laif-ds 0.2.46 → 0.2.47
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/index2.js +5 -2
- package/dist/_virtual/index3.js +2 -5
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/components/AppForm.md +23 -10
- package/dist/components/ui/app-form.js +46 -45
- package/dist/index.d.ts +2 -0
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/package.json +1 -1
package/dist/_virtual/index2.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as t } from "../node_modules/eventemitter3/index2.js";
|
|
4
|
+
var r = t();
|
|
5
|
+
const m = /* @__PURE__ */ e(r);
|
|
3
6
|
export {
|
|
4
|
-
|
|
7
|
+
m as default
|
|
5
8
|
};
|
package/dist/_virtual/index3.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import { __require as t } from "../node_modules/eventemitter3/index2.js";
|
|
4
|
-
var r = t();
|
|
5
|
-
const m = /* @__PURE__ */ e(r);
|
|
2
|
+
var e = { exports: {} };
|
|
6
3
|
export {
|
|
7
|
-
|
|
4
|
+
e as __module
|
|
8
5
|
};
|
package/dist/_virtual/index6.js
CHANGED
package/dist/_virtual/index7.js
CHANGED
|
@@ -24,6 +24,7 @@ export interface AppFormItem {
|
|
|
24
24
|
| "switch"
|
|
25
25
|
| "slider"; // Field type
|
|
26
26
|
name: string; // Field name (used for form state and validation)
|
|
27
|
+
inputType?: string; // HTML input type for "input" component (e.g. "text", "email", "password", "number")
|
|
27
28
|
defaultValue?: string | boolean | number | string[] | Date | number[]; // Initial value
|
|
28
29
|
options?: AppSelectOption[]; // Options for select/multiselect/radio
|
|
29
30
|
disabled?: boolean; // Disables the field
|
|
@@ -88,15 +89,15 @@ export function SubmitInsideVsOutside() {
|
|
|
88
89
|
|
|
89
90
|
## Props
|
|
90
91
|
|
|
91
|
-
| Prop
|
|
92
|
-
|
|
|
93
|
-
| `items`
|
|
94
|
-
| `form`
|
|
95
|
-
| `cols`
|
|
96
|
-
| `submitText`
|
|
97
|
-
| `onSubmit`
|
|
98
|
-
| `isSubmitting`
|
|
99
|
-
| `showSubmitButton` | `boolean`
|
|
92
|
+
| Prop | Type | Default | Description |
|
|
93
|
+
| ------------------ | --------------------- | ------------ | -------------------------------------------------------- |
|
|
94
|
+
| `items` | `AppFormItem[]` | **required** | Array of form field configurations |
|
|
95
|
+
| `form` | `UseFormReturn<any>` | **required** | React Hook Form instance |
|
|
96
|
+
| `cols` | `"1" \| "2" \| "3"` | `"2"` | Number of grid columns |
|
|
97
|
+
| `submitText` | `string` | `"Invia"` | Text for submit button |
|
|
98
|
+
| `onSubmit` | `(data: any) => void` | `undefined` | Form submission callback |
|
|
99
|
+
| `isSubmitting` | `boolean` | `false` | Shows loading state on submit button |
|
|
100
|
+
| `showSubmitButton` | `boolean` | `false` | Renders an internal submit button at the end of the form |
|
|
100
101
|
|
|
101
102
|
---
|
|
102
103
|
|
|
@@ -114,30 +115,41 @@ export function SubmitInsideVsOutside() {
|
|
|
114
115
|
## Field Types
|
|
115
116
|
|
|
116
117
|
### input
|
|
117
|
-
|
|
118
|
+
|
|
119
|
+
Standard text input field. When `component: "input"`, you can use the `inputType` property to control the underlying HTML input type (e.g. `"text"`, `"email"`, `"password"`, `"number"`, `"url"`).
|
|
120
|
+
|
|
121
|
+
For a complete showcase of different input types, see the Storybook story `UI/AppForm/DifferentInputTypes`.
|
|
118
122
|
|
|
119
123
|
### textarea
|
|
124
|
+
|
|
120
125
|
Multi-line text area
|
|
121
126
|
|
|
122
127
|
### select
|
|
128
|
+
|
|
123
129
|
Single selection dropdown using AppSelect
|
|
124
130
|
|
|
125
131
|
### multiselect
|
|
132
|
+
|
|
126
133
|
Multiple selection dropdown using AppSelect with `multiple` prop
|
|
127
134
|
|
|
128
135
|
### datepicker
|
|
136
|
+
|
|
129
137
|
Date picker component with optional range selection via `calendarRange`
|
|
130
138
|
|
|
131
139
|
### radio
|
|
140
|
+
|
|
132
141
|
Radio button group with options
|
|
133
142
|
|
|
134
143
|
### checkbox
|
|
144
|
+
|
|
135
145
|
Single checkbox with label
|
|
136
146
|
|
|
137
147
|
### switch
|
|
148
|
+
|
|
138
149
|
Toggle switch with label and optional caption
|
|
139
150
|
|
|
140
151
|
### slider
|
|
152
|
+
|
|
141
153
|
Range slider with min/max/step configuration
|
|
142
154
|
|
|
143
155
|
---
|
|
@@ -167,6 +179,7 @@ export function BasicForm() {
|
|
|
167
179
|
label: "Email",
|
|
168
180
|
component: "input",
|
|
169
181
|
name: "email",
|
|
182
|
+
inputType: "email",
|
|
170
183
|
placeholder: "Enter your email",
|
|
171
184
|
},
|
|
172
185
|
{
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import { cn as o } from "../../lib/utils.js";
|
|
4
4
|
import { Controller as V } from "../../node_modules/react-hook-form/dist/index.esm.js";
|
|
5
|
-
import { AppSelect as
|
|
5
|
+
import { AppSelect as v } from "./app-select.js";
|
|
6
6
|
import { Button as j } from "./button.js";
|
|
7
7
|
import { Checkbox as A } from "./checkbox.js";
|
|
8
8
|
import { DatePicker as F } from "./date-picker.js";
|
|
9
9
|
import { Input as I } from "./input.js";
|
|
10
10
|
import { Label as t } from "./label.js";
|
|
11
11
|
import { RadioGroup as R, RadioGroupItem as B } from "./radio-group.js";
|
|
12
|
-
import { Slider as
|
|
13
|
-
import { Switch as
|
|
14
|
-
import { Textarea as
|
|
12
|
+
import { Slider as T } from "./slider.js";
|
|
13
|
+
import { Switch as $ } from "./switch.js";
|
|
14
|
+
import { Textarea as D } from "./textarea.js";
|
|
15
15
|
import { Typo as i } from "./typo.js";
|
|
16
16
|
const X = ({
|
|
17
|
-
items:
|
|
18
|
-
cols:
|
|
17
|
+
items: p,
|
|
18
|
+
cols: m = "2",
|
|
19
19
|
form: b,
|
|
20
20
|
submitText: g = "Invia",
|
|
21
21
|
onSubmit: x,
|
|
22
|
-
isSubmitting:
|
|
22
|
+
isSubmitting: h = !1,
|
|
23
23
|
showSubmitButton: C = !1
|
|
24
24
|
}) => {
|
|
25
25
|
const {
|
|
@@ -34,18 +34,19 @@ const X = ({
|
|
|
34
34
|
name: e.name,
|
|
35
35
|
control: N,
|
|
36
36
|
render: ({ field: r }) => {
|
|
37
|
-
const s = /* @__PURE__ */
|
|
37
|
+
const s = /* @__PURE__ */ l("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
38
38
|
/* @__PURE__ */ a(t, { children: e.label }),
|
|
39
39
|
d && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: d })
|
|
40
40
|
] });
|
|
41
41
|
switch (e.component) {
|
|
42
42
|
case "input":
|
|
43
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
44
44
|
s,
|
|
45
45
|
/* @__PURE__ */ a(
|
|
46
46
|
I,
|
|
47
47
|
{
|
|
48
48
|
...r,
|
|
49
|
+
type: e.inputType,
|
|
49
50
|
placeholder: e.placeholder,
|
|
50
51
|
className: o(d && "border-d-destructive"),
|
|
51
52
|
disabled: e.disabled
|
|
@@ -53,10 +54,10 @@ const X = ({
|
|
|
53
54
|
)
|
|
54
55
|
] });
|
|
55
56
|
case "textarea":
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
57
58
|
s,
|
|
58
59
|
/* @__PURE__ */ a(
|
|
59
|
-
|
|
60
|
+
D,
|
|
60
61
|
{
|
|
61
62
|
...r,
|
|
62
63
|
placeholder: e.placeholder,
|
|
@@ -66,18 +67,18 @@ const X = ({
|
|
|
66
67
|
)
|
|
67
68
|
] });
|
|
68
69
|
case "radio":
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
70
71
|
s,
|
|
71
72
|
/* @__PURE__ */ a(
|
|
72
73
|
R,
|
|
73
74
|
{
|
|
74
75
|
value: r.value != null ? String(r.value) : "",
|
|
75
|
-
onValueChange: (
|
|
76
|
+
onValueChange: (n) => r.onChange(n),
|
|
76
77
|
className: "space-y-2",
|
|
77
78
|
disabled: e.disabled,
|
|
78
|
-
children: (e.options ?? []).map((
|
|
79
|
-
const u = `${e.name}-${
|
|
80
|
-
return /* @__PURE__ */
|
|
79
|
+
children: (e.options ?? []).map((n) => {
|
|
80
|
+
const u = `${e.name}-${n.value}`;
|
|
81
|
+
return /* @__PURE__ */ l(
|
|
81
82
|
"div",
|
|
82
83
|
{
|
|
83
84
|
className: "flex items-center gap-2",
|
|
@@ -86,7 +87,7 @@ const X = ({
|
|
|
86
87
|
B,
|
|
87
88
|
{
|
|
88
89
|
id: u,
|
|
89
|
-
value: String(
|
|
90
|
+
value: String(n.value),
|
|
90
91
|
disabled: e.disabled
|
|
91
92
|
}
|
|
92
93
|
),
|
|
@@ -98,25 +99,25 @@ const X = ({
|
|
|
98
99
|
"cursor-pointer",
|
|
99
100
|
e.disabled && "cursor-not-allowed opacity-60"
|
|
100
101
|
),
|
|
101
|
-
children:
|
|
102
|
+
children: n.label
|
|
102
103
|
}
|
|
103
104
|
)
|
|
104
105
|
]
|
|
105
106
|
},
|
|
106
|
-
|
|
107
|
+
n.value
|
|
107
108
|
);
|
|
108
109
|
})
|
|
109
110
|
}
|
|
110
111
|
)
|
|
111
112
|
] });
|
|
112
113
|
case "select":
|
|
113
|
-
return /* @__PURE__ */
|
|
114
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
114
115
|
s,
|
|
115
116
|
/* @__PURE__ */ a(
|
|
116
|
-
|
|
117
|
+
v,
|
|
117
118
|
{
|
|
118
119
|
...r,
|
|
119
|
-
onValueChange: (
|
|
120
|
+
onValueChange: (n) => r.onChange(n),
|
|
120
121
|
options: e.options ?? [],
|
|
121
122
|
placeholder: e.placeholder,
|
|
122
123
|
disabled: e.disabled
|
|
@@ -124,14 +125,14 @@ const X = ({
|
|
|
124
125
|
)
|
|
125
126
|
] });
|
|
126
127
|
case "multiselect":
|
|
127
|
-
return /* @__PURE__ */
|
|
128
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
128
129
|
s,
|
|
129
130
|
/* @__PURE__ */ a(
|
|
130
|
-
|
|
131
|
+
v,
|
|
131
132
|
{
|
|
132
133
|
...r,
|
|
133
134
|
multiple: !0,
|
|
134
|
-
onValueChange: (
|
|
135
|
+
onValueChange: (n) => r.onChange(n),
|
|
135
136
|
options: e.options ?? [],
|
|
136
137
|
placeholder: e.placeholder,
|
|
137
138
|
disabled: e.disabled
|
|
@@ -139,13 +140,13 @@ const X = ({
|
|
|
139
140
|
)
|
|
140
141
|
] });
|
|
141
142
|
case "datepicker":
|
|
142
|
-
return /* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
143
144
|
s,
|
|
144
145
|
/* @__PURE__ */ a(
|
|
145
146
|
F,
|
|
146
147
|
{
|
|
147
148
|
value: r.value,
|
|
148
|
-
onChange: e.disabled || e.calendarRange ? void 0 : (
|
|
149
|
+
onChange: e.disabled || e.calendarRange ? void 0 : (n) => r.onChange(n),
|
|
149
150
|
placeholder: e.placeholder,
|
|
150
151
|
disabled: e.disabled,
|
|
151
152
|
customCalendarProps: e.disabled ? {
|
|
@@ -154,20 +155,20 @@ const X = ({
|
|
|
154
155
|
} : e.calendarRange ? {
|
|
155
156
|
mode: "range",
|
|
156
157
|
selected: r.value,
|
|
157
|
-
onSelect: (
|
|
158
|
+
onSelect: (n) => r.onChange(n)
|
|
158
159
|
} : void 0
|
|
159
160
|
}
|
|
160
161
|
)
|
|
161
162
|
] });
|
|
162
163
|
case "checkbox":
|
|
163
|
-
return /* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
164
|
+
return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
165
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
165
166
|
/* @__PURE__ */ a(
|
|
166
167
|
A,
|
|
167
168
|
{
|
|
168
169
|
...r,
|
|
169
170
|
id: e.name,
|
|
170
|
-
onCheckedChange: (
|
|
171
|
+
onCheckedChange: (n) => r.onChange(n),
|
|
171
172
|
defaultChecked: !!e.defaultValue,
|
|
172
173
|
disabled: e.disabled
|
|
173
174
|
}
|
|
@@ -195,9 +196,9 @@ const X = ({
|
|
|
195
196
|
)
|
|
196
197
|
] });
|
|
197
198
|
case "switch":
|
|
198
|
-
return /* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */
|
|
199
|
+
return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
200
|
+
/* @__PURE__ */ l("div", { className: "flex items-center justify-between", children: [
|
|
201
|
+
/* @__PURE__ */ l("div", { children: [
|
|
201
202
|
/* @__PURE__ */ a(t, { htmlFor: e.name, children: e.label }),
|
|
202
203
|
e.caption && /* @__PURE__ */ a(
|
|
203
204
|
i,
|
|
@@ -209,11 +210,11 @@ const X = ({
|
|
|
209
210
|
)
|
|
210
211
|
] }),
|
|
211
212
|
/* @__PURE__ */ a(
|
|
212
|
-
|
|
213
|
+
$,
|
|
213
214
|
{
|
|
214
215
|
id: e.name,
|
|
215
216
|
checked: !!r.value,
|
|
216
|
-
onCheckedChange: (
|
|
217
|
+
onCheckedChange: (n) => r.onChange(n),
|
|
217
218
|
disabled: e.disabled
|
|
218
219
|
}
|
|
219
220
|
)
|
|
@@ -221,13 +222,13 @@ const X = ({
|
|
|
221
222
|
d && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: d })
|
|
222
223
|
] });
|
|
223
224
|
case "slider":
|
|
224
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
225
226
|
s,
|
|
226
227
|
/* @__PURE__ */ a(
|
|
227
|
-
|
|
228
|
+
T,
|
|
228
229
|
{
|
|
229
230
|
value: Array.isArray(r.value) ? r.value : [r.value || e.min || 0],
|
|
230
|
-
onValueChange: (
|
|
231
|
+
onValueChange: (n) => r.onChange(n[0]),
|
|
231
232
|
min: e.min ?? 0,
|
|
232
233
|
max: e.max ?? 100,
|
|
233
234
|
step: e.step ?? 1,
|
|
@@ -249,11 +250,11 @@ const X = ({
|
|
|
249
250
|
}
|
|
250
251
|
) });
|
|
251
252
|
};
|
|
252
|
-
return /* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */ a("div", { className: o("grid gap-4", `grid-cols-${
|
|
253
|
+
return /* @__PURE__ */ l("form", { onSubmit: y((e) => x?.(e)), children: [
|
|
254
|
+
/* @__PURE__ */ a("div", { className: o("grid gap-4", `grid-cols-${m}`), children: p.map((e, c) => /* @__PURE__ */ a(
|
|
254
255
|
"div",
|
|
255
256
|
{
|
|
256
|
-
className: o(c ===
|
|
257
|
+
className: o(c === p.length - 1 && "col-span-full"),
|
|
257
258
|
children: w(e)
|
|
258
259
|
},
|
|
259
260
|
e.name
|
|
@@ -262,8 +263,8 @@ const X = ({
|
|
|
262
263
|
j,
|
|
263
264
|
{
|
|
264
265
|
type: "submit",
|
|
265
|
-
disabled: !S || !k ||
|
|
266
|
-
isLoading:
|
|
266
|
+
disabled: !S || !k || h,
|
|
267
|
+
isLoading: h,
|
|
267
268
|
children: g
|
|
268
269
|
}
|
|
269
270
|
) })
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ClassValue } from 'clsx';
|
|
|
8
8
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
9
9
|
import { ColumnDef } from '@tanstack/react-table';
|
|
10
10
|
import { Command as Command_2 } from 'cmdk';
|
|
11
|
+
import { ComponentProps } from 'react';
|
|
11
12
|
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
12
13
|
import { ControllerProps } from 'react-hook-form';
|
|
13
14
|
import { DayPicker } from 'react-day-picker';
|
|
@@ -152,6 +153,7 @@ export declare interface AppFormItem {
|
|
|
152
153
|
label: string;
|
|
153
154
|
component: "input" | "select" | "textarea" | "checkbox" | "multiselect" | "datepicker" | "radio" | "switch" | "slider";
|
|
154
155
|
name: string;
|
|
156
|
+
inputType?: ComponentProps<"input">["type"];
|
|
155
157
|
defaultValue?: string | boolean | number | string[] | Date | number[];
|
|
156
158
|
options?: AppSelectOption[];
|
|
157
159
|
disabled?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { __module as e } from "../../../_virtual/
|
|
2
|
+
import { __module as e } from "../../../_virtual/index3.js";
|
|
3
3
|
import { __require as i } from "../cjs/use-sync-external-store-shim.production.js";
|
|
4
4
|
import { __require as o } from "../cjs/use-sync-external-store-shim.development.js";
|
|
5
5
|
var r;
|