@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,477 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useControlled
|
|
3
|
+
} from "./_chunk-01rqe37g.js";
|
|
4
|
+
import {
|
|
5
|
+
addEventListener
|
|
6
|
+
} from "./_chunk-mvv30fkv.js";
|
|
7
|
+
import {
|
|
8
|
+
createChangeEventDetails,
|
|
9
|
+
exports_reason_parts
|
|
10
|
+
} from "./_chunk-4s0k3h7t.js";
|
|
11
|
+
import {
|
|
12
|
+
useBaseUiId
|
|
13
|
+
} from "./_chunk-8kh3xk78.js";
|
|
14
|
+
import {
|
|
15
|
+
TransitionStatusDataAttributes,
|
|
16
|
+
useAnimationsFinished,
|
|
17
|
+
useTransitionStatus
|
|
18
|
+
} from "./_chunk-mbn76q14.js";
|
|
19
|
+
import {
|
|
20
|
+
AnimationFrame,
|
|
21
|
+
useAnimationFrame
|
|
22
|
+
} from "./_chunk-3h6zpchb.js";
|
|
23
|
+
import {
|
|
24
|
+
useOnMount
|
|
25
|
+
} from "./_chunk-8jz3hb7q.js";
|
|
26
|
+
import {
|
|
27
|
+
useStableCallback
|
|
28
|
+
} from "./_chunk-mznt6ktj.js";
|
|
29
|
+
import {
|
|
30
|
+
useIsoLayoutEffect
|
|
31
|
+
} from "./_chunk-b40erthe.js";
|
|
32
|
+
import {
|
|
33
|
+
useMergedRefs,
|
|
34
|
+
warn
|
|
35
|
+
} from "./_chunk-1s41sngz.js";
|
|
36
|
+
|
|
37
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/collapsible/root/useCollapsibleRoot.js
|
|
38
|
+
import * as React from "react";
|
|
39
|
+
"use client";
|
|
40
|
+
function useCollapsibleRoot(parameters) {
|
|
41
|
+
const {
|
|
42
|
+
open: openParam,
|
|
43
|
+
defaultOpen,
|
|
44
|
+
onOpenChange,
|
|
45
|
+
disabled
|
|
46
|
+
} = parameters;
|
|
47
|
+
const isControlled = openParam !== undefined;
|
|
48
|
+
const [open, setOpen] = useControlled({
|
|
49
|
+
controlled: openParam,
|
|
50
|
+
default: defaultOpen,
|
|
51
|
+
name: "Collapsible",
|
|
52
|
+
state: "open"
|
|
53
|
+
});
|
|
54
|
+
const {
|
|
55
|
+
mounted,
|
|
56
|
+
setMounted,
|
|
57
|
+
transitionStatus
|
|
58
|
+
} = useTransitionStatus(open, true, true);
|
|
59
|
+
const [visible, setVisible] = React.useState(open);
|
|
60
|
+
const [{
|
|
61
|
+
height,
|
|
62
|
+
width
|
|
63
|
+
}, setDimensions] = React.useState({
|
|
64
|
+
height: undefined,
|
|
65
|
+
width: undefined
|
|
66
|
+
});
|
|
67
|
+
const defaultPanelId = useBaseUiId();
|
|
68
|
+
const [panelIdState, setPanelIdState] = React.useState();
|
|
69
|
+
const panelId = panelIdState ?? defaultPanelId;
|
|
70
|
+
const [hiddenUntilFound, setHiddenUntilFound] = React.useState(false);
|
|
71
|
+
const [keepMounted, setKeepMounted] = React.useState(false);
|
|
72
|
+
const abortControllerRef = React.useRef(null);
|
|
73
|
+
const animationTypeRef = React.useRef(null);
|
|
74
|
+
const transitionDimensionRef = React.useRef(null);
|
|
75
|
+
const panelRef = React.useRef(null);
|
|
76
|
+
const runOnceAnimationsFinish = useAnimationsFinished(panelRef, false);
|
|
77
|
+
const handleTrigger = useStableCallback((event) => {
|
|
78
|
+
const nextOpen = !open;
|
|
79
|
+
const eventDetails = createChangeEventDetails(exports_reason_parts.triggerPress, event.nativeEvent);
|
|
80
|
+
onOpenChange(nextOpen, eventDetails);
|
|
81
|
+
if (eventDetails.isCanceled) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const panel = panelRef.current;
|
|
85
|
+
if (animationTypeRef.current === "css-animation" && panel != null) {
|
|
86
|
+
panel.style.removeProperty("animation-name");
|
|
87
|
+
}
|
|
88
|
+
if (!hiddenUntilFound && !keepMounted) {
|
|
89
|
+
if (animationTypeRef.current != null && animationTypeRef.current !== "css-animation") {
|
|
90
|
+
if (!mounted && nextOpen) {
|
|
91
|
+
setMounted(true);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (animationTypeRef.current === "css-animation") {
|
|
95
|
+
if (!visible && nextOpen) {
|
|
96
|
+
setVisible(true);
|
|
97
|
+
}
|
|
98
|
+
if (!mounted && nextOpen) {
|
|
99
|
+
setMounted(true);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
setOpen(nextOpen);
|
|
104
|
+
if (animationTypeRef.current === "none" && mounted && !nextOpen) {
|
|
105
|
+
setMounted(false);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
useIsoLayoutEffect(() => {
|
|
109
|
+
if (isControlled && animationTypeRef.current === "none" && !open) {
|
|
110
|
+
setMounted(false);
|
|
111
|
+
}
|
|
112
|
+
}, [isControlled, open, openParam, setMounted]);
|
|
113
|
+
return React.useMemo(() => ({
|
|
114
|
+
abortControllerRef,
|
|
115
|
+
animationTypeRef,
|
|
116
|
+
disabled,
|
|
117
|
+
handleTrigger,
|
|
118
|
+
height,
|
|
119
|
+
mounted,
|
|
120
|
+
open,
|
|
121
|
+
panelId,
|
|
122
|
+
panelRef,
|
|
123
|
+
runOnceAnimationsFinish,
|
|
124
|
+
setDimensions,
|
|
125
|
+
setHiddenUntilFound,
|
|
126
|
+
setKeepMounted,
|
|
127
|
+
setMounted,
|
|
128
|
+
setOpen,
|
|
129
|
+
setPanelIdState,
|
|
130
|
+
setVisible,
|
|
131
|
+
transitionDimensionRef,
|
|
132
|
+
transitionStatus,
|
|
133
|
+
visible,
|
|
134
|
+
width
|
|
135
|
+
}), [abortControllerRef, animationTypeRef, disabled, handleTrigger, height, mounted, open, panelId, panelRef, runOnceAnimationsFinish, setDimensions, setHiddenUntilFound, setKeepMounted, setMounted, setOpen, setVisible, transitionDimensionRef, transitionStatus, visible, width]);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRootContext.js
|
|
139
|
+
import * as React2 from "react";
|
|
140
|
+
"use client";
|
|
141
|
+
var CollapsibleRootContext = /* @__PURE__ */ React2.createContext(undefined);
|
|
142
|
+
if (true)
|
|
143
|
+
CollapsibleRootContext.displayName = "CollapsibleRootContext";
|
|
144
|
+
function useCollapsibleRootContext() {
|
|
145
|
+
const context = React2.useContext(CollapsibleRootContext);
|
|
146
|
+
if (context === undefined) {
|
|
147
|
+
throw new Error("Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>.");
|
|
148
|
+
}
|
|
149
|
+
return context;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanelDataAttributes.js
|
|
153
|
+
var CollapsiblePanelDataAttributes = function(CollapsiblePanelDataAttributes2) {
|
|
154
|
+
CollapsiblePanelDataAttributes2["open"] = "data-open";
|
|
155
|
+
CollapsiblePanelDataAttributes2["closed"] = "data-closed";
|
|
156
|
+
CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
|
|
157
|
+
CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
|
|
158
|
+
return CollapsiblePanelDataAttributes2;
|
|
159
|
+
}({});
|
|
160
|
+
|
|
161
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/collapsible/trigger/CollapsibleTriggerDataAttributes.js
|
|
162
|
+
var CollapsibleTriggerDataAttributes = /* @__PURE__ */ function(CollapsibleTriggerDataAttributes2) {
|
|
163
|
+
CollapsibleTriggerDataAttributes2["panelOpen"] = "data-panel-open";
|
|
164
|
+
return CollapsibleTriggerDataAttributes2;
|
|
165
|
+
}({});
|
|
166
|
+
|
|
167
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/utils/collapsibleOpenStateMapping.js
|
|
168
|
+
var PANEL_OPEN_HOOK = {
|
|
169
|
+
[CollapsiblePanelDataAttributes.open]: ""
|
|
170
|
+
};
|
|
171
|
+
var PANEL_CLOSED_HOOK = {
|
|
172
|
+
[CollapsiblePanelDataAttributes.closed]: ""
|
|
173
|
+
};
|
|
174
|
+
var triggerOpenStateMapping = {
|
|
175
|
+
open(value) {
|
|
176
|
+
if (value) {
|
|
177
|
+
return {
|
|
178
|
+
[CollapsibleTriggerDataAttributes.panelOpen]: ""
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
var collapsibleOpenStateMapping = {
|
|
185
|
+
open(value) {
|
|
186
|
+
if (value) {
|
|
187
|
+
return PANEL_OPEN_HOOK;
|
|
188
|
+
}
|
|
189
|
+
return PANEL_CLOSED_HOOK;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js
|
|
194
|
+
import * as React3 from "react";
|
|
195
|
+
|
|
196
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/accordion/root/AccordionRootDataAttributes.js
|
|
197
|
+
var AccordionRootDataAttributes = /* @__PURE__ */ function(AccordionRootDataAttributes2) {
|
|
198
|
+
AccordionRootDataAttributes2["disabled"] = "data-disabled";
|
|
199
|
+
AccordionRootDataAttributes2["orientation"] = "data-orientation";
|
|
200
|
+
return AccordionRootDataAttributes2;
|
|
201
|
+
}({});
|
|
202
|
+
|
|
203
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js
|
|
204
|
+
"use client";
|
|
205
|
+
function useCollapsiblePanel(parameters) {
|
|
206
|
+
const {
|
|
207
|
+
abortControllerRef,
|
|
208
|
+
animationTypeRef,
|
|
209
|
+
externalRef,
|
|
210
|
+
height,
|
|
211
|
+
hiddenUntilFound,
|
|
212
|
+
keepMounted,
|
|
213
|
+
id: idParam,
|
|
214
|
+
mounted,
|
|
215
|
+
onOpenChange,
|
|
216
|
+
open,
|
|
217
|
+
panelRef,
|
|
218
|
+
runOnceAnimationsFinish,
|
|
219
|
+
setDimensions,
|
|
220
|
+
setMounted,
|
|
221
|
+
setOpen,
|
|
222
|
+
setVisible,
|
|
223
|
+
transitionDimensionRef,
|
|
224
|
+
visible,
|
|
225
|
+
width
|
|
226
|
+
} = parameters;
|
|
227
|
+
const isBeforeMatchRef = React3.useRef(false);
|
|
228
|
+
const latestAnimationNameRef = React3.useRef(null);
|
|
229
|
+
const shouldCancelInitialOpenAnimationRef = React3.useRef(open);
|
|
230
|
+
const shouldCancelInitialOpenTransitionRef = React3.useRef(open);
|
|
231
|
+
const endingStyleFrame = useAnimationFrame();
|
|
232
|
+
const hidden = React3.useMemo(() => {
|
|
233
|
+
if (animationTypeRef.current === "css-animation") {
|
|
234
|
+
return !visible;
|
|
235
|
+
}
|
|
236
|
+
return !open && !mounted;
|
|
237
|
+
}, [open, mounted, visible, animationTypeRef]);
|
|
238
|
+
const handlePanelRef = useStableCallback((element) => {
|
|
239
|
+
if (!element) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (animationTypeRef.current == null || transitionDimensionRef.current == null) {
|
|
243
|
+
const panelStyles = getComputedStyle(element);
|
|
244
|
+
const hasAnimation = panelStyles.animationName !== "none" && panelStyles.animationName !== "";
|
|
245
|
+
const hasTransition = panelStyles.transitionDuration !== "0s" && panelStyles.transitionDuration !== "";
|
|
246
|
+
if (hasAnimation && hasTransition) {
|
|
247
|
+
if (true) {
|
|
248
|
+
warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used.");
|
|
249
|
+
}
|
|
250
|
+
} else if (panelStyles.animationName === "none" && panelStyles.transitionDuration !== "0s") {
|
|
251
|
+
animationTypeRef.current = "css-transition";
|
|
252
|
+
} else if (panelStyles.animationName !== "none" && panelStyles.transitionDuration === "0s") {
|
|
253
|
+
animationTypeRef.current = "css-animation";
|
|
254
|
+
} else {
|
|
255
|
+
animationTypeRef.current = "none";
|
|
256
|
+
}
|
|
257
|
+
if (element.getAttribute(AccordionRootDataAttributes.orientation) === "horizontal" || panelStyles.transitionProperty.indexOf("width") > -1) {
|
|
258
|
+
transitionDimensionRef.current = "width";
|
|
259
|
+
} else {
|
|
260
|
+
transitionDimensionRef.current = "height";
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (animationTypeRef.current !== "css-transition") {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (height === undefined || width === undefined) {
|
|
267
|
+
setDimensions({
|
|
268
|
+
height: element.scrollHeight,
|
|
269
|
+
width: element.scrollWidth
|
|
270
|
+
});
|
|
271
|
+
if (shouldCancelInitialOpenTransitionRef.current) {
|
|
272
|
+
element.style.setProperty("transition-duration", "0s");
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
let frame = -1;
|
|
276
|
+
let nextFrame = -1;
|
|
277
|
+
frame = AnimationFrame.request(() => {
|
|
278
|
+
shouldCancelInitialOpenTransitionRef.current = false;
|
|
279
|
+
nextFrame = AnimationFrame.request(() => {
|
|
280
|
+
setTimeout(() => {
|
|
281
|
+
element.style.removeProperty("transition-duration");
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
return () => {
|
|
286
|
+
AnimationFrame.cancel(frame);
|
|
287
|
+
AnimationFrame.cancel(nextFrame);
|
|
288
|
+
};
|
|
289
|
+
});
|
|
290
|
+
const mergedPanelRef = useMergedRefs(externalRef, panelRef, handlePanelRef);
|
|
291
|
+
useIsoLayoutEffect(() => {
|
|
292
|
+
if (animationTypeRef.current !== "css-transition") {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const panel = panelRef.current;
|
|
296
|
+
if (!panel) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
let resizeFrame = -1;
|
|
300
|
+
if (abortControllerRef.current != null) {
|
|
301
|
+
abortControllerRef.current.abort();
|
|
302
|
+
abortControllerRef.current = null;
|
|
303
|
+
}
|
|
304
|
+
if (open) {
|
|
305
|
+
const originalLayoutStyles = {
|
|
306
|
+
"justify-content": panel.style.justifyContent,
|
|
307
|
+
"align-items": panel.style.alignItems,
|
|
308
|
+
"align-content": panel.style.alignContent,
|
|
309
|
+
"justify-items": panel.style.justifyItems
|
|
310
|
+
};
|
|
311
|
+
Object.keys(originalLayoutStyles).forEach((key) => {
|
|
312
|
+
panel.style.setProperty(key, "initial", "important");
|
|
313
|
+
});
|
|
314
|
+
if (!shouldCancelInitialOpenTransitionRef.current && !keepMounted) {
|
|
315
|
+
panel.setAttribute(CollapsiblePanelDataAttributes.startingStyle, "");
|
|
316
|
+
}
|
|
317
|
+
setDimensions({
|
|
318
|
+
height: panel.scrollHeight,
|
|
319
|
+
width: panel.scrollWidth
|
|
320
|
+
});
|
|
321
|
+
resizeFrame = AnimationFrame.request(() => {
|
|
322
|
+
Object.entries(originalLayoutStyles).forEach(([key, value]) => {
|
|
323
|
+
if (value === "") {
|
|
324
|
+
panel.style.removeProperty(key);
|
|
325
|
+
} else {
|
|
326
|
+
panel.style.setProperty(key, value);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
} else {
|
|
331
|
+
if (panel.scrollHeight === 0 && panel.scrollWidth === 0) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
setDimensions({
|
|
335
|
+
height: panel.scrollHeight,
|
|
336
|
+
width: panel.scrollWidth
|
|
337
|
+
});
|
|
338
|
+
const abortController = new AbortController;
|
|
339
|
+
abortControllerRef.current = abortController;
|
|
340
|
+
const signal = abortController.signal;
|
|
341
|
+
let attributeObserver = null;
|
|
342
|
+
const endingStyleAttribute = CollapsiblePanelDataAttributes.endingStyle;
|
|
343
|
+
attributeObserver = new MutationObserver((mutationList) => {
|
|
344
|
+
const hasEndingStyle = mutationList.some((mutation) => mutation.type === "attributes" && mutation.attributeName === endingStyleAttribute);
|
|
345
|
+
if (hasEndingStyle) {
|
|
346
|
+
attributeObserver?.disconnect();
|
|
347
|
+
attributeObserver = null;
|
|
348
|
+
runOnceAnimationsFinish(() => {
|
|
349
|
+
setDimensions({
|
|
350
|
+
height: 0,
|
|
351
|
+
width: 0
|
|
352
|
+
});
|
|
353
|
+
panel.style.removeProperty("content-visibility");
|
|
354
|
+
setMounted(false);
|
|
355
|
+
if (abortControllerRef.current === abortController) {
|
|
356
|
+
abortControllerRef.current = null;
|
|
357
|
+
}
|
|
358
|
+
}, signal);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
attributeObserver.observe(panel, {
|
|
362
|
+
attributes: true,
|
|
363
|
+
attributeFilter: [endingStyleAttribute]
|
|
364
|
+
});
|
|
365
|
+
return () => {
|
|
366
|
+
attributeObserver?.disconnect();
|
|
367
|
+
endingStyleFrame.cancel();
|
|
368
|
+
if (abortControllerRef.current === abortController) {
|
|
369
|
+
abortController.abort();
|
|
370
|
+
abortControllerRef.current = null;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
return () => {
|
|
375
|
+
AnimationFrame.cancel(resizeFrame);
|
|
376
|
+
};
|
|
377
|
+
}, [abortControllerRef, animationTypeRef, endingStyleFrame, hiddenUntilFound, keepMounted, mounted, open, panelRef, runOnceAnimationsFinish, setDimensions, setMounted]);
|
|
378
|
+
useIsoLayoutEffect(() => {
|
|
379
|
+
if (animationTypeRef.current !== "css-animation") {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
const panel = panelRef.current;
|
|
383
|
+
if (!panel) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
latestAnimationNameRef.current = panel.style.animationName || latestAnimationNameRef.current;
|
|
387
|
+
panel.style.setProperty("animation-name", "none");
|
|
388
|
+
setDimensions({
|
|
389
|
+
height: panel.scrollHeight,
|
|
390
|
+
width: panel.scrollWidth
|
|
391
|
+
});
|
|
392
|
+
if (!shouldCancelInitialOpenAnimationRef.current && !isBeforeMatchRef.current) {
|
|
393
|
+
panel.style.removeProperty("animation-name");
|
|
394
|
+
}
|
|
395
|
+
if (open) {
|
|
396
|
+
if (abortControllerRef.current != null) {
|
|
397
|
+
abortControllerRef.current.abort();
|
|
398
|
+
abortControllerRef.current = null;
|
|
399
|
+
}
|
|
400
|
+
setMounted(true);
|
|
401
|
+
setVisible(true);
|
|
402
|
+
} else {
|
|
403
|
+
abortControllerRef.current = new AbortController;
|
|
404
|
+
runOnceAnimationsFinish(() => {
|
|
405
|
+
setMounted(false);
|
|
406
|
+
setVisible(false);
|
|
407
|
+
abortControllerRef.current = null;
|
|
408
|
+
}, abortControllerRef.current.signal);
|
|
409
|
+
}
|
|
410
|
+
}, [abortControllerRef, animationTypeRef, open, panelRef, runOnceAnimationsFinish, setDimensions, setMounted, setVisible, visible]);
|
|
411
|
+
useOnMount(() => {
|
|
412
|
+
const frame = AnimationFrame.request(() => {
|
|
413
|
+
shouldCancelInitialOpenAnimationRef.current = false;
|
|
414
|
+
});
|
|
415
|
+
return () => AnimationFrame.cancel(frame);
|
|
416
|
+
});
|
|
417
|
+
useIsoLayoutEffect(() => {
|
|
418
|
+
if (!hiddenUntilFound) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const panel = panelRef.current;
|
|
422
|
+
if (!panel) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
let frame = -1;
|
|
426
|
+
let nextFrame = -1;
|
|
427
|
+
if (open && isBeforeMatchRef.current) {
|
|
428
|
+
panel.style.transitionDuration = "0s";
|
|
429
|
+
setDimensions({
|
|
430
|
+
height: panel.scrollHeight,
|
|
431
|
+
width: panel.scrollWidth
|
|
432
|
+
});
|
|
433
|
+
frame = AnimationFrame.request(() => {
|
|
434
|
+
isBeforeMatchRef.current = false;
|
|
435
|
+
nextFrame = AnimationFrame.request(() => {
|
|
436
|
+
setTimeout(() => {
|
|
437
|
+
panel.style.removeProperty("transition-duration");
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
return () => {
|
|
443
|
+
AnimationFrame.cancel(frame);
|
|
444
|
+
AnimationFrame.cancel(nextFrame);
|
|
445
|
+
};
|
|
446
|
+
}, [hiddenUntilFound, open, panelRef, setDimensions]);
|
|
447
|
+
useIsoLayoutEffect(() => {
|
|
448
|
+
const panel = panelRef.current;
|
|
449
|
+
if (panel && hiddenUntilFound && hidden) {
|
|
450
|
+
panel.setAttribute("hidden", "until-found");
|
|
451
|
+
if (animationTypeRef.current === "css-transition") {
|
|
452
|
+
panel.setAttribute(CollapsiblePanelDataAttributes.startingStyle, "");
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}, [hiddenUntilFound, hidden, animationTypeRef, panelRef]);
|
|
456
|
+
React3.useEffect(function registerBeforeMatchListener() {
|
|
457
|
+
const panel = panelRef.current;
|
|
458
|
+
if (!panel) {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
function handleBeforeMatch(event) {
|
|
462
|
+
isBeforeMatchRef.current = true;
|
|
463
|
+
setOpen(true);
|
|
464
|
+
onOpenChange(true, createChangeEventDetails(exports_reason_parts.none, event));
|
|
465
|
+
}
|
|
466
|
+
return addEventListener(panel, "beforematch", handleBeforeMatch);
|
|
467
|
+
}, [onOpenChange, panelRef, setOpen]);
|
|
468
|
+
return React3.useMemo(() => ({
|
|
469
|
+
props: {
|
|
470
|
+
hidden,
|
|
471
|
+
id: idParam,
|
|
472
|
+
ref: mergedPanelRef
|
|
473
|
+
}
|
|
474
|
+
}), [hidden, idParam, mergedPanelRef]);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export { useCollapsibleRoot, CollapsibleRootContext, useCollapsibleRootContext, triggerOpenStateMapping, collapsibleOpenStateMapping, useCollapsiblePanel };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
"use client";
|
|
4
|
+
var DirectionContext = /* @__PURE__ */ React.createContext(undefined);
|
|
5
|
+
if (true)
|
|
6
|
+
DirectionContext.displayName = "DirectionContext";
|
|
7
|
+
function useDirection() {
|
|
8
|
+
const context = React.useContext(DirectionContext);
|
|
9
|
+
return context?.direction ?? "ltr";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { useDirection };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
round
|
|
3
|
+
} from "./_chunk-nya71ccw.js";
|
|
4
|
+
import {
|
|
5
|
+
getComputedStyle,
|
|
6
|
+
isHTMLElement
|
|
7
|
+
} from "./_chunk-sx6vkz01.js";
|
|
8
|
+
|
|
9
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/utils/getCssDimensions.js
|
|
10
|
+
function getCssDimensions(element) {
|
|
11
|
+
const css = getComputedStyle(element);
|
|
12
|
+
let width = parseFloat(css.width) || 0;
|
|
13
|
+
let height = parseFloat(css.height) || 0;
|
|
14
|
+
const hasOffset = isHTMLElement(element);
|
|
15
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
16
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
17
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
18
|
+
if (shouldFallback) {
|
|
19
|
+
width = offsetWidth;
|
|
20
|
+
height = offsetHeight;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
width,
|
|
24
|
+
height
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { getCssDimensions };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/serializeValue.js
|
|
2
|
+
function serializeValue(value) {
|
|
3
|
+
if (value == null) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
if (typeof value === "string") {
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
return JSON.stringify(value);
|
|
11
|
+
} catch {
|
|
12
|
+
return String(value);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { serializeValue };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/toolbar/root/ToolbarRootContext.js
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
"use client";
|
|
4
|
+
var ToolbarRootContext = /* @__PURE__ */ React.createContext(undefined);
|
|
5
|
+
if (true)
|
|
6
|
+
ToolbarRootContext.displayName = "ToolbarRootContext";
|
|
7
|
+
function useToolbarRootContext(optional) {
|
|
8
|
+
const context = React.useContext(ToolbarRootContext);
|
|
9
|
+
if (context === undefined && !optional) {
|
|
10
|
+
throw new Error("Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.");
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { useToolbarRootContext };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/csp-provider/CSPContext.js
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
"use client";
|
|
4
|
+
var CSPContext = /* @__PURE__ */ React.createContext(undefined);
|
|
5
|
+
if (true)
|
|
6
|
+
CSPContext.displayName = "CSPContext";
|
|
7
|
+
var DEFAULT_CSP_CONTEXT_VALUE = {
|
|
8
|
+
disableStyleElements: false
|
|
9
|
+
};
|
|
10
|
+
function useCSPContext() {
|
|
11
|
+
return React.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { useCSPContext };
|