@common-origin/design-system 2.21.0 → 2.23.0

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.
Files changed (79) hide show
  1. package/dist/client.js +261 -208
  2. package/dist/client.js.map +1 -1
  3. package/dist/components/atoms/Badge/Badge.d.mts +16 -4
  4. package/dist/components/atoms/Badge/Badge.d.ts +16 -4
  5. package/dist/components/atoms/Badge/Badge.mjs +4 -5
  6. package/dist/components/atoms/Badge/index.d.mts +1 -1
  7. package/dist/components/atoms/Badge/index.d.ts +1 -1
  8. package/dist/components/atoms/Box/Box.d.mts +25 -1
  9. package/dist/components/atoms/Box/Box.d.ts +25 -1
  10. package/dist/components/atoms/Box/Box.mjs +5 -2
  11. package/dist/components/atoms/Button/Button.mjs +1 -1
  12. package/dist/components/atoms/CategoryLabel/CategoryLabel.d.mts +23 -8
  13. package/dist/components/atoms/CategoryLabel/CategoryLabel.d.ts +23 -8
  14. package/dist/components/atoms/CategoryLabel/CategoryLabel.mjs +31 -18
  15. package/dist/components/atoms/CategoryLabel/index.d.mts +1 -1
  16. package/dist/components/atoms/CategoryLabel/index.d.ts +1 -1
  17. package/dist/components/atoms/Chip/SuggestionChip.mjs +1 -1
  18. package/dist/components/atoms/Chip/shared/utils.mjs +1 -1
  19. package/dist/components/atoms/Chip/shared/utils.mjs.map +1 -1
  20. package/dist/components/atoms/Icon/Icon.mjs +1 -1
  21. package/dist/components/atoms/MoneyDisplay/MoneyDisplay.mjs +14 -60
  22. package/dist/components/atoms/StatusBadge/StatusBadge.d.mts +3 -2
  23. package/dist/components/atoms/StatusBadge/StatusBadge.d.ts +3 -2
  24. package/dist/components/atoms/StatusBadge/StatusBadge.mjs +1 -1
  25. package/dist/components/atoms/StatusBadge/StatusBadge.mjs.map +1 -1
  26. package/dist/components/atoms/StatusLabel/StatusLabel.d.mts +5 -2
  27. package/dist/components/atoms/StatusLabel/StatusLabel.d.ts +5 -2
  28. package/dist/components/atoms/StatusLabel/StatusLabel.mjs +5 -2
  29. package/dist/components/atoms/StatusLabel/StatusLabel.mjs.map +1 -1
  30. package/dist/components/atoms/StatusLabel/StatusLabelBase.d.mts +2 -2
  31. package/dist/components/atoms/StatusLabel/StatusLabelBase.d.ts +2 -2
  32. package/dist/components/atoms/StatusLabel/StatusLabelBase.mjs +19 -13
  33. package/dist/components/atoms/StatusLabel/StatusShape.d.mts +4 -0
  34. package/dist/components/atoms/StatusLabel/StatusShape.d.ts +4 -0
  35. package/dist/components/atoms/StatusLabel/StatusShape.mjs +31 -0
  36. package/dist/components/atoms/StatusLabel/StatusShape.mjs.map +1 -0
  37. package/dist/components/atoms/Typography/Typography.mjs +2 -2
  38. package/dist/components/molecules/AccountCard/AccountCard.mjs +22 -14
  39. package/dist/components/molecules/Alert/Alert.d.mts +4 -4
  40. package/dist/components/molecules/Alert/Alert.d.ts +4 -4
  41. package/dist/components/molecules/Alert/Alert.mjs +5 -4
  42. package/dist/components/molecules/CodeBlock/CodeBlock.mjs +1 -1
  43. package/dist/components/molecules/Dropdown/Dropdown.mjs +2 -2
  44. package/dist/components/molecules/InlineAlert/InlineAlert.mjs +15 -5
  45. package/dist/components/molecules/TabBar/TabBar.mjs +3 -3
  46. package/dist/components/molecules/TransactionListItem/TransactionListItem.d.mts +1 -1
  47. package/dist/components/molecules/TransactionListItem/TransactionListItem.d.ts +1 -1
  48. package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs +15 -31
  49. package/dist/data.js +514 -303
  50. package/dist/data.js.map +1 -1
  51. package/dist/lib/statusShapes.d.mts +2 -0
  52. package/dist/lib/statusShapes.d.ts +2 -0
  53. package/dist/lib/statusShapes.mjs +16 -0
  54. package/dist/lib/statusShapes.mjs.map +1 -0
  55. package/dist/lib/styleUtils.mjs +2 -2
  56. package/dist/lib/styleUtils.mjs.map +1 -1
  57. package/dist/lib/tokenAliases.d.mts +9 -0
  58. package/dist/lib/tokenAliases.d.ts +9 -0
  59. package/dist/lib/tokenAliases.mjs +50 -11
  60. package/dist/lib/tokenAliases.mjs.map +1 -1
  61. package/dist/styles/icons.json +141 -0
  62. package/dist/styles/icons.json.mjs +153 -2
  63. package/dist/styles/icons.json.mjs.map +1 -1
  64. package/dist/styles/tokens.d.mts +721 -123
  65. package/dist/styles/tokens.d.ts +721 -123
  66. package/dist/styles/tokens.json +362 -302
  67. package/dist/styles/tokens.json.mjs +362 -302
  68. package/dist/styles/tokens.json.mjs.map +1 -1
  69. package/dist/tokens/index.js +362 -302
  70. package/dist/tokens/index.js.map +1 -1
  71. package/dist/tokens/index.mjs +362 -302
  72. package/dist/tokens/index.mjs.map +1 -1
  73. package/dist/tokens/styles/tokens.d.mts +721 -123
  74. package/dist/tokens/styles/tokens.d.ts +721 -123
  75. package/dist/tokens.css +363 -317
  76. package/dist/types/icons.d.mts +1 -1
  77. package/dist/types/icons.d.ts +1 -1
  78. package/dist/types/icons.mjs.map +1 -1
  79. package/package.json +1 -1
@@ -1,4 +1,13 @@
1
1
  import React from 'react';
2
+ /**
3
+ * Badge variants: `default` and `accent`, plus deprecated aliases of `accent` kept until 3.0.
4
+ */
5
+ export type BadgeVariant = 'default' | 'accent' | DeprecatedBadgeVariant;
6
+ /**
7
+ * Deprecated Badge variants, each rendered as `accent` until 3.0 (decisions 0029, 0045).
8
+ * @deprecated Use `accent`. For a count of items with a status, use StatusLabel.
9
+ */
10
+ export type DeprecatedBadgeVariant = 'primary' | 'error' | 'warning' | 'success';
2
11
  export interface BadgeProps {
3
12
  /** Content to wrap with the badge */
4
13
  children: React.ReactNode;
@@ -7,12 +16,15 @@ export interface BadgeProps {
7
16
  /** Maximum number to display before showing "99+" */
8
17
  max?: number;
9
18
  /**
10
- * Visual variant of the badge. `accent` is the blue highlight. `primary` is a deprecated alias
11
- * for `accent`, because Button's `primary` is near-black (decision 0029). It keeps working
12
- * until it is removed in 3.0.
19
+ * Visual variant of the badge. A badge means new or unread items (decision 0045): `accent` is
20
+ * the blue highlight, and `default` the near-black count. `primary` is a deprecated alias for
21
+ * `accent`, because Button's `primary` is near-black (decision 0029). `error`, `warning` and
22
+ * `success` are deprecated aliases for `accent`: a badge's colour alone can't carry a status, so
23
+ * a count of items with a status uses the status pattern instead ("3 failed" with StatusLabel).
24
+ * All four keep working until they are removed in 3.0.
13
25
  * @default 'default'
14
26
  */
15
- variant?: 'default' | 'accent' | 'primary' | 'error' | 'warning' | 'success';
27
+ variant?: BadgeVariant;
16
28
  /** Show only a dot indicator instead of count */
17
29
  dot?: boolean;
18
30
  /** Screen reader label for the badge */
@@ -1,4 +1,13 @@
1
1
  import React from 'react';
2
+ /**
3
+ * Badge variants: `default` and `accent`, plus deprecated aliases of `accent` kept until 3.0.
4
+ */
5
+ export type BadgeVariant = 'default' | 'accent' | DeprecatedBadgeVariant;
6
+ /**
7
+ * Deprecated Badge variants, each rendered as `accent` until 3.0 (decisions 0029, 0045).
8
+ * @deprecated Use `accent`. For a count of items with a status, use StatusLabel.
9
+ */
10
+ export type DeprecatedBadgeVariant = 'primary' | 'error' | 'warning' | 'success';
2
11
  export interface BadgeProps {
3
12
  /** Content to wrap with the badge */
4
13
  children: React.ReactNode;
@@ -7,12 +16,15 @@ export interface BadgeProps {
7
16
  /** Maximum number to display before showing "99+" */
8
17
  max?: number;
9
18
  /**
10
- * Visual variant of the badge. `accent` is the blue highlight. `primary` is a deprecated alias
11
- * for `accent`, because Button's `primary` is near-black (decision 0029). It keeps working
12
- * until it is removed in 3.0.
19
+ * Visual variant of the badge. A badge means new or unread items (decision 0045): `accent` is
20
+ * the blue highlight, and `default` the near-black count. `primary` is a deprecated alias for
21
+ * `accent`, because Button's `primary` is near-black (decision 0029). `error`, `warning` and
22
+ * `success` are deprecated aliases for `accent`: a badge's colour alone can't carry a status, so
23
+ * a count of items with a status uses the status pattern instead ("3 failed" with StatusLabel).
24
+ * All four keep working until they are removed in 3.0.
13
25
  * @default 'default'
14
26
  */
15
- variant?: 'default' | 'accent' | 'primary' | 'error' | 'warning' | 'success';
27
+ variant?: BadgeVariant;
16
28
  /** Show only a dot indicator instead of count */
17
29
  dot?: boolean;
18
30
  /** Screen reader label for the badge */
@@ -37,16 +37,15 @@ var BadgeIndicator = /*#__PURE__*/styled.span.withConfig({
37
37
  return props.$isDot ? "".concat(forcedColors, " { forced-color-adjust: none; background-color: CanvasText; }") : "".concat(forcedColors, " { border: ").concat(semantic.border.width.thin, " solid currentColor; }");
38
38
  }, function (props) {
39
39
  switch (props.$variant) {
40
+ // 'primary', 'error', 'warning' and 'success' are deprecated aliases for 'accent', removed in
41
+ // 3.0: 'primary' (#169), and the status colours, because a badge's colour alone can't carry a
42
+ // status (decision 0045, #263)
40
43
  case 'accent':
41
44
  case 'primary':
42
- // Deprecated alias for 'accent', removed in 3.0 (#169)
43
- return "\n background-color: ".concat(color.fill.accent, ";\n color: ").concat(color.text.inverse, ";\n ");
44
45
  case 'error':
45
- return "\n background-color: ".concat(color.fill.danger, ";\n color: ").concat(color.text.inverse, ";\n ");
46
46
  case 'warning':
47
- return "\n background-color: ".concat(color.fill.warning, ";\n color: ").concat(color.text.inverse, ";\n ");
48
47
  case 'success':
49
- return "\n background-color: ".concat(color.fill.success, ";\n color: ").concat(color.text.inverse, ";\n ");
48
+ return "\n background-color: ".concat(color.fill.accent, ";\n color: ").concat(color.text.inverse, ";\n ");
50
49
  default:
51
50
  return "\n background-color: ".concat(color.fill.emphasis, ";\n color: ").concat(color.text.inverse, ";\n ");
52
51
  }
@@ -1,2 +1,2 @@
1
1
  export { Badge } from './Badge.mjs';
2
- export type { BadgeProps } from './Badge.mjs';
2
+ export type { BadgeProps, BadgeVariant, DeprecatedBadgeVariant } from './Badge.mjs';
@@ -1,2 +1,2 @@
1
1
  export { Badge } from './Badge';
2
- export type { BadgeProps } from './Badge';
2
+ export type { BadgeProps, BadgeVariant, DeprecatedBadgeVariant } from './Badge';
@@ -1,5 +1,24 @@
1
1
  import React from 'react';
2
2
  import type { Tokens } from '../../../types/tokens.mjs';
3
+ import type { BackgroundPath } from '../../../lib/tokenAliases.mjs';
4
+ /**
5
+ * Box's background: a semantic token's path below `semantic` (decision 0031), such as
6
+ * `surface.base`, `surface.raised` or `color.fill.muted`.
7
+ */
8
+ export type BoxBackground = BackgroundPath | DeprecatedBoxBackground;
9
+ /**
10
+ * The old `semantic.color.background` keys, removed in 3.0 with those tokens (#99, #304).
11
+ * @deprecated Use the token path: `default` and `page` → `surface.base`; `subtle` → `surface.raised`;
12
+ * `overlay` → `surface.scrim`; `surface` → `color.fill.muted`; `transparent` → `color.fill.none`;
13
+ * `progressTrack` → `color.fill.default`; `hover-overlay`, `active-overlay` and `inverse-overlay` →
14
+ * `color.fill.none-hover`, `none-pressed` and `inverse-none-hover`. The rest become `color.fill.*`
15
+ * with `interactive` → `accent`, `error` → `danger`, `neutral` → `default`, `-subtle` → `-muted`
16
+ * and `-active` → `-pressed`: `interactive-subtle` → `color.fill.accent-muted`, `emphasis` →
17
+ * `color.fill.emphasis`. `emphasis-hover`
18
+ * and `emphasis-active` have no static replacement: a strong fill's states belong to the control
19
+ * that has them (decision 0048).
20
+ */
21
+ export type DeprecatedBoxBackground = keyof Tokens['semantic']['color']['background'];
3
22
  export interface BoxProps {
4
23
  display?: 'block' | 'inline' | 'inline-block' | 'flex' | 'inline-flex' | 'none';
5
24
  flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
@@ -38,7 +57,12 @@ export interface BoxProps {
38
57
  borderRight?: keyof Tokens['semantic']['color']['border'];
39
58
  borderBottom?: keyof Tokens['semantic']['color']['border'];
40
59
  borderLeft?: keyof Tokens['semantic']['color']['border'];
41
- bg?: keyof Tokens['semantic']['color']['background'];
60
+ /**
61
+ * Background colour, as a semantic token path: `surface.base` (page), `surface.raised` (cards,
62
+ * sheets), `surface.scrim`, or a `color.fill.*` fill such as `color.fill.muted`. The old
63
+ * background keys (`default`, `subtle`, `surface`…) are deprecated and removed in 3.0.
64
+ */
65
+ bg?: BoxBackground;
42
66
  color?: keyof Tokens['semantic']['color']['text'];
43
67
  shadow?: keyof Tokens['semantic']['elevation'];
44
68
  cursor?: 'auto' | 'default' | 'pointer' | 'wait' | 'text' | 'move' | 'help' | 'not-allowed';
@@ -1,5 +1,24 @@
1
1
  import React from 'react';
2
2
  import type { Tokens } from '../../../types/tokens';
3
+ import type { BackgroundPath } from '../../../lib/tokenAliases';
4
+ /**
5
+ * Box's background: a semantic token's path below `semantic` (decision 0031), such as
6
+ * `surface.base`, `surface.raised` or `color.fill.muted`.
7
+ */
8
+ export type BoxBackground = BackgroundPath | DeprecatedBoxBackground;
9
+ /**
10
+ * The old `semantic.color.background` keys, removed in 3.0 with those tokens (#99, #304).
11
+ * @deprecated Use the token path: `default` and `page` → `surface.base`; `subtle` → `surface.raised`;
12
+ * `overlay` → `surface.scrim`; `surface` → `color.fill.muted`; `transparent` → `color.fill.none`;
13
+ * `progressTrack` → `color.fill.default`; `hover-overlay`, `active-overlay` and `inverse-overlay` →
14
+ * `color.fill.none-hover`, `none-pressed` and `inverse-none-hover`. The rest become `color.fill.*`
15
+ * with `interactive` → `accent`, `error` → `danger`, `neutral` → `default`, `-subtle` → `-muted`
16
+ * and `-active` → `-pressed`: `interactive-subtle` → `color.fill.accent-muted`, `emphasis` →
17
+ * `color.fill.emphasis`. `emphasis-hover`
18
+ * and `emphasis-active` have no static replacement: a strong fill's states belong to the control
19
+ * that has them (decision 0048).
20
+ */
21
+ export type DeprecatedBoxBackground = keyof Tokens['semantic']['color']['background'];
3
22
  export interface BoxProps {
4
23
  display?: 'block' | 'inline' | 'inline-block' | 'flex' | 'inline-flex' | 'none';
5
24
  flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
@@ -38,7 +57,12 @@ export interface BoxProps {
38
57
  borderRight?: keyof Tokens['semantic']['color']['border'];
39
58
  borderBottom?: keyof Tokens['semantic']['color']['border'];
40
59
  borderLeft?: keyof Tokens['semantic']['color']['border'];
41
- bg?: keyof Tokens['semantic']['color']['background'];
60
+ /**
61
+ * Background colour, as a semantic token path: `surface.base` (page), `surface.raised` (cards,
62
+ * sheets), `surface.scrim`, or a `color.fill.*` fill such as `color.fill.muted`. The old
63
+ * background keys (`default`, `subtle`, `surface`…) are deprecated and removed in 3.0.
64
+ */
65
+ bg?: BoxBackground;
42
66
  color?: keyof Tokens['semantic']['color']['text'];
43
67
  shadow?: keyof Tokens['semantic']['elevation'];
44
68
  cursor?: 'auto' | 'default' | 'pointer' | 'wait' | 'text' | 'move' | 'help' | 'not-allowed';
@@ -4,9 +4,12 @@ import { jsx } from 'react/jsx-runtime';
4
4
  import styled$module, { css } from 'styled-components';
5
5
  const styled = styled$module.default || styled$module;
6
6
  import tokens from '../../../lib/cssTokens.mjs';
7
- import { spaceByLayoutKey, radiusByKey, borderColorByKey, backgroundByKey, textColorByKey } from '../../../lib/tokenAliases.mjs';
7
+ import { spaceByLayoutKey, radiusByKey, borderColorByKey, textColorByKey, backgroundByPath, backgroundByKey } from '../../../lib/tokenAliases.mjs';
8
8
  import { reducedMotion } from '../../../lib/styleUtils.mjs';
9
9
 
10
+ var backgroundColor = function backgroundColor(bg) {
11
+ return bg in backgroundByPath ? backgroundByPath[bg] : backgroundByKey[bg];
12
+ };
10
13
  var StyledBox = /*#__PURE__*/styled.div.withConfig({
11
14
  shouldForwardProp: function shouldForwardProp(prop) {
12
15
  return !prop.startsWith('$');
@@ -90,7 +93,7 @@ var StyledBox = /*#__PURE__*/styled.div.withConfig({
90
93
  }, function (props) {
91
94
  return props.$borderLeft && css(templateObject_37 || (templateObject_37 = __makeTemplateObject(["border-left: ", " solid ", ";"], ["border-left: ", " solid ", ";"])), tokens.semantic.border.width.thin, borderColorByKey[props.$borderLeft]);
92
95
  }, function (props) {
93
- return props.$bg && css(templateObject_38 || (templateObject_38 = __makeTemplateObject(["background-color: ", ";"], ["background-color: ", ";"])), backgroundByKey[props.$bg]);
96
+ return props.$bg && css(templateObject_38 || (templateObject_38 = __makeTemplateObject(["background-color: ", ";"], ["background-color: ", ";"])), backgroundColor(props.$bg));
94
97
  }, function (props) {
95
98
  return props.$color && css(templateObject_39 || (templateObject_39 = __makeTemplateObject(["color: ", ";"], ["color: ", ";"])), textColorByKey[props.$color]);
96
99
  }, function (props) {
@@ -78,7 +78,7 @@ var getSizeStyles = function getSizeStyles(_a) {
78
78
  var $size = _a.$size;
79
79
  switch ($size) {
80
80
  case 'small':
81
- return "\n font: ".concat(button.sizes.small.font, ";\n min-height: ").concat(control.sm, ";\n padding: 0 ").concat(inset.md, ";\n ");
81
+ return "\n font: ".concat(button.sizes.small.font, ";\n font-weight: ").concat(button.sizes.small.fontWeight, ";\n min-height: ").concat(control.sm, ";\n padding: 0 ").concat(inset.md, ";\n ");
82
82
  case 'medium':
83
83
  return "\n font: ".concat(button.sizes.medium.font, ";\n min-height: ").concat(control.md, ";\n padding: 0 ").concat(inset.lg, ";\n ");
84
84
  case 'large':
@@ -1,9 +1,22 @@
1
1
  import { ReactNode } from 'react';
2
2
  import type { IconName } from '../../../types/icons.mjs';
3
3
  /**
4
- * Category color options for CategoryLabel
4
+ * The category colours: four display colours with no meaning, and grey for "other" (decision 0043).
5
+ * They never mean status; for status use StatusLabel.
5
6
  */
6
- export type CategoryColor = 'blue' | 'purple' | 'pink' | 'yellow' | 'green' | 'red' | 'orange' | 'gray';
7
+ export type CategoryDisplayColor = 'olive' | 'periwinkle' | 'rose' | 'magenta' | 'gray';
8
+ /**
9
+ * Deprecated category colour names, each an alias of the nearest display colour until 3.0
10
+ * (decision 0043): blue is periwinkle; purple is magenta; pink, red and orange are rose; yellow and
11
+ * green are olive.
12
+ * @deprecated Use a CategoryDisplayColor: 'olive', 'periwinkle', 'rose', 'magenta' or 'gray'.
13
+ */
14
+ export type DeprecatedCategoryColor = 'blue' | 'purple' | 'pink' | 'yellow' | 'green' | 'red' | 'orange';
15
+ /**
16
+ * Category color options for CategoryLabel. The old hue names still work, as aliases of the
17
+ * nearest display colour, until 3.0.
18
+ */
19
+ export type CategoryColor = CategoryDisplayColor | DeprecatedCategoryColor;
7
20
  /**
8
21
  * Visual variant options for CategoryLabel
9
22
  */
@@ -21,8 +34,9 @@ export interface CategoryLabelProps {
21
34
  */
22
35
  children: ReactNode;
23
36
  /**
24
- * Color scheme for the label
25
- * @default 'blue'
37
+ * Category colour: 'olive', 'periwinkle', 'rose', 'magenta' or 'gray'. The old hue names are
38
+ * deprecated aliases (decision 0043).
39
+ * @default 'periwinkle'
26
40
  */
27
41
  color?: CategoryColor;
28
42
  /**
@@ -52,16 +66,17 @@ export interface CategoryLabelProps {
52
66
  /**
53
67
  * CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
54
68
  *
55
- * A static, chip-like label with 8 category colours, 3 visual variants and an optional icon.
56
- * Category colours carry no status meaning; for status use StatusLabel.
69
+ * A static, chip-like label with 4 display colours plus grey, 3 visual variants and an optional
70
+ * icon. Category colours carry no meaning (decision 0043); for status use StatusLabel. Beyond five
71
+ * categories, the icon and text tell them apart.
57
72
  *
58
73
  * @example
59
74
  * ```tsx
60
- * <CategoryLabel color="orange" icon="creditCard">
75
+ * <CategoryLabel color="rose" icon="creditCard">
61
76
  * Shopping
62
77
  * </CategoryLabel>
63
78
  *
64
- * <CategoryLabel color="blue" variant="outlined" size="medium">
79
+ * <CategoryLabel color="periwinkle" variant="outlined" size="medium">
65
80
  * Travel
66
81
  * </CategoryLabel>
67
82
  * ```
@@ -1,9 +1,22 @@
1
1
  import { ReactNode } from 'react';
2
2
  import type { IconName } from '../../../types/icons';
3
3
  /**
4
- * Category color options for CategoryLabel
4
+ * The category colours: four display colours with no meaning, and grey for "other" (decision 0043).
5
+ * They never mean status; for status use StatusLabel.
5
6
  */
6
- export type CategoryColor = 'blue' | 'purple' | 'pink' | 'yellow' | 'green' | 'red' | 'orange' | 'gray';
7
+ export type CategoryDisplayColor = 'olive' | 'periwinkle' | 'rose' | 'magenta' | 'gray';
8
+ /**
9
+ * Deprecated category colour names, each an alias of the nearest display colour until 3.0
10
+ * (decision 0043): blue is periwinkle; purple is magenta; pink, red and orange are rose; yellow and
11
+ * green are olive.
12
+ * @deprecated Use a CategoryDisplayColor: 'olive', 'periwinkle', 'rose', 'magenta' or 'gray'.
13
+ */
14
+ export type DeprecatedCategoryColor = 'blue' | 'purple' | 'pink' | 'yellow' | 'green' | 'red' | 'orange';
15
+ /**
16
+ * Category color options for CategoryLabel. The old hue names still work, as aliases of the
17
+ * nearest display colour, until 3.0.
18
+ */
19
+ export type CategoryColor = CategoryDisplayColor | DeprecatedCategoryColor;
7
20
  /**
8
21
  * Visual variant options for CategoryLabel
9
22
  */
@@ -21,8 +34,9 @@ export interface CategoryLabelProps {
21
34
  */
22
35
  children: ReactNode;
23
36
  /**
24
- * Color scheme for the label
25
- * @default 'blue'
37
+ * Category colour: 'olive', 'periwinkle', 'rose', 'magenta' or 'gray'. The old hue names are
38
+ * deprecated aliases (decision 0043).
39
+ * @default 'periwinkle'
26
40
  */
27
41
  color?: CategoryColor;
28
42
  /**
@@ -52,16 +66,17 @@ export interface CategoryLabelProps {
52
66
  /**
53
67
  * CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
54
68
  *
55
- * A static, chip-like label with 8 category colours, 3 visual variants and an optional icon.
56
- * Category colours carry no status meaning; for status use StatusLabel.
69
+ * A static, chip-like label with 4 display colours plus grey, 3 visual variants and an optional
70
+ * icon. Category colours carry no meaning (decision 0043); for status use StatusLabel. Beyond five
71
+ * categories, the icon and text tell them apart.
57
72
  *
58
73
  * @example
59
74
  * ```tsx
60
- * <CategoryLabel color="orange" icon="creditCard">
75
+ * <CategoryLabel color="rose" icon="creditCard">
61
76
  * Shopping
62
77
  * </CategoryLabel>
63
78
  *
64
- * <CategoryLabel color="blue" variant="outlined" size="medium">
79
+ * <CategoryLabel color="periwinkle" variant="outlined" size="medium">
65
80
  * Travel
66
81
  * </CategoryLabel>
67
82
  * ```
@@ -14,15 +14,26 @@ var category = color.category;
14
14
  var radius = semantic.radius;
15
15
  var space = semantic.space;
16
16
  var labelHeight = semantic.size.label;
17
- // Text on white or the -subtle fill (outlined and minimal), at least 4.5:1 (#115)
17
+ var displayColor = {
18
+ olive: 'olive',
19
+ periwinkle: 'periwinkle',
20
+ rose: 'rose',
21
+ magenta: 'magenta',
22
+ gray: 'gray',
23
+ blue: 'periwinkle',
24
+ purple: 'magenta',
25
+ pink: 'rose',
26
+ yellow: 'olive',
27
+ green: 'olive',
28
+ red: 'rose',
29
+ orange: 'rose'
30
+ };
31
+ // Text on white or the -muted fill (outlined and minimal), at least 4.5:1 (#115)
18
32
  var categoryText = {
19
- blue: category['blue-text'],
20
- purple: category['purple-text'],
21
- pink: category['pink-text'],
22
- yellow: category['yellow-text'],
23
- green: category['green-text'],
24
- red: category['red-text'],
25
- orange: category['orange-text'],
33
+ olive: category['olive-text'],
34
+ periwinkle: category['periwinkle-text'],
35
+ rose: category['rose-text'],
36
+ magenta: category['magenta-text'],
26
37
  gray: category['gray-text']
27
38
  };
28
39
  var StyledCategoryLabel = /*#__PURE__*/styled.span.withConfig({
@@ -82,16 +93,17 @@ var HiddenLabel = /*#__PURE__*/styled.span.withConfig({
82
93
  /**
83
94
  * CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
84
95
  *
85
- * A static, chip-like label with 8 category colours, 3 visual variants and an optional icon.
86
- * Category colours carry no status meaning; for status use StatusLabel.
96
+ * A static, chip-like label with 4 display colours plus grey, 3 visual variants and an optional
97
+ * icon. Category colours carry no meaning (decision 0043); for status use StatusLabel. Beyond five
98
+ * categories, the icon and text tell them apart.
87
99
  *
88
100
  * @example
89
101
  * ```tsx
90
- * <CategoryLabel color="orange" icon="creditCard">
102
+ * <CategoryLabel color="rose" icon="creditCard">
91
103
  * Shopping
92
104
  * </CategoryLabel>
93
105
  *
94
- * <CategoryLabel color="blue" variant="outlined" size="medium">
106
+ * <CategoryLabel color="periwinkle" variant="outlined" size="medium">
95
107
  * Travel
96
108
  * </CategoryLabel>
97
109
  * ```
@@ -99,16 +111,17 @@ var HiddenLabel = /*#__PURE__*/styled.span.withConfig({
99
111
  /**
100
112
  * CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
101
113
  *
102
- * A static, chip-like label with 8 category colours, 3 visual variants and an optional icon.
103
- * Category colours carry no status meaning; for status use StatusLabel.
114
+ * A static, chip-like label with 4 display colours plus grey, 3 visual variants and an optional
115
+ * icon. Category colours carry no meaning (decision 0043); for status use StatusLabel. Beyond five
116
+ * categories, the icon and text tell them apart.
104
117
  *
105
118
  * @example
106
119
  * ```tsx
107
- * <CategoryLabel color="orange" icon="creditCard">
120
+ * <CategoryLabel color="rose" icon="creditCard">
108
121
  * Shopping
109
122
  * </CategoryLabel>
110
123
  *
111
- * <CategoryLabel color="blue" variant="outlined" size="medium">
124
+ * <CategoryLabel color="periwinkle" variant="outlined" size="medium">
112
125
  * Travel
113
126
  * </CategoryLabel>
114
127
  * ```
@@ -116,7 +129,7 @@ var HiddenLabel = /*#__PURE__*/styled.span.withConfig({
116
129
  var CategoryLabel = function CategoryLabel(_a) {
117
130
  var children = _a.children,
118
131
  _b = _a.color,
119
- color = _b === void 0 ? 'blue' : _b,
132
+ color = _b === void 0 ? 'periwinkle' : _b,
120
133
  _c = _a.variant,
121
134
  variant = _c === void 0 ? 'filled' : _c,
122
135
  _d = _a.size,
@@ -128,7 +141,7 @@ var CategoryLabel = function CategoryLabel(_a) {
128
141
  // A blank aria-label is no label at all, so it falls back like a missing one
129
142
  var accessibleLabel = (ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.trim()) ? ariaLabel : undefined;
130
143
  return jsxs(StyledCategoryLabel, {
131
- "$color": color,
144
+ "$color": displayColor[color],
132
145
  "$variant": variant,
133
146
  "$size": size,
134
147
  "data-testid": dataTestId,
@@ -1,2 +1,2 @@
1
1
  export { CategoryLabel } from './CategoryLabel.mjs';
2
- export type { CategoryLabelProps, CategoryColor, CategoryVariant, CategoryLabelSize } from './CategoryLabel.mjs';
2
+ export type { CategoryLabelProps, CategoryColor, CategoryDisplayColor, CategoryVariant, CategoryLabelSize } from './CategoryLabel.mjs';
@@ -1,2 +1,2 @@
1
1
  export { CategoryLabel } from './CategoryLabel';
2
- export type { CategoryLabelProps, CategoryColor, CategoryVariant, CategoryLabelSize } from './CategoryLabel';
2
+ export type { CategoryLabelProps, CategoryColor, CategoryDisplayColor, CategoryVariant, CategoryLabelSize } from './CategoryLabel';
@@ -27,7 +27,7 @@ var StyledSuggestionChip = /*#__PURE__*/styled.button.withConfig({
27
27
  * - A native button: Enter and Space pick it, and its text is its accessible name
28
28
  * - Outlined, with the naked hover and pressed fills; no selected state
29
29
  * - One chip height (24px minimum, decision 0035); long text wraps instead of being cut off
30
- */])), semantic.border.width.thin, color.border.input, chip["default"].borderRadius, color.fill.none, color.text["default"], semantic.motion.transition.feedback, sizeStyles, color.fill['none-hover'], color.fill['none-pressed'], chip.focus.outline, semantic.border.focusOffset, color.border.emphasis, color.text.disabled, forcedColors);
30
+ */])), semantic.border.width.thin, color.border.input, chip["default"].borderRadius, color.fill.none, color.text["default"], semantic.motion.transition.feedback, sizeStyles, color.fill['none-hover'], color.fill['none-pressed'], chip.focus.outline, semantic.border.focusOffset, color.border["default"], color.text.disabled, forcedColors);
31
31
  /**
32
32
  * SuggestionChip - Offers text to put in the agent input
33
33
  *
@@ -23,7 +23,7 @@ var getVariantStyles = function getVariantStyles(_a) {
23
23
  fill = _b.fill,
24
24
  text = _b.text;
25
25
  var interactiveStates = $clickable;
26
- return "\n background-color: ".concat(fill['accent-muted'], ";\n color: ").concat(text.accent, ";\n \n &:hover {\n background-color: ").concat(interactiveStates ? fill['accent-muted-hover'] : fill['accent-muted'], ";\n color: ").concat(interactiveStates ? text['accent-hover'] : text.accent, ";\n }\n \n &:active {\n background-color: ").concat(interactiveStates ? fill['accent-muted-pressed'] : fill['accent-muted'], ";\n color: ").concat(interactiveStates ? text['accent-pressed'] : text.accent, ";\n }\n\n /* Forced colours drop the fill, so a selected chip takes the system selection colours\n (decision 0038); its checkmark follows the text colour */\n ").concat(forcedColors, " {\n forced-color-adjust: none;\n background-color: Highlight;\n border-color: Highlight;\n color: HighlightText;\n }\n ");
26
+ return "\n background-color: ".concat(fill['accent-muted'], ";\n color: ").concat(text.accent, ";\n \n &:hover {\n background-color: ").concat(interactiveStates ? fill['accent-muted-hover'] : fill['accent-muted'], ";\n color: ").concat(interactiveStates ? text.accent : text.accent, ";\n }\n \n &:active {\n background-color: ").concat(interactiveStates ? fill['accent-muted-pressed'] : fill['accent-muted'], ";\n color: ").concat(interactiveStates ? text.accent : text.accent, ";\n }\n\n /* Forced colours drop the fill, so a selected chip takes the system selection colours\n (decision 0038); its checkmark follows the text colour */\n ").concat(forcedColors, " {\n forced-color-adjust: none;\n background-color: Highlight;\n border-color: Highlight;\n color: HighlightText;\n }\n ");
27
27
  }
28
28
  switch ($variant) {
29
29
  case 'emphasis':
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../../../src/components/atoms/Chip/shared/utils.ts"],"sourcesContent":["import tokens from '../../../../lib/cssTokens'\nimport { forcedColors } from '../../../../lib/styleUtils'\nimport { ChipVariant } from './types'\n\nconst { component: { chip }, semantic } = tokens\n\ninterface StyledChipProps {\n $variant: ChipVariant\n $disabled?: boolean\n $clickable?: boolean\n $selected?: boolean\n}\n\n// Helper function to get variant styles matching Button's approach\nexport const getVariantStyles = ({ $variant, $selected, $clickable, $disabled }: StyledChipProps) => {\n // Selected filter and input chips use the light-blue selected treatment (decision 0016).\n // The text darkens with the fill so every state stays at least 4.5:1.\n if ($selected) {\n // A selected disabled chip looks like any disabled chip; the checkmark keeps the\n // selected state visible (#110)\n if ($disabled) {\n const { disabled } = chip.variants.subtle\n return `\n background-color: ${disabled.backgroundColor};\n color: ${disabled.textColor};\n `\n }\n\n const { fill, text } = tokens.semantic.color\n const interactiveStates = $clickable\n return `\n background-color: ${fill['accent-muted']};\n color: ${text.accent};\n \n &:hover {\n background-color: ${interactiveStates ? fill['accent-muted-hover'] : fill['accent-muted']};\n color: ${interactiveStates ? text['accent-hover'] : text.accent};\n }\n \n &:active {\n background-color: ${interactiveStates ? fill['accent-muted-pressed'] : fill['accent-muted']};\n color: ${interactiveStates ? text['accent-pressed'] : text.accent};\n }\n\n /* Forced colours drop the fill, so a selected chip takes the system selection colours\n (decision 0038); its checkmark follows the text colour */\n ${forcedColors} {\n forced-color-adjust: none;\n background-color: Highlight;\n border-color: Highlight;\n color: HighlightText;\n }\n `\n }\n \n switch ($variant) {\n case 'emphasis':\n return `\n background-color: ${chip.variants.emphasis.backgroundColor};\n color: ${chip.variants.emphasis.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.variants.emphasis.disabled.backgroundColor : ($clickable ? chip.variants.emphasis.hover.backgroundColor : chip.variants.emphasis.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.variants.emphasis.disabled.backgroundColor : ($clickable ? chip.variants.emphasis.active.backgroundColor : chip.variants.emphasis.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.variants.emphasis.disabled.backgroundColor};\n color: ${chip.variants.emphasis.disabled.textColor};\n ` : ''}\n `\n case 'subtle':\n return `\n background-color: ${chip.variants.subtle.backgroundColor};\n color: ${chip.variants.subtle.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.variants.subtle.disabled.backgroundColor : ($clickable ? chip.variants.subtle.hover.backgroundColor : chip.variants.subtle.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.variants.subtle.disabled.backgroundColor : ($clickable ? chip.variants.subtle.active.backgroundColor : chip.variants.subtle.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.variants.subtle.disabled.backgroundColor};\n color: ${chip.variants.subtle.disabled.textColor};\n ` : ''}\n `\n case 'interactive':\n return `\n background-color: ${chip.variants.interactive.backgroundColor};\n color: ${chip.variants.interactive.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.variants.interactive.disabled.backgroundColor : ($clickable ? chip.variants.interactive.hover.backgroundColor : chip.variants.interactive.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.variants.interactive.disabled.backgroundColor : ($clickable ? chip.variants.interactive.active.backgroundColor : chip.variants.interactive.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.variants.interactive.disabled.backgroundColor};\n color: ${chip.variants.interactive.disabled.textColor};\n ` : ''}\n `\n case 'default':\n default:\n return `\n background-color: ${chip.default.backgroundColor};\n color: ${chip.default.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.disabled.backgroundColor : ($clickable ? chip.hover.backgroundColor : chip.default.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.disabled.backgroundColor : ($clickable ? chip.active.backgroundColor : chip.default.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.disabled.backgroundColor};\n color: ${chip.disabled.textColor};\n ` : ''}\n `\n }\n}\n\n// Chips have one size: 24px from the label scale as a minimum, with the content centred\n// and no vertical padding (decisions 0034 and 0035). Horizontal padding comes from the\n// semantic spacing scale (decision 0022).\nexport const sizeStyles = `\n font: ${chip.sizes.medium.font};\n min-height: ${semantic.size.label.medium};\n padding: 0 ${semantic.space.inset.sm};\n`\n\n"],"names":["chip","tokens","component","semantic","getVariantStyles","_a","$variant","$selected","$clickable","$disabled","disabled","variants","subtle","concat","backgroundColor","textColor","_b","color","fill","text","interactiveStates","accent","forcedColors","emphasis","hover","active","interactive","sizeStyles","sizes","medium","font","size","label","space","inset","sm"],"mappings":";;;;AAIqB,IAAAA,IAAI,GAAiBC,MAAM,CAAAC,SAAA,CAAAF,IAAvB;EAAIG,QAAQ,GAAKF,MAAM,CAAAE,QAAX,CAAA;AASrC;IACaC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,EAA+D,EAAA;MAA7DC,QAAQ,GAAAD,EAAA,CAAAC,QAAA;IAAEC,SAAS,GAAAF,EAAA,CAAAE,SAAA;IAAEC,UAAU,GAAAH,EAAA,CAAAG,UAAA;IAAEC,SAAS,GAAAJ,EAAA,CAAAI,SAAA,CAAA;AAC3E;AACA;AACA,EAAA,IAAIF,SAAS,EA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AAA,CAAA,CAAAhB,MAAA,CAAAV,QAAQ,CAAC8B,KAAK,CAACC,KAAK,CAACC,EAAE;;;;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../../../../src/components/atoms/Chip/shared/utils.ts"],"sourcesContent":["import tokens from '../../../../lib/cssTokens'\nimport { forcedColors } from '../../../../lib/styleUtils'\nimport { ChipVariant } from './types'\n\nconst { component: { chip }, semantic } = tokens\n\ninterface StyledChipProps {\n $variant: ChipVariant\n $disabled?: boolean\n $clickable?: boolean\n $selected?: boolean\n}\n\n// Helper function to get variant styles matching Button's approach\nexport const getVariantStyles = ({ $variant, $selected, $clickable, $disabled }: StyledChipProps) => {\n // Selected filter and input chips use the light-blue selected treatment (decision 0016).\n // The text darkens with the fill so every state stays at least 4.5:1.\n if ($selected) {\n // A selected disabled chip looks like any disabled chip; the checkmark keeps the\n // selected state visible (#110)\n if ($disabled) {\n const { disabled } = chip.variants.subtle\n return `\n background-color: ${disabled.backgroundColor};\n color: ${disabled.textColor};\n `\n }\n\n const { fill, text } = tokens.semantic.color\n const interactiveStates = $clickable\n return `\n background-color: ${fill['accent-muted']};\n color: ${text.accent};\n \n &:hover {\n background-color: ${interactiveStates ? fill['accent-muted-hover'] : fill['accent-muted']};\n color: ${interactiveStates ? text.accent : text.accent};\n }\n \n &:active {\n background-color: ${interactiveStates ? fill['accent-muted-pressed'] : fill['accent-muted']};\n color: ${interactiveStates ? text.accent : text.accent};\n }\n\n /* Forced colours drop the fill, so a selected chip takes the system selection colours\n (decision 0038); its checkmark follows the text colour */\n ${forcedColors} {\n forced-color-adjust: none;\n background-color: Highlight;\n border-color: Highlight;\n color: HighlightText;\n }\n `\n }\n \n switch ($variant) {\n case 'emphasis':\n return `\n background-color: ${chip.variants.emphasis.backgroundColor};\n color: ${chip.variants.emphasis.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.variants.emphasis.disabled.backgroundColor : ($clickable ? chip.variants.emphasis.hover.backgroundColor : chip.variants.emphasis.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.variants.emphasis.disabled.backgroundColor : ($clickable ? chip.variants.emphasis.active.backgroundColor : chip.variants.emphasis.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.variants.emphasis.disabled.backgroundColor};\n color: ${chip.variants.emphasis.disabled.textColor};\n ` : ''}\n `\n case 'subtle':\n return `\n background-color: ${chip.variants.subtle.backgroundColor};\n color: ${chip.variants.subtle.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.variants.subtle.disabled.backgroundColor : ($clickable ? chip.variants.subtle.hover.backgroundColor : chip.variants.subtle.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.variants.subtle.disabled.backgroundColor : ($clickable ? chip.variants.subtle.active.backgroundColor : chip.variants.subtle.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.variants.subtle.disabled.backgroundColor};\n color: ${chip.variants.subtle.disabled.textColor};\n ` : ''}\n `\n case 'interactive':\n return `\n background-color: ${chip.variants.interactive.backgroundColor};\n color: ${chip.variants.interactive.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.variants.interactive.disabled.backgroundColor : ($clickable ? chip.variants.interactive.hover.backgroundColor : chip.variants.interactive.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.variants.interactive.disabled.backgroundColor : ($clickable ? chip.variants.interactive.active.backgroundColor : chip.variants.interactive.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.variants.interactive.disabled.backgroundColor};\n color: ${chip.variants.interactive.disabled.textColor};\n ` : ''}\n `\n case 'default':\n default:\n return `\n background-color: ${chip.default.backgroundColor};\n color: ${chip.default.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.disabled.backgroundColor : ($clickable ? chip.hover.backgroundColor : chip.default.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.disabled.backgroundColor : ($clickable ? chip.active.backgroundColor : chip.default.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.disabled.backgroundColor};\n color: ${chip.disabled.textColor};\n ` : ''}\n `\n }\n}\n\n// Chips have one size: 24px from the label scale as a minimum, with the content centred\n// and no vertical padding (decisions 0034 and 0035). Horizontal padding comes from the\n// semantic spacing scale (decision 0022).\nexport const sizeStyles = `\n font: ${chip.sizes.medium.font};\n min-height: ${semantic.size.label.medium};\n padding: 0 ${semantic.space.inset.sm};\n`\n\n"],"names":["chip","tokens","component","semantic","getVariantStyles","_a","$variant","$selected","$clickable","$disabled","disabled","variants","subtle","concat","backgroundColor","textColor","_b","color","fill","text","interactiveStates","accent","forcedColors","emphasis","hover","active","interactive","sizeStyles","sizes","medium","font","size","label","space","inset","sm"],"mappings":";;;;AAIqB,IAAAA,IAAI,GAAiBC,MAAM,CAAAC,SAAA,CAAAF,IAAvB;EAAIG,QAAQ,GAAKF,MAAM,CAAAE,QAAX,CAAA;AASrC;IACaC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,EAA+D,EAAA;MAA7DC,QAAQ,GAAAD,EAAA,CAAAC,QAAA;IAAEC,SAAS,GAAAF,EAAA,CAAAE,SAAA;IAAEC,UAAU,GAAAH,EAAA,CAAAG,UAAA;IAAEC,SAAS,GAAAJ,EAAA,CAAAI,SAAA,CAAA;AAC3E;AACA;AACA,EAAA,IAAIF,SAAS,EAAE;AACb;AACA;AACA,IAAA,IAAIE,SAAS,EAAE;MACL,IAAAC,QAAQ,GAAKV,IAAI,CAACW,QAAQ,CAACC,MAAM,SAAzB,CAAA;AAChB,MAAA,OAAO,8BAAA,CAAAC,MAAA,CACeH,QAAQ,CAACI,eAAe,+BACnCJ,QAAQ,CAACK,SAAS,EAAA,WAAA,CAC5B,CAAA;AACH,KAAA;AAEM,IAAA,IAAAC,EAAiB,GAAAf,MAAM,CAACE,QAAQ,CAACc,KAAK;MAApCC,IAAI,GAAAF,EAAA,CAAAE,IAAA;MAAEC,IAAI,GAAAH,EAAA,CAAAG,IAA0B,CAAA;IAC5C,IAAMC,iBAAiB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S,EAAA,8DAAA,CAAA,CAAAF,MAAA,CAGTJ,SAAS,GAAGT,IAAI,CAACU,QAAQ,CAACI,eAAe,GAAIN,UAAU,GAAGR,IAAI,CAACwB,KAAK,CAACV,eAAe,GAAGd,IAAI,CAAQ,SAAA,CAAA,CAACc,eAAgB,EAAA,0EAAA,CAAA,CAAAD,MAAA,CAIpHJ,SAAS,GAAGT,IAAI,CAACU,QAAQ,CAACI,eAAe,GAAIN,UAAU,GAAGR,IAAI,CAACyB,MAAM,CAACX,eAAe,GAAGd,IAAI,CAAA,SAAA,CAAQ,CAACc,eAAgB,EAGzI,kCAAA,CAAA,CAAAD,MAAA,CAAAJ,SAAS,GAAG,wCACQT,IAAI,CAACU,QAAQ,CAACI,eAAe,EAAA,sBAAA,CAAA,CAAAD,MAAA,CACxCb,IAAI,CAACU,QAAQ,CAACK,SAAS,EAAA,aAAA,CACjC,GAAG,EAAE,EAAA,UAAA,CACP,CAAA;AACL,GAAA;AACF,EAAC;AAED;AACA;AACA;IACaY,UAAU,GAAG,YAChB,CAAAd,MAAA,CAAAb,IAAI,CAAC4B,KAAK,CAACC,MAAM,CAACC,IAAI,EAChB,mBAAA,CAAA,CAAAjB,MAAA,CAAAV,QAAQ,CAAC4B,IAAI,CAACC,KAAK,CAACH,MAAM,EAC3B,kBAAA,CAAA,CAAAhB,MAAA,CAAAV,QAAQ,CAAC8B,KAAK,CAACC,KAAK,CAACC,EAAE;;;;"}
@@ -24,7 +24,7 @@ var IconStyled = /*#__PURE__*/styled.span.withConfig({
24
24
  case 'default':
25
25
  return tokens.semantic.color.icon["default"];
26
26
  case 'emphasis':
27
- return tokens.semantic.color.icon.emphasis;
27
+ return tokens.semantic.color.icon["default"];
28
28
  case 'subdued':
29
29
  return tokens.semantic.color.icon.muted;
30
30
  case 'disabled':