@westpac/ui 0.52.0 → 0.53.2

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 (87) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/component-type.json +1 -1
  3. package/dist/components/accordion/components/accordion-item/accordion-item.styles.js +1 -1
  4. package/dist/components/alert/alert.styles.js +1 -1
  5. package/dist/components/autocomplete/autocomplete.styles.js +1 -1
  6. package/dist/components/badge/badge.styles.d.ts +2 -2
  7. package/dist/components/badge/badge.styles.js +2 -2
  8. package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.js +2 -2
  9. package/dist/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.js +1 -1
  10. package/dist/components/button/button.styles.js +1 -1
  11. package/dist/components/button-dropdown/button-dropdown.component.d.ts +1 -1
  12. package/dist/components/button-dropdown/button-dropdown.component.js +5 -3
  13. package/dist/components/button-dropdown/button-dropdown.types.d.ts +7 -2
  14. package/dist/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.styles.js +1 -1
  15. package/dist/components/collapsible/collapsible.styles.js +1 -1
  16. package/dist/components/compacta/compacta.styles.js +1 -1
  17. package/dist/components/date-picker-beta/components/calendar/components/calendar-grid/calendar-grid.component.js +1 -1
  18. package/dist/components/date-picker-beta/components/date-field/components/date-segment/date-segment.styles.d.ts +2 -2
  19. package/dist/components/date-picker-beta/components/date-field/components/date-segment/date-segment.styles.js +1 -1
  20. package/dist/components/date-picker-beta/components/popover/popover.styles.js +1 -1
  21. package/dist/components/filter/components/filter-buttons/filter-buttons.component.js +2 -3
  22. package/dist/components/filter/components/filter-buttons/filter-buttons.styles.js +5 -5
  23. package/dist/components/filter/filter.component.js +1 -1
  24. package/dist/components/flexi-cell/components/flexi-cell-body/flexi-cell-body.styles.d.ts +2 -2
  25. package/dist/components/flexi-cell/components/flexi-cell-body/flexi-cell-body.styles.js +1 -1
  26. package/dist/components/flexi-cell/flexi-cell.styles.js +1 -1
  27. package/dist/components/footer/footer.styles.js +1 -1
  28. package/dist/components/header/header.styles.js +1 -1
  29. package/dist/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.d.ts +2 -2
  30. package/dist/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.js +3 -3
  31. package/dist/components/input-group/input-group.component.js +3 -1
  32. package/dist/components/modal/components/modal-dialog/modal-dialog.styles.js +1 -1
  33. package/dist/components/pagination/components/pagination-item/pagination-item.component.js +8 -2
  34. package/dist/components/pagination/components/pagination-item/pagination-item.styles.d.ts +12 -0
  35. package/dist/components/pagination/components/pagination-item/pagination-item.styles.js +5 -1
  36. package/dist/components/pagination/components/pagination-presentational/pagination-presentational.styles.js +1 -1
  37. package/dist/components/panel/components/panel-footer/panel-footer.styles.js +1 -1
  38. package/dist/components/panel/panel.styles.js +1 -1
  39. package/dist/components/popover/components/panel/panel.styles.js +2 -2
  40. package/dist/components/progress-rope/components/progress-rope-group-step/progress-rope-group-step.component.js +37 -19
  41. package/dist/components/repeater/repeater.styles.js +1 -1
  42. package/dist/components/table/table.styles.js +1 -1
  43. package/dist/components/tabs/components/tabs-tab/tabs-tab.styles.js +1 -1
  44. package/dist/components/tabs/components/tabs-tab-panel/tabs-tab-panel.styles.d.ts +2 -2
  45. package/dist/components/tabs/components/tabs-tab-panel/tabs-tab-panel.styles.js +1 -1
  46. package/dist/components/well/well.styles.d.ts +2 -2
  47. package/dist/components/well/well.styles.js +1 -1
  48. package/dist/css/westpac-ui.css +59 -9
  49. package/dist/css/westpac-ui.min.css +59 -9
  50. package/package.json +2 -2
  51. package/src/components/accordion/components/accordion-item/accordion-item.styles.ts +1 -1
  52. package/src/components/alert/alert.styles.ts +1 -1
  53. package/src/components/autocomplete/autocomplete.styles.ts +1 -1
  54. package/src/components/badge/badge.styles.ts +2 -2
  55. package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.ts +2 -2
  56. package/src/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.tsx +1 -1
  57. package/src/components/button/button.styles.ts +1 -1
  58. package/src/components/button-dropdown/button-dropdown.component.tsx +8 -1
  59. package/src/components/button-dropdown/button-dropdown.types.ts +7 -2
  60. package/src/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.styles.ts +1 -1
  61. package/src/components/collapsible/collapsible.styles.ts +1 -1
  62. package/src/components/compacta/compacta.styles.ts +1 -1
  63. package/src/components/date-picker-beta/components/calendar/components/calendar-grid/calendar-grid.component.tsx +1 -1
  64. package/src/components/date-picker-beta/components/date-field/components/date-segment/date-segment.styles.ts +1 -1
  65. package/src/components/date-picker-beta/components/popover/popover.styles.ts +1 -1
  66. package/src/components/filter/components/filter-buttons/filter-buttons.component.tsx +1 -2
  67. package/src/components/filter/components/filter-buttons/filter-buttons.styles.ts +5 -5
  68. package/src/components/filter/filter.component.tsx +1 -1
  69. package/src/components/flexi-cell/components/flexi-cell-body/flexi-cell-body.styles.ts +1 -1
  70. package/src/components/flexi-cell/flexi-cell.styles.ts +1 -1
  71. package/src/components/footer/footer.styles.ts +1 -1
  72. package/src/components/header/header.styles.ts +1 -1
  73. package/src/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.ts +3 -3
  74. package/src/components/input-group/input-group.component.tsx +3 -0
  75. package/src/components/modal/components/modal-dialog/modal-dialog.styles.ts +1 -1
  76. package/src/components/pagination/components/pagination-item/pagination-item.component.tsx +9 -2
  77. package/src/components/pagination/components/pagination-item/pagination-item.styles.ts +5 -1
  78. package/src/components/pagination/components/pagination-presentational/pagination-presentational.styles.ts +1 -1
  79. package/src/components/panel/components/panel-footer/panel-footer.styles.ts +1 -1
  80. package/src/components/panel/panel.styles.ts +1 -1
  81. package/src/components/popover/components/panel/panel.styles.ts +2 -2
  82. package/src/components/progress-rope/components/progress-rope-group-step/progress-rope-group-step.component.tsx +62 -38
  83. package/src/components/repeater/repeater.styles.ts +1 -1
  84. package/src/components/table/table.styles.ts +1 -1
  85. package/src/components/tabs/components/tabs-tab/tabs-tab.styles.ts +1 -1
  86. package/src/components/tabs/components/tabs-tab-panel/tabs-tab-panel.styles.ts +1 -1
  87. package/src/components/well/well.styles.ts +1 -1
@@ -2,17 +2,17 @@ import { tv } from 'tailwind-variants';
2
2
 
3
3
  export const styles = tv({
4
4
  slots: {
5
- base: 'relative flex justify-start',
6
- buttonList: 'flex w-full touch-pan-x gap-1 overflow-x-auto overflow-y-visible whitespace-nowrap',
7
- scrollButton: 'absolute rounded-none contrast-more:bg-black',
5
+ base: 'relative -left-1 flex justify-start', // left positioning for padding on buttons to show focus ring but be aligned to input
6
+ buttonList: 'flex w-full touch-pan-x gap-1 overflow-y-visible overflow-x-scroll whitespace-nowrap p-1',
7
+ scrollButton: 'absolute inset-y-0 h-auto rounded-none contrast-more:bg-black',
8
8
  },
9
9
  variants: {
10
10
  position: {
11
11
  left: {
12
- scrollButton: '-left-1 bg-[linear-gradient(90deg,_#fff_66%,_transparent)] pl-0',
12
+ scrollButton: 'left-0 bg-[linear-gradient(90deg,_#fff_66%,_transparent)] pl-0',
13
13
  },
14
14
  right: {
15
- scrollButton: '-right-1 bg-[linear-gradient(270deg,_#fff_66%,_transparent)] pr-0',
15
+ scrollButton: '-right-2 bg-[linear-gradient(270deg,_#fff_66%,_transparent)] pr-0',
16
16
  },
17
17
  },
18
18
  hidden: {
@@ -4,7 +4,7 @@ import { type FilterProps } from './filter.types.js';
4
4
 
5
5
  export function Filter({ children, ...props }: FilterProps) {
6
6
  return (
7
- <div {...props} className="flex flex-col gap-3">
7
+ <div {...props} className="flex flex-col gap-2">
8
8
  {children}
9
9
  </div>
10
10
  );
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
2
2
 
3
3
  export const styles = tv(
4
4
  {
5
- base: 'flex flex-1 flex-col gap-1 overflow-hidden',
5
+ base: 'flex flex-1 flex-col gap-1 overflow-x-clip',
6
6
  variants: {
7
7
  isLink: {
8
8
  true: 'group/dualaction',
@@ -3,7 +3,7 @@ import { tv } from 'tailwind-variants';
3
3
  export const styles = tv(
4
4
  {
5
5
  slots: {
6
- base: 'relative flex bg-white transition-colors',
6
+ base: 'relative flex bg-white transition-colors [&_:focus-visible]:focus-outline',
7
7
  topBadgeWrapper: 'absolute right-[-1px] top-[-1px]',
8
8
  topBadge: 'rounded-br-none rounded-tl-none',
9
9
  },
@@ -3,7 +3,7 @@ import { tv } from 'tailwind-variants';
3
3
  export const styles = tv(
4
4
  {
5
5
  slots: {
6
- base: 'relative overflow-hidden border-t border-t-border',
6
+ base: 'relative overflow-hidden border-t border-t-border [&_:focus-visible]:focus-outline',
7
7
  wrapper: 'pt-3 max-md:px-2 max-md:pb-3 md:px-4 md:pb-3',
8
8
  link: 'float-right block',
9
9
  logoWrapper: 'flex justify-end',
@@ -12,7 +12,7 @@ export const styles = tv(
12
12
  leftContent: 'flex items-center',
13
13
  leftButton:
14
14
  'my-1 rounded-none border-r border-[#E8E8ED] p-0 max-sm:-ml-2 max-sm:mr-2 max-sm:h-7 max-sm:min-w-7 sm:-ml-4 sm:mr-3 sm:h-[3.3125rem] sm:min-w-10',
15
- rightContent: 'ml-auto flex items-center',
15
+ rightContent: 'ml-auto flex items-center [&_:focus-visible]:focus-outline',
16
16
  },
17
17
  variants: {
18
18
  logoCenter: {
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
2
2
 
3
3
  export const styles = tv(
4
4
  {
5
- base: 'inset-y-0',
5
+ base: 'inset-y-0 focus-within:z-20',
6
6
  variants: {
7
7
  isInset: {
8
8
  true: 'absolute',
@@ -17,12 +17,12 @@ export const styles = tv(
17
17
  {
18
18
  isInset: true,
19
19
  position: 'before',
20
- className: 'left-0',
20
+ className: 'left-0 z-[11]',
21
21
  },
22
22
  {
23
23
  isInset: true,
24
24
  position: 'after',
25
- className: 'right-0',
25
+ className: 'right-0 z-[11]',
26
26
  },
27
27
  ],
28
28
  },
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import { clsx } from 'clsx';
3
4
  import React, {
4
5
  Attributes,
5
6
  Children,
@@ -96,6 +97,8 @@ export function InputGroup({
96
97
  'aria-describedby': ariaDescribedBy || ariaDescribedByValue,
97
98
  'aria-label': ariaLabel,
98
99
  ...(width !== 'full' ? { width: width } : {}),
100
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument
101
+ className: clsx(child.props.className, 'focus:z-10'), // for focus ring visibility
99
102
  } as Partial<unknown> & Attributes);
100
103
  }
101
104
  });
@@ -32,7 +32,7 @@ export const styles = tv(
32
32
  },
33
33
  },
34
34
  isFocusVisible: {
35
- true: { close: 'focus-outline' },
35
+ true: { close: '!outline-offset-[-3px] focus-outline' },
36
36
  false: { close: 'outline-none' },
37
37
  },
38
38
  },
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { AriaButtonOptions, mergeProps, useButton, useFocusRing } from 'react-aria';
2
3
 
3
4
  import { styles } from './pagination-item.styles.js';
4
5
  import { type PaginationItemProps } from './pagination-item.types.js';
@@ -16,10 +17,16 @@ export function PaginationItem({
16
17
  disabled = false,
17
18
  ...props
18
19
  }: PaginationItemProps) {
20
+ const ref = React.useRef(null);
21
+ const { focusProps, isFocusVisible } = useFocusRing();
22
+ const { buttonProps } = useButton(props as AriaButtonOptions<'button'>, ref);
23
+
24
+ const finalButtonProps = mergeProps(focusProps, buttonProps);
25
+
19
26
  return (
20
27
  <Tag
21
- className={styles({ className, firstItem, lastItem, active, disabled })}
22
- {...props}
28
+ className={styles({ className, firstItem, lastItem, active, disabled, isFocusVisible })}
29
+ {...finalButtonProps}
23
30
  disabled={disabled}
24
31
  aria-disabled={disabled ? 'true' : 'false'}
25
32
  aria-current={active ? 'page' : undefined}
@@ -4,6 +4,10 @@ export const styles = tv(
4
4
  {
5
5
  base: 'typography-body-10 relative block min-w-7 border border-border px-2 py-1.5 text-center text-text',
6
6
  variants: {
7
+ isFocusVisible: {
8
+ true: 'z-10 focus-outline',
9
+ false: '',
10
+ },
7
11
  firstItem: {
8
12
  true: 'rounded-l',
9
13
  false: 'ml-[-1px]',
@@ -13,7 +17,7 @@ export const styles = tv(
13
17
  false: '',
14
18
  },
15
19
  active: {
16
- true: 'z-10 border-hero bg-hero text-white',
20
+ true: 'border-hero bg-hero text-white',
17
21
  false: 'hover:bg-light',
18
22
  },
19
23
  disabled: {
@@ -4,7 +4,7 @@ export const styles = tv(
4
4
  {
5
5
  slots: {
6
6
  base: 'flex flex-col items-center',
7
- ul: 'flex overflow-hidden',
7
+ ul: 'flex',
8
8
  emptyItem:
9
9
  'typography-body-10 relative block min-w-7 cursor-default border-y border-border px-2 py-1.5 text-center text-text',
10
10
  },
@@ -3,7 +3,7 @@ import { tv } from 'tailwind-variants';
3
3
  export const styles = tv(
4
4
  {
5
5
  slots: {
6
- base: 'border-0 border-t border-border bg-light px-2 py-[0.625rem] sm:px-4',
6
+ base: 'border-0 border-t border-border bg-light px-2 py-[0.625rem] sm:px-4 [&_:focus-visible]:focus-outline',
7
7
  },
8
8
  variants: {},
9
9
  },
@@ -3,7 +3,7 @@ import { tv } from 'tailwind-variants';
3
3
  export const styles = tv(
4
4
  {
5
5
  slots: {
6
- base: 'group/panel overflow-hidden rounded border border-hero',
6
+ base: 'group/panel overflow-hidden rounded border border-hero [&_:focus-visible]:focus-outline',
7
7
  header: 'px-2 py-[0.625rem] sm:px-4',
8
8
  },
9
9
  variants: {
@@ -11,8 +11,8 @@ export const styles = tv(
11
11
  `,
12
12
  closeBtn: 'absolute right-1 top-1 h-3 p-0 hover:opacity-80',
13
13
  content: 'w-[17.625rem] rounded-[3px] bg-white py-4 pl-3 pr-5',
14
- heading: 'typography-body-9 mb-2 font-medium text-text',
15
- body: 'typography-body-10 text-text',
14
+ heading: 'typography-body-9 mb-2 font-medium text-text focus-visible:focus-outline',
15
+ body: 'typography-body-10 text-text focus-visible:focus-outline',
16
16
  },
17
17
  variants: {
18
18
  placement: {
@@ -1,5 +1,5 @@
1
- import { AnimatePresence, LazyMotion, m } from 'motion/react';
2
- import React, { useId, useMemo } from 'react';
1
+ import { LazyMotion, m, useAnimate } from 'motion/react';
2
+ import React, { useEffect, useId, useMemo, useState } from 'react';
3
3
  import { useFocusRing } from 'react-aria';
4
4
 
5
5
  import { Circle, VisuallyHidden } from '../../../index.js';
@@ -23,6 +23,8 @@ export function ProgressRopeGroupStep({
23
23
  onToggle,
24
24
  tag: Tag,
25
25
  }: ProgressRopeGroupStepProps) {
26
+ // Handling expanding animation this way for focus ring on steps
27
+ const [scope, animate] = useAnimate();
26
28
  const id = useId();
27
29
  const stepsContainerID = `progress-rope-group-steps-container-${id}`;
28
30
 
@@ -60,6 +62,38 @@ export function ProgressRopeGroupStep({
60
62
  }, [current, visited]);
61
63
 
62
64
  const styles = progressRopeGroupStyles({ firstItem, state, isFocusVisible });
65
+ const [overflowVisible, setOverflowVisible] = useState(false);
66
+
67
+ useEffect(() => {
68
+ // Animates expanding/collapsing steps
69
+ if (opened) {
70
+ animate(
71
+ scope.current,
72
+ { height: 'auto' },
73
+ {
74
+ duration: 0.2,
75
+ ease: 'easeInOut',
76
+ onComplete: () => {
77
+ setOverflowVisible(true);
78
+ },
79
+ },
80
+ );
81
+ } else {
82
+ animate(
83
+ scope.current,
84
+ { height: 0 },
85
+ {
86
+ duration: 0.2,
87
+ ease: 'easeInOut',
88
+ onPlay: () => {
89
+ setOverflowVisible(false);
90
+ },
91
+ },
92
+ );
93
+ }
94
+ // eslint-disable-next-line react-hooks/exhaustive-deps
95
+ }, [opened]);
96
+
63
97
  return (
64
98
  <Tag>
65
99
  <button
@@ -74,42 +108,32 @@ export function ProgressRopeGroupStep({
74
108
  <VisuallyHidden>{visuallyHiddenMessage}</VisuallyHidden>
75
109
  </button>
76
110
  <LazyMotion features={loadAnimations}>
77
- <AnimatePresence initial={false}>
78
- {opened && (
79
- <m.div
80
- initial={{
81
- height: 0,
82
- overflow: 'hidden',
83
- }}
84
- animate={{
85
- height: 'auto',
86
- }}
87
- exit={{
88
- height: 0,
89
- overflow: 'hidden',
90
- }}
91
- transition={{ duration: 0.2, ease: 'easeInOut' }}
92
- >
93
- <ol className={styles.stepsWrapper({})} id={stepsContainerID} aria-hidden={!opened}>
94
- {steps.map((step, index) => (
95
- <li key={step.index}>
96
- <ProgressRopeStep
97
- firstItem={index === 0}
98
- lastItemInGroup={index === steps.length - 1}
99
- size="small"
100
- onClick={(furthestVisitedStep || 0) >= step.index ? step.onClick : undefined}
101
- current={step.index === currentKey}
102
- visited={(furthestVisitedStep || 0) > step.index}
103
- furthest={furthestVisitedStep === step.index}
104
- >
105
- {step.text}
106
- </ProgressRopeStep>
107
- </li>
108
- ))}
109
- </ol>
110
- </m.div>
111
- )}
112
- </AnimatePresence>
111
+ <m.div
112
+ ref={scope}
113
+ initial={{ height: opened ? 'auto' : 0 }}
114
+ style={{
115
+ overflow: overflowVisible ? 'visible' : 'hidden', // to show focus ring correctly when expanded
116
+ }}
117
+ >
118
+ <ol className={styles.stepsWrapper({})} id={stepsContainerID} aria-hidden={!opened}>
119
+ {steps.map((step, index) => (
120
+ <li key={step.index}>
121
+ <ProgressRopeStep
122
+ firstItem={index === 0}
123
+ lastItemInGroup={index === steps.length - 1}
124
+ size="small"
125
+ onClick={(furthestVisitedStep || 0) >= step.index ? step.onClick : undefined}
126
+ current={step.index === currentKey}
127
+ visited={(furthestVisitedStep || 0) > step.index}
128
+ furthest={furthestVisitedStep === step.index}
129
+ tabIndex={opened ? 0 : -1} // Using hidden/visibility breaks styles
130
+ >
131
+ {step.text}
132
+ </ProgressRopeStep>
133
+ </li>
134
+ ))}
135
+ </ol>
136
+ </m.div>
113
137
  </LazyMotion>
114
138
  </Tag>
115
139
  );
@@ -7,7 +7,7 @@ export const styles = tv(
7
7
  list: 'm-0 flex list-none flex-col pl-0',
8
8
  item: 'relative',
9
9
  itemIndex: 'mb-3 font-bold',
10
- content: '',
10
+ content: '[&_:focus-visible]:focus-outline',
11
11
  removeBtn: 'absolute right-0 top-0 h-auto p-0 no-underline hover:underline',
12
12
  footer: 'flex justify-between pt-[0.875rem]',
13
13
  addBtn: 'h-auto p-0 no-underline hover:underline',
@@ -3,7 +3,7 @@ import { tv } from 'tailwind-variants';
3
3
  export const styles = tv(
4
4
  {
5
5
  slots: {
6
- base: 'mb-4 w-full',
6
+ base: 'mb-4 w-full [&_:focus-visible]:focus-outline',
7
7
  wrapper: 'max-xsl:mb-3 max-xsl:w-full max-xsl:overflow-x-auto max-xsl:overflow-y-hidden',
8
8
  },
9
9
  variants: {},
@@ -24,7 +24,7 @@ export const styles = tv(
24
24
  hero: '',
25
25
  },
26
26
  isFocusVisible: {
27
- true: 'focus-outline',
27
+ true: 'z-10 focus-outline',
28
28
  false: 'outline-none',
29
29
  },
30
30
  },
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
2
2
 
3
3
  export const styles = tv(
4
4
  {
5
- base: 'flex-1 bg-white p-4',
5
+ base: 'flex-1 bg-white p-4 [&_:focus-visible]:focus-outline',
6
6
  variants: {
7
7
  look: {
8
8
  default: 'border border-border',
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
2
2
 
3
3
  export const styles = tv(
4
4
  {
5
- base: 'rounded border border-border p-2 sm:p-4',
5
+ base: 'rounded border border-border p-2 sm:p-4 [&_:focus-visible]:focus-outline',
6
6
  variants: {
7
7
  color: {
8
8
  light: 'bg-light',