@wangs-ui/skills 1.1.3 → 1.1.5

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/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # @wangs-ui/skills
2
+
3
+ Modular AI agent skills installer and manager for **Wangs UI** React components and design patterns.
4
+
5
+ ---
6
+
7
+ ## 📚 Dedicated Storybook Guide
8
+
9
+ For a step-by-step guide on using `@wangs-ui/skills` independently with any Storybook project, see the [Dedicated Storybook Guide](../../docs/storybook-mcp-skills.md).
10
+
11
+ ---
12
+
13
+ ## ⚡ Quick Start
14
+
15
+ ```bash
16
+ # List available skills
17
+ npx @wangs-ui/skills list
18
+
19
+ # Install skills (opens interactive multiselect menu with skill descriptions)
20
+ npx @wangs-ui/skills add
21
+
22
+ # Install specific skills directly by name
23
+ npx @wangs-ui/skills add wangs-ui-components data-table create-form
24
+
25
+ # Update installed skills
26
+ npx @wangs-ui/skills update
27
+
28
+ # Remove a skill
29
+ npx @wangs-ui/skills remove create-form
30
+ ```
31
+
32
+ ---
33
+
34
+ ## 🛠️ Features
35
+
36
+ - **Modular UI Skills**: Installs specialized guidelines, component patterns, and rules into your AI agent environment.
37
+ - **Cross-Platform & Multi-Agent**: Supports Antigravity IDE, Claude Code, OpenCode, Kilo, and universal agent directories on Mac and Windows.
38
+ - **Independent Usage**: Works in any Storybook or React project without requiring project scaffolding tools.
package/dist/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as listSkills, n as updateSkills, r as addSkills, t as removeSkills } from "./src-BDMQAPi_.js";
2
+ import { i as listSkills, n as updateSkills, r as addSkills, t as removeSkills } from "./src-Cj_dOFcm.js";
3
3
  import path from "node:path";
4
4
  import { parseArgs } from "node:util";
5
5
  //#region bin.ts
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as getAgentSkillDirs, c as isSkillInstalled, d as loadAllSkills, i as listSkills, l as removeSkill, n as updateSkills, o as getInstalledSkills, r as addSkills, s as installSkill, t as removeSkills, u as getSkill } from "./src-BDMQAPi_.js";
1
+ import { a as getAgentSkillDirs, c as isSkillInstalled, d as loadAllSkills, i as listSkills, l as removeSkill, n as updateSkills, o as getInstalledSkills, r as addSkills, s as installSkill, t as removeSkills, u as getSkill } from "./src-Cj_dOFcm.js";
2
2
  export { addSkills, getAgentSkillDirs, getInstalledSkills, getSkill, installSkill, isSkillInstalled, listSkills, loadAllSkills, removeSkill, removeSkills, updateSkills };
@@ -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.