@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.mjs
CHANGED
|
@@ -1456,12 +1456,16 @@ function isFitSize(size) {
|
|
|
1456
1456
|
}
|
|
1457
1457
|
|
|
1458
1458
|
// src/ChipSelector/utils/chipLook.ts
|
|
1459
|
-
function chipFill({ selected, selectedFill, ink, onDarkInk, rest }) {
|
|
1459
|
+
function chipFill({ selected, selectedFill, ink, onDarkInk, lightInk, rest }) {
|
|
1460
1460
|
if (!selected || selectedFill === void 0)
|
|
1461
1461
|
return { ...rest, checkColor: void 0 };
|
|
1462
|
-
const fillInk =
|
|
1462
|
+
const fillInk = isDarkColor(selectedFill) ? darkFillInk(onDarkInk, lightInk, ink) : ink;
|
|
1463
1463
|
return { backgroundColor: selectedFill, textColor: fillInk, checkColor: fillInk };
|
|
1464
1464
|
}
|
|
1465
|
+
function darkFillInk(onDarkInk, lightInk, ink) {
|
|
1466
|
+
if (onDarkInk === void 0) return ink;
|
|
1467
|
+
return isDarkColor(onDarkInk) && lightInk !== void 0 ? lightInk : onDarkInk;
|
|
1468
|
+
}
|
|
1465
1469
|
var HEX_RGB = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;
|
|
1466
1470
|
var FN_RGB = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i;
|
|
1467
1471
|
var DARK_LUMINANCE = 0.4;
|
|
@@ -1562,6 +1566,7 @@ function OutlineChip(props) {
|
|
|
1562
1566
|
selectedFill: props.selectedFill,
|
|
1563
1567
|
ink: colors.textStrong,
|
|
1564
1568
|
onDarkInk: colors.onPrimary,
|
|
1569
|
+
lightInk: colors.surface,
|
|
1565
1570
|
rest: outlineRest(colors, { tone: props.outlineTone, selected, active })
|
|
1566
1571
|
});
|
|
1567
1572
|
const sized = chipSizeLook(props.size);
|
|
@@ -1605,6 +1610,7 @@ function SolidChip(props) {
|
|
|
1605
1610
|
selectedFill: props.selectedFill,
|
|
1606
1611
|
ink: colors.textStrong,
|
|
1607
1612
|
onDarkInk: colors.onPrimary,
|
|
1613
|
+
lightInk: colors.surface,
|
|
1608
1614
|
rest: { backgroundColor: selected ? colors.primary : TRANSPARENT_COLOR, textColor: selected ? colors.onPrimary : colors.textStrong }
|
|
1609
1615
|
});
|
|
1610
1616
|
const sized = chipSizeLook(props.size);
|
|
@@ -3117,6 +3123,7 @@ var DEFAULT_DATE_PICKER_LABELS = {
|
|
|
3117
3123
|
rangeDialog: "Choose a date range",
|
|
3118
3124
|
openCalendar: "Open calendar",
|
|
3119
3125
|
openCalendarHint: "Opens a calendar to pick the date",
|
|
3126
|
+
datePlaceholder: "",
|
|
3120
3127
|
previousMonth: "Previous month",
|
|
3121
3128
|
nextMonth: "Next month",
|
|
3122
3129
|
monthHint: "Shows another month",
|
|
@@ -3671,6 +3678,14 @@ function closedFieldMinWidth(text, iconRoom) {
|
|
|
3671
3678
|
return Math.ceil(chars * FONT_PX * GLYPH_EM) + PAD_INLINE + iconRoom + BORDER + BORDER;
|
|
3672
3679
|
}
|
|
3673
3680
|
|
|
3681
|
+
// src/DatePicker/utils/datePattern.ts
|
|
3682
|
+
var SAMPLE = new Date(Date.UTC(2027, 5, 12));
|
|
3683
|
+
var PART_TOKEN = { day: "dd", month: "mm", year: "yyyy" };
|
|
3684
|
+
function datePattern(locale) {
|
|
3685
|
+
const parts = new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric", timeZone: "UTC" }).formatToParts(SAMPLE);
|
|
3686
|
+
return parts.map((part) => PART_TOKEN[part.type] ?? part.value).join("");
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3674
3689
|
// src/DatePicker/utils/typedEdit.ts
|
|
3675
3690
|
var DELETE_KEYS = /* @__PURE__ */ new Set(["Backspace", "Delete"]);
|
|
3676
3691
|
function isPrintable(event) {
|
|
@@ -3721,7 +3736,7 @@ var ICON_SLOT = { position: "absolute", right: 2, top: 0, bottom: 0, display: "f
|
|
|
3721
3736
|
var anchorStyles = StyleSheet.create({ wrap: { position: "relative", width: "100%" } });
|
|
3722
3737
|
function DatePickerInput({ fieldProps, context, onTypedError }) {
|
|
3723
3738
|
const { label, value, onChange, onSubmit, accessibilityHint, testID, required, disabled = false, min, max } = fieldProps;
|
|
3724
|
-
const { labels, display } = useDatePickerConfig();
|
|
3739
|
+
const { labels, display, locale } = useDatePickerConfig();
|
|
3725
3740
|
const phone = useIsPhone();
|
|
3726
3741
|
const [open, setOpen] = useState(false);
|
|
3727
3742
|
const anchorRef = useRef(null);
|
|
@@ -3763,6 +3778,7 @@ function DatePickerInput({ fieldProps, context, onTypedError }) {
|
|
|
3763
3778
|
"data-testid": testID,
|
|
3764
3779
|
disabled,
|
|
3765
3780
|
id: context.controlId,
|
|
3781
|
+
placeholder: labels.datePlaceholder !== "" ? labels.datePlaceholder : datePattern(locale),
|
|
3766
3782
|
style: { ...buildNativeInputStyle(style, look), paddingInlineEnd: ICON_ROOM },
|
|
3767
3783
|
title: accessibilityHint,
|
|
3768
3784
|
type: "text",
|