rsuite 6.0.1 → 6.1.1

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 (278) hide show
  1. package/Accordion/styles/index.scss +3 -0
  2. package/Animation/styles/_animation.scss +95 -0
  3. package/Animation/styles/_bounce.scss +36 -0
  4. package/Animation/styles/_collapse.scss +23 -0
  5. package/Animation/styles/_fade.scss +10 -0
  6. package/Animation/styles/_mixin.scss +15 -0
  7. package/Animation/styles/_slide.scss +34 -0
  8. package/Animation/styles/_variables.scss +4 -0
  9. package/Animation/styles/index.scss +8 -0
  10. package/AutoComplete/styles/index.scss +43 -0
  11. package/Avatar/styles/index.scss +48 -0
  12. package/AvatarGroup/styles/index.scss +27 -0
  13. package/Badge/styles/_variables.scss +48 -0
  14. package/Badge/styles/index.scss +111 -0
  15. package/Box/styles/index.scss +1 -0
  16. package/Breadcrumb/styles/index.scss +50 -0
  17. package/Button/styles/_mixin.scss +83 -0
  18. package/Button/styles/_variables.scss +38 -0
  19. package/Button/styles/index.scss +374 -0
  20. package/ButtonGroup/styles/index.scss +96 -0
  21. package/ButtonToolbar/styles/index.scss +9 -0
  22. package/CHANGELOG.md +31 -0
  23. package/Calendar/styles/_variables.scss +16 -0
  24. package/Calendar/styles/index.scss +673 -0
  25. package/Card/styles/index.scss +63 -0
  26. package/CardGroup/styles/index.scss +10 -0
  27. package/Carousel/styles/index.scss +204 -0
  28. package/CascadeTree/styles/_search.scss +39 -0
  29. package/CascadeTree/styles/index.scss +83 -0
  30. package/Cascader/styles/index.scss +5 -0
  31. package/Center/styles/index.scss +11 -0
  32. package/CheckPicker/styles/index.scss +23 -0
  33. package/CheckTree/styles/_variables.scss +5 -0
  34. package/CheckTree/styles/index.scss +121 -0
  35. package/CheckTreePicker/styles/index.scss +20 -0
  36. package/Checkbox/styles/_mixin.scss +5 -0
  37. package/Checkbox/styles/_variables.scss +4 -0
  38. package/Checkbox/styles/index.scss +158 -0
  39. package/CheckboxGroup/styles/index.scss +14 -0
  40. package/Col/styles/index.scss +2 -0
  41. package/Container/stories/styles.scss +23 -0
  42. package/Container/styles/index.scss +16 -0
  43. package/Content/styles/index.scss +6 -0
  44. package/DateInput/styles/index.scss +1 -0
  45. package/DatePicker/styles/_mixin.scss +10 -0
  46. package/DatePicker/styles/index.scss +171 -0
  47. package/DateRangeInput/styles/index.scss +1 -0
  48. package/DateRangePicker/styles/index.scss +151 -0
  49. package/Divider/styles/index.scss +85 -0
  50. package/Drawer/styles/_mixin.scss +23 -0
  51. package/Drawer/styles/_variables.scss +18 -0
  52. package/Drawer/styles/index.scss +244 -0
  53. package/Dropdown/styles/_mixin.scss +4 -0
  54. package/Dropdown/styles/_variables.scss +12 -0
  55. package/Dropdown/styles/index.scss +334 -0
  56. package/FlexboxGrid/styles/index.scss +82 -0
  57. package/Footer/styles/index.scss +5 -0
  58. package/Form/styles/index.scss +3 -0
  59. package/FormControl/styles/_variables.scss +4 -0
  60. package/FormControl/styles/index.scss +82 -0
  61. package/FormControlLabel/styles/index.scss +7 -0
  62. package/FormErrorMessage/styles/_animation.scss +43 -0
  63. package/FormErrorMessage/styles/_variables.scss +7 -0
  64. package/FormErrorMessage/styles/index.scss +146 -0
  65. package/FormGroup/styles/index.scss +75 -0
  66. package/FormHelpText/styles/index.scss +21 -0
  67. package/FormStack/styles/index.scss +15 -0
  68. package/Grid/styles/_columns.scss +23 -0
  69. package/Grid/styles/_mixin.scss +110 -0
  70. package/Grid/styles/_row.scss +44 -0
  71. package/Grid/styles/_variables.scss +6 -0
  72. package/Grid/styles/index.scss +115 -0
  73. package/Header/styles/index.scss +5 -0
  74. package/Heading/styles/_variables.scss +19 -0
  75. package/Heading/styles/index.scss +42 -0
  76. package/HeadingGroup/styles/index.scss +5 -0
  77. package/Highlight/styles/index.scss +9 -0
  78. package/IconButton/styles/index.scss +90 -0
  79. package/Image/styles/index.scss +36 -0
  80. package/InlineEdit/styles/index.scss +51 -0
  81. package/Input/styles/_mixin.scss +39 -0
  82. package/Input/styles/_variables.scss +27 -0
  83. package/Input/styles/index.scss +23 -0
  84. package/InputGroup/styles/index.scss +264 -0
  85. package/InputNumber/styles/index.scss +1 -0
  86. package/InputPicker/styles/_mixin.scss +7 -0
  87. package/InputPicker/styles/index.scss +64 -0
  88. package/Kbd/styles/_mixin.scss +24 -0
  89. package/Kbd/styles/_variables.scss +13 -0
  90. package/Kbd/styles/index.scss +21 -0
  91. package/Link/styles/index.scss +41 -0
  92. package/List/styles/index.scss +111 -0
  93. package/Loader/styles/_mixin.scss +37 -0
  94. package/Loader/styles/_variables.scss +19 -0
  95. package/Loader/styles/index.scss +120 -0
  96. package/Menu/styles/index.scss +109 -0
  97. package/Message/styles/index.scss +189 -0
  98. package/Modal/styles/_animation.scss +15 -0
  99. package/Modal/styles/_variables.scss +16 -0
  100. package/Modal/styles/index.scss +186 -0
  101. package/MultiCascadeTree/styles/index.scss +35 -0
  102. package/MultiCascader/styles/index.scss +3 -0
  103. package/Nav/styles/index.scss +383 -0
  104. package/Navbar/styles/index.scss +253 -0
  105. package/Notification/styles/index.scss +116 -0
  106. package/NumberInput/styles/_mixin.scss +11 -0
  107. package/NumberInput/styles/index.scss +78 -0
  108. package/Pagination/styles/_pagination-group.scss +52 -0
  109. package/Pagination/styles/index.scss +77 -0
  110. package/Panel/styles/index.scss +122 -0
  111. package/PanelGroup/styles/index.scss +34 -0
  112. package/PasswordInput/styles/index.scss +3 -0
  113. package/PasswordStrengthMeter/styles/index.scss +41 -0
  114. package/PinInput/styles/index.scss +93 -0
  115. package/Placeholder/styles/_mixin.scss +9 -0
  116. package/Placeholder/styles/index.scss +155 -0
  117. package/Popover/styles/index.scss +224 -0
  118. package/Popover/styles/mixins.scss +54 -0
  119. package/Progress/styles/_animation.scss +69 -0
  120. package/Progress/styles/_mixins.scss +6 -0
  121. package/Progress/styles/_progress-line.scss +343 -0
  122. package/Progress/styles/index.scss +3 -0
  123. package/ProgressCircle/styles/index.scss +2 -0
  124. package/ProgressCircle/styles/progress-circle.scss +49 -0
  125. package/Radio/styles/_mixin.scss +5 -0
  126. package/Radio/styles/_variables.scss +5 -0
  127. package/Radio/styles/index.scss +147 -0
  128. package/RadioGroup/styles/_variables.scss +10 -0
  129. package/RadioGroup/styles/index.scss +83 -0
  130. package/RadioTile/styles/index.scss +80 -0
  131. package/RadioTileGroup/styles/index.scss +1 -0
  132. package/RangeSlider/styles/index.scss +4 -0
  133. package/Rate/styles/index.scss +141 -0
  134. package/Row/styles/index.scss +2 -0
  135. package/SegmentedControl/styles/_mixin.scss +7 -0
  136. package/SegmentedControl/styles/_variables.scss +43 -0
  137. package/SegmentedControl/styles/index.scss +147 -0
  138. package/SelectPicker/styles/index.scss +44 -0
  139. package/Sidebar/styles/index.scss +17 -0
  140. package/Sidenav/styles/index.scss +635 -0
  141. package/Sidenav/styles/mixin.scss +23 -0
  142. package/Slider/styles/index.scss +298 -0
  143. package/Stack/styles/_variables.scss +11 -0
  144. package/Stack/styles/index.scss +79 -0
  145. package/Stat/styles/index.scss +126 -0
  146. package/StatGroup/styles/index.scss +10 -0
  147. package/Steps/styles/index.scss +222 -0
  148. package/Table/styles/index.scss +473 -0
  149. package/Table/styles/mixin.scss +8 -0
  150. package/Tabs/styles/index.scss +24 -0
  151. package/Tag/styles/_variables.scss +13 -0
  152. package/Tag/styles/index.scss +62 -0
  153. package/TagGroup/styles/index.scss +14 -0
  154. package/TagInput/styles/index.scss +5 -0
  155. package/TagPicker/styles/index.scss +141 -0
  156. package/Text/styles/index.scss +142 -0
  157. package/Text/styles/variables.scss +9 -0
  158. package/Textarea/styles/index.scss +9 -0
  159. package/TimePicker/styles/index.scss +1 -0
  160. package/TimeRangePicker/styles/index.scss +1 -0
  161. package/Timeline/stories/styles.scss +29 -0
  162. package/Timeline/styles/_mixin.scss +13 -0
  163. package/Timeline/styles/index.scss +187 -0
  164. package/Toggle/styles/index.scss +284 -0
  165. package/Tooltip/styles/index.scss +160 -0
  166. package/Tooltip/styles/mixins.scss +56 -0
  167. package/Tree/styles/_indent-line.scss +8 -0
  168. package/Tree/styles/_toggle.scss +32 -0
  169. package/Tree/styles/_variables.scss +8 -0
  170. package/Tree/styles/index.scss +184 -0
  171. package/TreePicker/styles/index.scss +16 -0
  172. package/Uploader/styles/_mixin.scss +11 -0
  173. package/Uploader/styles/index.scss +491 -0
  174. package/VisuallyHidden/styles/index.scss +11 -0
  175. package/cjs/Breadcrumb/BreadcrumbItem.js +12 -7
  176. package/cjs/CheckTree/CheckTree.js +3 -0
  177. package/cjs/CheckTree/CheckTreeView.js +7 -3
  178. package/cjs/CheckTree/hooks/useTreeCheckState.d.ts +1 -0
  179. package/cjs/CheckTree/hooks/useTreeCheckState.js +54 -3
  180. package/cjs/CheckTree/utils.d.ts +9 -2
  181. package/cjs/CheckTree/utils.js +70 -11
  182. package/cjs/CheckTreePicker/CheckTreePicker.js +1 -0
  183. package/cjs/Checkbox/Checkbox.js +2 -1
  184. package/cjs/Checkbox/hooks/useIndeterminateCheckbox.d.ts +19 -0
  185. package/cjs/Checkbox/hooks/useIndeterminateCheckbox.js +32 -0
  186. package/cjs/DateInput/DateInput.js +24 -0
  187. package/cjs/DateInput/hooks/useKeyboardInputEvent.d.ts +2 -1
  188. package/cjs/DateInput/hooks/useKeyboardInputEvent.js +14 -0
  189. package/cjs/DateRangeInput/DateRangeInput.js +24 -0
  190. package/cjs/DateRangePicker/DateRangePicker.js +6 -0
  191. package/cjs/Form/Form.js +5 -1
  192. package/cjs/Rate/Rate.d.ts +8 -0
  193. package/cjs/Rate/Rate.js +3 -1
  194. package/cjs/Tree/hooks/useFlattenTree.d.ts +4 -0
  195. package/cjs/Tree/hooks/useFlattenTree.js +22 -1
  196. package/cjs/Tree/hooks/useFocusTree.js +19 -1
  197. package/cjs/Tree/hooks/useVirtualizedTreeData.d.ts +1 -0
  198. package/cjs/Tree/hooks/useVirtualizedTreeData.js +5 -2
  199. package/cjs/Tree/utils/focusableTree.d.ts +8 -0
  200. package/cjs/Tree/utils/focusableTree.js +40 -2
  201. package/cjs/Tree/utils/index.d.ts +1 -1
  202. package/cjs/Tree/utils/index.js +3 -1
  203. package/cjs/internals/Picker/utils.d.ts +2 -0
  204. package/cjs/internals/Picker/utils.js +13 -1
  205. package/cjs/internals/StyledBox/StyledBox.d.ts +1 -1
  206. package/cjs/internals/StyledBox/StyledBox.js +2 -2
  207. package/dist/rsuite.js +52 -74
  208. package/dist/rsuite.js.map +1 -1
  209. package/dist/rsuite.min.js +1 -1
  210. package/dist/rsuite.min.js.LICENSE.txt +0 -20
  211. package/dist/rsuite.min.js.map +1 -1
  212. package/esm/Breadcrumb/BreadcrumbItem.js +10 -5
  213. package/esm/CheckTree/CheckTree.js +3 -0
  214. package/esm/CheckTree/CheckTreeView.js +7 -3
  215. package/esm/CheckTree/hooks/useTreeCheckState.d.ts +1 -0
  216. package/esm/CheckTree/hooks/useTreeCheckState.js +55 -4
  217. package/esm/CheckTree/utils.d.ts +9 -2
  218. package/esm/CheckTree/utils.js +71 -12
  219. package/esm/CheckTreePicker/CheckTreePicker.js +1 -0
  220. package/esm/Checkbox/Checkbox.js +3 -2
  221. package/esm/Checkbox/hooks/useIndeterminateCheckbox.d.ts +19 -0
  222. package/esm/Checkbox/hooks/useIndeterminateCheckbox.js +29 -0
  223. package/esm/DateInput/DateInput.js +24 -0
  224. package/esm/DateInput/hooks/useKeyboardInputEvent.d.ts +2 -1
  225. package/esm/DateInput/hooks/useKeyboardInputEvent.js +14 -0
  226. package/esm/DateRangeInput/DateRangeInput.js +24 -0
  227. package/esm/DateRangePicker/DateRangePicker.js +6 -0
  228. package/esm/Form/Form.js +5 -1
  229. package/esm/Rate/Rate.d.ts +8 -0
  230. package/esm/Rate/Rate.js +3 -1
  231. package/esm/Tree/hooks/useFlattenTree.d.ts +4 -0
  232. package/esm/Tree/hooks/useFlattenTree.js +22 -1
  233. package/esm/Tree/hooks/useFocusTree.js +20 -2
  234. package/esm/Tree/hooks/useVirtualizedTreeData.d.ts +1 -0
  235. package/esm/Tree/hooks/useVirtualizedTreeData.js +5 -2
  236. package/esm/Tree/utils/focusableTree.d.ts +8 -0
  237. package/esm/Tree/utils/focusableTree.js +36 -0
  238. package/esm/Tree/utils/index.d.ts +1 -1
  239. package/esm/Tree/utils/index.js +1 -1
  240. package/esm/internals/Picker/utils.d.ts +2 -0
  241. package/esm/internals/Picker/utils.js +13 -1
  242. package/esm/internals/StyledBox/StyledBox.d.ts +1 -1
  243. package/esm/internals/StyledBox/StyledBox.js +2 -2
  244. package/internals/Box/styles/index.scss +31 -0
  245. package/internals/Burger/styles/index.scss +72 -0
  246. package/internals/CloseButton/styles/index.scss +14 -0
  247. package/internals/Picker/styles/_mixin.scss +219 -0
  248. package/internals/Picker/styles/_variables.scss +9 -0
  249. package/internals/Picker/styles/index.scss +476 -0
  250. package/internals/Ripple/styles/_mixins.scss +10 -0
  251. package/internals/Ripple/styles/index.scss +40 -0
  252. package/internals/ScrollView/styles/index.scss +77 -0
  253. package/internals/SearchBox/styles/index.scss +7 -0
  254. package/package.json +4 -4
  255. package/styles/_base.scss +37 -0
  256. package/styles/_css-reset.scss +345 -0
  257. package/styles/_themes.scss +132 -0
  258. package/styles/_variables.scss +48 -0
  259. package/styles/color-modes/_dark.scss +458 -0
  260. package/styles/color-modes/_high-contrast.scss +469 -0
  261. package/styles/color-modes/_light.scss +475 -0
  262. package/styles/colors/_colors-base.scss +39 -0
  263. package/styles/colors/_dark.scss +114 -0
  264. package/styles/colors/_high-contrast.scss +114 -0
  265. package/styles/colors/_light.scss +115 -0
  266. package/styles/colors/_palette.scss +413 -0
  267. package/styles/components.scss +114 -0
  268. package/styles/index.scss +2 -0
  269. package/styles/mixins/_color-modes.scss +20 -0
  270. package/styles/mixins/_combobox.scss +6 -0
  271. package/styles/mixins/_hacks.scss +33 -0
  272. package/styles/mixins/_input.scss +30 -0
  273. package/styles/mixins/_listbox.scss +70 -0
  274. package/styles/mixins/_menu.scss +12 -0
  275. package/styles/mixins/_utilities.scss +130 -0
  276. package/toaster/styles/animation.scss +54 -0
  277. package/toaster/styles/index.scss +109 -0
  278. package/useToaster/styles/index.scss +1 -0
@@ -0,0 +1,114 @@
1
+ // SCSS implementation of high-contrast color theme
2
+ @use 'palette' as *;
3
+ @use 'colors-base' as *;
4
+
5
+ // Highlight levels
6
+ $H050-high-contrast: #fffef2;
7
+ $H100-high-contrast: #fffbc2;
8
+ $H200-high-contrast: #fffa91;
9
+ $H300-high-contrast: #fffa61;
10
+ $H400-high-contrast: #fffc30;
11
+ $H500-high-contrast: #ffff00;
12
+ $H600-high-contrast: #f1f500;
13
+ $H700-high-contrast: #d9e000;
14
+ $H800-high-contrast: #b8c200;
15
+ $H900-high-contrast: #8f9900;
16
+
17
+ // Gray levels
18
+ $B000-high-contrast: #fff;
19
+ $B050-high-contrast: #e9ebf0;
20
+ $B100-high-contrast: #cbced4;
21
+ $B200-high-contrast: #a4a9b3;
22
+ $B300-high-contrast: #858b94;
23
+ $B400-high-contrast: #6a6f76;
24
+ $B500-high-contrast: #5c6066;
25
+ $B600-high-contrast: #3c3f43;
26
+ $B700-high-contrast: #292d33;
27
+ $B800-high-contrast: #1a1d24;
28
+ $B900-high-contrast: #0f131a;
29
+
30
+ // Secondary palette
31
+
32
+ // Red
33
+ $red-50-high-contrast: palette($red-high-contrast, 50);
34
+ $red-100-high-contrast: palette($red-high-contrast, 100);
35
+ $red-200-high-contrast: palette($red-high-contrast, 200);
36
+ $red-300-high-contrast: palette($red-high-contrast, 300);
37
+ $red-400-high-contrast: palette($red-high-contrast, 400);
38
+ $red-500-high-contrast: $red-high-contrast;
39
+ $red-600-high-contrast: palette($red-high-contrast, 600);
40
+ $red-700-high-contrast: palette($red-high-contrast, 700);
41
+ $red-800-high-contrast: palette($red-high-contrast, 800);
42
+ $red-900-high-contrast: palette($red-high-contrast, 900);
43
+
44
+ // Orange
45
+ $orange-50-high-contrast: palette($orange-high-contrast, 50);
46
+ $orange-100-high-contrast: palette($orange-high-contrast, 100);
47
+ $orange-200-high-contrast: palette($orange-high-contrast, 200);
48
+ $orange-300-high-contrast: palette($orange-high-contrast, 300);
49
+ $orange-400-high-contrast: palette($orange-high-contrast, 400);
50
+ $orange-500-high-contrast: $orange-high-contrast;
51
+ $orange-600-high-contrast: palette($orange-high-contrast, 600);
52
+ $orange-700-high-contrast: palette($orange-high-contrast, 700);
53
+ $orange-800-high-contrast: palette($orange-high-contrast, 800);
54
+ $orange-900-high-contrast: palette($orange-high-contrast, 900);
55
+
56
+ // Yellow
57
+ $yellow-50-high-contrast: palette($yellow-high-contrast, 50);
58
+ $yellow-100-high-contrast: palette($yellow-high-contrast, 100);
59
+ $yellow-200-high-contrast: palette($yellow-high-contrast, 200);
60
+ $yellow-300-high-contrast: palette($yellow-high-contrast, 300);
61
+ $yellow-400-high-contrast: palette($yellow-high-contrast, 400);
62
+ $yellow-500-high-contrast: $yellow-high-contrast;
63
+ $yellow-600-high-contrast: palette($yellow-high-contrast, 600);
64
+ $yellow-700-high-contrast: palette($yellow-high-contrast, 700);
65
+ $yellow-800-high-contrast: palette($yellow-high-contrast, 800);
66
+ $yellow-900-high-contrast: palette($yellow-high-contrast, 900);
67
+
68
+ // Green
69
+ $green-50-high-contrast: palette($green-high-contrast, 50);
70
+ $green-100-high-contrast: palette($green-high-contrast, 100);
71
+ $green-200-high-contrast: palette($green-high-contrast, 200);
72
+ $green-300-high-contrast: palette($green-high-contrast, 300);
73
+ $green-400-high-contrast: palette($green-high-contrast, 400);
74
+ $green-500-high-contrast: $green-high-contrast;
75
+ $green-600-high-contrast: palette($green-high-contrast, 600);
76
+ $green-700-high-contrast: palette($green-high-contrast, 700);
77
+ $green-800-high-contrast: palette($green-high-contrast, 800);
78
+ $green-900-high-contrast: palette($green-high-contrast, 900);
79
+
80
+ // Cyan
81
+ $cyan-50-high-contrast: palette($cyan-high-contrast, 50);
82
+ $cyan-100-high-contrast: palette($cyan-high-contrast, 100);
83
+ $cyan-200-high-contrast: palette($cyan-high-contrast, 200);
84
+ $cyan-300-high-contrast: palette($cyan-high-contrast, 300);
85
+ $cyan-400-high-contrast: palette($cyan-high-contrast, 400);
86
+ $cyan-500-high-contrast: $cyan-high-contrast;
87
+ $cyan-600-high-contrast: palette($cyan-high-contrast, 600);
88
+ $cyan-700-high-contrast: palette($cyan-high-contrast, 700);
89
+ $cyan-800-high-contrast: palette($cyan-high-contrast, 800);
90
+ $cyan-900-high-contrast: palette($cyan-high-contrast, 900);
91
+
92
+ // Blue
93
+ $blue-50-high-contrast: palette($blue-high-contrast, 50);
94
+ $blue-100-high-contrast: palette($blue-high-contrast, 100);
95
+ $blue-200-high-contrast: palette($blue-high-contrast, 200);
96
+ $blue-300-high-contrast: palette($blue-high-contrast, 300);
97
+ $blue-400-high-contrast: palette($blue-high-contrast, 400);
98
+ $blue-500-high-contrast: $blue-high-contrast;
99
+ $blue-600-high-contrast: palette($blue-high-contrast, 600);
100
+ $blue-700-high-contrast: palette($blue-high-contrast, 700);
101
+ $blue-800-high-contrast: palette($blue-high-contrast, 800);
102
+ $blue-900-high-contrast: palette($blue-high-contrast, 900);
103
+
104
+ // Violet
105
+ $violet-50-high-contrast: palette($violet-high-contrast, 50);
106
+ $violet-100-high-contrast: palette($violet-high-contrast, 100);
107
+ $violet-200-high-contrast: palette($violet-high-contrast, 200);
108
+ $violet-300-high-contrast: palette($violet-high-contrast, 300);
109
+ $violet-400-high-contrast: palette($violet-high-contrast, 400);
110
+ $violet-500-high-contrast: $violet-high-contrast;
111
+ $violet-600-high-contrast: palette($violet-high-contrast, 600);
112
+ $violet-700-high-contrast: palette($violet-high-contrast, 700);
113
+ $violet-800-high-contrast: palette($violet-high-contrast, 800);
114
+ $violet-900-high-contrast: palette($violet-high-contrast, 900);
@@ -0,0 +1,115 @@
1
+ // SCSS implementation of light color theme
2
+ @use 'palette' as *;
3
+ @use 'colors-base' as *;
4
+
5
+ // Highlight levels
6
+ $H050: palette($primary-color, 50);
7
+ $H100: palette($primary-color, 100);
8
+ $H200: palette($primary-color, 200);
9
+ $H300: palette($primary-color, 300);
10
+ // Generate a distinct color for level 400 using the palette function instead of using base color
11
+ $H400: palette($primary-color, 400);
12
+ $H500: $primary-color; // Level 500 uses the base color directly
13
+ $H600: palette($primary-color, 600);
14
+ $H700: palette($primary-color, 700);
15
+ $H800: palette($primary-color, 800);
16
+ $H900: palette($primary-color, 900);
17
+
18
+ // Gray levels
19
+ $B000: #fff;
20
+ $B050: #f7f7fa;
21
+ $B100: #f2f2f5;
22
+ $B200: #e5e5ea;
23
+ $B300: #d9d9d9;
24
+ $B400: #b6b7b8;
25
+ $B500: #939393;
26
+ $B600: #717273;
27
+ $B700: #575757;
28
+ $B800: #343434;
29
+ $B900: #121212;
30
+
31
+ // Secondary palette
32
+
33
+ // Red
34
+ $red-50: palette($red, 50);
35
+ $red-100: palette($red, 100);
36
+ $red-200: palette($red, 200);
37
+ $red-300: palette($red, 300);
38
+ $red-400: palette($red, 400);
39
+ $red-500: $red;
40
+ $red-600: palette($red, 600);
41
+ $red-700: palette($red, 700);
42
+ $red-800: palette($red, 800);
43
+ $red-900: palette($red, 900);
44
+
45
+ // Orange
46
+ $orange-50: palette($orange, 50);
47
+ $orange-100: palette($orange, 100);
48
+ $orange-200: palette($orange, 200);
49
+ $orange-300: palette($orange, 300);
50
+ $orange-400: palette($orange, 400);
51
+ $orange-500: $orange;
52
+ $orange-600: palette($orange, 600);
53
+ $orange-700: palette($orange, 700);
54
+ $orange-800: palette($orange, 800);
55
+ $orange-900: palette($orange, 900);
56
+
57
+ // Yellow
58
+ $yellow-50: palette($yellow, 50);
59
+ $yellow-100: palette($yellow, 100);
60
+ $yellow-200: palette($yellow, 200);
61
+ $yellow-300: palette($yellow, 300);
62
+ $yellow-400: palette($yellow, 400);
63
+ $yellow-500: $yellow;
64
+ $yellow-600: palette($yellow, 600);
65
+ $yellow-700: palette($yellow, 700);
66
+ $yellow-800: palette($yellow, 800);
67
+ $yellow-900: palette($yellow, 900);
68
+
69
+ // Green
70
+ $green-50: palette($green, 50);
71
+ $green-100: palette($green, 100);
72
+ $green-200: palette($green, 200);
73
+ $green-300: palette($green, 300);
74
+ $green-400: palette($green, 400);
75
+ $green-500: $green;
76
+ $green-600: palette($green, 600);
77
+ $green-700: palette($green, 700);
78
+ $green-800: palette($green, 800);
79
+ $green-900: palette($green, 900);
80
+
81
+ // Cyan
82
+ $cyan-50: palette($cyan, 50);
83
+ $cyan-100: palette($cyan, 100);
84
+ $cyan-200: palette($cyan, 200);
85
+ $cyan-300: palette($cyan, 300);
86
+ $cyan-400: palette($cyan, 400);
87
+ $cyan-500: $cyan;
88
+ $cyan-600: palette($cyan, 600);
89
+ $cyan-700: palette($cyan, 700);
90
+ $cyan-800: palette($cyan, 800);
91
+ $cyan-900: palette($cyan, 900);
92
+
93
+ // Blue
94
+ $blue-50: palette($blue, 50);
95
+ $blue-100: palette($blue, 100);
96
+ $blue-200: palette($blue, 200);
97
+ $blue-300: palette($blue, 300);
98
+ $blue-400: palette($blue, 400);
99
+ $blue-500: $blue;
100
+ $blue-600: palette($blue, 600);
101
+ $blue-700: palette($blue, 700);
102
+ $blue-800: palette($blue, 800);
103
+ $blue-900: palette($blue, 900);
104
+
105
+ // Violet
106
+ $violet-50: palette($violet, 50);
107
+ $violet-100: palette($violet, 100);
108
+ $violet-200: palette($violet, 200);
109
+ $violet-300: palette($violet, 300);
110
+ $violet-400: palette($violet, 400);
111
+ $violet-500: $violet;
112
+ $violet-600: palette($violet, 600);
113
+ $violet-700: palette($violet, 700);
114
+ $violet-800: palette($violet, 800);
115
+ $violet-900: palette($violet, 900);
@@ -0,0 +1,413 @@
1
+ // SCSS implementation of color palette generator
2
+ // Based on the original palette.js functionality, optimized with SCSS built-in color functions
3
+
4
+ @use 'sass:math';
5
+ @use 'sass:color';
6
+ @use 'sass:meta';
7
+ @use 'sass:list';
8
+ @use 'sass:string';
9
+ @use 'sass:map';
10
+
11
+ /**
12
+ * Helper function to convert a decimal number to a two-digit hex string
13
+ */
14
+ @function decimal-to-hex($value) {
15
+ // Convert to integer first
16
+ $int-value: math.round($value);
17
+
18
+ // Ensure the value is within range
19
+ $int-value: math.min(math.max($int-value, 0), 255);
20
+
21
+ $hex-digits: '0123456789ABCDEF';
22
+ $result: '';
23
+
24
+ // First hex digit (divide by 16)
25
+ $digit1: math.floor(math.div($int-value, 16));
26
+ $result: $result + string.slice($hex-digits, $digit1 + 1, $digit1 + 1);
27
+
28
+ // Second hex digit (remainder of division by 16)
29
+ $digit2: $int-value % 16;
30
+ $result: $result + string.slice($hex-digits, $digit2 + 1, $digit2 + 1);
31
+
32
+ @return $result;
33
+ }
34
+
35
+ /**
36
+ * Convert color to hex format for consistent output
37
+ */
38
+ @function color-to-hex($color) {
39
+ @return if(
40
+ color.alpha($color) < 1,
41
+ string.unquote(
42
+ '#' + decimal-to-hex(color.channel($color, 'red')) +
43
+ decimal-to-hex(color.channel($color, 'green')) +
44
+ decimal-to-hex(color.channel($color, 'blue')) +
45
+ decimal-to-hex(math.round(color.alpha($color) * 255))
46
+ ),
47
+ string.unquote(
48
+ '#' + decimal-to-hex(color.channel($color, 'red')) +
49
+ decimal-to-hex(color.channel($color, 'green')) +
50
+ decimal-to-hex(color.channel($color, 'blue'))
51
+ )
52
+ );
53
+ }
54
+
55
+ /**
56
+ * Convert RGB color to HSV (Hue, Saturation, Value/Brightness)
57
+ * This function ensures exact parity with tinycolor's toHsv() method
58
+ * @param {Color} $color - The color to convert to HSV
59
+ * @return {Map} - A map with h, s, v keys representing HSV values
60
+ */
61
+ @function rgb-to-hsv($color) {
62
+ $r: math.div(color.channel($color, 'red'), 255);
63
+ $g: math.div(color.channel($color, 'green'), 255);
64
+ $b: math.div(color.channel($color, 'blue'), 255);
65
+
66
+ $max: max($r, $g, $b);
67
+ $min: min($r, $g, $b);
68
+ $delta: $max - $min;
69
+
70
+ // Initialize HSV values
71
+ $h: 0; // hue
72
+ $s: if($max == 0, 0, math.div($delta, $max)); // saturation
73
+ $v: $max; // value/brightness
74
+
75
+ // Calculate hue
76
+ @if $delta != 0 {
77
+ @if $max == $r {
78
+ $h: math.div(($g - $b), $delta);
79
+ $h: if($h < 0, $h + 6, $h);
80
+ } @else if $max == $g {
81
+ $h: math.div(($b - $r), $delta) + 2;
82
+ } @else if $max == $b {
83
+ $h: math.div(($r - $g), $delta) + 4;
84
+ }
85
+
86
+ $h: $h * 60; // Convert to degrees
87
+ $h: math.round($h); // Match JS implementation which rounds hue
88
+ }
89
+
90
+ // Return HSV map
91
+ @return (h: $h, s: $s, v: $v);
92
+ }
93
+
94
+ /**
95
+ * Convert HSV values to RGB color
96
+ * This function ensures exact parity with tinycolor's HSV conversion
97
+ * @param {Number} $h - Hue (0-360)
98
+ * @param {Number} $s - Saturation (0-1)
99
+ * @param {Number} $v - Value/Brightness (0-1)
100
+ * @return {Color} - RGB color
101
+ */
102
+ @function hsv-to-rgb($h, $s, $v) {
103
+ // Ensure hue is between 0 and 360
104
+ $h: $h % 360;
105
+
106
+ $c: $v * $s; // Chroma
107
+ $x: $c * (1 - math.abs(math.div($h, 60) % 2 - 1));
108
+ $m: $v - $c;
109
+
110
+ $r-temp: 0;
111
+ $g-temp: 0;
112
+ $b-temp: 0;
113
+
114
+ @if $h >= 0 and $h < 60 {
115
+ $r-temp: $c;
116
+ $g-temp: $x;
117
+ $b-temp: 0;
118
+ } @else if $h >= 60 and $h < 120 {
119
+ $r-temp: $x;
120
+ $g-temp: $c;
121
+ $b-temp: 0;
122
+ } @else if $h >= 120 and $h < 180 {
123
+ $r-temp: 0;
124
+ $g-temp: $c;
125
+ $b-temp: $x;
126
+ } @else if $h >= 180 and $h < 240 {
127
+ $r-temp: 0;
128
+ $g-temp: $x;
129
+ $b-temp: $c;
130
+ } @else if $h >= 240 and $h < 300 {
131
+ $r-temp: $x;
132
+ $g-temp: 0;
133
+ $b-temp: $c;
134
+ } @else {
135
+ $r-temp: $c;
136
+ $g-temp: 0;
137
+ $b-temp: $x;
138
+ }
139
+
140
+ $r: math.round(($r-temp + $m) * 255);
141
+ $g: math.round(($g-temp + $m) * 255);
142
+ $b: math.round(($b-temp + $m) * 255);
143
+
144
+ @return rgb($r, $g, $b);
145
+ }
146
+
147
+ /**
148
+ * A simpler fade function to mimic Less's fade() function
149
+ * Since we can't reliably detect if a color is a valid color due to string format issues,
150
+ * we'll just use a direct rgba call with string interpolation for guaranteed compatibility
151
+ * @param {Color|String} $color - The color to adjust alpha for
152
+ * @param {Number} $alpha-percent - Alpha value as a percentage (0-100)
153
+ * @return {String} - rgba() function with the appropriate alpha value
154
+ */
155
+ @function fade($color, $alpha-percent) {
156
+ // Convert percentage to decimal
157
+ $alpha: math.div($alpha-percent, 100);
158
+
159
+ @if meta.type-of($color) == 'color' {
160
+ // If it's a valid CSS color, use color functions
161
+ $r: color.channel($color, 'red');
162
+ $g: color.channel($color, 'green');
163
+ $b: color.channel($color, 'blue');
164
+ @return string.unquote('rgba(#{$r}, #{$g}, #{$b}, #{$alpha})');
165
+ } @else {
166
+ // Otherwise treat it as a string (e.g., a CSS variable)
167
+ @return string.unquote('rgba(#{$color}, #{$alpha})');
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Convert color to hex format for consistent output
173
+ */
174
+ @function color-to-hex($color) {
175
+ @return if(
176
+ color.alpha($color) < 1,
177
+ string.unquote(
178
+ '#' + decimal-to-hex(color.channel($color, 'red')) +
179
+ decimal-to-hex(color.channel($color, 'green')) +
180
+ decimal-to-hex(color.channel($color, 'blue')) +
181
+ decimal-to-hex(math.round(color.alpha($color) * 255))
182
+ ),
183
+ string.unquote(
184
+ '#' + decimal-to-hex(color.channel($color, 'red')) +
185
+ decimal-to-hex(color.channel($color, 'green')) +
186
+ decimal-to-hex(color.channel($color, 'blue'))
187
+ )
188
+ );
189
+ }
190
+
191
+ /**
192
+ * Constants matching the JavaScript implementation
193
+ */
194
+ $primary-index: 5;
195
+ $hue-max: 360;
196
+ $saturation-min: 5;
197
+ $saturation-max: 100;
198
+ $brightness-min: 20;
199
+ $brightness-max: 100;
200
+ $color-number-set: '50', '100', '200', '300', '400', '500', '600', '700', '800', '900';
201
+
202
+ /**
203
+ * Calculate hue adjustment based on index
204
+ * Matches the JavaScript calculateHue function
205
+ * @param {Number} $original-hue - Original hue value (0-360)
206
+ * @param {Number} $index - Color level index in the palette
207
+ * @return {Number} - Adjusted hue value
208
+ */
209
+ @function calculate-hue($original-hue, $index) {
210
+ // Use 360 if original-hue is 0 or undefined (matches JS || operator)
211
+ $original-hue: math.round($original-hue);
212
+ @if $original-hue == 0 {
213
+ $original-hue: 360;
214
+ }
215
+
216
+ // Dark color increase, light color reduction
217
+ $step: $index - $primary-index;
218
+ $gap: 1; // Fixed gap for hue adjustment
219
+ $hue: $original-hue + $step * $gap;
220
+
221
+ // The value of hue is [0,360)
222
+ // If it is greater than 360, the absolute value of the difference is taken
223
+ @if $hue >= $hue-max {
224
+ @return math.abs($hue - $hue-max);
225
+ }
226
+
227
+ @return $hue;
228
+ }
229
+
230
+ /**
231
+ * Calculate saturation adjustment based on index
232
+ * Matches the JavaScript calculateSaturation function
233
+ * @param {Number} $original-saturation - Original saturation value (0-1)
234
+ * @param {Number} $index - Color level index in the palette
235
+ * @return {Number} - Adjusted saturation value (0-1)
236
+ */
237
+ @function calculate-saturation($original-saturation, $index) {
238
+ // Convert to percentage scale (0-100) for calculations
239
+ $original-saturation: math.round($original-saturation * 100);
240
+
241
+ // Dark color increase, light color reduction
242
+ $step: $index - $primary-index;
243
+
244
+ // Calculate gap based on conditions exactly as in JS implementation
245
+ $gap: 1; // Default gap
246
+
247
+ @if $step > 0 and $original-saturation < 100 {
248
+ // For lighter colors (indexes > 5), increase saturation proportional to how far from 100% we are
249
+ $gap: math.round(math.div(100 - $original-saturation, 4));
250
+ } @else if $original-saturation > $saturation-min {
251
+ // For darker colors, decrease saturation proportional to current value
252
+ $gap: math.round(math.div($original-saturation - 5, 5));
253
+ }
254
+
255
+ // Apply the calculated gap
256
+ $saturation: $original-saturation + $step * $gap;
257
+
258
+ // Ensure saturation stays within bounds [5,100]
259
+ @if $saturation < $saturation-min {
260
+ $saturation: $saturation-min;
261
+ } @else if $saturation > $saturation-max {
262
+ $saturation: $saturation-max;
263
+ }
264
+
265
+ // Convert back to 0-1 scale
266
+ @return math.div($saturation, 100);
267
+ }
268
+
269
+ /**
270
+ * Calculate brightness adjust value
271
+ * Helper function for brightness calculation that precisely matches the JS implementation
272
+ * @param {Number} $original-brightness - Original brightness as percentage (0-100)
273
+ * @param {Number} $step - Step value (positive for lighter, negative for darker)
274
+ * @return {Number} - Brightness adjustment value
275
+ */
276
+ @function calculate-brightness-adjust-value($original-brightness, $step) {
277
+ @if $step < 0 {
278
+ // For darker colors (lower index, steps < 0)
279
+ @if $original-brightness > 40 {
280
+ // For colors with brightness > 40%, apply non-linear reduction
281
+ // Calculating a progressively larger gap as we move further from primary
282
+ $basic-gap: math.ceil(math.div(math.div($original-brightness - 40, 4), 4));
283
+ $levels: math.abs($step);
284
+ $n: math.div(($levels + 1) * $levels, 2); // Sum of arithmetic progression
285
+ @return -1 * $basic-gap * $n; // Negative adjustment to reduce brightness
286
+ } @else {
287
+ // For colors already dark (brightness <= 40%), use a simpler reduction
288
+ @return math.round($step * math.div($original-brightness - 20, 4));
289
+ }
290
+ } @else {
291
+ // For lighter colors (higher index, steps > 0)
292
+ @return math.round($step * math.div(100 - $original-brightness, 5));
293
+ }
294
+ }
295
+
296
+ /**
297
+ * Calculate brightness adjustment based on index
298
+ * Matches the JavaScript calculateBrightness function
299
+ * @param {Number} $original-brightness - Original brightness value (0-1)
300
+ * @param {Number} $index - Color level index in the palette
301
+ * @return {Number} - Adjusted brightness value (0-1)
302
+ */
303
+ @function calculate-brightness($original-brightness, $index) {
304
+ // Convert to percentage scale (0-100) for calculations
305
+ $original-brightness: math.round($original-brightness * 100);
306
+
307
+ // Calculate step based on primary index and target index
308
+ $step: $primary-index - $index;
309
+
310
+ // Special case: When brightness is already low and we want to go lighter (400 level),
311
+ // return the original brightness without adjustment
312
+ @if $step < 0 and $original-brightness < $brightness-min {
313
+ @return math.div($original-brightness, 100);
314
+ }
315
+
316
+ // Calculate adjustment value based on current brightness and step
317
+ $adjust-value: calculate-brightness-adjust-value($original-brightness, $step);
318
+ $brightness: $original-brightness + $adjust-value;
319
+
320
+ // Ensure brightness stays within bounds [20,100]
321
+ @if $brightness < $brightness-min {
322
+ $brightness: $brightness-min;
323
+ } @else if $brightness > $brightness-max {
324
+ $brightness: $brightness-max;
325
+ }
326
+
327
+ // Convert back to 0-1 scale
328
+ @return math.div($brightness, 100);
329
+ }
330
+
331
+ /**
332
+ * Standard color levels in the design system
333
+ */
334
+ $color-levels: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900;
335
+
336
+ /**
337
+ * Generate color palette based on level
338
+ * @param {Color} $base-color - The base color to generate palette from
339
+ * @param {Number|String} $level - The color level (50, 100, 200, ..., 900)
340
+ * @return {Color} - The generated color for the specified level
341
+ */
342
+ @function palette($base-color, $level) {
343
+ // For consistency with JS, the base color is exactly level 500
344
+ @if $level == 500 {
345
+ @return $base-color;
346
+ }
347
+
348
+ // Find the index of the level in the color set
349
+ $index: -1;
350
+
351
+ // Convert $level to string for comparison if it's a number
352
+ $level-str: $level;
353
+ @if meta.type-of($level) == 'number' {
354
+ $level-str: '#{$level}';
355
+ }
356
+
357
+ // Match index with JavaScript implementation - use loop to find exact position
358
+ $found: false;
359
+ @for $i from 1 through list.length($color-number-set) {
360
+ @if not $found and list.nth($color-number-set, $i) == $level-str {
361
+ $index: $i - 1; // Convert to 0-based index
362
+ $found: true;
363
+ }
364
+ }
365
+
366
+ // If level not found, return the original color
367
+ @if $index == -1 {
368
+ @return $base-color;
369
+ }
370
+
371
+ // For level 500 (primary index), return the original color
372
+ @if $index == $primary-index {
373
+ @return $base-color;
374
+ }
375
+
376
+ // Convert RGB to HSV (matching the JS implementation)
377
+ $hsv: rgb-to-hsv($base-color);
378
+
379
+ // Get the HSV components
380
+ $h: map.get($hsv, 'h');
381
+ $s: map.get($hsv, 's');
382
+ $v: map.get($hsv, 'v');
383
+
384
+ // Calculate new HSV values using the JS-equivalent helper functions
385
+ $new-h: calculate-hue($h, $index);
386
+ $new-s: calculate-saturation($s, $index);
387
+ $new-v: calculate-brightness($v, $index);
388
+
389
+ // Convert the adjusted HSV values back to RGB
390
+ $adjusted-color: hsv-to-rgb($new-h, $new-s, $new-v);
391
+
392
+ // Force hex format for consistency with the original JS implementation
393
+ @return color-to-hex($adjusted-color);
394
+ }
395
+
396
+ /**
397
+ * Generate CSS custom properties for an entire color palette
398
+ * @param {String} $name - The base name for the color variables
399
+ * @param {Color} $base-color - The base color (level 500) to generate palette from
400
+ */
401
+ @mixin generate-palette-vars($name, $base-color) {
402
+ @each $level in $color-levels {
403
+ @if $level == 500 {
404
+ // Level 500 is the base color (reference color)
405
+ --rs-#{$name}-#{$level}: #{color-to-hex($base-color)};
406
+ } @else {
407
+ // Generate palette color for all other levels including 400
408
+ $palette-color: palette($base-color, $level);
409
+
410
+ --rs-#{$name}-#{$level}: #{$palette-color};
411
+ }
412
+ }
413
+ }