@zentauri-ui/zentauri-components 1.2.0 → 1.3.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/README.md +66 -38
- package/dist/accordion-base-qVomr7f_.d.mts +66 -0
- package/dist/accordion-base-qVomr7f_.d.ts +66 -0
- package/dist/avatar-base-s4dYg-24.d.mts +49 -0
- package/dist/avatar-base-s4dYg-24.d.ts +49 -0
- package/dist/card-base-CIGac8D_.d.mts +70 -0
- package/dist/card-base-CIGac8D_.d.ts +70 -0
- package/dist/chunk-2P3UU2J3.mjs +510 -0
- package/dist/chunk-2P3UU2J3.mjs.map +1 -0
- package/dist/chunk-2PQEXQVR.js +223 -0
- package/dist/chunk-2PQEXQVR.js.map +1 -0
- package/dist/chunk-3OR47XMY.js +273 -0
- package/dist/chunk-3OR47XMY.js.map +1 -0
- package/dist/chunk-4B7KGBQB.js +206 -0
- package/dist/chunk-4B7KGBQB.js.map +1 -0
- package/dist/chunk-5QB2KNZQ.js +148 -0
- package/dist/chunk-5QB2KNZQ.js.map +1 -0
- package/dist/chunk-6I7X5BF2.js +520 -0
- package/dist/chunk-6I7X5BF2.js.map +1 -0
- package/dist/chunk-7HL3A4YF.mjs +214 -0
- package/dist/chunk-7HL3A4YF.mjs.map +1 -0
- package/dist/chunk-AOEI4V3W.mjs +286 -0
- package/dist/chunk-AOEI4V3W.mjs.map +1 -0
- package/dist/chunk-BVXTOEBI.mjs +259 -0
- package/dist/chunk-BVXTOEBI.mjs.map +1 -0
- package/dist/chunk-C2FCPQTO.js +279 -0
- package/dist/chunk-C2FCPQTO.js.map +1 -0
- package/dist/chunk-E3DZNJAD.js +128 -0
- package/dist/chunk-E3DZNJAD.js.map +1 -0
- package/dist/chunk-FLILFCQE.mjs +197 -0
- package/dist/chunk-FLILFCQE.mjs.map +1 -0
- package/dist/chunk-IXDJ3IPG.mjs +315 -0
- package/dist/chunk-IXDJ3IPG.mjs.map +1 -0
- package/dist/chunk-JQ5TIJ4F.mjs +68 -0
- package/dist/chunk-JQ5TIJ4F.mjs.map +1 -0
- package/dist/chunk-LVUPECBT.mjs +217 -0
- package/dist/chunk-LVUPECBT.mjs.map +1 -0
- package/dist/chunk-N4NO3SYL.js +328 -0
- package/dist/chunk-N4NO3SYL.js.map +1 -0
- package/dist/chunk-OJ67PZ6N.js +175 -0
- package/dist/chunk-OJ67PZ6N.js.map +1 -0
- package/dist/chunk-P5HUBXUX.js +231 -0
- package/dist/chunk-P5HUBXUX.js.map +1 -0
- package/dist/chunk-PCK6LX3K.js +253 -0
- package/dist/chunk-PCK6LX3K.js.map +1 -0
- package/dist/chunk-PGH27VTL.mjs +316 -0
- package/dist/chunk-PGH27VTL.mjs.map +1 -0
- package/dist/chunk-QZKMFSH5.js +288 -0
- package/dist/chunk-QZKMFSH5.js.map +1 -0
- package/dist/chunk-RDSPHBHK.mjs +221 -0
- package/dist/chunk-RDSPHBHK.mjs.map +1 -0
- package/dist/chunk-U4YQCAXW.js +204 -0
- package/dist/chunk-U4YQCAXW.js.map +1 -0
- package/dist/chunk-UBFKTC2P.mjs +268 -0
- package/dist/chunk-UBFKTC2P.mjs.map +1 -0
- package/dist/chunk-UOFTZKMM.js +229 -0
- package/dist/chunk-UOFTZKMM.js.map +1 -0
- package/dist/chunk-UXGHUBNJ.mjs +240 -0
- package/dist/chunk-UXGHUBNJ.mjs.map +1 -0
- package/dist/chunk-W6PRMYUC.mjs +169 -0
- package/dist/chunk-W6PRMYUC.mjs.map +1 -0
- package/dist/chunk-WDCIZHXY.mjs +139 -0
- package/dist/chunk-WDCIZHXY.mjs.map +1 -0
- package/dist/chunk-WZKGRU3U.js +182 -0
- package/dist/chunk-WZKGRU3U.js.map +1 -0
- package/dist/chunk-X22LLJL6.js +71 -0
- package/dist/chunk-X22LLJL6.js.map +1 -0
- package/dist/chunk-XIXF7UVM.mjs +194 -0
- package/dist/chunk-XIXF7UVM.mjs.map +1 -0
- package/dist/chunk-XLAFQ24R.js +328 -0
- package/dist/chunk-XLAFQ24R.js.map +1 -0
- package/dist/chunk-XWM2S6VV.mjs +124 -0
- package/dist/chunk-XWM2S6VV.mjs.map +1 -0
- package/dist/chunk-YNCD6TKE.mjs +175 -0
- package/dist/chunk-YNCD6TKE.mjs.map +1 -0
- package/dist/progress-base-Cm1JODYA.d.mts +66 -0
- package/dist/progress-base-Cm1JODYA.d.ts +66 -0
- package/dist/types-C7N9UvRm.d.mts +38 -0
- package/dist/types-C7N9UvRm.d.ts +38 -0
- package/dist/types-CFpwSbpK.d.mts +27 -0
- package/dist/types-CFpwSbpK.d.ts +27 -0
- package/dist/types-CK_vNRIb.d.mts +63 -0
- package/dist/types-CK_vNRIb.d.ts +63 -0
- package/dist/types-Ca3t5aC_.d.mts +31 -0
- package/dist/types-Ca3t5aC_.d.ts +31 -0
- package/dist/types-Cn7IcgkH.d.mts +32 -0
- package/dist/types-Cn7IcgkH.d.ts +32 -0
- package/dist/types-CtFK7mFE.d.mts +34 -0
- package/dist/types-CtFK7mFE.d.ts +34 -0
- package/dist/types-DMkTQsWg.d.mts +46 -0
- package/dist/types-DMkTQsWg.d.ts +46 -0
- package/dist/types-DN400jNg.d.mts +28 -0
- package/dist/types-DN400jNg.d.ts +28 -0
- package/dist/types-vcZcRc6w.d.mts +24 -0
- package/dist/types-vcZcRc6w.d.ts +24 -0
- package/dist/types-zHcMUtKK.d.mts +42 -0
- package/dist/types-zHcMUtKK.d.ts +42 -0
- package/dist/ui/accordion/animated.d.mts +24 -0
- package/dist/ui/accordion/animated.d.ts +24 -0
- package/dist/ui/accordion/animated.js +67 -0
- package/dist/ui/accordion/animated.js.map +1 -0
- package/dist/ui/accordion/animated.mjs +56 -0
- package/dist/ui/accordion/animated.mjs.map +1 -0
- package/dist/ui/accordion.d.mts +9 -65
- package/dist/ui/accordion.d.ts +9 -65
- package/dist/ui/accordion.js +32 -288
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/accordion.mjs +6 -281
- package/dist/ui/accordion.mjs.map +1 -1
- package/dist/ui/alert/animated.d.mts +18 -0
- package/dist/ui/alert/animated.d.ts +18 -0
- package/dist/ui/alert/animated.js +47 -0
- package/dist/ui/alert/animated.js.map +1 -0
- package/dist/ui/alert/animated.mjs +44 -0
- package/dist/ui/alert/animated.mjs.map +1 -0
- package/dist/ui/alert.d.mts +10 -40
- package/dist/ui/alert.d.ts +10 -40
- package/dist/ui/alert.js +36 -218
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/alert.mjs +7 -211
- package/dist/ui/alert.mjs.map +1 -1
- package/dist/ui/avatar/animated.d.mts +22 -0
- package/dist/ui/avatar/animated.d.ts +22 -0
- package/dist/ui/avatar/animated.js +51 -0
- package/dist/ui/avatar/animated.js.map +1 -0
- package/dist/ui/avatar/animated.mjs +37 -0
- package/dist/ui/avatar/animated.mjs.map +1 -0
- package/dist/ui/avatar.d.mts +7 -53
- package/dist/ui/avatar.d.ts +7 -53
- package/dist/ui/avatar.js +32 -210
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/avatar.mjs +7 -204
- package/dist/ui/avatar.mjs.map +1 -1
- package/dist/ui/badge/animated.d.mts +22 -0
- package/dist/ui/badge/animated.d.ts +22 -0
- package/dist/ui/badge/animated.js +50 -0
- package/dist/ui/badge/animated.js.map +1 -0
- package/dist/ui/badge/animated.mjs +47 -0
- package/dist/ui/badge/animated.mjs.map +1 -0
- package/dist/ui/badge.d.mts +6 -30
- package/dist/ui/badge.d.ts +6 -30
- package/dist/ui/badge.js +11 -142
- package/dist/ui/badge.js.map +1 -1
- package/dist/ui/badge.mjs +6 -141
- package/dist/ui/badge.mjs.map +1 -1
- package/dist/ui/buttons/animated.d.mts +27 -0
- package/dist/ui/buttons/animated.d.ts +27 -0
- package/dist/ui/buttons/animated.js +101 -0
- package/dist/ui/buttons/animated.js.map +1 -0
- package/dist/ui/buttons/animated.mjs +98 -0
- package/dist/ui/buttons/animated.mjs.map +1 -0
- package/dist/ui/buttons.d.mts +5 -13
- package/dist/ui/buttons.d.ts +5 -13
- package/dist/ui/buttons.js +7 -45
- package/dist/ui/buttons.js.map +1 -1
- package/dist/ui/buttons.mjs +8 -45
- package/dist/ui/buttons.mjs.map +1 -1
- package/dist/ui/card/animated.d.mts +23 -0
- package/dist/ui/card/animated.d.ts +23 -0
- package/dist/ui/card/animated.js +72 -0
- package/dist/ui/card/animated.js.map +1 -0
- package/dist/ui/card/animated.mjs +50 -0
- package/dist/ui/card/animated.mjs.map +1 -0
- package/dist/ui/card.d.mts +6 -70
- package/dist/ui/card.d.ts +6 -70
- package/dist/ui/card.js +43 -245
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/card.mjs +5 -235
- package/dist/ui/card.mjs.map +1 -1
- package/dist/ui/divider/animated.d.mts +19 -0
- package/dist/ui/divider/animated.d.ts +19 -0
- package/dist/ui/divider/animated.js +41 -0
- package/dist/ui/divider/animated.js.map +1 -0
- package/dist/ui/divider/animated.mjs +39 -0
- package/dist/ui/divider/animated.mjs.map +1 -0
- package/dist/ui/divider.d.mts +6 -32
- package/dist/ui/divider.d.ts +6 -32
- package/dist/ui/divider.js +19 -186
- package/dist/ui/divider.js.map +1 -1
- package/dist/ui/divider.mjs +6 -183
- package/dist/ui/divider.mjs.map +1 -1
- package/dist/ui/drawer/animated.d.mts +23 -0
- package/dist/ui/drawer/animated.d.ts +23 -0
- package/dist/ui/drawer/animated.js +143 -0
- package/dist/ui/drawer/animated.js.map +1 -0
- package/dist/ui/drawer/animated.mjs +113 -0
- package/dist/ui/drawer/animated.mjs.map +1 -0
- package/dist/ui/drawer.d.mts +10 -11
- package/dist/ui/drawer.d.ts +10 -11
- package/dist/ui/drawer.js +44 -357
- package/dist/ui/drawer.js.map +1 -1
- package/dist/ui/drawer.mjs +3 -349
- package/dist/ui/drawer.mjs.map +1 -1
- package/dist/ui/empty-state/animated.d.mts +24 -0
- package/dist/ui/empty-state/animated.d.ts +24 -0
- package/dist/ui/empty-state/animated.js +45 -0
- package/dist/ui/empty-state/animated.js.map +1 -0
- package/dist/ui/empty-state/animated.mjs +42 -0
- package/dist/ui/empty-state/animated.mjs.map +1 -0
- package/dist/ui/empty-state.d.mts +11 -32
- package/dist/ui/empty-state.d.ts +11 -32
- package/dist/ui/empty-state.js +35 -160
- package/dist/ui/empty-state.js.map +1 -1
- package/dist/ui/empty-state.mjs +5 -153
- package/dist/ui/empty-state.mjs.map +1 -1
- package/dist/ui/inputs/animated.d.mts +27 -0
- package/dist/ui/inputs/animated.d.ts +27 -0
- package/dist/ui/inputs/animated.js +141 -0
- package/dist/ui/inputs/animated.js.map +1 -0
- package/dist/ui/inputs/animated.mjs +138 -0
- package/dist/ui/inputs/animated.mjs.map +1 -0
- package/dist/ui/inputs.d.mts +7 -21
- package/dist/ui/inputs.d.ts +7 -21
- package/dist/ui/inputs.js +16 -331
- package/dist/ui/inputs.js.map +1 -1
- package/dist/ui/inputs.mjs +13 -329
- package/dist/ui/inputs.mjs.map +1 -1
- package/dist/ui/modal/animated.d.mts +21 -0
- package/dist/ui/modal/animated.d.ts +21 -0
- package/dist/ui/modal/animated.js +120 -0
- package/dist/ui/modal/animated.js.map +1 -0
- package/dist/ui/modal/animated.mjs +117 -0
- package/dist/ui/modal/animated.mjs.map +1 -0
- package/dist/ui/modal.d.mts +10 -48
- package/dist/ui/modal.d.ts +10 -48
- package/dist/ui/modal.js +47 -361
- package/dist/ui/modal.js.map +1 -1
- package/dist/ui/modal.mjs +9 -351
- package/dist/ui/modal.mjs.map +1 -1
- package/dist/ui/progress/animated.d.mts +41 -0
- package/dist/ui/progress/animated.d.ts +41 -0
- package/dist/ui/progress/animated.js +123 -0
- package/dist/ui/progress/animated.js.map +1 -0
- package/dist/ui/progress/animated.mjs +112 -0
- package/dist/ui/progress/animated.mjs.map +1 -0
- package/dist/ui/progress.d.mts +10 -58
- package/dist/ui/progress.d.ts +10 -58
- package/dist/ui/progress.js +35 -227
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/progress.mjs +10 -222
- package/dist/ui/progress.mjs.map +1 -1
- package/dist/ui/skeleton/animated.d.mts +56 -0
- package/dist/ui/skeleton/animated.d.ts +56 -0
- package/dist/ui/skeleton/animated.js +126 -0
- package/dist/ui/skeleton/animated.js.map +1 -0
- package/dist/ui/skeleton/animated.mjs +119 -0
- package/dist/ui/skeleton/animated.mjs.map +1 -0
- package/dist/ui/skeleton.d.mts +16 -77
- package/dist/ui/skeleton.d.ts +16 -77
- package/dist/ui/skeleton.js +35 -526
- package/dist/ui/skeleton.js.map +1 -1
- package/dist/ui/skeleton.mjs +2 -520
- package/dist/ui/skeleton.mjs.map +1 -1
- package/dist/ui/{spinner.d.mts → spinner/animated.d.mts} +1 -6
- package/dist/ui/{spinner.d.ts → spinner/animated.d.ts} +1 -6
- package/dist/ui/{spinner.js → spinner/animated.js} +3 -9
- package/dist/ui/spinner/animated.js.map +1 -0
- package/dist/ui/{spinner.mjs → spinner/animated.mjs} +4 -9
- package/dist/ui/spinner/animated.mjs.map +1 -0
- package/dist/ui/table/animated.d.mts +21 -0
- package/dist/ui/table/animated.d.ts +21 -0
- package/dist/ui/table/animated.js +50 -0
- package/dist/ui/table/animated.js.map +1 -0
- package/dist/ui/table/animated.mjs +24 -0
- package/dist/ui/table/animated.mjs.map +1 -0
- package/dist/ui/table.d.mts +17 -11
- package/dist/ui/table.d.ts +17 -11
- package/dist/ui/table.js +55 -278
- package/dist/ui/table.js.map +1 -1
- package/dist/ui/table.mjs +2 -269
- package/dist/ui/table.mjs.map +1 -1
- package/dist/ui/tabs/animated.d.mts +25 -0
- package/dist/ui/tabs/animated.d.ts +25 -0
- package/dist/ui/tabs/animated.js +83 -0
- package/dist/ui/tabs/animated.js.map +1 -0
- package/dist/ui/tabs/animated.mjs +79 -0
- package/dist/ui/tabs/animated.mjs.map +1 -0
- package/dist/ui/tabs.d.mts +7 -41
- package/dist/ui/tabs.d.ts +7 -41
- package/dist/ui/tabs.js +35 -261
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/tabs.mjs +2 -256
- package/dist/ui/tabs.mjs.map +1 -1
- package/dist/ui/toast/animated.d.mts +23 -0
- package/dist/ui/toast/animated.d.ts +23 -0
- package/dist/ui/toast/animated.js +103 -0
- package/dist/ui/toast/animated.js.map +1 -0
- package/dist/ui/toast/animated.mjs +99 -0
- package/dist/ui/toast/animated.mjs.map +1 -0
- package/dist/ui/toast.d.mts +7 -52
- package/dist/ui/toast.d.ts +7 -52
- package/dist/ui/toast.js +47 -268
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/toast.mjs +2 -259
- package/dist/ui/toast.mjs.map +1 -1
- package/dist/ui/toggle/animated.d.mts +22 -0
- package/dist/ui/toggle/animated.d.ts +22 -0
- package/dist/ui/toggle/animated.js +88 -0
- package/dist/ui/toggle/animated.js.map +1 -0
- package/dist/ui/toggle/animated.mjs +85 -0
- package/dist/ui/toggle/animated.mjs.map +1 -0
- package/dist/ui/toggle.d.mts +6 -30
- package/dist/ui/toggle.d.ts +6 -30
- package/dist/ui/toggle.js +19 -83
- package/dist/ui/toggle.js.map +1 -1
- package/dist/ui/toggle.mjs +12 -80
- package/dist/ui/toggle.mjs.map +1 -1
- package/dist/ui/tooltip/animated.d.mts +17 -0
- package/dist/ui/tooltip/animated.d.ts +17 -0
- package/dist/ui/tooltip/animated.js +59 -0
- package/dist/ui/tooltip/animated.js.map +1 -0
- package/dist/ui/tooltip/animated.mjs +56 -0
- package/dist/ui/tooltip/animated.mjs.map +1 -0
- package/dist/ui/tooltip.d.mts +6 -33
- package/dist/ui/tooltip.d.ts +6 -33
- package/dist/ui/tooltip.js +26 -193
- package/dist/ui/tooltip.js.map +1 -1
- package/dist/ui/tooltip.mjs +2 -192
- package/dist/ui/tooltip.mjs.map +1 -1
- package/dist/variants-CYODHI8b.d.mts +10 -0
- package/dist/variants-CYODHI8b.d.ts +10 -0
- package/package.json +7 -4
- package/dist/ui/spinner.js.map +0 -1
- package/dist/ui/spinner.mjs.map +0 -1
package/dist/ui/divider.mjs
CHANGED
|
@@ -1,191 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import { jsx
|
|
2
|
+
import { DividerBase } from '../chunk-W6PRMYUC.mjs';
|
|
3
|
+
export { dividerLabelVariants, dividerLineVariants, dividerToneVariants, dividerVariants } from '../chunk-W6PRMYUC.mjs';
|
|
4
|
+
import '../chunk-DFEZH7TC.mjs';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
-
// src/ui/divider/animations.ts
|
|
8
|
-
var dividerAnimationPresets = {
|
|
9
|
-
none: {},
|
|
10
|
-
expand: {
|
|
11
|
-
initial: { scaleX: 0.6, opacity: 0.4 },
|
|
12
|
-
animate: { scaleX: 1, opacity: 1 },
|
|
13
|
-
transition: { duration: 0.35, ease: "easeOut" }
|
|
14
|
-
},
|
|
15
|
-
fade: {
|
|
16
|
-
initial: { opacity: 0 },
|
|
17
|
-
animate: { opacity: 1 },
|
|
18
|
-
transition: { duration: 0.25 }
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var APPEARANCES = {
|
|
22
|
-
default: "text-slate-200",
|
|
23
|
-
muted: "text-slate-500",
|
|
24
|
-
primary: "text-cyan-300",
|
|
25
|
-
destructive: "text-rose-400",
|
|
26
|
-
ghost: "text-slate-600",
|
|
27
|
-
sky: "text-sky-400",
|
|
28
|
-
rose: "text-rose-400",
|
|
29
|
-
purple: "text-purple-400",
|
|
30
|
-
pink: "text-pink-400",
|
|
31
|
-
orange: "text-orange-400",
|
|
32
|
-
yellow: "text-yellow-400",
|
|
33
|
-
teal: "text-teal-400",
|
|
34
|
-
indigo: "text-indigo-400",
|
|
35
|
-
emerald: "text-emerald-400",
|
|
36
|
-
gray: "text-gray-400",
|
|
37
|
-
amber: "text-amber-400",
|
|
38
|
-
violet: "text-violet-400",
|
|
39
|
-
"gradient-blue": "text-blue-400",
|
|
40
|
-
"gradient-green": "text-green-400",
|
|
41
|
-
"gradient-red": "text-red-400",
|
|
42
|
-
"gradient-yellow": "text-yellow-400",
|
|
43
|
-
"gradient-purple": "text-purple-400",
|
|
44
|
-
"gradient-teal": "text-teal-400",
|
|
45
|
-
"gradient-indigo": "text-indigo-400",
|
|
46
|
-
"gradient-pink": "text-pink-400",
|
|
47
|
-
"gradient-orange": "text-orange-400"
|
|
48
|
-
};
|
|
49
|
-
var dividerToneVariants = cva("", {
|
|
50
|
-
variants: {
|
|
51
|
-
appearance: APPEARANCES
|
|
52
|
-
},
|
|
53
|
-
defaultVariants: { appearance: "default" }
|
|
54
|
-
});
|
|
55
|
-
var dividerVariants = cva("flex w-full items-center gap-3", {
|
|
56
|
-
variants: {
|
|
57
|
-
appearance: APPEARANCES,
|
|
58
|
-
orientation: {
|
|
59
|
-
horizontal: "w-full flex-row",
|
|
60
|
-
vertical: "h-full min-h-[2rem] w-auto flex-col self-stretch"
|
|
61
|
-
},
|
|
62
|
-
size: {
|
|
63
|
-
sm: "",
|
|
64
|
-
md: "",
|
|
65
|
-
lg: ""
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
compoundVariants: [
|
|
69
|
-
{ orientation: "horizontal", size: "sm", class: "min-h-px" },
|
|
70
|
-
{ orientation: "horizontal", size: "md", class: "min-h-[2px]" },
|
|
71
|
-
{ orientation: "horizontal", size: "lg", class: "min-h-[3px]" },
|
|
72
|
-
{ orientation: "vertical", size: "sm", class: "min-w-px" },
|
|
73
|
-
{ orientation: "vertical", size: "md", class: "min-w-[2px]" },
|
|
74
|
-
{ orientation: "vertical", size: "lg", class: "min-w-[3px]" }
|
|
75
|
-
],
|
|
76
|
-
defaultVariants: {
|
|
77
|
-
appearance: "default",
|
|
78
|
-
orientation: "horizontal",
|
|
79
|
-
size: "md"
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
var dividerLineVariants = cva(
|
|
83
|
-
"shrink grow rounded-full bg-current opacity-80",
|
|
84
|
-
{
|
|
85
|
-
variants: {
|
|
86
|
-
orientation: {
|
|
87
|
-
horizontal: "h-px",
|
|
88
|
-
vertical: "w-px flex-1"
|
|
89
|
-
},
|
|
90
|
-
size: {
|
|
91
|
-
sm: "",
|
|
92
|
-
md: "",
|
|
93
|
-
lg: ""
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
compoundVariants: [
|
|
97
|
-
{ orientation: "horizontal", size: "sm", class: "h-px" },
|
|
98
|
-
{ orientation: "horizontal", size: "md", class: "h-0.5" },
|
|
99
|
-
{ orientation: "horizontal", size: "lg", class: "h-1" },
|
|
100
|
-
{ orientation: "vertical", size: "sm", class: "w-px" },
|
|
101
|
-
{ orientation: "vertical", size: "md", class: "w-0.5" },
|
|
102
|
-
{ orientation: "vertical", size: "lg", class: "w-1" }
|
|
103
|
-
],
|
|
104
|
-
defaultVariants: {
|
|
105
|
-
orientation: "horizontal",
|
|
106
|
-
size: "md"
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
var dividerLabelVariants = cva(
|
|
111
|
-
"shrink-0 text-xs font-medium uppercase tracking-wide text-current"
|
|
112
|
-
);
|
|
113
7
|
function Divider(props) {
|
|
114
|
-
|
|
115
|
-
className,
|
|
116
|
-
appearance,
|
|
117
|
-
orientation,
|
|
118
|
-
size,
|
|
119
|
-
animation = "none",
|
|
120
|
-
label,
|
|
121
|
-
children,
|
|
122
|
-
ref,
|
|
123
|
-
...rest
|
|
124
|
-
} = props;
|
|
125
|
-
const motionProps = dividerAnimationPresets[animation];
|
|
126
|
-
const slot = label ?? children;
|
|
127
|
-
if (!slot) {
|
|
128
|
-
return /* @__PURE__ */ jsx(
|
|
129
|
-
motion.div,
|
|
130
|
-
{
|
|
131
|
-
ref,
|
|
132
|
-
"data-slot": "divider",
|
|
133
|
-
role: "separator",
|
|
134
|
-
"aria-orientation": orientation === "vertical" ? "vertical" : "horizontal",
|
|
135
|
-
className: cn(
|
|
136
|
-
dividerToneVariants({ appearance }),
|
|
137
|
-
orientation === "horizontal" ? "flex w-full min-h-px flex-row items-stretch" : "flex h-full min-h-8 w-auto min-w-0 flex-col items-stretch self-stretch",
|
|
138
|
-
className
|
|
139
|
-
),
|
|
140
|
-
initial: animation === "none" ? false : void 0,
|
|
141
|
-
...motionProps,
|
|
142
|
-
...rest,
|
|
143
|
-
children: /* @__PURE__ */ jsx(
|
|
144
|
-
"span",
|
|
145
|
-
{
|
|
146
|
-
className: cn(dividerLineVariants({ orientation, size })),
|
|
147
|
-
"aria-hidden": true
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
return /* @__PURE__ */ jsxs(
|
|
154
|
-
motion.div,
|
|
155
|
-
{
|
|
156
|
-
ref,
|
|
157
|
-
"data-slot": "divider",
|
|
158
|
-
role: "separator",
|
|
159
|
-
"aria-orientation": orientation === "vertical" ? "vertical" : "horizontal",
|
|
160
|
-
className: cn(
|
|
161
|
-
dividerVariants({ appearance, orientation, size }),
|
|
162
|
-
className
|
|
163
|
-
),
|
|
164
|
-
initial: animation === "none" ? false : void 0,
|
|
165
|
-
...motionProps,
|
|
166
|
-
...rest,
|
|
167
|
-
children: [
|
|
168
|
-
/* @__PURE__ */ jsx(
|
|
169
|
-
"span",
|
|
170
|
-
{
|
|
171
|
-
className: cn(dividerLineVariants({ orientation, size })),
|
|
172
|
-
"aria-hidden": true
|
|
173
|
-
}
|
|
174
|
-
),
|
|
175
|
-
/* @__PURE__ */ jsx("span", { "data-slot": "divider-label", className: dividerLabelVariants(), children: slot }),
|
|
176
|
-
/* @__PURE__ */ jsx(
|
|
177
|
-
"span",
|
|
178
|
-
{
|
|
179
|
-
className: cn(dividerLineVariants({ orientation, size })),
|
|
180
|
-
"aria-hidden": true
|
|
181
|
-
}
|
|
182
|
-
)
|
|
183
|
-
]
|
|
184
|
-
}
|
|
185
|
-
);
|
|
8
|
+
return /* @__PURE__ */ jsx(DividerBase, { ...props });
|
|
186
9
|
}
|
|
187
10
|
Divider.displayName = "Divider";
|
|
188
11
|
|
|
189
|
-
export { Divider
|
|
12
|
+
export { Divider };
|
|
190
13
|
//# sourceMappingURL=divider.mjs.map
|
|
191
14
|
//# sourceMappingURL=divider.mjs.map
|
package/dist/ui/divider.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/divider/animations.ts","../../src/ui/divider/variants.ts","../../src/ui/divider/divider.tsx"],"names":[],"mappings":";;;;;;AAcO,IAAM,uBAAA,GAAmD;AAAA,EAC9D,MAAM,EAAC;AAAA,EACP,MAAA,EAAQ;AAAA,IACN,OAAA,EAAS,EAAE,MAAA,EAAQ,GAAA,EAAK,SAAS,GAAA,EAAI;AAAA,IACrC,OAAA,EAAS,EAAE,MAAA,EAAQ,CAAA,EAAG,SAAS,CAAA,EAAE;AAAA,IACjC,UAAA,EAAY,EAAE,QAAA,EAAU,IAAA,EAAM,MAAM,SAAA;AAAU,GAChD;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,OAAA,EAAS,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,IACtB,OAAA,EAAS,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,IACtB,UAAA,EAAY,EAAE,QAAA,EAAU,IAAA;AAAK;AAEjC;ACxBA,IAAM,WAAA,GAAc;AAAA,EAClB,OAAA,EAAS,gBAAA;AAAA,EACT,KAAA,EAAO,gBAAA;AAAA,EACP,OAAA,EAAS,eAAA;AAAA,EACT,WAAA,EAAa,eAAA;AAAA,EACb,KAAA,EAAO,gBAAA;AAAA,EACP,GAAA,EAAK,cAAA;AAAA,EACL,IAAA,EAAM,eAAA;AAAA,EACN,MAAA,EAAQ,iBAAA;AAAA,EACR,IAAA,EAAM,eAAA;AAAA,EACN,MAAA,EAAQ,iBAAA;AAAA,EACR,MAAA,EAAQ,iBAAA;AAAA,EACR,IAAA,EAAM,eAAA;AAAA,EACN,MAAA,EAAQ,iBAAA;AAAA,EACR,OAAA,EAAS,kBAAA;AAAA,EACT,IAA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ACL,kBAAA,EAAkB,WAAA,KAAgB,UAAA,GAAa,UAAA,GAAa,YAAA;AAAA,MAC5D,SAAA,EAAW,EAAA;AAAA,QACT,eAAA,CAAgB,EAAE,UAAA,EAAY,WAAA,EAAa,MAAM,CAAA;AAAA,QACjD;AAAA,OACF;AAAA,MACA,OAAA,EAAS,SAAA,KAAc,MAAA,GAAS,KAAA,GAAQ,MAAA;AAAA,MACvC,GAAG,WAAA;AAAA,MACH,GAAG,IAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,WAAW,EAAA,CAAG,mBAAA,CAAoB,EAAE,WAAA,EAAa,IAAA,EAAM,CAAC,CAAA;AAAA,YACxD,aAAA,EAAW;AAAA;AAAA,SACb;AAAA,4BACC,MAAA,EAAA,EAAK,WAAA,EAAU,iBAAgB,SAAA,EAAW,oBAAA,IACxC,QAAA,EAAA,IAAA,EACH,CAAA;AAAA,wBACA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,WAAW,EAAA,CAAG,mBAAA,CAAoB,EAAE,WAAA,EAAa,IAAA,EAAM,CAAC,CAAA;AAAA,YACxD,aAAA,EAAW;AAAA;AAAA;AACb;AAAA;AAAA,GACF;AAEJ;AAEA,OAAA,CAAQ,WAAA,GAAc,SAAA","file":"divider.mjs","sourcesContent":["import type { HTMLMotionProps } from \"framer-motion\";\n\nimport type { DividerAnimation } from \"./types\";\n\ntype DividerPresetMotionProps = Pick<\n HTMLMotionProps<\"div\">,\n \"initial\" | \"animate\" | \"transition\" | \"whileHover\"\n>;\n\nexport type DividerAnimationPresets = Record<\n DividerAnimation,\n DividerPresetMotionProps\n>;\n\nexport const dividerAnimationPresets: DividerAnimationPresets = {\n none: {},\n expand: {\n initial: { scaleX: 0.6, opacity: 0.4 },\n animate: { scaleX: 1, opacity: 1 },\n transition: { duration: 0.35, ease: \"easeOut\" },\n },\n fade: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n transition: { duration: 0.25 },\n },\n};\n","import { cva } from \"class-variance-authority\";\n\nconst APPEARANCES = {\n default: \"text-slate-200\",\n muted: \"text-slate-500\",\n primary: \"text-cyan-300\",\n destructive: \"text-rose-400\",\n ghost: \"text-slate-600\",\n sky: \"text-sky-400\",\n rose: \"text-rose-400\",\n purple: \"text-purple-400\",\n pink: \"text-pink-400\",\n orange: \"text-orange-400\",\n yellow: \"text-yellow-400\",\n teal: \"text-teal-400\",\n indigo: \"text-indigo-400\",\n emerald: \"text-emerald-400\",\n gray: \"text-gray-400\",\n amber: \"text-amber-400\",\n violet: \"text-violet-400\",\n \"gradient-blue\": \"text-blue-400\",\n \"gradient-green\": \"text-green-400\",\n \"gradient-red\": \"text-red-400\",\n \"gradient-yellow\": \"text-yellow-400\",\n \"gradient-purple\": \"text-purple-400\",\n \"gradient-teal\": \"text-teal-400\",\n \"gradient-indigo\": \"text-indigo-400\",\n \"gradient-pink\": \"text-pink-400\",\n \"gradient-orange\": \"text-orange-400\",\n};\n\nexport const dividerToneVariants = cva(\"\", {\n variants: {\n appearance: APPEARANCES,\n },\n defaultVariants: { appearance: \"default\" },\n});\n\nexport const dividerVariants = cva(\"flex w-full items-center gap-3\", {\n variants: {\n appearance: APPEARANCES,\n orientation: {\n horizontal: \"w-full flex-row\",\n vertical: \"h-full min-h-[2rem] w-auto flex-col self-stretch\",\n },\n size: {\n sm: \"\",\n md: \"\",\n lg: \"\",\n },\n },\n compoundVariants: [\n { orientation: \"horizontal\", size: \"sm\", class: \"min-h-px\" },\n { orientation: \"horizontal\", size: \"md\", class: \"min-h-[2px]\" },\n { orientation: \"horizontal\", size: \"lg\", class: \"min-h-[3px]\" },\n { orientation: \"vertical\", size: \"sm\", class: \"min-w-px\" },\n { orientation: \"vertical\", size: \"md\", class: \"min-w-[2px]\" },\n { orientation: \"vertical\", size: \"lg\", class: \"min-w-[3px]\" },\n ],\n defaultVariants: {\n appearance: \"default\",\n orientation: \"horizontal\",\n size: \"md\",\n },\n});\n\nexport const dividerLineVariants = cva(\n \"shrink grow rounded-full bg-current opacity-80\",\n {\n variants: {\n orientation: {\n horizontal: \"h-px\",\n vertical: \"w-px flex-1\",\n },\n size: {\n sm: \"\",\n md: \"\",\n lg: \"\",\n },\n },\n compoundVariants: [\n { orientation: \"horizontal\", size: \"sm\", class: \"h-px\" },\n { orientation: \"horizontal\", size: \"md\", class: \"h-0.5\" },\n { orientation: \"horizontal\", size: \"lg\", class: \"h-1\" },\n { orientation: \"vertical\", size: \"sm\", class: \"w-px\" },\n { orientation: \"vertical\", size: \"md\", class: \"w-0.5\" },\n { orientation: \"vertical\", size: \"lg\", class: \"w-1\" },\n ],\n defaultVariants: {\n orientation: \"horizontal\",\n size: \"md\",\n },\n },\n);\n\nexport const dividerLabelVariants = cva(\n \"shrink-0 text-xs font-medium uppercase tracking-wide text-current\",\n);\n","\"use client\";\n\nimport { motion } from \"framer-motion\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport { dividerAnimationPresets } from \"./animations\";\nimport type { DividerProps } from \"./types\";\nimport {\n dividerLabelVariants,\n dividerLineVariants,\n dividerToneVariants,\n dividerVariants,\n} from \"./variants\";\n\nexport function Divider(props: DividerProps) {\n const {\n className,\n appearance,\n orientation,\n size,\n animation = \"none\",\n label,\n children,\n ref,\n ...rest\n } = props;\n const motionProps = dividerAnimationPresets[animation];\n const slot = label ?? children;\n\n if (!slot) {\n return (\n <motion.div\n ref={ref}\n data-slot=\"divider\"\n role=\"separator\"\n aria-orientation={\n orientation === \"vertical\" ? \"vertical\" : \"horizontal\"\n }\n className={cn(\n dividerToneVariants({ appearance }),\n orientation === \"horizontal\"\n ? \"flex w-full min-h-px flex-row items-stretch\"\n : \"flex h-full min-h-8 w-auto min-w-0 flex-col items-stretch self-stretch\",\n className,\n )}\n initial={animation === \"none\" ? false : undefined}\n {...motionProps}\n {...rest}\n >\n <span\n className={cn(dividerLineVariants({ orientation, size }))}\n aria-hidden\n />\n </motion.div>\n );\n }\n\n return (\n <motion.div\n ref={ref}\n data-slot=\"divider\"\n role=\"separator\"\n aria-orientation={orientation === \"vertical\" ? \"vertical\" : \"horizontal\"}\n className={cn(\n dividerVariants({ appearance, orientation, size }),\n className,\n )}\n initial={animation === \"none\" ? false : undefined}\n {...motionProps}\n {...rest}\n >\n <span\n className={cn(dividerLineVariants({ orientation, size }))}\n aria-hidden\n />\n <span data-slot=\"divider-label\" className={dividerLabelVariants()}>\n {slot}\n </span>\n <span\n className={cn(dividerLineVariants({ orientation, size }))}\n aria-hidden\n />\n </motion.div>\n );\n}\n\nDivider.displayName = \"Divider\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/ui/divider/divider.tsx"],"names":[],"mappings":";;;;;AAIO,SAAS,QAAQ,KAAA,EAAqB;AAC3C,EAAA,uBAAO,GAAA,CAAC,WAAA,EAAA,EAAa,GAAG,KAAA,EAAO,CAAA;AACjC;AAEA,OAAA,CAAQ,WAAA,GAAc,SAAA","file":"divider.mjs","sourcesContent":["// divider.tsx — default static entry (no framer-motion)\nimport { DividerBase } from \"./divider-base\";\nimport type { DividerProps } from \"./types\";\n\nexport function Divider(props: DividerProps) {\n return <DividerBase {...props} />;\n}\n\nDivider.displayName = \"Divider\";\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DrawerContentProps } from '../drawer.mjs';
|
|
2
|
+
export { Drawer, DrawerBody, DrawerClose, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from '../drawer.mjs';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { HTMLMotionProps } from 'framer-motion';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
import 'class-variance-authority/types';
|
|
8
|
+
|
|
9
|
+
type DrawerContentAnimatedProps = DrawerContentProps & {
|
|
10
|
+
animation?: DrawerAnimation;
|
|
11
|
+
};
|
|
12
|
+
type DrawerAnimation = "none" | "fade" | "scale" | "slide";
|
|
13
|
+
type DrawerPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "exit" | "transition">;
|
|
14
|
+
type DrawerAnimationPresets = Record<DrawerAnimation, DrawerPresetMotionProps>;
|
|
15
|
+
|
|
16
|
+
declare function DrawerContentAnimated({ className, side, size, appearance, animation, children, ref, id, style, }: DrawerContentAnimatedProps): react.ReactPortal | null;
|
|
17
|
+
declare namespace DrawerContentAnimated {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare const drawerPanelPresets: (side: "left" | "right" | "top" | "bottom") => DrawerAnimationPresets;
|
|
22
|
+
|
|
23
|
+
export { type DrawerAnimation, type DrawerAnimationPresets, DrawerContentAnimated, type DrawerContentAnimatedProps, type DrawerPresetMotionProps, drawerPanelPresets };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DrawerContentProps } from '../drawer.js';
|
|
2
|
+
export { Drawer, DrawerBody, DrawerClose, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from '../drawer.js';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { HTMLMotionProps } from 'framer-motion';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
import 'class-variance-authority/types';
|
|
8
|
+
|
|
9
|
+
type DrawerContentAnimatedProps = DrawerContentProps & {
|
|
10
|
+
animation?: DrawerAnimation;
|
|
11
|
+
};
|
|
12
|
+
type DrawerAnimation = "none" | "fade" | "scale" | "slide";
|
|
13
|
+
type DrawerPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "exit" | "transition">;
|
|
14
|
+
type DrawerAnimationPresets = Record<DrawerAnimation, DrawerPresetMotionProps>;
|
|
15
|
+
|
|
16
|
+
declare function DrawerContentAnimated({ className, side, size, appearance, animation, children, ref, id, style, }: DrawerContentAnimatedProps): react.ReactPortal | null;
|
|
17
|
+
declare namespace DrawerContentAnimated {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare const drawerPanelPresets: (side: "left" | "right" | "top" | "bottom") => DrawerAnimationPresets;
|
|
22
|
+
|
|
23
|
+
export { type DrawerAnimation, type DrawerAnimationPresets, DrawerContentAnimated, type DrawerContentAnimatedProps, type DrawerPresetMotionProps, drawerPanelPresets };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkN4NO3SYL_js = require('../../chunk-N4NO3SYL.js');
|
|
5
|
+
var chunkYPLVTUYL_js = require('../../chunk-YPLVTUYL.js');
|
|
6
|
+
require('../../chunk-UIYFEP3I.js');
|
|
7
|
+
var chunkUOZYPWDZ_js = require('../../chunk-UOZYPWDZ.js');
|
|
8
|
+
var framerMotion = require('framer-motion');
|
|
9
|
+
var reactDom = require('react-dom');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
|
|
12
|
+
// src/ui/drawer/animated/animations.ts
|
|
13
|
+
var drawerPanelPresets = (side) => ({
|
|
14
|
+
none: {},
|
|
15
|
+
fade: {
|
|
16
|
+
initial: { opacity: 0 },
|
|
17
|
+
animate: { opacity: 1 },
|
|
18
|
+
exit: { opacity: 0 },
|
|
19
|
+
transition: { duration: 0.2 }
|
|
20
|
+
},
|
|
21
|
+
scale: {
|
|
22
|
+
initial: { opacity: 0, scale: 0.98 },
|
|
23
|
+
animate: { opacity: 1, scale: 1 },
|
|
24
|
+
exit: { opacity: 0, scale: 0.98 },
|
|
25
|
+
transition: { type: "spring", stiffness: 420, damping: 32 }
|
|
26
|
+
},
|
|
27
|
+
slide: {
|
|
28
|
+
initial: side === "left" ? { x: -24, opacity: 0 } : side === "right" ? { x: 24, opacity: 0 } : side === "top" ? { y: -24, opacity: 0 } : { y: 24, opacity: 0 },
|
|
29
|
+
animate: { x: 0, y: 0, opacity: 1 },
|
|
30
|
+
exit: side === "left" ? { x: -16, opacity: 0 } : side === "right" ? { x: 16, opacity: 0 } : side === "top" ? { y: -16, opacity: 0 } : { y: 16, opacity: 0 },
|
|
31
|
+
transition: { type: "spring", stiffness: 380, damping: 30 }
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
function DrawerContentAnimated({
|
|
35
|
+
className,
|
|
36
|
+
side = "right",
|
|
37
|
+
size,
|
|
38
|
+
appearance,
|
|
39
|
+
animation = "slide",
|
|
40
|
+
children,
|
|
41
|
+
ref,
|
|
42
|
+
id,
|
|
43
|
+
style
|
|
44
|
+
}) {
|
|
45
|
+
const { open, setOpen, titleId, descriptionId, contentRef } = chunkN4NO3SYL_js.useDrawerContext("DrawerContent");
|
|
46
|
+
const resolvedSide = side ?? "right";
|
|
47
|
+
const reduceMotion = framerMotion.useReducedMotion();
|
|
48
|
+
const overlayMotion = drawerPanelPresets(resolvedSide)[reduceMotion ? "fade" : animation];
|
|
49
|
+
const panelMotion = drawerPanelPresets(resolvedSide)[reduceMotion ? "fade" : animation];
|
|
50
|
+
chunkYPLVTUYL_js.useFocusManagement({
|
|
51
|
+
open,
|
|
52
|
+
setOpen,
|
|
53
|
+
contentRef
|
|
54
|
+
});
|
|
55
|
+
const portalTarget = typeof document !== "undefined" ? document.body : null;
|
|
56
|
+
if (!portalTarget) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return reactDom.createPortal(
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: open ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-50", "data-slot": "drawer-portal", children: [
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
+
framerMotion.motion.button,
|
|
63
|
+
{
|
|
64
|
+
type: "button",
|
|
65
|
+
"aria-hidden": true,
|
|
66
|
+
tabIndex: -1,
|
|
67
|
+
"data-slot": "drawer-overlay",
|
|
68
|
+
className: chunkN4NO3SYL_js.drawerOverlayVariants(),
|
|
69
|
+
onClick: () => setOpen(false),
|
|
70
|
+
initial: animation === "none" ? false : overlayMotion.initial,
|
|
71
|
+
animate: animation === "none" ? void 0 : overlayMotion.animate,
|
|
72
|
+
exit: animation === "none" ? void 0 : overlayMotion.exit,
|
|
73
|
+
transition: overlayMotion.transition
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
framerMotion.motion.div,
|
|
78
|
+
{
|
|
79
|
+
ref: (node) => {
|
|
80
|
+
contentRef.current = node;
|
|
81
|
+
if (typeof ref === "function") {
|
|
82
|
+
ref(node);
|
|
83
|
+
} else if (ref) {
|
|
84
|
+
ref.current = node;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
role: "dialog",
|
|
88
|
+
"aria-modal": "true",
|
|
89
|
+
"aria-labelledby": titleId,
|
|
90
|
+
"aria-describedby": descriptionId,
|
|
91
|
+
"data-slot": "drawer-content",
|
|
92
|
+
tabIndex: -1,
|
|
93
|
+
className: chunkUOZYPWDZ_js.cn(
|
|
94
|
+
chunkN4NO3SYL_js.drawerContentVariants({ side: resolvedSide, size, appearance }),
|
|
95
|
+
className
|
|
96
|
+
),
|
|
97
|
+
initial: animation === "none" ? false : panelMotion.initial,
|
|
98
|
+
animate: animation === "none" ? void 0 : panelMotion.animate,
|
|
99
|
+
exit: animation === "none" ? void 0 : panelMotion.exit,
|
|
100
|
+
transition: panelMotion.transition,
|
|
101
|
+
id,
|
|
102
|
+
style,
|
|
103
|
+
children
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] }) : null }),
|
|
107
|
+
portalTarget
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
DrawerContentAnimated.displayName = "DrawerContent";
|
|
111
|
+
|
|
112
|
+
Object.defineProperty(exports, "Drawer", {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function () { return chunkN4NO3SYL_js.Drawer; }
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "DrawerBody", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () { return chunkN4NO3SYL_js.DrawerBody; }
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "DrawerClose", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () { return chunkN4NO3SYL_js.DrawerClose; }
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(exports, "DrawerFooter", {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function () { return chunkN4NO3SYL_js.DrawerFooter; }
|
|
127
|
+
});
|
|
128
|
+
Object.defineProperty(exports, "DrawerHeader", {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
get: function () { return chunkN4NO3SYL_js.DrawerHeader; }
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "DrawerTitle", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () { return chunkN4NO3SYL_js.DrawerTitle; }
|
|
135
|
+
});
|
|
136
|
+
Object.defineProperty(exports, "DrawerTrigger", {
|
|
137
|
+
enumerable: true,
|
|
138
|
+
get: function () { return chunkN4NO3SYL_js.DrawerTrigger; }
|
|
139
|
+
});
|
|
140
|
+
exports.DrawerContentAnimated = DrawerContentAnimated;
|
|
141
|
+
exports.drawerPanelPresets = drawerPanelPresets;
|
|
142
|
+
//# sourceMappingURL=animated.js.map
|
|
143
|
+
//# sourceMappingURL=animated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/drawer/animated/animations.ts","../../../src/ui/drawer/animated/drawer-content-animated.tsx"],"names":["useDrawerContext","useReducedMotion","useFocusManagement","createPortal","jsx","AnimatePresence","jsxs","motion","drawerOverlayVariants","cn","drawerContentVariants"],"mappings":";;;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,CAChC,IAAA,MAC4B;AAAA,EAC5B,MAAM,EAAC;AAAA,EACP,IAAA,EAAM;AAAA,IACJ,OAAA,EAAS,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,I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AAc,MAAA,GAAS,MAAA,GAAY,WAAA,CAAY,IAAA;AAAA,UACrD,YAAY,WAAA,CAAY,UAAA;AAAA,UACxB,EAAA;AAAA,UACA,KAAA;AAAA,UAEC;AAAA;AAAA;AACH,KAAA,EACF,IACE,IAAA,EACN,CAAA;AAAA,IACA;AAAA,GACF;AACF;AAEA,qBAAA,CAAsB,WAAA,GAAc,eAAA","file":"animated.js","sourcesContent":["import { DrawerAnimationPresets } from \"./types\";\n\nexport const drawerPanelPresets = (\n side: \"left\" | \"right\" | \"top\" | \"bottom\",\n): DrawerAnimationPresets => ({\n none: {},\n fade: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n transition: { duration: 0.2 },\n },\n scale: {\n initial: { opacity: 0, scale: 0.98 },\n animate: { opacity: 1, scale: 1 },\n exit: { opacity: 0, scale: 0.98 },\n transition: { type: \"spring\", stiffness: 420, damping: 32 },\n },\n slide: {\n initial:\n side === \"left\"\n ? { x: -24, opacity: 0 }\n : side === \"right\"\n ? { x: 24, opacity: 0 }\n : side === \"top\"\n ? { y: -24, opacity: 0 }\n : { y: 24, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit:\n side === \"left\"\n ? { x: -16, opacity: 0 }\n : side === \"right\"\n ? { x: 16, opacity: 0 }\n : side === \"top\"\n ? { y: -16, opacity: 0 }\n : { y: 16, opacity: 0 },\n transition: { type: \"spring\", stiffness: 380, damping: 30 },\n },\n});\n","\"use client\";\n\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport type { MutableRefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { useFocusManagement } from \"../../../hooks/useFocusManagement\";\n\nimport { drawerPanelPresets } from \"./animations\";\nimport { useDrawerContext } from \"../drawer-base\";\nimport {\n drawerContentVariants,\n drawerOverlayVariants,\n} from \"../variants\";\nimport type { DrawerContentAnimatedProps } from \"./types\";\n\nexport function DrawerContentAnimated({\n className,\n side = \"right\",\n size,\n appearance,\n animation = \"slide\",\n children,\n ref,\n id,\n style,\n}: DrawerContentAnimatedProps) {\n const { open, setOpen, titleId, descriptionId, contentRef } =\n useDrawerContext(\"DrawerContent\");\n const resolvedSide = side ?? \"right\";\n const reduceMotion = useReducedMotion();\n const overlayMotion =\n drawerPanelPresets(resolvedSide)[reduceMotion ? \"fade\" : animation];\n const panelMotion =\n drawerPanelPresets(resolvedSide)[reduceMotion ? \"fade\" : animation];\n\n useFocusManagement({\n open,\n setOpen,\n contentRef,\n });\n\n const portalTarget = typeof document !== \"undefined\" ? document.body : null;\n if (!portalTarget) {\n return null;\n }\n\n return createPortal(\n <AnimatePresence>\n {open ? (\n <div className=\"fixed inset-0 z-50\" data-slot=\"drawer-portal\">\n <motion.button\n type=\"button\"\n aria-hidden\n tabIndex={-1}\n data-slot=\"drawer-overlay\"\n className={drawerOverlayVariants()}\n onClick={() => setOpen(false)}\n initial={animation === \"none\" ? false : overlayMotion.initial}\n animate={animation === \"none\" ? undefined : overlayMotion.animate}\n exit={animation === \"none\" ? undefined : overlayMotion.exit}\n transition={overlayMotion.transition}\n />\n <motion.div\n ref={(node) => {\n contentRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as MutableRefObject<HTMLDivElement | null>).current =\n node;\n }\n }}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n data-slot=\"drawer-content\"\n tabIndex={-1}\n className={cn(\n drawerContentVariants({ side: resolvedSide, size, appearance }),\n className,\n )}\n initial={animation === \"none\" ? false : panelMotion.initial}\n animate={animation === \"none\" ? undefined : panelMotion.animate}\n exit={animation === \"none\" ? undefined : panelMotion.exit}\n transition={panelMotion.transition}\n id={id}\n style={style}\n >\n {children}\n </motion.div>\n </div>\n ) : null}\n </AnimatePresence>,\n portalTarget,\n );\n}\n\nDrawerContentAnimated.displayName = \"DrawerContent\";\n"]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useDrawerContext, drawerOverlayVariants, drawerContentVariants } from '../../chunk-PGH27VTL.mjs';
|
|
3
|
+
export { Drawer, DrawerBody, DrawerClose, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from '../../chunk-PGH27VTL.mjs';
|
|
4
|
+
import { useFocusManagement } from '../../chunk-WL5I7RVS.mjs';
|
|
5
|
+
import '../../chunk-PMAF6FBF.mjs';
|
|
6
|
+
import { cn } from '../../chunk-DFEZH7TC.mjs';
|
|
7
|
+
import { useReducedMotion, AnimatePresence, motion } from 'framer-motion';
|
|
8
|
+
import { createPortal } from 'react-dom';
|
|
9
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
// src/ui/drawer/animated/animations.ts
|
|
12
|
+
var drawerPanelPresets = (side) => ({
|
|
13
|
+
none: {},
|
|
14
|
+
fade: {
|
|
15
|
+
initial: { opacity: 0 },
|
|
16
|
+
animate: { opacity: 1 },
|
|
17
|
+
exit: { opacity: 0 },
|
|
18
|
+
transition: { duration: 0.2 }
|
|
19
|
+
},
|
|
20
|
+
scale: {
|
|
21
|
+
initial: { opacity: 0, scale: 0.98 },
|
|
22
|
+
animate: { opacity: 1, scale: 1 },
|
|
23
|
+
exit: { opacity: 0, scale: 0.98 },
|
|
24
|
+
transition: { type: "spring", stiffness: 420, damping: 32 }
|
|
25
|
+
},
|
|
26
|
+
slide: {
|
|
27
|
+
initial: side === "left" ? { x: -24, opacity: 0 } : side === "right" ? { x: 24, opacity: 0 } : side === "top" ? { y: -24, opacity: 0 } : { y: 24, opacity: 0 },
|
|
28
|
+
animate: { x: 0, y: 0, opacity: 1 },
|
|
29
|
+
exit: side === "left" ? { x: -16, opacity: 0 } : side === "right" ? { x: 16, opacity: 0 } : side === "top" ? { y: -16, opacity: 0 } : { y: 16, opacity: 0 },
|
|
30
|
+
transition: { type: "spring", stiffness: 380, damping: 30 }
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
function DrawerContentAnimated({
|
|
34
|
+
className,
|
|
35
|
+
side = "right",
|
|
36
|
+
size,
|
|
37
|
+
appearance,
|
|
38
|
+
animation = "slide",
|
|
39
|
+
children,
|
|
40
|
+
ref,
|
|
41
|
+
id,
|
|
42
|
+
style
|
|
43
|
+
}) {
|
|
44
|
+
const { open, setOpen, titleId, descriptionId, contentRef } = useDrawerContext("DrawerContent");
|
|
45
|
+
const resolvedSide = side ?? "right";
|
|
46
|
+
const reduceMotion = useReducedMotion();
|
|
47
|
+
const overlayMotion = drawerPanelPresets(resolvedSide)[reduceMotion ? "fade" : animation];
|
|
48
|
+
const panelMotion = drawerPanelPresets(resolvedSide)[reduceMotion ? "fade" : animation];
|
|
49
|
+
useFocusManagement({
|
|
50
|
+
open,
|
|
51
|
+
setOpen,
|
|
52
|
+
contentRef
|
|
53
|
+
});
|
|
54
|
+
const portalTarget = typeof document !== "undefined" ? document.body : null;
|
|
55
|
+
if (!portalTarget) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return createPortal(
|
|
59
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: open ? /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50", "data-slot": "drawer-portal", children: [
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
motion.button,
|
|
62
|
+
{
|
|
63
|
+
type: "button",
|
|
64
|
+
"aria-hidden": true,
|
|
65
|
+
tabIndex: -1,
|
|
66
|
+
"data-slot": "drawer-overlay",
|
|
67
|
+
className: drawerOverlayVariants(),
|
|
68
|
+
onClick: () => setOpen(false),
|
|
69
|
+
initial: animation === "none" ? false : overlayMotion.initial,
|
|
70
|
+
animate: animation === "none" ? void 0 : overlayMotion.animate,
|
|
71
|
+
exit: animation === "none" ? void 0 : overlayMotion.exit,
|
|
72
|
+
transition: overlayMotion.transition
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
motion.div,
|
|
77
|
+
{
|
|
78
|
+
ref: (node) => {
|
|
79
|
+
contentRef.current = node;
|
|
80
|
+
if (typeof ref === "function") {
|
|
81
|
+
ref(node);
|
|
82
|
+
} else if (ref) {
|
|
83
|
+
ref.current = node;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
role: "dialog",
|
|
87
|
+
"aria-modal": "true",
|
|
88
|
+
"aria-labelledby": titleId,
|
|
89
|
+
"aria-describedby": descriptionId,
|
|
90
|
+
"data-slot": "drawer-content",
|
|
91
|
+
tabIndex: -1,
|
|
92
|
+
className: cn(
|
|
93
|
+
drawerContentVariants({ side: resolvedSide, size, appearance }),
|
|
94
|
+
className
|
|
95
|
+
),
|
|
96
|
+
initial: animation === "none" ? false : panelMotion.initial,
|
|
97
|
+
animate: animation === "none" ? void 0 : panelMotion.animate,
|
|
98
|
+
exit: animation === "none" ? void 0 : panelMotion.exit,
|
|
99
|
+
transition: panelMotion.transition,
|
|
100
|
+
id,
|
|
101
|
+
style,
|
|
102
|
+
children
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
] }) : null }),
|
|
106
|
+
portalTarget
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
DrawerContentAnimated.displayName = "DrawerContent";
|
|
110
|
+
|
|
111
|
+
export { DrawerContentAnimated, drawerPanelPresets };
|
|
112
|
+
//# sourceMappingURL=animated.mjs.map
|
|
113
|
+
//# sourceMappingURL=animated.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/drawer/animated/animations.ts","../../../src/ui/drawer/animated/drawer-content-animated.tsx"],"names":[],"mappings":";;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,CAChC,IAAA,MAC4B;AAAA,EAC5B,MAAM,EAAC;AAAA,EACP,IAAA,EAAM;AAAA,IACJ,OAAA,EAAS,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,IACtB,OAAA,EAAS,EAAE,OAAA,EAAS,CA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D,YAAY,WAAA,CAAY,UAAA;AAAA,UACxB,EAAA;AAAA,UACA,KAAA;AAAA,UAEC;AAAA;AAAA;AACH,KAAA,EACF,IACE,IAAA,EACN,CAAA;AAAA,IACA;AAAA,GACF;AACF;AAEA,qBAAA,CAAsB,WAAA,GAAc,eAAA","file":"animated.mjs","sourcesContent":["import { DrawerAnimationPresets } from \"./types\";\n\nexport const drawerPanelPresets = (\n side: \"left\" | \"right\" | \"top\" | \"bottom\",\n): DrawerAnimationPresets => ({\n none: {},\n fade: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n transition: { duration: 0.2 },\n },\n scale: {\n initial: { opacity: 0, scale: 0.98 },\n animate: { opacity: 1, scale: 1 },\n exit: { opacity: 0, scale: 0.98 },\n transition: { type: \"spring\", stiffness: 420, damping: 32 },\n },\n slide: {\n initial:\n side === \"left\"\n ? { x: -24, opacity: 0 }\n : side === \"right\"\n ? { x: 24, opacity: 0 }\n : side === \"top\"\n ? { y: -24, opacity: 0 }\n : { y: 24, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit:\n side === \"left\"\n ? { x: -16, opacity: 0 }\n : side === \"right\"\n ? { x: 16, opacity: 0 }\n : side === \"top\"\n ? { y: -16, opacity: 0 }\n : { y: 16, opacity: 0 },\n transition: { type: \"spring\", stiffness: 380, damping: 30 },\n },\n});\n","\"use client\";\n\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport type { MutableRefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { useFocusManagement } from \"../../../hooks/useFocusManagement\";\n\nimport { drawerPanelPresets } from \"./animations\";\nimport { useDrawerContext } from \"../drawer-base\";\nimport {\n drawerContentVariants,\n drawerOverlayVariants,\n} from \"../variants\";\nimport type { DrawerContentAnimatedProps } from \"./types\";\n\nexport function DrawerContentAnimated({\n className,\n side = \"right\",\n size,\n appearance,\n animation = \"slide\",\n children,\n ref,\n id,\n style,\n}: DrawerContentAnimatedProps) {\n const { open, setOpen, titleId, descriptionId, contentRef } =\n useDrawerContext(\"DrawerContent\");\n const resolvedSide = side ?? \"right\";\n const reduceMotion = useReducedMotion();\n const overlayMotion =\n drawerPanelPresets(resolvedSide)[reduceMotion ? \"fade\" : animation];\n const panelMotion =\n drawerPanelPresets(resolvedSide)[reduceMotion ? \"fade\" : animation];\n\n useFocusManagement({\n open,\n setOpen,\n contentRef,\n });\n\n const portalTarget = typeof document !== \"undefined\" ? document.body : null;\n if (!portalTarget) {\n return null;\n }\n\n return createPortal(\n <AnimatePresence>\n {open ? (\n <div className=\"fixed inset-0 z-50\" data-slot=\"drawer-portal\">\n <motion.button\n type=\"button\"\n aria-hidden\n tabIndex={-1}\n data-slot=\"drawer-overlay\"\n className={drawerOverlayVariants()}\n onClick={() => setOpen(false)}\n initial={animation === \"none\" ? false : overlayMotion.initial}\n animate={animation === \"none\" ? undefined : overlayMotion.animate}\n exit={animation === \"none\" ? undefined : overlayMotion.exit}\n transition={overlayMotion.transition}\n />\n <motion.div\n ref={(node) => {\n contentRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as MutableRefObject<HTMLDivElement | null>).current =\n node;\n }\n }}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n data-slot=\"drawer-content\"\n tabIndex={-1}\n className={cn(\n drawerContentVariants({ side: resolvedSide, size, appearance }),\n className,\n )}\n initial={animation === \"none\" ? false : panelMotion.initial}\n animate={animation === \"none\" ? undefined : panelMotion.animate}\n exit={animation === \"none\" ? undefined : panelMotion.exit}\n transition={panelMotion.transition}\n id={id}\n style={style}\n >\n {children}\n </motion.div>\n </div>\n ) : null}\n </AnimatePresence>,\n portalTarget,\n );\n}\n\nDrawerContentAnimated.displayName = \"DrawerContent\";\n"]}
|
package/dist/ui/drawer.d.mts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, Ref, CSSProperties, HTMLAttributes } from 'react';
|
|
2
|
+
import { ReactNode, Ref, CSSProperties, RefObject, HTMLAttributes } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
|
-
import { HTMLMotionProps } from 'framer-motion';
|
|
6
5
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
6
|
|
|
8
|
-
type DrawerAnimation = "none" | "fade" | "scale" | "slide";
|
|
9
|
-
type DrawerPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "exit" | "transition">;
|
|
10
|
-
type DrawerAnimationPresets = Record<DrawerAnimation, DrawerPresetMotionProps>;
|
|
11
|
-
declare const drawerPanelPresets: (side: "left" | "right" | "top" | "bottom") => DrawerAnimationPresets;
|
|
12
|
-
|
|
13
7
|
declare const drawerOverlayVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
14
8
|
declare const drawerTriggerVariants: (props?: ({
|
|
15
9
|
appearance?: "default" | "glass" | "sky" | "rose" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gray" | "amber" | "violet" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
|
|
@@ -21,7 +15,6 @@ declare const drawerContentVariants: (props?: ({
|
|
|
21
15
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
22
16
|
|
|
23
17
|
type DrawerContentVariantProps = VariantProps<typeof drawerContentVariants>;
|
|
24
|
-
|
|
25
18
|
type DrawerProps = {
|
|
26
19
|
open?: boolean;
|
|
27
20
|
defaultOpen?: boolean;
|
|
@@ -33,7 +26,6 @@ type DrawerTriggerProps = HTMLAttributes<HTMLButtonElement> & {
|
|
|
33
26
|
appearance?: VariantProps<typeof drawerTriggerVariants>["appearance"];
|
|
34
27
|
};
|
|
35
28
|
type DrawerContentProps = DrawerContentVariantProps & {
|
|
36
|
-
animation?: DrawerAnimation;
|
|
37
29
|
className?: string;
|
|
38
30
|
children?: ReactNode;
|
|
39
31
|
ref?: Ref<HTMLDivElement>;
|
|
@@ -44,6 +36,13 @@ type DrawerSectionProps = {
|
|
|
44
36
|
className?: string;
|
|
45
37
|
children?: ReactNode;
|
|
46
38
|
};
|
|
39
|
+
type DrawerCtx = {
|
|
40
|
+
open: boolean;
|
|
41
|
+
setOpen: (next: boolean) => void;
|
|
42
|
+
titleId: string;
|
|
43
|
+
descriptionId: string;
|
|
44
|
+
contentRef: RefObject<HTMLDivElement | null>;
|
|
45
|
+
};
|
|
47
46
|
|
|
48
47
|
declare function Drawer({ open, defaultOpen, onOpenChange, children, }: DrawerProps): react_jsx_runtime.JSX.Element;
|
|
49
48
|
declare namespace Drawer {
|
|
@@ -53,7 +52,7 @@ declare function DrawerTrigger({ className, children, appearance, onClick, ref,
|
|
|
53
52
|
declare namespace DrawerTrigger {
|
|
54
53
|
var displayName: string;
|
|
55
54
|
}
|
|
56
|
-
declare function DrawerContent({ className, side, size, appearance,
|
|
55
|
+
declare function DrawerContent({ className, side, size, appearance, children, ref, id, style, }: DrawerContentProps): react.ReactPortal | null;
|
|
57
56
|
declare namespace DrawerContent {
|
|
58
57
|
var displayName: string;
|
|
59
58
|
}
|
|
@@ -78,4 +77,4 @@ declare namespace DrawerClose {
|
|
|
78
77
|
var displayName: string;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
export { Drawer,
|
|
80
|
+
export { Drawer, DrawerBody, DrawerClose, DrawerContent, type DrawerContentProps, type DrawerContentVariantProps, type DrawerCtx, DrawerFooter, DrawerHeader, type DrawerProps, type DrawerSectionProps, DrawerTitle, DrawerTrigger, type DrawerTriggerProps, drawerContentVariants, drawerOverlayVariants };
|