@sanity/sanity-id 0.0.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/.turbo/turbo-build.log +32 -0
- package/README.md +272 -0
- package/css/all.css +3 -0
- package/css/colors.css +498 -0
- package/css/tailwind.css +3 -0
- package/css/variables.css +326 -0
- package/dist/Breadcrumbs.js +53 -0
- package/dist/Button.js +50 -0
- package/dist/Card.js +16 -0
- package/dist/Checkbox.js +31 -0
- package/dist/Eyebrow.js +30 -0
- package/dist/IconButton.js +38 -0
- package/dist/Input.js +16 -0
- package/dist/Input.module-P--gA8sq.js +6 -0
- package/dist/Label.js +22 -0
- package/dist/Link-BWIwmuYV.js +4068 -0
- package/dist/LinkCTA.js +53 -0
- package/dist/Radio.js +29 -0
- package/dist/RadioSwitch.js +87 -0
- package/dist/SanityIcon-Bl5or1b8.js +13 -0
- package/dist/Select.js +22 -0
- package/dist/Switch.js +29 -0
- package/dist/TextArea.js +21 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/colors.js +935 -0
- package/dist/styles.css +1 -0
- package/dist/tailwind.js +577 -0
- package/dist/useLinkWithRef-D9NOX6Bd.js +21 -0
- package/dist/utils.js +23 -0
- package/package.json +56 -0
- package/postcss.config.js +6 -0
- package/src/colors.ts +3 -0
- package/src/components/Breadcrumbs.module.css +21 -0
- package/src/components/Breadcrumbs.tsx +38 -0
- package/src/components/Button.module.css +407 -0
- package/src/components/Button.tsx +110 -0
- package/src/components/Card.module.css +19 -0
- package/src/components/Card.tsx +18 -0
- package/src/components/Checkbox.module.css +82 -0
- package/src/components/Checkbox.tsx +38 -0
- package/src/components/Eyebrow.module.css +28 -0
- package/src/components/Eyebrow.tsx +37 -0
- package/src/components/IconButton.module.css +196 -0
- package/src/components/IconButton.tsx +62 -0
- package/src/components/Input.module.css +55 -0
- package/src/components/Input.tsx +23 -0
- package/src/components/Label.module.css +53 -0
- package/src/components/Label.tsx +33 -0
- package/src/components/LinkCTA.module.css +122 -0
- package/src/components/LinkCTA.tsx +77 -0
- package/src/components/Radio.module.css +91 -0
- package/src/components/Radio.tsx +33 -0
- package/src/components/RadioSwitch.module.css +125 -0
- package/src/components/RadioSwitch.tsx +122 -0
- package/src/components/Select.module.css +35 -0
- package/src/components/Select.tsx +28 -0
- package/src/components/Switch.module.css +112 -0
- package/src/components/Switch.tsx +33 -0
- package/src/components/TextArea.module.css +17 -0
- package/src/components/TextArea.tsx +30 -0
- package/src/components/helpers/AddRefParam.tsx +29 -0
- package/src/components/helpers/Link.tsx +56 -0
- package/src/components/helpers/NavLink.tsx +20 -0
- package/src/components/helpers/SanityIcon.tsx +25 -0
- package/src/components/helpers/useIsCurrentPage.ts +39 -0
- package/src/components/helpers/useLinkWithRef.ts +27 -0
- package/src/components/helpers/useSafePathname.ts +17 -0
- package/src/css.d.ts +4 -0
- package/src/tailwind.ts +408 -0
- package/src/tokens/dynamic-colors.ts +154 -0
- package/src/tokens/primitive-colors.ts +237 -0
- package/src/tokens/semantic-colors.ts +574 -0
- package/src/utils.ts +58 -0
- package/tailwind.config.ts +7 -0
- package/tsconfig.json +17 -0
- package/vite.config.ts +29 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @sanity/sanity-id@0.0.0 build /Users/mitchell/Repositories/sanity-www/packages/sanity-id
|
|
4
|
+
> vite build
|
|
5
|
+
|
|
6
|
+
[36mvite v7.1.3 [32mbuilding for production...[36m[39m
|
|
7
|
+
[2K[1Gtransforming (1) [2msrc/colors.ts[22m[2K[1Gtransforming (44) [2mpackage.json[22m[2K[1Gtransforming (107) [2m../../node_modules/.pnpm/next@15.3.3_@babel+core@7.28.3_@opentelemetry+api@1.9.0_@playwright+test@1.50.1_react-dom@19._ki6fcgyjmd4bfmur66busazeo[2K[1G[32m✓[39m 212 modules transformed.
|
|
8
|
+
[2K[1Grendering chunks (1)...[2K[1Grendering chunks (2)...[2K[1Grendering chunks (3)...[2K[1Grendering chunks (4)...[2K[1Grendering chunks (5)...[2K[1Grendering chunks (6)...[2K[1Grendering chunks (7)...[2K[1Grendering chunks (8)...[2K[1Grendering chunks (9)...[2K[1Grendering chunks (10)...[2K[1Grendering chunks (11)...[2K[1Grendering chunks (12)...[2K[1Grendering chunks (13)...[2K[1Grendering chunks (14)...[2K[1Grendering chunks (15)...[2K[1Grendering chunks (16)...[2K[1Grendering chunks (17)...[2K[1Grendering chunks (18)...[2K[1Grendering chunks (19)...[2K[1Grendering chunks (20)...[2K[1Grendering chunks (21)...[2K[1Grendering chunks (22)...[2K[1Grendering chunks (23)...[2K[1G[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1Gcomputing gzip size (2)...[2K[1Gcomputing gzip size (3)...[2K[1Gcomputing gzip size (4)...[2K[1Gcomputing gzip size (5)...[2K[1Gcomputing gzip size (6)...[2K[1Gcomputing gzip size (7)...[2K[1Gcomputing gzip size (8)...[2K[1Gcomputing gzip size (9)...[2K[1Gcomputing gzip size (10)...[2K[1Gcomputing gzip size (11)...[2K[1Gcomputing gzip size (12)...[2K[1Gcomputing gzip size (13)...[2K[1Gcomputing gzip size (14)...[2K[1Gcomputing gzip size (15)...[2K[1Gcomputing gzip size (16)...[2K[1Gcomputing gzip size (17)...[2K[1Gcomputing gzip size (18)...[2K[1Gcomputing gzip size (19)...[2K[1Gcomputing gzip size (20)...[2K[1Gcomputing gzip size (21)...[2K[1Gcomputing gzip size (22)...[2K[1Gcomputing gzip size (23)...[2K[1Gcomputing gzip size (24)...[2K[1G[2mdist/[22m[35mstyles.css [39m[1m[2m 89.81 kB[22m[1m[22m[2m │ gzip: 7.83 kB[22m
|
|
9
|
+
[2mdist/[22m[36mInput.module-P--gA8sq.js [39m[1m[2m 0.06 kB[22m[1m[22m[2m │ gzip: 0.07 kB[22m
|
|
10
|
+
[2mdist/[22m[36m_commonjsHelpers-C6fGbg64.js [39m[1m[2m 0.14 kB[22m[1m[22m[2m │ gzip: 0.14 kB[22m
|
|
11
|
+
[2mdist/[22m[36mInput.js [39m[1m[2m 0.35 kB[22m[1m[22m[2m │ gzip: 0.25 kB[22m
|
|
12
|
+
[2mdist/[22m[36mCard.js [39m[1m[2m 0.36 kB[22m[1m[22m[2m │ gzip: 0.25 kB[22m
|
|
13
|
+
[2mdist/[22m[36mSanityIcon-Bl5or1b8.js [39m[1m[2m 0.47 kB[22m[1m[22m[2m │ gzip: 0.32 kB[22m
|
|
14
|
+
[2mdist/[22m[36mLabel.js [39m[1m[2m 0.48 kB[22m[1m[22m[2m │ gzip: 0.32 kB[22m
|
|
15
|
+
[2mdist/[22m[36mTextArea.js [39m[1m[2m 0.50 kB[22m[1m[22m[2m │ gzip: 0.33 kB[22m
|
|
16
|
+
[2mdist/[22m[36mclsx-OuTLNxxd.js [39m[1m[2m 0.51 kB[22m[1m[22m[2m │ gzip: 0.27 kB[22m
|
|
17
|
+
[2mdist/[22m[36museLinkWithRef-D9NOX6Bd.js [39m[1m[2m 0.64 kB[22m[1m[22m[2m │ gzip: 0.39 kB[22m
|
|
18
|
+
[2mdist/[22m[36mSelect.js [39m[1m[2m 0.69 kB[22m[1m[22m[2m │ gzip: 0.38 kB[22m
|
|
19
|
+
[2mdist/[22m[36mRadio.js [39m[1m[2m 0.71 kB[22m[1m[22m[2m │ gzip: 0.37 kB[22m
|
|
20
|
+
[2mdist/[22m[36mSwitch.js [39m[1m[2m 0.72 kB[22m[1m[22m[2m │ gzip: 0.37 kB[22m
|
|
21
|
+
[2mdist/[22m[36mEyebrow.js [39m[1m[2m 0.72 kB[22m[1m[22m[2m │ gzip: 0.39 kB[22m
|
|
22
|
+
[2mdist/[22m[36mCheckbox.js [39m[1m[2m 0.92 kB[22m[1m[22m[2m │ gzip: 0.45 kB[22m
|
|
23
|
+
[2mdist/[22m[36mIconButton.js [39m[1m[2m 0.99 kB[22m[1m[22m[2m │ gzip: 0.51 kB[22m
|
|
24
|
+
[2mdist/[22m[36mutils.js [39m[1m[2m 1.01 kB[22m[1m[22m[2m │ gzip: 0.64 kB[22m
|
|
25
|
+
[2mdist/[22m[36mButton.js [39m[1m[2m 1.56 kB[22m[1m[22m[2m │ gzip: 0.71 kB[22m
|
|
26
|
+
[2mdist/[22m[36mBreadcrumbs.js [39m[1m[2m 1.56 kB[22m[1m[22m[2m │ gzip: 0.69 kB[22m
|
|
27
|
+
[2mdist/[22m[36mLinkCTA.js [39m[1m[2m 1.70 kB[22m[1m[22m[2m │ gzip: 0.72 kB[22m
|
|
28
|
+
[2mdist/[22m[36mRadioSwitch.js [39m[1m[2m 2.40 kB[22m[1m[22m[2m │ gzip: 1.03 kB[22m
|
|
29
|
+
[2mdist/[22m[36mtailwind.js [39m[1m[2m 20.40 kB[22m[1m[22m[2m │ gzip: 4.04 kB[22m
|
|
30
|
+
[2mdist/[22m[36mcolors.js [39m[1m[2m 21.48 kB[22m[1m[22m[2m │ gzip: 3.88 kB[22m
|
|
31
|
+
[2mdist/[22m[36mLink-BWIwmuYV.js [39m[1m[2m137.58 kB[22m[1m[22m[2m │ gzip: 30.47 kB[22m
|
|
32
|
+
[32m✓ built in 1.05s[39m
|
package/README.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# @sanity/sanity-id
|
|
2
|
+
|
|
3
|
+
A Tailwind CSS configuration package that provides Sanity's design system
|
|
4
|
+
tokens, colors, and utilities.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @sanity/sanity-id
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Basic Setup
|
|
15
|
+
|
|
16
|
+
Create or update your `tailwind.config.ts` file:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createConfig } from "@sanity/sanity-id"
|
|
20
|
+
|
|
21
|
+
export default createConfig({
|
|
22
|
+
content: [
|
|
23
|
+
// Add your content paths here
|
|
24
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
25
|
+
],
|
|
26
|
+
// Optional: extend or override the base configuration
|
|
27
|
+
theme: {
|
|
28
|
+
extend: {
|
|
29
|
+
// Your custom theme extensions
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### TypeScript Configuration
|
|
36
|
+
|
|
37
|
+
For proper TypeScript resolution, add the following to your `tsconfig.json`:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"compilerOptions": {
|
|
42
|
+
"baseUrl": ".",
|
|
43
|
+
"paths": {
|
|
44
|
+
"@sanity/sanity-id": ["../../packages/sanity-id/src"],
|
|
45
|
+
"@sanity/sanity-id/*": ["../../packages/sanity-id/src/*"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Font Setup
|
|
52
|
+
|
|
53
|
+
The package expects certain font variables to be defined. Here's how to set them
|
|
54
|
+
up using Next.js Font:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import Local from "next/font/local"
|
|
58
|
+
|
|
59
|
+
const inter = Local({
|
|
60
|
+
display: "swap",
|
|
61
|
+
variable: "--font-sans",
|
|
62
|
+
fallback: ["ui-sans-serif", "system-ui", "sans-serif"],
|
|
63
|
+
src: [
|
|
64
|
+
{
|
|
65
|
+
path: "../assets/fonts/inter-variable.woff2",
|
|
66
|
+
weight: "100 900",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
path: "../assets/fonts/inter-italic-variable.woff2",
|
|
70
|
+
style: "italic",
|
|
71
|
+
weight: "100 900",
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const jetBrainsMono = Local({
|
|
77
|
+
src: "../assets/fonts/jetbrains-mono-variable.woff2",
|
|
78
|
+
display: "swap",
|
|
79
|
+
variable: "--font-mono",
|
|
80
|
+
fallback: ["ui-monospace", "monospace"],
|
|
81
|
+
weight: "100 900",
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
export const fontsClassName = [
|
|
85
|
+
inter.variable,
|
|
86
|
+
interItalic.variable,
|
|
87
|
+
jetBrainsMono.variable,
|
|
88
|
+
].join(" ")
|
|
89
|
+
|
|
90
|
+
// Apply fonts to your app
|
|
91
|
+
export default function RootLayout({
|
|
92
|
+
children,
|
|
93
|
+
}: {
|
|
94
|
+
children: React.ReactNode
|
|
95
|
+
}) {
|
|
96
|
+
return (
|
|
97
|
+
<html className={fontsClassName}>
|
|
98
|
+
<body>{children}</body>
|
|
99
|
+
</html>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Required font variables:
|
|
105
|
+
|
|
106
|
+
- `--font-sans`: Main sans-serif font
|
|
107
|
+
- `--font-mono`: Monospace font for code blocks
|
|
108
|
+
|
|
109
|
+
### Import CSS
|
|
110
|
+
|
|
111
|
+
Import the base styles in your main CSS file:
|
|
112
|
+
|
|
113
|
+
```css
|
|
114
|
+
@import "@sanity/sanity-id/all.css";
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Using Components
|
|
118
|
+
|
|
119
|
+
Import components directly from their paths:
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import { Button } from "@sanity/sanity-id/components/button"
|
|
123
|
+
import { Card } from "@sanity/sanity-id/components/card"
|
|
124
|
+
import { Dialog } from "@sanity/sanity-id/components/dialog"
|
|
125
|
+
|
|
126
|
+
function MyComponent() {
|
|
127
|
+
return (
|
|
128
|
+
<Card>
|
|
129
|
+
<Dialog>
|
|
130
|
+
<Button>Click me</Button>
|
|
131
|
+
</Dialog>
|
|
132
|
+
</Card>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Theme Support
|
|
138
|
+
|
|
139
|
+
The package supports light and dark themes through HTML data attributes:
|
|
140
|
+
|
|
141
|
+
```html
|
|
142
|
+
<!-- Light theme (default) -->
|
|
143
|
+
<html data-theme="light">
|
|
144
|
+
<!-- Dark theme -->
|
|
145
|
+
<html data-theme="dark"></html>
|
|
146
|
+
</html>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Theme Support
|
|
150
|
+
|
|
151
|
+
Theme-dependent variables require a theme provider to work correctly. You can
|
|
152
|
+
use next-themes:
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
import { ThemeProvider } from "next-themes"
|
|
156
|
+
|
|
157
|
+
export default function RootLayout({
|
|
158
|
+
children,
|
|
159
|
+
}: {
|
|
160
|
+
children: React.ReactNode
|
|
161
|
+
}) {
|
|
162
|
+
return (
|
|
163
|
+
<html>
|
|
164
|
+
<ThemeProvider attribute="data-theme">
|
|
165
|
+
<body>{children}</body>
|
|
166
|
+
</ThemeProvider>
|
|
167
|
+
</html>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Alternatively, you can hardcode the theme in your layout:
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
export default function RootLayout({
|
|
176
|
+
children,
|
|
177
|
+
}: {
|
|
178
|
+
children: React.ReactNode
|
|
179
|
+
}) {
|
|
180
|
+
return (
|
|
181
|
+
<html data-theme="light">
|
|
182
|
+
<body>{children}</body>
|
|
183
|
+
</html>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The package supports light and dark themes through HTML data attributes:
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<!-- Light theme (default) -->
|
|
192
|
+
<html data-theme="light">
|
|
193
|
+
<!-- Dark theme -->
|
|
194
|
+
<html data-theme="dark"></html>
|
|
195
|
+
</html>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Color System
|
|
199
|
+
|
|
200
|
+
The package provides three types of colors:
|
|
201
|
+
|
|
202
|
+
1. Primitive colors (static)
|
|
203
|
+
2. Dynamic colors (theme-aware)
|
|
204
|
+
3. Semantic colors (context-specific)
|
|
205
|
+
|
|
206
|
+
Example usage:
|
|
207
|
+
|
|
208
|
+
```jsx
|
|
209
|
+
// Using primitive colors
|
|
210
|
+
<div className="bg-gray-100">
|
|
211
|
+
|
|
212
|
+
// Using dynamic colors
|
|
213
|
+
<div className="bg-gray-100-dynamic">
|
|
214
|
+
|
|
215
|
+
// Using semantic colors
|
|
216
|
+
<div className="bg-bg-base text-fg-base">
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Typography Classes
|
|
220
|
+
|
|
221
|
+
The package includes predefined typography classes:
|
|
222
|
+
|
|
223
|
+
```jsx
|
|
224
|
+
// Page headings
|
|
225
|
+
<h1 className="page-heading-lg">
|
|
226
|
+
<h2 className="page-heading-md">
|
|
227
|
+
<h3 className="page-heading-sm">
|
|
228
|
+
|
|
229
|
+
// Component headings
|
|
230
|
+
<h4 className="component-heading-lg">
|
|
231
|
+
<h5 className="component-heading-md">
|
|
232
|
+
<h6 className="component-heading-sm">
|
|
233
|
+
|
|
234
|
+
// Text styles
|
|
235
|
+
<p className="text-description">
|
|
236
|
+
<p className="text-prose">
|
|
237
|
+
<p className="text-lede">
|
|
238
|
+
|
|
239
|
+
// Interactive text
|
|
240
|
+
<span className="text-interactive-lg">
|
|
241
|
+
<span className="text-interactive-md">
|
|
242
|
+
<span className="text-interactive-sm">
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Custom Variants
|
|
246
|
+
|
|
247
|
+
The package includes custom Tailwind variants:
|
|
248
|
+
|
|
249
|
+
```jsx
|
|
250
|
+
// Light theme specific styles
|
|
251
|
+
<div className="@light:bg-white">
|
|
252
|
+
|
|
253
|
+
// Dark theme specific styles
|
|
254
|
+
<div className="@dark:bg-black">
|
|
255
|
+
|
|
256
|
+
// Touch device specific styles
|
|
257
|
+
<div className="touch:hover:bg-transparent">
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Development
|
|
261
|
+
|
|
262
|
+
### Building Color Tokens
|
|
263
|
+
|
|
264
|
+
To rebuild the color tokens:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
npm run build:colors
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## License
|
|
271
|
+
|
|
272
|
+
Private - Internal use only
|
package/css/all.css
ADDED