@butternutbox/pawprint-native 2.1.0 → 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/dist/index.d.cts CHANGED
@@ -2130,6 +2130,7 @@ type DatePickerOwnProps = {
2130
2130
  getMonthLabel?: (year: number, month: number, locale?: Locale) => string;
2131
2131
  weekDayLabels?: [string, string, string, string, string, string, string];
2132
2132
  getDateState?: (date: Date) => DateItemState;
2133
+ getDateAccessibilityLabel?: (date: Date, state: DateItemState, monthLabel: string) => string;
2133
2134
  isDateDisabled?: (date: Date) => boolean;
2134
2135
  minDate?: Date;
2135
2136
  maxDate?: Date;
@@ -2157,6 +2158,8 @@ type DatePickerProps = DatePickerOwnProps & Omit<ViewProps, keyof DatePickerOwnP
2157
2158
  * @param {[string,string,string,string,string,string,string]} [weekDayLabels] - Day-column labels Mon→Sun.
2158
2159
  * @param {(date: Date) => DateItemState} [getDateState] - Returns the visual state for a date.
2159
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}".
2160
2163
  * @param {(date: Date) => boolean} [isDateDisabled] - Returns true to disable a date.
2161
2164
  * @param {Date} [minDate] - Dates before this (exclusive of time) will be disabled.
2162
2165
  * @param {Date} [maxDate] - Dates after this (exclusive of time) will be disabled.
package/dist/index.d.ts CHANGED
@@ -2130,6 +2130,7 @@ type DatePickerOwnProps = {
2130
2130
  getMonthLabel?: (year: number, month: number, locale?: Locale) => string;
2131
2131
  weekDayLabels?: [string, string, string, string, string, string, string];
2132
2132
  getDateState?: (date: Date) => DateItemState;
2133
+ getDateAccessibilityLabel?: (date: Date, state: DateItemState, monthLabel: string) => string;
2133
2134
  isDateDisabled?: (date: Date) => boolean;
2134
2135
  minDate?: Date;
2135
2136
  maxDate?: Date;
@@ -2157,6 +2158,8 @@ type DatePickerProps = DatePickerOwnProps & Omit<ViewProps, keyof DatePickerOwnP
2157
2158
  * @param {[string,string,string,string,string,string,string]} [weekDayLabels] - Day-column labels Mon→Sun.
2158
2159
  * @param {(date: Date) => DateItemState} [getDateState] - Returns the visual state for a date.
2159
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}".
2160
2163
  * @param {(date: Date) => boolean} [isDateDisabled] - Returns true to disable a date.
2161
2164
  * @param {Date} [minDate] - Dates before this (exclusive of time) will be disabled.
2162
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
- accessible: true,
6007
- accessibilityRole: "none",
6008
- accessibilityViewIsModal: true
6006
+ accessibilityViewIsModal: true,
6007
+ onAccessibilityEscape: closeDrawer
6009
6008
  }, props), {
6010
6009
  children: [
6011
6010
  /* @__PURE__ */ jsx(DrawerBodyMaxContext.Provider, { value: bodyMax, children }),
@@ -11304,6 +11303,7 @@ var DatePicker = React65.forwardRef(
11304
11303
  getMonthLabel,
11305
11304
  weekDayLabels = DEFAULT_WEEK_LABELS,
11306
11305
  getDateState,
11306
+ getDateAccessibilityLabel,
11307
11307
  isDateDisabled,
11308
11308
  minDate,
11309
11309
  maxDate
@@ -11324,6 +11324,7 @@ var DatePicker = React65.forwardRef(
11324
11324
  "getMonthLabel",
11325
11325
  "weekDayLabels",
11326
11326
  "getDateState",
11327
+ "getDateAccessibilityLabel",
11327
11328
  "isDateDisabled",
11328
11329
  "minDate",
11329
11330
  "maxDate"
@@ -11500,6 +11501,7 @@ var DatePicker = React65.forwardRef(
11500
11501
  token: datePicker.month.typography,
11501
11502
  align: "center",
11502
11503
  color: datePicker.month.colour.text.default,
11504
+ accessibilityRole: "header",
11503
11505
  children: resolvedMonthLabel
11504
11506
  }
11505
11507
  ) }),
@@ -11521,82 +11523,79 @@ var DatePicker = React65.forwardRef(
11521
11523
  {
11522
11524
  entering: MONTH_SLIDE_ENTERING[slideDir],
11523
11525
  exiting: MONTH_SLIDE_EXITING[slideDir],
11524
- children: /* @__PURE__ */ jsx(
11525
- StyledDatesGrid,
11526
- {
11527
- rowGap,
11528
- accessible: true,
11529
- accessibilityLabel: resolvedMonthLabel,
11530
- children: calendarRows.map((row, rowIdx) => /* @__PURE__ */ jsx(StyledDateRow, { children: row.map(
11531
- (date, colIdx) => !date ? /* @__PURE__ */ jsx(
11532
- StyledDateCell,
11533
- {
11534
- cellHeight,
11535
- accessibilityElementsHidden: true
11536
- },
11537
- `empty-${rowIdx}-${colIdx}`
11538
- ) : /* @__PURE__ */ jsx(
11539
- StyledDateCell,
11540
- {
11541
- cellHeight,
11542
- children: (() => {
11543
- const isDisabled = resolvedIsDateDisabled(date);
11544
- const {
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,
11545
11563
  state,
11546
- indicatorBg,
11547
- indicatorBorderColor,
11548
- textColor,
11549
- typography,
11550
- textDecoration,
11551
- isSelected
11552
- } = resolveDateCellConfig(date);
11553
- const isUndeliverable = isDisabled && state === "default";
11554
- const cellOpacity = isDisabled && !isUndeliverable ? disabledOpacity : 1;
11555
- const cellTextDecoration = isUndeliverable ? "line-through" : textDecoration;
11556
- const cellTextColor = isUndeliverable ? dt.colour.text.previous : textColor;
11557
- return /* @__PURE__ */ jsx(
11558
- 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,
11559
11574
  {
11560
- onPress: !isDisabled ? () => onDateSelect == null ? void 0 : onDateSelect(date) : void 0,
11561
- disabled: isDisabled,
11562
- accessible: true,
11563
- accessibilityRole: "button",
11564
- accessibilityLabel: `${date.getDate()} ${resolvedMonthLabel}`,
11565
- accessibilityState: {
11566
- selected: isSelected,
11567
- disabled: isDisabled
11568
- },
11569
- accessibilityHint: state === "current" ? "Today" : void 0,
11570
- style: { opacity: cellOpacity },
11575
+ indicatorSize,
11576
+ indicatorBorderRadius,
11577
+ indicatorBg,
11578
+ indicatorBorderWidth: indicatorBorderColor !== "transparent" ? selectedBorderWidth : 0,
11579
+ indicatorBorderColor,
11580
+ indicatorBorderStyle: indicatorBorderColor !== "transparent" ? "dashed" : "solid",
11571
11581
  children: /* @__PURE__ */ jsx(
11572
- StyledIndicator3,
11582
+ Typography,
11573
11583
  {
11574
- indicatorSize,
11575
- indicatorBorderRadius,
11576
- indicatorBg,
11577
- indicatorBorderWidth: indicatorBorderColor !== "transparent" ? selectedBorderWidth : 0,
11578
- indicatorBorderColor,
11579
- indicatorBorderStyle: indicatorBorderColor !== "transparent" ? "dashed" : "solid",
11580
- children: /* @__PURE__ */ jsx(
11581
- Typography,
11582
- {
11583
- color: cellTextColor,
11584
- token: typography,
11585
- textDecoration: cellTextDecoration,
11586
- children: date.getDate().toString()
11587
- }
11588
- )
11584
+ color: cellTextColor,
11585
+ token: typography,
11586
+ textDecoration: cellTextDecoration,
11587
+ children: date.getDate().toString()
11589
11588
  }
11590
11589
  )
11591
11590
  }
11592
- );
11593
- })()
11594
- },
11595
- toDateKey(date)
11596
- )
11597
- ) }, rowIdx))
11598
- }
11599
- )
11591
+ )
11592
+ }
11593
+ );
11594
+ })()
11595
+ },
11596
+ toDateKey(date)
11597
+ )
11598
+ ) }, rowIdx)) })
11600
11599
  },
11601
11600
  `${year}-${month}`
11602
11601
  )