@commercetools/nimbus 0.0.0-canary-20250903150359 → 0.0.0-canary-20250903194502
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/chunks/rich-text-input-C5lp1D-D.cjs.js +7 -0
- package/dist/chunks/rich-text-input-C5lp1D-D.cjs.js.map +1 -0
- package/dist/chunks/{rich-text-input-CgrxAPHc.es.js → rich-text-input-CYlc7Ozc.es.js} +186 -173
- package/dist/chunks/rich-text-input-CYlc7Ozc.es.js.map +1 -0
- package/dist/chunks/slate-helpers-CcSj-DBm.cjs.js +24 -0
- package/dist/chunks/slate-helpers-CcSj-DBm.cjs.js.map +1 -0
- package/dist/chunks/slate-helpers-DsTiLoO8.es.js +9042 -0
- package/dist/chunks/slate-helpers-DsTiLoO8.es.js.map +1 -0
- package/dist/chunks/use-formatting-state-B26nE9CO.es.js +113 -0
- package/dist/chunks/use-formatting-state-B26nE9CO.es.js.map +1 -0
- package/dist/chunks/use-formatting-state-D7zenGZW.cjs.js +2 -0
- package/dist/chunks/use-formatting-state-D7zenGZW.cjs.js.map +1 -0
- package/dist/components/components.cjs +1 -1
- package/dist/components/components.es.js +1 -1
- package/dist/components/hooks.cjs +1 -1
- package/dist/components/hooks.es.js +1 -1
- package/dist/components/rich-text-input.cjs +1 -1
- package/dist/components/rich-text-input.es.js +1 -1
- package/dist/components/utils.cjs +1 -1
- package/dist/components/utils.es.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.es.js +2 -2
- package/package.json +8 -8
- package/dist/chunks/rich-text-input-CItP9BzJ.cjs.js +0 -2
- package/dist/chunks/rich-text-input-CItP9BzJ.cjs.js.map +0 -1
- package/dist/chunks/rich-text-input-CgrxAPHc.es.js.map +0 -1
- package/dist/chunks/slate-helpers-BN_9Hky2.cjs.js +0 -24
- package/dist/chunks/slate-helpers-BN_9Hky2.cjs.js.map +0 -1
- package/dist/chunks/slate-helpers-DunxggA8.es.js +0 -6919
- package/dist/chunks/slate-helpers-DunxggA8.es.js.map +0 -1
- package/dist/chunks/use-formatting-state-DVcnyVBl.cjs.js +0 -2
- package/dist/chunks/use-formatting-state-DVcnyVBl.cjs.js.map +0 -1
- package/dist/chunks/use-formatting-state-DdKYccZs.es.js +0 -247
- package/dist/chunks/use-formatting-state-DdKYccZs.es.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { defineSlotRecipe as
|
|
4
|
-
import { e as
|
|
5
|
-
import {
|
|
6
|
-
import { a as Ce, u as
|
|
7
|
-
import { EDITOR_DEFAULTS as I, textStyles as
|
|
1
|
+
import { jsx as r, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as se, useMemo as de, useCallback as M, useImperativeHandle as ce, useState as G, useRef as ue, useEffect as he } from "react";
|
|
3
|
+
import { defineSlotRecipe as pe, createSlotRecipeContext as fe, useSlotRecipe as ge } from "@chakra-ui/react";
|
|
4
|
+
import { e as me } from "./extractStyleProps-vA4cNUoc.es.js";
|
|
5
|
+
import { j as _, k as W, O as N, P as j, w as ye, l as ve, r as xe, e as Se, g as be, L as we, m as Re, c as P, n as Te, o as Me, u as Z, b as V, f as q, t as De, v as Ie } from "./slate-helpers-DsTiLoO8.es.js";
|
|
6
|
+
import { a as Ce, u as $, c as Pe, b as Be } from "./use-formatting-state-B26nE9CO.es.js";
|
|
7
|
+
import { EDITOR_DEFAULTS as I, textStyles as Le } from "../components/constants.es.js";
|
|
8
8
|
import { B as b } from "./box-DuBoAZvq.es.js";
|
|
9
9
|
import { D as X } from "./divider--BAm3ca4.es.js";
|
|
10
10
|
import { G as J } from "./group-CqfSQXe7.es.js";
|
|
@@ -14,10 +14,10 @@ import { T as v } from "./text-DfQpupDi.es.js";
|
|
|
14
14
|
import { b as d } from "./tooltip-B1YdruCE.es.js";
|
|
15
15
|
import { V as T } from "./visually-hidden-BluyWhUI.es.js";
|
|
16
16
|
import { T as Q } from "./toggle-button-group-jRdpdYyd.es.js";
|
|
17
|
-
import { T as
|
|
18
|
-
import { MoreHoriz as
|
|
17
|
+
import { T as Oe } from "./toolbar-hpBfKrTl.es.js";
|
|
18
|
+
import { MoreHoriz as ze, FormatStrikethrough as He, Code as Ee, KeyboardArrowDown as Fe, FormatBold as Ve, FormatItalic as Ae, FormatUnderlined as We, FormatListBulleted as Ne, FormatListNumbered as ke, Undo as Ke, Redo as Ue } from "@commercetools/nimbus-icons";
|
|
19
19
|
import { M as g } from "./menu-8g9Hn1nm.es.js";
|
|
20
|
-
const
|
|
20
|
+
const ee = /* @__PURE__ */ pe({
|
|
21
21
|
slots: ["root", "toolbar", "editable"],
|
|
22
22
|
className: "nimbus-rich-text-input",
|
|
23
23
|
base: {
|
|
@@ -137,22 +137,35 @@ const $ = /* @__PURE__ */ ue({
|
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
139
|
variants: {}
|
|
140
|
-
}), { withProvider: Ge, withContext:
|
|
141
|
-
recipe:
|
|
142
|
-
}), _e = /* @__PURE__ */ Ge("div", "root"), je = /* @__PURE__ */
|
|
143
|
-
|
|
140
|
+
}), { withProvider: Ge, withContext: te } = /* @__PURE__ */ fe({
|
|
141
|
+
recipe: ee
|
|
142
|
+
}), _e = /* @__PURE__ */ Ge("div", "root"), je = /* @__PURE__ */ te("div", "toolbar"), qe = /* @__PURE__ */ te("div", "editable");
|
|
143
|
+
/*!
|
|
144
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
145
|
+
*
|
|
146
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
147
|
+
* Released under the MIT License.
|
|
148
|
+
*/
|
|
149
|
+
function Y(e) {
|
|
150
|
+
return Object.prototype.toString.call(e) === "[object Object]";
|
|
151
|
+
}
|
|
152
|
+
function Xe(e) {
|
|
153
|
+
var t, o;
|
|
154
|
+
return Y(e) === !1 ? !1 : (t = e.constructor, t === void 0 ? !0 : (o = t.prototype, !(Y(o) === !1 || o.hasOwnProperty("isPrototypeOf") === !1)));
|
|
155
|
+
}
|
|
156
|
+
var Je = {
|
|
144
157
|
/**
|
|
145
158
|
* Check if a value is a `History` object.
|
|
146
159
|
*/
|
|
147
160
|
isHistory(e) {
|
|
148
|
-
return
|
|
161
|
+
return Xe(e) && Array.isArray(e.redos) && Array.isArray(e.undos) && (e.redos.length === 0 || N.isOperationList(e.redos[0].operations)) && (e.undos.length === 0 || N.isOperationList(e.undos[0].operations));
|
|
149
162
|
}
|
|
150
163
|
}, A = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), m = {
|
|
151
164
|
/**
|
|
152
165
|
* Check if a value is a `HistoryEditor` object.
|
|
153
166
|
*/
|
|
154
167
|
isHistoryEditor(e) {
|
|
155
|
-
return
|
|
168
|
+
return Je.isHistory(e.history) && W.isEditor(e);
|
|
156
169
|
},
|
|
157
170
|
/**
|
|
158
171
|
* Get the merge flag's current value.
|
|
@@ -192,8 +205,8 @@ var Xe = {
|
|
|
192
205
|
* be merged into the previous history.
|
|
193
206
|
*/
|
|
194
207
|
withMerging(e, t) {
|
|
195
|
-
var
|
|
196
|
-
S.set(e, !0), t(), S.set(e,
|
|
208
|
+
var o = m.isMerging(e);
|
|
209
|
+
S.set(e, !0), t(), S.set(e, o);
|
|
197
210
|
},
|
|
198
211
|
/**
|
|
199
212
|
* Apply a series of changes inside a synchronous `fn`, ensuring that the first
|
|
@@ -201,33 +214,33 @@ var Xe = {
|
|
|
201
214
|
* merged as usual.
|
|
202
215
|
*/
|
|
203
216
|
withNewBatch(e, t) {
|
|
204
|
-
var
|
|
205
|
-
S.set(e, !0), C.set(e, !0), t(), S.set(e,
|
|
217
|
+
var o = m.isMerging(e);
|
|
218
|
+
S.set(e, !0), C.set(e, !0), t(), S.set(e, o), C.delete(e);
|
|
206
219
|
},
|
|
207
220
|
/**
|
|
208
221
|
* Apply a series of changes inside a synchronous `fn`, without merging any of
|
|
209
222
|
* the new operations into previous save point in the history.
|
|
210
223
|
*/
|
|
211
224
|
withoutMerging(e, t) {
|
|
212
|
-
var
|
|
213
|
-
S.set(e, !1), t(), S.set(e,
|
|
225
|
+
var o = m.isMerging(e);
|
|
226
|
+
S.set(e, !1), t(), S.set(e, o);
|
|
214
227
|
},
|
|
215
228
|
/**
|
|
216
229
|
* Apply a series of changes inside a synchronous `fn`, without saving any of
|
|
217
230
|
* their operations into the history.
|
|
218
231
|
*/
|
|
219
232
|
withoutSaving(e, t) {
|
|
220
|
-
var
|
|
233
|
+
var o = m.isSaving(e);
|
|
221
234
|
A.set(e, !1);
|
|
222
235
|
try {
|
|
223
236
|
t();
|
|
224
237
|
} finally {
|
|
225
|
-
A.set(e,
|
|
238
|
+
A.set(e, o);
|
|
226
239
|
}
|
|
227
240
|
}
|
|
228
|
-
},
|
|
241
|
+
}, Qe = (e) => {
|
|
229
242
|
var t = e, {
|
|
230
|
-
apply:
|
|
243
|
+
apply: o
|
|
231
244
|
} = t;
|
|
232
245
|
return t.history = {
|
|
233
246
|
undos: [],
|
|
@@ -258,8 +271,8 @@ var Xe = {
|
|
|
258
271
|
m.withoutSaving(t, () => {
|
|
259
272
|
W.withoutNormalizing(t, () => {
|
|
260
273
|
var c = s.operations.map(N.inverse).reverse();
|
|
261
|
-
for (var
|
|
262
|
-
t.apply(
|
|
274
|
+
for (var u of c)
|
|
275
|
+
t.apply(u);
|
|
263
276
|
s.selectionBefore && _.setSelection(t, s.selectionBefore);
|
|
264
277
|
});
|
|
265
278
|
}), t.writeHistory("redos", s), a.undos.pop();
|
|
@@ -270,79 +283,79 @@ var Xe = {
|
|
|
270
283
|
history: s
|
|
271
284
|
} = t, {
|
|
272
285
|
undos: c
|
|
273
|
-
} = s,
|
|
274
|
-
if (f == null && (f =
|
|
275
|
-
if (
|
|
276
|
-
|
|
286
|
+
} = s, u = c[c.length - 1], y = u && u.operations[u.operations.length - 1], f = m.isSaving(t), h = m.isMerging(t);
|
|
287
|
+
if (f == null && (f = Ze(a)), f) {
|
|
288
|
+
if (h == null && (u == null ? h = !1 : l.length !== 0 ? h = !0 : h = Ye(a, y)), m.isSplittingOnce(t) && (h = !1, m.setSplittingOnce(t, void 0)), u && h)
|
|
289
|
+
u.operations.push(a);
|
|
277
290
|
else {
|
|
278
|
-
var
|
|
291
|
+
var i = {
|
|
279
292
|
operations: [a],
|
|
280
293
|
selectionBefore: t.selection
|
|
281
294
|
};
|
|
282
|
-
t.writeHistory("undos",
|
|
295
|
+
t.writeHistory("undos", i);
|
|
283
296
|
}
|
|
284
297
|
for (; c.length > 100; )
|
|
285
298
|
c.shift();
|
|
286
299
|
s.redos = [];
|
|
287
300
|
}
|
|
288
|
-
|
|
301
|
+
o(a);
|
|
289
302
|
}, t.writeHistory = (a, l) => {
|
|
290
303
|
t.history[a].push(l);
|
|
291
304
|
}, t;
|
|
292
|
-
},
|
|
293
|
-
const
|
|
305
|
+
}, Ye = (e, t) => !!(t && e.type === "insert_text" && t.type === "insert_text" && e.offset === t.offset + t.text.length && j.equals(e.path, t.path) || t && e.type === "remove_text" && t.type === "remove_text" && e.offset + e.text.length === t.offset && j.equals(e.path, t.path)), Ze = (e, t) => e.type !== "set_selection";
|
|
306
|
+
const re = /* @__PURE__ */ se((e, t) => {
|
|
294
307
|
const {
|
|
295
|
-
value:
|
|
308
|
+
value: o,
|
|
296
309
|
onChange: a,
|
|
297
310
|
onFocus: l,
|
|
298
311
|
onBlur: s,
|
|
299
312
|
placeholder: c = I.placeholder,
|
|
300
|
-
isDisabled:
|
|
313
|
+
isDisabled: u = I.isDisabled,
|
|
301
314
|
isReadOnly: y = I.isReadOnly,
|
|
302
315
|
autoFocus: f = I.autoFocus,
|
|
303
|
-
toolbar:
|
|
304
|
-
} = e,
|
|
316
|
+
toolbar: h
|
|
317
|
+
} = e, i = de(() => {
|
|
305
318
|
const p = Me();
|
|
306
|
-
return ye(
|
|
307
|
-
}, []), { handleKeyDown:
|
|
319
|
+
return ye(Qe(ve(p)));
|
|
320
|
+
}, []), { handleKeyDown: B } = Ce({ editor: i }), L = M(
|
|
308
321
|
(p) => {
|
|
309
322
|
l && l(p);
|
|
310
323
|
},
|
|
311
324
|
[l]
|
|
312
|
-
),
|
|
325
|
+
), O = M(
|
|
313
326
|
(p) => {
|
|
314
327
|
s && s(p);
|
|
315
328
|
},
|
|
316
329
|
[s]
|
|
317
330
|
);
|
|
318
|
-
|
|
331
|
+
ce(
|
|
319
332
|
t,
|
|
320
333
|
() => ({
|
|
321
|
-
focus: () => Se(
|
|
322
|
-
resetValue: (p) => xe(
|
|
334
|
+
focus: () => Se(i),
|
|
335
|
+
resetValue: (p) => xe(i, p)
|
|
323
336
|
}),
|
|
324
|
-
[
|
|
337
|
+
[i]
|
|
325
338
|
);
|
|
326
|
-
const
|
|
327
|
-
(p) => /* @__PURE__ */
|
|
339
|
+
const z = M(
|
|
340
|
+
(p) => /* @__PURE__ */ r(be, { ...p }),
|
|
328
341
|
[]
|
|
329
|
-
),
|
|
330
|
-
(p) => /* @__PURE__ */
|
|
342
|
+
), H = M(
|
|
343
|
+
(p) => /* @__PURE__ */ r(we, { ...p }),
|
|
331
344
|
[]
|
|
332
|
-
),
|
|
333
|
-
return /* @__PURE__ */ n(Re, { editor:
|
|
334
|
-
|
|
335
|
-
/* @__PURE__ */
|
|
345
|
+
), E = P(), F = Array.isArray(o) && o.length > 0 ? o : E;
|
|
346
|
+
return /* @__PURE__ */ n(Re, { editor: i, initialValue: F, onChange: a, children: [
|
|
347
|
+
h && /* @__PURE__ */ r(je, { children: h }),
|
|
348
|
+
/* @__PURE__ */ r(qe, { asChild: !0, children: /* @__PURE__ */ r(
|
|
336
349
|
Te,
|
|
337
350
|
{
|
|
338
|
-
renderElement:
|
|
339
|
-
renderLeaf:
|
|
351
|
+
renderElement: z,
|
|
352
|
+
renderLeaf: H,
|
|
340
353
|
placeholder: c,
|
|
341
354
|
autoFocus: f,
|
|
342
|
-
readOnly: y ||
|
|
343
|
-
onKeyDown:
|
|
344
|
-
onFocus:
|
|
345
|
-
onBlur:
|
|
355
|
+
readOnly: y || u,
|
|
356
|
+
onKeyDown: B,
|
|
357
|
+
onFocus: L,
|
|
358
|
+
onBlur: O,
|
|
346
359
|
"aria-label": "Rich text editor",
|
|
347
360
|
role: "textbox",
|
|
348
361
|
"aria-multiline": "true"
|
|
@@ -350,10 +363,10 @@ const te = /* @__PURE__ */ ae((e, t) => {
|
|
|
350
363
|
) })
|
|
351
364
|
] });
|
|
352
365
|
});
|
|
353
|
-
|
|
354
|
-
const
|
|
355
|
-
const t =
|
|
356
|
-
withPreservedSelection:
|
|
366
|
+
re.displayName = "RichTextEditor";
|
|
367
|
+
const $e = ({ isDisabled: e = !1 }) => {
|
|
368
|
+
const t = Z(), o = $(t), { allSelectedKeys: a, handleAllSelectionChange: l } = Pe({
|
|
369
|
+
withPreservedSelection: o
|
|
357
370
|
});
|
|
358
371
|
return /* @__PURE__ */ n(
|
|
359
372
|
g.Root,
|
|
@@ -363,7 +376,7 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
363
376
|
onSelectionChange: l,
|
|
364
377
|
children: [
|
|
365
378
|
/* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
|
|
366
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ r(g.Trigger, { asChild: !0, children: /* @__PURE__ */ r(
|
|
367
380
|
k,
|
|
368
381
|
{
|
|
369
382
|
size: "xs",
|
|
@@ -371,27 +384,27 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
371
384
|
"aria-label": "More formatting options",
|
|
372
385
|
isDisabled: e,
|
|
373
386
|
onMouseDown: (s) => s.preventDefault(),
|
|
374
|
-
children: /* @__PURE__ */
|
|
387
|
+
children: /* @__PURE__ */ r(ze, {})
|
|
375
388
|
}
|
|
376
389
|
) }),
|
|
377
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ r(d.Content, { placement: "top", children: "More styles" })
|
|
378
391
|
] }),
|
|
379
392
|
/* @__PURE__ */ n(g.Content, { children: [
|
|
380
|
-
/* @__PURE__ */
|
|
381
|
-
/* @__PURE__ */
|
|
382
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ r(g.Item, { id: "strikethrough", children: /* @__PURE__ */ n(b, { slot: "label", display: "flex", alignItems: "center", gap: "200", children: [
|
|
394
|
+
/* @__PURE__ */ r(He, {}),
|
|
395
|
+
/* @__PURE__ */ r(v, { textStyle: "sm", children: "Strikethrough" })
|
|
383
396
|
] }) }),
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ r(g.Item, { id: "code", children: /* @__PURE__ */ n(b, { slot: "label", display: "flex", alignItems: "center", gap: "200", children: [
|
|
398
|
+
/* @__PURE__ */ r(Ee, {}),
|
|
399
|
+
/* @__PURE__ */ r(v, { textStyle: "sm", children: "Code" })
|
|
387
400
|
] }) }),
|
|
388
|
-
/* @__PURE__ */
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ r(g.Item, { id: "superscript", children: /* @__PURE__ */ n(b, { slot: "label", display: "flex", alignItems: "center", gap: "200", children: [
|
|
402
|
+
/* @__PURE__ */ r(v, { children: "X²" }),
|
|
403
|
+
/* @__PURE__ */ r(v, { textStyle: "sm", children: "Superscript" })
|
|
391
404
|
] }) }),
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ r(g.Item, { id: "subscript", children: /* @__PURE__ */ n(b, { slot: "label", display: "flex", alignItems: "center", gap: "200", children: [
|
|
406
|
+
/* @__PURE__ */ r(v, { children: "X₂" }),
|
|
407
|
+
/* @__PURE__ */ r(v, { textStyle: "sm", children: "Subscript" })
|
|
395
408
|
] }) })
|
|
396
409
|
] })
|
|
397
410
|
]
|
|
@@ -400,18 +413,18 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
400
413
|
}, oe = ({
|
|
401
414
|
isDisabled: e = !1
|
|
402
415
|
}) => {
|
|
403
|
-
const t =
|
|
416
|
+
const t = Z(), o = $(t), {
|
|
404
417
|
currentTextStyle: a,
|
|
405
418
|
selectedTextStyleLabel: l,
|
|
406
419
|
handleTextStyleChange: s,
|
|
407
420
|
handleListToggle: c,
|
|
408
|
-
selectedFormatKeys:
|
|
421
|
+
selectedFormatKeys: u,
|
|
409
422
|
selectedListKeys: y,
|
|
410
423
|
hasUndos: f,
|
|
411
|
-
hasRedos:
|
|
412
|
-
} =
|
|
424
|
+
hasRedos: h
|
|
425
|
+
} = Be({ withPreservedSelection: o });
|
|
413
426
|
return /* @__PURE__ */ n(
|
|
414
|
-
|
|
427
|
+
Oe,
|
|
415
428
|
{
|
|
416
429
|
orientation: "horizontal",
|
|
417
430
|
"aria-label": "Text formatting",
|
|
@@ -419,13 +432,13 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
419
432
|
overflow: "hidden",
|
|
420
433
|
size: "xs",
|
|
421
434
|
children: [
|
|
422
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ r(J, { children: /* @__PURE__ */ n(
|
|
423
436
|
g.Root,
|
|
424
437
|
{
|
|
425
|
-
onAction: (
|
|
438
|
+
onAction: (i) => s(String(i)),
|
|
426
439
|
children: [
|
|
427
440
|
/* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
|
|
428
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ r(
|
|
429
442
|
g.Trigger,
|
|
430
443
|
{
|
|
431
444
|
height: "800",
|
|
@@ -434,36 +447,36 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
434
447
|
borderRadius: "200",
|
|
435
448
|
_hover: { bg: "primary.2" },
|
|
436
449
|
isDisabled: e,
|
|
437
|
-
onMouseDown: (
|
|
450
|
+
onMouseDown: (i) => i.preventDefault(),
|
|
438
451
|
"aria-label": "Text style menu",
|
|
439
452
|
children: /* @__PURE__ */ n(b, { display: "flex", alignItems: "center", gap: "200", px: "200", children: [
|
|
440
|
-
/* @__PURE__ */
|
|
441
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ r(b, { display: "flex", alignItems: "center", gap: "200", flexGrow: "1", children: /* @__PURE__ */ r(v, { my: "auto", textStyle: "sm", fontWeight: "500", children: l }) }),
|
|
454
|
+
/* @__PURE__ */ r(Fe, {})
|
|
442
455
|
] })
|
|
443
456
|
}
|
|
444
457
|
),
|
|
445
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ r(d.Content, { placement: "top", children: "Text style" })
|
|
446
459
|
] }),
|
|
447
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ r(g.Content, { children: Le.map((i) => /* @__PURE__ */ r(
|
|
448
461
|
g.Item,
|
|
449
462
|
{
|
|
450
|
-
id:
|
|
451
|
-
...a ===
|
|
463
|
+
id: i.id,
|
|
464
|
+
...a === i.id && {
|
|
452
465
|
"data-state": "checked"
|
|
453
466
|
},
|
|
454
|
-
children: /* @__PURE__ */
|
|
467
|
+
children: /* @__PURE__ */ r(v, { ...i.props, children: i.label })
|
|
455
468
|
},
|
|
456
|
-
|
|
469
|
+
i.id
|
|
457
470
|
)) })
|
|
458
471
|
]
|
|
459
472
|
}
|
|
460
473
|
) }),
|
|
461
|
-
/* @__PURE__ */
|
|
474
|
+
/* @__PURE__ */ r(X, { orientation: "vertical" }),
|
|
462
475
|
/* @__PURE__ */ n(
|
|
463
476
|
Q.Root,
|
|
464
477
|
{
|
|
465
478
|
selectionMode: "multiple",
|
|
466
|
-
selectedKeys:
|
|
479
|
+
selectedKeys: u,
|
|
467
480
|
isDisabled: e,
|
|
468
481
|
children: [
|
|
469
482
|
/* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
|
|
@@ -475,15 +488,15 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
475
488
|
variant: "ghost",
|
|
476
489
|
"aria-label": "Bold",
|
|
477
490
|
isDisabled: e,
|
|
478
|
-
onMouseDown: (
|
|
479
|
-
onPress:
|
|
491
|
+
onMouseDown: (i) => i.preventDefault(),
|
|
492
|
+
onPress: o(() => V(t, "bold")),
|
|
480
493
|
children: [
|
|
481
|
-
/* @__PURE__ */
|
|
482
|
-
/* @__PURE__ */
|
|
494
|
+
/* @__PURE__ */ r(Ve, {}),
|
|
495
|
+
/* @__PURE__ */ r(T, { children: "Bold" })
|
|
483
496
|
]
|
|
484
497
|
}
|
|
485
498
|
),
|
|
486
|
-
/* @__PURE__ */
|
|
499
|
+
/* @__PURE__ */ r(d.Content, { placement: "top", children: "Bold" })
|
|
487
500
|
] }),
|
|
488
501
|
/* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
|
|
489
502
|
/* @__PURE__ */ n(
|
|
@@ -494,15 +507,15 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
494
507
|
variant: "ghost",
|
|
495
508
|
"aria-label": "Italic",
|
|
496
509
|
isDisabled: e,
|
|
497
|
-
onMouseDown: (
|
|
498
|
-
onPress:
|
|
510
|
+
onMouseDown: (i) => i.preventDefault(),
|
|
511
|
+
onPress: o(() => V(t, "italic")),
|
|
499
512
|
children: [
|
|
500
|
-
/* @__PURE__ */
|
|
501
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ r(Ae, {}),
|
|
514
|
+
/* @__PURE__ */ r(T, { children: "Italic" })
|
|
502
515
|
]
|
|
503
516
|
}
|
|
504
517
|
),
|
|
505
|
-
/* @__PURE__ */
|
|
518
|
+
/* @__PURE__ */ r(d.Content, { placement: "top", children: "Italic" })
|
|
506
519
|
] }),
|
|
507
520
|
/* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
|
|
508
521
|
/* @__PURE__ */ n(
|
|
@@ -513,23 +526,23 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
513
526
|
variant: "ghost",
|
|
514
527
|
"aria-label": "Underline",
|
|
515
528
|
isDisabled: e,
|
|
516
|
-
onMouseDown: (
|
|
517
|
-
onPress:
|
|
529
|
+
onMouseDown: (i) => i.preventDefault(),
|
|
530
|
+
onPress: o(
|
|
518
531
|
() => V(t, "underline")
|
|
519
532
|
),
|
|
520
533
|
children: [
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
/* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ r(We, {}),
|
|
535
|
+
/* @__PURE__ */ r(T, { children: "Underline" })
|
|
523
536
|
]
|
|
524
537
|
}
|
|
525
538
|
),
|
|
526
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ r(d.Content, { placement: "top", children: "Underline" })
|
|
527
540
|
] })
|
|
528
541
|
]
|
|
529
542
|
}
|
|
530
543
|
),
|
|
531
|
-
/* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */
|
|
544
|
+
/* @__PURE__ */ r($e, { isDisabled: e }),
|
|
545
|
+
/* @__PURE__ */ r(X, { orientation: "vertical" }),
|
|
533
546
|
/* @__PURE__ */ n(
|
|
534
547
|
Q.Root,
|
|
535
548
|
{
|
|
@@ -540,7 +553,7 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
540
553
|
isDisabled: e,
|
|
541
554
|
children: [
|
|
542
555
|
/* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
|
|
543
|
-
/* @__PURE__ */
|
|
556
|
+
/* @__PURE__ */ r(
|
|
544
557
|
R,
|
|
545
558
|
{
|
|
546
559
|
id: "bulleted-list",
|
|
@@ -548,14 +561,14 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
548
561
|
variant: "ghost",
|
|
549
562
|
"aria-label": "Bulleted List",
|
|
550
563
|
isDisabled: e,
|
|
551
|
-
onMouseDown: (
|
|
552
|
-
children: /* @__PURE__ */
|
|
564
|
+
onMouseDown: (i) => i.preventDefault(),
|
|
565
|
+
children: /* @__PURE__ */ r(Ne, {})
|
|
553
566
|
}
|
|
554
567
|
),
|
|
555
|
-
/* @__PURE__ */
|
|
568
|
+
/* @__PURE__ */ r(d.Content, { placement: "top", children: "Bulleted list" })
|
|
556
569
|
] }),
|
|
557
570
|
/* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
|
|
558
|
-
/* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ r(
|
|
559
572
|
R,
|
|
560
573
|
{
|
|
561
574
|
id: "numbered-list",
|
|
@@ -563,16 +576,16 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
563
576
|
variant: "ghost",
|
|
564
577
|
"aria-label": "Numbered List",
|
|
565
578
|
isDisabled: e,
|
|
566
|
-
onMouseDown: (
|
|
567
|
-
children: /* @__PURE__ */
|
|
579
|
+
onMouseDown: (i) => i.preventDefault(),
|
|
580
|
+
children: /* @__PURE__ */ r(ke, {})
|
|
568
581
|
}
|
|
569
582
|
),
|
|
570
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ r(d.Content, { placement: "top", children: "Numbered list" })
|
|
571
584
|
] })
|
|
572
585
|
]
|
|
573
586
|
}
|
|
574
587
|
),
|
|
575
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ r(b, { flexGrow: "1" }),
|
|
576
589
|
/* @__PURE__ */ n(J, { children: [
|
|
577
590
|
/* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
|
|
578
591
|
/* @__PURE__ */ n(
|
|
@@ -582,15 +595,15 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
582
595
|
variant: "ghost",
|
|
583
596
|
"aria-label": "Undo",
|
|
584
597
|
isDisabled: !f || e,
|
|
585
|
-
onPress:
|
|
586
|
-
onMouseDown: (
|
|
598
|
+
onPress: o(() => t.undo()),
|
|
599
|
+
onMouseDown: (i) => i.preventDefault(),
|
|
587
600
|
children: [
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
/* @__PURE__ */
|
|
601
|
+
/* @__PURE__ */ r(Ke, {}),
|
|
602
|
+
/* @__PURE__ */ r(T, { children: "Undo" })
|
|
590
603
|
]
|
|
591
604
|
}
|
|
592
605
|
),
|
|
593
|
-
/* @__PURE__ */
|
|
606
|
+
/* @__PURE__ */ r(d.Content, { placement: "top", children: "Undo" })
|
|
594
607
|
] }),
|
|
595
608
|
/* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
|
|
596
609
|
/* @__PURE__ */ n(
|
|
@@ -599,16 +612,16 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
599
612
|
size: "xs",
|
|
600
613
|
variant: "ghost",
|
|
601
614
|
"aria-label": "Redo",
|
|
602
|
-
isDisabled: !
|
|
603
|
-
onPress:
|
|
604
|
-
onMouseDown: (
|
|
615
|
+
isDisabled: !h || e,
|
|
616
|
+
onPress: o(() => t.redo()),
|
|
617
|
+
onMouseDown: (i) => i.preventDefault(),
|
|
605
618
|
children: [
|
|
606
|
-
/* @__PURE__ */
|
|
607
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ r(Ue, {}),
|
|
620
|
+
/* @__PURE__ */ r(T, { children: "Redo" })
|
|
608
621
|
]
|
|
609
622
|
}
|
|
610
623
|
),
|
|
611
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ r(d.Content, { placement: "top", children: "Redo" })
|
|
612
625
|
] })
|
|
613
626
|
] })
|
|
614
627
|
]
|
|
@@ -616,76 +629,76 @@ const Ze = ({ isDisabled: e = !1 }) => {
|
|
|
616
629
|
);
|
|
617
630
|
};
|
|
618
631
|
oe.displayName = "RichTextToolbar";
|
|
619
|
-
const
|
|
632
|
+
const et = (e) => {
|
|
620
633
|
const {
|
|
621
634
|
ref: t,
|
|
622
|
-
value:
|
|
635
|
+
value: o,
|
|
623
636
|
defaultValue: a,
|
|
624
637
|
onChange: l,
|
|
625
638
|
onFocus: s,
|
|
626
639
|
onBlur: c,
|
|
627
|
-
placeholder:
|
|
640
|
+
placeholder: u = "",
|
|
628
641
|
isDisabled: y = !1,
|
|
629
642
|
isReadOnly: f = !1,
|
|
630
|
-
isInvalid:
|
|
631
|
-
autoFocus:
|
|
632
|
-
...
|
|
633
|
-
} = e,
|
|
643
|
+
isInvalid: h = !1,
|
|
644
|
+
autoFocus: i = !1,
|
|
645
|
+
...B
|
|
646
|
+
} = e, L = ge({ recipe: ee }), [O, z] = L.splitVariantProps({
|
|
634
647
|
// Only semantic variants go here (none currently defined)
|
|
635
|
-
...
|
|
636
|
-
}), [
|
|
648
|
+
...B
|
|
649
|
+
}), [H, E] = me(z), F = {
|
|
637
650
|
"data-disabled": y ? "true" : void 0,
|
|
638
|
-
"data-invalid":
|
|
651
|
+
"data-invalid": h ? "true" : void 0,
|
|
639
652
|
"data-readonly": f ? "true" : void 0
|
|
640
653
|
}, [p, K] = G(() => {
|
|
641
|
-
const x =
|
|
654
|
+
const x = o ?? a ?? "";
|
|
642
655
|
try {
|
|
643
|
-
return x ? q(x) :
|
|
656
|
+
return x ? q(x) : P();
|
|
644
657
|
} catch (w) {
|
|
645
|
-
return console.warn("Failed to parse initial HTML, using empty value:", w),
|
|
658
|
+
return console.warn("Failed to parse initial HTML, using empty value:", w), P();
|
|
646
659
|
}
|
|
647
|
-
}), [D, U] = G(() =>
|
|
660
|
+
}), [D, U] = G(() => o ?? a ?? ""), ie = ue(null);
|
|
648
661
|
he(() => {
|
|
649
|
-
if (
|
|
650
|
-
const x =
|
|
651
|
-
K(x), U(
|
|
662
|
+
if (o !== void 0 && o !== D) {
|
|
663
|
+
const x = o ? q(o) : P();
|
|
664
|
+
K(x), U(o);
|
|
652
665
|
}
|
|
653
|
-
}, [
|
|
654
|
-
const
|
|
666
|
+
}, [o, D]);
|
|
667
|
+
const ne = M(
|
|
655
668
|
(x) => {
|
|
656
|
-
const w = De(x),
|
|
657
|
-
K(x), U(w),
|
|
669
|
+
const w = De(x), ae = w !== D;
|
|
670
|
+
K(x), U(w), ae && l && l(w);
|
|
658
671
|
},
|
|
659
672
|
[D, l]
|
|
660
|
-
),
|
|
661
|
-
return /* @__PURE__ */
|
|
673
|
+
), le = Ie(p);
|
|
674
|
+
return /* @__PURE__ */ r(
|
|
662
675
|
_e,
|
|
663
676
|
{
|
|
664
|
-
...
|
|
677
|
+
...O,
|
|
678
|
+
...H,
|
|
665
679
|
...E,
|
|
666
680
|
...F,
|
|
667
|
-
...O,
|
|
668
681
|
ref: t,
|
|
669
|
-
children: /* @__PURE__ */
|
|
670
|
-
|
|
682
|
+
children: /* @__PURE__ */ r(
|
|
683
|
+
re,
|
|
671
684
|
{
|
|
672
|
-
ref:
|
|
673
|
-
value:
|
|
674
|
-
onChange:
|
|
685
|
+
ref: ie,
|
|
686
|
+
value: le,
|
|
687
|
+
onChange: ne,
|
|
675
688
|
onFocus: s,
|
|
676
689
|
onBlur: c,
|
|
677
|
-
placeholder:
|
|
690
|
+
placeholder: u,
|
|
678
691
|
isDisabled: y,
|
|
679
692
|
isReadOnly: f,
|
|
680
|
-
autoFocus:
|
|
681
|
-
toolbar: f ? null : /* @__PURE__ */
|
|
693
|
+
autoFocus: i,
|
|
694
|
+
toolbar: f ? null : /* @__PURE__ */ r(oe, { isDisabled: y })
|
|
682
695
|
}
|
|
683
696
|
)
|
|
684
697
|
}
|
|
685
698
|
);
|
|
686
699
|
};
|
|
687
|
-
|
|
700
|
+
et.displayName = "RichTextInput";
|
|
688
701
|
export {
|
|
689
|
-
|
|
702
|
+
et as R
|
|
690
703
|
};
|
|
691
|
-
//# sourceMappingURL=rich-text-input-
|
|
704
|
+
//# sourceMappingURL=rich-text-input-CYlc7Ozc.es.js.map
|