@aurora-ds/components 0.16.0 → 0.16.2
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 +38 -18
- 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 +38 -18
- 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
|
@@ -113,7 +113,7 @@ const getTextVariantStyles = (theme) => ({
|
|
|
113
113
|
},
|
|
114
114
|
p: {
|
|
115
115
|
tag: 'p',
|
|
116
|
-
fontSize: theme.fontSize.
|
|
116
|
+
fontSize: theme.fontSize.sm,
|
|
117
117
|
fontWeight: theme.fontWeight.regular,
|
|
118
118
|
lineHeight: theme.lineHeight.relaxed,
|
|
119
119
|
},
|
|
@@ -125,7 +125,7 @@ const getTextVariantStyles = (theme) => ({
|
|
|
125
125
|
},
|
|
126
126
|
label: {
|
|
127
127
|
tag: 'label',
|
|
128
|
-
fontSize: theme.fontSize.
|
|
128
|
+
fontSize: theme.fontSize.sm,
|
|
129
129
|
fontWeight: theme.fontWeight.medium,
|
|
130
130
|
lineHeight: theme.lineHeight.normal,
|
|
131
131
|
},
|
|
@@ -576,7 +576,7 @@ const getButtonSizeStyles = () => ({
|
|
|
576
576
|
vertical: 'sm',
|
|
577
577
|
horizontal: 'md'
|
|
578
578
|
},
|
|
579
|
-
fontSize: '
|
|
579
|
+
fontSize: 'sm'
|
|
580
580
|
},
|
|
581
581
|
large: {
|
|
582
582
|
height: BUTTON_SIZE + 8,
|
|
@@ -584,7 +584,7 @@ const getButtonSizeStyles = () => ({
|
|
|
584
584
|
vertical: 'sm',
|
|
585
585
|
horizontal: 'lg'
|
|
586
586
|
},
|
|
587
|
-
fontSize: '
|
|
587
|
+
fontSize: 'md'
|
|
588
588
|
}
|
|
589
589
|
});
|
|
590
590
|
|
|
@@ -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
|
|
|
@@ -850,7 +870,7 @@ const INPUT_STYLES = theme.createStyles((theme) => ({
|
|
|
850
870
|
paddingRight: `calc(${theme.spacing.md} + ${hasEndIcon ? '1.5rem' : '0px'} + ${hasPasswordToggle ? '1.5rem' : '0px'})`,
|
|
851
871
|
border: `1px solid ${theme.colors.border}`,
|
|
852
872
|
borderRadius: theme.radius.md,
|
|
853
|
-
fontSize: theme.fontSize.
|
|
873
|
+
fontSize: theme.fontSize.sm,
|
|
854
874
|
fontFamily: 'inherit',
|
|
855
875
|
backgroundColor: theme.colors.surface,
|
|
856
876
|
color: theme.colors.text,
|
|
@@ -867,7 +887,7 @@ const INPUT_STYLES = theme.createStyles((theme) => ({
|
|
|
867
887
|
},
|
|
868
888
|
'::placeholder': {
|
|
869
889
|
color: theme.colors.textTertiary,
|
|
870
|
-
fontSize: theme.fontSize.
|
|
890
|
+
fontSize: theme.fontSize.sm,
|
|
871
891
|
},
|
|
872
892
|
...(disabled && {
|
|
873
893
|
color: theme.colors.disabledText,
|
|
@@ -972,7 +992,7 @@ const TEXTAREA_STYLES = theme.createStyles((theme) => ({
|
|
|
972
992
|
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
973
993
|
border: `1px solid ${theme.colors.border}`,
|
|
974
994
|
borderRadius: theme.radius.md,
|
|
975
|
-
fontSize: theme.fontSize.
|
|
995
|
+
fontSize: theme.fontSize.sm,
|
|
976
996
|
fontFamily: 'inherit',
|
|
977
997
|
backgroundColor: theme.colors.surface,
|
|
978
998
|
color: theme.colors.text,
|
|
@@ -986,7 +1006,7 @@ const TEXTAREA_STYLES = theme.createStyles((theme) => ({
|
|
|
986
1006
|
},
|
|
987
1007
|
'::placeholder': {
|
|
988
1008
|
color: theme.colors.textTertiary,
|
|
989
|
-
fontSize: theme.fontSize.
|
|
1009
|
+
fontSize: theme.fontSize.sm,
|
|
990
1010
|
textOverflow: 'ellipsis',
|
|
991
1011
|
overflow: 'hidden',
|
|
992
1012
|
whiteSpace: 'nowrap',
|