@mrpelz/uikit-ish 7.11.0 → 7.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/action-sheet/main.d.ts.map +1 -1
- package/dist/components/action-sheet/main.js +2 -1
- package/dist/components/action-sheet/main.js.map +1 -1
- package/dist/components/action-sheet/style.css +6 -0
- package/dist/components/activity-view/main.d.ts.map +1 -1
- package/dist/components/activity-view/main.js +5 -0
- package/dist/components/activity-view/main.js.map +1 -1
- package/dist/components/activity-view/style.css +8 -0
- package/dist/components/alert/main.d.ts.map +1 -1
- package/dist/components/alert/main.js +2 -1
- package/dist/components/alert/main.js.map +1 -1
- package/dist/components/color-picker/main.d.ts +0 -3
- package/dist/components/color-picker/main.d.ts.map +1 -1
- package/dist/components/color-picker/main.js +29 -15
- package/dist/components/color-picker/main.js.map +1 -1
- package/dist/components/color-picker/style.css +20 -17
- package/dist/components/contextual-menu/main.d.ts +2 -2
- package/dist/components/contextual-menu/main.d.ts.map +1 -1
- package/dist/components/contextual-menu/main.js +19 -7
- package/dist/components/contextual-menu/main.js.map +1 -1
- package/dist/components/contextual-menu/props.d.ts +10 -1
- package/dist/components/contextual-menu/props.d.ts.map +1 -1
- package/dist/components/drawer/main.d.ts.map +1 -1
- package/dist/components/drawer/main.js +2 -1
- package/dist/components/drawer/main.js.map +1 -1
- package/dist/components/edit-menu/style.css +7 -2
- package/dist/components/glass/style.css +20 -1
- package/dist/components/index.d.ts +6 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/island/main.d.ts +27 -0
- package/dist/components/island/main.d.ts.map +1 -0
- package/dist/components/island/main.js +409 -0
- package/dist/components/island/main.js.map +1 -0
- package/dist/components/island/props.d.ts +54 -0
- package/dist/components/island/props.d.ts.map +1 -0
- package/dist/components/island/props.js +2 -0
- package/dist/components/island/props.js.map +1 -0
- package/dist/components/island/style.css +404 -0
- package/dist/components/layout/props.d.ts +4 -3
- package/dist/components/layout/props.d.ts.map +1 -1
- package/dist/components/layout/style.css +37 -0
- package/dist/components/list/main.d.ts.map +1 -1
- package/dist/components/list/main.js +89 -17
- package/dist/components/list/main.js.map +1 -1
- package/dist/components/list/props.d.ts +4 -1
- package/dist/components/list/props.d.ts.map +1 -1
- package/dist/components/list/reorder.d.ts.map +1 -1
- package/dist/components/list/reorder.js +24 -0
- package/dist/components/list/reorder.js.map +1 -1
- package/dist/components/list/style.css +22 -3
- package/dist/components/menu/main.d.ts +7 -0
- package/dist/components/menu/main.d.ts.map +1 -1
- package/dist/components/menu/main.js +32 -2
- package/dist/components/menu/main.js.map +1 -1
- package/dist/components/menu/style.css +15 -4
- package/dist/components/navigation/main.d.ts +4 -2
- package/dist/components/navigation/main.d.ts.map +1 -1
- package/dist/components/navigation/main.js +115 -11
- package/dist/components/navigation/main.js.map +1 -1
- package/dist/components/navigation/props.d.ts +12 -1
- package/dist/components/navigation/props.d.ts.map +1 -1
- package/dist/components/navigation/style.css +25 -0
- package/dist/components/page/main.d.ts.map +1 -1
- package/dist/components/page/main.js +10 -5
- package/dist/components/page/main.js.map +1 -1
- package/dist/components/page/props.d.ts +8 -0
- package/dist/components/page/props.d.ts.map +1 -1
- package/dist/components/page/style.css +17 -0
- package/dist/components/popover/main.d.ts +4 -4
- package/dist/components/popover/main.d.ts.map +1 -1
- package/dist/components/popover/main.js +61 -24
- package/dist/components/popover/main.js.map +1 -1
- package/dist/components/popover/props.d.ts +26 -0
- package/dist/components/popover/props.d.ts.map +1 -1
- package/dist/components/popover/style.css +67 -3
- package/dist/components/progress/main.d.ts.map +1 -1
- package/dist/components/progress/main.js +47 -6
- package/dist/components/progress/main.js.map +1 -1
- package/dist/components/progress/style.css +4 -7
- package/dist/components/roll/main.d.ts.map +1 -1
- package/dist/components/roll/main.js +1 -1
- package/dist/components/roll/main.js.map +1 -1
- package/dist/components/roll/style.css +5 -0
- package/dist/components/settings/main.d.ts +21 -0
- package/dist/components/settings/main.d.ts.map +1 -0
- package/dist/components/settings/main.js +182 -0
- package/dist/components/settings/main.js.map +1 -0
- package/dist/components/settings/props.d.ts +44 -0
- package/dist/components/settings/props.d.ts.map +1 -0
- package/dist/components/settings/props.js +2 -0
- package/dist/components/settings/props.js.map +1 -0
- package/dist/components/settings/style.css +8 -0
- package/dist/components/sheet/main.d.ts +9 -4
- package/dist/components/sheet/main.d.ts.map +1 -1
- package/dist/components/sheet/main.js +352 -16
- package/dist/components/sheet/main.js.map +1 -1
- package/dist/components/sheet/props.d.ts +28 -2
- package/dist/components/sheet/props.d.ts.map +1 -1
- package/dist/components/sheet/snap.d.ts +21 -0
- package/dist/components/sheet/snap.d.ts.map +1 -0
- package/dist/components/sheet/snap.js +363 -0
- package/dist/components/sheet/snap.js.map +1 -0
- package/dist/components/sheet/style.css +378 -19
- package/dist/components/sidebar/main.d.ts.map +1 -1
- package/dist/components/sidebar/main.js +6 -4
- package/dist/components/sidebar/main.js.map +1 -1
- package/dist/components/sidebar/style.css +17 -35
- package/dist/components/switch/style.css +2 -2
- package/dist/components/tab-bar/main.d.ts.map +1 -1
- package/dist/components/tab-bar/main.js +15 -8
- package/dist/components/tab-bar/main.js.map +1 -1
- package/dist/components/tab-bar/props.d.ts +2 -1
- package/dist/components/tab-bar/props.d.ts.map +1 -1
- package/dist/components/text-field/main.d.ts +2 -2
- package/dist/components/text-field/main.d.ts.map +1 -1
- package/dist/components/text-field/main.js +30 -10
- package/dist/components/text-field/main.js.map +1 -1
- package/dist/components/text-field/props.d.ts +5 -5
- package/dist/components/text-field/props.d.ts.map +1 -1
- package/dist/components/text-field/style.css +49 -20
- package/dist/components/tooltip/main.d.ts +1 -1
- package/dist/components/tooltip/main.d.ts.map +1 -1
- package/dist/components/tooltip/main.js +123 -8
- package/dist/components/tooltip/main.js.map +1 -1
- package/dist/components/utils/main.d.ts +7 -5
- package/dist/components/utils/main.d.ts.map +1 -1
- package/dist/components/utils/main.js +5 -3
- package/dist/components/utils/main.js.map +1 -1
- package/dist/components/viewport/edge-effect.d.ts.map +1 -1
- package/dist/components/viewport/edge-effect.js +128 -2
- package/dist/components/viewport/edge-effect.js.map +1 -1
- package/dist/components/viewport/edge.d.ts +1 -1
- package/dist/components/viewport/edge.d.ts.map +1 -1
- package/dist/components/viewport/edge.js +3 -3
- package/dist/components/viewport/edge.js.map +1 -1
- package/dist/components/viewport/input.d.ts +3 -1
- package/dist/components/viewport/input.d.ts.map +1 -1
- package/dist/components/viewport/input.js +57 -9
- package/dist/components/viewport/input.js.map +1 -1
- package/dist/components/viewport/ios27.d.ts +14 -0
- package/dist/components/viewport/ios27.d.ts.map +1 -0
- package/dist/components/viewport/ios27.js +28 -0
- package/dist/components/viewport/ios27.js.map +1 -0
- package/dist/components/viewport/main.d.ts +4 -2
- package/dist/components/viewport/main.d.ts.map +1 -1
- package/dist/components/viewport/main.js +206 -36
- package/dist/components/viewport/main.js.map +1 -1
- package/dist/components/viewport/padding.d.ts +12 -0
- package/dist/components/viewport/padding.d.ts.map +1 -1
- package/dist/components/viewport/padding.js +70 -14
- package/dist/components/viewport/padding.js.map +1 -1
- package/dist/components/viewport/props.d.ts +12 -1
- package/dist/components/viewport/props.d.ts.map +1 -1
- package/dist/components/viewport/style.css +41 -4
- package/dist/styles.css +56 -0
- package/package.json +6 -4
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/* Island (see main.tsx). */
|
|
2
|
+
@layer uikit-ish {
|
|
3
|
+
/* Its anchor (a bottom `Viewport.Anchor`, holding it): touches through
|
|
4
|
+
it, but on the island (to the content beneath, e.g. a map, beside it;
|
|
5
|
+
above it, snapping, its scroller's). */
|
|
6
|
+
:where(.uikit-viewport-anchor):has(> .uikit-island) {
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Its box: as tall as it shows (its content's, or its stop's), 8px from
|
|
11
|
+
the screen's edges, the bottom too (the home indicator over its bottom
|
|
12
|
+
margin, as iOS 26's floating sheets); its corners 42px (theirs,
|
|
13
|
+
measured); regular, a
|
|
14
|
+
floating panel at the inline start. Its content's edge effects as a
|
|
15
|
+
medium sheet's (its glass not lightened by a backing, nor blurred
|
|
16
|
+
twice: its content fading out under its header instead). */
|
|
17
|
+
.uikit-island {
|
|
18
|
+
--uikit-viewport-edge-background: transparent;
|
|
19
|
+
--uikit-viewport-edge-veil: 0.75;
|
|
20
|
+
|
|
21
|
+
position: relative;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
border-radius: var(--uikit-island-radius);
|
|
24
|
+
|
|
25
|
+
/* (Its anchor's bottom inset, kept clear by its padding: moved back
|
|
26
|
+
into it, to 8px from the edge.) */
|
|
27
|
+
margin: 0 8px calc(8px - var(--uikit-viewport-safe-bottom, 0px));
|
|
28
|
+
color: var(--uikit-glass-content);
|
|
29
|
+
|
|
30
|
+
/* Its corners 42px (snapping, following what's shown: see below). */
|
|
31
|
+
--uikit-island-radius: 42px;
|
|
32
|
+
|
|
33
|
+
&[data-regular] {
|
|
34
|
+
width: min(375px, 100% - 20px);
|
|
35
|
+
margin-inline: 10px auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Snapping: its scroller (as tall as it may be) clipped to its box, its
|
|
39
|
+
box reaching above it (`--uikit-island-reach`; its place as tall as
|
|
40
|
+
it shows): touched on it alone and its reach, the content beneath
|
|
41
|
+
above it (its shadow kept, beside it, below it); a sliver's further
|
|
42
|
+
(a grabber's alone: small, by the home indicator). Moved (see
|
|
43
|
+
main.tsx), reaching up all of its scroller (its clip kept: iOS, its
|
|
44
|
+
clip lifted as it's touched, drops the touch's pan). */
|
|
45
|
+
&[data-snap] {
|
|
46
|
+
--uikit-island-reach: 24px;
|
|
47
|
+
|
|
48
|
+
overflow: visible clip;
|
|
49
|
+
height: calc(var(--uikit-island-shown) + var(--uikit-island-reach));
|
|
50
|
+
padding-top: var(--uikit-island-reach);
|
|
51
|
+
margin-top: calc(-1 * var(--uikit-island-reach));
|
|
52
|
+
|
|
53
|
+
/* Its corners following what's shown (its lowest stop and as far as
|
|
54
|
+
it's scrolled up past it: its scroller's timeline, named for it),
|
|
55
|
+
shown shorter than both (e.g. its header alone), a capsule, half
|
|
56
|
+
as tall (its top corners, its panel's, and its bottom ones, its
|
|
57
|
+
scroller's clip and rim, meeting, not overlapping). */
|
|
58
|
+
animation: uikit-island-corners linear both;
|
|
59
|
+
animation-range: 0 max(0px, 84px - var(--uikit-island-lowest, 0px));
|
|
60
|
+
animation-timeline: --uikit-island-scroll;
|
|
61
|
+
overflow-clip-margin: 16px;
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
timeline-scope: --uikit-island-scroll;
|
|
64
|
+
|
|
65
|
+
/* Its rim's bottom and its corners (its panel's glass draws the
|
|
66
|
+
rest, never its bottom: see the glass): over its scroller (the
|
|
67
|
+
panel's bottom below its clip, its sides clipped round its
|
|
68
|
+
corners); a sliver's fading in as its glass does. */
|
|
69
|
+
&::after {
|
|
70
|
+
position: absolute;
|
|
71
|
+
height: var(--uikit-island-radius);
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
border: 1px solid var(--glass-ui-panel-rim);
|
|
74
|
+
border-radius: 0 0 var(--uikit-island-radius)
|
|
75
|
+
var(--uikit-island-radius);
|
|
76
|
+
border-top: 0;
|
|
77
|
+
content: '';
|
|
78
|
+
inset: auto 0 0;
|
|
79
|
+
|
|
80
|
+
/* Its sides' start faded in by as much as the scroller's clip cuts
|
|
81
|
+
off the panel's own straight rim there (42px − √(42² − d²) at
|
|
82
|
+
d px down its arc), the two never drawn over each other. */
|
|
83
|
+
mask-image: linear-gradient(
|
|
84
|
+
transparent,
|
|
85
|
+
rgb(0 0 0 / 5%) 2px,
|
|
86
|
+
rgb(0 0 0 / 19%) 4px,
|
|
87
|
+
rgb(0 0 0 / 43%) 6px,
|
|
88
|
+
rgb(0 0 0 / 77%) 8px,
|
|
89
|
+
rgb(0 0 0 / 98%) 9px,
|
|
90
|
+
#000 9.1px
|
|
91
|
+
);
|
|
92
|
+
opacity: var(--uikit-island-sliver, 1);
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&[data-snap][data-sliver] {
|
|
98
|
+
--uikit-island-reach: 44px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&[data-snap][data-moving] {
|
|
102
|
+
--uikit-island-reach: max(
|
|
103
|
+
0px,
|
|
104
|
+
var(--uikit-island-max-height) - var(--uikit-island-shown)
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Snapping (see main.tsx, sheet/snap.ts): a scroller pinned to its
|
|
110
|
+
bottom, as tall as it may be (overflowing it upward), its bars hidden,
|
|
111
|
+
its corners the capsule's (its panel's clipped round below); touched
|
|
112
|
+
on all of it (above its capsule too: iOS scrolls no scroller touches
|
|
113
|
+
pass through), not bounced (iOS: below its lowest stop, it'd be dragged
|
|
114
|
+
down; its content's handing back to it its own). Not snapping: no box
|
|
115
|
+
of its own (its corners passed on). */
|
|
116
|
+
.uikit-island-scroller {
|
|
117
|
+
display: contents;
|
|
118
|
+
border-radius: inherit;
|
|
119
|
+
|
|
120
|
+
.uikit-island[data-snap] > & {
|
|
121
|
+
position: absolute;
|
|
122
|
+
bottom: 0;
|
|
123
|
+
display: block;
|
|
124
|
+
overflow: hidden auto;
|
|
125
|
+
height: var(--uikit-island-max-height);
|
|
126
|
+
inset-inline: 0;
|
|
127
|
+
overscroll-behavior: none;
|
|
128
|
+
pointer-events: auto;
|
|
129
|
+
scroll-snap-type: y mandatory;
|
|
130
|
+
scroll-timeline: --uikit-island-scroll block;
|
|
131
|
+
scrollbar-width: none;
|
|
132
|
+
|
|
133
|
+
&::-webkit-scrollbar {
|
|
134
|
+
display: none;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* The room it's scrolled up out of (snapping), short of its lowest stop
|
|
140
|
+
(never scrolled below it), its stops in one cell, each down by its own
|
|
141
|
+
(within it: `cqh`), in whole pixels (its scroll's range too, see
|
|
142
|
+
Sheet's); else none. */
|
|
143
|
+
.uikit-island-spacer {
|
|
144
|
+
display: none;
|
|
145
|
+
|
|
146
|
+
.uikit-island[data-snap] > .uikit-island-scroller > & {
|
|
147
|
+
display: grid;
|
|
148
|
+
height: round(down, 100% - var(--uikit-island-lowest, 0px), 1px);
|
|
149
|
+
container-type: size;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* Its stops: where it snaps, scrolled by as much (by their start; 1px
|
|
154
|
+
high: iOS snaps to no area without a height); flung, one at a time. */
|
|
155
|
+
.uikit-island-stop {
|
|
156
|
+
height: 1px;
|
|
157
|
+
align-self: start;
|
|
158
|
+
grid-area: 1 / 1;
|
|
159
|
+
scroll-snap-align: start;
|
|
160
|
+
scroll-snap-stop: always;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Its capsule (its glass's colors by class, drawn by its glass layer):
|
|
164
|
+
its header over its content; as tall as its content (up to as tall as
|
|
165
|
+
it may be), or (snapping) as the scroller, scrolled up into it; its
|
|
166
|
+
content's edge effects fixed to it. None left of the screen's insets
|
|
167
|
+
for what's in it (kept clear by its anchor; the home indicator over
|
|
168
|
+
its bottom margin, see the island). */
|
|
169
|
+
.uikit-island-panel {
|
|
170
|
+
--uikit-safe-area-inset-top: 0px;
|
|
171
|
+
--uikit-safe-area-inset-right: 0px;
|
|
172
|
+
--uikit-safe-area-inset-bottom: 0px;
|
|
173
|
+
--uikit-safe-area-inset-left: 0px;
|
|
174
|
+
|
|
175
|
+
position: relative;
|
|
176
|
+
display: flex;
|
|
177
|
+
overflow: hidden;
|
|
178
|
+
max-height: var(--uikit-island-max-height, none);
|
|
179
|
+
box-sizing: border-box;
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
border-radius: inherit;
|
|
182
|
+
backdrop-filter: none;
|
|
183
|
+
background-color: transparent;
|
|
184
|
+
box-shadow: none;
|
|
185
|
+
contain: layout;
|
|
186
|
+
isolation: isolate;
|
|
187
|
+
pointer-events: auto;
|
|
188
|
+
|
|
189
|
+
.uikit-island[data-snap] > .uikit-island-scroller > & {
|
|
190
|
+
height: 100%;
|
|
191
|
+
max-height: none;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Its glass (a medium material's), behind its content; a sliver's
|
|
196
|
+
fading in as it's swiped up past it (`--uikit-island-sliver`). */
|
|
197
|
+
.uikit-island-glass {
|
|
198
|
+
position: absolute;
|
|
199
|
+
z-index: -1;
|
|
200
|
+
border-radius: inherit;
|
|
201
|
+
backdrop-filter: saturate(180%) blur(16px);
|
|
202
|
+
background-color: var(--uikit-glass-background);
|
|
203
|
+
box-shadow: var(--uikit-glass-shadow);
|
|
204
|
+
inset: 0;
|
|
205
|
+
opacity: var(--uikit-island-sliver, 1);
|
|
206
|
+
pointer-events: none;
|
|
207
|
+
|
|
208
|
+
/* Snapping: its rim its top and sides alone (its bottom the island's,
|
|
209
|
+
see there, at the scroller's edge in every state: its own, below or
|
|
210
|
+
on it, would show a second pair of corners through its clip). */
|
|
211
|
+
.uikit-island[data-snap] & {
|
|
212
|
+
box-shadow: none;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* Its header, over its content (as a sheet's: its grabber, 10px below
|
|
217
|
+
its bar; without a grabber, its bar 16px down). */
|
|
218
|
+
.uikit-island-header {
|
|
219
|
+
position: absolute;
|
|
220
|
+
z-index: 10;
|
|
221
|
+
display: flex;
|
|
222
|
+
flex-direction: column;
|
|
223
|
+
align-items: stretch;
|
|
224
|
+
inset: 0 0 auto;
|
|
225
|
+
-webkit-user-select: none;
|
|
226
|
+
user-select: none;
|
|
227
|
+
|
|
228
|
+
&::after {
|
|
229
|
+
height: 10px;
|
|
230
|
+
flex: none;
|
|
231
|
+
content: '';
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
&:not(:has(> .uikit-island-grabber))::before {
|
|
235
|
+
height: 16px;
|
|
236
|
+
flex: none;
|
|
237
|
+
content: '';
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* Only a grabber (and a sliver's stop): no bar. */
|
|
241
|
+
&:not(:has(> :not(.uikit-island-grabber, .uikit-island-snap-group)))::after {
|
|
242
|
+
display: none;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* The grabber, its cursor's area around it (as a sheet's); a sliver's,
|
|
247
|
+
its glass a pill of its own around it (fading out as the capsule's
|
|
248
|
+
fades in). */
|
|
249
|
+
.uikit-island-grabber {
|
|
250
|
+
--uikit-utils-cursor: attr(cursor type(<custom-ident>), grab);
|
|
251
|
+
|
|
252
|
+
position: relative;
|
|
253
|
+
display: flex;
|
|
254
|
+
flex: none;
|
|
255
|
+
align-self: center;
|
|
256
|
+
padding: 5px 12px 6px;
|
|
257
|
+
border-radius: 100px;
|
|
258
|
+
isolation: isolate;
|
|
259
|
+
|
|
260
|
+
&::before {
|
|
261
|
+
width: 36px;
|
|
262
|
+
height: 5px;
|
|
263
|
+
border-radius: 100px;
|
|
264
|
+
background-color: #cfcfcf;
|
|
265
|
+
content: '';
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&::after {
|
|
269
|
+
position: absolute;
|
|
270
|
+
z-index: -1;
|
|
271
|
+
display: none;
|
|
272
|
+
border-radius: inherit;
|
|
273
|
+
backdrop-filter: saturate(180%) blur(16px);
|
|
274
|
+
background-color: var(--uikit-glass-background);
|
|
275
|
+
box-shadow: var(--uikit-glass-shadow);
|
|
276
|
+
content: '';
|
|
277
|
+
inset: 0;
|
|
278
|
+
opacity: calc(1 - var(--uikit-island-sliver, 1));
|
|
279
|
+
pointer-events: none;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.uikit-island[data-sliver] &::after {
|
|
283
|
+
display: block;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
@media (hover: hover) {
|
|
287
|
+
cursor: var(--uikit-utils-cursor);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* Its content, scrolling under its header; snapping, at its top stop
|
|
292
|
+
only (else the scroller's: at its start, a pull down handed back).
|
|
293
|
+
Clipped round itself (WebKit draws a composited scroller past its
|
|
294
|
+
parent's rounded clip). */
|
|
295
|
+
|
|
296
|
+
/* Its corners' radius (following its scroll, see the property) kept
|
|
297
|
+
off what's in it: inherited, everything in it would be restyled on
|
|
298
|
+
each frame of a scroll (costly; iOS's WebKit keeps much of that
|
|
299
|
+
memory). Its readers keep it (its panel, its rim, its content's clip),
|
|
300
|
+
not their children. (Not `inherits: false`: iOS's WebKit then
|
|
301
|
+
doesn't follow its animation where it's read. See the guide's
|
|
302
|
+
iOS Quirks page.) */
|
|
303
|
+
/* stylelint-disable no-descending-specificity -- a custom property only
|
|
304
|
+
the readers' children have (no rule above sets it) */
|
|
305
|
+
.uikit-island-panel > :not(.uikit-island-content, :has(.uikit-island-content)),
|
|
306
|
+
:where(.uikit-island-content) > * {
|
|
307
|
+
--uikit-island-radius: initial;
|
|
308
|
+
}
|
|
309
|
+
/* stylelint-enable no-descending-specificity */
|
|
310
|
+
|
|
311
|
+
.uikit-island-content {
|
|
312
|
+
overflow: auto;
|
|
313
|
+
min-height: 0;
|
|
314
|
+
flex: 1 1 auto;
|
|
315
|
+
clip-path: inset(0 round var(--uikit-island-radius, 42px));
|
|
316
|
+
overscroll-behavior: contain;
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
:where(.uikit-island[data-snap] > .uikit-island-scroller > .uikit-island-panel) > & {
|
|
320
|
+
overscroll-behavior: auto;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/* (Pulled down a stop: until it's bounced back, see sheet/snap.ts.) */
|
|
324
|
+
:where(.uikit-island[data-snap] > .uikit-island-scroller:not([data-snap-top]) > .uikit-island-panel)
|
|
325
|
+
> &:not([data-pulled]) {
|
|
326
|
+
overflow: hidden;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* Under its header (a bar, not only a grabber), fading out (as a
|
|
330
|
+
sheet's): hidden under the share of it the veil is, showing past it
|
|
331
|
+
and its soft effect's reach; only as content scrolls under it. */
|
|
332
|
+
.uikit-island-panel:has(
|
|
333
|
+
> .uikit-island-header > :not(.uikit-island-grabber, .uikit-island-snap-group)
|
|
334
|
+
)
|
|
335
|
+
> & {
|
|
336
|
+
mask-image: linear-gradient(
|
|
337
|
+
rgb(0 0 0 / calc(1 - var(--uikit-viewport-edge-start-progress, 1)))
|
|
338
|
+
calc(
|
|
339
|
+
var(--uikit-viewport-padding-block-start, 0px) *
|
|
340
|
+
var(--uikit-viewport-edge-veil, 0.75)
|
|
341
|
+
),
|
|
342
|
+
#000 calc(var(--uikit-viewport-padding-block-start, 0px) + 16px)
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* Its content's edge effects: within its corners, no blur (see above). */
|
|
348
|
+
.uikit-island-panel > .uikit-viewport-edge-effect {
|
|
349
|
+
&[data-edge='block-start'] {
|
|
350
|
+
border-start-end-radius: inherit;
|
|
351
|
+
border-start-start-radius: inherit;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&[data-edge='block-end'] {
|
|
355
|
+
border-end-end-radius: inherit;
|
|
356
|
+
border-end-start-radius: inherit;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&::before,
|
|
360
|
+
&::after {
|
|
361
|
+
border-radius: inherit;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
&[data-edge-effect='soft']::before {
|
|
365
|
+
backdrop-filter: none;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/* A snapping one's glass's rim (see the glass). */
|
|
370
|
+
.uikit-island[data-snap] .uikit-island-glass::before {
|
|
371
|
+
position: absolute;
|
|
372
|
+
box-sizing: border-box;
|
|
373
|
+
border: 1px solid var(--glass-ui-panel-rim);
|
|
374
|
+
border-radius: inherit;
|
|
375
|
+
border-bottom: 0;
|
|
376
|
+
border-end-end-radius: 0;
|
|
377
|
+
border-end-start-radius: 0;
|
|
378
|
+
content: '';
|
|
379
|
+
inset: 0;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* Its snap groups spaced as list sections are (see a sheet's). */
|
|
383
|
+
.uikit-island-snap-group:not(:empty) + .uikit-island-snap-group {
|
|
384
|
+
padding-block-start: var(--uikit-list-section-spacing, 35px);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
@keyframes uikit-island-corners {
|
|
389
|
+
from {
|
|
390
|
+
--uikit-island-radius: min(42px, var(--uikit-island-lowest, 0px) / 2);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
to {
|
|
394
|
+
--uikit-island-radius: 42px;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/* Its corners' radius (see the island): a length, so it's animated
|
|
399
|
+
(following its scroll). */
|
|
400
|
+
@property --uikit-island-radius {
|
|
401
|
+
inherits: true;
|
|
402
|
+
initial-value: 42px;
|
|
403
|
+
syntax: '<length>';
|
|
404
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
2
|
export type LayoutColumnProps = ComponentProps<'div'> & {
|
|
3
3
|
/**
|
|
4
|
-
* Next to a floating column (see `floating`): its pages' content
|
|
5
|
-
* the floating column's size
|
|
6
|
-
* backgrounds running underneath
|
|
4
|
+
* Next to a floating column (see `floating`): its pages' content (and a
|
|
5
|
+
* `Viewport.Content`'s, its bars') inset by the floating column's size
|
|
6
|
+
* (`--uikit-layout-inset-start`), their backgrounds running underneath
|
|
7
|
+
* it.
|
|
7
8
|
*/
|
|
8
9
|
clearFloating?: boolean;
|
|
9
10
|
/** Its initial size (px, uncontrolled); without a size, it's flexible. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/layout/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACtD
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/layout/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACtD;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
/* (For its background, behind its columns.) */
|
|
15
15
|
isolation: isolate;
|
|
16
|
+
|
|
17
|
+
/* Its floating column's size (set as it's laid out, see main.tsx):
|
|
18
|
+
none, unless it has one (not inherited from a layout around it). */
|
|
19
|
+
--uikit-layout-floating-size: 0px;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
.uikit-layout-background {
|
|
@@ -46,6 +50,10 @@
|
|
|
46
50
|
flex: var(--uikit-layout-column-flex, 1 1 0);
|
|
47
51
|
flex-direction: column;
|
|
48
52
|
|
|
53
|
+
/* Its pages' inset (see below): none, unless it's clear of a floating
|
|
54
|
+
column (not inherited from a column around its layout). */
|
|
55
|
+
--uikit-layout-inset-start: 0px;
|
|
56
|
+
|
|
49
57
|
/* The containing block of its fixed layers (e.g. a header's bar, a
|
|
50
58
|
`Viewport` anchor): spanning it, not the screen. */
|
|
51
59
|
contain: layout;
|
|
@@ -93,6 +101,35 @@
|
|
|
93
101
|
) {
|
|
94
102
|
padding-inline-start: var(--uikit-layout-inset-start);
|
|
95
103
|
}
|
|
104
|
+
|
|
105
|
+
/* A content layer in it (e.g. a screen's own provider's): its
|
|
106
|
+
content clear of it too, unless its child scrolls on its own (a
|
|
107
|
+
page: clearing it itself). */
|
|
108
|
+
& .uikit-viewport-content:not(
|
|
109
|
+
:has(
|
|
110
|
+
> :is(
|
|
111
|
+
.uikit-page-root,
|
|
112
|
+
.uikit-header-root,
|
|
113
|
+
.uikit-layout-root,
|
|
114
|
+
.uikit-navigation-root
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
) {
|
|
118
|
+
padding-inline-start: max(
|
|
119
|
+
var(--uikit-viewport-safe-left),
|
|
120
|
+
var(--uikit-layout-inset-start)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* What shows past a content layer's end (see Viewport's
|
|
125
|
+
`Overscroll`, e.g. a refresh indicator): centered clear of it, as
|
|
126
|
+
the content. */
|
|
127
|
+
& .uikit-viewport-overscroll-area {
|
|
128
|
+
padding-inline-start: max(
|
|
129
|
+
var(--uikit-viewport-safe-left),
|
|
130
|
+
var(--uikit-layout-inset-start)
|
|
131
|
+
);
|
|
132
|
+
}
|
|
96
133
|
}
|
|
97
134
|
|
|
98
135
|
/* The hairline between columns. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/list/main.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAKL,iBAAiB,EAEjB,UAAU,EAEV,SAAS,EAWV,MAAM,OAAO,CAAC;AAGf,OAAO,EAKL,cAAc,EACf,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,KAAK,EAEV,uBAAuB,EAIvB,sBAAsB,EACtB,sBAAsB,EAEtB,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EAEnB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,aAAa,EAIb,SAAS,EAIT,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,aAAa,EACb,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,iBAAiB,EACjB,OAAO,EAMR,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/list/main.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAKL,iBAAiB,EAEjB,UAAU,EAEV,SAAS,EAWV,MAAM,OAAO,CAAC;AAGf,OAAO,EAKL,cAAc,EACf,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,KAAK,EAEV,uBAAuB,EAIvB,sBAAsB,EACtB,sBAAsB,EAEtB,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EAEnB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,aAAa,EAIb,SAAS,EAIT,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,aAAa,EACb,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,iBAAiB,EACjB,OAAO,EAMR,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AA+/BnC;;;;GAIG;AACH,eAAO,MAAM,cAAc,QACzB,IAAI,CAAC,uBAAuB,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG,SACxB,CAAC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAO,OAAO,GAAG,SACX,CAAC;AAgxDnC;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GACtB,UAAU,MAAM,MAChB,OAAO,UAAU,CAAC,WAAW,CAAC,KAAG,IAOjC,CAAC;AAEJ,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA13DM,KAAK,oFAOzB,sBAAsB,CAAC,KAAK,CAAC,KAAG,SAAS;oBAgCrB,KAAK,yEAKzB,sBAAsB,CAAC,KAAK,CAAC,KAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA63D3C,CAAC"}
|
|
@@ -534,6 +534,8 @@ const snapPoints = [
|
|
|
534
534
|
'trailingArmed',
|
|
535
535
|
'trailingOverswipe',
|
|
536
536
|
];
|
|
537
|
+
/** The snap points a row stops at even when flung (see `Item`). */
|
|
538
|
+
const stopPoints = new Set(['closed', 'leading', 'trailing']);
|
|
537
539
|
/**
|
|
538
540
|
* Where a row snaps armed: twice the arming distance from its place, past
|
|
539
541
|
* its actions (or across the whole row, if less, see `snapPlaces`).
|
|
@@ -905,6 +907,25 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
905
907
|
const left = isRightToLeft ? offset - lead() : lead() - offset;
|
|
906
908
|
item.scrollTo({ behavior: isSmooth ? 'smooth' : 'instant', left });
|
|
907
909
|
};
|
|
910
|
+
// Scrolled somewhere by the row itself (opened, closed, reopened, across
|
|
911
|
+
// the whole row; not the user's scroll): its snapping off meanwhile, and
|
|
912
|
+
// brought back there at rest until it arrives (see `settle`: Safari's
|
|
913
|
+
// snapping, its early `scrollend`s, fighting a smooth scroll in a
|
|
914
|
+
// snapping scroller), or a touch takes over.
|
|
915
|
+
const targetRef = useRef(undefined);
|
|
916
|
+
const scrollToTarget = (offset) => {
|
|
917
|
+
const { current: item } = itemRef;
|
|
918
|
+
if (!item)
|
|
919
|
+
return;
|
|
920
|
+
if (Math.abs(offsetOf(item) - offset) < 1) {
|
|
921
|
+
targetRef.current = undefined;
|
|
922
|
+
item.style.removeProperty('scroll-snap-type');
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
targetRef.current = offset;
|
|
926
|
+
item.style.scrollSnapType = 'none';
|
|
927
|
+
scrollTo(offset, true);
|
|
928
|
+
};
|
|
908
929
|
// The track's room on a side: the actions' width; across the whole row
|
|
909
930
|
// only while overswiping it is possible (see `overswipable`), so a scroll
|
|
910
931
|
// opening the actions stops at them, not past them (snapping back).
|
|
@@ -1062,7 +1083,7 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
1062
1083
|
closingRef.current = true;
|
|
1063
1084
|
lock();
|
|
1064
1085
|
// (Its snap points change once closed, see `settle`.)
|
|
1065
|
-
|
|
1086
|
+
scrollToTarget(0);
|
|
1066
1087
|
},
|
|
1067
1088
|
focus: (side) => {
|
|
1068
1089
|
if (openSideRef.current !== side)
|
|
@@ -1086,7 +1107,7 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
1086
1107
|
openSideRef.current = side;
|
|
1087
1108
|
lock();
|
|
1088
1109
|
showSnaps();
|
|
1089
|
-
|
|
1110
|
+
scrollToTarget((side === 'leading' ? 1 : -1) * width);
|
|
1090
1111
|
if (outsideRef.current)
|
|
1091
1112
|
return;
|
|
1092
1113
|
outsideRef.current = (event) => {
|
|
@@ -1154,7 +1175,7 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
1154
1175
|
if (!openSide || canConceal(openSide))
|
|
1155
1176
|
return false;
|
|
1156
1177
|
const { [openSide]: width = 0 } = swipeRef.current.widths;
|
|
1157
|
-
|
|
1178
|
+
scrollToTarget((openSide === 'leading' ? 1 : -1) * width);
|
|
1158
1179
|
return true;
|
|
1159
1180
|
};
|
|
1160
1181
|
// Closed, at rest.
|
|
@@ -1168,18 +1189,64 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
1168
1189
|
closeOpenItem = undefined;
|
|
1169
1190
|
resetRow(item);
|
|
1170
1191
|
};
|
|
1192
|
+
// Scrolled by the row itself (see `scrollToTarget`), not there yet:
|
|
1193
|
+
// on there (true); there, no longer.
|
|
1194
|
+
const isOnItsWay = (item) => {
|
|
1195
|
+
const { current: target } = targetRef;
|
|
1196
|
+
if (target === undefined)
|
|
1197
|
+
return false;
|
|
1198
|
+
if (Math.abs(offsetOf(item) - target) >= 1) {
|
|
1199
|
+
scrollTo(target, true);
|
|
1200
|
+
return true;
|
|
1201
|
+
}
|
|
1202
|
+
targetRef.current = undefined;
|
|
1203
|
+
return false;
|
|
1204
|
+
};
|
|
1205
|
+
// Where a row at rest `distance` from closed towards `side` rests: the
|
|
1206
|
+
// nearest of closed and open (not swiped closed, see `allowSwipe`: open
|
|
1207
|
+
// only; not swiped open: closed only).
|
|
1208
|
+
const restingDistance = (side, distance) => {
|
|
1209
|
+
const { [side]: width = 0 } = swipeRef.current.widths;
|
|
1210
|
+
const { current: openSide } = openSideRef;
|
|
1211
|
+
const isOpenable = width > 0 &&
|
|
1212
|
+
(openSide === side || (openSide === undefined && canReveal(side)));
|
|
1213
|
+
const isLockedOpen = openSide === side && !canConceal(side);
|
|
1214
|
+
const stops = [
|
|
1215
|
+
...(isLockedOpen ? [] : [0]),
|
|
1216
|
+
...(isOpenable ? [width] : []),
|
|
1217
|
+
];
|
|
1218
|
+
const [nearest = 0] = stops.toSorted((a, b) => Math.abs(distance - a) - Math.abs(distance - b));
|
|
1219
|
+
return nearest;
|
|
1220
|
+
};
|
|
1221
|
+
// At rest overswiped (armed, or across the whole row): across it, then
|
|
1222
|
+
// triggering there.
|
|
1223
|
+
const settleOverswiped = (side, distance) => {
|
|
1224
|
+
const { [side]: extent = 0 } = swipeRef.current.extents;
|
|
1225
|
+
// Held between snap points (no `scrollend`): not yet.
|
|
1226
|
+
if (distance < armedPlace(swipeRef.current, side) - 1)
|
|
1227
|
+
return;
|
|
1228
|
+
// Across the whole row first (settling there again).
|
|
1229
|
+
if (distance < extent - 1) {
|
|
1230
|
+
scrollToTarget((side === 'leading' ? 1 : -1) * extent);
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
trigger(side);
|
|
1234
|
+
};
|
|
1171
1235
|
// The scroll at rest (not touched): overswiped (armed, or across the
|
|
1172
1236
|
// whole row: triggering there), open or closed.
|
|
1173
1237
|
const settle = () => {
|
|
1174
1238
|
const { current: item } = itemRef;
|
|
1175
|
-
if (!item ||
|
|
1239
|
+
if (!item ||
|
|
1240
|
+
dragRef.current?.isMoved ||
|
|
1241
|
+
touchingRef.current ||
|
|
1242
|
+
isOnItsWay(item)) {
|
|
1176
1243
|
return;
|
|
1244
|
+
}
|
|
1177
1245
|
item.style.removeProperty('scroll-snap-type');
|
|
1178
1246
|
const offset = offsetOf(item);
|
|
1179
1247
|
const side = offset > 0 ? 'leading' : 'trailing';
|
|
1180
1248
|
const distance = Math.abs(offset);
|
|
1181
1249
|
const { [side]: width = 0 } = swipeRef.current.widths;
|
|
1182
|
-
const { [side]: extent = 0 } = swipeRef.current.extents;
|
|
1183
1250
|
const { [side]: arm = Infinity } = swipeRef.current.arms;
|
|
1184
1251
|
const { current: isClosing } = closingRef;
|
|
1185
1252
|
closingRef.current = false;
|
|
@@ -1189,18 +1256,17 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
1189
1256
|
return;
|
|
1190
1257
|
}
|
|
1191
1258
|
if (overswipesNow(side) && distance > arm) {
|
|
1192
|
-
|
|
1193
|
-
if (distance < armedPlace(swipeRef.current, side) - 1)
|
|
1194
|
-
return;
|
|
1195
|
-
// Across the whole row first (settling there again).
|
|
1196
|
-
if (distance < extent - 1) {
|
|
1197
|
-
scrollTo((side === 'leading' ? 1 : -1) * extent, true);
|
|
1198
|
-
return;
|
|
1199
|
-
}
|
|
1200
|
-
trigger(side);
|
|
1259
|
+
settleOverswiped(side, distance);
|
|
1201
1260
|
return;
|
|
1202
1261
|
}
|
|
1203
1262
|
swipingRef.current = false;
|
|
1263
|
+
// At rest off its stops (iOS' snapping, coming to rest short of one,
|
|
1264
|
+
// e.g. almost closed): to the nearest it may rest at, at rest there.
|
|
1265
|
+
const nearest = restingDistance(side, distance);
|
|
1266
|
+
if (Math.abs(distance - nearest) >= 1) {
|
|
1267
|
+
scrollToTarget((side === 'leading' ? 1 : -1) * nearest);
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1204
1270
|
if (Math.abs(distance - width) < 1) {
|
|
1205
1271
|
if (openSideRef.current !== side)
|
|
1206
1272
|
context.open(side);
|
|
@@ -1225,7 +1291,8 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
1225
1291
|
return;
|
|
1226
1292
|
const offset = offsetOf(item);
|
|
1227
1293
|
const side = offset > 0 ? 'leading' : 'trailing';
|
|
1228
|
-
|
|
1294
|
+
// (Towards a side without actions, e.g. bouncing: not swiped.)
|
|
1295
|
+
if (Math.abs(offset) >= 1 && swipeRef.current.widths[side] !== undefined) {
|
|
1229
1296
|
item.dataset.swipe = side;
|
|
1230
1297
|
// (Swiped, it closes another row's; closing, not: e.g. as another
|
|
1231
1298
|
// opens by a trigger, which its scroll would close again.)
|
|
@@ -1265,6 +1332,11 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
1265
1332
|
};
|
|
1266
1333
|
const onTouchStart = () => {
|
|
1267
1334
|
touchingRef.current = true;
|
|
1335
|
+
// (Taking over from a scroll of the row's own, see `scrollToTarget`.)
|
|
1336
|
+
if (targetRef.current !== undefined) {
|
|
1337
|
+
targetRef.current = undefined;
|
|
1338
|
+
item.style.removeProperty('scroll-snap-type');
|
|
1339
|
+
}
|
|
1268
1340
|
// Swiped: overswiping in one go (see `overswipable`).
|
|
1269
1341
|
swipingRef.current = true;
|
|
1270
1342
|
showSnapsRef.current();
|
|
@@ -1389,7 +1461,7 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
1389
1461
|
// until then (which would start where it is).
|
|
1390
1462
|
if (!isLocked && !isCancelled && overswipesNow(side) && distance > arm) {
|
|
1391
1463
|
const { [side]: extent = 0 } = swipeRef.current.extents;
|
|
1392
|
-
|
|
1464
|
+
scrollToTarget((side === 'leading' ? 1 : -1) * extent);
|
|
1393
1465
|
return;
|
|
1394
1466
|
}
|
|
1395
1467
|
// Not overswiped: no longer, before snapping again (which would snap to
|
|
@@ -1474,7 +1546,7 @@ const Item = forwardRef((itemProps, ref) => {
|
|
|
1474
1546
|
}, children: _jsxs("div", { className: "uikit-list-track", "data-list-part": "track", children: [_jsx(Pin, { ref: setPin }), isSwipeable
|
|
1475
1547
|
? snapPoints.map((point) => (_jsx("span", { ref: (element) => {
|
|
1476
1548
|
snapsRef.current[point] = element;
|
|
1477
|
-
}, hidden: true, "aria-hidden": "true", className: "uikit-list-snap", "data-
|
|
1549
|
+
}, hidden: true, "aria-hidden": "true", className: "uikit-list-snap", "data-list-part": "snap", "data-stop": stopPoints.has(point) ? '' : undefined }, point)))
|
|
1478
1550
|
: null, _jsx(PinContext.Provider, { value: pin, children: _jsx("div", { className: "uikit-list-row", "data-list-part": "row", children: children }) })] }) }) }));
|
|
1479
1551
|
});
|
|
1480
1552
|
// Row slots (see style.css): a row's parts in a line, in their order;
|