rsuite 6.0.0-canary-20250424 → 6.0.0-canary-20250620

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 (927) hide show
  1. package/Accordion/styles/index.css +645 -325
  2. package/Animation/styles/index.css +153 -141
  3. package/AutoComplete/styles/index.css +2408 -2061
  4. package/Avatar/styles/index.css +227 -76
  5. package/AvatarGroup/styles/index.css +280 -107
  6. package/Badge/styles/index.css +335 -174
  7. package/Box/styles/index.css +132 -94
  8. package/Breadcrumb/styles/index.css +225 -71
  9. package/Button/styles/index.css +1199 -1016
  10. package/ButtonGroup/styles/index.css +221 -54
  11. package/ButtonToolbar/styles/index.css +274 -98
  12. package/CHANGELOG.md +66 -0
  13. package/Calendar/styles/index.css +1866 -1737
  14. package/Card/styles/index.css +242 -92
  15. package/CardGroup/styles/index.css +185 -6
  16. package/Carousel/styles/index.css +369 -213
  17. package/CascadeTree/styles/index.css +376 -237
  18. package/Cascader/styles/index.css +2494 -2146
  19. package/Center/styles/index.css +185 -6
  20. package/CheckPicker/styles/index.css +2555 -2193
  21. package/CheckTree/styles/index.css +2640 -2276
  22. package/CheckTreePicker/styles/index.css +2652 -2286
  23. package/Checkbox/styles/index.css +409 -251
  24. package/CheckboxGroup/styles/index.css +189 -25
  25. package/Container/styles/index.css +186 -20
  26. package/Content/styles/index.css +181 -15
  27. package/DateInput/styles/index.css +317 -164
  28. package/DatePicker/styles/index.css +3108 -2800
  29. package/DateRangeInput/styles/index.css +317 -164
  30. package/DateRangePicker/styles/index.css +3200 -2884
  31. package/Divider/styles/index.css +251 -96
  32. package/Drawer/styles/index.css +461 -312
  33. package/Dropdown/styles/index.css +1497 -1329
  34. package/FlexboxGrid/styles/index.css +498 -284
  35. package/Footer/styles/index.css +181 -23
  36. package/Form/styles/index.css +178 -12
  37. package/FormControl/styles/index.css +210 -44
  38. package/FormControlLabel/styles/index.css +190 -31
  39. package/FormErrorMessage/styles/index.css +332 -208
  40. package/FormGroup/styles/index.css +216 -48
  41. package/FormHelpText/styles/index.css +203 -44
  42. package/FormStack/styles/index.css +191 -26
  43. package/Grid/styles/index.css +2042 -1743
  44. package/Header/styles/index.css +181 -23
  45. package/Heading/styles/index.css +238 -73
  46. package/HeadingGroup/styles/index.css +181 -2
  47. package/Highlight/styles/index.css +190 -5
  48. package/IconButton/styles/index.css +1343 -1163
  49. package/Image/styles/index.css +216 -22
  50. package/InlineEdit/styles/index.css +378 -84
  51. package/Input/styles/index.css +317 -164
  52. package/InputGroup/styles/index.css +446 -1219
  53. package/InputNumber/styles/index.css +1565 -1366
  54. package/InputPicker/styles/index.css +2497 -2156
  55. package/Kbd/styles/index.css +258 -107
  56. package/Link/styles/index.css +203 -23
  57. package/List/styles/index.css +311 -158
  58. package/Loader/styles/index.css +354 -206
  59. package/Menu/styles/index.css +325 -186
  60. package/Message/styles/index.css +494 -408
  61. package/Modal/styles/index.css +394 -224
  62. package/MultiCascadeTree/styles/index.css +2694 -2331
  63. package/MultiCascader/styles/index.css +2710 -2346
  64. package/Nav/styles/index.css +1801 -1636
  65. package/Navbar/styles/index.css +1751 -1564
  66. package/Notification/styles/index.css +369 -221
  67. package/NumberInput/styles/index.css +1565 -1366
  68. package/Pagination/styles/index.css +2625 -2390
  69. package/Panel/styles/index.css +624 -305
  70. package/PanelGroup/styles/index.css +212 -55
  71. package/PasswordInput/styles/index.css +559 -164
  72. package/PasswordStrengthMeter/styles/index.css +224 -32
  73. package/PinInput/styles/index.css +381 -207
  74. package/Placeholder/styles/index.css +364 -200
  75. package/Popover/styles/index.css +468 -298
  76. package/Progress/styles/index.css +517 -236
  77. package/ProgressCircle/package.json +3 -3
  78. package/ProgressCircle/styles/index.css +248 -0
  79. package/README.md +1 -1
  80. package/Radio/styles/index.css +406 -242
  81. package/RadioGroup/styles/index.css +277 -124
  82. package/RadioTile/styles/index.css +286 -133
  83. package/RadioTileGroup/styles/index.css +0 -0
  84. package/RangeSlider/styles/index.css +599 -458
  85. package/Rate/styles/index.css +318 -179
  86. package/SelectPicker/styles/index.css +2430 -2088
  87. package/Sidebar/styles/index.css +188 -28
  88. package/Sidenav/styles/index.css +764 -591
  89. package/Slider/styles/index.css +599 -458
  90. package/Stack/styles/index.css +268 -93
  91. package/Stat/styles/index.css +1620 -1454
  92. package/StatGroup/styles/index.css +185 -6
  93. package/Steps/styles/index.css +384 -234
  94. package/Table/styles/index.css +626 -497
  95. package/Tabs/styles/index.css +1815 -1649
  96. package/Tag/styles/index.css +1487 -139
  97. package/TagGroup/styles/index.css +185 -19
  98. package/TagInput/styles/index.css +2831 -2469
  99. package/TagPicker/styles/index.css +2827 -2466
  100. package/Text/styles/index.css +398 -224
  101. package/Textarea/styles/index.css +184 -5
  102. package/TimePicker/styles/index.css +3108 -2800
  103. package/TimeRangePicker/styles/index.css +3200 -2884
  104. package/Timeline/styles/index.css +305 -148
  105. package/Toggle/styles/index.css +606 -429
  106. package/Tooltip/styles/index.css +347 -214
  107. package/Tree/styles/index.css +2538 -2197
  108. package/TreePicker/styles/index.css +2548 -2206
  109. package/Uploader/styles/index.css +1680 -1612
  110. package/VisuallyHidden/styles/index.css +11 -11
  111. package/cjs/Affix/Affix.js +1 -2
  112. package/cjs/Animation/Bounce.js +4 -5
  113. package/cjs/Animation/Collapse.js +1 -2
  114. package/cjs/Animation/Fade.js +5 -6
  115. package/cjs/Animation/Slide.js +5 -6
  116. package/cjs/AutoComplete/AutoComplete.js +1 -2
  117. package/cjs/Avatar/Avatar.js +1 -2
  118. package/cjs/AvatarGroup/AvatarGroup.js +1 -2
  119. package/cjs/Badge/Badge.js +1 -2
  120. package/cjs/Breadcrumb/Breadcrumb.js +1 -2
  121. package/cjs/Button/Button.js +1 -2
  122. package/cjs/ButtonGroup/ButtonGroup.js +1 -2
  123. package/cjs/Calendar/CalendarContainer.js +1 -2
  124. package/cjs/Calendar/CalendarHeader.js +1 -2
  125. package/cjs/Calendar/Grid/GridRow.js +1 -2
  126. package/cjs/Calendar/MonthDropdown/MonthDropdown.js +17 -22
  127. package/cjs/Calendar/MonthDropdown/MonthDropdownItem.js +1 -2
  128. package/cjs/Calendar/TimeDropdown/TimeDropdown.js +1 -2
  129. package/cjs/Calendar/TimeDropdown/utils/scrollToTime.js +1 -2
  130. package/cjs/Calendar/hooks/useCalendarDate.js +3 -6
  131. package/cjs/Carousel/Carousel.js +1 -2
  132. package/cjs/CascadeTree/CascadeTree.js +1 -2
  133. package/cjs/CascadeTree/TreeView.js +1 -2
  134. package/cjs/CascadeTree/hooks/usePaths.js +7 -8
  135. package/cjs/Cascader/Cascader.js +1 -2
  136. package/cjs/CheckPicker/CheckPicker.js +1 -2
  137. package/cjs/CheckTree/CheckTree.js +1 -2
  138. package/cjs/CheckTree/CheckTreeNode.js +1 -2
  139. package/cjs/CheckTree/CheckTreeView.js +17 -22
  140. package/cjs/CheckTree/hooks/useTreeNodeProps.js +1 -2
  141. package/cjs/CheckTree/hooks/useTreeValue.js +4 -5
  142. package/cjs/CheckTreePicker/CheckTreePicker.d.ts +4 -0
  143. package/cjs/CheckTreePicker/CheckTreePicker.js +29 -2
  144. package/cjs/Checkbox/Checkbox.js +1 -2
  145. package/cjs/CheckboxGroup/CheckboxGroup.js +1 -2
  146. package/cjs/Container/Container.js +1 -2
  147. package/cjs/CustomProvider/CustomProvider.js +14 -4
  148. package/cjs/DOMHelper/index.js +1 -2
  149. package/cjs/DateInput/DateInput.js +5 -2
  150. package/cjs/DateInput/hooks/useDateInputState.js +6 -7
  151. package/cjs/DateInput/hooks/useIsFocused.js +4 -5
  152. package/cjs/DateInput/hooks/useKeyboardInputEvent.js +7 -8
  153. package/cjs/DateInput/test/types/TestKeyPressProps.d.ts +6 -0
  154. package/cjs/DateInput/test/types/TestKeyPressProps.js +4 -0
  155. package/cjs/DatePicker/DatePicker.js +3 -10
  156. package/cjs/DatePicker/PredefinedRanges.js +1 -2
  157. package/cjs/DatePicker/Toolbar.js +6 -7
  158. package/cjs/DatePicker/utils.js +14 -24
  159. package/cjs/DateRangeInput/DateRangeInput.js +6 -6
  160. package/cjs/DateRangePicker/Calendar.d.ts +2 -1
  161. package/cjs/DateRangePicker/Calendar.js +8 -3
  162. package/cjs/DateRangePicker/DateRangePicker.d.ts +3 -1
  163. package/cjs/DateRangePicker/DateRangePicker.js +9 -20
  164. package/cjs/DateRangePicker/DateRangePickerProvider.js +1 -2
  165. package/cjs/DateRangePicker/disabledDateUtils.js +5 -18
  166. package/cjs/DateRangePicker/hooks/useCalendarHandlers.js +7 -8
  167. package/cjs/DateRangePicker/utils.js +5 -6
  168. package/cjs/Dropdown/Dropdown.js +9 -12
  169. package/cjs/Dropdown/DropdownItem.js +6 -8
  170. package/cjs/Dropdown/DropdownMenu.js +36 -43
  171. package/cjs/Dropdown/DropdownState.js +1 -4
  172. package/cjs/Form/Form.js +1 -2
  173. package/cjs/Form/FormContext.d.ts +1 -1
  174. package/cjs/Form/FormContext.js +1 -2
  175. package/cjs/Form/hooks/useFormValidate.js +8 -13
  176. package/cjs/Form/hooks/useSchemaModel.js +6 -9
  177. package/cjs/FormControl/FormControl.d.ts +2 -2
  178. package/cjs/FormControl/FormControl.js +53 -84
  179. package/cjs/FormErrorMessage/FormErrorMessage.d.ts +2 -2
  180. package/cjs/FormGroup/FormGroup.d.ts +0 -18
  181. package/cjs/FormGroup/FormGroup.js +4 -33
  182. package/cjs/FormGroup/FormGroupContext.d.ts +4 -0
  183. package/cjs/FormGroup/FormGroupContext.js +8 -0
  184. package/cjs/FormGroup/index.d.ts +1 -1
  185. package/cjs/FormGroup/index.js +4 -4
  186. package/cjs/FormGroup/useFormGroup.d.ts +18 -0
  187. package/cjs/FormGroup/useFormGroup.js +35 -0
  188. package/cjs/Grid/Col.js +1 -2
  189. package/cjs/Grid/utils/styles.js +1 -4
  190. package/cjs/InlineEdit/useEditState.js +1 -1
  191. package/cjs/InlineEdit/useFocusEvent.js +6 -7
  192. package/cjs/Input/Input.js +2 -3
  193. package/cjs/InputGroup/InputGroup.d.ts +0 -5
  194. package/cjs/InputGroup/InputGroup.js +4 -5
  195. package/cjs/InputGroup/InputGroupContext.d.ts +6 -0
  196. package/cjs/InputGroup/InputGroupContext.js +8 -0
  197. package/cjs/InputGroup/index.d.ts +1 -0
  198. package/cjs/InputGroup/index.js +3 -1
  199. package/cjs/InputPicker/InputAutosize.js +1 -2
  200. package/cjs/InputPicker/InputPicker.js +1 -2
  201. package/cjs/List/List.js +1 -2
  202. package/cjs/List/ListItem.js +1 -2
  203. package/cjs/List/helper/AutoScroller.js +7 -8
  204. package/cjs/List/helper/useSortHelper.js +1 -1
  205. package/cjs/List/helper/utils.js +4 -7
  206. package/cjs/MaskedInput/TextMask.js +1 -2
  207. package/cjs/MaskedInput/adjustCaretPosition.js +11 -12
  208. package/cjs/MaskedInput/conformToMask.js +1 -10
  209. package/cjs/MaskedInput/createTextMaskInputElement.js +9 -10
  210. package/cjs/MaskedInput/utilities.js +1 -7
  211. package/cjs/Menu/Menu.js +1 -2
  212. package/cjs/Menu/MenuItem.js +6 -8
  213. package/cjs/Message/Message.js +1 -2
  214. package/cjs/Modal/Modal.js +1 -2
  215. package/cjs/Modal/ModalBody.js +1 -2
  216. package/cjs/Modal/ModalHeader.js +1 -2
  217. package/cjs/Modal/ModalTitle.js +1 -2
  218. package/cjs/MultiCascadeTree/hooks/useCascadeValue.js +1 -4
  219. package/cjs/MultiCascadeTree/utils.js +1 -4
  220. package/cjs/MultiCascader/MultiCascader.js +1 -2
  221. package/cjs/Nav/AdaptiveNavItem.js +3 -4
  222. package/cjs/Nav/Nav.js +3 -4
  223. package/cjs/Nav/NavDropdown.js +9 -12
  224. package/cjs/Nav/NavDropdownItem.js +6 -8
  225. package/cjs/Nav/NavDropdownMenu.js +36 -43
  226. package/cjs/Nav/NavItem.js +1 -2
  227. package/cjs/Nav/NavMegaMenu.js +1 -2
  228. package/cjs/Nav/NavMenu.js +3 -4
  229. package/cjs/Navbar/Navbar.js +1 -2
  230. package/cjs/Navbar/NavbarDrawer.js +1 -2
  231. package/cjs/Navbar/NavbarDropdown.js +8 -11
  232. package/cjs/Navbar/NavbarDropdownItem.js +1 -2
  233. package/cjs/Navbar/NavbarDropdownMenu.js +12 -16
  234. package/cjs/Navbar/NavbarItem.js +1 -2
  235. package/cjs/Navbar/NavbarMegaMenu.js +1 -2
  236. package/cjs/Navbar/NavbarToggle.js +1 -2
  237. package/cjs/Notification/Notification.js +1 -2
  238. package/cjs/NumberInput/utils/number.js +1 -4
  239. package/cjs/Pagination/LimitPicker.js +1 -2
  240. package/cjs/Pagination/PaginationButton.js +1 -2
  241. package/cjs/Panel/Panel.js +1 -2
  242. package/cjs/Panel/PanelHeader.js +1 -2
  243. package/cjs/PanelGroup/PanelGroup.js +1 -2
  244. package/cjs/PanelGroup/index.js +1 -2
  245. package/cjs/Placeholder/PlaceholderGrid.js +1 -2
  246. package/cjs/Placeholder/PlaceholderParagraph.js +1 -2
  247. package/cjs/Popover/Popover.js +1 -2
  248. package/cjs/Progress/Progress.d.ts +1 -1
  249. package/cjs/Progress/Progress.js +1 -1
  250. package/cjs/Progress/ProgressInfo.d.ts +17 -0
  251. package/cjs/Progress/ProgressInfo.js +29 -0
  252. package/cjs/Progress/ProgressLine.d.ts +20 -6
  253. package/cjs/Progress/ProgressLine.js +48 -37
  254. package/cjs/Progress/ProgressSections.d.ts +15 -0
  255. package/cjs/Progress/ProgressSections.js +43 -0
  256. package/cjs/Progress/ProgressStroke.d.ts +24 -0
  257. package/cjs/Progress/ProgressStroke.js +51 -0
  258. package/cjs/Progress/index.d.ts +3 -3
  259. package/cjs/Progress/index.js +1 -1
  260. package/cjs/Progress/types.d.ts +11 -0
  261. package/cjs/Progress/types.js +4 -0
  262. package/cjs/{Progress → ProgressCircle}/ProgressCircle.d.ts +20 -14
  263. package/cjs/ProgressCircle/ProgressCircle.js +113 -0
  264. package/cjs/ProgressCircle/ProgressCircleSections.d.ts +23 -0
  265. package/cjs/ProgressCircle/ProgressCircleSections.js +52 -0
  266. package/cjs/ProgressCircle/hooks/useProgressCirclePath.d.ts +28 -0
  267. package/cjs/ProgressCircle/hooks/useProgressCirclePath.js +66 -0
  268. package/cjs/ProgressCircle/index.d.ts +4 -0
  269. package/cjs/ProgressCircle/index.js +11 -0
  270. package/cjs/Radio/Radio.js +1 -2
  271. package/cjs/RadioGroup/RadioGroup.js +1 -2
  272. package/cjs/RadioTile/RadioTile.js +1 -2
  273. package/cjs/RadioTileGroup/RadioTileGroup.js +1 -2
  274. package/cjs/RangeSlider/RangeSlider.js +1 -3
  275. package/cjs/Rate/Character.js +1 -2
  276. package/cjs/Rate/useRatingStates.js +6 -7
  277. package/cjs/SelectPicker/SelectPicker.js +1 -2
  278. package/cjs/Sidebar/Sidebar.js +1 -2
  279. package/cjs/Sidenav/ExpandedSidenavDropdown.js +12 -17
  280. package/cjs/Sidenav/ExpandedSidenavDropdownItem.js +3 -4
  281. package/cjs/Sidenav/ExpandedSidenavDropdownMenu.js +9 -12
  282. package/cjs/Sidenav/Sidenav.d.ts +0 -15
  283. package/cjs/Sidenav/Sidenav.js +4 -5
  284. package/cjs/Sidenav/SidenavContext.d.ts +16 -0
  285. package/cjs/Sidenav/SidenavContext.js +8 -0
  286. package/cjs/Sidenav/SidenavDropdown.js +15 -19
  287. package/cjs/Sidenav/SidenavDropdownItem.js +8 -10
  288. package/cjs/Sidenav/SidenavDropdownMenu.js +38 -45
  289. package/cjs/Sidenav/SidenavItem.js +8 -10
  290. package/cjs/Sidenav/SidenavToggle.js +3 -4
  291. package/cjs/Slider/ProgressBar.d.ts +0 -1
  292. package/cjs/Slider/ProgressBar.js +1 -3
  293. package/cjs/Slider/Slider.js +14 -6
  294. package/cjs/Stack/Stack.js +4 -2
  295. package/cjs/Stack/VStack.js +1 -3
  296. package/cjs/Tag/Tag.js +1 -2
  297. package/cjs/TagInput/TagInput.js +1 -2
  298. package/cjs/TagPicker/TagPicker.js +1 -2
  299. package/cjs/TimePicker/TimePicker.js +1 -2
  300. package/cjs/Toggle/Toggle.js +1 -2
  301. package/cjs/Tooltip/Tooltip.js +1 -2
  302. package/cjs/Tree/Tree.js +1 -2
  303. package/cjs/Tree/TreeNode.js +1 -2
  304. package/cjs/Tree/TreeView.js +17 -22
  305. package/cjs/Tree/hooks/useFlattenTree.js +2 -8
  306. package/cjs/Tree/hooks/useTreeNodeProps.js +1 -2
  307. package/cjs/Tree/hooks/useVirtualizedTreeData.js +1 -7
  308. package/cjs/Tree/utils/flattenTree.js +2 -8
  309. package/cjs/Tree/utils/getExpandItemValues.js +6 -7
  310. package/cjs/Tree/utils/indentTreeNode.js +1 -4
  311. package/cjs/TreePicker/TreePicker.js +1 -2
  312. package/cjs/Uploader/UploadFileItem.js +2 -6
  313. package/cjs/Uploader/UploadTrigger.js +1 -2
  314. package/cjs/Uploader/Uploader.js +2 -6
  315. package/cjs/global.d.ts +0 -6
  316. package/cjs/index.d.ts +3 -0
  317. package/cjs/index.js +18 -0
  318. package/cjs/internals/Disclosure/Disclosure.js +1 -2
  319. package/cjs/internals/InputBase/InputBase.js +2 -3
  320. package/cjs/internals/Menu/Menu.js +13 -18
  321. package/cjs/internals/Menu/MenuItem.js +1 -2
  322. package/cjs/internals/Menu/Menubar.js +6 -8
  323. package/cjs/internals/Menu/useRenderMenuItem.js +1 -2
  324. package/cjs/internals/Overlay/Modal.js +1 -2
  325. package/cjs/internals/Overlay/Overlay.js +1 -2
  326. package/cjs/internals/Overlay/OverlayProvider.js +1 -2
  327. package/cjs/internals/Overlay/OverlayTrigger.js +3 -11
  328. package/cjs/internals/Overlay/Position.js +4 -8
  329. package/cjs/internals/Overlay/types.d.ts +1 -1
  330. package/cjs/internals/Overlay/utils/position.d.ts +24 -0
  331. package/cjs/internals/Overlay/{positionUtils.js → utils/position.js} +136 -50
  332. package/cjs/internals/Picker/Listbox.js +18 -23
  333. package/cjs/internals/Picker/PickerIndicator.js +9 -10
  334. package/cjs/internals/Picker/PickerLabel.js +6 -7
  335. package/cjs/internals/Picker/PickerPopup.js +1 -2
  336. package/cjs/internals/Picker/PickerToggle.js +1 -2
  337. package/cjs/internals/Picker/PickerToggleTrigger.js +1 -2
  338. package/cjs/internals/Picker/utils.js +1 -4
  339. package/cjs/internals/Provider/CustomContext.d.ts +20 -1
  340. package/cjs/internals/Provider/types.d.ts +6 -3
  341. package/cjs/internals/Ripple/Ripple.js +1 -2
  342. package/cjs/internals/SafeAnchor/SafeAnchor.js +1 -2
  343. package/cjs/internals/Tree/TreeProvider.js +4 -5
  344. package/cjs/internals/Tree/utils/filterNodesOfTree.js +1 -4
  345. package/cjs/internals/Tree/utils/findNodeOfTree.js +1 -4
  346. package/cjs/internals/Windowing/AutoSizer.js +1 -2
  347. package/cjs/internals/Windowing/List.js +1 -2
  348. package/cjs/internals/Windowing/index.js +1 -2
  349. package/cjs/internals/hooks/useClickOutside.js +5 -6
  350. package/cjs/internals/hooks/useEventCallback.js +1 -4
  351. package/cjs/internals/hooks/useEventListener.js +1 -4
  352. package/cjs/internals/hooks/usePortal.js +9 -15
  353. package/cjs/internals/hooks/useRootClose.js +6 -7
  354. package/cjs/internals/hooks/useStyles.js +5 -8
  355. package/cjs/internals/hooks/useTimeout.js +1 -7
  356. package/cjs/internals/hooks/useToggleCaret.d.ts +1 -1
  357. package/cjs/internals/intl/FormattedDate.js +4 -5
  358. package/cjs/internals/intl/FormattedNumber.js +5 -7
  359. package/cjs/internals/types/placement.d.ts +5 -0
  360. package/cjs/internals/utils/colours.js +1 -4
  361. package/cjs/internals/utils/composeFunctions.js +1 -4
  362. package/cjs/internals/utils/createChainedFunction.js +2 -8
  363. package/cjs/internals/utils/date/copyTime.js +4 -5
  364. package/cjs/internals/utils/getDataGroupBy.js +5 -8
  365. package/cjs/internals/utils/html/htmlPropsUtils.js +1 -4
  366. package/cjs/internals/utils/placement.js +1 -4
  367. package/cjs/internals/utils/react/createComponent.js +6 -7
  368. package/cjs/internals/utils/string/tplTransform.js +1 -4
  369. package/cjs/internals/utils/style-sheet/css.js +3 -12
  370. package/cjs/internals/utils/style-sheet/styles.js +2 -8
  371. package/cjs/locales/ar_EG.d.ts +6 -0
  372. package/cjs/locales/ar_EG.js +6 -0
  373. package/cjs/locales/ca_ES.d.ts +6 -0
  374. package/cjs/locales/ca_ES.js +6 -0
  375. package/cjs/locales/cs_CZ.d.ts +6 -0
  376. package/cjs/locales/cs_CZ.js +6 -0
  377. package/cjs/locales/da_DK.d.ts +6 -0
  378. package/cjs/locales/da_DK.js +6 -0
  379. package/cjs/locales/de_DE.d.ts +6 -0
  380. package/cjs/locales/de_DE.js +6 -0
  381. package/cjs/locales/en_GB.d.ts +6 -0
  382. package/cjs/locales/en_GB.js +6 -0
  383. package/cjs/locales/en_US.d.ts +6 -0
  384. package/cjs/locales/en_US.js +6 -0
  385. package/cjs/locales/es_AR.d.ts +6 -0
  386. package/cjs/locales/es_AR.js +6 -0
  387. package/cjs/locales/es_ES.d.ts +6 -0
  388. package/cjs/locales/es_ES.js +7 -1
  389. package/cjs/locales/fa_IR.d.ts +6 -0
  390. package/cjs/locales/fa_IR.js +6 -0
  391. package/cjs/locales/fi_FI.d.ts +6 -0
  392. package/cjs/locales/fi_FI.js +6 -0
  393. package/cjs/locales/fr_FR.d.ts +6 -0
  394. package/cjs/locales/fr_FR.js +6 -0
  395. package/cjs/locales/gu_IN.d.ts +157 -0
  396. package/cjs/locales/gu_IN.js +97 -0
  397. package/cjs/locales/hu_HU.d.ts +6 -0
  398. package/cjs/locales/hu_HU.js +6 -0
  399. package/cjs/locales/index.d.ts +3 -0
  400. package/cjs/locales/index.js +8 -2
  401. package/cjs/locales/it_IT.d.ts +6 -0
  402. package/cjs/locales/it_IT.js +6 -0
  403. package/cjs/locales/ja_JP.d.ts +6 -0
  404. package/cjs/locales/ja_JP.js +6 -0
  405. package/cjs/locales/kk_KZ.d.ts +6 -0
  406. package/cjs/locales/kk_KZ.js +6 -0
  407. package/cjs/locales/ko_KR.d.ts +6 -0
  408. package/cjs/locales/ko_KR.js +6 -0
  409. package/cjs/locales/ne_NP.d.ts +6 -0
  410. package/cjs/locales/ne_NP.js +6 -0
  411. package/cjs/locales/nl_NL.d.ts +6 -0
  412. package/cjs/locales/nl_NL.js +8 -2
  413. package/cjs/locales/pl_PL.d.ts +6 -0
  414. package/cjs/locales/pl_PL.js +6 -0
  415. package/cjs/locales/pt_BR.d.ts +6 -0
  416. package/cjs/locales/pt_BR.js +6 -0
  417. package/cjs/locales/ru_RU.d.ts +6 -0
  418. package/cjs/locales/ru_RU.js +6 -0
  419. package/cjs/locales/sv_SE.d.ts +6 -0
  420. package/cjs/locales/sv_SE.js +6 -0
  421. package/cjs/locales/th_TH.d.ts +169 -0
  422. package/cjs/locales/th_TH.js +100 -0
  423. package/cjs/locales/tr_TR.d.ts +6 -0
  424. package/cjs/locales/tr_TR.js +6 -0
  425. package/cjs/locales/uk_UA.d.ts +157 -0
  426. package/cjs/locales/uk_UA.js +97 -0
  427. package/cjs/locales/zh_CN.d.ts +6 -0
  428. package/cjs/locales/zh_CN.js +6 -0
  429. package/cjs/locales/zh_TW.d.ts +6 -0
  430. package/cjs/locales/zh_TW.js +6 -0
  431. package/cjs/toaster/ToastContainer.js +3 -4
  432. package/cjs/toaster/toaster.js +2 -6
  433. package/cjs/useDialog/Dialog.d.ts +15 -0
  434. package/cjs/useDialog/Dialog.js +109 -0
  435. package/cjs/useDialog/DialogContainer.d.ts +11 -0
  436. package/cjs/useDialog/DialogContainer.js +57 -0
  437. package/cjs/useDialog/index.d.ts +3 -0
  438. package/cjs/useDialog/index.js +15 -0
  439. package/cjs/useDialog/types.d.ts +33 -0
  440. package/cjs/useDialog/types.js +4 -0
  441. package/cjs/useDialog/useDialog.d.ts +15 -0
  442. package/cjs/useDialog/useDialog.js +126 -0
  443. package/cjs/{FormControl → useFormControl}/hooks/useField.d.ts +3 -3
  444. package/cjs/{FormControl → useFormControl}/hooks/useField.js +5 -6
  445. package/cjs/useFormControl/hooks/useRegisterModel.d.ts +2 -0
  446. package/cjs/{FormControl → useFormControl}/hooks/useRegisterModel.js +2 -3
  447. package/cjs/useFormControl/index.d.ts +4 -0
  448. package/cjs/useFormControl/index.js +11 -0
  449. package/cjs/useFormControl/useFormControl.d.ts +38 -0
  450. package/cjs/useFormControl/useFormControl.js +135 -0
  451. package/cjs/{FormControl/utils.js → useFormControl/utils/nameToPath.js} +0 -0
  452. package/cjs/useMediaQuery/breakpoints.js +4 -10
  453. package/cjs/useMediaQuery/useMediaQuery.js +1 -4
  454. package/cjs/useToaster/useToaster.d.ts +1 -1
  455. package/cjs/useToaster/useToaster.js +9 -9
  456. package/dist/rsuite-no-reset.css +14370 -13982
  457. package/dist/rsuite-no-reset.min.css +1 -2
  458. package/dist/rsuite.css +14599 -14187
  459. package/dist/rsuite.js +436 -260
  460. package/dist/rsuite.js.map +1 -1
  461. package/dist/rsuite.min.css +1 -2
  462. package/dist/rsuite.min.js +1 -1
  463. package/dist/rsuite.min.js.map +1 -1
  464. package/esm/Animation/Bounce.js +4 -5
  465. package/esm/Animation/Fade.js +5 -6
  466. package/esm/Animation/Slide.js +5 -6
  467. package/esm/Calendar/MonthDropdown/MonthDropdown.js +16 -20
  468. package/esm/Calendar/TimeDropdown/utils/scrollToTime.js +1 -2
  469. package/esm/Calendar/hooks/useCalendarDate.js +3 -6
  470. package/esm/CascadeTree/hooks/usePaths.js +7 -8
  471. package/esm/CheckTree/CheckTreeView.js +16 -20
  472. package/esm/CheckTree/hooks/useTreeValue.js +4 -5
  473. package/esm/CheckTreePicker/CheckTreePicker.d.ts +4 -0
  474. package/esm/CheckTreePicker/CheckTreePicker.js +28 -0
  475. package/esm/CustomProvider/CustomProvider.js +13 -2
  476. package/esm/DateInput/DateInput.js +4 -0
  477. package/esm/DateInput/hooks/useDateInputState.js +6 -7
  478. package/esm/DateInput/hooks/useIsFocused.js +4 -5
  479. package/esm/DateInput/hooks/useKeyboardInputEvent.js +7 -8
  480. package/esm/DateInput/test/types/TestKeyPressProps.d.ts +6 -0
  481. package/esm/DateInput/test/types/TestKeyPressProps.js +2 -0
  482. package/esm/DatePicker/DatePicker.js +2 -8
  483. package/esm/DatePicker/Toolbar.js +6 -7
  484. package/esm/DatePicker/utils.js +14 -24
  485. package/esm/DateRangeInput/DateRangeInput.js +5 -4
  486. package/esm/DateRangePicker/Calendar.d.ts +2 -1
  487. package/esm/DateRangePicker/Calendar.js +7 -1
  488. package/esm/DateRangePicker/DateRangePicker.d.ts +3 -1
  489. package/esm/DateRangePicker/DateRangePicker.js +8 -18
  490. package/esm/DateRangePicker/disabledDateUtils.js +4 -16
  491. package/esm/DateRangePicker/hooks/useCalendarHandlers.js +7 -8
  492. package/esm/DateRangePicker/utils.js +5 -6
  493. package/esm/Dropdown/Dropdown.js +8 -10
  494. package/esm/Dropdown/DropdownItem.js +5 -6
  495. package/esm/Dropdown/DropdownMenu.js +35 -41
  496. package/esm/Dropdown/DropdownState.js +1 -4
  497. package/esm/Form/FormContext.d.ts +1 -1
  498. package/esm/Form/hooks/useFormValidate.js +4 -9
  499. package/esm/Form/hooks/useSchemaModel.js +6 -9
  500. package/esm/FormControl/FormControl.d.ts +2 -2
  501. package/esm/FormControl/FormControl.js +53 -83
  502. package/esm/FormErrorMessage/FormErrorMessage.d.ts +2 -2
  503. package/esm/FormGroup/FormGroup.d.ts +0 -18
  504. package/esm/FormGroup/FormGroup.js +1 -28
  505. package/esm/FormGroup/FormGroupContext.d.ts +4 -0
  506. package/esm/FormGroup/FormGroupContext.js +3 -0
  507. package/esm/FormGroup/index.d.ts +1 -1
  508. package/esm/FormGroup/index.js +1 -1
  509. package/esm/FormGroup/useFormGroup.d.ts +18 -0
  510. package/esm/FormGroup/useFormGroup.js +30 -0
  511. package/esm/Grid/utils/styles.js +1 -4
  512. package/esm/InlineEdit/useEditState.js +1 -1
  513. package/esm/InlineEdit/useFocusEvent.js +6 -7
  514. package/esm/Input/Input.js +1 -1
  515. package/esm/InputGroup/InputGroup.d.ts +0 -5
  516. package/esm/InputGroup/InputGroup.js +1 -1
  517. package/esm/InputGroup/InputGroupContext.d.ts +6 -0
  518. package/esm/InputGroup/InputGroupContext.js +3 -0
  519. package/esm/InputGroup/index.d.ts +1 -0
  520. package/esm/InputGroup/index.js +1 -0
  521. package/esm/List/helper/AutoScroller.js +7 -8
  522. package/esm/List/helper/useSortHelper.js +1 -1
  523. package/esm/List/helper/utils.js +4 -7
  524. package/esm/MaskedInput/adjustCaretPosition.js +11 -12
  525. package/esm/MaskedInput/conformToMask.js +1 -10
  526. package/esm/MaskedInput/createTextMaskInputElement.js +9 -10
  527. package/esm/MaskedInput/utilities.js +1 -7
  528. package/esm/Menu/MenuItem.js +5 -6
  529. package/esm/MultiCascadeTree/hooks/useCascadeValue.js +1 -4
  530. package/esm/MultiCascadeTree/utils.js +1 -4
  531. package/esm/Nav/AdaptiveNavItem.js +1 -1
  532. package/esm/Nav/Nav.js +1 -1
  533. package/esm/Nav/NavDropdown.js +8 -10
  534. package/esm/Nav/NavDropdownItem.js +5 -6
  535. package/esm/Nav/NavDropdownMenu.js +35 -41
  536. package/esm/Nav/NavMenu.js +1 -1
  537. package/esm/Navbar/NavbarDropdown.js +7 -9
  538. package/esm/Navbar/NavbarDropdownMenu.js +11 -14
  539. package/esm/NumberInput/utils/number.js +1 -4
  540. package/esm/Progress/Progress.d.ts +1 -1
  541. package/esm/Progress/Progress.js +1 -1
  542. package/esm/Progress/ProgressInfo.d.ts +17 -0
  543. package/esm/Progress/ProgressInfo.js +24 -0
  544. package/esm/Progress/ProgressLine.d.ts +20 -6
  545. package/esm/Progress/ProgressLine.js +49 -38
  546. package/esm/Progress/ProgressSections.d.ts +15 -0
  547. package/esm/Progress/ProgressSections.js +38 -0
  548. package/esm/Progress/ProgressStroke.d.ts +24 -0
  549. package/esm/Progress/ProgressStroke.js +46 -0
  550. package/esm/Progress/index.d.ts +3 -3
  551. package/esm/Progress/index.js +1 -1
  552. package/esm/Progress/types.d.ts +11 -0
  553. package/esm/Progress/types.js +2 -0
  554. package/esm/{Progress → ProgressCircle}/ProgressCircle.d.ts +20 -14
  555. package/esm/ProgressCircle/ProgressCircle.js +107 -0
  556. package/esm/ProgressCircle/ProgressCircleSections.d.ts +23 -0
  557. package/esm/ProgressCircle/ProgressCircleSections.js +47 -0
  558. package/esm/ProgressCircle/hooks/useProgressCirclePath.d.ts +28 -0
  559. package/esm/ProgressCircle/hooks/useProgressCirclePath.js +62 -0
  560. package/esm/ProgressCircle/index.d.ts +4 -0
  561. package/esm/ProgressCircle/index.js +8 -0
  562. package/esm/RangeSlider/RangeSlider.js +0 -1
  563. package/esm/Rate/useRatingStates.js +6 -7
  564. package/esm/Sidenav/ExpandedSidenavDropdown.js +10 -14
  565. package/esm/Sidenav/ExpandedSidenavDropdownItem.js +1 -1
  566. package/esm/Sidenav/ExpandedSidenavDropdownMenu.js +7 -9
  567. package/esm/Sidenav/Sidenav.d.ts +0 -15
  568. package/esm/Sidenav/Sidenav.js +1 -1
  569. package/esm/Sidenav/SidenavContext.d.ts +16 -0
  570. package/esm/Sidenav/SidenavContext.js +3 -0
  571. package/esm/Sidenav/SidenavDropdown.js +13 -16
  572. package/esm/Sidenav/SidenavDropdownItem.js +6 -7
  573. package/esm/Sidenav/SidenavDropdownMenu.js +36 -42
  574. package/esm/Sidenav/SidenavItem.js +6 -7
  575. package/esm/Sidenav/SidenavToggle.js +1 -1
  576. package/esm/Slider/ProgressBar.d.ts +0 -1
  577. package/esm/Slider/ProgressBar.js +1 -3
  578. package/esm/Slider/Slider.js +13 -4
  579. package/esm/Stack/Stack.js +4 -2
  580. package/esm/Stack/VStack.js +1 -3
  581. package/esm/Tree/TreeView.js +16 -20
  582. package/esm/Tree/hooks/useFlattenTree.js +2 -8
  583. package/esm/Tree/hooks/useVirtualizedTreeData.js +1 -7
  584. package/esm/Tree/utils/flattenTree.js +2 -8
  585. package/esm/Tree/utils/getExpandItemValues.js +6 -7
  586. package/esm/Tree/utils/indentTreeNode.js +1 -4
  587. package/esm/Uploader/UploadFileItem.js +1 -4
  588. package/esm/Uploader/Uploader.js +1 -4
  589. package/esm/global.d.ts +0 -6
  590. package/esm/index.d.ts +3 -0
  591. package/esm/index.js +3 -0
  592. package/esm/internals/InputBase/InputBase.js +1 -1
  593. package/esm/internals/Menu/Menu.js +12 -16
  594. package/esm/internals/Menu/Menubar.js +5 -6
  595. package/esm/internals/Overlay/OverlayTrigger.js +2 -9
  596. package/esm/internals/Overlay/Position.js +3 -6
  597. package/esm/internals/Overlay/types.d.ts +1 -1
  598. package/esm/internals/Overlay/utils/position.d.ts +24 -0
  599. package/esm/internals/Overlay/{positionUtils.js → utils/position.js} +134 -48
  600. package/esm/internals/Picker/Listbox.js +17 -21
  601. package/esm/internals/Picker/PickerIndicator.js +9 -10
  602. package/esm/internals/Picker/PickerLabel.js +6 -7
  603. package/esm/internals/Picker/utils.js +1 -4
  604. package/esm/internals/Provider/CustomContext.d.ts +20 -1
  605. package/esm/internals/Provider/types.d.ts +6 -3
  606. package/esm/internals/Tree/TreeProvider.js +4 -5
  607. package/esm/internals/Tree/utils/filterNodesOfTree.js +1 -4
  608. package/esm/internals/Tree/utils/findNodeOfTree.js +1 -4
  609. package/esm/internals/hooks/useClickOutside.js +5 -6
  610. package/esm/internals/hooks/useEventCallback.js +1 -4
  611. package/esm/internals/hooks/useEventListener.js +1 -4
  612. package/esm/internals/hooks/usePortal.js +8 -13
  613. package/esm/internals/hooks/useRootClose.js +6 -7
  614. package/esm/internals/hooks/useStyles.js +5 -8
  615. package/esm/internals/hooks/useTimeout.js +1 -7
  616. package/esm/internals/hooks/useToggleCaret.d.ts +1 -1
  617. package/esm/internals/intl/FormattedDate.js +4 -5
  618. package/esm/internals/intl/FormattedNumber.js +4 -5
  619. package/esm/internals/types/placement.d.ts +5 -0
  620. package/esm/internals/utils/colours.js +1 -4
  621. package/esm/internals/utils/composeFunctions.js +1 -4
  622. package/esm/internals/utils/createChainedFunction.js +2 -8
  623. package/esm/internals/utils/date/copyTime.js +4 -5
  624. package/esm/internals/utils/getDataGroupBy.js +5 -8
  625. package/esm/internals/utils/html/htmlPropsUtils.js +1 -4
  626. package/esm/internals/utils/placement.js +1 -4
  627. package/esm/internals/utils/react/createComponent.js +6 -7
  628. package/esm/internals/utils/string/tplTransform.js +1 -4
  629. package/esm/internals/utils/style-sheet/css.js +3 -12
  630. package/esm/internals/utils/style-sheet/styles.js +2 -8
  631. package/esm/locales/ar_EG.d.ts +6 -0
  632. package/esm/locales/ar_EG.js +6 -0
  633. package/esm/locales/ca_ES.d.ts +6 -0
  634. package/esm/locales/ca_ES.js +6 -0
  635. package/esm/locales/cs_CZ.d.ts +6 -0
  636. package/esm/locales/cs_CZ.js +6 -0
  637. package/esm/locales/da_DK.d.ts +6 -0
  638. package/esm/locales/da_DK.js +6 -0
  639. package/esm/locales/de_DE.d.ts +6 -0
  640. package/esm/locales/de_DE.js +6 -0
  641. package/esm/locales/en_GB.d.ts +6 -0
  642. package/esm/locales/en_GB.js +6 -0
  643. package/esm/locales/en_US.d.ts +6 -0
  644. package/esm/locales/en_US.js +6 -0
  645. package/esm/locales/es_AR.d.ts +6 -0
  646. package/esm/locales/es_AR.js +6 -0
  647. package/esm/locales/es_ES.d.ts +6 -0
  648. package/esm/locales/es_ES.js +7 -1
  649. package/esm/locales/fa_IR.d.ts +6 -0
  650. package/esm/locales/fa_IR.js +6 -0
  651. package/esm/locales/fi_FI.d.ts +6 -0
  652. package/esm/locales/fi_FI.js +6 -0
  653. package/esm/locales/fr_FR.d.ts +6 -0
  654. package/esm/locales/fr_FR.js +6 -0
  655. package/esm/locales/gu_IN.d.ts +157 -0
  656. package/esm/locales/gu_IN.js +93 -0
  657. package/esm/locales/hu_HU.d.ts +6 -0
  658. package/esm/locales/hu_HU.js +6 -0
  659. package/esm/locales/index.d.ts +3 -0
  660. package/esm/locales/index.js +4 -1
  661. package/esm/locales/it_IT.d.ts +6 -0
  662. package/esm/locales/it_IT.js +6 -0
  663. package/esm/locales/ja_JP.d.ts +6 -0
  664. package/esm/locales/ja_JP.js +6 -0
  665. package/esm/locales/kk_KZ.d.ts +6 -0
  666. package/esm/locales/kk_KZ.js +6 -0
  667. package/esm/locales/ko_KR.d.ts +6 -0
  668. package/esm/locales/ko_KR.js +6 -0
  669. package/esm/locales/ne_NP.d.ts +6 -0
  670. package/esm/locales/ne_NP.js +6 -0
  671. package/esm/locales/nl_NL.d.ts +6 -0
  672. package/esm/locales/nl_NL.js +8 -2
  673. package/esm/locales/pl_PL.d.ts +6 -0
  674. package/esm/locales/pl_PL.js +6 -0
  675. package/esm/locales/pt_BR.d.ts +6 -0
  676. package/esm/locales/pt_BR.js +6 -0
  677. package/esm/locales/ru_RU.d.ts +6 -0
  678. package/esm/locales/ru_RU.js +6 -0
  679. package/esm/locales/sv_SE.d.ts +6 -0
  680. package/esm/locales/sv_SE.js +6 -0
  681. package/esm/locales/th_TH.d.ts +169 -0
  682. package/esm/locales/th_TH.js +96 -0
  683. package/esm/locales/tr_TR.d.ts +6 -0
  684. package/esm/locales/tr_TR.js +6 -0
  685. package/esm/locales/uk_UA.d.ts +157 -0
  686. package/esm/locales/uk_UA.js +93 -0
  687. package/esm/locales/zh_CN.d.ts +6 -0
  688. package/esm/locales/zh_CN.js +6 -0
  689. package/esm/locales/zh_TW.d.ts +6 -0
  690. package/esm/locales/zh_TW.js +6 -0
  691. package/esm/toaster/ToastContainer.js +2 -2
  692. package/esm/toaster/toaster.js +1 -4
  693. package/esm/useDialog/Dialog.d.ts +15 -0
  694. package/esm/useDialog/Dialog.js +103 -0
  695. package/esm/useDialog/DialogContainer.d.ts +11 -0
  696. package/esm/useDialog/DialogContainer.js +52 -0
  697. package/esm/useDialog/index.d.ts +3 -0
  698. package/esm/useDialog/index.js +4 -0
  699. package/esm/useDialog/types.d.ts +33 -0
  700. package/esm/useDialog/types.js +2 -0
  701. package/esm/useDialog/useDialog.d.ts +15 -0
  702. package/esm/useDialog/useDialog.js +120 -0
  703. package/esm/{FormControl → useFormControl}/hooks/useField.d.ts +3 -3
  704. package/esm/{FormControl → useFormControl}/hooks/useField.js +4 -5
  705. package/esm/useFormControl/hooks/useRegisterModel.d.ts +2 -0
  706. package/esm/{FormControl → useFormControl}/hooks/useRegisterModel.js +2 -3
  707. package/esm/useFormControl/index.d.ts +4 -0
  708. package/esm/useFormControl/index.js +8 -0
  709. package/esm/useFormControl/useFormControl.d.ts +38 -0
  710. package/esm/useFormControl/useFormControl.js +130 -0
  711. package/esm/{FormControl/utils.js → useFormControl/utils/nameToPath.js} +0 -0
  712. package/esm/useMediaQuery/breakpoints.js +4 -10
  713. package/esm/useMediaQuery/useMediaQuery.js +1 -4
  714. package/esm/useToaster/useToaster.d.ts +1 -1
  715. package/esm/useToaster/useToaster.js +11 -10
  716. package/locales/gu_IN/package.json +7 -0
  717. package/locales/th_TH/package.json +7 -0
  718. package/locales/uk_UA/package.json +7 -0
  719. package/package.json +5 -6
  720. package/toaster/styles/index.css +107 -121
  721. package/useDialog/package.json +7 -0
  722. package/useFormControl/package.json +7 -0
  723. package/useToaster/styles/index.css +107 -121
  724. package/Accordion/styles/index.less +0 -2
  725. package/Animation/styles/animation.less +0 -95
  726. package/Animation/styles/bounce.less +0 -34
  727. package/Animation/styles/collapse.less +0 -23
  728. package/Animation/styles/fade.less +0 -10
  729. package/Animation/styles/index.less +0 -8
  730. package/Animation/styles/mixin.less +0 -15
  731. package/Animation/styles/slide.less +0 -24
  732. package/Animation/styles/variables.less +0 -4
  733. package/AutoComplete/styles/index.less +0 -37
  734. package/Avatar/styles/index.less +0 -48
  735. package/AvatarGroup/styles/index.less +0 -25
  736. package/Badge/styles/index.less +0 -101
  737. package/Badge/styles/variables.less +0 -19
  738. package/Box/styles/index.less +0 -1
  739. package/Breadcrumb/styles/index.less +0 -49
  740. package/Button/styles/index.less +0 -364
  741. package/Button/styles/mixin.less +0 -62
  742. package/Button/styles/variables.less +0 -30
  743. package/ButtonGroup/styles/index.less +0 -91
  744. package/ButtonToolbar/styles/index.less +0 -17
  745. package/Calendar/styles/index.less +0 -678
  746. package/Card/styles/index.less +0 -63
  747. package/CardGroup/styles/index.less +0 -8
  748. package/Carousel/styles/index.less +0 -192
  749. package/CascadeTree/styles/index.less +0 -88
  750. package/CascadeTree/styles/search.less +0 -35
  751. package/Cascader/styles/index.less +0 -5
  752. package/Center/styles/index.less +0 -9
  753. package/CheckPicker/styles/index.less +0 -21
  754. package/CheckTree/styles/index.less +0 -120
  755. package/CheckTreePicker/styles/index.less +0 -17
  756. package/Checkbox/styles/index.less +0 -153
  757. package/Checkbox/styles/mixin.less +0 -37
  758. package/CheckboxGroup/styles/index.less +0 -14
  759. package/Col/styles/index.less +0 -2
  760. package/Container/stories/styles.less +0 -23
  761. package/Container/styles/index.less +0 -16
  762. package/Content/styles/index.less +0 -6
  763. package/DateInput/styles/index.less +0 -1
  764. package/DatePicker/styles/index.less +0 -167
  765. package/DatePicker/styles/mixin.less +0 -8
  766. package/DateRangeInput/styles/index.less +0 -1
  767. package/DateRangePicker/styles/index.less +0 -145
  768. package/Divider/styles/index.less +0 -85
  769. package/Drawer/styles/index.less +0 -255
  770. package/Drawer/styles/mixin.less +0 -23
  771. package/Dropdown/styles/index.less +0 -341
  772. package/Dropdown/styles/mixin.less +0 -4
  773. package/FlexboxGrid/styles/index.less +0 -79
  774. package/Footer/styles/index.less +0 -5
  775. package/Form/styles/index.less +0 -1
  776. package/FormControl/styles/index.less +0 -79
  777. package/FormControlLabel/styles/index.less +0 -7
  778. package/FormErrorMessage/styles/animation.less +0 -43
  779. package/FormErrorMessage/styles/index.less +0 -179
  780. package/FormGroup/styles/index.less +0 -75
  781. package/FormHelpText/styles/index.less +0 -21
  782. package/FormStack/styles/index.less +0 -15
  783. package/Grid/styles/columns.less +0 -21
  784. package/Grid/styles/grid-framework.less +0 -92
  785. package/Grid/styles/index.less +0 -107
  786. package/Grid/styles/mixin.less +0 -12
  787. package/Grid/styles/row.less +0 -42
  788. package/Grid/styles/variables.less +0 -5
  789. package/Header/styles/index.less +0 -5
  790. package/Heading/styles/index.less +0 -42
  791. package/Heading/styles/variables.less +0 -19
  792. package/HeadingGroup/styles/index.less +0 -3
  793. package/Highlight/styles/index.less +0 -6
  794. package/IconButton/styles/index.less +0 -90
  795. package/Image/styles/index.less +0 -34
  796. package/InlineEdit/styles/index.less +0 -50
  797. package/Input/styles/index.less +0 -23
  798. package/Input/styles/mixin.less +0 -38
  799. package/Input/styles/variables.less +0 -22
  800. package/InputGroup/styles/index.less +0 -237
  801. package/InputNumber/styles/index.less +0 -1
  802. package/InputPicker/styles/index.less +0 -64
  803. package/InputPicker/styles/mixin.less +0 -7
  804. package/Kbd/styles/index.less +0 -20
  805. package/Kbd/styles/mixin.less +0 -24
  806. package/Kbd/styles/variables.less +0 -13
  807. package/Link/styles/index.less +0 -39
  808. package/List/styles/index.less +0 -113
  809. package/Loader/styles/index.less +0 -114
  810. package/Loader/styles/mixin.less +0 -33
  811. package/Loader/styles/variables.less +0 -16
  812. package/Menu/styles/index.less +0 -108
  813. package/Message/styles/index.less +0 -188
  814. package/Modal/styles/animation.less +0 -15
  815. package/Modal/styles/index.less +0 -189
  816. package/MultiCascadeTree/styles/index.less +0 -46
  817. package/MultiCascader/styles/index.less +0 -15
  818. package/Nav/styles/index.less +0 -366
  819. package/Navbar/styles/index.less +0 -236
  820. package/Notification/styles/index.less +0 -114
  821. package/NumberInput/styles/index.less +0 -74
  822. package/NumberInput/styles/mixin.less +0 -11
  823. package/Pagination/styles/index.less +0 -101
  824. package/Pagination/styles/mixin.less +0 -14
  825. package/Pagination/styles/pagination-group.less +0 -31
  826. package/Panel/styles/index.less +0 -121
  827. package/PanelGroup/styles/index.less +0 -34
  828. package/PasswordInput/styles/index.less +0 -1
  829. package/PasswordStrengthMeter/styles/index.less +0 -39
  830. package/PinInput/styles/index.less +0 -66
  831. package/Placeholder/styles/index.less +0 -148
  832. package/Placeholder/styles/mixin.less +0 -7
  833. package/Popover/styles/index.less +0 -202
  834. package/Popover/styles/mixins.less +0 -60
  835. package/Progress/styles/animation.less +0 -34
  836. package/Progress/styles/index.less +0 -187
  837. package/ProgressLine/package.json +0 -7
  838. package/Radio/styles/index.less +0 -144
  839. package/Radio/styles/mixin.less +0 -5
  840. package/RadioGroup/styles/index.less +0 -87
  841. package/RadioTile/styles/index.less +0 -79
  842. package/RadioTileGroup/styles/index.less +0 -1
  843. package/RangeSlider/styles/index.less +0 -4
  844. package/Rate/styles/index.less +0 -139
  845. package/Row/styles/index.less +0 -2
  846. package/SelectPicker/styles/index.less +0 -47
  847. package/Sidebar/styles/index.less +0 -15
  848. package/Sidenav/styles/index.less +0 -655
  849. package/Sidenav/styles/mixin.less +0 -23
  850. package/Slider/styles/index.less +0 -296
  851. package/Stack/styles/index.less +0 -83
  852. package/Stat/styles/index.less +0 -113
  853. package/StatGroup/styles/index.less +0 -8
  854. package/Steps/styles/index.less +0 -222
  855. package/Table/styles/index.less +0 -433
  856. package/Table/styles/mixin.less +0 -8
  857. package/Tabs/styles/index.less +0 -24
  858. package/Tag/styles/index.less +0 -55
  859. package/TagGroup/styles/index.less +0 -14
  860. package/TagInput/styles/index.less +0 -5
  861. package/TagPicker/styles/index.less +0 -136
  862. package/Text/styles/index.less +0 -122
  863. package/Text/styles/variables.less +0 -9
  864. package/Textarea/styles/index.less +0 -7
  865. package/TimePicker/styles/index.less +0 -1
  866. package/TimeRangePicker/styles/index.less +0 -1
  867. package/Timeline/stories/styles.less +0 -29
  868. package/Timeline/styles/index.less +0 -174
  869. package/Timeline/styles/mixin.less +0 -13
  870. package/Toggle/styles/index.less +0 -278
  871. package/Tooltip/styles/index.less +0 -161
  872. package/Tooltip/styles/mixins.less +0 -60
  873. package/Tree/styles/indent-line.less +0 -8
  874. package/Tree/styles/index.less +0 -186
  875. package/Tree/styles/toggle.less +0 -32
  876. package/TreePicker/styles/index.less +0 -16
  877. package/Uploader/styles/index.less +0 -468
  878. package/Uploader/styles/mixin.less +0 -11
  879. package/VisuallyHidden/styles/index.less +0 -11
  880. package/cjs/FormControl/hooks/useRegisterModel.d.ts +0 -3
  881. package/cjs/Progress/ProgressCircle.js +0 -132
  882. package/cjs/internals/Overlay/positionUtils.d.ts +0 -15
  883. package/dist/rsuite-no-reset-rtl.css +0 -15243
  884. package/dist/rsuite-no-reset-rtl.min.css +0 -2
  885. package/dist/rsuite-no-reset-rtl.min.css.map +0 -1
  886. package/dist/rsuite-no-reset.min.css.map +0 -1
  887. package/dist/rsuite-rtl.css +0 -15494
  888. package/dist/rsuite-rtl.min.css +0 -2
  889. package/dist/rsuite-rtl.min.css.map +0 -1
  890. package/dist/rsuite.min.css.map +0 -1
  891. package/esm/FormControl/hooks/useRegisterModel.d.ts +0 -3
  892. package/esm/Progress/ProgressCircle.js +0 -125
  893. package/esm/internals/Overlay/positionUtils.d.ts +0 -15
  894. package/internals/Box/styles/index.less +0 -82
  895. package/internals/Burger/styles/index.less +0 -67
  896. package/internals/CloseButton/styles/index.less +0 -15
  897. package/internals/Picker/styles/index.less +0 -477
  898. package/internals/Picker/styles/mixin.less +0 -131
  899. package/internals/Ripple/styles/index.less +0 -36
  900. package/internals/Ripple/styles/mixins.less +0 -6
  901. package/internals/ScrollView/styles/index.less +0 -69
  902. package/internals/SearchBox/styles/index.less +0 -11
  903. package/styles/color-modes/dark.less +0 -441
  904. package/styles/color-modes/high-contrast.less +0 -452
  905. package/styles/color-modes/light.less +0 -464
  906. package/styles/colors/dark.less +0 -105
  907. package/styles/colors/high-contrast.less +0 -105
  908. package/styles/colors/light.less +0 -105
  909. package/styles/common.less +0 -13
  910. package/styles/index.less +0 -106
  911. package/styles/mixins/color-modes.less +0 -16
  912. package/styles/mixins/combobox.less +0 -6
  913. package/styles/mixins/hacks.less +0 -32
  914. package/styles/mixins/listbox.less +0 -68
  915. package/styles/mixins/menu.less +0 -12
  916. package/styles/mixins/utilities.less +0 -183
  917. package/styles/normalize.less +0 -247
  918. package/styles/plugins/palette.js +0 -1407
  919. package/styles/root.less +0 -83
  920. package/styles/scaffolding.less +0 -54
  921. package/styles/typography.less +0 -123
  922. package/styles/variables.less +0 -638
  923. package/toaster/styles/animation.less +0 -54
  924. package/toaster/styles/index.less +0 -100
  925. package/useToaster/styles/index.less +0 -1
  926. /package/cjs/{FormControl/utils.d.ts → useFormControl/utils/nameToPath.d.ts} +0 -0
  927. /package/esm/{FormControl/utils.d.ts → useFormControl/utils/nameToPath.d.ts} +0 -0
@@ -1,1407 +0,0 @@
1
- // TinyColor v1.4.2
2
- // https://github.com/bgrins/TinyColor
3
- // Brian Grinstead, MIT License
4
-
5
- var tinycolor = (function (Math) {
6
- var trimLeft = /^\s+/,
7
- trimRight = /\s+$/,
8
- mathRound = Math.round,
9
- mathMin = Math.min,
10
- mathMax = Math.max,
11
- mathRandom = Math.random;
12
-
13
- function tinycolor(color, opts) {
14
- color = color ? color : '';
15
- opts = opts || {};
16
-
17
- // If input is already a tinycolor, return itself
18
- if (color instanceof tinycolor) {
19
- return color;
20
- }
21
- // If we are called as a function, call using new instead
22
- if (!(this instanceof tinycolor)) {
23
- return new tinycolor(color, opts);
24
- }
25
-
26
- var rgb = inputToRGB(color);
27
- (this._originalInput = color),
28
- (this._r = rgb.r),
29
- (this._g = rgb.g),
30
- (this._b = rgb.b),
31
- (this._a = rgb.a),
32
- (this._roundA = mathRound(100 * this._a) / 100),
33
- (this._format = opts.format || rgb.format);
34
- this._gradientType = opts.gradientType;
35
-
36
- // Don't let the range of [0,255] come back in [0,1].
37
- // Potentially lose a little bit of precision here, but will fix issues where
38
- // .5 gets interpreted as half of the total, instead of half of 1
39
- // If it was supposed to be 128, this was already taken care of by `inputToRgb`
40
- if (this._r < 1) {
41
- this._r = mathRound(this._r);
42
- }
43
- if (this._g < 1) {
44
- this._g = mathRound(this._g);
45
- }
46
- if (this._b < 1) {
47
- this._b = mathRound(this._b);
48
- }
49
-
50
- this._ok = rgb.ok;
51
- }
52
-
53
- tinycolor.prototype = {
54
- isDark: function () {
55
- return this.getBrightness() < 128;
56
- },
57
- isLight: function () {
58
- return !this.isDark();
59
- },
60
- isValid: function () {
61
- return this._ok;
62
- },
63
- getOriginalInput: function () {
64
- return this._originalInput;
65
- },
66
- getFormat: function () {
67
- return this._format;
68
- },
69
- getAlpha: function () {
70
- return this._a;
71
- },
72
- getBrightness: function () {
73
- //http://www.w3.org/TR/AERT#color-contrast
74
- var rgb = this.toRgb();
75
- return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
76
- },
77
- getLuminance: function () {
78
- //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
79
- var rgb = this.toRgb();
80
- var RsRGB, GsRGB, BsRGB, R, G, B;
81
- RsRGB = rgb.r / 255;
82
- GsRGB = rgb.g / 255;
83
- BsRGB = rgb.b / 255;
84
-
85
- if (RsRGB <= 0.03928) {
86
- R = RsRGB / 12.92;
87
- } else {
88
- R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
89
- }
90
- if (GsRGB <= 0.03928) {
91
- G = GsRGB / 12.92;
92
- } else {
93
- G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
94
- }
95
- if (BsRGB <= 0.03928) {
96
- B = BsRGB / 12.92;
97
- } else {
98
- B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
99
- }
100
- return 0.2126 * R + 0.7152 * G + 0.0722 * B;
101
- },
102
- setAlpha: function (value) {
103
- this._a = boundAlpha(value);
104
- this._roundA = mathRound(100 * this._a) / 100;
105
- return this;
106
- },
107
- toHsv: function () {
108
- var hsv = rgbToHsv(this._r, this._g, this._b);
109
- return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
110
- },
111
- toHsvString: function () {
112
- var hsv = rgbToHsv(this._r, this._g, this._b);
113
- var h = mathRound(hsv.h * 360),
114
- s = mathRound(hsv.s * 100),
115
- v = mathRound(hsv.v * 100);
116
- return this._a == 1
117
- ? 'hsv(' + h + ', ' + s + '%, ' + v + '%)'
118
- : 'hsva(' + h + ', ' + s + '%, ' + v + '%, ' + this._roundA + ')';
119
- },
120
- toHsl: function () {
121
- var hsl = rgbToHsl(this._r, this._g, this._b);
122
- return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
123
- },
124
- toHslString: function () {
125
- var hsl = rgbToHsl(this._r, this._g, this._b);
126
- var h = mathRound(hsl.h * 360),
127
- s = mathRound(hsl.s * 100),
128
- l = mathRound(hsl.l * 100);
129
- return this._a == 1
130
- ? 'hsl(' + h + ', ' + s + '%, ' + l + '%)'
131
- : 'hsla(' + h + ', ' + s + '%, ' + l + '%, ' + this._roundA + ')';
132
- },
133
- toHex: function (allow3Char) {
134
- return rgbToHex(this._r, this._g, this._b, allow3Char);
135
- },
136
- toHexString: function (allow3Char) {
137
- return '#' + this.toHex(allow3Char);
138
- },
139
- toHex8: function (allow4Char) {
140
- return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
141
- },
142
- toHex8String: function (allow4Char) {
143
- return '#' + this.toHex8(allow4Char);
144
- },
145
- toRgb: function () {
146
- return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
147
- },
148
- toRgbString: function () {
149
- return this._a == 1
150
- ? 'rgb(' + mathRound(this._r) + ', ' + mathRound(this._g) + ', ' + mathRound(this._b) + ')'
151
- : 'rgba(' +
152
- mathRound(this._r) +
153
- ', ' +
154
- mathRound(this._g) +
155
- ', ' +
156
- mathRound(this._b) +
157
- ', ' +
158
- this._roundA +
159
- ')';
160
- },
161
- toPercentageRgb: function () {
162
- return {
163
- r: mathRound(bound01(this._r, 255) * 100) + '%',
164
- g: mathRound(bound01(this._g, 255) * 100) + '%',
165
- b: mathRound(bound01(this._b, 255) * 100) + '%',
166
- a: this._a
167
- };
168
- },
169
- toPercentageRgbString: function () {
170
- return this._a == 1
171
- ? 'rgb(' +
172
- mathRound(bound01(this._r, 255) * 100) +
173
- '%, ' +
174
- mathRound(bound01(this._g, 255) * 100) +
175
- '%, ' +
176
- mathRound(bound01(this._b, 255) * 100) +
177
- '%)'
178
- : 'rgba(' +
179
- mathRound(bound01(this._r, 255) * 100) +
180
- '%, ' +
181
- mathRound(bound01(this._g, 255) * 100) +
182
- '%, ' +
183
- mathRound(bound01(this._b, 255) * 100) +
184
- '%, ' +
185
- this._roundA +
186
- ')';
187
- },
188
- toName: function () {
189
- if (this._a === 0) {
190
- return 'transparent';
191
- }
192
-
193
- if (this._a < 1) {
194
- return false;
195
- }
196
-
197
- return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
198
- },
199
- toFilter: function (secondColor) {
200
- var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
201
- var secondHex8String = hex8String;
202
- var gradientType = this._gradientType ? 'GradientType = 1, ' : '';
203
-
204
- if (secondColor) {
205
- var s = tinycolor(secondColor);
206
- secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
207
- }
208
-
209
- return (
210
- 'progid:DXImageTransform.Microsoft.gradient(' +
211
- gradientType +
212
- 'startColorstr=' +
213
- hex8String +
214
- ',endColorstr=' +
215
- secondHex8String +
216
- ')'
217
- );
218
- },
219
- toString: function (format) {
220
- var formatSet = !!format;
221
- format = format || this._format;
222
-
223
- var formattedString = false;
224
- var hasAlpha = this._a < 1 && this._a >= 0;
225
- var needsAlphaFormat =
226
- !formatSet &&
227
- hasAlpha &&
228
- (format === 'hex' ||
229
- format === 'hex6' ||
230
- format === 'hex3' ||
231
- format === 'hex4' ||
232
- format === 'hex8' ||
233
- format === 'name');
234
-
235
- if (needsAlphaFormat) {
236
- // Special case for "transparent", all other non-alpha formats
237
- // will return rgba when there is transparency.
238
- if (format === 'name' && this._a === 0) {
239
- return this.toName();
240
- }
241
- return this.toRgbString();
242
- }
243
- if (format === 'rgb') {
244
- formattedString = this.toRgbString();
245
- }
246
- if (format === 'prgb') {
247
- formattedString = this.toPercentageRgbString();
248
- }
249
- if (format === 'hex' || format === 'hex6') {
250
- formattedString = this.toHexString();
251
- }
252
- if (format === 'hex3') {
253
- formattedString = this.toHexString(true);
254
- }
255
- if (format === 'hex4') {
256
- formattedString = this.toHex8String(true);
257
- }
258
- if (format === 'hex8') {
259
- formattedString = this.toHex8String();
260
- }
261
- if (format === 'name') {
262
- formattedString = this.toName();
263
- }
264
- if (format === 'hsl') {
265
- formattedString = this.toHslString();
266
- }
267
- if (format === 'hsv') {
268
- formattedString = this.toHsvString();
269
- }
270
-
271
- return formattedString || this.toHexString();
272
- },
273
- clone: function () {
274
- return tinycolor(this.toString());
275
- },
276
-
277
- _applyModification: function (fn, args) {
278
- var color = fn.apply(null, [this].concat([].slice.call(args)));
279
- this._r = color._r;
280
- this._g = color._g;
281
- this._b = color._b;
282
- this.setAlpha(color._a);
283
- return this;
284
- },
285
- lighten: function () {
286
- return this._applyModification(lighten, arguments);
287
- },
288
- brighten: function () {
289
- return this._applyModification(brighten, arguments);
290
- },
291
- darken: function () {
292
- return this._applyModification(darken, arguments);
293
- },
294
- desaturate: function () {
295
- return this._applyModification(desaturate, arguments);
296
- },
297
- saturate: function () {
298
- return this._applyModification(saturate, arguments);
299
- },
300
- greyscale: function () {
301
- return this._applyModification(greyscale, arguments);
302
- },
303
- spin: function () {
304
- return this._applyModification(spin, arguments);
305
- },
306
-
307
- _applyCombination: function (fn, args) {
308
- return fn.apply(null, [this].concat([].slice.call(args)));
309
- },
310
- analogous: function () {
311
- return this._applyCombination(analogous, arguments);
312
- },
313
- complement: function () {
314
- return this._applyCombination(complement, arguments);
315
- },
316
- monochromatic: function () {
317
- return this._applyCombination(monochromatic, arguments);
318
- },
319
- splitcomplement: function () {
320
- return this._applyCombination(splitcomplement, arguments);
321
- },
322
- triad: function () {
323
- return this._applyCombination(triad, arguments);
324
- },
325
- tetrad: function () {
326
- return this._applyCombination(tetrad, arguments);
327
- }
328
- };
329
-
330
- // If input is an object, force 1 into "1.0" to handle ratios properly
331
- // String input requires "1.0" as input, so 1 will be treated as 1
332
- tinycolor.fromRatio = function (color, opts) {
333
- if (typeof color == 'object') {
334
- var newColor = {};
335
- for (var i in color) {
336
- if (color.hasOwnProperty(i)) {
337
- if (i === 'a') {
338
- newColor[i] = color[i];
339
- } else {
340
- newColor[i] = convertToPercentage(color[i]);
341
- }
342
- }
343
- }
344
- color = newColor;
345
- }
346
-
347
- return tinycolor(color, opts);
348
- };
349
-
350
- // Given a string or object, convert that input to RGB
351
- // Possible string inputs:
352
- //
353
- // "red"
354
- // "#f00" or "f00"
355
- // "#ff0000" or "ff0000"
356
- // "#ff000000" or "ff000000"
357
- // "rgb 255 0 0" or "rgb (255, 0, 0)"
358
- // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
359
- // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
360
- // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
361
- // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
362
- // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
363
- // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
364
- //
365
- function inputToRGB(color) {
366
- var rgb = { r: 0, g: 0, b: 0 };
367
- var a = 1;
368
- var s = null;
369
- var v = null;
370
- var l = null;
371
- var ok = false;
372
- var format = false;
373
-
374
- if (typeof color == 'string') {
375
- color = stringInputToObject(color);
376
- }
377
-
378
- if (typeof color == 'object') {
379
- if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
380
- rgb = rgbToRgb(color.r, color.g, color.b);
381
- ok = true;
382
- format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
383
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
384
- s = convertToPercentage(color.s);
385
- v = convertToPercentage(color.v);
386
- rgb = hsvToRgb(color.h, s, v);
387
- ok = true;
388
- format = 'hsv';
389
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
390
- s = convertToPercentage(color.s);
391
- l = convertToPercentage(color.l);
392
- rgb = hslToRgb(color.h, s, l);
393
- ok = true;
394
- format = 'hsl';
395
- }
396
-
397
- if (color.hasOwnProperty('a')) {
398
- a = color.a;
399
- }
400
- }
401
-
402
- a = boundAlpha(a);
403
-
404
- return {
405
- ok: ok,
406
- format: color.format || format,
407
- r: mathMin(255, mathMax(rgb.r, 0)),
408
- g: mathMin(255, mathMax(rgb.g, 0)),
409
- b: mathMin(255, mathMax(rgb.b, 0)),
410
- a: a
411
- };
412
- }
413
-
414
- // Conversion Functions
415
- // --------------------
416
-
417
- // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
418
- // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
419
-
420
- // `rgbToRgb`
421
- // Handle bounds / percentage checking to conform to CSS color spec
422
- // <http://www.w3.org/TR/css3-color/>
423
- // *Assumes:* r, g, b in [0, 255] or [0, 1]
424
- // *Returns:* { r, g, b } in [0, 255]
425
- function rgbToRgb(r, g, b) {
426
- return {
427
- r: bound01(r, 255) * 255,
428
- g: bound01(g, 255) * 255,
429
- b: bound01(b, 255) * 255
430
- };
431
- }
432
-
433
- // `rgbToHsl`
434
- // Converts an RGB color value to HSL.
435
- // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
436
- // *Returns:* { h, s, l } in [0,1]
437
- function rgbToHsl(r, g, b) {
438
- r = bound01(r, 255);
439
- g = bound01(g, 255);
440
- b = bound01(b, 255);
441
-
442
- var max = mathMax(r, g, b),
443
- min = mathMin(r, g, b);
444
- var h,
445
- s,
446
- l = (max + min) / 2;
447
-
448
- if (max == min) {
449
- h = s = 0; // achromatic
450
- } else {
451
- var d = max - min;
452
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
453
- switch (max) {
454
- case r:
455
- h = (g - b) / d + (g < b ? 6 : 0);
456
- break;
457
- case g:
458
- h = (b - r) / d + 2;
459
- break;
460
- case b:
461
- h = (r - g) / d + 4;
462
- break;
463
- }
464
-
465
- h /= 6;
466
- }
467
-
468
- return { h: h, s: s, l: l };
469
- }
470
-
471
- // `hslToRgb`
472
- // Converts an HSL color value to RGB.
473
- // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
474
- // *Returns:* { r, g, b } in the set [0, 255]
475
- function hslToRgb(h, s, l) {
476
- var r, g, b;
477
-
478
- h = bound01(h, 360);
479
- s = bound01(s, 100);
480
- l = bound01(l, 100);
481
-
482
- function hue2rgb(p, q, t) {
483
- if (t < 0) t += 1;
484
- if (t > 1) t -= 1;
485
- if (t < 1 / 6) return p + (q - p) * 6 * t;
486
- if (t < 1 / 2) return q;
487
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
488
- return p;
489
- }
490
-
491
- if (s === 0) {
492
- r = g = b = l; // achromatic
493
- } else {
494
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
495
- var p = 2 * l - q;
496
- r = hue2rgb(p, q, h + 1 / 3);
497
- g = hue2rgb(p, q, h);
498
- b = hue2rgb(p, q, h - 1 / 3);
499
- }
500
-
501
- return { r: r * 255, g: g * 255, b: b * 255 };
502
- }
503
-
504
- // `rgbToHsv`
505
- // Converts an RGB color value to HSV
506
- // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
507
- // *Returns:* { h, s, v } in [0,1]
508
- function rgbToHsv(r, g, b) {
509
- r = bound01(r, 255);
510
- g = bound01(g, 255);
511
- b = bound01(b, 255);
512
-
513
- var max = mathMax(r, g, b),
514
- min = mathMin(r, g, b);
515
- var h,
516
- s,
517
- v = max;
518
-
519
- var d = max - min;
520
- s = max === 0 ? 0 : d / max;
521
-
522
- if (max == min) {
523
- h = 0; // achromatic
524
- } else {
525
- switch (max) {
526
- case r:
527
- h = (g - b) / d + (g < b ? 6 : 0);
528
- break;
529
- case g:
530
- h = (b - r) / d + 2;
531
- break;
532
- case b:
533
- h = (r - g) / d + 4;
534
- break;
535
- }
536
- h /= 6;
537
- }
538
- return { h: h, s: s, v: v };
539
- }
540
-
541
- // `hsvToRgb`
542
- // Converts an HSV color value to RGB.
543
- // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
544
- // *Returns:* { r, g, b } in the set [0, 255]
545
- function hsvToRgb(h, s, v) {
546
- h = bound01(h, 360) * 6;
547
- s = bound01(s, 100);
548
- v = bound01(v, 100);
549
-
550
- var i = Math.floor(h),
551
- f = h - i,
552
- p = v * (1 - s),
553
- q = v * (1 - f * s),
554
- t = v * (1 - (1 - f) * s),
555
- mod = i % 6,
556
- r = [v, q, p, p, t, v][mod],
557
- g = [t, v, v, q, p, p][mod],
558
- b = [p, p, t, v, v, q][mod];
559
-
560
- return { r: r * 255, g: g * 255, b: b * 255 };
561
- }
562
-
563
- // `rgbToHex`
564
- // Converts an RGB color to hex
565
- // Assumes r, g, and b are contained in the set [0, 255]
566
- // Returns a 3 or 6 character hex
567
- function rgbToHex(r, g, b, allow3Char) {
568
- var hex = [
569
- pad2(mathRound(r).toString(16)),
570
- pad2(mathRound(g).toString(16)),
571
- pad2(mathRound(b).toString(16))
572
- ];
573
-
574
- // Return a 3 character hex if possible
575
- if (
576
- allow3Char &&
577
- hex[0].charAt(0) == hex[0].charAt(1) &&
578
- hex[1].charAt(0) == hex[1].charAt(1) &&
579
- hex[2].charAt(0) == hex[2].charAt(1)
580
- ) {
581
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
582
- }
583
-
584
- return hex.join('');
585
- }
586
-
587
- // `rgbaToHex`
588
- // Converts an RGBA color plus alpha transparency to hex
589
- // Assumes r, g, b are contained in the set [0, 255] and
590
- // a in [0, 1]. Returns a 4 or 8 character rgba hex
591
- function rgbaToHex(r, g, b, a, allow4Char) {
592
- var hex = [
593
- pad2(mathRound(r).toString(16)),
594
- pad2(mathRound(g).toString(16)),
595
- pad2(mathRound(b).toString(16)),
596
- pad2(convertDecimalToHex(a))
597
- ];
598
-
599
- // Return a 4 character hex if possible
600
- if (
601
- allow4Char &&
602
- hex[0].charAt(0) == hex[0].charAt(1) &&
603
- hex[1].charAt(0) == hex[1].charAt(1) &&
604
- hex[2].charAt(0) == hex[2].charAt(1) &&
605
- hex[3].charAt(0) == hex[3].charAt(1)
606
- ) {
607
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
608
- }
609
-
610
- return hex.join('');
611
- }
612
-
613
- // `rgbaToArgbHex`
614
- // Converts an RGBA color to an ARGB Hex8 string
615
- // Rarely used, but required for "toFilter()"
616
- function rgbaToArgbHex(r, g, b, a) {
617
- var hex = [
618
- pad2(convertDecimalToHex(a)),
619
- pad2(mathRound(r).toString(16)),
620
- pad2(mathRound(g).toString(16)),
621
- pad2(mathRound(b).toString(16))
622
- ];
623
-
624
- return hex.join('');
625
- }
626
-
627
- // `equals`
628
- // Can be called with any tinycolor input
629
- tinycolor.equals = function (color1, color2) {
630
- if (!color1 || !color2) {
631
- return false;
632
- }
633
- return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
634
- };
635
-
636
- tinycolor.random = function () {
637
- return tinycolor.fromRatio({
638
- r: mathRandom(),
639
- g: mathRandom(),
640
- b: mathRandom()
641
- });
642
- };
643
-
644
- // Modification Functions
645
- // ----------------------
646
- // Thanks to less.js for some of the basics here
647
- // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
648
-
649
- function desaturate(color, amount) {
650
- amount = amount === 0 ? 0 : amount || 10;
651
- var hsl = tinycolor(color).toHsl();
652
- hsl.s -= amount / 100;
653
- hsl.s = clamp01(hsl.s);
654
- return tinycolor(hsl);
655
- }
656
-
657
- function saturate(color, amount) {
658
- amount = amount === 0 ? 0 : amount || 10;
659
- var hsl = tinycolor(color).toHsl();
660
- hsl.s += amount / 100;
661
- hsl.s = clamp01(hsl.s);
662
- return tinycolor(hsl);
663
- }
664
-
665
- function greyscale(color) {
666
- return tinycolor(color).desaturate(100);
667
- }
668
-
669
- function lighten(color, amount) {
670
- amount = amount === 0 ? 0 : amount || 10;
671
- var hsl = tinycolor(color).toHsl();
672
- hsl.l += amount / 100;
673
- hsl.l = clamp01(hsl.l);
674
- return tinycolor(hsl);
675
- }
676
-
677
- function brighten(color, amount) {
678
- amount = amount === 0 ? 0 : amount || 10;
679
- var rgb = tinycolor(color).toRgb();
680
- rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * -(amount / 100))));
681
- rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * -(amount / 100))));
682
- rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * -(amount / 100))));
683
- return tinycolor(rgb);
684
- }
685
-
686
- function darken(color, amount) {
687
- amount = amount === 0 ? 0 : amount || 10;
688
- var hsl = tinycolor(color).toHsl();
689
- hsl.l -= amount / 100;
690
- hsl.l = clamp01(hsl.l);
691
- return tinycolor(hsl);
692
- }
693
-
694
- // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
695
- // Values outside of this range will be wrapped into this range.
696
- function spin(color, amount) {
697
- var hsl = tinycolor(color).toHsl();
698
- var hue = (hsl.h + amount) % 360;
699
- hsl.h = hue < 0 ? 360 + hue : hue;
700
- return tinycolor(hsl);
701
- }
702
-
703
- // Combination Functions
704
- // ---------------------
705
- // Thanks to jQuery xColor for some of the ideas behind these
706
- // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
707
-
708
- function complement(color) {
709
- var hsl = tinycolor(color).toHsl();
710
- hsl.h = (hsl.h + 180) % 360;
711
- return tinycolor(hsl);
712
- }
713
-
714
- function triad(color) {
715
- var hsl = tinycolor(color).toHsl();
716
- var h = hsl.h;
717
- return [
718
- tinycolor(color),
719
- tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
720
- tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
721
- ];
722
- }
723
-
724
- function tetrad(color) {
725
- var hsl = tinycolor(color).toHsl();
726
- var h = hsl.h;
727
- return [
728
- tinycolor(color),
729
- tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
730
- tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
731
- tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
732
- ];
733
- }
734
-
735
- function splitcomplement(color) {
736
- var hsl = tinycolor(color).toHsl();
737
- var h = hsl.h;
738
- return [
739
- tinycolor(color),
740
- tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
741
- tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
742
- ];
743
- }
744
-
745
- function analogous(color, results, slices) {
746
- results = results || 6;
747
- slices = slices || 30;
748
-
749
- var hsl = tinycolor(color).toHsl();
750
- var part = 360 / slices;
751
- var ret = [tinycolor(color)];
752
-
753
- for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results; ) {
754
- hsl.h = (hsl.h + part) % 360;
755
- ret.push(tinycolor(hsl));
756
- }
757
- return ret;
758
- }
759
-
760
- function monochromatic(color, results) {
761
- results = results || 6;
762
- var hsv = tinycolor(color).toHsv();
763
- var h = hsv.h,
764
- s = hsv.s,
765
- v = hsv.v;
766
- var ret = [];
767
- var modification = 1 / results;
768
-
769
- while (results--) {
770
- ret.push(tinycolor({ h: h, s: s, v: v }));
771
- v = (v + modification) % 1;
772
- }
773
-
774
- return ret;
775
- }
776
-
777
- // Utility Functions
778
- // ---------------------
779
-
780
- tinycolor.mix = function (color1, color2, amount) {
781
- amount = amount === 0 ? 0 : amount || 50;
782
-
783
- var rgb1 = tinycolor(color1).toRgb();
784
- var rgb2 = tinycolor(color2).toRgb();
785
-
786
- var p = amount / 100;
787
-
788
- var rgba = {
789
- r: (rgb2.r - rgb1.r) * p + rgb1.r,
790
- g: (rgb2.g - rgb1.g) * p + rgb1.g,
791
- b: (rgb2.b - rgb1.b) * p + rgb1.b,
792
- a: (rgb2.a - rgb1.a) * p + rgb1.a
793
- };
794
-
795
- return tinycolor(rgba);
796
- };
797
-
798
- // Readability Functions
799
- // ---------------------
800
- // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
801
-
802
- // `contrast`
803
- // Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
804
- tinycolor.readability = function (color1, color2) {
805
- var c1 = tinycolor(color1);
806
- var c2 = tinycolor(color2);
807
- return (
808
- (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) /
809
- (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05)
810
- );
811
- };
812
-
813
- // `isReadable`
814
- // Ensure that foreground and background color combinations meet WCAG2 guidelines.
815
- // The third argument is an optional Object.
816
- // the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
817
- // the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
818
- // If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
819
-
820
- // *Example*
821
- // tinycolor.isReadable("#000", "#111") => false
822
- // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
823
- tinycolor.isReadable = function (color1, color2, wcag2) {
824
- var readability = tinycolor.readability(color1, color2);
825
- var wcag2Parms, out;
826
-
827
- out = false;
828
-
829
- wcag2Parms = validateWCAG2Parms(wcag2);
830
- switch (wcag2Parms.level + wcag2Parms.size) {
831
- case 'AAsmall':
832
- case 'AAAlarge':
833
- out = readability >= 4.5;
834
- break;
835
- case 'AAlarge':
836
- out = readability >= 3;
837
- break;
838
- case 'AAAsmall':
839
- out = readability >= 7;
840
- break;
841
- }
842
- return out;
843
- };
844
-
845
- // `mostReadable`
846
- // Given a base color and a list of possible foreground or background
847
- // colors for that base, returns the most readable color.
848
- // Optionally returns Black or White if the most readable color is unreadable.
849
- // *Example*
850
- // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
851
- // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
852
- // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
853
- // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
854
- tinycolor.mostReadable = function (baseColor, colorList, args) {
855
- var bestColor = null;
856
- var bestScore = 0;
857
- var readability;
858
- var includeFallbackColors, level, size;
859
- args = args || {};
860
- includeFallbackColors = args.includeFallbackColors;
861
- level = args.level;
862
- size = args.size;
863
-
864
- for (var i = 0; i < colorList.length; i++) {
865
- readability = tinycolor.readability(baseColor, colorList[i]);
866
- if (readability > bestScore) {
867
- bestScore = readability;
868
- bestColor = tinycolor(colorList[i]);
869
- }
870
- }
871
-
872
- if (
873
- tinycolor.isReadable(baseColor, bestColor, { level: level, size: size }) ||
874
- !includeFallbackColors
875
- ) {
876
- return bestColor;
877
- } else {
878
- args.includeFallbackColors = false;
879
- return tinycolor.mostReadable(baseColor, ['#fff', '#000'], args);
880
- }
881
- };
882
-
883
- // Big List of Colors
884
- // ------------------
885
- // <http://www.w3.org/TR/css3-color/#svg-color>
886
- var names = (tinycolor.names = {
887
- aliceblue: 'f0f8ff',
888
- antiquewhite: 'faebd7',
889
- aqua: '0ff',
890
- aquamarine: '7fffd4',
891
- azure: 'f0ffff',
892
- beige: 'f5f5dc',
893
- bisque: 'ffe4c4',
894
- black: '000',
895
- blanchedalmond: 'ffebcd',
896
- blue: '00f',
897
- blueviolet: '8a2be2',
898
- brown: 'a52a2a',
899
- burlywood: 'deb887',
900
- burntsienna: 'ea7e5d',
901
- cadetblue: '5f9ea0',
902
- chartreuse: '7fff00',
903
- chocolate: 'd2691e',
904
- coral: 'ff7f50',
905
- cornflowerblue: '6495ed',
906
- cornsilk: 'fff8dc',
907
- crimson: 'dc143c',
908
- cyan: '0ff',
909
- darkblue: '00008b',
910
- darkcyan: '008b8b',
911
- darkgoldenrod: 'b8860b',
912
- darkgray: 'a9a9a9',
913
- darkgreen: '006400',
914
- darkgrey: 'a9a9a9',
915
- darkkhaki: 'bdb76b',
916
- darkmagenta: '8b008b',
917
- darkolivegreen: '556b2f',
918
- darkorange: 'ff8c00',
919
- darkorchid: '9932cc',
920
- darkred: '8b0000',
921
- darksalmon: 'e9967a',
922
- darkseagreen: '8fbc8f',
923
- darkslateblue: '483d8b',
924
- darkslategray: '2f4f4f',
925
- darkslategrey: '2f4f4f',
926
- darkturquoise: '00ced1',
927
- darkviolet: '9400d3',
928
- deeppink: 'ff1493',
929
- deepskyblue: '00bfff',
930
- dimgray: '696969',
931
- dimgrey: '696969',
932
- dodgerblue: '1e90ff',
933
- firebrick: 'b22222',
934
- floralwhite: 'fffaf0',
935
- forestgreen: '228b22',
936
- fuchsia: 'f0f',
937
- gainsboro: 'dcdcdc',
938
- ghostwhite: 'f8f8ff',
939
- gold: 'ffd700',
940
- goldenrod: 'daa520',
941
- gray: '808080',
942
- green: '008000',
943
- greenyellow: 'adff2f',
944
- grey: '808080',
945
- honeydew: 'f0fff0',
946
- hotpink: 'ff69b4',
947
- indianred: 'cd5c5c',
948
- indigo: '4b0082',
949
- ivory: 'fffff0',
950
- khaki: 'f0e68c',
951
- lavender: 'e6e6fa',
952
- lavenderblush: 'fff0f5',
953
- lawngreen: '7cfc00',
954
- lemonchiffon: 'fffacd',
955
- lightblue: 'add8e6',
956
- lightcoral: 'f08080',
957
- lightcyan: 'e0ffff',
958
- lightgoldenrodyellow: 'fafad2',
959
- lightgray: 'd3d3d3',
960
- lightgreen: '90ee90',
961
- lightgrey: 'd3d3d3',
962
- lightpink: 'ffb6c1',
963
- lightsalmon: 'ffa07a',
964
- lightseagreen: '20b2aa',
965
- lightskyblue: '87cefa',
966
- lightslategray: '789',
967
- lightslategrey: '789',
968
- lightsteelblue: 'b0c4de',
969
- lightyellow: 'ffffe0',
970
- lime: '0f0',
971
- limegreen: '32cd32',
972
- linen: 'faf0e6',
973
- magenta: 'f0f',
974
- maroon: '800000',
975
- mediumaquamarine: '66cdaa',
976
- mediumblue: '0000cd',
977
- mediumorchid: 'ba55d3',
978
- mediumpurple: '9370db',
979
- mediumseagreen: '3cb371',
980
- mediumslateblue: '7b68ee',
981
- mediumspringgreen: '00fa9a',
982
- mediumturquoise: '48d1cc',
983
- mediumvioletred: 'c71585',
984
- midnightblue: '191970',
985
- mintcream: 'f5fffa',
986
- mistyrose: 'ffe4e1',
987
- moccasin: 'ffe4b5',
988
- navajowhite: 'ffdead',
989
- navy: '000080',
990
- oldlace: 'fdf5e6',
991
- olive: '808000',
992
- olivedrab: '6b8e23',
993
- orange: 'ffa500',
994
- orangered: 'ff4500',
995
- orchid: 'da70d6',
996
- palegoldenrod: 'eee8aa',
997
- palegreen: '98fb98',
998
- paleturquoise: 'afeeee',
999
- palevioletred: 'db7093',
1000
- papayawhip: 'ffefd5',
1001
- peachpuff: 'ffdab9',
1002
- peru: 'cd853f',
1003
- pink: 'ffc0cb',
1004
- plum: 'dda0dd',
1005
- powderblue: 'b0e0e6',
1006
- purple: '800080',
1007
- rebeccapurple: '663399',
1008
- red: 'f00',
1009
- rosybrown: 'bc8f8f',
1010
- royalblue: '4169e1',
1011
- saddlebrown: '8b4513',
1012
- salmon: 'fa8072',
1013
- sandybrown: 'f4a460',
1014
- seagreen: '2e8b57',
1015
- seashell: 'fff5ee',
1016
- sienna: 'a0522d',
1017
- silver: 'c0c0c0',
1018
- skyblue: '87ceeb',
1019
- slateblue: '6a5acd',
1020
- slategray: '708090',
1021
- slategrey: '708090',
1022
- snow: 'fffafa',
1023
- springgreen: '00ff7f',
1024
- steelblue: '4682b4',
1025
- tan: 'd2b48c',
1026
- teal: '008080',
1027
- thistle: 'd8bfd8',
1028
- tomato: 'ff6347',
1029
- turquoise: '40e0d0',
1030
- violet: 'ee82ee',
1031
- wheat: 'f5deb3',
1032
- white: 'fff',
1033
- whitesmoke: 'f5f5f5',
1034
- yellow: 'ff0',
1035
- yellowgreen: '9acd32'
1036
- });
1037
-
1038
- // Make it easy to access colors via `hexNames[hex]`
1039
- var hexNames = (tinycolor.hexNames = flip(names));
1040
-
1041
- // Utilities
1042
- // ---------
1043
-
1044
- // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
1045
- function flip(o) {
1046
- var flipped = {};
1047
- for (var i in o) {
1048
- if (o.hasOwnProperty(i)) {
1049
- flipped[o[i]] = i;
1050
- }
1051
- }
1052
- return flipped;
1053
- }
1054
-
1055
- // Return a valid alpha value [0,1] with all invalid values being set to 1
1056
- function boundAlpha(a) {
1057
- a = parseFloat(a);
1058
-
1059
- if (isNaN(a) || a < 0 || a > 1) {
1060
- a = 1;
1061
- }
1062
-
1063
- return a;
1064
- }
1065
-
1066
- // Take input from [0, n] and return it as [0, 1]
1067
- function bound01(n, max) {
1068
- if (isOnePointZero(n)) {
1069
- n = '100%';
1070
- }
1071
-
1072
- var processPercent = isPercentage(n);
1073
- n = mathMin(max, mathMax(0, parseFloat(n)));
1074
-
1075
- // Automatically convert percentage into number
1076
- if (processPercent) {
1077
- n = parseInt(n * max, 10) / 100;
1078
- }
1079
-
1080
- // Handle floating point rounding errors
1081
- if (Math.abs(n - max) < 0.000001) {
1082
- return 1;
1083
- }
1084
-
1085
- // Convert into [0, 1] range if it isn't already
1086
- return (n % max) / parseFloat(max);
1087
- }
1088
-
1089
- // Force a number between 0 and 1
1090
- function clamp01(val) {
1091
- return mathMin(1, mathMax(0, val));
1092
- }
1093
-
1094
- // Parse a base-16 hex value into a base-10 integer
1095
- function parseIntFromHex(val) {
1096
- return parseInt(val, 16);
1097
- }
1098
-
1099
- // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
1100
- // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
1101
- function isOnePointZero(n) {
1102
- return typeof n == 'string' && n.indexOf('.') != -1 && parseFloat(n) === 1;
1103
- }
1104
-
1105
- // Check to see if string passed in is a percentage
1106
- function isPercentage(n) {
1107
- return typeof n === 'string' && n.indexOf('%') != -1;
1108
- }
1109
-
1110
- // Force a hex value to have 2 characters
1111
- function pad2(c) {
1112
- return c.length == 1 ? '0' + c : '' + c;
1113
- }
1114
-
1115
- // Replace a decimal with it's percentage value
1116
- function convertToPercentage(n) {
1117
- if (n <= 1) {
1118
- n = n * 100 + '%';
1119
- }
1120
-
1121
- return n;
1122
- }
1123
-
1124
- // Converts a decimal to a hex value
1125
- function convertDecimalToHex(d) {
1126
- return Math.round(parseFloat(d) * 255).toString(16);
1127
- }
1128
- // Converts a hex value to a decimal
1129
- function convertHexToDecimal(h) {
1130
- return parseIntFromHex(h) / 255;
1131
- }
1132
-
1133
- var matchers = (function () {
1134
- // <http://www.w3.org/TR/css3-values/#integers>
1135
- var CSS_INTEGER = '[-\\+]?\\d+%?';
1136
-
1137
- // <http://www.w3.org/TR/css3-values/#number-value>
1138
- var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
1139
-
1140
- // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
1141
- var CSS_UNIT = '(?:' + CSS_NUMBER + ')|(?:' + CSS_INTEGER + ')';
1142
-
1143
- // Actual matching.
1144
- // Parentheses and commas are optional, but not required.
1145
- // Whitespace can take the place of commas or opening paren
1146
- var PERMISSIVE_MATCH3 =
1147
- '[\\s|\\(]+(' + CSS_UNIT + ')[,|\\s]+(' + CSS_UNIT + ')[,|\\s]+(' + CSS_UNIT + ')\\s*\\)?';
1148
- var PERMISSIVE_MATCH4 =
1149
- '[\\s|\\(]+(' +
1150
- CSS_UNIT +
1151
- ')[,|\\s]+(' +
1152
- CSS_UNIT +
1153
- ')[,|\\s]+(' +
1154
- CSS_UNIT +
1155
- ')[,|\\s]+(' +
1156
- CSS_UNIT +
1157
- ')\\s*\\)?';
1158
-
1159
- return {
1160
- CSS_UNIT: new RegExp(CSS_UNIT),
1161
- rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
1162
- rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
1163
- hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
1164
- hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
1165
- hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
1166
- hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
1167
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1168
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
1169
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1170
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
1171
- };
1172
- })();
1173
-
1174
- // `isValidCSSUnit`
1175
- // Take in a single string / number and check to see if it looks like a CSS unit
1176
- // (see `matchers` above for definition).
1177
- function isValidCSSUnit(color) {
1178
- return !!matchers.CSS_UNIT.exec(color);
1179
- }
1180
-
1181
- // `stringInputToObject`
1182
- // Permissive string parsing. Take in a number of formats, and output an object
1183
- // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
1184
- function stringInputToObject(color) {
1185
- color = color.replace(trimLeft, '').replace(trimRight, '').toLowerCase();
1186
- var named = false;
1187
- if (names[color]) {
1188
- color = names[color];
1189
- named = true;
1190
- } else if (color == 'transparent') {
1191
- return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
1192
- }
1193
-
1194
- // Try to match string input using regular expressions.
1195
- // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
1196
- // Just return an object and let the conversion functions handle that.
1197
- // This way the result will be the same whether the tinycolor is initialized with string or object.
1198
- var match;
1199
- if ((match = matchers.rgb.exec(color))) {
1200
- return { r: match[1], g: match[2], b: match[3] };
1201
- }
1202
- if ((match = matchers.rgba.exec(color))) {
1203
- return { r: match[1], g: match[2], b: match[3], a: match[4] };
1204
- }
1205
- if ((match = matchers.hsl.exec(color))) {
1206
- return { h: match[1], s: match[2], l: match[3] };
1207
- }
1208
- if ((match = matchers.hsla.exec(color))) {
1209
- return { h: match[1], s: match[2], l: match[3], a: match[4] };
1210
- }
1211
- if ((match = matchers.hsv.exec(color))) {
1212
- return { h: match[1], s: match[2], v: match[3] };
1213
- }
1214
- if ((match = matchers.hsva.exec(color))) {
1215
- return { h: match[1], s: match[2], v: match[3], a: match[4] };
1216
- }
1217
- if ((match = matchers.hex8.exec(color))) {
1218
- return {
1219
- r: parseIntFromHex(match[1]),
1220
- g: parseIntFromHex(match[2]),
1221
- b: parseIntFromHex(match[3]),
1222
- a: convertHexToDecimal(match[4]),
1223
- format: named ? 'name' : 'hex8'
1224
- };
1225
- }
1226
- if ((match = matchers.hex6.exec(color))) {
1227
- return {
1228
- r: parseIntFromHex(match[1]),
1229
- g: parseIntFromHex(match[2]),
1230
- b: parseIntFromHex(match[3]),
1231
- format: named ? 'name' : 'hex'
1232
- };
1233
- }
1234
- if ((match = matchers.hex4.exec(color))) {
1235
- return {
1236
- r: parseIntFromHex(match[1] + '' + match[1]),
1237
- g: parseIntFromHex(match[2] + '' + match[2]),
1238
- b: parseIntFromHex(match[3] + '' + match[3]),
1239
- a: convertHexToDecimal(match[4] + '' + match[4]),
1240
- format: named ? 'name' : 'hex8'
1241
- };
1242
- }
1243
- if ((match = matchers.hex3.exec(color))) {
1244
- return {
1245
- r: parseIntFromHex(match[1] + '' + match[1]),
1246
- g: parseIntFromHex(match[2] + '' + match[2]),
1247
- b: parseIntFromHex(match[3] + '' + match[3]),
1248
- format: named ? 'name' : 'hex'
1249
- };
1250
- }
1251
-
1252
- return false;
1253
- }
1254
-
1255
- function validateWCAG2Parms(parms) {
1256
- // return valid WCAG2 parms for isReadable.
1257
- // If input parms are invalid, return {"level":"AA", "size":"small"}
1258
- var level, size;
1259
- parms = parms || { level: 'AA', size: 'small' };
1260
- level = (parms.level || 'AA').toUpperCase();
1261
- size = (parms.size || 'small').toLowerCase();
1262
- if (level !== 'AA' && level !== 'AAA') {
1263
- level = 'AA';
1264
- }
1265
- if (size !== 'small' && size !== 'large') {
1266
- size = 'small';
1267
- }
1268
- return { level: level, size: size };
1269
- }
1270
-
1271
- return tinycolor;
1272
- })(Math);
1273
-
1274
- // Primary color number.
1275
- var PRIMARY_INDEX = 5;
1276
- var HUE_MAX = 360;
1277
- var SATURATION_MIN = 5;
1278
- var SATURATION_MAX = 100;
1279
- var BRIGHTNESS_MIN = 20;
1280
- var BRIGHTNESS_MAX = 100;
1281
-
1282
- var COLOR_NUMBER_SET = ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900'];
1283
-
1284
- function calculateHue(originalHue, index) {
1285
- originalHue = Math.round(originalHue) || 360;
1286
- // Dark color increase , light color reduction
1287
- const step = index - PRIMARY_INDEX;
1288
- const gap = 1;
1289
- const hue = originalHue + step * gap;
1290
-
1291
- // The value of hue is [0,360).
1292
- // If it is greater than 360, the absolute value of the difference is taken.
1293
- return hue >= HUE_MAX ? Math.abs(hue - HUE_MAX) : hue;
1294
- }
1295
-
1296
- function calculateSaturation(originalSaturation, index) {
1297
- originalSaturation = Math.round(originalSaturation * 100);
1298
- // Dark color increase , light color reduction
1299
- const step = index - PRIMARY_INDEX;
1300
- const gap = Math.round(
1301
- (step > 0 && (100 - originalSaturation) / 4) ||
1302
- (originalSaturation > SATURATION_MIN && (originalSaturation - 5) / 5) ||
1303
- 1
1304
- );
1305
- const saturation = originalSaturation + step * gap;
1306
- return (
1307
- // The value range of saturation is [5,100]
1308
- ((saturation < SATURATION_MIN && SATURATION_MIN) ||
1309
- (saturation > SATURATION_MAX && SATURATION_MAX) ||
1310
- saturation) / 100
1311
- );
1312
- }
1313
-
1314
- function calculateBrightnessAdjustValue(brightness, step) {
1315
- if (step < 0) {
1316
- if (brightness > 40) {
1317
- // BasicGap rounded up to avoid a situation of 0.
1318
- let basicGap = Math.ceil((brightness - 40) / 4 / 4);
1319
- const levels = Math.abs(step);
1320
- // Less than 40, the brightness is smaller.
1321
- // n is a multiple of the reduction base (increased by the arithmetic progression)
1322
- const n = ((1 + levels) * levels) / 2;
1323
- return -1 * basicGap * n;
1324
- }
1325
- return Math.round(step * ((brightness - 20) / 4));
1326
- }
1327
- return Math.round(step * ((100 - brightness) / 5));
1328
- }
1329
-
1330
- function calculateBrightness(originalBrightness, index) {
1331
- originalBrightness = Math.round(originalBrightness * 100);
1332
- // Light color reduction , dark color increase.
1333
- const step = PRIMARY_INDEX - index;
1334
- // When originalBrightness is less than 20, no adjustment.
1335
- if (step < 0 && originalBrightness < BRIGHTNESS_MIN) {
1336
- return originalBrightness / 100;
1337
- }
1338
- const adjustValue = calculateBrightnessAdjustValue(originalBrightness, step);
1339
- const brightness = originalBrightness + adjustValue;
1340
- return (
1341
- // The range of brightness is [20,100]
1342
- ((brightness < BRIGHTNESS_MIN && BRIGHTNESS_MIN) ||
1343
- (brightness > BRIGHTNESS_MAX && BRIGHTNESS_MAX) ||
1344
- brightness) / 100
1345
- );
1346
- }
1347
-
1348
- function generatePalette(colorStr, name) {
1349
- const { _r, _g, _b, _a } = tinycolor(colorStr);
1350
- const color = {
1351
- rgb: [_r, _g, _b],
1352
- alpha: _a
1353
- };
1354
-
1355
- return COLOR_NUMBER_SET.map((level, index) => {
1356
- const {
1357
- rgb: [r, g, b],
1358
- alpha: a
1359
- } = color;
1360
-
1361
- const hsv = tinycolor({ r, g, b, a }).toHsv();
1362
- const tiny = tinycolor({
1363
- h: calculateHue(hsv.h, index),
1364
- s: calculateSaturation(hsv.s, index),
1365
- v: calculateBrightness(hsv.v, index)
1366
- });
1367
-
1368
- return {
1369
- level,
1370
- hex: tiny.toHexString(),
1371
- rgb: tiny.toRgbString(),
1372
- hls: tiny.toHslString(),
1373
- cssVar: `--rs-${name}-${level}`
1374
- };
1375
- });
1376
- }
1377
-
1378
- module.exports = {
1379
- tinycolor,
1380
- generatePalette,
1381
- install: function (less, pluginManager, functions) {
1382
- /**
1383
- * Calculate color
1384
- * @param color
1385
- * @param colorNumber
1386
- */
1387
- functions.add('palette', function (color, colorNumber) {
1388
- const {
1389
- rgb: [r, g, b],
1390
- alpha: a
1391
- } = color;
1392
-
1393
- const hsv = tinycolor({ r, g, b, a }).toHsv();
1394
- const index = COLOR_NUMBER_SET.indexOf('' + colorNumber.value);
1395
- if (index === -1 || index === PRIMARY_INDEX) {
1396
- return less.color(color.rgb);
1397
- }
1398
- return less.color(
1399
- tinycolor({
1400
- h: calculateHue(hsv.h, index),
1401
- s: calculateSaturation(hsv.s, index),
1402
- v: calculateBrightness(hsv.v, index)
1403
- }).toHex()
1404
- );
1405
- });
1406
- }
1407
- };