@commercetools/nimbus 0.0.0-canary-20250916130207 → 0.0.0-canary-20250918091239

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.
Files changed (78) hide show
  1. package/dist/chunks/icon-BHx0r3NL.cjs.js +2 -0
  2. package/dist/chunks/icon-BHx0r3NL.cjs.js.map +1 -0
  3. package/dist/chunks/icon-DHu0zrOb.es.js +14 -0
  4. package/dist/chunks/icon-DHu0zrOb.es.js.map +1 -0
  5. package/dist/chunks/icon.recipe-ClxbhW0Q.cjs.js +2 -0
  6. package/dist/chunks/icon.recipe-ClxbhW0Q.cjs.js.map +1 -0
  7. package/dist/chunks/icon.recipe-DjkjodUn.es.js +24 -0
  8. package/dist/chunks/icon.recipe-DjkjodUn.es.js.map +1 -0
  9. package/dist/chunks/inline-svg-DTleUhZq.es.js +21 -0
  10. package/dist/chunks/inline-svg-DTleUhZq.es.js.map +1 -0
  11. package/dist/chunks/inline-svg-DbvmiSw9.cjs.js +2 -0
  12. package/dist/chunks/inline-svg-DbvmiSw9.cjs.js.map +1 -0
  13. package/dist/chunks/{menu-bzi7WVh0.cjs.js → menu-CQYhHGbS.cjs.js} +2 -2
  14. package/dist/chunks/{menu-bzi7WVh0.cjs.js.map → menu-CQYhHGbS.cjs.js.map} +1 -1
  15. package/dist/chunks/{menu-DZVU5Z-r.es.js → menu-DnbrSKhK.es.js} +2 -2
  16. package/dist/chunks/{menu-DZVU5Z-r.es.js.map → menu-DnbrSKhK.es.js.map} +1 -1
  17. package/dist/chunks/rich-text-input-BbCjT_Nf.es.js +7916 -0
  18. package/dist/chunks/rich-text-input-BbCjT_Nf.es.js.map +1 -0
  19. package/dist/chunks/rich-text-input-BwrGY2EU.cjs.js +24 -0
  20. package/dist/chunks/rich-text-input-BwrGY2EU.cjs.js.map +1 -0
  21. package/dist/chunks/{split-button-BR8DktKd.es.js → split-button-ClVaxLZ7.es.js} +3 -3
  22. package/dist/chunks/{split-button-BR8DktKd.es.js.map → split-button-ClVaxLZ7.es.js.map} +1 -1
  23. package/dist/chunks/{split-button-1uPesHKO.cjs.js → split-button-D-3pT-LA.cjs.js} +2 -2
  24. package/dist/chunks/{split-button-1uPesHKO.cjs.js.map → split-button-D-3pT-LA.cjs.js.map} +1 -1
  25. package/dist/chunks/use-inline-svg-C2ko8Bcq.cjs.js +2 -0
  26. package/dist/chunks/use-inline-svg-C2ko8Bcq.cjs.js.map +1 -0
  27. package/dist/chunks/use-inline-svg-Cua0623E.es.js +47 -0
  28. package/dist/chunks/use-inline-svg-Cua0623E.es.js.map +1 -0
  29. package/dist/components/components.cjs +1 -1
  30. package/dist/components/components.es.js +79 -77
  31. package/dist/components/components.es.js.map +1 -1
  32. package/dist/components/constants.cjs +1 -1
  33. package/dist/components/constants.cjs.map +1 -1
  34. package/dist/components/constants.es.js +13 -122
  35. package/dist/components/constants.es.js.map +1 -1
  36. package/dist/components/hooks.cjs +1 -1
  37. package/dist/components/hooks.es.js +2 -5
  38. package/dist/components/icon.cjs +1 -1
  39. package/dist/components/icon.es.js +1 -1
  40. package/dist/components/inline-svg.cjs +2 -0
  41. package/dist/components/inline-svg.cjs.map +1 -0
  42. package/dist/components/inline-svg.es.js +5 -0
  43. package/dist/components/inline-svg.es.js.map +1 -0
  44. package/dist/components/rich-text-input.cjs +1 -1
  45. package/dist/components/rich-text-input.es.js +1 -1
  46. package/dist/components/split-button.cjs +1 -1
  47. package/dist/components/split-button.es.js +1 -1
  48. package/dist/components/utils.cjs +2 -1
  49. package/dist/components/utils.cjs.map +1 -1
  50. package/dist/components/utils.es.js +543 -65
  51. package/dist/components/utils.es.js.map +1 -1
  52. package/dist/components.d.ts +34 -0
  53. package/dist/constants.d.ts +4 -113
  54. package/dist/hooks.d.ts +7 -46
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.d.ts +41 -45
  58. package/dist/index.es.js +121 -119
  59. package/dist/index.es.js.map +1 -1
  60. package/dist/inline-svg.d.ts +139 -0
  61. package/dist/utils.d.ts +28 -148
  62. package/package.json +6 -5
  63. package/dist/chunks/icon-BoRbJStV.es.js +0 -31
  64. package/dist/chunks/icon-BoRbJStV.es.js.map +0 -1
  65. package/dist/chunks/icon-Cny8ZtnX.cjs.js +0 -2
  66. package/dist/chunks/icon-Cny8ZtnX.cjs.js.map +0 -1
  67. package/dist/chunks/rich-text-input-B3s6cy-T.cjs.js +0 -2
  68. package/dist/chunks/rich-text-input-B3s6cy-T.cjs.js.map +0 -1
  69. package/dist/chunks/rich-text-input-D4cP13Oo.es.js +0 -691
  70. package/dist/chunks/rich-text-input-D4cP13Oo.es.js.map +0 -1
  71. package/dist/chunks/slate-helpers-BwRHJO4o.es.js +0 -6919
  72. package/dist/chunks/slate-helpers-BwRHJO4o.es.js.map +0 -1
  73. package/dist/chunks/slate-helpers-CMAwCMk0.cjs.js +0 -24
  74. package/dist/chunks/slate-helpers-CMAwCMk0.cjs.js.map +0 -1
  75. package/dist/chunks/use-formatting-state-Denpy3Zo.cjs.js +0 -2
  76. package/dist/chunks/use-formatting-state-Denpy3Zo.cjs.js.map +0 -1
  77. package/dist/chunks/use-formatting-state-RJvSR-Zg.es.js +0 -247
  78. package/dist/chunks/use-formatting-state-RJvSR-Zg.es.js.map +0 -1
@@ -1,691 +0,0 @@
1
- import { jsx as o, jsxs as n } from "react/jsx-runtime";
2
- import { forwardRef as ae, useMemo as se, useCallback as M, useImperativeHandle as de, useState as G, useRef as ce, useEffect as he } from "react";
3
- import { defineSlotRecipe as ue, createSlotRecipeContext as pe, useSlotRecipe as fe } from "@chakra-ui/react";
4
- import { e as ge } from "./extractStyleProps-vXiS8lCp.es.js";
5
- import { h as _, j as W, O as N, P as j, k as me, w as ye, l as ve, r as xe, e as Se, g as be, L as we, m as Re, c as B, n as Te, o as Me, u as Y, b as V, f as q, t as De, v as Ie } from "./slate-helpers-BwRHJO4o.es.js";
6
- import { a as Ce, u as Z, c as Be, b as Le } from "./use-formatting-state-RJvSR-Zg.es.js";
7
- import { EDITOR_DEFAULTS as I, textStyles as Pe } from "../components/constants.es.js";
8
- import { B as b } from "./box-DuBoAZvq.es.js";
9
- import { D as X } from "./divider-C11VwZPX.es.js";
10
- import { G as J } from "./group-FqYM3Go1.es.js";
11
- import { I as k } from "./icon-button-CKidhzN0.es.js";
12
- import { I as R } from "./icon-toggle-button-CfrW8nn2.es.js";
13
- import { T as v } from "./text-Bi4Gre95.es.js";
14
- import { b as d } from "./tooltip-BE3LzL7I.es.js";
15
- import { V as T } from "./visually-hidden-09RsVX6x.es.js";
16
- import { T as Q } from "./toggle-button-group-DXmJCAH5.es.js";
17
- import { T as ze } from "./toolbar-Dv9YKOSU.es.js";
18
- import { MoreHoriz as He, FormatStrikethrough as Ee, Code as Fe, KeyboardArrowDown as Oe, 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
- import { M as g } from "./menu-DZVU5Z-r.es.js";
20
- const $ = /* @__PURE__ */ ue({
21
- slots: ["root", "toolbar", "editable"],
22
- className: "nimbus-rich-text-input",
23
- base: {
24
- root: {
25
- display: "flex",
26
- flexDirection: "column",
27
- position: "relative",
28
- width: "full",
29
- borderRadius: "200",
30
- borderWidth: "{sizes.25}",
31
- colorPalette: "slate",
32
- borderColor: "colorPalette.7",
33
- backgroundColor: "colorPalette.contrast",
34
- // Invalid state styling
35
- "&[data-invalid='true']": {
36
- borderWidth: "{sizes.50}",
37
- borderColor: "critical.7"
38
- }
39
- },
40
- toolbar: {
41
- boxShadow: "1",
42
- // Disabled state styling for toolbar
43
- "[data-disabled='true'] &": {
44
- opacity: "0.5"
45
- }
46
- },
47
- editable: {
48
- padding: "400",
49
- minHeight: "inherit",
50
- outline: "none",
51
- // Disabled state styling for editable
52
- "[data-disabled='true'] &": {
53
- cursor: "not-allowed",
54
- opacity: "0.5"
55
- },
56
- // Styling for user-facing editor text
57
- "& p": {
58
- textStyle: "md",
59
- fontWeight: "500"
60
- },
61
- "& h1": {
62
- textStyle: "2xl",
63
- fontWeight: "500"
64
- },
65
- "& h2": {
66
- textStyle: "xl",
67
- fontWeight: "500"
68
- },
69
- "& h3": {
70
- textStyle: "lg",
71
- fontWeight: "500"
72
- },
73
- "& h4": {
74
- textStyle: "md",
75
- fontWeight: "500"
76
- },
77
- "& h5": {
78
- textStyle: "xs",
79
- fontWeight: "500"
80
- },
81
- "& blockquote": {
82
- textStyle: "md",
83
- fontWeight: "400",
84
- borderLeftWidth: "{sizes.100}",
85
- paddingLeft: "400"
86
- },
87
- "& ul": {
88
- paddingLeft: "600",
89
- listStyleType: "disc"
90
- },
91
- "& ol": {
92
- paddingLeft: "600",
93
- listStyleType: "decimal"
94
- },
95
- "& code": {
96
- padding: "100",
97
- fontFamily: "mono"
98
- },
99
- "& pre": {
100
- padding: "300",
101
- borderRadius: "200",
102
- overflow: "auto",
103
- "& code": {
104
- padding: "0"
105
- }
106
- },
107
- "& a": {
108
- color: "primary.11",
109
- textDecoration: "underline",
110
- cursor: "pointer",
111
- _hover: {
112
- textDecoration: "none"
113
- }
114
- },
115
- "& strong": {
116
- fontWeight: "700"
117
- },
118
- "& em": {
119
- fontStyle: "italic"
120
- },
121
- "& u": {
122
- textDecoration: "underline"
123
- },
124
- "& del": {
125
- textDecoration: "line-through"
126
- },
127
- "& sup": {
128
- fontSize: "75%",
129
- verticalAlign: "super",
130
- lineHeight: "0"
131
- },
132
- "& sub": {
133
- fontSize: "75%",
134
- verticalAlign: "sub",
135
- lineHeight: "0"
136
- }
137
- }
138
- },
139
- variants: {}
140
- }), { withProvider: Ge, withContext: ee } = /* @__PURE__ */ pe({
141
- recipe: $
142
- }), _e = /* @__PURE__ */ Ge("div", "root"), je = /* @__PURE__ */ ee("div", "toolbar"), qe = /* @__PURE__ */ ee("div", "editable");
143
- var Xe = {
144
- /**
145
- * Check if a value is a `History` object.
146
- */
147
- isHistory(e) {
148
- return me(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
- }
150
- }, A = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), m = {
151
- /**
152
- * Check if a value is a `HistoryEditor` object.
153
- */
154
- isHistoryEditor(e) {
155
- return Xe.isHistory(e.history) && W.isEditor(e);
156
- },
157
- /**
158
- * Get the merge flag's current value.
159
- */
160
- isMerging(e) {
161
- return S.get(e);
162
- },
163
- /**
164
- * Get the splitting once flag's current value.
165
- */
166
- isSplittingOnce(e) {
167
- return C.get(e);
168
- },
169
- setSplittingOnce(e, t) {
170
- C.set(e, t);
171
- },
172
- /**
173
- * Get the saving flag's current value.
174
- */
175
- isSaving(e) {
176
- return A.get(e);
177
- },
178
- /**
179
- * Redo to the previous saved state.
180
- */
181
- redo(e) {
182
- e.redo();
183
- },
184
- /**
185
- * Undo to the previous saved state.
186
- */
187
- undo(e) {
188
- e.undo();
189
- },
190
- /**
191
- * Apply a series of changes inside a synchronous `fn`, These operations will
192
- * be merged into the previous history.
193
- */
194
- withMerging(e, t) {
195
- var i = m.isMerging(e);
196
- S.set(e, !0), t(), S.set(e, i);
197
- },
198
- /**
199
- * Apply a series of changes inside a synchronous `fn`, ensuring that the first
200
- * operation starts a new batch in the history. Subsequent operations will be
201
- * merged as usual.
202
- */
203
- withNewBatch(e, t) {
204
- var i = m.isMerging(e);
205
- S.set(e, !0), C.set(e, !0), t(), S.set(e, i), C.delete(e);
206
- },
207
- /**
208
- * Apply a series of changes inside a synchronous `fn`, without merging any of
209
- * the new operations into previous save point in the history.
210
- */
211
- withoutMerging(e, t) {
212
- var i = m.isMerging(e);
213
- S.set(e, !1), t(), S.set(e, i);
214
- },
215
- /**
216
- * Apply a series of changes inside a synchronous `fn`, without saving any of
217
- * their operations into the history.
218
- */
219
- withoutSaving(e, t) {
220
- var i = m.isSaving(e);
221
- A.set(e, !1);
222
- try {
223
- t();
224
- } finally {
225
- A.set(e, i);
226
- }
227
- }
228
- }, Je = (e) => {
229
- var t = e, {
230
- apply: i
231
- } = t;
232
- return t.history = {
233
- undos: [],
234
- redos: []
235
- }, t.redo = () => {
236
- var {
237
- history: a
238
- } = t, {
239
- redos: l
240
- } = a;
241
- if (l.length > 0) {
242
- var s = l[l.length - 1];
243
- s.selectionBefore && _.setSelection(t, s.selectionBefore), m.withoutSaving(t, () => {
244
- W.withoutNormalizing(t, () => {
245
- for (var c of s.operations)
246
- t.apply(c);
247
- });
248
- }), a.redos.pop(), t.writeHistory("undos", s);
249
- }
250
- }, t.undo = () => {
251
- var {
252
- history: a
253
- } = t, {
254
- undos: l
255
- } = a;
256
- if (l.length > 0) {
257
- var s = l[l.length - 1];
258
- m.withoutSaving(t, () => {
259
- W.withoutNormalizing(t, () => {
260
- var c = s.operations.map(N.inverse).reverse();
261
- for (var h of c)
262
- t.apply(h);
263
- s.selectionBefore && _.setSelection(t, s.selectionBefore);
264
- });
265
- }), t.writeHistory("redos", s), a.undos.pop();
266
- }
267
- }, t.apply = (a) => {
268
- var {
269
- operations: l,
270
- history: s
271
- } = t, {
272
- undos: c
273
- } = s, h = c[c.length - 1], y = h && h.operations[h.operations.length - 1], f = m.isSaving(t), u = m.isMerging(t);
274
- if (f == null && (f = Ye(a)), f) {
275
- if (u == null && (h == null ? u = !1 : l.length !== 0 ? u = !0 : u = Qe(a, y)), m.isSplittingOnce(t) && (u = !1, m.setSplittingOnce(t, void 0)), h && u)
276
- h.operations.push(a);
277
- else {
278
- var r = {
279
- operations: [a],
280
- selectionBefore: t.selection
281
- };
282
- t.writeHistory("undos", r);
283
- }
284
- for (; c.length > 100; )
285
- c.shift();
286
- s.redos = [];
287
- }
288
- i(a);
289
- }, t.writeHistory = (a, l) => {
290
- t.history[a].push(l);
291
- }, t;
292
- }, Qe = (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)), Ye = (e, t) => e.type !== "set_selection";
293
- const te = /* @__PURE__ */ ae((e, t) => {
294
- const {
295
- value: i,
296
- onChange: a,
297
- onFocus: l,
298
- onBlur: s,
299
- placeholder: c = I.placeholder,
300
- isDisabled: h = I.isDisabled,
301
- isReadOnly: y = I.isReadOnly,
302
- autoFocus: f = I.autoFocus,
303
- toolbar: u
304
- } = e, r = se(() => {
305
- const p = Me();
306
- return ye(Je(ve(p)));
307
- }, []), { handleKeyDown: L } = Ce({ editor: r }), P = M(
308
- (p) => {
309
- l && l(p);
310
- },
311
- [l]
312
- ), z = M(
313
- (p) => {
314
- s && s(p);
315
- },
316
- [s]
317
- );
318
- de(
319
- t,
320
- () => ({
321
- focus: () => Se(r),
322
- resetValue: (p) => xe(r, p)
323
- }),
324
- [r]
325
- );
326
- const H = M(
327
- (p) => /* @__PURE__ */ o(be, { ...p }),
328
- []
329
- ), E = M(
330
- (p) => /* @__PURE__ */ o(we, { ...p }),
331
- []
332
- ), F = B(), O = Array.isArray(i) && i.length > 0 ? i : F;
333
- return /* @__PURE__ */ n(Re, { editor: r, value: O, onChange: a, children: [
334
- u && /* @__PURE__ */ o(je, { children: u }),
335
- /* @__PURE__ */ o(qe, { asChild: !0, children: /* @__PURE__ */ o(
336
- Te,
337
- {
338
- renderElement: H,
339
- renderLeaf: E,
340
- placeholder: c,
341
- autoFocus: f,
342
- readOnly: y || h,
343
- onKeyDown: L,
344
- onFocus: P,
345
- onBlur: z,
346
- "aria-label": "Rich text editor",
347
- role: "textbox",
348
- "aria-multiline": "true"
349
- }
350
- ) })
351
- ] });
352
- });
353
- te.displayName = "RichTextEditor";
354
- const Ze = ({ isDisabled: e = !1 }) => {
355
- const t = Y(), i = Z(t), { allSelectedKeys: a, handleAllSelectionChange: l } = Be({
356
- withPreservedSelection: i
357
- });
358
- return /* @__PURE__ */ n(
359
- g.Root,
360
- {
361
- selectionMode: "multiple",
362
- selectedKeys: a,
363
- onSelectionChange: l,
364
- children: [
365
- /* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
366
- /* @__PURE__ */ o(g.Trigger, { asChild: !0, children: /* @__PURE__ */ o(
367
- k,
368
- {
369
- size: "xs",
370
- variant: "ghost",
371
- "aria-label": "More formatting options",
372
- isDisabled: e,
373
- onMouseDown: (s) => s.preventDefault(),
374
- children: /* @__PURE__ */ o(He, {})
375
- }
376
- ) }),
377
- /* @__PURE__ */ o(d.Content, { placement: "top", children: "More styles" })
378
- ] }),
379
- /* @__PURE__ */ n(g.Content, { children: [
380
- /* @__PURE__ */ o(g.Item, { id: "strikethrough", children: /* @__PURE__ */ n(b, { slot: "label", display: "flex", alignItems: "center", gap: "200", children: [
381
- /* @__PURE__ */ o(Ee, {}),
382
- /* @__PURE__ */ o(v, { textStyle: "sm", children: "Strikethrough" })
383
- ] }) }),
384
- /* @__PURE__ */ o(g.Item, { id: "code", children: /* @__PURE__ */ n(b, { slot: "label", display: "flex", alignItems: "center", gap: "200", children: [
385
- /* @__PURE__ */ o(Fe, {}),
386
- /* @__PURE__ */ o(v, { textStyle: "sm", children: "Code" })
387
- ] }) }),
388
- /* @__PURE__ */ o(g.Item, { id: "superscript", children: /* @__PURE__ */ n(b, { slot: "label", display: "flex", alignItems: "center", gap: "200", children: [
389
- /* @__PURE__ */ o(v, { children: "X²" }),
390
- /* @__PURE__ */ o(v, { textStyle: "sm", children: "Superscript" })
391
- ] }) }),
392
- /* @__PURE__ */ o(g.Item, { id: "subscript", children: /* @__PURE__ */ n(b, { slot: "label", display: "flex", alignItems: "center", gap: "200", children: [
393
- /* @__PURE__ */ o(v, { children: "X₂" }),
394
- /* @__PURE__ */ o(v, { textStyle: "sm", children: "Subscript" })
395
- ] }) })
396
- ] })
397
- ]
398
- }
399
- );
400
- }, oe = ({
401
- isDisabled: e = !1
402
- }) => {
403
- const t = Y(), i = Z(t), {
404
- currentTextStyle: a,
405
- selectedTextStyleLabel: l,
406
- handleTextStyleChange: s,
407
- handleListToggle: c,
408
- selectedFormatKeys: h,
409
- selectedListKeys: y,
410
- hasUndos: f,
411
- hasRedos: u
412
- } = Le({ withPreservedSelection: i });
413
- return /* @__PURE__ */ n(
414
- ze,
415
- {
416
- orientation: "horizontal",
417
- "aria-label": "Text formatting",
418
- width: "full",
419
- overflow: "hidden",
420
- size: "xs",
421
- children: [
422
- /* @__PURE__ */ o(J, { children: /* @__PURE__ */ n(
423
- g.Root,
424
- {
425
- onAction: (r) => s(String(r)),
426
- children: [
427
- /* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
428
- /* @__PURE__ */ o(
429
- g.Trigger,
430
- {
431
- height: "800",
432
- width: "4000",
433
- bg: "primary.1",
434
- borderRadius: "200",
435
- _hover: { bg: "primary.2" },
436
- isDisabled: e,
437
- onMouseDown: (r) => r.preventDefault(),
438
- "aria-label": "Text style menu",
439
- children: /* @__PURE__ */ n(b, { display: "flex", alignItems: "center", gap: "200", px: "200", children: [
440
- /* @__PURE__ */ o(b, { display: "flex", alignItems: "center", gap: "200", flexGrow: "1", children: /* @__PURE__ */ o(v, { my: "auto", textStyle: "sm", fontWeight: "500", children: l }) }),
441
- /* @__PURE__ */ o(Oe, {})
442
- ] })
443
- }
444
- ),
445
- /* @__PURE__ */ o(d.Content, { placement: "top", children: "Text style" })
446
- ] }),
447
- /* @__PURE__ */ o(g.Content, { children: Pe.map((r) => /* @__PURE__ */ o(
448
- g.Item,
449
- {
450
- id: r.id,
451
- ...a === r.id && {
452
- "data-state": "checked"
453
- },
454
- children: /* @__PURE__ */ o(v, { ...r.props, children: r.label })
455
- },
456
- r.id
457
- )) })
458
- ]
459
- }
460
- ) }),
461
- /* @__PURE__ */ o(X, { orientation: "vertical" }),
462
- /* @__PURE__ */ n(
463
- Q.Root,
464
- {
465
- selectionMode: "multiple",
466
- selectedKeys: h,
467
- isDisabled: e,
468
- children: [
469
- /* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
470
- /* @__PURE__ */ n(
471
- R,
472
- {
473
- id: "bold",
474
- size: "xs",
475
- variant: "ghost",
476
- "aria-label": "Bold",
477
- isDisabled: e,
478
- onMouseDown: (r) => r.preventDefault(),
479
- onPress: i(() => V(t, "bold")),
480
- children: [
481
- /* @__PURE__ */ o(Ve, {}),
482
- /* @__PURE__ */ o(T, { children: "Bold" })
483
- ]
484
- }
485
- ),
486
- /* @__PURE__ */ o(d.Content, { placement: "top", children: "Bold" })
487
- ] }),
488
- /* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
489
- /* @__PURE__ */ n(
490
- R,
491
- {
492
- id: "italic",
493
- size: "xs",
494
- variant: "ghost",
495
- "aria-label": "Italic",
496
- isDisabled: e,
497
- onMouseDown: (r) => r.preventDefault(),
498
- onPress: i(() => V(t, "italic")),
499
- children: [
500
- /* @__PURE__ */ o(Ae, {}),
501
- /* @__PURE__ */ o(T, { children: "Italic" })
502
- ]
503
- }
504
- ),
505
- /* @__PURE__ */ o(d.Content, { placement: "top", children: "Italic" })
506
- ] }),
507
- /* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
508
- /* @__PURE__ */ n(
509
- R,
510
- {
511
- id: "underline",
512
- size: "xs",
513
- variant: "ghost",
514
- "aria-label": "Underline",
515
- isDisabled: e,
516
- onMouseDown: (r) => r.preventDefault(),
517
- onPress: i(
518
- () => V(t, "underline")
519
- ),
520
- children: [
521
- /* @__PURE__ */ o(We, {}),
522
- /* @__PURE__ */ o(T, { children: "Underline" })
523
- ]
524
- }
525
- ),
526
- /* @__PURE__ */ o(d.Content, { placement: "top", children: "Underline" })
527
- ] })
528
- ]
529
- }
530
- ),
531
- /* @__PURE__ */ o(Ze, { isDisabled: e }),
532
- /* @__PURE__ */ o(X, { orientation: "vertical" }),
533
- /* @__PURE__ */ n(
534
- Q.Root,
535
- {
536
- selectionMode: "single",
537
- selectedKeys: y,
538
- onSelectionChange: c,
539
- "aria-label": "List formatting",
540
- isDisabled: e,
541
- children: [
542
- /* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
543
- /* @__PURE__ */ o(
544
- R,
545
- {
546
- id: "bulleted-list",
547
- size: "xs",
548
- variant: "ghost",
549
- "aria-label": "Bulleted List",
550
- isDisabled: e,
551
- onMouseDown: (r) => r.preventDefault(),
552
- children: /* @__PURE__ */ o(Ne, {})
553
- }
554
- ),
555
- /* @__PURE__ */ o(d.Content, { placement: "top", children: "Bulleted list" })
556
- ] }),
557
- /* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
558
- /* @__PURE__ */ o(
559
- R,
560
- {
561
- id: "numbered-list",
562
- size: "xs",
563
- variant: "ghost",
564
- "aria-label": "Numbered List",
565
- isDisabled: e,
566
- onMouseDown: (r) => r.preventDefault(),
567
- children: /* @__PURE__ */ o(ke, {})
568
- }
569
- ),
570
- /* @__PURE__ */ o(d.Content, { placement: "top", children: "Numbered list" })
571
- ] })
572
- ]
573
- }
574
- ),
575
- /* @__PURE__ */ o(b, { flexGrow: "1" }),
576
- /* @__PURE__ */ n(J, { children: [
577
- /* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
578
- /* @__PURE__ */ n(
579
- k,
580
- {
581
- size: "xs",
582
- variant: "ghost",
583
- "aria-label": "Undo",
584
- isDisabled: !f || e,
585
- onPress: i(() => t.undo()),
586
- onMouseDown: (r) => r.preventDefault(),
587
- children: [
588
- /* @__PURE__ */ o(Ke, {}),
589
- /* @__PURE__ */ o(T, { children: "Undo" })
590
- ]
591
- }
592
- ),
593
- /* @__PURE__ */ o(d.Content, { placement: "top", children: "Undo" })
594
- ] }),
595
- /* @__PURE__ */ n(d.Root, { delay: 0, closeDelay: 0, children: [
596
- /* @__PURE__ */ n(
597
- k,
598
- {
599
- size: "xs",
600
- variant: "ghost",
601
- "aria-label": "Redo",
602
- isDisabled: !u || e,
603
- onPress: i(() => t.redo()),
604
- onMouseDown: (r) => r.preventDefault(),
605
- children: [
606
- /* @__PURE__ */ o(Ue, {}),
607
- /* @__PURE__ */ o(T, { children: "Redo" })
608
- ]
609
- }
610
- ),
611
- /* @__PURE__ */ o(d.Content, { placement: "top", children: "Redo" })
612
- ] })
613
- ] })
614
- ]
615
- }
616
- );
617
- };
618
- oe.displayName = "RichTextToolbar";
619
- const $e = (e) => {
620
- const {
621
- ref: t,
622
- value: i,
623
- defaultValue: a,
624
- onChange: l,
625
- onFocus: s,
626
- onBlur: c,
627
- placeholder: h = "",
628
- isDisabled: y = !1,
629
- isReadOnly: f = !1,
630
- isInvalid: u = !1,
631
- autoFocus: r = !1,
632
- ...L
633
- } = e, P = fe({ recipe: $ }), [z, H] = P.splitVariantProps({
634
- // Only semantic variants go here (none currently defined)
635
- ...L
636
- }), [E, F] = ge(H), O = {
637
- "data-disabled": y ? "true" : void 0,
638
- "data-invalid": u ? "true" : void 0,
639
- "data-readonly": f ? "true" : void 0
640
- }, [p, K] = G(() => {
641
- const x = i ?? a ?? "";
642
- try {
643
- return x ? q(x) : B();
644
- } catch (w) {
645
- return console.warn("Failed to parse initial HTML, using empty value:", w), B();
646
- }
647
- }), [D, U] = G(() => i ?? a ?? ""), re = ce(null);
648
- he(() => {
649
- if (i !== void 0 && i !== D) {
650
- const x = i ? q(i) : B();
651
- K(x), U(i);
652
- }
653
- }, [i, D]);
654
- const ie = M(
655
- (x) => {
656
- const w = De(x), le = w !== D;
657
- K(x), U(w), le && l && l(w);
658
- },
659
- [D, l]
660
- ), ne = Ie(p);
661
- return /* @__PURE__ */ o(
662
- _e,
663
- {
664
- ...z,
665
- ...E,
666
- ...F,
667
- ...O,
668
- ref: t,
669
- children: /* @__PURE__ */ o(
670
- te,
671
- {
672
- ref: re,
673
- value: ne,
674
- onChange: ie,
675
- onFocus: s,
676
- onBlur: c,
677
- placeholder: h,
678
- isDisabled: y,
679
- isReadOnly: f,
680
- autoFocus: r,
681
- toolbar: f ? null : /* @__PURE__ */ o(oe, { isDisabled: y })
682
- }
683
- )
684
- }
685
- );
686
- };
687
- $e.displayName = "RichTextInput";
688
- export {
689
- $e as R
690
- };
691
- //# sourceMappingURL=rich-text-input-D4cP13Oo.es.js.map