@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,574 @@
|
|
|
1
|
+
import { type PrimitiveColor, primitiveColors } from "./primitive-colors"
|
|
2
|
+
|
|
3
|
+
export type SemanticColor = {
|
|
4
|
+
name: string
|
|
5
|
+
variable: string
|
|
6
|
+
light: PrimitiveColor
|
|
7
|
+
dark: PrimitiveColor
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const semanticColors = {
|
|
11
|
+
fgStrong: color({
|
|
12
|
+
name: "fg-strong",
|
|
13
|
+
light: primitiveColors.black,
|
|
14
|
+
dark: primitiveColors.gray50,
|
|
15
|
+
}),
|
|
16
|
+
fgBase: color({
|
|
17
|
+
name: "fg-base",
|
|
18
|
+
light: primitiveColors.gray900,
|
|
19
|
+
dark: primitiveColors.gray200,
|
|
20
|
+
}),
|
|
21
|
+
fgDim: color({
|
|
22
|
+
name: "fg-dim",
|
|
23
|
+
light: primitiveColors.gray600,
|
|
24
|
+
dark: primitiveColors.gray400,
|
|
25
|
+
}),
|
|
26
|
+
fgFaint: color({
|
|
27
|
+
name: "fg-faint",
|
|
28
|
+
light: primitiveColors.gray500,
|
|
29
|
+
dark: primitiveColors.gray600,
|
|
30
|
+
}),
|
|
31
|
+
fgInverseStrong: color({
|
|
32
|
+
name: "fg-inverse-strong",
|
|
33
|
+
light: primitiveColors.white,
|
|
34
|
+
dark: primitiveColors.black,
|
|
35
|
+
}),
|
|
36
|
+
fgInverseBase: color({
|
|
37
|
+
name: "fg-inverse-base",
|
|
38
|
+
light: primitiveColors.gray200,
|
|
39
|
+
dark: primitiveColors.gray900,
|
|
40
|
+
}),
|
|
41
|
+
fgInverseDim: color({
|
|
42
|
+
name: "fg-inverse-dim",
|
|
43
|
+
light: primitiveColors.gray300,
|
|
44
|
+
dark: primitiveColors.gray700,
|
|
45
|
+
}),
|
|
46
|
+
fgBrandStrong: color({
|
|
47
|
+
name: "fg-brand-strong",
|
|
48
|
+
light: primitiveColors.red700,
|
|
49
|
+
dark: primitiveColors.red300,
|
|
50
|
+
}),
|
|
51
|
+
fgBrandBase: color({
|
|
52
|
+
name: "fg-brand-base",
|
|
53
|
+
light: primitiveColors.red500,
|
|
54
|
+
dark: primitiveColors.red500,
|
|
55
|
+
}),
|
|
56
|
+
fgAccentStrong: color({
|
|
57
|
+
name: "fg-accent-strong",
|
|
58
|
+
light: primitiveColors.cyan800,
|
|
59
|
+
dark: primitiveColors.cyan300,
|
|
60
|
+
}),
|
|
61
|
+
fgAccentBase: color({
|
|
62
|
+
name: "fg-accent-base",
|
|
63
|
+
light: primitiveColors.cyan700,
|
|
64
|
+
dark: primitiveColors.cyan400,
|
|
65
|
+
}),
|
|
66
|
+
fgAccentDim: color({
|
|
67
|
+
name: "fg-accent-dim",
|
|
68
|
+
light: primitiveColors.cyan600,
|
|
69
|
+
dark: primitiveColors.cyan500,
|
|
70
|
+
}),
|
|
71
|
+
fgUpsellStrong: color({
|
|
72
|
+
name: "fg-upsell-strong",
|
|
73
|
+
light: primitiveColors.purple800,
|
|
74
|
+
dark: primitiveColors.purple200,
|
|
75
|
+
}),
|
|
76
|
+
fgUpsellBase: color({
|
|
77
|
+
name: "fg-upsell-base",
|
|
78
|
+
light: primitiveColors.purple600,
|
|
79
|
+
dark: primitiveColors.purple400,
|
|
80
|
+
}),
|
|
81
|
+
fgUpsellDim: color({
|
|
82
|
+
name: "fg-upsell-dim",
|
|
83
|
+
light: primitiveColors.purple500,
|
|
84
|
+
dark: primitiveColors.purple500,
|
|
85
|
+
}),
|
|
86
|
+
fgWarningStrong: color({
|
|
87
|
+
name: "fg-warning-strong",
|
|
88
|
+
light: primitiveColors.yellow800,
|
|
89
|
+
dark: primitiveColors.yellow100,
|
|
90
|
+
}),
|
|
91
|
+
fgWarningBase: color({
|
|
92
|
+
name: "fg-warning-base",
|
|
93
|
+
light: primitiveColors.yellow600,
|
|
94
|
+
dark: primitiveColors.yellow400,
|
|
95
|
+
}),
|
|
96
|
+
bgStrong: color({
|
|
97
|
+
name: "bg-strong",
|
|
98
|
+
light: primitiveColors.white,
|
|
99
|
+
dark: primitiveColors.black,
|
|
100
|
+
}),
|
|
101
|
+
bgBase: color({
|
|
102
|
+
name: "bg-base",
|
|
103
|
+
light: primitiveColors.gray50,
|
|
104
|
+
dark: primitiveColors.gray950,
|
|
105
|
+
}),
|
|
106
|
+
bgDim: color({
|
|
107
|
+
name: "bg-dim",
|
|
108
|
+
light: primitiveColors.gray100,
|
|
109
|
+
dark: primitiveColors.gray900,
|
|
110
|
+
}),
|
|
111
|
+
bgInverseStrong: color({
|
|
112
|
+
name: "bg-inverse-strong",
|
|
113
|
+
light: primitiveColors.black,
|
|
114
|
+
dark: primitiveColors.white,
|
|
115
|
+
}),
|
|
116
|
+
bgInverseBase: color({
|
|
117
|
+
name: "bg-inverse-base",
|
|
118
|
+
light: primitiveColors.gray950,
|
|
119
|
+
dark: primitiveColors.gray50,
|
|
120
|
+
}),
|
|
121
|
+
bgBrandBase: color({
|
|
122
|
+
name: "bg-brand-base",
|
|
123
|
+
light: primitiveColors.red500,
|
|
124
|
+
dark: primitiveColors.red500,
|
|
125
|
+
}),
|
|
126
|
+
bgBrandDim: color({
|
|
127
|
+
name: "bg-brand-dim",
|
|
128
|
+
light: primitiveColors.red200,
|
|
129
|
+
dark: primitiveColors.red900,
|
|
130
|
+
}),
|
|
131
|
+
bgAccentStrong: color({
|
|
132
|
+
name: "bg-accent-strong",
|
|
133
|
+
light: primitiveColors.cyan400,
|
|
134
|
+
dark: primitiveColors.cyan600,
|
|
135
|
+
}),
|
|
136
|
+
bgAccentBase: color({
|
|
137
|
+
name: "bg-accent-base",
|
|
138
|
+
light: primitiveColors.cyan200,
|
|
139
|
+
dark: primitiveColors.cyan800,
|
|
140
|
+
}),
|
|
141
|
+
bgAccentDim: color({
|
|
142
|
+
name: "bg-accent-dim",
|
|
143
|
+
light: primitiveColors.cyan100,
|
|
144
|
+
dark: primitiveColors.cyan900,
|
|
145
|
+
}),
|
|
146
|
+
bgUpsellStrong: color({
|
|
147
|
+
name: "bg-upsell-strong",
|
|
148
|
+
light: primitiveColors.purple400,
|
|
149
|
+
dark: primitiveColors.purple600,
|
|
150
|
+
}),
|
|
151
|
+
bgUpsellBase: color({
|
|
152
|
+
name: "bg-upsell-base",
|
|
153
|
+
light: primitiveColors.purple200,
|
|
154
|
+
dark: primitiveColors.purple800,
|
|
155
|
+
}),
|
|
156
|
+
bgUpsellDim: color({
|
|
157
|
+
name: "bg-upsell-dim",
|
|
158
|
+
light: primitiveColors.purple100,
|
|
159
|
+
dark: primitiveColors.purple900,
|
|
160
|
+
}),
|
|
161
|
+
bgWarningSubtle: color({
|
|
162
|
+
name: "bg-warning-subtle",
|
|
163
|
+
light: primitiveColors.yellow50,
|
|
164
|
+
dark: primitiveColors.yellow900,
|
|
165
|
+
}),
|
|
166
|
+
borderStrong: color({
|
|
167
|
+
name: "border-strong",
|
|
168
|
+
light: primitiveColors.gray400,
|
|
169
|
+
dark: primitiveColors.gray600,
|
|
170
|
+
}),
|
|
171
|
+
borderBase: color({
|
|
172
|
+
name: "border-base",
|
|
173
|
+
light: primitiveColors.gray300,
|
|
174
|
+
dark: primitiveColors.gray700,
|
|
175
|
+
}),
|
|
176
|
+
borderSubtle: color({
|
|
177
|
+
name: "border-subtle",
|
|
178
|
+
light: primitiveColors.gray200,
|
|
179
|
+
dark: primitiveColors.gray800,
|
|
180
|
+
}),
|
|
181
|
+
borderHairline: color({
|
|
182
|
+
name: "border-hairline",
|
|
183
|
+
light: primitiveColors.gray100,
|
|
184
|
+
dark: primitiveColors.gray900,
|
|
185
|
+
}),
|
|
186
|
+
borderInverse: color({
|
|
187
|
+
name: "border-inverse",
|
|
188
|
+
light: primitiveColors.black,
|
|
189
|
+
dark: primitiveColors.white,
|
|
190
|
+
}),
|
|
191
|
+
borderBrandStrong: color({
|
|
192
|
+
name: "border-brand-strong",
|
|
193
|
+
light: primitiveColors.red500,
|
|
194
|
+
dark: primitiveColors.red500,
|
|
195
|
+
}),
|
|
196
|
+
borderBrandBase: color({
|
|
197
|
+
name: "border-brand-base",
|
|
198
|
+
light: primitiveColors.red300,
|
|
199
|
+
dark: primitiveColors.red700,
|
|
200
|
+
}),
|
|
201
|
+
borderBrandDim: color({
|
|
202
|
+
name: "border-brand-dim",
|
|
203
|
+
light: primitiveColors.red200,
|
|
204
|
+
dark: primitiveColors.red800,
|
|
205
|
+
}),
|
|
206
|
+
borderAccentStrong: color({
|
|
207
|
+
name: "border-accent-strong",
|
|
208
|
+
light: primitiveColors.cyan400,
|
|
209
|
+
dark: primitiveColors.cyan400,
|
|
210
|
+
}),
|
|
211
|
+
borderAccentBase: color({
|
|
212
|
+
name: "border-accent-base",
|
|
213
|
+
light: primitiveColors.cyan300,
|
|
214
|
+
dark: primitiveColors.cyan700,
|
|
215
|
+
}),
|
|
216
|
+
borderAccentDim: color({
|
|
217
|
+
name: "border-accent-dim",
|
|
218
|
+
light: primitiveColors.cyan200,
|
|
219
|
+
dark: primitiveColors.cyan800,
|
|
220
|
+
}),
|
|
221
|
+
borderUpsellStrong: color({
|
|
222
|
+
name: "border-upsell-strong",
|
|
223
|
+
light: primitiveColors.purple400,
|
|
224
|
+
dark: primitiveColors.purple400,
|
|
225
|
+
}),
|
|
226
|
+
borderUpsellBase: color({
|
|
227
|
+
name: "border-upsell-base",
|
|
228
|
+
light: primitiveColors.purple300,
|
|
229
|
+
dark: primitiveColors.purple700,
|
|
230
|
+
}),
|
|
231
|
+
borderUpsellDim: color({
|
|
232
|
+
name: "border-upsell-dim",
|
|
233
|
+
light: primitiveColors.purple200,
|
|
234
|
+
dark: primitiveColors.purple800,
|
|
235
|
+
}),
|
|
236
|
+
buttonFocusRing: color({
|
|
237
|
+
name: "button-focus-ring",
|
|
238
|
+
light: primitiveColors.black,
|
|
239
|
+
dark: primitiveColors.white,
|
|
240
|
+
}),
|
|
241
|
+
buttonFocusSpace: color({
|
|
242
|
+
name: "button-focus-space",
|
|
243
|
+
light: primitiveColors.gray50,
|
|
244
|
+
dark: primitiveColors.gray950,
|
|
245
|
+
}),
|
|
246
|
+
buttonBgDefault: color({
|
|
247
|
+
name: "button-bg-default",
|
|
248
|
+
light: primitiveColors.gray50,
|
|
249
|
+
dark: primitiveColors.gray950,
|
|
250
|
+
}),
|
|
251
|
+
buttonBgDefaultPrimary: color({
|
|
252
|
+
name: "button-bg-default-primary",
|
|
253
|
+
light: primitiveColors.gray100,
|
|
254
|
+
dark: primitiveColors.gray900,
|
|
255
|
+
}),
|
|
256
|
+
buttonBgHover: color({
|
|
257
|
+
name: "button-bg-hover",
|
|
258
|
+
light: primitiveColors.white,
|
|
259
|
+
dark: primitiveColors.black,
|
|
260
|
+
}),
|
|
261
|
+
buttonBgActive: color({
|
|
262
|
+
name: "button-bg-active",
|
|
263
|
+
light: primitiveColors.gray200,
|
|
264
|
+
dark: primitiveColors.gray800,
|
|
265
|
+
}),
|
|
266
|
+
buttonBgInverseDefault: color({
|
|
267
|
+
name: "button-bg-inverse-default",
|
|
268
|
+
light: primitiveColors.black,
|
|
269
|
+
dark: primitiveColors.white,
|
|
270
|
+
}),
|
|
271
|
+
buttonBgInverseHover: color({
|
|
272
|
+
name: "button-bg-inverse-hover",
|
|
273
|
+
light: primitiveColors.cyan900,
|
|
274
|
+
dark: primitiveColors.cyan100,
|
|
275
|
+
}),
|
|
276
|
+
buttonBgInverseActive: color({
|
|
277
|
+
name: "button-bg-inverse-active",
|
|
278
|
+
light: primitiveColors.black,
|
|
279
|
+
dark: primitiveColors.white,
|
|
280
|
+
}),
|
|
281
|
+
buttonBgBrandDefault: color({
|
|
282
|
+
name: "button-bg-brand-default",
|
|
283
|
+
light: primitiveColors.gray50,
|
|
284
|
+
dark: primitiveColors.gray950,
|
|
285
|
+
}),
|
|
286
|
+
buttonBgBrandDefaultPrimary: color({
|
|
287
|
+
name: "button-bg-brand-default-primary",
|
|
288
|
+
light: primitiveColors.red500,
|
|
289
|
+
dark: primitiveColors.red500,
|
|
290
|
+
}),
|
|
291
|
+
buttonBgBrandHover: color({
|
|
292
|
+
name: "button-bg-brand-hover",
|
|
293
|
+
light: primitiveColors.red50,
|
|
294
|
+
dark: primitiveColors.red900,
|
|
295
|
+
}),
|
|
296
|
+
buttonBgBrandHoverPrimary: color({
|
|
297
|
+
name: "button-bg-brand-hover-primary",
|
|
298
|
+
light: primitiveColors.red400,
|
|
299
|
+
dark: primitiveColors.red400,
|
|
300
|
+
}),
|
|
301
|
+
buttonBgBrandActive: color({
|
|
302
|
+
name: "button-bg-brand-active",
|
|
303
|
+
light: primitiveColors.red500,
|
|
304
|
+
dark: primitiveColors.red500,
|
|
305
|
+
}),
|
|
306
|
+
buttonBgBrandActivePrimary: color({
|
|
307
|
+
name: "button-bg-brand-active-primary",
|
|
308
|
+
light: primitiveColors.red600,
|
|
309
|
+
dark: primitiveColors.red600,
|
|
310
|
+
}),
|
|
311
|
+
buttonBgAccentDefault: color({
|
|
312
|
+
name: "button-bg-accent-default",
|
|
313
|
+
light: primitiveColors.gray50,
|
|
314
|
+
dark: primitiveColors.gray950,
|
|
315
|
+
}),
|
|
316
|
+
buttonBgAccentDefaultPrimary: color({
|
|
317
|
+
name: "button-bg-accent-default-primary",
|
|
318
|
+
light: primitiveColors.cyan300,
|
|
319
|
+
dark: primitiveColors.cyan900,
|
|
320
|
+
}),
|
|
321
|
+
buttonBgAccentHover: color({
|
|
322
|
+
name: "button-bg-accent-hover",
|
|
323
|
+
light: primitiveColors.cyan200,
|
|
324
|
+
dark: primitiveColors.cyan700,
|
|
325
|
+
}),
|
|
326
|
+
buttonBgAccentActive: color({
|
|
327
|
+
name: "button-bg-accent-active",
|
|
328
|
+
light: primitiveColors.cyan400,
|
|
329
|
+
dark: primitiveColors.cyan400,
|
|
330
|
+
}),
|
|
331
|
+
buttonFgDefault: color({
|
|
332
|
+
name: "button-fg-default",
|
|
333
|
+
light: primitiveColors.black,
|
|
334
|
+
dark: primitiveColors.white,
|
|
335
|
+
}),
|
|
336
|
+
buttonFgDisabled: color({
|
|
337
|
+
name: "button-fg-disabled",
|
|
338
|
+
light: primitiveColors.gray700,
|
|
339
|
+
dark: primitiveColors.gray300,
|
|
340
|
+
}),
|
|
341
|
+
buttonFgInverseDefault: color({
|
|
342
|
+
name: "button-fg-inverse-default",
|
|
343
|
+
light: primitiveColors.white,
|
|
344
|
+
dark: primitiveColors.black,
|
|
345
|
+
}),
|
|
346
|
+
buttonFgInverseHover: color({
|
|
347
|
+
name: "button-fg-inverse-hover",
|
|
348
|
+
light: primitiveColors.cyan300,
|
|
349
|
+
dark: primitiveColors.cyan800,
|
|
350
|
+
}),
|
|
351
|
+
buttonFgInverseActive: color({
|
|
352
|
+
name: "button-fg-inverse-active",
|
|
353
|
+
light: primitiveColors.cyan300,
|
|
354
|
+
dark: primitiveColors.cyan800,
|
|
355
|
+
}),
|
|
356
|
+
buttonFgBrandDefault: color({
|
|
357
|
+
name: "button-fg-brand-default",
|
|
358
|
+
light: primitiveColors.black,
|
|
359
|
+
dark: primitiveColors.black,
|
|
360
|
+
}),
|
|
361
|
+
buttonFgBrandHover: color({
|
|
362
|
+
name: "button-fg-brand-hover",
|
|
363
|
+
light: primitiveColors.red900,
|
|
364
|
+
dark: primitiveColors.red100,
|
|
365
|
+
}),
|
|
366
|
+
buttonFgBrandHoverPrimary: color({
|
|
367
|
+
name: "button-fg-brand-hover-primary",
|
|
368
|
+
light: primitiveColors.red900,
|
|
369
|
+
dark: primitiveColors.red900,
|
|
370
|
+
}),
|
|
371
|
+
buttonFgBrandActive: color({
|
|
372
|
+
name: "button-fg-brand-active",
|
|
373
|
+
light: primitiveColors.black,
|
|
374
|
+
dark: primitiveColors.black,
|
|
375
|
+
}),
|
|
376
|
+
buttonFgBrandActivePrimary: color({
|
|
377
|
+
name: "button-fg-brand-active-primary",
|
|
378
|
+
light: primitiveColors.red50,
|
|
379
|
+
dark: primitiveColors.red50,
|
|
380
|
+
}),
|
|
381
|
+
buttonFgAccentDefault: color({
|
|
382
|
+
name: "button-fg-accent-default",
|
|
383
|
+
light: primitiveColors.cyan900,
|
|
384
|
+
dark: primitiveColors.cyan100,
|
|
385
|
+
}),
|
|
386
|
+
buttonFgAccentHover: color({
|
|
387
|
+
name: "button-fg-accent-hover",
|
|
388
|
+
light: primitiveColors.black,
|
|
389
|
+
dark: primitiveColors.white,
|
|
390
|
+
}),
|
|
391
|
+
buttonFgAccentActive: color({
|
|
392
|
+
name: "button-fg-accent-active",
|
|
393
|
+
light: primitiveColors.black,
|
|
394
|
+
dark: primitiveColors.black,
|
|
395
|
+
}),
|
|
396
|
+
buttonFgIconDefault: color({
|
|
397
|
+
name: "button-fg-icon-default",
|
|
398
|
+
light: primitiveColors.gray700,
|
|
399
|
+
dark: primitiveColors.gray300,
|
|
400
|
+
}),
|
|
401
|
+
buttonFgIconInverse: color({
|
|
402
|
+
name: "button-fg-icon-inverse",
|
|
403
|
+
light: primitiveColors.cyan300,
|
|
404
|
+
dark: primitiveColors.cyan700,
|
|
405
|
+
}),
|
|
406
|
+
buttonFgIconBrandPrimary: color({
|
|
407
|
+
name: "button-fg-icon-brand-primary",
|
|
408
|
+
light: primitiveColors.red700,
|
|
409
|
+
dark: primitiveColors.red700,
|
|
410
|
+
}),
|
|
411
|
+
buttonFgIconAccent: color({
|
|
412
|
+
name: "button-fg-icon-accent",
|
|
413
|
+
light: primitiveColors.cyan700,
|
|
414
|
+
dark: primitiveColors.cyan300,
|
|
415
|
+
}),
|
|
416
|
+
buttonFgIconDisabled: color({
|
|
417
|
+
name: "button-fg-icon-disabled",
|
|
418
|
+
light: primitiveColors.gray500,
|
|
419
|
+
dark: primitiveColors.gray500,
|
|
420
|
+
}),
|
|
421
|
+
buttonBorderDefault: color({
|
|
422
|
+
name: "button-border-default",
|
|
423
|
+
light: primitiveColors.gray200,
|
|
424
|
+
dark: primitiveColors.gray800,
|
|
425
|
+
}),
|
|
426
|
+
buttonBorderHover: color({
|
|
427
|
+
name: "button-border-hover",
|
|
428
|
+
light: primitiveColors.gray200,
|
|
429
|
+
dark: primitiveColors.gray800,
|
|
430
|
+
}),
|
|
431
|
+
buttonBorderActive: color({
|
|
432
|
+
name: "button-border-active",
|
|
433
|
+
light: primitiveColors.gray300,
|
|
434
|
+
dark: primitiveColors.gray700,
|
|
435
|
+
}),
|
|
436
|
+
buttonBorderDisabled: color({
|
|
437
|
+
name: "button-border-disabled",
|
|
438
|
+
light: primitiveColors.gray400,
|
|
439
|
+
dark: primitiveColors.gray600,
|
|
440
|
+
}),
|
|
441
|
+
buttonBorderBrand: color({
|
|
442
|
+
name: "button-border-brand",
|
|
443
|
+
light: primitiveColors.red500,
|
|
444
|
+
dark: primitiveColors.red500,
|
|
445
|
+
}),
|
|
446
|
+
buttonBorderAccentDefault: color({
|
|
447
|
+
name: "button-border-accent-default",
|
|
448
|
+
light: primitiveColors.cyan400,
|
|
449
|
+
dark: primitiveColors.cyan800,
|
|
450
|
+
}),
|
|
451
|
+
buttonBorderAccentHover: color({
|
|
452
|
+
name: "button-border-accent-hover",
|
|
453
|
+
light: primitiveColors.cyan400,
|
|
454
|
+
dark: primitiveColors.cyan600,
|
|
455
|
+
}),
|
|
456
|
+
buttonBorderAccentActive: color({
|
|
457
|
+
name: "button-border-accent-active",
|
|
458
|
+
light: primitiveColors.cyan400,
|
|
459
|
+
dark: primitiveColors.cyan400,
|
|
460
|
+
}),
|
|
461
|
+
linkCtaBgDefault: color({
|
|
462
|
+
name: "link-cta-bg-default",
|
|
463
|
+
light: primitiveColors.gray50,
|
|
464
|
+
dark: primitiveColors.gray950,
|
|
465
|
+
}),
|
|
466
|
+
linkCtaBgHover: color({
|
|
467
|
+
name: "link-cta-bg-hover",
|
|
468
|
+
light: primitiveColors.white,
|
|
469
|
+
dark: primitiveColors.black,
|
|
470
|
+
}),
|
|
471
|
+
linkCtaBgActive: color({
|
|
472
|
+
name: "link-cta-bg-active",
|
|
473
|
+
light: primitiveColors.red500,
|
|
474
|
+
dark: primitiveColors.red500,
|
|
475
|
+
}),
|
|
476
|
+
linkCtaFgDefault: color({
|
|
477
|
+
name: "link-cta-fg-default",
|
|
478
|
+
light: primitiveColors.black,
|
|
479
|
+
dark: primitiveColors.white,
|
|
480
|
+
}),
|
|
481
|
+
linkCtaFgActive: color({
|
|
482
|
+
name: "link-cta-fg-active",
|
|
483
|
+
light: primitiveColors.black,
|
|
484
|
+
dark: primitiveColors.black,
|
|
485
|
+
}),
|
|
486
|
+
linkCtaFgIconDefault: color({
|
|
487
|
+
name: "link-cta-fg-icon-default",
|
|
488
|
+
light: primitiveColors.red500,
|
|
489
|
+
dark: primitiveColors.red500,
|
|
490
|
+
}),
|
|
491
|
+
linkCtaFgIconActive: color({
|
|
492
|
+
name: "link-cta-fg-icon-active",
|
|
493
|
+
light: primitiveColors.black,
|
|
494
|
+
dark: primitiveColors.black,
|
|
495
|
+
}),
|
|
496
|
+
linkCtaBorderDefault: color({
|
|
497
|
+
name: "link-cta-border-default",
|
|
498
|
+
light: primitiveColors.gray300,
|
|
499
|
+
dark: primitiveColors.gray700,
|
|
500
|
+
}),
|
|
501
|
+
linkCtaBorderHover: color({
|
|
502
|
+
name: "link-cta-border-hover",
|
|
503
|
+
light: primitiveColors.red500,
|
|
504
|
+
dark: primitiveColors.red500,
|
|
505
|
+
}),
|
|
506
|
+
linkUnderline: color({
|
|
507
|
+
name: "link-underline",
|
|
508
|
+
light: primitiveColors.cyan600,
|
|
509
|
+
dark: primitiveColors.cyan400,
|
|
510
|
+
}),
|
|
511
|
+
logoPrimary: color({
|
|
512
|
+
name: "logo-primary",
|
|
513
|
+
light: primitiveColors.red500,
|
|
514
|
+
dark: primitiveColors.gray50,
|
|
515
|
+
}),
|
|
516
|
+
logoSecondary: color({
|
|
517
|
+
name: "logo-secondary",
|
|
518
|
+
light: primitiveColors.red400,
|
|
519
|
+
dark: primitiveColors.gray300,
|
|
520
|
+
}),
|
|
521
|
+
logoTertiary: color({
|
|
522
|
+
name: "logo-tertiary",
|
|
523
|
+
light: primitiveColors.red300,
|
|
524
|
+
dark: primitiveColors.gray500,
|
|
525
|
+
}),
|
|
526
|
+
fieldBorder: color({
|
|
527
|
+
name: "field-border",
|
|
528
|
+
dark: primitiveColors.gray800,
|
|
529
|
+
light: primitiveColors.gray200,
|
|
530
|
+
}),
|
|
531
|
+
fieldBorderHover: color({
|
|
532
|
+
name: "field-border-hover",
|
|
533
|
+
dark: primitiveColors.gray400,
|
|
534
|
+
light: primitiveColors.gray600,
|
|
535
|
+
}),
|
|
536
|
+
fieldBg: color({
|
|
537
|
+
name: "field-bg",
|
|
538
|
+
dark: primitiveColors.black,
|
|
539
|
+
light: primitiveColors.white,
|
|
540
|
+
}),
|
|
541
|
+
fieldFg: color({
|
|
542
|
+
name: "field-fg",
|
|
543
|
+
dark: primitiveColors.white,
|
|
544
|
+
light: primitiveColors.black,
|
|
545
|
+
}),
|
|
546
|
+
fieldFgPlaceholder: color({
|
|
547
|
+
name: "field-fg-placeholder",
|
|
548
|
+
dark: primitiveColors.gray400,
|
|
549
|
+
light: primitiveColors.gray600,
|
|
550
|
+
}),
|
|
551
|
+
fieldFgLabel: color({
|
|
552
|
+
name: "field-fg-label",
|
|
553
|
+
dark: primitiveColors.gray200,
|
|
554
|
+
light: primitiveColors.gray900,
|
|
555
|
+
}),
|
|
556
|
+
fieldFgHint: color({
|
|
557
|
+
name: "field-fg-hint",
|
|
558
|
+
dark: primitiveColors.gray400,
|
|
559
|
+
light: primitiveColors.gray700,
|
|
560
|
+
}),
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function color(options: {
|
|
564
|
+
name: string
|
|
565
|
+
light: PrimitiveColor
|
|
566
|
+
dark: PrimitiveColor
|
|
567
|
+
}): SemanticColor {
|
|
568
|
+
return {
|
|
569
|
+
name: options.name,
|
|
570
|
+
variable: `--theme-colors-${options.name}`,
|
|
571
|
+
dark: options.dark,
|
|
572
|
+
light: options.light,
|
|
573
|
+
}
|
|
574
|
+
}
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts pixels to rem units
|
|
3
|
+
* @param pixels - The number of pixels to convert
|
|
4
|
+
* @returns The rem value as a string with 'rem' suffix
|
|
5
|
+
*/
|
|
6
|
+
export function rem(pixels: number): string {
|
|
7
|
+
return `${pixels / 16}rem`
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Converts a URL or string to a relative URL path
|
|
12
|
+
* @param input - The URL or string to convert
|
|
13
|
+
* @returns A relative URL path string with origin removed
|
|
14
|
+
*/
|
|
15
|
+
export function toRelativeUrl(input: string | URL) {
|
|
16
|
+
if (input.toString().startsWith("#")) return input.toString()
|
|
17
|
+
const urlObject = new URL(input, "https://www.sanity.io")
|
|
18
|
+
return urlObject.href.replace(urlObject.origin, "")
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Checks if a URL is internal to sanity.io
|
|
23
|
+
* @param href - The URL to check
|
|
24
|
+
* @returns True if the URL is internal, false otherwise
|
|
25
|
+
*/
|
|
26
|
+
export function isInternalHref(href?: string) {
|
|
27
|
+
if (!href) return false
|
|
28
|
+
const value = href.replace(/^(https?:\/\/)?(www\.)?sanity\.io/, "")
|
|
29
|
+
const isRoot = value === ""
|
|
30
|
+
const isPath = value.startsWith("/")
|
|
31
|
+
const isAnchor = value.startsWith("#")
|
|
32
|
+
return isRoot || isPath || isAnchor
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Converts a string to a URL-safe slug
|
|
37
|
+
* @param string - The string to convert to a slug
|
|
38
|
+
* @returns A URL-safe slug string with special characters removed/replaced
|
|
39
|
+
*/
|
|
40
|
+
export function slugify(string: string) {
|
|
41
|
+
const a =
|
|
42
|
+
"àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;"
|
|
43
|
+
const b =
|
|
44
|
+
"aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnooooooooprrsssssttuuuuuuuuuwxyyzzz------"
|
|
45
|
+
const p = new RegExp(a.split("").join("|"), "g")
|
|
46
|
+
|
|
47
|
+
return string
|
|
48
|
+
.toString()
|
|
49
|
+
.toLowerCase()
|
|
50
|
+
.trim()
|
|
51
|
+
.replace(/\s+/g, "-") // Replace spaces with -
|
|
52
|
+
.replace(p, (c) => b.charAt(a.indexOf(c))) // Replace special characters
|
|
53
|
+
.replace(/&/g, "-and-") // Replace & with 'and'
|
|
54
|
+
.replace(/[^\w-]+/g, "") // Remove all non-word characters
|
|
55
|
+
.replace(/--+/g, "-") // Replace multiple - with single -
|
|
56
|
+
.replace(/^-+/, "") // Trim - from start of text
|
|
57
|
+
.replace(/-+$/, "") // Trim - from end of text
|
|
58
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"lib": ["ES2020", "DOM"],
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"jsx": "react"
|
|
14
|
+
},
|
|
15
|
+
"include": ["src"],
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineConfig } from "vite"
|
|
2
|
+
import { globby } from "globby"
|
|
3
|
+
import preserveDirectives from "rollup-preserve-directives"
|
|
4
|
+
|
|
5
|
+
const components = await globby("./src/components/*.tsx")
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [preserveDirectives()],
|
|
9
|
+
build: {
|
|
10
|
+
lib: {
|
|
11
|
+
entry: [
|
|
12
|
+
...components,
|
|
13
|
+
"./src/tailwind.ts",
|
|
14
|
+
"./src/utils.ts",
|
|
15
|
+
"./src/colors.ts",
|
|
16
|
+
],
|
|
17
|
+
cssFileName: "styles",
|
|
18
|
+
formats: ["es"],
|
|
19
|
+
},
|
|
20
|
+
rollupOptions: {
|
|
21
|
+
external: ["react", "react-dom"],
|
|
22
|
+
output: {
|
|
23
|
+
globals: {
|
|
24
|
+
react: "React",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
})
|