@westpac/ui 1.18.0 → 1.19.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/component-type.json +1 -1
  3. package/dist/components/button-group/button-group.component.d.ts +2 -1
  4. package/dist/components/button-group/button-group.component.js +6 -3
  5. package/dist/components/checkbox-group/checkbox-group.component.d.ts +11 -2
  6. package/dist/components/checkbox-group/checkbox-group.component.js +10 -3
  7. package/dist/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.d.ts +1 -1
  8. package/dist/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.js +5 -6
  9. package/dist/components/date-picker/components/date-field/components/date-segment/date-segment.component.d.ts +6 -5
  10. package/dist/components/date-picker/components/date-field/components/date-segment/date-segment.component.js +6 -4
  11. package/dist/components/date-picker/components/date-field/date-field.component.d.ts +5 -5
  12. package/dist/components/date-picker/components/date-field/date-field.component.js +7 -3
  13. package/dist/components/date-picker/date-picker.component.d.ts +19 -2
  14. package/dist/components/date-picker/date-picker.component.js +10 -5
  15. package/dist/components/date-picker/date-picker.styles.js +5 -5
  16. package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.component.js +3 -7
  17. package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-select-all-option/multi-select-select-all-option.component.js +3 -3
  18. package/dist/components/multi-select/components/multi-select-popover/multi-select-popover.component.js +5 -2
  19. package/dist/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.component.js +4 -7
  20. package/dist/components/multi-select/multi-select.component.d.ts +14 -3
  21. package/dist/components/multi-select/multi-select.component.js +10 -16
  22. package/dist/components/radio-group/components/radio-group-radio/radio-group-radio.component.d.ts +1 -1
  23. package/dist/components/radio-group/components/radio-group-radio/radio-group-radio.component.js +5 -6
  24. package/dist/components/radio-group/radio-group.component.d.ts +10 -2
  25. package/dist/components/radio-group/radio-group.component.js +10 -3
  26. package/dist/components/selector/components/selector-button-group/selector-button-group.component.d.ts +9 -2
  27. package/dist/components/selector/components/selector-button-group/selector-button-group.component.js +8 -3
  28. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.d.ts +6 -2
  29. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.js +8 -3
  30. package/dist/components/selector/components/selector-radio-group/selector-radio-group.component.d.ts +6 -2
  31. package/dist/components/selector/components/selector-radio-group/selector-radio-group.component.js +8 -3
  32. package/dist/components/selector/selector.component.d.ts +3 -1
  33. package/dist/components/selector/selector.component.js +16 -5
  34. package/dist/components/switch/switch.component.d.ts +8 -2
  35. package/dist/components/switch/switch.component.js +6 -4
  36. package/dist/css/westpac-ui.css +12 -12
  37. package/dist/css/westpac-ui.min.css +12 -12
  38. package/dist/hook/focus-manager-ref.hook.d.ts +29 -0
  39. package/dist/hook/focus-manager-ref.hook.js +23 -0
  40. package/dist/hook/index.d.ts +1 -0
  41. package/dist/index.d.ts +1 -0
  42. package/package.json +5 -4
  43. package/src/components/button-group/button-group.component.tsx +26 -16
  44. package/src/components/checkbox-group/checkbox-group.component.tsx +24 -14
  45. package/src/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.tsx +7 -7
  46. package/src/components/date-picker/components/date-field/components/date-segment/date-segment.component.tsx +10 -4
  47. package/src/components/date-picker/components/date-field/date-field.component.tsx +17 -3
  48. package/src/components/date-picker/date-picker.component.tsx +32 -21
  49. package/src/components/date-picker/date-picker.styles.ts +5 -5
  50. package/src/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.component.tsx +3 -5
  51. package/src/components/multi-select/components/multi-select-list-box/components/multi-select-select-all-option/multi-select-select-all-option.component.tsx +4 -3
  52. package/src/components/multi-select/components/multi-select-popover/multi-select-popover.component.tsx +8 -2
  53. package/src/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.component.tsx +3 -6
  54. package/src/components/multi-select/multi-select.component.tsx +33 -28
  55. package/src/components/radio-group/components/radio-group-radio/radio-group-radio.component.tsx +10 -7
  56. package/src/components/radio-group/radio-group.component.tsx +24 -14
  57. package/src/components/selector/components/selector-button-group/selector-button-group.component.tsx +23 -14
  58. package/src/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.tsx +12 -3
  59. package/src/components/selector/components/selector-radio-group/selector-radio-group.component.tsx +21 -11
  60. package/src/components/selector/selector.component.tsx +16 -5
  61. package/src/components/switch/switch.component.tsx +10 -12
  62. package/src/hook/focus-manager-ref.hook.ts +56 -0
  63. package/src/hook/index.ts +1 -0
  64. package/src/index.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @westpac/ui
2
2
 
3
+ ## 1.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 20f0934: Forward refs on composite form fields so form libraries such as react-hook-form can focus them on validation errors (`field.ref` → `focus()`):
8
+ - Single controls forward a DOM ref to their focusable element, like `Input` and `Button` already do: `Switch` → the switch `<input>`, `DatePicker` → the first editable date segment, `MultiSelect` → the trigger button.
9
+ - Groups (`RadioGroup`, `CheckboxGroup`, `Selector` with `radio`/`checkbox`/`button` types, `ButtonGroup`) forward a `FocusHandle` (`{ focus() }`, exported from `@westpac/ui`). `focus()` uses react-aria's focus manager to focus the group's first tabbable option at call time, so it follows the selected radio (roving tabindex), skips disabled options, and works when options render after mount.
10
+
11
+ `RadioGroupRadio` and `CheckboxGroupCheckbox` refs now point at the `<input>` instead of the wrapping `<label>`, in line with react-hook-form's guidance that a field ref should be the focusable input.
12
+
13
+ Fixed: the "Show N more items" button in `RadioGroup`/`CheckboxGroup` now moves focus to the first revealed option (it previously called `focus()` on a non-focusable label).
14
+
15
+ Adds `@react-aria/focus` as a direct dependency.
16
+
17
+ ### Patch Changes
18
+
19
+ - 20f0934: `DatePicker`: the date field no longer wraps its year segment onto a second line when the page font is wider than the design system's default. The per-size width is now a minimum (`min-w-*`) and segments are kept on one line (`whitespace-nowrap`), so the field grows to fit its content instead of overflowing.
20
+ - e419df1: `DatePicker`: no longer throws `ReferenceError: document is not defined` when rendered on the server (for example during Next.js prerendering). The default portal container lookup is now skipped outside the browser, matching the other portalled components.
21
+ - 20f0934: `MultiSelect`: fixed keyboard users being unable to select options. The dropdown is a non-modal react-aria popover, which react-aria dismisses on any page scroll; because focus moves into the dropdown (filter input, "Select all", options) the browser could scroll the page while arrowing through options and the dropdown closed mid-navigation. The popover no longer closes on scroll (all dismissal is handled by the component: blur, Escape, Tab, dismiss button), and focus moves inside the dropdown with react-aria's `focusWithoutScrolling` so the page does not jump. Also removed the incorrect `aria-modal="true"` from the non-modal popover.
22
+
3
23
  ## 1.18.0
4
24
 
5
25
  ### Minor Changes