@devalok/shilp-sutra 0.18.1 → 0.19.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.
Files changed (101) hide show
  1. package/dist/shell/bottom-navbar.js +4 -4
  2. package/dist/shell/sidebar.js +2 -2
  3. package/dist/shell/top-bar.d.ts +45 -20
  4. package/dist/shell/top-bar.d.ts.map +1 -1
  5. package/dist/shell/top-bar.js +222 -159
  6. package/dist/tokens/semantic.css +5 -5
  7. package/dist/ui/sidebar.js +11 -11
  8. package/docs/components/_header.md +85 -0
  9. package/docs/components/composed/activity-feed.md +43 -0
  10. package/docs/components/composed/avatar-group.md +32 -0
  11. package/docs/components/composed/command-palette.md +40 -0
  12. package/docs/components/composed/confirm-dialog.md +46 -0
  13. package/docs/components/composed/content-card.md +36 -0
  14. package/docs/components/composed/date-picker.md +130 -0
  15. package/docs/components/composed/empty-state.md +53 -0
  16. package/docs/components/composed/error-boundary.md +29 -0
  17. package/docs/components/composed/global-loading.md +27 -0
  18. package/docs/components/composed/loading-skeleton.md +51 -0
  19. package/docs/components/composed/member-picker.md +35 -0
  20. package/docs/components/composed/page-header.md +41 -0
  21. package/docs/components/composed/page-skeletons.md +32 -0
  22. package/docs/components/composed/priority-indicator.md +32 -0
  23. package/docs/components/composed/rich-text-editor.md +71 -0
  24. package/docs/components/composed/schedule-view.md +39 -0
  25. package/docs/components/composed/simple-tooltip.md +33 -0
  26. package/docs/components/composed/status-badge.md +42 -0
  27. package/docs/components/shell/app-command-palette.md +44 -0
  28. package/docs/components/shell/bottom-navbar.md +52 -0
  29. package/docs/components/shell/command-registry.md +48 -0
  30. package/docs/components/shell/link-context.md +41 -0
  31. package/docs/components/shell/notification-center.md +63 -0
  32. package/docs/components/shell/notification-preferences.md +42 -0
  33. package/docs/components/shell/sidebar.md +92 -0
  34. package/docs/components/shell/top-bar.md +140 -0
  35. package/docs/components/ui/accordion.md +48 -0
  36. package/docs/components/ui/alert-dialog.md +58 -0
  37. package/docs/components/ui/alert.md +43 -0
  38. package/docs/components/ui/aspect-ratio.md +25 -0
  39. package/docs/components/ui/autocomplete.md +48 -0
  40. package/docs/components/ui/avatar.md +34 -0
  41. package/docs/components/ui/badge.md +48 -0
  42. package/docs/components/ui/banner.md +36 -0
  43. package/docs/components/ui/breadcrumb.md +37 -0
  44. package/docs/components/ui/button-group.md +32 -0
  45. package/docs/components/ui/button.md +55 -0
  46. package/docs/components/ui/card.md +48 -0
  47. package/docs/components/ui/charts.md +43 -0
  48. package/docs/components/ui/checkbox.md +31 -0
  49. package/docs/components/ui/chip.md +44 -0
  50. package/docs/components/ui/code.md +28 -0
  51. package/docs/components/ui/collapsible.md +40 -0
  52. package/docs/components/ui/color-input.md +37 -0
  53. package/docs/components/ui/combobox.md +54 -0
  54. package/docs/components/ui/container.md +26 -0
  55. package/docs/components/ui/context-menu.md +43 -0
  56. package/docs/components/ui/data-table-toolbar.md +44 -0
  57. package/docs/components/ui/data-table.md +91 -0
  58. package/docs/components/ui/dialog.md +51 -0
  59. package/docs/components/ui/dropdown-menu.md +45 -0
  60. package/docs/components/ui/file-upload.md +41 -0
  61. package/docs/components/ui/form.md +51 -0
  62. package/docs/components/ui/hover-card.md +32 -0
  63. package/docs/components/ui/icon-button.md +33 -0
  64. package/docs/components/ui/input-otp.md +44 -0
  65. package/docs/components/ui/input.md +48 -0
  66. package/docs/components/ui/label.md +25 -0
  67. package/docs/components/ui/link.md +29 -0
  68. package/docs/components/ui/menubar.md +44 -0
  69. package/docs/components/ui/navigation-menu.md +46 -0
  70. package/docs/components/ui/number-input.md +44 -0
  71. package/docs/components/ui/pagination.md +48 -0
  72. package/docs/components/ui/popover.md +30 -0
  73. package/docs/components/ui/progress.md +29 -0
  74. package/docs/components/ui/radio.md +34 -0
  75. package/docs/components/ui/search-input.md +43 -0
  76. package/docs/components/ui/segmented-control.md +50 -0
  77. package/docs/components/ui/select.md +49 -0
  78. package/docs/components/ui/separator.md +29 -0
  79. package/docs/components/ui/sheet.md +47 -0
  80. package/docs/components/ui/sidebar.md +72 -0
  81. package/docs/components/ui/skeleton.md +77 -0
  82. package/docs/components/ui/slider.md +29 -0
  83. package/docs/components/ui/spinner.md +51 -0
  84. package/docs/components/ui/stack.md +39 -0
  85. package/docs/components/ui/stat-card.md +61 -0
  86. package/docs/components/ui/stepper.md +49 -0
  87. package/docs/components/ui/switch.md +34 -0
  88. package/docs/components/ui/table.md +47 -0
  89. package/docs/components/ui/tabs.md +56 -0
  90. package/docs/components/ui/text.md +37 -0
  91. package/docs/components/ui/textarea.md +39 -0
  92. package/docs/components/ui/toast.md +65 -0
  93. package/docs/components/ui/toaster.md +47 -0
  94. package/docs/components/ui/toggle-group.md +43 -0
  95. package/docs/components/ui/toggle.md +37 -0
  96. package/docs/components/ui/tooltip.md +33 -0
  97. package/docs/components/ui/tree-view.md +65 -0
  98. package/docs/components/ui/visually-hidden.md +21 -0
  99. package/llms-full.txt +164 -73
  100. package/llms.txt +1 -1
  101. package/package.json +699 -697
@@ -0,0 +1,55 @@
1
+ # Button
2
+
3
+ - Import: @devalok/shilp-sutra/ui/button
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ variant: "solid" | "default" (alias->solid) | "outline" | "ghost" | "link" | "destructive" (alias->solid+error)
9
+ color: "default" | "error"
10
+ size: "sm" | "md" | "lg" | "icon" | "icon-sm" | "icon-md" | "icon-lg"
11
+ startIcon: ReactNode
12
+ endIcon: ReactNode
13
+ loading: boolean (disables button, shows spinner)
14
+ loadingPosition: "start" | "end" | "center" (default: "start")
15
+ fullWidth: boolean
16
+ asChild: boolean
17
+ onClickAsync: (e: MouseEvent) => Promise<void> (auto loading->success/error->idle)
18
+ asyncFeedbackDuration: number (ms, default 1500)
19
+
20
+ ## Defaults
21
+ variant="solid", color="default", size="md"
22
+
23
+ ## Example
24
+ ```jsx
25
+ <Button variant="solid" color="error" startIcon={<IconTrash />} loading={isDeleting}>
26
+ Delete project
27
+ </Button>
28
+ ```
29
+
30
+ ## Gotchas
31
+ - DO NOT use variant="destructive" — use variant="solid" color="error"
32
+ - DO NOT use variant="secondary" — use variant="outline" or variant="ghost"
33
+ - DO NOT use size="default" — use size="md"
34
+ - DO NOT use color="danger" — use color="error"
35
+ - Inherits variant/color/size from ButtonGroup context if present
36
+ - onClickAsync overrides onClick and loading when active
37
+
38
+ ## Changes
39
+ ### v0.18.0
40
+ - **Added** `onClickAsync` prop — promise-driven loading -> success/error state machine
41
+ - **Added** `asyncFeedbackDuration` prop (default 1500ms)
42
+ - **Changed** whileTap scale animation added via Framer Motion
43
+ - **Fixed** Async feedback colors — `bg-success text-text-on-color` changed to `bg-success-9 text-accent-fg`
44
+ - **Fixed** `onClickAsync` added `isMountedRef` guard to prevent set-state-after-unmount
45
+
46
+ ### v0.4.2
47
+ - **Fixed** `Omit<HTMLAttributes, 'color'>` resolves TS2320 conflict with CVA color prop
48
+ - **Fixed** `className` was passed inside `buttonVariants()` (silently dropped by CVA) — now separate `cn()` argument
49
+
50
+ ### v0.3.0
51
+ - **Changed** (BREAKING) `variant="primary"` renamed to `variant="solid"`, `variant="secondary"` renamed to `variant="outline"`, `variant="error"` moved to `color="error"`
52
+ - **Fixed** All dismiss/close buttons now meet WCAG 2.5.8 minimum 24px touch target
53
+
54
+ ### v0.1.0
55
+ - **Added** Initial release
@@ -0,0 +1,48 @@
1
+ # Card
2
+
3
+ - Import: @devalok/shilp-sutra/ui/card
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ variant: "default" | "elevated" | "outline" | "flat"
9
+ interactive: boolean (enables hover shadow lift + pointer cursor)
10
+
11
+ ## Compound Components
12
+ Card (root)
13
+ CardHeader
14
+ CardTitle
15
+ CardDescription
16
+ CardContent
17
+ CardFooter
18
+
19
+ ## Defaults
20
+ variant="default"
21
+
22
+ ## Example
23
+ ```jsx
24
+ <Card variant="elevated" interactive onClick={() => navigate(url)}>
25
+ <CardHeader>
26
+ <CardTitle>Project</CardTitle>
27
+ <CardDescription>Last updated 2h ago</CardDescription>
28
+ </CardHeader>
29
+ <CardContent><p>Content here</p></CardContent>
30
+ </Card>
31
+ ```
32
+
33
+ ## Gotchas
34
+ - Use `interactive` prop for clickable cards — adds hover lift and pointer cursor
35
+
36
+ ## Changes
37
+ ### v0.18.0
38
+ - **Changed** Interactive card hover lift animation migrated to Framer Motion
39
+
40
+ ### v0.4.2
41
+ - **Changed** (BREAKING) `variant="outlined"` renamed to `variant="outline"`
42
+ - **Added** `cardVariants` export
43
+
44
+ ### v0.1.1
45
+ - **Fixed** `leading-none tracking-tight` changed to `leading-ds-none tracking-ds-tight` for token compliance
46
+
47
+ ### v0.1.0
48
+ - **Added** Initial release
@@ -0,0 +1,43 @@
1
+ # Charts
2
+
3
+ - Import: @devalok/shilp-sutra/ui/charts
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ Charts is a collection of chart components. Each accepts data-specific props.
9
+
10
+ Exported components:
11
+ ChartContainer — wrapper with responsive sizing
12
+ BarChart
13
+ LineChart
14
+ AreaChart
15
+ PieChart
16
+ Sparkline
17
+ GaugeChart
18
+ RadarChart
19
+ Legend — chart legend with LegendItem[]
20
+
21
+ ## Defaults
22
+ none
23
+
24
+ ## Example
25
+ ```jsx
26
+ import { BarChart } from '@devalok/shilp-sutra/ui/charts'
27
+
28
+ <BarChart data={salesData} />
29
+ ```
30
+
31
+ ## Gotchas
32
+ - Barrel-isolated since v0.5.0 — must use `@devalok/shilp-sutra/ui/charts`, NOT the `ui` barrel
33
+ - Requires D3 as an optional peer dependency
34
+
35
+ ## Changes
36
+ ### v0.18.0
37
+ - **Changed** All 8 chart types migrated to Framer Motion entrance animations
38
+
39
+ ### v0.5.0
40
+ - **Changed** (BREAKING) All chart components removed from `@devalok/shilp-sutra/ui` barrel export. Must use `@devalok/shilp-sutra/ui/charts` import path.
41
+
42
+ ### v0.1.0
43
+ - **Added** Initial release
@@ -0,0 +1,31 @@
1
+ # Checkbox
2
+
3
+ - Import: @devalok/shilp-sutra/ui/checkbox
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ checked: boolean | "indeterminate"
9
+ onCheckedChange: (checked: boolean | "indeterminate") => void
10
+ error: boolean (shows red border)
11
+ indeterminate: boolean (overrides checked, shows dash icon)
12
+ disabled: boolean
13
+
14
+ ## Defaults
15
+ none
16
+
17
+ ## Example
18
+ ```jsx
19
+ <Checkbox checked={agreed} onCheckedChange={(v) => setAgreed(v === true)} />
20
+ ```
21
+
22
+ ## Gotchas
23
+ - indeterminate overrides checked visually
24
+
25
+ ## Changes
26
+ ### v0.18.0
27
+ - **Changed** Bouncy check indicator animation migrated to Framer Motion
28
+ - **Fixed** Icon sizing uses design tokens consistently
29
+
30
+ ### v0.1.0
31
+ - **Added** Initial release
@@ -0,0 +1,44 @@
1
+ # Chip
2
+
3
+ - Import: @devalok/shilp-sutra/ui/chip
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ label: string (REQUIRED — use this, NOT children)
9
+ variant: "subtle" | "outline"
10
+ color: "default" | "primary" | "success" | "error" | "warning" | "info" | "teal" | "amber" | "slate" | "indigo" | "cyan" | "orange" | "emerald"
11
+ size: "sm" | "md" | "lg"
12
+ icon: ReactNode
13
+ onClick: MouseEventHandler (renders as <button> when provided)
14
+ onDismiss: () => void (shows X button)
15
+ disabled: boolean
16
+
17
+ ## Defaults
18
+ variant="subtle", size="md", color="default"
19
+
20
+ ## Example
21
+ ```jsx
22
+ <Chip label="In Progress" color="warning" />
23
+ <Chip label="React" color="info" onDismiss={() => removeFilter('react')} />
24
+ ```
25
+
26
+ ## Additional Exports
27
+ ChipGroup — re-exported AnimatePresence from framer-motion; wrap a list of Chips for coordinated exit animations
28
+
29
+ ## Gotchas
30
+ - MUST use label prop — children are NOT rendered
31
+ - `<Chip>text</Chip>` is WRONG — use `<Chip label="text" />`
32
+ - Wrap dynamic chip lists in `<ChipGroup>` for exit animations
33
+ - `color="primary"` will be renamed to `color="brand"` in v1.0 — use `color="primary"` for now
34
+
35
+ ## Changes
36
+ ### v0.4.2
37
+ - **Changed** (BREAKING) `variant="filled"` renamed to `"subtle"`, `variant="outlined"` renamed to `"outline"`, `onDelete` renamed to `onDismiss`
38
+
39
+ ### v0.1.1
40
+ - **Fixed** `opacity-[var(--action-disabled-opacity,0.38)]` replaced with `opacity-action-disabled`
41
+ - **Fixed** Converted from `React.createElement` to JSX syntax
42
+
43
+ ### v0.1.0
44
+ - **Added** Initial release
@@ -0,0 +1,28 @@
1
+ # Code
2
+
3
+ - Import: @devalok/shilp-sutra/ui/code
4
+ - Server-safe: Yes
5
+ - Category: ui
6
+
7
+ ## Props
8
+ variant: "inline" | "block"
9
+ children: ReactNode
10
+
11
+ ## Defaults
12
+ variant="inline"
13
+
14
+ ## Example
15
+ ```jsx
16
+ <Code>onClick</Code>
17
+ <Code variant="block">{`const x = 1;\nconsole.log(x);`}</Code>
18
+ ```
19
+
20
+ ## Gotchas
21
+ - "block" renders as `<pre><code>`, "inline" renders as `<code>`
22
+
23
+ ## Changes
24
+ ### v0.1.1
25
+ - **Fixed** `leading-[150%]` replaced with `leading-ds-relaxed` for token compliance
26
+
27
+ ### v0.1.0
28
+ - **Added** Initial release
@@ -0,0 +1,40 @@
1
+ # Collapsible
2
+
3
+ - Import: @devalok/shilp-sutra/ui/collapsible
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ open: boolean (controlled)
9
+ onOpenChange: (open: boolean) => void
10
+ defaultOpen: boolean
11
+
12
+ ## Compound Components
13
+ Collapsible (root)
14
+ CollapsibleTrigger
15
+ CollapsibleContent
16
+
17
+ ## Defaults
18
+ none
19
+
20
+ ## Example
21
+ ```jsx
22
+ <Collapsible>
23
+ <CollapsibleTrigger>Toggle</CollapsibleTrigger>
24
+ <CollapsibleContent>Hidden content</CollapsibleContent>
25
+ </Collapsible>
26
+ ```
27
+
28
+ ## Gotchas
29
+ - Standard Radix Collapsible API
30
+
31
+ ## Changes
32
+ ### v0.13.0
33
+ - **Changed** Default animation changed from fade-only to height-based expand/collapse using `animate-collapsible-down`/`animate-collapsible-up`
34
+ - **Added** `collapsible-down` and `collapsible-up` keyframes added to Tailwind preset
35
+
36
+ ### v0.4.2
37
+ - **Added** `CollapsibleProps` type export
38
+
39
+ ### v0.1.0
40
+ - **Added** Initial release
@@ -0,0 +1,37 @@
1
+ # ColorInput
2
+
3
+ - Import: @devalok/shilp-sutra/ui/color-input
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ value: string (hex color, e.g. "#d33163")
9
+ onChange: (value: string) => void
10
+ presets: string[] (optional preset color swatches)
11
+ disabled: boolean
12
+ className: string
13
+
14
+ ## Defaults
15
+ value="#000000", disabled=false
16
+
17
+ ## Example
18
+ ```jsx
19
+ <ColorInput
20
+ value={color}
21
+ onChange={setColor}
22
+ presets={['#d33163', '#2563eb', '#16a34a']}
23
+ />
24
+ ```
25
+
26
+ ## Gotchas
27
+ - Uses native color picker under the hood; value must be a valid hex string
28
+
29
+ ## Changes
30
+ ### v0.15.0
31
+ - **Changed** `md` size font standardized to `text-ds-md` (14px) from mixed values
32
+
33
+ ### v0.8.0
34
+ - **Fixed** Added `aria-label` to hex color input
35
+
36
+ ### v0.1.0
37
+ - **Added** Initial release
@@ -0,0 +1,54 @@
1
+ # Combobox
2
+
3
+ - Import: @devalok/shilp-sutra/ui/combobox
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ options: ComboboxOption[] (REQUIRED) — { value: string, label: string, description?: string, icon?: ReactNode, disabled?: boolean }
9
+ DISCRIMINATED UNION — type depends on `multiple` flag:
10
+ Single (default): multiple?: false, value?: string, onValueChange: (value: string) => void
11
+ Multiple: multiple: true, value?: string[], onValueChange: (value: string[]) => void
12
+ placeholder: string (default: "Select...")
13
+ searchPlaceholder: string (default: "Search...")
14
+ emptyMessage: string (default: "No results found")
15
+ disabled: boolean
16
+ triggerClassName: string
17
+ accessibleLabel: string (custom aria-label for trigger, falls back to placeholder)
18
+ maxVisible: number (default: 6, max dropdown items before scroll)
19
+ renderOption: (option, selected) => ReactNode
20
+
21
+ ## Defaults
22
+ placeholder="Select...", searchPlaceholder="Search...", emptyMessage="No results found", maxVisible=6
23
+
24
+ ## Example
25
+ ```jsx
26
+ <Combobox
27
+ multiple
28
+ options={tagOptions}
29
+ value={selectedTags}
30
+ onValueChange={setSelectedTags}
31
+ placeholder="Select tags..."
32
+ />
33
+ ```
34
+
35
+ ## Gotchas
36
+ - Enforces selection from list (unlike Autocomplete which allows free text)
37
+ - In multi mode, selected items appear as pills with "+N more" overflow
38
+
39
+ ## Changes
40
+ ### v0.18.0
41
+ - **Added** `accessibleLabel` prop — custom aria-label for trigger, falls back to placeholder
42
+
43
+ ### v0.14.0
44
+ - **Changed** z-index promoted from `z-dropdown` (1000) to `z-popover` (1400) — fixes dropdown rendering behind Sheet/Dialog overlays
45
+
46
+ ### v0.8.0
47
+ - **Changed** (BREAKING) Props now use discriminated union — `multiple: true` requires `value: string[]` and `onValueChange: (value: string[]) => void`
48
+
49
+ ### v0.3.0
50
+ - **Changed** (BREAKING) `onChange` renamed to `onValueChange`
51
+ - **Changed** Now extends HTMLAttributes — accepts all standard HTML props
52
+
53
+ ### v0.1.0
54
+ - **Added** Initial release
@@ -0,0 +1,26 @@
1
+ # Container
2
+
3
+ - Import: @devalok/shilp-sutra/ui/container
4
+ - Server-safe: Yes
5
+ - Category: ui
6
+
7
+ ## Props
8
+ maxWidth: "default" | "body" | "full"
9
+ as: ElementType (default: "div")
10
+
11
+ ## Defaults
12
+ maxWidth="default"
13
+
14
+ ## Example
15
+ ```jsx
16
+ <Container maxWidth="body">
17
+ <p>Centered content</p>
18
+ </Container>
19
+ ```
20
+
21
+ ## Gotchas
22
+ - Server-safe component — can be imported directly in Next.js Server Components
23
+
24
+ ## Changes
25
+ ### v0.1.0
26
+ - **Added** Initial release
@@ -0,0 +1,43 @@
1
+ # ContextMenu
2
+
3
+ - Import: @devalok/shilp-sutra/ui/context-menu
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Compound Components
8
+ ContextMenu (root)
9
+ ContextMenuTrigger (right-click target)
10
+ ContextMenuContent
11
+ ContextMenuItem
12
+ ContextMenuCheckboxItem
13
+ ContextMenuRadioGroup > ContextMenuRadioItem
14
+ ContextMenuLabel
15
+ ContextMenuSeparator
16
+ ContextMenuSub > ContextMenuSubTrigger, ContextMenuSubContent
17
+
18
+ ## Defaults
19
+ none
20
+
21
+ ## Example
22
+ ```jsx
23
+ <ContextMenu>
24
+ <ContextMenuTrigger>Right-click me</ContextMenuTrigger>
25
+ <ContextMenuContent>
26
+ <ContextMenuItem>Edit</ContextMenuItem>
27
+ <ContextMenuItem>Delete</ContextMenuItem>
28
+ </ContextMenuContent>
29
+ </ContextMenu>
30
+ ```
31
+
32
+ ## Gotchas
33
+ - Triggered by right-click (or long-press on touch devices)
34
+
35
+ ## Changes
36
+ ### v0.18.0
37
+ - **Added** `ContextMenuContentProps`, `ContextMenuItemProps` type exports
38
+
39
+ ### v0.14.0
40
+ - **Changed** z-index promoted from `z-dropdown` (1000) to `z-popover` (1400) — fixes dropdown rendering behind Sheet/Dialog overlays
41
+
42
+ ### v0.1.0
43
+ - **Added** Initial release
@@ -0,0 +1,44 @@
1
+ # DataTableToolbar
2
+
3
+ - Import: @devalok/shilp-sutra/ui/data-table-toolbar
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ table: Table<TData> (TanStack table instance)
9
+ globalFilter: boolean
10
+ globalFilterValue: string
11
+ onGlobalFilterChange: (value: string) => void
12
+ density: 'compact' | 'standard' | 'comfortable'
13
+ onDensityChange: (density: Density) => void
14
+ enableExport: boolean
15
+
16
+ ## Defaults
17
+ none
18
+
19
+ ## Example
20
+ ```jsx
21
+ import { DataTableToolbar } from '@devalok/shilp-sutra/ui/data-table-toolbar'
22
+
23
+ <DataTableToolbar
24
+ table={table}
25
+ globalFilter
26
+ globalFilterValue={filterValue}
27
+ onGlobalFilterChange={setFilterValue}
28
+ density={density}
29
+ onDensityChange={setDensity}
30
+ enableExport
31
+ />
32
+ ```
33
+
34
+ ## Gotchas
35
+ - Barrel-isolated since v0.5.0 — must use `@devalok/shilp-sutra/ui/data-table-toolbar`, NOT the `ui` barrel
36
+ - Companion to DataTable — provides column visibility, density toggle, and CSV export controls
37
+ - Requires @tanstack/react-table as a peer dependency
38
+
39
+ ## Changes
40
+ ### v0.5.0
41
+ - **Changed** (BREAKING) Removed from `@devalok/shilp-sutra/ui` barrel export — must use `@devalok/shilp-sutra/ui/data-table-toolbar`
42
+
43
+ ### v0.1.0
44
+ - **Added** Initial release
@@ -0,0 +1,91 @@
1
+ # DataTable
2
+
3
+ - Import: @devalok/shilp-sutra/ui/data-table
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Props
8
+ columns: ColumnDef<TData>[] (TanStack column definitions)
9
+ data: TData[]
10
+ sortable: boolean — enable column sorting
11
+ onSort: (key: string, dir: 'asc' | 'desc' | false) => void — server-side sort callback (enables manualSorting)
12
+ filterable: boolean — enable per-column filters
13
+ globalFilter: boolean — enable global search
14
+ paginated: boolean — enable client-side pagination
15
+ pagination: { page: number, pageSize: number, total: number, onPageChange: (page: number) => void } — server-side pagination (1-based page)
16
+ pageSize: number (default 10)
17
+ selectable: boolean — enable row selection with checkboxes
18
+ selectedIds: Set<string> — controlled selection state
19
+ selectableFilter: (row: TData) => boolean — disable selection on certain rows
20
+ getRowId: (row: TData) => string — custom row ID accessor
21
+ onSelectionChange: (selectedRows: TData[]) => void
22
+ expandable: boolean — enable row expansion
23
+ renderExpanded: (row: TData) => ReactNode — expanded row content
24
+ singleExpand: boolean — only one row expanded at a time
25
+ loading: boolean — show skeleton shimmer rows
26
+ emptyState: ReactNode — custom empty state (takes precedence over noResultsText)
27
+ noResultsText: string (default "No results.")
28
+ stickyHeader: boolean — sticky table header
29
+ onRowClick: (row: TData) => void — row click handler (excludes interactive element clicks)
30
+ bulkActions: BulkAction<TData>[] — floating action bar on selection — { label, onClick, color?: 'default'|'error', disabled? }
31
+ toolbar: boolean — show DataTableToolbar (column visibility, density, CSV export)
32
+ editable: boolean — enable double-click cell editing
33
+ virtualRows: boolean — virtualize rows for large datasets
34
+ columnPinning: { left?: string[], right?: string[] }
35
+ defaultDensity: 'compact' | 'standard' | 'comfortable'
36
+
37
+ ## Defaults
38
+ pageSize=10, noResultsText="No results."
39
+
40
+ ## Example
41
+ ```jsx
42
+ import { DataTable } from '@devalok/shilp-sutra/ui/data-table'
43
+
44
+ <DataTable
45
+ columns={[
46
+ { accessorKey: 'name', header: 'Name' },
47
+ { accessorKey: 'email', header: 'Email' },
48
+ ]}
49
+ data={users}
50
+ sortable
51
+ onSort={(key, dir) => handleSort(key, dir)}
52
+ pagination={{ page, pageSize: 20, total: totalCount, onPageChange: setPage }}
53
+ loading={isLoading}
54
+ emptyState={<EmptyState title="No users" />}
55
+ />
56
+ ```
57
+
58
+ ## Gotchas
59
+ - Barrel-isolated since v0.5.0 — must use `@devalok/shilp-sutra/ui/data-table`, NOT the `ui` barrel
60
+ - Requires @tanstack/react-table and @tanstack/react-virtual as peer dependencies
61
+ - When onSort is provided, sorting is manual (server-side) — rows stay in data order
62
+ - When pagination prop is provided, pagination is manual — pass total count
63
+ - selectedIds syncs via useEffect — provide getRowId for custom row IDs
64
+ - onRowClick does NOT fire when clicking checkboxes, buttons, links, or inputs
65
+ - Use defaultDensity="compact" for Karm-style h-9 rows
66
+
67
+ ## Changes
68
+ ### v0.16.1
69
+ - **Fixed** `serverPagination` object reference in `useCallback` dependency caused stale closure — now uses stable ref for `onPageChange`
70
+ - **Fixed** `onSelectionChange` effect fired every render due to `table` in dependency array — now derives selected rows directly
71
+ - **Fixed** `selectedRows` useMemo for bulk actions had same `table` dependency issue
72
+
73
+ ### v0.16.0
74
+ - **Added** `onSort` callback for server-side sorting
75
+ - **Added** `emptyState` ReactNode slot
76
+ - **Added** `loading` prop with shimmer skeleton rows
77
+ - **Added** `selectedIds` + `selectableFilter` for controlled selection
78
+ - **Added** `pagination` prop for server-side pagination
79
+ - **Added** `singleExpand` prop
80
+ - **Added** `stickyHeader` prop
81
+ - **Added** `onRowClick` handler
82
+ - **Added** `bulkActions` floating action bar
83
+
84
+ ### v0.5.0
85
+ - **Changed** (BREAKING) Removed from `@devalok/shilp-sutra/ui` barrel export — must use `@devalok/shilp-sutra/ui/data-table`
86
+
87
+ ### v0.1.1
88
+ - **Fixed** `useEffect` exhaustive-deps with proper dependency array
89
+
90
+ ### v0.1.0
91
+ - **Added** Initial release
@@ -0,0 +1,51 @@
1
+ # Dialog
2
+
3
+ - Import: @devalok/shilp-sutra/ui/dialog
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Compound Components
8
+ Dialog (root)
9
+ DialogTrigger
10
+ DialogContent
11
+ DialogHeader
12
+ DialogTitle
13
+ DialogDescription
14
+ [body content]
15
+ DialogFooter
16
+ DialogClose
17
+
18
+ ## Defaults
19
+ none
20
+
21
+ ## Example
22
+ ```jsx
23
+ <Dialog>
24
+ <DialogTrigger asChild><Button>Open</Button></DialogTrigger>
25
+ <DialogContent>
26
+ <DialogHeader>
27
+ <DialogTitle>Edit Profile</DialogTitle>
28
+ <DialogDescription>Make changes to your profile.</DialogDescription>
29
+ </DialogHeader>
30
+ <div>Form fields here</div>
31
+ <DialogFooter>
32
+ <Button>Save</Button>
33
+ </DialogFooter>
34
+ </DialogContent>
35
+ </Dialog>
36
+ ```
37
+
38
+ ## Gotchas
39
+ - DialogTitle is required for accessibility — screen readers announce it when the dialog opens
40
+
41
+ ## Changes
42
+ ### v0.18.0
43
+ - **Changed** Overlay animations migrated to Framer Motion (physics-based springs)
44
+ - **Added** `DialogContentProps`, `DialogTitleProps` type exports
45
+ - **Fixed** Context provider value wrapped in `useMemo` for performance
46
+
47
+ ### v0.3.0
48
+ - **Fixed** DialogHeader/Footer now support ref forwarding
49
+
50
+ ### v0.1.0
51
+ - **Added** Initial release
@@ -0,0 +1,45 @@
1
+ # DropdownMenu
2
+
3
+ - Import: @devalok/shilp-sutra/ui/dropdown-menu
4
+ - Server-safe: No
5
+ - Category: ui
6
+
7
+ ## Compound Components
8
+ DropdownMenu (root)
9
+ DropdownMenuTrigger
10
+ DropdownMenuContent
11
+ DropdownMenuLabel
12
+ DropdownMenuSeparator
13
+ DropdownMenuItem (+ DropdownMenuShortcut for keyboard hints)
14
+ DropdownMenuCheckboxItem
15
+ DropdownMenuRadioGroup > DropdownMenuRadioItem
16
+ DropdownMenuGroup
17
+ DropdownMenuSub > DropdownMenuSubTrigger, DropdownMenuSubContent
18
+
19
+ ## Defaults
20
+ none
21
+
22
+ ## Example
23
+ ```jsx
24
+ <DropdownMenu>
25
+ <DropdownMenuTrigger asChild><Button variant="ghost">Menu</Button></DropdownMenuTrigger>
26
+ <DropdownMenuContent>
27
+ <DropdownMenuItem>Profile</DropdownMenuItem>
28
+ <DropdownMenuSeparator />
29
+ <DropdownMenuItem>Logout</DropdownMenuItem>
30
+ </DropdownMenuContent>
31
+ </DropdownMenu>
32
+ ```
33
+
34
+ ## Gotchas
35
+ - Use `asChild` on DropdownMenuTrigger to render your own button element
36
+
37
+ ## Changes
38
+ ### v0.18.0
39
+ - **Added** `DropdownMenuContentProps`, `DropdownMenuItemProps` type exports
40
+
41
+ ### v0.14.0
42
+ - **Changed** z-index promoted from `z-dropdown` (1000) to `z-popover` (1400) — fixes dropdown rendering behind Sheet/Dialog overlays
43
+
44
+ ### v0.1.0
45
+ - **Added** Initial release