@devalok/shilp-sutra 0.18.1 → 0.18.2
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/docs/components/_header.md +83 -0
- package/docs/components/composed/activity-feed.md +43 -0
- package/docs/components/composed/avatar-group.md +32 -0
- package/docs/components/composed/command-palette.md +40 -0
- package/docs/components/composed/confirm-dialog.md +46 -0
- package/docs/components/composed/content-card.md +36 -0
- package/docs/components/composed/date-picker.md +130 -0
- package/docs/components/composed/empty-state.md +53 -0
- package/docs/components/composed/error-boundary.md +29 -0
- package/docs/components/composed/global-loading.md +27 -0
- package/docs/components/composed/loading-skeleton.md +51 -0
- package/docs/components/composed/member-picker.md +35 -0
- package/docs/components/composed/page-header.md +41 -0
- package/docs/components/composed/page-skeletons.md +32 -0
- package/docs/components/composed/priority-indicator.md +32 -0
- package/docs/components/composed/rich-text-editor.md +71 -0
- package/docs/components/composed/schedule-view.md +39 -0
- package/docs/components/composed/simple-tooltip.md +33 -0
- package/docs/components/composed/status-badge.md +41 -0
- package/docs/components/shell/app-command-palette.md +44 -0
- package/docs/components/shell/bottom-navbar.md +48 -0
- package/docs/components/shell/command-registry.md +48 -0
- package/docs/components/shell/link-context.md +41 -0
- package/docs/components/shell/notification-center.md +63 -0
- package/docs/components/shell/notification-preferences.md +42 -0
- package/docs/components/shell/sidebar.md +88 -0
- package/docs/components/shell/top-bar.md +63 -0
- package/docs/components/ui/accordion.md +48 -0
- package/docs/components/ui/alert-dialog.md +58 -0
- package/docs/components/ui/alert.md +43 -0
- package/docs/components/ui/aspect-ratio.md +25 -0
- package/docs/components/ui/autocomplete.md +48 -0
- package/docs/components/ui/avatar.md +34 -0
- package/docs/components/ui/badge.md +48 -0
- package/docs/components/ui/banner.md +35 -0
- package/docs/components/ui/breadcrumb.md +37 -0
- package/docs/components/ui/button-group.md +32 -0
- package/docs/components/ui/button.md +55 -0
- package/docs/components/ui/card.md +48 -0
- package/docs/components/ui/charts.md +43 -0
- package/docs/components/ui/checkbox.md +31 -0
- package/docs/components/ui/chip.md +43 -0
- package/docs/components/ui/code.md +28 -0
- package/docs/components/ui/collapsible.md +40 -0
- package/docs/components/ui/color-input.md +37 -0
- package/docs/components/ui/combobox.md +54 -0
- package/docs/components/ui/container.md +26 -0
- package/docs/components/ui/context-menu.md +43 -0
- package/docs/components/ui/data-table-toolbar.md +44 -0
- package/docs/components/ui/data-table.md +91 -0
- package/docs/components/ui/dialog.md +51 -0
- package/docs/components/ui/dropdown-menu.md +45 -0
- package/docs/components/ui/file-upload.md +41 -0
- package/docs/components/ui/form.md +51 -0
- package/docs/components/ui/hover-card.md +32 -0
- package/docs/components/ui/icon-button.md +33 -0
- package/docs/components/ui/input-otp.md +44 -0
- package/docs/components/ui/input.md +48 -0
- package/docs/components/ui/label.md +25 -0
- package/docs/components/ui/link.md +29 -0
- package/docs/components/ui/menubar.md +44 -0
- package/docs/components/ui/navigation-menu.md +46 -0
- package/docs/components/ui/number-input.md +44 -0
- package/docs/components/ui/pagination.md +48 -0
- package/docs/components/ui/popover.md +30 -0
- package/docs/components/ui/progress.md +29 -0
- package/docs/components/ui/radio.md +34 -0
- package/docs/components/ui/search-input.md +43 -0
- package/docs/components/ui/segmented-control.md +50 -0
- package/docs/components/ui/select.md +49 -0
- package/docs/components/ui/separator.md +29 -0
- package/docs/components/ui/sheet.md +47 -0
- package/docs/components/ui/sidebar.md +72 -0
- package/docs/components/ui/skeleton.md +77 -0
- package/docs/components/ui/slider.md +29 -0
- package/docs/components/ui/spinner.md +50 -0
- package/docs/components/ui/stack.md +39 -0
- package/docs/components/ui/stat-card.md +61 -0
- package/docs/components/ui/stepper.md +49 -0
- package/docs/components/ui/switch.md +34 -0
- package/docs/components/ui/table.md +47 -0
- package/docs/components/ui/tabs.md +56 -0
- package/docs/components/ui/text.md +37 -0
- package/docs/components/ui/textarea.md +39 -0
- package/docs/components/ui/toast.md +65 -0
- package/docs/components/ui/toaster.md +47 -0
- package/docs/components/ui/toggle-group.md +43 -0
- package/docs/components/ui/toggle.md +37 -0
- package/docs/components/ui/tooltip.md +33 -0
- package/docs/components/ui/tree-view.md +65 -0
- package/docs/components/ui/visually-hidden.md +21 -0
- package/llms-full.txt +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/skeleton
|
|
4
|
+
- Server-safe: Yes
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
### Skeleton (base)
|
|
9
|
+
variant: "rectangle" | "circle" | "text"
|
|
10
|
+
animation: "pulse" | "shimmer" | "none"
|
|
11
|
+
|
|
12
|
+
### SkeletonAvatar
|
|
13
|
+
size: "sm" | "md" | "lg" | "xl"
|
|
14
|
+
animation: "pulse" | "shimmer" | "none"
|
|
15
|
+
|
|
16
|
+
### SkeletonText
|
|
17
|
+
lines: number (default: 3)
|
|
18
|
+
lastLineWidth: "full" | "three-quarter" | "half" (default: "three-quarter")
|
|
19
|
+
spacing: "sm" | "md" (default: "md")
|
|
20
|
+
animation: "pulse" | "shimmer" | "none"
|
|
21
|
+
|
|
22
|
+
### SkeletonButton
|
|
23
|
+
size: "sm" | "md" | "lg"
|
|
24
|
+
width: "auto" | "full" | "icon"
|
|
25
|
+
animation: "pulse" | "shimmer" | "none"
|
|
26
|
+
|
|
27
|
+
### SkeletonInput
|
|
28
|
+
size: "sm" | "md" | "lg"
|
|
29
|
+
animation: "pulse" | "shimmer" | "none"
|
|
30
|
+
|
|
31
|
+
### SkeletonChart
|
|
32
|
+
bars: number (default: 7)
|
|
33
|
+
height: string (default: "h-40")
|
|
34
|
+
animation: "pulse" | "shimmer" | "none"
|
|
35
|
+
|
|
36
|
+
### SkeletonImage
|
|
37
|
+
width: string (default: "w-full")
|
|
38
|
+
height: string (default: "h-40")
|
|
39
|
+
animation: "pulse" | "shimmer" | "none"
|
|
40
|
+
|
|
41
|
+
### SkeletonGroup
|
|
42
|
+
label: string (default: "Loading") — accessible label for the loading state
|
|
43
|
+
|
|
44
|
+
## Defaults
|
|
45
|
+
Skeleton: variant="rectangle", animation="pulse"
|
|
46
|
+
SkeletonAvatar: size="md", animation="pulse"
|
|
47
|
+
SkeletonText: lines=3, lastLineWidth="three-quarter", spacing="md", animation="pulse"
|
|
48
|
+
SkeletonButton: size="md", width="auto", animation="pulse"
|
|
49
|
+
SkeletonInput: size="md", animation="pulse"
|
|
50
|
+
SkeletonChart: bars=7, height="h-40", animation="pulse"
|
|
51
|
+
SkeletonImage: width="w-full", height="h-40", animation="pulse"
|
|
52
|
+
SkeletonGroup: label="Loading"
|
|
53
|
+
|
|
54
|
+
## Example
|
|
55
|
+
```jsx
|
|
56
|
+
<Skeleton variant="text" className="w-3/4" />
|
|
57
|
+
<Skeleton variant="circle" className="h-12 w-12" />
|
|
58
|
+
<Skeleton variant="rectangle" animation="shimmer" className="h-48 w-full" />
|
|
59
|
+
|
|
60
|
+
<SkeletonGroup label="Loading user profile">
|
|
61
|
+
<SkeletonAvatar size="lg" />
|
|
62
|
+
<SkeletonText lines={2} />
|
|
63
|
+
<SkeletonButton />
|
|
64
|
+
</SkeletonGroup>
|
|
65
|
+
|
|
66
|
+
<SkeletonChart bars={5} height="h-32" />
|
|
67
|
+
<SkeletonImage height="h-64" />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Gotchas
|
|
71
|
+
- shimmer respects prefers-reduced-motion
|
|
72
|
+
- SkeletonGroup adds role="status" and aria-busy="true" — wrap multiple skeletons for a11y
|
|
73
|
+
- All sub-components accept className for custom sizing
|
|
74
|
+
|
|
75
|
+
## Changes
|
|
76
|
+
### v0.1.0
|
|
77
|
+
- **Added** Initial release with `shape` variants (text, circular, rectangular) and shimmer animation
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/slider
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
Standard Radix Slider props (value, onValueChange, defaultValue, min, max, step, aria-label)
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
```jsx
|
|
12
|
+
<Slider defaultValue={[50]} max={100} step={1} aria-label="Volume" />
|
|
13
|
+
<Slider defaultValue={[25, 75]} max={100} step={1} /> {/* range slider */}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Gotchas
|
|
17
|
+
- value is number[] (array), not a single number
|
|
18
|
+
- Multi-thumb: Pass array `defaultValue={[25, 75]}` for range sliders — renders one thumb per value
|
|
19
|
+
|
|
20
|
+
## Changes
|
|
21
|
+
### v0.18.0
|
|
22
|
+
- **Fixed** Multi-thumb support added
|
|
23
|
+
|
|
24
|
+
### v0.3.0
|
|
25
|
+
- **Added** `SliderProps` type export
|
|
26
|
+
|
|
27
|
+
### v0.1.0
|
|
28
|
+
- **Added** Initial release
|
|
29
|
+
- **Fixed** `aria-label` now forwarded to thumb element (was only on root container)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Spinner
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/spinner
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
size: "sm" | "md" | "lg"
|
|
9
|
+
state: "spinning" | "success" | "error"
|
|
10
|
+
variant: "filled" | "bare"
|
|
11
|
+
delay: number (ms — render delay to avoid flicker on fast operations)
|
|
12
|
+
onComplete: () => void (callback after success/error state transition)
|
|
13
|
+
|
|
14
|
+
## Defaults
|
|
15
|
+
size: "md"
|
|
16
|
+
state: "spinning"
|
|
17
|
+
variant: "filled"
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
```jsx
|
|
21
|
+
<Spinner size="lg" />
|
|
22
|
+
<Spinner state="success" /> {/* green checkmark */}
|
|
23
|
+
<Spinner variant="bare" /> {/* uses currentColor, for embedding in buttons */}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Gotchas
|
|
27
|
+
- Renders role="status" with sr-only "Loading..." text — no need for aria-label
|
|
28
|
+
- Button has built-in loading prop — prefer that over manual Spinner composition
|
|
29
|
+
- `bare` variant inherits text color — useful inside buttons and toolbars
|
|
30
|
+
- `delay` prevents flicker: spinner only appears after delay ms (good for fast API calls)
|
|
31
|
+
- No longer server-safe as of v0.18.0 (uses Framer Motion)
|
|
32
|
+
|
|
33
|
+
## Changes
|
|
34
|
+
### v0.18.0
|
|
35
|
+
- **Changed** (BREAKING) Complete rewrite with Framer Motion arc animation and state transitions
|
|
36
|
+
- **Added** `state` prop: 'spinning' | 'success' | 'error'
|
|
37
|
+
- **Added** `variant` prop: 'filled' | 'bare'
|
|
38
|
+
- **Added** `delay` prop for flicker prevention
|
|
39
|
+
- **Added** `onComplete` callback for state transitions
|
|
40
|
+
- **Changed** No longer server-safe (Framer Motion dependency)
|
|
41
|
+
- **Fixed** Fade out track circle in bare mode, use larger icons for bare variant
|
|
42
|
+
|
|
43
|
+
### v0.3.0
|
|
44
|
+
- **Fixed** Animations respect `prefers-reduced-motion`
|
|
45
|
+
|
|
46
|
+
### v0.2.0
|
|
47
|
+
- **Added** Identified as server-safe (no longer true as of v0.18.0)
|
|
48
|
+
|
|
49
|
+
### v0.1.0
|
|
50
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Stack
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/stack
|
|
4
|
+
- Server-safe: Yes
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
direction: "vertical" | "horizontal" | "row" | "column"
|
|
9
|
+
gap: SpacingToken | number — tokens: "ds-01".."ds-13", or numbers 0-13
|
|
10
|
+
align: "start" | "center" | "end" | "stretch" | "baseline"
|
|
11
|
+
justify: "start" | "center" | "end" | "between" | "around" | "evenly"
|
|
12
|
+
wrap: boolean
|
|
13
|
+
as: ElementType (default: "div")
|
|
14
|
+
|
|
15
|
+
## Defaults
|
|
16
|
+
direction: "vertical"
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
```jsx
|
|
20
|
+
<Stack direction="horizontal" gap="ds-04" align="center">
|
|
21
|
+
<Avatar size="sm" />
|
|
22
|
+
<Text variant="body-md">User Name</Text>
|
|
23
|
+
</Stack>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Gotchas
|
|
27
|
+
- "row" and "column" are aliases for "horizontal" and "vertical"
|
|
28
|
+
- gap accepts both token strings and numeric values
|
|
29
|
+
|
|
30
|
+
## Changes
|
|
31
|
+
### v0.2.0
|
|
32
|
+
- **Added** `direction` prop now accepts `"row"` / `"column"` as aliases for `"horizontal"` / `"vertical"`
|
|
33
|
+
- **Added** `gap` prop now accepts numeric values (e.g., `gap={4}` -> `gap-ds-04`) in addition to token strings
|
|
34
|
+
|
|
35
|
+
### v0.1.1
|
|
36
|
+
- **Fixed** Replaced dynamic `gap-${N}` with static lookup map (Tailwind JIT safety)
|
|
37
|
+
|
|
38
|
+
### v0.1.0
|
|
39
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# StatCard
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/stat-card
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
label: string (heading text)
|
|
9
|
+
title: string (alias for label)
|
|
10
|
+
value: string | number (REQUIRED)
|
|
11
|
+
prefix: string (before value, e.g. "$")
|
|
12
|
+
suffix: string (after value, e.g. "users")
|
|
13
|
+
delta: { value: string, direction: "up" | "down" | "neutral" }
|
|
14
|
+
icon: ReactNode | ComponentType<{ className?: string }>
|
|
15
|
+
loading: boolean (renders skeleton)
|
|
16
|
+
comparisonLabel: string (shown after delta, e.g. "vs last month")
|
|
17
|
+
secondaryLabel: string (below main value, e.g. "of $50,000 target")
|
|
18
|
+
progress: number (0-100, renders thin progress bar below value)
|
|
19
|
+
accent: "default" | "success" | "warning" | "error" | "info" (left border color)
|
|
20
|
+
sparkline: number[] (renders mini SVG line chart)
|
|
21
|
+
onClick: () => void (makes card clickable with hover state)
|
|
22
|
+
href: string (makes card a link via LinkContext)
|
|
23
|
+
footer: ReactNode (below card body, e.g. "View details →")
|
|
24
|
+
|
|
25
|
+
## Defaults
|
|
26
|
+
none (all props are optional except value)
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
```jsx
|
|
30
|
+
<StatCard
|
|
31
|
+
label="Revenue"
|
|
32
|
+
value="$48,200"
|
|
33
|
+
prefix="$"
|
|
34
|
+
delta={{ value: "+12%", direction: "up" }}
|
|
35
|
+
comparisonLabel="vs last month"
|
|
36
|
+
icon={<IconCurrencyDollar />}
|
|
37
|
+
accent="success"
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<StatCard
|
|
41
|
+
label="Storage"
|
|
42
|
+
value="4.2 GB"
|
|
43
|
+
secondaryLabel="of 10 GB"
|
|
44
|
+
progress={42}
|
|
45
|
+
sparkline={[10, 25, 18, 30, 42]}
|
|
46
|
+
footer={<a href="/storage">Manage storage →</a>}
|
|
47
|
+
/>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Gotchas
|
|
51
|
+
- delta.direction "up" = green, "down" = red, "neutral" = grey
|
|
52
|
+
- `label` and `title` are aliases — use either, not both
|
|
53
|
+
- `onClick` and `href` are mutually exclusive — href takes precedence
|
|
54
|
+
- `sparkline` needs at least 2 data points to render
|
|
55
|
+
|
|
56
|
+
## Changes
|
|
57
|
+
### v0.2.0
|
|
58
|
+
- **Added** `icon` prop now accepts `React.ComponentType` (e.g., `icon={IconBolt}`) in addition to `ReactNode`
|
|
59
|
+
|
|
60
|
+
### v0.1.0
|
|
61
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Stepper / Step
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/stepper
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
### Stepper
|
|
9
|
+
activeStep: number (REQUIRED, 0-indexed)
|
|
10
|
+
orientation: "horizontal" | "vertical"
|
|
11
|
+
children: <Step> elements
|
|
12
|
+
|
|
13
|
+
### Step
|
|
14
|
+
label: string (REQUIRED)
|
|
15
|
+
description: string
|
|
16
|
+
icon: ReactNode (overrides default number/checkmark)
|
|
17
|
+
|
|
18
|
+
## Defaults
|
|
19
|
+
orientation: "horizontal"
|
|
20
|
+
|
|
21
|
+
### StepperContent
|
|
22
|
+
activeStep: number (REQUIRED, 0-indexed — matches Stepper's activeStep)
|
|
23
|
+
children: ReactNode (one child per step, only the active one is visible)
|
|
24
|
+
className: string
|
|
25
|
+
|
|
26
|
+
## Compound Components
|
|
27
|
+
Stepper (root)
|
|
28
|
+
Step (label, description, icon)
|
|
29
|
+
StepperContent (content panel, animates active step)
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
```jsx
|
|
33
|
+
<Stepper activeStep={1}>
|
|
34
|
+
<Step label="Account" description="Create credentials" />
|
|
35
|
+
<Step label="Profile" description="Add details" />
|
|
36
|
+
<Step label="Review" />
|
|
37
|
+
</Stepper>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Gotchas
|
|
41
|
+
- Steps before activeStep are "completed", at activeStep is "active", after is "pending"
|
|
42
|
+
|
|
43
|
+
## Changes
|
|
44
|
+
### v0.18.0
|
|
45
|
+
- **Fixed** `bg-interactive` changed to `bg-accent-9` (OKLCH migration)
|
|
46
|
+
- **Fixed** Wrapped Stepper context provider value in `useMemo` for performance
|
|
47
|
+
|
|
48
|
+
### v0.1.0
|
|
49
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/switch
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
checked: boolean
|
|
9
|
+
onCheckedChange: (checked: boolean) => void
|
|
10
|
+
error: boolean (shows red border/bg)
|
|
11
|
+
disabled: boolean
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
```jsx
|
|
15
|
+
<Switch checked={enabled} onCheckedChange={setEnabled} />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Gotchas
|
|
19
|
+
- Use error prop for validation states (matches Checkbox API)
|
|
20
|
+
|
|
21
|
+
## Changes
|
|
22
|
+
### v0.18.0
|
|
23
|
+
- **Changed** Migrated to Framer Motion spring thumb animation
|
|
24
|
+
- **Fixed** Added visible border on unchecked state (`border-surface-border-strong`) — was borderless, making unchecked state hard to see
|
|
25
|
+
|
|
26
|
+
### v0.4.2
|
|
27
|
+
- **Fixed** `React.ComponentRef` changed to `React.ElementRef` for consistency
|
|
28
|
+
|
|
29
|
+
### v0.3.0
|
|
30
|
+
- **Added** `SwitchProps` type export
|
|
31
|
+
- **Added** `error` prop (matches Checkbox API)
|
|
32
|
+
|
|
33
|
+
### v0.1.0
|
|
34
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/table
|
|
4
|
+
- Server-safe: Yes
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Compound Components
|
|
8
|
+
Table (root <table>)
|
|
9
|
+
TableHeader (<thead>)
|
|
10
|
+
TableRow (<tr>)
|
|
11
|
+
TableHead (<th>)
|
|
12
|
+
TableBody (<tbody>)
|
|
13
|
+
TableRow (<tr>)
|
|
14
|
+
TableCell (<td>)
|
|
15
|
+
TableFooter (<tfoot>)
|
|
16
|
+
TableCaption (<caption>)
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
```jsx
|
|
20
|
+
<Table>
|
|
21
|
+
<TableHeader>
|
|
22
|
+
<TableRow>
|
|
23
|
+
<TableHead>Name</TableHead>
|
|
24
|
+
<TableHead>Status</TableHead>
|
|
25
|
+
</TableRow>
|
|
26
|
+
</TableHeader>
|
|
27
|
+
<TableBody>
|
|
28
|
+
<TableRow>
|
|
29
|
+
<TableCell>Project Alpha</TableCell>
|
|
30
|
+
<TableCell><Badge color="success">Active</Badge></TableCell>
|
|
31
|
+
</TableRow>
|
|
32
|
+
</TableBody>
|
|
33
|
+
</Table>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Gotchas
|
|
37
|
+
- Table headers automatically have scope="col" for screen reader navigation
|
|
38
|
+
|
|
39
|
+
## Changes
|
|
40
|
+
### v0.18.0
|
|
41
|
+
- **Added** `TableProps`, `TableRowProps`, `TableCellProps` type exports
|
|
42
|
+
|
|
43
|
+
### v0.17.0
|
|
44
|
+
- **Fixed** TableCell: Added `px-ds-03` horizontal padding — was `px-0`, causing content to hug container edges
|
|
45
|
+
|
|
46
|
+
### v0.1.0
|
|
47
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/tabs
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
### Tabs (root)
|
|
9
|
+
defaultValue: string
|
|
10
|
+
value: string
|
|
11
|
+
onValueChange: (value: string) => void
|
|
12
|
+
|
|
13
|
+
### TabsList
|
|
14
|
+
variant: "line" | "contained"
|
|
15
|
+
|
|
16
|
+
### TabsTrigger
|
|
17
|
+
value: string (REQUIRED)
|
|
18
|
+
variant: (inherits from TabsList)
|
|
19
|
+
|
|
20
|
+
### TabsContent
|
|
21
|
+
value: string (REQUIRED)
|
|
22
|
+
|
|
23
|
+
## Compound Components
|
|
24
|
+
Tabs (root)
|
|
25
|
+
TabsList (variant)
|
|
26
|
+
TabsTrigger (value)
|
|
27
|
+
TabsContent (value)
|
|
28
|
+
|
|
29
|
+
## Defaults
|
|
30
|
+
TabsList variant: "line"
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
```jsx
|
|
34
|
+
<Tabs defaultValue="overview">
|
|
35
|
+
<TabsList variant="contained">
|
|
36
|
+
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
37
|
+
<TabsTrigger value="activity">Activity</TabsTrigger>
|
|
38
|
+
</TabsList>
|
|
39
|
+
<TabsContent value="overview">Overview content</TabsContent>
|
|
40
|
+
<TabsContent value="activity">Activity content</TabsContent>
|
|
41
|
+
</Tabs>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Gotchas
|
|
45
|
+
- variant goes on TabsList, NOT on individual TabsTrigger (propagates via context)
|
|
46
|
+
- DO NOT put variant on TabsTrigger — it inherits from TabsList
|
|
47
|
+
|
|
48
|
+
## Changes
|
|
49
|
+
### v0.18.0
|
|
50
|
+
- **Fixed** Wrapped TabsList context provider value in `useMemo` for performance
|
|
51
|
+
|
|
52
|
+
### v0.14.0
|
|
53
|
+
- **Changed** TabsTrigger: Added `gap-ds-02` (4px) between icon and label for better spacing
|
|
54
|
+
|
|
55
|
+
### v0.1.0
|
|
56
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Text
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/text
|
|
4
|
+
- Server-safe: Yes
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
variant: TextVariant
|
|
9
|
+
as: ElementType (override the auto-selected HTML element)
|
|
10
|
+
|
|
11
|
+
## Types
|
|
12
|
+
TextVariant = 'heading-2xl' | 'heading-xl' | 'heading-lg' | 'heading-md' | 'heading-sm' | 'heading-xs' | 'body-lg' | 'body-md' | 'body-sm' | 'body-xs' | 'label-lg' | 'label-md' | 'label-sm' | 'label-xs' | 'caption' | 'overline'
|
|
13
|
+
|
|
14
|
+
## Defaults
|
|
15
|
+
variant: "body-md"
|
|
16
|
+
|
|
17
|
+
## Default Element Mapping
|
|
18
|
+
heading-2xl -> h1, heading-xl -> h2, heading-lg -> h3, heading-md -> h4, heading-sm -> h5, heading-xs -> h6
|
|
19
|
+
body-* -> p, label-* -> span, caption -> span, overline -> span
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
```jsx
|
|
23
|
+
<Text variant="heading-2xl">Page Title</Text>
|
|
24
|
+
<Text variant="body-sm" as="span">Inline text</Text>
|
|
25
|
+
<Text variant="label-sm" className="text-text-secondary">SECTION LABEL</Text>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Gotchas
|
|
29
|
+
- label-* and overline variants are automatically uppercase
|
|
30
|
+
- Use "as" prop to override the HTML element when needed
|
|
31
|
+
|
|
32
|
+
## Changes
|
|
33
|
+
### v0.2.0
|
|
34
|
+
- **Fixed** `as` prop widened to accept any `React.ElementType` — `<Text as="h1">` no longer causes TypeScript errors
|
|
35
|
+
|
|
36
|
+
### v0.1.0
|
|
37
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Textarea
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/textarea
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
size: "sm" | "md" | "lg"
|
|
9
|
+
state: "default" | "error" | "warning" | "success"
|
|
10
|
+
(plus standard textarea attributes except native "size")
|
|
11
|
+
|
|
12
|
+
## Defaults
|
|
13
|
+
size: "md"
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
```jsx
|
|
17
|
+
<Textarea size="lg" state="error" placeholder="Describe the issue..." />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Gotchas
|
|
21
|
+
- state="error" sets aria-invalid automatically; all sizes are vertically resizable
|
|
22
|
+
- Inside FormField: auto-inherits state, aria-describedby, aria-required from context (explicit props override)
|
|
23
|
+
|
|
24
|
+
## Changes
|
|
25
|
+
### v0.15.0
|
|
26
|
+
- **Changed** `lg` size font changed from `text-ds-lg` (18px) to `text-ds-md` (14px) — all input sizes now use 14px for consistency
|
|
27
|
+
- **Changed** `md` size font standardized to `text-ds-md` (14px)
|
|
28
|
+
|
|
29
|
+
### v0.8.0
|
|
30
|
+
- **Fixed** Now consumes FormField context automatically (`aria-describedby`, `aria-invalid`, `aria-required`)
|
|
31
|
+
|
|
32
|
+
### v0.4.2
|
|
33
|
+
- **Added** `textareaVariants` export
|
|
34
|
+
|
|
35
|
+
### v0.1.1
|
|
36
|
+
- **Fixed** Added `aria-invalid` for error state (matching Input pattern)
|
|
37
|
+
|
|
38
|
+
### v0.1.0
|
|
39
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Toast
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/toast
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## API
|
|
8
|
+
toast('Plain message') // no icon, no accent bar
|
|
9
|
+
toast.message('Same as plain') // alias for toast()
|
|
10
|
+
toast.success('Saved!') // green accent, check icon
|
|
11
|
+
toast.error('Failed', { description }) // red accent, X icon
|
|
12
|
+
toast.warning('Disk low') // yellow accent, triangle icon
|
|
13
|
+
toast.info('New version') // blue accent, info icon
|
|
14
|
+
toast.loading('Saving...') // interactive accent, spinner, no timer bar, duration: Infinity
|
|
15
|
+
toast.promise(asyncFn, { loading, success, error }) // dynamic messages
|
|
16
|
+
toast.undo('Item deleted', { onUndo, duration? }) // 8s default, Undo action button
|
|
17
|
+
toast.upload({ files, id?, onRetry?, onRemove? }) // upload toast with per-file progress
|
|
18
|
+
toast.custom((id) => <MyComponent />, options) // escape hatch
|
|
19
|
+
toast.dismiss(id?) // specific or all
|
|
20
|
+
|
|
21
|
+
## Options (all methods accept)
|
|
22
|
+
id?: string
|
|
23
|
+
description?: ReactNode
|
|
24
|
+
action?: { label: string, onClick: () => void }
|
|
25
|
+
cancel?: { label: string, onClick: () => void }
|
|
26
|
+
duration?: number (ms, default 5000)
|
|
27
|
+
|
|
28
|
+
## Types
|
|
29
|
+
UploadFile: { id, name, size (bytes), progress? (0-100), status: 'pending' | 'uploading' | 'processing' | 'complete' | 'error', error?, previewUrl? }
|
|
30
|
+
|
|
31
|
+
## Utility
|
|
32
|
+
formatFileSize(bytes) => string (B, KB, MB, GB)
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
```jsx
|
|
36
|
+
// Mount <Toaster /> once at root layout
|
|
37
|
+
import { toast } from '@devalok/shilp-sutra/ui/toast'
|
|
38
|
+
|
|
39
|
+
toast.success('Changes saved!')
|
|
40
|
+
toast.error('Upload failed', { description: 'File too large' })
|
|
41
|
+
toast.undo('Task deleted', { onUndo: () => restoreTask(id) })
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Gotchas
|
|
45
|
+
- DO NOT use useToast() hook — it is deprecated, use imperative toast.* methods
|
|
46
|
+
- DO NOT use toast({ title, color }) object syntax — use toast.success('message') etc.
|
|
47
|
+
- DO NOT call toast() without <Toaster /> mounted at layout root
|
|
48
|
+
- Timer bar animates auto-dismiss countdown (hidden on loading toasts)
|
|
49
|
+
- Upload toast replaces the old UploadProgress composed component
|
|
50
|
+
|
|
51
|
+
## Changes
|
|
52
|
+
### v0.18.0
|
|
53
|
+
- **Changed** (BREAKING) Complete rewrite to Sonner-based imperative API
|
|
54
|
+
- **Fixed** Accent bar colors from step 7 to step 9 (decorative fills use solid step)
|
|
55
|
+
|
|
56
|
+
### v0.4.2
|
|
57
|
+
- **Changed** (BREAKING) `color="default"` renamed to `color="neutral"`
|
|
58
|
+
|
|
59
|
+
### v0.3.0
|
|
60
|
+
- **Changed** (BREAKING) `variant` prop renamed to `color` for semantic intent
|
|
61
|
+
- **Fixed** Close button now always visible (was hidden until hover)
|
|
62
|
+
|
|
63
|
+
### v0.1.0
|
|
64
|
+
- **Added** Initial release
|
|
65
|
+
- **Fixed** Toast now announces to screen readers (`role="status"`, `aria-live`)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Toaster
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/toaster
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
position: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
|
|
9
|
+
closeButton: boolean
|
|
10
|
+
duration: number (ms)
|
|
11
|
+
hotkey: string[]
|
|
12
|
+
visibleToasts: number
|
|
13
|
+
|
|
14
|
+
## Defaults
|
|
15
|
+
position: "bottom-right"
|
|
16
|
+
closeButton: false
|
|
17
|
+
duration: 5000
|
|
18
|
+
hotkey: ['altKey', 'KeyT']
|
|
19
|
+
visibleToasts: 3
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
```jsx
|
|
23
|
+
// Mount once at root layout
|
|
24
|
+
import { Toaster } from '@devalok/shilp-sutra/ui/toaster'
|
|
25
|
+
|
|
26
|
+
export default function RootLayout({ children }) {
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
{children}
|
|
30
|
+
<Toaster />
|
|
31
|
+
</>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Gotchas
|
|
37
|
+
- Must be mounted once at the layout root for toast notifications to work
|
|
38
|
+
- Use the `toast` import from `@devalok/shilp-sutra/ui/toast` to trigger toasts
|
|
39
|
+
|
|
40
|
+
## Changes
|
|
41
|
+
### v0.18.0
|
|
42
|
+
- **Changed** (BREAKING) Rewritten to Sonner-based engine with custom ToastContent rendering
|
|
43
|
+
- **Added** `ToasterProps` type export
|
|
44
|
+
- **Added** Visual: neutral bg-layer-01 base, colored left accent bar per type, status icon, timer bar
|
|
45
|
+
|
|
46
|
+
### v0.1.0
|
|
47
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# ToggleGroup
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/toggle-group
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
### ToggleGroup
|
|
9
|
+
type: "single" | "multiple"
|
|
10
|
+
variant: "default" | "outline" (propagated to items)
|
|
11
|
+
size: "sm" | "md" | "lg" (propagated to items)
|
|
12
|
+
value: string | string[]
|
|
13
|
+
onValueChange: (value) => void
|
|
14
|
+
|
|
15
|
+
### ToggleGroupItem
|
|
16
|
+
value: string
|
|
17
|
+
|
|
18
|
+
## Compound Components
|
|
19
|
+
ToggleGroup (root)
|
|
20
|
+
ToggleGroupItem (value: string)
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
```jsx
|
|
24
|
+
<ToggleGroup type="single" variant="outline" size="sm" value={alignment} onValueChange={setAlignment}>
|
|
25
|
+
<ToggleGroupItem value="left"><IconAlignLeft /></ToggleGroupItem>
|
|
26
|
+
<ToggleGroupItem value="center"><IconAlignCenter /></ToggleGroupItem>
|
|
27
|
+
<ToggleGroupItem value="right"><IconAlignRight /></ToggleGroupItem>
|
|
28
|
+
</ToggleGroup>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Gotchas
|
|
32
|
+
- type is required — "single" or "multiple"
|
|
33
|
+
- variant and size propagate from ToggleGroup to items
|
|
34
|
+
|
|
35
|
+
## Changes
|
|
36
|
+
### v0.18.0
|
|
37
|
+
- **Fixed** Wrapped ToggleGroup context provider value in `useMemo` for performance
|
|
38
|
+
|
|
39
|
+
### v0.4.2
|
|
40
|
+
- **Added** `ToggleGroupProps`, `ToggleGroupItemProps` type exports
|
|
41
|
+
|
|
42
|
+
### v0.1.0
|
|
43
|
+
- **Added** Initial release
|