@tosui/react 0.1.4 → 0.1.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.
Files changed (145) hide show
  1. package/dist/components/Alert/Alert.d.ts.map +1 -1
  2. package/dist/components/Alert/Alert.js.map +1 -1
  3. package/dist/components/Badge/Badge.d.ts.map +1 -1
  4. package/dist/components/Badge/Badge.js.map +1 -1
  5. package/dist/components/Box/Box.d.ts +2 -7
  6. package/dist/components/Box/Box.d.ts.map +1 -1
  7. package/dist/components/Box/Box.js +1 -1
  8. package/dist/components/Box/Box.js.map +1 -1
  9. package/dist/components/Box/borders/borders.d.ts +11 -13
  10. package/dist/components/Box/borders/borders.d.ts.map +1 -1
  11. package/dist/components/Box/borders/borders.js +29 -62
  12. package/dist/components/Box/borders/borders.js.map +1 -1
  13. package/dist/components/Box/borders/borders.module.css +936 -40
  14. package/dist/components/Box/borders/borders.module.css.js +600 -40
  15. package/dist/components/Box/borders/borders.module.css.js.map +1 -1
  16. package/dist/components/Box/colors/colors.d.ts +6 -8
  17. package/dist/components/Box/colors/colors.d.ts.map +1 -1
  18. package/dist/components/Box/colors/colors.js +20 -30
  19. package/dist/components/Box/colors/colors.js.map +1 -1
  20. package/dist/components/Box/colors/colors.module.css +2537 -108
  21. package/dist/components/Box/colors/colors.module.css.js +1620 -108
  22. package/dist/components/Box/colors/colors.module.css.js.map +1 -1
  23. package/dist/components/Box/display/display.d.ts +2 -8
  24. package/dist/components/Box/display/display.d.ts.map +1 -1
  25. package/dist/components/Box/display/display.js +10 -33
  26. package/dist/components/Box/display/display.js.map +1 -1
  27. package/dist/components/Box/flexbox/flexbox.d.ts +12 -14
  28. package/dist/components/Box/flexbox/flexbox.d.ts.map +1 -1
  29. package/dist/components/Box/flexbox/flexbox.js +39 -102
  30. package/dist/components/Box/flexbox/flexbox.js.map +1 -1
  31. package/dist/components/Box/flexbox/flexbox.module.css +1210 -56
  32. package/dist/components/Box/flexbox/flexbox.module.css.js +727 -55
  33. package/dist/components/Box/flexbox/flexbox.module.css.js.map +1 -1
  34. package/dist/components/Box/grid/grid.d.ts.map +1 -1
  35. package/dist/components/Box/grid/grid.js +22 -33
  36. package/dist/components/Box/grid/grid.js.map +1 -1
  37. package/dist/components/Box/grid/grid.module.css +36 -36
  38. package/dist/components/Box/grid/grid.module.css.js +14 -34
  39. package/dist/components/Box/grid/grid.module.css.js.map +1 -1
  40. package/dist/components/Box/inset/inset.d.ts.map +1 -1
  41. package/dist/components/Box/inset/inset.js +8 -52
  42. package/dist/components/Box/inset/inset.js.map +1 -1
  43. package/dist/components/Box/inset/inset.module.css +120 -120
  44. package/dist/components/Box/inset/inset.module.css.js +21 -161
  45. package/dist/components/Box/inset/inset.module.css.js.map +1 -1
  46. package/dist/components/Box/interactions/interactions.d.ts +6 -8
  47. package/dist/components/Box/interactions/interactions.d.ts.map +1 -1
  48. package/dist/components/Box/interactions/interactions.js +20 -30
  49. package/dist/components/Box/interactions/interactions.js.map +1 -1
  50. package/dist/components/Box/interactions/interactions.module.css +891 -38
  51. package/dist/components/Box/interactions/interactions.module.css.js +570 -38
  52. package/dist/components/Box/interactions/interactions.module.css.js.map +1 -1
  53. package/dist/components/Box/margin/margin.d.ts.map +1 -1
  54. package/dist/components/Box/margin/margin.js +8 -52
  55. package/dist/components/Box/margin/margin.js.map +1 -1
  56. package/dist/components/Box/margin/margin.module.css +120 -120
  57. package/dist/components/Box/margin/margin.module.css.js +21 -161
  58. package/dist/components/Box/margin/margin.module.css.js.map +1 -1
  59. package/dist/components/Box/opacity/opacity.d.ts +2 -8
  60. package/dist/components/Box/opacity/opacity.d.ts.map +1 -1
  61. package/dist/components/Box/opacity/opacity.js +10 -33
  62. package/dist/components/Box/opacity/opacity.js.map +1 -1
  63. package/dist/components/Box/overflow/overflow.d.ts +2 -8
  64. package/dist/components/Box/overflow/overflow.d.ts.map +1 -1
  65. package/dist/components/Box/overflow/overflow.js +24 -29
  66. package/dist/components/Box/overflow/overflow.js.map +1 -1
  67. package/dist/components/Box/padding/padding.d.ts.map +1 -1
  68. package/dist/components/Box/padding/padding.js +8 -52
  69. package/dist/components/Box/padding/padding.js.map +1 -1
  70. package/dist/components/Box/padding/padding.module.css +120 -120
  71. package/dist/components/Box/padding/padding.module.css.js +21 -161
  72. package/dist/components/Box/padding/padding.module.css.js.map +1 -1
  73. package/dist/components/Box/position/position.d.ts +2 -8
  74. package/dist/components/Box/position/position.d.ts.map +1 -1
  75. package/dist/components/Box/position/position.js +10 -33
  76. package/dist/components/Box/position/position.js.map +1 -1
  77. package/dist/components/Box/roundness/roundness.d.ts +12 -14
  78. package/dist/components/Box/roundness/roundness.d.ts.map +1 -1
  79. package/dist/components/Box/roundness/roundness.js +26 -62
  80. package/dist/components/Box/roundness/roundness.js.map +1 -1
  81. package/dist/components/Box/roundness/roundness.module.css +937 -40
  82. package/dist/components/Box/roundness/roundness.module.css.js +600 -40
  83. package/dist/components/Box/roundness/roundness.module.css.js.map +1 -1
  84. package/dist/components/Box/shadows/shadows.d.ts +2 -8
  85. package/dist/components/Box/shadows/shadows.d.ts.map +1 -1
  86. package/dist/components/Box/shadows/shadows.js +10 -33
  87. package/dist/components/Box/shadows/shadows.js.map +1 -1
  88. package/dist/components/Box/shared/index.d.ts +1 -0
  89. package/dist/components/Box/shared/index.d.ts.map +1 -1
  90. package/dist/components/Box/shared/responsive.d.ts +36 -0
  91. package/dist/components/Box/shared/responsive.d.ts.map +1 -0
  92. package/dist/components/Box/shared/responsive.js +65 -0
  93. package/dist/components/Box/shared/responsive.js.map +1 -0
  94. package/dist/components/Box/shared/types.d.ts +6 -0
  95. package/dist/components/Box/shared/types.d.ts.map +1 -1
  96. package/dist/components/Box/sizing/sizing.d.ts.map +1 -1
  97. package/dist/components/Box/sizing/sizing.js +5 -37
  98. package/dist/components/Box/sizing/sizing.js.map +1 -1
  99. package/dist/components/Box/sizing/sizing.module.css +175 -183
  100. package/dist/components/Box/sizing/sizing.module.css.js +31 -241
  101. package/dist/components/Box/sizing/sizing.module.css.js.map +1 -1
  102. package/dist/components/Box/text/text.d.ts +6 -8
  103. package/dist/components/Box/text/text.d.ts.map +1 -1
  104. package/dist/components/Box/text/text.js +24 -30
  105. package/dist/components/Box/text/text.js.map +1 -1
  106. package/dist/components/Box/text/text.module.css +562 -24
  107. package/dist/components/Box/text/text.module.css.js +360 -24
  108. package/dist/components/Box/text/text.module.css.js.map +1 -1
  109. package/dist/components/Box/typography/typography.d.ts +7 -9
  110. package/dist/components/Box/typography/typography.d.ts.map +1 -1
  111. package/dist/components/Box/typography/typography.js +33 -19
  112. package/dist/components/Box/typography/typography.js.map +1 -1
  113. package/dist/components/Box/typography/typography.module.css +890 -19
  114. package/dist/components/Box/typography/typography.module.css.js +570 -19
  115. package/dist/components/Box/typography/typography.module.css.js.map +1 -1
  116. package/dist/components/Box/zIndex/zIndex.d.ts +2 -8
  117. package/dist/components/Box/zIndex/zIndex.d.ts.map +1 -1
  118. package/dist/components/Box/zIndex/zIndex.js +10 -33
  119. package/dist/components/Box/zIndex/zIndex.js.map +1 -1
  120. package/dist/components/Flex/Flex.d.ts +5 -6
  121. package/dist/components/Flex/Flex.d.ts.map +1 -1
  122. package/dist/components/Flex/Flex.js +0 -1
  123. package/dist/components/Flex/Flex.js.map +1 -1
  124. package/dist/components/Grid/Grid.d.ts +3 -3
  125. package/dist/components/Grid/Grid.d.ts.map +1 -1
  126. package/dist/components/Grid/Grid.js.map +1 -1
  127. package/dist/components/IconButton/IconButton.d.ts.map +1 -1
  128. package/dist/components/IconButton/IconButton.js.map +1 -1
  129. package/dist/components/Menu/Menu.d.ts.map +1 -1
  130. package/dist/components/Menu/Menu.js +5 -5
  131. package/dist/components/Menu/Menu.js.map +1 -1
  132. package/dist/components/Popover/Popover.d.ts.map +1 -1
  133. package/dist/components/Popover/Popover.js +9 -9
  134. package/dist/components/Popover/Popover.js.map +1 -1
  135. package/dist/components/Progress/Progress.d.ts.map +1 -1
  136. package/dist/components/Progress/Progress.js.map +1 -1
  137. package/dist/components/Stack/Stack.d.ts +2 -1
  138. package/dist/components/Stack/Stack.d.ts.map +1 -1
  139. package/dist/components/Stack/Stack.js.map +1 -1
  140. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  141. package/dist/components/Tooltip/Tooltip.js +5 -5
  142. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  143. package/dist/index.css +9778 -2147
  144. package/dist/styles/styles.css +7 -0
  145. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"borders.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"borders.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,14 +1,12 @@
1
- import { StyleResult } from '../shared';
1
+ import { ResponsiveValue } from '../../../utils/breakpoints';
2
+ import { StateProps, StyleResult } from '../shared';
2
3
  export type ColorValue = "accent-emphasis" | "accent" | "error-emphasis" | "error" | "foreground-inverted-muted" | "foreground-inverted-subtle" | "foreground-inverted" | "foreground-muted" | "foreground-subtle" | "foreground" | "info-emphasis" | "info" | "primary-emphasis" | "primary" | "success-emphasis" | "success" | "warning-emphasis" | "warning";
3
4
  export type BackgroundColorValue = "accent-default" | "accent-emphasis" | "accent-subtle" | "background" | "error-default" | "error-emphasis" | "error-subtle" | "foreground" | "info-default" | "info-emphasis" | "info-subtle" | "primary-default" | "primary-emphasis" | "primary-subtle" | "success-default" | "success-emphasis" | "success-subtle" | "surface" | "transparent" | "warning-default" | "warning-emphasis" | "warning-subtle";
4
5
  export type BorderColorValue = "accent-emphasis" | "accent" | "border-muted" | "border" | "error-emphasis" | "error" | "info-emphasis" | "info" | "primary-emphasis" | "primary" | "success-emphasis" | "success" | "warning-emphasis" | "warning";
5
6
  export type ColorProps = {
6
- color?: ColorValue;
7
- bg?: BackgroundColorValue;
8
- borderColor?: BorderColorValue;
7
+ color?: ResponsiveValue<ColorValue>;
8
+ bg?: ResponsiveValue<BackgroundColorValue>;
9
+ borderColor?: ResponsiveValue<BorderColorValue>;
9
10
  };
10
- export type ColorStateProps = {
11
- _hover?: ColorProps;
12
- };
13
- export declare function getColorStyles(props: ColorProps & ColorStateProps): StyleResult;
11
+ export declare function getColorStyles(props: ColorProps & StateProps<ColorProps>): StyleResult;
14
12
  //# sourceMappingURL=colors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/colors/colors.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,UAAU,GAClB,iBAAiB,GACjB,QAAQ,GACR,gBAAgB,GAChB,OAAO,GACP,2BAA2B,GAC3B,4BAA4B,GAC5B,qBAAqB,GACrB,kBAAkB,GAClB,mBAAmB,GACnB,YAAY,GACZ,eAAe,GACf,MAAM,GACN,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,SAAS,CAAC;AAEd,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,GACf,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,YAAY,GACZ,cAAc,GACd,eAAe,GACf,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,CAAC;AAErB,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,QAAQ,GACR,cAAc,GACd,QAAQ,GACR,gBAAgB,GAChB,OAAO,GACP,eAAe,GACf,MAAM,GACN,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,SAAS,CAAC;AAEd,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,EAAE,CAAC,EAAE,oBAAoB,CAAC;IAC1B,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAiDF,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,GAAG,eAAe,GAClC,WAAW,CAUb"}
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/colors/colors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,WAAW,EAEjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,UAAU,GAClB,iBAAiB,GACjB,QAAQ,GACR,gBAAgB,GAChB,OAAO,GACP,2BAA2B,GAC3B,4BAA4B,GAC5B,qBAAqB,GACrB,kBAAkB,GAClB,mBAAmB,GACnB,YAAY,GACZ,eAAe,GACf,MAAM,GACN,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,SAAS,CAAC;AAEd,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,GACf,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,YAAY,GACZ,cAAc,GACd,eAAe,GACf,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,CAAC;AAErB,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,QAAQ,GACR,cAAc,GACd,QAAQ,GACR,gBAAgB,GAChB,OAAO,GACP,eAAe,GACf,MAAM,GACN,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,SAAS,CAAC;AAEd,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IACpC,EAAE,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;CACjD,CAAC;AAkBF,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,GACzC,WAAW,CAmBb"}
@@ -1,41 +1,31 @@
1
- import { STATE_CLASS_SUFFIXES } from "../shared/constants.js";
1
+ import { getEnumResponsiveStyles } from "../shared/responsive.js";
2
2
  import styles from "./colors.module.css.js";
3
3
  import clsx from "clsx";
4
- function getColorClass(value, state) {
5
- const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
6
- return stateClassSuffix ? styles[`color-${value}${stateClassSuffix}`] : styles[`color-${value}`];
7
- }
8
- function getBgClass(value, state) {
9
- const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
10
- return stateClassSuffix ? styles[`bg-${value}${stateClassSuffix}`] : styles[`bg-${value}`];
11
- }
12
- function getBorderColorClass(value, state) {
13
- const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
14
- return stateClassSuffix ? styles[`border-color-${value}${stateClassSuffix}`] : styles[`border-color-${value}`];
15
- }
16
4
  function getColorStylesForState(props, state) {
17
5
  if (!props) return { className: "", style: {} };
18
- const classes = [];
19
- if (props.color) {
20
- const cls = getColorClass(props.color, state);
21
- if (cls) classes.push(cls);
22
- }
23
- if (props.bg) {
24
- const cls = getBgClass(props.bg, state);
25
- if (cls) classes.push(cls);
26
- }
27
- if (props.borderColor) {
28
- const cls = getBorderColorClass(props.borderColor, state);
29
- if (cls) classes.push(cls);
30
- }
31
- return { className: clsx(...classes), style: {} };
6
+ const colorResult = getEnumResponsiveStyles(styles, "color", props.color, state);
7
+ const bgResult = getEnumResponsiveStyles(styles, "bg", props.bg, state);
8
+ const borderColorResult = getEnumResponsiveStyles(styles, "border-color", props.borderColor, state);
9
+ return {
10
+ className: clsx(colorResult.className, bgResult.className, borderColorResult.className),
11
+ style: {}
12
+ };
32
13
  }
33
14
  function getColorStyles(props) {
34
- const { color, bg, borderColor, _hover } = props;
35
- const baseStyles = getColorStylesForState({ color, bg, borderColor }, "base");
15
+ const { _hover, _focus, _active, _disabled, ...baseProps } = props;
16
+ const baseStyles = getColorStylesForState(baseProps, "base");
36
17
  const hoverStyles = getColorStylesForState(_hover, "hover");
18
+ const focusStyles = getColorStylesForState(_focus, "focus");
19
+ const activeStyles = getColorStylesForState(_active, "active");
20
+ const disabledStyles = getColorStylesForState(_disabled, "disabled");
37
21
  return {
38
- className: clsx(baseStyles.className, hoverStyles.className),
22
+ className: clsx(
23
+ baseStyles.className,
24
+ hoverStyles.className,
25
+ focusStyles.className,
26
+ activeStyles.className,
27
+ disabledStyles.className
28
+ ),
39
29
  style: {}
40
30
  };
41
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","sources":["../../../../src/components/Box/colors/colors.ts"],"sourcesContent":["import {\n STATE_CLASS_SUFFIXES,\n type StateKey,\n type StyleResult,\n} from \"../shared\";\nimport styles from \"./colors.module.css\";\nimport clsx from \"clsx\";\n\nexport type ColorValue =\n | \"accent-emphasis\"\n | \"accent\"\n | \"error-emphasis\"\n | \"error\"\n | \"foreground-inverted-muted\"\n | \"foreground-inverted-subtle\"\n | \"foreground-inverted\"\n | \"foreground-muted\"\n | \"foreground-subtle\"\n | \"foreground\"\n | \"info-emphasis\"\n | \"info\"\n | \"primary-emphasis\"\n | \"primary\"\n | \"success-emphasis\"\n | \"success\"\n | \"warning-emphasis\"\n | \"warning\";\n\nexport type BackgroundColorValue =\n | \"accent-default\"\n | \"accent-emphasis\"\n | \"accent-subtle\"\n | \"background\"\n | \"error-default\"\n | \"error-emphasis\"\n | \"error-subtle\"\n | \"foreground\"\n | \"info-default\"\n | \"info-emphasis\"\n | \"info-subtle\"\n | \"primary-default\"\n | \"primary-emphasis\"\n | \"primary-subtle\"\n | \"success-default\"\n | \"success-emphasis\"\n | \"success-subtle\"\n | \"surface\"\n | \"transparent\"\n | \"warning-default\"\n | \"warning-emphasis\"\n | \"warning-subtle\";\n\nexport type BorderColorValue =\n | \"accent-emphasis\"\n | \"accent\"\n | \"border-muted\"\n | \"border\"\n | \"error-emphasis\"\n | \"error\"\n | \"info-emphasis\"\n | \"info\"\n | \"primary-emphasis\"\n | \"primary\"\n | \"success-emphasis\"\n | \"success\"\n | \"warning-emphasis\"\n | \"warning\";\n\nexport type ColorProps = {\n color?: ColorValue;\n bg?: BackgroundColorValue;\n borderColor?: BorderColorValue;\n};\n\nexport type ColorStateProps = {\n _hover?: ColorProps;\n};\n\nfunction getColorClass(value: ColorValue, state: StateKey): string | undefined {\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n return stateClassSuffix\n ? styles[`color-${value}${stateClassSuffix}`]\n : styles[`color-${value}`];\n}\n\nfunction getBgClass(value: BackgroundColorValue, state: StateKey): string | undefined {\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n return stateClassSuffix\n ? styles[`bg-${value}${stateClassSuffix}`]\n : styles[`bg-${value}`];\n}\n\nfunction getBorderColorClass(value: BorderColorValue, state: StateKey): string | undefined {\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n return stateClassSuffix\n ? styles[`border-color-${value}${stateClassSuffix}`]\n : styles[`border-color-${value}`];\n}\n\nfunction getColorStylesForState(\n props: ColorProps | undefined,\n state: StateKey\n): StyleResult {\n if (!props) return { className: \"\", style: {} };\n\n const classes: string[] = [];\n\n if (props.color) {\n const cls = getColorClass(props.color, state);\n if (cls) classes.push(cls);\n }\n\n if (props.bg) {\n const cls = getBgClass(props.bg, state);\n if (cls) classes.push(cls);\n }\n\n if (props.borderColor) {\n const cls = getBorderColorClass(props.borderColor, state);\n if (cls) classes.push(cls);\n }\n\n return { className: clsx(...classes), style: {} };\n}\n\nexport function getColorStyles(\n props: ColorProps & ColorStateProps\n): StyleResult {\n const { color, bg, borderColor, _hover } = props;\n\n const baseStyles = getColorStylesForState({ color, bg, borderColor }, \"base\");\n const hoverStyles = getColorStylesForState(_hover, \"hover\");\n\n return {\n className: clsx(baseStyles.className, hoverStyles.className),\n style: {},\n };\n}\n"],"names":[],"mappings":";;;AA8EA,SAAS,cAAc,OAAmB,OAAqC;AAC7E,QAAM,mBAAmB,qBAAqB,KAAK;AACnD,SAAO,mBACH,OAAO,SAAS,KAAK,GAAG,gBAAgB,EAAE,IAC1C,OAAO,SAAS,KAAK,EAAE;AAC7B;AAEA,SAAS,WAAW,OAA6B,OAAqC;AACpF,QAAM,mBAAmB,qBAAqB,KAAK;AACnD,SAAO,mBACH,OAAO,MAAM,KAAK,GAAG,gBAAgB,EAAE,IACvC,OAAO,MAAM,KAAK,EAAE;AAC1B;AAEA,SAAS,oBAAoB,OAAyB,OAAqC;AACzF,QAAM,mBAAmB,qBAAqB,KAAK;AACnD,SAAO,mBACH,OAAO,gBAAgB,KAAK,GAAG,gBAAgB,EAAE,IACjD,OAAO,gBAAgB,KAAK,EAAE;AACpC;AAEA,SAAS,uBACP,OACA,OACa;AACb,MAAI,CAAC,MAAO,QAAO,EAAE,WAAW,IAAI,OAAO,GAAC;AAE5C,QAAM,UAAoB,CAAA;AAE1B,MAAI,MAAM,OAAO;AACf,UAAM,MAAM,cAAc,MAAM,OAAO,KAAK;AAC5C,QAAI,IAAK,SAAQ,KAAK,GAAG;AAAA,EAC3B;AAEA,MAAI,MAAM,IAAI;AACZ,UAAM,MAAM,WAAW,MAAM,IAAI,KAAK;AACtC,QAAI,IAAK,SAAQ,KAAK,GAAG;AAAA,EAC3B;AAEA,MAAI,MAAM,aAAa;AACrB,UAAM,MAAM,oBAAoB,MAAM,aAAa,KAAK;AACxD,QAAI,IAAK,SAAQ,KAAK,GAAG;AAAA,EAC3B;AAEA,SAAO,EAAE,WAAW,KAAK,GAAG,OAAO,GAAG,OAAO,GAAC;AAChD;AAEO,SAAS,eACd,OACa;AACb,QAAM,EAAE,OAAO,IAAI,aAAa,WAAW;AAE3C,QAAM,aAAa,uBAAuB,EAAE,OAAO,IAAI,YAAA,GAAe,MAAM;AAC5E,QAAM,cAAc,uBAAuB,QAAQ,OAAO;AAE1D,SAAO;AAAA,IACL,WAAW,KAAK,WAAW,WAAW,YAAY,SAAS;AAAA,IAC3D,OAAO,CAAA;AAAA,EAAC;AAEZ;"}
1
+ {"version":3,"file":"colors.js","sources":["../../../../src/components/Box/colors/colors.ts"],"sourcesContent":["import type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport {\n type StateKey,\n type StateProps,\n type StyleResult,\n getEnumResponsiveStyles,\n} from \"../shared\";\nimport styles from \"./colors.module.css\";\nimport clsx from \"clsx\";\n\nexport type ColorValue =\n | \"accent-emphasis\"\n | \"accent\"\n | \"error-emphasis\"\n | \"error\"\n | \"foreground-inverted-muted\"\n | \"foreground-inverted-subtle\"\n | \"foreground-inverted\"\n | \"foreground-muted\"\n | \"foreground-subtle\"\n | \"foreground\"\n | \"info-emphasis\"\n | \"info\"\n | \"primary-emphasis\"\n | \"primary\"\n | \"success-emphasis\"\n | \"success\"\n | \"warning-emphasis\"\n | \"warning\";\n\nexport type BackgroundColorValue =\n | \"accent-default\"\n | \"accent-emphasis\"\n | \"accent-subtle\"\n | \"background\"\n | \"error-default\"\n | \"error-emphasis\"\n | \"error-subtle\"\n | \"foreground\"\n | \"info-default\"\n | \"info-emphasis\"\n | \"info-subtle\"\n | \"primary-default\"\n | \"primary-emphasis\"\n | \"primary-subtle\"\n | \"success-default\"\n | \"success-emphasis\"\n | \"success-subtle\"\n | \"surface\"\n | \"transparent\"\n | \"warning-default\"\n | \"warning-emphasis\"\n | \"warning-subtle\";\n\nexport type BorderColorValue =\n | \"accent-emphasis\"\n | \"accent\"\n | \"border-muted\"\n | \"border\"\n | \"error-emphasis\"\n | \"error\"\n | \"info-emphasis\"\n | \"info\"\n | \"primary-emphasis\"\n | \"primary\"\n | \"success-emphasis\"\n | \"success\"\n | \"warning-emphasis\"\n | \"warning\";\n\nexport type ColorProps = {\n color?: ResponsiveValue<ColorValue>;\n bg?: ResponsiveValue<BackgroundColorValue>;\n borderColor?: ResponsiveValue<BorderColorValue>;\n};\n\nfunction getColorStylesForState(\n props: ColorProps | undefined,\n state: StateKey\n): StyleResult {\n if (!props) return { className: \"\", style: {} };\n\n const colorResult = getEnumResponsiveStyles(styles, \"color\", props.color, state);\n const bgResult = getEnumResponsiveStyles(styles, \"bg\", props.bg, state);\n const borderColorResult = getEnumResponsiveStyles(styles, \"border-color\", props.borderColor, state);\n\n return {\n className: clsx(colorResult.className, bgResult.className, borderColorResult.className),\n style: {},\n };\n}\n\nexport function getColorStyles(\n props: ColorProps & StateProps<ColorProps>\n): StyleResult {\n const { _hover, _focus, _active, _disabled, ...baseProps } = props;\n\n const baseStyles = getColorStylesForState(baseProps, \"base\");\n const hoverStyles = getColorStylesForState(_hover, \"hover\");\n const focusStyles = getColorStylesForState(_focus, \"focus\");\n const activeStyles = getColorStylesForState(_active, \"active\");\n const disabledStyles = getColorStylesForState(_disabled, \"disabled\");\n\n return {\n className: clsx(\n baseStyles.className,\n hoverStyles.className,\n focusStyles.className,\n activeStyles.className,\n disabledStyles.className\n ),\n style: {},\n };\n}\n"],"names":[],"mappings":";;;AA4EA,SAAS,uBACP,OACA,OACa;AACb,MAAI,CAAC,MAAO,QAAO,EAAE,WAAW,IAAI,OAAO,GAAC;AAE5C,QAAM,cAAc,wBAAwB,QAAQ,SAAS,MAAM,OAAO,KAAK;AAC/E,QAAM,WAAW,wBAAwB,QAAQ,MAAM,MAAM,IAAI,KAAK;AACtE,QAAM,oBAAoB,wBAAwB,QAAQ,gBAAgB,MAAM,aAAa,KAAK;AAElG,SAAO;AAAA,IACL,WAAW,KAAK,YAAY,WAAW,SAAS,WAAW,kBAAkB,SAAS;AAAA,IACtF,OAAO,CAAA;AAAA,EAAC;AAEZ;AAEO,SAAS,eACd,OACa;AACb,QAAM,EAAE,QAAQ,QAAQ,SAAS,WAAW,GAAG,cAAc;AAE7D,QAAM,aAAa,uBAAuB,WAAW,MAAM;AAC3D,QAAM,cAAc,uBAAuB,QAAQ,OAAO;AAC1D,QAAM,cAAc,uBAAuB,QAAQ,OAAO;AAC1D,QAAM,eAAe,uBAAuB,SAAS,QAAQ;AAC7D,QAAM,iBAAiB,uBAAuB,WAAW,UAAU;AAEnE,SAAO;AAAA,IACL,WAAW;AAAA,MACT,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,eAAe;AAAA,IAAA;AAAA,IAEjB,OAAO,CAAA;AAAA,EAAC;AAEZ;"}