@alepha/ui 0.33.0 → 0.34.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 (236) hide show
  1. package/dist/admin/analytics/AdvancedSection.d.ts.map +1 -1
  2. package/dist/admin/analytics/AdvancedSection.js +7 -3
  3. package/dist/admin/analytics/AdvancedSection.js.map +1 -1
  4. package/dist/admin/analytics/AnalyticsChart.d.ts +1 -0
  5. package/dist/admin/analytics/AnalyticsChart.d.ts.map +1 -1
  6. package/dist/admin/analytics/AnalyticsChart.js +3 -1
  7. package/dist/admin/analytics/AnalyticsChart.js.map +1 -1
  8. package/dist/admin/analytics/AnalyticsChartHeader.d.ts +5 -0
  9. package/dist/admin/analytics/AnalyticsChartHeader.d.ts.map +1 -1
  10. package/dist/admin/analytics/AnalyticsChartHeader.js +7 -2
  11. package/dist/admin/analytics/AnalyticsChartHeader.js.map +1 -1
  12. package/dist/admin/analytics/AnalyticsChartLine.d.ts +5 -0
  13. package/dist/admin/analytics/AnalyticsChartLine.d.ts.map +1 -1
  14. package/dist/admin/analytics/AnalyticsChartLine.js +6 -2
  15. package/dist/admin/analytics/AnalyticsChartLine.js.map +1 -1
  16. package/dist/admin/analytics/CoarsenedBadge.d.ts +15 -0
  17. package/dist/admin/analytics/CoarsenedBadge.d.ts.map +1 -0
  18. package/dist/admin/analytics/CoarsenedBadge.js +30 -0
  19. package/dist/admin/analytics/CoarsenedBadge.js.map +1 -0
  20. package/dist/admin/analytics/CompareNote.d.ts +5 -0
  21. package/dist/admin/analytics/CompareNote.d.ts.map +1 -1
  22. package/dist/admin/analytics/CompareNote.js +5 -1
  23. package/dist/admin/analytics/CompareNote.js.map +1 -1
  24. package/dist/admin/analytics/FilterEditor.d.ts +1 -0
  25. package/dist/admin/analytics/FilterEditor.d.ts.map +1 -1
  26. package/dist/admin/analytics/FilterEditor.js +1 -0
  27. package/dist/admin/analytics/FilterEditor.js.map +1 -1
  28. package/dist/admin/analytics/GroupByChips.d.ts +17 -11
  29. package/dist/admin/analytics/GroupByChips.d.ts.map +1 -1
  30. package/dist/admin/analytics/GroupByChips.js +21 -20
  31. package/dist/admin/analytics/GroupByChips.js.map +1 -1
  32. package/dist/admin/analytics/MeasureChips.d.ts +11 -6
  33. package/dist/admin/analytics/MeasureChips.d.ts.map +1 -1
  34. package/dist/admin/analytics/MeasureChips.js +13 -16
  35. package/dist/admin/analytics/MeasureChips.js.map +1 -1
  36. package/dist/admin/analytics/QueryPanel.d.ts.map +1 -1
  37. package/dist/admin/analytics/QueryPanel.js +9 -5
  38. package/dist/admin/analytics/QueryPanel.js.map +1 -1
  39. package/dist/admin/analytics/RangeControl.d.ts +11 -7
  40. package/dist/admin/analytics/RangeControl.d.ts.map +1 -1
  41. package/dist/admin/analytics/RangeControl.js +83 -30
  42. package/dist/admin/analytics/RangeControl.js.map +1 -1
  43. package/dist/admin/analytics/ResultsPane.d.ts.map +1 -1
  44. package/dist/admin/analytics/ResultsPane.js +13 -9
  45. package/dist/admin/analytics/ResultsPane.js.map +1 -1
  46. package/dist/admin/analytics/ResultsTable.d.ts.map +1 -1
  47. package/dist/admin/analytics/ResultsTable.js +3 -3
  48. package/dist/admin/analytics/ResultsTable.js.map +1 -1
  49. package/dist/admin/analytics/TotalsCards.d.ts +2 -1
  50. package/dist/admin/analytics/TotalsCards.d.ts.map +1 -1
  51. package/dist/admin/analytics/TotalsCards.js +9 -10
  52. package/dist/admin/analytics/TotalsCards.js.map +1 -1
  53. package/dist/admin/analytics/analyticsModel.d.ts +126 -17
  54. package/dist/admin/analytics/analyticsModel.d.ts.map +1 -1
  55. package/dist/admin/analytics/analyticsModel.js +283 -48
  56. package/dist/admin/analytics/analyticsModel.js.map +1 -1
  57. package/dist/admin/analytics/analyticsTypes.d.ts +55 -4
  58. package/dist/admin/analytics/analyticsTypes.d.ts.map +1 -1
  59. package/dist/admin/analytics/chartModel.d.ts +38 -3
  60. package/dist/admin/analytics/chartModel.d.ts.map +1 -1
  61. package/dist/admin/analytics/chartModel.js +86 -16
  62. package/dist/admin/analytics/chartModel.js.map +1 -1
  63. package/dist/admin/analytics/instantRangeSchema.d.ts +8 -0
  64. package/dist/admin/analytics/instantRangeSchema.d.ts.map +1 -0
  65. package/dist/admin/analytics/instantRangeSchema.js +13 -0
  66. package/dist/admin/analytics/instantRangeSchema.js.map +1 -0
  67. package/dist/admin/analytics/useAnalyticsQuery.d.ts +13 -3
  68. package/dist/admin/analytics/useAnalyticsQuery.d.ts.map +1 -1
  69. package/dist/admin/analytics/useAnalyticsQuery.js +60 -21
  70. package/dist/admin/analytics/useAnalyticsQuery.js.map +1 -1
  71. package/dist/admin/analytics/useFilterValues.d.ts +4 -0
  72. package/dist/admin/analytics/useFilterValues.d.ts.map +1 -1
  73. package/dist/admin/analytics/useFilterValues.js +6 -6
  74. package/dist/admin/analytics/useFilterValues.js.map +1 -1
  75. package/dist/ai/AiChat.d.ts +30 -0
  76. package/dist/ai/AiChat.d.ts.map +1 -0
  77. package/dist/ai/AiChat.js +116 -0
  78. package/dist/ai/AiChat.js.map +1 -0
  79. package/dist/ai/AiChatConfirmCard.d.ts +17 -0
  80. package/dist/ai/AiChatConfirmCard.d.ts.map +1 -0
  81. package/dist/ai/AiChatConfirmCard.js +47 -0
  82. package/dist/ai/AiChatConfirmCard.js.map +1 -0
  83. package/dist/ai/AiChatHistory.d.ts +14 -0
  84. package/dist/ai/AiChatHistory.d.ts.map +1 -0
  85. package/dist/ai/AiChatHistory.js +40 -0
  86. package/dist/ai/AiChatHistory.js.map +1 -0
  87. package/dist/ai/AiChatMessage.d.ts +10 -0
  88. package/dist/ai/AiChatMessage.d.ts.map +1 -0
  89. package/dist/ai/AiChatMessage.js +38 -0
  90. package/dist/ai/AiChatMessage.js.map +1 -0
  91. package/dist/ai/AiFormRegistry.d.ts +37 -0
  92. package/dist/ai/AiFormRegistry.d.ts.map +1 -0
  93. package/dist/ai/AiFormRegistry.js +59 -0
  94. package/dist/ai/AiFormRegistry.js.map +1 -0
  95. package/dist/ai/aiChatMessageFormSchema.d.ts +7 -0
  96. package/dist/ai/aiChatMessageFormSchema.d.ts.map +1 -0
  97. package/dist/ai/aiChatMessageFormSchema.js +13 -0
  98. package/dist/ai/aiChatMessageFormSchema.js.map +1 -0
  99. package/dist/ai/aiContextAtom.d.ts +16 -0
  100. package/dist/ai/aiContextAtom.d.ts.map +1 -0
  101. package/dist/ai/aiContextAtom.js +25 -0
  102. package/dist/ai/aiContextAtom.js.map +1 -0
  103. package/dist/ai/index.d.ts +18 -0
  104. package/dist/ai/index.d.ts.map +1 -0
  105. package/dist/ai/index.js +10 -0
  106. package/dist/ai/useAiChat.d.ts +82 -0
  107. package/dist/ai/useAiChat.d.ts.map +1 -0
  108. package/dist/ai/useAiChat.js +256 -0
  109. package/dist/ai/useAiChat.js.map +1 -0
  110. package/dist/ai/useAiContext.d.ts +33 -0
  111. package/dist/ai/useAiContext.d.ts.map +1 -0
  112. package/dist/ai/useAiContext.js +52 -0
  113. package/dist/ai/useAiContext.js.map +1 -0
  114. package/dist/core/Breadcrumb.js +1 -1
  115. package/dist/core/Breadcrumb.js.map +1 -1
  116. package/dist/core/Sheet.d.ts +6 -1
  117. package/dist/core/Sheet.d.ts.map +1 -1
  118. package/dist/core/Sheet.js +2 -2
  119. package/dist/core/Sheet.js.map +1 -1
  120. package/dist/core/Sidebar.d.ts +7 -1
  121. package/dist/core/Sidebar.d.ts.map +1 -1
  122. package/dist/core/Sidebar.js +22 -17
  123. package/dist/core/Sidebar.js.map +1 -1
  124. package/dist/core/index.js +2 -2
  125. package/dist/form/Control.d.ts +14 -0
  126. package/dist/form/Control.d.ts.map +1 -1
  127. package/dist/form/Control.js +9 -3
  128. package/dist/form/Control.js.map +1 -1
  129. package/dist/form/ControlDate.d.ts +11 -0
  130. package/dist/form/ControlDate.d.ts.map +1 -1
  131. package/dist/form/ControlDate.js +20 -2
  132. package/dist/form/ControlDate.js.map +1 -1
  133. package/dist/form/ControlDatePopover.d.ts +3 -0
  134. package/dist/form/ControlDatePopover.d.ts.map +1 -1
  135. package/dist/form/ControlDatePopover.js +1 -0
  136. package/dist/form/ControlDatePopover.js.map +1 -1
  137. package/dist/form/ControlMonthPopover.d.ts +25 -0
  138. package/dist/form/ControlMonthPopover.d.ts.map +1 -0
  139. package/dist/form/ControlMonthPopover.js +112 -0
  140. package/dist/form/ControlMonthPopover.js.map +1 -0
  141. package/dist/form/ControlSelect.d.ts +7 -0
  142. package/dist/form/ControlSelect.d.ts.map +1 -1
  143. package/dist/form/ControlSelect.js +37 -0
  144. package/dist/form/ControlSelect.js.map +1 -1
  145. package/dist/i18n/fr/uiFr.d.ts.map +1 -1
  146. package/dist/i18n/fr/uiFr.js +31 -1
  147. package/dist/i18n/fr/uiFr.js.map +1 -1
  148. package/dist/shell/AppShellNavCollapse.d.ts +4 -0
  149. package/dist/shell/AppShellNavCollapse.d.ts.map +1 -1
  150. package/dist/shell/AppShellNavCollapse.js +1 -0
  151. package/dist/shell/AppShellNavCollapse.js.map +1 -1
  152. package/dist/shell/AppShellSidebarNavItem.d.ts.map +1 -1
  153. package/dist/shell/AppShellSidebarNavItem.js +13 -9
  154. package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
  155. package/dist/shell/AppShellStatefulSidebarTrigger.d.ts.map +1 -1
  156. package/dist/shell/AppShellStatefulSidebarTrigger.js +5 -2
  157. package/dist/shell/AppShellStatefulSidebarTrigger.js.map +1 -1
  158. package/dist/table/DataTable.d.ts.map +1 -1
  159. package/dist/table/DataTable.js +2 -1
  160. package/dist/table/DataTable.js.map +1 -1
  161. package/dist/table/DataTableToolbar.d.ts +7 -3
  162. package/dist/table/DataTableToolbar.d.ts.map +1 -1
  163. package/dist/table/DataTableToolbar.js +7 -3
  164. package/dist/table/DataTableToolbar.js.map +1 -1
  165. package/dist/table/dataTableBaseProps.d.ts +17 -0
  166. package/dist/table/dataTableBaseProps.d.ts.map +1 -1
  167. package/docs/packages-alepha-ui-account.md +29 -0
  168. package/docs/packages-alepha-ui-admin.md +35 -0
  169. package/docs/packages-alepha-ui-ai.md +29 -0
  170. package/docs/packages-alepha-ui-auth.md +23 -0
  171. package/docs/packages-alepha-ui-calendar.md +24 -0
  172. package/docs/packages-alepha-ui-chart.md +23 -0
  173. package/docs/packages-alepha-ui-command.md +24 -0
  174. package/docs/packages-alepha-ui-core.md +40 -0
  175. package/docs/packages-alepha-ui-form.md +29 -0
  176. package/docs/packages-alepha-ui-i18n-fr.md +31 -0
  177. package/docs/packages-alepha-ui-markdown.md +27 -0
  178. package/docs/packages-alepha-ui-organizations.md +20 -0
  179. package/docs/packages-alepha-ui-otp.md +22 -0
  180. package/docs/packages-alepha-ui-overview.md +337 -0
  181. package/docs/packages-alepha-ui-resizable.md +22 -0
  182. package/docs/packages-alepha-ui-settings.md +23 -0
  183. package/docs/packages-alepha-ui-shell.md +41 -0
  184. package/docs/packages-alepha-ui-table.md +37 -0
  185. package/docs/packages-alepha-ui-tree.md +31 -0
  186. package/package.json +15 -5
  187. package/src/admin/analytics/AdvancedSection.tsx +39 -30
  188. package/src/admin/analytics/AnalyticsChart.tsx +7 -1
  189. package/src/admin/analytics/AnalyticsChartHeader.tsx +22 -7
  190. package/src/admin/analytics/AnalyticsChartLine.tsx +15 -2
  191. package/src/admin/analytics/CoarsenedBadge.tsx +38 -0
  192. package/src/admin/analytics/CompareNote.tsx +16 -5
  193. package/src/admin/analytics/FilterEditor.tsx +2 -0
  194. package/src/admin/analytics/GroupByChips.tsx +40 -27
  195. package/src/admin/analytics/MeasureChips.tsx +19 -11
  196. package/src/admin/analytics/QueryPanel.tsx +10 -5
  197. package/src/admin/analytics/RangeControl.tsx +91 -27
  198. package/src/admin/analytics/ResultsPane.tsx +20 -6
  199. package/src/admin/analytics/ResultsTable.tsx +9 -5
  200. package/src/admin/analytics/TotalsCards.tsx +24 -11
  201. package/src/admin/analytics/analyticsModel.spec.ts +167 -36
  202. package/src/admin/analytics/analyticsModel.ts +358 -49
  203. package/src/admin/analytics/analyticsTypes.ts +56 -4
  204. package/src/admin/analytics/chartModel.ts +139 -20
  205. package/src/admin/analytics/instantRangeSchema.ts +9 -0
  206. package/src/admin/analytics/useAnalyticsQuery.ts +98 -35
  207. package/src/admin/analytics/useFilterValues.ts +16 -5
  208. package/src/ai/AiChat.tsx +151 -0
  209. package/src/ai/AiChatConfirmCard.tsx +64 -0
  210. package/src/ai/AiChatHistory.tsx +60 -0
  211. package/src/ai/AiChatMessage.tsx +57 -0
  212. package/src/ai/AiFormRegistry.ts +78 -0
  213. package/src/ai/__tests__/AiChat.browser.spec.tsx +391 -0
  214. package/src/ai/aiChatMessageFormSchema.ts +8 -0
  215. package/src/ai/aiContextAtom.ts +23 -0
  216. package/src/ai/index.ts +18 -0
  217. package/src/ai/useAiChat.ts +343 -0
  218. package/src/ai/useAiContext.ts +74 -0
  219. package/src/core/Breadcrumb.tsx +1 -1
  220. package/src/core/Sheet.tsx +9 -2
  221. package/src/core/Sidebar.tsx +45 -22
  222. package/src/form/Control.tsx +26 -1
  223. package/src/form/ControlDate.tsx +37 -2
  224. package/src/form/ControlDatePopover.tsx +4 -1
  225. package/src/form/ControlMonthPopover.tsx +169 -0
  226. package/src/form/ControlSelect.tsx +62 -0
  227. package/src/form/__tests__/ControlChoices.browser.spec.tsx +130 -0
  228. package/src/i18n/fr/uiFr.ts +36 -2
  229. package/src/shell/AppShellNavCollapse.tsx +5 -0
  230. package/src/shell/AppShellSidebarNavItem.tsx +23 -10
  231. package/src/shell/AppShellStatefulSidebarTrigger.tsx +10 -2
  232. package/src/shell/__tests__/AppShellDirection.browser.spec.tsx +95 -0
  233. package/src/table/DataTable.tsx +2 -0
  234. package/src/table/DataTableToolbar.tsx +18 -3
  235. package/src/table/__tests__/DataTableLeading.browser.spec.tsx +130 -0
  236. package/src/table/dataTableBaseProps.ts +17 -0
@@ -97,6 +97,7 @@ const Control = (props) => {
97
97
  label: merged.label ?? props.label,
98
98
  description: merged.description ?? props.description,
99
99
  disabled: merged.disabled,
100
+ accept: merged.accept,
100
101
  ...uploadOpts
101
102
  }));
102
103
  }
@@ -119,11 +120,12 @@ const Control = (props) => {
119
120
  triggerClassName: merged.triggerClassName,
120
121
  triggerPrefix: props.triggerPrefix
121
122
  }));
122
- if (merged.select || merged.combobox || merged.segmented || meta.isEnum || meta.isArray && !meta.isArrayOfObjects || items != null) return wrapWithSlots(merged, /* @__PURE__ */ jsx(ControlSelect, {
123
+ if (merged.select || merged.combobox || merged.segmented || merged.checkboxes || meta.isEnum || meta.isArray && !meta.isArrayOfObjects || items != null) return wrapWithSlots(merged, /* @__PURE__ */ jsx(ControlSelect, {
123
124
  input: props.input,
124
125
  label: merged.label ?? props.label,
125
126
  description: merged.description ?? props.description,
126
127
  segmented: merged.segmented,
128
+ checkboxes: merged.checkboxes,
127
129
  combobox: merged.combobox,
128
130
  searchable: merged.searchable,
129
131
  items,
@@ -148,10 +150,11 @@ const Control = (props) => {
148
150
  label: merged.label ?? meta.label,
149
151
  description: merged.description ?? meta.description,
150
152
  error: meta.error,
151
- required: meta.required,
153
+ required: false,
152
154
  children: /* @__PURE__ */ jsx("div", {
153
155
  className: "flex h-9 items-center",
154
156
  children: /* @__PURE__ */ jsx(Switch, {
157
+ ...merged.inputProps,
155
158
  id: meta.id,
156
159
  name: props.input.props.name,
157
160
  disabled: merged.disabled,
@@ -160,13 +163,15 @@ const Control = (props) => {
160
163
  })
161
164
  })
162
165
  }));
163
- if (merged.date || merged.datetime || merged.time || meta.format === "date" || meta.format === "date-time" || meta.format === "time") return wrapWithSlots(merged, /* @__PURE__ */ jsx(ControlDate, {
166
+ if (merged.date || merged.datetime || merged.time || merged.month || meta.format === "date" || meta.format === "date-time" || meta.format === "time") return wrapWithSlots(merged, /* @__PURE__ */ jsx(ControlDate, {
164
167
  input: props.input,
165
168
  label: merged.label ?? props.label,
166
169
  description: merged.description ?? props.description,
167
170
  date: merged.date,
168
171
  datetime: merged.datetime,
169
172
  time: merged.time,
173
+ month: merged.month,
174
+ inputProps: merged.inputProps,
170
175
  disabled: merged.disabled,
171
176
  clearable: merged.clearable,
172
177
  captionLayout: merged.captionLayout,
@@ -184,6 +189,7 @@ const Control = (props) => {
184
189
  id: meta.id,
185
190
  name: props.input.props.name,
186
191
  type: "file",
192
+ accept: merged.accept,
187
193
  disabled: merged.disabled,
188
194
  onChange: (e) => setValue(e.target.files?.[0])
189
195
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Control.js","names":[],"sources":["../../src/form/Control.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { z } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport {\n type BaseInputField,\n parseField,\n useFieldValue,\n useFormState,\n} from \"alepha/react/form\";\nimport { resolveSchemaControl, type SchemaControl } from \"alepha/react/ui\";\nimport { Check, X } from \"lucide-react\";\nimport {\n type ComponentType,\n type HTMLAttributes,\n type ReactNode,\n useEffect,\n useState,\n} from \"react\";\n\nimport { Input } from \"../core/Input.tsx\";\nimport { Switch } from \"../core/Switch.tsx\";\nimport { Textarea } from \"../core/Textarea.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { ControlArray, type ControlArrayProps } from \"./ControlArray.tsx\";\nimport { ControlDate, type ControlDateProps } from \"./ControlDate.tsx\";\nimport { ControlDateRange } from \"./ControlDateRange.tsx\";\nimport { ControlNumber } from \"./ControlNumber.tsx\";\nimport { ControlObject } from \"./ControlObject.tsx\";\nimport { ControlPassword } from \"./ControlPassword.tsx\";\nimport {\n ControlSelect,\n type ControlSelectSize,\n type SelectOption,\n} from \"./ControlSelect.tsx\";\nimport { ControlUpload, type ControlUploadProps } from \"./ControlUpload.tsx\";\nimport { FormField, formFieldAriaProps } from \"./FormField.tsx\";\nimport { useFormFieldAutoSave } from \"./FormFieldAutoSaveProvider.tsx\";\nimport { useFormFieldLayout } from \"./FormFieldLayoutProvider.tsx\";\nimport { type IconComponent, iconFor } from \"./iconHint.tsx\";\n\nexport interface ControlProps {\n /**\n * Bound `InputField` from `useForm`. Carries value, schema, and error state.\n */\n input: BaseInputField;\n /**\n * Field label. Falls back to schema `title` or the field name.\n */\n label?: string;\n /**\n * Helper text shown below the control. Falls back to schema `description`.\n */\n description?: string;\n /**\n * Force a specific input variant — renders a single-line text input.\n */\n text?: boolean;\n /**\n * Force a textarea.\n */\n area?: boolean;\n /**\n * Force a masked password input.\n */\n password?: boolean;\n /**\n * Force a `<Switch>` (boolean toggle).\n */\n switch?: boolean;\n /**\n * Force a numeric input.\n */\n number?: boolean;\n /**\n * Force the file-upload control (alias for `upload`).\n */\n file?: boolean;\n /**\n * Force a date picker.\n */\n date?: boolean;\n /**\n * Force a date-time picker.\n */\n datetime?: boolean;\n /**\n * Force a date-range picker, regardless of the schema's format.\n *\n * Rarely needed: `z.dateRange()` tags the array itself, so the control\n * selects itself. Here for the same reason `date` and `datetime` are - a\n * field whose schema is a plain pair of strings can still ask for it.\n */\n dateRange?: boolean;\n /**\n * Force a time picker.\n */\n time?: boolean;\n /**\n * Date picker caption style — `\"dropdown\"` swaps the month arrows for\n * month/year selects. See {@link ControlDateProps.captionLayout}.\n */\n captionLayout?: ControlDateProps[\"captionLayout\"];\n /** First selectable month of a date picker. */\n startMonth?: Date;\n /** Last selectable month of a date picker. */\n endMonth?: Date;\n /**\n * Date-of-birth shorthand: a year dropdown covering the last 120 years.\n * See {@link ControlDateProps.birthdate}.\n */\n birthdate?: boolean;\n /**\n * Force a `<Select>`.\n */\n select?: boolean;\n /**\n * Force a combobox (searchable select). Alias for `searchable: true`.\n */\n combobox?: boolean;\n /**\n * Force the select's search input on or off. Defaults to \"auto\" — on for an\n * async list, when `createNewEntry` is set, or above ~50 options.\n */\n searchable?: boolean;\n /**\n * Force a `<Segmented>` control (one option visible at a time).\n */\n segmented?: boolean;\n /**\n * Force a slider (numeric only).\n */\n slider?: boolean;\n /**\n * Force a nested `<ControlObject>` for object-typed schemas.\n */\n object?: boolean;\n /**\n * Force a nested `<ControlArray>` for array-typed schemas.\n */\n array?: boolean;\n /**\n * Props forwarded to the nested `<ControlObject>`, keyed by child field name.\n * This is the only way to reach INSIDE an object field — without it a caller\n * can style/override the object as a whole but never one of its children\n * (e.g. attaching a `custom` widget to `payg.zoneFareCents`).\n */\n /**\n * Dictionary prefix for schema-generated labels/help: this field reads\n * `<prefix>.<name>` and `<prefix>.<name>.desc`, and passes the extended\n * prefix down into nested objects and array items.\n */\n i18nPrefix?: string;\n objectProps?: {\n controlProps?: Record<string, Partial<Omit<ControlProps, \"input\">>>;\n variant?: \"fieldset\" | \"plain\";\n defaultExpanded?: boolean;\n };\n /**\n * Custom render component receiving `{value, onChange}`.\n */\n custom?: ComponentType<{ value: unknown; onChange: (v: unknown) => void }>;\n /**\n * Override icon — pass `null` to remove the schema-inferred icon.\n */\n icon?: IconComponent | string | null;\n /**\n * Disable the control.\n */\n disabled?: boolean;\n /**\n * Render slot before the control.\n */\n top?: ReactNode;\n /**\n * Render slot after the control.\n */\n bottom?: ReactNode;\n /**\n * A status drawn inside the right end of a text input, such as a tick or a\n * cross saying whether the value is accepted. Decoration only: it takes no\n * pointer events, so put anything the reader must act on in `bottom`.\n *\n * The auto-save tick and the clear button own that corner when they show,\n * and hide it meanwhile. The input reserves its gutter while it is drawn.\n */\n trailing?: ReactNode;\n /**\n * An error to show now, drawn exactly like a validation error. Wins over\n * the form's own, which only exists once the form has been submitted: a\n * multi-step wizard whose Next is not a submit uses this to refuse a value\n * the moment it is typed.\n */\n error?: string;\n /**\n * Width slot inside an `<AutoForm>` group (mapped to a CSS grid column\n * span). Read by the parent group; ignored when rendering standalone.\n */\n width?: 100 | 75 | 66 | 50 | 33 | 25;\n /**\n * HTML `autocomplete` hint passed to the underlying input.\n */\n autoComplete?: string;\n /**\n * Placeholder text. On a text-shaped control this is the HTML\n * `placeholder`; on a select it is the trigger text shown while nothing is\n * picked.\n */\n placeholder?: string;\n /**\n * Autofocus the control on mount. Forwarded to the text, number, password\n * or textarea input the control renders. Ignored by the variants that are\n * not a single focusable field (select, date, upload, array, object).\n *\n * Every forward site carries an `oxlint-disable-next-line\n * jsx-a11y/no-autofocus`. That rule is right about a page that grabs focus\n * unbidden and wrong here: nothing focuses unless a caller passed this prop,\n * and it is the caller the rule should be asking. Left to fire, it did real\n * damage once - a lint pass deleted the forwarding and left the prop\n * declared, so login and dialog forms silently stopped focusing their first\n * field and two components grew `getElementById(...).focus()` workarounds.\n */\n autoFocus?: boolean;\n /**\n * Visible row count for the textarea variant. Overrides the value\n * auto-derived from the schema's `maxLength`. Ignored by other variants.\n */\n rows?: number;\n /**\n * Escape hatch — extra native attributes (event handlers, `className`,\n * `aria-*`, `data-*`, `style`, …) forwarded to whichever element the\n * control actually renders (text input / textarea / password input). The\n * form bindings (`value`, `onChange`, `id`, `name`) always win and cannot\n * be overridden here.\n *\n * `data-*` is spelled out because `HTMLAttributes` does not carry it:\n * TypeScript special-cases dashed attributes in JSX only, so an object\n * literal `{ \"data-testid\": … }` is an excess property and fails to\n * compile. Without this a control cannot carry a test hook, which meant a\n * surface with an e2e had to keep a raw `<input>` rather than adopt the\n * shared control.\n *\n * ⚠️ **`autoComplete` does not go here.** `Control` takes it as a\n * first-class prop, and `ControlPassword` writes its own after spreading\n * this object - so a value passed through `inputProps` is silently\n * replaced by `\"current-password\"`, which on a field holding a deploy\n * token is the password-manager prompt the masking exists to avoid.\n */\n inputProps?: HTMLAttributes<HTMLElement> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n };\n /**\n * Allow user to create new entries in select / multi-select.\n */\n createNewEntry?: boolean | ((query: string) => unknown);\n /**\n * Inline option list for select / combobox controls. Infer array or\n * async loader. Overrides schema-derived `enum` when present.\n */\n items?:\n | SelectOption[]\n | ((query: string) => SelectOption[] | Promise<SelectOption[]>);\n /**\n * Whether the field offers a way back to empty.\n *\n * On a `ControlSelect`, `true` adds a synthetic \"none\" row that resets the\n * field to `undefined` — use it for optional filter chips.\n *\n * On a text field the affordance is the opposite way round: an optional\n * field already shows a clear (×) button whenever it holds a value, and\n * `false` takes it away. Pass `false` when emptying the field is not\n * something the API can honour — a username has no \"unset\" on the server,\n * so offering the button would promise an edit that silently does nothing.\n */\n clearable?: boolean;\n /**\n * Forwarded to `ControlSelect` — label of the `clearable` row, also\n * used as the empty-state trigger placeholder. Defaults to \"None\".\n */\n clearLabel?: string;\n /**\n * Trigger text for a multi-select whose selection is too long to name, e.g.\n * `(n) => \\`${n} status\\``. One selection always shows the value itself, so\n * this is only ever asked for two or more past `maxTriggerLength`. Defaults\n * to `\"{n} values\"`.\n */\n countLabel?: (count: number) => string;\n /**\n * Forwarded to `ControlSelect`: the longest joined text a multi-select\n * trigger names its selection with before it collapses to `countLabel`.\n * Defaults to 20.\n */\n maxTriggerLength?: number;\n /**\n * Forwarded to `ControlSelect` — extra className on the trigger.\n * Useful for sizing filter chips inline.\n */\n triggerClassName?: string;\n /**\n * Trigger height and type scale, for the select-shaped controls. Defaults\n * to `default`; `xs` is for a control that sits ON a row of text rather\n * than in a form.\n */\n size?: ControlSelectSize;\n /**\n * Render the select trigger borderless and transparent, so it reads as the\n * row it sits on rather than as a form field. Pairs with `size=\"xs\"`.\n */\n minimal?: boolean;\n /**\n * Forwarded to `ControlSelect`: drawn at the top of a select's popup, for\n * a setting that changes what the choice means (a filter's \"is / is not\").\n */\n popupHeader?: ReactNode;\n /**\n * Forwarded to `ControlSelect`: a short qualifier drawn before the\n * selected label on the trigger (\"not Active\").\n */\n triggerPrefix?: ReactNode;\n /**\n * Forwarded to `ControlSelect`: extra className on a select's popup, e.g.\n * `w-max min-w-48` to size it from its content rather than its trigger.\n */\n popupClassName?: string;\n /**\n * Render a managed upload control (image preview, multi, drag-drop)\n * that calls `FileController.uploadFile` and stores the file ID(s) in\n * the form value. Pass `true` for defaults or an options object.\n */\n upload?:\n | boolean\n | Pick<\n ControlUploadProps,\n \"multi\" | \"accept\" | \"maxSize\" | \"bucket\" | \"image\"\n >;\n}\n\n/**\n * Schema-driven form field renderer. Inspects the bound `InputField` from\n * `useForm`, evaluates `schema.$control` (object or function), merges the\n * result with explicit props, and dispatches to the right sub-control.\n */\nexport const Control = (props: ControlProps) => {\n const form = useFormState(props.input, [\"error\", \"dirty\"]);\n const autoSaveEnabled = useFormFieldAutoSave();\n const rowLayout = useFormFieldLayout() === \"row\";\n const [value, setValue] = useFieldValue(props.input);\n\n // Function-form `$control` reads other fields → re-render on any\n // change. Infer `$control` (object) does not need this subscription.\n useDynamicControlRefresh(props.input);\n\n if (!props.input?.props) return null;\n\n const parsed = parseField(props.input, {\n label: props.label,\n description: props.description,\n error: form.error,\n });\n const meta = props.error ? { ...parsed, error: props.error } : parsed;\n\n // ── Resolve $control (object | function | false) ─────────────────\n const resolved = resolveSchemaControl(meta.control, {\n form: props.input.form,\n value,\n });\n // `null` is gone, `hidden` is present-but-invisible. A control renders\n // nothing for either; only the LAYOUT tells them apart.\n if (resolved === null || resolved.hidden) return null;\n\n const merged = {\n ...props,\n ...(resolved as Partial<ControlProps>),\n } as ControlProps & Partial<SchemaControl>;\n\n // ── Custom escape hatch ──────────────────────────────────────────\n if (merged.custom) {\n const Custom = merged.custom;\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n >\n <Custom value={value} onChange={(v) => setValue(v)} />\n </FormField>,\n );\n }\n\n // ── Recursive: object / array of objects ─────────────────────────\n if (merged.object || meta.isObject) {\n return wrapWithSlots(\n merged,\n <ControlObject\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n disabled={merged.disabled}\n i18nPrefix={merged.i18nPrefix}\n controlProps={merged.objectProps?.controlProps}\n variant={merged.objectProps?.variant}\n defaultExpanded={merged.objectProps?.defaultExpanded}\n clearable={merged.clearable}\n />,\n );\n }\n if (merged.array || meta.isArrayOfObjects) {\n const arrayProps = (merged as { arrayProps?: Record<string, unknown> })\n .arrayProps;\n return wrapWithSlots(\n merged,\n <ControlArray\n input={props.input}\n i18nPrefix={merged.i18nPrefix}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n disabled={merged.disabled}\n confirmDelete={\n arrayProps?.confirmDelete as ControlArrayProps[\"confirmDelete\"]\n }\n renderTabName={\n arrayProps?.renderTabName as ControlArrayProps[\"renderTabName\"]\n }\n forceTabs={arrayProps?.forceTabs as boolean | undefined}\n />,\n );\n }\n\n // ── File: managed upload (image preview, multi, drag-drop) ──────\n // Checked early so it wins over the array→combobox branch below\n // when the schema is `z.array(z.string())` with $control.upload.\n if (merged.upload) {\n const uploadOpts =\n typeof merged.upload === \"object\"\n ? (merged.upload as Partial<ControlUploadProps>)\n : {};\n return wrapWithSlots(\n merged,\n <ControlUpload\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n disabled={merged.disabled}\n {...uploadOpts}\n />,\n );\n }\n\n // ── Items provided → select / multi / combobox ───────────────────\n // Read before the numeric branch, because that branch owns every numeric\n // schema by default and `ControlNumber` has nowhere to put an option list:\n // a `z.number()` field handed `items` used to render a bare spinner and drop\n // the rows on the floor, silently. An explicit list is an explicit request\n // for a select, so it wins - `slider` / `number` still override it below.\n const items = (merged as Record<string, unknown>).items as\n | undefined\n | unknown[]\n | ((q: string) => unknown);\n\n // ── Number / slider ──────────────────────────────────────────────\n if (\n merged.slider ||\n merged.number ||\n (!merged.select &&\n !merged.segmented &&\n !merged.combobox &&\n items == null &&\n (meta.type === \"number\" || meta.type === \"integer\"))\n ) {\n return wrapWithSlots(\n merged,\n <ControlNumber\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n slider={merged.slider}\n disabled={merged.disabled}\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- forwarded only when the caller asked, see `autoFocus` above\n autoFocus={merged.autoFocus}\n />,\n );\n }\n\n // ── Date range ───────────────────────────────────────────────────\n //\n // ⚠️ ABOVE the array branch below, and that placement is the whole of it.\n // `z.dateRange()` IS an array, so the `meta.isArray` test twenty lines down\n // matches it first and renders a range as a multi-select combobox - which\n // looks like a deliberate control and is silently the wrong one. Sitting\n // this beside the date branch further down, where it reads as though it\n // belongs, is exactly the mistake.\n //\n // Keyed on the format LITERAL, never on \"array whose items are dates\": that\n // second test cannot tell a range from an ordinary list of two days, and it\n // is what would make a later `date-time-range` a rewrite rather than one\n // more literal plus a `withTime` prop.\n if (merged.dateRange || meta.format === \"date-range\") {\n return wrapWithSlots(\n merged,\n <ControlDateRange\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n disabled={merged.disabled}\n clearable={merged.clearable}\n placeholder={merged.placeholder}\n triggerClassName={merged.triggerClassName}\n // From `props`, like the select's below: a node has no place in a\n // schema's `$control`.\n triggerPrefix={props.triggerPrefix}\n />,\n );\n }\n\n if (\n merged.select ||\n merged.combobox ||\n merged.segmented ||\n meta.isEnum ||\n (meta.isArray && !meta.isArrayOfObjects) ||\n items != null\n ) {\n return wrapWithSlots(\n merged,\n <ControlSelect\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n segmented={merged.segmented}\n combobox={merged.combobox}\n searchable={merged.searchable}\n items={items as never}\n // Every field carries a leading icon, a select included: the list\n // glyph unless the caller names one or passes `null`. Not on a\n // `minimal` trigger, the toolbar filter chip, which names itself with\n // a `triggerPrefix` and would only get noisier.\n icon={\n merged.minimal\n ? resolveIcon(merged.icon)\n : resolveIcon(merged.icon, \"list\")\n }\n disabled={merged.disabled}\n createNewEntry={\n merged.createNewEntry as boolean | ((q: string) => never) | undefined\n }\n clearable={merged.clearable}\n clearLabel={merged.clearLabel}\n countLabel={merged.countLabel}\n maxTriggerLength={merged.maxTriggerLength}\n // Dropped here until now, so a picker that needed to name its own\n // empty state (\"Pick an epic…\") could not be a `Control` at all.\n placeholder={merged.placeholder}\n triggerClassName={merged.triggerClassName}\n size={merged.size}\n minimal={merged.minimal}\n // Used to be dropped here, silently: every `inputProps={{ \"aria-label\"\n // }}` on a select-shaped Control (the epics and quests status filters\n // among them) named nothing at all, because the trigger is a button\n // with no visible label to borrow a name from.\n triggerProps={merged.inputProps}\n // From `props`, not `merged`: a node has no business in a schema's\n // `$control`, so there is nothing for the merge to contribute.\n popupHeader={props.popupHeader}\n triggerPrefix={props.triggerPrefix}\n popupClassName={merged.popupClassName}\n />,\n );\n }\n\n // ── Boolean → switch ─────────────────────────────────────────────\n if (meta.type === \"boolean\" && merged.switch !== false) {\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n >\n <div className=\"flex h-9 items-center\">\n <Switch\n id={meta.id}\n // Same omission as the numeric control had: without a name the\n // toggle is invisible to `[name=\"…\"]` lookups, including\n // `AutoForm`'s scroll-to-first-error.\n name={props.input.props.name}\n disabled={merged.disabled}\n checked={Boolean(value)}\n onCheckedChange={(v) => setValue(v)}\n />\n </div>\n </FormField>,\n );\n }\n\n // ── Date / time ──────────────────────────────────────────────────\n if (\n merged.date ||\n merged.datetime ||\n merged.time ||\n meta.format === \"date\" ||\n meta.format === \"date-time\" ||\n meta.format === \"time\"\n ) {\n return wrapWithSlots(\n merged,\n <ControlDate\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n date={merged.date}\n datetime={merged.datetime}\n time={merged.time}\n disabled={merged.disabled}\n clearable={merged.clearable}\n captionLayout={merged.captionLayout}\n startMonth={merged.startMonth}\n endMonth={merged.endMonth}\n birthdate={merged.birthdate}\n />,\n );\n }\n\n // ── File (raw) ───────────────────────────────────────────────────\n if (merged.file) {\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n >\n <Input\n id={meta.id}\n name={props.input.props.name}\n type=\"file\"\n disabled={merged.disabled}\n onChange={(e) => setValue(e.target.files?.[0])}\n />\n </FormField>,\n );\n }\n\n // ── Auto-textarea: explicit `area` or maxLength > 256 ────────────\n const maxLength = meta.constraints.maxLength ?? 0;\n if (merged.area || maxLength > 256) {\n const rows =\n merged.rows ?? (maxLength > 1024 ? 6 : maxLength > 512 ? 4 : 2);\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n >\n <Textarea\n {...merged.inputProps}\n {...formFieldAriaProps({\n id: meta.id,\n error: meta.error,\n description: merged.description ?? meta.description,\n required: meta.required,\n })}\n id={meta.id}\n name={props.input.props.name}\n rows={rows}\n disabled={merged.disabled}\n maxLength={maxLength || undefined}\n autoComplete={merged.autoComplete}\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- forwarded only when the caller asked, see `autoFocus` above\n autoFocus={merged.autoFocus}\n placeholder={merged.placeholder}\n value={String(value ?? \"\")}\n onChange={(e) => setValue(e.target.value)}\n />\n </FormField>,\n );\n }\n\n // ── Password ─────────────────────────────────────────────────────\n const isPassword =\n merged.password ||\n meta.iconHint === \"password\" ||\n meta.format === \"password\";\n if (isPassword) {\n return wrapWithSlots(\n merged,\n <ControlPassword\n id={meta.id}\n name={props.input.props.name}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n disabled={merged.disabled}\n autoComplete={merged.autoComplete}\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- forwarded only when the caller asked, see `autoFocus` above\n autoFocus={merged.autoFocus}\n inputProps={merged.inputProps}\n icon={resolveIcon(merged.icon, \"password\")}\n value={String(value ?? \"\")}\n onChange={(v) => setValue(v)}\n />,\n );\n }\n\n // ── Default text input with format-driven HTML5 type + icon ──────\n const Icon = resolveIcon(merged.icon, meta.iconHint);\n const htmlType =\n meta.format === \"email\"\n ? \"email\"\n : meta.format === \"url\" || meta.format === \"uri\"\n ? \"url\"\n : meta.format === \"tel\" || meta.format === \"phone\"\n ? \"tel\"\n : \"text\";\n\n // Derive a sensible HTML `autocomplete` hint from the schema format so\n // password managers and browser autofill behave correctly out of the box.\n // Explicit `autoComplete` prop always wins.\n const autoCompleteFromFormat =\n meta.format === \"email\"\n ? \"email\"\n : meta.format === \"tel\" || meta.format === \"phone\"\n ? \"tel\"\n : meta.format === \"url\" || meta.format === \"uri\"\n ? \"url\"\n : undefined;\n const autoComplete = merged.autoComplete ?? autoCompleteFromFormat;\n\n // A value typed verbatim (an account identifier, an address, a code) must\n // not be rewritten by the keyboard: iOS capitalises the first letter of a\n // username by default, and a sign-in then fails on \"Test@mobile.test\".\n const verbatim =\n htmlType === \"email\" ||\n htmlType === \"url\" ||\n [\"username\", \"email\", \"tel\", \"url\", \"one-time-code\"].includes(\n autoComplete ?? \"\",\n );\n\n // ── Right-side affordance: tick (when dirty) or clear (when nullable) ─\n // Tick only renders inside an `<AutoForm autoSave>` tree (or any caller\n // that explicitly wraps with `<FormFieldAutoSaveProvider value>`).\n const showSave = autoSaveEnabled && !!form.dirty && !merged.disabled;\n const isNullable =\n !meta.required && value != null && value !== \"\" && !merged.disabled;\n // `clearable !== false`, not `clearable === true`: an optional text field\n // offers the button by default and a caller opts *out* of it. See the prop.\n const showClear = !showSave && isNullable && merged.clearable !== false;\n // The right gutter is reserved only while the tick is drawn, or while the\n // cross is drawn AND the field has focus. Kept on every editable field, it\n // took 36px from the text of each one and cut placeholders short for a\n // button that was not there (\"Rechercher client, terr…\"). At rest the cross\n // floats over the end of the value on a fade instead, so a settings row\n // shows \"Delete project\" rather than \"Delete proj\"; once focused the gutter\n // comes back, since the caret must never sit under the button. The input\n // is border-box, so the padding never changes its width.\n const showTrailing = !showSave && !showClear && merged.trailing != null;\n const reserveGutter = showSave || showTrailing;\n\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n >\n <div className=\"relative\">\n {Icon && (\n <Icon className=\"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2\" />\n )}\n <Input\n autoCapitalize={verbatim ? \"none\" : undefined}\n autoCorrect={verbatim ? \"off\" : undefined}\n spellCheck={verbatim ? false : undefined}\n {...merged.inputProps}\n {...formFieldAriaProps({\n id: meta.id,\n error: meta.error,\n description: merged.description ?? meta.description,\n required: meta.required,\n })}\n id={meta.id}\n name={props.input.props.name}\n type={htmlType}\n disabled={merged.disabled}\n autoComplete={autoComplete}\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- forwarded only when the caller asked, see `autoFocus` above\n autoFocus={merged.autoFocus}\n placeholder={merged.placeholder}\n value={String(value ?? \"\")}\n minLength={meta.constraints.minLength}\n maxLength={meta.constraints.maxLength}\n pattern={meta.constraints.pattern}\n // `cn`, not a plain join: the settings width below has to be\n // overridable by the caller, and only `cn`'s merge can decide\n // that `sm:w-96` beats `sm:w-64` rather than both landing on the\n // element. Order is precedence — later wins.\n className={cn(\n // Row layout is the settings-card shape, whose right-hand cell is\n // an `auto` grid column: `w-full` there resolves against the\n // input's own intrinsic size (~172px), so every card would get a\n // slightly different control column. 256px is the width every\n // hand-written `SettingsRow` already passes; encoded once here.\n // Below `sm` the row stacks, and `w-full` from `<Input>` is right.\n rowLayout && \"sm:w-64\",\n merged.inputProps?.className,\n Icon && \"pl-9\",\n reserveGutter && \"pr-9\",\n showClear && \"focus:pr-9\",\n )}\n onChange={(e) => setValue(e.target.value)}\n onKeyDown={(e) => {\n merged.inputProps?.onKeyDown?.(e);\n if (e.defaultPrevented || e.key !== \"Enter\") return;\n // The commit the auto-save effect deliberately withholds from a\n // text field on every keystroke. Its comment offers \"Enter or the\n // inline tick button\" as the two ways to commit - and only the\n // tick ever existed. `AutoForm` in auto-save mode renders no\n // submit button, so the browser's implicit submission never fires\n // and Enter did nothing at all, on every text field in every\n // auto-saving form.\n //\n // Guarded on `showSave` so it is inert outside auto-save mode and\n // on a pristine field, where a normal form's own Enter handling\n // must keep working.\n if (!showSave) return;\n e.preventDefault();\n // `props.input.form`, the same handle the tick button submits\n // through. The local `form` is only the `dirty` / `error` slice.\n void props.input.form.submit();\n }}\n />\n {showSave && (\n <button\n type=\"button\"\n onClick={() => props.input.form.submit()}\n aria-label=\"Save\"\n className=\"text-primary hover:text-primary/80 absolute top-1/2 right-2 -translate-y-1/2 p-1\"\n >\n <Check className=\"size-3.5\" />\n </button>\n )}\n {showClear && (\n <button\n type=\"button\"\n onClick={() => setValue(undefined)}\n aria-label=\"Clear\"\n // `data-slot` like every other clear in the kit\n // (`combobox-clear`, and `control-clear` on the field trigger).\n // It was the only one without a hook, so the only way to address\n // it was its `aria-label` - which is translated, so a French UI\n // would have matched nothing. Purely an identification hook: no\n // style and no behaviour rides on it here.\n data-slot=\"control-clear\"\n // Over the value, inside the border (`inset-y-px right-px`), on a\n // fade into the surface behind the field (`--surface`, which any\n // element painting a surface token declares, see `styles.css`).\n // In dark the input carries its own\n // `bg-input/30` tint, so the fade stacks that tint over the\n // surface to match it exactly.\n className=\"text-muted-foreground hover:text-foreground absolute inset-y-px right-px flex items-center rounded-r-[calc(var(--radius-lg)-1px)] bg-[linear-gradient(to_right,transparent,var(--surface)_1.25rem)] pr-2.5 pl-6 dark:bg-[linear-gradient(to_right,transparent,color-mix(in_oklab,var(--input)_30%,transparent)_1.25rem),linear-gradient(to_right,transparent,var(--surface)_1.25rem)]\"\n >\n <X className=\"size-3.5\" />\n </button>\n )}\n {showTrailing && (\n <span\n data-slot=\"control-trailing\"\n className=\"pointer-events-none absolute top-1/2 right-3 flex -translate-y-1/2 items-center\"\n >\n {merged.trailing}\n </span>\n )}\n </div>\n </FormField>,\n );\n};\n\n/**\n * The raw `$control` a field declares, object form or function form.\n *\n * It rides on zod's `.meta()` registry rather than being a plain schema\n * property, and the field may be wrapped (optional / nullable / default), so\n * the wrapper has to be peeled before the meta is readable.\n *\n * Exported because the LAYOUT needs it too: `AutoForm` sizes a grid cell from\n * the width `$control` asks for, and a function-form `$control` has no `.width`\n * to read off the function itself. Pair it with {@link resolveSchemaControl}.\n */\nexport const readSchemaControl = (\n input: BaseInputField | undefined,\n): unknown => {\n const base = input?.schema ? z.schema.unwrap(input.schema) : undefined;\n return (base as { meta?: () => { $control?: unknown } } | undefined)?.meta?.()\n ?.$control;\n};\n\n/**\n * Re-render when a function-form `$control` may have changed its mind, which\n * is on any change to a field OTHER than this one. An object-form `$control`\n * is static and needs no subscription.\n *\n * Exported alongside {@link readSchemaControl}, and for the same reason: a\n * consumer that resolves `$control` itself has to re-resolve on the same\n * events, or it renders a stale answer.\n */\nexport const useDynamicControlRefresh = (input: BaseInputField | undefined) => {\n const alepha = useAlepha();\n const [, bump] = useState(0);\n const isDynamic = typeof readSchemaControl(input) === \"function\";\n useEffect(() => {\n if (!isDynamic || !input?.form) return;\n const formId = input.form.id;\n return alepha.events.on(\"form:changed\", (e) => {\n if (e.id === formId && e.path !== input.path) bump((n) => n + 1);\n });\n }, [alepha, input?.form, input?.path, isDynamic]);\n};\n\nconst resolveIcon = (\n icon: ControlProps[\"icon\"],\n fallback?: string | null,\n): IconComponent | undefined => {\n if (icon === null) return undefined;\n if (typeof icon === \"string\") return iconFor(icon);\n if (icon) return icon;\n return iconFor(fallback);\n};\n\nconst wrapWithSlots = (\n props: ControlProps & Partial<SchemaControl>,\n body: ReactNode,\n): ReactNode => {\n const top = (props.top as ReactNode) ?? null;\n const bottom = (props.bottom as ReactNode) ?? null;\n if (!top && !bottom) return body;\n return (\n <div className=\"flex flex-col gap-1\">\n {top}\n {body}\n {bottom}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwVA,MAAa,WAAW,UAAwB;CAC9C,MAAM,OAAO,aAAa,MAAM,OAAO,CAAC,SAAS,OAAO,CAAC;CACzD,MAAM,kBAAkB,qBAAqB;CAC7C,MAAM,YAAY,mBAAmB,MAAM;CAC3C,MAAM,CAAC,OAAO,YAAY,cAAc,MAAM,KAAK;CAInD,yBAAyB,MAAM,KAAK;CAEpC,IAAI,CAAC,MAAM,OAAO,OAAO,OAAO;CAEhC,MAAM,SAAS,WAAW,MAAM,OAAO;EACrC,OAAO,MAAM;EACb,aAAa,M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OAAO,GAAG,iBAAiB,MAAM;GAC7C,IAAI,EAAE,OAAO,UAAU,EAAE,SAAS,MAAM,MAAM,MAAM,MAAM,IAAI,CAAC;EACjE,CAAC;CACH,GAAG;EAAC;EAAQ,OAAO;EAAM,OAAO;EAAM;CAAS,CAAC;AAClD;AAEA,MAAM,eACJ,MACA,aAC8B;CAC9B,IAAI,SAAS,MAAM,OAAO,KAAA;CAC1B,IAAI,OAAO,SAAS,UAAU,OAAO,QAAQ,IAAI;CACjD,IAAI,MAAM,OAAO;CACjB,OAAO,QAAQ,QAAQ;AACzB;AAEA,MAAM,iBACJ,OACA,SACc;CACd,MAAM,MAAO,MAAM,OAAqB;CACxC,MAAM,SAAU,MAAM,UAAwB;CAC9C,IAAI,CAAC,OAAO,CAAC,QAAQ,OAAO;CAC5B,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACG;GACA;GACA;EACE;;AAET"}
1
+ {"version":3,"file":"Control.js","names":[],"sources":["../../src/form/Control.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { z } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport {\n type BaseInputField,\n parseField,\n useFieldValue,\n useFormState,\n} from \"alepha/react/form\";\nimport { resolveSchemaControl, type SchemaControl } from \"alepha/react/ui\";\nimport { Check, X } from \"lucide-react\";\nimport {\n type ComponentType,\n type HTMLAttributes,\n type ReactNode,\n useEffect,\n useState,\n} from \"react\";\n\nimport { Input } from \"../core/Input.tsx\";\nimport { Switch } from \"../core/Switch.tsx\";\nimport { Textarea } from \"../core/Textarea.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { ControlArray, type ControlArrayProps } from \"./ControlArray.tsx\";\nimport { ControlDate, type ControlDateProps } from \"./ControlDate.tsx\";\nimport { ControlDateRange } from \"./ControlDateRange.tsx\";\nimport { ControlNumber } from \"./ControlNumber.tsx\";\nimport { ControlObject } from \"./ControlObject.tsx\";\nimport { ControlPassword } from \"./ControlPassword.tsx\";\nimport {\n ControlSelect,\n type ControlSelectSize,\n type SelectOption,\n} from \"./ControlSelect.tsx\";\nimport { ControlUpload, type ControlUploadProps } from \"./ControlUpload.tsx\";\nimport { FormField, formFieldAriaProps } from \"./FormField.tsx\";\nimport { useFormFieldAutoSave } from \"./FormFieldAutoSaveProvider.tsx\";\nimport { useFormFieldLayout } from \"./FormFieldLayoutProvider.tsx\";\nimport { type IconComponent, iconFor } from \"./iconHint.tsx\";\n\nexport interface ControlProps {\n /**\n * Bound `InputField` from `useForm`. Carries value, schema, and error state.\n */\n input: BaseInputField;\n /**\n * Field label. Falls back to schema `title` or the field name.\n */\n label?: string;\n /**\n * Helper text shown below the control. Falls back to schema `description`.\n */\n description?: string;\n /**\n * Force a specific input variant — renders a single-line text input.\n */\n text?: boolean;\n /**\n * Force a textarea.\n */\n area?: boolean;\n /**\n * Force a masked password input.\n */\n password?: boolean;\n /**\n * Force a `<Switch>` (boolean toggle).\n */\n switch?: boolean;\n /**\n * Force a numeric input.\n */\n number?: boolean;\n /**\n * Force the file-upload control (alias for `upload`).\n */\n file?: boolean;\n /**\n * The file picker's `accept` filter (`\".csv,text/csv\"`, `\"image/*\"`), for\n * `file` and for `upload`; an `upload` object's own `accept` wins.\n */\n accept?: string;\n /**\n * Force a date picker.\n */\n date?: boolean;\n /**\n * Force a date-time picker.\n */\n datetime?: boolean;\n /**\n * Force a date-range picker, regardless of the schema's format.\n *\n * Rarely needed: `z.dateRange()` tags the array itself, so the control\n * selects itself. Here for the same reason `date` and `datetime` are - a\n * field whose schema is a plain pair of strings can still ask for it.\n */\n dateRange?: boolean;\n /**\n * Force a month picker: the value is `YYYY-MM`.\n */\n month?: boolean;\n /**\n * Force a time picker.\n */\n time?: boolean;\n /**\n * Date picker caption style — `\"dropdown\"` swaps the month arrows for\n * month/year selects. See {@link ControlDateProps.captionLayout}.\n */\n captionLayout?: ControlDateProps[\"captionLayout\"];\n /** First selectable month of a date picker. */\n startMonth?: Date;\n /** Last selectable month of a date picker. */\n endMonth?: Date;\n /**\n * Date-of-birth shorthand: a year dropdown covering the last 120 years.\n * See {@link ControlDateProps.birthdate}.\n */\n birthdate?: boolean;\n /**\n * Force a `<Select>`.\n */\n select?: boolean;\n /**\n * Force a combobox (searchable select). Alias for `searchable: true`.\n */\n combobox?: boolean;\n /**\n * Force the select's search input on or off. Defaults to \"auto\" — on for an\n * async list, when `createNewEntry` is set, or above ~50 options.\n */\n searchable?: boolean;\n /**\n * Force a `<Segmented>` control (one option visible at a time).\n */\n segmented?: boolean;\n /**\n * Render a multi-choice field (an array of options) as a group of\n * checkboxes, every option visible. See `ControlSelectProps.checkboxes`.\n */\n checkboxes?: boolean;\n /**\n * Force a slider (numeric only).\n */\n slider?: boolean;\n /**\n * Force a nested `<ControlObject>` for object-typed schemas.\n */\n object?: boolean;\n /**\n * Force a nested `<ControlArray>` for array-typed schemas.\n */\n array?: boolean;\n /**\n * Props forwarded to the nested `<ControlObject>`, keyed by child field name.\n * This is the only way to reach INSIDE an object field — without it a caller\n * can style/override the object as a whole but never one of its children\n * (e.g. attaching a `custom` widget to `payg.zoneFareCents`).\n */\n /**\n * Dictionary prefix for schema-generated labels/help: this field reads\n * `<prefix>.<name>` and `<prefix>.<name>.desc`, and passes the extended\n * prefix down into nested objects and array items.\n */\n i18nPrefix?: string;\n objectProps?: {\n controlProps?: Record<string, Partial<Omit<ControlProps, \"input\">>>;\n variant?: \"fieldset\" | \"plain\";\n defaultExpanded?: boolean;\n };\n /**\n * Custom render component receiving `{value, onChange}`.\n */\n custom?: ComponentType<{ value: unknown; onChange: (v: unknown) => void }>;\n /**\n * Override icon — pass `null` to remove the schema-inferred icon.\n */\n icon?: IconComponent | string | null;\n /**\n * Disable the control.\n */\n disabled?: boolean;\n /**\n * Render slot before the control.\n */\n top?: ReactNode;\n /**\n * Render slot after the control.\n */\n bottom?: ReactNode;\n /**\n * A status drawn inside the right end of a text input, such as a tick or a\n * cross saying whether the value is accepted. Decoration only: it takes no\n * pointer events, so put anything the reader must act on in `bottom`.\n *\n * The auto-save tick and the clear button own that corner when they show,\n * and hide it meanwhile. The input reserves its gutter while it is drawn.\n */\n trailing?: ReactNode;\n /**\n * An error to show now, drawn exactly like a validation error. Wins over\n * the form's own, which only exists once the form has been submitted: a\n * multi-step wizard whose Next is not a submit uses this to refuse a value\n * the moment it is typed.\n */\n error?: string;\n /**\n * Width slot inside an `<AutoForm>` group (mapped to a CSS grid column\n * span). Read by the parent group; ignored when rendering standalone.\n */\n width?: 100 | 75 | 66 | 50 | 33 | 25;\n /**\n * HTML `autocomplete` hint passed to the underlying input.\n */\n autoComplete?: string;\n /**\n * Placeholder text. On a text-shaped control this is the HTML\n * `placeholder`; on a select it is the trigger text shown while nothing is\n * picked.\n */\n placeholder?: string;\n /**\n * Autofocus the control on mount. Forwarded to the text, number, password\n * or textarea input the control renders. Ignored by the variants that are\n * not a single focusable field (select, date, upload, array, object).\n *\n * Every forward site carries an `oxlint-disable-next-line\n * jsx-a11y/no-autofocus`. That rule is right about a page that grabs focus\n * unbidden and wrong here: nothing focuses unless a caller passed this prop,\n * and it is the caller the rule should be asking. Left to fire, it did real\n * damage once - a lint pass deleted the forwarding and left the prop\n * declared, so login and dialog forms silently stopped focusing their first\n * field and two components grew `getElementById(...).focus()` workarounds.\n */\n autoFocus?: boolean;\n /**\n * Visible row count for the textarea variant. Overrides the value\n * auto-derived from the schema's `maxLength`. Ignored by other variants.\n */\n rows?: number;\n /**\n * Escape hatch — extra native attributes (event handlers, `className`,\n * `aria-*`, `data-*`, `style`, …) forwarded to whichever element the\n * control actually renders (text input / textarea / password input). The\n * form bindings (`value`, `onChange`, `id`, `name`) always win and cannot\n * be overridden here.\n *\n * `data-*` is spelled out because `HTMLAttributes` does not carry it:\n * TypeScript special-cases dashed attributes in JSX only, so an object\n * literal `{ \"data-testid\": … }` is an excess property and fails to\n * compile. Without this a control cannot carry a test hook, which meant a\n * surface with an e2e had to keep a raw `<input>` rather than adopt the\n * shared control.\n *\n * ⚠️ **`autoComplete` does not go here.** `Control` takes it as a\n * first-class prop, and `ControlPassword` writes its own after spreading\n * this object - so a value passed through `inputProps` is silently\n * replaced by `\"current-password\"`, which on a field holding a deploy\n * token is the password-manager prompt the masking exists to avoid.\n */\n inputProps?: HTMLAttributes<HTMLElement> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n };\n /**\n * Allow user to create new entries in select / multi-select.\n */\n createNewEntry?: boolean | ((query: string) => unknown);\n /**\n * Inline option list for select / combobox controls. Infer array or\n * async loader. Overrides schema-derived `enum` when present.\n */\n items?:\n | SelectOption[]\n | ((query: string) => SelectOption[] | Promise<SelectOption[]>);\n /**\n * Whether the field offers a way back to empty.\n *\n * On a `ControlSelect`, `true` adds a synthetic \"none\" row that resets the\n * field to `undefined` — use it for optional filter chips.\n *\n * On a text field the affordance is the opposite way round: an optional\n * field already shows a clear (×) button whenever it holds a value, and\n * `false` takes it away. Pass `false` when emptying the field is not\n * something the API can honour — a username has no \"unset\" on the server,\n * so offering the button would promise an edit that silently does nothing.\n */\n clearable?: boolean;\n /**\n * Forwarded to `ControlSelect` — label of the `clearable` row, also\n * used as the empty-state trigger placeholder. Defaults to \"None\".\n */\n clearLabel?: string;\n /**\n * Trigger text for a multi-select whose selection is too long to name, e.g.\n * `(n) => \\`${n} status\\``. One selection always shows the value itself, so\n * this is only ever asked for two or more past `maxTriggerLength`. Defaults\n * to `\"{n} values\"`.\n */\n countLabel?: (count: number) => string;\n /**\n * Forwarded to `ControlSelect`: the longest joined text a multi-select\n * trigger names its selection with before it collapses to `countLabel`.\n * Defaults to 20.\n */\n maxTriggerLength?: number;\n /**\n * Forwarded to `ControlSelect` — extra className on the trigger.\n * Useful for sizing filter chips inline.\n */\n triggerClassName?: string;\n /**\n * Trigger height and type scale, for the select-shaped controls. Defaults\n * to `default`; `xs` is for a control that sits ON a row of text rather\n * than in a form.\n */\n size?: ControlSelectSize;\n /**\n * Render the select trigger borderless and transparent, so it reads as the\n * row it sits on rather than as a form field. Pairs with `size=\"xs\"`.\n */\n minimal?: boolean;\n /**\n * Forwarded to `ControlSelect`: drawn at the top of a select's popup, for\n * a setting that changes what the choice means (a filter's \"is / is not\").\n */\n popupHeader?: ReactNode;\n /**\n * Forwarded to `ControlSelect`: a short qualifier drawn before the\n * selected label on the trigger (\"not Active\").\n */\n triggerPrefix?: ReactNode;\n /**\n * Forwarded to `ControlSelect`: extra className on a select's popup, e.g.\n * `w-max min-w-48` to size it from its content rather than its trigger.\n */\n popupClassName?: string;\n /**\n * Render a managed upload control (image preview, multi, drag-drop)\n * that calls `FileController.uploadFile` and stores the file ID(s) in\n * the form value. Pass `true` for defaults or an options object.\n */\n upload?:\n | boolean\n | Pick<\n ControlUploadProps,\n \"multi\" | \"accept\" | \"maxSize\" | \"bucket\" | \"image\"\n >;\n}\n\n/**\n * Schema-driven form field renderer. Inspects the bound `InputField` from\n * `useForm`, evaluates `schema.$control` (object or function), merges the\n * result with explicit props, and dispatches to the right sub-control.\n */\nexport const Control = (props: ControlProps) => {\n const form = useFormState(props.input, [\"error\", \"dirty\"]);\n const autoSaveEnabled = useFormFieldAutoSave();\n const rowLayout = useFormFieldLayout() === \"row\";\n const [value, setValue] = useFieldValue(props.input);\n\n // Function-form `$control` reads other fields → re-render on any\n // change. Infer `$control` (object) does not need this subscription.\n useDynamicControlRefresh(props.input);\n\n if (!props.input?.props) return null;\n\n const parsed = parseField(props.input, {\n label: props.label,\n description: props.description,\n error: form.error,\n });\n const meta = props.error ? { ...parsed, error: props.error } : parsed;\n\n // ── Resolve $control (object | function | false) ─────────────────\n const resolved = resolveSchemaControl(meta.control, {\n form: props.input.form,\n value,\n });\n // `null` is gone, `hidden` is present-but-invisible. A control renders\n // nothing for either; only the LAYOUT tells them apart.\n if (resolved === null || resolved.hidden) return null;\n\n const merged = {\n ...props,\n ...(resolved as Partial<ControlProps>),\n } as ControlProps & Partial<SchemaControl>;\n\n // ── Custom escape hatch ──────────────────────────────────────────\n if (merged.custom) {\n const Custom = merged.custom;\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n >\n <Custom value={value} onChange={(v) => setValue(v)} />\n </FormField>,\n );\n }\n\n // ── Recursive: object / array of objects ─────────────────────────\n if (merged.object || meta.isObject) {\n return wrapWithSlots(\n merged,\n <ControlObject\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n disabled={merged.disabled}\n i18nPrefix={merged.i18nPrefix}\n controlProps={merged.objectProps?.controlProps}\n variant={merged.objectProps?.variant}\n defaultExpanded={merged.objectProps?.defaultExpanded}\n clearable={merged.clearable}\n />,\n );\n }\n if (merged.array || meta.isArrayOfObjects) {\n const arrayProps = (merged as { arrayProps?: Record<string, unknown> })\n .arrayProps;\n return wrapWithSlots(\n merged,\n <ControlArray\n input={props.input}\n i18nPrefix={merged.i18nPrefix}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n disabled={merged.disabled}\n confirmDelete={\n arrayProps?.confirmDelete as ControlArrayProps[\"confirmDelete\"]\n }\n renderTabName={\n arrayProps?.renderTabName as ControlArrayProps[\"renderTabName\"]\n }\n forceTabs={arrayProps?.forceTabs as boolean | undefined}\n />,\n );\n }\n\n // ── File: managed upload (image preview, multi, drag-drop) ──────\n // Checked early so it wins over the array→combobox branch below\n // when the schema is `z.array(z.string())` with $control.upload.\n if (merged.upload) {\n const uploadOpts =\n typeof merged.upload === \"object\"\n ? (merged.upload as Partial<ControlUploadProps>)\n : {};\n return wrapWithSlots(\n merged,\n <ControlUpload\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n disabled={merged.disabled}\n accept={merged.accept}\n {...uploadOpts}\n />,\n );\n }\n\n // ── Items provided → select / multi / combobox ───────────────────\n // Read before the numeric branch, because that branch owns every numeric\n // schema by default and `ControlNumber` has nowhere to put an option list:\n // a `z.number()` field handed `items` used to render a bare spinner and drop\n // the rows on the floor, silently. An explicit list is an explicit request\n // for a select, so it wins - `slider` / `number` still override it below.\n const items = (merged as Record<string, unknown>).items as\n | undefined\n | unknown[]\n | ((q: string) => unknown);\n\n // ── Number / slider ──────────────────────────────────────────────\n if (\n merged.slider ||\n merged.number ||\n (!merged.select &&\n !merged.segmented &&\n !merged.combobox &&\n items == null &&\n (meta.type === \"number\" || meta.type === \"integer\"))\n ) {\n return wrapWithSlots(\n merged,\n <ControlNumber\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n slider={merged.slider}\n disabled={merged.disabled}\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- forwarded only when the caller asked, see `autoFocus` above\n autoFocus={merged.autoFocus}\n />,\n );\n }\n\n // ── Date range ───────────────────────────────────────────────────\n //\n // ⚠️ ABOVE the array branch below, and that placement is the whole of it.\n // `z.dateRange()` IS an array, so the `meta.isArray` test twenty lines down\n // matches it first and renders a range as a multi-select combobox - which\n // looks like a deliberate control and is silently the wrong one. Sitting\n // this beside the date branch further down, where it reads as though it\n // belongs, is exactly the mistake.\n //\n // Keyed on the format LITERAL, never on \"array whose items are dates\": that\n // second test cannot tell a range from an ordinary list of two days, and it\n // is what would make a later `date-time-range` a rewrite rather than one\n // more literal plus a `withTime` prop.\n if (merged.dateRange || meta.format === \"date-range\") {\n return wrapWithSlots(\n merged,\n <ControlDateRange\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n disabled={merged.disabled}\n clearable={merged.clearable}\n placeholder={merged.placeholder}\n triggerClassName={merged.triggerClassName}\n // From `props`, like the select's below: a node has no place in a\n // schema's `$control`.\n triggerPrefix={props.triggerPrefix}\n />,\n );\n }\n\n if (\n merged.select ||\n merged.combobox ||\n merged.segmented ||\n merged.checkboxes ||\n meta.isEnum ||\n (meta.isArray && !meta.isArrayOfObjects) ||\n items != null\n ) {\n return wrapWithSlots(\n merged,\n <ControlSelect\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n segmented={merged.segmented}\n checkboxes={merged.checkboxes}\n combobox={merged.combobox}\n searchable={merged.searchable}\n items={items as never}\n // Every field carries a leading icon, a select included: the list\n // glyph unless the caller names one or passes `null`. Not on a\n // `minimal` trigger, the toolbar filter chip, which names itself with\n // a `triggerPrefix` and would only get noisier.\n icon={\n merged.minimal\n ? resolveIcon(merged.icon)\n : resolveIcon(merged.icon, \"list\")\n }\n disabled={merged.disabled}\n createNewEntry={\n merged.createNewEntry as boolean | ((q: string) => never) | undefined\n }\n clearable={merged.clearable}\n clearLabel={merged.clearLabel}\n countLabel={merged.countLabel}\n maxTriggerLength={merged.maxTriggerLength}\n // Dropped here until now, so a picker that needed to name its own\n // empty state (\"Pick an epic…\") could not be a `Control` at all.\n placeholder={merged.placeholder}\n triggerClassName={merged.triggerClassName}\n size={merged.size}\n minimal={merged.minimal}\n // Used to be dropped here, silently: every `inputProps={{ \"aria-label\"\n // }}` on a select-shaped Control (the epics and quests status filters\n // among them) named nothing at all, because the trigger is a button\n // with no visible label to borrow a name from.\n triggerProps={merged.inputProps}\n // From `props`, not `merged`: a node has no business in a schema's\n // `$control`, so there is nothing for the merge to contribute.\n popupHeader={props.popupHeader}\n triggerPrefix={props.triggerPrefix}\n popupClassName={merged.popupClassName}\n />,\n );\n }\n\n // ── Boolean → switch ─────────────────────────────────────────────\n if (meta.type === \"boolean\" && merged.switch !== false) {\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n // A switch always holds a value, on or off: a required marker on it\n // asks for something the reader cannot fail to give. `aria-required`\n // is left off for the same reason.\n required={false}\n >\n <div className=\"flex h-9 items-center\">\n <Switch\n {...merged.inputProps}\n id={meta.id}\n // Same omission as the numeric control had: without a name the\n // toggle is invisible to `[name=\"…\"]` lookups, including\n // `AutoForm`'s scroll-to-first-error.\n name={props.input.props.name}\n disabled={merged.disabled}\n checked={Boolean(value)}\n onCheckedChange={(v) => setValue(v)}\n />\n </div>\n </FormField>,\n );\n }\n\n // ── Date / time ──────────────────────────────────────────────────\n if (\n merged.date ||\n merged.datetime ||\n merged.time ||\n merged.month ||\n meta.format === \"date\" ||\n meta.format === \"date-time\" ||\n meta.format === \"time\"\n ) {\n return wrapWithSlots(\n merged,\n <ControlDate\n input={props.input}\n label={merged.label ?? props.label}\n description={merged.description ?? props.description}\n date={merged.date}\n datetime={merged.datetime}\n time={merged.time}\n month={merged.month}\n inputProps={merged.inputProps}\n disabled={merged.disabled}\n clearable={merged.clearable}\n captionLayout={merged.captionLayout}\n startMonth={merged.startMonth}\n endMonth={merged.endMonth}\n birthdate={merged.birthdate}\n />,\n );\n }\n\n // ── File (raw) ───────────────────────────────────────────────────\n if (merged.file) {\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n >\n <Input\n id={meta.id}\n name={props.input.props.name}\n type=\"file\"\n accept={merged.accept}\n disabled={merged.disabled}\n onChange={(e) => setValue(e.target.files?.[0])}\n />\n </FormField>,\n );\n }\n\n // ── Auto-textarea: explicit `area` or maxLength > 256 ────────────\n const maxLength = meta.constraints.maxLength ?? 0;\n if (merged.area || maxLength > 256) {\n const rows =\n merged.rows ?? (maxLength > 1024 ? 6 : maxLength > 512 ? 4 : 2);\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n >\n <Textarea\n {...merged.inputProps}\n {...formFieldAriaProps({\n id: meta.id,\n error: meta.error,\n description: merged.description ?? meta.description,\n required: meta.required,\n })}\n id={meta.id}\n name={props.input.props.name}\n rows={rows}\n disabled={merged.disabled}\n maxLength={maxLength || undefined}\n autoComplete={merged.autoComplete}\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- forwarded only when the caller asked, see `autoFocus` above\n autoFocus={merged.autoFocus}\n placeholder={merged.placeholder}\n value={String(value ?? \"\")}\n onChange={(e) => setValue(e.target.value)}\n />\n </FormField>,\n );\n }\n\n // ── Password ─────────────────────────────────────────────────────\n const isPassword =\n merged.password ||\n meta.iconHint === \"password\" ||\n meta.format === \"password\";\n if (isPassword) {\n return wrapWithSlots(\n merged,\n <ControlPassword\n id={meta.id}\n name={props.input.props.name}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n disabled={merged.disabled}\n autoComplete={merged.autoComplete}\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- forwarded only when the caller asked, see `autoFocus` above\n autoFocus={merged.autoFocus}\n inputProps={merged.inputProps}\n icon={resolveIcon(merged.icon, \"password\")}\n value={String(value ?? \"\")}\n onChange={(v) => setValue(v)}\n />,\n );\n }\n\n // ── Default text input with format-driven HTML5 type + icon ──────\n const Icon = resolveIcon(merged.icon, meta.iconHint);\n const htmlType =\n meta.format === \"email\"\n ? \"email\"\n : meta.format === \"url\" || meta.format === \"uri\"\n ? \"url\"\n : meta.format === \"tel\" || meta.format === \"phone\"\n ? \"tel\"\n : \"text\";\n\n // Derive a sensible HTML `autocomplete` hint from the schema format so\n // password managers and browser autofill behave correctly out of the box.\n // Explicit `autoComplete` prop always wins.\n const autoCompleteFromFormat =\n meta.format === \"email\"\n ? \"email\"\n : meta.format === \"tel\" || meta.format === \"phone\"\n ? \"tel\"\n : meta.format === \"url\" || meta.format === \"uri\"\n ? \"url\"\n : undefined;\n const autoComplete = merged.autoComplete ?? autoCompleteFromFormat;\n\n // A value typed verbatim (an account identifier, an address, a code) must\n // not be rewritten by the keyboard: iOS capitalises the first letter of a\n // username by default, and a sign-in then fails on \"Test@mobile.test\".\n const verbatim =\n htmlType === \"email\" ||\n htmlType === \"url\" ||\n [\"username\", \"email\", \"tel\", \"url\", \"one-time-code\"].includes(\n autoComplete ?? \"\",\n );\n\n // ── Right-side affordance: tick (when dirty) or clear (when nullable) ─\n // Tick only renders inside an `<AutoForm autoSave>` tree (or any caller\n // that explicitly wraps with `<FormFieldAutoSaveProvider value>`).\n const showSave = autoSaveEnabled && !!form.dirty && !merged.disabled;\n const isNullable =\n !meta.required && value != null && value !== \"\" && !merged.disabled;\n // `clearable !== false`, not `clearable === true`: an optional text field\n // offers the button by default and a caller opts *out* of it. See the prop.\n const showClear = !showSave && isNullable && merged.clearable !== false;\n // The right gutter is reserved only while the tick is drawn, or while the\n // cross is drawn AND the field has focus. Kept on every editable field, it\n // took 36px from the text of each one and cut placeholders short for a\n // button that was not there (\"Rechercher client, terr…\"). At rest the cross\n // floats over the end of the value on a fade instead, so a settings row\n // shows \"Delete project\" rather than \"Delete proj\"; once focused the gutter\n // comes back, since the caret must never sit under the button. The input\n // is border-box, so the padding never changes its width.\n const showTrailing = !showSave && !showClear && merged.trailing != null;\n const reserveGutter = showSave || showTrailing;\n\n return wrapWithSlots(\n merged,\n <FormField\n id={meta.id}\n label={merged.label ?? meta.label}\n description={merged.description ?? meta.description}\n error={meta.error}\n required={meta.required}\n >\n <div className=\"relative\">\n {Icon && (\n <Icon className=\"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2\" />\n )}\n <Input\n autoCapitalize={verbatim ? \"none\" : undefined}\n autoCorrect={verbatim ? \"off\" : undefined}\n spellCheck={verbatim ? false : undefined}\n {...merged.inputProps}\n {...formFieldAriaProps({\n id: meta.id,\n error: meta.error,\n description: merged.description ?? meta.description,\n required: meta.required,\n })}\n id={meta.id}\n name={props.input.props.name}\n type={htmlType}\n disabled={merged.disabled}\n autoComplete={autoComplete}\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- forwarded only when the caller asked, see `autoFocus` above\n autoFocus={merged.autoFocus}\n placeholder={merged.placeholder}\n value={String(value ?? \"\")}\n minLength={meta.constraints.minLength}\n maxLength={meta.constraints.maxLength}\n pattern={meta.constraints.pattern}\n // `cn`, not a plain join: the settings width below has to be\n // overridable by the caller, and only `cn`'s merge can decide\n // that `sm:w-96` beats `sm:w-64` rather than both landing on the\n // element. Order is precedence — later wins.\n className={cn(\n // Row layout is the settings-card shape, whose right-hand cell is\n // an `auto` grid column: `w-full` there resolves against the\n // input's own intrinsic size (~172px), so every card would get a\n // slightly different control column. 256px is the width every\n // hand-written `SettingsRow` already passes; encoded once here.\n // Below `sm` the row stacks, and `w-full` from `<Input>` is right.\n rowLayout && \"sm:w-64\",\n merged.inputProps?.className,\n Icon && \"pl-9\",\n reserveGutter && \"pr-9\",\n showClear && \"focus:pr-9\",\n )}\n onChange={(e) => setValue(e.target.value)}\n onKeyDown={(e) => {\n merged.inputProps?.onKeyDown?.(e);\n if (e.defaultPrevented || e.key !== \"Enter\") return;\n // The commit the auto-save effect deliberately withholds from a\n // text field on every keystroke. Its comment offers \"Enter or the\n // inline tick button\" as the two ways to commit - and only the\n // tick ever existed. `AutoForm` in auto-save mode renders no\n // submit button, so the browser's implicit submission never fires\n // and Enter did nothing at all, on every text field in every\n // auto-saving form.\n //\n // Guarded on `showSave` so it is inert outside auto-save mode and\n // on a pristine field, where a normal form's own Enter handling\n // must keep working.\n if (!showSave) return;\n e.preventDefault();\n // `props.input.form`, the same handle the tick button submits\n // through. The local `form` is only the `dirty` / `error` slice.\n void props.input.form.submit();\n }}\n />\n {showSave && (\n <button\n type=\"button\"\n onClick={() => props.input.form.submit()}\n aria-label=\"Save\"\n className=\"text-primary hover:text-primary/80 absolute top-1/2 right-2 -translate-y-1/2 p-1\"\n >\n <Check className=\"size-3.5\" />\n </button>\n )}\n {showClear && (\n <button\n type=\"button\"\n onClick={() => setValue(undefined)}\n aria-label=\"Clear\"\n // `data-slot` like every other clear in the kit\n // (`combobox-clear`, and `control-clear` on the field trigger).\n // It was the only one without a hook, so the only way to address\n // it was its `aria-label` - which is translated, so a French UI\n // would have matched nothing. Purely an identification hook: no\n // style and no behaviour rides on it here.\n data-slot=\"control-clear\"\n // Over the value, inside the border (`inset-y-px right-px`), on a\n // fade into the surface behind the field (`--surface`, which any\n // element painting a surface token declares, see `styles.css`).\n // In dark the input carries its own\n // `bg-input/30` tint, so the fade stacks that tint over the\n // surface to match it exactly.\n className=\"text-muted-foreground hover:text-foreground absolute inset-y-px right-px flex items-center rounded-r-[calc(var(--radius-lg)-1px)] bg-[linear-gradient(to_right,transparent,var(--surface)_1.25rem)] pr-2.5 pl-6 dark:bg-[linear-gradient(to_right,transparent,color-mix(in_oklab,var(--input)_30%,transparent)_1.25rem),linear-gradient(to_right,transparent,var(--surface)_1.25rem)]\"\n >\n <X className=\"size-3.5\" />\n </button>\n )}\n {showTrailing && (\n <span\n data-slot=\"control-trailing\"\n className=\"pointer-events-none absolute top-1/2 right-3 flex -translate-y-1/2 items-center\"\n >\n {merged.trailing}\n </span>\n )}\n </div>\n </FormField>,\n );\n};\n\n/**\n * The raw `$control` a field declares, object form or function form.\n *\n * It rides on zod's `.meta()` registry rather than being a plain schema\n * property, and the field may be wrapped (optional / nullable / default), so\n * the wrapper has to be peeled before the meta is readable.\n *\n * Exported because the LAYOUT needs it too: `AutoForm` sizes a grid cell from\n * the width `$control` asks for, and a function-form `$control` has no `.width`\n * to read off the function itself. Pair it with {@link resolveSchemaControl}.\n */\nexport const readSchemaControl = (\n input: BaseInputField | undefined,\n): unknown => {\n const base = input?.schema ? z.schema.unwrap(input.schema) : undefined;\n return (base as { meta?: () => { $control?: unknown } } | undefined)?.meta?.()\n ?.$control;\n};\n\n/**\n * Re-render when a function-form `$control` may have changed its mind, which\n * is on any change to a field OTHER than this one. An object-form `$control`\n * is static and needs no subscription.\n *\n * Exported alongside {@link readSchemaControl}, and for the same reason: a\n * consumer that resolves `$control` itself has to re-resolve on the same\n * events, or it renders a stale answer.\n */\nexport const useDynamicControlRefresh = (input: BaseInputField | undefined) => {\n const alepha = useAlepha();\n const [, bump] = useState(0);\n const isDynamic = typeof readSchemaControl(input) === \"function\";\n useEffect(() => {\n if (!isDynamic || !input?.form) return;\n const formId = input.form.id;\n return alepha.events.on(\"form:changed\", (e) => {\n if (e.id === formId && e.path !== input.path) bump((n) => n + 1);\n });\n }, [alepha, input?.form, input?.path, isDynamic]);\n};\n\nconst resolveIcon = (\n icon: ControlProps[\"icon\"],\n fallback?: string | null,\n): IconComponent | undefined => {\n if (icon === null) return undefined;\n if (typeof icon === \"string\") return iconFor(icon);\n if (icon) return icon;\n return iconFor(fallback);\n};\n\nconst wrapWithSlots = (\n props: ControlProps & Partial<SchemaControl>,\n body: ReactNode,\n): ReactNode => {\n const top = (props.top as ReactNode) ?? null;\n const bottom = (props.bottom as ReactNode) ?? null;\n if (!top && !bottom) return body;\n return (\n <div className=\"flex flex-col gap-1\">\n {top}\n {body}\n {bottom}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsWA,MAAa,WAAW,UAAwB;CAC9C,MAAM,OAAO,aAAa,MAAM,OAAO,CAAC,SAAS,OAAO,CAAC;CACzD,MAAM,kBAAkB,qBAAqB;CAC7C,MAAM,YAAY,mBAAmB,MAAM;CAC3C,MAAM,CAAC,OAAO,YAAY,cAAc,MAAM,KAAK;CAInD,yBAAyB,MAAM,KAAK;CAEpC,IAAI,CAAC,MAAM,OAAO,OAAO,OAAO;CAEhC,MAAM,SAAS,WAAW,MAAM,OAAO;EACrC,OAAO,MAAM;EACb,aAAa,MAAM;EACnB,OAAO,KAAK;CACd,CAAC;CACD,MAAM,OAAO,MAAM,QAAQ;EAAE,GAAG;EAAQ,OAAO,MAAM;CAAM,IAAI;CAG/D,MAAM,WAAW,qBAAqB,KAAK,SAAS;EAClD,MAAM,MAAM,MAAM;EAClB;CACF,CAAC;CAGD,IAAI,aAAa,QAAQ,SAAS,QAAQ,OAAO;CAEjD,MAAM,SAAS;EACb,GAAG;EACH,GAAI;CACN;CAGA,IAAI,OAAO,QAAQ;EACjB,MAAM,SAAS,OAAO;EACtB,OAAO,cACL,QACA,oBAAC,WAAD;GACE,IAAI,KAAK;GACT,OAAO,OAAO,SAAS,KAAK;GAC5B,aAAa,OAAO,eAAe,KAAK;GACxC,OAAO,KAAK;GACZ,UAAU,KAAK;GAEf,UAA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A,MAAM,iBACJ,OACA,SACc;CACd,MAAM,MAAO,MAAM,OAAqB;CACxC,MAAM,SAAU,MAAM,UAAwB;CAC9C,IAAI,CAAC,OAAO,CAAC,QAAQ,OAAO;CAC5B,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACG;GACA;GACA;EACE;;AAET"}
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { type BaseInputField } from "alepha/react/form";
3
+ import type { HTMLAttributes } from "react";
3
4
  import type { DayPickerProps } from "react-day-picker";
4
5
  export interface ControlDateProps {
5
6
  /**
@@ -65,6 +66,16 @@ export interface ControlDateProps {
65
66
  * those wins over what this sets.
66
67
  */
67
68
  birthdate?: boolean;
69
+ /**
70
+ * A month picker: the value is `YYYY-MM`. See `ControlMonthPopover`.
71
+ */
72
+ month?: boolean;
73
+ /**
74
+ * Forwarded to the focusable element (the time input, or the picker's
75
+ * trigger): an `aria-label` for a field drawn without a label, a
76
+ * `data-testid`.
77
+ */
78
+ inputProps?: HTMLAttributes<HTMLElement>;
68
79
  }
69
80
  export declare const ControlDate: (props: ControlDateProps) => React.JSX.Element | null;
70
81
  //# sourceMappingURL=ControlDate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ControlDate.d.ts","sourceRoot":"","sources":["../../src/form/ControlDate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC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,CAAC;IAChD;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,WAAW,UAAW,gBAAgB,6BAiGlD,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { Input } from "../core/Input.js";
2
2
  import { ControlDatePopover } from "./ControlDatePopover.js";
3
+ import { ControlMonthPopover } from "./ControlMonthPopover.js";
3
4
  import { FormField } from "./FormField.js";
4
5
  import { Clock } from "lucide-react";
5
6
  import "react";
@@ -27,17 +28,33 @@ const ControlDate = (props) => {
27
28
  required: meta.required,
28
29
  children: /* @__PURE__ */ jsxs("div", {
29
30
  className: "relative",
30
- children: [/* @__PURE__ */ jsx(Clock, { className: "text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2" }), /* @__PURE__ */ jsx(Input, {
31
+ children: [/* @__PURE__ */ jsx(Clock, { className: "text-muted-foreground absolute start-3 top-1/2 size-4 -translate-y-1/2" }), /* @__PURE__ */ jsx(Input, {
32
+ ...props.inputProps,
31
33
  id: meta.id,
32
34
  name: props.input.props.name,
33
35
  type: "time",
34
- className: "pl-9",
36
+ className: "ps-9",
35
37
  disabled: props.disabled,
36
38
  value: value ?? "",
37
39
  onChange: (e) => setValue(e.target.value)
38
40
  })]
39
41
  })
40
42
  });
43
+ if (props.month) return /* @__PURE__ */ jsx(FormField, {
44
+ id: meta.id,
45
+ label: meta.label,
46
+ description: meta.description,
47
+ error: meta.error,
48
+ required: meta.required,
49
+ children: /* @__PURE__ */ jsx(ControlMonthPopover, {
50
+ id: meta.id,
51
+ value,
52
+ disabled: props.disabled,
53
+ clearable: props.clearable,
54
+ triggerProps: props.inputProps,
55
+ onChange: (v) => setValue(v)
56
+ })
57
+ });
41
58
  const thisYear = dateTime.now().toDate().getFullYear();
42
59
  return /* @__PURE__ */ jsx(FormField, {
43
60
  id: meta.id,
@@ -47,6 +64,7 @@ const ControlDate = (props) => {
47
64
  required: meta.required,
48
65
  children: /* @__PURE__ */ jsx(ControlDatePopover, {
49
66
  id: meta.id,
67
+ triggerProps: props.inputProps,
50
68
  value,
51
69
  withTime: isDateTime,
52
70
  disabled: props.disabled,
@@ -1 +1 @@
1
- {"version":3,"file":"ControlDate.js","names":[],"sources":["../../src/form/ControlDate.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useInject } from \"alepha/react\";\nimport {\n type BaseInputField,\n parseField,\n useFieldValue,\n useFormState,\n} from \"alepha/react/form\";\nimport { Clock } from \"lucide-react\";\nimport type { DayPickerProps } from \"react-day-picker\";\n\nimport { Input } from \"../core/Input.tsx\";\nimport { ControlDatePopover } from \"./ControlDatePopover.tsx\";\nimport { FormField } from \"./FormField.tsx\";\n\nexport interface ControlDateProps {\n /**\n * Bound `InputField` from `useForm`. Stores an ISO string.\n */\n input: BaseInputField;\n /**\n * Field label. Falls back to schema `title`.\n */\n label?: string;\n /**\n * Helper text shown below the picker.\n */\n description?: string;\n /**\n * Force date-only mode regardless of schema format.\n */\n date?: boolean;\n /**\n * Force date-time mode regardless of schema format.\n */\n datetime?: boolean;\n /**\n * Force time-only mode regardless of schema format.\n */\n time?: boolean;\n /**\n * Disable the picker.\n */\n disabled?: boolean;\n /**\n * Offer a way back to empty once a date is picked.\n *\n * A calendar has no \"none\" cell, so without this an optional date field is\n * one-way: pick a day and there is no gesture that unsets it. Every other\n * control in the kit spells this `clearable`, so this one does too - and\n * draws it the same way, as the kit's `x` on the trigger.\n */\n clearable?: boolean;\n /**\n * Caption style. `\"label\"` (the default) shows the month name with\n * previous/next arrows; `\"dropdown\"` swaps both for month and year selects.\n *\n * Arrows are fine for a date near today and hopeless for one that is not:\n * reaching a 1988 birthday costs about 450 clicks on `<`. Pair `\"dropdown\"`\n * with {@link startMonth} / {@link endMonth}, or use {@link birthdate},\n * which sets both.\n */\n captionLayout?: DayPickerProps[\"captionLayout\"];\n /**\n * First selectable month. Also bounds the year dropdown, which otherwise\n * offers a narrow range around today.\n */\n startMonth?: Date;\n /** Last selectable month. */\n endMonth?: Date;\n /**\n * Shorthand for a date of birth: a year dropdown covering the last\n * {@link BIRTHDATE_YEARS} years, ending this year.\n *\n * Sugar over `captionLayout` + `startMonth` / `endMonth`, which stay\n * available for any other historical field. An explicit value for one of\n * those wins over what this sets.\n */\n birthdate?: boolean;\n}\n\nexport const ControlDate = (props: ControlDateProps) => {\n const form = useFormState(props.input, [\"error\"]);\n const [value, setValue] = useFieldValue(props.input);\n const dateTime = useInject(DateTimeProvider);\n\n if (!props.input?.props) return null;\n\n const meta = parseField(props.input, {\n label: props.label,\n description: props.description,\n error: form.error,\n });\n\n const isDateTime = props.datetime || meta.format === \"date-time\";\n const isTime = props.time || meta.format === \"time\";\n\n if (isTime) {\n return (\n <FormField\n id={meta.id}\n label={meta.label}\n description={meta.description}\n error={meta.error}\n required={meta.required}\n >\n <div className=\"relative\">\n <Clock className=\"text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2\" />\n <Input\n id={meta.id}\n name={props.input.props.name}\n type=\"time\"\n className=\"pl-9\"\n disabled={props.disabled}\n value={value ?? \"\"}\n onChange={(e) => setValue(e.target.value)}\n />\n </div>\n </FormField>\n );\n }\n\n const thisYear = dateTime.now().toDate().getFullYear();\n\n return (\n <FormField\n id={meta.id}\n label={meta.label}\n description={meta.description}\n error={meta.error}\n required={meta.required}\n >\n <ControlDatePopover\n id={meta.id}\n value={value}\n withTime={isDateTime}\n disabled={props.disabled}\n clearable={props.clearable}\n captionLayout={\n props.captionLayout ?? (props.birthdate ? \"dropdown\" : undefined)\n }\n startMonth={\n props.startMonth ??\n (props.birthdate\n ? new Date(thisYear - BIRTHDATE_YEARS, 0, 1)\n : undefined)\n }\n endMonth={\n props.endMonth ??\n (props.birthdate ? new Date(thisYear, 11, 31) : undefined)\n }\n onChange={(v) => setValue(v)}\n />\n </FormField>\n );\n};\n\n/** How many years back a `birthdate` picker offers. Covers every living\n * person; the oldest verified human reached 122. */\nconst BIRTHDATE_YEARS = 120;\n"],"mappings":";;;;;;;;;;AAqFA,MAAa,eAAe,UAA4B;CACtD,MAAM,OAAO,aAAa,MAAM,OAAO,CAAC,OAAO,CAAC;CAChD,MAAM,CAAC,OAAO,YAAY,cAAc,MAAM,KAAK;CACnD,MAAM,WAAW,UAAU,gBAAgB;CAE3C,IAAI,CAAC,MAAM,OAAO,OAAO,OAAO;CAEhC,MAAM,OAAO,WAAW,MAAM,OAAO;EACnC,OAAO,MAAM;EACb,aAAa,MAAM;EACnB,OAAO,KAAK;CACd,CAAC;CAED,MAAM,aAAa,MAAM,YAAY,KAAK,WAAW;CAGrD,IAFe,MAAM,QAAQ,KAAK,WAAW,QAG3C,OACE,oBAAC,WAAD;EACE,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,OAAO,KAAK;EACZ,UAAU,KAAK;EAEf,UAAA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,OAAD,EAAO,WAAU,wEAAyE,CAAA,GAC1F,oBAAC,OAAD;IACE,IAAI,KAAK;IACT,MAAM,MAAM,MAAM,MAAM;IACxB,MAAK;IACL,WAAU;IACV,UAAU,MAAM;IAChB,OAAO,SAAS;IAChB,WAAW,MAAM,SAAS,EAAE,OAAO,KAAK;GACzC,CAAA,CACE;;CACI,CAAA;CAIf,MAAM,WAAW,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;CAErD,OACE,oBAAC,WAAD;EACE,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,OAAO,KAAK;EACZ,UAAU,KAAK;EAEf,UAAA,oBAAC,oBAAD;GACE,IAAI,KAAK;GACF;GACP,UAAU;GACV,UAAU,MAAM;GAChB,WAAW,MAAM;GACjB,eACE,MAAM,kBAAkB,MAAM,YAAY,aAAa,KAAA;GAEzD,YACE,MAAM,eACL,MAAM,YACH,IAAI,KAAK,WAAW,iBAAiB,GAAG,CAAC,IACzC,KAAA;GAEN,UACE,MAAM,aACL,MAAM,YAAY,IAAI,KAAK,UAAU,IAAI,EAAE,IAAI,KAAA;GAElD,WAAW,MAAM,SAAS,CAAC;EAC5B,CAAA;CACQ,CAAA;AAEf;;;AAIA,MAAM,kBAAkB"}
1
+ {"version":3,"file":"ControlDate.js","names":[],"sources":["../../src/form/ControlDate.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useInject } from \"alepha/react\";\nimport {\n type BaseInputField,\n parseField,\n useFieldValue,\n useFormState,\n} from \"alepha/react/form\";\nimport { Clock } from \"lucide-react\";\nimport type { HTMLAttributes } from \"react\";\nimport type { DayPickerProps } from \"react-day-picker\";\n\nimport { Input } from \"../core/Input.tsx\";\nimport { ControlDatePopover } from \"./ControlDatePopover.tsx\";\nimport { ControlMonthPopover } from \"./ControlMonthPopover.tsx\";\nimport { FormField } from \"./FormField.tsx\";\n\nexport interface ControlDateProps {\n /**\n * Bound `InputField` from `useForm`. Stores an ISO string.\n */\n input: BaseInputField;\n /**\n * Field label. Falls back to schema `title`.\n */\n label?: string;\n /**\n * Helper text shown below the picker.\n */\n description?: string;\n /**\n * Force date-only mode regardless of schema format.\n */\n date?: boolean;\n /**\n * Force date-time mode regardless of schema format.\n */\n datetime?: boolean;\n /**\n * Force time-only mode regardless of schema format.\n */\n time?: boolean;\n /**\n * Disable the picker.\n */\n disabled?: boolean;\n /**\n * Offer a way back to empty once a date is picked.\n *\n * A calendar has no \"none\" cell, so without this an optional date field is\n * one-way: pick a day and there is no gesture that unsets it. Every other\n * control in the kit spells this `clearable`, so this one does too - and\n * draws it the same way, as the kit's `x` on the trigger.\n */\n clearable?: boolean;\n /**\n * Caption style. `\"label\"` (the default) shows the month name with\n * previous/next arrows; `\"dropdown\"` swaps both for month and year selects.\n *\n * Arrows are fine for a date near today and hopeless for one that is not:\n * reaching a 1988 birthday costs about 450 clicks on `<`. Pair `\"dropdown\"`\n * with {@link startMonth} / {@link endMonth}, or use {@link birthdate},\n * which sets both.\n */\n captionLayout?: DayPickerProps[\"captionLayout\"];\n /**\n * First selectable month. Also bounds the year dropdown, which otherwise\n * offers a narrow range around today.\n */\n startMonth?: Date;\n /** Last selectable month. */\n endMonth?: Date;\n /**\n * Shorthand for a date of birth: a year dropdown covering the last\n * {@link BIRTHDATE_YEARS} years, ending this year.\n *\n * Sugar over `captionLayout` + `startMonth` / `endMonth`, which stay\n * available for any other historical field. An explicit value for one of\n * those wins over what this sets.\n */\n birthdate?: boolean;\n /**\n * A month picker: the value is `YYYY-MM`. See `ControlMonthPopover`.\n */\n month?: boolean;\n /**\n * Forwarded to the focusable element (the time input, or the picker's\n * trigger): an `aria-label` for a field drawn without a label, a\n * `data-testid`.\n */\n inputProps?: HTMLAttributes<HTMLElement>;\n}\n\nexport const ControlDate = (props: ControlDateProps) => {\n const form = useFormState(props.input, [\"error\"]);\n const [value, setValue] = useFieldValue(props.input);\n const dateTime = useInject(DateTimeProvider);\n\n if (!props.input?.props) return null;\n\n const meta = parseField(props.input, {\n label: props.label,\n description: props.description,\n error: form.error,\n });\n\n const isDateTime = props.datetime || meta.format === \"date-time\";\n const isTime = props.time || meta.format === \"time\";\n\n if (isTime) {\n return (\n <FormField\n id={meta.id}\n label={meta.label}\n description={meta.description}\n error={meta.error}\n required={meta.required}\n >\n <div className=\"relative\">\n <Clock className=\"text-muted-foreground absolute start-3 top-1/2 size-4 -translate-y-1/2\" />\n <Input\n {...props.inputProps}\n id={meta.id}\n name={props.input.props.name}\n type=\"time\"\n className=\"ps-9\"\n disabled={props.disabled}\n value={value ?? \"\"}\n onChange={(e) => setValue(e.target.value)}\n />\n </div>\n </FormField>\n );\n }\n\n if (props.month) {\n return (\n <FormField\n id={meta.id}\n label={meta.label}\n description={meta.description}\n error={meta.error}\n required={meta.required}\n >\n <ControlMonthPopover\n id={meta.id}\n value={value}\n disabled={props.disabled}\n clearable={props.clearable}\n triggerProps={props.inputProps}\n onChange={(v) => setValue(v)}\n />\n </FormField>\n );\n }\n\n const thisYear = dateTime.now().toDate().getFullYear();\n\n return (\n <FormField\n id={meta.id}\n label={meta.label}\n description={meta.description}\n error={meta.error}\n required={meta.required}\n >\n <ControlDatePopover\n id={meta.id}\n triggerProps={props.inputProps}\n value={value}\n withTime={isDateTime}\n disabled={props.disabled}\n clearable={props.clearable}\n captionLayout={\n props.captionLayout ?? (props.birthdate ? \"dropdown\" : undefined)\n }\n startMonth={\n props.startMonth ??\n (props.birthdate\n ? new Date(thisYear - BIRTHDATE_YEARS, 0, 1)\n : undefined)\n }\n endMonth={\n props.endMonth ??\n (props.birthdate ? new Date(thisYear, 11, 31) : undefined)\n }\n onChange={(v) => setValue(v)}\n />\n </FormField>\n );\n};\n\n/** How many years back a `birthdate` picker offers. Covers every living\n * person; the oldest verified human reached 122. */\nconst BIRTHDATE_YEARS = 120;\n"],"mappings":";;;;;;;;;;;AAiGA,MAAa,eAAe,UAA4B;CACtD,MAAM,OAAO,aAAa,MAAM,OAAO,CAAC,OAAO,CAAC;CAChD,MAAM,CAAC,OAAO,YAAY,cAAc,MAAM,KAAK;CACnD,MAAM,WAAW,UAAU,gBAAgB;CAE3C,IAAI,CAAC,MAAM,OAAO,OAAO,OAAO;CAEhC,MAAM,OAAO,WAAW,MAAM,OAAO;EACnC,OAAO,MAAM;EACb,aAAa,MAAM;EACnB,OAAO,KAAK;CACd,CAAC;CAED,MAAM,aAAa,MAAM,YAAY,KAAK,WAAW;CAGrD,IAFe,MAAM,QAAQ,KAAK,WAAW,QAG3C,OACE,oBAAC,WAAD;EACE,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,aAAa,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 @@
1
1
  import * as React from "react";
2
+ import { type HTMLAttributes } from "react";
2
3
  import type { DayPickerProps } from "react-day-picker";
3
4
  export interface ControlDatePopoverProps {
4
5
  id?: string;
@@ -9,6 +10,8 @@ export interface ControlDatePopoverProps {
9
10
  captionLayout?: DayPickerProps["captionLayout"];
10
11
  startMonth?: Date;
11
12
  endMonth?: Date;
13
+ /** Forwarded to the trigger: an `aria-label`, a `data-testid`. */
14
+ triggerProps?: HTMLAttributes<HTMLElement>;
12
15
  onChange: (value: string | undefined) => void;
13
16
  }
14
17
  export declare const ControlDatePopover: (props: ControlDatePopoverProps) => React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"ControlDatePopover.d.ts","sourceRoot":"","sources":["../../src/form/ControlDatePopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcvD,MAAM,WAAW,uBAAuB;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAChD,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC/C;AAED,eAAO,MAAM,kBAAkB,UAAW,uBAAuB,sBA4JhE,CAAC"}
1
+ {"version":3,"file":"ControlDatePopover.d.ts","sourceRoot":"","sources":["../../src/form/ControlDatePopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcvD,MAAM,WAAW,uBAAuB;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAChD,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,kEAAkE;IAClE,YAAY,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC/C;AAED,eAAO,MAAM,kBAAkB,UAAW,uBAAuB,sBA6JhE,CAAC"}
@@ -47,6 +47,7 @@ const ControlDatePopover = (props) => {
47
47
  children: [/* @__PURE__ */ jsxs("div", {
48
48
  className: TRIGGER_WRAPPER_CLASSES,
49
49
  children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
50
+ ...props.triggerProps,
50
51
  id: props.id,
51
52
  "data-slot": "date-trigger",
52
53
  disabled: props.disabled,
@@ -1 +1 @@
1
- {"version":3,"file":"ControlDatePopover.js","names":["CalendarIcon","ChevronDownIcon"],"sources":["../../src/form/ControlDatePopover.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useI18n } from \"alepha/react/i18n\";\nimport {\n Calendar as CalendarIcon,\n ChevronDown as ChevronDownIcon,\n} from \"lucide-react\";\nimport { useState } from \"react\";\nimport type { DayPickerProps } from \"react-day-picker\";\n\nimport { LazyCalendar, preloadCalendar } from \"../calendar/LazyCalendar.tsx\";\nimport { Input } from \"../core/Input.tsx\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../core/Popover.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { DATE_ONLY, formatDateOnly, parseDateOnly } from \"./dateOnly.ts\";\nimport {\n ControlClearButton,\n TRIGGER_CLASSES,\n TRIGGER_SIZES,\n TRIGGER_WRAPPER_CLASSES,\n} from \"./fieldTrigger.tsx\";\n\nexport interface ControlDatePopoverProps {\n id?: string;\n value?: string;\n withTime: boolean;\n disabled?: boolean;\n clearable?: boolean;\n captionLayout?: DayPickerProps[\"captionLayout\"];\n startMonth?: Date;\n endMonth?: Date;\n onChange: (value: string | undefined) => void;\n}\n\nexport const ControlDatePopover = (props: ControlDatePopoverProps) => {\n const { tr, l } = useI18n();\n const [open, setOpen] = useState(false);\n const date = props.value\n ? !props.withTime && DATE_ONLY.test(props.value)\n ? parseDateOnly(props.value)\n : new Date(props.value)\n : undefined;\n\n // In the page's language, never the browser's. `toLocaleString()` with no\n // locale followed the browser, so an English browser on a French page\n // printed 9/10/2026 for the 10th of September, and the server, which has no\n // browser, rendered yet another shape before hydration (#Q2392). The\n // runtime's time zone is unchanged: `Intl` still formats in it.\n const formatted = date\n ? props.withTime\n ? l(date, {\n date: {\n year: \"numeric\",\n month: \"numeric\",\n day: \"numeric\",\n hour: \"numeric\",\n minute: \"2-digit\",\n },\n })\n : l(date)\n : \"\";\n\n const handleDate = (d: Date | undefined) => {\n if (!d) {\n props.onChange(undefined);\n return;\n }\n if (props.withTime) {\n props.onChange(d.toISOString());\n } else {\n props.onChange(formatDateOnly(d));\n setOpen(false);\n }\n };\n\n const handleTime = (timeStr: string) => {\n if (!date) return;\n const [h, m] = timeStr.split(\":\").map(Number);\n const next = new Date(date);\n next.setHours(h ?? 0, m ?? 0, 0, 0);\n props.onChange(next.toISOString());\n };\n\n const timeValue =\n date && props.withTime\n ? `${String(date.getHours()).padStart(2, \"0\")}:${String(date.getMinutes()).padStart(2, \"0\")}`\n : \"\";\n\n const showClear = Boolean(props.clearable && date && !props.disabled);\n const size = TRIGGER_SIZES.default;\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n {/* The kit's field trigger, and the kit's clear button positioned on it\n - `control-base/field-trigger`, the same two a select draws. The\n clear sits BESIDE the trigger rather than inside it: a button nested\n in a button is invalid, and Base UI's popover trigger would swallow\n its click anyway. */}\n <div className={TRIGGER_WRAPPER_CLASSES}>\n <PopoverTrigger\n id={props.id}\n // A FIELD trigger, not a button, and the distinction is load\n // bearing: `styles.css` gives the `--border-hover` border to a\n // list of `data-slot`s, and this one was not on it, so the date\n // control was the only field in the kit that did not darken its\n // border under the pointer.\n //\n // ⚠️ It used to render `Button variant=\"outline\"` and then undo\n // the button-ness of it in four overrides - the border token, the\n // hover fill, the open-state fill, the placeholder colour - which\n // is a fair description of why it still did not look like the\n // selects beside it (feedback #2197). The shared trigger is a\n // field to begin with, so there is nothing left to undo.\n data-slot=\"date-trigger\"\n disabled={props.disabled}\n // The calendar is a chunk of its own (`LazyCalendar`). Asking for it\n // as the pointer arrives or focus lands means the click that opens\n // the popover usually finds it already downloaded.\n onPointerEnter={preloadCalendar}\n onFocus={preloadCalendar}\n className={cn(\n TRIGGER_CLASSES,\n size.trigger,\n size.chevron,\n // Muted means \"nothing picked yet\", exactly as on a select. With\n // a value the text is already `foreground`, so this only matters\n // while empty.\n !date && \"text-muted-foreground\",\n )}\n >\n {/* The room for the clear button - see `clearGap` in TRIGGER_SIZES\n for why it is a margin here and not padding on the trigger, and\n `ControlSelectCombobox` for `trigger-label`. */}\n <span\n data-slot=\"trigger-label\"\n className={cn(\n \"flex min-w-0 items-center gap-2\",\n showClear && size.clearGap,\n )}\n >\n {/*\n Muted whatever the field holds, matching `InputGroupAddon`, which\n paints every other leading icon in the kit `text-muted-foreground`\n on the container.\n\n Without the class this icon simply inherits the trigger's `color`,\n which the control swaps between muted and foreground to grey the\n PLACEHOLDER - so the icon brightened when a date was picked. That\n looked deliberate and was not: an icon says what kind of field this\n is, which does not change when you fill it, and the text beside it\n already carries filled-versus-empty.\n */}\n <CalendarIcon\n className={cn(\"text-muted-foreground shrink-0\", size.icon)}\n />\n <span className=\"truncate\">\n {formatted ||\n tr(\"controlDate.placeholder\", { default: \"Pick a date\" })}\n </span>\n </span>\n {/* Same trailing caret a select trigger carries, for the same\n reason: this opens a popover, and without it the control reads\n as a text field that happens to have a calendar glyph. */}\n <ChevronDownIcon className=\"text-muted-foreground pointer-events-none size-4 shrink-0\" />\n </PopoverTrigger>\n {showClear && (\n <ControlClearButton onClick={() => props.onChange(undefined)} />\n )}\n </div>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <LazyCalendar\n mode=\"single\"\n selected={date}\n onSelect={handleDate}\n captionLayout={props.captionLayout}\n startMonth={props.startMonth}\n endMonth={props.endMonth}\n />\n {props.withTime && (\n <div className=\"border-t p-3\">\n <Input\n type=\"time\"\n value={timeValue}\n onChange={(e) => handleTime(e.target.value)}\n />\n </div>\n )}\n </PopoverContent>\n </Popover>\n );\n};\n"],"mappings":";;;;;;;;;;;AAoCA,MAAa,sBAAsB,UAAmC;CACpE,MAAM,EAAE,IAAI,MAAM,QAAQ;CAC1B,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,OAAO,MAAM,QACf,CAAC,MAAM,YAAY,UAAU,KAAK,MAAM,KAAK,IAC3C,cAAc,MAAM,KAAK,IACzB,IAAI,KAAK,MAAM,KAAK,IACtB,KAAA;CAOJ,MAAM,YAAY,OACd,MAAM,WACJ,EAAE,MAAM,EACN,MAAM;EACJ,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;CACV,EACF,CAAC,IACD,EAAE,IAAI,IACR;CAEJ,MAAM,cAAc,MAAwB;EAC1C,IAAI,CAAC,GAAG;GACN,MAAM,SAAS,KAAA,CAAS;GACxB;EACF;EACA,IAAI,MAAM,UACR,MAAM,SAAS,EAAE,YAAY,CAAC;OACzB;GACL,MAAM,SAAS,eAAe,CAAC,CAAC;GAChC,QAAQ,KAAK;EACf;CACF;CAEA,MAAM,cAAc,YAAoB;EACtC,IAAI,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oBAAC,cAAD;IACE,MAAK;IACL,UAAU;IACV,UAAU;IACV,eAAe,MAAM;IACrB,YAAY,MAAM;IAClB,UAAU,MAAM;GACjB,CAAA,GACA,MAAM,YACL,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,oBAAC,OAAD;KACE,MAAK;KACL,OAAO;KACP,WAAW,MAAM,WAAW,EAAE,OAAO,KAAK;IAC3C,CAAA;GACE,CAAA,CAEO;EACT,CAAA,CAAA;;AAEb"}
1
+ {"version":3,"file":"ControlDatePopover.js","names":["CalendarIcon","ChevronDownIcon"],"sources":["../../src/form/ControlDatePopover.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useI18n } from \"alepha/react/i18n\";\nimport {\n Calendar as CalendarIcon,\n ChevronDown as ChevronDownIcon,\n} from \"lucide-react\";\nimport { type HTMLAttributes, useState } from \"react\";\nimport type { DayPickerProps } from \"react-day-picker\";\n\nimport { LazyCalendar, preloadCalendar } from \"../calendar/LazyCalendar.tsx\";\nimport { Input } from \"../core/Input.tsx\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../core/Popover.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { DATE_ONLY, formatDateOnly, parseDateOnly } from \"./dateOnly.ts\";\nimport {\n ControlClearButton,\n TRIGGER_CLASSES,\n TRIGGER_SIZES,\n TRIGGER_WRAPPER_CLASSES,\n} from \"./fieldTrigger.tsx\";\n\nexport interface ControlDatePopoverProps {\n id?: string;\n value?: string;\n withTime: boolean;\n disabled?: boolean;\n clearable?: boolean;\n captionLayout?: DayPickerProps[\"captionLayout\"];\n startMonth?: Date;\n endMonth?: Date;\n /** Forwarded to the trigger: an `aria-label`, a `data-testid`. */\n triggerProps?: HTMLAttributes<HTMLElement>;\n onChange: (value: string | undefined) => void;\n}\n\nexport const ControlDatePopover = (props: ControlDatePopoverProps) => {\n const { tr, l } = useI18n();\n const [open, setOpen] = useState(false);\n const date = props.value\n ? !props.withTime && DATE_ONLY.test(props.value)\n ? parseDateOnly(props.value)\n : new Date(props.value)\n : undefined;\n\n // In the page's language, never the browser's. `toLocaleString()` with no\n // locale followed the browser, so an English browser on a French page\n // printed 9/10/2026 for the 10th of September, and the server, which has no\n // browser, rendered yet another shape before hydration (#Q2392). The\n // runtime's time zone is unchanged: `Intl` still formats in it.\n const formatted = date\n ? props.withTime\n ? l(date, {\n date: {\n year: \"numeric\",\n month: \"numeric\",\n day: \"numeric\",\n hour: \"numeric\",\n minute: \"2-digit\",\n },\n })\n : l(date)\n : \"\";\n\n const handleDate = (d: Date | undefined) => {\n if (!d) {\n props.onChange(undefined);\n return;\n }\n if (props.withTime) {\n props.onChange(d.toISOString());\n } else {\n props.onChange(formatDateOnly(d));\n setOpen(false);\n }\n };\n\n const handleTime = (timeStr: string) => {\n if (!date) return;\n const [h, m] = timeStr.split(\":\").map(Number);\n const next = new Date(date);\n next.setHours(h ?? 0, m ?? 0, 0, 0);\n props.onChange(next.toISOString());\n };\n\n const timeValue =\n date && props.withTime\n ? `${String(date.getHours()).padStart(2, \"0\")}:${String(date.getMinutes()).padStart(2, \"0\")}`\n : \"\";\n\n const showClear = Boolean(props.clearable && date && !props.disabled);\n const size = TRIGGER_SIZES.default;\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n {/* The kit's field trigger, and the kit's clear button positioned on it\n - `control-base/field-trigger`, the same two a select draws. The\n clear sits BESIDE the trigger rather than inside it: a button nested\n in a button is invalid, and Base UI's popover trigger would swallow\n its click anyway. */}\n <div className={TRIGGER_WRAPPER_CLASSES}>\n <PopoverTrigger\n {...props.triggerProps}\n id={props.id}\n // A FIELD trigger, not a button, and the distinction is load\n // bearing: `styles.css` gives the `--border-hover` border to a\n // list of `data-slot`s, and this one was not on it, so the date\n // control was the only field in the kit that did not darken its\n // border under the pointer.\n //\n // ⚠️ It used to render `Button variant=\"outline\"` and then undo\n // the button-ness of it in four overrides - the border token, the\n // hover fill, the open-state fill, the placeholder colour - which\n // is a fair description of why it still did not look like the\n // selects beside it (feedback #2197). The shared trigger is a\n // field to begin with, so there is nothing left to undo.\n data-slot=\"date-trigger\"\n disabled={props.disabled}\n // The calendar is a chunk of its own (`LazyCalendar`). Asking for it\n // as the pointer arrives or focus lands means the click that opens\n // the popover usually finds it already downloaded.\n onPointerEnter={preloadCalendar}\n onFocus={preloadCalendar}\n className={cn(\n TRIGGER_CLASSES,\n size.trigger,\n size.chevron,\n // Muted means \"nothing picked yet\", exactly as on a select. With\n // a value the text is already `foreground`, so this only matters\n // while empty.\n !date && \"text-muted-foreground\",\n )}\n >\n {/* The room for the clear button - see `clearGap` in TRIGGER_SIZES\n for why it is a margin here and not padding on the trigger, and\n `ControlSelectCombobox` for `trigger-label`. */}\n <span\n data-slot=\"trigger-label\"\n className={cn(\n \"flex min-w-0 items-center gap-2\",\n showClear && size.clearGap,\n )}\n >\n {/*\n Muted whatever the field holds, matching `InputGroupAddon`, which\n paints every other leading icon in the kit `text-muted-foreground`\n on the container.\n\n Without the class this icon simply inherits the trigger's `color`,\n which the control swaps between muted and foreground to grey the\n PLACEHOLDER - so the icon brightened when a date was picked. That\n looked deliberate and was not: an icon says what kind of field this\n is, which does not change when you fill it, and the text beside it\n already carries filled-versus-empty.\n */}\n <CalendarIcon\n className={cn(\"text-muted-foreground shrink-0\", size.icon)}\n />\n <span className=\"truncate\">\n {formatted ||\n tr(\"controlDate.placeholder\", { default: \"Pick a date\" })}\n </span>\n </span>\n {/* Same trailing caret a select trigger carries, for the same\n reason: this opens a popover, and without it the control reads\n as a text field that happens to have a calendar glyph. */}\n <ChevronDownIcon className=\"text-muted-foreground pointer-events-none size-4 shrink-0\" />\n </PopoverTrigger>\n {showClear && (\n <ControlClearButton onClick={() => props.onChange(undefined)} />\n )}\n </div>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <LazyCalendar\n mode=\"single\"\n selected={date}\n onSelect={handleDate}\n captionLayout={props.captionLayout}\n startMonth={props.startMonth}\n endMonth={props.endMonth}\n />\n {props.withTime && (\n <div className=\"border-t p-3\">\n <Input\n type=\"time\"\n value={timeValue}\n onChange={(e) => handleTime(e.target.value)}\n />\n </div>\n )}\n </PopoverContent>\n </Popover>\n );\n};\n"],"mappings":";;;;;;;;;;;AAsCA,MAAa,sBAAsB,UAAmC;CACpE,MAAM,EAAE,IAAI,MAAM,QAAQ;CAC1B,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,OAAO,MAAM,QACf,CAAC,MAAM,YAAY,UAAU,KAAK,MAAM,KAAK,IAC3C,cAAc,MAAM,KAAK,IACzB,IAAI,KAAK,MAAM,KAAK,IACtB,KAAA;CAOJ,MAAM,YAAY,OACd,MAAM,WACJ,EAAE,MAAM,EACN,MAAM;EACJ,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;CACV,EACF,CAAC,IACD,EAAE,IAAI,IACR;CAEJ,MAAM,cAAc,MAAwB;EAC1C,IAAI,CAAC,GAAG;GACN,MAAM,SAAS,KAAA,CAAS;GACxB;EACF;EACA,IAAI,MAAM,UACR,MAAM,SAAS,EAAE,YAAY,CAAC;OACzB;GACL,MAAM,SAAS,eAAe,CAAC,CAAC;GAChC,QAAQ,KAAK;EACf;CACF;CAEA,MAAM,cAAc,YAAoB;EACtC,IAAI,CAAC,MAAM;EACX,MAAM,CAAC,GAAG,KAAK,QAAQ,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;EAC5C,MAAM,OAAO,IAAI,KAAK,IAAI;EAC1B,KAAK,SAAS,KAAK,GAAG,KAAK,GAAG,GAAG,CAAC;EAClC,MAAM,SAAS,KAAK,YAAY,CAAC;CACnC;CAEA,MAAM,YACJ,QAAQ,MAAM,WACV,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,MACxF;CAEN,MAAM,YAAY,QAAQ,MAAM,aAAa,QAAQ,CAAC,MAAM,QAAQ;CACpE,MAAM,OAAO,cAAc;CAE3B,OACE,qBAAC,SAAD;EAAe;EAAM,cAAc;EAAnC,UAAA,CAME,qBAAC,OAAD;GAAK,WAAW;GAAhB,UAAA,CACE,qBAAC,gBAAD;IACE,GAAI,MAAM;IACV,IAAI,MAAM;IAaV,aAAU;IACV,UAAU,MAAM;IAIhB,gBAAgB;IAChB,SAAS;IACT,WAAW,GACT,iBACA,KAAK,SACL,KAAK,SAIL,CAAC,QAAQ,uBACX;IA9BF,UAAA,CAmCE,qBAAC,QAAD;KACE,aAAU;KACV,WAAW,GACT,mCACA,aAAa,KAAK,QACpB;KALF,UAAA,CAmBE,oBAACA,UAAD,EACE,WAAW,GAAG,kCAAkC,KAAK,IAAI,EAC1D,CAAA,GACD,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,aACC,GAAG,2BAA2B,EAAE,SAAS,cAAc,CAAC;KACtD,CAAA,CACF;IAIN,CAAA,GAAA,oBAACC,aAAD,EAAiB,WAAU,4DAA6D,CAAA,CAC1E;GACf,CAAA,GAAA,aACC,oBAAC,oBAAD,EAAoB,eAAe,MAAM,SAAS,KAAA,CAAS,EAAI,CAAA,CAE9D;EACL,CAAA,GAAA,qBAAC,gBAAD;GAAgB,WAAU;GAAa,OAAM;GAA7C,UAAA,CACE,oBAAC,cAAD;IACE,MAAK;IACL,UAAU;IACV,UAAU;IACV,eAAe,MAAM;IACrB,YAAY,MAAM;IAClB,UAAU,MAAM;GACjB,CAAA,GACA,MAAM,YACL,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,oBAAC,OAAD;KACE,MAAK;KACL,OAAO;KACP,WAAW,MAAM,WAAW,EAAE,OAAO,KAAK;IAC3C,CAAA;GACE,CAAA,CAEO;EACT,CAAA,CAAA;;AAEb"}
@@ -0,0 +1,25 @@
1
+ import * as React from "react";
2
+ import { type HTMLAttributes } from "react";
3
+ export interface ControlMonthPopoverProps {
4
+ id?: string;
5
+ value?: string;
6
+ disabled?: boolean;
7
+ clearable?: boolean;
8
+ /** First selectable month, `YYYY-MM`. */
9
+ min?: string;
10
+ /** Last selectable month, `YYYY-MM`. */
11
+ max?: string;
12
+ /** Forwarded to the trigger: an `aria-label`, a `data-testid`. */
13
+ triggerProps?: HTMLAttributes<HTMLElement>;
14
+ onChange: (value: string | undefined) => void;
15
+ }
16
+ /**
17
+ * The month picker: the kit's field trigger, then a year with its twelve
18
+ * months. For a period that is a whole month (a report, an invoice), where a
19
+ * day picker would ask for a day nobody means.
20
+ *
21
+ * The value is `YYYY-MM`, so a schema reads it as a plain string and a
22
+ * server parses it without a time zone.
23
+ */
24
+ export declare const ControlMonthPopover: (props: ControlMonthPopoverProps) => React.JSX.Element;
25
+ //# sourceMappingURL=ControlMonthPopover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ControlMonthPopover.d.ts","sourceRoot":"","sources":["../../src/form/ControlMonthPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAC;AAiBtD,MAAM,WAAW,wBAAwB;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,YAAY,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,UAAW,wBAAwB,sBAsHlE,CAAC"}