@sanity/ui 3.0.0-static.4 → 3.0.0-static.6

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 (51) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +81 -31
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +82 -32
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/_visual-editing.d.mts +14 -11
  6. package/dist/_visual-editing.d.ts +14 -11
  7. package/dist/cli.js +1 -1
  8. package/dist/css.d.mts +144 -852
  9. package/dist/css.d.ts +144 -852
  10. package/dist/css.js +155 -141
  11. package/dist/css.js.map +1 -1
  12. package/dist/css.mjs +154 -141
  13. package/dist/css.mjs.map +1 -1
  14. package/dist/index.d.mts +14 -11
  15. package/dist/index.d.ts +14 -11
  16. package/dist/index.js +2 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +4 -6
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/sanity-theme.css +1 -1
  21. package/dist/system.css +54 -49
  22. package/dist/theme.js +271 -33
  23. package/dist/theme.js.map +1 -1
  24. package/dist/theme.mjs +252 -16
  25. package/dist/theme.mjs.map +1 -1
  26. package/package.json +2 -2
  27. package/src/css/aspects/flex/flexJustify.style.ts +3 -3
  28. package/src/css/aspects/grid/types.ts +2 -2
  29. package/src/css/index.ts +2 -2
  30. package/src/css/primitives/_input/__workshop__/index.ts +1 -1
  31. package/src/css/primitives/button/button.style.ts +6 -4
  32. package/src/css/primitives/stack/index.ts +1 -0
  33. package/src/css/primitives/stack/stack.style.ts +9 -0
  34. package/src/css/primitives/stack/stack.ts +6 -0
  35. package/src/css/system.style.ts +2 -0
  36. package/src/theme/v3/defaults.ts +1 -1
  37. package/src/ui/components/autocomplete/__workshop__/index.ts +1 -1
  38. package/src/ui/components/dialog/dialog.tsx +3 -4
  39. package/src/ui/constants.ts +6 -0
  40. package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +0 -2
  41. package/src/ui/primitives/box/box.tsx +6 -0
  42. package/src/ui/primitives/button/button.tsx +11 -10
  43. package/src/ui/primitives/code/code.tsx +1 -1
  44. package/src/ui/primitives/popover/popover.tsx +5 -75
  45. package/src/ui/primitives/stack/stack.tsx +10 -5
  46. package/src/ui/primitives/textInput/textInput.tsx +1 -1
  47. package/src/ui/primitives/tooltip/tooltip.tsx +2 -3
  48. package/dist/_chunks-cjs/v3_v2.js +0 -251
  49. package/dist/_chunks-cjs/v3_v2.js.map +0 -1
  50. package/dist/_chunks-es/v3_v2.mjs +0 -252
  51. package/dist/_chunks-es/v3_v2.mjs.map +0 -1
package/dist/theme.mjs CHANGED
@@ -1,18 +1,4 @@
1
- import { THEME_COLOR_BLEND_MODES, THEME_COLOR_BUTTON_MODES, THEME_COLOR_CARD_TONES, THEME_COLOR_STATE_TONES, THEME_COLOR_AVATAR_COLORS, v3_v2, THEME_COLOR_STATES, THEME_COLOR_INPUT_MODES, THEME_COLOR_INPUT_STATES } from "./_chunks-es/v3_v2.mjs";
2
- import { THEME_COLOR_SCHEMES } from "./_chunks-es/v3_v2.mjs";
3
1
  import { COLOR_HUES, COLOR_TINTS } from "@sanity/color";
4
- function isColorBlendModeValue(str) {
5
- return THEME_COLOR_BLEND_MODES.includes(str);
6
- }
7
- function isColorHueKey(str) {
8
- return COLOR_HUES.includes(str);
9
- }
10
- function isColorTintKey(str) {
11
- return COLOR_TINTS.includes(str);
12
- }
13
- function isColorButtonMode(str) {
14
- return THEME_COLOR_BUTTON_MODES.includes(str);
15
- }
16
2
  const AVATAR_SIZE = [0, 1, 2, 3], CONTAINER = [0, 1, 2, 3, 4, 5, "auto"], RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], SPACE = [0, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9], FONT_CODE_SIZE = [0, 1, 2, 3, 4], FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5], FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5], FONT_TEXT_SIZE = [0, 1, 2, 3, 4], SHADOW = [0, 1, 2, 3, 4, 5];
17
3
  function createSelectableTones(opts, base, dark, solid, muted) {
18
4
  return {
@@ -1447,7 +1433,39 @@ const defaultThemeConfig = {
1447
1433
  letterSpacing: 0
1448
1434
  }]
1449
1435
  }
1450
- }, HUES = ["gray", "blue", "purple", "magenta", "red", "orange", "yellow", "green", "cyan"], TINTS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950], RE_PERCENTAGE = /^([0-9]+)%/, RE_OPACITY = /^(1|0\.[0-9]+)?/;
1436
+ }, THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
1437
+ "transparent",
1438
+ "default",
1439
+ "neutral",
1440
+ "primary",
1441
+ // deprecated
1442
+ "suggest",
1443
+ "positive",
1444
+ "caution",
1445
+ "critical"
1446
+ ], THEME_COLOR_STATE_TONES = [
1447
+ "default",
1448
+ "neutral",
1449
+ "primary",
1450
+ // deprecated
1451
+ "suggest",
1452
+ "positive",
1453
+ "caution",
1454
+ "critical"
1455
+ ], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
1456
+ function isColorBlendModeValue(str) {
1457
+ return THEME_COLOR_BLEND_MODES.includes(str);
1458
+ }
1459
+ function isColorHueKey(str) {
1460
+ return COLOR_HUES.includes(str);
1461
+ }
1462
+ function isColorTintKey(str) {
1463
+ return COLOR_TINTS.includes(str);
1464
+ }
1465
+ function isColorButtonMode(str) {
1466
+ return THEME_COLOR_BUTTON_MODES.includes(str);
1467
+ }
1468
+ const HUES = ["gray", "blue", "purple", "magenta", "red", "orange", "yellow", "green", "cyan"], TINTS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950], RE_PERCENTAGE = /^([0-9]+)%/, RE_OPACITY = /^(1|0\.[0-9]+)?/;
1451
1469
  function parseColor$1(str) {
1452
1470
  let cursor = 0;
1453
1471
  const color = getColor();
@@ -1806,7 +1824,7 @@ const defaultTokens = {
1806
1824
  4: ["800", "300 50%"]
1807
1825
  },
1808
1826
  border: {
1809
- 0: ["900", "100"],
1827
+ 0: ["900", "300 40%"],
1810
1828
  4: ["700", "300"]
1811
1829
  },
1812
1830
  fg: {
@@ -2153,6 +2171,224 @@ function inputStateThemeColor_v2_v0(t) {
2153
2171
  placeholder: t.placeholder
2154
2172
  };
2155
2173
  }
2174
+ function themeColor_v3_v2(options) {
2175
+ const {
2176
+ color,
2177
+ dark
2178
+ } = options;
2179
+ return {
2180
+ _blend: "screen",
2181
+ _dark: dark,
2182
+ ...buildColorState({
2183
+ cardColor: color,
2184
+ state: "enabled",
2185
+ tone: "default",
2186
+ variant: "tinted"
2187
+ }),
2188
+ backdrop: color.backdrop,
2189
+ button: THEME_COLOR_BUTTON_MODES.reduce((modes, mode) => (modes[mode] = THEME_COLOR_STATE_TONES.reduce((tones2, tone) => (tones2[tone] = THEME_COLOR_STATES.reduce((states, state) => (states[state] = buildColorState({
2190
+ cardColor: color,
2191
+ state,
2192
+ tone,
2193
+ variant: mode === "default" ? "solid" : "tinted"
2194
+ }), mode === "bleed" && (states[state].border = "transparent"), states), {}), tones2), {}), modes), {}),
2195
+ focusRing: color.focusRing,
2196
+ input: THEME_COLOR_INPUT_MODES.reduce((modes, mode) => (modes[mode] = THEME_COLOR_INPUT_STATES.reduce((states, state) => (states[state] = buildInputState(color.variant.tinted.default), states), {}), modes), {}),
2197
+ selectable: THEME_COLOR_STATE_TONES.reduce((tones2, tone) => (tones2[tone] = THEME_COLOR_STATES.reduce((states, state) => (states[state] = buildColorState({
2198
+ cardColor: color,
2199
+ // cardVars: vars,
2200
+ state,
2201
+ tone,
2202
+ variant: "tinted"
2203
+ }), states), {}), tones2), {}),
2204
+ shadow: color.shadow,
2205
+ syntax: color.token
2206
+ };
2207
+ }
2208
+ const stateShades = {
2209
+ enabled: {
2210
+ bg: [0, 1, 2],
2211
+ border: [0, 1, 2],
2212
+ fg: [0, 1, 2]
2213
+ },
2214
+ hovered: {
2215
+ bg: [1, 2, 3],
2216
+ border: [1, 2, 3],
2217
+ fg: [1, 2, 3]
2218
+ },
2219
+ pressed: {
2220
+ bg: [2, 3, 4],
2221
+ border: [2, 3, 4],
2222
+ fg: [2, 3, 4]
2223
+ },
2224
+ selected: {
2225
+ bg: [3, 4, 4],
2226
+ border: [3, 4, 4],
2227
+ fg: [3, 4, 4]
2228
+ },
2229
+ disabled: {
2230
+ bg: [4, 4, 4],
2231
+ border: [4, 4, 4],
2232
+ fg: [4, 4, 4]
2233
+ }
2234
+ };
2235
+ function mix$1(tokens, index) {
2236
+ return index === 0 ? tokens[0] : index === 4 ? tokens[4] : `color-mix(in oklch, ${tokens[0]}, ${tokens[4]} ${index * 25}%)`;
2237
+ }
2238
+ function buildColorState(options) {
2239
+ const {
2240
+ cardColor,
2241
+ state,
2242
+ tone,
2243
+ variant
2244
+ } = options, color = cardColor.variant[variant][tone], shades = stateShades[state];
2245
+ return {
2246
+ accent: {
2247
+ fg: color.fg[4]
2248
+ },
2249
+ avatar: cardColor.avatar,
2250
+ badge: THEME_COLOR_STATE_TONES.reduce((tones2, tone2) => (tones2[tone2] = {
2251
+ bg: mix$1(color.bg, 1),
2252
+ fg: mix$1(color.fg, 1),
2253
+ dot: mix$1(color.fg, 3),
2254
+ icon: mix$1(color.fg, 3)
2255
+ }, tones2), {}),
2256
+ bg: mix$1(color.bg, shades.bg[0]),
2257
+ border: mix$1(color.border, shades.border[0]),
2258
+ fg: mix$1(color.fg, shades.fg[0]),
2259
+ code: {
2260
+ bg: mix$1(color.bg, shades.bg[1]),
2261
+ fg: mix$1(color.fg, shades.fg[2])
2262
+ },
2263
+ icon: mix$1(color.fg, shades.fg[2]),
2264
+ kbd: {
2265
+ bg: mix$1(color.bg, 0),
2266
+ fg: mix$1(color.fg, 0),
2267
+ border: mix$1(color.bg, 0)
2268
+ },
2269
+ link: {
2270
+ fg: mix$1(color.fg, shades.fg[2])
2271
+ },
2272
+ muted: {
2273
+ bg: mix$1(color.bg, shades.bg[1]),
2274
+ fg: mix$1(color.fg, shades.fg[2])
2275
+ },
2276
+ skeleton: cardColor.skeleton
2277
+ };
2278
+ }
2279
+ function buildInputState(colorElement) {
2280
+ return {
2281
+ bg: colorElement.bg[0],
2282
+ border: colorElement.bg[0],
2283
+ fg: colorElement.fg[0],
2284
+ muted: {
2285
+ bg: colorElement.bg[0]
2286
+ },
2287
+ placeholder: colorElement.fg[0]
2288
+ };
2289
+ }
2290
+ function v3_v2(theme_v3) {
2291
+ return {
2292
+ _version: 2,
2293
+ avatar: theme_v3.avatar,
2294
+ button: theme_v3.button,
2295
+ card: theme_v3.card,
2296
+ color: {
2297
+ dark: {
2298
+ transparent: themeColor_v3_v2({
2299
+ color: theme_v3.color.dark.card.transparent,
2300
+ dark: !0
2301
+ // vars: vars.color.dark.transparent,
2302
+ }),
2303
+ default: themeColor_v3_v2({
2304
+ color: theme_v3.color.dark.card.default,
2305
+ dark: !0
2306
+ // vars: vars.color.dark.default,
2307
+ }),
2308
+ neutral: themeColor_v3_v2({
2309
+ color: theme_v3.color.dark.card.neutral,
2310
+ dark: !0
2311
+ // vars: vars.color.dark.neutral,
2312
+ }),
2313
+ primary: themeColor_v3_v2({
2314
+ color: theme_v3.color.dark.card.primary,
2315
+ dark: !0
2316
+ // vars: vars.color.dark.primary,
2317
+ }),
2318
+ suggest: themeColor_v3_v2({
2319
+ color: theme_v3.color.dark.card.suggest,
2320
+ dark: !0
2321
+ // vars: vars.color.dark.suggest,
2322
+ }),
2323
+ positive: themeColor_v3_v2({
2324
+ color: theme_v3.color.dark.card.positive,
2325
+ dark: !0
2326
+ // vars: vars.color.dark.positive,
2327
+ }),
2328
+ caution: themeColor_v3_v2({
2329
+ color: theme_v3.color.dark.card.caution,
2330
+ dark: !0
2331
+ // vars: vars.color.dark.caution,
2332
+ }),
2333
+ critical: themeColor_v3_v2({
2334
+ color: theme_v3.color.dark.card.critical,
2335
+ dark: !0
2336
+ // vars: vars.color.dark.critical,
2337
+ })
2338
+ },
2339
+ light: {
2340
+ transparent: themeColor_v3_v2({
2341
+ color: theme_v3.color.light.card.transparent,
2342
+ dark: !1
2343
+ // vars: vars.color.light.transparent,
2344
+ }),
2345
+ default: themeColor_v3_v2({
2346
+ color: theme_v3.color.light.card.default,
2347
+ dark: !1
2348
+ // vars: vars.color.light.default,
2349
+ }),
2350
+ neutral: themeColor_v3_v2({
2351
+ color: theme_v3.color.light.card.neutral,
2352
+ dark: !1
2353
+ // vars: vars.color.light.neutral,
2354
+ }),
2355
+ primary: themeColor_v3_v2({
2356
+ color: theme_v3.color.light.card.primary,
2357
+ dark: !1
2358
+ // vars: vars.color.light.primary,
2359
+ }),
2360
+ suggest: themeColor_v3_v2({
2361
+ color: theme_v3.color.light.card.suggest,
2362
+ dark: !1
2363
+ // vars: vars.color.light.suggest,
2364
+ }),
2365
+ positive: themeColor_v3_v2({
2366
+ color: theme_v3.color.light.card.positive,
2367
+ dark: !1
2368
+ // vars: vars.color.light.positive,
2369
+ }),
2370
+ caution: themeColor_v3_v2({
2371
+ color: theme_v3.color.light.card.caution,
2372
+ dark: !1
2373
+ // vars: vars.color.light.caution,
2374
+ }),
2375
+ critical: themeColor_v3_v2({
2376
+ color: theme_v3.color.light.card.critical,
2377
+ dark: !1
2378
+ // vars: vars.color.light.critical,
2379
+ })
2380
+ }
2381
+ },
2382
+ container: theme_v3.container,
2383
+ font: theme_v3.font,
2384
+ input: theme_v3.input,
2385
+ layer: theme_v3.layer,
2386
+ media: theme_v3.media,
2387
+ radius: theme_v3.radius,
2388
+ shadow: theme_v3.shadow,
2389
+ space: theme_v3.space
2390
+ };
2391
+ }
2156
2392
  function buildTheme(_config) {
2157
2393
  const v3 = buildTheme_v3({
2158
2394
  v2: _config