@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.
Files changed (77) hide show
  1. package/.turbo/turbo-build.log +32 -0
  2. package/README.md +272 -0
  3. package/css/all.css +3 -0
  4. package/css/colors.css +498 -0
  5. package/css/tailwind.css +3 -0
  6. package/css/variables.css +326 -0
  7. package/dist/Breadcrumbs.js +53 -0
  8. package/dist/Button.js +50 -0
  9. package/dist/Card.js +16 -0
  10. package/dist/Checkbox.js +31 -0
  11. package/dist/Eyebrow.js +30 -0
  12. package/dist/IconButton.js +38 -0
  13. package/dist/Input.js +16 -0
  14. package/dist/Input.module-P--gA8sq.js +6 -0
  15. package/dist/Label.js +22 -0
  16. package/dist/Link-BWIwmuYV.js +4068 -0
  17. package/dist/LinkCTA.js +53 -0
  18. package/dist/Radio.js +29 -0
  19. package/dist/RadioSwitch.js +87 -0
  20. package/dist/SanityIcon-Bl5or1b8.js +13 -0
  21. package/dist/Select.js +22 -0
  22. package/dist/Switch.js +29 -0
  23. package/dist/TextArea.js +21 -0
  24. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  25. package/dist/clsx-OuTLNxxd.js +16 -0
  26. package/dist/colors.js +935 -0
  27. package/dist/styles.css +1 -0
  28. package/dist/tailwind.js +577 -0
  29. package/dist/useLinkWithRef-D9NOX6Bd.js +21 -0
  30. package/dist/utils.js +23 -0
  31. package/package.json +56 -0
  32. package/postcss.config.js +6 -0
  33. package/src/colors.ts +3 -0
  34. package/src/components/Breadcrumbs.module.css +21 -0
  35. package/src/components/Breadcrumbs.tsx +38 -0
  36. package/src/components/Button.module.css +407 -0
  37. package/src/components/Button.tsx +110 -0
  38. package/src/components/Card.module.css +19 -0
  39. package/src/components/Card.tsx +18 -0
  40. package/src/components/Checkbox.module.css +82 -0
  41. package/src/components/Checkbox.tsx +38 -0
  42. package/src/components/Eyebrow.module.css +28 -0
  43. package/src/components/Eyebrow.tsx +37 -0
  44. package/src/components/IconButton.module.css +196 -0
  45. package/src/components/IconButton.tsx +62 -0
  46. package/src/components/Input.module.css +55 -0
  47. package/src/components/Input.tsx +23 -0
  48. package/src/components/Label.module.css +53 -0
  49. package/src/components/Label.tsx +33 -0
  50. package/src/components/LinkCTA.module.css +122 -0
  51. package/src/components/LinkCTA.tsx +77 -0
  52. package/src/components/Radio.module.css +91 -0
  53. package/src/components/Radio.tsx +33 -0
  54. package/src/components/RadioSwitch.module.css +125 -0
  55. package/src/components/RadioSwitch.tsx +122 -0
  56. package/src/components/Select.module.css +35 -0
  57. package/src/components/Select.tsx +28 -0
  58. package/src/components/Switch.module.css +112 -0
  59. package/src/components/Switch.tsx +33 -0
  60. package/src/components/TextArea.module.css +17 -0
  61. package/src/components/TextArea.tsx +30 -0
  62. package/src/components/helpers/AddRefParam.tsx +29 -0
  63. package/src/components/helpers/Link.tsx +56 -0
  64. package/src/components/helpers/NavLink.tsx +20 -0
  65. package/src/components/helpers/SanityIcon.tsx +25 -0
  66. package/src/components/helpers/useIsCurrentPage.ts +39 -0
  67. package/src/components/helpers/useLinkWithRef.ts +27 -0
  68. package/src/components/helpers/useSafePathname.ts +17 -0
  69. package/src/css.d.ts +4 -0
  70. package/src/tailwind.ts +408 -0
  71. package/src/tokens/dynamic-colors.ts +154 -0
  72. package/src/tokens/primitive-colors.ts +237 -0
  73. package/src/tokens/semantic-colors.ts +574 -0
  74. package/src/utils.ts +58 -0
  75. package/tailwind.config.ts +7 -0
  76. package/tsconfig.json +17 -0
  77. 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
+ vite v7.1.3 building for production...
7
+ transforming (1) src/colors.tstransforming (44) package.jsontransforming (107) ../../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✓ 212 modules transformed.
8
+ rendering chunks (1)...rendering chunks (2)...rendering chunks (3)...rendering chunks (4)...rendering chunks (5)...rendering chunks (6)...rendering chunks (7)...rendering chunks (8)...rendering chunks (9)...rendering chunks (10)...rendering chunks (11)...rendering chunks (12)...rendering chunks (13)...rendering chunks (14)...rendering chunks (15)...rendering chunks (16)...rendering chunks (17)...rendering chunks (18)...rendering chunks (19)...rendering chunks (20)...rendering chunks (21)...rendering chunks (22)...rendering chunks (23)...computing gzip size (0)...computing gzip size (1)...computing gzip size (2)...computing gzip size (3)...computing gzip size (4)...computing gzip size (5)...computing gzip size (6)...computing gzip size (7)...computing gzip size (8)...computing gzip size (9)...computing gzip size (10)...computing gzip size (11)...computing gzip size (12)...computing gzip size (13)...computing gzip size (14)...computing gzip size (15)...computing gzip size (16)...computing gzip size (17)...computing gzip size (18)...computing gzip size (19)...computing gzip size (20)...computing gzip size (21)...computing gzip size (22)...computing gzip size (23)...computing gzip size (24)...dist/styles.css  89.81 kB │ gzip: 7.83 kB
9
+ dist/Input.module-P--gA8sq.js  0.06 kB │ gzip: 0.07 kB
10
+ dist/_commonjsHelpers-C6fGbg64.js  0.14 kB │ gzip: 0.14 kB
11
+ dist/Input.js  0.35 kB │ gzip: 0.25 kB
12
+ dist/Card.js  0.36 kB │ gzip: 0.25 kB
13
+ dist/SanityIcon-Bl5or1b8.js  0.47 kB │ gzip: 0.32 kB
14
+ dist/Label.js  0.48 kB │ gzip: 0.32 kB
15
+ dist/TextArea.js  0.50 kB │ gzip: 0.33 kB
16
+ dist/clsx-OuTLNxxd.js  0.51 kB │ gzip: 0.27 kB
17
+ dist/useLinkWithRef-D9NOX6Bd.js  0.64 kB │ gzip: 0.39 kB
18
+ dist/Select.js  0.69 kB │ gzip: 0.38 kB
19
+ dist/Radio.js  0.71 kB │ gzip: 0.37 kB
20
+ dist/Switch.js  0.72 kB │ gzip: 0.37 kB
21
+ dist/Eyebrow.js  0.72 kB │ gzip: 0.39 kB
22
+ dist/Checkbox.js  0.92 kB │ gzip: 0.45 kB
23
+ dist/IconButton.js  0.99 kB │ gzip: 0.51 kB
24
+ dist/utils.js  1.01 kB │ gzip: 0.64 kB
25
+ dist/Button.js  1.56 kB │ gzip: 0.71 kB
26
+ dist/Breadcrumbs.js  1.56 kB │ gzip: 0.69 kB
27
+ dist/LinkCTA.js  1.70 kB │ gzip: 0.72 kB
28
+ dist/RadioSwitch.js  2.40 kB │ gzip: 1.03 kB
29
+ dist/tailwind.js  20.40 kB │ gzip: 4.04 kB
30
+ dist/colors.js  21.48 kB │ gzip: 3.88 kB
31
+ dist/Link-BWIwmuYV.js 137.58 kB │ gzip: 30.47 kB
32
+ ✓ built in 1.05s
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
@@ -0,0 +1,3 @@
1
+ @import url("./colors.css");
2
+ @import url("./tailwind.css");
3
+ @import url("./variables.css");