@tosui/react 0.1.3 → 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 (146) hide show
  1. package/README.md +106 -60
  2. package/dist/components/Alert/Alert.d.ts.map +1 -1
  3. package/dist/components/Alert/Alert.js.map +1 -1
  4. package/dist/components/Badge/Badge.d.ts.map +1 -1
  5. package/dist/components/Badge/Badge.js.map +1 -1
  6. package/dist/components/Box/Box.d.ts +2 -7
  7. package/dist/components/Box/Box.d.ts.map +1 -1
  8. package/dist/components/Box/Box.js +1 -1
  9. package/dist/components/Box/Box.js.map +1 -1
  10. package/dist/components/Box/borders/borders.d.ts +11 -13
  11. package/dist/components/Box/borders/borders.d.ts.map +1 -1
  12. package/dist/components/Box/borders/borders.js +29 -62
  13. package/dist/components/Box/borders/borders.js.map +1 -1
  14. package/dist/components/Box/borders/borders.module.css +936 -40
  15. package/dist/components/Box/borders/borders.module.css.js +600 -40
  16. package/dist/components/Box/borders/borders.module.css.js.map +1 -1
  17. package/dist/components/Box/colors/colors.d.ts +6 -8
  18. package/dist/components/Box/colors/colors.d.ts.map +1 -1
  19. package/dist/components/Box/colors/colors.js +20 -30
  20. package/dist/components/Box/colors/colors.js.map +1 -1
  21. package/dist/components/Box/colors/colors.module.css +2537 -108
  22. package/dist/components/Box/colors/colors.module.css.js +1620 -108
  23. package/dist/components/Box/colors/colors.module.css.js.map +1 -1
  24. package/dist/components/Box/display/display.d.ts +2 -8
  25. package/dist/components/Box/display/display.d.ts.map +1 -1
  26. package/dist/components/Box/display/display.js +10 -33
  27. package/dist/components/Box/display/display.js.map +1 -1
  28. package/dist/components/Box/flexbox/flexbox.d.ts +12 -14
  29. package/dist/components/Box/flexbox/flexbox.d.ts.map +1 -1
  30. package/dist/components/Box/flexbox/flexbox.js +39 -102
  31. package/dist/components/Box/flexbox/flexbox.js.map +1 -1
  32. package/dist/components/Box/flexbox/flexbox.module.css +1210 -56
  33. package/dist/components/Box/flexbox/flexbox.module.css.js +727 -55
  34. package/dist/components/Box/flexbox/flexbox.module.css.js.map +1 -1
  35. package/dist/components/Box/grid/grid.d.ts +3 -2
  36. package/dist/components/Box/grid/grid.d.ts.map +1 -1
  37. package/dist/components/Box/grid/grid.js +24 -15
  38. package/dist/components/Box/grid/grid.js.map +1 -1
  39. package/dist/components/Box/grid/grid.module.css +68 -18
  40. package/dist/components/Box/grid/grid.module.css.js +14 -14
  41. package/dist/components/Box/inset/inset.d.ts.map +1 -1
  42. package/dist/components/Box/inset/inset.js +8 -52
  43. package/dist/components/Box/inset/inset.js.map +1 -1
  44. package/dist/components/Box/inset/inset.module.css +120 -120
  45. package/dist/components/Box/inset/inset.module.css.js +21 -161
  46. package/dist/components/Box/inset/inset.module.css.js.map +1 -1
  47. package/dist/components/Box/interactions/interactions.d.ts +6 -8
  48. package/dist/components/Box/interactions/interactions.d.ts.map +1 -1
  49. package/dist/components/Box/interactions/interactions.js +20 -30
  50. package/dist/components/Box/interactions/interactions.js.map +1 -1
  51. package/dist/components/Box/interactions/interactions.module.css +891 -38
  52. package/dist/components/Box/interactions/interactions.module.css.js +570 -38
  53. package/dist/components/Box/interactions/interactions.module.css.js.map +1 -1
  54. package/dist/components/Box/margin/margin.d.ts.map +1 -1
  55. package/dist/components/Box/margin/margin.js +8 -52
  56. package/dist/components/Box/margin/margin.js.map +1 -1
  57. package/dist/components/Box/margin/margin.module.css +120 -120
  58. package/dist/components/Box/margin/margin.module.css.js +21 -161
  59. package/dist/components/Box/margin/margin.module.css.js.map +1 -1
  60. package/dist/components/Box/opacity/opacity.d.ts +2 -8
  61. package/dist/components/Box/opacity/opacity.d.ts.map +1 -1
  62. package/dist/components/Box/opacity/opacity.js +10 -33
  63. package/dist/components/Box/opacity/opacity.js.map +1 -1
  64. package/dist/components/Box/overflow/overflow.d.ts +2 -8
  65. package/dist/components/Box/overflow/overflow.d.ts.map +1 -1
  66. package/dist/components/Box/overflow/overflow.js +24 -29
  67. package/dist/components/Box/overflow/overflow.js.map +1 -1
  68. package/dist/components/Box/padding/padding.d.ts.map +1 -1
  69. package/dist/components/Box/padding/padding.js +8 -52
  70. package/dist/components/Box/padding/padding.js.map +1 -1
  71. package/dist/components/Box/padding/padding.module.css +120 -120
  72. package/dist/components/Box/padding/padding.module.css.js +21 -161
  73. package/dist/components/Box/padding/padding.module.css.js.map +1 -1
  74. package/dist/components/Box/position/position.d.ts +2 -8
  75. package/dist/components/Box/position/position.d.ts.map +1 -1
  76. package/dist/components/Box/position/position.js +10 -33
  77. package/dist/components/Box/position/position.js.map +1 -1
  78. package/dist/components/Box/roundness/roundness.d.ts +12 -14
  79. package/dist/components/Box/roundness/roundness.d.ts.map +1 -1
  80. package/dist/components/Box/roundness/roundness.js +26 -62
  81. package/dist/components/Box/roundness/roundness.js.map +1 -1
  82. package/dist/components/Box/roundness/roundness.module.css +937 -40
  83. package/dist/components/Box/roundness/roundness.module.css.js +600 -40
  84. package/dist/components/Box/roundness/roundness.module.css.js.map +1 -1
  85. package/dist/components/Box/shadows/shadows.d.ts +2 -8
  86. package/dist/components/Box/shadows/shadows.d.ts.map +1 -1
  87. package/dist/components/Box/shadows/shadows.js +10 -33
  88. package/dist/components/Box/shadows/shadows.js.map +1 -1
  89. package/dist/components/Box/shared/index.d.ts +1 -0
  90. package/dist/components/Box/shared/index.d.ts.map +1 -1
  91. package/dist/components/Box/shared/responsive.d.ts +36 -0
  92. package/dist/components/Box/shared/responsive.d.ts.map +1 -0
  93. package/dist/components/Box/shared/responsive.js +65 -0
  94. package/dist/components/Box/shared/responsive.js.map +1 -0
  95. package/dist/components/Box/shared/types.d.ts +6 -0
  96. package/dist/components/Box/shared/types.d.ts.map +1 -1
  97. package/dist/components/Box/sizing/sizing.d.ts.map +1 -1
  98. package/dist/components/Box/sizing/sizing.js +5 -37
  99. package/dist/components/Box/sizing/sizing.js.map +1 -1
  100. package/dist/components/Box/sizing/sizing.module.css +175 -183
  101. package/dist/components/Box/sizing/sizing.module.css.js +31 -241
  102. package/dist/components/Box/sizing/sizing.module.css.js.map +1 -1
  103. package/dist/components/Box/text/text.d.ts +6 -8
  104. package/dist/components/Box/text/text.d.ts.map +1 -1
  105. package/dist/components/Box/text/text.js +24 -30
  106. package/dist/components/Box/text/text.js.map +1 -1
  107. package/dist/components/Box/text/text.module.css +562 -24
  108. package/dist/components/Box/text/text.module.css.js +360 -24
  109. package/dist/components/Box/text/text.module.css.js.map +1 -1
  110. package/dist/components/Box/typography/typography.d.ts +7 -9
  111. package/dist/components/Box/typography/typography.d.ts.map +1 -1
  112. package/dist/components/Box/typography/typography.js +33 -19
  113. package/dist/components/Box/typography/typography.js.map +1 -1
  114. package/dist/components/Box/typography/typography.module.css +890 -19
  115. package/dist/components/Box/typography/typography.module.css.js +570 -19
  116. package/dist/components/Box/typography/typography.module.css.js.map +1 -1
  117. package/dist/components/Box/zIndex/zIndex.d.ts +2 -8
  118. package/dist/components/Box/zIndex/zIndex.d.ts.map +1 -1
  119. package/dist/components/Box/zIndex/zIndex.js +10 -33
  120. package/dist/components/Box/zIndex/zIndex.js.map +1 -1
  121. package/dist/components/Flex/Flex.d.ts +5 -6
  122. package/dist/components/Flex/Flex.d.ts.map +1 -1
  123. package/dist/components/Flex/Flex.js +0 -1
  124. package/dist/components/Flex/Flex.js.map +1 -1
  125. package/dist/components/Grid/Grid.d.ts +8 -7
  126. package/dist/components/Grid/Grid.d.ts.map +1 -1
  127. package/dist/components/Grid/Grid.js.map +1 -1
  128. package/dist/components/IconButton/IconButton.d.ts.map +1 -1
  129. package/dist/components/IconButton/IconButton.js.map +1 -1
  130. package/dist/components/Menu/Menu.d.ts.map +1 -1
  131. package/dist/components/Menu/Menu.js +5 -5
  132. package/dist/components/Menu/Menu.js.map +1 -1
  133. package/dist/components/Popover/Popover.d.ts.map +1 -1
  134. package/dist/components/Popover/Popover.js +9 -9
  135. package/dist/components/Popover/Popover.js.map +1 -1
  136. package/dist/components/Progress/Progress.d.ts.map +1 -1
  137. package/dist/components/Progress/Progress.js.map +1 -1
  138. package/dist/components/Stack/Stack.d.ts +2 -1
  139. package/dist/components/Stack/Stack.d.ts.map +1 -1
  140. package/dist/components/Stack/Stack.js.map +1 -1
  141. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  142. package/dist/components/Tooltip/Tooltip.js +5 -5
  143. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  144. package/dist/index.css +9313 -1632
  145. package/dist/styles/styles.css +7 -0
  146. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"roundness.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"roundness.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,14 +1,8 @@
1
1
  import { ResponsiveValue } from '../../../utils/breakpoints';
2
- import { StyleResult } from '../shared';
2
+ import { StateProps, StyleResult } from '../shared';
3
3
  export type ShadowValue = "none" | "sm" | "md" | "lg";
4
4
  export type ShadowProps = {
5
5
  shadow?: ResponsiveValue<ShadowValue>;
6
6
  };
7
- export type ShadowStateProps = {
8
- _hover?: ShadowProps;
9
- _focus?: ShadowProps;
10
- _active?: ShadowProps;
11
- _disabled?: ShadowProps;
12
- };
13
- export declare function getShadowStyles(props: ShadowProps & ShadowStateProps): StyleResult;
7
+ export declare function getShadowStyles(props: ShadowProps & StateProps<ShadowProps>): StyleResult;
14
8
  //# sourceMappingURL=shadows.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/shadows/shadows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB,CAAC;AAiDF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,GAAG,gBAAgB,GACpC,WAAW,CAmBb"}
1
+ {"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/shadows/shadows.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,WAAW,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CACvC,CAAC;AAWF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,GAC3C,WAAW,CAmBb"}
@@ -1,40 +1,17 @@
1
- import { RESPONSIVE_KEYS, STATE_CLASS_SUFFIXES } from "../shared/constants.js";
1
+ import { getEnumResponsiveStyles } from "../shared/responsive.js";
2
2
  import styles from "./shadows.module.css.js";
3
3
  import clsx from "clsx";
4
- function getShadowClass(value, responsiveKey, state) {
5
- const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
6
- if (responsiveKey === "base") {
7
- return stateClassSuffix ? styles[`${value}${stateClassSuffix}`] : styles[value];
8
- }
9
- return stateClassSuffix ? styles[`${value}_${responsiveKey}${stateClassSuffix}`] : styles[`${value}_${responsiveKey}`];
10
- }
11
- function getShadowStylesForValue(value, state) {
12
- const result = { className: "", style: {} };
13
- if (value === void 0) return result;
14
- if (typeof value === "string") {
15
- const className = getShadowClass(value, "base", state);
16
- if (className) {
17
- result.className = className;
18
- }
19
- return result;
20
- }
21
- for (const responsiveKey of RESPONSIVE_KEYS) {
22
- const shadowValue = value[responsiveKey];
23
- if (shadowValue === void 0) continue;
24
- const className = getShadowClass(shadowValue, responsiveKey, state);
25
- if (className) {
26
- result.className = clsx(result.className, className);
27
- }
28
- }
29
- return result;
4
+ function getShadowStylesForState(props, state) {
5
+ if (!props) return { className: "", style: {} };
6
+ return getEnumResponsiveStyles(styles, "", props.shadow, state);
30
7
  }
31
8
  function getShadowStyles(props) {
32
- const { shadow, _hover, _focus, _active, _disabled } = props;
33
- const baseStyles = getShadowStylesForValue(shadow, "base");
34
- const hoverStyles = getShadowStylesForValue(_hover?.shadow, "hover");
35
- const focusStyles = getShadowStylesForValue(_focus?.shadow, "focus");
36
- const activeStyles = getShadowStylesForValue(_active?.shadow, "active");
37
- const disabledStyles = getShadowStylesForValue(_disabled?.shadow, "disabled");
9
+ const { _hover, _focus, _active, _disabled, ...baseProps } = props;
10
+ const baseStyles = getShadowStylesForState(baseProps, "base");
11
+ const hoverStyles = getShadowStylesForState(_hover, "hover");
12
+ const focusStyles = getShadowStylesForState(_focus, "focus");
13
+ const activeStyles = getShadowStylesForState(_active, "active");
14
+ const disabledStyles = getShadowStylesForState(_disabled, "disabled");
38
15
  return {
39
16
  className: clsx(
40
17
  baseStyles.className,
@@ -1 +1 @@
1
- {"version":3,"file":"shadows.js","sources":["../../../../src/components/Box/shadows/shadows.ts"],"sourcesContent":["import type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport {\n RESPONSIVE_KEYS,\n STATE_CLASS_SUFFIXES,\n type StateKey,\n type StyleResult,\n} from \"../shared\";\nimport styles from \"./shadows.module.css\";\nimport clsx from \"clsx\";\n\nexport type ShadowValue = \"none\" | \"sm\" | \"md\" | \"lg\";\n\nexport type ShadowProps = {\n shadow?: ResponsiveValue<ShadowValue>;\n};\n\nexport type ShadowStateProps = {\n _hover?: ShadowProps;\n _focus?: ShadowProps;\n _active?: ShadowProps;\n _disabled?: ShadowProps;\n};\n\nfunction getShadowClass(\n value: ShadowValue,\n responsiveKey: (typeof RESPONSIVE_KEYS)[number],\n state: StateKey\n): string | undefined {\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n\n if (responsiveKey === \"base\") {\n return stateClassSuffix\n ? styles[`${value}${stateClassSuffix}`]\n : styles[value];\n }\n\n return stateClassSuffix\n ? styles[`${value}_${responsiveKey}${stateClassSuffix}`]\n : styles[`${value}_${responsiveKey}`];\n}\n\nfunction getShadowStylesForValue(\n value: ResponsiveValue<ShadowValue> | undefined,\n state: StateKey\n): StyleResult {\n const result: StyleResult = { className: \"\", style: {} };\n\n if (value === undefined) return result;\n\n if (typeof value === \"string\") {\n const className = getShadowClass(value, \"base\", state);\n if (className) {\n result.className = className;\n }\n return result;\n }\n\n for (const responsiveKey of RESPONSIVE_KEYS) {\n const shadowValue = value[responsiveKey];\n if (shadowValue === undefined) continue;\n\n const className = getShadowClass(shadowValue, responsiveKey, state);\n if (className) {\n result.className = clsx(result.className, className);\n }\n }\n\n return result;\n}\n\nexport function getShadowStyles(\n props: ShadowProps & ShadowStateProps\n): StyleResult {\n const { shadow, _hover, _focus, _active, _disabled } = props;\n\n const baseStyles = getShadowStylesForValue(shadow, \"base\");\n const hoverStyles = getShadowStylesForValue(_hover?.shadow, \"hover\");\n const focusStyles = getShadowStylesForValue(_focus?.shadow, \"focus\");\n const activeStyles = getShadowStylesForValue(_active?.shadow, \"active\");\n const disabledStyles = getShadowStylesForValue(_disabled?.shadow, \"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":";;;AAuBA,SAAS,eACP,OACA,eACA,OACoB;AACpB,QAAM,mBAAmB,qBAAqB,KAAK;AAEnD,MAAI,kBAAkB,QAAQ;AAC5B,WAAO,mBACH,OAAO,GAAG,KAAK,GAAG,gBAAgB,EAAE,IACpC,OAAO,KAAK;AAAA,EAClB;AAEA,SAAO,mBACH,OAAO,GAAG,KAAK,IAAI,aAAa,GAAG,gBAAgB,EAAE,IACrD,OAAO,GAAG,KAAK,IAAI,aAAa,EAAE;AACxC;AAEA,SAAS,wBACP,OACA,OACa;AACb,QAAM,SAAsB,EAAE,WAAW,IAAI,OAAO,CAAA,EAAC;AAErD,MAAI,UAAU,OAAW,QAAO;AAEhC,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,YAAY,eAAe,OAAO,QAAQ,KAAK;AACrD,QAAI,WAAW;AACb,aAAO,YAAY;AAAA,IACrB;AACA,WAAO;AAAA,EACT;AAEA,aAAW,iBAAiB,iBAAiB;AAC3C,UAAM,cAAc,MAAM,aAAa;AACvC,QAAI,gBAAgB,OAAW;AAE/B,UAAM,YAAY,eAAe,aAAa,eAAe,KAAK;AAClE,QAAI,WAAW;AACb,aAAO,YAAY,KAAK,OAAO,WAAW,SAAS;AAAA,IACrD;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,gBACd,OACa;AACb,QAAM,EAAE,QAAQ,QAAQ,QAAQ,SAAS,cAAc;AAEvD,QAAM,aAAa,wBAAwB,QAAQ,MAAM;AACzD,QAAM,cAAc,wBAAwB,QAAQ,QAAQ,OAAO;AACnE,QAAM,cAAc,wBAAwB,QAAQ,QAAQ,OAAO;AACnE,QAAM,eAAe,wBAAwB,SAAS,QAAQ,QAAQ;AACtE,QAAM,iBAAiB,wBAAwB,WAAW,QAAQ,UAAU;AAE5E,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;"}
1
+ {"version":3,"file":"shadows.js","sources":["../../../../src/components/Box/shadows/shadows.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 \"./shadows.module.css\";\nimport clsx from \"clsx\";\n\nexport type ShadowValue = \"none\" | \"sm\" | \"md\" | \"lg\";\n\nexport type ShadowProps = {\n shadow?: ResponsiveValue<ShadowValue>;\n};\n\nfunction getShadowStylesForState(\n props: ShadowProps | undefined,\n state: StateKey\n): StyleResult {\n if (!props) return { className: \"\", style: {} };\n\n return getEnumResponsiveStyles(styles, \"\", props.shadow, state);\n}\n\nexport function getShadowStyles(\n props: ShadowProps & StateProps<ShadowProps>\n): StyleResult {\n const { _hover, _focus, _active, _disabled, ...baseProps } = props;\n\n const baseStyles = getShadowStylesForState(baseProps, \"base\");\n const hoverStyles = getShadowStylesForState(_hover, \"hover\");\n const focusStyles = getShadowStylesForState(_focus, \"focus\");\n const activeStyles = getShadowStylesForState(_active, \"active\");\n const disabledStyles = getShadowStylesForState(_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":";;;AAgBA,SAAS,wBACP,OACA,OACa;AACb,MAAI,CAAC,MAAO,QAAO,EAAE,WAAW,IAAI,OAAO,GAAC;AAE5C,SAAO,wBAAwB,QAAQ,IAAI,MAAM,QAAQ,KAAK;AAChE;AAEO,SAAS,gBACd,OACa;AACb,QAAM,EAAE,QAAQ,QAAQ,SAAS,WAAW,GAAG,cAAc;AAE7D,QAAM,aAAa,wBAAwB,WAAW,MAAM;AAC5D,QAAM,cAAc,wBAAwB,QAAQ,OAAO;AAC3D,QAAM,cAAc,wBAAwB,QAAQ,OAAO;AAC3D,QAAM,eAAe,wBAAwB,SAAS,QAAQ;AAC9D,QAAM,iBAAiB,wBAAwB,WAAW,UAAU;AAEpE,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;"}
@@ -1,4 +1,5 @@
1
1
  export * from './constants';
2
2
  export * from './types';
3
3
  export * from './spacing';
4
+ export * from './responsive';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { ResponsiveValue } from '../../../utils/breakpoints';
2
+ import { StateKey, StyleResult } from './types';
3
+ /**
4
+ * Generic helper for variable-based responsive props using CSS fallback chains.
5
+ *
6
+ * With this pattern, each prop has ONE CSS class per state. The CSS handles
7
+ * breakpoint cascading via nested var() fallbacks in media queries.
8
+ * JS only needs to apply the class and set CSS variables for specified breakpoints.
9
+ *
10
+ * @param styles CSS module styles object
11
+ * @param classKey Key to look up in the CSS module (e.g., "pt")
12
+ * @param varPrefix CSS variable prefix (e.g., "pt" → --t-pt, --t-pt_sm, etc.)
13
+ * @param value The prop value (plain or responsive object)
14
+ * @param state Interaction state (base, hover, focus, active, disabled)
15
+ * @param transform Optional transform from prop value to CSS string (e.g., getRawValue)
16
+ */
17
+ export declare function getResponsiveVarStyles<T>(styles: Record<string, string>, classKey: string, varPrefix: string, value: ResponsiveValue<T> | undefined, state?: StateKey, transform?: (v: T) => string | undefined): StyleResult;
18
+ /**
19
+ * Generic helper for enum-based responsive props using per-breakpoint CSS classes.
20
+ *
21
+ * Each combination of (value, breakpoint, state) maps to a unique CSS class.
22
+ * No inline styles — pure class-name lookup. Zero runtime cost.
23
+ *
24
+ * CSS class naming convention:
25
+ * base: .{classPrefix}-{value} or .{value} (if classPrefix is empty)
26
+ * breakpoint: .{classPrefix}-{value}_{bp}
27
+ * state: .{classPrefix}-{value}{stateClassSuffix}
28
+ * both: .{classPrefix}-{value}_{bp}{stateClassSuffix}
29
+ *
30
+ * @param styles CSS module styles object
31
+ * @param classPrefix Prefix for class lookup (e.g., "color", "text", "flex"). Empty string for no prefix.
32
+ * @param value The prop value (plain string or responsive object)
33
+ * @param state Interaction state (base, hover, focus, active, disabled)
34
+ */
35
+ export declare function getEnumResponsiveStyles<T extends string>(styles: Record<string, string>, classPrefix: string, value: ResponsiveValue<T> | undefined, state?: StateKey): StyleResult;
36
+ //# sourceMappingURL=responsive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/shared/responsive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,qBAAqB,CAAC;AAE7E,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,EACrC,KAAK,GAAE,QAAiB,EACxB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,GACvC,WAAW,CAwCb;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,MAAM,EACtD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,EACrC,KAAK,GAAE,QAAiB,GACvB,WAAW,CAoCb"}
@@ -0,0 +1,65 @@
1
+ import { STATE_CLASS_SUFFIXES, STATE_SUFFIXES, RESPONSIVE_KEYS } from "./constants.js";
2
+ function getResponsiveVarStyles(styles, classKey, varPrefix, value, state = "base", transform) {
3
+ const result = { className: "", style: {} };
4
+ if (value === void 0) return result;
5
+ const stateSuffix = STATE_SUFFIXES[state];
6
+ const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
7
+ const className = stateClassSuffix ? styles[`${classKey}${stateClassSuffix}`] : styles[classKey];
8
+ if (!className) return result;
9
+ if (typeof value !== "object") {
10
+ const raw = transform ? transform(value) : String(value);
11
+ if (raw === void 0) return result;
12
+ result.className = className;
13
+ result.style[`--t-${varPrefix}${stateSuffix}`] = raw;
14
+ return result;
15
+ }
16
+ let hasAnyValue = false;
17
+ const responsive = value;
18
+ for (const key of RESPONSIVE_KEYS) {
19
+ const v = responsive[key];
20
+ if (v === void 0) continue;
21
+ const raw = transform ? transform(v) : String(v);
22
+ if (raw === void 0) continue;
23
+ const bpSuffix = key === "base" ? "" : `_${key}`;
24
+ result.style[`--t-${varPrefix}${bpSuffix}${stateSuffix}`] = raw;
25
+ hasAnyValue = true;
26
+ }
27
+ if (hasAnyValue) {
28
+ result.className = className;
29
+ }
30
+ return result;
31
+ }
32
+ function getEnumResponsiveStyles(styles, classPrefix, value, state = "base") {
33
+ const result = { className: "", style: {} };
34
+ if (value === void 0) return result;
35
+ const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
36
+ const getClass = (val, bp) => {
37
+ const baseKey = classPrefix ? `${classPrefix}-${val}` : val;
38
+ if (bp === "base") {
39
+ return stateClassSuffix ? styles[`${baseKey}${stateClassSuffix}`] : styles[baseKey];
40
+ }
41
+ return stateClassSuffix ? styles[`${baseKey}_${bp}${stateClassSuffix}`] : styles[`${baseKey}_${bp}`];
42
+ };
43
+ if (typeof value === "string") {
44
+ const cls = getClass(value, "base");
45
+ if (cls) result.className = cls;
46
+ return result;
47
+ }
48
+ const responsive = value;
49
+ const classes = [];
50
+ for (const key of RESPONSIVE_KEYS) {
51
+ const v = responsive[key];
52
+ if (v === void 0) continue;
53
+ const cls = getClass(v, key);
54
+ if (cls) classes.push(cls);
55
+ }
56
+ if (classes.length > 0) {
57
+ result.className = classes.join(" ");
58
+ }
59
+ return result;
60
+ }
61
+ export {
62
+ getEnumResponsiveStyles,
63
+ getResponsiveVarStyles
64
+ };
65
+ //# sourceMappingURL=responsive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsive.js","sources":["../../../../src/components/Box/shared/responsive.ts"],"sourcesContent":["import type { ResponsiveValue, ResponsiveObject } from \"@/utils/breakpoints\";\nimport { RESPONSIVE_KEYS, STATE_SUFFIXES, STATE_CLASS_SUFFIXES } from \"./constants\";\nimport type { StateKey, StyleResult } from \"./types\";\n\n/**\n * Generic helper for variable-based responsive props using CSS fallback chains.\n *\n * With this pattern, each prop has ONE CSS class per state. The CSS handles\n * breakpoint cascading via nested var() fallbacks in media queries.\n * JS only needs to apply the class and set CSS variables for specified breakpoints.\n *\n * @param styles CSS module styles object\n * @param classKey Key to look up in the CSS module (e.g., \"pt\")\n * @param varPrefix CSS variable prefix (e.g., \"pt\" → --t-pt, --t-pt_sm, etc.)\n * @param value The prop value (plain or responsive object)\n * @param state Interaction state (base, hover, focus, active, disabled)\n * @param transform Optional transform from prop value to CSS string (e.g., getRawValue)\n */\nexport function getResponsiveVarStyles<T>(\n styles: Record<string, string>,\n classKey: string,\n varPrefix: string,\n value: ResponsiveValue<T> | undefined,\n state: StateKey = \"base\",\n transform?: (v: T) => string | undefined\n): StyleResult {\n const result: StyleResult = { className: \"\", style: {} };\n\n if (value === undefined) return result;\n\n const stateSuffix = STATE_SUFFIXES[state];\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n\n const className = stateClassSuffix\n ? styles[`${classKey}${stateClassSuffix}`]\n : styles[classKey];\n\n if (!className) return result;\n\n if (typeof value !== \"object\") {\n const raw = transform ? transform(value) : String(value);\n if (raw === undefined) return result;\n result.className = className;\n result.style[`--t-${varPrefix}${stateSuffix}`] = raw;\n return result;\n }\n\n let hasAnyValue = false;\n const responsive = value as ResponsiveObject<T>;\n\n for (const key of RESPONSIVE_KEYS) {\n const v = responsive[key];\n if (v === undefined) continue;\n const raw = transform ? transform(v) : String(v);\n if (raw === undefined) continue;\n const bpSuffix = key === \"base\" ? \"\" : `_${key}`;\n result.style[`--t-${varPrefix}${bpSuffix}${stateSuffix}`] = raw;\n hasAnyValue = true;\n }\n\n if (hasAnyValue) {\n result.className = className;\n }\n\n return result;\n}\n\n/**\n * Generic helper for enum-based responsive props using per-breakpoint CSS classes.\n *\n * Each combination of (value, breakpoint, state) maps to a unique CSS class.\n * No inline styles — pure class-name lookup. Zero runtime cost.\n *\n * CSS class naming convention:\n * base: .{classPrefix}-{value} or .{value} (if classPrefix is empty)\n * breakpoint: .{classPrefix}-{value}_{bp}\n * state: .{classPrefix}-{value}{stateClassSuffix}\n * both: .{classPrefix}-{value}_{bp}{stateClassSuffix}\n *\n * @param styles CSS module styles object\n * @param classPrefix Prefix for class lookup (e.g., \"color\", \"text\", \"flex\"). Empty string for no prefix.\n * @param value The prop value (plain string or responsive object)\n * @param state Interaction state (base, hover, focus, active, disabled)\n */\nexport function getEnumResponsiveStyles<T extends string>(\n styles: Record<string, string>,\n classPrefix: string,\n value: ResponsiveValue<T> | undefined,\n state: StateKey = \"base\"\n): StyleResult {\n const result: StyleResult = { className: \"\", style: {} };\n\n if (value === undefined) return result;\n\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n\n const getClass = (val: string, bp: string): string | undefined => {\n const baseKey = classPrefix ? `${classPrefix}-${val}` : val;\n if (bp === \"base\") {\n return stateClassSuffix ? styles[`${baseKey}${stateClassSuffix}`] : styles[baseKey];\n }\n return stateClassSuffix\n ? styles[`${baseKey}_${bp}${stateClassSuffix}`]\n : styles[`${baseKey}_${bp}`];\n };\n\n if (typeof value === \"string\") {\n const cls = getClass(value, \"base\");\n if (cls) result.className = cls;\n return result;\n }\n\n const responsive = value as ResponsiveObject<T>;\n const classes: string[] = [];\n for (const key of RESPONSIVE_KEYS) {\n const v = responsive[key];\n if (v === undefined) continue;\n const cls = getClass(v, key);\n if (cls) classes.push(cls);\n }\n if (classes.length > 0) {\n result.className = classes.join(\" \");\n }\n\n return result;\n}\n"],"names":[],"mappings":";AAkBO,SAAS,uBACd,QACA,UACA,WACA,OACA,QAAkB,QAClB,WACa;AACb,QAAM,SAAsB,EAAE,WAAW,IAAI,OAAO,CAAA,EAAC;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G,OAAO,IAAI,EAAE,GAAG,gBAAgB,EAAE,IAC5C,OAAO,GAAG,OAAO,IAAI,EAAE,EAAE;AAAA,EAC/B;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,MAAM,SAAS,OAAO,MAAM;AAClC,QAAI,YAAY,YAAY;AAC5B,WAAO;AAAA,EACT;AAEA,QAAM,aAAa;AACnB,QAAM,UAAoB,CAAA;AAC1B,aAAW,OAAO,iBAAiB;AACjC,UAAM,IAAI,WAAW,GAAG;AACxB,QAAI,MAAM,OAAW;AACrB,UAAM,MAAM,SAAS,GAAG,GAAG;AAC3B,QAAI,IAAK,SAAQ,KAAK,GAAG;AAAA,EAC3B;AACA,MAAI,QAAQ,SAAS,GAAG;AACtB,WAAO,YAAY,QAAQ,KAAK,GAAG;AAAA,EACrC;AAEA,SAAO;AACT;"}
@@ -4,4 +4,10 @@ export type StyleResult = {
4
4
  className: string;
5
5
  style: Record<string, string>;
6
6
  };
7
+ export type StateProps<T> = {
8
+ _hover?: T;
9
+ _focus?: T;
10
+ _active?: T;
11
+ _disabled?: T;
12
+ };
7
13
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/shared/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,oBAAoB,CAAC;AAIzD,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/shared/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,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WAAW,CAyBb"}
1
+ {"version":3,"file":"sizing.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/sizing/sizing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAEL,KAAK,WAAW,EAGjB,MAAM,WAAW,CAAC;AAInB,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAGnC,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB,CAAC;AAmBF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,GAAG,gBAAgB,GACpC,WAAW,CAyBb"}
@@ -1,45 +1,13 @@
1
- import { STATE_SUFFIXES, STATE_CLASS_SUFFIXES, RESPONSIVE_KEYS } from "../shared/constants.js";
2
1
  import { getRawValue } from "../shared/spacing.js";
2
+ import { getResponsiveVarStyles } from "../shared/responsive.js";
3
3
  import styles from "./sizing.module.css.js";
4
4
  import clsx from "clsx";
5
- function getSizingProp(key, value, state = "base") {
6
- const result = { className: "", style: {} };
7
- if (value === void 0) return result;
8
- const stateSuffix = STATE_SUFFIXES[state];
9
- const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
10
- if (typeof value !== "object") {
11
- const rawValue = getRawValue(value);
12
- if (rawValue !== void 0) {
13
- const className = stateClassSuffix ? styles[`${key}${stateClassSuffix}`] : styles[key];
14
- result.className = className || "";
15
- result.style[`--t-${key}${stateSuffix}`] = rawValue;
16
- }
17
- return result;
18
- }
19
- for (const responsiveKey of RESPONSIVE_KEYS) {
20
- const rawValue = getRawValue(value[responsiveKey]);
21
- if (rawValue === void 0) continue;
22
- let className;
23
- let varName;
24
- if (responsiveKey === "base") {
25
- className = stateClassSuffix ? styles[`${key}${stateClassSuffix}`] : styles[key];
26
- varName = `--t-${key}${stateSuffix}`;
27
- } else {
28
- className = stateClassSuffix ? styles[`${key}_${responsiveKey}${stateClassSuffix}`] : styles[`${key}_${responsiveKey}`];
29
- varName = `--t-${key}_${responsiveKey}${stateSuffix}`;
30
- }
31
- if (className) {
32
- result.className = clsx(result.className, className);
33
- }
34
- result.style[varName] = rawValue;
35
- }
36
- return result;
37
- }
38
5
  function getSizingStylesForState(props, state) {
39
- const result = { className: "", style: {} };
40
- if (!props) return result;
6
+ if (!props) return { className: "", style: {} };
41
7
  const keys = ["w", "h", "minW", "maxW", "minH", "maxH"];
42
- const results = keys.map((key) => getSizingProp(key, props[key], state));
8
+ const results = keys.map(
9
+ (key) => getResponsiveVarStyles(styles, key, key, props[key], state, getRawValue)
10
+ );
43
11
  return {
44
12
  className: clsx(...results.map((r) => r.className)),
45
13
  style: Object.assign({}, ...results.map((r) => r.style))
@@ -1 +1 @@
1
- {"version":3,"file":"sizing.js","sources":["../../../../src/components/Box/sizing/sizing.ts"],"sourcesContent":["import type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport {\n RESPONSIVE_KEYS,\n STATE_SUFFIXES,\n STATE_CLASS_SUFFIXES,\n type StateKey,\n type StyleResult,\n getRawValue,\n} from \"../shared\";\nimport styles from \"./sizing.module.css\";\nimport clsx from \"clsx\";\n\ntype SizingValue = string | number;\ntype SizingKey = \"w\" | \"h\" | \"minW\" | \"maxW\" | \"minH\" | \"maxH\";\n\nexport type SizingProps = {\n w?: ResponsiveValue<SizingValue>;\n h?: ResponsiveValue<SizingValue>;\n minW?: ResponsiveValue<SizingValue>;\n maxW?: ResponsiveValue<SizingValue>;\n minH?: ResponsiveValue<SizingValue>;\n maxH?: ResponsiveValue<SizingValue>;\n};\n\nexport type SizingStateProps = {\n _hover?: SizingProps;\n _focus?: SizingProps;\n _active?: SizingProps;\n _disabled?: SizingProps;\n};\n\nfunction getSizingProp(\n key: SizingKey,\n value: ResponsiveValue<SizingValue> | undefined,\n state: StateKey = \"base\"\n): StyleResult {\n const result: StyleResult = { className: \"\", style: {} };\n\n if (value === undefined) return result;\n\n const stateSuffix = STATE_SUFFIXES[state];\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n\n if (typeof value !== \"object\") {\n const rawValue = getRawValue(value);\n if (rawValue !== undefined) {\n const className = stateClassSuffix\n ? styles[`${key}${stateClassSuffix}`]\n : styles[key];\n result.className = className || \"\";\n result.style[`--t-${key}${stateSuffix}`] = rawValue;\n }\n return result;\n }\n\n for (const responsiveKey of RESPONSIVE_KEYS) {\n const rawValue = getRawValue(value[responsiveKey]);\n if (rawValue === undefined) continue;\n\n let className: string | undefined;\n let varName: string;\n\n if (responsiveKey === \"base\") {\n className = stateClassSuffix\n ? styles[`${key}${stateClassSuffix}`]\n : styles[key];\n varName = `--t-${key}${stateSuffix}`;\n } else {\n className = stateClassSuffix\n ? styles[`${key}_${responsiveKey}${stateClassSuffix}`]\n : styles[`${key}_${responsiveKey}`];\n varName = `--t-${key}_${responsiveKey}${stateSuffix}`;\n }\n\n if (className) {\n result.className = clsx(result.className, className);\n }\n result.style[varName] = rawValue;\n }\n\n return result;\n}\n\nfunction getSizingStylesForState(\n props: SizingProps | undefined,\n state: StateKey\n): StyleResult {\n const result: StyleResult = { className: \"\", style: {} };\n\n if (!props) return result;\n\n const keys: SizingKey[] = [\"w\", \"h\", \"minW\", \"maxW\", \"minH\", \"maxH\"];\n const results = keys.map((key) => getSizingProp(key, props[key], state));\n\n return {\n className: clsx(...results.map((r) => r.className)),\n style: Object.assign({}, ...results.map((r) => r.style)),\n };\n}\n\nexport function getSizingStyles(\n props: SizingProps & SizingStateProps\n): StyleResult {\n const { _hover, _focus, _active, _disabled, ...baseProps } = props;\n\n const baseStyles = getSizingStylesForState(baseProps, \"base\");\n const hoverStyles = getSizingStylesForState(_hover, \"hover\");\n const focusStyles = getSizingStylesForState(_focus, \"focus\");\n const activeStyles = getSizingStylesForState(_active, \"active\");\n const disabledStyles = getSizingStylesForState(_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 ...baseStyles.style,\n ...hoverStyles.style,\n ...focusStyles.style,\n ...activeStyles.style,\n ...disabledStyles.style,\n },\n };\n}\n"],"names":[],"mappings":";;;;AA+BA,SAAS,cACP,KACA,OACA,QAAkB,QACL;AACb,QAAM,SAAsB,EAAE,WAAW,IAAI,OAAO,CAAA,EAAC;AAErD,MAAI,UAAU,OAAW,QAAO;AAEhC,QAAM,cAAc,eAAe,KAAK;AACxC,QAAM,mBAAmB,qBAAqB,KAAK;AAEnD,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,WAAW,YAAY,KAAK;AAClC,QAAI,aAAa,QAAW;AAC1B,YAAM,YAAY,mBACd,OAAO,GAAG,GAAG,GAAG,gBAAgB,EAAE,IAClC,OAAO,GAAG;AACd,aAAO,YAAY,aAAa;AAChC,aAAO,MAAM,OAAO,GAAG,GAAG,WAAW,EAAE,IAAI;AAAA,IAC7C;AACA,WAAO;AAAA,EACT;AAEA,aAAW,iBAAiB,iBAAiB;AAC3C,UAAM,WAAW,YAAY,MAAM,aAAa,CAAC;AACjD,QAAI,aAAa,OAAW;AAE5B,QAAI;AACJ,QAAI;AAEJ,QAAI,kBAAkB,QAAQ;AAC5B,kBAAY,mBACR,OAAO,GAAG,GAAG,G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AA,MACb,eAAe;AAAA,IAAA;AAAA,IAEjB,OAAO;AAAA,MACL,GAAG,WAAW;AAAA,MACd,GAAG,YAAY;AAAA,MACf,GAAG,YAAY;AAAA,MACf,GAAG,aAAa;AAAA,MAChB,GAAG,eAAe;AAAA,IAAA;AAAA,EACpB;AAEJ;"}
1
+ {"version":3,"file":"sizing.js","sources":["../../../../src/components/Box/sizing/sizing.ts"],"sourcesContent":["import type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport {\n type StateKey,\n type StyleResult,\n getRawValue,\n getResponsiveVarStyles,\n} from \"../shared\";\nimport styles from \"./sizing.module.css\";\nimport clsx from \"clsx\";\n\ntype SizingValue = string | number;\ntype SizingKey = \"w\" | \"h\" | \"minW\" | \"maxW\" | \"minH\" | \"maxH\";\n\nexport type SizingProps = {\n w?: ResponsiveValue<SizingValue>;\n h?: ResponsiveValue<SizingValue>;\n minW?: ResponsiveValue<SizingValue>;\n maxW?: ResponsiveValue<SizingValue>;\n minH?: ResponsiveValue<SizingValue>;\n maxH?: ResponsiveValue<SizingValue>;\n};\n\nexport type SizingStateProps = {\n _hover?: SizingProps;\n _focus?: SizingProps;\n _active?: SizingProps;\n _disabled?: SizingProps;\n};\n\nfunction getSizingStylesForState(\n props: SizingProps | undefined,\n state: StateKey\n): StyleResult {\n if (!props) return { className: \"\", style: {} };\n\n const keys: SizingKey[] = [\"w\", \"h\", \"minW\", \"maxW\", \"minH\", \"maxH\"];\n const results = keys.map((key) =>\n getResponsiveVarStyles(styles, key, key, props[key], state, getRawValue)\n );\n\n return {\n className: clsx(...results.map((r) => r.className)),\n style: Object.assign({}, ...results.map((r) => r.style)),\n };\n}\n\nexport function getSizingStyles(\n props: SizingProps & SizingStateProps\n): StyleResult {\n const { _hover, _focus, _active, _disabled, ...baseProps } = props;\n\n const baseStyles = getSizingStylesForState(baseProps, \"base\");\n const hoverStyles = getSizingStylesForState(_hover, \"hover\");\n const focusStyles = getSizingStylesForState(_focus, \"focus\");\n const activeStyles = getSizingStylesForState(_active, \"active\");\n const disabledStyles = getSizingStylesForState(_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 ...baseStyles.style,\n ...hoverStyles.style,\n ...focusStyles.style,\n ...activeStyles.style,\n ...disabledStyles.style,\n },\n };\n}\n"],"names":[],"mappings":";;;;AA6BA,SAAS,wBACP,OACA,OACa;AACb,MAAI,CAAC,MAAO,QAAO,EAAE,WAAW,IAAI,OAAO,GAAC;AAE5C,QAAM,OAAoB,CAAC,KAAK,KAAK,QAAQ,QAAQ,QAAQ,MAAM;AACnE,QAAM,UAAU,KAAK;AAAA,IAAI,CAAC,QACxB,uBAAuB,QAAQ,KAAK,KAAK,MAAM,GAAG,GAAG,OAAO,WAAW;AAAA,EAAA;AAGzE,SAAO;AAAA,IACL,WAAW,KAAK,GAAG,QAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC;AAAA,IAClD,OAAO,OAAO,OAAO,IAAI,GAAG,QAAQ,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC;AAAA,EAAA;AAE3D;AAEO,SAAS,gBACd,OACa;AACb,QAAM,EAAE,QAAQ,QAAQ,SAAS,WAAW,GAAG,cAAc;AAE7D,QAAM,aAAa,wBAAwB,WAAW,MAAM;AAC5D,QAAM,cAAc,wBAAwB,QAAQ,OAAO;AAC3D,QAAM,cAAc,wBAAwB,QAAQ,OAAO;AAC3D,QAAM,eAAe,wBAAwB,SAAS,QAAQ;AAC9D,QAAM,iBAAiB,wBAAwB,WAAW,UAAU;AAEpE,SAAO;AAAA,IACL,WAAW;AAAA,MACT,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,eAAe;AAAA,IAAA;AAAA,IAEjB,OAAO;AAAA,MACL,GAAG,WAAW;AAAA,MACd,GAAG,YAAY;AAAA,MACf,GAAG,YAAY;AAAA,MACf,GAAG,aAAa;AAAA,MAChB,GAAG,eAAe;AAAA,IAAA;AAAA,EACpB;AAEJ;"}