@skunkworksai/ui-kit 0.1.18 → 0.1.25-a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/README.md +2 -0
- package/dist/index.cjs +34 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14469 -14225
- package/dist/index.js.map +1 -1
- package/dist/types/assets/icons/DashboardActiveIcon.d.ts +1 -1
- package/dist/types/assets/icons/DashboardIcon.d.ts +1 -1
- package/dist/types/assets/icons/DevicesActiveIcon.d.ts +1 -1
- package/dist/types/assets/icons/DevicesIcon.d.ts +1 -1
- package/dist/types/assets/icons/InstallerActiveIcon.d.ts +1 -1
- package/dist/types/assets/icons/InstallerIcon.d.ts +1 -1
- package/dist/types/assets/icons/ManifestActiveIcon.d.ts +1 -1
- package/dist/types/assets/icons/ManifestIcon.d.ts +1 -1
- package/dist/types/assets/icons/SensorActiveIcon.d.ts +1 -1
- package/dist/types/assets/icons/SensorIcon.d.ts +1 -1
- package/dist/types/assets/icons/SiteActiveIcon.d.ts +1 -1
- package/dist/types/assets/icons/SiteIcon.d.ts +1 -1
- package/dist/types/assets/icons/XrayActiveIcon.d.ts +1 -1
- package/dist/types/assets/icons/XrayIcon.d.ts +1 -1
- package/dist/types/assets/logos/DarkLogo.d.ts +1 -1
- package/dist/types/assets/logos/DarkSymbol.d.ts +1 -1
- package/dist/types/assets/logos/PrimaryLogo.d.ts +1 -1
- package/dist/types/assets/logos/PrimarySymbol.d.ts +1 -1
- package/dist/types/assets/logos/WhiteLogo.d.ts +1 -1
- package/dist/types/assets/logos/WhiteSymbol.d.ts +1 -1
- package/dist/types/components/blocks/AppBentoMenu.d.ts +2 -2
- package/dist/types/components/blocks/AppDashboard.d.ts +9 -3
- package/dist/types/components/blocks/AppHeader.d.ts +6 -6
- package/dist/types/components/blocks/AppLocationTreeFilter.d.ts +1 -1
- package/dist/types/components/blocks/AppNotificationsMenu.d.ts +1 -1
- package/dist/types/components/blocks/AppPageTitle.d.ts +1 -1
- package/dist/types/components/blocks/AppProfile.d.ts +1 -1
- package/dist/types/components/blocks/AppWizardStepper.d.ts +61 -0
- package/dist/types/components/blocks/TableManager.d.ts +36 -14
- package/dist/types/components/blocks/backgrounds/AppDashboardBackgroundDots.d.ts +1 -1
- package/dist/types/components/blocks/backgrounds/AppDashboardBackgroundWave.d.ts +1 -1
- package/dist/types/components/blocks/backgrounds/types.d.ts +2 -0
- package/dist/types/components/blocks/index.d.ts +1 -0
- package/dist/types/components/primitives/AppAccordion.d.ts +4 -4
- package/dist/types/components/primitives/AppAlert.d.ts +1 -1
- package/dist/types/components/primitives/AppAlertDialog.d.ts +2 -2
- package/dist/types/components/primitives/AppAspectRatio.d.ts +1 -1
- package/dist/types/components/primitives/AppAvatar.d.ts +3 -3
- package/dist/types/components/primitives/AppBadge.d.ts +1 -1
- package/dist/types/components/primitives/AppBreadcrumb.d.ts +7 -7
- package/dist/types/components/primitives/AppButton.d.ts +1 -1
- package/dist/types/components/primitives/AppButtonGroup.d.ts +1 -1
- package/dist/types/components/primitives/AppCalendar.d.ts +1 -1
- package/dist/types/components/primitives/AppCard.d.ts +7 -7
- package/dist/types/components/primitives/AppCarousel.d.ts +5 -5
- package/dist/types/components/primitives/AppChart.d.ts +3 -3
- package/dist/types/components/primitives/AppCheckbox.d.ts +1 -1
- package/dist/types/components/primitives/AppCollapsible.d.ts +1 -1
- package/dist/types/components/primitives/AppCombobox.d.ts +7 -7
- package/dist/types/components/primitives/AppCommand.d.ts +9 -9
- package/dist/types/components/primitives/AppContextMenu.d.ts +7 -7
- package/dist/types/components/primitives/AppDataTable.d.ts +2 -1
- package/dist/types/components/primitives/AppDatePicker.d.ts +2 -1
- package/dist/types/components/primitives/AppDialog.d.ts +6 -6
- package/dist/types/components/primitives/AppDrawer.d.ts +3 -3
- package/dist/types/components/primitives/AppDropdownMenu.d.ts +10 -10
- package/dist/types/components/primitives/AppEmpty.d.ts +6 -6
- package/dist/types/components/primitives/AppField.d.ts +10 -10
- package/dist/types/components/primitives/AppForm.d.ts +2 -2
- package/dist/types/components/primitives/AppHoverCard.d.ts +3 -3
- package/dist/types/components/primitives/AppInput.d.ts +10 -1
- package/dist/types/components/primitives/AppKbd.d.ts +2 -2
- package/dist/types/components/primitives/AppLabel.d.ts +1 -1
- package/dist/types/components/primitives/AppMenubar.d.ts +6 -6
- package/dist/types/components/primitives/AppNavigationMenu.d.ts +8 -8
- package/dist/types/components/primitives/AppPagination.d.ts +7 -7
- package/dist/types/components/primitives/AppPopover.d.ts +3 -3
- package/dist/types/components/primitives/AppProgress.d.ts +1 -1
- package/dist/types/components/primitives/AppRadioGroup.d.ts +2 -2
- package/dist/types/components/primitives/AppScrollArea.d.ts +2 -2
- package/dist/types/components/primitives/AppSelect.d.ts +7 -7
- package/dist/types/components/primitives/AppSeparator.d.ts +1 -1
- package/dist/types/components/primitives/AppSheet.d.ts +6 -6
- package/dist/types/components/primitives/AppSidebar.d.ts +24 -24
- package/dist/types/components/primitives/AppSkeleton.d.ts +1 -1
- package/dist/types/components/primitives/AppSwitch.d.ts +1 -1
- package/dist/types/components/primitives/AppTable.d.ts +8 -8
- package/dist/types/components/primitives/AppTabs.d.ts +4 -4
- package/dist/types/components/primitives/AppTextarea.d.ts +7 -1
- package/dist/types/components/primitives/AppThemeProvider.d.ts +2 -2
- package/dist/types/components/primitives/AppToaster.d.ts +1 -1
- package/dist/types/components/primitives/AppToggle.d.ts +1 -1
- package/dist/types/components/primitives/AppTooltip.d.ts +4 -4
- package/dist/types/components/primitives/AppTypography.d.ts +1 -1
- package/dist/types/components/ui/alert-dialog.d.ts +2 -2
- package/dist/types/components/ui/badge.d.ts +1 -1
- package/dist/types/components/ui/breadcrumb.d.ts +2 -2
- package/dist/types/components/ui/button.d.ts +5 -2
- package/dist/types/components/ui/calendar.d.ts +1 -1
- package/dist/types/components/ui/card.d.ts +7 -7
- package/dist/types/components/ui/carousel.d.ts +5 -5
- package/dist/types/components/ui/chart.d.ts +4 -4
- package/dist/types/components/ui/combobox.d.ts +7 -7
- package/dist/types/components/ui/command.d.ts +9 -9
- package/dist/types/components/ui/context-menu.d.ts +1 -1
- package/dist/types/components/ui/dialog.d.ts +2 -2
- package/dist/types/components/ui/drawer.d.ts +2 -2
- package/dist/types/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/types/components/ui/form.d.ts +2 -2
- package/dist/types/components/ui/input.d.ts +1 -1
- package/dist/types/components/ui/label.d.ts +1 -1
- package/dist/types/components/ui/menubar.d.ts +16 -16
- package/dist/types/components/ui/pagination.d.ts +5 -5
- package/dist/types/components/ui/scroll-text.d.ts +1 -1
- package/dist/types/components/ui/sheet.d.ts +2 -2
- package/dist/types/components/ui/sidebar.d.ts +23 -23
- package/dist/types/components/ui/skeleton.d.ts +1 -1
- package/dist/types/components/ui/sonner.d.ts +1 -1
- package/dist/types/hooks/use-page-title.d.ts +10 -1
- package/dist/ui-kit.css +1 -1
- package/package.json +29 -19
- package/rules/button.md +1 -0
- package/rules/dashboard.md +96 -4
- package/rules/header.md +23 -2
- package/rules/input.md +34 -2
- package/rules/pagetitle.md +32 -0
- package/rules/sidebar.md +21 -0
- package/rules/table-manager.md +44 -1
- package/rules/textarea.md +23 -1
- package/rules/wizard-stepper.md +207 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# AppWizardStepper
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/blocks/wizard-stepper
|
|
4
|
+
|
|
5
|
+
**This is a block — import from `blocks/AppWizardStepper`, not `primitives/`.**
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import {
|
|
9
|
+
AppWizardStepper,
|
|
10
|
+
type AppWizardStep,
|
|
11
|
+
type AppWizardStepperProps,
|
|
12
|
+
} from "@skunkworks-ai/ui-kit"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Default | Description |
|
|
18
|
+
|------|------|---------|-------------|
|
|
19
|
+
| `steps` | `AppWizardStep[]` | required | Ordered list of steps. Each step needs a stable `id` and a `label`. |
|
|
20
|
+
| `activeIndex` | `number` | required | 0-based index of the currently active step. Steps before this index are rendered as completed. |
|
|
21
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Layout direction. |
|
|
22
|
+
| `onStepClick` | `(step: AppWizardStep, index: number) => void` | — | Fires when a completed or active step is clicked. Upcoming steps are never interactive. |
|
|
23
|
+
| `hideLabels` | `boolean \| undefined` | `undefined` | Controls label visibility. See tristate values below. |
|
|
24
|
+
| `className` | `string` | — | Extra classes on the root `<ol>`. |
|
|
25
|
+
|
|
26
|
+
### `AppWizardStep` type
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
type AppWizardStep = {
|
|
30
|
+
id: string // Stable identifier used as React key and in onStepClick
|
|
31
|
+
label: string // Displayed step name
|
|
32
|
+
description?: string // Optional sub-label shown under the main label
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### `hideLabels` tristate
|
|
37
|
+
|
|
38
|
+
| Value | Behaviour |
|
|
39
|
+
|-------|-----------|
|
|
40
|
+
| `undefined` (default) | Labels hidden below `md`, visible on `md+` (CSS-only; screen-reader visible at all sizes) |
|
|
41
|
+
| `true` | Always hidden — `sr-only` at all breakpoints |
|
|
42
|
+
| `false` | Always visible — no responsive hiding |
|
|
43
|
+
|
|
44
|
+
## Step states
|
|
45
|
+
|
|
46
|
+
| State | Condition | Visual |
|
|
47
|
+
|-------|-----------|--------|
|
|
48
|
+
| `completed` | `index < activeIndex` | Filled circle with check icon (`--primary` bg) |
|
|
49
|
+
| `active` | `index === activeIndex` | Outlined circle with primary ring (`--primary` border + ring) |
|
|
50
|
+
| `upcoming` | `index > activeIndex` | Muted circle with number (`--muted` bg, `--border` border) |
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
### Horizontal (default)
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
const STEPS: AppWizardStep[] = [
|
|
58
|
+
{ id: "details", label: "Details" },
|
|
59
|
+
{ id: "review", label: "Review" },
|
|
60
|
+
{ id: "confirm", label: "Confirm" },
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
function WizardPage() {
|
|
64
|
+
const [activeIndex, setActiveIndex] = React.useState(0)
|
|
65
|
+
|
|
66
|
+
const handleStepClick = React.useCallback(
|
|
67
|
+
(_step: AppWizardStep, index: number) => setActiveIndex(index),
|
|
68
|
+
[]
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<AppWizardStepper
|
|
73
|
+
steps={STEPS}
|
|
74
|
+
activeIndex={activeIndex}
|
|
75
|
+
onStepClick={handleStepClick}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Vertical
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<AppWizardStepper
|
|
85
|
+
steps={STEPS}
|
|
86
|
+
activeIndex={1}
|
|
87
|
+
orientation="vertical"
|
|
88
|
+
onStepClick={handleStepClick}
|
|
89
|
+
/>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### With descriptions
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
const STEPS: AppWizardStep[] = [
|
|
96
|
+
{ id: "account", label: "Account", description: "Basic info" },
|
|
97
|
+
{ id: "profile", label: "Profile", description: "Personal details" },
|
|
98
|
+
{ id: "done", label: "Done", description: "Review & submit" },
|
|
99
|
+
]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Always show labels
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
<AppWizardStepper steps={STEPS} activeIndex={1} hideLabels={false} />
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Icon-only (always hidden labels)
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
<AppWizardStepper steps={STEPS} activeIndex={1} hideLabels={true} />
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Controlled active index (full wizard flow)
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
function MultiStepForm() {
|
|
118
|
+
const [activeIndex, setActiveIndex] = React.useState(0)
|
|
119
|
+
|
|
120
|
+
const handleNext = () => setActiveIndex((i) => Math.min(i + 1, STEPS.length - 1))
|
|
121
|
+
const handleBack = () => setActiveIndex((i) => Math.max(i - 1, 0))
|
|
122
|
+
|
|
123
|
+
// Gate forward nav yourself — onStepClick only fires for completed/active steps
|
|
124
|
+
const handleStepClick = React.useCallback(
|
|
125
|
+
(_step: AppWizardStep, index: number) => setActiveIndex(index),
|
|
126
|
+
[]
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<div className="space-y-6">
|
|
131
|
+
<AppWizardStepper
|
|
132
|
+
steps={STEPS}
|
|
133
|
+
activeIndex={activeIndex}
|
|
134
|
+
onStepClick={handleStepClick}
|
|
135
|
+
/>
|
|
136
|
+
<StepContent index={activeIndex} />
|
|
137
|
+
<div className="flex gap-2">
|
|
138
|
+
<AppButton variant="outline" onClick={handleBack} disabled={activeIndex === 0}>
|
|
139
|
+
Back
|
|
140
|
+
</AppButton>
|
|
141
|
+
<AppButton onClick={handleNext} disabled={activeIndex === STEPS.length - 1}>
|
|
142
|
+
Next
|
|
143
|
+
</AppButton>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Clickability gate
|
|
151
|
+
|
|
152
|
+
`onStepClick` only fires for steps in `completed` or `active` state. Upcoming steps are rendered as static `<div>` elements — not `<button>` elements — so they cannot be focused or activated. This is intentional: forward navigation must be gated by the parent component.
|
|
153
|
+
|
|
154
|
+
Do not try to navigate forward by clicking an upcoming step indicator — the component will not call `onStepClick` for it.
|
|
155
|
+
|
|
156
|
+
## Accessibility
|
|
157
|
+
|
|
158
|
+
- Root element is `<ol role="list" aria-label="Progress">`
|
|
159
|
+
- Each step is `<li role="listitem">`
|
|
160
|
+
- Active step carries `aria-current="step"`
|
|
161
|
+
- Clickable steps are native `<button type="button">` with `aria-label="Go to step N: Label"`
|
|
162
|
+
- Indicator circles are `aria-hidden="true"` — label text provides the accessible name
|
|
163
|
+
- Labels are `sr-only` on mobile by default, ensuring screen readers always have access to step names regardless of the `hideLabels` setting
|
|
164
|
+
|
|
165
|
+
## Performance
|
|
166
|
+
|
|
167
|
+
Memoize `steps` and `onStepClick` to avoid unnecessary re-renders. `steps` is typically a module-level constant; `onStepClick` should be wrapped in `useCallback`.
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
// ✅ Correct
|
|
171
|
+
const STEPS = [{ id: "a", label: "A" }, { id: "b", label: "B" }] // module scope
|
|
172
|
+
|
|
173
|
+
const handleStepClick = React.useCallback(
|
|
174
|
+
(_step: AppWizardStep, i: number) => setActive(i),
|
|
175
|
+
[]
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
// ❌ Wrong — new array + new function every render
|
|
179
|
+
<AppWizardStepper
|
|
180
|
+
steps={[{ id: "a", label: "A" }]}
|
|
181
|
+
onStepClick={(_s, i) => setActive(i)}
|
|
182
|
+
...
|
|
183
|
+
/>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Token usage
|
|
187
|
+
|
|
188
|
+
| Visual element | Token |
|
|
189
|
+
|----------------|-------|
|
|
190
|
+
| Completed circle fill | `--primary` / `--primary-foreground` |
|
|
191
|
+
| Active circle border + ring | `--primary` / `ring-primary/30` |
|
|
192
|
+
| Upcoming circle fill | `--muted` / `--muted-foreground` |
|
|
193
|
+
| Upcoming circle border | `--border` |
|
|
194
|
+
| Connector line (default) | `--border` |
|
|
195
|
+
| Connector line (completed segment) | `--primary` |
|
|
196
|
+
|
|
197
|
+
## Rules
|
|
198
|
+
|
|
199
|
+
- ✅ Define `steps` at module scope or memoize — avoid recreating the array on every render
|
|
200
|
+
- ✅ Wrap `onStepClick` in `useCallback`
|
|
201
|
+
- ✅ Gate forward navigation yourself — `onStepClick` only fires for completed/active steps
|
|
202
|
+
- ✅ Use `hideLabels={false}` when you always want labels visible regardless of breakpoint
|
|
203
|
+
- ✅ Use `orientation="vertical"` for tall, sidebar-style step flows
|
|
204
|
+
- ❌ Do not attempt to make upcoming steps clickable — the block intentionally blocks this; gate forward nav in the parent
|
|
205
|
+
- ❌ Do not manage the completed/upcoming state externally — derive it from `activeIndex`; steps before it are automatically completed
|
|
206
|
+
- ❌ Do not add custom color classes to the indicator circle — all step colors come from design tokens
|
|
207
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|