@povio/ui 0.0.2 → 0.0.4

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 (485) hide show
  1. package/package.json +70 -9
  2. package/src/assets/icons/AlignCenter.tsx +16 -0
  3. package/src/assets/icons/AlignLeft.tsx +16 -0
  4. package/src/assets/icons/AlignLeftRight.tsx +16 -0
  5. package/src/assets/icons/AlignRight.tsx +16 -0
  6. package/src/assets/icons/ArrowDropDown.tsx +16 -0
  7. package/src/assets/icons/ArrowDropUp.tsx +16 -0
  8. package/src/assets/icons/ArrowLeft.tsx +16 -0
  9. package/src/assets/icons/ArrowRight.tsx +16 -0
  10. package/src/assets/icons/Bold.tsx +16 -0
  11. package/src/assets/icons/BulletedList.tsx +16 -0
  12. package/src/assets/icons/Calendar.tsx +18 -0
  13. package/src/assets/icons/Check.tsx +18 -0
  14. package/src/assets/icons/CheckCircle.tsx +16 -0
  15. package/src/assets/icons/CheckboxCheckmark.tsx +19 -0
  16. package/src/assets/icons/CheckboxIndeterminate.tsx +19 -0
  17. package/src/assets/icons/ChevronDown.tsx +18 -0
  18. package/src/assets/icons/ChevronLeft.tsx +18 -0
  19. package/src/assets/icons/ChevronRight.tsx +18 -0
  20. package/src/assets/icons/ChevronUp.tsx +18 -0
  21. package/src/assets/icons/ChevronsLeft.tsx +24 -0
  22. package/src/assets/icons/ChevronsRight.tsx +24 -0
  23. package/src/assets/icons/Clock.tsx +16 -0
  24. package/src/assets/icons/Close.tsx +16 -0
  25. package/src/assets/icons/DateTime.tsx +20 -0
  26. package/src/assets/icons/Drag.tsx +16 -0
  27. package/src/assets/icons/File.tsx +18 -0
  28. package/src/assets/icons/Highlight.tsx +16 -0
  29. package/src/assets/icons/HighlightOn.tsx +26 -0
  30. package/src/assets/icons/Info.tsx +24 -0
  31. package/src/assets/icons/Italic.tsx +16 -0
  32. package/src/assets/icons/Link.tsx +16 -0
  33. package/src/assets/icons/Menu.tsx +18 -0
  34. package/src/assets/icons/NumberedList.tsx +16 -0
  35. package/src/assets/icons/PointerHorizontal.tsx +16 -0
  36. package/src/assets/icons/PointerVertical.tsx +16 -0
  37. package/src/assets/icons/Send.tsx +18 -0
  38. package/src/assets/icons/Strikethrough.tsx +16 -0
  39. package/src/assets/icons/TextColor.tsx +24 -0
  40. package/src/assets/icons/Today.tsx +16 -0
  41. package/src/assets/icons/Underlined.tsx +18 -0
  42. package/src/assets/icons/Upload.tsx +20 -0
  43. package/src/assets/icons/View.tsx +16 -0
  44. package/src/assets/icons/ViewOff.tsx +16 -0
  45. package/src/assets/icons/Warningfilled.tsx +18 -0
  46. package/src/assets/locales/en/translation.json +156 -0
  47. package/src/assets/locales/sl/translation.json +152 -0
  48. package/src/components/Menu/Menu.tsx +29 -0
  49. package/src/components/Menu/MenuDesktop.tsx +68 -0
  50. package/src/components/Menu/MenuItem.tsx +33 -0
  51. package/src/components/Menu/MenuMobile.tsx +81 -0
  52. package/src/components/Menu/MenuPopover.tsx +45 -0
  53. package/src/components/buttons/Button/Button.tsx +108 -0
  54. package/src/components/buttons/Button/button.cva.ts +678 -0
  55. package/src/components/buttons/IconButton/IconButton.tsx +25 -0
  56. package/src/components/buttons/InlineIconButton/InlineIconButton.tsx +27 -0
  57. package/src/components/buttons/PillButton/PillButton.tsx +70 -0
  58. package/src/components/buttons/PillButton/pillButton.cva.ts +88 -0
  59. package/src/components/buttons/SplitButton/SplitButton.tsx +61 -0
  60. package/src/components/buttons/TextButton/TextButton.tsx +29 -0
  61. package/src/components/buttons/ToggleButton/ToggleButton.tsx +28 -0
  62. package/src/components/buttons/shared/ButtonContent.tsx +61 -0
  63. package/src/components/buttons/shared/buttonContent.cva.ts +18 -0
  64. package/src/components/inputs/Checkbox/Checkbox.tsx +101 -0
  65. package/src/components/inputs/Checkbox/CheckboxCheckmark.tsx +47 -0
  66. package/src/components/inputs/Checkbox/checkbox.cva.ts +51 -0
  67. package/src/components/inputs/DateTime/DatePicker/DatePicker.tsx +269 -0
  68. package/src/components/inputs/DateTime/DateRangePicker/DateRangePicker.tsx +808 -0
  69. package/src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx +291 -0
  70. package/src/components/inputs/DateTime/TimePicker/TimePicker.tsx +255 -0
  71. package/src/components/inputs/DateTime/shared/Calendar.tsx +104 -0
  72. package/src/components/inputs/DateTime/shared/CalendarCell.tsx +247 -0
  73. package/src/components/inputs/DateTime/shared/CalendarGrid.tsx +102 -0
  74. package/src/components/inputs/DateTime/shared/CalendarHeader.tsx +110 -0
  75. package/src/components/inputs/DateTime/shared/CalendarSelectHeader.tsx +228 -0
  76. package/src/components/inputs/DateTime/shared/DateField.tsx +83 -0
  77. package/src/components/inputs/DateTime/shared/DatePickerInput.tsx +170 -0
  78. package/src/components/inputs/DateTime/shared/DateSegmentItem.tsx +65 -0
  79. package/src/components/inputs/DateTime/shared/DateTimeDialog.tsx +87 -0
  80. package/src/components/inputs/DateTime/shared/DateTimeDialogFooter.tsx +42 -0
  81. package/src/components/inputs/DateTime/shared/MonthPicker.tsx +91 -0
  82. package/src/components/inputs/DateTime/shared/RangeCalendar.tsx +160 -0
  83. package/src/components/inputs/DateTime/shared/TimeField.tsx +36 -0
  84. package/src/components/inputs/DateTime/shared/TimePickerForm.tsx +222 -0
  85. package/src/components/inputs/DateTime/shared/TimePickerInput.tsx +114 -0
  86. package/src/components/inputs/DateTime/shared/YearPicker.tsx +100 -0
  87. package/src/components/inputs/File/FileUpload.tsx +285 -0
  88. package/src/components/inputs/File/FileUploadContainer.tsx +16 -0
  89. package/src/components/inputs/File/InputUpload.tsx +196 -0
  90. package/src/components/inputs/File/fileUpload.types.ts +100 -0
  91. package/src/components/inputs/File/index.ts +15 -0
  92. package/src/components/inputs/File/inputUpload.types.ts +41 -0
  93. package/src/components/inputs/File/shared/FileCard.tsx +72 -0
  94. package/src/components/inputs/File/shared/FileCardList.tsx +30 -0
  95. package/src/components/inputs/File/shared/FileProgressBar.tsx +25 -0
  96. package/src/components/inputs/File/shared/FileUploadContent.tsx +99 -0
  97. package/src/components/inputs/File/shared/FileUploadContentEmpty.tsx +94 -0
  98. package/src/components/inputs/File/shared/FileUploadContentError.tsx +170 -0
  99. package/src/components/inputs/File/shared/FileUploadContentFilled.tsx +179 -0
  100. package/src/components/inputs/File/shared/FileUploadContentLoading.tsx +115 -0
  101. package/src/components/inputs/File/shared/InputUploadContent.tsx +68 -0
  102. package/src/components/inputs/File/shared/InputUploadFilled.tsx +32 -0
  103. package/src/components/inputs/File/shared/fileUpload.cva.ts +59 -0
  104. package/src/components/inputs/File/shared/inputUploadButton.cva.ts +48 -0
  105. package/src/components/inputs/FormField/FormField.tsx +69 -0
  106. package/src/components/inputs/FormField/FormFieldError.tsx +21 -0
  107. package/src/components/inputs/FormField/FormFieldHeader.tsx +75 -0
  108. package/src/components/inputs/FormField/FormFieldHeaderClose.tsx +23 -0
  109. package/src/components/inputs/FormField/FormFieldLabel.tsx +41 -0
  110. package/src/components/inputs/Input/NumberInput/NumberInput.tsx +180 -0
  111. package/src/components/inputs/Input/PasswordInput/PasswordInput.tsx +34 -0
  112. package/src/components/inputs/Input/TextArea/TextArea.tsx +166 -0
  113. package/src/components/inputs/Input/TextInput/TextInput.tsx +181 -0
  114. package/src/components/inputs/Input/shared/InputContent.tsx +154 -0
  115. package/src/components/inputs/Inputs/Form.tsx +129 -0
  116. package/src/components/inputs/Inputs/InputItem.tsx +127 -0
  117. package/src/components/inputs/Inputs/Inputs.tsx +43 -0
  118. package/src/components/inputs/RadioGroup/RadioGroup.tsx +139 -0
  119. package/src/components/inputs/RadioGroup/radio.cva.ts +51 -0
  120. package/src/components/inputs/Selection/Autocomplete/Autocomplete.tsx +61 -0
  121. package/src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx +58 -0
  122. package/src/components/inputs/Selection/Select/Select.tsx +59 -0
  123. package/src/components/inputs/Selection/shared/SelectBase.tsx +69 -0
  124. package/src/components/inputs/Selection/shared/SelectDesktop.tsx +236 -0
  125. package/src/components/inputs/Selection/shared/SelectInput.tsx +278 -0
  126. package/src/components/inputs/Selection/shared/SelectListBox.tsx +121 -0
  127. package/src/components/inputs/Selection/shared/SelectListBoxItem.tsx +79 -0
  128. package/src/components/inputs/Selection/shared/SelectListBoxItemSelectAll.tsx +40 -0
  129. package/src/components/inputs/Selection/shared/SelectListBoxLoadingItem.tsx +52 -0
  130. package/src/components/inputs/Selection/shared/SelectListBoxSelectionBar.tsx +39 -0
  131. package/src/components/inputs/Selection/shared/SelectMobile.tsx +169 -0
  132. package/src/components/inputs/Selection/shared/select.context.tsx +316 -0
  133. package/src/components/inputs/Selection/shared/select.types.ts +75 -0
  134. package/src/components/inputs/Selection/shared/useSelectItems.tsx +127 -0
  135. package/src/components/inputs/Slider/Slider.tsx +174 -0
  136. package/src/components/inputs/TextEditor/TextEditor.tsx +239 -0
  137. package/src/components/inputs/TextEditor/Toolbar/ColorPicker.tsx +34 -0
  138. package/src/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.tsx +74 -0
  139. package/src/components/inputs/TextEditor/Toolbar/HyperlinkAction.tsx +87 -0
  140. package/src/components/inputs/TextEditor/Toolbar/TextAlignSelect.tsx +64 -0
  141. package/src/components/inputs/TextEditor/Toolbar/TextColorSelect.tsx +30 -0
  142. package/src/components/inputs/TextEditor/Toolbar/TextEditorToolbar.tsx +40 -0
  143. package/src/components/inputs/TextEditor/Toolbar/TextHighlightSelect.tsx +39 -0
  144. package/src/components/inputs/TextEditor/Toolbar/TextListActions.tsx +57 -0
  145. package/src/components/inputs/TextEditor/Toolbar/TextMarksActions.tsx +79 -0
  146. package/src/components/inputs/TextEditor/Toolbar/TextStyleSelect.tsx +73 -0
  147. package/src/components/inputs/TextEditor/textEditor.types.ts +43 -0
  148. package/src/components/inputs/Toggle/Toggle.tsx +80 -0
  149. package/src/components/inputs/Toggle/toggle.cva.ts +48 -0
  150. package/src/components/inputs/shared/CheckContent.tsx +26 -0
  151. package/src/components/inputs/shared/InputClear.tsx +29 -0
  152. package/src/components/inputs/shared/form.types.ts +28 -0
  153. package/src/components/inputs/shared/input.cva.ts +182 -0
  154. package/src/components/inputs/shared/label.cva.ts +146 -0
  155. package/src/components/outline.clsx.ts +9 -0
  156. package/src/components/overlays/ActionModal/ActionModal.tsx +93 -0
  157. package/src/components/overlays/BottomSheet/BottomSheet.tsx +270 -0
  158. package/src/components/overlays/Drawer/Drawer.tsx +93 -0
  159. package/src/components/overlays/Modal/Modal.tsx +63 -0
  160. package/src/components/overlays/Modal/modal.cva.ts +55 -0
  161. package/src/components/overlays/ResponsivePopover/ResponsivePopover.tsx +77 -0
  162. package/src/components/overlays/Tooltip/Tooltip.tsx +47 -0
  163. package/src/components/overlays/Tooltip/TooltipEllipsis.tsx +35 -0
  164. package/src/components/segment/Segment.tsx +121 -0
  165. package/src/components/segment/SegmentItem.tsx +41 -0
  166. package/src/components/segment/segment.types.ts +44 -0
  167. package/src/components/shared/pagination/Pagination.tsx +75 -0
  168. package/src/components/shared/pagination/PaginationList.tsx +174 -0
  169. package/src/components/shared/pagination/minWidth.cva.ts +13 -0
  170. package/src/components/status/Alert/Alert.tsx +58 -0
  171. package/src/components/status/Alert/alert.cva.ts +66 -0
  172. package/src/components/status/Loader/Loader.tsx +32 -0
  173. package/src/components/status/Loader/loader.cva.ts +29 -0
  174. package/src/components/status/Toast/Toast.tsx +86 -0
  175. package/src/components/status/Toast/toast.cva.ts +154 -0
  176. package/src/components/status/Toast/useToast.tsx +77 -0
  177. package/src/components/status/shared/status.cva.ts +60 -0
  178. package/src/components/table/CellText.tsx +23 -0
  179. package/src/components/table/ColumnConfig.tsx +145 -0
  180. package/src/components/table/HeaderText.tsx +18 -0
  181. package/src/components/table/InfiniteTable.tsx +51 -0
  182. package/src/components/table/PaginatedTable.tsx +38 -0
  183. package/src/components/table/Table.tsx +456 -0
  184. package/src/components/table/table.cva.ts +47 -0
  185. package/src/components/text/Link/Link.tsx +21 -0
  186. package/src/components/text/Link/link.cva.ts +21 -0
  187. package/src/components/text/Tag/Tag.tsx +59 -0
  188. package/src/components/text/Tag/tag.cva.ts +62 -0
  189. package/src/components/text/Typography/Typography.tsx +33 -0
  190. package/src/components/text/Typography/typography.cva.ts +102 -0
  191. package/src/config/confirmation.context.tsx +133 -0
  192. package/src/config/i18n.ts +12 -0
  193. package/src/config/router.context.tsx +66 -0
  194. package/src/config/uiConfig.context.tsx +89 -0
  195. package/src/config/uiStyle.context.tsx +100 -0
  196. package/src/helpers/dynamicColumns.ts +567 -0
  197. package/src/helpers/dynamicInputs.ts +392 -0
  198. package/src/hooks/useAutosave.ts +109 -0
  199. package/src/hooks/useBreakpoint.ts +26 -0
  200. package/src/hooks/useDebounceCallback.ts +35 -0
  201. package/src/hooks/useDeepCompare.ts +27 -0
  202. package/src/hooks/useFilters.ts +154 -0
  203. package/src/hooks/useForm.ts +54 -0
  204. package/src/hooks/useFormAutosave.ts +100 -0
  205. package/src/hooks/useIntersectionObserver.ts +33 -0
  206. package/src/hooks/useLocalStorage.ts +81 -0
  207. package/src/hooks/useLongPressRepeat.ts +40 -0
  208. package/src/hooks/usePagination.ts +41 -0
  209. package/src/hooks/useScrollableListBox.ts +35 -0
  210. package/src/hooks/useSingletonMutation.ts +30 -0
  211. package/src/hooks/useSorting.ts +39 -0
  212. package/src/hooks/useStateAndRef.ts +20 -0
  213. package/src/hooks/useTableColumnConfig.ts +86 -0
  214. package/src/hooks/useTableNav.ts +615 -0
  215. package/src/hooks/useTranslationMemo.ts +17 -0
  216. package/src/index.ts +252 -0
  217. package/src/types/{common.d.ts → common.ts} +15 -4
  218. package/src/types/i18next.d.ts +11 -0
  219. package/src/types/react-query.ts +48 -0
  220. package/src/types/table.d.ts +17 -0
  221. package/src/utils/array.utils.spec.ts +16 -0
  222. package/src/utils/array.utils.ts +9 -0
  223. package/src/utils/compoundMapper.spec.ts +91 -0
  224. package/src/utils/compoundMapper.ts +42 -0
  225. package/src/utils/date-time.utils.spec.ts +48 -0
  226. package/src/utils/date-time.utils.ts +85 -0
  227. package/src/utils/date.utils.spec.ts +12 -0
  228. package/src/utils/date.utils.ts +9 -0
  229. package/src/utils/dom.utils.ts +16 -0
  230. package/src/utils/file.utils.ts +73 -0
  231. package/src/utils/isEqual.ts +153 -0
  232. package/src/utils/logger.ts +19 -0
  233. package/src/utils/object.utils.ts +62 -0
  234. package/src/utils/queries.utils.ts +10 -0
  235. package/src/utils/rest/interceptors/logging.interceptor.ts +16 -0
  236. package/src/utils/rest/interceptors/response.interceptor.ts +27 -0
  237. package/src/utils/rest/interceptors/rest-interceptor.ts +22 -0
  238. package/src/utils/rest/rest-client.ts +125 -0
  239. package/src/utils/rest/rest.utils.ts +65 -0
  240. package/src/utils/routing.utils.ts +12 -0
  241. package/src/utils/string.utils.ts +9 -0
  242. package/src/utils/vendor/error-handling.ts +170 -0
  243. package/src/utils/zod.utils.ts +95 -0
  244. package/index.js +0 -61206
  245. package/povio-ui-0.0.2.tgz +0 -0
  246. package/src/assets/icons/AlignCenter.d.ts +0 -2
  247. package/src/assets/icons/AlignLeft.d.ts +0 -2
  248. package/src/assets/icons/AlignLeftRight.d.ts +0 -2
  249. package/src/assets/icons/AlignRight.d.ts +0 -2
  250. package/src/assets/icons/ArrowDropDown.d.ts +0 -2
  251. package/src/assets/icons/ArrowDropUp.d.ts +0 -2
  252. package/src/assets/icons/ArrowLeft.d.ts +0 -2
  253. package/src/assets/icons/ArrowRight.d.ts +0 -2
  254. package/src/assets/icons/Bold.d.ts +0 -2
  255. package/src/assets/icons/BulletedList.d.ts +0 -2
  256. package/src/assets/icons/Calendar.d.ts +0 -2
  257. package/src/assets/icons/Check.d.ts +0 -2
  258. package/src/assets/icons/CheckCircle.d.ts +0 -2
  259. package/src/assets/icons/CheckboxCheckmark.d.ts +0 -2
  260. package/src/assets/icons/CheckboxIndeterminate.d.ts +0 -2
  261. package/src/assets/icons/ChevronDown.d.ts +0 -2
  262. package/src/assets/icons/ChevronLeft.d.ts +0 -2
  263. package/src/assets/icons/ChevronRight.d.ts +0 -2
  264. package/src/assets/icons/ChevronUp.d.ts +0 -2
  265. package/src/assets/icons/ChevronsLeft.d.ts +0 -2
  266. package/src/assets/icons/ChevronsRight.d.ts +0 -2
  267. package/src/assets/icons/Clock.d.ts +0 -2
  268. package/src/assets/icons/Close.d.ts +0 -2
  269. package/src/assets/icons/DateTime.d.ts +0 -2
  270. package/src/assets/icons/Drag.d.ts +0 -2
  271. package/src/assets/icons/File.d.ts +0 -2
  272. package/src/assets/icons/Highlight.d.ts +0 -2
  273. package/src/assets/icons/HighlightOn.d.ts +0 -6
  274. package/src/assets/icons/Info.d.ts +0 -2
  275. package/src/assets/icons/Italic.d.ts +0 -2
  276. package/src/assets/icons/Link.d.ts +0 -2
  277. package/src/assets/icons/Menu.d.ts +0 -2
  278. package/src/assets/icons/NumberedList.d.ts +0 -2
  279. package/src/assets/icons/PointerHorizontal.d.ts +0 -2
  280. package/src/assets/icons/PointerVertical.d.ts +0 -2
  281. package/src/assets/icons/Send.d.ts +0 -2
  282. package/src/assets/icons/Strikethrough.d.ts +0 -2
  283. package/src/assets/icons/TextColor.d.ts +0 -6
  284. package/src/assets/icons/Today.d.ts +0 -2
  285. package/src/assets/icons/Underlined.d.ts +0 -2
  286. package/src/assets/icons/Upload.d.ts +0 -2
  287. package/src/assets/icons/View.d.ts +0 -2
  288. package/src/assets/icons/ViewOff.d.ts +0 -2
  289. package/src/assets/icons/Warningfilled.d.ts +0 -2
  290. package/src/components/Menu/Menu.d.ts +0 -14
  291. package/src/components/Menu/MenuDesktop.d.ts +0 -2
  292. package/src/components/Menu/MenuItem.d.ts +0 -5
  293. package/src/components/Menu/MenuMobile.d.ts +0 -2
  294. package/src/components/Menu/MenuPopover.d.ts +0 -5
  295. package/src/components/buttons/Button/Button.d.ts +0 -27
  296. package/src/components/buttons/Button/button.cva.d.ts +0 -30
  297. package/src/components/buttons/IconButton/IconButton.d.ts +0 -10
  298. package/src/components/buttons/InlineIconButton/InlineIconButton.d.ts +0 -11
  299. package/src/components/buttons/PillButton/PillButton.d.ts +0 -11
  300. package/src/components/buttons/PillButton/pillButton.cva.d.ts +0 -14
  301. package/src/components/buttons/SplitButton/SplitButton.d.ts +0 -10
  302. package/src/components/buttons/TextButton/TextButton.d.ts +0 -11
  303. package/src/components/buttons/ToggleButton/ToggleButton.d.ts +0 -9
  304. package/src/components/buttons/shared/ButtonContent.d.ts +0 -16
  305. package/src/components/buttons/shared/buttonContent.cva.d.ts +0 -6
  306. package/src/components/inputs/Checkbox/Checkbox.d.ts +0 -17
  307. package/src/components/inputs/Checkbox/CheckboxCheckmark.d.ts +0 -9
  308. package/src/components/inputs/Checkbox/checkbox.cva.d.ts +0 -11
  309. package/src/components/inputs/DateTime/DatePicker/DatePicker.d.ts +0 -24
  310. package/src/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +0 -32
  311. package/src/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +0 -22
  312. package/src/components/inputs/DateTime/TimePicker/TimePicker.d.ts +0 -20
  313. package/src/components/inputs/DateTime/shared/Calendar.d.ts +0 -20
  314. package/src/components/inputs/DateTime/shared/CalendarCell.d.ts +0 -20
  315. package/src/components/inputs/DateTime/shared/CalendarGrid.d.ts +0 -25
  316. package/src/components/inputs/DateTime/shared/CalendarHeader.d.ts +0 -16
  317. package/src/components/inputs/DateTime/shared/CalendarSelectHeader.d.ts +0 -17
  318. package/src/components/inputs/DateTime/shared/DateField.d.ts +0 -12
  319. package/src/components/inputs/DateTime/shared/DatePickerInput.d.ts +0 -20
  320. package/src/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -11
  321. package/src/components/inputs/DateTime/shared/DateTimeDialog.d.ts +0 -15
  322. package/src/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +0 -7
  323. package/src/components/inputs/DateTime/shared/MonthPicker.d.ts +0 -7
  324. package/src/components/inputs/DateTime/shared/RangeCalendar.d.ts +0 -26
  325. package/src/components/inputs/DateTime/shared/TimeField.d.ts +0 -12
  326. package/src/components/inputs/DateTime/shared/TimePickerForm.d.ts +0 -10
  327. package/src/components/inputs/DateTime/shared/TimePickerInput.d.ts +0 -18
  328. package/src/components/inputs/DateTime/shared/YearPicker.d.ts +0 -8
  329. package/src/components/inputs/File/FileUpload.d.ts +0 -4
  330. package/src/components/inputs/File/FileUploadContainer.d.ts +0 -3
  331. package/src/components/inputs/File/InputUpload.d.ts +0 -4
  332. package/src/components/inputs/File/fileUpload.types.d.ts +0 -79
  333. package/src/components/inputs/File/index.d.ts +0 -9
  334. package/src/components/inputs/File/inputUpload.types.d.ts +0 -30
  335. package/src/components/inputs/File/shared/FileCard.d.ts +0 -9
  336. package/src/components/inputs/File/shared/FileCardList.d.ts +0 -9
  337. package/src/components/inputs/File/shared/FileProgressBar.d.ts +0 -3
  338. package/src/components/inputs/File/shared/FileUploadContent.d.ts +0 -10
  339. package/src/components/inputs/File/shared/FileUploadContentEmpty.d.ts +0 -9
  340. package/src/components/inputs/File/shared/FileUploadContentError.d.ts +0 -11
  341. package/src/components/inputs/File/shared/FileUploadContentFilled.d.ts +0 -11
  342. package/src/components/inputs/File/shared/FileUploadContentLoading.d.ts +0 -9
  343. package/src/components/inputs/File/shared/InputUploadContent.d.ts +0 -8
  344. package/src/components/inputs/File/shared/InputUploadFilled.d.ts +0 -7
  345. package/src/components/inputs/File/shared/fileUpload.cva.d.ts +0 -11
  346. package/src/components/inputs/File/shared/inputUploadButton.cva.d.ts +0 -10
  347. package/src/components/inputs/FormField/FormField.d.ts +0 -17
  348. package/src/components/inputs/FormField/FormFieldError.d.ts +0 -7
  349. package/src/components/inputs/FormField/FormFieldHeader.d.ts +0 -14
  350. package/src/components/inputs/FormField/FormFieldHeaderClose.d.ts +0 -5
  351. package/src/components/inputs/FormField/FormFieldLabel.d.ts +0 -11
  352. package/src/components/inputs/Input/NumberInput/NumberInput.d.ts +0 -18
  353. package/src/components/inputs/Input/PasswordInput/PasswordInput.d.ts +0 -7
  354. package/src/components/inputs/Input/TextArea/TextArea.d.ts +0 -17
  355. package/src/components/inputs/Input/TextInput/TextInput.d.ts +0 -19
  356. package/src/components/inputs/Input/shared/InputContent.d.ts +0 -27
  357. package/src/components/inputs/Inputs/Form.d.ts +0 -26
  358. package/src/components/inputs/Inputs/InputItem.d.ts +0 -73
  359. package/src/components/inputs/Inputs/Inputs.d.ts +0 -10
  360. package/src/components/inputs/RadioGroup/RadioGroup.d.ts +0 -18
  361. package/src/components/inputs/RadioGroup/radio.cva.d.ts +0 -11
  362. package/src/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +0 -8
  363. package/src/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +0 -19
  364. package/src/components/inputs/Selection/Select/Select.d.ts +0 -8
  365. package/src/components/inputs/Selection/shared/SelectBase.d.ts +0 -24
  366. package/src/components/inputs/Selection/shared/SelectDesktop.d.ts +0 -5
  367. package/src/components/inputs/Selection/shared/SelectInput.d.ts +0 -15
  368. package/src/components/inputs/Selection/shared/SelectListBox.d.ts +0 -9
  369. package/src/components/inputs/Selection/shared/SelectListBoxItem.d.ts +0 -8
  370. package/src/components/inputs/Selection/shared/SelectListBoxItemSelectAll.d.ts +0 -4
  371. package/src/components/inputs/Selection/shared/SelectListBoxLoadingItem.d.ts +0 -6
  372. package/src/components/inputs/Selection/shared/SelectListBoxSelectionBar.d.ts +0 -5
  373. package/src/components/inputs/Selection/shared/SelectMobile.d.ts +0 -5
  374. package/src/components/inputs/Selection/shared/select.context.d.ts +0 -30
  375. package/src/components/inputs/Selection/shared/select.types.d.ts +0 -55
  376. package/src/components/inputs/Selection/shared/useSelectItems.d.ts +0 -23
  377. package/src/components/inputs/Slider/Slider.d.ts +0 -18
  378. package/src/components/inputs/TextEditor/TextEditor.d.ts +0 -20
  379. package/src/components/inputs/TextEditor/Toolbar/ColorPicker.d.ts +0 -7
  380. package/src/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.d.ts +0 -10
  381. package/src/components/inputs/TextEditor/Toolbar/HyperlinkAction.d.ts +0 -2
  382. package/src/components/inputs/TextEditor/Toolbar/TextAlignSelect.d.ts +0 -2
  383. package/src/components/inputs/TextEditor/Toolbar/TextColorSelect.d.ts +0 -2
  384. package/src/components/inputs/TextEditor/Toolbar/TextEditorToolbar.d.ts +0 -6
  385. package/src/components/inputs/TextEditor/Toolbar/TextHighlightSelect.d.ts +0 -2
  386. package/src/components/inputs/TextEditor/Toolbar/TextListActions.d.ts +0 -2
  387. package/src/components/inputs/TextEditor/Toolbar/TextMarksActions.d.ts +0 -2
  388. package/src/components/inputs/TextEditor/Toolbar/TextStyleSelect.d.ts +0 -2
  389. package/src/components/inputs/TextEditor/textEditor.types.d.ts +0 -5
  390. package/src/components/inputs/Toggle/Toggle.d.ts +0 -14
  391. package/src/components/inputs/Toggle/toggle.cva.d.ts +0 -10
  392. package/src/components/inputs/shared/CheckContent.d.ts +0 -7
  393. package/src/components/inputs/shared/InputClear.d.ts +0 -6
  394. package/src/components/inputs/shared/form.types.d.ts +0 -12
  395. package/src/components/inputs/shared/input.cva.d.ts +0 -22
  396. package/src/components/inputs/shared/label.cva.d.ts +0 -10
  397. package/src/components/outline.clsx.d.ts +0 -2
  398. package/src/components/overlays/ActionModal/ActionModal.d.ts +0 -19
  399. package/src/components/overlays/BottomSheet/BottomSheet.d.ts +0 -21
  400. package/src/components/overlays/Drawer/Drawer.d.ts +0 -13
  401. package/src/components/overlays/Modal/Modal.d.ts +0 -11
  402. package/src/components/overlays/Modal/modal.cva.d.ts +0 -12
  403. package/src/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +0 -10
  404. package/src/components/overlays/Tooltip/Tooltip.d.ts +0 -9
  405. package/src/components/overlays/Tooltip/TooltipEllipsis.d.ts +0 -7
  406. package/src/components/segment/Segment.d.ts +0 -4
  407. package/src/components/segment/SegmentItem.d.ts +0 -2
  408. package/src/components/segment/segment.types.d.ts +0 -34
  409. package/src/components/shared/pagination/Pagination.d.ts +0 -9
  410. package/src/components/shared/pagination/PaginationList.d.ts +0 -15
  411. package/src/components/shared/pagination/minWidth.cva.d.ts +0 -3
  412. package/src/components/status/Alert/Alert.d.ts +0 -11
  413. package/src/components/status/Alert/alert.cva.d.ts +0 -7
  414. package/src/components/status/Loader/Loader.d.ts +0 -5
  415. package/src/components/status/Loader/loader.cva.d.ts +0 -9
  416. package/src/components/status/Toast/Toast.d.ts +0 -14
  417. package/src/components/status/Toast/toast.cva.d.ts +0 -18
  418. package/src/components/status/Toast/useToast.d.ts +0 -12
  419. package/src/components/status/shared/status.cva.d.ts +0 -8
  420. package/src/components/table/CellText.d.ts +0 -7
  421. package/src/components/table/ColumnConfig.d.ts +0 -10
  422. package/src/components/table/HeaderText.d.ts +0 -5
  423. package/src/components/table/InfiniteTable.d.ts +0 -9
  424. package/src/components/table/PaginatedTable.d.ts +0 -11
  425. package/src/components/table/Table.d.ts +0 -37
  426. package/src/components/table/table.cva.d.ts +0 -15
  427. package/src/components/text/Link/Link.d.ts +0 -7
  428. package/src/components/text/Link/link.cva.d.ts +0 -6
  429. package/src/components/text/Tag/Tag.d.ts +0 -10
  430. package/src/components/text/Tag/tag.cva.d.ts +0 -6
  431. package/src/components/text/Typography/Typography.d.ts +0 -11
  432. package/src/components/text/Typography/typography.cva.d.ts +0 -8
  433. package/src/config/confirmation.context.d.ts +0 -20
  434. package/src/config/i18n.d.ts +0 -315
  435. package/src/config/router.context.d.ts +0 -20
  436. package/src/config/uiConfig.context.d.ts +0 -28
  437. package/src/config/uiStyle.context.d.ts +0 -84
  438. package/src/helpers/dynamicColumns.d.ts +0 -44
  439. package/src/helpers/dynamicInputs.d.ts +0 -83
  440. package/src/hooks/useAutosave.d.ts +0 -9
  441. package/src/hooks/useBreakpoint.d.ts +0 -3
  442. package/src/hooks/useDebounceCallback.d.ts +0 -6
  443. package/src/hooks/useDeepCompare.d.ts +0 -4
  444. package/src/hooks/useFilters.d.ts +0 -7
  445. package/src/hooks/useForm.d.ts +0 -18
  446. package/src/hooks/useFormAutosave.d.ts +0 -13
  447. package/src/hooks/useIntersectionObserver.d.ts +0 -7
  448. package/src/hooks/useLocalStorage.d.ts +0 -13
  449. package/src/hooks/useLongPressRepeat.d.ts +0 -9
  450. package/src/hooks/usePagination.d.ts +0 -7
  451. package/src/hooks/useScrollableListBox.d.ts +0 -3
  452. package/src/hooks/useSingletonMutation.d.ts +0 -2
  453. package/src/hooks/useSorting.d.ts +0 -6
  454. package/src/hooks/useStateAndRef.d.ts +0 -4
  455. package/src/hooks/useTableColumnConfig.d.ts +0 -16
  456. package/src/hooks/useTableNav.d.ts +0 -84
  457. package/src/hooks/useTranslationMemo.d.ts +0 -4
  458. package/src/index.d.ts +0 -205
  459. package/src/types/react-query.d.ts +0 -6
  460. package/src/utils/array.utils.d.ts +0 -3
  461. package/src/utils/array.utils.spec.d.ts +0 -1
  462. package/src/utils/compoundMapper.d.ts +0 -19
  463. package/src/utils/compoundMapper.spec.d.ts +0 -1
  464. package/src/utils/date-time.utils.d.ts +0 -14
  465. package/src/utils/date-time.utils.spec.d.ts +0 -1
  466. package/src/utils/date.utils.d.ts +0 -3
  467. package/src/utils/date.utils.spec.d.ts +0 -1
  468. package/src/utils/dom.utils.d.ts +0 -5
  469. package/src/utils/file.utils.d.ts +0 -9
  470. package/src/utils/isEqual.d.ts +0 -1
  471. package/src/utils/logger.d.ts +0 -7
  472. package/src/utils/object.utils.d.ts +0 -10
  473. package/src/utils/queries.utils.d.ts +0 -4
  474. package/src/utils/rest/interceptors/logging.interceptor.d.ts +0 -2
  475. package/src/utils/rest/interceptors/response.interceptor.d.ts +0 -2
  476. package/src/utils/rest/interceptors/rest-interceptor.d.ts +0 -8
  477. package/src/utils/rest/rest-client.d.ts +0 -29
  478. package/src/utils/rest/rest.utils.d.ts +0 -10
  479. package/src/utils/routing.utils.d.ts +0 -3
  480. package/src/utils/string.utils.d.ts +0 -4
  481. package/src/utils/vendor/error-handling.d.ts +0 -21
  482. package/src/utils/zod.utils.d.ts +0 -19
  483. package/vite.config.d.ts +0 -2
  484. /package/{styles → src/styles}/editor.css +0 -0
  485. /package/{styles → src/styles}/index.css +0 -0
@@ -0,0 +1,83 @@
1
+ import { type CalendarDate, createCalendar } from "@internationalized/date";
2
+ import type { DateFieldStateOptions } from "@react-stately/datepicker";
3
+ import { type FocusEvent, type Ref, useEffect, useImperativeHandle, useRef } from "react";
4
+ import { useDateField, useLocale } from "react-aria";
5
+ import { useDateFieldState } from "react-stately";
6
+
7
+ import { DateSegmentItem } from "#ui/components/inputs/DateTime/shared/DateSegmentItem";
8
+
9
+ export interface DateFieldHandle {
10
+ clearField: () => void;
11
+ }
12
+
13
+ interface DateFieldProps extends Omit<DateFieldStateOptions, "locale" | "createCalendar"> {
14
+ ref?: Ref<DateFieldHandle>;
15
+ onClearChange?: (canClear: boolean) => void;
16
+ hidePlaceholder?: boolean;
17
+ }
18
+
19
+ export const DateField = ({ ref, onClearChange, hidePlaceholder, ...props }: DateFieldProps) => {
20
+ const { locale } = useLocale();
21
+ const state = useDateFieldState({
22
+ ...props,
23
+ locale,
24
+ createCalendar,
25
+ });
26
+
27
+ const dataFieldRef = useRef<HTMLDivElement>(null);
28
+ const { fieldProps } = useDateField(props, state, dataFieldRef);
29
+
30
+ const handleBlur = (e: FocusEvent<HTMLDivElement>) => {
31
+ fieldProps.onBlur?.(e);
32
+
33
+ if (!state.value) {
34
+ return;
35
+ }
36
+
37
+ const currentValue = state.value as CalendarDate;
38
+ const { year } = currentValue;
39
+
40
+ if (year >= 0 && year <= 99) {
41
+ const correctedYear = year <= 50 ? 2000 + year : 1900 + year;
42
+
43
+ const correctedDate = currentValue.set({ year: correctedYear });
44
+
45
+ if (correctedDate) {
46
+ state.setValue(correctedDate);
47
+ props.onChange?.(correctedDate);
48
+ }
49
+ }
50
+ };
51
+
52
+ useImperativeHandle(ref, () => ({
53
+ clearField: () => {
54
+ state.setValue(null);
55
+ },
56
+ }));
57
+
58
+ useEffect(() => {
59
+ onClearChange?.(state.segments.some((segment) => segment.type !== "literal" && segment.isPlaceholder === false));
60
+ }, [state.segments, onClearChange]);
61
+
62
+ return (
63
+ <div
64
+ {...fieldProps}
65
+ ref={dataFieldRef}
66
+ onBlur={handleBlur}
67
+ className="relative w-full"
68
+ >
69
+ <div className="flex">
70
+ {state.segments.map((segment, i) => (
71
+ <DateSegmentItem
72
+ // oxlint-disable-next-line react/no-array-index-key
73
+ key={i}
74
+ segment={segment}
75
+ state={state}
76
+ isDisabled={props.isDisabled}
77
+ hidePlaceholder={hidePlaceholder}
78
+ />
79
+ ))}
80
+ </div>
81
+ </div>
82
+ );
83
+ };
@@ -0,0 +1,170 @@
1
+ import { getLocalTimeZone, now, today } from "@internationalized/date";
2
+ import { clsx } from "clsx";
3
+ import { type Ref, useCallback, useMemo, useRef, useState } from "react";
4
+ import { type DatePickerAria, useFocusVisible, useFocusWithin, useHover } from "react-aria";
5
+ import useMeasure from "react-use-measure";
6
+
7
+ import { CalendarIcon } from "#ui/assets/icons/Calendar";
8
+ import { DateTimeIcon } from "#ui/assets/icons/DateTime";
9
+ import { TodayIcon } from "#ui/assets/icons/Today";
10
+ import { IconButton } from "#ui/components/buttons/IconButton/IconButton";
11
+ import { InlineIconButton } from "#ui/components/buttons/InlineIconButton/InlineIconButton";
12
+ import { DateField, type DateFieldHandle } from "#ui/components/inputs/DateTime/shared/DateField";
13
+ import type { FormFieldHeaderProps } from "#ui/components/inputs/FormField/FormFieldHeader";
14
+ import { FormFieldLabel } from "#ui/components/inputs/FormField/FormFieldLabel";
15
+ import { InputClear } from "#ui/components/inputs/shared/InputClear";
16
+ import { type InputVariantProps, useInputCva } from "#ui/components/inputs/shared/input.cva";
17
+
18
+ interface DatePickerInputProps extends InputVariantProps {
19
+ ref?: Ref<HTMLDivElement>;
20
+ groupProps: DatePickerAria["groupProps"];
21
+ fieldProps: DatePickerAria["fieldProps"];
22
+ endFieldProps?: DatePickerAria["fieldProps"];
23
+ buttonProps: DatePickerAria["buttonProps"];
24
+ isDisabled?: boolean;
25
+ isInvalid?: boolean;
26
+ disableDropdown?: boolean;
27
+ isDateTime?: boolean;
28
+ isClearable?: boolean;
29
+ headerProps?: FormFieldHeaderProps;
30
+ todayIcon?: boolean;
31
+ }
32
+
33
+ export const DatePickerInput = ({
34
+ ref,
35
+ as,
36
+ groupProps,
37
+ fieldProps,
38
+ endFieldProps,
39
+ buttonProps,
40
+ isDisabled,
41
+ isInvalid,
42
+ disableDropdown,
43
+ variant,
44
+ size,
45
+ isDateTime,
46
+ isClearable,
47
+ headerProps,
48
+ todayIcon,
49
+ ...props
50
+ }: DatePickerInputProps) => {
51
+ const inputCva = useInputCva();
52
+ const [canClear, setCanClear] = useState(false);
53
+ const { hoverProps, isHovered } = useHover({ isDisabled });
54
+ const [isFocused, setIsFocused] = useState(false);
55
+ const { focusWithinProps } = useFocusWithin({ onFocusWithinChange: setIsFocused });
56
+ const { isFocusVisible } = useFocusVisible();
57
+ const dateFieldRef = useRef<DateFieldHandle>(null);
58
+ const endDateFieldRef = useRef<DateFieldHandle>(null);
59
+ const [labelContentRef, { width: labelWidth }] = useMeasure();
60
+
61
+ const onClearChange = useCallback((canClearInput: boolean) => {
62
+ setCanClear(canClearInput);
63
+ }, []);
64
+
65
+ const onClear = () => {
66
+ dateFieldRef.current?.clearField();
67
+ fieldProps.onChange?.(null);
68
+ const timeout = setTimeout(() => {
69
+ endDateFieldRef.current?.clearField();
70
+ clearTimeout(timeout);
71
+ }, 0);
72
+ setCanClear(false);
73
+ };
74
+
75
+ const onToday = () => {
76
+ if (isDateTime) {
77
+ fieldProps.onChange?.(now(getLocalTimeZone()));
78
+ } else {
79
+ fieldProps.onChange?.(today(getLocalTimeZone()));
80
+ }
81
+ };
82
+
83
+ const hidePlaceholder = as === "floating" && !fieldProps.value && !isFocused;
84
+
85
+ const style = useMemo(() => {
86
+ const leftPadding = as === "filter" ? `var(--spacing-input-side-default) + ${labelWidth}` : "0";
87
+ return {
88
+ paddingLeft: `calc(${leftPadding}px)`,
89
+ };
90
+ }, [labelWidth, as]);
91
+
92
+ return (
93
+ <div
94
+ ref={ref}
95
+ className={inputCva({
96
+ variant,
97
+ as,
98
+ size,
99
+ ...props,
100
+ className: clsx("group/date-picker-content relative flex items-center justify-between gap-2"),
101
+ })}
102
+ data-rac=""
103
+ data-hovered={isHovered || undefined}
104
+ data-disabled={isDisabled || undefined}
105
+ data-invalid={isInvalid || undefined}
106
+ data-focus-within={isFocused || undefined}
107
+ data-focus-visible={(isFocused && isFocusVisible) || undefined}
108
+ data-has-selection={fieldProps.value !== null || undefined}
109
+ {...groupProps}
110
+ {...focusWithinProps}
111
+ {...hoverProps}
112
+ >
113
+ <div>
114
+ {as && ["filter", "floating"].includes(as) && headerProps && (
115
+ <FormFieldLabel
116
+ ref={labelContentRef}
117
+ as={as}
118
+ {...headerProps}
119
+ />
120
+ )}
121
+ <div
122
+ className="flex items-center gap-2"
123
+ style={style}
124
+ >
125
+ {todayIcon && (
126
+ <IconButton
127
+ label=""
128
+ icon={TodayIcon}
129
+ size="xxs"
130
+ onPress={onToday}
131
+ />
132
+ )}
133
+ <DateField
134
+ ref={dateFieldRef}
135
+ {...fieldProps}
136
+ isDisabled={isDisabled}
137
+ isInvalid={isInvalid}
138
+ onClearChange={onClearChange}
139
+ hidePlaceholder={hidePlaceholder}
140
+ />
141
+ {endFieldProps && (
142
+ <>
143
+ {!((as === "floating" || as === "filter") && hidePlaceholder) && <span className="select-none">–</span>}
144
+ <DateField
145
+ ref={endDateFieldRef}
146
+ {...endFieldProps}
147
+ isDisabled={isDisabled}
148
+ isInvalid={isInvalid}
149
+ onClearChange={onClearChange}
150
+ hidePlaceholder={hidePlaceholder}
151
+ />
152
+ </>
153
+ )}
154
+ </div>
155
+ </div>
156
+ <div className={clsx("flex items-center gap-2", as === "floating" && "-mt-4")}>
157
+ {isClearable && canClear && <InputClear onClear={onClear} />}
158
+ {!disableDropdown && (
159
+ <InlineIconButton
160
+ label=""
161
+ color="secondary"
162
+ {...buttonProps}
163
+ icon={isDateTime ? DateTimeIcon : CalendarIcon}
164
+ isDisabled={isDisabled}
165
+ />
166
+ )}
167
+ </div>
168
+ </div>
169
+ );
170
+ };
@@ -0,0 +1,65 @@
1
+ import type { DateFieldState, DateSegment } from "@react-stately/datepicker";
2
+ import { clsx } from "clsx";
3
+ import { useRef } from "react";
4
+ import { useDateSegment } from "react-aria";
5
+
6
+ interface DateSegmentProps {
7
+ state: DateFieldState;
8
+ segment: DateSegment;
9
+ isDisabled?: boolean;
10
+ timePickerOnly?: boolean;
11
+ hidePlaceholder?: boolean;
12
+ }
13
+
14
+ export const getPlaceholder = (segment: DateSegment): string | null => {
15
+ if (!segment.isPlaceholder) {
16
+ return null;
17
+ }
18
+
19
+ switch (segment.type) {
20
+ case "hour":
21
+ return "hh";
22
+ case "minute":
23
+ return "mm";
24
+ case "second":
25
+ return "ss";
26
+ default:
27
+ return segment.placeholder;
28
+ }
29
+ };
30
+
31
+ export const DateSegmentItem = ({ segment, state, isDisabled, timePickerOnly, hidePlaceholder }: DateSegmentProps) => {
32
+ const ref = useRef<HTMLDivElement>(null);
33
+ const { segmentProps } = useDateSegment(segment, state, ref);
34
+
35
+ const isInputEmpty = !state.value;
36
+
37
+ return (
38
+ <div
39
+ {...segmentProps}
40
+ ref={ref}
41
+ className={clsx(
42
+ "box-content rounded-input-rounding-default",
43
+ isDisabled && "text-interactive-text-secondary-disabled",
44
+ !isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1",
45
+ !isDisabled && !isInputEmpty && "text-text-default-1",
46
+ "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1",
47
+ ["hour", "dayPeriod"].includes(segment.type) && !timePickerOnly && "ml-1",
48
+ )}
49
+ >
50
+ {!hidePlaceholder && (
51
+ <>
52
+ {segment.isPlaceholder && (
53
+ <span
54
+ aria-hidden="true"
55
+ className="pointer-events-none"
56
+ >
57
+ {getPlaceholder(segment)}
58
+ </span>
59
+ )}
60
+ {segment.isPlaceholder ? "" : segment.text}
61
+ </>
62
+ )}
63
+ </div>
64
+ );
65
+ };
@@ -0,0 +1,87 @@
1
+ import type { ReactNode, RefObject } from "react";
2
+ import type { AriaDialogProps } from "react-aria";
3
+ import { Dialog as AriaDialog, Popover as AriaPopover } from "react-aria-components";
4
+
5
+ import { FormFieldHeader } from "#ui/components/inputs/FormField/FormFieldHeader";
6
+ import { FormFieldHeaderClose } from "#ui/components/inputs/FormField/FormFieldHeaderClose";
7
+ import { BottomSheet } from "#ui/components/overlays/BottomSheet/BottomSheet";
8
+ import { useBreakpoint } from "#ui/hooks/useBreakpoint";
9
+
10
+ interface DateTimeDialogProps {
11
+ children: ReactNode;
12
+ footer: ReactNode;
13
+ sidebar?: ReactNode;
14
+ hideSidebar?: boolean;
15
+ label: string;
16
+ isOpen: boolean;
17
+ triggerRef?: RefObject<HTMLElement | null>;
18
+ dialogProps?: AriaDialogProps;
19
+ onOpenChange: (open: boolean) => void;
20
+ }
21
+
22
+ export const DateTimeDialog = ({
23
+ hideSidebar,
24
+ children,
25
+ footer,
26
+ sidebar,
27
+ label,
28
+ isOpen,
29
+ triggerRef,
30
+ dialogProps,
31
+ onOpenChange,
32
+ }: DateTimeDialogProps) => {
33
+ const isDesktop = useBreakpoint("md");
34
+
35
+ if (isDesktop) {
36
+ if (!isOpen) {
37
+ return null;
38
+ }
39
+ return (
40
+ <AriaPopover
41
+ triggerRef={triggerRef}
42
+ isOpen={isOpen}
43
+ placement="bottom start"
44
+ onOpenChange={onOpenChange}
45
+ >
46
+ <AriaDialog
47
+ {...dialogProps}
48
+ className="!outline-none"
49
+ aria-label={label}
50
+ >
51
+ <div className="flex overflow-hidden rounded-input-rounding-default border border-elevation-outline-default-1 border-solid bg-elevation-fill-default-1 shadow-5">
52
+ {!hideSidebar && sidebar}
53
+ <div className="flex flex-1 flex-col justify-between">
54
+ {children}
55
+ {footer}
56
+ </div>
57
+ </div>
58
+ </AriaDialog>
59
+ </AriaPopover>
60
+ );
61
+ }
62
+
63
+ return (
64
+ <BottomSheet
65
+ label={label}
66
+ footer={footer}
67
+ isOpen={isOpen}
68
+ onOpenChange={onOpenChange}
69
+ sheetMarginBottom={0}
70
+ isScrollable={false}
71
+ height="auto"
72
+ isDismissable
73
+ >
74
+ {(close) => (
75
+ <>
76
+ <FormFieldHeader
77
+ label={label}
78
+ className="!mb-8 shrink-0 px-4 pt-3"
79
+ rightContent={<FormFieldHeaderClose onClose={close} />}
80
+ />
81
+ {children}
82
+ {!hideSidebar && sidebar}
83
+ </>
84
+ )}
85
+ </BottomSheet>
86
+ );
87
+ };
@@ -0,0 +1,42 @@
1
+ import { clsx } from "clsx";
2
+ import { useTranslation } from "react-i18next";
3
+
4
+ import { TextButton } from "#ui/components/buttons/TextButton/TextButton";
5
+ import { ns } from "#ui/config/i18n";
6
+
7
+ interface DatePickerFooterProps {
8
+ isValid?: boolean;
9
+ onTodayPress?: () => void;
10
+ onApply: () => void;
11
+ }
12
+
13
+ export const DateTimeDialogFooter = ({ isValid = true, onTodayPress, onApply }: DatePickerFooterProps) => {
14
+ const { t } = useTranslation(ns);
15
+
16
+ return (
17
+ <footer
18
+ className={clsx(
19
+ "flex shrink-0 items-center gap-2 bg-elevation-fill-default-2 px-4 py-3 md:border-elevation-outline-default-1 md:border-t md:bg-elevation-fill-default-1 md:py-1-5",
20
+ onTodayPress ? "justify-between" : "justify-end",
21
+ )}
22
+ >
23
+ {onTodayPress && (
24
+ <TextButton
25
+ type="button"
26
+ color="primary"
27
+ onPress={onTodayPress}
28
+ >
29
+ {t(($) => $.ui.datePicker.today)}
30
+ </TextButton>
31
+ )}
32
+ <TextButton
33
+ type="button"
34
+ color="secondary"
35
+ onPress={onApply}
36
+ isDisabled={!isValid}
37
+ >
38
+ {t(($) => $.ui.datePicker.save)}
39
+ </TextButton>
40
+ </footer>
41
+ );
42
+ };
@@ -0,0 +1,91 @@
1
+ import { useDateFormatter } from "@react-aria/i18n";
2
+ import type { CalendarState, RangeCalendarState } from "@react-stately/calendar";
3
+ import { clsx } from "clsx";
4
+ import { type Key, ListBox, ListBoxItem } from "react-aria-components";
5
+
6
+ import { Typography } from "#ui/components/text/Typography/Typography";
7
+
8
+ export interface MonthPickerProps {
9
+ state: CalendarState | RangeCalendarState;
10
+ onSelectionChange: (key: Set<Key>) => void;
11
+ }
12
+
13
+ export const MonthPicker = ({ state, onSelectionChange }: MonthPickerProps) => {
14
+ const formatter = useDateFormatter({
15
+ month: "long",
16
+ timeZone: state.timeZone,
17
+ });
18
+
19
+ const numMonths = state.focusedDate.calendar.getMonthsInYear(state.focusedDate);
20
+
21
+ const getMonths = () => {
22
+ const months: string[] = [];
23
+ for (let i = 1; i <= numMonths; i++) {
24
+ const date = state.focusedDate.set({ month: i });
25
+ months.push(formatter.format(date.toDate(state.timeZone)));
26
+ }
27
+ return months;
28
+ };
29
+
30
+ const isMonthDisabled = (month: number) => {
31
+ if (state.minValue && state.focusedDate.set({ month }) < state.minValue) {
32
+ return true;
33
+ }
34
+ if (state.maxValue && state.focusedDate.set({ month }) > state.maxValue) {
35
+ return true;
36
+ }
37
+ return false;
38
+ };
39
+
40
+ return (
41
+ <ListBox
42
+ autoFocus
43
+ aria-label="Month"
44
+ selectionMode="single"
45
+ layout="grid"
46
+ selectedKeys={[state.focusedDate.month]}
47
+ onSelectionChange={(key) => {
48
+ if (key === "all") {
49
+ return;
50
+ }
51
+
52
+ const index = [...key][0];
53
+
54
+ if (typeof index === "number") {
55
+ const date = state.focusedDate.set({ month: [...key][0] as number });
56
+ state.setFocusedDate(date);
57
+ }
58
+
59
+ onSelectionChange(key);
60
+ }}
61
+ className="grid size-full min-h-72 grid-cols-3 grid-rows-4 gap-2 p-3 md:w-80"
62
+ >
63
+ {getMonths().map((month, index) => {
64
+ const isDisabled = isMonthDisabled(index + 1);
65
+ return (
66
+ <ListBoxItem
67
+ key={month}
68
+ id={index + 1}
69
+ textValue={month}
70
+ isDisabled={isDisabled}
71
+ className={clsx(
72
+ "flex items-center justify-center text-interactive-text-secondary-idle",
73
+ "rounded-button-rounding-m border border-elevation-outline-default-1 border-solid bg-elevation-fill-default-1",
74
+ "hover:text-interactive-text-secondary-hover",
75
+ "selected:border-interactive-contained-primary-idle selected:bg-interactive-contained-primary-idle selected:text-interactive-text-secondary-idle-inverted",
76
+ "focus:outline-none focus-visible:outline-1 focus-visible:outline-interactive-contained-primary-focus focus-visible:outline-offset-1",
77
+ isDisabled ? "cursor-default opacity-50" : "cursor-pointer",
78
+ )}
79
+ >
80
+ <Typography
81
+ as="span"
82
+ size="label-2"
83
+ >
84
+ {month}
85
+ </Typography>
86
+ </ListBoxItem>
87
+ );
88
+ })}
89
+ </ListBox>
90
+ );
91
+ };
@@ -0,0 +1,160 @@
1
+ import type { CalendarDate } from "@internationalized/date";
2
+ import { useRangeCalendar } from "@react-aria/calendar";
3
+ import type { RangeCalendarState, RangeCalendarStateOptions } from "@react-stately/calendar";
4
+ import { clsx } from "clsx";
5
+ import { type KeyboardEvent, useMemo, useRef } from "react";
6
+ import type { DateValue } from "react-aria";
7
+
8
+ import { CalendarGrid } from "#ui/components/inputs/DateTime/shared/CalendarGrid";
9
+ import { CalendarSelectHeader } from "#ui/components/inputs/DateTime/shared/CalendarSelectHeader";
10
+
11
+ interface DateRange {
12
+ start: DateValue;
13
+ end: DateValue;
14
+ }
15
+
16
+ interface CalendarProps {
17
+ className?: string;
18
+ leftCalendarState: RangeCalendarState;
19
+ rightCalendarState: RangeCalendarState;
20
+ calendarProps: Omit<RangeCalendarStateOptions, "locale" | "createCalendar">;
21
+ onApply: () => void;
22
+ onRangeChange?: (value: DateRange | null) => void;
23
+ onDateSelection?: (date: DateValue, calendarSide?: "left" | "right") => void;
24
+ onDateHover?: (date: DateValue | null) => void;
25
+ rangeSelection?: {
26
+ start: DateValue | null;
27
+ end: DateValue | null;
28
+ isSelecting: boolean;
29
+ };
30
+ hoverDate?: DateValue | null;
31
+ onKeyboardNavigation?: (event: KeyboardEvent, date: DateValue, calendarSide: "left" | "right") => boolean;
32
+ }
33
+
34
+ export const RangeCalendar = ({
35
+ className,
36
+ leftCalendarState,
37
+ rightCalendarState,
38
+ calendarProps,
39
+ onApply,
40
+ onRangeChange: _onRangeChange,
41
+ onDateSelection,
42
+ onDateHover,
43
+ rangeSelection,
44
+ hoverDate,
45
+ onKeyboardNavigation,
46
+ }: CalendarProps) => {
47
+ const leftRef = useRef<HTMLDivElement | null>(null);
48
+ const rightRef = useRef<HTMLDivElement | null>(null);
49
+
50
+ const { calendarProps: leftCalendarAriaProps } = useRangeCalendar(calendarProps, leftCalendarState, leftRef);
51
+ const { calendarProps: rightCalendarAriaProps } = useRangeCalendar(calendarProps, rightCalendarState, rightRef);
52
+
53
+ const leftDate = leftCalendarState.visibleRange.start;
54
+ const rightDate = rightCalendarState.visibleRange.start;
55
+
56
+ const handleLeftKeyboardNavigation = (event: KeyboardEvent, date: DateValue) => {
57
+ return onKeyboardNavigation?.(event, date, "left") ?? false;
58
+ };
59
+
60
+ const handleRightKeyboardNavigation = (event: KeyboardEvent, date: DateValue) => {
61
+ return onKeyboardNavigation?.(event, date, "right") ?? false;
62
+ };
63
+
64
+ const handleLeftNavigate = (newDate: CalendarDate) => {
65
+ const rightCurrentDate = rightCalendarState.visibleRange.start;
66
+ if (
67
+ newDate.year < rightCurrentDate.year ||
68
+ (newDate.year === rightCurrentDate.year && newDate.month < rightCurrentDate.month)
69
+ ) {
70
+ leftCalendarState.setFocusedDate(newDate);
71
+ } else {
72
+ const closestValidDate = rightCurrentDate.subtract({ months: 1 });
73
+ leftCalendarState.setFocusedDate(closestValidDate);
74
+ }
75
+ };
76
+
77
+ const handleRightNavigate = (newDate: CalendarDate) => {
78
+ const leftCurrentDate = leftCalendarState.visibleRange.start;
79
+ if (
80
+ newDate.year > leftCurrentDate.year ||
81
+ (newDate.year === leftCurrentDate.year && newDate.month > leftCurrentDate.month)
82
+ ) {
83
+ rightCalendarState.setFocusedDate(newDate);
84
+ } else {
85
+ const closestValidDate = leftCurrentDate.add({ months: 1 });
86
+ rightCalendarState.setFocusedDate(closestValidDate);
87
+ }
88
+ };
89
+
90
+ const isNextDisabled = useMemo(() => {
91
+ return (
92
+ leftDate.year > rightDate.year ||
93
+ (leftDate.year === rightDate.year && leftDate.add({ months: 1 }).month === rightDate.month)
94
+ );
95
+ }, [leftDate, rightDate]);
96
+
97
+ const isPrevDisabled = useMemo(() => {
98
+ return (
99
+ rightDate.year < leftDate.year ||
100
+ (rightDate.year === leftDate.year && rightDate.subtract({ months: 1 }).month === leftDate.month)
101
+ );
102
+ }, [leftDate, rightDate]);
103
+
104
+ return (
105
+ <div className={clsx("flex w-fit flex-col items-center bg-elevation-fill-default-1", className)}>
106
+ <div className="flex">
107
+ <div
108
+ {...leftCalendarAriaProps}
109
+ ref={leftRef}
110
+ className="flex flex-col items-center"
111
+ >
112
+ <CalendarSelectHeader
113
+ state={leftCalendarState}
114
+ isNextMonthDisabled={isNextDisabled}
115
+ isNextYearDisabled={isNextDisabled}
116
+ onNavigate={handleLeftNavigate}
117
+ maxDate={rightDate}
118
+ />
119
+ <CalendarGrid
120
+ state={leftCalendarState}
121
+ onApply={onApply}
122
+ shouldCloseOnSelect={false}
123
+ onDateSelection={onDateSelection}
124
+ rangeSelection={rangeSelection}
125
+ onDateHover={onDateHover}
126
+ hoverDate={hoverDate}
127
+ onKeyboardNavigation={handleLeftKeyboardNavigation}
128
+ className="!w-[304px] h-64"
129
+ calendarSide="left"
130
+ />
131
+ </div>
132
+ <div
133
+ {...rightCalendarAriaProps}
134
+ ref={rightRef}
135
+ className="hidden flex-col items-center md:flex"
136
+ >
137
+ <CalendarSelectHeader
138
+ state={rightCalendarState}
139
+ isPrevMonthDisabled={isPrevDisabled}
140
+ isPrevYearDisabled={isPrevDisabled}
141
+ onNavigate={handleRightNavigate}
142
+ minDate={leftDate}
143
+ />
144
+ <CalendarGrid
145
+ state={rightCalendarState}
146
+ onApply={onApply}
147
+ shouldCloseOnSelect={false}
148
+ onDateSelection={onDateSelection}
149
+ rangeSelection={rangeSelection}
150
+ onDateHover={onDateHover}
151
+ hoverDate={hoverDate}
152
+ onKeyboardNavigation={handleRightKeyboardNavigation}
153
+ className="!w-[304px] h-64"
154
+ calendarSide="right"
155
+ />
156
+ </div>
157
+ </div>
158
+ </div>
159
+ );
160
+ };