@westpac/ui 0.8.0 → 0.9.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.
Files changed (109) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/assets/icons/filled/exit-filled.svg +3 -3
  3. package/assets/icons/outlined/exit-outlined.svg +3 -3
  4. package/dist/component-type.json +1 -1
  5. package/dist/components/accordion/accordion.styles.js +1 -1
  6. package/dist/components/accordion/components/accordion-item/accordion-item.styles.d.ts +2 -0
  7. package/dist/components/accordion/components/accordion-item/accordion-item.styles.js +2 -1
  8. package/dist/components/alert/alert.styles.js +4 -4
  9. package/dist/components/badge/badge.styles.js +1 -1
  10. package/dist/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.js +1 -1
  11. package/dist/components/button/button.styles.js +4 -4
  12. package/dist/components/button-dropdown/components/panel/panel.styles.js +1 -1
  13. package/dist/components/button-group/components/button/button.styles.js +1 -1
  14. package/dist/components/checkbox-group/components/checkbox/checkbox.styles.js +1 -1
  15. package/dist/components/compacta/compacta.styles.js +4 -4
  16. package/dist/components/flexi-cell/flexi-cell.styles.js +1 -1
  17. package/dist/components/form-label/form-label.styles.d.ts +1 -1
  18. package/dist/components/form-label/form-label.styles.js +1 -1
  19. package/dist/components/icon/components/exit-icon.js +2 -2
  20. package/dist/components/input-field/components/add-ons/components/icon-add-on/icon-add-on.styles.js +6 -6
  21. package/dist/components/input-field/components/add-ons/components/text-add-on/text-add-on.styles.js +5 -5
  22. package/dist/components/list/components/item/item.styles.js +4 -4
  23. package/dist/components/modal/components/dialog/dialog.styles.js +1 -1
  24. package/dist/components/pagination/components/pagination-item/pagination-item.styles.d.ts +1 -1
  25. package/dist/components/pagination/components/pagination-item/pagination-item.styles.js +3 -3
  26. package/dist/components/panel/panel.styles.js +1 -1
  27. package/dist/components/popover/components/panel/panel.component.d.ts +1 -1
  28. package/dist/components/popover/components/panel/panel.component.js +39 -5
  29. package/dist/components/popover/components/panel/panel.styles.js +5 -5
  30. package/dist/components/popover/components/panel/panel.types.d.ts +12 -2
  31. package/dist/components/popover/popover.component.d.ts +4 -0
  32. package/dist/components/popover/popover.component.js +12 -6
  33. package/dist/components/popover/popover.hooks.d.ts +3 -0
  34. package/dist/components/popover/popover.hooks.js +37 -0
  35. package/dist/components/popover/popover.stories.d.ts +9 -5
  36. package/dist/components/popover/popover.types.d.ts +1 -1
  37. package/dist/components/progress-bar/progress-bar.styles.js +2 -2
  38. package/dist/components/repeater/repeater.styles.js +4 -4
  39. package/dist/components/switch/switch.styles.js +1 -1
  40. package/dist/components/table/components/row/row.styles.js +1 -1
  41. package/dist/components/tabs/components/tab/tab.styles.d.ts +1 -1
  42. package/dist/components/tabs/components/tab/tab.styles.js +4 -4
  43. package/dist/components/well/well.styles.d.ts +1 -1
  44. package/dist/components/well/well.styles.js +1 -1
  45. package/dist/css/westpac-ui.css +481 -328
  46. package/dist/css/westpac-ui.min.css +481 -328
  47. package/dist/stories/foundation/typography.stories.d.ts +4 -0
  48. package/dist/tailwind/__mocks__/utils.constants.d.ts +71 -36
  49. package/dist/tailwind/__mocks__/utils.constants.js +71 -36
  50. package/dist/tailwind/constants/spacing.d.ts +2 -36
  51. package/dist/tailwind/constants/spacing.js +2 -1
  52. package/dist/tailwind/tailwind-plugin.js +3 -0
  53. package/dist/tailwind/types/index.d.ts +0 -1
  54. package/dist/tailwind/types/index.js +0 -1
  55. package/dist/tailwind/utils/create-spacing.d.ts +2 -3
  56. package/dist/tailwind/utils/create-spacing.js +7 -7
  57. package/package.json +3 -1
  58. package/src/components/accordion/accordion.styles.ts +1 -1
  59. package/src/components/accordion/components/accordion-item/accordion-item.styles.ts +1 -0
  60. package/src/components/alert/alert.styles.ts +4 -4
  61. package/src/components/badge/badge.styles.ts +1 -1
  62. package/src/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.tsx +1 -1
  63. package/src/components/button/button.styles.ts +4 -4
  64. package/src/components/button-dropdown/components/panel/panel.styles.ts +1 -2
  65. package/src/components/button-group/components/button/button.styles.ts +1 -1
  66. package/src/components/checkbox-group/components/checkbox/checkbox.styles.ts +1 -1
  67. package/src/components/compacta/compacta.styles.ts +4 -4
  68. package/src/components/error-message/error-message.component.tsx +1 -7
  69. package/src/components/flexi-cell/flexi-cell.styles.ts +1 -1
  70. package/src/components/form-label/form-label.styles.ts +1 -1
  71. package/src/components/icon/components/exit-icon.tsx +2 -2
  72. package/src/components/icon/index.ts +1 -0
  73. package/src/components/input-field/components/add-ons/components/icon-add-on/icon-add-on.styles.ts +16 -16
  74. package/src/components/input-field/components/add-ons/components/text-add-on/text-add-on.styles.ts +5 -5
  75. package/src/components/list/components/item/item.styles.ts +4 -4
  76. package/src/components/modal/components/dialog/dialog.styles.ts +1 -1
  77. package/src/components/pagination/components/pagination-item/pagination-item.styles.ts +3 -3
  78. package/src/components/panel/panel.styles.ts +1 -1
  79. package/src/components/popover/components/panel/panel.component.tsx +36 -6
  80. package/src/components/popover/components/panel/panel.styles.ts +5 -5
  81. package/src/components/popover/components/panel/panel.types.ts +13 -2
  82. package/src/components/popover/popover.component.tsx +13 -2
  83. package/src/components/popover/popover.hooks.tsx +56 -0
  84. package/src/components/popover/popover.types.ts +1 -1
  85. package/src/components/progress-bar/progress-bar.styles.ts +2 -2
  86. package/src/components/repeater/repeater.styles.ts +4 -4
  87. package/src/components/switch/switch.styles.ts +1 -1
  88. package/src/components/table/components/row/row.styles.ts +1 -1
  89. package/src/components/tabs/components/tab/tab.styles.ts +4 -4
  90. package/src/components/well/well.styles.ts +1 -1
  91. package/src/tailwind/__mocks__/utils.constants.ts +71 -36
  92. package/src/tailwind/constants/spacing.ts +2 -1
  93. package/src/tailwind/tailwind-plugin.ts +3 -0
  94. package/src/tailwind/types/index.ts +0 -1
  95. package/src/tailwind/utils/create-spacing.ts +9 -13
  96. package/.storybook/global.css +0 -109
  97. package/.storybook/main.ts +0 -33
  98. package/.storybook/manager.ts +0 -6
  99. package/.storybook/preview.tsx +0 -91
  100. package/.storybook/theme.ts +0 -9
  101. package/dist/tailwind/types/theme.types.d.ts +0 -1
  102. package/dist/tailwind/types/theme.types.js +0 -1
  103. package/scaffold/component/scaffold.component.hbs +0 -12
  104. package/scaffold/component/scaffold.index.hbs +0 -2
  105. package/scaffold/component/scaffold.spec.hbs +0 -16
  106. package/scaffold/component/scaffold.stories.hbs +0 -23
  107. package/scaffold/component/scaffold.styles.hbs +0 -9
  108. package/scaffold/component/scaffold.types.hbs +0 -12
  109. package/src/tailwind/types/theme.types.ts +0 -37
@@ -1,109 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- @layer base {
6
- /* BOM fonts */
7
- @font-face {
8
- src: url('/fonts/lineto-brown-pro-light.woff2') format('woff2'),
9
- url('/fonts/lineto-brown-pro-light.woff') format('woff');
10
- font-family: 'Brown Pro';
11
- font-weight: 300;
12
- font-style: normal;
13
- }
14
- @font-face {
15
- src: url('/fonts/lineto-brown-pro-regular.woff2') format('woff2'),
16
- url('/fonts/lineto-brown-pro-regular.woff') format('woff');
17
- font-family: 'Brown Pro';
18
- font-weight: 400;
19
- font-style: normal;
20
- }
21
- @font-face {
22
- src: url('/fonts/lineto-brown-pro-bold.woff2') format('woff2'),
23
- url('/fonts/lineto-brown-pro-bold.woff') format('woff');
24
- font-family: 'Brown Pro';
25
- font-weight: 700;
26
- font-style: normal;
27
- }
28
-
29
- /* BSA fonts */
30
- @font-face {
31
- src: url('/fonts/Aller_Lt.woff2') format('woff2'), url('/fonts/Aller_Lt.woff') format('woff');
32
- font-family: 'Aller';
33
- font-weight: 300;
34
- font-style: normal;
35
- }
36
- @font-face {
37
- src: url('/fonts/Aller_Bd.woff2') format('woff2'), url('/fonts/Aller_Bd.woff') format('woff');
38
- font-family: 'Aller';
39
- font-weight: 700;
40
- font-style: normal;
41
- }
42
-
43
- /* RAMS fonts */
44
- @font-face {
45
- src: url('/fonts/source-sans-pro-v14-latin-regular.woff2') format('woff2'),
46
- url('/fonts/source-sans-pro-v14-latin-regular.woff') format('woff');
47
- font-family: 'Source Sans Pro';
48
- font-weight: normal;
49
- font-style: normal;
50
- }
51
- @font-face {
52
- src: url('/fonts/source-sans-pro-v14-latin-600.woff2') format('woff2'),
53
- url('/fonts/source-sans-pro-v14-latin-600.woff') format('woff');
54
- font-family: 'Source Sans Pro';
55
- font-weight: 600;
56
- font-style: normal;
57
- }
58
- @font-face {
59
- src: url('/fonts/source-sans-pro-v14-latin-700.woff2') format('woff2'),
60
- url('/fonts/source-sans-pro-v14-latin-700.woff') format('woff');
61
- font-family: 'Source Sans Pro';
62
- font-weight: 700;
63
- font-style: normal;
64
- }
65
-
66
- /* STG fonts */
67
- @font-face {
68
- src: url('/fonts/dragonbold-bold-webfont.woff2') format('woff2'),
69
- url('/fonts/dragonbold-bold-webfont.woff') format('woff');
70
- font-family: 'Dragon Bold';
71
- font-weight: 400;
72
- font-style: normal;
73
- }
74
-
75
- /* WBC fonts */
76
- @font-face {
77
- src: url('/fonts/Westpac-Bold-v2.007.woff2') format('woff2'), url('/fonts/Westpac-Bold-v2.007.woff') format('woff');
78
- font-family: 'Westpac';
79
- font-weight: 400;
80
- font-style: normal;
81
- }
82
-
83
- /* WBG fonts */
84
- @font-face {
85
- src: url('/fonts/montserrat-v14-latin-300.woff2') format('woff2'),
86
- url('/fonts/montserrat-v14-latin-300.woff') format('woff');
87
- font-family: 'Montserrat';
88
- font-weight: 300;
89
- font-style: normal;
90
- }
91
- @font-face {
92
- src: url('/fonts/montserrat-v14-latin-regular.woff2') format('woff2'),
93
- url('/fonts/montserrat-v14-latin-regular.woff') format('woff');
94
- font-family: 'Montserrat';
95
- font-weight: 400;
96
- font-style: normal;
97
- }
98
- @font-face {
99
- src: url('/fonts/montserrat-v14-latin-700.woff2') format('woff2'),
100
- url('/fonts/montserrat-v14-latin-700.woff') format('woff');
101
- font-family: 'Montserrat';
102
- font-weight: 700;
103
- font-style: normal;
104
- }
105
-
106
- body {
107
- @apply typography-body-11;
108
- }
109
- }
@@ -1,33 +0,0 @@
1
- import type { StorybookConfig } from '@storybook/react-vite';
2
- import { mergeConfig } from 'vite';
3
-
4
- const config: StorybookConfig = {
5
- stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
6
- addons: [
7
- '@storybook/addon-links',
8
- '@storybook/addon-essentials',
9
- '@storybook/addon-interactions',
10
- '@storybook/addon-styling',
11
- '@storybook/addon-actions',
12
- '@storybook/addon-a11y',
13
- ],
14
- framework: {
15
- name: '@storybook/react-vite',
16
- options: {},
17
- },
18
- docs: {
19
- autodocs: 'tag',
20
- },
21
- staticDirs: ['../assets/storybook'],
22
- async viteFinal(config) {
23
- return mergeConfig(config, {
24
- optimizeDeps: {
25
- exclude: ['@duetds/date-picker/dist/loader'],
26
- },
27
- define: {
28
- 'process.env': {},
29
- },
30
- });
31
- },
32
- };
33
- export default config;
@@ -1,6 +0,0 @@
1
- import { addons } from '@storybook/manager-api';
2
- import theme from './theme';
3
-
4
- addons.setConfig({
5
- theme: theme,
6
- });
@@ -1,91 +0,0 @@
1
- import type { Preview } from '@storybook/react';
2
- import './global.css';
3
- import * as React from 'react';
4
-
5
- const withThemeProvider = (Story, context) => {
6
- const theme = context.globals?.theme || 'WBC';
7
- return (
8
- <div data-theme={theme.toLowerCase()} className="p-4">
9
- <Story />
10
- </div>
11
- );
12
- };
13
-
14
- const systemViewports = {
15
- xs: {
16
- name: 'XS',
17
- styles: {
18
- width: '375px',
19
- height: '801px',
20
- },
21
- },
22
- xsl: {
23
- name: 'XSL',
24
- styles: {
25
- width: '576px',
26
- height: '801px',
27
- },
28
- },
29
- sm: {
30
- name: 'SM',
31
- styles: {
32
- width: '768px',
33
- height: '801px',
34
- },
35
- },
36
- md: {
37
- name: 'MD',
38
- styles: {
39
- width: '992px',
40
- height: '801px',
41
- },
42
- },
43
- lg: {
44
- name: 'LG',
45
- styles: {
46
- width: '1200px',
47
- height: '801px',
48
- },
49
- },
50
- xl: {
51
- name: 'XL',
52
- styles: {
53
- width: '1900px',
54
- height: '801px',
55
- },
56
- },
57
- };
58
-
59
- const preview: Preview = {
60
- globalTypes: {
61
- theme: {
62
- description: 'Global theme for components',
63
- defaultValue: 'WBC',
64
- toolbar: {
65
- // The label to show for this toolbar item
66
- title: 'Theme',
67
- icon: 'paintbrush',
68
- // Array of plain string values or MenuItem shape (see below)
69
- items: ['BOM', 'BSA', 'BTFG', 'RAMS', 'STG', 'WBC', 'WBG'],
70
- // Change title based on selected value
71
- dynamicTitle: true,
72
- },
73
- },
74
- },
75
- parameters: {
76
- actions: { argTypesRegex: '^on[A-Z].*' },
77
- controls: {
78
- matchers: {
79
- color: /(background|color)$/i,
80
- date: /Date$/,
81
- },
82
- },
83
- layout: 'fullscreen',
84
- viewport: {
85
- viewports: systemViewports,
86
- },
87
- },
88
- decorators: [withThemeProvider],
89
- };
90
-
91
- export default preview;
@@ -1,9 +0,0 @@
1
- import { create } from '@storybook/theming/create';
2
-
3
- export default create({
4
- base: 'light',
5
- brandTitle: 'GEL Next',
6
- brandImage: '/gel-icon.svg',
7
- brandTarget: '_self',
8
- colorSecondary: '#DA1710',
9
- });
@@ -1 +0,0 @@
1
- export type SPACING_KEY = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35;
@@ -1 +0,0 @@
1
- export { };
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
-
3
- import { styles } from './{{kebabCase name}}.styles.js';
4
- import { type {{name}}Props } from './{{kebabCase name}}.types.js';
5
-
6
- export function {{name}}({ className, tag: Tag = 'div', children, ...props }: {{name}}Props) {
7
- return (
8
- <Tag className={styles({ className })} {...props}>
9
- {children}
10
- </Tag>
11
- );
12
- }
@@ -1,2 +0,0 @@
1
- export { {{name}} } from './{{kebabCase name}}.component.js';
2
- export { type {{name}}Props } from './{{kebabCase name}}.types.js';
@@ -1,16 +0,0 @@
1
- import { render } from '@testing-library/react';
2
-
3
- import { {{name}} } from './{{kebabCase name}}.component.js';
4
- import { styles } from './{{kebabCase name}}.styles.js';
5
-
6
- describe('{{name}}', () => {
7
- it('renders the component', () => {
8
- const { container } = render(<{{name}} />);
9
- expect(container).toBeInTheDocument();
10
- });
11
- it('renders the style correctly', () => {
12
- const style = styles();
13
- // TODO: use some variants for test
14
- expect(style).toBe('');
15
- });
16
- });
@@ -1,23 +0,0 @@
1
- import { type Meta, StoryFn, type StoryObj } from '@storybook/react';
2
-
3
- import { {{name}} } from './{{kebabCase name}}.component.js';
4
-
5
- const meta: Meta<typeof {{name}}> = {
6
- title: 'Components/{{name}}',
7
- component: {{name}},
8
- tags: ['autodocs'],
9
- decorators: [(Story: StoryFn) => <Story />],
10
- parameters: {
11
- layout: 'centered',
12
- },
13
- };
14
-
15
- export default meta;
16
- type Story = StoryObj<typeof meta>;
17
-
18
- /**
19
- * > Default usage example
20
- */
21
- export const DefaultStory: Story = {
22
- args: {},
23
- };
@@ -1,9 +0,0 @@
1
- import { tv } from 'tailwind-variants';
2
-
3
- export const styles = tv(
4
- {
5
- base: '',
6
- variants: {},
7
- },
8
- { responsiveVariants: ['xsl', 'sm', 'md', 'lg', 'xl'] },
9
- );
@@ -1,12 +0,0 @@
1
- import { HTMLAttributes } from 'react';
2
- import { type VariantProps } from 'tailwind-variants';
3
-
4
- import { styles } from './{{kebabCase name}}.styles.js';
5
-
6
- export type {{name}}Props = {
7
- /**
8
- * Tag to render
9
- */
10
- tag?: keyof JSX.IntrinsicElements;
11
- } & VariantProps<typeof styles> &
12
- HTMLAttributes<Element>;
@@ -1,37 +0,0 @@
1
- export type SPACING_KEY =
2
- | 0
3
- | 1
4
- | 2
5
- | 3
6
- | 4
7
- | 5
8
- | 6
9
- | 7
10
- | 8
11
- | 9
12
- | 10
13
- | 11
14
- | 12
15
- | 13
16
- | 14
17
- | 15
18
- | 16
19
- | 17
20
- | 18
21
- | 19
22
- | 20
23
- | 21
24
- | 22
25
- | 23
26
- | 24
27
- | 25
28
- | 26
29
- | 27
30
- | 28
31
- | 29
32
- | 30
33
- | 31
34
- | 32
35
- | 33
36
- | 34
37
- | 35;