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,83 @@
|
|
|
1
|
+
export declare const POPOVER_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-border";
|
|
3
|
+
readonly kind: "colour";
|
|
4
|
+
readonly outright: "--border";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-overlay";
|
|
7
|
+
readonly kind: "colour";
|
|
8
|
+
readonly outright: "--surface-overlay";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "--vk-fg";
|
|
11
|
+
readonly kind: "colour";
|
|
12
|
+
readonly outright: "--text";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "--vk-border-subtle";
|
|
15
|
+
readonly kind: "colour";
|
|
16
|
+
readonly outright: "--border-subtle";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "--vk-fg-subtle";
|
|
19
|
+
readonly kind: "colour";
|
|
20
|
+
readonly outright: "--text-subtle";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "--vk-shadow-lg";
|
|
23
|
+
readonly kind: "shadow";
|
|
24
|
+
readonly outright: "--shadow-lg";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "--vk-shadow-md";
|
|
27
|
+
readonly kind: "shadow";
|
|
28
|
+
readonly outright: "--shadow-md";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "--vk-shadow-xl";
|
|
31
|
+
readonly kind: "shadow";
|
|
32
|
+
readonly outright: "--shadow-xl";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "--vk-layer-popup";
|
|
35
|
+
readonly kind: "size";
|
|
36
|
+
readonly outright: "--layer-popup";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "--vk-radius-xl";
|
|
39
|
+
readonly kind: "size";
|
|
40
|
+
readonly outright: "--radius-xl";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "--vk-spacing";
|
|
43
|
+
readonly kind: "size";
|
|
44
|
+
readonly outright: "--spacing";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "--vk-border-width";
|
|
47
|
+
readonly kind: "size";
|
|
48
|
+
readonly outright: "--border-width";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "--vk-font-size-sm";
|
|
51
|
+
readonly kind: "size";
|
|
52
|
+
readonly outright: "--text-sm";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "--vk-line-height-sm";
|
|
55
|
+
readonly kind: "size";
|
|
56
|
+
readonly outright: "--text-sm--line-height";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "--vk-radius-lg";
|
|
59
|
+
readonly kind: "size";
|
|
60
|
+
readonly outright: "--radius-lg";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "--vk-radius-2xl";
|
|
63
|
+
readonly kind: "size";
|
|
64
|
+
readonly outright: "--radius-2xl";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "--vk-font-weight-medium";
|
|
67
|
+
readonly kind: "size";
|
|
68
|
+
readonly outright: "--font-weight-medium";
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "--vk-duration-fast";
|
|
71
|
+
readonly kind: "motion";
|
|
72
|
+
readonly outright: "--duration-fast";
|
|
73
|
+
}, {
|
|
74
|
+
readonly name: "--vk-ease-out";
|
|
75
|
+
readonly kind: "motion";
|
|
76
|
+
readonly outright: "--ease-out";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "--vk-ease-in";
|
|
79
|
+
readonly kind: "motion";
|
|
80
|
+
readonly outright: "--ease-in";
|
|
81
|
+
}];
|
|
82
|
+
/** The prefixes of its own machinery, set and read by it alone: not public. */
|
|
83
|
+
export declare const POPOVER_PRIVATE: readonly ["--popover-", "--divider-", "--anchor-", "--available-"];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const POPOVER_TOKENS = [
|
|
2
|
+
{ name: "--vk-border", kind: "colour", outright: "--border" },
|
|
3
|
+
{ name: "--vk-overlay", kind: "colour", outright: "--surface-overlay" },
|
|
4
|
+
{ name: "--vk-fg", kind: "colour", outright: "--text" },
|
|
5
|
+
{ name: "--vk-border-subtle", kind: "colour", outright: "--border-subtle" },
|
|
6
|
+
{ name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
|
|
7
|
+
{ name: "--vk-shadow-lg", kind: "shadow", outright: "--shadow-lg" },
|
|
8
|
+
{ name: "--vk-shadow-md", kind: "shadow", outright: "--shadow-md" },
|
|
9
|
+
{ name: "--vk-shadow-xl", kind: "shadow", outright: "--shadow-xl" },
|
|
10
|
+
{ name: "--vk-layer-popup", kind: "size", outright: "--layer-popup" },
|
|
11
|
+
{ name: "--vk-radius-xl", kind: "size", outright: "--radius-xl" },
|
|
12
|
+
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
13
|
+
{ name: "--vk-border-width", kind: "size", outright: "--border-width" },
|
|
14
|
+
{ name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
|
|
15
|
+
{ name: "--vk-line-height-sm", kind: "size", outright: "--text-sm--line-height" },
|
|
16
|
+
{ name: "--vk-radius-lg", kind: "size", outright: "--radius-lg" },
|
|
17
|
+
{ name: "--vk-radius-2xl", kind: "size", outright: "--radius-2xl" },
|
|
18
|
+
{ name: "--vk-font-weight-medium", kind: "size", outright: "--font-weight-medium" },
|
|
19
|
+
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
20
|
+
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
21
|
+
{ name: "--vk-ease-in", kind: "motion", outright: "--ease-in" },
|
|
22
|
+
];
|
|
23
|
+
export const POPOVER_PRIVATE = ["--popover-", "--divider-", "--anchor-", "--available-"];
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* The Popover: a shell. Every value it draws with is a public name (controls/popover/tokens.ts); this file only says which
|
|
2
|
+
name each part takes. Base UI marks the panel data-open, data-starting-style and data-ending-style as it comes and goes,
|
|
3
|
+
data-side where it stands, and gives the room it has as --available-width and --available-height, and what it opened
|
|
4
|
+
from's width as --anchor-width. What an app sets once is a data attribute on the frame around it (looks.ts):
|
|
5
|
+
|
|
6
|
+
data-popover-corners lg · xl · 2xl which radius it takes
|
|
7
|
+
data-popover-smoothing round · smooth how its corners bend
|
|
8
|
+
data-popover-shadow none · md · lg · xl its shadow
|
|
9
|
+
data-popover-edge outline · subtle · none one clear edge, a quieter one, or none; the lines inside it
|
|
10
|
+
(--divider-colour) wear its colour, the subtle border with none, and
|
|
11
|
+
reach past what it holds by --divider-reach, to its edge, inside it
|
|
12
|
+
data-popover-padding 0 · 4 · 8 · 12 · 16 how far what it holds stands from its edge
|
|
13
|
+
data-popover-gap 0 · 4 · 8 how far it stands from what opened it (none laid over it)
|
|
14
|
+
|
|
15
|
+
The rules sit in the components layer, so a utility class on it still wins. */
|
|
16
|
+
@layer components {
|
|
17
|
+
|
|
18
|
+
/* ── Where it stands: on the popup layer, over the Modal, the drawer and the sheet; one opened later stands
|
|
19
|
+
over the one it opened from, being later on the page ─────────────────────────────────────────────────────────── */
|
|
20
|
+
.o-popover-positioner { z-index: var(--vk-layer-popup); outline: none; }
|
|
21
|
+
/* What opened it has scrolled fully out of view: it closes (popover/popover.tsx), and goes at once, so no exit plays over nothing. */
|
|
22
|
+
.o-popover-positioner[data-anchor-hidden] { visibility: hidden; }
|
|
23
|
+
|
|
24
|
+
/* ── The shell: the overlay's ground, corners and a shadow; 288 wide unless it is handed a width, as shadcn's, and at
|
|
25
|
+
least as wide as what opened it. Its edge and what it holds are inside it (.o-popover-cut) ─────────────────── */
|
|
26
|
+
.o-popover {
|
|
27
|
+
--popover-corners: var(--vk-radius-xl); --popover-shadow: var(--vk-shadow-md); --popover-pad: calc(var(--vk-spacing) * 2);
|
|
28
|
+
--popover-gap: var(--vk-spacing); --popover-edge: var(--vk-border); --divider-colour: var(--vk-border);
|
|
29
|
+
--divider-reach: max(0px, calc(var(--popover-pad) - var(--vk-border-width)));
|
|
30
|
+
box-sizing: border-box; display: flex; flex-direction: column;
|
|
31
|
+
width: calc(var(--vk-spacing) * 72); min-width: var(--anchor-width, auto); max-width: var(--available-width, 100%); max-height: var(--available-height, none);
|
|
32
|
+
border-radius: var(--popover-corners); background-color: var(--vk-overlay); box-shadow: var(--popover-shadow); color: var(--vk-fg);
|
|
33
|
+
font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); outline: none;
|
|
34
|
+
transition: opacity var(--vk-duration-fast) var(--vk-ease-out), translate var(--vk-duration-fast) var(--vk-ease-out);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* What it holds, inside its edge, scrolling there when the screen is shorter. The edge is drawn as two shapes, never a
|
|
38
|
+
border, as the Modal's is: its colour (::before), and the ground just inside it (::after), one line narrower. Each
|
|
39
|
+
takes its own corner, its inset less, so the edge follows the corners exactly, round or smooth. */
|
|
40
|
+
.o-popover-cut { position: relative; isolation: isolate; box-sizing: border-box; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--popover-pad); border-radius: inherit; }
|
|
41
|
+
.o-popover-cut::before, .o-popover-cut::after { content: ""; position: absolute; z-index: -1; border-radius: var(--popover-c); pointer-events: none; }
|
|
42
|
+
.o-popover-cut::before { --popover-c: var(--popover-corners); inset: 0; background-color: var(--popover-edge); }
|
|
43
|
+
.o-popover-cut::after { --popover-c: calc(var(--popover-corners) - var(--vk-border-width)); inset: var(--vk-border-width); background-color: var(--vk-overlay); }
|
|
44
|
+
|
|
45
|
+
/* The gap, on the side it stands on. */
|
|
46
|
+
.o-popover[data-side="bottom"] { margin-top: var(--popover-gap); }
|
|
47
|
+
.o-popover[data-side="top"] { margin-bottom: var(--popover-gap); }
|
|
48
|
+
.o-popover[data-side="left"] { margin-right: var(--popover-gap); }
|
|
49
|
+
.o-popover[data-side="right"] { margin-left: var(--popover-gap); }
|
|
50
|
+
/* Laid over what opens it (a negative sideOffset), it stands on it: no gap. */
|
|
51
|
+
.o-popover[data-over] { margin: 0; }
|
|
52
|
+
|
|
53
|
+
/* It fades in and moves 4px out from what opened it; it leaves faster than it came. */
|
|
54
|
+
.o-popover[data-ending-style] { transition-timing-function: var(--vk-ease-in); }
|
|
55
|
+
.o-popover:is([data-starting-style], [data-ending-style]) { opacity: 0; translate: 0 calc(var(--vk-spacing) * -1); }
|
|
56
|
+
.o-popover[data-side="top"]:is([data-starting-style], [data-ending-style]) { translate: 0 var(--vk-spacing); }
|
|
57
|
+
.o-popover[data-side="left"]:is([data-starting-style], [data-ending-style]) { translate: var(--vk-spacing) 0; }
|
|
58
|
+
.o-popover[data-side="right"]:is([data-starting-style], [data-ending-style]) { translate: calc(var(--vk-spacing) * -1) 0; }
|
|
59
|
+
|
|
60
|
+
/* ── What an app sets once ───────────────────────────────────────────────────────────────────────────────────── */
|
|
61
|
+
[data-popover-corners="lg"] .o-popover { --popover-corners: var(--vk-radius-lg); }
|
|
62
|
+
[data-popover-corners="2xl"] .o-popover { --popover-corners: var(--vk-radius-2xl); }
|
|
63
|
+
[data-popover-shadow="none"] .o-popover { --popover-shadow: none; }
|
|
64
|
+
[data-popover-shadow="lg"] .o-popover { --popover-shadow: var(--vk-shadow-lg); }
|
|
65
|
+
[data-popover-shadow="xl"] .o-popover { --popover-shadow: var(--vk-shadow-xl); }
|
|
66
|
+
[data-popover-edge="subtle"] .o-popover { --popover-edge: var(--vk-border-subtle); --divider-colour: var(--vk-border-subtle); }
|
|
67
|
+
[data-popover-edge="none"] .o-popover { --popover-edge: var(--vk-overlay); --divider-colour: var(--vk-border-subtle); }
|
|
68
|
+
[data-popover-padding="0"] .o-popover { --popover-pad: 0px; }
|
|
69
|
+
[data-popover-padding="4"] .o-popover { --popover-pad: var(--vk-spacing); }
|
|
70
|
+
[data-popover-padding="12"] .o-popover { --popover-pad: calc(var(--vk-spacing) * 3); }
|
|
71
|
+
[data-popover-padding="16"] .o-popover { --popover-pad: calc(var(--vk-spacing) * 4); }
|
|
72
|
+
[data-popover-gap="0"] .o-popover { --popover-gap: 0px; }
|
|
73
|
+
[data-popover-gap="8"] .o-popover { --popover-gap: calc(var(--vk-spacing) * 2); }
|
|
74
|
+
|
|
75
|
+
/* ── Its corners smooth: the smooth outline (smooth.css), Apple's curve as measured, so every browser that knows
|
|
76
|
+
shape() shows it; one that doesn't keeps the corners above. The shell keeps its shadow, which a cut would take with
|
|
77
|
+
it, so .o-popover-cut inside it is cut instead, and the edge's two shapes each by the same outline at its own corner,
|
|
78
|
+
so the edge stays the corners' curve ─────────────────────────────────────────────────────────────────────────── */
|
|
79
|
+
@supports (clip-path: shape(from 0 0, curve by 1px 1px with 1px 0 / 1px 0, close)) {
|
|
80
|
+
[data-popover-smoothing="smooth"] .o-popover { background-color: transparent; }
|
|
81
|
+
[data-popover-smoothing="smooth"] .o-popover-cut { --popover-c: var(--popover-corners); background-color: var(--vk-overlay); }
|
|
82
|
+
[data-popover-smoothing="smooth"] .o-popover-cut::before, [data-popover-smoothing="smooth"] .o-popover-cut::after { border-radius: 0; }
|
|
83
|
+
[data-popover-smoothing="smooth"] .o-popover-cut, [data-popover-smoothing="smooth"] .o-popover-cut::before, [data-popover-smoothing="smooth"] .o-popover-cut::after {
|
|
84
|
+
--smooth-t: var(--popover-c); clip-path: shape(var(--smooth-outline));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* ── Its title and what it says, when it has them: the title text-sm at medium weight, the words quieter ──────── */
|
|
89
|
+
.o-popover-title { margin: 0; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); font-weight: var(--vk-font-weight-medium); color: var(--vk-fg); }
|
|
90
|
+
.o-popover-description { margin: 0; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); color: var(--vk-fg-subtle); }
|
|
91
|
+
|
|
92
|
+
/* Under reduced motion it just appears. */
|
|
93
|
+
@media (prefers-reduced-motion: reduce) { .o-popover { transition: none; } }
|
|
94
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The scrollbar: placed as the very next sibling of the element that scrolls
|
|
2
|
+
* (`<div className="body">…</div><Scrollbar />`), which stays as it is. It marks that element `data-scrollbar` (no sideways
|
|
3
|
+
* scroll). By default it draws no bar at all: a panel over a list (the Popover, the Sheet's body, a menu's panel) scrolls with
|
|
4
|
+
* no bar, the browser's hidden on every screen, a touch screen's too where the browser lets it be. `drawn` (a body that holds
|
|
5
|
+
* a whole page) asks for this bar: drawn over the element's right edge only while it scrolls, held while the pointer is on
|
|
6
|
+
* it, dragged to scroll; on a touch screen the phone's own bar stays there. An element that is no scroll container
|
|
7
|
+
* (overflow-y visible or clip) is left alone; one hidden at one stop and auto at another (the Sheet's body) is marked. */
|
|
8
|
+
export declare function Scrollbar({ drawn }: {
|
|
9
|
+
drawn?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { drawnAt, overflows, scrollTopForDrag } from "../internal/scroll.js";
|
|
4
|
+
export function Scrollbar({ drawn = false }) {
|
|
5
|
+
const ref = React.useRef(null);
|
|
6
|
+
React.useLayoutEffect(() => {
|
|
7
|
+
const bar = ref.current, list = bar?.previousElementSibling;
|
|
8
|
+
if (!bar || !list || !/^(auto|scroll|hidden)$/.test(getComputedStyle(list).overflowY))
|
|
9
|
+
return;
|
|
10
|
+
list.setAttribute("data-scrollbar", "");
|
|
11
|
+
const unmark = () => list.removeAttribute("data-scrollbar");
|
|
12
|
+
const win = list.ownerDocument.defaultView;
|
|
13
|
+
if (!drawn || !win?.matchMedia("(hover: hover) and (pointer: fine)").matches)
|
|
14
|
+
return unmark;
|
|
15
|
+
const own = getComputedStyle(bar);
|
|
16
|
+
const time = own.getPropertyValue("--sb-hold").trim(), inset = parseFloat(own.getPropertyValue("--sb-inset")) || 0;
|
|
17
|
+
const hold = parseFloat(time) * (/\ds$/.test(time) ? 1000 : 1) || 1000;
|
|
18
|
+
let timer = 0, over = false, ends = [inset, inset], drag = null;
|
|
19
|
+
const corner = (el, v) => { const r = v.split(" ").pop() ?? "0"; return r.endsWith("%") ? (parseFloat(r) / 100) * el.offsetHeight : parseFloat(r) || 0; };
|
|
20
|
+
const readEnds = () => {
|
|
21
|
+
const s = getComputedStyle(list), box = list.getBoundingClientRect(), k = drawnAt(list);
|
|
22
|
+
let t = Math.max(inset, corner(list, s.borderTopRightRadius)), b = Math.max(inset, corner(list, s.borderBottomRightRadius));
|
|
23
|
+
for (let up = list.parentElement, n = 0; up && n < 4; up = up.parentElement, n++) {
|
|
24
|
+
const q = up.getBoundingClientRect(), u = getComputedStyle(up), rt = corner(up, u.borderTopRightRadius), rb = corner(up, u.borderBottomRightRadius);
|
|
25
|
+
if (Math.abs(q.top - box.top) <= 1 && (q.right - box.right) / k < rt)
|
|
26
|
+
t = Math.max(t, rt);
|
|
27
|
+
if (Math.abs(q.bottom - box.bottom) <= 1 && (q.right - box.right) / k < rb)
|
|
28
|
+
b = Math.max(b, rb);
|
|
29
|
+
}
|
|
30
|
+
const head = list.previousElementSibling?.getBoundingClientRect();
|
|
31
|
+
if (head && head.top <= box.top + 0.5 && head.bottom > box.top + 0.5)
|
|
32
|
+
t = Math.max(t, (head.bottom - box.top) / k + inset);
|
|
33
|
+
ends = [t, b];
|
|
34
|
+
};
|
|
35
|
+
const place = () => {
|
|
36
|
+
const [t, b] = ends, max = list.scrollHeight - list.clientHeight;
|
|
37
|
+
const set = (k, v) => bar.style.setProperty(k, v);
|
|
38
|
+
set("--sb-top", `${list.offsetTop + list.clientTop}px`);
|
|
39
|
+
set("--sb-right", `${list.offsetLeft + list.clientLeft + list.clientWidth}px`);
|
|
40
|
+
set("--sb-track", `${list.clientHeight}px`);
|
|
41
|
+
set("--sb-end-t", `${t}px`);
|
|
42
|
+
set("--sb-end-b", `${b}px`);
|
|
43
|
+
set("--sb-len", String(list.clientHeight / list.scrollHeight));
|
|
44
|
+
set("--sb-at", String(max > 0 ? list.scrollTop / max : 0));
|
|
45
|
+
};
|
|
46
|
+
const hide = () => { if (!over && !drag)
|
|
47
|
+
bar.removeAttribute("data-scrolling"); };
|
|
48
|
+
const later = () => { win.clearTimeout(timer); timer = win.setTimeout(hide, hold); };
|
|
49
|
+
const show = () => {
|
|
50
|
+
if (!overflows(list.clientHeight, list.scrollHeight)) {
|
|
51
|
+
bar.removeAttribute("data-scrolling");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!bar.hasAttribute("data-scrolling"))
|
|
55
|
+
readEnds();
|
|
56
|
+
place();
|
|
57
|
+
bar.setAttribute("data-scrolling", "");
|
|
58
|
+
later();
|
|
59
|
+
};
|
|
60
|
+
const resized = () => {
|
|
61
|
+
if (!bar.hasAttribute("data-scrolling"))
|
|
62
|
+
return;
|
|
63
|
+
if (overflows(list.clientHeight, list.scrollHeight)) {
|
|
64
|
+
readEnds();
|
|
65
|
+
place();
|
|
66
|
+
}
|
|
67
|
+
else
|
|
68
|
+
bar.removeAttribute("data-scrolling");
|
|
69
|
+
};
|
|
70
|
+
const enter = () => { over = true; };
|
|
71
|
+
const leave = () => { over = false; later(); };
|
|
72
|
+
const down = (e) => {
|
|
73
|
+
if (e.button !== 0 || !bar.hasAttribute("data-scrolling"))
|
|
74
|
+
return;
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
e.stopPropagation();
|
|
77
|
+
const [t, b] = ends;
|
|
78
|
+
drag = { start: list.scrollTop, y: e.clientY, track: list.clientHeight - t - b, thumb: bar.offsetHeight, id: e.pointerId };
|
|
79
|
+
bar.setPointerCapture(e.pointerId);
|
|
80
|
+
bar.setAttribute("data-dragging", "");
|
|
81
|
+
};
|
|
82
|
+
const move = (e) => {
|
|
83
|
+
if (!drag || e.pointerId !== drag.id)
|
|
84
|
+
return;
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
list.scrollTop = scrollTopForDrag(drag.start, (e.clientY - drag.y) / drawnAt(list), list.clientHeight, list.scrollHeight, drag.track, drag.thumb);
|
|
87
|
+
};
|
|
88
|
+
const up = (e) => {
|
|
89
|
+
if (!drag || e.pointerId !== drag.id)
|
|
90
|
+
return;
|
|
91
|
+
drag = null;
|
|
92
|
+
bar.removeAttribute("data-dragging");
|
|
93
|
+
if (bar.hasPointerCapture(e.pointerId))
|
|
94
|
+
bar.releasePointerCapture(e.pointerId);
|
|
95
|
+
later();
|
|
96
|
+
};
|
|
97
|
+
const quiet = (e) => { if (bar.hasAttribute("data-scrolling")) {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
if (e.type === "mousedown")
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
} };
|
|
102
|
+
const wheel = (e) => {
|
|
103
|
+
if (e.ctrlKey)
|
|
104
|
+
return;
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
const line = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? list.clientHeight : 1;
|
|
107
|
+
list.scrollBy({ top: e.deltaY * line });
|
|
108
|
+
};
|
|
109
|
+
list.addEventListener("scroll", show, { passive: true });
|
|
110
|
+
bar.addEventListener("pointerenter", enter);
|
|
111
|
+
bar.addEventListener("pointerleave", leave);
|
|
112
|
+
bar.addEventListener("pointerdown", down);
|
|
113
|
+
bar.addEventListener("pointermove", move);
|
|
114
|
+
bar.addEventListener("pointerup", up);
|
|
115
|
+
bar.addEventListener("pointercancel", up);
|
|
116
|
+
bar.addEventListener("lostpointercapture", up);
|
|
117
|
+
bar.addEventListener("mousedown", quiet);
|
|
118
|
+
bar.addEventListener("click", quiet);
|
|
119
|
+
bar.addEventListener("wheel", wheel, { passive: false });
|
|
120
|
+
const seen = new ResizeObserver(resized);
|
|
121
|
+
seen.observe(list);
|
|
122
|
+
const held = new MutationObserver(resized);
|
|
123
|
+
held.observe(list, { childList: true, subtree: true });
|
|
124
|
+
return () => {
|
|
125
|
+
win.clearTimeout(timer);
|
|
126
|
+
seen.disconnect();
|
|
127
|
+
held.disconnect();
|
|
128
|
+
list.removeEventListener("scroll", show);
|
|
129
|
+
bar.removeEventListener("pointerenter", enter);
|
|
130
|
+
bar.removeEventListener("pointerleave", leave);
|
|
131
|
+
bar.removeEventListener("pointerdown", down);
|
|
132
|
+
bar.removeEventListener("pointermove", move);
|
|
133
|
+
bar.removeEventListener("pointerup", up);
|
|
134
|
+
bar.removeEventListener("pointercancel", up);
|
|
135
|
+
bar.removeEventListener("lostpointercapture", up);
|
|
136
|
+
bar.removeEventListener("mousedown", quiet);
|
|
137
|
+
bar.removeEventListener("click", quiet);
|
|
138
|
+
bar.removeEventListener("wheel", wheel);
|
|
139
|
+
unmark();
|
|
140
|
+
};
|
|
141
|
+
}, [drawn]);
|
|
142
|
+
return _jsx("div", { ref: ref, className: "o-scrollbar", "data-drawn": drawn ? "" : undefined, "aria-hidden": "true" });
|
|
143
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const SCROLLBAR_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-duration-fast";
|
|
3
|
+
readonly kind: "motion";
|
|
4
|
+
readonly outright: "--duration-fast";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-duration-slow";
|
|
7
|
+
readonly kind: "motion";
|
|
8
|
+
readonly outright: "--duration-slow";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "--vk-ease-out";
|
|
11
|
+
readonly kind: "motion";
|
|
12
|
+
readonly outright: "--ease-out";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "--vk-radius-full";
|
|
15
|
+
readonly kind: "size";
|
|
16
|
+
readonly outright: "--radius-full";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "--vk-spacing";
|
|
19
|
+
readonly kind: "size";
|
|
20
|
+
readonly outright: "--spacing";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "--vk-scrollbar-size";
|
|
23
|
+
readonly kind: "size";
|
|
24
|
+
readonly outright: "--scrollbar-size";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "--vk-scrollbar-inset";
|
|
27
|
+
readonly kind: "size";
|
|
28
|
+
readonly outright: "--scrollbar-inset";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "--vk-scrollbar-thumb";
|
|
31
|
+
readonly kind: "colour";
|
|
32
|
+
readonly outright: "--scrollbar-thumb";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "--vk-scrollbar-thumb-hovered";
|
|
35
|
+
readonly kind: "colour";
|
|
36
|
+
readonly outright: "--scrollbar-thumb-hovered";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "--vk-scrollbar-hold";
|
|
39
|
+
readonly kind: "motion";
|
|
40
|
+
readonly outright: "--scrollbar-hold";
|
|
41
|
+
}];
|
|
42
|
+
/** The prefix of the scrollbar's own machinery, set and read by it alone: not public. */
|
|
43
|
+
export declare const SCROLLBAR_PRIVATE: readonly ["--sb-"];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const SCROLLBAR_TOKENS = [
|
|
2
|
+
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
3
|
+
{ name: "--vk-duration-slow", kind: "motion", outright: "--duration-slow" },
|
|
4
|
+
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
5
|
+
{ name: "--vk-radius-full", kind: "size", outright: "--radius-full" },
|
|
6
|
+
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
7
|
+
{ name: "--vk-scrollbar-size", kind: "size", outright: "--scrollbar-size" },
|
|
8
|
+
{ name: "--vk-scrollbar-inset", kind: "size", outright: "--scrollbar-inset" },
|
|
9
|
+
{ name: "--vk-scrollbar-thumb", kind: "colour", outright: "--scrollbar-thumb" },
|
|
10
|
+
{ name: "--vk-scrollbar-thumb-hovered", kind: "colour", outright: "--scrollbar-thumb-hovered" },
|
|
11
|
+
{ name: "--vk-scrollbar-hold", kind: "motion", outright: "--scrollbar-hold" },
|
|
12
|
+
];
|
|
13
|
+
export const SCROLLBAR_PRIVATE = ["--sb-"];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* The Scrollbar (controls/scrollbar/scrollbar.tsx), standing right after what scrolls and marking it data-scrollbar. What
|
|
2
|
+
scrolls scrolls only up and down: a press area poking past its edge never makes it scroll sideways. By default no bar shows
|
|
3
|
+
(a panel over a list): the browser's is hidden on every screen, a touch screen's too where the browser lets it be, and this
|
|
4
|
+
draws nothing. Drawn (data-drawn: a body holding a whole page), on a computer the browser's bar is gone, so it takes no
|
|
5
|
+
room, and this one is drawn over it only while it scrolls, fading once it stops; under the pointer and while it is dragged
|
|
6
|
+
it darkens. On a touch screen the phone's own bar stays there, already floating, and this draws nothing.
|
|
7
|
+
|
|
8
|
+
It is placed from what the script writes, each in the list's own pixels: --sb-top and --sb-right, where the list stands in
|
|
9
|
+
what both stand in; --sb-track, its height; --sb-end-t and --sb-end-b, how far the bar keeps from its ends; and the shares
|
|
10
|
+
--sb-len (how much of the list shows) and --sb-at (how far it is scrolled). --sb-hold and --sb-inset hand the script how
|
|
11
|
+
long it stays and how far it keeps from its ends.
|
|
12
|
+
|
|
13
|
+
The rules sit in the components layer, so a utility class still wins. */
|
|
14
|
+
@layer components {
|
|
15
|
+
|
|
16
|
+
/* Doubled, so a component's own overflow: auto in the same layer never brings the sideways scroll back. */
|
|
17
|
+
[data-scrollbar][data-scrollbar] { overflow-x: hidden; }
|
|
18
|
+
|
|
19
|
+
.o-scrollbar { display: none; --sb-hold: var(--vk-scrollbar-hold); --sb-inset: var(--vk-scrollbar-inset); }
|
|
20
|
+
|
|
21
|
+
/* The browser's bar hidden from the first style, read by what stands right before the bar, not by the mark the script sets: WebKit
|
|
22
|
+
never lays out again what a list holds when its bar goes after the first layout, so a mark set then left the rows 15 short. With
|
|
23
|
+
no bar, on every screen; drawn, on a computer only. */
|
|
24
|
+
:has(+ .o-scrollbar:not([data-drawn])) { scrollbar-width: none; }
|
|
25
|
+
:has(+ .o-scrollbar:not([data-drawn]))::-webkit-scrollbar { display: none; }
|
|
26
|
+
|
|
27
|
+
@media (hover: hover) and (pointer: fine) {
|
|
28
|
+
:has(+ .o-scrollbar[data-drawn]) { scrollbar-width: none; }
|
|
29
|
+
:has(+ .o-scrollbar[data-drawn])::-webkit-scrollbar { display: none; }
|
|
30
|
+
|
|
31
|
+
.o-scrollbar[data-drawn] {
|
|
32
|
+
--sb-in: calc(var(--sb-track, 0px) - var(--sb-end-t, 0px) - var(--sb-end-b, 0px));
|
|
33
|
+
--sb-h: max(calc(var(--vk-spacing) * 6), calc(var(--sb-in) * var(--sb-len, 1)));
|
|
34
|
+
display: block; position: absolute; z-index: 1; box-sizing: border-box;
|
|
35
|
+
top: calc(var(--sb-top, 0px) + var(--sb-end-t, 0px)); left: calc(var(--sb-right, 0px) - var(--vk-scrollbar-size) - var(--vk-scrollbar-inset));
|
|
36
|
+
width: var(--vk-scrollbar-size); height: var(--sb-h); translate: 0 calc((var(--sb-in) - var(--sb-h)) * var(--sb-at, 0));
|
|
37
|
+
border-radius: var(--vk-radius-full); background-color: var(--vk-scrollbar-thumb);
|
|
38
|
+
opacity: 0; pointer-events: none; touch-action: none;
|
|
39
|
+
transition: opacity var(--vk-duration-slow) var(--vk-ease-out), background-color var(--vk-duration-fast) var(--vk-ease-out);
|
|
40
|
+
}
|
|
41
|
+
.o-scrollbar[data-scrolling] { opacity: 1; pointer-events: auto; transition-duration: var(--vk-duration-fast); }
|
|
42
|
+
.o-scrollbar:is(:hover, [data-dragging]) { background-color: var(--vk-scrollbar-thumb-hovered); }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (prefers-reduced-motion: reduce) { .o-scrollbar { transition: none; } }
|
|
46
|
+
|
|
47
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type CloseReason } from "../internal/close-reason.js";
|
|
3
|
+
import { type SheetForm, type SheetStop } from "./forms.js";
|
|
4
|
+
export type { SheetForm, SheetStop } from "./forms.js";
|
|
5
|
+
/** Closes every sheet open under this one and this one: a choice that finishes the job. A drag, the dim or Back close
|
|
6
|
+
* only the top one. */
|
|
7
|
+
export declare const useSheetCloseAll: () => (() => void) | null;
|
|
8
|
+
/** A close that is a button of its own: a head's Cancel. */
|
|
9
|
+
export declare const SheetClose: ({ children }: {
|
|
10
|
+
children: React.ReactElement;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export interface SheetHeadProps {
|
|
13
|
+
/** What it is. */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Where its title stands, which each sheet chooses: centred, or at the left. */
|
|
16
|
+
titleAt?: "center" | "left";
|
|
17
|
+
/** A second line under the title, quieter. */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** The X. Left off, the sheet closes by a drag or the dim. */
|
|
20
|
+
close?: boolean;
|
|
21
|
+
/** Back: to the step before, or out of the sheet. In Glass it takes the X's place, and the sheet closes by a drag or the dim. */
|
|
22
|
+
onBack?: () => void;
|
|
23
|
+
/** Buttons left and right of the title, in place of Back and the close. Left, usually a SheetClose. */
|
|
24
|
+
left?: React.ReactNode;
|
|
25
|
+
right?: React.ReactNode;
|
|
26
|
+
/** What stands on its right: a ⋯, or two SheetButtons. */
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/** A button in its head. Its head is an option on the frame around it, which only sheet.css reads, so both are drawn and it
|
|
30
|
+
* shows one: under Glass the Glass button, under Flat a quiet Button. Primary, for what confirms, is primary in both. It holds
|
|
31
|
+
* an icon, or a word (a head's Cancel): the Glass button with its word under Glass, a quiet Button with it under Flat. */
|
|
32
|
+
export declare function SheetButton({ className, kind, children, ...props }: {
|
|
33
|
+
"aria-label"?: string;
|
|
34
|
+
icon?: React.ReactNode;
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
onClick?: () => void;
|
|
37
|
+
className?: string;
|
|
38
|
+
kind?: "primary";
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
/** Its head, one of its kinds: the one header (HeaderBar), under its handle. Glass has on its left the X, or Back in its place, and on its right one action, or two, as the phone header's Two buttons says.
|
|
42
|
+
* Flat has Back on its left, if there is one, and its action and the X on its right. Or Decide, a button either side of its
|
|
43
|
+
* title. A sheet with no head is its handle alone. */
|
|
44
|
+
export declare function SheetHead({ title, titleAt, description, close, onBack, left, right, children }: SheetHeadProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
/** Its foot: stays at the foot of the screen at every stop, and leaves with the sheet. */
|
|
46
|
+
export declare const SheetFoot: ({ children }: {
|
|
47
|
+
children: React.ReactNode;
|
|
48
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
/** What scrolls under the head. At a lower stop it doesn't: a drag raises the sheet, and a wheel or focus under the fold
|
|
50
|
+
* takes it to full. */
|
|
51
|
+
export declare const SheetBody: React.ForwardRefExoticComponent<{
|
|
52
|
+
onScroll?: () => void;
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
55
|
+
/** One step of a sheet, floating or full: a row opens the next in its place, with Back, and a floating sheet resizes to it. A step
|
|
56
|
+
* that replaces another starts at its top and takes the focus itself, so what was pressed leaving takes it nowhere; the first step
|
|
57
|
+
* does neither. It slides in without the body scrolling sideways (sheet.css). */
|
|
58
|
+
export declare function SheetStep({ step, back, children }: {
|
|
59
|
+
step: string;
|
|
60
|
+
back?: boolean;
|
|
61
|
+
children: React.ReactNode;
|
|
62
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
/** Why it closed: a drag, its dim, Escape, its X, a choice that finishes the job. */
|
|
64
|
+
export interface SheetChangeDetails {
|
|
65
|
+
reason: CloseReason;
|
|
66
|
+
}
|
|
67
|
+
export interface SheetProps {
|
|
68
|
+
open: boolean;
|
|
69
|
+
/** It opens or closes, and why: the second argument is there for whoever reads it, and nothing has to. */
|
|
70
|
+
onOpenChange: (open: boolean, details: SheetChangeDetails) => void;
|
|
71
|
+
/** Once it has finished coming or going. */
|
|
72
|
+
onOpenChangeComplete?: (open: boolean) => void;
|
|
73
|
+
/** Its name to screen readers. */
|
|
74
|
+
label: string;
|
|
75
|
+
/** How it looks. */
|
|
76
|
+
form?: SheetForm;
|
|
77
|
+
/** The stops it may rest at, lowest first. Left out, its form's. */
|
|
78
|
+
stops?: SheetStop[];
|
|
79
|
+
/** The stop it opens at. Left out, the lowest. */
|
|
80
|
+
openAt?: SheetStop;
|
|
81
|
+
/** The stop it is at, to move it from code, with onStopChange. */
|
|
82
|
+
stop?: SheetStop;
|
|
83
|
+
onStopChange?: (stop: SheetStop) => void;
|
|
84
|
+
/** What the measured stop rests under, inside what is poured in. */
|
|
85
|
+
mark?: string;
|
|
86
|
+
/** Where it is drawn: over the whole page, or inside an element that holds it as a window holds a page. */
|
|
87
|
+
container?: HTMLElement | null;
|
|
88
|
+
/** It stands in `container`, a screen on a page that shows it, as it would on a phone: what's round that screen stays
|
|
89
|
+
* live and free to scroll, and only a press inside it, on its dim, closes it. The container holds fixed positions
|
|
90
|
+
* itself (a transform). */
|
|
91
|
+
standing?: boolean;
|
|
92
|
+
/** Where focus goes once it shuts. Nothing found, or left out, focus goes back to what opened it. */
|
|
93
|
+
finalFocus?: () => HTMLElement | null;
|
|
94
|
+
/** Its head and its body. */
|
|
95
|
+
children: React.ReactNode;
|
|
96
|
+
}
|
|
97
|
+
/** What rises from the bottom of the phone, in a form, at stops. What it holds is poured in. */
|
|
98
|
+
export declare function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form, stops, openAt, stop, onStopChange, mark: marked, container, standing: stands, finalFocus, children }: SheetProps): import("react/jsx-runtime").JSX.Element;
|