@gridui/choice 1.2.3 → 1.2.5
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 +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -13
- package/dist/index.js.map +2 -2
- package/dist/shared/switch-indicator.d.ts +1 -1
- package/dist/shared/switch-options.d.ts +27 -0
- package/dist/shared/switch-setting.d.ts +3 -7
- package/dist/styles.css +93 -65
- package/dist/switch/switch.d.ts +2 -3
- package/dist/switch-group/switch-group.d.ts +2 -5
- package/dist/switch-panel/switch-panel.d.ts +3 -8
- package/docs/catalog.json +12 -1
- package/docs/reference/README.md +9 -0
- package/docs/reference/checkbox.md +95 -0
- package/docs/reference/switch-group.md +77 -0
- package/docs/reference/switch-panel.md +71 -0
- package/docs/reference/switch.md +95 -0
- package/docs/reference/toggle-group-item.md +67 -0
- package/docs/reference/toggle-group.md +117 -0
- package/package.json +5 -5
- package/dist/shared/switch-presentation.d.ts +0 -16
package/dist/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer theme {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
@layer utilities {
|
|
11
|
-
.gridui-u-sr-only {
|
|
11
|
+
.gridui-u-choice--sr-only {
|
|
12
12
|
position: absolute;
|
|
13
13
|
width: 1px;
|
|
14
14
|
height: 1px;
|
|
@@ -19,207 +19,227 @@
|
|
|
19
19
|
white-space: nowrap;
|
|
20
20
|
border-width: 0;
|
|
21
21
|
}
|
|
22
|
-
.gridui-u-grid {
|
|
22
|
+
.gridui-u-choice--grid {
|
|
23
23
|
display: grid;
|
|
24
24
|
}
|
|
25
|
-
.gridui-u-inline-flex {
|
|
25
|
+
.gridui-u-choice--inline-flex {
|
|
26
26
|
display: inline-flex;
|
|
27
27
|
}
|
|
28
|
-
.gridui-u-size-5 {
|
|
28
|
+
.gridui-u-choice--size-5 {
|
|
29
29
|
width: calc(var(--spacing) * 5);
|
|
30
30
|
height: calc(var(--spacing) * 5);
|
|
31
31
|
}
|
|
32
|
-
.gridui-u-min-h-gridui-control {
|
|
32
|
+
.gridui-u-choice--min-h-gridui-control {
|
|
33
33
|
min-height: var(--gridui-control-min-height);
|
|
34
34
|
}
|
|
35
|
-
.gridui-u-w-fit {
|
|
35
|
+
.gridui-u-choice--w-fit {
|
|
36
36
|
width: fit-content;
|
|
37
37
|
}
|
|
38
|
-
.gridui-u-w-full {
|
|
38
|
+
.gridui-u-choice--w-full {
|
|
39
39
|
width: 100%;
|
|
40
40
|
}
|
|
41
|
-
.gridui-u-max-w-full {
|
|
41
|
+
.gridui-u-choice--max-w-full {
|
|
42
42
|
max-width: 100%;
|
|
43
43
|
}
|
|
44
|
-
.gridui-u-min-w-0 {
|
|
44
|
+
.gridui-u-choice--min-w-0 {
|
|
45
45
|
min-width: 0px;
|
|
46
46
|
}
|
|
47
|
-
.gridui-u-min-w-gridui-control {
|
|
47
|
+
.gridui-u-choice--min-w-gridui-control {
|
|
48
48
|
min-width: var(--gridui-control-min-height);
|
|
49
49
|
}
|
|
50
|
-
.gridui-u-shrink-0 {
|
|
50
|
+
.gridui-u-choice--shrink-0 {
|
|
51
51
|
flex-shrink: 0;
|
|
52
52
|
}
|
|
53
|
-
.gridui-u-
|
|
53
|
+
.gridui-u-choice--grow {
|
|
54
|
+
flex-grow: 1;
|
|
55
|
+
}
|
|
56
|
+
.gridui-u-choice--basis-auto {
|
|
57
|
+
flex-basis: auto;
|
|
58
|
+
}
|
|
59
|
+
.gridui-u-choice--cursor-pointer {
|
|
54
60
|
cursor: pointer;
|
|
55
61
|
}
|
|
56
|
-
.gridui-u-auto-cols-fr {
|
|
62
|
+
.gridui-u-choice--auto-cols-fr {
|
|
57
63
|
grid-auto-columns: minmax(0, 1fr);
|
|
58
64
|
}
|
|
59
|
-
.gridui-u-grid-flow-col {
|
|
65
|
+
.gridui-u-choice--grid-flow-col {
|
|
60
66
|
grid-auto-flow: column;
|
|
61
67
|
}
|
|
62
|
-
.gridui-u-flex-wrap {
|
|
68
|
+
.gridui-u-choice--flex-wrap {
|
|
63
69
|
flex-wrap: wrap;
|
|
64
70
|
}
|
|
65
|
-
.gridui-u-items-center {
|
|
71
|
+
.gridui-u-choice--items-center {
|
|
66
72
|
align-items: center;
|
|
67
73
|
}
|
|
68
|
-
.gridui-u-justify-center {
|
|
74
|
+
.gridui-u-choice--justify-center {
|
|
69
75
|
justify-content: center;
|
|
70
76
|
}
|
|
71
|
-
.gridui-u-gap-px {
|
|
77
|
+
.gridui-u-choice--gap-px {
|
|
72
78
|
gap: 1px;
|
|
73
79
|
}
|
|
74
|
-
.gridui-u-rounded-control {
|
|
80
|
+
.gridui-u-choice--rounded-control {
|
|
75
81
|
border-radius: var(--gridui-control-radius);
|
|
76
82
|
}
|
|
77
|
-
.gridui-u-border {
|
|
83
|
+
.gridui-u-choice--border {
|
|
78
84
|
border-style: var(--tw-border-style);
|
|
79
85
|
border-width: 1px;
|
|
80
86
|
}
|
|
81
|
-
.gridui-u-border-0 {
|
|
87
|
+
.gridui-u-choice--border-0 {
|
|
82
88
|
border-style: var(--tw-border-style);
|
|
83
89
|
border-width: 0px;
|
|
84
90
|
}
|
|
85
|
-
.gridui-u-border-x-0 {
|
|
91
|
+
.gridui-u-choice--border-x-0 {
|
|
86
92
|
border-inline-style: var(--tw-border-style);
|
|
87
93
|
border-inline-width: 0px;
|
|
88
94
|
}
|
|
89
|
-
.gridui-u-border-t-0 {
|
|
95
|
+
.gridui-u-choice--border-t-0 {
|
|
90
96
|
border-top-style: var(--tw-border-style);
|
|
91
97
|
border-top-width: 0px;
|
|
92
98
|
}
|
|
93
|
-
.gridui-u-border-solid {
|
|
99
|
+
.gridui-u-choice--border-solid {
|
|
94
100
|
--tw-border-style: solid;
|
|
95
101
|
border-style: solid;
|
|
96
102
|
}
|
|
97
|
-
.gridui-u-border-border {
|
|
103
|
+
.gridui-u-choice--border-border {
|
|
98
104
|
border-color: var(--gridui-border);
|
|
99
105
|
}
|
|
100
|
-
.gridui-u-border-control-border {
|
|
106
|
+
.gridui-u-choice--border-control-border {
|
|
101
107
|
border-color: var(--gridui-control-border);
|
|
102
108
|
}
|
|
103
|
-
.gridui-u-border-transparent {
|
|
109
|
+
.gridui-u-choice--border-transparent {
|
|
104
110
|
border-color: transparent;
|
|
105
111
|
}
|
|
106
|
-
.gridui-u-bg-background {
|
|
112
|
+
.gridui-u-choice--bg-background {
|
|
107
113
|
background-color: var(--gridui-background);
|
|
108
114
|
}
|
|
109
|
-
.gridui-u-bg-border {
|
|
115
|
+
.gridui-u-choice--bg-border {
|
|
110
116
|
background-color: var(--gridui-border);
|
|
111
117
|
}
|
|
112
|
-
.gridui-u-bg-transparent {
|
|
118
|
+
.gridui-u-choice--bg-transparent {
|
|
113
119
|
background-color: transparent;
|
|
114
120
|
}
|
|
115
|
-
.gridui-u-p-0 {
|
|
121
|
+
.gridui-u-choice--p-0 {
|
|
116
122
|
padding: 0px;
|
|
117
123
|
}
|
|
118
|
-
.gridui-u-px-gridui-8 {
|
|
124
|
+
.gridui-u-choice--px-gridui-8 {
|
|
119
125
|
padding-inline: var(--gridui-space-8);
|
|
120
126
|
}
|
|
121
|
-
.gridui-u-px-gridui-16 {
|
|
127
|
+
.gridui-u-choice--px-gridui-16 {
|
|
122
128
|
padding-inline: var(--gridui-space-16);
|
|
123
129
|
}
|
|
124
|
-
.gridui-u-py-gridui-8 {
|
|
130
|
+
.gridui-u-choice--py-gridui-8 {
|
|
125
131
|
padding-block: var(--gridui-space-8);
|
|
126
132
|
}
|
|
127
|
-
.gridui-u-py-gridui-16 {
|
|
133
|
+
.gridui-u-choice--py-gridui-16 {
|
|
128
134
|
padding-block: var(--gridui-space-16);
|
|
129
135
|
}
|
|
130
|
-
.gridui-u-text-center {
|
|
136
|
+
.gridui-u-choice--text-center {
|
|
131
137
|
text-align: center;
|
|
132
138
|
}
|
|
133
|
-
.gridui-u-align-middle {
|
|
139
|
+
.gridui-u-choice--align-middle {
|
|
134
140
|
vertical-align: middle;
|
|
135
141
|
}
|
|
136
|
-
.gridui-u-type-caption {
|
|
142
|
+
.gridui-u-choice--type-caption {
|
|
137
143
|
font: var(--gridui-type-caption);
|
|
138
144
|
letter-spacing: normal;
|
|
139
145
|
}
|
|
140
|
-
.gridui-u-type-supporting {
|
|
146
|
+
.gridui-u-choice--type-supporting {
|
|
141
147
|
font: var(--gridui-type-supporting);
|
|
142
148
|
letter-spacing: normal;
|
|
143
149
|
}
|
|
144
|
-
.gridui-u-type-ui {
|
|
150
|
+
.gridui-u-choice--type-ui {
|
|
145
151
|
font: var(--gridui-type-ui);
|
|
146
152
|
letter-spacing: normal;
|
|
147
153
|
}
|
|
148
|
-
.gridui-u-wrap-anywhere {
|
|
154
|
+
.gridui-u-choice--wrap-anywhere {
|
|
149
155
|
overflow-wrap: anywhere;
|
|
150
156
|
}
|
|
151
|
-
.gridui-u-whitespace-normal {
|
|
157
|
+
.gridui-u-choice--whitespace-normal {
|
|
152
158
|
white-space: normal;
|
|
153
159
|
}
|
|
154
|
-
.gridui-u-text-foreground {
|
|
160
|
+
.gridui-u-choice--text-foreground {
|
|
155
161
|
color: var(--gridui-foreground);
|
|
156
162
|
}
|
|
157
|
-
.gridui-u-aria-invalid\:border-danger-foreground[aria-invalid="true"] {
|
|
163
|
+
.gridui-u-choice--aria-invalid\:border-danger-foreground[aria-invalid="true"] {
|
|
158
164
|
border-color: var(--gridui-danger-foreground);
|
|
159
165
|
}
|
|
160
|
-
.gridui-u-data-disabled\:cursor-not-allowed[data-disabled] {
|
|
166
|
+
.gridui-u-choice--data-disabled\:cursor-not-allowed[data-disabled] {
|
|
161
167
|
cursor: not-allowed;
|
|
162
168
|
}
|
|
163
|
-
.gridui-u-data-disabled\:opacity-50[data-disabled] {
|
|
169
|
+
.gridui-u-choice--data-disabled\:opacity-50[data-disabled] {
|
|
164
170
|
opacity: 50%;
|
|
165
171
|
}
|
|
166
|
-
.gridui-u-data-readonly\:cursor-default[data-readonly] {
|
|
172
|
+
.gridui-u-choice--data-readonly\:cursor-default[data-readonly] {
|
|
167
173
|
cursor: default;
|
|
168
174
|
}
|
|
169
|
-
.gridui-u-data-\[orientation\=horizontal\]\:border-b-2[data-orientation="horizontal"] {
|
|
175
|
+
.gridui-u-choice--data-\[orientation\=horizontal\]\:border-b-2[data-orientation="horizontal"] {
|
|
170
176
|
border-bottom-style: var(--tw-border-style);
|
|
171
177
|
border-bottom-width: 2px;
|
|
172
178
|
}
|
|
173
|
-
.gridui-u-data-\[orientation\=vertical\]\:grid-flow-row[data-orientation="vertical"] {
|
|
179
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:grid-flow-row[data-orientation="vertical"] {
|
|
174
180
|
grid-auto-flow: row;
|
|
175
181
|
}
|
|
176
|
-
.gridui-u-data-\[orientation\=vertical\]\:auto-rows-fr[data-orientation="vertical"] {
|
|
182
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:auto-rows-fr[data-orientation="vertical"] {
|
|
177
183
|
grid-auto-rows: minmax(0, 1fr);
|
|
178
184
|
}
|
|
179
|
-
.gridui-u-data-\[orientation\=vertical\]\:grid-cols-1[data-orientation="vertical"] {
|
|
185
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:grid-cols-1[data-orientation="vertical"] {
|
|
180
186
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
181
187
|
}
|
|
182
|
-
.gridui-u-data-\[orientation\=vertical\]\:flex-col[data-orientation="vertical"] {
|
|
188
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:flex-col[data-orientation="vertical"] {
|
|
183
189
|
flex-direction: column;
|
|
184
190
|
}
|
|
185
|
-
.gridui-u-data-\[orientation\=vertical\]\:border-r-2[data-orientation="vertical"] {
|
|
191
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:border-r-2[data-orientation="vertical"] {
|
|
186
192
|
border-right-style: var(--tw-border-style);
|
|
187
193
|
border-right-width: 2px;
|
|
188
194
|
}
|
|
189
|
-
.gridui-u-data-\[orientation\=vertical\]\:border-b-0[data-orientation="vertical"] {
|
|
195
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:border-b-0[data-orientation="vertical"] {
|
|
190
196
|
border-bottom-style: var(--tw-border-style);
|
|
191
197
|
border-bottom-width: 0px;
|
|
192
198
|
}
|
|
193
|
-
.gridui-u-data-\[state\=checked\]\:bg-accent-background[data-state="checked"] {
|
|
199
|
+
.gridui-u-choice--data-\[state\=checked\]\:bg-accent-background[data-state="checked"] {
|
|
194
200
|
background-color: var(--gridui-accent-background);
|
|
195
201
|
}
|
|
196
|
-
.gridui-u-data-\[state\=checked\]\:text-accent-foreground[data-state="checked"] {
|
|
202
|
+
.gridui-u-choice--data-\[state\=checked\]\:text-accent-foreground[data-state="checked"] {
|
|
197
203
|
color: var(--gridui-accent-foreground);
|
|
198
204
|
}
|
|
199
|
-
.gridui-u-data-\[state\=indeterminate\]\:bg-accent-background[data-state="indeterminate"] {
|
|
205
|
+
.gridui-u-choice--data-\[state\=indeterminate\]\:bg-accent-background[data-state="indeterminate"] {
|
|
200
206
|
background-color: var(--gridui-accent-background);
|
|
201
207
|
}
|
|
202
|
-
.gridui-u-data-\[state\=indeterminate\]\:text-accent-foreground[data-state="indeterminate"] {
|
|
208
|
+
.gridui-u-choice--data-\[state\=indeterminate\]\:text-accent-foreground[data-state="indeterminate"] {
|
|
203
209
|
color: var(--gridui-accent-foreground);
|
|
204
210
|
}
|
|
205
|
-
.gridui-u-data-\[state\=on\]\:bg-brand-tint[data-state="on"] {
|
|
211
|
+
.gridui-u-choice--data-\[state\=on\]\:bg-brand-tint[data-state="on"] {
|
|
206
212
|
background-color: var(--gridui-brand-tint);
|
|
207
213
|
}
|
|
208
|
-
.gridui-u-data-\[state\=on\]\:font-medium[data-state="on"] {
|
|
214
|
+
.gridui-u-choice--data-\[state\=on\]\:font-medium[data-state="on"] {
|
|
209
215
|
--tw-font-weight: var(--font-weight-medium);
|
|
210
216
|
font-weight: var(--font-weight-medium);
|
|
211
217
|
}
|
|
212
|
-
.gridui-u-data-\[state\=on\]\:text-foreground[data-state="on"] {
|
|
218
|
+
.gridui-u-choice--data-\[state\=on\]\:text-foreground[data-state="on"] {
|
|
213
219
|
color: var(--gridui-foreground);
|
|
214
220
|
}
|
|
215
|
-
.gridui-u-rtl\:data-\[orientation\=vertical\]\:border-r-0:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
|
|
221
|
+
.gridui-u-choice--rtl\:data-\[orientation\=vertical\]\:border-r-0:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
|
|
216
222
|
border-right-style: var(--tw-border-style);
|
|
217
223
|
border-right-width: 0px;
|
|
218
224
|
}
|
|
219
|
-
.gridui-u-rtl\:data-\[orientation\=vertical\]\:border-l-2:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
|
|
225
|
+
.gridui-u-choice--rtl\:data-\[orientation\=vertical\]\:border-l-2:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
|
|
220
226
|
border-left-style: var(--tw-border-style);
|
|
221
227
|
border-left-width: 2px;
|
|
222
228
|
}
|
|
229
|
+
@media (forced-colors: active) {
|
|
230
|
+
.gridui-u-choice--forced-colors\:outline-\[CanvasText\] {
|
|
231
|
+
outline-color: CanvasText;
|
|
232
|
+
}
|
|
233
|
+
.gridui-u-choice--forced-colors\:data-\[state\=on\]\:bg-\[Highlight\][data-state="on"] {
|
|
234
|
+
background-color: Highlight;
|
|
235
|
+
}
|
|
236
|
+
.gridui-u-choice--forced-colors\:data-\[state\=on\]\:text-\[HighlightText\][data-state="on"] {
|
|
237
|
+
color: HighlightText;
|
|
238
|
+
}
|
|
239
|
+
.gridui-u-choice--forced-colors\:data-\[state\=on\]\:forced-color-adjust-none[data-state="on"] {
|
|
240
|
+
forced-color-adjust: none;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
223
243
|
}
|
|
224
244
|
@layer components {
|
|
225
245
|
.gridui-switch-control, .gridui-switch-indicator, .gridui-switch-setting-copy, .gridui-switch-setting-end {
|
|
@@ -232,7 +252,6 @@
|
|
|
232
252
|
}
|
|
233
253
|
.gridui-switch-control:disabled {
|
|
234
254
|
cursor: not-allowed;
|
|
235
|
-
opacity: 0.5;
|
|
236
255
|
}
|
|
237
256
|
.gridui-switch-control[data-readonly] {
|
|
238
257
|
cursor: default;
|
|
@@ -326,6 +345,15 @@
|
|
|
326
345
|
flex-shrink: 0;
|
|
327
346
|
max-width: 45%;
|
|
328
347
|
}
|
|
348
|
+
.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 {
|
|
349
|
+
opacity: 0.5;
|
|
350
|
+
}
|
|
351
|
+
@media (forced-colors: active) {
|
|
352
|
+
.gridui-switch-thumb {
|
|
353
|
+
background: CanvasText;
|
|
354
|
+
forced-color-adjust: none;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
329
357
|
@media (prefers-reduced-motion: reduce) {
|
|
330
358
|
.gridui-switch-indicator, .gridui-switch-thumb {
|
|
331
359
|
transition: none;
|
package/dist/switch/switch.d.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* @namespace Switch
|
|
5
5
|
* @description Switch
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
8
|
-
import type { ChoiceProps } from "../shared/use-choice";
|
|
7
|
+
import type { SwitchOptions } from "../shared/switch-options";
|
|
9
8
|
import type { FC } from "react";
|
|
10
|
-
export type SwitchProps =
|
|
9
|
+
export type SwitchProps = SwitchOptions;
|
|
11
10
|
export declare const Switch: FC<SwitchProps>;
|
|
@@ -4,14 +4,11 @@
|
|
|
4
4
|
* @namespace SwitchGroup
|
|
5
5
|
* @description Switch Group
|
|
6
6
|
*/
|
|
7
|
-
import type { SwitchPresentationProps } from "../shared/switch-
|
|
8
|
-
import type { SwitchProps } from "../switch/switch";
|
|
7
|
+
import type { SwitchOptions, SwitchPresentationProps, SwitchSettingCopy } from "../shared/switch-options";
|
|
9
8
|
import type { ComponentPropsWithRef, FC, ReactNode } from "react";
|
|
10
|
-
export type SwitchGroupItem =
|
|
9
|
+
export type SwitchGroupItem = SwitchOptions & SwitchSettingCopy & {
|
|
11
10
|
/** Stable item identity and native control ID. */
|
|
12
11
|
readonly id: string;
|
|
13
|
-
readonly label: ReactNode;
|
|
14
|
-
readonly description?: ReactNode;
|
|
15
12
|
};
|
|
16
13
|
export type SwitchGroupProps = Omit<ComponentPropsWithRef<"fieldset">, "children"> & SwitchPresentationProps & {
|
|
17
14
|
readonly items: readonly SwitchGroupItem[];
|
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
* @namespace SwitchPanel
|
|
5
5
|
* @description Switch Panel
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
8
|
-
import { type ComponentPropsWithRef, type FC
|
|
9
|
-
export type SwitchPanelProps = ComponentPropsWithRef<"div"> &
|
|
10
|
-
readonly label: ReactNode;
|
|
11
|
-
readonly description?: ReactNode;
|
|
12
|
-
/** State, form attributes, accessible overrides and ref for the switch button. */
|
|
13
|
-
readonly control: SwitchProps;
|
|
14
|
-
};
|
|
7
|
+
import type { SwitchSettingOptions } from "../shared/switch-options";
|
|
8
|
+
import { type ComponentPropsWithRef, type FC } from "react";
|
|
9
|
+
export type SwitchPanelProps = ComponentPropsWithRef<"div"> & SwitchSettingOptions;
|
|
15
10
|
export declare const SwitchPanel: FC<SwitchPanelProps>;
|
package/docs/catalog.json
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/choice",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.5",
|
|
5
5
|
"category": "core",
|
|
6
6
|
"description": "GridUI React choice",
|
|
7
7
|
"usage": "Core 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
|
+
"docs/reference/README.md",
|
|
11
|
+
"docs/reference/checkbox.md",
|
|
12
|
+
"docs/reference/switch-group.md",
|
|
13
|
+
"docs/reference/switch-panel.md",
|
|
14
|
+
"docs/reference/switch.md",
|
|
15
|
+
"docs/reference/toggle-group-item.md",
|
|
16
|
+
"docs/reference/toggle-group.md",
|
|
10
17
|
"docs/switches.md",
|
|
11
18
|
"docs/tabs-and-choices.md"
|
|
12
19
|
],
|
|
@@ -93,7 +100,11 @@
|
|
|
93
100
|
"@gridui/choice/styles.css"
|
|
94
101
|
],
|
|
95
102
|
"examples": [
|
|
103
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/checkbox.stories.tsx",
|
|
96
104
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/choices.stories.tsx",
|
|
105
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-control.stories.tsx",
|
|
106
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-group.stories.tsx",
|
|
107
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-panel.stories.tsx",
|
|
97
108
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch.stories.tsx",
|
|
98
109
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/toggle-group.stories.tsx"
|
|
99
110
|
]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<!-- Generated by pnpm docs:storybook. -->
|
|
2
|
+
# Component reference
|
|
3
|
+
|
|
4
|
+
- [Checkbox](checkbox.md)
|
|
5
|
+
- [Switch](switch.md)
|
|
6
|
+
- [SwitchGroup](switch-group.md)
|
|
7
|
+
- [SwitchPanel](switch-panel.md)
|
|
8
|
+
- [ToggleGroup](toggle-group.md)
|
|
9
|
+
- [ToggleGroupItem](toggle-group-item.md)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# Checkbox
|
|
3
|
+
|
|
4
|
+
Toggles an independent option or represents a mixed selection. Use a radio group when exactly one option must be selected.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/choice`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Checkbox } from "@gridui/choice";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/choice/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/checkbox.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### onFocus
|
|
23
|
+
|
|
24
|
+
``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
25
|
+
|
|
26
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
27
|
+
|
|
28
|
+
### onBlur
|
|
29
|
+
|
|
30
|
+
``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
31
|
+
|
|
32
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
33
|
+
|
|
34
|
+
### onSubmit
|
|
35
|
+
|
|
36
|
+
``(event: SubmitEvent<HTMLButtonElement>): void`` · Optional
|
|
37
|
+
|
|
38
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
39
|
+
|
|
40
|
+
### onClick
|
|
41
|
+
|
|
42
|
+
``(event: MouseEvent<HTMLButtonElement, MouseEvent>): void`` · Optional
|
|
43
|
+
|
|
44
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
45
|
+
|
|
46
|
+
### value
|
|
47
|
+
|
|
48
|
+
``string | number | readonly string[] | undefined`` · Optional
|
|
49
|
+
|
|
50
|
+
Default: ``"on"``
|
|
51
|
+
|
|
52
|
+
Controlled value. Pair with the corresponding change callback.
|
|
53
|
+
|
|
54
|
+
### checked
|
|
55
|
+
|
|
56
|
+
``boolean | undefined`` · Optional
|
|
57
|
+
|
|
58
|
+
Controlled checked state. Pair with onCheckedChange.
|
|
59
|
+
|
|
60
|
+
### defaultChecked
|
|
61
|
+
|
|
62
|
+
``boolean | undefined`` · Optional
|
|
63
|
+
|
|
64
|
+
Initial uncontrolled checked state. Reset the story after changing it.
|
|
65
|
+
|
|
66
|
+
### readOnly
|
|
67
|
+
|
|
68
|
+
``boolean | undefined`` · Optional
|
|
69
|
+
|
|
70
|
+
Allows reading without changing the value.
|
|
71
|
+
|
|
72
|
+
### required
|
|
73
|
+
|
|
74
|
+
``boolean | undefined`` · Optional
|
|
75
|
+
|
|
76
|
+
Participates in required form validation.
|
|
77
|
+
|
|
78
|
+
### uncheckedValue
|
|
79
|
+
|
|
80
|
+
``string | undefined`` · Optional
|
|
81
|
+
|
|
82
|
+
### inputRef
|
|
83
|
+
|
|
84
|
+
``Ref<HTMLInputElement> | undefined`` · Optional
|
|
85
|
+
|
|
86
|
+
### onCheckedChange
|
|
87
|
+
|
|
88
|
+
``(checked: boolean, details: ChangeDetails): void`` · Optional
|
|
89
|
+
|
|
90
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
91
|
+
|
|
92
|
+
### indeterminate
|
|
93
|
+
|
|
94
|
+
``boolean | undefined`` · Optional
|
|
95
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# SwitchGroup
|
|
3
|
+
|
|
4
|
+
Groups related boolean settings with labels and optional descriptions. Each setting keeps its own state and form value.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/choice`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { SwitchGroup } from "@gridui/choice";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/choice/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-group.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### onFocus
|
|
23
|
+
|
|
24
|
+
``(event: FocusEvent<HTMLFieldSetElement, Element>): void`` · Optional
|
|
25
|
+
|
|
26
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
27
|
+
|
|
28
|
+
### onBlur
|
|
29
|
+
|
|
30
|
+
``(event: FocusEvent<HTMLFieldSetElement, Element>): void`` · Optional
|
|
31
|
+
|
|
32
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
33
|
+
|
|
34
|
+
### onChange
|
|
35
|
+
|
|
36
|
+
``(event: ChangeEvent<HTMLFieldSetElement, Element>): void`` · Optional
|
|
37
|
+
|
|
38
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
39
|
+
|
|
40
|
+
### onSubmit
|
|
41
|
+
|
|
42
|
+
``(event: SubmitEvent<HTMLFieldSetElement>): void`` · Optional
|
|
43
|
+
|
|
44
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
45
|
+
|
|
46
|
+
### onClick
|
|
47
|
+
|
|
48
|
+
``(event: MouseEvent<HTMLFieldSetElement, MouseEvent>): void`` · Optional
|
|
49
|
+
|
|
50
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
51
|
+
|
|
52
|
+
### variant
|
|
53
|
+
|
|
54
|
+
``SwitchVariant | undefined`` · Optional
|
|
55
|
+
|
|
56
|
+
Visual variant.
|
|
57
|
+
|
|
58
|
+
### stateLabels
|
|
59
|
+
|
|
60
|
+
``SwitchStateLabels | undefined`` · Optional
|
|
61
|
+
|
|
62
|
+
Visible state words; the accessible name must describe the setting.
|
|
63
|
+
|
|
64
|
+
### items
|
|
65
|
+
|
|
66
|
+
``readonly SwitchGroupItem[]`` · Required
|
|
67
|
+
|
|
68
|
+
### legend
|
|
69
|
+
|
|
70
|
+
``ReactNode`` · Optional
|
|
71
|
+
|
|
72
|
+
### density
|
|
73
|
+
|
|
74
|
+
``"compact" | "comfortable" | undefined`` · Optional
|
|
75
|
+
|
|
76
|
+
Default: ``"compact"``
|
|
77
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# SwitchPanel
|
|
3
|
+
|
|
4
|
+
Pairs a labeled switch with supporting content in a bordered panel. Use it when a setting needs more context than a single row.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/choice`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { SwitchPanel } from "@gridui/choice";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/choice/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-panel.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### children
|
|
23
|
+
|
|
24
|
+
``ReactNode`` · Optional
|
|
25
|
+
|
|
26
|
+
Content rendered inside the component.
|
|
27
|
+
|
|
28
|
+
### onFocus
|
|
29
|
+
|
|
30
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
31
|
+
|
|
32
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
33
|
+
|
|
34
|
+
### onBlur
|
|
35
|
+
|
|
36
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
37
|
+
|
|
38
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
39
|
+
|
|
40
|
+
### onChange
|
|
41
|
+
|
|
42
|
+
``(event: ChangeEvent<HTMLDivElement, Element>): void`` · Optional
|
|
43
|
+
|
|
44
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
45
|
+
|
|
46
|
+
### onSubmit
|
|
47
|
+
|
|
48
|
+
``(event: SubmitEvent<HTMLDivElement>): void`` · Optional
|
|
49
|
+
|
|
50
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
51
|
+
|
|
52
|
+
### onClick
|
|
53
|
+
|
|
54
|
+
``(event: MouseEvent<HTMLDivElement, MouseEvent>): void`` · Optional
|
|
55
|
+
|
|
56
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
57
|
+
|
|
58
|
+
### label
|
|
59
|
+
|
|
60
|
+
``ReactNode`` · Required
|
|
61
|
+
|
|
62
|
+
### description
|
|
63
|
+
|
|
64
|
+
``ReactNode`` · Optional
|
|
65
|
+
|
|
66
|
+
### control
|
|
67
|
+
|
|
68
|
+
``SwitchOptions`` · Required
|
|
69
|
+
|
|
70
|
+
State, form attributes, accessible overrides and ref for the switch button.
|
|
71
|
+
|