@povio/ui 3.4.0-rc.1 → 3.4.0-rc.2
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/dist/components/inputs/DateTime/DatePicker/DatePicker.js +2 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +2 -1
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +6 -4
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +2 -1
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +2 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +3 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +2 -2
- package/dist/components/inputs/Skeleton/InputFrame.js +5 -2
- package/dist/components/inputs/shared/InputClear.js +40 -25
- package/package.json +1 -1
|
@@ -340,6 +340,7 @@ var DatePickerInner = ({ fullIso = true, granularity = "day", minValue, maxValue
|
|
|
340
340
|
});
|
|
341
341
|
return /* @__PURE__ */ jsx(InputFrame, {
|
|
342
342
|
...props,
|
|
343
|
+
onClear: () => props.onChange?.(null),
|
|
343
344
|
isDisabled,
|
|
344
345
|
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
345
346
|
inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
|
|
@@ -394,7 +395,7 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
394
395
|
...innerProps,
|
|
395
396
|
ref: mergeRefs(ref, field_0.ref),
|
|
396
397
|
value: field_0.value ?? null,
|
|
397
|
-
onChange: field_0.onChange,
|
|
398
|
+
onChange: (value) => field_0.onChange(value ?? null),
|
|
398
399
|
onBlur: field_0.onBlur,
|
|
399
400
|
isDirty,
|
|
400
401
|
isDisabled: field_0.disabled || props.isDisabled,
|
|
@@ -804,6 +804,7 @@ var DateRangePickerInner = ({ fullIso = true, minValue, maxValue, renderStaticIn
|
|
|
804
804
|
});
|
|
805
805
|
return /* @__PURE__ */ jsx(InputFrame, {
|
|
806
806
|
...props,
|
|
807
|
+
onClear: () => props.onChange?.(null),
|
|
807
808
|
isDisabled,
|
|
808
809
|
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
809
810
|
inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
|
|
@@ -857,7 +858,7 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
857
858
|
...innerProps,
|
|
858
859
|
ref: mergeRefs(ref, field_0.ref),
|
|
859
860
|
value: field_0.value ?? null,
|
|
860
|
-
onChange: field_0.onChange,
|
|
861
|
+
onChange: (value) => field_0.onChange(value ?? null),
|
|
861
862
|
onBlur: field_0.onBlur,
|
|
862
863
|
isDirty,
|
|
863
864
|
isDisabled: field_0.disabled || props.isDisabled,
|
|
@@ -122,9 +122,10 @@ var DateTimePickerBase = (props) => {
|
|
|
122
122
|
labelProps
|
|
123
123
|
};
|
|
124
124
|
const onApply = () => {
|
|
125
|
-
const newValue = dialogState.value;
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
const newValue = dialogState.value ?? null;
|
|
126
|
+
onChange?.(newValue);
|
|
127
|
+
dialogState.setValue(newValue);
|
|
128
|
+
state.close();
|
|
128
129
|
};
|
|
129
130
|
const onMonthYearChange = (selectedDate) => {
|
|
130
131
|
if (!shouldUpdateDateOnMonthYearChange) return;
|
|
@@ -307,6 +308,7 @@ var DateTimePickerInner = ({ fullIso: _fullIso = true, renderStaticInput, isForm
|
|
|
307
308
|
});
|
|
308
309
|
return /* @__PURE__ */ jsx(InputFrame, {
|
|
309
310
|
...props,
|
|
311
|
+
onClear: () => props.onChange?.(null),
|
|
310
312
|
isDisabled,
|
|
311
313
|
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
312
314
|
inputClassName: clsx(props.shouldShrinkInput ? "min-w-0" : "min-w-input-width-min-width", props.inputClassName),
|
|
@@ -359,7 +361,7 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
359
361
|
...innerProps,
|
|
360
362
|
ref: mergeRefs(ref, field_0.ref),
|
|
361
363
|
value: field_0.value ?? null,
|
|
362
|
-
onChange: field_0.onChange,
|
|
364
|
+
onChange: (value) => field_0.onChange(value ?? null),
|
|
363
365
|
onBlur: field_0.onBlur,
|
|
364
366
|
isDirty,
|
|
365
367
|
isDisabled: field_0.disabled || props.isDisabled,
|
|
@@ -494,6 +494,7 @@ var TimePickerInner = (t0) => {
|
|
|
494
494
|
});
|
|
495
495
|
return /* @__PURE__ */ jsx(InputFrame, {
|
|
496
496
|
...props,
|
|
497
|
+
onClear: () => props.onChange?.(null),
|
|
497
498
|
isDisabled,
|
|
498
499
|
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
499
500
|
inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
|
|
@@ -589,7 +590,7 @@ var TimePicker = (t0) => {
|
|
|
589
590
|
...innerProps,
|
|
590
591
|
ref: mergeRefs(ref, field_0.ref),
|
|
591
592
|
value: field_0.value ?? null,
|
|
592
|
-
onChange: field_0.onChange,
|
|
593
|
+
onChange: (value) => field_0.onChange(value ?? null),
|
|
593
594
|
onBlur: field_0.onBlur,
|
|
594
595
|
isDirty,
|
|
595
596
|
isDisabled: field_0.disabled || props.isDisabled,
|
|
@@ -15,6 +15,7 @@ interface DateFieldProps extends Omit<DateFieldStateOptions, "locale" | "createC
|
|
|
15
15
|
timeZone?: string;
|
|
16
16
|
segmentGroup?: string;
|
|
17
17
|
shouldAutoFixYear?: boolean;
|
|
18
|
+
preserveNullValue?: boolean;
|
|
18
19
|
}
|
|
19
|
-
export declare const DateField: ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity, isTimeOptional, format, timeZone, segmentGroup, shouldAutoFixYear, ...props }: DateFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const DateField: ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity, isTimeOptional, format, timeZone, segmentGroup, shouldAutoFixYear, preserveNullValue, ...props }: DateFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
export {};
|
|
@@ -9,10 +9,10 @@ import { DateTime } from "luxon";
|
|
|
9
9
|
import { useDateFieldState } from "react-stately";
|
|
10
10
|
//#region src/components/inputs/DateTime/shared/DateField.tsx
|
|
11
11
|
var omitNullValue = ({ value: _value, ...props }) => props;
|
|
12
|
-
var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity = "day", isTimeOptional = false, format, timeZone, segmentGroup, shouldAutoFixYear = false, ...props }) => {
|
|
12
|
+
var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity = "day", isTimeOptional = false, format, timeZone, segmentGroup, shouldAutoFixYear = false, preserveNullValue = false, ...props }) => {
|
|
13
13
|
const { locale } = useLocale();
|
|
14
14
|
const previousValueRef = useRef(props.value);
|
|
15
|
-
const dateFieldProps = props.value == null ? omitNullValue(props) : props;
|
|
15
|
+
const dateFieldProps = props.value == null && !preserveNullValue ? omitNullValue(props) : props;
|
|
16
16
|
const state = useDateFieldState({
|
|
17
17
|
...dateFieldProps,
|
|
18
18
|
isDisabled,
|
|
@@ -51,10 +51,10 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, fieldVa
|
|
|
51
51
|
shouldAutoFixYear: autoFixYear
|
|
52
52
|
} : void 0;
|
|
53
53
|
const clearInput = useCallback(() => {
|
|
54
|
-
dateFieldRef.current?.clearField();
|
|
55
|
-
endDateFieldRef.current?.clearField();
|
|
56
54
|
if (onClearProp) onClearProp();
|
|
57
55
|
else {
|
|
56
|
+
dateFieldRef.current?.clearField();
|
|
57
|
+
endDateFieldRef.current?.clearField();
|
|
58
58
|
fieldProps.onChange?.(null);
|
|
59
59
|
endFieldProps?.onChange?.(null);
|
|
60
60
|
}
|
|
@@ -150,6 +150,7 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, fieldVa
|
|
|
150
150
|
disableManualEntry,
|
|
151
151
|
dateGranularity,
|
|
152
152
|
isTimeOptional,
|
|
153
|
+
preserveNullValue: isValueControlled && !endFieldProps,
|
|
153
154
|
format,
|
|
154
155
|
timeZone: effectiveTimeZone,
|
|
155
156
|
segmentGroup: normalizedEndFieldProps ? "start" : void 0
|
|
@@ -150,8 +150,8 @@ var TimePickerInput = (t0) => {
|
|
|
150
150
|
if ($[33] !== canClear || $[34] !== isClearable || $[35] !== onClear || $[36] !== state) {
|
|
151
151
|
t23 = isClearable && /* @__PURE__ */ jsx(InputClear, {
|
|
152
152
|
onClear: () => {
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
if (onClear) onClear();
|
|
154
|
+
else state.setValue(null);
|
|
155
155
|
},
|
|
156
156
|
show: canClear
|
|
157
157
|
});
|
|
@@ -152,6 +152,7 @@ var InputFrame = (props) => {
|
|
|
152
152
|
}) : /* @__PURE__ */ jsxs(Fragment, { children: [contentRow, trailingRow] });
|
|
153
153
|
const shouldReplayStaticPress = (target) => staticPressTarget === "frame" || target instanceof Element && !!target.closest("[data-static-press-action]");
|
|
154
154
|
const isStaticPressActionTarget = (target_0) => target_0 instanceof Element && !!target_0.closest("[data-static-press-action]");
|
|
155
|
+
const isStaticClearActionTarget = (target_1) => target_1 instanceof Element && !!target_1.closest("[data-static-clear-action]");
|
|
155
156
|
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
156
157
|
as,
|
|
157
158
|
error,
|
|
@@ -170,7 +171,7 @@ var InputFrame = (props) => {
|
|
|
170
171
|
},
|
|
171
172
|
onFocusCapture: (event_0) => {
|
|
172
173
|
onFocusCapture?.(event_0);
|
|
173
|
-
if (pendingStaticPressPointerIdRef.current == null) onStaticInteract?.(true, event_0.target);
|
|
174
|
+
if (pendingStaticPressPointerIdRef.current == null && !isStaticClearActionTarget(event_0.target)) onStaticInteract?.(true, event_0.target);
|
|
174
175
|
},
|
|
175
176
|
children: /* @__PURE__ */ jsx("div", {
|
|
176
177
|
ref,
|
|
@@ -181,9 +182,10 @@ var InputFrame = (props) => {
|
|
|
181
182
|
}), inputClassName),
|
|
182
183
|
tabIndex: isDisabled ? -1 : 0,
|
|
183
184
|
onFocus: (event_1) => {
|
|
184
|
-
if (pendingStaticPressPointerIdRef.current == null) onStaticInteract?.(true, event_1.target);
|
|
185
|
+
if (pendingStaticPressPointerIdRef.current == null && !isStaticClearActionTarget(event_1.target)) onStaticInteract?.(true, event_1.target);
|
|
185
186
|
},
|
|
186
187
|
onClick: (event_2) => {
|
|
188
|
+
if (isStaticClearActionTarget(event_2.target)) return;
|
|
187
189
|
if (onStaticPress && shouldReplayStaticPress(event_2.target)) {
|
|
188
190
|
onStaticPress();
|
|
189
191
|
return;
|
|
@@ -194,6 +196,7 @@ var InputFrame = (props) => {
|
|
|
194
196
|
if (onStaticPress && shouldReplayStaticPress(event_3.target) || isStaticPressActionTarget(event_3.target)) pendingStaticPressPointerIdRef.current = event_3.pointerId;
|
|
195
197
|
},
|
|
196
198
|
onPointerDown: (event_4) => {
|
|
199
|
+
if (isStaticClearActionTarget(event_4.target)) return;
|
|
197
200
|
if (pendingStaticPressPointerIdRef.current === event_4.pointerId) return;
|
|
198
201
|
if (onStaticPress && shouldReplayStaticPress(event_4.target)) {
|
|
199
202
|
pendingStaticPressPointerIdRef.current = event_4.pointerId;
|
|
@@ -8,56 +8,68 @@ import { clsx } from "clsx";
|
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
9
9
|
//#region src/components/inputs/shared/InputClear.tsx
|
|
10
10
|
var InputClear = (t0) => {
|
|
11
|
-
const $ = c(
|
|
11
|
+
const $ = c(16);
|
|
12
12
|
const { onClear, className, style, show, renderStatic } = t0;
|
|
13
|
-
const
|
|
13
|
+
const ui = UIConfig.useConfig();
|
|
14
|
+
const { t } = useTranslation("ui");
|
|
15
|
+
const alwaysShowClear = ui.input.alwaysShowClear;
|
|
14
16
|
let clearClassName;
|
|
15
17
|
let t1;
|
|
16
|
-
if ($[0] !== alwaysShowClear || $[1] !== className || $[2] !==
|
|
18
|
+
if ($[0] !== alwaysShowClear || $[1] !== className || $[2] !== onClear || $[3] !== renderStatic || $[4] !== show || $[5] !== style || $[6] !== t) {
|
|
17
19
|
t1 = Symbol.for("react.early_return_sentinel");
|
|
18
20
|
bb0: {
|
|
19
21
|
clearClassName = clsx("relative z-raised flex items-center", !alwaysShowClear && "md:invisible group-focus-within:visible group-hover/date-picker-content:visible group-hover/select-content:visible group-hover/text-area:visible group-hover:visible", "border-0!", !show && "invisible!", className);
|
|
20
22
|
if (renderStatic) {
|
|
21
23
|
let t2;
|
|
22
|
-
if ($[
|
|
23
|
-
t2 =
|
|
24
|
-
$[
|
|
25
|
-
|
|
24
|
+
if ($[9] !== t) {
|
|
25
|
+
t2 = t(_temp);
|
|
26
|
+
$[9] = t;
|
|
27
|
+
$[10] = t2;
|
|
28
|
+
} else t2 = $[10];
|
|
29
|
+
let t3;
|
|
30
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
31
|
+
t3 = /* @__PURE__ */ jsx(CloseIcon, { className: "h-6 w-6 shrink-0" });
|
|
32
|
+
$[11] = t3;
|
|
33
|
+
} else t3 = $[11];
|
|
26
34
|
t1 = /* @__PURE__ */ jsx("button", {
|
|
27
35
|
type: "button",
|
|
28
|
-
"aria-
|
|
36
|
+
"aria-label": t2,
|
|
37
|
+
"data-static-clear-action": true,
|
|
29
38
|
tabIndex: -1,
|
|
39
|
+
onClick: onClear,
|
|
30
40
|
className: clsx("group inline-flex items-center justify-center border border-solid border-support-transparent-outline", "rounded-button-rounding-s p-0 text-interactive-text-secondary-idle", clearClassName),
|
|
31
41
|
style,
|
|
32
|
-
children:
|
|
42
|
+
children: t3
|
|
33
43
|
});
|
|
34
44
|
break bb0;
|
|
35
45
|
}
|
|
36
46
|
}
|
|
37
47
|
$[0] = alwaysShowClear;
|
|
38
48
|
$[1] = className;
|
|
39
|
-
$[2] =
|
|
40
|
-
$[3] =
|
|
41
|
-
$[4] =
|
|
42
|
-
$[5] =
|
|
43
|
-
$[6] =
|
|
49
|
+
$[2] = onClear;
|
|
50
|
+
$[3] = renderStatic;
|
|
51
|
+
$[4] = show;
|
|
52
|
+
$[5] = style;
|
|
53
|
+
$[6] = t;
|
|
54
|
+
$[7] = clearClassName;
|
|
55
|
+
$[8] = t1;
|
|
44
56
|
} else {
|
|
45
|
-
clearClassName = $[
|
|
46
|
-
t1 = $[
|
|
57
|
+
clearClassName = $[7];
|
|
58
|
+
t1 = $[8];
|
|
47
59
|
}
|
|
48
60
|
if (t1 !== Symbol.for("react.early_return_sentinel")) return t1;
|
|
49
61
|
let t2;
|
|
50
|
-
if ($[
|
|
62
|
+
if ($[12] !== clearClassName || $[13] !== onClear || $[14] !== style) {
|
|
51
63
|
t2 = /* @__PURE__ */ jsx(InputClearButton, {
|
|
52
64
|
onClear,
|
|
53
65
|
className: clearClassName,
|
|
54
66
|
style
|
|
55
67
|
});
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
} else t2 = $[
|
|
68
|
+
$[12] = clearClassName;
|
|
69
|
+
$[13] = onClear;
|
|
70
|
+
$[14] = style;
|
|
71
|
+
$[15] = t2;
|
|
72
|
+
} else t2 = $[15];
|
|
61
73
|
return t2;
|
|
62
74
|
};
|
|
63
75
|
var InputClearButton = (t0) => {
|
|
@@ -66,7 +78,7 @@ var InputClearButton = (t0) => {
|
|
|
66
78
|
const { t } = useTranslation("ui");
|
|
67
79
|
let t1;
|
|
68
80
|
if ($[0] !== t) {
|
|
69
|
-
t1 = t(
|
|
81
|
+
t1 = t(_temp2);
|
|
70
82
|
$[0] = t;
|
|
71
83
|
$[1] = t1;
|
|
72
84
|
} else t1 = $[1];
|
|
@@ -78,7 +90,7 @@ var InputClearButton = (t0) => {
|
|
|
78
90
|
label: t1,
|
|
79
91
|
icon: CloseIcon,
|
|
80
92
|
onPress: onClear,
|
|
81
|
-
onMouseDown:
|
|
93
|
+
onMouseDown: _temp3,
|
|
82
94
|
excludeFromTabOrder: true,
|
|
83
95
|
style
|
|
84
96
|
});
|
|
@@ -93,7 +105,10 @@ var InputClearButton = (t0) => {
|
|
|
93
105
|
function _temp($) {
|
|
94
106
|
return $.ui.clearAlt;
|
|
95
107
|
}
|
|
96
|
-
function _temp2(
|
|
108
|
+
function _temp2($) {
|
|
109
|
+
return $.ui.clearAlt;
|
|
110
|
+
}
|
|
111
|
+
function _temp3(e) {
|
|
97
112
|
return e.preventDefault();
|
|
98
113
|
}
|
|
99
114
|
//#endregion
|