@fuf-stack/uniform 1.30.0 → 2.0.0-next.3

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 (149) hide show
  1. package/README.md +0 -6
  2. package/dist/Checkboxes/index.d.mts +178 -274
  3. package/dist/Checkboxes/index.d.mts.map +1 -1
  4. package/dist/Checkboxes/index.mjs +294 -94
  5. package/dist/Checkboxes/index.mjs.map +1 -1
  6. package/dist/DatePicker/index.d.mts +1963 -148
  7. package/dist/DatePicker/index.d.mts.map +1 -1
  8. package/dist/DatePicker/index.mjs +401 -82
  9. package/dist/DatePicker/index.mjs.map +1 -1
  10. package/dist/FieldArray/index.d.mts +102 -97
  11. package/dist/FieldArray/index.d.mts.map +1 -1
  12. package/dist/FieldArray/index.mjs +340 -195
  13. package/dist/FieldArray/index.mjs.map +1 -1
  14. package/dist/FieldCard/index.d.mts +34 -34
  15. package/dist/FieldCard/index.d.mts.map +1 -1
  16. package/dist/FieldCard/index.mjs +181 -127
  17. package/dist/FieldCard/index.mjs.map +1 -1
  18. package/dist/{FieldCopyTestIdButton-Y9SfvaM9.mjs → FieldCopyTestIdButton-D3_jZYJ1.mjs} +4 -2
  19. package/dist/FieldCopyTestIdButton-D3_jZYJ1.mjs.map +1 -0
  20. package/dist/FieldDescription-X_0s1Lhu.mjs +35 -0
  21. package/dist/FieldDescription-X_0s1Lhu.mjs.map +1 -0
  22. package/dist/FieldLabel-DrNWJIVh.mjs +128 -0
  23. package/dist/FieldLabel-DrNWJIVh.mjs.map +1 -0
  24. package/dist/FieldLayout-DcvQU0zN.mjs +45 -0
  25. package/dist/FieldLayout-DcvQU0zN.mjs.map +1 -0
  26. package/dist/FieldReset/index.d.mts +17 -12
  27. package/dist/FieldReset/index.d.mts.map +1 -1
  28. package/dist/FieldReset/index.mjs +50 -33
  29. package/dist/FieldReset/index.mjs.map +1 -1
  30. package/dist/FieldValidationError-iAayfTEw.mjs +75 -0
  31. package/dist/FieldValidationError-iAayfTEw.mjs.map +1 -0
  32. package/dist/Form/index.d.mts +2 -2
  33. package/dist/Form/index.d.mts.map +1 -1
  34. package/dist/Form/index.mjs +9 -7
  35. package/dist/Form/index.mjs.map +1 -1
  36. package/dist/{FormContext-Dvt3MiKq.d.mts → FormContext-BnNJYZOo.d.mts} +3 -3
  37. package/dist/{FormContext-Dvt3MiKq.d.mts.map → FormContext-BnNJYZOo.d.mts.map} +1 -1
  38. package/dist/{FormContext-B8G_Xxd6.mjs → FormContext-PXkVlBdU.mjs} +6 -2
  39. package/dist/FormContext-PXkVlBdU.mjs.map +1 -0
  40. package/dist/Grid/index.mjs +1 -1
  41. package/dist/{Grid-Us2JFczS.mjs → Grid-DBL29Kwb.mjs} +4 -2
  42. package/dist/Grid-DBL29Kwb.mjs.map +1 -0
  43. package/dist/Input/index.d.mts +734 -47
  44. package/dist/Input/index.d.mts.map +1 -1
  45. package/dist/Input/index.mjs +411 -168
  46. package/dist/Input/index.mjs.map +1 -1
  47. package/dist/RadioBoxes/index.d.mts +300 -98
  48. package/dist/RadioBoxes/index.d.mts.map +1 -1
  49. package/dist/RadioBoxes/index.mjs +156 -119
  50. package/dist/RadioBoxes/index.mjs.map +1 -1
  51. package/dist/RadioTabs/index.d.mts +302 -76
  52. package/dist/RadioTabs/index.d.mts.map +1 -1
  53. package/dist/RadioTabs/index.mjs +274 -87
  54. package/dist/RadioTabs/index.mjs.map +1 -1
  55. package/dist/Radios/index.d.mts +314 -78
  56. package/dist/Radios/index.d.mts.map +1 -1
  57. package/dist/Radios/index.mjs +90 -44
  58. package/dist/Radios/index.mjs.map +1 -1
  59. package/dist/Select/index.d.mts +410 -142
  60. package/dist/Select/index.d.mts.map +1 -1
  61. package/dist/Select/index.mjs +284 -157
  62. package/dist/Select/index.mjs.map +1 -1
  63. package/dist/Slider/index.d.mts +382 -63
  64. package/dist/Slider/index.d.mts.map +1 -1
  65. package/dist/Slider/index.mjs +269 -90
  66. package/dist/Slider/index.mjs.map +1 -1
  67. package/dist/SubmitButton/index.d.mts.map +1 -1
  68. package/dist/SubmitButton/index.mjs +4 -1
  69. package/dist/SubmitButton/index.mjs.map +1 -1
  70. package/dist/Switch/index.d.mts +2 -427
  71. package/dist/Switch/index.mjs +167 -72
  72. package/dist/Switch/index.mjs.map +1 -1
  73. package/dist/Switch-Db2dpGz7.d.mts +648 -0
  74. package/dist/Switch-Db2dpGz7.d.mts.map +1 -0
  75. package/dist/SwitchBox/index.d.mts +191 -91
  76. package/dist/SwitchBox/index.d.mts.map +1 -1
  77. package/dist/SwitchBox/index.mjs +142 -88
  78. package/dist/SwitchBox/index.mjs.map +1 -1
  79. package/dist/TextArea/index.d.mts +347 -29
  80. package/dist/TextArea/index.d.mts.map +1 -1
  81. package/dist/TextArea/index.mjs +195 -47
  82. package/dist/TextArea/index.mjs.map +1 -1
  83. package/dist/Time/index.d.mts +1373 -139
  84. package/dist/Time/index.d.mts.map +1 -1
  85. package/dist/Time/index.mjs +160 -77
  86. package/dist/Time/index.mjs.map +1 -1
  87. package/dist/helpers/index.d.mts +1 -1
  88. package/dist/helpers/index.mjs +1 -1
  89. package/dist/helpers/index.mjs.map +1 -1
  90. package/dist/hooks/useClientValidation/index.mjs +1 -1
  91. package/dist/hooks/useController/index.d.mts +29 -2
  92. package/dist/hooks/useController/index.d.mts.map +1 -0
  93. package/dist/hooks/useController/index.mjs +1 -1
  94. package/dist/hooks/useFormContext/index.d.mts +44 -2
  95. package/dist/hooks/useFormContext/index.d.mts.map +1 -0
  96. package/dist/hooks/useFormContext/index.mjs +1 -1
  97. package/dist/hooks/useInputValueDebounce/index.d.mts +9 -3
  98. package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
  99. package/dist/hooks/useInputValueDebounce/index.mjs +27 -5
  100. package/dist/hooks/useInputValueDebounce/index.mjs.map +1 -1
  101. package/dist/hooks/useInputValueTransform/index.d.mts +1 -2
  102. package/dist/hooks/useInputValueTransform/index.mjs +1 -1
  103. package/dist/hooks/useWatchFormReset/index.mjs +1 -1
  104. package/dist/hooks/useWatchUserChange/index.mjs +1 -1
  105. package/dist/{useInputValueTransform-cevZBrIN.d.mts → index-cevZBrIN.d.mts} +1 -1
  106. package/dist/index-cevZBrIN.d.mts.map +1 -0
  107. package/dist/partials/FieldCopyTestIdButton/index.mjs +1 -1
  108. package/dist/partials/FieldValidationError/index.d.mts +637 -3
  109. package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
  110. package/dist/partials/FieldValidationError/index.mjs +1 -1
  111. package/dist/radioControlVariants-BYRfaD6y.mjs +187 -0
  112. package/dist/radioControlVariants-BYRfaD6y.mjs.map +1 -0
  113. package/dist/switchVariants-D16b2VaT.mjs +67 -0
  114. package/dist/switchVariants-D16b2VaT.mjs.map +1 -0
  115. package/dist/timeVariants-CtXyNKmW.mjs +58 -0
  116. package/dist/timeVariants-CtXyNKmW.mjs.map +1 -0
  117. package/dist/{useController-CJjMqXU5.mjs → useController-JtIeurpw.mjs} +2 -2
  118. package/dist/{useController-CJjMqXU5.mjs.map → useController-JtIeurpw.mjs.map} +1 -1
  119. package/dist/{useFormContext-BEjPBdzb.mjs → useFormContext-piqnN2L-.mjs} +2 -2
  120. package/dist/{useFormContext-BEjPBdzb.mjs.map → useFormContext-piqnN2L-.mjs.map} +1 -1
  121. package/dist/{useInputValueTransform-D44BLp1Z.mjs → useInputValueTransform-CXWWFhy_.mjs} +2 -2
  122. package/dist/{useInputValueTransform-D44BLp1Z.mjs.map → useInputValueTransform-CXWWFhy_.mjs.map} +1 -1
  123. package/package.json +13 -25
  124. package/dist/FieldCopyTestIdButton-Y9SfvaM9.mjs.map +0 -1
  125. package/dist/FieldValidationError-BcUV0r1I.mjs +0 -48
  126. package/dist/FieldValidationError-BcUV0r1I.mjs.map +0 -1
  127. package/dist/FormContext-B8G_Xxd6.mjs.map +0 -1
  128. package/dist/Grid-Us2JFczS.mjs.map +0 -1
  129. package/dist/Switch/index.d.mts.map +0 -1
  130. package/dist/hooks/useInput/index.d.mts +0 -2
  131. package/dist/hooks/useInput/index.mjs +0 -5
  132. package/dist/hooks/useInput/index.mjs.map +0 -1
  133. package/dist/hooks/useUniformField/index.d.mts +0 -2
  134. package/dist/hooks/useUniformField/index.mjs +0 -141
  135. package/dist/hooks/useUniformField/index.mjs.map +0 -1
  136. package/dist/hooks/useUniformFieldArray/index.d.mts +0 -47
  137. package/dist/hooks/useUniformFieldArray/index.d.mts.map +0 -1
  138. package/dist/hooks/useUniformFieldArray/index.mjs +0 -99
  139. package/dist/hooks/useUniformFieldArray/index.mjs.map +0 -1
  140. package/dist/index-CaxrMD1A.d.mts +0 -1
  141. package/dist/index-DsB0_365.d.mts +0 -106
  142. package/dist/index-DsB0_365.d.mts.map +0 -1
  143. package/dist/useController-CdFEp-Wa.d.mts +0 -30
  144. package/dist/useController-CdFEp-Wa.d.mts.map +0 -1
  145. package/dist/useFormContext-BSSUZ0Md.d.mts +0 -45
  146. package/dist/useFormContext-BSSUZ0Md.d.mts.map +0 -1
  147. package/dist/useInput-ClpHDPdr.d.mts +0 -2
  148. package/dist/useInput-NPbS4w_n.mjs +0 -1
  149. package/dist/useInputValueTransform-cevZBrIN.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/DatePicker/DatePicker.tsx"],"mappings":";;qBAiBa,sBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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sToClassNames } from "@fuf-stack/pixel-utils";
3
- import { jsx } from "react/jsx-runtime";
4
- import { DatePicker } from "@heroui/date-picker";
1
+ import { n as useUniformField, t as FieldLabel } from "../FieldLabel-DrNWJIVh.mjs";
2
+ import { n as getFieldControlProps, t as FieldDescription } from "../FieldDescription-X_0s1Lhu.mjs";
3
+ import { t as segmentedInputVariants } from "../timeVariants-CtXyNKmW.mjs";
4
+ import { useWatchFormReset } from "../hooks/useWatchFormReset/index.mjs";
5
+ import { useContext } from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { tv } from "@fuf-stack/pixel-utils";
8
+ import { useStyling } from "@fuf-stack/pixels/StylingProvider";
9
+ import { Button, Calendar, CalendarCell, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, DateField, DateFieldStateContext, DateInput, DatePicker, DateSegment, Dialog, Group, Heading, Label, Popover, TimeField } from "react-aria-components";
5
10
  import { getLocalTimeZone, now, parseAbsolute, parseAbsoluteToLocal, parseDate, parseDateTime, parseZonedDateTime } from "@internationalized/date";
6
11
  // src/DatePicker/dateHelpers.ts
7
12
  /** Cast unknown input to the DatePicker value union type. */
@@ -30,7 +35,7 @@ const tryParse = (parser) => {
30
35
  }
31
36
  };
32
37
  /**
33
- * Parse a form value into a HeroUI DatePicker compatible `DateValue`.
38
+ * Parse a form value into a segmented date control’s `DateValue`
34
39
  *
35
40
  * Accepts existing `DateValue` objects, native `Date` instances, and ISO-like
36
41
  * strings (date, date-time, zoned, and absolute). Returns `null` when the value
@@ -93,105 +98,419 @@ const dateValueToUtcIsoString = (value, timeZone) => {
93
98
  if (typeof maybeWithToDate.toDate === "function") return maybeWithToDate.toDate(timeZone).toISOString();
94
99
  return null;
95
100
  };
96
- // src/DatePicker/DatePicker.tsx
101
+ /** Converts edited dates to the configured form storage format */
102
+ const createDatePickerValueTransform = ({ timeZone, valueType, withTime }) => {
103
+ const resolvedTimeZone = resolveDatePickerTimeZone(withTime ?? false, timeZone);
104
+ return {
105
+ toDisplayValue: (value) => {
106
+ return value ?? "";
107
+ },
108
+ toFormValue: (value) => {
109
+ const nextValue = value;
110
+ if (nextValue == null) return null;
111
+ if (valueType === "dateValue") return nextValue;
112
+ return dateValueToUtcIsoString(nextValue, resolvedTimeZone ?? "UTC") ?? String(nextValue);
113
+ }
114
+ };
115
+ };
116
+ // src/DatePicker/datePickerVariants.ts
97
117
  const datePickerVariants = tv({
118
+ extend: segmentedInputVariants,
98
119
  slots: {
99
- /** wrapper around the whole date picker */
120
+ /** Container for the date input and supporting text */
100
121
  base: "",
101
- /** helper wrapper for error/description */
122
+ /** Calendar panel inside the popup */
123
+ calendar: ["", "relative inline-block w-64 max-w-full overflow-hidden rounded-large bg-default-50 dark:bg-background"],
124
+ /** Previous or next month button */
125
+ calendarButton: [
126
+ "outline-solid flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-default-400 outline-transparent",
127
+ "hover:bg-default/40 data-[disabled=true]:opacity-disabled",
128
+ "data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-offset-2 data-[focus-visible=true]:outline-focus"
129
+ ],
130
+ /** Calendar grid and navigation area */
131
+ calendarContent: ["", "w-full"],
132
+ /** Row containing month navigation */
133
+ calendarHeader: "flex items-center justify-between gap-2 bg-content1 px-4 py-2",
134
+ /** Currently displayed month and year */
135
+ calendarTitle: "flex-1 text-center font-medium text-default-500 text-small",
136
+ /** Selectable date with interaction states */
137
+ cell: [
138
+ "outline-solid flex h-8 w-8 cursor-pointer select-none items-center justify-center rounded-full text-foreground outline-transparent transition-colors",
139
+ "data-[focus-visible=true]:z-10 data-[disabled=true]:cursor-default data-[unavailable=true]:cursor-default",
140
+ "data-[hovered=true]:bg-primary-50 data-[selected=true]:bg-primary data-[selected=true]:data-[hovered=true]:bg-primary",
141
+ "data-[disabled=true]:text-default-300 data-[hovered=true]:text-primary-400 data-[selected=true]:data-[hovered=true]:text-primary-foreground data-[selected=true]:text-primary-foreground data-[unavailable=true]:text-default-300 data-[unavailable=true]:line-through",
142
+ "data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-offset-2 data-[focus-visible=true]:outline-focus",
143
+ "motion-reduce:transition-none"
144
+ ],
145
+ /** Keyboard focus boundary inside the popup */
146
+ dialog: "flex flex-col outline-none",
147
+ /** Table of selectable dates */
148
+ grid: "z-0 w-full border-collapse",
149
+ /** Rows containing calendar dates */
150
+ gridBody: "[&>tr:first-child]:mt-2 [&>tr>td]:px-0 [&>tr>td]:py-0.5 [&>tr]:flex [&>tr]:items-center [&>tr]:justify-center",
151
+ /** Row containing weekday headings */
152
+ gridHeader: "bg-content1 shadow-[0px_20px_20px_0px_rgb(0_0_0/0.05)] [&>tr]:flex [&>tr]:justify-center [&>tr]:px-4 [&>tr]:pb-2",
153
+ /** Individual weekday heading */
154
+ gridHeaderCell: "flex w-8 items-center justify-center font-medium text-default-400 text-small",
155
+ /** Viewport around the calendar grid */
156
+ gridWrapper: "relative flex h-auto max-w-full overflow-hidden pb-2",
157
+ /** Supporting text below the input surface */
102
158
  helperWrapper: ["p-0"],
103
- /** the calendar element */
104
- calendar: "",
105
- /** the calendar's content element */
106
- calendarContent: "",
107
- /**
108
- * inner wrapper (HeroUI inputWrapper slot)
109
- *
110
- * NOTE: Unlike HeroUI Input, the DatePicker does not expose a
111
- * `data-focus` indicator on the group, so the focus border has to be
112
- * driven by the native `focus-within` state of the segment inputs.
113
- */
114
- inputWrapper: "bg-content1 focus-within:border-focus",
115
- /** field label */
116
- label: "cursor-default",
117
- /** the calendar popover element */
118
- popoverContent: "",
119
- /** selector button element */
120
- selectorButton: "",
121
- /** selector icon element */
122
- selectorIcon: "",
123
- /** the time-input component element */
124
- timeInput: "",
125
- /** the time-input component's label element */
126
- timeInputLabel: ""
159
+ /** Invalid color for content beside segments */
160
+ innerWrapper: "group-data-[invalid=true]:text-danger",
161
+ /** Input surface with a focus indicator */
162
+ inputWrapper: ["bg-content1 focus-within:border-focus", "group-data-[invalid=true]:border-danger group-data-[invalid=true]:focus-within:border-danger group-data-[invalid=true]:hover:border-danger group-data-[invalid=true]:focus-within:hover:border-danger"],
163
+ /** Label above the date input */
164
+ label: ["cursor-default", "group-data-[invalid=true]:text-danger"],
165
+ /** Floating surface around the calendar */
166
+ popoverContent: ["", "z-50 rounded-large bg-content1 shadow-medium outline-none text-small"],
167
+ /** Invalid editable value and separator states */
168
+ segment: "data-[invalid=true]:data-[editable=true]:data-[placeholder=true]:text-danger data-[invalid=true]:data-[editable=true]:text-danger data-[invalid=true]:text-danger-300 data-[invalid=true]:focus:bg-danger-400/50 data-[invalid=true]:data-[editable=true]:focus:text-danger dark:data-[invalid=true]:focus:bg-danger-400/20",
169
+ /** Button opening the calendar popup */
170
+ selectorButton: [
171
+ "",
172
+ "outline-solid relative -mx-2 inline-flex h-8 min-h-8 w-8 min-w-8 shrink-0 items-center justify-center rounded-full text-inherit outline-transparent text-tiny",
173
+ "hover:bg-default/40",
174
+ "data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-offset-2 data-[focus-visible=true]:outline-focus"
175
+ ],
176
+ /** Icon inside the calendar toggle */
177
+ selectorIcon: ["", "h-[18px] w-[18px]"],
178
+ /** Time input below the calendar */
179
+ timeInput: ["", "group flex w-full flex-row flex-wrap items-center gap-x-6 px-5 pb-4"],
180
+ /** Label beside the calendar time input */
181
+ timeInputLabel: ["", "relative font-medium text-foreground text-tiny"],
182
+ /** Surface around the calendar time segments */
183
+ timeInputWrapper: ["shadow-xs relative inline-flex h-8 min-h-8 w-full flex-1 items-center rounded-small bg-default-100 px-2", "hover:bg-default-200 focus-within:hover:bg-default-100"]
127
184
  },
128
- variants: { readOnly: { true: { base: "**:cursor-not-allowed cursor-not-allowed opacity-disabled" } } }
185
+ variants: {
186
+ disabled: { true: { base: "pointer-events-none opacity-disabled" } },
187
+ readOnly: { true: { base: "cursor-not-allowed opacity-disabled **:cursor-not-allowed" } }
188
+ }
129
189
  });
190
+ // src/DatePicker/subcomponents/DatePickerChevron.tsx
191
+ /** Decorative direction indicator for calendar navigation */
192
+ const DatePickerChevron = ({ previous = false }) => {
193
+ return /* @__PURE__ */ jsx("svg", {
194
+ "aria-hidden": true,
195
+ className: previous ? "h-4 w-4 rtl:rotate-180" : "h-4 w-4 rotate-180 rtl:rotate-0",
196
+ fill: "none",
197
+ viewBox: "0 0 16 16",
198
+ children: /* @__PURE__ */ jsx("path", {
199
+ d: "M10 3.33334L6 8.00001L10 12.6667",
200
+ stroke: "currentColor",
201
+ strokeLinecap: "round",
202
+ strokeLinejoin: "round",
203
+ strokeWidth: "1.5"
204
+ })
205
+ });
206
+ };
207
+ // src/DatePicker/subcomponents/DatePickerCalendar.tsx
130
208
  /**
131
- * DatePicker component based on [HeroUI DatePicker](https://v2.heroui.com/docs/components/date-picker)
209
+ * Calendar popup with month navigation and an optional time editor
210
+ *
211
+ * @see https://react-aria.adobe.com/DatePicker
212
+ * @see https://react-aria.adobe.com/Calendar
132
213
  */
133
- const DatePicker$1 = ({ className: _className = void 0, hourCycle = 24, hideTimeZone = false, maxValue = void 0, minValue = void 0, name, timeZone = void 0, valueType = "string", withTime = false, ...uniformFieldProps }) => {
134
- const { ariaLabel, disabled, errorMessage, field: { onBlur, onChange, ref, value }, invalid, label, readOnly, required, testId } = useUniformField({
135
- name,
136
- ...uniformFieldProps
214
+ const DatePickerCalendar = ({ className: classNames, hideTimeZone, hourCycle, maxValue, minValue, placeholderValue, readOnly, state, withTime }) => {
215
+ const handleTimeChange = (next) => {
216
+ if (next && !readOnly) state.setTimeValue(next);
217
+ };
218
+ return /* @__PURE__ */ jsx(Popover, {
219
+ className: classNames.popoverContent,
220
+ "data-slot": "popover-content",
221
+ offset: 4,
222
+ placement: "bottom",
223
+ children: /* @__PURE__ */ jsx(Dialog, {
224
+ className: classNames.dialog,
225
+ children: /* @__PURE__ */ jsxs(Calendar, {
226
+ className: classNames.calendar,
227
+ "data-slot": "calendar",
228
+ children: [/* @__PURE__ */ jsxs("div", {
229
+ className: classNames.calendarContent,
230
+ "data-slot": "calendar-content",
231
+ children: [/* @__PURE__ */ jsxs("header", {
232
+ className: classNames.calendarHeader,
233
+ "data-slot": "header-wrapper",
234
+ children: [
235
+ /* @__PURE__ */ jsx(Button, {
236
+ className: classNames.calendarButton,
237
+ "data-slot": "prev-button",
238
+ slot: "previous",
239
+ children: /* @__PURE__ */ jsx(DatePickerChevron, { previous: true })
240
+ }),
241
+ /* @__PURE__ */ jsx(Heading, {
242
+ className: classNames.calendarTitle,
243
+ "data-slot": "title"
244
+ }),
245
+ /* @__PURE__ */ jsx(Button, {
246
+ className: classNames.calendarButton,
247
+ "data-slot": "next-button",
248
+ slot: "next",
249
+ children: /* @__PURE__ */ jsx(DatePickerChevron, {})
250
+ })
251
+ ]
252
+ }), /* @__PURE__ */ jsx("div", {
253
+ className: classNames.gridWrapper,
254
+ "data-slot": "grid-wrapper",
255
+ children: /* @__PURE__ */ jsxs(CalendarGrid, {
256
+ className: classNames.grid,
257
+ "data-slot": "grid",
258
+ weekdayStyle: "narrow",
259
+ children: [/* @__PURE__ */ jsx(CalendarGridHeader, {
260
+ className: classNames.gridHeader,
261
+ children: (day) => {
262
+ return /* @__PURE__ */ jsx(CalendarHeaderCell, {
263
+ className: classNames.gridHeaderCell,
264
+ children: day
265
+ });
266
+ }
267
+ }), /* @__PURE__ */ jsx(CalendarGridBody, {
268
+ className: classNames.gridBody,
269
+ children: (date) => {
270
+ return /* @__PURE__ */ jsx(CalendarCell, {
271
+ className: classNames.cell,
272
+ "data-slot": "cell-button",
273
+ date
274
+ });
275
+ }
276
+ })]
277
+ })
278
+ })]
279
+ }), withTime ? /* @__PURE__ */ jsxs(TimeField, {
280
+ className: classNames.timeInput,
281
+ "data-slot": "time-input",
282
+ granularity: "minute",
283
+ hideTimeZone,
284
+ hourCycle,
285
+ isReadOnly: readOnly,
286
+ maxValue: maxValue && "hour" in maxValue ? maxValue : void 0,
287
+ minValue: minValue && "hour" in minValue ? minValue : void 0,
288
+ onChange: handleTimeChange,
289
+ placeholderValue: placeholderValue && "hour" in placeholderValue ? placeholderValue : void 0,
290
+ shouldForceLeadingZeros: true,
291
+ validationBehavior: "aria",
292
+ value: state.timeValue ?? null,
293
+ children: [/* @__PURE__ */ jsx(Label, {
294
+ className: classNames.timeInputLabel,
295
+ "data-slot": "time-input-label",
296
+ children: "Time"
297
+ }), /* @__PURE__ */ jsx("div", {
298
+ className: classNames.timeInputWrapper,
299
+ children: /* @__PURE__ */ jsx(DateInput, {
300
+ className: classNames.input,
301
+ children: (segment) => {
302
+ return /* @__PURE__ */ jsx(DateSegment, {
303
+ className: classNames.segment,
304
+ "data-editable": segment.isEditable || void 0,
305
+ segment
306
+ });
307
+ }
308
+ })
309
+ })]
310
+ }) : null]
311
+ })
312
+ })
313
+ });
314
+ };
315
+ // src/DatePicker/subcomponents/DatePickerTrigger.tsx
316
+ /**
317
+ * Calendar button connected to the surrounding date picker’s popup state
318
+ *
319
+ * @see https://react-aria.adobe.com/DatePicker
320
+ * @see https://react-aria.adobe.com/Button
321
+ */
322
+ const DatePickerTrigger = ({ className: classNames }) => {
323
+ return /* @__PURE__ */ jsx(Button, {
324
+ className: classNames.selectorButton,
325
+ "data-slot": "selector-button",
326
+ children: /* @__PURE__ */ jsxs("svg", {
327
+ "aria-hidden": true,
328
+ className: classNames.selectorIcon,
329
+ "data-slot": "selector-icon",
330
+ fill: "none",
331
+ viewBox: "0 0 24 24",
332
+ children: [/* @__PURE__ */ jsx("path", {
333
+ d: "M7.75 2.5a.75.75 0 0 0-1.5 0v1.58c-1.44.115-2.384.397-3.078 1.092c-.695.694-.977 1.639-1.093 3.078h19.842c-.116-1.44-.398-2.384-1.093-3.078c-.694-.695-1.639-.977-3.078-1.093V2.5a.75.75 0 0 0-1.5 0v1.513C15.585 4 14.839 4 14 4h-4c-.839 0-1.585 0-2.25.013z",
334
+ fill: "currentColor"
335
+ }), /* @__PURE__ */ jsx("path", {
336
+ clipRule: "evenodd",
337
+ d: "M2 12c0-.839 0-1.585.013-2.25h19.974C22 10.415 22 11.161 22 12v2c0 3.771 0 5.657-1.172 6.828C19.657 22 17.771 22 14 22h-4c-3.771 0-5.657 0-6.828-1.172C2 19.657 2 17.771 2 14zm15 2a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2a1 1 0 0 0 0 2m-4-5a1 1 0 1 1-2 0a1 1 0 0 1 2 0m0 4a1 1 0 1 1-2 0a1 1 0 0 1 2 0m-6-3a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2a1 1 0 0 0 0 2",
338
+ fill: "currentColor",
339
+ fillRule: "evenodd"
340
+ })]
341
+ })
342
+ });
343
+ };
344
+ // src/DatePicker/subcomponents/DatePickerInput.tsx
345
+ /**
346
+ * Editable date segments with a calendar trigger and supporting messages
347
+ *
348
+ * Keeps the reset bridge inside DateField so partial edits reset with the form
349
+ *
350
+ * @see https://react-aria.adobe.com/DateField
351
+ * @see https://react-aria.adobe.com/DatePicker
352
+ * @see https://react-aria.adobe.com/Group
353
+ */
354
+ const DatePickerInput = ({ children, className: classNames, field }) => {
355
+ const { description, errorMessage, ids, invalid, testId } = field;
356
+ return /* @__PURE__ */ jsxs(Group, {
357
+ className: classNames.inputWrapper,
358
+ "data-slot": "input-wrapper",
359
+ "data-testid": testId,
360
+ children: [/* @__PURE__ */ jsxs("div", {
361
+ className: classNames.innerWrapper,
362
+ "data-slot": "inner-wrapper",
363
+ children: [/* @__PURE__ */ jsxs(DateField, {
364
+ className: "flex h-full w-full",
365
+ children: [children, /* @__PURE__ */ jsx(DateInput, {
366
+ className: classNames.input,
367
+ "data-slot": "input-field",
368
+ children: (segment) => {
369
+ return /* @__PURE__ */ jsx(DateSegment, {
370
+ className: classNames.segment,
371
+ "data-editable": segment.isEditable || void 0,
372
+ "data-slot": "segment",
373
+ segment
374
+ });
375
+ }
376
+ })]
377
+ }), /* @__PURE__ */ jsx(DatePickerTrigger, { className: classNames })]
378
+ }), description || invalid ? /* @__PURE__ */ jsxs("div", {
379
+ className: classNames.helperWrapper,
380
+ "data-slot": "helper-wrapper",
381
+ children: [/* @__PURE__ */ jsx(FieldDescription, {
382
+ className: classNames.description,
383
+ id: ids.description,
384
+ children: description
385
+ }), invalid ? /* @__PURE__ */ jsx("div", {
386
+ className: classNames.errorMessage,
387
+ "data-slot": "error-message",
388
+ id: ids.error,
389
+ children: errorMessage
390
+ }) : null]
391
+ }) : null]
137
392
  });
138
- const variants = datePickerVariants({ readOnly });
139
- const classNames = variantsToClassNames(variants, _className, "base");
393
+ };
394
+ // src/DatePicker/subcomponents/DatePickerControl.tsx
395
+ /**
396
+ * Date input presentation with editable segments, field messages and calendar
397
+ *
398
+ * @see https://react-aria.adobe.com/DatePicker
399
+ */
400
+ const DatePickerControl = ({ children, className, field, hideTimeZone, hourCycle, maxValue, minValue, timeZone, withTime = false }) => {
401
+ const styling = useStyling();
402
+ const { disabled, ids, ref: inputRef, invalid, label, name, onBlur, onChange: onValueChange, readOnly, required } = field;
403
+ const controlProps = getFieldControlProps(field);
140
404
  const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);
141
- const parsedValue = parseDateValue(value, withTime ? resolvedTimeZone : timeZone);
405
+ const displayTimeZone = withTime ? resolvedTimeZone : timeZone;
406
+ const value = parseDateValue(field.value, displayTimeZone);
407
+ const parsedMinValue = parseDateValue(minValue, displayTimeZone);
408
+ const parsedMaxValue = parseDateValue(maxValue, displayTimeZone);
142
409
  const placeholderValue = getDatePickerPlaceholderValue(withTime, timeZone);
143
- const parsedMinValue = parseDateValue(minValue, withTime ? resolvedTimeZone : timeZone);
144
- const parsedMaxValue = parseDateValue(maxValue, withTime ? resolvedTimeZone : timeZone);
145
- const handleChange = (nextValue) => {
146
- if (readOnly) return;
147
- if (nextValue == null) {
148
- onChange(null);
149
- return;
150
- }
151
- if (valueType === "dateValue") {
152
- onChange(nextValue);
153
- return;
154
- }
155
- onChange(dateValueToUtcIsoString(nextValue, resolvedTimeZone ?? "UTC") ?? String(nextValue));
410
+ const variants = styling.resolve(datePickerVariants, {
411
+ disabled,
412
+ readOnly
413
+ });
414
+ const classNames = styling.variantsToClassNames(variants, className, "base");
415
+ const handleValueChange = (nextValue) => {
416
+ if (!readOnly) onValueChange(nextValue);
417
+ };
418
+ const handleControlRef = (element) => {
419
+ inputRef(element ? { focus: () => {
420
+ element.querySelector("[role=\"spinbutton\"]:not([aria-disabled=\"true\"])")?.focus();
421
+ } } : null);
156
422
  };
157
423
  return /* @__PURE__ */ jsx(DatePicker, {
158
- ref,
159
- "aria-label": label ? void 0 : ariaLabel,
160
- classNames: {
161
- base: classNames.base,
162
- calendar: classNames.calendar,
163
- calendarContent: classNames.calendarContent,
164
- helperWrapper: classNames.helperWrapper,
165
- inputWrapper: classNames.inputWrapper,
166
- label: classNames.label,
167
- popoverContent: classNames.popoverContent,
168
- selectorButton: classNames.selectorButton,
169
- selectorIcon: classNames.selectorIcon,
170
- timeInput: classNames.timeInput,
171
- timeInputLabel: classNames.timeInputLabel
172
- },
173
- "data-testid": testId,
174
- errorMessage,
424
+ ref: handleControlRef,
425
+ "aria-describedby": controlProps["aria-describedby"],
426
+ "aria-invalid": controlProps["aria-invalid"],
427
+ "aria-label": controlProps["aria-label"],
428
+ className: classNames.base,
429
+ "data-component": "date-picker",
430
+ "data-slot": "base",
175
431
  granularity: withTime ? "minute" : "day",
176
432
  hideTimeZone,
177
433
  hourCycle,
178
- id: testId,
434
+ id: controlProps.id,
179
435
  isDisabled: disabled,
180
436
  isInvalid: invalid,
181
437
  isReadOnly: readOnly,
182
438
  isRequired: required,
183
- label,
184
- labelPlacement: "outside",
185
- maxValue: parsedMaxValue,
186
- minValue: parsedMinValue,
439
+ maxValue: parsedMaxValue ?? void 0,
440
+ minValue: parsedMinValue ?? void 0,
187
441
  name,
188
442
  onBlur,
189
- onChange: handleChange,
190
- placeholderValue,
191
- radius: "sm",
192
- timeInputProps: { isReadOnly: readOnly },
193
- value: parsedValue,
194
- variant: "bordered"
443
+ onChange: handleValueChange,
444
+ placeholderValue: placeholderValue ?? void 0,
445
+ shouldCloseOnSelect: !withTime,
446
+ shouldForceLeadingZeros: true,
447
+ validationBehavior: "aria",
448
+ value: value ?? null,
449
+ children: ({ state }) => {
450
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
451
+ label ? /* @__PURE__ */ jsx(FieldLabel, {
452
+ as: Label,
453
+ className: classNames.label,
454
+ id: ids.label,
455
+ required,
456
+ children: label
457
+ }) : null,
458
+ /* @__PURE__ */ jsx(DatePickerInput, {
459
+ className: classNames,
460
+ field,
461
+ children
462
+ }),
463
+ /* @__PURE__ */ jsx(DatePickerCalendar, {
464
+ className: classNames,
465
+ hideTimeZone,
466
+ hourCycle,
467
+ maxValue: parsedMaxValue,
468
+ minValue: parsedMinValue,
469
+ placeholderValue,
470
+ readOnly,
471
+ state,
472
+ withTime
473
+ })
474
+ ] });
475
+ }
476
+ });
477
+ };
478
+ // src/DatePicker/subcomponents/DatePickerReset.tsx
479
+ /**
480
+ * Clears partial segment edits when the form resets an empty field
481
+ *
482
+ * @see https://react-aria.adobe.com/DatePicker
483
+ */
484
+ const DatePickerReset = () => {
485
+ const state = useContext(DateFieldStateContext);
486
+ useWatchFormReset({ onReset: () => {
487
+ if (state?.value == null) state?.setValue(null);
488
+ } });
489
+ return null;
490
+ };
491
+ // src/DatePicker/DatePicker.tsx
492
+ /** Form input field for a date, with an optional time and calendar picker */
493
+ const DatePicker$1 = ({ className = void 0, hourCycle = 24, hideTimeZone = false, maxValue = void 0, minValue = void 0, name, timeZone = void 0, valueType = "string", withTime = false, ...uniformFieldProps }) => {
494
+ const transform = createDatePickerValueTransform({
495
+ timeZone,
496
+ valueType,
497
+ withTime
498
+ });
499
+ const { field } = useUniformField({
500
+ ...uniformFieldProps,
501
+ name,
502
+ transform
503
+ });
504
+ return /* @__PURE__ */ jsx(DatePickerControl, {
505
+ className,
506
+ field,
507
+ hideTimeZone,
508
+ hourCycle,
509
+ maxValue,
510
+ minValue,
511
+ timeZone,
512
+ withTime,
513
+ children: /* @__PURE__ */ jsx(DatePickerReset, {})
195
514
  });
196
515
  };
197
516
  // src/DatePicker/index.ts