wimui 0.15.0 → 0.16.0

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 (151) hide show
  1. package/NOTICE +85 -0
  2. package/README.ja.md +2 -0
  3. package/README.md +2 -0
  4. package/dist/components/_internal/FeedbackIcon.cjs +1 -1
  5. package/dist/components/_internal/FeedbackIcon.js +17 -16
  6. package/dist/components/ai/ChatUI/chat-ui.module.cjs +1 -1
  7. package/dist/components/ai/ChatUI/chat-ui.module.js +2 -2
  8. package/dist/components/ai/CodeBlock/code-block.module.cjs +1 -1
  9. package/dist/components/ai/CodeBlock/code-block.module.js +1 -1
  10. package/dist/components/ai/Terminal/Terminal.cjs +1 -1
  11. package/dist/components/ai/Terminal/Terminal.js +1 -1
  12. package/dist/components/data-display/Card/card.module.cjs +1 -1
  13. package/dist/components/data-display/Card/card.module.js +15 -15
  14. package/dist/components/data-display/Stats/Stats.cjs +1 -1
  15. package/dist/components/data-display/Stats/Stats.js +46 -38
  16. package/dist/components/data-display/Timeline/timeline.module.cjs +1 -1
  17. package/dist/components/data-display/Timeline/timeline.module.js +6 -6
  18. package/dist/components/form/Cascader/cascader.module.cjs +1 -1
  19. package/dist/components/form/Cascader/cascader.module.js +6 -6
  20. package/dist/components/form/RichTextEditor/RichTextEditor.cjs +1 -1
  21. package/dist/components/form/RichTextEditor/RichTextEditor.js +248 -421
  22. package/dist/components/form/SignaturePad/signature-pad.module.cjs +1 -1
  23. package/dist/components/form/SignaturePad/signature-pad.module.js +6 -6
  24. package/dist/components/form/Transfer/transfer.module.cjs +1 -1
  25. package/dist/components/form/Transfer/transfer.module.js +6 -6
  26. package/dist/components/form/TreeSelect/tree-select.module.cjs +1 -1
  27. package/dist/components/form/TreeSelect/tree-select.module.js +6 -6
  28. package/dist/components/layout/Dashboard/Dashboard.cjs +1 -1
  29. package/dist/components/layout/Dashboard/Dashboard.js +1 -1
  30. package/dist/components/layout/Transition/Transition.cjs +1 -1
  31. package/dist/components/layout/Transition/Transition.js +24 -46
  32. package/dist/components/media/Gallery/Gallery.cjs +1 -1
  33. package/dist/components/media/Gallery/Gallery.js +1 -1
  34. package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
  35. package/dist/components/media/Lightbox/Lightbox.d.ts +4 -0
  36. package/dist/components/media/Lightbox/Lightbox.js +23 -22
  37. package/dist/components/navigation/TabBar/TabBar.d.ts +12 -1
  38. package/dist/components/navigation/TabBar/tab-bar.module.cjs +1 -1
  39. package/dist/components/navigation/TabBar/tab-bar.module.js +1 -1
  40. package/dist/components/overlay/BottomSheet/BottomSheet.cjs +1 -1
  41. package/dist/components/overlay/BottomSheet/BottomSheet.js +1 -8
  42. package/dist/components/overlay/BottomSheet/bottom-sheet.module.cjs +1 -1
  43. package/dist/components/overlay/BottomSheet/bottom-sheet.module.js +8 -10
  44. package/dist/components/overlay/Popover/Popover.cjs +1 -1
  45. package/dist/components/overlay/Popover/Popover.js +2 -3
  46. package/dist/i18n/generated/keys.d.ts +1 -1
  47. package/dist/i18n/generated/resources.cjs +1 -1
  48. package/dist/i18n/generated/resources.js +9 -3
  49. package/dist/icon/alert-triangle.cjs +2 -0
  50. package/dist/icon/alert-triangle.js +31 -0
  51. package/dist/icon/align-justify.cjs +1 -1
  52. package/dist/icon/align-justify.js +14 -8
  53. package/dist/icon/arrow-down.cjs +2 -0
  54. package/dist/icon/arrow-down.js +22 -0
  55. package/dist/icon/arrow-left.cjs +2 -0
  56. package/dist/icon/arrow-left.js +22 -0
  57. package/dist/icon/arrow-right.cjs +2 -0
  58. package/dist/icon/arrow-right.js +22 -0
  59. package/dist/icon/arrow-up.cjs +2 -0
  60. package/dist/icon/arrow-up.js +22 -0
  61. package/dist/icon/bell.cjs +1 -1
  62. package/dist/icon/bell.js +0 -2
  63. package/dist/icon/bold.cjs +2 -0
  64. package/dist/icon/bold.js +17 -0
  65. package/dist/icon/chart.cjs +1 -1
  66. package/dist/icon/chart.js +0 -2
  67. package/dist/icon/close-small.cjs +1 -1
  68. package/dist/icon/close-small.js +21 -11
  69. package/dist/icon/columns.cjs +1 -1
  70. package/dist/icon/columns.js +5 -17
  71. package/dist/icon/credit-card.cjs +1 -1
  72. package/dist/icon/credit-card.js +0 -2
  73. package/dist/icon/document.cjs +1 -1
  74. package/dist/icon/document.js +1 -6
  75. package/dist/icon/eraser.cjs +2 -0
  76. package/dist/icon/eraser.js +17 -0
  77. package/dist/icon/external-link.cjs +1 -1
  78. package/dist/icon/external-link.js +0 -2
  79. package/dist/icon/grid.cjs +1 -1
  80. package/dist/icon/grid.js +36 -36
  81. package/dist/icon/grip-vertical.cjs +1 -1
  82. package/dist/icon/grip-vertical.js +0 -2
  83. package/dist/icon/home.cjs +1 -1
  84. package/dist/icon/home.js +1 -3
  85. package/dist/icon/hourglass.cjs +1 -1
  86. package/dist/icon/hourglass.js +6 -1
  87. package/dist/icon/index.cjs +1 -1
  88. package/dist/icon/index.d.ts +29 -1
  89. package/dist/icon/index.js +176 -148
  90. package/dist/icon/italic.cjs +2 -0
  91. package/dist/icon/italic.js +36 -0
  92. package/dist/icon/link.cjs +2 -0
  93. package/dist/icon/link.js +17 -0
  94. package/dist/icon/list-ordered.cjs +2 -0
  95. package/dist/icon/list-ordered.js +24 -0
  96. package/dist/icon/list.cjs +2 -0
  97. package/dist/icon/list.js +54 -0
  98. package/dist/icon/loading.cjs +1 -1
  99. package/dist/icon/loading.js +7 -16
  100. package/dist/icon/maximize.cjs +1 -1
  101. package/dist/icon/maximize.js +2 -4
  102. package/dist/icon/menu.cjs +1 -1
  103. package/dist/icon/menu.js +4 -4
  104. package/dist/icon/minimize.cjs +1 -1
  105. package/dist/icon/minimize.js +0 -2
  106. package/dist/icon/paperclip.cjs +1 -1
  107. package/dist/icon/paperclip.js +1 -3
  108. package/dist/icon/phone.cjs +1 -1
  109. package/dist/icon/phone.js +1 -1
  110. package/dist/icon/pip.cjs +1 -1
  111. package/dist/icon/pip.js +15 -31
  112. package/dist/icon/project.cjs +1 -1
  113. package/dist/icon/project.js +1 -3
  114. package/dist/icon/repeat.cjs +1 -1
  115. package/dist/icon/repeat.js +4 -6
  116. package/dist/icon/send.cjs +1 -1
  117. package/dist/icon/send.js +6 -3
  118. package/dist/icon/settings.cjs +1 -1
  119. package/dist/icon/settings.js +2 -4
  120. package/dist/icon/shuffle.cjs +1 -1
  121. package/dist/icon/shuffle.js +0 -2
  122. package/dist/icon/skip-back.cjs +1 -1
  123. package/dist/icon/skip-back.js +0 -2
  124. package/dist/icon/skip-forward.cjs +1 -1
  125. package/dist/icon/skip-forward.js +1 -3
  126. package/dist/icon/square.cjs +1 -1
  127. package/dist/icon/square.js +13 -9
  128. package/dist/icon/star.cjs +1 -1
  129. package/dist/icon/star.js +0 -2
  130. package/dist/icon/strikethrough.cjs +2 -0
  131. package/dist/icon/strikethrough.js +26 -0
  132. package/dist/icon/thumb-down.cjs +1 -1
  133. package/dist/icon/thumb-down.js +1 -1
  134. package/dist/icon/underline.cjs +2 -0
  135. package/dist/icon/underline.js +22 -0
  136. package/dist/icon/unlink.cjs +2 -0
  137. package/dist/icon/unlink.js +44 -0
  138. package/dist/icons.cjs +1 -1
  139. package/dist/icons.js +90 -76
  140. package/dist/index.cjs +1 -1
  141. package/dist/index.js +257 -243
  142. package/dist/llms-full.txt +11 -2
  143. package/dist/llms.txt +1 -1
  144. package/dist/locales/en/components.json +3 -1
  145. package/dist/locales/ja/components.json +3 -1
  146. package/dist/locales/pt/components.json +3 -1
  147. package/dist/reset.css +1 -1
  148. package/dist/styles.css +2 -2
  149. package/dist/wimui.umd.css +1 -1
  150. package/dist/wimui.umd.js +5 -5
  151. package/package.json +7 -2
@@ -1,226 +1,26 @@
1
1
  "use client";
2
2
  import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
3
- import { Button as t } from "../Button/Button.js";
4
- import { FieldTemplate as n } from "../FieldTemplate/FieldTemplate.js";
5
- import { Input as r } from "../Input/Input.js";
6
- import { Dialog as i, DialogClose as a, DialogContent as ee, DialogFooter as te, DialogHeader as ne, DialogTitle as re } from "../../overlay/Dialog/Dialog.js";
7
- import { createLink as ie, getActiveFormats as ae, getEditorRange as oe, removeAllFormatting as se, removeLink as ce, setBlock as o, toggleInline as s, toggleList as c } from "./commands.js";
8
- import l from "./rich-text-editor.module.js";
9
- import u from "react";
10
- import d from "classnames";
11
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
3
+ import t from "../../../icon/bold.js";
4
+ import n from "../../../icon/eraser.js";
5
+ import r from "../../../icon/italic.js";
6
+ import i from "../../../icon/link.js";
7
+ import a from "../../../icon/list-ordered.js";
8
+ import ee from "../../../icon/list.js";
9
+ import te from "../../../icon/strikethrough.js";
10
+ import ne from "../../../icon/underline.js";
11
+ import re from "../../../icon/unlink.js";
12
+ import { Icon as o } from "../../media/Icon/Icon.js";
13
+ import { Button as s } from "../Button/Button.js";
14
+ import { FieldTemplate as c } from "../FieldTemplate/FieldTemplate.js";
15
+ import { Input as ie } from "../Input/Input.js";
16
+ import { Dialog as ae, DialogClose as oe, DialogContent as se, DialogFooter as ce, DialogHeader as le, DialogTitle as ue } from "../../overlay/Dialog/Dialog.js";
17
+ import { createLink as de, getActiveFormats as fe, getEditorRange as pe, removeAllFormatting as me, removeLink as he, setBlock as l, toggleInline as u, toggleList as ge } from "./commands.js";
18
+ import d from "./rich-text-editor.module.js";
19
+ import f from "react";
20
+ import _e from "classnames";
21
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
12
22
  //#region src/components/form/RichTextEditor/RichTextEditor.tsx
13
- var le = () => /* @__PURE__ */ p("svg", {
14
- viewBox: "0 0 24 24",
15
- fill: "none",
16
- stroke: "currentColor",
17
- strokeWidth: "2.5",
18
- "aria-hidden": "true",
19
- children: [/* @__PURE__ */ f("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }), /* @__PURE__ */ f("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })]
20
- }), ue = () => /* @__PURE__ */ p("svg", {
21
- viewBox: "0 0 24 24",
22
- fill: "none",
23
- stroke: "currentColor",
24
- strokeWidth: "2.5",
25
- "aria-hidden": "true",
26
- children: [
27
- /* @__PURE__ */ f("line", {
28
- x1: "19",
29
- y1: "4",
30
- x2: "10",
31
- y2: "4"
32
- }),
33
- /* @__PURE__ */ f("line", {
34
- x1: "14",
35
- y1: "20",
36
- x2: "5",
37
- y2: "20"
38
- }),
39
- /* @__PURE__ */ f("line", {
40
- x1: "15",
41
- y1: "4",
42
- x2: "9",
43
- y2: "20"
44
- })
45
- ]
46
- }), de = () => /* @__PURE__ */ p("svg", {
47
- viewBox: "0 0 24 24",
48
- fill: "none",
49
- stroke: "currentColor",
50
- strokeWidth: "2.5",
51
- "aria-hidden": "true",
52
- children: [/* @__PURE__ */ f("path", { d: "M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3" }), /* @__PURE__ */ f("line", {
53
- x1: "4",
54
- y1: "21",
55
- x2: "20",
56
- y2: "21"
57
- })]
58
- }), fe = () => /* @__PURE__ */ p("svg", {
59
- viewBox: "0 0 24 24",
60
- fill: "none",
61
- stroke: "currentColor",
62
- strokeWidth: "2.5",
63
- "aria-hidden": "true",
64
- children: [/* @__PURE__ */ f("path", { d: "M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" }), /* @__PURE__ */ f("line", {
65
- x1: "4",
66
- y1: "12",
67
- x2: "20",
68
- y2: "12"
69
- })]
70
- }), pe = () => /* @__PURE__ */ p("svg", {
71
- viewBox: "0 0 24 24",
72
- fill: "none",
73
- stroke: "currentColor",
74
- strokeWidth: "2",
75
- "aria-hidden": "true",
76
- children: [
77
- /* @__PURE__ */ f("line", {
78
- x1: "9",
79
- y1: "6",
80
- x2: "20",
81
- y2: "6"
82
- }),
83
- /* @__PURE__ */ f("line", {
84
- x1: "9",
85
- y1: "12",
86
- x2: "20",
87
- y2: "12"
88
- }),
89
- /* @__PURE__ */ f("line", {
90
- x1: "9",
91
- y1: "18",
92
- x2: "20",
93
- y2: "18"
94
- }),
95
- /* @__PURE__ */ f("circle", {
96
- cx: "4",
97
- cy: "6",
98
- r: "1.5",
99
- fill: "currentColor",
100
- stroke: "none"
101
- }),
102
- /* @__PURE__ */ f("circle", {
103
- cx: "4",
104
- cy: "12",
105
- r: "1.5",
106
- fill: "currentColor",
107
- stroke: "none"
108
- }),
109
- /* @__PURE__ */ f("circle", {
110
- cx: "4",
111
- cy: "18",
112
- r: "1.5",
113
- fill: "currentColor",
114
- stroke: "none"
115
- })
116
- ]
117
- }), me = () => /* @__PURE__ */ p("svg", {
118
- viewBox: "0 0 24 24",
119
- fill: "none",
120
- stroke: "currentColor",
121
- strokeWidth: "2",
122
- "aria-hidden": "true",
123
- children: [
124
- /* @__PURE__ */ f("line", {
125
- x1: "10",
126
- y1: "6",
127
- x2: "21",
128
- y2: "6"
129
- }),
130
- /* @__PURE__ */ f("line", {
131
- x1: "10",
132
- y1: "12",
133
- x2: "21",
134
- y2: "12"
135
- }),
136
- /* @__PURE__ */ f("line", {
137
- x1: "10",
138
- y1: "18",
139
- x2: "21",
140
- y2: "18"
141
- }),
142
- /* @__PURE__ */ f("text", {
143
- x: "1",
144
- y: "8",
145
- fontSize: "7",
146
- fill: "currentColor",
147
- stroke: "none",
148
- fontWeight: "bold",
149
- children: "1."
150
- }),
151
- /* @__PURE__ */ f("text", {
152
- x: "1",
153
- y: "14",
154
- fontSize: "7",
155
- fill: "currentColor",
156
- stroke: "none",
157
- fontWeight: "bold",
158
- children: "2."
159
- }),
160
- /* @__PURE__ */ f("text", {
161
- x: "1",
162
- y: "20",
163
- fontSize: "7",
164
- fill: "currentColor",
165
- stroke: "none",
166
- fontWeight: "bold",
167
- children: "3."
168
- })
169
- ]
170
- }), he = () => /* @__PURE__ */ p("svg", {
171
- viewBox: "0 0 24 24",
172
- fill: "none",
173
- stroke: "currentColor",
174
- strokeWidth: "2",
175
- "aria-hidden": "true",
176
- children: [/* @__PURE__ */ f("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ f("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })]
177
- }), ge = () => /* @__PURE__ */ p("svg", {
178
- viewBox: "0 0 24 24",
179
- fill: "none",
180
- stroke: "currentColor",
181
- strokeWidth: "2",
182
- "aria-hidden": "true",
183
- children: [
184
- /* @__PURE__ */ f("path", { d: "M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.72" }),
185
- /* @__PURE__ */ f("path", { d: "M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" }),
186
- /* @__PURE__ */ f("line", {
187
- x1: "8",
188
- y1: "2",
189
- x2: "8",
190
- y2: "5"
191
- }),
192
- /* @__PURE__ */ f("line", {
193
- x1: "2",
194
- y1: "8",
195
- x2: "5",
196
- y2: "8"
197
- }),
198
- /* @__PURE__ */ f("line", {
199
- x1: "16",
200
- y1: "19",
201
- x2: "16",
202
- y2: "22"
203
- }),
204
- /* @__PURE__ */ f("line", {
205
- x1: "19",
206
- y1: "16",
207
- x2: "22",
208
- y2: "16"
209
- })
210
- ]
211
- }), _e = () => /* @__PURE__ */ p("svg", {
212
- viewBox: "0 0 24 24",
213
- fill: "none",
214
- stroke: "currentColor",
215
- strokeWidth: "2",
216
- "aria-hidden": "true",
217
- children: [/* @__PURE__ */ f("path", { d: "M20 20H7L3 16l10-10 7 7-3.5 3.5" }), /* @__PURE__ */ f("line", {
218
- x1: "6",
219
- y1: "7",
220
- x2: "17",
221
- y2: "18"
222
- })]
223
- }), ve = [
23
+ var ve = [
224
24
  "bold",
225
25
  "italic",
226
26
  "underline",
@@ -237,9 +37,9 @@ var le = () => /* @__PURE__ */ p("svg", {
237
37
  "unlink",
238
38
  "separator",
239
39
  "removeFormat"
240
- ], m = u.memo(({ onClick: e, active: t, disabled: n, title: r, children: i }) => /* @__PURE__ */ f("button", {
40
+ ], h = f.memo(({ onClick: e, active: t, disabled: n, title: r, children: i }) => /* @__PURE__ */ p("button", {
241
41
  type: "button",
242
- className: d(l.toolbarBtn, t && l.active),
42
+ className: _e(d.toolbarBtn, t && d.active),
243
43
  onClick: e,
244
44
  disabled: n,
245
45
  title: r,
@@ -248,294 +48,321 @@ var le = () => /* @__PURE__ */ p("svg", {
248
48
  tabIndex: -1,
249
49
  children: i
250
50
  }));
251
- m.displayName = "ToolbarButton";
252
- var h = ({ value: h, defaultValue: ye = "", onChange: g, placeholder: be, disabled: xe, intent: Se = "default", variant: Ce = "outline", fullWidth: _ = !1, width: v, minHeight: y = 200, label: b, error: x, required: S, layout: we, className: Te, id: Ee, toolbar: De = ve, labels: Oe = {}, "aria-label": ke, "aria-labelledby": C }) => {
253
- let { t: w } = e("components"), { bold: T = w("a11y.rte_bold"), italic: E = w("a11y.rte_italic"), underline: D = w("a11y.rte_underline"), strikethrough: O = w("a11y.rte_strikethrough"), h1: k = w("a11y.rte_h1"), h2: A = w("a11y.rte_h2"), h3: j = w("a11y.rte_h3"), ul: M = w("a11y.rte_ul"), ol: Ae = w("a11y.rte_ol"), link: N = w("a11y.rte_link"), unlink: je = w("a11y.rte_unlink"), removeFormat: Me = w("a11y.rte_remove_format"), toolbar: Ne = w("a11y.rte_toolbar"), linkPrompt: Pe = w("a11y.rte_link_prompt"), linkApply: Fe = w("a11y.rte_link_apply"), linkCancel: Ie = w("a11y.rte_link_cancel") } = Oe, P = u.useRef(null), F = u.useRef(!1), I = u.useRef(h ?? ye), [L, Le] = u.useState(/* @__PURE__ */ new Set()), Re = u.useId(), R = Ee || `wim-rte-${Re}`, ze = x ? `${R}-error` : void 0, Be = b ? `${R}-label` : void 0, z = xe, Ve = x ? "danger" : Se, He = typeof v == "string" && [
51
+ h.displayName = "ToolbarButton";
52
+ var g = ({ value: g, defaultValue: ye = "", onChange: _, placeholder: be, disabled: xe, intent: Se = "default", variant: Ce = "outline", fullWidth: v = !1, width: y, minHeight: b = 200, label: x, error: S, required: C, layout: we, className: Te, id: Ee, toolbar: De = ve, labels: Oe = {}, "aria-label": ke, "aria-labelledby": w }) => {
53
+ let { t: T } = e("components"), { bold: E = T("a11y.rte_bold"), italic: D = T("a11y.rte_italic"), underline: O = T("a11y.rte_underline"), strikethrough: k = T("a11y.rte_strikethrough"), h1: A = T("a11y.rte_h1"), h2: j = T("a11y.rte_h2"), h3: Ae = T("a11y.rte_h3"), ul: je = T("a11y.rte_ul"), ol: Me = T("a11y.rte_ol"), link: M = T("a11y.rte_link"), unlink: Ne = T("a11y.rte_unlink"), removeFormat: Pe = T("a11y.rte_remove_format"), toolbar: Fe = T("a11y.rte_toolbar"), linkPrompt: Ie = T("a11y.rte_link_prompt"), linkApply: Le = T("a11y.rte_link_apply"), linkCancel: Re = T("a11y.rte_link_cancel") } = Oe, N = f.useRef(null), P = f.useRef(!1), F = f.useRef(g ?? ye), [I, ze] = f.useState(/* @__PURE__ */ new Set()), Be = f.useId(), L = Ee || `wim-rte-${Be}`, Ve = S ? `${L}-error` : void 0, He = x ? `${L}-label` : void 0, R = xe, Ue = S ? "danger" : Se, We = typeof y == "string" && [
254
54
  "xs",
255
55
  "sm",
256
56
  "md",
257
57
  "lg",
258
58
  "xl"
259
- ].includes(v), Ue = v !== void 0 && !He && !_, B = He && !_ ? v : void 0, We = B ? l[`width${B.charAt(0).toUpperCase()}${B.slice(1)}`] : void 0, V = u.useRef(h === void 0 ? ye : h), H = u.useCallback(() => {
260
- P.current && Le(ae(P.current));
261
- }, []), U = u.useRef([]), W = u.useRef(-1), G = u.useRef(void 0), K = u.useCallback((e) => {
262
- let t = U.current, n = W.current;
59
+ ].includes(y), Ge = y !== void 0 && !We && !v, z = We && !v ? y : void 0, Ke = z ? d[`width${z.charAt(0).toUpperCase()}${z.slice(1)}`] : void 0, B = f.useRef(g === void 0 ? ye : g), V = f.useCallback(() => {
60
+ N.current && ze(fe(N.current));
61
+ }, []), H = f.useRef([]), U = f.useRef(-1), W = f.useRef(void 0), G = f.useCallback((e) => {
62
+ let t = H.current, n = U.current;
263
63
  if (t[n] === e) return;
264
64
  let r = [...t.slice(0, n + 1), e];
265
- r.length > 100 && (r = r.slice(1)), U.current = r, W.current = r.length - 1;
266
- }, []), q = u.useCallback(() => {
267
- G.current !== void 0 && (clearTimeout(G.current), G.current = void 0, K(I.current));
268
- }, [K]), J = u.useCallback((e) => {
269
- q();
270
- let t = U.current, n = W.current + e;
271
- if (n < 0 || n >= t.length || !P.current) return;
272
- W.current = n;
65
+ r.length > 100 && (r = r.slice(1)), H.current = r, U.current = r.length - 1;
66
+ }, []), K = f.useCallback(() => {
67
+ W.current !== void 0 && (clearTimeout(W.current), W.current = void 0, G(F.current));
68
+ }, [G]), q = f.useCallback((e) => {
69
+ K();
70
+ let t = H.current, n = U.current + e;
71
+ if (n < 0 || n >= t.length || !N.current) return;
72
+ U.current = n;
273
73
  let r = t[n];
274
- P.current.innerHTML = r, I.current = r, g?.(r);
74
+ N.current.innerHTML = r, F.current = r, _?.(r);
275
75
  let i = document.createRange();
276
- i.selectNodeContents(P.current), i.collapse(!1);
76
+ i.selectNodeContents(N.current), i.collapse(!1);
277
77
  let a = window.getSelection();
278
- a?.removeAllRanges(), a?.addRange(i), H();
78
+ a?.removeAllRanges(), a?.addRange(i), V();
279
79
  }, [
280
- q,
281
- g,
282
- H
283
- ]), Y = u.useCallback((e) => {
284
- if (z || !P.current) return;
285
- let t = P.current, n = oe(t)?.cloneRange() ?? null;
80
+ K,
81
+ _,
82
+ V
83
+ ]), J = f.useCallback((e) => {
84
+ if (R || !N.current) return;
85
+ let t = N.current, n = pe(t)?.cloneRange() ?? null;
286
86
  if (t.focus(), n) {
287
87
  let e = window.getSelection();
288
88
  e?.removeAllRanges(), e?.addRange(n);
289
89
  }
290
- q(), K(t.innerHTML), e(t), H();
90
+ K(), G(t.innerHTML), e(t), V();
291
91
  let r = t.innerHTML;
292
- I.current = r, K(r), g?.(r);
92
+ F.current = r, G(r), _?.(r);
293
93
  }, [
294
- z,
295
- q,
94
+ R,
296
95
  K,
297
- g,
298
- H
299
- ]), Ge = u.useCallback(() => {
300
- Y((e) => se(e));
301
- }, [Y]), [Ke, X] = u.useState(!1), [Z, qe] = u.useState("https://"), Q = u.useRef(null), Je = u.useCallback(() => {
302
- if (z || !P.current) return;
303
- P.current.focus();
304
- let e = oe(P.current);
305
- Q.current = e ? e.cloneRange() : null;
96
+ G,
97
+ _,
98
+ V
99
+ ]), qe = f.useCallback(() => {
100
+ J((e) => me(e));
101
+ }, [J]), [Je, Y] = f.useState(!1), [X, Ye] = f.useState("https://"), Z = f.useRef(null), Q = f.useCallback(() => {
102
+ if (R || !N.current) return;
103
+ N.current.focus();
104
+ let e = pe(N.current);
105
+ Z.current = e ? e.cloneRange() : null;
306
106
  let t = e?.toString() ?? "";
307
- qe(t.startsWith("http") ? t : "https://"), X(!0);
308
- }, [z]), Ye = u.useCallback(() => {
309
- let e = Z.trim();
310
- if (X(!1), !e || !P.current) return;
107
+ Ye(t.startsWith("http") ? t : "https://"), Y(!0);
108
+ }, [R]), Xe = f.useCallback(() => {
109
+ let e = X.trim();
110
+ if (Y(!1), !e || !N.current) return;
311
111
  let t = window.getSelection();
312
- if (t?.removeAllRanges(), Q.current) t?.addRange(Q.current);
112
+ if (t?.removeAllRanges(), Z.current) t?.addRange(Z.current);
313
113
  else {
314
114
  let e = document.createRange();
315
- e.selectNodeContents(P.current), e.collapse(!1), t?.addRange(e);
115
+ e.selectNodeContents(N.current), e.collapse(!1), t?.addRange(e);
316
116
  }
317
- Y((t) => ie(t, e));
318
- }, [Z, Y]), $ = u.useCallback(() => {
319
- if (F.current) return;
320
- let e = P.current?.innerHTML ?? "";
321
- e !== I.current && (I.current = e, g?.(e), G.current !== void 0 && clearTimeout(G.current), G.current = setTimeout(() => {
322
- G.current = void 0, K(I.current);
323
- }, 400)), H();
117
+ J((t) => de(t, e));
118
+ }, [X, J]), $ = f.useCallback(() => {
119
+ if (P.current) return;
120
+ let e = N.current?.innerHTML ?? "";
121
+ e !== F.current && (F.current = e, _?.(e), W.current !== void 0 && clearTimeout(W.current), W.current = setTimeout(() => {
122
+ W.current = void 0, G(F.current);
123
+ }, 400)), V();
324
124
  }, [
325
- g,
326
- K,
327
- H
328
- ]), Xe = u.useCallback((e) => {
125
+ _,
126
+ G,
127
+ V
128
+ ]), Ze = f.useCallback((e) => {
329
129
  let t = e.nativeEvent.inputType;
330
- t === "historyUndo" ? (e.preventDefault(), J(-1)) : t === "historyRedo" && (e.preventDefault(), J(1));
331
- }, [J]), Ze = u.useCallback((e) => {
130
+ t === "historyUndo" ? (e.preventDefault(), q(-1)) : t === "historyRedo" && (e.preventDefault(), q(1));
131
+ }, [q]), Qe = f.useCallback((e) => {
332
132
  if (!(e.ctrlKey || e.metaKey)) return;
333
133
  let t = e.key.toLowerCase();
334
- t === "z" ? (e.preventDefault(), J(e.shiftKey ? 1 : -1)) : t === "y" && (e.preventDefault(), J(1));
335
- }, [J]), Qe = u.useCallback(() => {
336
- H();
337
- }, [H]), $e = u.useCallback(() => {
338
- H();
339
- }, [H]), et = u.useCallback(() => {
340
- F.current = !0;
341
- }, []), tt = u.useCallback(() => {
342
- F.current = !1, $();
343
- }, [$]), nt = u.useCallback((e) => {
134
+ t === "z" ? (e.preventDefault(), q(e.shiftKey ? 1 : -1)) : t === "y" && (e.preventDefault(), q(1));
135
+ }, [q]), $e = f.useCallback(() => {
136
+ V();
137
+ }, [V]), et = f.useCallback(() => {
138
+ V();
139
+ }, [V]), tt = f.useCallback(() => {
140
+ P.current = !0;
141
+ }, []), nt = f.useCallback(() => {
142
+ P.current = !1, $();
143
+ }, [$]), rt = f.useCallback((e) => {
344
144
  e.preventDefault();
345
145
  }, []);
346
- u.useEffect(() => {
347
- P.current && (P.current.innerHTML = V.current, I.current = V.current, U.current = [V.current], W.current = 0);
348
- }, []), u.useEffect(() => {
349
- h !== void 0 && P.current && P.current.innerHTML !== h && (P.current.innerHTML = h, I.current = h);
350
- }, [h]);
351
- let rt = u.useCallback((e, t) => {
352
- if (e === "separator") return /* @__PURE__ */ f("span", {
353
- className: l.toolbarSep,
146
+ f.useEffect(() => {
147
+ N.current && (N.current.innerHTML = B.current, F.current = B.current, H.current = [B.current], U.current = 0);
148
+ }, []), f.useEffect(() => {
149
+ g !== void 0 && N.current && N.current.innerHTML !== g && (N.current.innerHTML = g, F.current = g);
150
+ }, [g]);
151
+ let it = f.useCallback((e, s) => {
152
+ if (e === "separator") return /* @__PURE__ */ p("span", {
153
+ className: d.toolbarSep,
354
154
  "aria-hidden": "true"
355
- }, `sep-${t}`);
356
- let n = {
357
- disabled: z,
358
- active: L.has(e)
155
+ }, `sep-${s}`);
156
+ let c = {
157
+ disabled: R,
158
+ active: I.has(e)
359
159
  };
360
160
  switch (e) {
361
- case "bold": return /* @__PURE__ */ f(m, {
362
- ...n,
363
- title: T,
364
- onClick: () => Y((e) => s(e, "bold")),
365
- children: /* @__PURE__ */ f(le, {})
366
- }, "bold");
367
- case "italic": return /* @__PURE__ */ f(m, {
368
- ...n,
161
+ case "bold": return /* @__PURE__ */ p(h, {
162
+ ...c,
369
163
  title: E,
370
- onClick: () => Y((e) => s(e, "italic")),
371
- children: /* @__PURE__ */ f(ue, {})
372
- }, "italic");
373
- case "underline": return /* @__PURE__ */ f(m, {
374
- ...n,
164
+ onClick: () => J((e) => u(e, "bold")),
165
+ children: /* @__PURE__ */ p(o, {
166
+ component: t,
167
+ size: "sm"
168
+ })
169
+ }, "bold");
170
+ case "italic": return /* @__PURE__ */ p(h, {
171
+ ...c,
375
172
  title: D,
376
- onClick: () => Y((e) => s(e, "underline")),
377
- children: /* @__PURE__ */ f(de, {})
378
- }, "underline");
379
- case "strikethrough": return /* @__PURE__ */ f(m, {
380
- ...n,
173
+ onClick: () => J((e) => u(e, "italic")),
174
+ children: /* @__PURE__ */ p(o, {
175
+ component: r,
176
+ size: "sm"
177
+ })
178
+ }, "italic");
179
+ case "underline": return /* @__PURE__ */ p(h, {
180
+ ...c,
381
181
  title: O,
382
- onClick: () => Y((e) => s(e, "strikethrough")),
383
- children: /* @__PURE__ */ f(fe, {})
384
- }, "strikethrough");
385
- case "h1": return /* @__PURE__ */ f(m, {
386
- ...n,
387
- active: L.has("h1"),
182
+ onClick: () => J((e) => u(e, "underline")),
183
+ children: /* @__PURE__ */ p(o, {
184
+ component: ne,
185
+ size: "sm"
186
+ })
187
+ }, "underline");
188
+ case "strikethrough": return /* @__PURE__ */ p(h, {
189
+ ...c,
388
190
  title: k,
389
- onClick: () => Y((e) => o(e, "h1")),
390
- children: /* @__PURE__ */ f("span", {
191
+ onClick: () => J((e) => u(e, "strikethrough")),
192
+ children: /* @__PURE__ */ p(o, {
193
+ component: te,
194
+ size: "sm"
195
+ })
196
+ }, "strikethrough");
197
+ case "h1": return /* @__PURE__ */ p(h, {
198
+ ...c,
199
+ active: I.has("h1"),
200
+ title: A,
201
+ onClick: () => J((e) => l(e, "h1")),
202
+ children: /* @__PURE__ */ p("span", {
391
203
  "aria-hidden": "true",
392
204
  children: "H1"
393
205
  })
394
206
  }, "h1");
395
- case "h2": return /* @__PURE__ */ f(m, {
396
- ...n,
397
- active: L.has("h2"),
398
- title: A,
399
- onClick: () => Y((e) => o(e, "h2")),
400
- children: /* @__PURE__ */ f("span", {
207
+ case "h2": return /* @__PURE__ */ p(h, {
208
+ ...c,
209
+ active: I.has("h2"),
210
+ title: j,
211
+ onClick: () => J((e) => l(e, "h2")),
212
+ children: /* @__PURE__ */ p("span", {
401
213
  "aria-hidden": "true",
402
214
  children: "H2"
403
215
  })
404
216
  }, "h2");
405
- case "h3": return /* @__PURE__ */ f(m, {
406
- ...n,
407
- active: L.has("h3"),
408
- title: j,
409
- onClick: () => Y((e) => o(e, "h3")),
410
- children: /* @__PURE__ */ f("span", {
217
+ case "h3": return /* @__PURE__ */ p(h, {
218
+ ...c,
219
+ active: I.has("h3"),
220
+ title: Ae,
221
+ onClick: () => J((e) => l(e, "h3")),
222
+ children: /* @__PURE__ */ p("span", {
411
223
  "aria-hidden": "true",
412
224
  children: "H3"
413
225
  })
414
226
  }, "h3");
415
- case "ul": return /* @__PURE__ */ f(m, {
416
- ...n,
417
- title: M,
418
- onClick: () => Y((e) => c(e, "ul")),
419
- children: /* @__PURE__ */ f(pe, {})
227
+ case "ul": return /* @__PURE__ */ p(h, {
228
+ ...c,
229
+ title: je,
230
+ onClick: () => J((e) => ge(e, "ul")),
231
+ children: /* @__PURE__ */ p(o, {
232
+ component: ee,
233
+ size: "sm"
234
+ })
420
235
  }, "ul");
421
- case "ol": return /* @__PURE__ */ f(m, {
422
- ...n,
423
- title: Ae,
424
- onClick: () => Y((e) => c(e, "ol")),
425
- children: /* @__PURE__ */ f(me, {})
236
+ case "ol": return /* @__PURE__ */ p(h, {
237
+ ...c,
238
+ title: Me,
239
+ onClick: () => J((e) => ge(e, "ol")),
240
+ children: /* @__PURE__ */ p(o, {
241
+ component: a,
242
+ size: "sm"
243
+ })
426
244
  }, "ol");
427
- case "link": return /* @__PURE__ */ f(m, {
428
- ...n,
429
- title: N,
430
- onClick: Je,
431
- children: /* @__PURE__ */ f(he, {})
245
+ case "link": return /* @__PURE__ */ p(h, {
246
+ ...c,
247
+ title: M,
248
+ onClick: Q,
249
+ children: /* @__PURE__ */ p(o, {
250
+ component: i,
251
+ size: "sm"
252
+ })
432
253
  }, "link");
433
- case "unlink": return /* @__PURE__ */ f(m, {
434
- ...n,
435
- title: je,
436
- onClick: () => Y((e) => ce(e)),
437
- children: /* @__PURE__ */ f(ge, {})
254
+ case "unlink": return /* @__PURE__ */ p(h, {
255
+ ...c,
256
+ title: Ne,
257
+ onClick: () => J((e) => he(e)),
258
+ children: /* @__PURE__ */ p(o, {
259
+ component: re,
260
+ size: "sm"
261
+ })
438
262
  }, "unlink");
439
- case "removeFormat": return /* @__PURE__ */ f(m, {
440
- ...n,
441
- title: Me,
442
- onClick: Ge,
443
- children: /* @__PURE__ */ f(_e, {})
263
+ case "removeFormat": return /* @__PURE__ */ p(h, {
264
+ ...c,
265
+ title: Pe,
266
+ onClick: qe,
267
+ children: /* @__PURE__ */ p(o, {
268
+ component: n,
269
+ size: "sm"
270
+ })
444
271
  }, "removeFormat");
445
272
  default: return null;
446
273
  }
447
274
  }, [
448
- L,
449
- z,
450
- T,
275
+ I,
276
+ R,
451
277
  E,
452
278
  D,
453
279
  O,
454
280
  k,
455
281
  A,
456
282
  j,
457
- M,
458
283
  Ae,
459
- N,
460
284
  je,
461
285
  Me,
462
- Y,
463
- Je,
464
- Ge
286
+ M,
287
+ Ne,
288
+ Pe,
289
+ J,
290
+ Q,
291
+ qe
465
292
  ]);
466
- return /* @__PURE__ */ f(n, {
467
- label: b,
468
- error: x,
469
- required: S,
293
+ return /* @__PURE__ */ p(c, {
294
+ label: x,
295
+ error: S,
296
+ required: C,
470
297
  layout: we,
471
- labelId: Be,
472
- errorId: ze,
298
+ labelId: He,
299
+ errorId: Ve,
473
300
  className: Te,
474
- children: /* @__PURE__ */ p("div", {
475
- className: d("wim-rich-text-editor", l.root, l[Ve], z && l.disabled, l[Ce], _ && l.fullWidth, Ue && l.hasCustomWidth, We),
476
- style: Ue ? { "--wim-input-width": typeof v == "number" ? `${v}px` : v } : void 0,
301
+ children: /* @__PURE__ */ m("div", {
302
+ className: _e("wim-rich-text-editor", d.root, d[Ue], R && d.disabled, d[Ce], v && d.fullWidth, Ge && d.hasCustomWidth, Ke),
303
+ style: Ge ? { "--wim-input-width": typeof y == "number" ? `${y}px` : y } : void 0,
477
304
  children: [
478
- /* @__PURE__ */ f("div", {
479
- className: l.toolbar,
305
+ /* @__PURE__ */ p("div", {
306
+ className: d.toolbar,
480
307
  role: "toolbar",
481
- "aria-label": Ne,
482
- "aria-controls": R,
483
- onMouseDown: nt,
484
- children: De.map((e, t) => rt(e, t))
308
+ "aria-label": Fe,
309
+ "aria-controls": L,
310
+ onMouseDown: rt,
311
+ children: De.map((e, t) => it(e, t))
485
312
  }),
486
- /* @__PURE__ */ f("div", {
487
- ref: P,
488
- id: R,
489
- className: l.content,
490
- contentEditable: !z,
313
+ /* @__PURE__ */ p("div", {
314
+ ref: N,
315
+ id: L,
316
+ className: d.content,
317
+ contentEditable: !R,
491
318
  suppressContentEditableWarning: !0,
492
319
  role: "textbox",
493
320
  "aria-multiline": !0,
494
- "aria-label": ke ?? (b || C ? void 0 : w("a11y.rte_editor")),
495
- "aria-labelledby": C ?? (b ? Be : void 0),
496
- "aria-invalid": Ve === "danger",
497
- "aria-describedby": ze,
498
- "aria-required": S,
499
- "aria-disabled": z,
321
+ "aria-label": ke ?? (x || w ? void 0 : T("a11y.rte_editor")),
322
+ "aria-labelledby": w ?? (x ? He : void 0),
323
+ "aria-invalid": Ue === "danger",
324
+ "aria-describedby": Ve,
325
+ "aria-required": C,
326
+ "aria-disabled": R,
500
327
  "aria-placeholder": be,
501
328
  "data-placeholder": be,
502
- tabIndex: z ? -1 : 0,
329
+ tabIndex: R ? -1 : 0,
503
330
  style: {
504
- minHeight: typeof y == "number" ? `${y}px` : y,
331
+ minHeight: typeof b == "number" ? `${b}px` : b,
505
332
  outline: "none"
506
333
  },
507
334
  onInput: $,
508
- onBeforeInput: Xe,
509
- onKeyDown: Ze,
510
- onKeyUp: Qe,
511
- onMouseUp: $e,
512
- onCompositionStart: et,
513
- onCompositionEnd: tt
335
+ onBeforeInput: Ze,
336
+ onKeyDown: Qe,
337
+ onKeyUp: $e,
338
+ onMouseUp: et,
339
+ onCompositionStart: tt,
340
+ onCompositionEnd: nt
514
341
  }),
515
- /* @__PURE__ */ f(i, {
516
- open: Ke,
517
- onOpenChange: X,
518
- children: /* @__PURE__ */ p(ee, { children: [/* @__PURE__ */ f(ne, { children: /* @__PURE__ */ f(re, { children: N }) }), /* @__PURE__ */ p("form", {
342
+ /* @__PURE__ */ p(ae, {
343
+ open: Je,
344
+ onOpenChange: Y,
345
+ children: /* @__PURE__ */ m(se, { children: [/* @__PURE__ */ p(le, { children: /* @__PURE__ */ p(ue, { children: M }) }), /* @__PURE__ */ m("form", {
519
346
  onSubmit: (e) => {
520
- e.preventDefault(), Ye();
347
+ e.preventDefault(), Xe();
521
348
  },
522
- children: [/* @__PURE__ */ f(r, {
523
- label: Pe,
349
+ children: [/* @__PURE__ */ p(ie, {
350
+ label: Ie,
524
351
  type: "url",
525
- value: Z,
526
- onChange: (e) => qe(e.target.value),
352
+ value: X,
353
+ onChange: (e) => Ye(e.target.value),
527
354
  fullWidth: !0
528
- }), /* @__PURE__ */ p(te, { children: [/* @__PURE__ */ f(a, {
355
+ }), /* @__PURE__ */ m(ce, { children: [/* @__PURE__ */ p(oe, {
529
356
  asChild: !0,
530
- children: /* @__PURE__ */ f(t, {
357
+ children: /* @__PURE__ */ p(s, {
531
358
  variant: "ghost",
532
359
  type: "button",
533
- children: Ie
360
+ children: Re
534
361
  })
535
- }), /* @__PURE__ */ f(t, {
362
+ }), /* @__PURE__ */ p(s, {
536
363
  variant: "solid",
537
364
  type: "submit",
538
- children: Fe
365
+ children: Le
539
366
  })] })]
540
367
  })] })
541
368
  })
@@ -543,6 +370,6 @@ var h = ({ value: h, defaultValue: ye = "", onChange: g, placeholder: be, disabl
543
370
  })
544
371
  });
545
372
  };
546
- h.displayName = "RichTextEditor";
373
+ g.displayName = "RichTextEditor";
547
374
  //#endregion
548
- export { h as RichTextEditor };
375
+ export { g as RichTextEditor };