@surdeddd/bottom-sheet 0.1.0 → 0.2.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.
Files changed (50) hide show
  1. package/README.md +6 -0
  2. package/dist/BottomSheetEngine-CIT9Htti.d.cts +219 -0
  3. package/dist/BottomSheetEngine-Df9MwBbm.d.ts +219 -0
  4. package/dist/element.cjs +95 -440
  5. package/dist/element.d.cts +3 -56
  6. package/dist/element.d.ts +3 -56
  7. package/dist/element.iife.global.js +2 -2
  8. package/dist/element.js +95 -440
  9. package/dist/index.cjs +84 -494
  10. package/dist/index.d.cts +3 -84
  11. package/dist/index.d.ts +3 -84
  12. package/dist/index.js +84 -494
  13. package/dist/integrations/formik.d.cts +2 -8
  14. package/dist/integrations/formik.d.ts +2 -8
  15. package/dist/integrations/react-hook-form.d.cts +2 -11
  16. package/dist/integrations/react-hook-form.d.ts +2 -11
  17. package/dist/overlay.cjs +0 -87
  18. package/dist/overlay.d.cts +1 -137
  19. package/dist/overlay.d.ts +1 -137
  20. package/dist/overlay.js +0 -87
  21. package/dist/preact.d.cts +2 -2
  22. package/dist/preact.d.ts +2 -2
  23. package/dist/preact.js +0 -1
  24. package/dist/qwik.cjs +87 -439
  25. package/dist/qwik.d.cts +3 -24
  26. package/dist/qwik.d.ts +3 -24
  27. package/dist/qwik.js +87 -439
  28. package/dist/react.cjs +91 -496
  29. package/dist/react.d.cts +16 -158
  30. package/dist/react.d.ts +16 -158
  31. package/dist/react.js +91 -496
  32. package/dist/solid.cjs +87 -439
  33. package/dist/solid.d.cts +4 -31
  34. package/dist/solid.d.ts +4 -31
  35. package/dist/solid.js +87 -439
  36. package/dist/styles.css +27 -102
  37. package/dist/svelte.cjs +139 -462
  38. package/dist/svelte.d.ts +9 -2
  39. package/dist/svelte.js +139 -462
  40. package/dist/themes/ios.css +0 -3
  41. package/dist/themes/material.css +0 -3
  42. package/dist/themes/vercel.css +0 -3
  43. package/dist/{transform-Brkf-wzo.d.cts → transform-jVfAikE9.d.cts} +0 -1
  44. package/dist/{transform-Brkf-wzo.d.ts → transform-jVfAikE9.d.ts} +0 -1
  45. package/dist/vue.cjs +104 -446
  46. package/dist/vue.d.ts +7 -1
  47. package/dist/vue.js +105 -447
  48. package/package.json +3 -3
  49. package/dist/BottomSheetEngine-CvSVbo6c.d.cts +0 -704
  50. package/dist/BottomSheetEngine-DbO8rW_3.d.ts +0 -704
package/dist/styles.css CHANGED
@@ -1,37 +1,24 @@
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
- /* surface */
2
+
9
3
  --bs-surface: #ffffff;
10
4
  --bs-surface-border: rgba(225, 227, 237, 1);
11
5
  --bs-shadow: 0 -3px 12px rgba(0, 0, 0, 0.12);
12
6
  --bs-radius: 20px;
13
7
 
14
- /* handle — WCAG 1.4.11 contrast against light surface ≥ 3:1 */
15
8
  --bs-handle-color: #b5b3a8;
16
9
  --bs-handle-width: 40px;
17
10
  --bs-handle-height: 5px;
18
11
 
19
- /* layout */
20
12
  --bs-z-backdrop: 90;
21
13
  --bs-z-sheet: 100;
22
14
  --bs-header-min-height: 80px;
23
15
 
24
- /* backdrop */
25
16
  --bs-backdrop-color: rgba(0, 0, 0, 0.5);
26
17
 
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
18
  --bs-scrim-color: rgba(0, 0, 0, 0.4);
31
19
  --bs-scrim-blur: 0px;
32
20
  --bs-z-scrim: calc(var(--bs-z-sheet) - 1);
33
21
 
34
- /* engine writes these — read them in your own CSS to react to drag */
35
22
  --bs-size: 0px;
36
23
  --bs-progress: 0;
37
24
  }
@@ -43,8 +30,7 @@
43
30
  opacity: 0;
44
31
  pointer-events: none;
45
32
  z-index: var(--bs-z-backdrop);
46
- /* Transition only when NOT actively dragging/animating — engine writes
47
- opacity per-frame and the transition would delay it by 150ms. */
33
+
48
34
  transition: opacity 0.15s linear;
49
35
  will-change: opacity;
50
36
  }
@@ -53,7 +39,6 @@
53
39
  transition: none;
54
40
  }
55
41
 
56
- /* ----- sheet ----- */
57
42
  .bs-sheet {
58
43
  position: fixed;
59
44
  background: var(--bs-surface);
@@ -62,11 +47,11 @@
62
47
  overflow: hidden;
63
48
  display: flex;
64
49
  flex-direction: column;
65
- /* engine sets touch-action on the handle directly; this is for clicks. */
50
+
66
51
  -webkit-tap-highlight-color: transparent;
67
52
  user-select: none;
68
53
  overscroll-behavior: contain;
69
- /* engine drives the size via transform translate3d. */
54
+
70
55
  }
71
56
 
72
57
  .bs-sheet[data-mode="bottom"] {
@@ -77,9 +62,9 @@
77
62
  border-top-left-radius: var(--bs-radius);
78
63
  border-top-right-radius: var(--bs-radius);
79
64
  border-top: 1px solid var(--bs-surface-border);
80
- /* iPhone home-indicator safe area. */
65
+
81
66
  padding-bottom: env(safe-area-inset-bottom);
82
- /* Progress-driven shadow depth — deeper as the sheet expands. */
67
+
83
68
  box-shadow: 0
84
69
  calc(var(--bs-progress, 0) * -2px - 3px)
85
70
  calc(var(--bs-progress, 0) * 18px + 12px)
@@ -105,8 +90,7 @@
105
90
  border-top-right-radius: var(--bs-radius);
106
91
  border-bottom-right-radius: var(--bs-radius);
107
92
  border-right: 1px solid var(--bs-surface-border);
108
- /* default flex layout (column) — handle is positioned-absolute at the
109
- open edge (right) so column flow doesn't matter for it */
93
+
110
94
  box-shadow: 3px 0 12px rgba(0, 0, 0, 0.12);
111
95
  }
112
96
  .bs-sheet[data-mode="right"] {
@@ -119,8 +103,7 @@
119
103
  border-left: 1px solid var(--bs-surface-border);
120
104
  box-shadow: -3px 0 12px rgba(0, 0, 0, 0.12);
121
105
  }
122
- /* In side modes, content sits inside the sheet but with padding to clear
123
- the absolutely-positioned handle strip on the open edge. */
106
+
124
107
  .bs-sheet[data-mode="left"] .bs-content {
125
108
  padding-right: 36px;
126
109
  }
@@ -128,10 +111,9 @@
128
111
  padding-left: 36px;
129
112
  }
130
113
 
131
- /* ----- handle ----- */
132
114
  .bs-handle {
133
115
  flex-shrink: 0;
134
- /* WCAG 2.5.5 / Apple HIG / Material — 44px minimum hit target. */
116
+
135
117
  min-height: 44px;
136
118
  display: flex;
137
119
  flex-direction: column;
@@ -143,7 +125,7 @@
143
125
  background: var(--bs-surface);
144
126
  -webkit-tap-highlight-color: transparent;
145
127
  outline: none;
146
- /* anchor point for the optional .bs-handle--ticks ::after dots */
128
+
147
129
  position: relative;
148
130
  }
149
131
  .bs-handle:active {
@@ -164,17 +146,9 @@
164
146
  border-radius: calc(var(--bs-handle-height) / 2);
165
147
  margin: 0 auto 8px;
166
148
  transition: width 0.15s ease, background 0.15s ease, transform 0.15s ease;
167
- pointer-events: none; /* always hit the padding-zoned parent */
149
+ pointer-events: none;
168
150
  }
169
151
 
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
152
  .bs-sheet[data-mode="left"] .bs-handle,
179
153
  .bs-sheet[data-mode="right"] .bs-handle {
180
154
  position: absolute;
@@ -220,24 +194,17 @@
220
194
  transform: scaleX(1.15);
221
195
  }
222
196
 
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
197
  .bs-handle.bs-handle--ticks::after {
230
198
  content: "";
231
199
  display: block;
232
200
  position: absolute;
233
201
  left: 50%;
234
- /* Sit just under the grip in vertical (bottom/top) modes. Translate -50%
235
- so the dot row is centered horizontally regardless of width. */
202
+
236
203
  bottom: 6px;
237
204
  transform: translateX(-50%);
238
205
  width: calc(var(--bs-handle-width) * 2);
239
206
  height: 3px;
240
- /* 3px dots spaced every 8px — purely visual hint. */
207
+
241
208
  background-image: radial-gradient(
242
209
  circle,
243
210
  var(--bs-handle-color) 0 1.5px,
@@ -250,16 +217,16 @@
250
217
  transition: opacity 0.18s ease-out;
251
218
  pointer-events: none;
252
219
  }
253
- /* Only visible while the user is actively dragging the sheet. */
220
+
254
221
  .bs-root[data-dragging="true"] .bs-handle.bs-handle--ticks::after {
255
222
  opacity: 0.4;
256
223
  }
257
- /* Top mode: dots above the grip instead of below. */
224
+
258
225
  .bs-sheet[data-mode="top"] .bs-handle.bs-handle--ticks::after {
259
226
  bottom: auto;
260
227
  top: 6px;
261
228
  }
262
- /* Side modes: dots run vertically alongside the (vertical) grip. */
229
+
263
230
  .bs-sheet[data-mode="left"] .bs-handle.bs-handle--ticks::after,
264
231
  .bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after {
265
232
  left: 50%;
@@ -270,14 +237,13 @@
270
237
  height: calc(var(--bs-handle-width) * 2);
271
238
  background-size: 3px 8px;
272
239
  background-repeat: repeat-y;
273
- /* Offset the column so it sits beside the grip, not on top of it. */
240
+
274
241
  margin-left: calc(var(--bs-handle-height) + 6px);
275
242
  }
276
243
  .bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after {
277
244
  margin-left: calc(-1 * (var(--bs-handle-height) + 6px));
278
245
  }
279
246
 
280
- /* ----- content ----- */
281
247
  .bs-content {
282
248
  flex: 1;
283
249
  min-height: 0;
@@ -287,38 +253,22 @@
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
- display: none;
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
- /* Engine writes opacity per-frame; transition only when not actively
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
- /* WCAG 1.4.11 — non-text contrast ≥ 3:1 against the surface. */
314
+
377
315
  --bs-handle-color: rgba(255, 255, 255, 0.45);
378
316
  --bs-shadow: 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
- /* Modern open transition — works alongside the JS double-rAF fallback
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
- /* @starting-style: define the "from" frame for the entry interpolation
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);