@devalok/shilp-sutra 0.39.0 → 0.40.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.
- package/AGENTS.md +151 -0
- package/MIGRATION.md +137 -0
- package/README.md +3 -0
- package/dist/_chunks/badge-group.js +75 -74
- package/dist/_chunks/badge-group.js.map +1 -1
- package/dist/_chunks/chart-container.js +50 -0
- package/dist/_chunks/chart-container.js.map +1 -0
- package/dist/_chunks/chat.js +231 -223
- package/dist/_chunks/chat.js.map +1 -1
- package/dist/_chunks/colors.js +30 -0
- package/dist/_chunks/colors.js.map +1 -0
- package/dist/_chunks/emoji-data.js +45 -0
- package/dist/_chunks/emoji-data.js.map +1 -0
- package/dist/_chunks/grid-lines.js +72 -0
- package/dist/_chunks/grid-lines.js.map +1 -0
- package/dist/_chunks/mention-suggestion.js +31 -259
- package/dist/_chunks/mention-suggestion.js.map +1 -1
- package/dist/_chunks/normalize-icon.js +18 -0
- package/dist/_chunks/normalize-icon.js.map +1 -0
- package/dist/_chunks/oauth-button.js +227 -0
- package/dist/_chunks/oauth-button.js.map +1 -0
- package/dist/_chunks/primitives.js +107 -107
- package/dist/_chunks/primitives.js.map +1 -1
- package/dist/_chunks/{text.js → success.js} +24 -61
- package/dist/_chunks/success.js.map +1 -0
- package/dist/_chunks/tiptap.js +1952 -1949
- package/dist/_chunks/tiptap.js.map +1 -1
- package/dist/_chunks/tooltip.js +58 -0
- package/dist/_chunks/tooltip.js.map +1 -0
- package/dist/_chunks/tree-view.js +101 -96
- package/dist/_chunks/tree-view.js.map +1 -1
- package/dist/ai/ai-command-provider.d.ts +3 -2
- package/dist/ai/ai-command-provider.d.ts.map +1 -1
- package/dist/ai/ai-command-provider.js.map +1 -1
- package/dist/ai/block-renderer.js +11 -9
- package/dist/ai/block-renderer.js.map +1 -1
- package/dist/ai/blocks/error.js +31 -0
- package/dist/ai/blocks/error.js.map +1 -0
- package/dist/ai/blocks/index.d.ts +0 -2
- package/dist/ai/blocks/index.d.ts.map +1 -1
- package/dist/ai/blocks/index.js +2 -2
- package/dist/ai/blocks/text.js +19 -0
- package/dist/ai/blocks/text.js.map +1 -0
- package/dist/ai/command-bar.d.ts.map +1 -1
- package/dist/ai/command-bar.js +192 -187
- package/dist/ai/command-bar.js.map +1 -1
- package/dist/ai/conversation.d.ts +2 -1
- package/dist/ai/conversation.d.ts.map +1 -1
- package/dist/ai/conversation.js +88 -83
- package/dist/ai/conversation.js.map +1 -1
- package/dist/ai/index.d.ts +0 -4
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +45 -46
- package/dist/ai/index.js.map +1 -1
- package/dist/composed/activity-feed.d.ts +2 -1
- package/dist/composed/activity-feed.d.ts.map +1 -1
- package/dist/composed/activity-feed.js.map +1 -1
- package/dist/composed/bulk-action-bar.d.ts +2 -2
- package/dist/composed/bulk-action-bar.d.ts.map +1 -1
- package/dist/composed/bulk-action-bar.js +11 -11
- package/dist/composed/bulk-action-bar.js.map +1 -1
- package/dist/composed/command-palette.d.ts +2 -1
- package/dist/composed/command-palette.d.ts.map +1 -1
- package/dist/composed/command-palette.js +103 -98
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/date-picker/index.js +747 -3
- package/dist/composed/date-picker/index.js.map +1 -0
- package/dist/composed/empty-state.d.ts +3 -3
- package/dist/composed/empty-state.d.ts.map +1 -1
- package/dist/composed/empty-state.js +40 -31
- package/dist/composed/empty-state.js.map +1 -1
- package/dist/composed/extensions/emoji-node.js +81 -0
- package/dist/composed/extensions/emoji-node.js.map +1 -0
- package/dist/composed/extensions/emoji-suggestion.js +117 -0
- package/dist/composed/extensions/emoji-suggestion.js.map +1 -0
- package/dist/composed/file-preview.js +498 -2
- package/dist/{_chunks → composed}/file-preview.js.map +1 -1
- package/dist/composed/index.d.ts +0 -15
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +16 -24
- package/dist/composed/rich-chat-input.js +2073 -2
- package/dist/{_chunks → composed}/rich-chat-input.js.map +1 -1
- package/dist/composed/rich-text-editor.js +64 -61
- package/dist/composed/rich-text-editor.js.map +1 -1
- package/dist/composed/status-badge.d.ts +3 -2
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js +58 -53
- package/dist/composed/status-badge.js.map +1 -1
- package/dist/shell/app-command-palette.d.ts +2 -1
- package/dist/shell/app-command-palette.d.ts.map +1 -1
- package/dist/shell/app-command-palette.js.map +1 -1
- package/dist/shell/bottom-navbar.d.ts +3 -1
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +90 -82
- package/dist/shell/bottom-navbar.js.map +1 -1
- package/dist/shell/command-registry.d.ts +2 -1
- package/dist/shell/command-registry.d.ts.map +1 -1
- package/dist/shell/command-registry.js.map +1 -1
- package/dist/shell/sidebar.d.ts +7 -4
- package/dist/shell/sidebar.d.ts.map +1 -1
- package/dist/shell/sidebar.js +143 -129
- package/dist/shell/sidebar.js.map +1 -1
- package/dist/shell/top-bar.d.ts +4 -3
- package/dist/shell/top-bar.d.ts.map +1 -1
- package/dist/shell/top-bar.js +114 -106
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/ui/badge.d.ts +3 -2
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/button.d.ts +3 -2
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +54 -53
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/charts/area-chart.js +177 -0
- package/dist/ui/charts/area-chart.js.map +1 -0
- package/dist/ui/charts/bar-chart.js +127 -0
- package/dist/ui/charts/bar-chart.js.map +1 -0
- package/dist/ui/charts/chart-container.js +3 -0
- package/dist/ui/charts/gauge-chart.js +72 -0
- package/dist/ui/charts/gauge-chart.js.map +1 -0
- package/dist/ui/charts/index.js +10 -1035
- package/dist/ui/charts/line-chart.js +135 -0
- package/dist/ui/charts/line-chart.js.map +1 -0
- package/dist/ui/charts/pie-chart.js +111 -0
- package/dist/ui/charts/pie-chart.js.map +1 -0
- package/dist/ui/charts/radar-chart.js +170 -0
- package/dist/ui/charts/radar-chart.js.map +1 -0
- package/dist/ui/charts/sparkline.js +119 -0
- package/dist/ui/charts/sparkline.js.map +1 -0
- package/dist/ui/chat/message.d.ts +3 -3
- package/dist/ui/chat/message.d.ts.map +1 -1
- package/dist/ui/chat/system-message.d.ts +2 -1
- package/dist/ui/chat/system-message.d.ts.map +1 -1
- package/dist/ui/combobox.d.ts +2 -1
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +97 -92
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/container.d.ts +6 -1
- package/dist/ui/container.d.ts.map +1 -1
- package/dist/ui/container.js +2 -1
- package/dist/ui/container.js.map +1 -1
- package/dist/ui/icon-button.d.ts +9 -2
- package/dist/ui/icon-button.d.ts.map +1 -1
- package/dist/ui/icon-button.js +14 -13
- package/dist/ui/icon-button.js.map +1 -1
- package/dist/ui/index.d.ts +1 -3
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +31 -33
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/lib/icon-input.d.ts +42 -0
- package/dist/ui/lib/icon-input.d.ts.map +1 -0
- package/dist/ui/lib/normalize-icon.d.ts +39 -0
- package/dist/ui/lib/normalize-icon.d.ts.map +1 -0
- package/dist/ui/oauth-button/index.d.ts +3 -0
- package/dist/ui/oauth-button/index.d.ts.map +1 -0
- package/dist/ui/oauth-button/index.js +3 -0
- package/dist/ui/oauth-button/oauth-button.d.ts +208 -0
- package/dist/ui/oauth-button/oauth-button.d.ts.map +1 -0
- package/dist/ui/progress.js +1 -1
- package/dist/ui/segmented-control.d.ts +3 -4
- package/dist/ui/segmented-control.d.ts.map +1 -1
- package/dist/ui/segmented-control.js +53 -45
- package/dist/ui/segmented-control.js.map +1 -1
- package/dist/ui/stack.d.ts +6 -1
- package/dist/ui/stack.d.ts.map +1 -1
- package/dist/ui/stack.js +2 -1
- package/dist/ui/stack.js.map +1 -1
- package/dist/ui/stat-card.d.ts +2 -3
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +117 -115
- package/dist/ui/stat-card.js.map +1 -1
- package/dist/ui/stepper.d.ts +2 -1
- package/dist/ui/stepper.d.ts.map +1 -1
- package/dist/ui/stepper.js +74 -69
- package/dist/ui/stepper.js.map +1 -1
- package/dist/ui/text.d.ts +7 -2
- package/dist/ui/text.d.ts.map +1 -1
- package/dist/ui/text.js +2 -1
- package/dist/ui/text.js.map +1 -1
- package/dist/ui/toaster.d.ts +11 -2
- package/dist/ui/toaster.d.ts.map +1 -1
- package/dist/ui/toaster.js.map +1 -1
- package/dist/ui/tooltip.js +12 -12
- package/dist/ui/tree-view/tree-item.d.ts +3 -2
- package/dist/ui/tree-view/tree-item.d.ts.map +1 -1
- package/dist/ui/tree-view/use-tree.d.ts +2 -1
- package/dist/ui/tree-view/use-tree.d.ts.map +1 -1
- package/docs/components/ui/oauth-button.md +86 -0
- package/docs/recipes/customize-brand.md +15 -0
- package/docs/recipes/index.md +5 -1
- package/docs/recipes/install-astro.md +15 -0
- package/docs/recipes/install-next-app-router.md +21 -5
- package/docs/recipes/install-next-pages.md +2 -0
- package/docs/recipes/install-remix.md +15 -0
- package/docs/recipes/install-tanstack-start.md +15 -0
- package/docs/recipes/install-vite.md +15 -0
- package/docs/recipes/troubleshoot.md +22 -0
- package/llms-full.txt +87 -1
- package/llms-quick.txt +247 -0
- package/llms.txt +107 -2
- package/package.json +79 -2
- package/scripts/welcome.mjs +219 -0
- package/skill/SKILL.md +22 -3
- package/skill/references/components-full.md +87 -1
- package/skill/references/components.md +107 -2
- package/skill/references/customize-brand.md +15 -0
- package/skill/references/setup-astro.md +15 -0
- package/skill/references/setup-next-app-router.md +21 -5
- package/skill/references/setup-next-pages.md +2 -0
- package/skill/references/setup-remix.md +15 -0
- package/skill/references/setup-tanstack-start.md +15 -0
- package/skill/references/setup-vite.md +15 -0
- package/skill/references/troubleshoot.md +22 -0
- package/dist/_chunks/date-picker.js +0 -748
- package/dist/_chunks/date-picker.js.map +0 -1
- package/dist/_chunks/file-preview.js +0 -499
- package/dist/_chunks/rich-chat-input.js +0 -2071
- package/dist/_chunks/text.js.map +0 -1
- package/dist/ui/charts/index.js.map +0 -1
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Override colors, radius, fonts, and spacing without forking the package. All customization happens through CSS custom properties — no JS configuration.
|
|
4
4
|
|
|
5
|
+
## The fast path: use the Themer
|
|
6
|
+
|
|
7
|
+
Before hand-writing variables, try **[shilp-sutra.devalok.in/themer](https://shilp-sutra.devalok.in/themer)**. It is one funnel with four entry doors:
|
|
8
|
+
|
|
9
|
+
- **Pick an archetype** — Linear, Stripe, Apple, Material, Notion, Vercel, or Devalok. Click → result page.
|
|
10
|
+
- **Use my brand color** — paste a hex or dial OKLCH. Auto-generates the 12-step ramp and suggests an archetype.
|
|
11
|
+
- **Walk me through it** — five-question wizard composes the answers into a theme.
|
|
12
|
+
- **Just exploring** — land on a sample result page to see what you ship away with.
|
|
13
|
+
|
|
14
|
+
Every door drops you at the same result screen: a copy-pasteable CSS block (role tokens + 12-step OKLCH accent ramp), install commands for your package manager, and a share URL that encodes the theme.
|
|
15
|
+
|
|
16
|
+
Paste the snippet into your global stylesheet *after* the `@import "@devalok/shilp-sutra/css";` line. That's the whole flow — no `tailwind.config.ts`, no theme provider, no JS bundle.
|
|
17
|
+
|
|
18
|
+
The rest of this doc covers what to do if the Themer doesn't expose a token you need to override (font stack, spacing scale, focus ring) — fall through to the hand-written cases below.
|
|
19
|
+
|
|
5
20
|
## How tokens layer
|
|
6
21
|
|
|
7
22
|
Shilp Sutra's tokens are organized in three tiers:
|
package/docs/recipes/index.md
CHANGED
|
@@ -29,9 +29,13 @@ If the framework is not listed, start with [install-vite.md](./install-vite.md)
|
|
|
29
29
|
|
|
30
30
|
| Recipe | What it covers |
|
|
31
31
|
|---|---|
|
|
32
|
-
| [customize-brand.md](./customize-brand.md) | Token override cookbook — colors, radius role tokens, `[data-shape]` presets, fonts, spacing scale, dark-mode mapping |
|
|
32
|
+
| [customize-brand.md](./customize-brand.md) | Token override cookbook — colors, radius role tokens, `[data-shape]` presets, fonts, spacing scale, dark-mode mapping. **Start here**, or skip ahead to the Themer ↓ |
|
|
33
33
|
| [server-components.md](./server-components.md) | Per-component RSC-safety matrix; correct import patterns for Server Components |
|
|
34
34
|
|
|
35
|
+
### The fast path: Themer
|
|
36
|
+
|
|
37
|
+
Don't want to write CSS variables by hand? Use **[shilp-sutra.devalok.in/themer](https://shilp-sutra.devalok.in/themer)** — one funnel, four doors (pick an archetype, paste your brand color, take a wizard, or just explore). Every door drops you at a result page with a CSS snippet to paste, install commands, and a share URL.
|
|
38
|
+
|
|
35
39
|
## Diagnostics
|
|
36
40
|
|
|
37
41
|
| Recipe | What it covers |
|
|
@@ -29,6 +29,21 @@ Add only if rendering `<Toaster />`:
|
|
|
29
29
|
pnpm add sonner
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
### 2a. Optional peer dependencies (install ONLY when importing the matching subpath)
|
|
33
|
+
|
|
34
|
+
Some components ship hard peers as optional. **Install BEFORE first import** or Astro's Vite build will fail with `Failed to resolve import`. Skip if you only use core components.
|
|
35
|
+
|
|
36
|
+
| When you import… | Install |
|
|
37
|
+
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
|
38
|
+
| `@devalok/shilp-sutra/ui/charts/*` | `pnpm add d3-array d3-axis d3-format d3-interpolate d3-scale d3-selection d3-shape d3-time-format d3-transition` |
|
|
39
|
+
| `@devalok/shilp-sutra/ui/data-table` | `pnpm add @tanstack/react-table @tanstack/react-virtual` |
|
|
40
|
+
| `@devalok/shilp-sutra/composed/date-picker` (+ DateRange, DateTime, Calendar) | `pnpm add date-fns` |
|
|
41
|
+
| `@devalok/shilp-sutra/composed/rich-text-editor` (+ RichChatInput, RichTextViewer) | `pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder` |
|
|
42
|
+
| `@devalok/shilp-sutra/ui/input-otp` | `pnpm add input-otp` |
|
|
43
|
+
| `@devalok/shilp-sutra/composed/file-preview` | `pnpm add react-pdf react-zoom-pan-pinch` |
|
|
44
|
+
| `@devalok/shilp-sutra/composed/markdown-viewer` | `pnpm add react-markdown react-syntax-highlighter` |
|
|
45
|
+
| Any `Icon` / `IconButton` with Tabler icons | `pnpm add @tabler/icons-react` |
|
|
46
|
+
|
|
32
47
|
## 3. Wire Tailwind 4 in `astro.config`
|
|
33
48
|
|
|
34
49
|
Astro has its own `@astrojs/tailwind` integration, but for Tailwind 4 use the Vite plugin directly (Astro 4.5+ supports this):
|
|
@@ -8,10 +8,9 @@ You are in this recipe if **all** of these are true:
|
|
|
8
8
|
|
|
9
9
|
- `package.json` lists `"next"` at version `^13.0.0` or higher
|
|
10
10
|
- An `app/` directory exists at the project root or under `src/`
|
|
11
|
-
- An `app/layout.tsx
|
|
12
|
-
- No `pages/` directory at the project root, OR `pages/` exists but only contains `_app.{js,tsx}` and `_document.{js,tsx}` (legacy artifacts)
|
|
11
|
+
- An `app/layout.{tsx,jsx}` file exists
|
|
13
12
|
|
|
14
|
-
If `pages/`
|
|
13
|
+
If a `pages/` directory exists at the project root AND contains route files (not just `_app`/`_document` legacy artifacts from older `create-next-app` versions), use [install-next-pages.md](./install-next-pages.md). `create-next-app@16+` no longer scaffolds `pages/` for App Router projects.
|
|
15
14
|
|
|
16
15
|
## 2. Install dependencies
|
|
17
16
|
|
|
@@ -47,6 +46,23 @@ Add brand assets package if you need Devalok or Karm logos:
|
|
|
47
46
|
pnpm add @devalok/shilp-sutra-brand
|
|
48
47
|
```
|
|
49
48
|
|
|
49
|
+
### 2a. Optional peer dependencies (install ONLY when importing the matching subpath)
|
|
50
|
+
|
|
51
|
+
Some components depend on third-party libraries that ship as optional peers. **Install BEFORE first import** of the matching component, or `next build` will exit with `Module not found`. Skip entirely if you only use core components (`Button`, `Text`, `Stack`, `Dialog`, `Toast`, `Form*`, `Input`, `Card`, etc.).
|
|
52
|
+
|
|
53
|
+
| When you import… | Install |
|
|
54
|
+
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
|
55
|
+
| `@devalok/shilp-sutra/ui/charts/*` (BarChart, LineChart, …)| `pnpm add d3-array d3-axis d3-format d3-interpolate d3-scale d3-selection d3-shape d3-time-format d3-transition` |
|
|
56
|
+
| `@devalok/shilp-sutra/ui/data-table` | `pnpm add @tanstack/react-table @tanstack/react-virtual` |
|
|
57
|
+
| `@devalok/shilp-sutra/composed/date-picker` (+ DateRange, DateTime, Calendar) | `pnpm add date-fns` |
|
|
58
|
+
| `@devalok/shilp-sutra/composed/rich-text-editor` (+ RichChatInput, RichTextViewer) | `pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder` |
|
|
59
|
+
| `@devalok/shilp-sutra/ui/input-otp` | `pnpm add input-otp` |
|
|
60
|
+
| `@devalok/shilp-sutra/composed/file-preview` | `pnpm add react-pdf react-zoom-pan-pinch` |
|
|
61
|
+
| `@devalok/shilp-sutra/composed/markdown-viewer` | `pnpm add react-markdown react-syntax-highlighter` |
|
|
62
|
+
| Any `Icon` / `IconButton` use with Tabler icons | `pnpm add @tabler/icons-react` |
|
|
63
|
+
|
|
64
|
+
> These aren't in core deps so consumers who never render a chart, OTP input, or rich-text editor don't pay the install / bundle cost. One-time decision at install.
|
|
65
|
+
|
|
50
66
|
## 3. Configure PostCSS
|
|
51
67
|
|
|
52
68
|
Create or update `postcss.config.mjs` at the project root:
|
|
@@ -211,8 +227,8 @@ If anything is off, see [troubleshoot.md](./troubleshoot.md).
|
|
|
211
227
|
}
|
|
212
228
|
```
|
|
213
229
|
For npm/yarn/bun equivalents, see [troubleshoot.md](./troubleshoot.md).
|
|
214
|
-
- **
|
|
215
|
-
- **`p-3` vs `p-ds-03
|
|
230
|
+
- **Per-component imports keep RSC fast AND avoid peer-dep cliffs.** Inside Server Components, prefer `@devalok/shilp-sutra/ui/text`, `…/composed/page-header`, etc. The barrel `@devalok/shilp-sutra/ui` re-exports many client components — including some with hard peer-dep imports (e.g. `input-otp`) — so it both inflates the client bundle and forces those peers to be installed even when you never render those components. See [server-components.md](./server-components.md) for the full RSC-safety matrix.
|
|
231
|
+
- **`p-3` vs `p-ds-03` — both are valid.** DS spacing uses the `--spacing-ds-*` namespace (`p-ds-04`, `gap-ds-03`); Tailwind 4's default numeric scale (`p-4`, `gap-2`) coexists by design. Pick `p-ds-*` for values that should track DS theme changes (card padding, form gaps); pick `p-N` for one-off layout values (section breathing room). Do NOT mass-codemod `p-4` → `p-ds-04` — that is not what the package intends.
|
|
216
232
|
- **Bare `shadow` is dead.** Tailwind 4 has no `--shadow-DEFAULT`. Use `shadow-raised`, `shadow-overlay`, or `shadow-floating`.
|
|
217
233
|
|
|
218
234
|
## 9. What you should NOT do
|
|
@@ -16,6 +16,8 @@ If both `app/` and `pages/` exist, prefer [install-next-app-router.md](./install
|
|
|
16
16
|
|
|
17
17
|
Same dependencies as the App Router recipe — see [install-next-app-router.md § 2](./install-next-app-router.md#2-install-dependencies). Replace `next-themes`'s `attribute="class"` setup with the same on Pages Router (it works identically).
|
|
18
18
|
|
|
19
|
+
**Optional peer dependencies** — if you'll render `<DataTable>`, any chart, `<DatePicker>`, `<RichTextEditor>`, `<InputOTP>`, `<FilePreview>`, `<MarkdownViewer>`, or use Tabler icons, install the matching peers BEFORE first import. Full table at [install-next-app-router.md § 2a](./install-next-app-router.md#2a-optional-peer-dependencies-install-only-when-importing-the-matching-subpath) — identical for Pages Router.
|
|
20
|
+
|
|
19
21
|
## 3. PostCSS
|
|
20
22
|
|
|
21
23
|
Same as App Router — see [§ 3](./install-next-app-router.md#3-configure-postcss).
|
|
@@ -25,6 +25,21 @@ Optional:
|
|
|
25
25
|
pnpm add sonner # only if rendering <Toaster />
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
### 2a. Optional peer dependencies (install ONLY when importing the matching subpath)
|
|
29
|
+
|
|
30
|
+
Some components ship hard peers as optional. **Install BEFORE first import** or Remix's Vite build will fail with `Failed to resolve import`. Skip if you only use core components.
|
|
31
|
+
|
|
32
|
+
| When you import… | Install |
|
|
33
|
+
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
|
34
|
+
| `@devalok/shilp-sutra/ui/charts/*` | `pnpm add d3-array d3-axis d3-format d3-interpolate d3-scale d3-selection d3-shape d3-time-format d3-transition` |
|
|
35
|
+
| `@devalok/shilp-sutra/ui/data-table` | `pnpm add @tanstack/react-table @tanstack/react-virtual` |
|
|
36
|
+
| `@devalok/shilp-sutra/composed/date-picker` (+ DateRange, DateTime, Calendar) | `pnpm add date-fns` |
|
|
37
|
+
| `@devalok/shilp-sutra/composed/rich-text-editor` (+ RichChatInput, RichTextViewer) | `pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder` |
|
|
38
|
+
| `@devalok/shilp-sutra/ui/input-otp` | `pnpm add input-otp` |
|
|
39
|
+
| `@devalok/shilp-sutra/composed/file-preview` | `pnpm add react-pdf react-zoom-pan-pinch` |
|
|
40
|
+
| `@devalok/shilp-sutra/composed/markdown-viewer` | `pnpm add react-markdown react-syntax-highlighter` |
|
|
41
|
+
| Any `Icon` / `IconButton` with Tabler icons | `pnpm add @tabler/icons-react` |
|
|
42
|
+
|
|
28
43
|
## 3. Wire Tailwind 4 in `vite.config.ts`
|
|
29
44
|
|
|
30
45
|
```ts
|
|
@@ -23,6 +23,21 @@ Optional:
|
|
|
23
23
|
pnpm add sonner # only if rendering <Toaster />
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
### 2a. Optional peer dependencies (install ONLY when importing the matching subpath)
|
|
27
|
+
|
|
28
|
+
Some components ship hard peers as optional. **Install BEFORE first import** or the TanStack Start dev/build will fail with `Failed to resolve import`. Skip if you only use core components.
|
|
29
|
+
|
|
30
|
+
| When you import… | Install |
|
|
31
|
+
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
|
32
|
+
| `@devalok/shilp-sutra/ui/charts/*` | `pnpm add d3-array d3-axis d3-format d3-interpolate d3-scale d3-selection d3-shape d3-time-format d3-transition` |
|
|
33
|
+
| `@devalok/shilp-sutra/ui/data-table` | `pnpm add @tanstack/react-table @tanstack/react-virtual` |
|
|
34
|
+
| `@devalok/shilp-sutra/composed/date-picker` (+ DateRange, DateTime, Calendar) | `pnpm add date-fns` |
|
|
35
|
+
| `@devalok/shilp-sutra/composed/rich-text-editor` (+ RichChatInput, RichTextViewer) | `pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder` |
|
|
36
|
+
| `@devalok/shilp-sutra/ui/input-otp` | `pnpm add input-otp` |
|
|
37
|
+
| `@devalok/shilp-sutra/composed/file-preview` | `pnpm add react-pdf react-zoom-pan-pinch` |
|
|
38
|
+
| `@devalok/shilp-sutra/composed/markdown-viewer` | `pnpm add react-markdown react-syntax-highlighter` |
|
|
39
|
+
| Any `Icon` / `IconButton` with Tabler icons | `pnpm add @tabler/icons-react` |
|
|
40
|
+
|
|
26
41
|
## 3. Wire Tailwind 4 in `app.config.ts`
|
|
27
42
|
|
|
28
43
|
```ts
|
|
@@ -40,6 +40,21 @@ Add only if rendering `<Toaster />`:
|
|
|
40
40
|
pnpm add sonner
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
### 2a. Optional peer dependencies (install ONLY when importing the matching subpath)
|
|
44
|
+
|
|
45
|
+
Some components ship hard peers as optional. **Install BEFORE first import** or `vite dev` / `vite build` will fail with `Failed to resolve import`. Skip if you only use core components.
|
|
46
|
+
|
|
47
|
+
| When you import… | Install |
|
|
48
|
+
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
|
49
|
+
| `@devalok/shilp-sutra/ui/charts/*` | `pnpm add d3-array d3-axis d3-format d3-interpolate d3-scale d3-selection d3-shape d3-time-format d3-transition` |
|
|
50
|
+
| `@devalok/shilp-sutra/ui/data-table` | `pnpm add @tanstack/react-table @tanstack/react-virtual` |
|
|
51
|
+
| `@devalok/shilp-sutra/composed/date-picker` (+ DateRange, DateTime, Calendar) | `pnpm add date-fns` |
|
|
52
|
+
| `@devalok/shilp-sutra/composed/rich-text-editor` (+ RichChatInput, RichTextViewer) | `pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder` |
|
|
53
|
+
| `@devalok/shilp-sutra/ui/input-otp` | `pnpm add input-otp` |
|
|
54
|
+
| `@devalok/shilp-sutra/composed/file-preview` | `pnpm add react-pdf react-zoom-pan-pinch` |
|
|
55
|
+
| `@devalok/shilp-sutra/composed/markdown-viewer` | `pnpm add react-markdown react-syntax-highlighter` |
|
|
56
|
+
| Any `Icon` / `IconButton` with Tabler icons | `pnpm add @tabler/icons-react` |
|
|
57
|
+
|
|
43
58
|
## 3. Wire Tailwind 4 in `vite.config.ts`
|
|
44
59
|
|
|
45
60
|
Use the official Tailwind 4 Vite plugin (faster than PostCSS for Vite):
|
|
@@ -97,6 +97,28 @@ transpilePackages: ["@devalok/shilp-sutra", "@devalok/shilp-sutra-brand"],
|
|
|
97
97
|
|
|
98
98
|
If `@devalok/shilp-sutra-brand` is not installed, list only `@devalok/shilp-sutra`.
|
|
99
99
|
|
|
100
|
+
## Symptom: Build error `Cannot find module 'sonner' / 'input-otp' / 'date-fns' / '@tiptap/react' / 'react-pdf' / 'react-markdown' / '@emoji-mart/react'`
|
|
101
|
+
|
|
102
|
+
**Diagnosis:** an optional peer dependency is missing. Each component below has a peer it pulls only when imported. Install the matching peer (always BEFORE the first import):
|
|
103
|
+
|
|
104
|
+
| You imported (per-component subpath) | Install |
|
|
105
|
+
|--------------------------------------|-----------------------------------------------------------------------------------------------|
|
|
106
|
+
| `…/ui/toaster` or `…/ui/toast` | `pnpm add sonner` |
|
|
107
|
+
| `…/ui/input-otp` | `pnpm add input-otp` |
|
|
108
|
+
| `…/composed/date-picker` | `pnpm add date-fns` |
|
|
109
|
+
| `…/composed/emoji-picker` | `pnpm add @emoji-mart/data @emoji-mart/react` |
|
|
110
|
+
| `…/composed/extensions/emoji-node` or `…/extensions/emoji-suggestion` | `pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder` |
|
|
111
|
+
| `…/composed/rich-text-editor` | `pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder` |
|
|
112
|
+
| `…/composed/rich-chat-input` | `pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder` |
|
|
113
|
+
| `…/composed/file-preview` | `pnpm add react-pdf react-zoom-pan-pinch` |
|
|
114
|
+
| `…/composed/markdown-viewer` | `pnpm add react-markdown react-syntax-highlighter remark-gfm` |
|
|
115
|
+
| `…/ai/block-renderer`, `…/ai/blocks/text`, `…/ai/blocks/error` | `pnpm add react-markdown remark-gfm` |
|
|
116
|
+
| Any `…/ui/charts/*` | `pnpm add d3-array d3-axis d3-format d3-interpolate d3-scale d3-selection d3-shape d3-time-format d3-transition` |
|
|
117
|
+
|
|
118
|
+
These ship as **optional** peers so consumers who never render the matching component don't pay the install cost. Once you import the component, the peer becomes required. Each affected component's JSDoc carries the same install hint — hover the import in your editor to see it inline.
|
|
119
|
+
|
|
120
|
+
For the full table in your framework's install recipe, see `install-<framework>.md → §2a. Optional peer dependencies`.
|
|
121
|
+
|
|
100
122
|
## Symptom: Hydration warning on every page load (Next.js)
|
|
101
123
|
|
|
102
124
|
**Diagnosis:** `next-themes` writes the `class` attribute on `<html>` before React hydrates, causing a server/client class mismatch.
|
package/llms-full.txt
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> All variant values and props verified from source CVA definitions.
|
|
6
6
|
>
|
|
7
7
|
> Package: @devalok/shilp-sutra
|
|
8
|
-
> Version: 0.
|
|
8
|
+
> Version: 0.40.0
|
|
9
9
|
>
|
|
10
10
|
> **If you are an AI agent reading this file top-to-bottom:** the Setup
|
|
11
11
|
> section below is authoritative. If any later per-component doc or a
|
|
@@ -3032,6 +3032,92 @@ const { size, stroke } = useIconContext()
|
|
|
3032
3032
|
|
|
3033
3033
|
### v0.1.0
|
|
3034
3034
|
- **Added** Initial release
|
|
3035
|
+
# OAuthButton
|
|
3036
|
+
|
|
3037
|
+
- Import: @devalok/shilp-sutra/ui/oauth-button
|
|
3038
|
+
- Server-safe: No
|
|
3039
|
+
- Category: ui
|
|
3040
|
+
|
|
3041
|
+
## Exports
|
|
3042
|
+
- `OAuthButton` — primary brand-aware sign-in button
|
|
3043
|
+
- `OAuthGroup` — stacked layout wrapper with consistent spacing
|
|
3044
|
+
- `OAuthDivider` — `or`-style horizontal rule between OAuth row and email form
|
|
3045
|
+
- `OAuthConnectionRow` — settings-page row for a linked provider (Disconnect / Connect action)
|
|
3046
|
+
|
|
3047
|
+
## OAuthButton props
|
|
3048
|
+
provider: "google" | "apple" | "github" | "microsoft" | "x" | "linkedin" | "facebook" | "discord" | "slack" | "gitlab" | "sso" | "email" | "passkey" (required)
|
|
3049
|
+
intent: "continue" | "signin" | "signup" (default "continue") — drives the verb in the label
|
|
3050
|
+
appearance: "brand" | "outline" | "dark" (default "brand") — visual treatment
|
|
3051
|
+
icon: ReactNode — override the default Tabler glyph with a brand-multicolour SVG
|
|
3052
|
+
iconOnly: boolean — compact icon-only button; provider name preserved in aria-label
|
|
3053
|
+
compact: boolean — short label ("Google" not "Continue with Google"); aria-label keeps long form
|
|
3054
|
+
lastUsed: boolean — inline right-edge pill inside the button (a stronger pattern is reorder, below)
|
|
3055
|
+
helperText: ReactNode — reassurance copy rendered below the button
|
|
3056
|
+
children: ReactNode — override the default label entirely (i18n / custom copy)
|
|
3057
|
+
size: inherited from Button ("xs" | "sm" | "md" | "lg" | compact + icon variants)
|
|
3058
|
+
fullWidth, loading, onClick, onClickAsync, asyncFeedbackDuration, disabled — inherited from Button
|
|
3059
|
+
|
|
3060
|
+
## Data attributes
|
|
3061
|
+
- `data-provider="<provider>"` — useful for analytics filtering
|
|
3062
|
+
- `data-oauth-appearance="<appearance>"`
|
|
3063
|
+
|
|
3064
|
+
## OAuthGroup props
|
|
3065
|
+
orientation: "vertical" | "horizontal" (default "vertical")
|
|
3066
|
+
gap: "ds-02" | "ds-03" | "ds-04" (default "ds-03")
|
|
3067
|
+
fullWidth: boolean (default true) — stretches children to fill width when vertical
|
|
3068
|
+
reorderLastUsedFirst: boolean (default false) — pull the child with lastUsed to position 0
|
|
3069
|
+
(Stripe-style — a stronger conversion lever than a visual badge alone)
|
|
3070
|
+
|
|
3071
|
+
## OAuthDivider props
|
|
3072
|
+
label: ReactNode (default "or")
|
|
3073
|
+
|
|
3074
|
+
## OAuthConnectionRow props
|
|
3075
|
+
provider: OAuthProvider (required)
|
|
3076
|
+
connected: boolean (required)
|
|
3077
|
+
accountLabel: ReactNode — account identifier shown next to the provider name (e.g. email)
|
|
3078
|
+
onAction: (e) => void — synchronous click handler
|
|
3079
|
+
onActionAsync: (e) => Promise<void> — uses Button's async state machine
|
|
3080
|
+
actionLabel: ReactNode — override the "Disconnect" / "Connect <name>" copy
|
|
3081
|
+
icon: ReactNode — override the default glyph
|
|
3082
|
+
disabled: boolean
|
|
3083
|
+
|
|
3084
|
+
## Defaults
|
|
3085
|
+
intent="continue", appearance="brand", iconOnly=false, lastUsed=false
|
|
3086
|
+
|
|
3087
|
+
## Example
|
|
3088
|
+
```jsx
|
|
3089
|
+
// Typical signup flow
|
|
3090
|
+
<OAuthGroup>
|
|
3091
|
+
<OAuthButton provider="google" lastUsed />
|
|
3092
|
+
<OAuthButton provider="apple" />
|
|
3093
|
+
<OAuthButton provider="github" />
|
|
3094
|
+
</OAuthGroup>
|
|
3095
|
+
<OAuthDivider />
|
|
3096
|
+
<OAuthGroup>
|
|
3097
|
+
<OAuthButton provider="passkey" appearance="outline" />
|
|
3098
|
+
<OAuthButton provider="email" appearance="outline" />
|
|
3099
|
+
</OAuthGroup>
|
|
3100
|
+
|
|
3101
|
+
// Async loading + success/error feedback
|
|
3102
|
+
<OAuthButton provider="google" fullWidth onClickAsync={signInWithGoogle} />
|
|
3103
|
+
|
|
3104
|
+
// True brand-multicolour glyph from the provider's brand page
|
|
3105
|
+
<OAuthButton provider="google" icon={<GoogleGSvg />} />
|
|
3106
|
+
|
|
3107
|
+
// Settings page — linked state
|
|
3108
|
+
<OAuthConnectionRow
|
|
3109
|
+
provider="google"
|
|
3110
|
+
connected
|
|
3111
|
+
accountLabel="namaskar@devalok.in"
|
|
3112
|
+
onAction={disconnectGoogle}
|
|
3113
|
+
/>
|
|
3114
|
+
```
|
|
3115
|
+
|
|
3116
|
+
## Composability
|
|
3117
|
+
- **Built on Button.** Async state machine, loading/processing, sizes, and `fullWidth` are inherited. `variant` and `color` are managed internally — pass `appearance` instead.
|
|
3118
|
+
- **Tabler peer dep.** Default glyphs come from `@tabler/icons-react`. To match a provider's official multicolour mark, pass `icon={<YourSvg />}`.
|
|
3119
|
+
- **Brand-colour backgrounds.** `appearance="brand"` uses each provider's published button colour. `appearance="outline"` falls back to DS-neutral. `appearance="dark"` unifies every provider into an Apple-style black-on-white (light) / white-on-black (dark) treatment — useful when you want a row to feel visually consistent across providers.
|
|
3120
|
+
- **Last-used hint.** Storage is the consumer's responsibility — pass `lastUsed={user.lastProvider === 'google'}`.
|
|
3035
3121
|
# Pagination
|
|
3036
3122
|
|
|
3037
3123
|
- Import: @devalok/shilp-sutra/ui/pagination
|
package/llms-quick.txt
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# @devalok/shilp-sutra — quick reference for AI agents
|
|
2
|
+
|
|
3
|
+
> Tailwind 4 + React 19 + CVA design system. 110+ components, OKLCH tokens, framer-motion. **Not shadcn/ui** — APIs diverge in ways noted below.
|
|
4
|
+
>
|
|
5
|
+
> This file is the ≤15K-token fast-path summary. Reach for `llms.txt` (~27K tokens) or `llms-full.txt` (~140K tokens) only when this isn't enough.
|
|
6
|
+
|
|
7
|
+
## SETUP (consumer install, ~5 min)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @devalok/shilp-sutra framer-motion next-themes
|
|
11
|
+
pnpm add -D tailwindcss@^4 @tailwindcss/postcss # or @tailwindcss/vite
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Then 4 files:
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
/* globals.css — order matters */
|
|
18
|
+
@import "tailwindcss";
|
|
19
|
+
@import "@devalok/shilp-sutra/css";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// next.config.ts — only if Next.js
|
|
24
|
+
transpilePackages: ["@devalok/shilp-sutra", "@devalok/shilp-sutra-brand"]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
// app/layout.tsx — Next App Router
|
|
29
|
+
<html lang="en" suppressHydrationWarning> {/* required for next-themes */}
|
|
30
|
+
<body><Providers>{children}</Providers></body>
|
|
31
|
+
</html>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
// app/providers.tsx
|
|
36
|
+
'use client'
|
|
37
|
+
import { ThemeProvider } from 'next-themes'
|
|
38
|
+
import { Toaster } from '@devalok/shilp-sutra/ui/toaster'
|
|
39
|
+
export function Providers({ children }) {
|
|
40
|
+
return <ThemeProvider attribute="class" defaultTheme="system" enableSystem>{children}<Toaster /></ThemeProvider>
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Per-framework recipes: `node_modules/@devalok/shilp-sutra/docs/recipes/install-<framework>.md` (six recipes — Next App Router, Next Pages, Vite, Astro, Remix, TanStack Start).
|
|
45
|
+
|
|
46
|
+
**Theme it in 30 seconds:** https://shilp-sutra.devalok.in/themer — outputs a copy-pasteable CSS block (12-step OKLCH ramp + role tokens). Paste *after* the `@devalok/shilp-sutra/css` import.
|
|
47
|
+
|
|
48
|
+
## OPTIONAL PEER DEPENDENCIES (install BEFORE first import)
|
|
49
|
+
|
|
50
|
+
| When you import… | Install |
|
|
51
|
+
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
|
52
|
+
| `@devalok/shilp-sutra/ui/charts/*` | `pnpm add d3-array d3-axis d3-format d3-interpolate d3-scale d3-selection d3-shape d3-time-format d3-transition` |
|
|
53
|
+
| `@devalok/shilp-sutra/ui/data-table` | `pnpm add @tanstack/react-table @tanstack/react-virtual` |
|
|
54
|
+
| `@devalok/shilp-sutra/composed/date-picker` (+ DateRange, DateTime, Calendar) | `pnpm add date-fns` |
|
|
55
|
+
| `@devalok/shilp-sutra/composed/rich-text-editor` (+ RichChatInput, RichTextViewer) | `pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-placeholder` |
|
|
56
|
+
| `@devalok/shilp-sutra/ui/input-otp` | `pnpm add input-otp` |
|
|
57
|
+
| `@devalok/shilp-sutra/composed/file-preview` | `pnpm add react-pdf react-zoom-pan-pinch` |
|
|
58
|
+
| `@devalok/shilp-sutra/composed/markdown-viewer` | `pnpm add react-markdown react-syntax-highlighter remark-gfm` |
|
|
59
|
+
| `@devalok/shilp-sutra/ui/toaster` or `…/ui/toast` | `pnpm add sonner` |
|
|
60
|
+
| Tabler icons in `<Icon>`, `<Button startIcon>`, etc. | `pnpm add @tabler/icons-react` |
|
|
61
|
+
|
|
62
|
+
## HARD CONSTRAINTS
|
|
63
|
+
|
|
64
|
+
1. **Tailwind 4 only.** No `tailwind.config.ts presets: [shilpSutra]` — that was removed in 0.38. CSS-only setup as above.
|
|
65
|
+
2. **`framer-motion@^12` required peer.** Single copy — configure pnpm/yarn overrides if you see duplicates.
|
|
66
|
+
3. **`sonner@^2`** required only when you render `<Toaster />` or call `toast.*`. Optional otherwise.
|
|
67
|
+
4. **Per-component imports keep RSC fast AND avoid peer-dep cliffs.** Barrel `@devalok/shilp-sutra/ui` works in client contexts but inflates client bundle and forces optional peers to be installed. Prefer `…/ui/text`, `…/ui/dialog`, etc. The barrel **no longer** re-exports peer-cliff symbols (`Toaster`, `toast`, `InputOTP`, `DatePicker`, `RichTextEditor`, `EmojiPicker`, `FilePreview`, `MarkdownViewer`, `BlockRenderer`, `ErrorBlock`, `TextBlock`) as of 0.40.0 — import per-component.
|
|
68
|
+
5. **Spacing namespace is `--spacing-ds-*`.** `p-ds-04`, `gap-ds-03` — these DO NOT replace TW4 default `p-4`, `gap-2`. Both coexist by design. Pick `p-ds-*` for values that should track DS theme changes, `p-N` for one-off layout values.
|
|
69
|
+
6. **Bare `shadow` class renders no shadow in TW4.** Use `shadow-raised` (cards), `shadow-floating` (dropdowns), `shadow-overlay` (dialogs), `shadow-ring` (focus).
|
|
70
|
+
7. **Variant names must match CVA source exactly** — invented variant names silently no-op (CVA falls back to defaults). Grep `packages/core/src/ui/<component>.tsx` if in doubt.
|
|
71
|
+
8. **Default to `variant="soft"`** over `variant="outline"` for non-primary Button actions. Outline only on colored backgrounds or where primary/secondary hierarchy needs a hard border.
|
|
72
|
+
|
|
73
|
+
## ICON API (one shape across every component, v0.40.0+)
|
|
74
|
+
|
|
75
|
+
Every icon-accepting prop (`startIcon`, `endIcon`, `icon`, …) takes `IconInput`:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { IconPlus } from '@tabler/icons-react'
|
|
79
|
+
import { Icon } from '@devalok/shilp-sutra/ui/icon'
|
|
80
|
+
|
|
81
|
+
<Button startIcon={<Icon icon={IconPlus} />}>Add</Button> // canonical
|
|
82
|
+
<Button startIcon={<IconPlus />}>Add</Button> // raw Tabler element
|
|
83
|
+
<Button startIcon={IconPlus}>Add</Button> // component ref
|
|
84
|
+
<Button startIcon={<span>+</span>}>Add</Button> // custom node
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
All four work. Size flows from `<IconProvider>` context — don't pass `className="h-4 w-4"`. On 22 components: Button, IconButton, Badge, Combobox, SegmentedControl, Stepper, StatCard, TreeItem, OAuthButton, Chat.Message.*, AIConversation, EmptyState, BulkActionBar, ActivityFeed, CommandPalette, TopBar, Sidebar, BottomNavbar, AppCommandPalette, CommandRegistry.
|
|
88
|
+
|
|
89
|
+
## IMPORT PATH CHEATSHEET (don't guess)
|
|
90
|
+
|
|
91
|
+
| Component / API | Exact import path |
|
|
92
|
+
|------------------------------------------------|----|
|
|
93
|
+
| `FormField`, `FormHelperText`, `useFormField` | `@devalok/shilp-sutra/ui/form` (NOT `ui/form-field`)|
|
|
94
|
+
| `Label` | `@devalok/shilp-sutra/ui/label`|
|
|
95
|
+
| `AppSidebar` | `@devalok/shilp-sutra/shell/sidebar` (NOT `shell/app-sidebar`)|
|
|
96
|
+
| `TopBar`, `TopBar.*` | `@devalok/shilp-sutra/shell/top-bar`|
|
|
97
|
+
| `BottomNavbar` | `@devalok/shilp-sutra/shell/bottom-navbar`|
|
|
98
|
+
| `AppCommandPalette` | `@devalok/shilp-sutra/shell/app-command-palette`|
|
|
99
|
+
| `NotificationCenter` | `@devalok/shilp-sutra/shell/notification-center`|
|
|
100
|
+
| `CommandPalette` (lower-level) | `@devalok/shilp-sutra/composed/command-palette`|
|
|
101
|
+
| `BarChart`, `LineChart`, `AreaChart`, `PieChart`, `RadarChart`, `GaugeChart`, `Sparkline`, `ChartContainer`, `Legend` | `@devalok/shilp-sutra/ui/charts` (or per-chart subpath `…/ui/charts/bar-chart`) |
|
|
102
|
+
| `DataTable` | `@devalok/shilp-sutra/ui/data-table`|
|
|
103
|
+
| **`DatePicker`** family | `@devalok/shilp-sutra/composed/date-picker` **(per-component required since 0.40)** |
|
|
104
|
+
| **`Toaster`** | `@devalok/shilp-sutra/ui/toaster` **(per-component required since 0.40, pulls `sonner`)** |
|
|
105
|
+
| **`toast`** | `@devalok/shilp-sutra/ui/toast` **(per-component required since 0.40)** |
|
|
106
|
+
| **`InputOTP`** family | `@devalok/shilp-sutra/ui/input-otp` **(per-component required since 0.40)** |
|
|
107
|
+
| **`EmojiPicker`** | `@devalok/shilp-sutra/composed/emoji-picker` **(per-component since 0.40)** |
|
|
108
|
+
| **`FilePreview`** | `@devalok/shilp-sutra/composed/file-preview` **(per-component since 0.40)** |
|
|
109
|
+
| **`MarkdownViewer`** | `@devalok/shilp-sutra/composed/markdown-viewer` **(per-component since 0.40)** |
|
|
110
|
+
| **`RichTextEditor`** / **`RichChatInput`** | `@devalok/shilp-sutra/composed/rich-{text-editor,chat-input}` **(per-component since 0.40)** |
|
|
111
|
+
| **`BlockRenderer`**, **`ErrorBlock`**, **`TextBlock`** | `@devalok/shilp-sutra/ai/{block-renderer,blocks/error,blocks/text}` **(per-component since 0.40)** |
|
|
112
|
+
| `useColorMode` | `@devalok/shilp-sutra/hooks/use-color-mode`|
|
|
113
|
+
| `MotionProvider`, `springs`, `tweens` | `@devalok/shilp-sutra/motion`|
|
|
114
|
+
|
|
115
|
+
Components whose import path is the kebab-case of their name (`Button` → `ui/button`, `Card` → `ui/card`, `Avatar` → `ui/avatar`, `Stack` → `ui/stack`, `Text` → `ui/text`) follow the obvious rule. The table above lists the ones that DON'T.
|
|
116
|
+
|
|
117
|
+
## TWO-AXIS VARIANT SYSTEM (vs shadcn's one-axis)
|
|
118
|
+
|
|
119
|
+
Many components take BOTH `variant` (shape/surface) AND `color` (intent/semantics):
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
<Button variant="solid" color="error">Delete</Button> // red solid
|
|
123
|
+
<Button variant="soft" color="warning">Pending</Button> // amber tinted
|
|
124
|
+
<Button variant="outline" color="accent">Cancel</Button> // bordered
|
|
125
|
+
<Badge variant="solid" color="success">Active</Badge> // green solid
|
|
126
|
+
<Alert variant="subtle" color="info" title="Note" /> // tinted blue
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Components with the two-axis system: **Button, Badge, Alert, Banner, Progress, StatusBadge**.
|
|
130
|
+
|
|
131
|
+
## TOP DIFFERENCES FROM SHADCN/UI (will trip you up)
|
|
132
|
+
|
|
133
|
+
| shadcn pattern | shilp-sutra equivalent |
|
|
134
|
+
|---|---|
|
|
135
|
+
| `variant="destructive"` | `color="error"` |
|
|
136
|
+
| `size="default"` | `size="md"` (always — never "default") |
|
|
137
|
+
| `<Select size="lg">` | `<SelectTrigger size="lg">` (size on trigger, NOT root) |
|
|
138
|
+
| `<Chip>` | `<Badge onClick={...}>` (Chip removed 0.32) |
|
|
139
|
+
| `useToast() + toast({variant})` | `import { toast }`, then `toast.success('msg')` |
|
|
140
|
+
| `Badge variant="destructive"` | `Badge variant="solid" color="error"` |
|
|
141
|
+
| `Alert + AlertTitle + AlertDescription` | `<Alert title="..." color="error">` (single component) |
|
|
142
|
+
| `Form + FormField + FormItem + FormLabel + FormControl + …` | `<FormField>` + `<Label>` + `<Input>` + `<FormHelperText>` + `useFormField()` hook |
|
|
143
|
+
|
|
144
|
+
## COMMON MISTAKES — DO NOT
|
|
145
|
+
|
|
146
|
+
- DO NOT use `variant="destructive"` — use `color="error"`
|
|
147
|
+
- DO NOT use `variant="default"` on Button — use `variant="solid"`
|
|
148
|
+
- DO NOT use `size="default"` — use `size="md"`
|
|
149
|
+
- DO NOT put `size` on `<Select>` — put it on `<SelectTrigger size="md">`
|
|
150
|
+
- DO NOT use `<Chip>` — use `<Badge onClick={...}>`
|
|
151
|
+
- DO NOT call `useToast()` hook — use `import { toast } from '@devalok/shilp-sutra/ui/toast'`
|
|
152
|
+
- DO NOT call `toast({title, color})` object form — use `toast.success('message', { description })`
|
|
153
|
+
- DO NOT call `toast()` without `<Toaster />` mounted
|
|
154
|
+
- DO NOT use `<Alert><AlertTitle>...</AlertTitle></Alert>` — use `<Alert title="..." />`
|
|
155
|
+
- DO NOT codemod `p-4` → `p-ds-04` — both coexist by design
|
|
156
|
+
- DO NOT use bare `shadow` class — pick `shadow-raised` / `shadow-floating` / `shadow-overlay`
|
|
157
|
+
- DO NOT use `tailwind.config.ts presets: [shilpSutra]` — JS preset removed 0.38
|
|
158
|
+
- DO NOT use `bg-surface-1..4` — renamed to `bg-surface-{base,raised,raised-hover,raised-active}` in 0.23
|
|
159
|
+
- DO NOT use `shadow-01..05` — renamed to `shadow-{raised,raised-hover,floating,overlay}` in 0.23
|
|
160
|
+
- DO NOT use TW3 `bg-gradient-to-*` — use TW4 `bg-linear-to-*` (since 0.37)
|
|
161
|
+
- DO NOT use TW3 `w-[--var]` — use TW4 `w-(--var)` (since 0.37)
|
|
162
|
+
- DO NOT pass `children` to `<IconButton>` — use the `icon` prop
|
|
163
|
+
|
|
164
|
+
## TOP 30 COMPONENTS QUICK-REF
|
|
165
|
+
|
|
166
|
+
### Inputs & buttons
|
|
167
|
+
- **Button**: variant(solid|soft|outline|ghost|link) color(accent|error|success|warning|neutral) size(xs|sm|md|lg|compact-xs|compact-sm|compact-md|icon-xs|icon-sm|icon-md|icon-lg) shape(default|pill) + loading, startIcon, endIcon, asChild, processing, onClickAsync
|
|
168
|
+
- **IconButton**: icon(IconInput, required) shape(square|circle) size(sm|md|lg) + aria-label required. Children rejected by type.
|
|
169
|
+
- **SplitButton**: `[Action | ▼]` with dropdown. triggerSide, dropdownContent.
|
|
170
|
+
- **Input**: size(xs|sm|md|lg) state(default|error|warning|success) + startSection, endSection (auto-typed icon vs label).
|
|
171
|
+
- **NumberInput**: value + onValueChange + min/max/step.
|
|
172
|
+
- **Textarea**, **SearchInput**, **ColorInput**.
|
|
173
|
+
- **Checkbox**: checked, onCheckedChange, indeterminate, error, size.
|
|
174
|
+
- **Switch**: checked, onCheckedChange, error, size, color, thumbIcon.
|
|
175
|
+
- **RadioGroup > RadioGroupItem**.
|
|
176
|
+
- **Select > SelectTrigger(size) > SelectValue; SelectContent > SelectItem**.
|
|
177
|
+
- **Combobox**: discriminated union — `multiple?: false` (value: string) | `multiple: true` (value: string[]).
|
|
178
|
+
- **Autocomplete**, **Slider**, **Toggle**, **ToggleGroup**, **SegmentedControl**.
|
|
179
|
+
- **FormField + Label + Input + FormHelperText + useFormField()** — replaces shadcn's Form + FormItem + FormControl + FormDescription + FormMessage.
|
|
180
|
+
|
|
181
|
+
### Display
|
|
182
|
+
- **Text**: variant(heading-2xl..xs, body-lg..xs, label-lg..xs, caption, overline, code). Polymorphic `as` prop.
|
|
183
|
+
- **Stack**: direction(vertical|horizontal) gap(SpacingToken) align/justify/wrap.
|
|
184
|
+
- **Container**, **Separator**.
|
|
185
|
+
- **Card**: variant(default|elevated|outline|flat) accent(left|top|right|bottom). Compound: CardHeader > CardTitle, CardDescription; CardContent; CardFooter.
|
|
186
|
+
- **Badge**: variant(subtle|solid|outline|soft) color(default|accent|error|success|warning|info|neutral + 7 categories + custom) size(xs|sm|md|lg) + onClick, onDismiss, dot, startIcon, endIcon, truncate. Compound: Badge.Indicator, Badge.Group.
|
|
187
|
+
- **Avatar**: size(xs|sm|md|lg|xl) shape(circle|square|rounded) status, ring, badge.
|
|
188
|
+
- **Spinner**, **Progress** (autoColor!), **Skeleton**, **StatCard**, **StatusDot**, **ColorSwatch**.
|
|
189
|
+
- **Alert**: variant(subtle|solid|outline) color(info|success|warning|error|neutral) + title, onDismiss. Single component, not compound.
|
|
190
|
+
- **Banner**: color(...) + actions, onDismiss. Mobile-responsive.
|
|
191
|
+
- **Toast**: imperative `toast.success('msg')` / `.error/.warning/.info/.loading/.message/.promise/.upload/.custom`. Requires `<Toaster />`.
|
|
192
|
+
|
|
193
|
+
### Overlays
|
|
194
|
+
- **Dialog**: compound (DialogTrigger; DialogContent > DialogHeader > DialogTitle; …; DialogFooter). Mobile auto-fullscreens.
|
|
195
|
+
- **AlertDialog**: same compound, mobile bottom-sheet via `responsive` prop.
|
|
196
|
+
- **Sheet**: side(top|bottom|left|right). Mobile auto-bottom + swipe-to-dismiss.
|
|
197
|
+
- **Popover**, **Tooltip** (auto-wraps Provider), **HoverCard**, **Collapsible**.
|
|
198
|
+
|
|
199
|
+
### Navigation
|
|
200
|
+
- **Tabs**: TabsList(variant: line|contained) > TabsTrigger; TabsContent. color, size, orientation.
|
|
201
|
+
- **Accordion**: AccordionItem > AccordionTrigger; AccordionContent.
|
|
202
|
+
- **Breadcrumb**, **PaginationRoot**, **DropdownMenu**, **ContextMenu**, **Menubar**, **NavigationMenu**.
|
|
203
|
+
|
|
204
|
+
### Composed (per-component subpaths)
|
|
205
|
+
- **DatePicker**, **DateRangePicker**, **DateTimePicker**, **TimePicker**, **CalendarGrid** — `@devalok/shilp-sutra/composed/date-picker`. Needs `date-fns` peer.
|
|
206
|
+
- **EmptyState**: icon(IconInput) + title, description, action, compact, iconSize.
|
|
207
|
+
- **CommandPalette**, **AppCommandPalette**, **MultiSelectPopover**, **MemberPicker**, **MasterDetail**, **ActivityFeed**, **PageHeader**, **InlineEdit**, **FormSection**, **BulkActionBar**, **DeadlineIndicator**.
|
|
208
|
+
- **RichTextEditor**, **RichTextViewer**, **RichChatInput** — needs `@tiptap/*` peers.
|
|
209
|
+
- **FilePreview**, **MarkdownViewer**, **EmojiPicker**.
|
|
210
|
+
|
|
211
|
+
### Shell
|
|
212
|
+
- **TopBar**: Composition-based. `TopBar.Left/Center/Right/Section/IconButton/Title/UserMenu`.
|
|
213
|
+
- **AppSidebar**: `NavItem[]` + `NavGroup[]` + `footer.{links,version,promo,slot}`.
|
|
214
|
+
- **BottomNavbar**: mobile.
|
|
215
|
+
- **NotificationCenter**, **NotificationPreferences**, **LinkProvider**.
|
|
216
|
+
|
|
217
|
+
### AI module
|
|
218
|
+
- **CommandBar**, **AIConversation**, **BlockRenderer** (per-component, pulls `react-markdown`), **AICommandProvider**, **DevadootIcon**.
|
|
219
|
+
- AI blocks (barrel-safe): BlockTable, ConfirmBlock, DividerBlock, InfoBlock, LoadingBlock, StatRowBlock, SuccessBlock.
|
|
220
|
+
- AI blocks (per-component required): ErrorBlock (`/ai/blocks/error`), TextBlock (`/ai/blocks/text`).
|
|
221
|
+
|
|
222
|
+
## SERVER-SAFE COMPONENTS (`@server-safe` annotation in source)
|
|
223
|
+
|
|
224
|
+
UI: `Text`, `Skeleton`, `Stack`, `Container`, `Table` (+ sub), `Code`, `VisuallyHidden`.
|
|
225
|
+
Composed: `ContentCard`, `PageHeader`, `LoadingSkeleton`, `PageSkeletons`, `PriorityIndicator`.
|
|
226
|
+
|
|
227
|
+
Use per-component subpaths in Server Components: `import { Text } from '@devalok/shilp-sutra/ui/text'`.
|
|
228
|
+
|
|
229
|
+
## TROUBLESHOOTING
|
|
230
|
+
|
|
231
|
+
13 symptoms with diagnosis + fix at `node_modules/@devalok/shilp-sutra/docs/recipes/troubleshoot.md`. Most common:
|
|
232
|
+
|
|
233
|
+
- **`Cannot find module 'sonner'` / `'input-otp'` / `'date-fns'`** → missing optional peer; install per the matrix above.
|
|
234
|
+
- **Spacing utilities don't apply** → Tailwind not seeing `node_modules/@devalok/shilp-sutra/dist`; ensure `transpilePackages` in `next.config` OR Tailwind 4 auto-discovery.
|
|
235
|
+
- **`<Toaster />` mounted but `toast()` silent** → check sonner peer installed + Toaster mounted ONCE at layout root.
|
|
236
|
+
- **Hydration warning on every page** → add `suppressHydrationWarning` to `<html>` (needed for next-themes).
|
|
237
|
+
- **Bare `shadow` produces no shadow** → TW4 has no `--shadow-DEFAULT`; pick `shadow-raised`/`-floating`/`-overlay`.
|
|
238
|
+
|
|
239
|
+
## NEED MORE?
|
|
240
|
+
|
|
241
|
+
- `llms.txt` — full ~27K-token reference (this file is the slice)
|
|
242
|
+
- `llms-full.txt` — exhaustive per-component prop tables (~140K tokens)
|
|
243
|
+
- `docs/recipes/install-<framework>.md` — per-framework setup with edge cases
|
|
244
|
+
- `docs/recipes/customize-brand.md` — token override cookbook
|
|
245
|
+
- `MIGRATION.md` — every breaking change since 0.18
|
|
246
|
+
|
|
247
|
+
This file regenerates from `llms.txt` when component APIs change; expect it to track v0.40+ closely.
|