@westpac/ui 0.47.1 → 0.49.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 +23 -0
- package/dist/component-type.json +1 -1
- package/dist/components/accordion/accordion.component.js +4 -4
- package/dist/components/accordion/accordion.styles.d.ts +9 -0
- package/dist/components/accordion/accordion.styles.js +4 -1
- package/dist/components/accordion/components/accordion-item/accordion-item.component.d.ts +1 -1
- package/dist/components/accordion/components/accordion-item/accordion-item.component.js +7 -3
- package/dist/components/accordion/components/accordion-item/accordion-item.styles.d.ts +15 -0
- package/dist/components/accordion/components/accordion-item/accordion-item.styles.js +27 -5
- package/dist/components/accordion/components/accordion-item/accordion-item.types.d.ts +5 -0
- package/dist/components/alert/alert.styles.js +1 -1
- package/dist/components/button-dropdown/button-dropdown.component.d.ts +1 -1
- package/dist/components/button-dropdown/button-dropdown.component.js +3 -2
- package/dist/components/button-dropdown/button-dropdown.types.d.ts +2 -1
- package/dist/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.component.js +0 -1
- package/dist/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.styles.js +1 -1
- package/dist/components/field/field.component.js +1 -1
- package/dist/components/header/header.component.d.ts +1 -1
- package/dist/components/header/header.component.js +6 -2
- package/dist/components/header/header.types.d.ts +11 -1
- package/dist/components/input-group/input-group.component.d.ts +1 -1
- package/dist/components/input-group/input-group.component.js +9 -3
- package/dist/components/input-group/input-group.styles.js +1 -1
- package/dist/components/input-group/input-group.types.d.ts +16 -0
- package/dist/components/modal/components/modal-backdrop/modal-backdrop.component.js +3 -2
- package/dist/components/modal/components/modal-backdrop/modal-backdrop.styles.js +1 -1
- package/dist/components/modal/modal.component.d.ts +1 -1
- package/dist/components/modal/modal.component.js +2 -1
- package/dist/components/modal/modal.types.d.ts +4 -0
- package/dist/css/westpac-ui.css +94 -43
- package/dist/css/westpac-ui.min.css +94 -43
- package/package.json +3 -3
- package/src/components/accordion/accordion.component.tsx +3 -3
- package/src/components/accordion/accordion.styles.ts +4 -1
- package/src/components/accordion/components/accordion-item/accordion-item.component.tsx +12 -2
- package/src/components/accordion/components/accordion-item/accordion-item.styles.ts +15 -6
- package/src/components/accordion/components/accordion-item/accordion-item.types.ts +6 -0
- package/src/components/alert/alert.styles.ts +1 -1
- package/src/components/button-dropdown/button-dropdown.component.tsx +2 -0
- package/src/components/button-dropdown/button-dropdown.types.ts +3 -1
- package/src/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.component.tsx +1 -1
- package/src/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.styles.ts +1 -1
- package/src/components/field/field.component.tsx +5 -3
- package/src/components/header/header.component.tsx +4 -2
- package/src/components/header/header.types.ts +11 -1
- package/src/components/input-group/input-group.component.tsx +9 -3
- package/src/components/input-group/input-group.styles.ts +1 -1
- package/src/components/input-group/input-group.types.ts +16 -0
- package/src/components/modal/components/modal-backdrop/modal-backdrop.component.tsx +2 -3
- package/src/components/modal/components/modal-backdrop/modal-backdrop.styles.ts +1 -1
- package/src/components/modal/modal.component.tsx +12 -2
- package/src/components/modal/modal.types.ts +4 -0
|
@@ -32,15 +32,15 @@ function Accordion({ className, rounded = true, look = 'soft', ...props }, ref)
|
|
|
32
32
|
ref: domRef,
|
|
33
33
|
className: styles({
|
|
34
34
|
className,
|
|
35
|
-
rounded
|
|
35
|
+
rounded,
|
|
36
|
+
lego: look === 'lego'
|
|
36
37
|
})
|
|
37
|
-
}, React.createElement("div",
|
|
38
|
-
className: "-ml-px -mt-px"
|
|
39
|
-
}, [
|
|
38
|
+
}, React.createElement("div", null, [
|
|
40
39
|
...state.collection
|
|
41
40
|
].map((item)=>React.createElement(AccordionItemContent, {
|
|
42
41
|
key: item.key,
|
|
43
42
|
item: item,
|
|
43
|
+
rounded: rounded,
|
|
44
44
|
state: state,
|
|
45
45
|
look: look
|
|
46
46
|
}))));
|
|
@@ -2,16 +2,25 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
2
2
|
rounded: {
|
|
3
3
|
true: string;
|
|
4
4
|
};
|
|
5
|
+
lego: {
|
|
6
|
+
true: string;
|
|
7
|
+
};
|
|
5
8
|
}, undefined, "flex flex-col border border-border text-text", {
|
|
6
9
|
responsiveVariants: string[];
|
|
7
10
|
}, {
|
|
8
11
|
rounded: {
|
|
9
12
|
true: string;
|
|
10
13
|
};
|
|
14
|
+
lego: {
|
|
15
|
+
true: string;
|
|
16
|
+
};
|
|
11
17
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
12
18
|
rounded: {
|
|
13
19
|
true: string;
|
|
14
20
|
};
|
|
21
|
+
lego: {
|
|
22
|
+
true: string;
|
|
23
|
+
};
|
|
15
24
|
}, undefined, "flex flex-col border border-border text-text", {
|
|
16
25
|
responsiveVariants: string[];
|
|
17
26
|
}, unknown, unknown, undefined>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type AccordionItemProps } from './accordion-item.types.js';
|
|
2
|
-
export declare function AccordionItem<T = HTMLElement>({ className, tag: Tag, look, ...props }: AccordionItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function AccordionItem<T = HTMLElement>({ className, tag: Tag, look, rounded, ...props }: AccordionItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { mergeProps, useFocusRing, useHover, useLocale } from 'react-aria';
|
|
|
5
5
|
import { ArrowLeftIcon, ArrowRightIcon } from '../../../icon/index.js';
|
|
6
6
|
import { styles as accordionItemStyles } from './accordion-item.styles.js';
|
|
7
7
|
const loadAnimations = ()=>import('./accordion-item.utils.js').then((res)=>res.default);
|
|
8
|
-
export function AccordionItem({ className, tag: Tag = 'div', look = 'soft', ...props }) {
|
|
8
|
+
export function AccordionItem({ className, tag: Tag = 'div', look = 'soft', rounded = true, ...props }) {
|
|
9
9
|
const ref = useRef(null);
|
|
10
10
|
const { state, item } = props;
|
|
11
11
|
const { buttonProps, regionProps } = useAccordionItem(props, state, ref);
|
|
@@ -20,7 +20,8 @@ export function AccordionItem({ className, tag: Tag = 'div', look = 'soft', ...p
|
|
|
20
20
|
isOpen,
|
|
21
21
|
isDisabled,
|
|
22
22
|
look,
|
|
23
|
-
isFocusVisible
|
|
23
|
+
isFocusVisible,
|
|
24
|
+
rounded
|
|
24
25
|
});
|
|
25
26
|
return React.createElement(Tag, {
|
|
26
27
|
className: styles.base({
|
|
@@ -63,6 +64,9 @@ export function AccordionItem({ className, tag: Tag = 'div', look = 'soft', ...p
|
|
|
63
64
|
]
|
|
64
65
|
}
|
|
65
66
|
}, React.createElement("div", {
|
|
66
|
-
className: styles.content()
|
|
67
|
+
className: styles.content(),
|
|
68
|
+
onBlur: (e)=>{
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
}
|
|
67
71
|
}, item.props.children))))));
|
|
68
72
|
}
|
|
@@ -28,6 +28,11 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
28
28
|
itemHeader: string;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
+
rounded: {
|
|
32
|
+
true: {
|
|
33
|
+
itemHeader: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
31
36
|
}, {
|
|
32
37
|
base: string;
|
|
33
38
|
itemHeader: string;
|
|
@@ -66,6 +71,11 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
66
71
|
itemHeader: string;
|
|
67
72
|
};
|
|
68
73
|
};
|
|
74
|
+
rounded: {
|
|
75
|
+
true: {
|
|
76
|
+
itemHeader: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
69
79
|
}, {
|
|
70
80
|
base: string;
|
|
71
81
|
itemHeader: string;
|
|
@@ -102,6 +112,11 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
|
102
112
|
itemHeader: string;
|
|
103
113
|
};
|
|
104
114
|
};
|
|
115
|
+
rounded: {
|
|
116
|
+
true: {
|
|
117
|
+
itemHeader: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
105
120
|
}, {
|
|
106
121
|
base: string;
|
|
107
122
|
itemHeader: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const styles = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: '
|
|
5
|
-
itemHeader: 'typography-body-9 flex w-full flex-1 items-center justify-between px-3 py-2',
|
|
4
|
+
base: 'group',
|
|
5
|
+
itemHeader: 'typography-body-9 flex w-full flex-1 items-center justify-between px-3 py-2 group-first:border-t-0',
|
|
6
6
|
headerTitleWrapper: 'flex-1 pr-2 text-left',
|
|
7
7
|
indicator: 'size-3 rotate-90',
|
|
8
8
|
content: 'hidden'
|
|
@@ -13,12 +13,12 @@ export const styles = tv({
|
|
|
13
13
|
itemHeader: 'border-t border-border bg-light'
|
|
14
14
|
},
|
|
15
15
|
lego: {
|
|
16
|
-
itemHeader: 'border-l-[0.375rem] border-border bg-light shadow-[
|
|
16
|
+
itemHeader: 'mb-[-1px] border-l-[0.375rem] border-r border-border bg-light shadow-[inset_0px_1px_0_0_var(--tw-shadow-color),inset_0_-1px_0_0_var(--tw-shadow-color)] !shadow-border transition-colors'
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
isOpen: {
|
|
20
20
|
true: {
|
|
21
|
-
content: 'block border-
|
|
21
|
+
content: 'block border-border p-3'
|
|
22
22
|
},
|
|
23
23
|
false: {
|
|
24
24
|
base: '',
|
|
@@ -36,6 +36,11 @@ export const styles = tv({
|
|
|
36
36
|
false: {
|
|
37
37
|
itemHeader: 'outline-none'
|
|
38
38
|
}
|
|
39
|
+
},
|
|
40
|
+
rounded: {
|
|
41
|
+
true: {
|
|
42
|
+
itemHeader: 'group-first:rounded-t-sm group-last:rounded-b-sm'
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
},
|
|
41
46
|
compoundSlots: [
|
|
@@ -58,8 +63,25 @@ export const styles = tv({
|
|
|
58
63
|
slots: [
|
|
59
64
|
'content'
|
|
60
65
|
],
|
|
66
|
+
look: 'soft',
|
|
67
|
+
isOpen: true,
|
|
68
|
+
className: 'border-t'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
slots: [
|
|
72
|
+
'itemHeader'
|
|
73
|
+
],
|
|
74
|
+
isOpen: true,
|
|
75
|
+
rounded: true,
|
|
76
|
+
className: 'group-last:rounded-none'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
slots: [
|
|
80
|
+
'content'
|
|
81
|
+
],
|
|
82
|
+
isOpen: true,
|
|
61
83
|
look: 'lego',
|
|
62
|
-
className: 'border-l-[0.375rem] border-
|
|
84
|
+
className: 'mt-[1px] border-l-[0.375rem] border-r'
|
|
63
85
|
}
|
|
64
86
|
]
|
|
65
87
|
}, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { Node, TreeState } from 'react-stately';
|
|
3
3
|
import { type VariantProps } from 'tailwind-variants';
|
|
4
|
+
import { AccordionProps } from '../../accordion.types.js';
|
|
4
5
|
import { styles } from './accordion-item.styles.js';
|
|
5
6
|
type Variants = VariantProps<typeof styles>;
|
|
6
7
|
export type AccordionItemProps<T = HTMLElement> = {
|
|
@@ -16,6 +17,10 @@ export type AccordionItemProps<T = HTMLElement> = {
|
|
|
16
17
|
* Look of the item
|
|
17
18
|
*/
|
|
18
19
|
look?: Variants['look'];
|
|
20
|
+
/**
|
|
21
|
+
* Whether accordion is rounded
|
|
22
|
+
*/
|
|
23
|
+
rounded?: AccordionProps['rounded'];
|
|
19
24
|
/**
|
|
20
25
|
* Tree state
|
|
21
26
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const styles = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: 'typography-body-10 relative mb-
|
|
4
|
+
base: 'typography-body-10 relative mb-5 xsl:flex',
|
|
5
5
|
icon: 'float-left flex-none',
|
|
6
6
|
body: 'relative flex-1 overflow-hidden xsl:top-[0.125rem] [&_a]:underline',
|
|
7
7
|
heading: 'typography-body-9 mb-1 font-bold',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type ButtonDropdownProps } from './button-dropdown.types.js';
|
|
2
|
-
export declare function ButtonDropdown({ className, dropdownSize, iconBefore: IconBefore, open, text, children, size, look, soft, block, }: ButtonDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function ButtonDropdown({ className, dropdownSize, iconBefore: IconBefore, open, text, children, size, look, soft, block, shouldFlip, }: ButtonDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { Button } from '../button/index.js';
|
|
|
6
6
|
import { DropDownIcon } from '../icon/index.js';
|
|
7
7
|
import { styles as buttonDropdownStyles } from './button-dropdown.styles.js';
|
|
8
8
|
import { ButtonDropdownPanel } from './components/button-dropdown-panel/button-dropdown-panel.component.js';
|
|
9
|
-
export function ButtonDropdown({ className, dropdownSize = 'medium', iconBefore: IconBefore, open = false, text, children, size, look = 'hero', soft = false, block = false }) {
|
|
9
|
+
export function ButtonDropdown({ className, dropdownSize = 'medium', iconBefore: IconBefore, open = false, text, children, size, look = 'hero', soft = false, block = false, shouldFlip }) {
|
|
10
10
|
const ref = useRef(null);
|
|
11
11
|
const panelId = useId();
|
|
12
12
|
const styles = buttonDropdownStyles({
|
|
@@ -56,6 +56,7 @@ export function ButtonDropdown({ className, dropdownSize = 'medium', iconBefore:
|
|
|
56
56
|
triggerRef: ref,
|
|
57
57
|
state: state,
|
|
58
58
|
block: block,
|
|
59
|
-
id: panelId
|
|
59
|
+
id: panelId,
|
|
60
|
+
shouldFlip: shouldFlip
|
|
60
61
|
}, children));
|
|
61
62
|
}
|
|
@@ -2,6 +2,7 @@ import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
|
2
2
|
import { type VariantProps } from 'tailwind-variants';
|
|
3
3
|
import { ButtonProps } from '../button/index.js';
|
|
4
4
|
import { styles } from './button-dropdown.styles.js';
|
|
5
|
+
import { ButtonDropdownPanelProps } from './components/button-dropdown-panel/button-dropdown-panel.types.js';
|
|
5
6
|
type Variants = VariantProps<typeof styles>;
|
|
6
7
|
export type ButtonDropdownProps = {
|
|
7
8
|
/**
|
|
@@ -28,5 +29,5 @@ export type ButtonDropdownProps = {
|
|
|
28
29
|
* Button text
|
|
29
30
|
*/
|
|
30
31
|
text: string;
|
|
31
|
-
} & ButtonHTMLAttributes<Element> & Pick<ButtonProps, 'size' | 'iconBefore' | 'block'>;
|
|
32
|
+
} & ButtonHTMLAttributes<Element> & Pick<ButtonProps, 'size' | 'iconBefore' | 'block'> & Pick<ButtonDropdownPanelProps, 'shouldFlip'>;
|
|
32
33
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const styles = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: '
|
|
4
|
+
base: 'my-0.5 rounded border border-border bg-white p-2 shadow-[0_0.375rem_0.75rem_rgba(0,0,0,0.175)]',
|
|
5
5
|
dialog: ''
|
|
6
6
|
},
|
|
7
7
|
variants: {
|
|
@@ -26,7 +26,7 @@ export function Field({ className, label, tag: Tag = 'div', children, hintMessag
|
|
|
26
26
|
className
|
|
27
27
|
}),
|
|
28
28
|
...props
|
|
29
|
-
}, React.createElement(Label, {
|
|
29
|
+
}, label && React.createElement(Label, {
|
|
30
30
|
size: labelSize,
|
|
31
31
|
...labelProps
|
|
32
32
|
}, label), hintMessage && React.createElement(Hint, descriptionProps, hintMessage), errorMessage && React.createElement(ErrorMessage, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type HeaderProps } from './header.types.js';
|
|
2
|
-
export declare function Header({ brand, className, children, fixed, isScrolled, leftIcon, leftOnClick, leftAssistiveText, logoAssistiveText, logoLink, logoCenter, logoOnClick, skipLinkContent, skipToContentId, ...props }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function Header({ anchorTarget, brand, className, children, fixed, fixedMaxWidth, isScrolled, leftIcon, leftOnClick, leftAssistiveText, logoAssistiveText, logoLink, logoCenter, logoOnClick, skipLinkContent, skipToContentId, ...props }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -31,7 +31,7 @@ const logoMap = {
|
|
|
31
31
|
largeLogo: (props)=>React.createElement(RAMSMultibrandLargeLogo, props)
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
export function Header({ brand, className, children, fixed = false, isScrolled, leftIcon, leftOnClick, leftAssistiveText, logoAssistiveText, logoLink = '#', logoCenter = false, logoOnClick, skipLinkContent = 'Skip to main content', skipToContentId, ...props }) {
|
|
34
|
+
export function Header({ anchorTarget, brand, className, children, fixed = false, fixedMaxWidth, isScrolled, leftIcon, leftOnClick, leftAssistiveText, logoAssistiveText, logoLink = '#', logoCenter = false, logoOnClick, skipLinkContent = 'Skip to main content', skipToContentId, ...props }) {
|
|
35
35
|
const [scrolled, setScrolled] = useState(false);
|
|
36
36
|
const handleScroll = throttle(()=>{
|
|
37
37
|
let hasScrolled = false;
|
|
@@ -65,7 +65,10 @@ export function Header({ brand, className, children, fixed = false, isScrolled,
|
|
|
65
65
|
}),
|
|
66
66
|
...props
|
|
67
67
|
}, React.createElement("div", {
|
|
68
|
-
className: styles.inner()
|
|
68
|
+
className: styles.inner(),
|
|
69
|
+
style: {
|
|
70
|
+
maxWidth: fixed ? fixedMaxWidth : undefined
|
|
71
|
+
}
|
|
69
72
|
}, skipToContentId && React.createElement(SkipLink, {
|
|
70
73
|
href: skipToContentId
|
|
71
74
|
}, skipLinkContent), leftIcon && React.createElement("div", {
|
|
@@ -80,6 +83,7 @@ export function Header({ brand, className, children, fixed = false, isScrolled,
|
|
|
80
83
|
iconColor: "text"
|
|
81
84
|
})), React.createElement("a", {
|
|
82
85
|
href: logoLink,
|
|
86
|
+
target: anchorTarget,
|
|
83
87
|
className: styles.logoLink(),
|
|
84
88
|
onClick: logoOnClick
|
|
85
89
|
}, React.createElement(SmallLogo, {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Property } from 'csstype';
|
|
2
|
+
import { HTMLAttributeAnchorTarget, HTMLAttributes } from 'react';
|
|
2
3
|
import { BrandKey } from '../../tailwind/index.js';
|
|
3
4
|
export type HeaderProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Target for the logo link
|
|
7
|
+
*/
|
|
8
|
+
anchorTarget?: HTMLAttributeAnchorTarget;
|
|
4
9
|
/**
|
|
5
10
|
* Icon for brand
|
|
6
11
|
*/
|
|
@@ -9,6 +14,11 @@ export type HeaderProps = {
|
|
|
9
14
|
* Enable fixed header
|
|
10
15
|
*/
|
|
11
16
|
fixed?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Set max width for fixed header for certain layouts
|
|
19
|
+
* NOTE: Using max-w in classname will work for non-fixed headers
|
|
20
|
+
*/
|
|
21
|
+
fixedMaxWidth?: Property.MaxWidth;
|
|
12
22
|
/**
|
|
13
23
|
* Used with fixed to show drop shadow when something on screen is scrolled that should trigger drop shadow but doesn't
|
|
14
24
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type InputGroupProps } from './input-group.types.js';
|
|
2
|
-
export declare function InputGroup({ label, hideLabel, size, hint, errorMessage, supportingText, instanceId, after, before, children, tag: Tag, className, width, ...props }: InputGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function InputGroup({ label, hideLabel, size, hint, errorMessage, supportingText, instanceId, after, before, children, tag: Tag, className, width, id: propID, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-label': ariaLabel, ...props }: InputGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { ErrorMessage, Hint, Label } from '../index.js';
|
|
|
4
4
|
import { InputGroupSupportingText } from './components/index.js';
|
|
5
5
|
import { InputGroupAddOn } from './components/input-group-add-ons/input-group-add-ons.component.js';
|
|
6
6
|
import { styles as inputGroupStyles } from './input-group.styles.js';
|
|
7
|
-
export function InputGroup({ label, hideLabel, size = 'medium', hint, errorMessage, supportingText, instanceId, after, before, children, tag: Tag = 'div', className, width = 'full', ...props }) {
|
|
7
|
+
export function InputGroup({ label, hideLabel, size = 'medium', hint, errorMessage, supportingText, instanceId, after, before, children, tag: Tag = 'div', className, width = 'full', id: propID, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-label': ariaLabel, ...props }) {
|
|
8
8
|
const _id = useId();
|
|
9
9
|
const id = useMemo(()=>instanceId || `gel-field-${_id}`, [
|
|
10
10
|
_id,
|
|
@@ -72,8 +72,10 @@ export function InputGroup({ label, hideLabel, size = 'medium', hint, errorMessa
|
|
|
72
72
|
if (isValidElement(child)) {
|
|
73
73
|
return cloneElement(child, {
|
|
74
74
|
size,
|
|
75
|
-
id,
|
|
76
|
-
'aria-
|
|
75
|
+
id: propID || id,
|
|
76
|
+
'aria-labelledby': ariaLabelledBy,
|
|
77
|
+
'aria-describedby': ariaDescribedBy || ariaDescribedByValue,
|
|
78
|
+
'aria-label': ariaLabel,
|
|
77
79
|
...width !== 'full' ? {
|
|
78
80
|
width: width
|
|
79
81
|
} : {}
|
|
@@ -83,8 +85,12 @@ export function InputGroup({ label, hideLabel, size = 'medium', hint, errorMessa
|
|
|
83
85
|
}, [
|
|
84
86
|
children,
|
|
85
87
|
size,
|
|
88
|
+
propID,
|
|
86
89
|
id,
|
|
90
|
+
ariaLabelledBy,
|
|
91
|
+
ariaDescribedBy,
|
|
87
92
|
ariaDescribedByValue,
|
|
93
|
+
ariaLabel,
|
|
88
94
|
width
|
|
89
95
|
]);
|
|
90
96
|
const isFieldset = useMemo(()=>Tag === 'fieldset', [
|
|
@@ -70,4 +70,20 @@ export type InputGroupProps = {
|
|
|
70
70
|
* width of input
|
|
71
71
|
*/
|
|
72
72
|
width?: InputProps['width'];
|
|
73
|
+
/**
|
|
74
|
+
* id
|
|
75
|
+
*/
|
|
76
|
+
id?: string;
|
|
77
|
+
/**
|
|
78
|
+
* aria-labelledby
|
|
79
|
+
*/
|
|
80
|
+
'aria-labelledby'?: string;
|
|
81
|
+
/**
|
|
82
|
+
* aria-describedby
|
|
83
|
+
*/
|
|
84
|
+
'aria-describedby'?: string;
|
|
85
|
+
/**
|
|
86
|
+
* aria-label
|
|
87
|
+
*/
|
|
88
|
+
'aria-label'?: string;
|
|
73
89
|
};
|
|
@@ -6,7 +6,6 @@ export function ModalBackdrop({ zIndex = 100, portalContainer, size, ...props })
|
|
|
6
6
|
const { children, state, className } = props;
|
|
7
7
|
const ref = useRef(null);
|
|
8
8
|
const styles = backdropStyles({
|
|
9
|
-
className,
|
|
10
9
|
fullscreen: size === 'full',
|
|
11
10
|
fluid: size === 'fluid'
|
|
12
11
|
});
|
|
@@ -22,10 +21,12 @@ export function ModalBackdrop({ zIndex = 100, portalContainer, size, ...props })
|
|
|
22
21
|
return React.createElement(Overlay, {
|
|
23
22
|
portalContainer: portalContainer || brandContainer
|
|
24
23
|
}, React.createElement("div", {
|
|
24
|
+
className: styles.base({
|
|
25
|
+
className
|
|
26
|
+
}),
|
|
25
27
|
style: {
|
|
26
28
|
zIndex
|
|
27
29
|
},
|
|
28
|
-
className: styles.base(),
|
|
29
30
|
...underlayProps
|
|
30
31
|
}, React.createElement("div", {
|
|
31
32
|
...modalProps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const styles = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: 'fixed inset-0
|
|
4
|
+
base: 'fixed inset-0 flex animate-fadeIn items-center justify-center overflow-y-auto bg-black/50 p-2',
|
|
5
5
|
modal: 'relative top-3 z-10 h-fit w-full animate-fadeInDown'
|
|
6
6
|
},
|
|
7
7
|
variants: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type ModalProps } from './modal.types.js';
|
|
2
|
-
export declare function Modal({ children, title, role, body, size, className, fullscreen, ...props }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function Modal({ children, backdropStyle, title, role, body, size, className, fullscreen, ...props }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ModalBackdrop, ModalDialog } from './components/index.js';
|
|
4
|
-
export function Modal({ children, title, role, body, size, className, fullscreen, ...props }) {
|
|
4
|
+
export function Modal({ children, backdropStyle, title, role, body, size, className, fullscreen, ...props }) {
|
|
5
5
|
return React.createElement(ModalBackdrop, {
|
|
6
6
|
size: size,
|
|
7
|
+
className: backdropStyle,
|
|
7
8
|
...props
|
|
8
9
|
}, React.createElement(ModalDialog, {
|
|
9
10
|
fullscreen: fullscreen,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type ModalBackdropProps, ModalDialogProps } from './components/index.js';
|
|
2
2
|
export type ModalProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Provide inset styles for the backdrop for centering in certain containers
|
|
5
|
+
*/
|
|
6
|
+
backdropStyle?: string;
|
|
3
7
|
/**
|
|
4
8
|
* Whether the modal is fullscreen
|
|
5
9
|
*/
|