@westpac/ui 0.20.1 → 0.21.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 +6 -0
- package/dist/component-type.json +1 -1
- package/dist/components/input-group/input-group.styles.js +36 -15
- package/dist/components/popover/popover.component.d.ts +1 -1
- package/dist/components/popover/popover.component.js +8 -4
- package/dist/components/popover/popover.styles.d.ts +18 -2
- package/dist/components/popover/popover.styles.js +10 -2
- package/dist/components/popover/popover.types.d.ts +5 -1
- package/dist/css/westpac-ui.css +10 -2
- package/dist/css/westpac-ui.min.css +10 -2
- package/package.json +2 -2
- package/src/components/input-group/input-group.styles.ts +14 -13
- package/src/components/popover/popover.component.tsx +6 -2
- package/src/components/popover/popover.styles.ts +9 -1
- package/src/components/popover/popover.types.ts +5 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
|
-
const inlineFlexInput = {
|
|
3
|
-
input: 'inline-flex'
|
|
4
|
-
};
|
|
5
2
|
export const styles = tv({
|
|
6
3
|
slots: {
|
|
7
4
|
base: 'group m-0 mb-5 border-none p-0',
|
|
@@ -26,18 +23,42 @@ export const styles = tv({
|
|
|
26
23
|
},
|
|
27
24
|
width: {
|
|
28
25
|
full: '',
|
|
29
|
-
1:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
1: {
|
|
27
|
+
input: 'inline-flex'
|
|
28
|
+
},
|
|
29
|
+
2: {
|
|
30
|
+
input: 'inline-flex'
|
|
31
|
+
},
|
|
32
|
+
3: {
|
|
33
|
+
input: 'inline-flex'
|
|
34
|
+
},
|
|
35
|
+
4: {
|
|
36
|
+
input: 'inline-flex'
|
|
37
|
+
},
|
|
38
|
+
5: {
|
|
39
|
+
input: 'inline-flex'
|
|
40
|
+
},
|
|
41
|
+
6: {
|
|
42
|
+
input: 'inline-flex'
|
|
43
|
+
},
|
|
44
|
+
7: {
|
|
45
|
+
input: 'inline-flex'
|
|
46
|
+
},
|
|
47
|
+
8: {
|
|
48
|
+
input: 'inline-flex'
|
|
49
|
+
},
|
|
50
|
+
9: {
|
|
51
|
+
input: 'inline-flex'
|
|
52
|
+
},
|
|
53
|
+
10: {
|
|
54
|
+
input: 'inline-flex'
|
|
55
|
+
},
|
|
56
|
+
20: {
|
|
57
|
+
input: 'inline-flex'
|
|
58
|
+
},
|
|
59
|
+
30: {
|
|
60
|
+
input: 'inline-flex'
|
|
61
|
+
}
|
|
41
62
|
}
|
|
42
63
|
},
|
|
43
64
|
compoundVariants: [
|
|
@@ -3,4 +3,4 @@ import { type PopoverProps } from './popover.types.js';
|
|
|
3
3
|
* TODO: Revisit this component when react-aria has updated usePopover, see: https://github.com/adobe/react-spectrum/discussions/5341
|
|
4
4
|
* This version does not currently use react-aria as it blocked so functionality that was needed to match GEL 3.0
|
|
5
5
|
*/
|
|
6
|
-
export declare function Popover({ children, className, headingTag, content, heading, onClick, placement, look, soft, open, icon, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function Popover({ children, className, headingTag, content, heading, onClick, placement, look, soft, open, linkStyling, size, icon, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,10 +4,12 @@ import { useOverlayTriggerState } from 'react-stately';
|
|
|
4
4
|
import { Button } from '../button/index.js';
|
|
5
5
|
import { Panel } from './components/panel/panel.component.js';
|
|
6
6
|
import { styles as popoverStyles } from './popover.styles.js';
|
|
7
|
-
export function Popover({ children , className , headingTag , content , heading , onClick =()=>undefined , placement , look , soft =false , open =false , icon }) {
|
|
7
|
+
export function Popover({ children , className , headingTag , content , heading , onClick =()=>undefined , placement , look , soft =false , open =false , linkStyling =false , size ='medium' , icon }) {
|
|
8
8
|
const state = useOverlayTriggerState({});
|
|
9
9
|
const panelId = useId();
|
|
10
|
-
const styles = popoverStyles({
|
|
10
|
+
const styles = popoverStyles({
|
|
11
|
+
linkStyling
|
|
12
|
+
});
|
|
11
13
|
const ref = useRef(null);
|
|
12
14
|
const handleClick = useCallback(()=>{
|
|
13
15
|
onClick();
|
|
@@ -41,13 +43,15 @@ export function Popover({ children , className , headingTag , content , heading
|
|
|
41
43
|
className
|
|
42
44
|
})
|
|
43
45
|
}, React.createElement(Button, {
|
|
44
|
-
look: icon && !children ? 'link' : look,
|
|
46
|
+
look: icon && !children || linkStyling ? 'link' : look,
|
|
45
47
|
iconAfter: icon,
|
|
46
48
|
soft: soft,
|
|
47
49
|
"aria-expanded": state.isOpen,
|
|
48
50
|
"aria-controls": panelId,
|
|
49
51
|
onClick: handleClick,
|
|
50
|
-
ref: ref
|
|
52
|
+
ref: ref,
|
|
53
|
+
size: size,
|
|
54
|
+
className: styles.button()
|
|
51
55
|
}, children), state.isOpen && React.createElement(Panel, {
|
|
52
56
|
placement: placement,
|
|
53
57
|
heading: heading ? heading : '',
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
1
|
+
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
linkStyling: {
|
|
3
|
+
true: {
|
|
4
|
+
button: string;
|
|
5
|
+
};
|
|
6
|
+
false: {};
|
|
7
|
+
};
|
|
8
|
+
}, {
|
|
2
9
|
base: string;
|
|
10
|
+
button: string;
|
|
3
11
|
}, undefined, {
|
|
4
12
|
responsiveVariants: string[];
|
|
5
|
-
}, {
|
|
13
|
+
}, {
|
|
14
|
+
linkStyling: {
|
|
15
|
+
true: {
|
|
16
|
+
button: string;
|
|
17
|
+
};
|
|
18
|
+
false: {};
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
6
21
|
base: string;
|
|
22
|
+
button: string;
|
|
7
23
|
}>;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const styles = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: 'relative inline-block'
|
|
4
|
+
base: 'relative inline-block',
|
|
5
|
+
button: ''
|
|
5
6
|
},
|
|
6
|
-
variants: {
|
|
7
|
+
variants: {
|
|
8
|
+
linkStyling: {
|
|
9
|
+
true: {
|
|
10
|
+
button: 'p-0'
|
|
11
|
+
},
|
|
12
|
+
false: {}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
7
15
|
}, {
|
|
8
16
|
responsiveVariants: [
|
|
9
17
|
'xsl',
|
|
@@ -23,6 +23,10 @@ export type PopoverProps = {
|
|
|
23
23
|
* Use an icon as the button
|
|
24
24
|
*/
|
|
25
25
|
icon?: (props: IconProps) => JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Removes padding from trigger button and sets look to link to be able to look inline, use size prop to match font size
|
|
28
|
+
*/
|
|
29
|
+
linkStyling?: boolean;
|
|
26
30
|
/**
|
|
27
31
|
* A function for the onClick event
|
|
28
32
|
*/
|
|
@@ -36,4 +40,4 @@ export type PopoverProps = {
|
|
|
36
40
|
* @default top
|
|
37
41
|
*/
|
|
38
42
|
placement?: 'top' | 'bottom';
|
|
39
|
-
} & HTMLAttributes<Element> & Pick<ButtonProps, 'look' | 'soft'>;
|
|
43
|
+
} & HTMLAttributes<Element> & Pick<ButtonProps, 'look' | 'soft' | 'size'>;
|
package/dist/css/westpac-ui.css
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
[31mTailwind Variants Transform Failed: inlineFlexInput is not defined[0m
|
|
2
|
-
If you think this is an issue, please submit it at https://github.com/nextui-org/tailwind-variants/issues/new/choose
|
|
3
1
|
/*
|
|
4
2
|
! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com
|
|
5
3
|
*//*
|
|
@@ -7124,6 +7122,8 @@ video {
|
|
|
7124
7122
|
}.xsl\:bg-white {
|
|
7125
7123
|
--tw-bg-opacity: 1;
|
|
7126
7124
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
7125
|
+
}.xsl\:p-0 {
|
|
7126
|
+
padding: 0rem;
|
|
7127
7127
|
}.xsl\:p-2 {
|
|
7128
7128
|
padding: 0.75rem;
|
|
7129
7129
|
}.xsl\:p-3 {
|
|
@@ -8176,6 +8176,8 @@ video {
|
|
|
8176
8176
|
}.sm\:bg-white {
|
|
8177
8177
|
--tw-bg-opacity: 1;
|
|
8178
8178
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
8179
|
+
}.sm\:p-0 {
|
|
8180
|
+
padding: 0rem;
|
|
8179
8181
|
}.sm\:p-2 {
|
|
8180
8182
|
padding: 0.75rem;
|
|
8181
8183
|
}.sm\:p-3 {
|
|
@@ -9247,6 +9249,8 @@ video {
|
|
|
9247
9249
|
}.md\:bg-white {
|
|
9248
9250
|
--tw-bg-opacity: 1;
|
|
9249
9251
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
9252
|
+
}.md\:p-0 {
|
|
9253
|
+
padding: 0rem;
|
|
9250
9254
|
}.md\:p-2 {
|
|
9251
9255
|
padding: 0.75rem;
|
|
9252
9256
|
}.md\:p-3 {
|
|
@@ -10311,6 +10315,8 @@ video {
|
|
|
10311
10315
|
}.lg\:bg-white {
|
|
10312
10316
|
--tw-bg-opacity: 1;
|
|
10313
10317
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
10318
|
+
}.lg\:p-0 {
|
|
10319
|
+
padding: 0rem;
|
|
10314
10320
|
}.lg\:p-2 {
|
|
10315
10321
|
padding: 0.75rem;
|
|
10316
10322
|
}.lg\:p-3 {
|
|
@@ -11340,6 +11346,8 @@ video {
|
|
|
11340
11346
|
}.xl\:bg-white {
|
|
11341
11347
|
--tw-bg-opacity: 1;
|
|
11342
11348
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
11349
|
+
}.xl\:p-0 {
|
|
11350
|
+
padding: 0rem;
|
|
11343
11351
|
}.xl\:p-2 {
|
|
11344
11352
|
padding: 0.75rem;
|
|
11345
11353
|
}.xl\:p-3 {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
[31mTailwind Variants Transform Failed: inlineFlexInput is not defined[0m
|
|
2
|
-
If you think this is an issue, please submit it at https://github.com/nextui-org/tailwind-variants/issues/new/choose
|
|
3
1
|
/*
|
|
4
2
|
! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com
|
|
5
3
|
*//*
|
|
@@ -7124,6 +7122,8 @@ video {
|
|
|
7124
7122
|
}.xsl\:bg-white {
|
|
7125
7123
|
--tw-bg-opacity: 1;
|
|
7126
7124
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
7125
|
+
}.xsl\:p-0 {
|
|
7126
|
+
padding: 0rem;
|
|
7127
7127
|
}.xsl\:p-2 {
|
|
7128
7128
|
padding: 0.75rem;
|
|
7129
7129
|
}.xsl\:p-3 {
|
|
@@ -8176,6 +8176,8 @@ video {
|
|
|
8176
8176
|
}.sm\:bg-white {
|
|
8177
8177
|
--tw-bg-opacity: 1;
|
|
8178
8178
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
8179
|
+
}.sm\:p-0 {
|
|
8180
|
+
padding: 0rem;
|
|
8179
8181
|
}.sm\:p-2 {
|
|
8180
8182
|
padding: 0.75rem;
|
|
8181
8183
|
}.sm\:p-3 {
|
|
@@ -9247,6 +9249,8 @@ video {
|
|
|
9247
9249
|
}.md\:bg-white {
|
|
9248
9250
|
--tw-bg-opacity: 1;
|
|
9249
9251
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
9252
|
+
}.md\:p-0 {
|
|
9253
|
+
padding: 0rem;
|
|
9250
9254
|
}.md\:p-2 {
|
|
9251
9255
|
padding: 0.75rem;
|
|
9252
9256
|
}.md\:p-3 {
|
|
@@ -10311,6 +10315,8 @@ video {
|
|
|
10311
10315
|
}.lg\:bg-white {
|
|
10312
10316
|
--tw-bg-opacity: 1;
|
|
10313
10317
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
10318
|
+
}.lg\:p-0 {
|
|
10319
|
+
padding: 0rem;
|
|
10314
10320
|
}.lg\:p-2 {
|
|
10315
10321
|
padding: 0.75rem;
|
|
10316
10322
|
}.lg\:p-3 {
|
|
@@ -11340,6 +11346,8 @@ video {
|
|
|
11340
11346
|
}.xl\:bg-white {
|
|
11341
11347
|
--tw-bg-opacity: 1;
|
|
11342
11348
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
11349
|
+
}.xl\:p-0 {
|
|
11350
|
+
padding: 0rem;
|
|
11343
11351
|
}.xl\:p-2 {
|
|
11344
11352
|
padding: 0.75rem;
|
|
11345
11353
|
}.xl\:p-3 {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@westpac/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -255,8 +255,8 @@
|
|
|
255
255
|
"typescript": "^5.1.6",
|
|
256
256
|
"vite": "^4.3.9",
|
|
257
257
|
"vitest": "^0.30.1",
|
|
258
|
-
"@westpac/ts-config": "~0.0.0",
|
|
259
258
|
"@westpac/test-config": "~0.0.0",
|
|
259
|
+
"@westpac/ts-config": "~0.0.0",
|
|
260
260
|
"@westpac/eslint-config": "~0.2.1"
|
|
261
261
|
},
|
|
262
262
|
"dependencies": {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
|
-
const inlineFlexInput = { input: 'inline-flex' };
|
|
4
3
|
export const styles = tv(
|
|
5
4
|
{
|
|
6
5
|
slots: {
|
|
@@ -27,18 +26,20 @@ export const styles = tv(
|
|
|
27
26
|
// Has to be done this as doing it with compoundVariants with array was not working
|
|
28
27
|
width: {
|
|
29
28
|
full: '',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
// Below ignored because tailwind was showing a transform error when using a const
|
|
30
|
+
// eslint-disable-next-line sonarjs/no-duplicate-string
|
|
31
|
+
1: { input: 'inline-flex' },
|
|
32
|
+
2: { input: 'inline-flex' },
|
|
33
|
+
3: { input: 'inline-flex' },
|
|
34
|
+
4: { input: 'inline-flex' },
|
|
35
|
+
5: { input: 'inline-flex' },
|
|
36
|
+
6: { input: 'inline-flex' },
|
|
37
|
+
7: { input: 'inline-flex' },
|
|
38
|
+
8: { input: 'inline-flex' },
|
|
39
|
+
9: { input: 'inline-flex' },
|
|
40
|
+
10: { input: 'inline-flex' },
|
|
41
|
+
20: { input: 'inline-flex' },
|
|
42
|
+
30: { input: 'inline-flex' },
|
|
42
43
|
},
|
|
43
44
|
},
|
|
44
45
|
compoundVariants: [
|
|
@@ -25,11 +25,13 @@ export function Popover({
|
|
|
25
25
|
look,
|
|
26
26
|
soft = false,
|
|
27
27
|
open = false,
|
|
28
|
+
linkStyling = false,
|
|
29
|
+
size = 'medium',
|
|
28
30
|
icon,
|
|
29
31
|
}: PopoverProps) {
|
|
30
32
|
const state = useOverlayTriggerState({});
|
|
31
33
|
const panelId = useId();
|
|
32
|
-
const styles = popoverStyles({});
|
|
34
|
+
const styles = popoverStyles({ linkStyling });
|
|
33
35
|
const ref = useRef<HTMLButtonElement & HTMLAnchorElement & HTMLSpanElement & HTMLDivElement>(null);
|
|
34
36
|
|
|
35
37
|
const handleClick = useCallback(() => {
|
|
@@ -57,13 +59,15 @@ export function Popover({
|
|
|
57
59
|
return (
|
|
58
60
|
<div className={styles.base({ className })}>
|
|
59
61
|
<Button
|
|
60
|
-
look={icon && !children ? 'link' : look}
|
|
62
|
+
look={(icon && !children) || linkStyling ? 'link' : look}
|
|
61
63
|
iconAfter={icon}
|
|
62
64
|
soft={soft}
|
|
63
65
|
aria-expanded={state.isOpen}
|
|
64
66
|
aria-controls={panelId}
|
|
65
67
|
onClick={handleClick}
|
|
66
68
|
ref={ref}
|
|
69
|
+
size={size}
|
|
70
|
+
className={styles.button()}
|
|
67
71
|
>
|
|
68
72
|
{children}
|
|
69
73
|
</Button>
|
|
@@ -4,8 +4,16 @@ export const styles = tv(
|
|
|
4
4
|
{
|
|
5
5
|
slots: {
|
|
6
6
|
base: 'relative inline-block',
|
|
7
|
+
button: '',
|
|
8
|
+
},
|
|
9
|
+
variants: {
|
|
10
|
+
linkStyling: {
|
|
11
|
+
true: {
|
|
12
|
+
button: 'p-0',
|
|
13
|
+
},
|
|
14
|
+
false: {},
|
|
15
|
+
},
|
|
7
16
|
},
|
|
8
|
-
variants: {},
|
|
9
17
|
},
|
|
10
18
|
{ responsiveVariants: ['xsl', 'sm', 'md', 'lg', 'xl'] },
|
|
11
19
|
);
|
|
@@ -25,6 +25,10 @@ export type PopoverProps = {
|
|
|
25
25
|
* Use an icon as the button
|
|
26
26
|
*/
|
|
27
27
|
icon?: (props: IconProps) => JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* Removes padding from trigger button and sets look to link to be able to look inline, use size prop to match font size
|
|
30
|
+
*/
|
|
31
|
+
linkStyling?: boolean;
|
|
28
32
|
/**
|
|
29
33
|
* A function for the onClick event
|
|
30
34
|
*/
|
|
@@ -39,4 +43,4 @@ export type PopoverProps = {
|
|
|
39
43
|
*/
|
|
40
44
|
placement?: 'top' | 'bottom';
|
|
41
45
|
} & HTMLAttributes<Element> &
|
|
42
|
-
Pick<ButtonProps, 'look' | 'soft'>;
|
|
46
|
+
Pick<ButtonProps, 'look' | 'soft' | 'size'>;
|