@devalok/shilp-sutra 0.18.0 → 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/dist/_chunks/motion-provider.js +24 -0
- package/dist/_chunks/primitives.js +101 -101
- package/dist/_chunks/tree-view.js +12 -12
- package/dist/_chunks/use-calendar.js +1 -1
- package/dist/_chunks/vendor-utils.js +2 -2
- package/dist/composed/activity-feed.js +21 -21
- package/dist/composed/avatar-group.js +25 -25
- package/dist/composed/command-palette.js +3 -3
- package/dist/composed/confirm-dialog.js +1 -1
- package/dist/composed/content-card.js +1 -1
- package/dist/composed/empty-state.js +2 -2
- package/dist/composed/error-boundary.js +2 -2
- package/dist/composed/global-loading.js +10 -10
- package/dist/composed/lib/string-utils.d.ts +0 -1
- package/dist/composed/lib/string-utils.js +0 -1
- package/dist/composed/loading-skeleton.js +1 -1
- package/dist/composed/member-picker.js +6 -6
- package/dist/composed/page-header.js +1 -1
- package/dist/composed/page-skeletons.js +1 -1
- package/dist/composed/priority-indicator.js +6 -6
- package/dist/composed/rich-text-editor.js +1 -1
- package/dist/composed/schedule-view.js +15 -15
- package/dist/composed/simple-tooltip.js +8 -8
- package/dist/composed/status-badge.js +12 -12
- package/dist/motion/index.d.ts +1 -1
- package/dist/motion/index.d.ts.map +1 -1
- package/dist/motion/index.js +8 -6
- package/dist/motion/primitives-index.js +184 -8
- package/dist/shell/app-command-palette.js +1 -1
- package/dist/shell/bottom-navbar.js +3 -3
- package/dist/shell/notification-center.js +35 -35
- package/dist/shell/notification-preferences.js +29 -28
- package/dist/shell/sidebar.js +56 -56
- package/dist/shell/top-bar.js +25 -25
- package/dist/ui/accordion.js +11 -11
- package/dist/ui/alert-dialog.js +41 -41
- package/dist/ui/alert.js +10 -10
- package/dist/ui/aspect-ratio.js +5 -5
- package/dist/ui/autocomplete.js +15 -15
- package/dist/ui/avatar.js +4 -4
- package/dist/ui/badge.js +11 -11
- package/dist/ui/banner.js +3 -3
- package/dist/ui/breadcrumb.js +8 -8
- package/dist/ui/button-group.js +4 -4
- package/dist/ui/button.js +25 -25
- package/dist/ui/card.js +5 -5
- package/dist/ui/charts/index.js +4 -4
- package/dist/ui/checkbox.js +4 -4
- package/dist/ui/chip.js +14 -14
- package/dist/ui/code.js +1 -1
- package/dist/ui/collapsible.js +7 -7
- package/dist/ui/color-input.js +1 -1
- package/dist/ui/combobox.js +5 -5
- package/dist/ui/container.js +4 -4
- package/dist/ui/context-menu.js +4 -4
- package/dist/ui/data-table-toolbar.js +18 -18
- package/dist/ui/data-table.js +55 -55
- package/dist/ui/dialog.js +3 -3
- package/dist/ui/dropdown-menu.js +3 -3
- package/dist/ui/file-upload.js +10 -10
- package/dist/ui/form.js +1 -1
- package/dist/ui/hover-card.js +12 -12
- package/dist/ui/icon-button.js +9 -9
- package/dist/ui/index.js +322 -516
- package/dist/ui/input-otp.js +4 -4
- package/dist/ui/input.js +9 -9
- package/dist/ui/label.js +9 -9
- package/dist/ui/lib/date-utils.d.ts +0 -1
- package/dist/{_chunks → ui/lib}/date-utils.js +1 -2
- package/dist/{_chunks/motion2.js → ui/lib/motion.js} +13 -14
- package/dist/ui/lib/use-ripple.d.ts.map +1 -1
- package/dist/ui/lib/utils.js +1 -1
- package/dist/ui/link.js +1 -1
- package/dist/ui/menubar.js +66 -66
- package/dist/ui/navigation-menu.js +4 -4
- package/dist/ui/number-input.js +9 -9
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/popover.js +18 -18
- package/dist/ui/progress.js +4 -4
- package/dist/ui/radio.js +11 -11
- package/dist/ui/search-input.js +2 -2
- package/dist/ui/segmented-control.d.ts +2 -0
- package/dist/ui/segmented-control.d.ts.map +1 -1
- package/dist/ui/segmented-control.js +59 -55
- package/dist/ui/select.js +19 -19
- package/dist/ui/separator.js +5 -5
- package/dist/ui/sheet.js +10 -10
- package/dist/ui/sidebar.js +574 -38
- package/dist/ui/skeleton.js +1 -1
- package/dist/ui/slider.js +9 -9
- package/dist/ui/spinner.js +2 -2
- package/dist/ui/stack.js +1 -1
- package/dist/ui/stat-card.js +35 -35
- package/dist/ui/stepper.d.ts +1 -3
- package/dist/ui/stepper.d.ts.map +1 -1
- package/dist/ui/stepper.js +74 -74
- package/dist/ui/switch.js +7 -7
- package/dist/ui/table.js +28 -28
- package/dist/ui/tabs.js +10 -10
- package/dist/ui/text.js +1 -1
- package/dist/ui/textarea.js +10 -10
- package/dist/ui/toast.js +12 -12
- package/dist/ui/toaster.js +11 -11
- package/dist/ui/toggle-group.js +2 -2
- package/dist/ui/toggle.js +8 -8
- package/dist/ui/tooltip.js +21 -21
- package/dist/ui/visually-hidden.js +3 -3
- 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 +3384 -1591
- package/llms.txt +4 -4
- package/package.json +28 -3
- package/dist/_chunks/avatar.js +0 -52
- package/dist/_chunks/button-group.js +0 -27
- package/dist/_chunks/button.js +0 -113
- package/dist/_chunks/card.js +0 -50
- package/dist/_chunks/checkbox.js +0 -16
- package/dist/_chunks/form.js +0 -27
- package/dist/_chunks/sidebar.js +0 -606
- package/dist/_chunks/spinner.js +0 -64
- package/dist/_chunks/tooltip.js +0 -30
- package/dist/_chunks/utils.js +0 -17
- package/dist/motion/motion-provider.js +0 -24
- package/dist/motion/primitives.js +0 -187
- /package/dist/_chunks/{motion.js → framer.js} +0 -0
|
@@ -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
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# FileUpload
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/file-upload
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
onFiles: (files: File[]) => void (REQUIRED)
|
|
9
|
+
accept: string (MIME or extension, e.g. "image/*", ".pdf,.doc")
|
|
10
|
+
maxSize: number (bytes, default: 10MB)
|
|
11
|
+
multiple: boolean
|
|
12
|
+
uploading: boolean
|
|
13
|
+
progress: number (0-100)
|
|
14
|
+
error: string
|
|
15
|
+
compact: boolean (inline button mode vs drop zone)
|
|
16
|
+
disabled: boolean
|
|
17
|
+
label: string
|
|
18
|
+
sublabel: string
|
|
19
|
+
|
|
20
|
+
## Defaults
|
|
21
|
+
compact: false
|
|
22
|
+
maxSize: 10MB (10485760 bytes)
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
```jsx
|
|
26
|
+
<FileUpload
|
|
27
|
+
accept="image/*"
|
|
28
|
+
maxSize={2 * 1024 * 1024}
|
|
29
|
+
onFiles={(files) => uploadAvatar(files[0])}
|
|
30
|
+
label="Upload profile photo"
|
|
31
|
+
sublabel="PNG, JPG up to 2MB"
|
|
32
|
+
/>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Gotchas
|
|
36
|
+
- compact=true renders a small inline button; false (default) renders a large drag-and-drop zone
|
|
37
|
+
- Client-side validation: invalid files are rejected before onFiles is called
|
|
38
|
+
|
|
39
|
+
## Changes
|
|
40
|
+
### v0.1.0
|
|
41
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# FormField / FormHelperText / useFormField
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/form
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
### FormField
|
|
9
|
+
state: "helper" | "error" | "warning" | "success" (default: "helper")
|
|
10
|
+
helperTextId: string (auto-generated if omitted)
|
|
11
|
+
required: boolean
|
|
12
|
+
|
|
13
|
+
### FormHelperText
|
|
14
|
+
state: "helper" | "error" | "warning" | "success" (inherits from FormField context)
|
|
15
|
+
|
|
16
|
+
## Types
|
|
17
|
+
FormHelperState = 'helper' | 'error' | 'warning' | 'success'
|
|
18
|
+
|
|
19
|
+
## Hook
|
|
20
|
+
useFormField() => { state, helperTextId, required }
|
|
21
|
+
|
|
22
|
+
## Defaults
|
|
23
|
+
state: "helper"
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
```jsx
|
|
27
|
+
<FormField state="error">
|
|
28
|
+
<Label htmlFor="email">Email</Label>
|
|
29
|
+
<Input id="email" state="error" />
|
|
30
|
+
<FormHelperText>Please enter a valid email.</FormHelperText>
|
|
31
|
+
</FormField>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Gotchas
|
|
35
|
+
- getFormFieldA11y() was REMOVED — use useFormField() hook instead
|
|
36
|
+
- FormHelperText auto-reads state and id from FormField context
|
|
37
|
+
- FormHelperText renders role="alert" when state="error"
|
|
38
|
+
|
|
39
|
+
## Changes
|
|
40
|
+
### v0.18.0
|
|
41
|
+
- **Fixed** Wrapped FormField context provider value in `useMemo` for performance
|
|
42
|
+
|
|
43
|
+
### v0.8.0
|
|
44
|
+
- **Fixed** Input/Textarea now consume FormField context automatically (`aria-describedby`, `aria-invalid`, `aria-required`)
|
|
45
|
+
|
|
46
|
+
### v0.3.0
|
|
47
|
+
- **Added** `useFormField()` hook for automatic aria-describedby wiring
|
|
48
|
+
- **Changed** (BREAKING) FormField auto-wires `aria-describedby` via context. `getFormFieldA11y()` removed
|
|
49
|
+
|
|
50
|
+
### v0.1.0
|
|
51
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# HoverCard
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/hover-card
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Compound Components
|
|
8
|
+
HoverCard (root)
|
|
9
|
+
HoverCardTrigger
|
|
10
|
+
HoverCardContent
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
```jsx
|
|
14
|
+
<HoverCard>
|
|
15
|
+
<HoverCardTrigger asChild><span>Hover me</span></HoverCardTrigger>
|
|
16
|
+
<HoverCardContent>Preview content</HoverCardContent>
|
|
17
|
+
</HoverCard>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Gotchas
|
|
21
|
+
- Overlay component — uses Framer Motion for enter/exit animations (v0.18.0)
|
|
22
|
+
|
|
23
|
+
## Changes
|
|
24
|
+
### v0.18.0
|
|
25
|
+
- **Changed** Migrated to Framer Motion for enter/exit animations
|
|
26
|
+
- **Added** `HoverCardContentProps` type export
|
|
27
|
+
|
|
28
|
+
### v0.14.0
|
|
29
|
+
- **Changed** z-index promoted from `z-dropdown` (1000) to `z-popover` (1400) — fixes content rendering behind Sheet/Dialog overlays
|
|
30
|
+
|
|
31
|
+
### v0.1.0
|
|
32
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# IconButton
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/icon-button
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
icon: ReactNode (REQUIRED)
|
|
9
|
+
aria-label: string (REQUIRED — WCAG AA mandatory)
|
|
10
|
+
shape: "square" | "circle"
|
|
11
|
+
size: "sm" | "md" | "lg"
|
|
12
|
+
variant: same as Button (solid, outline, ghost, link)
|
|
13
|
+
color: same as Button (default, error)
|
|
14
|
+
loading: boolean
|
|
15
|
+
disabled: boolean
|
|
16
|
+
|
|
17
|
+
## Defaults
|
|
18
|
+
shape: "square"
|
|
19
|
+
size: "md"
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
```jsx
|
|
23
|
+
<IconButton icon={<IconEdit />} variant="ghost" aria-label="Edit item" />
|
|
24
|
+
<IconButton icon={<IconX />} shape="circle" variant="ghost" size="sm" aria-label="Close" />
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Gotchas
|
|
28
|
+
- aria-label is enforced by TypeScript — you MUST provide it
|
|
29
|
+
- Prefer IconButton over Button with size="icon-*" for icon-only buttons
|
|
30
|
+
|
|
31
|
+
## Changes
|
|
32
|
+
### v0.1.0
|
|
33
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# InputOTP
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/input-otp
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
Standard input-otp props (maxLength, pattern, etc.)
|
|
9
|
+
|
|
10
|
+
## Compound Components
|
|
11
|
+
InputOTP (root)
|
|
12
|
+
InputOTPGroup
|
|
13
|
+
InputOTPSlot (index: number, REQUIRED)
|
|
14
|
+
InputOTPSeparator
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
```jsx
|
|
18
|
+
<InputOTP maxLength={6}>
|
|
19
|
+
<InputOTPGroup>
|
|
20
|
+
<InputOTPSlot index={0} />
|
|
21
|
+
<InputOTPSlot index={1} />
|
|
22
|
+
<InputOTPSlot index={2} />
|
|
23
|
+
</InputOTPGroup>
|
|
24
|
+
<InputOTPSeparator />
|
|
25
|
+
<InputOTPGroup>
|
|
26
|
+
<InputOTPSlot index={3} />
|
|
27
|
+
<InputOTPSlot index={4} />
|
|
28
|
+
<InputOTPSlot index={5} />
|
|
29
|
+
</InputOTPGroup>
|
|
30
|
+
</InputOTP>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Gotchas
|
|
34
|
+
- Each InputOTPSlot requires an `index` prop (0-based)
|
|
35
|
+
|
|
36
|
+
## Changes
|
|
37
|
+
### v0.18.0
|
|
38
|
+
- **Added** `InputOTPProps` type export
|
|
39
|
+
|
|
40
|
+
### v0.1.1
|
|
41
|
+
- **Fixed** `animate-caret-blink` keyframe added to Tailwind preset — caret animation was silently broken
|
|
42
|
+
|
|
43
|
+
### v0.1.0
|
|
44
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Input
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/input
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
size: "sm" | "md" | "lg"
|
|
9
|
+
state: InputState
|
|
10
|
+
startIcon: ReactNode
|
|
11
|
+
endIcon: ReactNode
|
|
12
|
+
(plus all standard HTML input attributes except native "size")
|
|
13
|
+
|
|
14
|
+
## Types
|
|
15
|
+
InputState = 'default' | 'error' | 'warning' | 'success'
|
|
16
|
+
|
|
17
|
+
## Defaults
|
|
18
|
+
size: "md"
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
```jsx
|
|
22
|
+
<Input type="email" placeholder="you@example.com" state="error" startIcon={<IconMail />} />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Gotchas
|
|
26
|
+
- HTML native "size" attribute is excluded — use CSS width instead
|
|
27
|
+
- state="error" sets aria-invalid automatically
|
|
28
|
+
- Inside FormField: auto-inherits state, aria-describedby, aria-required from context (explicit props override)
|
|
29
|
+
- Resting border is border-subtle (soft); focus ring is ring-1 at 50% opacity (v0.12.0)
|
|
30
|
+
- All sizes (sm, md, lg) use text-ds-md (14px) font — size only affects height and padding (v0.15.0)
|
|
31
|
+
|
|
32
|
+
## Changes
|
|
33
|
+
### v0.15.0
|
|
34
|
+
- **Changed** `lg` size font changed from `text-ds-lg` (18px) to `text-ds-md` (14px) — all input sizes now use 14px for consistency
|
|
35
|
+
- **Changed** `md` size font standardized to `text-ds-md` (14px) from mixed values
|
|
36
|
+
|
|
37
|
+
### v0.12.0
|
|
38
|
+
- **Changed** Softer resting border (`border-border-subtle` instead of `border-border`), subtler focus ring (`ring-1 ring-focus/50` instead of `ring-2 ring-focus`)
|
|
39
|
+
- **Changed** Reverted split `pl-*/pr-*` size variants back to `px-*`; icon padding uses `pl-ds-07`/`pr-ds-07`
|
|
40
|
+
|
|
41
|
+
### v0.8.0
|
|
42
|
+
- **Fixed** Now consumes FormField context automatically (`aria-describedby`, `aria-invalid`, `aria-required`)
|
|
43
|
+
|
|
44
|
+
### v0.4.2
|
|
45
|
+
- **Added** `inputVariants` export
|
|
46
|
+
|
|
47
|
+
### v0.1.0
|
|
48
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Label
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/label
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
required: boolean (shows red asterisk)
|
|
9
|
+
htmlFor: string
|
|
10
|
+
(plus standard Radix Label props)
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
```jsx
|
|
14
|
+
<Label htmlFor="email" required>Email Address</Label>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Gotchas
|
|
18
|
+
- Use with FormField for automatic aria wiring
|
|
19
|
+
|
|
20
|
+
## Changes
|
|
21
|
+
### v0.2.0
|
|
22
|
+
- **Fixed** Children rendering verified and covered by tests — issue was caused by `@primitives` type leak, not a runtime bug
|
|
23
|
+
|
|
24
|
+
### v0.1.0
|
|
25
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Link
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/link
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
inline: boolean (default: true — "inline" or "block" display)
|
|
9
|
+
asChild: boolean (merge with child element, e.g. Next.js Link)
|
|
10
|
+
(plus standard anchor attributes)
|
|
11
|
+
|
|
12
|
+
## Defaults
|
|
13
|
+
inline: true
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
```jsx
|
|
17
|
+
<Link href="/docs">Documentation</Link>
|
|
18
|
+
<Link asChild><NextLink href="/about">About</NextLink></Link>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Gotchas
|
|
22
|
+
- Use asChild with framework-specific Link components (e.g. Next.js Link)
|
|
23
|
+
|
|
24
|
+
## Changes
|
|
25
|
+
### v0.18.0
|
|
26
|
+
- **Fixed** Color tokens — `text-info-9` changed to `text-accent-11` (links are interactive = accent scale)
|
|
27
|
+
|
|
28
|
+
### v0.1.0
|
|
29
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Menubar
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/menubar
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Compound Components
|
|
8
|
+
Menubar (root)
|
|
9
|
+
MenubarMenu
|
|
10
|
+
MenubarTrigger
|
|
11
|
+
MenubarContent
|
|
12
|
+
MenubarItem (+ MenubarShortcut)
|
|
13
|
+
MenubarCheckboxItem
|
|
14
|
+
MenubarRadioGroup > MenubarRadioItem
|
|
15
|
+
MenubarLabel
|
|
16
|
+
MenubarSeparator
|
|
17
|
+
MenubarSub > MenubarSubTrigger, MenubarSubContent
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
```jsx
|
|
21
|
+
<Menubar>
|
|
22
|
+
<MenubarMenu>
|
|
23
|
+
<MenubarTrigger>File</MenubarTrigger>
|
|
24
|
+
<MenubarContent>
|
|
25
|
+
<MenubarItem>New<MenubarShortcut>Ctrl+N</MenubarShortcut></MenubarItem>
|
|
26
|
+
<MenubarSeparator />
|
|
27
|
+
<MenubarItem>Exit</MenubarItem>
|
|
28
|
+
</MenubarContent>
|
|
29
|
+
</MenubarMenu>
|
|
30
|
+
</Menubar>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Gotchas
|
|
34
|
+
- Follows the standard Radix Menubar compound pattern
|
|
35
|
+
|
|
36
|
+
## Changes
|
|
37
|
+
### v0.18.0
|
|
38
|
+
- **Added** `MenubarContentProps`, `MenubarItemProps` type exports
|
|
39
|
+
|
|
40
|
+
### v0.14.0
|
|
41
|
+
- **Changed** z-index promoted from `z-dropdown` (1000) to `z-popover` (1400) — fixes content rendering behind Sheet/Dialog overlays
|
|
42
|
+
|
|
43
|
+
### v0.1.0
|
|
44
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# NavigationMenu
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/navigation-menu
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Compound Components
|
|
8
|
+
NavigationMenu (root)
|
|
9
|
+
NavigationMenuList
|
|
10
|
+
NavigationMenuItem
|
|
11
|
+
NavigationMenuTrigger (for items with content panels)
|
|
12
|
+
NavigationMenuContent (dropdown panel)
|
|
13
|
+
NavigationMenuLink (for direct links)
|
|
14
|
+
NavigationMenuIndicator
|
|
15
|
+
NavigationMenuViewport
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
```jsx
|
|
19
|
+
<NavigationMenu>
|
|
20
|
+
<NavigationMenuList>
|
|
21
|
+
<NavigationMenuItem>
|
|
22
|
+
<NavigationMenuTrigger>Products</NavigationMenuTrigger>
|
|
23
|
+
<NavigationMenuContent>
|
|
24
|
+
<ul>...</ul>
|
|
25
|
+
</NavigationMenuContent>
|
|
26
|
+
</NavigationMenuItem>
|
|
27
|
+
<NavigationMenuItem>
|
|
28
|
+
<NavigationMenuLink href="/about">About</NavigationMenuLink>
|
|
29
|
+
</NavigationMenuItem>
|
|
30
|
+
</NavigationMenuList>
|
|
31
|
+
</NavigationMenu>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Gotchas
|
|
35
|
+
- Uses Framer Motion for enter/exit animations (v0.18.0)
|
|
36
|
+
|
|
37
|
+
## Changes
|
|
38
|
+
### v0.18.0
|
|
39
|
+
- **Changed** Migrated to Framer Motion for enter/exit animations
|
|
40
|
+
- **Added** `NavigationMenuProps`, `NavigationMenuContentProps` type exports
|
|
41
|
+
|
|
42
|
+
### v0.1.1
|
|
43
|
+
- **Fixed** Token compliance — icon sizes replaced with `h-ico-sm w-ico-sm`
|
|
44
|
+
|
|
45
|
+
### v0.1.0
|
|
46
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# NumberInput
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/number-input
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
value: number (default: 0)
|
|
9
|
+
onValueChange: (value: number) => void
|
|
10
|
+
min: number
|
|
11
|
+
max: number
|
|
12
|
+
step: number (default: 1)
|
|
13
|
+
disabled: boolean
|
|
14
|
+
|
|
15
|
+
## Defaults
|
|
16
|
+
value: 0
|
|
17
|
+
step: 1
|
|
18
|
+
min: Number.MIN_SAFE_INTEGER
|
|
19
|
+
max: Number.MAX_SAFE_INTEGER
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
```jsx
|
|
23
|
+
<NumberInput value={qty} onValueChange={setQty} min={1} max={99} />
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Gotchas
|
|
27
|
+
- Controlled only — buttons won't work without onValueChange
|
|
28
|
+
|
|
29
|
+
## Changes
|
|
30
|
+
### v0.18.0
|
|
31
|
+
- **Fixed** Replaced `parseInt` with `Number()`, handle empty input
|
|
32
|
+
|
|
33
|
+
### v0.15.0
|
|
34
|
+
- **Changed** `md` size font standardized to `text-ds-md` (14px)
|
|
35
|
+
|
|
36
|
+
### v0.8.0
|
|
37
|
+
- **Fixed** FormField context consumption, `aria-label` fallback, `parseInt` radix parameter
|
|
38
|
+
|
|
39
|
+
### v0.3.0
|
|
40
|
+
- **Changed** (BREAKING) `onChange` renamed to `onValueChange`
|
|
41
|
+
- **Changed** Now extends HTMLAttributes — accepts all standard HTML props
|
|
42
|
+
|
|
43
|
+
### v0.1.0
|
|
44
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Pagination
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra/ui/pagination
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: ui
|
|
6
|
+
|
|
7
|
+
## Compound Components
|
|
8
|
+
PaginationRoot (nav)
|
|
9
|
+
PaginationContent (ul)
|
|
10
|
+
PaginationItem (li)
|
|
11
|
+
PaginationLink (isActive: boolean, asChild: boolean)
|
|
12
|
+
PaginationPrevious
|
|
13
|
+
PaginationNext
|
|
14
|
+
PaginationEllipsis
|
|
15
|
+
PaginationNav (convenience wrapper)
|
|
16
|
+
|
|
17
|
+
## Utility
|
|
18
|
+
generatePagination(current: number, total: number, siblingCount: number) => (number | 'ellipsis')[]
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
```jsx
|
|
22
|
+
<PaginationRoot>
|
|
23
|
+
<PaginationContent>
|
|
24
|
+
<PaginationItem><PaginationPrevious onClick={() => setPage(p - 1)} /></PaginationItem>
|
|
25
|
+
{generatePagination(page, totalPages, 1).map((item, i) =>
|
|
26
|
+
item === 'ellipsis'
|
|
27
|
+
? <PaginationItem key={i}><PaginationEllipsis /></PaginationItem>
|
|
28
|
+
: <PaginationItem key={i}>
|
|
29
|
+
<PaginationLink isActive={item === page} onClick={() => setPage(item)}>
|
|
30
|
+
{item}
|
|
31
|
+
</PaginationLink>
|
|
32
|
+
</PaginationItem>
|
|
33
|
+
)}
|
|
34
|
+
<PaginationItem><PaginationNext onClick={() => setPage(p + 1)} /></PaginationItem>
|
|
35
|
+
</PaginationContent>
|
|
36
|
+
</PaginationRoot>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Gotchas
|
|
40
|
+
- Root component is PaginationRoot (NOT Pagination)
|
|
41
|
+
|
|
42
|
+
## Changes
|
|
43
|
+
### v0.1.1
|
|
44
|
+
- **Fixed** Pagination link padding uses `ds-*` tokens instead of Tailwind arbitrary values
|
|
45
|
+
|
|
46
|
+
### v0.1.0
|
|
47
|
+
- **Added** Initial release
|
|
48
|
+
- **Added** PaginationNav compound wrapper with `generatePagination` helper
|