@aaas-pro/library 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -2
- package/dist/components/address-picker.d.ts +18 -0
- package/dist/components/address-picker.js +46 -0
- package/dist/components/card-date-filter.d.ts +12 -0
- package/dist/components/card-date-filter.js +95 -0
- package/dist/components/date-time-picker.d.ts +12 -0
- package/dist/components/date-time-picker.js +96 -0
- package/dist/components/detail-dialog.d.ts +48 -0
- package/dist/components/detail-dialog.js +97 -0
- package/dist/components/document-links.d.ts +13 -0
- package/dist/components/document-links.js +19 -0
- package/dist/components/draft-row-actions.d.ts +14 -0
- package/dist/components/draft-row-actions.js +70 -0
- package/dist/components/error-boundary.d.ts +14 -0
- package/dist/components/error-boundary.js +35 -0
- package/dist/components/glow-card.d.ts +13 -0
- package/dist/components/glow-card.js +48 -0
- package/dist/components/org-picker.d.ts +17 -0
- package/dist/components/org-picker.js +56 -0
- package/dist/components/overflow-row-actions.d.ts +29 -0
- package/dist/components/overflow-row-actions.js +135 -0
- package/dist/components/page-header.d.ts +21 -0
- package/dist/components/page-header.js +21 -0
- package/dist/components/permission-button.d.ts +4 -0
- package/dist/components/permission-button.js +17 -0
- package/dist/components/permission-context.d.ts +12 -0
- package/dist/components/permission-context.js +17 -0
- package/dist/components/person-picker.d.ts +20 -0
- package/dist/components/person-picker.js +38 -0
- package/dist/components/process-flow-bar.d.ts +15 -0
- package/dist/components/process-flow-bar.js +19 -0
- package/dist/components/product-picker.d.ts +19 -0
- package/dist/components/product-picker.js +155 -0
- package/dist/components/ref-doc-picker.d.ts +24 -0
- package/dist/components/ref-doc-picker.js +139 -0
- package/dist/components/scroll-to-top.d.ts +1 -0
- package/dist/components/scroll-to-top.js +20 -0
- package/dist/components/state-view.d.ts +26 -0
- package/dist/components/state-view.js +75 -0
- package/dist/components/theme-switcher.d.ts +27 -0
- package/dist/components/theme-switcher.js +77 -0
- package/dist/components/time-filter.d.ts +7 -0
- package/dist/components/time-filter.js +65 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +64 -0
- package/dist/components/ui/alert-dialog.d.ts +15 -0
- package/dist/components/ui/alert-dialog.js +160 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/alert.js +66 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/aspect-ratio.js +10 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/avatar.js +53 -0
- package/dist/components/ui/badge.d.ts +12 -0
- package/dist/components/ui/badge.js +44 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb.js +103 -0
- package/dist/components/ui/button-group.d.ts +14 -0
- package/dist/components/ui/button-group.js +76 -0
- package/dist/components/ui/button.d.ts +20 -0
- package/dist/components/ui/button.js +93 -0
- package/dist/components/ui/calendar.d.ts +73 -0
- package/dist/components/ui/calendar.js +103 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.js +90 -0
- package/dist/components/ui/carousel.d.ts +14 -0
- package/dist/components/ui/carousel.js +200 -0
- package/dist/components/ui/chart.d.ts +43 -0
- package/dist/components/ui/chart.js +252 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +34 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/command.js +170 -0
- package/dist/components/ui/context-menu.d.ts +26 -0
- package/dist/components/ui/context-menu.js +237 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +139 -0
- package/dist/components/ui/drawer.d.ts +13 -0
- package/dist/components/ui/drawer.js +129 -0
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.js +245 -0
- package/dist/components/ui/empty.d.ts +14 -0
- package/dist/components/ui/empty.js +102 -0
- package/dist/components/ui/field.d.ts +27 -0
- package/dist/components/ui/field.js +229 -0
- package/dist/components/ui/form.d.ts +26 -0
- package/dist/components/ui/form.js +118 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.js +39 -0
- package/dist/components/ui/input-group.d.ts +22 -0
- package/dist/components/ui/input-group.js +156 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input-otp.js +66 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +21 -0
- package/dist/components/ui/item.d.ts +29 -0
- package/dist/components/ui/item.js +187 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +31 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +22 -0
- package/dist/components/ui/menubar.d.ts +26 -0
- package/dist/components/ui/menubar.js +252 -0
- package/dist/components/ui/navigation-menu.d.ts +17 -0
- package/dist/components/ui/navigation-menu.js +170 -0
- package/dist/components/ui/pagination.d.ts +13 -0
- package/dist/components/ui/pagination.js +118 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.js +47 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/progress.js +34 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +45 -0
- package/dist/components/ui/resizable.d.ts +7 -0
- package/dist/components/ui/resizable.js +49 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +60 -0
- package/dist/components/ui/select.d.ts +17 -0
- package/dist/components/ui/select.js +215 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +26 -0
- package/dist/components/ui/sheet.d.ts +13 -0
- package/dist/components/ui/sheet.js +127 -0
- package/dist/components/ui/sidebar.d.ts +72 -0
- package/dist/components/ui/sidebar.js +656 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.js +63 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/sonner.js +34 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/spinner.js +17 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +31 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +114 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.js +67 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +18 -0
- package/dist/components/ui/toggle-group.d.ts +9 -0
- package/dist/components/ui/toggle-group.js +68 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/toggle.js +43 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +56 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/icons/index.d.ts +57 -0
- package/dist/icons/index.js +115 -0
- package/dist/icons/paths.d.ts +556 -0
- package/dist/icons/paths.js +231 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +399 -0
- package/dist/internal/selection-base.d.ts +37 -0
- package/dist/internal/selection-base.js +40 -0
- package/dist/lib/class-names.d.ts +6 -0
- package/dist/lib/class-names.js +159 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +7 -0
- package/dist/lib/variants.d.ts +21 -0
- package/dist/lib/variants.js +21 -0
- package/dist/primitives/accordion.d.ts +29 -0
- package/dist/primitives/accordion.js +49 -0
- package/dist/primitives/alert-dialog.d.ts +10 -0
- package/dist/primitives/alert-dialog.js +22 -0
- package/dist/primitives/aspect-ratio.d.ts +4 -0
- package/dist/primitives/aspect-ratio.js +7 -0
- package/dist/primitives/avatar.d.ts +8 -0
- package/dist/primitives/avatar.js +45 -0
- package/dist/primitives/carousel.d.ts +22 -0
- package/dist/primitives/carousel.js +78 -0
- package/dist/primitives/chart.d.ts +71 -0
- package/dist/primitives/chart.js +125 -0
- package/dist/primitives/checkbox.d.ts +13 -0
- package/dist/primitives/checkbox.js +24 -0
- package/dist/primitives/collapsible.d.ts +14 -0
- package/dist/primitives/collapsible.js +29 -0
- package/dist/primitives/command.d.ts +43 -0
- package/dist/primitives/command.js +98 -0
- package/dist/primitives/context-menu.d.ts +24 -0
- package/dist/primitives/context-menu.js +19 -0
- package/dist/primitives/core.d.ts +25 -0
- package/dist/primitives/core.js +89 -0
- package/dist/primitives/dialog.d.ts +7 -0
- package/dist/primitives/dialog.js +15 -0
- package/dist/primitives/drawer.d.ts +30 -0
- package/dist/primitives/drawer.js +39 -0
- package/dist/primitives/dropdown-menu.d.ts +24 -0
- package/dist/primitives/dropdown-menu.js +19 -0
- package/dist/primitives/form.d.ts +154 -0
- package/dist/primitives/form.js +139 -0
- package/dist/primitives/hover-card.d.ts +4 -0
- package/dist/primitives/hover-card.js +8 -0
- package/dist/primitives/input-otp.d.ts +21 -0
- package/dist/primitives/input-otp.js +78 -0
- package/dist/primitives/label.d.ts +2 -0
- package/dist/primitives/label.js +7 -0
- package/dist/primitives/layer.d.ts +84 -0
- package/dist/primitives/layer.js +300 -0
- package/dist/primitives/menu.d.ts +56 -0
- package/dist/primitives/menu.js +126 -0
- package/dist/primitives/menubar.d.ts +91 -0
- package/dist/primitives/menubar.js +44 -0
- package/dist/primitives/navigation-menu.d.ts +32 -0
- package/dist/primitives/navigation-menu.js +121 -0
- package/dist/primitives/popover.d.ts +4 -0
- package/dist/primitives/popover.js +12 -0
- package/dist/primitives/progress.d.ts +7 -0
- package/dist/primitives/progress.js +13 -0
- package/dist/primitives/radio-group.d.ts +18 -0
- package/dist/primitives/radio-group.js +36 -0
- package/dist/primitives/resizable.d.ts +19 -0
- package/dist/primitives/resizable.js +91 -0
- package/dist/primitives/scroll-area.d.ts +12 -0
- package/dist/primitives/scroll-area.js +26 -0
- package/dist/primitives/select.d.ts +42 -0
- package/dist/primitives/select.js +167 -0
- package/dist/primitives/separator.d.ts +5 -0
- package/dist/primitives/separator.js +7 -0
- package/dist/primitives/slider.d.ts +25 -0
- package/dist/primitives/slider.js +98 -0
- package/dist/primitives/slot.d.ts +1 -0
- package/dist/primitives/slot.js +4 -0
- package/dist/primitives/switch.d.ts +11 -0
- package/dist/primitives/switch.js +22 -0
- package/dist/primitives/tabs.d.ts +23 -0
- package/dist/primitives/tabs.js +38 -0
- package/dist/primitives/toast.d.ts +55 -0
- package/dist/primitives/toast.js +86 -0
- package/dist/primitives/toggle-group.d.ts +24 -0
- package/dist/primitives/toggle-group.js +33 -0
- package/dist/primitives/toggle.d.ts +7 -0
- package/dist/primitives/toggle.js +13 -0
- package/dist/primitives/tooltip.d.ts +7 -0
- package/dist/primitives/tooltip.js +10 -0
- package/dist/style-entry.d.ts +1 -0
- package/dist/style-entry.js +1 -0
- package/dist/styles.css +7016 -0
- package/dist/styles.js +1 -0
- package/dist/theme/index.d.ts +110 -0
- package/dist/theme/index.js +199 -0
- package/licenses/Lucide.txt +15 -0
- package/package.json +67 -4
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { cva } from "../../lib/variants.js";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { Label } from "./label.js";
|
|
6
|
+
import { Separator } from "./separator.js";
|
|
7
|
+
function FieldSet({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
"fieldset",
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "field-set",
|
|
12
|
+
className: cn(
|
|
13
|
+
"flex flex-col gap-6",
|
|
14
|
+
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
15
|
+
className
|
|
16
|
+
),
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function FieldLegend({
|
|
22
|
+
className,
|
|
23
|
+
variant = "legend",
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"legend",
|
|
28
|
+
{
|
|
29
|
+
"data-slot": "field-legend",
|
|
30
|
+
"data-variant": variant,
|
|
31
|
+
className: cn(
|
|
32
|
+
"mb-3 font-medium",
|
|
33
|
+
"data-[variant=legend]:text-base",
|
|
34
|
+
"data-[variant=label]:text-sm",
|
|
35
|
+
className
|
|
36
|
+
),
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function FieldGroup({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
"data-slot": "field-group",
|
|
46
|
+
className: cn(
|
|
47
|
+
"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
const fieldVariants = cva(
|
|
55
|
+
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
56
|
+
{
|
|
57
|
+
variants: {
|
|
58
|
+
orientation: {
|
|
59
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
60
|
+
horizontal: [
|
|
61
|
+
"flex-row items-center",
|
|
62
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
63
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
64
|
+
],
|
|
65
|
+
responsive: [
|
|
66
|
+
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
|
|
67
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
68
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
defaultVariants: {
|
|
73
|
+
orientation: "vertical"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
function Field({
|
|
78
|
+
className,
|
|
79
|
+
orientation = "vertical",
|
|
80
|
+
...props
|
|
81
|
+
}) {
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
role: "group",
|
|
86
|
+
"data-slot": "field",
|
|
87
|
+
"data-orientation": orientation,
|
|
88
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
89
|
+
...props
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function FieldContent({ className, ...props }) {
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
"data-slot": "field-content",
|
|
98
|
+
className: cn(
|
|
99
|
+
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
100
|
+
className
|
|
101
|
+
),
|
|
102
|
+
...props
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
function FieldLabel({
|
|
107
|
+
className,
|
|
108
|
+
...props
|
|
109
|
+
}) {
|
|
110
|
+
return /* @__PURE__ */ jsx(
|
|
111
|
+
Label,
|
|
112
|
+
{
|
|
113
|
+
"data-slot": "field-label",
|
|
114
|
+
className: cn(
|
|
115
|
+
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
116
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4",
|
|
117
|
+
"has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
|
|
118
|
+
className
|
|
119
|
+
),
|
|
120
|
+
...props
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function FieldTitle({ className, ...props }) {
|
|
125
|
+
return /* @__PURE__ */ jsx(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
"data-slot": "field-label",
|
|
129
|
+
className: cn(
|
|
130
|
+
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
|
131
|
+
className
|
|
132
|
+
),
|
|
133
|
+
...props
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
function FieldDescription({ className, ...props }) {
|
|
138
|
+
return /* @__PURE__ */ jsx(
|
|
139
|
+
"p",
|
|
140
|
+
{
|
|
141
|
+
"data-slot": "field-description",
|
|
142
|
+
className: cn(
|
|
143
|
+
"text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
144
|
+
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
145
|
+
"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
|
|
146
|
+
className
|
|
147
|
+
),
|
|
148
|
+
...props
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
function FieldSeparator({
|
|
153
|
+
children,
|
|
154
|
+
className,
|
|
155
|
+
...props
|
|
156
|
+
}) {
|
|
157
|
+
return /* @__PURE__ */ jsxs(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
"data-slot": "field-separator",
|
|
161
|
+
"data-content": !!children,
|
|
162
|
+
className: cn(
|
|
163
|
+
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
164
|
+
className
|
|
165
|
+
),
|
|
166
|
+
...props,
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
|
|
169
|
+
children && /* @__PURE__ */ jsx(
|
|
170
|
+
"span",
|
|
171
|
+
{
|
|
172
|
+
className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
|
|
173
|
+
"data-slot": "field-separator-content",
|
|
174
|
+
children
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
function FieldError({
|
|
182
|
+
className,
|
|
183
|
+
children,
|
|
184
|
+
errors,
|
|
185
|
+
...props
|
|
186
|
+
}) {
|
|
187
|
+
const content = useMemo(() => {
|
|
188
|
+
if (children) {
|
|
189
|
+
return children;
|
|
190
|
+
}
|
|
191
|
+
if (!errors?.length) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
const uniqueErrors = [
|
|
195
|
+
...new Map(errors.map((error) => [error?.message, error])).values()
|
|
196
|
+
];
|
|
197
|
+
if (uniqueErrors?.length == 1) {
|
|
198
|
+
return uniqueErrors[0]?.message;
|
|
199
|
+
}
|
|
200
|
+
return /* @__PURE__ */ jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
201
|
+
(error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)
|
|
202
|
+
) });
|
|
203
|
+
}, [children, errors]);
|
|
204
|
+
if (!content) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
return /* @__PURE__ */ jsx(
|
|
208
|
+
"div",
|
|
209
|
+
{
|
|
210
|
+
role: "alert",
|
|
211
|
+
"data-slot": "field-error",
|
|
212
|
+
className: cn("text-destructive text-sm font-normal", className),
|
|
213
|
+
...props,
|
|
214
|
+
children: content
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
export {
|
|
219
|
+
Field,
|
|
220
|
+
FieldContent,
|
|
221
|
+
FieldDescription,
|
|
222
|
+
FieldError,
|
|
223
|
+
FieldGroup,
|
|
224
|
+
FieldLabel,
|
|
225
|
+
FieldLegend,
|
|
226
|
+
FieldSeparator,
|
|
227
|
+
FieldSet,
|
|
228
|
+
FieldTitle
|
|
229
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type * as LabelPrimitive from "../../primitives/label";
|
|
3
|
+
import { Slot } from "../../primitives/slot";
|
|
4
|
+
import { FormProvider, type ControllerProps, type FieldPath, type FieldValues } from "../../primitives/form";
|
|
5
|
+
declare const Form: typeof FormProvider;
|
|
6
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
7
|
+
declare const useFormField: () => {
|
|
8
|
+
error: import("./form").FormFieldError | undefined;
|
|
9
|
+
invalid: boolean;
|
|
10
|
+
isTouched: boolean;
|
|
11
|
+
isDirty: boolean;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
formItemId: string;
|
|
15
|
+
formDescriptionId: string;
|
|
16
|
+
formMessageId: string;
|
|
17
|
+
};
|
|
18
|
+
declare function FormItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
19
|
+
declare function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): React.JSX.Element;
|
|
20
|
+
declare function FormControl({ ...props }: React.ComponentProps<typeof Slot>): React.JSX.Element;
|
|
21
|
+
declare function FormDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
22
|
+
declare function FormMessage({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element | null;
|
|
23
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
|
|
24
|
+
export { useForm } from "../../primitives/form";
|
|
25
|
+
export type { ValidationRules, UseFormOptions, FieldValues } from "../../primitives/form";
|
|
26
|
+
export type { UseFormReturn, FieldError as FormFieldError } from "../../primitives/form";
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { FormProvider, Controller, useFormContext, useFormState } from "../../primitives/form.js";
|
|
4
|
+
import { useForm } from "../../primitives/form.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Label } from "./label.js";
|
|
7
|
+
import { Slot } from "../../primitives/core.js";
|
|
8
|
+
const Form = FormProvider;
|
|
9
|
+
const FormFieldContext = React.createContext(
|
|
10
|
+
{}
|
|
11
|
+
);
|
|
12
|
+
const FormField = ({
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
16
|
+
};
|
|
17
|
+
const useFormField = () => {
|
|
18
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
19
|
+
const itemContext = React.useContext(FormItemContext);
|
|
20
|
+
const { getFieldState } = useFormContext();
|
|
21
|
+
const formState = useFormState({ name: fieldContext.name });
|
|
22
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
23
|
+
if (!fieldContext.name) {
|
|
24
|
+
throw new Error("useFormField should be used within <FormField>");
|
|
25
|
+
}
|
|
26
|
+
const { id } = itemContext;
|
|
27
|
+
return {
|
|
28
|
+
id,
|
|
29
|
+
name: fieldContext.name,
|
|
30
|
+
formItemId: `${id}-form-item`,
|
|
31
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
32
|
+
formMessageId: `${id}-form-item-message`,
|
|
33
|
+
...fieldState
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const FormItemContext = React.createContext(
|
|
37
|
+
{}
|
|
38
|
+
);
|
|
39
|
+
function FormItem({ className, ...props }) {
|
|
40
|
+
const id = React.useId();
|
|
41
|
+
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "form-item",
|
|
45
|
+
className: cn("grid gap-2", className),
|
|
46
|
+
...props
|
|
47
|
+
}
|
|
48
|
+
) });
|
|
49
|
+
}
|
|
50
|
+
function FormLabel({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}) {
|
|
54
|
+
const { error, formItemId } = useFormField();
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
Label,
|
|
57
|
+
{
|
|
58
|
+
"data-slot": "form-label",
|
|
59
|
+
"data-error": !!error,
|
|
60
|
+
className: cn("data-[error=true]:text-destructive", className),
|
|
61
|
+
htmlFor: formItemId,
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function FormControl({ ...props }) {
|
|
67
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
Slot,
|
|
70
|
+
{
|
|
71
|
+
"data-slot": "form-control",
|
|
72
|
+
id: formItemId,
|
|
73
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
74
|
+
"aria-invalid": !!error,
|
|
75
|
+
...props
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function FormDescription({ className, ...props }) {
|
|
80
|
+
const { formDescriptionId } = useFormField();
|
|
81
|
+
return /* @__PURE__ */ jsx(
|
|
82
|
+
"p",
|
|
83
|
+
{
|
|
84
|
+
"data-slot": "form-description",
|
|
85
|
+
id: formDescriptionId,
|
|
86
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function FormMessage({ className, ...props }) {
|
|
92
|
+
const { error, formMessageId } = useFormField();
|
|
93
|
+
const body = error ? String(error?.message ?? "") : props.children;
|
|
94
|
+
if (!body) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return /* @__PURE__ */ jsx(
|
|
98
|
+
"p",
|
|
99
|
+
{
|
|
100
|
+
"data-slot": "form-message",
|
|
101
|
+
id: formMessageId,
|
|
102
|
+
className: cn("text-destructive text-sm", className),
|
|
103
|
+
...props,
|
|
104
|
+
children: body
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
Form,
|
|
110
|
+
FormControl,
|
|
111
|
+
FormDescription,
|
|
112
|
+
FormField,
|
|
113
|
+
FormItem,
|
|
114
|
+
FormLabel,
|
|
115
|
+
FormMessage,
|
|
116
|
+
useForm,
|
|
117
|
+
useFormField
|
|
118
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as HoverCardPrimitive from "../../primitives/hover-card";
|
|
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,39 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useThemePortalContainer } from "../../theme/index.js";
|
|
3
|
+
import { Root, Portal, Content, Trigger } from "../../primitives/hover-card.js";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
function HoverCard({
|
|
6
|
+
...props
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Root, { "data-slot": "hover-card", ...props });
|
|
9
|
+
}
|
|
10
|
+
function HoverCardTrigger({
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ jsx(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__ */ jsx(Portal, { container: useThemePortalContainer(), "data-slot": "hover-card-portal", children: /* @__PURE__ */ jsx(
|
|
22
|
+
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-[80] w-64 origin-(--aaas-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props
|
|
32
|
+
}
|
|
33
|
+
) });
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
HoverCard,
|
|
37
|
+
HoverCardContent,
|
|
38
|
+
HoverCardTrigger
|
|
39
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "../../lib/variants";
|
|
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-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
class?: import("../../lib/class-names").ClassValue;
|
|
9
|
+
className?: import("../../lib/class-names").ClassValue;
|
|
10
|
+
}) | undefined) => string;
|
|
11
|
+
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
|
|
12
|
+
declare const inputGroupButtonVariants: (props?: ({
|
|
13
|
+
size?: "sm" | "icon-sm" | "xs" | "icon-xs" | null | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
class?: import("../../lib/class-names").ClassValue;
|
|
16
|
+
className?: import("../../lib/class-names").ClassValue;
|
|
17
|
+
}) | undefined) => string;
|
|
18
|
+
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, "size"> & VariantProps<typeof inputGroupButtonVariants>): React.JSX.Element;
|
|
19
|
+
declare function InputGroupText({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
20
|
+
declare function InputGroupInput({ className, ...props }: React.ComponentProps<"input">): React.JSX.Element;
|
|
21
|
+
declare function InputGroupTextarea({ className, ...props }: React.ComponentProps<"textarea">): React.JSX.Element;
|
|
22
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupInput, InputGroupTextarea, };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "../../lib/variants.js";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { Input } from "./input.js";
|
|
6
|
+
import { Textarea } from "./textarea.js";
|
|
7
|
+
function InputGroup({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "input-group",
|
|
12
|
+
role: "group",
|
|
13
|
+
className: cn(
|
|
14
|
+
"group/input-group border-input bg-card dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,border-color,box-shadow] duration-150 outline-none hover:not-has-[[data-slot=input-group-control]:disabled]:border-[color-mix(in_srgb,var(--primary)_55%,var(--input))]",
|
|
15
|
+
"h-9 min-w-0 has-[>textarea]:h-auto",
|
|
16
|
+
// The group owns the disabled surface; controls remain transparent.
|
|
17
|
+
"has-[[data-slot=input-group-control]:disabled]:bg-muted has-[[data-slot=input-group-control]:disabled]:text-muted-foreground has-[[data-slot=input-group-control]:disabled]:shadow-none has-[[data-slot=input-group-control]:disabled]:cursor-not-allowed dark:has-[[data-slot=input-group-control]:disabled]:bg-muted",
|
|
18
|
+
// Variants based on alignment.
|
|
19
|
+
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
20
|
+
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
|
21
|
+
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
|
|
22
|
+
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
|
23
|
+
// Focus state.
|
|
24
|
+
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/15 has-[[data-slot=input-group-control]:focus-visible]:ring-2",
|
|
25
|
+
// Error state.
|
|
26
|
+
"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",
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const inputGroupAddonVariants = cva(
|
|
34
|
+
"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-has-[[data-slot=input-group-control]:disabled]/input-group:cursor-not-allowed",
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
align: {
|
|
38
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
39
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
40
|
+
"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
|
|
41
|
+
"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
align: "inline-start"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
function InputGroupAddon({
|
|
50
|
+
className,
|
|
51
|
+
align = "inline-start",
|
|
52
|
+
...props
|
|
53
|
+
}) {
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
role: "group",
|
|
58
|
+
"data-slot": "input-group-addon",
|
|
59
|
+
"data-align": align,
|
|
60
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
61
|
+
onClick: (e) => {
|
|
62
|
+
if (e.target.closest("button")) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
66
|
+
},
|
|
67
|
+
...props
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
const inputGroupButtonVariants = cva(
|
|
72
|
+
"text-sm shadow-none flex gap-2 items-center",
|
|
73
|
+
{
|
|
74
|
+
variants: {
|
|
75
|
+
size: {
|
|
76
|
+
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
77
|
+
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
78
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
79
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
defaultVariants: {
|
|
83
|
+
size: "xs"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
function InputGroupButton({
|
|
88
|
+
className,
|
|
89
|
+
type = "button",
|
|
90
|
+
variant = "ghost",
|
|
91
|
+
size = "xs",
|
|
92
|
+
...props
|
|
93
|
+
}) {
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
Button,
|
|
96
|
+
{
|
|
97
|
+
type,
|
|
98
|
+
"data-size": size,
|
|
99
|
+
variant,
|
|
100
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
101
|
+
...props
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function InputGroupText({ className, ...props }) {
|
|
106
|
+
return /* @__PURE__ */ jsx(
|
|
107
|
+
"span",
|
|
108
|
+
{
|
|
109
|
+
className: cn(
|
|
110
|
+
"text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
111
|
+
className
|
|
112
|
+
),
|
|
113
|
+
...props
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
function InputGroupInput({
|
|
118
|
+
className,
|
|
119
|
+
...props
|
|
120
|
+
}) {
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
Input,
|
|
123
|
+
{
|
|
124
|
+
"data-slot": "input-group-control",
|
|
125
|
+
className: cn(
|
|
126
|
+
"h-full flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 disabled:bg-transparent read-only:bg-transparent dark:bg-transparent",
|
|
127
|
+
className
|
|
128
|
+
),
|
|
129
|
+
...props
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
function InputGroupTextarea({
|
|
134
|
+
className,
|
|
135
|
+
...props
|
|
136
|
+
}) {
|
|
137
|
+
return /* @__PURE__ */ jsx(
|
|
138
|
+
Textarea,
|
|
139
|
+
{
|
|
140
|
+
"data-slot": "input-group-control",
|
|
141
|
+
className: cn(
|
|
142
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 disabled:bg-transparent read-only:bg-transparent dark:bg-transparent",
|
|
143
|
+
className
|
|
144
|
+
),
|
|
145
|
+
...props
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
export {
|
|
150
|
+
InputGroup,
|
|
151
|
+
InputGroupAddon,
|
|
152
|
+
InputGroupButton,
|
|
153
|
+
InputGroupInput,
|
|
154
|
+
InputGroupText,
|
|
155
|
+
InputGroupTextarea
|
|
156
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { OTPInput } from "../../primitives/input-otp";
|
|
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,66 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { OTPInput, OTPInputContext } from "../../primitives/input-otp.js";
|
|
4
|
+
import { MinusIcon } from "../../icons/index.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
function InputOTP({
|
|
7
|
+
className,
|
|
8
|
+
containerClassName,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
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__ */ jsx(
|
|
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__ */ jsxs(
|
|
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/15 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-2",
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
...props,
|
|
51
|
+
children: [
|
|
52
|
+
char,
|
|
53
|
+
hasFakeCaret && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function InputOTPSeparator({ ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx(MinusIcon, {}) });
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
InputOTP,
|
|
63
|
+
InputOTPGroup,
|
|
64
|
+
InputOTPSeparator,
|
|
65
|
+
InputOTPSlot
|
|
66
|
+
};
|