@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.
@@ -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/esm/index.js CHANGED
@@ -111,7 +111,7 @@ const getTextVariantStyles = (theme) => ({
111
111
  },
112
112
  p: {
113
113
  tag: 'p',
114
- fontSize: theme.fontSize.md,
114
+ fontSize: theme.fontSize.sm,
115
115
  fontWeight: theme.fontWeight.regular,
116
116
  lineHeight: theme.lineHeight.relaxed,
117
117
  },
@@ -123,7 +123,7 @@ const getTextVariantStyles = (theme) => ({
123
123
  },
124
124
  label: {
125
125
  tag: 'label',
126
- fontSize: theme.fontSize.md,
126
+ fontSize: theme.fontSize.sm,
127
127
  fontWeight: theme.fontWeight.medium,
128
128
  lineHeight: theme.lineHeight.normal,
129
129
  },
@@ -574,7 +574,7 @@ const getButtonSizeStyles = () => ({
574
574
  vertical: 'sm',
575
575
  horizontal: 'md'
576
576
  },
577
- fontSize: 'md'
577
+ fontSize: 'sm'
578
578
  },
579
579
  large: {
580
580
  height: BUTTON_SIZE + 8,
@@ -582,7 +582,7 @@ const getButtonSizeStyles = () => ({
582
582
  vertical: 'sm',
583
583
  horizontal: 'lg'
584
584
  },
585
- fontSize: 'lg'
585
+ fontSize: 'md'
586
586
  }
587
587
  });
588
588
 
@@ -671,12 +671,15 @@ const BUTTON_STYLES = createStyles((theme) => {
671
671
  const variantStyles = getButtonVariantStyles(theme);
672
672
  const sizeStyles = getButtonSizeStyles();
673
673
  return {
674
- root: ({ variant = 'contained', active = false, textColor, size = 'medium' }) => {
674
+ root: ({ variant = 'contained', active = false, textColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor, size = 'medium' }) => {
675
675
  const sizeConfig = sizeStyles[size];
676
676
  const overrides = textColor ? {
677
677
  ...(variant !== 'contained' && { color: theme.colors[textColor] }),
678
678
  ...(variant === 'outlined' && { border: `1px solid ${theme.colors[textColor]}` }),
679
679
  } : {};
680
+ const backgroundOverride = backgroundColor ? { backgroundColor: theme.colors[backgroundColor] } : {};
681
+ const hoverBackgroundOverride = hoverBackgroundColor ? { backgroundColor: theme.colors[hoverBackgroundColor] } : {};
682
+ const activeBackgroundOverride = activeBackgroundColor ? { backgroundColor: theme.colors[activeBackgroundColor] } : {};
680
683
  return {
681
684
  display: 'inline-flex',
682
685
  alignItems: 'center',
@@ -692,10 +695,17 @@ const BUTTON_STYLES = createStyles((theme) => {
692
695
  fontFamily: 'inherit',
693
696
  ...variantStyles[variant].default,
694
697
  ...(active && variantStyles[variant].pressed),
695
- ':hover': variantStyles[variant].hover,
696
- ':active': variantStyles[variant].pressed,
698
+ ':hover': {
699
+ ...variantStyles[variant].hover,
700
+ ...hoverBackgroundOverride,
701
+ },
702
+ ':active': {
703
+ ...variantStyles[variant].pressed,
704
+ ...activeBackgroundOverride,
705
+ },
697
706
  ':disabled': variantStyles[variant].disabled,
698
707
  ...overrides,
708
+ ...backgroundOverride,
699
709
  };
700
710
  },
701
711
  };
@@ -709,12 +719,12 @@ const BUTTON_STYLES = createStyles((theme) => {
709
719
  * - `outlined`: Border only button
710
720
  * - `text`: Text only button without background
711
721
  */
712
- const Button = ({ label, startIcon, endIcon, variant = 'contained', active = false, onClick, disabled, type = 'button', textColor: customTextColor, size = 'medium', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
722
+ 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, }) => {
713
723
  const theme = useTheme();
714
724
  const variantStyles = getButtonVariantStyles(theme);
715
725
  const sizeStyles = getButtonSizeStyles();
716
726
  const textColor = disabled ? 'disabledText' : (customTextColor ?? variantStyles[variant].textColor);
717
- return (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 && (jsx(Icon, { color: textColor, children: startIcon })), jsx(Text, { variant: 'label', color: textColor, fontSize: sizeStyles[size].fontSize, children: label }), endIcon && (jsx(Icon, { color: textColor, children: endIcon }))] }));
727
+ return (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 && (jsx(Icon, { color: textColor, children: startIcon })), jsx(Text, { variant: 'label', color: textColor, fontSize: sizeStyles[size].fontSize, children: label }), endIcon && (jsx(Icon, { color: textColor, children: endIcon }))] }));
718
728
  };
719
729
  Button.displayName = 'Button';
720
730
 
@@ -740,12 +750,15 @@ const ICON_BUTTON_STYLES = createStyles((theme) => {
740
750
  const variantStyles = getButtonVariantStyles(theme);
741
751
  const sizeStyles = getIconButtonSizeStyles();
742
752
  return {
743
- root: ({ variant = 'contained', active = false, size = 'medium', textColor }) => {
753
+ root: ({ variant = 'contained', active = false, size = 'medium', textColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor }) => {
744
754
  const sizeConfig = sizeStyles[size];
745
755
  const overrides = textColor ? {
746
756
  ...(variant !== 'contained' && { color: theme.colors[textColor] }),
747
757
  ...(variant === 'outlined' && { border: `1px solid ${theme.colors[textColor]}` }),
748
758
  } : {};
759
+ const backgroundOverride = backgroundColor ? { backgroundColor: theme.colors[backgroundColor] } : {};
760
+ const hoverBackgroundOverride = hoverBackgroundColor ? { backgroundColor: theme.colors[hoverBackgroundColor] } : {};
761
+ const activeBackgroundOverride = activeBackgroundColor ? { backgroundColor: theme.colors[activeBackgroundColor] } : {};
749
762
  return {
750
763
  display: 'inline-flex',
751
764
  alignItems: 'center',
@@ -763,21 +776,28 @@ const ICON_BUTTON_STYLES = createStyles((theme) => {
763
776
  fontFamily: 'inherit',
764
777
  ...variantStyles[variant].default,
765
778
  ...(active && variantStyles[variant].pressed),
766
- ':hover': variantStyles[variant].hover,
767
- ':active': variantStyles[variant].pressed,
779
+ ':hover': {
780
+ ...variantStyles[variant].hover,
781
+ ...hoverBackgroundOverride,
782
+ },
783
+ ':active': {
784
+ ...variantStyles[variant].pressed,
785
+ ...activeBackgroundOverride,
786
+ },
768
787
  ':disabled': variantStyles[variant].disabled,
769
788
  ...overrides,
789
+ ...backgroundOverride,
770
790
  };
771
791
  },
772
792
  };
773
793
  });
774
794
 
775
- const IconButton = ({ icon, variant = 'contained', active = false, type = 'button', onClick, disabled, textColor: customTextColor, size = 'medium', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
795
+ const IconButton = ({ icon, variant = 'contained', active = false, type = 'button', onClick, disabled, textColor: customTextColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor, size = 'medium', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
776
796
  const theme = useTheme();
777
797
  const variantStyles = getButtonVariantStyles(theme);
778
798
  const textColor = disabled ? 'disabledText' : (customTextColor ?? variantStyles[variant].textColor);
779
799
  const iconSize = getIconButtonSizeStyles()[size].iconSize;
780
- return (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: jsx(Icon, { color: textColor, size: iconSize, children: icon }) }));
800
+ return (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: jsx(Icon, { color: textColor, size: iconSize, children: icon }) }));
781
801
  };
782
802
  IconButton.displayName = 'IconButton';
783
803
 
@@ -848,7 +868,7 @@ const INPUT_STYLES = createStyles((theme) => ({
848
868
  paddingRight: `calc(${theme.spacing.md} + ${hasEndIcon ? '1.5rem' : '0px'} + ${hasPasswordToggle ? '1.5rem' : '0px'})`,
849
869
  border: `1px solid ${theme.colors.border}`,
850
870
  borderRadius: theme.radius.md,
851
- fontSize: theme.fontSize.md,
871
+ fontSize: theme.fontSize.sm,
852
872
  fontFamily: 'inherit',
853
873
  backgroundColor: theme.colors.surface,
854
874
  color: theme.colors.text,
@@ -865,7 +885,7 @@ const INPUT_STYLES = createStyles((theme) => ({
865
885
  },
866
886
  '::placeholder': {
867
887
  color: theme.colors.textTertiary,
868
- fontSize: theme.fontSize.md,
888
+ fontSize: theme.fontSize.sm,
869
889
  },
870
890
  ...(disabled && {
871
891
  color: theme.colors.disabledText,
@@ -970,7 +990,7 @@ const TEXTAREA_STYLES = createStyles((theme) => ({
970
990
  padding: `${theme.spacing.sm} ${theme.spacing.md}`,
971
991
  border: `1px solid ${theme.colors.border}`,
972
992
  borderRadius: theme.radius.md,
973
- fontSize: theme.fontSize.md,
993
+ fontSize: theme.fontSize.sm,
974
994
  fontFamily: 'inherit',
975
995
  backgroundColor: theme.colors.surface,
976
996
  color: theme.colors.text,
@@ -984,7 +1004,7 @@ const TEXTAREA_STYLES = createStyles((theme) => ({
984
1004
  },
985
1005
  '::placeholder': {
986
1006
  color: theme.colors.textTertiary,
987
- fontSize: theme.fontSize.md,
1007
+ fontSize: theme.fontSize.sm,
988
1008
  textOverflow: 'ellipsis',
989
1009
  overflow: 'hidden',
990
1010
  whiteSpace: 'nowrap',