@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@butternutbox/pawprint-native",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "description": "ButternutBox Pawprint Design System - React Native Components",
6
6
  "main": "./dist/index.cjs",
@@ -121,6 +121,11 @@ type DatePickerOwnProps = {
121
121
  getMonthLabel?: (year: number, month: number, locale?: Locale) => string
122
122
  weekDayLabels?: [string, string, string, string, string, string, string]
123
123
  getDateState?: (date: Date) => DateItemState
124
+ getDateAccessibilityLabel?: (
125
+ date: Date,
126
+ state: DateItemState,
127
+ monthLabel: string
128
+ ) => string
124
129
  isDateDisabled?: (date: Date) => boolean
125
130
  minDate?: Date
126
131
  maxDate?: Date
@@ -229,6 +234,8 @@ const StyledIndicator = styled(View)<{
229
234
  * @param {[string,string,string,string,string,string,string]} [weekDayLabels] - Day-column labels Mon→Sun.
230
235
  * @param {(date: Date) => DateItemState} [getDateState] - Returns the visual state for a date.
231
236
  * Defaults to: past="previous", today="current", future="default".
237
+ * @param {(date: Date, state: DateItemState, monthLabel: string) => string} [getDateAccessibilityLabel] - Returns the screen-reader label for a date,
238
+ * e.g. to announce delivery states. Defaults to "{day} {monthLabel}".
232
239
  * @param {(date: Date) => boolean} [isDateDisabled] - Returns true to disable a date.
233
240
  * @param {Date} [minDate] - Dates before this (exclusive of time) will be disabled.
234
241
  * @param {Date} [maxDate] - Dates after this (exclusive of time) will be disabled.
@@ -270,6 +277,7 @@ export const DatePicker = React.forwardRef<View, DatePickerProps>(
270
277
  getMonthLabel,
271
278
  weekDayLabels = DEFAULT_WEEK_LABELS,
272
279
  getDateState,
280
+ getDateAccessibilityLabel,
273
281
  isDateDisabled,
274
282
  minDate,
275
283
  maxDate,
@@ -470,6 +478,7 @@ export const DatePicker = React.forwardRef<View, DatePickerProps>(
470
478
  token={datePicker.month.typography}
471
479
  align="center"
472
480
  color={datePicker.month.colour.text.default}
481
+ accessibilityRole="header"
473
482
  >
474
483
  {resolvedMonthLabel}
475
484
  </Typography>
@@ -493,11 +502,7 @@ export const DatePicker = React.forwardRef<View, DatePickerProps>(
493
502
  entering={MONTH_SLIDE_ENTERING[slideDir]}
494
503
  exiting={MONTH_SLIDE_EXITING[slideDir]}
495
504
  >
496
- <StyledDatesGrid
497
- rowGap={rowGap}
498
- accessible
499
- accessibilityLabel={resolvedMonthLabel}
500
- >
505
+ <StyledDatesGrid rowGap={rowGap}>
501
506
  {calendarRows.map((row, rowIdx) => (
502
507
  <StyledDateRow key={rowIdx}>
503
508
  {row.map((date, colIdx) =>
@@ -547,7 +552,13 @@ export const DatePicker = React.forwardRef<View, DatePickerProps>(
547
552
  disabled={isDisabled}
548
553
  accessible
549
554
  accessibilityRole="button"
550
- accessibilityLabel={`${date.getDate()} ${resolvedMonthLabel}`}
555
+ accessibilityLabel={
556
+ getDateAccessibilityLabel?.(
557
+ date,
558
+ state,
559
+ resolvedMonthLabel
560
+ ) ?? `${date.getDate()} ${resolvedMonthLabel}`
561
+ }
551
562
  accessibilityState={{
552
563
  selected: isSelected,
553
564
  disabled: isDisabled
@@ -433,9 +433,8 @@ export const DrawerContent = React.forwardRef<View, DrawerContentProps>(
433
433
  panelShadowColor={modal.shadow.color}
434
434
  panelShadowOffsetY={parseTokenValue(modal.shadow.offsetY)}
435
435
  panelShadowBlur={parseTokenValue(modal.shadow.blur)}
436
- accessible
437
- accessibilityRole="none"
438
436
  accessibilityViewIsModal
437
+ onAccessibilityEscape={closeDrawer}
439
438
  {...props}
440
439
  >
441
440
  <DrawerBodyMaxContext.Provider value={bodyMax}>