laif-ds 1.1.1 → 1.1.3
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/CHANGELOG.md +20 -0
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/adoption-report.json +3 -3
- package/dist/agent-docs/components/AppEditor.md +51 -13
- package/dist/agent-docs/components/Input.md +11 -10
- package/dist/agent-docs/manifest.json +13 -10
- package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +34 -30
- package/dist/components/editor/plugins/toolbar/link-toolbar-plugin.js +99 -0
- package/dist/components/editor/themes/editor-theme.js +5 -2
- package/dist/components/ui/app-data-grid/app-data-grid.js +1 -0
- package/dist/components/ui/app-editor.js +162 -138
- package/dist/components/ui/input.js +63 -62
- package/dist/index.d.ts +18 -2
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +2 -1
|
@@ -1,207 +1,231 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
|
|
2
|
+
import { jsx as r, jsxs as n, Fragment as u } from "react/jsx-runtime";
|
|
3
|
+
import { LinkNode as U } from "../../node_modules/@lexical/link/dist/LexicalLink.prod.js";
|
|
4
|
+
import { ListNode as _, ListItemNode as Q } from "../../node_modules/@lexical/list/dist/LexicalList.prod.js";
|
|
5
|
+
import { TRANSFORMERS as K, $convertToMarkdownString as W, $convertFromMarkdownString as Z } from "../../node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js";
|
|
6
|
+
import { CheckListPlugin as q } from "../../node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js";
|
|
7
|
+
import { ClearEditorPlugin as G } from "../../node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js";
|
|
8
|
+
import { LexicalComposer as J } from "../../node_modules/@lexical/react/dist/LexicalComposer.prod.js";
|
|
9
|
+
import { useLexicalComposerContext as L } from "../../node_modules/@lexical/react/dist/LexicalComposerContext.prod.js";
|
|
10
|
+
import { LexicalErrorBoundary as X } from "../../node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js";
|
|
11
|
+
import { HistoryPlugin as Y } from "../../node_modules/@lexical/react/dist/LexicalHistoryPlugin.prod.js";
|
|
12
|
+
import { ListPlugin as V } from "../../node_modules/@lexical/react/dist/LexicalListPlugin.prod.js";
|
|
13
|
+
import { OnChangePlugin as rr } from "../../node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js";
|
|
14
|
+
import { RichTextPlugin as or } from "../../node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js";
|
|
15
|
+
import { HeadingNode as er, QuoteNode as tr } from "../../node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js";
|
|
16
|
+
import { ParagraphNode as g, TextNode as h, $nodesOfType as ir, $getRoot as N } from "../../node_modules/lexical/dist/Lexical.prod.js";
|
|
17
|
+
import { forwardRef as nr, useState as lr, useMemo as ar, useImperativeHandle as sr, useEffect as mr } from "react";
|
|
18
|
+
import { ContentEditable as cr } from "../editor/editor-ui/content-editable.js";
|
|
19
|
+
import { MentionNode as k } from "../editor/nodes/mention-node.js";
|
|
20
|
+
import { ActionsPlugin as dr } from "../editor/plugins/actions/actions-plugin.js";
|
|
21
|
+
import { ClearEditorActionPlugin as pr } from "../editor/plugins/actions/clear-editor-plugin.js";
|
|
22
|
+
import { CounterCharacterPlugin as fr } from "../editor/plugins/actions/counter-character-plugin.js";
|
|
23
|
+
import { MENTION_TRANSFORMER as ur, MentionPlugin as gr, collectMentions as hr } from "../editor/plugins/mention-plugin.js";
|
|
24
|
+
import { FormatBulletedList as Nr } from "../editor/plugins/toolbar/block-format/format-bulleted-list.js";
|
|
25
|
+
import { FormatCheckList as br } from "../editor/plugins/toolbar/block-format/format-check-list.js";
|
|
26
|
+
import { FormatHeading as vr } from "../editor/plugins/toolbar/block-format/format-heading.js";
|
|
27
|
+
import { FormatNumberedList as xr } from "../editor/plugins/toolbar/block-format/format-numbered-list.js";
|
|
28
|
+
import { FormatParagraph as Er } from "../editor/plugins/toolbar/block-format/format-paragraph.js";
|
|
29
|
+
import { FormatQuote as Fr } from "../editor/plugins/toolbar/block-format/format-quote.js";
|
|
30
|
+
import { BlockFormatDropDown as Pr } from "../editor/plugins/toolbar/block-format-toolbar-plugin.js";
|
|
31
|
+
import { FontFormatToolbarPlugin as m } from "../editor/plugins/toolbar/font-format-toolbar-plugin.js";
|
|
32
|
+
import { LinkToolbarPlugin as yr, $insertLink as Rr } from "../editor/plugins/toolbar/link-toolbar-plugin.js";
|
|
33
|
+
import { MentionInsertToolbarPlugin as Cr } from "../editor/plugins/toolbar/mention-insert-toolbar-plugin.js";
|
|
34
|
+
import { ToolbarPlugin as f } from "../editor/plugins/toolbar/toolbar-plugin.js";
|
|
35
|
+
import { editorTheme as Tr } from "../editor/themes/editor-theme.js";
|
|
36
|
+
import { TooltipProvider as kr } from "./tooltip.js";
|
|
37
|
+
import { HistoryToolbarPlugin as wr } from "../editor/plugins/toolbar/history-toolbar-plugin.js";
|
|
38
|
+
import { cn as Lr } from "../../lib/utils.js";
|
|
39
|
+
const Sr = "Start typing...", Ar = {
|
|
38
40
|
format: ["underline"],
|
|
39
41
|
tag: "++",
|
|
40
42
|
type: "text-format"
|
|
41
|
-
},
|
|
42
|
-
...
|
|
43
|
-
|
|
44
|
-
],
|
|
45
|
-
function
|
|
43
|
+
}, w = [
|
|
44
|
+
...K,
|
|
45
|
+
Ar
|
|
46
|
+
], Mr = (o) => o.replace(/<u>(.*?)<\/u>/g, "++$1++"), $r = (o) => o.replace(/\+\+(.+?)\+\+/g, "<u>$1</u>");
|
|
47
|
+
function Ir({
|
|
48
|
+
handleRef: o
|
|
49
|
+
}) {
|
|
50
|
+
const [e] = L();
|
|
51
|
+
return sr(
|
|
52
|
+
o,
|
|
53
|
+
() => ({
|
|
54
|
+
insertLink: (t, a) => {
|
|
55
|
+
e.focus(), e.update(() => Rr(t, a));
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
[e]
|
|
59
|
+
), null;
|
|
60
|
+
}
|
|
61
|
+
function Or({
|
|
46
62
|
defaultValue: o,
|
|
47
|
-
onlyMarkdown:
|
|
48
|
-
transformers:
|
|
63
|
+
onlyMarkdown: e,
|
|
64
|
+
transformers: t
|
|
49
65
|
}) {
|
|
50
|
-
const [
|
|
51
|
-
return
|
|
52
|
-
o &&
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
) :
|
|
66
|
+
const [a] = L();
|
|
67
|
+
return mr(() => {
|
|
68
|
+
o && a.update(() => {
|
|
69
|
+
e ? Z(
|
|
70
|
+
Mr(o),
|
|
71
|
+
t
|
|
72
|
+
) : N().append(
|
|
57
73
|
new g().append(new h(o))
|
|
58
74
|
);
|
|
59
|
-
const
|
|
60
|
-
(
|
|
75
|
+
const c = N();
|
|
76
|
+
(c.getFirstChild() ?? c).selectStart();
|
|
61
77
|
});
|
|
62
|
-
}, [
|
|
78
|
+
}, [a, o, e, t]), null;
|
|
63
79
|
}
|
|
64
|
-
function
|
|
80
|
+
function Hr({
|
|
65
81
|
defaultValue: o,
|
|
66
|
-
onMarkdownEdit:
|
|
67
|
-
onValueChange:
|
|
68
|
-
plugins:
|
|
69
|
-
toolbars:
|
|
70
|
-
placeholder:
|
|
71
|
-
onlyMarkdown:
|
|
72
|
-
className:
|
|
73
|
-
wrpClassName:
|
|
74
|
-
mentions:
|
|
75
|
-
mentionTrigger:
|
|
76
|
-
}) {
|
|
77
|
-
const [,
|
|
78
|
-
() =>
|
|
79
|
-
[
|
|
82
|
+
onMarkdownEdit: e,
|
|
83
|
+
onValueChange: t,
|
|
84
|
+
plugins: a = [],
|
|
85
|
+
toolbars: c = [],
|
|
86
|
+
placeholder: S = Sr,
|
|
87
|
+
onlyMarkdown: b = !0,
|
|
88
|
+
className: A = "rounded-lg border border-d-border",
|
|
89
|
+
wrpClassName: M = "",
|
|
90
|
+
mentions: d,
|
|
91
|
+
mentionTrigger: v = "@"
|
|
92
|
+
}, $) {
|
|
93
|
+
const [, I] = lr(null), s = d !== void 0, x = ar(
|
|
94
|
+
() => s ? [ur, ...w] : w,
|
|
95
|
+
[s]
|
|
80
96
|
), O = {
|
|
81
97
|
namespace: "AppEditor",
|
|
82
|
-
theme:
|
|
98
|
+
theme: Tr,
|
|
83
99
|
nodes: [
|
|
84
|
-
|
|
100
|
+
er,
|
|
85
101
|
g,
|
|
86
102
|
h,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
tr,
|
|
104
|
+
_,
|
|
105
|
+
Q,
|
|
106
|
+
// TRANSFORMERS includes the Markdown LINK transformer, which needs this
|
|
107
|
+
// node to import `[text](url)` from `defaultValue`.
|
|
108
|
+
U,
|
|
109
|
+
...s ? [k] : []
|
|
91
110
|
],
|
|
92
|
-
onError: (
|
|
93
|
-
console.error(
|
|
111
|
+
onError: (i) => {
|
|
112
|
+
console.error(i);
|
|
94
113
|
},
|
|
95
|
-
...o && !
|
|
114
|
+
...o && !b ? {
|
|
96
115
|
editorState: () => {
|
|
97
|
-
|
|
116
|
+
N().append(
|
|
98
117
|
new g().append(new h(o))
|
|
99
118
|
);
|
|
100
119
|
}
|
|
101
120
|
} : {}
|
|
102
|
-
}, E = (
|
|
103
|
-
return /* @__PURE__ */ r("div", { className:
|
|
121
|
+
}, E = (i) => a.includes(i), p = (i) => c.includes(i), F = E("clear"), P = E("counter"), y = p("block-format"), H = p("font-format"), R = p("history"), j = p("link");
|
|
122
|
+
return /* @__PURE__ */ r("div", { className: Lr("bg-d-background flex h-96 flex-col", M), children: /* @__PURE__ */ r(J, { initialConfig: O, children: /* @__PURE__ */ n(kr, { children: [
|
|
123
|
+
/* @__PURE__ */ r(Ir, { handleRef: $ }),
|
|
104
124
|
o && /* @__PURE__ */ r(
|
|
105
|
-
|
|
125
|
+
Or,
|
|
106
126
|
{
|
|
107
127
|
defaultValue: o,
|
|
108
|
-
onlyMarkdown:
|
|
109
|
-
transformers:
|
|
128
|
+
onlyMarkdown: b,
|
|
129
|
+
transformers: x
|
|
110
130
|
}
|
|
111
131
|
),
|
|
112
|
-
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
/* @__PURE__ */ r(
|
|
117
|
-
/* @__PURE__ */ r(
|
|
118
|
-
/* @__PURE__ */ r(
|
|
119
|
-
/* @__PURE__ */ r(
|
|
120
|
-
/* @__PURE__ */ r(
|
|
121
|
-
/* @__PURE__ */ r(
|
|
132
|
+
s && /* @__PURE__ */ r(gr, { source: d, trigger: v }),
|
|
133
|
+
/* @__PURE__ */ n("div", { className: "border-d-border flex items-center border-b", children: [
|
|
134
|
+
R && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ r(wr, {}) }) }),
|
|
135
|
+
y && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ r(u, { children: /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ n(Pr, { children: [
|
|
136
|
+
/* @__PURE__ */ r(Er, {}),
|
|
137
|
+
/* @__PURE__ */ r(vr, { levels: ["h1", "h2", "h3"] }),
|
|
138
|
+
/* @__PURE__ */ r(xr, {}),
|
|
139
|
+
/* @__PURE__ */ r(Nr, {}),
|
|
140
|
+
/* @__PURE__ */ r(br, {}),
|
|
141
|
+
/* @__PURE__ */ r(Fr, {})
|
|
122
142
|
] }) }) }) }),
|
|
123
|
-
|
|
124
|
-
/* @__PURE__ */ r(
|
|
125
|
-
/* @__PURE__ */ r(
|
|
126
|
-
/* @__PURE__ */ r(
|
|
127
|
-
/* @__PURE__ */ r(
|
|
128
|
-
|
|
129
|
-
|
|
143
|
+
H && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ n("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: [
|
|
144
|
+
/* @__PURE__ */ r(m, { format: "bold" }),
|
|
145
|
+
/* @__PURE__ */ r(m, { format: "italic" }),
|
|
146
|
+
/* @__PURE__ */ r(m, { format: "underline" }),
|
|
147
|
+
/* @__PURE__ */ r(m, { format: "strikethrough" }),
|
|
148
|
+
/* @__PURE__ */ r(m, { format: "code" }),
|
|
149
|
+
s && /* @__PURE__ */ r(
|
|
150
|
+
Cr,
|
|
130
151
|
{
|
|
131
|
-
trigger:
|
|
152
|
+
trigger: v ?? "@"
|
|
132
153
|
}
|
|
133
154
|
)
|
|
134
|
-
] }) })
|
|
155
|
+
] }) }),
|
|
156
|
+
j && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ r(yr, {}) }) })
|
|
135
157
|
] }),
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
|
|
158
|
+
/* @__PURE__ */ n("div", { className: "relative flex min-h-0 w-full flex-1 flex-col", children: [
|
|
159
|
+
R && /* @__PURE__ */ r(Y, {}),
|
|
138
160
|
/* @__PURE__ */ r(
|
|
139
|
-
|
|
161
|
+
or,
|
|
140
162
|
{
|
|
141
|
-
ErrorBoundary:
|
|
163
|
+
ErrorBoundary: X,
|
|
142
164
|
contentEditable: /* @__PURE__ */ r(
|
|
143
165
|
"div",
|
|
144
166
|
{
|
|
145
|
-
ref:
|
|
167
|
+
ref: I,
|
|
146
168
|
className: "flex min-h-0 w-full flex-1 overflow-auto",
|
|
147
169
|
children: /* @__PURE__ */ r(
|
|
148
|
-
|
|
170
|
+
cr,
|
|
149
171
|
{
|
|
150
|
-
placeholder:
|
|
151
|
-
className: `border-d-border w-full rounded-none border-b ${
|
|
172
|
+
placeholder: S,
|
|
173
|
+
className: `border-d-border w-full rounded-none border-b ${A}`
|
|
152
174
|
}
|
|
153
175
|
)
|
|
154
176
|
}
|
|
155
177
|
)
|
|
156
178
|
}
|
|
157
179
|
),
|
|
158
|
-
|
|
159
|
-
/* @__PURE__ */ r(
|
|
160
|
-
/* @__PURE__ */ r(
|
|
180
|
+
y && /* @__PURE__ */ n(u, { children: [
|
|
181
|
+
/* @__PURE__ */ r(V, {}),
|
|
182
|
+
/* @__PURE__ */ r(q, {})
|
|
161
183
|
] }),
|
|
162
|
-
(F ||
|
|
184
|
+
(F || P) && /* @__PURE__ */ r(dr, { children: /* @__PURE__ */ n("div", { className: "clear-both flex items-center justify-between gap-2 p-1", children: [
|
|
163
185
|
/* @__PURE__ */ r("div", { className: "flex flex-1 justify-start" }),
|
|
164
|
-
/* @__PURE__ */ r("div", { children:
|
|
165
|
-
/* @__PURE__ */ r("div", { className: "flex flex-1 justify-end gap-2", children: F && /* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */ r(
|
|
167
|
-
/* @__PURE__ */ r(
|
|
186
|
+
/* @__PURE__ */ r("div", { children: P && /* @__PURE__ */ r(fr, { charset: "UTF-16" }) }),
|
|
187
|
+
/* @__PURE__ */ r("div", { className: "flex flex-1 justify-end gap-2", children: F && /* @__PURE__ */ n(u, { children: [
|
|
188
|
+
/* @__PURE__ */ r(pr, {}),
|
|
189
|
+
/* @__PURE__ */ r(G, {})
|
|
168
190
|
] }) })
|
|
169
191
|
] }) })
|
|
170
192
|
] }),
|
|
171
193
|
/* @__PURE__ */ r(
|
|
172
|
-
|
|
194
|
+
rr,
|
|
173
195
|
{
|
|
174
196
|
ignoreSelectionChange: !0,
|
|
175
|
-
onChange: (
|
|
176
|
-
if (!
|
|
177
|
-
const
|
|
178
|
-
|
|
197
|
+
onChange: (i) => {
|
|
198
|
+
if (!t && !e) return;
|
|
199
|
+
const C = $r(
|
|
200
|
+
i.read(() => W(x))
|
|
179
201
|
);
|
|
180
|
-
if (!
|
|
181
|
-
|
|
202
|
+
if (!t) {
|
|
203
|
+
e?.(C);
|
|
182
204
|
return;
|
|
183
205
|
}
|
|
184
|
-
let
|
|
185
|
-
if (
|
|
186
|
-
const
|
|
187
|
-
() =>
|
|
188
|
-
),
|
|
189
|
-
|
|
206
|
+
let T = [];
|
|
207
|
+
if (s) {
|
|
208
|
+
const B = i.read(
|
|
209
|
+
() => hr(ir(k))
|
|
210
|
+
), z = Array.isArray(d) ? d : [], D = new Map(
|
|
211
|
+
z.map((l) => [String(l.id), l])
|
|
190
212
|
);
|
|
191
|
-
|
|
192
|
-
(
|
|
193
|
-
id:
|
|
194
|
-
label:
|
|
195
|
-
value:
|
|
213
|
+
T = B.map(
|
|
214
|
+
(l) => D.get(String(l.id)) ?? {
|
|
215
|
+
id: l.id,
|
|
216
|
+
label: l.label,
|
|
217
|
+
value: l.value
|
|
196
218
|
}
|
|
197
219
|
);
|
|
198
220
|
}
|
|
199
|
-
|
|
221
|
+
t(C, { mentions: T });
|
|
200
222
|
}
|
|
201
223
|
}
|
|
202
224
|
)
|
|
203
225
|
] }) }) });
|
|
204
226
|
}
|
|
227
|
+
const jr = nr(Hr);
|
|
228
|
+
jr.displayName = "AppEditor";
|
|
205
229
|
export {
|
|
206
|
-
|
|
230
|
+
jr as AppEditor
|
|
207
231
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as u, jsx as o } from "react/jsx-runtime";
|
|
3
|
-
import { cva as
|
|
3
|
+
import { cva as y } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
4
4
|
import * as a from "react";
|
|
5
5
|
import { designTokens as i } from "../design-tokens.js";
|
|
6
|
-
import { Label as
|
|
7
|
-
import { cn as
|
|
6
|
+
import { Label as le } from "./label.js";
|
|
7
|
+
import { cn as l } from "../../lib/utils.js";
|
|
8
8
|
import { Icon as k } from "./icon.js";
|
|
9
|
-
import { Typo as
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
import { Typo as ce } from "./typo.js";
|
|
10
|
+
const ue = y(
|
|
11
|
+
l(
|
|
12
12
|
i.input.base,
|
|
13
13
|
i.radius.default,
|
|
14
14
|
"items-center gap-2 px-3",
|
|
@@ -27,8 +27,8 @@ const le = G(
|
|
|
27
27
|
size: "default"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
),
|
|
31
|
-
|
|
30
|
+
), de = y(
|
|
31
|
+
l(
|
|
32
32
|
i.text.base,
|
|
33
33
|
"shadow-none flex-1 min-w-0 bg-transparent outline-none border-0 p-0 overflow-hidden text-ellipsis",
|
|
34
34
|
"file:text-d-foreground file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
@@ -50,26 +50,27 @@ const le = G(
|
|
|
50
50
|
size: "default"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
),
|
|
53
|
+
), w = {
|
|
54
54
|
show: "Mostra password",
|
|
55
55
|
hide: "Nascondi password"
|
|
56
|
-
}, T = "Cancella",
|
|
56
|
+
}, T = "Cancella", be = a.forwardRef(
|
|
57
57
|
({
|
|
58
|
-
className:
|
|
58
|
+
className: G,
|
|
59
59
|
type: d,
|
|
60
60
|
label: E,
|
|
61
|
-
labelClassName:
|
|
62
|
-
id:
|
|
61
|
+
labelClassName: F,
|
|
62
|
+
id: X,
|
|
63
63
|
iconLeft: M,
|
|
64
64
|
iconRight: V,
|
|
65
65
|
startContent: C,
|
|
66
66
|
endContent: L,
|
|
67
|
+
clearable: $ = !0,
|
|
67
68
|
size: f,
|
|
68
|
-
disabled:
|
|
69
|
+
disabled: c,
|
|
69
70
|
required: O,
|
|
70
71
|
onBlur: _,
|
|
71
|
-
onChange:
|
|
72
|
-
onInvalid:
|
|
72
|
+
onChange: B,
|
|
73
|
+
onInvalid: z,
|
|
73
74
|
"aria-invalid": J,
|
|
74
75
|
"aria-describedby": K,
|
|
75
76
|
showValidMessage: D = !1,
|
|
@@ -77,19 +78,19 @@ const le = G(
|
|
|
77
78
|
validityI18n: t,
|
|
78
79
|
...m
|
|
79
80
|
}, Q) => {
|
|
80
|
-
const [p, Y] = a.useState(!1), [
|
|
81
|
+
const [p, Y] = a.useState(!1), [x, N] = a.useState(!0), [Z, R] = a.useState(!1), [U, S] = a.useState(""), q = a.useId(), b = X ?? q, j = `${b}-validity`, h = a.useRef(null), v = d === "password", I = d === "search", [ee, W] = a.useState(
|
|
81
82
|
() => String(m.value ?? m.defaultValue ?? "").length > 0
|
|
82
|
-
), I = v ? p ? "text" : "password" : d,
|
|
83
|
+
), H = I && $ && ee && !c, te = v ? p ? "text" : "password" : d, P = J ?? (!x && Z ? !0 : void 0), se = [K, A && j].filter(Boolean).join(" ").trim() || void 0;
|
|
83
84
|
a.useImperativeHandle(Q, () => h.current);
|
|
84
|
-
const
|
|
85
|
+
const ae = a.useCallback(
|
|
85
86
|
(e) => {
|
|
86
|
-
if (
|
|
87
|
+
if (c) return;
|
|
87
88
|
const s = e.target;
|
|
88
89
|
if (s.tagName === "INPUT" || s.tagName === "BUTTON") return;
|
|
89
90
|
const r = h.current;
|
|
90
91
|
r && (r.focus(), !v && d !== "file" && r.select());
|
|
91
92
|
},
|
|
92
|
-
[
|
|
93
|
+
[c, v, d]
|
|
93
94
|
), g = a.useCallback(
|
|
94
95
|
(e) => {
|
|
95
96
|
const s = e.validity, r = e.validationMessage !== "" ? e.validationMessage : "✓";
|
|
@@ -111,51 +112,51 @@ const le = G(
|
|
|
111
112
|
N(e), S(s);
|
|
112
113
|
}
|
|
113
114
|
}, [g]);
|
|
114
|
-
const
|
|
115
|
+
const re = a.useCallback(
|
|
115
116
|
(e) => {
|
|
116
117
|
R(!0);
|
|
117
118
|
const { isValid: s, message: r } = g(e.currentTarget);
|
|
118
|
-
N(s), S(r),
|
|
119
|
+
N(s), S(r), W(e.currentTarget.value.length > 0), B?.(e);
|
|
119
120
|
},
|
|
120
|
-
[
|
|
121
|
+
[B, g]
|
|
121
122
|
);
|
|
122
123
|
a.useEffect(() => {
|
|
123
|
-
m.value !== void 0 &&
|
|
124
|
+
m.value !== void 0 && W(String(m.value).length > 0);
|
|
124
125
|
}, [m.value]);
|
|
125
|
-
const
|
|
126
|
+
const ne = a.useCallback(() => {
|
|
126
127
|
const e = h.current;
|
|
127
128
|
if (!e) return;
|
|
128
129
|
Object.getOwnPropertyDescriptor(
|
|
129
130
|
window.HTMLInputElement.prototype,
|
|
130
131
|
"value"
|
|
131
132
|
)?.set?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), e.focus();
|
|
132
|
-
}, []),
|
|
133
|
+
}, []), oe = a.useCallback(
|
|
133
134
|
(e) => {
|
|
134
135
|
R(!0), _?.(e);
|
|
135
136
|
},
|
|
136
137
|
[_]
|
|
137
|
-
),
|
|
138
|
+
), ie = a.useCallback(
|
|
138
139
|
(e) => {
|
|
139
140
|
const { isValid: s, message: r } = g(e.currentTarget);
|
|
140
|
-
N(s), S(r),
|
|
141
|
+
N(s), S(r), z?.(e);
|
|
141
142
|
},
|
|
142
|
-
[
|
|
143
|
+
[z, g]
|
|
143
144
|
);
|
|
144
|
-
return /* @__PURE__ */ u("div", { className:
|
|
145
|
-
E && /* @__PURE__ */ u(
|
|
145
|
+
return /* @__PURE__ */ u("div", { className: l("flex flex-col gap-1.5", G), children: [
|
|
146
|
+
E && /* @__PURE__ */ u(le, { htmlFor: b, className: l("gap-0.5", F), children: [
|
|
146
147
|
E,
|
|
147
|
-
O &&
|
|
148
|
-
!
|
|
148
|
+
O && x && /* @__PURE__ */ o("div", { children: "*" }),
|
|
149
|
+
!x && /* @__PURE__ */ o("div", { className: "text-d-destructive", children: "*" })
|
|
149
150
|
] }),
|
|
150
151
|
/* @__PURE__ */ u(
|
|
151
152
|
"div",
|
|
152
153
|
{
|
|
153
|
-
className:
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
className: l(
|
|
155
|
+
ue({ size: f }),
|
|
156
|
+
c ? "cursor-not-allowed opacity-50" : "cursor-text"
|
|
156
157
|
),
|
|
157
|
-
"aria-invalid":
|
|
158
|
-
onClick:
|
|
158
|
+
"aria-invalid": P,
|
|
159
|
+
onClick: ae,
|
|
159
160
|
children: [
|
|
160
161
|
(M || C) && /* @__PURE__ */ u("div", { className: "text-d-muted-foreground flex shrink-0 items-center gap-2", children: [
|
|
161
162
|
M && /* @__PURE__ */ o(k, { name: M, size: f === "lg" ? "sm" : "xs" }),
|
|
@@ -165,16 +166,16 @@ const le = G(
|
|
|
165
166
|
"input",
|
|
166
167
|
{
|
|
167
168
|
id: b,
|
|
168
|
-
type:
|
|
169
|
+
type: te,
|
|
169
170
|
"data-slot": "input",
|
|
170
|
-
className:
|
|
171
|
+
className: l(de({ size: f })),
|
|
171
172
|
ref: h,
|
|
172
|
-
disabled:
|
|
173
|
-
onChange:
|
|
174
|
-
onBlur:
|
|
175
|
-
onInvalid:
|
|
176
|
-
"aria-invalid":
|
|
177
|
-
"aria-describedby":
|
|
173
|
+
disabled: c,
|
|
174
|
+
onChange: re,
|
|
175
|
+
onBlur: oe,
|
|
176
|
+
onInvalid: ie,
|
|
177
|
+
"aria-invalid": P,
|
|
178
|
+
"aria-describedby": se,
|
|
178
179
|
required: O,
|
|
179
180
|
step: d === "number" ? "any" : void 0,
|
|
180
181
|
...m
|
|
@@ -187,15 +188,15 @@ const le = G(
|
|
|
187
188
|
onClick: (e) => {
|
|
188
189
|
e.stopPropagation(), e.preventDefault(), Y((s) => !s);
|
|
189
190
|
},
|
|
190
|
-
className:
|
|
191
|
+
className: l(
|
|
191
192
|
"text-d-muted-foreground flex shrink-0 cursor-pointer items-center",
|
|
192
|
-
|
|
193
|
+
c && "cursor-not-allowed"
|
|
193
194
|
),
|
|
194
|
-
"aria-label": p ?
|
|
195
|
+
"aria-label": p ? w.hide : w.show,
|
|
195
196
|
"aria-pressed": p,
|
|
196
197
|
"aria-controls": b,
|
|
197
|
-
title: p ?
|
|
198
|
-
disabled:
|
|
198
|
+
title: p ? w.hide : w.show,
|
|
199
|
+
disabled: c,
|
|
199
200
|
children: [
|
|
200
201
|
/* @__PURE__ */ o(
|
|
201
202
|
k,
|
|
@@ -204,17 +205,17 @@ const le = G(
|
|
|
204
205
|
size: f === "lg" ? "sm" : "xs"
|
|
205
206
|
}
|
|
206
207
|
),
|
|
207
|
-
/* @__PURE__ */ o("span", { className: "sr-only", children: p ?
|
|
208
|
+
/* @__PURE__ */ o("span", { className: "sr-only", children: p ? w.hide : w.show })
|
|
208
209
|
]
|
|
209
210
|
}
|
|
210
|
-
) : (
|
|
211
|
+
) : (H || V || L) && /* @__PURE__ */ u("div", { className: "text-d-muted-foreground flex shrink-0 items-center gap-2", children: [
|
|
211
212
|
L,
|
|
212
|
-
|
|
213
|
+
H && /* @__PURE__ */ u(
|
|
213
214
|
"button",
|
|
214
215
|
{
|
|
215
216
|
type: "button",
|
|
216
217
|
onClick: (e) => {
|
|
217
|
-
e.stopPropagation(), e.preventDefault(),
|
|
218
|
+
e.stopPropagation(), e.preventDefault(), ne();
|
|
218
219
|
},
|
|
219
220
|
onMouseDown: (e) => e.preventDefault(),
|
|
220
221
|
className: "text-d-muted-foreground flex shrink-0 cursor-pointer items-center",
|
|
@@ -232,15 +233,15 @@ const le = G(
|
|
|
232
233
|
}
|
|
233
234
|
),
|
|
234
235
|
A && U.length > 0 && /* @__PURE__ */ o(
|
|
235
|
-
|
|
236
|
+
ce,
|
|
236
237
|
{
|
|
237
238
|
variant: "caption",
|
|
238
239
|
id: j,
|
|
239
|
-
role:
|
|
240
|
+
role: x ? "status" : "alert",
|
|
240
241
|
"aria-live": "polite",
|
|
241
|
-
className:
|
|
242
|
+
className: l(
|
|
242
243
|
"max-w-full min-w-0 text-wrap",
|
|
243
|
-
|
|
244
|
+
x ? "text-d-success" : "text-d-destructive"
|
|
244
245
|
),
|
|
245
246
|
children: U
|
|
246
247
|
}
|
|
@@ -249,6 +250,6 @@ const le = G(
|
|
|
249
250
|
}
|
|
250
251
|
);
|
|
251
252
|
export {
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
be as Input,
|
|
254
|
+
de as inputVariants
|
|
254
255
|
};
|