@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!", as === "inline" && "h-full"),
44
- children: [leadingVisual && /* @__PURE__ */ jsx("div", {
45
- className: "pointer-events-none shrink-0",
46
- children: leadingVisual
47
- }), /* @__PURE__ */ jsxs("div", {
48
- className: clsx("flex w-full truncate", as === "floating" && "flex-col", as === "filter" && "gap-input-gap-input-text-to-elements", contentRowClassName),
49
- children: [
50
- as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
51
- as,
52
- size,
53
- label: formFieldProps.label,
54
- isRequired: formFieldProps.isRequired,
55
- isDisabled: formFieldProps.isDisabled
56
- }),
57
- leadingContent && /* @__PURE__ */ jsx("div", {
58
- className: "ml-input-side-default flex shrink-0 items-center",
59
- children: leadingContent
60
- }),
61
- /* @__PURE__ */ jsxs("div", {
62
- className: clsx("w-full truncate", !hasValue && "text-text-default-3"),
63
- children: [staticDisplayContent, shouldRenderFloatingLineSpacer && /* @__PURE__ */ jsx(Fragment, { children: "\xA0" })]
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 mapTypeToPlaceholder = (type) => {
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 "dd";
45
- case "month": return "mm";
46
- case "year": return "yyyy";
47
- case "hour": return "hh";
48
- case "minute": return "mm";
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.17",
3
+ "version": "2.2.9-rc.18",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",