laif-ds 0.2.39 → 0.2.40
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/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +5 -5
- package/dist/components/ui/button.js +7 -7
- package/dist/components/ui/date-picker.js +66 -62
- package/dist/components/ui/dialog.js +36 -35
- package/dist/components/ui/form-composer.js +246 -0
- package/dist/components/ui/input.js +76 -75
- package/dist/components/ui/textarea.js +9 -9
- package/dist/index.d.ts +29 -1
- package/dist/index.js +250 -248
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as u, jsx as i } from "react/jsx-runtime";
|
|
3
3
|
import { Label as ee } from "./label.js";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { cva as
|
|
4
|
+
import { cn as l } from "../../lib/utils.js";
|
|
5
|
+
import { cva as A } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
6
6
|
import * as r from "react";
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { Typo as
|
|
9
|
-
const
|
|
10
|
-
|
|
7
|
+
import { Icon as k } from "./icon.js";
|
|
8
|
+
import { Typo as te } from "./typo.js";
|
|
9
|
+
const se = A(
|
|
10
|
+
l(
|
|
11
11
|
"flex w-full items-center gap-2 rounded-md bg-d-input border border-d-border/50 px-3 transition-all duration-200",
|
|
12
12
|
"focus-within:border-d-ring focus-within:border-1",
|
|
13
13
|
"aria-[invalid=true]:ring-d-destructive/20 aria-[invalid=true]:border-d-destructive"
|
|
@@ -24,13 +24,14 @@ const te = R(
|
|
|
24
24
|
size: "default"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
), re =
|
|
28
|
-
|
|
27
|
+
), re = A(
|
|
28
|
+
l(
|
|
29
29
|
"shadow-none flex-1 min-w-0 bg-transparent outline-none border-0 p-0 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
30
30
|
"file:text-d-foreground file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
31
31
|
"placeholder:text-d-muted-foreground",
|
|
32
32
|
"selection:bg-d-primary selection:text-d-primary-foreground",
|
|
33
|
-
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
33
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
34
|
+
"[-webkit-autofill]:shadow-[0_0_0_1000px_transparent_inset] [-webkit-autofill]:[-webkit-text-fill-color:inherit]"
|
|
34
35
|
),
|
|
35
36
|
{
|
|
36
37
|
variants: {
|
|
@@ -49,11 +50,11 @@ const te = R(
|
|
|
49
50
|
hide: "Nascondi password"
|
|
50
51
|
}, ce = r.forwardRef(
|
|
51
52
|
({
|
|
52
|
-
className:
|
|
53
|
+
className: R,
|
|
53
54
|
type: m,
|
|
54
|
-
label:
|
|
55
|
-
labelClassName:
|
|
56
|
-
id:
|
|
55
|
+
label: N,
|
|
56
|
+
labelClassName: W,
|
|
57
|
+
id: D,
|
|
57
58
|
iconLeft: b,
|
|
58
59
|
iconRight: v,
|
|
59
60
|
startContent: S,
|
|
@@ -63,123 +64,123 @@ const te = R(
|
|
|
63
64
|
required: E,
|
|
64
65
|
onBlur: C,
|
|
65
66
|
onChange: O,
|
|
66
|
-
onInvalid:
|
|
67
|
-
"aria-invalid":
|
|
67
|
+
onInvalid: _,
|
|
68
|
+
"aria-invalid": G,
|
|
68
69
|
"aria-describedby": F,
|
|
69
|
-
showValidMessage:
|
|
70
|
-
showValidityMessage:
|
|
70
|
+
showValidMessage: P = !1,
|
|
71
|
+
showValidityMessage: B = !1,
|
|
71
72
|
validityI18n: e,
|
|
72
73
|
...H
|
|
73
74
|
}, $) => {
|
|
74
|
-
const [c, J] = r.useState(!1), [
|
|
75
|
-
r.useImperativeHandle($, () =>
|
|
75
|
+
const [c, J] = r.useState(!1), [h, M] = r.useState(!0), [K, L] = r.useState(!1), [U, V] = r.useState(""), Q = r.useId(), w = D ?? Q, j = `${w}-validity`, g = r.useRef(null), x = m === "password", X = x ? c ? "text" : "password" : m, z = G ?? (!h && K ? !0 : void 0), Y = [F, B && j].filter(Boolean).join(" ").trim() || void 0;
|
|
76
|
+
r.useImperativeHandle($, () => g.current);
|
|
76
77
|
const Z = r.useCallback(
|
|
77
|
-
(
|
|
78
|
+
(s) => {
|
|
78
79
|
if (d) return;
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
const a =
|
|
82
|
-
a && (a.focus(), !
|
|
80
|
+
const t = s.target;
|
|
81
|
+
if (t.tagName === "INPUT" || t.tagName === "BUTTON") return;
|
|
82
|
+
const a = g.current;
|
|
83
|
+
a && (a.focus(), !x && m !== "file" && a.select());
|
|
83
84
|
},
|
|
84
|
-
[d,
|
|
85
|
-
),
|
|
86
|
-
(
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
85
|
+
[d, x, m]
|
|
86
|
+
), n = r.useCallback(
|
|
87
|
+
(s) => {
|
|
88
|
+
const t = s.validity, a = s.validationMessage !== "" ? s.validationMessage : "✓";
|
|
89
|
+
if (t.valid)
|
|
89
90
|
return {
|
|
90
91
|
isValid: !0,
|
|
91
|
-
message:
|
|
92
|
+
message: P ? e?.valid ?? a : ""
|
|
92
93
|
};
|
|
93
94
|
if (!e)
|
|
94
95
|
return { isValid: !1, message: a };
|
|
95
96
|
let o = a;
|
|
96
|
-
return
|
|
97
|
+
return t.valueMissing && e.valueMissing ? o = e.valueMissing : t.typeMismatch && e.typeMismatch ? o = e.typeMismatch : t.patternMismatch && e.patternMismatch ? o = e.patternMismatch : t.tooLong && e.tooLong ? o = e.tooLong : t.tooShort && e.tooShort ? o = e.tooShort : t.rangeUnderflow && e.rangeUnderflow ? o = e.rangeUnderflow : t.rangeOverflow && e.rangeOverflow ? o = e.rangeOverflow : t.badInput && e.badInput ? o = e.badInput : t.stepMismatch && e.stepMismatch ? o = e.stepMismatch : t.customError && e.customError && (o = e.customError), { isValid: !1, message: o };
|
|
97
98
|
},
|
|
98
|
-
[
|
|
99
|
+
[P, e]
|
|
99
100
|
);
|
|
100
101
|
r.useEffect(() => {
|
|
101
|
-
if (
|
|
102
|
-
const { isValid:
|
|
103
|
-
M(
|
|
102
|
+
if (g.current) {
|
|
103
|
+
const { isValid: s, message: t } = n(g.current);
|
|
104
|
+
M(s), V(t);
|
|
104
105
|
}
|
|
105
|
-
}, [
|
|
106
|
+
}, [n]);
|
|
106
107
|
const q = r.useCallback(
|
|
107
|
-
(
|
|
108
|
-
|
|
109
|
-
const { isValid:
|
|
110
|
-
M(
|
|
108
|
+
(s) => {
|
|
109
|
+
L(!0);
|
|
110
|
+
const { isValid: t, message: a } = n(s.currentTarget);
|
|
111
|
+
M(t), V(a), O?.(s);
|
|
111
112
|
},
|
|
112
|
-
[O,
|
|
113
|
+
[O, n]
|
|
113
114
|
), y = r.useCallback(
|
|
114
|
-
(
|
|
115
|
-
|
|
115
|
+
(s) => {
|
|
116
|
+
L(!0), C?.(s);
|
|
116
117
|
},
|
|
117
|
-
[C,
|
|
118
|
+
[C, n]
|
|
118
119
|
), I = r.useCallback(
|
|
119
|
-
(
|
|
120
|
-
const { isValid:
|
|
121
|
-
M(
|
|
120
|
+
(s) => {
|
|
121
|
+
const { isValid: t, message: a } = n(s.currentTarget);
|
|
122
|
+
M(t), V(a), _?.(s);
|
|
122
123
|
},
|
|
123
|
-
[
|
|
124
|
+
[_, n]
|
|
124
125
|
);
|
|
125
|
-
return /* @__PURE__ */ u("div", { className:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
E &&
|
|
129
|
-
!
|
|
126
|
+
return /* @__PURE__ */ u("div", { className: l("flex flex-col gap-1.5", R), children: [
|
|
127
|
+
N && /* @__PURE__ */ u(ee, { htmlFor: w, className: l("gap-0.5", W), children: [
|
|
128
|
+
N,
|
|
129
|
+
E && h && /* @__PURE__ */ i("div", { children: "*" }),
|
|
130
|
+
!h && /* @__PURE__ */ i("div", { className: "text-d-destructive", children: "*" })
|
|
130
131
|
] }),
|
|
131
132
|
/* @__PURE__ */ u(
|
|
132
133
|
"div",
|
|
133
134
|
{
|
|
134
|
-
className:
|
|
135
|
-
|
|
135
|
+
className: l(
|
|
136
|
+
se({ size: p }),
|
|
136
137
|
d ? "cursor-not-allowed opacity-50" : "cursor-text"
|
|
137
138
|
),
|
|
138
|
-
"aria-invalid":
|
|
139
|
+
"aria-invalid": z,
|
|
139
140
|
onClick: Z,
|
|
140
141
|
children: [
|
|
141
142
|
(b || S) && /* @__PURE__ */ u("div", { className: "text-d-muted-foreground flex shrink-0 items-center gap-2", children: [
|
|
142
|
-
b && /* @__PURE__ */ i(
|
|
143
|
+
b && /* @__PURE__ */ i(k, { name: b, size: p === "lg" ? "sm" : "xs" }),
|
|
143
144
|
S
|
|
144
145
|
] }),
|
|
145
146
|
/* @__PURE__ */ i(
|
|
146
147
|
"input",
|
|
147
148
|
{
|
|
148
|
-
id:
|
|
149
|
+
id: w,
|
|
149
150
|
type: X,
|
|
150
151
|
"data-slot": "input",
|
|
151
|
-
className:
|
|
152
|
-
ref:
|
|
152
|
+
className: l(re({ size: p })),
|
|
153
|
+
ref: g,
|
|
153
154
|
disabled: d,
|
|
154
155
|
onChange: q,
|
|
155
156
|
onBlur: y,
|
|
156
157
|
onInvalid: I,
|
|
157
|
-
"aria-invalid":
|
|
158
|
+
"aria-invalid": z,
|
|
158
159
|
"aria-describedby": Y,
|
|
159
160
|
required: E,
|
|
160
161
|
step: m === "number" ? "any" : void 0,
|
|
161
162
|
...H
|
|
162
163
|
}
|
|
163
164
|
),
|
|
164
|
-
|
|
165
|
+
x ? /* @__PURE__ */ u(
|
|
165
166
|
"button",
|
|
166
167
|
{
|
|
167
168
|
type: "button",
|
|
168
|
-
onClick: (
|
|
169
|
-
|
|
169
|
+
onClick: (s) => {
|
|
170
|
+
s.stopPropagation(), s.preventDefault(), J((t) => !t);
|
|
170
171
|
},
|
|
171
|
-
className:
|
|
172
|
+
className: l(
|
|
172
173
|
"text-d-muted-foreground flex shrink-0 cursor-pointer items-center",
|
|
173
174
|
d && "cursor-not-allowed"
|
|
174
175
|
),
|
|
175
176
|
"aria-label": c ? f.hide : f.show,
|
|
176
177
|
"aria-pressed": c,
|
|
177
|
-
"aria-controls":
|
|
178
|
+
"aria-controls": w,
|
|
178
179
|
title: c ? f.hide : f.show,
|
|
179
180
|
disabled: d,
|
|
180
181
|
children: [
|
|
181
182
|
/* @__PURE__ */ i(
|
|
182
|
-
|
|
183
|
+
k,
|
|
183
184
|
{
|
|
184
185
|
name: c ? "EyeOff" : "Eye",
|
|
185
186
|
size: p === "lg" ? "sm" : "xs"
|
|
@@ -190,23 +191,23 @@ const te = R(
|
|
|
190
191
|
}
|
|
191
192
|
) : (v || T) && /* @__PURE__ */ u("div", { className: "text-d-muted-foreground flex shrink-0 items-center gap-2", children: [
|
|
192
193
|
T,
|
|
193
|
-
v && /* @__PURE__ */ i(
|
|
194
|
+
v && /* @__PURE__ */ i(k, { name: v, size: p === "lg" ? "sm" : "xs" })
|
|
194
195
|
] })
|
|
195
196
|
]
|
|
196
197
|
}
|
|
197
198
|
),
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
B && U.length > 0 && /* @__PURE__ */ i(
|
|
200
|
+
te,
|
|
200
201
|
{
|
|
201
202
|
variant: "caption",
|
|
202
|
-
id:
|
|
203
|
-
role:
|
|
203
|
+
id: j,
|
|
204
|
+
role: h ? "status" : "alert",
|
|
204
205
|
"aria-live": "polite",
|
|
205
|
-
className:
|
|
206
|
+
className: l(
|
|
206
207
|
"max-w-full min-w-0 text-wrap",
|
|
207
|
-
|
|
208
|
+
h ? "text-d-success" : "text-d-destructive"
|
|
208
209
|
),
|
|
209
|
-
children:
|
|
210
|
+
children: U
|
|
210
211
|
}
|
|
211
212
|
)
|
|
212
213
|
] });
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import { Label as c } from "./label.js";
|
|
4
|
-
import { cn as
|
|
4
|
+
import { cn as d } from "../../lib/utils.js";
|
|
5
5
|
function b({
|
|
6
|
-
wrpClassName:
|
|
6
|
+
wrpClassName: i,
|
|
7
7
|
className: o,
|
|
8
8
|
label: e,
|
|
9
9
|
labelClassName: a,
|
|
10
|
-
id:
|
|
11
|
-
...
|
|
10
|
+
id: s,
|
|
11
|
+
...n
|
|
12
12
|
}) {
|
|
13
|
-
const r =
|
|
14
|
-
return /* @__PURE__ */ l("div", { className:
|
|
13
|
+
const r = s || (e ? `textarea-${Math.random().toString(36).substring(2, 9)}` : void 0);
|
|
14
|
+
return /* @__PURE__ */ l("div", { className: d("space-y-1.5", i), children: [
|
|
15
15
|
e && /* @__PURE__ */ t(c, { htmlFor: r, className: a, children: e }),
|
|
16
16
|
/* @__PURE__ */ t(
|
|
17
17
|
"textarea",
|
|
18
18
|
{
|
|
19
19
|
id: r,
|
|
20
20
|
"data-slot": "textarea",
|
|
21
|
-
className:
|
|
22
|
-
"border-d-
|
|
21
|
+
className: d(
|
|
22
|
+
"border-d-border/50 placeholder:text-d-muted-foreground focus-visible:border-d-ring focus-visible:ring-d-ring/50 aria-invalid:ring-d-destructive/20 aria-invalid:border-d-destructive bg-d-input flex field-sizing-content min-h-16 w-full rounded-md border px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
23
23
|
o
|
|
24
24
|
),
|
|
25
|
-
...
|
|
25
|
+
...n
|
|
26
26
|
}
|
|
27
27
|
)
|
|
28
28
|
] });
|
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
|
56
56
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
57
57
|
import { UseAskResult } from 'use-ask';
|
|
58
58
|
import { UseEmblaCarouselType } from 'embla-carousel-react';
|
|
59
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
59
60
|
import { VariantProps } from 'class-variance-authority';
|
|
60
61
|
|
|
61
62
|
declare type AcceptItem = "pdf" | "doc" | "docx" | "xls" | "xlsx" | "ppt" | "pptx" | "txt" | "csv" | "jpg" | "jpeg" | "png" | "gif" | "image" | "video" | "audio";
|
|
@@ -1076,8 +1077,9 @@ export declare interface DatePickerProps {
|
|
|
1076
1077
|
|
|
1077
1078
|
export declare function Dialog({ ...props }: React_2.ComponentProps<typeof DialogPrimitive.Root>): JSX.Element;
|
|
1078
1079
|
|
|
1079
|
-
export declare function DialogContent({ className, children, size, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
1080
|
+
export declare function DialogContent({ className, children, size, closeOnOverlay, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
1080
1081
|
size?: "sm" | "default" | "lg" | "xl";
|
|
1082
|
+
closeOnOverlay?: boolean;
|
|
1081
1083
|
}): JSX.Element;
|
|
1082
1084
|
|
|
1083
1085
|
export declare function DialogDescription({ className, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Description>): JSX.Element;
|
|
@@ -1170,6 +1172,32 @@ declare type FilterOperator = "array_overlap" | "checked" | "date_after" | "date
|
|
|
1170
1172
|
|
|
1171
1173
|
export declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React_2.JSX.Element;
|
|
1172
1174
|
|
|
1175
|
+
export declare const FormComposer: ({ items, cols, form, submitText, onSubmit, isSubmitting, }: FormComposerProps) => JSX.Element;
|
|
1176
|
+
|
|
1177
|
+
declare interface FormComposerItem {
|
|
1178
|
+
label: string;
|
|
1179
|
+
component: "input" | "select" | "textarea" | "checkbox" | "multiselect" | "datepicker" | "radio" | "switch" | "slider";
|
|
1180
|
+
name: string;
|
|
1181
|
+
defaultValue?: string | boolean | number | string[] | Date | number[];
|
|
1182
|
+
options?: AppSelectOption[];
|
|
1183
|
+
disabled?: boolean;
|
|
1184
|
+
placeholder?: string;
|
|
1185
|
+
caption?: string;
|
|
1186
|
+
calendarRange?: [Date, Date];
|
|
1187
|
+
min?: number;
|
|
1188
|
+
max?: number;
|
|
1189
|
+
step?: number;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
declare interface FormComposerProps {
|
|
1193
|
+
cols?: "2" | "1" | "3";
|
|
1194
|
+
items: FormComposerItem[];
|
|
1195
|
+
form: UseFormReturn<any>;
|
|
1196
|
+
submitText?: string;
|
|
1197
|
+
onSubmit?: (data: any) => void;
|
|
1198
|
+
isSubmitting?: boolean;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1173
1201
|
export declare function FormControl({ ...props }: React_2.ComponentProps<typeof Slot>): JSX.Element;
|
|
1174
1202
|
|
|
1175
1203
|
export declare function FormDescription({ className, ...props }: React_2.ComponentProps<"p">): JSX.Element;
|