@nexus-cross/design-system 1.0.13 → 1.1.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/claude-rules/nexus/CLAUDE.md +85 -0
- package/claude-rules/nexus/commands/nexus-audit.md +79 -0
- package/claude-rules/nexus/commands/nexus-component-map.md +85 -0
- package/claude-rules/nexus/commands/nexus-token-check.md +68 -0
- package/claude-rules/nexus/skills/nexus-design-system/SKILL.md +92 -0
- package/cursor-rules/nexus-ui-api.mdc +824 -41
- package/cursor-rules/nexus-ui-decisions.mdc +259 -0
- package/dist/accordion.js +0 -1
- package/dist/accordion.mjs +0 -1
- package/dist/alert.js +0 -1
- package/dist/alert.mjs +0 -1
- package/dist/avatar.js +0 -1
- package/dist/avatar.mjs +0 -1
- package/dist/badge.js +0 -1
- package/dist/badge.mjs +0 -1
- package/dist/breadcrumb.js +0 -1
- package/dist/breadcrumb.mjs +0 -1
- package/dist/button.js +0 -1
- package/dist/button.mjs +0 -1
- package/dist/carousel.js +0 -1
- package/dist/carousel.mjs +0 -1
- package/dist/checkbox.js +0 -1
- package/dist/checkbox.mjs +0 -1
- package/dist/chip.js +0 -1
- package/dist/chip.mjs +0 -1
- package/dist/chunks/chunk-2Z52NPWB.js +78 -0
- package/dist/chunks/chunk-46P52MFM.mjs +56 -0
- package/dist/chunks/{chunk-X3CTJ7TD.js → chunk-4KBFVIKX.js} +41 -11
- package/dist/chunks/chunk-56ZOOQFE.mjs +514 -0
- package/dist/chunks/chunk-5ASTWFJW.js +538 -0
- package/dist/chunks/{chunk-33UFQJIO.mjs → chunk-BJMXZJWO.mjs} +16 -5
- package/dist/chunks/chunk-EILXBLEV.mjs +5 -0
- package/dist/chunks/chunk-G3RLK2HS.js +7 -0
- package/dist/chunks/{chunk-YZV6FWE7.js → chunk-JLDQNDFT.js} +16 -5
- package/dist/chunks/{chunk-K574BYHQ.js → chunk-K3CK7NTP.js} +22 -4
- package/dist/chunks/{chunk-Z4YM7LU3.mjs → chunk-PIGHBDK5.mjs} +22 -4
- package/dist/chunks/{chunk-PEIEVKD5.js → chunk-RCIBLLSF.js} +11 -12
- package/dist/chunks/{chunk-MMCA33FW.mjs → chunk-RSFLNWOM.mjs} +41 -11
- package/dist/chunks/{chunk-K2TBLM3F.mjs → chunk-THBE27U3.mjs} +11 -12
- package/dist/client-only.js +0 -1
- package/dist/client-only.mjs +0 -1
- package/dist/combobox.js +16 -0
- package/dist/combobox.mjs +3 -0
- package/dist/components/Combobox.d.ts +48 -0
- package/dist/components/Combobox.d.ts.map +1 -0
- package/dist/components/DataGrid.d.ts +44 -0
- package/dist/components/DataGrid.d.ts.map +1 -0
- package/dist/components/DataList.d.ts +3 -1
- package/dist/components/DataList.d.ts.map +1 -1
- package/dist/components/RadioGroup.d.ts +4 -0
- package/dist/components/RadioGroup.d.ts.map +1 -1
- package/dist/components/Stepper.d.ts.map +1 -1
- package/dist/components/ToggleGroup.d.ts +2 -1
- package/dist/components/ToggleGroup.d.ts.map +1 -1
- package/dist/countdown.js +0 -1
- package/dist/countdown.mjs +0 -1
- package/dist/counter.js +0 -1
- package/dist/counter.mjs +0 -1
- package/dist/data-grid.js +14 -0
- package/dist/data-grid.mjs +5 -0
- package/dist/data-list.js +2 -3
- package/dist/data-list.mjs +1 -2
- package/dist/date-picker.js +0 -1
- package/dist/date-picker.mjs +0 -1
- package/dist/divider.js +0 -1
- package/dist/divider.mjs +0 -1
- package/dist/drawer.js +0 -1
- package/dist/drawer.mjs +0 -1
- package/dist/dropdown-menu.js +0 -1
- package/dist/dropdown-menu.mjs +0 -1
- package/dist/ellipsis.js +0 -1
- package/dist/ellipsis.mjs +0 -1
- package/dist/empty-state.js +0 -1
- package/dist/empty-state.mjs +0 -1
- package/dist/error-boundary.js +0 -1
- package/dist/error-boundary.mjs +0 -1
- package/dist/hooks/useCheckDevice.js +0 -1
- package/dist/hooks/useCheckDevice.mjs +0 -1
- package/dist/hooks/useClickOutside.js +0 -1
- package/dist/hooks/useClickOutside.mjs +0 -1
- package/dist/hooks/useDraggableBottomSheet.js +0 -1
- package/dist/hooks/useDraggableBottomSheet.mjs +0 -1
- package/dist/hooks/useDraggableWindow.js +0 -1
- package/dist/hooks/useDraggableWindow.mjs +0 -1
- package/dist/hooks/useInView.js +0 -1
- package/dist/hooks/useInView.mjs +0 -1
- package/dist/hooks/useModal.js +0 -1
- package/dist/hooks/useModal.mjs +0 -1
- package/dist/image-upload.js +0 -1
- package/dist/image-upload.mjs +0 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -88
- package/dist/index.mjs +12 -12
- package/dist/infinite-scroll.js +0 -1
- package/dist/infinite-scroll.mjs +0 -1
- package/dist/marquee.js +0 -1
- package/dist/marquee.mjs +0 -1
- package/dist/modal/index.js +11 -12
- package/dist/modal/index.mjs +2 -3
- package/dist/number-input.js +0 -1
- package/dist/number-input.mjs +0 -1
- package/dist/nx-image.js +0 -1
- package/dist/nx-image.mjs +0 -1
- package/dist/pagination.js +0 -1
- package/dist/pagination.mjs +0 -1
- package/dist/popover.js +0 -1
- package/dist/popover.mjs +0 -1
- package/dist/price-input.js +0 -1
- package/dist/price-input.mjs +0 -1
- package/dist/progress.js +0 -1
- package/dist/progress.mjs +0 -1
- package/dist/radio-group.js +5 -6
- package/dist/radio-group.mjs +1 -2
- package/dist/schemas/_all.json +308 -117
- package/dist/schemas/accordion.d.ts.map +1 -1
- package/dist/schemas/accordion.json +1 -1
- package/dist/schemas/alert.d.ts.map +1 -1
- package/dist/schemas/alert.json +1 -1
- package/dist/schemas/avatar.d.ts.map +1 -1
- package/dist/schemas/avatar.json +1 -1
- package/dist/schemas/badge.d.ts.map +1 -1
- package/dist/schemas/badge.json +1 -1
- package/dist/schemas/breadcrumb.d.ts.map +1 -1
- package/dist/schemas/breadcrumb.json +1 -1
- package/dist/schemas/button.d.ts.map +1 -1
- package/dist/schemas/button.json +1 -1
- package/dist/schemas/carousel.d.ts.map +1 -1
- package/dist/schemas/carousel.json +1 -1
- package/dist/schemas/checkBox.json +1 -1
- package/dist/schemas/checkbox.d.ts.map +1 -1
- package/dist/schemas/chip.d.ts.map +1 -1
- package/dist/schemas/chip.json +1 -1
- package/dist/schemas/client-only.d.ts.map +1 -1
- package/dist/schemas/clientOnly.json +1 -1
- package/dist/schemas/combobox.d.ts +85 -0
- package/dist/schemas/combobox.d.ts.map +1 -0
- package/dist/schemas/combobox.json +98 -0
- package/dist/schemas/comboboxOption.json +30 -0
- package/dist/schemas/countdown.d.ts.map +1 -1
- package/dist/schemas/countdown.json +1 -1
- package/dist/schemas/counter.d.ts.map +1 -1
- package/dist/schemas/counter.json +1 -1
- package/dist/schemas/data-grid.d.ts +74 -0
- package/dist/schemas/data-grid.d.ts.map +1 -0
- package/dist/schemas/data-list.d.ts.map +1 -1
- package/dist/schemas/dataGrid.json +102 -0
- package/dist/schemas/dataList.json +1 -1
- package/dist/schemas/date-picker.d.ts.map +1 -1
- package/dist/schemas/datePicker.json +1 -1
- package/dist/schemas/divider.d.ts.map +1 -1
- package/dist/schemas/divider.json +1 -1
- package/dist/schemas/drawer.d.ts.map +1 -1
- package/dist/schemas/drawer.json +1 -1
- package/dist/schemas/dropdown-menu.d.ts.map +1 -1
- package/dist/schemas/dropdownMenu.json +1 -1
- package/dist/schemas/ellipsis.d.ts.map +1 -1
- package/dist/schemas/ellipsis.json +1 -1
- package/dist/schemas/empty-state.d.ts.map +1 -1
- package/dist/schemas/emptyState.json +1 -1
- package/dist/schemas/error-boundary.d.ts.map +1 -1
- package/dist/schemas/errorBoundary.json +1 -1
- package/dist/schemas/image-upload.d.ts.map +1 -1
- package/dist/schemas/imageUpload.json +1 -1
- package/dist/schemas/index.d.ts +2 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/infinite-scroll.d.ts.map +1 -1
- package/dist/schemas/infiniteScroll.json +1 -1
- package/dist/schemas/marquee.d.ts.map +1 -1
- package/dist/schemas/marquee.json +1 -1
- package/dist/schemas/modal.d.ts.map +1 -1
- package/dist/schemas/modalTemplate.json +1 -1
- package/dist/schemas/number-input.d.ts.map +1 -1
- package/dist/schemas/numberInput.json +1 -1
- package/dist/schemas/nx-image.d.ts.map +1 -1
- package/dist/schemas/nxImage.json +1 -1
- package/dist/schemas/pagination.d.ts.map +1 -1
- package/dist/schemas/pagination.json +1 -1
- package/dist/schemas/popover.d.ts.map +1 -1
- package/dist/schemas/popover.json +1 -1
- package/dist/schemas/price-input.d.ts.map +1 -1
- package/dist/schemas/priceInput.json +1 -1
- package/dist/schemas/progress.d.ts.map +1 -1
- package/dist/schemas/progress.json +1 -1
- package/dist/schemas/radio-group.d.ts +9 -0
- package/dist/schemas/radio-group.d.ts.map +1 -1
- package/dist/schemas/radioGroup.json +10 -1
- package/dist/schemas/radioItem.json +11 -0
- package/dist/schemas/select.d.ts.map +1 -1
- package/dist/schemas/select.json +1 -1
- package/dist/schemas/skeleton.d.ts.map +1 -1
- package/dist/schemas/skeleton.json +1 -1
- package/dist/schemas/slider.d.ts.map +1 -1
- package/dist/schemas/slider.json +1 -1
- package/dist/schemas/spinner.d.ts.map +1 -1
- package/dist/schemas/spinner.json +1 -1
- package/dist/schemas/stepper.d.ts.map +1 -1
- package/dist/schemas/stepper.json +1 -1
- package/dist/schemas/switch.d.ts.map +1 -1
- package/dist/schemas/switch.json +1 -1
- package/dist/schemas/tab.d.ts.map +1 -1
- package/dist/schemas/tab.json +1 -1
- package/dist/schemas/table.d.ts.map +1 -1
- package/dist/schemas/table.json +1 -1
- package/dist/schemas/tableRow.json +1 -1
- package/dist/schemas/tag-input.d.ts.map +1 -1
- package/dist/schemas/tagInput.json +1 -1
- package/dist/schemas/tdColumn.json +1 -1
- package/dist/schemas/text-area.d.ts.map +1 -1
- package/dist/schemas/text-input.d.ts +2 -2
- package/dist/schemas/text-input.d.ts.map +1 -1
- package/dist/schemas/textArea.json +1 -1
- package/dist/schemas/textInput.json +1 -1
- package/dist/schemas/toast.d.ts.map +1 -1
- package/dist/schemas/toastOptions.json +1 -1
- package/dist/schemas/toaster.json +1 -1
- package/dist/schemas/toggle-group.d.ts +6 -3
- package/dist/schemas/toggle-group.d.ts.map +1 -1
- package/dist/schemas/toggleGroup.json +9 -3
- package/dist/schemas/tooltip.d.ts.map +1 -1
- package/dist/schemas/tooltip.json +1 -1
- package/dist/schemas/virtual-scroll.d.ts.map +1 -1
- package/dist/schemas/virtualGrid.json +1 -1
- package/dist/schemas/virtualList.json +1 -1
- package/dist/schemas.js +867 -66
- package/dist/schemas.mjs +865 -66
- package/dist/select.js +0 -1
- package/dist/select.mjs +0 -1
- package/dist/skeleton.js +0 -1
- package/dist/skeleton.mjs +0 -1
- package/dist/slider.js +0 -1
- package/dist/slider.mjs +0 -1
- package/dist/spinner.js +0 -1
- package/dist/spinner.mjs +0 -1
- package/dist/stepper.js +3 -4
- package/dist/stepper.mjs +1 -2
- package/dist/styles/.generated/built.d.ts +1 -1
- package/dist/styles/.generated/built.d.ts.map +1 -1
- package/dist/styles/layer.js +2 -3
- package/dist/styles/layer.mjs +1 -2
- package/dist/styles.css +554 -51
- package/dist/styles.js +2 -3
- package/dist/styles.layered.css +554 -51
- package/dist/styles.mjs +1 -2
- package/dist/switch.js +0 -1
- package/dist/switch.mjs +0 -1
- package/dist/tab.js +0 -1
- package/dist/tab.mjs +0 -1
- package/dist/table.js +0 -1
- package/dist/table.mjs +0 -1
- package/dist/tag-input.js +0 -1
- package/dist/tag-input.mjs +0 -1
- package/dist/text-area.js +0 -1
- package/dist/text-area.mjs +0 -1
- package/dist/text-input.js +0 -1
- package/dist/text-input.mjs +0 -1
- package/dist/toast.js +0 -1
- package/dist/toast.mjs +0 -1
- package/dist/toggle-group.js +3 -4
- package/dist/toggle-group.mjs +1 -2
- package/dist/tooltip.js +0 -1
- package/dist/tooltip.mjs +0 -1
- package/dist/utils/cn.js +0 -1
- package/dist/utils/cn.mjs +0 -1
- package/dist/utils/scroll.js +0 -1
- package/dist/utils/scroll.mjs +0 -1
- package/dist/virtual-scroll.js +0 -1
- package/dist/virtual-scroll.mjs +0 -1
- package/package.json +14 -8
- package/scripts/setup-cursor-rules.cjs +164 -27
- package/dist/chunks/chunk-22ULI3BF.js +0 -21
- package/dist/chunks/chunk-6ECGMUT6.mjs +0 -5
- package/dist/chunks/chunk-CVYXRSXT.mjs +0 -8
- package/dist/chunks/chunk-I252NERB.mjs +0 -21
- package/dist/chunks/chunk-JNMCYWGY.js +0 -10
- package/dist/chunks/chunk-V35IEPRL.js +0 -7
- package/dist/components/ThemeProvider.d.ts +0 -25
- package/dist/components/ThemeProvider.d.ts.map +0 -1
- package/dist/schemas/theme-provider.d.ts +0 -36
- package/dist/schemas/theme-provider.d.ts.map +0 -1
- package/dist/schemas/themeProvider.json +0 -65
- package/dist/theme-provider.js +0 -15
- package/dist/theme-provider.mjs +0 -2
- package/dist/chunks/{chunk-CWMLTXOH.mjs → chunk-5ZVPTIL3.mjs} +1 -1
- package/dist/chunks/{chunk-HFBTS42N.js → chunk-7F4SOLAC.js} +1 -1
package/dist/schemas.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import './chunks/chunk-CVYXRSXT.mjs';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
|
|
3
|
+
// src/schemas/breadcrumb.ts
|
|
4
4
|
z.object({
|
|
5
5
|
children: z.any().describe("Content to render inside the breadcrumb item (ReactNode). Can be plain text, Link, Select, or any ReactElement."),
|
|
6
6
|
className: z.string().optional().describe("Additional CSS class")
|
|
@@ -11,7 +11,21 @@ var breadcrumbPropsSchema = z.object({
|
|
|
11
11
|
maxItems: z.number().optional().describe('Max visible items. When exceeded, middle items collapse with "\u2026"'),
|
|
12
12
|
className: z.string().optional().describe("Style override for the root nav element")
|
|
13
13
|
}).describe(
|
|
14
|
-
|
|
14
|
+
`Breadcrumb \u2014 hierarchical location navigation (Home > Settings > Profile).
|
|
15
|
+
|
|
16
|
+
WHEN TO USE:
|
|
17
|
+
\u2022 Multi-level information architecture (>=3 levels deep)
|
|
18
|
+
\u2022 Hierarchical category drill-down (file system, taxonomy)
|
|
19
|
+
\u2022 Step-based linear flow \u2192 Stepper (not Breadcrumb)
|
|
20
|
+
\u2022 Tab switching \u2192 Tab
|
|
21
|
+
\u2022 Single-level navigation \u2192 page title alone
|
|
22
|
+
|
|
23
|
+
Compound pattern: use <Breadcrumb.Item> children. Each Item wraps any ReactNode (Link, Select, plain text). Use maxItems for long paths (auto-collapse with "\u2026").
|
|
24
|
+
|
|
25
|
+
ANTI-PATTERNS:
|
|
26
|
+
\u2717 Breadcrumb with 1 level \u2014 just show page title
|
|
27
|
+
\u2717 Breadcrumb with > 6 visible items \u2192 set maxItems
|
|
28
|
+
\u2717 Last item as a link (it's the current page; should be plain text)`
|
|
15
29
|
);
|
|
16
30
|
var buttonPropsSchema = z.object({
|
|
17
31
|
semantic: z.enum(["primary", "secondary", "normal", "danger"]).default("primary").describe(
|
|
@@ -31,7 +45,17 @@ var buttonPropsSchema = z.object({
|
|
|
31
45
|
style: z.any().optional().describe("Inline style (CSSProperties)"),
|
|
32
46
|
className: z.string().optional().describe("Style override")
|
|
33
47
|
}).describe(
|
|
34
|
-
|
|
48
|
+
`Interactive button (always prefer over native <button>).
|
|
49
|
+
|
|
50
|
+
WHEN TO USE: any clickable action \u2014 submit, navigate (with asChild), open modal, trigger menu.
|
|
51
|
+
2-axis: semantic (color intent) \xD7 variant (visual weight). Use semantic="primary" for the page's main CTA, "danger" for destructive actions, "secondary" for sub actions, "normal" for neutral.
|
|
52
|
+
|
|
53
|
+
ANTI-PATTERNS:
|
|
54
|
+
\u2717 <button className="bg-blue-500"> \u2192 <Button semantic="primary">
|
|
55
|
+
\u2717 <a className="..."> styled as button \u2192 <Button asChild><a href="..."/></Button>
|
|
56
|
+
\u2717 Mixing variants randomly within one row \u2014 pick one per visual hierarchy level
|
|
57
|
+
\u2717 Using primary + contained for every button \u2192 only ONE primary CTA per view
|
|
58
|
+
\u2717 <Button className="!bg-red-500"> \u2192 <Button semantic="danger"> (no !important)`
|
|
35
59
|
);
|
|
36
60
|
var textInputPropsSchema = z.object({
|
|
37
61
|
size: z.enum(["md", "lg", "xl"]).default("md").describe("Size"),
|
|
@@ -58,7 +82,20 @@ var textInputPropsSchema = z.object({
|
|
|
58
82
|
onBlur: z.any().optional().describe("Blur callback"),
|
|
59
83
|
onFocus: z.any().optional().describe("Focus callback"),
|
|
60
84
|
className: z.string().optional().describe("Style override")
|
|
61
|
-
}).describe(
|
|
85
|
+
}).describe(
|
|
86
|
+
`Single-line text input (always prefer over native <input type="text">).
|
|
87
|
+
|
|
88
|
+
WHEN TO USE: any short text \u2014 name, email, search, URL, password.
|
|
89
|
+
Use the built-in label/description props instead of wrapping with your own <label>/<p> tags (auto-binds htmlFor/aria-describedby for accessibility).
|
|
90
|
+
For numeric input use NumberInput; for currency PriceInput; for long text TextArea; for date DatePicker.
|
|
91
|
+
|
|
92
|
+
ANTI-PATTERNS:
|
|
93
|
+
\u2717 <TextInput type="number"> \u2192 <NumberInput> (gives unit, step, \u2191\u2193 keys)
|
|
94
|
+
\u2717 <label>Email <input ...></label> + <p>helper</p> \u2192 <TextInput label="Email" description="helper">
|
|
95
|
+
\u2717 Custom red border for error \u2192 use error prop (auto aria-invalid + token color)
|
|
96
|
+
\u2717 Manual character counter \u2192 use showCount + maxLength
|
|
97
|
+
\u2717 Manual clear X button \u2192 use clearable prop`
|
|
98
|
+
);
|
|
62
99
|
var textAreaPropsSchema = z.object({
|
|
63
100
|
label: z.string().optional().describe("Label text above the textarea"),
|
|
64
101
|
description: z.string().optional().describe("Helper/error description below the textarea"),
|
|
@@ -81,7 +118,21 @@ var textAreaPropsSchema = z.object({
|
|
|
81
118
|
onBlur: z.any().optional().describe("Blur callback"),
|
|
82
119
|
onFocus: z.any().optional().describe("Focus callback"),
|
|
83
120
|
className: z.string().optional().describe("Style override")
|
|
84
|
-
}).describe(
|
|
121
|
+
}).describe(
|
|
122
|
+
`Multi-line text input. Always prefer over native <textarea>.
|
|
123
|
+
|
|
124
|
+
WHEN TO USE:
|
|
125
|
+
\u2022 Long-form text \u2014 comments, descriptions, memos, bios
|
|
126
|
+
\u2022 Single-line input \u2192 TextInput
|
|
127
|
+
\u2022 Numeric \u2192 NumberInput
|
|
128
|
+
|
|
129
|
+
resize="auto" auto-grows with content (great for chat input). resize="none" locks size for fixed UI.
|
|
130
|
+
|
|
131
|
+
ANTI-PATTERNS:
|
|
132
|
+
\u2717 Native <textarea> + custom counter \u2192 showCount + maxLength
|
|
133
|
+
\u2717 <TextArea> for short labels \u2014 use TextInput (smaller affordance)
|
|
134
|
+
\u2717 Wrapping with custom <label>/<p> \u2192 use built-in label/description props (auto a11y binding)`
|
|
135
|
+
);
|
|
85
136
|
var selectPropsSchema = z.object({
|
|
86
137
|
value: z.string().optional().describe("Selected value"),
|
|
87
138
|
placeholder: z.string().optional().describe("Placeholder"),
|
|
@@ -93,13 +144,75 @@ var selectPropsSchema = z.object({
|
|
|
93
144
|
children: z.any().describe("SelectItem list (ReactNode, required)"),
|
|
94
145
|
className: z.string().optional().describe("Wrapper style"),
|
|
95
146
|
triggerClassName: z.string().optional().describe("Trigger style override")
|
|
96
|
-
}).describe(
|
|
147
|
+
}).describe(
|
|
148
|
+
`Dropdown select for short option lists. Based on Radix Select. Used with SelectItem.
|
|
149
|
+
|
|
150
|
+
WHEN TO USE:
|
|
151
|
+
\u2022 Options \u2264 7, no search needed \u2192 Select
|
|
152
|
+
\u2022 Options \u2265 7 OR search needed OR async \u2192 Combobox instead
|
|
153
|
+
\u2022 Need multi-select \u2192 Combobox (multiple)
|
|
154
|
+
\u2022 Action menu (save/delete/share) \u2192 DropdownMenu (not Select; values vs actions)
|
|
155
|
+
|
|
156
|
+
ANTI-PATTERNS:
|
|
157
|
+
\u2717 Select with 20+ options \u2192 Combobox
|
|
158
|
+
\u2717 Using Select for menu items that trigger functions \u2192 DropdownMenu
|
|
159
|
+
\u2717 Manual <select> styling \u2192 Select gives consistent token styling
|
|
160
|
+
\u2717 Wrapping each SelectItem with Tooltip \u2014 instead put hint in item label`
|
|
161
|
+
);
|
|
97
162
|
var selectItemPropsSchema = z.object({
|
|
98
163
|
value: z.string().describe("Item value"),
|
|
99
164
|
children: z.any().describe("Item content (ReactNode, required)"),
|
|
100
165
|
disabled: z.boolean().optional().describe("Disabled"),
|
|
101
166
|
className: z.string().optional().describe("Style override")
|
|
102
167
|
}).describe("Individual option within Select.");
|
|
168
|
+
var comboboxOptionSchema = z.object({
|
|
169
|
+
value: z.string().describe("Option value (unique key)"),
|
|
170
|
+
label: z.any().describe("Display label (string | ReactNode)"),
|
|
171
|
+
description: z.any().optional().describe("Secondary text below label (ReactNode)"),
|
|
172
|
+
disabled: z.boolean().optional().describe("Disabled option")
|
|
173
|
+
}).describe("Single Combobox option.");
|
|
174
|
+
var comboboxPropsSchema = z.object({
|
|
175
|
+
options: z.any().describe("Available options array (ComboboxOption[], required)"),
|
|
176
|
+
value: z.any().optional().describe("Selected value. string for single, string[] for multiple"),
|
|
177
|
+
defaultValue: z.any().optional().describe("Initial value (uncontrolled)"),
|
|
178
|
+
onValueChange: z.any().optional().describe("Value change callback. (value: string | string[]) => void"),
|
|
179
|
+
multiple: z.boolean().default(false).describe("Multi-select mode. Selected values shown as chips inside input"),
|
|
180
|
+
onSearch: z.any().optional().describe("Async search callback. (query: string) => void. Triggers external data fetching with debounce"),
|
|
181
|
+
searchDebounce: z.number().default(250).describe("Debounce delay (ms) before onSearch fires"),
|
|
182
|
+
loading: z.boolean().default(false).describe("Externally-controlled loading state. Shows spinner in input suffix"),
|
|
183
|
+
filter: z.any().optional().describe("Custom client-side filter. (option, query) => boolean. Default: case-insensitive label includes match"),
|
|
184
|
+
placeholder: z.string().optional().describe("Input placeholder"),
|
|
185
|
+
emptyMessage: z.any().optional().describe('Message when no options match (string | ReactNode). Default: "\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C"'),
|
|
186
|
+
loadingMessage: z.any().optional().describe('Message during loading state inside popover (string | ReactNode). Default: "\uAC80\uC0C9 \uC911\u2026"'),
|
|
187
|
+
size: z.enum(["md", "lg", "xl"]).default("md").describe("Input size (matches TextInput tokens)"),
|
|
188
|
+
disabled: z.boolean().optional().describe("Disabled"),
|
|
189
|
+
error: z.boolean().optional().describe("Error state"),
|
|
190
|
+
clearable: z.boolean().default(true).describe("Show clear button when value(s) exist"),
|
|
191
|
+
autoOpenOnFocus: z.boolean().default(true).describe("Open popover automatically when input gains focus"),
|
|
192
|
+
label: z.any().optional().describe("Field label (ReactNode)"),
|
|
193
|
+
description: z.any().optional().describe("Helper text below input (ReactNode)"),
|
|
194
|
+
className: z.string().optional().describe("Wrapper className"),
|
|
195
|
+
popoverClassName: z.string().optional().describe("Popover content className")
|
|
196
|
+
}).describe(
|
|
197
|
+
`Searchable select. Text input + popover listbox. Single/multi-select. Sync (auto-filter) or async (onSearch + loading) modes.
|
|
198
|
+
|
|
199
|
+
WHEN TO USE:
|
|
200
|
+
\u2022 Options \u2265 7, OR labels are long, OR search/filter is needed \u2192 Combobox (not Select)
|
|
201
|
+
\u2022 Multi-select form field \u2192 Combobox with multiple (chips render inside input)
|
|
202
|
+
\u2022 Async data from server \u2192 set onSearch + loading
|
|
203
|
+
For \u22647 simple options use Select. For free-text tags use TagInput.
|
|
204
|
+
|
|
205
|
+
ASYNC PATTERN:
|
|
206
|
+
<Combobox options={results} loading={isFetching} onSearch={(q) => mutate(q)} />
|
|
207
|
+
\u2014 onSearch fires after searchDebounce (default 250ms). Do NOT clear input on result update; component preserves user's typing.
|
|
208
|
+
|
|
209
|
+
IME (Korean/Japanese/Chinese): Enter during composition is ignored automatically \u2014 do not add custom keydown handlers.
|
|
210
|
+
|
|
211
|
+
ANTI-PATTERNS:
|
|
212
|
+
\u2717 <Select> with 20 options \u2192 <Combobox>
|
|
213
|
+
\u2717 Manual <input> + dropdown div + filter logic \u2192 <Combobox>
|
|
214
|
+
\u2717 Setting value externally to clear input mid-typing \u2192 use onValueChange instead`
|
|
215
|
+
);
|
|
103
216
|
var dropdownMenuItemSchema = z.object({
|
|
104
217
|
label: z.any().describe("Menu item text (ReactNode)"),
|
|
105
218
|
value: z.string().optional().describe("Item identifier"),
|
|
@@ -116,7 +229,24 @@ var dropdownMenuPropsSchema = z.object({
|
|
|
116
229
|
side: z.enum(["top", "right", "bottom", "left"]).default("bottom").describe("Position"),
|
|
117
230
|
className: z.string().optional().describe("Trigger wrapper style"),
|
|
118
231
|
contentClassName: z.string().optional().describe("Content panel style")
|
|
119
|
-
}).describe(
|
|
232
|
+
}).describe(
|
|
233
|
+
`Dropdown menu \u2014 list of actions/commands triggered by a button. Based on Radix DropdownMenu (role="menu" + keyboard nav).
|
|
234
|
+
|
|
235
|
+
WHEN TO USE:
|
|
236
|
+
\u2022 "More" / context menu (\u2022\u2022\u2022, \u22EE)
|
|
237
|
+
\u2022 Action lists where each item triggers a function (save, share, delete)
|
|
238
|
+
\u2022 Selecting a value (form field) \u2192 Select / Combobox (not DropdownMenu)
|
|
239
|
+
\u2022 Multi-select toggles \u2192 ToggleGroup or CheckBox group
|
|
240
|
+
\u2022 Anchored info panel \u2192 Popover
|
|
241
|
+
|
|
242
|
+
Use danger=true on destructive items (Delete) for visual + semantic emphasis.
|
|
243
|
+
Use separator=true to group related actions.
|
|
244
|
+
|
|
245
|
+
ANTI-PATTERNS:
|
|
246
|
+
\u2717 DropdownMenu for value selection submitted later \u2192 Select / Combobox
|
|
247
|
+
\u2717 Custom <div onClick> with isOpen state \u2192 DropdownMenu
|
|
248
|
+
\u2717 Long form inputs inside menu items \u2192 Popover instead`
|
|
249
|
+
);
|
|
120
250
|
var toggleGroupItemSchema = z.object({
|
|
121
251
|
value: z.string().describe("Item value"),
|
|
122
252
|
label: z.any().describe("Display label (ReactNode)"),
|
|
@@ -130,12 +260,37 @@ var toggleGroupPropsSchema = z.object({
|
|
|
130
260
|
value: z.any().optional().describe("Controlled value (string | string[])"),
|
|
131
261
|
defaultValue: z.any().optional().describe("Default value"),
|
|
132
262
|
onValueChange: z.any().optional().describe("Value change callback"),
|
|
133
|
-
variant: z.enum(["default", "primary", "secondary"]).default("default").describe(
|
|
263
|
+
variant: z.enum(["default", "primary", "secondary", "outline"]).default("default").describe(
|
|
264
|
+
"Style variant (default=slider, primary/secondary=accent filled, outline=bordered buttons with no background)"
|
|
265
|
+
),
|
|
134
266
|
size: z.enum(["sm", "md", "lg"]).default("md").describe("Size"),
|
|
267
|
+
fullWidth: z.boolean().default(false).describe("Stretch the group to parent width and split items equally"),
|
|
135
268
|
disabled: z.boolean().optional().describe("Disable all items"),
|
|
136
269
|
required: z.boolean().default(true).describe("Prevent deselection (at least one must be selected)"),
|
|
137
270
|
className: z.string().optional().describe("Style override")
|
|
138
|
-
}).describe(
|
|
271
|
+
}).describe(
|
|
272
|
+
`Toggle group / Segment control for immediate-effect option selection. Based on Radix ToggleGroup.
|
|
273
|
+
|
|
274
|
+
WHEN TO USE:
|
|
275
|
+
\u2022 Sort order, view mode (grid/list), filter chips \u2014 selection takes effect immediately
|
|
276
|
+
\u2022 Visual comparison important (icons or short labels)
|
|
277
|
+
\u2022 Form field that submits later \u2192 RadioGroup or CheckBox instead
|
|
278
|
+
\u2022 Page area switching (settings tabs) \u2192 Tab instead
|
|
279
|
+
|
|
280
|
+
VARIANTS:
|
|
281
|
+
\u2022 default \u2014 slider-style background (sleek)
|
|
282
|
+
\u2022 primary / secondary \u2014 accent-filled selected state
|
|
283
|
+
\u2022 outline \u2014 bordered buttons with no background (button-style toolbar)
|
|
284
|
+
|
|
285
|
+
fullWidth=true distributes items equally across parent width (use with outline variant for button-row look).
|
|
286
|
+
|
|
287
|
+
type="single" requires at least one selection by default (required=true). Set required=false to allow deselection.
|
|
288
|
+
|
|
289
|
+
ANTI-PATTERNS:
|
|
290
|
+
\u2717 Using ToggleGroup for content tabs \u2192 Tab
|
|
291
|
+
\u2717 Using ToggleGroup as form field submitted later \u2192 RadioGroup (semantics + a11y)
|
|
292
|
+
\u2717 Mixing icons and text labels of different sizes \u2014 keep visual rhythm consistent`
|
|
293
|
+
);
|
|
139
294
|
var sliderPropsSchema = z.object({
|
|
140
295
|
value: z.array(z.number()).optional().describe("Controlled value (number[]). Use [50] for single, [20, 80] for range"),
|
|
141
296
|
defaultValue: z.array(z.number()).optional().describe("Default value"),
|
|
@@ -150,7 +305,23 @@ var sliderPropsSchema = z.object({
|
|
|
150
305
|
onValueChange: z.any().optional().describe("Value change callback (value: number[]) => void"),
|
|
151
306
|
onValueCommit: z.any().optional().describe("Committed value callback (on pointer up)"),
|
|
152
307
|
className: z.string().optional().describe("Style override")
|
|
153
|
-
}).describe(
|
|
308
|
+
}).describe(
|
|
309
|
+
`Slider \u2014 numeric range selector. Based on Radix Slider. Single thumb or range (two thumbs).
|
|
310
|
+
|
|
311
|
+
WHEN TO USE:
|
|
312
|
+
\u2022 Continuous range with visual feedback: volume, brightness, price filter
|
|
313
|
+
\u2022 Range filter (min-max) \u2192 defaultValue=[20, 80]
|
|
314
|
+
\u2022 Precise number entry \u2192 NumberInput
|
|
315
|
+
\u2022 Discrete few options \u2192 ToggleGroup or RadioGroup
|
|
316
|
+
\u2022 Boolean \u2192 Switch
|
|
317
|
+
|
|
318
|
+
step controls increments. onValueCommit fires only after pointer release (good for expensive recomputations).
|
|
319
|
+
|
|
320
|
+
ANTI-PATTERNS:
|
|
321
|
+
\u2717 Slider for required precise input (typing 47 is faster than dragging)
|
|
322
|
+
\u2717 Long step count without showValue / labels (users have no reference)
|
|
323
|
+
\u2717 Calling expensive API on every onValueChange tick \u2192 use onValueCommit`
|
|
324
|
+
);
|
|
154
325
|
var checkBoxPropsSchema = z.object({
|
|
155
326
|
size: z.enum(["sm", "md"]).default("md").describe("Size"),
|
|
156
327
|
shape: z.enum(["square", "round"]).default("square").describe("Shape"),
|
|
@@ -166,12 +337,30 @@ var checkBoxPropsSchema = z.object({
|
|
|
166
337
|
onCheckedChange: z.any().optional().describe("Checked state change callback (checked: boolean) => void"),
|
|
167
338
|
onChange: z.any().optional().describe("Native change event handler"),
|
|
168
339
|
className: z.string().optional().describe("Style override")
|
|
169
|
-
}).describe(
|
|
340
|
+
}).describe(
|
|
341
|
+
`Checkbox for multi-select form fields. Native input-based, supports square/round shapes.
|
|
342
|
+
|
|
343
|
+
WHEN TO USE:
|
|
344
|
+
\u2022 Form field with multiple independent options (T&C agreements, multi-select filters submitted later)
|
|
345
|
+
\u2022 Tri-state (parent-child selection) \u2014 use indeterminate prop
|
|
346
|
+
\u2022 Single binary that takes effect immediately \u2192 Switch instead
|
|
347
|
+
\u2022 Many options with search \u2192 Combobox (multiple)
|
|
348
|
+
|
|
349
|
+
INDETERMINATE: set indeterminate=true when some children are checked, others not. aria-checked becomes "mixed" automatically.
|
|
350
|
+
|
|
351
|
+
ANTI-PATTERNS:
|
|
352
|
+
\u2717 <CheckBox> for "Enable dark mode" toggle \u2192 <Switch>
|
|
353
|
+
\u2717 Native <input type="checkbox"> + manual styling \u2192 <CheckBox>
|
|
354
|
+
\u2717 Forgetting indeterminate for "select all" parent`
|
|
355
|
+
);
|
|
170
356
|
var radioGroupPropsSchema = z.object({
|
|
171
357
|
name: z.string().describe("Form name (required)"),
|
|
172
358
|
value: z.string().optional().describe("Selected value (controlled)"),
|
|
173
359
|
defaultValue: z.string().optional().describe("Initial value (uncontrolled)"),
|
|
174
360
|
size: z.enum(["sm", "md"]).default("md").describe("Size"),
|
|
361
|
+
variant: z.enum(["default", "ring"]).default("default").describe(
|
|
362
|
+
"Visual style. default=outline circle with inner dot, ring=thick border replaces dot when checked"
|
|
363
|
+
),
|
|
175
364
|
orientation: z.enum(["horizontal", "vertical"]).default("vertical").describe("Layout direction"),
|
|
176
365
|
disabled: z.boolean().optional().describe("Disabled"),
|
|
177
366
|
children: z.any().describe("RadioItem list (ReactNode, required)"),
|
|
@@ -179,11 +368,32 @@ var radioGroupPropsSchema = z.object({
|
|
|
179
368
|
"aria-labelledby": z.string().optional().describe("Accessibility label reference ID"),
|
|
180
369
|
onValueChange: z.any().optional().describe("Value change callback (value: string) => void"),
|
|
181
370
|
className: z.string().optional().describe("Style override")
|
|
182
|
-
}).describe(
|
|
371
|
+
}).describe(
|
|
372
|
+
`Radio group for single-choice form fields. Used with RadioItem.
|
|
373
|
+
|
|
374
|
+
WHEN TO USE:
|
|
375
|
+
\u2022 Form field where user picks ONE of small set (\u22644-7) and submits later \u2192 RadioGroup
|
|
376
|
+
\u2022 All options should be visible at once for comparison \u2192 RadioGroup (not Select)
|
|
377
|
+
\u2022 Immediate effect on selection (no submit) \u2192 ToggleGroup instead
|
|
378
|
+
\u2022 Page area switching (tabs) \u2192 Tab (not RadioGroup)
|
|
379
|
+
\u2022 Many options \u2192 Select / Combobox
|
|
380
|
+
|
|
381
|
+
VARIANTS:
|
|
382
|
+
\u2022 variant="default" \u2014 outline circle with inner dot when checked (classic)
|
|
383
|
+
\u2022 variant="ring" \u2014 thick border replaces inner dot when checked (modern, Figma "ring" style)
|
|
384
|
+
|
|
385
|
+
ANTI-PATTERNS:
|
|
386
|
+
\u2717 Using RadioGroup for tab-like content switching \u2192 Tab
|
|
387
|
+
\u2717 Using RadioGroup for immediate filters \u2192 ToggleGroup
|
|
388
|
+
\u2717 Mixing RadioGroup and ToggleGroup in same form \u2192 pick one pattern
|
|
389
|
+
\u2717 Native <input type="radio"> \u2192 RadioItem (gets a11y, focus ring, tokens)`
|
|
390
|
+
);
|
|
183
391
|
var radioItemPropsSchema = z.object({
|
|
184
392
|
value: z.string().describe("Item value (required)"),
|
|
185
393
|
size: z.enum(["sm", "md"]).optional().describe("Size (overrides group)"),
|
|
394
|
+
variant: z.enum(["default", "ring"]).optional().describe("Visual style (overrides group)"),
|
|
186
395
|
label: z.any().optional().describe("Label text (ReactNode)"),
|
|
396
|
+
description: z.any().optional().describe("Help text shown beneath the label (ReactNode)"),
|
|
187
397
|
children: z.any().optional().describe("Label alternative content (ReactNode)"),
|
|
188
398
|
disabled: z.boolean().optional().describe("Disabled"),
|
|
189
399
|
className: z.string().optional().describe("Style override")
|
|
@@ -198,7 +408,20 @@ var switchPropsSchema = z.object({
|
|
|
198
408
|
onCheckedChange: z.any().optional().describe("Toggle state change callback (checked: boolean) => void"),
|
|
199
409
|
onChange: z.any().optional().describe("Native change event handler (ChangeEvent)"),
|
|
200
410
|
className: z.string().optional().describe("Style override")
|
|
201
|
-
}).describe(
|
|
411
|
+
}).describe(
|
|
412
|
+
`Toggle switch for immediate on/off binary state. Native checkbox-based, role="switch".
|
|
413
|
+
|
|
414
|
+
WHEN TO USE:
|
|
415
|
+
\u2022 Setting that takes effect immediately (notifications on/off, dark mode)
|
|
416
|
+
\u2022 Binary state with no submit step
|
|
417
|
+
\u2022 Form field submitted later \u2192 CheckBox instead (semantics: checkbox is form data)
|
|
418
|
+
\u2022 Multiple related options \u2192 CheckBox group or ToggleGroup (multiple)
|
|
419
|
+
|
|
420
|
+
ANTI-PATTERNS:
|
|
421
|
+
\u2717 <CheckBox> for "Enable notifications" toggle \u2192 <Switch>
|
|
422
|
+
\u2717 <Switch> inside form requiring submit \u2192 <CheckBox>
|
|
423
|
+
\u2717 Wrapping Switch in <label onClick> manually \u2192 use label prop or htmlFor pattern`
|
|
424
|
+
);
|
|
202
425
|
var chipPropsSchema = z.object({
|
|
203
426
|
variant: z.enum(["default", "filled", "outline", "accent"]).default("default").describe("Style"),
|
|
204
427
|
size: z.enum(["sm", "md", "lg"]).default("md").describe("Size"),
|
|
@@ -208,7 +431,21 @@ var chipPropsSchema = z.object({
|
|
|
208
431
|
onClose: z.any().optional().describe("Close button click callback (e: MouseEvent) => void. Shows X button when provided"),
|
|
209
432
|
onClick: z.any().optional().describe("Click event handler"),
|
|
210
433
|
className: z.string().optional().describe("Style override")
|
|
211
|
-
}).describe(
|
|
434
|
+
}).describe(
|
|
435
|
+
`Chip \u2014 small interactive token for filters, tags, removable selections, status labels.
|
|
436
|
+
|
|
437
|
+
WHEN TO USE:
|
|
438
|
+
\u2022 Filter token / removable selection (set onClose for X button)
|
|
439
|
+
\u2022 Tag/category indicator
|
|
440
|
+
\u2022 Status indicator with color (variant="accent")
|
|
441
|
+
\u2022 Pure count badge \u2192 Badge instead
|
|
442
|
+
\u2022 Toggleable filter \u2192 ToggleGroup or Chip with onClick + active state
|
|
443
|
+
|
|
444
|
+
ANTI-PATTERNS:
|
|
445
|
+
\u2717 Building dismiss UI manually with custom div + X icon \u2192 use onClose prop
|
|
446
|
+
\u2717 Using Chip as a primary CTA \u2192 Button
|
|
447
|
+
\u2717 Using Chip for hover-only labels \u2192 Tooltip`
|
|
448
|
+
);
|
|
212
449
|
var badgePropsSchema = z.object({
|
|
213
450
|
count: z.number().optional().describe("Badge count number"),
|
|
214
451
|
max: z.number().default(99).describe('Max count (shows "99+" when exceeded)'),
|
|
@@ -219,7 +456,23 @@ var badgePropsSchema = z.object({
|
|
|
219
456
|
offset: z.tuple([z.number(), z.number()]).optional().describe("Position offset [x, y] in px"),
|
|
220
457
|
children: z.any().optional().describe("Anchor element to attach badge to (ReactNode)"),
|
|
221
458
|
className: z.string().optional().describe("Style override")
|
|
222
|
-
}).describe(
|
|
459
|
+
}).describe(
|
|
460
|
+
`Badge \u2014 small status / count indicator overlaid on an anchor (icon, avatar, button).
|
|
461
|
+
|
|
462
|
+
WHEN TO USE:
|
|
463
|
+
\u2022 Notification count on bell icon
|
|
464
|
+
\u2022 Unread message count on inbox tab
|
|
465
|
+
\u2022 Status dot (online/offline) \u2192 dot=true
|
|
466
|
+
\u2022 Status label with text (e.g. "PRO", "NEW") \u2192 Chip variant="accent"
|
|
467
|
+
\u2022 Removable filter token \u2192 Chip with onClose
|
|
468
|
+
|
|
469
|
+
count={0} hides badge by default; pass showZero=true to keep visible.
|
|
470
|
+
|
|
471
|
+
ANTI-PATTERNS:
|
|
472
|
+
\u2717 Using Badge as standalone label without anchor \u2192 Chip
|
|
473
|
+
\u2717 count > 999 without max \u2192 ugly layout; default max=99 ("99+")
|
|
474
|
+
\u2717 Multiple badges on same anchor (visual noise)`
|
|
475
|
+
);
|
|
223
476
|
var progressPropsSchema = z.object({
|
|
224
477
|
value: z.number().default(0).describe("Current progress value"),
|
|
225
478
|
max: z.number().default(100).describe("Maximum value"),
|
|
@@ -229,7 +482,23 @@ var progressPropsSchema = z.object({
|
|
|
229
482
|
indeterminate: z.boolean().default(false).describe("Indeterminate loading animation"),
|
|
230
483
|
label: z.string().optional().describe("Label text above the bar"),
|
|
231
484
|
className: z.string().optional().describe("Style override")
|
|
232
|
-
}).describe(
|
|
485
|
+
}).describe(
|
|
486
|
+
`Progress \u2014 linear progress bar (file upload, multi-step form, loading with known %).
|
|
487
|
+
|
|
488
|
+
WHEN TO USE:
|
|
489
|
+
\u2022 Quantifiable progress (% complete, X of Y)
|
|
490
|
+
\u2022 Unknown duration spinner \u2192 Spinner
|
|
491
|
+
\u2022 Stable component shape during load \u2192 Skeleton
|
|
492
|
+
\u2022 Step-based navigation \u2192 Stepper
|
|
493
|
+
\u2022 Indeterminate (loading without %) \u2192 set indeterminate=true
|
|
494
|
+
|
|
495
|
+
variant follows semantic colors (success when complete, danger on error).
|
|
496
|
+
|
|
497
|
+
ANTI-PATTERNS:
|
|
498
|
+
\u2717 Indeterminate Progress for short loads (<1s) \u2014 Spinner is lighter
|
|
499
|
+
\u2717 Custom <div style={{ width: x% }}> \u2192 Progress (a11y, tokens)
|
|
500
|
+
\u2717 Progress without label/showValue when % is critical info`
|
|
501
|
+
);
|
|
233
502
|
var alertPropsSchema = z.object({
|
|
234
503
|
variant: z.enum(["info", "success", "warning", "danger"]).default("info").describe("Alert type / color"),
|
|
235
504
|
title: z.string().optional().describe("Alert title (bold)"),
|
|
@@ -239,14 +508,42 @@ var alertPropsSchema = z.object({
|
|
|
239
508
|
onClose: z.any().optional().describe("Close callback () => void"),
|
|
240
509
|
action: z.any().optional().describe("Action area (ReactNode, e.g. Button)"),
|
|
241
510
|
className: z.string().optional().describe("Style override")
|
|
242
|
-
}).describe(
|
|
511
|
+
}).describe(
|
|
512
|
+
`Alert \u2014 persistent inline notification (banner). Auto icon by variant.
|
|
513
|
+
|
|
514
|
+
WHEN TO USE:
|
|
515
|
+
\u2022 In-page status: form errors, server warnings, info banners, success confirmation
|
|
516
|
+
\u2022 Transient toast/snackbar \u2192 use a toast library, NOT Alert
|
|
517
|
+
\u2022 Modal-blocking error \u2192 Modal with semantic="danger"
|
|
518
|
+
\u2022 Inline form field error \u2192 use error/description prop on TextInput / Select / etc.
|
|
519
|
+
|
|
520
|
+
variant maps to semantic colors. closable=true gives users dismiss control. action prop reserved for inline buttons (e.g. "Retry").
|
|
521
|
+
|
|
522
|
+
ANTI-PATTERNS:
|
|
523
|
+
\u2717 Stacking 5 alerts at top of page (use one with summary)
|
|
524
|
+
\u2717 Critical destructive action confirmation in Alert \u2192 Modal
|
|
525
|
+
\u2717 Wrapping <div className="bg-red-100"> manually \u2192 Alert (a11y role + tokens)`
|
|
526
|
+
);
|
|
243
527
|
var spinnerPropsSchema = z.object({
|
|
244
528
|
size: z.number().default(20).describe("Size in px"),
|
|
245
529
|
color: z.string().optional().describe("Color (CSS color value, default currentColor)"),
|
|
246
530
|
"aria-label": z.string().default("Loading").describe("Accessibility label"),
|
|
247
531
|
style: z.any().optional().describe("Inline style (CSSProperties)"),
|
|
248
532
|
className: z.string().optional().describe("Color override etc.")
|
|
249
|
-
}).describe(
|
|
533
|
+
}).describe(
|
|
534
|
+
`Loading indicator (spinner). SVG-based. role="status" + aria-label built-in.
|
|
535
|
+
|
|
536
|
+
WHEN TO USE:
|
|
537
|
+
\u2022 Short loads (<1s), inline indicator (button content while submitting)
|
|
538
|
+
\u2022 Long loads with known structure \u2192 Skeleton (better perceived performance)
|
|
539
|
+
\u2022 Quantifiable progress \u2192 Progress
|
|
540
|
+
\u2022 Page-level loading boundary inside DataList/DataGrid \u2192 use their loading prop instead
|
|
541
|
+
|
|
542
|
+
ANTI-PATTERNS:
|
|
543
|
+
\u2717 Custom CSS spinning div \u2192 Spinner (a11y + tokens)
|
|
544
|
+
\u2717 Using Spinner where Skeleton fits (long loads with stable layout)
|
|
545
|
+
\u2717 Forgetting aria-label override when meaning differs from "Loading"`
|
|
546
|
+
);
|
|
250
547
|
var stepItemSchema = z.object({
|
|
251
548
|
label: z.string().describe("Step title"),
|
|
252
549
|
description: z.string().optional().describe("Step description")
|
|
@@ -258,7 +555,23 @@ var stepperPropsSchema = z.object({
|
|
|
258
555
|
orientation: z.enum(["horizontal", "vertical"]).default("horizontal").describe("Layout direction"),
|
|
259
556
|
size: z.enum(["sm", "md"]).default("md").describe("Size"),
|
|
260
557
|
className: z.string().optional().describe("Style override")
|
|
261
|
-
}).describe(
|
|
558
|
+
}).describe(
|
|
559
|
+
`Stepper \u2014 multi-step linear flow indicator (checkout, onboarding, wizard).
|
|
560
|
+
|
|
561
|
+
WHEN TO USE:
|
|
562
|
+
\u2022 Sequential workflow with finite steps (3-7)
|
|
563
|
+
\u2022 Show user's current position in flow + completed/upcoming steps
|
|
564
|
+
\u2022 Independent navigation between unrelated sections \u2192 Tab
|
|
565
|
+
\u2022 Continuous % progress \u2192 Progress
|
|
566
|
+
\u2022 Hierarchy / location \u2192 Breadcrumb
|
|
567
|
+
|
|
568
|
+
status="error" highlights the current step with danger color when validation fails.
|
|
569
|
+
|
|
570
|
+
ANTI-PATTERNS:
|
|
571
|
+
\u2717 Stepper with 2 steps (use Progress or just navigation)
|
|
572
|
+
\u2717 Stepper with 10+ steps (overwhelming) \u2014 chunk into sub-flows
|
|
573
|
+
\u2717 Letting users skip ahead by clicking future steps (only mark completed \u2192 current is allowed)`
|
|
574
|
+
);
|
|
262
575
|
var skeletonPropsSchema = z.object({
|
|
263
576
|
as: z.enum(["div", "span"]).default("div").describe("Rendered tag"),
|
|
264
577
|
circle: z.boolean().default(false).describe("Circle skeleton (rounded-full)"),
|
|
@@ -268,7 +581,21 @@ var skeletonPropsSchema = z.object({
|
|
|
268
581
|
style: z.any().optional().describe("Inline style (CSSProperties)"),
|
|
269
582
|
className: z.string().optional().describe("Style override")
|
|
270
583
|
}).describe(
|
|
271
|
-
|
|
584
|
+
`Skeleton loading placeholder. Size/shape via className. With children, wraps transparently to maintain actual size.
|
|
585
|
+
|
|
586
|
+
WHEN TO USE:
|
|
587
|
+
\u2022 Long load with known component shape (cards, lists, profile headers)
|
|
588
|
+
\u2022 Reduces perceived wait time when layout is predictable
|
|
589
|
+
\u2022 Short loads (<1s) \u2192 Spinner
|
|
590
|
+
\u2022 Quantifiable progress \u2192 Progress
|
|
591
|
+
\u2022 DataList/DataGrid loading \u2192 set list={null} (uses skeletonElement prop automatically)
|
|
592
|
+
|
|
593
|
+
GOLDEN RULE: Skeleton must match the real component's shape and size. Mismatch causes layout shift.
|
|
594
|
+
|
|
595
|
+
ANTI-PATTERNS:
|
|
596
|
+
\u2717 Generic gray rectangle for everything \u2192 match real component shape
|
|
597
|
+
\u2717 Skeleton for instant loads (causes flash)
|
|
598
|
+
\u2717 Many skeletons of different shapes when component is uniform \u2192 use a single skeleton in DataList`
|
|
272
599
|
);
|
|
273
600
|
var dividerPropsSchema = z.object({
|
|
274
601
|
orientation: z.enum(["horizontal", "vertical"]).default("horizontal").describe("Direction"),
|
|
@@ -276,7 +603,21 @@ var dividerPropsSchema = z.object({
|
|
|
276
603
|
color: z.string().optional().describe("Custom color (CSS value)"),
|
|
277
604
|
style: z.any().optional().describe("Inline style (CSSProperties)"),
|
|
278
605
|
className: z.string().optional().describe("Style override")
|
|
279
|
-
}).describe(
|
|
606
|
+
}).describe(
|
|
607
|
+
`Divider \u2014 visual separator (horizontal/vertical line).
|
|
608
|
+
|
|
609
|
+
WHEN TO USE:
|
|
610
|
+
\u2022 Separating sections within a card / list
|
|
611
|
+
\u2022 Vertical separator between inline items (orientation="vertical")
|
|
612
|
+
\u2022 Use color prop sparingly \u2014 defaults to border-default token
|
|
613
|
+
\u2022 For grouping form sections, prefer larger spacing over Divider
|
|
614
|
+
\u2022 Tab/Accordion already provide visual separation \u2014 don't add Divider
|
|
615
|
+
|
|
616
|
+
ANTI-PATTERNS:
|
|
617
|
+
\u2717 Stacking many Dividers \u2014 increase spacing instead
|
|
618
|
+
\u2717 Using Divider as decorative line with bright color \u2192 use Tailwind border utility on container
|
|
619
|
+
\u2717 Inline <hr> with custom CSS \u2192 Divider (consistent token)`
|
|
620
|
+
);
|
|
280
621
|
var tooltipPropsSchema = z.object({
|
|
281
622
|
children: z.any().describe("Trigger element (ReactNode, required)"),
|
|
282
623
|
content: z.any().describe("Tooltip content (ReactNode, required)"),
|
|
@@ -287,7 +628,22 @@ var tooltipPropsSchema = z.object({
|
|
|
287
628
|
disabled: z.boolean().default(false).describe("Disabled"),
|
|
288
629
|
className: z.string().optional().describe("Content style"),
|
|
289
630
|
triggerClassName: z.string().optional().describe("Trigger style")
|
|
290
|
-
}).describe(
|
|
631
|
+
}).describe(
|
|
632
|
+
`Tooltip \u2014 short text hint shown on hover/focus. Based on Radix Tooltip. Provider built-in.
|
|
633
|
+
|
|
634
|
+
WHEN TO USE:
|
|
635
|
+
\u2022 Brief explanation of an icon button or truncated label
|
|
636
|
+
\u2022 Hover-only, non-interactive content (text only)
|
|
637
|
+
\u2022 Need clickable content inside \u2192 Popover (not Tooltip)
|
|
638
|
+
\u2022 Action menu \u2192 DropdownMenu
|
|
639
|
+
\u2022 Force user attention \u2192 Modal
|
|
640
|
+
|
|
641
|
+
ANTI-PATTERNS:
|
|
642
|
+
\u2717 Buttons/links inside content \u2192 use Popover (Tooltip not focusable)
|
|
643
|
+
\u2717 Long paragraphs in tooltip \u2192 consider Popover or Drawer
|
|
644
|
+
\u2717 Tooltip on disabled buttons (won't show in some browsers) \u2014 wrap in span instead
|
|
645
|
+
\u2717 Critical info only in tooltip \u2014 duplicate visible elsewhere for mobile/touch`
|
|
646
|
+
);
|
|
291
647
|
var popoverPropsSchema = z.object({
|
|
292
648
|
trigger: z.any().describe("Trigger element (ReactNode, required)"),
|
|
293
649
|
side: z.enum(["top", "right", "bottom", "left"]).default("bottom").describe("Position"),
|
|
@@ -300,7 +656,21 @@ var popoverPropsSchema = z.object({
|
|
|
300
656
|
children: z.any().optional().describe("Popover body (ReactNode)"),
|
|
301
657
|
className: z.string().optional().describe("Content style"),
|
|
302
658
|
arrowClassName: z.string().optional().describe("Arrow style")
|
|
303
|
-
}).describe(
|
|
659
|
+
}).describe(
|
|
660
|
+
`Popover \u2014 anchor-positioned panel with interactive content. Based on Radix Popover.
|
|
661
|
+
|
|
662
|
+
WHEN TO USE:
|
|
663
|
+
\u2022 Trigger-anchored UI with buttons, inputs, or rich content
|
|
664
|
+
\u2022 Filter/option panel near a button (not a full sidebar)
|
|
665
|
+
\u2022 Hover-only text hint \u2192 Tooltip (lighter)
|
|
666
|
+
\u2022 Action menu list \u2192 DropdownMenu (gives role=menu, keyboard nav)
|
|
667
|
+
\u2022 Decision dialog \u2192 Modal
|
|
668
|
+
|
|
669
|
+
ANTI-PATTERNS:
|
|
670
|
+
\u2717 Action lists with onClick handlers \u2192 DropdownMenu (a11y semantics)
|
|
671
|
+
\u2717 Implementing dropdown manually with Popover + custom buttons \u2192 DropdownMenu
|
|
672
|
+
\u2717 Long forms inside Popover \u2192 Drawer or Modal`
|
|
673
|
+
);
|
|
304
674
|
var accordionItemData = z.object({
|
|
305
675
|
id: z.string().describe("Unique ID"),
|
|
306
676
|
trigger: z.any().describe("Trigger content (ReactNode)"),
|
|
@@ -318,7 +688,23 @@ var accordionPropsSchema = z.object({
|
|
|
318
688
|
defaultValue: z.union([z.string(), z.array(z.string())]).optional().describe("Uncontrolled initial value"),
|
|
319
689
|
onValueChange: z.any().optional().describe("Open item change callback (value: string | string[]) => void"),
|
|
320
690
|
className: z.string().optional().describe("Root style")
|
|
321
|
-
}).describe(
|
|
691
|
+
}).describe(
|
|
692
|
+
`Accordion \u2014 collapsible content sections (FAQ, settings groups).
|
|
693
|
+
|
|
694
|
+
WHEN TO USE:
|
|
695
|
+
\u2022 FAQ, help docs, settings groups
|
|
696
|
+
\u2022 Long page where each section is independently scannable
|
|
697
|
+
\u2022 Hidden critical info \u2014 DO NOT bury what users always need
|
|
698
|
+
\u2022 Tab-like content switching \u2192 Tab (Accordion is for stacked, not exclusive)
|
|
699
|
+
|
|
700
|
+
type="single" + collapsible=true \u2192 all-closed allowed (recommended for FAQ).
|
|
701
|
+
type="multiple" \u2192 multiple sections open at once.
|
|
702
|
+
|
|
703
|
+
ANTI-PATTERNS:
|
|
704
|
+
\u2717 Hiding the page's primary content inside collapsed Accordion
|
|
705
|
+
\u2717 Single-section Accordion (just show the content)
|
|
706
|
+
\u2717 Custom toggle div + state \u2014 use Accordion (gets a11y, keyboard nav)`
|
|
707
|
+
);
|
|
322
708
|
var drawerDirection = z.enum(["bottom", "top", "left", "right"]).default("bottom");
|
|
323
709
|
var drawerPropsSchema = z.object({
|
|
324
710
|
direction: drawerDirection.describe("Direction"),
|
|
@@ -328,7 +714,23 @@ var drawerPropsSchema = z.object({
|
|
|
328
714
|
modal: z.boolean().optional().describe("Modal mode (default true). If false, background is interactive"),
|
|
329
715
|
shouldScaleBackground: z.boolean().optional().describe("Background scale effect (default false)"),
|
|
330
716
|
children: z.any().describe("Drawer sub-components (ReactNode, required)")
|
|
331
|
-
}).describe(
|
|
717
|
+
}).describe(
|
|
718
|
+
`Drawer / bottom sheet. Based on Vaul. Compound component pattern.
|
|
719
|
+
|
|
720
|
+
WHEN TO USE:
|
|
721
|
+
\u2022 Side panel for secondary action while user can still see main content (filter panel, item details)
|
|
722
|
+
\u2022 Mobile bottom sheet (direction="bottom")
|
|
723
|
+
\u2022 Force decision blocking main flow \u2192 Modal instead
|
|
724
|
+
\u2022 Inline anchor-positioned UI \u2192 Popover instead
|
|
725
|
+
|
|
726
|
+
DIRECTION: bottom (default, mobile-friendly), top, left, right.
|
|
727
|
+
dismissible=true (default) allows swipe/outside-click close. Set false for blocking flows.
|
|
728
|
+
|
|
729
|
+
ANTI-PATTERNS:
|
|
730
|
+
\u2717 Drawer for confirmation dialogs \u2192 Modal (decision-forcing)
|
|
731
|
+
\u2717 Always shouldScaleBackground \u2192 only enable for true mobile bottom-sheets
|
|
732
|
+
\u2717 Forgetting Drawer.Title \u2192 required for screen readers (a11y)`
|
|
733
|
+
);
|
|
332
734
|
var drawerContentPropsSchema = z.object({
|
|
333
735
|
direction: drawerDirection.optional().describe("Direction (Context takes priority)"),
|
|
334
736
|
blur: z.enum(["none", "sm", "md"]).default("none").describe("Overlay blur"),
|
|
@@ -372,7 +774,24 @@ var tabPropsSchema = z.object({
|
|
|
372
774
|
className: z.string().optional().describe("Root style"),
|
|
373
775
|
tabListClassName: z.string().optional().describe("Tab list style"),
|
|
374
776
|
tabPanelClassName: z.string().optional().describe("Tab panel style")
|
|
375
|
-
}).describe(
|
|
777
|
+
}).describe(
|
|
778
|
+
`Tab navigation \u2014 switch between content panels (settings sections, profile views).
|
|
779
|
+
|
|
780
|
+
WHEN TO USE:
|
|
781
|
+
\u2022 Page area swap where only one panel is visible at a time
|
|
782
|
+
\u2022 Mutually exclusive content with stable section labels
|
|
783
|
+
\u2022 Form field selection \u2192 RadioGroup (semantics: not navigation)
|
|
784
|
+
\u2022 Immediate filter/option toggle \u2192 ToggleGroup
|
|
785
|
+
\u2022 Stacked collapsible sections \u2192 Accordion
|
|
786
|
+
|
|
787
|
+
destroyInactive=true unmounts hidden panels (saves memory but loses state).
|
|
788
|
+
|
|
789
|
+
ANTI-PATTERNS:
|
|
790
|
+
\u2717 Tab with 1 item \u2014 just render the panel
|
|
791
|
+
\u2717 Tab with 8+ items \u2014 consider sub-routing or DropdownMenu
|
|
792
|
+
\u2717 Using Tab for form value selection \u2192 RadioGroup
|
|
793
|
+
\u2717 Custom <button> + onClick + state \u2192 Tab (a11y, keyboard, focus management)`
|
|
794
|
+
);
|
|
376
795
|
var carouselPropsSchema = z.object({
|
|
377
796
|
opts: z.record(z.any()).optional().describe("Embla options (loop, align, etc.)"),
|
|
378
797
|
plugins: z.array(z.any()).optional().describe("Embla plugins"),
|
|
@@ -380,7 +799,20 @@ var carouselPropsSchema = z.object({
|
|
|
380
799
|
children: z.any().optional().describe("Carousel slides and sub-components (ReactNode)"),
|
|
381
800
|
className: z.string().optional().describe("Style override")
|
|
382
801
|
}).describe(
|
|
383
|
-
|
|
802
|
+
`Carousel \u2014 horizontal slide gallery. Based on Embla Carousel. Compound: CarouselSlide, CarouselPrev/Next, CarouselDots.
|
|
803
|
+
|
|
804
|
+
WHEN TO USE:
|
|
805
|
+
\u2022 Hero banners, image gallery, product showcase
|
|
806
|
+
\u2022 Multi-card horizontal scroll with snap behavior
|
|
807
|
+
\u2022 Vertical scrolling list \u2192 Marquee or VirtualList (not Carousel)
|
|
808
|
+
\u2022 Critical content that must always be visible \u2014 Carousel hides slides
|
|
809
|
+
|
|
810
|
+
opts={{ loop: true, align: 'start' }} for endless loop. Add Embla autoplay plugin for auto-advance.
|
|
811
|
+
|
|
812
|
+
ANTI-PATTERNS:
|
|
813
|
+
\u2717 Critical CTA inside non-first slide (users might never scroll)
|
|
814
|
+
\u2717 Auto-advance without pause-on-hover (a11y)
|
|
815
|
+
\u2717 Manual scroll-snap div \u2192 Carousel (gets keyboard nav, indicators)`
|
|
384
816
|
);
|
|
385
817
|
var carouselSlidePropsSchema = z.object({
|
|
386
818
|
className: z.string().optional().describe("Slide style (use basis-1/3 etc. for multi-slide view)"),
|
|
@@ -401,7 +833,21 @@ var paginationPropsSchema = z.object({
|
|
|
401
833
|
size: z.enum(["sm", "md"]).default("md").describe("Size"),
|
|
402
834
|
onPageChange: z.any().describe("Page change callback (page: number) => void, required"),
|
|
403
835
|
className: z.string().optional().describe("<nav> style")
|
|
404
|
-
}).describe(
|
|
836
|
+
}).describe(
|
|
837
|
+
`Pagination \u2014 page-by-page navigation for long datasets.
|
|
838
|
+
|
|
839
|
+
WHEN TO USE:
|
|
840
|
+
\u2022 User needs to jump to specific pages (search results, blog archives)
|
|
841
|
+
\u2022 Total count is known and stable
|
|
842
|
+
\u2022 Continuous browsing \u2192 InfiniteScroll instead
|
|
843
|
+
\u2022 Real-time stream \u2192 InfiniteScroll
|
|
844
|
+
\u2022 Both fit \u2192 Pagination is more accessible (keyboard, deep-linkable URL)
|
|
845
|
+
|
|
846
|
+
ANTI-PATTERNS:
|
|
847
|
+
\u2717 Pagination with totalPages=1 \u2014 hide it
|
|
848
|
+
\u2717 Mixing Pagination + InfiniteScroll on same list (confusing)
|
|
849
|
+
\u2717 Custom page button divs \u2192 Pagination (a11y, edge cases like ellipsis)`
|
|
850
|
+
);
|
|
405
851
|
var avatarPropsSchema = z.object({
|
|
406
852
|
src: z.string().optional().describe("Image URL"),
|
|
407
853
|
alt: z.string().optional().describe("Alt text"),
|
|
@@ -411,7 +857,22 @@ var avatarPropsSchema = z.object({
|
|
|
411
857
|
children: z.any().optional().describe("Custom image element (e.g. Next.js Image)"),
|
|
412
858
|
onImageError: z.any().optional().describe("Image load error callback () => void"),
|
|
413
859
|
className: z.string().optional().describe("Style override")
|
|
414
|
-
}).describe(
|
|
860
|
+
}).describe(
|
|
861
|
+
`Avatar \u2014 user/entity profile image with text fallback.
|
|
862
|
+
|
|
863
|
+
WHEN TO USE:
|
|
864
|
+
\u2022 User profiles, comment authors, team member lists, message sender icons
|
|
865
|
+
\u2022 Image fails / not provided \u2192 fallback (initials or icon) shown automatically
|
|
866
|
+
\u2022 Need optimized image (Next.js) \u2192 pass <Image> via children, omit src
|
|
867
|
+
\u2022 Larger illustration / logo \u2192 use NxImage instead
|
|
868
|
+
|
|
869
|
+
shape="square" for organization/team logos; "circle" for people (default).
|
|
870
|
+
|
|
871
|
+
ANTI-PATTERNS:
|
|
872
|
+
\u2717 <img> + manual fallback handling \u2192 Avatar (handles error)
|
|
873
|
+
\u2717 Avatar without alt for screen readers (always set alt or aria-label)
|
|
874
|
+
\u2717 Mixing avatar sizes inconsistently in a list \u2014 pick one size`
|
|
875
|
+
);
|
|
415
876
|
var counterPropsSchema = z.object({
|
|
416
877
|
endValue: z.number().describe("Target value (required)"),
|
|
417
878
|
startValue: z.number().default(0).describe("Start value"),
|
|
@@ -423,7 +884,22 @@ var counterPropsSchema = z.object({
|
|
|
423
884
|
onEnd: z.any().optional().describe("Count complete callback () => void"),
|
|
424
885
|
style: z.any().optional().describe("Inline style (CSSProperties)"),
|
|
425
886
|
className: z.string().optional().describe("Style override")
|
|
426
|
-
}).describe(
|
|
887
|
+
}).describe(
|
|
888
|
+
`Counter \u2014 animated number tick from startValue to endValue.
|
|
889
|
+
|
|
890
|
+
WHEN TO USE:
|
|
891
|
+
\u2022 Marketing landing \u2014 "10,000+ users" KPI displays
|
|
892
|
+
\u2022 Stat dashboards (animate when value changes)
|
|
893
|
+
\u2022 Live tickers / real-time data \u2014 re-render plain text instead (Counter is one-shot animation)
|
|
894
|
+
\u2022 Currency input / editable number \u2192 NumberInput / PriceInput
|
|
895
|
+
|
|
896
|
+
triggerOnView=true delays animation until element scrolls into view (good for landing pages).
|
|
897
|
+
|
|
898
|
+
ANTI-PATTERNS:
|
|
899
|
+
\u2717 Counter for values that update frequently \u2014 animation queue conflicts
|
|
900
|
+
\u2717 Long duration on critical numbers (users wait to read)
|
|
901
|
+
\u2717 Counter without separator for large numbers (hard to read)`
|
|
902
|
+
);
|
|
427
903
|
var countdownPropsSchema = z.object({
|
|
428
904
|
endTimestamp: z.number().describe("End time (Unix ms, required)"),
|
|
429
905
|
separator: z.any().default(":").describe("Separator (ReactNode)"),
|
|
@@ -437,7 +913,22 @@ var countdownPropsSchema = z.object({
|
|
|
437
913
|
render: z.any().optional().describe("Custom render function"),
|
|
438
914
|
onEnd: z.any().optional().describe("Countdown end callback () => void"),
|
|
439
915
|
className: z.string().optional().describe("Style override")
|
|
440
|
-
}).describe(
|
|
916
|
+
}).describe(
|
|
917
|
+
`Countdown \u2014 live timer counting down to endTimestamp (Unix ms).
|
|
918
|
+
|
|
919
|
+
WHEN TO USE:
|
|
920
|
+
\u2022 Sale ends in / event starts in / token claim window
|
|
921
|
+
\u2022 OTP / verification code expiry
|
|
922
|
+
\u2022 Counting up (since X) \u2192 not Countdown; use Counter or custom interval
|
|
923
|
+
\u2022 Persistent server time \u2192 pass server-synced endTimestamp (not Date.now offset)
|
|
924
|
+
|
|
925
|
+
showDays=false for short timers (<24h) to declutter. Use render prop for fully custom layouts.
|
|
926
|
+
|
|
927
|
+
ANTI-PATTERNS:
|
|
928
|
+
\u2717 Countdown without onEnd handler \u2014 UI stuck at 0
|
|
929
|
+
\u2717 Countdown across SSR without hydration safety \u2014 pass endTimestamp from server
|
|
930
|
+
\u2717 Updating endTimestamp every render \u2014 causes jitter`
|
|
931
|
+
);
|
|
441
932
|
var marqueePropsSchema = z.object({
|
|
442
933
|
direction: z.enum(["left", "right", "up", "down"]).default("left").describe("Direction"),
|
|
443
934
|
speed: z.number().default(40).describe("Animation speed (seconds)"),
|
|
@@ -446,7 +937,22 @@ var marqueePropsSchema = z.object({
|
|
|
446
937
|
children: z.any().describe("Content to repeat (ReactNode, required)"),
|
|
447
938
|
style: z.any().optional().describe("Inline style (CSSProperties)"),
|
|
448
939
|
className: z.string().optional().describe("Style override")
|
|
449
|
-
}).describe(
|
|
940
|
+
}).describe(
|
|
941
|
+
`Marquee \u2014 endless scrolling content (logo strip, promo banner, news ticker).
|
|
942
|
+
|
|
943
|
+
WHEN TO USE:
|
|
944
|
+
\u2022 Logo cloud, partner brands strip, social proof
|
|
945
|
+
\u2022 Critical info that must be read \u2192 not Marquee (auto-scroll hurts a11y)
|
|
946
|
+
\u2022 Long static list \u2192 VirtualList
|
|
947
|
+
\u2022 User-paced gallery \u2192 Carousel
|
|
948
|
+
|
|
949
|
+
pauseOnHover=true is recommended whenever content is readable text.
|
|
950
|
+
|
|
951
|
+
ANTI-PATTERNS:
|
|
952
|
+
\u2717 Marquee with action buttons inside (hard to click)
|
|
953
|
+
\u2717 Fast-speed marquee on important text (unreadable, a11y violation)
|
|
954
|
+
\u2717 Multiple Marquees on same page in different directions (visual chaos)`
|
|
955
|
+
);
|
|
450
956
|
var virtualListPropsSchema = z.object({
|
|
451
957
|
items: z.array(z.any()).describe("Data array (required)"),
|
|
452
958
|
estimateSize: z.union([z.number(), z.any()]).describe("Estimated item height (number or (index) => number, required)"),
|
|
@@ -457,7 +963,23 @@ var virtualListPropsSchema = z.object({
|
|
|
457
963
|
style: z.any().optional().describe("Inline style (CSSProperties)"),
|
|
458
964
|
endReachedThreshold: z.number().default(200).describe("End detection threshold (px)"),
|
|
459
965
|
onEndReached: z.any().optional().describe("End reached callback () => void")
|
|
460
|
-
}).describe(
|
|
966
|
+
}).describe(
|
|
967
|
+
`VirtualList \u2014 performant rendering of huge lists (1000+ items). Based on @tanstack/react-virtual.
|
|
968
|
+
|
|
969
|
+
WHEN TO USE:
|
|
970
|
+
\u2022 Large datasets (>200 rows): chat history, transactions, logs, leaderboard
|
|
971
|
+
\u2022 Stable item height (or measurable per-item via estimateSize fn)
|
|
972
|
+
\u2022 Small list (<100 items) \u2192 DataList (much simpler API)
|
|
973
|
+
\u2022 Grid layout \u2192 VirtualGrid
|
|
974
|
+
\u2022 Server-side pagination \u2192 InfiniteScroll wrapping plain list
|
|
975
|
+
|
|
976
|
+
estimateSize is critical \u2014 wrong values cause scroll jumps. Pair with onEndReached for server pagination.
|
|
977
|
+
|
|
978
|
+
ANTI-PATTERNS:
|
|
979
|
+
\u2717 VirtualList for short lists (DataList is simpler and renders faster)
|
|
980
|
+
\u2717 Variable estimateSize for uniform items \u2014 use a single number
|
|
981
|
+
\u2717 Putting interactive overlays inside virtual rows (mounted/unmounted on scroll)`
|
|
982
|
+
);
|
|
461
983
|
var virtualGridPropsSchema = z.object({
|
|
462
984
|
items: z.array(z.any()).describe("Data array (required)"),
|
|
463
985
|
columns: z.number().describe("Column count (required)"),
|
|
@@ -469,7 +991,20 @@ var virtualGridPropsSchema = z.object({
|
|
|
469
991
|
style: z.any().optional().describe("Inline style (CSSProperties)"),
|
|
470
992
|
endReachedThreshold: z.number().default(200).describe("End detection threshold (px)"),
|
|
471
993
|
onEndReached: z.any().optional().describe("End reached callback () => void")
|
|
472
|
-
}).describe(
|
|
994
|
+
}).describe(
|
|
995
|
+
`VirtualGrid \u2014 performant grid for huge lists. Based on @tanstack/react-virtual.
|
|
996
|
+
|
|
997
|
+
WHEN TO USE:
|
|
998
|
+
\u2022 Image gallery / card grid with 200+ items
|
|
999
|
+
\u2022 Fixed column count (responsive via JS \u2014 recompute columns on breakpoint)
|
|
1000
|
+
\u2022 Small grid \u2192 DataGrid (no virtualization, simpler API)
|
|
1001
|
+
\u2022 Single-column list \u2192 VirtualList
|
|
1002
|
+
|
|
1003
|
+
ANTI-PATTERNS:
|
|
1004
|
+
\u2717 VirtualGrid with <50 items \u2014 DataGrid is simpler
|
|
1005
|
+
\u2717 Cards with hover-expanding height (breaks virtualization)
|
|
1006
|
+
\u2717 Forgetting to recompute columns on resize \u2192 visible empty space`
|
|
1007
|
+
);
|
|
473
1008
|
var infiniteScrollPropsSchema = z.object({
|
|
474
1009
|
list: z.array(z.any()).nullable().describe("Current data array (required)"),
|
|
475
1010
|
totalCount: z.number().optional().describe("Total count (mutually exclusive with hasMore)"),
|
|
@@ -482,7 +1017,23 @@ var infiniteScrollPropsSchema = z.object({
|
|
|
482
1017
|
scrollTarget: z.any().optional().describe("Scroll target element (HTMLElement | Document | MutableRefObject)"),
|
|
483
1018
|
children: z.any().describe("List item rendering (ReactNode, required)"),
|
|
484
1019
|
className: z.string().optional().describe("Style override")
|
|
485
|
-
}).describe(
|
|
1020
|
+
}).describe(
|
|
1021
|
+
`InfiniteScroll \u2014 auto-load more when sentinel enters viewport. Based on IntersectionObserver.
|
|
1022
|
+
|
|
1023
|
+
WHEN TO USE:
|
|
1024
|
+
\u2022 Feeds, social timelines, search-as-you-scroll
|
|
1025
|
+
\u2022 Continuous browsing where total isn't critical
|
|
1026
|
+
\u2022 Need jump-to-page \u2192 Pagination (not InfiniteScroll)
|
|
1027
|
+
\u2022 Need to render 1000s of already-loaded items efficiently \u2192 VirtualList
|
|
1028
|
+
\u2022 Combine with VirtualList for huge + paginated data
|
|
1029
|
+
|
|
1030
|
+
Pass either totalCount or hasMore (not both). handleLoadMore is required.
|
|
1031
|
+
|
|
1032
|
+
ANTI-PATTERNS:
|
|
1033
|
+
\u2717 InfiniteScroll without footer/loading element (looks broken at the bottom)
|
|
1034
|
+
\u2717 InfiniteScroll without debouncing handleLoadMore \u2014 duplicate fetches
|
|
1035
|
+
\u2717 Auto-loading critical actions in footer (links, contact) \u2014 they become unreachable`
|
|
1036
|
+
);
|
|
486
1037
|
var ellipsisPropsSchema = z.object({
|
|
487
1038
|
content: z.any().default("").describe("Body text (ReactNode)"),
|
|
488
1039
|
lineClamp: z.number().default(2).describe("Line clamp limit"),
|
|
@@ -492,7 +1043,22 @@ var ellipsisPropsSchema = z.object({
|
|
|
492
1043
|
observingEnvs: z.array(z.boolean()).optional().describe("Re-measure on external condition change"),
|
|
493
1044
|
onShowMoreLessClick: z.any().optional().describe("Show more/less click callback () => void"),
|
|
494
1045
|
className: z.string().optional().describe("Style override")
|
|
495
|
-
}).describe(
|
|
1046
|
+
}).describe(
|
|
1047
|
+
`Ellipsis \u2014 clamp long text to N lines with "show more / less" toggle.
|
|
1048
|
+
|
|
1049
|
+
WHEN TO USE:
|
|
1050
|
+
\u2022 Long descriptions in cards, comments, post previews
|
|
1051
|
+
\u2022 Single-line truncation only \u2192 CSS line-clamp utility (lighter)
|
|
1052
|
+
\u2022 Tooltip on hover for full text \u2192 Tooltip + truncate utility
|
|
1053
|
+
\u2022 Critical content that must be fully readable \u2014 don't truncate
|
|
1054
|
+
|
|
1055
|
+
triggerMore/triggerLess accept ReactNode for icons or styled buttons.
|
|
1056
|
+
|
|
1057
|
+
ANTI-PATTERNS:
|
|
1058
|
+
\u2717 Ellipsis on titles / labels \u2014 confusing UX
|
|
1059
|
+
\u2717 Always-collapsed (defaultShortened=true) for short text \u2014 measurement waste
|
|
1060
|
+
\u2717 Overriding triggerMore/Less with HTML that breaks accessibility (use button-like)`
|
|
1061
|
+
);
|
|
496
1062
|
var emptyStatePropsSchema = z.object({
|
|
497
1063
|
icon: z.any().optional().describe("Custom icon (ReactNode). Default inbox icon"),
|
|
498
1064
|
title: z.string().optional().describe("Title text"),
|
|
@@ -501,7 +1067,22 @@ var emptyStatePropsSchema = z.object({
|
|
|
501
1067
|
size: z.enum(["sm", "md", "lg"]).default("md").describe("Overall size"),
|
|
502
1068
|
children: z.any().optional().describe("Additional content (ReactNode)"),
|
|
503
1069
|
className: z.string().optional().describe("Style override")
|
|
504
|
-
}).describe(
|
|
1070
|
+
}).describe(
|
|
1071
|
+
`EmptyState \u2014 friendly placeholder for empty lists, no search results, first-time setup.
|
|
1072
|
+
|
|
1073
|
+
WHEN TO USE:
|
|
1074
|
+
\u2022 Empty inbox / list / search results
|
|
1075
|
+
\u2022 First-time use (onboarding nudge with action button)
|
|
1076
|
+
\u2022 Loading \u2192 Skeleton/Spinner (NOT EmptyState)
|
|
1077
|
+
\u2022 Error \u2192 Alert (or pass icon + title to EmptyState only when conceptually "nothing here")
|
|
1078
|
+
|
|
1079
|
+
DataList/DataGrid have built-in noDataMessage that wraps EmptyState \u2014 use that prop instead of conditional rendering.
|
|
1080
|
+
|
|
1081
|
+
ANTI-PATTERNS:
|
|
1082
|
+
\u2717 Showing EmptyState during loading (confuses users into thinking data is missing)
|
|
1083
|
+
\u2717 EmptyState without action when user can fix it ("Create your first X" button)
|
|
1084
|
+
\u2717 Cluttered EmptyState (too much text/multiple CTAs) \u2014 keep one primary action`
|
|
1085
|
+
);
|
|
505
1086
|
var numberInputPropsSchema = z.object({
|
|
506
1087
|
variant: z.enum(["basic", "bind"]).default("basic").describe("Variant: basic (right chevron arrows) or bind (left/right +/- buttons)"),
|
|
507
1088
|
value: z.union([z.number(), z.string()]).optional().describe("Current value"),
|
|
@@ -528,7 +1109,17 @@ var numberInputPropsSchema = z.object({
|
|
|
528
1109
|
onFocus: z.any().optional().describe("Focus callback"),
|
|
529
1110
|
className: z.string().optional().describe("Style override")
|
|
530
1111
|
}).describe(
|
|
531
|
-
|
|
1112
|
+
`Number input with two variants: basic (chevron arrows) and bind (+/- buttons). Supports label, description, max display (click to fill), accelerated increment on long press. numberInputBind(ref, direction) binds acceleration to external buttons.
|
|
1113
|
+
|
|
1114
|
+
WHEN TO USE:
|
|
1115
|
+
\u2022 Any numeric field \u2014 quantity, score, age, count
|
|
1116
|
+
\u2022 Currency with thousand separators \u2192 PriceInput instead
|
|
1117
|
+
\u2022 Date / time \u2192 DatePicker instead
|
|
1118
|
+
|
|
1119
|
+
ANTI-PATTERNS:
|
|
1120
|
+
\u2717 <TextInput type="number"> \u2192 <NumberInput> (loses keyboard \u2191\u2193, step, accelerated long-press, max click)
|
|
1121
|
+
\u2717 Custom +/- buttons + <input> \u2192 variant="bind" (or numberInputBind for external)
|
|
1122
|
+
\u2717 Manual thousand separators for currency \u2192 PriceInput`
|
|
532
1123
|
);
|
|
533
1124
|
var priceInputPropsSchema = z.object({
|
|
534
1125
|
size: z.enum(["md", "lg", "xl"]).default("md").describe("Size"),
|
|
@@ -551,7 +1142,20 @@ var priceInputPropsSchema = z.object({
|
|
|
551
1142
|
onBalanceClick: z.any().optional().describe("Balance click callback (balance: string | number) => void"),
|
|
552
1143
|
className: z.string().optional().describe("Style override")
|
|
553
1144
|
}).describe(
|
|
554
|
-
|
|
1145
|
+
`PriceInput \u2014 currency / amount input with prefix, suffix, balance display, click-to-fill.
|
|
1146
|
+
|
|
1147
|
+
WHEN TO USE:
|
|
1148
|
+
\u2022 Money / token amounts: payment, transfer, swap, withdraw
|
|
1149
|
+
\u2022 Need balance hint with auto-fill UX (set balance + onBalanceClick)
|
|
1150
|
+
\u2022 Pure number (count, age, score) \u2192 NumberInput
|
|
1151
|
+
\u2022 Generic text \u2192 TextInput
|
|
1152
|
+
|
|
1153
|
+
separator=true displays commas; onValueChange always returns raw value (no commas). maxBalance auto-applies error styling on overflow.
|
|
1154
|
+
|
|
1155
|
+
ANTI-PATTERNS:
|
|
1156
|
+
\u2717 <TextInput type="number"> + manual currency formatting \u2192 PriceInput
|
|
1157
|
+
\u2717 NumberInput for currency (loses prefix/suffix/balance UX)
|
|
1158
|
+
\u2717 Using string input for amounts then parseFloat \u2014 lose precision; use this component`
|
|
555
1159
|
);
|
|
556
1160
|
var dataListPropsSchema = z.object({
|
|
557
1161
|
list: z.array(z.any()).nullable().describe("Data array to render. null = loading state (required)"),
|
|
@@ -564,7 +1168,58 @@ var dataListPropsSchema = z.object({
|
|
|
564
1168
|
children: z.any().describe("Item render function: ({ item, index }) => ReactNode (required)"),
|
|
565
1169
|
className: z.string().optional().describe("Root element style")
|
|
566
1170
|
}).describe(
|
|
567
|
-
|
|
1171
|
+
`DataList \u2014 render-prop list that handles loading / skeleton / empty / error / data in one component. Built-in ErrorBoundary.
|
|
1172
|
+
|
|
1173
|
+
WHEN TO USE:
|
|
1174
|
+
\u2022 Any async list (<200 items) \u2014 feed, comments, dashboard rows
|
|
1175
|
+
\u2022 Pass list={null} during loading (auto-shows skeleton/spinner)
|
|
1176
|
+
\u2022 Pass list=[] for empty state (auto-shows noDataMessage)
|
|
1177
|
+
\u2022 Card grid \u2192 DataGrid (same API + columns prop)
|
|
1178
|
+
\u2022 Huge dataset \u2192 VirtualList
|
|
1179
|
+
|
|
1180
|
+
children is render fn: ({ item, index }) => ReactNode.
|
|
1181
|
+
|
|
1182
|
+
ANTI-PATTERNS:
|
|
1183
|
+
\u2717 Manual if (loading) {...} else if (!data.length) {...} chains \u2192 DataList handles all
|
|
1184
|
+
\u2717 DataList without skeletonElement when component shape is known (use Skeleton)
|
|
1185
|
+
\u2717 list=undefined (treated as data, not loading) \u2014 use null for loading`
|
|
1186
|
+
);
|
|
1187
|
+
var responsiveColumnsSchema = z.object({
|
|
1188
|
+
base: z.number().optional().describe("Default column count (mobile-first)"),
|
|
1189
|
+
sm: z.number().optional().describe(">= 640px"),
|
|
1190
|
+
md: z.number().optional().describe(">= 768px"),
|
|
1191
|
+
lg: z.number().optional().describe(">= 1024px"),
|
|
1192
|
+
xl: z.number().optional().describe(">= 1280px"),
|
|
1193
|
+
"2xl": z.number().optional().describe(">= 1536px")
|
|
1194
|
+
});
|
|
1195
|
+
var dataGridPropsSchema = z.object({
|
|
1196
|
+
list: z.array(z.any()).nullable().describe("Data array to render. null = loading state (required)"),
|
|
1197
|
+
columns: z.union([z.number(), responsiveColumnsSchema]).describe(
|
|
1198
|
+
"Column count. number = fixed | { base, sm, md, lg, xl, 2xl } = responsive (required)"
|
|
1199
|
+
),
|
|
1200
|
+
gap: z.union([z.number(), z.string()]).optional().describe("Item gap. number = px | string = CSS value"),
|
|
1201
|
+
noDataMessage: z.any().optional().describe("Message for empty array (string | ReactElement)"),
|
|
1202
|
+
errorFallback: z.any().optional().describe("Fallback on error (ReactNode)"),
|
|
1203
|
+
loadingElement: z.any().optional().describe("Custom loading element (default: Spinner)"),
|
|
1204
|
+
skeletonElement: z.any().optional().describe("Skeleton element during loading (ReactElement)"),
|
|
1205
|
+
skeletonCount: z.number().default(3).describe("Skeleton repeat count"),
|
|
1206
|
+
loading: z.boolean().default(false).describe("Force loading state"),
|
|
1207
|
+
children: z.any().describe("Item render function: ({ item, index }) => ReactNode (required)"),
|
|
1208
|
+
className: z.string().optional().describe("Root element style")
|
|
1209
|
+
}).describe(
|
|
1210
|
+
`DataGrid \u2014 card grid version of DataList with responsive columns. Built-in ErrorBoundary, loading/skeleton/empty/error states.
|
|
1211
|
+
|
|
1212
|
+
WHEN TO USE:
|
|
1213
|
+
\u2022 Card grids: products, gallery, team members, posts
|
|
1214
|
+
\u2022 Need responsive column count \u2192 pass { base: 1, sm: 2, lg: 3, xl: 4 }
|
|
1215
|
+
\u2022 Single column / row layout \u2192 DataList
|
|
1216
|
+
\u2022 Tabular data \u2192 table component (not DataGrid)
|
|
1217
|
+
\u2022 Huge dataset \u2192 VirtualGrid
|
|
1218
|
+
|
|
1219
|
+
ANTI-PATTERNS:
|
|
1220
|
+
\u2717 Tabular data forced into card grid (use a table)
|
|
1221
|
+
\u2717 Hardcoded column count for responsive layouts \u2192 use responsive object
|
|
1222
|
+
\u2717 Manual loading/empty handling \u2192 DataGrid does it`
|
|
568
1223
|
);
|
|
569
1224
|
var animationOptionsSchema = z.object({
|
|
570
1225
|
name: z.string().optional().describe("Animation name"),
|
|
@@ -603,7 +1258,22 @@ var modalTemplatePropsSchema = z.object({
|
|
|
603
1258
|
dimClassName: z.string().optional().describe("Dim overlay style"),
|
|
604
1259
|
headerClassName: z.string().optional().describe("Header area style")
|
|
605
1260
|
}).describe(
|
|
606
|
-
|
|
1261
|
+
`Modal template. All modal components must be wrapped with ModalTemplate.
|
|
1262
|
+
|
|
1263
|
+
WHEN TO USE:
|
|
1264
|
+
\u2022 Force user decision (delete confirm, submit confirm, blocking dialog)
|
|
1265
|
+
\u2022 Long form/flow that needs full attention
|
|
1266
|
+
\u2022 Side panel that doesn't block main flow \u2192 Drawer instead
|
|
1267
|
+
\u2022 Inline contextual UI \u2192 Popover instead
|
|
1268
|
+
\u2022 Short hint \u2192 Tooltip instead
|
|
1269
|
+
|
|
1270
|
+
PREFERRED API: use modal() / useModal() imperative API rather than mounting <ModalTemplate> directly. modal() handles stacking, focus return, ESC, and background scroll automatically.
|
|
1271
|
+
|
|
1272
|
+
ANTI-PATTERNS:
|
|
1273
|
+
\u2717 Custom <div className="fixed inset-0"> \u2192 modal() (loses focus trap, a11y)
|
|
1274
|
+
\u2717 Direct <ModalTemplate> mount in render tree \u2192 wrap with modal()
|
|
1275
|
+
\u2717 Modal with no title for screen readers \u2192 always pass title prop
|
|
1276
|
+
\u2717 Multiple modals stacking confusingly \u2192 use isAlone:true to close prior modals`
|
|
607
1277
|
);
|
|
608
1278
|
var modalCallSchema = z.object({
|
|
609
1279
|
component: z.any().describe("Modal component (required). Automatically receives close/resolve as props"),
|
|
@@ -634,24 +1304,39 @@ var errorBoundaryPropsSchema = z.object({
|
|
|
634
1304
|
children: z.any().describe("Child elements to wrap (ReactNode, required)"),
|
|
635
1305
|
fallback: z.any().optional().describe("Fallback UI on error (ReactNode)"),
|
|
636
1306
|
onError: z.any().optional().describe("Error callback (error: Error, errorInfo: ErrorInfo) => void")
|
|
637
|
-
}).describe(
|
|
1307
|
+
}).describe(
|
|
1308
|
+
`ErrorBoundary \u2014 catches render-time errors in subtree and shows fallback UI.
|
|
1309
|
+
|
|
1310
|
+
WHEN TO USE:
|
|
1311
|
+
\u2022 Wrap risky areas: third-party widgets, dynamic imports, untrusted content rendering
|
|
1312
|
+
\u2022 Async errors / promise rejections \u2192 NOT caught (use try/catch in handlers)
|
|
1313
|
+
\u2022 Per-route error wrapping \u2192 use framework's error.tsx (Next.js) where possible
|
|
1314
|
+
|
|
1315
|
+
DataList / DataGrid have ErrorBoundary built-in \u2014 don't double-wrap.
|
|
1316
|
+
|
|
1317
|
+
ANTI-PATTERNS:
|
|
1318
|
+
\u2717 ErrorBoundary at app root only \u2014 granular boundaries give better UX (one widget fails, page survives)
|
|
1319
|
+
\u2717 Showing raw Error.message in production (leak risk) \u2014 use friendly fallback
|
|
1320
|
+
\u2717 Forgetting onError logging \u2192 silent failures in production`
|
|
1321
|
+
);
|
|
638
1322
|
var clientOnlyPropsSchema = z.object({
|
|
639
1323
|
children: z.any().describe("Element to render only on client (ReactNode, required)"),
|
|
640
1324
|
fallback: z.any().optional().describe("Fallback UI during SSR (ReactNode, default: null)")
|
|
641
|
-
}).describe(
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
1325
|
+
}).describe(
|
|
1326
|
+
`ClientOnly \u2014 defers children to client-side render, preventing SSR hydration mismatch.
|
|
1327
|
+
|
|
1328
|
+
WHEN TO USE:
|
|
1329
|
+
\u2022 Wrap components that read window/document/localStorage at render time
|
|
1330
|
+
\u2022 Components depending on browser-only APIs (IntersectionObserver eager init, geolocation)
|
|
1331
|
+
\u2022 Server-renderable content \u2192 DON'T wrap (loses SEO/SSR perf benefits)
|
|
1332
|
+
\u2022 Conditional based on data \u2192 use proper SSR-safe state instead
|
|
1333
|
+
|
|
1334
|
+
Pass fallback to avoid layout shift during hydration.
|
|
1335
|
+
|
|
1336
|
+
ANTI-PATTERNS:
|
|
1337
|
+
\u2717 Wrapping the entire page in ClientOnly (defeats SSR)
|
|
1338
|
+
\u2717 ClientOnly without fallback for above-the-fold UI (CLS)
|
|
1339
|
+
\u2717 Using ClientOnly to "fix" any hydration warning \u2014 root-cause the mismatch first`
|
|
655
1340
|
);
|
|
656
1341
|
var tablePropsSchema = z.object({
|
|
657
1342
|
list: z.array(z.any()).nullable().describe("Data array. null/undefined = loading state (required)"),
|
|
@@ -668,14 +1353,35 @@ var tablePropsSchema = z.object({
|
|
|
668
1353
|
className: z.string().optional().describe("Table wrapper style"),
|
|
669
1354
|
theadClassName: z.string().optional().describe("Header row style")
|
|
670
1355
|
}).describe(
|
|
671
|
-
|
|
1356
|
+
`Table \u2014 tabular data with sortable columns, skeleton/loading/empty states. Compound: TableRow + TdColumn.
|
|
1357
|
+
|
|
1358
|
+
WHEN TO USE:
|
|
1359
|
+
\u2022 Comparable structured data (financial reports, transaction history, leaderboard)
|
|
1360
|
+
\u2022 Sortable per-column \u2192 enableSorting on TdColumn
|
|
1361
|
+
\u2022 Card-style entities \u2192 DataGrid
|
|
1362
|
+
\u2022 Single-column read-only list \u2192 DataList
|
|
1363
|
+
\u2022 Huge dataset (>500 rows) \u2192 wrap with VirtualList logic or paginate
|
|
1364
|
+
|
|
1365
|
+
list={null} \u2192 loading state. list=[] \u2192 noDataMsg. children: ({ item, index }) => <TableRow>...</TableRow>.
|
|
1366
|
+
|
|
1367
|
+
ANTI-PATTERNS:
|
|
1368
|
+
\u2717 Native <table> + manual loading/empty handling \u2192 Table component
|
|
1369
|
+
\u2717 Forcing card-style data into Table (use DataGrid)
|
|
1370
|
+
\u2717 Sorting in client when server pagination is in use \u2192 server-side sort`
|
|
672
1371
|
);
|
|
673
1372
|
var tableRowPropsSchema = z.object({
|
|
674
1373
|
variant: z.enum(["default", "accent"]).default("default").describe("Row style"),
|
|
675
1374
|
className: z.string().optional().describe("Style override"),
|
|
676
1375
|
children: z.any().describe("TdColumn list (ReactNode, required)"),
|
|
677
1376
|
onClick: z.any().optional().describe("Row click callback (e: MouseEvent) => void")
|
|
678
|
-
}).describe(
|
|
1377
|
+
}).describe(
|
|
1378
|
+
`TableRow \u2014 a single row inside Table. Wraps TdColumn cells.
|
|
1379
|
+
|
|
1380
|
+
WHEN TO USE:
|
|
1381
|
+
\u2022 variant="accent" highlights selected/current row
|
|
1382
|
+
\u2022 onClick for row-level navigation (e.g. open detail page)
|
|
1383
|
+
\u2022 Per-row checkbox/action \u2192 place inside a TdColumn child`
|
|
1384
|
+
);
|
|
679
1385
|
var tdColumnPropsSchema = z.object({
|
|
680
1386
|
label: z.any().optional().describe("Header label (ReactElement | string)"),
|
|
681
1387
|
fieldId: z.string().nullable().describe("Column identifier (sort key, required)"),
|
|
@@ -693,7 +1399,20 @@ var tdColumnPropsSchema = z.object({
|
|
|
693
1399
|
handleClickSort: z.any().optional().describe("Sort click callback ({ index, fieldId, order }) => void"),
|
|
694
1400
|
children: z.any().describe("Cell content (ReactNode, required)"),
|
|
695
1401
|
className: z.string().optional().describe("Style override")
|
|
696
|
-
}).describe(
|
|
1402
|
+
}).describe(
|
|
1403
|
+
`TdColumn \u2014 table cell. Drives both <th> and <td> for the column. Provides sorting, alignment, overflow handling.
|
|
1404
|
+
|
|
1405
|
+
WHEN TO USE:
|
|
1406
|
+
\u2022 textOverflow="truncate" (default) for fixed-width columns; "wrap" for narrative
|
|
1407
|
+
\u2022 align="right" for numeric/currency columns (a11y readability)
|
|
1408
|
+
\u2022 enableSorting=true when column is sortable; supply order + handleClickSort for controlled sort
|
|
1409
|
+
\u2022 highlightKey to group columns that highlight together on hover
|
|
1410
|
+
|
|
1411
|
+
ANTI-PATTERNS:
|
|
1412
|
+
\u2717 enableSorting without handleClickSort \u2192 sort indicator is dead
|
|
1413
|
+
\u2717 align="left" for currency/number columns
|
|
1414
|
+
\u2717 Mixing text and numeric in one column without consistent align`
|
|
1415
|
+
);
|
|
697
1416
|
var toastOptionsSchema = z.object({
|
|
698
1417
|
description: z.any().optional().describe("Toast subtitle (ReactNode)"),
|
|
699
1418
|
duration: z.number().optional().describe("Auto-dismiss duration (ms). Default 4000"),
|
|
@@ -719,7 +1438,20 @@ var toastOptionsSchema = z.object({
|
|
|
719
1438
|
unstyled: z.boolean().optional().describe("Remove default styles (for custom styling)"),
|
|
720
1439
|
id: z.union([z.string(), z.number()]).optional().describe("Toast ID (for deduplication or updates)")
|
|
721
1440
|
}).describe(
|
|
722
|
-
|
|
1441
|
+
`toast() options. Used as toast(message, options) / toast.success / .error / .warning / .info / .promise / .custom(jsx).
|
|
1442
|
+
|
|
1443
|
+
WHEN TO USE TOAST:
|
|
1444
|
+
\u2022 Transient feedback after user action: "Saved", "Copied", "Network error"
|
|
1445
|
+
\u2022 Persistent in-page banner \u2192 Alert
|
|
1446
|
+
\u2022 Critical destructive confirmation \u2192 Modal (toast can be missed)
|
|
1447
|
+
\u2022 Form field error \u2192 use error/description prop on the input
|
|
1448
|
+
|
|
1449
|
+
richColors=true gives strong success/error/warning/info colors. Use action for "Undo" patterns.
|
|
1450
|
+
|
|
1451
|
+
ANTI-PATTERNS:
|
|
1452
|
+
\u2717 Toast for confirmation that user MUST acknowledge \u2192 Modal
|
|
1453
|
+
\u2717 Stacking many toasts \u2192 set visibleToasts on Toaster
|
|
1454
|
+
\u2717 Long-form content in toast (toast is for short messages)`
|
|
723
1455
|
);
|
|
724
1456
|
var toasterPropsSchema = z.object({
|
|
725
1457
|
position: z.enum([
|
|
@@ -741,7 +1473,17 @@ var toasterPropsSchema = z.object({
|
|
|
741
1473
|
offset: z.any().optional().describe("Offset from screen edge. string | number | { top, right, bottom, left }"),
|
|
742
1474
|
dir: z.enum(["ltr", "rtl", "auto"]).optional().describe("Text direction")
|
|
743
1475
|
}).describe(
|
|
744
|
-
|
|
1476
|
+
`Toaster \u2014 toast container. Mount ONCE at app root. Then call toast() anywhere. Based on sonner.
|
|
1477
|
+
|
|
1478
|
+
WHEN TO USE:
|
|
1479
|
+
\u2022 Mount in app shell (layout.tsx / _app.tsx) \u2014 exactly one instance globally
|
|
1480
|
+
\u2022 Set position once here; per-toast position only when needed
|
|
1481
|
+
\u2022 Provide visibleToasts cap to avoid stacking
|
|
1482
|
+
|
|
1483
|
+
ANTI-PATTERNS:
|
|
1484
|
+
\u2717 Multiple Toasters across pages \u2014 only one global Toaster
|
|
1485
|
+
\u2717 Mounting Toaster inside conditional render \u2014 toasts vanish on remount
|
|
1486
|
+
\u2717 Forgetting Toaster mount \u2014 toast() calls do nothing`
|
|
745
1487
|
);
|
|
746
1488
|
var tagInputPropsSchema = z.object({
|
|
747
1489
|
value: z.array(z.string()).optional().describe("Controlled tags array"),
|
|
@@ -755,7 +1497,22 @@ var tagInputPropsSchema = z.object({
|
|
|
755
1497
|
description: z.string().optional().describe("Helper text below input"),
|
|
756
1498
|
size: z.enum(["sm", "md", "lg"]).default("md").describe("Size"),
|
|
757
1499
|
className: z.string().optional().describe("Style override")
|
|
758
|
-
}).describe(
|
|
1500
|
+
}).describe(
|
|
1501
|
+
`TagInput \u2014 free-form multi-value entry (Enter to add, Backspace to remove last).
|
|
1502
|
+
|
|
1503
|
+
WHEN TO USE:
|
|
1504
|
+
\u2022 Free-form labels: skills, hashtags, email recipients, keywords
|
|
1505
|
+
\u2022 Predefined options \u2192 Combobox with multi-select (NOT TagInput)
|
|
1506
|
+
\u2022 Single value \u2192 TextInput
|
|
1507
|
+
\u2022 Limited options \u2192 Select / RadioGroup / Checkbox
|
|
1508
|
+
|
|
1509
|
+
allowDuplicates=false (default) prevents repeats. Use max to cap count.
|
|
1510
|
+
|
|
1511
|
+
ANTI-PATTERNS:
|
|
1512
|
+
\u2717 TagInput for predefined taxonomy \u2192 Combobox (controlled options)
|
|
1513
|
+
\u2717 TagInput without max for spam-prone fields
|
|
1514
|
+
\u2717 Custom comma-split string field \u2192 TagInput (proper UX + a11y)`
|
|
1515
|
+
);
|
|
759
1516
|
var nxImagePropsSchema = z.object({
|
|
760
1517
|
src: z.string().optional().describe("Image source URL"),
|
|
761
1518
|
alt: z.string().optional().describe("Alt text"),
|
|
@@ -766,7 +1523,22 @@ var nxImagePropsSchema = z.object({
|
|
|
766
1523
|
lazy: z.boolean().default(true).describe('Enable lazy loading (loading="lazy")'),
|
|
767
1524
|
wrapperClassName: z.string().optional().describe("Wrapper div style"),
|
|
768
1525
|
className: z.string().optional().describe("Image element style")
|
|
769
|
-
}).describe(
|
|
1526
|
+
}).describe(
|
|
1527
|
+
`NxImage \u2014 lazy-loaded <img> with fallback, fixed aspect-ratio, object-fit. Always prefer over native <img>.
|
|
1528
|
+
|
|
1529
|
+
WHEN TO USE:
|
|
1530
|
+
\u2022 Content images: covers, banners, illustrations, hero images
|
|
1531
|
+
\u2022 Profile/user avatar (with text fallback) \u2192 Avatar
|
|
1532
|
+
\u2022 Background image / decorative \u2192 CSS bg-image
|
|
1533
|
+
\u2022 Need Next.js optimization \u2192 use next/image directly (NxImage doesn't optimize)
|
|
1534
|
+
|
|
1535
|
+
aspectRatio reserves space, preventing CLS (layout shift).
|
|
1536
|
+
|
|
1537
|
+
ANTI-PATTERNS:
|
|
1538
|
+
\u2717 <img> with manual onError handling \u2192 NxImage (built-in fallback)
|
|
1539
|
+
\u2717 NxImage without alt for content images (a11y violation)
|
|
1540
|
+
\u2717 NxImage without aspectRatio in fluid layouts \u2192 CLS jank`
|
|
1541
|
+
);
|
|
770
1542
|
var datePickerPropsSchema = z.object({
|
|
771
1543
|
value: z.any().optional().describe("Controlled date value (Date)"),
|
|
772
1544
|
defaultValue: z.any().optional().describe("Default date (Date)"),
|
|
@@ -778,7 +1550,22 @@ var datePickerPropsSchema = z.object({
|
|
|
778
1550
|
locale: z.enum(["ko", "en"]).default("ko").describe("Calendar locale"),
|
|
779
1551
|
formatStr: z.string().default("yyyy-MM-dd").describe("Date format string (date-fns format)"),
|
|
780
1552
|
className: z.string().optional().describe("Style override")
|
|
781
|
-
}).describe(
|
|
1553
|
+
}).describe(
|
|
1554
|
+
`DatePicker \u2014 calendar popup for date selection. Based on react-day-picker.
|
|
1555
|
+
|
|
1556
|
+
WHEN TO USE:
|
|
1557
|
+
\u2022 Single date selection: birthday, due date, appointment
|
|
1558
|
+
\u2022 Date range \u2192 use two DatePickers with minDate/maxDate cross-bound
|
|
1559
|
+
\u2022 Time selection \u2192 not yet supported; use TextInput with type="time" + DatePicker combo
|
|
1560
|
+
\u2022 Quick relative ranges (Today/Last 7 days) \u2192 DropdownMenu of preset Buttons + DatePicker for "Custom"
|
|
1561
|
+
|
|
1562
|
+
minDate/maxDate disable out-of-range dates. locale="ko" for Korean labels.
|
|
1563
|
+
|
|
1564
|
+
ANTI-PATTERNS:
|
|
1565
|
+
\u2717 Native <input type="date"> for branded UI (inconsistent across browsers) \u2192 DatePicker
|
|
1566
|
+
\u2717 Free-text date with parsing \u2192 DatePicker (consistent UX)
|
|
1567
|
+
\u2717 DatePicker without minDate for past-date-invalid fields (e.g. booking)`
|
|
1568
|
+
);
|
|
782
1569
|
var imageUploadPropsSchema = z.object({
|
|
783
1570
|
value: z.string().nullable().optional().describe("Controlled image URL (string | null)"),
|
|
784
1571
|
defaultValue: z.string().optional().describe("Default image URL"),
|
|
@@ -794,7 +1581,19 @@ var imageUploadPropsSchema = z.object({
|
|
|
794
1581
|
size: z.enum(["sm", "md", "lg"]).default("md").describe("Upload area size"),
|
|
795
1582
|
className: z.string().optional().describe("Style override")
|
|
796
1583
|
}).describe(
|
|
797
|
-
|
|
1584
|
+
`ImageUpload \u2014 drag-and-drop image upload with preview, file-type/size validation, label/description.
|
|
1585
|
+
|
|
1586
|
+
WHEN TO USE:
|
|
1587
|
+
\u2022 Single image upload: avatar, cover, KYC document, post thumbnail
|
|
1588
|
+
\u2022 Multiple files / non-image \u2192 not yet supported; build custom or use a file dropzone
|
|
1589
|
+
\u2022 Inline image picker without preview \u2192 custom <input type="file">
|
|
1590
|
+
|
|
1591
|
+
accept whitelist + maxSize together cover validation. onError fires with i18n-ready string.
|
|
1592
|
+
|
|
1593
|
+
ANTI-PATTERNS:
|
|
1594
|
+
\u2717 <input type="file"> + manual preview \u2192 ImageUpload (handles drag, validation, preview)
|
|
1595
|
+
\u2717 ImageUpload without onError handler \u2192 silent failure on validation reject
|
|
1596
|
+
\u2717 Storing image as data-URL value (use File via onChange and upload to server)`
|
|
798
1597
|
);
|
|
799
1598
|
|
|
800
|
-
export { accordionPropsSchema, alertPropsSchema, avatarPropsSchema, badgePropsSchema, breadcrumbPropsSchema, buttonPropsSchema, carouselButtonPropsSchema, carouselDotsPropsSchema, carouselPropsSchema, carouselSlidePropsSchema, checkBoxPropsSchema, chipPropsSchema, clientOnlyPropsSchema, countdownPropsSchema, counterPropsSchema, dataListPropsSchema, datePickerPropsSchema, dividerPropsSchema, drawerClosePropsSchema, drawerContentPropsSchema, drawerDescriptionPropsSchema, drawerPropsSchema, drawerTitlePropsSchema, drawerTriggerPropsSchema, dropdownMenuPropsSchema, ellipsisPropsSchema, emptyStatePropsSchema, errorBoundaryPropsSchema, imageUploadPropsSchema, infiniteScrollPropsSchema, marqueePropsSchema, modalCallSchema, modalTemplatePropsSchema, numberInputPropsSchema, nxImagePropsSchema, paginationPropsSchema, popoverPropsSchema, priceInputPropsSchema, progressPropsSchema, radioGroupPropsSchema, radioItemPropsSchema, selectItemPropsSchema, selectPropsSchema, skeletonPropsSchema, sliderPropsSchema, spinnerPropsSchema, stepperPropsSchema, switchPropsSchema, tabPropsSchema, tablePropsSchema, tableRowPropsSchema, tagInputPropsSchema, tdColumnPropsSchema, textAreaPropsSchema, textInputPropsSchema,
|
|
1599
|
+
export { accordionPropsSchema, alertPropsSchema, avatarPropsSchema, badgePropsSchema, breadcrumbPropsSchema, buttonPropsSchema, carouselButtonPropsSchema, carouselDotsPropsSchema, carouselPropsSchema, carouselSlidePropsSchema, checkBoxPropsSchema, chipPropsSchema, clientOnlyPropsSchema, comboboxOptionSchema, comboboxPropsSchema, countdownPropsSchema, counterPropsSchema, dataGridPropsSchema, dataListPropsSchema, datePickerPropsSchema, dividerPropsSchema, drawerClosePropsSchema, drawerContentPropsSchema, drawerDescriptionPropsSchema, drawerPropsSchema, drawerTitlePropsSchema, drawerTriggerPropsSchema, dropdownMenuPropsSchema, ellipsisPropsSchema, emptyStatePropsSchema, errorBoundaryPropsSchema, imageUploadPropsSchema, infiniteScrollPropsSchema, marqueePropsSchema, modalCallSchema, modalTemplatePropsSchema, numberInputPropsSchema, nxImagePropsSchema, paginationPropsSchema, popoverPropsSchema, priceInputPropsSchema, progressPropsSchema, radioGroupPropsSchema, radioItemPropsSchema, selectItemPropsSchema, selectPropsSchema, skeletonPropsSchema, sliderPropsSchema, spinnerPropsSchema, stepperPropsSchema, switchPropsSchema, tabPropsSchema, tablePropsSchema, tableRowPropsSchema, tagInputPropsSchema, tdColumnPropsSchema, textAreaPropsSchema, textInputPropsSchema, toastOptionsSchema, toasterPropsSchema, toggleGroupPropsSchema, tooltipPropsSchema, virtualGridPropsSchema, virtualListPropsSchema };
|