@westpac/ui 0.19.0 → 0.20.1
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/.eslintrc.cjs +7 -2
- package/CHANGELOG.md +12 -0
- package/dist/component-type.json +1 -1
- package/dist/components/accordion/accordion.component.d.ts +3 -2
- package/dist/components/accordion/accordion.types.d.ts +1 -1
- package/dist/components/accordion/components/accordion-item/accordion-item.component.d.ts +1 -1
- package/dist/components/accordion/components/accordion-item/accordion-item.types.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete.component.js +6 -3
- package/dist/components/autocomplete/components/autocomplete-item/autocomplete-item.component.js +0 -1
- package/dist/components/autocomplete/components/autocomplete-item/autocomplete-item.types.d.ts +1 -1
- package/dist/components/autocomplete/components/autocomplete-list-box/autocomplete-list-box.types.d.ts +2 -2
- package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.component.d.ts +1 -1
- package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.types.d.ts +1 -1
- package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-section/autocomplete-list-box-section.component.d.ts +1 -1
- package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-section/autocomplete-list-box-section.types.d.ts +1 -1
- package/dist/components/badge/badge.component.d.ts +3 -3
- package/dist/components/badge/badge.component.js +1 -3
- package/dist/components/badge/badge.styles.d.ts +1 -1
- package/dist/components/badge/badge.styles.js +3 -3
- package/dist/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.js +3 -1
- package/dist/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.d.ts +3 -3
- package/dist/components/button/button.component.d.ts +1 -1
- package/dist/components/button/button.styles.js +1 -1
- package/dist/components/button-dropdown/button-dropdown.component.js +1 -1
- package/dist/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.component.js +8 -3
- package/dist/components/button-group/button-group.component.js +1 -1
- package/dist/components/checkbox-group/checkbox-group.component.js +1 -1
- package/dist/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.d.ts +1 -1
- package/dist/components/collapsible/collapsible.component.js +1 -1
- package/dist/components/date-picker/date-picker.component.js +9 -1
- package/dist/components/date-picker/date-picker.types.d.ts +8 -8
- package/dist/components/date-picker/date-picker.utils.d.ts +2 -2
- package/dist/components/date-picker/date-picker.utils.js +2 -1
- package/dist/components/error-message/error-message.component.js +2 -1
- package/dist/components/field/field.component.js +2 -1
- package/dist/components/flexi-cell/flexi-cell.component.d.ts +1 -1
- package/dist/components/header/header.component.js +4 -1
- package/dist/components/input-group/components/input-group-add-ons/components/input-group-add-on-default-add-on/input-group-add-on-default-add-on.component.d.ts +1 -1
- package/dist/components/input-group/components/input-group-add-ons/components/input-group-add-on-default-add-on/input-group-add-on-default-add-on.component.js +1 -1
- package/dist/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.js +2 -2
- package/dist/components/input-group/input-group.component.js +8 -3
- package/dist/components/input-group/input-group.styles.d.ts +74 -4
- package/dist/components/input-group/input-group.styles.js +16 -8
- package/dist/components/list/components/list-item/list-item.component.d.ts +3 -3
- package/dist/components/pagination/pagination.component.js +6 -4
- package/dist/components/pagination/pagination.hooks.js +4 -2
- package/dist/components/pass-code/pass-code.component.js +6 -4
- package/dist/components/pass-code-view/pass-code-view.types.d.ts +2 -2
- package/dist/components/popover/components/panel/panel.component.js +6 -3
- package/dist/components/popover/popover.component.js +5 -3
- package/dist/components/popover/{popover.hooks.d.ts → popover.utils.d.ts} +1 -1
- package/dist/components/popover/{popover.hooks.js → popover.utils.js} +1 -1
- package/dist/components/progress-rope/components/progress-rope-step/progress-rope-step.component.d.ts +1 -1
- package/dist/components/progress-rope/components/progress-rope-step/progress-rope-step.component.js +3 -1
- package/dist/components/progress-rope/components/progress-rope-step/progress-rope-step.types.d.ts +1 -1
- package/dist/components/progress-rope/progress-rope.component.js +3 -2
- package/dist/components/radio-group/components/radio-group-radio/radio-group-radio.component.d.ts +1 -1
- package/dist/components/radio-group/radio-group.component.js +1 -1
- package/dist/components/select/select.styles.d.ts +1 -1
- package/dist/components/select/select.styles.js +1 -1
- package/dist/components/selector/components/selector-button-group/components/selector-button-group-option/selector-button-group-option.component.js +2 -1
- package/dist/components/selector/components/selector-button-group/selector-button-group.component.js +3 -1
- package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.js +1 -1
- package/dist/components/selector/components/selector-radio-group/selector-radio-group.component.js +1 -1
- package/dist/components/skip-link/skip-link.component.d.ts +1 -1
- package/dist/components/tabs/components/tabs-tab/tabs-tab.types.d.ts +1 -1
- package/dist/components/tabs/components/tabs-tab-panel/tabs-tab-panel.types.d.ts +1 -1
- package/dist/components/tabs/tabs.types.d.ts +1 -1
- package/dist/css/westpac-ui.css +20 -38
- package/dist/css/westpac-ui.min.css +20 -38
- package/dist/tailwind/tailwind-plugin.js +1 -1
- package/dist/tailwind/utils/create-font-sizes.d.ts +10 -1
- package/dist/tailwind/utils/generate-font-components.d.ts +2 -2
- package/package.json +3 -3
- package/src/components/accordion/accordion.component.tsx +15 -9
- package/src/components/accordion/accordion.types.ts +1 -1
- package/src/components/accordion/components/accordion-item/accordion-item.component.tsx +4 -4
- package/src/components/accordion/components/accordion-item/accordion-item.types.ts +1 -1
- package/src/components/autocomplete/autocomplete.component.tsx +9 -2
- package/src/components/autocomplete/components/autocomplete-item/autocomplete-item.component.tsx +0 -1
- package/src/components/autocomplete/components/autocomplete-item/autocomplete-item.types.ts +1 -1
- package/src/components/autocomplete/components/autocomplete-list-box/autocomplete-list-box.types.ts +2 -2
- package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.component.tsx +3 -3
- package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.types.ts +1 -1
- package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-section/autocomplete-list-box-section.component.tsx +1 -1
- package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-section/autocomplete-list-box-section.types.ts +1 -1
- package/src/components/badge/badge.component.tsx +5 -6
- package/src/components/badge/badge.styles.ts +3 -3
- package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.component.tsx +0 -1
- package/src/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.tsx +2 -3
- package/src/components/breadcrumb/breadcrumb.component.tsx +4 -1
- package/src/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.tsx +5 -5
- package/src/components/button/button.component.tsx +2 -2
- package/src/components/button/button.styles.ts +1 -1
- package/src/components/button-dropdown/button-dropdown.component.tsx +2 -2
- package/src/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.component.tsx +3 -3
- package/src/components/button-group/button-group.component.tsx +1 -3
- package/src/components/checkbox-group/checkbox-group.component.tsx +2 -4
- package/src/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.tsx +5 -2
- package/src/components/collapsible/collapsible.component.tsx +1 -1
- package/src/components/compacta/compacta.component.tsx +1 -1
- package/src/components/date-picker/date-picker.component.tsx +2 -2
- package/src/components/date-picker/date-picker.types.ts +18 -8
- package/src/components/date-picker/date-picker.utils.ts +3 -3
- package/src/components/error-message/error-message.component.tsx +2 -2
- package/src/components/error-message/error-message.types.ts +1 -1
- package/src/components/field/field.component.tsx +1 -1
- package/src/components/flexi-cell/flexi-cell.component.tsx +3 -3
- package/src/components/header/header.component.tsx +1 -1
- package/src/components/input-group/components/input-group-add-ons/components/input-group-add-on-default-add-on/input-group-add-on-default-add-on.component.tsx +1 -6
- package/src/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.ts +2 -2
- package/src/components/input-group/input-group.component.tsx +14 -5
- package/src/components/input-group/input-group.styles.ts +15 -8
- package/src/components/list/components/list-item/list-item.component.tsx +2 -2
- package/src/components/pagination/components/pagination-item/pagination-item.types.ts +2 -0
- package/src/components/pagination/pagination.component.tsx +2 -2
- package/src/components/pagination/pagination.hooks.ts +2 -2
- package/src/components/pass-code/pass-code.component.tsx +3 -3
- package/src/components/pass-code-view/pass-code-view.types.ts +2 -2
- package/src/components/popover/components/panel/panel.component.tsx +3 -3
- package/src/components/popover/popover.component.tsx +5 -5
- package/src/components/popover/{popover.hooks.tsx → popover.utils.tsx} +2 -2
- package/src/components/progress-rope/components/progress-rope-step/progress-rope-step.component.tsx +2 -3
- package/src/components/progress-rope/components/progress-rope-step/progress-rope-step.types.ts +1 -1
- package/src/components/progress-rope/progress-rope.component.tsx +1 -2
- package/src/components/radio-group/components/radio-group-radio/radio-group-radio.component.tsx +2 -2
- package/src/components/radio-group/radio-group.component.tsx +2 -4
- package/src/components/select/select.styles.ts +1 -1
- package/src/components/selector/components/selector-button-group/components/selector-button-group-option/selector-button-group-option.component.tsx +3 -3
- package/src/components/selector/components/selector-button-group/selector-button-group.component.tsx +2 -2
- package/src/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.component.tsx +2 -2
- package/src/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.tsx +1 -3
- package/src/components/selector/components/selector-link-group/components/selector-link-group-option/selector-link-group-option.component.tsx +3 -3
- package/src/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.tsx +2 -2
- package/src/components/selector/components/selector-radio-group/selector-radio-group.component.tsx +1 -3
- package/src/components/skip-link/skip-link.component.tsx +3 -3
- package/src/components/tabs/components/tabs-tab/tabs-tab.component.tsx +2 -2
- package/src/components/tabs/components/tabs-tab/tabs-tab.types.ts +1 -1
- package/src/components/tabs/components/tabs-tab-panel/tabs-tab-panel.types.ts +1 -1
- package/src/components/tabs/tabs.component.tsx +7 -7
- package/src/components/tabs/tabs.types.ts +1 -1
- package/src/tailwind/tailwind-plugin.ts +1 -1
- package/src/tailwind/utils/create-font-sizes.ts +22 -11
- package/src/tailwind/utils/generate-font-components.ts +16 -19
- package/src/tailwind/utils/generate-form-control.ts +10 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RefObject, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
import { DuetDatePickerElement } from './date-picker.types.js';
|
|
4
4
|
|
|
@@ -34,7 +34,7 @@ export function formatDate(date: Date, format: string) {
|
|
|
34
34
|
export function useListener(
|
|
35
35
|
ref: RefObject<DuetDatePickerElement> | null,
|
|
36
36
|
eventName: string,
|
|
37
|
-
handler?:
|
|
37
|
+
handler?: EventListenerOrEventListenerObject,
|
|
38
38
|
) {
|
|
39
39
|
useEffect(() => {
|
|
40
40
|
if (ref?.current && handler) {
|
|
@@ -42,7 +42,7 @@ export function useListener(
|
|
|
42
42
|
element.addEventListener(eventName, handler);
|
|
43
43
|
return () => element.removeEventListener(eventName, handler);
|
|
44
44
|
}
|
|
45
|
-
}, [eventName, handler]);
|
|
45
|
+
}, [eventName, handler, ref]);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export function createDate(year: string, month: string, day: string) {
|
|
@@ -11,8 +11,8 @@ export function ErrorMessage({ className, tag: Tag = 'div', icon: Icon, message,
|
|
|
11
11
|
|
|
12
12
|
return Array.isArray(message) ? (
|
|
13
13
|
<ul className={styles.list({})} {...props}>
|
|
14
|
-
{message.map(msg => (
|
|
15
|
-
<li className={styles.base({ className })}>
|
|
14
|
+
{message.map((msg, index) => (
|
|
15
|
+
<li key={index} className={styles.base({ className })}>
|
|
16
16
|
<FinalIcon copyrightYear="2023" className={styles.icon({})} size="xsmall" look="outlined" />
|
|
17
17
|
{msg}
|
|
18
18
|
</li>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef } from 'react';
|
|
3
|
+
import React, { Ref, forwardRef } from 'react';
|
|
4
4
|
import { mergeProps, useFocusRing } from 'react-aria';
|
|
5
5
|
|
|
6
6
|
import { ArrowRightIcon } from '../icon/index.js';
|
|
@@ -26,7 +26,7 @@ function FlexiCellBase(
|
|
|
26
26
|
tabIndex,
|
|
27
27
|
...props
|
|
28
28
|
}: FlexiCellProps,
|
|
29
|
-
ref:
|
|
29
|
+
ref: Ref<HTMLElement>,
|
|
30
30
|
) {
|
|
31
31
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
32
32
|
|
|
@@ -41,7 +41,7 @@ function FlexiCellBase(
|
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
43
|
<Tag
|
|
44
|
-
{...({ ref } as
|
|
44
|
+
{...({ ref } as object)}
|
|
45
45
|
className={styles.base({ className })}
|
|
46
46
|
href={href}
|
|
47
47
|
{...mergeProps(props, focusProps)}
|
|
@@ -6,12 +6,7 @@ import { type InputGroupAddOnDefaultAddOnProps } from './input-group-add-on-defa
|
|
|
6
6
|
/**
|
|
7
7
|
* @private
|
|
8
8
|
*/
|
|
9
|
-
export const InputGroupAddOnDefaultAddOn = ({
|
|
10
|
-
position,
|
|
11
|
-
className,
|
|
12
|
-
children,
|
|
13
|
-
...props
|
|
14
|
-
}: InputGroupAddOnDefaultAddOnProps) => {
|
|
9
|
+
export const InputGroupAddOnDefaultAddOn = ({ className, children, ...props }: InputGroupAddOnDefaultAddOnProps) => {
|
|
15
10
|
return (
|
|
16
11
|
<div className={styles({ className })} {...props}>
|
|
17
12
|
{children}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, {
|
|
3
|
+
import React, {
|
|
4
|
+
Attributes,
|
|
5
|
+
Children,
|
|
6
|
+
ReactNode,
|
|
7
|
+
cloneElement,
|
|
8
|
+
isValidElement,
|
|
9
|
+
useCallback,
|
|
10
|
+
useId,
|
|
11
|
+
useMemo,
|
|
12
|
+
} from 'react';
|
|
4
13
|
|
|
5
14
|
import { ErrorMessage, Hint, Label } from '../index.js';
|
|
6
15
|
|
|
@@ -37,7 +46,7 @@ export function InputGroup({
|
|
|
37
46
|
...(supportingText ? [`${id}-supporting-text`] : []),
|
|
38
47
|
];
|
|
39
48
|
return arr.join(' ');
|
|
40
|
-
}, [id, hint,
|
|
49
|
+
}, [errorMessage, id, hint, before, after, supportingText]);
|
|
41
50
|
|
|
42
51
|
const {
|
|
43
52
|
element: beforeElement,
|
|
@@ -81,10 +90,10 @@ export function InputGroup({
|
|
|
81
90
|
id,
|
|
82
91
|
'aria-describedby': ariaDescribedByValue,
|
|
83
92
|
...(width !== 'full' ? { width: width } : {}),
|
|
84
|
-
} as
|
|
93
|
+
} as Partial<unknown> & Attributes);
|
|
85
94
|
}
|
|
86
95
|
});
|
|
87
|
-
}, [children, ariaDescribedByValue]);
|
|
96
|
+
}, [children, size, id, ariaDescribedByValue, width]);
|
|
88
97
|
|
|
89
98
|
const isFieldset = useMemo(() => Tag === 'fieldset', [Tag]);
|
|
90
99
|
|
|
@@ -93,7 +102,7 @@ export function InputGroup({
|
|
|
93
102
|
after: !!after,
|
|
94
103
|
afterInset,
|
|
95
104
|
beforeInset,
|
|
96
|
-
width:
|
|
105
|
+
width: width,
|
|
97
106
|
});
|
|
98
107
|
|
|
99
108
|
return (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
|
+
const inlineFlexInput = { input: 'inline-flex' };
|
|
3
4
|
export const styles = tv(
|
|
4
5
|
{
|
|
5
6
|
slots: {
|
|
@@ -23,9 +24,21 @@ export const styles = tv(
|
|
|
23
24
|
true: '',
|
|
24
25
|
false: '',
|
|
25
26
|
},
|
|
27
|
+
// Has to be done this as doing it with compoundVariants with array was not working
|
|
26
28
|
width: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
full: '',
|
|
30
|
+
1: inlineFlexInput,
|
|
31
|
+
2: inlineFlexInput,
|
|
32
|
+
3: inlineFlexInput,
|
|
33
|
+
4: inlineFlexInput,
|
|
34
|
+
5: inlineFlexInput,
|
|
35
|
+
6: inlineFlexInput,
|
|
36
|
+
7: inlineFlexInput,
|
|
37
|
+
8: inlineFlexInput,
|
|
38
|
+
9: inlineFlexInput,
|
|
39
|
+
10: inlineFlexInput,
|
|
40
|
+
20: inlineFlexInput,
|
|
41
|
+
30: inlineFlexInput,
|
|
29
42
|
},
|
|
30
43
|
},
|
|
31
44
|
compoundVariants: [
|
|
@@ -49,12 +62,6 @@ export const styles = tv(
|
|
|
49
62
|
beforeInset: true,
|
|
50
63
|
className: { base: 'input-group-inset-before' },
|
|
51
64
|
},
|
|
52
|
-
{
|
|
53
|
-
width: true,
|
|
54
|
-
className: {
|
|
55
|
-
input: 'inline-flex',
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
65
|
],
|
|
59
66
|
},
|
|
60
67
|
{ responsiveVariants: ['xsl', 'sm', 'md', 'lg', 'xl'] },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef, useContext } from 'react';
|
|
3
|
+
import React, { Ref, forwardRef, useContext } from 'react';
|
|
4
4
|
import { useFocusRing } from 'react-aria';
|
|
5
5
|
|
|
6
6
|
import { ListContext } from '../../list.component.js';
|
|
@@ -11,7 +11,7 @@ import { type ListItemProps } from './list-item.types.js';
|
|
|
11
11
|
|
|
12
12
|
export function BaseListItem(
|
|
13
13
|
{ className, children, href, target, look, type, spacing, icon, ...props }: ListItemProps,
|
|
14
|
-
ref:
|
|
14
|
+
ref: Ref<HTMLAnchorElement>,
|
|
15
15
|
) {
|
|
16
16
|
const state = useContext(ListContext);
|
|
17
17
|
|
|
@@ -25,5 +25,7 @@ export type PaginationItemProps = {
|
|
|
25
25
|
/**
|
|
26
26
|
* Link component to render
|
|
27
27
|
*/
|
|
28
|
+
// NOTE: any typing below is very hard to replace
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
30
|
tag?: 'a' | 'button' | ((...args: any[]) => ReactElement | null);
|
|
29
31
|
} & (AnchorHTMLAttributes<HTMLAnchorElement> | ButtonHTMLAttributes<HTMLButtonElement>);
|
|
@@ -66,7 +66,7 @@ export function Pagination({
|
|
|
66
66
|
tag: linkComponent || 'a',
|
|
67
67
|
href: fowardOnly ? pages[pages.length - 1].href : pages[(current || 0) - 2]?.href,
|
|
68
68
|
};
|
|
69
|
-
}, [current, onChange, linkComponent, pages,
|
|
69
|
+
}, [current, infinite, onChange, linkComponent, pages, generateHandleOnClickBackwards]);
|
|
70
70
|
|
|
71
71
|
const generateHandleOnClickForward = useCallback(
|
|
72
72
|
(current: number, infinite: boolean, backwardsOnly: boolean, onChange: (page: number) => unknown) => () => {
|
|
@@ -108,7 +108,7 @@ export function Pagination({
|
|
|
108
108
|
tag: linkComponent || 'a',
|
|
109
109
|
href: backwardsOnly ? pages[0].href : pages[current || 0]?.href,
|
|
110
110
|
};
|
|
111
|
-
}, [current,
|
|
111
|
+
}, [current, pages, infinite, linkComponent, onChange, generateHandleOnClickForward]);
|
|
112
112
|
|
|
113
113
|
return (
|
|
114
114
|
<Tag className={styles.base({ className })} role={role} aria-label="Page number" {...props}>
|
|
@@ -13,7 +13,7 @@ export const usePagination = ({ defaultCurrent = 1, pages, infinite = false }: P
|
|
|
13
13
|
}
|
|
14
14
|
return cannotGoForward ? currentPage : currentPage + 1;
|
|
15
15
|
});
|
|
16
|
-
}, [pages]);
|
|
16
|
+
}, [infinite, pages.length]);
|
|
17
17
|
|
|
18
18
|
const previous = useCallback(() => {
|
|
19
19
|
setCurrentPage(currentPage => {
|
|
@@ -23,7 +23,7 @@ export const usePagination = ({ defaultCurrent = 1, pages, infinite = false }: P
|
|
|
23
23
|
}
|
|
24
24
|
return cannotGoBackwards ? currentPage : currentPage - 1;
|
|
25
25
|
});
|
|
26
|
-
}, [pages]);
|
|
26
|
+
}, [infinite, pages.length]);
|
|
27
27
|
|
|
28
28
|
const selectedPage = useMemo(() => {
|
|
29
29
|
return pages[currentPage - 1];
|
|
@@ -31,7 +31,7 @@ export function PassCode({ length, onComplete, className, ...props }: PassCodePr
|
|
|
31
31
|
onComplete(newPasscode.join(''));
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
[
|
|
34
|
+
[passcode, length, onComplete],
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
const handlePaste = useCallback(
|
|
@@ -47,7 +47,7 @@ export function PassCode({ length, onComplete, className, ...props }: PassCodePr
|
|
|
47
47
|
onComplete(newPasscode.join(''));
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
[passcode],
|
|
50
|
+
[length, onComplete, passcode],
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
const handleKeyDown = useCallback(
|
|
@@ -66,7 +66,7 @@ export function PassCode({ length, onComplete, className, ...props }: PassCodePr
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
[
|
|
69
|
+
[passcode],
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
const handleFocus = useCallback(
|
|
@@ -33,11 +33,11 @@ export type PassCodeViewProps = {
|
|
|
33
33
|
/**
|
|
34
34
|
* on click the resend button
|
|
35
35
|
*/
|
|
36
|
-
onResend?: () =>
|
|
36
|
+
onResend?: () => void;
|
|
37
37
|
/**
|
|
38
38
|
* on click the update button
|
|
39
39
|
*/
|
|
40
|
-
onUpdate?: () =>
|
|
40
|
+
onUpdate?: () => void;
|
|
41
41
|
/**
|
|
42
42
|
* length of the passcode
|
|
43
43
|
*/
|
|
@@ -3,7 +3,7 @@ import { FocusScope } from 'react-aria';
|
|
|
3
3
|
|
|
4
4
|
import { Button } from '../../../button/index.js';
|
|
5
5
|
import { CloseIcon } from '../../../icon/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { getPopoverPosition } from '../../popover.utils.js';
|
|
7
7
|
|
|
8
8
|
import { styles as panelStyles } from './panel.styles.js';
|
|
9
9
|
import { type PanelProps, Position } from './panel.types.js';
|
|
@@ -29,8 +29,8 @@ export function Panel({ state, heading, headingTag: Tag = 'h1', content, placeme
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
useLayoutEffect(() => {
|
|
32
|
-
setPosition(
|
|
33
|
-
}, [state.isOpen]);
|
|
32
|
+
setPosition(getPopoverPosition(triggerRef, popoverRef, arrowRef, placement));
|
|
33
|
+
}, [placement, remSize, state.isOpen, triggerRef]);
|
|
34
34
|
|
|
35
35
|
const getPopoverClass = useCallback(() => {
|
|
36
36
|
return {
|
|
@@ -30,18 +30,18 @@ export function Popover({
|
|
|
30
30
|
const state = useOverlayTriggerState({});
|
|
31
31
|
const panelId = useId();
|
|
32
32
|
const styles = popoverStyles({});
|
|
33
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
33
|
+
const ref = useRef<HTMLButtonElement & HTMLAnchorElement & HTMLSpanElement & HTMLDivElement>(null);
|
|
34
34
|
|
|
35
35
|
const handleClick = useCallback(() => {
|
|
36
36
|
onClick();
|
|
37
37
|
state.toggle();
|
|
38
|
-
}, [onClick, state
|
|
38
|
+
}, [onClick, state]);
|
|
39
39
|
|
|
40
40
|
const keyHandler = useCallback(
|
|
41
41
|
(event: globalThis.KeyboardEvent) => {
|
|
42
42
|
if (state.isOpen && event.key === 'Escape') state.close();
|
|
43
43
|
},
|
|
44
|
-
[state
|
|
44
|
+
[state],
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
useEffect(() => {
|
|
@@ -49,11 +49,11 @@ export function Popover({
|
|
|
49
49
|
return () => {
|
|
50
50
|
window.document.removeEventListener('keydown', keyHandler);
|
|
51
51
|
};
|
|
52
|
-
}, [state.isOpen]);
|
|
52
|
+
}, [keyHandler, state.isOpen]);
|
|
53
53
|
|
|
54
54
|
useLayoutEffect(() => {
|
|
55
55
|
if (open) state.setOpen(true);
|
|
56
|
-
}, [open]);
|
|
56
|
+
}, [open, state]);
|
|
57
57
|
return (
|
|
58
58
|
<div className={styles.base({ className })}>
|
|
59
59
|
<Button
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RefObject
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Position } from './components/panel/panel.types.js';
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const getPopoverPosition = (
|
|
6
6
|
triggerRef: RefObject<HTMLDivElement>,
|
|
7
7
|
popoverRef: RefObject<HTMLDivElement>,
|
|
8
8
|
arrowRef: RefObject<HTMLDivElement>,
|
package/src/components/progress-rope/components/progress-rope-step/progress-rope-step.component.tsx
CHANGED
|
@@ -14,7 +14,6 @@ export function ProgressRopeStep({
|
|
|
14
14
|
current,
|
|
15
15
|
visited,
|
|
16
16
|
tag: Tag = 'button',
|
|
17
|
-
type,
|
|
18
17
|
size = 'medium',
|
|
19
18
|
children,
|
|
20
19
|
firstItem,
|
|
@@ -41,7 +40,7 @@ export function ProgressRopeStep({
|
|
|
41
40
|
return 'visited';
|
|
42
41
|
}
|
|
43
42
|
return 'non-visited';
|
|
44
|
-
}, [current, visited]);
|
|
43
|
+
}, [current, lastItemInRope, visited]);
|
|
45
44
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
46
45
|
|
|
47
46
|
const styles = progressRopeStyles({
|
|
@@ -65,7 +64,7 @@ export function ProgressRopeStep({
|
|
|
65
64
|
return ', complete';
|
|
66
65
|
}
|
|
67
66
|
return ', not started';
|
|
68
|
-
}, [current, visited]);
|
|
67
|
+
}, [current, furthest, visited]);
|
|
69
68
|
|
|
70
69
|
return (
|
|
71
70
|
<Tag
|
|
@@ -68,7 +68,7 @@ export function ProgressRope({
|
|
|
68
68
|
if (newGroupStepIndex !== openedGroupStepIndex) {
|
|
69
69
|
setOpenedGroupStepIndex(newGroupStepIndex);
|
|
70
70
|
}
|
|
71
|
-
}, [current]);
|
|
71
|
+
}, [current, mappedData, openedGroupStepIndex]);
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
74
|
<Tag className={className} role={role} aria-label={ariaLabel} {...props}>
|
|
@@ -92,7 +92,6 @@ export function ProgressRope({
|
|
|
92
92
|
) : (
|
|
93
93
|
<ProgressRopeStep
|
|
94
94
|
firstItem={index === 0}
|
|
95
|
-
type={item.type}
|
|
96
95
|
onClick={furthestVisitedStep >= item.index ? item.onClick : undefined}
|
|
97
96
|
visited={furthestVisitedStep > item.index}
|
|
98
97
|
furthest={furthestVisitedStep === item.index}
|
package/src/components/radio-group/components/radio-group-radio/radio-group-radio.component.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef, useContext, useRef } from 'react';
|
|
3
|
+
import React, { Ref, forwardRef, useContext, useRef } from 'react';
|
|
4
4
|
import { VisuallyHidden, useFocusRing, useRadio } from 'react-aria';
|
|
5
5
|
|
|
6
6
|
import { RadioGroupContext } from '../../radio-group.component.js';
|
|
@@ -8,7 +8,7 @@ import { RadioGroupContext } from '../../radio-group.component.js';
|
|
|
8
8
|
import { styles as radioStyles } from './radio-group-radio.styles.js';
|
|
9
9
|
import { type RadioGroupRadioProps } from './radio-group-radio.types.js';
|
|
10
10
|
|
|
11
|
-
function BaseRadioGroupRadio({ className, hint, label, ...props }: RadioGroupRadioProps, ref:
|
|
11
|
+
function BaseRadioGroupRadio({ className, hint, label, ...props }: RadioGroupRadioProps, ref: Ref<HTMLLabelElement>) {
|
|
12
12
|
const { state, size, orientation } = useContext(RadioGroupContext);
|
|
13
13
|
const localRef = useRef(null);
|
|
14
14
|
const { inputProps, isSelected, isDisabled } = useRadio({ ...props, children: label }, state, localRef);
|
|
@@ -90,7 +90,7 @@ export function RadioGroup({
|
|
|
90
90
|
);
|
|
91
91
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
92
92
|
const [hiddenOptions, setHiddenOptions] = useState<boolean>(showAmount > 0);
|
|
93
|
-
const firstNewRadioRef = useRef<
|
|
93
|
+
const firstNewRadioRef = useRef<HTMLLabelElement>(null);
|
|
94
94
|
const revealAmount = radios && radios.length - showAmount;
|
|
95
95
|
const styles = radioGroupStyles({ orientation, isFocusVisible });
|
|
96
96
|
const panelId = useId();
|
|
@@ -112,9 +112,7 @@ export function RadioGroup({
|
|
|
112
112
|
<div className={styles.base({ className })} {...radioGroupProps}>
|
|
113
113
|
<Label {...labelProps}>{label}</Label>
|
|
114
114
|
{hintMessage && <Hint {...descriptionProps}>{hintMessage}</Hint>}
|
|
115
|
-
{errorMessage && state.
|
|
116
|
-
<ErrorMessage {...errorMessageProps} message={errorMessage} />
|
|
117
|
-
)}
|
|
115
|
+
{errorMessage && state.isInvalid && <ErrorMessage {...errorMessageProps} message={errorMessage} />}
|
|
118
116
|
<div className={styles.radioWrapper()} id={panelId}>
|
|
119
117
|
<RadioGroupContext.Provider value={{ state, orientation, size }}>{childrenToRender}</RadioGroupContext.Provider>
|
|
120
118
|
{hiddenOptions && (
|
|
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
export const styles = tv(
|
|
4
4
|
{
|
|
5
|
-
base: 'form-control bg-no-repeat select-caret disabled:form-control-disabled group-
|
|
5
|
+
base: 'form-control bg-no-repeat select-caret disabled:form-control-disabled group-first/add-on-before:!rounded-l group-first/add-on-before:rounded-r-none group-first/add-on-before:!border-x group-last/add-on-after:!rounded-r group-last/add-on-after:rounded-l-none group-last/add-on-after:!border-x group-[.input-group-after]:rounded-r-none group-[.input-group-before]:rounded-l-none group-[.input-group-after]:border-r-0 group-[.input-group-before]:border-l-0',
|
|
6
6
|
variants: {
|
|
7
7
|
size: {
|
|
8
8
|
small: 'form-control-small bg-[right_0.5625rem_center] pr-[calc(0.5rem+14px+0.5625rem)]',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { MouseEventHandler, forwardRef, useCallback, useContext } from 'react';
|
|
1
|
+
import React, { MouseEventHandler, Ref, forwardRef, useCallback, useContext } from 'react';
|
|
2
2
|
import { mergeProps, useFocusRing } from 'react-aria';
|
|
3
3
|
|
|
4
4
|
import { FlexiCell } from '../../../../../../index.js';
|
|
@@ -21,7 +21,7 @@ function BaseSelectorButtonGroupOption(
|
|
|
21
21
|
id,
|
|
22
22
|
...props
|
|
23
23
|
}: SelectorButtonGroupOptionProps,
|
|
24
|
-
ref:
|
|
24
|
+
ref: Ref<HTMLElement>,
|
|
25
25
|
) {
|
|
26
26
|
const state = useContext(SelectorButtonContext);
|
|
27
27
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
@@ -36,7 +36,7 @@ function BaseSelectorButtonGroupOption(
|
|
|
36
36
|
onClick(event);
|
|
37
37
|
state.onClick(id);
|
|
38
38
|
},
|
|
39
|
-
[onClick, state
|
|
39
|
+
[id, onClick, state],
|
|
40
40
|
);
|
|
41
41
|
return (
|
|
42
42
|
<FlexiCell
|
package/src/components/selector/components/selector-button-group/selector-button-group.component.tsx
CHANGED
|
@@ -32,7 +32,7 @@ export function SelectorButtonGroup({
|
|
|
32
32
|
(id: string) => {
|
|
33
33
|
setSelected(id);
|
|
34
34
|
},
|
|
35
|
-
[
|
|
35
|
+
[setSelected],
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
const state: SelectorButtonGroupContextState = useMemo(
|
|
@@ -42,7 +42,7 @@ export function SelectorButtonGroup({
|
|
|
42
42
|
validationState: errorMessage ? 'invalid' : 'valid',
|
|
43
43
|
isDisabled,
|
|
44
44
|
}),
|
|
45
|
-
[selected],
|
|
45
|
+
[errorMessage, handleChange, isDisabled, selected],
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
const { labelProps, fieldProps, descriptionProps, errorMessageProps } = useField({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef, useContext, useRef } from 'react';
|
|
3
|
+
import React, { Ref, forwardRef, useContext, useRef } from 'react';
|
|
4
4
|
import { VisuallyHidden, mergeProps, useCheckboxGroupItem, useFocusRing } from 'react-aria';
|
|
5
5
|
|
|
6
6
|
import { ArrowRightIcon, TickIcon } from '../../../../../../components/icon/index.js';
|
|
@@ -22,7 +22,7 @@ function BaseSelectorCheckboxGroupOption(
|
|
|
22
22
|
checkIcon = 'checkbox',
|
|
23
23
|
...props
|
|
24
24
|
}: SelectorCheckboxGroupOptionProps,
|
|
25
|
-
ref:
|
|
25
|
+
ref: Ref<HTMLElement>,
|
|
26
26
|
) {
|
|
27
27
|
const state = useContext(SelectorCheckboxGroupContext);
|
|
28
28
|
const localRef = useRef(null);
|
|
@@ -82,9 +82,7 @@ export function SelectorCheckboxGroup(props: SelectorCheckboxGroupProps) {
|
|
|
82
82
|
<>
|
|
83
83
|
{label && <Label {...labelProps}>{label}</Label>}
|
|
84
84
|
{description && <Hint {...descriptionProps}>{description}</Hint>}
|
|
85
|
-
{errorMessage && state.
|
|
86
|
-
<ErrorMessage {...errorMessageProps} message={errorMessage} />
|
|
87
|
-
)}
|
|
85
|
+
{errorMessage && state.isInvalid && <ErrorMessage {...errorMessageProps} message={errorMessage} />}
|
|
88
86
|
<div {...groupProps} className={styles({ className: groupProps.className })}>
|
|
89
87
|
<SelectorCheckboxGroupContext.Provider value={state}>{children}</SelectorCheckboxGroupContext.Provider>
|
|
90
88
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef, useContext, useId, useRef } from 'react';
|
|
3
|
+
import React, { Ref, RefObject, forwardRef, useContext, useId, useRef } from 'react';
|
|
4
4
|
import { mergeProps, useFocusRing, useLink } from 'react-aria';
|
|
5
5
|
|
|
6
6
|
import { FlexiCell } from '../../../../../../index.js';
|
|
@@ -22,12 +22,12 @@ function BaseSelectorLinkGroupOption(
|
|
|
22
22
|
href,
|
|
23
23
|
...props
|
|
24
24
|
}: SelectorLinkGroupOptionProps,
|
|
25
|
-
ref:
|
|
25
|
+
ref: Ref<HTMLElement>,
|
|
26
26
|
) {
|
|
27
27
|
const id = useId();
|
|
28
28
|
const localRef = useRef(ref);
|
|
29
29
|
const state = useContext(SelectorLinkContext);
|
|
30
|
-
const { linkProps } = useLink({ ...props }, localRef);
|
|
30
|
+
const { linkProps } = useLink({ ...props }, localRef as RefObject<HTMLElement>);
|
|
31
31
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
32
32
|
const styles = SelectorLinkGroupOptionStyles({
|
|
33
33
|
className,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef, useContext, useRef } from 'react';
|
|
3
|
+
import React, { Ref, forwardRef, useContext, useRef } from 'react';
|
|
4
4
|
import { VisuallyHidden, mergeProps, useFocusRing, useRadio } from 'react-aria';
|
|
5
5
|
|
|
6
6
|
import { ArrowRightIcon, TickIcon } from '../../../../../../components/icon/index.js';
|
|
@@ -22,7 +22,7 @@ function BaseSelectorRadioGroupOption(
|
|
|
22
22
|
checkIcon = 'checkbox',
|
|
23
23
|
...props
|
|
24
24
|
}: SelectorRadioGroupOptionProps,
|
|
25
|
-
ref:
|
|
25
|
+
ref: Ref<HTMLElement>,
|
|
26
26
|
) {
|
|
27
27
|
const { state } = useContext(SelectorRadioGroupContext);
|
|
28
28
|
const localRef = useRef(null);
|
package/src/components/selector/components/selector-radio-group/selector-radio-group.component.tsx
CHANGED
|
@@ -89,9 +89,7 @@ export function SelectorRadioGroup({
|
|
|
89
89
|
<>
|
|
90
90
|
{label && <Label {...labelProps}>{label}</Label>}
|
|
91
91
|
{description && <Hint {...descriptionProps}>{description}</Hint>}
|
|
92
|
-
{errorMessage && state.
|
|
93
|
-
<ErrorMessage {...errorMessageProps} message={errorMessage} />
|
|
94
|
-
)}
|
|
92
|
+
{errorMessage && state.isInvalid && <ErrorMessage {...errorMessageProps} message={errorMessage} />}
|
|
95
93
|
<div className={styles({ className, orientation })} {...radioGroupProps}>
|
|
96
94
|
<SelectorRadioGroupContext.Provider value={{ state, orientation }}>
|
|
97
95
|
{children}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef } from 'react';
|
|
3
|
+
import React, { Ref, forwardRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { styles } from './skip-link.styles.js';
|
|
6
6
|
import { type SkipLinkProps } from './skip-link.types.js';
|
|
7
7
|
|
|
8
|
-
function BaseSkipLink({ className, tag: Tag = 'a', children, ...props }: SkipLinkProps, ref:
|
|
8
|
+
function BaseSkipLink({ className, tag: Tag = 'a', children, ...props }: SkipLinkProps, ref: Ref<HTMLElement>) {
|
|
9
9
|
return (
|
|
10
|
-
<Tag {...({ ref } as
|
|
10
|
+
<Tag {...({ ref } as object)} className={styles({ className })} {...props}>
|
|
11
11
|
{children}
|
|
12
12
|
</Tag>
|
|
13
13
|
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
|
-
import { mergeProps, useFocusRing, useTab } from 'react-aria';
|
|
2
|
+
import { Key, mergeProps, useFocusRing, useTab } from 'react-aria';
|
|
3
3
|
|
|
4
4
|
import { styles } from './tabs-tab.styles.js';
|
|
5
5
|
import { type TabsTabProps } from './tabs-tab.types.js';
|
|
6
6
|
|
|
7
7
|
export function TabsTab({ item: { key, rendered }, state, orientation, justify, color, look }: TabsTabProps) {
|
|
8
8
|
const ref = useRef(null);
|
|
9
|
-
const { tabProps } = useTab({ key: key as
|
|
9
|
+
const { tabProps } = useTab({ key: key as Key }, state, ref);
|
|
10
10
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
11
11
|
return (
|
|
12
12
|
<div
|