@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.
@@ -7,12 +7,12 @@
7
7
  CJS Build start
8
8
  ESM Build start
9
9
  DTS Build start
10
- CJS dist/index.cjs 576.02 KB
11
- CJS dist/index.cjs.map 1.12 MB
12
- CJS ⚡️ Build success in 5883ms
13
- ESM dist/index.js 544.36 KB
10
+ ESM dist/index.js 544.81 KB
14
11
  ESM dist/index.js.map 1.12 MB
15
- ESM ⚡️ Build success in 5884ms
16
- DTS ⚡️ Build success in 16031ms
17
- DTS dist/index.d.cts 113.84 KB
18
- DTS dist/index.d.ts 113.84 KB
12
+ ESM ⚡️ Build success in 8378ms
13
+ CJS dist/index.cjs 576.54 KB
14
+ CJS dist/index.cjs.map 1.13 MB
15
+ CJS ⚡️ Build success in 8378ms
16
+ DTS ⚡️ Build success in 22238ms
17
+ DTS dist/index.d.cts 114.18 KB
18
+ DTS dist/index.d.ts 114.18 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @butternutbox/pawprint-native
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 55577eb: Make `DatePicker` days reachable with VoiceOver. The dates grid was a single
8
+ accessible element, so iOS only announced the month name and none of the day
9
+ buttons could be focused or selected. The grid is no longer grouped, and the
10
+ month label is now a header so screen-reader users can still jump between
11
+ months.
12
+
13
+ Add `getDateAccessibilityLabel(date, state, monthLabel)` so consumers can
14
+ announce delivery states such as the next box or future boxes. It defaults to
15
+ the existing "{day} {monthLabel}" label.
16
+
17
+ ### Patch Changes
18
+
19
+ - 7d7caa7: Make `Drawer` usable with VoiceOver. The panel was a single accessible
20
+ element, so iOS hid everything inside it, including the close button and any
21
+ footer actions, and a drawer couldn't be closed or acted on. The panel is no
22
+ longer grouped, so its contents are reachable, and it stays modal to keep
23
+ focus inside. The VoiceOver escape gesture (two-finger scrub) now closes the
24
+ drawer, as Android back already does.
25
+
26
+ ## 2.1.0
27
+
28
+ ### Minor Changes
29
+
30
+ - 2504fe2: Add `searchable` to `SelectField`, matching `SelectDrawerField`. It defaults to
31
+ `true`, so existing fields still filter as you type. With `searchable={false}`
32
+ the field can't be typed into: pressing it opens the full list, and tapping
33
+ outside the list closes it.
34
+
3
35
  ## 2.0.1
4
36
 
5
37
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -6033,9 +6033,8 @@ var DrawerContent = React65__default.default.forwardRef(
6033
6033
  panelShadowColor: modal.shadow.color,
6034
6034
  panelShadowOffsetY: parseTokenValue23(modal.shadow.offsetY),
6035
6035
  panelShadowBlur: parseTokenValue23(modal.shadow.blur),
6036
- accessible: true,
6037
- accessibilityRole: "none",
6038
- accessibilityViewIsModal: true
6036
+ accessibilityViewIsModal: true,
6037
+ onAccessibilityEscape: closeDrawer
6039
6038
  }, props), {
6040
6039
  children: [
6041
6040
  /* @__PURE__ */ jsxRuntime.jsx(DrawerBodyMaxContext.Provider, { value: bodyMax, children }),
@@ -9062,6 +9061,7 @@ var SelectField = React65__default.default.forwardRef(
9062
9061
  optionalText,
9063
9062
  placeholder,
9064
9063
  leadingIcon,
9064
+ searchable = true,
9065
9065
  noResultsText = "No results found",
9066
9066
  errorText = "Something went wrong",
9067
9067
  onSearchQuery,
@@ -9082,6 +9082,7 @@ var SelectField = React65__default.default.forwardRef(
9082
9082
  "optionalText",
9083
9083
  "placeholder",
9084
9084
  "leadingIcon",
9085
+ "searchable",
9085
9086
  "noResultsText",
9086
9087
  "errorText",
9087
9088
  "onSearchQuery",
@@ -9217,7 +9218,7 @@ var SelectField = React65__default.default.forwardRef(
9217
9218
  setInputText("");
9218
9219
  setFilterQuery("");
9219
9220
  commitValue(null);
9220
- (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
9221
+ if (searchable) (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
9221
9222
  };
9222
9223
  const fieldState = error ? "error" : state;
9223
9224
  const isOpen = isFocused && !disabled;
@@ -9239,28 +9240,39 @@ var SelectField = React65__default.default.forwardRef(
9239
9240
  );
9240
9241
  const dropdown = React65__default.default.useMemo(() => {
9241
9242
  if (!isOpen || !anchorRect) return null;
9242
- return /* @__PURE__ */ jsxRuntime.jsx(
9243
- SelectFieldDropdown,
9244
- {
9245
- anchor: anchorRect,
9246
- placement: placement.direction,
9247
- maxHeight: placement.maxHeight,
9248
- screenHeight: windowHeight,
9249
- accessibilityLiveRegion: "polite",
9250
- children: /* @__PURE__ */ jsxRuntime.jsx(
9251
- SelectFieldList,
9252
- {
9253
- state: optionsState,
9254
- selectedValue,
9255
- onSelect: onOptionPress,
9256
- noResultsText,
9257
- errorText,
9258
- searchHintText
9259
- }
9260
- )
9261
- }
9262
- );
9243
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9244
+ !searchable && /* @__PURE__ */ jsxRuntime.jsx(
9245
+ reactNative.Pressable,
9246
+ {
9247
+ style: reactNative.StyleSheet.absoluteFill,
9248
+ onPress: () => setIsFocused(false),
9249
+ accessible: false
9250
+ }
9251
+ ),
9252
+ /* @__PURE__ */ jsxRuntime.jsx(
9253
+ SelectFieldDropdown,
9254
+ {
9255
+ anchor: anchorRect,
9256
+ placement: placement.direction,
9257
+ maxHeight: placement.maxHeight,
9258
+ screenHeight: windowHeight,
9259
+ accessibilityLiveRegion: "polite",
9260
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9261
+ SelectFieldList,
9262
+ {
9263
+ state: optionsState,
9264
+ selectedValue,
9265
+ onSelect: onOptionPress,
9266
+ noResultsText,
9267
+ errorText,
9268
+ searchHintText
9269
+ }
9270
+ )
9271
+ }
9272
+ )
9273
+ ] });
9263
9274
  }, [
9275
+ searchable,
9264
9276
  isOpen,
9265
9277
  anchorRect,
9266
9278
  placement,
@@ -9279,11 +9291,12 @@ var SelectField = React65__default.default.forwardRef(
9279
9291
  {
9280
9292
  ref: inputRef,
9281
9293
  value: inputText,
9282
- onChangeText: handleChangeText,
9283
- onFocus: handleFocus,
9284
- onBlur: handleBlur,
9294
+ onChangeText: searchable ? handleChangeText : void 0,
9295
+ onFocus: searchable ? handleFocus : void 0,
9296
+ onBlur: searchable ? handleBlur : void 0,
9297
+ onPress: !searchable && !disabled ? () => setIsFocused(true) : void 0,
9285
9298
  placeholder,
9286
- editable: !disabled,
9299
+ editable: searchable && !disabled,
9287
9300
  state: fieldState,
9288
9301
  hideStateIcons: Boolean(clearAction),
9289
9302
  leadingIcon,
@@ -11320,6 +11333,7 @@ var DatePicker = React65__default.default.forwardRef(
11320
11333
  getMonthLabel,
11321
11334
  weekDayLabels = DEFAULT_WEEK_LABELS,
11322
11335
  getDateState,
11336
+ getDateAccessibilityLabel,
11323
11337
  isDateDisabled,
11324
11338
  minDate,
11325
11339
  maxDate
@@ -11340,6 +11354,7 @@ var DatePicker = React65__default.default.forwardRef(
11340
11354
  "getMonthLabel",
11341
11355
  "weekDayLabels",
11342
11356
  "getDateState",
11357
+ "getDateAccessibilityLabel",
11343
11358
  "isDateDisabled",
11344
11359
  "minDate",
11345
11360
  "maxDate"
@@ -11516,6 +11531,7 @@ var DatePicker = React65__default.default.forwardRef(
11516
11531
  token: datePicker.month.typography,
11517
11532
  align: "center",
11518
11533
  color: datePicker.month.colour.text.default,
11534
+ accessibilityRole: "header",
11519
11535
  children: resolvedMonthLabel
11520
11536
  }
11521
11537
  ) }),
@@ -11537,82 +11553,79 @@ var DatePicker = React65__default.default.forwardRef(
11537
11553
  {
11538
11554
  entering: MONTH_SLIDE_ENTERING[slideDir],
11539
11555
  exiting: MONTH_SLIDE_EXITING[slideDir],
11540
- children: /* @__PURE__ */ jsxRuntime.jsx(
11541
- StyledDatesGrid,
11542
- {
11543
- rowGap,
11544
- accessible: true,
11545
- accessibilityLabel: resolvedMonthLabel,
11546
- children: calendarRows.map((row, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx(StyledDateRow, { children: row.map(
11547
- (date, colIdx) => !date ? /* @__PURE__ */ jsxRuntime.jsx(
11548
- StyledDateCell,
11549
- {
11550
- cellHeight,
11551
- accessibilityElementsHidden: true
11552
- },
11553
- `empty-${rowIdx}-${colIdx}`
11554
- ) : /* @__PURE__ */ jsxRuntime.jsx(
11555
- StyledDateCell,
11556
- {
11557
- cellHeight,
11558
- children: (() => {
11559
- const isDisabled = resolvedIsDateDisabled(date);
11560
- const {
11556
+ children: /* @__PURE__ */ jsxRuntime.jsx(StyledDatesGrid, { rowGap, children: calendarRows.map((row, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx(StyledDateRow, { children: row.map(
11557
+ (date, colIdx) => !date ? /* @__PURE__ */ jsxRuntime.jsx(
11558
+ StyledDateCell,
11559
+ {
11560
+ cellHeight,
11561
+ accessibilityElementsHidden: true
11562
+ },
11563
+ `empty-${rowIdx}-${colIdx}`
11564
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
11565
+ StyledDateCell,
11566
+ {
11567
+ cellHeight,
11568
+ children: (() => {
11569
+ var _a3;
11570
+ const isDisabled = resolvedIsDateDisabled(date);
11571
+ const {
11572
+ state,
11573
+ indicatorBg,
11574
+ indicatorBorderColor,
11575
+ textColor,
11576
+ typography,
11577
+ textDecoration,
11578
+ isSelected
11579
+ } = resolveDateCellConfig(date);
11580
+ const isUndeliverable = isDisabled && state === "default";
11581
+ const cellOpacity = isDisabled && !isUndeliverable ? disabledOpacity : 1;
11582
+ const cellTextDecoration = isUndeliverable ? "line-through" : textDecoration;
11583
+ const cellTextColor = isUndeliverable ? dt.colour.text.previous : textColor;
11584
+ return /* @__PURE__ */ jsxRuntime.jsx(
11585
+ reactNative.Pressable,
11586
+ {
11587
+ onPress: !isDisabled ? () => onDateSelect == null ? void 0 : onDateSelect(date) : void 0,
11588
+ disabled: isDisabled,
11589
+ accessible: true,
11590
+ accessibilityRole: "button",
11591
+ accessibilityLabel: (_a3 = getDateAccessibilityLabel == null ? void 0 : getDateAccessibilityLabel(
11592
+ date,
11561
11593
  state,
11562
- indicatorBg,
11563
- indicatorBorderColor,
11564
- textColor,
11565
- typography,
11566
- textDecoration,
11567
- isSelected
11568
- } = resolveDateCellConfig(date);
11569
- const isUndeliverable = isDisabled && state === "default";
11570
- const cellOpacity = isDisabled && !isUndeliverable ? disabledOpacity : 1;
11571
- const cellTextDecoration = isUndeliverable ? "line-through" : textDecoration;
11572
- const cellTextColor = isUndeliverable ? dt.colour.text.previous : textColor;
11573
- return /* @__PURE__ */ jsxRuntime.jsx(
11574
- reactNative.Pressable,
11594
+ resolvedMonthLabel
11595
+ )) != null ? _a3 : `${date.getDate()} ${resolvedMonthLabel}`,
11596
+ accessibilityState: {
11597
+ selected: isSelected,
11598
+ disabled: isDisabled
11599
+ },
11600
+ accessibilityHint: state === "current" ? "Today" : void 0,
11601
+ style: { opacity: cellOpacity },
11602
+ children: /* @__PURE__ */ jsxRuntime.jsx(
11603
+ StyledIndicator3,
11575
11604
  {
11576
- onPress: !isDisabled ? () => onDateSelect == null ? void 0 : onDateSelect(date) : void 0,
11577
- disabled: isDisabled,
11578
- accessible: true,
11579
- accessibilityRole: "button",
11580
- accessibilityLabel: `${date.getDate()} ${resolvedMonthLabel}`,
11581
- accessibilityState: {
11582
- selected: isSelected,
11583
- disabled: isDisabled
11584
- },
11585
- accessibilityHint: state === "current" ? "Today" : void 0,
11586
- style: { opacity: cellOpacity },
11605
+ indicatorSize,
11606
+ indicatorBorderRadius,
11607
+ indicatorBg,
11608
+ indicatorBorderWidth: indicatorBorderColor !== "transparent" ? selectedBorderWidth : 0,
11609
+ indicatorBorderColor,
11610
+ indicatorBorderStyle: indicatorBorderColor !== "transparent" ? "dashed" : "solid",
11587
11611
  children: /* @__PURE__ */ jsxRuntime.jsx(
11588
- StyledIndicator3,
11612
+ Typography,
11589
11613
  {
11590
- indicatorSize,
11591
- indicatorBorderRadius,
11592
- indicatorBg,
11593
- indicatorBorderWidth: indicatorBorderColor !== "transparent" ? selectedBorderWidth : 0,
11594
- indicatorBorderColor,
11595
- indicatorBorderStyle: indicatorBorderColor !== "transparent" ? "dashed" : "solid",
11596
- children: /* @__PURE__ */ jsxRuntime.jsx(
11597
- Typography,
11598
- {
11599
- color: cellTextColor,
11600
- token: typography,
11601
- textDecoration: cellTextDecoration,
11602
- children: date.getDate().toString()
11603
- }
11604
- )
11614
+ color: cellTextColor,
11615
+ token: typography,
11616
+ textDecoration: cellTextDecoration,
11617
+ children: date.getDate().toString()
11605
11618
  }
11606
11619
  )
11607
11620
  }
11608
- );
11609
- })()
11610
- },
11611
- toDateKey(date)
11612
- )
11613
- ) }, rowIdx))
11614
- }
11615
- )
11621
+ )
11622
+ }
11623
+ );
11624
+ })()
11625
+ },
11626
+ toDateKey(date)
11627
+ )
11628
+ ) }, rowIdx)) })
11616
11629
  },
11617
11630
  `${year}-${month}`
11618
11631
  )