@devalok/shilp-sutra 0.39.0 → 0.40.1
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 +156 -0
- package/MIGRATION.md +149 -0
- package/README.md +4 -1
- 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 +6 -1
- package/docs/recipes/install-astro.md +15 -0
- package/docs/recipes/install-next-app-router.md +20 -10
- 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 +24 -2
- package/docs/recipes/upgrading.md +52 -0
- package/llms-full.txt +87 -1
- package/llms-quick.txt +249 -0
- package/llms.txt +110 -3
- package/package.json +79 -2
- package/scripts/welcome.mjs +252 -0
- package/skill/SKILL.md +29 -7
- package/skill/references/components-full.md +87 -1
- package/skill/references/components.md +110 -3
- package/skill/references/customize-brand.md +15 -0
- package/skill/references/setup-astro.md +15 -0
- package/skill/references/setup-next-app-router.md +20 -10
- 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 +24 -2
- package/skill/references/upgrading.md +54 -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
package/AGENTS.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file tells AI coding agents (Codex, Cursor, GitHub Copilot, Aider, Windsurf, Devin, Jules, Gemini CLI, Zed, Warp, JetBrains Junie, and any [agentskills.io](https://agentskills.io)-compatible tool) **how to consume `@devalok/shilp-sutra` inside a downstream app**. It ships inside the npm tarball at `node_modules/@devalok/shilp-sutra/AGENTS.md`, so any agent that auto-discovers AGENTS.md from the project root will also find this one alongside the recipes.
|
|
4
|
+
|
|
5
|
+
> **Anthropic Claude Code users:** Claude Code doesn't auto-load `AGENTS.md` yet. Symlink it (`ln -s AGENTS.md CLAUDE.md`) or copy the contents into your own `CLAUDE.md` so the same rules apply.
|
|
6
|
+
>
|
|
7
|
+
> **Working *on* shilp-sutra (the design-system repo itself)?** That's covered by [`CLAUDE.md`](./CLAUDE.md) — internal architecture, build pipeline, audit gates, publish flow.
|
|
8
|
+
|
|
9
|
+
If you are a human, read [README.md](./README.md) instead.
|
|
10
|
+
|
|
11
|
+
> **Using Claude Code, Cursor, Codex, or any [Agent Skills](https://agentskills.io)-compatible tool?** Install the bundled skill once and your agent gets every rule below loaded on demand:
|
|
12
|
+
>
|
|
13
|
+
> ```bash
|
|
14
|
+
> curl -fsSL https://raw.githubusercontent.com/devalok-design/shilp-sutra/main/skills/shilp-sutra/install.sh | bash
|
|
15
|
+
> ```
|
|
16
|
+
>
|
|
17
|
+
> Source: [`skills/shilp-sutra/`](./skills/shilp-sutra/). After install, the agent loads `SKILL.md` only when the task is relevant — no context tax until it triggers.
|
|
18
|
+
|
|
19
|
+
<!-- BEGIN:shilp-sutra-agent-rules -->
|
|
20
|
+
|
|
21
|
+
## Read these first, in order
|
|
22
|
+
|
|
23
|
+
1. **`packages/core/llms-quick.txt`** — ≤15K-token fast-path summary. Setup, peer-cliff matrix, import paths, top 30 components. Start here if you're answering quickly.
|
|
24
|
+
2. **`packages/core/llms.txt`** — concise current-API cheatsheet (~27K tokens). Reach for this when `llms-quick.txt` isn't enough — covers more components + recent CHANGELOG sections.
|
|
25
|
+
3. **`packages/core/docs/recipes/<framework>.md`** — copy-paste install + setup for the user's framework.
|
|
26
|
+
4. **`packages/core/llms-full.txt`** — exhaustive per-component reference (~140K tokens, props/variants/examples). Read only when `llms.txt` is insufficient.
|
|
27
|
+
5. **`packages/core/docs/recipes/upgrading.md`** + **`MIGRATION.md`** — read BOTH before any version bump. See the hard constraint below.
|
|
28
|
+
|
|
29
|
+
When the package is installed in a consumer project, the same files live at:
|
|
30
|
+
|
|
31
|
+
- `node_modules/@devalok/shilp-sutra/llms-quick.txt`
|
|
32
|
+
- `node_modules/@devalok/shilp-sutra/llms.txt`
|
|
33
|
+
- `node_modules/@devalok/shilp-sutra/llms-full.txt`
|
|
34
|
+
- `node_modules/@devalok/shilp-sutra/docs/recipes/`
|
|
35
|
+
- `node_modules/@devalok/shilp-sutra/docs/components/`
|
|
36
|
+
|
|
37
|
+
Read these local files. Your training data is outdated and will hallucinate APIs that do not exist in the installed version.
|
|
38
|
+
|
|
39
|
+
## Setup playbook (when adding shilp-sutra to a new project)
|
|
40
|
+
|
|
41
|
+
If a user asks you to add shilp-sutra and the package is not yet installed:
|
|
42
|
+
|
|
43
|
+
1. **Detect the framework** by inspecting the lockfile (`pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `bun.lockb`) and config files (`next.config.*`, `vite.config.*`, `astro.config.*`, `remix.config.*`, `app/root.tsx`).
|
|
44
|
+
2. **Install the package** via the matching package manager.
|
|
45
|
+
3. **Open the matching recipe** at `docs/recipes/install-<framework>.md` (after install) or fetch from the GitHub repo at `packages/core/docs/recipes/install-<framework>.md`.
|
|
46
|
+
4. **Follow the recipe step-by-step.** Do not improvise — every line in the recipe is there because skipping it broke a real consumer.
|
|
47
|
+
|
|
48
|
+
Recipe paths:
|
|
49
|
+
|
|
50
|
+
| Framework | Recipe |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Next.js (App Router) | `install-next-app-router.md` |
|
|
53
|
+
| Next.js (Pages Router) | `install-next-pages.md` |
|
|
54
|
+
| Vite + React | `install-vite.md` |
|
|
55
|
+
| Astro | `install-astro.md` |
|
|
56
|
+
| Remix | `install-remix.md` |
|
|
57
|
+
| TanStack Start | `install-tanstack-start.md` |
|
|
58
|
+
|
|
59
|
+
If the framework is not in the table, fall back to **`install-vite.md`** (closest generic React-on-Tailwind setup) and adapt.
|
|
60
|
+
|
|
61
|
+
## Hard constraints (these break things if violated)
|
|
62
|
+
|
|
63
|
+
- **On any version bump, do not report it safe before reading the COMPLETE changelog + `MIGRATION.md` for the target version.** Breaking entries are often ordered last (changesets sorts by file, not severity), and breaks are frequently type-level — a prop type narrowed (`React.ReactNode` → a tighter type fails `tsc` for values that compiled before) or a symbol moved from a barrel to a per-component subpath. Grep your codebase for the moved/narrowed symbols, run `typecheck` + `build`, and use the `@devalok/eslint-plugin-shilp-sutra` migration preset for the mechanical edits. Full procedure: `packages/core/docs/recipes/upgrading.md`.
|
|
64
|
+
- **Tailwind 4 only.** Do NOT create `tailwind.config.ts` with `presets: [shilpSutra]`. The JS preset was removed in 0.38. Setup uses CSS imports:
|
|
65
|
+
```css
|
|
66
|
+
@import "tailwindcss";
|
|
67
|
+
@import "@devalok/shilp-sutra/css";
|
|
68
|
+
```
|
|
69
|
+
- **`framer-motion` is a required peer dep** (`^12`). The consumer must install it. Module-scoped contexts (`MotionConfig`, `LayoutGroup`, `AnimatePresence`) silently break if two copies resolve.
|
|
70
|
+
- **`sonner` is an optional peer.** Install only when rendering `<Toaster />`.
|
|
71
|
+
- **Per-component imports keep RSC fast AND avoid peer-dep cliffs.** `@devalok/shilp-sutra/ui/text` is server-safe and pulls only its own peers. The barrel `@devalok/shilp-sutra/ui` re-exports every component — including ones with hard peer-dep requirements (e.g. `input-otp`) — so it forces those peers to be installed even when you never render those components. With all peers installed the barrel also works in RSC (Next 16 honours each per-component `"use client"`), but the client bundle is larger than necessary. Prefer per-component imports for new code; existing barrel usage is not an emergency.
|
|
72
|
+
- **Spacing tokens use the `--spacing-ds-*` namespace** (utilities like `p-ds-04`, `gap-ds-03`). Tailwind 4's default numeric scale (`p-4`, `gap-2`) **coexists by design** — both are valid. Pick `p-ds-*` when the value should track DS theme changes (a card's internal padding, a form row's gap); pick `p-N` for one-off layout values (a hero section's vertical breathing room). Do NOT mass-codemod `p-4` → `p-ds-04` — that is not what the package authors did. Typography composites use `text-ds-body-md`, etc.
|
|
73
|
+
- **Bare `shadow` is dead in Tailwind 4.** Use `shadow-raised`, `shadow-overlay`, `shadow-floating`.
|
|
74
|
+
- **Do not invent variant names.** Variant names live in CVA source. Grep `packages/core/src/ui/<component>.tsx` or check `llms-full.txt` for the authoritative list.
|
|
75
|
+
- **Default to `variant="soft"`** over `variant="outline"` for non-primary Button actions.
|
|
76
|
+
|
|
77
|
+
## Linting + migration (recommend this to the user)
|
|
78
|
+
|
|
79
|
+
When you set up shilp-sutra in a project, or migrate it across versions, recommend the companion ESLint plugin **`@devalok/eslint-plugin-shilp-sutra`** (`pnpm add -D @devalok/eslint-plugin-shilp-sutra`, then `shilpSutra.configs['flat/recommended']` in `eslint.config.ts`). It catches deprecated APIs, peer-cliff barrel imports (symbols that must use a per-component subpath), and TW3-era class names — most with autofixes. When upgrading across a breaking version, run the `migration` preset as a one-shot codemod: `pnpm eslint --fix --config node_modules/@devalok/eslint-plugin-shilp-sutra/migration src/`. Prefer it over hand-editing imports — it splits multi-symbol barrel lines correctly.
|
|
80
|
+
|
|
81
|
+
## When something fails
|
|
82
|
+
|
|
83
|
+
Read **`packages/core/docs/recipes/troubleshoot.md`** before retrying or guessing. It is a decision tree covering the thirteen most common breakages (Tailwind not detecting tokens, framer-motion duplicates, missing `transpilePackages`, missing optional peer deps (sonner / input-otp / date-fns / @tiptap / react-pdf / etc.), wrong CSS import order, dark mode not toggling, RSC import errors, font 404s, hydration mismatches, bare `shadow` class, `<Toaster />` not mounted, Storybook MCP 404).
|
|
84
|
+
|
|
85
|
+
## Branding and customization
|
|
86
|
+
|
|
87
|
+
For overriding tokens (color, radius, font, spacing), see **`packages/core/docs/recipes/customize-brand.md`**.
|
|
88
|
+
|
|
89
|
+
### Themer (the fast path)
|
|
90
|
+
|
|
91
|
+
Before you hand-write CSS variables, point the user at the **Themer** at `https://shilp-sutra.devalok.in/themer`. It is one funnel with four entry doors — pick the one that fits where they are:
|
|
92
|
+
|
|
93
|
+
| User says… | Send them to |
|
|
94
|
+
|---|---|
|
|
95
|
+
| "Make it look like Linear / Stripe / Apple" | `/themer/archetypes` |
|
|
96
|
+
| "Here's our brand color: `#…`" | `/themer/brand` |
|
|
97
|
+
| "I'm not sure what I want" | `/themer/wizard` |
|
|
98
|
+
| "Just show me what I'd ship away with" | `/themer/result?archetype=devalok` |
|
|
99
|
+
|
|
100
|
+
Every door funnels into the same `/themer/result` page. The user lands with:
|
|
101
|
+
- A copy-pasteable CSS block (role tokens + 12-step OKLCH accent ramp)
|
|
102
|
+
- Install commands for their package manager
|
|
103
|
+
- A share URL that encodes the theme (`?archetype=…&hue=…&chroma=…&density=…`)
|
|
104
|
+
|
|
105
|
+
**Your job once they have the snippet:** paste it into their global stylesheet *after* the `@import "@devalok/shilp-sutra/css";` line. That's it — no `tailwind.config.ts`, no theme provider, no JS bundle. The CSS variables cascade to every component.
|
|
106
|
+
|
|
107
|
+
For deeper overrides (font stack, spacing scale, focus ring, texture) that the Themer doesn't expose yet, fall back to **`packages/core/docs/recipes/customize-brand.md`**.
|
|
108
|
+
|
|
109
|
+
### One-prompt recipe (when the user pastes a prompt at you)
|
|
110
|
+
|
|
111
|
+
If a user pastes the following prompt template at you, execute it verbatim — every step exists because skipping it broke a real consumer:
|
|
112
|
+
|
|
113
|
+
````
|
|
114
|
+
Set up shilp-sutra theming for this project via the Themer.
|
|
115
|
+
|
|
116
|
+
My brand: <hex OR archetype name>
|
|
117
|
+
|
|
118
|
+
Steps:
|
|
119
|
+
1. Map my brand input to query params (archetype=<name>, or hue=<0-360>&chroma=<0.10-0.20>, or default archetype=devalok&hue=340&chroma=0.19).
|
|
120
|
+
2. Fetch GET https://shilp-sutra.devalok.in/themer/result.json?<params>
|
|
121
|
+
Response: { archetype, density, shape, motion, hue, chroma, css, pasteAfter, pasteLocation, doNotPasteInside }
|
|
122
|
+
3. Paste the response `css` field AFTER the line in `pasteAfter` in the project's global stylesheet. Not inside any `@layer`.
|
|
123
|
+
4. If @devalok/shilp-sutra isn't installed, install it first per the matching install-<framework>.md recipe.
|
|
124
|
+
5. Verify with a Button or Card on any page — radius + accent should match https://shilp-sutra.devalok.in/themer/result?<params>.
|
|
125
|
+
````
|
|
126
|
+
|
|
127
|
+
When the user has already been to the Themer, they may paste a *filled-in* version with the JSON URL pre-built — skip step 1, go straight to fetch.
|
|
128
|
+
|
|
129
|
+
The JSON endpoint is the stable contract — agents and tooling should prefer it over scraping `/themer/result`'s HTML.
|
|
130
|
+
|
|
131
|
+
### Shape roundness — `[data-shape]` presets (v0.39+)
|
|
132
|
+
|
|
133
|
+
Components reference semantic radius role tokens (`--radius-control`, `--radius-surface`, `--radius-overlay-*`, `--radius-pill`, `--radius-bubble`), NOT primitive `rounded-ds-*`. Three presets ship: `sharp`, `slightly-rounded` (default), `rounded`. Set on `<html>` or any subtree:
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<html data-shape="sharp">
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Consumers can override any role globally (`:root { --radius-control: 4px; }`) or per-scope. When writing your own UI on top of shilp-sutra, prefer the role utilities (`rounded-control`, `rounded-surface`, `rounded-overlay`, `rounded-pill`, `rounded-bubble`) over `rounded-ds-*` so your styles respond to the preset switch.
|
|
140
|
+
|
|
141
|
+
## Server vs client components
|
|
142
|
+
|
|
143
|
+
For the per-component RSC-safety matrix and import patterns, see **`packages/core/docs/recipes/server-components.md`**.
|
|
144
|
+
|
|
145
|
+
## Reporting feedback
|
|
146
|
+
|
|
147
|
+
If you find that a recipe is wrong, a constraint above is no longer accurate, or a component behavior contradicts the docs:
|
|
148
|
+
|
|
149
|
+
1. Open a GitHub issue at `https://github.com/devalok-design/shilp-sutra/issues` with label `ai-agent-feedback`.
|
|
150
|
+
2. Include the package version (`pnpm view @devalok/shilp-sutra version` or read from the consumer's lockfile), the recipe path, the exact command/file/error, and what you expected.
|
|
151
|
+
|
|
152
|
+
<!-- END:shilp-sutra-agent-rules -->
|
|
153
|
+
|
|
154
|
+
## Project-specific notes
|
|
155
|
+
|
|
156
|
+
The block above is managed by Shilp Sutra and may be updated when you upgrade the package. Add your own project conventions, glossary, or codebase notes outside the markers — they will not be touched.
|
package/MIGRATION.md
CHANGED
|
@@ -4,6 +4,155 @@ This page indexes all breaking changes across `@devalok/shilp-sutra` versions. F
|
|
|
4
4
|
|
|
5
5
|
> **Upgrading from < 0.36?** Start here, then read each intermediate version section. Breaking changes stack — skipping versions means stacking migrations.
|
|
6
6
|
|
|
7
|
+
## v0.40.0 — Barrel peer-cliff cleanup + Icon API unification
|
|
8
|
+
|
|
9
|
+
This release pairs one breaking change (barrel peer-cliff cleanup) with one non-breaking type widening (Icon API unification). Read the breaking section first.
|
|
10
|
+
|
|
11
|
+
### Icon API unification (mostly non-breaking — one narrowing)
|
|
12
|
+
|
|
13
|
+
**Mostly non-breaking, with one narrowing for `React.ReactNode`-typed props.** For the 14 components whose `icon` prop was previously `React.ReactNode`, `IconInput` accepts **less** — it excludes `string`, `number`, and iterables. If you store icons in a `Record<string, React.ReactNode>` map or a `icon?: React.ReactNode` field and pass them to a migrated component, `tsc` will fail even though the runtime JSX is valid. **Fix: retype the icon source to `React.ReactElement`** (or import `IconInput`). Known affected props: `CommandItem.icon` (CommandBar/CommandPalette), `ActivityItem.icon` (ActivityFeed), `Chat.Message.Avatar` `icon`. For props that were `ComponentType`-only the change is a genuine widening (accepts more). Build-time only — no runtime impact.
|
|
14
|
+
|
|
15
|
+
Every icon-accepting prop across the design system now takes the same shape: **`IconInput`**. Before 0.40 there were six distinct prop types for the same conceptual "icon":
|
|
16
|
+
|
|
17
|
+
| Old shape | Components |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `React.ReactElement \| null` | Button (startIcon/endIcon), IconButton (icon), Badge (startIcon/endIcon) |
|
|
20
|
+
| `React.ReactNode` | 14 components (Combobox option, Stepper step, TreeItem, OAuthButton, AppCommandPalette, CommandRegistry, BottomNavbar, Sidebar's three NavItem types, TopBar, Chat.Message.Avatar, SystemMessage, AIConversation, ActivityFeed, CommandPalette item) |
|
|
21
|
+
| `React.ReactNode \| React.ComponentType<{className}>` | EmptyState, StatCard (dual-detect logic duplicated in both source files) |
|
|
22
|
+
| `React.ComponentType<{className?}>` | SegmentedControl (option), SlashCommand |
|
|
23
|
+
| `IconProps['icon']` (strict Tabler ref) | BulkActionBar (action), Chat.Message.Action |
|
|
24
|
+
| `React.ForwardRefExoticComponent<any>` | Toast (internal, sonner pass-through — unchanged) |
|
|
25
|
+
|
|
26
|
+
All six collapse to `IconInput`:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
type IconInput =
|
|
30
|
+
| React.ReactElement
|
|
31
|
+
| React.ComponentType<{ className?: string; size?: number | string }>
|
|
32
|
+
| null
|
|
33
|
+
| undefined
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
#### Migration
|
|
37
|
+
|
|
38
|
+
For every prop now typed as `IconInput`, all four shapes work identically:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<Button startIcon={<Icon icon={IconPlus} />}>OK</Button> // canonical
|
|
42
|
+
<Button startIcon={<IconPlus />}>OK</Button> // raw Tabler element
|
|
43
|
+
<Button startIcon={IconPlus}>OK</Button> // component ref
|
|
44
|
+
<Button startIcon={<span>+</span>}>OK</Button> // custom node
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Calls passing a JSX element or component ref still work.** The exception is the narrowing above: if your icon *source* is annotated `React.ReactNode` (a map value or field type), retype it to `React.ReactElement` — one-line per source, not per call site.
|
|
48
|
+
|
|
49
|
+
**You can now delete `className="h-4 w-4"` overrides** on icon-prop usages — `IconProvider` wires size through context. Stories cleanup is voluntary; behavior unchanged.
|
|
50
|
+
|
|
51
|
+
**Strict-to-loose call sites that newly compile:**
|
|
52
|
+
- `SegmentedControl options[*].icon` previously rejected `<IconX />` instantiated elements (only accepted bare `IconX` refs). Now both work.
|
|
53
|
+
- `BulkActionBar actions[*].icon` previously rejected non-Tabler nodes. Now accepts any `IconInput`.
|
|
54
|
+
- `Message.Action` same.
|
|
55
|
+
- `EmptyState` no longer needs the dual `<X />` / `X` differentiation in your call sites.
|
|
56
|
+
|
|
57
|
+
#### What got removed internally
|
|
58
|
+
|
|
59
|
+
- Five duplicate `iconSizeMap` declarations (Badge, Combobox, EmptyState, StatCard, etc.) → one shared `<IconProvider size={token}>` per call site
|
|
60
|
+
- Two duplicate dual-detect branches (`React.isValidElement(icon) || ('$$typeof' in icon)`) — replaced with `normalizeIcon()`
|
|
61
|
+
- The orphan `IconProps['icon']` references in BulkActionBar + Chat.Message.Action
|
|
62
|
+
|
|
63
|
+
#### Helpers exported (for consumer composability)
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import type { IconInput } from '@devalok/shilp-sutra/ui/lib/icon-input'
|
|
67
|
+
import { normalizeIcon } from '@devalok/shilp-sutra/ui/lib/normalize-icon'
|
|
68
|
+
|
|
69
|
+
// In your own component:
|
|
70
|
+
function MyCard({ icon }: { icon: IconInput }) {
|
|
71
|
+
return (
|
|
72
|
+
<div>
|
|
73
|
+
<IconProvider size="md">{normalizeIcon(icon)}</IconProvider>
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Use these in custom wrappers that consume our icon-style props.
|
|
80
|
+
|
|
81
|
+
### Barrel peer-cliff cleanup (breaking)
|
|
82
|
+
|
|
83
|
+
**Breaking.** Twelve symbols that statically pulled optional peer dependencies have been removed from their parent barrels (`/ui`, `/composed`, `/ai`, `/ai/blocks`). They remain fully available via their per-component subpath.
|
|
84
|
+
|
|
85
|
+
#### Why
|
|
86
|
+
|
|
87
|
+
Optional peer deps (`input-otp`, `sonner`, `date-fns`, `@emoji-mart/*`, `@tiptap/*`, `react-pdf`, `react-zoom-pan-pinch`, `react-markdown`, `react-syntax-highlighter`, `remark-gfm`) were declared `peerDependenciesMeta.optional = true` but the components that needed them were re-exported from the corresponding barrel with **static** ESM `import` statements. Result: a fresh consumer who wrote `import { Text } from '@devalok/shilp-sutra/ui'` without installing `input-otp` got:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Module not found: Can't resolve 'input-otp'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
…at `next build`/`vite build` time. "Optional" was a lie at the bundler level. This release closes that cliff for every affected component.
|
|
94
|
+
|
|
95
|
+
#### Search-and-replace migration table
|
|
96
|
+
|
|
97
|
+
For each symbol below, change ONLY the import path. Prop / type signatures are unchanged.
|
|
98
|
+
|
|
99
|
+
| Symbol(s) | Old (no longer works) | New (in 0.40.0+) | Peer it pulls |
|
|
100
|
+
|---|---|---|---|
|
|
101
|
+
| `InputOTP`, `InputOTPGroup`, `InputOTPSeparator`, `InputOTPSlot`, `InputOTPProps` | `from '@devalok/shilp-sutra/ui'` | `from '@devalok/shilp-sutra/ui/input-otp'` | `input-otp` |
|
|
102
|
+
| `toast`, `formatFileSize`, `ToastActionOptions`, `ToastOptions`, `ToastProps`, `ToastType`, `ToastUndoOptions`, `ToastUploadOptions`, `UploadFile` | `from '@devalok/shilp-sutra/ui'` | `from '@devalok/shilp-sutra/ui/toast'` | `sonner` |
|
|
103
|
+
| `Toaster`, `ToasterProps` | `from '@devalok/shilp-sutra/ui'` | `from '@devalok/shilp-sutra/ui/toaster'` | `sonner` |
|
|
104
|
+
| `DatePicker`, `DateRangePicker`, `DateTimePicker`, `TimePicker`, `CalendarGrid`, `MonthPicker`, `YearPicker`, `Presets`, `useCalendar`, all related `*Props` + `CalendarEvent` + `PresetKey` | `from '@devalok/shilp-sutra/composed'` | `from '@devalok/shilp-sutra/composed/date-picker'` | `date-fns` |
|
|
105
|
+
| `EmojiPicker`, `EmojiPickerPopover`, `EmojiData`, `EmojiPickerProps`, `EmojiPickerPopoverProps`, `EmojiSet` | `from '@devalok/shilp-sutra/composed'` | `from '@devalok/shilp-sutra/composed/emoji-picker'` | `@emoji-mart/data` + `@emoji-mart/react` |
|
|
106
|
+
| `EmojiNode`, `EmojiNodeAttrs` | `from '@devalok/shilp-sutra/composed'` | `from '@devalok/shilp-sutra/composed/extensions/emoji-node'` (new in 0.40.0) | `@tiptap/*` |
|
|
107
|
+
| `createEmojiSuggestion` | `from '@devalok/shilp-sutra/composed'` | `from '@devalok/shilp-sutra/composed/extensions/emoji-suggestion'` (new in 0.40.0) | `@tiptap/*` |
|
|
108
|
+
| `FilePreview`, `FilePreviewProps` | `from '@devalok/shilp-sutra/composed'` | `from '@devalok/shilp-sutra/composed/file-preview'` | `react-pdf` + `react-zoom-pan-pinch` |
|
|
109
|
+
| `MarkdownViewer`, `MarkdownViewerProps` | `from '@devalok/shilp-sutra/composed'` | `from '@devalok/shilp-sutra/composed/markdown-viewer'` | `react-markdown` + `react-syntax-highlighter` + `remark-gfm` |
|
|
110
|
+
| `RichChatInput`, `AudioPlayer`, `AudioWaveform`, `useVoiceRecorder`, all related `*Props` + `*Message` | `from '@devalok/shilp-sutra/composed'` | `from '@devalok/shilp-sutra/composed/rich-chat-input'` | `@tiptap/*` |
|
|
111
|
+
| `RichTextEditor`, `RichTextViewer`, `RichTextEditorProps`, `RichTextViewerProps`, `MentionItem`, `ToolbarItem` | `from '@devalok/shilp-sutra/composed'` | `from '@devalok/shilp-sutra/composed/rich-text-editor'` | `@tiptap/*` |
|
|
112
|
+
| `BlockRenderer`, `BlockRendererProps` | `from '@devalok/shilp-sutra/ai'` | `from '@devalok/shilp-sutra/ai/block-renderer'` | `react-markdown` + `remark-gfm` (transitively via TextBlock/ErrorBlock) |
|
|
113
|
+
| `ErrorBlock` | `from '@devalok/shilp-sutra/ai'` OR `from '@devalok/shilp-sutra/ai/blocks'` | `from '@devalok/shilp-sutra/ai/blocks/error'` (new in 0.40.0) | `react-markdown` + `remark-gfm` |
|
|
114
|
+
| `TextBlock` | `from '@devalok/shilp-sutra/ai'` OR `from '@devalok/shilp-sutra/ai/blocks'` | `from '@devalok/shilp-sutra/ai/blocks/text'` (new in 0.40.0) | `react-markdown` + `remark-gfm` |
|
|
115
|
+
|
|
116
|
+
The seven other AI blocks (`BlockTable`, `ConfirmBlock`, `DividerBlock`, `InfoBlock`, `LoadingBlock`, `StatRowBlock`, `SuccessBlock`) have no peer-dep imports and remain available via `from '@devalok/shilp-sutra/ai/blocks'` (the sub-barrel) or `from '@devalok/shilp-sutra/ai'` (the main barrel).
|
|
117
|
+
|
|
118
|
+
#### Codemod helper (recommended)
|
|
119
|
+
|
|
120
|
+
The fastest path is the official ESLint plugin — its `prefer-per-component-import` rule detects every peer-cliff symbol still imported from a barrel and **autofixes the import path** for you:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pnpm add -D @devalok/eslint-plugin-shilp-sutra
|
|
124
|
+
# one-shot codemod across your source
|
|
125
|
+
pnpm eslint --fix --config node_modules/@devalok/eslint-plugin-shilp-sutra/migration src/
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Or wire `shilpSutra.configs['flat/migration']` into your `eslint.config.ts` and run `eslint --fix`. The rule splits multi-symbol barrel lines correctly, which the `sed` approach below cannot.
|
|
129
|
+
|
|
130
|
+
<details><summary>Manual <code>sed</code> fallback (single-symbol lines only)</summary>
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Replace barrel imports of toast / Toaster with per-component imports
|
|
134
|
+
grep -rl "from '@devalok/shilp-sutra/ui'" src/ | xargs sed -i.bak \
|
|
135
|
+
-e "s|import { \\(.*\\)toast\\(.*\\)} from '@devalok/shilp-sutra/ui'|import { toast } from '@devalok/shilp-sutra/ui/toast'\\nimport { \\1\\2} from '@devalok/shilp-sutra/ui'|"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
(Adjust per project — the regex assumes a single `toast` import on the line. For multi-symbol lines, the ESLint autofix above is far more reliable.)
|
|
139
|
+
|
|
140
|
+
</details>
|
|
141
|
+
|
|
142
|
+
#### Per-chart subpaths added (non-breaking)
|
|
143
|
+
|
|
144
|
+
`/ui/charts/<chart>` subpaths are now exported for `area-chart`, `bar-chart`, `chart-container`, `gauge-chart`, `line-chart`, `pie-chart`, `radar-chart`, `sparkline`. The `/ui/charts` barrel still works and still pulls all 9 d3-\* peers — but if you only need `BarChart`, `import { BarChart } from '@devalok/shilp-sutra/ui/charts/bar-chart'` pulls only the d3-\* peers it actually needs (`d3-scale`, `d3-axis`, `d3-selection`).
|
|
145
|
+
|
|
146
|
+
#### What didn't change
|
|
147
|
+
|
|
148
|
+
- All per-component subpaths existed before 0.40.0 (except the 4 new ones noted above). Consumers already importing per-component need zero changes.
|
|
149
|
+
- Component APIs, prop signatures, types, runtime behavior, default styles: all unchanged.
|
|
150
|
+
- Storybook stories, tests, internal imports inside the DS itself: all use relative paths and were never affected.
|
|
151
|
+
|
|
152
|
+
#### Why this isn't behind a flag
|
|
153
|
+
|
|
154
|
+
There is no good additive solution. Tree-shaking can't drop a static `import 'sonner'` if `sonner` isn't on disk — the resolver fails before tree-shaking runs. Lazy-imports (`import('sonner')`) move the failure from build-time to runtime, which is worse. Removing the barrel re-export is the only fix.
|
|
155
|
+
|
|
7
156
|
## v0.39.0 — Shape presets & semantic radius role tokens
|
|
8
157
|
|
|
9
158
|
No API breaks. Component prop signatures unchanged. But the visual output of several components shifts because radius is now role-driven, not per-size ad-hoc.
|
package/README.md
CHANGED
|
@@ -4,10 +4,13 @@ Devalok Design System -- tokens, components, and patterns for React & Next.js.
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@devalok/shilp-sutra)
|
|
6
6
|
[](https://devalok-design.github.io/shilp-sutra/)
|
|
7
|
+
[](https://shilp-sutra.devalok.in/themer)
|
|
7
8
|
[](https://opensource.org/licenses/MIT)
|
|
8
9
|
|
|
9
10
|
For full documentation, setup guides, and architecture details, see the [monorepo README](https://github.com/devalok-design/shilp-sutra#readme).
|
|
10
11
|
|
|
12
|
+
> **Want to brand it?** Skip the CSS cookbook — open **[the Themer](https://shilp-sutra.devalok.in/themer)**. Pick an archetype (Linear / Stripe / Apple / Material / Notion / Vercel / Devalok), or paste your brand hex, or take a 5-question wizard. Lands you at a result page with install commands + a CSS block to paste.
|
|
13
|
+
|
|
11
14
|
## Install
|
|
12
15
|
|
|
13
16
|
```bash
|
|
@@ -29,7 +32,7 @@ pnpm add sonner
|
|
|
29
32
|
```ts
|
|
30
33
|
// next.config.ts
|
|
31
34
|
export default {
|
|
32
|
-
transpilePackages: ['@devalok/shilp-sutra'
|
|
35
|
+
transpilePackages: ['@devalok/shilp-sutra'],
|
|
33
36
|
}
|
|
34
37
|
```
|
|
35
38
|
|
|
@@ -4,13 +4,14 @@ import { durations as t, springs as n } from "../ui/lib/motion.js";
|
|
|
4
4
|
import { t as r } from "./vendor-utils.js";
|
|
5
5
|
import { cn as i } from "../ui/lib/utils.js";
|
|
6
6
|
import { Icon as a } from "../ui/icon.js";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { t as o } from "./normalize-icon.js";
|
|
8
|
+
import { BadgeIndicator as s } from "../ui/badge-indicator.js";
|
|
9
|
+
import * as c from "react";
|
|
10
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
11
|
+
import { IconCheck as d, IconX as f } from "@tabler/icons-react";
|
|
12
|
+
import { AnimatePresence as p, motion as m, useReducedMotion as h } from "framer-motion";
|
|
12
13
|
//#region src/ui/badge.tsx
|
|
13
|
-
var
|
|
14
|
+
var g = {
|
|
14
15
|
default: {
|
|
15
16
|
bg: "bg-surface-raised-hover",
|
|
16
17
|
fg: "text-surface-fg-muted",
|
|
@@ -110,9 +111,9 @@ var h = {
|
|
|
110
111
|
solidFg: "text-white"
|
|
111
112
|
}
|
|
112
113
|
};
|
|
113
|
-
function
|
|
114
|
+
function _(e, t) {
|
|
114
115
|
if (t === "custom") return "";
|
|
115
|
-
let n =
|
|
116
|
+
let n = g[t];
|
|
116
117
|
switch (e) {
|
|
117
118
|
case "subtle": return i(n.bg, n.fg, n.border);
|
|
118
119
|
case "solid": return i(n.solid, n.solidFg, "border-transparent");
|
|
@@ -120,7 +121,7 @@ function g(e, t) {
|
|
|
120
121
|
case "soft": return i(n.bg, n.fg, "border-transparent");
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
var
|
|
124
|
+
var v = r("relative inline-flex items-center rounded-pill font-sans font-medium overflow-hidden isolate transition-[color,background-color,border-color,padding] duration-fast-02 ease-productive-standard select-none [&>span:not([data-grain])]:relative [&>span:not([data-grain])]:z-[2]", {
|
|
124
125
|
variants: {
|
|
125
126
|
variant: {
|
|
126
127
|
subtle: "border",
|
|
@@ -139,81 +140,81 @@ var _ = r("relative inline-flex items-center rounded-pill font-sans font-medium
|
|
|
139
140
|
variant: "subtle",
|
|
140
141
|
size: "md"
|
|
141
142
|
}
|
|
142
|
-
}),
|
|
143
|
+
}), y = {
|
|
143
144
|
xs: "[&>svg]:h-2.5 [&>svg]:w-2.5",
|
|
144
145
|
sm: "[&>svg]:h-3 [&>svg]:w-3",
|
|
145
146
|
md: "[&>svg]:h-3 [&>svg]:w-3",
|
|
146
147
|
lg: "[&>svg]:h-3.5 [&>svg]:w-3.5"
|
|
147
|
-
},
|
|
148
|
+
}, b = {
|
|
148
149
|
xs: "pl-ds-02",
|
|
149
150
|
sm: "pl-ds-02b",
|
|
150
151
|
md: "pl-ds-03",
|
|
151
152
|
lg: "pl-2.5"
|
|
152
|
-
},
|
|
153
|
+
}, x = {
|
|
153
154
|
xs: "pr-ds-01",
|
|
154
155
|
sm: "pr-ds-02",
|
|
155
156
|
md: "pr-ds-02",
|
|
156
157
|
lg: "pr-ds-02b"
|
|
157
|
-
},
|
|
158
|
-
let
|
|
159
|
-
...
|
|
158
|
+
}, S = c.forwardRef(({ className: r, variant: s, color: c, size: g, asChild: S, startIcon: C, endIcon: w, dot: T, onDismiss: E, onClick: D, selected: O, disabled: k, maxWidth: A, truncate: j, circle: M, children: N, style: P, ...F }, I) => {
|
|
159
|
+
let L = h(), R = s ?? "subtle", z = c ?? "default", B = g ?? "md", V = S ? e : D && E ? "div" : D ? "button" : "span", H = z === "custom" ? {
|
|
160
|
+
...R === "subtle" && {
|
|
160
161
|
backgroundColor: "color-mix(in oklch, var(--badge-color) 15%, transparent)",
|
|
161
162
|
color: "var(--badge-color)",
|
|
162
163
|
borderColor: "color-mix(in oklch, var(--badge-color) 40%, transparent)"
|
|
163
164
|
},
|
|
164
|
-
...
|
|
165
|
+
...R === "solid" && {
|
|
165
166
|
backgroundColor: "var(--badge-color)",
|
|
166
167
|
color: "var(--badge-fg-color, white)",
|
|
167
168
|
borderColor: "transparent"
|
|
168
169
|
},
|
|
169
|
-
...
|
|
170
|
+
...R === "outline" && {
|
|
170
171
|
backgroundColor: "transparent",
|
|
171
172
|
color: "var(--badge-color)",
|
|
172
173
|
borderColor: "color-mix(in oklch, var(--badge-color) 50%, transparent)"
|
|
173
174
|
},
|
|
174
|
-
...
|
|
175
|
+
...R === "soft" && {
|
|
175
176
|
backgroundColor: "color-mix(in oklch, var(--badge-color) 12%, transparent)",
|
|
176
177
|
color: "var(--badge-color)",
|
|
177
178
|
borderColor: "transparent"
|
|
178
179
|
}
|
|
179
|
-
} : void 0,
|
|
180
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
181
|
-
} :
|
|
182
|
-
return /* @__PURE__ */
|
|
183
|
-
ref:
|
|
184
|
-
className: i(
|
|
185
|
-
variant:
|
|
186
|
-
size:
|
|
187
|
-
}),
|
|
180
|
+
} : void 0, U = D && E ? (e) => {
|
|
181
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), k || D(e)), F.onKeyDown?.(e);
|
|
182
|
+
} : F.onKeyDown, W = !!(T || C || D && O && !C && !T), G = !!(E || w);
|
|
183
|
+
return /* @__PURE__ */ u(V, {
|
|
184
|
+
ref: I,
|
|
185
|
+
className: i(v({
|
|
186
|
+
variant: R,
|
|
187
|
+
size: B
|
|
188
|
+
}), _(R, z), W && b[B], G && x[B], D && "cursor-pointer hover:brightness-[0.97] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-1 transition-[color,background-color,border-color,transform,filter] duration-moderate-01 ease-productive-exit hover:duration-fast-02 hover:ease-productive-entrance active:scale-[0.95] active:brightness-[0.92] active:duration-[0ms]", O && "ring-1 ring-current/20 transition-shadow duration-fast-02", k && "opacity-action-disabled pointer-events-none saturate-[0.3]", M && "justify-center px-0 aspect-square", r),
|
|
188
189
|
style: {
|
|
189
|
-
...
|
|
190
|
-
...
|
|
191
|
-
...
|
|
190
|
+
...P,
|
|
191
|
+
...H,
|
|
192
|
+
...A ? { maxWidth: A } : void 0
|
|
192
193
|
},
|
|
193
|
-
onClick:
|
|
194
|
-
onKeyDown:
|
|
195
|
-
...
|
|
196
|
-
...
|
|
197
|
-
...
|
|
194
|
+
onClick: k ? void 0 : D,
|
|
195
|
+
onKeyDown: U,
|
|
196
|
+
...V === "button" && { type: "button" },
|
|
197
|
+
...V === "button" && k ? { disabled: !0 } : {},
|
|
198
|
+
...V === "div" && D ? {
|
|
198
199
|
role: "button",
|
|
199
200
|
tabIndex: 0
|
|
200
201
|
} : {},
|
|
201
|
-
...
|
|
202
|
+
...F,
|
|
202
203
|
children: [
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ l(p, { children: T && /* @__PURE__ */ u(m.span, {
|
|
204
205
|
initial: { scale: 0 },
|
|
205
206
|
animate: { scale: 1 },
|
|
206
207
|
exit: { scale: 0 },
|
|
207
208
|
transition: n.snappy,
|
|
208
209
|
className: "relative inline-flex h-1.5 w-1.5 shrink-0",
|
|
209
210
|
"aria-hidden": "true",
|
|
210
|
-
children: [/* @__PURE__ */
|
|
211
|
+
children: [/* @__PURE__ */ l(m.span, {
|
|
211
212
|
className: "absolute inset-0 rounded-pill bg-current",
|
|
212
|
-
animate:
|
|
213
|
+
animate: L ? void 0 : {
|
|
213
214
|
scale: [1, 2.5],
|
|
214
215
|
opacity: [.35, 0]
|
|
215
216
|
},
|
|
216
|
-
transition:
|
|
217
|
+
transition: L ? { duration: 0 } : {
|
|
217
218
|
repeat: Infinity,
|
|
218
219
|
repeatDelay: .3,
|
|
219
220
|
duration: 1.2,
|
|
@@ -224,11 +225,11 @@ var _ = r("relative inline-flex items-center rounded-pill font-sans font-medium
|
|
|
224
225
|
1
|
|
225
226
|
]
|
|
226
227
|
}
|
|
227
|
-
}), /* @__PURE__ */
|
|
228
|
+
}), /* @__PURE__ */ l("span", { className: "relative h-1.5 w-1.5 rounded-pill bg-current" })]
|
|
228
229
|
}, "dot") }),
|
|
229
|
-
|
|
230
|
+
D && !C && !T && /* @__PURE__ */ l(m.span, {
|
|
230
231
|
initial: !1,
|
|
231
|
-
animate:
|
|
232
|
+
animate: O ? {
|
|
232
233
|
opacity: 1,
|
|
233
234
|
scale: 1,
|
|
234
235
|
width: "auto",
|
|
@@ -250,54 +251,54 @@ var _ = r("relative inline-flex items-center rounded-pill font-sans font-medium
|
|
|
250
251
|
]
|
|
251
252
|
},
|
|
252
253
|
className: "inline-flex shrink-0 overflow-hidden",
|
|
253
|
-
"aria-hidden": !
|
|
254
|
-
children: /* @__PURE__ */
|
|
255
|
-
icon:
|
|
254
|
+
"aria-hidden": !O,
|
|
255
|
+
children: /* @__PURE__ */ l(a, {
|
|
256
|
+
icon: d,
|
|
256
257
|
size: "xs"
|
|
257
258
|
})
|
|
258
259
|
}),
|
|
259
|
-
|
|
260
|
-
className: i("shrink-0",
|
|
261
|
-
children:
|
|
260
|
+
C && /* @__PURE__ */ l("span", {
|
|
261
|
+
className: i("shrink-0", y[B]),
|
|
262
|
+
children: o(C)
|
|
262
263
|
}),
|
|
263
|
-
|
|
264
|
+
j || A ? /* @__PURE__ */ l("span", {
|
|
264
265
|
className: "truncate",
|
|
265
|
-
title: typeof
|
|
266
|
-
children:
|
|
267
|
-
}) :
|
|
268
|
-
|
|
269
|
-
className: i("shrink-0",
|
|
270
|
-
children:
|
|
266
|
+
title: typeof N == "string" ? N : void 0,
|
|
267
|
+
children: N
|
|
268
|
+
}) : N,
|
|
269
|
+
w && /* @__PURE__ */ l("span", {
|
|
270
|
+
className: i("shrink-0", y[B]),
|
|
271
|
+
children: o(w)
|
|
271
272
|
}),
|
|
272
|
-
|
|
273
|
+
E && /* @__PURE__ */ l("button", {
|
|
273
274
|
type: "button",
|
|
274
275
|
onClick: (e) => {
|
|
275
|
-
e.stopPropagation(),
|
|
276
|
+
e.stopPropagation(), E();
|
|
276
277
|
},
|
|
277
|
-
className: i("shrink-0 rounded-pill text-current/60 hover:text-current hover:bg-current/10 transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent-9",
|
|
278
|
-
"aria-label": `Remove ${typeof
|
|
279
|
-
children: /* @__PURE__ */
|
|
280
|
-
icon:
|
|
278
|
+
className: i("shrink-0 rounded-pill text-current/60 hover:text-current hover:bg-current/10 transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent-9", B === "xs" ? "p-0 -mr-0.5 min-w-[16px] min-h-[16px]" : "p-px"),
|
|
279
|
+
"aria-label": `Remove ${typeof N == "string" ? N : ""}`.trim() || "Remove",
|
|
280
|
+
children: /* @__PURE__ */ l(a, {
|
|
281
|
+
icon: f,
|
|
281
282
|
size: "xs"
|
|
282
283
|
})
|
|
283
284
|
})
|
|
284
285
|
]
|
|
285
286
|
});
|
|
286
287
|
});
|
|
287
|
-
|
|
288
|
-
var
|
|
289
|
-
Indicator:
|
|
290
|
-
Group:
|
|
291
|
-
}),
|
|
288
|
+
S.displayName = "Badge";
|
|
289
|
+
var C = Object.assign(S, {
|
|
290
|
+
Indicator: s,
|
|
291
|
+
Group: T
|
|
292
|
+
}), w = {
|
|
292
293
|
tight: "gap-1",
|
|
293
294
|
default: "gap-1.5",
|
|
294
295
|
loose: "gap-2"
|
|
295
296
|
};
|
|
296
|
-
function
|
|
297
|
-
let
|
|
298
|
-
return /* @__PURE__ */
|
|
299
|
-
className: i("flex flex-wrap items-center",
|
|
300
|
-
children: [f, d && /* @__PURE__ */
|
|
297
|
+
function T({ max: e, gap: t = "default", size: n, onOverflowClick: r, className: a, children: o }) {
|
|
298
|
+
let s = c.Children.toArray(o), l = s.length, d = e !== void 0 && l > e, f = d ? s.slice(0, e) : s, p = d ? l - e : 0;
|
|
299
|
+
return /* @__PURE__ */ u("div", {
|
|
300
|
+
className: i("flex flex-wrap items-center", w[t], a),
|
|
301
|
+
children: [f, d && /* @__PURE__ */ u(C, {
|
|
301
302
|
variant: "outline",
|
|
302
303
|
color: "neutral",
|
|
303
304
|
size: n ?? "sm",
|
|
@@ -306,6 +307,6 @@ function w({ max: e, gap: t = "default", size: n, onOverflowClick: r, className:
|
|
|
306
307
|
})]
|
|
307
308
|
});
|
|
308
309
|
}
|
|
309
|
-
|
|
310
|
+
T.displayName = "BadgeGroup";
|
|
310
311
|
//#endregion
|
|
311
|
-
export {
|
|
312
|
+
export { C as n, v as r, T as t };
|