@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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1115,6 +1115,8 @@ interface DatePickerLabels {
|
|
|
1115
1115
|
rangeDialog: string;
|
|
1116
1116
|
openCalendar: string;
|
|
1117
1117
|
openCalendarHint: string;
|
|
1118
|
+
/** PRE-LOCALIZED empty-field placeholder; empty = the locale's pattern, en-GB `dd/mm/yyyy`. */
|
|
1119
|
+
datePlaceholder: string;
|
|
1118
1120
|
previousMonth: string;
|
|
1119
1121
|
nextMonth: string;
|
|
1120
1122
|
monthHint: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1115,6 +1115,8 @@ interface DatePickerLabels {
|
|
|
1115
1115
|
rangeDialog: string;
|
|
1116
1116
|
openCalendar: string;
|
|
1117
1117
|
openCalendarHint: string;
|
|
1118
|
+
/** PRE-LOCALIZED empty-field placeholder; empty = the locale's pattern, en-GB `dd/mm/yyyy`. */
|
|
1119
|
+
datePlaceholder: string;
|
|
1118
1120
|
previousMonth: string;
|
|
1119
1121
|
nextMonth: string;
|
|
1120
1122
|
monthHint: string;
|
package/dist/index.js
CHANGED
|
@@ -3124,6 +3124,7 @@ var DEFAULT_DATE_PICKER_LABELS = {
|
|
|
3124
3124
|
rangeDialog: "Choose a date range",
|
|
3125
3125
|
openCalendar: "Open calendar",
|
|
3126
3126
|
openCalendarHint: "Opens a calendar to pick the date",
|
|
3127
|
+
datePlaceholder: "",
|
|
3127
3128
|
previousMonth: "Previous month",
|
|
3128
3129
|
nextMonth: "Next month",
|
|
3129
3130
|
monthHint: "Shows another month",
|
|
@@ -3678,6 +3679,14 @@ function closedFieldMinWidth(text, iconRoom) {
|
|
|
3678
3679
|
return Math.ceil(chars * FONT_PX * GLYPH_EM) + PAD_INLINE + iconRoom + BORDER + BORDER;
|
|
3679
3680
|
}
|
|
3680
3681
|
|
|
3682
|
+
// src/DatePicker/utils/datePattern.ts
|
|
3683
|
+
var SAMPLE = new Date(Date.UTC(2027, 5, 12));
|
|
3684
|
+
var PART_TOKEN = { day: "dd", month: "mm", year: "yyyy" };
|
|
3685
|
+
function datePattern(locale) {
|
|
3686
|
+
const parts = new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric", timeZone: "UTC" }).formatToParts(SAMPLE);
|
|
3687
|
+
return parts.map((part) => PART_TOKEN[part.type] ?? part.value).join("");
|
|
3688
|
+
}
|
|
3689
|
+
|
|
3681
3690
|
// src/DatePicker/utils/typedEdit.ts
|
|
3682
3691
|
var DELETE_KEYS = /* @__PURE__ */ new Set(["Backspace", "Delete"]);
|
|
3683
3692
|
function isPrintable(event) {
|
|
@@ -3728,7 +3737,7 @@ var ICON_SLOT = { position: "absolute", right: 2, top: 0, bottom: 0, display: "f
|
|
|
3728
3737
|
var anchorStyles = reactNative.StyleSheet.create({ wrap: { position: "relative", width: "100%" } });
|
|
3729
3738
|
function DatePickerInput({ fieldProps, context, onTypedError }) {
|
|
3730
3739
|
const { label, value, onChange, onSubmit, accessibilityHint, testID, required, disabled = false, min, max } = fieldProps;
|
|
3731
|
-
const { labels, display } = useDatePickerConfig();
|
|
3740
|
+
const { labels, display, locale } = useDatePickerConfig();
|
|
3732
3741
|
const phone = useIsPhone();
|
|
3733
3742
|
const [open, setOpen] = React41.useState(false);
|
|
3734
3743
|
const anchorRef = React41.useRef(null);
|
|
@@ -3770,6 +3779,7 @@ function DatePickerInput({ fieldProps, context, onTypedError }) {
|
|
|
3770
3779
|
"data-testid": testID,
|
|
3771
3780
|
disabled,
|
|
3772
3781
|
id: context.controlId,
|
|
3782
|
+
placeholder: labels.datePlaceholder !== "" ? labels.datePlaceholder : datePattern(locale),
|
|
3773
3783
|
style: { ...buildNativeInputStyle(style, look), paddingInlineEnd: ICON_ROOM },
|
|
3774
3784
|
title: accessibilityHint,
|
|
3775
3785
|
type: "text",
|