@dloizides/ui-forms 1.59.0 → 1.61.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 +19 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -3
- 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
|
@@ -1463,12 +1463,16 @@ function isFitSize(size) {
|
|
|
1463
1463
|
}
|
|
1464
1464
|
|
|
1465
1465
|
// src/ChipSelector/utils/chipLook.ts
|
|
1466
|
-
function chipFill({ selected, selectedFill, ink, onDarkInk, rest }) {
|
|
1466
|
+
function chipFill({ selected, selectedFill, ink, onDarkInk, lightInk, rest }) {
|
|
1467
1467
|
if (!selected || selectedFill === void 0)
|
|
1468
1468
|
return { ...rest, checkColor: void 0 };
|
|
1469
|
-
const fillInk =
|
|
1469
|
+
const fillInk = isDarkColor(selectedFill) ? darkFillInk(onDarkInk, lightInk, ink) : ink;
|
|
1470
1470
|
return { backgroundColor: selectedFill, textColor: fillInk, checkColor: fillInk };
|
|
1471
1471
|
}
|
|
1472
|
+
function darkFillInk(onDarkInk, lightInk, ink) {
|
|
1473
|
+
if (onDarkInk === void 0) return ink;
|
|
1474
|
+
return isDarkColor(onDarkInk) && lightInk !== void 0 ? lightInk : onDarkInk;
|
|
1475
|
+
}
|
|
1472
1476
|
var HEX_RGB = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;
|
|
1473
1477
|
var FN_RGB = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i;
|
|
1474
1478
|
var DARK_LUMINANCE = 0.4;
|
|
@@ -1569,6 +1573,7 @@ function OutlineChip(props) {
|
|
|
1569
1573
|
selectedFill: props.selectedFill,
|
|
1570
1574
|
ink: colors.textStrong,
|
|
1571
1575
|
onDarkInk: colors.onPrimary,
|
|
1576
|
+
lightInk: colors.surface,
|
|
1572
1577
|
rest: outlineRest(colors, { tone: props.outlineTone, selected, active })
|
|
1573
1578
|
});
|
|
1574
1579
|
const sized = chipSizeLook(props.size);
|
|
@@ -1612,6 +1617,7 @@ function SolidChip(props) {
|
|
|
1612
1617
|
selectedFill: props.selectedFill,
|
|
1613
1618
|
ink: colors.textStrong,
|
|
1614
1619
|
onDarkInk: colors.onPrimary,
|
|
1620
|
+
lightInk: colors.surface,
|
|
1615
1621
|
rest: { backgroundColor: selected ? colors.primary : TRANSPARENT_COLOR, textColor: selected ? colors.onPrimary : colors.textStrong }
|
|
1616
1622
|
});
|
|
1617
1623
|
const sized = chipSizeLook(props.size);
|
|
@@ -3124,6 +3130,7 @@ var DEFAULT_DATE_PICKER_LABELS = {
|
|
|
3124
3130
|
rangeDialog: "Choose a date range",
|
|
3125
3131
|
openCalendar: "Open calendar",
|
|
3126
3132
|
openCalendarHint: "Opens a calendar to pick the date",
|
|
3133
|
+
datePlaceholder: "",
|
|
3127
3134
|
previousMonth: "Previous month",
|
|
3128
3135
|
nextMonth: "Next month",
|
|
3129
3136
|
monthHint: "Shows another month",
|
|
@@ -3678,6 +3685,14 @@ function closedFieldMinWidth(text, iconRoom) {
|
|
|
3678
3685
|
return Math.ceil(chars * FONT_PX * GLYPH_EM) + PAD_INLINE + iconRoom + BORDER + BORDER;
|
|
3679
3686
|
}
|
|
3680
3687
|
|
|
3688
|
+
// src/DatePicker/utils/datePattern.ts
|
|
3689
|
+
var SAMPLE = new Date(Date.UTC(2027, 5, 12));
|
|
3690
|
+
var PART_TOKEN = { day: "dd", month: "mm", year: "yyyy" };
|
|
3691
|
+
function datePattern(locale) {
|
|
3692
|
+
const parts = new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric", timeZone: "UTC" }).formatToParts(SAMPLE);
|
|
3693
|
+
return parts.map((part) => PART_TOKEN[part.type] ?? part.value).join("");
|
|
3694
|
+
}
|
|
3695
|
+
|
|
3681
3696
|
// src/DatePicker/utils/typedEdit.ts
|
|
3682
3697
|
var DELETE_KEYS = /* @__PURE__ */ new Set(["Backspace", "Delete"]);
|
|
3683
3698
|
function isPrintable(event) {
|
|
@@ -3728,7 +3743,7 @@ var ICON_SLOT = { position: "absolute", right: 2, top: 0, bottom: 0, display: "f
|
|
|
3728
3743
|
var anchorStyles = reactNative.StyleSheet.create({ wrap: { position: "relative", width: "100%" } });
|
|
3729
3744
|
function DatePickerInput({ fieldProps, context, onTypedError }) {
|
|
3730
3745
|
const { label, value, onChange, onSubmit, accessibilityHint, testID, required, disabled = false, min, max } = fieldProps;
|
|
3731
|
-
const { labels, display } = useDatePickerConfig();
|
|
3746
|
+
const { labels, display, locale } = useDatePickerConfig();
|
|
3732
3747
|
const phone = useIsPhone();
|
|
3733
3748
|
const [open, setOpen] = React41.useState(false);
|
|
3734
3749
|
const anchorRef = React41.useRef(null);
|
|
@@ -3770,6 +3785,7 @@ function DatePickerInput({ fieldProps, context, onTypedError }) {
|
|
|
3770
3785
|
"data-testid": testID,
|
|
3771
3786
|
disabled,
|
|
3772
3787
|
id: context.controlId,
|
|
3788
|
+
placeholder: labels.datePlaceholder !== "" ? labels.datePlaceholder : datePattern(locale),
|
|
3773
3789
|
style: { ...buildNativeInputStyle(style, look), paddingInlineEnd: ICON_ROOM },
|
|
3774
3790
|
title: accessibilityHint,
|
|
3775
3791
|
type: "text",
|