@sanity/ui 3.0.0-static.13 → 3.0.0-static.15

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 (31) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +101 -106
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +101 -106
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/css.js.map +1 -1
  7. package/dist/css.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/src/css/aspects/margin/margin.style.ts +0 -3
  10. package/src/ui/primitives/popover/popover.tsx +7 -6
  11. package/src/ui/primitives/popover/{popoverCard.tsx → popoverLayer.tsx} +14 -28
  12. package/src/ui/primitives/tooltip/tooltip.tsx +21 -24
  13. package/src/ui/primitives/tooltip/{tooltipCard.tsx → tooltipLayer.tsx} +14 -27
  14. package/src/css/aspects/height/rules.ts +0 -7
  15. package/src/css/aspects/width/rules.ts +0 -8
  16. package/src/css/components/menu/rules.ts +0 -15
  17. package/src/css/primitives/avatar/rules.ts +0 -176
  18. package/src/css/primitives/button/rules.ts +0 -302
  19. package/src/css/primitives/checkbox/rules.ts +0 -152
  20. package/src/css/primitives/code/rules.ts +0 -96
  21. package/src/css/primitives/container/rules.ts +0 -8
  22. package/src/css/primitives/heading/rules.ts +0 -155
  23. package/src/css/primitives/kbd/rules.ts +0 -20
  24. package/src/css/primitives/label/rules.ts +0 -137
  25. package/src/css/primitives/radio/rules.ts +0 -121
  26. package/src/css/primitives/select/rules.ts +0 -22
  27. package/src/css/primitives/switch/rules.ts +0 -340
  28. package/src/css/primitives/text/rules.ts +0 -164
  29. package/src/css/primitives/textArea/rules.ts +0 -7
  30. package/src/css/primitives/textInput/rules.ts +0 -224
  31. package/src/css/primitives/tooltip/rules.ts +0 -19
@@ -1,340 +0,0 @@
1
- import {Rules} from '../../types'
2
-
3
- export const switchRules: Rules = {
4
- 'switch': {},
5
-
6
- 'switch-element': {
7
- position: 'absolute',
8
- top: 0,
9
- right: 0,
10
- bottom: 0,
11
- left: 0,
12
- opacity: 0,
13
- height: '100%',
14
- width: '100%',
15
- outline: 'none',
16
- padding: 0,
17
- margin: 0,
18
-
19
- /* Place the input element above the representation element */
20
- zIndex: 1,
21
- },
22
-
23
- 'switch-presentation': {
24
- '--switch-bg-color': 'var(--color-tinted-default-border-2)',
25
- // '--switch-border-color': 'var(--color-tinted-default-border-1)',
26
- '--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
- '--switch-thumb-offset': '0',
30
- '--switch-thumb-size': 'calc(var(--input-switch-height) - var(--input-switch-padding) * 2)',
31
- 'display': 'block',
32
- // &:not([hidden]) {
33
- // display: block;
34
- // }
35
- 'position': 'relative',
36
- 'width': 'var(--input-switch-width)',
37
- 'height': 'var(--input-switch-height)',
38
- 'borderRadius': 'calc(var(--input-switch-height) / 2)',
39
- 'outlineOffset': 'var(--input-switch-focus-ring-offset)',
40
-
41
- // Make sure it’s not possible to interact with the presentation element
42
- 'pointerEvents': 'none',
43
-
44
- '@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
- '.switch-element:focus + &': {
58
- // --switch-box-shadow: ${focusRingStyle({focusRing: input.switch.focusRing})};
59
- outline: 'var(--input-switch-focus-ring-width) solid var(--color-focus-ring)',
60
- },
61
- 'input:focus:not(:focus-visible) + &': {
62
- outline: 'none',
63
- },
64
- 'input:checked + &': {
65
- '--switch-bg-color': 'var(--color-solid-default-bg-0)',
66
- // '--switch-border-color': 'var(--color-solid-default-bg-0)',
67
- '--switch-fg-color': 'var(--color-solid-default-fg-0)',
68
- },
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
-
82
- '.switch-element:checked + &': {
83
- '--switch-thumb-offset':
84
- 'calc(var(--input-switch-width) - (var(--input-switch-padding) * 2) - var(--switch-thumb-size))',
85
- },
86
- },
87
-
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
- // }
98
- },
99
-
100
- 'switch-track': {
101
- display: 'block',
102
- backgroundColor: 'var(--switch-bg-color)',
103
- position: 'absolute',
104
- left: 0,
105
- top: 0,
106
- right: 0,
107
- bottom: 0,
108
- borderRadius: 'inherit',
109
- // boxShadow: 'inset 0 0 0 1px var(--switch-border-color)',
110
-
111
- transition:
112
- 'box-shadow, background-color var(--input-switch-transition-duration-ms) var(--input-switch-transition-timing-function)',
113
- },
114
-
115
- 'switch-thumb': {
116
- // '--switch-thumb-offset': '0',
117
-
118
- display: 'block',
119
- position: 'absolute',
120
- left: 'var(--input-switch-padding)',
121
- top: 'var(--input-switch-padding)',
122
- width: 'var(--switch-thumb-size)',
123
- height: 'var(--switch-thumb-size)',
124
- backgroundColor: 'var(--switch-fg-color)',
125
- borderRadius: '9999px',
126
- boxShadow: '0 0 0 0.5px var(--color-shadow-umbra), 0 0.5px 2px 0.5px var(--color-shadow-umbra)',
127
- transform: 'translate3d(var(--switch-thumb-offset), 0, 0)',
128
- transition:
129
- '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
- },
167
- }
168
-
169
- // import {getTheme_v2} from '@sanity/ui/theme'
170
- // import {rem, ThemeProps} from '../../_compat'
171
- // import {focusRingStyle} from '../../_compat/styles/internal'
172
- // import {css} from '../../lib/styled'
173
-
174
- // /* Root */
175
- // // export function switchBaseStyles(): ReturnType<typeof css> {
176
- // // return css`
177
- // // position: relative;
178
- // // &:not([hidden]) {
179
- // // display: inline-block;
180
- // // }
181
- // // `
182
- // // }
183
-
184
- // /* Input */
185
- // export function switchInputStyles(): ReturnType<typeof css> {
186
- // // Visually hide the input element while keeping it interactive
187
- // return css`
188
- // position: absolute;
189
- // top: 0;
190
- // right: 0;
191
- // bottom: 0;
192
- // left: 0;
193
- // opacity: 0;
194
- // height: 100%;
195
- // width: 100%;
196
- // outline: none;
197
- // padding: 0;
198
- // margin: 0;
199
-
200
- // /* Place the input element above the representation element */
201
- // z-index: 1;
202
- // `
203
- // }
204
-
205
- // /* Representation */
206
- // export function switchRepresentationStyles(props: ThemeProps): ReturnType<typeof css> {
207
- // const {color, input} = getTheme_v2(props.theme)
208
-
209
- // return css`
210
- // --switch-bg-color: ${color.input.default.enabled.border};
211
- // --switch-fg-color: ${color.input.default.enabled.bg};
212
- // --switch-box-shadow: none;
213
-
214
- // &:not([hidden]) {
215
- // display: block;
216
- // }
217
- // position: relative;
218
- // width: ${rem(input.switch.width)};
219
- // height: ${rem(input.switch.height)};
220
- // border-radius: ${rem(input.switch.height / 2)};
221
-
222
- // /* Make sure it’s not possible to interact with the wrapper element */
223
- // pointer-events: none;
224
-
225
- // &:after {
226
- // content: '';
227
- // display: block;
228
- // position: absolute;
229
- // top: 0;
230
- // left: 0;
231
- // right: 0;
232
- // bottom: 0;
233
- // z-index: 1;
234
- // box-shadow: var(--switch-box-shadow);
235
- // border-radius: inherit;
236
- // }
237
-
238
- // /* Focus styles */
239
- // input:focus + && {
240
- // --switch-box-shadow: ${focusRingStyle({focusRing: input.switch.focusRing})};
241
- // }
242
-
243
- // input:focus:not(:focus-visible) + && {
244
- // --switch-box-shadow: none;
245
- // }
246
-
247
- // input:checked + && {
248
- // --switch-bg-color: ${color.input.default.enabled.fg};
249
- // --switch-fg-color: ${color.input.default.enabled.bg};
250
- // }
251
-
252
- // @media (hover: hover) {
253
- // input:not(:disabled):hover + && {
254
- // --switch-bg-color: ${color.input.default.hovered.border};
255
- // --switch-fg-color: ${color.input.default.hovered.bg};
256
- // }
257
-
258
- // input:not(:disabled):checked:hover + && {
259
- // --switch-bg-color: ${color.input.default.enabled.fg};
260
- // --switch-fg-color: ${color.input.default.enabled.bg};
261
- // }
262
- // }
263
-
264
- // input:not([data-read-only]):disabled + && {
265
- // --switch-bg-color: ${color.input.default.disabled.border};
266
- // --switch-fg-color: ${color.input.default.disabled.bg};
267
- // }
268
-
269
- // input[data-read-only]:disabled + && {
270
- // --switch-bg-color: ${color.input.default.readOnly.border};
271
- // --switch-fg-color: ${color.input.default.readOnly.bg};
272
- // }
273
-
274
- // input:checked[data-read-only]:disabled + && {
275
- // --switch-bg-color: ${color.input.default.readOnly.fg};
276
- // --switch-fg-color: ${color.input.default.readOnly.bg};
277
- // }
278
- // `
279
- // }
280
-
281
- // /* Track */
282
- // export function switchTrackStyles(props: ThemeProps): ReturnType<typeof css> {
283
- // const {input} = getTheme_v2(props.theme)
284
-
285
- // return css`
286
- // &:not([hidden]) {
287
- // display: block;
288
- // }
289
- // background-color: var(--switch-bg-color);
290
- // position: absolute;
291
- // left: 0;
292
- // top: 0;
293
- // width: ${rem(input.switch.width)};
294
- // height: ${rem(input.switch.height)};
295
- // border-radius: ${rem(input.switch.height / 2)};
296
- // `
297
- // }
298
-
299
- // /* Thumb */
300
- // export function switchThumbStyles(
301
- // props: {$checked?: boolean; $indeterminate?: boolean} & ThemeProps,
302
- // ): ReturnType<typeof css> {
303
- // const {$indeterminate} = props
304
- // const {input} = getTheme_v2(props.theme)
305
- // const trackWidth = input.switch.width
306
- // const trackHeight = input.switch.height
307
- // const trackPadding = input.switch.padding
308
- // const size = trackHeight - input.switch.padding * 2
309
- // const checkedOffset = trackWidth - trackPadding * 2 - size
310
- // const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding
311
- // const checked = $indeterminate !== true && props.$checked === true
312
-
313
- // return css`
314
- // &:not([hidden]) {
315
- // display: block;
316
- // }
317
- // position: absolute;
318
- // left: ${rem(trackPadding)};
319
- // top: ${rem(trackPadding)};
320
- // height: ${rem(size)};
321
- // width: ${rem(size)};
322
- // border-radius: ${rem(size / 2)};
323
- // transition-property: transform;
324
- // transition-duration: ${input.switch.transitionDurationMs}ms;
325
- // transition-timing-function: ${input.switch.transitionTimingFunction};
326
- // background: var(--switch-fg-color);
327
- // transform: translate3d(0, 0, 0);
328
- // box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.05);
329
-
330
- // ${checked &&
331
- // css`
332
- // transform: translate3d(${checkedOffset}px, 0, 0);
333
- // `}
334
-
335
- // ${$indeterminate &&
336
- // css`
337
- // transform: translate3d(${indeterminateOffset}px, 0, 0);
338
- // `}
339
- // `
340
- // }
@@ -1,164 +0,0 @@
1
- import {responsiveRules} from '../../responsiveRules'
2
- import {Rules} from '../../types'
3
-
4
- export const textRules: Rules = {
5
- 'text': {
6
- '--font-weight-regular': `var(--font-text-weight-regular)`,
7
- '--font-weight-medium': `var(--font-text-weight-medium)`,
8
- '--font-weight-semibold': `var(--font-text-weight-semibold)`,
9
- '--font-weight-bold': `var(--font-text-weight-bold)`,
10
-
11
- '--font-family': `var(--font-text-family)`,
12
- '--font-feature-settings': `var(--font-text-feature-settings)`,
13
-
14
- 'color': 'var(--color-fg)',
15
-
16
- '@nest': {
17
- '& a': {
18
- color: 'var(--color-link-fg)',
19
- textDecoration: 'none',
20
- },
21
-
22
- '& a:hover': {
23
- color: 'var(--color-fg)',
24
- },
25
-
26
- // '& svg': {
27
- // color: 'var(--color-icon)',
28
- // },
29
- },
30
- },
31
-
32
- // 'text-accent': {
33
- // '--color-fg': 'var(--color-accent-fg)',
34
- // },
35
-
36
- 'text-muted': {
37
- color: 'var(--color-muted-fg)',
38
- // '--color-fg': 'var(--color-tinted-default-fg-4)',
39
- },
40
-
41
- ...responsiveRules('text-0', {
42
- '--font-size': 'var(--font-text-0-size)',
43
- '--font-line-height': 'var(--font-text-0-line-height)',
44
- '--font-letter-spacing': 'var(--font-text-0-letter-spacing)',
45
- '--font-icon-size': 'var(--font-text-0-icon-size)',
46
- '--font-ascender-height': 'var(--font-text-0-ascender-height)',
47
- '--font-descender-height': 'var(--font-text-0-descender-height)',
48
- // '--font-cap-height': 'var(--font-text-0-cap-height)',
49
- }),
50
-
51
- ...responsiveRules('text-1', {
52
- '--font-size': 'var(--font-text-1-size)',
53
- '--font-line-height': 'var(--font-text-1-line-height)',
54
- '--font-letter-spacing': 'var(--font-text-1-letter-spacing)',
55
- '--font-icon-size': 'var(--font-text-1-icon-size)',
56
- '--font-ascender-height': 'var(--font-text-1-ascender-height)',
57
- '--font-descender-height': 'var(--font-text-1-descender-height)',
58
- // '--font-cap-height': 'var(--font-text-1-cap-height)',
59
- }),
60
-
61
- ...responsiveRules('text-2', {
62
- '--font-size': 'var(--font-text-2-size)',
63
- '--font-line-height': 'var(--font-text-2-line-height)',
64
- '--font-letter-spacing': 'var(--font-text-2-letter-spacing)',
65
- '--font-icon-size': 'var(--font-text-2-icon-size)',
66
- '--font-ascender-height': 'var(--font-text-2-ascender-height)',
67
- '--font-descender-height': 'var(--font-text-2-descender-height)',
68
- // '--font-cap-height': 'var(--font-text-2-cap-height)',
69
- }),
70
-
71
- ...responsiveRules('text-3', {
72
- '--font-size': 'var(--font-text-3-size)',
73
- '--font-line-height': 'var(--font-text-3-line-height)',
74
- '--font-letter-spacing': 'var(--font-text-3-letter-spacing)',
75
- '--font-icon-size': 'var(--font-text-3-icon-size)',
76
- '--font-ascender-height': 'var(--font-text-3-ascender-height)',
77
- '--font-descender-height': 'var(--font-text-3-descender-height)',
78
- // '--font-cap-height': 'var(--font-text-3-cap-height)',
79
- }),
80
-
81
- ...responsiveRules('text-4', {
82
- '--font-size': 'var(--font-text-4-size)',
83
- '--font-line-height': 'var(--font-text-4-line-height)',
84
- '--font-letter-spacing': 'var(--font-text-4-letter-spacing)',
85
- '--font-icon-size': 'var(--font-text-4-icon-size)',
86
- '--font-ascender-height': 'var(--font-text-4-ascender-height)',
87
- '--font-descender-height': 'var(--font-text-4-descender-height)',
88
- // '--font-cap-height': 'var(--font-text-4-cap-height)',
89
- }),
90
- }
91
-
92
- // import {getTheme_v2} from '@sanity/ui/theme'
93
- // import {ThemeProps} from '../../_compat'
94
- // import {css} from '../../lib/styled'
95
-
96
- // export function textBaseStyle(
97
- // props: {$accent?: boolean; $muted?: boolean} & ThemeProps,
98
- // ): ReturnType<typeof css> {
99
- // const {$accent, $muted} = props
100
- // const {font} = getTheme_v2(props.theme)
101
-
102
- // return css`
103
- // color: var(--card-fg-color);
104
-
105
- // ${$accent &&
106
- // css`
107
- // color: var(--card-accent-fg-color);
108
- // `}
109
-
110
- // ${$muted &&
111
- // css`
112
- // color: var(--card-muted-fg-color);
113
- // `}
114
-
115
- // & code {
116
- // font-family: ${font.code.family};
117
- // border-radius: 1px;
118
- // background-color: var(--card-code-bg-color);
119
- // color: var(--card-code-fg-color);
120
- // }
121
-
122
- // & a {
123
- // text-decoration: none;
124
- // border-radius: 1px;
125
- // color: var(--card-link-color);
126
- // outline: none;
127
-
128
- // @media (hover: hover) {
129
- // &:hover {
130
- // text-decoration: underline;
131
- // }
132
- // }
133
-
134
- // &:focus {
135
- // box-shadow:
136
- // 0 0 0 1px var(--card-bg-color),
137
- // 0 0 0 3px var(--card-focus-ring-color);
138
- // }
139
-
140
- // &:focus:not(:focus-visible) {
141
- // box-shadow: none;
142
- // }
143
- // }
144
-
145
- // & strong {
146
- // font-weight: ${font.text.weights.bold};
147
- // }
148
-
149
- // & svg {
150
- // /* Certain popular CSS libraries changes the defaults for SVG display */
151
- // /* Make sure SVGs are rendered as inline elements */
152
- // display: inline;
153
- // }
154
-
155
- // & [data-sanity-icon] {
156
- // vertical-align: baseline;
157
- // color: var(--card-icon-color);
158
-
159
- // & path {
160
- // vector-effect: non-scaling-stroke !important;
161
- // }
162
- // }
163
- // `
164
- // }
@@ -1,7 +0,0 @@
1
- import {Rules} from '../../types'
2
-
3
- export const textAreaRules: Rules = {
4
- 'text-area': {
5
- //
6
- },
7
- }