@fea-ui/react 0.1.0-alpha.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/dist/index.cjs +1330 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1619 -0
- package/dist/index.d.mts +1619 -0
- package/dist/index.mjs +1247 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +68 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1247 @@
|
|
|
1
|
+
import { cn, cn as cn$1, tv } from "tailwind-variants";
|
|
2
|
+
import { Accordion, Avatar, Button, Checkbox, CheckboxGroup, Dialog, Field, Input, Menu, Meter, Separator, Switch, Tabs, Toggle } from "@base-ui/react";
|
|
3
|
+
import { LucideCheck, LucideMenu, LucidePlus, LucideX } from "lucide-react";
|
|
4
|
+
import React, { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/accordion/accordion.context.ts
|
|
8
|
+
const AccordionContext = createContext(null);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/components/accordion/accordion.variants.ts
|
|
12
|
+
const accordionVariants = tv({ slots: {
|
|
13
|
+
content: "accordion__content",
|
|
14
|
+
header: "accordion__header",
|
|
15
|
+
item: "accordion__item",
|
|
16
|
+
panel: "accordion__panel",
|
|
17
|
+
root: "accordion",
|
|
18
|
+
trigger: "accordion__trigger",
|
|
19
|
+
triggerIcon: "accordion__trigger-icon"
|
|
20
|
+
} });
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/components/accordion/use-accordion.ts
|
|
24
|
+
const useAccordion = () => {
|
|
25
|
+
const context = useContext(AccordionContext);
|
|
26
|
+
if (!context) throw new Error("useAccordion must be used within a AccordionProvider");
|
|
27
|
+
return context;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/components/accordion/accordion.tsx
|
|
32
|
+
const Accordion$1 = ({ className, ...props }) => {
|
|
33
|
+
const slots = useMemo(() => accordionVariants({}), []);
|
|
34
|
+
return /* @__PURE__ */ jsx(AccordionContext.Provider, {
|
|
35
|
+
value: { slots },
|
|
36
|
+
children: /* @__PURE__ */ jsx(Accordion.Root, {
|
|
37
|
+
className: cn$1(className, slots.root()),
|
|
38
|
+
...props
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const AccordionItem = ({ className, ...props }) => {
|
|
43
|
+
const { slots } = useAccordion();
|
|
44
|
+
return /* @__PURE__ */ jsx(Accordion.Item, {
|
|
45
|
+
className: cn$1(className, slots.item()),
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const AccordionHeader = ({ className, ...props }) => {
|
|
50
|
+
const { slots } = useAccordion();
|
|
51
|
+
return /* @__PURE__ */ jsx(Accordion.Header, {
|
|
52
|
+
className: cn$1(className, slots.header()),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const AccordionTrigger = ({ className, ...props }) => {
|
|
57
|
+
const { slots } = useAccordion();
|
|
58
|
+
return /* @__PURE__ */ jsx(Accordion.Trigger, {
|
|
59
|
+
className: cn$1(className, slots.trigger()),
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const AccordionTriggerIcon = ({ className, ...props }) => {
|
|
64
|
+
const { slots } = useAccordion();
|
|
65
|
+
return /* @__PURE__ */ jsx(LucidePlus, {
|
|
66
|
+
className: cn$1(className, slots.triggerIcon()),
|
|
67
|
+
...props
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const AccordionPanel = ({ className, ...props }) => {
|
|
71
|
+
const { slots } = useAccordion();
|
|
72
|
+
return /* @__PURE__ */ jsx(Accordion.Panel, {
|
|
73
|
+
className: cn$1(className, slots.panel()),
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
const AccordionContent = ({ className, ...props }) => {
|
|
78
|
+
const { slots } = useAccordion();
|
|
79
|
+
return /* @__PURE__ */ jsx("div", {
|
|
80
|
+
className: cn$1(className, slots.content()),
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
Accordion$1.Content = AccordionContent;
|
|
85
|
+
Accordion$1.Header = AccordionHeader;
|
|
86
|
+
Accordion$1.Item = AccordionItem;
|
|
87
|
+
Accordion$1.Panel = AccordionPanel;
|
|
88
|
+
Accordion$1.Root = Accordion$1;
|
|
89
|
+
Accordion$1.Trigger = AccordionTrigger;
|
|
90
|
+
Accordion$1.TriggerIcon = AccordionTriggerIcon;
|
|
91
|
+
var accordion_default = Accordion$1;
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/components/avatar/avatar.context.ts
|
|
95
|
+
const AvatarContext = createContext(null);
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/components/avatar/avatar.variants.ts
|
|
99
|
+
const avatarVariants = tv({
|
|
100
|
+
defaultVariants: { size: "md" },
|
|
101
|
+
slots: {
|
|
102
|
+
fallback: "avatar__fallback",
|
|
103
|
+
image: "avatar__image",
|
|
104
|
+
root: "avatar"
|
|
105
|
+
},
|
|
106
|
+
variants: { size: {
|
|
107
|
+
lg: { root: "avatar--lg" },
|
|
108
|
+
md: { root: "avatar--md" },
|
|
109
|
+
sm: { root: "avatar--sm" }
|
|
110
|
+
} }
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/components/avatar/use-avatar.ts
|
|
115
|
+
const useAvatar = () => {
|
|
116
|
+
const ctx = useContext(AvatarContext);
|
|
117
|
+
if (!ctx) throw new Error("useAvatar must be used within the Avatar component.");
|
|
118
|
+
return ctx;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/components/avatar/avatar.tsx
|
|
123
|
+
const Avatar$1 = ({ className, size, ...props }) => {
|
|
124
|
+
const slots = useMemo(() => avatarVariants({ size }), [size]);
|
|
125
|
+
return /* @__PURE__ */ jsx(AvatarContext.Provider, {
|
|
126
|
+
value: { slots },
|
|
127
|
+
children: /* @__PURE__ */ jsx(Avatar.Root, {
|
|
128
|
+
className: cn$1(className, slots.root()),
|
|
129
|
+
...props
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
const AvatarImage = ({ className, ...props }) => {
|
|
134
|
+
const { slots } = useAvatar();
|
|
135
|
+
return /* @__PURE__ */ jsx(Avatar.Image, {
|
|
136
|
+
className: cn$1(className, slots.image()),
|
|
137
|
+
...props
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
const AvatarFallback = ({ className, ...props }) => {
|
|
141
|
+
const { slots } = useAvatar();
|
|
142
|
+
return /* @__PURE__ */ jsx(Avatar.Fallback, {
|
|
143
|
+
className: cn$1(className, slots.fallback()),
|
|
144
|
+
...props
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
Avatar$1.Fallback = AvatarFallback;
|
|
148
|
+
Avatar$1.Image = AvatarImage;
|
|
149
|
+
Avatar$1.Root = Avatar$1;
|
|
150
|
+
var avatar_default = Avatar$1;
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/components/button/button.variants.ts
|
|
154
|
+
const buttonVariants = tv({
|
|
155
|
+
base: "button",
|
|
156
|
+
defaultVariants: {
|
|
157
|
+
isIconOnly: false,
|
|
158
|
+
size: "md",
|
|
159
|
+
variant: "primary"
|
|
160
|
+
},
|
|
161
|
+
variants: {
|
|
162
|
+
isIconOnly: { true: "button--icon-only" },
|
|
163
|
+
size: {
|
|
164
|
+
lg: "button--lg",
|
|
165
|
+
md: "button--md",
|
|
166
|
+
sm: "button--sm"
|
|
167
|
+
},
|
|
168
|
+
variant: {
|
|
169
|
+
danger: "button--danger",
|
|
170
|
+
ghost: "button--ghost",
|
|
171
|
+
outline: "button--outline",
|
|
172
|
+
primary: "button--primary",
|
|
173
|
+
secondary: "button--secondary"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/components/button/button.tsx
|
|
180
|
+
const Button$1 = ({ className, variant, size, isIconOnly, ...props }) => {
|
|
181
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
182
|
+
className: cn$1(buttonVariants({
|
|
183
|
+
isIconOnly,
|
|
184
|
+
size,
|
|
185
|
+
variant
|
|
186
|
+
}), className),
|
|
187
|
+
...props
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
var button_default = Button$1;
|
|
191
|
+
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/components/button-group/button-group.variants.ts
|
|
194
|
+
const buttonGroupVariants = tv({ base: "button-group" });
|
|
195
|
+
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/components/button-group/button-group.tsx
|
|
198
|
+
const ButtonGroup = ({ className, ...props }) => {
|
|
199
|
+
return /* @__PURE__ */ jsx("div", {
|
|
200
|
+
className: cn$1(className, buttonGroupVariants()),
|
|
201
|
+
...props
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
var button_group_default = ButtonGroup;
|
|
205
|
+
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/components/card/card.context.ts
|
|
208
|
+
const CardContext = createContext(null);
|
|
209
|
+
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/components/card/card.variants.ts
|
|
212
|
+
const cardVariants = tv({
|
|
213
|
+
defaultVariants: { variant: "default" },
|
|
214
|
+
slots: {
|
|
215
|
+
body: "card__body",
|
|
216
|
+
description: "card__description",
|
|
217
|
+
footer: "card__footer",
|
|
218
|
+
header: "card__header",
|
|
219
|
+
root: "card",
|
|
220
|
+
title: "card__title"
|
|
221
|
+
},
|
|
222
|
+
variants: { variant: {
|
|
223
|
+
default: { root: "card--default" },
|
|
224
|
+
transparent: { root: "card--transparent" }
|
|
225
|
+
} }
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/components/card/use-card.ts
|
|
230
|
+
const useCard = () => {
|
|
231
|
+
const ctx = useContext(CardContext);
|
|
232
|
+
if (!ctx) throw new Error("CardContext must be used with in the Card component.");
|
|
233
|
+
return ctx;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/components/card/card.tsx
|
|
238
|
+
const Card = ({ className, variant, ...props }) => {
|
|
239
|
+
const slots = useMemo(() => cardVariants({ variant }), [variant]);
|
|
240
|
+
console.log(slots);
|
|
241
|
+
return /* @__PURE__ */ jsx(CardContext.Provider, {
|
|
242
|
+
value: { slots },
|
|
243
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
244
|
+
className: cn$1(className, slots.root()),
|
|
245
|
+
...props
|
|
246
|
+
})
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
const CardHeader = ({ className, ...props }) => {
|
|
250
|
+
const { slots } = useCard();
|
|
251
|
+
return /* @__PURE__ */ jsx("div", {
|
|
252
|
+
className: cn$1(className, slots.header()),
|
|
253
|
+
...props
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
const CardBody = ({ className, ...props }) => {
|
|
257
|
+
const { slots } = useCard();
|
|
258
|
+
return /* @__PURE__ */ jsx("div", {
|
|
259
|
+
className: cn$1(className, slots.body()),
|
|
260
|
+
...props
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
const CardFooter = ({ className, ...props }) => {
|
|
264
|
+
const { slots } = useCard();
|
|
265
|
+
return /* @__PURE__ */ jsx("div", {
|
|
266
|
+
className: cn$1(className, slots.footer()),
|
|
267
|
+
...props
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
const CardTitle = ({ className, ...props }) => {
|
|
271
|
+
const { slots } = useCard();
|
|
272
|
+
return /* @__PURE__ */ jsx("h2", {
|
|
273
|
+
className: cn$1(className, slots.title()),
|
|
274
|
+
...props
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
const CardDescription = ({ className, ...props }) => {
|
|
278
|
+
const { slots } = useCard();
|
|
279
|
+
return /* @__PURE__ */ jsx("p", {
|
|
280
|
+
className: cn$1(className, slots.description()),
|
|
281
|
+
...props
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
/** Exports */
|
|
285
|
+
Card.Body = CardBody;
|
|
286
|
+
Card.Description = CardDescription;
|
|
287
|
+
Card.Footer = CardFooter;
|
|
288
|
+
Card.Header = CardHeader;
|
|
289
|
+
Card.Root = Card;
|
|
290
|
+
Card.Title = CardTitle;
|
|
291
|
+
var card_default = Card;
|
|
292
|
+
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/components/checkbox/checkbox.context.ts
|
|
295
|
+
const CheckboxContext = createContext(null);
|
|
296
|
+
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/components/checkbox/checkbox.variants.ts
|
|
299
|
+
const checkboxVariants = tv({ slots: {
|
|
300
|
+
checkboxIcon: "checkbox__icon",
|
|
301
|
+
indicator: "checkbox__indicator",
|
|
302
|
+
label: "checkbox__label",
|
|
303
|
+
root: "checkbox"
|
|
304
|
+
} });
|
|
305
|
+
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/components/checkbox/use-checkbox.ts
|
|
308
|
+
const useCheckbox = () => {
|
|
309
|
+
const ctx = useContext(CheckboxContext);
|
|
310
|
+
if (!ctx) throw new Error("CheckboxContext must be used with in the Checkbox component.");
|
|
311
|
+
return ctx;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/components/checkbox/checkbox.tsx
|
|
316
|
+
const Checkbox$1 = ({ className, ...props }) => {
|
|
317
|
+
const slots = useMemo(() => checkboxVariants(), []);
|
|
318
|
+
return /* @__PURE__ */ jsx(CheckboxContext.Provider, {
|
|
319
|
+
value: { slots },
|
|
320
|
+
children: /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
321
|
+
className: cn$1(className, slots.root()),
|
|
322
|
+
...props
|
|
323
|
+
})
|
|
324
|
+
});
|
|
325
|
+
};
|
|
326
|
+
const CheckboxIndicator = ({ className, ...props }) => {
|
|
327
|
+
const { slots } = useCheckbox();
|
|
328
|
+
return /* @__PURE__ */ jsx(Checkbox.Indicator, {
|
|
329
|
+
className: cn$1(className, slots.indicator()),
|
|
330
|
+
...props,
|
|
331
|
+
children: /* @__PURE__ */ jsx(LucideCheck, { className: slots.checkboxIcon() })
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
Checkbox$1.Indicator = CheckboxIndicator;
|
|
335
|
+
Checkbox$1.Root = Checkbox$1;
|
|
336
|
+
var checkbox_default = Checkbox$1;
|
|
337
|
+
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/components/checkbox-group/checkbox-group.variants.ts
|
|
340
|
+
const checkboxGroupVariants = tv({ base: "checkbox-group" });
|
|
341
|
+
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/components/checkbox-group/checkbox-group.tsx
|
|
344
|
+
const CheckboxGroup$1 = ({ className, ...props }) => {
|
|
345
|
+
return /* @__PURE__ */ jsx(CheckboxGroup, {
|
|
346
|
+
className: cn$1(className, checkboxGroupVariants()),
|
|
347
|
+
...props
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
var checkbox_group_default = CheckboxGroup$1;
|
|
351
|
+
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/components/chip/chip.variants.ts
|
|
354
|
+
const chipVariants = tv({
|
|
355
|
+
base: "chip",
|
|
356
|
+
defaultVariants: {
|
|
357
|
+
size: "md",
|
|
358
|
+
variant: "primary"
|
|
359
|
+
},
|
|
360
|
+
variants: {
|
|
361
|
+
size: {
|
|
362
|
+
lg: "chip--lg",
|
|
363
|
+
md: "chip--md",
|
|
364
|
+
sm: "chip--sm"
|
|
365
|
+
},
|
|
366
|
+
variant: {
|
|
367
|
+
danger: "chip--danger",
|
|
368
|
+
outline: "chip--outline",
|
|
369
|
+
primary: "chip--primary",
|
|
370
|
+
secondary: "chip--secondary",
|
|
371
|
+
success: "chip--success"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/components/chip/chip.tsx
|
|
378
|
+
const Chip = ({ className, variant, size, ...props }) => {
|
|
379
|
+
return /* @__PURE__ */ jsx("span", {
|
|
380
|
+
className: cn$1(className, chipVariants({
|
|
381
|
+
size,
|
|
382
|
+
variant
|
|
383
|
+
})),
|
|
384
|
+
...props
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
var chip_default = Chip;
|
|
388
|
+
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region src/components/container/container.variants.ts
|
|
391
|
+
const containerVariants = tv({ base: "container" });
|
|
392
|
+
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/components/container/container.tsx
|
|
395
|
+
const Container = ({ className, ...props }) => {
|
|
396
|
+
return /* @__PURE__ */ jsx("div", {
|
|
397
|
+
className: cn$1(className, containerVariants()),
|
|
398
|
+
...props
|
|
399
|
+
});
|
|
400
|
+
};
|
|
401
|
+
var container_default = Container;
|
|
402
|
+
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region src/components/dialog/dialog.context.ts
|
|
405
|
+
const DialogContext = createContext(null);
|
|
406
|
+
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/components/dialog/dialog.variants.ts
|
|
409
|
+
const dialogVariants = tv({ slots: {
|
|
410
|
+
backdrop: "dialog__backdrop",
|
|
411
|
+
close: "dialog__close",
|
|
412
|
+
description: "dialog__description",
|
|
413
|
+
popup: "dialog__popup",
|
|
414
|
+
portal: "dialog__portal",
|
|
415
|
+
root: "dialog",
|
|
416
|
+
title: "dialog__title",
|
|
417
|
+
trigger: "dialog__trigger",
|
|
418
|
+
viewport: "dialog__viewport"
|
|
419
|
+
} });
|
|
420
|
+
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/components/dialog/use-dialog.ts
|
|
423
|
+
const useDialog = () => {
|
|
424
|
+
const context = useContext(DialogContext);
|
|
425
|
+
if (!context) throw new Error("useDialog must be used within a DialogProvider");
|
|
426
|
+
return context;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/components/dialog/dialog.tsx
|
|
431
|
+
const Dialog$1 = ({ ...props }) => {
|
|
432
|
+
const slots = useMemo(() => dialogVariants(), []);
|
|
433
|
+
return /* @__PURE__ */ jsx(DialogContext.Provider, {
|
|
434
|
+
value: { slots },
|
|
435
|
+
children: /* @__PURE__ */ jsx(Dialog.Root, { ...props })
|
|
436
|
+
});
|
|
437
|
+
};
|
|
438
|
+
const DialogTrigger = ({ className, ...props }) => {
|
|
439
|
+
const { slots } = useDialog();
|
|
440
|
+
return /* @__PURE__ */ jsx(Dialog.Trigger, {
|
|
441
|
+
className: cn$1(slots.trigger(), className),
|
|
442
|
+
...props
|
|
443
|
+
});
|
|
444
|
+
};
|
|
445
|
+
const DialogPortal = ({ className, ...props }) => {
|
|
446
|
+
const { slots } = useDialog();
|
|
447
|
+
return /* @__PURE__ */ jsx(Dialog.Portal, {
|
|
448
|
+
className: cn$1(slots.portal(), className),
|
|
449
|
+
...props
|
|
450
|
+
});
|
|
451
|
+
};
|
|
452
|
+
const DialogBackdrop = ({ className, ...props }) => {
|
|
453
|
+
const { slots } = useDialog();
|
|
454
|
+
return /* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
455
|
+
className: cn$1(slots.backdrop(), className),
|
|
456
|
+
...props
|
|
457
|
+
});
|
|
458
|
+
};
|
|
459
|
+
const DialogViewport = ({ className, ...props }) => {
|
|
460
|
+
const { slots } = useDialog();
|
|
461
|
+
return /* @__PURE__ */ jsx(Dialog.Viewport, {
|
|
462
|
+
className: cn$1(slots.viewport(), className),
|
|
463
|
+
...props
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
const DialogPopup = ({ className, ...props }) => {
|
|
467
|
+
const { slots } = useDialog();
|
|
468
|
+
return /* @__PURE__ */ jsx(Dialog.Popup, {
|
|
469
|
+
className: cn$1(slots.popup(), className),
|
|
470
|
+
...props
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
const DialogTitle = ({ className, ...props }) => {
|
|
474
|
+
const { slots } = useDialog();
|
|
475
|
+
return /* @__PURE__ */ jsx(Dialog.Title, {
|
|
476
|
+
className: cn$1(slots.title(), className),
|
|
477
|
+
...props
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
const DialogDescription = ({ className, ...props }) => {
|
|
481
|
+
const { slots } = useDialog();
|
|
482
|
+
return /* @__PURE__ */ jsx(Dialog.Description, {
|
|
483
|
+
className: cn$1(slots.description(), className),
|
|
484
|
+
...props
|
|
485
|
+
});
|
|
486
|
+
};
|
|
487
|
+
const DialogClose = ({ className, ...props }) => {
|
|
488
|
+
const { slots } = useDialog();
|
|
489
|
+
return /* @__PURE__ */ jsx(Dialog.Close, {
|
|
490
|
+
className: cn$1(slots.close(), className),
|
|
491
|
+
...props,
|
|
492
|
+
children: /* @__PURE__ */ jsx(LucideX, {})
|
|
493
|
+
});
|
|
494
|
+
};
|
|
495
|
+
Dialog$1.Backdrop = DialogBackdrop;
|
|
496
|
+
Dialog$1.Close = DialogClose;
|
|
497
|
+
Dialog$1.Description = DialogDescription;
|
|
498
|
+
Dialog$1.Popup = DialogPopup;
|
|
499
|
+
Dialog$1.Portal = DialogPortal;
|
|
500
|
+
Dialog$1.Root = Dialog$1;
|
|
501
|
+
Dialog$1.Title = DialogTitle;
|
|
502
|
+
Dialog$1.Trigger = DialogTrigger;
|
|
503
|
+
Dialog$1.Viewport = DialogViewport;
|
|
504
|
+
var dialog_default = Dialog$1;
|
|
505
|
+
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/components/field/field.context.ts
|
|
508
|
+
const FieldContext = createContext(null);
|
|
509
|
+
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/components/field/field.variants.ts
|
|
512
|
+
const fieldVariants = tv({
|
|
513
|
+
slots: {
|
|
514
|
+
control: "input",
|
|
515
|
+
description: "field__description",
|
|
516
|
+
error: "field__error",
|
|
517
|
+
label: "label",
|
|
518
|
+
root: "field"
|
|
519
|
+
},
|
|
520
|
+
variants: { size: {
|
|
521
|
+
lg: { control: "input--lg" },
|
|
522
|
+
md: { control: "input--md" },
|
|
523
|
+
sm: { control: "input--sm" }
|
|
524
|
+
} }
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
//#endregion
|
|
528
|
+
//#region src/components/field/use-field.ts
|
|
529
|
+
const useField = () => {
|
|
530
|
+
const ctx = useContext(FieldContext);
|
|
531
|
+
if (!ctx) throw new Error("FieldContext must be used with in the Field component.");
|
|
532
|
+
return ctx;
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
//#endregion
|
|
536
|
+
//#region src/components/field/field.tsx
|
|
537
|
+
const Field$1 = ({ className, size, ...props }) => {
|
|
538
|
+
const slots = useMemo(() => fieldVariants({ size }), [size]);
|
|
539
|
+
console.log(slots.root());
|
|
540
|
+
return /* @__PURE__ */ jsx(FieldContext, {
|
|
541
|
+
value: { slots },
|
|
542
|
+
children: /* @__PURE__ */ jsx(Field.Root, {
|
|
543
|
+
className: cn$1(className, slots.root()),
|
|
544
|
+
...props
|
|
545
|
+
})
|
|
546
|
+
});
|
|
547
|
+
};
|
|
548
|
+
const FieldLabel = ({ className, ...props }) => {
|
|
549
|
+
const { slots } = useField();
|
|
550
|
+
return /* @__PURE__ */ jsx(Field.Label, {
|
|
551
|
+
className: cn$1(className, slots.label()),
|
|
552
|
+
...props
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
const FieldDescription = ({ className, ...props }) => {
|
|
556
|
+
const { slots } = useField();
|
|
557
|
+
return /* @__PURE__ */ jsx(Field.Description, {
|
|
558
|
+
className: cn$1(className, slots.description()),
|
|
559
|
+
...props
|
|
560
|
+
});
|
|
561
|
+
};
|
|
562
|
+
const FieldControl = ({ className, ...props }) => {
|
|
563
|
+
const { slots } = useField();
|
|
564
|
+
return /* @__PURE__ */ jsx(Field.Control, {
|
|
565
|
+
className: cn$1(className, slots.control()),
|
|
566
|
+
...props
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
const FieldError = ({ className, ...props }) => {
|
|
570
|
+
const { slots } = useField();
|
|
571
|
+
return /* @__PURE__ */ jsx(Field.Error, {
|
|
572
|
+
className: cn$1(slots.error(), className),
|
|
573
|
+
...props
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
Field$1.Control = FieldControl;
|
|
577
|
+
Field$1.Description = FieldDescription;
|
|
578
|
+
Field$1.Error = FieldError;
|
|
579
|
+
Field$1.Label = FieldLabel;
|
|
580
|
+
Field$1.Root = Field$1;
|
|
581
|
+
var field_default = Field$1;
|
|
582
|
+
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region src/components/form/form.variants.ts
|
|
585
|
+
const formVariants = tv({ base: "form" });
|
|
586
|
+
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region src/components/form/form.tsx
|
|
589
|
+
const Form = ({ className, ...props }) => {
|
|
590
|
+
return /* @__PURE__ */ jsx("form", {
|
|
591
|
+
className: cn$1(className, formVariants()),
|
|
592
|
+
...props
|
|
593
|
+
});
|
|
594
|
+
};
|
|
595
|
+
var form_default = Form;
|
|
596
|
+
|
|
597
|
+
//#endregion
|
|
598
|
+
//#region src/components/input/input.variants.ts
|
|
599
|
+
const inputVariants = tv({
|
|
600
|
+
base: "input",
|
|
601
|
+
variants: { inputSize: {
|
|
602
|
+
lg: "input--lg",
|
|
603
|
+
md: "input--md",
|
|
604
|
+
sm: "input--sm"
|
|
605
|
+
} }
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
//#endregion
|
|
609
|
+
//#region src/components/input/input.tsx
|
|
610
|
+
const Input$1 = ({ className, inputSize, ...props }) => {
|
|
611
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
612
|
+
className: cn$1(className, inputVariants({ inputSize })),
|
|
613
|
+
...props
|
|
614
|
+
});
|
|
615
|
+
};
|
|
616
|
+
var input_default = Input$1;
|
|
617
|
+
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region src/components/label/label.variants.ts
|
|
620
|
+
const labelVariants = tv({ base: "label" });
|
|
621
|
+
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/components/label/label.tsx
|
|
624
|
+
const Label = ({ className, ...props }) => {
|
|
625
|
+
return /* @__PURE__ */ jsx("label", {
|
|
626
|
+
className: cn$1(className, labelVariants()),
|
|
627
|
+
...props
|
|
628
|
+
});
|
|
629
|
+
};
|
|
630
|
+
var label_default = Label;
|
|
631
|
+
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region src/components/link/link.variants.ts
|
|
634
|
+
const linkVariants = tv({
|
|
635
|
+
base: "link",
|
|
636
|
+
defaultVariants: { variant: "no-underline" },
|
|
637
|
+
variants: { variant: {
|
|
638
|
+
"no-underline": "link--no-underline",
|
|
639
|
+
underline: "link--underline"
|
|
640
|
+
} }
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/components/link/link.tsx
|
|
645
|
+
const Link = ({ className, variant, ...props }) => {
|
|
646
|
+
return /* @__PURE__ */ jsx("a", {
|
|
647
|
+
className: cn$1(className, linkVariants({ variant })),
|
|
648
|
+
...props
|
|
649
|
+
});
|
|
650
|
+
};
|
|
651
|
+
var link_default = Link;
|
|
652
|
+
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region src/components/list/list.context.ts
|
|
655
|
+
const ListContext = createContext(null);
|
|
656
|
+
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region src/components/list/list.variants.ts
|
|
659
|
+
const listVariants = tv({ slots: {
|
|
660
|
+
item: "list__item",
|
|
661
|
+
root: "list"
|
|
662
|
+
} });
|
|
663
|
+
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region src/components/list/use-list.ts
|
|
666
|
+
const useList = () => {
|
|
667
|
+
const context = useContext(ListContext);
|
|
668
|
+
if (!context) throw new Error("useList must be used within a ListProvider");
|
|
669
|
+
return context;
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
//#endregion
|
|
673
|
+
//#region src/components/list/list.tsx
|
|
674
|
+
const List = ({ className, ...props }) => {
|
|
675
|
+
const slots = useMemo(() => listVariants(), []);
|
|
676
|
+
return /* @__PURE__ */ jsx(ListContext.Provider, {
|
|
677
|
+
value: { slots },
|
|
678
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
679
|
+
className: cn$1(className, slots.root()),
|
|
680
|
+
...props
|
|
681
|
+
})
|
|
682
|
+
});
|
|
683
|
+
};
|
|
684
|
+
const ListItem = ({ className, ...props }) => {
|
|
685
|
+
const { slots } = useList();
|
|
686
|
+
return /* @__PURE__ */ jsx("li", {
|
|
687
|
+
className: cn$1(className, slots.item()),
|
|
688
|
+
...props
|
|
689
|
+
});
|
|
690
|
+
};
|
|
691
|
+
List.Root = List;
|
|
692
|
+
List.Item = ListItem;
|
|
693
|
+
var list_default = List;
|
|
694
|
+
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region src/components/menu/menu.context.ts
|
|
697
|
+
const MenuContext = createContext(null);
|
|
698
|
+
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region src/components/menu/menu.variants.ts
|
|
701
|
+
const menuVariants = tv({ slots: {
|
|
702
|
+
arrow: "menu__arrow",
|
|
703
|
+
backdrop: "menu__backdrop",
|
|
704
|
+
checkboxItem: "menu__checkbox-item",
|
|
705
|
+
group: "menu__group",
|
|
706
|
+
groupLabel: "menu__group-label",
|
|
707
|
+
item: "menu__item",
|
|
708
|
+
popup: "menu__popup",
|
|
709
|
+
portal: "menu__portal",
|
|
710
|
+
positioner: "menu__positioner",
|
|
711
|
+
radioGroup: "menu__radio-group",
|
|
712
|
+
radioItem: "menu__radio-item",
|
|
713
|
+
root: "menu",
|
|
714
|
+
separator: "menu__separator",
|
|
715
|
+
submenu: "menu__submenu",
|
|
716
|
+
submenuTrigger: "menu__submenu__trigger",
|
|
717
|
+
trigger: "menu__trigger"
|
|
718
|
+
} });
|
|
719
|
+
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/components/menu/use-menu.ts
|
|
722
|
+
const useMenu = () => {
|
|
723
|
+
const context = useContext(MenuContext);
|
|
724
|
+
if (!context) throw new Error("useMenu must be used within a MenuProvider");
|
|
725
|
+
return context;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region src/components/menu/menu.tsx
|
|
730
|
+
const Menu$1 = ({ ...props }) => {
|
|
731
|
+
const slots = useMemo(() => menuVariants(), []);
|
|
732
|
+
return /* @__PURE__ */ jsx(MenuContext.Provider, {
|
|
733
|
+
value: { slots },
|
|
734
|
+
children: /* @__PURE__ */ jsx(Menu.Root, { ...props })
|
|
735
|
+
});
|
|
736
|
+
};
|
|
737
|
+
const MenuTrigger = ({ className, ...props }) => {
|
|
738
|
+
const { slots } = useMenu();
|
|
739
|
+
return /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
740
|
+
className: cn$1(slots.trigger(), className),
|
|
741
|
+
...props
|
|
742
|
+
});
|
|
743
|
+
};
|
|
744
|
+
const MenuPortal = ({ className, ...props }) => {
|
|
745
|
+
const { slots } = useMenu();
|
|
746
|
+
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
747
|
+
className: cn$1(slots.portal(), className),
|
|
748
|
+
...props
|
|
749
|
+
});
|
|
750
|
+
};
|
|
751
|
+
const MenuBackdrop = ({ className, ...props }) => {
|
|
752
|
+
const { slots } = useMenu();
|
|
753
|
+
return /* @__PURE__ */ jsx(Menu.Backdrop, {
|
|
754
|
+
className: cn$1(slots.backdrop(), className),
|
|
755
|
+
...props
|
|
756
|
+
});
|
|
757
|
+
};
|
|
758
|
+
const MenuPositioner = ({ className, ...props }) => {
|
|
759
|
+
const { slots } = useMenu();
|
|
760
|
+
return /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
761
|
+
className: cn$1(slots.positioner(), className),
|
|
762
|
+
...props
|
|
763
|
+
});
|
|
764
|
+
};
|
|
765
|
+
const MenuPopup = ({ className, ...props }) => {
|
|
766
|
+
const { slots } = useMenu();
|
|
767
|
+
return /* @__PURE__ */ jsx(Menu.Popup, {
|
|
768
|
+
className: cn$1(slots.popup(), className),
|
|
769
|
+
...props
|
|
770
|
+
});
|
|
771
|
+
};
|
|
772
|
+
const MenuArrow = ({ className, ...props }) => {
|
|
773
|
+
const { slots } = useMenu();
|
|
774
|
+
return /* @__PURE__ */ jsx(Menu.Arrow, {
|
|
775
|
+
className: cn$1(slots.arrow(), className),
|
|
776
|
+
...props
|
|
777
|
+
});
|
|
778
|
+
};
|
|
779
|
+
const MenuItem = ({ className, ...props }) => {
|
|
780
|
+
const { slots } = useMenu();
|
|
781
|
+
return /* @__PURE__ */ jsx(Menu.Item, {
|
|
782
|
+
className: cn$1(slots.item(), className),
|
|
783
|
+
...props
|
|
784
|
+
});
|
|
785
|
+
};
|
|
786
|
+
const MenuSeparator = ({ className, ...props }) => {
|
|
787
|
+
const { slots } = useMenu();
|
|
788
|
+
return /* @__PURE__ */ jsx(Menu.Separator, {
|
|
789
|
+
className: cn$1(slots.separator(), className),
|
|
790
|
+
...props
|
|
791
|
+
});
|
|
792
|
+
};
|
|
793
|
+
const MenuGroup = ({ className, ...props }) => {
|
|
794
|
+
const { slots } = useMenu();
|
|
795
|
+
return /* @__PURE__ */ jsx(Menu.Group, {
|
|
796
|
+
className: cn$1(slots.group(), className),
|
|
797
|
+
...props
|
|
798
|
+
});
|
|
799
|
+
};
|
|
800
|
+
const MenuGroupLabel = ({ className, ...props }) => {
|
|
801
|
+
const { slots } = useMenu();
|
|
802
|
+
return /* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
803
|
+
className: cn$1(slots.groupLabel(), className),
|
|
804
|
+
...props
|
|
805
|
+
});
|
|
806
|
+
};
|
|
807
|
+
const MenuRadioGroup = ({ className, ...props }) => {
|
|
808
|
+
const { slots } = useMenu();
|
|
809
|
+
return /* @__PURE__ */ jsx(Menu.RadioGroup, {
|
|
810
|
+
className: cn$1(slots.radioGroup(), className),
|
|
811
|
+
...props
|
|
812
|
+
});
|
|
813
|
+
};
|
|
814
|
+
const MenuRadioItem = ({ className, ...props }) => {
|
|
815
|
+
const { slots } = useMenu();
|
|
816
|
+
return /* @__PURE__ */ jsx(Menu.RadioItem, {
|
|
817
|
+
className: cn$1(slots.radioItem(), className),
|
|
818
|
+
...props
|
|
819
|
+
});
|
|
820
|
+
};
|
|
821
|
+
const MenuCheckboxItem = ({ className, ...props }) => {
|
|
822
|
+
const { slots } = useMenu();
|
|
823
|
+
return /* @__PURE__ */ jsx(Menu.CheckboxItem, {
|
|
824
|
+
className: cn$1(slots.checkboxItem(), className),
|
|
825
|
+
...props
|
|
826
|
+
});
|
|
827
|
+
};
|
|
828
|
+
const MenuSubmenu = ({ ...props }) => {
|
|
829
|
+
return /* @__PURE__ */ jsx(Menu.SubmenuRoot, { ...props });
|
|
830
|
+
};
|
|
831
|
+
const MenuSubmenuTrigger = ({ className, ...props }) => {
|
|
832
|
+
const { slots } = useMenu();
|
|
833
|
+
return /* @__PURE__ */ jsx(Menu.SubmenuTrigger, {
|
|
834
|
+
className: cn$1(slots.submenuTrigger(), className),
|
|
835
|
+
...props
|
|
836
|
+
});
|
|
837
|
+
};
|
|
838
|
+
Menu$1.Arrow = MenuArrow;
|
|
839
|
+
Menu$1.Backdrop = MenuBackdrop;
|
|
840
|
+
Menu$1.CheckboxItem = MenuCheckboxItem;
|
|
841
|
+
Menu$1.Group = MenuGroup;
|
|
842
|
+
Menu$1.GroupLabel = MenuGroupLabel;
|
|
843
|
+
Menu$1.Item = MenuItem;
|
|
844
|
+
Menu$1.Popup = MenuPopup;
|
|
845
|
+
Menu$1.Portal = MenuPortal;
|
|
846
|
+
Menu$1.Positioner = MenuPositioner;
|
|
847
|
+
Menu$1.RadioGroup = MenuRadioGroup;
|
|
848
|
+
Menu$1.RadioItem = MenuRadioItem;
|
|
849
|
+
Menu$1.Root = Menu$1;
|
|
850
|
+
Menu$1.Separator = MenuSeparator;
|
|
851
|
+
Menu$1.Submenu = MenuSubmenu;
|
|
852
|
+
Menu$1.SubmenuTrigger = MenuSubmenuTrigger;
|
|
853
|
+
Menu$1.Trigger = MenuTrigger;
|
|
854
|
+
var menu_default = Menu$1;
|
|
855
|
+
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region src/components/meter/meter.context.ts
|
|
858
|
+
const MeterContext = createContext(void 0);
|
|
859
|
+
|
|
860
|
+
//#endregion
|
|
861
|
+
//#region src/components/meter/meter.variants.ts
|
|
862
|
+
const meterVariants = tv({
|
|
863
|
+
slots: {
|
|
864
|
+
indicator: "meter__indicator",
|
|
865
|
+
label: "meter__label",
|
|
866
|
+
root: "meter",
|
|
867
|
+
track: "meter__track",
|
|
868
|
+
value: "meter__value"
|
|
869
|
+
},
|
|
870
|
+
variants: {
|
|
871
|
+
size: {
|
|
872
|
+
lg: { root: "meter--lg" },
|
|
873
|
+
md: { root: "meter--md" },
|
|
874
|
+
sm: { root: "meter--sm" }
|
|
875
|
+
},
|
|
876
|
+
variant: {
|
|
877
|
+
danger: { root: "meter--danger" },
|
|
878
|
+
primary: { root: "meter--primary" },
|
|
879
|
+
secondary: { root: "meter--secondary" },
|
|
880
|
+
success: { root: "meter--success" }
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
|
|
885
|
+
//#endregion
|
|
886
|
+
//#region src/components/meter/use-meter.ts
|
|
887
|
+
const useMeter = () => {
|
|
888
|
+
const context = useContext(MeterContext);
|
|
889
|
+
if (!context) throw new Error("useMeter must be used within a MeterProvider");
|
|
890
|
+
return context;
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region src/components/meter/meter.tsx
|
|
895
|
+
const Meter$1 = ({ className, size, variant, ...props }) => {
|
|
896
|
+
const slots = useMemo(() => meterVariants({
|
|
897
|
+
size,
|
|
898
|
+
variant
|
|
899
|
+
}), [size, variant]);
|
|
900
|
+
return /* @__PURE__ */ jsx(MeterContext, {
|
|
901
|
+
value: { slots },
|
|
902
|
+
children: /* @__PURE__ */ jsx(Meter.Root, {
|
|
903
|
+
className: cn$1(className, slots.root()),
|
|
904
|
+
...props
|
|
905
|
+
})
|
|
906
|
+
});
|
|
907
|
+
};
|
|
908
|
+
const MeterLabel = ({ className, ...props }) => {
|
|
909
|
+
const { slots } = useMeter();
|
|
910
|
+
return /* @__PURE__ */ jsx(Meter.Label, {
|
|
911
|
+
className: cn$1(className, slots.label()),
|
|
912
|
+
...props
|
|
913
|
+
});
|
|
914
|
+
};
|
|
915
|
+
const MeterValue = ({ className, ...props }) => {
|
|
916
|
+
const { slots } = useMeter();
|
|
917
|
+
return /* @__PURE__ */ jsx(Meter.Value, {
|
|
918
|
+
className: cn$1(className, slots.value()),
|
|
919
|
+
...props
|
|
920
|
+
});
|
|
921
|
+
};
|
|
922
|
+
const MeterTrack = ({ className, ...props }) => {
|
|
923
|
+
const { slots } = useMeter();
|
|
924
|
+
return /* @__PURE__ */ jsx(Meter.Track, {
|
|
925
|
+
className: cn$1(className, slots.track()),
|
|
926
|
+
...props
|
|
927
|
+
});
|
|
928
|
+
};
|
|
929
|
+
const MeterIndicator = ({ className, ...props }) => {
|
|
930
|
+
const { slots } = useMeter();
|
|
931
|
+
return /* @__PURE__ */ jsx(Meter.Indicator, {
|
|
932
|
+
className: cn$1(className, slots.indicator()),
|
|
933
|
+
...props
|
|
934
|
+
});
|
|
935
|
+
};
|
|
936
|
+
Meter$1.Indicator = MeterIndicator;
|
|
937
|
+
Meter$1.Label = MeterLabel;
|
|
938
|
+
Meter$1.Root = Meter$1;
|
|
939
|
+
Meter$1.Track = MeterTrack;
|
|
940
|
+
Meter$1.Value = MeterValue;
|
|
941
|
+
var meter_default = Meter$1;
|
|
942
|
+
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region src/components/navbar/navbar.context.ts
|
|
945
|
+
const NavbarContext = createContext(null);
|
|
946
|
+
|
|
947
|
+
//#endregion
|
|
948
|
+
//#region src/components/navbar/navbar.variants.ts
|
|
949
|
+
const navbarVariants = tv({ slots: {
|
|
950
|
+
container: "navbar__container",
|
|
951
|
+
content: "navbar__content",
|
|
952
|
+
list: "navbar__list",
|
|
953
|
+
listItem: "navbar__list-item",
|
|
954
|
+
menu: "navbar__menu",
|
|
955
|
+
menuItem: "navbar__menu-item",
|
|
956
|
+
root: "navbar",
|
|
957
|
+
toggle: "navbar__toggle"
|
|
958
|
+
} });
|
|
959
|
+
|
|
960
|
+
//#endregion
|
|
961
|
+
//#region src/components/navbar/use-navbar.ts
|
|
962
|
+
const useNavbar = () => {
|
|
963
|
+
const context = React.useContext(NavbarContext);
|
|
964
|
+
if (!context) throw new Error("useNavbar must be used within a NavbarProvider");
|
|
965
|
+
return context;
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
//#endregion
|
|
969
|
+
//#region src/components/navbar/navbar.tsx
|
|
970
|
+
const Navbar = ({ className, isOpen, onOpenChange, ...props }) => {
|
|
971
|
+
const slots = useMemo(() => navbarVariants(), []);
|
|
972
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
973
|
+
const open = isOpen ?? internalOpen;
|
|
974
|
+
const handleOpenChange = useCallback((next) => {
|
|
975
|
+
if (isOpen === void 0) setInternalOpen(next);
|
|
976
|
+
onOpenChange?.(next);
|
|
977
|
+
}, [isOpen, onOpenChange]);
|
|
978
|
+
return /* @__PURE__ */ jsx(NavbarContext.Provider, {
|
|
979
|
+
value: {
|
|
980
|
+
isOpen: open,
|
|
981
|
+
onOpenChange: handleOpenChange,
|
|
982
|
+
slots
|
|
983
|
+
},
|
|
984
|
+
children: /* @__PURE__ */ jsx("header", {
|
|
985
|
+
className: cn$1(slots.root(), className),
|
|
986
|
+
...props
|
|
987
|
+
})
|
|
988
|
+
});
|
|
989
|
+
};
|
|
990
|
+
const NavbarContainer = ({ className, ...props }) => {
|
|
991
|
+
const { slots } = useNavbar();
|
|
992
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
993
|
+
className: cn$1(slots.container(), className),
|
|
994
|
+
...props
|
|
995
|
+
});
|
|
996
|
+
};
|
|
997
|
+
const NavbarContent = ({ className, ...props }) => {
|
|
998
|
+
const { slots } = useNavbar();
|
|
999
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1000
|
+
className: cn$1(slots.content(), className),
|
|
1001
|
+
...props
|
|
1002
|
+
});
|
|
1003
|
+
};
|
|
1004
|
+
const NavbarList = ({ className, ...props }) => {
|
|
1005
|
+
const { slots } = useNavbar();
|
|
1006
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
1007
|
+
className: cn$1(slots.list(), className),
|
|
1008
|
+
...props
|
|
1009
|
+
});
|
|
1010
|
+
};
|
|
1011
|
+
const NavbarListItem = ({ className, ...props }) => {
|
|
1012
|
+
const { slots } = useNavbar();
|
|
1013
|
+
return /* @__PURE__ */ jsx("li", {
|
|
1014
|
+
className: cn$1(slots.listItem(), className),
|
|
1015
|
+
...props
|
|
1016
|
+
});
|
|
1017
|
+
};
|
|
1018
|
+
const NavbarToggle = ({ className, ...props }) => {
|
|
1019
|
+
const { slots, isOpen, onOpenChange } = useNavbar();
|
|
1020
|
+
const Icon = isOpen ? LucideX : LucideMenu;
|
|
1021
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1022
|
+
className: cn$1(className, slots.toggle()),
|
|
1023
|
+
onClick: () => onOpenChange(!isOpen),
|
|
1024
|
+
...props,
|
|
1025
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "size-5" })
|
|
1026
|
+
});
|
|
1027
|
+
};
|
|
1028
|
+
const NavbarMenu = ({ className, ...props }) => {
|
|
1029
|
+
const { slots, isOpen } = useNavbar();
|
|
1030
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
1031
|
+
className: cn$1(slots.menu(), className),
|
|
1032
|
+
"data-expanded": isOpen ? "true" : "false",
|
|
1033
|
+
...props
|
|
1034
|
+
});
|
|
1035
|
+
};
|
|
1036
|
+
const NavbarMenuItem = ({ className, ...props }) => {
|
|
1037
|
+
const { slots } = useNavbar();
|
|
1038
|
+
return /* @__PURE__ */ jsx("li", {
|
|
1039
|
+
className: cn$1(slots.menuItem(), className),
|
|
1040
|
+
...props
|
|
1041
|
+
});
|
|
1042
|
+
};
|
|
1043
|
+
Navbar.Root = Navbar;
|
|
1044
|
+
Navbar.Container = NavbarContainer;
|
|
1045
|
+
Navbar.Content = NavbarContent;
|
|
1046
|
+
Navbar.List = NavbarList;
|
|
1047
|
+
Navbar.ListItem = NavbarListItem;
|
|
1048
|
+
Navbar.Toggle = NavbarToggle;
|
|
1049
|
+
Navbar.Menu = NavbarMenu;
|
|
1050
|
+
Navbar.MenuItem = NavbarMenuItem;
|
|
1051
|
+
var navbar_default = Navbar;
|
|
1052
|
+
|
|
1053
|
+
//#endregion
|
|
1054
|
+
//#region src/components/separator/separator.variants.ts
|
|
1055
|
+
const separatorVariants = tv({
|
|
1056
|
+
base: "separator",
|
|
1057
|
+
defaultVariants: { orientation: "horizontal" },
|
|
1058
|
+
variants: { orientation: {
|
|
1059
|
+
horizontal: "separator--horizontal",
|
|
1060
|
+
vertical: "separator--vertical"
|
|
1061
|
+
} }
|
|
1062
|
+
});
|
|
1063
|
+
|
|
1064
|
+
//#endregion
|
|
1065
|
+
//#region src/components/separator/separator.tsx
|
|
1066
|
+
const Separator$1 = ({ className, orientation, ...props }) => {
|
|
1067
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
1068
|
+
className: cn$1(className, separatorVariants({ orientation })),
|
|
1069
|
+
...props
|
|
1070
|
+
});
|
|
1071
|
+
};
|
|
1072
|
+
var separator_default = Separator$1;
|
|
1073
|
+
|
|
1074
|
+
//#endregion
|
|
1075
|
+
//#region src/components/switch/switch.context.ts
|
|
1076
|
+
const SwitchContext = createContext(null);
|
|
1077
|
+
|
|
1078
|
+
//#endregion
|
|
1079
|
+
//#region src/components/switch/switch.variants.ts
|
|
1080
|
+
const switchVariants = tv({
|
|
1081
|
+
defaultVariants: { size: "md" },
|
|
1082
|
+
slots: {
|
|
1083
|
+
root: "switch",
|
|
1084
|
+
thumb: "switch__thumb"
|
|
1085
|
+
},
|
|
1086
|
+
variants: { size: {
|
|
1087
|
+
lg: { root: "switch--lg" },
|
|
1088
|
+
md: { root: "switch--md" },
|
|
1089
|
+
sm: { root: "switch--sm" }
|
|
1090
|
+
} }
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region src/components/switch/use-switch.ts
|
|
1095
|
+
const useSwitch = () => {
|
|
1096
|
+
const context = useContext(SwitchContext);
|
|
1097
|
+
if (!context) throw new Error("useSwitch must be used within a SwitchProvider");
|
|
1098
|
+
return context;
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
//#endregion
|
|
1102
|
+
//#region src/components/switch/switch.tsx
|
|
1103
|
+
const Switch$1 = ({ className, size, ...props }) => {
|
|
1104
|
+
const slots = useMemo(() => switchVariants({ size }), [size]);
|
|
1105
|
+
return /* @__PURE__ */ jsx(SwitchContext.Provider, {
|
|
1106
|
+
value: { slots },
|
|
1107
|
+
children: /* @__PURE__ */ jsx(Switch.Root, {
|
|
1108
|
+
className: cn$1(className, slots.root()),
|
|
1109
|
+
...props
|
|
1110
|
+
})
|
|
1111
|
+
});
|
|
1112
|
+
};
|
|
1113
|
+
const SwitchThumb = ({ className, ...props }) => {
|
|
1114
|
+
const { slots } = useSwitch();
|
|
1115
|
+
return /* @__PURE__ */ jsx(Switch.Thumb, {
|
|
1116
|
+
className: cn$1(className, slots.thumb()),
|
|
1117
|
+
...props
|
|
1118
|
+
});
|
|
1119
|
+
};
|
|
1120
|
+
Switch$1.Thumb = SwitchThumb;
|
|
1121
|
+
Switch$1.Root = Switch$1;
|
|
1122
|
+
var switch_default = Switch$1;
|
|
1123
|
+
|
|
1124
|
+
//#endregion
|
|
1125
|
+
//#region src/components/tabs/tabs.context.ts
|
|
1126
|
+
const TabsContext = createContext(null);
|
|
1127
|
+
|
|
1128
|
+
//#endregion
|
|
1129
|
+
//#region src/components/tabs/tabs.variants.ts
|
|
1130
|
+
const tabsVariants = tv({ slots: {
|
|
1131
|
+
indicator: "tabs__indicator",
|
|
1132
|
+
list: "tabs__list",
|
|
1133
|
+
panel: "tabs__panel",
|
|
1134
|
+
root: "tabs",
|
|
1135
|
+
tab: "tabs__tab"
|
|
1136
|
+
} });
|
|
1137
|
+
|
|
1138
|
+
//#endregion
|
|
1139
|
+
//#region src/components/tabs/use-tabs.ts
|
|
1140
|
+
const useTabs = () => {
|
|
1141
|
+
const context = useContext(TabsContext);
|
|
1142
|
+
if (!context) throw new Error("useTabs must be used within a TabsProvider");
|
|
1143
|
+
return context;
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
//#endregion
|
|
1147
|
+
//#region src/components/tabs/tabs.tsx
|
|
1148
|
+
const Tabs$1 = ({ className, ...props }) => {
|
|
1149
|
+
const slots = useMemo(() => tabsVariants(), []);
|
|
1150
|
+
return /* @__PURE__ */ jsx(TabsContext.Provider, {
|
|
1151
|
+
value: { slots },
|
|
1152
|
+
children: /* @__PURE__ */ jsx(Tabs.Root, {
|
|
1153
|
+
className: cn$1(className, slots.root()),
|
|
1154
|
+
...props
|
|
1155
|
+
})
|
|
1156
|
+
});
|
|
1157
|
+
};
|
|
1158
|
+
const TabsList = ({ className, ...props }) => {
|
|
1159
|
+
const { slots } = useTabs();
|
|
1160
|
+
return /* @__PURE__ */ jsx(Tabs.List, {
|
|
1161
|
+
className: cn$1(slots.list(), className),
|
|
1162
|
+
...props
|
|
1163
|
+
});
|
|
1164
|
+
};
|
|
1165
|
+
const TabsTab = ({ className, ...props }) => {
|
|
1166
|
+
const { slots } = useTabs();
|
|
1167
|
+
return /* @__PURE__ */ jsx(Tabs.Tab, {
|
|
1168
|
+
className: cn$1(slots.tab(), className),
|
|
1169
|
+
...props
|
|
1170
|
+
});
|
|
1171
|
+
};
|
|
1172
|
+
const TabsIndicator = ({ className, ...props }) => {
|
|
1173
|
+
const { slots } = useTabs();
|
|
1174
|
+
return /* @__PURE__ */ jsx(Tabs.Indicator, {
|
|
1175
|
+
className: cn$1(slots.indicator(), className),
|
|
1176
|
+
...props
|
|
1177
|
+
});
|
|
1178
|
+
};
|
|
1179
|
+
const TabsPanel = ({ className, ...props }) => {
|
|
1180
|
+
const { slots } = useTabs();
|
|
1181
|
+
return /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
1182
|
+
className: cn$1(slots.panel(), className),
|
|
1183
|
+
...props
|
|
1184
|
+
});
|
|
1185
|
+
};
|
|
1186
|
+
Tabs$1.List = TabsList;
|
|
1187
|
+
Tabs$1.Tab = TabsTab;
|
|
1188
|
+
Tabs$1.Indicator = TabsIndicator;
|
|
1189
|
+
Tabs$1.Panel = TabsPanel;
|
|
1190
|
+
Tabs$1.Root = Tabs$1;
|
|
1191
|
+
var tabs_default = Tabs$1;
|
|
1192
|
+
|
|
1193
|
+
//#endregion
|
|
1194
|
+
//#region src/components/text/text.variants.ts
|
|
1195
|
+
const textVariants = tv({ base: "text" });
|
|
1196
|
+
|
|
1197
|
+
//#endregion
|
|
1198
|
+
//#region src/components/text/text.tsx
|
|
1199
|
+
const Text = ({ className, ...props }) => {
|
|
1200
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1201
|
+
className: cn$1(textVariants(), className),
|
|
1202
|
+
"data-slot": "text",
|
|
1203
|
+
...props
|
|
1204
|
+
});
|
|
1205
|
+
};
|
|
1206
|
+
var text_default = Text;
|
|
1207
|
+
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region src/components/textarea/textarea.variants.ts
|
|
1210
|
+
const textareaVariants = tv({
|
|
1211
|
+
base: "textarea",
|
|
1212
|
+
extend: inputVariants
|
|
1213
|
+
});
|
|
1214
|
+
|
|
1215
|
+
//#endregion
|
|
1216
|
+
//#region src/components/textarea/textarea.tsx
|
|
1217
|
+
const Textarea = ({ className, ...props }) => {
|
|
1218
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
1219
|
+
className: cn$1(className, textareaVariants()),
|
|
1220
|
+
...props
|
|
1221
|
+
});
|
|
1222
|
+
};
|
|
1223
|
+
var textarea_default = Textarea;
|
|
1224
|
+
|
|
1225
|
+
//#endregion
|
|
1226
|
+
//#region src/components/toggle-button/toggle-button.variants.ts
|
|
1227
|
+
const toggleButtonVariants = tv({
|
|
1228
|
+
base: "toggle-button",
|
|
1229
|
+
extend: buttonVariants
|
|
1230
|
+
});
|
|
1231
|
+
|
|
1232
|
+
//#endregion
|
|
1233
|
+
//#region src/components/toggle-button/toggle-button.tsx
|
|
1234
|
+
const ToggleButton = ({ className, variant, size, ...props }) => {
|
|
1235
|
+
return /* @__PURE__ */ jsx(Toggle, {
|
|
1236
|
+
className: cn$1(className, toggleButtonVariants({
|
|
1237
|
+
size,
|
|
1238
|
+
variant
|
|
1239
|
+
})),
|
|
1240
|
+
...props
|
|
1241
|
+
});
|
|
1242
|
+
};
|
|
1243
|
+
var toggle_button_default = ToggleButton;
|
|
1244
|
+
|
|
1245
|
+
//#endregion
|
|
1246
|
+
export { accordion_default as Accordion, avatar_default as Avatar, button_default as Button, button_group_default as ButtonGroup, card_default as Card, checkbox_default as Checkbox, checkbox_group_default as CheckboxGroup, chip_default as Chip, container_default as Container, dialog_default as Dialog, field_default as Field, form_default as Form, input_default as Input, label_default as Label, link_default as Link, list_default as List, menu_default as Menu, meter_default as Meter, navbar_default as Navbar, separator_default as Separator, switch_default as Switch, tabs_default as Tabs, text_default as Text, textarea_default as Textarea, toggle_button_default as ToggleButton, accordionVariants, avatarVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxGroupVariants, checkboxVariants, chipVariants, cn, containerVariants, dialogVariants, fieldVariants, formVariants, inputVariants, labelVariants, linkVariants, listVariants, menuVariants, meterVariants, navbarVariants, separatorVariants, switchVariants, tabsVariants, textVariants, textareaVariants, toggleButtonVariants };
|
|
1247
|
+
//# sourceMappingURL=index.mjs.map
|