@vkzstudio/muza-ui 1.0.35 → 1.0.37
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/DataTable/DataTable.d.ts +6 -1
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +92 -79
- package/dist/components/DataTable/DataTable.stories.d.ts +1 -0
- package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.js +1 -1
- package/dist/components/Input/Input.d.ts +9 -0
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.js +23 -22
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +83 -62
- package/dist/components/MuzaUIProvider/theme/colorShades.js +11 -10
- package/dist/components/Reorderable/Reorderable.d.ts +5 -0
- package/dist/components/Reorderable/Reorderable.d.ts.map +1 -1
- package/dist/components/Reorderable/Reorderable.js +166 -164
- package/dist/components/ReorderableTable/ReorderableTable.d.ts +6 -0
- package/dist/components/ReorderableTable/ReorderableTable.d.ts.map +1 -1
- package/dist/components/ReorderableTable/ReorderableTable.js +91 -80
- package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts +1 -0
- package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts.map +1 -1
- 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,61 +1,62 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { motion as
|
|
4
|
-
import { ReorderableGroup as
|
|
5
|
-
import { Reorder as
|
|
1
|
+
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as S } from "react";
|
|
3
|
+
import { motion as l } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
4
|
+
import { ReorderableGroup as k, ReorderableItem as w, ReorderableHandle as z } from "../Reorderable/Reorderable.js";
|
|
5
|
+
import { Reorder as G } from "../Icons/CustomIcons.js";
|
|
6
6
|
import { cn as d } from "../../utils/cn.js";
|
|
7
|
-
import { typographyVariants as
|
|
8
|
-
const
|
|
9
|
-
data:
|
|
10
|
-
onReorder:
|
|
11
|
-
onSync:
|
|
12
|
-
syncDelay:
|
|
13
|
-
onSyncPendingChange:
|
|
14
|
-
onDragStart:
|
|
15
|
-
onDragEnd:
|
|
16
|
-
columns:
|
|
17
|
-
showHeader:
|
|
18
|
-
disabled:
|
|
19
|
-
isRowDisabled:
|
|
20
|
-
className:
|
|
21
|
-
isMovable:
|
|
22
|
-
animateItems:
|
|
23
|
-
layout:
|
|
7
|
+
import { typographyVariants as W, Typography as K } from "../Typography/Typography.js";
|
|
8
|
+
const f = 72, N = 20, R = 24, U = 4, F = ({
|
|
9
|
+
data: g,
|
|
10
|
+
onReorder: x,
|
|
11
|
+
onSync: L,
|
|
12
|
+
syncDelay: v,
|
|
13
|
+
onSyncPendingChange: _,
|
|
14
|
+
onDragStart: I,
|
|
15
|
+
onDragEnd: T,
|
|
16
|
+
columns: c,
|
|
17
|
+
showHeader: A = !1,
|
|
18
|
+
disabled: u = !1,
|
|
19
|
+
isRowDisabled: m,
|
|
20
|
+
className: H,
|
|
21
|
+
isMovable: i = !0,
|
|
22
|
+
animateItems: O = !1,
|
|
23
|
+
layout: E,
|
|
24
|
+
onRowClick: n,
|
|
24
25
|
...C
|
|
25
|
-
},
|
|
26
|
+
}, j) => /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ h(
|
|
26
27
|
"table",
|
|
27
28
|
{
|
|
28
|
-
ref:
|
|
29
|
+
ref: j,
|
|
29
30
|
className: d(
|
|
30
31
|
"-my-sm w-full border-separate border-spacing-y-sm",
|
|
31
|
-
|
|
32
|
+
H
|
|
32
33
|
),
|
|
33
34
|
...C,
|
|
34
35
|
children: [
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
A && /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ h("tr", { children: [
|
|
37
|
+
c.map((o, a) => /* @__PURE__ */ e(
|
|
37
38
|
"th",
|
|
38
39
|
{
|
|
39
40
|
className: d(
|
|
40
|
-
|
|
41
|
+
W({
|
|
41
42
|
size: "sm",
|
|
42
43
|
uppercase: !0,
|
|
43
44
|
variant: "body",
|
|
44
45
|
weight: "medium"
|
|
45
46
|
}),
|
|
46
47
|
"px-comp-table-p text-left text-text-dark-secondary",
|
|
47
|
-
|
|
48
|
+
o.className
|
|
48
49
|
),
|
|
49
|
-
children:
|
|
50
|
+
children: o.title
|
|
50
51
|
},
|
|
51
|
-
|
|
52
|
+
a
|
|
52
53
|
)),
|
|
53
54
|
/* @__PURE__ */ e(
|
|
54
|
-
|
|
55
|
+
l.th,
|
|
55
56
|
{
|
|
56
57
|
initial: !1,
|
|
57
58
|
animate: {
|
|
58
|
-
width:
|
|
59
|
+
width: i ? f : N
|
|
59
60
|
},
|
|
60
61
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
61
62
|
className: "overflow-hidden"
|
|
@@ -63,57 +64,65 @@ const p = 72, u = 20, G = 24, W = 4, K = ({
|
|
|
63
64
|
)
|
|
64
65
|
] }) }),
|
|
65
66
|
/* @__PURE__ */ e(
|
|
66
|
-
|
|
67
|
+
k,
|
|
67
68
|
{
|
|
68
|
-
values:
|
|
69
|
-
onReorder:
|
|
70
|
-
onSync:
|
|
71
|
-
syncDelay:
|
|
72
|
-
onSyncPendingChange:
|
|
73
|
-
onDragStart:
|
|
74
|
-
onDragEnd:
|
|
75
|
-
disabled:
|
|
76
|
-
animatePresence:
|
|
69
|
+
values: g,
|
|
70
|
+
onReorder: x,
|
|
71
|
+
onSync: L,
|
|
72
|
+
syncDelay: v,
|
|
73
|
+
onSyncPendingChange: _,
|
|
74
|
+
onDragStart: I,
|
|
75
|
+
onDragEnd: T,
|
|
76
|
+
disabled: u,
|
|
77
|
+
animatePresence: O,
|
|
77
78
|
as: "tbody",
|
|
78
79
|
className: "contents",
|
|
79
|
-
children: (
|
|
80
|
-
const
|
|
81
|
-
return /* @__PURE__ */
|
|
82
|
-
|
|
80
|
+
children: (o) => o.map((a, p) => {
|
|
81
|
+
const D = (m == null ? void 0 : m(a, p)) ?? !1, t = u || D, b = !!n && !t;
|
|
82
|
+
return /* @__PURE__ */ h(
|
|
83
|
+
w,
|
|
83
84
|
{
|
|
84
|
-
value:
|
|
85
|
+
value: a,
|
|
85
86
|
as: "tr",
|
|
86
|
-
layout:
|
|
87
|
+
layout: E,
|
|
87
88
|
disabled: t,
|
|
88
89
|
dragListenerDisabled: !0,
|
|
89
90
|
whileDrag: t ? void 0 : { boxShadow: "0 8px 32px 0 rgba(59, 18, 107, 0.2)" },
|
|
90
|
-
|
|
91
|
+
onClick: b ? (r) => {
|
|
92
|
+
if (!b) return;
|
|
93
|
+
const s = r.target;
|
|
94
|
+
s != null && s.closest("[data-reorder-handle]") || n == null || n(a, p);
|
|
95
|
+
} : void 0,
|
|
96
|
+
className: d(
|
|
97
|
+
"group rounded-2xl",
|
|
98
|
+
b && "cursor-pointer"
|
|
99
|
+
),
|
|
91
100
|
children: [
|
|
92
|
-
|
|
93
|
-
const
|
|
101
|
+
c.map((r, s) => {
|
|
102
|
+
const P = s === 0, y = s === c.length - 1;
|
|
94
103
|
return /* @__PURE__ */ e(
|
|
95
|
-
|
|
104
|
+
l.td,
|
|
96
105
|
{
|
|
97
106
|
initial: !1,
|
|
98
|
-
animate:
|
|
99
|
-
paddingRight:
|
|
107
|
+
animate: y ? {
|
|
108
|
+
paddingRight: i ? R : U
|
|
100
109
|
} : void 0,
|
|
101
110
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
102
111
|
className: d(
|
|
103
112
|
"h-comp-table-h-def border-y border-stroke-base-secondary bg-surface-base-secondary align-middle",
|
|
104
|
-
|
|
113
|
+
y ? "pl-comp-table-p" : "px-comp-table-p",
|
|
105
114
|
{
|
|
106
|
-
"rounded-l-xl border-l":
|
|
115
|
+
"rounded-l-xl border-l": P,
|
|
107
116
|
"group-focus-within:border-icon-brand-focus group-hover:border-icon-brand-hover": !t
|
|
108
117
|
},
|
|
109
|
-
|
|
118
|
+
r.className
|
|
110
119
|
),
|
|
111
|
-
children:
|
|
112
|
-
r
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
children: r.render ? r.render(
|
|
121
|
+
a[r.dataKey],
|
|
122
|
+
a,
|
|
123
|
+
p
|
|
115
124
|
) : /* @__PURE__ */ e(
|
|
116
|
-
|
|
125
|
+
K,
|
|
117
126
|
{
|
|
118
127
|
variant: "body",
|
|
119
128
|
size: "base",
|
|
@@ -122,50 +131,52 @@ const p = 72, u = 20, G = 24, W = 4, K = ({
|
|
|
122
131
|
className: d(
|
|
123
132
|
t && "text-text-dark-disabled",
|
|
124
133
|
{
|
|
125
|
-
"line-clamp-1":
|
|
126
|
-
"line-clamp-2":
|
|
134
|
+
"line-clamp-1": r.lineClamp === !0 || r.lineClamp === 1,
|
|
135
|
+
"line-clamp-2": r.lineClamp === 2
|
|
127
136
|
}
|
|
128
137
|
),
|
|
129
|
-
children: r
|
|
138
|
+
children: a[r.dataKey]
|
|
130
139
|
}
|
|
131
140
|
)
|
|
132
141
|
},
|
|
133
|
-
|
|
142
|
+
s
|
|
134
143
|
);
|
|
135
144
|
}),
|
|
136
145
|
/* @__PURE__ */ e(
|
|
137
|
-
|
|
146
|
+
l.td,
|
|
138
147
|
{
|
|
148
|
+
"data-reorder-handle": !0,
|
|
139
149
|
initial: !1,
|
|
140
150
|
animate: {
|
|
141
|
-
width:
|
|
151
|
+
width: i ? f : N
|
|
142
152
|
},
|
|
143
153
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
144
154
|
className: d(
|
|
145
155
|
"h-comp-table-h-def min-w-[20px] rounded-r-xl border-y border-r border-stroke-base-secondary bg-surface-base-secondary align-middle",
|
|
146
156
|
{
|
|
147
|
-
"group-focus-within:border-icon-brand-focus group-hover:border-icon-brand-hover": !t
|
|
157
|
+
"group-focus-within:border-icon-brand-focus group-hover:border-icon-brand-hover": !t,
|
|
158
|
+
"cursor-default": !!n
|
|
148
159
|
}
|
|
149
160
|
),
|
|
150
161
|
children: /* @__PURE__ */ e(
|
|
151
|
-
|
|
162
|
+
l.div,
|
|
152
163
|
{
|
|
153
164
|
initial: !1,
|
|
154
165
|
animate: {
|
|
155
|
-
opacity:
|
|
156
|
-
width:
|
|
166
|
+
opacity: i ? 1 : 0,
|
|
167
|
+
width: i ? f : 0
|
|
157
168
|
},
|
|
158
169
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
159
170
|
className: "flex h-full items-center justify-center overflow-hidden border-l border-stroke-base-secondary",
|
|
160
171
|
children: /* @__PURE__ */ e(
|
|
161
|
-
|
|
172
|
+
z,
|
|
162
173
|
{
|
|
163
|
-
disabled: !
|
|
174
|
+
disabled: !i || t,
|
|
164
175
|
className: d(
|
|
165
176
|
"flex h-comp-button-h-sm w-comp-button-w-sm items-center justify-center focus-visible-default",
|
|
166
177
|
t ? "text-text-dark-disabled" : "text-text-brand-def"
|
|
167
178
|
),
|
|
168
|
-
children: /* @__PURE__ */ e(
|
|
179
|
+
children: /* @__PURE__ */ e(G, { className: "size-icon-default" })
|
|
169
180
|
}
|
|
170
181
|
)
|
|
171
182
|
}
|
|
@@ -174,15 +185,15 @@ const p = 72, u = 20, G = 24, W = 4, K = ({
|
|
|
174
185
|
)
|
|
175
186
|
]
|
|
176
187
|
},
|
|
177
|
-
|
|
188
|
+
a.id
|
|
178
189
|
);
|
|
179
190
|
})
|
|
180
191
|
}
|
|
181
192
|
)
|
|
182
193
|
]
|
|
183
194
|
}
|
|
184
|
-
) }),
|
|
185
|
-
|
|
195
|
+
) }), V = S(F);
|
|
196
|
+
V.displayName = "ReorderableTable";
|
|
186
197
|
export {
|
|
187
|
-
|
|
198
|
+
V as ReorderableTable
|
|
188
199
|
};
|
|
@@ -12,6 +12,7 @@ declare const meta: Meta<typeof ReorderableTable>;
|
|
|
12
12
|
export default meta;
|
|
13
13
|
type Story = StoryObj<typeof ReorderableTable<IBenefit>>;
|
|
14
14
|
export declare const Default: Story;
|
|
15
|
+
export declare const WithRowClick: Story;
|
|
15
16
|
export declare const WithoutHeader: Story;
|
|
16
17
|
export declare const WithDisabledRow: Story;
|
|
17
18
|
export declare const AnimatedRows: Story;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReorderableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"ReorderableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAc3D,OAAO,EACL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAA;AAE3B,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;CAC9B;AAyCD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAoEvC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAA;AAExD,eAAO,MAAM,OAAO,EAAE,KAkHrB,CAAA;AAMD,eAAO,MAAM,YAAY,EAAE,KAuL1B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAsG3B,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA2G7B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KA0H1B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAkG3B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA4FtB,CAAA"}
|
|
@@ -135,6 +135,10 @@ export interface TextEditorProps {
|
|
|
135
135
|
unstyled?: boolean;
|
|
136
136
|
/** Additional class name for the TipTap editor element */
|
|
137
137
|
editorClassName?: string;
|
|
138
|
+
/** Maximum character count. Blocks input past this limit and enables the counter when `showCharacterCount` is true. */
|
|
139
|
+
maxLength?: number;
|
|
140
|
+
/** Displays a character counter (currentCount/maxLength) in the label row. Requires `maxLength` to be set. @default false */
|
|
141
|
+
showCharacterCount?: boolean;
|
|
138
142
|
}
|
|
139
143
|
declare const TextEditor: import('react').ForwardRefExoticComponent<TextEditorProps & import('react').RefAttributes<TextEditorRef>>;
|
|
140
144
|
export { TextEditor };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../src/components/TextEditor/TextEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../src/components/TextEditor/TextEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAIhD,OAAO,EAAE,KAAK,MAAM,EAA4B,MAAM,eAAe,CAAA;AAWrE,gCAAgC;AAChC,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,CAAC,EAAE,MAAM,CAAA;IACxB,uHAAuH;IACvH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6HAA6H;IAC7H,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAwBD,QAAA,MAAM,UAAU,2GA6Qf,CAAA;AAID,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -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;
|