@stevederico/skateboard-ui 3.0.2 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.jsx +13 -13
- package/CHANGELOG.md +64 -0
- package/README.md +59 -65
- package/components/AuthOverlay.jsx +4 -4
- package/components/ProtectedRoute.jsx +1 -1
- package/components/ThemeToggle.jsx +1 -1
- package/components/UpgradeSheet.jsx +2 -2
- package/{core → components/core}/DynamicIcon.jsx +1 -1
- package/{layout → components/layout}/Header.jsx +4 -4
- package/{layout → components/layout}/Layout.jsx +1 -1
- package/{layout → components/layout}/Sidebar.jsx +2 -2
- package/{layout → components/layout}/TabBar.jsx +1 -1
- package/{views → components/views}/LandingView.jsx +5 -5
- package/{views → components/views}/NotFound.jsx +2 -2
- package/{views → components/views}/PaymentView.jsx +1 -1
- package/{views → components/views}/SettingsView.jsx +6 -6
- package/{views → components/views}/SignInView.jsx +6 -6
- package/{views → components/views}/SignOutView.jsx +1 -1
- package/{views → components/views}/SignUpView.jsx +6 -6
- package/{views → components/views}/TextView.jsx +3 -3
- package/hooks/useAuthGate.js +1 -1
- package/index.js +1 -1
- package/package.json +32 -50
- package/shadcn/lib/base-ui/LICENSE +21 -0
- package/shadcn/lib/base-ui/_chunk-01rqe37g.js +70 -0
- package/shadcn/lib/base-ui/_chunk-0h5sskyw.js +347 -0
- package/shadcn/lib/base-ui/_chunk-0xhx4g7r.js +57 -0
- package/shadcn/lib/base-ui/_chunk-1e6khrvm.js +218 -0
- package/shadcn/lib/base-ui/_chunk-1s41sngz.js +302 -0
- package/shadcn/lib/base-ui/_chunk-20rtfsz9.js +23 -0
- package/shadcn/lib/base-ui/_chunk-2tyt8f8r.js +6034 -0
- package/shadcn/lib/base-ui/_chunk-3f31ka8n.js +11 -0
- package/shadcn/lib/base-ui/_chunk-3h6zpchb.js +89 -0
- package/shadcn/lib/base-ui/_chunk-4s0k3h7t.js +114 -0
- package/shadcn/lib/base-ui/_chunk-502wngfc.js +598 -0
- package/shadcn/lib/base-ui/_chunk-536jvgeq.js +68 -0
- package/shadcn/lib/base-ui/_chunk-611pz5sm.js +10 -0
- package/shadcn/lib/base-ui/_chunk-65zw5gs2.js +15 -0
- package/shadcn/lib/base-ui/_chunk-6b17g8t7.js +34 -0
- package/shadcn/lib/base-ui/_chunk-6xevjepc.js +15 -0
- package/shadcn/lib/base-ui/_chunk-71zm6zgv.js +16 -0
- package/shadcn/lib/base-ui/_chunk-7fmjymvh.js +32 -0
- package/shadcn/lib/base-ui/_chunk-7jjzay8b.js +176 -0
- package/shadcn/lib/base-ui/_chunk-7v1t86x1.js +43 -0
- package/shadcn/lib/base-ui/_chunk-85vrgzwr.js +227 -0
- package/shadcn/lib/base-ui/_chunk-8jz3hb7q.js +9 -0
- package/shadcn/lib/base-ui/_chunk-8kh3xk78.js +35 -0
- package/shadcn/lib/base-ui/_chunk-97tas84n.js +67 -0
- package/shadcn/lib/base-ui/_chunk-9nyxkvte.js +13 -0
- package/shadcn/lib/base-ui/_chunk-a8fwg9d0.js +52 -0
- package/shadcn/lib/base-ui/_chunk-agc6ew3g.js +29 -0
- package/shadcn/lib/base-ui/_chunk-aqwsk46c.js +64 -0
- package/shadcn/lib/base-ui/_chunk-atd5kq5q.js +803 -0
- package/shadcn/lib/base-ui/_chunk-atnkefgd.js +104 -0
- package/shadcn/lib/base-ui/_chunk-b40erthe.js +7 -0
- package/shadcn/lib/base-ui/_chunk-b5jsqt97.js +50 -0
- package/shadcn/lib/base-ui/_chunk-bk7n9s9e.js +15 -0
- package/shadcn/lib/base-ui/_chunk-c3572b5x.js +19 -0
- package/shadcn/lib/base-ui/_chunk-cwr896nf.js +25 -0
- package/shadcn/lib/base-ui/_chunk-drfb9kp2.js +27 -0
- package/shadcn/lib/base-ui/_chunk-ds8fnpjj.js +0 -0
- package/shadcn/lib/base-ui/_chunk-ek863ta9.js +82 -0
- package/shadcn/lib/base-ui/_chunk-f09cp81f.js +12 -0
- package/shadcn/lib/base-ui/_chunk-f5d01bp9.js +0 -0
- package/shadcn/lib/base-ui/_chunk-f9tgee1q.js +21 -0
- package/shadcn/lib/base-ui/_chunk-fch5cba8.js +84 -0
- package/shadcn/lib/base-ui/_chunk-gfce3j3z.js +18 -0
- package/shadcn/lib/base-ui/_chunk-ha06w2pp.js +2391 -0
- package/shadcn/lib/base-ui/_chunk-hzgetm70.js +23 -0
- package/shadcn/lib/base-ui/_chunk-j0eqdjta.js +39 -0
- package/shadcn/lib/base-ui/_chunk-k1e5fvcj.js +48 -0
- package/shadcn/lib/base-ui/_chunk-k4mc2kan.js +81 -0
- package/shadcn/lib/base-ui/_chunk-kfz96xv1.js +128 -0
- package/shadcn/lib/base-ui/_chunk-m45547cc.js +15 -0
- package/shadcn/lib/base-ui/_chunk-mbn76q14.js +184 -0
- package/shadcn/lib/base-ui/_chunk-mvv30fkv.js +9 -0
- package/shadcn/lib/base-ui/_chunk-mznt6ktj.js +33 -0
- package/shadcn/lib/base-ui/_chunk-n7dnqnbw.js +7 -0
- package/shadcn/lib/base-ui/_chunk-nya71ccw.js +546 -0
- package/shadcn/lib/base-ui/_chunk-p6qynd6r.js +146 -0
- package/shadcn/lib/base-ui/_chunk-q3nee19r.js +323 -0
- package/shadcn/lib/base-ui/_chunk-q7yw9mz4.js +385 -0
- package/shadcn/lib/base-ui/_chunk-qce0xt57.js +107 -0
- package/shadcn/lib/base-ui/_chunk-qgzhcjsj.js +14 -0
- package/shadcn/lib/base-ui/_chunk-qt6r015s.js +38 -0
- package/shadcn/lib/base-ui/_chunk-r0vsdknk.js +4 -0
- package/shadcn/lib/base-ui/_chunk-sx6vkz01.js +150 -0
- package/shadcn/lib/base-ui/_chunk-szcr6mhk.js +6 -0
- package/shadcn/lib/base-ui/_chunk-t7j3rbpv.js +67 -0
- package/shadcn/lib/base-ui/_chunk-tmfmrzwe.js +39 -0
- package/shadcn/lib/base-ui/_chunk-v92ycsfj.js +9 -0
- package/shadcn/lib/base-ui/_chunk-vdc01ss3.js +6 -0
- package/shadcn/lib/base-ui/_chunk-vjbnhhg1.js +26 -0
- package/shadcn/lib/base-ui/_chunk-w68yxg9d.js +21 -0
- package/shadcn/lib/base-ui/_chunk-wana68v3.js +477 -0
- package/shadcn/lib/base-ui/_chunk-wtw745qd.js +12 -0
- package/shadcn/lib/base-ui/_chunk-xb7ph1ka.js +6 -0
- package/shadcn/lib/base-ui/_chunk-xfagb0fq.js +28 -0
- package/shadcn/lib/base-ui/_chunk-xxhqanfd.js +16 -0
- package/shadcn/lib/base-ui/_chunk-y887e46p.js +15 -0
- package/shadcn/lib/base-ui/_chunk-ymj1dpqg.js +14 -0
- package/shadcn/lib/base-ui/accordion.js +650 -0
- package/shadcn/lib/base-ui/alert-dialog.js +138 -0
- package/shadcn/lib/base-ui/avatar.js +235 -0
- package/shadcn/lib/base-ui/button.js +52 -0
- package/shadcn/lib/base-ui/checkbox.js +454 -0
- package/shadcn/lib/base-ui/collapsible.js +283 -0
- package/shadcn/lib/base-ui/context-menu.js +324 -0
- package/shadcn/lib/base-ui/dialog.js +71 -0
- package/shadcn/lib/base-ui/input.js +1028 -0
- package/shadcn/lib/base-ui/menu.js +61 -0
- package/shadcn/lib/base-ui/menubar.js +157 -0
- package/shadcn/lib/base-ui/merge-props.js +15 -0
- package/shadcn/lib/base-ui/navigation-menu.js +1854 -0
- package/shadcn/lib/base-ui/popover.js +1090 -0
- package/shadcn/lib/base-ui/preview-card.js +709 -0
- package/shadcn/lib/base-ui/progress.js +278 -0
- package/shadcn/lib/base-ui/radio-group.js +247 -0
- package/shadcn/lib/base-ui/radio.js +382 -0
- package/shadcn/lib/base-ui/scroll-area.js +1061 -0
- package/shadcn/lib/base-ui/select.js +2438 -0
- package/shadcn/lib/base-ui/separator.js +11 -0
- package/shadcn/lib/base-ui/slider.js +1595 -0
- package/shadcn/lib/base-ui/switch.js +333 -0
- package/shadcn/lib/base-ui/tabs.js +892 -0
- package/shadcn/lib/base-ui/toggle-group.js +152 -0
- package/shadcn/lib/base-ui/toggle.js +133 -0
- package/shadcn/lib/base-ui/tooltip.js +791 -0
- package/shadcn/lib/base-ui/use-render.js +15 -0
- package/shadcn/lib/tailwind-merge.js +3312 -0
- package/shadcn/lib/utils.js +1 -1
- package/shadcn/ui/accordion.jsx +1 -1
- package/shadcn/ui/alert-dialog.jsx +1 -1
- package/shadcn/ui/avatar.jsx +1 -1
- package/shadcn/ui/badge.jsx +2 -2
- package/shadcn/ui/breadcrumb.jsx +2 -2
- package/shadcn/ui/button-group.jsx +2 -2
- package/shadcn/ui/button.jsx +1 -1
- package/shadcn/ui/calendar.jsx +1 -1
- package/shadcn/ui/checkbox.jsx +1 -1
- package/shadcn/ui/collapsible.jsx +1 -1
- package/shadcn/ui/command.jsx +1 -1
- package/shadcn/ui/context-menu.jsx +1 -1
- package/shadcn/ui/dialog.jsx +1 -1
- package/shadcn/ui/drawer.jsx +176 -74
- package/shadcn/ui/dropdown-menu.jsx +1 -1
- package/shadcn/ui/hover-card.jsx +1 -1
- package/shadcn/ui/input.jsx +1 -1
- package/shadcn/ui/item.jsx +2 -2
- package/shadcn/ui/menubar.jsx +2 -2
- package/shadcn/ui/navigation-menu.jsx +1 -1
- package/shadcn/ui/popover.jsx +1 -1
- package/shadcn/ui/progress.jsx +1 -1
- package/shadcn/ui/radio-group.jsx +2 -2
- package/shadcn/ui/scroll-area.jsx +1 -1
- package/shadcn/ui/select.jsx +1 -1
- package/shadcn/ui/separator.jsx +1 -1
- package/shadcn/ui/sheet.jsx +1 -1
- package/shadcn/ui/sidebar.jsx +3 -3
- package/shadcn/ui/slider.jsx +1 -1
- package/shadcn/ui/switch.jsx +1 -1
- package/shadcn/ui/tabs.jsx +1 -1
- package/shadcn/ui/toggle-group.jsx +2 -2
- package/shadcn/ui/toggle.jsx +1 -1
- package/shadcn/ui/tooltip.jsx +1 -1
- package/styles.css +31 -0
- package/MIGRATION.md +0 -230
- package/shadcn/ui/carousel.jsx +0 -195
- package/shadcn/ui/chart.jsx +0 -312
- package/shadcn/ui/resizable.jsx +0 -47
- /package/{core → components/core}/Calendar.jsx +0 -0
- /package/{core → components/core}/Command.jsx +0 -0
- /package/{core → components/core}/Context.jsx +0 -0
- /package/{core → components/core}/ThemeProvider.jsx +0 -0
- /package/{core → components/core}/Utilities.js +0 -0
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InternalBackdrop,
|
|
3
|
+
useOpenInteractionType,
|
|
4
|
+
useScrollLock
|
|
5
|
+
} from "./_chunk-q3nee19r.js";
|
|
6
|
+
import {
|
|
7
|
+
createInitialPopupStoreState,
|
|
8
|
+
popupStoreSelectors,
|
|
9
|
+
useImplicitActiveTrigger,
|
|
10
|
+
useOpenStateTransitions,
|
|
11
|
+
useTriggerDataForwarding
|
|
12
|
+
} from "./_chunk-7jjzay8b.js";
|
|
13
|
+
import {
|
|
14
|
+
useOnFirstRender
|
|
15
|
+
} from "./_chunk-f09cp81f.js";
|
|
16
|
+
import {
|
|
17
|
+
CommonPopupDataAttributes,
|
|
18
|
+
popupStateMapping,
|
|
19
|
+
triggerOpenStateMapping
|
|
20
|
+
} from "./_chunk-536jvgeq.js";
|
|
21
|
+
import {
|
|
22
|
+
inertValue
|
|
23
|
+
} from "./_chunk-9nyxkvte.js";
|
|
24
|
+
import {
|
|
25
|
+
CLICK_TRIGGER_IDENTIFIER,
|
|
26
|
+
FloatingFocusManager,
|
|
27
|
+
FloatingPortal,
|
|
28
|
+
PopupTriggerMap,
|
|
29
|
+
ReactStore,
|
|
30
|
+
createSelector,
|
|
31
|
+
useClick,
|
|
32
|
+
useDismiss,
|
|
33
|
+
useInteractions,
|
|
34
|
+
useRole,
|
|
35
|
+
useSyncedFloatingRootContext
|
|
36
|
+
} from "./_chunk-2tyt8f8r.js";
|
|
37
|
+
import {
|
|
38
|
+
contains,
|
|
39
|
+
getTarget
|
|
40
|
+
} from "./_chunk-atnkefgd.js";
|
|
41
|
+
import {
|
|
42
|
+
COMPOSITE_KEYS
|
|
43
|
+
} from "./_chunk-qce0xt57.js";
|
|
44
|
+
import {
|
|
45
|
+
createChangeEventDetails,
|
|
46
|
+
exports_reason_parts
|
|
47
|
+
} from "./_chunk-4s0k3h7t.js";
|
|
48
|
+
import {
|
|
49
|
+
useBaseUiId
|
|
50
|
+
} from "./_chunk-8kh3xk78.js";
|
|
51
|
+
import {
|
|
52
|
+
transitionStatusMapping,
|
|
53
|
+
useOpenChangeComplete
|
|
54
|
+
} from "./_chunk-mbn76q14.js";
|
|
55
|
+
import {
|
|
56
|
+
useButton
|
|
57
|
+
} from "./_chunk-85vrgzwr.js";
|
|
58
|
+
import {
|
|
59
|
+
useRefWithInit,
|
|
60
|
+
useRenderElement
|
|
61
|
+
} from "./_chunk-1s41sngz.js";
|
|
62
|
+
|
|
63
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/root/DialogRoot.js
|
|
64
|
+
import * as React4 from "react";
|
|
65
|
+
|
|
66
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/root/useDialogRoot.js
|
|
67
|
+
import * as React from "react";
|
|
68
|
+
"use client";
|
|
69
|
+
function useDialogRoot(params) {
|
|
70
|
+
const {
|
|
71
|
+
store,
|
|
72
|
+
parentContext,
|
|
73
|
+
actionsRef,
|
|
74
|
+
isDrawer
|
|
75
|
+
} = params;
|
|
76
|
+
const open = store.useState("open");
|
|
77
|
+
const disablePointerDismissal = store.useState("disablePointerDismissal");
|
|
78
|
+
const modal = store.useState("modal");
|
|
79
|
+
const popupElement = store.useState("popupElement");
|
|
80
|
+
const {
|
|
81
|
+
openMethod,
|
|
82
|
+
triggerProps
|
|
83
|
+
} = useOpenInteractionType(open);
|
|
84
|
+
useImplicitActiveTrigger(store);
|
|
85
|
+
const {
|
|
86
|
+
forceUnmount
|
|
87
|
+
} = useOpenStateTransitions(open, store);
|
|
88
|
+
const handleImperativeClose = React.useCallback(() => {
|
|
89
|
+
store.setOpen(false, createChangeEventDetails(exports_reason_parts.imperativeAction));
|
|
90
|
+
}, [store]);
|
|
91
|
+
React.useImperativeHandle(actionsRef, () => ({
|
|
92
|
+
unmount: forceUnmount,
|
|
93
|
+
close: handleImperativeClose
|
|
94
|
+
}), [forceUnmount, handleImperativeClose]);
|
|
95
|
+
const floatingRootContext = useSyncedFloatingRootContext({
|
|
96
|
+
popupStore: store,
|
|
97
|
+
onOpenChange: store.setOpen,
|
|
98
|
+
treatPopupAsFloatingElement: true
|
|
99
|
+
});
|
|
100
|
+
const [ownNestedOpenDialogs, setOwnNestedOpenDialogs] = React.useState(0);
|
|
101
|
+
const [ownNestedOpenDrawers, setOwnNestedOpenDrawers] = React.useState(0);
|
|
102
|
+
const isTopmost = ownNestedOpenDialogs === 0;
|
|
103
|
+
const role = useRole(floatingRootContext);
|
|
104
|
+
const dismiss = useDismiss(floatingRootContext, {
|
|
105
|
+
outsidePressEvent() {
|
|
106
|
+
if (store.context.internalBackdropRef.current || store.context.backdropRef.current) {
|
|
107
|
+
return "intentional";
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
mouse: modal === "trap-focus" ? "sloppy" : "intentional",
|
|
111
|
+
touch: "sloppy"
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
outsidePress(event) {
|
|
115
|
+
if (!store.context.outsidePressEnabledRef.current) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if ("button" in event && event.button !== 0) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if ("touches" in event && event.touches.length !== 1) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
const target = getTarget(event);
|
|
125
|
+
if (isTopmost && !disablePointerDismissal) {
|
|
126
|
+
const eventTarget = target;
|
|
127
|
+
if (modal) {
|
|
128
|
+
return store.context.internalBackdropRef.current || store.context.backdropRef.current ? store.context.internalBackdropRef.current === eventTarget || store.context.backdropRef.current === eventTarget || contains(eventTarget, popupElement) && !eventTarget?.hasAttribute("data-base-ui-portal") : true;
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
},
|
|
134
|
+
escapeKey: isTopmost
|
|
135
|
+
});
|
|
136
|
+
useScrollLock(open && modal === true, popupElement);
|
|
137
|
+
const {
|
|
138
|
+
getReferenceProps,
|
|
139
|
+
getFloatingProps,
|
|
140
|
+
getTriggerProps
|
|
141
|
+
} = useInteractions([role, dismiss]);
|
|
142
|
+
store.useContextCallback("onNestedDialogOpen", (dialogCount, drawerCount) => {
|
|
143
|
+
setOwnNestedOpenDialogs(dialogCount);
|
|
144
|
+
setOwnNestedOpenDrawers(drawerCount);
|
|
145
|
+
});
|
|
146
|
+
store.useContextCallback("onNestedDialogClose", () => {
|
|
147
|
+
setOwnNestedOpenDialogs(0);
|
|
148
|
+
setOwnNestedOpenDrawers(0);
|
|
149
|
+
});
|
|
150
|
+
React.useEffect(() => {
|
|
151
|
+
if (parentContext?.onNestedDialogOpen && open) {
|
|
152
|
+
parentContext.onNestedDialogOpen(ownNestedOpenDialogs + 1, ownNestedOpenDrawers + (isDrawer ? 1 : 0));
|
|
153
|
+
}
|
|
154
|
+
if (parentContext?.onNestedDialogClose && !open) {
|
|
155
|
+
parentContext.onNestedDialogClose();
|
|
156
|
+
}
|
|
157
|
+
return () => {
|
|
158
|
+
if (parentContext?.onNestedDialogClose && open) {
|
|
159
|
+
parentContext.onNestedDialogClose();
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}, [isDrawer, open, ownNestedOpenDialogs, ownNestedOpenDrawers, parentContext]);
|
|
163
|
+
const activeTriggerProps = React.useMemo(() => getReferenceProps(triggerProps), [getReferenceProps, triggerProps]);
|
|
164
|
+
const inactiveTriggerProps = React.useMemo(() => getTriggerProps(triggerProps), [getTriggerProps, triggerProps]);
|
|
165
|
+
const popupProps = React.useMemo(() => getFloatingProps(), [getFloatingProps]);
|
|
166
|
+
store.useSyncedValues({
|
|
167
|
+
openMethod,
|
|
168
|
+
activeTriggerProps,
|
|
169
|
+
inactiveTriggerProps,
|
|
170
|
+
popupProps,
|
|
171
|
+
floatingRootContext,
|
|
172
|
+
nestedOpenDialogCount: ownNestedOpenDialogs,
|
|
173
|
+
nestedOpenDrawerCount: ownNestedOpenDrawers
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/root/DialogRootContext.js
|
|
178
|
+
import * as React2 from "react";
|
|
179
|
+
"use client";
|
|
180
|
+
var DialogRootContext = /* @__PURE__ */ React2.createContext(undefined);
|
|
181
|
+
if (true)
|
|
182
|
+
DialogRootContext.displayName = "DialogRootContext";
|
|
183
|
+
function useDialogRootContext(optional) {
|
|
184
|
+
const dialogRootContext = React2.useContext(DialogRootContext);
|
|
185
|
+
if (optional === false && dialogRootContext === undefined) {
|
|
186
|
+
throw new Error("Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.");
|
|
187
|
+
}
|
|
188
|
+
return dialogRootContext;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/store/DialogStore.js
|
|
192
|
+
import * as React3 from "react";
|
|
193
|
+
var selectors = {
|
|
194
|
+
...popupStoreSelectors,
|
|
195
|
+
modal: createSelector((state) => state.modal),
|
|
196
|
+
nested: createSelector((state) => state.nested),
|
|
197
|
+
nestedOpenDialogCount: createSelector((state) => state.nestedOpenDialogCount),
|
|
198
|
+
nestedOpenDrawerCount: createSelector((state) => state.nestedOpenDrawerCount),
|
|
199
|
+
disablePointerDismissal: createSelector((state) => state.disablePointerDismissal),
|
|
200
|
+
openMethod: createSelector((state) => state.openMethod),
|
|
201
|
+
descriptionElementId: createSelector((state) => state.descriptionElementId),
|
|
202
|
+
titleElementId: createSelector((state) => state.titleElementId),
|
|
203
|
+
viewportElement: createSelector((state) => state.viewportElement),
|
|
204
|
+
role: createSelector((state) => state.role)
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
class DialogStore extends ReactStore {
|
|
208
|
+
constructor(initialState) {
|
|
209
|
+
super(createInitialState(initialState), {
|
|
210
|
+
popupRef: /* @__PURE__ */ React3.createRef(),
|
|
211
|
+
backdropRef: /* @__PURE__ */ React3.createRef(),
|
|
212
|
+
internalBackdropRef: /* @__PURE__ */ React3.createRef(),
|
|
213
|
+
outsidePressEnabledRef: {
|
|
214
|
+
current: true
|
|
215
|
+
},
|
|
216
|
+
triggerElements: new PopupTriggerMap,
|
|
217
|
+
onOpenChange: undefined,
|
|
218
|
+
onOpenChangeComplete: undefined
|
|
219
|
+
}, selectors);
|
|
220
|
+
}
|
|
221
|
+
setOpen = (nextOpen, eventDetails) => {
|
|
222
|
+
eventDetails.preventUnmountOnClose = () => {
|
|
223
|
+
this.set("preventUnmountingOnClose", true);
|
|
224
|
+
};
|
|
225
|
+
if (!nextOpen && eventDetails.trigger == null && this.state.activeTriggerId != null) {
|
|
226
|
+
eventDetails.trigger = this.state.activeTriggerElement ?? undefined;
|
|
227
|
+
}
|
|
228
|
+
this.context.onOpenChange?.(nextOpen, eventDetails);
|
|
229
|
+
if (eventDetails.isCanceled) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
233
|
+
const updatedState = {
|
|
234
|
+
open: nextOpen
|
|
235
|
+
};
|
|
236
|
+
const newTriggerId = eventDetails.trigger?.id ?? null;
|
|
237
|
+
if (newTriggerId || nextOpen) {
|
|
238
|
+
updatedState.activeTriggerId = newTriggerId;
|
|
239
|
+
updatedState.activeTriggerElement = eventDetails.trigger ?? null;
|
|
240
|
+
}
|
|
241
|
+
this.update(updatedState);
|
|
242
|
+
};
|
|
243
|
+
static useStore(externalStore, initialState) {
|
|
244
|
+
const internalStore = useRefWithInit(() => {
|
|
245
|
+
return new DialogStore(initialState);
|
|
246
|
+
}).current;
|
|
247
|
+
return externalStore ?? internalStore;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function createInitialState(initialState = {}) {
|
|
251
|
+
return {
|
|
252
|
+
...createInitialPopupStoreState(),
|
|
253
|
+
modal: true,
|
|
254
|
+
disablePointerDismissal: false,
|
|
255
|
+
popupElement: null,
|
|
256
|
+
viewportElement: null,
|
|
257
|
+
descriptionElementId: undefined,
|
|
258
|
+
titleElementId: undefined,
|
|
259
|
+
openMethod: null,
|
|
260
|
+
nested: false,
|
|
261
|
+
nestedOpenDialogCount: 0,
|
|
262
|
+
nestedOpenDrawerCount: 0,
|
|
263
|
+
role: "dialog",
|
|
264
|
+
...initialState
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/root/DialogRoot.js
|
|
269
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
270
|
+
"use client";
|
|
271
|
+
var IsDrawerContext = /* @__PURE__ */ React4.createContext(false);
|
|
272
|
+
if (true)
|
|
273
|
+
IsDrawerContext.displayName = "IsDrawerContext";
|
|
274
|
+
function DialogRoot(props) {
|
|
275
|
+
const {
|
|
276
|
+
children,
|
|
277
|
+
open: openProp,
|
|
278
|
+
defaultOpen = false,
|
|
279
|
+
onOpenChange,
|
|
280
|
+
onOpenChangeComplete,
|
|
281
|
+
disablePointerDismissal = false,
|
|
282
|
+
modal = true,
|
|
283
|
+
actionsRef,
|
|
284
|
+
handle,
|
|
285
|
+
triggerId: triggerIdProp,
|
|
286
|
+
defaultTriggerId: defaultTriggerIdProp = null
|
|
287
|
+
} = props;
|
|
288
|
+
const parentDialogRootContext = useDialogRootContext(true);
|
|
289
|
+
const isDrawer = React4.useContext(IsDrawerContext);
|
|
290
|
+
const nested = Boolean(parentDialogRootContext);
|
|
291
|
+
const store = DialogStore.useStore(handle?.store, {
|
|
292
|
+
open: defaultOpen,
|
|
293
|
+
openProp,
|
|
294
|
+
activeTriggerId: defaultTriggerIdProp,
|
|
295
|
+
triggerIdProp,
|
|
296
|
+
modal,
|
|
297
|
+
disablePointerDismissal,
|
|
298
|
+
nested
|
|
299
|
+
});
|
|
300
|
+
useOnFirstRender(() => {
|
|
301
|
+
if (openProp === undefined && store.state.open === false && defaultOpen === true) {
|
|
302
|
+
store.update({
|
|
303
|
+
open: true,
|
|
304
|
+
activeTriggerId: defaultTriggerIdProp
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
store.useControlledProp("openProp", openProp);
|
|
309
|
+
store.useControlledProp("triggerIdProp", triggerIdProp);
|
|
310
|
+
store.useSyncedValues({
|
|
311
|
+
disablePointerDismissal,
|
|
312
|
+
nested,
|
|
313
|
+
modal
|
|
314
|
+
});
|
|
315
|
+
store.useContextCallback("onOpenChange", onOpenChange);
|
|
316
|
+
store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
|
|
317
|
+
const payload = store.useState("payload");
|
|
318
|
+
useDialogRoot({
|
|
319
|
+
store,
|
|
320
|
+
actionsRef,
|
|
321
|
+
parentContext: parentDialogRootContext?.store.context,
|
|
322
|
+
isDrawer,
|
|
323
|
+
onOpenChange,
|
|
324
|
+
triggerIdProp
|
|
325
|
+
});
|
|
326
|
+
const contextValue = React4.useMemo(() => ({
|
|
327
|
+
store
|
|
328
|
+
}), [store]);
|
|
329
|
+
return /* @__PURE__ */ _jsx(IsDrawerContext.Provider, {
|
|
330
|
+
value: false,
|
|
331
|
+
children: /* @__PURE__ */ _jsx(DialogRootContext.Provider, {
|
|
332
|
+
value: contextValue,
|
|
333
|
+
children: typeof children === "function" ? children({
|
|
334
|
+
payload
|
|
335
|
+
}) : children
|
|
336
|
+
})
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/backdrop/DialogBackdrop.js
|
|
341
|
+
import * as React5 from "react";
|
|
342
|
+
"use client";
|
|
343
|
+
var stateAttributesMapping = {
|
|
344
|
+
...popupStateMapping,
|
|
345
|
+
...transitionStatusMapping
|
|
346
|
+
};
|
|
347
|
+
var DialogBackdrop = /* @__PURE__ */ React5.forwardRef(function DialogBackdrop2(componentProps, forwardedRef) {
|
|
348
|
+
const {
|
|
349
|
+
render,
|
|
350
|
+
className,
|
|
351
|
+
style,
|
|
352
|
+
forceRender = false,
|
|
353
|
+
...elementProps
|
|
354
|
+
} = componentProps;
|
|
355
|
+
const {
|
|
356
|
+
store
|
|
357
|
+
} = useDialogRootContext();
|
|
358
|
+
const open = store.useState("open");
|
|
359
|
+
const nested = store.useState("nested");
|
|
360
|
+
const mounted = store.useState("mounted");
|
|
361
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
362
|
+
const state = {
|
|
363
|
+
open,
|
|
364
|
+
transitionStatus
|
|
365
|
+
};
|
|
366
|
+
return useRenderElement("div", componentProps, {
|
|
367
|
+
state,
|
|
368
|
+
ref: [store.context.backdropRef, forwardedRef],
|
|
369
|
+
stateAttributesMapping,
|
|
370
|
+
props: [{
|
|
371
|
+
role: "presentation",
|
|
372
|
+
hidden: !mounted,
|
|
373
|
+
style: {
|
|
374
|
+
userSelect: "none",
|
|
375
|
+
WebkitUserSelect: "none"
|
|
376
|
+
}
|
|
377
|
+
}, elementProps],
|
|
378
|
+
enabled: forceRender || !nested
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
if (true)
|
|
382
|
+
DialogBackdrop.displayName = "DialogBackdrop";
|
|
383
|
+
|
|
384
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/close/DialogClose.js
|
|
385
|
+
import * as React6 from "react";
|
|
386
|
+
"use client";
|
|
387
|
+
var DialogClose = /* @__PURE__ */ React6.forwardRef(function DialogClose2(componentProps, forwardedRef) {
|
|
388
|
+
const {
|
|
389
|
+
render,
|
|
390
|
+
className,
|
|
391
|
+
disabled = false,
|
|
392
|
+
nativeButton = true,
|
|
393
|
+
style,
|
|
394
|
+
...elementProps
|
|
395
|
+
} = componentProps;
|
|
396
|
+
const {
|
|
397
|
+
store
|
|
398
|
+
} = useDialogRootContext();
|
|
399
|
+
const open = store.useState("open");
|
|
400
|
+
function handleClick(event) {
|
|
401
|
+
if (open) {
|
|
402
|
+
store.setOpen(false, createChangeEventDetails(exports_reason_parts.closePress, event.nativeEvent));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const {
|
|
406
|
+
getButtonProps,
|
|
407
|
+
buttonRef
|
|
408
|
+
} = useButton({
|
|
409
|
+
disabled,
|
|
410
|
+
native: nativeButton
|
|
411
|
+
});
|
|
412
|
+
const state = {
|
|
413
|
+
disabled
|
|
414
|
+
};
|
|
415
|
+
return useRenderElement("button", componentProps, {
|
|
416
|
+
state,
|
|
417
|
+
ref: [forwardedRef, buttonRef],
|
|
418
|
+
props: [{
|
|
419
|
+
onClick: handleClick
|
|
420
|
+
}, elementProps, getButtonProps]
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
if (true)
|
|
424
|
+
DialogClose.displayName = "DialogClose";
|
|
425
|
+
|
|
426
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/description/DialogDescription.js
|
|
427
|
+
import * as React7 from "react";
|
|
428
|
+
"use client";
|
|
429
|
+
var DialogDescription = /* @__PURE__ */ React7.forwardRef(function DialogDescription2(componentProps, forwardedRef) {
|
|
430
|
+
const {
|
|
431
|
+
render,
|
|
432
|
+
className,
|
|
433
|
+
style,
|
|
434
|
+
id: idProp,
|
|
435
|
+
...elementProps
|
|
436
|
+
} = componentProps;
|
|
437
|
+
const {
|
|
438
|
+
store
|
|
439
|
+
} = useDialogRootContext();
|
|
440
|
+
const id = useBaseUiId(idProp);
|
|
441
|
+
store.useSyncedValueWithCleanup("descriptionElementId", id);
|
|
442
|
+
return useRenderElement("p", componentProps, {
|
|
443
|
+
ref: forwardedRef,
|
|
444
|
+
props: [{
|
|
445
|
+
id
|
|
446
|
+
}, elementProps]
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
if (true)
|
|
450
|
+
DialogDescription.displayName = "DialogDescription";
|
|
451
|
+
|
|
452
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/popup/DialogPopup.js
|
|
453
|
+
import * as React9 from "react";
|
|
454
|
+
|
|
455
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/popup/DialogPopupCssVars.js
|
|
456
|
+
var DialogPopupCssVars = /* @__PURE__ */ function(DialogPopupCssVars2) {
|
|
457
|
+
DialogPopupCssVars2["nestedDialogs"] = "--nested-dialogs";
|
|
458
|
+
return DialogPopupCssVars2;
|
|
459
|
+
}({});
|
|
460
|
+
|
|
461
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/popup/DialogPopupDataAttributes.js
|
|
462
|
+
var DialogPopupDataAttributes = function(DialogPopupDataAttributes2) {
|
|
463
|
+
DialogPopupDataAttributes2[DialogPopupDataAttributes2["open"] = CommonPopupDataAttributes.open] = "open";
|
|
464
|
+
DialogPopupDataAttributes2[DialogPopupDataAttributes2["closed"] = CommonPopupDataAttributes.closed] = "closed";
|
|
465
|
+
DialogPopupDataAttributes2[DialogPopupDataAttributes2["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle";
|
|
466
|
+
DialogPopupDataAttributes2[DialogPopupDataAttributes2["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle";
|
|
467
|
+
DialogPopupDataAttributes2["nested"] = "data-nested";
|
|
468
|
+
DialogPopupDataAttributes2["nestedDialogOpen"] = "data-nested-dialog-open";
|
|
469
|
+
return DialogPopupDataAttributes2;
|
|
470
|
+
}({});
|
|
471
|
+
|
|
472
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/portal/DialogPortalContext.js
|
|
473
|
+
import * as React8 from "react";
|
|
474
|
+
"use client";
|
|
475
|
+
var DialogPortalContext = /* @__PURE__ */ React8.createContext(undefined);
|
|
476
|
+
if (true)
|
|
477
|
+
DialogPortalContext.displayName = "DialogPortalContext";
|
|
478
|
+
function useDialogPortalContext() {
|
|
479
|
+
const value = React8.useContext(DialogPortalContext);
|
|
480
|
+
if (value === undefined) {
|
|
481
|
+
throw new Error("Base UI: <Dialog.Portal> is missing.");
|
|
482
|
+
}
|
|
483
|
+
return value;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/popup/DialogPopup.js
|
|
487
|
+
import { jsx as _jsx2 } from "react/jsx-runtime";
|
|
488
|
+
"use client";
|
|
489
|
+
var stateAttributesMapping2 = {
|
|
490
|
+
...popupStateMapping,
|
|
491
|
+
...transitionStatusMapping,
|
|
492
|
+
nestedDialogOpen(value) {
|
|
493
|
+
return value ? {
|
|
494
|
+
[DialogPopupDataAttributes.nestedDialogOpen]: ""
|
|
495
|
+
} : null;
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
var DialogPopup = /* @__PURE__ */ React9.forwardRef(function DialogPopup2(componentProps, forwardedRef) {
|
|
499
|
+
const {
|
|
500
|
+
className,
|
|
501
|
+
finalFocus,
|
|
502
|
+
initialFocus,
|
|
503
|
+
render,
|
|
504
|
+
style,
|
|
505
|
+
...elementProps
|
|
506
|
+
} = componentProps;
|
|
507
|
+
const {
|
|
508
|
+
store
|
|
509
|
+
} = useDialogRootContext();
|
|
510
|
+
const descriptionElementId = store.useState("descriptionElementId");
|
|
511
|
+
const disablePointerDismissal = store.useState("disablePointerDismissal");
|
|
512
|
+
const floatingRootContext = store.useState("floatingRootContext");
|
|
513
|
+
const rootPopupProps = store.useState("popupProps");
|
|
514
|
+
const modal = store.useState("modal");
|
|
515
|
+
const mounted = store.useState("mounted");
|
|
516
|
+
const nested = store.useState("nested");
|
|
517
|
+
const nestedOpenDialogCount = store.useState("nestedOpenDialogCount");
|
|
518
|
+
const open = store.useState("open");
|
|
519
|
+
const openMethod = store.useState("openMethod");
|
|
520
|
+
const titleElementId = store.useState("titleElementId");
|
|
521
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
522
|
+
const role = store.useState("role");
|
|
523
|
+
useDialogPortalContext();
|
|
524
|
+
useOpenChangeComplete({
|
|
525
|
+
open,
|
|
526
|
+
ref: store.context.popupRef,
|
|
527
|
+
onComplete() {
|
|
528
|
+
if (open) {
|
|
529
|
+
store.context.onOpenChangeComplete?.(true);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
function defaultInitialFocus(interactionType) {
|
|
534
|
+
if (interactionType === "touch") {
|
|
535
|
+
return store.context.popupRef.current;
|
|
536
|
+
}
|
|
537
|
+
return true;
|
|
538
|
+
}
|
|
539
|
+
const resolvedInitialFocus = initialFocus === undefined ? defaultInitialFocus : initialFocus;
|
|
540
|
+
const nestedDialogOpen = nestedOpenDialogCount > 0;
|
|
541
|
+
const state = {
|
|
542
|
+
open,
|
|
543
|
+
nested,
|
|
544
|
+
transitionStatus,
|
|
545
|
+
nestedDialogOpen
|
|
546
|
+
};
|
|
547
|
+
const element = useRenderElement("div", componentProps, {
|
|
548
|
+
state,
|
|
549
|
+
props: [rootPopupProps, {
|
|
550
|
+
"aria-labelledby": titleElementId ?? undefined,
|
|
551
|
+
"aria-describedby": descriptionElementId ?? undefined,
|
|
552
|
+
role,
|
|
553
|
+
tabIndex: -1,
|
|
554
|
+
hidden: !mounted,
|
|
555
|
+
onKeyDown(event) {
|
|
556
|
+
if (COMPOSITE_KEYS.has(event.key)) {
|
|
557
|
+
event.stopPropagation();
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
style: {
|
|
561
|
+
[DialogPopupCssVars.nestedDialogs]: nestedOpenDialogCount
|
|
562
|
+
}
|
|
563
|
+
}, elementProps],
|
|
564
|
+
ref: [forwardedRef, store.context.popupRef, store.useStateSetter("popupElement")],
|
|
565
|
+
stateAttributesMapping: stateAttributesMapping2
|
|
566
|
+
});
|
|
567
|
+
return /* @__PURE__ */ _jsx2(FloatingFocusManager, {
|
|
568
|
+
context: floatingRootContext,
|
|
569
|
+
openInteractionType: openMethod,
|
|
570
|
+
disabled: !mounted,
|
|
571
|
+
closeOnFocusOut: !disablePointerDismissal,
|
|
572
|
+
initialFocus: resolvedInitialFocus,
|
|
573
|
+
returnFocus: finalFocus,
|
|
574
|
+
modal: modal !== false,
|
|
575
|
+
restoreFocus: "popup",
|
|
576
|
+
children: element
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
if (true)
|
|
580
|
+
DialogPopup.displayName = "DialogPopup";
|
|
581
|
+
|
|
582
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/portal/DialogPortal.js
|
|
583
|
+
import * as React10 from "react";
|
|
584
|
+
import { jsx as _jsx3, jsxs as _jsxs } from "react/jsx-runtime";
|
|
585
|
+
"use client";
|
|
586
|
+
var DialogPortal = /* @__PURE__ */ React10.forwardRef(function DialogPortal2(props, forwardedRef) {
|
|
587
|
+
const {
|
|
588
|
+
keepMounted = false,
|
|
589
|
+
...portalProps
|
|
590
|
+
} = props;
|
|
591
|
+
const {
|
|
592
|
+
store
|
|
593
|
+
} = useDialogRootContext();
|
|
594
|
+
const mounted = store.useState("mounted");
|
|
595
|
+
const modal = store.useState("modal");
|
|
596
|
+
const open = store.useState("open");
|
|
597
|
+
const shouldRender = mounted || keepMounted;
|
|
598
|
+
if (!shouldRender) {
|
|
599
|
+
return null;
|
|
600
|
+
}
|
|
601
|
+
return /* @__PURE__ */ _jsx3(DialogPortalContext.Provider, {
|
|
602
|
+
value: keepMounted,
|
|
603
|
+
children: /* @__PURE__ */ _jsxs(FloatingPortal, {
|
|
604
|
+
ref: forwardedRef,
|
|
605
|
+
...portalProps,
|
|
606
|
+
children: [mounted && modal === true && /* @__PURE__ */ _jsx3(InternalBackdrop, {
|
|
607
|
+
ref: store.context.internalBackdropRef,
|
|
608
|
+
inert: inertValue(!open)
|
|
609
|
+
}), props.children]
|
|
610
|
+
})
|
|
611
|
+
});
|
|
612
|
+
});
|
|
613
|
+
if (true)
|
|
614
|
+
DialogPortal.displayName = "DialogPortal";
|
|
615
|
+
|
|
616
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/title/DialogTitle.js
|
|
617
|
+
import * as React11 from "react";
|
|
618
|
+
"use client";
|
|
619
|
+
var DialogTitle = /* @__PURE__ */ React11.forwardRef(function DialogTitle2(componentProps, forwardedRef) {
|
|
620
|
+
const {
|
|
621
|
+
render,
|
|
622
|
+
className,
|
|
623
|
+
style,
|
|
624
|
+
id: idProp,
|
|
625
|
+
...elementProps
|
|
626
|
+
} = componentProps;
|
|
627
|
+
const {
|
|
628
|
+
store
|
|
629
|
+
} = useDialogRootContext();
|
|
630
|
+
const id = useBaseUiId(idProp);
|
|
631
|
+
store.useSyncedValueWithCleanup("titleElementId", id);
|
|
632
|
+
return useRenderElement("h2", componentProps, {
|
|
633
|
+
ref: forwardedRef,
|
|
634
|
+
props: [{
|
|
635
|
+
id
|
|
636
|
+
}, elementProps]
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
if (true)
|
|
640
|
+
DialogTitle.displayName = "DialogTitle";
|
|
641
|
+
|
|
642
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/trigger/DialogTrigger.js
|
|
643
|
+
import * as React12 from "react";
|
|
644
|
+
"use client";
|
|
645
|
+
var DialogTrigger = /* @__PURE__ */ React12.forwardRef(function DialogTrigger2(componentProps, forwardedRef) {
|
|
646
|
+
const {
|
|
647
|
+
render,
|
|
648
|
+
className,
|
|
649
|
+
disabled = false,
|
|
650
|
+
nativeButton = true,
|
|
651
|
+
id: idProp,
|
|
652
|
+
payload,
|
|
653
|
+
handle,
|
|
654
|
+
style,
|
|
655
|
+
...elementProps
|
|
656
|
+
} = componentProps;
|
|
657
|
+
const dialogRootContext = useDialogRootContext(true);
|
|
658
|
+
const store = handle?.store ?? dialogRootContext?.store;
|
|
659
|
+
if (!store) {
|
|
660
|
+
throw new Error("Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.");
|
|
661
|
+
}
|
|
662
|
+
const thisTriggerId = useBaseUiId(idProp);
|
|
663
|
+
const floatingContext = store.useState("floatingRootContext");
|
|
664
|
+
const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
|
|
665
|
+
const triggerElementRef = React12.useRef(null);
|
|
666
|
+
const {
|
|
667
|
+
registerTrigger,
|
|
668
|
+
isMountedByThisTrigger
|
|
669
|
+
} = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
|
|
670
|
+
payload
|
|
671
|
+
});
|
|
672
|
+
const {
|
|
673
|
+
getButtonProps,
|
|
674
|
+
buttonRef
|
|
675
|
+
} = useButton({
|
|
676
|
+
disabled,
|
|
677
|
+
native: nativeButton
|
|
678
|
+
});
|
|
679
|
+
const click = useClick(floatingContext, {
|
|
680
|
+
enabled: floatingContext != null
|
|
681
|
+
});
|
|
682
|
+
const localInteractionProps = useInteractions([click]);
|
|
683
|
+
const state = {
|
|
684
|
+
disabled,
|
|
685
|
+
open: isOpenedByThisTrigger
|
|
686
|
+
};
|
|
687
|
+
const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
|
|
688
|
+
return useRenderElement("button", componentProps, {
|
|
689
|
+
state,
|
|
690
|
+
ref: [buttonRef, forwardedRef, registerTrigger, triggerElementRef],
|
|
691
|
+
props: [localInteractionProps.getReferenceProps(), rootTriggerProps, {
|
|
692
|
+
[CLICK_TRIGGER_IDENTIFIER]: "",
|
|
693
|
+
id: thisTriggerId
|
|
694
|
+
}, elementProps, getButtonProps],
|
|
695
|
+
stateAttributesMapping: triggerOpenStateMapping
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
if (true)
|
|
699
|
+
DialogTrigger.displayName = "DialogTrigger";
|
|
700
|
+
|
|
701
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/viewport/DialogViewport.js
|
|
702
|
+
import * as React13 from "react";
|
|
703
|
+
|
|
704
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/viewport/DialogViewportDataAttributes.js
|
|
705
|
+
var DialogViewportDataAttributes = function(DialogViewportDataAttributes2) {
|
|
706
|
+
DialogViewportDataAttributes2[DialogViewportDataAttributes2["open"] = CommonPopupDataAttributes.open] = "open";
|
|
707
|
+
DialogViewportDataAttributes2[DialogViewportDataAttributes2["closed"] = CommonPopupDataAttributes.closed] = "closed";
|
|
708
|
+
DialogViewportDataAttributes2[DialogViewportDataAttributes2["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle";
|
|
709
|
+
DialogViewportDataAttributes2[DialogViewportDataAttributes2["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle";
|
|
710
|
+
DialogViewportDataAttributes2["nested"] = "data-nested";
|
|
711
|
+
DialogViewportDataAttributes2["nestedDialogOpen"] = "data-nested-dialog-open";
|
|
712
|
+
return DialogViewportDataAttributes2;
|
|
713
|
+
}({});
|
|
714
|
+
|
|
715
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/viewport/DialogViewport.js
|
|
716
|
+
"use client";
|
|
717
|
+
var stateAttributesMapping3 = {
|
|
718
|
+
...popupStateMapping,
|
|
719
|
+
...transitionStatusMapping,
|
|
720
|
+
nested(value) {
|
|
721
|
+
return value ? {
|
|
722
|
+
[DialogViewportDataAttributes.nested]: ""
|
|
723
|
+
} : null;
|
|
724
|
+
},
|
|
725
|
+
nestedDialogOpen(value) {
|
|
726
|
+
return value ? {
|
|
727
|
+
[DialogViewportDataAttributes.nestedDialogOpen]: ""
|
|
728
|
+
} : null;
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
var DialogViewport = /* @__PURE__ */ React13.forwardRef(function DialogViewport2(componentProps, forwardedRef) {
|
|
732
|
+
const {
|
|
733
|
+
className,
|
|
734
|
+
render,
|
|
735
|
+
children,
|
|
736
|
+
style,
|
|
737
|
+
...elementProps
|
|
738
|
+
} = componentProps;
|
|
739
|
+
const keepMounted = useDialogPortalContext();
|
|
740
|
+
const {
|
|
741
|
+
store
|
|
742
|
+
} = useDialogRootContext();
|
|
743
|
+
const open = store.useState("open");
|
|
744
|
+
const nested = store.useState("nested");
|
|
745
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
746
|
+
const nestedOpenDialogCount = store.useState("nestedOpenDialogCount");
|
|
747
|
+
const mounted = store.useState("mounted");
|
|
748
|
+
const nestedDialogOpen = nestedOpenDialogCount > 0;
|
|
749
|
+
const state = {
|
|
750
|
+
open,
|
|
751
|
+
nested,
|
|
752
|
+
transitionStatus,
|
|
753
|
+
nestedDialogOpen
|
|
754
|
+
};
|
|
755
|
+
const shouldRender = keepMounted || mounted;
|
|
756
|
+
return useRenderElement("div", componentProps, {
|
|
757
|
+
enabled: shouldRender,
|
|
758
|
+
state,
|
|
759
|
+
ref: [forwardedRef, store.useStateSetter("viewportElement")],
|
|
760
|
+
stateAttributesMapping: stateAttributesMapping3,
|
|
761
|
+
props: [{
|
|
762
|
+
role: "presentation",
|
|
763
|
+
hidden: !mounted,
|
|
764
|
+
style: {
|
|
765
|
+
pointerEvents: !open ? "none" : undefined
|
|
766
|
+
},
|
|
767
|
+
children
|
|
768
|
+
}, elementProps]
|
|
769
|
+
});
|
|
770
|
+
});
|
|
771
|
+
if (true)
|
|
772
|
+
DialogViewport.displayName = "DialogViewport";
|
|
773
|
+
|
|
774
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/dialog/store/DialogHandle.js
|
|
775
|
+
class DialogHandle {
|
|
776
|
+
constructor(store) {
|
|
777
|
+
this.store = store ?? new DialogStore;
|
|
778
|
+
}
|
|
779
|
+
open(triggerId) {
|
|
780
|
+
const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : undefined;
|
|
781
|
+
if (true) {
|
|
782
|
+
if (triggerId && !triggerElement) {
|
|
783
|
+
console.warn(`Base UI: DialogHandle.open: No trigger found with id "${triggerId}". The dialog will open, but the trigger will not be associated with the dialog.`);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
this.store.setOpen(true, createChangeEventDetails(exports_reason_parts.imperativeAction, undefined, triggerElement));
|
|
787
|
+
}
|
|
788
|
+
openWithPayload(payload) {
|
|
789
|
+
this.store.set("payload", payload);
|
|
790
|
+
this.store.setOpen(true, createChangeEventDetails(exports_reason_parts.imperativeAction, undefined, undefined));
|
|
791
|
+
}
|
|
792
|
+
close() {
|
|
793
|
+
this.store.setOpen(false, createChangeEventDetails(exports_reason_parts.imperativeAction, undefined, undefined));
|
|
794
|
+
}
|
|
795
|
+
get isOpen() {
|
|
796
|
+
return this.store.state.open;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
function createDialogHandle() {
|
|
800
|
+
return new DialogHandle;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export { useDialogRoot, DialogRootContext, useDialogRootContext, DialogStore, IsDrawerContext, DialogRoot, DialogBackdrop, DialogClose, DialogDescription, DialogPopup, DialogPortal, DialogTitle, DialogTrigger, DialogViewport, DialogHandle, createDialogHandle };
|