Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/ui-buttons/src/BaseButton/v2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ class BaseButton extends Component<BaseButtonProps> {

const { hasOnlyIconVisible } = this
const iconSize = buttonSizeToIconSize[size!]
const iconColor = buttonColorToIconColor[color!]
const iconColor =
this.isDisabled && color === 'ai-secondary'
? 'inherit'
: buttonColorToIconColor[color!]
const wrappedIcon = (
<span css={styles?.iconSVG}>
{renderIconWithProps(renderIcon, iconSize, iconColor)}
Expand Down
130 changes: 69 additions & 61 deletions packages/ui-buttons/src/BaseButton/v2/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ const generateStyle = (
boxShadow: componentTheme.secondaryGhostHoverBoxShadow
},
disabled: {
background: 'transparent'
background: 'transparent',
borderColor: componentTheme.secondaryDisabledBorderColor,
color: componentTheme.secondaryDisabledTextColor
}
},

Expand Down Expand Up @@ -425,70 +427,76 @@ const generateStyle = (
}

return {
baseButton: isEnabled
? {
label: 'baseButton',
appearance: 'none',
textDecoration: 'none' /* for links styled as buttons */,
touchAction: 'manipulation',
// This sets the focus ring's border radius displayed by the `View`
borderRadius:
size === 'condensedSmall' || size === 'condensedMedium'
? componentTheme.borderRadiusSm
: componentTheme.borderRadius,
...shapeVariants[shape!],
// Prevents vertical stretching in flex parents with fixed height
// Avoids background/focus ring distortion
height: 'fit-content',
baseButton: {
...(isEnabled
? {
label: 'baseButton',
appearance: 'none',
textDecoration: 'none' /* for links styled as buttons */,
touchAction: 'manipulation',
// This sets the focus ring's border radius displayed by the `View`
borderRadius:
size === 'condensedSmall' || size === 'condensedMedium'
? componentTheme.borderRadiusSm
: componentTheme.borderRadius,
...shapeVariants[shape!],
// Prevents vertical stretching in flex parents with fixed height
// Avoids background/focus ring distortion
height: 'fit-content',

'&::-moz-focus-inner': {
border: '0' /* removes default dotted focus outline in Firefox */
},
'*': {
pointerEvents:
'none' /* Ensures that button or link is always the event target */
},
'&:focus': {
textDecoration: 'none'
},
'&:hover > [class$=-baseButton__content]':
colorVariants[color!].hover,
'&:active > [class$=-baseButton__content]':
colorVariants[color!].active,
'&::-moz-focus-inner': {
border: '0' /* removes default dotted focus outline in Firefox */
},
'*': {
pointerEvents:
'none' /* Ensures that button or link is always the event target */
},
'&:focus': {
textDecoration: 'none'
},
'&:hover > [class$=-baseButton__content]':
colorVariants[color!].hover,
'&:active > [class$=-baseButton__content]':
colorVariants[color!].active
}
: // When not enabled (disabled/readonly) skip all interactive styles (hover/active/focus)
{
textDecoration: 'none',
label: 'baseButton',
appearance: 'none'
}),

//TODO not the greatest solution. Must be stronger than the same &&& enforcement of <View>
...(color === 'ai-secondary'
? {
'&&&&&&&&&&': {
padding: componentTheme.borderWidth,
...(shape !== 'circle'
? {
borderRadius: `calc(${componentTheme.borderRadius} + ${componentTheme.borderWidth})`
}
: { borderRadius: componentTheme.borderRadiusFull }),
'&::before': {
content: '""',
position: 'absolute',
inset: '0',
borderRadius: 'inherit',
padding: componentTheme.borderWidth,
background: `linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%)`,
WebkitMask:
'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
WebkitMaskComposite: 'xor',
mask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
maskComposite: 'exclude',
pointerEvents: 'none'
//TODO not the greatest solution. Must be stronger than the same &&& enforcement of <View>
// The ai-secondary border must render in both enabled and disabled states.
...(color === 'ai-secondary'
? {
'&&&&&&&&&&': {
padding: componentTheme.borderWidth,
...(shape !== 'circle'
? {
borderRadius: `calc(${componentTheme.borderRadius} + ${componentTheme.borderWidth})`
}
}
: { borderRadius: componentTheme.borderRadiusFull }),
'&::before': {
content: '""',
position: 'absolute',
inset: '0',
borderRadius: 'inherit',
padding: componentTheme.borderWidth,
background: isDisabled
? componentTheme.aiSecondaryDisabledBorderColor
: `linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%)`,
WebkitMask:
'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
WebkitMaskComposite: 'xor',
mask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
maskComposite: 'exclude',
pointerEvents: 'none'
}
: {})
}
: {
textDecoration: 'none',
label: 'baseButton',
appearance: 'none'
},
}
}
: {})
},
content: {
label: 'baseButton__content',
opacity: componentTheme.opacityBase,
Expand Down
43 changes: 31 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading