@mittwald/flow-react-components 1.6.0-next.3 → 1.6.0-next.30

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 (291) hide show
  1. package/AGENTS.md +132 -88
  2. package/USAGE.md +7 -2
  3. package/dist/assets/component-index.json +1 -1
  4. package/dist/assets/doc-properties.json +1 -1
  5. package/dist/css/all-layered.css +1 -1
  6. package/dist/css/all.css +1 -1
  7. package/dist/js/_virtual/_10.locale.mjs +3 -3
  8. package/dist/js/_virtual/_11.locale.mjs +3 -9
  9. package/dist/js/_virtual/_12.locale.mjs +9 -3
  10. package/dist/js/_virtual/_13.locale.mjs +3 -9
  11. package/dist/js/_virtual/_14.locale.mjs +5 -505
  12. package/dist/js/_virtual/_15.locale.mjs +505 -5
  13. package/dist/js/_virtual/_16.locale.mjs +9 -3
  14. package/dist/js/_virtual/_17.locale.mjs +3 -63
  15. package/dist/js/_virtual/_18.locale.mjs +77 -3
  16. package/dist/js/_virtual/_19.locale.mjs +3 -9
  17. package/dist/js/_virtual/_20.locale.mjs +5 -5
  18. package/dist/js/_virtual/_21.locale.mjs +5 -11
  19. package/dist/js/_virtual/_22.locale.mjs +15 -3
  20. package/dist/js/_virtual/_23.locale.mjs +3 -15
  21. package/dist/js/_virtual/_24.locale.mjs +15 -3
  22. package/dist/js/_virtual/_25.locale.mjs +3 -33
  23. package/dist/js/_virtual/_26.locale.mjs +29 -5
  24. package/dist/js/_virtual/_27.locale.mjs +9 -3
  25. package/dist/js/_virtual/_28.locale.mjs +3 -3
  26. package/dist/js/_virtual/_29.locale.mjs +3 -93
  27. package/dist/js/_virtual/_30.locale.mjs +93 -3
  28. package/dist/js/_virtual/_31.locale.mjs +3 -9
  29. package/dist/js/_virtual/_32.locale.mjs +9 -3
  30. package/dist/js/_virtual/_33.locale.mjs +3 -9
  31. package/dist/js/_virtual/_34.locale.mjs +5 -7
  32. package/dist/js/_virtual/_35.locale.mjs +7 -13
  33. package/dist/js/_virtual/_36.locale.mjs +23 -0
  34. package/dist/js/_virtual/_4.locale.mjs +3 -9
  35. package/dist/js/_virtual/_5.locale.mjs +9 -3
  36. package/dist/js/_virtual/_6.locale.mjs +3 -21
  37. package/dist/js/_virtual/_7.locale.mjs +21 -3
  38. package/dist/js/_virtual/_8.locale.mjs +3 -3
  39. package/dist/js/_virtual/_9.locale.mjs +3 -3
  40. package/dist/js/default.mjs +4 -3
  41. package/dist/js/flr-universal.mjs +2 -1
  42. package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs +3 -2
  43. package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs.map +1 -1
  44. package/dist/js/packages/components/src/components/Accordion/Accordion.mjs +3 -2
  45. package/dist/js/packages/components/src/components/Accordion/Accordion.mjs.map +1 -1
  46. package/dist/js/packages/components/src/components/ActionGroup/ActionGroup.mjs +3 -3
  47. package/dist/js/packages/components/src/components/ActionGroup/ActionGroup.mjs.map +1 -1
  48. package/dist/js/packages/components/src/components/Activity/Activity.mjs +1 -1
  49. package/dist/js/packages/components/src/components/Activity/Activity.mjs.map +1 -1
  50. package/dist/js/packages/components/src/components/Alert/Alert.mjs +3 -2
  51. package/dist/js/packages/components/src/components/Alert/Alert.mjs.map +1 -1
  52. package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs +4 -0
  53. package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs.map +1 -1
  54. package/dist/js/packages/components/src/components/Badge/Badge.mjs +1 -1
  55. package/dist/js/packages/components/src/components/Calendar/components/RangeCalendar/helpers/useCalendarDateRangePresets.mjs +1 -1
  56. package/dist/js/packages/components/src/components/CartesianChart/CartesianChart.mjs +6 -8
  57. package/dist/js/packages/components/src/components/CartesianChart/CartesianChart.mjs.map +1 -1
  58. package/dist/js/packages/components/src/components/CartesianChart/components/ChartTooltip/TooltipProgressBar.mjs +1 -1
  59. package/dist/js/packages/components/src/components/CartesianChart/components/YAxis/YAxis.mjs +23 -5
  60. package/dist/js/packages/components/src/components/CartesianChart/components/YAxis/YAxis.mjs.map +1 -1
  61. package/dist/js/packages/components/src/components/CartesianChart/hooks/useTickLabelWidth.mjs +67 -0
  62. package/dist/js/packages/components/src/components/CartesianChart/hooks/useTickLabelWidth.mjs.map +1 -0
  63. package/dist/js/packages/components/src/components/Checkbox/Checkbox.mjs +2 -2
  64. package/dist/js/packages/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
  65. package/dist/js/packages/components/src/components/CodeBlock/CodeBlock.mjs +4 -4
  66. package/dist/js/packages/components/src/components/CodeBlock/CodeBlock.mjs.map +1 -1
  67. package/dist/js/packages/components/src/components/CodeEditor/CodeEditor.mjs +41 -12
  68. package/dist/js/packages/components/src/components/CodeEditor/CodeEditor.mjs.map +1 -1
  69. package/dist/js/packages/components/src/components/CodeEditor/hooks/useCodeEditorExtensions.mjs +29 -16
  70. package/dist/js/packages/components/src/components/CodeEditor/hooks/useCodeEditorExtensions.mjs.map +1 -1
  71. package/dist/js/packages/components/src/components/ComboBox/ComboBox.mjs +4 -3
  72. package/dist/js/packages/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
  73. package/dist/js/packages/components/src/components/ContextMenu/ContextMenu.mjs +3 -2
  74. package/dist/js/packages/components/src/components/ContextMenu/ContextMenu.mjs.map +1 -1
  75. package/dist/js/packages/components/src/components/ContextMenu/components/ContextMenuSelectAll/ContextMenuSelectAll.mjs +1 -1
  76. package/dist/js/packages/components/src/components/ContextualHelp/components/ContextualHelpTrigger/ContextualHelpTrigger.mjs +1 -1
  77. package/dist/js/packages/components/src/components/CopyButton/CopyButton.mjs +1 -1
  78. package/dist/js/packages/components/src/components/CountryOptions/CountryOptions.mjs +6 -2
  79. package/dist/js/packages/components/src/components/CountryOptions/CountryOptions.mjs.map +1 -1
  80. package/dist/js/packages/components/src/components/DatePicker/DatePicker.mjs +2 -1
  81. package/dist/js/packages/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
  82. package/dist/js/packages/components/src/components/DateRangePicker/DateRangePicker.mjs +2 -1
  83. package/dist/js/packages/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
  84. package/dist/js/packages/components/src/components/DeprecationWarningProvider/DeprecationWarningProvider.mjs +40 -8
  85. package/dist/js/packages/components/src/components/DeprecationWarningProvider/DeprecationWarningProvider.mjs.map +1 -1
  86. package/dist/js/packages/components/src/components/DonutChart/DonutChart.mjs.map +1 -1
  87. package/dist/js/packages/components/src/components/FileCard/components/DeleteButton/DeleteButton.mjs +1 -1
  88. package/dist/js/packages/components/src/components/Heading/Heading.mjs +2 -0
  89. package/dist/js/packages/components/src/components/Heading/Heading.mjs.map +1 -1
  90. package/dist/js/packages/components/src/components/Icon/Icon.module.mjs.map +1 -1
  91. package/dist/js/packages/components/src/components/IllustratedMessage/IllustratedMessage.mjs +3 -2
  92. package/dist/js/packages/components/src/components/IllustratedMessage/IllustratedMessage.mjs.map +1 -1
  93. package/dist/js/packages/components/src/components/ImageCropper/ImageCropper.mjs +1 -1
  94. package/dist/js/packages/components/src/components/Kbd/Kbd.mjs +1 -1
  95. package/dist/js/packages/components/src/components/Label/Label.mjs +1 -5
  96. package/dist/js/packages/components/src/components/Label/Label.mjs.map +1 -1
  97. package/dist/js/packages/components/src/components/LightBox/LightBox.mjs +1 -1
  98. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGallery/Controls.mjs +1 -1
  99. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGallery/LightBoxGallery.mjs +1 -1
  100. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.mjs +1 -1
  101. package/dist/js/packages/components/src/components/Link/components/LinkIcon/LinkIcon.mjs +1 -1
  102. package/dist/js/packages/components/src/components/List/components/EmptySearchResultView/EmptySearchResultView.mjs +1 -1
  103. package/dist/js/packages/components/src/components/List/components/EmptyView/EmptyView.mjs +1 -1
  104. package/dist/js/packages/components/src/components/List/components/Footer/Footer.mjs +1 -1
  105. package/dist/js/packages/components/src/components/List/components/Footer/components/PaginationInfos/PaginationInfos.mjs +1 -1
  106. package/dist/js/packages/components/src/components/List/components/Footer/components/ShowNextBatchButton/ShowNextBatchButton.mjs +1 -1
  107. package/dist/js/packages/components/src/components/List/components/Header/components/ActiveFilters/ActiveFilters.mjs +7 -3
  108. package/dist/js/packages/components/src/components/List/components/Header/components/ActiveFilters/ActiveFilters.mjs.map +1 -1
  109. package/dist/js/packages/components/src/components/List/components/Header/components/AllFiltersModal/AllFiltersModal.mjs +1 -1
  110. package/dist/js/packages/components/src/components/List/components/Header/components/AllFiltersModal/FilterAccordionCheckboxGroup.mjs +1 -1
  111. package/dist/js/packages/components/src/components/List/components/Header/components/AllFiltersModal/FilterAccordionDateRange.mjs +6 -4
  112. package/dist/js/packages/components/src/components/List/components/Header/components/AllFiltersModal/FilterAccordionDateRange.mjs.map +1 -1
  113. package/dist/js/packages/components/src/components/List/components/Header/components/AllFiltersModal/FilterAccordionRadioGroup.mjs +1 -1
  114. package/dist/js/packages/components/src/components/List/components/Header/components/AllFiltersModal/SortingAccordion.mjs +1 -1
  115. package/dist/js/packages/components/src/components/List/components/Header/components/AllFiltersModal/ViewModeAccordion.mjs +1 -1
  116. package/dist/js/packages/components/src/components/List/components/Header/components/DateTimeRangeFields/DateTimeRangeFields.mjs +101 -0
  117. package/dist/js/packages/components/src/components/List/components/Header/components/DateTimeRangeFields/DateTimeRangeFields.mjs.map +1 -0
  118. package/dist/js/packages/components/src/components/List/components/Header/components/DateTimeRangeFields/DateTimeRangeFields.module.mjs +13 -0
  119. package/dist/js/packages/components/src/components/List/components/Header/components/DateTimeRangeFields/DateTimeRangeFields.module.mjs.map +1 -0
  120. package/dist/js/packages/components/src/components/List/components/Header/components/FilterContextMenu/DateRangeFilterPopover.mjs +17 -10
  121. package/dist/js/packages/components/src/components/List/components/Header/components/FilterContextMenu/DateRangeFilterPopover.mjs.map +1 -1
  122. package/dist/js/packages/components/src/components/List/components/Header/components/FilterContextMenu/FilterContextMenus.module.mjs +6 -2
  123. package/dist/js/packages/components/src/components/List/components/Header/components/FilterContextMenu/FilterContextMenus.module.mjs.map +1 -1
  124. package/dist/js/packages/components/src/components/List/components/Header/components/SortingContextMenu/SortingContextMenu.mjs +1 -1
  125. package/dist/js/packages/components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeContextMenu.mjs +1 -1
  126. package/dist/js/packages/components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeMenuItem.mjs +1 -1
  127. package/dist/js/packages/components/src/components/List/components/Items/Items.mjs +3 -0
  128. package/dist/js/packages/components/src/components/List/components/Items/Items.mjs.map +1 -1
  129. package/dist/js/packages/components/src/components/List/components/Items/components/Item/Item.mjs +1 -1
  130. package/dist/js/packages/components/src/components/List/components/Items/components/Item/Item.mjs.map +1 -1
  131. package/dist/js/packages/components/src/components/List/components/Items/components/Item/components/AccordionButton.mjs +1 -1
  132. package/dist/js/packages/components/src/components/List/components/Items/components/Item/components/OptionsButton/OptionsButton.mjs +1 -1
  133. package/dist/js/packages/components/src/components/List/components/Items/components/Item/hooks/useGridItemProps.mjs +1 -2
  134. package/dist/js/packages/components/src/components/List/components/Items/components/Item/hooks/useGridItemProps.mjs.map +1 -1
  135. package/dist/js/packages/components/src/components/List/components/Items/views/GridList/GridList.mjs +3 -0
  136. package/dist/js/packages/components/src/components/List/components/Items/views/GridList/GridList.mjs.map +1 -1
  137. package/dist/js/packages/components/src/components/List/components/ListSummary/ListSummary.mjs +5 -9
  138. package/dist/js/packages/components/src/components/List/components/ListSummary/ListSummary.mjs.map +1 -1
  139. package/dist/js/packages/components/src/components/List/components/Table/Table.mjs +8 -12
  140. package/dist/js/packages/components/src/components/List/components/Table/Table.mjs.map +1 -1
  141. package/dist/js/packages/components/src/components/List/components/Table/components/Row.mjs +31 -0
  142. package/dist/js/packages/components/src/components/List/components/Table/components/Row.mjs.map +1 -0
  143. package/dist/js/packages/components/src/components/List/hooks/useAriaAnnounceSearchState.mjs +1 -1
  144. package/dist/js/packages/components/src/components/List/hooks/useLatestOnAction.mjs +21 -0
  145. package/dist/js/packages/components/src/components/List/hooks/useLatestOnAction.mjs.map +1 -0
  146. package/dist/js/packages/components/src/components/List/model/List.mjs +1 -0
  147. package/dist/js/packages/components/src/components/List/model/List.mjs.map +1 -1
  148. package/dist/js/packages/components/src/components/List/model/filter/DateRangeFilter.mjs +15 -2
  149. package/dist/js/packages/components/src/components/List/model/filter/DateRangeFilter.mjs.map +1 -1
  150. package/dist/js/packages/components/src/components/List/model/filter/resolveDateRangeFilterValue.mjs +16 -0
  151. package/dist/js/packages/components/src/components/List/model/filter/resolveDateRangeFilterValue.mjs.map +1 -0
  152. package/dist/js/packages/components/src/components/List/model/item/ItemView.mjs +20 -7
  153. package/dist/js/packages/components/src/components/List/model/item/ItemView.mjs.map +1 -1
  154. package/dist/js/packages/components/src/components/List/model/table/TableCell.mjs +1 -1
  155. package/dist/js/packages/components/src/components/List/model/table/TableCell.mjs.map +1 -1
  156. package/dist/js/packages/components/src/components/List/model/table/TableRow.mjs +28 -1
  157. package/dist/js/packages/components/src/components/List/model/table/TableRow.mjs.map +1 -1
  158. package/dist/js/packages/components/src/components/List/views/EmptyView/EmptyView.mjs +1 -1
  159. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs +29 -11
  160. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs.map +1 -1
  161. package/dist/js/packages/components/src/components/Markdown/components/SkeletonBlocks.mjs +1 -1
  162. package/dist/js/packages/components/src/components/Markdown/components/SkeletonBlocks.mjs.map +1 -1
  163. package/dist/js/packages/components/src/components/Markdown/lib/isExternalHref.mjs +8 -0
  164. package/dist/js/packages/components/src/components/Markdown/lib/isExternalHref.mjs.map +1 -0
  165. package/dist/js/packages/components/src/components/MarkdownEditor/components/ModeButton.mjs +1 -1
  166. package/dist/js/packages/components/src/components/MarkdownEditor/components/ToolbarButton.mjs +1 -1
  167. package/dist/js/packages/components/src/components/MarkdownEditor/lib/useFileUpload.mjs +1 -1
  168. package/dist/js/packages/components/src/components/MenuItem/MenuItem.mjs +32 -3
  169. package/dist/js/packages/components/src/components/MenuItem/MenuItem.mjs.map +1 -1
  170. package/dist/js/packages/components/src/components/MenuItem/MenuItem.module.mjs +1 -3
  171. package/dist/js/packages/components/src/components/Message/Message.mjs +1 -1
  172. package/dist/js/packages/components/src/components/MessageThread/MessageThread.mjs +1 -1
  173. package/dist/js/packages/components/src/components/MessageThread/MessageThread.mjs.map +1 -1
  174. package/dist/js/packages/components/src/components/MessageThread/components/MessageSeparator/MessageSeparator.mjs +1 -1
  175. package/dist/js/packages/components/src/components/Modal/Modal.mjs +3 -2
  176. package/dist/js/packages/components/src/components/Modal/Modal.mjs.map +1 -1
  177. package/dist/js/packages/components/src/components/Modal/components/ConfirmUnsavedChangesModal/ConfirmUnsavedChangesModal.mjs +1 -1
  178. package/dist/js/packages/components/src/components/Navigation/Navigation.module.mjs +1 -3
  179. package/dist/js/packages/components/src/components/Notification/Notification.mjs +1 -1
  180. package/dist/js/packages/components/src/components/NumberField/NumberField.mjs +2 -3
  181. package/dist/js/packages/components/src/components/NumberField/NumberField.mjs.map +1 -1
  182. package/dist/js/packages/components/src/components/Option/Option.module.mjs +1 -3
  183. package/dist/js/packages/components/src/components/Overlay/components/OverlayContent.mjs +2 -1
  184. package/dist/js/packages/components/src/components/Overlay/components/OverlayContent.mjs.map +1 -1
  185. package/dist/js/packages/components/src/components/PasswordCreationField/PasswordCreationField.mjs +2 -2
  186. package/dist/js/packages/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
  187. package/dist/js/packages/components/src/components/PasswordCreationField/components/PasswordGenerateButton/PasswordGenerateButton.mjs +1 -1
  188. package/dist/js/packages/components/src/components/PasswordCreationField/components/TogglePasswordVisibilityButton/TogglePasswordVisibilityButton.mjs +1 -1
  189. package/dist/js/packages/components/src/components/PasswordCreationField/components/ValidationResultButton/ValidationResultButton.mjs +1 -1
  190. package/dist/js/packages/components/src/components/PasswordCreationField/components/ValidationResultEntry/ValidationResultEntry.mjs +1 -1
  191. package/dist/js/packages/components/src/components/PasswordCreationField/lib/ariaAnnounce.mjs +1 -1
  192. package/dist/js/packages/components/src/components/Popover/components/NonModalPopoverContent/NonModalPopoverContent.mjs +1 -1
  193. package/dist/js/packages/components/src/components/Popover/components/NonModalPopoverContent/NonModalPopoverContent.mjs.map +1 -1
  194. package/dist/js/packages/components/src/components/Popover/components/PopoverContent/PopoverContent.mjs +4 -2
  195. package/dist/js/packages/components/src/components/Popover/components/PopoverContent/PopoverContent.mjs.map +1 -1
  196. package/dist/js/packages/components/src/components/ProgressBar/ProgressBar.mjs.map +1 -1
  197. package/dist/js/packages/components/src/components/ProgressBar/components/ProgressBarLegend.mjs +5 -4
  198. package/dist/js/packages/components/src/components/ProgressBar/components/ProgressBarLegend.mjs.map +1 -1
  199. package/dist/js/packages/components/src/components/ProgressBar/components/ProgressBarValue.mjs +1 -1
  200. package/dist/js/packages/components/src/components/RadioGroup/RadioGroup.mjs +2 -3
  201. package/dist/js/packages/components/src/components/RadioGroup/RadioGroup.mjs.map +1 -1
  202. package/dist/js/packages/components/src/components/Rating/Rating.mjs +12 -11
  203. package/dist/js/packages/components/src/components/Rating/Rating.mjs.map +1 -1
  204. package/dist/js/packages/components/src/components/Rating/components/RatingSegment/RatingSegment.mjs +1 -1
  205. package/dist/js/packages/components/src/components/SearchField/SearchField.mjs +3 -4
  206. package/dist/js/packages/components/src/components/SearchField/SearchField.mjs.map +1 -1
  207. package/dist/js/packages/components/src/components/Section/Section.mjs +10 -6
  208. package/dist/js/packages/components/src/components/Section/Section.mjs.map +1 -1
  209. package/dist/js/packages/components/src/components/Section/components/SectionHeader/SectionHeader.mjs +0 -4
  210. package/dist/js/packages/components/src/components/Section/components/SectionHeader/SectionHeader.mjs.map +1 -1
  211. package/dist/js/packages/components/src/components/Section/context.mjs +47 -0
  212. package/dist/js/packages/components/src/components/Section/context.mjs.map +1 -0
  213. package/dist/js/packages/components/src/components/SegmentedControl/SegmentedControl.mjs +2 -3
  214. package/dist/js/packages/components/src/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  215. package/dist/js/packages/components/src/components/Select/Select.mjs +2 -3
  216. package/dist/js/packages/components/src/components/Select/Select.mjs.map +1 -1
  217. package/dist/js/packages/components/src/components/SkeletonMode/SkeletonMode.mjs +1 -1
  218. package/dist/js/packages/components/src/components/SkeletonText/SkeletonText.mjs +4 -3
  219. package/dist/js/packages/components/src/components/SkeletonText/SkeletonText.mjs.map +1 -1
  220. package/dist/js/packages/components/src/components/Slider/Slider.mjs +48 -42
  221. package/dist/js/packages/components/src/components/Slider/Slider.mjs.map +1 -1
  222. package/dist/js/packages/components/src/components/TabNavigation/TabNavigation.mjs +1 -1
  223. package/dist/js/packages/components/src/components/Table/Table.mjs +3 -0
  224. package/dist/js/packages/components/src/components/Table/Table.mjs.map +1 -1
  225. package/dist/js/packages/components/src/components/Table/Table.module.mjs.map +1 -1
  226. package/dist/js/packages/components/src/components/Tabs/Tabs.mjs +6 -8
  227. package/dist/js/packages/components/src/components/Tabs/Tabs.mjs.map +1 -1
  228. package/dist/js/packages/components/src/components/Tabs/Tabs.module.mjs.map +1 -1
  229. package/dist/js/packages/components/src/components/Tabs/components/FallbackTab/FallbackTab.mjs +1 -1
  230. package/dist/js/packages/components/src/components/Tabs/components/TabList/TabList.mjs +0 -3
  231. package/dist/js/packages/components/src/components/Tabs/components/TabList/TabList.mjs.map +1 -1
  232. package/dist/js/packages/components/src/components/TextArea/TextArea.mjs +1 -1
  233. package/dist/js/packages/components/src/components/TextField/TextField.mjs +12 -9
  234. package/dist/js/packages/components/src/components/TextField/TextField.mjs.map +1 -1
  235. package/dist/js/packages/components/src/components/TimeField/TimeField.mjs +4 -2
  236. package/dist/js/packages/components/src/components/TimeField/TimeField.mjs.map +1 -1
  237. package/dist/js/packages/components/src/components/TranslationProvider/useLocalizedStringFormatter.mjs +15 -2
  238. package/dist/js/packages/components/src/components/TranslationProvider/useLocalizedStringFormatter.mjs.map +1 -1
  239. package/dist/js/packages/components/src/components/Wrap/Wrap.mjs.map +1 -1
  240. package/dist/js/packages/components/src/integrations/react-hook-form/components/Field/Field.mjs +2 -2
  241. package/dist/js/packages/components/src/integrations/react-hook-form/components/FormRootError/FormRootError.mjs +1 -1
  242. package/dist/js/packages/components/src/views/DatePickerView.mjs +16 -0
  243. package/dist/js/packages/components/src/views/DatePickerView.mjs.map +1 -0
  244. package/dist/js/packages/components/src/views/LabelView.mjs +16 -0
  245. package/dist/js/packages/components/src/views/LabelView.mjs.map +1 -0
  246. package/dist/js/packages/components/src/views/TimeFieldView.mjs +16 -0
  247. package/dist/js/packages/components/src/views/TimeFieldView.mjs.map +1 -0
  248. package/dist/js/packages/components-base/src/index.mjs +4 -2
  249. package/dist/js/packages/components-base/src/list/filter/ListDateRangeFilter.mjs +1 -0
  250. package/dist/js/packages/components-base/src/list/filter/ListDateRangeFilter.mjs.map +1 -1
  251. package/dist/js/packages/components-base/src/list/filter/ListFilter.mjs +4 -1
  252. package/dist/js/packages/components-base/src/list/filter/ListFilter.mjs.map +1 -1
  253. package/dist/js/packages/components-base/src/list/filter/dateRange.mjs +37 -13
  254. package/dist/js/packages/components-base/src/list/filter/dateRange.mjs.map +1 -1
  255. package/dist/js/packages/components-base/src/list/filter/dateTimeRangeFields.mjs +55 -0
  256. package/dist/js/packages/components-base/src/list/filter/dateTimeRangeFields.mjs.map +1 -0
  257. package/dist/js/packages/components-base/src/list/filter/formatDateRange.mjs +27 -0
  258. package/dist/js/packages/components-base/src/list/filter/formatDateRange.mjs.map +1 -0
  259. package/dist/types/_bundled/flow-components-base/index.d.ts +3 -1
  260. package/dist/types/_bundled/flow-components-base/list/filter/ListFilter.d.ts +2 -0
  261. package/dist/types/_bundled/flow-components-base/list/filter/dateRange.d.ts +24 -1
  262. package/dist/types/_bundled/flow-components-base/list/filter/dateTimeRangeFields.d.ts +34 -0
  263. package/dist/types/_bundled/flow-components-base/list/filter/formatDateRange.d.ts +7 -0
  264. package/dist/types/components/CartesianChart/hooks/useTickLabelWidth.d.ts +1 -0
  265. package/dist/types/components/CodeBlock/CodeBlock.d.ts +1 -1
  266. package/dist/types/components/DonutChart/DonutChart.d.ts +1 -4
  267. package/dist/types/components/List/components/Header/components/DateTimeRangeFields/DateTimeRangeFields.d.ts +8 -0
  268. package/dist/types/components/List/components/Items/components/Item/Item.d.ts +2 -0
  269. package/dist/types/components/List/components/Items/components/Item/hooks/useGridItemProps.d.ts +1 -0
  270. package/dist/types/components/List/components/ListSummary/ListSummary.d.ts +3 -2
  271. package/dist/types/components/List/components/Table/components/Row.d.ts +13 -0
  272. package/dist/types/components/List/hooks/useLatestOnAction.d.ts +7 -0
  273. package/dist/types/components/List/index.d.ts +2 -0
  274. package/dist/types/components/List/model/filter/DateRangeFilter.d.ts +15 -8
  275. package/dist/types/components/List/model/filter/resolveDateRangeFilterValue.d.ts +11 -0
  276. package/dist/types/components/List/model/filter/types.d.ts +23 -1
  277. package/dist/types/components/List/model/item/ItemView.d.ts +34 -11
  278. package/dist/types/components/List/model/table/TableRow.d.ts +14 -0
  279. package/dist/types/components/List/model/table/types.d.ts +17 -1
  280. package/dist/types/components/List/typedList.d.ts +1 -0
  281. package/dist/types/components/Markdown/lib/isExternalHref.d.ts +1 -0
  282. package/dist/types/components/ProgressBar/ProgressBar.d.ts +1 -4
  283. package/dist/types/components/Rating/Rating.d.ts +5 -5
  284. package/dist/types/components/Section/context.d.ts +28 -0
  285. package/dist/types/components/Wrap/Wrap.d.ts +5 -0
  286. package/dist/types/index/flr-universal.d.ts +1 -1
  287. package/package.json +12 -12
  288. package/dist/js/packages/components/src/lib/date/transformDateValueToFormattedDate.mjs +0 -10
  289. package/dist/js/packages/components/src/lib/date/transformDateValueToFormattedDate.mjs.map +0 -1
  290. package/dist/types/lib/date/transformDateValueToDateTime.d.ts +0 -3
  291. package/dist/types/lib/date/transformDateValueToFormattedDate.d.ts +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ListFilter.mjs","names":[],"sources":["../../../../../../../../components-base/src/list/filter/ListFilter.ts"],"sourcesContent":["import { toArray } from \"../../lib/array\";\nimport { getListColumn, type ListModelContext } from \"../ListModelContext\";\nimport type { ListSettingsOperationOptions } from \"../settings/types\";\nimport { customPropertyPrefix } from \"../types\";\nimport type { PropertyName, PropertyValueRenderMethod } from \"../types\";\nimport { ListFilterValue } from \"./ListFilterValue\";\nimport type {\n FilterMatcher,\n FilterMode,\n FilterUpdatedCallback,\n ListFilterShape,\n} from \"./types\";\nimport type {\n Column,\n ColumnDef,\n ColumnFilter,\n InitialTableState,\n} from \"@tanstack/table-core\";\nimport { getProperty } from \"dot-prop\";\nimport { difference, unique } from \"remeda\";\n\nconst equalsPropertyMatcher: FilterMatcher<unknown, never, never> = (\n filterValue,\n propertyValue,\n) => filterValue === propertyValue;\n\n/** From how many values on a multiple-choice filter offers \"Select all\". */\nconst selectAllMinValueCount = 6;\n\nconst stringCastRenderMethod: PropertyValueRenderMethod<unknown, never> = (\n value,\n) => String(value) as never;\n\n/** What `storeFilters` needs of a filter, and nothing more. */\ninterface StorableFilter {\n readonly storageKey: string;\n getArrayValue(): { id: string }[];\n}\n\n/**\n * One filter of a list: its values, which of them are on, and how that is\n * persisted.\n *\n * Framework-free apart from one thing, which is why `TRendered` exists: a\n * filter value has to be _shown_, and what \"shown\" is belongs to the binding.\n * React's `Filter` fills it with `ReactNode`; the default is `unknown`, so the\n * core can be read without deciding.\n *\n * The selected values live in the TanStack table's column filter, not here.\n * This translates: ids to values, values to a predicate, a toggle to a new\n * column filter.\n */\nexport class ListFilter<\n T = never,\n TProp extends PropertyName<T> = never,\n TMatchValue = never,\n TRendered = unknown,\n> {\n private _values?: ListFilterValue<TRendered>[] | undefined;\n private valuesFromTableState?: {\n facets: Map<unknown, number>;\n values: ListFilterValue<TRendered>[];\n };\n public readonly context: ListModelContext<T>;\n public readonly property: TProp;\n public readonly mode: FilterMode;\n public readonly matcher: FilterMatcher<T, never, never>;\n public readonly renderItem: PropertyValueRenderMethod<TMatchValue, TRendered>;\n public readonly name?: string;\n public readonly autosave: boolean;\n public readonly manualSave: boolean;\n private readonly onFilterChangeCallbacks = new Set<FilterUpdatedCallback>();\n private readonly defaultSelectedValues?: ListFilterValue<TRendered>[];\n public readonly priority: \"primary\" | \"secondary\";\n public readonly storageKey: string;\n\n public constructor(\n context: ListModelContext<T>,\n shape: ListFilterShape<T, TProp, TMatchValue, TRendered>,\n ) {\n const {\n autosave = context.settingsDefaults?.filters?.autosave ?? false,\n manualSave = context.settingsDefaults?.filters?.manualSave ?? true,\n property,\n mode = \"some\",\n values,\n matcher = equalsPropertyMatcher,\n renderItem = stringCastRenderMethod as PropertyValueRenderMethod<\n TMatchValue,\n TRendered\n >,\n priority = \"primary\",\n name,\n defaultSelected,\n onChange,\n } = shape;\n\n this.context = context;\n this.autosave = autosave;\n this.manualSave = manualSave;\n this.property = property;\n this.storageKey = String(property);\n this.mode = mode;\n this._values = values?.map((v) => ListFilterValue.create(this, v));\n this.matcher = matcher;\n this.renderItem = renderItem;\n this.name = name;\n this.priority = priority;\n this.defaultSelectedValues = defaultSelected?.map((v) =>\n ListFilterValue.create(this, v),\n );\n if (onChange) {\n this.onFilterChangeCallbacks.add(onChange);\n }\n }\n\n public updateInitialState(initialState: InitialTableState): void {\n const initialIds = this.getInitialSelectedIds();\n\n if (initialIds?.length) {\n initialState.columnFilters = [\n ...(initialState.columnFilters ?? []),\n {\n id: this.property as string,\n value: initialIds,\n },\n ];\n }\n }\n\n private getInitialSelectedIds(): string[] | undefined {\n return (\n this.getStoredSelectedIds({\n autosave: this.autosave,\n manualSave: this.manualSave,\n }) ?? this.defaultSelectedValues?.map((v) => v.id)\n );\n }\n\n private getStoredSelectedIds(\n options: ListSettingsOperationOptions,\n ): string[] | undefined {\n return this.context.settings?.get(\"activeFilters\", options)?.[\n this.storageKey\n ];\n }\n\n private getStoredSelectedValues(\n options: ListSettingsOperationOptions,\n ): ListFilterValue<TRendered>[] | undefined {\n return this.getStoredSelectedIds(options)\n ?.map((id) => this.values.find((v) => v.id === id))\n .filter((v): v is ListFilterValue<TRendered> => v !== undefined);\n }\n\n /**\n * Writes every filter's selection in one go — they share a settings key.\n *\n * Takes the two members it reads rather than a `ListFilter<any, …>`: a\n * `Table<never>` is not assignable to a `Table<any>` (a row model sits in a\n * contravariant position deep inside), so a list of concrete filters would\n * not go in.\n */\n public static storeFilters<T>(\n context: ListModelContext<T>,\n filters: StorableFilter[],\n options: ListSettingsOperationOptions,\n ): void {\n const data = Object.fromEntries(\n filters.map((filter) => [\n filter.storageKey,\n filter.getArrayValue().map((v) => v.id),\n ]),\n );\n\n context.settings?.store(\"activeFilters\", data, options);\n }\n\n public updateTableColumnDef(def: ColumnDef<T>): void {\n def.enableColumnFilter = true;\n def.filterFn = this.getTableFilterFn();\n }\n\n private getTableFilterFn(): ColumnDef<T>[\"filterFn\"] {\n return (row, _, filterValue) => {\n const propertyAsString = this.property as string;\n\n /*\n * A custom property is not on the item, so the matcher gets the item\n * itself and decides.\n */\n const filterBy = propertyAsString.startsWith(customPropertyPrefix)\n ? row.original\n : getProperty(row.original as object, propertyAsString);\n\n return this.checkFilterMatches(filterBy, filterValue);\n };\n }\n\n private checkFilterMatches(\n property: unknown,\n filterValueInput: unknown,\n ): boolean {\n if (filterValueInput === null) {\n return true;\n }\n\n const predicate = (filterValue: ListFilterValue<TRendered>) =>\n this.matcher(filterValue.value as never, property as never);\n\n const toFilterValue = (something: unknown) =>\n ListFilterValue.create(this, something);\n\n if (this.mode === \"all\") {\n return toArray(filterValueInput).map(toFilterValue).every(predicate);\n } else if (this.mode === \"some\") {\n const filterArr = toArray(filterValueInput);\n return (\n filterArr.length === 0 || filterArr.map(toFilterValue).some(predicate)\n );\n } else if (this.mode === \"one\") {\n const oneValue = Array.isArray(filterValueInput)\n ? filterValueInput[0]\n : filterValueInput;\n return predicate(toFilterValue(oneValue));\n }\n\n throw new Error(`Unknown filter mode '${this.mode}'`);\n }\n\n protected getTableColumnFilter(): ColumnFilter | undefined {\n return this.context.dataTable\n .getState()\n .columnFilters.find((f) => f.id === this.property);\n }\n\n protected getTableColumn(): Column<T> {\n return getListColumn(this.context.dataTable, this.property);\n }\n\n public getValue(): unknown {\n return this.getTableColumnFilter()?.value ?? null;\n }\n\n /*\n * Rebuilt only when TanStack hands out a new map: it memoizes the faceted\n * values and replaces the map when the data changes. Without this, every\n * row the filter function checks re-hashes every value — `getArrayValue()`\n * resolves each stored id through `values`.\n */\n private getValuesFromTableState(): ListFilterValue<TRendered>[] {\n const facets = this.getTableColumn().getFacetedUniqueValues();\n\n if (this.valuesFromTableState?.facets !== facets) {\n this.valuesFromTableState = {\n facets,\n values: unique(\n Array.from(facets.keys())\n .flatMap((v) => v)\n .filter((v) => v !== undefined && v !== null),\n ).map((v) => ListFilterValue.create(this, v)),\n };\n }\n\n return this.valuesFromTableState.values;\n }\n\n private checkIfValueIsUnknown(value: ListFilterValue<TRendered>): boolean {\n return !this.values.some((v) => v.id === value.id);\n }\n\n /**\n * Drops a selection the data no longer offers — a stored filter value whose\n * item is gone would otherwise filter everything away with no way to undo\n * it.\n */\n public deleteUnknownFilterValues(): void {\n /* Values the data offers are by definition known. */\n if (this._values === undefined) {\n return;\n }\n\n for (const currentValues of this.getArrayValue()) {\n if (this.checkIfValueIsUnknown(currentValues)) {\n this.deactivateValue(currentValues);\n }\n }\n }\n\n /**\n * The values the filter offers — the ones it was given, or the ones the data\n * has.\n *\n * Follows the table, not a snapshot. A binding that keeps one filter instance\n * for the list's lifetime would otherwise hold the answer from before the\n * first batch arrived: an async loader gives the header an empty menu and\n * never fills it. The values are cached per faceted-values map, which\n * TanStack replaces when the data changes.\n */\n public get values(): ListFilterValue<TRendered>[] {\n return this._values ?? this.getValuesFromTableState();\n }\n\n public getArrayValue(): ListFilterValue<TRendered>[] {\n const value = this.getValue();\n return value === null\n ? []\n : toArray(value).map((v) => ListFilterValue.create(this, v));\n }\n\n public isValueActive(value: ListFilterValue<TRendered>): boolean {\n return this.getArrayValue().some((v) => v.equals(value));\n }\n\n public isActive(): boolean {\n return this.getArrayValue().length > 0;\n }\n\n public deactivateValue(value: ListFilterValue<TRendered>): void {\n const currentValueAsArray = this.getArrayValue();\n\n const updatedValue =\n this.mode === \"all\" || this.mode === \"some\"\n ? currentValueAsArray.filter((v) => !v.equals(value))\n : null;\n\n this.getTableColumn().setFilterValue(updatedValue);\n this.callOnChangedHandlers(updatedValue);\n }\n\n private callOnChangedHandlers(\n newValue: ListFilterValue<TRendered>[] | ListFilterValue<TRendered> | null,\n ): void {\n const values = toArray(newValue).map((v) => v?.value);\n this.onFilterChangeCallbacks.forEach((cb) => cb(values));\n }\n\n public hasChanges(): boolean {\n const currentIds = this.getArrayValue().map((v) => v.id);\n\n const defaultIds =\n this.getStoredSelectedIds({ autosave: false }) ??\n this.defaultSelectedValues?.map((v) => v.id) ??\n [];\n\n return (\n currentIds.length !== defaultIds.length ||\n difference(currentIds, defaultIds).length > 0\n );\n }\n\n public isStoringAvailable(): boolean {\n return !!this.context.settings && this.manualSave;\n }\n\n public resetValues(): void {\n const storedValues =\n this.getStoredSelectedValues({ autosave: false }) ??\n this.defaultSelectedValues;\n\n const resetTo =\n storedValues ?? (this.mode === \"all\" || this.mode === \"some\" ? [] : null);\n\n this.getTableColumn().setFilterValue(resetTo);\n this.callOnChangedHandlers(resetTo);\n }\n\n public clear(): void {\n this.getTableColumn().setFilterValue(null);\n this.callOnChangedHandlers(null);\n }\n\n public toggleValue(newValue: ListFilterValue<TRendered>): void {\n const currentValueAsArray = this.getArrayValue();\n\n let updatedValue:\n ListFilterValue<TRendered>[] | ListFilterValue<TRendered> | null;\n\n if (this.mode === \"all\" || this.mode === \"some\") {\n updatedValue = newValue.isActive\n ? currentValueAsArray.filter((v) => !v.equals(newValue))\n : [...currentValueAsArray, newValue];\n } else {\n updatedValue = newValue.isActive ? null : newValue;\n }\n\n this.getTableColumn().setFilterValue(updatedValue);\n this.callOnChangedHandlers(updatedValue);\n }\n\n /**\n * Whether the filter offers \"Select all\" — a `some` filter with enough\n * values.\n */\n public get isSelectAllAvailable(): boolean {\n return this.mode === \"some\" && this.values.length >= selectAllMinValueCount;\n }\n\n public isEveryValueActive(): boolean {\n return this.values.every((v) => v.isActive);\n }\n\n public selectAll(): void {\n this.setArrayValue(this.values);\n }\n\n /** Makes exactly these values active — what a multiple-selection menu reports. */\n public setActiveValueIds(ids: Iterable<unknown>): void {\n const idSet = new Set(ids);\n this.setArrayValue(this.values.filter((v) => idSet.has(v.id)));\n }\n\n public deselectAll(): void {\n this.setArrayValue([]);\n }\n\n private setArrayValue(value: ListFilterValue<TRendered>[]): void {\n this.getTableColumn().setFilterValue(value);\n this.callOnChangedHandlers(value);\n }\n\n public onFilterUpdated(cb: () => unknown): void {\n this.onFilterChangeCallbacks.add(cb);\n }\n}\n\nexport default ListFilter;\n"],"mappings":";;;;;;;;AAqBA,IAAM,yBACJ,aACA,kBACG,gBAAgB;;AAGrB,IAAM,yBAAyB;AAE/B,IAAM,0BACJ,UACG,OAAO,KAAK;;;;;;;;;;;;;;AAqBjB,IAAa,aAAb,MAKE;CACA;CACA;CAIA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,0CAA2C,IAAI,IAA2B;CAC1E;CACA;CACA;CAEA,YACE,SACA,OACA;EACA,MAAM,EACJ,WAAW,QAAQ,kBAAkB,SAAS,YAAY,OAC1D,aAAa,QAAQ,kBAAkB,SAAS,cAAc,MAC9D,UACA,OAAO,QACP,QACA,UAAU,uBACV,aAAa,wBAIb,WAAW,WACX,MACA,iBACA,aACE;EAEJ,KAAK,UAAU;EACf,KAAK,WAAW;EAChB,KAAK,aAAa;EAClB,KAAK,WAAW;EAChB,KAAK,aAAa,OAAO,QAAQ;EACjC,KAAK,OAAO;EACZ,KAAK,UAAU,QAAQ,KAAK,MAAM,gBAAgB,OAAO,MAAM,CAAC,CAAC;EACjE,KAAK,UAAU;EACf,KAAK,aAAa;EAClB,KAAK,OAAO;EACZ,KAAK,WAAW;EAChB,KAAK,wBAAwB,iBAAiB,KAAK,MACjD,gB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AAE;CACrC;AACF"}
1
+ {"version":3,"file":"ListFilter.mjs","names":[],"sources":["../../../../../../../../components-base/src/list/filter/ListFilter.ts"],"sourcesContent":["import { toArray } from \"../../lib/array\";\nimport { getListColumn, type ListModelContext } from \"../ListModelContext\";\nimport type { ListSettingsOperationOptions } from \"../settings/types\";\nimport { customPropertyPrefix } from \"../types\";\nimport type { PropertyName, PropertyValueRenderMethod } from \"../types\";\nimport { ListFilterValue } from \"./ListFilterValue\";\nimport type {\n FilterMatcher,\n FilterMode,\n FilterUpdatedCallback,\n ListFilterShape,\n} from \"./types\";\nimport type {\n Column,\n ColumnDef,\n ColumnFilter,\n InitialTableState,\n} from \"@tanstack/table-core\";\nimport { getProperty } from \"dot-prop\";\nimport { difference, unique } from \"remeda\";\n\nconst equalsPropertyMatcher: FilterMatcher<unknown, never, never> = (\n filterValue,\n propertyValue,\n) => filterValue === propertyValue;\n\n/** From how many values on a multiple-choice filter offers \"Select all\". */\nconst selectAllMinValueCount = 6;\n\nconst stringCastRenderMethod: PropertyValueRenderMethod<unknown, never> = (\n value,\n) => String(value) as never;\n\n/** What `storeFilters` needs of a filter, and nothing more. */\ninterface StorableFilter {\n readonly storageKey: string;\n getArrayValue(): { id: string }[];\n}\n\n/**\n * One filter of a list: its values, which of them are on, and how that is\n * persisted.\n *\n * Framework-free apart from one thing, which is why `TRendered` exists: a\n * filter value has to be _shown_, and what \"shown\" is belongs to the binding.\n * React's `Filter` fills it with `ReactNode`; the default is `unknown`, so the\n * core can be read without deciding.\n *\n * The selected values live in the TanStack table's column filter, not here.\n * This translates: ids to values, values to a predicate, a toggle to a new\n * column filter.\n */\nexport class ListFilter<\n T = never,\n TProp extends PropertyName<T> = never,\n TMatchValue = never,\n TRendered = unknown,\n> {\n private _values?: ListFilterValue<TRendered>[] | undefined;\n private valuesFromTableState?: {\n facets: Map<unknown, number>;\n values: ListFilterValue<TRendered>[];\n };\n public readonly context: ListModelContext<T>;\n public readonly property: TProp;\n public readonly mode: FilterMode;\n public readonly matcher: FilterMatcher<T, never, never>;\n public readonly renderItem: PropertyValueRenderMethod<TMatchValue, TRendered>;\n public readonly name?: string;\n public readonly autosave: boolean;\n public readonly manualSave: boolean;\n private readonly onFilterChangeCallbacks = new Set<FilterUpdatedCallback>();\n private readonly defaultSelectedValues?: ListFilterValue<TRendered>[];\n public readonly priority: \"primary\" | \"secondary\";\n public readonly storageKey: string;\n\n public constructor(\n context: ListModelContext<T>,\n shape: ListFilterShape<T, TProp, TMatchValue, TRendered>,\n ) {\n const {\n autosave = context.settingsDefaults?.filters?.autosave ?? false,\n manualSave = context.settingsDefaults?.filters?.manualSave ?? true,\n property,\n mode = \"some\",\n values,\n matcher = equalsPropertyMatcher,\n renderItem = stringCastRenderMethod as PropertyValueRenderMethod<\n TMatchValue,\n TRendered\n >,\n priority = \"primary\",\n name,\n defaultSelected,\n onChange,\n } = shape;\n\n this.context = context;\n this.autosave = autosave;\n this.manualSave = manualSave;\n this.property = property;\n this.storageKey = String(property);\n this.mode = mode;\n this._values = values?.map((v) => ListFilterValue.create(this, v));\n this.matcher = matcher;\n this.renderItem = renderItem;\n this.name = name;\n this.priority = priority;\n this.defaultSelectedValues = defaultSelected?.map((v) =>\n ListFilterValue.create(this, v),\n );\n if (onChange) {\n this.onFilterChangeCallbacks.add(onChange);\n }\n }\n\n public updateInitialState(initialState: InitialTableState): void {\n const initialIds = this.getInitialSelectedIds();\n\n if (initialIds?.length) {\n initialState.columnFilters = [\n ...(initialState.columnFilters ?? []),\n {\n id: this.property as string,\n value: initialIds,\n },\n ];\n }\n }\n\n private getInitialSelectedIds(): string[] | undefined {\n return (\n this.getStoredSelectedIds({\n autosave: this.autosave,\n manualSave: this.manualSave,\n }) ?? this.defaultSelectedValues?.map((v) => v.id)\n );\n }\n\n private getStoredSelectedIds(\n options: ListSettingsOperationOptions,\n ): string[] | undefined {\n return this.context.settings?.get(\"activeFilters\", options)?.[\n this.storageKey\n ];\n }\n\n private getStoredSelectedValues(\n options: ListSettingsOperationOptions,\n ): ListFilterValue<TRendered>[] | undefined {\n return this.getStoredSelectedIds(options)\n ?.map((id) => this.values.find((v) => v.id === id))\n .filter((v): v is ListFilterValue<TRendered> => v !== undefined);\n }\n\n /**\n * Writes every filter's selection in one go — they share a settings key.\n *\n * Takes the two members it reads rather than a `ListFilter<any, …>`: a\n * `Table<never>` is not assignable to a `Table<any>` (a row model sits in a\n * contravariant position deep inside), so a list of concrete filters would\n * not go in.\n */\n public static storeFilters<T>(\n context: ListModelContext<T>,\n filters: StorableFilter[],\n options: ListSettingsOperationOptions,\n ): void {\n const data = Object.fromEntries(\n filters.map((filter) => [\n filter.storageKey,\n filter.getArrayValue().map((v) => v.id),\n ]),\n );\n\n context.settings?.store(\"activeFilters\", data, options);\n }\n\n public updateTableColumnDef(def: ColumnDef<T>): void {\n def.enableColumnFilter = true;\n def.filterFn = this.getTableFilterFn();\n }\n\n private getTableFilterFn(): ColumnDef<T>[\"filterFn\"] {\n return (row, _, filterValue) => {\n const propertyAsString = this.property as string;\n\n /*\n * A custom property is not on the item, so the matcher gets the item\n * itself and decides.\n */\n const filterBy = propertyAsString.startsWith(customPropertyPrefix)\n ? row.original\n : getProperty(row.original as object, propertyAsString);\n\n return this.checkFilterMatches(filterBy, filterValue);\n };\n }\n\n private checkFilterMatches(\n property: unknown,\n filterValueInput: unknown,\n ): boolean {\n if (filterValueInput === null) {\n return true;\n }\n\n const predicate = (filterValue: ListFilterValue<TRendered>) =>\n this.matcher(filterValue.value as never, property as never);\n\n const toFilterValue = (something: unknown) =>\n ListFilterValue.create(this, something);\n\n if (this.mode === \"all\") {\n return toArray(filterValueInput).map(toFilterValue).every(predicate);\n } else if (this.mode === \"some\") {\n const filterArr = toArray(filterValueInput);\n return (\n filterArr.length === 0 || filterArr.map(toFilterValue).some(predicate)\n );\n } else if (this.mode === \"one\") {\n const oneValue = Array.isArray(filterValueInput)\n ? filterValueInput[0]\n : filterValueInput;\n return predicate(toFilterValue(oneValue));\n }\n\n throw new Error(`Unknown filter mode '${this.mode}'`);\n }\n\n protected getTableColumnFilter(): ColumnFilter | undefined {\n return this.context.dataTable\n .getState()\n .columnFilters.find((f) => f.id === this.property);\n }\n\n protected getTableColumn(): Column<T> {\n return getListColumn(this.context.dataTable, this.property);\n }\n\n public getValue(): unknown {\n return this.getTableColumnFilter()?.value ?? null;\n }\n\n /*\n * Rebuilt only when TanStack hands out a new map: it memoizes the faceted\n * values and replaces the map when the data changes. Without this, every\n * row the filter function checks re-hashes every value — `getArrayValue()`\n * resolves each stored id through `values`.\n */\n private getValuesFromTableState(): ListFilterValue<TRendered>[] {\n const facets = this.getTableColumn().getFacetedUniqueValues();\n\n if (this.valuesFromTableState?.facets !== facets) {\n this.valuesFromTableState = {\n facets,\n values: unique(\n Array.from(facets.keys())\n .flatMap((v) => v)\n .filter((v) => v !== undefined && v !== null),\n ).map((v) => ListFilterValue.create(this, v)),\n };\n }\n\n return this.valuesFromTableState.values;\n }\n\n private checkIfValueIsUnknown(value: ListFilterValue<TRendered>): boolean {\n return !this.values.some((v) => v.id === value.id);\n }\n\n /**\n * Drops a selection the data no longer offers — a stored filter value whose\n * item is gone would otherwise filter everything away with no way to undo\n * it.\n */\n public deleteUnknownFilterValues(): void {\n /* Values the data offers are by definition known. */\n if (this._values === undefined) {\n return;\n }\n\n for (const currentValues of this.getArrayValue()) {\n if (this.checkIfValueIsUnknown(currentValues)) {\n this.deactivateValue(currentValues);\n }\n }\n }\n\n /**\n * The values the filter offers — the ones it was given, or the ones the data\n * has.\n *\n * Follows the table, not a snapshot. A binding that keeps one filter instance\n * for the list's lifetime would otherwise hold the answer from before the\n * first batch arrived: an async loader gives the header an empty menu and\n * never fills it. The values are cached per faceted-values map, which\n * TanStack replaces when the data changes.\n */\n public get values(): ListFilterValue<TRendered>[] {\n return this._values ?? this.getValuesFromTableState();\n }\n\n public getArrayValue(): ListFilterValue<TRendered>[] {\n const value = this.getValue();\n return value === null\n ? []\n : toArray(value).map((v) => ListFilterValue.create(this, v));\n }\n\n public isValueActive(value: ListFilterValue<TRendered>): boolean {\n return this.getArrayValue().some((v) => v.equals(value));\n }\n\n public isActive(): boolean {\n return this.getArrayValue().length > 0;\n }\n\n public deactivateValue(value: ListFilterValue<TRendered>): void {\n const currentValueAsArray = this.getArrayValue();\n\n const updatedValue =\n this.mode === \"all\" || this.mode === \"some\"\n ? currentValueAsArray.filter((v) => !v.equals(value))\n : null;\n\n this.getTableColumn().setFilterValue(updatedValue);\n this.callOnChangedHandlers(updatedValue);\n }\n\n private callOnChangedHandlers(\n newValue: ListFilterValue<TRendered>[] | ListFilterValue<TRendered> | null,\n ): void {\n this.notifyFilterUpdated(toArray(newValue).map((v) => v?.value));\n }\n\n /** Tells the listeners — the list resetting its batches among them. */\n protected notifyFilterUpdated(values: unknown[]): void {\n this.onFilterChangeCallbacks.forEach((cb) => cb(values));\n }\n\n public hasChanges(): boolean {\n const currentIds = this.getArrayValue().map((v) => v.id);\n\n const defaultIds =\n this.getStoredSelectedIds({ autosave: false }) ??\n this.defaultSelectedValues?.map((v) => v.id) ??\n [];\n\n return (\n currentIds.length !== defaultIds.length ||\n difference(currentIds, defaultIds).length > 0\n );\n }\n\n public isStoringAvailable(): boolean {\n return !!this.context.settings && this.manualSave;\n }\n\n public resetValues(): void {\n const storedValues =\n this.getStoredSelectedValues({ autosave: false }) ??\n this.defaultSelectedValues;\n\n const resetTo =\n storedValues ?? (this.mode === \"all\" || this.mode === \"some\" ? [] : null);\n\n this.getTableColumn().setFilterValue(resetTo);\n this.callOnChangedHandlers(resetTo);\n }\n\n public clear(): void {\n this.getTableColumn().setFilterValue(null);\n this.callOnChangedHandlers(null);\n }\n\n public toggleValue(newValue: ListFilterValue<TRendered>): void {\n const currentValueAsArray = this.getArrayValue();\n\n let updatedValue:\n ListFilterValue<TRendered>[] | ListFilterValue<TRendered> | null;\n\n if (this.mode === \"all\" || this.mode === \"some\") {\n updatedValue = newValue.isActive\n ? currentValueAsArray.filter((v) => !v.equals(newValue))\n : [...currentValueAsArray, newValue];\n } else {\n updatedValue = newValue.isActive ? null : newValue;\n }\n\n this.getTableColumn().setFilterValue(updatedValue);\n this.callOnChangedHandlers(updatedValue);\n }\n\n /**\n * Whether the filter offers \"Select all\" — a `some` filter with enough\n * values.\n */\n public get isSelectAllAvailable(): boolean {\n return this.mode === \"some\" && this.values.length >= selectAllMinValueCount;\n }\n\n public isEveryValueActive(): boolean {\n return this.values.every((v) => v.isActive);\n }\n\n public selectAll(): void {\n this.setArrayValue(this.values);\n }\n\n /** Makes exactly these values active — what a multiple-selection menu reports. */\n public setActiveValueIds(ids: Iterable<unknown>): void {\n const idSet = new Set(ids);\n this.setArrayValue(this.values.filter((v) => idSet.has(v.id)));\n }\n\n public deselectAll(): void {\n this.setArrayValue([]);\n }\n\n private setArrayValue(value: ListFilterValue<TRendered>[]): void {\n this.getTableColumn().setFilterValue(value);\n this.callOnChangedHandlers(value);\n }\n\n public onFilterUpdated(cb: () => unknown): void {\n this.onFilterChangeCallbacks.add(cb);\n }\n}\n\nexport default ListFilter;\n"],"mappings":";;;;;;;;AAqBA,IAAM,yBACJ,aACA,kBACG,gBAAgB;;AAGrB,IAAM,yBAAyB;AAE/B,IAAM,0BACJ,UACG,OAAO,KAAK;;;;;;;;;;;;;;AAqBjB,IAAa,aAAb,MAKE;CACA;CACA;CAIA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,0CAA2C,IAAI,IAA2B;CAC1E;CACA;CACA;CAEA,YACE,SACA,OACA;EACA,MAAM,EACJ,WAAW,QAAQ,kBAAkB,SAAS,YAAY,OAC1D,aAAa,QAAQ,kBAAkB,SAAS,cAAc,MAC9D,UACA,OAAO,QACP,QACA,UAAU,uBACV,aAAa,wBAIb,WAAW,WACX,MACA,iBACA,aACE;EAEJ,KAAK,UAAU;EACf,KAAK,WAAW;EAChB,KAAK,aAAa;EAClB,KAAK,WAAW;EAChB,KAAK,aAAa,OAAO,QAAQ;EACjC,KAAK,OAAO;EACZ,KAAK,UAAU,QAAQ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;CAEA,cAA2B;EACzB,KAAK,cAAc,CAAC,CAAC;CACvB;CAEA,cAAsB,OAA2C;EAC/D,KAAK,eAAe,CAAC,CAAC,eAAe,KAAK;EAC1C,KAAK,sBAAsB,KAAK;CAClC;CAEA,gBAAuB,IAAyB;EAC9C,KAAK,wBAAwB,IAAI,EAAE;CACrC;AACF"}
@@ -1,27 +1,52 @@
1
1
  "use client"
2
2
  /* */
3
- import { CalendarDate } from "@internationalized/date";
3
+ import { CalendarDate, CalendarDateTime, ZonedDateTime } from "@internationalized/date";
4
4
  import { DateTime } from "luxon";
5
5
  //#region ../components-base/src/list/filter/dateRange.ts
6
6
  /** A range needs both ends present to be one, even if either may be unset. */
7
7
  var isListDateRange = (value) => !!value && typeof value === "object" && "start" in value && "end" in value;
8
- var startOfDay = (date) => DateTime.fromObject({
8
+ var hasTime = (date) => "hour" in date;
9
+ /**
10
+ * The date as a local point in time. A `ZonedDateTime` is the instant it names;
11
+ * anything else is read field by field, since after crossing the remote
12
+ * boundary a `CalendarDate` is a plain object.
13
+ */
14
+ var listDateToDateTime = (date) => date instanceof ZonedDateTime ? DateTime.fromJSDate(date.toDate()) : DateTime.fromObject({
9
15
  year: date.year,
10
16
  month: date.month,
11
- day: date.day
17
+ day: date.day,
18
+ ...hasTime(date) ? {
19
+ hour: date.hour,
20
+ minute: date.minute,
21
+ second: date.second
22
+ } : {}
12
23
  });
13
24
  /**
25
+ * Resolves a range to the instants it spans, for filtering on the server side.
26
+ * Both bounds are inclusive: a date covers its whole day and a date with time
27
+ * its whole minute, in the user's local time zone. A missing side has no
28
+ * bound.
29
+ */
30
+ var resolveListDateRange = (range) => {
31
+ const unit = (date) => hasTime(date) ? "minute" : "day";
32
+ return {
33
+ start: range.start ? listDateToDateTime(range.start).startOf(unit(range.start)).toJSDate() : void 0,
34
+ end: range.end ? listDateToDateTime(range.end).endOf(unit(range.end)).toJSDate() : void 0
35
+ };
36
+ };
37
+ /**
14
38
  * The cell's value as a point in time, or `undefined` when the filter does not
15
39
  * treat it as a date.
16
40
  *
17
- * Three shapes count, each on its own terms: a luxon `DateTime` and an ISO 8601
18
- * string are compared as the instant they name — a date-only string as the
19
- * start of its day — and a `CalendarDate` as its day. Anything else, a plain `{
20
- * year, month, day }` object included, is not a date here.
41
+ * A luxon `DateTime` and an ISO 8601 string are compared as the instant they
42
+ * name — a date-only string as the start of its day. A `CalendarDate` counts as
43
+ * the start of its day, a `CalendarDateTime` as its local time and a
44
+ * `ZonedDateTime` as its instant. Anything else, a plain `{ year, month, day }`
45
+ * object included, is not a date here.
21
46
  */
22
47
  var toDateTime = (value) => {
23
48
  if (value instanceof DateTime) return value;
24
- if (value instanceof CalendarDate) return startOfDay(value);
49
+ if (value instanceof CalendarDate || value instanceof CalendarDateTime || value instanceof ZonedDateTime) return listDateToDateTime(value);
25
50
  if (typeof value === "string") return DateTime.fromISO(value);
26
51
  };
27
52
  /**
@@ -35,10 +60,9 @@ var dateRangeFilterFn = (row, columnId, range) => {
35
60
  if (!range) return true;
36
61
  const dateValue = toDateTime(row.getValue(columnId));
37
62
  if (!dateValue) return true;
38
- const startDate = range.start ? startOfDay(range.start) : void 0;
39
- const endDate = range.end ? startOfDay(range.end).endOf("day") : void 0;
40
- if (startDate && dateValue < startDate) return false;
41
- return !(endDate && dateValue > endDate);
63
+ const { start, end } = resolveListDateRange(range);
64
+ if (start && dateValue.toMillis() < start.getTime()) return false;
65
+ return !(end && dateValue.toMillis() > end.getTime());
42
66
  };
43
67
  /** Turns the column into one a date range filters. */
44
68
  var applyDateRangeColumnDef = (def) => {
@@ -46,6 +70,6 @@ var applyDateRangeColumnDef = (def) => {
46
70
  def.filterFn = dateRangeFilterFn;
47
71
  };
48
72
  //#endregion
49
- export { applyDateRangeColumnDef, dateRangeFilterFn, isListDateRange };
73
+ export { applyDateRangeColumnDef, dateRangeFilterFn, isListDateRange, listDateToDateTime, resolveListDateRange };
50
74
 
51
75
  //# sourceMappingURL=dateRange.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dateRange.mjs","names":[],"sources":["../../../../../../../../components-base/src/list/filter/dateRange.ts"],"sourcesContent":["import { CalendarDate } from \"@internationalized/date\";\nimport type { ColumnDef, Row } from \"@tanstack/table-core\";\nimport { DateTime } from \"luxon\";\n\n/** A calendar date, in whichever shape it reached the filter. */\nexport interface ListDateParts {\n readonly year: number;\n readonly month: number;\n readonly day: number;\n}\n\nexport interface ListDateRange {\n readonly start?: ListDateParts;\n readonly end?: ListDateParts;\n}\n\n/** A range needs both ends present to be one, even if either may be unset. */\nexport const isListDateRange = (value: unknown): value is ListDateRange =>\n !!value && typeof value === \"object\" && \"start\" in value && \"end\" in value;\n\n/*\n * The range's ends are read field by field: they come from the calendar, and\n * after crossing the remote boundary a `CalendarDate` is a plain object.\n */\nconst startOfDay = (date: ListDateParts): DateTime =>\n DateTime.fromObject({\n year: date.year,\n month: date.month,\n day: date.day,\n });\n\n/**\n * The cell's value as a point in time, or `undefined` when the filter does not\n * treat it as a date.\n *\n * Three shapes count, each on its own terms: a luxon `DateTime` and an ISO 8601\n * string are compared as the instant they name — a date-only string as the\n * start of its day — and a `CalendarDate` as its day. Anything else, a plain `{\n * year, month, day }` object included, is not a date here.\n */\nconst toDateTime = (value: unknown): DateTime | undefined => {\n if (value instanceof DateTime) {\n return value;\n }\n if (value instanceof CalendarDate) {\n return startOfDay(value);\n }\n if (typeof value === \"string\") {\n return DateTime.fromISO(value);\n }\n return undefined;\n};\n\n/**\n * Whether a row's date falls inside the selected range.\n *\n * A value that is not a date keeps its row: a filter the data cannot answer\n * should not empty the list. That includes a string luxon cannot parse — the\n * invalid `DateTime` compares as `NaN`, and neither end excludes it.\n */\nexport const dateRangeFilterFn = <T>(\n row: Row<T>,\n columnId: string,\n range?: ListDateRange,\n): boolean => {\n if (!range) {\n return true;\n }\n\n const dateValue = toDateTime(row.getValue(columnId));\n\n if (!dateValue) {\n return true;\n }\n\n const startDate = range.start ? startOfDay(range.start) : undefined;\n /* The whole end day counts, up to its last moment. */\n const endDate = range.end ? startOfDay(range.end).endOf(\"day\") : undefined;\n\n if (startDate && dateValue < startDate) {\n return false;\n }\n\n return !(endDate && dateValue > endDate);\n};\n\n/** Turns the column into one a date range filters. */\nexport const applyDateRangeColumnDef = <T>(def: ColumnDef<T>): void => {\n def.enableColumnFilter = true;\n def.filterFn = dateRangeFilterFn;\n};\n"],"mappings":";;;;;;AAiBA,IAAa,mBAAmB,UAC9B,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,WAAW,SAAS,SAAS;AAMvE,IAAM,cAAc,SAClB,SAAS,WAAW;CAClB,MAAM,KAAK;CACX,OAAO,KAAK;CACZ,KAAK,KAAK;AACZ,CAAC;;;;;;;;;;AAWH,IAAM,cAAc,UAAyC;CAC3D,IAAI,iBAAiB,UACnB,OAAO;CAET,IAAI,iBAAiB,cACnB,OAAO,WAAW,KAAK;CAEzB,IAAI,OAAO,UAAU,UACnB,OAAO,SAAS,QAAQ,KAAK;AAGjC;;;;;;;;AASA,IAAa,qBACX,KACA,UACA,UACY;CACZ,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,YAAY,WAAW,IAAI,SAAS,QAAQ,CAAC;CAEnD,IAAI,CAAC,WACH,OAAO;CAGT,MAAM,YAAY,MAAM,QAAQ,WAAW,MAAM,KAAK,IAAI,KAAA;CAE1D,MAAM,UAAU,MAAM,MAAM,WAAW,MAAM,GAAG,CAAC,CAAC,MAAM,KAAK,IAAI,KAAA;CAEjE,IAAI,aAAa,YAAY,WAC3B,OAAO;CAGT,OAAO,EAAE,WAAW,YAAY;AAClC;;AAGA,IAAa,2BAA8B,QAA4B;CACrE,IAAI,qBAAqB;CACzB,IAAI,WAAW;AACjB"}
1
+ {"version":3,"file":"dateRange.mjs","names":[],"sources":["../../../../../../../../components-base/src/list/filter/dateRange.ts"],"sourcesContent":["import {\n CalendarDate,\n CalendarDateTime,\n ZonedDateTime,\n} from \"@internationalized/date\";\nimport type { ColumnDef, Row } from \"@tanstack/table-core\";\nimport { DateTime } from \"luxon\";\n\n/**\n * A calendar date, in whichever shape it reached the filter — with a time of\n * day when the filter narrows down by minute.\n */\nexport interface ListDateParts {\n readonly year: number;\n readonly month: number;\n readonly day: number;\n readonly hour?: number;\n readonly minute?: number;\n readonly second?: number;\n}\n\nexport interface ListDateRange {\n readonly start?: ListDateParts;\n readonly end?: ListDateParts;\n}\n\n/** A range needs both ends present to be one, even if either may be unset. */\nexport const isListDateRange = (value: unknown): value is ListDateRange =>\n !!value && typeof value === \"object\" && \"start\" in value && \"end\" in value;\n\nconst hasTime = (date: ListDateParts) => \"hour\" in date;\n\n/**\n * The date as a local point in time. A `ZonedDateTime` is the instant it names;\n * anything else is read field by field, since after crossing the remote\n * boundary a `CalendarDate` is a plain object.\n */\nexport const listDateToDateTime = (date: ListDateParts): DateTime =>\n date instanceof ZonedDateTime\n ? DateTime.fromJSDate(date.toDate())\n : DateTime.fromObject({\n year: date.year,\n month: date.month,\n day: date.day,\n ...(hasTime(date)\n ? { hour: date.hour, minute: date.minute, second: date.second }\n : {}),\n });\n\n/**\n * Resolves a range to the instants it spans, for filtering on the server side.\n * Both bounds are inclusive: a date covers its whole day and a date with time\n * its whole minute, in the user's local time zone. A missing side has no\n * bound.\n */\nexport const resolveListDateRange = (\n range: ListDateRange,\n): { start?: Date; end?: Date } => {\n const unit = (date: ListDateParts) => (hasTime(date) ? \"minute\" : \"day\");\n\n return {\n start: range.start\n ? listDateToDateTime(range.start).startOf(unit(range.start)).toJSDate()\n : undefined,\n end: range.end\n ? listDateToDateTime(range.end).endOf(unit(range.end)).toJSDate()\n : undefined,\n };\n};\n\n/**\n * The cell's value as a point in time, or `undefined` when the filter does not\n * treat it as a date.\n *\n * A luxon `DateTime` and an ISO 8601 string are compared as the instant they\n * name — a date-only string as the start of its day. A `CalendarDate` counts as\n * the start of its day, a `CalendarDateTime` as its local time and a\n * `ZonedDateTime` as its instant. Anything else, a plain `{ year, month, day }`\n * object included, is not a date here.\n */\nconst toDateTime = (value: unknown): DateTime | undefined => {\n if (value instanceof DateTime) {\n return value;\n }\n if (\n value instanceof CalendarDate ||\n value instanceof CalendarDateTime ||\n value instanceof ZonedDateTime\n ) {\n return listDateToDateTime(value);\n }\n if (typeof value === \"string\") {\n return DateTime.fromISO(value);\n }\n return undefined;\n};\n\n/**\n * Whether a row's date falls inside the selected range.\n *\n * A value that is not a date keeps its row: a filter the data cannot answer\n * should not empty the list. That includes a string luxon cannot parse — the\n * invalid `DateTime` compares as `NaN`, and neither end excludes it.\n */\nexport const dateRangeFilterFn = <T>(\n row: Row<T>,\n columnId: string,\n range?: ListDateRange,\n): boolean => {\n if (!range) {\n return true;\n }\n\n const dateValue = toDateTime(row.getValue(columnId));\n\n if (!dateValue) {\n return true;\n }\n\n const { start, end } = resolveListDateRange(range);\n\n if (start && dateValue.toMillis() < start.getTime()) {\n return false;\n }\n\n return !(end && dateValue.toMillis() > end.getTime());\n};\n\n/** Turns the column into one a date range filters. */\nexport const applyDateRangeColumnDef = <T>(def: ColumnDef<T>): void => {\n def.enableColumnFilter = true;\n def.filterFn = dateRangeFilterFn;\n};\n"],"mappings":";;;;;;AA2BA,IAAa,mBAAmB,UAC9B,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,WAAW,SAAS,SAAS;AAEvE,IAAM,WAAW,SAAwB,UAAU;;;;;;AAOnD,IAAa,sBAAsB,SACjC,gBAAgB,gBACZ,SAAS,WAAW,KAAK,OAAO,CAAC,IACjC,SAAS,WAAW;CAClB,MAAM,KAAK;CACX,OAAO,KAAK;CACZ,KAAK,KAAK;CACV,GAAI,QAAQ,IAAI,IACZ;EAAE,MAAM,KAAK;EAAM,QAAQ,KAAK;EAAQ,QAAQ,KAAK;CAAO,IAC5D,CAAC;AACP,CAAC;;;;;;;AAQP,IAAa,wBACX,UACiC;CACjC,MAAM,QAAQ,SAAyB,QAAQ,IAAI,IAAI,WAAW;CAElE,OAAO;EACL,OAAO,MAAM,QACT,mBAAmB,MAAM,KAAK,CAAC,CAAC,QAAQ,KAAK,MAAM,KAAK,CAAC,CAAC,CAAC,SAAS,IACpE,KAAA;EACJ,KAAK,MAAM,MACP,mBAAmB,MAAM,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS,IAC9D,KAAA;CACN;AACF;;;;;;;;;;;AAYA,IAAM,cAAc,UAAyC;CAC3D,IAAI,iBAAiB,UACnB,OAAO;CAET,IACE,iBAAiB,gBACjB,iBAAiB,oBACjB,iBAAiB,eAEjB,OAAO,mBAAmB,KAAK;CAEjC,IAAI,OAAO,UAAU,UACnB,OAAO,SAAS,QAAQ,KAAK;AAGjC;;;;;;;;AASA,IAAa,qBACX,KACA,UACA,UACY;CACZ,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,YAAY,WAAW,IAAI,SAAS,QAAQ,CAAC;CAEnD,IAAI,CAAC,WACH,OAAO;CAGT,MAAM,EAAE,OAAO,QAAQ,qBAAqB,KAAK;CAEjD,IAAI,SAAS,UAAU,SAAS,IAAI,MAAM,QAAQ,GAChD,OAAO;CAGT,OAAO,EAAE,OAAO,UAAU,SAAS,IAAI,IAAI,QAAQ;AACrD;;AAGA,IAAa,2BAA8B,QAA4B;CACrE,IAAI,qBAAqB;CACzB,IAAI,WAAW;AACjB"}
@@ -0,0 +1,55 @@
1
+ "use client"
2
+ /* */
3
+ import { resolveListDateRange } from "./dateRange.mjs";
4
+ import { CalendarDate, Time, toCalendarDateTime } from "@internationalized/date";
5
+ //#region ../components-base/src/list/filter/dateTimeRangeFields.ts
6
+ var toListCalendarDate = (value) => value ? new CalendarDate(value.year, value.month, value.day) : null;
7
+ var toListTime = (value) => value && "hour" in value ? new Time(value.hour, value.minute) : null;
8
+ var listDateTimeRangeFieldsFromValue = (value) => ({
9
+ startDate: toListCalendarDate(value?.start),
10
+ startTime: toListTime(value?.start),
11
+ endDate: toListCalendarDate(value?.end),
12
+ endTime: toListTime(value?.end)
13
+ });
14
+ var toBound = (date, time) => date ? time ? toCalendarDateTime(date, time) : date : void 0;
15
+ var boundKey = (bound) => bound && [
16
+ bound.year,
17
+ bound.month,
18
+ bound.day,
19
+ bound.hour,
20
+ bound.minute
21
+ ].join("-");
22
+ var isYearComplete = (date) => !!date && date.year >= 1e3;
23
+ /** Not while a year is still being typed: "2" would read as an early end. */
24
+ var isListDateTimeRangeEndBeforeStart = (fields) => {
25
+ if (!isYearComplete(fields.startDate) || !isYearComplete(fields.endDate)) return false;
26
+ const { start, end } = resolveListDateRange({
27
+ start: toBound(fields.startDate, fields.startTime),
28
+ end: toBound(fields.endDate, fields.endTime)
29
+ });
30
+ return !!start && !!end && end < start;
31
+ };
32
+ var isListDateValid = (date, limits = {}) => {
33
+ const minValue = toListCalendarDate(limits.minValue);
34
+ const maxValue = toListCalendarDate(limits.maxValue);
35
+ return !date || !(!isYearComplete(date) || minValue && date.compare(minValue) < 0 || maxValue && date.compare(maxValue) > 0 || limits.isDateUnavailable?.(date));
36
+ };
37
+ /**
38
+ * The range the fields stand for, or `undefined` while it must not be applied:
39
+ * an invalid input keeps the last valid range, and an unchanged one needs no
40
+ * update. `null` clears the filter.
41
+ */
42
+ var getListDateTimeRangeUpdate = (fields, applied, limits) => {
43
+ if (!isListDateValid(fields.startDate, limits) || !isListDateValid(fields.endDate, limits) || isListDateTimeRangeEndBeforeStart(fields)) return;
44
+ const start = toBound(fields.startDate, fields.startTime);
45
+ const end = toBound(fields.endDate, fields.endTime);
46
+ if (boundKey(start) === boundKey(applied?.start) && boundKey(end) === boundKey(applied?.end)) return;
47
+ return start || end ? {
48
+ start,
49
+ end
50
+ } : null;
51
+ };
52
+ //#endregion
53
+ export { getListDateTimeRangeUpdate, isListDateTimeRangeEndBeforeStart, isListDateValid, listDateTimeRangeFieldsFromValue, toListCalendarDate, toListTime };
54
+
55
+ //# sourceMappingURL=dateTimeRangeFields.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateTimeRangeFields.mjs","names":[],"sources":["../../../../../../../../components-base/src/list/filter/dateTimeRangeFields.ts"],"sourcesContent":["import {\n CalendarDate,\n type CalendarDateTime,\n Time,\n toCalendarDateTime,\n} from \"@internationalized/date\";\nimport {\n resolveListDateRange,\n type ListDateParts,\n type ListDateRange,\n} from \"./dateRange\";\n\n/*\n * The rules of the date and time fields a range filter shows with\n * `granularity: \"minute\"`. Which input is valid and when it applies is the same\n * in every binding; the fields and the state holding their input are not.\n */\n\nexport interface ListDateTimeRangeFields {\n readonly startDate: CalendarDate | null;\n readonly startTime: Time | null;\n readonly endDate: CalendarDate | null;\n readonly endTime: Time | null;\n}\n\nexport interface ListDateTimeRangeLimits {\n readonly minValue?: ListDateParts | null;\n readonly maxValue?: ListDateParts | null;\n readonly isDateUnavailable?: (date: CalendarDate) => boolean;\n}\n\ntype Bound = CalendarDate | CalendarDateTime;\n\nexport interface ListDateTimeRange {\n readonly start?: Bound;\n readonly end?: Bound;\n}\n\n/* Field by field: a value from the host of a remote connection is a plain object. */\nexport const toListCalendarDate = (\n value?: ListDateParts | null,\n): CalendarDate | null =>\n value ? new CalendarDate(value.year, value.month, value.day) : null;\n\nexport const toListTime = (\n value?: { readonly hour?: number; readonly minute?: number } | null,\n): Time | null =>\n value && \"hour\" in value ? new Time(value.hour, value.minute) : null;\n\nexport const listDateTimeRangeFieldsFromValue = (\n value: ListDateRange | null,\n): ListDateTimeRangeFields => ({\n startDate: toListCalendarDate(value?.start),\n startTime: toListTime(value?.start),\n endDate: toListCalendarDate(value?.end),\n endTime: toListTime(value?.end),\n});\n\nconst toBound = (date: CalendarDate | null, time: Time | null) =>\n date ? (time ? toCalendarDateTime(date, time) : date) : undefined;\n\nconst boundKey = (bound?: ListDateParts) =>\n bound &&\n [bound.year, bound.month, bound.day, bound.hour, bound.minute].join(\"-\");\n\n// react-aria reports a typed year digit by digit (2, 20, 202, 2026)\nconst isYearComplete = (date: CalendarDate | null) =>\n !!date && date.year >= 1000;\n\n/** Not while a year is still being typed: \"2\" would read as an early end. */\nexport const isListDateTimeRangeEndBeforeStart = (\n fields: ListDateTimeRangeFields,\n): boolean => {\n if (!isYearComplete(fields.startDate) || !isYearComplete(fields.endDate)) {\n return false;\n }\n const { start, end } = resolveListDateRange({\n start: toBound(fields.startDate, fields.startTime),\n end: toBound(fields.endDate, fields.endTime),\n });\n return !!start && !!end && end < start;\n};\n\nexport const isListDateValid = (\n date: CalendarDate | null,\n limits: ListDateTimeRangeLimits = {},\n): boolean => {\n const minValue = toListCalendarDate(limits.minValue);\n const maxValue = toListCalendarDate(limits.maxValue);\n\n return (\n !date ||\n !(\n !isYearComplete(date) ||\n (minValue && date.compare(minValue) < 0) ||\n (maxValue && date.compare(maxValue) > 0) ||\n limits.isDateUnavailable?.(date)\n )\n );\n};\n\n/**\n * The range the fields stand for, or `undefined` while it must not be applied:\n * an invalid input keeps the last valid range, and an unchanged one needs no\n * update. `null` clears the filter.\n */\nexport const getListDateTimeRangeUpdate = (\n fields: ListDateTimeRangeFields,\n applied: ListDateRange | null,\n limits?: ListDateTimeRangeLimits,\n): ListDateTimeRange | null | undefined => {\n if (\n !isListDateValid(fields.startDate, limits) ||\n !isListDateValid(fields.endDate, limits) ||\n isListDateTimeRangeEndBeforeStart(fields)\n ) {\n return undefined;\n }\n\n const start = toBound(fields.startDate, fields.startTime);\n const end = toBound(fields.endDate, fields.endTime);\n\n if (\n boundKey(start) === boundKey(applied?.start) &&\n boundKey(end) === boundKey(applied?.end)\n ) {\n return undefined;\n }\n\n return start || end ? { start, end } : null;\n};\n"],"mappings":";;;;;AAuCA,IAAa,sBACX,UAEA,QAAQ,IAAI,aAAa,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,IAAI;AAEjE,IAAa,cACX,UAEA,SAAS,UAAU,QAAQ,IAAI,KAAK,MAAM,MAAM,MAAM,MAAM,IAAI;AAElE,IAAa,oCACX,WAC6B;CAC7B,WAAW,mBAAmB,OAAO,KAAK;CAC1C,WAAW,WAAW,OAAO,KAAK;CAClC,SAAS,mBAAmB,OAAO,GAAG;CACtC,SAAS,WAAW,O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EAAE;EAAO;CAAI,IAAI;AACzC"}
@@ -0,0 +1,27 @@
1
+ "use client"
2
+ /* */
3
+ import { listDateToDateTime } from "./dateRange.mjs";
4
+ import { DateFormatter } from "@internationalized/date";
5
+ //#region ../components-base/src/list/filter/formatDateRange.ts
6
+ /** The active filter chip's text: an end with time shows its time. */
7
+ var formatListDateRange = (value, locale, format) => {
8
+ const formatBound = (bound) => new DateFormatter(locale, {
9
+ year: "numeric",
10
+ month: "numeric",
11
+ day: "numeric",
12
+ ..."hour" in bound ? {
13
+ hour: "2-digit",
14
+ minute: "2-digit",
15
+ hourCycle: "h23"
16
+ } : {}
17
+ }).format(listDateToDateTime(bound).toJSDate());
18
+ const { start, end } = value;
19
+ if (start && end) return `${formatBound(start)} – ${formatBound(end)}`;
20
+ if (start) return format("dateRange.from", { date: formatBound(start) });
21
+ if (end) return format("dateRange.until", { date: formatBound(end) });
22
+ return "";
23
+ };
24
+ //#endregion
25
+ export { formatListDateRange };
26
+
27
+ //# sourceMappingURL=formatDateRange.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatDateRange.mjs","names":[],"sources":["../../../../../../../../components-base/src/list/filter/formatDateRange.ts"],"sourcesContent":["import { DateFormatter } from \"@internationalized/date\";\nimport {\n listDateToDateTime,\n type ListDateParts,\n type ListDateRange,\n} from \"./dateRange\";\n\n/** Formats the text of an open range (\"from {date}\", \"until {date}\"). */\nexport type ListDateRangeTextFormat = (\n key: \"dateRange.from\" | \"dateRange.until\",\n values: { date: string },\n) => string;\n\n/** The active filter chip's text: an end with time shows its time. */\nexport const formatListDateRange = (\n value: ListDateRange,\n locale: string,\n format: ListDateRangeTextFormat,\n): string => {\n const formatBound = (bound: ListDateParts) =>\n new DateFormatter(locale, {\n year: \"numeric\",\n month: \"numeric\",\n day: \"numeric\",\n // TimeField always shows 24 hours\n ...(\"hour\" in bound\n ? { hour: \"2-digit\", minute: \"2-digit\", hourCycle: \"h23\" }\n : {}),\n }).format(listDateToDateTime(bound).toJSDate());\n\n const { start, end } = value;\n\n if (start && end) {\n return `${formatBound(start)} – ${formatBound(end)}`;\n }\n if (start) {\n return format(\"dateRange.from\", { date: formatBound(start) });\n }\n if (end) {\n return format(\"dateRange.until\", { date: formatBound(end) });\n }\n return \"\";\n};\n"],"mappings":";;;;;;AAcA,IAAa,uBACX,OACA,QACA,WACW;CACX,MAAM,eAAe,UACnB,IAAI,cAAc,QAAQ;EACxB,MAAM;EACN,OAAO;EACP,KAAK;EAEL,GAAI,UAAU,QACV;GAAE,MAAM;GAAW,QAAQ;GAAW,WAAW;EAAM,IACvD,CAAC;CACP,CAAC,CAAC,CAAC,OAAO,mBAAmB,KAAK,CAAC,CAAC,SAAS,CAAC;CAEhD,MAAM,EAAE,OAAO,QAAQ;CAEvB,IAAI,SAAS,KACX,OAAO,GAAG,YAAY,KAAK,EAAE,KAAK,YAAY,GAAG;CAEnD,IAAI,OACF,OAAO,OAAO,kBAAkB,EAAE,MAAM,YAAY,KAAK,EAAE,CAAC;CAE9D,IAAI,KACF,OAAO,OAAO,mBAAmB,EAAE,MAAM,YAAY,GAAG,EAAE,CAAC;CAE7D,OAAO;AACT"}
@@ -2,7 +2,9 @@ export { ActionState, actionStateDurations, type ActionStateValue, } from "./act
2
2
  export { toArray, type ItemType } from "./lib/array";
3
3
  export { ListFilter } from "./list/filter/ListFilter";
4
4
  export { ListDateRangeFilter } from "./list/filter/ListDateRangeFilter";
5
- export { applyDateRangeColumnDef, dateRangeFilterFn, isListDateRange, type ListDateParts, type ListDateRange, } from "./list/filter/dateRange";
5
+ export { applyDateRangeColumnDef, dateRangeFilterFn, isListDateRange, listDateToDateTime, resolveListDateRange, type ListDateParts, type ListDateRange, } from "./list/filter/dateRange";
6
+ export { formatListDateRange, type ListDateRangeTextFormat, } from "./list/filter/formatDateRange";
7
+ export { getListDateTimeRangeUpdate, isListDateTimeRangeEndBeforeStart, isListDateValid, listDateTimeRangeFieldsFromValue, toListCalendarDate, toListTime, type ListDateTimeRange, type ListDateTimeRangeFields, type ListDateTimeRangeLimits, } from "./list/filter/dateTimeRangeFields";
6
8
  export { ListFilterValue } from "./list/filter/ListFilterValue";
7
9
  export type { FilterMatcher, FilterMode, FilterUpdatedCallback, ListFilterShape, } from "./list/filter/types";
8
10
  export { getListColumn, type ListModelContext } from "./list/ListModelContext";
@@ -83,6 +83,8 @@ export declare class ListFilter<T = never, TProp extends PropertyName<T> = never
83
83
  isActive(): boolean;
84
84
  deactivateValue(value: ListFilterValue<TRendered>): void;
85
85
  private callOnChangedHandlers;
86
+ /** Tells the listeners — the list resetting its batches among them. */
87
+ protected notifyFilterUpdated(values: unknown[]): void;
86
88
  hasChanges(): boolean;
87
89
  isStoringAvailable(): boolean;
88
90
  resetValues(): void;
@@ -1,9 +1,16 @@
1
1
  import type { ColumnDef, Row } from "@tanstack/table-core";
2
- /** A calendar date, in whichever shape it reached the filter. */
2
+ import { DateTime } from "luxon";
3
+ /**
4
+ * A calendar date, in whichever shape it reached the filter — with a time of
5
+ * day when the filter narrows down by minute.
6
+ */
3
7
  export interface ListDateParts {
4
8
  readonly year: number;
5
9
  readonly month: number;
6
10
  readonly day: number;
11
+ readonly hour?: number;
12
+ readonly minute?: number;
13
+ readonly second?: number;
7
14
  }
8
15
  export interface ListDateRange {
9
16
  readonly start?: ListDateParts;
@@ -11,6 +18,22 @@ export interface ListDateRange {
11
18
  }
12
19
  /** A range needs both ends present to be one, even if either may be unset. */
13
20
  export declare const isListDateRange: (value: unknown) => value is ListDateRange;
21
+ /**
22
+ * The date as a local point in time. A `ZonedDateTime` is the instant it names;
23
+ * anything else is read field by field, since after crossing the remote
24
+ * boundary a `CalendarDate` is a plain object.
25
+ */
26
+ export declare const listDateToDateTime: (date: ListDateParts) => DateTime;
27
+ /**
28
+ * Resolves a range to the instants it spans, for filtering on the server side.
29
+ * Both bounds are inclusive: a date covers its whole day and a date with time
30
+ * its whole minute, in the user's local time zone. A missing side has no
31
+ * bound.
32
+ */
33
+ export declare const resolveListDateRange: (range: ListDateRange) => {
34
+ start?: Date;
35
+ end?: Date;
36
+ };
14
37
  /**
15
38
  * Whether a row's date falls inside the selected range.
16
39
  *
@@ -0,0 +1,34 @@
1
+ import { CalendarDate, type CalendarDateTime, Time } from "@internationalized/date";
2
+ import { type ListDateParts, type ListDateRange } from "./dateRange";
3
+ export interface ListDateTimeRangeFields {
4
+ readonly startDate: CalendarDate | null;
5
+ readonly startTime: Time | null;
6
+ readonly endDate: CalendarDate | null;
7
+ readonly endTime: Time | null;
8
+ }
9
+ export interface ListDateTimeRangeLimits {
10
+ readonly minValue?: ListDateParts | null;
11
+ readonly maxValue?: ListDateParts | null;
12
+ readonly isDateUnavailable?: (date: CalendarDate) => boolean;
13
+ }
14
+ type Bound = CalendarDate | CalendarDateTime;
15
+ export interface ListDateTimeRange {
16
+ readonly start?: Bound;
17
+ readonly end?: Bound;
18
+ }
19
+ export declare const toListCalendarDate: (value?: ListDateParts | null) => CalendarDate | null;
20
+ export declare const toListTime: (value?: {
21
+ readonly hour?: number;
22
+ readonly minute?: number;
23
+ } | null) => Time | null;
24
+ export declare const listDateTimeRangeFieldsFromValue: (value: ListDateRange | null) => ListDateTimeRangeFields;
25
+ /** Not while a year is still being typed: "2" would read as an early end. */
26
+ export declare const isListDateTimeRangeEndBeforeStart: (fields: ListDateTimeRangeFields) => boolean;
27
+ export declare const isListDateValid: (date: CalendarDate | null, limits?: ListDateTimeRangeLimits) => boolean;
28
+ /**
29
+ * The range the fields stand for, or `undefined` while it must not be applied:
30
+ * an invalid input keeps the last valid range, and an unchanged one needs no
31
+ * update. `null` clears the filter.
32
+ */
33
+ export declare const getListDateTimeRangeUpdate: (fields: ListDateTimeRangeFields, applied: ListDateRange | null, limits?: ListDateTimeRangeLimits) => ListDateTimeRange | null | undefined;
34
+ export {};
@@ -0,0 +1,7 @@
1
+ import { type ListDateRange } from "./dateRange";
2
+ /** Formats the text of an open range ("from {date}", "until {date}"). */
3
+ export type ListDateRangeTextFormat = (key: "dateRange.from" | "dateRange.until", values: {
4
+ date: string;
5
+ }) => string;
6
+ /** The active filter chip's text: an end with time shows its time. */
7
+ export declare const formatListDateRange: (value: ListDateRange, locale: string, format: ListDateRangeTextFormat) => string;
@@ -8,7 +8,7 @@ export interface CodeBlockProps extends PropsWithClassName, PropsWithChildren, P
8
8
  * Controls truncation of long code blocks. `false` disables it, `true`
9
9
  * truncates after 8 lines, and a number sets the maximum line count.
10
10
  *
11
- * @default: false
11
+ * @default false
12
12
  */
13
13
  truncateLines?: boolean | number;
14
14
  }
@@ -15,10 +15,7 @@ export interface DonutChartProps extends Omit<Aria.ProgressBarProps, "children"
15
15
  size?: "m" | "l";
16
16
  /** Divides the fill of the donut chart into segments */
17
17
  segments?: DonutChartSegment[];
18
- /**
19
- * Whether the legend component is shown when segments are used. @default:
20
- * true
21
- */
18
+ /** Whether the legend component is shown when segments are used. @default true */
22
19
  showLegend?: boolean;
23
20
  /** The position of the legend. @default "right" */
24
21
  legendPosition?: "top" | "left" | "bottom" | "right";
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { AnyDateRangeFilter } from '../../../../model/filter/types';
3
+ interface Props {
4
+ filter: AnyDateRangeFilter;
5
+ className?: string;
6
+ }
7
+ export declare const DateTimeRangeFields: FC<Props>;
8
+ export default DateTimeRangeFields;
@@ -7,6 +7,8 @@ interface Props extends PropsWithChildren {
7
7
  triggerRef?: Ref<HTMLDivElement>;
8
8
  list: ListModel<never>;
9
9
  isTile: boolean;
10
+ /** Stable invoker of the list's latest `onAction` */
11
+ onAction?: (data: never) => void;
10
12
  }
11
13
  export declare const Item: import('react').MemoExoticComponent<(props: Props) => import('react').JSX.Element | null>;
12
14
  interface ItemContainerProps extends PropsWithChildren {
@@ -2,6 +2,7 @@ import { PropsWithChildren } from 'react';
2
2
  import { default as List } from '../../../../../model/List';
3
3
  interface P extends PropsWithChildren {
4
4
  data: never;
5
+ onAction?: (data: never) => void;
5
6
  }
6
7
  export declare const useGridItemProps: (props: P, list: List<never>) => {
7
8
  gridItemProps: {
@@ -1,7 +1,8 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { FlowComponentProps } from '../../../../lib/componentFactory/flowComponent';
3
- export interface ListSummaryProps extends FlowComponentProps, PropsWithChildren {
4
- /** Whether the summary is placed above or underneath the list @default: "top" */
3
+ import { PropsWithClassName } from '../../../../lib/types/props';
4
+ export interface ListSummaryProps extends PropsWithClassName, FlowComponentProps, PropsWithChildren {
5
+ /** Whether the summary is placed above or underneath the list @default "top" */
5
6
  position?: "top" | "bottom";
6
7
  }
7
8
  /** @flr-generate all */
@@ -0,0 +1,13 @@
1
+ import { Ref } from 'react';
2
+ import { Key } from 'react-aria-components';
3
+ import { default as ListModel } from '../../../model/List';
4
+ interface Props {
5
+ id: Key;
6
+ data: never;
7
+ list: ListModel<never>;
8
+ /** Stable invoker of the list's latest `onAction` */
9
+ onAction?: (data: never) => void;
10
+ triggerRef?: Ref<HTMLTableRowElement>;
11
+ }
12
+ export declare const Row: import('react').MemoExoticComponent<(props: Props) => import('react').JSX.Element | null>;
13
+ export default Row;
@@ -0,0 +1,7 @@
1
+ import { default as List } from '../model/List';
2
+ /**
3
+ * A stable invoker of the list's latest `onAction`, or `undefined` without one.
4
+ * An event handler only ever needs to be the latest one, so items and rows do
5
+ * not re-render for an inline `onAction`.
6
+ */
7
+ export declare const useLatestOnAction: (list: List<never>) => ((data: never) => void | undefined) | undefined;
@@ -1,6 +1,8 @@
1
1
  export type { RenderItemFn } from './model/item/types';
2
2
  export type { AsyncDataLoader, AsyncResourceFactory, DataLoaderOptions, DataLoaderResult, } from './model/loading/types';
3
3
  export type { SortingFn } from './model/sorting/types';
4
+ export type { DateRangeFilterOptions, DateRangeFilterValue, } from './model/filter/types';
5
+ export { resolveDateRangeFilterValue } from './model/filter/resolveDateRangeFilterValue';
4
6
  export { SortingFunctions } from './model/sorting/SortingFunctions';
5
7
  export * from './components/Items/views/GridList';
6
8
  export * from './components/Items/views/GridListItem';
@@ -1,9 +1,7 @@
1
1
  import { ListDateRangeFilter, ListModelContext } from '../../../../_bundled/flow-components-base/index';
2
- import { FilterShape } from './types';
2
+ import { DateRangeFilterOptions, DateRangeFilterValue, FilterShape } from './types';
3
3
  import { PropertyName } from '../types';
4
4
  import { RangeCalendarProps } from '../../../Calendar';
5
- import { DateValue } from '@internationalized/date';
6
- import { DateRange, RangeValue } from 'react-aria-components';
7
5
  import { ReactNode } from 'react';
8
6
  import { List } from '../List';
9
7
  import { FilterValue } from './FilterValue';
@@ -12,14 +10,23 @@ import { FilterValue } from './FilterValue';
12
10
  *
13
11
  * The column, the comparison and the stored value are `ListDateRangeFilter` in
14
12
  * `@mittwald/flow-components-base`, so the Vue binding filters the same dates
15
- * the same way. What is left here is the calendar's own options, which are
16
- * Flow's `RangeCalendar` props.
13
+ * the same way. What is left here are the options of the fields that pick the
14
+ * range: Flow's `RangeCalendar` props, or with `granularity: "minute"` those of
15
+ * the date and time fields.
17
16
  */
18
17
  export declare class DateRangeFilter<T = never, TProp extends PropertyName<T> = never> extends ListDateRangeFilter<T, TProp, ReactNode> {
19
- readonly dateRangeOptions?: RangeCalendarProps;
18
+ readonly dateRangeOptions?: DateRangeFilterOptions;
20
19
  constructor(context: ListModelContext<T>, shape: FilterShape<T, TProp, never>);
21
- getValue(): DateRange | null;
22
- setValue(range: RangeValue<DateValue> | null): void;
20
+ get granularity(): "day" | "minute";
21
+ get rangeCalendarProps(): RangeCalendarProps;
22
+ get dateTimeRangeOptions(): {
23
+ granularity: "minute";
24
+ minValue?: import('@internationalized/date').DateValue | null;
25
+ maxValue?: import('@internationalized/date').DateValue | null;
26
+ isDateUnavailable?: (date: import('@internationalized/date').DateValue) => boolean;
27
+ } | undefined;
28
+ getValue(): DateRangeFilterValue | null;
29
+ setValue(range: DateRangeFilterValue | null): void;
23
30
  /** The list this filter belongs to — `context`, typed as React's `List`. */
24
31
  get list(): List<T>;
25
32
  get values(): FilterValue[];
@@ -0,0 +1,11 @@
1
+ import { DateRangeFilterValue } from './types';
2
+ /**
3
+ * Resolves the value of a date range filter to the instants it spans, for
4
+ * filtering on the server side. Both bounds are inclusive: a date covers its
5
+ * whole day and a date with time its whole minute, in the user's local time
6
+ * zone. A missing side has no bound.
7
+ */
8
+ export declare const resolveDateRangeFilterValue: (range: DateRangeFilterValue) => {
9
+ start?: Date;
10
+ end?: Date;
11
+ };
@@ -3,8 +3,30 @@ import { PropertyName } from '../types';
3
3
  import { RangeCalendarProps } from '../../../Calendar';
4
4
  import { ListFilterShape } from '../../../../_bundled/flow-components-base/index';
5
5
  import { ReactNode } from 'react';
6
+ import { DateValue } from '@internationalized/date';
6
7
  export type { FilterMatcher, FilterMode, FilterUpdatedCallback, } from '../../../../_bundled/flow-components-base/index';
7
8
  export interface FilterShape<T, TProp extends PropertyName<T>, TMatcherValue> extends ListFilterShape<T, TProp, TMatcherValue, ReactNode> {
8
- dateRangeOptions?: RangeCalendarProps;
9
+ dateRangeOptions?: DateRangeFilterOptions;
10
+ }
11
+ export type DateRangeFilterOptions = ({
12
+ /**
13
+ * Whether the filter narrows down by date only, or by date and time.
14
+ *
15
+ * @default "day"
16
+ */
17
+ granularity?: "day";
18
+ } & RangeCalendarProps) | {
19
+ granularity: "minute";
20
+ minValue?: DateValue | null;
21
+ maxValue?: DateValue | null;
22
+ isDateUnavailable?: (date: DateValue) => boolean;
23
+ };
24
+ /**
25
+ * A date covers its whole day, a date with time its whole minute. A missing
26
+ * side has no bound.
27
+ */
28
+ export interface DateRangeFilterValue {
29
+ start?: DateValue;
30
+ end?: DateValue;
9
31
  }
10
32
  export type AnyDateRangeFilter = DateRangeFilter | DateRangeFilter<any, any>;