@sanity/ui 3.0.0-static.5 → 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.
- package/dist/_chunks-cjs/_visual-editing.js +60 -56
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +61 -57
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +10 -10
- package/dist/_visual-editing.d.ts +10 -10
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +11 -1
- package/dist/css.d.ts +11 -1
- package/dist/css.js +324 -309
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +324 -309
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +5 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -19
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +229 -10
- package/dist/theme.js +1 -1
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1 -1
- package/dist/theme.mjs.map +1 -1
- package/package.json +2 -2
- package/src/css/aspects/index.ts +1 -0
- package/src/css/aspects/minWidth/index.ts +2 -0
- package/src/css/aspects/minWidth/minWidth.style.ts +13 -0
- package/src/css/aspects/minWidth/minWidth.ts +6 -0
- package/src/css/aspects/minWidth/types.ts +7 -0
- package/src/css/compile/compileRule.ts +1 -0
- package/src/css/compile/compileStyle.ts +1 -1
- package/src/css/primitives/_input/__workshop__/index.ts +1 -1
- package/src/css/primitives/box/box.style.ts +1 -1
- package/src/css/primitives/box/box.ts +2 -3
- package/src/css/primitives/box/types.ts +2 -0
- package/src/css/primitives/card/card.style.ts +69 -3
- package/src/css/primitives/card/types.ts +0 -1
- package/src/css/primitives/popover/popover.ts +4 -0
- package/src/css/primitives/switch/switch.style.ts +8 -83
- package/src/css/system.style.ts +2 -0
- package/src/theme/v3/defaults.ts +1 -1
- package/src/ui/components/autocomplete/__workshop__/index.ts +1 -1
- package/src/ui/components/autocomplete/autocomplete.tsx +2 -11
- package/src/ui/components/dialog/dialog.tsx +3 -4
- package/src/ui/constants.ts +6 -0
- package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +0 -2
- package/src/ui/primitives/box/box.tsx +3 -2
- package/src/ui/primitives/card/card.tsx +2 -6
- package/src/ui/primitives/code/code.tsx +1 -1
- package/src/ui/primitives/kbd/kbd.tsx +2 -2
- package/src/ui/primitives/popover/popover.tsx +5 -75
- package/src/ui/primitives/popover/popoverCard.tsx +45 -39
- package/src/ui/primitives/textInput/textInput.tsx +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +2 -3
- 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.
|
|
3
|
+
"version": "3.0.0-static.7",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"@rollup/plugin-replace": "^6.0.2",
|
|
126
126
|
"@sanity/pkg-utils": "^7.2.2",
|
|
127
127
|
"@sanity/prettier-config": "^1.0.3",
|
|
128
|
-
"@sanity/ui-workshop": "^2.1.
|
|
128
|
+
"@sanity/ui-workshop": "^2.1.3",
|
|
129
129
|
"@storybook/addon-a11y": "^8.6.12",
|
|
130
130
|
"@storybook/addon-docs": "^8.6.12",
|
|
131
131
|
"@storybook/addon-essentials": "^8.6.12",
|
package/src/css/aspects/index.ts
CHANGED
|
@@ -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}}
|
|
@@ -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(
|
|
115
|
+
css += `${nestedSelector.replace(/&/g, selector)} {\n`
|
|
116
116
|
css += compileProperties(nestedProperties)
|
|
117
117
|
css += '}\n\n'
|
|
118
118
|
}
|
|
@@ -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
|
-
'
|
|
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
|
-
'
|
|
36
|
+
'a&': {
|
|
37
37
|
outline: 'none',
|
|
38
38
|
textDecoration: 'none',
|
|
39
39
|
},
|
|
40
40
|
|
|
41
|
-
'
|
|
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
|
}
|
|
@@ -16,22 +16,16 @@ const primitive: StyleRules = {
|
|
|
16
16
|
padding: 0,
|
|
17
17
|
margin: 0,
|
|
18
18
|
|
|
19
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
package/src/css/system.style.ts
CHANGED
|
@@ -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,
|
package/src/theme/v3/defaults.ts
CHANGED
|
@@ -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/
|
|
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 =
|
|
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
|
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
useRef,
|
|
27
27
|
} from 'react'
|
|
28
28
|
|
|
29
|
-
import {
|
|
29
|
+
import {Z_OFFSETS} from '../../constants'
|
|
30
30
|
import {
|
|
31
31
|
containsOrEqualsElement,
|
|
32
32
|
focusFirstDescendant,
|
|
@@ -282,7 +282,6 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
282
282
|
ref: ForwardedRef<HTMLDivElement>,
|
|
283
283
|
) {
|
|
284
284
|
const context = useDialog()
|
|
285
|
-
const {layer} = useTheme_v2()
|
|
286
285
|
const {
|
|
287
286
|
__unstable_autoFocus: autoFocus = true,
|
|
288
287
|
__unstable_hideCloseButton: hideCloseButton = false,
|
|
@@ -309,8 +308,8 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
309
308
|
tone,
|
|
310
309
|
...restProps
|
|
311
310
|
} = props
|
|
312
|
-
const positionProp = _positionProp ??
|
|
313
|
-
const zOffsetProp = _zOffsetProp ??
|
|
311
|
+
const positionProp = _positionProp ?? context.position ?? 'fixed'
|
|
312
|
+
const zOffsetProp = _zOffsetProp ?? context.zOffset ?? Z_OFFSETS.dialog
|
|
314
313
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
315
314
|
const animate = prefersReducedMotion ? false : _animate
|
|
316
315
|
const portal = usePortal()
|
package/src/ui/constants.ts
CHANGED
|
@@ -96,8 +96,6 @@ function getServerSnapshot() {
|
|
|
96
96
|
* @beta
|
|
97
97
|
*/
|
|
98
98
|
export function useMediaIndex(): number {
|
|
99
|
-
// const {media} = useTheme_v2()
|
|
100
|
-
// const media = MEDIA
|
|
101
99
|
const store = useMemo(() => _createMediaStore(), [])
|
|
102
100
|
|
|
103
101
|
return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot)
|
|
@@ -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 = '
|
|
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 {
|
|
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 =
|
|
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>
|