@fuf-stack/uniform 1.27.0 → 2.0.0-next.1

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 +9 -0
  2. package/dist/Checkboxes/index.d.mts +192 -263
  3. package/dist/Checkboxes/index.d.mts.map +1 -1
  4. package/dist/Checkboxes/index.mjs +294 -90
  5. package/dist/Checkboxes/index.mjs.map +1 -1
  6. package/dist/DatePicker/index.d.mts +1282 -500
  7. package/dist/DatePicker/index.d.mts.map +1 -1
  8. package/dist/DatePicker/index.mjs +403 -83
  9. package/dist/DatePicker/index.mjs.map +1 -1
  10. package/dist/FieldArray/index.d.mts +105 -98
  11. package/dist/FieldArray/index.d.mts.map +1 -1
  12. package/dist/FieldArray/index.mjs +344 -195
  13. package/dist/FieldArray/index.mjs.map +1 -1
  14. package/dist/FieldCard/index.d.mts +37 -35
  15. package/dist/FieldCard/index.d.mts.map +1 -1
  16. package/dist/FieldCard/index.mjs +187 -128
  17. package/dist/FieldCard/index.mjs.map +1 -1
  18. package/dist/{FieldCopyTestIdButton-CRJBix9D.mjs → FieldCopyTestIdButton-DV0tkdh2.mjs} +5 -3
  19. package/dist/FieldCopyTestIdButton-DV0tkdh2.mjs.map +1 -0
  20. package/dist/FieldDescription-C4l0HKGL.mjs +36 -0
  21. package/dist/FieldDescription-C4l0HKGL.mjs.map +1 -0
  22. package/dist/FieldLabel-DKzqkuY1.mjs +125 -0
  23. package/dist/FieldLabel-DKzqkuY1.mjs.map +1 -0
  24. package/dist/FieldLayout-BLW5S-Jm.mjs +46 -0
  25. package/dist/FieldLayout-BLW5S-Jm.mjs.map +1 -0
  26. package/dist/FieldValidationError-DgkCL3cC.mjs +77 -0
  27. package/dist/FieldValidationError-DgkCL3cC.mjs.map +1 -0
  28. package/dist/Form/index.d.mts +11 -11
  29. package/dist/Form/index.d.mts.map +1 -1
  30. package/dist/Form/index.mjs +14 -11
  31. package/dist/Form/index.mjs.map +1 -1
  32. package/dist/FormContext-CHctWFAP.mjs +520 -0
  33. package/dist/FormContext-CHctWFAP.mjs.map +1 -0
  34. package/dist/FormContext-CsFiNvuJ.d.mts.map +1 -1
  35. package/dist/Grid/index.mjs +1 -2
  36. package/dist/{Grid-CTs-Rb9G.mjs → Grid-DfcZeuib.mjs} +4 -2
  37. package/dist/Grid-DfcZeuib.mjs.map +1 -0
  38. package/dist/Input/index.d.mts +640 -392
  39. package/dist/Input/index.d.mts.map +1 -1
  40. package/dist/Input/index.mjs +421 -76
  41. package/dist/Input/index.mjs.map +1 -1
  42. package/dist/RadioBoxes/index.d.mts +1583 -120
  43. package/dist/RadioBoxes/index.d.mts.map +1 -1
  44. package/dist/RadioBoxes/index.mjs +159 -114
  45. package/dist/RadioBoxes/index.mjs.map +1 -1
  46. package/dist/RadioTabs/index.d.mts +300 -81
  47. package/dist/RadioTabs/index.d.mts.map +1 -1
  48. package/dist/RadioTabs/index.mjs +277 -86
  49. package/dist/RadioTabs/index.mjs.map +1 -1
  50. package/dist/Radios/index.d.mts +1353 -108
  51. package/dist/Radios/index.d.mts.map +1 -1
  52. package/dist/Radios/index.mjs +105 -54
  53. package/dist/Radios/index.mjs.map +1 -1
  54. package/dist/Select/index.d.mts +558 -3013
  55. package/dist/Select/index.d.mts.map +1 -1
  56. package/dist/Select/index.mjs +319 -177
  57. package/dist/Select/index.mjs.map +1 -1
  58. package/dist/Slider/index.d.mts +414 -1326
  59. package/dist/Slider/index.d.mts.map +1 -1
  60. package/dist/Slider/index.mjs +276 -94
  61. package/dist/Slider/index.mjs.map +1 -1
  62. package/dist/SubmitButton/index.d.mts.map +1 -1
  63. package/dist/SubmitButton/index.mjs +4 -1
  64. package/dist/SubmitButton/index.mjs.map +1 -1
  65. package/dist/Switch/index.d.mts +2 -1248
  66. package/dist/Switch/index.mjs +167 -68
  67. package/dist/Switch/index.mjs.map +1 -1
  68. package/dist/Switch-CvPO8IF9.d.mts +601 -0
  69. package/dist/Switch-CvPO8IF9.d.mts.map +1 -0
  70. package/dist/SwitchBox/index.d.mts +139 -43
  71. package/dist/SwitchBox/index.d.mts.map +1 -1
  72. package/dist/SwitchBox/index.mjs +142 -87
  73. package/dist/SwitchBox/index.mjs.map +1 -1
  74. package/dist/TextArea/index.d.mts +295 -411
  75. package/dist/TextArea/index.d.mts.map +1 -1
  76. package/dist/TextArea/index.mjs +200 -48
  77. package/dist/TextArea/index.mjs.map +1 -1
  78. package/dist/Time/index.d.mts +1170 -601
  79. package/dist/Time/index.d.mts.map +1 -1
  80. package/dist/Time/index.mjs +162 -74
  81. package/dist/Time/index.mjs.map +1 -1
  82. package/dist/helpers/index.d.mts +1 -1
  83. package/dist/helpers/index.mjs +1 -1
  84. package/dist/helpers/index.mjs.map +1 -1
  85. package/dist/hooks/useClientValidation/index.mjs +1 -1
  86. package/dist/hooks/useController/index.d.mts +31 -3
  87. package/dist/hooks/useController/index.d.mts.map +1 -0
  88. package/dist/hooks/useController/index.mjs +1 -2
  89. package/dist/hooks/useFormContext/index.d.mts +65 -3
  90. package/dist/hooks/useFormContext/index.d.mts.map +1 -0
  91. package/dist/hooks/useFormContext/index.mjs +1 -2
  92. package/dist/hooks/useInputValueDebounce/index.d.mts +11 -5
  93. package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
  94. package/dist/hooks/useInputValueDebounce/index.mjs +27 -5
  95. package/dist/hooks/useInputValueDebounce/index.mjs.map +1 -1
  96. package/dist/hooks/useInputValueTransform/index.d.mts +1 -2
  97. package/dist/hooks/useInputValueTransform/index.mjs +1 -2
  98. package/dist/hooks/useWatchFormReset/index.mjs +1 -1
  99. package/dist/hooks/useWatchUserChange/index.d.mts +2 -2
  100. package/dist/hooks/useWatchUserChange/index.d.mts.map +1 -1
  101. package/dist/hooks/useWatchUserChange/index.mjs +1 -1
  102. package/dist/hooks/useWatchUserChange/index.mjs.map +1 -1
  103. package/dist/{useInputValueTransform-LOaEim7k.d.mts → index-BS8IoBOn.d.mts} +3 -3
  104. package/dist/index-BS8IoBOn.d.mts.map +1 -0
  105. package/dist/partials/FieldCopyTestIdButton/index.mjs +1 -2
  106. package/dist/partials/FieldValidationError/index.d.mts +637 -3
  107. package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
  108. package/dist/partials/FieldValidationError/index.mjs +1 -2
  109. package/dist/radioControlVariants-Cm6WufWo.mjs +188 -0
  110. package/dist/radioControlVariants-Cm6WufWo.mjs.map +1 -0
  111. package/dist/switchVariants-BaQw2DA7.mjs +67 -0
  112. package/dist/switchVariants-BaQw2DA7.mjs.map +1 -0
  113. package/dist/timeVariants-B9HDfNYt.mjs +58 -0
  114. package/dist/timeVariants-B9HDfNYt.mjs.map +1 -0
  115. package/dist/{useController-CK39i6HI.mjs → useController-BCFeZbBZ.mjs} +2 -2
  116. package/dist/{useController-CK39i6HI.mjs.map → useController-BCFeZbBZ.mjs.map} +1 -1
  117. package/dist/{useFormContext-fYWtlnpE.mjs → useFormContext-BPjJjNnM.mjs} +2 -2
  118. package/dist/{useFormContext-fYWtlnpE.mjs.map → useFormContext-BPjJjNnM.mjs.map} +1 -1
  119. package/dist/{useInputValueTransform-DJ5zkqSy.mjs → useInputValueTransform-Mw8YEOXT.mjs} +2 -2
  120. package/dist/{useInputValueTransform-DJ5zkqSy.mjs.map → useInputValueTransform-Mw8YEOXT.mjs.map} +1 -1
  121. package/package.json +17 -29
  122. package/dist/FieldCopyTestIdButton-CRJBix9D.mjs.map +0 -1
  123. package/dist/FieldValidationError-ByRoIxaM.mjs +0 -50
  124. package/dist/FieldValidationError-ByRoIxaM.mjs.map +0 -1
  125. package/dist/FormContext-gHSwOlcy.mjs +0 -278
  126. package/dist/FormContext-gHSwOlcy.mjs.map +0 -1
  127. package/dist/Grid-CTs-Rb9G.mjs.map +0 -1
  128. package/dist/Switch/index.d.mts.map +0 -1
  129. package/dist/hooks/useInput/index.d.mts +0 -2
  130. package/dist/hooks/useInput/index.mjs +0 -7
  131. package/dist/hooks/useInput/index.mjs.map +0 -1
  132. package/dist/hooks/useUniformField/index.d.mts +0 -98
  133. package/dist/hooks/useUniformField/index.d.mts.map +0 -1
  134. package/dist/hooks/useUniformField/index.mjs +0 -137
  135. package/dist/hooks/useUniformField/index.mjs.map +0 -1
  136. package/dist/hooks/useUniformFieldArray/index.d.mts +0 -73
  137. package/dist/hooks/useUniformFieldArray/index.d.mts.map +0 -1
  138. package/dist/hooks/useUniformFieldArray/index.mjs +0 -101
  139. package/dist/hooks/useUniformFieldArray/index.mjs.map +0 -1
  140. package/dist/index-CAdGtKE_.d.mts +0 -1
  141. package/dist/index-CaxrMD1A.d.mts +0 -1
  142. package/dist/index-D5HVU2jP.d.mts +0 -1
  143. package/dist/useController-DcK2YHbw.d.mts +0 -32
  144. package/dist/useController-DcK2YHbw.d.mts.map +0 -1
  145. package/dist/useFormContext-B3QGVVaO.d.mts +0 -66
  146. package/dist/useFormContext-B3QGVVaO.d.mts.map +0 -1
  147. package/dist/useInput-C0aJaAGe.mjs +0 -2
  148. package/dist/useInput-ClpHDPdr.d.mts +0 -2
  149. package/dist/useInputValueTransform-LOaEim7k.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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgHnB,YAAY,mBAAmB;;;UC5G1B;;EAEf;;EAEA,YAAY;;EAEZ,cAAc;;EAEd;;EAEA;;;;;;EAMA;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;;EAEA;;;;;;;EAOA;;EAEA;;;;;;;EAOA;;;cAII,eAAc,WAAA,WAAA,cAAA,UAAA,UAAA,MAAA,UAAA,WAAA,aAAA,qBAWjB,oCAAe,IAAA"}
@@ -1,7 +1,12 @@
1
- import { useUniformField } from "../hooks/useUniformField/index.mjs";
2
- import { tv, variantsToClassNames } 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-DKzqkuY1.mjs";
2
+ import { n as getFieldControlProps, t as FieldDescription } from "../FieldDescription-C4l0HKGL.mjs";
3
+ import { t as segmentedInputVariants } from "../timeVariants-B9HDfNYt.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
  //#region 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,100 +98,415 @@ const dateValueToUtcIsoString = (value, timeZone) => {
93
98
  if (typeof maybeWithToDate.toDate === "function") return maybeWithToDate.toDate(timeZone).toISOString();
94
99
  return null;
95
100
  };
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
+ };
96
116
  //#endregion
97
- //#region src/DatePicker/DatePicker.tsx
98
- const datePickerVariants = tv({ slots: {
99
- /** wrapper around the whole date picker */
100
- base: "",
101
- /** helper wrapper for error/description */
102
- 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: ""
127
- } });
117
+ //#region src/DatePicker/datePickerVariants.ts
118
+ const datePickerVariants = tv({
119
+ extend: segmentedInputVariants,
120
+ slots: {
121
+ /** Container for the date input and supporting text */
122
+ base: "",
123
+ /** Calendar panel inside the popup */
124
+ calendar: ["", "relative inline-block w-64 max-w-full overflow-hidden rounded-large bg-default-50 dark:bg-background"],
125
+ /** Previous or next month button */
126
+ calendarButton: [
127
+ "outline-solid flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-default-400 outline-transparent",
128
+ "hover:bg-default/40 data-[disabled=true]:opacity-disabled",
129
+ "data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-offset-2 data-[focus-visible=true]:outline-focus"
130
+ ],
131
+ /** Calendar grid and navigation area */
132
+ calendarContent: ["", "w-full"],
133
+ /** Row containing month navigation */
134
+ calendarHeader: "flex items-center justify-between gap-2 bg-content1 px-4 py-2",
135
+ /** Currently displayed month and year */
136
+ calendarTitle: "flex-1 text-center font-medium text-default-500 text-small",
137
+ /** Selectable date with interaction states */
138
+ cell: [
139
+ "outline-solid flex h-8 w-8 cursor-pointer select-none items-center justify-center rounded-full text-foreground outline-transparent transition-colors",
140
+ "data-[focus-visible=true]:z-10 data-[disabled=true]:cursor-default data-[unavailable=true]:cursor-default",
141
+ "data-[hovered=true]:bg-primary-50 data-[selected=true]:bg-primary data-[selected=true]:data-[hovered=true]:bg-primary",
142
+ "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",
143
+ "data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-offset-2 data-[focus-visible=true]:outline-focus",
144
+ "motion-reduce:transition-none"
145
+ ],
146
+ /** Keyboard focus boundary inside the popup */
147
+ dialog: "flex flex-col outline-none",
148
+ /** Table of selectable dates */
149
+ grid: "z-0 w-full border-collapse",
150
+ /** Rows containing calendar dates */
151
+ gridBody: "[&>tr:first-child]:mt-2 [&>tr>td]:px-0 [&>tr>td]:py-0.5 [&>tr]:flex [&>tr]:items-center [&>tr]:justify-center",
152
+ /** Row containing weekday headings */
153
+ 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",
154
+ /** Individual weekday heading */
155
+ gridHeaderCell: "flex w-8 items-center justify-center font-medium text-default-400 text-small",
156
+ /** Viewport around the calendar grid */
157
+ gridWrapper: "relative flex h-auto max-w-full overflow-hidden pb-2",
158
+ /** Supporting text below the input surface */
159
+ helperWrapper: ["p-0"],
160
+ /** Invalid color for content beside segments */
161
+ innerWrapper: "group-data-[invalid=true]:text-danger",
162
+ /** Input surface with a focus indicator */
163
+ 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"],
164
+ /** Label above the date input */
165
+ label: ["cursor-default", "group-data-[invalid=true]:text-danger"],
166
+ /** Floating surface around the calendar */
167
+ popoverContent: ["", "z-50 rounded-large bg-content1 shadow-medium outline-none text-small"],
168
+ /** Invalid editable value and separator states */
169
+ 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",
170
+ /** Button opening the calendar popup */
171
+ selectorButton: [
172
+ "",
173
+ "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",
174
+ "hover:bg-default/40",
175
+ "data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-offset-2 data-[focus-visible=true]:outline-focus"
176
+ ],
177
+ /** Icon inside the calendar toggle */
178
+ selectorIcon: ["", "h-[18px] w-[18px]"],
179
+ /** Time input below the calendar */
180
+ timeInput: ["", "group flex w-full flex-row flex-wrap items-center gap-x-6 px-5 pb-4"],
181
+ /** Label beside the calendar time input */
182
+ timeInputLabel: ["", "relative font-medium text-foreground text-tiny"],
183
+ /** Surface around the calendar time segments */
184
+ 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"]
185
+ },
186
+ variants: { disabled: { true: { base: "pointer-events-none opacity-disabled" } } }
187
+ });
188
+ //#endregion
189
+ //#region src/DatePicker/subcomponents/DatePickerChevron.tsx
190
+ /** Decorative direction indicator for calendar navigation */
191
+ const DatePickerChevron = ({ previous = false }) => {
192
+ return /* @__PURE__ */ jsx("svg", {
193
+ "aria-hidden": true,
194
+ className: previous ? "h-4 w-4 rtl:rotate-180" : "h-4 w-4 rotate-180 rtl:rotate-0",
195
+ fill: "none",
196
+ viewBox: "0 0 16 16",
197
+ children: /* @__PURE__ */ jsx("path", {
198
+ d: "M10 3.33334L6 8.00001L10 12.6667",
199
+ stroke: "currentColor",
200
+ strokeLinecap: "round",
201
+ strokeLinejoin: "round",
202
+ strokeWidth: "1.5"
203
+ })
204
+ });
205
+ };
206
+ //#endregion
207
+ //#region src/DatePicker/subcomponents/DatePickerCalendar.tsx
128
208
  /**
129
- * 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
130
213
  */
131
- 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 }) => {
132
- const { ariaLabel, disabled, errorMessage, field: { onBlur, onChange, ref, value }, invalid, label, required, testId } = useUniformField({
133
- name,
134
- ...uniformFieldProps
214
+ const DatePickerCalendar = ({ className: classNames, hideTimeZone, hourCycle, maxValue, minValue, placeholderValue, state, withTime }) => {
215
+ const handleTimeChange = (next) => {
216
+ if (next) 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
+ maxValue: maxValue && "hour" in maxValue ? maxValue : void 0,
286
+ minValue: minValue && "hour" in minValue ? minValue : void 0,
287
+ onChange: handleTimeChange,
288
+ placeholderValue: placeholderValue && "hour" in placeholderValue ? placeholderValue : void 0,
289
+ shouldForceLeadingZeros: true,
290
+ validationBehavior: "aria",
291
+ value: state.timeValue ?? null,
292
+ children: [/* @__PURE__ */ jsx(Label, {
293
+ className: classNames.timeInputLabel,
294
+ "data-slot": "time-input-label",
295
+ children: "Time"
296
+ }), /* @__PURE__ */ jsx("div", {
297
+ className: classNames.timeInputWrapper,
298
+ children: /* @__PURE__ */ jsx(DateInput, {
299
+ className: classNames.input,
300
+ children: (segment) => {
301
+ return /* @__PURE__ */ jsx(DateSegment, {
302
+ className: classNames.segment,
303
+ "data-editable": segment.isEditable || void 0,
304
+ segment
305
+ });
306
+ }
307
+ })
308
+ })]
309
+ }) : null]
310
+ })
311
+ })
312
+ });
313
+ };
314
+ //#endregion
315
+ //#region 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
+ //#endregion
345
+ //#region src/DatePicker/subcomponents/DatePickerInput.tsx
346
+ /**
347
+ * Editable date segments with a calendar trigger and supporting messages
348
+ *
349
+ * Keeps the reset bridge inside DateField so partial edits reset with the form
350
+ *
351
+ * @see https://react-aria.adobe.com/DateField
352
+ * @see https://react-aria.adobe.com/DatePicker
353
+ * @see https://react-aria.adobe.com/Group
354
+ */
355
+ const DatePickerInput = ({ children, className: classNames, field }) => {
356
+ const { description, errorMessage, ids, invalid, testId } = field;
357
+ return /* @__PURE__ */ jsxs(Group, {
358
+ className: classNames.inputWrapper,
359
+ "data-slot": "input-wrapper",
360
+ "data-testid": testId,
361
+ children: [/* @__PURE__ */ jsxs("div", {
362
+ className: classNames.innerWrapper,
363
+ "data-slot": "inner-wrapper",
364
+ children: [/* @__PURE__ */ jsxs(DateField, {
365
+ className: "flex h-full w-full",
366
+ children: [children, /* @__PURE__ */ jsx(DateInput, {
367
+ className: classNames.input,
368
+ "data-slot": "input-field",
369
+ children: (segment) => {
370
+ return /* @__PURE__ */ jsx(DateSegment, {
371
+ className: classNames.segment,
372
+ "data-editable": segment.isEditable || void 0,
373
+ "data-slot": "segment",
374
+ segment
375
+ });
376
+ }
377
+ })]
378
+ }), /* @__PURE__ */ jsx(DatePickerTrigger, { className: classNames })]
379
+ }), description || invalid ? /* @__PURE__ */ jsxs("div", {
380
+ className: classNames.helperWrapper,
381
+ "data-slot": "helper-wrapper",
382
+ children: [/* @__PURE__ */ jsx(FieldDescription, {
383
+ className: classNames.description,
384
+ id: ids.description,
385
+ children: description
386
+ }), invalid ? /* @__PURE__ */ jsx("div", {
387
+ className: classNames.errorMessage,
388
+ "data-slot": "error-message",
389
+ id: ids.error,
390
+ children: errorMessage
391
+ }) : null]
392
+ }) : null]
135
393
  });
136
- const variants = datePickerVariants();
137
- const classNames = variantsToClassNames(variants, _className, "base");
394
+ };
395
+ //#endregion
396
+ //#region src/DatePicker/subcomponents/DatePickerControl.tsx
397
+ /**
398
+ * Date input presentation with editable segments, field messages and calendar
399
+ *
400
+ * @see https://react-aria.adobe.com/DatePicker
401
+ */
402
+ const DatePickerControl = ({ children, className, field, hideTimeZone, hourCycle, maxValue, minValue, timeZone, withTime = false }) => {
403
+ const styling = useStyling();
404
+ const { disabled, ids, ref: inputRef, invalid, label, name, onBlur, onChange: onValueChange, required } = field;
405
+ const controlProps = getFieldControlProps(field);
138
406
  const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);
139
- const parsedValue = parseDateValue(value, withTime ? resolvedTimeZone : timeZone);
407
+ const displayTimeZone = withTime ? resolvedTimeZone : timeZone;
408
+ const value = parseDateValue(field.value, displayTimeZone);
409
+ const parsedMinValue = parseDateValue(minValue, displayTimeZone);
410
+ const parsedMaxValue = parseDateValue(maxValue, displayTimeZone);
140
411
  const placeholderValue = getDatePickerPlaceholderValue(withTime, timeZone);
141
- const parsedMinValue = parseDateValue(minValue, withTime ? resolvedTimeZone : timeZone);
142
- const parsedMaxValue = parseDateValue(maxValue, withTime ? resolvedTimeZone : timeZone);
143
- const handleChange = (nextValue) => {
144
- if (nextValue == null) {
145
- onChange(null);
146
- return;
147
- }
148
- if (valueType === "dateValue") {
149
- onChange(nextValue);
150
- return;
151
- }
152
- onChange(dateValueToUtcIsoString(nextValue, resolvedTimeZone ?? "UTC") ?? String(nextValue));
412
+ const variants = styling.resolve(datePickerVariants, { disabled });
413
+ const classNames = styling.variantsToClassNames(variants, className, "base");
414
+ const handleControlRef = (element) => {
415
+ inputRef(element ? { focus: () => {
416
+ element.querySelector("[role=\"spinbutton\"]:not([aria-disabled=\"true\"])")?.focus();
417
+ } } : null);
153
418
  };
154
419
  return /* @__PURE__ */ jsx(DatePicker, {
155
- ref,
156
- "aria-label": label ? void 0 : ariaLabel,
157
- classNames: {
158
- base: classNames.base,
159
- calendar: classNames.calendar,
160
- calendarContent: classNames.calendarContent,
161
- helperWrapper: classNames.helperWrapper,
162
- inputWrapper: classNames.inputWrapper,
163
- label: classNames.label,
164
- popoverContent: classNames.popoverContent,
165
- selectorButton: classNames.selectorButton,
166
- selectorIcon: classNames.selectorIcon,
167
- timeInput: classNames.timeInput,
168
- timeInputLabel: classNames.timeInputLabel
169
- },
170
- "data-testid": testId,
171
- errorMessage,
420
+ ref: handleControlRef,
421
+ "aria-describedby": controlProps["aria-describedby"],
422
+ "aria-invalid": controlProps["aria-invalid"],
423
+ "aria-label": controlProps["aria-label"],
424
+ className: classNames.base,
425
+ "data-component": "date-picker",
426
+ "data-slot": "base",
172
427
  granularity: withTime ? "minute" : "day",
173
428
  hideTimeZone,
174
429
  hourCycle,
175
- id: testId,
430
+ id: controlProps.id,
176
431
  isDisabled: disabled,
177
432
  isInvalid: invalid,
178
433
  isRequired: required,
179
- label,
180
- labelPlacement: "outside",
181
- maxValue: parsedMaxValue,
182
- minValue: parsedMinValue,
434
+ maxValue: parsedMaxValue ?? void 0,
435
+ minValue: parsedMinValue ?? void 0,
183
436
  name,
184
437
  onBlur,
185
- onChange: handleChange,
186
- placeholderValue,
187
- radius: "sm",
188
- value: parsedValue,
189
- variant: "bordered"
438
+ onChange: onValueChange,
439
+ placeholderValue: placeholderValue ?? void 0,
440
+ shouldCloseOnSelect: !withTime,
441
+ shouldForceLeadingZeros: true,
442
+ validationBehavior: "aria",
443
+ value: value ?? null,
444
+ children: ({ state }) => {
445
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
446
+ label ? /* @__PURE__ */ jsx(FieldLabel, {
447
+ as: Label,
448
+ className: classNames.label,
449
+ id: ids.label,
450
+ required,
451
+ children: label
452
+ }) : null,
453
+ /* @__PURE__ */ jsx(DatePickerInput, {
454
+ className: classNames,
455
+ field,
456
+ children
457
+ }),
458
+ /* @__PURE__ */ jsx(DatePickerCalendar, {
459
+ className: classNames,
460
+ hideTimeZone,
461
+ hourCycle,
462
+ maxValue: parsedMaxValue,
463
+ minValue: parsedMinValue,
464
+ placeholderValue,
465
+ state,
466
+ withTime
467
+ })
468
+ ] });
469
+ }
470
+ });
471
+ };
472
+ //#endregion
473
+ //#region src/DatePicker/subcomponents/DatePickerReset.tsx
474
+ /**
475
+ * Clears partial segment edits when the form resets an empty field
476
+ *
477
+ * @see https://react-aria.adobe.com/DatePicker
478
+ */
479
+ const DatePickerReset = () => {
480
+ const state = useContext(DateFieldStateContext);
481
+ useWatchFormReset({ onReset: () => {
482
+ if (state?.value == null) state?.setValue(null);
483
+ } });
484
+ return null;
485
+ };
486
+ //#endregion
487
+ //#region src/DatePicker/DatePicker.tsx
488
+ /** Form input field for a date, with an optional time and calendar picker */
489
+ 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 }) => {
490
+ const transform = createDatePickerValueTransform({
491
+ timeZone,
492
+ valueType,
493
+ withTime
494
+ });
495
+ const { field } = useUniformField({
496
+ ...uniformFieldProps,
497
+ name,
498
+ transform
499
+ });
500
+ return /* @__PURE__ */ jsx(DatePickerControl, {
501
+ className,
502
+ field,
503
+ hideTimeZone,
504
+ hourCycle,
505
+ maxValue,
506
+ minValue,
507
+ timeZone,
508
+ withTime,
509
+ children: /* @__PURE__ */ jsx(DatePickerReset, {})
190
510
  });
191
511
  };
192
512
  //#endregion