@sanity/ui 5.0.0-alpha.19 → 5.0.0-alpha.20
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/index.d.ts +9 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +87 -150
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/checkbox/Checkbox.tsx +13 -28
- package/src/components/checkbox/checkbox.css +19 -20
- package/src/components/checkbox/checkbox.props.ts +3 -12
- package/src/components/index.css +0 -1
- package/src/components/radio/Radio.tsx +11 -29
- package/src/components/radio/radio.css +17 -32
- package/src/components/radio/radio.props.ts +1 -24
- package/src/components/switch/Switch.tsx +10 -22
- package/src/components/switch/switch.css +22 -23
- package/src/components/switch/switch.props.ts +3 -12
- package/src/components/tooltip/Tooltip.tsx +1 -1
- package/src/components/tooltip/tooltip.css +2 -0
- package/src/css/classes/generic/placement.css +81 -93
- package/src/css/classes/local/text-trim.css +11 -0
- package/src/css/tokens/surface.css +2 -0
- package/src/index.ts +0 -1
- package/src/types/TextAlign.ts +1 -1
- package/src/version.ts +2 -2
- package/src/components/label/Label.tsx +0 -34
- package/src/components/label/label.css +0 -3
- package/src/components/label/label.props.ts +0 -25
|
@@ -1,109 +1,98 @@
|
|
|
1
|
-
[class*=
|
|
1
|
+
[class*="placement-"] {
|
|
2
2
|
inset: auto;
|
|
3
3
|
margin: 0;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
@position-try --top-center {
|
|
7
|
-
top: auto;
|
|
8
|
-
right: auto;
|
|
9
|
-
bottom: anchor(top);
|
|
10
|
-
left: anchor(center);
|
|
11
|
-
translate: -50% 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
6
|
@position-try --top-start {
|
|
15
|
-
|
|
16
|
-
right: auto;
|
|
7
|
+
inset: auto;
|
|
17
8
|
bottom: anchor(top);
|
|
18
9
|
left: anchor(left);
|
|
19
|
-
translate: none;
|
|
20
10
|
}
|
|
21
11
|
|
|
22
12
|
@position-try --top-end {
|
|
23
|
-
|
|
24
|
-
left: auto;
|
|
13
|
+
inset: auto;
|
|
25
14
|
bottom: anchor(top);
|
|
26
15
|
right: anchor(right);
|
|
27
|
-
translate: none;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@position-try --bottom-center {
|
|
31
|
-
bottom: auto;
|
|
32
|
-
right: auto;
|
|
33
|
-
top: anchor(bottom);
|
|
34
|
-
left: anchor(center);
|
|
35
|
-
translate: -50% 0;
|
|
36
16
|
}
|
|
37
17
|
|
|
38
18
|
@position-try --bottom-start {
|
|
39
|
-
|
|
40
|
-
right: auto;
|
|
19
|
+
inset: auto;
|
|
41
20
|
top: anchor(bottom);
|
|
42
21
|
left: anchor(left);
|
|
43
|
-
translate: none;
|
|
44
22
|
}
|
|
45
23
|
|
|
46
24
|
@position-try --bottom-end {
|
|
47
|
-
|
|
48
|
-
left: auto;
|
|
25
|
+
inset: auto;
|
|
49
26
|
top: anchor(bottom);
|
|
50
27
|
right: anchor(right);
|
|
51
|
-
translate: none;
|
|
52
28
|
}
|
|
53
29
|
|
|
54
|
-
@position-try --
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
30
|
+
@position-try --left-start {
|
|
31
|
+
inset: auto;
|
|
32
|
+
top: anchor(top);
|
|
33
|
+
right: anchor(left);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@position-try --left-end {
|
|
37
|
+
inset: auto;
|
|
38
|
+
bottom: anchor(bottom);
|
|
39
|
+
right: anchor(left);
|
|
60
40
|
}
|
|
61
41
|
|
|
62
42
|
@position-try --right-start {
|
|
63
|
-
|
|
64
|
-
bottom: auto;
|
|
65
|
-
left: anchor(right);
|
|
43
|
+
inset: auto;
|
|
66
44
|
top: anchor(top);
|
|
67
|
-
|
|
45
|
+
left: anchor(right);
|
|
68
46
|
}
|
|
69
47
|
|
|
70
48
|
@position-try --right-end {
|
|
71
|
-
|
|
72
|
-
top: auto;
|
|
73
|
-
left: anchor(right);
|
|
49
|
+
inset: auto;
|
|
74
50
|
bottom: anchor(bottom);
|
|
75
|
-
|
|
51
|
+
left: anchor(right);
|
|
76
52
|
}
|
|
77
53
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
translate: 0 -50%;
|
|
54
|
+
.sui-placement-top {
|
|
55
|
+
bottom: anchor(top);
|
|
56
|
+
left: anchor(center);
|
|
57
|
+
translate: -50% 0;
|
|
58
|
+
position-try-fallbacks: flip-block;
|
|
84
59
|
}
|
|
85
60
|
|
|
86
|
-
@
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
61
|
+
@supports (justify-self: anchor-center) {
|
|
62
|
+
.sui-placement-top {
|
|
63
|
+
left: auto;
|
|
64
|
+
translate: none;
|
|
65
|
+
justify-self: anchor-center;
|
|
66
|
+
margin-inline: var(--space-2);
|
|
67
|
+
}
|
|
92
68
|
}
|
|
93
69
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
70
|
+
.sui-placement-top-start {
|
|
71
|
+
bottom: anchor(top);
|
|
72
|
+
left: anchor(left);
|
|
73
|
+
position-try-fallbacks: --bottom-start;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.sui-placement-top-end {
|
|
77
|
+
bottom: anchor(top);
|
|
78
|
+
right: anchor(right);
|
|
79
|
+
position-try-fallbacks: --bottom-end;
|
|
100
80
|
}
|
|
101
81
|
|
|
102
82
|
.sui-placement-bottom {
|
|
103
83
|
top: anchor(bottom);
|
|
104
84
|
left: anchor(center);
|
|
105
85
|
translate: -50% 0;
|
|
106
|
-
position-try-fallbacks:
|
|
86
|
+
position-try-fallbacks: flip-block;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@supports (justify-self: anchor-center) {
|
|
90
|
+
.sui-placement-bottom {
|
|
91
|
+
left: auto;
|
|
92
|
+
translate: none;
|
|
93
|
+
justify-self: anchor-center;
|
|
94
|
+
margin-inline: var(--space-2);
|
|
95
|
+
}
|
|
107
96
|
}
|
|
108
97
|
|
|
109
98
|
.sui-placement-bottom-start {
|
|
@@ -118,60 +107,59 @@
|
|
|
118
107
|
position-try-fallbacks: --top-end;
|
|
119
108
|
}
|
|
120
109
|
|
|
121
|
-
.sui-placement-top {
|
|
122
|
-
bottom: anchor(top);
|
|
123
|
-
left: anchor(center);
|
|
124
|
-
translate: -50% 0;
|
|
125
|
-
position-try-fallbacks: --bottom-center;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.sui-placement-top-start {
|
|
129
|
-
bottom: anchor(top);
|
|
130
|
-
left: anchor(left);
|
|
131
|
-
position-try-fallbacks: --bottom-start;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.sui-placement-top-end {
|
|
135
|
-
bottom: anchor(top);
|
|
136
|
-
right: anchor(right);
|
|
137
|
-
position-try-fallbacks: --bottom-end;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
110
|
.sui-placement-left {
|
|
141
|
-
right: anchor(left);
|
|
142
111
|
top: anchor(center);
|
|
112
|
+
right: anchor(left);
|
|
143
113
|
translate: 0 -50%;
|
|
144
|
-
position-try-fallbacks:
|
|
114
|
+
position-try-fallbacks: flip-inline;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@supports (align-self: anchor-center) {
|
|
118
|
+
.sui-placement-left {
|
|
119
|
+
top: auto;
|
|
120
|
+
translate: none;
|
|
121
|
+
align-self: anchor-center;
|
|
122
|
+
margin-block: var(--space-2);
|
|
123
|
+
}
|
|
145
124
|
}
|
|
146
125
|
|
|
147
126
|
.sui-placement-left-start {
|
|
148
|
-
right: anchor(left);
|
|
149
127
|
top: anchor(top);
|
|
128
|
+
right: anchor(left);
|
|
150
129
|
position-try-fallbacks: --right-start;
|
|
151
130
|
}
|
|
152
131
|
|
|
153
132
|
.sui-placement-left-end {
|
|
154
|
-
right: anchor(left);
|
|
155
133
|
bottom: anchor(bottom);
|
|
134
|
+
right: anchor(left);
|
|
156
135
|
position-try-fallbacks: --right-end;
|
|
157
136
|
}
|
|
158
137
|
|
|
159
138
|
.sui-placement-right {
|
|
160
|
-
left: anchor(right);
|
|
161
139
|
top: anchor(center);
|
|
140
|
+
left: anchor(right);
|
|
162
141
|
translate: 0 -50%;
|
|
163
|
-
position-try-fallbacks:
|
|
142
|
+
position-try-fallbacks: flip-inline;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@supports (align-self: anchor-center) {
|
|
146
|
+
.sui-placement-right {
|
|
147
|
+
top: auto;
|
|
148
|
+
translate: none;
|
|
149
|
+
align-self: anchor-center;
|
|
150
|
+
margin-block: var(--space-2);
|
|
151
|
+
}
|
|
164
152
|
}
|
|
165
153
|
|
|
166
154
|
.sui-placement-right-start {
|
|
167
|
-
left: anchor(right);
|
|
168
155
|
top: anchor(top);
|
|
156
|
+
left: anchor(right);
|
|
169
157
|
position-try-fallbacks: --left-start;
|
|
170
158
|
}
|
|
171
159
|
|
|
172
160
|
.sui-placement-right-end {
|
|
173
|
-
left: anchor(right);
|
|
174
161
|
bottom: anchor(bottom);
|
|
162
|
+
left: anchor(right);
|
|
175
163
|
position-try-fallbacks: --left-end;
|
|
176
164
|
}
|
|
177
165
|
|
|
@@ -185,14 +173,14 @@
|
|
|
185
173
|
margin-inline: var(--space-1);
|
|
186
174
|
}
|
|
187
175
|
|
|
188
|
-
[class*="placement-bottom"] {
|
|
189
|
-
transform-origin: center top;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
176
|
[class*="placement-top"] {
|
|
193
177
|
transform-origin: center bottom;
|
|
194
178
|
}
|
|
195
179
|
|
|
180
|
+
[class*="placement-bottom"] {
|
|
181
|
+
transform-origin: center top;
|
|
182
|
+
}
|
|
183
|
+
|
|
196
184
|
[class*="placement-left"] {
|
|
197
185
|
transform-origin: right center;
|
|
198
186
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
.sui-text-trim-edge {
|
|
2
|
+
text-box: trim-both cap alphabetic;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.sui-text-trim:before,
|
|
2
6
|
.sui-text-trim:after {
|
|
3
7
|
content: '';
|
|
@@ -38,4 +42,11 @@
|
|
|
38
42
|
.sui-text-code2 { --trim: -6px; }
|
|
39
43
|
.sui-text-code3 { --trim: -7px; }
|
|
40
44
|
.sui-text-code4 { --trim: -8px; }
|
|
45
|
+
|
|
46
|
+
.sui-text-eyebrow0 { --trim: -2px; }
|
|
47
|
+
.sui-text-eyebrow1 { --trim: -2.5px; }
|
|
48
|
+
.sui-text-eyebrow2 { --trim: -3px; }
|
|
49
|
+
.sui-text-eyebrow3 { --trim: -3.5px; }
|
|
50
|
+
.sui-text-eyebrow4 { --trim: -4px; }
|
|
51
|
+
.sui-text-eyebrow5 { --trim: -4.5px; }
|
|
41
52
|
}
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
--foreground-low-emphasized: light-dark(var(--gray-100), var(--gray-900));
|
|
17
17
|
/* Used to create equivalent text + block size for form elements vs UI v3/4. Can drop once migration is complete. */
|
|
18
18
|
--form-element-text: var(--regular) 13px / 1.15 var(--sans);
|
|
19
|
+
/* Used to increase hit sizes across smaller inputs. */
|
|
20
|
+
--form-element-inset: -4.5px;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
/* Default tone mirrors untoned surface except for backgrounds */
|
package/src/index.ts
CHANGED
|
@@ -24,7 +24,6 @@ export * from './components/indicator/Indicator'
|
|
|
24
24
|
export * from './components/indicator-stack/IndicatorStack'
|
|
25
25
|
export * from './components/inline/Inline'
|
|
26
26
|
export * from './components/kbd/KBD'
|
|
27
|
-
export * from './components/label/Label'
|
|
28
27
|
export * from './components/link/Link'
|
|
29
28
|
export * from './components/list/List'
|
|
30
29
|
export * from './components/popover/Popover'
|
package/src/types/TextAlign.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// This file is generated by scripts/write-version.js. Do not edit.
|
|
2
|
-
export const VERSION = '
|
|
3
|
-
export const HASH = '
|
|
2
|
+
export const VERSION = '500alpha20'
|
|
3
|
+
export const HASH = '77fbb7'
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx'
|
|
2
|
-
|
|
3
|
-
import {getProps} from '../../utils/getProps'
|
|
4
|
-
import {suffixClassName} from '../../utils/suffixClassName'
|
|
5
|
-
import {Text} from '../text/Text'
|
|
6
|
-
import {type LabelProps, labelProps} from './label.props'
|
|
7
|
-
|
|
8
|
-
const labelClassName = suffixClassName('sui-Label')
|
|
9
|
-
|
|
10
|
-
/** @beta */
|
|
11
|
-
export function Label(props: LabelProps) {
|
|
12
|
-
const {children, className, style, disabled, error, ...rest} = getProps(props, labelProps)
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<Text
|
|
16
|
-
as="label"
|
|
17
|
-
size={1}
|
|
18
|
-
muted={disabled}
|
|
19
|
-
className={clsx(
|
|
20
|
-
labelClassName,
|
|
21
|
-
'sui-display-flex sui-align-items-center sui-gap2',
|
|
22
|
-
error && 'sui-error',
|
|
23
|
-
className,
|
|
24
|
-
)}
|
|
25
|
-
style={style}
|
|
26
|
-
data-ui="Label"
|
|
27
|
-
{...rest}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</Text>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type {LabelProps}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {type MarginProps, marginProps} from '../../props/margin'
|
|
2
|
-
import {type PropDef} from '../../types/PropDef'
|
|
3
|
-
|
|
4
|
-
/** @beta */
|
|
5
|
-
export interface LabelProps extends React.ComponentProps<'label'>, MarginProps {
|
|
6
|
-
/**
|
|
7
|
-
* Renders the label in a muted color.
|
|
8
|
-
*/
|
|
9
|
-
disabled?: boolean
|
|
10
|
-
/**
|
|
11
|
-
* Renders the label in the error color.
|
|
12
|
-
* @remarks Use when the linked input has a validation error.
|
|
13
|
-
*/
|
|
14
|
-
error?: boolean
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const labelProps: Record<string, PropDef> = {
|
|
18
|
-
disabled: {
|
|
19
|
-
type: 'boolean',
|
|
20
|
-
},
|
|
21
|
-
error: {
|
|
22
|
-
type: 'boolean',
|
|
23
|
-
},
|
|
24
|
-
...marginProps,
|
|
25
|
-
}
|