@aurora-ds/components 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/actions/button/Button.props.d.ts +9 -0
- package/dist/cjs/components/actions/icon-button/IconButton.props.d.ts +9 -0
- package/dist/cjs/index.js +30 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/actions/button/Button.props.d.ts +9 -0
- package/dist/esm/components/actions/icon-button/IconButton.props.d.ts +9 -0
- package/dist/esm/index.js +30 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/package.json +1 -1
|
@@ -20,6 +20,12 @@ export type ButtonProps = {
|
|
|
20
20
|
disabled?: boolean;
|
|
21
21
|
/** Custom text color (overrides variant color) */
|
|
22
22
|
textColor?: keyof Theme['colors'];
|
|
23
|
+
/** Custom backgroundColor (overrides variant backgroundColor) */
|
|
24
|
+
backgroundColor?: keyof Theme['colors'];
|
|
25
|
+
/** Custom hover backgroundColor (overrides variant hover backgroundColor) */
|
|
26
|
+
hoverBackgroundColor?: keyof Theme['colors'];
|
|
27
|
+
/** Custom active backgroundColor (overrides variant active backgroundColor) */
|
|
28
|
+
activeBackgroundColor?: keyof Theme['colors'];
|
|
23
29
|
/** Size of the button */
|
|
24
30
|
size?: IconButtonSizes;
|
|
25
31
|
/** Accessibility label for screen readers */
|
|
@@ -37,5 +43,8 @@ export type ButtonStyleParams = {
|
|
|
37
43
|
variant?: ButtonVariants;
|
|
38
44
|
active?: boolean;
|
|
39
45
|
textColor?: keyof Theme['colors'];
|
|
46
|
+
backgroundColor?: keyof Theme['colors'];
|
|
47
|
+
hoverBackgroundColor?: keyof Theme['colors'];
|
|
48
|
+
activeBackgroundColor?: keyof Theme['colors'];
|
|
40
49
|
size?: IconButtonSizes;
|
|
41
50
|
};
|
|
@@ -16,6 +16,12 @@ export type IconButtonProps = {
|
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
/** Custom text/icon color (overrides variant color) */
|
|
18
18
|
textColor?: keyof Theme['colors'];
|
|
19
|
+
/** Custom backgroundColor (overrides variant backgroundColor) */
|
|
20
|
+
backgroundColor?: keyof Theme['colors'];
|
|
21
|
+
/** Custom hover backgroundColor (overrides variant hover backgroundColor) */
|
|
22
|
+
hoverBackgroundColor?: keyof Theme['colors'];
|
|
23
|
+
/** Custom active backgroundColor (overrides variant active backgroundColor) */
|
|
24
|
+
activeBackgroundColor?: keyof Theme['colors'];
|
|
19
25
|
/** Size of the icon button */
|
|
20
26
|
size?: IconButtonSizes;
|
|
21
27
|
/** Accessibility label for screen readers */
|
|
@@ -34,4 +40,7 @@ export type IconButtonStyleParams = {
|
|
|
34
40
|
active?: boolean;
|
|
35
41
|
size?: IconButtonSizes;
|
|
36
42
|
textColor?: keyof Theme['colors'];
|
|
43
|
+
backgroundColor?: keyof Theme['colors'];
|
|
44
|
+
hoverBackgroundColor?: keyof Theme['colors'];
|
|
45
|
+
activeBackgroundColor?: keyof Theme['colors'];
|
|
37
46
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -673,12 +673,15 @@ const BUTTON_STYLES = theme.createStyles((theme) => {
|
|
|
673
673
|
const variantStyles = getButtonVariantStyles(theme);
|
|
674
674
|
const sizeStyles = getButtonSizeStyles();
|
|
675
675
|
return {
|
|
676
|
-
root: ({ variant = 'contained', active = false, textColor, size = 'medium' }) => {
|
|
676
|
+
root: ({ variant = 'contained', active = false, textColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor, size = 'medium' }) => {
|
|
677
677
|
const sizeConfig = sizeStyles[size];
|
|
678
678
|
const overrides = textColor ? {
|
|
679
679
|
...(variant !== 'contained' && { color: theme.colors[textColor] }),
|
|
680
680
|
...(variant === 'outlined' && { border: `1px solid ${theme.colors[textColor]}` }),
|
|
681
681
|
} : {};
|
|
682
|
+
const backgroundOverride = backgroundColor ? { backgroundColor: theme.colors[backgroundColor] } : {};
|
|
683
|
+
const hoverBackgroundOverride = hoverBackgroundColor ? { backgroundColor: theme.colors[hoverBackgroundColor] } : {};
|
|
684
|
+
const activeBackgroundOverride = activeBackgroundColor ? { backgroundColor: theme.colors[activeBackgroundColor] } : {};
|
|
682
685
|
return {
|
|
683
686
|
display: 'inline-flex',
|
|
684
687
|
alignItems: 'center',
|
|
@@ -694,10 +697,17 @@ const BUTTON_STYLES = theme.createStyles((theme) => {
|
|
|
694
697
|
fontFamily: 'inherit',
|
|
695
698
|
...variantStyles[variant].default,
|
|
696
699
|
...(active && variantStyles[variant].pressed),
|
|
697
|
-
':hover':
|
|
698
|
-
|
|
700
|
+
':hover': {
|
|
701
|
+
...variantStyles[variant].hover,
|
|
702
|
+
...hoverBackgroundOverride,
|
|
703
|
+
},
|
|
704
|
+
':active': {
|
|
705
|
+
...variantStyles[variant].pressed,
|
|
706
|
+
...activeBackgroundOverride,
|
|
707
|
+
},
|
|
699
708
|
':disabled': variantStyles[variant].disabled,
|
|
700
709
|
...overrides,
|
|
710
|
+
...backgroundOverride,
|
|
701
711
|
};
|
|
702
712
|
},
|
|
703
713
|
};
|
|
@@ -711,12 +721,12 @@ const BUTTON_STYLES = theme.createStyles((theme) => {
|
|
|
711
721
|
* - `outlined`: Border only button
|
|
712
722
|
* - `text`: Text only button without background
|
|
713
723
|
*/
|
|
714
|
-
const Button = ({ label, startIcon, endIcon, variant = 'contained', active = false, onClick, disabled, type = 'button', textColor: customTextColor, size = 'medium', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
724
|
+
const Button = ({ label, startIcon, endIcon, variant = 'contained', active = false, onClick, disabled, type = 'button', textColor: customTextColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor, size = 'medium', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
715
725
|
const theme$1 = theme.useTheme();
|
|
716
726
|
const variantStyles = getButtonVariantStyles(theme$1);
|
|
717
727
|
const sizeStyles = getButtonSizeStyles();
|
|
718
728
|
const textColor = disabled ? 'disabledText' : (customTextColor ?? variantStyles[variant].textColor);
|
|
719
|
-
return (jsxRuntime.jsxs("button", { onClick: onClick, disabled: disabled, type: type, className: BUTTON_STYLES.root({ variant, active, textColor: customTextColor, size }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [startIcon && (jsxRuntime.jsx(Icon, { color: textColor, children: startIcon })), jsxRuntime.jsx(Text, { variant: 'label', color: textColor, fontSize: sizeStyles[size].fontSize, children: label }), endIcon && (jsxRuntime.jsx(Icon, { color: textColor, children: endIcon }))] }));
|
|
729
|
+
return (jsxRuntime.jsxs("button", { onClick: onClick, disabled: disabled, type: type, className: BUTTON_STYLES.root({ variant, active, textColor: customTextColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor, size }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [startIcon && (jsxRuntime.jsx(Icon, { color: textColor, children: startIcon })), jsxRuntime.jsx(Text, { variant: 'label', color: textColor, fontSize: sizeStyles[size].fontSize, children: label }), endIcon && (jsxRuntime.jsx(Icon, { color: textColor, children: endIcon }))] }));
|
|
720
730
|
};
|
|
721
731
|
Button.displayName = 'Button';
|
|
722
732
|
|
|
@@ -742,12 +752,15 @@ const ICON_BUTTON_STYLES = theme.createStyles((theme) => {
|
|
|
742
752
|
const variantStyles = getButtonVariantStyles(theme);
|
|
743
753
|
const sizeStyles = getIconButtonSizeStyles();
|
|
744
754
|
return {
|
|
745
|
-
root: ({ variant = 'contained', active = false, size = 'medium', textColor }) => {
|
|
755
|
+
root: ({ variant = 'contained', active = false, size = 'medium', textColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor }) => {
|
|
746
756
|
const sizeConfig = sizeStyles[size];
|
|
747
757
|
const overrides = textColor ? {
|
|
748
758
|
...(variant !== 'contained' && { color: theme.colors[textColor] }),
|
|
749
759
|
...(variant === 'outlined' && { border: `1px solid ${theme.colors[textColor]}` }),
|
|
750
760
|
} : {};
|
|
761
|
+
const backgroundOverride = backgroundColor ? { backgroundColor: theme.colors[backgroundColor] } : {};
|
|
762
|
+
const hoverBackgroundOverride = hoverBackgroundColor ? { backgroundColor: theme.colors[hoverBackgroundColor] } : {};
|
|
763
|
+
const activeBackgroundOverride = activeBackgroundColor ? { backgroundColor: theme.colors[activeBackgroundColor] } : {};
|
|
751
764
|
return {
|
|
752
765
|
display: 'inline-flex',
|
|
753
766
|
alignItems: 'center',
|
|
@@ -765,21 +778,28 @@ const ICON_BUTTON_STYLES = theme.createStyles((theme) => {
|
|
|
765
778
|
fontFamily: 'inherit',
|
|
766
779
|
...variantStyles[variant].default,
|
|
767
780
|
...(active && variantStyles[variant].pressed),
|
|
768
|
-
':hover':
|
|
769
|
-
|
|
781
|
+
':hover': {
|
|
782
|
+
...variantStyles[variant].hover,
|
|
783
|
+
...hoverBackgroundOverride,
|
|
784
|
+
},
|
|
785
|
+
':active': {
|
|
786
|
+
...variantStyles[variant].pressed,
|
|
787
|
+
...activeBackgroundOverride,
|
|
788
|
+
},
|
|
770
789
|
':disabled': variantStyles[variant].disabled,
|
|
771
790
|
...overrides,
|
|
791
|
+
...backgroundOverride,
|
|
772
792
|
};
|
|
773
793
|
},
|
|
774
794
|
};
|
|
775
795
|
});
|
|
776
796
|
|
|
777
|
-
const IconButton = ({ icon, variant = 'contained', active = false, type = 'button', onClick, disabled, textColor: customTextColor, size = 'medium', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
797
|
+
const IconButton = ({ icon, variant = 'contained', active = false, type = 'button', onClick, disabled, textColor: customTextColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor, size = 'medium', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
778
798
|
const theme$1 = theme.useTheme();
|
|
779
799
|
const variantStyles = getButtonVariantStyles(theme$1);
|
|
780
800
|
const textColor = disabled ? 'disabledText' : (customTextColor ?? variantStyles[variant].textColor);
|
|
781
801
|
const iconSize = getIconButtonSizeStyles()[size].iconSize;
|
|
782
|
-
return (jsxRuntime.jsx("button", { onClick: onClick, disabled: disabled, type: type, className: ICON_BUTTON_STYLES.root({ variant, active, size, textColor: customTextColor }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: jsxRuntime.jsx(Icon, { color: textColor, size: iconSize, children: icon }) }));
|
|
802
|
+
return (jsxRuntime.jsx("button", { onClick: onClick, disabled: disabled, type: type, className: ICON_BUTTON_STYLES.root({ variant, active, size, textColor: customTextColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: jsxRuntime.jsx(Icon, { color: textColor, size: iconSize, children: icon }) }));
|
|
783
803
|
};
|
|
784
804
|
IconButton.displayName = 'IconButton';
|
|
785
805
|
|