@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
@@ -1,12 +1,25 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { ArrowRight, CalendarIcon, X } from "lucide-react";
5
5
  import { usePickerLocales, useTranslation } from "../../i18n/use-translation.js";
6
- import { parseDateInput, toIsoDate } from "../../lib/datetime/index.js";
6
+ import { toIsoDate } from "../../lib/datetime/index.js";
7
+ import {
8
+ formatPickerDate,
9
+ parsePickerDate,
10
+ pickerDateAllowed
11
+ } from "../../lib/datetime/picker-format.js";
12
+ import { Button } from "../general/button.js";
13
+ import { Flex } from "../layout/flex.js";
14
+ import {
15
+ CONTROL_VARIANT_CHROME_CLASS,
16
+ CONTROL_STATUS_CHROME_CLASS,
17
+ controlAppearanceAttributes
18
+ } from "./control-appearance.js";
7
19
  import { useControlledLatch } from "../../lib/hooks.js";
8
20
  import { pickGroupFieldA11y, useFieldIdentity } from "../../lib/field-a11y.js";
9
21
  import { cn } from "../../lib/utils.js";
22
+ import { resolveAllowClear } from "./control-surface.js";
10
23
  import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../data-display/popover.js";
11
24
  import { Calendar } from "./calendar.js";
12
25
  const ISO_HINT = "yyyy-mm-dd";
@@ -24,12 +37,52 @@ function DateRangePicker({
24
37
  showClose,
25
38
  fromDate,
26
39
  toDate,
27
- allowClear = true,
40
+ disabledDate,
41
+ cellRender,
42
+ allowClear,
43
+ format,
44
+ parseFormat,
45
+ minDate,
46
+ maxDate,
47
+ showWeek,
48
+ presets,
49
+ needConfirm = false,
50
+ allowEmpty = [true, true],
51
+ order = true,
52
+ open: openProp,
53
+ defaultOpen = false,
54
+ onOpenChange,
55
+ inputReadOnly,
56
+ preserveInvalidOnBlur,
57
+ placement = "bottom-start",
58
+ renderExtraFooter,
59
+ size,
60
+ status,
61
+ variant = "outlined",
62
+ ref,
28
63
  ...ariaProps
29
64
  }) {
30
65
  const { t } = useTranslation();
31
- const { dayPickerLocale } = usePickerLocales(localeProp);
32
- const [open, setOpen] = React.useState(false);
66
+ const { dayPickerLocale, locale } = usePickerLocales(localeProp);
67
+ const appearance = controlAppearanceAttributes({ status, variant });
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 minimum = minDate ?? fromDate;
82
+ const maximum = maxDate ?? toDate;
83
+ const allowed = (date) => pickerDateAllowed(date, minimum, maximum, disabledDate);
84
+ const display = (date) => formatPickerDate(date, format, locale);
85
+ const parse = (text) => parsePickerDate(text, format, parseFormat);
33
86
  const groupA11y = pickGroupFieldA11y(ariaProps);
34
87
  const autoId = React.useId();
35
88
  const groupId = id ?? autoId;
@@ -41,29 +94,45 @@ function DateRangePicker({
41
94
  const isControlled = useControlledLatch(valueProp !== void 0);
42
95
  const [internalValue, setInternalValue] = React.useState(defaultValue);
43
96
  const value = isControlled ? valueProp : internalValue;
44
- const [fromText, setFromText] = React.useState(() => toIsoDate(value?.from));
45
- const [toText, setToText] = React.useState(() => toIsoDate(value?.to));
97
+ const working = hasPending ? pending : value;
98
+ const [fromText, setFromText] = React.useState(() => display(value?.from));
99
+ const [toText, setToText] = React.useState(() => display(value?.to));
46
100
  React.useEffect(() => {
47
- setFromText(toIsoDate(value?.from));
48
- setToText(toIsoDate(value?.to));
49
- }, [value?.from, value?.to]);
101
+ setFromText(formatPickerDate(value?.from, format, locale));
102
+ setToText(formatPickerDate(value?.to, format, locale));
103
+ }, [value?.from, value?.to, format, locale]);
50
104
  const resolvedPlaceholder = placeholder ?? t("dataEntry.dateRangePicker.placeholder") ?? ISO_HINT;
51
105
  const emit = (next) => {
52
106
  if (!isControlled) setInternalValue(next);
53
107
  onValueChange?.(next);
54
108
  };
55
- const showClear = allowClear && Boolean(value?.from || value?.to) && !disabled;
109
+ const clearControl = resolveAllowClear(allowClear, true, t("common.clear") ?? "Clear");
110
+ const showClear = clearControl.enabled && allowEmpty.every(Boolean) && Boolean(value?.from || value?.to) && !disabled;
56
111
  const clear = () => {
57
112
  emit(void 0);
58
113
  setFromText("");
59
114
  setToText("");
60
115
  };
116
+ const validRange = (next) => Boolean(
117
+ next && (next.from ? allowed(next.from) : allowEmpty[0]) && (next.to ? allowed(next.to) : allowEmpty[1])
118
+ );
119
+ const choose = (range) => {
120
+ let next = range;
121
+ if (next?.from && !allowed(next.from) || next?.to && !allowed(next.to)) return;
122
+ if (order && next?.from && next.to && next.from > next.to)
123
+ next = { from: next.to, to: next.from };
124
+ if (needConfirm) {
125
+ setPending(next);
126
+ setHasPending(true);
127
+ } else emit(next);
128
+ };
61
129
  const commitEdge = (edge, raw) => {
62
130
  const trimmed = raw.trim();
63
- if (trimmed !== "" && !/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) return;
64
- const parsed = trimmed === "" ? void 0 : parseDateInput(trimmed) ?? void 0;
65
- const next = { from: value?.from, to: value?.to, [edge]: parsed };
66
- emit(next.from || next.to ? next : void 0);
131
+ const parsed = parse(trimmed);
132
+ if (trimmed && (!parsed || !allowed(parsed))) return;
133
+ if (!trimmed && !allowEmpty[edge === "from" ? 0 : 1]) return;
134
+ const next = { from: working?.from, to: working?.to, [edge]: parsed };
135
+ choose(next.from || next.to ? next : void 0);
67
136
  };
68
137
  const sharedKeyHandlers = {
69
138
  onKeyDown: (event) => {
@@ -76,135 +145,204 @@ function DateRangePicker({
76
145
  }
77
146
  };
78
147
  const innerInputClass = "ui-month-picker-input";
79
- return /* @__PURE__ */ jsx(Popover, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs(
80
- "div",
81
- {
82
- role: "group",
83
- id: groupId,
84
- ...groupA11y,
85
- "data-field": rangeField,
86
- "aria-disabled": disabled ? true : void 0,
87
- "data-state": open ? "open" : "closed",
88
- className: cn(
89
- // One input-styled shell for the whole range — the shared composite-field box, so
90
- // this and the month range picker cannot drift into two slightly different fields.
91
- "ui-control ui-control-composite-field",
92
- "aria-invalid:border-destructive",
93
- className
148
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
149
+ (format || needConfirm || preserveInvalidOnBlur) && rangeName ? /* @__PURE__ */ jsxs(Fragment, { children: [
150
+ /* @__PURE__ */ jsx(
151
+ "input",
152
+ {
153
+ type: "hidden",
154
+ disabled,
155
+ name: `${rangeName}_from`,
156
+ value: toIsoDate(value?.from)
157
+ }
94
158
  ),
95
- onClick: () => {
96
- if (!disabled) setOpen(true);
97
- },
98
- children: [
99
- /* @__PURE__ */ jsx(
100
- "input",
101
- {
102
- id: fromId,
103
- "data-field": rangeField ? `${rangeField}_from` : void 0,
104
- name: rangeName ? `${rangeName}_from` : void 0,
105
- value: fromText,
106
- disabled,
107
- placeholder: resolvedPlaceholder,
108
- inputMode: "numeric",
109
- autoComplete: "off",
110
- "aria-label": t("dataEntry.dateRangePicker.from") ?? "From",
111
- className: innerInputClass,
112
- ...sharedKeyHandlers,
113
- onChange: (event) => {
114
- setFromText(event.target.value);
115
- commitEdge("from", event.target.value);
116
- },
117
- onBlur: (event) => {
118
- const parsed = parseDateInput(event.target.value.trim());
119
- setFromText(parsed ? toIsoDate(parsed) : toIsoDate(value?.from));
120
- }
121
- }
159
+ /* @__PURE__ */ jsx(
160
+ "input",
161
+ {
162
+ type: "hidden",
163
+ disabled,
164
+ name: `${rangeName}_to`,
165
+ value: toIsoDate(value?.to)
166
+ }
167
+ )
168
+ ] }) : null,
169
+ /* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs(
170
+ "div",
171
+ {
172
+ role: "group",
173
+ id: groupId,
174
+ ...groupA11y,
175
+ "data-field": rangeField,
176
+ "data-size": size,
177
+ ...appearance,
178
+ "aria-disabled": disabled ? true : void 0,
179
+ "data-state": open ? "open" : "closed",
180
+ className: cn(
181
+ // One input-styled shell for the whole range — the shared composite-field box, so
182
+ // this and the month range picker cannot drift into two slightly different fields.
183
+ "ui-control ui-control-composite-field",
184
+ "aria-invalid:border-destructive",
185
+ CONTROL_VARIANT_CHROME_CLASS[variant],
186
+ CONTROL_STATUS_CHROME_CLASS,
187
+ className
122
188
  ),
123
- /* @__PURE__ */ jsx(ArrowRight, { className: "ui-month-picker-separator-icon", "aria-hidden": "true" }),
124
- /* @__PURE__ */ jsx(
125
- "input",
126
- {
127
- id: toId,
128
- "data-field": rangeField ? `${rangeField}_to` : void 0,
129
- name: rangeName ? `${rangeName}_to` : void 0,
130
- value: toText,
131
- disabled,
132
- placeholder: resolvedPlaceholder,
133
- inputMode: "numeric",
134
- autoComplete: "off",
135
- "aria-label": t("dataEntry.dateRangePicker.to") ?? "To",
136
- className: innerInputClass,
137
- ...sharedKeyHandlers,
138
- onChange: (event) => {
139
- setToText(event.target.value);
140
- commitEdge("to", event.target.value);
141
- },
142
- onBlur: (event) => {
143
- const parsed = parseDateInput(event.target.value.trim());
144
- setToText(parsed ? toIsoDate(parsed) : toIsoDate(value?.to));
189
+ onClick: () => {
190
+ if (!disabled) setOpen(true);
191
+ },
192
+ children: [
193
+ /* @__PURE__ */ jsx(
194
+ "input",
195
+ {
196
+ id: fromId,
197
+ "data-field": rangeField ? `${rangeField}_from` : void 0,
198
+ name: !format && !needConfirm && !preserveInvalidOnBlur && rangeName ? `${rangeName}_from` : void 0,
199
+ ref,
200
+ readOnly: inputReadOnly,
201
+ value: fromText,
202
+ disabled,
203
+ placeholder: resolvedPlaceholder,
204
+ inputMode: "numeric",
205
+ autoComplete: "off",
206
+ "aria-label": t("dataEntry.dateRangePicker.from") ?? "From",
207
+ className: innerInputClass,
208
+ ...sharedKeyHandlers,
209
+ onChange: (event) => {
210
+ setFromText(event.target.value);
211
+ commitEdge("from", event.target.value);
212
+ },
213
+ onBlur: (event) => {
214
+ const parsed = parse(event.target.value);
215
+ const accepted = parsed && allowed(parsed) ? parsed : void 0;
216
+ if (!preserveInvalidOnBlur)
217
+ setFromText(accepted ? display(accepted) : display(value?.from));
218
+ }
145
219
  }
146
- }
147
- ),
148
- showClear ? /* @__PURE__ */ jsx(
149
- "button",
150
- {
151
- type: "button",
152
- tabIndex: -1,
153
- "aria-label": t("common.clear") ?? "Clear",
154
- className: "text-muted-foreground hover:text-foreground shrink-0",
155
- onClick: (event) => {
156
- event.stopPropagation();
157
- clear();
158
- },
159
- children: /* @__PURE__ */ jsx(X, { className: "ui-month-picker-icon", "aria-hidden": "true" })
160
- }
161
- ) : null,
162
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
163
- "button",
164
- {
165
- type: "button",
166
- disabled,
167
- tabIndex: -1,
168
- "aria-label": t("dataEntry.dateRangePicker.openCalendar") ?? "Open calendar",
169
- className: "text-muted-foreground hover:text-foreground shrink-0",
170
- children: /* @__PURE__ */ jsx(CalendarIcon, { className: "ui-month-picker-icon", "aria-hidden": "true" })
171
- }
172
- ) }),
173
- /* @__PURE__ */ jsx(
174
- PopoverContent,
175
- {
176
- className: "ui-control-panel-flush",
177
- align: "start",
178
- onOpenAutoFocus: (event) => event.preventDefault(),
179
- children: /* @__PURE__ */ jsx(
180
- Calendar,
181
- {
182
- mode: "range",
183
- selected: value,
184
- defaultMonth: value?.from,
185
- numberOfMonths: 2,
186
- onSelect: (range) => {
187
- emit(range);
188
- setFromText(toIsoDate(range?.from));
189
- setToText(toIsoDate(range?.to));
190
- },
191
- locale: dayPickerLocale,
192
- disabled: [
193
- ...fromDate ? [{ before: fromDate }] : [],
194
- ...toDate ? [{ after: toDate }] : []
195
- ],
196
- startMonth: fromDate,
197
- endMonth: toDate,
198
- showToday,
199
- showClose,
200
- onClose: () => setOpen(false)
220
+ ),
221
+ /* @__PURE__ */ jsx(ArrowRight, { className: "ui-month-picker-separator-icon", "aria-hidden": "true" }),
222
+ /* @__PURE__ */ jsx(
223
+ "input",
224
+ {
225
+ id: toId,
226
+ "data-field": rangeField ? `${rangeField}_to` : void 0,
227
+ name: !format && !needConfirm && !preserveInvalidOnBlur && rangeName ? `${rangeName}_to` : void 0,
228
+ readOnly: inputReadOnly,
229
+ value: toText,
230
+ disabled,
231
+ placeholder: resolvedPlaceholder,
232
+ inputMode: "numeric",
233
+ autoComplete: "off",
234
+ "aria-label": t("dataEntry.dateRangePicker.to") ?? "To",
235
+ className: innerInputClass,
236
+ ...sharedKeyHandlers,
237
+ onChange: (event) => {
238
+ setToText(event.target.value);
239
+ commitEdge("to", event.target.value);
240
+ },
241
+ onBlur: (event) => {
242
+ const parsed = parse(event.target.value);
243
+ const accepted = parsed && allowed(parsed) ? parsed : void 0;
244
+ if (!preserveInvalidOnBlur)
245
+ setToText(accepted ? display(accepted) : display(value?.to));
201
246
  }
202
- )
203
- }
204
- )
205
- ]
206
- }
207
- ) }) });
247
+ }
248
+ ),
249
+ showClear ? /* @__PURE__ */ jsx(
250
+ "button",
251
+ {
252
+ type: "button",
253
+ tabIndex: -1,
254
+ "aria-label": clearControl.label,
255
+ className: "text-muted-foreground hover:text-foreground shrink-0",
256
+ onClick: (event) => {
257
+ event.stopPropagation();
258
+ event.currentTarget.closest("div")?.querySelector("input:not([type=hidden])")?.focus();
259
+ clear();
260
+ },
261
+ children: clearControl.clearIcon ?? /* @__PURE__ */ jsx(X, { className: "ui-month-picker-icon", "aria-hidden": "true" })
262
+ }
263
+ ) : /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
264
+ "button",
265
+ {
266
+ type: "button",
267
+ disabled,
268
+ tabIndex: -1,
269
+ "aria-label": t("dataEntry.dateRangePicker.openCalendar") ?? "Open calendar",
270
+ className: "text-muted-foreground hover:text-foreground shrink-0",
271
+ children: /* @__PURE__ */ jsx(CalendarIcon, { className: "ui-month-picker-icon", "aria-hidden": "true" })
272
+ }
273
+ ) }),
274
+ /* @__PURE__ */ jsxs(
275
+ PopoverContent,
276
+ {
277
+ className: "ui-control-panel-flush",
278
+ side: placement.startsWith("top") ? "top" : "bottom",
279
+ align: placement.endsWith("end") ? "end" : "start",
280
+ onClick: (event) => event.stopPropagation(),
281
+ onOpenAutoFocus: (event) => event.preventDefault(),
282
+ children: [
283
+ presets?.length ? /* @__PURE__ */ jsx(Flex, { wrap: true, gap: "xs", pad: "sm", children: presets.map((preset, index) => /* @__PURE__ */ jsx(
284
+ Button,
285
+ {
286
+ type: "button",
287
+ variant: "ghost",
288
+ size: "sm",
289
+ onClick: () => {
290
+ const range = typeof preset.value === "function" ? preset.value() : preset.value;
291
+ if (validRange(range)) choose(range);
292
+ },
293
+ children: preset.label
294
+ },
295
+ index
296
+ )) }) : null,
297
+ /* @__PURE__ */ jsx(
298
+ Calendar,
299
+ {
300
+ mode: "range",
301
+ selected: working,
302
+ defaultMonth: working?.from,
303
+ showWeekNumber: showWeek,
304
+ numberOfMonths: 2,
305
+ onSelect: (range) => {
306
+ choose(range);
307
+ setFromText(display(range?.from));
308
+ setToText(display(range?.to));
309
+ },
310
+ locale: dayPickerLocale,
311
+ disabled: [
312
+ ...minimum ? [{ before: minimum }] : [],
313
+ ...maximum ? [{ after: maximum }] : [],
314
+ ...disabledDate ? [disabledDate] : []
315
+ ],
316
+ cellRender,
317
+ startMonth: minimum,
318
+ endMonth: maximum,
319
+ showToday,
320
+ showClose,
321
+ onClose: () => setOpen(false)
322
+ }
323
+ ),
324
+ needConfirm ? /* @__PURE__ */ jsx(Flex, { pad: "sm", justify: "end", children: /* @__PURE__ */ jsx(
325
+ Button,
326
+ {
327
+ type: "button",
328
+ disabled: !validRange(working),
329
+ onClick: () => {
330
+ if (validRange(working)) {
331
+ emit(working);
332
+ setOpen(false);
333
+ }
334
+ },
335
+ children: t("dataEntry.timePicker.confirm")
336
+ }
337
+ ) }) : null,
338
+ renderExtraFooter?.()
339
+ ]
340
+ }
341
+ )
342
+ ]
343
+ }
344
+ ) })
345
+ ] });
208
346
  }
209
347
  export {
210
348
  DateRangePicker
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import { jsx, jsxs } from "react/jsx-runtime";
3
2
  import { cn } from "../../lib/utils.js";
4
3
  import { Label } from "./label.js";
@@ -1,4 +1,4 @@
1
1
  import * as React from "react";
2
2
  import type { FormFieldProp } from "../../props/components/data-entry.prop.js";
3
3
  export type { FormFieldProp, FormFieldProp as FormFieldProps, } from "../../props/components/data-entry.prop.js";
4
- export declare function FormField({ id, name, field, label, required, helper, error: errorProp, labelAddon, layout: layoutProp, labelWidth: labelWidthProp, controlWidth: controlWidthProp, colSpan, className, children, staticText, }: FormFieldProp): React.JSX.Element;
4
+ export declare function FormField({ id, name, field, label, required, helper, error: errorProp, validateStatus, hasFeedback, feedback, labelAddon, layout: layoutProp, labelWidth: labelWidthProp, controlWidth: controlWidthProp, colSpan, className, children, staticText, }: FormFieldProp): React.JSX.Element;
@@ -1,7 +1,10 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
+ import { CheckCircle, CircleAlert, LoaderCircle, TriangleAlert } from "lucide-react";
5
+ import { useTranslation } from "../../i18n/use-translation.js";
4
6
  import { Label } from "../data-entry/label.js";
7
+ import { controlIconClass } from "../../lib/control-styles.js";
5
8
  import { cn } from "../../lib/utils.js";
6
9
  import { FieldIdentityContext, FieldNameContext, mergeAriaIds } from "../../lib/field-a11y.js";
7
10
  import { useOptionalAppContext } from "../../app/app-provider.js";
@@ -17,6 +20,9 @@ function FormField({
17
20
  required,
18
21
  helper,
19
22
  error: errorProp,
23
+ validateStatus,
24
+ hasFeedback,
25
+ feedback,
20
26
  labelAddon,
21
27
  layout: layoutProp,
22
28
  labelWidth: labelWidthProp,
@@ -27,6 +33,7 @@ function FormField({
27
33
  staticText
28
34
  }) {
29
35
  const form = useFormLayout();
36
+ const { t } = useTranslation();
30
37
  const layout = layoutProp ?? form?.layout ?? "vertical";
31
38
  const labelWidth = labelWidthProp ?? form?.labelWidth;
32
39
  const controlWidth = controlWidthProp ?? form?.controlWidth;
@@ -39,6 +46,9 @@ function FormField({
39
46
  const resolvedId = id ?? autoId;
40
47
  const labelId = `${resolvedId}-label`;
41
48
  const helperId = helper ? `${resolvedId}-helper` : void 0;
49
+ const validationStatus = error ? "error" : validateStatus;
50
+ const feedbackId = hasFeedback && validationStatus ? `${resolvedId}-feedback` : void 0;
51
+ const FeedbackIcon = validationStatus === "validating" ? LoaderCircle : validationStatus === "error" ? CircleAlert : validationStatus === "warning" ? TriangleAlert : CheckCircle;
42
52
  const errorId = error ? `${resolvedId}-error` : void 0;
43
53
  const fieldKey = field ?? name ?? id;
44
54
  const emitFieldNames = useOptionalAppContext()?.emitFieldNames ?? false;
@@ -67,6 +77,8 @@ function FormField({
67
77
  // controls (Radio.Group, checkbox lists, range pairs) have no labelable root,
68
78
  // and a dangling `for` triggers Chrome's "Incorrect use of <label>" issue.
69
79
  id: childProps?.id ?? resolvedId,
80
+ ...form?.disabled && childProps?.disabled !== false ? { disabled: true } : {},
81
+ ...validationStatus === "validating" ? { "aria-busy": true } : {},
70
82
  // Read the child's own value first in BOTH cases: cloneElement
71
83
  // overwrites every key present in the config bag, `undefined` included, so a bare
72
84
  // `"data-field": fieldKey` would erase a value the control set for itself.
@@ -82,14 +94,15 @@ function FormField({
82
94
  // aria-errormessage (surfaced when aria-invalid is true).
83
95
  "aria-describedby": mergeIds(
84
96
  childProps?.["aria-describedby"],
85
- helperId
97
+ helperId,
98
+ feedbackId
86
99
  ),
87
100
  "aria-errormessage": mergeIds(
88
101
  childProps?.["aria-errormessage"],
89
102
  errorId
90
103
  ),
91
104
  "aria-required": required ? true : childProps?.["aria-required"],
92
- "aria-invalid": error ? true : childProps?.["aria-invalid"]
105
+ "aria-invalid": validationStatus === "error" ? true : childProps?.["aria-invalid"]
93
106
  }) : children;
94
107
  const style = {};
95
108
  if (labelWidth != null)
@@ -125,7 +138,11 @@ function FormField({
125
138
  },
126
139
  children: /* @__PURE__ */ jsxs("span", { children: [
127
140
  label,
128
- required && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "ui-form-field-required", children: "*" })
141
+ !required && form?.requiredMark === "optional" && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
142
+ " ",
143
+ t("dataEntry.form.optional")
144
+ ] }),
145
+ required && form?.requiredMark !== false && form?.requiredMark !== "optional" && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "ui-form-field-required", children: "*" })
129
146
  ] })
130
147
  }
131
148
  )
@@ -134,7 +151,25 @@ function FormField({
134
151
  labelAddon
135
152
  ] }),
136
153
  /* @__PURE__ */ jsxs("div", { "data-slot": "form-field-control", className: "ui-form-field-control", children: [
137
- isStatic ? childWithA11y : /* @__PURE__ */ jsx(FieldNameContext.Provider, { value: fieldNameContext, children: /* @__PURE__ */ jsx(FieldIdentityContext.Provider, { value: fieldIdentityContext, children: childWithA11y }) }),
154
+ isStatic ? childWithA11y : /* @__PURE__ */ jsx(FieldNameContext.Provider, { value: fieldNameContext, children: /* @__PURE__ */ jsx(FieldIdentityContext.Provider, { value: fieldIdentityContext, children: /* @__PURE__ */ jsx(
155
+ "fieldset",
156
+ {
157
+ role: "presentation",
158
+ className: "contents",
159
+ disabled: form?.disabled && childProps?.disabled !== false,
160
+ children: childWithA11y
161
+ }
162
+ ) }) }),
163
+ hasFeedback && validationStatus ? /* @__PURE__ */ jsxs("span", { id: feedbackId, role: "status", className: "ui-inline-xs text-xs", children: [
164
+ feedback ?? /* @__PURE__ */ jsx(
165
+ FeedbackIcon,
166
+ {
167
+ "aria-hidden": "true",
168
+ className: validationStatus === "validating" ? `${controlIconClass} motion-safe:animate-spin` : controlIconClass
169
+ }
170
+ ),
171
+ t(`dataEntry.form.${validationStatus}`)
172
+ ] }) : null,
138
173
  helper ? /* @__PURE__ */ jsx("p", { id: helperId, className: "text-muted-foreground text-xs", children: helper }) : null,
139
174
  error ? /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: "text-destructive text-xs", children: error }) : null
140
175
  ] })
@@ -4,6 +4,8 @@ export type { FormProp, FormProp as FormProps } from "../../props/components/dat
4
4
  /** Resolved layout settings shared from a Form down to its FormFields (override per field). */
5
5
  export interface FormLayoutContextValue {
6
6
  layout: FormLayoutProp;
7
+ disabled?: boolean;
8
+ requiredMark?: boolean | "optional";
7
9
  labelWidth?: WidthProp;
8
10
  controlWidth?: WidthProp;
9
11
  labelAlign: "start" | "end";
@@ -17,6 +19,8 @@ export declare function useFormLayout(): FormLayoutContextValue | null;
17
19
  * inside it.
18
20
  */
19
21
  export declare const Form: React.ForwardRefExoticComponent<React.FormHTMLAttributes<HTMLFormElement> & {
22
+ disabled?: boolean;
23
+ requiredMark?: boolean | "optional";
20
24
  layout?: FormLayoutProp;
21
25
  labelWidth?: WidthProp;
22
26
  controlWidth?: WidthProp;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { Slot } from "@radix-ui/react-slot";
3
+ import { Slot } from "../../lib/slot.js";
4
4
  import * as React from "react";
5
5
  import { cn } from "../../lib/utils.js";
6
6
  import { FormErrorsProvider } from "./form-errors.js";
@@ -11,6 +11,8 @@ function useFormLayout() {
11
11
  }
12
12
  const Form = React.forwardRef(function Form2({
13
13
  layout = "vertical",
14
+ disabled,
15
+ requiredMark,
14
16
  labelWidth,
15
17
  controlWidth,
16
18
  labelAlign = "end",
@@ -24,8 +26,8 @@ const Form = React.forwardRef(function Form2({
24
26
  ...props
25
27
  }, ref) {
26
28
  const ctx = React.useMemo(
27
- () => ({ layout, labelWidth, controlWidth, labelAlign, collapseBelow }),
28
- [layout, labelWidth, controlWidth, labelAlign, collapseBelow]
29
+ () => ({ layout, labelWidth, controlWidth, labelAlign, collapseBelow, disabled, requiredMark }),
30
+ [layout, labelWidth, controlWidth, labelAlign, collapseBelow, disabled, requiredMark]
29
31
  );
30
32
  const content = columns != null ? /* @__PURE__ */ jsx(ResponsiveGrid, { columns, children }) : children;
31
33
  const withRegistry = (node) => errors !== void 0 ? /* @__PURE__ */ jsx(FormErrorsProvider, { errors, children: node }) : node;