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,143 @@
|
|
|
1
|
+
export declare const SHEET_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-backdrop-sheet";
|
|
3
|
+
readonly kind: "colour";
|
|
4
|
+
readonly outright: "--backdrop-sheet";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-backdrop-sheet-light";
|
|
7
|
+
readonly kind: "colour";
|
|
8
|
+
readonly outright: "--backdrop-sheet-light";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "--vk-backdrop-stacked";
|
|
11
|
+
readonly kind: "colour";
|
|
12
|
+
readonly outright: "--backdrop-stacked";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "--vk-overlay";
|
|
15
|
+
readonly kind: "colour";
|
|
16
|
+
readonly outright: "--surface-overlay";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "--vk-fg";
|
|
19
|
+
readonly kind: "colour";
|
|
20
|
+
readonly outright: "--text";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "--vk-sheet-handle";
|
|
23
|
+
readonly kind: "colour";
|
|
24
|
+
readonly outright: "--sheet-handle";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "--vk-border-subtle";
|
|
27
|
+
readonly kind: "colour";
|
|
28
|
+
readonly outright: "--border-subtle";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "--vk-shadow-2xl";
|
|
31
|
+
readonly kind: "shadow";
|
|
32
|
+
readonly outright: "--shadow-2xl";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "--vk-radius-2xl";
|
|
35
|
+
readonly kind: "size";
|
|
36
|
+
readonly outright: "--radius-2xl";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "--vk-spacing";
|
|
39
|
+
readonly kind: "size";
|
|
40
|
+
readonly outright: "--spacing";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "--vk-spring-exit";
|
|
43
|
+
readonly kind: "size";
|
|
44
|
+
readonly outright: "--spring-exit";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "--vk-spring-past";
|
|
47
|
+
readonly kind: "size";
|
|
48
|
+
readonly outright: "--spring-past";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "--vk-radius-lg";
|
|
51
|
+
readonly kind: "size";
|
|
52
|
+
readonly outright: "--radius-lg";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "--vk-radius-xl";
|
|
55
|
+
readonly kind: "size";
|
|
56
|
+
readonly outright: "--radius-xl";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "--vk-radius-3xl";
|
|
59
|
+
readonly kind: "size";
|
|
60
|
+
readonly outright: "--radius-3xl";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "--vk-radius-4xl";
|
|
63
|
+
readonly kind: "size";
|
|
64
|
+
readonly outright: "--radius-4xl";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "--vk-radius-5xl";
|
|
67
|
+
readonly kind: "size";
|
|
68
|
+
readonly outright: "--radius-5xl";
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "--vk-layer-drawer";
|
|
71
|
+
readonly kind: "size";
|
|
72
|
+
readonly outright: "--layer-drawer";
|
|
73
|
+
}, {
|
|
74
|
+
readonly name: "--vk-radius-full";
|
|
75
|
+
readonly kind: "size";
|
|
76
|
+
readonly outright: "--radius-full";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "--vk-border-width";
|
|
79
|
+
readonly kind: "size";
|
|
80
|
+
readonly outright: "--border-width";
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "--vk-spring-smooth";
|
|
83
|
+
readonly kind: "motion";
|
|
84
|
+
readonly outright: "--spring-smooth";
|
|
85
|
+
}, {
|
|
86
|
+
readonly name: "--vk-ease-spring-smooth";
|
|
87
|
+
readonly kind: "motion";
|
|
88
|
+
readonly outright: "--ease-spring-smooth";
|
|
89
|
+
}, {
|
|
90
|
+
readonly name: "--vk-duration-spring-smooth";
|
|
91
|
+
readonly kind: "motion";
|
|
92
|
+
readonly outright: "--duration-spring-smooth";
|
|
93
|
+
}, {
|
|
94
|
+
readonly name: "--vk-spring-quick";
|
|
95
|
+
readonly kind: "motion";
|
|
96
|
+
readonly outright: "--spring-quick";
|
|
97
|
+
}, {
|
|
98
|
+
readonly name: "--vk-ease-spring-quick";
|
|
99
|
+
readonly kind: "motion";
|
|
100
|
+
readonly outright: "--ease-spring-quick";
|
|
101
|
+
}, {
|
|
102
|
+
readonly name: "--vk-duration-spring-quick";
|
|
103
|
+
readonly kind: "motion";
|
|
104
|
+
readonly outright: "--duration-spring-quick";
|
|
105
|
+
}, {
|
|
106
|
+
readonly name: "--vk-spring-lively";
|
|
107
|
+
readonly kind: "motion";
|
|
108
|
+
readonly outright: "--spring-lively";
|
|
109
|
+
}, {
|
|
110
|
+
readonly name: "--vk-ease-spring-lively";
|
|
111
|
+
readonly kind: "motion";
|
|
112
|
+
readonly outright: "--ease-spring-lively";
|
|
113
|
+
}, {
|
|
114
|
+
readonly name: "--vk-duration-spring-lively";
|
|
115
|
+
readonly kind: "motion";
|
|
116
|
+
readonly outright: "--duration-spring-lively";
|
|
117
|
+
}, {
|
|
118
|
+
readonly name: "--vk-sheet-press-scale";
|
|
119
|
+
readonly kind: "motion";
|
|
120
|
+
readonly outright: "--sheet-press-scale";
|
|
121
|
+
}, {
|
|
122
|
+
readonly name: "--vk-duration-slow";
|
|
123
|
+
readonly kind: "motion";
|
|
124
|
+
readonly outright: "--duration-slow";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "--vk-ease-out";
|
|
127
|
+
readonly kind: "motion";
|
|
128
|
+
readonly outright: "--ease-out";
|
|
129
|
+
}, {
|
|
130
|
+
readonly name: "--vk-push-scale";
|
|
131
|
+
readonly kind: "motion";
|
|
132
|
+
readonly outright: "--push-scale";
|
|
133
|
+
}, {
|
|
134
|
+
readonly name: "--vk-duration-fast";
|
|
135
|
+
readonly kind: "motion";
|
|
136
|
+
readonly outright: "--duration-fast";
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "--vk-duration-base";
|
|
139
|
+
readonly kind: "motion";
|
|
140
|
+
readonly outright: "--duration-base";
|
|
141
|
+
}];
|
|
142
|
+
/** The prefixes of its own machinery, set and read by it alone: not public. */
|
|
143
|
+
export declare const SHEET_PRIVATE: readonly ["--sheet-", "--drawer-", "--step-", "--safe-area-", "--page-padding", "--phone-padding", "--screen-curve-"];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const SHEET_TOKENS = [
|
|
2
|
+
{ name: "--vk-backdrop-sheet", kind: "colour", outright: "--backdrop-sheet" },
|
|
3
|
+
{ name: "--vk-backdrop-sheet-light", kind: "colour", outright: "--backdrop-sheet-light" },
|
|
4
|
+
{ name: "--vk-backdrop-stacked", kind: "colour", outright: "--backdrop-stacked" },
|
|
5
|
+
{ name: "--vk-overlay", kind: "colour", outright: "--surface-overlay" },
|
|
6
|
+
{ name: "--vk-fg", kind: "colour", outright: "--text" },
|
|
7
|
+
{ name: "--vk-sheet-handle", kind: "colour", outright: "--sheet-handle" },
|
|
8
|
+
{ name: "--vk-border-subtle", kind: "colour", outright: "--border-subtle" },
|
|
9
|
+
{ name: "--vk-shadow-2xl", kind: "shadow", outright: "--shadow-2xl" },
|
|
10
|
+
{ name: "--vk-radius-2xl", kind: "size", outright: "--radius-2xl" },
|
|
11
|
+
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
12
|
+
{ name: "--vk-spring-exit", kind: "size", outright: "--spring-exit" },
|
|
13
|
+
{ name: "--vk-spring-past", kind: "size", outright: "--spring-past" },
|
|
14
|
+
{ name: "--vk-radius-lg", kind: "size", outright: "--radius-lg" },
|
|
15
|
+
{ name: "--vk-radius-xl", kind: "size", outright: "--radius-xl" },
|
|
16
|
+
{ name: "--vk-radius-3xl", kind: "size", outright: "--radius-3xl" },
|
|
17
|
+
{ name: "--vk-radius-4xl", kind: "size", outright: "--radius-4xl" },
|
|
18
|
+
{ name: "--vk-radius-5xl", kind: "size", outright: "--radius-5xl" },
|
|
19
|
+
{ name: "--vk-layer-drawer", kind: "size", outright: "--layer-drawer" },
|
|
20
|
+
{ name: "--vk-radius-full", kind: "size", outright: "--radius-full" },
|
|
21
|
+
{ name: "--vk-border-width", kind: "size", outright: "--border-width" },
|
|
22
|
+
{ name: "--vk-spring-smooth", kind: "motion", outright: "--spring-smooth" },
|
|
23
|
+
{ name: "--vk-ease-spring-smooth", kind: "motion", outright: "--ease-spring-smooth" },
|
|
24
|
+
{ name: "--vk-duration-spring-smooth", kind: "motion", outright: "--duration-spring-smooth" },
|
|
25
|
+
{ name: "--vk-spring-quick", kind: "motion", outright: "--spring-quick" },
|
|
26
|
+
{ name: "--vk-ease-spring-quick", kind: "motion", outright: "--ease-spring-quick" },
|
|
27
|
+
{ name: "--vk-duration-spring-quick", kind: "motion", outright: "--duration-spring-quick" },
|
|
28
|
+
{ name: "--vk-spring-lively", kind: "motion", outright: "--spring-lively" },
|
|
29
|
+
{ name: "--vk-ease-spring-lively", kind: "motion", outright: "--ease-spring-lively" },
|
|
30
|
+
{ name: "--vk-duration-spring-lively", kind: "motion", outright: "--duration-spring-lively" },
|
|
31
|
+
{ name: "--vk-sheet-press-scale", kind: "motion", outright: "--sheet-press-scale" },
|
|
32
|
+
{ name: "--vk-duration-slow", kind: "motion", outright: "--duration-slow" },
|
|
33
|
+
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
34
|
+
{ name: "--vk-push-scale", kind: "motion", outright: "--push-scale" },
|
|
35
|
+
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
36
|
+
{ name: "--vk-duration-base", kind: "motion", outright: "--duration-base" },
|
|
37
|
+
];
|
|
38
|
+
export const SHEET_PRIVATE = ["--sheet-", "--drawer-", "--step-", "--safe-area-", "--page-padding", "--phone-padding", "--screen-curve-"];
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/* The bottom Sheet. Every value it draws with is a public name (controls/sheet/tokens.ts); this file only says which name each
|
|
2
|
+
part takes. Its options (looks.ts) are data attributes on the frame around it, and each one only chooses other names:
|
|
3
|
+
|
|
4
|
+
data-sheet-spring smooth · quick · lively which spring it settles on
|
|
5
|
+
data-sheet-corners lg · xl · 2xl · 3xl · 4xl · 5xl which radius its corners take
|
|
6
|
+
data-sheet-smoothing round · smooth how its corners bend
|
|
7
|
+
data-sheet-margin 4 · 6 · 8 · 10 · 12 how far a floating sheet stands from the edges
|
|
8
|
+
data-sheet-padding page · 12 · 16 · 20 · 24 how far its content stands from its sides: the page's padding, or its own
|
|
9
|
+
data-sheet-dim deep · light which dim stands behind it
|
|
10
|
+
|
|
11
|
+
Page reads --phone-padding, the phone's page padding where what holds it sets one; with none it reads --page-padding, and
|
|
12
|
+
with neither it stands at 24. Its head is the phone header bar (phone-header.css), Glass unless the frame says
|
|
13
|
+
data-phone-header-surface="flat".
|
|
14
|
+
|
|
15
|
+
data-sheet-form on the sheet says which of its forms it is: full, floating, blend or edge (forms.ts). Base UI marks it
|
|
16
|
+
data-starting-style and data-ending-style while it comes and goes, data-swiping while it is dragged and data-expanded at
|
|
17
|
+
full height; while it comes in, until it rests, .o-sheet-shield stands over it (bottom-sheet.tsx), and moves it by
|
|
18
|
+
--drawer-snap-point-offset and --drawer-swipe-movement-y. bottom-sheet.tsx writes the rest:
|
|
19
|
+
--sheet-gone how far below its lowest stop it has been dragged, 0 to 1: the dim fades by it
|
|
20
|
+
--sheet-ease, --sheet-time the settle compiled for this release; with none, the spring's own
|
|
21
|
+
--sheet-catch how far it was caught from its stop, grabbed in mid-settle
|
|
22
|
+
--sheet-lift how far its foot is raised, so it stays at the screen's foot at a lower stop
|
|
23
|
+
--sheet-fit how tall a floating sheet's content is
|
|
24
|
+
--sheet-screen the curve of the screen it stands on, read from --screen-curve-<w>x<h> where the page declares one
|
|
25
|
+
--sheet-rise how far a blend has opened out from floating to full, 0 to 1
|
|
26
|
+
--sheet-scale how far a blend is scaled down to floating's width, 1 at full
|
|
27
|
+
--sheet-cut how much of a blend's foot is cut off, so it ends on floating's foot
|
|
28
|
+
--sheet-keyboard while a box in it has focus, how far the phone's keyboard covers the screen's foot: a full Sheet's body
|
|
29
|
+
keeps that under what it holds where it is more than its own padding
|
|
30
|
+
and reads, on it, --sheet-spring (its spring), --sheet-exit and --sheet-past (how far a settle may carry it).
|
|
31
|
+
|
|
32
|
+
The rules sit in the components layer, so a utility class on a sheet still wins. */
|
|
33
|
+
@layer components {
|
|
34
|
+
|
|
35
|
+
.o-sheet, .o-sheet-backdrop, .o-sheet-below {
|
|
36
|
+
--sheet-spring: var(--vk-spring-quick); --sheet-spring-ease: var(--vk-ease-spring-quick); --sheet-spring-time: var(--vk-duration-spring-quick);
|
|
37
|
+
}
|
|
38
|
+
[data-sheet-spring="smooth"] :is(.o-sheet, .o-sheet-backdrop) { --sheet-spring: var(--vk-spring-smooth); --sheet-spring-ease: var(--vk-ease-spring-smooth); --sheet-spring-time: var(--vk-duration-spring-smooth); }
|
|
39
|
+
[data-sheet-spring="lively"] :is(.o-sheet, .o-sheet-backdrop) { --sheet-spring: var(--vk-spring-lively); --sheet-spring-ease: var(--vk-ease-spring-lively); --sheet-spring-time: var(--vk-duration-spring-lively); }
|
|
40
|
+
.o-sheet { --sheet-radius: var(--vk-radius-2xl); --sheet-padding: var(--phone-padding, var(--page-padding, calc(var(--vk-spacing) * 6))); }
|
|
41
|
+
.o-sheet { --sheet-exit: var(--vk-spring-exit); --sheet-past: var(--vk-spring-past); }
|
|
42
|
+
[data-sheet-padding="12"] .o-sheet { --sheet-padding: calc(var(--vk-spacing) * 3); }
|
|
43
|
+
[data-sheet-padding="16"] .o-sheet { --sheet-padding: calc(var(--vk-spacing) * 4); }
|
|
44
|
+
[data-sheet-padding="20"] .o-sheet { --sheet-padding: calc(var(--vk-spacing) * 5); }
|
|
45
|
+
[data-sheet-padding="24"] .o-sheet { --sheet-padding: calc(var(--vk-spacing) * 6); }
|
|
46
|
+
[data-sheet-corners="lg"] .o-sheet { --sheet-radius: var(--vk-radius-lg); }
|
|
47
|
+
[data-sheet-corners="xl"] .o-sheet { --sheet-radius: var(--vk-radius-xl); }
|
|
48
|
+
[data-sheet-corners="3xl"] .o-sheet { --sheet-radius: var(--vk-radius-3xl); }
|
|
49
|
+
[data-sheet-corners="4xl"] .o-sheet { --sheet-radius: var(--vk-radius-4xl); }
|
|
50
|
+
[data-sheet-corners="5xl"] .o-sheet { --sheet-radius: var(--vk-radius-5xl); }
|
|
51
|
+
|
|
52
|
+
/* ── Its dim: whole at any stop, fading only below the lowest; dim and blocked travel together. It moves as the sheet
|
|
53
|
+
does. A sheet on a sheet has a lighter one of its own ──────────────────────────────────────────────────────────── */
|
|
54
|
+
.o-sheet-backdrop {
|
|
55
|
+
position: fixed; inset: 0; z-index: var(--vk-layer-drawer); background-color: var(--vk-backdrop-sheet-light); opacity: calc(1 - var(--sheet-gone, 0));
|
|
56
|
+
transition: opacity var(--sheet-time, var(--sheet-spring-time)) var(--sheet-ease, var(--sheet-spring-ease));
|
|
57
|
+
}
|
|
58
|
+
[data-sheet-dim="deep"] .o-sheet-backdrop { background-color: var(--vk-backdrop-sheet); }
|
|
59
|
+
.o-sheet-backdrop[data-stacked] { background-color: var(--vk-backdrop-stacked); }
|
|
60
|
+
.o-sheet-backdrop:is([data-starting-style], [data-ending-style]) { opacity: 0; }
|
|
61
|
+
.o-sheet-backdrop[data-swiping] { transition: none; }
|
|
62
|
+
|
|
63
|
+
/* ── What goes on under Safari's floating toolbar, in the page, where nothing fixed paints (bottom-sheet.tsx). Under full
|
|
64
|
+
it goes on as the sheet does until the sheet has gone; under floating it goes on as the dim does ────────────────── */
|
|
65
|
+
.o-sheet-below { position: absolute; left: 0; right: 0; height: calc(var(--vk-spacing) * 40); z-index: var(--vk-layer-drawer); pointer-events: none; }
|
|
66
|
+
.o-sheet-below:is([data-sheet-form="floating"], [data-sheet-form="blend"]) {
|
|
67
|
+
opacity: calc(1 - var(--sheet-gone, 0)); transition: opacity var(--sheet-time, var(--sheet-spring-time)) var(--sheet-ease, var(--sheet-spring-ease));
|
|
68
|
+
@starting-style { opacity: 0; }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* ── Where it sits: from the bottom, the gesture its own from the first touch ────────────────────────────────────── */
|
|
72
|
+
.o-sheet-viewport { position: fixed; inset: 0; z-index: var(--vk-layer-drawer); display: flex; align-items: flex-end; justify-content: center; touch-action: none; }
|
|
73
|
+
.o-sheet-viewport { --sheet-gap: calc(var(--vk-spacing) * 2); }
|
|
74
|
+
[data-sheet-margin="4"] .o-sheet-viewport { --sheet-gap: calc(var(--vk-spacing) * 1); }
|
|
75
|
+
[data-sheet-margin="6"] .o-sheet-viewport { --sheet-gap: calc(var(--vk-spacing) * 1.5); }
|
|
76
|
+
[data-sheet-margin="10"] .o-sheet-viewport { --sheet-gap: calc(var(--vk-spacing) * 2.5); }
|
|
77
|
+
[data-sheet-margin="12"] .o-sheet-viewport { --sheet-gap: calc(var(--vk-spacing) * 3); }
|
|
78
|
+
.o-sheet-viewport[data-sheet-form="floating"] {
|
|
79
|
+
padding: 0 calc(var(--sheet-gap) + var(--safe-area-right, env(safe-area-inset-right, 0px))) var(--sheet-gap) calc(var(--sheet-gap) + var(--safe-area-left, env(safe-area-inset-left, 0px)));
|
|
80
|
+
}
|
|
81
|
+
/* Coming in, over all of it, the sheet and its dim: a press lands here and nothing in it is pressed. After the sheet in
|
|
82
|
+
the page, so it is drawn and pressed over it. */
|
|
83
|
+
.o-sheet-shield { position: absolute; inset: 0; }
|
|
84
|
+
|
|
85
|
+
/* ── It: moved only by transform, from its stop and the finger; on a spring whenever no finger holds it. Base UI holds
|
|
86
|
+
transition: none on it through a drag, inline, and takes that away itself at the release: a rule of ours would outlive
|
|
87
|
+
that by a moment, in which Base UI reads its height, and a sheet let go to close would jump to its end ──────────── */
|
|
88
|
+
.o-sheet {
|
|
89
|
+
position: relative; box-sizing: border-box; display: flex; flex-direction: column; width: 100%; min-height: 0;
|
|
90
|
+
background-color: var(--vk-overlay); color: var(--vk-fg); box-shadow: var(--vk-shadow-2xl); outline: none;
|
|
91
|
+
touch-action: none; will-change: transform; transform-origin: 50% 0;
|
|
92
|
+
transform: translateY(calc(var(--drawer-snap-point-offset, 0px) + var(--drawer-swipe-movement-y, 0px) + var(--sheet-catch, 0px)));
|
|
93
|
+
transition: transform var(--sheet-time, var(--sheet-spring-time)) var(--sheet-ease, var(--sheet-spring-ease)), clip-path var(--sheet-time, var(--sheet-spring-time)) var(--sheet-ease, var(--sheet-spring-ease)), transform-origin var(--sheet-time, var(--sheet-spring-time)) var(--sheet-ease, var(--sheet-spring-ease)), scale var(--sheet-time, var(--sheet-spring-time)) var(--sheet-ease, var(--sheet-spring-ease)), height var(--sheet-spring-time) var(--sheet-spring-ease);
|
|
94
|
+
}
|
|
95
|
+
.o-sheet:is([data-starting-style], [data-ending-style]) { transform: translateY(calc(100% + var(--sheet-margin, 0px))); }
|
|
96
|
+
.o-sheet[data-swiping] { user-select: none; }
|
|
97
|
+
/* Under a finger where it can drag, a floating sheet or a blend below full grows a little, ready to be moved, and goes back on its spring. It is
|
|
98
|
+
scale and an animation, since from the touch Base UI writes transform and transition: none inline. */
|
|
99
|
+
@keyframes o-sheet-press { from { scale: var(--sheet-scale, 1); } }
|
|
100
|
+
.o-sheet[data-sheet-pressed]:is([data-sheet-form="floating"], [data-sheet-form="blend"]:not([data-expanded])) { scale: calc(var(--sheet-scale, 1) * var(--vk-sheet-press-scale)); animation: o-sheet-press var(--vk-duration-slow) var(--vk-ease-out); }
|
|
101
|
+
|
|
102
|
+
/* Full: edge to edge, rounded on top, just under the status bar. Under it, the sheet goes on past its foot, so nothing
|
|
103
|
+
shows when it is pulled above its top stop or swings past it. */
|
|
104
|
+
.o-sheet:is([data-sheet-form="full"], [data-sheet-form="blend"]) {
|
|
105
|
+
height: calc(100% - var(--safe-area-top, env(safe-area-inset-top, 0px)) - var(--vk-spacing) * 2.5); border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
|
|
106
|
+
}
|
|
107
|
+
.o-sheet:is([data-sheet-form="full"], [data-sheet-form="blend"], [data-sheet-form="edge"])::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 100%; background-color: inherit; }
|
|
108
|
+
/* Edge: full's shape, as tall as what it holds, as floating is. Its body clears the home bar and no more. */
|
|
109
|
+
.o-sheet[data-sheet-form="edge"] { height: var(--sheet-fit, auto); max-height: calc(100% - var(--safe-area-top, env(safe-area-inset-top, 0px)) - var(--vk-spacing) * 12); border-radius: var(--sheet-radius) var(--sheet-radius) 0 0; }
|
|
110
|
+
.o-sheet[data-sheet-form="edge"] .o-sheet-body { padding-bottom: calc(var(--vk-spacing) * 3 + var(--safe-area-bottom, env(safe-area-inset-bottom, 0px))); }
|
|
111
|
+
/* Floating: the same margin from the screen's left, right and bottom, past the home bar, which what it holds clears instead.
|
|
112
|
+
Its bottom corners follow the phone's own: the screen's curve less the margin, or Corners on a screen no token knows. Its
|
|
113
|
+
top corners, which stand on no screen's edge, take Corners.
|
|
114
|
+
As tall as what is in it; past its most, its body scrolls. */
|
|
115
|
+
.o-sheet[data-sheet-form="floating"] {
|
|
116
|
+
--sheet-margin: var(--sheet-gap); --sheet-curve: calc(var(--sheet-screen) - var(--sheet-gap));
|
|
117
|
+
--sheet-home: calc(var(--safe-area-bottom, env(safe-area-inset-bottom, 0px)) - var(--sheet-gap));
|
|
118
|
+
transform-origin: 50% 100%; height: var(--sheet-fit, auto); max-height: calc(100% - var(--safe-area-top, env(safe-area-inset-top, 0px)) - var(--vk-spacing) * 12); border-radius: var(--sheet-radius) var(--sheet-radius) var(--sheet-curve, var(--sheet-radius)) var(--sheet-curve, var(--sheet-radius)); overflow: clip;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Blend: the two forms as one. It is laid out once, at full's width and height, and at its lower stops the whole of it is scaled
|
|
122
|
+
down to floating's width, its head, buttons, text and padding together, and cut to floating's foot and bottom corners. From
|
|
123
|
+
the stop under full it grows to edge to edge with the sheet, as one piece: nothing is laid out again, so no line wraps
|
|
124
|
+
differently. It cuts its own foot, so it casts no shadow. It scales from where it stands, so its stops stay where they are. */
|
|
125
|
+
.o-sheet[data-sheet-form="blend"] {
|
|
126
|
+
--sheet-margin: var(--sheet-gap); --sheet-curve: calc(var(--sheet-screen) - var(--sheet-gap));
|
|
127
|
+
--sheet-round: calc(var(--sheet-curve, var(--sheet-radius)) * (1 - var(--sheet-rise, 0)) / var(--sheet-scale, 1));
|
|
128
|
+
scroll-margin-left: var(--sheet-gap); scale: var(--sheet-scale, 1);
|
|
129
|
+
transform-origin: 50% calc(var(--drawer-snap-point-offset, 0px) + var(--drawer-swipe-movement-y, 0px));
|
|
130
|
+
clip-path: inset(0 0 var(--sheet-cut, 0px) round var(--sheet-radius) var(--sheet-radius) var(--sheet-round) var(--sheet-round));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Its corners smooth: the same corners, drawn as an outline, so every browser that knows shape() shows them; one that doesn't
|
|
134
|
+
keeps the quarter circles above. Each corner is three curves, Apple's own sheet as measured (smoothing 70%): the bend starts
|
|
135
|
+
1.7 radii from the corner and meets the quarter circle at the tip, so a corner stands as large as a round one and only comes
|
|
136
|
+
in softer. It is the one smooth outline (smooth.css): --smooth-t the top corners' radius, --smooth-b the bottom ones',
|
|
137
|
+
--smooth-foot where it ends. A blend cuts itself. Full and floating cast a shadow, which a cut would take with it, so they keep it
|
|
138
|
+
and .o-sheet-cut, inside them, is cut and carries their ground instead. */
|
|
139
|
+
/* What it holds is cut along its corners, whichever way they bend, so nothing in it, a Glass button's wide shadow, reaches past
|
|
140
|
+
the curve. It is a cut of its own, not a clip-path: under one, Firefox loses a sticky header's blur and squares what it cuts. */
|
|
141
|
+
.o-sheet-cut { display: flex; flex-direction: column; flex: 1; width: 100%; min-height: 0; background-color: inherit; border-radius: inherit; overflow: clip; }
|
|
142
|
+
@supports (clip-path: shape(from 0 0, curve by 1px 1px with 1px 0 / 1px 0, close)) {
|
|
143
|
+
.o-sheet:not([data-sheet-smoothing="round"] *) { --smooth-t: var(--sheet-radius); --smooth-b: 0px; --smooth-foot: 100%; --sheet-outline: shape(var(--smooth-outline)); }
|
|
144
|
+
.o-sheet[data-sheet-form="floating"]:not([data-sheet-smoothing="round"] *) { --smooth-b: var(--sheet-curve, var(--sheet-radius)); }
|
|
145
|
+
.o-sheet[data-sheet-form="blend"]:not([data-sheet-smoothing="round"] *) { --smooth-b: var(--sheet-round); --smooth-foot: calc(100% - var(--sheet-cut, 0px)); clip-path: var(--sheet-outline); }
|
|
146
|
+
.o-sheet:is([data-sheet-form="full"], [data-sheet-form="floating"], [data-sheet-form="edge"]):not([data-sheet-smoothing="round"] *) { background-color: transparent; }
|
|
147
|
+
.o-sheet:is([data-sheet-form="full"], [data-sheet-form="floating"], [data-sheet-form="edge"]):not([data-sheet-smoothing="round"] *)::after { background-color: var(--vk-overlay); }
|
|
148
|
+
.o-sheet:is([data-sheet-form="full"], [data-sheet-form="floating"], [data-sheet-form="edge"]):not([data-sheet-smoothing="round"] *) > .o-sheet-cut { background-color: var(--vk-overlay); clip-path: var(--sheet-outline); }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* A sheet on a sheet: the one below steps back and stays still; only the top one is live. */
|
|
152
|
+
.o-sheet[data-nested-drawer-open] { scale: var(--vk-push-scale); }
|
|
153
|
+
|
|
154
|
+
/* ── Its handle, then its head, the drag's own ground. Its head is the one header (phone-header.css), standing under the
|
|
155
|
+
handle; the phone header's options reach it here too. With no head the handle stands alone, its drag a little taller ───────── */
|
|
156
|
+
.o-sheet-handle { flex: none; align-self: center; width: calc(var(--vk-spacing) * 9); height: calc(var(--vk-spacing) * 1.25); margin-block: calc(var(--vk-spacing) * 1) calc(var(--vk-spacing) * 0.5); border-radius: var(--vk-radius-full); background-color: var(--vk-sheet-handle); }
|
|
157
|
+
.o-sheet-handle:has(+ .o-sheet-body) { margin-bottom: calc(var(--vk-spacing) * 3); }
|
|
158
|
+
.o-sheet-head { flex: none; box-sizing: border-box; min-width: 0; user-select: none; }
|
|
159
|
+
/* The buttons in its corners stand as far from the top as from the sides: the row starts under the handle's 11. */
|
|
160
|
+
.o-sheet-row { margin: calc(var(--sheet-padding) - var(--vk-spacing) * 2.75) 0 calc(var(--vk-spacing) * 2); }
|
|
161
|
+
/* Its buttons: Its head says which of the two shows (bottom-sheet.tsx). */
|
|
162
|
+
[data-phone-header-surface="flat"] .o-sheet-row .o-sheet-glass, .o-sheet-row .o-sheet-plain:not([data-phone-header-surface="flat"] *) { display: none; }
|
|
163
|
+
.o-sheet-row .o-sheet-glass:not([data-phone-header-surface="flat"] *) { display: grid; }
|
|
164
|
+
/* One that holds a word lays its icon and its word out in a line, as the Glass button does. */
|
|
165
|
+
.o-sheet-row .o-sheet-glass.o-glass-button-worded:not([data-phone-header-surface="flat"] *) { display: inline-flex; }
|
|
166
|
+
/* Glass: its head floats. The soft edge starts at the sheet's top, on the sheet's ground, and the body runs up under it and the
|
|
167
|
+
handle, by as much as they stand tall, so what scrolls passes under the buttons and what it holds still starts where it did. */
|
|
168
|
+
.o-sheet-handle:not([data-phone-header-surface="flat"] *) { position: relative; z-index: 2; }
|
|
169
|
+
.o-sheet-head:not([data-phone-header-surface="flat"] *) { position: relative; z-index: 1; --hd-bar-room: var(--sheet-padding); --soft-edge-ground: var(--vk-overlay); }
|
|
170
|
+
.o-sheet-head + .o-sheet-body:not([data-phone-header-surface="flat"] *) { --sheet-under: calc(var(--sheet-padding) + var(--vk-spacing) * 13); }
|
|
171
|
+
/* Its head stands on the sheet's padding, not the page's, which phone-header.css reads; flat's own, below, still wins. */
|
|
172
|
+
.o-sheet-head > .o-sheet-row { padding-inline: var(--sheet-padding); }
|
|
173
|
+
.o-sheet-row > .o-hd-bar-edge { border-radius: var(--sheet-radius) var(--sheet-radius) 0 0; }
|
|
174
|
+
/* Flat, in a sheet: quiet Buttons in a shorter row. A plain button is a glyph in a 36px target, 12
|
|
175
|
+
inside it, so the target's edge stands 12 short of the padding. With nothing on its left, a title at the left stands on the
|
|
176
|
+
padding, and Back's arrow does. */
|
|
177
|
+
[data-phone-header-surface="flat"] .o-sheet-row { gap: 0; height: calc(var(--vk-spacing) * 9); margin: calc(var(--sheet-padding) - var(--vk-spacing) * 5.75) 0 calc(var(--vk-spacing) * 1); padding-inline: calc(var(--sheet-padding) - var(--vk-spacing) * 3); }
|
|
178
|
+
[data-phone-header-surface="flat"] .o-sheet-row > .o-hd-bar-side { min-width: 0; }
|
|
179
|
+
[data-phone-header-surface="flat"] .o-sheet-row[data-title-at="left"]:not([data-sides]) { padding-left: var(--sheet-padding); }
|
|
180
|
+
[data-phone-header-surface="flat"] .o-sheet-row[data-title-at="left"] .o-sheet-back { margin: 0 calc(var(--vk-spacing) * 1) 0 calc(var(--vk-spacing) * -3); }
|
|
181
|
+
|
|
182
|
+
/* ── Its body scrolls only at full height; lower, a drag up raises the sheet. Its foot clears the home bar ─────────── */
|
|
183
|
+
.o-sheet-body {
|
|
184
|
+
flex: 1; min-height: 0; overflow-y: auto; outline: none; touch-action: pan-y; overscroll-behavior: contain;
|
|
185
|
+
margin-top: calc(-1 * var(--sheet-under, 0px));
|
|
186
|
+
padding: calc(var(--vk-spacing) * 2 + var(--sheet-under, 0px)) var(--sheet-padding) max(calc(var(--vk-spacing) * 8 + var(--safe-area-bottom, env(safe-area-inset-bottom, 0px))), var(--sheet-keyboard, 0px));
|
|
187
|
+
}
|
|
188
|
+
.o-sheet:is([data-sheet-form="full"], [data-sheet-form="blend"]):not([data-expanded]) .o-sheet-body { overflow-y: hidden; }
|
|
189
|
+
.o-sheet[data-sheet-form="floating"] .o-sheet-body { padding: calc(var(--vk-spacing) * 1 + var(--sheet-under, 0px)) calc(var(--sheet-padding) - var(--vk-spacing) * 2) max(calc(var(--vk-spacing) * 2), var(--sheet-home)); }
|
|
190
|
+
|
|
191
|
+
/* ── Its foot: over the body, on the sheet's ground, a line above it; it stays at the screen's foot at every stop, moved up
|
|
192
|
+
by as much as the sheet is moved down, on the same spring, and leaves with the sheet below its lowest ──────────── */
|
|
193
|
+
.o-sheet-foot {
|
|
194
|
+
flex: none; position: relative; z-index: 1; background-color: var(--vk-overlay); border-top: var(--vk-border-width) solid var(--vk-border-subtle);
|
|
195
|
+
padding: calc(var(--vk-spacing) * 3) var(--sheet-padding) calc(var(--vk-spacing) * 3 + var(--safe-area-bottom, env(safe-area-inset-bottom, 0px)));
|
|
196
|
+
transform: translateY(calc(-1 * var(--sheet-lift, 0px)));
|
|
197
|
+
transition: transform var(--sheet-time, var(--sheet-spring-time)) var(--sheet-ease, var(--sheet-spring-ease));
|
|
198
|
+
}
|
|
199
|
+
.o-sheet[data-sheet-form="blend"] .o-sheet-foot { transform: translateY(calc(-1 * var(--sheet-cut, 0px))); }
|
|
200
|
+
.o-sheet[data-swiping] .o-sheet-foot { transition: none; }
|
|
201
|
+
.o-sheet[data-sheet-form="floating"] .o-sheet-foot { padding-bottom: max(calc(var(--vk-spacing) * 3), var(--sheet-home)); }
|
|
202
|
+
|
|
203
|
+
/* A step coming into a floating sheet, from the right, or from the left going back; the sheet resizes on its spring. */
|
|
204
|
+
@keyframes o-sheet-step { from { opacity: 0; translate: var(--step-from) 0; } }
|
|
205
|
+
.o-sheet-step { --step-from: calc(var(--vk-spacing) * 6); animation: o-sheet-step var(--vk-duration-slow) var(--vk-ease-out); }
|
|
206
|
+
.o-sheet-step[data-back] { --step-from: calc(var(--vk-spacing) * -6); }
|
|
207
|
+
/* A step takes the focus as it comes, with no ring: what it holds is what is pressed next. While it slides, the body never scrolls
|
|
208
|
+
sideways (a full Sheet's body scrolls, and a step's slide would otherwise widen it). */
|
|
209
|
+
.o-sheet-step { outline: none; }
|
|
210
|
+
.o-sheet-body:has(.o-sheet-step) { overflow-x: hidden; }
|
|
211
|
+
|
|
212
|
+
/* Less motion: a fade, no scale. */
|
|
213
|
+
@media (prefers-reduced-motion: reduce) {
|
|
214
|
+
.o-sheet { transition: transform var(--vk-duration-fast) var(--vk-ease-out), opacity var(--vk-duration-base) var(--vk-ease-out); }
|
|
215
|
+
.o-sheet:is([data-starting-style], [data-ending-style]) { opacity: 0; transform: translateY(var(--drawer-snap-point-offset, 0px)); }
|
|
216
|
+
.o-sheet[data-nested-drawer-open] { scale: 1; }
|
|
217
|
+
.o-sheet-backdrop { transition: opacity var(--vk-duration-base) var(--vk-ease-out); }
|
|
218
|
+
.o-sheet-step { animation: none; }
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* The smooth corner, the kit's one outline: a corner cut by a drawn outline instead of a quarter circle,
|
|
2
|
+
so every browser that knows shape() shows it. Each corner is three curves, Apple's own sheet as measured (smoothing 70%): the bend
|
|
3
|
+
starts 1.7 radii from the corner and meets the quarter circle at its tip, so a corner stands as large as a round one and comes in
|
|
4
|
+
softer. A component puts o-smooth on what it clips, sets its inputs there, and clips with the outputs, inside its own
|
|
5
|
+
@supports (clip-path: shape(…)), so a browser without shape() keeps its quarter circles.
|
|
6
|
+
|
|
7
|
+
Inputs, on the o-smooth element (or its ::before or ::after, for a ring's inner line):
|
|
8
|
+
--smooth-t the top corners' radius
|
|
9
|
+
--smooth-b the bottom corners' radius; --smooth-t unless set
|
|
10
|
+
--smooth-in how far in the outline stands, for a ring's inner line on the element's own box; 0 unless set
|
|
11
|
+
--smooth-foot where its bottom edge stands; 100% unless set (a Blend's cut)
|
|
12
|
+
--smooth-side with o-smooth-ease: the box's shorter side, which eases the smoothing where it is too short for it
|
|
13
|
+
--smooth-amount with o-smooth-ease: the most smoothing it takes, 0.7 (Apple's) unless set; 0 is a quarter circle. A control
|
|
14
|
+
sets it from the token corner-smoothing, or by its own Corner smoothing. It inherits, so it is
|
|
15
|
+
set on what draws the outline (a control's cut), never on a box that can hold another (an Option holds an Avatar);
|
|
16
|
+
where a host that follows the token holds what it can't foresee (a crumb, a tab), the Avatar sets its own, initial,
|
|
17
|
+
so no host's amount reaches it.
|
|
18
|
+
A control gives the outline a radius that fits its side, side / (2 + 2 × amount), so the whole bend fits and the
|
|
19
|
+
smoothing stays; the Avatar gives its own radius and eases instead
|
|
20
|
+
Outputs:
|
|
21
|
+
--smooth-outline the whole outline: clip-path: shape(var(--smooth-outline))
|
|
22
|
+
--smooth-path the outline after its start point
|
|
23
|
+
--smooth-ring on a ::before or ::after: the ring between the element's outline and its own (a line in), as an edge drawn
|
|
24
|
+
along the curve: clip-path: shape(var(--smooth-ring))
|
|
25
|
+
|
|
26
|
+
The curve's numbers are a share of a corner's radius. Apple's are fixed, so whatever takes them draws as the six copies did before
|
|
27
|
+
this file. o-smooth-ease works them out from the smoothing instead, as Figma does where 1.7 radii don't fit at each end of a side:
|
|
28
|
+
--smooth-x, the least of the amount (0.7 unless set) and half the side over the radius less one (0, a quarter circle, where the
|
|
29
|
+
radius takes half the side). A custom property is worked out where it is declared, so the outline is declared on each element
|
|
30
|
+
that draws it.
|
|
31
|
+
|
|
32
|
+
Registered: the top radius, the side and the thirteen numbers, each worked out once, where it is declared, to one
|
|
33
|
+
length or one number, so the outline that reads them holds `8.82px * 1.7` where it held their whole sums again in each of its
|
|
34
|
+
terms (a Button's was 52,000 characters, worked out on every restyle). The radius and the
|
|
35
|
+
side are registered as lengths so that --smooth-x reads them as px: worked out as a number, atan2 over a container's or a
|
|
36
|
+
font's unit is wrong in WebKit and impossible in Firefox. --smooth-b, --smooth-in, --smooth-foot and --smooth-amount stay
|
|
37
|
+
plain, as each is read with a fallback that a registered property never falls back to. */
|
|
38
|
+
@property --smooth-t { syntax: "<length-percentage>"; inherits: true; initial-value: 0px; }
|
|
39
|
+
@property --smooth-side { syntax: "<length>"; inherits: true; initial-value: 0px; }
|
|
40
|
+
@property --smooth-x { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
41
|
+
@property --smooth-k { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
42
|
+
@property --smooth-cc { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
43
|
+
@property --smooth-d { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
44
|
+
@property --smooth-p { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
45
|
+
@property --smooth-a2 { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
46
|
+
@property --smooth-a1 { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
47
|
+
@property --smooth-bc { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
48
|
+
@property --smooth-e { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
49
|
+
@property --smooth-hx { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
50
|
+
@property --smooth-hy { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
51
|
+
@property --smooth-khy { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
52
|
+
@property --smooth-khx { syntax: "<number>"; inherits: true; initial-value: 0; }
|
|
53
|
+
@layer components {
|
|
54
|
+
|
|
55
|
+
.o-smooth, .o-smooth::before, .o-smooth::after {
|
|
56
|
+
/* The first curve's reach (e) and drop (d), its handles (a1, a2); the arc's chord (k) and handles (hx, hy, and k less each); the
|
|
57
|
+
last curve's handles (cc, bc); where the bend starts (p). Apple's, at 70%. */
|
|
58
|
+
--smooth-e: 1.222; --smooth-d: 0.147; --smooth-a1: 0.655; --smooth-a2: 0.982; --smooth-k: 0.33; --smooth-hx: 0.135; --smooth-hy: 0.082;
|
|
59
|
+
--smooth-khy: 0.248; --smooth-khx: 0.196; --smooth-cc: 0.24; --smooth-bc: 0.568; --smooth-p: 1.7;
|
|
60
|
+
--smooth-path:
|
|
61
|
+
hline to calc(100% - var(--smooth-in, 0px) - var(--smooth-t) * var(--smooth-p)),
|
|
62
|
+
curve by calc(var(--smooth-t) * var(--smooth-e)) calc(var(--smooth-t) * var(--smooth-d)) with calc(var(--smooth-t) * var(--smooth-a1)) 0 / calc(var(--smooth-t) * var(--smooth-a2)) 0,
|
|
63
|
+
curve by calc(var(--smooth-t) * var(--smooth-k)) calc(var(--smooth-t) * var(--smooth-k)) with calc(var(--smooth-t) * var(--smooth-hx)) calc(var(--smooth-t) * var(--smooth-hy)) / calc(var(--smooth-t) * var(--smooth-khy)) calc(var(--smooth-t) * var(--smooth-khx)),
|
|
64
|
+
curve by calc(var(--smooth-t) * var(--smooth-d)) calc(var(--smooth-t) * var(--smooth-e)) with calc(var(--smooth-t) * var(--smooth-d)) calc(var(--smooth-t) * var(--smooth-cc)) / calc(var(--smooth-t) * var(--smooth-d)) calc(var(--smooth-t) * var(--smooth-bc)),
|
|
65
|
+
vline to calc(var(--smooth-foot, 100%) - var(--smooth-in, 0px) - var(--smooth-b, var(--smooth-t)) * var(--smooth-p)),
|
|
66
|
+
curve by calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-d) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-e)) with 0 calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-a1)) / 0 calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-a2)),
|
|
67
|
+
curve by calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-k) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-k)) with calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-hy) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-hx)) / calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-khx) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-khy)),
|
|
68
|
+
curve by calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-e) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-d)) with calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-cc) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-d)) / calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-bc) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-d)),
|
|
69
|
+
hline to calc(var(--smooth-in, 0px) + var(--smooth-b, var(--smooth-t)) * var(--smooth-p)),
|
|
70
|
+
curve by calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-e) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-d) * -1) with calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-a1) * -1) 0 / calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-a2) * -1) 0,
|
|
71
|
+
curve by calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-k) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-k) * -1) with calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-hx) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-hy) * -1) / calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-khy) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-khx) * -1),
|
|
72
|
+
curve by calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-d) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-e) * -1) with calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-d) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-cc) * -1) / calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-d) * -1) calc(var(--smooth-b, var(--smooth-t)) * var(--smooth-bc) * -1),
|
|
73
|
+
vline to calc(var(--smooth-in, 0px) + var(--smooth-t) * var(--smooth-p)),
|
|
74
|
+
curve by calc(var(--smooth-t) * var(--smooth-d)) calc(var(--smooth-t) * var(--smooth-e) * -1) with 0 calc(var(--smooth-t) * var(--smooth-a1) * -1) / 0 calc(var(--smooth-t) * var(--smooth-a2) * -1),
|
|
75
|
+
curve by calc(var(--smooth-t) * var(--smooth-k)) calc(var(--smooth-t) * var(--smooth-k) * -1) with calc(var(--smooth-t) * var(--smooth-hy)) calc(var(--smooth-t) * var(--smooth-hx) * -1) / calc(var(--smooth-t) * var(--smooth-khx)) calc(var(--smooth-t) * var(--smooth-khy) * -1),
|
|
76
|
+
curve by calc(var(--smooth-t) * var(--smooth-e)) calc(var(--smooth-t) * var(--smooth-d) * -1) with calc(var(--smooth-t) * var(--smooth-cc)) calc(var(--smooth-t) * var(--smooth-d) * -1) / calc(var(--smooth-t) * var(--smooth-bc)) calc(var(--smooth-t) * var(--smooth-d) * -1),
|
|
77
|
+
close;
|
|
78
|
+
--smooth-outline: from calc(var(--smooth-in, 0px) + var(--smooth-t) * var(--smooth-p)) var(--smooth-in, 0px), var(--smooth-path);
|
|
79
|
+
--smooth-ring: evenodd var(--smooth-outer), move to calc(var(--smooth-in, 0px) + var(--smooth-t) * var(--smooth-p)) var(--smooth-in, 0px), var(--smooth-path);
|
|
80
|
+
}
|
|
81
|
+
/* The element's own outline, as it worked it out: what its ::before or ::after reads for a ring's outer line. */
|
|
82
|
+
.o-smooth { --smooth-outer: var(--smooth-outline); }
|
|
83
|
+
|
|
84
|
+
/* Eased on a short side: the smoothing from the side and the top radius, on the element alone so its ring takes the same; each number
|
|
85
|
+
from it (at 0.7 these give Apple's within a thousandth). */
|
|
86
|
+
.o-smooth.o-smooth-ease { --smooth-x: clamp(0, tan(atan2(var(--smooth-side), var(--smooth-t) * 2)) - 1, var(--smooth-amount, 0.7)); }
|
|
87
|
+
.o-smooth.o-smooth-ease, .o-smooth.o-smooth-ease::before, .o-smooth.o-smooth-ease::after {
|
|
88
|
+
--smooth-k: calc(sin(45deg * (1 - var(--smooth-x))) * 1.414214);
|
|
89
|
+
--smooth-cc: calc(tan(22.5deg * var(--smooth-x)) * cos(45deg * var(--smooth-x)));
|
|
90
|
+
--smooth-d: calc(tan(22.5deg * var(--smooth-x)) * sin(45deg * var(--smooth-x)));
|
|
91
|
+
--smooth-p: calc(1 + var(--smooth-x));
|
|
92
|
+
--smooth-a2: calc(var(--smooth-p) - var(--smooth-k) - var(--smooth-cc) - var(--smooth-d));
|
|
93
|
+
--smooth-a1: calc(var(--smooth-a2) * 2 / 3);
|
|
94
|
+
--smooth-bc: calc(var(--smooth-a2) / 3 + var(--smooth-cc));
|
|
95
|
+
--smooth-e: calc(var(--smooth-p) - var(--smooth-k) - var(--smooth-d));
|
|
96
|
+
--smooth-hx: calc(tan(22.5deg * (1 - var(--smooth-x))) * 4 / 3 * cos(45deg * var(--smooth-x)));
|
|
97
|
+
--smooth-hy: calc(tan(22.5deg * (1 - var(--smooth-x))) * 4 / 3 * sin(45deg * var(--smooth-x)));
|
|
98
|
+
--smooth-khy: calc(var(--smooth-k) - var(--smooth-hy));
|
|
99
|
+
--smooth-khx: calc(var(--smooth-k) - var(--smooth-hx));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const NOT_ARC = ["tail", "halves", "bars", "pulse"];
|
|
2
|
+
const NOT_RING = ["bars", "pulse"];
|
|
3
|
+
const NOT_BARS = ["arc", "tail", "halves", "pulse"];
|
|
4
|
+
const options = [
|
|
5
|
+
{ id: "kind", name: "Kind", def: "tail", values: [{ id: "arc", name: "Arc" }, { id: "tail", name: "Tail" }, { id: "halves", name: "Two halves" }, { id: "bars", name: "Bars" }, { id: "pulse", name: "Pulse" }] },
|
|
6
|
+
{ id: "breath", name: "Breath", def: "dot", unless: ["kind", NOT_ARC], values: [{ id: "dot", name: "From a dot" }, { id: "slow", name: "Slower" }, { id: "open", name: "Never a dot" }, { id: "soft", name: "Soft" }, { id: "barely", name: "Barely" }] },
|
|
7
|
+
{ id: "line", name: "Line", def: "regular", unless: ["kind", NOT_RING], values: [{ id: "regular", name: "Regular" }, { id: "thin", name: "Thin" }] },
|
|
8
|
+
{ id: "track", name: "Track", def: "none", unless: ["kind", NOT_RING], values: [{ id: "none", name: "None" }, { id: "faint", name: "Faint" }] },
|
|
9
|
+
{ id: "bars", name: "Bars", def: "plain", unless: ["kind", NOT_BARS], values: [{ id: "plain", name: "Plain" }, { id: "eased", name: "Eased" }, { id: "foot", name: "From the foot" }] },
|
|
10
|
+
{ id: "loading", name: "Loading bar", def: "soft", values: [{ id: "slides", name: "Slides" }, { id: "soft", name: "Soft ends" }] },
|
|
11
|
+
];
|
|
12
|
+
const base = { kind: "arc", breath: "dot", line: "regular", track: "none", bars: "plain", loading: "slides" };
|
|
13
|
+
export const SPINNER_LOOKS = {
|
|
14
|
+
id: "spinner",
|
|
15
|
+
name: "Spinner",
|
|
16
|
+
options,
|
|
17
|
+
looks: [
|
|
18
|
+
{ id: "arc", name: "Arc", picks: { ...base } },
|
|
19
|
+
{ id: "slow", name: "Slow arc", picks: { ...base, breath: "slow" } },
|
|
20
|
+
{ id: "open", name: "Never a dot", picks: { ...base, breath: "open" } },
|
|
21
|
+
{ id: "soft", name: "Soft breath", picks: { ...base, breath: "soft" } },
|
|
22
|
+
{ id: "barely", name: "Barely breathing", picks: { ...base, breath: "barely" } },
|
|
23
|
+
{ id: "thin", name: "Thin line", picks: { ...base, breath: "soft", line: "thin" } },
|
|
24
|
+
{ id: "track", name: "On a track", picks: { ...base, breath: "soft", track: "faint" } },
|
|
25
|
+
{ id: "tail", name: "Tail", picks: { ...base, kind: "tail" } },
|
|
26
|
+
{ id: "halves", name: "Two halves", picks: { ...base, kind: "halves" } },
|
|
27
|
+
{ id: "bars", name: "Bars", picks: { ...base, kind: "bars" } },
|
|
28
|
+
{ id: "bars-eased", name: "Eased bars", picks: { ...base, kind: "bars", bars: "eased" } },
|
|
29
|
+
{ id: "equalizer", name: "Equalizer", picks: { ...base, kind: "bars", bars: "foot" } },
|
|
30
|
+
{ id: "pulse", name: "Pulse", picks: { ...base, kind: "pulse" } },
|
|
31
|
+
],
|
|
32
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface SpinnerProps {
|
|
3
|
+
/** Its size in px: 12 in a chip, 14 in a toast or a small button, 16 in a button, field or row, 20 in a panel, 24 in a list, 32 while the app starts, 40 alone on a page. */
|
|
4
|
+
size?: number;
|
|
5
|
+
/** What is loading, said to screen readers ("Loading deals"). Empty when what it stands in for says it, as a busy button does. */
|
|
6
|
+
label?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Something on its way, in the colour of the words beside it: an arc that grows and shrinks as it turns, or whichever of its
|
|
10
|
+
* looks the app wears (a tail, two halves, bars, a pulse). */
|
|
11
|
+
export declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<SVGSVGElement>>;
|
|
12
|
+
export interface LoadingBarProps {
|
|
13
|
+
/** Whether it is loading: the bar shows, and what it holds dims and can't be reached. */
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
/** What is loading, said to screen readers ("Loading deals"). */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** What is loading again: a table's rows, a list. Left out, the bar alone, along the top of the box it stands in, which places it. */
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/** The loading bar: a thin bar sliding along the top of what is loading again (a table whose rows change after a filter or a
|
|
22
|
+
* sort), which stays where it is, dimmed and out of reach, until the new rows are in. */
|
|
23
|
+
export declare function LoadingBar({ loading, label, children, className }: LoadingBarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 LINE = { 12: 6.25, 14: 6.4, 16: 6.25, 20: 5.6, 24: 5.2, 32: 4.7, 40: 4.2 };
|
|
5
|
+
const BARS = [33.33, 46.46, 59.58].map((x, i) => ({ x, at: i ? i * 0.2 - 1 : 0 }));
|
|
6
|
+
const FOOT = [[0.835, -0.14], [1.07, -0.43], [0.74, -0.07], [1.16, -0.64], [0.93, -0.29]].map(([pace, at], i) => ({ x: 31.67 + i * 7.92, pace, at }));
|
|
7
|
+
const set = (vars) => vars;
|
|
8
|
+
export const Spinner = React.forwardRef(function Spinner({ size = 14, label = "Working", className }, ref) {
|
|
9
|
+
return (_jsxs("svg", { ref: ref, className: cx("o-spinner", className), viewBox: "25 25 50 50", style: { width: size, height: size, ...set({ "--o-spinner-l": LINE[size] ?? 6.25 }) }, ...(label ? { role: "status", "aria-label": label } : { "aria-hidden": true }), "data-kit": "spinner", children: [_jsx("circle", { className: "o-spinner-track", cx: "50", cy: "50", r: "20" }), _jsx("circle", { className: "o-spinner-arc", cx: "50", cy: "50", r: "20" }), _jsx("g", { className: "o-spinner-bars", children: BARS.map((b) => _jsx("rect", { x: b.x, y: "33.33", width: "7.08", height: "33.33", rx: "3.54", style: set({ "--o-spinner-at": b.at }) }, b.x)) }), _jsx("g", { className: "o-spinner-bars o-spinner-foot", children: FOOT.map((b) => _jsx("rect", { x: b.x, y: "33.33", width: "5", height: "33.33", rx: "2.5", style: set({ "--o-spinner-at": b.at, "--o-spinner-pace": b.pace }) }, b.x)) }), _jsx("circle", { className: "o-spinner-dot", cx: "50", cy: "50", r: "6.67" }), _jsx("circle", { className: "o-spinner-ring", cx: "50", cy: "50", r: "8.33" })] }));
|
|
10
|
+
});
|
|
11
|
+
export function LoadingBar({ loading = true, label = "Loading", children, className }) {
|
|
12
|
+
const bar = loading ? _jsx("span", { className: "o-loading-bar", role: "progressbar", "aria-label": label, "data-kit": children === undefined ? "spinner" : undefined }) : null;
|
|
13
|
+
if (children === undefined)
|
|
14
|
+
return bar;
|
|
15
|
+
return (_jsxs("div", { className: cx("o-loading", className), "data-loading": loading ? "" : undefined, "aria-busy": loading || undefined, "data-kit": "spinner", children: [bar, _jsx("div", { className: "o-loading-held", inert: loading || undefined, children: children })] }));
|
|
16
|
+
}
|