@zentauri-ui/zentauri-components 0.0.8 → 0.0.9
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 +27 -2
- package/dist/ui/accordion.cjs +311 -0
- package/dist/ui/accordion.cjs.map +1 -0
- package/dist/ui/accordion.d.cts +70 -0
- package/dist/ui/accordion.d.ts +70 -0
- package/dist/ui/accordion.js +286 -0
- package/dist/ui/accordion.js.map +1 -0
- package/dist/ui/alert.cjs +257 -0
- package/dist/ui/alert.cjs.map +1 -0
- package/dist/ui/alert.d.cts +66 -0
- package/dist/ui/alert.d.ts +66 -0
- package/dist/ui/alert.js +224 -0
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/badge.cjs +192 -0
- package/dist/ui/badge.cjs.map +1 -0
- package/dist/ui/badge.d.cts +37 -0
- package/dist/ui/badge.d.ts +37 -0
- package/dist/ui/badge.js +165 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/buttons.cjs +202 -0
- package/dist/ui/buttons.cjs.map +1 -0
- package/dist/ui/buttons.d.cts +27 -0
- package/dist/ui/buttons.d.ts +27 -0
- package/dist/ui/buttons.js +176 -0
- package/dist/ui/buttons.js.map +1 -0
- package/dist/ui/card.cjs +293 -0
- package/dist/ui/card.cjs.map +1 -0
- package/dist/ui/card.d.cts +77 -0
- package/dist/ui/card.d.ts +77 -0
- package/dist/ui/card.js +258 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/divider.cjs +229 -0
- package/dist/ui/divider.cjs.map +1 -0
- package/dist/ui/divider.d.cts +39 -0
- package/dist/ui/divider.d.ts +39 -0
- package/dist/ui/divider.js +200 -0
- package/dist/ui/divider.js.map +1 -0
- package/dist/ui/drawer.cjs +408 -0
- package/dist/ui/drawer.cjs.map +1 -0
- package/dist/ui/drawer.d.cts +81 -0
- package/dist/ui/drawer.d.ts +81 -0
- package/dist/ui/drawer.js +383 -0
- package/dist/ui/drawer.js.map +1 -0
- package/dist/ui/dropdown.cjs +302 -0
- package/dist/ui/dropdown.cjs.map +1 -0
- package/dist/ui/dropdown.d.cts +50 -0
- package/dist/ui/dropdown.d.ts +50 -0
- package/dist/ui/dropdown.js +278 -0
- package/dist/ui/dropdown.js.map +1 -0
- package/dist/ui/empty-state.cjs +186 -0
- package/dist/ui/empty-state.cjs.map +1 -0
- package/dist/ui/empty-state.d.cts +55 -0
- package/dist/ui/empty-state.d.ts +55 -0
- package/dist/ui/empty-state.js +154 -0
- package/dist/ui/empty-state.js.map +1 -0
- package/dist/ui/index.d.cts +27 -1164
- package/dist/ui/index.d.ts +27 -1164
- package/dist/ui/inputs.cjs +458 -0
- package/dist/ui/inputs.cjs.map +1 -0
- package/dist/ui/inputs.d.cts +35 -0
- package/dist/ui/inputs.d.ts +35 -0
- package/dist/ui/inputs.js +432 -0
- package/dist/ui/inputs.js.map +1 -0
- package/dist/ui/modal.cjs +406 -0
- package/dist/ui/modal.cjs.map +1 -0
- package/dist/ui/modal.d.cts +84 -0
- package/dist/ui/modal.d.ts +84 -0
- package/dist/ui/modal.js +384 -0
- package/dist/ui/modal.js.map +1 -0
- package/dist/ui/pagination.cjs +523 -0
- package/dist/ui/pagination.cjs.map +1 -0
- package/dist/ui/pagination.d.cts +114 -0
- package/dist/ui/pagination.d.ts +114 -0
- package/dist/ui/pagination.js +494 -0
- package/dist/ui/pagination.js.map +1 -0
- package/dist/ui/progress.cjs +268 -0
- package/dist/ui/progress.cjs.map +1 -0
- package/dist/ui/progress.d.cts +61 -0
- package/dist/ui/progress.d.ts +61 -0
- package/dist/ui/progress.js +237 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/select.cjs +360 -0
- package/dist/ui/select.cjs.map +1 -0
- package/dist/ui/select.d.cts +73 -0
- package/dist/ui/select.d.ts +73 -0
- package/dist/ui/select.js +327 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/skeleton.cjs +576 -0
- package/dist/ui/skeleton.cjs.map +1 -0
- package/dist/ui/skeleton.d.cts +90 -0
- package/dist/ui/skeleton.d.ts +90 -0
- package/dist/ui/skeleton.js +544 -0
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/spinner.cjs +219 -0
- package/dist/ui/spinner.cjs.map +1 -0
- package/dist/ui/spinner.d.cts +27 -0
- package/dist/ui/spinner.d.ts +27 -0
- package/dist/ui/spinner.js +193 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/table.cjs +328 -0
- package/dist/ui/table.cjs.map +1 -0
- package/dist/ui/table.d.cts +81 -0
- package/dist/ui/table.d.ts +81 -0
- package/dist/ui/table.js +293 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/tabs.cjs +300 -0
- package/dist/ui/tabs.cjs.map +1 -0
- package/dist/ui/tabs.d.cts +58 -0
- package/dist/ui/tabs.d.ts +58 -0
- package/dist/ui/tabs.js +274 -0
- package/dist/ui/tabs.js.map +1 -0
- package/dist/ui/toast.cjs +285 -0
- package/dist/ui/toast.cjs.map +1 -0
- package/dist/ui/toast.d.cts +86 -0
- package/dist/ui/toast.d.ts +86 -0
- package/dist/ui/toast.js +258 -0
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/toggle.cjs +185 -0
- package/dist/ui/toggle.cjs.map +1 -0
- package/dist/ui/toggle.d.cts +37 -0
- package/dist/ui/toggle.d.ts +37 -0
- package/dist/ui/toggle.js +158 -0
- package/dist/ui/toggle.js.map +1 -0
- package/dist/ui/tooltip.cjs +242 -0
- package/dist/ui/tooltip.cjs.map +1 -0
- package/dist/ui/tooltip.d.cts +46 -0
- package/dist/ui/tooltip.d.ts +46 -0
- package/dist/ui/tooltip.js +214 -0
- package/dist/ui/tooltip.js.map +1 -0
- package/dist/variants-1Bx3BEeS.d.cts +8 -0
- package/dist/variants-1Bx3BEeS.d.ts +8 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -13,7 +13,6 @@ Published artifacts live under `dist/`; consumers import the UI barrel at `@zent
|
|
|
13
13
|
| Subpath | Description |
|
|
14
14
|
| --- | --- |
|
|
15
15
|
| `@zentauri-ui/zentauri-components/ui` | Components, hooks, and types (ESM `.js`, CJS `.cjs`, `.d.ts`) |
|
|
16
|
-
| `@zentauri-ui/zentauri-components/styles.css` | Compiled CSS emitted by the build |
|
|
17
16
|
|
|
18
17
|
## Requirements
|
|
19
18
|
|
|
@@ -24,7 +23,27 @@ Published artifacts live under `dist/`; consumers import the UI barrel at `@zent
|
|
|
24
23
|
|
|
25
24
|
Modules re-exported from the UI entry include:
|
|
26
25
|
|
|
27
|
-
Accordion
|
|
26
|
+
- Accordion
|
|
27
|
+
- Alert
|
|
28
|
+
- Badge
|
|
29
|
+
- Button
|
|
30
|
+
- Card
|
|
31
|
+
- Divider
|
|
32
|
+
- Drawer
|
|
33
|
+
- Dropdown
|
|
34
|
+
- Empty state
|
|
35
|
+
- Input
|
|
36
|
+
- Modal
|
|
37
|
+
- Pagination
|
|
38
|
+
- Progress
|
|
39
|
+
- Select
|
|
40
|
+
- Skeleton
|
|
41
|
+
- Spinner
|
|
42
|
+
- Table
|
|
43
|
+
- Tabs
|
|
44
|
+
- Toast
|
|
45
|
+
- Toggle
|
|
46
|
+
- Tooltip
|
|
28
47
|
|
|
29
48
|
## Installation
|
|
30
49
|
|
|
@@ -96,6 +115,9 @@ import {
|
|
|
96
115
|
</div>
|
|
97
116
|
```
|
|
98
117
|
|
|
118
|
+
## Checkout the components:
|
|
119
|
+
https://zentauri-ui.vercel.app/
|
|
120
|
+
|
|
99
121
|
## Development
|
|
100
122
|
|
|
101
123
|
From this package directory in the monorepo:
|
|
@@ -104,6 +126,9 @@ From this package directory in the monorepo:
|
|
|
104
126
|
- `pnpm dev` — `tsup` watch mode
|
|
105
127
|
- `pnpm test` / `pnpm test:watch` — **Vitest** and **Testing Library** unit tests
|
|
106
128
|
|
|
129
|
+
## NOTE:
|
|
130
|
+
This package is in initial phase of development and you might see some minor or major breaking changes in the future. If you want to contribute to this project, email me at @shubhmtiwri00@gmail.com or ping me on linkeded https://www.linkedin.com/in/shubham-tiwari-b7544b193/
|
|
131
|
+
|
|
107
132
|
## License
|
|
108
133
|
|
|
109
134
|
MIT
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ui/accordion/index.ts
|
|
21
|
+
var accordion_exports = {};
|
|
22
|
+
__export(accordion_exports, {
|
|
23
|
+
Accordion: () => Accordion,
|
|
24
|
+
AccordionContent: () => AccordionContent,
|
|
25
|
+
AccordionItem: () => AccordionItem,
|
|
26
|
+
AccordionTrigger: () => AccordionTrigger,
|
|
27
|
+
accordionContentTransitionPresets: () => accordionContentTransitionPresets,
|
|
28
|
+
accordionContentVariants: () => accordionContentVariants,
|
|
29
|
+
accordionItemVariants: () => accordionItemVariants,
|
|
30
|
+
accordionTriggerVariants: () => accordionTriggerVariants,
|
|
31
|
+
accordionVariants: () => accordionVariants
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(accordion_exports);
|
|
34
|
+
|
|
35
|
+
// src/ui/accordion/accordion.tsx
|
|
36
|
+
var import_framer_motion = require("framer-motion");
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
|
|
39
|
+
// src/lib/utils.ts
|
|
40
|
+
var import_clsx = require("clsx");
|
|
41
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
42
|
+
function cn(...inputs) {
|
|
43
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/ui/accordion/animations.ts
|
|
47
|
+
var accordionContentTransitionPresets = {
|
|
48
|
+
none: { duration: 0 },
|
|
49
|
+
default: { duration: 0.2, ease: [0.4, 0, 0.2, 1] },
|
|
50
|
+
smooth: { duration: 0.28, ease: [0.22, 1, 0.36, 1] },
|
|
51
|
+
slow: { duration: 0.38, ease: [0.4, 0, 0.2, 1] }
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/ui/accordion/variants.ts
|
|
55
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
56
|
+
var accordionVariants = (0, import_class_variance_authority.cva)("w-full", {
|
|
57
|
+
variants: {
|
|
58
|
+
appearance: {
|
|
59
|
+
default: "divide-y divide-white/10 rounded-xl border border-white/10",
|
|
60
|
+
outline: "divide-y divide-white/10 rounded-xl border border-white/15",
|
|
61
|
+
ghost: "divide-y divide-white/5",
|
|
62
|
+
card: "space-y-2",
|
|
63
|
+
separated: "space-y-3",
|
|
64
|
+
sky: "divide-y divide-sky-600 rounded-xl border border-sky-600",
|
|
65
|
+
rose: "divide-y divide-rose-600 rounded-xl border border-rose-600",
|
|
66
|
+
purple: "divide-y divide-purple-600 rounded-xl border border-purple-600",
|
|
67
|
+
pink: "divide-y divide-pink-600 rounded-xl border border-pink-600",
|
|
68
|
+
orange: "divide-y divide-orange-600 rounded-xl border border-orange-600",
|
|
69
|
+
yellow: "divide-y divide-yellow-600 rounded-xl border border-yellow-600",
|
|
70
|
+
teal: "divide-y divide-teal-600 rounded-xl border border-teal-600",
|
|
71
|
+
indigo: "divide-y divide-indigo-600 rounded-xl border border-indigo-600",
|
|
72
|
+
emerald: "divide-y divide-emerald-600 rounded-xl border border-emerald-600",
|
|
73
|
+
"gradient-blue": "divide-y divide-gradient-to-r from-blue-600 to-purple-600 rounded-xl border border-gradient-to-r from-blue-600 to-purple-600",
|
|
74
|
+
"gradient-green": "divide-y divide-gradient-to-r from-green-600 to-lime-600 rounded-xl border border-gradient-to-r from-green-600 to-lime-600",
|
|
75
|
+
"gradient-red": "divide-y divide-gradient-to-r from-red-600 to-pink-600 rounded-xl border border-gradient-to-r from-red-600 to-pink-600",
|
|
76
|
+
"gradient-yellow": "divide-y divide-gradient-to-r from-yellow-600 to-orange-600 rounded-xl border border-gradient-to-r from-yellow-600 to-orange-600",
|
|
77
|
+
"gradient-purple": "divide-y divide-gradient-to-r from-purple-600 to-pink-600 rounded-xl border border-gradient-to-r from-purple-600 to-pink-600",
|
|
78
|
+
"gradient-teal": "divide-y divide-gradient-to-r from-teal-600 to-cyan-600 rounded-xl border border-gradient-to-r from-teal-600 to-cyan-600",
|
|
79
|
+
"gradient-indigo": "divide-y divide-gradient-to-r from-indigo-600 to-purple-600 rounded-xl border border-gradient-to-r from-indigo-600 to-purple-600",
|
|
80
|
+
"gradient-pink": "divide-y divide-gradient-to-r from-pink-600 to-rose-600 rounded-xl border border-gradient-to-r from-pink-600 to-rose-600",
|
|
81
|
+
"gradient-orange": "divide-y divide-gradient-to-r from-orange-600 to-red-600 rounded-xl border border-gradient-to-r from-orange-600 to-red-600"
|
|
82
|
+
},
|
|
83
|
+
size: {
|
|
84
|
+
sm: "px-3 py-2 text-sm",
|
|
85
|
+
md: "px-4 py-3 text-sm",
|
|
86
|
+
lg: "px-5 py-4 text-base"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
defaultVariants: {
|
|
90
|
+
appearance: "default",
|
|
91
|
+
size: "md"
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
var accordionItemVariants = (0, import_class_variance_authority.cva)("", {
|
|
95
|
+
variants: {
|
|
96
|
+
appearance: {
|
|
97
|
+
default: "",
|
|
98
|
+
outline: "",
|
|
99
|
+
ghost: "",
|
|
100
|
+
card: "rounded-xl border border-white/10 bg-white/[0.03] p-2",
|
|
101
|
+
separated: "rounded-xl border border-white/10 bg-slate-950/40 p-2",
|
|
102
|
+
sky: "rounded-xl border border-sky-600 bg-sky-600/[0.03] p-2",
|
|
103
|
+
rose: "rounded-xl border border-rose-600 bg-rose-600/[0.03] p-2",
|
|
104
|
+
purple: "rounded-xl border border-purple-600 bg-purple-600/[0.03] p-2",
|
|
105
|
+
pink: "rounded-xl border border-pink-600 bg-pink-600/[0.03] p-2",
|
|
106
|
+
orange: "rounded-xl border border-orange-600 bg-orange-600/[0.03] p-2",
|
|
107
|
+
yellow: "rounded-xl border border-yellow-600 bg-yellow-600/[0.03] p-2",
|
|
108
|
+
teal: "rounded-xl border border-teal-600 bg-teal-600/[0.03] p-2",
|
|
109
|
+
indigo: "rounded-xl border border-indigo-600 bg-indigo-600/[0.03] p-2",
|
|
110
|
+
emerald: "rounded-xl border border-emerald-600 bg-emerald-600/[0.03] p-2",
|
|
111
|
+
"gradient-blue": "rounded-xl bg-linear-to-r from-blue-600 to-purple-600/[0.03] p-2 text-white",
|
|
112
|
+
"gradient-green": "rounded-xl bg-linear-to-r from-green-600 to-lime-600/[0.03] p-2 text-white",
|
|
113
|
+
"gradient-red": "rounded-xl bg-linear-to-r from-red-600 to-pink-600/[0.03] p-2 text-white",
|
|
114
|
+
"gradient-yellow": "rounded-xl bg-linear-to-r from-yellow-600 to-orange-600/[0.03] p-2 text-white",
|
|
115
|
+
"gradient-purple": "rounded-xl bg-linear-to-r from-purple-600 to-pink-600/[0.03] p-2 text-white",
|
|
116
|
+
"gradient-teal": "rounded-xl bg-linear-to-r from-teal-600 to-cyan-600/[0.03] p-2 text-white",
|
|
117
|
+
"gradient-indigo": "rounded-xl bg-linear-to-r from-indigo-600 to-purple-600/[0.03] p-2 text-white",
|
|
118
|
+
"gradient-pink": "rounded-xl bg-linear-to-r from-pink-600 to-rose-600/[0.03] p-2 text-white",
|
|
119
|
+
"gradient-orange": "rounded-xl bg-linear-to-r from-orange-600 to-red-600/[0.03] p-2 text-white"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
defaultVariants: { appearance: "default" }
|
|
123
|
+
});
|
|
124
|
+
var accordionTriggerVariants = (0, import_class_variance_authority.cva)(
|
|
125
|
+
"flex w-full items-center justify-between gap-3 py-3 text-left font-medium text-slate-50 outline-none transition hover:text-white focus-visible:ring-2 focus-visible:ring-white/30",
|
|
126
|
+
{
|
|
127
|
+
variants: {
|
|
128
|
+
size: {
|
|
129
|
+
sm: "py-2 text-sm",
|
|
130
|
+
md: "py-3 text-sm",
|
|
131
|
+
lg: "py-4 text-base"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
defaultVariants: { size: "md" }
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
var accordionContentVariants = (0, import_class_variance_authority.cva)("pb-3 text-sm", {
|
|
138
|
+
variants: {
|
|
139
|
+
size: {
|
|
140
|
+
sm: "pb-2 text-xs",
|
|
141
|
+
md: "pb-3 text-sm",
|
|
142
|
+
lg: "pb-4 text-base"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
defaultVariants: { size: "md" }
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// src/ui/accordion/accordion.tsx
|
|
149
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
150
|
+
var AccordionContext = (0, import_react.createContext)(null);
|
|
151
|
+
var AccordionItemValueContext = (0, import_react.createContext)(null);
|
|
152
|
+
function useAccordionContext(component) {
|
|
153
|
+
const ctx = (0, import_react.useContext)(AccordionContext);
|
|
154
|
+
if (!ctx) {
|
|
155
|
+
throw new Error(`${component} must be used within <Accordion>`);
|
|
156
|
+
}
|
|
157
|
+
return ctx;
|
|
158
|
+
}
|
|
159
|
+
function useAccordionItemValue(component) {
|
|
160
|
+
const value = (0, import_react.useContext)(AccordionItemValueContext);
|
|
161
|
+
if (!value) {
|
|
162
|
+
throw new Error(`${component} must be used within <AccordionItem>`);
|
|
163
|
+
}
|
|
164
|
+
return value;
|
|
165
|
+
}
|
|
166
|
+
function Accordion({
|
|
167
|
+
type = "single",
|
|
168
|
+
value,
|
|
169
|
+
values,
|
|
170
|
+
defaultValue,
|
|
171
|
+
defaultValues,
|
|
172
|
+
onValueChange,
|
|
173
|
+
onValuesChange,
|
|
174
|
+
transition = "default",
|
|
175
|
+
appearance = "default",
|
|
176
|
+
size = "md",
|
|
177
|
+
className,
|
|
178
|
+
children
|
|
179
|
+
}) {
|
|
180
|
+
const isSingleControlled = value !== void 0;
|
|
181
|
+
const isMultipleControlled = values !== void 0;
|
|
182
|
+
const [singleUncontrolled, setSingleUncontrolled] = (0, import_react.useState)(defaultValue);
|
|
183
|
+
const [multipleUncontrolled, setMultipleUncontrolled] = (0, import_react.useState)(defaultValues ?? []);
|
|
184
|
+
const singleValue = isSingleControlled ? value : singleUncontrolled;
|
|
185
|
+
const multipleValues = (0, import_react.useMemo)(() => isMultipleControlled ? values ?? [] : multipleUncontrolled, [isMultipleControlled, values, multipleUncontrolled]);
|
|
186
|
+
const isOpen = (0, import_react.useCallback)(
|
|
187
|
+
(itemValue) => {
|
|
188
|
+
if (type === "single") {
|
|
189
|
+
return singleValue === itemValue;
|
|
190
|
+
}
|
|
191
|
+
return multipleValues.includes(itemValue);
|
|
192
|
+
},
|
|
193
|
+
[multipleValues, singleValue, type]
|
|
194
|
+
);
|
|
195
|
+
const toggle = (0, import_react.useCallback)(
|
|
196
|
+
(itemValue) => {
|
|
197
|
+
if (type === "single") {
|
|
198
|
+
const next2 = singleValue === itemValue ? void 0 : itemValue;
|
|
199
|
+
if (!isSingleControlled) {
|
|
200
|
+
setSingleUncontrolled(next2);
|
|
201
|
+
}
|
|
202
|
+
onValueChange?.(next2);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const exists = multipleValues.includes(itemValue);
|
|
206
|
+
const next = exists ? multipleValues.filter((entry) => entry !== itemValue) : [...multipleValues, itemValue];
|
|
207
|
+
if (!isMultipleControlled) {
|
|
208
|
+
setMultipleUncontrolled(next);
|
|
209
|
+
}
|
|
210
|
+
onValuesChange?.(next);
|
|
211
|
+
},
|
|
212
|
+
[
|
|
213
|
+
isMultipleControlled,
|
|
214
|
+
isSingleControlled,
|
|
215
|
+
multipleValues,
|
|
216
|
+
onValueChange,
|
|
217
|
+
onValuesChange,
|
|
218
|
+
singleValue,
|
|
219
|
+
type
|
|
220
|
+
]
|
|
221
|
+
);
|
|
222
|
+
const ctx = (0, import_react.useMemo)(
|
|
223
|
+
() => ({
|
|
224
|
+
type,
|
|
225
|
+
transition: transition ?? "default",
|
|
226
|
+
appearance: appearance ?? "default",
|
|
227
|
+
size: size ?? "md",
|
|
228
|
+
isOpen,
|
|
229
|
+
toggle
|
|
230
|
+
}),
|
|
231
|
+
[appearance, isOpen, size, toggle, transition, type]
|
|
232
|
+
);
|
|
233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { "data-slot": "accordion", className: cn(accordionVariants({ appearance, size }), className), children }) });
|
|
234
|
+
}
|
|
235
|
+
Accordion.displayName = "Accordion";
|
|
236
|
+
function AccordionItem({ className, value, children, ref, ...rest }) {
|
|
237
|
+
const { appearance } = useAccordionContext("AccordionItem");
|
|
238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionItemValueContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
ref,
|
|
242
|
+
"data-slot": "accordion-item",
|
|
243
|
+
"data-value": value,
|
|
244
|
+
className: cn(accordionItemVariants({ appearance }), className),
|
|
245
|
+
...rest,
|
|
246
|
+
children
|
|
247
|
+
}
|
|
248
|
+
) });
|
|
249
|
+
}
|
|
250
|
+
AccordionItem.displayName = "AccordionItem";
|
|
251
|
+
function AccordionTrigger({ className, children, ref, ...rest }) {
|
|
252
|
+
const itemValue = useAccordionItemValue("AccordionTrigger");
|
|
253
|
+
const { isOpen, toggle, size } = useAccordionContext("AccordionTrigger");
|
|
254
|
+
const open = isOpen(itemValue);
|
|
255
|
+
const panelId = `${itemValue}-panel`;
|
|
256
|
+
const baseId = (0, import_react.useId)();
|
|
257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "m-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
258
|
+
"button",
|
|
259
|
+
{
|
|
260
|
+
ref,
|
|
261
|
+
type: "button",
|
|
262
|
+
"data-slot": "accordion-trigger",
|
|
263
|
+
id: `${baseId}-trigger-${itemValue}`,
|
|
264
|
+
"aria-expanded": open,
|
|
265
|
+
"aria-controls": panelId,
|
|
266
|
+
className: cn(accordionTriggerVariants({ size }), className),
|
|
267
|
+
onClick: () => toggle(itemValue),
|
|
268
|
+
...rest,
|
|
269
|
+
children
|
|
270
|
+
}
|
|
271
|
+
) });
|
|
272
|
+
}
|
|
273
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
274
|
+
function AccordionContent({ className, children, ref }) {
|
|
275
|
+
const itemValue = useAccordionItemValue("AccordionContent");
|
|
276
|
+
const { isOpen, transition: transitionVariant, size } = useAccordionContext("AccordionContent");
|
|
277
|
+
const open = isOpen(itemValue);
|
|
278
|
+
const panelId = `${itemValue}-panel`;
|
|
279
|
+
const transitionConfig = accordionContentTransitionPresets[transitionVariant];
|
|
280
|
+
const motionless = transitionVariant === "none";
|
|
281
|
+
return open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
282
|
+
import_framer_motion.motion.div,
|
|
283
|
+
{
|
|
284
|
+
ref,
|
|
285
|
+
id: panelId,
|
|
286
|
+
role: "region",
|
|
287
|
+
"data-slot": "accordion-content",
|
|
288
|
+
className: cn(accordionContentVariants({ size }), className),
|
|
289
|
+
initial: motionless ? false : { opacity: 0 },
|
|
290
|
+
animate: motionless ? void 0 : { opacity: 1 },
|
|
291
|
+
exit: motionless ? void 0 : { opacity: 0 },
|
|
292
|
+
transition: transitionConfig,
|
|
293
|
+
children
|
|
294
|
+
},
|
|
295
|
+
itemValue
|
|
296
|
+
) : null;
|
|
297
|
+
}
|
|
298
|
+
AccordionContent.displayName = "AccordionContent";
|
|
299
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
300
|
+
0 && (module.exports = {
|
|
301
|
+
Accordion,
|
|
302
|
+
AccordionContent,
|
|
303
|
+
AccordionItem,
|
|
304
|
+
AccordionTrigger,
|
|
305
|
+
accordionContentTransitionPresets,
|
|
306
|
+
accordionContentVariants,
|
|
307
|
+
accordionItemVariants,
|
|
308
|
+
accordionTriggerVariants,
|
|
309
|
+
accordionVariants
|
|
310
|
+
});
|
|
311
|
+
//# sourceMappingURL=accordion.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/accordion/index.ts","../../src/ui/accordion/accordion.tsx","../../src/lib/utils.ts","../../src/ui/accordion/animations.ts","../../src/ui/accordion/variants.ts"],"sourcesContent":["export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from \"./accordion\";\nexport type {\n AccordionContentProps,\n AccordionItemProps,\n AccordionProps,\n AccordionTransition,\n AccordionTriggerProps,\n AccordionType,\n} from \"./types\";\nexport { accordionContentTransitionPresets } from \"./animations\";\nexport {\n accordionVariants,\n accordionItemVariants,\n accordionTriggerVariants,\n accordionContentVariants,\n} from \"./variants\";\n","\"use client\";\nimport { motion } from \"framer-motion\";\nimport {\n createContext,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n} from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport { accordionContentTransitionPresets } from \"./animations\";\nimport type {\n AccordionContentProps,\n AccordionItemProps,\n AccordionProps,\n AccordionTriggerProps,\n AccordionCtx,\n} from \"./types\";\nimport {\n accordionContentVariants,\n accordionItemVariants,\n accordionTriggerVariants,\n accordionVariants,\n} from \"./variants\";\n\n\nconst AccordionContext = createContext<AccordionCtx | null>(null);\n\nconst AccordionItemValueContext = createContext<string | null>(null);\n\nfunction useAccordionContext(component: string): AccordionCtx {\n const ctx = useContext(AccordionContext);\n if (!ctx) {\n throw new Error(`${component} must be used within <Accordion>`);\n }\n return ctx;\n}\n\nfunction useAccordionItemValue(component: string): string {\n const value = useContext(AccordionItemValueContext);\n if (!value) {\n throw new Error(`${component} must be used within <AccordionItem>`);\n }\n return value;\n}\n\nexport function Accordion({\n type = \"single\",\n value,\n values,\n defaultValue,\n defaultValues,\n onValueChange,\n onValuesChange,\n transition = \"default\",\n appearance = \"default\",\n size = \"md\",\n className,\n children,\n}: AccordionProps) {\n const isSingleControlled = value !== undefined;\n const isMultipleControlled = values !== undefined;\n const [singleUncontrolled, setSingleUncontrolled] = useState<string | undefined>(defaultValue);\n const [multipleUncontrolled, setMultipleUncontrolled] = useState<string[]>(defaultValues ?? []);\n\n const singleValue = isSingleControlled ? value : singleUncontrolled;\n const multipleValues = useMemo(() => isMultipleControlled ? values ?? [] : multipleUncontrolled, [isMultipleControlled, values, multipleUncontrolled]);\n\n const isOpen = useCallback(\n (itemValue: string) => {\n if (type === \"single\") {\n return singleValue === itemValue;\n }\n return multipleValues.includes(itemValue);\n },\n [multipleValues, singleValue, type],\n );\n\n const toggle = useCallback(\n (itemValue: string) => {\n if (type === \"single\") {\n const next = singleValue === itemValue ? undefined : itemValue;\n if (!isSingleControlled) {\n setSingleUncontrolled(next);\n }\n onValueChange?.(next);\n return;\n }\n const exists = multipleValues.includes(itemValue);\n const next = exists\n ? multipleValues.filter((entry) => entry !== itemValue)\n : [...multipleValues, itemValue];\n if (!isMultipleControlled) {\n setMultipleUncontrolled(next);\n }\n onValuesChange?.(next);\n },\n [\n isMultipleControlled,\n isSingleControlled,\n multipleValues,\n onValueChange,\n onValuesChange,\n singleValue,\n type,\n ],\n );\n\n const ctx = useMemo(\n () => ({\n type,\n transition: transition ?? \"default\",\n appearance: appearance ?? \"default\",\n size: size ?? \"md\",\n isOpen,\n toggle,\n }),\n [appearance, isOpen, size, toggle, transition, type],\n );\n\n return (\n <AccordionContext.Provider value={ctx}>\n <div data-slot=\"accordion\" className={cn(accordionVariants({ appearance, size }), className)}>\n {children}\n </div>\n </AccordionContext.Provider>\n );\n}\n\nAccordion.displayName = \"Accordion\";\n\nexport function AccordionItem({ className, value, children, ref, ...rest }: AccordionItemProps) {\n const { appearance } = useAccordionContext(\"AccordionItem\");\n return (\n <AccordionItemValueContext.Provider value={value}>\n <div\n ref={ref}\n data-slot=\"accordion-item\"\n data-value={value}\n className={cn(accordionItemVariants({ appearance }), className)}\n {...rest}\n >\n {children}\n </div>\n </AccordionItemValueContext.Provider>\n );\n}\n\nAccordionItem.displayName = \"AccordionItem\";\n\nexport function AccordionTrigger({ className, children, ref, ...rest }: AccordionTriggerProps) {\n const itemValue = useAccordionItemValue(\"AccordionTrigger\");\n const { isOpen, toggle, size } = useAccordionContext(\"AccordionTrigger\");\n const open = isOpen(itemValue);\n const panelId = `${itemValue}-panel`;\n const baseId = useId();\n\n return (\n <h3 className=\"m-0\">\n <button\n ref={ref}\n type=\"button\"\n data-slot=\"accordion-trigger\"\n id={`${baseId}-trigger-${itemValue}`}\n aria-expanded={open}\n aria-controls={panelId}\n className={cn(accordionTriggerVariants({ size }), className)}\n onClick={() => toggle(itemValue)}\n {...rest}\n >\n {children}\n </button>\n </h3>\n );\n}\n\nAccordionTrigger.displayName = \"AccordionTrigger\";\n\nexport function AccordionContent({ className, children, ref }: AccordionContentProps) {\n const itemValue = useAccordionItemValue(\"AccordionContent\");\n const { isOpen, transition: transitionVariant, size } = useAccordionContext(\"AccordionContent\");\n const open = isOpen(itemValue);\n const panelId = `${itemValue}-panel`;\n const transitionConfig = accordionContentTransitionPresets[transitionVariant];\n const motionless = transitionVariant === \"none\";\n\n return (\n open ? (\n <motion.div\n key={itemValue}\n ref={ref}\n id={panelId}\n role=\"region\"\n data-slot=\"accordion-content\"\n className={cn(accordionContentVariants({ size }), className)}\n initial={motionless ? false : { opacity: 0 }}\n animate={motionless ? undefined : { opacity: 1 }}\n exit={motionless ? undefined : { opacity: 0 }}\n transition={transitionConfig}\n >\n {children}\n </motion.div>\n ) : null\n );\n}\n\nAccordionContent.displayName = \"AccordionContent\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}","import type { Transition } from \"framer-motion\";\n\n/** Easing and duration presets for accordion panel open/close (opacity only). */\nexport type AccordionTransition = \"none\" | \"default\" | \"smooth\" | \"slow\";\n\nexport type AccordionTransitionPresets = Record<AccordionTransition, Transition>;\n\nexport const accordionContentTransitionPresets: AccordionTransitionPresets = {\n none: { duration: 0 },\n default: { duration: 0.2, ease: [0.4, 0, 0.2, 1] },\n smooth: { duration: 0.28, ease: [0.22, 1, 0.36, 1] },\n slow: { duration: 0.38, ease: [0.4, 0, 0.2, 1] },\n};\n","import { cva } from \"class-variance-authority\";\n\nexport const accordionVariants = cva(\"w-full\", {\n variants: {\n appearance: {\n default: \"divide-y divide-white/10 rounded-xl border border-white/10\",\n outline: \"divide-y divide-white/10 rounded-xl border border-white/15\",\n ghost: \"divide-y divide-white/5\",\n card: \"space-y-2\",\n separated: \"space-y-3\",\n sky: \"divide-y divide-sky-600 rounded-xl border border-sky-600\",\n rose: \"divide-y divide-rose-600 rounded-xl border border-rose-600\",\n purple: \"divide-y divide-purple-600 rounded-xl border border-purple-600\",\n pink: \"divide-y divide-pink-600 rounded-xl border border-pink-600\",\n orange: \"divide-y divide-orange-600 rounded-xl border border-orange-600\",\n yellow: \"divide-y divide-yellow-600 rounded-xl border border-yellow-600\",\n teal: \"divide-y divide-teal-600 rounded-xl border border-teal-600\",\n indigo: \"divide-y divide-indigo-600 rounded-xl border border-indigo-600\",\n emerald: \"divide-y divide-emerald-600 rounded-xl border border-emerald-600\",\n \"gradient-blue\": \"divide-y divide-gradient-to-r from-blue-600 to-purple-600 rounded-xl border border-gradient-to-r from-blue-600 to-purple-600\",\n \"gradient-green\": \"divide-y divide-gradient-to-r from-green-600 to-lime-600 rounded-xl border border-gradient-to-r from-green-600 to-lime-600\",\n \"gradient-red\": \"divide-y divide-gradient-to-r from-red-600 to-pink-600 rounded-xl border border-gradient-to-r from-red-600 to-pink-600\",\n \"gradient-yellow\": \"divide-y divide-gradient-to-r from-yellow-600 to-orange-600 rounded-xl border border-gradient-to-r from-yellow-600 to-orange-600\",\n \"gradient-purple\": \"divide-y divide-gradient-to-r from-purple-600 to-pink-600 rounded-xl border border-gradient-to-r from-purple-600 to-pink-600\",\n \"gradient-teal\": \"divide-y divide-gradient-to-r from-teal-600 to-cyan-600 rounded-xl border border-gradient-to-r from-teal-600 to-cyan-600\",\n \"gradient-indigo\": \"divide-y divide-gradient-to-r from-indigo-600 to-purple-600 rounded-xl border border-gradient-to-r from-indigo-600 to-purple-600\",\n \"gradient-pink\": \"divide-y divide-gradient-to-r from-pink-600 to-rose-600 rounded-xl border border-gradient-to-r from-pink-600 to-rose-600\",\n \"gradient-orange\": \"divide-y divide-gradient-to-r from-orange-600 to-red-600 rounded-xl border border-gradient-to-r from-orange-600 to-red-600\",\n },\n size: {\n sm: \"px-3 py-2 text-sm\",\n md: \"px-4 py-3 text-sm\",\n lg: \"px-5 py-4 text-base\",\n },\n },\n defaultVariants: {\n appearance: \"default\",\n size: \"md\",\n },\n});\n\nexport const accordionItemVariants = cva(\"\", {\n variants: {\n appearance: {\n default: \"\",\n outline: \"\",\n ghost: \"\",\n card: \"rounded-xl border border-white/10 bg-white/[0.03] p-2\",\n separated: \"rounded-xl border border-white/10 bg-slate-950/40 p-2\",\n sky: \"rounded-xl border border-sky-600 bg-sky-600/[0.03] p-2\",\n rose: \"rounded-xl border border-rose-600 bg-rose-600/[0.03] p-2\",\n purple: \"rounded-xl border border-purple-600 bg-purple-600/[0.03] p-2\",\n pink: \"rounded-xl border border-pink-600 bg-pink-600/[0.03] p-2\",\n orange: \"rounded-xl border border-orange-600 bg-orange-600/[0.03] p-2\",\n yellow: \"rounded-xl border border-yellow-600 bg-yellow-600/[0.03] p-2\",\n teal: \"rounded-xl border border-teal-600 bg-teal-600/[0.03] p-2\",\n indigo: \"rounded-xl border border-indigo-600 bg-indigo-600/[0.03] p-2\",\n emerald: \"rounded-xl border border-emerald-600 bg-emerald-600/[0.03] p-2\",\n \"gradient-blue\": \"rounded-xl bg-linear-to-r from-blue-600 to-purple-600/[0.03] p-2 text-white\",\n \"gradient-green\": \"rounded-xl bg-linear-to-r from-green-600 to-lime-600/[0.03] p-2 text-white\",\n \"gradient-red\": \"rounded-xl bg-linear-to-r from-red-600 to-pink-600/[0.03] p-2 text-white\",\n \"gradient-yellow\": \"rounded-xl bg-linear-to-r from-yellow-600 to-orange-600/[0.03] p-2 text-white\",\n \"gradient-purple\": \"rounded-xl bg-linear-to-r from-purple-600 to-pink-600/[0.03] p-2 text-white\",\n \"gradient-teal\": \"rounded-xl bg-linear-to-r from-teal-600 to-cyan-600/[0.03] p-2 text-white\",\n \"gradient-indigo\": \"rounded-xl bg-linear-to-r from-indigo-600 to-purple-600/[0.03] p-2 text-white\",\n \"gradient-pink\": \"rounded-xl bg-linear-to-r from-pink-600 to-rose-600/[0.03] p-2 text-white\",\n \"gradient-orange\": \"rounded-xl bg-linear-to-r from-orange-600 to-red-600/[0.03] p-2 text-white\",\n },\n },\n defaultVariants: { appearance: \"default\" },\n});\n\nexport const accordionTriggerVariants = cva(\n \"flex w-full items-center justify-between gap-3 py-3 text-left font-medium text-slate-50 outline-none transition hover:text-white focus-visible:ring-2 focus-visible:ring-white/30\",\n {\n variants: {\n size: {\n sm: \"py-2 text-sm\",\n md: \"py-3 text-sm\",\n lg: \"py-4 text-base\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n);\n\nexport const accordionContentVariants = cva(\"pb-3 text-sm\", {\n variants: {\n size: {\n sm: \"pb-2 text-xs\",\n md: \"pb-3 text-sm\",\n lg: \"pb-4 text-base\",\n },\n },\n defaultVariants: { size: \"md\" },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,2BAAuB;AACvB,mBAOO;;;ACTP,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACEO,IAAM,oCAAgE;AAAA,EAC3E,MAAM,EAAE,UAAU,EAAE;AAAA,EACpB,SAAS,EAAE,UAAU,KAAK,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE;AAAA,EACjD,QAAQ,EAAE,UAAU,MAAM,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE;AAAA,EACnD,MAAM,EAAE,UAAU,MAAM,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE;AACjD;;;ACZA,sCAAoB;AAEb,IAAM,wBAAoB,qCAAI,UAAU;AAAA,EAC7C,UAAU;AAAA,IACR,YAAY;AAAA,MACV,SAAS;AAAA,MACT,SAAS;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,MACN,WAAW;AAAA,MACX,KAAK;AAAA,MACL,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,iBAAiB;AAAA,MACjB,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,MAChB,mBAAmB;AAAA,MACnB,mBAAmB;AAAA,MACnB,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,IACrB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VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { ReactNode, HTMLAttributes, Ref } from 'react';
|
|
4
|
+
import { Transition } from 'framer-motion';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
|
|
7
|
+
/** Easing and duration presets for accordion panel open/close (opacity only). */
|
|
8
|
+
type AccordionTransition = "none" | "default" | "smooth" | "slow";
|
|
9
|
+
type AccordionTransitionPresets = Record<AccordionTransition, Transition>;
|
|
10
|
+
declare const accordionContentTransitionPresets: AccordionTransitionPresets;
|
|
11
|
+
|
|
12
|
+
declare const accordionVariants: (props?: ({
|
|
13
|
+
appearance?: "default" | "outline" | "ghost" | "card" | "separated" | "sky" | "rose" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
|
|
14
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
15
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
|
+
declare const accordionItemVariants: (props?: ({
|
|
17
|
+
appearance?: "default" | "outline" | "ghost" | "card" | "separated" | "sky" | "rose" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
|
|
18
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
19
|
+
declare const accordionTriggerVariants: (props?: ({
|
|
20
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
21
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
22
|
+
declare const accordionContentVariants: (props?: ({
|
|
23
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
24
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
25
|
+
|
|
26
|
+
type AccordionVariantProps = VariantProps<typeof accordionVariants>;
|
|
27
|
+
type AccordionType = "single" | "multiple";
|
|
28
|
+
type AccordionProps = AccordionVariantProps & {
|
|
29
|
+
transition?: AccordionTransition;
|
|
30
|
+
type?: AccordionType;
|
|
31
|
+
/** Controlled value for `single` mode. */
|
|
32
|
+
value?: string;
|
|
33
|
+
/** Controlled values for `multiple` mode. */
|
|
34
|
+
values?: string[];
|
|
35
|
+
defaultValue?: string;
|
|
36
|
+
defaultValues?: string[];
|
|
37
|
+
onValueChange?: (value: string | undefined) => void;
|
|
38
|
+
onValuesChange?: (values: string[]) => void;
|
|
39
|
+
className?: string;
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
type AccordionItemProps = HTMLAttributes<HTMLDivElement> & {
|
|
43
|
+
value: string;
|
|
44
|
+
ref?: Ref<HTMLDivElement>;
|
|
45
|
+
};
|
|
46
|
+
type AccordionTriggerProps = HTMLAttributes<HTMLButtonElement> & {
|
|
47
|
+
ref?: Ref<HTMLButtonElement>;
|
|
48
|
+
};
|
|
49
|
+
type AccordionContentProps = HTMLAttributes<HTMLDivElement> & {
|
|
50
|
+
ref?: Ref<HTMLDivElement>;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
declare function Accordion({ type, value, values, defaultValue, defaultValues, onValueChange, onValuesChange, transition, appearance, size, className, children, }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare namespace Accordion {
|
|
55
|
+
var displayName: string;
|
|
56
|
+
}
|
|
57
|
+
declare function AccordionItem({ className, value, children, ref, ...rest }: AccordionItemProps): react_jsx_runtime.JSX.Element;
|
|
58
|
+
declare namespace AccordionItem {
|
|
59
|
+
var displayName: string;
|
|
60
|
+
}
|
|
61
|
+
declare function AccordionTrigger({ className, children, ref, ...rest }: AccordionTriggerProps): react_jsx_runtime.JSX.Element;
|
|
62
|
+
declare namespace AccordionTrigger {
|
|
63
|
+
var displayName: string;
|
|
64
|
+
}
|
|
65
|
+
declare function AccordionContent({ className, children, ref }: AccordionContentProps): react_jsx_runtime.JSX.Element | null;
|
|
66
|
+
declare namespace AccordionContent {
|
|
67
|
+
var displayName: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionTransition, AccordionTrigger, type AccordionTriggerProps, type AccordionType, accordionContentTransitionPresets, accordionContentVariants, accordionItemVariants, accordionTriggerVariants, accordionVariants };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { ReactNode, HTMLAttributes, Ref } from 'react';
|
|
4
|
+
import { Transition } from 'framer-motion';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
|
|
7
|
+
/** Easing and duration presets for accordion panel open/close (opacity only). */
|
|
8
|
+
type AccordionTransition = "none" | "default" | "smooth" | "slow";
|
|
9
|
+
type AccordionTransitionPresets = Record<AccordionTransition, Transition>;
|
|
10
|
+
declare const accordionContentTransitionPresets: AccordionTransitionPresets;
|
|
11
|
+
|
|
12
|
+
declare const accordionVariants: (props?: ({
|
|
13
|
+
appearance?: "default" | "outline" | "ghost" | "card" | "separated" | "sky" | "rose" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
|
|
14
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
15
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
|
+
declare const accordionItemVariants: (props?: ({
|
|
17
|
+
appearance?: "default" | "outline" | "ghost" | "card" | "separated" | "sky" | "rose" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
|
|
18
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
19
|
+
declare const accordionTriggerVariants: (props?: ({
|
|
20
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
21
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
22
|
+
declare const accordionContentVariants: (props?: ({
|
|
23
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
24
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
25
|
+
|
|
26
|
+
type AccordionVariantProps = VariantProps<typeof accordionVariants>;
|
|
27
|
+
type AccordionType = "single" | "multiple";
|
|
28
|
+
type AccordionProps = AccordionVariantProps & {
|
|
29
|
+
transition?: AccordionTransition;
|
|
30
|
+
type?: AccordionType;
|
|
31
|
+
/** Controlled value for `single` mode. */
|
|
32
|
+
value?: string;
|
|
33
|
+
/** Controlled values for `multiple` mode. */
|
|
34
|
+
values?: string[];
|
|
35
|
+
defaultValue?: string;
|
|
36
|
+
defaultValues?: string[];
|
|
37
|
+
onValueChange?: (value: string | undefined) => void;
|
|
38
|
+
onValuesChange?: (values: string[]) => void;
|
|
39
|
+
className?: string;
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
type AccordionItemProps = HTMLAttributes<HTMLDivElement> & {
|
|
43
|
+
value: string;
|
|
44
|
+
ref?: Ref<HTMLDivElement>;
|
|
45
|
+
};
|
|
46
|
+
type AccordionTriggerProps = HTMLAttributes<HTMLButtonElement> & {
|
|
47
|
+
ref?: Ref<HTMLButtonElement>;
|
|
48
|
+
};
|
|
49
|
+
type AccordionContentProps = HTMLAttributes<HTMLDivElement> & {
|
|
50
|
+
ref?: Ref<HTMLDivElement>;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
declare function Accordion({ type, value, values, defaultValue, defaultValues, onValueChange, onValuesChange, transition, appearance, size, className, children, }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare namespace Accordion {
|
|
55
|
+
var displayName: string;
|
|
56
|
+
}
|
|
57
|
+
declare function AccordionItem({ className, value, children, ref, ...rest }: AccordionItemProps): react_jsx_runtime.JSX.Element;
|
|
58
|
+
declare namespace AccordionItem {
|
|
59
|
+
var displayName: string;
|
|
60
|
+
}
|
|
61
|
+
declare function AccordionTrigger({ className, children, ref, ...rest }: AccordionTriggerProps): react_jsx_runtime.JSX.Element;
|
|
62
|
+
declare namespace AccordionTrigger {
|
|
63
|
+
var displayName: string;
|
|
64
|
+
}
|
|
65
|
+
declare function AccordionContent({ className, children, ref }: AccordionContentProps): react_jsx_runtime.JSX.Element | null;
|
|
66
|
+
declare namespace AccordionContent {
|
|
67
|
+
var displayName: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionTransition, AccordionTrigger, type AccordionTriggerProps, type AccordionType, accordionContentTransitionPresets, accordionContentVariants, accordionItemVariants, accordionTriggerVariants, accordionVariants };
|