@dloizides/ui-forms 1.59.0 → 1.60.0

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/index.mjs CHANGED
@@ -3117,6 +3117,7 @@ var DEFAULT_DATE_PICKER_LABELS = {
3117
3117
  rangeDialog: "Choose a date range",
3118
3118
  openCalendar: "Open calendar",
3119
3119
  openCalendarHint: "Opens a calendar to pick the date",
3120
+ datePlaceholder: "",
3120
3121
  previousMonth: "Previous month",
3121
3122
  nextMonth: "Next month",
3122
3123
  monthHint: "Shows another month",
@@ -3671,6 +3672,14 @@ function closedFieldMinWidth(text, iconRoom) {
3671
3672
  return Math.ceil(chars * FONT_PX * GLYPH_EM) + PAD_INLINE + iconRoom + BORDER + BORDER;
3672
3673
  }
3673
3674
 
3675
+ // src/DatePicker/utils/datePattern.ts
3676
+ var SAMPLE = new Date(Date.UTC(2027, 5, 12));
3677
+ var PART_TOKEN = { day: "dd", month: "mm", year: "yyyy" };
3678
+ function datePattern(locale) {
3679
+ const parts = new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric", timeZone: "UTC" }).formatToParts(SAMPLE);
3680
+ return parts.map((part) => PART_TOKEN[part.type] ?? part.value).join("");
3681
+ }
3682
+
3674
3683
  // src/DatePicker/utils/typedEdit.ts
3675
3684
  var DELETE_KEYS = /* @__PURE__ */ new Set(["Backspace", "Delete"]);
3676
3685
  function isPrintable(event) {
@@ -3721,7 +3730,7 @@ var ICON_SLOT = { position: "absolute", right: 2, top: 0, bottom: 0, display: "f
3721
3730
  var anchorStyles = StyleSheet.create({ wrap: { position: "relative", width: "100%" } });
3722
3731
  function DatePickerInput({ fieldProps, context, onTypedError }) {
3723
3732
  const { label, value, onChange, onSubmit, accessibilityHint, testID, required, disabled = false, min, max } = fieldProps;
3724
- const { labels, display } = useDatePickerConfig();
3733
+ const { labels, display, locale } = useDatePickerConfig();
3725
3734
  const phone = useIsPhone();
3726
3735
  const [open, setOpen] = useState(false);
3727
3736
  const anchorRef = useRef(null);
@@ -3763,6 +3772,7 @@ function DatePickerInput({ fieldProps, context, onTypedError }) {
3763
3772
  "data-testid": testID,
3764
3773
  disabled,
3765
3774
  id: context.controlId,
3775
+ placeholder: labels.datePlaceholder !== "" ? labels.datePlaceholder : datePattern(locale),
3766
3776
  style: { ...buildNativeInputStyle(style, look), paddingInlineEnd: ICON_ROOM },
3767
3777
  title: accessibilityHint,
3768
3778
  type: "text",