@erxes/ui 4.0.0-v2.1 → 4.0.0-v2.10

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 (318) hide show
  1. package/AGENTS.md +58 -0
  2. package/CATALOG.md +251 -0
  3. package/README.md +25 -2
  4. package/dist/components/accordion.d.ts +1 -0
  5. package/dist/components/accordion.js +1 -0
  6. package/dist/components/alert-dialog.d.ts +4 -0
  7. package/dist/components/alert-dialog.js +4 -0
  8. package/dist/components/alert.d.ts +1 -0
  9. package/dist/components/alert.js +1 -0
  10. package/dist/components/avatar.d.ts +2 -0
  11. package/dist/components/avatar.js +1 -0
  12. package/dist/components/background-gradient-animation.d.ts +4 -1
  13. package/dist/components/background-gradient-animation.js +4 -1
  14. package/dist/components/badge.d.ts +3 -0
  15. package/dist/components/badge.js +2 -0
  16. package/dist/components/breadcrumb.d.ts +1 -0
  17. package/dist/components/breadcrumb.js +1 -0
  18. package/dist/components/button.d.ts +6 -1
  19. package/dist/components/button.js +5 -1
  20. package/dist/components/calendar.d.ts +5 -0
  21. package/dist/components/calendar.js +4 -0
  22. package/dist/components/card.d.ts +1 -0
  23. package/dist/components/card.js +1 -0
  24. package/dist/components/chart-config.d.ts +4 -1
  25. package/dist/components/charts.d.ts +6 -0
  26. package/dist/components/charts.js +12 -3
  27. package/dist/components/checkbox.d.ts +1 -0
  28. package/dist/components/checkbox.js +1 -0
  29. package/dist/components/choicebox-group.d.ts +1 -0
  30. package/dist/components/choicebox-group.js +1 -0
  31. package/dist/components/collapsible.d.ts +1 -0
  32. package/dist/components/collapsible.js +1 -0
  33. package/dist/components/color-picker.d.ts +1 -0
  34. package/dist/components/color-picker.js +13 -6
  35. package/dist/components/combobox.d.ts +6 -1
  36. package/dist/components/combobox.js +9 -1
  37. package/dist/components/command-bar.d.ts +4 -0
  38. package/dist/components/command-bar.js +4 -0
  39. package/dist/components/command.d.ts +4 -0
  40. package/dist/components/command.js +4 -0
  41. package/dist/components/context-menu.d.ts +1 -0
  42. package/dist/components/context-menu.js +1 -0
  43. package/dist/components/copy-text.d.ts +1 -0
  44. package/dist/components/copy-text.js +1 -0
  45. package/dist/components/date-picker-value.d.ts +5 -9
  46. package/dist/components/date-picker-value.js +15 -34
  47. package/dist/components/date-picker.d.ts +4 -4
  48. package/dist/components/date-picker.js +9 -7
  49. package/dist/components/date-text-input.d.ts +2 -4
  50. package/dist/components/date-text-input.js +11 -9
  51. package/dist/components/dialog.d.ts +4 -0
  52. package/dist/components/dialog.js +5 -1
  53. package/dist/components/drag-handle.d.ts +1 -0
  54. package/dist/components/drag-handle.js +1 -0
  55. package/dist/components/dropdown-menu.d.ts +1 -0
  56. package/dist/components/dropdown-menu.js +1 -0
  57. package/dist/components/empty.d.ts +6 -1
  58. package/dist/components/empty.js +25 -2
  59. package/dist/components/form.d.ts +6 -2
  60. package/dist/components/form.js +8 -2
  61. package/dist/components/hover-card.d.ts +1 -0
  62. package/dist/components/hover-card.js +1 -0
  63. package/dist/components/icon-tip.d.ts +7 -0
  64. package/dist/components/icon-tip.js +16 -0
  65. package/dist/components/info-card.d.ts +4 -0
  66. package/dist/components/info-card.js +4 -0
  67. package/dist/components/input-group.d.ts +5 -4
  68. package/dist/components/input-group.js +5 -4
  69. package/dist/components/input.d.ts +1 -0
  70. package/dist/components/input.js +1 -0
  71. package/dist/components/kbd.d.ts +2 -1
  72. package/dist/components/kbd.js +2 -1
  73. package/dist/components/label.d.ts +1 -1
  74. package/dist/components/label.js +1 -1
  75. package/dist/components/multiselect.d.ts +1 -0
  76. package/dist/components/multiselect.js +3 -2
  77. package/dist/components/on-demand.d.ts +6 -0
  78. package/dist/components/on-demand.js +6 -0
  79. package/dist/components/popover.d.ts +4 -0
  80. package/dist/components/popover.js +4 -0
  81. package/dist/components/radio-group.d.ts +1 -0
  82. package/dist/components/radio-group.js +1 -0
  83. package/dist/components/scroll-area.d.ts +1 -0
  84. package/dist/components/scroll-area.js +1 -0
  85. package/dist/components/select.d.ts +5 -1
  86. package/dist/components/select.js +7 -1
  87. package/dist/components/separator.d.ts +4 -0
  88. package/dist/components/separator.js +4 -0
  89. package/dist/components/sheet.d.ts +4 -0
  90. package/dist/components/sheet.js +8 -4
  91. package/dist/components/sidebar/panel.js +29 -7
  92. package/dist/components/sidebar.d.ts +1 -0
  93. package/dist/components/sidebar.js +1 -0
  94. package/dist/components/skeleton.d.ts +1 -0
  95. package/dist/components/skeleton.js +1 -0
  96. package/dist/components/spinner.d.ts +1 -0
  97. package/dist/components/spinner.js +1 -0
  98. package/dist/components/string-array.js +1 -0
  99. package/dist/components/switch.d.ts +1 -0
  100. package/dist/components/switch.js +1 -0
  101. package/dist/components/table.d.ts +4 -0
  102. package/dist/components/table.js +4 -0
  103. package/dist/components/tabs.d.ts +8 -1
  104. package/dist/components/tabs.js +8 -1
  105. package/dist/components/text-overflow.d.ts +4 -1
  106. package/dist/components/text-overflow.js +4 -1
  107. package/dist/components/textarea.d.ts +1 -0
  108. package/dist/components/textarea.js +1 -0
  109. package/dist/components/toaster.d.ts +4 -1
  110. package/dist/components/toaster.js +5 -2
  111. package/dist/components/toggle-group.d.ts +5 -0
  112. package/dist/components/toggle-group.js +19 -11
  113. package/dist/components/toggle.d.ts +1 -0
  114. package/dist/components/toggle.js +1 -0
  115. package/dist/components/tooltip.d.ts +4 -0
  116. package/dist/components/tooltip.js +4 -0
  117. package/dist/components/upload.d.ts +4 -0
  118. package/dist/components/upload.js +20 -11
  119. package/dist/federation.d.ts +8 -1
  120. package/dist/federation.js +12 -2
  121. package/dist/hooks/use-item-keys.d.ts +11 -0
  122. package/dist/hooks/use-item-keys.js +24 -0
  123. package/dist/hooks/use-page-hotkey.d.ts +12 -0
  124. package/dist/hooks/use-page-hotkey.js +22 -0
  125. package/dist/hooks/use-toast.d.ts +5 -0
  126. package/dist/hooks/use-toast.js +5 -0
  127. package/dist/index.d.ts +33 -6
  128. package/dist/index.js +31 -4
  129. package/dist/lib/format.d.ts +60 -0
  130. package/dist/lib/format.js +86 -0
  131. package/dist/lib/money.d.ts +13 -0
  132. package/dist/lib/money.js +21 -0
  133. package/dist/lib/stored.d.ts +13 -0
  134. package/dist/lib/stored.js +41 -0
  135. package/dist/lib/text.d.ts +11 -0
  136. package/dist/lib/text.js +18 -0
  137. package/dist/modules/attachments/use-carousel.js +5 -10
  138. package/dist/modules/blocks/hooks/useBarcodeSizeForm.d.ts +1 -1
  139. package/dist/modules/blocks/utils/parseBlocks.d.ts +1 -1
  140. package/dist/modules/blocks/utils/parseBlocks.js +1 -1
  141. package/dist/modules/conditions/ConditionValueInput.d.ts +10 -0
  142. package/dist/modules/conditions/ConditionValueInput.js +166 -0
  143. package/dist/modules/conditions/ConditionsEditor.d.ts +11 -0
  144. package/dist/modules/conditions/ConditionsEditor.js +209 -0
  145. package/dist/modules/conditions/LazyConditionsEditor.d.ts +10 -0
  146. package/dist/modules/conditions/LazyConditionsEditor.js +11 -0
  147. package/dist/modules/conditions/PathPicker.d.ts +8 -0
  148. package/dist/modules/conditions/PathPicker.js +51 -0
  149. package/dist/modules/conditions/conditions.d.ts +66 -0
  150. package/dist/modules/conditions/conditions.js +136 -0
  151. package/dist/modules/display/components/EmailDisplay.d.ts +4 -0
  152. package/dist/modules/display/components/EmailDisplay.js +6 -3
  153. package/dist/modules/display/components/PhoneDisplay.d.ts +4 -0
  154. package/dist/modules/display/components/PhoneDisplay.js +4 -0
  155. package/dist/modules/display/components/RelativeDateDisplay.d.ts +7 -5
  156. package/dist/modules/display/components/RelativeDateDisplay.js +10 -8
  157. package/dist/modules/display/components/SexDisplay.d.ts +1 -0
  158. package/dist/modules/display/components/SexDisplay.js +1 -0
  159. package/dist/modules/filter/components/Filter.d.ts +4 -0
  160. package/dist/modules/filter/components/Filter.js +4 -0
  161. package/dist/modules/filter/components/FilterBar.js +5 -7
  162. package/dist/modules/filter/components/FilterDialog.js +4 -5
  163. package/dist/modules/filter/components/FilterPopover.js +1 -1
  164. package/dist/modules/filter/components/FilterProvider.d.ts +1 -2
  165. package/dist/modules/filter/components/FilterProvider.js +22 -16
  166. package/dist/modules/filter/hooks/useFilterContext.d.ts +1 -0
  167. package/dist/modules/filter/hooks/useFilterContext.js +1 -0
  168. package/dist/modules/filter/types/filter.d.ts +0 -1
  169. package/dist/modules/hotkey/components/PopoverScoped.d.ts +5 -0
  170. package/dist/modules/hotkey/components/PopoverScoped.js +5 -0
  171. package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.d.ts +1 -0
  172. package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.js +1 -0
  173. package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +5 -1
  174. package/dist/modules/hotkey/hooks/useScopedHotkeys.js +5 -1
  175. package/dist/modules/icons/components/IconComponent.d.ts +4 -0
  176. package/dist/modules/icons/components/IconComponent.js +4 -0
  177. package/dist/modules/icons/components/IconPicker.d.ts +4 -0
  178. package/dist/modules/icons/components/IconPicker.js +7 -5
  179. package/dist/modules/icons/providers/IconsProvider.d.ts +1 -0
  180. package/dist/modules/icons/providers/IconsProvider.js +1 -0
  181. package/dist/modules/inputs/components/EmailField.d.ts +4 -1
  182. package/dist/modules/inputs/components/EmailField.js +4 -1
  183. package/dist/modules/inputs/components/FullNameField.d.ts +6 -0
  184. package/dist/modules/inputs/components/FullNameField.js +20 -8
  185. package/dist/modules/inputs/components/PhoneField.d.ts +4 -1
  186. package/dist/modules/inputs/components/PhoneField.js +4 -1
  187. package/dist/modules/inputs/components/SexField.d.ts +1 -0
  188. package/dist/modules/inputs/components/SexField.js +1 -0
  189. package/dist/modules/layout/components/AppLayout.d.ts +6 -6
  190. package/dist/modules/layout/components/AppLayout.js +12 -13
  191. package/dist/modules/layout/components/AppLayoutResizeHandle.d.ts +5 -12
  192. package/dist/modules/layout/components/AppLayoutResizeHandle.js +15 -18
  193. package/dist/modules/layout/components/Page.d.ts +5 -0
  194. package/dist/modules/layout/components/Page.js +5 -0
  195. package/dist/modules/layout/components/PageHeader.d.ts +4 -1
  196. package/dist/modules/layout/components/PageHeader.js +9 -3
  197. package/dist/modules/list/DisplayMenu.d.ts +24 -0
  198. package/dist/modules/list/DisplayMenu.js +87 -0
  199. package/dist/modules/list/ListFilter.d.ts +63 -0
  200. package/dist/modules/list/ListFilter.js +44 -0
  201. package/dist/modules/list/ViewBar.d.ts +13 -0
  202. package/dist/modules/list/ViewBar.js +30 -0
  203. package/dist/modules/list/filter/AdvancedFilterDialog.d.ts +5 -0
  204. package/dist/modules/list/filter/AdvancedFilterDialog.js +52 -0
  205. package/dist/modules/list/filter/FieldMenus.d.ts +5 -0
  206. package/dist/modules/list/filter/FieldMenus.js +184 -0
  207. package/dist/modules/list/filter/ListFilterBar.d.ts +6 -0
  208. package/dist/modules/list/filter/ListFilterBar.js +246 -0
  209. package/dist/modules/list/filter/RecordCount.d.ts +7 -0
  210. package/dist/modules/list/filter/RecordCount.js +22 -0
  211. package/dist/modules/list/filter/RuleChips.d.ts +2 -0
  212. package/dist/modules/list/filter/RuleChips.js +157 -0
  213. package/dist/modules/list/filter/fieldIcons.d.ts +7 -0
  214. package/dist/modules/list/filter/fieldIcons.js +16 -0
  215. package/dist/modules/list/filter/filterRules.d.ts +46 -0
  216. package/dist/modules/list/filter/filterRules.js +166 -0
  217. package/dist/modules/list/filter/listFilterContext.d.ts +29 -0
  218. package/dist/modules/list/filter/listFilterContext.js +34 -0
  219. package/dist/modules/list/filter/listFilterQuery.d.ts +16 -0
  220. package/dist/modules/list/filter/listFilterQuery.js +22 -0
  221. package/dist/modules/navigation-menu/components/NavigationMenu.d.ts +4 -3
  222. package/dist/modules/navigation-menu/components/NavigationMenu.js +7 -7
  223. package/dist/modules/pickers/EntityPicker.d.ts +37 -0
  224. package/dist/modules/pickers/EntityPicker.js +67 -0
  225. package/dist/modules/pickers/LookupPicker.d.ts +51 -0
  226. package/dist/modules/pickers/LookupPicker.js +84 -0
  227. package/dist/modules/pickers/SelectMember.d.ts +41 -0
  228. package/dist/modules/pickers/SelectMember.js +122 -0
  229. package/dist/modules/pickers/members.d.ts +30 -0
  230. package/dist/modules/pickers/members.js +18 -0
  231. package/dist/modules/record-field/components/NumberField.d.ts +5 -0
  232. package/dist/modules/record-field/components/NumberField.js +14 -7
  233. package/dist/modules/record-field/components/TextField.d.ts +4 -0
  234. package/dist/modules/record-field/components/TextField.js +14 -3
  235. package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +5 -0
  236. package/dist/modules/record-field/meta-inputs/components/PhoneInput.js +5 -0
  237. package/dist/modules/record-list/RecordList.d.ts +18 -0
  238. package/dist/modules/record-list/RecordList.js +23 -0
  239. package/dist/modules/record-list/RecordListProvider.d.ts +30 -0
  240. package/dist/modules/record-list/RecordListProvider.js +57 -0
  241. package/dist/modules/record-list/RecordListRoot.d.ts +28 -0
  242. package/dist/modules/record-list/RecordListRoot.js +124 -0
  243. package/dist/modules/record-list/selection.d.ts +22 -0
  244. package/dist/modules/record-list/selection.js +54 -0
  245. package/dist/modules/record-panel/PanelDescriptionEditor.d.ts +9 -0
  246. package/dist/modules/record-panel/PanelDescriptionEditor.js +39 -0
  247. package/dist/modules/record-panel/PanelDescriptionField.d.ts +13 -0
  248. package/dist/modules/record-panel/PanelDescriptionField.js +39 -0
  249. package/dist/modules/record-panel/PanelField.d.ts +17 -0
  250. package/dist/modules/record-panel/PanelField.js +47 -0
  251. package/dist/modules/record-panel/PanelForm.d.ts +22 -0
  252. package/dist/modules/record-panel/PanelForm.js +81 -0
  253. package/dist/modules/record-panel/PanelLabel.d.ts +10 -0
  254. package/dist/modules/record-panel/PanelLabel.js +55 -0
  255. package/dist/modules/record-panel/PanelSection.d.ts +12 -0
  256. package/dist/modules/record-panel/PanelSection.js +24 -0
  257. package/dist/modules/record-panel/panelExpansion.d.ts +10 -0
  258. package/dist/modules/record-panel/panelExpansion.js +7 -0
  259. package/dist/modules/record-panel/useSaveOnLeave.d.ts +14 -0
  260. package/dist/modules/record-panel/useSaveOnLeave.js +42 -0
  261. package/dist/modules/record-table/components/RecordTable.d.ts +6 -0
  262. package/dist/modules/record-table/components/RecordTable.js +6 -0
  263. package/dist/modules/record-table/components/RecordTableCell.d.ts +9 -0
  264. package/dist/modules/record-table/components/RecordTableCell.js +16 -2
  265. package/dist/modules/record-table/components/RecordTableCellInline.d.ts +5 -0
  266. package/dist/modules/record-table/components/RecordTableCellInline.js +8 -7
  267. package/dist/modules/record-table/components/RecordTableCursor.js +30 -28
  268. package/dist/modules/record-table/components/RecordTableProvider.js +12 -7
  269. package/dist/modules/record-table/hooks/useTablePreferences.d.ts +1 -1
  270. package/dist/modules/record-table/hooks/useTablePreferences.js +18 -31
  271. package/dist/modules/record-table/states/RecordTableCursorState.d.ts +21 -1
  272. package/dist/modules/record-table/states/RecordTableCursorState.js +21 -3
  273. package/dist/modules/record-table/types/RecordTableCursorTypes.d.ts +1 -0
  274. package/dist/modules/record-table/types/RecordTableCursorTypes.js +1 -0
  275. package/dist/modules/records/ContactLink.d.ts +13 -0
  276. package/dist/modules/records/ContactLink.js +77 -0
  277. package/dist/modules/records/contacts.d.ts +35 -0
  278. package/dist/modules/records/contacts.js +10 -0
  279. package/dist/modules/records/openRecord.d.ts +44 -0
  280. package/dist/modules/records/openRecord.js +48 -0
  281. package/dist/state/sidebarPanelState.d.ts +5 -1
  282. package/dist/state/sidebarPanelState.js +11 -3
  283. package/dist/state/themeState.d.ts +13 -2
  284. package/dist/state/themeState.js +18 -4
  285. package/dist/theme.css +5 -2
  286. package/dist/types/SexCode.d.ts +1 -0
  287. package/dist/types/SexCode.js +1 -0
  288. package/dist/types/UIConfig.d.ts +131 -3
  289. package/dist/utils/IsUndefinedOrNull.d.ts +1 -0
  290. package/dist/utils/IsUndefinedOrNull.js +1 -0
  291. package/dist/utils/file-storage.d.ts +1 -0
  292. package/dist/utils/file-storage.js +1 -0
  293. package/dist/utils/format/formatPhoneNumber.d.ts +4 -0
  294. package/dist/utils/format/formatPhoneNumber.js +4 -0
  295. package/dist/utils/getPluginAssetsUrl.d.ts +5 -0
  296. package/dist/utils/getPluginAssetsUrl.js +5 -0
  297. package/dist/utils/host-component.d.ts +10 -0
  298. package/dist/utils/host-component.js +34 -0
  299. package/dist/utils/json.d.ts +3 -2
  300. package/dist/utils/json.js +3 -2
  301. package/dist/utils/plugin-runtime.d.ts +21 -17
  302. package/dist/utils/plugin-runtime.js +59 -12
  303. package/dist/utils/plugin-styles.d.ts +7 -0
  304. package/dist/utils/plugin-styles.js +54 -0
  305. package/dist/utils/record-timeline.d.ts +10 -9
  306. package/dist/utils/record-timeline.js +12 -17
  307. package/exports.txt +226 -0
  308. package/package.json +13 -3
  309. package/dist/constants/IntlLanguages.d.ts +0 -74
  310. package/dist/constants/IntlLanguages.js +0 -76
  311. package/dist/hooks/use-query-state.d.ts +0 -16
  312. package/dist/hooks/use-query-state.js +0 -122
  313. package/dist/modules/filter/hooks/useFilterQueryState.d.ts +0 -4
  314. package/dist/modules/filter/hooks/useFilterQueryState.js +0 -14
  315. package/dist/types/Theme.d.ts +0 -1
  316. package/dist/types/Theme.js +0 -0
  317. package/dist/utils/localization/formatDateISOStringToRelativeDate.d.ts +0 -2
  318. package/dist/utils/localization/formatDateISOStringToRelativeDate.js +0 -16
@@ -1,7 +1,8 @@
1
+ import { useFormat } from "../lib/format.js";
1
2
  import { cn } from "../lib/utils.js";
2
3
  import { ChartContext, configFor, fillOf, keyOf, useChart } from "./chart-config.js";
3
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import "react";
5
+ import React from "react";
5
6
  import * as RechartsPrimitive from "recharts";
6
7
  // src/components/charts.tsx
7
8
  /** The series colours as `--color-<key>` variables. */
@@ -10,10 +11,15 @@ const colorVariables = (config) => {
10
11
  for (const [key, { color }] of Object.entries(config)) if (color) variables[`--color-${key}`] = color;
11
12
  return variables;
12
13
  };
14
+ /**
15
+ * The frame for a recharts chart: size, theme and series colours.
16
+ * Each `config` colour becomes a `--color-<key>` variable the chart's parts can use.
17
+ */
13
18
  const ChartContainer = ({ ref, className, children, config, style, ...props }) => {
14
19
  const cssVariables = colorVariables(config);
20
+ const chart = React.useMemo(() => ({ config }), [config]);
15
21
  return /* @__PURE__ */ jsx(ChartContext.Provider, {
16
- value: { config },
22
+ value: chart,
17
23
  children: /* @__PURE__ */ jsx("div", {
18
24
  ref,
19
25
  style: {
@@ -48,6 +54,7 @@ const TooltipIndicator = ({ indicator, color, nested }) => /* @__PURE__ */ jsx("
48
54
  });
49
55
  const TooltipRow = ({ item, index, payload, props, label }) => {
50
56
  const { config } = useChart();
57
+ const fmt = useFormat();
51
58
  const { indicator = "dot", formatter } = props;
52
59
  const nested = label !== null;
53
60
  const itemConfig = configFor(config, item, keyOf(props.nameKey, item.name, item.dataKey));
@@ -66,10 +73,11 @@ const TooltipRow = ({ item, index, payload, props, label }) => {
66
73
  })]
67
74
  }), item.value !== void 0 && /* @__PURE__ */ jsx("span", {
68
75
  className: "font-mono font-medium tabular-nums text-foreground",
69
- children: item.value.toLocaleString()
76
+ children: typeof item.value === "number" ? fmt.number(item.value) : String(item.value)
70
77
  })]
71
78
  })] });
72
79
  };
80
+ /** The themed body for a recharts `Tooltip`, labelled from the config. */
73
81
  const ChartTooltipContent = ({ ref, ...props }) => {
74
82
  const { active, payload, className, indicator = "dot", hideLabel = false } = props;
75
83
  if (!active || !payload?.length) return null;
@@ -96,6 +104,7 @@ const ChartTooltipContent = ({ ref, ...props }) => {
96
104
  })]
97
105
  });
98
106
  };
107
+ /** The themed body for a recharts `Legend`: each series' icon and label. */
99
108
  const ChartLegendContent = ({ ref, className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }) => {
100
109
  const { config } = useChart();
101
110
  if (!payload?.length) return null;
@@ -1,2 +1,3 @@
1
1
  import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
2
+ /** A themed checkbox; pass `indeterminate` for a partial selection. */
2
3
  export declare const Checkbox: ({ className, ...props }: Checkbox$1.Root.Props) => import("react").JSX.Element;
@@ -2,6 +2,7 @@ import { cn } from "../lib/utils.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
4
4
  // src/components/checkbox.tsx
5
+ /** A themed checkbox; pass `indeterminate` for a partial selection. */
5
6
  const Checkbox = ({ className, ...props }) => /* @__PURE__ */ jsx(Checkbox$1.Root, {
6
7
  className: cn("peer inline-flex items-center justify-center size-4 shrink-0 rounded border border-scroll outline-offset-2 focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-ring/70 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-checked:border-primary data-indeterminate:border-primary data-checked:bg-primary data-indeterminate:bg-primary data-checked:text-primary-foreground data-indeterminate:text-primary-foreground bg-background", className),
7
8
  ...props,
@@ -13,6 +13,7 @@ interface ChoiceboxItemProps extends Omit<ComponentPropsWithoutRef<'div'>, 'titl
13
13
  children: ReactNode;
14
14
  }
15
15
  declare const ChoiceboxItem: ({ ref, className, value, title, disabled, children }: ChoiceboxItemProps & React.RefAttributes<HTMLLabelElement>) => import("react").JSX.Element;
16
+ /** Radio choices drawn as large tiles with a title and text. */
16
17
  export declare const ChoiceboxGroup: typeof ChoiceboxGroupRoot & {
17
18
  Item: typeof ChoiceboxItem;
18
19
  };
@@ -38,5 +38,6 @@ const ChoiceboxItem = ({ ref, className, value, title, disabled, children }) =>
38
38
  })]
39
39
  }, `${id}-${value}`);
40
40
  };
41
+ /** Radio choices drawn as large tiles with a title and text. */
41
42
  const ChoiceboxGroup = Object.assign(ChoiceboxGroupRoot, { Item: ChoiceboxItem });
42
43
  export { ChoiceboxGroup };
@@ -1,6 +1,7 @@
1
1
  import { IconCaretDownFilled } from "@tabler/icons-react";
2
2
  import React from "react";
3
3
  declare const TriggerIcon: ({ className, ...props }: React.ComponentProps<typeof IconCaretDownFilled>) => React.JSX.Element;
4
+ /** One section that folds open and shut, with a caret icon for its trigger. */
4
5
  export declare const Collapsible: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").CollapsibleRootProps, "ref"> & React.RefAttributes<HTMLDivElement>> & {
5
6
  Trigger: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").CollapsibleTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
6
7
  TriggerIcon: typeof TriggerIcon;
@@ -8,6 +8,7 @@ const TriggerIcon = ({ className, ...props }) => /* @__PURE__ */ jsx(IconCaretDo
8
8
  className: cn("transition-transform duration-100 group-data-closed:-rotate-90", className),
9
9
  ...props
10
10
  });
11
+ /** One section that folds open and shut, with a caret icon for its trigger. */
11
12
  const Collapsible = Object.assign(Collapsible$1.Root, {
12
13
  Trigger: Collapsible$1.Trigger,
13
14
  TriggerIcon,
@@ -19,6 +19,7 @@ declare const ColorPickerRoot: ({ ref, value, onValueChange, colors, scope, clas
19
19
  colors?: Record<string, string>;
20
20
  scope?: string;
21
21
  } & React.RefAttributes<React.ComponentRef<typeof Combobox.TriggerBase>>) => React.JSX.Element;
22
+ /** A swatch button that opens preset colours and a hex input in a popover. */
22
23
  export declare const ColorPicker: typeof ColorPickerRoot & {
23
24
  Provider: typeof ColorPickerProvider;
24
25
  Trigger: typeof ColorPickerTrigger;
@@ -5,7 +5,7 @@ import { cn } from "../lib/utils.js";
5
5
  import { PopoverScoped } from "../modules/hotkey/components/PopoverScoped.js";
6
6
  import { IconCheck, IconChevronDown } from "@tabler/icons-react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
- import { createContext, useContext, useState } from "react";
8
+ import { createContext, useContext, useMemo, useState } from "react";
9
9
  import { IMaskInput } from "react-imask";
10
10
  // src/components/color-picker.tsx
11
11
  const DEFAULT_COLORS = {
@@ -33,12 +33,17 @@ const useColorPickerContext = () => {
33
33
  return context;
34
34
  };
35
35
  const ColorPickerProvider = ({ children, value, onValueChange, colors = DEFAULT_COLORS, open, onOpenChange, scope }) => {
36
+ const picker = useMemo(() => ({
37
+ value,
38
+ onValueChange,
39
+ colors
40
+ }), [
41
+ value,
42
+ onValueChange,
43
+ colors
44
+ ]);
36
45
  return /* @__PURE__ */ jsx(ColorPickerContext.Provider, {
37
- value: {
38
- value,
39
- onValueChange,
40
- colors
41
- },
46
+ value: picker,
42
47
  children: /* @__PURE__ */ jsx(PopoverScoped, {
43
48
  scope,
44
49
  open,
@@ -83,6 +88,7 @@ const ColorPickerContent = ({ setOpen }) => {
83
88
  style: { "--swatch": value },
84
89
  children: [/* @__PURE__ */ jsx("input", {
85
90
  type: "color",
91
+ "aria-label": "Custom color",
86
92
  value: value || "#000000",
87
93
  className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer",
88
94
  onChange: (e) => onValueChange?.(e.target.value)
@@ -122,6 +128,7 @@ const ColorPickerRoot = ({ ref, value, onValueChange, colors, scope, className,
122
128
  }), /* @__PURE__ */ jsx(ColorPickerContent, { setOpen })]
123
129
  });
124
130
  };
131
+ /** A swatch button that opens preset colours and a hex input in a popover. */
125
132
  const ColorPicker = Object.assign(ColorPickerRoot, {
126
133
  Provider: ColorPickerProvider,
127
134
  Trigger: ColorPickerTrigger,
@@ -7,7 +7,7 @@ type ComboboxTriggerProps = Omit<React.ComponentProps<typeof Button>, 'variant'>
7
7
  variant?: React.ComponentProps<typeof Button>['variant'] | 'bordered';
8
8
  hideChevron?: boolean;
9
9
  };
10
- declare const ComboboxTriggerBase: ({ ref, className, children, hideChevron, variant, ...props }: ComboboxTriggerProps) => React.JSX.Element;
10
+ declare const ComboboxTriggerBase: ({ ref, className, children, hideChevron, variant, id, ...props }: ComboboxTriggerProps) => React.JSX.Element;
11
11
  declare const ComboboxTrigger: ({ ref, children, hideChevron, ...props }: ComboboxTriggerProps) => React.JSX.Element;
12
12
  declare const ComboboxValue: ({ ref, value, className, placeholder, loading, ...props }: React.HTMLAttributes<HTMLSpanElement> & {
13
13
  placeholder?: string;
@@ -35,6 +35,11 @@ declare const ComboboxEmpty: ({ ref, className, loading, error, ...props }: Reac
35
35
  loading?: boolean;
36
36
  error?: Pick<Error, 'message'> | null;
37
37
  }) => React.JSX.Element;
38
+ /**
39
+ * Parts of a popover picker: trigger, value, content, check, load-more.
40
+ * Put a `Command` inside `Combobox.Content` for the searchable list. `ChipTrigger` is the
41
+ * labelled chip a filter bar uses.
42
+ */
38
43
  export declare const Combobox: {
39
44
  TriggerBase: typeof ComboboxTriggerBase;
40
45
  Trigger: typeof ComboboxTrigger;
@@ -4,14 +4,17 @@ import { Popover } from "./popover.js";
4
4
  import { Command } from "./command.js";
5
5
  import { Skeleton } from "./skeleton.js";
6
6
  import { Spinner } from "./spinner.js";
7
+ import { useCellLabel } from "../modules/record-table/components/RecordTableCell.js";
7
8
  import { IconCheck, IconChevronDown, IconX } from "@tabler/icons-react";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
10
  import "react";
10
11
  import { useOnInView } from "react-intersection-observer";
11
12
  // src/components/combobox.tsx
12
- const ComboboxTriggerBase = ({ ref, className, children, hideChevron = false, variant = "outline", ...props }) => {
13
+ const ComboboxTriggerBase = ({ ref, className, children, hideChevron = false, variant = "outline", id, ...props }) => {
14
+ const label = useCellLabel(id);
13
15
  return /* @__PURE__ */ jsx(Popover.Trigger, {
14
16
  render: /* @__PURE__ */ jsx(Button, {
17
+ ...label,
15
18
  ref,
16
19
  variant: variant === "bordered" ? "outline" : variant,
17
20
  ...props,
@@ -128,6 +131,11 @@ const ComboboxEmpty = ({ ref, className, loading, error, ...props }) => {
128
131
  })
129
132
  });
130
133
  };
134
+ /**
135
+ * Parts of a popover picker: trigger, value, content, check, load-more.
136
+ * Put a `Command` inside `Combobox.Content` for the searchable list. `ChipTrigger` is the
137
+ * labelled chip a filter bar uses.
138
+ */
131
139
  const Combobox = {
132
140
  TriggerBase: ComboboxTriggerBase,
133
141
  Trigger: ComboboxTrigger,
@@ -10,6 +10,10 @@ declare const Value: ({ ref, className, onClose, children, ...props }: React.Com
10
10
  onClose?: () => void;
11
11
  }) => React.JSX.Element;
12
12
  declare const Bar: ({ ref, className, ...props }: React.ComponentProps<'div'>) => React.JSX.Element;
13
+ /**
14
+ * A bar floating at the page bottom with bulk actions for a selection.
15
+ * The page opens it through `open`, so it has no trigger.
16
+ */
13
17
  export declare const CommandBar: typeof Root & {
14
18
  Value: typeof Value;
15
19
  Bar: typeof Bar;
@@ -52,6 +52,10 @@ const Bar = ({ ref, className, ...props }) => {
52
52
  ...props
53
53
  });
54
54
  };
55
+ /**
56
+ * A bar floating at the page bottom with bulk actions for a selection.
57
+ * The page opens it through `open`, so it has no trigger.
58
+ */
55
59
  const CommandBar = Object.assign(Root, {
56
60
  Value,
57
61
  Bar
@@ -37,6 +37,10 @@ declare const CommandActionItem: ({ icon: Icon, label, onSelect, disabled, trail
37
37
  className?: string;
38
38
  }) => React.JSX.Element;
39
39
  declare const CommandShortcut: ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => React.JSX.Element;
40
+ /**
41
+ * A searchable list of items to pick or run, built on cmdk.
42
+ * `Command.Dialog` puts it in a palette; inside `Combobox.Content` it is a picker's list.
43
+ */
40
44
  export declare const Command: typeof CommandRoot & {
41
45
  Dialog: typeof CommandDialog;
42
46
  Input: typeof CommandInput;
@@ -131,6 +131,10 @@ const CommandShortcut = ({ className, ...props }) => {
131
131
  ...props
132
132
  });
133
133
  };
134
+ /**
135
+ * A searchable list of items to pick or run, built on cmdk.
136
+ * `Command.Dialog` puts it in a palette; inside `Combobox.Content` it is a picker's list.
137
+ */
134
138
  const Command = Object.assign(CommandRoot, {
135
139
  Dialog: CommandDialog,
136
140
  Input: CommandInput,
@@ -8,6 +8,7 @@ declare const ContextMenuContent: ({ className, side, sideOffset, align, ...prop
8
8
  declare const ContextMenuItem: ({ className, inset, ...props }: Menu.Item.Props & {
9
9
  inset?: boolean;
10
10
  }) => import("react").JSX.Element;
11
+ /** A menu that opens on right-click, beside the pointer. */
11
12
  export declare const ContextMenu: typeof ContextMenuRoot & {
12
13
  Trigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuTriggerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
13
14
  Content: typeof ContextMenuContent;
@@ -21,6 +21,7 @@ const ContextMenuItem = ({ className, inset, ...props }) => /* @__PURE__ */ jsx(
21
21
  className: cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 font-medium text-sm outline-hidden transition-colors data-highlighted:bg-accent data-disabled:pointer-events-none data-disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0", inset && "pl-8", className),
22
22
  ...props
23
23
  });
24
+ /** A menu that opens on right-click, beside the pointer. */
24
25
  const ContextMenu = Object.assign(ContextMenuRoot, {
25
26
  Trigger: ContextMenu$1.Trigger,
26
27
  Content: ContextMenuContent,
@@ -3,5 +3,6 @@ interface CopyTextProps {
3
3
  children: React.ReactNode;
4
4
  className?: string;
5
5
  }
6
+ /** Text that copies `value` to the clipboard on click and shows "Copied!". */
6
7
  export declare const CopyText: ({ value, children, className }: CopyTextProps) => import("react").JSX.Element;
7
8
  export {};
@@ -4,6 +4,7 @@ import { IconCheck } from "@tabler/icons-react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { useState } from "react";
6
6
  // src/components/copy-text.tsx
7
+ /** Text that copies `value` to the clipboard on click and shows "Copied!". */
7
8
  const CopyText = ({ value, children, className }) => {
8
9
  const [copied, setCopied] = useState(false);
9
10
  const handleCopy = async (e) => {
@@ -6,27 +6,23 @@ export type DatePickerValue = DateInput | DateInput[] | DateRange | {
6
6
  } | null | undefined;
7
7
  export type DatePickerMode = 'single' | 'multiple' | 'range';
8
8
  export type NormalizedValue = Date | Date[] | DateRange | undefined;
9
- /** Formats are written with Day.js tokens (`YYYY-MM-DD`, `MMM D, YYYY`), the picker's public API. */
10
- export declare const DEFAULT_FORMAT = "YYYY-MM-DD";
11
- export declare const DEFAULT_DISPLAY_FORMAT = "MMM D, YYYY";
12
- export declare const formatWith: (date: Date, dayjsFormat: string) => string;
13
9
  /** ISO strings without an offset are local time, like the Day.js parser this replaced. */
14
10
  export declare const toDate: (value: unknown) => Date | undefined;
15
11
  export declare const normalizeValue: (value: DatePickerValue, mode: DatePickerMode) => NormalizedValue;
16
12
  export declare const getAnchorDate: (value: NormalizedValue) => Date | undefined;
17
- /** Masks typed text as `YYYY-MM-DD` when the picker uses the default format. */
18
- export declare const maskInputText: (rawValue: string, format: string) => string;
13
+ /** Masks typed text as `yyyy-MM-dd`, clamping the month and day. */
14
+ export declare const maskInputText: (value: string) => string;
19
15
  export declare const getDateBounds: (withPresent: boolean, minDate?: Date, maxDate?: Date) => {
20
16
  minBound: Date | undefined;
21
17
  maxBound: Date | undefined;
22
18
  };
23
19
  export declare const getCalendarDisabled: (disabled: Matcher | Matcher[] | undefined, minBound?: Date, maxBound?: Date) => Matcher[];
24
- /** Parses typed text strictly; the default format also accepts unpadded months and days. */
25
- export declare const parseInputDate: (text: string, format: string, { minBound, maxBound, loose }: {
20
+ /** Parses typed text strictly; `loose` also accepts unpadded months and days. */
21
+ export declare const parseInputDate: (text: string, { minBound, maxBound, loose }: {
26
22
  minBound?: Date;
27
23
  maxBound?: Date;
28
24
  loose?: boolean;
29
25
  }) => Date | undefined;
30
26
  export declare const isDateRange: (value: NormalizedValue) => value is DateRange;
31
- export declare const describeValue: (value: NormalizedValue, format: string, formatMultiple: (count: number) => string) => string | undefined;
27
+ export declare const describeValue: (value: NormalizedValue, formatDay: (date: Date) => string, formatMultiple: (count: number) => string) => string | undefined;
32
28
  export {};
@@ -1,30 +1,12 @@
1
1
  import { endOfDay, format, getDaysInMonth, isAfter, isBefore, isValid, parse, parseISO, startOfDay } from "date-fns";
2
2
  // src/components/date-picker-value.ts
3
- /** Formats are written with Day.js tokens (`YYYY-MM-DD`, `MMM D, YYYY`), the picker's public API. */
4
- const DEFAULT_FORMAT = "YYYY-MM-DD";
5
- const DEFAULT_DISPLAY_FORMAT = "MMM D, YYYY";
6
- const LOOSE_INPUT_FORMATS = [
7
- DEFAULT_FORMAT,
8
- "YYYY-M-D",
9
- "YYYY-MM-D",
10
- "YYYY-M-DD"
3
+ const INPUT_PATTERN = "yyyy-MM-dd";
4
+ const LOOSE_INPUT_PATTERNS = [
5
+ INPUT_PATTERN,
6
+ "yyyy-M-d",
7
+ "yyyy-MM-d",
8
+ "yyyy-M-dd"
11
9
  ];
12
- const DAYJS_TOKEN = /\[([^\]]*)]|YYYY|YY|DD|D|dddd|ddd|A|a|ZZ|Z/g;
13
- const DATE_FNS_TOKEN = {
14
- YYYY: "yyyy",
15
- YY: "yy",
16
- DD: "dd",
17
- D: "d",
18
- dddd: "EEEE",
19
- ddd: "EEE",
20
- A: "a",
21
- a: "aaa",
22
- ZZ: "xx",
23
- Z: "xxx"
24
- };
25
- /** Turns a Day.js format string into the date-fns pattern with the same output. */
26
- const toDateFnsPattern = (dayjsFormat) => dayjsFormat.replace(DAYJS_TOKEN, (token, escaped) => escaped === void 0 ? DATE_FNS_TOKEN[token] ?? token : `'${escaped.replaceAll("'", "''")}'`);
27
- const formatWith = (date, dayjsFormat) => format(date, toDateFnsPattern(dayjsFormat));
28
10
  const isDateInput = (value) => value instanceof Date || typeof value === "string" || typeof value === "number";
29
11
  /** ISO strings without an offset are local time, like the Day.js parser this replaced. */
30
12
  const toDate = (value) => {
@@ -80,7 +62,8 @@ const daysInMonth = (year, month) => {
80
62
  if (year?.length !== 4 || !(monthNumber >= 1 && monthNumber <= 12)) return void 0;
81
63
  return getDaysInMonth(new Date(Number(year), monthNumber - 1, 1));
82
64
  };
83
- const formatDateMask = (value) => {
65
+ /** Masks typed text as `yyyy-MM-dd`, clamping the month and day. */
66
+ const maskInputText = (value) => {
84
67
  const [year, month, day] = splitDateSegments(value);
85
68
  const normalizedMonth = month?.length === 2 ? String(Math.min(Number(month), 12)).padStart(2, "0") : month;
86
69
  const maxDay = daysInMonth(year, normalizedMonth);
@@ -90,8 +73,6 @@ const formatDateMask = (value) => {
90
73
  day?.length === 2 && maxDay ? String(Math.min(Number(day), maxDay)).padStart(2, "0") : day
91
74
  ].filter((segment) => segment !== void 0).join("-");
92
75
  };
93
- /** Masks typed text as `YYYY-MM-DD` when the picker uses the default format. */
94
- const maskInputText = (rawValue, format) => format === "YYYY-MM-DD" ? formatDateMask(rawValue) : rawValue;
95
76
  const getDateBounds = (withPresent, minDate, maxDate) => ({
96
77
  minBound: minDate ?? (withPresent ? /* @__PURE__ */ new Date("1900-01-01") : void 0),
97
78
  maxBound: maxDate ?? (withPresent ? /* @__PURE__ */ new Date() : void 0)
@@ -102,19 +83,19 @@ const getCalendarDisabled = (disabled, minBound, maxBound) => [
102
83
  ...maxBound ? [{ after: maxBound }] : []
103
84
  ];
104
85
  const isWithinBounds = (date, minBound, maxBound) => !(minBound && isBefore(date, startOfDay(minBound))) && !(maxBound && isAfter(date, endOfDay(maxBound)));
105
- /** Parses typed text strictly; the default format also accepts unpadded months and days. */
106
- const parseInputDate = (text, format$1, { minBound, maxBound, loose }) => {
107
- const parsed = (loose && format$1 === "YYYY-MM-DD" ? LOOSE_INPUT_FORMATS : [format$1]).map(toDateFnsPattern).map((pattern) => ({
86
+ /** Parses typed text strictly; `loose` also accepts unpadded months and days. */
87
+ const parseInputDate = (text, { minBound, maxBound, loose }) => {
88
+ const parsed = (loose ? LOOSE_INPUT_PATTERNS : [INPUT_PATTERN]).map((pattern) => ({
108
89
  pattern,
109
90
  date: parse(text, pattern, /* @__PURE__ */ new Date())
110
91
  })).find(({ pattern, date }) => isValid(date) && format(date, pattern) === text)?.date;
111
92
  return parsed && isWithinBounds(parsed, minBound, maxBound) ? parsed : void 0;
112
93
  };
113
94
  const isDateRange = (value) => value !== void 0 && !(value instanceof Date) && !Array.isArray(value);
114
- const describeValue = (value, format, formatMultiple) => {
95
+ const describeValue = (value, formatDay, formatMultiple) => {
115
96
  if (Array.isArray(value)) return value.length ? formatMultiple(value.length) : void 0;
116
97
  if (!isDateRange(value) || !value.from) return void 0;
117
- const from = formatWith(value.from, format);
118
- return value.to ? `${from} - ${formatWith(value.to, format)}` : from;
98
+ const from = formatDay(value.from);
99
+ return value.to ? [from, formatDay(value.to)].join(" - ") : from;
119
100
  };
120
- export { DEFAULT_DISPLAY_FORMAT, DEFAULT_FORMAT, describeValue, formatWith, getAnchorDate, getCalendarDisabled, getDateBounds, isDateRange, maskInputText, normalizeValue, parseInputDate, toDate };
101
+ export { describeValue, getAnchorDate, getCalendarDisabled, getDateBounds, isDateRange, maskInputText, normalizeValue, parseInputDate, toDate };
@@ -11,10 +11,6 @@ export type DatePickerProps = {
11
11
  minDate?: Date;
12
12
  maxDate?: Date;
13
13
  mode?: DatePickerMode;
14
- /** Day.js tokens, e.g. `YYYY-MM-DD`. */
15
- format?: string;
16
- /** Day.js tokens, e.g. `DD.MM.YYYY`. */
17
- displayFormat?: string;
18
14
  formatMultiple?: (count: number) => string;
19
15
  variant?: 'outline' | 'default' | 'ghost';
20
16
  allowNull?: boolean;
@@ -25,5 +21,9 @@ export type DatePickerProps = {
25
21
  inline?: boolean;
26
22
  disabled?: Matcher | Matcher[];
27
23
  } & Omit<PropsBase, 'mode' | 'required' | 'disabled'>;
24
+ /**
25
+ * A date field with a calendar popover, for one day, several or a range.
26
+ * `mode` picks which; `inline` shows the calendar without the popover.
27
+ */
28
28
  export declare const DatePicker: (props: DatePickerProps) => import("react").JSX.Element;
29
29
  export {};
@@ -1,8 +1,9 @@
1
1
  import { Calendar } from "./calendar.js";
2
2
  import { Button } from "./button.js";
3
3
  import { Popover } from "./popover.js";
4
+ import { useFormat } from "../lib/format.js";
4
5
  import { cn } from "../lib/utils.js";
5
- import { DEFAULT_DISPLAY_FORMAT, DEFAULT_FORMAT, describeValue, getAnchorDate, getCalendarDisabled, getDateBounds, isDateRange, normalizeValue, toDate } from "./date-picker-value.js";
6
+ import { describeValue, getAnchorDate, getCalendarDisabled, getDateBounds, isDateRange, normalizeValue, toDate } from "./date-picker-value.js";
6
7
  import { DateTextInput } from "./date-text-input.js";
7
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
9
  import { useRef, useState } from "react";
@@ -88,7 +89,7 @@ const useDatePicker = ({ value, onChange, mode, withPresent, minDate, maxDate, d
88
89
  };
89
90
  };
90
91
  /** The props with their defaults; what is left goes to the calendar. */
91
- const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresent = false, minDate, maxDate, disabled, className, mode = "single", format = DEFAULT_FORMAT, displayFormat = format === "YYYY-MM-DD" ? DEFAULT_DISPLAY_FORMAT : format, formatMultiple = defaultFormatMultiple, variant = "outline", allowNull, clearable = allowNull ?? true, clearLabel = "Clear", calendarClassName, popoverContentProps, inline = false, defaultMonth, ...calendarProps }) => ({
92
+ const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresent = false, minDate, maxDate, disabled, className, mode = "single", formatMultiple = defaultFormatMultiple, variant = "outline", allowNull, clearable = allowNull ?? true, clearLabel = "Clear", calendarClassName, popoverContentProps, inline = false, defaultMonth, ...calendarProps }) => ({
92
93
  value,
93
94
  onChange,
94
95
  placeholder,
@@ -98,8 +99,6 @@ const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresen
98
99
  disabled,
99
100
  className,
100
101
  mode,
101
- format,
102
- displayFormat,
103
102
  formatMultiple,
104
103
  variant,
105
104
  clearable,
@@ -110,15 +109,18 @@ const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresen
110
109
  defaultMonth,
111
110
  calendarProps
112
111
  });
112
+ /**
113
+ * A date field with a calendar popover, for one day, several or a range.
114
+ * `mode` picks which; `inline` shows the calendar without the popover.
115
+ */
113
116
  const DatePicker = (props) => {
114
117
  const { calendarProps, ...o } = resolveProps(props);
115
118
  const picker = useDatePicker(o);
119
+ const fmt = useFormat();
116
120
  const { normalizedValue, isDisabled, hasValue, setIsOpen } = picker;
117
121
  const singleInput = /* @__PURE__ */ jsx(DateTextInput, {
118
122
  singleDate: normalizedValue instanceof Date ? normalizedValue : void 0,
119
123
  onChange: o.onChange,
120
- format: o.format,
121
- displayFormat: o.displayFormat,
122
124
  bounds: picker.bounds,
123
125
  calendarDisabled: picker.calendarDisabled,
124
126
  clearable: o.clearable,
@@ -158,7 +160,7 @@ const DatePicker = (props) => {
158
160
  render: /* @__PURE__ */ jsx(Button, { variant: o.variant }),
159
161
  disabled: isDisabled,
160
162
  className: cn("w-full justify-start text-left font-normal", o.className),
161
- children: describeValue(normalizedValue, o.format, o.formatMultiple) ?? o.placeholder
163
+ children: describeValue(normalizedValue, fmt.date, o.formatMultiple) ?? o.placeholder
162
164
  }),
163
165
  contentProps: o.popoverContentProps,
164
166
  children: calendar
@@ -3,7 +3,6 @@ import { Matcher } from "react-day-picker";
3
3
  type DateDraftOptions = {
4
4
  singleDate?: Date;
5
5
  onChange: (date: Date | null) => void;
6
- format: string;
7
6
  bounds: {
8
7
  minBound?: Date;
9
8
  maxBound?: Date;
@@ -13,7 +12,6 @@ type DateDraftOptions = {
13
12
  onOpen?: () => void;
14
13
  };
15
14
  type DateTextInputProps = DateDraftOptions & {
16
- displayFormat: string;
17
15
  clearLabel: string;
18
16
  isDisabled: boolean;
19
17
  placeholder: string;
@@ -21,6 +19,6 @@ type DateTextInputProps = DateDraftOptions & {
21
19
  inputRef: RefObject<HTMLInputElement | null>;
22
20
  onClear: () => void;
23
21
  };
24
- /** Typed date entry for single mode: the display format at rest, the edit format while typing. */
25
- export declare const DateTextInput: ({ displayFormat, clearLabel, isDisabled, placeholder, className, inputRef, onClear, ...options }: DateTextInputProps) => import("react").JSX.Element;
22
+ /** Typed date entry for single mode: the date in the UI's language at rest, `yyyy-MM-dd` while typing. */
23
+ export declare const DateTextInput: ({ clearLabel, isDisabled, placeholder, className, inputRef, onClear, ...options }: DateTextInputProps) => import("react").JSX.Element;
26
24
  export {};
@@ -1,16 +1,17 @@
1
1
  import { cn } from "../lib/utils.js";
2
- import { formatWith, maskInputText, parseInputDate } from "./date-picker-value.js";
2
+ import { toIsoDay, useFormat } from "../lib/format.js";
3
+ import { maskInputText, parseInputDate } from "./date-picker-value.js";
3
4
  import { IconCalendar, IconX } from "@tabler/icons-react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { useState } from "react";
6
7
  import { dateMatchModifiers } from "react-day-picker";
7
8
  // src/components/date-text-input.tsx
8
9
  /** The text being typed (null while not editing, so the text follows the value) and its handlers. */
9
- const useDateDraft = ({ singleDate, onChange, format, bounds, calendarDisabled, clearable, onOpen }) => {
10
+ const useDateDraft = ({ singleDate, onChange, bounds, calendarDisabled, clearable, onOpen }) => {
10
11
  const [draft, setDraft] = useState(null);
11
12
  const singleTime = singleDate?.getTime();
12
13
  const parseDraft = (text, loose) => {
13
- const date = text ? parseInputDate(text, format, {
14
+ const date = text ? parseInputDate(text, {
14
15
  ...bounds,
15
16
  loose
16
17
  }) : void 0;
@@ -20,7 +21,7 @@ const useDateDraft = ({ singleDate, onChange, format, bounds, calendarDisabled,
20
21
  if (date && date.getTime() !== singleTime) onChange(date);
21
22
  };
22
23
  const handleChange = (text) => {
23
- const masked = maskInputText(text, format);
24
+ const masked = maskInputText(text);
24
25
  setDraft(masked);
25
26
  if (masked) {
26
27
  const parsed = parseDraft(masked, false);
@@ -34,7 +35,7 @@ const useDateDraft = ({ singleDate, onChange, format, bounds, calendarDisabled,
34
35
  e.stopPropagation();
35
36
  const typed = e.key === "Enter" ? parseDraft(draft, true) : void 0;
36
37
  if (typed && typed.getTime() !== singleTime) {
37
- setDraft(formatWith(typed, format));
38
+ setDraft(toIsoDay(typed));
38
39
  onChange(typed);
39
40
  } else if (opensPopover) onOpen?.();
40
41
  };
@@ -43,18 +44,19 @@ const useDateDraft = ({ singleDate, onChange, format, bounds, calendarDisabled,
43
44
  setDraft,
44
45
  handleChange,
45
46
  handleKeyDown,
46
- handleFocus: () => setDraft((current) => current ?? (singleDate ? formatWith(singleDate, format) : "")),
47
+ handleFocus: () => setDraft((current) => current ?? (singleDate ? toIsoDay(singleDate) : "")),
47
48
  handleBlur: () => {
48
49
  changeTo(parseDraft(draft, true));
49
50
  setDraft(null);
50
51
  }
51
52
  };
52
53
  };
53
- /** Typed date entry for single mode: the display format at rest, the edit format while typing. */
54
- const DateTextInput = ({ displayFormat, clearLabel, isDisabled, placeholder, className, inputRef, onClear, ...options }) => {
54
+ /** Typed date entry for single mode: the date in the UI's language at rest, `yyyy-MM-dd` while typing. */
55
+ const DateTextInput = ({ clearLabel, isDisabled, placeholder, className, inputRef, onClear, ...options }) => {
55
56
  const { draft, setDraft, handleChange, handleKeyDown, handleFocus, handleBlur } = useDateDraft(options);
57
+ const fmt = useFormat();
56
58
  const { singleDate } = options;
57
- const inputText = draft ?? (singleDate ? formatWith(singleDate, displayFormat) : "");
59
+ const inputText = draft ?? (singleDate ? fmt.date(singleDate) : "");
58
60
  return /* @__PURE__ */ jsxs("div", {
59
61
  "aria-disabled": isDisabled,
60
62
  className: cn("flex h-7 w-full items-center gap-1 rounded-sm bg-background px-3 text-sm text-foreground shadow-xs transition focus-within:shadow-focus", isDisabled && "cursor-not-allowed opacity-50", className),
@@ -18,6 +18,10 @@ declare const DialogHeader: ({ className, ...props }: React.HTMLAttributes<HTMLD
18
18
  declare const DialogFooter: ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
19
19
  declare const DialogTitle: ({ className, ...props }: Dialog$1.Title.Props) => React.JSX.Element;
20
20
  declare const DialogDescription: ({ className, ...props }: Dialog$1.Description.Props) => React.JSX.Element;
21
+ /**
22
+ * A centered modal over a dimmed page, such as an image lightbox.
23
+ * Never a form: forms go in core's record side panel. To confirm an action, call `useConfirm`.
24
+ */
21
25
  export declare const Dialog: (<Payload>(props: Dialog$1.Root.Props<Payload>) => React.JSX.Element) & {
22
26
  Trigger: Dialog$1.Trigger;
23
27
  Close: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").DialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -4,8 +4,8 @@ import { IconX } from "@tabler/icons-react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import "react";
6
6
  import { cva } from "class-variance-authority";
7
- import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
8
7
  import { useTranslation } from "react-i18next";
8
+ import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
9
9
  // src/components/dialog.tsx
10
10
  /** Dims the page under a dialog. Content renders one; a hand-built popup in `Dialog.Portal` uses this. */
11
11
  const DialogBackdrop = ({ className, ...props }) => /* @__PURE__ */ jsx(Dialog$1.Backdrop, {
@@ -72,6 +72,10 @@ const DialogDescription = ({ className, ...props }) => /* @__PURE__ */ jsx(Dialo
72
72
  className: cn("text-sm text-accent-foreground", className),
73
73
  ...props
74
74
  });
75
+ /**
76
+ * A centered modal over a dimmed page, such as an image lightbox.
77
+ * Never a form: forms go in core's record side panel. To confirm an action, call `useConfirm`.
78
+ */
75
79
  const Dialog = Object.assign(Dialog$1.Root, {
76
80
  Trigger: Dialog$1.Trigger,
77
81
  Close: Dialog$1.Close,
@@ -1,4 +1,5 @@
1
1
  import { ButtonProps } from "./button.js";
2
2
  type DragHandleProps = Omit<ButtonProps, 'render' | 'children' | 'size'>;
3
+ /** A small grip button to drag a row or card by, for a sortable list. */
3
4
  export declare const DragHandle: ({ ref, className, variant, ...props }: DragHandleProps) => import("react").JSX.Element;
4
5
  export {};
@@ -3,6 +3,7 @@ import { cn } from "../lib/utils.js";
3
3
  import { IconGripVertical } from "@tabler/icons-react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  // src/components/drag-handle.tsx
6
+ /** A small grip button to drag a row or card by, for a sortable list. */
6
7
  const DragHandle = ({ ref, className, variant = "ghost", ...props }) => /* @__PURE__ */ jsx(Button, {
7
8
  className: cn("size-5 flex-none cursor-grab px-0 text-accent-foreground active:cursor-grabbing", className),
8
9
  ref,