@westpac/ui 1.1.2 → 1.2.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/.agents/skills/creating-gel-component/SKILL.md +13 -9
- package/.agents/skills/reviewing-gel-component/SKILL.md +19 -9
- package/.agents/skills/writing-gel-tests/SKILL.md +10 -6
- package/CHANGELOG.md +13 -0
- package/dist/component-type.json +1 -1
- package/dist/components/autocomplete/autocomplete.component.js +2 -2
- package/dist/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.component.d.ts +1 -1
- package/dist/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.component.js +2 -2
- package/dist/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.types.d.ts +1 -0
- package/dist/components/multi-select/components/multi-select-list-box/multi-select-list-box.component.js +2 -2
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.component.d.ts +1 -1
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.component.js +3 -2
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.styles.d.ts +42 -39
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.styles.js +15 -14
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.types.d.ts +1 -0
- package/dist/components/multi-select/components/multi-select-popover/multi-select-popover.component.js +13 -5
- package/dist/components/multi-select/multi-select.component.d.ts +1 -1
- package/dist/components/multi-select/multi-select.component.js +19 -6
- package/dist/components/multi-select/multi-select.types.d.ts +22 -1
- package/package.json +4 -4
- package/src/components/autocomplete/autocomplete.component.tsx +2 -2
- package/src/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.component.tsx +4 -1
- package/src/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.types.ts +1 -0
- package/src/components/multi-select/components/multi-select-list-box/multi-select-list-box.component.tsx +2 -2
- package/src/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.component.tsx +2 -0
- package/src/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.styles.ts +14 -14
- package/src/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.types.ts +1 -0
- package/src/components/multi-select/components/multi-select-popover/multi-select-popover.component.tsx +20 -4
- package/src/components/multi-select/multi-select.component.tsx +18 -3
- package/src/components/multi-select/multi-select.types.ts +23 -1
|
@@ -7,9 +7,13 @@ description: 'Scaffolds a new GEL design system UI component following project c
|
|
|
7
7
|
|
|
8
8
|
Scaffolds a new React component in `packages/ui/src/components/`. All conventions (file naming, imports, patterns) are defined in the `packages/ui/.agents/AGENTS.md` — follow those automatically.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## When to Use
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Use this skill when you want to create a new GEL design system component. This includes scaffolding the necessary files (component, styles, types, tests, stories), following the established patterns for responsive variants and Tailwind styling, and registering the component in the main index.
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
1. Create the types file (`{name}.types.ts`)
|
|
13
17
|
|
|
14
18
|
```tsx
|
|
15
19
|
import { HTMLAttributes } from 'react';
|
|
@@ -30,7 +34,7 @@ export type {PascalName}Props = {
|
|
|
30
34
|
} & HTMLAttributes<HTMLElement>;
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
2. Create the styles file (`{name}.styles.ts`)
|
|
34
38
|
|
|
35
39
|
```ts
|
|
36
40
|
import { tv } from 'tailwind-variants';
|
|
@@ -41,7 +45,7 @@ export const styles = tv({
|
|
|
41
45
|
});
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
3. Create the component file (`{name}.component.tsx`)
|
|
45
49
|
|
|
46
50
|
```tsx
|
|
47
51
|
'use client';
|
|
@@ -78,14 +82,14 @@ function Base{PascalName}(
|
|
|
78
82
|
export const {PascalName} = forwardRef(Base{PascalName});
|
|
79
83
|
```
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
4. Create the index file (`index.ts`)
|
|
82
86
|
|
|
83
87
|
```ts
|
|
84
88
|
export { {PascalName} } from './{kebab-case-name}.component.js';
|
|
85
89
|
export { type {PascalName}Props } from './{kebab-case-name}.types.js';
|
|
86
90
|
```
|
|
87
91
|
|
|
88
|
-
|
|
92
|
+
5. Create the test file (`{name}.spec.tsx`)
|
|
89
93
|
|
|
90
94
|
```tsx
|
|
91
95
|
import { render } from '@testing-library/react';
|
|
@@ -102,7 +106,7 @@ describe('{PascalName}', () => {
|
|
|
102
106
|
|
|
103
107
|
See the `writing-gel-tests` skill for comprehensive testing guidance.
|
|
104
108
|
|
|
105
|
-
|
|
109
|
+
6. Create the stories file (`{name}.stories.tsx`)
|
|
106
110
|
|
|
107
111
|
```tsx
|
|
108
112
|
import { type Meta, StoryFn, type StoryObj } from '@storybook/react-vite';
|
|
@@ -137,7 +141,7 @@ export const Example = () => {
|
|
|
137
141
|
};
|
|
138
142
|
```
|
|
139
143
|
|
|
140
|
-
|
|
144
|
+
7. Register the component
|
|
141
145
|
|
|
142
146
|
Add the export to `packages/ui/src/components/index.ts`:
|
|
143
147
|
|
|
@@ -145,7 +149,7 @@ Add the export to `packages/ui/src/components/index.ts`:
|
|
|
145
149
|
export * from './{kebab-case-name}/index.js';
|
|
146
150
|
```
|
|
147
151
|
|
|
148
|
-
|
|
152
|
+
8. Verify
|
|
149
153
|
|
|
150
154
|
Run these commands from `packages/ui/`:
|
|
151
155
|
|
|
@@ -7,15 +7,25 @@ description: 'Reviews GEL design system components for convention compliance, ac
|
|
|
7
7
|
|
|
8
8
|
Reviews components in `packages/ui/src/components/` against the conventions defined in `packages/ui/.agents/AGENTS.md`.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## When to Use
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Use this skill when a maintainer asks to "review my component", "check my code", "audit this component", or "ensure this follows GEL conventions". This includes checking file structure, types, styles, component implementation, accessibility, and index exports for any component in `packages/ui`.
|
|
13
|
+
|
|
14
|
+
## Use vercel skills first
|
|
15
|
+
|
|
16
|
+
Before continuing with this skill, check using `vercel-react-best-practices` and `web-design-guidelines` skills to catch common React and web development issues.
|
|
17
|
+
|
|
18
|
+
## Project Review Checklist
|
|
19
|
+
|
|
20
|
+
The below checklist is based on project specific conventions that may not be covered by general best practices. Use this to review the component for compliance with GEL design system standards.
|
|
21
|
+
|
|
22
|
+
1. File Structure
|
|
13
23
|
|
|
14
24
|
- [ ] All required files exist: `index.ts`, `*.component.tsx`, `*.styles.ts`, `*.types.ts`, `*.spec.tsx`, `*.stories.tsx`
|
|
15
25
|
- [ ] File names use kebab-case matching the directory name
|
|
16
26
|
- [ ] Component is exported from `packages/ui/src/components/index.ts`
|
|
17
27
|
|
|
18
|
-
|
|
28
|
+
2. Types
|
|
19
29
|
|
|
20
30
|
- [ ] `Variants` type alias derived from `VariantProps<typeof styles>`
|
|
21
31
|
- [ ] Responsive props wrapped with `ResponsiveVariants<Variants['...']>`
|
|
@@ -24,7 +34,7 @@ Reviews components in `packages/ui/src/components/` against the conventions defi
|
|
|
24
34
|
- [ ] Uses `Omit<>` for conflicting HTML attributes
|
|
25
35
|
- [ ] `.js` extensions on relative imports
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
3. Styles
|
|
28
38
|
|
|
29
39
|
- [ ] Uses tailwind styling except when animations/dynamic styles are required
|
|
30
40
|
- [ ] Uses `tv()` from `tailwind-variants`, exported as `styles`
|
|
@@ -33,7 +43,7 @@ Reviews components in `packages/ui/src/components/` against the conventions defi
|
|
|
33
43
|
- [ ] Uses `slots` for multi-element components
|
|
34
44
|
- [ ] Uses `compoundSlots` for variant combinations
|
|
35
45
|
|
|
36
|
-
|
|
46
|
+
4. Component
|
|
37
47
|
|
|
38
48
|
- [ ] Has `'use client';` if using hooks or client-side rendering
|
|
39
49
|
- [ ] Uses `forwardRef` pattern when appropriate
|
|
@@ -44,7 +54,7 @@ Reviews components in `packages/ui/src/components/` against the conventions defi
|
|
|
44
54
|
- [ ] `.js` extensions on all relative imports
|
|
45
55
|
- [ ] Plain function declarations (not `React.FC`)
|
|
46
56
|
|
|
47
|
-
|
|
57
|
+
5. Accessibility
|
|
48
58
|
|
|
49
59
|
- [ ] Interactive elements use appropriate ARIA attributes
|
|
50
60
|
- [ ] Decorative icons use `aria-hidden`
|
|
@@ -52,19 +62,19 @@ Reviews components in `packages/ui/src/components/` against the conventions defi
|
|
|
52
62
|
- [ ] Semantic HTML elements used
|
|
53
63
|
- [ ] `react-stately` hooks for state management where applicable
|
|
54
64
|
|
|
55
|
-
|
|
65
|
+
6. Index
|
|
56
66
|
|
|
57
67
|
- [ ] Exports component and props type only
|
|
58
68
|
- [ ] Does NOT re-export styles
|
|
59
69
|
- [ ] `.js` extensions
|
|
60
70
|
|
|
61
|
-
|
|
71
|
+
7. Tests
|
|
62
72
|
|
|
63
73
|
- [ ] At minimum a "renders the component" test
|
|
64
74
|
- [ ] Uses `userEvent.setup()` (not `fireEvent`) for interactions
|
|
65
75
|
- [ ] Imports from `.component.js` (not index)
|
|
66
76
|
|
|
67
|
-
|
|
77
|
+
8. Stories
|
|
68
78
|
|
|
69
79
|
- [ ] Imports from `@storybook/react-vite`
|
|
70
80
|
- [ ] Has `tags: ['autodocs']` and standard decorator
|
|
@@ -7,6 +7,10 @@ description: 'Writes Vitest + React Testing Library tests for GEL design system
|
|
|
7
7
|
|
|
8
8
|
Guides writing tests for components in `packages/ui/src/components/`. Test conventions are also summarised in `packages/ui/.agents/AGENTS.md`.
|
|
9
9
|
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
Reference this when a maintainer asks to "write tests for my component", "add tests", "improve test coverage", or "ensure this is well tested". Tests should also be written/updated after functionality has been added or changed. This includes writing new tests, improving existing tests, and ensuring comprehensive coverage for any component in `packages/ui`.
|
|
13
|
+
|
|
10
14
|
## Test Environment
|
|
11
15
|
|
|
12
16
|
- **Runner**: Vitest with `jsdom` environment
|
|
@@ -48,7 +52,7 @@ Import from `./component-name.component.js` (NOT from `index`), sub-components f
|
|
|
48
52
|
|
|
49
53
|
## Test Categories
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
1. Render Tests (Required)
|
|
52
56
|
|
|
53
57
|
```tsx
|
|
54
58
|
it('renders the component', () => {
|
|
@@ -57,7 +61,7 @@ it('renders the component', () => {
|
|
|
57
61
|
});
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
2. Variant Rendering
|
|
61
65
|
|
|
62
66
|
```tsx
|
|
63
67
|
it('renders as an anchor tag', () => {
|
|
@@ -70,7 +74,7 @@ it('renders as an anchor tag', () => {
|
|
|
70
74
|
});
|
|
71
75
|
```
|
|
72
76
|
|
|
73
|
-
|
|
77
|
+
3. User Interactions
|
|
74
78
|
|
|
75
79
|
Always use `userEvent.setup()` (NOT `fireEvent`):
|
|
76
80
|
|
|
@@ -89,7 +93,7 @@ it('calls onClick when clicked', async () => {
|
|
|
89
93
|
});
|
|
90
94
|
```
|
|
91
95
|
|
|
92
|
-
|
|
96
|
+
4. Visibility / State
|
|
93
97
|
|
|
94
98
|
```tsx
|
|
95
99
|
it('shows content when expanded', async () => {
|
|
@@ -109,7 +113,7 @@ it('shows content when expanded', async () => {
|
|
|
109
113
|
});
|
|
110
114
|
```
|
|
111
115
|
|
|
112
|
-
|
|
116
|
+
5. Icon Rendering
|
|
113
117
|
|
|
114
118
|
```tsx
|
|
115
119
|
it('renders an icon when passed', () => {
|
|
@@ -118,7 +122,7 @@ it('renders an icon when passed', () => {
|
|
|
118
122
|
});
|
|
119
123
|
```
|
|
120
124
|
|
|
121
|
-
|
|
125
|
+
6. Utility Functions
|
|
122
126
|
|
|
123
127
|
```tsx
|
|
124
128
|
describe('ComponentName utils', () => {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @westpac/ui
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ba74b1e: - added hideFilter prop to MultiSelect to hide the filter in dropdown
|
|
8
|
+
- added hideSelectAll prop to MultiSelect to hide the Select All option in dropdown
|
|
9
|
+
- added width prop to MultiSelect for fixed widths similar to the Input component
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 5aa6631: - fix security issues in style-config
|
|
14
|
+
- fix deprecated prop usage in autocomplete after package updates
|
|
15
|
+
|
|
3
16
|
## 1.1.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|