@sanity/ui 3.0.0-static.3 → 3.0.0-static.5

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 (68) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +98 -64
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-cjs/buildCommand.js +1 -1
  4. package/dist/_chunks-cjs/buildCommand.js.map +1 -1
  5. package/dist/_chunks-es/_visual-editing.mjs +99 -65
  6. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  7. package/dist/_visual-editing.d.mts +4 -1
  8. package/dist/_visual-editing.d.ts +4 -1
  9. package/dist/cli.js +1 -1
  10. package/dist/css.d.mts +145 -893
  11. package/dist/css.d.ts +145 -893
  12. package/dist/css.js +182 -191
  13. package/dist/css.js.map +1 -1
  14. package/dist/css.mjs +182 -191
  15. package/dist/css.mjs.map +1 -1
  16. package/dist/index.d.mts +4 -1
  17. package/dist/index.d.ts +4 -1
  18. package/dist/index.js +12 -14
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +12 -14
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/sanity-palette.css +1 -9
  23. package/dist/sanity-theme.css +1 -1
  24. package/dist/system.css +114 -109
  25. package/dist/theme.d.mts +1 -43
  26. package/dist/theme.d.ts +1 -43
  27. package/dist/theme.js +291 -102
  28. package/dist/theme.js.map +1 -1
  29. package/dist/theme.mjs +272 -85
  30. package/dist/theme.mjs.map +1 -1
  31. package/package.json +1 -1
  32. package/src/cli/buildCommand.ts +2 -2
  33. package/src/css/_comp.ts +1 -0
  34. package/src/css/aspects/flex/flexJustify.style.ts +3 -3
  35. package/src/css/aspects/grid/types.ts +2 -2
  36. package/src/css/aspects/textOverflow/textOverflow.ts +2 -2
  37. package/src/css/compile/compilePalette.ts +8 -41
  38. package/src/css/compile/compileTheme_v3.ts +0 -18
  39. package/src/css/index.ts +2 -2
  40. package/src/css/primitives/_selectable/_contants.ts +1 -1
  41. package/src/css/primitives/box/box.ts +3 -0
  42. package/src/css/primitives/button/_constants.ts +1 -1
  43. package/src/css/primitives/button/button.style.ts +12 -13
  44. package/src/css/primitives/card/_constants.ts +2 -2
  45. package/src/css/primitives/card/card.ts +1 -1
  46. package/src/css/primitives/stack/index.ts +1 -0
  47. package/src/css/primitives/stack/stack.style.ts +9 -0
  48. package/src/css/primitives/stack/stack.ts +6 -0
  49. package/src/css/system.style.ts +2 -0
  50. package/src/theme/defaults/config.ts +2 -2
  51. package/src/theme/defaults/fonts.ts +4 -4
  52. package/src/theme/palette/constants.ts +1 -3
  53. package/src/theme/palette/types.ts +0 -12
  54. package/src/theme/v3/buildTheme_v3.ts +1 -2
  55. package/src/theme/v3/defaults.ts +12 -31
  56. package/src/theme/v3/types.ts +0 -3
  57. package/src/ui/StyleTags.tsx +1 -1
  58. package/src/ui/primitives/box/box.tsx +6 -0
  59. package/src/ui/primitives/button/button.tsx +12 -11
  60. package/src/ui/primitives/card/card.tsx +5 -2
  61. package/src/ui/primitives/heading/heading.tsx +1 -1
  62. package/src/ui/primitives/select/select.tsx +3 -3
  63. package/src/ui/primitives/stack/stack.tsx +10 -5
  64. package/src/ui/primitives/text/text.tsx +1 -1
  65. package/dist/_chunks-cjs/v3_v2.js +0 -251
  66. package/dist/_chunks-cjs/v3_v2.js.map +0 -1
  67. package/dist/_chunks-es/v3_v2.mjs +0 -252
  68. package/dist/_chunks-es/v3_v2.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "3.0.0-static.3",
3
+ "version": "3.0.0-static.5",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -1,10 +1,10 @@
1
1
  import {compilePalette, compileSystem, compileTheme} from '@sanity/ui/css'
2
- import {buildTheme_v3, defaultPalette, RootTheme} from '@sanity/ui/theme'
2
+ import {buildTheme_v3, RootTheme} from '@sanity/ui/theme'
3
3
  import fs from 'fs/promises'
4
4
  import path from 'path'
5
5
 
6
6
  async function buildPalette(outDir: string) {
7
- const css = compilePalette(defaultPalette)
7
+ const css = compilePalette()
8
8
 
9
9
  await fs.mkdir(outDir, {recursive: true})
10
10
 
package/src/css/_comp.ts CHANGED
@@ -4,6 +4,7 @@ import {scopeClassName} from './scopeClassName'
4
4
  export function _comp(...classNames: Array<string | false | undefined>): string | undefined {
5
5
  return (
6
6
  getClassNames(...classNames)
7
+ .filter(Boolean)
7
8
  .map(scopeClassName)
8
9
  .join(' ') || undefined
9
10
  )
@@ -6,8 +6,8 @@ const util: StyleRules = {}
6
6
  _responsiveRule(util, 'flex-justify-flex-start', {justifyContent: 'flex-start'})
7
7
  _responsiveRule(util, 'flex-justify-flex-end', {justifyContent: 'flex-end'})
8
8
  _responsiveRule(util, 'flex-justify-center', {justifyContent: 'center'})
9
- _responsiveRule(util, 'flex-justify-between', {justifyContent: 'space-between'})
10
- _responsiveRule(util, 'flex-justify-around', {justifyContent: 'space-around'})
11
- _responsiveRule(util, 'flex-justify-evenly', {justifyContent: 'space-evenly'})
9
+ _responsiveRule(util, 'flex-justify-space-between', {justifyContent: 'space-between'})
10
+ _responsiveRule(util, 'flex-justify-space-around', {justifyContent: 'space-around'})
11
+ _responsiveRule(util, 'flex-justify-space-evenly', {justifyContent: 'space-evenly'})
12
12
 
13
13
  export const flexJustifyStyle: Style = {layers: {util}}
@@ -15,9 +15,9 @@ export type GridAutoCols = 'auto' | 'min' | 'max' | 'fr'
15
15
  */
16
16
  export type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense'
17
17
 
18
- export type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12
18
+ export type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
19
19
 
20
- export type Rows = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12
20
+ export type Rows = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
21
21
 
22
22
  /** @public */
23
23
  export interface GridStyleProps {
@@ -1,6 +1,6 @@
1
- import {composeClassNames} from '../../composeClassNames'
1
+ import {_comp} from '../../_comp'
2
2
  import {TextOverflowStyleProps} from './types'
3
3
 
4
4
  export function textOverflow(props: TextOverflowStyleProps): string | undefined {
5
- return composeClassNames(props.textOverflow && `text-overflow-${props.textOverflow}`)
5
+ return _comp(props.textOverflow && `text-overflow-${props.textOverflow}`)
6
6
  }
@@ -1,58 +1,25 @@
1
- import {HUES, PaletteConfig, TINTS} from '@sanity/ui/theme'
1
+ import {color} from '@sanity/color'
2
+ import {HUES, TINTS} from '@sanity/ui/theme'
2
3
 
3
4
  import {compileRule} from './compileRule'
4
5
 
5
- export function compilePalette(config: PaletteConfig): string {
6
+ export function compilePalette(): string {
6
7
  const props: Record<string, string> = {
7
- '--l-min': `${config.luminosity.min * 100}%`,
8
- '--l-max': `${config.luminosity.max * 100}%`,
9
- '--l-range': `calc(var(--l-max) - var(--l-min))`,
8
+ ...compileHues(),
10
9
 
11
- '--c-min': `${config.chroma.min}`,
12
- '--c-max': `${config.chroma.max}`,
13
- '--c-range': `calc(var(--c-max) - var(--c-min))`,
14
-
15
- ...compileHues(config.hues),
16
-
17
- '--black': `oklch(
18
- calc(var(--l-min) + 0.0 * var(--l-range))
19
- calc(var(--c-min) + 0.0 * var(--gray-c-range))
20
- var(--gray-h)
21
- )`,
22
-
23
- '--white': `oklch(
24
- calc(var(--l-min) + 1.0 * var(--l-range))
25
- calc(var(--c-min) + 0.0 * var(--gray-c-range))
26
- var(--gray-h)
27
- )`,
10
+ '--black': color.black.hex,
11
+ '--white': color.white.hex,
28
12
  }
29
13
 
30
14
  return compileRule(':root', props, {keyframes: {}, media: {}})
31
15
  }
32
16
 
33
- function compileHues(hues: PaletteConfig['hues']) {
17
+ function compileHues() {
34
18
  const rules: Record<string, string> = {}
35
19
 
36
20
  for (const hue of HUES) {
37
- const {c, h} = hues[hue]
38
-
39
- rules[`--${hue}-h`] = `${h}`
40
- rules[`--${hue}-c`] = `${c}`
41
- rules[`--${hue}-c-max`] = `min(var(--c-max), var(--${hue}-c))`
42
- rules[`--${hue}-c-range`] = `calc(var(--${hue}-c-max) - var(--c-min))`
43
-
44
21
  for (const tint of TINTS) {
45
- const l_offset = parseFloat((1 - tint / 1000).toFixed(2))
46
- const c_offset_tmp = tint / 500
47
- const c_offset = parseFloat((c_offset_tmp < 1 ? c_offset_tmp : 2 - c_offset_tmp).toFixed(1))
48
-
49
- rules[`--${hue}-${tint}`] = [
50
- `oklch(`,
51
- `calc(var(--l-min) + ${l_offset} * var(--l-range)) `,
52
- `calc(var(--c-min) + ${c_offset} * var(--${hue}-c-range)) `,
53
- `var(--${hue}-h)`,
54
- `)`,
55
- ].join('')
22
+ rules[`--${hue}-${tint}`] = color[hue][tint].hex
56
23
  }
57
24
  }
58
25
 
@@ -22,8 +22,6 @@ export function compileTheme_v3(theme: Theme_v3): string {
22
22
  }
23
23
 
24
24
  function compileThemeProperties(theme: Theme_v3): Properties {
25
- // const palette = defaultPalette
26
-
27
25
  return {
28
26
  ...buildAvatarThemeProperties(theme),
29
27
  ...buildButtonThemeProperties(theme),
@@ -36,26 +34,10 @@ function compileThemeProperties(theme: Theme_v3): Properties {
36
34
  ...buildRadiusThemeProperties(theme),
37
35
  ...buildShadowThemeProperties(theme),
38
36
  ...buildSpaceThemeProperties(theme),
39
- // ...buildColorPaletteProperties(palette),
40
37
  ...buildColorThemeProperties(theme),
41
38
  }
42
39
  }
43
40
 
44
- // function buildColorPaletteProperties(palette: Color): Properties {
45
- // const props: Properties = {
46
- // '--black': palette.black.hex,
47
- // '--white': palette.white.hex,
48
- // }
49
-
50
- // for (const hue of COLOR_HUES) {
51
- // for (const tint of COLOR_TINTS) {
52
- // props[`--${hue}-${tint}`] = palette[hue][tint].hex
53
- // }
54
- // }
55
-
56
- // return props
57
- // }
58
-
59
41
  function buildAvatarThemeProperties(theme: Theme_v3): Properties {
60
42
  return {
61
43
  [`--avatar-focus-ring-offset`]: px(theme.avatar.focusRing.offset),
package/src/css/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from '../theme/versioning/v3_v2'
1
+ export * from './aspects'
2
2
  export * from './compile/compilePalette'
3
3
  export * from './compile/compileSystem'
4
4
  export * from './compile/compileTheme'
@@ -27,13 +27,13 @@ export * from './primitives/popover'
27
27
  export * from './primitives/radio'
28
28
  export * from './primitives/select'
29
29
  export * from './primitives/spinner'
30
+ export * from './primitives/stack'
30
31
  export * from './primitives/switch'
31
32
  export * from './primitives/text'
32
33
  export * from './primitives/textArea'
33
34
  export * from './primitives/textInput'
34
35
  export * from './primitives/tooltip'
35
36
  export * from './scopeClassName'
36
- export * from './aspects'
37
37
  export * from './types'
38
38
  export * from './util'
39
39
  export * from './utils/srOnly'
@@ -1,7 +1,7 @@
1
1
  import {ThemeColorStateToneKey} from '@sanity/ui/theme'
2
2
 
3
3
  export const toneMap: Record<ThemeColorStateToneKey, string | undefined> = {
4
- default: 'surface',
4
+ default: 'default',
5
5
  neutral: 'neutral',
6
6
  suggest: 'suggest',
7
7
  primary: 'accent',
@@ -23,6 +23,9 @@ import {BoxStyleProps} from './types'
23
23
 
24
24
  /** @public */
25
25
  export function box(props: BoxStyleProps): string | undefined {
26
+ // props.align
27
+ // props.autoCols
28
+
26
29
  return _comp(
27
30
  'box',
28
31
  props.muted && 'muted', // todo: consider this naming
@@ -1,7 +1,7 @@
1
1
  import {ThemeColorButtonModeKey, ThemeColorStateToneKey} from '@sanity/ui/theme'
2
2
 
3
3
  export const toneMap: Record<ThemeColorStateToneKey, string | undefined> = {
4
- default: 'surface',
4
+ default: 'default',
5
5
  neutral: 'neutral',
6
6
  suggest: 'suggest',
7
7
  primary: 'accent',
@@ -24,6 +24,8 @@ const primitive: StyleRules = {
24
24
  'backgroundColor': vars.color.bg,
25
25
  'color': vars.color.fg,
26
26
  'boxShadow': 'var(--button-box-shadow)',
27
+ 'alignItems': 'center',
28
+ // 'justifyContent': 'center',
27
29
 
28
30
  '@nest': {
29
31
  '&::-moz-focus-inner': {
@@ -100,38 +102,35 @@ for (const tone of THEME_COLOR_STATE_TONES) {
100
102
 
101
103
  // mode: ghost
102
104
  primitive[`.button.${variantMap.ghost}.${toneMap[tone]}`] = {
103
- [varNames.color.bg]: tinted.bg[0],
104
- [varNames.color.border]: tinted.border[1],
105
+ [varNames.color.bg]: tinted.bg[1],
106
+ [varNames.color.border]: tinted.border[0],
105
107
  [varNames.color.fg]: tinted.fg[2],
106
- '--button-box-shadow': [
107
- `inset 0 0 0 var(--button-border-width) var(--color-border)`,
108
- `inset 0 -1.5px 0 0.5px var(--color-shadow-umbra)`,
109
- ].join(','),
108
+ '--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
110
109
 
111
110
  '@nest': {
112
111
  '&:not([data-disabled]):hover': {
113
- [varNames.color.bg]: tinted.bg[1],
114
- [varNames.color.border]: tinted.border[2],
112
+ [varNames.color.bg]: tinted.bg[2],
113
+ [varNames.color.border]: tinted.border[1],
115
114
  [varNames.color.fg]: tinted.fg[1],
116
115
  // '--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
117
116
  },
118
117
 
119
118
  '&:not([data-disabled]):active': {
120
- [varNames.color.bg]: tinted.bg[2],
121
- [varNames.color.border]: tinted.border[3],
119
+ [varNames.color.bg]: tinted.bg[3],
120
+ [varNames.color.border]: tinted.border[2],
122
121
  [varNames.color.fg]: tinted.fg[1],
123
122
  '--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
124
123
  },
125
124
 
126
125
  '&:not([data-disabled])[data-selected]': {
127
- [varNames.color.bg]: tinted.bg[2],
128
- [varNames.color.border]: tinted.border[3],
126
+ [varNames.color.bg]: tinted.bg[3],
127
+ [varNames.color.border]: tinted.border[2],
129
128
  [varNames.color.fg]: tinted.fg[1],
130
129
  '--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
131
130
  },
132
131
 
133
132
  '&[data-disabled]': {
134
- [varNames.color.bg]: vars.color.default.tinted.bg[0],
133
+ [varNames.color.bg]: vars.color.default.tinted.bg[1],
135
134
  [varNames.color.border]: vars.color.default.tinted.border[0],
136
135
  [varNames.color.fg]: vars.color.default.tinted.fg[2],
137
136
  },
@@ -1,8 +1,8 @@
1
1
  import {ThemeColorCardToneKey} from '@sanity/ui/theme'
2
2
 
3
3
  export const toneMap: Record<ThemeColorCardToneKey | 'inherit', string | undefined> = {
4
- transparent: 'canvas',
5
- default: 'surface',
4
+ transparent: 'transparent',
5
+ default: 'default',
6
6
  neutral: 'neutral',
7
7
  suggest: 'suggest',
8
8
  primary: 'accent',
@@ -6,7 +6,7 @@ import {CardStyleProps} from './types'
6
6
  export function card(props: CardStyleProps): string | undefined {
7
7
  return _comp(
8
8
  props.scheme,
9
- toneMap[props.tone ?? 'inherit'],
9
+ toneMap[props.tone ?? 'default'],
10
10
  'card',
11
11
  props.checkered && 'card-checkered',
12
12
  shadow(props),
@@ -0,0 +1 @@
1
+ export * from './stack'
@@ -0,0 +1,9 @@
1
+ import {Style, StyleRules} from '../../types'
2
+
3
+ const primitive: StyleRules = {
4
+ '.stack': {
5
+ gridTemplateColumns: 'minmax(0, 1fr)',
6
+ },
7
+ }
8
+
9
+ export const stackStyle: Style = {layers: {primitive}}
@@ -0,0 +1,6 @@
1
+ import {_comp} from '../../_comp'
2
+
3
+ /** @public */
4
+ export function stack(): string | undefined {
5
+ return _comp('stack')
6
+ }
@@ -56,6 +56,7 @@ import {popoverStyle} from './primitives/popover/popover.style'
56
56
  import {radioStyle} from './primitives/radio/radio.style'
57
57
  import {selectStyle} from './primitives/select/select.style'
58
58
  import {spinnerStyle} from './primitives/spinner/spinner.style'
59
+ import {stackStyle} from './primitives/stack/stack.style'
59
60
  import {switchStyle} from './primitives/switch/switch.style'
60
61
  import {textStyle} from './primitives/text/text.style'
61
62
  import {textAreaStyle} from './primitives/textArea/textArea.style'
@@ -136,6 +137,7 @@ export const systemStyle: Style = _mergeStyles([
136
137
  radioStyle,
137
138
  selectStyle,
138
139
  spinnerStyle,
140
+ stackStyle,
139
141
  switchStyle,
140
142
  textAreaStyle,
141
143
  textInputStyle,
@@ -1,6 +1,6 @@
1
1
  import {RootTheme_v2} from '../v2'
2
2
 
3
- const BORDER_WIDTH = 0.5
3
+ const BORDER_WIDTH = 1
4
4
  const OUTLINE_WIDTH = 0.5
5
5
 
6
6
  export const defaultThemeConfig: Omit<RootTheme_v2, 'color' | 'font'> = {
@@ -31,7 +31,7 @@ export const defaultThemeConfig: Omit<RootTheme_v2, 'color' | 'font'> = {
31
31
  popover: {zOffset: 400},
32
32
  tooltip: {zOffset: 200},
33
33
  },
34
- radius: [0, 1, 5, 9, 13, 17, 25, 45, 77, 129],
34
+ radius: [0, 1, 3, 7, 11, 15, 23, 43, 75, 127],
35
35
  shadow: [
36
36
  null,
37
37
  {umbra: [0, 0, 0, 0], penumbra: [0, 0, 0, 0], ambient: [0, 0, 0, 0]},
@@ -57,10 +57,10 @@ export const defaultThemeFonts: ThemeFonts = {
57
57
  'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
58
58
  featureSettings: `'liga' 1, 'calt' 1, 'ss01' 1, 'ss03' 1, 'zero' 1`,
59
59
  weights: {
60
- regular: 400,
61
- medium: 500,
62
- semibold: 600,
63
- bold: 700,
60
+ regular: 600,
61
+ medium: 700,
62
+ semibold: 800,
63
+ bold: 900,
64
64
  },
65
65
  sizes: [
66
66
  {
@@ -10,6 +10,4 @@ export const HUES = [
10
10
  'cyan',
11
11
  ] as const
12
12
 
13
- export const TINTS = [
14
- 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950,
15
- ] as const
13
+ export const TINTS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const
@@ -2,15 +2,3 @@ import {type HUES, type TINTS} from './constants'
2
2
 
3
3
  export type Hue = (typeof HUES)[number]
4
4
  export type Tint = (typeof TINTS)[number]
5
-
6
- export type PaletteConfig = {
7
- chroma: {
8
- min: number
9
- max: number
10
- }
11
- luminosity: {
12
- min: number
13
- max: number
14
- }
15
- hues: Record<Hue, {h: number; c: number}>
16
- }
@@ -1,7 +1,7 @@
1
1
  import {defaultThemeConfig} from '../defaults/config'
2
2
  import {defaultThemeFonts} from '../defaults/fonts'
3
3
  import {buildColor_v3} from './color/buildColor_v3'
4
- import {defaultPalette, defaultTokens} from './defaults'
4
+ import {defaultTokens} from './defaults'
5
5
  import {resolveTokens} from './resolveTokens'
6
6
  import {Theme_v3, ThemeOptions} from './types'
7
7
 
@@ -12,7 +12,6 @@ export function buildTheme_v3(options?: ThemeOptions): Theme_v3 {
12
12
 
13
13
  return {
14
14
  _version: 3,
15
- _palette: options?.palette ?? defaultPalette,
16
15
  _tokens: tokens,
17
16
  avatar: v2?.avatar ?? defaultThemeConfig.avatar,
18
17
  button: v2?.button ?? defaultThemeConfig.button,
@@ -1,22 +1,5 @@
1
- import {PaletteConfig} from '../palette'
2
1
  import {PartialTokens, Tokens} from './tokens'
3
2
 
4
- export const defaultPalette: PaletteConfig = {
5
- chroma: {min: 0.005, max: 0.2325},
6
- luminosity: {min: 0.1875, max: 1},
7
- hues: {
8
- gray: {h: 277, c: 0.04},
9
- blue: {h: 273, c: 0.185},
10
- purple: {h: 295, c: 0.4},
11
- magenta: {h: 12, c: 0.4},
12
- red: {h: 30, c: 0.4},
13
- orange: {h: 68, c: 0.4},
14
- yellow: {h: 90, c: 0.4},
15
- green: {h: 171, c: 0.4},
16
- cyan: {h: 194, c: 0.4},
17
- },
18
- }
19
-
20
3
  export const defaultTokens: PartialTokens<Tokens> = {
21
4
  color: {
22
5
  '*': {
@@ -73,12 +56,12 @@ export const defaultTokens: PartialTokens<Tokens> = {
73
56
  tinted: {
74
57
  '*': {
75
58
  bg: {
76
- 0: ['900', '50'],
77
- 4: ['800', '150'],
59
+ 0: ['950', '50'],
60
+ 4: ['800', '100'],
78
61
  },
79
62
  border: {
80
- 0: ['800', '150'],
81
- 4: ['600', '350'],
63
+ 0: ['800', '100'],
64
+ 4: ['600', '300'],
82
65
  },
83
66
  fg: {
84
67
  0: ['100', '900'],
@@ -150,15 +133,15 @@ export const defaultTokens: PartialTokens<Tokens> = {
150
133
  '*': {
151
134
  bg: {
152
135
  0: ['black', 'gray/50'],
153
- 4: ['900', '150'],
136
+ 4: ['800', '300 50%'],
154
137
  },
155
138
  border: {
156
- 0: ['900', '150'],
157
- 4: ['700', '350'],
139
+ 0: ['900', '300 40%'],
140
+ 4: ['700', '300'],
158
141
  },
159
142
  fg: {
160
- 0: ['150', 'black'],
161
- 4: ['550', '600'],
143
+ 0: ['100', 'black'],
144
+ 4: ['500', '600'],
162
145
  },
163
146
  },
164
147
  },
@@ -170,11 +153,11 @@ export const defaultTokens: PartialTokens<Tokens> = {
170
153
  '*': {
171
154
  bg: {
172
155
  0: ['gray/950', 'white'],
173
- 4: ['850', '100'],
156
+ 4: ['800', '200'],
174
157
  },
175
158
  border: {
176
- 0: ['850', '100'],
177
- 4: ['650', '300'],
159
+ 0: ['800', '100'],
160
+ 4: ['600', '300'],
178
161
  },
179
162
  fg: {
180
163
  0: ['white', 'black'],
@@ -201,5 +184,3 @@ export const defaultTokens: PartialTokens<Tokens> = {
201
184
  },
202
185
  },
203
186
  }
204
-
205
- // export const defaultTheme = buildTheme_v3()
@@ -1,5 +1,4 @@
1
1
  import {ThemeConfig} from '../config'
2
- import {PaletteConfig} from '../palette'
3
2
  import {ThemeFocusRing, ThemeFonts, ThemeFontWeightKey, ThemeLayer, ThemeShadow} from '../v0'
4
3
  import {ThemeAvatar_v2, ThemeInput_v2} from '../v2'
5
4
  import {ThemeColor_v3} from './color'
@@ -11,7 +10,6 @@ export type ThemeEntry = [`--${string}`, string]
11
10
  /** @public */
12
11
  export interface ThemeOptions {
13
12
  v2?: ThemeConfig
14
- palette?: PaletteConfig
15
13
  tokens?: PartialTokens<Tokens>
16
14
  }
17
15
 
@@ -22,7 +20,6 @@ export interface ThemeOptions {
22
20
  */
23
21
  export interface Theme_v3 {
24
22
  _version: 3
25
- _palette: PaletteConfig
26
23
  _tokens: Tokens
27
24
  avatar: ThemeAvatar_v2
28
25
  button: {
@@ -11,7 +11,7 @@ export function StyleTags(props: {theme?: Theme_v3}): ReactNode {
11
11
  return (
12
12
  <>
13
13
  <style href="sanity-palette" precedence="palette">
14
- {compilePalette(theme._palette)}
14
+ {compilePalette()}
15
15
  </style>
16
16
  <style href="sanity-theme" precedence="theme">
17
17
  {compileTheme({v3: theme} as RootTheme)}
@@ -32,6 +32,9 @@ export const Box = forwardRef(function Box(
32
32
  const {
33
33
  align,
34
34
  as: As = 'div',
35
+ autoCols,
36
+ autoFlow,
37
+ autoRows,
35
38
  border,
36
39
  borderTop,
37
40
  borderRight,
@@ -93,6 +96,9 @@ export const Box = forwardRef(function Box(
93
96
  className,
94
97
  box({
95
98
  align,
99
+ autoCols,
100
+ autoFlow,
101
+ autoRows,
96
102
  border,
97
103
  borderTop,
98
104
  borderRight,
@@ -14,7 +14,6 @@ import {FontTextSize, Space} from '@sanity/ui/theme'
14
14
  import {ElementType, ForwardedRef, forwardRef, isValidElement, ReactNode} from 'react'
15
15
  import {isValidElementType} from 'react-is'
16
16
 
17
- // import {useTheme_v2} from '../../_compat'
18
17
  import {ButtonMode, ButtonTextAlign, ButtonTone, Props} from '../../types'
19
18
  import {Box} from '../box'
20
19
  import {Spinner} from '../spinner'
@@ -84,7 +83,7 @@ export const Button = forwardRef(function Button(
84
83
  paddingBottom,
85
84
  paddingLeft,
86
85
  paddingRight,
87
- radius = 3,
86
+ radius = 2,
88
87
  selected,
89
88
  space = props.gap ?? props.space ?? props.padding ?? 3, // eslint-disable-line @typescript-eslint/no-unused-vars
90
89
  text,
@@ -114,12 +113,12 @@ export const Button = forwardRef(function Button(
114
113
  >
115
114
  {Boolean(loading) && (
116
115
  <Box
117
- align={align}
116
+ align="center"
118
117
  as="span"
119
118
  className={buttonLoadingBox()}
120
119
  display="flex"
121
120
  flex={1}
122
- justify={justify}
121
+ justify="center"
123
122
  width="fill"
124
123
  >
125
124
  <Spinner size={fontSize} />
@@ -128,6 +127,7 @@ export const Button = forwardRef(function Button(
128
127
 
129
128
  {(IconComponent || text || IconRightComponent) && (
130
129
  <Box
130
+ // align={align}
131
131
  as="span"
132
132
  direction={direction}
133
133
  display="flex"
@@ -143,8 +143,8 @@ export const Button = forwardRef(function Button(
143
143
  paddingBottom={paddingBottom}
144
144
  paddingLeft={paddingLeft}
145
145
  paddingRight={paddingRight}
146
- width="fill"
147
- wrap={wrap}
146
+ // width="fill"
147
+ // wrap={wrap}
148
148
  >
149
149
  {IconComponent && (
150
150
  <Text as="span" flex="none" muted size={fontSize}>
@@ -161,7 +161,6 @@ export const Button = forwardRef(function Button(
161
161
  muted={muted}
162
162
  size={fontSize}
163
163
  textOverflow={textOverflow}
164
- // weight={textWeight ?? buttonTheme.textWeight}
165
164
  weight={textWeight}
166
165
  >
167
166
  {text}
@@ -179,13 +178,15 @@ export const Button = forwardRef(function Button(
179
178
 
180
179
  {children && (
181
180
  <Box
181
+ // align={align}
182
182
  as="span"
183
- direction={direction}
184
- display="flex"
183
+ // direction={direction}
184
+ // display="flex"
185
185
  flex={1}
186
186
  gap={gap}
187
187
  gapX={gapX}
188
188
  gapY={gapY}
189
+ // justify={justify}
189
190
  padding={padding}
190
191
  paddingX={paddingX}
191
192
  paddingY={paddingY}
@@ -193,8 +194,8 @@ export const Button = forwardRef(function Button(
193
194
  paddingBottom={paddingBottom}
194
195
  paddingLeft={paddingLeft}
195
196
  paddingRight={paddingRight}
196
- width="fill"
197
- wrap={wrap}
197
+ // width="fill"
198
+ // wrap={wrap}
198
199
  >
199
200
  {children}
200
201
  </Box>