@godxjp/ui 19.6.0 → 20.1.0

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 (326) hide show
  1. package/README.md +8 -2
  2. package/dist/app/theme-axes.d.ts +2 -0
  3. package/dist/app/theme-axes.js +45 -0
  4. package/dist/components/charts/chart-cartesian.d.ts +2 -1
  5. package/dist/components/charts/chart-cartesian.js +52 -3
  6. package/dist/components/charts/chart-category-axis.d.ts +55 -0
  7. package/dist/components/charts/chart-category-axis.js +93 -0
  8. package/dist/components/charts/chart-frame.d.ts +10 -1
  9. package/dist/components/charts/chart-frame.js +19 -3
  10. package/dist/components/charts/compact-bar-trend.d.ts +1 -1
  11. package/dist/components/charts/compact-bar-trend.js +2 -0
  12. package/dist/components/charts/pie-chart.d.ts +1 -1
  13. package/dist/components/charts/pie-chart.js +12 -1
  14. package/dist/components/charts/recharts-peer.d.ts +49 -0
  15. package/dist/components/charts/recharts-peer.js +45 -0
  16. package/dist/components/data-display/card.d.ts +14 -3
  17. package/dist/components/data-display/card.js +22 -4
  18. package/dist/components/data-display/code-block.js +6 -2
  19. package/dist/components/data-display/collapsible.d.ts +23 -4
  20. package/dist/components/data-display/collapsible.js +119 -4
  21. package/dist/components/data-display/data-table.d.ts +39 -4
  22. package/dist/components/data-display/data-table.js +802 -270
  23. package/dist/components/data-display/descriptions.d.ts +27 -6
  24. package/dist/components/data-display/descriptions.js +58 -17
  25. package/dist/components/data-display/index.d.ts +5 -1
  26. package/dist/components/data-display/index.js +4 -0
  27. package/dist/components/data-display/legend.d.ts +15 -0
  28. package/dist/components/data-display/legend.js +11 -0
  29. package/dist/components/data-display/list-row.d.ts +10 -1
  30. package/dist/components/data-display/list-row.js +8 -2
  31. package/dist/components/data-display/popover.d.ts +60 -7
  32. package/dist/components/data-display/popover.js +268 -39
  33. package/dist/components/data-display/progress.d.ts +50 -2
  34. package/dist/components/data-display/progress.js +57 -9
  35. package/dist/components/data-display/range-timeline.d.ts +38 -0
  36. package/dist/components/data-display/range-timeline.js +161 -0
  37. package/dist/components/data-display/scroll-area.js +13 -2
  38. package/dist/components/data-display/service-launcher-card.js +10 -10
  39. package/dist/components/data-display/table.d.ts +11 -3
  40. package/dist/components/data-display/table.js +48 -18
  41. package/dist/components/data-display/tree-list.js +4 -9
  42. package/dist/components/data-entry/calendar.d.ts +2 -2
  43. package/dist/components/data-entry/calendar.js +79 -33
  44. package/dist/components/data-entry/cascader.d.ts +1 -1
  45. package/dist/components/data-entry/cascader.js +188 -24
  46. package/dist/components/data-entry/checkbox.d.ts +19 -6
  47. package/dist/components/data-entry/checkbox.js +55 -16
  48. package/dist/components/data-entry/choice-option.d.ts +1 -1
  49. package/dist/components/data-entry/color-picker.d.ts +1 -1
  50. package/dist/components/data-entry/color-picker.js +17 -5
  51. package/dist/components/data-entry/control-appearance.d.ts +64 -0
  52. package/dist/components/data-entry/control-appearance.js +39 -0
  53. package/dist/components/data-entry/control-surface.d.ts +61 -0
  54. package/dist/components/data-entry/control-surface.js +39 -0
  55. package/dist/components/data-entry/date-picker.d.ts +1 -1
  56. package/dist/components/data-entry/date-picker.js +344 -113
  57. package/dist/components/data-entry/date-range-picker.d.ts +2 -2
  58. package/dist/components/data-entry/date-range-picker.js +278 -140
  59. package/dist/components/data-entry/field.js +0 -1
  60. package/dist/components/data-entry/form-field.d.ts +1 -1
  61. package/dist/components/data-entry/form-field.js +39 -4
  62. package/dist/components/data-entry/form.d.ts +4 -0
  63. package/dist/components/data-entry/form.js +5 -3
  64. package/dist/components/data-entry/index.d.ts +7 -3
  65. package/dist/components/data-entry/index.js +10 -1
  66. package/dist/components/data-entry/input-otp.d.ts +1 -1
  67. package/dist/components/data-entry/input.d.ts +12 -34
  68. package/dist/components/data-entry/input.js +92 -24
  69. package/dist/components/data-entry/label.d.ts +3 -2
  70. package/dist/components/data-entry/label.js +23 -10
  71. package/dist/components/data-entry/month-picker.d.ts +2 -2
  72. package/dist/components/data-entry/month-picker.js +47 -10
  73. package/dist/components/data-entry/month-range-picker.d.ts +2 -2
  74. package/dist/components/data-entry/month-range-picker.js +51 -11
  75. package/dist/components/data-entry/number-input.d.ts +7 -0
  76. package/dist/components/data-entry/number-input.js +147 -98
  77. package/dist/components/data-entry/password-input.d.ts +1 -1
  78. package/dist/components/data-entry/radio.d.ts +1 -1
  79. package/dist/components/data-entry/radio.js +61 -13
  80. package/dist/components/data-entry/search-input.d.ts +1 -1
  81. package/dist/components/data-entry/search-input.js +16 -2
  82. package/dist/components/data-entry/search-select.d.ts +2 -2
  83. package/dist/components/data-entry/search-select.js +209 -78
  84. package/dist/components/data-entry/select.d.ts +22 -4
  85. package/dist/components/data-entry/select.js +215 -163
  86. package/dist/components/data-entry/slider.d.ts +9 -1
  87. package/dist/components/data-entry/slider.js +87 -9
  88. package/dist/components/data-entry/switch.d.ts +3 -0
  89. package/dist/components/data-entry/switch.js +29 -3
  90. package/dist/components/data-entry/textarea.d.ts +14 -56
  91. package/dist/components/data-entry/textarea.js +80 -33
  92. package/dist/components/data-entry/time-picker.d.ts +2 -2
  93. package/dist/components/data-entry/time-picker.js +333 -109
  94. package/dist/components/data-entry/time-range-picker.d.ts +5 -0
  95. package/dist/components/data-entry/time-range-picker.js +89 -0
  96. package/dist/components/data-entry/transfer.d.ts +1 -1
  97. package/dist/components/data-entry/transfer.js +99 -31
  98. package/dist/components/data-entry/tree-select-strategy.d.ts +1 -1
  99. package/dist/components/data-entry/tree-select.d.ts +1 -1
  100. package/dist/components/data-entry/tree-select.js +197 -92
  101. package/dist/components/data-entry/tree-utils.d.ts +1 -1
  102. package/dist/components/data-entry/tree-utils.js +7 -14
  103. package/dist/components/data-entry/upload-files.d.ts +2 -0
  104. package/dist/components/data-entry/upload-files.js +31 -0
  105. package/dist/components/data-entry/upload-request.d.ts +4 -0
  106. package/dist/components/data-entry/upload-request.js +53 -0
  107. package/dist/components/data-entry/upload-types.d.ts +28 -0
  108. package/dist/components/data-entry/upload-types.js +2 -0
  109. package/dist/components/data-entry/upload.d.ts +2 -2
  110. package/dist/components/data-entry/upload.js +482 -117
  111. package/dist/components/feedback/dialog.d.ts +105 -38
  112. package/dist/components/feedback/dialog.js +268 -193
  113. package/dist/components/feedback/overlay-close-focus.d.ts +31 -0
  114. package/dist/components/feedback/overlay-close-focus.js +31 -0
  115. package/dist/components/feedback/overlay-header-tone.d.ts +1 -1
  116. package/dist/components/feedback/sheet.d.ts +53 -11
  117. package/dist/components/feedback/sheet.js +150 -81
  118. package/dist/components/feedback/tooltip.d.ts +51 -7
  119. package/dist/components/feedback/tooltip.js +107 -25
  120. package/dist/components/general/button.d.ts +1 -1
  121. package/dist/components/general/button.js +7 -3
  122. package/dist/components/general/index.d.ts +1 -0
  123. package/dist/components/general/index.js +2 -0
  124. package/dist/components/general/logo.d.ts +17 -0
  125. package/dist/components/general/logo.js +22 -16
  126. package/dist/components/general/typography.d.ts +3 -0
  127. package/dist/components/general/typography.js +15 -1
  128. package/dist/components/general/visually-hidden.d.ts +3 -0
  129. package/dist/components/general/visually-hidden.js +9 -0
  130. package/dist/components/layout/app-launcher.d.ts +34 -0
  131. package/dist/components/layout/app-launcher.js +228 -0
  132. package/dist/components/layout/app-shell.d.ts +3 -1
  133. package/dist/components/layout/app-shell.js +69 -12
  134. package/dist/components/layout/aspect-ratio.js +0 -1
  135. package/dist/components/layout/auth-divider.js +0 -1
  136. package/dist/components/layout/breadcrumb.d.ts +14 -2
  137. package/dist/components/layout/breadcrumb.js +46 -4
  138. package/dist/components/layout/flex.d.ts +1 -1
  139. package/dist/components/layout/flex.js +41 -3
  140. package/dist/components/layout/index.d.ts +3 -0
  141. package/dist/components/layout/index.js +5 -1
  142. package/dist/components/layout/nav-surface.d.ts +26 -0
  143. package/dist/components/layout/nav-surface.js +17 -0
  144. package/dist/components/layout/org-switcher.d.ts +5 -1
  145. package/dist/components/layout/org-switcher.js +25 -4
  146. package/dist/components/layout/page-container.d.ts +1 -1
  147. package/dist/components/layout/page-container.js +5 -3
  148. package/dist/components/layout/responsive-grid.d.ts +16 -2
  149. package/dist/components/layout/responsive-grid.js +29 -2
  150. package/dist/components/layout/separator.js +0 -1
  151. package/dist/components/layout/sidebar.js +4 -1
  152. package/dist/components/layout/split-pane.d.ts +14 -1
  153. package/dist/components/layout/split-pane.js +26 -13
  154. package/dist/components/layout/topbar-item.d.ts +3 -0
  155. package/dist/components/layout/topbar-item.js +19 -5
  156. package/dist/components/layout/topbar.d.ts +1 -1
  157. package/dist/components/layout/topbar.js +27 -6
  158. package/dist/components/navigation/app-setting-picker.js +21 -2
  159. package/dist/components/navigation/app-setting-toggle.d.ts +16 -0
  160. package/dist/components/navigation/app-setting-toggle.js +96 -0
  161. package/dist/components/navigation/dropdown-menu.d.ts +227 -18
  162. package/dist/components/navigation/dropdown-menu.js +402 -118
  163. package/dist/components/navigation/index.d.ts +2 -0
  164. package/dist/components/navigation/index.js +2 -0
  165. package/dist/components/navigation/pagination-utils.d.ts +2 -1
  166. package/dist/components/navigation/pagination.d.ts +2 -2
  167. package/dist/components/navigation/pagination.js +155 -83
  168. package/dist/components/navigation/steps.d.ts +2 -2
  169. package/dist/components/navigation/steps.js +29 -4
  170. package/dist/components/navigation/tabs.d.ts +29 -16
  171. package/dist/components/navigation/tabs.js +374 -144
  172. package/dist/components/ui/accordion.d.ts +50 -5
  173. package/dist/components/ui/accordion.js +239 -33
  174. package/dist/components/ui/aspect-ratio.d.ts +23 -2
  175. package/dist/components/ui/aspect-ratio.js +15 -13
  176. package/dist/components/ui/avatar.d.ts +29 -4
  177. package/dist/components/ui/avatar.js +111 -25
  178. package/dist/components/ui/hover-card.d.ts +42 -4
  179. package/dist/components/ui/hover-card.js +183 -27
  180. package/dist/components/ui/input-otp.d.ts +26 -28
  181. package/dist/components/ui/input-otp.js +50 -7
  182. package/dist/components/ui/label.js +0 -1
  183. package/dist/components/ui/password-input.d.ts +36 -2
  184. package/dist/components/ui/password-input.js +27 -7
  185. package/dist/components/ui/rating.d.ts +25 -0
  186. package/dist/components/ui/rating.js +67 -27
  187. package/dist/components/ui/segmented.d.ts +12 -3
  188. package/dist/components/ui/segmented.js +17 -2
  189. package/dist/components/ui/separator.d.ts +12 -2
  190. package/dist/components/ui/separator.js +30 -9
  191. package/dist/components/ui/tag-input.d.ts +45 -0
  192. package/dist/components/ui/tag-input.js +109 -27
  193. package/dist/components/ui/toggle-group.d.ts +50 -5
  194. package/dist/components/ui/toggle-group.js +79 -20
  195. package/dist/components/ui/toggle.d.ts +31 -5
  196. package/dist/components/ui/toggle.js +42 -3
  197. package/dist/form/form-context.d.ts +29 -0
  198. package/dist/form/form-context.js +44 -4
  199. package/dist/form/form-field-array.d.ts +22 -0
  200. package/dist/form/form-field-array.js +50 -0
  201. package/dist/form/form-field-control.d.ts +2 -1
  202. package/dist/form/form-field-control.js +116 -40
  203. package/dist/form/form-root.d.ts +2 -1
  204. package/dist/form/form-root.js +142 -23
  205. package/dist/form/index.d.ts +3 -1
  206. package/dist/form/index.js +12 -1
  207. package/dist/i18n/messages/en.json +64 -5
  208. package/dist/i18n/messages/ja.json +64 -5
  209. package/dist/i18n/messages/vi.json +64 -5
  210. package/dist/inertia/index.d.ts +20 -0
  211. package/dist/inertia/index.js +60 -1
  212. package/dist/lib/control-styles.d.ts +25 -3
  213. package/dist/lib/control-styles.js +9 -3
  214. package/dist/lib/datetime/picker-format.d.ts +8 -0
  215. package/dist/lib/datetime/picker-format.js +54 -0
  216. package/dist/lib/slot.d.ts +32 -0
  217. package/dist/lib/slot.js +22 -0
  218. package/dist/lib/variants.d.ts +22 -3
  219. package/dist/lib/variants.js +56 -1
  220. package/dist/props/components/app.prop.d.ts +25 -1
  221. package/dist/props/components/charts.prop.d.ts +21 -0
  222. package/dist/props/components/data-display.prop.d.ts +72 -4
  223. package/dist/props/components/data-entry.prop.d.ts +718 -46
  224. package/dist/props/components/form.prop.d.ts +142 -4
  225. package/dist/props/components/general.prop.d.ts +17 -1
  226. package/dist/props/components/index.d.ts +3 -3
  227. package/dist/props/components/layout.prop.d.ts +281 -11
  228. package/dist/props/components/navigation.prop.d.ts +114 -4
  229. package/dist/props/registry.d.ts +397 -11
  230. package/dist/props/registry.js +526 -11
  231. package/dist/props/vocabulary/content.prop.d.ts +1 -1
  232. package/dist/props/vocabulary/data.prop.d.ts +179 -1
  233. package/dist/props/vocabulary/index.d.ts +5 -5
  234. package/dist/props/vocabulary/interaction.prop.d.ts +68 -3
  235. package/dist/props/vocabulary/layout.prop.d.ts +57 -1
  236. package/dist/props/vocabulary/navigation.prop.d.ts +40 -0
  237. package/dist/props/vocabulary/shared.prop.d.ts +33 -0
  238. package/dist/styles/badge-layout.css +2 -1
  239. package/dist/styles/card-layout.css +26 -4
  240. package/dist/styles/chart-layout.css +15 -0
  241. package/dist/styles/control.css +657 -15
  242. package/dist/styles/core.css +5 -2
  243. package/dist/styles/data-display-layout.css +313 -6
  244. package/dist/styles/data-entry-layout.css +13 -0
  245. package/dist/styles/focus-ring.css +4 -0
  246. package/dist/styles/index.css +5 -2
  247. package/dist/styles/layout.css +327 -4
  248. package/dist/styles/navigation-layout.css +227 -0
  249. package/dist/styles/shell-layout.css +369 -13
  250. package/dist/styles/table-layout.css +95 -6
  251. package/dist/styles/text-layout.css +10 -4
  252. package/dist/tokens/base.css +2 -1
  253. package/dist/tokens/components/badge.css +1 -0
  254. package/dist/tokens/components/chart.css +6 -0
  255. package/dist/tokens/components/control.css +79 -2
  256. package/dist/tokens/components/data-display.css +20 -0
  257. package/dist/tokens/components/descriptions.css +11 -0
  258. package/dist/tokens/components/flex.css +8 -0
  259. package/dist/tokens/components/navigation.css +55 -0
  260. package/dist/tokens/components/shell.css +53 -3
  261. package/dist/tokens/components/table.css +14 -0
  262. package/dist/tokens/foundation.css +2 -0
  263. package/dist/tokens/semantic/layout.css +9 -0
  264. package/docs/COMPONENTS.md +9 -3
  265. package/docs/CONSUMER-RULES.md +13 -0
  266. package/docs/DESIGN-AUTHORITY.md +145 -83
  267. package/docs/DEVELOPMENT.md +4 -3
  268. package/docs/FORMS.md +151 -6
  269. package/docs/FRAME-COVERAGE-REPORT.md +32 -17
  270. package/docs/README.md +15 -15
  271. package/docs/STANDARDS-vocabulary-tokens.md +1 -1
  272. package/docs/TESTING.md +15 -6
  273. package/docs/WHAT-BELONGS-HERE.md +179 -0
  274. package/docs/charts/cjk-category-axis.tsx +81 -0
  275. package/docs/data-display/card/index.tsx +22 -0
  276. package/docs/data-display/data-table/examples/antd-parity.tsx +257 -0
  277. package/docs/data-display/data-table/index.tsx +23 -0
  278. package/docs/data-display/descriptions.tsx +41 -0
  279. package/docs/data-display/legend.tsx +145 -0
  280. package/docs/data-display/progress.tsx +32 -0
  281. package/docs/data-display/scroll-area.tsx +31 -25
  282. package/docs/data-display/table.tsx +104 -45
  283. package/docs/data-display/timeline.tsx +41 -0
  284. package/docs/data-entry/date-picker.tsx +85 -0
  285. package/docs/data-entry/date-range-picker.tsx +26 -0
  286. package/docs/data-entry/form-dynamic-fields.tsx +199 -0
  287. package/docs/data-entry/form.tsx +74 -4
  288. package/docs/data-entry/input-otp.tsx +24 -0
  289. package/docs/data-entry/input.tsx +46 -1
  290. package/docs/data-entry/month-range-picker.tsx +1 -1
  291. package/docs/data-entry/segmented.tsx +1 -1
  292. package/docs/data-entry/select.tsx +29 -2
  293. package/docs/data-entry/switch.tsx +41 -0
  294. package/docs/data-entry/textarea.tsx +38 -0
  295. package/docs/data-entry/time-picker.tsx +85 -1
  296. package/docs/data-entry/time-range-picker.tsx +55 -0
  297. package/docs/data-entry/transfer.tsx +17 -0
  298. package/docs/data-entry/upload.tsx +56 -12
  299. package/docs/feedback/sheet.tsx +1 -1
  300. package/docs/feedback/tooltip.tsx +1 -1
  301. package/docs/general/activity.tsx +2 -2
  302. package/docs/general/button/index.tsx +14 -1
  303. package/docs/general/typography.tsx +14 -1
  304. package/docs/layout/app-launcher.tsx +151 -0
  305. package/docs/layout/app-shell-arrangements.tsx +225 -0
  306. package/docs/layout/app-shell.tsx +11 -0
  307. package/docs/layout/aspect-ratio.tsx +1 -1
  308. package/docs/layout/flex.tsx +50 -0
  309. package/docs/layout/responsive-grid.tsx +21 -1
  310. package/docs/layout/topbar.tsx +5 -9
  311. package/docs/navigation/app-setting-picker.tsx +37 -1
  312. package/docs/navigation/app-setting-toggle.tsx +111 -0
  313. package/docs/navigation/breadcrumb.tsx +48 -0
  314. package/docs/navigation/dropdown-menu.tsx +21 -0
  315. package/docs/navigation/pagination.tsx +52 -0
  316. package/docs/navigation/steps.tsx +37 -0
  317. package/docs/navigation/tabs.tsx +97 -1
  318. package/docs/query/button-refetch.tsx +1 -0
  319. package/package.json +28 -8
  320. package/scripts/_agent-setup.mjs +182 -3
  321. package/scripts/consumer-rule.md +98 -0
  322. package/scripts/guinea-pig-skill.md +322 -0
  323. package/scripts/init-guinea-pig.mjs +84 -0
  324. package/scripts/postinstall.mjs +13 -2
  325. package/scripts/ui-audit.mjs +351 -37
  326. /package/dist/tokens/{antd.generated.css → derived.css} +0 -0
@@ -0,0 +1,39 @@
1
+ function controlAppearanceAttributes({
2
+ status,
3
+ variant,
4
+ "aria-invalid": ariaInvalid
5
+ }) {
6
+ return {
7
+ "data-status": status,
8
+ "data-variant": variant,
9
+ "aria-invalid": ariaInvalid ?? (status === "error" ? true : void 0)
10
+ };
11
+ }
12
+ const CONTROL_VARIANT_CHROME_CLASS = {
13
+ outlined: "border-input bg-background",
14
+ filled: "ui-control--filled",
15
+ borderless: "ui-control--borderless"
16
+ };
17
+ const CONTROL_STATUS_CHROME_CLASS = "data-[status=error]:border-destructive data-[status=warning]:border-warning";
18
+ function countCodePoints(value) {
19
+ return [...value].length;
20
+ }
21
+ function resolveControlCount(config, value) {
22
+ if (!config || config.show === false) return null;
23
+ const strategy = config.strategy ?? countCodePoints;
24
+ const count = strategy(value);
25
+ const max = config.max;
26
+ return {
27
+ count,
28
+ max,
29
+ exceeded: max != null && count > max,
30
+ content: config.formatter ? config.formatter({ value, count, max }) : max == null ? String(count) : `${count} / ${max}`
31
+ };
32
+ }
33
+ export {
34
+ CONTROL_STATUS_CHROME_CLASS,
35
+ CONTROL_VARIANT_CHROME_CLASS,
36
+ controlAppearanceAttributes,
37
+ countCodePoints,
38
+ resolveControlCount
39
+ };
@@ -0,0 +1,61 @@
1
+ import type * as React from "react";
2
+ import type { AllowClearProp, ControlStatusProp, ControlVariantProp, MaxTagPlaceholderProp, SizeProp } from "../../props/vocabulary/index.js";
3
+ /**
4
+ * The DOM attributes that put a control on the `variant` × `status` × `size` matrix owned by
5
+ * `.ui-control-surface` in `src/styles/control.css`.
6
+ *
7
+ * Written once, here, rather than five times: every member of the select family (Select,
8
+ * SearchSelect, Cascader, TreeSelect, TagInput) states the antd surface contract the same way, and
9
+ * a per-component copy is how the five drift apart. Each default (`outlined`, `md`) emits NO
10
+ * attribute at all, so a control that says nothing keeps the exact DOM it had.
11
+ */
12
+ export declare function controlSurfaceAttrs(props: {
13
+ variant?: ControlVariantProp;
14
+ status?: ControlStatusProp;
15
+ size?: SizeProp;
16
+ }): {
17
+ "data-variant"?: ControlVariantProp;
18
+ "data-status"?: ControlStatusProp;
19
+ "data-size"?: SizeProp;
20
+ };
21
+ /**
22
+ * `status="error"` must also reach assistive tech, so it folds into `aria-invalid`.
23
+ *
24
+ * antd's own `status="error"` is a pure recolour — a state announced by hue alone, which WCAG 2.2
25
+ * SC 1.4.1 does not accept. An `aria-invalid` arriving from `FormField` always wins: the field's
26
+ * validation state is the authority, and a `status` prop must never be able to talk it down.
27
+ */
28
+ export declare function resolveAriaInvalid<T extends React.AriaAttributes["aria-invalid"]>(ariaInvalid: T, status: ControlStatusProp | undefined): T | true | undefined;
29
+ /** The normalised clear affordance: whether to offer it, with what icon, under what label. */
30
+ export type ResolvedAllowClear = {
31
+ enabled: boolean;
32
+ clearIcon?: React.ReactNode;
33
+ label?: string;
34
+ };
35
+ /**
36
+ * Reconcile antd's `allowClear` with this library's own `clearable`.
37
+ *
38
+ * `allowClear` wins when present because it is the more specific statement — the object form
39
+ * carries an icon and a label that `clearable` has no way to express. `clearable` remains the
40
+ * name every existing call site uses, and keeps its `true` default.
41
+ */
42
+ export declare function resolveAllowClear(allowClear: AllowClearProp | undefined, clearable: boolean | undefined, fallbackLabel?: string): ResolvedAllowClear;
43
+ /**
44
+ * Apply antd's `maxTagCount` / `maxTagPlaceholder` to a list of selected values.
45
+ *
46
+ * Returns the values that stay visible plus the overflow node, so the three call sites (Cascader,
47
+ * TreeSelect, TagInput) agree on what "+2" means. `maxTagCount` is only honoured when it is a
48
+ * non-negative number — `undefined` shows everything, which is the antd default.
49
+ *
50
+ * `overflow` is `undefined` when the consumer supplied no `maxTagPlaceholder`: the fallback wording
51
+ * is a COUNT, and a count has to go through `t()` + `Intl.PluralRules` at the call site rather than
52
+ * be concatenated here.
53
+ */
54
+ export declare function applyMaxTagCount<T extends {
55
+ value: string;
56
+ label: React.ReactNode;
57
+ }>(items: T[], maxTagCount: number | undefined, maxTagPlaceholder: MaxTagPlaceholderProp | undefined): {
58
+ visible: T[];
59
+ omitted: T[];
60
+ overflow: React.ReactNode | undefined;
61
+ };
@@ -0,0 +1,39 @@
1
+ function controlSurfaceAttrs(props) {
2
+ return {
3
+ "data-variant": props.variant && props.variant !== "outlined" ? props.variant : void 0,
4
+ "data-status": props.status,
5
+ "data-size": props.size && props.size !== "md" ? props.size : void 0
6
+ };
7
+ }
8
+ function resolveAriaInvalid(ariaInvalid, status) {
9
+ if (ariaInvalid !== void 0) return ariaInvalid;
10
+ return status === "error" ? true : void 0;
11
+ }
12
+ function resolveAllowClear(allowClear, clearable, fallbackLabel) {
13
+ if (allowClear !== void 0) {
14
+ if (typeof allowClear === "boolean") {
15
+ return { enabled: allowClear, label: fallbackLabel };
16
+ }
17
+ return {
18
+ enabled: true,
19
+ clearIcon: allowClear.clearIcon,
20
+ label: allowClear.label ?? fallbackLabel
21
+ };
22
+ }
23
+ return { enabled: clearable !== false, label: fallbackLabel };
24
+ }
25
+ function applyMaxTagCount(items, maxTagCount, maxTagPlaceholder) {
26
+ if (maxTagCount === void 0 || maxTagCount < 0 || items.length <= maxTagCount) {
27
+ return { visible: items, omitted: [], overflow: void 0 };
28
+ }
29
+ const visible = items.slice(0, maxTagCount);
30
+ const omitted = items.slice(maxTagCount);
31
+ const overflow = typeof maxTagPlaceholder === "function" ? maxTagPlaceholder(omitted.map(({ value, label }) => ({ value, label }))) : maxTagPlaceholder;
32
+ return { visible, omitted, overflow };
33
+ }
34
+ export {
35
+ applyMaxTagCount,
36
+ controlSurfaceAttrs,
37
+ resolveAllowClear,
38
+ resolveAriaInvalid
39
+ };
@@ -6,4 +6,4 @@ export type { DatePickerProp, DatePickerProp as DatePickerProps, } from "../../p
6
6
  * `yyyy-MM-dd` string (the international standard): it is form-submittable (give it a `name`),
7
7
  * screen-reader friendly, and e2e-testable by simply filling the input.
8
8
  */
9
- export declare function DatePicker({ value: valueProp, defaultValue, onValueChange, placeholder, disabled, className, id, name, locale: localeProp, showToday, showClose, fromDate, toDate, allowClear, ...ariaProps }: DatePickerProp): React.JSX.Element;
9
+ export declare function DatePicker(props: DatePickerProp): React.JSX.Element;
@@ -1,36 +1,92 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { CalendarIcon, X } from "lucide-react";
4
+ import { CalendarIcon, ChevronLeft, ChevronRight, X } from "lucide-react";
5
5
  import { usePickerLocales, useTranslation } from "../../i18n/use-translation.js";
6
- import { parseDateInput, toIsoDate } from "../../lib/datetime/parse.js";
6
+ import { toIsoDate } from "../../lib/datetime/parse.js";
7
+ import {
8
+ formatPickerDate,
9
+ parsePickerDate,
10
+ pickerDateAllowed,
11
+ pickerPeriodStart
12
+ } from "../../lib/datetime/picker-format.js";
13
+ import { Button } from "../general/button.js";
14
+ import { Flex } from "../layout/flex.js";
15
+ import { TimePicker } from "./time-picker.js";
7
16
  import { useControlledLatch } from "../../lib/hooks.js";
8
17
  import { pickFieldA11y, useFieldIdentity } from "../../lib/field-a11y.js";
9
18
  import { cn } from "../../lib/utils.js";
19
+ import { resolveAllowClear } from "./control-surface.js";
10
20
  import { Input } from "./input.js";
11
21
  import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../data-display/popover.js";
12
22
  import { Calendar } from "./calendar.js";
13
23
  const ISO_HINT = "yyyy-mm-dd";
14
- function DatePicker({
15
- value: valueProp,
16
- defaultValue,
17
- onValueChange,
18
- placeholder,
19
- disabled,
20
- className,
21
- id,
22
- name,
23
- locale: localeProp,
24
- showToday,
25
- showClose,
26
- fromDate,
27
- toDate,
28
- allowClear = true,
29
- ...ariaProps
30
- }) {
24
+ function DatePicker(props) {
25
+ const {
26
+ value: valueProp,
27
+ defaultValue,
28
+ placeholder,
29
+ disabled,
30
+ className,
31
+ id,
32
+ name,
33
+ locale: localeProp,
34
+ showToday,
35
+ showClose,
36
+ fromDate,
37
+ toDate,
38
+ disabledDate,
39
+ cellRender,
40
+ allowClear,
41
+ format: formatProp,
42
+ parseFormat,
43
+ minDate,
44
+ maxDate,
45
+ showWeek,
46
+ showTime,
47
+ presets,
48
+ multiple = false,
49
+ picker = "date",
50
+ order = true,
51
+ needConfirm = Boolean(showTime),
52
+ open: openProp,
53
+ defaultOpen = false,
54
+ onOpenChange,
55
+ inputReadOnly,
56
+ preserveInvalidOnBlur,
57
+ placement = "bottom-start",
58
+ renderExtraFooter,
59
+ size,
60
+ status,
61
+ variant,
62
+ ref,
63
+ ...ariaProps
64
+ } = props;
65
+ const format = formatProp ?? (typeof showTime === "object" && showTime.showSeconds ? "yyyy-MM-dd HH:mm:ss" : void 0);
31
66
  const { t } = useTranslation();
32
- const { dayPickerLocale } = usePickerLocales(localeProp);
33
- const [open, setOpen] = React.useState(false);
67
+ const { dayPickerLocale, locale } = usePickerLocales(localeProp);
68
+ const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
69
+ const open = !disabled && (openProp ?? internalOpen);
70
+ const [pending, setPending] = React.useState();
71
+ const [hasPending, setHasPending] = React.useState(false);
72
+ const setOpen = (next) => {
73
+ if (disabled && next) return;
74
+ if (openProp === void 0) setInternalOpen(next);
75
+ onOpenChange?.(next);
76
+ if (!next) {
77
+ setHasPending(false);
78
+ setPending(void 0);
79
+ }
80
+ };
81
+ const timeAllowed = (date) => {
82
+ const rules = typeof showTime === "object" ? showTime.disabledTime?.() : void 0;
83
+ return !(rules?.disabledHours?.().includes(date.getHours()) || rules?.disabledMinutes?.(date.getHours()).includes(date.getMinutes()) || rules?.disabledSeconds?.(date.getHours(), date.getMinutes()).includes(date.getSeconds()));
84
+ };
85
+ const minimum = minDate ?? fromDate;
86
+ const maximum = maxDate ?? toDate;
87
+ const allowed = (date) => pickerDateAllowed(date, minimum, maximum, disabledDate);
88
+ const display = (date) => Array.isArray(date) ? date.map((day) => formatPickerDate(day, format, locale)).join(", ") : formatPickerDate(date, format, locale, Boolean(showTime));
89
+ const parse = (text2) => parsePickerDate(text2, format, parseFormat, Boolean(showTime));
34
90
  const fieldA11y = pickFieldA11y(ariaProps);
35
91
  const identity = useFieldIdentity({ id, name, "data-field": fieldA11y["data-field"] });
36
92
  const resolvedName = name ?? identity.name;
@@ -40,63 +96,106 @@ function DatePicker({
40
96
  const isControlled = useControlledLatch(valueProp !== void 0);
41
97
  const [internalValue, setInternalValue] = React.useState(defaultValue);
42
98
  const value = isControlled ? valueProp : internalValue;
99
+ const working = hasPending ? pending : value;
100
+ const selectedDate = Array.isArray(working) ? working[0] : working;
101
+ const [viewYear, setViewYear] = React.useState((selectedDate ?? /* @__PURE__ */ new Date()).getFullYear());
102
+ const periodDate = (date) => pickerPeriodStart(date, picker, dayPickerLocale);
43
103
  const emit = (next) => {
44
104
  if (!isControlled) setInternalValue(next);
45
- onValueChange?.(next);
105
+ if (props.multiple)
106
+ props.onValueChange?.(Array.isArray(next) ? next : next ? [next] : void 0);
107
+ else props.onValueChange?.(Array.isArray(next) ? next[0] : next);
46
108
  };
47
- const [text, setText] = React.useState(() => toIsoDate(value));
109
+ const [text, setText] = React.useState(() => display(value));
48
110
  React.useEffect(() => {
49
- setText(toIsoDate(value));
50
- }, [value]);
111
+ setText(
112
+ Array.isArray(value) ? value.map((date) => formatPickerDate(date, format, locale)).join(", ") : formatPickerDate(value, format, locale, Boolean(showTime))
113
+ );
114
+ }, [value, format, locale, showTime]);
51
115
  const resolvedPlaceholder = placeholder ?? t("dataEntry.datePicker.placeholder") ?? ISO_HINT;
52
116
  const clear = () => {
53
117
  emit(void 0);
54
118
  setText("");
55
119
  };
56
- const showClear = allowClear && text !== "" && !disabled;
120
+ const clearControl = resolveAllowClear(allowClear, true, t("common.clear") ?? "Clear");
121
+ const showClear = clearControl.enabled && text !== "" && !disabled;
122
+ const choose = (input) => {
123
+ let date = input;
124
+ if (Array.isArray(date)) {
125
+ if (date.some((day) => !allowed(day))) return;
126
+ if (order) date = [...date].sort((a, b) => +a - +b);
127
+ } else if (date) {
128
+ date = periodDate(date);
129
+ if (!allowed(date) || !needConfirm && !timeAllowed(date)) return;
130
+ if (multiple) {
131
+ const current = Array.isArray(working) ? working : [];
132
+ date = current.some((day) => +day === +date) ? current.filter((day) => +day !== +date) : [...current, date];
133
+ if (order) date.sort((a, b) => +a - +b);
134
+ }
135
+ }
136
+ if (needConfirm) {
137
+ setPending(date);
138
+ setHasPending(true);
139
+ } else {
140
+ emit(date);
141
+ setText(display(date));
142
+ }
143
+ };
57
144
  const commit = (raw) => {
58
- const trimmed = raw.trim();
59
- if (trimmed === "") {
60
- emit(void 0);
145
+ if (!raw.trim()) {
146
+ choose(void 0);
61
147
  return;
62
148
  }
63
- if (!/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) return;
64
- const parsed = parseDateInput(trimmed);
65
- if (parsed) {
66
- emit(parsed);
67
- }
149
+ const parsed = parse(raw);
150
+ if (parsed && allowed(parsed)) choose(parsed);
68
151
  };
69
- return /* @__PURE__ */ jsx(Popover, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
70
- /* @__PURE__ */ jsx(
71
- Input,
152
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
153
+ (format || showTime || multiple || needConfirm || preserveInvalidOnBlur) && resolvedName ? /* @__PURE__ */ jsx(
154
+ "input",
72
155
  {
73
- id,
74
- name: resolvedName,
75
- "data-field": resolvedField,
76
- value: text,
156
+ type: "hidden",
77
157
  disabled,
78
- placeholder: resolvedPlaceholder,
79
- inputMode: "numeric",
80
- autoComplete: "off",
81
- role: "combobox",
82
- "aria-expanded": open,
83
- "aria-haspopup": "dialog",
84
- "aria-controls": open ? dialogId : void 0,
85
- ...fieldA11y,
86
- className: showClear ? "ui-control-inline-affix-pair-affixed" : void 0,
87
- trailingIcon: /* @__PURE__ */ jsxs("span", { className: "ui-time-picker-affix", children: [
88
- showClear ? /* @__PURE__ */ jsx(
158
+ name: resolvedName,
159
+ value: showTime ? (Array.isArray(value) ? value[0] : value)?.toISOString() ?? "" : Array.isArray(value) ? value.map(toIsoDate).join(",") : toIsoDate(value)
160
+ }
161
+ ) : null,
162
+ /* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
163
+ /* @__PURE__ */ jsx(
164
+ Input,
165
+ {
166
+ id,
167
+ name: format || showTime || multiple || needConfirm || preserveInvalidOnBlur ? "" : resolvedName,
168
+ ref,
169
+ size,
170
+ status,
171
+ variant,
172
+ readOnly: inputReadOnly || multiple,
173
+ "data-field": resolvedField,
174
+ value: text,
175
+ disabled,
176
+ placeholder: resolvedPlaceholder,
177
+ inputMode: "numeric",
178
+ autoComplete: "off",
179
+ role: "combobox",
180
+ "aria-expanded": open,
181
+ "aria-haspopup": "dialog",
182
+ "aria-controls": open ? dialogId : void 0,
183
+ ...fieldA11y,
184
+ trailingIcon: /* @__PURE__ */ jsx("span", { className: "ui-time-picker-affix", children: showClear ? /* @__PURE__ */ jsx(
89
185
  "button",
90
186
  {
91
187
  type: "button",
92
188
  tabIndex: -1,
93
- "aria-label": t("common.clear") ?? "Clear",
94
- onClick: clear,
189
+ "aria-label": clearControl.label,
190
+ onClick: (event) => {
191
+ event.stopPropagation();
192
+ event.currentTarget.closest("div")?.querySelector("input:not([type=hidden])")?.focus();
193
+ clear();
194
+ },
95
195
  className: "ui-control-inline-affix-action",
96
- children: /* @__PURE__ */ jsx(X, { className: "ui-control-inline-affix-icon", "aria-hidden": "true" })
196
+ children: clearControl.clearIcon ?? /* @__PURE__ */ jsx(X, { className: "ui-control-inline-affix-icon", "aria-hidden": "true" })
97
197
  }
98
- ) : null,
99
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
198
+ ) : /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
100
199
  "button",
101
200
  {
102
201
  type: "button",
@@ -106,64 +205,196 @@ function DatePicker({
106
205
  className: "ui-control-inline-affix-action",
107
206
  children: /* @__PURE__ */ jsx(CalendarIcon, { className: "ui-control-inline-affix-icon", "aria-hidden": "true" })
108
207
  }
109
- ) })
110
- ] }),
111
- onClick: () => {
112
- if (!disabled) setOpen(true);
113
- },
114
- onKeyDown: (event) => {
115
- if (event.key === "ArrowDown") {
116
- event.preventDefault();
117
- setOpen(true);
118
- } else if (event.key === "Escape" && open) {
119
- setOpen(false);
120
- }
121
- },
122
- onChange: (event) => {
123
- setText(event.target.value);
124
- commit(event.target.value);
125
- },
126
- onBlur: (event) => {
127
- const parsed = parseDateInput(event.target.value.trim());
128
- setText(parsed ? toIsoDate(parsed) : toIsoDate(value));
129
- }
130
- }
131
- ),
132
- /* @__PURE__ */ jsx(
133
- PopoverContent,
134
- {
135
- id: dialogId,
136
- role: "dialog",
137
- "aria-label": t("dataEntry.datePicker.openCalendar") ?? "Calendar",
138
- className: "ui-control-panel-flush",
139
- align: "start",
140
- onOpenAutoFocus: (event) => event.preventDefault(),
141
- children: /* @__PURE__ */ jsx(
142
- Calendar,
143
- {
144
- mode: "single",
145
- selected: value,
146
- defaultMonth: value,
147
- onSelect: (date) => {
148
- emit(date);
149
- setText(toIsoDate(date));
208
+ ) }) }),
209
+ onClick: () => {
210
+ if (!disabled) setOpen(true);
211
+ },
212
+ onKeyDown: (event) => {
213
+ if (event.key === "ArrowDown") {
214
+ event.preventDefault();
215
+ setOpen(true);
216
+ } else if (event.key === "Enter") {
217
+ const parsed = parse(text);
218
+ if (parsed && allowed(parsed) && timeAllowed(parsed)) {
219
+ const next = periodDate(parsed);
220
+ emit(next);
221
+ setText(display(parsed));
222
+ setOpen(false);
223
+ }
224
+ } else if (event.key === "Escape" && open) {
150
225
  setOpen(false);
151
- },
152
- locale: dayPickerLocale,
153
- disabled: [
154
- ...fromDate ? [{ before: fromDate }] : [],
155
- ...toDate ? [{ after: toDate }] : []
156
- ],
157
- startMonth: fromDate,
158
- endMonth: toDate,
159
- showToday,
160
- showClose,
161
- onClose: () => setOpen(false)
226
+ }
227
+ },
228
+ onChange: (event) => {
229
+ setText(event.target.value);
230
+ commit(event.target.value);
231
+ },
232
+ onBlur: (event) => {
233
+ const parsed = parse(event.target.value);
234
+ const accepted = parsed && allowed(parsed) && timeAllowed(parsed) ? parsed : void 0;
235
+ if (!preserveInvalidOnBlur) setText(accepted ? display(accepted) : display(value));
162
236
  }
163
- )
164
- }
165
- )
166
- ] }) }) });
237
+ }
238
+ ),
239
+ /* @__PURE__ */ jsxs(
240
+ PopoverContent,
241
+ {
242
+ id: dialogId,
243
+ role: "dialog",
244
+ "aria-label": t("dataEntry.datePicker.openCalendar") ?? "Calendar",
245
+ className: "ui-control-panel-flush",
246
+ side: placement.startsWith("top") ? "top" : "bottom",
247
+ align: placement.endsWith("end") ? "end" : "start",
248
+ onOpenAutoFocus: (event) => event.preventDefault(),
249
+ children: [
250
+ presets?.length ? /* @__PURE__ */ jsx(Flex, { wrap: true, gap: "xs", pad: "sm", children: presets.map((preset, index) => /* @__PURE__ */ jsx(
251
+ Button,
252
+ {
253
+ variant: "ghost",
254
+ size: "sm",
255
+ type: "button",
256
+ onClick: () => {
257
+ const date = typeof preset.value === "function" ? preset.value() : preset.value;
258
+ if (!allowed(date)) return;
259
+ choose(date);
260
+ if (!needConfirm && !multiple) setOpen(false);
261
+ },
262
+ children: preset.label
263
+ },
264
+ index
265
+ )) }) : null,
266
+ picker === "date" || picker === "week" ? multiple ? /* @__PURE__ */ jsx(
267
+ Calendar,
268
+ {
269
+ mode: "multiple",
270
+ selected: Array.isArray(working) ? working : [],
271
+ defaultMonth: selectedDate,
272
+ locale: dayPickerLocale,
273
+ onSelect: choose,
274
+ disabled: (day) => !allowed(day),
275
+ cellRender,
276
+ showWeekNumber: showWeek,
277
+ startMonth: minimum,
278
+ endMonth: maximum,
279
+ showToday,
280
+ showClose,
281
+ onClose: () => setOpen(false)
282
+ }
283
+ ) : /* @__PURE__ */ jsx(
284
+ Calendar,
285
+ {
286
+ mode: "single",
287
+ selected: selectedDate,
288
+ defaultMonth: selectedDate,
289
+ showWeekNumber: showWeek,
290
+ onSelect: (date) => {
291
+ if (date && showTime && selectedDate)
292
+ date.setHours(
293
+ selectedDate.getHours(),
294
+ selectedDate.getMinutes(),
295
+ selectedDate.getSeconds()
296
+ );
297
+ choose(date);
298
+ if (!needConfirm && !multiple) setOpen(false);
299
+ },
300
+ locale: dayPickerLocale,
301
+ disabled: [
302
+ ...minimum ? [{ before: minimum }] : [],
303
+ ...maximum ? [{ after: maximum }] : [],
304
+ ...disabledDate ? [disabledDate] : []
305
+ ],
306
+ cellRender,
307
+ startMonth: minimum,
308
+ endMonth: maximum,
309
+ showToday,
310
+ showClose,
311
+ onClose: () => setOpen(false)
312
+ }
313
+ ) : /* @__PURE__ */ jsxs("div", { className: "ui-month-picker-panel", children: [
314
+ /* @__PURE__ */ jsxs(Flex, { justify: "between", align: "center", children: [
315
+ /* @__PURE__ */ jsx(
316
+ Button,
317
+ {
318
+ type: "button",
319
+ variant: "ghost",
320
+ "aria-label": t("dataEntry.monthPicker.previousYear"),
321
+ onClick: () => setViewYear(viewYear - (picker === "year" ? 12 : 1)),
322
+ children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true" })
323
+ }
324
+ ),
325
+ /* @__PURE__ */ jsx("span", { "aria-live": "polite", children: new Intl.NumberFormat(locale, { useGrouping: false }).format(viewYear) }),
326
+ /* @__PURE__ */ jsx(
327
+ Button,
328
+ {
329
+ type: "button",
330
+ variant: "ghost",
331
+ "aria-label": t("dataEntry.monthPicker.nextYear"),
332
+ onClick: () => setViewYear(viewYear + (picker === "year" ? 12 : 1)),
333
+ children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true" })
334
+ }
335
+ )
336
+ ] }),
337
+ /* @__PURE__ */ jsx("div", { className: "ui-month-picker-grid", children: Array.from({ length: picker === "quarter" ? 4 : 12 }, (_, index) => {
338
+ const date = picker === "year" ? new Date(viewYear + index, 0, 1) : new Date(viewYear, index * (picker === "quarter" ? 3 : 1), 1);
339
+ const label = picker === "year" ? new Intl.DateTimeFormat(locale, { year: "numeric" }).format(date) : picker === "quarter" ? t("dataEntry.datePicker.quarter", { quarter: index + 1 }) : new Intl.DateTimeFormat(locale, { month: "short" }).format(date);
340
+ const selected = (Array.isArray(working) ? working : working ? [working] : []).some((day) => +periodDate(day) === +date);
341
+ return /* @__PURE__ */ jsx(
342
+ Button,
343
+ {
344
+ type: "button",
345
+ variant: selected ? "default" : "ghost",
346
+ "aria-pressed": selected,
347
+ disabled: !allowed(date),
348
+ onClick: () => {
349
+ choose(date);
350
+ if (!needConfirm && !multiple) setOpen(false);
351
+ },
352
+ children: label
353
+ },
354
+ index
355
+ );
356
+ }) })
357
+ ] }),
358
+ showTime ? /* @__PURE__ */ jsx(Flex, { pad: "sm", children: /* @__PURE__ */ jsx(
359
+ TimePicker,
360
+ {
361
+ ...typeof showTime === "object" ? showTime : {},
362
+ "aria-label": t("dataEntry.timePicker.openPicker"),
363
+ value: selectedDate ? [
364
+ selectedDate.getHours(),
365
+ selectedDate.getMinutes(),
366
+ ...typeof showTime === "object" && showTime.showSeconds ? [selectedDate.getSeconds()] : []
367
+ ].map((n) => String(n).padStart(2, "0")).join(":") : "",
368
+ onValueChange: (time) => {
369
+ if (!time) return;
370
+ const date = new Date(selectedDate ?? /* @__PURE__ */ new Date());
371
+ const [h, m, sec = 0] = time.split(":").map(Number);
372
+ date.setHours(h, m, sec, 0);
373
+ choose(date);
374
+ }
375
+ }
376
+ ) }) : null,
377
+ needConfirm ? /* @__PURE__ */ jsx(Flex, { pad: "sm", justify: "end", children: /* @__PURE__ */ jsx(
378
+ Button,
379
+ {
380
+ type: "button",
381
+ disabled: !selectedDate || !allowed(selectedDate) || !timeAllowed(selectedDate),
382
+ onClick: () => {
383
+ if (selectedDate && allowed(selectedDate) && timeAllowed(selectedDate)) {
384
+ emit(working);
385
+ setText(display(working));
386
+ setOpen(false);
387
+ }
388
+ },
389
+ children: t("dataEntry.timePicker.confirm")
390
+ }
391
+ ) }) : null,
392
+ renderExtraFooter?.()
393
+ ]
394
+ }
395
+ )
396
+ ] }) })
397
+ ] });
167
398
  }
168
399
  export {
169
400
  DatePicker
@@ -3,9 +3,9 @@ import type { DateRangePickerProp } from "../../props/components/data-entry.prop
3
3
  export type { DateRangePickerProp, DateRangePickerProp as DateRangePickerProps, } from "../../props/components/data-entry.prop.js";
4
4
  /**
5
5
  * DateRangePicker — WAI-ARIA date-range combobox rendered as ONE input-styled control
6
- * (Ant Design RangePicker convention): `[ from → to ✕ 📅 ]`. The two inner fields stay
6
+ * (the established RangePicker convention): `[ from → to ✕ 📅 ]`. The two inner fields stay
7
7
  * real, typeable ISO `yyyy-MM-dd` inputs (form-submittable via `${name}_from` /
8
8
  * `${name}_to`, screen-reader friendly, e2e-testable by filling either input); the
9
9
  * range calendar is the visual affordance.
10
10
  */
11
- export declare function DateRangePicker({ value: valueProp, defaultValue, onValueChange, placeholder, disabled, className, id, name, locale: localeProp, showToday, showClose, fromDate, toDate, allowClear, ...ariaProps }: DateRangePickerProp): React.JSX.Element;
11
+ export declare function DateRangePicker({ value: valueProp, defaultValue, onValueChange, placeholder, disabled, className, id, name, locale: localeProp, showToday, showClose, fromDate, toDate, disabledDate, cellRender, allowClear, format, parseFormat, minDate, maxDate, showWeek, presets, needConfirm, allowEmpty, order, open: openProp, defaultOpen, onOpenChange, inputReadOnly, preserveInvalidOnBlur, placement, renderExtraFooter, size, status, variant, ref, ...ariaProps }: DateRangePickerProp): React.JSX.Element;