@wangs-ui/skills 1.1.5 → 1.1.9

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.
@@ -1,176 +1,176 @@
1
- ---
2
- name: create-form
3
- description: Form architecture, validation workflows, strongly-typed forms (useForm, useDialogForm, useWatchField), initialValues/reset lifecycle, and MCP discovery protocol for building forms and input controls with @wangs-ui/react-core.
4
- ---
5
-
6
- # Skill: Form Architecture & Validation Workflows
7
-
8
- Use this skill when building forms, data entry panels, modal forms, settings pages, or multipart forms in Wangs UI applications.
9
-
10
- ---
11
-
12
- ## 1. MCP Protocol & Component Rules (Mandatory Single Source of Truth)
13
-
14
- Do **NOT** hardcode or guess prop names, component options, preset variations, or Storybook patterns in this document. Always retrieve component definitions, active props, and live Storybook implementations directly via MCP:
15
-
16
- ### Component & Form Documentation Protocol:
17
-
18
- ```json
19
- get-documentation({ "id": "form" })
20
- get-documentation({ "id": "field" })
21
- get-documentation({ "id": "dialogform" })
22
- get-documentation({ "id": "input" })
23
- get-documentation({ "id": "numberinput" })
24
- get-documentation({ "id": "select" })
25
- get-documentation({ "id": "multiselect" })
26
- get-documentation({ "id": "datepicker" })
27
- get-documentation({ "id": "fileupload" })
28
- ```
29
-
30
- ### Live Storybook & Interactive Behavior Protocol:
31
-
32
- ```json
33
- get-documentation-for-story({ "id": "form", "storyName": "Default" })
34
- get-documentation-for-story({ "id": "form", "storyName": "AsyncInitialValues" })
35
- get-documentation-for-story({ "id": "form", "storyName": "ConditionalFields" })
36
- get-documentation-for-story({ "id": "form", "storyName": "CascadingOptions" })
37
- get-documentation-for-story({ "id": "dialogform", "storyName": "Default" })
38
- ```
39
-
40
- ### Knowledge Graph & Symbol Usages:
41
-
42
- ```json
43
- query_graph({ "query": "useForm" })
44
- query_graph({ "query": "useDialogForm" })
45
- query_graph({ "query": "useWatchField" })
46
- ```
47
-
48
- ---
49
-
50
- ## 2. Core Form Concepts & Lifecycle Mechanics
51
-
52
- ### A. Strongly Typed Form Instance (`useForm<TForm>()`)
53
-
54
- `useForm<TForm>()` instantiates a `FormControl` natively bound to model type `TForm`.
55
-
56
- - `Field`: `name` is strictly typed to `Path<TForm>` dot-paths.
57
- - `useWatchField`: `name` is strictly typed to `Path<TForm>`.
58
- - `control`: Provides `setInitialValues`, `setValues`, `setFieldError`, `setErrors`, and `reset`.
59
-
60
- ### B. Dynamic Initial Values & Baseline Reset (`setInitialValues` vs `setValues`)
61
-
62
- 1. **Async Initial Values (`control.setInitialValues(values)`)**:
63
- - Accepts a `Partial<TForm>` JSON object (e.g. fetched from an API).
64
- - Establishes an **immutable baseline** for registered fields. Once set for a field path, subsequent calls to `setInitialValues` for that path are ignored.
65
- 2. **Batch Value Updates (`control.setValues(values)`)**:
66
- - Accepts a `Partial<TForm>` JSON object to update current input values without altering the initial baseline.
67
- 3. **Reset Behavior (`control.reset()`)**:
68
- - Restores all fields back to their registered initial baseline values (set via `setInitialValues` or field `initialValue`) and clears all field-level validation errors.
69
-
70
- ### C. Primitive Component Integration Architecture
71
-
72
- `Field` serves as the form integration wrapper for primitive UI input components (`Input`, `Select`, `MultiSelect`, `DatePicker`, `NumberInput`, `FileUpload`, `Calendar`, etc.):
73
-
74
- - **Children Render Callback**: `Field` yields `{ fieldProps, fieldState }`.
75
- - **`fieldProps`**: Pass directly to primitive inputs (`<Input {...fieldProps} />`). Contains `name`, `value`, `ref`, `onChange`.
76
- - **`fieldState`**: Provides `invalid`, `error`, `isDirty`, `isPending`. Pass `invalid={fieldState.invalid}` to primitive components for accessibility and validation styling.
77
-
78
- ---
79
-
80
- ## 3. High-Level Form Architecture & Usage Patterns
81
-
82
- ### Pattern 1: Page Forms (`useForm<T>()`)
83
-
84
- ```tsx
85
- import Button from '@wangs-ui/react-core/primitive/button';
86
- import { useForm } from '@wangs-ui/react-core/primitive/form';
87
- import Input from '@wangs-ui/react-core/primitive/input';
88
- import { useI18n } from '@wangs-ui/react-i18n';
89
- import { useEffect } from 'react';
90
-
91
- interface UserProfile {
92
- name: string;
93
- email: string;
94
- }
95
-
96
- export function UserProfilePage({ userId }: { userId: string }) {
97
- const { t } = useI18n();
98
- const { Form, Field, control } = useForm<UserProfile>();
99
-
100
- useEffect(() => {
101
- async function loadData() {
102
- const data = await fetchUserData(userId);
103
- // Establish immutable initial baseline from async response
104
- control.setInitialValues(data);
105
- }
106
- loadData();
107
- }, [userId, control]);
108
-
109
- return (
110
- <Form control={control} onSubmit={(values) => saveUserData(values)}>
111
- <Field required label={t('Full Name')} name="name">
112
- {({ fieldProps, fieldState }) => (
113
- <Input {...fieldProps} invalid={fieldState.invalid} placeholder={t('Enter full name')} />
114
- )}
115
- </Field>
116
-
117
- <div className="flex gap-2">
118
- <Button
119
- label={t('Reset')}
120
- type="button"
121
- variant="outlined"
122
- onClick={() => control.reset()}
123
- />
124
- <Button label={t('Save')} type="submit" />
125
- </div>
126
- </Form>
127
- );
128
- }
129
- ```
130
-
131
- ### Pattern 2: Modal Forms (`useDialogForm<T>()`)
132
-
133
- ```tsx
134
- import Button from '@wangs-ui/react-core/primitive/button';
135
- import { useDialogForm } from '@wangs-ui/react-core/primitive/dialogform';
136
- import Input from '@wangs-ui/react-core/primitive/input';
137
- import { useI18n } from '@wangs-ui/react-i18n';
138
- import { useState } from 'react';
139
-
140
- interface EditUserForm {
141
- name: string;
142
- }
143
-
144
- export function EditUserModal() {
145
- const { t } = useI18n();
146
- const [open, setOpen] = useState(false);
147
- const { DialogForm, Field, control } = useDialogForm<EditUserForm>();
148
-
149
- return (
150
- <>
151
- <Button label={t('Edit')} onClick={() => setOpen(true)} />
152
- <DialogForm
153
- closeOnSubmit
154
- control={control}
155
- header={t('Edit User')}
156
- open={open}
157
- onOpenChange={setOpen}
158
- onSubmit={(values) => handleSave(values)}
159
- >
160
- <Field required label={t('Full Name')} name="name">
161
- {({ fieldProps, fieldState }) => <Input {...fieldProps} invalid={fieldState.invalid} />}
162
- </Field>
163
- </DialogForm>
164
- </>
165
- );
166
- }
167
- ```
168
-
169
- ---
170
-
171
- ## 4. Mandatory Implementation Guidelines
172
-
173
- 1. **Query MCP First**: Never guess component props or story examples — inspect via MCP tools.
174
- 2. **Granular Primitive Subpaths**: Import primitives via exact subpath modules (`@wangs-ui/react-core/primitive/form`, `@wangs-ui/react-core/primitive/dialogform`, `@wangs-ui/react-core/primitive/input`).
175
- 3. **i18n Localization**: Wrap all user-visible labels, placeholders, and error strings in `t('...')` from `@wangs-ui/react-i18n`.
176
- 4. **Server Error Mapping**: Map HTTP validation errors (e.g. 422 response) into the form using `control.setErrors(apiErrors)`.
1
+ ---
2
+ name: create-form
3
+ description: Form architecture, validation workflows, strongly-typed forms (useForm, useDialogForm, useWatchField), initialValues/reset lifecycle, and MCP discovery protocol for building forms and input controls with @wangs-ui/react-core.
4
+ ---
5
+
6
+ # Skill: Form Architecture & Validation Workflows
7
+
8
+ Use this skill when building forms, data entry panels, modal forms, settings pages, or multipart forms in Wangs UI applications.
9
+
10
+ ---
11
+
12
+ ## 1. MCP Protocol & Component Rules (Mandatory Single Source of Truth)
13
+
14
+ Do **NOT** hardcode or guess prop names, component options, preset variations, or Storybook patterns in this document. Always retrieve component definitions, active props, and live Storybook implementations directly via MCP:
15
+
16
+ ### Component & Form Documentation Protocol:
17
+
18
+ ```json
19
+ get-documentation({ "id": "form" })
20
+ get-documentation({ "id": "field" })
21
+ get-documentation({ "id": "dialogform" })
22
+ get-documentation({ "id": "input" })
23
+ get-documentation({ "id": "numberinput" })
24
+ get-documentation({ "id": "select" })
25
+ get-documentation({ "id": "multiselect" })
26
+ get-documentation({ "id": "datepicker" })
27
+ get-documentation({ "id": "fileupload" })
28
+ ```
29
+
30
+ ### Live Storybook & Interactive Behavior Protocol:
31
+
32
+ ```json
33
+ get-documentation-for-story({ "id": "form", "storyName": "Default" })
34
+ get-documentation-for-story({ "id": "form", "storyName": "AsyncInitialValues" })
35
+ get-documentation-for-story({ "id": "form", "storyName": "ConditionalFields" })
36
+ get-documentation-for-story({ "id": "form", "storyName": "CascadingOptions" })
37
+ get-documentation-for-story({ "id": "dialogform", "storyName": "Default" })
38
+ ```
39
+
40
+ ### Knowledge Graph & Symbol Usages:
41
+
42
+ ```json
43
+ query_graph({ "query": "useForm" })
44
+ query_graph({ "query": "useDialogForm" })
45
+ query_graph({ "query": "useWatchField" })
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 2. Core Form Concepts & Lifecycle Mechanics
51
+
52
+ ### A. Strongly Typed Form Instance (`useForm<TForm>()`)
53
+
54
+ `useForm<TForm>()` instantiates a `FormControl` natively bound to model type `TForm`.
55
+
56
+ - `Field`: `name` is strictly typed to `Path<TForm>` dot-paths.
57
+ - `useWatchField`: `name` is strictly typed to `Path<TForm>`.
58
+ - `control`: Provides `setInitialValues`, `setValues`, `setFieldError`, `setErrors`, and `reset`.
59
+
60
+ ### B. Dynamic Initial Values & Baseline Reset (`setInitialValues` vs `setValues`)
61
+
62
+ 1. **Async Initial Values (`control.setInitialValues(values)`)**:
63
+ - Accepts a `Partial<TForm>` JSON object (e.g. fetched from an API).
64
+ - Establishes an **immutable baseline** for registered fields. Once set for a field path, subsequent calls to `setInitialValues` for that path are ignored.
65
+ 2. **Batch Value Updates (`control.setValues(values)`)**:
66
+ - Accepts a `Partial<TForm>` JSON object to update current input values without altering the initial baseline.
67
+ 3. **Reset Behavior (`control.reset()`)**:
68
+ - Restores all fields back to their registered initial baseline values (set via `setInitialValues` or field `initialValue`) and clears all field-level validation errors.
69
+
70
+ ### C. Primitive Component Integration Architecture
71
+
72
+ `Field` serves as the form integration wrapper for primitive UI input components (`Input`, `Select`, `MultiSelect`, `DatePicker`, `NumberInput`, `FileUpload`, `Calendar`, etc.):
73
+
74
+ - **Children Render Callback**: `Field` yields `{ fieldProps, fieldState }`.
75
+ - **`fieldProps`**: Pass directly to primitive inputs (`<Input {...fieldProps} />`). Contains `name`, `value`, `ref`, `onChange`.
76
+ - **`fieldState`**: Provides `invalid`, `error`, `isDirty`, `isPending`. Pass `invalid={fieldState.invalid}` to primitive components for accessibility and validation styling.
77
+
78
+ ---
79
+
80
+ ## 3. High-Level Form Architecture & Usage Patterns
81
+
82
+ ### Pattern 1: Page Forms (`useForm<T>()`)
83
+
84
+ ```tsx
85
+ import Button from '@wangs-ui/react-core/primitive/button';
86
+ import { useForm } from '@wangs-ui/react-core/primitive/form';
87
+ import Input from '@wangs-ui/react-core/primitive/input';
88
+ import { useI18n } from '@wangs-ui/react-i18n';
89
+ import { useEffect } from 'react';
90
+
91
+ interface UserProfile {
92
+ name: string;
93
+ email: string;
94
+ }
95
+
96
+ export function UserProfilePage({ userId }: { userId: string }) {
97
+ const { t } = useI18n();
98
+ const { Form, Field, control } = useForm<UserProfile>();
99
+
100
+ useEffect(() => {
101
+ async function loadData() {
102
+ const data = await fetchUserData(userId);
103
+ // Establish immutable initial baseline from async response
104
+ control.setInitialValues(data);
105
+ }
106
+ loadData();
107
+ }, [userId, control]);
108
+
109
+ return (
110
+ <Form control={control} onSubmit={(values) => saveUserData(values)}>
111
+ <Field required label={t('Full Name')} name="name">
112
+ {({ fieldProps, fieldState }) => (
113
+ <Input {...fieldProps} invalid={fieldState.invalid} placeholder={t('Enter full name')} />
114
+ )}
115
+ </Field>
116
+
117
+ <div className="flex gap-2">
118
+ <Button
119
+ label={t('Reset')}
120
+ type="button"
121
+ variant="outlined"
122
+ onClick={() => control.reset()}
123
+ />
124
+ <Button label={t('Save')} type="submit" />
125
+ </div>
126
+ </Form>
127
+ );
128
+ }
129
+ ```
130
+
131
+ ### Pattern 2: Modal Forms (`useDialogForm<T>()`)
132
+
133
+ ```tsx
134
+ import Button from '@wangs-ui/react-core/primitive/button';
135
+ import { useDialogForm } from '@wangs-ui/react-core/primitive/dialogform';
136
+ import Input from '@wangs-ui/react-core/primitive/input';
137
+ import { useI18n } from '@wangs-ui/react-i18n';
138
+ import { useState } from 'react';
139
+
140
+ interface EditUserForm {
141
+ name: string;
142
+ }
143
+
144
+ export function EditUserModal() {
145
+ const { t } = useI18n();
146
+ const [open, setOpen] = useState(false);
147
+ const { DialogForm, Field, control } = useDialogForm<EditUserForm>();
148
+
149
+ return (
150
+ <>
151
+ <Button label={t('Edit')} onClick={() => setOpen(true)} />
152
+ <DialogForm
153
+ closeOnSubmit
154
+ control={control}
155
+ header={t('Edit User')}
156
+ open={open}
157
+ onOpenChange={setOpen}
158
+ onSubmit={(values) => handleSave(values)}
159
+ >
160
+ <Field required label={t('Full Name')} name="name">
161
+ {({ fieldProps, fieldState }) => <Input {...fieldProps} invalid={fieldState.invalid} />}
162
+ </Field>
163
+ </DialogForm>
164
+ </>
165
+ );
166
+ }
167
+ ```
168
+
169
+ ---
170
+
171
+ ## 4. Mandatory Implementation Guidelines
172
+
173
+ 1. **Query MCP First**: Never guess component props or story examples — inspect via MCP tools.
174
+ 2. **Granular Primitive Subpaths**: Import primitives via exact subpath modules (`@wangs-ui/react-core/primitive/form`, `@wangs-ui/react-core/primitive/dialogform`, `@wangs-ui/react-core/primitive/input`).
175
+ 3. **i18n Localization**: Wrap all user-visible labels, placeholders, and error strings in `t('...')` from `@wangs-ui/react-i18n`.
176
+ 4. **Server Error Mapping**: Map HTTP validation errors (e.g. 422 response) into the form using `control.setErrors(apiErrors)`.
@@ -1,68 +1,68 @@
1
- ---
2
- name: data-table
3
- description: Architecture, workflows, and MCP discovery protocol for building DataTables with sorting, pagination, filtering, selection, and export.
4
- ---
5
-
6
- # Skill: DataTable Architecture & Integration Workflows
7
-
8
- Use this skill when implementing data grids, server-paginated tables, filterable listing views, or batch management interfaces with `@wangs-ui/react-core`.
9
-
10
- ---
11
-
12
- ## 1. MCP Inspection Protocol (Mandatory Single Source of Truth)
13
-
14
- Do **NOT** guess table prop names or hardcode table structures. Query the MCP server dynamically to inspect exact TypeScript signatures, live story implementations, and companion controls:
15
-
16
- ### Inspect Component Contracts:
17
-
18
- ```json
19
- get-documentation({ "id": "datatable" })
20
- get-documentation({ "id": "exportbutton" })
21
- get-documentation({ "id": "filtercontainer" })
22
- get-documentation({ "id": "bulkactionbutton" })
23
- ```
24
-
25
- ### Inspect Live Story Implementations:
26
-
27
- ```json
28
- get-documentation-for-story({ "id": "datatable", "storyName": "Basic" })
29
- get-documentation-for-story({ "id": "datatable", "storyName": "ServerPagination" })
30
- get-documentation-for-story({ "id": "datatable", "storyName": "Sortable" })
31
- get-documentation-for-story({ "id": "datatable", "storyName": "MultipleSelection" })
32
- get-documentation-for-story({ "id": "datatable", "storyName": "CustomColumn" })
33
- get-documentation-for-story({ "id": "exportbutton", "storyName": "WithTable" })
34
- ```
35
-
36
- ### Inspect Knowledge Graph & Usages:
37
-
38
- ```json
39
- query_graph({ "query": "DataTable" })
40
- query_graph({ "query": "useDataTableFetch" })
41
- ```
42
-
43
- ---
44
-
45
- ## 2. Core Architecture & Mental Model
46
-
47
- The Wangs UI `DataTable` is built on a modular, headless-first architecture:
48
-
49
- 1. **Declarative Column Definitions (`TableColumn<T>[]`)**:
50
- Columns are configured as typed array objects, not as JSX children. Check `get-documentation({ "id": "datatable" })` for column field types.
51
- 2. **Table Instance Hook (`useDataTable`)**:
52
- Coordinates table state (sorting, pagination, selection, column ordering, pinning, visibility).
53
- 3. **Data Fetching Hook (`useDataTableFetch`)**:
54
- Feeds server-side data, handles loading indicators, manages query parameters (`search`, `filter`, `sort`, `page`, `limit`), and debounces requests automatically.
55
- 4. **Ecosystem Companions**:
56
- - `FilterContainer` & `FilterToggleButton`: Filter popovers and faceted search.
57
- - `ExportButton`: Client/server export to Excel, CSV, PDF, or Print.
58
- - `BulkActionButton`: Contextual batch actions triggered when rows are selected.
59
- - `CustomColumn`: User-controlled column ordering, visibility toggling, and pinning.
60
-
61
- ---
62
-
63
- ## 3. Mandatory Implementation Rules
64
-
65
- 1. **Query MCP for Current Code Patterns**: Always run `get-documentation-for-story` for `datatable` before drafting code.
66
- 2. **Strict Subpath Imports**: Import via `@wangs-ui/react-core/primitive/datatable` and companion primitive paths.
67
- 3. **Always Translate Visible Copy**: All column header labels, empty state messages, and action button labels must be wrapped in `t('...')` from `@wangs-ui/react-i18n`.
68
- 4. **Stable Row Identity**: Always configure a unique key identifier for stable selection and row identity.
1
+ ---
2
+ name: data-table
3
+ description: Architecture, workflows, and MCP discovery protocol for building DataTables with sorting, pagination, filtering, selection, and export.
4
+ ---
5
+
6
+ # Skill: DataTable Architecture & Integration Workflows
7
+
8
+ Use this skill when implementing data grids, server-paginated tables, filterable listing views, or batch management interfaces with `@wangs-ui/react-core`.
9
+
10
+ ---
11
+
12
+ ## 1. MCP Inspection Protocol (Mandatory Single Source of Truth)
13
+
14
+ Do **NOT** guess table prop names or hardcode table structures. Query the MCP server dynamically to inspect exact TypeScript signatures, live story implementations, and companion controls:
15
+
16
+ ### Inspect Component Contracts:
17
+
18
+ ```json
19
+ get-documentation({ "id": "datatable" })
20
+ get-documentation({ "id": "exportbutton" })
21
+ get-documentation({ "id": "filtercontainer" })
22
+ get-documentation({ "id": "bulkactionbutton" })
23
+ ```
24
+
25
+ ### Inspect Live Story Implementations:
26
+
27
+ ```json
28
+ get-documentation-for-story({ "id": "datatable", "storyName": "Basic" })
29
+ get-documentation-for-story({ "id": "datatable", "storyName": "ServerPagination" })
30
+ get-documentation-for-story({ "id": "datatable", "storyName": "Sortable" })
31
+ get-documentation-for-story({ "id": "datatable", "storyName": "MultipleSelection" })
32
+ get-documentation-for-story({ "id": "datatable", "storyName": "CustomColumn" })
33
+ get-documentation-for-story({ "id": "exportbutton", "storyName": "WithTable" })
34
+ ```
35
+
36
+ ### Inspect Knowledge Graph & Usages:
37
+
38
+ ```json
39
+ query_graph({ "query": "DataTable" })
40
+ query_graph({ "query": "useDataTableFetch" })
41
+ ```
42
+
43
+ ---
44
+
45
+ ## 2. Core Architecture & Mental Model
46
+
47
+ The Wangs UI `DataTable` is built on a modular, headless-first architecture:
48
+
49
+ 1. **Declarative Column Definitions (`TableColumn<T>[]`)**:
50
+ Columns are configured as typed array objects, not as JSX children. Check `get-documentation({ "id": "datatable" })` for column field types.
51
+ 2. **Table Instance Hook (`useDataTable`)**:
52
+ Coordinates table state (sorting, pagination, selection, column ordering, pinning, visibility).
53
+ 3. **Data Fetching Hook (`useDataTableFetch`)**:
54
+ Feeds server-side data, handles loading indicators, manages query parameters (`search`, `filter`, `sort`, `page`, `limit`), and debounces requests automatically.
55
+ 4. **Ecosystem Companions**:
56
+ - `FilterContainer` & `FilterToggleButton`: Filter popovers and faceted search.
57
+ - `ExportButton`: Client/server export to Excel, CSV, PDF, or Print.
58
+ - `BulkActionButton`: Contextual batch actions triggered when rows are selected.
59
+ - `CustomColumn`: User-controlled column ordering, visibility toggling, and pinning.
60
+
61
+ ---
62
+
63
+ ## 3. Mandatory Implementation Rules
64
+
65
+ 1. **Query MCP for Current Code Patterns**: Always run `get-documentation-for-story` for `datatable` before drafting code.
66
+ 2. **Strict Subpath Imports**: Import via `@wangs-ui/react-core/primitive/datatable` and companion primitive paths.
67
+ 3. **Always Translate Visible Copy**: All column header labels, empty state messages, and action button labels must be wrapped in `t('...')` from `@wangs-ui/react-i18n`.
68
+ 4. **Stable Row Identity**: Always configure a unique key identifier for stable selection and row identity.
@@ -1,58 +1,58 @@
1
- ---
2
- name: dialog-modal
3
- description: Patterns, overlay selection criteria, and MCP discovery protocol for Dialog, Modal, and DialogForm components in Wangs UI.
4
- ---
5
-
6
- # Skill: Dialog, Modal & Overlay Workflows
7
-
8
- Use this skill when building interactive modals, create/edit dialog forms, destructive action confirmations, or slide-in overlay panels.
9
-
10
- ---
11
-
12
- ## 1. MCP Inspection Protocol (Mandatory Single Source of Truth)
13
-
14
- Do **NOT** guess overlay props, event names, or footer slots. Query the MCP server dynamically to inspect exact contracts and live story implementations:
15
-
16
- ### Inspect Overlay Contracts:
17
-
18
- ```json
19
- get-documentation({ "id": "dialog" })
20
- get-documentation({ "id": "dialogform" })
21
- get-documentation({ "id": "modal" })
22
- get-documentation({ "id": "toast" })
23
- ```
24
-
25
- ### Inspect Live Story Implementations:
26
-
27
- ```json
28
- get-documentation-for-story({ "id": "dialog", "storyName": "Confirmation" })
29
- get-documentation-for-story({ "id": "dialogform", "storyName": "Default" })
30
- get-documentation-for-story({ "id": "modal", "storyName": "Default" })
31
- ```
32
-
33
- ### Inspect Knowledge Graph & Usages:
34
-
35
- ```json
36
- query_graph({ "query": "Dialog" })
37
- query_graph({ "query": "DialogForm" })
38
- ```
39
-
40
- ---
41
-
42
- ## 2. Overlay Selection Matrix
43
-
44
- | Component | Primary Use Case | Key Characteristics |
45
- | :--------------- | :-------------------------------------------- | :------------------------------------------------------------------------------------ |
46
- | **`Dialog`** | Confirmations, alerts, simple detail previews | Standard `header`, `footer`, and body layout; built-in backdrop dimming. |
47
- | **`DialogForm`** | Create/Edit forms embedded inside a dialog | Built-in form submit/cancel action bar, dirty state tracking, and submit lifecycle. |
48
- | **`Modal`** | Slide-in drawers, complex custom viewports | Headless overlay primitive with flexible animations, size variants, and drawer modes. |
49
-
50
- ---
51
-
52
- ## 3. Mandatory Implementation Rules
53
-
54
- 1. **Query MCP for Current Code Patterns**: Always inspect `dialog`, `dialogform`, or `modal` stories via MCP before writing overlay code.
55
- 2. **Strict Subpath Imports**: Import via `@wangs-ui/react-core/primitive/dialog`, `@wangs-ui/react-core/primitive/dialogform`, `@wangs-ui/react-core/primitive/modal`, or `@wangs-ui/react-core/primitive/toast`.
56
- 3. **Prevent Dismissal During Async Mutations**: Guard the close handler so users cannot accidentally dismiss the dialog while a mutation request is in-flight.
57
- 4. **Coordinate with Toast Notifications**: Trigger feedback toasts on successful creation, update, or deletion actions.
58
- 5. **Translate All Overlay Copy**: All dialog titles, confirmation descriptions, and button labels must be localized using `t('...')` from `@wangs-ui/react-i18n`.
1
+ ---
2
+ name: dialog-modal
3
+ description: Patterns, overlay selection criteria, and MCP discovery protocol for Dialog, Modal, and DialogForm components in Wangs UI.
4
+ ---
5
+
6
+ # Skill: Dialog, Modal & Overlay Workflows
7
+
8
+ Use this skill when building interactive modals, create/edit dialog forms, destructive action confirmations, or slide-in overlay panels.
9
+
10
+ ---
11
+
12
+ ## 1. MCP Inspection Protocol (Mandatory Single Source of Truth)
13
+
14
+ Do **NOT** guess overlay props, event names, or footer slots. Query the MCP server dynamically to inspect exact contracts and live story implementations:
15
+
16
+ ### Inspect Overlay Contracts:
17
+
18
+ ```json
19
+ get-documentation({ "id": "dialog" })
20
+ get-documentation({ "id": "dialogform" })
21
+ get-documentation({ "id": "modal" })
22
+ get-documentation({ "id": "toast" })
23
+ ```
24
+
25
+ ### Inspect Live Story Implementations:
26
+
27
+ ```json
28
+ get-documentation-for-story({ "id": "dialog", "storyName": "Confirmation" })
29
+ get-documentation-for-story({ "id": "dialogform", "storyName": "Default" })
30
+ get-documentation-for-story({ "id": "modal", "storyName": "Default" })
31
+ ```
32
+
33
+ ### Inspect Knowledge Graph & Usages:
34
+
35
+ ```json
36
+ query_graph({ "query": "Dialog" })
37
+ query_graph({ "query": "DialogForm" })
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 2. Overlay Selection Matrix
43
+
44
+ | Component | Primary Use Case | Key Characteristics |
45
+ | :--------------- | :-------------------------------------------- | :------------------------------------------------------------------------------------ |
46
+ | **`Dialog`** | Confirmations, alerts, simple detail previews | Standard `header`, `footer`, and body layout; built-in backdrop dimming. |
47
+ | **`DialogForm`** | Create/Edit forms embedded inside a dialog | Built-in form submit/cancel action bar, dirty state tracking, and submit lifecycle. |
48
+ | **`Modal`** | Slide-in drawers, complex custom viewports | Headless overlay primitive with flexible animations, size variants, and drawer modes. |
49
+
50
+ ---
51
+
52
+ ## 3. Mandatory Implementation Rules
53
+
54
+ 1. **Query MCP for Current Code Patterns**: Always inspect `dialog`, `dialogform`, or `modal` stories via MCP before writing overlay code.
55
+ 2. **Strict Subpath Imports**: Import via `@wangs-ui/react-core/primitive/dialog`, `@wangs-ui/react-core/primitive/dialogform`, `@wangs-ui/react-core/primitive/modal`, or `@wangs-ui/react-core/primitive/toast`.
56
+ 3. **Prevent Dismissal During Async Mutations**: Guard the close handler so users cannot accidentally dismiss the dialog while a mutation request is in-flight.
57
+ 4. **Coordinate with Toast Notifications**: Trigger feedback toasts on successful creation, update, or deletion actions.
58
+ 5. **Translate All Overlay Copy**: All dialog titles, confirmation descriptions, and button labels must be localized using `t('...')` from `@wangs-ui/react-i18n`.