@surdeddd/bottom-sheet 0.1.0 → 0.3.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/README.md +57 -21
- package/dist/BottomSheetEngine-CAymrH-P.d.cts +285 -0
- package/dist/BottomSheetEngine-DcqcuudN.d.ts +285 -0
- package/dist/element.cjs +775 -537
- package/dist/element.d.cts +9 -57
- package/dist/element.d.ts +9 -57
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +775 -537
- package/dist/index.cjs +760 -600
- package/dist/index.d.cts +18 -85
- package/dist/index.d.ts +18 -85
- package/dist/index.js +758 -601
- package/dist/integrations/formik.d.cts +2 -8
- package/dist/integrations/formik.d.ts +2 -8
- package/dist/integrations/react-hook-form.d.cts +2 -11
- package/dist/integrations/react-hook-form.d.ts +2 -11
- package/dist/overlay.cjs +168 -122
- package/dist/overlay.d.cts +14 -137
- package/dist/overlay.d.ts +14 -137
- package/dist/overlay.js +168 -122
- package/dist/preact.d.cts +2 -2
- package/dist/preact.d.ts +2 -2
- package/dist/preact.js +0 -1
- package/dist/qwik.cjs +667 -519
- package/dist/qwik.d.cts +3 -24
- package/dist/qwik.d.ts +3 -24
- package/dist/qwik.js +668 -520
- package/dist/react.cjs +873 -648
- package/dist/react.d.cts +34 -159
- package/dist/react.d.ts +34 -159
- package/dist/react.js +873 -648
- package/dist/solid.cjs +703 -560
- package/dist/solid.d.cts +264 -32
- package/dist/solid.d.ts +264 -32
- package/dist/solid.js +704 -561
- package/dist/solid.source.jsx +3215 -0
- package/dist/styles.css +37 -112
- package/dist/svelte-core.cjs +3149 -0
- package/dist/svelte-core.js +3147 -0
- package/dist/svelte-src/BottomSheet.svelte +210 -0
- package/dist/svelte-src/index.js +2 -0
- package/dist/svelte.cjs +718 -547
- package/dist/svelte.d.cts +100 -0
- package/dist/svelte.d.ts +15 -4
- package/dist/svelte.js +719 -548
- package/dist/themes/ios.css +0 -3
- package/dist/themes/material.css +0 -3
- package/dist/themes/vercel.css +0 -3
- package/dist/{transform-Brkf-wzo.d.cts → transform-jVfAikE9.d.cts} +0 -1
- package/dist/{transform-Brkf-wzo.d.ts → transform-jVfAikE9.d.ts} +0 -1
- package/dist/vue.cjs +677 -526
- package/dist/vue.d.cts +78 -0
- package/dist/vue.d.ts +12 -2
- package/dist/vue.js +678 -527
- package/package.json +105 -45
- package/dist/BottomSheetEngine-CvSVbo6c.d.cts +0 -704
- package/dist/BottomSheetEngine-DbO8rW_3.d.ts +0 -704
package/dist/styles.css
CHANGED
|
@@ -1,37 +1,23 @@
|
|
|
1
|
-
/* =====================================================================
|
|
2
|
-
* @surdeddd/bottom-sheet — base styles
|
|
3
|
-
* Override any token below to retheme. All sizes use logical defaults
|
|
4
|
-
* so the same stylesheet works for bottom / top / left / right modes.
|
|
5
|
-
* ===================================================================== */
|
|
6
|
-
|
|
7
1
|
:where(.bs-root) {
|
|
8
|
-
|
|
2
|
+
|
|
9
3
|
--bs-surface: #ffffff;
|
|
10
4
|
--bs-surface-border: rgba(225, 227, 237, 1);
|
|
11
|
-
--bs-shadow: 0 -3px 12px rgba(0, 0, 0, 0.12);
|
|
12
5
|
--bs-radius: 20px;
|
|
13
6
|
|
|
14
|
-
/* handle — WCAG 1.4.11 contrast against light surface ≥ 3:1 */
|
|
15
7
|
--bs-handle-color: #b5b3a8;
|
|
16
8
|
--bs-handle-width: 40px;
|
|
17
9
|
--bs-handle-height: 5px;
|
|
18
10
|
|
|
19
|
-
/* layout */
|
|
20
11
|
--bs-z-backdrop: 90;
|
|
21
12
|
--bs-z-sheet: 100;
|
|
22
13
|
--bs-header-min-height: 80px;
|
|
23
14
|
|
|
24
|
-
/* backdrop */
|
|
25
15
|
--bs-backdrop-color: rgba(0, 0, 0, 0.5);
|
|
26
16
|
|
|
27
|
-
/* scrim — dimming layer for the area NOT occupied by the sheet
|
|
28
|
-
(used with scrimMode: "above-sheet" or the .bs-scrim* recipes below).
|
|
29
|
-
Override these to retheme without rewriting the recipe. */
|
|
30
17
|
--bs-scrim-color: rgba(0, 0, 0, 0.4);
|
|
31
18
|
--bs-scrim-blur: 0px;
|
|
32
19
|
--bs-z-scrim: calc(var(--bs-z-sheet) - 1);
|
|
33
20
|
|
|
34
|
-
/* engine writes these — read them in your own CSS to react to drag */
|
|
35
21
|
--bs-size: 0px;
|
|
36
22
|
--bs-progress: 0;
|
|
37
23
|
}
|
|
@@ -43,8 +29,7 @@
|
|
|
43
29
|
opacity: 0;
|
|
44
30
|
pointer-events: none;
|
|
45
31
|
z-index: var(--bs-z-backdrop);
|
|
46
|
-
|
|
47
|
-
opacity per-frame and the transition would delay it by 150ms. */
|
|
32
|
+
|
|
48
33
|
transition: opacity 0.15s linear;
|
|
49
34
|
will-change: opacity;
|
|
50
35
|
}
|
|
@@ -53,20 +38,19 @@
|
|
|
53
38
|
transition: none;
|
|
54
39
|
}
|
|
55
40
|
|
|
56
|
-
/* ----- sheet ----- */
|
|
57
41
|
.bs-sheet {
|
|
58
42
|
position: fixed;
|
|
59
43
|
background: var(--bs-surface);
|
|
60
|
-
box-shadow: var(--bs-shadow);
|
|
44
|
+
box-shadow: var(--bs-shadow, var(--bs-shadow-auto, none));
|
|
61
45
|
z-index: var(--bs-z-sheet);
|
|
62
46
|
overflow: hidden;
|
|
63
47
|
display: flex;
|
|
64
48
|
flex-direction: column;
|
|
65
|
-
|
|
49
|
+
|
|
66
50
|
-webkit-tap-highlight-color: transparent;
|
|
67
51
|
user-select: none;
|
|
68
52
|
overscroll-behavior: contain;
|
|
69
|
-
|
|
53
|
+
|
|
70
54
|
}
|
|
71
55
|
|
|
72
56
|
.bs-sheet[data-mode="bottom"] {
|
|
@@ -77,13 +61,13 @@
|
|
|
77
61
|
border-top-left-radius: var(--bs-radius);
|
|
78
62
|
border-top-right-radius: var(--bs-radius);
|
|
79
63
|
border-top: 1px solid var(--bs-surface-border);
|
|
80
|
-
|
|
64
|
+
|
|
81
65
|
padding-bottom: env(safe-area-inset-bottom);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
66
|
+
|
|
67
|
+
--bs-shadow-auto: 0
|
|
68
|
+
calc(var(--bs-progress, 0) * -2px - 3px)
|
|
69
|
+
calc(var(--bs-progress, 0) * 18px + 12px)
|
|
70
|
+
rgba(0, 0, 0, calc(var(--bs-progress, 0) * 0.15 + 0.12));
|
|
87
71
|
}
|
|
88
72
|
.bs-sheet[data-mode="top"] {
|
|
89
73
|
left: 0;
|
|
@@ -94,7 +78,7 @@
|
|
|
94
78
|
border-bottom-right-radius: var(--bs-radius);
|
|
95
79
|
border-bottom: 1px solid var(--bs-surface-border);
|
|
96
80
|
flex-direction: column-reverse;
|
|
97
|
-
|
|
81
|
+
--bs-shadow-auto: 0 3px 12px rgba(0, 0, 0, 0.12);
|
|
98
82
|
padding-top: env(safe-area-inset-top);
|
|
99
83
|
}
|
|
100
84
|
.bs-sheet[data-mode="left"] {
|
|
@@ -105,9 +89,8 @@
|
|
|
105
89
|
border-top-right-radius: var(--bs-radius);
|
|
106
90
|
border-bottom-right-radius: var(--bs-radius);
|
|
107
91
|
border-right: 1px solid var(--bs-surface-border);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
box-shadow: 3px 0 12px rgba(0, 0, 0, 0.12);
|
|
92
|
+
|
|
93
|
+
--bs-shadow-auto: 3px 0 12px rgba(0, 0, 0, 0.12);
|
|
111
94
|
}
|
|
112
95
|
.bs-sheet[data-mode="right"] {
|
|
113
96
|
top: 0;
|
|
@@ -117,10 +100,9 @@
|
|
|
117
100
|
border-top-left-radius: var(--bs-radius);
|
|
118
101
|
border-bottom-left-radius: var(--bs-radius);
|
|
119
102
|
border-left: 1px solid var(--bs-surface-border);
|
|
120
|
-
|
|
103
|
+
--bs-shadow-auto: -3px 0 12px rgba(0, 0, 0, 0.12);
|
|
121
104
|
}
|
|
122
|
-
|
|
123
|
-
the absolutely-positioned handle strip on the open edge. */
|
|
105
|
+
|
|
124
106
|
.bs-sheet[data-mode="left"] .bs-content {
|
|
125
107
|
padding-right: 36px;
|
|
126
108
|
}
|
|
@@ -128,10 +110,9 @@
|
|
|
128
110
|
padding-left: 36px;
|
|
129
111
|
}
|
|
130
112
|
|
|
131
|
-
/* ----- handle ----- */
|
|
132
113
|
.bs-handle {
|
|
133
114
|
flex-shrink: 0;
|
|
134
|
-
|
|
115
|
+
|
|
135
116
|
min-height: 44px;
|
|
136
117
|
display: flex;
|
|
137
118
|
flex-direction: column;
|
|
@@ -143,7 +124,7 @@
|
|
|
143
124
|
background: var(--bs-surface);
|
|
144
125
|
-webkit-tap-highlight-color: transparent;
|
|
145
126
|
outline: none;
|
|
146
|
-
|
|
127
|
+
|
|
147
128
|
position: relative;
|
|
148
129
|
}
|
|
149
130
|
.bs-handle:active {
|
|
@@ -164,17 +145,9 @@
|
|
|
164
145
|
border-radius: calc(var(--bs-handle-height) / 2);
|
|
165
146
|
margin: 0 auto 8px;
|
|
166
147
|
transition: width 0.15s ease, background 0.15s ease, transform 0.15s ease;
|
|
167
|
-
pointer-events: none;
|
|
148
|
+
pointer-events: none;
|
|
168
149
|
}
|
|
169
150
|
|
|
170
|
-
/* Side-mode handle: a thin grab-strip docked to the sheet's open edge,
|
|
171
|
-
absolutely positioned so it sits on the visible boundary regardless of
|
|
172
|
-
the sheet's flex-direction. The header content inside it is hidden in
|
|
173
|
-
side modes — for vertical sheets the handle is just a grip. The hidden
|
|
174
|
-
header content stays in DOM (and out of the a11y tree thanks to
|
|
175
|
-
`display: none`) so screen readers don't read a stale header here —
|
|
176
|
-
consumers should put descriptive content inside the scrollable area
|
|
177
|
-
instead in side modes. */
|
|
178
151
|
.bs-sheet[data-mode="left"] .bs-handle,
|
|
179
152
|
.bs-sheet[data-mode="right"] .bs-handle {
|
|
180
153
|
position: absolute;
|
|
@@ -220,24 +193,17 @@
|
|
|
220
193
|
transform: scaleX(1.15);
|
|
221
194
|
}
|
|
222
195
|
|
|
223
|
-
/* ----- snap-target ticks (opt-in via .bs-handle--ticks) -----
|
|
224
|
-
Material You / Apple Music inspired: while dragging, render a faint row
|
|
225
|
-
of dots near the grip to suggest "this thing has multiple stops".
|
|
226
|
-
Decorative only — positions are NOT computed from real snap points.
|
|
227
|
-
Hidden in idle state, fades in during drag. Opt-in via the modifier
|
|
228
|
-
class so consumers who don't want the hint don't get it. */
|
|
229
196
|
.bs-handle.bs-handle--ticks::after {
|
|
230
197
|
content: "";
|
|
231
198
|
display: block;
|
|
232
199
|
position: absolute;
|
|
233
200
|
left: 50%;
|
|
234
|
-
|
|
235
|
-
so the dot row is centered horizontally regardless of width. */
|
|
201
|
+
|
|
236
202
|
bottom: 6px;
|
|
237
203
|
transform: translateX(-50%);
|
|
238
204
|
width: calc(var(--bs-handle-width) * 2);
|
|
239
205
|
height: 3px;
|
|
240
|
-
|
|
206
|
+
|
|
241
207
|
background-image: radial-gradient(
|
|
242
208
|
circle,
|
|
243
209
|
var(--bs-handle-color) 0 1.5px,
|
|
@@ -250,16 +216,16 @@
|
|
|
250
216
|
transition: opacity 0.18s ease-out;
|
|
251
217
|
pointer-events: none;
|
|
252
218
|
}
|
|
253
|
-
|
|
219
|
+
|
|
254
220
|
.bs-root[data-dragging="true"] .bs-handle.bs-handle--ticks::after {
|
|
255
221
|
opacity: 0.4;
|
|
256
222
|
}
|
|
257
|
-
|
|
223
|
+
|
|
258
224
|
.bs-sheet[data-mode="top"] .bs-handle.bs-handle--ticks::after {
|
|
259
225
|
bottom: auto;
|
|
260
226
|
top: 6px;
|
|
261
227
|
}
|
|
262
|
-
|
|
228
|
+
|
|
263
229
|
.bs-sheet[data-mode="left"] .bs-handle.bs-handle--ticks::after,
|
|
264
230
|
.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after {
|
|
265
231
|
left: 50%;
|
|
@@ -270,55 +236,39 @@
|
|
|
270
236
|
height: calc(var(--bs-handle-width) * 2);
|
|
271
237
|
background-size: 3px 8px;
|
|
272
238
|
background-repeat: repeat-y;
|
|
273
|
-
|
|
239
|
+
|
|
274
240
|
margin-left: calc(var(--bs-handle-height) + 6px);
|
|
275
241
|
}
|
|
276
242
|
.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after {
|
|
277
243
|
margin-left: calc(-1 * (var(--bs-handle-height) + 6px));
|
|
278
244
|
}
|
|
279
245
|
|
|
280
|
-
/* ----- content ----- */
|
|
281
246
|
.bs-content {
|
|
282
247
|
flex: 1;
|
|
283
248
|
min-height: 0;
|
|
284
249
|
overflow-y: auto;
|
|
285
250
|
-webkit-overflow-scrolling: touch;
|
|
286
251
|
overscroll-behavior: contain;
|
|
252
|
+
user-select: text;
|
|
287
253
|
padding: 0 16px 16px;
|
|
288
254
|
}
|
|
289
255
|
|
|
290
|
-
/* ----- screen-component (fades in behind sheet, opacity = --bs-progress) -----
|
|
291
|
-
*
|
|
292
|
-
* Two ready-made scrim recipes for the engine's `screenComponent`:
|
|
293
|
-
*
|
|
294
|
-
* 1. `.bs-screen` — base. Engine writes `opacity` and `display`; consumer
|
|
295
|
-
* controls layout. Use directly when scrimMode: "full" (default).
|
|
296
|
-
*
|
|
297
|
-
* 2. `.bs-scrim` — opinionated scrim with token-driven color + optional
|
|
298
|
-
* blur. Drop on the same element as `.bs-screen` (or alone) for an
|
|
299
|
-
* instant "monitoring-style" dim with no extra CSS.
|
|
300
|
-
*
|
|
301
|
-
* 3. `.bs-scrim--above` — pairs with `scrimMode: "above-sheet"`. The
|
|
302
|
-
* engine writes the `inset` so the scrim covers only the area NOT
|
|
303
|
-
* occupied by the sheet; this class only adds the visual treatment.
|
|
304
|
-
*
|
|
305
|
-
* Tokens (override at any cascade level):
|
|
306
|
-
* --bs-scrim-color default rgba(0, 0, 0, 0.4)
|
|
307
|
-
* --bs-scrim-blur default 0px (set to e.g. 8px for backdrop blur)
|
|
308
|
-
* --bs-z-scrim default calc(--bs-z-sheet - 1)
|
|
309
|
-
*/
|
|
310
256
|
.bs-screen {
|
|
311
257
|
position: absolute;
|
|
312
258
|
inset: 0;
|
|
313
259
|
pointer-events: none;
|
|
314
|
-
|
|
260
|
+
|
|
315
261
|
z-index: var(--bs-z-scrim);
|
|
316
262
|
}
|
|
317
263
|
|
|
264
|
+
.bs-scrim-overlay {
|
|
265
|
+
z-index: calc(var(--bs-z-sheet) + 1);
|
|
266
|
+
pointer-events: none;
|
|
267
|
+
}
|
|
268
|
+
|
|
318
269
|
.bs-scrim {
|
|
319
270
|
background: var(--bs-scrim-color);
|
|
320
|
-
|
|
321
|
-
dragging/animating to avoid the 150ms lag on fast snaps. */
|
|
271
|
+
|
|
322
272
|
transition: opacity 0.15s linear;
|
|
323
273
|
will-change: opacity;
|
|
324
274
|
}
|
|
@@ -327,21 +277,11 @@
|
|
|
327
277
|
transition: none;
|
|
328
278
|
}
|
|
329
279
|
|
|
330
|
-
/* Optional blur — opt-in by setting --bs-scrim-blur to a non-zero length.
|
|
331
|
-
`backdrop-filter: blur(0)` is a no-op visually but still triggers a
|
|
332
|
-
compositing layer; the calc() guards against accidental layer creation
|
|
333
|
-
when the consumer hasn't customised the token. */
|
|
334
280
|
.bs-scrim {
|
|
335
281
|
backdrop-filter: blur(var(--bs-scrim-blur));
|
|
336
282
|
-webkit-backdrop-filter: blur(var(--bs-scrim-blur));
|
|
337
283
|
}
|
|
338
284
|
|
|
339
|
-
/* `.bs-scrim--above` is a documented marker class for `scrimMode:
|
|
340
|
-
"above-sheet"` — the engine writes the `inset` + `position: fixed`
|
|
341
|
-
inline. Add your own declarations under `.bs-scrim--above { ... }` to
|
|
342
|
-
override the visual treatment per-context. */
|
|
343
|
-
|
|
344
|
-
/* ----- buttons docked above the sheet ----- */
|
|
345
285
|
.bs-button-slot {
|
|
346
286
|
position: absolute;
|
|
347
287
|
z-index: calc(var(--bs-z-sheet) + 1);
|
|
@@ -358,7 +298,6 @@
|
|
|
358
298
|
transition: bottom 0.15s ease;
|
|
359
299
|
}
|
|
360
300
|
|
|
361
|
-
/* ----- accessibility ----- */
|
|
362
301
|
@media (prefers-reduced-motion: reduce) {
|
|
363
302
|
.bs-backdrop,
|
|
364
303
|
.bs-handle::before,
|
|
@@ -368,18 +307,16 @@
|
|
|
368
307
|
}
|
|
369
308
|
}
|
|
370
309
|
|
|
371
|
-
/* ----- dark mode token defaults ----- */
|
|
372
310
|
@media (prefers-color-scheme: dark) {
|
|
373
311
|
:where(.bs-root) {
|
|
374
312
|
--bs-surface: #1a1a1d;
|
|
375
313
|
--bs-surface-border: rgba(255, 255, 255, 0.08);
|
|
376
|
-
|
|
314
|
+
|
|
377
315
|
--bs-handle-color: rgba(255, 255, 255, 0.45);
|
|
378
|
-
--bs-shadow: 0 -3px 16px rgba(0, 0, 0, 0.5);
|
|
316
|
+
--bs-shadow-auto: 0 -3px 16px rgba(0, 0, 0, 0.5);
|
|
379
317
|
}
|
|
380
318
|
}
|
|
381
319
|
|
|
382
|
-
/* visually-hidden helper for aria-live announcements */
|
|
383
320
|
.bs-sr-only {
|
|
384
321
|
position: absolute;
|
|
385
322
|
width: 1px;
|
|
@@ -392,10 +329,6 @@
|
|
|
392
329
|
border: 0;
|
|
393
330
|
}
|
|
394
331
|
|
|
395
|
-
/* =====================================================================
|
|
396
|
-
* OVERLAY — bottom-anchored slide-up panel
|
|
397
|
-
* ===================================================================== */
|
|
398
|
-
|
|
399
332
|
:where(.ovl-root) {
|
|
400
333
|
--ovl-surface: var(--bs-surface, #ffffff);
|
|
401
334
|
--ovl-surface-border: var(--bs-surface-border, rgba(0, 0, 0, 0.08));
|
|
@@ -422,13 +355,7 @@
|
|
|
422
355
|
z-index: var(--ovl-z-panel);
|
|
423
356
|
-webkit-tap-highlight-color: transparent;
|
|
424
357
|
outline: none;
|
|
425
|
-
|
|
426
|
-
in core/overlay.ts. In browsers that support @starting-style
|
|
427
|
-
(Chrome 117+, Safari 17.5+, Firefox 129+), the engine just flips
|
|
428
|
-
[data-state] from "entering" to "open" and the browser interpolates
|
|
429
|
-
from the @starting-style block below. The JS still writes inline
|
|
430
|
-
transition/transform for older browsers; setting the same transition
|
|
431
|
-
here is harmless because the inline style wins via specificity. */
|
|
358
|
+
|
|
432
359
|
transition: transform 0.32s cubic-bezier(0.29, 1.24, 0.84, 0.99),
|
|
433
360
|
opacity 0.32s ease-out;
|
|
434
361
|
}
|
|
@@ -436,9 +363,7 @@
|
|
|
436
363
|
transform: translate3d(0, 0, 0);
|
|
437
364
|
opacity: 1;
|
|
438
365
|
}
|
|
439
|
-
|
|
440
|
-
per edge. Browsers without support fall back gracefully — the
|
|
441
|
-
double-rAF in overlay.ts still drives the same animation. */
|
|
366
|
+
|
|
442
367
|
@starting-style {
|
|
443
368
|
.ovl-panel[data-edge="bottom"][data-state="open"] {
|
|
444
369
|
transform: translate3d(0, 100%, 0);
|