@sofyan/glass 0.1.4 → 0.1.6
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 +21 -2
- package/dist/glass.css +24 -1
- package/dist/react/index.d.ts +18 -5
- package/dist/react/index.js +35 -10
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Liquid Glass for the web: a translucent material (CSS), React components, and a
|
|
|
6
6
|
- **CSS first.** Plain CSS in cascade layers. Works with Tailwind v4 (its utilities always
|
|
7
7
|
win) and without Tailwind.
|
|
8
8
|
- **Accessible.** Fallbacks for no `backdrop-filter`, reduced transparency, more contrast
|
|
9
|
-
and reduced motion.
|
|
10
|
-
(WCAG 2.5.1, 2.5.7).
|
|
9
|
+
and reduced motion. A tap outside the sheet is the single-tap alternative to the swipe
|
|
10
|
+
(WCAG 2.5.1, 2.5.7); the close button stays for screen readers and keyboards.
|
|
11
11
|
- **Safari first.** No effect depends on Chromium-only features; refraction is an opt-in
|
|
12
12
|
extra that only Chromium draws.
|
|
13
13
|
|
|
@@ -131,6 +131,12 @@ focus returns to the opener. A tap outside closes it too.
|
|
|
131
131
|
the body drags only when scrolled to the top, so scrolling the text never closes it.
|
|
132
132
|
- After a swipe, `onClose` runs once the sheet has slid away. If `open` is still true a
|
|
133
133
|
moment later (say you ask "discard changes?" first), the sheet slides back.
|
|
134
|
+
- On phones there is no visible ✕, like a native sheet: the grabber, a pull down or a tap
|
|
135
|
+
outside closes it. The close button is still there for screen readers and shows when the
|
|
136
|
+
keyboard focuses it.
|
|
137
|
+
- While a finger is on the sheet, the page behind stays still: the hook cancels the touch
|
|
138
|
+
moves that have nothing to scroll (iOS Safari would pan the page otherwise). Mark a
|
|
139
|
+
sideways scroller in the header or footer with `data-glass-no-drag`.
|
|
134
140
|
- **640px and up:** a centred card. No swipe.
|
|
135
141
|
- Opening focuses the dialog itself, so a screen reader starts at the title and no focus
|
|
136
142
|
ring shows on the close button.
|
|
@@ -147,6 +153,19 @@ Pass `enabled: false` once the sheet is closed. After `onClose` the hook keeps t
|
|
|
147
153
|
off-screen and clears its inline styles when `enabled` turns false; if that has not
|
|
148
154
|
happened a moment later, it slides the sheet back.
|
|
149
155
|
|
|
156
|
+
From release until the sheet has closed, the hook sets `data-closing` on it. Style the
|
|
157
|
+
`::backdrop` with it so the dim fades out before the dialog closes: iOS Safari can leave a
|
|
158
|
+
closed dialog's backdrop painted. `.glass-dialog` does this already; for your own dialog:
|
|
159
|
+
|
|
160
|
+
```css
|
|
161
|
+
dialog.my-sheet::backdrop {
|
|
162
|
+
transition: background-color 180ms ease-out;
|
|
163
|
+
}
|
|
164
|
+
dialog.my-sheet[data-closing]::backdrop {
|
|
165
|
+
background-color: transparent;
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
150
169
|
### Refraction (Chromium only)
|
|
151
170
|
|
|
152
171
|
Mount `<GlassFilter />` once near the root, then add `refract` (or `glass-refract`). Safari
|
package/dist/glass.css
CHANGED
|
@@ -524,6 +524,15 @@
|
|
|
524
524
|
background-color: var(--lg-scrim);
|
|
525
525
|
overflow: hidden;
|
|
526
526
|
overscroll-behavior: contain;
|
|
527
|
+
/* Both ways: out on a swipe-close, back in if the sheet comes back. No effect on open,
|
|
528
|
+
where the backdrop is new and has nothing to transition from. */
|
|
529
|
+
transition: background-color var(--lg-duration-fast) var(--lg-ease-out);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/* Set by the swipe hook from release until the sheet has closed. iOS Safari can leave a
|
|
533
|
+
closed dialog's backdrop painted, so it must already be clear when the close happens. */
|
|
534
|
+
dialog.glass-dialog[data-closing]::backdrop {
|
|
535
|
+
background-color: transparent;
|
|
527
536
|
}
|
|
528
537
|
|
|
529
538
|
.glass-dialog-grabber {
|
|
@@ -633,6 +642,19 @@
|
|
|
633
642
|
padding-top: 0.5rem;
|
|
634
643
|
}
|
|
635
644
|
|
|
645
|
+
/* Like a native sheet: no ✕ on phones. A pull down or a tap outside closes it. The
|
|
646
|
+
button stays for screen readers, and shows when the keyboard focuses it. */
|
|
647
|
+
.glass-dialog-close:not(:focus-visible) {
|
|
648
|
+
position: absolute;
|
|
649
|
+
width: 1px;
|
|
650
|
+
height: 1px;
|
|
651
|
+
margin: -1px;
|
|
652
|
+
padding: 0;
|
|
653
|
+
overflow: hidden;
|
|
654
|
+
clip-path: inset(50%);
|
|
655
|
+
white-space: nowrap;
|
|
656
|
+
}
|
|
657
|
+
|
|
636
658
|
/* Clear the home indicator under the last line. */
|
|
637
659
|
.glass-dialog-body:last-child,
|
|
638
660
|
.glass-dialog-footer {
|
|
@@ -689,7 +711,8 @@
|
|
|
689
711
|
.glass-menu-item,
|
|
690
712
|
.glass-sheet,
|
|
691
713
|
.glass-scrim,
|
|
692
|
-
dialog.glass-dialog[open]
|
|
714
|
+
dialog.glass-dialog[open],
|
|
715
|
+
dialog.glass-dialog::backdrop {
|
|
693
716
|
animation: none;
|
|
694
717
|
transition: none;
|
|
695
718
|
}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -71,8 +71,9 @@ interface GlassSheetProps {
|
|
|
71
71
|
/**
|
|
72
72
|
* A modal sheet on a native <dialog>: the browser makes the page inert, keeps focus inside,
|
|
73
73
|
* closes on Esc and returns focus to the opener. Centred from 640px up; on phones a bottom
|
|
74
|
-
* sheet with a grabber that can be pulled down to close.
|
|
75
|
-
* single-tap alternative to the swipe (WCAG 2.5.1 and
|
|
74
|
+
* sheet with a grabber that can be pulled down to close. On phones the ✕ is hidden, like a
|
|
75
|
+
* native sheet: a tap outside is the single-tap alternative to the swipe (WCAG 2.5.1 and
|
|
76
|
+
* 2.5.7), and the button stays for screen readers and keyboards.
|
|
76
77
|
*
|
|
77
78
|
* Opening focuses the dialog itself rather than the close button, so screen readers start
|
|
78
79
|
* at the title and no focus ring flashes on the ✕ for touch users.
|
|
@@ -97,6 +98,9 @@ interface SwipeToCloseOptions {
|
|
|
97
98
|
/**
|
|
98
99
|
* Called once the sheet has slid away. The sheet stays off-screen until `enabled` turns
|
|
99
100
|
* false; if that has not happened `REOPEN_AFTER_MS` later, it slides back.
|
|
101
|
+
*
|
|
102
|
+
* From release until the sheet is closed and tidied up (or comes back) it carries
|
|
103
|
+
* `data-closing`. Style the backdrop with it, so the dim is gone before the close.
|
|
100
104
|
*/
|
|
101
105
|
onClose: () => void;
|
|
102
106
|
/** Media query for when the gesture applies. Default: the phone bottom-sheet layout. */
|
|
@@ -105,13 +109,22 @@ interface SwipeToCloseOptions {
|
|
|
105
109
|
/**
|
|
106
110
|
* Pull-down-to-close for a sheet. Touch uses touch events, because a pointer-events drag
|
|
107
111
|
* over scrollable content is cancelled by the browser as soon as it starts to pan; with
|
|
108
|
-
* a non-passive touchmove we can stop that pan
|
|
109
|
-
*
|
|
110
|
-
*
|
|
112
|
+
* a non-passive touchmove we can stop that pan. Mouse and pen use pointer events. The sheet
|
|
113
|
+
* follows the finger via an inline transform and either slides away (then `onClose`) or
|
|
114
|
+
* settles back.
|
|
115
|
+
*
|
|
116
|
+
* iOS Safari decides at the first touchmove of a gesture whether the page pans, and later
|
|
117
|
+
* moves can no longer stop it. So wherever nothing in the sheet would scroll for that touch
|
|
118
|
+
* (the header, grabber and backdrop, a downward pull at the top of the body, a body with
|
|
119
|
+
* nothing to scroll), touchmoves are cancelled from the first one; taps still click.
|
|
111
120
|
*
|
|
112
121
|
* After a slide-away the inline transform is kept until the effect is torn down (the owner
|
|
113
122
|
* closed the sheet and `enabled` turned false). Clearing it earlier would show the sheet at
|
|
114
123
|
* rest for a frame before the close is committed.
|
|
124
|
+
*
|
|
125
|
+
* From release until the sheet is closed and tidied up, or comes back, the sheet has the
|
|
126
|
+
* attribute `data-closing`. Fade the backdrop out with it (`[data-closing]::backdrop`): iOS
|
|
127
|
+
* Safari can leave a dialog's backdrop painted after it closes, so it must be clear by then.
|
|
115
128
|
*/
|
|
116
129
|
declare function useSwipeToClose(sheetRef: RefObject<HTMLElement | null>, { enabled, scrollRef, onClose, media }: SwipeToCloseOptions): void;
|
|
117
130
|
|
package/dist/react/index.js
CHANGED
|
@@ -206,6 +206,7 @@ function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-
|
|
|
206
206
|
const sheet = sheetRef.current;
|
|
207
207
|
if (!enabled || !sheet) return;
|
|
208
208
|
let drag = null;
|
|
209
|
+
let holdPage = false;
|
|
209
210
|
let suppressClick = false;
|
|
210
211
|
let alive = true;
|
|
211
212
|
let closing = false;
|
|
@@ -219,11 +220,13 @@ function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-
|
|
|
219
220
|
sheet.style.transform = "";
|
|
220
221
|
sheet.style.transition = "";
|
|
221
222
|
sheet.removeAttribute("data-dragging");
|
|
223
|
+
sheet.removeAttribute("data-closing");
|
|
222
224
|
};
|
|
223
225
|
runs.set(sheet, (runs.get(sheet) ?? 0) + 1);
|
|
224
226
|
resetStyles();
|
|
225
227
|
sheet.style.animation = "";
|
|
226
228
|
const settleBack = () => {
|
|
229
|
+
sheet.removeAttribute("data-closing");
|
|
227
230
|
sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;
|
|
228
231
|
sheet.style.transform = "";
|
|
229
232
|
timer = setTimeout(resetStyles, SETTLE_MS);
|
|
@@ -299,32 +302,54 @@ function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-
|
|
|
299
302
|
return;
|
|
300
303
|
}
|
|
301
304
|
closing = true;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;
|
|
305
|
+
sheet.setAttribute("data-closing", "");
|
|
306
|
+
sheet.style.transition = reduceMotion ? "none" : `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;
|
|
307
307
|
sheet.style.transform = "translate3d(0, 100%, 0)";
|
|
308
|
-
|
|
308
|
+
const comeBack = reduceMotion ? resetStyles : settleBack;
|
|
309
|
+
timer = setTimeout(() => requestClose(comeBack), SLIDE_AWAY_MS);
|
|
309
310
|
};
|
|
310
311
|
const cancel = () => {
|
|
311
312
|
const wasActive = drag?.active === true;
|
|
312
313
|
drag = null;
|
|
313
314
|
if (wasActive) resetStyles();
|
|
314
315
|
};
|
|
316
|
+
const bodyCannotScroll = () => {
|
|
317
|
+
const scroller = scrollRef?.current;
|
|
318
|
+
return !scroller || scroller.scrollHeight <= scroller.clientHeight;
|
|
319
|
+
};
|
|
315
320
|
const onTouchStart = (e) => {
|
|
321
|
+
holdPage = false;
|
|
316
322
|
const t = e.touches[0];
|
|
317
323
|
if (e.touches.length !== 1 || !t) return cancel();
|
|
318
324
|
begin("touch", t.clientX, t.clientY, e.target);
|
|
325
|
+
const scroller = scrollRef?.current;
|
|
326
|
+
const inBody = !!scroller && e.target instanceof Node && scroller.contains(e.target);
|
|
327
|
+
holdPage = drag?.pointerId === "touch" && (!inBody || bodyCannotScroll());
|
|
319
328
|
};
|
|
320
329
|
const onTouchMove = (e) => {
|
|
321
330
|
const t = e.touches[0];
|
|
322
|
-
|
|
323
|
-
if (
|
|
331
|
+
let stopPan = holdPage;
|
|
332
|
+
if (t && drag?.pointerId === "touch") {
|
|
333
|
+
const pulledDown = t.clientY > drag.startY;
|
|
334
|
+
if (move(t.clientX, t.clientY)) {
|
|
335
|
+
stopPan = true;
|
|
336
|
+
} else if (drag) {
|
|
337
|
+
stopPan ||= pulledDown;
|
|
338
|
+
} else if (bodyCannotScroll()) {
|
|
339
|
+
holdPage = true;
|
|
340
|
+
stopPan = true;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (stopPan && e.cancelable) e.preventDefault();
|
|
324
344
|
};
|
|
325
345
|
const onTouchEnd = () => {
|
|
346
|
+
holdPage = false;
|
|
326
347
|
if (drag?.pointerId === "touch") end();
|
|
327
348
|
};
|
|
349
|
+
const onTouchCancel = () => {
|
|
350
|
+
holdPage = false;
|
|
351
|
+
cancel();
|
|
352
|
+
};
|
|
328
353
|
const onPointerDown = (e) => {
|
|
329
354
|
if (e.pointerType === "touch" || e.button !== 0) return;
|
|
330
355
|
begin(e.pointerId, e.clientX, e.clientY, e.target);
|
|
@@ -351,7 +376,7 @@ function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-
|
|
|
351
376
|
sheet.addEventListener("touchstart", onTouchStart, { passive: true });
|
|
352
377
|
sheet.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
353
378
|
sheet.addEventListener("touchend", onTouchEnd);
|
|
354
|
-
sheet.addEventListener("touchcancel",
|
|
379
|
+
sheet.addEventListener("touchcancel", onTouchCancel);
|
|
355
380
|
sheet.addEventListener("pointerdown", onPointerDown);
|
|
356
381
|
sheet.addEventListener("click", onClickCapture, true);
|
|
357
382
|
window.addEventListener("pointermove", onPointerMove);
|
|
@@ -370,7 +395,7 @@ function useSwipeToClose(sheetRef, { enabled, scrollRef, onClose, media = "(max-
|
|
|
370
395
|
sheet.removeEventListener("touchstart", onTouchStart);
|
|
371
396
|
sheet.removeEventListener("touchmove", onTouchMove);
|
|
372
397
|
sheet.removeEventListener("touchend", onTouchEnd);
|
|
373
|
-
sheet.removeEventListener("touchcancel",
|
|
398
|
+
sheet.removeEventListener("touchcancel", onTouchCancel);
|
|
374
399
|
sheet.removeEventListener("pointerdown", onPointerDown);
|
|
375
400
|
sheet.removeEventListener("click", onClickCapture, true);
|
|
376
401
|
window.removeEventListener("pointermove", onPointerMove);
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react/Glass.tsx","../../src/react/cx.ts","../../src/react/GlassButton.tsx","../../src/react/GlassFilter.tsx","../../src/react/GlassSheet.tsx","../../src/react/swipe.ts"],"sourcesContent":["import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementType,\n type ForwardedRef,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\nimport { cx } from './cx';\n\nexport type GlassTone = 'light' | 'dark' | 'clear' | 'tinted' | 'tinted-secondary' | 'danger';\nexport type GlassThickness = 'thin' | 'regular' | 'thick';\nexport type GlassShape = 'sm' | 'md' | 'lg' | 'xl' | 'pill';\n\nconst TONE_CLASS: Record<GlassTone, string | undefined> = {\n light: undefined,\n dark: 'glass-dark',\n clear: 'glass-clear',\n tinted: 'glass-tinted',\n 'tinted-secondary': 'glass-tinted-secondary',\n danger: 'glass-danger',\n};\n\nconst THICKNESS_CLASS: Record<GlassThickness, string | undefined> = {\n thin: 'glass-thin',\n regular: undefined,\n thick: 'glass-thick',\n};\n\nconst SHAPE_CLASS: Record<GlassShape, string | undefined> = {\n sm: 'glass-sm',\n md: undefined,\n lg: 'glass-lg',\n xl: 'glass-xl',\n pill: 'glass-pill',\n};\n\nexport interface GlassOptions {\n tone?: GlassTone;\n thickness?: GlassThickness;\n shape?: GlassShape;\n /** Hover fill, press-scale and focus ring. Use for clickable surfaces. */\n interactive?: boolean;\n /** Float upward on hover. Use for cards. */\n lift?: boolean;\n /** Chromium-only SVG refraction (no-op elsewhere). Needs <GlassFilter /> mounted once. */\n refract?: boolean;\n}\n\n/** The class list for a glass surface, for elements you can't swap for <Glass>. */\nexport function glassClasses({\n tone = 'light',\n thickness = 'regular',\n shape = 'md',\n interactive = false,\n lift = false,\n refract = false,\n}: GlassOptions = {}): string {\n return cx(\n 'glass',\n TONE_CLASS[tone],\n THICKNESS_CLASS[thickness],\n SHAPE_CLASS[shape],\n interactive && 'glass-interactive',\n lift && 'glass-lift',\n refract && 'glass-refract',\n );\n}\n\nexport type GlassProps<T extends ElementType = 'div'> = GlassOptions & {\n as?: T;\n className?: string;\n children?: ReactNode;\n} & Omit<ComponentPropsWithoutRef<T>, keyof GlassOptions | 'as' | 'className' | 'children'>;\n\nfunction GlassInner<T extends ElementType = 'div'>(\n {\n as,\n tone,\n thickness,\n shape,\n interactive,\n lift,\n refract,\n className,\n children,\n ...rest\n }: GlassProps<T>,\n ref: ForwardedRef<Element>,\n) {\n const Component: ElementType = as ?? 'div';\n return (\n <Component\n ref={ref}\n className={cx(\n glassClasses({ tone, thickness, shape, interactive, lift, refract }),\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n}\n\n/** A Liquid Glass surface. Polymorphic: `<Glass as=\"nav\" tone=\"dark\" shape=\"pill\">`. */\nexport const Glass = forwardRef(GlassInner) as <T extends ElementType = 'div'>(\n props: GlassProps<T> & { ref?: Ref<Element> },\n) => ReactElement | null;\n","/** Join class names, skipping falsy values. */\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(' ');\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cx } from './cx';\n\nexport type GlassButtonVariant = 'glass' | 'dark' | 'clear' | 'primary' | 'secondary' | 'danger';\nexport type GlassButtonSize = 'sm' | 'md' | 'lg';\n\nconst VARIANT_CLASS: Record<GlassButtonVariant, string | undefined> = {\n glass: undefined,\n dark: 'glass-dark',\n clear: 'glass-clear',\n primary: 'glass-tinted',\n secondary: 'glass-tinted-secondary',\n danger: 'glass-danger',\n};\n\nconst SIZE_CLASS: Record<GlassButtonSize, string | undefined> = {\n sm: 'glass-btn-sm',\n md: undefined,\n lg: 'glass-btn-lg',\n};\n\nexport interface GlassButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: GlassButtonVariant;\n size?: GlassButtonSize;\n /** Stretch to the container width. */\n block?: boolean;\n}\n\n/** A glass button with a 44px touch target. Defaults to `type=\"button\"`. */\nexport const GlassButton = forwardRef<HTMLButtonElement, GlassButtonProps>(function GlassButton(\n { variant = 'glass', size = 'md', block = false, className, type = 'button', ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n className={cx(\n 'glass-btn',\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n block && 'glass-block',\n className,\n )}\n {...rest}\n />\n );\n});\n","import { useEffect } from 'react';\n\n/**\n * True when the browser renders SVG filters inside `backdrop-filter`\n * (currently Chromium only). Safari and Firefox accept the syntax but either\n * ignore it or drop the whole backdrop, so we gate on the engine instead.\n */\nexport function supportsBackdropRefraction(): boolean {\n if (typeof navigator === 'undefined' || typeof CSS === 'undefined') return false;\n const uaData = (navigator as Navigator & { userAgentData?: { brands?: { brand: string }[] } })\n .userAgentData;\n const isChromium = !!uaData?.brands?.some((b) => b.brand === 'Chromium');\n return isChromium && CSS.supports('backdrop-filter', 'url(#lg-refract)');\n}\n\n/**\n * Mount once near the app root. Provides the `#lg-refract` displacement filter\n * used by `.glass-refract` and flags support on <html data-lg-refract>.\n */\nexport function GlassFilter() {\n useEffect(() => {\n if (!supportsBackdropRefraction()) return;\n const root = document.documentElement;\n root.setAttribute('data-lg-refract', '');\n return () => {\n root.removeAttribute('data-lg-refract');\n };\n }, []);\n\n return (\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n width=\"0\"\n height=\"0\"\n style={{ position: 'absolute', width: 0, height: 0, overflow: 'hidden' }}\n >\n <filter\n id=\"lg-refract\"\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency=\"0.008 0.012\"\n numOctaves=\"2\"\n seed=\"7\"\n result=\"noise\"\n />\n <feGaussianBlur in=\"noise\" stdDeviation=\"2\" result=\"softNoise\" />\n <feDisplacementMap\n in=\"SourceGraphic\"\n in2=\"softNoise\"\n scale=\"18\"\n xChannelSelector=\"R\"\n yChannelSelector=\"G\"\n />\n </filter>\n </svg>\n );\n}\n","import {\n useEffect,\n useId,\n useRef,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\nimport { cx } from './cx';\nimport { useSwipeToClose } from './swipe';\n\nexport interface GlassSheetProps {\n open: boolean;\n /** Called when the person closes it: the close button, a swipe down, Esc or a tap outside. */\n onClose: () => void;\n /** Names the dialog (aria-labelledby). */\n title: ReactNode;\n /** Small line above the title, e.g. \"About event\". */\n eyebrow?: ReactNode;\n /** Accessible name of the close button. Translate it. */\n closeLabel?: string;\n /** Pull down to close in the phone (bottom sheet) layout. Default true. */\n swipeToClose?: boolean;\n /** Content pinned under the scrolling body, e.g. actions. */\n footer?: ReactNode;\n children?: ReactNode;\n className?: string;\n bodyClassName?: string;\n}\n\n/** Light dismiss is native where `closedby` is supported; elsewhere it is done below. */\nconst needsLightDismissFallback = () =>\n typeof HTMLDialogElement !== 'undefined' && !('closedBy' in HTMLDialogElement.prototype);\n\nconst isOutside = (e: ReactMouseEvent<HTMLDialogElement>) => {\n const r = e.currentTarget.getBoundingClientRect();\n return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;\n};\n\nfunction CloseIcon() {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M6 18 18 6M6 6l12 12\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\n/**\n * A modal sheet on a native <dialog>: the browser makes the page inert, keeps focus inside,\n * closes on Esc and returns focus to the opener. Centred from 640px up; on phones a bottom\n * sheet with a grabber that can be pulled down to close. The close button stays, as the\n * single-tap alternative to the swipe (WCAG 2.5.1 and 2.5.7).\n *\n * Opening focuses the dialog itself rather than the close button, so screen readers start\n * at the title and no focus ring flashes on the ✕ for touch users.\n */\nexport function GlassSheet({\n open,\n onClose,\n title,\n eyebrow,\n closeLabel = 'Close',\n swipeToClose = true,\n footer,\n children,\n className,\n bodyClassName,\n}: GlassSheetProps) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const pressedOutside = useRef(false);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog || open === dialog.hasAttribute('open')) return;\n // Feature-checked: older engines and jsdom lack showModal/close.\n if (open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n dialog.focus({ preventScroll: true });\n if (bodyRef.current) bodyRef.current.scrollTop = 0;\n } else if (typeof dialog.close === 'function') {\n dialog.close();\n } else {\n dialog.removeAttribute('open');\n }\n }, [open]);\n\n useSwipeToClose(dialogRef, { enabled: open && swipeToClose, scrollRef: bodyRef, onClose });\n\n return (\n <dialog\n ref={dialogRef}\n // Not yet in React's types; React passes it through as an attribute.\n {...{ closedby: 'any' }}\n tabIndex={-1}\n aria-labelledby={titleId}\n // Esc or light dismiss closed it; when `open` is already false the page closed it.\n onClose={() => {\n if (open) onClose();\n }}\n // Without `closedby`: close only when both the press and the release are outside the\n // box, so a text selection dragged onto the backdrop does not dismiss.\n onPointerDown={(e) => {\n pressedOutside.current = needsLightDismissFallback() && isOutside(e);\n }}\n onPointerUp={(e) => {\n if (pressedOutside.current && isOutside(e)) onClose();\n pressedOutside.current = false;\n }}\n className={cx('glass-dialog', className)}\n >\n {swipeToClose && <div className=\"glass-dialog-grabber\" aria-hidden=\"true\" />}\n <header className=\"glass-dialog-header\">\n <div className=\"glass-dialog-heading\">\n {eyebrow && <p className=\"glass-dialog-eyebrow\">{eyebrow}</p>}\n <h2 id={titleId} className=\"glass-dialog-title\">\n {title}\n </h2>\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={closeLabel}\n className=\"glass-dialog-close\"\n >\n <CloseIcon />\n </button>\n </header>\n <div ref={bodyRef} className={cx('glass-dialog-body', bodyClassName)}>\n {children}\n </div>\n {footer && <div className=\"glass-dialog-footer\">{footer}</div>}\n </dialog>\n );\n}\n","import { useEffect, useRef, type RefObject } from 'react';\n\n/** Movement (px) before a press counts as a drag, so taps and small jitters stay taps. */\nexport const DRAG_SLOP_PX = 8;\n/** Pull further than this share of the sheet's height and it closes on release. */\nexport const CLOSE_DISTANCE_RATIO = 0.25;\n/** Or flick downward at least this fast (px per ms), however short the pull. */\nexport const CLOSE_VELOCITY = 0.5;\n/** A flick only counts once the sheet has moved this far, so a twitch doesn't close it. */\nexport const MIN_FLICK_PX = 24;\n/** How long the sheet takes to slide away or settle back (ms). */\nexport const SETTLE_MS = 220;\n/**\n * How long after release the owner is asked to close (ms): the slide-away plus a margin, so\n * the transition has really finished. Closing a dialog while its transform is still moving\n * is one more thing iOS Safari may get wrong.\n */\nexport const SLIDE_AWAY_MS = SETTLE_MS + 60;\n/**\n * After `onClose`, how long the sheet waits off-screen for its owner to close it (ms). If it\n * is still open by then (the owner kept it, e.g. to ask \"discard changes?\"), it comes back.\n */\nexport const REOPEN_AFTER_MS = 250;\n\nconst SETTLE_EASE = 'cubic-bezier(0.22, 1, 0.36, 1)';\n\nexport interface ReleaseState {\n /** How far the sheet is pulled down (px). */\n offset: number;\n /** The sheet's height (px). */\n height: number;\n /** Downward speed at release (px per ms; negative means moving up). */\n velocity: number;\n}\n\n/** Whether a released drag should close the sheet or let it settle back. */\nexport function shouldClose({ offset, height, velocity }: ReleaseState): boolean {\n if (offset <= 0) return false;\n if (height > 0 && offset >= height * CLOSE_DISTANCE_RATIO) return true;\n return velocity >= CLOSE_VELOCITY && offset >= MIN_FLICK_PX;\n}\n\n/** Controls a press should leave alone: a drag starting on one would steal its tap. */\nconst INTERACTIVE =\n 'button, a[href], input, select, textarea, label, summary, [contenteditable=\"\"], [contenteditable=\"true\"], [role=\"button\"], [role=\"slider\"], [data-glass-no-drag]';\n\n/** Counts the hook runs per sheet, so a late tidy-up never touches a sheet that is in use again. */\nconst runs = new WeakMap<HTMLElement, number>();\n\nconst prefersReducedMotion = () =>\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\nexport interface SwipeToCloseOptions {\n /** Turn the gesture on or off (e.g. only while open, only in the bottom-sheet layout). */\n enabled: boolean;\n /** The scrolling part of the sheet. A press there drags only while it is scrolled to the top. */\n scrollRef?: RefObject<HTMLElement | null>;\n /**\n * Called once the sheet has slid away. The sheet stays off-screen until `enabled` turns\n * false; if that has not happened `REOPEN_AFTER_MS` later, it slides back.\n */\n onClose: () => void;\n /** Media query for when the gesture applies. Default: the phone bottom-sheet layout. */\n media?: string;\n}\n\ninterface Drag {\n pointerId: number | 'touch';\n startX: number;\n startY: number;\n lastY: number;\n lastT: number;\n velocity: number;\n /** Null until the press has moved past the slop and we know whether it is our drag. */\n active: boolean | null;\n}\n\n/**\n * Pull-down-to-close for a sheet. Touch uses touch events, because a pointer-events drag\n * over scrollable content is cancelled by the browser as soon as it starts to pan; with\n * a non-passive touchmove we can stop that pan once the drag is ours. Mouse and pen use\n * pointer events. The sheet follows the finger via an inline transform and either slides\n * away (then `onClose`) or settles back.\n *\n * After a slide-away the inline transform is kept until the effect is torn down (the owner\n * closed the sheet and `enabled` turned false). Clearing it earlier would show the sheet at\n * rest for a frame before the close is committed.\n */\nexport function useSwipeToClose(\n sheetRef: RefObject<HTMLElement | null>,\n { enabled, scrollRef, onClose, media = '(max-width: 639.98px)' }: SwipeToCloseOptions,\n): void {\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n\n useEffect(() => {\n const sheet = sheetRef.current;\n if (!enabled || !sheet) return;\n\n let drag: Drag | null = null;\n let suppressClick = false;\n // False once the effect is torn down, so nothing is scheduled on a sheet we let go of.\n let alive = true;\n // True from release until the owner closes the sheet or it comes back.\n let closing = false;\n // The release phases (slide away, wait for the owner, settle back) run one after\n // another, so a single timer handle covers them.\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const clearTimer = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n\n const applies = () =>\n typeof window.matchMedia !== 'function' || window.matchMedia(media).matches;\n\n const resetStyles = () => {\n sheet.style.transform = '';\n sheet.style.transition = '';\n sheet.removeAttribute('data-dragging');\n };\n\n // Start clean: an earlier run may have left its inline styles (see the cleanup).\n runs.set(sheet, (runs.get(sheet) ?? 0) + 1);\n resetStyles();\n sheet.style.animation = '';\n\n /** Animate back to rest, then drop the inline styles. */\n const settleBack = () => {\n sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;\n sheet.style.transform = '';\n // A timer, not transitionend: that event never fires if nothing moved or the tab hid.\n timer = setTimeout(resetStyles, SETTLE_MS);\n };\n\n /**\n * Ask the owner to close, leaving the sheet where it is. The effect cleanup clears the\n * styles once the sheet really closes; if it is still open after REOPEN_AFTER_MS,\n * `comeBack` runs.\n */\n const requestClose = (comeBack: () => void) => {\n try {\n onCloseRef.current();\n } finally {\n // The owner may have closed the sheet synchronously, tearing this effect down.\n if (alive) {\n timer = setTimeout(() => {\n closing = false;\n comeBack();\n }, REOPEN_AFTER_MS);\n }\n }\n };\n\n const begin = (id: Drag['pointerId'], x: number, y: number, target: EventTarget | null) => {\n // While closing, the sheet is sliding away or waiting for its owner: leave it be.\n if (drag || closing || !applies()) return;\n const el = target instanceof Element ? target : null;\n if (!el || !sheet.contains(el) || el.closest(INTERACTIVE)) return;\n const scroller = scrollRef?.current;\n if (scroller && scroller.contains(el) && scroller.scrollTop > 0) return;\n // Text selected inside the body: the press is probably adjusting it.\n if (scroller?.contains(el) && window.getSelection()?.isCollapsed === false) return;\n clearTimer();\n drag = {\n pointerId: id,\n startX: x,\n startY: y,\n lastY: y,\n lastT: performance.now(),\n velocity: 0,\n active: null,\n };\n };\n\n /** Returns true while the move belongs to the drag (so the caller can stop scrolling). */\n const move = (x: number, y: number): boolean => {\n if (!drag) return false;\n const dy = y - drag.startY;\n const dx = x - drag.startX;\n if (drag.active === null) {\n if (Math.abs(dy) < DRAG_SLOP_PX && Math.abs(dx) < DRAG_SLOP_PX) return false;\n // Upward or sideways: a scroll or a swipe for something else. Let it go.\n if (dy <= 0 || Math.abs(dx) > Math.abs(dy)) {\n drag = null;\n return false;\n }\n drag.active = true;\n sheet.setAttribute('data-dragging', '');\n sheet.style.transition = 'none';\n // Off until the sheet closes (see cleanup). An open animation with a fill mode would\n // override the inline transform, and switching it off only for the drag would replay\n // it on release.\n sheet.style.animation = 'none';\n }\n const now = performance.now();\n const dt = now - drag.lastT;\n if (dt > 0) drag.velocity = (y - drag.lastY) / dt;\n drag.lastY = y;\n drag.lastT = now;\n sheet.style.transform = `translate3d(0, ${Math.max(0, dy - DRAG_SLOP_PX)}px, 0)`;\n return true;\n };\n\n const end = () => {\n if (!drag) return;\n const wasActive = drag.active === true;\n const wasTouch = drag.pointerId === 'touch';\n const offset = Math.max(0, drag.lastY - drag.startY - DRAG_SLOP_PX);\n // A long pause before letting go means the flick is over.\n const velocity = performance.now() - drag.lastT > 100 ? 0 : drag.velocity;\n drag = null;\n if (!wasActive) return;\n // Only a mouse or pen drag ends in a click to swallow. A touch drag does not, and the\n // flag would then eat the next real activation (e.g. from a screen reader).\n suppressClick = !wasTouch;\n sheet.removeAttribute('data-dragging');\n\n const close = shouldClose({ offset, height: sheet.getBoundingClientRect().height, velocity });\n const reduceMotion = prefersReducedMotion();\n if (!close) {\n if (reduceMotion) resetStyles();\n else settleBack();\n return;\n }\n closing = true;\n if (reduceMotion) {\n // No slide: close from where the finger let go, and snap back if it stays open.\n requestClose(resetStyles);\n return;\n }\n sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;\n sheet.style.transform = 'translate3d(0, 100%, 0)';\n // A timer, not transitionend: that event never fires if nothing moved or the tab hid.\n timer = setTimeout(() => requestClose(settleBack), SLIDE_AWAY_MS);\n };\n\n const cancel = () => {\n const wasActive = drag?.active === true;\n drag = null;\n if (wasActive) resetStyles();\n };\n\n // Touch\n const onTouchStart = (e: TouchEvent) => {\n const t = e.touches[0];\n if (e.touches.length !== 1 || !t) return cancel();\n begin('touch', t.clientX, t.clientY, e.target);\n };\n const onTouchMove = (e: TouchEvent) => {\n const t = e.touches[0];\n if (!t || drag?.pointerId !== 'touch') return;\n if (move(t.clientX, t.clientY) && e.cancelable) e.preventDefault();\n };\n const onTouchEnd = () => {\n if (drag?.pointerId === 'touch') end();\n };\n\n // Mouse and pen (touch is handled above)\n const onPointerDown = (e: PointerEvent) => {\n if (e.pointerType === 'touch' || e.button !== 0) return;\n begin(e.pointerId, e.clientX, e.clientY, e.target);\n };\n const onPointerMove = (e: PointerEvent) => {\n if (drag?.pointerId !== e.pointerId) return;\n if (move(e.clientX, e.clientY)) e.preventDefault();\n };\n const onPointerUp = (e: PointerEvent) => {\n if (drag?.pointerId === e.pointerId) end();\n };\n const onPointerCancel = (e: PointerEvent) => {\n if (drag?.pointerId === e.pointerId) cancel();\n };\n\n // A mouse drag ends with a click on whatever is under it; that click must not count.\n const onClickCapture = (e: MouseEvent) => {\n if (!suppressClick) return;\n suppressClick = false;\n e.preventDefault();\n e.stopPropagation();\n };\n const clearSuppress = () => {\n suppressClick = false;\n };\n\n sheet.addEventListener('touchstart', onTouchStart, { passive: true });\n sheet.addEventListener('touchmove', onTouchMove, { passive: false });\n sheet.addEventListener('touchend', onTouchEnd);\n sheet.addEventListener('touchcancel', cancel);\n sheet.addEventListener('pointerdown', onPointerDown);\n sheet.addEventListener('click', onClickCapture, true);\n window.addEventListener('pointermove', onPointerMove);\n window.addEventListener('pointerup', onPointerUp);\n window.addEventListener('pointercancel', onPointerCancel);\n window.addEventListener('pointerdown', clearSuppress, true);\n\n return () => {\n alive = false;\n clearTimer();\n // Never change the sheet in the frame it closes: moving it or restarting its open\n // animation together with dialog.close() is the suspected cause of the backdrop staying\n // painted on iOS Safari. Tidy up a moment later, unless the sheet is in use again.\n const mine = runs.get(sheet);\n setTimeout(() => {\n if (runs.get(sheet) !== mine) return;\n resetStyles();\n sheet.style.animation = '';\n }, SLIDE_AWAY_MS);\n sheet.removeEventListener('touchstart', onTouchStart);\n sheet.removeEventListener('touchmove', onTouchMove);\n sheet.removeEventListener('touchend', onTouchEnd);\n sheet.removeEventListener('touchcancel', cancel);\n sheet.removeEventListener('pointerdown', onPointerDown);\n sheet.removeEventListener('click', onClickCapture, true);\n window.removeEventListener('pointermove', onPointerMove);\n window.removeEventListener('pointerup', onPointerUp);\n window.removeEventListener('pointercancel', onPointerCancel);\n window.removeEventListener('pointerdown', clearSuppress, true);\n };\n },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AAS,WAAW,GAAG,qBAAqB,aAAa,GAChE,UACH;AAAA,QACC,UAAU,gBAAAA,KAAC,SAAI,WAAU,uBAAuB,kBAAO;AAAA;AAAA;AAAA,EAC1D;AAEJ;","names":["forwardRef","jsx","forwardRef","GlassButton","jsx","useEffect","useRef","useEffect","jsx","jsxs","useRef","useEffect"]}
|
|
1
|
+
{"version":3,"sources":["../../src/react/Glass.tsx","../../src/react/cx.ts","../../src/react/GlassButton.tsx","../../src/react/GlassFilter.tsx","../../src/react/GlassSheet.tsx","../../src/react/swipe.ts"],"sourcesContent":["import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementType,\n type ForwardedRef,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\nimport { cx } from './cx';\n\nexport type GlassTone = 'light' | 'dark' | 'clear' | 'tinted' | 'tinted-secondary' | 'danger';\nexport type GlassThickness = 'thin' | 'regular' | 'thick';\nexport type GlassShape = 'sm' | 'md' | 'lg' | 'xl' | 'pill';\n\nconst TONE_CLASS: Record<GlassTone, string | undefined> = {\n light: undefined,\n dark: 'glass-dark',\n clear: 'glass-clear',\n tinted: 'glass-tinted',\n 'tinted-secondary': 'glass-tinted-secondary',\n danger: 'glass-danger',\n};\n\nconst THICKNESS_CLASS: Record<GlassThickness, string | undefined> = {\n thin: 'glass-thin',\n regular: undefined,\n thick: 'glass-thick',\n};\n\nconst SHAPE_CLASS: Record<GlassShape, string | undefined> = {\n sm: 'glass-sm',\n md: undefined,\n lg: 'glass-lg',\n xl: 'glass-xl',\n pill: 'glass-pill',\n};\n\nexport interface GlassOptions {\n tone?: GlassTone;\n thickness?: GlassThickness;\n shape?: GlassShape;\n /** Hover fill, press-scale and focus ring. Use for clickable surfaces. */\n interactive?: boolean;\n /** Float upward on hover. Use for cards. */\n lift?: boolean;\n /** Chromium-only SVG refraction (no-op elsewhere). Needs <GlassFilter /> mounted once. */\n refract?: boolean;\n}\n\n/** The class list for a glass surface, for elements you can't swap for <Glass>. */\nexport function glassClasses({\n tone = 'light',\n thickness = 'regular',\n shape = 'md',\n interactive = false,\n lift = false,\n refract = false,\n}: GlassOptions = {}): string {\n return cx(\n 'glass',\n TONE_CLASS[tone],\n THICKNESS_CLASS[thickness],\n SHAPE_CLASS[shape],\n interactive && 'glass-interactive',\n lift && 'glass-lift',\n refract && 'glass-refract',\n );\n}\n\nexport type GlassProps<T extends ElementType = 'div'> = GlassOptions & {\n as?: T;\n className?: string;\n children?: ReactNode;\n} & Omit<ComponentPropsWithoutRef<T>, keyof GlassOptions | 'as' | 'className' | 'children'>;\n\nfunction GlassInner<T extends ElementType = 'div'>(\n {\n as,\n tone,\n thickness,\n shape,\n interactive,\n lift,\n refract,\n className,\n children,\n ...rest\n }: GlassProps<T>,\n ref: ForwardedRef<Element>,\n) {\n const Component: ElementType = as ?? 'div';\n return (\n <Component\n ref={ref}\n className={cx(\n glassClasses({ tone, thickness, shape, interactive, lift, refract }),\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n}\n\n/** A Liquid Glass surface. Polymorphic: `<Glass as=\"nav\" tone=\"dark\" shape=\"pill\">`. */\nexport const Glass = forwardRef(GlassInner) as <T extends ElementType = 'div'>(\n props: GlassProps<T> & { ref?: Ref<Element> },\n) => ReactElement | null;\n","/** Join class names, skipping falsy values. */\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(' ');\n}\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cx } from './cx';\n\nexport type GlassButtonVariant = 'glass' | 'dark' | 'clear' | 'primary' | 'secondary' | 'danger';\nexport type GlassButtonSize = 'sm' | 'md' | 'lg';\n\nconst VARIANT_CLASS: Record<GlassButtonVariant, string | undefined> = {\n glass: undefined,\n dark: 'glass-dark',\n clear: 'glass-clear',\n primary: 'glass-tinted',\n secondary: 'glass-tinted-secondary',\n danger: 'glass-danger',\n};\n\nconst SIZE_CLASS: Record<GlassButtonSize, string | undefined> = {\n sm: 'glass-btn-sm',\n md: undefined,\n lg: 'glass-btn-lg',\n};\n\nexport interface GlassButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: GlassButtonVariant;\n size?: GlassButtonSize;\n /** Stretch to the container width. */\n block?: boolean;\n}\n\n/** A glass button with a 44px touch target. Defaults to `type=\"button\"`. */\nexport const GlassButton = forwardRef<HTMLButtonElement, GlassButtonProps>(function GlassButton(\n { variant = 'glass', size = 'md', block = false, className, type = 'button', ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n className={cx(\n 'glass-btn',\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n block && 'glass-block',\n className,\n )}\n {...rest}\n />\n );\n});\n","import { useEffect } from 'react';\n\n/**\n * True when the browser renders SVG filters inside `backdrop-filter`\n * (currently Chromium only). Safari and Firefox accept the syntax but either\n * ignore it or drop the whole backdrop, so we gate on the engine instead.\n */\nexport function supportsBackdropRefraction(): boolean {\n if (typeof navigator === 'undefined' || typeof CSS === 'undefined') return false;\n const uaData = (navigator as Navigator & { userAgentData?: { brands?: { brand: string }[] } })\n .userAgentData;\n const isChromium = !!uaData?.brands?.some((b) => b.brand === 'Chromium');\n return isChromium && CSS.supports('backdrop-filter', 'url(#lg-refract)');\n}\n\n/**\n * Mount once near the app root. Provides the `#lg-refract` displacement filter\n * used by `.glass-refract` and flags support on <html data-lg-refract>.\n */\nexport function GlassFilter() {\n useEffect(() => {\n if (!supportsBackdropRefraction()) return;\n const root = document.documentElement;\n root.setAttribute('data-lg-refract', '');\n return () => {\n root.removeAttribute('data-lg-refract');\n };\n }, []);\n\n return (\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n width=\"0\"\n height=\"0\"\n style={{ position: 'absolute', width: 0, height: 0, overflow: 'hidden' }}\n >\n <filter\n id=\"lg-refract\"\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency=\"0.008 0.012\"\n numOctaves=\"2\"\n seed=\"7\"\n result=\"noise\"\n />\n <feGaussianBlur in=\"noise\" stdDeviation=\"2\" result=\"softNoise\" />\n <feDisplacementMap\n in=\"SourceGraphic\"\n in2=\"softNoise\"\n scale=\"18\"\n xChannelSelector=\"R\"\n yChannelSelector=\"G\"\n />\n </filter>\n </svg>\n );\n}\n","import {\n useEffect,\n useId,\n useRef,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\nimport { cx } from './cx';\nimport { useSwipeToClose } from './swipe';\n\nexport interface GlassSheetProps {\n open: boolean;\n /** Called when the person closes it: the close button, a swipe down, Esc or a tap outside. */\n onClose: () => void;\n /** Names the dialog (aria-labelledby). */\n title: ReactNode;\n /** Small line above the title, e.g. \"About event\". */\n eyebrow?: ReactNode;\n /** Accessible name of the close button. Translate it. */\n closeLabel?: string;\n /** Pull down to close in the phone (bottom sheet) layout. Default true. */\n swipeToClose?: boolean;\n /** Content pinned under the scrolling body, e.g. actions. */\n footer?: ReactNode;\n children?: ReactNode;\n className?: string;\n bodyClassName?: string;\n}\n\n/** Light dismiss is native where `closedby` is supported; elsewhere it is done below. */\nconst needsLightDismissFallback = () =>\n typeof HTMLDialogElement !== 'undefined' && !('closedBy' in HTMLDialogElement.prototype);\n\nconst isOutside = (e: ReactMouseEvent<HTMLDialogElement>) => {\n const r = e.currentTarget.getBoundingClientRect();\n return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;\n};\n\nfunction CloseIcon() {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M6 18 18 6M6 6l12 12\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\n/**\n * A modal sheet on a native <dialog>: the browser makes the page inert, keeps focus inside,\n * closes on Esc and returns focus to the opener. Centred from 640px up; on phones a bottom\n * sheet with a grabber that can be pulled down to close. On phones the ✕ is hidden, like a\n * native sheet: a tap outside is the single-tap alternative to the swipe (WCAG 2.5.1 and\n * 2.5.7), and the button stays for screen readers and keyboards.\n *\n * Opening focuses the dialog itself rather than the close button, so screen readers start\n * at the title and no focus ring flashes on the ✕ for touch users.\n */\nexport function GlassSheet({\n open,\n onClose,\n title,\n eyebrow,\n closeLabel = 'Close',\n swipeToClose = true,\n footer,\n children,\n className,\n bodyClassName,\n}: GlassSheetProps) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const pressedOutside = useRef(false);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog || open === dialog.hasAttribute('open')) return;\n // Feature-checked: older engines and jsdom lack showModal/close.\n if (open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n dialog.focus({ preventScroll: true });\n if (bodyRef.current) bodyRef.current.scrollTop = 0;\n } else if (typeof dialog.close === 'function') {\n dialog.close();\n } else {\n dialog.removeAttribute('open');\n }\n }, [open]);\n\n useSwipeToClose(dialogRef, { enabled: open && swipeToClose, scrollRef: bodyRef, onClose });\n\n return (\n <dialog\n ref={dialogRef}\n // Not yet in React's types; React passes it through as an attribute.\n {...{ closedby: 'any' }}\n tabIndex={-1}\n aria-labelledby={titleId}\n // Esc or light dismiss closed it; when `open` is already false the page closed it.\n onClose={() => {\n if (open) onClose();\n }}\n // Without `closedby`: close only when both the press and the release are outside the\n // box, so a text selection dragged onto the backdrop does not dismiss.\n onPointerDown={(e) => {\n pressedOutside.current = needsLightDismissFallback() && isOutside(e);\n }}\n onPointerUp={(e) => {\n if (pressedOutside.current && isOutside(e)) onClose();\n pressedOutside.current = false;\n }}\n className={cx('glass-dialog', className)}\n >\n {swipeToClose && <div className=\"glass-dialog-grabber\" aria-hidden=\"true\" />}\n <header className=\"glass-dialog-header\">\n <div className=\"glass-dialog-heading\">\n {eyebrow && <p className=\"glass-dialog-eyebrow\">{eyebrow}</p>}\n <h2 id={titleId} className=\"glass-dialog-title\">\n {title}\n </h2>\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={closeLabel}\n className=\"glass-dialog-close\"\n >\n <CloseIcon />\n </button>\n </header>\n <div ref={bodyRef} className={cx('glass-dialog-body', bodyClassName)}>\n {children}\n </div>\n {footer && <div className=\"glass-dialog-footer\">{footer}</div>}\n </dialog>\n );\n}\n","import { useEffect, useRef, type RefObject } from 'react';\n\n/** Movement (px) before a press counts as a drag, so taps and small jitters stay taps. */\nexport const DRAG_SLOP_PX = 8;\n/** Pull further than this share of the sheet's height and it closes on release. */\nexport const CLOSE_DISTANCE_RATIO = 0.25;\n/** Or flick downward at least this fast (px per ms), however short the pull. */\nexport const CLOSE_VELOCITY = 0.5;\n/** A flick only counts once the sheet has moved this far, so a twitch doesn't close it. */\nexport const MIN_FLICK_PX = 24;\n/** How long the sheet takes to slide away or settle back (ms). */\nexport const SETTLE_MS = 220;\n/**\n * How long after release the owner is asked to close (ms): the slide-away plus a margin, so\n * the transition has really finished. Closing a dialog while its transform is still moving\n * is one more thing iOS Safari may get wrong.\n */\nexport const SLIDE_AWAY_MS = SETTLE_MS + 60;\n/**\n * After `onClose`, how long the sheet waits off-screen for its owner to close it (ms). If it\n * is still open by then (the owner kept it, e.g. to ask \"discard changes?\"), it comes back.\n */\nexport const REOPEN_AFTER_MS = 250;\n\nconst SETTLE_EASE = 'cubic-bezier(0.22, 1, 0.36, 1)';\n\nexport interface ReleaseState {\n /** How far the sheet is pulled down (px). */\n offset: number;\n /** The sheet's height (px). */\n height: number;\n /** Downward speed at release (px per ms; negative means moving up). */\n velocity: number;\n}\n\n/** Whether a released drag should close the sheet or let it settle back. */\nexport function shouldClose({ offset, height, velocity }: ReleaseState): boolean {\n if (offset <= 0) return false;\n if (height > 0 && offset >= height * CLOSE_DISTANCE_RATIO) return true;\n return velocity >= CLOSE_VELOCITY && offset >= MIN_FLICK_PX;\n}\n\n/** Controls a press should leave alone: a drag starting on one would steal its tap. */\nconst INTERACTIVE =\n 'button, a[href], input, select, textarea, label, summary, [contenteditable=\"\"], [contenteditable=\"true\"], [role=\"button\"], [role=\"slider\"], [data-glass-no-drag]';\n\n/** Counts the hook runs per sheet, so a late tidy-up never touches a sheet that is in use again. */\nconst runs = new WeakMap<HTMLElement, number>();\n\nconst prefersReducedMotion = () =>\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\nexport interface SwipeToCloseOptions {\n /** Turn the gesture on or off (e.g. only while open, only in the bottom-sheet layout). */\n enabled: boolean;\n /** The scrolling part of the sheet. A press there drags only while it is scrolled to the top. */\n scrollRef?: RefObject<HTMLElement | null>;\n /**\n * Called once the sheet has slid away. The sheet stays off-screen until `enabled` turns\n * false; if that has not happened `REOPEN_AFTER_MS` later, it slides back.\n *\n * From release until the sheet is closed and tidied up (or comes back) it carries\n * `data-closing`. Style the backdrop with it, so the dim is gone before the close.\n */\n onClose: () => void;\n /** Media query for when the gesture applies. Default: the phone bottom-sheet layout. */\n media?: string;\n}\n\ninterface Drag {\n pointerId: number | 'touch';\n startX: number;\n startY: number;\n lastY: number;\n lastT: number;\n velocity: number;\n /** Null until the press has moved past the slop and we know whether it is our drag. */\n active: boolean | null;\n}\n\n/**\n * Pull-down-to-close for a sheet. Touch uses touch events, because a pointer-events drag\n * over scrollable content is cancelled by the browser as soon as it starts to pan; with\n * a non-passive touchmove we can stop that pan. Mouse and pen use pointer events. The sheet\n * follows the finger via an inline transform and either slides away (then `onClose`) or\n * settles back.\n *\n * iOS Safari decides at the first touchmove of a gesture whether the page pans, and later\n * moves can no longer stop it. So wherever nothing in the sheet would scroll for that touch\n * (the header, grabber and backdrop, a downward pull at the top of the body, a body with\n * nothing to scroll), touchmoves are cancelled from the first one; taps still click.\n *\n * After a slide-away the inline transform is kept until the effect is torn down (the owner\n * closed the sheet and `enabled` turned false). Clearing it earlier would show the sheet at\n * rest for a frame before the close is committed.\n *\n * From release until the sheet is closed and tidied up, or comes back, the sheet has the\n * attribute `data-closing`. Fade the backdrop out with it (`[data-closing]::backdrop`): iOS\n * Safari can leave a dialog's backdrop painted after it closes, so it must be clear by then.\n */\nexport function useSwipeToClose(\n sheetRef: RefObject<HTMLElement | null>,\n { enabled, scrollRef, onClose, media = '(max-width: 639.98px)' }: SwipeToCloseOptions,\n): void {\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n\n useEffect(() => {\n const sheet = sheetRef.current;\n if (!enabled || !sheet) return;\n\n let drag: Drag | null = null;\n // Cancel every touchmove until this touch ends: nothing under it scrolls, so a pan would\n // move the page behind the dialog. Cleared on touchstart, touchend and touchcancel.\n let holdPage = false;\n let suppressClick = false;\n // False once the effect is torn down, so nothing is scheduled on a sheet we let go of.\n let alive = true;\n // True from release until the owner closes the sheet or it comes back.\n let closing = false;\n // The release phases (slide away, wait for the owner, settle back) run one after\n // another, so a single timer handle covers them.\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const clearTimer = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n\n const applies = () =>\n typeof window.matchMedia !== 'function' || window.matchMedia(media).matches;\n\n const resetStyles = () => {\n sheet.style.transform = '';\n sheet.style.transition = '';\n sheet.removeAttribute('data-dragging');\n sheet.removeAttribute('data-closing');\n };\n\n // Start clean: an earlier run may have left its inline styles (see the cleanup).\n runs.set(sheet, (runs.get(sheet) ?? 0) + 1);\n resetStyles();\n sheet.style.animation = '';\n\n /** Animate back to rest, then drop the inline styles. */\n const settleBack = () => {\n // Now, not once it has settled: the backdrop fades back in while the sheet slides up.\n sheet.removeAttribute('data-closing');\n sheet.style.transition = `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;\n sheet.style.transform = '';\n // A timer, not transitionend: that event never fires if nothing moved or the tab hid.\n timer = setTimeout(resetStyles, SETTLE_MS);\n };\n\n /**\n * Ask the owner to close, leaving the sheet where it is. The effect cleanup clears the\n * styles once the sheet really closes; if it is still open after REOPEN_AFTER_MS,\n * `comeBack` runs.\n */\n const requestClose = (comeBack: () => void) => {\n try {\n onCloseRef.current();\n } finally {\n // The owner may have closed the sheet synchronously, tearing this effect down.\n if (alive) {\n timer = setTimeout(() => {\n closing = false;\n comeBack();\n }, REOPEN_AFTER_MS);\n }\n }\n };\n\n const begin = (id: Drag['pointerId'], x: number, y: number, target: EventTarget | null) => {\n // While closing, the sheet is sliding away or waiting for its owner: leave it be.\n if (drag || closing || !applies()) return;\n const el = target instanceof Element ? target : null;\n if (!el || !sheet.contains(el) || el.closest(INTERACTIVE)) return;\n const scroller = scrollRef?.current;\n if (scroller && scroller.contains(el) && scroller.scrollTop > 0) return;\n // Text selected inside the body: the press is probably adjusting it.\n if (scroller?.contains(el) && window.getSelection()?.isCollapsed === false) return;\n clearTimer();\n drag = {\n pointerId: id,\n startX: x,\n startY: y,\n lastY: y,\n lastT: performance.now(),\n velocity: 0,\n active: null,\n };\n };\n\n /** Returns true while the move belongs to the drag (so the caller can stop scrolling). */\n const move = (x: number, y: number): boolean => {\n if (!drag) return false;\n const dy = y - drag.startY;\n const dx = x - drag.startX;\n if (drag.active === null) {\n if (Math.abs(dy) < DRAG_SLOP_PX && Math.abs(dx) < DRAG_SLOP_PX) return false;\n // Upward or sideways: a scroll or a swipe for something else. Let it go.\n if (dy <= 0 || Math.abs(dx) > Math.abs(dy)) {\n drag = null;\n return false;\n }\n drag.active = true;\n sheet.setAttribute('data-dragging', '');\n sheet.style.transition = 'none';\n // Off until the sheet closes (see cleanup). An open animation with a fill mode would\n // override the inline transform, and switching it off only for the drag would replay\n // it on release.\n sheet.style.animation = 'none';\n }\n const now = performance.now();\n const dt = now - drag.lastT;\n if (dt > 0) drag.velocity = (y - drag.lastY) / dt;\n drag.lastY = y;\n drag.lastT = now;\n sheet.style.transform = `translate3d(0, ${Math.max(0, dy - DRAG_SLOP_PX)}px, 0)`;\n return true;\n };\n\n const end = () => {\n if (!drag) return;\n const wasActive = drag.active === true;\n const wasTouch = drag.pointerId === 'touch';\n const offset = Math.max(0, drag.lastY - drag.startY - DRAG_SLOP_PX);\n // A long pause before letting go means the flick is over.\n const velocity = performance.now() - drag.lastT > 100 ? 0 : drag.velocity;\n drag = null;\n if (!wasActive) return;\n // Only a mouse or pen drag ends in a click to swallow. A touch drag does not, and the\n // flag would then eat the next real activation (e.g. from a screen reader).\n suppressClick = !wasTouch;\n sheet.removeAttribute('data-dragging');\n\n const close = shouldClose({ offset, height: sheet.getBoundingClientRect().height, velocity });\n const reduceMotion = prefersReducedMotion();\n if (!close) {\n if (reduceMotion) resetStyles();\n else settleBack();\n return;\n }\n closing = true;\n // The backdrop fades out from now, so nothing dark is left to repaint at the close.\n sheet.setAttribute('data-closing', '');\n // Reduced motion: no slide, the sheet goes at once. The close still waits, so it never\n // lands in the frame the backdrop changes.\n sheet.style.transition = reduceMotion ? 'none' : `transform ${SETTLE_MS}ms ${SETTLE_EASE}`;\n sheet.style.transform = 'translate3d(0, 100%, 0)';\n // A timer, not transitionend: that event never fires if nothing moved or the tab hid.\n const comeBack = reduceMotion ? resetStyles : settleBack;\n timer = setTimeout(() => requestClose(comeBack), SLIDE_AWAY_MS);\n };\n\n const cancel = () => {\n const wasActive = drag?.active === true;\n drag = null;\n if (wasActive) resetStyles();\n };\n\n /** Whether the body has nothing to scroll, so a pan in it would chain to the page. */\n const bodyCannotScroll = () => {\n const scroller = scrollRef?.current;\n return !scroller || scroller.scrollHeight <= scroller.clientHeight;\n };\n\n // Touch\n const onTouchStart = (e: TouchEvent) => {\n holdPage = false;\n const t = e.touches[0];\n if (e.touches.length !== 1 || !t) return cancel();\n begin('touch', t.clientX, t.clientY, e.target);\n // Outside the body (header, grabber, footer, the backdrop) nothing scrolls natively;\n // nor does a body whose content fits. Hold from the start: the first move decides.\n const scroller = scrollRef?.current;\n const inBody = !!scroller && e.target instanceof Node && scroller.contains(e.target);\n holdPage = drag?.pointerId === 'touch' && (!inBody || bodyCannotScroll());\n };\n const onTouchMove = (e: TouchEvent) => {\n const t = e.touches[0];\n let stopPan = holdPage;\n if (t && drag?.pointerId === 'touch') {\n const pulledDown = t.clientY > drag.startY;\n if (move(t.clientX, t.clientY)) {\n stopPan = true; // our drag\n } else if (drag) {\n // Within the slop. At the top of the body a pull down has nothing to scroll.\n stopPan ||= pulledDown;\n } else if (bodyCannotScroll()) {\n // Dropped as not ours, and the body has nothing to scroll: keep the page still.\n holdPage = true;\n stopPan = true;\n }\n }\n if (stopPan && e.cancelable) e.preventDefault();\n };\n const onTouchEnd = () => {\n holdPage = false;\n if (drag?.pointerId === 'touch') end();\n };\n const onTouchCancel = () => {\n holdPage = false;\n cancel();\n };\n\n // Mouse and pen (touch is handled above)\n const onPointerDown = (e: PointerEvent) => {\n if (e.pointerType === 'touch' || e.button !== 0) return;\n begin(e.pointerId, e.clientX, e.clientY, e.target);\n };\n const onPointerMove = (e: PointerEvent) => {\n if (drag?.pointerId !== e.pointerId) return;\n if (move(e.clientX, e.clientY)) e.preventDefault();\n };\n const onPointerUp = (e: PointerEvent) => {\n if (drag?.pointerId === e.pointerId) end();\n };\n const onPointerCancel = (e: PointerEvent) => {\n if (drag?.pointerId === e.pointerId) cancel();\n };\n\n // A mouse drag ends with a click on whatever is under it; that click must not count.\n const onClickCapture = (e: MouseEvent) => {\n if (!suppressClick) return;\n suppressClick = false;\n e.preventDefault();\n e.stopPropagation();\n };\n const clearSuppress = () => {\n suppressClick = false;\n };\n\n sheet.addEventListener('touchstart', onTouchStart, { passive: true });\n sheet.addEventListener('touchmove', onTouchMove, { passive: false });\n sheet.addEventListener('touchend', onTouchEnd);\n sheet.addEventListener('touchcancel', onTouchCancel);\n sheet.addEventListener('pointerdown', onPointerDown);\n sheet.addEventListener('click', onClickCapture, true);\n window.addEventListener('pointermove', onPointerMove);\n window.addEventListener('pointerup', onPointerUp);\n window.addEventListener('pointercancel', onPointerCancel);\n window.addEventListener('pointerdown', clearSuppress, true);\n\n return () => {\n alive = false;\n clearTimer();\n // Never change the sheet in the frame it closes: moving it or restarting its open\n // animation together with dialog.close() is the suspected cause of the backdrop staying\n // painted on iOS Safari. Tidy up a moment later (styles and `data-closing`), unless the\n // sheet is in use again.\n const mine = runs.get(sheet);\n setTimeout(() => {\n if (runs.get(sheet) !== mine) return;\n resetStyles();\n sheet.style.animation = '';\n }, SLIDE_AWAY_MS);\n sheet.removeEventListener('touchstart', onTouchStart);\n sheet.removeEventListener('touchmove', onTouchMove);\n sheet.removeEventListener('touchend', onTouchEnd);\n sheet.removeEventListener('touchcancel', onTouchCancel);\n sheet.removeEventListener('pointerdown', onPointerDown);\n sheet.removeEventListener('click', onClickCapture, true);\n window.removeEventListener('pointermove', onPointerMove);\n window.removeEventListener('pointerup', onPointerUp);\n window.removeEventListener('pointercancel', onPointerCancel);\n window.removeEventListener('pointerdown', clearSuppress, true);\n };\n }, [enabled, media, scrollRef, sheetRef]);\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAOK;;;ACPA,SAAS,MAAM,OAAyD;AAC7E,SAAO,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG;AACvC;;;AD0FI;AA9EJ,IAAM,aAAoD;AAAA,EACxD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,oBAAoB;AAAA,EACpB,QAAQ;AACV;AAEA,IAAM,kBAA8D;AAAA,EAClE,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AACT;AAEA,IAAM,cAAsD;AAAA,EAC1D,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AACR;AAeO,SAAS,aAAa;AAAA,EAC3B,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,OAAO;AAAA,EACP,UAAU;AACZ,IAAkB,CAAC,GAAW;AAC5B,SAAO;AAAA,IACL;AAAA,IACA,WAAW,IAAI;AAAA,IACf,gBAAgB,SAAS;AAAA,IACz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AAI,WAAU,uBAAuB,kBAAO;AAAA;AAAA;AAAA,EAC1D;AAEJ;","names":["forwardRef","jsx","forwardRef","GlassButton","jsx","useEffect","useRef","useEffect","jsx","jsxs","useRef","useEffect"]}
|
package/package.json
CHANGED