@gridui/choice 1.3.0 → 2.0.0
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/README.md +21 -4
- package/dist/index.js +37 -22
- package/dist/index.js.map +4 -4
- package/dist/shared/context.d.ts +5 -1
- package/dist/shared/size.d.ts +3 -0
- package/dist/shared/switch-control.d.ts +6 -0
- package/dist/shared/switch-indicator.d.ts +6 -0
- package/dist/shared/use-choice.d.ts +2 -0
- package/dist/styled.js +3 -0
- package/dist/styles.css +178 -43
- package/dist/styles.local.css +490 -0
- package/dist/switch-group/switch-group.d.ts +3 -1
- package/dist/switch-panel/switch-panel.d.ts +4 -1
- package/dist/toggle-group/toggle-group.d.ts +2 -0
- package/dist/toggle-group-item/toggle-group-item.d.ts +4 -1
- package/docs/catalog.json +14 -13
- package/docs/reference/checkbox.md +10 -2
- package/docs/reference/switch-group.md +12 -4
- package/docs/reference/switch-panel.md +10 -2
- package/docs/reference/switch.md +8 -2
- package/docs/reference/toggle-group-item.md +10 -2
- package/docs/reference/toggle-group.md +10 -2
- package/docs/switches.md +1 -1
- package/docs/tabs-and-choices.md +1 -1
- package/package.json +14 -9
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer theme {
|
|
5
|
+
:root, :host {
|
|
6
|
+
--font-weight-medium: 500;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
@layer utilities {
|
|
10
|
+
.gridui-u-choice--sr-only {
|
|
11
|
+
position: absolute;
|
|
12
|
+
width: 1px;
|
|
13
|
+
height: 1px;
|
|
14
|
+
padding: 0;
|
|
15
|
+
margin: -1px;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
clip-path: inset(50%);
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
border-width: 0;
|
|
20
|
+
}
|
|
21
|
+
.gridui-u-choice--grid {
|
|
22
|
+
display: grid;
|
|
23
|
+
}
|
|
24
|
+
.gridui-u-choice--inline-flex {
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
}
|
|
27
|
+
.gridui-u-choice--min-h-\(--gridui-choice-target\) {
|
|
28
|
+
min-height: var(--gridui-choice-target);
|
|
29
|
+
}
|
|
30
|
+
.gridui-u-choice--w-fit {
|
|
31
|
+
width: fit-content;
|
|
32
|
+
}
|
|
33
|
+
.gridui-u-choice--w-full {
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
.gridui-u-choice--max-w-full {
|
|
37
|
+
max-width: 100%;
|
|
38
|
+
}
|
|
39
|
+
.gridui-u-choice--min-w-\(--gridui-choice-target\) {
|
|
40
|
+
min-width: var(--gridui-choice-target);
|
|
41
|
+
}
|
|
42
|
+
.gridui-u-choice--min-w-0 {
|
|
43
|
+
min-width: 0px;
|
|
44
|
+
}
|
|
45
|
+
.gridui-u-choice--shrink-0 {
|
|
46
|
+
flex-shrink: 0;
|
|
47
|
+
}
|
|
48
|
+
.gridui-u-choice--grow {
|
|
49
|
+
flex-grow: 1;
|
|
50
|
+
}
|
|
51
|
+
.gridui-u-choice--basis-auto {
|
|
52
|
+
flex-basis: auto;
|
|
53
|
+
}
|
|
54
|
+
.gridui-u-choice--cursor-pointer {
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
}
|
|
57
|
+
.gridui-u-choice--auto-cols-fr {
|
|
58
|
+
grid-auto-columns: minmax(0, 1fr);
|
|
59
|
+
}
|
|
60
|
+
.gridui-u-choice--grid-flow-col {
|
|
61
|
+
grid-auto-flow: column;
|
|
62
|
+
}
|
|
63
|
+
.gridui-u-choice--flex-wrap {
|
|
64
|
+
flex-wrap: wrap;
|
|
65
|
+
}
|
|
66
|
+
.gridui-u-choice--items-center {
|
|
67
|
+
align-items: center;
|
|
68
|
+
}
|
|
69
|
+
.gridui-u-choice--justify-center {
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
72
|
+
.gridui-u-choice--gap-px {
|
|
73
|
+
gap: 1px;
|
|
74
|
+
}
|
|
75
|
+
.gridui-u-choice--rounded-control {
|
|
76
|
+
border-radius: var(--gridui-control-radius);
|
|
77
|
+
}
|
|
78
|
+
.gridui-u-choice--border {
|
|
79
|
+
border-style: var(--tw-border-style);
|
|
80
|
+
border-width: 1px;
|
|
81
|
+
}
|
|
82
|
+
.gridui-u-choice--border-0 {
|
|
83
|
+
border-style: var(--tw-border-style);
|
|
84
|
+
border-width: 0px;
|
|
85
|
+
}
|
|
86
|
+
.gridui-u-choice--border-x-0 {
|
|
87
|
+
border-inline-style: var(--tw-border-style);
|
|
88
|
+
border-inline-width: 0px;
|
|
89
|
+
}
|
|
90
|
+
.gridui-u-choice--border-t-0 {
|
|
91
|
+
border-top-style: var(--tw-border-style);
|
|
92
|
+
border-top-width: 0px;
|
|
93
|
+
}
|
|
94
|
+
.gridui-u-choice--border-solid {
|
|
95
|
+
--tw-border-style: solid;
|
|
96
|
+
border-style: solid;
|
|
97
|
+
}
|
|
98
|
+
.gridui-u-choice--border-border {
|
|
99
|
+
border-color: var(--gridui-border);
|
|
100
|
+
}
|
|
101
|
+
.gridui-u-choice--border-transparent {
|
|
102
|
+
border-color: transparent;
|
|
103
|
+
}
|
|
104
|
+
.gridui-u-choice--bg-background {
|
|
105
|
+
background-color: var(--gridui-background);
|
|
106
|
+
}
|
|
107
|
+
.gridui-u-choice--bg-border {
|
|
108
|
+
background-color: var(--gridui-border);
|
|
109
|
+
}
|
|
110
|
+
.gridui-u-choice--bg-transparent {
|
|
111
|
+
background-color: transparent;
|
|
112
|
+
}
|
|
113
|
+
.gridui-u-choice--p-0 {
|
|
114
|
+
padding: 0px;
|
|
115
|
+
}
|
|
116
|
+
.gridui-u-choice--px-\(--gridui-choice-inline\) {
|
|
117
|
+
padding-inline: var(--gridui-choice-inline);
|
|
118
|
+
}
|
|
119
|
+
.gridui-u-choice--py-\(--gridui-choice-block\) {
|
|
120
|
+
padding-block: var(--gridui-choice-block);
|
|
121
|
+
}
|
|
122
|
+
.gridui-u-choice--text-center {
|
|
123
|
+
text-align: center;
|
|
124
|
+
}
|
|
125
|
+
.gridui-u-choice--align-middle {
|
|
126
|
+
vertical-align: middle;
|
|
127
|
+
}
|
|
128
|
+
.gridui-u-choice--type-caption {
|
|
129
|
+
font: var(--gridui-type-caption);
|
|
130
|
+
font-family: var(--gridui-font-body);
|
|
131
|
+
letter-spacing: normal;
|
|
132
|
+
}
|
|
133
|
+
.gridui-u-choice--type-supporting {
|
|
134
|
+
font: var(--gridui-type-supporting);
|
|
135
|
+
font-family: var(--gridui-font-body);
|
|
136
|
+
letter-spacing: normal;
|
|
137
|
+
}
|
|
138
|
+
.gridui-u-choice--type-ui {
|
|
139
|
+
font: var(--gridui-type-ui);
|
|
140
|
+
font-family: var(--gridui-font-body);
|
|
141
|
+
letter-spacing: normal;
|
|
142
|
+
}
|
|
143
|
+
.gridui-u-choice--wrap-anywhere {
|
|
144
|
+
overflow-wrap: anywhere;
|
|
145
|
+
}
|
|
146
|
+
.gridui-u-choice--whitespace-normal {
|
|
147
|
+
white-space: normal;
|
|
148
|
+
}
|
|
149
|
+
.gridui-u-choice--text-foreground {
|
|
150
|
+
color: var(--gridui-foreground);
|
|
151
|
+
}
|
|
152
|
+
.gridui-u-choice--\[--gridui-choice-block\:var\(--gridui-space-4\)\] {
|
|
153
|
+
--gridui-choice-block: var(--gridui-space-4);
|
|
154
|
+
}
|
|
155
|
+
.gridui-u-choice--\[--gridui-choice-block\:var\(--gridui-space-8\)\] {
|
|
156
|
+
--gridui-choice-block: var(--gridui-space-8);
|
|
157
|
+
}
|
|
158
|
+
.gridui-u-choice--\[--gridui-choice-inline\:var\(--gridui-space-8\)\] {
|
|
159
|
+
--gridui-choice-inline: var(--gridui-space-8);
|
|
160
|
+
}
|
|
161
|
+
.gridui-u-choice--\[--gridui-choice-inline\:var\(--gridui-space-16\)\] {
|
|
162
|
+
--gridui-choice-inline: var(--gridui-space-16);
|
|
163
|
+
}
|
|
164
|
+
.gridui-u-choice--\[--gridui-choice-inline\:var\(--gridui-space-24\)\] {
|
|
165
|
+
--gridui-choice-inline: var(--gridui-space-24);
|
|
166
|
+
}
|
|
167
|
+
.gridui-u-choice--\[--gridui-choice-mark\:1\.5rem\] {
|
|
168
|
+
--gridui-choice-mark: 1.5rem;
|
|
169
|
+
}
|
|
170
|
+
.gridui-u-choice--\[--gridui-choice-mark\:1\.25rem\] {
|
|
171
|
+
--gridui-choice-mark: 1.25rem;
|
|
172
|
+
}
|
|
173
|
+
.gridui-u-choice--\[--gridui-choice-mark\:1rem\] {
|
|
174
|
+
--gridui-choice-mark: 1rem;
|
|
175
|
+
}
|
|
176
|
+
.gridui-u-choice--\[--gridui-choice-target\:max\(var\(--gridui-control-min-height-large\)\,var\(--gridui-target-min-size\)\)\] {
|
|
177
|
+
--gridui-choice-target: max(var(--gridui-control-min-height-large), var(--gridui-target-min-size));
|
|
178
|
+
}
|
|
179
|
+
.gridui-u-choice--\[--gridui-choice-target\:max\(var\(--gridui-control-min-height-medium\)\,var\(--gridui-target-min-size\)\)\] {
|
|
180
|
+
--gridui-choice-target: max(var(--gridui-control-min-height-medium), var(--gridui-target-min-size));
|
|
181
|
+
}
|
|
182
|
+
.gridui-u-choice--\[--gridui-choice-target\:max\(var\(--gridui-control-min-height-small\)\,var\(--gridui-target-min-size\)\)\] {
|
|
183
|
+
--gridui-choice-target: max(var(--gridui-control-min-height-small), var(--gridui-target-min-size));
|
|
184
|
+
}
|
|
185
|
+
.gridui-u-choice--data-disabled\:cursor-not-allowed[data-disabled] {
|
|
186
|
+
cursor: not-allowed;
|
|
187
|
+
}
|
|
188
|
+
.gridui-u-choice--data-disabled\:opacity-50[data-disabled] {
|
|
189
|
+
opacity: 50%;
|
|
190
|
+
}
|
|
191
|
+
.gridui-u-choice--data-readonly\:cursor-default[data-readonly] {
|
|
192
|
+
cursor: default;
|
|
193
|
+
}
|
|
194
|
+
.gridui-u-choice--data-\[orientation\=horizontal\]\:border-b-2[data-orientation="horizontal"] {
|
|
195
|
+
border-bottom-style: var(--tw-border-style);
|
|
196
|
+
border-bottom-width: 2px;
|
|
197
|
+
}
|
|
198
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:grid-flow-row[data-orientation="vertical"] {
|
|
199
|
+
grid-auto-flow: row;
|
|
200
|
+
}
|
|
201
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:auto-rows-fr[data-orientation="vertical"] {
|
|
202
|
+
grid-auto-rows: minmax(0, 1fr);
|
|
203
|
+
}
|
|
204
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:grid-cols-1[data-orientation="vertical"] {
|
|
205
|
+
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
206
|
+
}
|
|
207
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:flex-col[data-orientation="vertical"] {
|
|
208
|
+
flex-direction: column;
|
|
209
|
+
}
|
|
210
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:border-r-2[data-orientation="vertical"] {
|
|
211
|
+
border-right-style: var(--tw-border-style);
|
|
212
|
+
border-right-width: 2px;
|
|
213
|
+
}
|
|
214
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:border-b-0[data-orientation="vertical"] {
|
|
215
|
+
border-bottom-style: var(--tw-border-style);
|
|
216
|
+
border-bottom-width: 0px;
|
|
217
|
+
}
|
|
218
|
+
.gridui-u-choice--data-\[state\=on\]\:bg-selection-background[data-state="on"] {
|
|
219
|
+
background-color: var(--gridui-selection-background);
|
|
220
|
+
}
|
|
221
|
+
.gridui-u-choice--data-\[state\=on\]\:font-medium[data-state="on"] {
|
|
222
|
+
--tw-font-weight: var(--font-weight-medium);
|
|
223
|
+
font-weight: var(--font-weight-medium);
|
|
224
|
+
}
|
|
225
|
+
.gridui-u-choice--data-\[state\=on\]\:text-foreground[data-state="on"] {
|
|
226
|
+
color: var(--gridui-foreground);
|
|
227
|
+
}
|
|
228
|
+
.gridui-u-choice--rtl\:data-\[orientation\=vertical\]\:border-r-0:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
|
|
229
|
+
border-right-style: var(--tw-border-style);
|
|
230
|
+
border-right-width: 0px;
|
|
231
|
+
}
|
|
232
|
+
.gridui-u-choice--rtl\:data-\[orientation\=vertical\]\:border-l-2:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
|
|
233
|
+
border-left-style: var(--tw-border-style);
|
|
234
|
+
border-left-width: 2px;
|
|
235
|
+
}
|
|
236
|
+
@media (forced-colors: active) {
|
|
237
|
+
.gridui-u-choice--forced-colors\:outline-\[CanvasText\] {
|
|
238
|
+
outline-color: CanvasText;
|
|
239
|
+
}
|
|
240
|
+
.gridui-u-choice--forced-colors\:data-\[state\=on\]\:bg-\[Highlight\][data-state="on"] {
|
|
241
|
+
background-color: Highlight;
|
|
242
|
+
}
|
|
243
|
+
.gridui-u-choice--forced-colors\:data-\[state\=on\]\:text-\[HighlightText\][data-state="on"] {
|
|
244
|
+
color: HighlightText;
|
|
245
|
+
}
|
|
246
|
+
.gridui-u-choice--forced-colors\:data-\[state\=on\]\:forced-color-adjust-none[data-state="on"] {
|
|
247
|
+
forced-color-adjust: none;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
@layer components {
|
|
252
|
+
.gridui-switch-control, .gridui-switch-indicator, .gridui-switch-setting-copy, .gridui-switch-setting-end {
|
|
253
|
+
box-sizing: border-box;
|
|
254
|
+
}
|
|
255
|
+
.gridui-switch-control {
|
|
256
|
+
color: var(--gridui-foreground);
|
|
257
|
+
border-radius: var(--gridui-control-radius);
|
|
258
|
+
cursor: pointer;
|
|
259
|
+
}
|
|
260
|
+
.gridui-switch-control:disabled {
|
|
261
|
+
cursor: not-allowed;
|
|
262
|
+
}
|
|
263
|
+
.gridui-switch-control[data-readonly] {
|
|
264
|
+
cursor: default;
|
|
265
|
+
}
|
|
266
|
+
.gridui-switch-indicator {
|
|
267
|
+
--_gridui-switch-thumb-size: calc(var(--gridui-choice-mark) * 0.9);
|
|
268
|
+
display: inline-flex;
|
|
269
|
+
flex-shrink: 0;
|
|
270
|
+
align-items: center;
|
|
271
|
+
width: calc(var(--gridui-choice-mark) * 2.4);
|
|
272
|
+
height: calc(var(--gridui-choice-mark) * 1.3);
|
|
273
|
+
padding: var(--gridui-space-2);
|
|
274
|
+
border: 1px solid var(--gridui-control-border);
|
|
275
|
+
border-radius: var(--gridui-control-radius);
|
|
276
|
+
background: var(--gridui-background);
|
|
277
|
+
color: var(--gridui-foreground);
|
|
278
|
+
pointer-events: none;
|
|
279
|
+
transition: var(--gridui-motion-transition, background-color calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)), border-color calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)));
|
|
280
|
+
}
|
|
281
|
+
.gridui-switch-indicator[data-state="checked"] {
|
|
282
|
+
border-color: var(--gridui-accent-background);
|
|
283
|
+
background: var(--gridui-selection-background);
|
|
284
|
+
}
|
|
285
|
+
.gridui-switch-thumb {
|
|
286
|
+
flex-shrink: 0;
|
|
287
|
+
width: var(--_gridui-switch-thumb-size);
|
|
288
|
+
height: var(--_gridui-switch-thumb-size);
|
|
289
|
+
margin-inline-start: 0;
|
|
290
|
+
border-radius: var(--gridui-control-radius);
|
|
291
|
+
background: var(--gridui-muted);
|
|
292
|
+
transition: var(--gridui-motion-transition, margin-inline-start calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out));
|
|
293
|
+
}
|
|
294
|
+
.gridui-switch-indicator[data-state="checked"] .gridui-switch-thumb {
|
|
295
|
+
margin-inline-start: max(0px, calc(100% - var(--_gridui-switch-thumb-size)));
|
|
296
|
+
background: var(--gridui-accent-background);
|
|
297
|
+
}
|
|
298
|
+
.gridui-switch-indicator[data-variant="state"] {
|
|
299
|
+
justify-content: center;
|
|
300
|
+
gap: var(--gridui-space-4);
|
|
301
|
+
width: max-content;
|
|
302
|
+
min-width: min(4.5rem, 100%);
|
|
303
|
+
max-width: 100%;
|
|
304
|
+
height: auto;
|
|
305
|
+
min-height: calc(var(--gridui-choice-mark) * 1.6);
|
|
306
|
+
padding: var(--gridui-space-4) var(--gridui-space-8);
|
|
307
|
+
}
|
|
308
|
+
.gridui-switch-indicator[data-variant="state"][data-state="checked"] {
|
|
309
|
+
color: var(--gridui-accent-foreground);
|
|
310
|
+
background: var(--gridui-accent-background);
|
|
311
|
+
}
|
|
312
|
+
.gridui-switch-state-icon {
|
|
313
|
+
flex-shrink: 0;
|
|
314
|
+
width: var(--gridui-icon-size);
|
|
315
|
+
height: var(--gridui-icon-size);
|
|
316
|
+
}
|
|
317
|
+
.gridui-switch-state-label {
|
|
318
|
+
min-width: 0;
|
|
319
|
+
text-align: center;
|
|
320
|
+
overflow-wrap: anywhere;
|
|
321
|
+
}
|
|
322
|
+
.gridui-switch-control[aria-invalid="true"] .gridui-switch-indicator {
|
|
323
|
+
border-color: var(--gridui-status-danger-border);
|
|
324
|
+
}
|
|
325
|
+
.gridui-switch-setting {
|
|
326
|
+
display: flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
justify-content: space-between;
|
|
329
|
+
gap: var(--gridui-space-16);
|
|
330
|
+
width: 100%;
|
|
331
|
+
min-width: 0;
|
|
332
|
+
min-height: var(--gridui-choice-target);
|
|
333
|
+
padding: var(--gridui-space-12) var(--gridui-space-16);
|
|
334
|
+
border: 0;
|
|
335
|
+
background: var(--gridui-background);
|
|
336
|
+
text-align: start;
|
|
337
|
+
}
|
|
338
|
+
.gridui-switch-setting-copy {
|
|
339
|
+
display: grid;
|
|
340
|
+
gap: var(--gridui-space-4);
|
|
341
|
+
flex: 1;
|
|
342
|
+
min-width: 0;
|
|
343
|
+
overflow-wrap: anywhere;
|
|
344
|
+
}
|
|
345
|
+
.gridui-switch-setting-description {
|
|
346
|
+
color: var(--gridui-muted);
|
|
347
|
+
}
|
|
348
|
+
.gridui-switch-setting-end {
|
|
349
|
+
display: flex;
|
|
350
|
+
align-items: center;
|
|
351
|
+
justify-content: center;
|
|
352
|
+
flex-shrink: 0;
|
|
353
|
+
max-width: 45%;
|
|
354
|
+
}
|
|
355
|
+
.gridui-switch-control:disabled:not(.gridui-switch-setting), .gridui-switch-setting:disabled > .gridui-switch-setting-copy, .gridui-switch-setting:disabled > .gridui-switch-setting-end > .gridui-switch-indicator {
|
|
356
|
+
opacity: 0.5;
|
|
357
|
+
}
|
|
358
|
+
@media (forced-colors: active) {
|
|
359
|
+
.gridui-switch-thumb {
|
|
360
|
+
background: CanvasText;
|
|
361
|
+
forced-color-adjust: none;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
@media (prefers-reduced-motion: reduce) {
|
|
365
|
+
.gridui-switch-indicator, .gridui-switch-thumb {
|
|
366
|
+
transition: none;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
.gridui-switch-group {
|
|
370
|
+
box-sizing: border-box;
|
|
371
|
+
min-width: 0;
|
|
372
|
+
margin: 0;
|
|
373
|
+
padding: 0;
|
|
374
|
+
border: 1px solid var(--gridui-border);
|
|
375
|
+
border-radius: var(--gridui-control-radius);
|
|
376
|
+
}
|
|
377
|
+
.gridui-switch-group-legend {
|
|
378
|
+
margin-inline: var(--gridui-space-8);
|
|
379
|
+
padding-inline: var(--gridui-space-8);
|
|
380
|
+
color: var(--gridui-foreground);
|
|
381
|
+
}
|
|
382
|
+
.gridui-switch-group > .gridui-switch-setting ~ .gridui-switch-setting {
|
|
383
|
+
border-block-start: 1px solid var(--gridui-border);
|
|
384
|
+
}
|
|
385
|
+
.gridui-switch-group[data-density="compact"] > .gridui-switch-setting {
|
|
386
|
+
min-height: var(--gridui-choice-target);
|
|
387
|
+
padding-block: var(--gridui-space-8);
|
|
388
|
+
}
|
|
389
|
+
.gridui-switch-group[data-density="comfortable"] > .gridui-switch-setting {
|
|
390
|
+
min-height: var(--gridui-choice-target);
|
|
391
|
+
padding-block: var(--gridui-space-16);
|
|
392
|
+
}
|
|
393
|
+
.gridui-switch-panel {
|
|
394
|
+
box-sizing: border-box;
|
|
395
|
+
min-width: 0;
|
|
396
|
+
border: 1px solid var(--gridui-border);
|
|
397
|
+
border-radius: var(--gridui-control-radius);
|
|
398
|
+
background: var(--gridui-background);
|
|
399
|
+
color: var(--gridui-foreground);
|
|
400
|
+
}
|
|
401
|
+
.gridui-switch-panel > .gridui-switch-setting {
|
|
402
|
+
align-items: stretch;
|
|
403
|
+
gap: 0;
|
|
404
|
+
min-height: 5rem;
|
|
405
|
+
padding: 0;
|
|
406
|
+
}
|
|
407
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-copy {
|
|
408
|
+
align-content: center;
|
|
409
|
+
padding: var(--gridui-space-16);
|
|
410
|
+
}
|
|
411
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end {
|
|
412
|
+
width: 6rem;
|
|
413
|
+
border-inline-start: 1px solid var(--gridui-border);
|
|
414
|
+
background: var(--gridui-surface);
|
|
415
|
+
}
|
|
416
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end > .gridui-switch-indicator[data-variant="rail"] {
|
|
417
|
+
position: relative;
|
|
418
|
+
border-color: transparent;
|
|
419
|
+
background: transparent;
|
|
420
|
+
}
|
|
421
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end > .gridui-switch-indicator[data-variant="rail"]::before {
|
|
422
|
+
content: "";
|
|
423
|
+
position: absolute;
|
|
424
|
+
inset-inline: var(--gridui-space-2);
|
|
425
|
+
height: 1px;
|
|
426
|
+
background: var(--gridui-control-border);
|
|
427
|
+
}
|
|
428
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end > .gridui-switch-indicator > .gridui-switch-thumb {
|
|
429
|
+
position: relative;
|
|
430
|
+
}
|
|
431
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end > .gridui-switch-indicator[data-variant="state"] {
|
|
432
|
+
align-self: stretch;
|
|
433
|
+
width: 100%;
|
|
434
|
+
border: 0;
|
|
435
|
+
}
|
|
436
|
+
.gridui-switch-panel > .gridui-switch-setting[aria-invalid="true"] {
|
|
437
|
+
box-shadow: inset 0 0 0 1px var(--gridui-status-danger-border);
|
|
438
|
+
}
|
|
439
|
+
.gridui-switch-panel-content {
|
|
440
|
+
box-sizing: border-box;
|
|
441
|
+
padding: var(--gridui-space-16);
|
|
442
|
+
border-block-start: 1px solid var(--gridui-border);
|
|
443
|
+
}
|
|
444
|
+
.gridui-checkbox {
|
|
445
|
+
min-inline-size: var(--gridui-choice-target);
|
|
446
|
+
min-block-size: var(--gridui-choice-target);
|
|
447
|
+
}
|
|
448
|
+
.gridui-checkbox-mark {
|
|
449
|
+
display: inline-flex;
|
|
450
|
+
align-items: center;
|
|
451
|
+
justify-content: center;
|
|
452
|
+
inline-size: var(--gridui-choice-mark);
|
|
453
|
+
block-size: var(--gridui-choice-mark);
|
|
454
|
+
border: 1px solid var(--gridui-control-border);
|
|
455
|
+
background: var(--gridui-background);
|
|
456
|
+
border-radius: var(--gridui-control-radius);
|
|
457
|
+
}
|
|
458
|
+
.gridui-checkbox:is([data-state="checked"], [data-state="indeterminate"]) .gridui-checkbox-mark {
|
|
459
|
+
background: var(--gridui-accent-background);
|
|
460
|
+
color: var(--gridui-accent-foreground);
|
|
461
|
+
}
|
|
462
|
+
.gridui-checkbox[aria-invalid="true"] .gridui-checkbox-mark {
|
|
463
|
+
border-color: var(--gridui-status-danger-border);
|
|
464
|
+
}
|
|
465
|
+
.gridui-checkbox-mark svg {
|
|
466
|
+
inline-size: calc(var(--gridui-choice-mark) - 0.25rem);
|
|
467
|
+
block-size: calc(var(--gridui-choice-mark) - 0.25rem);
|
|
468
|
+
}
|
|
469
|
+
.gridui-checkbox-mark svg > path {
|
|
470
|
+
stroke-width: 1.5px;
|
|
471
|
+
vector-effect: non-scaling-stroke;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
@property --tw-border-style {
|
|
475
|
+
syntax: "*";
|
|
476
|
+
inherits: false;
|
|
477
|
+
initial-value: solid;
|
|
478
|
+
}
|
|
479
|
+
@property --tw-font-weight {
|
|
480
|
+
syntax: "*";
|
|
481
|
+
inherits: false;
|
|
482
|
+
}
|
|
483
|
+
@layer properties {
|
|
484
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
485
|
+
*, ::before, ::after, ::backdrop {
|
|
486
|
+
--tw-border-style: solid;
|
|
487
|
+
--tw-font-weight: initial;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @namespace SwitchGroup
|
|
5
5
|
* @description Switch Group
|
|
6
6
|
*/
|
|
7
|
+
import type { Size, Density } from "@gridui/theme";
|
|
7
8
|
import type { SwitchOptions, SwitchPresentationProps, SwitchSettingCopy } from "../shared/switch-options";
|
|
8
9
|
import type { ComponentPropsWithRef, FC, ReactNode } from "react";
|
|
9
10
|
export type SwitchGroupItem = SwitchOptions & SwitchSettingCopy & {
|
|
@@ -13,6 +14,7 @@ export type SwitchGroupItem = SwitchOptions & SwitchSettingCopy & {
|
|
|
13
14
|
export type SwitchGroupProps = Omit<ComponentPropsWithRef<"fieldset">, "children"> & SwitchPresentationProps & {
|
|
14
15
|
readonly items: readonly SwitchGroupItem[];
|
|
15
16
|
readonly legend?: ReactNode;
|
|
16
|
-
readonly density?:
|
|
17
|
+
readonly density?: Density;
|
|
18
|
+
readonly size?: Size;
|
|
17
19
|
};
|
|
18
20
|
export declare const SwitchGroup: FC<SwitchGroupProps>;
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* @namespace SwitchPanel
|
|
5
5
|
* @description Switch Panel
|
|
6
6
|
*/
|
|
7
|
+
import type { Size } from "@gridui/theme";
|
|
7
8
|
import type { SwitchSettingOptions } from "../shared/switch-options";
|
|
8
9
|
import { type ComponentPropsWithRef, type FC } from "react";
|
|
9
|
-
export type SwitchPanelProps = ComponentPropsWithRef<"div"> & SwitchSettingOptions
|
|
10
|
+
export type SwitchPanelProps = ComponentPropsWithRef<"div"> & SwitchSettingOptions & {
|
|
11
|
+
readonly size?: Size;
|
|
12
|
+
};
|
|
10
13
|
export declare const SwitchPanel: FC<SwitchPanelProps>;
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* @namespace ToggleGroup
|
|
5
5
|
* @description Toggle Group
|
|
6
6
|
*/
|
|
7
|
+
import type { Size } from "@gridui/theme";
|
|
7
8
|
import * as Primitive from "@radix-ui/react-toggle-group";
|
|
8
9
|
import { type ComponentPropsWithRef, type FC } from "react";
|
|
9
10
|
export type ToggleGroupProps = Omit<ComponentPropsWithRef<typeof Primitive.Root>, "type" | "value" | "defaultValue" | "onValueChange" | "loop"> & {
|
|
11
|
+
readonly size?: Size;
|
|
10
12
|
readonly multiple?: boolean | undefined;
|
|
11
13
|
readonly value?: string[] | undefined;
|
|
12
14
|
readonly defaultValue?: string[] | undefined;
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* @namespace ToggleGroupItem
|
|
5
5
|
* @description Toggle Group Item
|
|
6
6
|
*/
|
|
7
|
+
import type { Size } from "@gridui/theme";
|
|
7
8
|
import * as Primitive from "@radix-ui/react-toggle-group";
|
|
8
9
|
import { type ComponentPropsWithRef, type FC } from "react";
|
|
9
|
-
export type ToggleGroupItemProps = ComponentPropsWithRef<typeof Primitive.Item
|
|
10
|
+
export type ToggleGroupItemProps = ComponentPropsWithRef<typeof Primitive.Item> & {
|
|
11
|
+
readonly size?: Size;
|
|
12
|
+
};
|
|
10
13
|
export declare const ToggleGroupItem: FC<ToggleGroupItemProps>;
|
package/docs/catalog.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/choice",
|
|
4
|
-
"version": "
|
|
5
|
-
"category": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"category": "controls",
|
|
6
6
|
"description": "GridUI React choice",
|
|
7
|
-
"usage": "
|
|
7
|
+
"usage": "Controls family. Public components: `Checkbox`, `Switch`, `SwitchGroup`, `SwitchPanel`, `ToggleGroup`, and `ToggleGroupItem`. Each exports its named Props contract. Switch presentation types and `SwitchGroupItem` describe their supported configuration.",
|
|
8
8
|
"documentation": [
|
|
9
9
|
"README.md",
|
|
10
10
|
"docs/reference/README.md",
|
|
@@ -99,16 +99,17 @@
|
|
|
99
99
|
"@gridui/form/styles.css",
|
|
100
100
|
"@gridui/choice/styles.css"
|
|
101
101
|
],
|
|
102
|
+
"styledImport": "@gridui/choice/styled",
|
|
102
103
|
"examples": [
|
|
103
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
104
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
105
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
106
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
107
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
108
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
109
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
110
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
111
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
112
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
104
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/boolean-settings.mdx",
|
|
105
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/checkboxes.mdx",
|
|
106
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/getting-started.mdx",
|
|
107
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/settings-panels.mdx",
|
|
108
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/toggle-selections.mdx",
|
|
109
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/checkbox.stories.tsx",
|
|
110
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/switch-control.stories.tsx",
|
|
111
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/switch-group.stories.tsx",
|
|
112
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/switch-panel.stories.tsx",
|
|
113
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/toggle-group.stories.tsx"
|
|
113
114
|
]
|
|
114
115
|
}
|
|
@@ -11,9 +11,9 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/choice/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
|
-
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/checkbox.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
17
|
|
|
18
18
|
## API
|
|
19
19
|
|
|
@@ -51,6 +51,14 @@ Default: ``"on"``
|
|
|
51
51
|
|
|
52
52
|
Controlled value. Pair with the corresponding change callback.
|
|
53
53
|
|
|
54
|
+
### size
|
|
55
|
+
|
|
56
|
+
``Size | undefined`` · Optional
|
|
57
|
+
|
|
58
|
+
Default: ``"medium"``
|
|
59
|
+
|
|
60
|
+
Component size preset.
|
|
61
|
+
|
|
54
62
|
### checked
|
|
55
63
|
|
|
56
64
|
``boolean | undefined`` · Optional
|
|
@@ -11,9 +11,9 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/choice/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
|
-
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/switch-group.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
17
|
|
|
18
18
|
## API
|
|
19
19
|
|
|
@@ -71,7 +71,15 @@ Visible state words; the accessible name must describe the setting.
|
|
|
71
71
|
|
|
72
72
|
### density
|
|
73
73
|
|
|
74
|
-
``
|
|
74
|
+
``Density | undefined`` · Optional
|
|
75
75
|
|
|
76
|
-
Default: ``"
|
|
76
|
+
Default: ``"comfortable"``
|
|
77
|
+
|
|
78
|
+
### size
|
|
79
|
+
|
|
80
|
+
``Size | undefined`` · Optional
|
|
81
|
+
|
|
82
|
+
Default: ``"medium"``
|
|
83
|
+
|
|
84
|
+
Component size preset.
|
|
77
85
|
|
|
@@ -11,9 +11,9 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/choice/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
|
-
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-controls/choice/stories/switch-panel.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
17
|
|
|
18
18
|
## API
|
|
19
19
|
|
|
@@ -69,3 +69,11 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
|
|
|
69
69
|
|
|
70
70
|
State, form attributes, accessible overrides and ref for the switch button.
|
|
71
71
|
|
|
72
|
+
### size
|
|
73
|
+
|
|
74
|
+
``Size | undefined`` · Optional
|
|
75
|
+
|
|
76
|
+
Default: ``"medium"``
|
|
77
|
+
|
|
78
|
+
Component size preset.
|
|
79
|
+
|