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

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 (44) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +50 -50
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +51 -51
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/css.d.mts +11 -1
  7. package/dist/css.d.ts +11 -1
  8. package/dist/css.js +324 -309
  9. package/dist/css.js.map +1 -1
  10. package/dist/css.mjs +324 -309
  11. package/dist/css.mjs.map +1 -1
  12. package/dist/index.js +3 -13
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +3 -13
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/sanity-theme.css +1 -1
  17. package/dist/system.css +229 -10
  18. package/dist/theme.js +1 -1
  19. package/dist/theme.js.map +1 -1
  20. package/dist/theme.mjs +1 -1
  21. package/dist/theme.mjs.map +1 -1
  22. package/package.json +1 -1
  23. package/src/css/aspects/index.ts +1 -0
  24. package/src/css/aspects/minWidth/index.ts +2 -0
  25. package/src/css/aspects/minWidth/minWidth.style.ts +13 -0
  26. package/src/css/aspects/minWidth/minWidth.ts +6 -0
  27. package/src/css/aspects/minWidth/types.ts +7 -0
  28. package/src/css/compile/compileRule.ts +1 -0
  29. package/src/css/compile/compileStyle.ts +1 -1
  30. package/src/css/primitives/box/box.style.ts +1 -1
  31. package/src/css/primitives/box/box.ts +2 -3
  32. package/src/css/primitives/box/types.ts +2 -0
  33. package/src/css/primitives/card/card.style.ts +69 -3
  34. package/src/css/primitives/card/types.ts +0 -1
  35. package/src/css/primitives/popover/popover.ts +4 -0
  36. package/src/css/primitives/switch/switch.style.ts +8 -83
  37. package/src/css/system.style.ts +2 -0
  38. package/src/theme/v3/defaults.ts +1 -1
  39. package/src/ui/components/autocomplete/autocomplete.tsx +2 -11
  40. package/src/ui/primitives/box/box.tsx +3 -2
  41. package/src/ui/primitives/card/card.tsx +2 -6
  42. package/src/ui/primitives/kbd/kbd.tsx +2 -2
  43. package/src/ui/primitives/popover/popoverCard.tsx +45 -39
  44. package/src/css/primitives/card/rules.ts +0 -473
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "3.0.0-static.6",
3
+ "version": "3.0.0-static.7",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -10,6 +10,7 @@ export * from './height'
10
10
  export * from './inset'
11
11
  export * from './margin'
12
12
  export * from './maxWidth'
13
+ export * from './minWidth'
13
14
  export * from './overflow'
14
15
  export * from './padding'
15
16
  export * from './pointerEvents'
@@ -0,0 +1,2 @@
1
+ export * from './minWidth'
2
+ export * from './types'
@@ -0,0 +1,13 @@
1
+ import {_responsiveRule} from '../../_responsiveRule'
2
+ import type {Style, StyleRules} from '../../types'
3
+
4
+ const util: StyleRules = {}
5
+
6
+ _responsiveRule(util, 'min-w-0', {minWidth: '0'})
7
+ _responsiveRule(util, 'min-w-auto', {minWidth: 'auto'})
8
+ _responsiveRule(util, 'min-w-full', {minWidth: '100%'})
9
+ _responsiveRule(util, 'min-w-min', {minWidth: 'min-content'})
10
+ _responsiveRule(util, 'min-w-max', {minWidth: 'max-content'})
11
+ _responsiveRule(util, 'min-w-fit', {minWidth: 'fit-content'})
12
+
13
+ export const minWidthStyle: Style = {layers: {util}}
@@ -0,0 +1,6 @@
1
+ import {_resp} from '../../_resp'
2
+ import {MinWidthStyleProps} from './types'
3
+
4
+ export function minWidth(props: MinWidthStyleProps): string {
5
+ return _resp('min-w', props.minWidth) ?? ''
6
+ }
@@ -0,0 +1,7 @@
1
+ import {ResponsiveProp} from '../../types'
2
+
3
+ export type MinWidth = 0 | 'auto' | 'full' | 'min' | 'max' | 'fit'
4
+
5
+ export interface MinWidthStyleProps {
6
+ minWidth?: ResponsiveProp<MinWidth>
7
+ }
@@ -2,6 +2,7 @@ import {PREFIX} from '../constants'
2
2
  import {type Properties} from '../types'
3
3
  import {CompileRulesContext} from './types'
4
4
 
5
+ // TODO: remove this
5
6
  export function compileRule(
6
7
  selector: string,
7
8
  props: Properties,
@@ -112,7 +112,7 @@ function compileStyleRule(_selector: string, properties: Properties): string {
112
112
  ? _nestedSelector.replace(/\./g, `.${PREFIX}`)
113
113
  : _nestedSelector
114
114
 
115
- css += `${nestedSelector.replace('&', selector)} {\n`
115
+ css += `${nestedSelector.replace(/&/g, selector)} {\n`
116
116
  css += compileProperties(nestedProperties)
117
117
  css += '}\n\n'
118
118
  }
@@ -3,7 +3,7 @@ import {vars} from '../../vars'
3
3
 
4
4
  const primitive: StyleRules = {
5
5
  '.box': {
6
- 'minWidth': 0,
6
+ // todo: move to aspects
7
7
  'minHeight': 0,
8
8
 
9
9
  '@nest': {
@@ -12,6 +12,7 @@ import {
12
12
  inset,
13
13
  margin,
14
14
  maxWidth,
15
+ minWidth,
15
16
  overflow,
16
17
  padding,
17
18
  pointerEvents,
@@ -23,9 +24,6 @@ import {BoxStyleProps} from './types'
23
24
 
24
25
  /** @public */
25
26
  export function box(props: BoxStyleProps): string | undefined {
26
- // props.align
27
- // props.autoCols
28
-
29
27
  return _comp(
30
28
  'box',
31
29
  props.muted && 'muted', // todo: consider this naming
@@ -42,6 +40,7 @@ export function box(props: BoxStyleProps): string | undefined {
42
40
  inset(props),
43
41
  margin(props),
44
42
  maxWidth(props),
43
+ minWidth(props),
45
44
  props.outline && `outline-${props.outline}`,
46
45
  overflow(props),
47
46
  padding(props),
@@ -10,6 +10,7 @@ import {
10
10
  InsetStyleProps,
11
11
  MarginStyleProps,
12
12
  MaxWidthStyleProps,
13
+ MinWidthStyleProps,
13
14
  OverflowStyleProps,
14
15
  PaddingStyleProps,
15
16
  PointerEventsStyleProps,
@@ -37,6 +38,7 @@ export interface BoxStyleProps
37
38
  InsetStyleProps,
38
39
  MarginStyleProps,
39
40
  MaxWidthStyleProps,
41
+ MinWidthStyleProps,
40
42
  OverflowStyleProps,
41
43
  PaddingStyleProps,
42
44
  PointerEventsStyleProps,
@@ -22,7 +22,7 @@ const primitive: StyleRules = {
22
22
  [varNames.color.muted.fg]: vars.color.tinted.default.fg[4],
23
23
 
24
24
  '@nest': {
25
- '&:is(button)': {
25
+ 'button&': {
26
26
  WebkitFontSmoothing: 'inherit',
27
27
  appearance: 'none',
28
28
  outline: 'none',
@@ -33,15 +33,81 @@ const primitive: StyleRules = {
33
33
  width: ['-moz-available', '-webkit-fill-available', 'fill-available'],
34
34
  },
35
35
 
36
- '&:is(a)': {
36
+ 'a&': {
37
37
  outline: 'none',
38
38
  textDecoration: 'none',
39
39
  },
40
40
 
41
- '&:is(pre)': {
41
+ 'pre&': {
42
42
  font: 'inherit',
43
43
  whiteSpace: 'inherit',
44
44
  },
45
+
46
+ 'a&:not([data-disabled]):hover, button&:not([data-disabled]):hover': {
47
+ [varNames.color.bg]: vars.color.tinted.default.bg[1],
48
+ [varNames.color.border]: vars.color.tinted.default.border[3],
49
+ [varNames.color.fg]: vars.color.tinted.default.fg[1],
50
+ [varNames.color.muted.bg]: vars.color.tinted.default.bg[2],
51
+ [varNames.color.muted.fg]: vars.color.tinted.default.fg[4],
52
+ },
53
+
54
+ 'a&:not([data-disabled]):active, button&:not([data-disabled]):active': {
55
+ [varNames.color.bg]: vars.color.tinted.default.bg[2],
56
+ [varNames.color.border]: vars.color.tinted.default.border[4],
57
+ [varNames.color.fg]: vars.color.tinted.default.fg[0],
58
+ [varNames.color.muted.bg]: vars.color.tinted.default.bg[3],
59
+ [varNames.color.muted.fg]: vars.color.tinted.default.fg[4],
60
+ },
61
+
62
+ // toggle button
63
+ 'a&:not([data-disabled])[aria-pressed="true"], button&:not([data-disabled])[aria-pressed="true"]':
64
+ {
65
+ [varNames.color.bg]: vars.color.tinted.default.bg[2],
66
+ [varNames.color.border]: vars.color.tinted.default.border[4],
67
+ [varNames.color.fg]: vars.color.tinted.default.fg[0],
68
+ [varNames.color.muted.bg]: vars.color.tinted.default.bg[3],
69
+ [varNames.color.muted.fg]: vars.color.tinted.default.fg[4],
70
+ },
71
+
72
+ 'a&:not([data-disabled])[data-pressed], button&:not([data-disabled])[data-pressed]': {
73
+ [varNames.color.bg]: vars.color.tinted.default.bg[2],
74
+ [varNames.color.border]: vars.color.tinted.default.border[4],
75
+ [varNames.color.fg]: vars.color.tinted.default.fg[0],
76
+ [varNames.color.muted.bg]: vars.color.tinted.default.bg[3],
77
+ [varNames.color.muted.fg]: vars.color.tinted.default.fg[4],
78
+ },
79
+
80
+ 'a&:not([data-disabled])[data-selected], button&:not([data-disabled])[data-selected]': {
81
+ [varNames.color.bg]: vars.color.solid.primary.bg[0],
82
+ [varNames.color.border]: vars.color.solid.primary.border[1],
83
+ [varNames.color.fg]: vars.color.solid.primary.fg[0],
84
+ [varNames.color.muted.bg]: vars.color.solid.primary.bg[1],
85
+ [varNames.color.muted.fg]: vars.color.solid.primary.fg[3],
86
+ },
87
+
88
+ // '&:not([data-disabled]):focus': {
89
+ // '--color-bg': vars.color.solid.bg[0],
90
+ // '--color-border': vars.color.solid.border[1],
91
+ // '--color-fg': vars.color.solid.fg[1],
92
+ // '--color-muted-bg': vars.color.solid.bg[1],
93
+ // '--color-muted-fg': vars.color.solid.fg[3],
94
+ // },
95
+
96
+ 'a&[data-disabled]), button&[data-disabled]': {
97
+ [varNames.color.bg]: vars.color.tinted.default.bg[2],
98
+ [varNames.color.border]: vars.color.tinted.default.border[4],
99
+ [varNames.color.fg]: vars.color.tinted.default.fg[0],
100
+ [varNames.color.muted.bg]: vars.color.tinted.default.bg[3],
101
+ [varNames.color.muted.fg]: vars.color.tinted.default.fg[4],
102
+ },
103
+
104
+ // '&[data-disabled]': {
105
+ // '--color-bg': vars.color.tinted.bg[0],
106
+ // '--color-border': vars.color.tinted.border[1],
107
+ // '--color-fg': vars.color.tinted.border[4],
108
+ // '--color-muted-bg': vars.color.tinted.bg[1],
109
+ // '--color-muted-fg': vars.color.tinted.border[4],
110
+ // },
45
111
  },
46
112
  },
47
113
  }
@@ -5,7 +5,6 @@ import {BoxStyleProps} from '../box'
5
5
 
6
6
  export interface CardStyleProps extends BoxStyleProps, ShadowStyleProps {
7
7
  checkered?: boolean
8
- selectable?: boolean
9
8
  scheme?: ThemeColorSchemeKey
10
9
  tone?: ThemeColorCardToneKey | 'inherit'
11
10
  }
@@ -3,3 +3,7 @@ import {_comp} from '../../_comp'
3
3
  export function popover(): string | undefined {
4
4
  return _comp('popover')
5
5
  }
6
+
7
+ export function popoverCard(): string | undefined {
8
+ return _comp('popover-card')
9
+ }
@@ -16,22 +16,16 @@ const primitive: StyleRules = {
16
16
  padding: 0,
17
17
  margin: 0,
18
18
 
19
- /* Place the input element above the representation element */
19
+ // place the input element on top of the representation element
20
20
  zIndex: 1,
21
21
  },
22
22
 
23
23
  '.switch-presentation': {
24
24
  '--switch-bg-color': 'var(--color-tinted-default-border-2)',
25
- // '--switch-border-color': 'var(--color-tinted-default-border-1)',
26
25
  '--switch-fg-color': 'var(--color-tinted-default-bg-0)',
27
- // --switch-bg-color: ${color.input.default.enabled.border};
28
- // --switch-fg-color: ${color.input.default.enabled.bg};
29
26
  '--switch-thumb-offset': '0',
30
27
  '--switch-thumb-size': 'calc(var(--input-switch-height) - var(--input-switch-padding) * 2)',
31
28
  'display': 'block',
32
- // &:not([hidden]) {
33
- // display: block;
34
- // }
35
29
  'position': 'relative',
36
30
  'width': 'var(--input-switch-width)',
37
31
  'height': 'var(--input-switch-height)',
@@ -42,59 +36,29 @@ const primitive: StyleRules = {
42
36
  'pointerEvents': 'none',
43
37
 
44
38
  '@nest': {
45
- // '&::after': {
46
- // content: '""',
47
- // display: 'block',
48
- // position: 'absolute',
49
- // top: 0,
50
- // left: 0,
51
- // right: 0,
52
- // bottom: 0,
53
- // zIndex: 1,
54
- // // boxShadow: 'var(--switch-box-shadow)',
55
- // borderRadius: 'inherit',
56
- // },
57
39
  '.switch-element:focus + &': {
58
- // --switch-box-shadow: ${focusRingStyle({focusRing: input.switch.focusRing})};
59
40
  outline: 'var(--input-switch-focus-ring-width) solid var(--color-focus-ring)',
60
41
  },
42
+
61
43
  'input:focus:not(:focus-visible) + &': {
62
44
  outline: 'none',
63
45
  },
46
+
64
47
  'input:checked + &': {
65
48
  '--switch-bg-color': 'var(--color-solid-default-bg-0)',
66
- // '--switch-border-color': 'var(--color-solid-default-bg-0)',
67
49
  '--switch-fg-color': 'var(--color-solid-default-fg-0)',
68
50
  },
69
- // input:not([data-read-only]):disabled + && {
70
- // --switch-bg-color: ${color.input.default.disabled.border};
71
- // --switch-fg-color: ${color.input.default.disabled.bg};
72
- // }
73
- // input[data-read-only]:disabled + && {
74
- // --switch-bg-color: ${color.input.default.readOnly.border};
75
- // --switch-fg-color: ${color.input.default.readOnly.bg};
76
- // }
77
- // input:checked[data-read-only]:disabled + && {
78
- // --switch-bg-color: ${color.input.default.readOnly.fg};
79
- // --switch-fg-color: ${color.input.default.readOnly.bg};
80
- // }
81
51
 
82
52
  '.switch-element:checked + &': {
83
53
  '--switch-thumb-offset':
84
54
  'calc(var(--input-switch-width) - (var(--input-switch-padding) * 2) - var(--switch-thumb-size))',
85
55
  },
86
- },
87
56
 
88
- // @media (hover: hover) {
89
- // input:not(:disabled):hover + && {
90
- // --switch-bg-color: ${color.input.default.hovered.border};
91
- // --switch-fg-color: ${color.input.default.hovered.bg};
92
- // }
93
- // input:not(:disabled):checked:hover + && {
94
- // --switch-bg-color: ${color.input.default.enabled.fg};
95
- // --switch-fg-color: ${color.input.default.enabled.bg};
96
- // }
97
- // }
57
+ '[data-indeterminate] > .switch-element + &': {
58
+ '--switch-thumb-offset':
59
+ 'calc(var(--input-switch-width) / 2 - var(--switch-thumb-size) / 2 - var(--input-switch-padding))',
60
+ },
61
+ },
98
62
  },
99
63
 
100
64
  '.switch-track': {
@@ -106,15 +70,12 @@ const primitive: StyleRules = {
106
70
  right: 0,
107
71
  bottom: 0,
108
72
  borderRadius: 'inherit',
109
- // boxShadow: 'inset 0 0 0 1px var(--switch-border-color)',
110
73
 
111
74
  transition:
112
75
  'box-shadow, background-color var(--input-switch-transition-duration-ms) var(--input-switch-transition-timing-function)',
113
76
  },
114
77
 
115
78
  '.switch-thumb': {
116
- // '--switch-thumb-offset': '0',
117
-
118
79
  display: 'block',
119
80
  position: 'absolute',
120
81
  left: 'var(--input-switch-padding)',
@@ -127,42 +88,6 @@ const primitive: StyleRules = {
127
88
  transform: 'translate3d(var(--switch-thumb-offset), 0, 0)',
128
89
  transition:
129
90
  'transform var(--input-switch-transition-duration-ms) var(--input-switch-transition-timing-function)',
130
- // transition-property: transform;
131
- // transition-duration: ${input.switch.transitionDurationMs}ms;
132
- // transition-timing-function: ${input.switch.transitionTimingFunction};
133
-
134
- // const {$indeterminate} = props
135
- // const {input} = getTheme_v2(props.theme)
136
- // const trackWidth = input.switch.width
137
- // const trackHeight = input.switch.height
138
- // const trackPadding = input.switch.padding
139
- // const size = trackHeight - input.switch.padding * 2
140
- // const checkedOffset = trackWidth - trackPadding * 2 - size
141
- // const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding
142
- // const checked = $indeterminate !== true && props.$checked === true
143
- // return css`
144
-
145
- // position: absolute;
146
- // left: ${rem(trackPadding)};
147
- // top: ${rem(trackPadding)};
148
- // height: ${rem(size)};
149
- // width: ${rem(size)};
150
- // border-radius: ${rem(size / 2)};
151
- // transition-property: transform;
152
- // transition-duration: ${input.switch.transitionDurationMs}ms;
153
- // transition-timing-function: ${input.switch.transitionTimingFunction};
154
- // background: var(--switch-fg-color);
155
- // transform: translate3d(0, 0, 0);
156
- // box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.05);
157
- // ${checked &&
158
- // css`
159
- // transform: translate3d(${checkedOffset}px, 0, 0);
160
- // `}
161
- // ${$indeterminate &&
162
- // css`
163
- // transform: translate3d(${indeterminateOffset}px, 0, 0);
164
- // `}
165
- // `
166
91
  },
167
92
  }
168
93
 
@@ -23,6 +23,7 @@ import {heightStyle} from './aspects/height/height.style'
23
23
  import {insetStyle} from './aspects/inset/inset.style'
24
24
  import {marginStyle} from './aspects/margin/margin.style'
25
25
  import {maxWidthStyle} from './aspects/maxWidth/maxWidth.style'
26
+ import {minWidthStyle} from './aspects/minWidth/minWidth.style'
26
27
  import {outlineStyle} from './aspects/outline/outline.style'
27
28
  import {overflowStyle} from './aspects/overflow/overflow.style'
28
29
  import {paddingStyle} from './aspects/padding/padding.style'
@@ -104,6 +105,7 @@ export const systemStyle: Style = _mergeStyles([
104
105
  insetStyle,
105
106
  marginStyle,
106
107
  maxWidthStyle,
108
+ minWidthStyle,
107
109
  outlineStyle,
108
110
  overflowStyle,
109
111
  paddingStyle,
@@ -5,7 +5,7 @@ export const defaultTokens: PartialTokens<Tokens> = {
5
5
  '*': {
6
6
  // backdrop: ['black/0.2', '200/0.2'],
7
7
  backdrop: ['black/0.5', 'gray/100/0.5'],
8
- focusRing: ['blue/500', 'blue/300'],
8
+ focusRing: ['blue/500', 'blue/500'],
9
9
  link: {
10
10
  fg: ['blue/400', 'blue/600'],
11
11
  },
@@ -128,7 +128,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
128
128
  customValidity,
129
129
  disabled,
130
130
  filterOption: filterOptionProp,
131
- fontSize = 1,
131
+ fontSize = 2,
132
132
  icon,
133
133
  id,
134
134
  listBox = EMPTY_RECORD,
@@ -167,14 +167,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
167
167
 
168
168
  const defaultRenderOption = useCallback(
169
169
  ({value}: BaseAutocompleteOption) => (
170
- <Card
171
- as="button"
172
- // data-as="button"
173
- padding={paddingProp}
174
- radius={2}
175
- selectable
176
- // tone="inherit"
177
- >
170
+ <Card as="button" padding={paddingProp} radius={2} tone="inherit">
178
171
  <Text size={fontSize} textOverflow="ellipsis">
179
172
  {value}
180
173
  </Text>
@@ -619,7 +612,6 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
619
612
  {cloneElement(renderOption(option), {
620
613
  disabled: loading,
621
614
  selected: active,
622
- selectable: true,
623
615
  tabIndex: listFocused && active ? 0 : -1,
624
616
  })}
625
617
  </AutocompleteOption>
@@ -686,7 +678,6 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
686
678
  handlePopoverMouseEnter,
687
679
  handlePopoverMouseLeave,
688
680
  popover,
689
- radius,
690
681
  renderPopover,
691
682
  ])
692
683
 
@@ -66,6 +66,7 @@ export const Box = forwardRef(function Box(
66
66
  marginBottom,
67
67
  marginLeft,
68
68
  maxWidth,
69
+ minWidth = 0,
69
70
  overflow,
70
71
  padding = 0,
71
72
  paddingX,
@@ -82,7 +83,7 @@ export const Box = forwardRef(function Box(
82
83
  rows,
83
84
  rowStart,
84
85
  rowEnd,
85
- sizing = 'border',
86
+ sizing = 'content',
86
87
  width,
87
88
  wrap,
88
89
  ...restProps
@@ -130,6 +131,7 @@ export const Box = forwardRef(function Box(
130
131
  marginBottom,
131
132
  marginLeft,
132
133
  maxWidth,
134
+ minWidth,
133
135
  muted,
134
136
  padding,
135
137
  paddingX,
@@ -150,7 +152,6 @@ export const Box = forwardRef(function Box(
150
152
  wrap,
151
153
  }),
152
154
  )}
153
- // data-gap={gap}
154
155
  ref={ref}
155
156
  >
156
157
  {props.children}
@@ -1,4 +1,4 @@
1
- import {_selectable, card, CardStyleProps, composeClassNames} from '@sanity/ui/css'
1
+ import {card, CardStyleProps, composeClassNames} from '@sanity/ui/css'
2
2
  import {createElement, ForwardedRef, forwardRef} from 'react'
3
3
  import {isValidElementType} from 'react-is'
4
4
 
@@ -46,7 +46,7 @@ export const Card = forwardRef(function Card(
46
46
  pressed,
47
47
  radius = 0,
48
48
  scheme: schemeProp,
49
- selectable,
49
+ // selectable,
50
50
  selected,
51
51
  shadow,
52
52
  style,
@@ -78,15 +78,11 @@ export const Card = forwardRef(function Card(
78
78
  shadow,
79
79
  tone,
80
80
  }),
81
- selectable && _selectable({radius}),
82
81
  )}
83
- data-context-tone={context.tone}
84
- data-context-scheme={context.scheme}
85
82
  data-checkered={checkered ? '' : undefined}
86
83
  data-focus-ring={focusRing ? '' : undefined}
87
84
  data-pressed={pressed ? '' : undefined}
88
85
  data-selected={selected ? '' : undefined}
89
- data-tone={tone}
90
86
  radius={radius}
91
87
  ref={ref}
92
88
  style={style}
@@ -28,7 +28,7 @@ export const KBD = forwardRef(function KBD(
28
28
  children,
29
29
  className,
30
30
  display = 'inline-block',
31
- fontSize = 1,
31
+ fontSize = 0,
32
32
  padding = 1,
33
33
  radius = 2,
34
34
  ...restProps
@@ -45,7 +45,7 @@ export const KBD = forwardRef(function KBD(
45
45
  padding={padding}
46
46
  ref={ref}
47
47
  >
48
- <Text as="span" muted size={fontSize}>
48
+ <Text as="span" muted size={fontSize} weight="semibold">
49
49
  {children}
50
50
  </Text>
51
51
  </Box>
@@ -1,11 +1,12 @@
1
1
  import {Strategy} from '@floating-ui/react-dom'
2
+ import {popoverCard} from '@sanity/ui/css'
2
3
  import {motion, MotionProps} from 'framer-motion'
3
4
  import {CSSProperties, ForwardedRef, forwardRef, memo, useMemo} from 'react'
4
5
 
5
6
  import {POPOVER_MOTION_PROPS} from '../../constants'
6
7
  import {Placement, PopoverMargins, Props} from '../../types'
7
8
  import {Arrow, useLayer} from '../../utils'
8
- import {Card, CardProps} from '../card'
9
+ import {Card, CardProps, CardProvider, useCard} from '../card'
9
10
  import {Flex} from '../flex'
10
11
  import {
11
12
  DEFAULT_POPOVER_ARROW_HEIGHT,
@@ -69,6 +70,8 @@ export const PopoverCard = memo(
69
70
  ...restProps
70
71
  } = props
71
72
 
73
+ const card = useCard()
74
+
72
75
  const layer = useLayer()
73
76
 
74
77
  // Get margins: [top, right, bottom, left]
@@ -107,48 +110,51 @@ export const PopoverCard = memo(
107
110
  )
108
111
 
109
112
  return (
110
- <MotionCard
111
- className="popover-card"
112
- data-ui="Popover"
113
- {...(restProps as CardProps & MotionProps)}
114
- data-placement={placement}
115
- direction="column"
116
- display="flex"
117
- radius={radius}
118
- ref={ref}
119
- scheme={scheme}
120
- shadow={shadow}
121
- sizing="border"
122
- style={rootStyle}
123
- tone={tone}
124
- variants={POPOVER_MOTION_PROPS.card}
125
- transition={POPOVER_MOTION_PROPS.transition}
126
- initial={animate ? ['hidden', 'initial'] : undefined}
127
- animate={animate ? ['visible', 'scaleIn'] : undefined}
128
- exit={animate ? ['hidden', 'scaleOut'] : undefined}
129
- >
130
- <Flex
131
- data-ui="Popover__wrapper"
113
+ <CardProvider tone={card?.tone ?? 'transparent'} scheme={card?.scheme ?? 'light'}>
114
+ <MotionCard
115
+ className={popoverCard()}
116
+ data-ui="Popover"
117
+ {...(restProps as CardProps & MotionProps)}
118
+ data-context-tone={card?.tone ?? 'transparent'}
119
+ data-placement={placement}
132
120
  direction="column"
133
- flex={1}
134
- maxWidth={maxWidth}
135
- overflow={overflow}
121
+ display="flex"
122
+ radius={radius}
123
+ ref={ref}
124
+ scheme={scheme}
125
+ shadow={shadow}
126
+ sizing="border"
127
+ style={rootStyle}
128
+ tone={tone}
129
+ variants={POPOVER_MOTION_PROPS.card}
130
+ transition={POPOVER_MOTION_PROPS.transition}
131
+ initial={animate ? ['hidden', 'initial'] : undefined}
132
+ animate={animate ? ['visible', 'scaleIn'] : undefined}
133
+ exit={animate ? ['hidden', 'scaleOut'] : undefined}
136
134
  >
137
- <Flex direction="column" flex={1} padding={padding}>
138
- {children}
135
+ <Flex
136
+ data-ui="Popover__wrapper"
137
+ direction="column"
138
+ flex={1}
139
+ maxWidth={maxWidth}
140
+ overflow={overflow}
141
+ >
142
+ <Flex direction="column" flex={1} padding={padding}>
143
+ {children}
144
+ </Flex>
139
145
  </Flex>
140
- </Flex>
141
146
 
142
- {arrow && (
143
- <Arrow
144
- ref={arrowRef}
145
- style={arrowStyle}
146
- width={DEFAULT_POPOVER_ARROW_WIDTH}
147
- height={DEFAULT_POPOVER_ARROW_HEIGHT}
148
- radius={DEFAULT_POPOVER_ARROW_RADIUS}
149
- />
150
- )}
151
- </MotionCard>
147
+ {arrow && (
148
+ <Arrow
149
+ ref={arrowRef}
150
+ style={arrowStyle}
151
+ width={DEFAULT_POPOVER_ARROW_WIDTH}
152
+ height={DEFAULT_POPOVER_ARROW_HEIGHT}
153
+ radius={DEFAULT_POPOVER_ARROW_RADIUS}
154
+ />
155
+ )}
156
+ </MotionCard>
157
+ </CardProvider>
152
158
  )
153
159
  }),
154
160
  )