@sanity/ui 3.0.0-static.6 → 3.0.0-static.8
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 +53 -53
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +54 -54
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +207 -185
- package/dist/css.d.ts +207 -185
- package/dist/css.js +617 -547
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +617 -547
- package/dist/css.mjs.map +1 -1
- package/dist/index.js +3 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -13
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +1334 -914
- package/dist/theme.d.mts +84 -76
- package/dist/theme.d.ts +84 -76
- package/dist/theme.js +148 -124
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +148 -124
- package/dist/theme.mjs.map +1 -1
- package/package.json +1 -1
- 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/compile/compileTheme_v3.ts +46 -37
- package/src/css/primitives/badge/badge.style.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/button/button.style.ts +20 -0
- package/src/css/primitives/card/card.style.ts +116 -44
- package/src/css/primitives/card/types.ts +0 -1
- package/src/css/primitives/kbd/kbd.style.ts +1 -1
- package/src/css/primitives/popover/popover.ts +4 -0
- package/src/css/primitives/switch/switch.style.ts +8 -83
- package/src/css/primitives/text/text.style.ts +11 -3
- package/src/css/system.style.ts +2 -0
- package/src/css/types.ts +200 -188
- package/src/css/varNames.ts +86 -76
- package/src/css/vars.ts +85 -76
- package/src/theme/v3/color/buildColor_v3.ts +43 -38
- package/src/theme/v3/color/card.ts +43 -38
- package/src/theme/v3/color/color.ts +42 -38
- package/src/theme/v3/defaults.ts +63 -47
- package/src/theme/v3/resolveTokens.ts +43 -38
- package/src/theme/versioning/themeColor_v3_v2.ts +1 -1
- package/src/ui/components/autocomplete/__workshop__/async.tsx +0 -1
- package/src/ui/components/autocomplete/autocomplete.tsx +2 -11
- package/src/ui/primitives/box/box.tsx +4 -3
- package/src/ui/primitives/card/card.tsx +2 -6
- package/src/ui/primitives/kbd/kbd.tsx +2 -2
- package/src/ui/primitives/popover/popoverCard.tsx +45 -39
- package/src/css/primitives/card/rules.ts +0 -473
package/src/theme/v3/defaults.ts
CHANGED
|
@@ -5,7 +5,48 @@ 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
|
-
|
|
8
|
+
code: {
|
|
9
|
+
bg: ['950', '50'],
|
|
10
|
+
fg: ['300', '700'],
|
|
11
|
+
token: {
|
|
12
|
+
atrule: ['purple/300', 'purple/600'],
|
|
13
|
+
attrName: ['green/300', 'green/600'],
|
|
14
|
+
attrValue: ['yellow/300', 'yellow/600'],
|
|
15
|
+
attribute: ['yellow/300', 'yellow/600'],
|
|
16
|
+
boolean: ['purple/300', 'purple/600'],
|
|
17
|
+
builtin: ['purple/300', 'purple/600'],
|
|
18
|
+
cdata: ['yellow/300', 'yellow/600'],
|
|
19
|
+
char: ['yellow/300', 'yellow/600'],
|
|
20
|
+
class: ['orange/300', 'orange/600'],
|
|
21
|
+
className: ['cyan/300', 'cyan/600'],
|
|
22
|
+
comment: ['gray/600', 'gray/300'],
|
|
23
|
+
constant: ['purple/300', 'purple/600'],
|
|
24
|
+
deleted: ['red/300', 'red/600'],
|
|
25
|
+
entity: ['red/300', 'red/600'],
|
|
26
|
+
function: ['green/300', 'green/600'],
|
|
27
|
+
hexcode: ['blue/300', 'blue/600'],
|
|
28
|
+
id: ['purple/300', 'purple/600'],
|
|
29
|
+
important: ['purple/300', 'purple/600'],
|
|
30
|
+
inserted: ['green/300', 'green/600'],
|
|
31
|
+
keyword: ['magenta/300', 'magenta/600'],
|
|
32
|
+
number: ['purple/300', 'purple/600'],
|
|
33
|
+
operator: ['magenta/300', 'magenta/600'],
|
|
34
|
+
prolog: ['gray/300', 'gray/600'],
|
|
35
|
+
property: ['blue/300', 'blue/600'],
|
|
36
|
+
pseudoClass: ['yellow/300', 'yellow/600'],
|
|
37
|
+
pseudoElement: ['yellow/300', 'yellow/600'],
|
|
38
|
+
punctuation: ['gray/300', 'gray/600'],
|
|
39
|
+
regex: ['blue/300', 'blue/600'],
|
|
40
|
+
selector: ['red/300', 'red/600'],
|
|
41
|
+
string: ['yellow/300', 'yellow/600'],
|
|
42
|
+
symbol: ['purple/300', 'purple/600'],
|
|
43
|
+
tag: ['red/300', 'red/600'],
|
|
44
|
+
unit: ['orange/300', 'orange/600'],
|
|
45
|
+
url: ['red/300', 'red/600'],
|
|
46
|
+
variable: ['red/300', 'red/600'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
focusRing: ['blue/500', 'blue/500'],
|
|
9
50
|
link: {
|
|
10
51
|
fg: ['blue/400', 'blue/600'],
|
|
11
52
|
},
|
|
@@ -15,53 +56,16 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
15
56
|
penumbra: ['black/0.14', '500/0.07'],
|
|
16
57
|
ambient: ['black/0.12', '500/0.06'],
|
|
17
58
|
},
|
|
18
|
-
token: {
|
|
19
|
-
atrule: ['purple/300', 'purple/600'],
|
|
20
|
-
attrName: ['green/300', 'green/600'],
|
|
21
|
-
attrValue: ['yellow/300', 'yellow/600'],
|
|
22
|
-
attribute: ['yellow/300', 'yellow/600'],
|
|
23
|
-
boolean: ['purple/300', 'purple/600'],
|
|
24
|
-
builtin: ['purple/300', 'purple/600'],
|
|
25
|
-
cdata: ['yellow/300', 'yellow/600'],
|
|
26
|
-
char: ['yellow/300', 'yellow/600'],
|
|
27
|
-
class: ['orange/300', 'orange/600'],
|
|
28
|
-
className: ['cyan/300', 'cyan/600'],
|
|
29
|
-
comment: ['gray/600', 'gray/300'],
|
|
30
|
-
constant: ['purple/300', 'purple/600'],
|
|
31
|
-
deleted: ['red/300', 'red/600'],
|
|
32
|
-
entity: ['red/300', 'red/600'],
|
|
33
|
-
function: ['green/300', 'green/600'],
|
|
34
|
-
hexcode: ['blue/300', 'blue/600'],
|
|
35
|
-
id: ['purple/300', 'purple/600'],
|
|
36
|
-
important: ['purple/300', 'purple/600'],
|
|
37
|
-
inserted: ['green/300', 'green/600'],
|
|
38
|
-
keyword: ['magenta/300', 'magenta/600'],
|
|
39
|
-
number: ['purple/300', 'purple/600'],
|
|
40
|
-
operator: ['magenta/300', 'magenta/600'],
|
|
41
|
-
prolog: ['gray/300', 'gray/600'],
|
|
42
|
-
property: ['blue/300', 'blue/600'],
|
|
43
|
-
pseudoClass: ['yellow/300', 'yellow/600'],
|
|
44
|
-
pseudoElement: ['yellow/300', 'yellow/600'],
|
|
45
|
-
punctuation: ['gray/300', 'gray/600'],
|
|
46
|
-
regex: ['blue/300', 'blue/600'],
|
|
47
|
-
selector: ['red/300', 'red/600'],
|
|
48
|
-
string: ['yellow/300', 'yellow/600'],
|
|
49
|
-
symbol: ['purple/300', 'purple/600'],
|
|
50
|
-
tag: ['red/300', 'red/600'],
|
|
51
|
-
unit: ['orange/300', 'orange/600'],
|
|
52
|
-
url: ['red/300', 'red/600'],
|
|
53
|
-
variable: ['red/300', 'red/600'],
|
|
54
|
-
},
|
|
55
59
|
variant: {
|
|
56
60
|
tinted: {
|
|
57
61
|
'*': {
|
|
58
62
|
bg: {
|
|
59
63
|
0: ['950', '50'],
|
|
60
|
-
4: ['800', '
|
|
64
|
+
4: ['800', '200'],
|
|
61
65
|
},
|
|
62
66
|
border: {
|
|
63
|
-
0: ['
|
|
64
|
-
4: ['
|
|
67
|
+
0: ['700', '100'],
|
|
68
|
+
4: ['500', '300'],
|
|
65
69
|
},
|
|
66
70
|
fg: {
|
|
67
71
|
0: ['100', '900'],
|
|
@@ -87,8 +91,8 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
87
91
|
solid: {
|
|
88
92
|
'*': {
|
|
89
93
|
bg: {
|
|
90
|
-
0: ['
|
|
91
|
-
4: ['
|
|
94
|
+
0: ['400', '500'],
|
|
95
|
+
4: ['300', '600'],
|
|
92
96
|
},
|
|
93
97
|
border: {
|
|
94
98
|
0: ['200', '400'],
|
|
@@ -136,12 +140,12 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
136
140
|
4: ['800', '300 50%'],
|
|
137
141
|
},
|
|
138
142
|
border: {
|
|
139
|
-
0: ['
|
|
140
|
-
4: ['
|
|
143
|
+
0: ['800', '300 40%'],
|
|
144
|
+
4: ['600', '300'],
|
|
141
145
|
},
|
|
142
146
|
fg: {
|
|
143
147
|
0: ['100', 'black'],
|
|
144
|
-
4: ['
|
|
148
|
+
4: ['400', '700'],
|
|
145
149
|
},
|
|
146
150
|
},
|
|
147
151
|
},
|
|
@@ -152,7 +156,7 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
152
156
|
tinted: {
|
|
153
157
|
'*': {
|
|
154
158
|
bg: {
|
|
155
|
-
0: ['
|
|
159
|
+
0: ['950', 'white'],
|
|
156
160
|
4: ['800', '200'],
|
|
157
161
|
},
|
|
158
162
|
border: {
|
|
@@ -167,6 +171,18 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
167
171
|
},
|
|
168
172
|
},
|
|
169
173
|
},
|
|
174
|
+
'neutral': {
|
|
175
|
+
variant: {
|
|
176
|
+
tinted: {
|
|
177
|
+
'*': {
|
|
178
|
+
bg: {
|
|
179
|
+
0: ['900', '50'],
|
|
180
|
+
4: ['700', '200'],
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
170
186
|
'primary': {
|
|
171
187
|
_hue: 'blue',
|
|
172
188
|
},
|
|
@@ -97,6 +97,48 @@ function resolveCardColorTokens(
|
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
99
|
backdrop: tokens?.backdrop ?? ['900', '100'],
|
|
100
|
+
code: {
|
|
101
|
+
bg: tokens?.code?.bg ?? ['950', '50'],
|
|
102
|
+
fg: tokens?.code?.fg ?? ['400', '600'],
|
|
103
|
+
token: {
|
|
104
|
+
atrule: tokens?.code?.token?.atrule ?? ['400', '600'],
|
|
105
|
+
attribute: tokens?.code?.token?.attribute ?? ['400', '600'],
|
|
106
|
+
attrName: tokens?.code?.token?.attrName ?? ['400', '600'],
|
|
107
|
+
attrValue: tokens?.code?.token?.attrValue ?? ['400', '600'],
|
|
108
|
+
boolean: tokens?.code?.token?.boolean ?? ['400', '600'],
|
|
109
|
+
builtin: tokens?.code?.token?.builtin ?? ['400', '600'],
|
|
110
|
+
cdata: tokens?.code?.token?.cdata ?? ['400', '600'],
|
|
111
|
+
char: tokens?.code?.token?.char ?? ['400', '600'],
|
|
112
|
+
class: tokens?.code?.token?.class ?? ['400', '600'],
|
|
113
|
+
className: tokens?.code?.token?.className ?? ['400', '600'],
|
|
114
|
+
comment: tokens?.code?.token?.comment ?? ['600', '400'],
|
|
115
|
+
constant: tokens?.code?.token?.constant ?? ['400', '600'],
|
|
116
|
+
deleted: tokens?.code?.token?.deleted ?? ['400', '600'],
|
|
117
|
+
doctype: tokens?.code?.token?.doctype ?? ['400', '600'],
|
|
118
|
+
entity: tokens?.code?.token?.entity ?? ['400', '600'],
|
|
119
|
+
function: tokens?.code?.token?.function ?? ['400', '600'],
|
|
120
|
+
hexcode: tokens?.code?.token?.hexcode ?? ['400', '600'],
|
|
121
|
+
id: tokens?.code?.token?.id ?? ['400', '600'],
|
|
122
|
+
important: tokens?.code?.token?.important ?? ['400', '600'],
|
|
123
|
+
inserted: tokens?.code?.token?.inserted ?? ['400', '600'],
|
|
124
|
+
keyword: tokens?.code?.token?.keyword ?? ['400', '600'],
|
|
125
|
+
number: tokens?.code?.token?.number ?? ['400', '600'],
|
|
126
|
+
operator: tokens?.code?.token?.operator ?? ['400', '600'],
|
|
127
|
+
prolog: tokens?.code?.token?.prolog ?? ['400', '600'],
|
|
128
|
+
property: tokens?.code?.token?.property ?? ['400', '600'],
|
|
129
|
+
pseudoClass: tokens?.code?.token?.pseudoClass ?? ['400', '600'],
|
|
130
|
+
pseudoElement: tokens?.code?.token?.pseudoElement ?? ['400', '600'],
|
|
131
|
+
punctuation: tokens?.code?.token?.punctuation ?? ['400', '600'],
|
|
132
|
+
regex: tokens?.code?.token?.regex ?? ['400', '600'],
|
|
133
|
+
selector: tokens?.code?.token?.selector ?? ['400', '600'],
|
|
134
|
+
string: tokens?.code?.token?.string ?? ['400', '600'],
|
|
135
|
+
symbol: tokens?.code?.token?.symbol ?? ['400', '600'],
|
|
136
|
+
tag: tokens?.code?.token?.tag ?? ['400', '600'],
|
|
137
|
+
unit: tokens?.code?.token?.unit ?? ['400', '600'],
|
|
138
|
+
url: tokens?.code?.token?.url ?? ['400', '600'],
|
|
139
|
+
variable: tokens?.code?.token?.variable ?? ['400', '600'],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
100
142
|
focusRing: tokens?.focusRing ?? ['500', '500'],
|
|
101
143
|
link: {
|
|
102
144
|
fg: tokens?.link?.fg ?? ['400', '600'],
|
|
@@ -111,44 +153,7 @@ function resolveCardColorTokens(
|
|
|
111
153
|
from: tokens?.skeleton?.from ?? ['900', '100'],
|
|
112
154
|
to: tokens?.skeleton?.to ?? ['950', '50'],
|
|
113
155
|
},
|
|
114
|
-
|
|
115
|
-
atrule: tokens?.token?.atrule ?? ['400', '600'],
|
|
116
|
-
attribute: tokens?.token?.attribute ?? ['400', '600'],
|
|
117
|
-
attrName: tokens?.token?.attrName ?? ['400', '600'],
|
|
118
|
-
attrValue: tokens?.token?.attrValue ?? ['400', '600'],
|
|
119
|
-
boolean: tokens?.token?.boolean ?? ['400', '600'],
|
|
120
|
-
builtin: tokens?.token?.builtin ?? ['400', '600'],
|
|
121
|
-
cdata: tokens?.token?.cdata ?? ['400', '600'],
|
|
122
|
-
char: tokens?.token?.char ?? ['400', '600'],
|
|
123
|
-
class: tokens?.token?.class ?? ['400', '600'],
|
|
124
|
-
className: tokens?.token?.className ?? ['400', '600'],
|
|
125
|
-
comment: tokens?.token?.comment ?? ['600', '400'],
|
|
126
|
-
constant: tokens?.token?.constant ?? ['400', '600'],
|
|
127
|
-
deleted: tokens?.token?.deleted ?? ['400', '600'],
|
|
128
|
-
doctype: tokens?.token?.doctype ?? ['400', '600'],
|
|
129
|
-
entity: tokens?.token?.entity ?? ['400', '600'],
|
|
130
|
-
function: tokens?.token?.function ?? ['400', '600'],
|
|
131
|
-
hexcode: tokens?.token?.hexcode ?? ['400', '600'],
|
|
132
|
-
id: tokens?.token?.id ?? ['400', '600'],
|
|
133
|
-
important: tokens?.token?.important ?? ['400', '600'],
|
|
134
|
-
inserted: tokens?.token?.inserted ?? ['400', '600'],
|
|
135
|
-
keyword: tokens?.token?.keyword ?? ['400', '600'],
|
|
136
|
-
number: tokens?.token?.number ?? ['400', '600'],
|
|
137
|
-
operator: tokens?.token?.operator ?? ['400', '600'],
|
|
138
|
-
prolog: tokens?.token?.prolog ?? ['400', '600'],
|
|
139
|
-
property: tokens?.token?.property ?? ['400', '600'],
|
|
140
|
-
pseudoClass: tokens?.token?.pseudoClass ?? ['400', '600'],
|
|
141
|
-
pseudoElement: tokens?.token?.pseudoElement ?? ['400', '600'],
|
|
142
|
-
punctuation: tokens?.token?.punctuation ?? ['400', '600'],
|
|
143
|
-
regex: tokens?.token?.regex ?? ['400', '600'],
|
|
144
|
-
selector: tokens?.token?.selector ?? ['400', '600'],
|
|
145
|
-
string: tokens?.token?.string ?? ['400', '600'],
|
|
146
|
-
symbol: tokens?.token?.symbol ?? ['400', '600'],
|
|
147
|
-
tag: tokens?.token?.tag ?? ['400', '600'],
|
|
148
|
-
unit: tokens?.token?.unit ?? ['400', '600'],
|
|
149
|
-
url: tokens?.token?.url ?? ['400', '600'],
|
|
150
|
-
variable: tokens?.token?.variable ?? ['400', '600'],
|
|
151
|
-
},
|
|
156
|
+
|
|
152
157
|
variant: {
|
|
153
158
|
solid: {
|
|
154
159
|
'*': resolveElementTokens(tokens?.variant?.solid?.['*']),
|
|
@@ -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
|
|
|
@@ -35,7 +35,7 @@ export const Box = forwardRef(function Box(
|
|
|
35
35
|
autoCols,
|
|
36
36
|
autoFlow,
|
|
37
37
|
autoRows,
|
|
38
|
-
border,
|
|
38
|
+
border = false,
|
|
39
39
|
borderTop,
|
|
40
40
|
borderRight,
|
|
41
41
|
borderBottom,
|
|
@@ -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>
|
|
@@ -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
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
|
134
|
-
|
|
135
|
-
|
|
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
|
|
138
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
)
|