@povio/ui 2.2.9-rc.17 → 2.2.9-rc.18
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.
|
@@ -29,7 +29,7 @@ var Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply,
|
|
|
29
29
|
setToggleState("time");
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
onApply(resolvedDate);
|
|
32
|
+
if (datePickerState?.value && !setDateValueOnDateSelection) onApply(resolvedDate);
|
|
33
33
|
};
|
|
34
34
|
const getContent = () => {
|
|
35
35
|
if (!toggleState) return /* @__PURE__ */ jsx(CalendarGrid, {
|
|
@@ -40,30 +40,28 @@ var StaticInput = ({ onInteract, as, size, variant, applyMinInputWidth, placehol
|
|
|
40
40
|
className: clsx(inputSizeCva({
|
|
41
41
|
size,
|
|
42
42
|
as
|
|
43
|
-
}), "group/input-content flex w-full items-center gap-input-gap-input-text-to-elements pr-0!",
|
|
44
|
-
children: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
as
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
]
|
|
66
|
-
})]
|
|
43
|
+
}), "group/input-content flex w-full items-center gap-input-gap-input-text-to-elements pr-0!", contentRowClassName),
|
|
44
|
+
children: [
|
|
45
|
+
leadingVisual && /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: "pointer-events-none shrink-0",
|
|
47
|
+
children: leadingVisual
|
|
48
|
+
}),
|
|
49
|
+
as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
50
|
+
as,
|
|
51
|
+
size,
|
|
52
|
+
label: formFieldProps.label,
|
|
53
|
+
isRequired: formFieldProps.isRequired,
|
|
54
|
+
isDisabled: formFieldProps.isDisabled
|
|
55
|
+
}),
|
|
56
|
+
leadingContent && /* @__PURE__ */ jsx("div", {
|
|
57
|
+
className: "ml-input-side-default flex shrink-0 items-center",
|
|
58
|
+
children: leadingContent
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ jsxs("div", {
|
|
61
|
+
className: clsx("w-full truncate", !hasValue && "text-text-default-3"),
|
|
62
|
+
children: [staticDisplayContent, shouldRenderFloatingLineSpacer && /* @__PURE__ */ jsx(Fragment, { children: "\xA0" })]
|
|
63
|
+
})
|
|
64
|
+
]
|
|
67
65
|
})
|
|
68
66
|
}), trailingContent && /* @__PURE__ */ jsx("div", {
|
|
69
67
|
className: clsx(inputSizeCva({
|
|
@@ -39,18 +39,23 @@ var DateTimeUtils;
|
|
|
39
39
|
hourCycle: "h23",
|
|
40
40
|
timeZone: "UTC"
|
|
41
41
|
});
|
|
42
|
-
const
|
|
42
|
+
const repeatLocalizedFieldLabel = (type, length, locale) => {
|
|
43
|
+
const placeholderChar = new Intl.DisplayNames(getResolvedLocale(locale), { type: "dateTimeField" }).of(type)?.trim().charAt(0).toLocaleLowerCase(getResolvedLocale(locale));
|
|
44
|
+
if (!placeholderChar) return null;
|
|
45
|
+
return placeholderChar.repeat(length);
|
|
46
|
+
};
|
|
47
|
+
const mapTypeToPlaceholder = (type, locale) => {
|
|
43
48
|
switch (type) {
|
|
44
|
-
case "day": return
|
|
45
|
-
case "month": return
|
|
46
|
-
case "year": return
|
|
47
|
-
case "hour": return
|
|
48
|
-
case "minute": return
|
|
49
|
+
case "day": return repeatLocalizedFieldLabel(type, 2, locale);
|
|
50
|
+
case "month": return repeatLocalizedFieldLabel(type, 2, locale);
|
|
51
|
+
case "year": return repeatLocalizedFieldLabel(type, 4, locale);
|
|
52
|
+
case "hour": return repeatLocalizedFieldLabel(type, 2, locale);
|
|
53
|
+
case "minute": return repeatLocalizedFieldLabel(type, 2, locale);
|
|
49
54
|
default: return null;
|
|
50
55
|
}
|
|
51
56
|
};
|
|
52
57
|
const formatPlaceholder = (formatter, sampleDate) => {
|
|
53
|
-
return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type) ?? part.value).join("");
|
|
58
|
+
return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale) ?? part.value.replace(/\s+/gu, "")).join("");
|
|
54
59
|
};
|
|
55
60
|
function getDatePlaceholder(locale) {
|
|
56
61
|
return formatPlaceholder(getDatePlaceholderFormatter(locale), DATE_SAMPLE_DATE_UTC);
|