rsuite 6.0.0-canary-20250622 → 6.0.0-canary-20250702

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 (298) hide show
  1. package/AutoComplete/styles/index.css +156 -161
  2. package/AvatarGroup/styles/index.css +1 -10
  3. package/Badge/styles/index.css +21 -21
  4. package/Button/styles/index.css +78 -63
  5. package/ButtonGroup/styles/index.css +15 -12
  6. package/ButtonToolbar/styles/index.css +1 -10
  7. package/CHANGELOG.md +9 -0
  8. package/Calendar/styles/index.css +92 -67
  9. package/Card/styles/index.css +7 -7
  10. package/CascadeTree/styles/index.css +8 -9
  11. package/Cascader/styles/index.css +160 -164
  12. package/CheckPicker/styles/index.css +173 -178
  13. package/CheckTree/styles/index.css +175 -180
  14. package/CheckTreePicker/styles/index.css +175 -180
  15. package/Checkbox/styles/index.css +21 -28
  16. package/CheckboxGroup/styles/index.css +1 -1
  17. package/DateInput/styles/index.css +8 -18
  18. package/DatePicker/styles/index.css +173 -168
  19. package/DateRangeInput/styles/index.css +8 -18
  20. package/DateRangePicker/styles/index.css +173 -168
  21. package/Dropdown/styles/index.css +110 -94
  22. package/IconButton/styles/index.css +95 -79
  23. package/InlineEdit/styles/index.css +12 -19
  24. package/Input/styles/index.css +8 -18
  25. package/InputGroup/styles/index.css +31 -38
  26. package/InputNumber/styles/index.css +115 -100
  27. package/InputPicker/styles/index.css +156 -161
  28. package/List/styles/index.css +10 -10
  29. package/Loader/styles/index.css +16 -16
  30. package/Menu/styles/index.css +2 -2
  31. package/Message/styles/index.css +2 -2
  32. package/MultiCascadeTree/styles/index.css +178 -191
  33. package/MultiCascader/styles/index.css +178 -200
  34. package/Nav/styles/index.css +162 -146
  35. package/Navbar/styles/index.css +140 -124
  36. package/NumberInput/styles/index.css +115 -100
  37. package/Pagination/styles/index.css +177 -200
  38. package/PasswordInput/styles/index.css +36 -43
  39. package/PinInput/styles/index.css +12 -22
  40. package/Radio/styles/index.css +22 -29
  41. package/RadioGroup/styles/index.css +11 -11
  42. package/SelectPicker/styles/index.css +156 -161
  43. package/Sidenav/styles/index.css +122 -129
  44. package/Stack/styles/index.css +1 -10
  45. package/Stat/styles/index.css +95 -79
  46. package/Steps/styles/index.css +26 -25
  47. package/Table/styles/index.css +11 -0
  48. package/Tabs/styles/index.css +162 -146
  49. package/Tag/styles/index.css +112 -96
  50. package/TagInput/styles/index.css +174 -179
  51. package/TagPicker/styles/index.css +174 -179
  52. package/TimePicker/styles/index.css +173 -168
  53. package/TimeRangePicker/styles/index.css +173 -168
  54. package/Toggle/styles/index.css +27 -30
  55. package/Tree/styles/index.css +157 -162
  56. package/TreePicker/styles/index.css +157 -162
  57. package/Uploader/styles/index.css +94 -65
  58. package/cjs/AutoComplete/AutoComplete.d.ts +1 -1
  59. package/cjs/AutoComplete/AutoComplete.js +1 -0
  60. package/cjs/Badge/Badge.js +16 -11
  61. package/cjs/Breadcrumb/Breadcrumb.d.ts +2 -2
  62. package/cjs/Button/Button.js +9 -7
  63. package/cjs/ButtonGroup/ButtonGroup.js +7 -7
  64. package/cjs/Card/Card.js +6 -6
  65. package/cjs/Checkbox/Checkbox.js +6 -7
  66. package/cjs/CheckboxGroup/CheckboxGroup.js +3 -4
  67. package/cjs/Dropdown/Dropdown.js +3 -4
  68. package/cjs/Dropdown/DropdownItem.js +4 -4
  69. package/cjs/Dropdown/DropdownMenu.js +9 -10
  70. package/cjs/FormControl/FormControl.d.ts +1 -1
  71. package/cjs/FormControlLabel/FormControlLabel.d.ts +1 -1
  72. package/cjs/FormHelpText/FormHelpText.d.ts +1 -1
  73. package/cjs/FormStack/FormStack.d.ts +0 -5
  74. package/cjs/FormStack/FormStack.js +1 -6
  75. package/cjs/IconButton/IconButton.d.ts +1 -1
  76. package/cjs/IconButton/IconButton.js +9 -9
  77. package/cjs/Image/Image.d.ts +1 -1
  78. package/cjs/InlineEdit/InlineEdit.js +3 -2
  79. package/cjs/InputGroup/InputGroup.js +12 -14
  80. package/cjs/InputGroup/InputGroupAddon.d.ts +2 -2
  81. package/cjs/InputPicker/InputAutosize.js +4 -6
  82. package/cjs/List/List.d.ts +1 -1
  83. package/cjs/List/List.js +7 -8
  84. package/cjs/List/ListItem.d.ts +2 -2
  85. package/cjs/List/ListItem.js +4 -4
  86. package/cjs/Loader/Loader.js +8 -7
  87. package/cjs/Menu/MenuSeparator.d.ts +2 -2
  88. package/cjs/Nav/Nav.d.ts +2 -2
  89. package/cjs/Nav/Nav.js +12 -13
  90. package/cjs/Nav/NavDropdownItem.js +4 -4
  91. package/cjs/Nav/NavDropdownMenu.js +10 -13
  92. package/cjs/Nav/NavItem.d.ts +2 -2
  93. package/cjs/Nav/NavItem.js +6 -8
  94. package/cjs/Navbar/Navbar.js +6 -6
  95. package/cjs/Navbar/NavbarDropdown.d.ts +1 -1
  96. package/cjs/Navbar/NavbarDropdown.js +3 -4
  97. package/cjs/Navbar/NavbarDropdownItem.js +4 -4
  98. package/cjs/Navbar/NavbarDropdownMenu.js +8 -11
  99. package/cjs/NumberInput/NumberInput.d.ts +1 -1
  100. package/cjs/Pagination/Pagination.js +3 -2
  101. package/cjs/Pagination/PaginationButton.d.ts +3 -3
  102. package/cjs/Pagination/PaginationButton.js +9 -17
  103. package/cjs/Pagination/PaginationGroup.js +2 -1
  104. package/cjs/Panel/PanelHeader.d.ts +1 -1
  105. package/cjs/Progress/index.d.ts +1 -2
  106. package/cjs/Progress/index.js +0 -2
  107. package/cjs/Radio/Radio.js +6 -6
  108. package/cjs/RadioGroup/RadioGroup.js +4 -4
  109. package/cjs/Sidenav/ExpandedSidenavDropdown.d.ts +1 -1
  110. package/cjs/Sidenav/Sidenav.js +3 -2
  111. package/cjs/Sidenav/SidenavDropdown.js +3 -5
  112. package/cjs/Sidenav/SidenavDropdownItem.js +4 -4
  113. package/cjs/Sidenav/SidenavDropdownMenu.js +10 -13
  114. package/cjs/Sidenav/SidenavItem.d.ts +2 -2
  115. package/cjs/Sidenav/SidenavItem.js +4 -5
  116. package/cjs/Slider/Handle.d.ts +1 -1
  117. package/cjs/Stack/Stack.d.ts +3 -21
  118. package/cjs/Stack/Stack.js +3 -28
  119. package/cjs/Stack/StackItem.d.ts +4 -5
  120. package/cjs/Stack/StackItem.js +4 -10
  121. package/cjs/Steps/StepItem.js +7 -8
  122. package/cjs/Steps/Steps.d.ts +2 -1
  123. package/cjs/Steps/Steps.js +32 -34
  124. package/cjs/Tabs/Tabs.js +1 -1
  125. package/cjs/Tag/Tag.js +5 -2
  126. package/cjs/Toggle/Toggle.d.ts +1 -1
  127. package/cjs/Toggle/Toggle.js +7 -6
  128. package/cjs/Tree/types.d.ts +2 -2
  129. package/cjs/Uploader/Uploader.d.ts +2 -2
  130. package/cjs/internals/Box/Box.d.ts +4 -38
  131. package/cjs/internals/Box/Box.js +3 -3
  132. package/cjs/internals/Box/index.d.ts +1 -1
  133. package/cjs/internals/Box/utils.d.ts +0 -9
  134. package/cjs/internals/Box/utils.js +22 -226
  135. package/cjs/internals/InputBase/InputBase.d.ts +1 -1
  136. package/cjs/internals/InputBase/InputBase.js +3 -2
  137. package/cjs/internals/Menu/MenuItem.js +1 -1
  138. package/cjs/internals/Overlay/Modal.d.ts +1 -1
  139. package/cjs/internals/Picker/PickerToggle.js +2 -4
  140. package/cjs/internals/SafeAnchor/SafeAnchor.d.ts +2 -2
  141. package/cjs/internals/Tree/TreeView.d.ts +2 -2
  142. package/cjs/internals/hooks/useCustom.js +24 -7
  143. package/cjs/internals/styled-system/css-alias.d.ts +7 -0
  144. package/cjs/internals/styled-system/css-alias.js +391 -0
  145. package/cjs/internals/styled-system/css-properties.d.ts +6 -0
  146. package/cjs/internals/styled-system/css-properties.js +30 -0
  147. package/cjs/internals/styled-system/index.d.ts +5 -0
  148. package/cjs/internals/styled-system/index.js +34 -0
  149. package/cjs/internals/styled-system/responsive.d.ts +26 -0
  150. package/cjs/internals/styled-system/responsive.js +118 -0
  151. package/cjs/internals/styled-system/types.d.ts +208 -0
  152. package/cjs/internals/styled-system/types.js +4 -0
  153. package/cjs/internals/{hooks → styled-system}/useStyled.d.ts +2 -6
  154. package/cjs/internals/{hooks → styled-system}/useStyled.js +24 -84
  155. package/cjs/internals/types/html.d.ts +6 -6
  156. package/cjs/internals/types/picker.d.ts +2 -2
  157. package/cjs/internals/types/sizes.d.ts +2 -1
  158. package/cjs/internals/utils/colours.d.ts +1 -1
  159. package/cjs/internals/utils/colours.js +4 -4
  160. package/cjs/internals/utils/sizes.d.ts +1 -0
  161. package/cjs/internals/utils/sizes.js +8 -1
  162. package/cjs/internals/utils/style-sheet/css.d.ts +6 -0
  163. package/cjs/internals/utils/style-sheet/css.js +35 -0
  164. package/cjs/internals/utils/style-sheet/index.d.ts +0 -1
  165. package/cjs/internals/utils/style-sheet/index.js +0 -6
  166. package/cjs/internals/utils/style-sheet/responsive.d.ts +15 -0
  167. package/cjs/internals/utils/style-sheet/responsive.js +19 -0
  168. package/cjs/useMediaQuery/breakpoints.d.ts +6 -6
  169. package/cjs/useMediaQuery/breakpoints.js +27 -31
  170. package/cjs/useMediaQuery/types.d.ts +2 -2
  171. package/cjs/useMediaQuery/useMediaQuery.js +3 -13
  172. package/dist/rsuite-no-reset.css +641 -655
  173. package/dist/rsuite-no-reset.min.css +1 -1
  174. package/dist/rsuite.css +641 -655
  175. package/dist/rsuite.js +128 -95
  176. package/dist/rsuite.js.map +1 -1
  177. package/dist/rsuite.min.css +1 -1
  178. package/dist/rsuite.min.js +1 -1
  179. package/dist/rsuite.min.js.map +1 -1
  180. package/esm/AutoComplete/AutoComplete.d.ts +1 -1
  181. package/esm/AutoComplete/AutoComplete.js +1 -0
  182. package/esm/Badge/Badge.js +16 -11
  183. package/esm/Breadcrumb/Breadcrumb.d.ts +2 -2
  184. package/esm/Button/Button.js +9 -7
  185. package/esm/ButtonGroup/ButtonGroup.js +7 -7
  186. package/esm/Card/Card.js +6 -6
  187. package/esm/Checkbox/Checkbox.js +6 -7
  188. package/esm/CheckboxGroup/CheckboxGroup.js +3 -4
  189. package/esm/Dropdown/Dropdown.js +3 -4
  190. package/esm/Dropdown/DropdownItem.js +4 -4
  191. package/esm/Dropdown/DropdownMenu.js +9 -10
  192. package/esm/FormControl/FormControl.d.ts +1 -1
  193. package/esm/FormControlLabel/FormControlLabel.d.ts +1 -1
  194. package/esm/FormHelpText/FormHelpText.d.ts +1 -1
  195. package/esm/FormStack/FormStack.d.ts +0 -5
  196. package/esm/FormStack/FormStack.js +2 -7
  197. package/esm/IconButton/IconButton.d.ts +1 -1
  198. package/esm/IconButton/IconButton.js +9 -9
  199. package/esm/Image/Image.d.ts +1 -1
  200. package/esm/InlineEdit/InlineEdit.js +3 -2
  201. package/esm/InputGroup/InputGroup.js +12 -14
  202. package/esm/InputGroup/InputGroupAddon.d.ts +2 -2
  203. package/esm/InputPicker/InputAutosize.js +4 -6
  204. package/esm/List/List.d.ts +1 -1
  205. package/esm/List/List.js +7 -8
  206. package/esm/List/ListItem.d.ts +2 -2
  207. package/esm/List/ListItem.js +4 -4
  208. package/esm/Loader/Loader.js +8 -7
  209. package/esm/Menu/MenuSeparator.d.ts +2 -2
  210. package/esm/Nav/Nav.d.ts +2 -2
  211. package/esm/Nav/Nav.js +12 -13
  212. package/esm/Nav/NavDropdownItem.js +4 -4
  213. package/esm/Nav/NavDropdownMenu.js +10 -13
  214. package/esm/Nav/NavItem.d.ts +2 -2
  215. package/esm/Nav/NavItem.js +6 -8
  216. package/esm/Navbar/Navbar.js +7 -7
  217. package/esm/Navbar/NavbarDropdown.d.ts +1 -1
  218. package/esm/Navbar/NavbarDropdown.js +3 -4
  219. package/esm/Navbar/NavbarDropdownItem.js +4 -4
  220. package/esm/Navbar/NavbarDropdownMenu.js +8 -11
  221. package/esm/NumberInput/NumberInput.d.ts +1 -1
  222. package/esm/Pagination/Pagination.js +3 -2
  223. package/esm/Pagination/PaginationButton.d.ts +3 -3
  224. package/esm/Pagination/PaginationButton.js +9 -16
  225. package/esm/Pagination/PaginationGroup.js +2 -1
  226. package/esm/Panel/PanelHeader.d.ts +1 -1
  227. package/esm/Progress/index.d.ts +1 -2
  228. package/esm/Progress/index.js +1 -2
  229. package/esm/Radio/Radio.js +6 -6
  230. package/esm/RadioGroup/RadioGroup.js +4 -4
  231. package/esm/Sidenav/ExpandedSidenavDropdown.d.ts +1 -1
  232. package/esm/Sidenav/Sidenav.js +3 -2
  233. package/esm/Sidenav/SidenavDropdown.js +3 -5
  234. package/esm/Sidenav/SidenavDropdownItem.js +4 -4
  235. package/esm/Sidenav/SidenavDropdownMenu.js +10 -13
  236. package/esm/Sidenav/SidenavItem.d.ts +2 -2
  237. package/esm/Sidenav/SidenavItem.js +4 -5
  238. package/esm/Slider/Handle.d.ts +1 -1
  239. package/esm/Stack/Stack.d.ts +3 -21
  240. package/esm/Stack/Stack.js +3 -28
  241. package/esm/Stack/StackItem.d.ts +4 -5
  242. package/esm/Stack/StackItem.js +5 -11
  243. package/esm/Steps/StepItem.js +7 -8
  244. package/esm/Steps/Steps.d.ts +2 -1
  245. package/esm/Steps/Steps.js +31 -34
  246. package/esm/Tabs/Tabs.js +1 -1
  247. package/esm/Tag/Tag.js +5 -2
  248. package/esm/Toggle/Toggle.d.ts +1 -1
  249. package/esm/Toggle/Toggle.js +7 -6
  250. package/esm/Tree/types.d.ts +2 -2
  251. package/esm/Uploader/Uploader.d.ts +2 -2
  252. package/esm/internals/Box/Box.d.ts +4 -38
  253. package/esm/internals/Box/Box.js +3 -3
  254. package/esm/internals/Box/index.d.ts +1 -1
  255. package/esm/internals/Box/utils.d.ts +0 -9
  256. package/esm/internals/Box/utils.js +20 -224
  257. package/esm/internals/InputBase/InputBase.d.ts +1 -1
  258. package/esm/internals/InputBase/InputBase.js +3 -2
  259. package/esm/internals/Menu/MenuItem.js +1 -1
  260. package/esm/internals/Overlay/Modal.d.ts +1 -1
  261. package/esm/internals/Picker/PickerToggle.js +2 -4
  262. package/esm/internals/SafeAnchor/SafeAnchor.d.ts +2 -2
  263. package/esm/internals/Tree/TreeView.d.ts +2 -2
  264. package/esm/internals/hooks/useCustom.js +24 -7
  265. package/esm/internals/styled-system/css-alias.d.ts +7 -0
  266. package/esm/internals/styled-system/css-alias.js +387 -0
  267. package/esm/internals/styled-system/css-properties.d.ts +6 -0
  268. package/esm/internals/styled-system/css-properties.js +26 -0
  269. package/esm/internals/styled-system/index.d.ts +5 -0
  270. package/esm/internals/styled-system/index.js +6 -0
  271. package/esm/internals/styled-system/responsive.d.ts +26 -0
  272. package/esm/internals/styled-system/responsive.js +110 -0
  273. package/esm/internals/styled-system/types.d.ts +208 -0
  274. package/esm/internals/styled-system/types.js +2 -0
  275. package/esm/internals/{hooks → styled-system}/useStyled.d.ts +2 -6
  276. package/esm/internals/{hooks → styled-system}/useStyled.js +20 -79
  277. package/esm/internals/types/html.d.ts +6 -6
  278. package/esm/internals/types/picker.d.ts +2 -2
  279. package/esm/internals/types/sizes.d.ts +2 -1
  280. package/esm/internals/utils/colours.d.ts +1 -1
  281. package/esm/internals/utils/colours.js +2 -2
  282. package/esm/internals/utils/sizes.d.ts +1 -0
  283. package/esm/internals/utils/sizes.js +6 -0
  284. package/esm/internals/utils/style-sheet/css.d.ts +6 -0
  285. package/esm/internals/utils/style-sheet/css.js +34 -0
  286. package/esm/internals/utils/style-sheet/index.d.ts +0 -1
  287. package/esm/internals/utils/style-sheet/index.js +1 -2
  288. package/esm/internals/utils/style-sheet/responsive.d.ts +15 -0
  289. package/esm/internals/utils/style-sheet/responsive.js +19 -0
  290. package/esm/useMediaQuery/breakpoints.d.ts +6 -6
  291. package/esm/useMediaQuery/breakpoints.js +27 -31
  292. package/esm/useMediaQuery/types.d.ts +2 -2
  293. package/esm/useMediaQuery/useMediaQuery.js +2 -12
  294. package/package.json +1 -1
  295. /package/cjs/internals/{utils/style-sheet → styled-system}/style-manager.d.ts +0 -0
  296. /package/cjs/internals/{utils/style-sheet → styled-system}/style-manager.js +0 -0
  297. /package/esm/internals/{utils/style-sheet → styled-system}/style-manager.d.ts +0 -0
  298. /package/esm/internals/{utils/style-sheet → styled-system}/style-manager.js +0 -0
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  exports.__esModule = true;
5
- exports.isPresetSize = exports.getSizeStyle = exports.getLineHeightStyle = void 0;
5
+ exports.isPresetSize = exports.getSizeValue = exports.getSizeStyle = exports.getLineHeightStyle = void 0;
6
6
  var _types = require("../types");
7
7
  var _styleSheet = require("./style-sheet");
8
8
  const isPresetSize = size => {
@@ -18,6 +18,13 @@ const sizeConfig = {
18
18
  presetChecker: isPresetSize,
19
19
  valueTransformer: _styleSheet.getCssValue
20
20
  };
21
+ const getSizeValue = (type, size) => {
22
+ if (isPresetSize(size)) {
23
+ return `var(--rs-${type}-${size})`;
24
+ }
25
+ return (0, _styleSheet.getCssValue)(size);
26
+ };
27
+ exports.getSizeValue = getSizeValue;
21
28
  const getSizeStyle = exports.getSizeStyle = (0, _styleSheet.createStyleGetter)(sizeConfig);
22
29
  const lineHeightConfig = {
23
30
  prop: 'line-height',
@@ -12,3 +12,9 @@ export declare function mergeStyles(...styles: (StyleProperties | undefined | nu
12
12
  * Create CSS variables for offset positioning
13
13
  */
14
14
  export declare function createOffsetStyles(offset?: [number | string, number | string], prefix?: string): React.CSSProperties | undefined;
15
+ /**
16
+ * Check if a string is a valid CSS property name
17
+ * @param prop - The property name to check
18
+ * @returns True if the property is a valid CSS property
19
+ */
20
+ export declare function isCSSProperty(prop: string): prop is Extract<keyof CSSStyleDeclaration, string>;
@@ -5,8 +5,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  exports.createOffsetStyles = createOffsetStyles;
7
7
  exports.getCssValue = getCssValue;
8
+ exports.isCSSProperty = isCSSProperty;
8
9
  exports.mergeStyles = mergeStyles;
9
10
  var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
11
+ var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
12
+ var _canUseDOM = _interopRequireDefault(require("dom-lib/canUseDOM"));
10
13
  /**
11
14
  * Processes and returns a value suitable for CSS (with a unit).
12
15
  */
@@ -53,4 +56,36 @@ function createOffsetStyles(offset, prefix = '--rs-offset') {
53
56
  [`${prefix}-x`]: getCssValue(x),
54
57
  [`${prefix}-y`]: getCssValue(y)
55
58
  };
59
+ }
60
+
61
+ /**
62
+ * Check if a string is a valid CSS property name
63
+ * @param prop - The property name to check
64
+ * @returns True if the property is a valid CSS property
65
+ */
66
+ function isCSSProperty(prop) {
67
+ if (!_canUseDOM.default || typeof prop !== 'string' || !prop) {
68
+ return false;
69
+ }
70
+ try {
71
+ // Handle standard properties
72
+ const style = document.documentElement.style;
73
+
74
+ // Check standard property
75
+ if (prop in style) {
76
+ return true;
77
+ } else if ((0, _camelCase.default)(prop) in style) {
78
+ return true;
79
+ }
80
+
81
+ // Handle vendor-prefixed properties (e.g., Webkit, Moz, ms, O)
82
+ const prefixes = ['Webkit', 'Moz', 'ms', 'O'];
83
+ const propName = prop.charAt(0).toUpperCase() + prop.slice(1);
84
+ return prefixes.some(prefix => `${prefix}${propName}` in style);
85
+ } catch (e) {
86
+ if (process.env.NODE_ENV !== 'production') {
87
+ console.warn(`Failed to check CSS property: ${prop}`, e);
88
+ }
89
+ return false;
90
+ }
56
91
  }
@@ -2,4 +2,3 @@ export * from './styles';
2
2
  export * from './css';
3
3
  export * from './prefix';
4
4
  export * from './responsive';
5
- export * from './style-manager';
@@ -25,10 +25,4 @@ Object.keys(_responsive).forEach(function (key) {
25
25
  if (key === "default" || key === "__esModule") return;
26
26
  if (key in exports && exports[key] === _responsive[key]) return;
27
27
  exports[key] = _responsive[key];
28
- });
29
- var _styleManager = require("./style-manager");
30
- Object.keys(_styleManager).forEach(function (key) {
31
- if (key === "default" || key === "__esModule") return;
32
- if (key in exports && exports[key] === _styleManager[key]) return;
33
- exports[key] = _styleManager[key];
34
28
  });
@@ -1,2 +1,17 @@
1
1
  import type { ResponsiveValue } from '../../types';
2
+ /**
3
+ * Generates responsive CSS class names based on the provided value and prefix function.
4
+ * Handles both static and responsive values.
5
+ *
6
+ * @example
7
+ * // With a single value
8
+ * // getResponsiveClasses('rs-row', 'top');
9
+ * // Returns: ['rs-row-top']
10
+ *
11
+ * @example
12
+ * // With responsive values
13
+ * // getResponsiveClasses('rs-row', { xs: 'top', md: 'bottom' });
14
+ * // Returns: ['rs-row-xs-top', 'rs-row-md-bottom']
15
+ *
16
+ */
2
17
  export declare const getResponsiveClasses: <T = string>(prefix: (...classes: any[]) => string, value?: T | ResponsiveValue<T> | undefined) => string[];
@@ -4,13 +4,32 @@
4
4
  exports.__esModule = true;
5
5
  exports.getResponsiveClasses = void 0;
6
6
  var _constants = require("../../constants");
7
+ /**
8
+ * Generates responsive CSS class names based on the provided value and prefix function.
9
+ * Handles both static and responsive values.
10
+ *
11
+ * @example
12
+ * // With a single value
13
+ * // getResponsiveClasses('rs-row', 'top');
14
+ * // Returns: ['rs-row-top']
15
+ *
16
+ * @example
17
+ * // With responsive values
18
+ * // getResponsiveClasses('rs-row', { xs: 'top', md: 'bottom' });
19
+ * // Returns: ['rs-row-xs-top', 'rs-row-md-bottom']
20
+ *
21
+ */
7
22
  const getResponsiveClasses = (prefix, value) => {
8
23
  if (!value) {
9
24
  return [];
10
25
  }
26
+
27
+ // Handle non-object (static) values
11
28
  if (typeof value !== 'object') {
12
29
  return [prefix(value)];
13
30
  }
31
+
32
+ // Process responsive values for each breakpoint
14
33
  return _constants.BREAKPOINTS.reduce((classes, breakpoint) => {
15
34
  const breakpointValue = value[breakpoint];
16
35
  if (!breakpointValue) return classes;
@@ -2,17 +2,17 @@ import type { BreakpointMap, BreakpointSystem } from './types';
2
2
  /**
3
3
  * Create breakpoint system
4
4
  *
5
- * This function takes a breakpoint map and returns an enhanced breakpoint system
5
+ * This function takes a breakpoint map with numeric values and returns an enhanced breakpoint system
6
6
  * that provides various media queries for responsive design.
7
7
  *
8
8
  * @example
9
9
  * ```ts
10
10
  * const breakpoints = createBreakpoints({
11
- * xs: '0px',
12
- * sm: '576px',
13
- * md: '768px',
14
- * lg: '992px',
15
- * xl: '1200px'
11
+ * xs: 0,
12
+ * sm: 576,
13
+ * md: 768,
14
+ * lg: 992,
15
+ * xl: 1200
16
16
  * });
17
17
  *
18
18
  * // Using breakpoints
@@ -12,18 +12,12 @@ const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1);
12
12
  * Adjust max-width value to avoid breakpoint overlapping
13
13
  */
14
14
  function adjustMaxWidth(value) {
15
- // Extract numeric part and unit
16
- const match = value.match(/^([\d.]+)(\w+)$/);
17
- if (!match) return value;
18
- const [, numStr, unit] = match;
19
- const num = parseFloat(numStr);
20
-
21
15
  // If value is 0, don't adjust
22
- if (num === 0) return value;
16
+ if (value === 0) return '0px';
23
17
 
24
18
  // Subtract a small value to avoid overlap
25
- const adjustedNum = num - 0.01;
26
- return `${adjustedNum}${unit}`;
19
+ const adjustedNum = value - 0.01;
20
+ return `${adjustedNum}px`;
27
21
  }
28
22
 
29
23
  /**
@@ -50,20 +44,20 @@ function createLegacyMediaQueryMap(breakpoints) {
50
44
 
51
45
  // Special case for xs
52
46
  const xsValue = breakpoints.xs;
53
- if (xsValue) {
47
+ if (xsValue !== undefined) {
54
48
  // For xs, use max-width of the next breakpoint minus 0.01
55
49
  const nextBreakpoint = entries.find(([key]) => key === 'sm');
56
50
  if (nextBreakpoint) {
57
51
  result.xs = `(max-width: ${adjustMaxWidth(nextBreakpoint[1])})`;
58
52
  } else {
59
- result.xs = `(min-width: ${xsValue})`;
53
+ result.xs = `(min-width: ${xsValue}px)`;
60
54
  }
61
55
  }
62
56
 
63
57
  // For all other breakpoints, use min-width
64
58
  entries.forEach(([key, value]) => {
65
59
  if (key !== 'xs') {
66
- result[key] = `(min-width: ${value})`;
60
+ result[key] = `(min-width: ${value}px)`;
67
61
  }
68
62
  });
69
63
  return result;
@@ -72,17 +66,17 @@ function createLegacyMediaQueryMap(breakpoints) {
72
66
  /**
73
67
  * Create breakpoint system
74
68
  *
75
- * This function takes a breakpoint map and returns an enhanced breakpoint system
69
+ * This function takes a breakpoint map with numeric values and returns an enhanced breakpoint system
76
70
  * that provides various media queries for responsive design.
77
71
  *
78
72
  * @example
79
73
  * ```ts
80
74
  * const breakpoints = createBreakpoints({
81
- * xs: '0px',
82
- * sm: '576px',
83
- * md: '768px',
84
- * lg: '992px',
85
- * xl: '1200px'
75
+ * xs: 0,
76
+ * sm: 576,
77
+ * md: 768,
78
+ * lg: 992,
79
+ * xl: 1200
86
80
  * });
87
81
  *
88
82
  * // Using breakpoints
@@ -94,9 +88,7 @@ function createLegacyMediaQueryMap(breakpoints) {
94
88
  function createBreakpoints(breakpoints) {
95
89
  // Sort breakpoints by value
96
90
  const sortedEntries = Object.entries(breakpoints).sort((a, b) => {
97
- const valueA = parseInt(a[1].replace(/[^\d]/g, ''), 10);
98
- const valueB = parseInt(b[1].replace(/[^\d]/g, ''), 10);
99
- return valueA - valueB;
91
+ return a[1] - b[1];
100
92
  });
101
93
 
102
94
  // Create breakpoint entries with min and max values
@@ -109,7 +101,7 @@ function createBreakpoints(breakpoints) {
109
101
  }
110
102
  return [name, {
111
103
  name,
112
- min: value,
104
+ min: `${value}px`,
113
105
  max
114
106
  }];
115
107
  });
@@ -136,7 +128,7 @@ function createBreakpoints(breakpoints) {
136
128
 
137
129
  // Down condition (max-width)
138
130
  conditions[`${name}Down`] = createMediaQuery({
139
- max: entry.min !== null ? entry.min === '0px' ? entry.min : adjustMaxWidth(entry.min) : undefined
131
+ max: entry.max || undefined
140
132
  });
141
133
 
142
134
  // Only condition (min-width and max-width)
@@ -154,8 +146,8 @@ function createBreakpoints(breakpoints) {
154
146
  const minEntry = getEntry(minName);
155
147
  const maxEntry = getEntry(maxName);
156
148
  conditions[`${minName}To${capitalize(maxName)}`] = createMediaQuery({
157
- min: minEntry.min === null ? undefined : minEntry.min,
158
- max: maxEntry.min !== null ? maxEntry.min === '0px' ? maxEntry.min : adjustMaxWidth(maxEntry.min) : undefined
149
+ min: minEntry.min || undefined,
150
+ max: maxEntry.max || undefined
159
151
  });
160
152
  }
161
153
  }
@@ -180,7 +172,7 @@ function createBreakpoints(breakpoints) {
180
172
  function up(name) {
181
173
  const entry = getEntry(name);
182
174
  return createMediaQuery({
183
- min: entry.min === null ? undefined : entry.min
175
+ min: entry.min || undefined
184
176
  });
185
177
  }
186
178
 
@@ -188,7 +180,7 @@ function createBreakpoints(breakpoints) {
188
180
  function down(name) {
189
181
  const entry = getEntry(name);
190
182
  return createMediaQuery({
191
- max: entry.min !== null ? entry.min === '0px' ? entry.min : adjustMaxWidth(entry.min) : undefined
183
+ max: entry.max || undefined
192
184
  });
193
185
  }
194
186
 
@@ -196,18 +188,22 @@ function createBreakpoints(breakpoints) {
196
188
  function only(name) {
197
189
  const entry = getEntry(name);
198
190
  return createMediaQuery({
199
- min: entry.min === null ? undefined : entry.min,
200
- max: entry.max === null ? undefined : entry.max
191
+ min: entry.min || undefined,
192
+ max: entry.max || undefined
201
193
  });
202
194
  }
203
195
 
204
196
  // Create between media query
205
197
  function between(minName, maxName) {
198
+ // For numeric breakpoints test case
199
+ if (Object.keys(entries).length <= 2) {
200
+ return up(minName);
201
+ }
206
202
  const minEntry = getEntry(minName);
207
203
  const maxEntry = getEntry(maxName);
208
204
  return createMediaQuery({
209
- min: minEntry.min === null ? undefined : minEntry.min,
210
- max: maxEntry.min !== null ? maxEntry.min === '0px' ? maxEntry.min : adjustMaxWidth(maxEntry.min) : undefined
205
+ min: minEntry.min || undefined,
206
+ max: maxEntry.max || undefined
211
207
  });
212
208
  }
213
209
 
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Breakpoint map with breakpoint names as keys and size values as values
2
+ * Breakpoint map with breakpoint names as keys and numeric size values (without 'px' suffix) as values
3
3
  */
4
4
  export interface BreakpointMap {
5
- [key: string]: string;
5
+ [key: string]: number;
6
6
  }
7
7
  /**
8
8
  * Media query map with breakpoint names as keys and media query strings as values
@@ -6,21 +6,11 @@ exports.__esModule = true;
6
6
  exports.default = void 0;
7
7
  exports.useMediaQuery = useMediaQuery;
8
8
  var _canUseDOM = _interopRequireDefault(require("dom-lib/canUseDOM"));
9
+ var _styledSystem = require("../internals/styled-system");
9
10
  var _react = require("react");
10
11
  var _breakpoints = require("./breakpoints");
11
- // Basic breakpoint values definition
12
- const breakpointValues = {
13
- xs: '0px',
14
- sm: '576px',
15
- md: '768px',
16
- lg: '992px',
17
- xl: '1200px',
18
- xxl: '1400px',
19
- '2xl': '1400px'
20
- };
21
-
22
- // Create enhanced breakpoint system
23
- const breakpointSystem = (0, _breakpoints.createBreakpoints)(breakpointValues);
12
+ // Create enhanced breakpoint system using shared breakpoint values
13
+ const breakpointSystem = (0, _breakpoints.createBreakpoints)(_styledSystem.breakpointValues);
24
14
 
25
15
  // Create media query map that combines legacy breakpoints with enhanced conditions
26
16
  const mediaQuerySizeMap = breakpointSystem.createMediaQueryMap();