@avenue-ticketing/ui 0.11.0 → 0.12.0-beta.2
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 +47 -0
- package/dist/badge-types-B67wcd4m.d.ts +22 -0
- package/dist/react/app-store-buttons-outline.d.ts +17 -0
- package/dist/react/app-store-buttons-outline.js +582 -0
- package/dist/react/app-store-buttons-outline.js.map +1 -0
- package/dist/react/app-store-buttons.d.ts +20 -0
- package/dist/react/app-store-buttons.js +817 -0
- package/dist/react/app-store-buttons.js.map +1 -0
- package/dist/react/avatar-label-group.d.ts +14 -0
- package/dist/react/avatar-label-group.js +183 -0
- package/dist/react/avatar-label-group.js.map +1 -0
- package/dist/react/avatar-profile-photo.d.ts +9 -0
- package/dist/react/avatar-profile-photo.js +202 -0
- package/dist/react/avatar-profile-photo.js.map +1 -0
- package/dist/react/avatar.d.ts +66 -40
- package/dist/react/avatar.js +159 -149
- package/dist/react/avatar.js.map +1 -1
- package/dist/react/badge-groups.d.ts +25 -0
- package/dist/react/badge-groups.js +162 -0
- package/dist/react/badge-groups.js.map +1 -0
- package/dist/react/badge.d.ts +123 -59
- package/dist/react/badge.js +314 -86
- package/dist/react/badge.js.map +1 -1
- package/dist/react/button-group.d.ts +43 -0
- package/dist/react/button-group.js +108 -0
- package/dist/react/button-group.js.map +1 -0
- package/dist/react/button-utility.d.ts +47 -0
- package/dist/react/button-utility.js +158 -0
- package/dist/react/button-utility.js.map +1 -0
- package/dist/react/button.d.ts +112 -37
- package/dist/react/button.js +270 -55
- package/dist/react/button.js.map +1 -1
- package/dist/react/checkbox.d.ts +25 -8
- package/dist/react/checkbox.js +115 -110
- package/dist/react/checkbox.js.map +1 -1
- package/dist/react/close-button.d.ts +25 -0
- package/dist/react/close-button.js +54 -0
- package/dist/react/close-button.js.map +1 -0
- package/dist/react/combobox.d.ts +18 -0
- package/dist/react/combobox.js +574 -0
- package/dist/react/combobox.js.map +1 -0
- package/dist/react/dialog.d.ts +15 -15
- package/dist/react/dialog.js +43 -108
- package/dist/react/dialog.js.map +1 -1
- package/dist/react/dropdown-account-breadcrumb.d.ts +5 -0
- package/dist/react/dropdown-account-breadcrumb.js +481 -0
- package/dist/react/dropdown-account-breadcrumb.js.map +1 -0
- package/dist/react/dropdown-account-button.d.ts +5 -0
- package/dist/react/dropdown-account-button.js +938 -0
- package/dist/react/dropdown-account-button.js.map +1 -0
- package/dist/react/dropdown-account-card-md.d.ts +5 -0
- package/dist/react/dropdown-account-card-md.js +714 -0
- package/dist/react/dropdown-account-card-md.js.map +1 -0
- package/dist/react/dropdown-account-card-sm.d.ts +5 -0
- package/dist/react/dropdown-account-card-sm.js +692 -0
- package/dist/react/dropdown-account-card-sm.js.map +1 -0
- package/dist/react/dropdown-account-card-xs.d.ts +5 -0
- package/dist/react/dropdown-account-card-xs.js +672 -0
- package/dist/react/dropdown-account-card-xs.js.map +1 -0
- package/dist/react/dropdown-avatar.d.ts +5 -0
- package/dist/react/dropdown-avatar.js +955 -0
- package/dist/react/dropdown-avatar.js.map +1 -0
- package/dist/react/dropdown-button-advanced.d.ts +5 -0
- package/dist/react/dropdown-button-advanced.js +964 -0
- package/dist/react/dropdown-button-advanced.js.map +1 -0
- package/dist/react/dropdown-button-link.d.ts +5 -0
- package/dist/react/dropdown-button-link.js +666 -0
- package/dist/react/dropdown-button-link.js.map +1 -0
- package/dist/react/dropdown-button-simple.d.ts +5 -0
- package/dist/react/dropdown-button-simple.js +919 -0
- package/dist/react/dropdown-button-simple.js.map +1 -0
- package/dist/react/dropdown-icon-advanced.d.ts +5 -0
- package/dist/react/dropdown-icon-advanced.js +708 -0
- package/dist/react/dropdown-icon-advanced.js.map +1 -0
- package/dist/react/dropdown-icon-simple.d.ts +5 -0
- package/dist/react/dropdown-icon-simple.js +670 -0
- package/dist/react/dropdown-icon-simple.js.map +1 -0
- package/dist/react/dropdown-integration.d.ts +5 -0
- package/dist/react/dropdown-integration.js +1490 -0
- package/dist/react/dropdown-integration.js.map +1 -0
- package/dist/react/dropdown-search-advanced.d.ts +5 -0
- package/dist/react/dropdown-search-advanced.js +1163 -0
- package/dist/react/dropdown-search-advanced.js.map +1 -0
- package/dist/react/dropdown-search-simple.d.ts +5 -0
- package/dist/react/dropdown-search-simple.js +1125 -0
- package/dist/react/dropdown-search-simple.js.map +1 -0
- package/dist/react/dropdown.d.ts +35 -133
- package/dist/react/dropdown.js +536 -1318
- package/dist/react/dropdown.js.map +1 -1
- package/dist/react/file-upload-trigger.d.ts +34 -0
- package/dist/react/file-upload-trigger.js +39 -0
- package/dist/react/file-upload-trigger.js.map +1 -0
- package/dist/react/form.d.ts +10 -0
- package/dist/react/form.js +11 -0
- package/dist/react/form.js.map +1 -0
- package/dist/react/hint-text.d.ts +17 -0
- package/dist/react/hint-text.js +36 -0
- package/dist/react/hint-text.js.map +1 -0
- package/dist/react/hook-form.d.ts +35 -0
- package/dist/react/hook-form.js +50 -0
- package/dist/react/hook-form.js.map +1 -0
- package/dist/react/input-date.d.ts +43 -0
- package/dist/react/input-date.js +306 -0
- package/dist/react/input-date.js.map +1 -0
- package/dist/react/input-file.d.ts +45 -0
- package/dist/react/input-file.js +748 -0
- package/dist/react/input-file.js.map +1 -0
- package/dist/react/input-group.d.ts +37 -0
- package/dist/react/input-group.js +251 -0
- package/dist/react/input-group.js.map +1 -0
- package/dist/react/input-number.d.ts +32 -0
- package/dist/react/input-number.js +553 -0
- package/dist/react/input-number.js.map +1 -0
- package/dist/react/input-payment.d.ts +16 -0
- package/dist/react/input-payment.js +593 -0
- package/dist/react/input-payment.js.map +1 -0
- package/dist/react/input-tags-outer.d.ts +53 -0
- package/dist/react/input-tags-outer.js +607 -0
- package/dist/react/input-tags-outer.js.map +1 -0
- package/dist/react/input-tags.d.ts +53 -0
- package/dist/react/input-tags.js +565 -0
- package/dist/react/input-tags.js.map +1 -0
- package/dist/react/input.d.ts +71 -22
- package/dist/react/input.js +332 -45
- package/dist/react/input.js.map +1 -1
- package/dist/react/label.d.ts +18 -0
- package/dist/react/label.js +112 -0
- package/dist/react/label.js.map +1 -0
- package/dist/react/multi-select.d.ts +90 -0
- package/dist/react/multi-select.js +1237 -0
- package/dist/react/multi-select.js.map +1 -0
- package/dist/react/pin-input.d.ts +59 -0
- package/dist/react/pin-input.js +229 -0
- package/dist/react/pin-input.js.map +1 -0
- package/dist/react/popover.d.ts +14 -71
- package/dist/react/popover.js +171 -540
- package/dist/react/popover.js.map +1 -1
- package/dist/react/progress-circle.d.ts +9 -0
- package/dist/react/progress-circle.js +36 -0
- package/dist/react/progress-circle.js.map +1 -0
- package/dist/react/progress-circles.d.ts +14 -0
- package/dist/react/progress-circles.js +160 -0
- package/dist/react/progress-circles.js.map +1 -0
- package/dist/react/progress-indicators.d.ts +52 -0
- package/dist/react/progress-indicators.js +78 -0
- package/dist/react/progress-indicators.js.map +1 -0
- package/dist/react/radio-buttons.d.ts +35 -0
- package/dist/react/radio-buttons.js +117 -0
- package/dist/react/radio-buttons.js.map +1 -0
- package/dist/react/scroll-header.d.ts +6 -0
- package/dist/react/scroll-header.js +42 -61
- package/dist/react/scroll-header.js.map +1 -1
- package/dist/react/scroll-wheel.d.ts +4 -5
- package/dist/react/scroll-wheel.js +19 -15
- package/dist/react/scroll-wheel.js.map +1 -1
- package/dist/react/select-item.d.ts +14 -0
- package/dist/react/select-item.js +340 -0
- package/dist/react/select-item.js.map +1 -0
- package/dist/react/select-native.d.ts +17 -0
- package/dist/react/select-native.js +203 -0
- package/dist/react/select-native.js.map +1 -0
- package/dist/react/select.d.ts +19 -61
- package/dist/react/select.js +866 -908
- package/dist/react/select.js.map +1 -1
- package/dist/react/sheet.d.ts +19 -19
- package/dist/react/sheet.js +97 -219
- package/dist/react/sheet.js.map +1 -1
- package/dist/react/slider.d.ts +15 -0
- package/dist/react/slider.js +66 -0
- package/dist/react/slider.js.map +1 -0
- package/dist/react/social-button.d.ts +55 -0
- package/dist/react/social-button.js +263 -0
- package/dist/react/social-button.js.map +1 -0
- package/dist/react/social-logos.d.ts +20 -0
- package/dist/react/social-logos.js +131 -0
- package/dist/react/social-logos.js.map +1 -0
- package/dist/react/switch.d.ts +21 -36
- package/dist/react/switch.js +121 -109
- package/dist/react/switch.js.map +1 -1
- package/dist/react/tag-select.d.ts +47 -0
- package/dist/react/tag-select.js +1252 -0
- package/dist/react/tag-select.js.map +1 -0
- package/dist/react/tags.d.ts +30 -0
- package/dist/react/tags.js +228 -0
- package/dist/react/tags.js.map +1 -0
- package/dist/react/textarea.d.ts +40 -4
- package/dist/react/textarea.js +193 -27
- package/dist/react/textarea.js.map +1 -1
- package/dist/react/tooltip.d.ts +30 -43
- package/dist/react/tooltip.js +65 -521
- package/dist/react/tooltip.js.map +1 -1
- package/dist/select-mobile-sheet-CB2ptDTJ.d.ts +12 -0
- package/dist/select-shared-oJEeJxeB.d.ts +68 -0
- package/package.json +28 -21
- package/source.css +2 -13
- package/theme.css +883 -79
- package/dist/react/calendar.d.ts +0 -13
- package/dist/react/calendar.js +0 -4639
- package/dist/react/calendar.js.map +0 -1
- package/dist/react/card.d.ts +0 -11
- package/dist/react/card.js +0 -113
- package/dist/react/card.js.map +0 -1
- package/dist/react/datetime-picker.d.ts +0 -21
- package/dist/react/datetime-picker.js +0 -6142
- package/dist/react/datetime-picker.js.map +0 -1
- package/dist/react/pagination.d.ts +0 -28
- package/dist/react/pagination.js +0 -262
- package/dist/react/pagination.js.map +0 -1
- package/dist/react/table-pagination.d.ts +0 -15
- package/dist/react/table-pagination.js +0 -1247
- package/dist/react/table-pagination.js.map +0 -1
- package/dist/react/table-view/column-menu.d.ts +0 -15
- package/dist/react/table-view/column-menu.js +0 -1049
- package/dist/react/table-view/column-menu.js.map +0 -1
- package/dist/react/table-view/index.d.ts +0 -70
- package/dist/react/table-view/index.js +0 -2284
- package/dist/react/table-view/index.js.map +0 -1
- package/dist/react/table.d.ts +0 -86
- package/dist/react/table.js +0 -414
- package/dist/react/table.js.map +0 -1
- package/dist/react/tabs.d.ts +0 -34
- package/dist/react/tabs.js +0 -423
- package/dist/react/tabs.js.map +0 -1
- package/dist/react/time-picker.d.ts +0 -22
- package/dist/react/time-picker.js +0 -856
- package/dist/react/time-picker.js.map +0 -1
package/dist/react/sheet.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React, { useCallback, useState, useMemo, useEffect, useLayoutEffect } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { ArrowLeftIcon } from '@phosphor-icons/react/dist/csr/ArrowLeft';
|
|
4
|
+
import { XIcon } from '@phosphor-icons/react/dist/csr/X';
|
|
5
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
var twMerge = extendTailwindMerge({
|
|
9
|
+
extend: {
|
|
10
|
+
theme: {
|
|
11
|
+
text: ["display-xs", "display-sm", "display-md", "display-lg", "display-xl", "display-2xl"]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var cx = twMerge;
|
|
11
16
|
var CLOSE_THRESHOLD = 200;
|
|
12
17
|
var VELOCITY_THRESHOLD = 1;
|
|
13
18
|
var SHEET_MOBILE_MAX_WIDTH_PX = 1024;
|
|
@@ -32,10 +37,10 @@ var PANEL_OFF_Y = "100%";
|
|
|
32
37
|
var SHEET_Z_PANEL_CLOSE = 100;
|
|
33
38
|
var SHEET_Z_PORTAL_STEP = 10;
|
|
34
39
|
var SIDE_LAYOUT = {
|
|
35
|
-
top: "top-0 left-0 right-0 border-b border-
|
|
36
|
-
bottom: "bottom-0 left-0 right-0 border-t border-
|
|
37
|
-
left: "left-0 top-0 bottom-0 border-r border-
|
|
38
|
-
right: "right-0 top-0 bottom-0 md:border-l border-
|
|
40
|
+
top: "top-0 left-0 right-0 border-b border-secondary",
|
|
41
|
+
bottom: "bottom-0 left-0 right-0 border-t border-secondary",
|
|
42
|
+
left: "left-0 top-0 bottom-0 border-r border-secondary",
|
|
43
|
+
right: "right-0 top-0 bottom-0 md:border-l border-secondary"
|
|
39
44
|
};
|
|
40
45
|
function sizeClassFor(side, size) {
|
|
41
46
|
const horizontal = side === "left" || side === "right";
|
|
@@ -93,22 +98,9 @@ var SheetBoundary = ({ className, children, ...props }) => {
|
|
|
93
98
|
setHost(node);
|
|
94
99
|
}, []);
|
|
95
100
|
const boundaryValue = useMemo(() => ({ host, depth }), [host, depth]);
|
|
96
|
-
return /* @__PURE__ */ jsx(SheetBoundaryContext.Provider, { value: boundaryValue, children: /* @__PURE__ */ jsx(
|
|
97
|
-
"div",
|
|
98
|
-
{
|
|
99
|
-
ref: setRef,
|
|
100
|
-
className: cn("relative min-h-0 min-w-0", className),
|
|
101
|
-
...props,
|
|
102
|
-
children
|
|
103
|
-
}
|
|
104
|
-
) });
|
|
101
|
+
return /* @__PURE__ */ jsx(SheetBoundaryContext.Provider, { value: boundaryValue, children: /* @__PURE__ */ jsx("div", { ref: setRef, className: cx("relative min-h-0 min-w-0", className), ...props, children }) });
|
|
105
102
|
};
|
|
106
|
-
var Sheet = ({
|
|
107
|
-
children,
|
|
108
|
-
open: controlledOpen,
|
|
109
|
-
onOpenChange,
|
|
110
|
-
showBackdrop = false
|
|
111
|
-
}) => {
|
|
103
|
+
var Sheet = ({ children, open: controlledOpen, onOpenChange, showBackdrop = false }) => {
|
|
112
104
|
const [internalOpen, setInternalOpen] = useState(false);
|
|
113
105
|
const isControlled = controlledOpen !== void 0;
|
|
114
106
|
const open = isControlled ? controlledOpen : internalOpen;
|
|
@@ -154,14 +146,7 @@ var Sheet = ({
|
|
|
154
146
|
clearCloseHandoff,
|
|
155
147
|
handoffAfterCloseRef
|
|
156
148
|
}),
|
|
157
|
-
[
|
|
158
|
-
open,
|
|
159
|
-
setOpen,
|
|
160
|
-
nestDepth,
|
|
161
|
-
showBackdrop,
|
|
162
|
-
closeHandoffActive,
|
|
163
|
-
clearCloseHandoff
|
|
164
|
-
]
|
|
149
|
+
[open, setOpen, nestDepth, showBackdrop, closeHandoffActive, clearCloseHandoff]
|
|
165
150
|
);
|
|
166
151
|
return /* @__PURE__ */ jsx(SheetContext.Provider, { value: sheetContextValue, children });
|
|
167
152
|
};
|
|
@@ -184,18 +169,13 @@ var SheetTrigger = ({ children, asChild }) => {
|
|
|
184
169
|
};
|
|
185
170
|
var SheetClose = ({ children, asChild, afterClose }) => {
|
|
186
171
|
const { setOpen } = useSheetContext();
|
|
187
|
-
const closeSheet = useCallback(
|
|
188
|
-
() => setOpen(false, afterClose ? { afterClose } : void 0),
|
|
189
|
-
[setOpen, afterClose]
|
|
190
|
-
);
|
|
172
|
+
const closeSheet = useCallback(() => setOpen(false, afterClose ? { afterClose } : void 0), [setOpen, afterClose]);
|
|
191
173
|
return mergeChildClick(children, asChild, closeSheet);
|
|
192
174
|
};
|
|
193
175
|
function useSheetMobileViewport() {
|
|
194
176
|
const [isMobileViewport, setIsMobileViewport] = useState(false);
|
|
195
177
|
useEffect(() => {
|
|
196
|
-
const mqMobile = window.matchMedia(
|
|
197
|
-
`(max-width: ${SHEET_MOBILE_MAX_WIDTH_PX}px)`
|
|
198
|
-
);
|
|
178
|
+
const mqMobile = window.matchMedia(`(max-width: ${SHEET_MOBILE_MAX_WIDTH_PX}px)`);
|
|
199
179
|
const sync = () => setIsMobileViewport(mqMobile.matches);
|
|
200
180
|
sync();
|
|
201
181
|
mqMobile.addEventListener("change", sync);
|
|
@@ -212,10 +192,7 @@ function useSheetRenderLifecycle(open, panelCloseMs, showBackdrop) {
|
|
|
212
192
|
setShouldRender(true);
|
|
213
193
|
} else {
|
|
214
194
|
setIsAnimating(false);
|
|
215
|
-
const timer = setTimeout(
|
|
216
|
-
() => setShouldRender(false),
|
|
217
|
-
unmountAfterCloseMs
|
|
218
|
-
);
|
|
195
|
+
const timer = setTimeout(() => setShouldRender(false), unmountAfterCloseMs);
|
|
219
196
|
return () => clearTimeout(timer);
|
|
220
197
|
}
|
|
221
198
|
}, [open, unmountAfterCloseMs]);
|
|
@@ -275,14 +252,14 @@ var SheetCloseButton = React.forwardRef(
|
|
|
275
252
|
ref,
|
|
276
253
|
type,
|
|
277
254
|
style: { zIndex: SHEET_Z_PANEL_CLOSE, ...style },
|
|
278
|
-
className:
|
|
279
|
-
"flex size-12 cursor-pointer items-center justify-center rounded-full
|
|
255
|
+
className: cx(
|
|
256
|
+
"flex size-12 cursor-pointer items-center justify-center rounded-full text-fg-primary transition duration-100 ease-linear hover:bg-primary_hover active:scale-[0.96] md:border md:border-secondary md:bg-primary md:shadow-xl md:hover:bg-primary_hover focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]",
|
|
280
257
|
className
|
|
281
258
|
),
|
|
282
259
|
onClick: handleClick,
|
|
283
260
|
...props,
|
|
284
261
|
children: [
|
|
285
|
-
/* @__PURE__ */ jsx(
|
|
262
|
+
/* @__PURE__ */ jsx(XIcon, { className: "size-5.5", "aria-hidden": "true" }),
|
|
286
263
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
287
264
|
]
|
|
288
265
|
}
|
|
@@ -303,38 +280,19 @@ var SheetContent = ({
|
|
|
303
280
|
role,
|
|
304
281
|
...props
|
|
305
282
|
}) => {
|
|
306
|
-
const {
|
|
307
|
-
open,
|
|
308
|
-
setOpen,
|
|
309
|
-
nestDepth,
|
|
310
|
-
showBackdrop,
|
|
311
|
-
closeHandoffActive,
|
|
312
|
-
clearCloseHandoff,
|
|
313
|
-
handoffAfterCloseRef
|
|
314
|
-
} = useSheetContext();
|
|
283
|
+
const { open, setOpen, nestDepth, showBackdrop, closeHandoffActive, clearCloseHandoff, handoffAfterCloseRef } = useSheetContext();
|
|
315
284
|
const boundaryCtx = React.useContext(SheetBoundaryContext);
|
|
316
285
|
const inBoundaryTree = useMemo(() => boundaryCtx != null, [boundaryCtx]);
|
|
317
286
|
const boundaryHost = useMemo(() => boundaryCtx?.host ?? null, [boundaryCtx]);
|
|
318
|
-
const bounded = useMemo(
|
|
319
|
-
() => inBoundaryTree && boundaryHost != null,
|
|
320
|
-
[inBoundaryTree, boundaryHost]
|
|
321
|
-
);
|
|
287
|
+
const bounded = useMemo(() => inBoundaryTree && boundaryHost != null, [inBoundaryTree, boundaryHost]);
|
|
322
288
|
const isMobileViewport = useSheetMobileViewport();
|
|
323
|
-
const dialogMotion = useMemo(
|
|
324
|
-
|
|
325
|
-
[bounded, role, isMobileViewport]
|
|
326
|
-
);
|
|
327
|
-
const swipeActive = useMemo(
|
|
328
|
-
() => swipeEnabled && !dialogMotion,
|
|
329
|
-
[swipeEnabled, dialogMotion]
|
|
330
|
-
);
|
|
289
|
+
const dialogMotion = useMemo(() => bounded && role === "dialog" && isMobileViewport, [bounded, role, isMobileViewport]);
|
|
290
|
+
const swipeActive = useMemo(() => swipeEnabled && !dialogMotion, [swipeEnabled, dialogMotion]);
|
|
331
291
|
const basePanelCloseMs = useMemo(
|
|
332
292
|
() => dialogMotion ? DIALOG_MOTION_MS : isMobileViewport ? PANEL_CLOSE_MS_MOBILE : PANEL_CLOSE_MS_DESKTOP,
|
|
333
293
|
[dialogMotion, isMobileViewport]
|
|
334
294
|
);
|
|
335
|
-
const [handoffExitMsLatch, setHandoffExitMsLatch] = useState(
|
|
336
|
-
null
|
|
337
|
-
);
|
|
295
|
+
const [handoffExitMsLatch, setHandoffExitMsLatch] = useState(null);
|
|
338
296
|
useLayoutEffect(() => {
|
|
339
297
|
if (open) {
|
|
340
298
|
setHandoffExitMsLatch(null);
|
|
@@ -347,11 +305,7 @@ var SheetContent = ({
|
|
|
347
305
|
const panelCloseMs = useMemo(() => {
|
|
348
306
|
return !open && closeHandoffActive ? PANEL_CLOSE_MS_HANDOFF : !open && handoffExitMsLatch != null ? handoffExitMsLatch : basePanelCloseMs;
|
|
349
307
|
}, [open, closeHandoffActive, handoffExitMsLatch, basePanelCloseMs]);
|
|
350
|
-
const { shouldRender, isAnimating } = useSheetRenderLifecycle(
|
|
351
|
-
open,
|
|
352
|
-
panelCloseMs,
|
|
353
|
-
showBackdrop
|
|
354
|
-
);
|
|
308
|
+
const { shouldRender, isAnimating } = useSheetRenderLifecycle(open, panelCloseMs, showBackdrop);
|
|
355
309
|
useEffect(() => {
|
|
356
310
|
if (open || !closeHandoffActive) return;
|
|
357
311
|
const cb = handoffAfterCloseRef.current;
|
|
@@ -388,20 +342,15 @@ var SheetContent = ({
|
|
|
388
342
|
swipeReboundCleanupRef.current = null;
|
|
389
343
|
}, []);
|
|
390
344
|
const updateTransform = useCallback(() => {
|
|
391
|
-
if (!panelRef.current || !touchRef.current.isDragging || !swipeActive)
|
|
392
|
-
return;
|
|
345
|
+
if (!panelRef.current || !touchRef.current.isDragging || !swipeActive) return;
|
|
393
346
|
const { startX, startY, currentX, currentY, direction } = touchRef.current;
|
|
394
347
|
const deltaX = currentX - startX;
|
|
395
348
|
const deltaY = currentY - startY;
|
|
396
349
|
let transform = "";
|
|
397
|
-
if (side === "right" && direction === "x" && deltaX > 0)
|
|
398
|
-
|
|
399
|
-
else if (side === "
|
|
400
|
-
|
|
401
|
-
else if (side === "bottom" && direction === "y" && deltaY > 0)
|
|
402
|
-
transform = `translateY(${deltaY}px)`;
|
|
403
|
-
else if (side === "top" && direction === "y" && deltaY < 0)
|
|
404
|
-
transform = `translateY(${deltaY}px)`;
|
|
350
|
+
if (side === "right" && direction === "x" && deltaX > 0) transform = `translateX(${deltaX}px)`;
|
|
351
|
+
else if (side === "left" && direction === "x" && deltaX < 0) transform = `translateX(${deltaX}px)`;
|
|
352
|
+
else if (side === "bottom" && direction === "y" && deltaY > 0) transform = `translateY(${deltaY}px)`;
|
|
353
|
+
else if (side === "top" && direction === "y" && deltaY < 0) transform = `translateY(${deltaY}px)`;
|
|
405
354
|
if (transform) {
|
|
406
355
|
panelRef.current.style.transform = transform;
|
|
407
356
|
panelRef.current.style.transition = "none";
|
|
@@ -431,12 +380,8 @@ var SheetContent = ({
|
|
|
431
380
|
if (!touchRef.current.isDragging || !swipeActive || !e.touches[0]) return;
|
|
432
381
|
touchRef.current.currentX = e.touches[0].clientX;
|
|
433
382
|
touchRef.current.currentY = e.touches[0].clientY;
|
|
434
|
-
const deltaX = Math.abs(
|
|
435
|
-
|
|
436
|
-
);
|
|
437
|
-
const deltaY = Math.abs(
|
|
438
|
-
touchRef.current.currentY - touchRef.current.startY
|
|
439
|
-
);
|
|
383
|
+
const deltaX = Math.abs(touchRef.current.currentX - touchRef.current.startX);
|
|
384
|
+
const deltaY = Math.abs(touchRef.current.currentY - touchRef.current.startY);
|
|
440
385
|
if (!touchRef.current.direction && (deltaX > 5 || deltaY > 5)) {
|
|
441
386
|
touchRef.current.direction = deltaX > deltaY ? "x" : "y";
|
|
442
387
|
}
|
|
@@ -445,8 +390,7 @@ var SheetContent = ({
|
|
|
445
390
|
);
|
|
446
391
|
const handleTouchEnd = useCallback(
|
|
447
392
|
(e) => {
|
|
448
|
-
if (!touchRef.current.isDragging || !swipeActive || !e.changedTouches[0])
|
|
449
|
-
return;
|
|
393
|
+
if (!touchRef.current.isDragging || !swipeActive || !e.changedTouches[0]) return;
|
|
450
394
|
touchRef.current.isDragging = false;
|
|
451
395
|
if (rafId.current) cancelAnimationFrame(rafId.current);
|
|
452
396
|
const endX = e.changedTouches[0].clientX;
|
|
@@ -517,17 +461,7 @@ var SheetContent = ({
|
|
|
517
461
|
}
|
|
518
462
|
}
|
|
519
463
|
},
|
|
520
|
-
[
|
|
521
|
-
swipeActive,
|
|
522
|
-
closeThreshold,
|
|
523
|
-
velocityThreshold,
|
|
524
|
-
side,
|
|
525
|
-
isMobileViewport,
|
|
526
|
-
bounded,
|
|
527
|
-
setOpen,
|
|
528
|
-
cancelSwipeRebound,
|
|
529
|
-
panelOpenMs
|
|
530
|
-
]
|
|
464
|
+
[swipeActive, closeThreshold, velocityThreshold, side, isMobileViewport, bounded, setOpen, cancelSwipeRebound, panelOpenMs]
|
|
531
465
|
);
|
|
532
466
|
const panelTransform = useMemo(
|
|
533
467
|
() => dialogMotion ? isAnimating ? "translateY(0)" : `translateY(${DIALOG_MOTION_OFFSET_PX}px)` : panelSlideTransform(side, isAnimating, bounded),
|
|
@@ -573,136 +507,80 @@ var SheetContent = ({
|
|
|
573
507
|
transitionTimingFunction: open ? PANEL_OPEN_EASING : panelCloseEasingViaSwipeRef.current ? PANEL_SWIPE_CLOSE_EASING : PANEL_CLOSE_EASING,
|
|
574
508
|
touchAction
|
|
575
509
|
};
|
|
576
|
-
}, [
|
|
577
|
-
dialogMotion,
|
|
578
|
-
props.style,
|
|
579
|
-
panelTransform,
|
|
580
|
-
isAnimating,
|
|
581
|
-
open,
|
|
582
|
-
panelOpenMs,
|
|
583
|
-
panelCloseMs,
|
|
584
|
-
side,
|
|
585
|
-
swipeActive
|
|
586
|
-
]);
|
|
510
|
+
}, [dialogMotion, props.style, panelTransform, isAnimating, open, panelOpenMs, panelCloseMs, side, swipeActive]);
|
|
587
511
|
if (!shouldRender) return null;
|
|
588
512
|
if (inBoundaryTree && boundaryHost == null) {
|
|
589
513
|
return null;
|
|
590
514
|
}
|
|
591
|
-
const sheetTree = /* @__PURE__ */ jsxs(
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
515
|
+
const sheetTree = /* @__PURE__ */ jsxs("div", { className: cx(layerPosition, "inset-0", !bounded && "flex items-center justify-center", bounded && "pointer-events-none"), style: rootLayerStyle, children: [
|
|
516
|
+
/* @__PURE__ */ jsx(
|
|
517
|
+
"div",
|
|
518
|
+
{
|
|
519
|
+
className: cx(
|
|
520
|
+
layerPosition,
|
|
521
|
+
"inset-0",
|
|
522
|
+
showBackdrop && "bg-overlay/40 transition-opacity",
|
|
523
|
+
showBackdrop && (isAnimating ? "opacity-100" : "opacity-0"),
|
|
524
|
+
!showBackdrop && "bg-transparent",
|
|
525
|
+
bounded && "pointer-events-auto"
|
|
526
|
+
),
|
|
527
|
+
style: backdropStyle,
|
|
528
|
+
onClick: closeSheet
|
|
529
|
+
}
|
|
530
|
+
),
|
|
531
|
+
/* @__PURE__ */ jsxs(
|
|
532
|
+
"div",
|
|
533
|
+
{
|
|
534
|
+
...props,
|
|
535
|
+
ref: panelRef,
|
|
536
|
+
role,
|
|
537
|
+
className: cx(
|
|
538
|
+
"flex flex-col bg-primary p-6 shadow-xl",
|
|
539
|
+
layerPosition,
|
|
540
|
+
bounded ? cx("pointer-events-auto inset-0 z-10 h-full w-full max-w-none overflow-hidden") : cx("z-50", SIDE_LAYOUT[side], sizeClassFor(side, size)),
|
|
541
|
+
className
|
|
616
542
|
),
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
onTouchMove: swipeActive ? handleTouchMove : void 0,
|
|
634
|
-
onTouchEnd: swipeActive ? handleTouchEnd : void 0,
|
|
635
|
-
children: [
|
|
636
|
-
children,
|
|
637
|
-
showClose && /* @__PURE__ */ jsx(
|
|
638
|
-
SheetCloseButton,
|
|
639
|
-
{
|
|
640
|
-
side,
|
|
641
|
-
className: cn(
|
|
642
|
-
"absolute top-4 right-4",
|
|
643
|
-
side === "right" && "md:top-5 md:right-auto md:-left-16",
|
|
644
|
-
side === "left" && "md:top-5 md:-right-16 md:left-auto",
|
|
645
|
-
side === "top" && "md:top-auto md:right-auto md:-bottom-15 md:left-1/2 md:-translate-x-1/2",
|
|
646
|
-
side === "bottom" && "md:-top-15 md:right-auto md:bottom-auto md:left-1/2 md:-translate-x-1/2"
|
|
647
|
-
)
|
|
648
|
-
}
|
|
543
|
+
style: panelSurfaceStyle,
|
|
544
|
+
onTouchStart: swipeActive ? handleTouchStart : void 0,
|
|
545
|
+
onTouchMove: swipeActive ? handleTouchMove : void 0,
|
|
546
|
+
onTouchEnd: swipeActive ? handleTouchEnd : void 0,
|
|
547
|
+
children: [
|
|
548
|
+
children,
|
|
549
|
+
showClose && /* @__PURE__ */ jsx(
|
|
550
|
+
SheetCloseButton,
|
|
551
|
+
{
|
|
552
|
+
side,
|
|
553
|
+
className: cx(
|
|
554
|
+
"absolute top-4 right-4",
|
|
555
|
+
side === "right" && "md:top-5 md:right-auto md:-left-16",
|
|
556
|
+
side === "left" && "md:top-5 md:-right-16 md:left-auto",
|
|
557
|
+
side === "top" && "md:top-auto md:right-auto md:-bottom-15 md:left-1/2 md:-translate-x-1/2",
|
|
558
|
+
side === "bottom" && "md:-top-15 md:right-auto md:bottom-auto md:left-1/2 md:-translate-x-1/2"
|
|
649
559
|
)
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
);
|
|
656
|
-
return createPortal(
|
|
657
|
-
sheetTree,
|
|
658
|
-
bounded && boundaryHost ? boundaryHost : document.body
|
|
659
|
-
);
|
|
560
|
+
}
|
|
561
|
+
)
|
|
562
|
+
]
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
] });
|
|
566
|
+
return createPortal(sheetTree, bounded && boundaryHost ? boundaryHost : document.body);
|
|
660
567
|
};
|
|
661
|
-
var SheetHeader = ({ className, fixed, ...props }) => /* @__PURE__ */ jsx(
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
"flex flex-col text-left",
|
|
666
|
-
fixed && "bg-background border-primary/10 sticky top-0 z-10 border-b p-4",
|
|
667
|
-
className
|
|
668
|
-
),
|
|
669
|
-
...props
|
|
670
|
-
}
|
|
671
|
-
);
|
|
672
|
-
var SheetFooter = ({ className, fixed, ...props }) => /* @__PURE__ */ jsx(
|
|
673
|
-
"div",
|
|
674
|
-
{
|
|
675
|
-
className: cn(
|
|
676
|
-
"flex flex-row",
|
|
677
|
-
fixed && "bg-background border-primary/10 sticky bottom-0 z-10 border-t p-4",
|
|
678
|
-
className
|
|
679
|
-
),
|
|
680
|
-
...props
|
|
681
|
-
}
|
|
682
|
-
);
|
|
683
|
-
var SheetTitle = ({
|
|
684
|
-
className,
|
|
685
|
-
...props
|
|
686
|
-
}) => /* @__PURE__ */ jsx(
|
|
687
|
-
"h3",
|
|
688
|
-
{
|
|
689
|
-
className: cn("text-primary text-lg font-semibold", className),
|
|
690
|
-
...props
|
|
691
|
-
}
|
|
692
|
-
);
|
|
693
|
-
var SheetDescription = ({ className, ...props }) => /* @__PURE__ */ jsx("p", { className: cn("text-muted-foreground text-sm", className), ...props });
|
|
568
|
+
var SheetHeader = ({ className, fixed, ...props }) => /* @__PURE__ */ jsx("div", { className: cx("flex flex-col text-left", fixed && "sticky top-0 z-10 border-b border-secondary bg-primary p-4", className), ...props });
|
|
569
|
+
var SheetFooter = ({ className, fixed, ...props }) => /* @__PURE__ */ jsx("div", { className: cx("flex flex-row", fixed && "sticky bottom-0 z-10 border-t border-secondary bg-primary p-4", className), ...props });
|
|
570
|
+
var SheetTitle = ({ className, ...props }) => /* @__PURE__ */ jsx("h3", { className: cx("text-lg font-semibold text-primary", className), ...props });
|
|
571
|
+
var SheetDescription = ({ className, ...props }) => /* @__PURE__ */ jsx("p", { className: cx("text-sm text-tertiary", className), ...props });
|
|
694
572
|
var SheetNestedClose = ({ className, children, onClick, afterClose, ...props }) => /* @__PURE__ */ jsx(SheetClose, { asChild: true, afterClose, children: /* @__PURE__ */ jsx(
|
|
695
573
|
"button",
|
|
696
574
|
{
|
|
697
575
|
type: "button",
|
|
698
|
-
className:
|
|
699
|
-
"inline-flex size-12 shrink-0 cursor-pointer items-center justify-center rounded-full bg-
|
|
576
|
+
className: cx(
|
|
577
|
+
"inline-flex size-12 shrink-0 cursor-pointer items-center justify-center rounded-full bg-primary text-fg-primary transition duration-100 ease-linear hover:bg-primary_hover active:scale-[0.96]",
|
|
700
578
|
className
|
|
701
579
|
),
|
|
702
580
|
onClick,
|
|
703
581
|
...props,
|
|
704
582
|
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
705
|
-
/* @__PURE__ */ jsx(
|
|
583
|
+
/* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-5.5", "aria-hidden": true }),
|
|
706
584
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Back" })
|
|
707
585
|
] })
|
|
708
586
|
}
|