From 2481ae2547a49fb53773d029088ba2633c481ee8 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Tue, 2 Apr 2024 11:57:41 +0300 Subject: [PATCH] Update SelectButton --- .../selectbutton/style/SelectButtonStyle.js | 1 - .../primeone/base/selectbutton/index.js | 78 ++++--------------- .../primeone/base/togglebutton/index.js | 2 + .../presets/aura/selectbutton/index.js | 18 ----- .../presets/aura/togglebutton/index.js | 2 + doc/theming/styled/utils/DTDoc.vue | 1 + 6 files changed, 21 insertions(+), 81 deletions(-) diff --git a/components/lib/selectbutton/style/SelectButtonStyle.js b/components/lib/selectbutton/style/SelectButtonStyle.js index ebb43c206..510e71ae5 100644 --- a/components/lib/selectbutton/style/SelectButtonStyle.js +++ b/components/lib/selectbutton/style/SelectButtonStyle.js @@ -4,7 +4,6 @@ const classes = { root: ({ props }) => [ 'p-selectbutton p-component', { - 'p-disabled': props.disabled, 'p-invalid': props.invalid } ], diff --git a/components/lib/themes/primeone/base/selectbutton/index.js b/components/lib/themes/primeone/base/selectbutton/index.js index 4a424adf2..52885db37 100644 --- a/components/lib/themes/primeone/base/selectbutton/index.js +++ b/components/lib/themes/primeone/base/selectbutton/index.js @@ -4,78 +4,32 @@ export default { display: inline-flex; user-select: none; vertical-align: bottom; - border: 1px solid transparent; - background: ${dt('selectbutton.background')}; - border-radius: ${dt('rounded.base')}; outline-color: transparent; - transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; -} - -.p-selectbutton .p-button { - flex: 1 1 auto; - background: transparent; - border: 0 none; - color: ${dt('selectbutton.item.color')}; - transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; - outline-color: transparent; - padding: 0.5rem 1rem; - display: inline-flex; - align-items: center; - justify-content: center; border-radius: ${dt('rounded.base')}; - gap: 0.5rem; +} + +.p-selectbutton .p-togglebutton { + border-radius: 0; +} + +.p-selectbutton .p-togglebutton:focus-visible { position: relative; - cursor: pointer; + z-index: 1; } -.p-selectbutton .p-button::before { - content: ""; - background: transparent; - transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; - position: absolute; - left: 0.25rem; - top: 0.25rem; - width: calc(100% - 0.5rem); - height: calc(100% - 0.5rem); - border-radius: ${dt('rounded.sm')}; +.p-selectbutton .p-togglebutton:first-child { + border-top-left-radius: ${dt('rounded.base')}; + border-bottom-left-radius: ${dt('rounded.base')}; } -.p-selectbutton .p-button .p-button-label { - position: relative; - transition: none; -} - -.p-selectbutton .p-button:not(.p-disabled):not(.p-highlight):hover { - color: ${dt('selectbutton.item.hover.color')}; -} - -.p-selectbutton .p-button.p-highlight { - color: ${dt('selectbutton.item.checked.color')}; -} - -.p-selectbutton .p-button.p-highlight::before { - background: ${dt('selectbutton.item.checked.background')}; - box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.02), 0px 1px 2px 0px rgba(0, 0, 0, 0.04); -} - -.p-selectbutton .p-button:focus-visible { - outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')}; - outline-offset: ${dt('focus.ring.offset')}; +.p-selectbutton .p-togglebutton:last-child { + border-top-right-radius: ${dt('rounded.base')}; + border-bottom-right-radius: ${dt('rounded.base')}; } .p-selectbutton.p-invalid { - border-color: ${dt('selectbutton.invalid.border.color')}; -} - -.p-selectbutton.p-disabled { - opacity: 1; - background: ${dt('selectbutton.disabled.background')}; -} - -.p-selectbutton.p-disabled .p-button, -.p-selectbutton .p-button.p-disabled { - background: ${dt('selectbutton.disabled.background')}; - color: ${dt('selectbutton.item.disabled.color')}; + outline: 1px solid ${dt('selectbutton.invalid.border.color')}; + outline-offset: 0; } ` }; diff --git a/components/lib/themes/primeone/base/togglebutton/index.js b/components/lib/themes/primeone/base/togglebutton/index.js index b0fbdd05a..95e3d327b 100644 --- a/components/lib/themes/primeone/base/togglebutton/index.js +++ b/components/lib/themes/primeone/base/togglebutton/index.js @@ -62,7 +62,9 @@ export default { .p-togglebutton:disabled { opacity: 1; + cursor: default; background: ${dt('togglebutton.disabled.background')}; + border-color: ${dt('togglebutton.disabled.border.color')}; color: ${dt('togglebutton.disabled.color')}; } diff --git a/components/lib/themes/primeone/presets/aura/selectbutton/index.js b/components/lib/themes/primeone/presets/aura/selectbutton/index.js index 2ae117af0..d22a34184 100644 --- a/components/lib/themes/primeone/presets/aura/selectbutton/index.js +++ b/components/lib/themes/primeone/presets/aura/selectbutton/index.js @@ -2,30 +2,12 @@ export default { colorScheme: { light: { root: { - background: '{surface.100}', - disabledBackground: '{form.field.background.disabled}', invalidBorderColor: '{form.field.invalid.border.color}' - }, - item: { - checkedBackground: '{surface.0}', - color: '{surface.500}', - hoverColor: '{surface.700}', - checkedColor: '{surface.900}', - disabledColor: '{form.field.text.color.disabled}' } }, dark: { root: { - background: '{surface.950}', - disabledBackground: '{form.field.background.disabled}', invalidBorderColor: '{form.field.invalid.border.color}' - }, - item: { - checkedBackground: '{surface.800}', - color: '{surface.400}', - hoverColor: '{surface.300}', - checkedColor: '{surface.0}', - disabledColor: '{form.field.text.color.disabled}' } } } diff --git a/components/lib/themes/primeone/presets/aura/togglebutton/index.js b/components/lib/themes/primeone/presets/aura/togglebutton/index.js index bfe4376c0..94ce34b78 100644 --- a/components/lib/themes/primeone/presets/aura/togglebutton/index.js +++ b/components/lib/themes/primeone/presets/aura/togglebutton/index.js @@ -6,6 +6,7 @@ export default { checkedBackground: '{surface.0}', disabledBackground: '{form.field.disabled.background}', borderColor: '{surface.100}', + disabledBorderColor: '{form.field.disabled.background}', invalidBorderColor: '{form.field.invalid.border.color}', color: '{surface.500}', hoverColor: '{surface.700}', @@ -25,6 +26,7 @@ export default { checkedBackground: '{surface.800}', disabledBackground: '{form.field.disabled.background}', borderColor: '{surface.950}', + disabledBorderColor: '{form.field.disabled.background}', invalidBorderColor: '{form.field.invalid.border.color}', color: '{surface.400}', hoverColor: '{surface.300}', diff --git a/doc/theming/styled/utils/DTDoc.vue b/doc/theming/styled/utils/DTDoc.vue index 2470deebe..5c012a050 100644 --- a/doc/theming/styled/utils/DTDoc.vue +++ b/doc/theming/styled/utils/DTDoc.vue @@ -1,5 +1,6 @@