@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,83 @@
|
|
|
1
|
+
# @devalok/shilp-sutra — Full Component Reference
|
|
2
|
+
|
|
3
|
+
> Exhaustive API reference for AI coding agents.
|
|
4
|
+
> For a concise cheatsheet, see llms.txt instead.
|
|
5
|
+
> All variant values and props verified from source CVA definitions.
|
|
6
|
+
>
|
|
7
|
+
> Package: @devalok/shilp-sutra
|
|
8
|
+
> Version: {{VERSION}}
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Architecture Notes
|
|
13
|
+
|
|
14
|
+
### The Two-Axis Variant System
|
|
15
|
+
|
|
16
|
+
Many components use TWO props where shadcn/ui uses one:
|
|
17
|
+
- `variant` controls SHAPE/SURFACE: solid, outline, ghost, subtle, filled, etc.
|
|
18
|
+
- `color` controls INTENT/SEMANTICS: default, error, success, warning, info, etc.
|
|
19
|
+
|
|
20
|
+
Components with two-axis system: Button, Badge, Alert, Chip, Banner, Progress, StatusBadge
|
|
21
|
+
|
|
22
|
+
### Server-Safe Components (no "use client")
|
|
23
|
+
|
|
24
|
+
These can be imported directly in Next.js Server Components:
|
|
25
|
+
- UI: Text, Skeleton, Stack, Container, Table (and sub-components), Code, VisuallyHidden
|
|
26
|
+
- Composed: ContentCard, PageHeader, LoadingSkeleton, PageSkeletons, PriorityIndicator
|
|
27
|
+
- NOTE (v0.18.0): Spinner, EmptyState, StatusBadge are NO LONGER server-safe (Framer Motion dependency)
|
|
28
|
+
|
|
29
|
+
Use per-component imports for server components:
|
|
30
|
+
import { Text } from '@devalok/shilp-sutra/ui/text'
|
|
31
|
+
import { PageHeader } from '@devalok/shilp-sutra/composed/page-header'
|
|
32
|
+
|
|
33
|
+
DO NOT use barrel imports in Server Components — they include "use client" components.
|
|
34
|
+
|
|
35
|
+
### Token Architecture — OKLCH 12-Step System
|
|
36
|
+
|
|
37
|
+
Color tokens use OKLCH (perceptually uniform) with 12 functional steps per palette:
|
|
38
|
+
|
|
39
|
+
| Step | Purpose | Example usage |
|
|
40
|
+
|------|---------|---------------|
|
|
41
|
+
| 1 | App background | Page bg, body |
|
|
42
|
+
| 2 | Subtle background | Sidebar, card alt |
|
|
43
|
+
| 3 | Component bg | Input bg, badge bg |
|
|
44
|
+
| 4 | Component bg hover | Button hover state |
|
|
45
|
+
| 5 | Component bg active | Active/pressed state |
|
|
46
|
+
| 6 | Border subtle | Dividers, soft borders |
|
|
47
|
+
| 7 | Border default | Input borders, card borders |
|
|
48
|
+
| 8 | Border strong | Focus rings, emphasis borders |
|
|
49
|
+
| 9 | Solid / accent | Button bg, primary CTA |
|
|
50
|
+
| 10 | Solid hover | Button hover bg |
|
|
51
|
+
| 11 | Low-contrast text | Secondary accent text |
|
|
52
|
+
| 12 | High-contrast text | Headings on light bg |
|
|
53
|
+
|
|
54
|
+
Semantic layer:
|
|
55
|
+
- Accent (swappable): --color-accent-{1-12} + --color-accent-fg
|
|
56
|
+
- Secondary: --color-secondary-{1-12} + --color-secondary-fg
|
|
57
|
+
- Surface: --color-surface-{1-4} + --color-surface-fg / fg-muted / fg-subtle / border
|
|
58
|
+
- Status: --color-{error,success,warning,info}-{3,7,9,11}
|
|
59
|
+
- Category: --color-category-{teal,amber,slate,indigo,cyan,orange,emerald}
|
|
60
|
+
|
|
61
|
+
Consumer rebranding: Override accent scale CSS vars or use generateScale(options) utility.
|
|
62
|
+
|
|
63
|
+
Tailwind utilities: accent-1..12, secondary-1..12, surface-1..4, plus fg/border variants.
|
|
64
|
+
|
|
65
|
+
### Toast Setup Pattern
|
|
66
|
+
|
|
67
|
+
1. Mount <Toaster /> once at your root layout.
|
|
68
|
+
2. Import { toast } from '@devalok/shilp-sutra/ui/toast' and call toast.success(), toast.error(), etc.
|
|
69
|
+
3. Types: 'success' | 'error' | 'warning' | 'info' | 'loading' | 'message'
|
|
70
|
+
|
|
71
|
+
### Form Accessibility Pattern
|
|
72
|
+
|
|
73
|
+
Use <FormField> + useFormField() hook:
|
|
74
|
+
<FormField state="error">
|
|
75
|
+
<Label htmlFor="email">Email</Label>
|
|
76
|
+
<Input id="email" state="error" />
|
|
77
|
+
<FormHelperText>Error message here.</FormHelperText>
|
|
78
|
+
</FormField>
|
|
79
|
+
|
|
80
|
+
useFormField() returns { state, helperTextId, required } from context.
|
|
81
|
+
Wire manually: <Input aria-describedby={helperTextId} aria-invalid={state === 'error'} />
|
|
82
|
+
|
|
83
|
+
Note: getFormFieldA11y() was removed in favor of useFormField() hook.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# ActivityFeed
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/activity-feed
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
items: ActivityItem[] (REQUIRED) — { id, actor?: { name, image? }, action: string|ReactNode, timestamp: Date|string, icon?, color?: 'default'|'success'|'warning'|'error'|'info', detail?: ReactNode }
|
|
9
|
+
onLoadMore: () => void — "Load more" button callback
|
|
10
|
+
loading: boolean — skeleton shimmer
|
|
11
|
+
hasMore: boolean — shows "Load more" button
|
|
12
|
+
emptyState: ReactNode — empty state content
|
|
13
|
+
compact: boolean — tighter spacing, no avatars, smaller text
|
|
14
|
+
maxInitialItems: number — truncate with "Show all (N)" toggle
|
|
15
|
+
|
|
16
|
+
## Defaults
|
|
17
|
+
loading=false, compact=false
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
```jsx
|
|
21
|
+
<ActivityFeed
|
|
22
|
+
items={[
|
|
23
|
+
{ id: '1', actor: { name: 'Alice' }, action: 'completed task', timestamp: new Date(), color: 'success' },
|
|
24
|
+
{ id: '2', action: 'System backup completed', timestamp: new Date(), detail: <pre>Details...</pre> },
|
|
25
|
+
]}
|
|
26
|
+
hasMore
|
|
27
|
+
onLoadMore={() => fetchMore()}
|
|
28
|
+
compact
|
|
29
|
+
/>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Gotchas
|
|
33
|
+
- `items` is required — passing an empty array renders the `emptyState` content
|
|
34
|
+
- `color` on each item controls the timeline dot color
|
|
35
|
+
- `actor.image` is optional — falls back to initials from `actor.name`
|
|
36
|
+
- `maxInitialItems` truncates with a "Show all (N)" toggle button
|
|
37
|
+
|
|
38
|
+
## Changes
|
|
39
|
+
### v0.18.0
|
|
40
|
+
- **Fixed** `bg-accent-9` changed to `bg-info-9` (info color, not accent)
|
|
41
|
+
|
|
42
|
+
### v0.16.0
|
|
43
|
+
- **Added** Initial release — vertical timeline with colored dots, actor avatars, expandable detail, compact mode, load more, maxInitialItems truncation
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AvatarGroup
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/avatar-group
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
users: AvatarUser[] (REQUIRED) — { name: string, image?: string | null }
|
|
9
|
+
max: number (default: 4, overflow shows "+N" badge)
|
|
10
|
+
size: "sm" | "md" | "lg"
|
|
11
|
+
showTooltip: boolean (default: true)
|
|
12
|
+
|
|
13
|
+
## Defaults
|
|
14
|
+
size="md", max=4, showTooltip=true
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
```jsx
|
|
18
|
+
<AvatarGroup
|
|
19
|
+
users={[{ name: 'Alice', image: '/alice.jpg' }, { name: 'Bob' }]}
|
|
20
|
+
max={3}
|
|
21
|
+
size="md"
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Gotchas
|
|
26
|
+
- Wraps TooltipProvider internally — no need to add one yourself
|
|
27
|
+
- Users beyond `max` are collapsed into a "+N" overflow badge
|
|
28
|
+
- Missing `image` falls back to initials derived from `name`
|
|
29
|
+
|
|
30
|
+
## Changes
|
|
31
|
+
### v0.1.0
|
|
32
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# CommandPalette
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/command-palette
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
groups: CommandGroup[] — { label: string, items: CommandItem[] }
|
|
9
|
+
placeholder: string (default: "Search or jump to...")
|
|
10
|
+
onSearch: (query: string) => void
|
|
11
|
+
emptyMessage: string (default: "No results found.")
|
|
12
|
+
|
|
13
|
+
CommandItem shape: { id, label, description?, icon?, shortcut?, onSelect: () => void }
|
|
14
|
+
|
|
15
|
+
## Defaults
|
|
16
|
+
placeholder="Search or jump to...", emptyMessage="No results found."
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
```jsx
|
|
20
|
+
<CommandPalette
|
|
21
|
+
groups={[{
|
|
22
|
+
label: 'Navigation',
|
|
23
|
+
items: [{ id: 'dash', label: 'Dashboard', onSelect: () => navigate('/') }],
|
|
24
|
+
}]}
|
|
25
|
+
/>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Gotchas
|
|
29
|
+
- Opens with Ctrl+K / Cmd+K by default
|
|
30
|
+
- Items animate in with staggered slide-up (30ms delay cascade); groups fade in; active item icon/shortcut highlight in interactive color (v0.15.0)
|
|
31
|
+
|
|
32
|
+
## Changes
|
|
33
|
+
### v0.15.0
|
|
34
|
+
- **Added** Staggered slide-up entrance animations for items, fade-in for groups/empty state/footer, scale-in for search icon, active item icon/shortcut color transitions
|
|
35
|
+
|
|
36
|
+
### v0.8.0
|
|
37
|
+
- **Added** Full ARIA combobox pattern (`role="combobox"`, `aria-expanded`, `aria-activedescendant`)
|
|
38
|
+
|
|
39
|
+
### v0.1.0
|
|
40
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# ConfirmDialog
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/confirm-dialog
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
open: boolean (REQUIRED, controlled)
|
|
9
|
+
onOpenChange: (open: boolean) => void (REQUIRED)
|
|
10
|
+
title: string (REQUIRED)
|
|
11
|
+
description: string (REQUIRED)
|
|
12
|
+
confirmText: string (default: "Confirm")
|
|
13
|
+
cancelText: string (default: "Cancel")
|
|
14
|
+
color: "default" | "error" (controls confirm button color)
|
|
15
|
+
loading: boolean (default: false, disables buttons and shows spinner)
|
|
16
|
+
onConfirm: () => void | Promise<void> (REQUIRED)
|
|
17
|
+
|
|
18
|
+
## Defaults
|
|
19
|
+
confirmText="Confirm", cancelText="Cancel", color="default", loading=false
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
```jsx
|
|
23
|
+
const [open, setOpen] = useState(false)
|
|
24
|
+
<ConfirmDialog
|
|
25
|
+
open={open}
|
|
26
|
+
onOpenChange={setOpen}
|
|
27
|
+
title="Delete project?"
|
|
28
|
+
description="This action cannot be undone."
|
|
29
|
+
color="error"
|
|
30
|
+
confirmText="Delete"
|
|
31
|
+
loading={isDeleting}
|
|
32
|
+
onConfirm={async () => { await deleteProject(); setOpen(false) }}
|
|
33
|
+
/>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Gotchas
|
|
37
|
+
- Dialog stays open after confirm — consumer must close it via `onOpenChange`
|
|
38
|
+
- Built on AlertDialog internally
|
|
39
|
+
- Fully controlled — `open` and `onOpenChange` are required
|
|
40
|
+
|
|
41
|
+
## Changes
|
|
42
|
+
### v0.18.0
|
|
43
|
+
- **Fixed** Converted to `forwardRef` pattern
|
|
44
|
+
|
|
45
|
+
### v0.1.0
|
|
46
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# ContentCard
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/content-card
|
|
4
|
+
- Server-safe: Yes
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
variant: "default" | "outline" | "ghost"
|
|
9
|
+
padding: "default" | "compact" | "spacious" | "none"
|
|
10
|
+
header: ReactNode (custom header content)
|
|
11
|
+
headerTitle: string (simple text header)
|
|
12
|
+
headerActions: ReactNode (actions in header area)
|
|
13
|
+
footer: ReactNode
|
|
14
|
+
children: ReactNode (body)
|
|
15
|
+
|
|
16
|
+
## Defaults
|
|
17
|
+
variant="default", padding="default"
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
```jsx
|
|
21
|
+
<ContentCard headerTitle="Team Members" headerActions={<Button size="sm">Add</Button>}>
|
|
22
|
+
<p>Member list here</p>
|
|
23
|
+
</ContentCard>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Gotchas
|
|
27
|
+
- Server-safe: can be imported directly in Next.js Server Components
|
|
28
|
+
- Use `headerTitle` for simple text headers; use `header` for custom header content
|
|
29
|
+
- `header` takes precedence over `headerTitle` if both are provided
|
|
30
|
+
|
|
31
|
+
## Changes
|
|
32
|
+
### v0.2.0
|
|
33
|
+
- **Added** Identified as server-safe component
|
|
34
|
+
|
|
35
|
+
### v0.1.0
|
|
36
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# DatePicker
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/date-picker
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
### DatePicker
|
|
10
|
+
value: Date | null
|
|
11
|
+
onChange: (date: Date | null) => void
|
|
12
|
+
placeholder: string (default: "Pick a date")
|
|
13
|
+
formatStr: string (default: "MMM d, yyyy")
|
|
14
|
+
minDate: Date
|
|
15
|
+
maxDate: Date
|
|
16
|
+
disabledDates: (date: Date) => boolean
|
|
17
|
+
className: string
|
|
18
|
+
|
|
19
|
+
### DateRangePicker
|
|
20
|
+
startDate: Date | null
|
|
21
|
+
endDate: Date | null
|
|
22
|
+
onChange: (range: { start: Date | null, end: Date | null }) => void
|
|
23
|
+
placeholder: string (default: "Pick a date range")
|
|
24
|
+
formatStr: string (default: "MMM d, yyyy")
|
|
25
|
+
minDate: Date
|
|
26
|
+
maxDate: Date
|
|
27
|
+
disabledDates: (date: Date) => boolean
|
|
28
|
+
presets: PresetKey[] (shows quick-select sidebar)
|
|
29
|
+
numberOfMonths: number (default: 1)
|
|
30
|
+
|
|
31
|
+
### DateTimePicker
|
|
32
|
+
value: Date | null
|
|
33
|
+
onChange: (date: Date | null) => void
|
|
34
|
+
minDate: Date
|
|
35
|
+
maxDate: Date
|
|
36
|
+
disabledDates: (date: Date) => boolean
|
|
37
|
+
timeFormat: "12h" | "24h"
|
|
38
|
+
minuteStep: number
|
|
39
|
+
placeholder: string
|
|
40
|
+
className: string
|
|
41
|
+
|
|
42
|
+
### TimePicker
|
|
43
|
+
value: Date | null (time stored as a Date object)
|
|
44
|
+
onChange: (date: Date) => void
|
|
45
|
+
format: "12h" | "24h" (default: "12h")
|
|
46
|
+
minuteStep: number (default: 1)
|
|
47
|
+
secondStep: number (default: 1)
|
|
48
|
+
showSeconds: boolean (default: false)
|
|
49
|
+
placeholder: string (default: "Pick a time")
|
|
50
|
+
disabled: boolean (default: false)
|
|
51
|
+
className: string
|
|
52
|
+
|
|
53
|
+
### CalendarGrid
|
|
54
|
+
currentMonth: Date (REQUIRED)
|
|
55
|
+
selected: Date | null
|
|
56
|
+
rangeStart: Date | null
|
|
57
|
+
rangeEnd: Date | null
|
|
58
|
+
hoverDate: Date | null
|
|
59
|
+
onSelect: (date: Date) => void (REQUIRED)
|
|
60
|
+
onHover: (date: Date | null) => void
|
|
61
|
+
onMonthChange: (date: Date) => void (REQUIRED)
|
|
62
|
+
onHeaderClick: () => void
|
|
63
|
+
disabledDates: (date: Date) => boolean
|
|
64
|
+
minDate: Date
|
|
65
|
+
maxDate: Date
|
|
66
|
+
hidePrevNav: boolean
|
|
67
|
+
hideNextNav: boolean
|
|
68
|
+
events: CalendarEvent[] — { date: Date, color?: string, label?: string }
|
|
69
|
+
|
|
70
|
+
### YearPicker
|
|
71
|
+
currentYear: number (REQUIRED)
|
|
72
|
+
selectedYear: number
|
|
73
|
+
onYearSelect: (year: number) => void (REQUIRED)
|
|
74
|
+
minDate: Date
|
|
75
|
+
maxDate: Date
|
|
76
|
+
|
|
77
|
+
### MonthPicker
|
|
78
|
+
currentYear: number (REQUIRED)
|
|
79
|
+
selectedMonth: number (0-11)
|
|
80
|
+
onMonthSelect: (month: number) => void (REQUIRED)
|
|
81
|
+
minDate: Date
|
|
82
|
+
maxDate: Date
|
|
83
|
+
|
|
84
|
+
### Presets
|
|
85
|
+
presets: PresetKey[] (REQUIRED)
|
|
86
|
+
onSelect: (start: Date, end: Date) => void (REQUIRED)
|
|
87
|
+
className: string
|
|
88
|
+
|
|
89
|
+
PresetKey: 'today' | 'yesterday' | 'last7days' | 'last30days' | 'thisMonth' | 'lastMonth' | 'thisYear'
|
|
90
|
+
|
|
91
|
+
### useCalendar hook
|
|
92
|
+
useCalendar(initialMonth?: Date) => { currentMonth, setCurrentMonth, goToPreviousMonth, goToNextMonth, goToMonth, goToYear }
|
|
93
|
+
|
|
94
|
+
## Defaults
|
|
95
|
+
DatePicker: placeholder="Pick a date", formatStr="MMM d, yyyy"
|
|
96
|
+
DateRangePicker: placeholder="Pick a date range", formatStr="MMM d, yyyy", numberOfMonths=1
|
|
97
|
+
TimePicker: format="12h", minuteStep=1, secondStep=1, showSeconds=false
|
|
98
|
+
|
|
99
|
+
## Example
|
|
100
|
+
```jsx
|
|
101
|
+
<DatePicker value={date} onChange={setDate} placeholder="Select date" />
|
|
102
|
+
|
|
103
|
+
<DateRangePicker
|
|
104
|
+
startDate={start}
|
|
105
|
+
endDate={end}
|
|
106
|
+
onChange={({ start, end }) => { setStart(start); setEnd(end); }}
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
<DateTimePicker value={dateTime} onChange={setDateTime} timeFormat="12h" minuteStep={15} />
|
|
110
|
+
|
|
111
|
+
<TimePicker value={time} onChange={setTime} format="24h" minuteStep={15} />
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Gotchas
|
|
115
|
+
- TimePicker stores time inside a Date object — only hours/minutes/seconds are meaningful
|
|
116
|
+
- CalendarGrid is a low-level building block — prefer DatePicker/DateRangePicker for most use cases
|
|
117
|
+
- MonthPicker month values are 0-indexed (Jan=0, Dec=11) — same as JavaScript `Date.getMonth()`
|
|
118
|
+
- YearPicker displays a 12-year grid based on the decade of `currentYear`
|
|
119
|
+
- CalendarGrid supports up to 3 event dots per day cell
|
|
120
|
+
- useCalendar is a convenience hook for managing calendar month state
|
|
121
|
+
|
|
122
|
+
## Changes
|
|
123
|
+
### v0.18.0
|
|
124
|
+
- **Fixed** Added `aria-label` to DatePicker/DateRangePicker trigger buttons
|
|
125
|
+
|
|
126
|
+
### v0.4.2
|
|
127
|
+
- **Changed** DateRangePicker default `formatStr` from `'MMM d'` to `'MMM d, yyyy'`
|
|
128
|
+
|
|
129
|
+
### v0.1.0
|
|
130
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# EmptyState
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/empty-state
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
Note: EmptyState was server-safe prior to v0.18.0 but is NO LONGER server-safe due to Framer Motion dependency.
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
title: string (REQUIRED)
|
|
11
|
+
description: string
|
|
12
|
+
icon: ReactNode | ComponentType<{ className?: string }> (default: Devalok chakra icon)
|
|
13
|
+
action: ReactNode (e.g. a Button)
|
|
14
|
+
compact: boolean (smaller layout)
|
|
15
|
+
iconSize: 'sm' | 'md' | 'lg' (default 'md', compact defaults to 'sm') — sm=h-ico-sm, md=h-ico-lg, lg=h-ico-xl
|
|
16
|
+
|
|
17
|
+
## Defaults
|
|
18
|
+
iconSize="md" (compact defaults to "sm")
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
```jsx
|
|
22
|
+
<EmptyState
|
|
23
|
+
title="No tasks found"
|
|
24
|
+
description="Create your first task to get started."
|
|
25
|
+
action={<Button>Create Task</Button>}
|
|
26
|
+
iconSize="lg"
|
|
27
|
+
/>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Gotchas
|
|
31
|
+
- `icon` accepts both JSX elements (`<IconFolder />`) and component references (`IconFolder`). Component references are auto-instantiated with correct sizing classes.
|
|
32
|
+
- `iconSize` controls icon dimensions regardless of icon type. When `compact=true` and no `iconSize`, defaults to `'sm'`.
|
|
33
|
+
- As of v0.18.0, EmptyState is NOT server-safe (Framer Motion dependency). Use per-component import in client components.
|
|
34
|
+
|
|
35
|
+
## Changes
|
|
36
|
+
### v0.18.0
|
|
37
|
+
- **Changed** No longer server-safe due to Framer Motion dependency
|
|
38
|
+
|
|
39
|
+
### v0.16.0
|
|
40
|
+
- **Added** `iconSize?: 'sm' | 'md' | 'lg'` — control icon dimensions
|
|
41
|
+
|
|
42
|
+
### v0.13.0
|
|
43
|
+
- **Changed** `icon` prop now accepts `React.ComponentType<{ className?: string }>` in addition to `ReactNode` — component references are auto-instantiated
|
|
44
|
+
|
|
45
|
+
### v0.5.0
|
|
46
|
+
- **Changed** `icon` prop changed from `TablerIcon` (component ref) to `React.ReactNode` — use `icon={<MyIcon />}` instead of `icon={MyIcon}`
|
|
47
|
+
- **Changed** Default icon is now the Devalok swadhisthana chakra (inline SVG)
|
|
48
|
+
|
|
49
|
+
### v0.2.0
|
|
50
|
+
- **Added** Identified as server-safe component (later reverted in v0.18.0)
|
|
51
|
+
|
|
52
|
+
### v0.1.0
|
|
53
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ErrorDisplay
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/error-boundary
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
error: unknown (REQUIRED — Error object, status object, or string)
|
|
9
|
+
onReset: () => void (optional retry button)
|
|
10
|
+
|
|
11
|
+
## Defaults
|
|
12
|
+
None
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
```jsx
|
|
16
|
+
<ErrorDisplay error={error} onReset={() => refetch()} />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Gotchas
|
|
20
|
+
- Auto-detects HTTP status codes (404, 403, 500) and shows appropriate icon/message
|
|
21
|
+
- Shows stack trace in development mode only
|
|
22
|
+
- The import path is `error-boundary` but the component is named `ErrorDisplay`
|
|
23
|
+
|
|
24
|
+
## Changes
|
|
25
|
+
### v0.18.0
|
|
26
|
+
- **Added** ErrorBoundary tests (13 new tests)
|
|
27
|
+
|
|
28
|
+
### v0.1.0
|
|
29
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# GlobalLoading
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/global-loading
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
isLoading: boolean (REQUIRED)
|
|
9
|
+
|
|
10
|
+
## Defaults
|
|
11
|
+
None
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
```jsx
|
|
15
|
+
<GlobalLoading isLoading={isNavigating} />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Gotchas
|
|
19
|
+
- Fixed-position bar at top of viewport (z-toast layer)
|
|
20
|
+
- Renders nothing when `isLoading` is false
|
|
21
|
+
|
|
22
|
+
## Changes
|
|
23
|
+
### v0.18.0
|
|
24
|
+
- **Fixed** Track `setTimeout` with ref, add cleanup on unmount
|
|
25
|
+
|
|
26
|
+
### v0.1.0
|
|
27
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# LoadingSkeleton
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/loading-skeleton
|
|
4
|
+
- Server-safe: Yes
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
Exports: CardSkeleton, TableSkeleton, BoardSkeleton, ListSkeleton
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
### CardSkeleton
|
|
12
|
+
className: string
|
|
13
|
+
|
|
14
|
+
### TableSkeleton
|
|
15
|
+
rows: number (default: 5)
|
|
16
|
+
columns: number (default: 4)
|
|
17
|
+
className: string
|
|
18
|
+
|
|
19
|
+
### BoardSkeleton
|
|
20
|
+
columns: number (default: 4)
|
|
21
|
+
cardsPerColumn: number (default: 3)
|
|
22
|
+
className: string
|
|
23
|
+
|
|
24
|
+
### ListSkeleton
|
|
25
|
+
rows: number (default: 6)
|
|
26
|
+
showAvatar: boolean (default: true)
|
|
27
|
+
className: string
|
|
28
|
+
|
|
29
|
+
## Defaults
|
|
30
|
+
TableSkeleton: rows=5, columns=4
|
|
31
|
+
BoardSkeleton: columns=4, cardsPerColumn=3
|
|
32
|
+
ListSkeleton: rows=6, showAvatar=true
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
```jsx
|
|
36
|
+
<CardSkeleton />
|
|
37
|
+
<TableSkeleton rows={8} columns={5} />
|
|
38
|
+
<BoardSkeleton columns={3} cardsPerColumn={4} />
|
|
39
|
+
<ListSkeleton rows={10} showAvatar={false} />
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Gotchas
|
|
43
|
+
- Server-safe: can be imported directly in Next.js Server Components
|
|
44
|
+
- These are pre-composed skeleton layouts — for individual skeleton shapes, use the `Skeleton` UI component
|
|
45
|
+
|
|
46
|
+
## Changes
|
|
47
|
+
### v0.2.0
|
|
48
|
+
- **Added** Identified as server-safe component
|
|
49
|
+
|
|
50
|
+
### v0.1.0
|
|
51
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# MemberPicker
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/member-picker
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
members: MemberPickerMember[] (REQUIRED) — { id, name, avatar? }
|
|
9
|
+
selectedIds: string[] (REQUIRED)
|
|
10
|
+
onSelect: (memberId: string) => void (REQUIRED)
|
|
11
|
+
multiple: boolean (default: false)
|
|
12
|
+
placeholder: string (default: "Search members...")
|
|
13
|
+
children: ReactNode (trigger element)
|
|
14
|
+
|
|
15
|
+
## Defaults
|
|
16
|
+
multiple=false, placeholder="Search members..."
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
```jsx
|
|
20
|
+
<MemberPicker members={teamMembers} selectedIds={assignees} onSelect={toggleAssignee} multiple>
|
|
21
|
+
<Button variant="outline">Assign Members</Button>
|
|
22
|
+
</MemberPicker>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Gotchas
|
|
26
|
+
- `children` is used as the trigger element (e.g., a Button)
|
|
27
|
+
- `onSelect` is called with a single `memberId` — toggle logic is up to the consumer
|
|
28
|
+
- When `multiple=false`, selecting a new member replaces the previous selection
|
|
29
|
+
|
|
30
|
+
## Changes
|
|
31
|
+
### v0.18.0
|
|
32
|
+
- **Fixed** Added `aria-label` to search input
|
|
33
|
+
|
|
34
|
+
### v0.1.0
|
|
35
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# PageHeader
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/page-header
|
|
4
|
+
- Server-safe: Yes
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
title: string (falls back to last breadcrumb label if omitted)
|
|
9
|
+
subtitle: string
|
|
10
|
+
actions: ReactNode (action buttons)
|
|
11
|
+
breadcrumbs: Breadcrumb[] — { label: string, href?: string }
|
|
12
|
+
titleClassName: string
|
|
13
|
+
|
|
14
|
+
## Defaults
|
|
15
|
+
None
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
```jsx
|
|
19
|
+
<PageHeader
|
|
20
|
+
title="Project Settings"
|
|
21
|
+
subtitle="Configure your project preferences"
|
|
22
|
+
breadcrumbs={[
|
|
23
|
+
{ label: 'Home', href: '/' },
|
|
24
|
+
{ label: 'Projects', href: '/projects' },
|
|
25
|
+
{ label: 'Settings' },
|
|
26
|
+
]}
|
|
27
|
+
actions={<Button>Save</Button>}
|
|
28
|
+
/>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Gotchas
|
|
32
|
+
- Server-safe: can be imported directly in Next.js Server Components
|
|
33
|
+
- If `title` is omitted, the last breadcrumb's `label` is used as the page title
|
|
34
|
+
- The last breadcrumb should not have an `href` (it represents the current page)
|
|
35
|
+
|
|
36
|
+
## Changes
|
|
37
|
+
### v0.2.0
|
|
38
|
+
- **Added** Identified as server-safe component
|
|
39
|
+
|
|
40
|
+
### v0.1.0
|
|
41
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# PageSkeletons
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/composed/page-skeletons
|
|
4
|
+
- Server-safe: Yes
|
|
5
|
+
- Category: composed
|
|
6
|
+
|
|
7
|
+
Exports: DashboardSkeleton, ProjectListSkeleton, TaskDetailSkeleton
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
className?: string (plus all standard HTML div attributes via React.ComponentPropsWithoutRef<'div'>)
|
|
11
|
+
|
|
12
|
+
## Defaults
|
|
13
|
+
None
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
```jsx
|
|
17
|
+
<DashboardSkeleton />
|
|
18
|
+
<ProjectListSkeleton />
|
|
19
|
+
<TaskDetailSkeleton />
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Gotchas
|
|
23
|
+
- Server-safe: can be imported directly in Next.js Server Components
|
|
24
|
+
- These are full-page skeleton layouts — for smaller skeleton sections, use LoadingSkeleton components
|
|
25
|
+
- Accept `className` and standard div attributes but render fixed layout structures
|
|
26
|
+
|
|
27
|
+
## Changes
|
|
28
|
+
### v0.2.0
|
|
29
|
+
- **Added** Identified as server-safe component
|
|
30
|
+
|
|
31
|
+
### v0.1.0
|
|
32
|
+
- **Added** Initial release
|