@vkzstudio/muza-ui 1.0.34 → 1.0.36
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/components/DropdownMenu/DropdownMenu.js +11 -11
- package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.js +13 -17
- package/dist/components/FileUpload/FileUpload.stories.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.stories.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +83 -62
- package/dist/components/TextEditor/TextEditor.d.ts +4 -0
- package/dist/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/components/TextEditor/TextEditor.js +128 -97
- package/dist/components/TextEditor/TextEditor.stories.d.ts +1 -0
- package/dist/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.js +1 -1
- package/dist/muza-ui.css +1 -1
- package/dist/node_modules/@tiptap/extension-character-count/dist/index.js +73 -0
- package/package.json +3 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
1
|
+
import { jsxs as p, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as D, useState as G, useEffect as u, useImperativeHandle as J, useRef as Q } from "react";
|
|
3
|
+
import { CharacterCount as X } from "../../node_modules/@tiptap/extension-character-count/dist/index.js";
|
|
4
|
+
import { Link as Y } from "../../node_modules/@tiptap/extension-link/dist/index.js";
|
|
5
|
+
import { Placeholder as Z } from "../../node_modules/@tiptap/extension-placeholder/dist/index.js";
|
|
6
|
+
import { useEditor as tt, EditorContent as et } from "../../node_modules/@tiptap/react/dist/index.js";
|
|
7
|
+
import { StarterKit as rt } from "../../node_modules/@tiptap/starter-kit/dist/index.js";
|
|
8
|
+
import { cva as ot } from "class-variance-authority";
|
|
9
|
+
import { EditorToolbar as nt } from "./EditorToolbar.js";
|
|
10
|
+
import { LinkBubbleMenu as it } from "./LinkBubbleMenu.js";
|
|
11
|
+
import { useLinkEditor as st } from "./useLinkEditor.js";
|
|
12
|
+
import { useMuzaTranslations as lt } from "../../translations/TranslationContext.js";
|
|
13
|
+
import { FormField as at } from "../FormField/FormField.js";
|
|
14
|
+
import { cn as x } from "../../utils/cn.js";
|
|
15
|
+
import { typographyVariants as ct } from "../Typography/Typography.js";
|
|
16
|
+
const mt = ot(
|
|
15
17
|
[
|
|
16
18
|
"overflow-hidden rounded-xl border bg-surface-base-secondary transition-colors",
|
|
17
19
|
"focus-within:border-comp-input-stroke-focused",
|
|
@@ -23,50 +25,52 @@ const et = J(
|
|
|
23
25
|
state: {
|
|
24
26
|
default: "border-comp-input-stroke-def hover:border-comp-input-stroke-hover",
|
|
25
27
|
disabled: "cursor-not-allowed border-comp-input-stroke-disabled opacity-60",
|
|
26
|
-
error: "border-comp-input-stroke-error"
|
|
28
|
+
error: "border-comp-input-stroke-error-def"
|
|
27
29
|
}
|
|
28
30
|
},
|
|
29
31
|
defaultVariants: {
|
|
30
32
|
state: "default"
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
),
|
|
35
|
+
), dt = D(
|
|
34
36
|
({
|
|
35
|
-
value:
|
|
36
|
-
defaultValue:
|
|
37
|
-
onChange:
|
|
38
|
-
onBlur:
|
|
39
|
-
onFocus:
|
|
40
|
-
placeholder:
|
|
41
|
-
label:
|
|
42
|
-
hint:
|
|
43
|
-
infoTooltip:
|
|
44
|
-
disabled:
|
|
45
|
-
readOnly:
|
|
46
|
-
required:
|
|
37
|
+
value: n,
|
|
38
|
+
defaultValue: v,
|
|
39
|
+
onChange: d,
|
|
40
|
+
onBlur: C,
|
|
41
|
+
onFocus: T,
|
|
42
|
+
placeholder: E = "",
|
|
43
|
+
label: L,
|
|
44
|
+
hint: M,
|
|
45
|
+
infoTooltip: w,
|
|
46
|
+
disabled: i = !1,
|
|
47
|
+
readOnly: f = !1,
|
|
48
|
+
required: z,
|
|
47
49
|
disableRequiredAsterisk: H,
|
|
48
|
-
error:
|
|
49
|
-
toolbar:
|
|
50
|
-
toolbarExtra:
|
|
51
|
-
extensions:
|
|
52
|
-
minHeight:
|
|
53
|
-
maxHeight:
|
|
54
|
-
resizable:
|
|
55
|
-
className:
|
|
56
|
-
contentClassName:
|
|
50
|
+
error: a,
|
|
51
|
+
toolbar: s = {},
|
|
52
|
+
toolbarExtra: h,
|
|
53
|
+
extensions: N = [],
|
|
54
|
+
minHeight: R = 200,
|
|
55
|
+
maxHeight: c,
|
|
56
|
+
resizable: S = !0,
|
|
57
|
+
className: U,
|
|
58
|
+
contentClassName: V,
|
|
57
59
|
unstyled: F = !1,
|
|
58
|
-
editorClassName:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
editorClassName: P,
|
|
61
|
+
maxLength: o,
|
|
62
|
+
showCharacterCount: j
|
|
63
|
+
}, A) => {
|
|
64
|
+
const k = lt(), [B, y] = G(0), m = {
|
|
65
|
+
history: s.history ?? !0,
|
|
66
|
+
headings: s.headings ?? !0,
|
|
67
|
+
formatting: s.formatting ?? !0,
|
|
68
|
+
lists: s.lists ?? !0,
|
|
69
|
+
link: s.link ?? !0,
|
|
70
|
+
clearFormatting: s.clearFormatting ?? !0
|
|
71
|
+
}, O = !!h || Object.values(m).some((e) => e !== !1), t = tt({
|
|
68
72
|
extensions: [
|
|
69
|
-
|
|
73
|
+
rt.configure({
|
|
70
74
|
heading: { levels: [1, 2, 3] },
|
|
71
75
|
bulletList: {
|
|
72
76
|
HTMLAttributes: { class: "list-disc ml-6" }
|
|
@@ -76,7 +80,7 @@ const et = J(
|
|
|
76
80
|
}
|
|
77
81
|
}),
|
|
78
82
|
...m.link ? [
|
|
79
|
-
|
|
83
|
+
Y.configure({
|
|
80
84
|
openOnClick: !1,
|
|
81
85
|
autolink: !0,
|
|
82
86
|
linkOnPaste: !0,
|
|
@@ -86,22 +90,23 @@ const et = J(
|
|
|
86
90
|
}
|
|
87
91
|
})
|
|
88
92
|
] : [],
|
|
89
|
-
|
|
90
|
-
placeholder: ({ editor: e }) => e.state.doc.textContent.length === 0 ?
|
|
93
|
+
Z.configure({
|
|
94
|
+
placeholder: ({ editor: e }) => e.state.doc.textContent.length === 0 ? E : ""
|
|
91
95
|
}),
|
|
92
|
-
...
|
|
96
|
+
...o != null ? [X.configure({ limit: o, mode: "textSize" })] : [],
|
|
97
|
+
...N
|
|
93
98
|
],
|
|
94
|
-
content:
|
|
95
|
-
editable: !
|
|
99
|
+
content: n ?? v ?? "",
|
|
100
|
+
editable: !i && !f,
|
|
96
101
|
onUpdate: ({ editor: e }) => {
|
|
97
|
-
const
|
|
98
|
-
|
|
102
|
+
const b = e.getText().trim(), g = e.getHTML();
|
|
103
|
+
o != null && y(e.storage.characterCount.characters()), d == null || d(b.length === 0 ? "" : g);
|
|
99
104
|
},
|
|
100
|
-
onBlur:
|
|
101
|
-
onFocus:
|
|
105
|
+
onBlur: C,
|
|
106
|
+
onFocus: T,
|
|
102
107
|
editorProps: {
|
|
103
108
|
attributes: {
|
|
104
|
-
class:
|
|
109
|
+
class: x(
|
|
105
110
|
"outline-none text-sm",
|
|
106
111
|
!F && [
|
|
107
112
|
// Headings
|
|
@@ -123,7 +128,7 @@ const et = J(
|
|
|
123
128
|
],
|
|
124
129
|
// Placeholder (only when the entire editor is empty — controlled via placeholder function)
|
|
125
130
|
"[&_.is-empty]:before:content-[attr(data-placeholder)] [&_.is-empty]:before:text-comp-input-text-placeholder [&_.is-empty]:before:float-left [&_.is-empty]:before:h-0 [&_.is-empty]:before:pointer-events-none",
|
|
126
|
-
|
|
131
|
+
P
|
|
127
132
|
),
|
|
128
133
|
// Inline styles needed because Tailwind CSS 4 JIT doesn't apply to dynamically created elements
|
|
129
134
|
style: "width: 100%; min-height: 100%; max-width: none;",
|
|
@@ -132,15 +137,17 @@ const et = J(
|
|
|
132
137
|
}
|
|
133
138
|
}
|
|
134
139
|
});
|
|
135
|
-
|
|
136
|
-
if (t &&
|
|
140
|
+
u(() => {
|
|
141
|
+
if (t && n !== void 0) {
|
|
137
142
|
const e = t.getHTML();
|
|
138
|
-
(
|
|
143
|
+
(n || "<p></p>") !== (e || "<p></p>") && t.commands.setContent(n, !1);
|
|
139
144
|
}
|
|
140
|
-
}, [t,
|
|
141
|
-
t && t.setEditable(!
|
|
142
|
-
}, [t,
|
|
143
|
-
|
|
145
|
+
}, [t, n]), u(() => {
|
|
146
|
+
t && t.setEditable(!i && !f);
|
|
147
|
+
}, [t, i, f]), u(() => {
|
|
148
|
+
t && o != null && y(t.storage.characterCount.characters());
|
|
149
|
+
}, [t, o, n]), J(
|
|
150
|
+
A,
|
|
144
151
|
() => ({
|
|
145
152
|
editor: t,
|
|
146
153
|
focus: () => t == null ? void 0 : t.commands.focus(),
|
|
@@ -152,51 +159,75 @@ const et = J(
|
|
|
152
159
|
}),
|
|
153
160
|
[t]
|
|
154
161
|
);
|
|
155
|
-
const r =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
162
|
+
const r = st(t), _ = Q(null), $ = i ? "disabled" : a ? "error" : "default", I = typeof a == "string" ? a : void 0, K = `${Math.max(R, 200)}px`, W = j && o != null ? /* @__PURE__ */ p(
|
|
163
|
+
"span",
|
|
164
|
+
{
|
|
165
|
+
className: x(
|
|
166
|
+
ct({
|
|
167
|
+
variant: "body",
|
|
168
|
+
weight: "regular",
|
|
169
|
+
size: "sm"
|
|
170
|
+
}),
|
|
171
|
+
"text-comp-input-text-secondary"
|
|
172
|
+
),
|
|
173
|
+
children: [
|
|
174
|
+
B,
|
|
175
|
+
"/",
|
|
176
|
+
o
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
) : void 0, q = {
|
|
180
|
+
minHeight: K,
|
|
181
|
+
maxHeight: c ? typeof c == "number" ? `${c}px` : c : void 0,
|
|
182
|
+
resize: S && !i ? "vertical" : "none"
|
|
159
183
|
};
|
|
160
|
-
return /* @__PURE__ */
|
|
161
|
-
|
|
184
|
+
return /* @__PURE__ */ l("div", { ref: _, children: /* @__PURE__ */ l(
|
|
185
|
+
at,
|
|
162
186
|
{
|
|
163
|
-
label:
|
|
164
|
-
hint:
|
|
165
|
-
error: !!
|
|
166
|
-
required:
|
|
187
|
+
label: L,
|
|
188
|
+
hint: I || M,
|
|
189
|
+
error: !!a,
|
|
190
|
+
required: z,
|
|
167
191
|
disableRequiredAsterisk: H,
|
|
168
|
-
className:
|
|
169
|
-
infoTooltip:
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
192
|
+
className: U,
|
|
193
|
+
infoTooltip: w,
|
|
194
|
+
labelRight: W,
|
|
195
|
+
children: /* @__PURE__ */ p("div", { className: mt({ state: $ }), children: [
|
|
196
|
+
O && /* @__PURE__ */ l(
|
|
197
|
+
nt,
|
|
173
198
|
{
|
|
174
199
|
editor: t,
|
|
175
200
|
toolbarConfig: m,
|
|
176
|
-
disabled:
|
|
177
|
-
translations:
|
|
201
|
+
disabled: i,
|
|
202
|
+
translations: k.textEditor,
|
|
178
203
|
onLinkClick: r.handleLinkToolbarClick,
|
|
179
|
-
toolbarExtra:
|
|
204
|
+
toolbarExtra: h
|
|
180
205
|
}
|
|
181
206
|
),
|
|
182
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ p(
|
|
183
208
|
"div",
|
|
184
209
|
{
|
|
185
|
-
className:
|
|
186
|
-
"relative overflow-auto px-2xl py-xl",
|
|
210
|
+
className: x(
|
|
211
|
+
"relative flex flex-col overflow-auto px-2xl py-xl",
|
|
187
212
|
"mr-[calc(var(--spacing-xl)/2)]",
|
|
188
213
|
"pr-[calc(var(--spacing-2xl)-var(--spacing-xl)/2)]",
|
|
189
214
|
// Compensate for scrollbar offset
|
|
190
|
-
|
|
215
|
+
V
|
|
191
216
|
),
|
|
192
|
-
style:
|
|
217
|
+
style: q,
|
|
193
218
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
|
|
196
|
-
|
|
219
|
+
/* @__PURE__ */ l(
|
|
220
|
+
et,
|
|
221
|
+
{
|
|
222
|
+
editor: t,
|
|
223
|
+
className: "flex w-full flex-1 [&_div]:grow-1"
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
t && m.link && /* @__PURE__ */ l(
|
|
227
|
+
it,
|
|
197
228
|
{
|
|
198
229
|
editor: t,
|
|
199
|
-
containerRef:
|
|
230
|
+
containerRef: _,
|
|
200
231
|
linkUrl: r.linkUrl,
|
|
201
232
|
isEditingLink: r.isEditingLink,
|
|
202
233
|
onUrlChange: r.setLinkUrl,
|
|
@@ -204,7 +235,7 @@ const et = J(
|
|
|
204
235
|
onSave: r.handleSaveLink,
|
|
205
236
|
onRemove: r.handleRemoveLink,
|
|
206
237
|
onCancel: r.handleCancelEdit,
|
|
207
|
-
translations:
|
|
238
|
+
translations: k.textEditor
|
|
208
239
|
}
|
|
209
240
|
)
|
|
210
241
|
]
|
|
@@ -215,7 +246,7 @@ const et = J(
|
|
|
215
246
|
) });
|
|
216
247
|
}
|
|
217
248
|
);
|
|
218
|
-
|
|
249
|
+
dt.displayName = "TextEditor";
|
|
219
250
|
export {
|
|
220
|
-
|
|
251
|
+
dt as TextEditor
|
|
221
252
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof TextEditor>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof TextEditor>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
+
export declare const WithCharacterCounter: Story;
|
|
7
8
|
export declare const Controlled: Story;
|
|
8
9
|
export declare const WithFormIntegration: Story;
|
|
9
10
|
export declare const AllStates: Story;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.stories.d.ts","sourceRoot":"","sources":["../../../src/components/TextEditor/TextEditor.stories.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAO3D,OAAO,EACL,UAAU,EAIX,MAAM,SAAS,CAAA;AAEhB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAgIjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAGxC,eAAO,MAAM,OAAO,EAAE,KAerB,CAAA;AAGD,eAAO,MAAM,UAAU,EAAE,KA4BxB,CAAA;AAGD,eAAO,MAAM,mBAAmB,EAAE,KAmCjC,CAAA;AAGD,eAAO,MAAM,SAAS,EAAE,KA6DvB,CAAA;AAGD,eAAO,MAAM,kBAAkB,EAAE,KAsBhC,CAAA;AAGD,eAAO,MAAM,cAAc,EAAE,KAsB5B,CAAA;AAGD,eAAO,MAAM,gBAAgB,EAAE,KAsC9B,CAAA;AAGD,eAAO,MAAM,YAAY,EAAE,KAmC1B,CAAA;AAGD,eAAO,MAAM,mBAAmB,EAAE,KAsCjC,CAAA;AAqKD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,EAAE,KAwD1B,CAAA;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,EAAE,KA0DjC,CAAA;AAGD,eAAO,MAAM,QAAQ,EAAE,KA6CtB,CAAA;AAGD,eAAO,MAAM,mBAAmB,EAAE,KA0CjC,CAAA"}
|
|
1
|
+
{"version":3,"file":"TextEditor.stories.d.ts","sourceRoot":"","sources":["../../../src/components/TextEditor/TextEditor.stories.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAO3D,OAAO,EACL,UAAU,EAIX,MAAM,SAAS,CAAA;AAEhB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAgIjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAGxC,eAAO,MAAM,OAAO,EAAE,KAerB,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,KAgBlC,CAAA;AAGD,eAAO,MAAM,UAAU,EAAE,KA4BxB,CAAA;AAGD,eAAO,MAAM,mBAAmB,EAAE,KAmCjC,CAAA;AAGD,eAAO,MAAM,SAAS,EAAE,KA6DvB,CAAA;AAGD,eAAO,MAAM,kBAAkB,EAAE,KAsBhC,CAAA;AAGD,eAAO,MAAM,cAAc,EAAE,KAsB5B,CAAA;AAGD,eAAO,MAAM,gBAAgB,EAAE,KAsC9B,CAAA;AAGD,eAAO,MAAM,YAAY,EAAE,KAmC1B,CAAA;AAGD,eAAO,MAAM,mBAAmB,EAAE,KAsCjC,CAAA;AAqKD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,EAAE,KAwD1B,CAAA;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,EAAE,KA0DjC,CAAA;AAGD,eAAO,MAAM,QAAQ,EAAE,KA6CtB,CAAA;AAGD,eAAO,MAAM,mBAAmB,EAAE,KA0CjC,CAAA"}
|
|
@@ -49,7 +49,7 @@ const E = x(
|
|
|
49
49
|
state: {
|
|
50
50
|
default: "border-comp-input-stroke-def hover:border-comp-input-stroke-hover",
|
|
51
51
|
disabled: "cursor-not-allowed border-comp-input-stroke-disabled bg-comp-input-fill-disabled",
|
|
52
|
-
error: "border-comp-input-stroke-error"
|
|
52
|
+
error: "border-comp-input-stroke-error-def"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
defaultVariants: {
|