@vritti/quantum-ui 0.1.11 → 0.1.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/dist/Button.js +3 -43
- package/dist/Button.js.map +1 -1
- package/dist/Checkbox.d.ts +10 -1
- package/dist/Checkbox.js +35 -7
- package/dist/Checkbox.js.map +1 -1
- package/dist/Form.d.ts +263 -0
- package/dist/Form.js +683 -0
- package/dist/Form.js.map +1 -0
- package/dist/OTPField.d.ts +3 -3
- package/dist/OTPField.js +135 -0
- package/dist/OTPField.js.map +1 -0
- package/dist/PasswordField.d.ts +3 -3
- package/dist/PasswordField.js +63 -57
- package/dist/PasswordField.js.map +1 -1
- package/dist/PhoneField.d.ts +3 -3
- package/dist/PhoneField.js +55 -58
- package/dist/PhoneField.js.map +1 -1
- package/dist/TextArea.d.ts +11 -0
- package/dist/TextArea.js +54 -0
- package/dist/TextArea.js.map +1 -0
- package/dist/TextField.d.ts +3 -3
- package/dist/TextField.js +26 -39
- package/dist/TextField.js.map +1 -1
- package/dist/assets/quantum-ui.css +8 -0
- package/dist/components/Form.d.ts +2 -0
- package/dist/components/Form.js +3 -0
- package/dist/components/Form.js.map +1 -0
- package/dist/components/OTPField.js +1 -134
- package/dist/components/OTPField.js.map +1 -1
- package/dist/components/Progress.js +2 -2
- package/dist/components/TextArea.d.ts +2 -0
- package/dist/components/TextArea.js +2 -0
- package/dist/components/TextArea.js.map +1 -0
- package/dist/field.js +431 -0
- package/dist/field.js.map +1 -0
- package/dist/index.d.ts +296 -8
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/index2.js +116 -54
- package/dist/index2.js.map +1 -1
- package/dist/index3.js +42 -38
- package/dist/index3.js.map +1 -1
- package/dist/index4.js +54 -116
- package/dist/index4.js.map +1 -1
- package/dist/index5.js +41 -0
- package/dist/index5.js.map +1 -0
- package/dist/shadcn/shadcnField.d.ts +1 -0
- package/dist/shadcn/shadcnField.js +2 -0
- package/dist/shadcn/shadcnField.js.map +1 -0
- package/dist/shadcnField.d.ts +1 -0
- package/package.json +20 -3
- package/dist/Label.js +0 -40
- package/dist/Label.js.map +0 -1
package/dist/Form.d.ts
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { Controller } from 'react-hook-form';
|
|
2
|
+
import { default as default_2 } from 'react';
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
|
+
import { JSX } from 'react/jsx-runtime';
|
|
5
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
6
|
+
import * as React_2 from 'react';
|
|
7
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
8
|
+
import { VariantProps } from 'class-variance-authority';
|
|
9
|
+
|
|
10
|
+
export { Controller }
|
|
11
|
+
|
|
12
|
+
export declare function Field({
|
|
13
|
+
className,
|
|
14
|
+
orientation = "vertical",
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
role="group"
|
|
20
|
+
data-slot="field"
|
|
21
|
+
data-orientation={orientation}
|
|
22
|
+
className={cn(fieldVariants({ orientation }), className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
data-slot="field-content"
|
|
32
|
+
className={cn(
|
|
33
|
+
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
42
|
+
return (
|
|
43
|
+
<p
|
|
44
|
+
data-slot="field-description"
|
|
45
|
+
className={cn(
|
|
46
|
+
"text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
47
|
+
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
48
|
+
"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
|
|
49
|
+
className
|
|
50
|
+
)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export declare function FieldError({
|
|
57
|
+
className,
|
|
58
|
+
children,
|
|
59
|
+
errors,
|
|
60
|
+
...props
|
|
61
|
+
}: React.ComponentProps<"div"> & {
|
|
62
|
+
errors?: Array<{ message?: string } | undefined>
|
|
63
|
+
}) {
|
|
64
|
+
const content = useMemo(() => {
|
|
65
|
+
if (children) {
|
|
66
|
+
return children
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (!errors?.length) {
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (errors?.length == 1) {
|
|
74
|
+
return errors[0]?.message
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<ul className="ml-4 flex list-disc flex-col gap-1">
|
|
79
|
+
{errors.map(
|
|
80
|
+
(error, index) =>
|
|
81
|
+
error?.message && <li key={index}>{error.message}</li>
|
|
82
|
+
)}
|
|
83
|
+
</ul>
|
|
84
|
+
)
|
|
85
|
+
}, [children, errors])
|
|
86
|
+
|
|
87
|
+
if (!content) {
|
|
88
|
+
return null
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div
|
|
93
|
+
role="alert"
|
|
94
|
+
data-slot="field-error"
|
|
95
|
+
className={cn("text-destructive text-sm font-normal", className)}
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
{content}
|
|
99
|
+
</div>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
data-slot="field-group"
|
|
107
|
+
className={cn(
|
|
108
|
+
"group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare function FieldLabel({
|
|
117
|
+
className,
|
|
118
|
+
...props
|
|
119
|
+
}: React.ComponentProps<typeof Label>) {
|
|
120
|
+
return (
|
|
121
|
+
<Label
|
|
122
|
+
data-slot="field-label"
|
|
123
|
+
className={cn(
|
|
124
|
+
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
125
|
+
"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",
|
|
126
|
+
"has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
|
|
127
|
+
className
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export declare function FieldLegend({
|
|
135
|
+
className,
|
|
136
|
+
variant = "legend",
|
|
137
|
+
...props
|
|
138
|
+
}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
|
|
139
|
+
return (
|
|
140
|
+
<legend
|
|
141
|
+
data-slot="field-legend"
|
|
142
|
+
data-variant={variant}
|
|
143
|
+
className={cn(
|
|
144
|
+
"mb-3 font-medium",
|
|
145
|
+
"data-[variant=legend]:text-base",
|
|
146
|
+
"data-[variant=label]:text-sm",
|
|
147
|
+
className
|
|
148
|
+
)}
|
|
149
|
+
{...props}
|
|
150
|
+
/>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export declare function FieldSeparator({
|
|
155
|
+
children,
|
|
156
|
+
className,
|
|
157
|
+
...props
|
|
158
|
+
}: React.ComponentProps<"div"> & {
|
|
159
|
+
children?: React.ReactNode
|
|
160
|
+
}) {
|
|
161
|
+
return (
|
|
162
|
+
<div
|
|
163
|
+
data-slot="field-separator"
|
|
164
|
+
data-content={!!children}
|
|
165
|
+
className={cn(
|
|
166
|
+
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
167
|
+
className
|
|
168
|
+
)}
|
|
169
|
+
{...props}
|
|
170
|
+
>
|
|
171
|
+
<Separator className="absolute inset-0 top-1/2" />
|
|
172
|
+
{children && (
|
|
173
|
+
<span
|
|
174
|
+
className="bg-background text-muted-foreground relative mx-auto block w-fit px-2"
|
|
175
|
+
data-slot="field-separator-content"
|
|
176
|
+
>
|
|
177
|
+
{children}
|
|
178
|
+
</span>
|
|
179
|
+
)}
|
|
180
|
+
</div>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
|
|
185
|
+
return (
|
|
186
|
+
<fieldset
|
|
187
|
+
data-slot="field-set"
|
|
188
|
+
className={cn(
|
|
189
|
+
"flex flex-col gap-4",
|
|
190
|
+
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
191
|
+
className
|
|
192
|
+
)}
|
|
193
|
+
{...props}
|
|
194
|
+
/>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
199
|
+
return (
|
|
200
|
+
<div
|
|
201
|
+
data-slot="field-label"
|
|
202
|
+
className={cn(
|
|
203
|
+
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
|
204
|
+
className
|
|
205
|
+
)}
|
|
206
|
+
{...props}
|
|
207
|
+
/>
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare const fieldVariants = cva(
|
|
212
|
+
"group/field flex w-full gap-2 data-[invalid=true]:text-destructive",
|
|
213
|
+
{
|
|
214
|
+
variants: {
|
|
215
|
+
orientation: {
|
|
216
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
217
|
+
horizontal: [
|
|
218
|
+
"flex-row items-center",
|
|
219
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
220
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
221
|
+
],
|
|
222
|
+
responsive: [
|
|
223
|
+
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
|
|
224
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
225
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
defaultVariants: {
|
|
230
|
+
orientation: "vertical",
|
|
231
|
+
},
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
export declare function Form<TFieldValues extends FieldValues = FieldValues>({ form, onSubmit, children, showRootError, rootErrorPosition, rootErrorClassName, ...props }: FormProps<TFieldValues>): JSX.Element;
|
|
236
|
+
|
|
237
|
+
export declare namespace Form {
|
|
238
|
+
var displayName: string;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export declare interface FormProps<TFieldValues extends FieldValues = FieldValues> extends Omit<default_2.FormHTMLAttributes<HTMLFormElement>, 'onSubmit'> {
|
|
242
|
+
form: UseFormReturn<TFieldValues>;
|
|
243
|
+
onSubmit: (data: TFieldValues) => void | Promise<void>;
|
|
244
|
+
children: default_2.ReactNode;
|
|
245
|
+
showRootError?: boolean;
|
|
246
|
+
rootErrorPosition?: 'top' | 'bottom';
|
|
247
|
+
rootErrorClassName?: string;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
declare function Label({ className, ...props }: React_2.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
251
|
+
return (
|
|
252
|
+
<LabelPrimitive.Root
|
|
253
|
+
data-slot='label'
|
|
254
|
+
className={cn(
|
|
255
|
+
'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
|
256
|
+
className
|
|
257
|
+
)}
|
|
258
|
+
{...props}
|
|
259
|
+
/>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export { }
|