@butternutbox/pawprint-native 2.0.1 → 2.2.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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +32 -0
- package/dist/index.cjs +111 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +111 -98
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/components/molecules/DatePicker/DatePicker.tsx +17 -6
- package/src/components/molecules/Drawer/DrawerContent.tsx +1 -2
- package/src/components/molecules/SelectField/SelectField.stories.tsx +13 -0
- package/src/components/molecules/SelectField/SelectField.test.tsx +41 -0
- package/src/components/molecules/SelectField/SelectField.tsx +37 -21
package/dist/index.d.cts
CHANGED
|
@@ -1602,6 +1602,7 @@ type SelectFieldOwnProps = {
|
|
|
1602
1602
|
optionalText?: string;
|
|
1603
1603
|
placeholder?: string;
|
|
1604
1604
|
leadingIcon?: React__default.ReactNode;
|
|
1605
|
+
searchable?: boolean;
|
|
1605
1606
|
noResultsText?: string;
|
|
1606
1607
|
errorText?: string;
|
|
1607
1608
|
onSearchQuery?: SelectOptionsResolver;
|
|
@@ -2129,6 +2130,7 @@ type DatePickerOwnProps = {
|
|
|
2129
2130
|
getMonthLabel?: (year: number, month: number, locale?: Locale) => string;
|
|
2130
2131
|
weekDayLabels?: [string, string, string, string, string, string, string];
|
|
2131
2132
|
getDateState?: (date: Date) => DateItemState;
|
|
2133
|
+
getDateAccessibilityLabel?: (date: Date, state: DateItemState, monthLabel: string) => string;
|
|
2132
2134
|
isDateDisabled?: (date: Date) => boolean;
|
|
2133
2135
|
minDate?: Date;
|
|
2134
2136
|
maxDate?: Date;
|
|
@@ -2156,6 +2158,8 @@ type DatePickerProps = DatePickerOwnProps & Omit<ViewProps, keyof DatePickerOwnP
|
|
|
2156
2158
|
* @param {[string,string,string,string,string,string,string]} [weekDayLabels] - Day-column labels Mon→Sun.
|
|
2157
2159
|
* @param {(date: Date) => DateItemState} [getDateState] - Returns the visual state for a date.
|
|
2158
2160
|
* Defaults to: past="previous", today="current", future="default".
|
|
2161
|
+
* @param {(date: Date, state: DateItemState, monthLabel: string) => string} [getDateAccessibilityLabel] - Returns the screen-reader label for a date,
|
|
2162
|
+
* e.g. to announce delivery states. Defaults to "{day} {monthLabel}".
|
|
2159
2163
|
* @param {(date: Date) => boolean} [isDateDisabled] - Returns true to disable a date.
|
|
2160
2164
|
* @param {Date} [minDate] - Dates before this (exclusive of time) will be disabled.
|
|
2161
2165
|
* @param {Date} [maxDate] - Dates after this (exclusive of time) will be disabled.
|
package/dist/index.d.ts
CHANGED
|
@@ -1602,6 +1602,7 @@ type SelectFieldOwnProps = {
|
|
|
1602
1602
|
optionalText?: string;
|
|
1603
1603
|
placeholder?: string;
|
|
1604
1604
|
leadingIcon?: React__default.ReactNode;
|
|
1605
|
+
searchable?: boolean;
|
|
1605
1606
|
noResultsText?: string;
|
|
1606
1607
|
errorText?: string;
|
|
1607
1608
|
onSearchQuery?: SelectOptionsResolver;
|
|
@@ -2129,6 +2130,7 @@ type DatePickerOwnProps = {
|
|
|
2129
2130
|
getMonthLabel?: (year: number, month: number, locale?: Locale) => string;
|
|
2130
2131
|
weekDayLabels?: [string, string, string, string, string, string, string];
|
|
2131
2132
|
getDateState?: (date: Date) => DateItemState;
|
|
2133
|
+
getDateAccessibilityLabel?: (date: Date, state: DateItemState, monthLabel: string) => string;
|
|
2132
2134
|
isDateDisabled?: (date: Date) => boolean;
|
|
2133
2135
|
minDate?: Date;
|
|
2134
2136
|
maxDate?: Date;
|
|
@@ -2156,6 +2158,8 @@ type DatePickerProps = DatePickerOwnProps & Omit<ViewProps, keyof DatePickerOwnP
|
|
|
2156
2158
|
* @param {[string,string,string,string,string,string,string]} [weekDayLabels] - Day-column labels Mon→Sun.
|
|
2157
2159
|
* @param {(date: Date) => DateItemState} [getDateState] - Returns the visual state for a date.
|
|
2158
2160
|
* Defaults to: past="previous", today="current", future="default".
|
|
2161
|
+
* @param {(date: Date, state: DateItemState, monthLabel: string) => string} [getDateAccessibilityLabel] - Returns the screen-reader label for a date,
|
|
2162
|
+
* e.g. to announce delivery states. Defaults to "{day} {monthLabel}".
|
|
2159
2163
|
* @param {(date: Date) => boolean} [isDateDisabled] - Returns true to disable a date.
|
|
2160
2164
|
* @param {Date} [minDate] - Dates before this (exclusive of time) will be disabled.
|
|
2161
2165
|
* @param {Date} [maxDate] - Dates after this (exclusive of time) will be disabled.
|
package/dist/index.js
CHANGED
|
@@ -6003,9 +6003,8 @@ var DrawerContent = React65.forwardRef(
|
|
|
6003
6003
|
panelShadowColor: modal.shadow.color,
|
|
6004
6004
|
panelShadowOffsetY: parseTokenValue23(modal.shadow.offsetY),
|
|
6005
6005
|
panelShadowBlur: parseTokenValue23(modal.shadow.blur),
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
accessibilityViewIsModal: true
|
|
6006
|
+
accessibilityViewIsModal: true,
|
|
6007
|
+
onAccessibilityEscape: closeDrawer
|
|
6009
6008
|
}, props), {
|
|
6010
6009
|
children: [
|
|
6011
6010
|
/* @__PURE__ */ jsx(DrawerBodyMaxContext.Provider, { value: bodyMax, children }),
|
|
@@ -9032,6 +9031,7 @@ var SelectField = React65.forwardRef(
|
|
|
9032
9031
|
optionalText,
|
|
9033
9032
|
placeholder,
|
|
9034
9033
|
leadingIcon,
|
|
9034
|
+
searchable = true,
|
|
9035
9035
|
noResultsText = "No results found",
|
|
9036
9036
|
errorText = "Something went wrong",
|
|
9037
9037
|
onSearchQuery,
|
|
@@ -9052,6 +9052,7 @@ var SelectField = React65.forwardRef(
|
|
|
9052
9052
|
"optionalText",
|
|
9053
9053
|
"placeholder",
|
|
9054
9054
|
"leadingIcon",
|
|
9055
|
+
"searchable",
|
|
9055
9056
|
"noResultsText",
|
|
9056
9057
|
"errorText",
|
|
9057
9058
|
"onSearchQuery",
|
|
@@ -9187,7 +9188,7 @@ var SelectField = React65.forwardRef(
|
|
|
9187
9188
|
setInputText("");
|
|
9188
9189
|
setFilterQuery("");
|
|
9189
9190
|
commitValue(null);
|
|
9190
|
-
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
9191
|
+
if (searchable) (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
9191
9192
|
};
|
|
9192
9193
|
const fieldState = error ? "error" : state;
|
|
9193
9194
|
const isOpen = isFocused && !disabled;
|
|
@@ -9209,28 +9210,39 @@ var SelectField = React65.forwardRef(
|
|
|
9209
9210
|
);
|
|
9210
9211
|
const dropdown = React65.useMemo(() => {
|
|
9211
9212
|
if (!isOpen || !anchorRect) return null;
|
|
9212
|
-
return /* @__PURE__ */
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9213
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9214
|
+
!searchable && /* @__PURE__ */ jsx(
|
|
9215
|
+
Pressable,
|
|
9216
|
+
{
|
|
9217
|
+
style: StyleSheet.absoluteFill,
|
|
9218
|
+
onPress: () => setIsFocused(false),
|
|
9219
|
+
accessible: false
|
|
9220
|
+
}
|
|
9221
|
+
),
|
|
9222
|
+
/* @__PURE__ */ jsx(
|
|
9223
|
+
SelectFieldDropdown,
|
|
9224
|
+
{
|
|
9225
|
+
anchor: anchorRect,
|
|
9226
|
+
placement: placement.direction,
|
|
9227
|
+
maxHeight: placement.maxHeight,
|
|
9228
|
+
screenHeight: windowHeight,
|
|
9229
|
+
accessibilityLiveRegion: "polite",
|
|
9230
|
+
children: /* @__PURE__ */ jsx(
|
|
9231
|
+
SelectFieldList,
|
|
9232
|
+
{
|
|
9233
|
+
state: optionsState,
|
|
9234
|
+
selectedValue,
|
|
9235
|
+
onSelect: onOptionPress,
|
|
9236
|
+
noResultsText,
|
|
9237
|
+
errorText,
|
|
9238
|
+
searchHintText
|
|
9239
|
+
}
|
|
9240
|
+
)
|
|
9241
|
+
}
|
|
9242
|
+
)
|
|
9243
|
+
] });
|
|
9233
9244
|
}, [
|
|
9245
|
+
searchable,
|
|
9234
9246
|
isOpen,
|
|
9235
9247
|
anchorRect,
|
|
9236
9248
|
placement,
|
|
@@ -9249,11 +9261,12 @@ var SelectField = React65.forwardRef(
|
|
|
9249
9261
|
{
|
|
9250
9262
|
ref: inputRef,
|
|
9251
9263
|
value: inputText,
|
|
9252
|
-
onChangeText: handleChangeText,
|
|
9253
|
-
onFocus: handleFocus,
|
|
9254
|
-
onBlur: handleBlur,
|
|
9264
|
+
onChangeText: searchable ? handleChangeText : void 0,
|
|
9265
|
+
onFocus: searchable ? handleFocus : void 0,
|
|
9266
|
+
onBlur: searchable ? handleBlur : void 0,
|
|
9267
|
+
onPress: !searchable && !disabled ? () => setIsFocused(true) : void 0,
|
|
9255
9268
|
placeholder,
|
|
9256
|
-
editable: !disabled,
|
|
9269
|
+
editable: searchable && !disabled,
|
|
9257
9270
|
state: fieldState,
|
|
9258
9271
|
hideStateIcons: Boolean(clearAction),
|
|
9259
9272
|
leadingIcon,
|
|
@@ -11290,6 +11303,7 @@ var DatePicker = React65.forwardRef(
|
|
|
11290
11303
|
getMonthLabel,
|
|
11291
11304
|
weekDayLabels = DEFAULT_WEEK_LABELS,
|
|
11292
11305
|
getDateState,
|
|
11306
|
+
getDateAccessibilityLabel,
|
|
11293
11307
|
isDateDisabled,
|
|
11294
11308
|
minDate,
|
|
11295
11309
|
maxDate
|
|
@@ -11310,6 +11324,7 @@ var DatePicker = React65.forwardRef(
|
|
|
11310
11324
|
"getMonthLabel",
|
|
11311
11325
|
"weekDayLabels",
|
|
11312
11326
|
"getDateState",
|
|
11327
|
+
"getDateAccessibilityLabel",
|
|
11313
11328
|
"isDateDisabled",
|
|
11314
11329
|
"minDate",
|
|
11315
11330
|
"maxDate"
|
|
@@ -11486,6 +11501,7 @@ var DatePicker = React65.forwardRef(
|
|
|
11486
11501
|
token: datePicker.month.typography,
|
|
11487
11502
|
align: "center",
|
|
11488
11503
|
color: datePicker.month.colour.text.default,
|
|
11504
|
+
accessibilityRole: "header",
|
|
11489
11505
|
children: resolvedMonthLabel
|
|
11490
11506
|
}
|
|
11491
11507
|
) }),
|
|
@@ -11507,82 +11523,79 @@ var DatePicker = React65.forwardRef(
|
|
|
11507
11523
|
{
|
|
11508
11524
|
entering: MONTH_SLIDE_ENTERING[slideDir],
|
|
11509
11525
|
exiting: MONTH_SLIDE_EXITING[slideDir],
|
|
11510
|
-
children: /* @__PURE__ */ jsx(
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11526
|
+
children: /* @__PURE__ */ jsx(StyledDatesGrid, { rowGap, children: calendarRows.map((row, rowIdx) => /* @__PURE__ */ jsx(StyledDateRow, { children: row.map(
|
|
11527
|
+
(date, colIdx) => !date ? /* @__PURE__ */ jsx(
|
|
11528
|
+
StyledDateCell,
|
|
11529
|
+
{
|
|
11530
|
+
cellHeight,
|
|
11531
|
+
accessibilityElementsHidden: true
|
|
11532
|
+
},
|
|
11533
|
+
`empty-${rowIdx}-${colIdx}`
|
|
11534
|
+
) : /* @__PURE__ */ jsx(
|
|
11535
|
+
StyledDateCell,
|
|
11536
|
+
{
|
|
11537
|
+
cellHeight,
|
|
11538
|
+
children: (() => {
|
|
11539
|
+
var _a3;
|
|
11540
|
+
const isDisabled = resolvedIsDateDisabled(date);
|
|
11541
|
+
const {
|
|
11542
|
+
state,
|
|
11543
|
+
indicatorBg,
|
|
11544
|
+
indicatorBorderColor,
|
|
11545
|
+
textColor,
|
|
11546
|
+
typography,
|
|
11547
|
+
textDecoration,
|
|
11548
|
+
isSelected
|
|
11549
|
+
} = resolveDateCellConfig(date);
|
|
11550
|
+
const isUndeliverable = isDisabled && state === "default";
|
|
11551
|
+
const cellOpacity = isDisabled && !isUndeliverable ? disabledOpacity : 1;
|
|
11552
|
+
const cellTextDecoration = isUndeliverable ? "line-through" : textDecoration;
|
|
11553
|
+
const cellTextColor = isUndeliverable ? dt.colour.text.previous : textColor;
|
|
11554
|
+
return /* @__PURE__ */ jsx(
|
|
11555
|
+
Pressable,
|
|
11556
|
+
{
|
|
11557
|
+
onPress: !isDisabled ? () => onDateSelect == null ? void 0 : onDateSelect(date) : void 0,
|
|
11558
|
+
disabled: isDisabled,
|
|
11559
|
+
accessible: true,
|
|
11560
|
+
accessibilityRole: "button",
|
|
11561
|
+
accessibilityLabel: (_a3 = getDateAccessibilityLabel == null ? void 0 : getDateAccessibilityLabel(
|
|
11562
|
+
date,
|
|
11531
11563
|
state,
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
const cellTextColor = isUndeliverable ? dt.colour.text.previous : textColor;
|
|
11543
|
-
return /* @__PURE__ */ jsx(
|
|
11544
|
-
Pressable,
|
|
11564
|
+
resolvedMonthLabel
|
|
11565
|
+
)) != null ? _a3 : `${date.getDate()} ${resolvedMonthLabel}`,
|
|
11566
|
+
accessibilityState: {
|
|
11567
|
+
selected: isSelected,
|
|
11568
|
+
disabled: isDisabled
|
|
11569
|
+
},
|
|
11570
|
+
accessibilityHint: state === "current" ? "Today" : void 0,
|
|
11571
|
+
style: { opacity: cellOpacity },
|
|
11572
|
+
children: /* @__PURE__ */ jsx(
|
|
11573
|
+
StyledIndicator3,
|
|
11545
11574
|
{
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
selected: isSelected,
|
|
11553
|
-
disabled: isDisabled
|
|
11554
|
-
},
|
|
11555
|
-
accessibilityHint: state === "current" ? "Today" : void 0,
|
|
11556
|
-
style: { opacity: cellOpacity },
|
|
11575
|
+
indicatorSize,
|
|
11576
|
+
indicatorBorderRadius,
|
|
11577
|
+
indicatorBg,
|
|
11578
|
+
indicatorBorderWidth: indicatorBorderColor !== "transparent" ? selectedBorderWidth : 0,
|
|
11579
|
+
indicatorBorderColor,
|
|
11580
|
+
indicatorBorderStyle: indicatorBorderColor !== "transparent" ? "dashed" : "solid",
|
|
11557
11581
|
children: /* @__PURE__ */ jsx(
|
|
11558
|
-
|
|
11582
|
+
Typography,
|
|
11559
11583
|
{
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
indicatorBorderColor,
|
|
11565
|
-
indicatorBorderStyle: indicatorBorderColor !== "transparent" ? "dashed" : "solid",
|
|
11566
|
-
children: /* @__PURE__ */ jsx(
|
|
11567
|
-
Typography,
|
|
11568
|
-
{
|
|
11569
|
-
color: cellTextColor,
|
|
11570
|
-
token: typography,
|
|
11571
|
-
textDecoration: cellTextDecoration,
|
|
11572
|
-
children: date.getDate().toString()
|
|
11573
|
-
}
|
|
11574
|
-
)
|
|
11584
|
+
color: cellTextColor,
|
|
11585
|
+
token: typography,
|
|
11586
|
+
textDecoration: cellTextDecoration,
|
|
11587
|
+
children: date.getDate().toString()
|
|
11575
11588
|
}
|
|
11576
11589
|
)
|
|
11577
11590
|
}
|
|
11578
|
-
)
|
|
11579
|
-
}
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
)
|
|
11584
|
-
|
|
11585
|
-
)
|
|
11591
|
+
)
|
|
11592
|
+
}
|
|
11593
|
+
);
|
|
11594
|
+
})()
|
|
11595
|
+
},
|
|
11596
|
+
toDateKey(date)
|
|
11597
|
+
)
|
|
11598
|
+
) }, rowIdx)) })
|
|
11586
11599
|
},
|
|
11587
11600
|
`${year}-${month}`
|
|
11588
11601
|
)
|