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.
@@ -1,207 +1,231 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as t, Fragment as p } from "react/jsx-runtime";
3
- import { ListNode as H, ListItemNode as D } from "../../node_modules/@lexical/list/dist/LexicalList.prod.js";
4
- import { TRANSFORMERS as U, $convertToMarkdownString as _, $convertFromMarkdownString as z } from "../../node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js";
5
- import { CheckListPlugin as Q } from "../../node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js";
6
- import { ClearEditorPlugin as K } from "../../node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js";
7
- import { LexicalComposer as W } from "../../node_modules/@lexical/react/dist/LexicalComposer.prod.js";
8
- import { useLexicalComposerContext as q } from "../../node_modules/@lexical/react/dist/LexicalComposerContext.prod.js";
9
- import { LexicalErrorBoundary as G } from "../../node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js";
10
- import { HistoryPlugin as J } from "../../node_modules/@lexical/react/dist/LexicalHistoryPlugin.prod.js";
11
- import { ListPlugin as X } from "../../node_modules/@lexical/react/dist/LexicalListPlugin.prod.js";
12
- import { OnChangePlugin as Y } from "../../node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js";
13
- import { RichTextPlugin as Z } from "../../node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js";
14
- import { HeadingNode as V, QuoteNode as rr } from "../../node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js";
15
- import { ParagraphNode as g, TextNode as h, $nodesOfType as or, $getRoot as b } from "../../node_modules/lexical/dist/Lexical.prod.js";
16
- import { useState as er, useMemo as tr, useEffect as ir } from "react";
17
- import { ContentEditable as nr } from "../editor/editor-ui/content-editable.js";
18
- import { MentionNode as w } from "../editor/nodes/mention-node.js";
19
- import { ActionsPlugin as lr } from "../editor/plugins/actions/actions-plugin.js";
20
- import { ClearEditorActionPlugin as ar } from "../editor/plugins/actions/clear-editor-plugin.js";
21
- import { CounterCharacterPlugin as sr } from "../editor/plugins/actions/counter-character-plugin.js";
22
- import { MENTION_TRANSFORMER as mr, MentionPlugin as cr, collectMentions as dr } from "../editor/plugins/mention-plugin.js";
23
- import { FormatBulletedList as fr } from "../editor/plugins/toolbar/block-format/format-bulleted-list.js";
24
- import { FormatCheckList as pr } from "../editor/plugins/toolbar/block-format/format-check-list.js";
25
- import { FormatHeading as ur } from "../editor/plugins/toolbar/block-format/format-heading.js";
26
- import { FormatNumberedList as gr } from "../editor/plugins/toolbar/block-format/format-numbered-list.js";
27
- import { FormatParagraph as hr } from "../editor/plugins/toolbar/block-format/format-paragraph.js";
28
- import { FormatQuote as br } from "../editor/plugins/toolbar/block-format/format-quote.js";
29
- import { BlockFormatDropDown as xr } from "../editor/plugins/toolbar/block-format-toolbar-plugin.js";
30
- import { FontFormatToolbarPlugin as d } from "../editor/plugins/toolbar/font-format-toolbar-plugin.js";
31
- import { MentionInsertToolbarPlugin as Nr } from "../editor/plugins/toolbar/mention-insert-toolbar-plugin.js";
32
- import { ToolbarPlugin as u } from "../editor/plugins/toolbar/toolbar-plugin.js";
33
- import { editorTheme as vr } from "../editor/themes/editor-theme.js";
34
- import { TooltipProvider as Er } from "./tooltip.js";
35
- import { HistoryToolbarPlugin as Fr } from "../editor/plugins/toolbar/history-toolbar-plugin.js";
36
- import { cn as Cr } from "../../lib/utils.js";
37
- const Pr = "Start typing...", yr = {
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
- }, S = [
42
- ...U,
43
- yr
44
- ], Tr = (o) => o.replace(/<u>(.*?)<\/u>/g, "++$1++"), Rr = (o) => o.replace(/\+\+(.+?)\+\+/g, "<u>$1</u>");
45
- function wr({
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: a,
48
- transformers: n
63
+ onlyMarkdown: e,
64
+ transformers: t
49
65
  }) {
50
- const [s] = q();
51
- return ir(() => {
52
- o && s.update(() => {
53
- a ? z(
54
- Tr(o),
55
- n
56
- ) : b().append(
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 m = b();
60
- (m.getFirstChild() ?? m).selectStart();
75
+ const c = N();
76
+ (c.getFirstChild() ?? c).selectStart();
61
77
  });
62
- }, [s, o, a, n]), null;
78
+ }, [a, o, e, t]), null;
63
79
  }
64
- function co({
80
+ function Hr({
65
81
  defaultValue: o,
66
- onMarkdownEdit: a,
67
- onValueChange: n,
68
- plugins: s = [],
69
- toolbars: m = [],
70
- placeholder: L = Pr,
71
- onlyMarkdown: x = !0,
72
- className: M = "rounded-lg border border-d-border",
73
- wrpClassName: A = "",
74
- mentions: c,
75
- mentionTrigger: N = "@"
76
- }) {
77
- const [, k] = er(null), l = c !== void 0, v = tr(
78
- () => l ? [mr, ...S] : S,
79
- [l]
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: vr,
98
+ theme: Tr,
83
99
  nodes: [
84
- V,
100
+ er,
85
101
  g,
86
102
  h,
87
- rr,
88
- H,
89
- D,
90
- ...l ? [w] : []
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: (e) => {
93
- console.error(e);
111
+ onError: (i) => {
112
+ console.error(i);
94
113
  },
95
- ...o && !x ? {
114
+ ...o && !b ? {
96
115
  editorState: () => {
97
- b().append(
116
+ N().append(
98
117
  new g().append(new h(o))
99
118
  );
100
119
  }
101
120
  } : {}
102
- }, E = (e) => s.includes(e), f = (e) => m.includes(e), F = E("clear"), C = E("counter"), P = f("block-format"), $ = f("font-format"), y = f("history");
103
- return /* @__PURE__ */ r("div", { className: Cr("bg-d-background flex h-96 flex-col", A), children: /* @__PURE__ */ r(W, { initialConfig: O, children: /* @__PURE__ */ t(Er, { children: [
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
- wr,
125
+ Or,
106
126
  {
107
127
  defaultValue: o,
108
- onlyMarkdown: x,
109
- transformers: v
128
+ onlyMarkdown: b,
129
+ transformers: x
110
130
  }
111
131
  ),
112
- l && /* @__PURE__ */ r(cr, { source: c, trigger: N }),
113
- /* @__PURE__ */ t("div", { className: "border-d-border flex items-center border-b", children: [
114
- y && /* @__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__ */ r(Fr, {}) }) }),
115
- P && /* @__PURE__ */ r(u, { children: () => /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ t(xr, { children: [
116
- /* @__PURE__ */ r(hr, {}),
117
- /* @__PURE__ */ r(ur, { levels: ["h1", "h2", "h3"] }),
118
- /* @__PURE__ */ r(gr, {}),
119
- /* @__PURE__ */ r(fr, {}),
120
- /* @__PURE__ */ r(pr, {}),
121
- /* @__PURE__ */ r(br, {})
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
- $ && /* @__PURE__ */ r(u, { children: () => /* @__PURE__ */ t("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: [
124
- /* @__PURE__ */ r(d, { format: "bold" }),
125
- /* @__PURE__ */ r(d, { format: "italic" }),
126
- /* @__PURE__ */ r(d, { format: "underline" }),
127
- /* @__PURE__ */ r(d, { format: "strikethrough" }),
128
- l && /* @__PURE__ */ r(
129
- Nr,
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: N ?? "@"
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__ */ t("div", { className: "relative flex min-h-0 w-full flex-1 flex-col", children: [
137
- y && /* @__PURE__ */ r(J, {}),
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
- Z,
161
+ or,
140
162
  {
141
- ErrorBoundary: G,
163
+ ErrorBoundary: X,
142
164
  contentEditable: /* @__PURE__ */ r(
143
165
  "div",
144
166
  {
145
- ref: k,
167
+ ref: I,
146
168
  className: "flex min-h-0 w-full flex-1 overflow-auto",
147
169
  children: /* @__PURE__ */ r(
148
- nr,
170
+ cr,
149
171
  {
150
- placeholder: L,
151
- className: `border-d-border w-full rounded-none border-b ${M}`
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
- P && /* @__PURE__ */ t(p, { children: [
159
- /* @__PURE__ */ r(X, {}),
160
- /* @__PURE__ */ r(Q, {})
180
+ y && /* @__PURE__ */ n(u, { children: [
181
+ /* @__PURE__ */ r(V, {}),
182
+ /* @__PURE__ */ r(q, {})
161
183
  ] }),
162
- (F || C) && /* @__PURE__ */ r(lr, { children: /* @__PURE__ */ t("div", { className: "clear-both flex items-center justify-between gap-2 p-1", children: [
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: C && /* @__PURE__ */ r(sr, { charset: "UTF-16" }) }),
165
- /* @__PURE__ */ r("div", { className: "flex flex-1 justify-end gap-2", children: F && /* @__PURE__ */ t(p, { children: [
166
- /* @__PURE__ */ r(ar, {}),
167
- /* @__PURE__ */ r(K, {})
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
- Y,
194
+ rr,
173
195
  {
174
196
  ignoreSelectionChange: !0,
175
- onChange: (e) => {
176
- if (!n && !a) return;
177
- const T = Rr(
178
- e.read(() => _(v))
197
+ onChange: (i) => {
198
+ if (!t && !e) return;
199
+ const C = $r(
200
+ i.read(() => W(x))
179
201
  );
180
- if (!n) {
181
- a?.(T);
202
+ if (!t) {
203
+ e?.(C);
182
204
  return;
183
205
  }
184
- let R = [];
185
- if (l) {
186
- const I = e.read(
187
- () => dr(or(w))
188
- ), j = Array.isArray(c) ? c : [], B = new Map(
189
- j.map((i) => [String(i.id), i])
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
- R = I.map(
192
- (i) => B.get(String(i.id)) ?? {
193
- id: i.id,
194
- label: i.label,
195
- value: i.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
- n(T, { mentions: R });
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
- co as AppEditor
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 G } from "../../node_modules/class-variance-authority/dist/index.js";
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 oe } from "./label.js";
7
- import { cn as c } from "../../lib/utils.js";
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 ie } from "./typo.js";
10
- const le = G(
11
- c(
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
- ), ce = G(
31
- c(
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
- ), x = {
53
+ ), w = {
54
54
  show: "Mostra password",
55
55
  hide: "Nascondi password"
56
- }, T = "Cancella", xe = a.forwardRef(
56
+ }, T = "Cancella", be = a.forwardRef(
57
57
  ({
58
- className: F,
58
+ className: G,
59
59
  type: d,
60
60
  label: E,
61
- labelClassName: X,
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: l,
69
+ disabled: c,
69
70
  required: O,
70
71
  onBlur: _,
71
- onChange: z,
72
- onInvalid: B,
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), [w, N] = a.useState(!0), [Z, R] = a.useState(!1), [U, S] = a.useState(""), q = a.useId(), b = $ ?? q, j = `${b}-validity`, h = a.useRef(null), v = d === "password", W = d === "search", [H, P] = a.useState(
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, y = J ?? (!w && Z ? !0 : void 0), ee = [K, A && j].filter(Boolean).join(" ").trim() || void 0;
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 te = a.useCallback(
85
+ const ae = a.useCallback(
85
86
  (e) => {
86
- if (l) return;
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
- [l, v, d]
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 se = a.useCallback(
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), P(e.currentTarget.value.length > 0), z?.(e);
119
+ N(s), S(r), W(e.currentTarget.value.length > 0), B?.(e);
119
120
  },
120
- [z, g]
121
+ [B, g]
121
122
  );
122
123
  a.useEffect(() => {
123
- m.value !== void 0 && P(String(m.value).length > 0);
124
+ m.value !== void 0 && W(String(m.value).length > 0);
124
125
  }, [m.value]);
125
- const ae = a.useCallback(() => {
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
- }, []), re = a.useCallback(
133
+ }, []), oe = a.useCallback(
133
134
  (e) => {
134
135
  R(!0), _?.(e);
135
136
  },
136
137
  [_]
137
- ), ne = a.useCallback(
138
+ ), ie = a.useCallback(
138
139
  (e) => {
139
140
  const { isValid: s, message: r } = g(e.currentTarget);
140
- N(s), S(r), B?.(e);
141
+ N(s), S(r), z?.(e);
141
142
  },
142
- [B, g]
143
+ [z, g]
143
144
  );
144
- return /* @__PURE__ */ u("div", { className: c("flex flex-col gap-1.5", F), children: [
145
- E && /* @__PURE__ */ u(oe, { htmlFor: b, className: c("gap-0.5", X), children: [
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 && w && /* @__PURE__ */ o("div", { children: "*" }),
148
- !w && /* @__PURE__ */ o("div", { className: "text-d-destructive", children: "*" })
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: c(
154
- le({ size: f }),
155
- l ? "cursor-not-allowed opacity-50" : "cursor-text"
154
+ className: l(
155
+ ue({ size: f }),
156
+ c ? "cursor-not-allowed opacity-50" : "cursor-text"
156
157
  ),
157
- "aria-invalid": y,
158
- onClick: te,
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: I,
169
+ type: te,
169
170
  "data-slot": "input",
170
- className: c(ce({ size: f })),
171
+ className: l(de({ size: f })),
171
172
  ref: h,
172
- disabled: l,
173
- onChange: se,
174
- onBlur: re,
175
- onInvalid: ne,
176
- "aria-invalid": y,
177
- "aria-describedby": ee,
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: c(
191
+ className: l(
191
192
  "text-d-muted-foreground flex shrink-0 cursor-pointer items-center",
192
- l && "cursor-not-allowed"
193
+ c && "cursor-not-allowed"
193
194
  ),
194
- "aria-label": p ? x.hide : x.show,
195
+ "aria-label": p ? w.hide : w.show,
195
196
  "aria-pressed": p,
196
197
  "aria-controls": b,
197
- title: p ? x.hide : x.show,
198
- disabled: l,
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 ? x.hide : x.show })
208
+ /* @__PURE__ */ o("span", { className: "sr-only", children: p ? w.hide : w.show })
208
209
  ]
209
210
  }
210
- ) : (W && H && !l ? !0 : V || L) && /* @__PURE__ */ u("div", { className: "text-d-muted-foreground flex shrink-0 items-center gap-2", children: [
211
+ ) : (H || V || L) && /* @__PURE__ */ u("div", { className: "text-d-muted-foreground flex shrink-0 items-center gap-2", children: [
211
212
  L,
212
- W && H && !l && /* @__PURE__ */ u(
213
+ H && /* @__PURE__ */ u(
213
214
  "button",
214
215
  {
215
216
  type: "button",
216
217
  onClick: (e) => {
217
- e.stopPropagation(), e.preventDefault(), ae();
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
- ie,
236
+ ce,
236
237
  {
237
238
  variant: "caption",
238
239
  id: j,
239
- role: w ? "status" : "alert",
240
+ role: x ? "status" : "alert",
240
241
  "aria-live": "polite",
241
- className: c(
242
+ className: l(
242
243
  "max-w-full min-w-0 text-wrap",
243
- w ? "text-d-success" : "text-d-destructive"
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
- xe as Input,
253
- ce as inputVariants
253
+ be as Input,
254
+ de as inputVariants
254
255
  };