@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,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
|
|
@@ -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
|