@povio/ui 2.3.0-rc.37 → 2.3.0-rc.39
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 +1 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +2 -2
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +3 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +1 -1
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +45 -48
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +4 -2
- package/dist/utils/date-time.utils.js +7 -10
- package/package.json +1 -1
|
@@ -294,7 +294,7 @@ var DatePickerInner = (t0) => {
|
|
|
294
294
|
let t5;
|
|
295
295
|
if ($[5] !== fullIso || $[6] !== normalizeByGranularity) {
|
|
296
296
|
t5 = (formattedDate) => {
|
|
297
|
-
if (formattedDate == null) return
|
|
297
|
+
if (formattedDate == null) return null;
|
|
298
298
|
if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
|
|
299
299
|
const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
300
300
|
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
|
|
@@ -614,7 +614,7 @@ var DateRangePickerInner = (t0) => {
|
|
|
614
614
|
let t3;
|
|
615
615
|
if ($[2] !== fullIso) {
|
|
616
616
|
t3 = (formattedRange) => {
|
|
617
|
-
if (!formattedRange?.start || !formattedRange?.end) return
|
|
617
|
+
if (!formattedRange?.start || !formattedRange?.end) return null;
|
|
618
618
|
if (fullIso) return {
|
|
619
619
|
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
620
620
|
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
@@ -635,7 +635,7 @@ var DateRangePickerInner = (t0) => {
|
|
|
635
635
|
let t4;
|
|
636
636
|
if ($[4] !== fullIso) {
|
|
637
637
|
t4 = (formattedDate) => {
|
|
638
|
-
if (formattedDate == null) return
|
|
638
|
+
if (formattedDate == null) return null;
|
|
639
639
|
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
640
640
|
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
641
641
|
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
@@ -149,9 +149,6 @@ var DateTimePickerBase = (props) => {
|
|
|
149
149
|
dialogState.setValue(currentValue);
|
|
150
150
|
calendarState.setFocusedDate(toCalendarDate(currentValue));
|
|
151
151
|
};
|
|
152
|
-
const onInputClear = () => {
|
|
153
|
-
onChange?.(null);
|
|
154
|
-
};
|
|
155
152
|
const onOpenChange = (isOpen) => {
|
|
156
153
|
state.toggle();
|
|
157
154
|
calendarState.setFocusedDate(state.value || today(effectiveTimeZone));
|
|
@@ -163,7 +160,7 @@ var DateTimePickerBase = (props) => {
|
|
|
163
160
|
dialogState.setValue(state.value);
|
|
164
161
|
return;
|
|
165
162
|
}
|
|
166
|
-
const textValue = e?.currentTarget
|
|
163
|
+
const textValue = e?.currentTarget?.textContent ?? null;
|
|
167
164
|
const dateTimeValue = DateTimeUtils.formatTextDateToCalendarDateTime(textValue, effectiveTimeZone, locale);
|
|
168
165
|
if (dateTimeValue) {
|
|
169
166
|
state.setValue(dateTimeValue);
|
|
@@ -217,8 +214,7 @@ var DateTimePickerBase = (props) => {
|
|
|
217
214
|
timeZone: effectiveTimeZone,
|
|
218
215
|
isTimeOptional,
|
|
219
216
|
format,
|
|
220
|
-
fireBlurOnChange
|
|
221
|
-
onClear: onInputClear
|
|
217
|
+
fireBlurOnChange
|
|
222
218
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
223
219
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
224
220
|
isDisabled,
|
|
@@ -435,7 +431,7 @@ function _temp2(dateValue) {
|
|
|
435
431
|
return DateTimeUtils.fromDateValueFieldsToUTCISO(dateValue);
|
|
436
432
|
}
|
|
437
433
|
function _temp3(isoString) {
|
|
438
|
-
if (isoString == null) return
|
|
434
|
+
if (isoString == null) return null;
|
|
439
435
|
return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString, "UTC");
|
|
440
436
|
}
|
|
441
437
|
//#endregion
|
|
@@ -606,7 +606,7 @@ function _temp(input) {
|
|
|
606
606
|
return input.querySelector("input, button, [tabindex]:not([tabindex='-1'])");
|
|
607
607
|
}
|
|
608
608
|
function _temp2(isoString) {
|
|
609
|
-
if (isoString == null) return
|
|
609
|
+
if (isoString == null) return null;
|
|
610
610
|
return toTime(DateTimeUtils.fromISOtoZonedDateTime(isoString, "UTC"));
|
|
611
611
|
}
|
|
612
612
|
//#endregion
|
|
@@ -12,6 +12,7 @@ export declare const DateSegmentItem: ({ segment, state, isDisabled, timePickerO
|
|
|
12
12
|
interface DateSegmentItemViewProps {
|
|
13
13
|
ref?: Ref<HTMLDivElement>;
|
|
14
14
|
segmentProps?: HTMLAttributes<HTMLDivElement>;
|
|
15
|
+
role?: HTMLAttributes<HTMLDivElement>["role"];
|
|
15
16
|
type?: DateSegment["type"];
|
|
16
17
|
text: ReactNode;
|
|
17
18
|
placeholder?: ReactNode;
|
|
@@ -21,5 +22,5 @@ interface DateSegmentItemViewProps {
|
|
|
21
22
|
timePickerOnly?: boolean;
|
|
22
23
|
hidePlaceholder?: boolean;
|
|
23
24
|
}
|
|
24
|
-
export declare const DateSegmentItemView: ({ ref, segmentProps, type, text, placeholder, isPlaceholder, isInputEmpty, isDisabled, timePickerOnly, hidePlaceholder, }: DateSegmentItemViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare const DateSegmentItemView: ({ ref, segmentProps, role, type, text, placeholder, isPlaceholder, isInputEmpty, isDisabled, timePickerOnly, hidePlaceholder, }: DateSegmentItemViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export {};
|
|
@@ -55,63 +55,60 @@ var DateSegmentItem = (t0) => {
|
|
|
55
55
|
return t5;
|
|
56
56
|
};
|
|
57
57
|
var DateSegmentItemView = (t0) => {
|
|
58
|
-
const $ = c(
|
|
59
|
-
const { ref, segmentProps, type, text, placeholder, isPlaceholder, isInputEmpty, isDisabled, timePickerOnly, hidePlaceholder } = t0;
|
|
60
|
-
const t1 =
|
|
61
|
-
const t2 =
|
|
62
|
-
const t3 = !isDisabled &&
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
$[0] = timePickerOnly;
|
|
67
|
-
$[1] = type;
|
|
68
|
-
$[2] = t4;
|
|
69
|
-
} else t4 = $[2];
|
|
70
|
-
const t5 = hidePlaceholder && "opacity-0";
|
|
71
|
-
let t6;
|
|
72
|
-
if ($[3] !== t1 || $[4] !== t2 || $[5] !== t3 || $[6] !== t4 || $[7] !== t5) {
|
|
73
|
-
t6 = clsx("box-content rounded-input-rounding-default", t1, t2, t3, "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1", t4, t5);
|
|
74
|
-
$[3] = t1;
|
|
75
|
-
$[4] = t2;
|
|
76
|
-
$[5] = t3;
|
|
77
|
-
$[6] = t4;
|
|
78
|
-
$[7] = t5;
|
|
79
|
-
$[8] = t6;
|
|
80
|
-
} else t6 = $[8];
|
|
58
|
+
const $ = c(18);
|
|
59
|
+
const { ref, segmentProps, role, type, text, placeholder, isPlaceholder, isInputEmpty, isDisabled, timePickerOnly, hidePlaceholder } = t0;
|
|
60
|
+
const t1 = role ?? segmentProps?.role;
|
|
61
|
+
const t2 = isDisabled && "text-interactive-text-secondary-disabled";
|
|
62
|
+
const t3 = !isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1";
|
|
63
|
+
const t4 = !isDisabled && !isInputEmpty && "text-text-default-1";
|
|
64
|
+
const t5 = type && (type === "hour" && !timePickerOnly || type === "dayPeriod") && "ml-1";
|
|
65
|
+
const t6 = hidePlaceholder && "opacity-0";
|
|
81
66
|
let t7;
|
|
82
|
-
if ($[
|
|
83
|
-
t7 =
|
|
67
|
+
if ($[0] !== t2 || $[1] !== t3 || $[2] !== t4 || $[3] !== t5 || $[4] !== t6) {
|
|
68
|
+
t7 = clsx("box-content rounded-input-rounding-default", t2, t3, t4, "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1", t5, t6);
|
|
69
|
+
$[0] = t2;
|
|
70
|
+
$[1] = t3;
|
|
71
|
+
$[2] = t4;
|
|
72
|
+
$[3] = t5;
|
|
73
|
+
$[4] = t6;
|
|
74
|
+
$[5] = t7;
|
|
75
|
+
} else t7 = $[5];
|
|
76
|
+
let t8;
|
|
77
|
+
if ($[6] !== isPlaceholder || $[7] !== placeholder) {
|
|
78
|
+
t8 = isPlaceholder && /* @__PURE__ */ jsx("span", {
|
|
84
79
|
"aria-hidden": "true",
|
|
85
80
|
className: "pointer-events-none",
|
|
86
81
|
children: placeholder
|
|
87
82
|
});
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
} else
|
|
92
|
-
const
|
|
93
|
-
let t9;
|
|
94
|
-
if ($[12] !== t7 || $[13] !== t8) {
|
|
95
|
-
t9 = /* @__PURE__ */ jsxs(Fragment, { children: [t7, t8] });
|
|
96
|
-
$[12] = t7;
|
|
97
|
-
$[13] = t8;
|
|
98
|
-
$[14] = t9;
|
|
99
|
-
} else t9 = $[14];
|
|
83
|
+
$[6] = isPlaceholder;
|
|
84
|
+
$[7] = placeholder;
|
|
85
|
+
$[8] = t8;
|
|
86
|
+
} else t8 = $[8];
|
|
87
|
+
const t9 = isPlaceholder ? "" : text;
|
|
100
88
|
let t10;
|
|
101
|
-
if ($[
|
|
102
|
-
t10 = /* @__PURE__ */
|
|
89
|
+
if ($[9] !== t8 || $[10] !== t9) {
|
|
90
|
+
t10 = /* @__PURE__ */ jsxs(Fragment, { children: [t8, t9] });
|
|
91
|
+
$[9] = t8;
|
|
92
|
+
$[10] = t9;
|
|
93
|
+
$[11] = t10;
|
|
94
|
+
} else t10 = $[11];
|
|
95
|
+
let t11;
|
|
96
|
+
if ($[12] !== ref || $[13] !== segmentProps || $[14] !== t1 || $[15] !== t10 || $[16] !== t7) {
|
|
97
|
+
t11 = /* @__PURE__ */ jsx("div", {
|
|
103
98
|
...segmentProps,
|
|
99
|
+
role: t1,
|
|
104
100
|
ref,
|
|
105
|
-
className:
|
|
106
|
-
children:
|
|
101
|
+
className: t7,
|
|
102
|
+
children: t10
|
|
107
103
|
});
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
$[12] = ref;
|
|
105
|
+
$[13] = segmentProps;
|
|
106
|
+
$[14] = t1;
|
|
107
|
+
$[15] = t10;
|
|
108
|
+
$[16] = t7;
|
|
109
|
+
$[17] = t11;
|
|
110
|
+
} else t11 = $[17];
|
|
111
|
+
return t11;
|
|
115
112
|
};
|
|
116
113
|
//#endregion
|
|
117
114
|
export { DateSegmentItem, DateSegmentItemView, getPlaceholder };
|
|
@@ -17,7 +17,8 @@ var getStaticCalendarDateTimeSegments = ({ value, locale, shouldForceLeadingZero
|
|
|
17
17
|
isPlaceholder: !hasValue,
|
|
18
18
|
isInputEmpty: !hasValue,
|
|
19
19
|
isDisabled,
|
|
20
|
-
hidePlaceholder
|
|
20
|
+
hidePlaceholder,
|
|
21
|
+
segmentRole: "spinbutton"
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
24
|
var getStaticDateRangeSegments = ({ start, end, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
|
|
@@ -62,7 +63,8 @@ var renderStaticSegments = (value, options) => {
|
|
|
62
63
|
isInputEmpty: options.isInputEmpty,
|
|
63
64
|
isDisabled: options.isDisabled,
|
|
64
65
|
timePickerOnly: options.timePickerOnly,
|
|
65
|
-
hidePlaceholder: options.hidePlaceholder
|
|
66
|
+
hidePlaceholder: options.hidePlaceholder,
|
|
67
|
+
role: token.type === "literal" ? void 0 : options.segmentRole
|
|
66
68
|
}, index))
|
|
67
69
|
});
|
|
68
70
|
};
|
|
@@ -4,7 +4,7 @@ import { DateTime } from "luxon";
|
|
|
4
4
|
var DateTimeUtils;
|
|
5
5
|
(function(_DateTimeUtils) {
|
|
6
6
|
const DATE_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22));
|
|
7
|
-
const TIME_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22,
|
|
7
|
+
const TIME_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22, 6, 45));
|
|
8
8
|
const getDayMonthFormat = (shouldForceLeadingZeros = false) => shouldForceLeadingZeros ? "2-digit" : "numeric";
|
|
9
9
|
const getDatePlaceholderFormatter = (locale, options) => new Intl.DateTimeFormat(locale, {
|
|
10
10
|
day: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
@@ -13,8 +13,7 @@ var DateTimeUtils;
|
|
|
13
13
|
});
|
|
14
14
|
const getTimePlaceholderFormatter = (locale) => new Intl.DateTimeFormat(locale, {
|
|
15
15
|
hour: "2-digit",
|
|
16
|
-
minute: "2-digit"
|
|
17
|
-
hourCycle: "h23"
|
|
16
|
+
minute: "2-digit"
|
|
18
17
|
});
|
|
19
18
|
const getResolvedLocale = (locale) => {
|
|
20
19
|
if (locale) return locale;
|
|
@@ -27,18 +26,16 @@ var DateTimeUtils;
|
|
|
27
26
|
timeZone: "UTC"
|
|
28
27
|
});
|
|
29
28
|
const getTimeFormatter = (locale) => new DateFormatter(getResolvedLocale(locale), {
|
|
30
|
-
hour: "
|
|
29
|
+
hour: "numeric",
|
|
31
30
|
minute: "2-digit",
|
|
32
|
-
hourCycle: "h23",
|
|
33
31
|
timeZone: "UTC"
|
|
34
32
|
});
|
|
35
33
|
const getDateTimeFormatter = (locale, options) => new Intl.DateTimeFormat(getResolvedLocale(locale), {
|
|
36
34
|
day: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
37
35
|
month: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
38
36
|
year: "numeric",
|
|
39
|
-
hour: "
|
|
37
|
+
hour: "numeric",
|
|
40
38
|
minute: "2-digit",
|
|
41
|
-
hourCycle: "h23",
|
|
42
39
|
timeZone: "UTC"
|
|
43
40
|
});
|
|
44
41
|
const getLocaleDateFormat = (locale) => {
|
|
@@ -71,9 +68,9 @@ var DateTimeUtils;
|
|
|
71
68
|
}
|
|
72
69
|
};
|
|
73
70
|
const formatPlaceholder = (formatter, sampleDate) => {
|
|
74
|
-
return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale) ?? part.value
|
|
71
|
+
return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale) ?? part.value).join("");
|
|
75
72
|
};
|
|
76
|
-
const removeDateSeparatorSpacing = (value) => value.replace(/([./-])\s+(
|
|
73
|
+
const removeDateSeparatorSpacing = (value) => value.replace(/([./-])\s+(?=[\p{Letter}\p{Number}])/gu, "$1");
|
|
77
74
|
const formatLocalizedDateParts = (formatter, date) => {
|
|
78
75
|
return removeDateSeparatorSpacing(formatter.format(date));
|
|
79
76
|
};
|
|
@@ -89,7 +86,7 @@ var DateTimeUtils;
|
|
|
89
86
|
});
|
|
90
87
|
};
|
|
91
88
|
function getDatePlaceholder(locale, options) {
|
|
92
|
-
return formatPlaceholder(getDatePlaceholderFormatter(locale, options), DATE_SAMPLE_DATE_UTC);
|
|
89
|
+
return removeDateSeparatorSpacing(formatPlaceholder(getDatePlaceholderFormatter(locale, options), DATE_SAMPLE_DATE_UTC));
|
|
93
90
|
}
|
|
94
91
|
_DateTimeUtils.getDatePlaceholder = getDatePlaceholder;
|
|
95
92
|
function getTimePlaceholder(locale) {
|