@westpac/ui 0.36.1 → 0.38.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/button/button.component.d.ts +1 -0
- package/dist/components/button/button.component.js +3 -1
- package/dist/components/button/button.types.d.ts +5 -0
- package/dist/tailwind/tailwind-plugin.js +19 -4
- package/package.json +1 -1
- package/src/components/button/button.component.tsx +7 -2
- package/src/components/button/button.types.ts +5 -0
- package/src/tailwind/tailwind-plugin.ts +20 -11
|
@@ -8,6 +8,7 @@ export declare const Button: React.ForwardRefExoticComponent<{
|
|
|
8
8
|
iconAfter?: (props: import("../icon/icon.types.js").IconProps) => JSX.Element;
|
|
9
9
|
iconBefore?: (props: import("../icon/icon.types.js").IconProps) => JSX.Element;
|
|
10
10
|
iconColor?: import("../icon/icon.types.js").IconProps["color"];
|
|
11
|
+
iconLook?: import("../icon/icon.types.js").IconProps["look"];
|
|
11
12
|
iconSize?: import("../icon/icon.types.js").IconProps["size"];
|
|
12
13
|
justify?: boolean | {
|
|
13
14
|
[x: string]: boolean | undefined;
|
|
@@ -17,7 +17,7 @@ import React, { forwardRef, useMemo } from 'react';
|
|
|
17
17
|
import { mergeProps, useFocusRing } from 'react-aria';
|
|
18
18
|
import { styles as buttonStyles } from './button.styles.js';
|
|
19
19
|
import { getIconSize } from './button.utils.js';
|
|
20
|
-
function BaseButton({ className , size ='medium' , look ='hero' , soft , block =false , justify , tag: Tag = 'button' , iconBefore: IconBefore , iconAfter: IconAfter , iconColor , iconSize , children , ...props }, ref) {
|
|
20
|
+
function BaseButton({ className , size ='medium' , look ='hero' , soft , block =false , justify , tag: Tag = 'button' , iconBefore: IconBefore , iconAfter: IconAfter , iconLook , iconColor , iconSize , children , ...props }, ref) {
|
|
21
21
|
const { isFocusVisible , focusProps } = useFocusRing();
|
|
22
22
|
const btnIconSize = useMemo(()=>iconSize || getIconSize(size), [
|
|
23
23
|
iconSize,
|
|
@@ -38,6 +38,7 @@ function BaseButton({ className , size ='medium' , look ='hero' , soft , block =
|
|
|
38
38
|
className
|
|
39
39
|
})
|
|
40
40
|
}, mergeProps(props, focusProps)), IconBefore && React.createElement(IconBefore, {
|
|
41
|
+
look: iconLook,
|
|
41
42
|
size: btnIconSize,
|
|
42
43
|
className: styles.iconBefore(),
|
|
43
44
|
color: iconColor,
|
|
@@ -45,6 +46,7 @@ function BaseButton({ className , size ='medium' , look ='hero' , soft , block =
|
|
|
45
46
|
}), React.createElement("span", {
|
|
46
47
|
className: styles.text()
|
|
47
48
|
}, children), IconAfter && React.createElement(IconAfter, {
|
|
49
|
+
look: iconLook,
|
|
48
50
|
size: btnIconSize,
|
|
49
51
|
className: styles.iconAfter(),
|
|
50
52
|
color: iconColor,
|
|
@@ -34,11 +34,26 @@ export const WestpacUIKitBasePlugin = plugin.withOptions(function(options = {})
|
|
|
34
34
|
'.select-caret': {
|
|
35
35
|
backgroundImage: "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='8' style='color: rgb(89,87,103);'><path fill='currentColor' d='M0 0l7 8 7-8z'/></svg>\")"
|
|
36
36
|
}
|
|
37
|
+
}, {
|
|
38
|
+
respectPrefix: true,
|
|
39
|
+
respectImportant: true
|
|
40
|
+
});
|
|
41
|
+
addComponents(generateLinearLoader(), {
|
|
42
|
+
respectPrefix: true,
|
|
43
|
+
respectImportant: true
|
|
44
|
+
});
|
|
45
|
+
addComponents(generateFontComponents(theme('typographySizes'), theme), {
|
|
46
|
+
respectPrefix: true,
|
|
47
|
+
respectImportant: true
|
|
48
|
+
});
|
|
49
|
+
addComponents(generateFormControlComponents(theme('formControl')), {
|
|
50
|
+
respectPrefix: true,
|
|
51
|
+
respectImportant: true
|
|
52
|
+
});
|
|
53
|
+
addComponents(generateDatePicker(), {
|
|
54
|
+
respectPrefix: true,
|
|
55
|
+
respectImportant: true
|
|
37
56
|
});
|
|
38
|
-
addComponents(generateLinearLoader());
|
|
39
|
-
addComponents(generateFontComponents(theme('typographySizes'), theme));
|
|
40
|
-
addComponents(generateFormControlComponents(theme('formControl')));
|
|
41
|
-
addComponents(generateDatePicker());
|
|
42
57
|
THEMES.forEach(({ name })=>{
|
|
43
58
|
addVariant(`active-theme-${name.toLowerCase()}`, [
|
|
44
59
|
`[data-theme="${name.toLowerCase()}"] &`,
|
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ function BaseButton(
|
|
|
18
18
|
tag: Tag = 'button',
|
|
19
19
|
iconBefore: IconBefore,
|
|
20
20
|
iconAfter: IconAfter,
|
|
21
|
+
iconLook,
|
|
21
22
|
iconColor,
|
|
22
23
|
iconSize,
|
|
23
24
|
children,
|
|
@@ -39,9 +40,13 @@ function BaseButton(
|
|
|
39
40
|
|
|
40
41
|
return (
|
|
41
42
|
<Tag ref={ref} className={styles.base({ className })} {...mergeProps(props, focusProps)}>
|
|
42
|
-
{IconBefore &&
|
|
43
|
+
{IconBefore && (
|
|
44
|
+
<IconBefore look={iconLook} size={btnIconSize} className={styles.iconBefore()} color={iconColor} aria-hidden />
|
|
45
|
+
)}
|
|
43
46
|
<span className={styles.text()}>{children}</span>
|
|
44
|
-
{IconAfter &&
|
|
47
|
+
{IconAfter && (
|
|
48
|
+
<IconAfter look={iconLook} size={btnIconSize} className={styles.iconAfter()} color={iconColor} aria-hidden />
|
|
49
|
+
)}
|
|
45
50
|
</Tag>
|
|
46
51
|
);
|
|
47
52
|
}
|
|
@@ -39,22 +39,31 @@ export const WestpacUIKitBasePlugin = plugin.withOptions(
|
|
|
39
39
|
/**
|
|
40
40
|
* Utilities
|
|
41
41
|
*/
|
|
42
|
-
addUtilities(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
addUtilities(
|
|
43
|
+
{
|
|
44
|
+
'.focus-outline': { [`@apply ${theme('focusOutline')}`]: {} },
|
|
45
|
+
'.background-transition': { [`@apply ${theme('backgroundTransition')}`]: {} },
|
|
46
|
+
'.select-caret': {
|
|
47
|
+
backgroundImage:
|
|
48
|
+
"url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='8' style='color: rgb(89,87,103);'><path fill='currentColor' d='M0 0l7 8 7-8z'/></svg>\")",
|
|
49
|
+
},
|
|
48
50
|
},
|
|
49
|
-
|
|
51
|
+
{ respectPrefix: true, respectImportant: true },
|
|
52
|
+
);
|
|
50
53
|
|
|
51
54
|
/**
|
|
52
55
|
* Components
|
|
53
56
|
*/
|
|
54
|
-
addComponents(generateLinearLoader());
|
|
55
|
-
addComponents(generateFontComponents(theme('typographySizes'), theme)
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
addComponents(generateLinearLoader(), { respectPrefix: true, respectImportant: true });
|
|
58
|
+
addComponents(generateFontComponents(theme('typographySizes'), theme), {
|
|
59
|
+
respectPrefix: true,
|
|
60
|
+
respectImportant: true,
|
|
61
|
+
});
|
|
62
|
+
addComponents(generateFormControlComponents(theme('formControl')), {
|
|
63
|
+
respectPrefix: true,
|
|
64
|
+
respectImportant: true,
|
|
65
|
+
});
|
|
66
|
+
addComponents(generateDatePicker(), { respectPrefix: true, respectImportant: true });
|
|
58
67
|
|
|
59
68
|
/**
|
|
60
69
|
* Variants
|