@povio/ui 3.3.0-rc.4 → 3.4.0-rc.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.
- package/README.md +15 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +55 -206
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
- package/dist/components/buttons/shared/ButtonContent.js +22 -80
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +93 -100
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +1 -2
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +109 -113
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +97 -238
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +88 -214
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +64 -143
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +275 -294
- package/dist/components/inputs/DateTime/shared/Calendar.js +139 -339
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +114 -308
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +35 -150
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +95 -229
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +115 -296
- package/dist/components/inputs/DateTime/shared/DateField.js +135 -306
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +1 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +136 -343
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +43 -46
- package/dist/components/inputs/File/FileUpload.d.ts +1 -1
- package/dist/components/inputs/File/FileUpload.js +18 -18
- package/dist/components/inputs/File/InputUpload.d.ts +1 -1
- package/dist/components/inputs/File/InputUpload.js +82 -278
- package/dist/components/inputs/File/fileUpload.types.d.ts +1 -1
- package/dist/components/inputs/File/inputUpload.types.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +48 -180
- package/dist/components/inputs/File/shared/FileUploadContentError.js +95 -265
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +99 -261
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +56 -234
- package/dist/components/inputs/File/shared/ProgressBar.js +15 -102
- package/dist/components/inputs/FormField/FormField.js +34 -47
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +1 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +19 -19
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +1 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +93 -331
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -1
- package/dist/components/inputs/Input/TextArea/TextArea.js +18 -18
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -2
- package/dist/components/inputs/Input/TextInput/TextInput.js +36 -38
- package/dist/components/inputs/Inputs/Form.d.ts +4 -4
- package/dist/components/inputs/Inputs/InputItem.d.ts +22 -22
- package/dist/components/inputs/Inputs/InputItem.js +35 -36
- package/dist/components/inputs/Inputs/Inputs.d.ts +2 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.js +107 -111
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +26 -86
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +19 -19
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/QuerySelect.js +49 -115
- package/dist/components/inputs/Selection/Select/Select.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/Select.js +22 -22
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +0 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +34 -37
- package/dist/components/inputs/Selection/shared/SelectInput.js +1 -0
- package/dist/components/inputs/Selection/shared/SelectListBox.js +51 -163
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +4 -8
- package/dist/components/inputs/Selection/shared/select.types.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/useSelectItems.js +48 -108
- package/dist/components/inputs/Skeleton/InputFrame.js +177 -552
- package/dist/components/inputs/Slider/Slider.d.ts +1 -1
- package/dist/components/inputs/Slider/Slider.js +18 -18
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -1
- package/dist/components/inputs/TextEditor/TextEditor.js +105 -407
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -2
- package/dist/components/inputs/Toggle/Toggle.js +59 -63
- package/dist/components/inputs/shared/InputClear.js +24 -40
- package/dist/components/inputs/shared/form.binding.d.ts +27 -0
- package/dist/components/inputs/shared/form.binding.js +57 -0
- package/dist/components/inputs/shared/form.types.d.ts +9 -8
- package/dist/components/inputs/shared/form.types.js +8 -0
- package/dist/components/navigation/Accordion/Accordion.js +22 -69
- package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
- package/dist/components/navigation/Stepper/Stepper.js +22 -67
- package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +29 -110
- package/dist/components/segment/Segment.d.ts +1 -1
- package/dist/components/segment/Segment.js +17 -17
- package/dist/components/segment/segment.types.d.ts +1 -1
- package/dist/components/shared/pagination/Pagination.js +22 -108
- package/dist/components/status/Alert/Alert.js +30 -97
- package/dist/components/table/InfiniteTable.js +16 -67
- package/dist/components/table/Table.d.ts +2 -8
- package/dist/components/table/Table.js +33 -55
- package/dist/components/text/Typography/Typography.js +8 -23
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/theme.context.js +45 -98
- package/dist/config/uiConfig.context.d.ts +5 -5
- package/dist/config/uiConfig.context.js +11 -51
- package/dist/config/uiOverrides.context.d.ts +0 -1
- package/dist/helpers/dynamicColumns.d.ts +1 -1
- package/dist/helpers/dynamicInputs.d.ts +7 -7
- package/dist/hooks/useAutosave.d.ts +4 -4
- package/dist/hooks/useAutosave.js +64 -49
- package/dist/hooks/useDebounceCallback.js +17 -51
- package/dist/hooks/useForm.d.ts +39 -15
- package/dist/hooks/useForm.js +96 -43
- package/dist/hooks/useFormAutosave.d.ts +8 -9
- package/dist/hooks/useFormAutosave.js +49 -122
- package/dist/hooks/useLongPressRepeat.js +20 -55
- package/dist/index.d.ts +2 -3
- package/dist/index.js +3 -4
- package/package.json +3 -4
- package/dist/components/inputs/FormField/formField.cva.d.ts +0 -11
- package/dist/components/inputs/FormField/formField.cva.js +0 -16
- package/dist/components/table/TableColumnFilterInput.d.ts +0 -9
- package/dist/components/table/TableColumnFilterInput.js +0 -108
- package/dist/components/table/TableColumnFilterPlaceholder.d.ts +0 -5
- package/dist/components/table/TableColumnFilterPlaceholder.js +0 -41
- package/dist/components/table/TableColumnFilterRow.d.ts +0 -16
- package/dist/components/table/TableColumnFilterRow.js +0 -68
- package/dist/hooks/useAutosave.spec.d.ts +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
2
2
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
|
+
import { FieldController } from "../../shared/form.binding.js";
|
|
3
4
|
import { FormField } from "../../FormField/FormField.js";
|
|
4
5
|
import { Calendar } from "../shared/Calendar.js";
|
|
5
6
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
@@ -12,20 +13,17 @@ import { getStaticCalendarDateTimeSegments, getStaticDateTimeFocusTarget } from
|
|
|
12
13
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
13
14
|
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
14
15
|
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
15
|
-
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
16
|
-
import { c } from "react/compiler-runtime";
|
|
17
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
17
|
import { clsx } from "clsx";
|
|
19
18
|
import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
20
19
|
import { useDatePicker, useLocale } from "react-aria";
|
|
21
20
|
import { mergeRefs } from "@react-aria/utils";
|
|
22
|
-
import { Controller } from "react-hook-form";
|
|
23
21
|
import { Time, createCalendar, getLocalTimeZone, toCalendarDate, toCalendarDateTime, today } from "@internationalized/date";
|
|
24
22
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
25
23
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
26
24
|
var DateTimePickerBase = (props) => {
|
|
27
25
|
const ui = UIConfig.useConfig();
|
|
28
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, shouldShrinkInput, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone: timeZoneProp, autoFixYear: autoFixYearProp,
|
|
26
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, shouldShrinkInput, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone: timeZoneProp, autoFixYear: autoFixYearProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
|
|
29
27
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
30
28
|
const variant = variantProp ?? ui.input.variant;
|
|
31
29
|
const as = asProp ?? ui.input.as;
|
|
@@ -39,7 +37,6 @@ var DateTimePickerBase = (props) => {
|
|
|
39
37
|
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
40
38
|
const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
|
|
41
39
|
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
42
|
-
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
43
40
|
const setDateValueOnDateSelection = setDateValueOnDateSelectionProp ?? ui.dateInput.setDateValueOnDateSelection;
|
|
44
41
|
const timeZone = timeZoneProp ?? ui.dateInput.timeZone;
|
|
45
42
|
let effectiveTimeZone = getLocalTimeZone();
|
|
@@ -70,7 +67,6 @@ var DateTimePickerBase = (props) => {
|
|
|
70
67
|
const handleBlur = (val) => {
|
|
71
68
|
onBlur?.({ target: { value: val } });
|
|
72
69
|
};
|
|
73
|
-
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
74
70
|
const normalizedValue = value ?? null;
|
|
75
71
|
const dialogState = useDatePickerState({
|
|
76
72
|
...rest,
|
|
@@ -91,7 +87,6 @@ var DateTimePickerBase = (props) => {
|
|
|
91
87
|
onChange?.(val_0);
|
|
92
88
|
dialogState.setValue(val_0);
|
|
93
89
|
calendarState.setFocusedDate(val_0 || today(effectiveTimeZone));
|
|
94
|
-
if (fireBlurOnChange) debouncedBlur(val_0);
|
|
95
90
|
},
|
|
96
91
|
shouldCloseOnSelect: false,
|
|
97
92
|
granularity: "minute",
|
|
@@ -130,7 +125,6 @@ var DateTimePickerBase = (props) => {
|
|
|
130
125
|
const newValue = dialogState.value;
|
|
131
126
|
state.setValue(newValue);
|
|
132
127
|
state.toggle();
|
|
133
|
-
if (fireBlurOnChange) handleBlur(newValue);
|
|
134
128
|
};
|
|
135
129
|
const onMonthYearChange = (selectedDate) => {
|
|
136
130
|
if (!shouldUpdateDateOnMonthYearChange) return;
|
|
@@ -155,12 +149,26 @@ var DateTimePickerBase = (props) => {
|
|
|
155
149
|
const onInputClear = () => {
|
|
156
150
|
onChange?.(null);
|
|
157
151
|
dialogState.setValue(null);
|
|
158
|
-
if (fireBlurOnChange) handleBlur(null);
|
|
159
152
|
};
|
|
160
|
-
const
|
|
153
|
+
const syncDialogFromControlledValue = () => {
|
|
154
|
+
dialogState.setValue(state.value);
|
|
155
|
+
if (state.value) {
|
|
156
|
+
calendarState.setFocusedDate(state.value);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
calendarState.setFocusedDate(today(effectiveTimeZone));
|
|
160
|
+
};
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (!state.isOpen) return;
|
|
163
|
+
syncDialogFromControlledValue();
|
|
164
|
+
}, [state.isOpen]);
|
|
165
|
+
const onOpenChange = (_isOpen) => {
|
|
166
|
+
state.toggle();
|
|
167
|
+
syncDialogFromControlledValue();
|
|
168
|
+
};
|
|
169
|
+
const onOpenDropdown = () => {
|
|
170
|
+
syncDialogFromControlledValue();
|
|
161
171
|
state.toggle();
|
|
162
|
-
calendarState.setFocusedDate(state.value || today(effectiveTimeZone));
|
|
163
|
-
if (!isOpen) dialogState.setValue(state.value);
|
|
164
172
|
};
|
|
165
173
|
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
166
174
|
as,
|
|
@@ -205,12 +213,11 @@ var DateTimePickerBase = (props) => {
|
|
|
205
213
|
disableManualEntry,
|
|
206
214
|
autoFixYear,
|
|
207
215
|
placeholder,
|
|
208
|
-
onOpenDropdown
|
|
216
|
+
onOpenDropdown,
|
|
209
217
|
className: inputClassName,
|
|
210
218
|
timeZone: effectiveTimeZone,
|
|
211
219
|
isTimeOptional,
|
|
212
220
|
format,
|
|
213
|
-
fireBlurOnChange,
|
|
214
221
|
onClear: onInputClear
|
|
215
222
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
216
223
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
@@ -239,9 +246,7 @@ var DateTimePickerBase = (props) => {
|
|
|
239
246
|
})
|
|
240
247
|
});
|
|
241
248
|
};
|
|
242
|
-
var DateTimePickerInner = (
|
|
243
|
-
const $ = c(9);
|
|
244
|
-
const { fullIso: t1, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
249
|
+
var DateTimePickerInner = ({ fullIso: _fullIso = true, renderStaticInput, isFormControlDisabled, ...props }) => {
|
|
245
250
|
const ui = UIConfig.useConfig();
|
|
246
251
|
const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRowDefinition);
|
|
247
252
|
const { locale } = useLocale();
|
|
@@ -252,8 +257,15 @@ var DateTimePickerInner = (t0) => {
|
|
|
252
257
|
inputRef,
|
|
253
258
|
renderInput,
|
|
254
259
|
setRenderInput,
|
|
255
|
-
getFocusTarget:
|
|
256
|
-
|
|
260
|
+
getFocusTarget: (input, staticTarget) => {
|
|
261
|
+
const container = input.getContainer?.() ?? input;
|
|
262
|
+
return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
|
|
263
|
+
},
|
|
264
|
+
getPressTarget: (input_0) => {
|
|
265
|
+
const container_0 = input_0.getContainer?.() ?? input_0;
|
|
266
|
+
if (!(container_0 instanceof HTMLElement)) return null;
|
|
267
|
+
return container_0.querySelector("[data-static-press-action]");
|
|
268
|
+
}
|
|
257
269
|
});
|
|
258
270
|
const normalizedValue = props.value ?? null;
|
|
259
271
|
const timeZone = props.timeZone ?? ui.dateInput.timeZone;
|
|
@@ -323,137 +335,46 @@ var DateTimePickerInner = (t0) => {
|
|
|
323
335
|
trailingClassName: "py-0! pl-0!",
|
|
324
336
|
action: showDropdown ? {
|
|
325
337
|
icon: ui.dateInput.dateTimeIcon,
|
|
326
|
-
onClick:
|
|
338
|
+
onClick: () => {},
|
|
327
339
|
altText: ""
|
|
328
340
|
} : void 0,
|
|
329
341
|
children: staticSegments
|
|
330
342
|
});
|
|
331
343
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
$[0] = formatDateValue;
|
|
339
|
-
$[1] = props;
|
|
340
|
-
$[2] = t4;
|
|
341
|
-
} else t4 = $[2];
|
|
342
|
-
let t5;
|
|
343
|
-
if ($[3] !== T0 || $[4] !== props || $[5] !== t2 || $[6] !== t3 || $[7] !== t4) {
|
|
344
|
-
t5 = /* @__PURE__ */ jsx(T0, {
|
|
345
|
-
...props,
|
|
346
|
-
ref: t2,
|
|
347
|
-
value: t3,
|
|
348
|
-
onChange: t4
|
|
349
|
-
});
|
|
350
|
-
$[3] = T0;
|
|
351
|
-
$[4] = props;
|
|
352
|
-
$[5] = t2;
|
|
353
|
-
$[6] = t3;
|
|
354
|
-
$[7] = t4;
|
|
355
|
-
$[8] = t5;
|
|
356
|
-
} else t5 = $[8];
|
|
357
|
-
return t5;
|
|
344
|
+
return /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
345
|
+
...props,
|
|
346
|
+
ref: mergeRefs(props.ref, inputRef),
|
|
347
|
+
value: parseDateValue(normalizedValue),
|
|
348
|
+
onChange: (value) => props.onChange?.(formatDateValue(value))
|
|
349
|
+
});
|
|
358
350
|
};
|
|
359
|
-
var DateTimePicker = (
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
let ref;
|
|
380
|
-
if ($[4] !== props) {
|
|
381
|
-
({formControl, ref, ...innerProps} = props);
|
|
382
|
-
$[4] = props;
|
|
383
|
-
$[5] = formControl;
|
|
384
|
-
$[6] = innerProps;
|
|
385
|
-
$[7] = ref;
|
|
386
|
-
} else {
|
|
387
|
-
formControl = $[5];
|
|
388
|
-
innerProps = $[6];
|
|
389
|
-
ref = $[7];
|
|
390
|
-
}
|
|
391
|
-
const controlWithOptions = formControl.control;
|
|
392
|
-
let t2;
|
|
393
|
-
if ($[8] !== controlWithOptions._options?.disabled || $[9] !== fullIso || $[10] !== innerProps || $[11] !== props.error || $[12] !== props.isDisabled || $[13] !== ref || $[14] !== renderStaticInput) {
|
|
394
|
-
t2 = (t3) => {
|
|
395
|
-
const { field, fieldState: t4 } = t3;
|
|
396
|
-
const { error, isDirty } = t4;
|
|
397
|
-
return /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
398
|
-
...innerProps,
|
|
399
|
-
ref: mergeRefs(ref, field.ref),
|
|
400
|
-
value: field.value ?? null,
|
|
401
|
-
onChange: field.onChange,
|
|
402
|
-
onBlur: field.onBlur,
|
|
403
|
-
isDirty,
|
|
404
|
-
isDisabled: field.disabled || props.isDisabled,
|
|
405
|
-
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
406
|
-
error: props.error ?? error?.message,
|
|
407
|
-
fullIso,
|
|
408
|
-
renderStaticInput
|
|
409
|
-
});
|
|
410
|
-
};
|
|
411
|
-
$[8] = controlWithOptions._options?.disabled;
|
|
412
|
-
$[9] = fullIso;
|
|
413
|
-
$[10] = innerProps;
|
|
414
|
-
$[11] = props.error;
|
|
415
|
-
$[12] = props.isDisabled;
|
|
416
|
-
$[13] = ref;
|
|
417
|
-
$[14] = renderStaticInput;
|
|
418
|
-
$[15] = t2;
|
|
419
|
-
} else t2 = $[15];
|
|
420
|
-
let t3;
|
|
421
|
-
if ($[16] !== formControl.control || $[17] !== formControl.name || $[18] !== t2) {
|
|
422
|
-
t3 = /* @__PURE__ */ jsx(Controller, {
|
|
423
|
-
control: formControl.control,
|
|
424
|
-
name: formControl.name,
|
|
425
|
-
render: t2
|
|
426
|
-
});
|
|
427
|
-
$[16] = formControl.control;
|
|
428
|
-
$[17] = formControl.name;
|
|
429
|
-
$[18] = t2;
|
|
430
|
-
$[19] = t3;
|
|
431
|
-
} else t3 = $[19];
|
|
432
|
-
return t3;
|
|
433
|
-
}
|
|
434
|
-
let t2;
|
|
435
|
-
if ($[20] !== fullIso || $[21] !== props || $[22] !== renderStaticInput) {
|
|
436
|
-
t2 = /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
437
|
-
...props,
|
|
438
|
-
fullIso,
|
|
439
|
-
renderStaticInput
|
|
351
|
+
var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
352
|
+
if ("field" in props && props.field) {
|
|
353
|
+
const { field, ref, ...innerProps } = props;
|
|
354
|
+
const controlWithOptions = field.form;
|
|
355
|
+
return /* @__PURE__ */ jsx(FieldController, {
|
|
356
|
+
control: field.form,
|
|
357
|
+
name: field.name,
|
|
358
|
+
render: ({ field: field_0, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
359
|
+
...innerProps,
|
|
360
|
+
ref: mergeRefs(ref, field_0.ref),
|
|
361
|
+
value: field_0.value ?? null,
|
|
362
|
+
onChange: field_0.onChange,
|
|
363
|
+
onBlur: field_0.onBlur,
|
|
364
|
+
isDirty,
|
|
365
|
+
isDisabled: field_0.disabled || props.isDisabled,
|
|
366
|
+
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
367
|
+
error: props.error ?? error?.message,
|
|
368
|
+
fullIso,
|
|
369
|
+
renderStaticInput
|
|
370
|
+
})
|
|
440
371
|
});
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
372
|
+
}
|
|
373
|
+
return /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
374
|
+
...props,
|
|
375
|
+
fullIso,
|
|
376
|
+
renderStaticInput
|
|
377
|
+
});
|
|
447
378
|
};
|
|
448
|
-
function _temp(input, staticTarget) {
|
|
449
|
-
const container = input.getContainer?.() ?? input;
|
|
450
|
-
return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
|
|
451
|
-
}
|
|
452
|
-
function _temp2(input_0) {
|
|
453
|
-
const container_0 = input_0.getContainer?.() ?? input_0;
|
|
454
|
-
if (!(container_0 instanceof HTMLElement)) return null;
|
|
455
|
-
return container_0.querySelector("[data-static-press-action]");
|
|
456
|
-
}
|
|
457
|
-
function _temp3() {}
|
|
458
379
|
//#endregion
|
|
459
380
|
export { DateTimePicker };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref, FocusEvent } from 'react';
|
|
2
2
|
import { AriaTimeFieldProps, TimeValue } from 'react-aria';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from '../../shared/form.binding';
|
|
4
4
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
5
5
|
import { ControlProps } from '../../shared/form.types';
|
|
6
6
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
@@ -14,7 +14,6 @@ interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Ar
|
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
inputClassName?: string;
|
|
16
16
|
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
17
|
-
fireBlurOnChange?: boolean;
|
|
18
17
|
shouldForceLeadingZeros?: boolean;
|
|
19
18
|
}
|
|
20
19
|
export interface TimePickerProps extends Omit<TimePickerBaseProps, "value" | "onChange"> {
|