@devalok/shilp-sutra 0.2.0 → 0.3.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/README.md +239 -0
- package/dist/composed/content-card.d.ts +2 -2
- package/dist/composed/error-boundary.js +1 -1
- package/dist/shell/notification-preferences.js +14 -14
- package/dist/tailwind/index.cjs +344 -0
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +15 -10
- package/dist/tokens/index.css +1 -0
- package/dist/tokens/semantic.css +3 -3
- package/dist/tokens/typography.css +7 -7
- package/dist/ui/alert.d.ts +7 -7
- package/dist/ui/alert.js +10 -10
- package/dist/ui/autocomplete.d.ts +3 -3
- package/dist/ui/autocomplete.d.ts.map +1 -1
- package/dist/ui/autocomplete.js +1 -1
- package/dist/ui/badge.d.ts +10 -7
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/badge.js +82 -30
- package/dist/ui/banner.d.ts +5 -5
- package/dist/ui/banner.js +17 -17
- package/dist/ui/button-group.d.ts +8 -5
- package/dist/ui/button-group.d.ts.map +1 -1
- package/dist/ui/button-group.js +17 -17
- package/dist/ui/button.d.ts +10 -8
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +65 -47
- package/dist/ui/chip.d.ts +5 -5
- package/dist/ui/chip.js +10 -10
- package/dist/ui/combobox.d.ts +6 -7
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +32 -31
- package/dist/ui/dialog.d.ts +5 -11
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +53 -53
- package/dist/ui/file-upload.js +34 -34
- package/dist/ui/form.d.ts +31 -28
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +34 -32
- package/dist/ui/icon-button.d.ts +4 -4
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +69 -69
- package/dist/ui/number-input.d.ts +8 -10
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +48 -47
- package/dist/ui/progress.d.ts +1 -1
- package/dist/ui/search-input.js +8 -8
- package/dist/ui/sheet.d.ts +6 -12
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +49 -49
- package/dist/ui/sidebar.d.ts +1 -1
- package/dist/ui/slider.d.ts +1 -0
- package/dist/ui/slider.d.ts.map +1 -1
- package/dist/ui/spinner.js +7 -7
- package/dist/ui/switch.d.ts +4 -1
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +13 -12
- package/dist/ui/toast.d.ts +3 -3
- package/dist/ui/toast.js +22 -22
- package/dist/ui/toaster.d.ts +3 -3
- package/dist/ui/toggle-group.d.ts +2 -2
- package/dist/ui/toggle.d.ts +2 -2
- package/fonts/Inter-Italic-Variable.woff2 +0 -0
- package/fonts/Inter-Variable.woff2 +0 -0
- package/fonts/Ranade-Variable.woff2 +0 -0
- package/fonts/Ranade-VariableItalic.woff2 +0 -0
- package/package.json +63 -11
- package/fonts/GoogleSans-Italic-Variable.ttf +0 -0
- package/fonts/GoogleSans-Variable.ttf +0 -0
- package/fonts/Ranade-Variable.ttf +0 -0
- package/fonts/Ranade-VariableItalic.ttf +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# @devalok/shilp-sutra
|
|
2
|
+
|
|
3
|
+
Devalok Design System -- tokens, components, and patterns for React & Next.js.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@devalok/shilp-sutra)
|
|
6
|
+
[](https://devalok-design.github.io/shilp-sutra/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Quick Setup
|
|
12
|
+
|
|
13
|
+
### 1. Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @devalok/shilp-sutra
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 2. Add Tailwind Preset
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// tailwind.config.ts
|
|
23
|
+
import shilpSutra from '@devalok/shilp-sutra/tailwind'
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
presets: [shilpSutra],
|
|
27
|
+
content: [
|
|
28
|
+
'./app/**/*.{ts,tsx}',
|
|
29
|
+
'./node_modules/@devalok/shilp-sutra/dist/**/*.js',
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. Import Tokens
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
// app/layout.tsx (Next.js) or main entry point
|
|
38
|
+
import '@devalok/shilp-sutra/tokens'
|
|
39
|
+
import './globals.css'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Done. Start using components.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Import Patterns
|
|
47
|
+
|
|
48
|
+
### Per-component import (recommended)
|
|
49
|
+
|
|
50
|
+
Best for tree-shaking, Server Components, and fast builds:
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { Button } from '@devalok/shilp-sutra/ui/button'
|
|
54
|
+
import { Dialog } from '@devalok/shilp-sutra/ui/dialog'
|
|
55
|
+
import { DatePicker } from '@devalok/shilp-sutra/composed/date-picker'
|
|
56
|
+
import { TopBar } from '@devalok/shilp-sutra/shell/top-bar'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Barrel import
|
|
60
|
+
|
|
61
|
+
Convenient for client components that use many primitives:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Button, Dialog, Input, Badge } from '@devalok/shilp-sutra/ui'
|
|
65
|
+
import { PageHeader, DatePicker } from '@devalok/shilp-sutra/composed'
|
|
66
|
+
import { AppSidebar, TopBar } from '@devalok/shilp-sutra/shell'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Root import
|
|
70
|
+
|
|
71
|
+
Shorthand for UI components only:
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { Button, Input } from '@devalok/shilp-sutra'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Mental Model
|
|
80
|
+
|
|
81
|
+
The design system is organized into three tiers:
|
|
82
|
+
|
|
83
|
+
| Layer | Import | What it contains |
|
|
84
|
+
|-------|--------|------------------|
|
|
85
|
+
| **ui** | `@devalok/shilp-sutra/ui` | 60+ atomic primitives -- buttons, inputs, dialogs, cards, tables, badges, charts, navigation menus |
|
|
86
|
+
| **composed** | `@devalok/shilp-sutra/composed` | 14 multi-component patterns -- date picker, rich text editor, command palette, page header, skeletons |
|
|
87
|
+
| **shell** | `@devalok/shilp-sutra/shell` | 7 app-level layout components -- sidebar, top bar, bottom navbar, notification center, command palette |
|
|
88
|
+
|
|
89
|
+
Additional exports:
|
|
90
|
+
|
|
91
|
+
| Import | Contents |
|
|
92
|
+
|--------|----------|
|
|
93
|
+
| `@devalok/shilp-sutra/tokens` | CSS custom properties (primitives, semantic, typography) |
|
|
94
|
+
| `@devalok/shilp-sutra/tailwind` | Tailwind CSS preset with all design tokens |
|
|
95
|
+
| `@devalok/shilp-sutra/hooks` | `useToast`, `useColorMode`, `useIsMobile` |
|
|
96
|
+
| `@devalok/shilp-sutra/fonts/*` | Inter and Ranade variable fonts (WOFF2) |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Peer Dependencies
|
|
101
|
+
|
|
102
|
+
### Required
|
|
103
|
+
|
|
104
|
+
| Package | Version |
|
|
105
|
+
|---------|---------|
|
|
106
|
+
| `react` | `^18 \|\| ^19` |
|
|
107
|
+
| `react-dom` | `^18 \|\| ^19` |
|
|
108
|
+
|
|
109
|
+
### Optional
|
|
110
|
+
|
|
111
|
+
Install only what you use:
|
|
112
|
+
|
|
113
|
+
| Feature | Packages |
|
|
114
|
+
|---------|----------|
|
|
115
|
+
| Charts (`./ui/charts`) | `d3-array`, `d3-axis`, `d3-format`, `d3-interpolate`, `d3-scale`, `d3-selection`, `d3-shape`, `d3-time-format`, `d3-transition` |
|
|
116
|
+
| Rich Text Editor (`./composed/rich-text-editor`) | `@tiptap/react`, `@tiptap/starter-kit`, `@tiptap/extension-placeholder` |
|
|
117
|
+
| DataTable (`./ui/data-table`) | `@tanstack/react-table`, `@tanstack/react-virtual` |
|
|
118
|
+
| Icons (various components) | `@tabler/icons-react` |
|
|
119
|
+
| Date components (`./composed/date-picker`) | `date-fns` |
|
|
120
|
+
| OTP Input (`./ui/input-otp`) | `input-otp` |
|
|
121
|
+
| Markdown rendering | `react-markdown` |
|
|
122
|
+
|
|
123
|
+
Example -- install only charts deps:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
pnpm add d3-array d3-axis d3-format d3-interpolate d3-scale d3-selection d3-shape d3-time-format d3-transition
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Server-Safe Components
|
|
132
|
+
|
|
133
|
+
These components work in React Server Components when imported via their per-component path. They do **not** include `"use client"` directives:
|
|
134
|
+
|
|
135
|
+
### ui
|
|
136
|
+
|
|
137
|
+
| Component | Import |
|
|
138
|
+
|-----------|--------|
|
|
139
|
+
| Text | `@devalok/shilp-sutra/ui/text` |
|
|
140
|
+
| Skeleton | `@devalok/shilp-sutra/ui/skeleton` |
|
|
141
|
+
| Spinner | `@devalok/shilp-sutra/ui/spinner` |
|
|
142
|
+
| Stack | `@devalok/shilp-sutra/ui/stack` |
|
|
143
|
+
| Container | `@devalok/shilp-sutra/ui/container` |
|
|
144
|
+
| Table | `@devalok/shilp-sutra/ui/table` |
|
|
145
|
+
| Code | `@devalok/shilp-sutra/ui/code` |
|
|
146
|
+
| VisuallyHidden | `@devalok/shilp-sutra/ui/visually-hidden` |
|
|
147
|
+
|
|
148
|
+
### composed
|
|
149
|
+
|
|
150
|
+
| Component | Import |
|
|
151
|
+
|-----------|--------|
|
|
152
|
+
| ContentCard | `@devalok/shilp-sutra/composed/content-card` |
|
|
153
|
+
| EmptyState | `@devalok/shilp-sutra/composed/empty-state` |
|
|
154
|
+
| PageHeader | `@devalok/shilp-sutra/composed/page-header` |
|
|
155
|
+
| LoadingSkeleton | `@devalok/shilp-sutra/composed/loading-skeleton` |
|
|
156
|
+
| PageSkeletons | `@devalok/shilp-sutra/composed/page-skeletons` |
|
|
157
|
+
| PriorityIndicator | `@devalok/shilp-sutra/composed/priority-indicator` |
|
|
158
|
+
| StatusBadge | `@devalok/shilp-sutra/composed/status-badge` |
|
|
159
|
+
|
|
160
|
+
All other components require client-side React and include `"use client"`.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Dark Mode
|
|
165
|
+
|
|
166
|
+
The design system uses CSS custom properties with a `.dark` class toggle. All semantic tokens have dark mode overrides built in.
|
|
167
|
+
|
|
168
|
+
### Setup
|
|
169
|
+
|
|
170
|
+
Add the `.dark` class to your `<html>` or a parent element:
|
|
171
|
+
|
|
172
|
+
```html
|
|
173
|
+
<html class="dark">
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Next.js with next-themes
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
// app/layout.tsx
|
|
180
|
+
import { ThemeProvider } from 'next-themes'
|
|
181
|
+
|
|
182
|
+
export default function RootLayout({ children }) {
|
|
183
|
+
return (
|
|
184
|
+
<html suppressHydrationWarning>
|
|
185
|
+
<body>
|
|
186
|
+
<ThemeProvider attribute="class" defaultTheme="system">
|
|
187
|
+
{children}
|
|
188
|
+
</ThemeProvider>
|
|
189
|
+
</body>
|
|
190
|
+
</html>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Programmatic toggle
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
import { useColorMode } from '@devalok/shilp-sutra/hooks'
|
|
199
|
+
|
|
200
|
+
function ThemeToggle() {
|
|
201
|
+
const { mode, toggle } = useColorMode()
|
|
202
|
+
return <button onClick={toggle}>{mode === 'dark' ? 'Light' : 'Dark'}</button>
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## TypeScript
|
|
209
|
+
|
|
210
|
+
Full TypeScript support works out of the box. No special `tsconfig.json` settings required.
|
|
211
|
+
|
|
212
|
+
All component props are exported as named types:
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
import { type ButtonProps } from '@devalok/shilp-sutra/ui/button'
|
|
216
|
+
import { type DatePickerProps } from '@devalok/shilp-sutra/composed/date-picker'
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Token Architecture
|
|
222
|
+
|
|
223
|
+
Three-tier CSS custom property system:
|
|
224
|
+
|
|
225
|
+
1. **Primitives** (`primitives.css`) -- Raw palette values (50-950 scales). Never used directly in components.
|
|
226
|
+
2. **Semantic** (`semantic.css`) -- Intent-based tokens (`--color-interactive`, `--color-text-primary`). Includes dark mode via `.dark` class.
|
|
227
|
+
3. **Typography** (`typography.css`) -- Font-face declarations, type scale (T1-T7, B1-B8, L1-L6, P1-P7).
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Links
|
|
232
|
+
|
|
233
|
+
- [Storybook](https://devalok-design.github.io/shilp-sutra/) -- interactive component docs
|
|
234
|
+
- [GitHub](https://github.com/devalok-design/shilp-sutra)
|
|
235
|
+
- [Changelog](https://github.com/devalok-design/shilp-sutra/blob/main/CHANGELOG.md)
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
MIT -- Copyright 2026 Devalok Design & Strategy Studios
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
declare const contentCardVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
5
|
-
padding?: "
|
|
4
|
+
variant?: "outline" | "ghost" | "default" | null | undefined;
|
|
5
|
+
padding?: "default" | "none" | "compact" | "spacious" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
export interface ContentCardProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof contentCardVariants> {
|
|
8
8
|
header?: React.ReactNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as t, Fragment as B, jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as i } from "react";
|
|
4
4
|
import { Button as b } from "../ui/button.js";
|
|
5
|
-
import { Select as d, SelectTrigger as o, SelectValue as m, SelectContent as h, SelectItem as
|
|
5
|
+
import { Select as d, SelectTrigger as o, SelectValue as m, SelectContent as h, SelectItem as c } from "../ui/select.js";
|
|
6
6
|
import { Dialog as D, DialogContent as z, DialogHeader as q, DialogTitle as J, DialogDescription as K } from "../ui/dialog.js";
|
|
7
7
|
import { Switch as k } from "../ui/switch.js";
|
|
8
8
|
import { Card as Q, CardHeader as W, CardTitle as X, CardContent as Y } from "../ui/card.js";
|
|
@@ -21,12 +21,12 @@ function te({
|
|
|
21
21
|
projects: v = [],
|
|
22
22
|
isLoading: L = !1,
|
|
23
23
|
onSave: C,
|
|
24
|
-
onToggleMute:
|
|
25
|
-
onUpdateTier:
|
|
24
|
+
onToggleMute: u,
|
|
25
|
+
onUpdateTier: x,
|
|
26
26
|
onDelete: p,
|
|
27
27
|
className: T
|
|
28
28
|
}) {
|
|
29
|
-
const [E, s] =
|
|
29
|
+
const [E, s] = i(!1), [N, g] = i("global"), [I, w] = i("IN_APP"), [y, A] = i("INFO"), [P, j] = i(!1), [S, O] = i(!1), R = async () => {
|
|
30
30
|
if (C) {
|
|
31
31
|
O(!0);
|
|
32
32
|
try {
|
|
@@ -57,7 +57,7 @@ function te({
|
|
|
57
57
|
b,
|
|
58
58
|
{
|
|
59
59
|
size: "sm",
|
|
60
|
-
variant: "
|
|
60
|
+
variant: "outline",
|
|
61
61
|
onClick: () => s(!0),
|
|
62
62
|
children: [
|
|
63
63
|
/* @__PURE__ */ e(Z, { className: "mr-ds-02b h-ico-sm w-ico-sm" }),
|
|
@@ -85,10 +85,10 @@ function te({
|
|
|
85
85
|
d,
|
|
86
86
|
{
|
|
87
87
|
value: l.minTier,
|
|
88
|
-
onValueChange: (r) =>
|
|
88
|
+
onValueChange: (r) => x == null ? void 0 : x(l, r),
|
|
89
89
|
children: [
|
|
90
90
|
/* @__PURE__ */ e(o, { className: "h-ds-xs-plus w-[130px] text-ds-sm", children: /* @__PURE__ */ e(m, {}) }),
|
|
91
|
-
/* @__PURE__ */ e(h, { children: Object.entries(G).map(([r, V]) => /* @__PURE__ */ e(
|
|
91
|
+
/* @__PURE__ */ e(h, { children: Object.entries(G).map(([r, V]) => /* @__PURE__ */ e(c, { value: r, children: V }, r)) })
|
|
92
92
|
]
|
|
93
93
|
}
|
|
94
94
|
),
|
|
@@ -98,7 +98,7 @@ function te({
|
|
|
98
98
|
k,
|
|
99
99
|
{
|
|
100
100
|
checked: !l.muted,
|
|
101
|
-
onCheckedChange: () =>
|
|
101
|
+
onCheckedChange: () => u == null ? void 0 : u(l)
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
] }),
|
|
@@ -128,8 +128,8 @@ function te({
|
|
|
128
128
|
/* @__PURE__ */ t(d, { value: N, onValueChange: g, children: [
|
|
129
129
|
/* @__PURE__ */ e(o, { id: "pref-scope", children: /* @__PURE__ */ e(m, { placeholder: "Select scope" }) }),
|
|
130
130
|
/* @__PURE__ */ t(h, { children: [
|
|
131
|
-
/* @__PURE__ */ e(
|
|
132
|
-
v.map((l) => /* @__PURE__ */ e(
|
|
131
|
+
/* @__PURE__ */ e(c, { value: "global", children: "Global (all projects)" }),
|
|
132
|
+
v.map((l) => /* @__PURE__ */ e(c, { value: l.id, children: l.title }, l.id))
|
|
133
133
|
] })
|
|
134
134
|
] })
|
|
135
135
|
] }),
|
|
@@ -138,8 +138,8 @@ function te({
|
|
|
138
138
|
/* @__PURE__ */ t(d, { value: I, onValueChange: w, children: [
|
|
139
139
|
/* @__PURE__ */ e(o, { id: "pref-channel", children: /* @__PURE__ */ e(m, {}) }),
|
|
140
140
|
/* @__PURE__ */ t(h, { children: [
|
|
141
|
-
/* @__PURE__ */ e(
|
|
142
|
-
/* @__PURE__ */ e(
|
|
141
|
+
/* @__PURE__ */ e(c, { value: "IN_APP", children: "In-App" }),
|
|
142
|
+
/* @__PURE__ */ e(c, { value: "GOOGLE_CHAT", children: "Google Chat" })
|
|
143
143
|
] })
|
|
144
144
|
] })
|
|
145
145
|
] }),
|
|
@@ -147,7 +147,7 @@ function te({
|
|
|
147
147
|
/* @__PURE__ */ e("label", { htmlFor: "pref-min-tier", className: "text-ds-sm font-medium text-text-secondary", children: "Minimum Tier" }),
|
|
148
148
|
/* @__PURE__ */ t(d, { value: y, onValueChange: A, children: [
|
|
149
149
|
/* @__PURE__ */ e(o, { id: "pref-min-tier", children: /* @__PURE__ */ e(m, {}) }),
|
|
150
|
-
/* @__PURE__ */ e(h, { children: Object.entries(G).map(([l, n]) => /* @__PURE__ */ e(
|
|
150
|
+
/* @__PURE__ */ e(h, { children: Object.entries(G).map(([l, n]) => /* @__PURE__ */ e(c, { value: l, children: n }, l)) })
|
|
151
151
|
] })
|
|
152
152
|
] }),
|
|
153
153
|
/* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|