@arch-cadre/ui 0.0.10 → 0.0.15
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/build.config.ts +23 -0
- package/dist/components/.gitkeep +0 -0
- package/dist/components/accordion.cjs +62 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.mjs +58 -0
- package/dist/components/alert-dialog.cjs +127 -0
- package/dist/components/alert-dialog.d.ts +14 -0
- package/dist/components/alert-dialog.mjs +144 -0
- package/dist/components/alert.cjs +58 -0
- package/dist/components/alert.d.ts +9 -0
- package/dist/components/alert.mjs +62 -0
- package/dist/components/aspect-ratio.cjs +19 -0
- package/dist/components/aspect-ratio.d.ts +4 -0
- package/dist/components/aspect-ratio.mjs +9 -0
- package/dist/components/avatar.cjs +44 -0
- package/dist/components/avatar.d.ts +6 -0
- package/dist/components/avatar.mjs +50 -0
- package/dist/components/badge.cjs +41 -0
- package/dist/components/badge.d.ts +9 -0
- package/dist/components/badge.mjs +37 -0
- package/dist/components/breadcrumb.cjs +106 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.mjs +105 -0
- package/dist/components/button-group.cjs +65 -0
- package/dist/components/button-group.d.ts +12 -0
- package/dist/components/button-group.mjs +76 -0
- package/dist/components/button.cjs +57 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.mjs +51 -0
- package/dist/components/calendar.cjs +143 -0
- package/dist/components/calendar.d.ts +8 -0
- package/dist/components/calendar.mjs +191 -0
- package/dist/components/card.cjs +86 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/card.mjs +90 -0
- package/dist/components/checkbox.cjs +28 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.mjs +30 -0
- package/dist/components/collapsible.cjs +37 -0
- package/dist/components/collapsible.d.ts +6 -0
- package/dist/components/collapsible.mjs +31 -0
- package/dist/components/command.cjs +125 -0
- package/dist/components/command.d.ts +18 -0
- package/dist/components/command.mjs +169 -0
- package/dist/components/context-menu.cjs +188 -0
- package/dist/components/context-menu.d.ts +25 -0
- package/dist/components/context-menu.mjs +218 -0
- package/dist/components/dialog.cjs +123 -0
- package/dist/components/dialog.d.ts +15 -0
- package/dist/components/dialog.mjs +130 -0
- package/dist/components/drawer.cjs +118 -0
- package/dist/components/drawer.d.ts +13 -0
- package/dist/components/drawer.mjs +124 -0
- package/dist/components/dropdown-menu.cjs +190 -0
- package/dist/components/dropdown-menu.d.ts +25 -0
- package/dist/components/dropdown-menu.mjs +226 -0
- package/dist/components/empty.cjs +92 -0
- package/dist/components/empty.d.ts +12 -0
- package/dist/components/empty.mjs +102 -0
- package/dist/components/field.cjs +173 -0
- package/dist/components/field.d.ts +25 -0
- package/dist/components/field.mjs +228 -0
- package/dist/components/form.cjs +143 -0
- package/dist/components/form.d.ts +23 -0
- package/dist/components/form.mjs +123 -0
- package/dist/components/hover-card.cjs +46 -0
- package/dist/components/hover-card.d.ts +6 -0
- package/dist/components/hover-card.mjs +35 -0
- package/dist/components/input-group.cjs +130 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.mjs +155 -0
- package/dist/components/input-otp.cjs +69 -0
- package/dist/components/input-otp.d.ts +11 -0
- package/dist/components/input-otp.mjs +59 -0
- package/dist/components/input.cjs +22 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.mjs +19 -0
- package/dist/components/item.cjs +168 -0
- package/dist/components/item.d.ts +23 -0
- package/dist/components/item.mjs +187 -0
- package/dist/components/kbd.cjs +31 -0
- package/dist/components/kbd.d.ts +4 -0
- package/dist/components/kbd.mjs +28 -0
- package/dist/components/label.cjs +22 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.mjs +21 -0
- package/dist/components/language-switcher.cjs +43 -0
- package/dist/components/language-switcher.d.ts +2 -0
- package/dist/components/language-switcher.mjs +30 -0
- package/dist/components/menubar.cjs +207 -0
- package/dist/components/menubar.d.ts +26 -0
- package/dist/components/menubar.mjs +246 -0
- package/dist/components/navigation-menu.cjs +113 -0
- package/dist/components/navigation-menu.d.ts +14 -0
- package/dist/components/navigation-menu.mjs +166 -0
- package/dist/components/pagination.cjs +106 -0
- package/dist/components/pagination.d.ts +15 -0
- package/dist/components/pagination.mjs +116 -0
- package/dist/components/popover.cjs +53 -0
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.mjs +40 -0
- package/dist/components/progress.cjs +29 -0
- package/dist/components/progress.d.ts +4 -0
- package/dist/components/progress.mjs +30 -0
- package/dist/components/radio-group.cjs +39 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/radio-group.mjs +43 -0
- package/dist/components/scroll-area.cjs +45 -0
- package/dist/components/scroll-area.d.ts +7 -0
- package/dist/components/scroll-area.mjs +59 -0
- package/dist/components/select.cjs +140 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.mjs +173 -0
- package/dist/components/separator.cjs +26 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/separator.mjs +25 -0
- package/dist/components/sheet.cjs +120 -0
- package/dist/components/sheet.d.ts +13 -0
- package/dist/components/sheet.mjs +119 -0
- package/dist/components/sidebar.cjs +508 -0
- package/dist/components/sidebar.d.ts +69 -0
- package/dist/components/sidebar.mjs +635 -0
- package/dist/components/skeleton.cjs +20 -0
- package/dist/components/skeleton.d.ts +3 -0
- package/dist/components/skeleton.mjs +13 -0
- package/dist/components/slider.cjs +43 -0
- package/dist/components/slider.d.ts +4 -0
- package/dist/components/slider.mjs +59 -0
- package/dist/components/sonner.cjs +49 -0
- package/dist/components/sonner.d.ts +4 -0
- package/dist/components/sonner.mjs +36 -0
- package/dist/components/spinner.cjs +22 -0
- package/dist/components/spinner.d.ts +3 -0
- package/dist/components/spinner.mjs +15 -0
- package/dist/components/switch.cjs +25 -0
- package/dist/components/switch.d.ts +4 -0
- package/dist/components/switch.mjs +30 -0
- package/dist/components/table.cjs +101 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.mjs +115 -0
- package/dist/components/tabs.cjs +55 -0
- package/dist/components/tabs.d.ts +7 -0
- package/dist/components/tabs.mjs +63 -0
- package/dist/components/textarea.cjs +20 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.mjs +16 -0
- package/dist/components/toggle-group.cjs +65 -0
- package/dist/components/toggle-group.d.ts +9 -0
- package/dist/components/toggle-group.mjs +65 -0
- package/dist/components/toggle.cjs +47 -0
- package/dist/components/toggle.d.ts +9 -0
- package/dist/components/toggle.mjs +41 -0
- package/dist/components/tooltip.cjs +56 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.mjs +49 -0
- package/dist/hooks/.gitkeep +0 -0
- package/dist/hooks/use-mobile.cjs +23 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.mjs +17 -0
- package/dist/hooks/use-user.cjs +21 -0
- package/dist/hooks/use-user.d.ts +12 -0
- package/dist/hooks/use-user.mjs +12 -0
- package/dist/index.cjs +155 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +13 -0
- package/dist/lib/utils.cjs +11 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.mjs +5 -0
- package/dist/logo.cjs +49 -0
- package/dist/logo.d.ts +15 -0
- package/dist/logo.mjs +32 -0
- package/dist/postcss.config.cjs +13 -0
- package/dist/postcss.config.d.mts +3 -0
- package/dist/postcss.config.mjs +6 -0
- package/dist/providers/auth-provider.cjs +44 -0
- package/dist/providers/auth-provider.d.ts +15 -0
- package/dist/providers/auth-provider.mjs +37 -0
- package/dist/providers/index.cjs +47 -0
- package/dist/providers/index.d.ts +7 -0
- package/dist/providers/index.mjs +33 -0
- package/dist/shared/access-denied.cjs +38 -0
- package/dist/shared/access-denied.d.ts +2 -0
- package/dist/shared/access-denied.mjs +12 -0
- package/dist/shared/loader.cjs +95 -0
- package/dist/shared/loader.d.ts +11 -0
- package/dist/shared/loader.mjs +98 -0
- package/dist/shared/page-loader.cjs +23 -0
- package/dist/shared/page-loader.d.ts +7 -0
- package/dist/shared/page-loader.mjs +6 -0
- package/dist/shared/scroll-fade-effect.cjs +21 -0
- package/dist/shared/scroll-fade-effect.d.ts +4 -0
- package/dist/shared/scroll-fade-effect.mjs +20 -0
- package/dist/styles/globals.css +1 -0
- package/package.json +58 -49
- package/scripts/switchToDist.js +55 -0
- package/scripts/switchToSrc.js +52 -0
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +1 -1
- package/src/components/alert.tsx +1 -1
- package/src/components/aspect-ratio.tsx +2 -1
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +3 -3
- package/src/components/breadcrumb.tsx +5 -3
- package/src/components/button-group.tsx +4 -2
- package/src/components/button.tsx +3 -3
- package/src/components/calendar.tsx +2 -2
- package/src/components/checkbox.tsx +2 -2
- package/src/components/collapsible.tsx +2 -1
- package/src/components/command.tsx +1 -1
- package/src/components/context-menu.tsx +2 -2
- package/src/components/dialog.tsx +2 -2
- package/src/components/dropdown-menu.tsx +2 -2
- package/src/components/empty.tsx +1 -0
- package/src/components/field.tsx +5 -2
- package/src/components/form.tsx +9 -7
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/item.tsx +3 -3
- package/src/components/kbd.tsx +1 -0
- package/src/components/label.tsx +1 -1
- package/src/components/language-switcher.tsx +16 -17
- package/src/components/menubar.tsx +2 -2
- package/src/components/navigation-menu.tsx +2 -2
- package/src/components/pagination.tsx +5 -2
- package/src/components/popover.tsx +1 -1
- package/src/components/progress.tsx +1 -1
- package/src/components/radio-group.tsx +2 -2
- package/src/components/scroll-area.tsx +1 -1
- package/src/components/select.tsx +2 -2
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +2 -2
- package/src/components/sidebar.tsx +6 -6
- package/src/components/skeleton.tsx +1 -0
- package/src/components/slider.tsx +1 -1
- package/src/components/sonner.tsx +1 -0
- package/src/components/spinner.tsx +1 -0
- package/src/components/switch.tsx +1 -1
- package/src/components/tabs.tsx +1 -1
- package/src/components/toggle-group.tsx +2 -2
- package/src/components/toggle.tsx +2 -2
- package/src/components/tooltip.tsx +1 -1
- package/src/hooks/use-user.ts +2 -2
- package/src/index.ts +8 -5
- package/src/logo.tsx +1 -0
- package/src/providers/auth-provider.tsx +7 -6
- package/src/providers/index.tsx +1 -0
- package/src/shared/access-denied.tsx +1 -0
- package/src/shared/loader.tsx +2 -1
- package/src/shared/page-loader.tsx +1 -0
- package/src/shared/scroll-fade-effect.tsx +1 -1
- package/src/styles/globals.css +258 -244
- package/biome.json +0 -38
- package/src/components/carousel.tsx +0 -241
- package/src/components/chart.tsx +0 -357
- package/tsconfig.build.json +0 -16
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Slot as SlotPrimitive } from "radix-ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
Controller,
|
|
6
|
+
FormProvider,
|
|
7
|
+
useFormContext,
|
|
8
|
+
useFormState
|
|
9
|
+
} from "react-hook-form";
|
|
10
|
+
import { cn } from "../lib/utils.mjs";
|
|
11
|
+
import { Label } from "./label.mjs";
|
|
12
|
+
const Form = FormProvider;
|
|
13
|
+
const FormFieldContext = React.createContext(
|
|
14
|
+
{}
|
|
15
|
+
);
|
|
16
|
+
const FormField = ({
|
|
17
|
+
...props
|
|
18
|
+
}) => {
|
|
19
|
+
return /* @__PURE__ */ React.createElement(FormFieldContext.Provider, { value: { name: props.name } }, /* @__PURE__ */ React.createElement(Controller, { ...props }));
|
|
20
|
+
};
|
|
21
|
+
const useFormField = () => {
|
|
22
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
23
|
+
const itemContext = React.useContext(FormItemContext);
|
|
24
|
+
const { getFieldState } = useFormContext();
|
|
25
|
+
const formState = useFormState({ name: fieldContext.name });
|
|
26
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
27
|
+
if (!fieldContext) {
|
|
28
|
+
throw new Error("useFormField should be used within <FormField>");
|
|
29
|
+
}
|
|
30
|
+
const { id } = itemContext;
|
|
31
|
+
return {
|
|
32
|
+
id,
|
|
33
|
+
name: fieldContext.name,
|
|
34
|
+
formItemId: `${id}-form-item`,
|
|
35
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
36
|
+
formMessageId: `${id}-form-item-message`,
|
|
37
|
+
...fieldState
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const FormItemContext = React.createContext(
|
|
41
|
+
{}
|
|
42
|
+
);
|
|
43
|
+
function FormItem({ className, ...props }) {
|
|
44
|
+
const id = React.useId();
|
|
45
|
+
return /* @__PURE__ */ React.createElement(FormItemContext.Provider, { value: { id } }, /* @__PURE__ */ React.createElement(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
"data-slot": "form-item",
|
|
49
|
+
className: cn("grid gap-2", className),
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
));
|
|
53
|
+
}
|
|
54
|
+
function FormLabel({
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
const { error, formItemId } = useFormField();
|
|
59
|
+
return /* @__PURE__ */ React.createElement(
|
|
60
|
+
Label,
|
|
61
|
+
{
|
|
62
|
+
"data-slot": "form-label",
|
|
63
|
+
"data-error": !!error,
|
|
64
|
+
className: cn("data-[error=true]:text-destructive", className),
|
|
65
|
+
htmlFor: formItemId,
|
|
66
|
+
...props
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function FormControl({
|
|
71
|
+
...props
|
|
72
|
+
}) {
|
|
73
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
74
|
+
return /* @__PURE__ */ React.createElement(
|
|
75
|
+
SlotPrimitive.Slot,
|
|
76
|
+
{
|
|
77
|
+
"data-slot": "form-control",
|
|
78
|
+
id: formItemId,
|
|
79
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
80
|
+
"aria-invalid": !!error,
|
|
81
|
+
...props
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function FormDescription({ className, ...props }) {
|
|
86
|
+
const { formDescriptionId } = useFormField();
|
|
87
|
+
return /* @__PURE__ */ React.createElement(
|
|
88
|
+
"p",
|
|
89
|
+
{
|
|
90
|
+
"data-slot": "form-description",
|
|
91
|
+
id: formDescriptionId,
|
|
92
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
93
|
+
...props
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function FormMessage({ className, ...props }) {
|
|
98
|
+
const { error, formMessageId } = useFormField();
|
|
99
|
+
const body = error ? String(error?.message ?? "") : props.children;
|
|
100
|
+
if (!body) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
return /* @__PURE__ */ React.createElement(
|
|
104
|
+
"p",
|
|
105
|
+
{
|
|
106
|
+
"data-slot": "form-message",
|
|
107
|
+
id: formMessageId,
|
|
108
|
+
className: cn("text-destructive text-sm", className),
|
|
109
|
+
...props
|
|
110
|
+
},
|
|
111
|
+
body
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
useFormField,
|
|
116
|
+
Form,
|
|
117
|
+
FormItem,
|
|
118
|
+
FormLabel,
|
|
119
|
+
FormControl,
|
|
120
|
+
FormDescription,
|
|
121
|
+
FormMessage,
|
|
122
|
+
FormField
|
|
123
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.HoverCard = HoverCard;
|
|
8
|
+
exports.HoverCardContent = HoverCardContent;
|
|
9
|
+
exports.HoverCardTrigger = HoverCardTrigger;
|
|
10
|
+
var _radixUi = require("radix-ui");
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _utils = require("../lib/utils.cjs");
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
function HoverCard({
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
return /* @__PURE__ */React.createElement(_radixUi.HoverCard.Root, {
|
|
19
|
+
"data-slot": "hover-card",
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function HoverCardTrigger({
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */React.createElement(_radixUi.HoverCard.Trigger, {
|
|
27
|
+
"data-slot": "hover-card-trigger",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function HoverCardContent({
|
|
32
|
+
className,
|
|
33
|
+
align = "center",
|
|
34
|
+
sideOffset = 4,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */React.createElement(_radixUi.HoverCard.Portal, {
|
|
38
|
+
"data-slot": "hover-card-portal"
|
|
39
|
+
}, /* @__PURE__ */React.createElement(_radixUi.HoverCard.Content, {
|
|
40
|
+
"data-slot": "hover-card-content",
|
|
41
|
+
align,
|
|
42
|
+
sideOffset,
|
|
43
|
+
className: (0, _utils.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className),
|
|
44
|
+
...props
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HoverCard as HoverCardPrimitive } from "radix-ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare function HoverCard({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function HoverCardTrigger({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function HoverCardContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof HoverCardPrimitive.Content>): React.JSX.Element;
|
|
6
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { HoverCard as HoverCardPrimitive } from "radix-ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/utils.mjs";
|
|
5
|
+
function HoverCard({
|
|
6
|
+
...props
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ React.createElement(HoverCardPrimitive.Root, { "data-slot": "hover-card", ...props });
|
|
9
|
+
}
|
|
10
|
+
function HoverCardTrigger({
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ React.createElement(HoverCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", ...props });
|
|
14
|
+
}
|
|
15
|
+
function HoverCardContent({
|
|
16
|
+
className,
|
|
17
|
+
align = "center",
|
|
18
|
+
sideOffset = 4,
|
|
19
|
+
...props
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ React.createElement(HoverCardPrimitive.Portal, { "data-slot": "hover-card-portal" }, /* @__PURE__ */ React.createElement(
|
|
22
|
+
HoverCardPrimitive.Content,
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "hover-card-content",
|
|
25
|
+
align,
|
|
26
|
+
sideOffset,
|
|
27
|
+
className: cn(
|
|
28
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props
|
|
32
|
+
}
|
|
33
|
+
));
|
|
34
|
+
}
|
|
35
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.InputGroup = InputGroup;
|
|
8
|
+
exports.InputGroupAddon = InputGroupAddon;
|
|
9
|
+
exports.InputGroupButton = InputGroupButton;
|
|
10
|
+
exports.InputGroupInput = InputGroupInput;
|
|
11
|
+
exports.InputGroupText = InputGroupText;
|
|
12
|
+
exports.InputGroupTextarea = InputGroupTextarea;
|
|
13
|
+
var _classVarianceAuthority = require("class-variance-authority");
|
|
14
|
+
var React = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _utils = require("../lib/utils.cjs");
|
|
16
|
+
var _button = require("./button.cjs");
|
|
17
|
+
var _input = require("./input.cjs");
|
|
18
|
+
var _textarea = require("./textarea.cjs");
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
function InputGroup({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
26
|
+
"data-slot": "input-group",
|
|
27
|
+
role: "group",
|
|
28
|
+
className: (0, _utils.cn)("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none", "h-9 min-w-0 has-[>textarea]:h-auto",
|
|
29
|
+
// Variants based on alignment.
|
|
30
|
+
"has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
|
31
|
+
// Focus state.
|
|
32
|
+
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
|
|
33
|
+
// Error state.
|
|
34
|
+
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const inputGroupAddonVariants = (0, _classVarianceAuthority.cva)("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50", {
|
|
39
|
+
variants: {
|
|
40
|
+
align: {
|
|
41
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
42
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
43
|
+
"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
|
|
44
|
+
"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
align: "inline-start"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
function InputGroupAddon({
|
|
52
|
+
className,
|
|
53
|
+
align = "inline-start",
|
|
54
|
+
...props
|
|
55
|
+
}) {
|
|
56
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
57
|
+
role: "group",
|
|
58
|
+
"data-slot": "input-group-addon",
|
|
59
|
+
"data-align": align,
|
|
60
|
+
className: (0, _utils.cn)(inputGroupAddonVariants({
|
|
61
|
+
align
|
|
62
|
+
}), className),
|
|
63
|
+
onClick: e => {
|
|
64
|
+
if (e.target.closest("button")) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
68
|
+
},
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const inputGroupButtonVariants = (0, _classVarianceAuthority.cva)("text-sm shadow-none flex gap-2 items-center", {
|
|
73
|
+
variants: {
|
|
74
|
+
size: {
|
|
75
|
+
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
76
|
+
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
77
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
78
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
defaultVariants: {
|
|
82
|
+
size: "xs"
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
function InputGroupButton({
|
|
86
|
+
className,
|
|
87
|
+
type = "button",
|
|
88
|
+
variant = "ghost",
|
|
89
|
+
size = "xs",
|
|
90
|
+
...props
|
|
91
|
+
}) {
|
|
92
|
+
return /* @__PURE__ */React.createElement(_button.Button, {
|
|
93
|
+
type,
|
|
94
|
+
"data-size": size,
|
|
95
|
+
variant,
|
|
96
|
+
className: (0, _utils.cn)(inputGroupButtonVariants({
|
|
97
|
+
size
|
|
98
|
+
}), className),
|
|
99
|
+
...props
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function InputGroupText({
|
|
103
|
+
className,
|
|
104
|
+
...props
|
|
105
|
+
}) {
|
|
106
|
+
return /* @__PURE__ */React.createElement("span", {
|
|
107
|
+
className: (0, _utils.cn)("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
108
|
+
...props
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function InputGroupInput({
|
|
112
|
+
className,
|
|
113
|
+
...props
|
|
114
|
+
}) {
|
|
115
|
+
return /* @__PURE__ */React.createElement(_input.Input, {
|
|
116
|
+
"data-slot": "input-group-control",
|
|
117
|
+
className: (0, _utils.cn)("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent", className),
|
|
118
|
+
...props
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function InputGroupTextarea({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}) {
|
|
125
|
+
return /* @__PURE__ */React.createElement(_textarea.Textarea, {
|
|
126
|
+
"data-slot": "input-group-control",
|
|
127
|
+
className: (0, _utils.cn)("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent", className),
|
|
128
|
+
...props
|
|
129
|
+
});
|
|
130
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Button } from "./button";
|
|
4
|
+
declare function InputGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
5
|
+
declare const inputGroupAddonVariants: (props?: ({
|
|
6
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
|
|
9
|
+
declare const inputGroupButtonVariants: (props?: ({
|
|
10
|
+
size?: "sm" | "icon-sm" | "xs" | "icon-xs" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
12
|
+
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, "size"> & VariantProps<typeof inputGroupButtonVariants>): React.JSX.Element;
|
|
13
|
+
declare function InputGroupText({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
14
|
+
declare function InputGroupInput({ className, ...props }: React.ComponentProps<"input">): React.JSX.Element;
|
|
15
|
+
declare function InputGroupTextarea({ className, ...props }: React.ComponentProps<"textarea">): React.JSX.Element;
|
|
16
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupInput, InputGroupTextarea, };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/utils.mjs";
|
|
5
|
+
import { Button } from "./button.mjs";
|
|
6
|
+
import { Input } from "./input.mjs";
|
|
7
|
+
import { Textarea } from "./textarea.mjs";
|
|
8
|
+
function InputGroup({ className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ React.createElement(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
"data-slot": "input-group",
|
|
13
|
+
role: "group",
|
|
14
|
+
className: cn(
|
|
15
|
+
"group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none",
|
|
16
|
+
"h-9 min-w-0 has-[>textarea]:h-auto",
|
|
17
|
+
// Variants based on alignment.
|
|
18
|
+
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
19
|
+
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
|
20
|
+
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
|
|
21
|
+
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
|
22
|
+
// Focus state.
|
|
23
|
+
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
|
|
24
|
+
// Error state.
|
|
25
|
+
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
26
|
+
className
|
|
27
|
+
),
|
|
28
|
+
...props
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
const inputGroupAddonVariants = cva(
|
|
33
|
+
"text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
|
|
34
|
+
{
|
|
35
|
+
variants: {
|
|
36
|
+
align: {
|
|
37
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
38
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
39
|
+
"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
|
|
40
|
+
"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
align: "inline-start"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
function InputGroupAddon({
|
|
49
|
+
className,
|
|
50
|
+
align = "inline-start",
|
|
51
|
+
...props
|
|
52
|
+
}) {
|
|
53
|
+
return /* @__PURE__ */ React.createElement(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
role: "group",
|
|
57
|
+
"data-slot": "input-group-addon",
|
|
58
|
+
"data-align": align,
|
|
59
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
60
|
+
onClick: (e) => {
|
|
61
|
+
if (e.target.closest("button")) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
65
|
+
},
|
|
66
|
+
...props
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
const inputGroupButtonVariants = cva(
|
|
71
|
+
"text-sm shadow-none flex gap-2 items-center",
|
|
72
|
+
{
|
|
73
|
+
variants: {
|
|
74
|
+
size: {
|
|
75
|
+
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
76
|
+
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
77
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
78
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
defaultVariants: {
|
|
82
|
+
size: "xs"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
function InputGroupButton({
|
|
87
|
+
className,
|
|
88
|
+
type = "button",
|
|
89
|
+
variant = "ghost",
|
|
90
|
+
size = "xs",
|
|
91
|
+
...props
|
|
92
|
+
}) {
|
|
93
|
+
return /* @__PURE__ */ React.createElement(
|
|
94
|
+
Button,
|
|
95
|
+
{
|
|
96
|
+
type,
|
|
97
|
+
"data-size": size,
|
|
98
|
+
variant,
|
|
99
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
100
|
+
...props
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
function InputGroupText({ className, ...props }) {
|
|
105
|
+
return /* @__PURE__ */ React.createElement(
|
|
106
|
+
"span",
|
|
107
|
+
{
|
|
108
|
+
className: cn(
|
|
109
|
+
"text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
110
|
+
className
|
|
111
|
+
),
|
|
112
|
+
...props
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
function InputGroupInput({
|
|
117
|
+
className,
|
|
118
|
+
...props
|
|
119
|
+
}) {
|
|
120
|
+
return /* @__PURE__ */ React.createElement(
|
|
121
|
+
Input,
|
|
122
|
+
{
|
|
123
|
+
"data-slot": "input-group-control",
|
|
124
|
+
className: cn(
|
|
125
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
126
|
+
className
|
|
127
|
+
),
|
|
128
|
+
...props
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
function InputGroupTextarea({
|
|
133
|
+
className,
|
|
134
|
+
...props
|
|
135
|
+
}) {
|
|
136
|
+
return /* @__PURE__ */ React.createElement(
|
|
137
|
+
Textarea,
|
|
138
|
+
{
|
|
139
|
+
"data-slot": "input-group-control",
|
|
140
|
+
className: cn(
|
|
141
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
142
|
+
className
|
|
143
|
+
),
|
|
144
|
+
...props
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
InputGroup,
|
|
150
|
+
InputGroupAddon,
|
|
151
|
+
InputGroupButton,
|
|
152
|
+
InputGroupText,
|
|
153
|
+
InputGroupInput,
|
|
154
|
+
InputGroupTextarea
|
|
155
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.InputOTP = InputOTP;
|
|
8
|
+
exports.InputOTPGroup = InputOTPGroup;
|
|
9
|
+
exports.InputOTPSeparator = InputOTPSeparator;
|
|
10
|
+
exports.InputOTPSlot = InputOTPSlot;
|
|
11
|
+
var _inputOtp = require("input-otp");
|
|
12
|
+
var _lucideReact = require("lucide-react");
|
|
13
|
+
var React = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _utils = require("../lib/utils.cjs");
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
function InputOTP({
|
|
18
|
+
className,
|
|
19
|
+
containerClassName,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */React.createElement(_inputOtp.OTPInput, {
|
|
23
|
+
"data-slot": "input-otp",
|
|
24
|
+
containerClassName: (0, _utils.cn)("flex items-center gap-2 has-disabled:opacity-50", containerClassName),
|
|
25
|
+
className: (0, _utils.cn)("disabled:cursor-not-allowed", className),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function InputOTPGroup({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
34
|
+
"data-slot": "input-otp-group",
|
|
35
|
+
className: (0, _utils.cn)("flex items-center", className),
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function InputOTPSlot({
|
|
40
|
+
index,
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}) {
|
|
44
|
+
const inputOTPContext = React.useContext(_inputOtp.OTPInputContext);
|
|
45
|
+
const {
|
|
46
|
+
char,
|
|
47
|
+
hasFakeCaret,
|
|
48
|
+
isActive
|
|
49
|
+
} = inputOTPContext?.slots[index] ?? {};
|
|
50
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
51
|
+
"data-slot": "input-otp-slot",
|
|
52
|
+
"data-active": isActive,
|
|
53
|
+
className: (0, _utils.cn)("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]", className),
|
|
54
|
+
...props
|
|
55
|
+
}, char, hasFakeCaret && /* @__PURE__ */React.createElement("div", {
|
|
56
|
+
className: "pointer-events-none absolute inset-0 flex items-center justify-center"
|
|
57
|
+
}, /* @__PURE__ */React.createElement("div", {
|
|
58
|
+
className: "animate-caret-blink bg-foreground h-4 w-px duration-1000"
|
|
59
|
+
})));
|
|
60
|
+
}
|
|
61
|
+
function InputOTPSeparator({
|
|
62
|
+
...props
|
|
63
|
+
}) {
|
|
64
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
65
|
+
"data-slot": "input-otp-separator",
|
|
66
|
+
role: "separator",
|
|
67
|
+
...props
|
|
68
|
+
}, /* @__PURE__ */React.createElement(_lucideReact.MinusIcon, null));
|
|
69
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OTPInput } from "input-otp";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare function InputOTP({ className, containerClassName, ...props }: React.ComponentProps<typeof OTPInput> & {
|
|
4
|
+
containerClassName?: string;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
declare function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare function InputOTPSlot({ index, className, ...props }: React.ComponentProps<"div"> & {
|
|
8
|
+
index: number;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare function InputOTPSeparator({ ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
3
|
+
import { MinusIcon } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../lib/utils.mjs";
|
|
6
|
+
function InputOTP({
|
|
7
|
+
className,
|
|
8
|
+
containerClassName,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ React.createElement(
|
|
12
|
+
OTPInput,
|
|
13
|
+
{
|
|
14
|
+
"data-slot": "input-otp",
|
|
15
|
+
containerClassName: cn(
|
|
16
|
+
"flex items-center gap-2 has-disabled:opacity-50",
|
|
17
|
+
containerClassName
|
|
18
|
+
),
|
|
19
|
+
className: cn("disabled:cursor-not-allowed", className),
|
|
20
|
+
...props
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function InputOTPGroup({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ React.createElement(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
"data-slot": "input-otp-group",
|
|
29
|
+
className: cn("flex items-center", className),
|
|
30
|
+
...props
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function InputOTPSlot({
|
|
35
|
+
index,
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}) {
|
|
39
|
+
const inputOTPContext = React.useContext(OTPInputContext);
|
|
40
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
|
41
|
+
return /* @__PURE__ */ React.createElement(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "input-otp-slot",
|
|
45
|
+
"data-active": isActive,
|
|
46
|
+
className: cn(
|
|
47
|
+
"data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
...props
|
|
51
|
+
},
|
|
52
|
+
char,
|
|
53
|
+
hasFakeCaret && /* @__PURE__ */ React.createElement("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center" }, /* @__PURE__ */ React.createElement("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }))
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function InputOTPSeparator({ ...props }) {
|
|
57
|
+
return /* @__PURE__ */ React.createElement("div", { "data-slot": "input-otp-separator", role: "separator", ...props }, /* @__PURE__ */ React.createElement(MinusIcon, null));
|
|
58
|
+
}
|
|
59
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|