@liberation-data/desk 0.11.0 → 0.14.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/dist/css/controls.css +37 -0
- package/dist/css/setup.css +17 -1
- package/dist/css/tokens.css +3 -0
- package/dist/desk.css +57 -1
- package/dist/react/controls.d.ts +11 -1
- package/dist/react/controls.d.ts.map +1 -1
- package/dist/react/controls.js +2 -2
- package/dist/react/controls.js.map +1 -1
- package/llms.txt +3 -2
- package/package.json +1 -1
- package/src/css/controls.css +37 -0
- package/src/css/setup.css +17 -1
- package/src/css/tokens.css +3 -0
- package/src/react/controls.tsx +12 -2
package/dist/css/controls.css
CHANGED
|
@@ -137,6 +137,22 @@
|
|
|
137
137
|
cursor: pointer;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/*
|
|
141
|
+
* Spanning the row, with every option the same width. The default sizes each option to its label,
|
|
142
|
+
* which is right in a toolbar and wrong when the control is the heading of the thing below it:
|
|
143
|
+
* equal answers should not be different sizes because one of them is a longer word.
|
|
144
|
+
*/
|
|
145
|
+
.desk-segmented[data-width="fill"] {
|
|
146
|
+
display: flex;
|
|
147
|
+
width: 100%;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.desk-segmented[data-width="fill"] .desk-segment {
|
|
151
|
+
flex: 1 1 0;
|
|
152
|
+
min-width: 0;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
}
|
|
155
|
+
|
|
140
156
|
.desk-segmented[data-size="small"] .desk-segment {
|
|
141
157
|
min-height: calc(var(--desk-control-height-small) - 4px);
|
|
142
158
|
padding: 0 var(--desk-space-2);
|
|
@@ -204,12 +220,33 @@
|
|
|
204
220
|
gap: 2px;
|
|
205
221
|
}
|
|
206
222
|
|
|
223
|
+
/*
|
|
224
|
+
* A LABEL AND ITS INPUT ARE ONE THING, and the space around them has to say so. The gap INSIDE a
|
|
225
|
+
* field is 4px; the gap BETWEEN fields has to be clearly larger, or the eye groups a label with
|
|
226
|
+
* the field above it instead of the one below — which is what a label sitting closer to its
|
|
227
|
+
* neighbour than to its own input actually does.
|
|
228
|
+
*
|
|
229
|
+
* `.desk-field` only ever set the inside gap, and said nothing about the outside. Every consumer
|
|
230
|
+
* picked its own: one app's forms came out at 14px, another's at 10px, and anything that forgot
|
|
231
|
+
* got the browser's default of none. Same components, different grouping, and no rule to point at.
|
|
232
|
+
*/
|
|
207
233
|
.desk-field {
|
|
208
234
|
display: flex;
|
|
209
235
|
flex-direction: column;
|
|
210
236
|
gap: var(--desk-space-1);
|
|
211
237
|
}
|
|
212
238
|
|
|
239
|
+
/*
|
|
240
|
+
* The container a stack of fields goes in. Four times the inside gap, which is enough that the
|
|
241
|
+
* pairing is read rather than worked out, and an app that wants tighter or looser sets the token
|
|
242
|
+
* rather than the rule.
|
|
243
|
+
*/
|
|
244
|
+
.desk-fields {
|
|
245
|
+
display: flex;
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
gap: var(--desk-field-gap, var(--desk-space-4));
|
|
248
|
+
}
|
|
249
|
+
|
|
213
250
|
.desk-label {
|
|
214
251
|
font-size: 12px;
|
|
215
252
|
font-weight: 500;
|
package/dist/css/setup.css
CHANGED
|
@@ -104,10 +104,23 @@
|
|
|
104
104
|
|
|
105
105
|
/* ── Wizard ── */
|
|
106
106
|
|
|
107
|
+
/*
|
|
108
|
+
* ONE SIZE FOR EVERY STEP, not a floor with taller steps growing past it.
|
|
109
|
+
*
|
|
110
|
+
* `min-height` meant a step with an extra field was a taller card than the step before it, so the
|
|
111
|
+
* pane changed shape as somebody moved through setup and the buttons they were reaching for moved
|
|
112
|
+
* with it. Worse within a step: a choice that swaps one field for two resized the pane under the
|
|
113
|
+
* pointer.
|
|
114
|
+
*
|
|
115
|
+
* A fixed height costs a step that genuinely needs more room, which is why the content area
|
|
116
|
+
* scrolls rather than being clipped, and why the height is a token an app can raise once for all
|
|
117
|
+
* of its steps. `max-height` keeps the whole thing on a short screen.
|
|
118
|
+
*/
|
|
107
119
|
.desk-wizard {
|
|
108
120
|
box-sizing: border-box;
|
|
109
121
|
width: min(640px, 100%);
|
|
110
|
-
|
|
122
|
+
height: var(--desk-wizard-height, 520px);
|
|
123
|
+
max-height: 100%;
|
|
111
124
|
display: flex;
|
|
112
125
|
flex-direction: column;
|
|
113
126
|
border: 1px solid var(--desk-rule);
|
|
@@ -121,6 +134,9 @@
|
|
|
121
134
|
|
|
122
135
|
.desk-wizard-content {
|
|
123
136
|
flex: 1;
|
|
137
|
+
/* The card's height is fixed, so a step that needs more room scrolls inside it. */
|
|
138
|
+
min-height: 0;
|
|
139
|
+
overflow-y: auto;
|
|
124
140
|
display: flex;
|
|
125
141
|
flex-direction: column;
|
|
126
142
|
align-items: center;
|
package/dist/css/tokens.css
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
--desk-mode: #34c47a;
|
|
17
17
|
--desk-info: #34c47a;
|
|
18
18
|
--desk-radius: 12px;
|
|
19
|
+
|
|
20
|
+
/* Between one field and the next. Larger than the 4px inside a field, or the pairing is lost. */
|
|
21
|
+
--desk-field-gap: 16px;
|
|
19
22
|
--desk-gap: 12px;
|
|
20
23
|
--desk-padding: 12px;
|
|
21
24
|
--desk-shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 12px 32px rgb(16 24 40 / 10%);
|
package/dist/desk.css
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
--desk-mode: #34c47a;
|
|
17
17
|
--desk-info: #34c47a;
|
|
18
18
|
--desk-radius: 12px;
|
|
19
|
+
|
|
20
|
+
/* Between one field and the next. Larger than the 4px inside a field, or the pairing is lost. */
|
|
21
|
+
--desk-field-gap: 16px;
|
|
19
22
|
--desk-gap: 12px;
|
|
20
23
|
--desk-padding: 12px;
|
|
21
24
|
--desk-shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 12px 32px rgb(16 24 40 / 10%);
|
|
@@ -1066,6 +1069,22 @@
|
|
|
1066
1069
|
cursor: pointer;
|
|
1067
1070
|
}
|
|
1068
1071
|
|
|
1072
|
+
/*
|
|
1073
|
+
* Spanning the row, with every option the same width. The default sizes each option to its label,
|
|
1074
|
+
* which is right in a toolbar and wrong when the control is the heading of the thing below it:
|
|
1075
|
+
* equal answers should not be different sizes because one of them is a longer word.
|
|
1076
|
+
*/
|
|
1077
|
+
.desk-segmented[data-width="fill"] {
|
|
1078
|
+
display: flex;
|
|
1079
|
+
width: 100%;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
.desk-segmented[data-width="fill"] .desk-segment {
|
|
1083
|
+
flex: 1 1 0;
|
|
1084
|
+
min-width: 0;
|
|
1085
|
+
justify-content: center;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1069
1088
|
.desk-segmented[data-size="small"] .desk-segment {
|
|
1070
1089
|
min-height: calc(var(--desk-control-height-small) - 4px);
|
|
1071
1090
|
padding: 0 var(--desk-space-2);
|
|
@@ -1133,12 +1152,33 @@
|
|
|
1133
1152
|
gap: 2px;
|
|
1134
1153
|
}
|
|
1135
1154
|
|
|
1155
|
+
/*
|
|
1156
|
+
* A LABEL AND ITS INPUT ARE ONE THING, and the space around them has to say so. The gap INSIDE a
|
|
1157
|
+
* field is 4px; the gap BETWEEN fields has to be clearly larger, or the eye groups a label with
|
|
1158
|
+
* the field above it instead of the one below — which is what a label sitting closer to its
|
|
1159
|
+
* neighbour than to its own input actually does.
|
|
1160
|
+
*
|
|
1161
|
+
* `.desk-field` only ever set the inside gap, and said nothing about the outside. Every consumer
|
|
1162
|
+
* picked its own: one app's forms came out at 14px, another's at 10px, and anything that forgot
|
|
1163
|
+
* got the browser's default of none. Same components, different grouping, and no rule to point at.
|
|
1164
|
+
*/
|
|
1136
1165
|
.desk-field {
|
|
1137
1166
|
display: flex;
|
|
1138
1167
|
flex-direction: column;
|
|
1139
1168
|
gap: var(--desk-space-1);
|
|
1140
1169
|
}
|
|
1141
1170
|
|
|
1171
|
+
/*
|
|
1172
|
+
* The container a stack of fields goes in. Four times the inside gap, which is enough that the
|
|
1173
|
+
* pairing is read rather than worked out, and an app that wants tighter or looser sets the token
|
|
1174
|
+
* rather than the rule.
|
|
1175
|
+
*/
|
|
1176
|
+
.desk-fields {
|
|
1177
|
+
display: flex;
|
|
1178
|
+
flex-direction: column;
|
|
1179
|
+
gap: var(--desk-field-gap, var(--desk-space-4));
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1142
1182
|
.desk-label {
|
|
1143
1183
|
font-size: 12px;
|
|
1144
1184
|
font-weight: 500;
|
|
@@ -2716,10 +2756,23 @@
|
|
|
2716
2756
|
|
|
2717
2757
|
/* ── Wizard ── */
|
|
2718
2758
|
|
|
2759
|
+
/*
|
|
2760
|
+
* ONE SIZE FOR EVERY STEP, not a floor with taller steps growing past it.
|
|
2761
|
+
*
|
|
2762
|
+
* `min-height` meant a step with an extra field was a taller card than the step before it, so the
|
|
2763
|
+
* pane changed shape as somebody moved through setup and the buttons they were reaching for moved
|
|
2764
|
+
* with it. Worse within a step: a choice that swaps one field for two resized the pane under the
|
|
2765
|
+
* pointer.
|
|
2766
|
+
*
|
|
2767
|
+
* A fixed height costs a step that genuinely needs more room, which is why the content area
|
|
2768
|
+
* scrolls rather than being clipped, and why the height is a token an app can raise once for all
|
|
2769
|
+
* of its steps. `max-height` keeps the whole thing on a short screen.
|
|
2770
|
+
*/
|
|
2719
2771
|
.desk-wizard {
|
|
2720
2772
|
box-sizing: border-box;
|
|
2721
2773
|
width: min(640px, 100%);
|
|
2722
|
-
|
|
2774
|
+
height: var(--desk-wizard-height, 520px);
|
|
2775
|
+
max-height: 100%;
|
|
2723
2776
|
display: flex;
|
|
2724
2777
|
flex-direction: column;
|
|
2725
2778
|
border: 1px solid var(--desk-rule);
|
|
@@ -2733,6 +2786,9 @@
|
|
|
2733
2786
|
|
|
2734
2787
|
.desk-wizard-content {
|
|
2735
2788
|
flex: 1;
|
|
2789
|
+
/* The card's height is fixed, so a step that needs more room scrolls inside it. */
|
|
2790
|
+
min-height: 0;
|
|
2791
|
+
overflow-y: auto;
|
|
2736
2792
|
display: flex;
|
|
2737
2793
|
flex-direction: column;
|
|
2738
2794
|
align-items: center;
|
package/dist/react/controls.d.ts
CHANGED
|
@@ -23,8 +23,18 @@ export interface SegmentedControlProps<T extends string> {
|
|
|
23
23
|
readonly label: string;
|
|
24
24
|
readonly size?: 'regular' | 'small';
|
|
25
25
|
readonly disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* `fit` (the default) sizes each option to its own label, which is right for a control that sits
|
|
28
|
+
* beside other things in a toolbar.
|
|
29
|
+
*
|
|
30
|
+
* `fill` spans the row and gives every option the same width. Use it when the control is the
|
|
31
|
+
* heading of what it governs rather than one item among several: "Direct" and "Via an endpoint"
|
|
32
|
+
* are the same kind of answer, and sizing them by how many letters they happen to have says the
|
|
33
|
+
* short one is the lesser choice.
|
|
34
|
+
*/
|
|
35
|
+
readonly width?: 'fit' | 'fill';
|
|
26
36
|
}
|
|
27
|
-
export declare function SegmentedControl<T extends string>({ options, value, onChange, label, size, disabled }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
37
|
+
export declare function SegmentedControl<T extends string>({ options, value, onChange, label, size, disabled, width }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
28
38
|
export interface ToggleProps {
|
|
29
39
|
readonly checked: boolean;
|
|
30
40
|
readonly onChange: (checked: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../src/react/controls.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAQhG,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAA;AAEzE,MAAM,WAAW,WAAY,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAC1E,gGAAgG;IAChG,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAA;I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SAAS,6GAyBpB,CAAA"}
|
package/dist/react/controls.js
CHANGED
|
@@ -3,7 +3,7 @@ import { forwardRef, useEffect, useId, useRef } from 'react';
|
|
|
3
3
|
export const Button = forwardRef(function Button({ intent = 'normal', size = 'regular', icon, children, type = 'button', className, ...rest }, ref) {
|
|
4
4
|
return (_jsxs("button", { ref: ref, type: type, className: ['desk-button', className].filter(Boolean).join(' '), "data-intent": intent, "data-size": size, "data-icon-only": !children || undefined, ...rest, children: [icon && _jsx("span", { className: "desk-button-icon", "aria-hidden": "true", children: icon }), children] }));
|
|
5
5
|
});
|
|
6
|
-
export function SegmentedControl({ options, value, onChange, label, size = 'regular', disabled }) {
|
|
6
|
+
export function SegmentedControl({ options, value, onChange, label, size = 'regular', disabled, width = 'fit' }) {
|
|
7
7
|
const group = useRef(null);
|
|
8
8
|
const move = (event) => {
|
|
9
9
|
const keys = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 };
|
|
@@ -20,7 +20,7 @@ export function SegmentedControl({ options, value, onChange, label, size = 'regu
|
|
|
20
20
|
// Selection follows focus here, as it does in a segmented control on any platform.
|
|
21
21
|
group.current?.querySelector(`[data-value="${CSS.escape(next.value)}"]`)?.focus();
|
|
22
22
|
};
|
|
23
|
-
return (_jsx("div", { ref: group, role: "radiogroup", "aria-label": label, className: "desk-segmented", "data-size": size, onKeyDown: move, children: options.map(option => {
|
|
23
|
+
return (_jsx("div", { ref: group, role: "radiogroup", "aria-label": label, className: "desk-segmented", "data-size": size, "data-width": width, onKeyDown: move, children: options.map(option => {
|
|
24
24
|
const selected = option.value === value;
|
|
25
25
|
return (_jsxs("button", { type: "button", role: "radio", "aria-checked": selected, "data-value": option.value, className: "desk-segment", tabIndex: selected ? 0 : -1, disabled: disabled || option.disabled, onClick: () => onChange(option.value), children: [option.icon && _jsx("span", { className: "desk-segment-icon", "aria-hidden": "true", children: option.icon }), option.label] }, option.value));
|
|
26
26
|
}) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../../src/react/controls.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAmB5D,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAiC,SAAS,MAAM,CAC9E,EAAE,MAAM,GAAG,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAC5F,GAAG;IAEH,OAAO,CACL,kBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,iBAClD,MAAM,eACR,IAAI,oBACC,CAAC,QAAQ,IAAI,SAAS,KAClC,IAAI,aAEP,IAAI,IAAI,eAAM,SAAS,EAAC,kBAAkB,iBAAa,MAAM,YAAE,IAAI,GAAQ,EAC3E,QAAQ,IACF,CACV,CAAA;AACH,CAAC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../../src/react/controls.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAmB5D,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAiC,SAAS,MAAM,CAC9E,EAAE,MAAM,GAAG,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAC5F,GAAG;IAEH,OAAO,CACL,kBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,CAAC,aAAa,EAAE,SAAS,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AAC,CAAC,SAAS,aAChE,gBAAO,OAAO,EAAE,EAAE,EAAE,SAAS,EAAC,YAAY,iBAAc,WAAW,IAAI,SAAS,YAC7E,KAAK,GACA,EACR,gBACE,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,SAAS,EAAC,YAAY,kBACR,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,sBACpB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,KACtE,IAAI,GACR,EACD,KAAK,IAAI,eAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,YAAY,YAAE,KAAK,GAAQ,EACjE,IAAI,IAAI,CAAC,KAAK,IAAI,eAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC,WAAW,YAAE,IAAI,GAAQ,IACpE,CACP,CAAA;AACH,CAAC,CAAC,CAAA"}
|
package/llms.txt
CHANGED
|
@@ -364,7 +364,7 @@ SearchCommand = 'desk.search' // a menu item can open i
|
|
|
364
364
|
|
|
365
365
|
```tsx
|
|
366
366
|
<Button intent?={'normal'|'default'|'quiet'|'destructive'} size?={'regular'|'small'} icon? … />
|
|
367
|
-
<SegmentedControl options={{value,label,icon?,disabled?}[]} value onChange label size? disabled? />
|
|
367
|
+
<SegmentedControl options={{value,label,icon?,disabled?}[]} value onChange label size? disabled? width?={fit|fill} />
|
|
368
368
|
<Toggle checked onChange label? description? disabled? aria-label? /> // applies at once
|
|
369
369
|
<Checkbox checked indeterminate? onChange label? description? disabled? /> // waits for Save
|
|
370
370
|
<Slider value onChange label min? max? step? disabled? format?={(v) => string} />
|
|
@@ -465,7 +465,8 @@ Every value reads a `--desk-*` token; redefine tokens, never override selectors.
|
|
|
465
465
|
`--desk-surface`, `--desk-titlebar`, `--desk-ink`, `--desk-muted`, `--desk-rule`, `--desk-accent`,
|
|
466
466
|
`--desk-ok|warn|bad`, `--desk-on-accent`. Spacing `--desk-space-1..7` = 4, 8, 12, 16, 24, 32, 48 px. Also
|
|
467
467
|
`--desk-radius`, `--desk-control-height`, `--desk-control-radius`, `--desk-font`, `--desk-font-mono`,
|
|
468
|
-
`--desk-ease`, `--desk-dock-size`, `--desk-dock-glass`, `--desk-inset-bottom
|
|
468
|
+
`--desk-ease`, `--desk-dock-size`, `--desk-dock-glass`, `--desk-inset-bottom`, `--desk-wizard-height`,
|
|
469
|
+
`--desk-field-gap`.
|
|
469
470
|
|
|
470
471
|
Light and dark follow `prefers-color-scheme`; `data-theme="light" | "dark"` on the root wins.
|
|
471
472
|
|
package/package.json
CHANGED
package/src/css/controls.css
CHANGED
|
@@ -136,6 +136,22 @@
|
|
|
136
136
|
cursor: pointer;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/*
|
|
140
|
+
* Spanning the row, with every option the same width. The default sizes each option to its label,
|
|
141
|
+
* which is right in a toolbar and wrong when the control is the heading of the thing below it:
|
|
142
|
+
* equal answers should not be different sizes because one of them is a longer word.
|
|
143
|
+
*/
|
|
144
|
+
.desk-segmented[data-width="fill"] {
|
|
145
|
+
display: flex;
|
|
146
|
+
width: 100%;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.desk-segmented[data-width="fill"] .desk-segment {
|
|
150
|
+
flex: 1 1 0;
|
|
151
|
+
min-width: 0;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
}
|
|
154
|
+
|
|
139
155
|
.desk-segmented[data-size="small"] .desk-segment {
|
|
140
156
|
min-height: calc(var(--desk-control-height-small) - 4px);
|
|
141
157
|
padding: 0 var(--desk-space-2);
|
|
@@ -203,12 +219,33 @@
|
|
|
203
219
|
gap: 2px;
|
|
204
220
|
}
|
|
205
221
|
|
|
222
|
+
/*
|
|
223
|
+
* A LABEL AND ITS INPUT ARE ONE THING, and the space around them has to say so. The gap INSIDE a
|
|
224
|
+
* field is 4px; the gap BETWEEN fields has to be clearly larger, or the eye groups a label with
|
|
225
|
+
* the field above it instead of the one below — which is what a label sitting closer to its
|
|
226
|
+
* neighbour than to its own input actually does.
|
|
227
|
+
*
|
|
228
|
+
* `.desk-field` only ever set the inside gap, and said nothing about the outside. Every consumer
|
|
229
|
+
* picked its own: one app's forms came out at 14px, another's at 10px, and anything that forgot
|
|
230
|
+
* got the browser's default of none. Same components, different grouping, and no rule to point at.
|
|
231
|
+
*/
|
|
206
232
|
.desk-field {
|
|
207
233
|
display: flex;
|
|
208
234
|
flex-direction: column;
|
|
209
235
|
gap: var(--desk-space-1);
|
|
210
236
|
}
|
|
211
237
|
|
|
238
|
+
/*
|
|
239
|
+
* The container a stack of fields goes in. Four times the inside gap, which is enough that the
|
|
240
|
+
* pairing is read rather than worked out, and an app that wants tighter or looser sets the token
|
|
241
|
+
* rather than the rule.
|
|
242
|
+
*/
|
|
243
|
+
.desk-fields {
|
|
244
|
+
display: flex;
|
|
245
|
+
flex-direction: column;
|
|
246
|
+
gap: var(--desk-field-gap, var(--desk-space-4));
|
|
247
|
+
}
|
|
248
|
+
|
|
212
249
|
.desk-label {
|
|
213
250
|
font-size: 12px;
|
|
214
251
|
font-weight: 500;
|
package/src/css/setup.css
CHANGED
|
@@ -103,10 +103,23 @@
|
|
|
103
103
|
|
|
104
104
|
/* ── Wizard ── */
|
|
105
105
|
|
|
106
|
+
/*
|
|
107
|
+
* ONE SIZE FOR EVERY STEP, not a floor with taller steps growing past it.
|
|
108
|
+
*
|
|
109
|
+
* `min-height` meant a step with an extra field was a taller card than the step before it, so the
|
|
110
|
+
* pane changed shape as somebody moved through setup and the buttons they were reaching for moved
|
|
111
|
+
* with it. Worse within a step: a choice that swaps one field for two resized the pane under the
|
|
112
|
+
* pointer.
|
|
113
|
+
*
|
|
114
|
+
* A fixed height costs a step that genuinely needs more room, which is why the content area
|
|
115
|
+
* scrolls rather than being clipped, and why the height is a token an app can raise once for all
|
|
116
|
+
* of its steps. `max-height` keeps the whole thing on a short screen.
|
|
117
|
+
*/
|
|
106
118
|
.desk-wizard {
|
|
107
119
|
box-sizing: border-box;
|
|
108
120
|
width: min(640px, 100%);
|
|
109
|
-
|
|
121
|
+
height: var(--desk-wizard-height, 520px);
|
|
122
|
+
max-height: 100%;
|
|
110
123
|
display: flex;
|
|
111
124
|
flex-direction: column;
|
|
112
125
|
border: 1px solid var(--desk-rule);
|
|
@@ -120,6 +133,9 @@
|
|
|
120
133
|
|
|
121
134
|
.desk-wizard-content {
|
|
122
135
|
flex: 1;
|
|
136
|
+
/* The card's height is fixed, so a step that needs more room scrolls inside it. */
|
|
137
|
+
min-height: 0;
|
|
138
|
+
overflow-y: auto;
|
|
123
139
|
display: flex;
|
|
124
140
|
flex-direction: column;
|
|
125
141
|
align-items: center;
|
package/src/css/tokens.css
CHANGED
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
--desk-mode: #34c47a;
|
|
16
16
|
--desk-info: #34c47a;
|
|
17
17
|
--desk-radius: 12px;
|
|
18
|
+
|
|
19
|
+
/* Between one field and the next. Larger than the 4px inside a field, or the pairing is lost. */
|
|
20
|
+
--desk-field-gap: 16px;
|
|
18
21
|
--desk-gap: 12px;
|
|
19
22
|
--desk-padding: 12px;
|
|
20
23
|
--desk-shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 12px 32px rgb(16 24 40 / 10%);
|
package/src/react/controls.tsx
CHANGED
|
@@ -53,9 +53,19 @@ export interface SegmentedControlProps<T extends string> {
|
|
|
53
53
|
readonly label: string
|
|
54
54
|
readonly size?: 'regular' | 'small'
|
|
55
55
|
readonly disabled?: boolean
|
|
56
|
+
/**
|
|
57
|
+
* `fit` (the default) sizes each option to its own label, which is right for a control that sits
|
|
58
|
+
* beside other things in a toolbar.
|
|
59
|
+
*
|
|
60
|
+
* `fill` spans the row and gives every option the same width. Use it when the control is the
|
|
61
|
+
* heading of what it governs rather than one item among several: "Direct" and "Via an endpoint"
|
|
62
|
+
* are the same kind of answer, and sizing them by how many letters they happen to have says the
|
|
63
|
+
* short one is the lesser choice.
|
|
64
|
+
*/
|
|
65
|
+
readonly width?: 'fit' | 'fill'
|
|
56
66
|
}
|
|
57
67
|
|
|
58
|
-
export function SegmentedControl<T extends string>({ options, value, onChange, label, size = 'regular', disabled }: SegmentedControlProps<T>) {
|
|
68
|
+
export function SegmentedControl<T extends string>({ options, value, onChange, label, size = 'regular', disabled, width = 'fit' }: SegmentedControlProps<T>) {
|
|
59
69
|
const group = useRef<HTMLDivElement>(null)
|
|
60
70
|
|
|
61
71
|
const move = (event: KeyboardEvent<HTMLDivElement>) => {
|
|
@@ -73,7 +83,7 @@ export function SegmentedControl<T extends string>({ options, value, onChange, l
|
|
|
73
83
|
}
|
|
74
84
|
|
|
75
85
|
return (
|
|
76
|
-
<div ref={group} role="radiogroup" aria-label={label} className="desk-segmented" data-size={size} onKeyDown={move}>
|
|
86
|
+
<div ref={group} role="radiogroup" aria-label={label} className="desk-segmented" data-size={size} data-width={width} onKeyDown={move}>
|
|
77
87
|
{options.map(option => {
|
|
78
88
|
const selected = option.value === value
|
|
79
89
|
return (
|