pentatrion-design 0.0.12 → 0.0.13

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 (505) hide show
  1. package/README.md +2 -2
  2. package/components/autocomplete/Autocomplete.d.ts +44 -0
  3. package/components/autocomplete/Autocomplete.js +132 -0
  4. package/components/autocomplete/AutocompleteOption.d.ts +5 -0
  5. package/components/autocomplete/AutocompleteOption.js +18 -0
  6. package/components/autocomplete/LazyAutocomplete.d.ts +8 -0
  7. package/components/autocomplete/LazyAutocomplete.js +71 -0
  8. package/components/autocomplete/SimpleAutocomplete.d.ts +6 -0
  9. package/components/autocomplete/SimpleAutocomplete.js +35 -0
  10. package/components/autocomplete/_fixtures.d.ts +2 -0
  11. package/components/autocomplete/_fixtures.js +25 -0
  12. package/components/autocomplete/index.js +6 -0
  13. package/components/autocomplete/useAutocompleteContext.d.ts +11 -0
  14. package/components/autocomplete/useAutocompleteContext.js +9 -0
  15. package/components/autocomplete/util.d.ts +3 -0
  16. package/components/autocomplete/util.js +16 -0
  17. package/components/badge/Badge.d.ts +13 -0
  18. package/components/badge/Badge.js +17 -0
  19. package/components/badge/index.js +1 -0
  20. package/components/button/Button.d.ts +34 -0
  21. package/components/button/Button.js +80 -0
  22. package/components/button/Button.test.d.ts +1 -0
  23. package/components/button/Button.test.js +17 -0
  24. package/components/button/ButtonGroup.d.ts +7 -0
  25. package/components/button/ButtonGroup.js +9 -0
  26. package/components/button/LinkButton.d.ts +18 -0
  27. package/components/button/LinkButton.js +12 -0
  28. package/components/button/index.js +3 -0
  29. package/components/card/config.d.ts +4 -0
  30. package/components/card/config.js +4 -0
  31. package/components/card/index.js +1 -0
  32. package/components/code/Code.d.ts +7 -0
  33. package/components/code/Code.js +5 -0
  34. package/components/code/index.js +1 -0
  35. package/components/color/ColorPalette.d.ts +1 -0
  36. package/components/color/ColorPalette.js +4 -0
  37. package/components/color/utils.d.ts +292 -0
  38. package/components/color/utils.js +293 -0
  39. package/components/context-menu/ContextMenu.d.ts +9 -0
  40. package/components/context-menu/ContextMenu.js +109 -0
  41. package/components/context-menu/ContextMenuItem.d.ts +9 -0
  42. package/components/context-menu/ContextMenuItem.js +6 -0
  43. package/components/context-menu/index.js +2 -0
  44. package/components/dialog/Dialog.d.ts +13 -0
  45. package/components/dialog/Dialog.js +20 -0
  46. package/components/dialog/index.js +1 -0
  47. package/components/dialog/util.d.ts +11 -0
  48. package/components/dialog/util.js +22 -0
  49. package/components/dropdown-menu/DropdownMenu.d.ts +7 -0
  50. package/components/dropdown-menu/DropdownMenu.js +6 -0
  51. package/components/dropdown-menu/DropdownMenuContent.d.ts +1 -0
  52. package/components/dropdown-menu/DropdownMenuContent.js +15 -0
  53. package/components/dropdown-menu/DropdownMenuItem.d.ts +6 -0
  54. package/components/dropdown-menu/DropdownMenuItem.js +16 -0
  55. package/components/dropdown-menu/DropdownMenuTrigger.d.ts +6 -0
  56. package/components/dropdown-menu/DropdownMenuTrigger.js +19 -0
  57. package/components/dropdown-menu/index.js +6 -0
  58. package/components/dropdown-menu/useDropdownMenu.d.ts +53 -0
  59. package/components/dropdown-menu/useDropdownMenu.js +79 -0
  60. package/components/dropdown-menu/useDropdownMenuContext.d.ts +56 -0
  61. package/components/dropdown-menu/useDropdownMenuContext.js +9 -0
  62. package/components/dropdown-menu-nested/DropdownMenuNested.d.ts +6 -0
  63. package/components/dropdown-menu-nested/DropdownMenuNested.js +7 -0
  64. package/components/dropdown-menu-nested/MenuContext.d.ts +8 -0
  65. package/components/dropdown-menu-nested/MenuContext.js +8 -0
  66. package/components/dropdown-menu-nested/MenuItem.d.ts +7 -0
  67. package/components/dropdown-menu-nested/MenuItem.js +20 -0
  68. package/components/dropdown-menu-nested/MenuItemWithChildren.d.ts +6 -0
  69. package/components/dropdown-menu-nested/MenuItemWithChildren.js +101 -0
  70. package/components/dropdown-menu-nested/index.js +3 -0
  71. package/components/flash/Flash.d.ts +9 -0
  72. package/components/flash/Flash.js +6 -0
  73. package/components/flash/index.js +1 -0
  74. package/components/highlight/Highlight.d.ts +7 -0
  75. package/components/highlight/Highlight.js +23 -0
  76. package/components/highlight/index.js +1 -0
  77. package/components/href/Href.d.ts +7 -0
  78. package/components/href/Href.js +6 -0
  79. package/components/href/index.js +1 -0
  80. package/components/input/Checkbox.d.ts +8 -0
  81. package/components/input/Checkbox.js +9 -0
  82. package/components/input/Color.d.ts +11 -0
  83. package/components/input/Color.js +11 -0
  84. package/components/input/Input.d.ts +14 -0
  85. package/components/input/Input.js +16 -0
  86. package/components/input/Input.test.d.ts +1 -0
  87. package/components/input/Input.test.js +11 -0
  88. package/components/input/RadioGroup.d.ts +21 -0
  89. package/components/input/RadioGroup.js +20 -0
  90. package/components/input/Range.d.ts +15 -0
  91. package/components/input/Range.js +15 -0
  92. package/components/input/Toggle.d.ts +7 -0
  93. package/components/input/Toggle.js +9 -0
  94. package/components/input/index.js +6 -0
  95. package/components/input-field/InputField.d.ts +13 -0
  96. package/components/input-field/InputField.js +16 -0
  97. package/components/input-field/index.js +1 -0
  98. package/components/loader/Loader.d.ts +8 -0
  99. package/components/loader/Loader.js +28 -0
  100. package/components/loader/index.js +1 -0
  101. package/components/modal/Components.d.ts +11 -0
  102. package/components/modal/Components.js +18 -0
  103. package/components/modal/Modal.d.ts +7 -0
  104. package/components/modal/Modal.js +7 -0
  105. package/components/modal/ModalContent.d.ts +1 -0
  106. package/components/modal/ModalContent.js +18 -0
  107. package/components/modal/ModalTrigger.d.ts +6 -0
  108. package/components/modal/ModalTrigger.js +19 -0
  109. package/components/modal/index.js +6 -0
  110. package/components/modal/useModal.d.ts +53 -0
  111. package/components/modal/useModal.js +32 -0
  112. package/components/modal/useModalContext.d.ts +55 -0
  113. package/components/modal/useModalContext.js +9 -0
  114. package/components/notification/NotificationsContext.d.ts +14 -0
  115. package/components/notification/NotificationsContext.js +51 -0
  116. package/components/notification/NotificationsProvider.d.ts +6 -0
  117. package/components/notification/NotificationsProvider.js +30 -0
  118. package/components/notification/index.js +4 -0
  119. package/components/notification/useContextNotifications.d.ts +5 -0
  120. package/components/notification/useContextNotifications.js +9 -0
  121. package/components/notification/useFetch.d.ts +2 -0
  122. package/components/notification/useFetch.js +16 -0
  123. package/components/popover/Components.d.ts +8 -0
  124. package/components/popover/Components.js +14 -0
  125. package/components/popover/Popover.d.ts +7 -0
  126. package/components/popover/Popover.js +6 -0
  127. package/components/popover/Popover.test.d.ts +1 -0
  128. package/components/popover/Popover.test.js +12 -0
  129. package/components/popover/PopoverContent.d.ts +1 -0
  130. package/components/popover/PopoverContent.js +16 -0
  131. package/components/popover/PopoverTrigger.d.ts +6 -0
  132. package/components/popover/PopoverTrigger.js +19 -0
  133. package/components/popover/index.js +6 -0
  134. package/components/popover/usePopover.d.ts +54 -0
  135. package/components/popover/usePopover.js +49 -0
  136. package/components/popover/usePopoverContext.d.ts +57 -0
  137. package/components/popover/usePopoverContext.js +9 -0
  138. package/components/portal/Portal.d.ts +6 -0
  139. package/components/portal/Portal.js +4 -0
  140. package/components/portal/index.js +1 -0
  141. package/components/resize-area/ResizeArea.d.ts +8 -0
  142. package/components/resize-area/ResizeArea.js +61 -0
  143. package/components/resize-area/index.js +1 -0
  144. package/components/scroll/Scroll.d.ts +22 -0
  145. package/components/scroll/Scroll.js +61 -0
  146. package/components/scroll/index.js +1 -0
  147. package/components/select/Select.d.ts +33 -0
  148. package/components/select/Select.js +137 -0
  149. package/components/select/Select.test.d.ts +1 -0
  150. package/components/select/Select.test.js +15 -0
  151. package/components/select/SelectOption.d.ts +4 -0
  152. package/components/select/SelectOption.js +13 -0
  153. package/components/select/SelectSelection.d.ts +5 -0
  154. package/components/select/SelectSelection.js +5 -0
  155. package/components/select/_fixtures.d.ts +28 -0
  156. package/components/select/_fixtures.js +62 -0
  157. package/components/select/index.js +4 -0
  158. package/components/select/useSelectContext.d.ts +10 -0
  159. package/components/select/useSelectContext.js +9 -0
  160. package/components/select/util.d.ts +1 -0
  161. package/components/select/util.js +10 -0
  162. package/components/snack/Snack.d.ts +5 -0
  163. package/components/snack/Snack.js +18 -0
  164. package/components/snack/index.js +1 -0
  165. package/components/sortable/Sortable.d.ts +2 -0
  166. package/components/sortable/Sortable.js +15 -0
  167. package/components/sortable/index.js +1 -0
  168. package/components/steps/Step.d.ts +11 -0
  169. package/components/steps/Step.js +10 -0
  170. package/components/steps/Steps.d.ts +23 -0
  171. package/components/steps/Steps.js +15 -0
  172. package/components/steps/index.js +3 -0
  173. package/components/steps/util.d.ts +1 -0
  174. package/components/steps/util.js +3 -0
  175. package/components/table/Table.d.ts +6 -0
  176. package/components/table/Table.js +4 -0
  177. package/components/table/TableBody.d.ts +6 -0
  178. package/components/table/TableBody.js +4 -0
  179. package/components/table/TableCell.d.ts +7 -0
  180. package/components/table/TableCell.js +5 -0
  181. package/components/table/TableFooter.d.ts +6 -0
  182. package/components/table/TableFooter.js +4 -0
  183. package/components/table/TableHeader.d.ts +6 -0
  184. package/components/table/TableHeader.js +5 -0
  185. package/components/table/TableHeaderCell.d.ts +6 -0
  186. package/components/table/TableHeaderCell.js +5 -0
  187. package/components/table/TableRow.d.ts +6 -0
  188. package/components/table/TableRow.js +5 -0
  189. package/components/table/index.js +7 -0
  190. package/components/tabs/Tabs.d.ts +25 -0
  191. package/components/tabs/Tabs.js +14 -0
  192. package/components/tabs/index.js +1 -0
  193. package/components/textarea/Textarea.d.ts +7 -0
  194. package/components/textarea/Textarea.js +6 -0
  195. package/components/textarea/index.js +1 -0
  196. package/components/tooltip/SimpleTooltip.d.ts +8 -0
  197. package/components/tooltip/SimpleTooltip.js +6 -0
  198. package/components/tooltip/Tooltip.d.ts +7 -0
  199. package/components/tooltip/Tooltip.js +6 -0
  200. package/components/tooltip/Tooltip.test.d.ts +1 -0
  201. package/components/tooltip/Tooltip.test.js +13 -0
  202. package/components/tooltip/TooltipContent.d.ts +1 -0
  203. package/components/tooltip/TooltipContent.js +15 -0
  204. package/components/tooltip/TooltipTrigger.d.ts +6 -0
  205. package/components/tooltip/TooltipTrigger.js +18 -0
  206. package/components/tooltip/index.js +6 -0
  207. package/components/tooltip/useTooltip.d.ts +49 -0
  208. package/components/tooltip/useTooltip.js +52 -0
  209. package/components/tooltip/useTooltipContext.d.ts +52 -0
  210. package/components/tooltip/useTooltipContext.js +9 -0
  211. package/hooks/index.js +11 -0
  212. package/hooks/useCombinedRefs.d.ts +2 -0
  213. package/hooks/useCombinedRefs.js +13 -0
  214. package/hooks/useCombinedRefs.test.d.ts +1 -0
  215. package/hooks/useCombinedRefs.test.js +34 -0
  216. package/hooks/useCopyToClipboard.d.ts +4 -0
  217. package/hooks/useCopyToClipboard.js +21 -0
  218. package/hooks/useDebounce.d.ts +4 -0
  219. package/hooks/useDebounce.js +40 -0
  220. package/hooks/useEventCallback.d.ts +1 -0
  221. package/hooks/useEventCallback.js +8 -0
  222. package/hooks/useEventListener.d.ts +6 -0
  223. package/hooks/useEventListener.js +25 -0
  224. package/hooks/useIsClosing.d.ts +5 -0
  225. package/hooks/useIsClosing.js +21 -0
  226. package/hooks/useIsMounted.d.ts +1 -0
  227. package/hooks/useIsMounted.js +13 -0
  228. package/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
  229. package/hooks/useIsomorphicLayoutEffect.js +2 -0
  230. package/hooks/useOnClickOutside.d.ts +4 -0
  231. package/hooks/useOnClickOutside.js +18 -0
  232. package/hooks/usePrevious.d.ts +1 -0
  233. package/hooks/usePrevious.js +8 -0
  234. package/hooks/useRipple.d.ts +5 -0
  235. package/hooks/useRipple.js +65 -0
  236. package/hooks/useRipple.test.d.ts +1 -0
  237. package/hooks/useRipple.test.js +34 -0
  238. package/{index.ts → index.d.ts} +0 -6
  239. package/index.js +32 -0
  240. package/lib/arrUtil.d.ts +1 -0
  241. package/lib/arrUtil.js +6 -0
  242. package/lib/error.d.ts +3 -0
  243. package/lib/error.js +15 -0
  244. package/lib/fetch.d.ts +17 -0
  245. package/lib/fetch.js +80 -0
  246. package/lib/fetch.test.d.ts +1 -0
  247. package/lib/fetch.test.js +84 -0
  248. package/lib/index.js +4 -0
  249. package/lib/tailwindVariants.d.ts +9 -0
  250. package/lib/tailwindVariants.js +26 -0
  251. package/package.json +6 -55
  252. package/redux/index.js +1 -0
  253. package/redux/notification/NotificationConsumer.d.ts +6 -0
  254. package/redux/notification/NotificationConsumer.js +28 -0
  255. package/redux/notification/errorCatcherMiddleware.d.ts +1 -0
  256. package/redux/notification/{errorCatcherMiddleware.ts → errorCatcherMiddleware.js} +14 -0
  257. package/redux/notification/index.js +5 -0
  258. package/redux/notification/notificationSlice.d.ts +19 -0
  259. package/redux/notification/notificationSlice.js +49 -0
  260. package/redux/notification/useReduxNotifications.d.ts +5 -0
  261. package/redux/notification/useReduxNotifications.js +22 -0
  262. package/styles/Content.d.ts +1 -0
  263. package/styles/Content.js +4 -0
  264. package/tailwind/base.d.ts +3 -0
  265. package/tailwind/base.js +60 -0
  266. package/tailwind/components.d.ts +5 -0
  267. package/tailwind/components.js +285 -0
  268. package/tailwind/index.js +2 -0
  269. package/tailwind/keyframes.d.ts +2 -0
  270. package/tailwind/keyframes.js +67 -0
  271. package/tailwind/pentatrionTw.d.ts +50 -0
  272. package/tailwind/pentatrionTw.js +189 -0
  273. package/tailwind/utilities.d.ts +3 -0
  274. package/tailwind/utilities.js +70 -0
  275. package/tailwind/vars.d.ts +2 -0
  276. package/tailwind/vars.js +104 -0
  277. package/tsup.config.d.ts +2 -0
  278. package/tsup.config.js +25 -0
  279. package/vite.config.d.ts +2 -0
  280. package/vite.config.js +21 -0
  281. package/vitest-setup.js +1 -0
  282. package/.prettierrc +0 -3
  283. package/CHANGELOG.md +0 -30
  284. package/bin/fontello.py +0 -105
  285. package/components/autocomplete/Autocomplete.stories.tsx +0 -63
  286. package/components/autocomplete/Autocomplete.tsx +0 -334
  287. package/components/autocomplete/AutocompleteOption.tsx +0 -35
  288. package/components/autocomplete/LazyAutocomplete.tsx +0 -132
  289. package/components/autocomplete/SimpleAutocomplete.tsx +0 -74
  290. package/components/autocomplete/_fixtures.tsx +0 -27
  291. package/components/autocomplete/useAutocompleteContext.ts +0 -20
  292. package/components/autocomplete/util.ts +0 -19
  293. package/components/badge/Badge.stories.tsx +0 -72
  294. package/components/badge/Badge.tsx +0 -73
  295. package/components/button/Button.stories.tsx +0 -190
  296. package/components/button/Button.test.tsx +0 -20
  297. package/components/button/Button.tsx +0 -209
  298. package/components/button/ButtonGroup.stories.tsx +0 -46
  299. package/components/button/ButtonGroup.tsx +0 -29
  300. package/components/button/LinkButton.tsx +0 -89
  301. package/components/card/Card.stories.tsx +0 -21
  302. package/components/card/config.ts +0 -4
  303. package/components/code/Code.tsx +0 -15
  304. package/components/color/ColorPalette.tsx +0 -3
  305. package/components/color/utils.ts +0 -292
  306. package/components/context-menu/ContextMenu.stories.tsx +0 -22
  307. package/components/context-menu/ContextMenu.tsx +0 -185
  308. package/components/context-menu/ContextMenuItem.tsx +0 -32
  309. package/components/dialog/Dialog.stories.tsx +0 -270
  310. package/components/dialog/Dialog.tsx +0 -46
  311. package/components/dialog/util.ts +0 -29
  312. package/components/dropdown-menu/DropdownMenu.stories.tsx +0 -19
  313. package/components/dropdown-menu/DropdownMenu.tsx +0 -12
  314. package/components/dropdown-menu/DropdownMenuContent.tsx +0 -52
  315. package/components/dropdown-menu/DropdownMenuItem.tsx +0 -33
  316. package/components/dropdown-menu/DropdownMenuTrigger.tsx +0 -40
  317. package/components/dropdown-menu/interface.d.ts +0 -13
  318. package/components/dropdown-menu/useDropdownMenu.tsx +0 -115
  319. package/components/dropdown-menu/useDropdownMenuContext.ts +0 -16
  320. package/components/dropdown-menu-nested/DropdownMenuNested.stories.tsx +0 -33
  321. package/components/dropdown-menu-nested/DropdownMenuNested.tsx +0 -17
  322. package/components/dropdown-menu-nested/MenuContext.ts +0 -15
  323. package/components/dropdown-menu-nested/MenuItem.tsx +0 -42
  324. package/components/dropdown-menu-nested/MenuItemWithChildren.tsx +0 -202
  325. package/components/flash/Flash.stories.tsx +0 -34
  326. package/components/flash/Flash.tsx +0 -24
  327. package/components/highlight/Highlight.stories.tsx +0 -142
  328. package/components/highlight/Highlight.tsx +0 -29
  329. package/components/href/Href.stories.tsx +0 -56
  330. package/components/href/Href.tsx +0 -21
  331. package/components/input/Checkbox.stories.tsx +0 -56
  332. package/components/input/Checkbox.tsx +0 -52
  333. package/components/input/Color.stories.tsx +0 -18
  334. package/components/input/Color.tsx +0 -61
  335. package/components/input/Input.stories.tsx +0 -103
  336. package/components/input/Input.test.tsx +0 -10
  337. package/components/input/Input.tsx +0 -58
  338. package/components/input/RadioGroup.stories.tsx +0 -81
  339. package/components/input/RadioGroup.tsx +0 -84
  340. package/components/input/Range.stories.tsx +0 -102
  341. package/components/input/Range.tsx +0 -134
  342. package/components/input/Toggle.stories.tsx +0 -29
  343. package/components/input/Toggle.tsx +0 -48
  344. package/components/input-field/InputField.stories.tsx +0 -253
  345. package/components/input-field/InputField.tsx +0 -68
  346. package/components/loader/Loader.stories.tsx +0 -37
  347. package/components/loader/Loader.tsx +0 -54
  348. package/components/modal/Components.tsx +0 -75
  349. package/components/modal/Modal.stories.tsx +0 -218
  350. package/components/modal/Modal.tsx +0 -13
  351. package/components/modal/ModalContent.tsx +0 -51
  352. package/components/modal/ModalTrigger.tsx +0 -39
  353. package/components/modal/interface.d.ts +0 -10
  354. package/components/modal/useModal.ts +0 -48
  355. package/components/modal/useModalContext.ts +0 -16
  356. package/components/notification/Notification.stories.tsx +0 -56
  357. package/components/notification/NotificationsContext.ts +0 -79
  358. package/components/notification/NotificationsProvider.tsx +0 -67
  359. package/components/notification/useContextNotifications.tsx +0 -13
  360. package/components/notification/useFetch.ts +0 -21
  361. package/components/popover/Components.tsx +0 -61
  362. package/components/popover/Popover.stories.tsx +0 -46
  363. package/components/popover/Popover.test.tsx +0 -21
  364. package/components/popover/Popover.tsx +0 -12
  365. package/components/popover/PopoverContent.tsx +0 -49
  366. package/components/popover/PopoverTrigger.tsx +0 -40
  367. package/components/popover/interface.d.ts +0 -13
  368. package/components/popover/usePopover.tsx +0 -80
  369. package/components/popover/usePopoverContext.ts +0 -16
  370. package/components/portal/Portal.tsx +0 -10
  371. package/components/quick-settings/QuickSettings.stories.tsx +0 -182
  372. package/components/resize-area/ResizeArea.stories.css +0 -40
  373. package/components/resize-area/ResizeArea.stories.tsx +0 -30
  374. package/components/resize-area/ResizeArea.tsx +0 -98
  375. package/components/scroll/Scroll.stories.tsx +0 -81
  376. package/components/scroll/Scroll.tsx +0 -111
  377. package/components/select/Select.stories.tsx +0 -170
  378. package/components/select/Select.test.tsx +0 -19
  379. package/components/select/Select.tsx +0 -364
  380. package/components/select/SelectOption.tsx +0 -29
  381. package/components/select/SelectSelection.tsx +0 -13
  382. package/components/select/_fixtures.tsx +0 -89
  383. package/components/select/interface.d.ts +0 -35
  384. package/components/select/useSelectContext.ts +0 -19
  385. package/components/select/util.ts +0 -12
  386. package/components/snack/Snack.stories.tsx +0 -33
  387. package/components/snack/Snack.tsx +0 -54
  388. package/components/sortable/Sortable.stories.tsx +0 -98
  389. package/components/sortable/Sortable.tsx +0 -37
  390. package/components/sortable/types.d.ts +0 -12
  391. package/components/steps/Step.tsx +0 -41
  392. package/components/steps/Steps.stories.tsx +0 -140
  393. package/components/steps/Steps.tsx +0 -49
  394. package/components/steps/util.ts +0 -3
  395. package/components/table/Table.stories.tsx +0 -36
  396. package/components/table/Table.tsx +0 -13
  397. package/components/table/TableBody.tsx +0 -9
  398. package/components/table/TableCell.tsx +0 -16
  399. package/components/table/TableFooter.tsx +0 -9
  400. package/components/table/TableHeader.tsx +0 -14
  401. package/components/table/TableHeaderCell.tsx +0 -14
  402. package/components/table/TableRow.tsx +0 -14
  403. package/components/tabs/Tabs.stories.tsx +0 -66
  404. package/components/tabs/Tabs.tsx +0 -90
  405. package/components/textarea/Textarea.stories.tsx +0 -26
  406. package/components/textarea/Textarea.tsx +0 -36
  407. package/components/tooltip/SimpleTooltip.tsx +0 -17
  408. package/components/tooltip/Tooltip.stories.tsx +0 -128
  409. package/components/tooltip/Tooltip.test.tsx +0 -20
  410. package/components/tooltip/Tooltip.tsx +0 -12
  411. package/components/tooltip/TooltipContent.tsx +0 -45
  412. package/components/tooltip/TooltipTrigger.tsx +0 -34
  413. package/components/tooltip/interface.d.ts +0 -15
  414. package/components/tooltip/useTooltip.ts +0 -87
  415. package/components/tooltip/useTooltipContext.ts +0 -16
  416. package/env.d.ts +0 -27
  417. package/fontello-dist/fontello.eot +0 -0
  418. package/fontello-dist/fontello.svg +0 -160
  419. package/fontello-dist/fontello.ttf +0 -0
  420. package/fontello-dist/fontello.woff +0 -0
  421. package/fontello-dist/fontello.woff2 +0 -0
  422. package/fontello.config.json +0 -966
  423. package/fontello.css +0 -131
  424. package/hooks/useCombinedRefs.test.tsx +0 -42
  425. package/hooks/useCombinedRefs.ts +0 -21
  426. package/hooks/useCopyToClipboard.ts +0 -28
  427. package/hooks/useDebounce.ts +0 -59
  428. package/hooks/useEventCallback.ts +0 -13
  429. package/hooks/useEventListener.ts +0 -86
  430. package/hooks/useIsClosing.ts +0 -25
  431. package/hooks/useIsMounted.ts +0 -16
  432. package/hooks/useIsomorphicLayoutEffect.ts +0 -4
  433. package/hooks/useOnClickOutside.ts +0 -35
  434. package/hooks/usePrevious.ts +0 -9
  435. package/hooks/useRipple.test.tsx +0 -52
  436. package/hooks/useRipple.tsx +0 -79
  437. package/index.css +0 -30
  438. package/lib/arrUtil.ts +0 -8
  439. package/lib/error.ts +0 -18
  440. package/lib/fetch.test.ts +0 -107
  441. package/lib/fetch.ts +0 -115
  442. package/lib/tailwindVariants.ts +0 -35
  443. package/postcss.config.js +0 -8
  444. package/redux/notification/NotificationConsumer.tsx +0 -59
  445. package/redux/notification/notificationSlice.ts +0 -68
  446. package/redux/notification/useReduxNotifications.ts +0 -26
  447. package/styles/Animation.stories.tsx +0 -47
  448. package/styles/Content.tsx +0 -340
  449. package/styles/Icons.stories.tsx +0 -69
  450. package/styles/Shadow.stories.tsx +0 -43
  451. package/styles/Themes.stories.tsx +0 -31
  452. package/styles/Typography.stories.tsx +0 -89
  453. package/tailwind/base.ts +0 -72
  454. package/tailwind/components.ts +0 -316
  455. package/tailwind/keyframes.ts +0 -69
  456. package/tailwind/legacy/base.css +0 -189
  457. package/tailwind/legacy/components-input-outline.css +0 -62
  458. package/tailwind/legacy/components-resize-area.css +0 -112
  459. package/tailwind/legacy/components-step.css +0 -161
  460. package/tailwind/legacy/components.css +0 -59
  461. package/tailwind/legacy/utilities-dialog.css +0 -101
  462. package/tailwind/legacy/utilities.css +0 -3
  463. package/tailwind/pentatrionTw.ts +0 -216
  464. package/tailwind/utilities.ts +0 -78
  465. package/tailwind/vars.ts +0 -125
  466. package/tailwind.config.js +0 -21
  467. package/tsconfig.json +0 -42
  468. package/tsup.config.ts +0 -26
  469. package/types.d.ts +0 -12
  470. package/vite.config.ts +0 -24
  471. /package/components/autocomplete/{index.ts → index.d.ts} +0 -0
  472. /package/components/badge/{index.ts → index.d.ts} +0 -0
  473. /package/components/button/{index.ts → index.d.ts} +0 -0
  474. /package/components/card/{index.ts → index.d.ts} +0 -0
  475. /package/components/code/{index.ts → index.d.ts} +0 -0
  476. /package/components/context-menu/{index.ts → index.d.ts} +0 -0
  477. /package/components/dialog/{index.ts → index.d.ts} +0 -0
  478. /package/components/dropdown-menu/{index.ts → index.d.ts} +0 -0
  479. /package/components/dropdown-menu-nested/{index.ts → index.d.ts} +0 -0
  480. /package/components/flash/{index.ts → index.d.ts} +0 -0
  481. /package/components/highlight/{index.ts → index.d.ts} +0 -0
  482. /package/components/href/{index.ts → index.d.ts} +0 -0
  483. /package/components/input/{index.ts → index.d.ts} +0 -0
  484. /package/components/input-field/{index.ts → index.d.ts} +0 -0
  485. /package/components/loader/{index.ts → index.d.ts} +0 -0
  486. /package/components/modal/{index.ts → index.d.ts} +0 -0
  487. /package/components/notification/{index.ts → index.d.ts} +0 -0
  488. /package/components/popover/{index.ts → index.d.ts} +0 -0
  489. /package/components/portal/{index.ts → index.d.ts} +0 -0
  490. /package/components/resize-area/{index.ts → index.d.ts} +0 -0
  491. /package/components/scroll/{index.ts → index.d.ts} +0 -0
  492. /package/components/select/{index.ts → index.d.ts} +0 -0
  493. /package/components/snack/{index.ts → index.d.ts} +0 -0
  494. /package/components/sortable/{index.ts → index.d.ts} +0 -0
  495. /package/components/steps/{index.ts → index.d.ts} +0 -0
  496. /package/components/table/{index.ts → index.d.ts} +0 -0
  497. /package/components/tabs/{index.ts → index.d.ts} +0 -0
  498. /package/components/textarea/{index.ts → index.d.ts} +0 -0
  499. /package/components/tooltip/{index.ts → index.d.ts} +0 -0
  500. /package/hooks/{index.ts → index.d.ts} +0 -0
  501. /package/lib/{index.ts → index.d.ts} +0 -0
  502. /package/redux/{index.ts → index.d.ts} +0 -0
  503. /package/redux/notification/{index.ts → index.d.ts} +0 -0
  504. /package/tailwind/{index.ts → index.d.ts} +0 -0
  505. /package/{vitest-setup.ts → vitest-setup.d.ts} +0 -0
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # [Pentatrion Design System](https://storybook.lonlat.pentatrion.com)
2
2
 
3
- <a href="https://storybook.lonlat.pentatrion.com">
4
- <img src="https://raw.githubusercontent.com/lhapaipai/lonlat/main/extra/assets/public/graphics/screenshots/storybook.jpg" alt="Pentatrion design system" />
3
+ <a href="https://design.pentatrion.com">
4
+ <img src="https://raw.githubusercontent.com/lhapaipai/pentatrion-design/main/screenshot.png" alt="Pentatrion design system" />
5
5
  </a>
6
6
 
7
7
  ## Prérequis
@@ -0,0 +1,44 @@
1
+ import { ReactNode } from "react";
2
+ import type { OptionLike, Option } from "../select";
3
+ import { AutocompleteOptionProps } from "./AutocompleteOption";
4
+ import { Placement } from "@floating-ui/react";
5
+ import { ThemeColor } from "../../types.d";
6
+ export interface AutocompleteProps<O extends OptionLike = Option> {
7
+ className?: string;
8
+ icon?: boolean | ReactNode;
9
+ color?: ThemeColor;
10
+ /**
11
+ * render suffix only if selection
12
+ * ex: add contextuel buttons associated to selection
13
+ */
14
+ selectionSuffix?: ReactNode;
15
+ /**
16
+ * render suffix only if selection and searchValue is empty
17
+ */
18
+ noSearchSuffix?: ReactNode;
19
+ placement?: Placement;
20
+ placeholder?: string;
21
+ /**
22
+ * search string used as value for <input>
23
+ */
24
+ searchValue: string;
25
+ /**
26
+ * change handler when typing in the input
27
+ * or when clicking on an option (the label value is passed)
28
+ */
29
+ onChangeSearchValue: (value: string, selectionLabel: boolean) => void;
30
+ selection?: O | null;
31
+ /**
32
+ * select handler for a selection from the autocomplete's dropdown
33
+ * the option object is passed when clicking on an option
34
+ * null value is passed when typing a new character in the input search.
35
+ */
36
+ onChangeSelection: (option: O | null) => void;
37
+ options: O[];
38
+ autocompleteOptionComponent?: (props: AutocompleteOptionProps<O>) => ReactNode;
39
+ loading?: boolean;
40
+ clearSearchButton?: boolean;
41
+ selectOnFocus?: boolean;
42
+ }
43
+ declare const _default: <O extends OptionLike = Option>(props: AutocompleteProps<O> & import("react").RefAttributes<HTMLInputElement>) => React.ReactElement | null;
44
+ export default _default;
@@ -0,0 +1,132 @@
1
+ import { createElement as _createElement } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useMemo, useRef, useState, forwardRef, } from "react";
4
+ import AutocompleteOption from "./AutocompleteOption";
5
+ import { FloatingFocusManager, FloatingList, FloatingPortal, autoUpdate, flip, offset, size, useDismiss, useFloating, useInteractions, useListNavigation, useRole, } from "@floating-ui/react";
6
+ import { AutocompleteContext } from "./useAutocompleteContext";
7
+ import clsx from "clsx";
8
+ import { useEventCallback } from "../../hooks";
9
+ import { getOptionLabel, getOptionValue } from "./util";
10
+ import { Button } from "../button";
11
+ import { Dialog } from "../dialog";
12
+ import { Loader } from "../loader";
13
+ import { inputConfig } from "../input/Input";
14
+ function Autocomplete({ className, icon = true, color = "yellow", selectionSuffix, noSearchSuffix, placement = "bottom", placeholder = "Search...", selection = null, onChangeSelection, autocompleteOptionComponent, loading = false, clearSearchButton = false, searchValue, onChangeSearchValue, options, selectOnFocus = true, }, inputRef) {
15
+ const [isOpen, setIsOpen] = useState(false);
16
+ const [activeIndex, setActiveIndex] = useState(null);
17
+ const onChangeSearchValueStable = useEventCallback(onChangeSearchValue);
18
+ const onChangeSelectionStable = useEventCallback(onChangeSelection);
19
+ const OptionComponent = autocompleteOptionComponent ?? AutocompleteOption;
20
+ const listRef = useRef([]);
21
+ const { refs, floatingStyles, context } = useFloating({
22
+ placement,
23
+ open: isOpen,
24
+ onOpenChange: setIsOpen,
25
+ whileElementsMounted: autoUpdate,
26
+ middleware: [
27
+ offset(5),
28
+ flip({ padding: 10 }),
29
+ size({
30
+ apply({ rects, elements, availableHeight }) {
31
+ Object.assign(elements.floating.style, {
32
+ width: `${Math.max(130, rects.reference.width)}px`,
33
+ });
34
+ const firstChild = elements.floating.firstElementChild;
35
+ if (firstChild) {
36
+ firstChild.style.maxHeight = `${Math.min(availableHeight, 288)}px`;
37
+ }
38
+ },
39
+ padding: 10,
40
+ }),
41
+ ],
42
+ });
43
+ const role = useRole(context, { role: "listbox" });
44
+ const dismiss = useDismiss(context);
45
+ const listNav = useListNavigation(context, {
46
+ listRef,
47
+ activeIndex,
48
+ onNavigate: setActiveIndex,
49
+ /* we want the real focus to stay on the input, so focus associated to active items is simulated */
50
+ virtual: true,
51
+ loop: true,
52
+ });
53
+ const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
54
+ role,
55
+ dismiss,
56
+ listNav,
57
+ ]);
58
+ function handleChangeSearchValue(e) {
59
+ const value = e.target.value;
60
+ onChangeSearchValueStable(value, false);
61
+ if (value !== searchValue && selection !== null) {
62
+ onChangeSelectionStable(null);
63
+ setActiveIndex(null);
64
+ return;
65
+ }
66
+ if (value) {
67
+ setIsOpen(true);
68
+ /**
69
+ * bug whith LazyAutocomplete activeIndex is set to 0 but the options array has immediately 0 elements
70
+ * so focus can't be set to the first Dom element.
71
+ */
72
+ setActiveIndex(listRef.current[0] ? 0 : null);
73
+ }
74
+ else {
75
+ setIsOpen(false);
76
+ setActiveIndex(null);
77
+ }
78
+ }
79
+ const handleSelect = useCallback((index) => {
80
+ if (index === null) {
81
+ onChangeSelectionStable(null);
82
+ }
83
+ else if (options[index]) {
84
+ const newSelection = options[index];
85
+ onChangeSelectionStable(newSelection);
86
+ onChangeSearchValueStable(getOptionLabel(newSelection), true);
87
+ }
88
+ setActiveIndex(null);
89
+ setIsOpen(false);
90
+ }, [options, onChangeSelectionStable, onChangeSearchValueStable]);
91
+ const autocompleteContext = useMemo(() => ({
92
+ activeIndex,
93
+ selection,
94
+ getItemProps,
95
+ handleSelect,
96
+ }), [activeIndex, selection, getItemProps, handleSelect]);
97
+ return (_jsxs("div", { className: className, children: [_jsxs("div", { className: clsx(inputConfig.container), ref: refs.setReference, "data-color": color, children: [icon !== false && (_jsxs("div", { className: "relative flex-center", children: [loading && _jsx(Loader, { size: "medium", color: "gray", className: "absolute left-0 top-0" }), icon === true ? (_jsx("span", { className: "h-8 w-8 flex-center", children: _jsx("i", { className: "fe-search" }) })) : (icon)] })), _jsx("input", { spellCheck: "false", className: clsx(inputConfig.input, icon === false && "pl-4"), ref: inputRef, type: "search", value: searchValue, placeholder: placeholder, "aria-autocomplete": "list", ...getReferenceProps({
98
+ onFocus() {
99
+ if (selectOnFocus) {
100
+ document.activeElement?.select();
101
+ }
102
+ },
103
+ onChange: handleChangeSearchValue,
104
+ onMouseDown() {
105
+ if (options.length === 0) {
106
+ return;
107
+ }
108
+ /**
109
+ * There is a already selection
110
+ * and the only element available is the selection,
111
+ * no need to display the dropdown.
112
+ */
113
+ // if (options.length === 1 && options[0].value === selection?.value) {
114
+ // return;
115
+ // }
116
+ setIsOpen((isOpen) => !isOpen);
117
+ },
118
+ onKeyDown(e) {
119
+ if (e.key === "Enter" && activeIndex != null) {
120
+ handleSelect(activeIndex);
121
+ }
122
+ },
123
+ }) }), _jsxs("div", { className: "relative flex-center", children: [selection && selectionSuffix, clearSearchButton && (searchValue.trim() !== "" || selection !== null) && (_jsx(Button, { withRipple: false, icon: true, color: "gray", variant: "text", onClick: () => {
124
+ setIsOpen(false);
125
+ onChangeSelectionStable(null);
126
+ setActiveIndex(null);
127
+ onChangeSearchValueStable("", true);
128
+ }, children: _jsx("i", { className: "fe-cancel" }) })), icon === false && loading && _jsx(Loader, { size: "medium", color: "gray" }), !selection && searchValue === "" && noSearchSuffix] })] }), _jsx(FloatingPortal, { children: _jsx(AutocompleteContext.Provider, { value: autocompleteContext, children: isOpen && (_jsx(FloatingFocusManager, { disabled: selectOnFocus, context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: _jsx("div", { className: "z-dialog outline-none", ref: refs.setFloating, style: floatingStyles, ...getFloatingProps(), children: _jsx(Dialog, { placement: context.placement, className: "overflow-auto motion-safe:animate-fade-in-list", children: _jsx(FloatingList, { elementsRef: listRef, children: options.map((option) => {
129
+ return _createElement(OptionComponent, { ...option, key: getOptionValue(option) });
130
+ }) }) }) }) })) }) })] }));
131
+ }
132
+ export default forwardRef(Autocomplete);
@@ -0,0 +1,5 @@
1
+ import { OptionLike } from "../select";
2
+ export type AutocompleteOptionProps<O extends OptionLike> = O;
3
+ declare function AutocompleteOption<O extends OptionLike>(props: AutocompleteOptionProps<O>): import("react/jsx-runtime").JSX.Element;
4
+ declare const _default: import("react").MemoExoticComponent<typeof AutocompleteOption>;
5
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo, useId } from "react";
3
+ import { useListItem } from "@floating-ui/react";
4
+ import { useAutocomplete } from ".";
5
+ import clsx from "clsx";
6
+ import { getOptionLabel, getOptionValue } from "./util";
7
+ function AutocompleteOption(props) {
8
+ const label = getOptionLabel(props);
9
+ const id = useId();
10
+ const { activeIndex, selection, getItemProps, handleSelect } = useAutocomplete();
11
+ const { ref, index } = useListItem({ label });
12
+ const isActive = activeIndex === index;
13
+ const isSelected = selection ? getOptionValue(selection) === getOptionValue(props) : false;
14
+ return (_jsx("div", { className: clsx("option", isSelected ? "bg-gray-2" : isActive && "bg-gray-1"), ref: ref, role: "option", id: id, "aria-selected": isActive, ...getItemProps({
15
+ onClick: () => handleSelect(index),
16
+ }), children: label }));
17
+ }
18
+ export default memo(AutocompleteOption);
@@ -0,0 +1,8 @@
1
+ import { AutocompleteProps } from ".";
2
+ import { OptionLike, Option } from "../select";
3
+ interface Props<O extends OptionLike = Option> extends Pick<AutocompleteProps<O>, "className" | "icon" | "color" | "selectionSuffix" | "noSearchSuffix" | "placement" | "placeholder" | "selection" | "onChangeSelection" | "autocompleteOptionComponent" | "loading" | "clearSearchButton"> {
4
+ onChangeSearchValueCallback: (searchValue: string) => Promise<O[]>;
5
+ debounce?: number;
6
+ }
7
+ export declare function LazyAutocomplete<O extends OptionLike = Option>({ onChangeSearchValueCallback, debounce, selection, onChangeSelection, ...rest }: Props<O>): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,71 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
3
+ import { Autocomplete } from ".";
4
+ import { getOptionLabel } from "./util";
5
+ import { useStateDebounce, useEventCallback } from "../../hooks";
6
+ export function LazyAutocomplete({ onChangeSearchValueCallback, debounce = 5000, selection = null, onChangeSelection, ...rest }) {
7
+ const onChangeSelectionStable = useEventCallback(onChangeSelection);
8
+ const onChangeSearchValueCallbackStable = useEventCallback(onChangeSearchValueCallback);
9
+ const [searchValue, searchValueDebounced, setSearchValue] = useStateDebounce(selection ? getOptionLabel(selection) : "", debounce);
10
+ // console.log(searchValue, searchValueDebounced);
11
+ const searchValueRef = useRef(searchValue);
12
+ searchValueRef.current = searchValue;
13
+ const inputRef = useRef(null);
14
+ const [loading, setLoading] = useState(false);
15
+ const [options, setOptions] = useState([]);
16
+ const handleChangeSelection = useCallback((selection) => {
17
+ onChangeSelectionStable(selection);
18
+ if (selection) {
19
+ setOptions([]);
20
+ }
21
+ }, [onChangeSelectionStable]);
22
+ // side effect, update the searchValue <input /> value when
23
+ // selection come from outside
24
+ useLayoutEffect(() => {
25
+ if (selection === null) {
26
+ if (document.activeElement !== inputRef.current) {
27
+ setSearchValue("", true);
28
+ }
29
+ return;
30
+ }
31
+ // we need the fresh value of searchValue but we don't
32
+ // want searchValue as useEffect dependency
33
+ const selectionLabel = getOptionLabel(selection);
34
+ if (searchValueRef.current !== selectionLabel) {
35
+ setSearchValue(selectionLabel, true);
36
+ }
37
+ }, [selection, setSearchValue]);
38
+ /**
39
+ * set new options when searchValueDebounced change
40
+ */
41
+ useEffect(() => {
42
+ let abort = false;
43
+ // when we're selecting option we change searchValue to be the complete label
44
+ // value but we don't want to fetch new research
45
+ if (selection) {
46
+ return;
47
+ }
48
+ if (searchValueDebounced.trim() === "") {
49
+ setOptions([]);
50
+ return;
51
+ }
52
+ setLoading(true);
53
+ onChangeSearchValueCallbackStable(searchValueDebounced)
54
+ ?.then((newOptions) => {
55
+ setLoading(false);
56
+ if (!abort) {
57
+ setOptions(newOptions);
58
+ }
59
+ })
60
+ .catch(() => {
61
+ setLoading(false);
62
+ });
63
+ return () => {
64
+ setLoading(false);
65
+ abort = true;
66
+ };
67
+ }, [selection, searchValueDebounced, onChangeSearchValueCallbackStable]);
68
+ return (_jsx(Autocomplete, { ref: inputRef, searchValue: searchValue, onChangeSearchValue: (newValue, immediate) => {
69
+ setSearchValue(newValue, immediate || newValue === "" ? true : false);
70
+ }, selection: selection, onChangeSelection: handleChangeSelection, options: options, loading: loading, ...rest }));
71
+ }
@@ -0,0 +1,6 @@
1
+ import { AutocompleteProps } from ".";
2
+ import { Option, OptionLike } from "../select";
3
+ interface Props<O extends OptionLike = Option> extends Pick<AutocompleteProps<O>, "className" | "icon" | "color" | "placement" | "placeholder" | "selection" | "onChangeSelection" | "autocompleteOptionComponent" | "options" | "selection"> {
4
+ }
5
+ export declare function SimpleAutocomplete<O extends OptionLike = Option>({ options, selection, onChangeSelection, ...rest }: Props<O>): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useLayoutEffect, useRef, useState } from "react";
3
+ import { Autocomplete } from ".";
4
+ import { useEventCallback } from "../../hooks";
5
+ import { getOptionLabel } from "./util";
6
+ export function SimpleAutocomplete({ options, selection = null, onChangeSelection, ...rest }) {
7
+ const onChangeSelectionStable = useEventCallback(onChangeSelection);
8
+ const [searchValue, setSearchValue] = useState(selection ? getOptionLabel(selection) : "");
9
+ const searchValueRef = useRef(searchValue);
10
+ searchValueRef.current = searchValue;
11
+ const inputRef = useRef(null);
12
+ // side effect, update the searchValue <input /> value when
13
+ // selection come from outside
14
+ useLayoutEffect(() => {
15
+ if (selection === null) {
16
+ if (document.activeElement !== inputRef.current) {
17
+ setSearchValue("");
18
+ }
19
+ return;
20
+ }
21
+ // we need the fresh value of searchValue but we don't
22
+ // want searchValue as useEffect dependency
23
+ const selectionLabel = getOptionLabel(selection);
24
+ if (searchValueRef.current !== getOptionLabel(selection)) {
25
+ setSearchValue(selectionLabel);
26
+ }
27
+ }, [selection, setSearchValue]);
28
+ const filteredOptions = selection !== null
29
+ ? []
30
+ : options.filter((option) => {
31
+ const optionLabel = getOptionLabel(option);
32
+ return optionLabel.toLowerCase().startsWith(searchValue.toLowerCase());
33
+ });
34
+ return (_jsx(Autocomplete, { ref: inputRef, searchValue: searchValue, onChangeSearchValue: setSearchValue, selection: selection, onChangeSelection: onChangeSelectionStable, options: filteredOptions, ...rest }));
35
+ }
@@ -0,0 +1,2 @@
1
+ import { Option } from "../select";
2
+ export declare const options: Option[];
@@ -0,0 +1,25 @@
1
+ export const options = [
2
+ { value: "abbeville", label: "Abbeville" },
3
+ { value: "agde", label: "Agde" },
4
+ { value: "agen", label: "Agen" },
5
+ { value: "aixenprovence", label: "Aix-en-Provence" },
6
+ { value: "ajaccio", label: "Ajaccio" },
7
+ { value: "albi", label: "Albi" },
8
+ { value: "alencon", label: "Alençon" },
9
+ { value: "amiens", label: "Amiens" },
10
+ { value: "angers", label: "Angers" },
11
+ { value: "angouleme", label: "Angoulême" },
12
+ { value: "annonay", label: "Annonay" },
13
+ { value: "antibes", label: "Antibes" },
14
+ { value: "arcachon", label: "Arcachon" },
15
+ { value: "arles", label: "Arles" },
16
+ { value: "arras", label: "Arras" },
17
+ { value: "asnieres-sur-seine", label: "Asnières-sur-Seine" },
18
+ { value: "aubagne", label: "Aubagne" },
19
+ { value: "aubervilliers", label: "Aubervilliers" },
20
+ { value: "aulnay-sous-bois", label: "Aulnay-sous-Bois" },
21
+ { value: "avignon", label: "Avignon" },
22
+ { value: "avranches", label: "Avranches" },
23
+ { value: "avoriaz", label: "Avoriaz" },
24
+ { value: "avray", label: "Avray" },
25
+ ];
@@ -0,0 +1,6 @@
1
+ export { default as Autocomplete } from "./Autocomplete";
2
+ export { SimpleAutocomplete } from "./SimpleAutocomplete";
3
+ export { default as AutocompleteOption } from "./AutocompleteOption";
4
+ export { LazyAutocomplete } from "./LazyAutocomplete";
5
+ export { useAutocomplete } from "./useAutocompleteContext";
6
+ export { getOptionValue, getOptionLabel } from "./util";
@@ -0,0 +1,11 @@
1
+ import { useInteractions } from "@floating-ui/react";
2
+ import { OptionLike } from "../select";
3
+ interface AutocompleteContext {
4
+ activeIndex: number | null;
5
+ selection: OptionLike | null;
6
+ getItemProps: ReturnType<typeof useInteractions>["getItemProps"];
7
+ handleSelect: (index: number | null) => void;
8
+ }
9
+ export declare const AutocompleteContext: import("react").Context<AutocompleteContext | null>;
10
+ export declare function useAutocomplete(): AutocompleteContext;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import { createContext, useContext } from "react";
2
+ export const AutocompleteContext = createContext(null);
3
+ export function useAutocomplete() {
4
+ const context = useContext(AutocompleteContext);
5
+ if (context === null) {
6
+ throw new Error("Autocomplete components must be wrapped in <Autocomplete>");
7
+ }
8
+ return context;
9
+ }
@@ -0,0 +1,3 @@
1
+ import { OptionLike } from "../select";
2
+ export declare function getOptionLabel(option: OptionLike): string;
3
+ export declare function getOptionValue(option: OptionLike): string | number;
@@ -0,0 +1,16 @@
1
+ export function getOptionLabel(option) {
2
+ switch (option.type) {
3
+ case "Feature":
4
+ return option.properties.label;
5
+ default:
6
+ return option.label;
7
+ }
8
+ }
9
+ export function getOptionValue(option) {
10
+ switch (option.type) {
11
+ case "Feature":
12
+ return option.properties.id;
13
+ default:
14
+ return option.value;
15
+ }
16
+ }
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from "react";
2
+ import { ThemeColor } from "../../types.d";
3
+ interface Props {
4
+ children: ReactNode;
5
+ className?: string;
6
+ tooltip?: string;
7
+ url?: string;
8
+ color?: ThemeColor;
9
+ onClick?: () => void;
10
+ onRemove?: () => void;
11
+ }
12
+ export declare function Badge({ children, className, onRemove, onClick, tooltip, url, color, }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { buttonVariants } from "../button";
4
+ import { Href } from "../href";
5
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip";
6
+ export function Badge({ children, className, onRemove, onClick, tooltip, url, color = "yellow", }) {
7
+ const badge = (_jsxs("span", { className: clsx("ll-badge", "inline-flex w-fit items-stretch overflow-hidden rounded-full text-xs shadow", buttonVariants.variant.contained(color),
8
+ // badgeVariants.color[color],
9
+ // `variant-solid-${color}`,
10
+ // `text-${color}-4`,
11
+ className), children: [onClick ? (_jsx("button", { className: "px-2", onClick: onClick, children: children })) : (_jsx("span", { className: "px-2", children: children })), onRemove && (_jsx("button", { className: "remove rounded-r-full pl-0.5 pr-1", onClick: onRemove, children: _jsx("i", { className: "fe-cancel" }) }))] }));
12
+ const wrappedBadge = url ? (_jsx(Href, { href: url, ghost: true, children: badge })) : (badge);
13
+ if (!tooltip) {
14
+ return wrappedBadge;
15
+ }
16
+ return (_jsxs(Tooltip, { children: [_jsx(TooltipContent, { children: tooltip }), _jsx(TooltipTrigger, { asChild: true, children: wrappedBadge })] }));
17
+ }
@@ -0,0 +1 @@
1
+ export { Badge } from "./Badge";
@@ -0,0 +1,34 @@
1
+ import { ComponentPropsWithRef } from "react";
2
+ import { ThemeColor } from "../../types.d";
3
+ export interface ButtonProps extends ComponentPropsWithRef<"button"> {
4
+ withRipple?: boolean;
5
+ variant?: "contained" | "light" | "outlined" | "text" | "ghost";
6
+ size?: "small" | "medium" | "large" | "custom";
7
+ color?: ThemeColor;
8
+ children?: React.ReactNode;
9
+ /**
10
+ * undefined: hidden
11
+ * false: invisible
12
+ * true: visible
13
+ */
14
+ loading?: boolean;
15
+ disabled?: boolean;
16
+ fullWidth?: boolean;
17
+ focusable?: boolean;
18
+ /**
19
+ * For a selected item inside a group.
20
+ */
21
+ selected?: boolean;
22
+ icon?: boolean;
23
+ }
24
+ export declare const buttonVariants: {
25
+ size(icon: boolean, size: "small" | "medium" | "large" | "custom"): string | false;
26
+ variant: {
27
+ contained(color: ThemeColor): string;
28
+ light(color: ThemeColor): string;
29
+ outlined(color: ThemeColor): string;
30
+ text(color: ThemeColor): string;
31
+ ghost(color: ThemeColor): string;
32
+ };
33
+ };
34
+ export declare const Button: (props: ButtonProps & import("react").RefAttributes<HTMLButtonElement>) => React.ReactElement | null;
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useImperativeHandle, useRef, } from "react";
3
+ import clsx from "clsx";
4
+ import { Loader } from "../loader";
5
+ import { useRipple } from "../../hooks";
6
+ export const buttonVariants = {
7
+ size(icon, size) {
8
+ if (size === "custom") {
9
+ return false;
10
+ }
11
+ switch (size) {
12
+ case "small":
13
+ return clsx("text-sm h-6", icon ? "min-w-6 [&_i]:w-6" : "px-2");
14
+ case "medium":
15
+ return clsx("h-8", icon ? "min-w-8 [&_i]:w-8" : "px-4");
16
+ case "large":
17
+ return clsx("h-12", icon ? "text-2xl min-w-12 [&_i]:w-12" : "text-xl px-8");
18
+ }
19
+ },
20
+ variant: {
21
+ contained(color) {
22
+ return clsx("shadow hover:shadow-md focus:shadow-md active-full:shadow-lg outline-offset-0", {
23
+ yellow: "text-yellow-text bg-yellow-3 hover:bg-yellow-4 active-full:bg-yellow-5 focus-visible:outline-yellow-5",
24
+ gray: "text-gray-text bg-gray-3 hover:bg-gray-4 active-full:bg-gray-5 focus-visible:outline-gray-5",
25
+ red: "text-red-text bg-red-3 hover:bg-red-4 active-full:bg-red-5 focus-visible:outline-red-5",
26
+ orange: "text-orange-text bg-orange-3 hover:bg-orange-4 active-full:bg-orange-5 focus-visible:outline-orange-5",
27
+ green: "text-green-text bg-green-3 hover:bg-green-4 active-full:bg-green-5 focus-visible:outline-green-5",
28
+ blue: "text-blue-text bg-blue-3 hover:bg-blue-4 active-full:bg-blue-5 focus-visible:outline-blue-5",
29
+ }[color]);
30
+ },
31
+ light(color) {
32
+ return clsx("shadow hover:shadow-md focus:shadow-md active-full:shadow-lg outline-offset-0 bg-gray-0", {
33
+ yellow: "text-gray-text hover:text-yellow-text hover:bg-yellow-3 active-full:bg-yellow-4 dark:active-full:bg-yellow-4 focus-visible:outline-yellow-4",
34
+ gray: "text-gray-text hover:text-gray-text hover:bg-gray-3 active-full:bg-gray-4 dark:active-full:bg-gray-4/50 focus-visible:outline-gray-4",
35
+ red: "text-gray-text hover:text-red-text hover:bg-red-3 active-full:bg-red-4 dark:active-full:bg-red-4/50 focus-visible:outline-red-4",
36
+ orange: "text-gray-text hover:text-orange-text hover:bg-orange-3 active-full:bg-orange-4 dark:active-full:bg-orange-4/50 focus-visible:outline-orange-4",
37
+ green: "text-gray-text hover:text-green-text hover:bg-green-3 active-full:bg-green-4 dark:active-full:bg-green-4/50 focus-visible:outline-green-4",
38
+ blue: "text-gray-text hover:text-blue-text hover:bg-blue-3 active-full:bg-blue-4 dark:active-full:bg-blue-4/50 focus-visible:outline-blue-4",
39
+ }[color]);
40
+ },
41
+ outlined(color) {
42
+ return clsx("bg-gray-0 text-gray-7 outline outline-2 outline-offset-[-2px] focus-visible:ring-2 active-full:shadow-md", {
43
+ yellow: "hover:bg-yellow-1/50 active-full:bg-yellow-2/50 outline-yellow-5 focus-visible:ring-yellow-4",
44
+ gray: "hover:bg-gray-1 active-full:bg-gray-2 outline-gray-5 focus-visible:ring-gray-4",
45
+ red: "hover:bg-red-1/50 active-full:bg-red-2/50 outline-red-5 focus-visible:ring-red-4",
46
+ orange: "hover:bg-orange-1/50 active-full:bg-orange-2/50 outline-orange-5 focus-visible:ring-orange-4",
47
+ green: "hover:bg-green-1/50 active-full:bg-green-2/50 outline-green-5 focus-visible:ring-green-4",
48
+ blue: "hover:bg-blue-1/50 active-full:bg-blue-2/50 outline-blue-5 focus-visible:ring-blue-4",
49
+ }[color]);
50
+ },
51
+ text(color) {
52
+ return clsx("bg-transparent active-full:shadow-sm outline-offset-0", {
53
+ yellow: "hover:bg-yellow-1/50 active-full:bg-yellow-2/25 text-yellow-4 hover:text-yellow-5 focus-visible:outline-yellow-5",
54
+ gray: "hover:bg-gray-1 active-full:bg-gray-2 text-gray-5 hover:text-gray-6 active-full:text-gray-7 focus-visible:outline-gray-5",
55
+ red: "hover:bg-red-1/50 active-full:bg-red-2/50 text-red-4 hover:text-red-5 focus-visible:outline-red-5",
56
+ orange: "hover:bg-orange-1/50 active-full:bg-orange-2/50 text-orange-4 hover:text-orange-5 focus-visible:outline-orange-5",
57
+ green: "hover:bg-green-1/50 active-full:bg-green-2/50 text-green-4 hover:text-green-5 focus-visible:outline-green-5",
58
+ blue: "hover:bg-blue-1/50 active-full:bg-blue-2/50 text-blue-4 hover:text-blue-5 focus-visible:outline-blue-5",
59
+ }[color]);
60
+ },
61
+ ghost(color) {
62
+ return clsx("bg-transparent outline-offset-0", {
63
+ yellow: "text-yellow-4 hover:text-yellow-5",
64
+ gray: "text-gray-5 hover:text-gray-6 active-full:text-gray-7",
65
+ red: "text-red-4 hover:text-red-5",
66
+ orange: "text-orange-4 hover:text-orange-5",
67
+ green: "text-green-4 hover:text-green-5",
68
+ blue: "text-blue-4 hover:text-blue-5",
69
+ }[color]);
70
+ },
71
+ },
72
+ };
73
+ export const Button = forwardRef(({ withRipple = true, variant = "contained", loading, color = "yellow", size = "medium", focusable = true, fullWidth, className, disabled, children, selected = false, icon = false, ...props }, ref) => {
74
+ const inputRef = useRef(null);
75
+ useImperativeHandle(ref, () => inputRef.current);
76
+ const notClickable = loading || disabled;
77
+ const ripples = useRipple(inputRef);
78
+ // check if overflow-clip-margin: 1px; is needed ?
79
+ return (_jsxs("button", { tabIndex: focusable ? 0 : -1, role: "button", ref: inputRef, className: clsx("relative inline-flex cursor-pointer items-center overflow-clip border-0 text-center leading-5 no-underline duration-300 focus-visible:outline focus-visible:outline-2 motion-safe:transition-color-shadow", icon ? "rounded-full" : "rounded-2xl", className, buttonVariants.size(icon, size), buttonVariants.variant[variant](color), icon && "justify-center [&_:last-child:not(i,img,svg)]:pr-4", fullWidth && "w-full", selected && "active", notClickable && "disabled"), "data-variant": variant, disabled: disabled, "aria-busy": loading, ...props, children: [!notClickable && withRipple && ripples, children, loading !== undefined && (_jsx("span", { className: "", children: _jsx(Loader, { color: color, size: "small", className: clsx("-mr-2 ml-2", !loading && "invisible") }) }))] }));
80
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cleanup, fireEvent, render } from "@testing-library/react";
3
+ import { describe, it, expect, vi, afterEach } from "vitest";
4
+ import { Button } from ".";
5
+ afterEach(cleanup);
6
+ describe("<Button />", () => {
7
+ it("forwards className", () => {
8
+ const { getByRole } = render(_jsx(Button, { className: "custom" }));
9
+ expect(getByRole("button")).toHaveClass("custom");
10
+ });
11
+ it("handle click", () => {
12
+ const mockOnClick = vi.fn();
13
+ const { getByRole } = render(_jsx(Button, { onClick: mockOnClick, children: "Click Me" }));
14
+ fireEvent.click(getByRole("button"));
15
+ expect(mockOnClick).toHaveBeenCalledTimes(1);
16
+ });
17
+ });
@@ -0,0 +1,7 @@
1
+ import { ComponentProps, ReactNode } from "react";
2
+ interface Props extends ComponentProps<"div"> {
3
+ children: ReactNode;
4
+ direction?: "horizontal" | "vertical";
5
+ }
6
+ export declare function ButtonGroup({ children, className, direction }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ const buttonGroupVariants = {
4
+ horizontal: "[&_:not(:first-child)]:rounded-bl-none [&_:not(:last-child)]:rounded-tr-none [&_[data-variant='outlined']]:-mx-[1px]",
5
+ vertical: "flex flex-col [&_:not(:first-child)]:rounded-tr-none [&_:not(:last-child)]:rounded-bl-none [&_[data-variant='outlined']]:-my-[1px]",
6
+ };
7
+ export function ButtonGroup({ children, className, direction = "horizontal" }) {
8
+ return (_jsx("div", { className: clsx("ll-button-group [&_:not(:first-child)]:rounded-tl-none [&_:not(:last-child)]:rounded-br-none", buttonGroupVariants[direction], `direction-${direction}`, className), children: children }));
9
+ }
@@ -0,0 +1,18 @@
1
+ import { ComponentPropsWithRef } from "react";
2
+ import { ThemeColor } from "../../types.d";
3
+ export interface LinkButtonProps extends ComponentPropsWithRef<"a"> {
4
+ href: string;
5
+ withRipple?: boolean;
6
+ variant?: "contained" | "light" | "outlined" | "text" | "ghost";
7
+ size?: "small" | "medium" | "large" | "custom";
8
+ color?: ThemeColor;
9
+ children?: React.ReactNode;
10
+ fullWidth?: boolean;
11
+ focusable?: boolean;
12
+ /**
13
+ * For a selected item inside a group.
14
+ */
15
+ selected?: boolean;
16
+ icon?: boolean;
17
+ }
18
+ export declare const LinkButton: (props: LinkButtonProps & import("react").RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;