@westpac/ui 0.16.0 → 0.18.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/CHANGELOG.md +12 -0
- package/dist/component-type.json +1 -1
- package/dist/components/accordion/accordion.component.d.ts +2 -1
- package/dist/components/autocomplete/autocomplete.component.js +4 -2
- package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.styles.d.ts +1 -1
- package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.styles.js +1 -1
- package/dist/components/autocomplete/components/autocomplete-popover/autocomplete-popover.component.js +2 -1
- package/dist/components/badge/badge.component.js +3 -1
- package/dist/components/badge/badge.styles.js +1 -1
- package/dist/components/bottom-sheet/bottom-sheet.component.d.ts +1 -1
- package/dist/components/bottom-sheet/bottom-sheet.component.js +7 -2
- package/dist/components/bottom-sheet/bottom-sheet.types.d.ts +20 -0
- package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.component.d.ts +1 -1
- package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.component.js +26 -11
- package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.d.ts +47 -0
- package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.js +20 -0
- package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.types.d.ts +17 -1
- package/dist/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.d.ts +1 -1
- package/dist/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.js +8 -14
- package/dist/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.styles.d.ts +11 -0
- package/dist/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.styles.js +17 -0
- package/dist/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.types.d.ts +0 -5
- package/dist/components/button-group/button-group.component.js +58 -11
- package/dist/components/button-group/button-group.types.d.ts +9 -1
- package/dist/components/button-group/components/button-group-button/button-group-button.component.js +1 -2
- package/dist/components/checkbox-group/checkbox-group.component.js +61 -10
- package/dist/components/checkbox-group/checkbox-group.types.d.ts +5 -1
- package/dist/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.js +1 -2
- package/dist/components/date-picker/date-picker.types.d.ts +1 -0
- package/dist/components/error-message/error-message.types.d.ts +3 -2
- package/dist/components/icon/components/x-icon.d.ts +2 -0
- package/dist/components/icon/components/x-icon.js +40 -0
- package/dist/components/icon/index.d.ts +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/list/components/list-item/list-item.component.d.ts +1 -1
- package/dist/components/list/list.utils.d.ts +1 -1
- package/dist/components/modal/components/modal-backdrop/modal-backdrop.component.js +4 -2
- package/dist/components/modal/components/modal-backdrop/modal-backdrop.styles.d.ts +10 -0
- package/dist/components/modal/components/modal-backdrop/modal-backdrop.styles.js +7 -2
- package/dist/components/modal/components/modal-dialog/components/modal-dialog-body/modal-dialog-body.component.js +7 -2
- package/dist/components/modal/components/modal-dialog/components/modal-dialog-body/modal-dialog-body.styles.d.ts +43 -5
- package/dist/components/modal/components/modal-dialog/components/modal-dialog-body/modal-dialog-body.styles.js +30 -1
- package/dist/components/modal/components/modal-dialog/components/modal-dialog-footer/modal-dialog-footer.component.d.ts +1 -1
- package/dist/components/modal/components/modal-dialog/components/modal-dialog-footer/modal-dialog-footer.component.js +21 -4
- package/dist/components/modal/components/modal-dialog/components/modal-dialog-footer/modal-dialog-footer.styles.d.ts +47 -5
- package/dist/components/modal/components/modal-dialog/components/modal-dialog-footer/modal-dialog-footer.styles.js +32 -1
- package/dist/components/modal/components/modal-dialog/components/modal-dialog-footer/modal-dialog-footer.types.d.ts +16 -0
- package/dist/components/modal/components/modal-dialog/modal-dialog.component.d.ts +2 -1
- package/dist/components/modal/components/modal-dialog/modal-dialog.component.js +11 -2
- package/dist/components/modal/components/modal-dialog/modal-dialog.styles.d.ts +18 -0
- package/dist/components/modal/components/modal-dialog/modal-dialog.styles.js +16 -7
- package/dist/components/modal/components/modal-dialog/modal-dialog.types.d.ts +6 -0
- package/dist/components/popover/components/panel/panel.styles.js +2 -2
- package/dist/components/radio-group/components/radio-group-radio/radio-group-radio.component.js +1 -2
- package/dist/components/radio-group/radio-group.component.js +58 -11
- package/dist/components/radio-group/radio-group.types.d.ts +5 -1
- package/dist/components/repeater/repeater.component.js +4 -2
- package/dist/components/selector/components/selector-button-group/selector-button-group.component.js +9 -7
- package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.js +50 -1
- package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.js +1 -1
- package/dist/components/selector/components/selector-radio-group/selector-radio-group.component.js +58 -11
- package/dist/components/selector/components/selector-radio-group/selector-radio-group.types.d.ts +5 -1
- package/dist/components/tabs/components/tabs-tab/tabs-tab.component.js +1 -1
- package/dist/components/tabs/tabs.component.d.ts +6 -2
- package/dist/components/tabs/tabs.component.js +7 -1
- package/dist/constants/message.d.ts +1 -0
- package/dist/constants/message.js +1 -0
- package/dist/css/westpac-ui.css +192 -100
- package/dist/css/westpac-ui.min.css +192 -100
- package/package.json +10 -10
- package/src/components/accordion/accordion.component.tsx +3 -3
- package/src/components/accordion/components/accordion-item/accordion-item.component.tsx +2 -2
- package/src/components/autocomplete/autocomplete.component.tsx +5 -1
- package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.component.tsx +1 -1
- package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.styles.ts +1 -1
- package/src/components/autocomplete/components/autocomplete-popover/autocomplete-popover.component.tsx +4 -1
- package/src/components/badge/badge.component.tsx +2 -1
- package/src/components/badge/badge.styles.ts +1 -1
- package/src/components/bottom-sheet/bottom-sheet.component.tsx +20 -2
- package/src/components/bottom-sheet/bottom-sheet.types.ts +20 -0
- package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.component.tsx +33 -14
- package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.ts +16 -0
- package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.types.ts +17 -1
- package/src/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.tsx +11 -26
- package/src/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.styles.ts +14 -0
- package/src/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.types.ts +0 -5
- package/src/components/button-group/button-group.component.tsx +58 -11
- package/src/components/button-group/button-group.types.ts +9 -2
- package/src/components/button-group/components/button-group-button/button-group-button.component.tsx +1 -2
- package/src/components/checkbox-group/checkbox-group.component.tsx +62 -10
- package/src/components/checkbox-group/checkbox-group.types.ts +5 -1
- package/src/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.tsx +1 -2
- package/src/components/date-picker/date-picker.types.ts +4 -0
- package/src/components/error-message/error-message.component.tsx +2 -2
- package/src/components/error-message/error-message.types.ts +2 -1
- package/src/components/icon/components/x-icon.tsx +37 -0
- package/src/components/icon/index.ts +1 -1
- package/src/components/modal/components/modal-backdrop/modal-backdrop.component.tsx +5 -2
- package/src/components/modal/components/modal-backdrop/modal-backdrop.styles.ts +7 -2
- package/src/components/modal/components/modal-dialog/components/modal-dialog-body/modal-dialog-body.component.tsx +6 -2
- package/src/components/modal/components/modal-dialog/components/modal-dialog-body/modal-dialog-body.styles.ts +15 -3
- package/src/components/modal/components/modal-dialog/components/modal-dialog-footer/modal-dialog-footer.component.tsx +25 -4
- package/src/components/modal/components/modal-dialog/components/modal-dialog-footer/modal-dialog-footer.styles.ts +15 -3
- package/src/components/modal/components/modal-dialog/components/modal-dialog-footer/modal-dialog-footer.types.ts +16 -0
- package/src/components/modal/components/modal-dialog/modal-dialog.component.tsx +10 -3
- package/src/components/modal/components/modal-dialog/modal-dialog.styles.ts +14 -5
- package/src/components/modal/components/modal-dialog/modal-dialog.types.ts +7 -0
- package/src/components/pagination/pagination.component.tsx +6 -6
- package/src/components/popover/components/panel/panel.styles.ts +2 -2
- package/src/components/radio-group/components/radio-group-radio/radio-group-radio.component.tsx +1 -2
- package/src/components/radio-group/radio-group.component.tsx +57 -13
- package/src/components/radio-group/radio-group.types.ts +5 -1
- package/src/components/repeater/repeater.component.tsx +2 -0
- package/src/components/selector/components/selector-button-group/selector-button-group.component.tsx +10 -7
- package/src/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.tsx +49 -0
- package/src/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.tsx +1 -1
- package/src/components/selector/components/selector-radio-group/selector-radio-group.component.tsx +58 -11
- package/src/components/selector/components/selector-radio-group/selector-radio-group.types.ts +5 -1
- package/src/components/tabs/components/tabs-tab/tabs-tab.component.tsx +1 -1
- package/src/components/tabs/tabs.component.tsx +26 -5
- package/src/constants/message.ts +1 -0
- package/src/tailwind/utils/create-font-sizes.ts +11 -8
- package/src/tailwind/utils/generate-font-components.ts +18 -15
- package/src/tailwind/utils/generate-form-control.ts +11 -8
- package/dist/components/icon/components/twitter-icon.d.ts +0 -2
- package/dist/components/icon/components/twitter-icon.js +0 -35
- package/src/components/icon/components/twitter-icon.tsx +0 -37
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import { AlertIcon } from '../../components/icon/index.js';
|
|
4
4
|
|
|
@@ -21,7 +21,7 @@ export function ErrorMessage({ className, tag: Tag = 'div', icon: Icon, message,
|
|
|
21
21
|
) : (
|
|
22
22
|
<Tag className={styles.base({ className: `${className} mb-2` })} {...props}>
|
|
23
23
|
<FinalIcon copyrightYear="2023" className={styles.icon({})} size="xsmall" look="outlined" />
|
|
24
|
-
{message}
|
|
24
|
+
{message as ReactNode}
|
|
25
25
|
</Tag>
|
|
26
26
|
);
|
|
27
27
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { AriaFieldProps } from 'react-aria';
|
|
2
3
|
|
|
3
4
|
export type ErrorMessageProps = {
|
|
4
5
|
/**
|
|
@@ -8,7 +9,7 @@ export type ErrorMessageProps = {
|
|
|
8
9
|
/**
|
|
9
10
|
* Message or messages
|
|
10
11
|
*/
|
|
11
|
-
message?:
|
|
12
|
+
message?: AriaFieldProps['errorMessage'];
|
|
12
13
|
/**
|
|
13
14
|
* Tag to render
|
|
14
15
|
*/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Icon } from '../icon.component.js';
|
|
4
|
+
import { type IconProps } from '../icon.types.js';
|
|
5
|
+
|
|
6
|
+
export function XIcon({ look = 'filled', 'aria-label': ariaLabel = 'X', copyrightYear = '2024', ...props }: IconProps) {
|
|
7
|
+
return (
|
|
8
|
+
<Icon aria-label={ariaLabel} copyrightYear={copyrightYear} {...props}>
|
|
9
|
+
{look === 'filled' ? (
|
|
10
|
+
<Fragment>
|
|
11
|
+
<path fill="currentColor" d="M15.815 19.008h2.12L8.178 5.04h-2.12l9.757 13.968Z" />
|
|
12
|
+
<path
|
|
13
|
+
fill="currentColor"
|
|
14
|
+
fill-rule="evenodd"
|
|
15
|
+
d="M2 0a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2Zm17.315 4-5.824 6.775L19.825 20h-4.659l-4.265-6.212L5.56 20H4.18l6.107-7.104L4.18 4H8.84l4.039 5.883L17.935 4h1.38Z"
|
|
16
|
+
clip-rule="evenodd"
|
|
17
|
+
/>
|
|
18
|
+
</Fragment>
|
|
19
|
+
) : (
|
|
20
|
+
<Fragment>
|
|
21
|
+
<path
|
|
22
|
+
fill="currentColor"
|
|
23
|
+
fill-rule="evenodd"
|
|
24
|
+
d="m19.315 4-5.824 6.775L19.825 20h-4.659l-4.265-6.212L5.56 20H4.18l6.107-7.104L4.18 4H8.84l4.039 5.883L17.935 4h1.38Zm-3.5 15.008h2.12L8.178 5.04h-2.12l9.757 13.968Z"
|
|
25
|
+
clip-rule="evenodd"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
fill="currentColor"
|
|
29
|
+
fill-rule="evenodd"
|
|
30
|
+
d="M0 2a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v20a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2Zm2 0h20v20H2V2Z"
|
|
31
|
+
clip-rule="evenodd"
|
|
32
|
+
/>
|
|
33
|
+
</Fragment>
|
|
34
|
+
)}
|
|
35
|
+
</Icon>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -211,7 +211,6 @@ export { TransferIcon } from './components/transfer-icon.js';
|
|
|
211
211
|
export { TransportIcon } from './components/transport-icon.js';
|
|
212
212
|
export { TravelExploreIcon } from './components/travel-explore-icon.js';
|
|
213
213
|
export { TuneIcon } from './components/tune-icon.js';
|
|
214
|
-
export { TwitterIcon } from './components/twitter-icon.js';
|
|
215
214
|
export { UmbrellaIcon } from './components/umbrella-icon.js';
|
|
216
215
|
export { UploadIcon } from './components/upload-icon.js';
|
|
217
216
|
export { VerifiedIcon } from './components/verified-icon.js';
|
|
@@ -229,6 +228,7 @@ export { WindowsNewIcon } from './components/windows-new-icon.js';
|
|
|
229
228
|
export { WineGlassIcon } from './components/wine-glass-icon.js';
|
|
230
229
|
export { WordFileIcon } from './components/word-file-icon.js';
|
|
231
230
|
export { WriteIcon } from './components/write-icon.js';
|
|
231
|
+
export { XIcon } from './components/x-icon.js';
|
|
232
232
|
export { YammerIcon } from './components/yammer-icon.js';
|
|
233
233
|
export { YoutubeIcon } from './components/youtube-icon.js';
|
|
234
234
|
export { ZipFileIcon } from './components/zip-file-icon.js';
|
|
@@ -11,7 +11,7 @@ export function ModalBackdrop({ zIndex = 100, portalContainer, size, ...props }:
|
|
|
11
11
|
const { children, state, className } = props;
|
|
12
12
|
|
|
13
13
|
const ref = useRef(null);
|
|
14
|
-
const styles = backdropStyles({ className, fullscreen: size === 'full' });
|
|
14
|
+
const styles = backdropStyles({ className, fullscreen: size === 'full', fluid: size === 'fluid' });
|
|
15
15
|
|
|
16
16
|
const { modalProps, underlayProps } = useModalOverlay(props, state, ref);
|
|
17
17
|
|
|
@@ -20,8 +20,11 @@ export function ModalBackdrop({ zIndex = 100, portalContainer, size, ...props }:
|
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// This is required so branding applies correctly by default due to portal location, can be overridden with portalContainer prop
|
|
24
|
+
const brandContainer = document.querySelector('[data-theme]') || document.querySelector('[className="data-theme"]');
|
|
25
|
+
|
|
23
26
|
return (
|
|
24
|
-
<Overlay portalContainer={portalContainer}>
|
|
27
|
+
<Overlay portalContainer={portalContainer || brandContainer || document.body}>
|
|
25
28
|
<div style={{ zIndex }} className={styles.base()} {...underlayProps}>
|
|
26
29
|
<div {...modalProps} ref={ref} className={styles.modal()}>
|
|
27
30
|
{children}
|
|
@@ -2,8 +2,8 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
export const styles = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
base: 'fixed inset-0 z-50 flex animate-fadeIn justify-center overflow-y-auto bg-black/50 p-2',
|
|
6
|
-
modal: 'relative top-
|
|
5
|
+
base: 'fixed inset-0 z-50 flex animate-fadeIn items-center justify-center overflow-y-auto bg-black/50 p-2',
|
|
6
|
+
modal: 'relative top-3 z-10 h-fit w-full animate-fadeInDown',
|
|
7
7
|
},
|
|
8
8
|
variants: {
|
|
9
9
|
fullscreen: {
|
|
@@ -12,5 +12,10 @@ export const styles = tv({
|
|
|
12
12
|
base: 'flex flex-col p-0',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
|
+
fluid: {
|
|
16
|
+
true: {
|
|
17
|
+
modal: 'px-2',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
15
20
|
},
|
|
16
21
|
});
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useModalDialogContext } from '../../modal-dialog.component.js';
|
|
4
|
+
|
|
5
|
+
import { styles as modalBodyStyles } from './modal-dialog-body.styles.js';
|
|
4
6
|
import { type ModalDialogBodyProps } from './modal-dialog-body.types.js';
|
|
5
7
|
|
|
6
8
|
export function ModalDialogBody({ className, children, ...props }: ModalDialogBodyProps) {
|
|
9
|
+
const { size } = useModalDialogContext();
|
|
10
|
+
const styles = modalBodyStyles({ size });
|
|
7
11
|
return (
|
|
8
|
-
<div className={styles({ className })} {...props}>
|
|
12
|
+
<div className={styles.base({ className })} {...props}>
|
|
9
13
|
{children}
|
|
10
14
|
</div>
|
|
11
15
|
);
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
|
-
export const styles = tv(
|
|
4
|
-
|
|
5
|
-
}
|
|
3
|
+
export const styles = tv(
|
|
4
|
+
{
|
|
5
|
+
slots: { base: 'flex-1 overflow-auto' },
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
full: { base: 'px-4 py-3' },
|
|
9
|
+
lg: { base: 'px-12 pb-12' },
|
|
10
|
+
md: { base: 'px-7 pb-7' },
|
|
11
|
+
sm: { base: 'px-5 pb-7' },
|
|
12
|
+
fluid: { base: 'px-5 pb-7' },
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{ responsiveVariants: ['xsl', 'sm', 'md', 'lg', 'xl'] },
|
|
17
|
+
);
|
|
@@ -1,12 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
|
|
3
|
-
import {
|
|
5
|
+
import { Button } from '../../../../../button/index.js';
|
|
6
|
+
import { useModalDialogContext } from '../../modal-dialog.component.js';
|
|
7
|
+
|
|
8
|
+
import { styles as modalFooterStyles } from './modal-dialog-footer.styles.js';
|
|
4
9
|
import { type ModalDialogFooterProps } from './modal-dialog-footer.types.js';
|
|
5
10
|
|
|
6
|
-
export function ModalDialogFooter({
|
|
11
|
+
export function ModalDialogFooter({
|
|
12
|
+
className,
|
|
13
|
+
primaryLabel,
|
|
14
|
+
primaryOnClick,
|
|
15
|
+
secondaryLabel,
|
|
16
|
+
secondaryOnClick,
|
|
17
|
+
...props
|
|
18
|
+
}: ModalDialogFooterProps) {
|
|
19
|
+
const { size } = useModalDialogContext();
|
|
20
|
+
const styles = modalFooterStyles({ size });
|
|
7
21
|
return (
|
|
8
|
-
<div className={styles({ className })} {...props}>
|
|
9
|
-
{
|
|
22
|
+
<div className={styles.base({ className })} {...props}>
|
|
23
|
+
<Button look="primary" size="large" className={styles.primaryBtn()} onClick={primaryOnClick}>
|
|
24
|
+
{primaryLabel}
|
|
25
|
+
</Button>
|
|
26
|
+
{secondaryLabel && (
|
|
27
|
+
<Button look="link" size="large" className={styles.secondaryBtn()} onClick={secondaryOnClick}>
|
|
28
|
+
{secondaryLabel}
|
|
29
|
+
</Button>
|
|
30
|
+
)}
|
|
10
31
|
</div>
|
|
11
32
|
);
|
|
12
33
|
}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
|
-
export const styles = tv(
|
|
4
|
-
|
|
5
|
-
}
|
|
3
|
+
export const styles = tv(
|
|
4
|
+
{
|
|
5
|
+
slots: { base: 'flex gap-1', primaryBtn: '', secondaryBtn: 'no-underline hover:underline' },
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
full: { base: 'px-4 py-3' },
|
|
9
|
+
lg: { base: '-mt-6 px-12 pb-12' },
|
|
10
|
+
md: { base: '-mt-2 px-7 pb-7' },
|
|
11
|
+
sm: { base: '-mt-2 flex-col px-5 pb-5' },
|
|
12
|
+
fluid: { base: '-mt-2 px-5 pb-5 max-md:flex-col' },
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{ responsiveVariants: ['xsl', 'sm', 'md', 'lg', 'xl'] },
|
|
17
|
+
);
|
|
@@ -5,4 +5,20 @@ export type ModalDialogFooterProps = {
|
|
|
5
5
|
* Footer content
|
|
6
6
|
*/
|
|
7
7
|
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Label for primary button
|
|
10
|
+
*/
|
|
11
|
+
primaryLabel: string;
|
|
12
|
+
/**
|
|
13
|
+
* onClick for primary button
|
|
14
|
+
*/
|
|
15
|
+
primaryOnClick: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Label for secondary button
|
|
18
|
+
*/
|
|
19
|
+
secondaryLabel?: string;
|
|
20
|
+
/**
|
|
21
|
+
* onClick for secondary button
|
|
22
|
+
*/
|
|
23
|
+
secondaryOnClick?: () => void;
|
|
8
24
|
} & HTMLAttributes<HTMLElement>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { createContext, useContext, useRef } from 'react';
|
|
2
4
|
import { useDialog, useFocusRing } from 'react-aria';
|
|
3
5
|
|
|
4
6
|
import { CloseIcon } from '../../../../components/icon/index.js';
|
|
@@ -6,8 +8,11 @@ import { CloseIcon } from '../../../../components/icon/index.js';
|
|
|
6
8
|
import { ModalDialogBody } from './components/modal-dialog-body/index.js';
|
|
7
9
|
import { ModalDialogFooter } from './components/modal-dialog-footer/index.js';
|
|
8
10
|
import { styles as dialogStyles } from './modal-dialog.styles.js';
|
|
9
|
-
import { type ModalDialogProps } from './modal-dialog.types.js';
|
|
11
|
+
import { ModalDialogContextValue, type ModalDialogProps } from './modal-dialog.types.js';
|
|
12
|
+
|
|
13
|
+
const ModalDialogContext = createContext<ModalDialogContextValue>({ size: 'md' });
|
|
10
14
|
|
|
15
|
+
export const useModalDialogContext = () => useContext(ModalDialogContext);
|
|
11
16
|
/**
|
|
12
17
|
* @private
|
|
13
18
|
*/
|
|
@@ -32,7 +37,9 @@ export function ModalDialog({ className, body, onClose, size = 'md', ...props }:
|
|
|
32
37
|
{props.title}
|
|
33
38
|
</h3>
|
|
34
39
|
)}
|
|
35
|
-
{
|
|
40
|
+
<ModalDialogContext.Provider value={{ size }}>
|
|
41
|
+
{body ? <ModalDialogBody>{children}</ModalDialogBody> : children}
|
|
42
|
+
</ModalDialogContext.Provider>
|
|
36
43
|
</div>
|
|
37
44
|
);
|
|
38
45
|
}
|
|
@@ -3,23 +3,32 @@ import { tv } from 'tailwind-variants';
|
|
|
3
3
|
export const styles = tv(
|
|
4
4
|
{
|
|
5
5
|
slots: {
|
|
6
|
-
base: 'relative mx-auto flex max-w-full flex-col overflow-hidden rounded bg-white outline-none',
|
|
7
|
-
title: '
|
|
8
|
-
close: 'absolute right-
|
|
6
|
+
base: 'relative mx-auto flex max-w-full flex-col overflow-hidden rounded bg-white text-text outline-none',
|
|
7
|
+
title: 'typography-body-7 pb-4 pt-9 font-bold text-text',
|
|
8
|
+
close: 'absolute right-0 top-0 block p-3',
|
|
9
9
|
},
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
12
12
|
full: {
|
|
13
13
|
base: 'max-h-screen w-full flex-1',
|
|
14
|
+
close: 'p-2',
|
|
15
|
+
title: 'px-4 py-3',
|
|
14
16
|
},
|
|
15
17
|
lg: {
|
|
16
|
-
base: 'w-[
|
|
18
|
+
base: 'w-[50rem]',
|
|
19
|
+
title: 'px-12 pt-12',
|
|
17
20
|
},
|
|
18
21
|
md: {
|
|
19
22
|
base: 'w-[37.5rem]',
|
|
23
|
+
title: 'px-7 ',
|
|
20
24
|
},
|
|
21
25
|
sm: {
|
|
22
|
-
base: 'w-[
|
|
26
|
+
base: 'w-[25rem]',
|
|
27
|
+
title: 'px-5',
|
|
28
|
+
},
|
|
29
|
+
fluid: {
|
|
30
|
+
base: 'w-full',
|
|
31
|
+
title: 'px-5',
|
|
23
32
|
},
|
|
24
33
|
},
|
|
25
34
|
isFocusVisible: {
|
|
@@ -23,12 +23,12 @@ export function Pagination({
|
|
|
23
23
|
|
|
24
24
|
const generateHandleOnClickBackwards = useCallback(
|
|
25
25
|
(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
current: number,
|
|
27
|
+
infinite: boolean,
|
|
28
|
+
forwardOnly: boolean,
|
|
29
|
+
onChange: (page: number) => unknown,
|
|
30
|
+
pages: PaginationProps['pages'],
|
|
31
|
+
) =>
|
|
32
32
|
() => {
|
|
33
33
|
if (infinite && forwardOnly) {
|
|
34
34
|
return onChange(pages.length);
|
|
@@ -9,8 +9,8 @@ export const styles = tv(
|
|
|
9
9
|
'absolute h-0 w-0 border-x-[8px] border-t-[12px] border-x-[transparent] border-t-muted after:absolute after:h-0 after:w-0 after:border-x-[7px] after:border-t-[11px] after:border-x-[transparent] after:border-t-white',
|
|
10
10
|
closeBtn: 'absolute right-1 top-1 m-1 p-0 hover:opacity-80',
|
|
11
11
|
content: 'w-[17.625rem] py-4 pl-3 pr-5',
|
|
12
|
-
heading: 'typography-body-9 mb-2 font-bold',
|
|
13
|
-
body: 'typography-body-10',
|
|
12
|
+
heading: 'typography-body-9 mb-2 font-bold text-text',
|
|
13
|
+
body: 'typography-body-10 text-text',
|
|
14
14
|
},
|
|
15
15
|
variants: {
|
|
16
16
|
placement: {
|
package/src/components/radio-group/components/radio-group-radio/radio-group-radio.component.tsx
CHANGED
|
@@ -9,8 +9,7 @@ import { styles as radioStyles } from './radio-group-radio.styles.js';
|
|
|
9
9
|
import { type RadioGroupRadioProps } from './radio-group-radio.types.js';
|
|
10
10
|
|
|
11
11
|
function BaseRadioGroupRadio({ className, hint, label, ...props }: RadioGroupRadioProps, ref: any) {
|
|
12
|
-
const state = useContext(RadioGroupContext);
|
|
13
|
-
const { size, orientation } = state;
|
|
12
|
+
const { state, size, orientation } = useContext(RadioGroupContext);
|
|
14
13
|
const localRef = useRef(null);
|
|
15
14
|
const { inputProps, isSelected, isDisabled } = useRadio({ ...props, children: label }, state, localRef);
|
|
16
15
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
@@ -4,6 +4,7 @@ import React, { createContext, useEffect, useId, useMemo, useRef, useState } fro
|
|
|
4
4
|
import { useFocusRing, useRadioGroup } from 'react-aria';
|
|
5
5
|
import { useRadioGroupState } from 'react-stately';
|
|
6
6
|
|
|
7
|
+
import { FUNCTION_NOT_IMPLEMENTED } from '../../constants/message.js';
|
|
7
8
|
import { Button } from '../button/index.js';
|
|
8
9
|
import { ExpandMoreIcon } from '../icon/index.js';
|
|
9
10
|
import { ErrorMessage, Hint, Label, RadioGroupRadio } from '../index.js';
|
|
@@ -12,18 +13,63 @@ import { styles as radioGroupStyles } from './radio-group.styles.js';
|
|
|
12
13
|
import { type RadioGroupContextState, type RadioGroupProps } from './radio-group.types.js';
|
|
13
14
|
|
|
14
15
|
export const RadioGroupContext = createContext<RadioGroupContextState>({
|
|
15
|
-
// TODO: Remove deprecated name prop once React Aria removes it from RadioGroupState
|
|
16
|
-
name: '',
|
|
17
|
-
isDisabled: false,
|
|
18
|
-
isReadOnly: false,
|
|
19
|
-
isRequired: false,
|
|
20
|
-
validationState: null,
|
|
21
|
-
selectedValue: null,
|
|
22
|
-
setSelectedValue: () => null,
|
|
23
|
-
lastFocusedValue: null,
|
|
24
|
-
setLastFocusedValue: () => null,
|
|
25
16
|
orientation: 'vertical',
|
|
26
17
|
size: 'medium',
|
|
18
|
+
state: {
|
|
19
|
+
name: '',
|
|
20
|
+
isDisabled: false,
|
|
21
|
+
isReadOnly: false,
|
|
22
|
+
isRequired: false,
|
|
23
|
+
validationState: null,
|
|
24
|
+
selectedValue: null,
|
|
25
|
+
setSelectedValue: () => null,
|
|
26
|
+
lastFocusedValue: null,
|
|
27
|
+
setLastFocusedValue: () => null,
|
|
28
|
+
isInvalid: false,
|
|
29
|
+
realtimeValidation: {
|
|
30
|
+
isInvalid: false,
|
|
31
|
+
validationErrors: [],
|
|
32
|
+
validationDetails: {
|
|
33
|
+
badInput: false,
|
|
34
|
+
customError: false,
|
|
35
|
+
patternMismatch: false,
|
|
36
|
+
rangeOverflow: false,
|
|
37
|
+
rangeUnderflow: false,
|
|
38
|
+
stepMismatch: false,
|
|
39
|
+
tooLong: false,
|
|
40
|
+
tooShort: false,
|
|
41
|
+
typeMismatch: false,
|
|
42
|
+
valid: false,
|
|
43
|
+
valueMissing: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
displayValidation: {
|
|
47
|
+
isInvalid: false,
|
|
48
|
+
validationErrors: [],
|
|
49
|
+
validationDetails: {
|
|
50
|
+
badInput: false,
|
|
51
|
+
customError: false,
|
|
52
|
+
patternMismatch: false,
|
|
53
|
+
rangeOverflow: false,
|
|
54
|
+
rangeUnderflow: false,
|
|
55
|
+
stepMismatch: false,
|
|
56
|
+
tooLong: false,
|
|
57
|
+
tooShort: false,
|
|
58
|
+
typeMismatch: false,
|
|
59
|
+
valid: false,
|
|
60
|
+
valueMissing: false,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
updateValidation: function (): void {
|
|
64
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
65
|
+
},
|
|
66
|
+
resetValidation: function (): void {
|
|
67
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
68
|
+
},
|
|
69
|
+
commitValidation: function (): void {
|
|
70
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
71
|
+
},
|
|
72
|
+
},
|
|
27
73
|
});
|
|
28
74
|
|
|
29
75
|
export function RadioGroup({
|
|
@@ -70,9 +116,7 @@ export function RadioGroup({
|
|
|
70
116
|
<ErrorMessage {...errorMessageProps} message={errorMessage} />
|
|
71
117
|
)}
|
|
72
118
|
<div className={styles.radioWrapper()} id={panelId}>
|
|
73
|
-
<RadioGroupContext.Provider value={{
|
|
74
|
-
{childrenToRender}
|
|
75
|
-
</RadioGroupContext.Provider>
|
|
119
|
+
<RadioGroupContext.Provider value={{ state, orientation, size }}>{childrenToRender}</RadioGroupContext.Provider>
|
|
76
120
|
{hiddenOptions && (
|
|
77
121
|
<Button
|
|
78
122
|
onClick={() => setHiddenOptions(false)}
|
|
@@ -99,6 +99,7 @@ export function Repeater({
|
|
|
99
99
|
size="small"
|
|
100
100
|
soft
|
|
101
101
|
onClick={() => handleRemove(item.id, index)}
|
|
102
|
+
type="button"
|
|
102
103
|
>
|
|
103
104
|
Remove
|
|
104
105
|
</Button>
|
|
@@ -118,6 +119,7 @@ export function Repeater({
|
|
|
118
119
|
size="small"
|
|
119
120
|
soft
|
|
120
121
|
onClick={() => handleAdd()}
|
|
122
|
+
type="button"
|
|
121
123
|
>
|
|
122
124
|
{addText}
|
|
123
125
|
</Button>
|
package/src/components/selector/components/selector-button-group/selector-button-group.component.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { createContext, useCallback, useState } from 'react';
|
|
3
|
+
import { createContext, useCallback, useMemo, useState } from 'react';
|
|
4
4
|
import { useField } from 'react-aria';
|
|
5
5
|
|
|
6
6
|
import { ErrorMessage, Hint, Label } from '../../../index.js';
|
|
@@ -35,12 +35,15 @@ export function SelectorButtonGroup({
|
|
|
35
35
|
[selected, setSelected],
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
const state: SelectorButtonGroupContextState =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const state: SelectorButtonGroupContextState = useMemo(
|
|
39
|
+
() => ({
|
|
40
|
+
value: selected,
|
|
41
|
+
onClick: (id: string) => handleChange(id),
|
|
42
|
+
validationState: errorMessage ? 'invalid' : 'valid',
|
|
43
|
+
isDisabled,
|
|
44
|
+
}),
|
|
45
|
+
[selected],
|
|
46
|
+
);
|
|
44
47
|
|
|
45
48
|
const { labelProps, fieldProps, descriptionProps, errorMessageProps } = useField({
|
|
46
49
|
validationState: state.validationState,
|
|
@@ -4,6 +4,7 @@ import React, { createContext } from 'react';
|
|
|
4
4
|
import { useCheckboxGroup } from 'react-aria';
|
|
5
5
|
import { useCheckboxGroupState } from 'react-stately';
|
|
6
6
|
|
|
7
|
+
import { FUNCTION_NOT_IMPLEMENTED } from '../../../../constants/message.js';
|
|
7
8
|
import { ErrorMessage, Hint, Label } from '../../../index.js';
|
|
8
9
|
|
|
9
10
|
import { styles } from './selector-checkbox-group.styles.js';
|
|
@@ -22,6 +23,54 @@ export const SelectorCheckboxGroupContext = createContext<SelectorCheckboxGroupC
|
|
|
22
23
|
removeValue: () => null,
|
|
23
24
|
toggleValue: () => null,
|
|
24
25
|
validationState: 'valid',
|
|
26
|
+
isInvalid: false,
|
|
27
|
+
isRequired: false,
|
|
28
|
+
setInvalid: function (): void {
|
|
29
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
30
|
+
},
|
|
31
|
+
realtimeValidation: {
|
|
32
|
+
isInvalid: false,
|
|
33
|
+
validationErrors: [],
|
|
34
|
+
validationDetails: {
|
|
35
|
+
badInput: false,
|
|
36
|
+
customError: false,
|
|
37
|
+
patternMismatch: false,
|
|
38
|
+
rangeOverflow: false,
|
|
39
|
+
rangeUnderflow: false,
|
|
40
|
+
stepMismatch: false,
|
|
41
|
+
tooLong: false,
|
|
42
|
+
tooShort: false,
|
|
43
|
+
typeMismatch: false,
|
|
44
|
+
valid: false,
|
|
45
|
+
valueMissing: false,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
displayValidation: {
|
|
49
|
+
isInvalid: false,
|
|
50
|
+
validationErrors: [],
|
|
51
|
+
validationDetails: {
|
|
52
|
+
badInput: false,
|
|
53
|
+
customError: false,
|
|
54
|
+
patternMismatch: false,
|
|
55
|
+
rangeOverflow: false,
|
|
56
|
+
rangeUnderflow: false,
|
|
57
|
+
stepMismatch: false,
|
|
58
|
+
tooLong: false,
|
|
59
|
+
tooShort: false,
|
|
60
|
+
typeMismatch: false,
|
|
61
|
+
valid: false,
|
|
62
|
+
valueMissing: false,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
updateValidation: function (): void {
|
|
66
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
67
|
+
},
|
|
68
|
+
resetValidation: function (): void {
|
|
69
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
70
|
+
},
|
|
71
|
+
commitValidation: function (): void {
|
|
72
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
73
|
+
},
|
|
25
74
|
});
|
|
26
75
|
|
|
27
76
|
export function SelectorCheckboxGroup(props: SelectorCheckboxGroupProps) {
|
|
@@ -24,7 +24,7 @@ function BaseSelectorRadioGroupOption(
|
|
|
24
24
|
}: SelectorRadioGroupOptionProps,
|
|
25
25
|
ref: any,
|
|
26
26
|
) {
|
|
27
|
-
const state = useContext(SelectorRadioGroupContext);
|
|
27
|
+
const { state } = useContext(SelectorRadioGroupContext);
|
|
28
28
|
const localRef = useRef(null);
|
|
29
29
|
const { inputProps, isSelected, isDisabled } = useRadio({ ...props, value, children }, state, localRef);
|
|
30
30
|
const { isFocusVisible, focusProps } = useFocusRing();
|