viewkitjs 0.20.0 → 0.22.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/CHANGELOG.md +39 -0
- package/MIGRATION.md +2 -1
- package/README.md +1 -1
- package/fields/dist/conventions.d.ts +15 -3
- package/fields/dist/conventions.js +25 -0
- package/fields/dist/design/category-colors.d.ts +12 -5
- package/fields/dist/design/category-colors.js +7 -7
- package/fields/dist/query/buckets.js +42 -35
- package/fields/dist/query/date.js +2 -13
- package/fields/docs/guides/conventions.md +1 -1
- package/fields/docs/guides/options.md +2 -1
- package/fields/docs/reference/design-category-colors.md +2 -2
- package/fields/docs/reference/design-status-slots.md +1 -1
- package/fields/docs/reference/fields.md +1 -1
- package/package.json +19 -1
- package/views/README.md +2 -1
- package/views/dist/atoms/StatusBadge.js +1 -1
- package/views/dist/atoms/tones.js +7 -7
- package/views/dist/atoms/types.d.ts +3 -2
- package/views/dist/contract.d.ts +295 -2
- package/views/dist/contract.js +129 -0
- package/views/dist/controls/button/button.d.ts +40 -0
- package/views/dist/controls/button/button.js +40 -0
- package/views/dist/controls/button/looks.d.ts +4 -0
- package/views/dist/controls/button/looks.js +20 -0
- package/views/dist/controls/button/map-button.d.ts +11 -0
- package/views/dist/controls/button/map-button.js +20 -0
- package/views/dist/controls/button/own-look.d.ts +59 -0
- package/views/dist/controls/button/own-look.js +33 -0
- package/views/dist/controls/button.css +530 -0
- package/views/dist/controls/controls.d.ts +5 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/index.d.ts +11 -0
- package/views/dist/controls/index.js +6 -0
- package/views/dist/controls/smooth.css +101 -0
- package/views/dist/controls/spinner/looks.d.ts +4 -0
- package/views/dist/controls/spinner/looks.js +32 -0
- package/views/dist/controls/spinner/spinner.d.ts +23 -0
- package/views/dist/controls/spinner/spinner.js +16 -0
- package/views/dist/controls/spinner.css +147 -0
- package/views/dist/display/date.js +15 -2
- package/views/dist/display/fit-values.d.ts +3 -2
- package/views/dist/display/link.d.ts +1 -1
- package/views/dist/display/location.js +2 -1
- package/views/dist/display/multi-value.js +1 -1
- package/views/dist/display/name.js +3 -1
- package/views/dist/display/select.js +1 -1
- package/views/dist/display/value-list.d.ts +1 -1
- package/views/dist/grid/chrome/GridStructure.js +2 -1
- package/views/dist/grid/looks.d.ts +45 -0
- package/views/dist/grid/looks.js +74 -0
- package/views/dist/looks/index.d.ts +9 -0
- package/views/dist/looks/index.js +5 -0
- package/views/dist/looks/looks.d.ts +47 -0
- package/views/dist/looks/looks.js +25 -0
- package/views/dist/looks/pieces.d.ts +3 -0
- package/views/dist/looks/pieces.js +4 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.js +8 -8
- package/views/dist/provider/ViewsProvider.d.ts +3 -3
- package/views/dist/provider/ViewsProvider.js +1 -1
- package/views/dist/provider/context.d.ts +1 -1
- package/views/dist/styles.css +1000 -119
- package/views/dist/styles.unlayered.css +1017 -119
- package/views/docs/contract.md +172 -7
- package/views/docs/guides/display.md +11 -7
- package/views/docs/guides/looks.md +29 -0
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/index.md +3 -0
- package/views/docs/install.md +7 -5
- package/views/docs/reference/controls.md +36 -0
- package/views/docs/reference/display.md +2 -2
- package/views/docs/reference/looks.md +41 -0
- package/views/docs/reference/react.md +2 -2
- package/views/docs/reference/views.md +5 -2
- package/views/skills/views/SKILL.md +2 -2
package/views/dist/contract.d.ts
CHANGED
|
@@ -37,8 +37,13 @@ export type VkColour = (typeof VK_COLOURS)[number];
|
|
|
37
37
|
* pointer or while editing (undeclared, `--vk-border-brand`). `--vk-selection-edge` is a picked row's lines
|
|
38
38
|
* (undeclared, `--vk-brand`). `--vk-frozen-shadow` is the colour the pinned edge's shadow fades from (undeclared,
|
|
39
39
|
* black at 15%, 60% in the dark). `--vk-editing-shadow` is the open editor's lift, a whole `box-shadow` value
|
|
40
|
-
* (undeclared, Tailwind's `shadow-lg` in black at 20%, 50% in the dark).
|
|
41
|
-
|
|
40
|
+
* (undeclared, Tailwind's `shadow-lg` in black at 20%, 50% in the dark).
|
|
41
|
+
* The status washes (`--vk-success-subtlest`, `--vk-warning-subtlest`, `--vk-info-subtlest`), the words on a
|
|
42
|
+
* filled status (`--vk-fg-inverse`, `--vk-fg-warning-inverse`) and each hue's pale ground (`--vk-label-blue-soft` and
|
|
43
|
+
* the six others) are what fields' class names draw under the stylesheet (VK-769). Each hue's `-fill`, `-edge` and `-strong` are the
|
|
44
|
+
* default Tag's pill: its fill, its edge drawn inside and its words (VK-733); undeclared, the hue 15% and 40% into
|
|
45
|
+
* `--vk-ground` and 60% into `--vk-fg`, so an app that declares only its hue keeps it. */
|
|
46
|
+
export declare const VK_OPTIONAL_COLOURS: readonly ["--vk-success", "--vk-warning", "--vk-info", "--vk-success-subtlest", "--vk-warning-subtlest", "--vk-info-subtlest", "--vk-fg-inverse", "--vk-fg-warning-inverse", "--vk-label-blue", "--vk-label-blue-soft", "--vk-label-blue-fill", "--vk-label-blue-edge", "--vk-label-blue-strong", "--vk-label-green", "--vk-label-green-soft", "--vk-label-green-fill", "--vk-label-green-edge", "--vk-label-green-strong", "--vk-label-amber", "--vk-label-amber-soft", "--vk-label-amber-fill", "--vk-label-amber-edge", "--vk-label-amber-strong", "--vk-label-red", "--vk-label-red-soft", "--vk-label-red-fill", "--vk-label-red-edge", "--vk-label-red-strong", "--vk-label-purple", "--vk-label-purple-soft", "--vk-label-purple-fill", "--vk-label-purple-edge", "--vk-label-purple-strong", "--vk-label-pink", "--vk-label-pink-soft", "--vk-label-pink-fill", "--vk-label-pink-edge", "--vk-label-pink-strong", "--vk-label-teal", "--vk-label-teal-soft", "--vk-label-teal-fill", "--vk-label-teal-edge", "--vk-label-teal-strong", "--vk-float-shadow", "--vk-focus-ring", "--vk-outline-hover-shadow", "--vk-editing-shadow", "--vk-frozen-shadow", "--vk-selected", "--vk-outline", "--vk-outline-active", "--vk-outline-hover", "--vk-selection-edge", "--vk-head-glyph-fg"];
|
|
42
47
|
export type VkOptionalColour = (typeof VK_OPTIONAL_COLOURS)[number];
|
|
43
48
|
/** Layout the APP may declare, read with a built-in fallback. `--vk-gutter` is the side padding the
|
|
44
49
|
* page gives its content: the grid's rows run edge to edge and line their content up with it.
|
|
@@ -77,6 +82,294 @@ export declare const VK_INTERNAL_FAMILIES: readonly ["--vk-col-w-"];
|
|
|
77
82
|
* marks its box `vk-fit` and each value's box `vk-fit-value`, which its measure reads. */
|
|
78
83
|
export declare const VK_INTERNAL_MARKS: readonly ["vk-fit", "vk-fit-value"];
|
|
79
84
|
export type VkInternalMark = (typeof VK_INTERNAL_MARKS)[number];
|
|
85
|
+
/** THE CONTROLS' TOKENS: every name ViewKit's default controls (`viewkitjs/views/controls`) read, each with its kind (the
|
|
86
|
+
* Outright token each stands for is docs/contract.md's table). All optional: the ready stylesheet declares each at My preset's value, and an app
|
|
87
|
+
* declares one to change it. Sixteen are the contract's colours already; the rest are the controls' own, named by the rule
|
|
88
|
+
* in docs/contract.md (Tokens, The controls' tokens). */
|
|
89
|
+
export declare const VK_CONTROL_TOKENS: readonly [{
|
|
90
|
+
readonly name: "--vk-brand";
|
|
91
|
+
readonly kind: "colour";
|
|
92
|
+
}, {
|
|
93
|
+
readonly name: "--vk-neutral";
|
|
94
|
+
readonly kind: "colour";
|
|
95
|
+
}, {
|
|
96
|
+
readonly name: "--vk-neutral-hovered";
|
|
97
|
+
readonly kind: "colour";
|
|
98
|
+
}, {
|
|
99
|
+
readonly name: "--vk-border";
|
|
100
|
+
readonly kind: "colour";
|
|
101
|
+
}, {
|
|
102
|
+
readonly name: "--vk-border-bold";
|
|
103
|
+
readonly kind: "colour";
|
|
104
|
+
}, {
|
|
105
|
+
readonly name: "--vk-border-brand";
|
|
106
|
+
readonly kind: "colour";
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "--vk-border-subtle";
|
|
109
|
+
readonly kind: "colour";
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "--vk-fg-brand";
|
|
112
|
+
readonly kind: "colour";
|
|
113
|
+
}, {
|
|
114
|
+
readonly name: "--vk-ground";
|
|
115
|
+
readonly kind: "colour";
|
|
116
|
+
}, {
|
|
117
|
+
readonly name: "--vk-hovered";
|
|
118
|
+
readonly kind: "colour";
|
|
119
|
+
}, {
|
|
120
|
+
readonly name: "--vk-pressed";
|
|
121
|
+
readonly kind: "colour";
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "--vk-fg";
|
|
124
|
+
readonly kind: "colour";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "--vk-fg-on-brand";
|
|
127
|
+
readonly kind: "colour";
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "--vk-fg-inverse";
|
|
130
|
+
readonly kind: "colour";
|
|
131
|
+
}, {
|
|
132
|
+
readonly name: "--vk-fg-subtle";
|
|
133
|
+
readonly kind: "colour";
|
|
134
|
+
}, {
|
|
135
|
+
readonly name: "--vk-fg-subtlest";
|
|
136
|
+
readonly kind: "colour";
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "--vk-brand-hovered";
|
|
139
|
+
readonly kind: "colour";
|
|
140
|
+
}, {
|
|
141
|
+
readonly name: "--vk-brand-pressed";
|
|
142
|
+
readonly kind: "colour";
|
|
143
|
+
}, {
|
|
144
|
+
readonly name: "--vk-brand-subtler";
|
|
145
|
+
readonly kind: "colour";
|
|
146
|
+
}, {
|
|
147
|
+
readonly name: "--vk-brand-subtler-hovered";
|
|
148
|
+
readonly kind: "colour";
|
|
149
|
+
}, {
|
|
150
|
+
readonly name: "--vk-brand-subtler-pressed";
|
|
151
|
+
readonly kind: "colour";
|
|
152
|
+
}, {
|
|
153
|
+
readonly name: "--vk-danger-bold";
|
|
154
|
+
readonly kind: "colour";
|
|
155
|
+
}, {
|
|
156
|
+
readonly name: "--vk-danger-bold-hovered";
|
|
157
|
+
readonly kind: "colour";
|
|
158
|
+
}, {
|
|
159
|
+
readonly name: "--vk-danger-bold-pressed";
|
|
160
|
+
readonly kind: "colour";
|
|
161
|
+
}, {
|
|
162
|
+
readonly name: "--vk-info-bold";
|
|
163
|
+
readonly kind: "colour";
|
|
164
|
+
}, {
|
|
165
|
+
readonly name: "--vk-info-bold-hovered";
|
|
166
|
+
readonly kind: "colour";
|
|
167
|
+
}, {
|
|
168
|
+
readonly name: "--vk-info-bold-pressed";
|
|
169
|
+
readonly kind: "colour";
|
|
170
|
+
}, {
|
|
171
|
+
readonly name: "--vk-success-bold";
|
|
172
|
+
readonly kind: "colour";
|
|
173
|
+
}, {
|
|
174
|
+
readonly name: "--vk-success-bold-hovered";
|
|
175
|
+
readonly kind: "colour";
|
|
176
|
+
}, {
|
|
177
|
+
readonly name: "--vk-success-bold-pressed";
|
|
178
|
+
readonly kind: "colour";
|
|
179
|
+
}, {
|
|
180
|
+
readonly name: "--vk-warning-bold";
|
|
181
|
+
readonly kind: "colour";
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "--vk-warning-bold-hovered";
|
|
184
|
+
readonly kind: "colour";
|
|
185
|
+
}, {
|
|
186
|
+
readonly name: "--vk-warning-bold-pressed";
|
|
187
|
+
readonly kind: "colour";
|
|
188
|
+
}, {
|
|
189
|
+
readonly name: "--vk-brighten";
|
|
190
|
+
readonly kind: "colour";
|
|
191
|
+
}, {
|
|
192
|
+
readonly name: "--vk-darken";
|
|
193
|
+
readonly kind: "colour";
|
|
194
|
+
}, {
|
|
195
|
+
readonly name: "--vk-border-input";
|
|
196
|
+
readonly kind: "colour";
|
|
197
|
+
}, {
|
|
198
|
+
readonly name: "--vk-border-input-hovered";
|
|
199
|
+
readonly kind: "colour";
|
|
200
|
+
}, {
|
|
201
|
+
readonly name: "--vk-raised";
|
|
202
|
+
readonly kind: "colour";
|
|
203
|
+
}, {
|
|
204
|
+
readonly name: "--vk-raised-hovered";
|
|
205
|
+
readonly kind: "colour";
|
|
206
|
+
}, {
|
|
207
|
+
readonly name: "--vk-overlay-hovered";
|
|
208
|
+
readonly kind: "colour";
|
|
209
|
+
}, {
|
|
210
|
+
readonly name: "--vk-overlay-pressed";
|
|
211
|
+
readonly kind: "colour";
|
|
212
|
+
}, {
|
|
213
|
+
readonly name: "--vk-overlay-card-pressed";
|
|
214
|
+
readonly kind: "colour";
|
|
215
|
+
}, {
|
|
216
|
+
readonly name: "--vk-fg-disabled";
|
|
217
|
+
readonly kind: "colour";
|
|
218
|
+
}, {
|
|
219
|
+
readonly name: "--vk-fg-accent";
|
|
220
|
+
readonly kind: "colour";
|
|
221
|
+
}, {
|
|
222
|
+
readonly name: "--vk-border-width";
|
|
223
|
+
readonly kind: "size";
|
|
224
|
+
}, {
|
|
225
|
+
readonly name: "--vk-corner-smoothing";
|
|
226
|
+
readonly kind: "size";
|
|
227
|
+
}, {
|
|
228
|
+
readonly name: "--vk-dot-size";
|
|
229
|
+
readonly kind: "size";
|
|
230
|
+
}, {
|
|
231
|
+
readonly name: "--vk-duration-instant";
|
|
232
|
+
readonly kind: "motion";
|
|
233
|
+
}, {
|
|
234
|
+
readonly name: "--vk-duration-fast";
|
|
235
|
+
readonly kind: "motion";
|
|
236
|
+
}, {
|
|
237
|
+
readonly name: "--vk-duration-base";
|
|
238
|
+
readonly kind: "motion";
|
|
239
|
+
}, {
|
|
240
|
+
readonly name: "--vk-duration-slow";
|
|
241
|
+
readonly kind: "motion";
|
|
242
|
+
}, {
|
|
243
|
+
readonly name: "--vk-ease-out";
|
|
244
|
+
readonly kind: "motion";
|
|
245
|
+
}, {
|
|
246
|
+
readonly name: "--vk-ease-in-out";
|
|
247
|
+
readonly kind: "motion";
|
|
248
|
+
}, {
|
|
249
|
+
readonly name: "--vk-ease-spring";
|
|
250
|
+
readonly kind: "motion";
|
|
251
|
+
}, {
|
|
252
|
+
readonly name: "--vk-focus-width";
|
|
253
|
+
readonly kind: "size";
|
|
254
|
+
}, {
|
|
255
|
+
readonly name: "--vk-focus-offset";
|
|
256
|
+
readonly kind: "size";
|
|
257
|
+
}, {
|
|
258
|
+
readonly name: "--vk-font-weight-medium";
|
|
259
|
+
readonly kind: "size";
|
|
260
|
+
}, {
|
|
261
|
+
readonly name: "--vk-font-weight-semibold";
|
|
262
|
+
readonly kind: "size";
|
|
263
|
+
}, {
|
|
264
|
+
readonly name: "--vk-hover-lift";
|
|
265
|
+
readonly kind: "motion";
|
|
266
|
+
}, {
|
|
267
|
+
readonly name: "--vk-loading-dim";
|
|
268
|
+
readonly kind: "motion";
|
|
269
|
+
}, {
|
|
270
|
+
readonly name: "--vk-press-scale";
|
|
271
|
+
readonly kind: "motion";
|
|
272
|
+
}, {
|
|
273
|
+
readonly name: "--vk-press-squash";
|
|
274
|
+
readonly kind: "motion";
|
|
275
|
+
}, {
|
|
276
|
+
readonly name: "--vk-press-travel";
|
|
277
|
+
readonly kind: "motion";
|
|
278
|
+
}, {
|
|
279
|
+
readonly name: "--vk-press-travel-lg";
|
|
280
|
+
readonly kind: "motion";
|
|
281
|
+
}, {
|
|
282
|
+
readonly name: "--vk-progress-slide";
|
|
283
|
+
readonly kind: "motion";
|
|
284
|
+
}, {
|
|
285
|
+
readonly name: "--vk-radius-xs";
|
|
286
|
+
readonly kind: "size";
|
|
287
|
+
}, {
|
|
288
|
+
readonly name: "--vk-radius-sm";
|
|
289
|
+
readonly kind: "size";
|
|
290
|
+
}, {
|
|
291
|
+
readonly name: "--vk-radius-md";
|
|
292
|
+
readonly kind: "size";
|
|
293
|
+
}, {
|
|
294
|
+
readonly name: "--vk-radius-lg";
|
|
295
|
+
readonly kind: "size";
|
|
296
|
+
}, {
|
|
297
|
+
readonly name: "--vk-radius-xl";
|
|
298
|
+
readonly kind: "size";
|
|
299
|
+
}, {
|
|
300
|
+
readonly name: "--vk-radius-2xl";
|
|
301
|
+
readonly kind: "size";
|
|
302
|
+
}, {
|
|
303
|
+
readonly name: "--vk-radius-full";
|
|
304
|
+
readonly kind: "size";
|
|
305
|
+
}, {
|
|
306
|
+
readonly name: "--vk-shadow-key";
|
|
307
|
+
readonly kind: "shadow";
|
|
308
|
+
}, {
|
|
309
|
+
readonly name: "--vk-shadow-key-pressed";
|
|
310
|
+
readonly kind: "shadow";
|
|
311
|
+
}, {
|
|
312
|
+
readonly name: "--vk-shadow-key-pressed-bold";
|
|
313
|
+
readonly kind: "shadow";
|
|
314
|
+
}, {
|
|
315
|
+
readonly name: "--vk-shadow-key-shallow";
|
|
316
|
+
readonly kind: "shadow";
|
|
317
|
+
}, {
|
|
318
|
+
readonly name: "--vk-shadow-key-soft";
|
|
319
|
+
readonly kind: "shadow";
|
|
320
|
+
}, {
|
|
321
|
+
readonly name: "--vk-shadow-key-subtle";
|
|
322
|
+
readonly kind: "shadow";
|
|
323
|
+
}, {
|
|
324
|
+
readonly name: "--vk-shadow-key-subtle-raised";
|
|
325
|
+
readonly kind: "shadow";
|
|
326
|
+
}, {
|
|
327
|
+
readonly name: "--vk-shadow-lift";
|
|
328
|
+
readonly kind: "shadow";
|
|
329
|
+
}, {
|
|
330
|
+
readonly name: "--vk-shadow-lift-raised";
|
|
331
|
+
readonly kind: "shadow";
|
|
332
|
+
}, {
|
|
333
|
+
readonly name: "--vk-shadow-rim";
|
|
334
|
+
readonly kind: "shadow";
|
|
335
|
+
}, {
|
|
336
|
+
readonly name: "--vk-shadow-rim-bold";
|
|
337
|
+
readonly kind: "shadow";
|
|
338
|
+
}, {
|
|
339
|
+
readonly name: "--vk-shadow-rim-bold-raised";
|
|
340
|
+
readonly kind: "shadow";
|
|
341
|
+
}, {
|
|
342
|
+
readonly name: "--vk-shadow-rim-raised";
|
|
343
|
+
readonly kind: "shadow";
|
|
344
|
+
}, {
|
|
345
|
+
readonly name: "--vk-spacing";
|
|
346
|
+
readonly kind: "size";
|
|
347
|
+
}, {
|
|
348
|
+
readonly name: "--vk-spinner-breath";
|
|
349
|
+
readonly kind: "motion";
|
|
350
|
+
}, {
|
|
351
|
+
readonly name: "--vk-spinner-turn";
|
|
352
|
+
readonly kind: "motion";
|
|
353
|
+
}, {
|
|
354
|
+
readonly name: "--vk-spinner-turn-reduced";
|
|
355
|
+
readonly kind: "motion";
|
|
356
|
+
}, {
|
|
357
|
+
readonly name: "--vk-font-size-xs";
|
|
358
|
+
readonly kind: "size";
|
|
359
|
+
}, {
|
|
360
|
+
readonly name: "--vk-font-size-sm";
|
|
361
|
+
readonly kind: "size";
|
|
362
|
+
}, {
|
|
363
|
+
readonly name: "--vk-font-size-base";
|
|
364
|
+
readonly kind: "size";
|
|
365
|
+
}, {
|
|
366
|
+
readonly name: "--vk-font-size-lg";
|
|
367
|
+
readonly kind: "size";
|
|
368
|
+
}];
|
|
369
|
+
export type VkControlToken = (typeof VK_CONTROL_TOKENS)[number]["name"];
|
|
370
|
+
/** The controls' own machinery, set and read by a control alone: not public, and not prefixed, because the names came with
|
|
371
|
+
* the controls from the Outright kit and other pieces still set them. An app neither sets nor reads them. */
|
|
372
|
+
export declare const VK_CONTROL_PRIVATE_FAMILIES: readonly ["--button-", "--smooth-", "--o-spinner-", "--o-loading-", "--pressing-room-"];
|
|
80
373
|
/** The primitives an app hands in through the provider. */
|
|
81
374
|
export declare const COMPONENT_NAMES: readonly ["Button", "Popover", "Tooltip", "Checkbox", "Menu", "Collapse", "Sheet", "AppIcon", "Markdown"];
|
|
82
375
|
export type ComponentName = (typeof COMPONENT_NAMES)[number];
|
package/views/dist/contract.js
CHANGED
|
@@ -116,13 +116,46 @@ export const VK_OPTIONAL_COLOURS = [
|
|
|
116
116
|
"--vk-success",
|
|
117
117
|
"--vk-warning",
|
|
118
118
|
"--vk-info",
|
|
119
|
+
"--vk-success-subtlest",
|
|
120
|
+
"--vk-warning-subtlest",
|
|
121
|
+
"--vk-info-subtlest",
|
|
122
|
+
"--vk-fg-inverse",
|
|
123
|
+
"--vk-fg-warning-inverse",
|
|
119
124
|
"--vk-label-blue",
|
|
125
|
+
"--vk-label-blue-soft",
|
|
126
|
+
"--vk-label-blue-fill",
|
|
127
|
+
"--vk-label-blue-edge",
|
|
128
|
+
"--vk-label-blue-strong",
|
|
120
129
|
"--vk-label-green",
|
|
130
|
+
"--vk-label-green-soft",
|
|
131
|
+
"--vk-label-green-fill",
|
|
132
|
+
"--vk-label-green-edge",
|
|
133
|
+
"--vk-label-green-strong",
|
|
121
134
|
"--vk-label-amber",
|
|
135
|
+
"--vk-label-amber-soft",
|
|
136
|
+
"--vk-label-amber-fill",
|
|
137
|
+
"--vk-label-amber-edge",
|
|
138
|
+
"--vk-label-amber-strong",
|
|
122
139
|
"--vk-label-red",
|
|
140
|
+
"--vk-label-red-soft",
|
|
141
|
+
"--vk-label-red-fill",
|
|
142
|
+
"--vk-label-red-edge",
|
|
143
|
+
"--vk-label-red-strong",
|
|
123
144
|
"--vk-label-purple",
|
|
145
|
+
"--vk-label-purple-soft",
|
|
146
|
+
"--vk-label-purple-fill",
|
|
147
|
+
"--vk-label-purple-edge",
|
|
148
|
+
"--vk-label-purple-strong",
|
|
124
149
|
"--vk-label-pink",
|
|
150
|
+
"--vk-label-pink-soft",
|
|
151
|
+
"--vk-label-pink-fill",
|
|
152
|
+
"--vk-label-pink-edge",
|
|
153
|
+
"--vk-label-pink-strong",
|
|
125
154
|
"--vk-label-teal",
|
|
155
|
+
"--vk-label-teal-soft",
|
|
156
|
+
"--vk-label-teal-fill",
|
|
157
|
+
"--vk-label-teal-edge",
|
|
158
|
+
"--vk-label-teal-strong",
|
|
126
159
|
"--vk-float-shadow",
|
|
127
160
|
"--vk-focus-ring",
|
|
128
161
|
"--vk-outline-hover-shadow",
|
|
@@ -166,6 +199,102 @@ export const VK_INTERNAL = [
|
|
|
166
199
|
];
|
|
167
200
|
export const VK_INTERNAL_FAMILIES = ["--vk-col-w-"];
|
|
168
201
|
export const VK_INTERNAL_MARKS = ["vk-fit", "vk-fit-value"];
|
|
202
|
+
export const VK_CONTROL_TOKENS = [
|
|
203
|
+
{ name: "--vk-brand", kind: "colour" },
|
|
204
|
+
{ name: "--vk-neutral", kind: "colour" },
|
|
205
|
+
{ name: "--vk-neutral-hovered", kind: "colour" },
|
|
206
|
+
{ name: "--vk-border", kind: "colour" },
|
|
207
|
+
{ name: "--vk-border-bold", kind: "colour" },
|
|
208
|
+
{ name: "--vk-border-brand", kind: "colour" },
|
|
209
|
+
{ name: "--vk-border-subtle", kind: "colour" },
|
|
210
|
+
{ name: "--vk-fg-brand", kind: "colour" },
|
|
211
|
+
{ name: "--vk-ground", kind: "colour" },
|
|
212
|
+
{ name: "--vk-hovered", kind: "colour" },
|
|
213
|
+
{ name: "--vk-pressed", kind: "colour" },
|
|
214
|
+
{ name: "--vk-fg", kind: "colour" },
|
|
215
|
+
{ name: "--vk-fg-on-brand", kind: "colour" },
|
|
216
|
+
{ name: "--vk-fg-inverse", kind: "colour" },
|
|
217
|
+
{ name: "--vk-fg-subtle", kind: "colour" },
|
|
218
|
+
{ name: "--vk-fg-subtlest", kind: "colour" },
|
|
219
|
+
{ name: "--vk-brand-hovered", kind: "colour" },
|
|
220
|
+
{ name: "--vk-brand-pressed", kind: "colour" },
|
|
221
|
+
{ name: "--vk-brand-subtler", kind: "colour" },
|
|
222
|
+
{ name: "--vk-brand-subtler-hovered", kind: "colour" },
|
|
223
|
+
{ name: "--vk-brand-subtler-pressed", kind: "colour" },
|
|
224
|
+
{ name: "--vk-danger-bold", kind: "colour" },
|
|
225
|
+
{ name: "--vk-danger-bold-hovered", kind: "colour" },
|
|
226
|
+
{ name: "--vk-danger-bold-pressed", kind: "colour" },
|
|
227
|
+
{ name: "--vk-info-bold", kind: "colour" },
|
|
228
|
+
{ name: "--vk-info-bold-hovered", kind: "colour" },
|
|
229
|
+
{ name: "--vk-info-bold-pressed", kind: "colour" },
|
|
230
|
+
{ name: "--vk-success-bold", kind: "colour" },
|
|
231
|
+
{ name: "--vk-success-bold-hovered", kind: "colour" },
|
|
232
|
+
{ name: "--vk-success-bold-pressed", kind: "colour" },
|
|
233
|
+
{ name: "--vk-warning-bold", kind: "colour" },
|
|
234
|
+
{ name: "--vk-warning-bold-hovered", kind: "colour" },
|
|
235
|
+
{ name: "--vk-warning-bold-pressed", kind: "colour" },
|
|
236
|
+
{ name: "--vk-brighten", kind: "colour" },
|
|
237
|
+
{ name: "--vk-darken", kind: "colour" },
|
|
238
|
+
{ name: "--vk-border-input", kind: "colour" },
|
|
239
|
+
{ name: "--vk-border-input-hovered", kind: "colour" },
|
|
240
|
+
{ name: "--vk-raised", kind: "colour" },
|
|
241
|
+
{ name: "--vk-raised-hovered", kind: "colour" },
|
|
242
|
+
{ name: "--vk-overlay-hovered", kind: "colour" },
|
|
243
|
+
{ name: "--vk-overlay-pressed", kind: "colour" },
|
|
244
|
+
{ name: "--vk-overlay-card-pressed", kind: "colour" },
|
|
245
|
+
{ name: "--vk-fg-disabled", kind: "colour" },
|
|
246
|
+
{ name: "--vk-fg-accent", kind: "colour" },
|
|
247
|
+
{ name: "--vk-border-width", kind: "size" },
|
|
248
|
+
{ name: "--vk-corner-smoothing", kind: "size" },
|
|
249
|
+
{ name: "--vk-dot-size", kind: "size" },
|
|
250
|
+
{ name: "--vk-duration-instant", kind: "motion" },
|
|
251
|
+
{ name: "--vk-duration-fast", kind: "motion" },
|
|
252
|
+
{ name: "--vk-duration-base", kind: "motion" },
|
|
253
|
+
{ name: "--vk-duration-slow", kind: "motion" },
|
|
254
|
+
{ name: "--vk-ease-out", kind: "motion" },
|
|
255
|
+
{ name: "--vk-ease-in-out", kind: "motion" },
|
|
256
|
+
{ name: "--vk-ease-spring", kind: "motion" },
|
|
257
|
+
{ name: "--vk-focus-width", kind: "size" },
|
|
258
|
+
{ name: "--vk-focus-offset", kind: "size" },
|
|
259
|
+
{ name: "--vk-font-weight-medium", kind: "size" },
|
|
260
|
+
{ name: "--vk-font-weight-semibold", kind: "size" },
|
|
261
|
+
{ name: "--vk-hover-lift", kind: "motion" },
|
|
262
|
+
{ name: "--vk-loading-dim", kind: "motion" },
|
|
263
|
+
{ name: "--vk-press-scale", kind: "motion" },
|
|
264
|
+
{ name: "--vk-press-squash", kind: "motion" },
|
|
265
|
+
{ name: "--vk-press-travel", kind: "motion" },
|
|
266
|
+
{ name: "--vk-press-travel-lg", kind: "motion" },
|
|
267
|
+
{ name: "--vk-progress-slide", kind: "motion" },
|
|
268
|
+
{ name: "--vk-radius-xs", kind: "size" },
|
|
269
|
+
{ name: "--vk-radius-sm", kind: "size" },
|
|
270
|
+
{ name: "--vk-radius-md", kind: "size" },
|
|
271
|
+
{ name: "--vk-radius-lg", kind: "size" },
|
|
272
|
+
{ name: "--vk-radius-xl", kind: "size" },
|
|
273
|
+
{ name: "--vk-radius-2xl", kind: "size" },
|
|
274
|
+
{ name: "--vk-radius-full", kind: "size" },
|
|
275
|
+
{ name: "--vk-shadow-key", kind: "shadow" },
|
|
276
|
+
{ name: "--vk-shadow-key-pressed", kind: "shadow" },
|
|
277
|
+
{ name: "--vk-shadow-key-pressed-bold", kind: "shadow" },
|
|
278
|
+
{ name: "--vk-shadow-key-shallow", kind: "shadow" },
|
|
279
|
+
{ name: "--vk-shadow-key-soft", kind: "shadow" },
|
|
280
|
+
{ name: "--vk-shadow-key-subtle", kind: "shadow" },
|
|
281
|
+
{ name: "--vk-shadow-key-subtle-raised", kind: "shadow" },
|
|
282
|
+
{ name: "--vk-shadow-lift", kind: "shadow" },
|
|
283
|
+
{ name: "--vk-shadow-lift-raised", kind: "shadow" },
|
|
284
|
+
{ name: "--vk-shadow-rim", kind: "shadow" },
|
|
285
|
+
{ name: "--vk-shadow-rim-bold", kind: "shadow" },
|
|
286
|
+
{ name: "--vk-shadow-rim-bold-raised", kind: "shadow" },
|
|
287
|
+
{ name: "--vk-shadow-rim-raised", kind: "shadow" },
|
|
288
|
+
{ name: "--vk-spacing", kind: "size" },
|
|
289
|
+
{ name: "--vk-spinner-breath", kind: "motion" },
|
|
290
|
+
{ name: "--vk-spinner-turn", kind: "motion" },
|
|
291
|
+
{ name: "--vk-spinner-turn-reduced", kind: "motion" },
|
|
292
|
+
{ name: "--vk-font-size-xs", kind: "size" },
|
|
293
|
+
{ name: "--vk-font-size-sm", kind: "size" },
|
|
294
|
+
{ name: "--vk-font-size-base", kind: "size" },
|
|
295
|
+
{ name: "--vk-font-size-lg", kind: "size" },
|
|
296
|
+
];
|
|
297
|
+
export const VK_CONTROL_PRIVATE_FAMILIES = ["--button-", "--smooth-", "--o-spinner-", "--o-loading-", "--pressing-room-"];
|
|
169
298
|
export const COMPONENT_NAMES = [
|
|
170
299
|
"Button",
|
|
171
300
|
"Popover",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Button as BaseButton } from "@base-ui/react/button";
|
|
3
|
+
import { type ButtonOwnLook } from "./own-look.js";
|
|
4
|
+
export type ButtonKind = "primary" | "outline" | "soft" | "quiet" | "danger" | "information" | "success" | "warning" | "link" | "text";
|
|
5
|
+
export type ButtonSize = "2xs" | "xs" | "sm" | "md" | "lg" | "44" | "20" | "22" | "26" | "20x24" | "32x44" | "40x44" | "line";
|
|
6
|
+
export type ButtonShape = "default" | "icon" | "round";
|
|
7
|
+
/** The Button's classes for a kind, a size and a form; left out, outline, md and default. */
|
|
8
|
+
export declare function buttonClass(kind?: ButtonKind | null, size?: ButtonSize | null, shape?: ButtonShape | null): string;
|
|
9
|
+
export interface ButtonProps extends Omit<BaseButton.Props, "className"> {
|
|
10
|
+
kind?: ButtonKind | null;
|
|
11
|
+
size?: ButtonSize | null;
|
|
12
|
+
shape?: ButtonShape | null;
|
|
13
|
+
/** Working: the label keeps the button's width under a spinner, and a press does nothing. */
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
/** An icon before the label (15px); an icon-only button's one icon. */
|
|
16
|
+
icon?: React.ReactNode;
|
|
17
|
+
/** An icon after the label: a menu's chevron. */
|
|
18
|
+
iconEnd?: React.ReactNode;
|
|
19
|
+
/** A Button's own look: the options it names, set on it. */
|
|
20
|
+
look?: ButtonOwnLook;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/** What a person presses to make something happen. */
|
|
24
|
+
export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
25
|
+
/** Buttons joined in one row (or a column): the corners between them square, the edges shared, as one control. It holds
|
|
26
|
+
* Buttons, a ButtonGroupText, a ButtonGroupSeparator, or groups of its own, set apart. */
|
|
27
|
+
export declare function ButtonGroup({ orientation, className, children, ...props }: {
|
|
28
|
+
orientation?: "horizontal" | "vertical";
|
|
29
|
+
className?: string;
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
} & React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
/** Words inside a group, on the neutral ground with the group's edge: a unit, a count, what the buttons act on. */
|
|
33
|
+
export declare function ButtonGroupText({ className, children, ...props }: {
|
|
34
|
+
className?: string;
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
} & React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
/** A line between two buttons of a group that have no edge of their own (the soft kind, the primary). */
|
|
38
|
+
export declare function ButtonGroupSeparator({ className }: {
|
|
39
|
+
className?: string;
|
|
40
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Button as BaseButton } from "@base-ui/react/button";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
6
|
+
import { buttonOwnAttrs } from "./own-look.js";
|
|
7
|
+
const KIND = {
|
|
8
|
+
primary: "o-button-primary", outline: "o-button-outline", soft: "o-button-soft", quiet: "o-button-quiet", danger: "o-button-danger",
|
|
9
|
+
information: "o-button-information", success: "o-button-success", warning: "o-button-warning", link: "o-button-link", text: "o-button-text",
|
|
10
|
+
};
|
|
11
|
+
const SIZE = {
|
|
12
|
+
"2xs": "o-button-2xs", xs: "o-button-xs", sm: "o-button-sm", md: "", lg: "o-button-lg", "44": "o-button-44",
|
|
13
|
+
"20": "o-button-20", "22": "o-button-22", "26": "o-button-26", "20x24": "o-button-20x24", "32x44": "o-button-32x44", "40x44": "o-button-40x44", line: "o-button-line",
|
|
14
|
+
};
|
|
15
|
+
const SHAPE = { default: "", icon: "o-button-icon", round: "o-button-round" };
|
|
16
|
+
export function buttonClass(kind, size, shape) {
|
|
17
|
+
return cx("o-button", KIND[kind ?? "outline"], SIZE[size ?? "md"], SHAPE[shape ?? "default"]);
|
|
18
|
+
}
|
|
19
|
+
export const Button = React.forwardRef(function Button({ kind, size, shape, loading = false, icon, iconEnd, look, className, children, onClick, ...props }, ref) {
|
|
20
|
+
if (process.env.NODE_ENV !== "production" && (shape === "icon" || shape === "round") && !props["aria-label"] && !props["aria-labelledby"])
|
|
21
|
+
console.warn("ViewKit Button: an icon-only button needs an aria-label, the name its tooltip shows too.");
|
|
22
|
+
const link = React.isValidElement(props.render) && props.render.props.href != null;
|
|
23
|
+
const linkKeys = link ? {
|
|
24
|
+
role: props.role,
|
|
25
|
+
onKeyDown: (e) => { if (e.key === " ")
|
|
26
|
+
e.preventBaseUIHandler?.(); props.onKeyDown?.(e); },
|
|
27
|
+
onKeyUp: (e) => { if (e.key === " ")
|
|
28
|
+
e.preventBaseUIHandler?.(); props.onKeyUp?.(e); },
|
|
29
|
+
} : {};
|
|
30
|
+
return (_jsxs(BaseButton, { ref: ref, className: cx(buttonClass(kind, size, shape), className), "aria-busy": loading || undefined, onClick: loading ? (e) => e.preventDefault() : onClick, "data-kit": "button", ...(look ? buttonOwnAttrs(look) : {}), ...props, ...linkKeys, children: [icon != null && _jsx("span", { "data-slot": "vk-button-icon", children: icon }), children != null && _jsx("span", { "data-slot": "vk-button-label", children: children }), iconEnd != null && _jsx("span", { "data-slot": "vk-button-icon", children: iconEnd }), loading && _jsx("span", { "data-slot": "vk-button-spinner", children: _jsx(Spinner, { size: size === "sm" ? 14 : size == null || size === "md" || size === "lg" || size === "44" || size === "32x44" || size === "40x44" ? 16 : 12, label: "" }) }), _jsx("span", { className: "o-button-cut", "aria-hidden": "true", children: _jsx("span", { className: "o-smooth o-smooth-ease" }) })] }));
|
|
31
|
+
});
|
|
32
|
+
export function ButtonGroup({ orientation = "horizontal", className, children, ...props }) {
|
|
33
|
+
return _jsx("div", { role: "group", "data-orientation": orientation, className: cx("o-button-group", className), ...props, children: children });
|
|
34
|
+
}
|
|
35
|
+
export function ButtonGroupText({ className, children, ...props }) {
|
|
36
|
+
return _jsx("div", { className: cx("o-button-group-text", className), ...props, children: children });
|
|
37
|
+
}
|
|
38
|
+
export function ButtonGroupSeparator({ className }) {
|
|
39
|
+
return _jsx("span", { role: "separator", className: cx("o-button-group-sep", className) });
|
|
40
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PieceLooks } from "../../looks/looks.js";
|
|
2
|
+
export type ButtonLookOptionId = "radius" | "smoothing" | "depth" | "hover" | "press" | "soft" | "weight";
|
|
3
|
+
/** The Button's options and looks. */
|
|
4
|
+
export declare const BUTTON_LOOKS: PieceLooks<ButtonLookOptionId>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const options = [
|
|
2
|
+
{ id: "radius", name: "Corners", def: "lg", kind: "steps", values: ["xs", "sm", "md", "lg", "xl", "2xl", "full"].map((id) => ({ id, name: id === "full" ? "Full" : id })) },
|
|
3
|
+
{ id: "smoothing", name: "Corner smoothing", def: "app", values: [{ id: "app", name: "The app's" }, { id: "smooth", name: "Smooth" }, { id: "round", name: "Round" }] },
|
|
4
|
+
{ id: "depth", name: "Depth", def: "flat", values: [{ id: "flat", name: "Flat" }, { id: "edged", name: "Edged" }, { id: "lifted", name: "Lifted" }] },
|
|
5
|
+
{ id: "hover", name: "Under the pointer", def: "tone", values: [{ id: "tone", name: "A tone" }, { id: "brighter", name: "Brighter" }, { id: "rises", name: "Rises" }] },
|
|
6
|
+
{ id: "press", name: "Press", def: "settles", values: [{ id: "settles", name: "Settles" }, { id: "sinks", name: "Sinks" }, { id: "springs", name: "Springs" }, { id: "lands", name: "Lands" }] },
|
|
7
|
+
{ id: "soft", name: "The soft kind", def: "grey", values: [{ id: "grey", name: "Grey" }, { id: "tint", name: "Brand tint" }] },
|
|
8
|
+
{ id: "weight", name: "Label weight", def: "medium", values: [{ id: "medium", name: "Medium" }, { id: "semibold", name: "Semibold" }] },
|
|
9
|
+
];
|
|
10
|
+
export const BUTTON_LOOKS = {
|
|
11
|
+
id: "button",
|
|
12
|
+
name: "Button",
|
|
13
|
+
options,
|
|
14
|
+
looks: [
|
|
15
|
+
{ id: "classic", name: "Classic", picks: { radius: "lg", smoothing: "app", depth: "flat", hover: "tone", press: "settles", soft: "grey", weight: "medium" } },
|
|
16
|
+
{ id: "keycap", name: "Keycap", picks: { radius: "lg", smoothing: "app", depth: "edged", hover: "brighter", press: "sinks", soft: "grey", weight: "medium" } },
|
|
17
|
+
{ id: "pill", name: "Pill", picks: { radius: "full", smoothing: "app", depth: "flat", hover: "tone", press: "springs", soft: "tint", weight: "medium" } },
|
|
18
|
+
{ id: "soft-lift", name: "Soft lift", picks: { radius: "lg", smoothing: "app", depth: "lifted", hover: "rises", press: "lands", soft: "grey", weight: "medium" } },
|
|
19
|
+
],
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ViewsButtonProps } from "../../provider/components.js";
|
|
3
|
+
/** A glyph ViewKit hands before a button's words (+ Add column's "+", its icon in a fragment with the words) is the Button's
|
|
4
|
+
* icon, so it stands before the words on one line, never stacked over them in the label. The glyph is an svg or one of the
|
|
5
|
+
* app's icons (`glyphs`), never another component; a glyph alone stays the children. */
|
|
6
|
+
export declare function leadingGlyph(children: React.ReactNode, glyphs: ReadonlySet<unknown>): {
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/** ViewKit's button, drawn as the kit's Button. Outside a provider (an app drawing it on its own) only an svg is a glyph. */
|
|
11
|
+
export declare function MapButton({ variant, size, type, children, ...rest }: ViewsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ViewsContext } from "../../provider/context.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
const KIND = {
|
|
6
|
+
default: "primary", ghost: "quiet", outline: "outline", destructive: "danger", secondary: "soft",
|
|
7
|
+
};
|
|
8
|
+
export function leadingGlyph(children, glyphs) {
|
|
9
|
+
const inner = React.isValidElement(children) && children.type === React.Fragment ? children.props.children : children;
|
|
10
|
+
const parts = React.Children.toArray(inner);
|
|
11
|
+
const first = parts[0];
|
|
12
|
+
const glyph = React.isValidElement(first) && (first.type === "svg" || glyphs.has(first.type));
|
|
13
|
+
return parts.length > 1 && glyph ? { icon: first, label: parts.slice(1) } : { label: children };
|
|
14
|
+
}
|
|
15
|
+
export function MapButton({ variant = "default", size = "default", type = "button", children, ...rest }) {
|
|
16
|
+
const icons = React.useContext(ViewsContext)?.icons;
|
|
17
|
+
const glyphs = React.useMemo(() => new Set(icons ? Object.values(icons) : []), [icons]);
|
|
18
|
+
const { icon, label } = size === "icon" ? { icon: undefined, label: children } : leadingGlyph(children, glyphs);
|
|
19
|
+
return _jsx(Button, { kind: KIND[variant], size: size === "default" ? "md" : "sm", shape: size === "icon" ? "icon" : "default", type: type, icon: icon, ...rest, children: label });
|
|
20
|
+
}
|