@aurora-ds/components 0.22.4 → 0.22.5

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.
@@ -5,7 +5,7 @@ import { IconProps } from '@components/foundation/icon/Icon.props.ts';
5
5
  *
6
6
  * **Features:**
7
7
  * - Theme-aware sizing via font sizes
8
- * - Color and fill support from theme
8
+ * - Color (stroke) and fill support from theme
9
9
  * - Optional background with padding and border radius
10
10
  * - Transition animation on color changes
11
11
  *
@@ -13,9 +13,15 @@ import { IconProps } from '@components/foundation/icon/Icon.props.ts';
13
13
  * ```tsx
14
14
  * import { SomeIcon } from 'some-icon-library'
15
15
  *
16
+ * // Stroke color only
16
17
  * <Icon size="md" color="primary">
17
18
  * <SomeIcon />
18
19
  * </Icon>
20
+ *
21
+ * // With fill color
22
+ * <Icon size="md" color="primary" fill="secondary">
23
+ * <SomeIcon />
24
+ * </Icon>
19
25
  * ```
20
26
  *
21
27
  * **With background:**
@@ -23,6 +29,7 @@ import { IconProps } from '@components/foundation/icon/Icon.props.ts';
23
29
  * <Icon
24
30
  * size="lg"
25
31
  * color="onPrimary"
32
+ * fill="onPrimary"
26
33
  * backgroundColor="primary"
27
34
  * padding="sm"
28
35
  * borderRadius="full"
@@ -5,6 +5,8 @@ export type IconProps = PropsWithChildren<{
5
5
  size?: keyof ThemeContract['fontSize'];
6
6
  /** Icon stroke/line color from theme */
7
7
  color?: keyof ThemeContract['colors'];
8
+ /** Icon fill color from theme (for filled icons) */
9
+ fill?: keyof ThemeContract['colors'];
8
10
  /** Background color from theme */
9
11
  backgroundColor?: keyof ThemeContract['colors'];
10
12
  /** Padding from theme spacing */
@@ -1,3 +1,3 @@
1
1
  export declare const ICON_STYLES: {
2
- root: (size?: keyof import("@/interfaces").ThemeFontSizeContract | undefined, color?: keyof import("@/interfaces").ThemeColorContract | undefined, backgroundColor?: keyof import("@/interfaces").ThemeColorContract | undefined, padding?: keyof import("@/interfaces").ThemeSpacingContract | undefined, borderRadius?: keyof import("@/interfaces").ThemeRadiusContract | undefined) => string;
2
+ root: (size?: keyof import("@/interfaces").ThemeFontSizeContract | undefined, color?: keyof import("@/interfaces").ThemeColorContract | undefined, fill?: keyof import("@/interfaces").ThemeColorContract | undefined, backgroundColor?: keyof import("@/interfaces").ThemeColorContract | undefined, padding?: keyof import("@/interfaces").ThemeSpacingContract | undefined, borderRadius?: keyof import("@/interfaces").ThemeRadiusContract | undefined) => string;
3
3
  };
package/dist/esm/index.js CHANGED
@@ -4,13 +4,13 @@ import { createStyles, useTheme, keyframes, colors } from '@aurora-ds/theme';
4
4
  import { createPortal } from 'react-dom';
5
5
 
6
6
  const ICON_STYLES = createStyles((theme) => ({
7
- root: (size, color, backgroundColor, padding, borderRadius) => ({
7
+ root: (size, color, fill, backgroundColor, padding, borderRadius) => ({
8
8
  boxSizing: 'content-box',
9
9
  display: 'flex',
10
10
  alignItems: 'center',
11
11
  justifyContent: 'center',
12
12
  overflow: 'hidden',
13
- transition: 'color 150ms ease-in-out',
13
+ transition: 'color 150ms ease-in-out, fill 150ms ease-in-out',
14
14
  flexShrink: 0,
15
15
  lineHeight: 0,
16
16
  height: theme.fontSize[size ?? 'md'],
@@ -18,9 +18,13 @@ const ICON_STYLES = createStyles((theme) => ({
18
18
  minWidth: theme.fontSize[size ?? 'md'],
19
19
  minHeight: theme.fontSize[size ?? 'md'],
20
20
  color: color ? theme.colors[color] : 'inherit',
21
+ fill: fill ? theme.colors[fill] : undefined,
21
22
  backgroundColor: backgroundColor ? theme.colors[backgroundColor] : undefined,
22
23
  padding: padding ? theme.spacing[padding] : 0,
23
24
  borderRadius: theme.radius[borderRadius ?? 'md'],
25
+ '& svg': {
26
+ fill: fill ? theme.colors[fill] : undefined,
27
+ },
24
28
  }),
25
29
  }));
26
30
 
@@ -29,7 +33,7 @@ const ICON_STYLES = createStyles((theme) => ({
29
33
  *
30
34
  * **Features:**
31
35
  * - Theme-aware sizing via font sizes
32
- * - Color and fill support from theme
36
+ * - Color (stroke) and fill support from theme
33
37
  * - Optional background with padding and border radius
34
38
  * - Transition animation on color changes
35
39
  *
@@ -37,9 +41,15 @@ const ICON_STYLES = createStyles((theme) => ({
37
41
  * ```tsx
38
42
  * import { SomeIcon } from 'some-icon-library'
39
43
  *
44
+ * // Stroke color only
40
45
  * <Icon size="md" color="primary">
41
46
  * <SomeIcon />
42
47
  * </Icon>
48
+ *
49
+ * // With fill color
50
+ * <Icon size="md" color="primary" fill="secondary">
51
+ * <SomeIcon />
52
+ * </Icon>
43
53
  * ```
44
54
  *
45
55
  * **With background:**
@@ -47,6 +57,7 @@ const ICON_STYLES = createStyles((theme) => ({
47
57
  * <Icon
48
58
  * size="lg"
49
59
  * color="onPrimary"
60
+ * fill="onPrimary"
50
61
  * backgroundColor="primary"
51
62
  * padding="sm"
52
63
  * borderRadius="full"
@@ -55,7 +66,7 @@ const ICON_STYLES = createStyles((theme) => ({
55
66
  * </Icon>
56
67
  * ```
57
68
  */
58
- const Icon = ({ children, size, color, backgroundColor, padding, borderRadius, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
69
+ const Icon = ({ children, size, color, fill, backgroundColor, padding, borderRadius, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
59
70
  // Clone child element to apply width and height
60
71
  const child = Children.only(children);
61
72
  const styledChild = isValidElement(child)
@@ -64,7 +75,7 @@ const Icon = ({ children, size, color, backgroundColor, padding, borderRadius, a
64
75
  height: '100%',
65
76
  })
66
77
  : child;
67
- return (jsx("div", { className: ICON_STYLES.root(size, color, backgroundColor, padding, borderRadius), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: styledChild }));
78
+ return (jsx("div", { className: ICON_STYLES.root(size, color, fill, backgroundColor, padding, borderRadius), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: styledChild }));
68
79
  };
69
80
  Icon.displayName = 'Icon';
70
81