| 2 | import type {Theme} from '../ThemeProvider' |
| 3 | |
| 4 | export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme) => { |
| 5 | const style = { |
| 6 | default: { |
| 7 | color: 'btn.text', |
| 8 | backgroundColor: 'btn.bg', |
| 9 | boxShadow: `${theme?.shadows.btn.shadow}, ${theme?.shadows.btn.insetShadow}`, |
| 10 | '&:hover:not([disabled]):not([data-inactive])': { |
| 11 | backgroundColor: 'btn.hoverBg', |
| 12 | borderColor: `var(--button-default-borderColor-hover, ${theme?.colors.btn.hoverBorder})`, |
| 13 | }, |
| 14 | '&:active:not([disabled]):not([data-inactive])': { |
| 15 | backgroundColor: 'btn.activeBg', |
| 16 | borderColor: `var(--button-default-borderColor-active, ${theme?.colors.btn.activeBorder})`, |
| 17 | }, |
| 18 | '&:disabled': { |
| 19 | color: 'primer.fg.disabled', |
| 20 | borderColor: `var(--button-default-borderColor-disabled, ${theme?.colors.btn.border})`, |
| 21 | backgroundColor: `var(--button-default-bgColor-disabled, ${theme?.colors.input.disabledBg})`, |
| 22 | '[data-component=ButtonCounter]': { |
| 23 | color: 'inherit', |
| 24 | }, |
| 25 | }, |
| 26 | '&[aria-expanded=true]': { |
| 27 | backgroundColor: 'btn.activeBg', |
| 28 | borderColor: `var(--button-default-borderColor-active, ${theme?.colors.btn.activeBorder})`, |
| 29 | }, |
| 30 | '[data-component="leadingVisual"], [data-component="trailingVisual"], [data-component="trailingAction"]': { |
| 31 | color: `var(--button-color, ${theme?.colors.fg.muted})`, |
| 32 | }, |
| 33 | '[data-component=ButtonCounter]': { |
| 34 | backgroundColor: 'btn.counterBg', |
| 35 | }, |
| 36 | '&[data-component="IconButton"][data-no-visuals]': { |
| 37 | color: 'fg.muted', |
| 38 | }, |
| 39 | }, |
| 40 | primary: { |
| 41 | color: 'btn.primary.text', |
| 42 | backgroundColor: 'btn.primary.bg', |
| 43 | borderColor: 'btn.primary.border', |
| 44 | boxShadow: `${theme?.shadows.btn.primary.shadow}`, |
| 45 | '&:hover:not([disabled]):not([data-inactive])': { |
| 46 | color: 'btn.primary.hoverText', |
| 47 | backgroundColor: 'btn.primary.hoverBg', |
| 48 | }, |
| 49 | '&:focus:not([disabled])': { |
| 50 | boxShadow: 'inset 0 0 0 3px', |
| 51 | }, |
| 52 | '&:focus-visible:not([disabled])': { |
| 53 | boxShadow: 'inset 0 0 0 3px', |
| 54 | }, |
| 55 | '&:active:not([disabled]):not([data-inactive])': { |
| 56 | backgroundColor: 'btn.primary.selectedBg', |
| 57 | boxShadow: `${theme?.shadows.btn.primary.selectedShadow}`, |
| 58 | }, |
| 59 | '&:disabled': { |
| 60 | color: 'btn.primary.disabledText', |
| 61 | backgroundColor: 'btn.primary.disabledBg', |