@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
package/shadcn/lib/utils.js
CHANGED
package/shadcn/ui/accordion.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import { AlertDialog as AlertDialogPrimitive } from "
|
|
4
|
+
import { AlertDialog as AlertDialogPrimitive } from "../lib/base-ui/alert-dialog.js"
|
|
5
5
|
|
|
6
6
|
import { cn } from "../lib/utils.js"
|
|
7
7
|
import { Button } from "./button.jsx"
|
package/shadcn/ui/avatar.jsx
CHANGED
package/shadcn/ui/badge.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeProps } from "
|
|
2
|
-
import { useRender } from "
|
|
1
|
+
import { mergeProps } from "../lib/base-ui/merge-props.js"
|
|
2
|
+
import { useRender } from "../lib/base-ui/use-render.js"
|
|
3
3
|
import { cva } from "../lib/cva.js";
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils.js"
|
package/shadcn/ui/breadcrumb.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
|
-
import { mergeProps } from "
|
|
3
|
-
import { useRender } from "
|
|
2
|
+
import { mergeProps } from "../lib/base-ui/merge-props.js"
|
|
3
|
+
import { useRender } from "../lib/base-ui/use-render.js"
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils.js"
|
|
6
6
|
import { ChevronRightIcon, MoreHorizontalIcon } from "../../icons"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeProps } from "
|
|
2
|
-
import { useRender } from "
|
|
1
|
+
import { mergeProps } from "../lib/base-ui/merge-props.js"
|
|
2
|
+
import { useRender } from "../lib/base-ui/use-render.js"
|
|
3
3
|
import { cva } from "../lib/cva.js";
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils.js"
|
package/shadcn/ui/button.jsx
CHANGED
package/shadcn/ui/calendar.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
|
-
import { DayPicker, getDefaultClassNames } from "../../core/Calendar.jsx";
|
|
2
|
+
import { DayPicker, getDefaultClassNames } from "../../components/core/Calendar.jsx";
|
|
3
3
|
|
|
4
4
|
import { cn } from "../lib/utils.js"
|
|
5
5
|
import { Button, buttonVariants } from "./button.jsx"
|
package/shadcn/ui/checkbox.jsx
CHANGED
package/shadcn/ui/command.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import { ContextMenu as ContextMenuPrimitive } from "
|
|
4
|
+
import { ContextMenu as ContextMenuPrimitive } from "../lib/base-ui/context-menu.js"
|
|
5
5
|
|
|
6
6
|
import { cn } from "../lib/utils.js"
|
|
7
7
|
import { ChevronRightIcon, CheckIcon } from "../../icons"
|
package/shadcn/ui/dialog.jsx
CHANGED
package/shadcn/ui/drawer.jsx
CHANGED
|
@@ -1,119 +1,221 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
|
-
import {
|
|
2
|
+
import { Dialog as DialogPrimitive } from "../lib/base-ui/dialog.js"
|
|
3
3
|
|
|
4
4
|
import { cn } from "../lib/utils.js"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
// Drag thresholds and animation timing ported from vaul (MIT — Emil Kowalski).
|
|
7
|
+
// https://github.com/emilkowalski/vaul/blob/main/src/constants.ts
|
|
8
|
+
const VELOCITY_THRESHOLD = 0.4
|
|
9
|
+
const CLOSE_THRESHOLD = 0.25
|
|
10
|
+
const TRANSITION = "transform 500ms cubic-bezier(0.32, 0.72, 0, 1)"
|
|
11
|
+
|
|
12
|
+
function dampenValue(v) {
|
|
13
|
+
return 8 * (Math.log(v + 1) - 2)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Ported from vaul/src/index.tsx `shouldDrag`. Skips drag when the pointer is
|
|
17
|
+
// inside a scrollable child that isn't at scrollTop=0 (lets content scroll
|
|
18
|
+
// naturally), on a <select>, on a [data-no-drag] subtree, or when text is
|
|
19
|
+
// highlighted.
|
|
20
|
+
function shouldDrag(el, popup) {
|
|
21
|
+
let element = el
|
|
22
|
+
if (window.getSelection()?.toString()) return false
|
|
23
|
+
while (element && element !== popup) {
|
|
24
|
+
if (element.tagName === "SELECT") return false
|
|
25
|
+
if (element.hasAttribute?.("data-no-drag") || element.closest?.("[data-no-drag]")) return false
|
|
26
|
+
if (element.scrollHeight > element.clientHeight && element.scrollTop !== 0) return false
|
|
27
|
+
element = element.parentNode
|
|
28
|
+
}
|
|
29
|
+
return true
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const DrawerCtx = React.createContext(null)
|
|
33
|
+
|
|
34
|
+
function Drawer({ open, defaultOpen, onOpenChange, ...props }) {
|
|
35
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? false)
|
|
36
|
+
const isControlled = open !== undefined
|
|
37
|
+
const actualOpen = isControlled ? open : internalOpen
|
|
38
|
+
const handleOpenChange = React.useCallback(
|
|
39
|
+
(next) => {
|
|
40
|
+
if (!isControlled) setInternalOpen(next)
|
|
41
|
+
onOpenChange?.(next)
|
|
42
|
+
},
|
|
43
|
+
[isControlled, onOpenChange]
|
|
44
|
+
)
|
|
45
|
+
return (
|
|
46
|
+
<DrawerCtx.Provider value={{ onOpenChange: handleOpenChange }}>
|
|
47
|
+
<DialogPrimitive.Root
|
|
48
|
+
data-slot="drawer"
|
|
49
|
+
open={actualOpen}
|
|
50
|
+
onOpenChange={handleOpenChange}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
</DrawerCtx.Provider>
|
|
54
|
+
)
|
|
10
55
|
}
|
|
11
56
|
|
|
12
|
-
function DrawerTrigger({
|
|
13
|
-
...props
|
|
14
|
-
}) {
|
|
15
|
-
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
|
|
57
|
+
function DrawerTrigger(props) {
|
|
58
|
+
return <DialogPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
16
59
|
}
|
|
17
60
|
|
|
18
|
-
function DrawerPortal({
|
|
19
|
-
...props
|
|
20
|
-
}) {
|
|
21
|
-
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />;
|
|
61
|
+
function DrawerPortal(props) {
|
|
62
|
+
return <DialogPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
22
63
|
}
|
|
23
64
|
|
|
24
|
-
function DrawerClose({
|
|
25
|
-
...props
|
|
26
|
-
}) {
|
|
27
|
-
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
|
|
65
|
+
function DrawerClose(props) {
|
|
66
|
+
return <DialogPrimitive.Close data-slot="drawer-close" {...props} />
|
|
28
67
|
}
|
|
29
68
|
|
|
30
|
-
function DrawerOverlay({
|
|
31
|
-
className,
|
|
32
|
-
...props
|
|
33
|
-
}) {
|
|
69
|
+
function DrawerOverlay({ className, ...props }) {
|
|
34
70
|
return (
|
|
35
|
-
<
|
|
71
|
+
<DialogPrimitive.Backdrop
|
|
36
72
|
data-slot="drawer-overlay"
|
|
37
|
-
className={cn(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{...props} />
|
|
42
|
-
);
|
|
73
|
+
className={cn("drawer-backdrop fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs", className)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
43
77
|
}
|
|
44
78
|
|
|
45
|
-
function DrawerContent({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
79
|
+
function DrawerContent({ className, children, ...props }) {
|
|
80
|
+
const popupRef = React.useRef(null)
|
|
81
|
+
const ctx = React.useContext(DrawerCtx)
|
|
82
|
+
const dragState = React.useRef({ dragging: false, startY: 0, height: 0, startTime: 0 })
|
|
83
|
+
|
|
84
|
+
const snapBack = React.useCallback(() => {
|
|
85
|
+
const el = popupRef.current
|
|
86
|
+
if (!el) return
|
|
87
|
+
el.style.transition = ""
|
|
88
|
+
el.style.transform = ""
|
|
89
|
+
}, [])
|
|
90
|
+
|
|
91
|
+
const dismiss = React.useCallback(() => {
|
|
92
|
+
const el = popupRef.current
|
|
93
|
+
if (!el) {
|
|
94
|
+
ctx?.onOpenChange(false)
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
el.style.transition = TRANSITION
|
|
98
|
+
el.style.transform = "translate3d(0, 100%, 0)"
|
|
99
|
+
window.setTimeout(() => {
|
|
100
|
+
ctx?.onOpenChange(false)
|
|
101
|
+
}, 500)
|
|
102
|
+
}, [ctx])
|
|
103
|
+
|
|
104
|
+
const handlePointerDown = React.useCallback((event) => {
|
|
105
|
+
const el = popupRef.current
|
|
106
|
+
if (!el || !shouldDrag(event.target, el)) return
|
|
107
|
+
event.target.setPointerCapture?.(event.pointerId)
|
|
108
|
+
dragState.current = {
|
|
109
|
+
dragging: true,
|
|
110
|
+
startY: event.clientY,
|
|
111
|
+
height: el.getBoundingClientRect().height || 0,
|
|
112
|
+
startTime: event.timeStamp,
|
|
113
|
+
}
|
|
114
|
+
el.style.transition = "none"
|
|
115
|
+
}, [])
|
|
116
|
+
|
|
117
|
+
const handlePointerMove = React.useCallback((event) => {
|
|
118
|
+
const state = dragState.current
|
|
119
|
+
if (!state.dragging) return
|
|
120
|
+
const el = popupRef.current
|
|
121
|
+
if (!el) return
|
|
122
|
+
const delta = event.clientY - state.startY
|
|
123
|
+
if (delta >= 0) {
|
|
124
|
+
// Dragging down toward close — direct translate
|
|
125
|
+
el.style.transform = `translate3d(0, ${delta}px, 0)`
|
|
126
|
+
} else {
|
|
127
|
+
// Dragging up away from close — logarithmic rubber-band damping (vaul-style)
|
|
128
|
+
const damped = -dampenValue(-delta)
|
|
129
|
+
el.style.transform = `translate3d(0, ${damped}px, 0)`
|
|
130
|
+
}
|
|
131
|
+
}, [])
|
|
132
|
+
|
|
133
|
+
const handlePointerUp = React.useCallback(
|
|
134
|
+
(event) => {
|
|
135
|
+
const state = dragState.current
|
|
136
|
+
if (!state.dragging) return
|
|
137
|
+
state.dragging = false
|
|
138
|
+
const delta = event.clientY - state.startY
|
|
139
|
+
const elapsed = Math.max(1, event.timeStamp - state.startTime)
|
|
140
|
+
const velocity = Math.abs(delta) / elapsed
|
|
141
|
+
|
|
142
|
+
if (delta < 0) {
|
|
143
|
+
snapBack()
|
|
144
|
+
return
|
|
145
|
+
}
|
|
146
|
+
if (velocity > VELOCITY_THRESHOLD || delta >= state.height * CLOSE_THRESHOLD) {
|
|
147
|
+
dismiss()
|
|
148
|
+
} else {
|
|
149
|
+
snapBack()
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
[dismiss, snapBack]
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
const handlePointerCancel = React.useCallback(() => {
|
|
156
|
+
if (!dragState.current.dragging) return
|
|
157
|
+
dragState.current.dragging = false
|
|
158
|
+
snapBack()
|
|
159
|
+
}, [snapBack])
|
|
160
|
+
|
|
50
161
|
return (
|
|
51
|
-
<DrawerPortal
|
|
162
|
+
<DrawerPortal>
|
|
52
163
|
<DrawerOverlay />
|
|
53
|
-
<
|
|
164
|
+
<DialogPrimitive.Popup
|
|
165
|
+
ref={popupRef}
|
|
54
166
|
data-slot="drawer-content"
|
|
55
|
-
className={cn(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
167
|
+
className={cn("drawer-popup bg-background text-sm", className)}
|
|
168
|
+
onPointerDown={handlePointerDown}
|
|
169
|
+
onPointerMove={handlePointerMove}
|
|
170
|
+
onPointerUp={handlePointerUp}
|
|
171
|
+
onPointerCancel={handlePointerCancel}
|
|
172
|
+
{...props}
|
|
173
|
+
>
|
|
174
|
+
<div className="bg-muted mx-auto mt-4 h-1.5 w-[100px] shrink-0 rounded-full" />
|
|
62
175
|
{children}
|
|
63
|
-
</
|
|
176
|
+
</DialogPrimitive.Popup>
|
|
64
177
|
</DrawerPortal>
|
|
65
|
-
)
|
|
178
|
+
)
|
|
66
179
|
}
|
|
67
180
|
|
|
68
|
-
function DrawerHeader({
|
|
69
|
-
className,
|
|
70
|
-
...props
|
|
71
|
-
}) {
|
|
181
|
+
function DrawerHeader({ className, ...props }) {
|
|
72
182
|
return (
|
|
73
183
|
<div
|
|
74
184
|
data-slot="drawer-header"
|
|
75
|
-
className={cn(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{...props} />
|
|
80
|
-
);
|
|
185
|
+
className={cn("gap-0.5 p-4 text-center md:gap-1.5 md:text-left flex flex-col", className)}
|
|
186
|
+
{...props}
|
|
187
|
+
/>
|
|
188
|
+
)
|
|
81
189
|
}
|
|
82
190
|
|
|
83
|
-
function DrawerFooter({
|
|
84
|
-
className,
|
|
85
|
-
...props
|
|
86
|
-
}) {
|
|
191
|
+
function DrawerFooter({ className, ...props }) {
|
|
87
192
|
return (
|
|
88
193
|
<div
|
|
89
194
|
data-slot="drawer-footer"
|
|
90
195
|
className={cn("gap-2 p-4 mt-auto flex flex-col", className)}
|
|
91
|
-
{...props}
|
|
92
|
-
|
|
196
|
+
{...props}
|
|
197
|
+
/>
|
|
198
|
+
)
|
|
93
199
|
}
|
|
94
200
|
|
|
95
|
-
function DrawerTitle({
|
|
96
|
-
className,
|
|
97
|
-
...props
|
|
98
|
-
}) {
|
|
201
|
+
function DrawerTitle({ className, ...props }) {
|
|
99
202
|
return (
|
|
100
|
-
<
|
|
203
|
+
<DialogPrimitive.Title
|
|
101
204
|
data-slot="drawer-title"
|
|
102
205
|
className={cn("text-foreground font-medium", className)}
|
|
103
|
-
{...props}
|
|
104
|
-
|
|
206
|
+
{...props}
|
|
207
|
+
/>
|
|
208
|
+
)
|
|
105
209
|
}
|
|
106
210
|
|
|
107
|
-
function DrawerDescription({
|
|
108
|
-
className,
|
|
109
|
-
...props
|
|
110
|
-
}) {
|
|
211
|
+
function DrawerDescription({ className, ...props }) {
|
|
111
212
|
return (
|
|
112
|
-
<
|
|
213
|
+
<DialogPrimitive.Description
|
|
113
214
|
data-slot="drawer-description"
|
|
114
215
|
className={cn("text-muted-foreground text-sm", className)}
|
|
115
|
-
{...props}
|
|
116
|
-
|
|
216
|
+
{...props}
|
|
217
|
+
/>
|
|
218
|
+
)
|
|
117
219
|
}
|
|
118
220
|
|
|
119
221
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import { Menu as MenuPrimitive } from "
|
|
4
|
+
import { Menu as MenuPrimitive } from "../lib/base-ui/menu.js"
|
|
5
5
|
|
|
6
6
|
import { cn } from "../lib/utils.js"
|
|
7
7
|
import { ChevronRightIcon, CheckIcon } from "../../icons"
|
package/shadcn/ui/hover-card.jsx
CHANGED
package/shadcn/ui/input.jsx
CHANGED
package/shadcn/ui/item.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
|
-
import { mergeProps } from "
|
|
3
|
-
import { useRender } from "
|
|
2
|
+
import { mergeProps } from "../lib/base-ui/merge-props.js"
|
|
3
|
+
import { useRender } from "../lib/base-ui/use-render.js"
|
|
4
4
|
import { cva } from "../lib/cva.js";
|
|
5
5
|
|
|
6
6
|
import { cn } from "../lib/utils.js"
|
package/shadcn/ui/menubar.jsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import { Menu as MenuPrimitive } from "
|
|
5
|
-
import { Menubar as MenubarPrimitive } from "
|
|
4
|
+
import { Menu as MenuPrimitive } from "../lib/base-ui/menu.js"
|
|
5
|
+
import { Menubar as MenubarPrimitive } from "../lib/base-ui/menubar.js"
|
|
6
6
|
|
|
7
7
|
import { cn } from "../lib/utils.js"
|
|
8
8
|
import {
|
package/shadcn/ui/popover.jsx
CHANGED
package/shadcn/ui/progress.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import { Radio as RadioPrimitive } from "
|
|
4
|
-
import { RadioGroup as RadioGroupPrimitive } from "
|
|
3
|
+
import { Radio as RadioPrimitive } from "../lib/base-ui/radio.js"
|
|
4
|
+
import { RadioGroup as RadioGroupPrimitive } from "../lib/base-ui/radio-group.js"
|
|
5
5
|
|
|
6
6
|
import { cn } from "../lib/utils.js"
|
|
7
7
|
import { CircleIcon } from "../../icons"
|
package/shadcn/ui/select.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
|
-
import { Select as SelectPrimitive } from "
|
|
2
|
+
import { Select as SelectPrimitive } from "../lib/base-ui/select.js"
|
|
3
3
|
|
|
4
4
|
import { cn } from "../lib/utils.js"
|
|
5
5
|
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "../../icons"
|
package/shadcn/ui/separator.jsx
CHANGED
package/shadcn/ui/sheet.jsx
CHANGED
package/shadcn/ui/sidebar.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react"
|
|
3
|
-
import { mergeProps } from "
|
|
4
|
-
import { useRender } from "
|
|
3
|
+
import { mergeProps } from "../lib/base-ui/merge-props.js"
|
|
4
|
+
import { useRender } from "../lib/base-ui/use-render.js"
|
|
5
5
|
import { cva } from "../lib/cva.js";
|
|
6
6
|
|
|
7
7
|
import { cn } from "../lib/utils.js"
|
|
@@ -454,7 +454,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
454
454
|
variants: {
|
|
455
455
|
variant: {
|
|
456
456
|
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
457
|
-
outline: "bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[
|
|
457
|
+
outline: "bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_var(--sidebar-border)] hover:shadow-[0_0_0_1px_var(--sidebar-accent)]",
|
|
458
458
|
},
|
|
459
459
|
size: {
|
|
460
460
|
default: "h-10 text-base",
|
package/shadcn/ui/slider.jsx
CHANGED
package/shadcn/ui/switch.jsx
CHANGED
package/shadcn/ui/tabs.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
|
-
import { Toggle as TogglePrimitive } from "
|
|
3
|
-
import { ToggleGroup as ToggleGroupPrimitive } from "
|
|
2
|
+
import { Toggle as TogglePrimitive } from "../lib/base-ui/toggle.js"
|
|
3
|
+
import { ToggleGroup as ToggleGroupPrimitive } from "../lib/base-ui/toggle-group.js"
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils.js"
|
|
6
6
|
import { toggleVariants } from "./toggle.jsx"
|
package/shadcn/ui/toggle.jsx
CHANGED
package/shadcn/ui/tooltip.jsx
CHANGED
package/styles.css
CHANGED
|
@@ -87,6 +87,37 @@
|
|
|
87
87
|
.slide-out-to-right-10 { --tw-exit-translate-x: 2.5rem; }
|
|
88
88
|
.slide-out-to-right-52 { --tw-exit-translate-x: 13rem; }
|
|
89
89
|
|
|
90
|
+
/* Drawer (bottom sheet) — base-ui Dialog shell + ported vaul drag math.
|
|
91
|
+
Entrance/exit keyed off base-ui's data-starting-style / data-ending-style. */
|
|
92
|
+
.drawer-popup {
|
|
93
|
+
position: fixed;
|
|
94
|
+
inset-inline: 0;
|
|
95
|
+
bottom: 0;
|
|
96
|
+
z-index: 50;
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
max-height: 80vh;
|
|
100
|
+
border-top: 1px solid var(--border);
|
|
101
|
+
border-top-left-radius: 0.75rem;
|
|
102
|
+
border-top-right-radius: 0.75rem;
|
|
103
|
+
outline: none;
|
|
104
|
+
transform: translate3d(0, 0, 0);
|
|
105
|
+
transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
|
|
106
|
+
touch-action: none;
|
|
107
|
+
}
|
|
108
|
+
.drawer-popup[data-starting-style],
|
|
109
|
+
.drawer-popup[data-ending-style] {
|
|
110
|
+
transform: translate3d(0, 100%, 0);
|
|
111
|
+
}
|
|
112
|
+
.drawer-backdrop {
|
|
113
|
+
opacity: 1;
|
|
114
|
+
transition: opacity 250ms cubic-bezier(0.32, 0.72, 0, 1);
|
|
115
|
+
}
|
|
116
|
+
.drawer-backdrop[data-starting-style],
|
|
117
|
+
.drawer-backdrop[data-ending-style] {
|
|
118
|
+
opacity: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
90
121
|
@custom-variant dark (&:is(.dark *));
|
|
91
122
|
|
|
92
123
|
@theme {
|