viewkitjs 0.21.0 → 0.23.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 +49 -0
- package/MIGRATION.md +1 -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/fields.md +1 -1
- package/package.json +13 -1
- package/views/dist/atoms/tones.js +7 -7
- package/views/dist/contract.d.ts +6 -1
- package/views/dist/contract.js +1 -0
- package/views/dist/controls/atoms.d.ts +8 -0
- package/views/dist/controls/atoms.js +8 -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/tokens.d.ts +351 -0
- package/views/dist/controls/button/tokens.js +90 -0
- package/views/dist/controls/button.css +530 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +28 -0
- package/views/dist/controls/checkbox/checkbox.js +15 -0
- package/views/dist/controls/checkbox/looks.d.ts +3 -0
- package/views/dist/controls/checkbox/looks.js +8 -0
- package/views/dist/controls/checkbox/map-checkbox.d.ts +2 -0
- package/views/dist/controls/checkbox/map-checkbox.js +5 -0
- package/views/dist/controls/checkbox/tokens.d.ts +131 -0
- package/views/dist/controls/checkbox/tokens.js +35 -0
- package/views/dist/controls/checkbox.css +133 -0
- package/views/dist/controls/controls.d.ts +14 -0
- package/views/dist/controls/controls.js +14 -0
- package/views/dist/controls/field/field.d.ts +94 -0
- package/views/dist/controls/field/field.js +46 -0
- package/views/dist/controls/field/looks.d.ts +13 -0
- package/views/dist/controls/field/looks.js +22 -0
- package/views/dist/controls/field/tokens.d.ts +75 -0
- package/views/dist/controls/field/tokens.js +21 -0
- package/views/dist/controls/field.css +98 -0
- package/views/dist/controls/glass-button/glass-button.d.ts +40 -0
- package/views/dist/controls/glass-button/glass-button.js +16 -0
- package/views/dist/controls/glass-button/looks.d.ts +4 -0
- package/views/dist/controls/glass-button/looks.js +4 -0
- package/views/dist/controls/glass-button/tokens.d.ts +127 -0
- package/views/dist/controls/glass-button/tokens.js +34 -0
- package/views/dist/controls/glass-button.css +111 -0
- package/views/dist/controls/index.d.ts +37 -0
- package/views/dist/controls/index.js +31 -0
- package/views/dist/controls/inline-input/inline-input.d.ts +14 -0
- package/views/dist/controls/inline-input/inline-input.js +10 -0
- package/views/dist/controls/inline-input/looks.d.ts +3 -0
- package/views/dist/controls/inline-input/looks.js +16 -0
- package/views/dist/controls/inline-input/tokens.d.ts +79 -0
- package/views/dist/controls/inline-input/tokens.js +22 -0
- package/views/dist/controls/inline-input.css +78 -0
- package/views/dist/controls/input/autofill.d.ts +25 -0
- package/views/dist/controls/input/autofill.js +17 -0
- package/views/dist/controls/input/input.d.ts +119 -0
- package/views/dist/controls/input/input.js +127 -0
- package/views/dist/controls/input/looks.d.ts +41 -0
- package/views/dist/controls/input/looks.js +48 -0
- package/views/dist/controls/input/map-input.d.ts +2 -0
- package/views/dist/controls/input/map-input.js +5 -0
- package/views/dist/controls/input/tokens.d.ts +171 -0
- package/views/dist/controls/input/tokens.js +45 -0
- package/views/dist/controls/input.css +381 -0
- package/views/dist/controls/internal/anchor.d.ts +16 -0
- package/views/dist/controls/internal/anchor.js +8 -0
- package/views/dist/controls/internal/close-reason.d.ts +5 -0
- package/views/dist/controls/internal/close-reason.js +2 -0
- package/views/dist/controls/internal/popup-host.d.ts +7 -0
- package/views/dist/controls/internal/popup-host.js +10 -0
- package/views/dist/controls/internal/scroll.d.ts +11 -0
- package/views/dist/controls/internal/scroll.js +14 -0
- package/views/dist/controls/kbd/kbd.d.ts +13 -0
- package/views/dist/controls/kbd/kbd.js +10 -0
- package/views/dist/controls/kbd/looks.d.ts +4 -0
- package/views/dist/controls/kbd/looks.js +4 -0
- package/views/dist/controls/kbd/tokens.d.ts +47 -0
- package/views/dist/controls/kbd/tokens.js +14 -0
- package/views/dist/controls/kbd.css +46 -0
- package/views/dist/controls/number-field/number-field.d.ts +48 -0
- package/views/dist/controls/number-field/number-field.js +34 -0
- package/views/dist/controls/number-field/tokens.d.ts +47 -0
- package/views/dist/controls/number-field/tokens.js +14 -0
- package/views/dist/controls/number-field.css +54 -0
- package/views/dist/controls/option/atom-tag.d.ts +6 -0
- package/views/dist/controls/option/atom-tag.js +6 -0
- package/views/dist/controls/option/looks.d.ts +7 -0
- package/views/dist/controls/option/looks.js +21 -0
- package/views/dist/controls/option/option.d.ts +35 -0
- package/views/dist/controls/option/option.js +32 -0
- package/views/dist/controls/option/tokens.d.ts +223 -0
- package/views/dist/controls/option/tokens.js +58 -0
- package/views/dist/controls/option.css +92 -0
- package/views/dist/controls/phone-header/header-bar.d.ts +18 -0
- package/views/dist/controls/phone-header/header-bar.js +9 -0
- package/views/dist/controls/phone-header/looks.d.ts +4 -0
- package/views/dist/controls/phone-header/looks.js +4 -0
- package/views/dist/controls/phone-header/soft-edge.d.ts +5 -0
- package/views/dist/controls/phone-header/soft-edge.js +3 -0
- package/views/dist/controls/phone-header/tokens.d.ts +59 -0
- package/views/dist/controls/phone-header/tokens.js +17 -0
- package/views/dist/controls/phone-header.css +51 -0
- package/views/dist/controls/popover/looks.d.ts +4 -0
- package/views/dist/controls/popover/looks.js +10 -0
- package/views/dist/controls/popover/map-popover.d.ts +3 -0
- package/views/dist/controls/popover/map-popover.js +5 -0
- package/views/dist/controls/popover/popover.d.ts +74 -0
- package/views/dist/controls/popover/popover.js +106 -0
- package/views/dist/controls/popover/tokens.d.ts +83 -0
- package/views/dist/controls/popover/tokens.js +23 -0
- package/views/dist/controls/popover.css +94 -0
- package/views/dist/controls/scrollbar/scrollbar.d.ts +10 -0
- package/views/dist/controls/scrollbar/scrollbar.js +143 -0
- package/views/dist/controls/scrollbar/tokens.d.ts +43 -0
- package/views/dist/controls/scrollbar/tokens.js +13 -0
- package/views/dist/controls/scrollbar.css +47 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +98 -0
- package/views/dist/controls/sheet/bottom-sheet.js +372 -0
- package/views/dist/controls/sheet/forms.d.ts +38 -0
- package/views/dist/controls/sheet/forms.js +26 -0
- package/views/dist/controls/sheet/looks.d.ts +4 -0
- package/views/dist/controls/sheet/looks.js +10 -0
- package/views/dist/controls/sheet/map-sheet.d.ts +3 -0
- package/views/dist/controls/sheet/map-sheet.js +12 -0
- package/views/dist/controls/sheet/spring.d.ts +22 -0
- package/views/dist/controls/sheet/spring.js +48 -0
- package/views/dist/controls/sheet/tokens.d.ts +143 -0
- package/views/dist/controls/sheet/tokens.js +38 -0
- package/views/dist/controls/sheet.css +220 -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/tokens.d.ts +55 -0
- package/views/dist/controls/spinner/tokens.js +16 -0
- package/views/dist/controls/spinner.css +147 -0
- package/views/dist/controls/status/atom-status-badge.d.ts +10 -0
- package/views/dist/controls/status/atom-status-badge.js +13 -0
- package/views/dist/controls/status/looks.d.ts +4 -0
- package/views/dist/controls/status/looks.js +22 -0
- package/views/dist/controls/status/marks.d.ts +26 -0
- package/views/dist/controls/status/marks.js +73 -0
- package/views/dist/controls/status/status.d.ts +43 -0
- package/views/dist/controls/status/status.js +26 -0
- package/views/dist/controls/status/tokens.d.ts +407 -0
- package/views/dist/controls/status/tokens.js +104 -0
- package/views/dist/controls/status.css +164 -0
- package/views/dist/controls/switch/looks.d.ts +4 -0
- package/views/dist/controls/switch/looks.js +19 -0
- package/views/dist/controls/switch/switch.d.ts +15 -0
- package/views/dist/controls/switch/switch.js +11 -0
- package/views/dist/controls/switch/tokens.d.ts +139 -0
- package/views/dist/controls/switch/tokens.js +37 -0
- package/views/dist/controls/switch.css +169 -0
- package/views/dist/controls/tag/atom-cell-more.d.ts +3 -0
- package/views/dist/controls/tag/atom-cell-more.js +5 -0
- package/views/dist/controls/tag/looks.d.ts +4 -0
- package/views/dist/controls/tag/looks.js +4 -0
- package/views/dist/controls/tag/tag.d.ts +25 -0
- package/views/dist/controls/tag/tag.js +19 -0
- package/views/dist/controls/tag/tokens.d.ts +63 -0
- package/views/dist/controls/tag/tokens.js +18 -0
- package/views/dist/controls/tag.css +81 -0
- package/views/dist/controls/toggle/looks.d.ts +3 -0
- package/views/dist/controls/toggle/looks.js +12 -0
- package/views/dist/controls/toggle/toggle.d.ts +47 -0
- package/views/dist/controls/toggle/toggle.js +23 -0
- package/views/dist/controls/toggle/tokens.d.ts +55 -0
- package/views/dist/controls/toggle/tokens.js +16 -0
- package/views/dist/controls/toggle.css +67 -0
- package/views/dist/controls/tokens.d.ts +16 -0
- package/views/dist/controls/tokens.js +45 -0
- package/views/dist/controls/tooltip/looks.d.ts +4 -0
- package/views/dist/controls/tooltip/looks.js +4 -0
- package/views/dist/controls/tooltip/map-tooltip.d.ts +3 -0
- package/views/dist/controls/tooltip/map-tooltip.js +5 -0
- package/views/dist/controls/tooltip/tokens.d.ts +75 -0
- package/views/dist/controls/tooltip/tokens.js +21 -0
- package/views/dist/controls/tooltip/tooltip.d.ts +54 -0
- package/views/dist/controls/tooltip/tooltip.js +78 -0
- package/views/dist/controls/tooltip.css +94 -0
- package/views/dist/display/date.js +15 -2
- package/views/dist/grid/chrome/GridTable.js +21 -19
- package/views/dist/grid/chrome/grid-row-window.js +3 -0
- package/views/dist/grid/chrome/useGridColumnLayout.d.ts +4 -1
- package/views/dist/grid/chrome/useGridColumnLayout.js +17 -2
- package/views/dist/grid/chrome/useGridFittedWidths.d.ts +29 -0
- package/views/dist/grid/chrome/useGridFittedWidths.js +46 -0
- package/views/dist/looks/index.d.ts +17 -0
- package/views/dist/looks/index.js +17 -0
- package/views/dist/looks/looks.d.ts +2 -1
- package/views/dist/looks/pieces.js +37 -1
- package/views/dist/model/column-schema.d.ts +3 -2
- package/views/dist/model/column-state.d.ts +11 -1
- package/views/dist/model/column-state.js +8 -2
- package/views/dist/panels/react/views-row/FoldingViewRow.js +8 -8
- package/views/dist/styles.css +2748 -56
- package/views/dist/styles.unlayered.css +2765 -56
- package/views/docs/contract.md +39 -8
- package/views/docs/controls/button.md +93 -0
- package/views/docs/controls/checkbox.md +38 -0
- package/views/docs/controls/field.md +26 -0
- package/views/docs/controls/glass-button.md +37 -0
- package/views/docs/controls/inline-input.md +27 -0
- package/views/docs/controls/input.md +48 -0
- package/views/docs/controls/kbd.md +17 -0
- package/views/docs/controls/number-field.md +17 -0
- package/views/docs/controls/option.md +61 -0
- package/views/docs/controls/phone-header.md +20 -0
- package/views/docs/controls/popover.md +26 -0
- package/views/docs/controls/scrollbar.md +16 -0
- package/views/docs/controls/sheet.md +41 -0
- package/views/docs/controls/spinner.md +19 -0
- package/views/docs/controls/status.md +107 -0
- package/views/docs/controls/switch.md +40 -0
- package/views/docs/controls/tag.md +21 -0
- package/views/docs/controls/toggle.md +19 -0
- package/views/docs/controls/tooltip.md +24 -0
- package/views/docs/getting-started.md +1 -1
- package/views/docs/guides/the-provider.md +1 -1
- package/views/docs/index.md +1 -0
- package/views/docs/install.md +2 -0
- package/views/docs/reference/controls.md +207 -0
- package/views/docs/reference/looks.md +77 -2
- package/views/docs/reference/views.md +10 -2
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
/* The Input: one field for everything typed into, as its card draws it. Every value it draws with is a public name; this file only says which token each part
|
|
2
|
+
and state takes. The field's states come from the browser and Base UI's Field: :hover, :focus-visible,
|
|
3
|
+
aria-invalid and :disabled; data-force draws a state for the sheet. A group's focus is its control's, or any of its
|
|
4
|
+
segments' (InputGroupSegment, a value typed in parts: a segment has it on :focus, as an input shows it however it came). An InputGroup is the same field
|
|
5
|
+
drawn round an Input and its addons (at the end of this file). The field around it, its label, note and
|
|
6
|
+
error, is field.css.
|
|
7
|
+
|
|
8
|
+
It is the one field: the Select's field and the tag field are .o-input too, so every state and option
|
|
9
|
+
here draws them. A Select's open list (data-popup-open) is its focus, and a field's state is read from
|
|
10
|
+
its control (.o-input-control) wherever inside it sits, among a Select's chips too.
|
|
11
|
+
|
|
12
|
+
The rules sit in the components layer, so a utility class on a field still wins. */
|
|
13
|
+
@layer components {
|
|
14
|
+
|
|
15
|
+
/* ── At rest: an edge, no fill (the surface shows through), and a 1px lift that is part of the field ── */
|
|
16
|
+
.o-input {
|
|
17
|
+
--input-edge: var(--vk-border-input); --input-ground: var(--vk-input); --input-r: var(--vk-radius-lg); --input-side: calc(var(--vk-spacing) * 9);
|
|
18
|
+
--input-edge-in: var(--vk-border-width); --input-inset: none;
|
|
19
|
+
box-sizing: border-box; width: 100%; min-width: 0; height: calc(var(--vk-spacing) * 9); margin: 0;
|
|
20
|
+
--input-pad-block: 0px; --input-pad-inline: calc(var(--vk-spacing) * 3); padding: var(--input-pad-block) var(--input-pad-inline);
|
|
21
|
+
--input-box-r: var(--input-r); --input-inner: var(--input-r);
|
|
22
|
+
border: var(--vk-border-width) solid var(--input-edge); border-radius: var(--input-box-r); corner-shape: squircle;
|
|
23
|
+
background: var(--input-ground); box-shadow: var(--vk-shadow-field);
|
|
24
|
+
color: var(--vk-fg); font: inherit; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm));
|
|
25
|
+
outline: none;
|
|
26
|
+
transition: border-color var(--vk-duration-fast) var(--vk-ease-out), box-shadow var(--vk-duration-fast) var(--vk-ease-out), background-color var(--vk-duration-fast) var(--vk-ease-out);
|
|
27
|
+
}
|
|
28
|
+
.o-input::placeholder { color: var(--vk-fg-subtlest); opacity: 1; }
|
|
29
|
+
/* Numbers line up. */
|
|
30
|
+
.o-input-num { font-variant-numeric: tabular-nums; }
|
|
31
|
+
/* Long text: the same field as a textarea, at least 84px (minLines sets another start), resized only up and down. */
|
|
32
|
+
.o-input-long { --input-side: calc(2lh + var(--vk-spacing) * 4 + var(--vk-border-width) * 2); height: auto; min-height: calc(var(--vk-spacing) * 21); --input-pad-block: calc(var(--vk-spacing) * 2); --input-pad-inline: calc(var(--vk-spacing) * 3); resize: vertical; }
|
|
33
|
+
/* Long text of a set number of lines: its height theirs, no floor, never dragged taller; past them it
|
|
34
|
+
scrolls. Its control is fixed at its lines and its box, a group's or a lone Input's, loses the floor. */
|
|
35
|
+
.o-input.o-input-long:has(> .o-input-lines) { height: auto; min-height: 0; --input-side: calc(1lh + var(--vk-spacing) * 4 + var(--vk-border-width) * 2); }
|
|
36
|
+
/* The phone's size: 44px and 16px text, so iOS never zooms in when it is tapped. Every field takes it
|
|
37
|
+
on a phone (the phone switch); size="lg" asks for it anywhere. Long text keeps its own height and padding, at lg's words, as
|
|
38
|
+
it does on a phone. */
|
|
39
|
+
.o-input-lg:not(.o-input-long) { height: calc(var(--vk-spacing) * 11); --input-side: calc(var(--vk-spacing) * 11); --input-pad-block: 0px; --input-pad-inline: calc(var(--vk-spacing) * 3.5); }
|
|
40
|
+
.o-input-lg { font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); }
|
|
41
|
+
/* The smaller sizes, as the Button's, for a field beside buttons of its size: 32px in toolbars, 28 and 24 in
|
|
42
|
+
dense rows, 24 with 12px words. Long text keeps its own height. */
|
|
43
|
+
.o-input-sm:not(.o-input-long) { height: calc(var(--vk-spacing) * 8); --input-side: calc(var(--vk-spacing) * 8); }
|
|
44
|
+
.o-input-xs:not(.o-input-long) { height: calc(var(--vk-spacing) * 7); --input-side: calc(var(--vk-spacing) * 7); --input-pad-block: 0px; --input-pad-inline: calc(var(--vk-spacing) * 2.5); }
|
|
45
|
+
.o-input-2xs:not(.o-input-long) { height: calc(var(--vk-spacing) * 6); --input-side: calc(var(--vk-spacing) * 6); --input-pad-block: 0px; --input-pad-inline: calc(var(--vk-spacing) * 2); }
|
|
46
|
+
.o-input-2xs { font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs)); }
|
|
47
|
+
@media (width < 640px) {
|
|
48
|
+
.o-input:not(.o-input-long):where(:not([data-computer-host], [data-computer-host] *)) { height: calc(var(--vk-spacing) * 11); --input-side: calc(var(--vk-spacing) * 11); --input-pad-block: 0px; --input-pad-inline: calc(var(--vk-spacing) * 3.5); }
|
|
49
|
+
.o-input:where(:not([data-computer-host], [data-computer-host] *)) { font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); }
|
|
50
|
+
}
|
|
51
|
+
@container o-phone (width < 640px) {
|
|
52
|
+
.o-input:not(.o-input-long) { height: calc(var(--vk-spacing) * 11); --input-side: calc(var(--vk-spacing) * 11); --input-pad-block: 0px; --input-pad-inline: calc(var(--vk-spacing) * 3.5); }
|
|
53
|
+
.o-input { font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); }
|
|
54
|
+
}
|
|
55
|
+
/* In a computer host every part is the computer's but a box a finger
|
|
56
|
+
can type in, which keeps 16px words, so iOS never zooms the page into it. A
|
|
57
|
+
read-only or disabled box keeps its own size. */
|
|
58
|
+
[data-computer-host] :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="hidden"], [type="button"], [type="submit"], [type="reset"], [type="color"], [type="file"], [type="image"]), textarea, select, [contenteditable=""], [contenteditable="true"]):not([readonly], :disabled) { font-size: var(--vk-font-size-base); }
|
|
59
|
+
|
|
60
|
+
/* ── Under the pointer, a louder edge and a deeper lift; in focus, the edge turns blue and glows ──────
|
|
61
|
+
The states come in the card's order, each as specific as the last, so a later one wins: the pointer
|
|
62
|
+
never takes a field's focus or its error away (only its lift deepens on an error). The pointer's
|
|
63
|
+
rule leaves out a disabled field inside :where, which adds nothing to its weight. A browser counts the
|
|
64
|
+
pointer on a label as the pointer on its field (a click on the label focuses the field), so the
|
|
65
|
+
pointer's rule also leaves out a field whose label the pointer is on: only the field itself shows it. */
|
|
66
|
+
@media (hover: hover) { .o-input:is(:where(:hover:not(.o-field:has(> .o-field-label:hover) *)), [data-force="hover"]):where(:not(:disabled, [data-disabled], [data-input-hover="fill"] *:not([data-input-own], [data-input-hover="fill"] [data-input-hover]:not([data-input-hover="fill"]) *), [data-input-own][data-input-hover="fill"], [data-input-hover="none"] *:not([data-input-own], [data-input-hover="none"] [data-input-hover]:not([data-input-hover="none"]) *), [data-input-own][data-input-hover="none"], :has(.o-input-control:is(:disabled, [data-disabled])))) { --input-edge: var(--vk-border-input-hovered); box-shadow: var(--vk-shadow-field-hover); } }
|
|
67
|
+
.o-input:is(:focus-visible, [data-force="focus"], [data-popup-open], :where(:has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { --input-edge: var(--vk-border-brand); box-shadow: var(--vk-shadow-field-focus); }
|
|
68
|
+
/* In error, the edge is red, and red glows in focus. */
|
|
69
|
+
.o-input:is([aria-invalid="true"], :where(:has(.o-input-control[aria-invalid="true"]))) { --input-edge: var(--vk-border-danger); }
|
|
70
|
+
.o-input:is([aria-invalid="true"], :where(:has(.o-input-control[aria-invalid="true"]))):is(:focus-visible, [data-force="focus"], [data-popup-open], :where(:has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { box-shadow: var(--vk-shadow-field-focus-danger); }
|
|
71
|
+
/* Disabled: a softer edge, a grey fill, no lift. */
|
|
72
|
+
.o-input:is(:disabled, [data-disabled], :where(:has(.o-input-control:is(:disabled, [data-disabled])))) { --input-edge: var(--vk-border-subtle); --input-ground: var(--vk-neutral); box-shadow: none; color: var(--vk-fg-disabled); cursor: not-allowed; }
|
|
73
|
+
|
|
74
|
+
/* Read-only: what it holds can be read, chosen and copied, not changed: a soft edge and no lift; it still
|
|
75
|
+
takes the focus, and the pointer changes nothing. One that opens something is a
|
|
76
|
+
box to press, not words to copy, and keeps a resting field's edge and lift. */
|
|
77
|
+
.o-input:is([readonly], :where(:has(.o-input-control[readonly]))) { cursor: default; }
|
|
78
|
+
.o-input:is([readonly], :where(:has(.o-input-control[readonly]))):where(:not(:focus-visible, [data-force="focus"], [data-popup-open], [aria-haspopup], :has(:is(.o-input-control:focus-visible, .o-input-segment:focus, .o-input-control[aria-haspopup])))) { --input-edge: var(--vk-border-subtle); box-shadow: none; }
|
|
79
|
+
|
|
80
|
+
/* ── The options a design picks (input/looks.ts) ─────────────────────────────────────────────────────
|
|
81
|
+
Data attributes on the frame or the app around the Input; each value only chooses other tokens:
|
|
82
|
+
|
|
83
|
+
data-input-radius xs · sm · md · lg · xl · 2xl · full which radius step its corners take
|
|
84
|
+
data-input-style outlined · filled · underline an edge all round, a fill, or one line under it
|
|
85
|
+
data-input-depth lift · flat · sunken the 1px lift, none, or a shadow inside it
|
|
86
|
+
data-input-hover edge · fill · strong what the pointer changes
|
|
87
|
+
data-input-focus glow · line · thick the blue edge with its glow, alone, or doubled
|
|
88
|
+
data-input-error edge · tint a red edge, or a red edge on a red tint
|
|
89
|
+
|
|
90
|
+
Nothing set is Classic, the card. An option restates every state it touches, in the order above, so the
|
|
91
|
+
pointer never takes focus or an error away. Set them on one element. Set again on a frame inside it, an
|
|
92
|
+
option replaces the outer one's: the nearest frame wins, option by option. Each frame read
|
|
93
|
+
carries a guard inside its :where(), so its weight never moves: <frame> [data-input-X]:not(<its test on X>) *,
|
|
94
|
+
or for a :not() test <frame> [data-input-X="V"] *, for each option X the frame names (every rule holds to it, so a new rule writes it
|
|
95
|
+
too). Two limits, which no page shows: a value set back two frames down is not read
|
|
96
|
+
(A, then B inside it, then A again: a field inside the second A takes the default; nest frames only with
|
|
97
|
+
different values); and a rule that reads two options together (the filled style's hover, the pill's ends
|
|
98
|
+
without an underline, the underline's tint) holds only when both come from one frame: inputAttrs writes every option a picker
|
|
99
|
+
offers and inputFrameAttrs every option a box's own look takes, so a frame either writes holds whole for the options it
|
|
100
|
+
writes.
|
|
101
|
+
|
|
102
|
+
A box's own look is the same attributes on the field's own element,
|
|
103
|
+
marked data-input-own, every option at once: it wins over its frame's, whole. Each rule reads either, as
|
|
104
|
+
:is(<frame> :where(.o-input:not([data-input-own])), :where(.o-input[data-input-own]<frame>)), whose weight is
|
|
105
|
+
the frame's alone, so every rule weighs what it weighed before a box could carry its own look. A box's own
|
|
106
|
+
look also takes four values a picker never offers: the ground (data-input-ground: input, none, the surface
|
|
107
|
+
showing through; overlay, the overlay's), Under the pointer none (nothing changes: the hover rules leave it
|
|
108
|
+
out), the inset (data-input-pad="edge": its words 12px from its outer edge) and its corners round
|
|
109
|
+
(data-input-corner="round"). A frame takes them too, written whole by inputFrameAttrs. */
|
|
110
|
+
|
|
111
|
+
/* ── Corners: a step of the radius; full is round at its ends ──────────────────────────────────────── */
|
|
112
|
+
:is([data-input-radius="xs"] :where(.o-input:not([data-input-own], [data-input-radius="xs"] [data-input-radius]:not([data-input-radius="xs"]) *)), :where(.o-input[data-input-own][data-input-radius="xs"])).o-input { --input-r: var(--vk-radius-xs); }
|
|
113
|
+
:is([data-input-radius="sm"] :where(.o-input:not([data-input-own], [data-input-radius="sm"] [data-input-radius]:not([data-input-radius="sm"]) *)), :where(.o-input[data-input-own][data-input-radius="sm"])).o-input { --input-r: var(--vk-radius-sm); }
|
|
114
|
+
:is([data-input-radius="md"] :where(.o-input:not([data-input-own], [data-input-radius="md"] [data-input-radius]:not([data-input-radius="md"]) *)), :where(.o-input[data-input-own][data-input-radius="md"])).o-input { --input-r: var(--vk-radius-md); }
|
|
115
|
+
:is([data-input-radius="lg"] :where(.o-input:not([data-input-own], [data-input-radius="lg"] [data-input-radius]:not([data-input-radius="lg"]) *)), :where(.o-input[data-input-own][data-input-radius="lg"])).o-input { --input-r: var(--vk-radius-lg); }
|
|
116
|
+
:is([data-input-radius="xl"] :where(.o-input:not([data-input-own], [data-input-radius="xl"] [data-input-radius]:not([data-input-radius="xl"]) *)), :where(.o-input[data-input-own][data-input-radius="xl"])).o-input { --input-r: var(--vk-radius-xl); }
|
|
117
|
+
:is([data-input-radius="2xl"] :where(.o-input:not([data-input-own], [data-input-radius="2xl"] [data-input-radius]:not([data-input-radius="2xl"]) *)), :where(.o-input[data-input-own][data-input-radius="2xl"])).o-input { --input-r: var(--vk-radius-2xl); }
|
|
118
|
+
:is([data-input-radius="full"]:not([data-input-style="underline"]) :where(.o-input:not([data-input-own], [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-radius]:not([data-input-radius="full"]) *, [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-style="underline"] *)), :where(.o-input[data-input-own][data-input-radius="full"]:not([data-input-style="underline"]))).o-input:not(.o-input-long) { --input-r: var(--vk-radius-full); corner-shape: round; --input-cut: none; --input-shown-edge: var(--input-edge); --input-shown-ground: var(--input-ground); --input-shown-thick: var(--vk-border-width); --input-shown-sunk: var(--vk-shadow-key-pressed); --input-pad-inline: calc(var(--vk-spacing) * 4); }
|
|
119
|
+
/* The two smallest round ones keep their ends in proportion, as the Button's do. */
|
|
120
|
+
:is([data-input-radius="full"]:not([data-input-style="underline"]) :where(.o-input:not([data-input-own], [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-radius]:not([data-input-radius="full"]) *, [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-style="underline"] *)), :where(.o-input[data-input-own][data-input-radius="full"]:not([data-input-style="underline"]))).o-input-xs:not(.o-input-long) { --input-pad-inline: calc(var(--vk-spacing) * 3); }
|
|
121
|
+
:is([data-input-radius="full"]:not([data-input-style="underline"]) :where(.o-input:not([data-input-own], [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-radius]:not([data-input-radius="full"]) *, [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-style="underline"] *)), :where(.o-input[data-input-own][data-input-radius="full"]:not([data-input-style="underline"]))).o-input-2xs:not(.o-input-long) { --input-pad-inline: calc(var(--vk-spacing) * 2.5); }
|
|
122
|
+
@media (width < 640px) { :is([data-input-radius="full"]:not([data-input-style="underline"]) :where(.o-input:not([data-input-own], [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-radius]:not([data-input-radius="full"]) *, [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-style="underline"] *)), :where(.o-input[data-input-own][data-input-radius="full"]:not([data-input-style="underline"]))).o-input:is(.o-input-xs, .o-input-2xs):not(.o-input-long):where(:not([data-computer-host], [data-computer-host] *)) { --input-pad-inline: calc(var(--vk-spacing) * 4); } }
|
|
123
|
+
@container o-phone (width < 640px) { :is([data-input-radius="full"]:not([data-input-style="underline"]) :where(.o-input:not([data-input-own], [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-radius]:not([data-input-radius="full"]) *, [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-style="underline"] *)), :where(.o-input[data-input-own][data-input-radius="full"]:not([data-input-style="underline"]))).o-input:is(.o-input-xs, .o-input-2xs):not(.o-input-long) { --input-pad-inline: calc(var(--vk-spacing) * 4); } }
|
|
124
|
+
/* Long text can't be a pill: it takes the largest step that still reads as a box. */
|
|
125
|
+
:is([data-input-radius="full"]:not([data-input-style="underline"]) :where(.o-input:not([data-input-own], [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-radius]:not([data-input-radius="full"]) *, [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-style="underline"] *)), :where(.o-input[data-input-own][data-input-radius="full"]:not([data-input-style="underline"]))).o-input-long { --input-r: var(--vk-radius-2xl); }
|
|
126
|
+
|
|
127
|
+
/* ── Ground: none (the surface shows through), or the overlay's, for a box over a cell, in a Popover or a Sheet. Filled
|
|
128
|
+
keeps its fill and an underline its line; disabled keeps its grey. ──────────────────────────────────────────────── */
|
|
129
|
+
:is([data-input-ground="overlay"] :where(.o-input:not([data-input-own], [data-input-ground="overlay"] [data-input-ground]:not([data-input-ground="overlay"]) *)), :where(.o-input[data-input-own][data-input-ground="overlay"])).o-input:where(:not(:disabled, [data-disabled], :has(.o-input-control:is(:disabled, [data-disabled])))) { --input-ground: var(--vk-overlay); }
|
|
130
|
+
|
|
131
|
+
/* ── Filled: a grey fill and no edge until focus or an error gives it one. It stays a filled field in
|
|
132
|
+
every state: the pointer moves the fill a step (darker in light, lighter in dark), focus keeps that
|
|
133
|
+
step and draws the blue edge on it, so a click under the pointer only adds the edge, and disabled
|
|
134
|
+
takes the fainter, sunken fill. ────────────────────────────────────────────────────────────────── */
|
|
135
|
+
:is([data-input-style="filled"] :where(.o-input:not([data-input-own], [data-input-style="filled"] [data-input-style]:not([data-input-style="filled"]) *)), :where(.o-input[data-input-own][data-input-style="filled"])).o-input { --input-edge: transparent; --input-ground: var(--vk-neutral); }
|
|
136
|
+
@media (hover: hover) { :is([data-input-style="filled"] :where(.o-input:not([data-input-own], [data-input-style="filled"] [data-input-style]:not([data-input-style="filled"]) *)), :where(.o-input[data-input-own][data-input-style="filled"])).o-input:is(:where(:hover:not(.o-field:has(> .o-field-label:hover) *)), [data-force="hover"]):where(:not(:disabled, [data-disabled], [data-input-hover="edge"] *:not([data-input-own], [data-input-hover="edge"] [data-input-hover]:not([data-input-hover="edge"]) *), [data-input-own][data-input-hover="edge"], [data-input-hover="none"] *:not([data-input-own], [data-input-hover="none"] [data-input-hover]:not([data-input-hover="none"]) *), [data-input-own][data-input-hover="none"], :has(.o-input-control:is(:disabled, [data-disabled])))) { --input-edge: transparent; --input-ground: var(--vk-neutral-hovered); } }
|
|
137
|
+
:is([data-input-style="filled"] :where(.o-input:not([data-input-own], [data-input-style="filled"] [data-input-style]:not([data-input-style="filled"]) *)), :where(.o-input[data-input-own][data-input-style="filled"])).o-input:is(:focus-visible, [data-force="focus"], [data-popup-open], :where(:has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { --input-edge: var(--vk-border-brand); --input-ground: var(--vk-neutral-hovered); }
|
|
138
|
+
:is([data-input-style="filled"] :where(.o-input:not([data-input-own], [data-input-style="filled"] [data-input-style]:not([data-input-style="filled"]) *)), :where(.o-input[data-input-own][data-input-style="filled"])).o-input:is([aria-invalid="true"], :where(:has(.o-input-control[aria-invalid="true"]))) { --input-edge: var(--vk-border-danger); }
|
|
139
|
+
:is([data-input-style="filled"] :where(.o-input:not([data-input-own], [data-input-style="filled"] [data-input-style]:not([data-input-style="filled"]) *)), :where(.o-input[data-input-own][data-input-style="filled"])).o-input:is(:disabled, [data-disabled], :where(:has(.o-input-control:is(:disabled, [data-disabled])))) { --input-edge: transparent; --input-ground: var(--vk-sunken); }
|
|
140
|
+
|
|
141
|
+
/* ── Depth: flat, no lift; sunken, a shadow along its top inside it. Focus keeps its own. ─────────── */
|
|
142
|
+
:is([data-input-depth="flat"] :where(.o-input:not([data-input-own], [data-input-depth="flat"] [data-input-depth]:not([data-input-depth="flat"]) *)), :where(.o-input[data-input-own][data-input-depth="flat"])).o-input:where(:not(:focus-visible, [data-force="focus"], [data-popup-open], :has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { box-shadow: none; }
|
|
143
|
+
:is([data-input-depth="sunken"] :where(.o-input:not([data-input-own], [data-input-depth="sunken"] [data-input-depth]:not([data-input-depth="sunken"]) *)), :where(.o-input[data-input-own][data-input-depth="sunken"])).o-input:where(:not(:focus-visible, [data-force="focus"], [data-popup-open], :disabled, [data-disabled], :has(:is(.o-input-control:is(:focus-visible, :disabled, [data-disabled]), .o-input-segment:focus)))) { box-shadow: var(--input-sunk, var(--vk-shadow-key-pressed)); --input-inset: var(--vk-shadow-key-pressed); }
|
|
144
|
+
|
|
145
|
+
/* ── Under the pointer: the edge (the rules above, the lift deepening with it), the fill alone, or both
|
|
146
|
+
with the edge a step darker. Never over focus, an error or a disabled field, which keep their
|
|
147
|
+
own. A filled field's Edge keeps its fill and shows an edge; its Strong takes the fill's step too. ── */
|
|
148
|
+
@media (hover: hover) { :is([data-input-hover="fill"]:not([data-input-style="filled"]) :where(.o-input:not([data-input-own], [data-input-hover="fill"]:not([data-input-style="filled"]) [data-input-hover]:not([data-input-hover="fill"]) *, [data-input-hover="fill"]:not([data-input-style="filled"]) [data-input-style="filled"] *)), :where(.o-input[data-input-own][data-input-hover="fill"]:not([data-input-style="filled"]))).o-input:is(:where(:hover:not(.o-field:has(> .o-field-label:hover) *)), [data-force="hover"]):where(:not(:focus-visible, [data-force="focus"], [data-popup-open], [aria-invalid="true"], :disabled, [data-disabled], :has(:is(.o-input-control:is(:focus-visible, [aria-invalid="true"], :disabled, [data-disabled]), .o-input-segment:focus)))) { --input-ground: var(--vk-hovered); } }
|
|
149
|
+
@media (hover: hover) { :is([data-input-hover="strong"]:not([data-input-style="filled"]) :where(.o-input:not([data-input-own], [data-input-hover="strong"]:not([data-input-style="filled"]) [data-input-hover]:not([data-input-hover="strong"]) *, [data-input-hover="strong"]:not([data-input-style="filled"]) [data-input-style="filled"] *)), :where(.o-input[data-input-own][data-input-hover="strong"]:not([data-input-style="filled"]))).o-input:is(:where(:hover:not(.o-field:has(> .o-field-label:hover) *)), [data-force="hover"]):where(:not(:focus-visible, [data-force="focus"], [data-popup-open], [aria-invalid="true"], :disabled, [data-disabled], :has(:is(.o-input-control:is(:focus-visible, [aria-invalid="true"], :disabled, [data-disabled]), .o-input-segment:focus)))) { --input-edge: var(--vk-border-input-strong); } }
|
|
150
|
+
@media (hover: hover) { :is([data-input-hover="strong"][data-input-style="outlined"] :where(.o-input:not([data-input-own], [data-input-hover="strong"][data-input-style="outlined"] [data-input-hover]:not([data-input-hover="strong"]) *, [data-input-hover="strong"][data-input-style="outlined"] [data-input-style]:not([data-input-style="outlined"]) *)), :where(.o-input[data-input-own][data-input-hover="strong"][data-input-style="outlined"])).o-input:is(:where(:hover:not(.o-field:has(> .o-field-label:hover) *)), [data-force="hover"]):where(:not(:focus-visible, [data-force="focus"], [data-popup-open], [aria-invalid="true"], :disabled, [data-disabled], :has(:is(.o-input-control:is(:focus-visible, [aria-invalid="true"], :disabled, [data-disabled]), .o-input-segment:focus)))) { --input-ground: var(--vk-hovered); } }
|
|
151
|
+
@media (hover: hover) { :is([data-input-style="filled"]:is([data-input-hover="edge"], [data-input-hover="strong"]) :where(.o-input:not([data-input-own], [data-input-style="filled"]:is([data-input-hover="edge"], [data-input-hover="strong"]) [data-input-style]:not([data-input-style="filled"]) *, [data-input-style="filled"]:is([data-input-hover="edge"], [data-input-hover="strong"]) [data-input-hover]:not([data-input-hover="edge"], [data-input-hover="strong"]) *)), :where(.o-input[data-input-own][data-input-style="filled"]:is([data-input-hover="edge"], [data-input-hover="strong"]))).o-input:is(:where(:hover:not(.o-field:has(> .o-field-label:hover) *)), [data-force="hover"]):where(:not(:focus-visible, [data-force="focus"], [data-popup-open], [aria-invalid="true"], :disabled, [data-disabled], :has(:is(.o-input-control:is(:focus-visible, [aria-invalid="true"], :disabled, [data-disabled]), .o-input-segment:focus)))) { --input-edge: var(--vk-border-input-hovered); } }
|
|
152
|
+
|
|
153
|
+
/* ── Focus: the edge alone, or the edge doubled inside it; in error, in red ───────────────────────── */
|
|
154
|
+
:is([data-input-focus="line"] :where(.o-input:not([data-input-own], [data-input-focus="line"] [data-input-focus]:not([data-input-focus="line"]) *)), :where(.o-input[data-input-own][data-input-focus="line"])).o-input:is(:focus-visible, [data-force="focus"], [data-popup-open], :where(:has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { box-shadow: none; }
|
|
155
|
+
/* Focus within: the edge alone, as Edge only, and the edge also while anything inside it has the focus,
|
|
156
|
+
a Button in its side too. */
|
|
157
|
+
:where(.o-input[data-input-own][data-input-focus="within"]).o-input:is(:focus-visible, [data-force="focus"], [data-popup-open], :where(:has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { box-shadow: none; }
|
|
158
|
+
.o-input.o-input-group[data-input-own][data-input-focus="within"]:focus-within { --input-edge: var(--vk-border-brand); }
|
|
159
|
+
:is([data-input-focus="thick"] :where(.o-input:not([data-input-own], [data-input-focus="thick"] [data-input-focus]:not([data-input-focus="thick"]) *)), :where(.o-input[data-input-own][data-input-focus="thick"])).o-input:is(:focus-visible, [data-force="focus"], [data-popup-open], :where(:has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { box-shadow: inset 0 0 0 var(--input-thick, var(--vk-border-width)) var(--vk-border-brand); --input-edge-in: calc(var(--vk-border-width) * 2); }
|
|
160
|
+
:is([data-input-focus="thick"] :where(.o-input:not([data-input-own], [data-input-focus="thick"] [data-input-focus]:not([data-input-focus="thick"]) *)), :where(.o-input[data-input-own][data-input-focus="thick"])).o-input:is([aria-invalid="true"], :where(:has(.o-input-control[aria-invalid="true"]))):is(:focus-visible, [data-force="focus"], [data-popup-open], :where(:has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { box-shadow: inset 0 0 0 var(--input-thick, var(--vk-border-width)) var(--vk-border-danger); --input-edge-in: calc(var(--vk-border-width) * 2); }
|
|
161
|
+
|
|
162
|
+
/* ── Error: the red edge on a red tint ─────────────────────────────────────────────────────────────── */
|
|
163
|
+
:is([data-input-error="tint"] :where(.o-input:not([data-input-own], [data-input-error="tint"] [data-input-error]:not([data-input-error="tint"]) *)), :where(.o-input[data-input-own][data-input-error="tint"])).o-input:is([aria-invalid="true"], :where(:has(.o-input-control[aria-invalid="true"]))) { --input-ground: var(--vk-danger-subtlest); }
|
|
164
|
+
|
|
165
|
+
/* ── Underline: one line under the words, no corners, no lift; focus thickens the line, whatever the
|
|
166
|
+
focus option says, since a glow round a box you can't see draws a box. ──────────────────────────── */
|
|
167
|
+
:is([data-input-style="underline"] :where(.o-input:not([data-input-own], [data-input-style="underline"] [data-input-style]:not([data-input-style="underline"]) *)), :where(.o-input[data-input-own][data-input-style="underline"])).o-input {
|
|
168
|
+
border-width: 0 0 var(--vk-border-width); --input-r: 0px; corner-shape: round; --input-pad-inline: 0px;
|
|
169
|
+
--input-ground: var(--vk-input); box-shadow: none; --input-cut: none; --input-shown-edge: var(--input-edge); --input-shown-ground: var(--input-ground); --input-shown-thick: var(--vk-border-width); --input-shown-sunk: var(--vk-shadow-key-pressed);
|
|
170
|
+
}
|
|
171
|
+
:is([data-input-style="underline"] :where(.o-input:not([data-input-own], [data-input-style="underline"] [data-input-style]:not([data-input-style="underline"]) *)), :where(.o-input[data-input-own][data-input-style="underline"])).o-input:is(:focus-visible, [data-force="focus"], [data-popup-open], :where(:has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { box-shadow: inset 0 calc(var(--vk-border-width) * -1) 0 var(--vk-border-brand); }
|
|
172
|
+
:is([data-input-style="underline"] :where(.o-input:not([data-input-own], [data-input-style="underline"] [data-input-style]:not([data-input-style="underline"]) *)), :where(.o-input[data-input-own][data-input-style="underline"])).o-input:is([aria-invalid="true"], :where(:has(.o-input-control[aria-invalid="true"]))):is(:focus-visible, [data-force="focus"], [data-popup-open], :where(:has(:is(.o-input-control:focus-visible, .o-input-segment:focus)))) { box-shadow: inset 0 calc(var(--vk-border-width) * -1) 0 var(--vk-border-danger); }
|
|
173
|
+
:is([data-input-style="underline"][data-input-error="tint"] :where(.o-input:not([data-input-own], [data-input-style="underline"][data-input-error="tint"] [data-input-style]:not([data-input-style="underline"]) *, [data-input-style="underline"][data-input-error="tint"] [data-input-error]:not([data-input-error="tint"]) *)), :where(.o-input[data-input-own][data-input-style="underline"][data-input-error="tint"])).o-input:is([aria-invalid="true"], :where(:has(.o-input-control[aria-invalid="true"]))) { --input-ground: var(--vk-danger-subtlest); --input-pad-inline: calc(var(--vk-spacing) * 2); }
|
|
174
|
+
|
|
175
|
+
/* ── The inset (a box's own look): its words 12px from its outer edge at every size, the hairline inside that; long
|
|
176
|
+
text 6px from its top and bottom (10px at the phone's size), as labelled boxes are. It outweighs the sizes and the phone's padding, and an own Underline's none; an own look at
|
|
177
|
+
radius full keeps the pill's ends. A frame sets it too, as it sets every option. ───────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
178
|
+
/* On a frame too. Each keeps the weight it had as an own look's rule, (0,3,0) and up: .o-input twice. */
|
|
179
|
+
:is([data-input-pad="edge"] :where(.o-input:not([data-input-own], [data-input-pad="edge"] [data-input-pad]:not([data-input-pad="edge"]) *)), :where(.o-input[data-input-own][data-input-pad="edge"])).o-input.o-input { --input-pad-inline: calc(var(--vk-spacing) * 3 - var(--vk-border-width)); }
|
|
180
|
+
:is([data-input-pad="edge"] :where(.o-input:not([data-input-own], [data-input-pad="edge"] [data-input-pad]:not([data-input-pad="edge"]) *)), :where(.o-input[data-input-own][data-input-pad="edge"])).o-input.o-input.o-input-long { --input-pad-block: calc(var(--vk-spacing) * 1.5 - var(--vk-border-width)); }
|
|
181
|
+
:is([data-input-pad="edge"] :where(.o-input:not([data-input-own], [data-input-pad="edge"] [data-input-pad]:not([data-input-pad="edge"]) *)), :where(.o-input[data-input-own][data-input-pad="edge"])).o-input.o-input.o-input-long.o-input-lg { --input-pad-block: calc(var(--vk-spacing) * 2.5 - var(--vk-border-width)); }
|
|
182
|
+
/* A box's own look's corners, round where said; the smooth outline unless. On a frame too. */
|
|
183
|
+
:is([data-input-corner="round"] :where(.o-input:not([data-input-own], [data-input-corner="round"] [data-input-corner]:not([data-input-corner="round"]) *)), :where(.o-input[data-input-own][data-input-corner="round"])).o-input.o-input { corner-shape: round; --input-cut: none; --input-shown-edge: var(--input-edge); --input-shown-ground: var(--input-ground); --input-shown-thick: var(--vk-border-width); --input-shown-sunk: var(--vk-shadow-key-pressed); }
|
|
184
|
+
/* A box's own look in code words: the monospace typeface at xs, for long text that is code. Never a size:
|
|
185
|
+
its height and its line stay its size's. An own look only; it outweighs the sizes. On a phone a box that can be typed into keeps
|
|
186
|
+
the phone's 16px, so the phone never zooms in on it; a read-only one keeps xs there too. */
|
|
187
|
+
.o-input[data-input-own][data-input-words="code"] { font-family: var(--vk-font-mono); font-size: var(--vk-font-size-xs); }
|
|
188
|
+
@media (width < 640px) { .o-input[data-input-own][data-input-words="code"]:not([readonly], :has(> .o-input-control[readonly])):where(:not([data-computer-host], [data-computer-host] *)) { font-size: var(--vk-font-size-base); } }
|
|
189
|
+
@container o-phone (width < 640px) { .o-input[data-input-own][data-input-words="code"]:not([readonly], :has(> .o-input-control[readonly])) { font-size: var(--vk-font-size-base); } }
|
|
190
|
+
|
|
191
|
+
/* ── A group: the field drawn around an Input and its addons ───────────────────────────────────────────
|
|
192
|
+
The group is the field itself (it carries .o-input), so its edge, lift, size, corners and every look
|
|
193
|
+
are the Input's own; each state above also reads the Input inside it (its focus, its error, disabled),
|
|
194
|
+
at the same weight, so a group's states fall in the same order. The Input inside is bare. */
|
|
195
|
+
/* The room between its parts is --input-group-gap where a place sets it (a body that lays its parts closer), 6px unless said. */
|
|
196
|
+
.o-input-group { display: flex; align-items: center; gap: var(--input-group-gap, calc(var(--vk-spacing) * 1.5)); cursor: text; }
|
|
197
|
+
/* The bare control (alone, or a group's): a value wider than it ends in "…" at rest, so a cut address never reads as a wrong one
|
|
198
|
+
; typed into, the browser scrolls it whole. */
|
|
199
|
+
.o-input-control {
|
|
200
|
+
flex: 1; align-self: stretch; box-sizing: border-box; width: 100%; min-width: 0; margin: 0; padding: 0;
|
|
201
|
+
border: 0; border-radius: 0; background: transparent; box-shadow: none; color: inherit; font: inherit; outline: none; text-overflow: ellipsis;
|
|
202
|
+
}
|
|
203
|
+
/* A bare box told not to fill its line (fills={false}) stands at the width and height its place gives it. */
|
|
204
|
+
.o-input-control[data-fills="off"] { flex: initial; align-self: auto; }
|
|
205
|
+
.o-input-control::placeholder { color: var(--vk-fg-subtlest); opacity: 1; }
|
|
206
|
+
/* A segment of a value typed in parts (InputGroupSegment) draws no outline of its own: its group shows the focus. */
|
|
207
|
+
.o-input-segment { outline: none; }
|
|
208
|
+
.o-input-control:is(:disabled, [data-disabled]) { cursor: not-allowed; }
|
|
209
|
+
/* Numbers line up inside a group too: the control's font: inherit, just above, would take .o-input-num's tabular digits away
|
|
210
|
+
(in DM Sans no pixel moves, its digits already one width). */
|
|
211
|
+
.o-input-control.o-input-num { font-variant-numeric: tabular-nums; }
|
|
212
|
+
/* Bare, a box that can be typed into keeps the phone's 16px words on a phone whatever its place's, so iOS never zooms in on it: the Input's, the Number field's, any place's. A field gives the control inside it its words, so this reads only a
|
|
213
|
+
control no field draws round; a read-only or disabled one keeps its place's. (0,1,0), after the control's font: inherit; a place's
|
|
214
|
+
own rule for its box still wins (a picker's, a links editor's, each 16 on a phone too). */
|
|
215
|
+
@media (width < 640px) { .o-input-control:where(:not(.o-input *, [readonly], :disabled, [data-disabled])):where(:not([data-computer-host], [data-computer-host] *)) { font-size: var(--vk-font-size-base); } }
|
|
216
|
+
@container o-phone (width < 640px) { .o-input-control:where(:not(.o-input *, [readonly], :disabled, [data-disabled])) { font-size: var(--vk-font-size-base); } }
|
|
217
|
+
|
|
218
|
+
/* ── A lone Input in its field: a box round its control, a group of one, so its corner can wear the smooth outline
|
|
219
|
+
(the end of this file) in every browser. Inline-level, as the <input> was, so no line it stands on moves. Its padding is its
|
|
220
|
+
control's (the field form's two variables), so the control fills the box inside its edge: its resize handle, its scrollbar and
|
|
221
|
+
the browser's autofill fill stand where they stood, every press lands in it (its edge hands one on), and its corners are the
|
|
222
|
+
box's inside its edge (--input-inner), a quarter circle within the smooth outline.
|
|
223
|
+
Its value wider than it is cut off at rest, with no "…". Long text keeps its own height, dragged taller by
|
|
224
|
+
its control's handle; growing, its control grows to ten lines, then scrolls. ──────────────────────────────────────────────── */
|
|
225
|
+
.o-input.o-input-lone { display: inline-flex; padding: 0; }
|
|
226
|
+
/* Its edge shows the I-beam, as the <input>'s did; read-only and disabled keep theirs (this weighs nothing). */
|
|
227
|
+
:where(.o-input.o-input-lone) { cursor: text; }
|
|
228
|
+
/* Standing on a line (inline, never as a flex or grid item, where it lends its first line), each engine stood the <textarea> where
|
|
229
|
+
it stands the box only after a nudge, measured at 14 and 16px words and every height in each engine: WebKit
|
|
230
|
+
on its bottom edge, as the box; Chromium on the textarea's bottom margin edge, its edge's width inside the box, so the box is
|
|
231
|
+
raised by it; Firefox 3px above its bottom edge. Each engine is known by what it supports (corner-shape: Chromium alone;
|
|
232
|
+
-moz-appearance: Firefox alone), so an engine that ships the other's moves this 1-3px, and no page yet stands a lone long text on a line to
|
|
233
|
+
catch it. The measurements left with the proofs: a change here is measured again,
|
|
234
|
+
by hand, in Chromium, WebKit and Firefox. */
|
|
235
|
+
.o-input.o-input-lone.o-input-long { display: inline-block; }
|
|
236
|
+
@supports (corner-shape: round) { .o-input.o-input-lone.o-input-long { vertical-align: var(--vk-border-width); } }
|
|
237
|
+
@supports (-moz-appearance: none) { .o-input.o-input-lone.o-input-long { vertical-align: -3px; } }
|
|
238
|
+
.o-input-lone > .o-input-control {
|
|
239
|
+
padding: var(--input-pad-block) var(--input-pad-inline); border-radius: max(0px, calc(var(--input-inner) - var(--vk-border-width)));
|
|
240
|
+
text-overflow: clip;
|
|
241
|
+
}
|
|
242
|
+
/* Read-only, the arrow, as the box shows it (its own I-beam unless; disabled, not-allowed, above). */
|
|
243
|
+
.o-input-lone > .o-input-control[readonly] { cursor: default; }
|
|
244
|
+
/* One line: the box's full height, set, as the <input>'s was (a stretched input sets its words a pixel higher in Chromium). */
|
|
245
|
+
.o-input-lone > input.o-input-control { height: 100%; }
|
|
246
|
+
/* Long text: the <textarea> it was, to the pixel. It fills the box to its outer edge, its own edge there transparent, so the box's
|
|
247
|
+
edge shows through it, and takes the box's floor (min-height: inherit); a block in an inline block. */
|
|
248
|
+
.o-input-lone > textarea.o-input-control {
|
|
249
|
+
display: block; box-sizing: border-box; width: calc(100% + var(--vk-border-width) * 2); margin: calc(var(--vk-border-width) * -1);
|
|
250
|
+
border: var(--vk-border-width) solid transparent; border-radius: var(--input-inner); background-clip: padding-box;
|
|
251
|
+
min-height: inherit; max-height: none; field-sizing: fixed; resize: vertical;
|
|
252
|
+
}
|
|
253
|
+
.o-input-lone > textarea.o-input-control.o-input-lines { resize: none; }
|
|
254
|
+
|
|
255
|
+
/* Long text, or a row above or below it: a column, the rows full width, the long text between them
|
|
256
|
+
growing with its words from two lines to ten, then scrolling (maxLines sets another stop). */
|
|
257
|
+
.o-input-group.o-input-long { flex-direction: column; align-items: stretch; gap: calc(var(--vk-spacing) * 2); }
|
|
258
|
+
textarea.o-input-control { flex: 1 0 auto; min-height: calc(1lh * 2); max-height: calc(1lh * 10); resize: none; field-sizing: content; }
|
|
259
|
+
textarea.o-input-control.o-input-lines { flex: none; min-height: 0; max-height: none; field-sizing: fixed; }
|
|
260
|
+
|
|
261
|
+
/* ── An addon: what sits beside the words, in the order its side says, whatever the order it's written
|
|
262
|
+
in. Its words quieter than the words typed, its icon 16px and quieter still. ──────────────────────── */
|
|
263
|
+
.o-input-addon { flex: none; display: flex; align-items: center; gap: calc(var(--vk-spacing) * 1.5); color: var(--vk-fg-subtle); white-space: nowrap; user-select: none; }
|
|
264
|
+
.o-input-addon:is([data-side="start"], [data-side="top"]) { order: -1; }
|
|
265
|
+
.o-input-addon:is([data-side="end"], [data-side="bottom"]) { order: 1; }
|
|
266
|
+
.o-input-addon > svg { flex: none; width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); color: var(--vk-fg-subtlest); }
|
|
267
|
+
.o-input-2xs > .o-input-addon > svg { width: calc(var(--vk-spacing) * 3.5); height: calc(var(--vk-spacing) * 3.5); }
|
|
268
|
+
@media (width < 640px) { .o-input-2xs > .o-input-addon > svg:where(:not([data-computer-host], [data-computer-host] *)) { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); } }
|
|
269
|
+
@container o-phone (width < 640px) { .o-input-2xs > .o-input-addon > svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); } }
|
|
270
|
+
.o-input-group:has(.o-input-control:is(:disabled, [data-disabled])) .o-input-addon { color: var(--vk-fg-disabled); }
|
|
271
|
+
.o-input-group:has(.o-input-control:is(:disabled, [data-disabled])) .o-input-addon > svg { color: inherit; }
|
|
272
|
+
|
|
273
|
+
/* A row above or below long text: its buttons 4px apart, as a toolbar's, the first and the last as far
|
|
274
|
+
in from the side as from the top or the bottom (8px), the long text's words where they always are. */
|
|
275
|
+
.o-input-addon:is([data-side="top"], [data-side="bottom"]) { gap: calc(var(--vk-spacing) * 1); margin-inline: calc(var(--vk-spacing) * -1); }
|
|
276
|
+
:is([data-input-style="underline"] :where(.o-input:not([data-input-own], [data-input-style="underline"] [data-input-style]:not([data-input-style="underline"]) *)), :where(.o-input[data-input-own][data-input-style="underline"])) .o-input-addon:is([data-side="top"], [data-side="bottom"]) { margin-inline: 0; }
|
|
277
|
+
|
|
278
|
+
/* A button at the field's start or end sits as far in from the side as from the top and bottom: 3px inside
|
|
279
|
+
the edge of a 36px field round a 28px button and of a 32px one round a 24px button, 7px in a 44px one. Its corners are a step smaller than the
|
|
280
|
+
field's, so the two curves run alike; in a round field it is round. */
|
|
281
|
+
.o-input.o-input-group:has(> .o-input-addon[data-side="end"]:not(:where([data-flush])) > .o-button:last-child) { padding-right: calc(var(--vk-spacing) * 3 / 4); }
|
|
282
|
+
.o-input.o-input-group:has(> .o-input-addon[data-side="start"]:not(:where([data-flush])) > .o-button:first-child) { padding-left: calc(var(--vk-spacing) * 3 / 4); }
|
|
283
|
+
.o-input.o-input-group.o-input-lg:has(> .o-input-addon[data-side="end"]:not(:where([data-flush])) > .o-button:last-child) { padding-right: calc(var(--vk-spacing) * 7 / 4); }
|
|
284
|
+
.o-input.o-input-group.o-input-lg:has(> .o-input-addon[data-side="start"]:not(:where([data-flush])) > .o-button:first-child) { padding-left: calc(var(--vk-spacing) * 7 / 4); }
|
|
285
|
+
/* An lg group is the phone's form asked for anywhere, so its button beside the value takes the value's 16px words at any width
|
|
286
|
+
, as the phone's rule below gives every group's; the same weight, (0,2,0). */
|
|
287
|
+
:where(.o-input.o-input-group.o-input-lg > .o-input-addon:is([data-side="start"], [data-side="end"]):not(:where([data-flush]))) > .o-button.o-button { font-size: var(--vk-font-size-base); }
|
|
288
|
+
@media (width < 640px) {
|
|
289
|
+
.o-input.o-input-group:not(.o-input-long):has(> .o-input-addon[data-side="end"]:not(:where([data-flush])) > .o-button:last-child):where(:not([data-computer-host], [data-computer-host] *)) { padding-right: calc(var(--vk-spacing) * 7 / 4); }
|
|
290
|
+
.o-input.o-input-group:not(.o-input-long):has(> .o-input-addon[data-side="start"]:not(:where([data-flush])) > .o-button:first-child):where(:not([data-computer-host], [data-computer-host] *)) { padding-left: calc(var(--vk-spacing) * 7 / 4); }
|
|
291
|
+
/* A 32px field's 24px button, in the phone's 44px field. */
|
|
292
|
+
.o-input.o-input-group:not(.o-input-long):has(> .o-input-addon[data-side="end"]:not(:where([data-flush])) > .o-button-2xs:last-child):where(:not([data-computer-host], [data-computer-host] *)) { padding-right: calc(var(--vk-spacing) * 9 / 4); }
|
|
293
|
+
.o-input.o-input-group:not(.o-input-long):has(> .o-input-addon[data-side="start"]:not(:where([data-flush])) > .o-button-2xs:first-child):where(:not([data-computer-host], [data-computer-host] *)) { padding-left: calc(var(--vk-spacing) * 9 / 4); }
|
|
294
|
+
/* A button beside the value takes the value's 16px words; a row above or below long text keeps the Button's sizes.
|
|
295
|
+
(0,2,0): over the Button's sizes, under a Button's own words look (0,3,0); the editors' own phone rules are unlayered. */
|
|
296
|
+
:where(.o-input.o-input-group > .o-input-addon:is([data-side="start"], [data-side="end"]):not(:where([data-flush]))) > .o-button.o-button:where(:not([data-computer-host], [data-computer-host] *)) { font-size: var(--vk-font-size-base); }
|
|
297
|
+
}
|
|
298
|
+
@container o-phone (width < 640px) {
|
|
299
|
+
.o-input.o-input-group:not(.o-input-long):has(> .o-input-addon[data-side="end"]:not(:where([data-flush])) > .o-button:last-child) { padding-right: calc(var(--vk-spacing) * 7 / 4); }
|
|
300
|
+
.o-input.o-input-group:not(.o-input-long):has(> .o-input-addon[data-side="start"]:not(:where([data-flush])) > .o-button:first-child) { padding-left: calc(var(--vk-spacing) * 7 / 4); }
|
|
301
|
+
/* A 32px field's 24px button, in the phone's 44px field. */
|
|
302
|
+
.o-input.o-input-group:not(.o-input-long):has(> .o-input-addon[data-side="end"]:not(:where([data-flush])) > .o-button-2xs:last-child) { padding-right: calc(var(--vk-spacing) * 9 / 4); }
|
|
303
|
+
.o-input.o-input-group:not(.o-input-long):has(> .o-input-addon[data-side="start"]:not(:where([data-flush])) > .o-button-2xs:first-child) { padding-left: calc(var(--vk-spacing) * 9 / 4); }
|
|
304
|
+
/* A button beside the value takes the value's 16px words; a row above or below long text keeps the Button's sizes.
|
|
305
|
+
(0,2,0): over the Button's sizes, under a Button's own words look (0,3,0); the editors' own phone rules are unlayered. */
|
|
306
|
+
:where(.o-input.o-input-group > .o-input-addon:is([data-side="start"], [data-side="end"]):not(:where([data-flush]))) > .o-button.o-button { font-size: var(--vk-font-size-base); }
|
|
307
|
+
}
|
|
308
|
+
/* Its focus ring hugs it, so the ring stays inside the field's edge. */
|
|
309
|
+
.o-input.o-input-group > .o-input-addon:not(:where([data-flush])) > .o-button:is(:focus-visible, [data-force="focus"]) { outline-offset: 0; }
|
|
310
|
+
.o-input.o-input-group > .o-input-addon:not(:where([data-flush])) > .o-button:not(.o-button-round, :where([data-button-own][data-button-radius])) { --button-r: var(--vk-radius-md); }
|
|
311
|
+
:is([data-input-radius="xs"] :where(.o-input:not([data-input-own], [data-input-radius="xs"] [data-input-radius]:not([data-input-radius="xs"]) *)), :where(.o-input[data-input-own][data-input-radius="xs"])).o-input.o-input-group > .o-input-addon:not(:where([data-flush])) > .o-button:not(.o-button-round, :where([data-button-own][data-button-radius])),
|
|
312
|
+
:is([data-input-radius="sm"] :where(.o-input:not([data-input-own], [data-input-radius="sm"] [data-input-radius]:not([data-input-radius="sm"]) *)), :where(.o-input[data-input-own][data-input-radius="sm"])).o-input.o-input-group > .o-input-addon:not(:where([data-flush])) > .o-button:not(.o-button-round, :where([data-button-own][data-button-radius])) { --button-r: var(--vk-radius-xs); }
|
|
313
|
+
:is([data-input-radius="md"] :where(.o-input:not([data-input-own], [data-input-radius="md"] [data-input-radius]:not([data-input-radius="md"]) *)), :where(.o-input[data-input-own][data-input-radius="md"])).o-input.o-input-group > .o-input-addon:not(:where([data-flush])) > .o-button:not(.o-button-round, :where([data-button-own][data-button-radius])) { --button-r: var(--vk-radius-sm); }
|
|
314
|
+
:is([data-input-radius="xl"] :where(.o-input:not([data-input-own], [data-input-radius="xl"] [data-input-radius]:not([data-input-radius="xl"]) *)), :where(.o-input[data-input-own][data-input-radius="xl"])).o-input.o-input-group > .o-input-addon:not(:where([data-flush])) > .o-button:not(.o-button-round, :where([data-button-own][data-button-radius])) { --button-r: var(--vk-radius-lg); }
|
|
315
|
+
:is([data-input-radius="2xl"] :where(.o-input:not([data-input-own], [data-input-radius="2xl"] [data-input-radius]:not([data-input-radius="2xl"]) *)), :where(.o-input[data-input-own][data-input-radius="2xl"])).o-input.o-input-group > .o-input-addon:not(:where([data-flush])) > .o-button:not(.o-button-round, :where([data-button-own][data-button-radius])) { --button-r: var(--vk-radius-xl); }
|
|
316
|
+
:is([data-input-radius="full"]:not([data-input-style="underline"]) :where(.o-input:not([data-input-own], [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-radius]:not([data-input-radius="full"]) *, [data-input-radius="full"]:not([data-input-style="underline"]) [data-input-style="underline"] *)), :where(.o-input[data-input-own][data-input-radius="full"]:not([data-input-style="underline"]))).o-input.o-input-group:not(.o-input-long) > .o-input-addon:not(:where([data-flush])) > .o-button:not(.o-button-round, :where([data-button-own][data-button-radius])) { --button-r: var(--vk-radius-full); }
|
|
317
|
+
|
|
318
|
+
/* ── Long text that grows with its words, and is dragged taller too, as shadcn's Textarea,
|
|
319
|
+
to ten lines (its padding and edge on top), then scrolls; maxLines sets another stop ─────────────────────────────────── */
|
|
320
|
+
.o-input-lone.o-input-grow > textarea.o-input-control { field-sizing: content; max-height: calc(1lh * 10 + var(--vk-spacing) * 4 + var(--vk-border-width) * 2); }
|
|
321
|
+
|
|
322
|
+
/* Kept at its size: under the phone switch a box whose look or frame says so keeps 32 high and a line of 20, a Select's
|
|
323
|
+
words 14, as the computer's form of a labelled box is shown on a phone's screen; what is typed stays 16 (its place's rule). */
|
|
324
|
+
@media (width < 640px) {
|
|
325
|
+
:is([data-input-keep="size"] .o-input, .o-input[data-input-keep="size"]).o-input.o-input:where(:not([data-computer-host], [data-computer-host] *)) { line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
|
|
326
|
+
:is([data-input-keep="size"] .o-input, .o-input[data-input-keep="size"]).o-input.o-input:not(.o-input-long):where(:not([data-computer-host], [data-computer-host] *)) { height: calc(var(--vk-spacing) * 8); --input-side: calc(var(--vk-spacing) * 8); }
|
|
327
|
+
:is([data-input-keep="size"] .o-input, .o-input[data-input-keep="size"]).o-input.o-select-field:where(:not([data-computer-host], [data-computer-host] *)) { font-size: var(--vk-font-size-sm); }
|
|
328
|
+
}
|
|
329
|
+
@container o-phone (width < 640px) {
|
|
330
|
+
:is([data-input-keep="size"] .o-input, .o-input[data-input-keep="size"]).o-input.o-input { line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
|
|
331
|
+
:is([data-input-keep="size"] .o-input, .o-input[data-input-keep="size"]).o-input.o-input:not(.o-input-long) { height: calc(var(--vk-spacing) * 8); --input-side: calc(var(--vk-spacing) * 8); }
|
|
332
|
+
:is([data-input-keep="size"] .o-input, .o-input[data-input-keep="size"]).o-input.o-select-field { font-size: var(--vk-font-size-sm); }
|
|
333
|
+
}
|
|
334
|
+
/* A segment its owner says has the focus, or one a page shows typed into: the brand's tint. */
|
|
335
|
+
.o-input-segment[data-on] { background-color: var(--vk-brand-subtler); }
|
|
336
|
+
|
|
337
|
+
/* ── Corner smoothing: following the token corner-smoothing (Round is the token at 0), a box that can
|
|
338
|
+
hold a layer (o-smooth: an InputGroup in its field, the Number field's among them, and the Select's box) is drawn with the
|
|
339
|
+
smooth outline (ViewKit's smooth.css) in every browser that knows shape(); one that doesn't keeps the corners above. The box is never
|
|
340
|
+
clipped, since its lift, its focus glow and its error's glow stand outside it: every state and look above sets its paint as
|
|
341
|
+
variables (--input-edge, --input-ground, its corner --input-r, its side --input-side: the least it stands at, long text
|
|
342
|
+
two lines or its set lines, a Toolbar's line its own, so the outline never crosses itself), which its own ::before (the ground, clipped
|
|
343
|
+
by the outline, Sunken's shadow inside it) and ::after (the edge, a ring along it, Thick's two lines) draw, its round part fitted
|
|
344
|
+
to its side, min(r, side / (2 + 2 × amount)), so the whole smoothing stays. An underline, a box at Full and a box's own round
|
|
345
|
+
corner draw themselves as before (--input-cut: none gives the box its paint back). A lone Input is a box round its control
|
|
346
|
+
, and smooths as a group does. ─────────────── */
|
|
347
|
+
.o-input.o-smooth { --smooth-amount: var(--vk-corner-smoothing); }
|
|
348
|
+
/* The Input's own Corner smoothing: The app's, with nothing set, follows the token; Round paints every box as it
|
|
349
|
+
stood before , a quarter circle, its layers off; Smooth smooths them at Apple's 70% (the outline's own amount) whatever the
|
|
350
|
+
token says. */
|
|
351
|
+
:is([data-input-smoothing="round"] :where(.o-input:not([data-input-own], [data-input-smoothing="round"] [data-input-smoothing]:not([data-input-smoothing="round"]) *)), :where(.o-input[data-input-own][data-input-smoothing="round"])).o-input { corner-shape: round; --input-cut: none; --input-shown-edge: var(--input-edge); --input-shown-ground: var(--input-ground); --input-shown-thick: var(--vk-border-width); --input-shown-sunk: var(--vk-shadow-key-pressed); }
|
|
352
|
+
:is([data-input-smoothing="smooth"] :where(.o-input:not([data-input-own], [data-input-smoothing="smooth"] [data-input-smoothing]:not([data-input-smoothing="smooth"]) *)), :where(.o-input[data-input-own][data-input-smoothing="smooth"])).o-input.o-smooth { --smooth-amount: initial; }
|
|
353
|
+
@supports (clip-path: shape(evenodd from 0 0, curve by 1px 1px with 1px 0 / 1px 0, close, move to 0 0, hline to 1px, close)) and (width: calc(tan(atan2(1px, 1px)) * 1px)) {
|
|
354
|
+
/* Its own corner is its ground's: the fitted corner, --smooth-t, worked out once on the box (ViewKit's smooth.css), so its lift and
|
|
355
|
+
its focus or error glow, box-shadows on the box, stand on its ground, a quarter circle in Chromium too (the squircle above would
|
|
356
|
+
square its shadows past the outline). A lone Input's control (its autofill fill, its scrollbar) is a quarter circle inside the
|
|
357
|
+
outline's edge: one as small as the fitted corner crosses the hairline where the bend starts, so its round part takes half the
|
|
358
|
+
smoothing more (--input-inner; the outline itself at Round). Where the box paints itself (--input-given, from --input-thick a
|
|
359
|
+
width: an underline, Full, a box's own round corner, the Input's own Round), both are its radius, as before. */
|
|
360
|
+
.o-input.o-smooth {
|
|
361
|
+
--input-fit: min(var(--input-r), var(--input-side) / (2 + 2 * var(--smooth-amount, 0.7))); --smooth-t: var(--input-fit); --smooth-side: var(--input-side);
|
|
362
|
+
--input-thick: var(--input-shown-thick, 0px); --input-sunk: var(--input-shown-sunk, none);
|
|
363
|
+
--input-given: clamp(0, tan(atan2(var(--input-thick) * 1000, 1px)), 1);
|
|
364
|
+
--input-box-r: calc(var(--smooth-t) + (var(--input-r) - var(--smooth-t)) * var(--input-given));
|
|
365
|
+
--input-inner: calc(var(--smooth-t) * (1 + var(--smooth-amount, 0.7) / 2) + (var(--input-r) - var(--smooth-t) * (1 + var(--smooth-amount, 0.7) / 2)) * var(--input-given));
|
|
366
|
+
position: relative; isolation: isolate; border-color: var(--input-shown-edge, transparent); background-color: var(--input-shown-ground, transparent);
|
|
367
|
+
corner-shape: round;
|
|
368
|
+
}
|
|
369
|
+
.o-input.o-smooth::before, .o-input.o-smooth::after {
|
|
370
|
+
content: var(--input-cut, ""); position: absolute; inset: calc(var(--vk-border-width) * -1); z-index: -1; pointer-events: none;
|
|
371
|
+
transition: background-color var(--vk-duration-fast) var(--vk-ease-out);
|
|
372
|
+
}
|
|
373
|
+
.o-input.o-smooth::before { border-radius: var(--input-fit); background-color: var(--input-ground); box-shadow: var(--input-inset); clip-path: shape(var(--smooth-outline)); }
|
|
374
|
+
.o-input.o-smooth::after {
|
|
375
|
+
--smooth-t: max(0px, var(--input-fit) - var(--input-edge-in)); --smooth-in: var(--input-edge-in);
|
|
376
|
+
background-color: var(--input-edge); clip-path: shape(var(--smooth-ring));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
@media (prefers-reduced-motion: reduce) { .o-input { transition: none; } .o-input.o-smooth::before, .o-input.o-smooth::after { transition: none; } }
|
|
381
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
/** An element, a ref to one, or a point on the page; null while nothing opens it. */
|
|
3
|
+
export type Anchor = Element | React.RefObject<Element | null> | {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
} | null;
|
|
7
|
+
type Measurable = {
|
|
8
|
+
getBoundingClientRect(): DOMRect;
|
|
9
|
+
};
|
|
10
|
+
export declare const isElement: (v: unknown) => v is Element;
|
|
11
|
+
export declare const atPoint: (x: number, y: number) => Measurable;
|
|
12
|
+
/** The anchor as Base UI's positioner takes it. */
|
|
13
|
+
export declare function positionerAnchor(anchor: Anchor | undefined): Element | Measurable | React.RefObject<Element | null> | null | undefined;
|
|
14
|
+
/** The element it stands for, when there is one: a point has none. */
|
|
15
|
+
export declare const anchorElement: (anchor: Anchor | undefined) => Element | null;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const isElement = (v) => typeof Element !== "undefined" && v instanceof Element;
|
|
2
|
+
export const atPoint = (x, y) => ({ getBoundingClientRect: () => ({ x, y, width: 0, height: 0, top: y, left: x, right: x, bottom: y, toJSON: () => ({ x, y }) }) });
|
|
3
|
+
export function positionerAnchor(anchor) {
|
|
4
|
+
if (anchor == null || isElement(anchor) || "current" in anchor)
|
|
5
|
+
return anchor;
|
|
6
|
+
return atPoint(anchor.x, anchor.y);
|
|
7
|
+
}
|
|
8
|
+
export const anchorElement = (anchor) => (anchor == null ? null : isElement(anchor) ? anchor : "current" in anchor ? anchor.current : null);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Why it opened or closed: a press on what opens it, a press outside it, Escape, focus leaving it, a row pressed in it,
|
|
2
|
+
* a Close in it, a drag that sent it away; any other is `none`. */
|
|
3
|
+
export type CloseReason = "trigger-press" | "outside-press" | "escape-key" | "focus-out" | "item-press" | "close-press" | "swipe" | "none";
|
|
4
|
+
/** Base UI's reason as one of the list's; one the list doesn't name is `none`. */
|
|
5
|
+
export declare const closeReasonOf: (reason: string | undefined) => CloseReason;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** The attribute that marks a popup host. */
|
|
3
|
+
export declare const POPUP_HOST = "data-popup-host";
|
|
4
|
+
/** The nearest element around `el` marked as a popup host; outside any, the page itself (undefined). */
|
|
5
|
+
export declare function popupHostOf(el: Element | null | undefined): HTMLElement | undefined;
|
|
6
|
+
/** The popup host around `ref` (popupHostOf), read once it is on the page. */
|
|
7
|
+
export declare function usePopupHost(ref: React.RefObject<Element | null>): HTMLElement | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export const POPUP_HOST = "data-popup-host";
|
|
3
|
+
export function popupHostOf(el) {
|
|
4
|
+
return el?.closest(`[${POPUP_HOST}]`) ?? undefined;
|
|
5
|
+
}
|
|
6
|
+
export function usePopupHost(ref) {
|
|
7
|
+
const [host, setHost] = React.useState(null);
|
|
8
|
+
React.useLayoutEffect(() => { setHost(popupHostOf(ref.current) ?? null); }, [ref]);
|
|
9
|
+
return host ?? undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The scale a length is drawn at: on screen over its own; 1 where they agree to within offset*'s rounding, or it has none. */
|
|
2
|
+
export declare const scaleOf: (onScreen: number, own: number) => number;
|
|
3
|
+
/** The scale an element is drawn at, read along its longer side, where offset*'s whole-pixel rounding weighs least. */
|
|
4
|
+
export declare function drawnAt(el: HTMLElement): number;
|
|
5
|
+
/** Whether a list `room` tall holding `content` scrolls. */
|
|
6
|
+
export declare const overflows: (room: number, content: number) => boolean;
|
|
7
|
+
/** Where a list's scrollTop goes when its bar, grabbed at scrollTop `start`, has moved `moved` along its track, `track` long,
|
|
8
|
+
* the bar `thumb` long: the rows move by the bar's share of the track, never past either end; a bar as long as its track
|
|
9
|
+
* moves nothing. */
|
|
10
|
+
export declare function scrollTopForDrag(start: number, moved: number, room: number, content: number, track: number, thumb: number): number;
|
|
11
|
+
export declare const typesInto: (el: EventTarget | null) => el is HTMLElement;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const scaleOf = (onScreen, own) => (own > 0 && onScreen > 0 && Math.abs(onScreen - own) > 0.5 ? onScreen / own : 1);
|
|
2
|
+
export function drawnAt(el) {
|
|
3
|
+
const r = el.getBoundingClientRect();
|
|
4
|
+
return el.offsetWidth >= el.offsetHeight ? scaleOf(r.width, el.offsetWidth) : scaleOf(r.height, el.offsetHeight);
|
|
5
|
+
}
|
|
6
|
+
export const overflows = (room, content) => content - room >= 1;
|
|
7
|
+
export function scrollTopForDrag(start, moved, room, content, track, thumb) {
|
|
8
|
+
const max = Math.max(0, content - room);
|
|
9
|
+
if (track <= thumb)
|
|
10
|
+
return start;
|
|
11
|
+
return Math.max(0, Math.min(max, start + (moved * max) / (track - thumb)));
|
|
12
|
+
}
|
|
13
|
+
const TYPED = new Set(["text", "search", "email", "number", "password", "tel", "url"]);
|
|
14
|
+
export const typesInto = (el) => el instanceof HTMLElement && (el.isContentEditable || el instanceof HTMLTextAreaElement || (el instanceof HTMLInputElement && TYPED.has(el.type)));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface KbdProps {
|
|
2
|
+
/** The keys, as printed on the keyboard: a letter or a digit ("N"), the Mac's symbols for modifiers
|
|
3
|
+
* (⌘ ⇧ ⌥ ⌃), words for named keys (Esc, Enter, Space, Tab, ↑ ↓ ← →). Never "Cmd" on a Mac. */
|
|
4
|
+
keys: string | string[];
|
|
5
|
+
/** One after the other ("G then D"), rather than pressed together. */
|
|
6
|
+
then?: boolean;
|
|
7
|
+
/** Windows and Linux write Ctrl, Shift and Alt for the Mac's symbols. */
|
|
8
|
+
platform?: "mac" | "windows";
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A key to press, drawn as a key: in a sentence of help, on a shortcuts sheet and in a tooltip. Keys pressed together sit
|
|
12
|
+
* side by side with no "+"; one after the other, "then" between them. Show a key only for a shortcut that works. */
|
|
13
|
+
export declare function Kbd({ keys, then, platform, className }: KbdProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cx } from "../../internal/cx.js";
|
|
4
|
+
const WORDS = { "⌘": "Ctrl", "⌃": "Ctrl", "⇧": "Shift", "⌥": "Alt" };
|
|
5
|
+
export function Kbd({ keys, then = false, platform = "mac", className }) {
|
|
6
|
+
const list = (Array.isArray(keys) ? keys : [keys]).map((k) => (platform === "windows" ? WORDS[k] ?? k : k));
|
|
7
|
+
if (list.length === 1)
|
|
8
|
+
return _jsx("kbd", { className: cx("o-kbd o-smooth o-smooth-ease", className), "data-kit": "kbd", children: list[0] });
|
|
9
|
+
return (_jsx("kbd", { className: cx("o-keys", className), "data-kit": "kbd", children: list.map((k, i) => (_jsxs(React.Fragment, { children: [then && i > 0 && _jsx("span", { className: "o-keys-then", children: "then" }), _jsx("kbd", { className: "o-kbd o-smooth o-smooth-ease", children: k })] }, i))) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const options = [
|
|
2
|
+
{ id: "smoothing", name: "Corner smoothing", def: "app", demo: false, values: [{ id: "app", name: "The app's" }, { id: "smooth", name: "Smooth" }, { id: "round", name: "Round" }] },
|
|
3
|
+
];
|
|
4
|
+
export const KBD_LOOKS = { id: "kbd", name: "Kbd", options, looks: [] };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const KBD_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-border-bold";
|
|
3
|
+
readonly kind: "colour";
|
|
4
|
+
readonly outright: "--border-bold";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-raised";
|
|
7
|
+
readonly kind: "colour";
|
|
8
|
+
readonly outright: "--surface-raised";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "--vk-fg-subtle";
|
|
11
|
+
readonly kind: "colour";
|
|
12
|
+
readonly outright: "--text-subtle";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "--vk-fg-subtlest";
|
|
15
|
+
readonly kind: "colour";
|
|
16
|
+
readonly outright: "--text-subtlest";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "--vk-border-width";
|
|
19
|
+
readonly kind: "size";
|
|
20
|
+
readonly outright: "--border-width";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "--vk-corner-smoothing";
|
|
23
|
+
readonly kind: "size";
|
|
24
|
+
readonly outright: "--corner-smoothing";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "--vk-font-sans";
|
|
27
|
+
readonly kind: "size";
|
|
28
|
+
readonly outright: "--font-sans";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "--vk-font-size-xs";
|
|
31
|
+
readonly kind: "size";
|
|
32
|
+
readonly outright: "--text-xs";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "--vk-font-weight-medium";
|
|
35
|
+
readonly kind: "size";
|
|
36
|
+
readonly outright: "--font-weight-medium";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "--vk-radius-sm";
|
|
39
|
+
readonly kind: "size";
|
|
40
|
+
readonly outright: "--radius-sm";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "--vk-spacing";
|
|
43
|
+
readonly kind: "size";
|
|
44
|
+
readonly outright: "--spacing";
|
|
45
|
+
}];
|
|
46
|
+
/** The prefix of the key's own machinery, set and read by it alone: not public. */
|
|
47
|
+
export declare const KBD_PRIVATE: readonly ["--kbd-"];
|