@forgedevstack/bear 1.0.5 → 1.0.7

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 (183) hide show
  1. package/dist/components/BottomSheet/BottomSheet.cjs +1 -0
  2. package/dist/components/BottomSheet/BottomSheet.d.ts +3 -0
  3. package/dist/components/BottomSheet/BottomSheet.js +102 -0
  4. package/dist/components/BottomSheet/BottomSheet.types.d.ts +13 -0
  5. package/dist/components/BottomSheet/index.d.ts +2 -0
  6. package/dist/components/Button/Button.cjs +1 -1
  7. package/dist/components/Button/Button.js +40 -38
  8. package/dist/components/Button/Button.types.d.ts +4 -0
  9. package/dist/components/Calendar/Calendar.cjs +1 -1
  10. package/dist/components/Calendar/Calendar.const.cjs +1 -1
  11. package/dist/components/Calendar/Calendar.const.d.ts +1 -0
  12. package/dist/components/Calendar/Calendar.const.js +6 -5
  13. package/dist/components/Calendar/Calendar.helpers.cjs +1 -1
  14. package/dist/components/Calendar/Calendar.helpers.js +4 -4
  15. package/dist/components/Calendar/Calendar.js +128 -128
  16. package/dist/components/Cascader/Cascader.cjs +1 -0
  17. package/dist/components/Cascader/Cascader.const.cjs +1 -0
  18. package/dist/components/Cascader/Cascader.const.d.ts +33 -0
  19. package/dist/components/Cascader/Cascader.const.js +21 -0
  20. package/dist/components/Cascader/Cascader.d.ts +17 -0
  21. package/dist/components/Cascader/Cascader.js +227 -0
  22. package/dist/components/Cascader/Cascader.types.d.ts +94 -0
  23. package/dist/components/Cascader/index.d.ts +2 -0
  24. package/dist/components/CommandPalette/CommandPalette.cjs +1 -0
  25. package/dist/components/CommandPalette/CommandPalette.const.cjs +1 -0
  26. package/dist/components/CommandPalette/CommandPalette.const.d.ts +25 -0
  27. package/dist/components/CommandPalette/CommandPalette.const.js +13 -0
  28. package/dist/components/CommandPalette/CommandPalette.d.ts +18 -0
  29. package/dist/components/CommandPalette/CommandPalette.js +190 -0
  30. package/dist/components/CommandPalette/CommandPalette.types.d.ts +90 -0
  31. package/dist/components/CommandPalette/CommandPalette.utils.cjs +1 -0
  32. package/dist/components/CommandPalette/CommandPalette.utils.d.ts +17 -0
  33. package/dist/components/CommandPalette/CommandPalette.utils.js +63 -0
  34. package/dist/components/CommandPalette/index.d.ts +2 -0
  35. package/dist/components/CreditInput/CreditInput.cjs +1 -0
  36. package/dist/components/CreditInput/CreditInput.const.cjs +1 -0
  37. package/dist/components/CreditInput/CreditInput.const.d.ts +37 -0
  38. package/dist/components/CreditInput/CreditInput.const.js +66 -0
  39. package/dist/components/CreditInput/CreditInput.d.ts +15 -0
  40. package/dist/components/CreditInput/CreditInput.js +214 -0
  41. package/dist/components/CreditInput/CreditInput.types.d.ts +93 -0
  42. package/dist/components/CreditInput/CreditInput.utils.cjs +1 -0
  43. package/dist/components/CreditInput/CreditInput.utils.d.ts +48 -0
  44. package/dist/components/CreditInput/CreditInput.utils.js +79 -0
  45. package/dist/components/CreditInput/index.d.ts +2 -0
  46. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  47. package/dist/components/DatePicker/DatePicker.js +108 -84
  48. package/dist/components/DatePicker/DatePicker.types.d.ts +2 -1
  49. package/dist/components/Drawer/Drawer.cjs +1 -1
  50. package/dist/components/Drawer/Drawer.js +75 -44
  51. package/dist/components/EmojiPicker/EmojiPicker.cjs +1 -0
  52. package/dist/components/EmojiPicker/EmojiPicker.const.cjs +1 -0
  53. package/dist/components/EmojiPicker/EmojiPicker.const.d.ts +5 -0
  54. package/dist/components/EmojiPicker/EmojiPicker.const.js +10 -0
  55. package/dist/components/EmojiPicker/EmojiPicker.d.ts +3 -0
  56. package/dist/components/EmojiPicker/EmojiPicker.js +63 -0
  57. package/dist/components/EmojiPicker/EmojiPicker.types.d.ts +6 -0
  58. package/dist/components/EmojiPicker/index.d.ts +3 -0
  59. package/dist/components/Form/Form.cjs +1 -0
  60. package/dist/components/Form/Form.const.cjs +1 -0
  61. package/dist/components/Form/Form.const.d.ts +33 -0
  62. package/dist/components/Form/Form.const.js +27 -0
  63. package/dist/components/Form/Form.context.cjs +1 -0
  64. package/dist/components/Form/Form.context.d.ts +13 -0
  65. package/dist/components/Form/Form.context.js +12 -0
  66. package/dist/components/Form/Form.d.ts +18 -0
  67. package/dist/components/Form/Form.js +230 -0
  68. package/dist/components/Form/Form.types.d.ts +166 -0
  69. package/dist/components/Form/Form.utils.cjs +1 -0
  70. package/dist/components/Form/Form.utils.d.ts +17 -0
  71. package/dist/components/Form/Form.utils.js +31 -0
  72. package/dist/components/Form/index.d.ts +3 -0
  73. package/dist/components/Kanban/Kanban.cjs +1 -0
  74. package/dist/components/Kanban/Kanban.d.ts +3 -0
  75. package/dist/components/Kanban/Kanban.js +90 -0
  76. package/dist/components/Kanban/Kanban.types.d.ts +21 -0
  77. package/dist/components/Kanban/index.d.ts +2 -0
  78. package/dist/components/MentionsInput/MentionsInput.cjs +1 -0
  79. package/dist/components/MentionsInput/MentionsInput.d.ts +3 -0
  80. package/dist/components/MentionsInput/MentionsInput.js +140 -0
  81. package/dist/components/MentionsInput/MentionsInput.types.d.ts +21 -0
  82. package/dist/components/MentionsInput/index.d.ts +2 -0
  83. package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -0
  84. package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -0
  85. package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +25 -0
  86. package/dist/components/NotificationCenter/NotificationCenter.const.js +28 -0
  87. package/dist/components/NotificationCenter/NotificationCenter.d.ts +15 -0
  88. package/dist/components/NotificationCenter/NotificationCenter.js +223 -0
  89. package/dist/components/NotificationCenter/NotificationCenter.types.d.ts +117 -0
  90. package/dist/components/NotificationCenter/NotificationCenter.utils.cjs +1 -0
  91. package/dist/components/NotificationCenter/NotificationCenter.utils.d.ts +11 -0
  92. package/dist/components/NotificationCenter/NotificationCenter.utils.js +19 -0
  93. package/dist/components/NotificationCenter/index.d.ts +2 -0
  94. package/dist/components/PhoneInput/PhoneInput.cjs +1 -0
  95. package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -0
  96. package/dist/components/PhoneInput/PhoneInput.const.d.ts +33 -0
  97. package/dist/components/PhoneInput/PhoneInput.const.js +82 -0
  98. package/dist/components/PhoneInput/PhoneInput.d.ts +16 -0
  99. package/dist/components/PhoneInput/PhoneInput.js +194 -0
  100. package/dist/components/PhoneInput/PhoneInput.types.d.ts +108 -0
  101. package/dist/components/PhoneInput/PhoneInput.utils.cjs +1 -0
  102. package/dist/components/PhoneInput/PhoneInput.utils.d.ts +25 -0
  103. package/dist/components/PhoneInput/PhoneInput.utils.js +39 -0
  104. package/dist/components/PhoneInput/index.d.ts +2 -0
  105. package/dist/components/RichEditor/RichEditor.cjs +1 -1
  106. package/dist/components/RichEditor/RichEditor.const.cjs +2 -2
  107. package/dist/components/RichEditor/RichEditor.const.d.ts +4 -1
  108. package/dist/components/RichEditor/RichEditor.const.js +51 -18
  109. package/dist/components/RichEditor/RichEditor.js +106 -105
  110. package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
  111. package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +105 -95
  112. package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.cjs +1 -1
  113. package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.d.ts +2 -0
  114. package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.js +47 -29
  115. package/dist/components/SegmentedControl/SegmentedControl.cjs +1 -0
  116. package/dist/components/SegmentedControl/SegmentedControl.d.ts +3 -0
  117. package/dist/components/SegmentedControl/SegmentedControl.js +58 -0
  118. package/dist/components/SegmentedControl/SegmentedControl.types.d.ts +16 -0
  119. package/dist/components/SegmentedControl/index.d.ts +2 -0
  120. package/dist/components/SignPad/SignPad.cjs +1 -1
  121. package/dist/components/SignPad/SignPad.js +94 -86
  122. package/dist/components/SliderRange/SliderRange.cjs +1 -0
  123. package/dist/components/SliderRange/SliderRange.d.ts +3 -0
  124. package/dist/components/SliderRange/SliderRange.js +142 -0
  125. package/dist/components/SliderRange/SliderRange.types.d.ts +17 -0
  126. package/dist/components/SliderRange/index.d.ts +2 -0
  127. package/dist/components/TagsInput/TagsInput.cjs +1 -0
  128. package/dist/components/TagsInput/TagsInput.d.ts +3 -0
  129. package/dist/components/TagsInput/TagsInput.js +100 -0
  130. package/dist/components/TagsInput/TagsInput.types.d.ts +16 -0
  131. package/dist/components/TagsInput/index.d.ts +2 -0
  132. package/dist/components/TimePicker/TimePicker.cjs +1 -1
  133. package/dist/components/TimePicker/TimePicker.constants.cjs +1 -1
  134. package/dist/components/TimePicker/TimePicker.constants.d.ts +22 -1
  135. package/dist/components/TimePicker/TimePicker.constants.js +36 -19
  136. package/dist/components/TimePicker/TimePicker.js +97 -131
  137. package/dist/components/TimePicker/TimePicker.types.d.ts +47 -6
  138. package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.cjs +1 -0
  139. package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.d.ts +3 -0
  140. package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js +81 -0
  141. package/dist/components/TimePicker/components/TimePickerColumnsDropdown/index.d.ts +1 -0
  142. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -0
  143. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.d.ts +3 -0
  144. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +84 -0
  145. package/dist/components/TimePicker/components/TimePickerDialDropdown/index.d.ts +1 -0
  146. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -0
  147. package/dist/components/TimePicker/helpers/ClockFaceSvg.d.ts +18 -0
  148. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +67 -0
  149. package/dist/components/TimePicker/helpers/index.d.ts +2 -0
  150. package/dist/components/TimePicker/index.d.ts +1 -1
  151. package/dist/components/VirtualList/VirtualList.cjs +1 -0
  152. package/dist/components/VirtualList/VirtualList.d.ts +3 -0
  153. package/dist/components/VirtualList/VirtualList.js +68 -0
  154. package/dist/components/VirtualList/VirtualList.types.d.ts +10 -0
  155. package/dist/components/VirtualList/index.d.ts +2 -0
  156. package/dist/components/index.cjs +1 -1
  157. package/dist/components/index.d.ts +28 -2
  158. package/dist/components/index.js +177 -146
  159. package/dist/hooks/index.cjs +1 -1
  160. package/dist/hooks/index.d.ts +4 -0
  161. package/dist/hooks/index.js +36 -32
  162. package/dist/hooks/useDragDrop/index.d.ts +2 -0
  163. package/dist/hooks/useDragDrop/useDragDrop.cjs +1 -0
  164. package/dist/hooks/useDragDrop/useDragDrop.d.ts +22 -0
  165. package/dist/hooks/useDragDrop/useDragDrop.js +56 -0
  166. package/dist/hooks/useDragDrop/useDragDrop.types.d.ts +55 -0
  167. package/dist/hooks/useLazyLoad/index.d.ts +2 -0
  168. package/dist/hooks/useLazyLoad/useLazyLoad.cjs +1 -0
  169. package/dist/hooks/useLazyLoad/useLazyLoad.d.ts +26 -0
  170. package/dist/hooks/useLazyLoad/useLazyLoad.js +27 -0
  171. package/dist/hooks/useLazyLoad/useLazyLoad.types.d.ts +25 -0
  172. package/dist/index.cjs +1 -1
  173. package/dist/index.js +290 -255
  174. package/dist/styles.css +1 -1
  175. package/package.json +1 -1
  176. package/dist/components/DateTimePicker/DateTimePicker.cjs +0 -1
  177. package/dist/components/DateTimePicker/DateTimePicker.d.ts +0 -3
  178. package/dist/components/DateTimePicker/DateTimePicker.js +0 -178
  179. package/dist/components/DateTimePicker/DateTimePicker.types.d.ts +0 -26
  180. package/dist/components/DateTimePicker/DateTimePicker.utils.cjs +0 -1
  181. package/dist/components/DateTimePicker/DateTimePicker.utils.d.ts +0 -2
  182. package/dist/components/DateTimePicker/DateTimePicker.utils.js +0 -16
  183. package/dist/components/DateTimePicker/index.d.ts +0 -2
@@ -1,84 +1,85 @@
1
- import { jsxs as me, jsx as t } from "react/jsx-runtime";
2
- import { useRef as pe, useState as C, useEffect as _, useCallback as d } from "react";
3
- import { cn as b } from "../../utils/cn.js";
4
- import { getActiveFormats as be, queryCommandValue as Re, execCommand as u, insertLink as Te, setTextColor as x, setHighlightColor as S, fileToDataUrl as v, insertImage as A } from "./helpers/formatHelpers.js";
5
- import { RICH_EDITOR_MIN_HEIGHT as ye, RICH_EDITOR_DEFAULT_TOOLBAR as _e, RICH_EDITOR_CONTENT_STYLES as Ee, RICH_EDITOR_BUTTON_CONFIG as O, RICH_EDITOR_TOOLBAR_CLASSES as Le, RICH_EDITOR_CONTENT_CLASSES as ze, RICH_EDITOR_ROOT_CLASSES as He, RICH_EDITOR_DIVIDER_CLASSES as ke, RICH_EDITOR_HEADING_OPTIONS as xe } from "./RichEditor.const.js";
1
+ import { jsxs as Re, jsx as t } from "react/jsx-runtime";
2
+ import { useRef as Te, useState as I, useEffect as y, useCallback as d } from "react";
3
+ import { cn as R } from "../../utils/cn.js";
4
+ import { getActiveFormats as be, queryCommandValue as _e, execCommand as u, insertLink as Ee, setTextColor as x, setHighlightColor as A, fileToDataUrl as S, insertImage as v } from "./helpers/formatHelpers.js";
5
+ import { RICH_EDITOR_MIN_HEIGHT as ye, RICH_EDITOR_DEFAULT_TOOLBAR as Le, RICH_EDITOR_CONTENT_STYLES as He, RICH_EDITOR_BUTTON_CONFIG as B, RICH_EDITOR_MOBILE_TOOLBAR as Oe, RICH_EDITOR_TOOLBAR_CLASSES as ze, RICH_EDITOR_CONTENT_CLASSES as ke, RICH_EDITOR_ROOT_CLASSES as xe, RICH_EDITOR_DIVIDER_CLASSES as Ae, RICH_EDITOR_HEADING_OPTIONS as Se, RICH_EDITOR_MOBILE_MORE_ITEMS as ve, RICH_EDITOR_MOBILE_BREAKPOINT as Be } from "./RichEditor.const.js";
6
+ import { useMediaQuery as De } from "../../hooks/useMediaQuery.js";
6
7
  import { ToolbarButton as f } from "./components/ToolbarButton/ToolbarButton.js";
7
- import { ToolbarDropdown as Se } from "./components/ToolbarDropdown/ToolbarDropdown.js";
8
+ import { ToolbarDropdown as Ne } from "./components/ToolbarDropdown/ToolbarDropdown.js";
8
9
  import { ToolbarColorPicker as D } from "./components/ToolbarColorPicker/ToolbarColorPicker.js";
9
- import { ToolbarMore as ve } from "./components/ToolbarMore/ToolbarMore.js";
10
- import { TextIcon as Ae, InsertLinkIcon as B, InsertPhotoIcon as F, AlignLeftIcon as N, AlignCenterIcon as w, AlignRightIcon as U, AlignJustifyIcon as M, IndentIncreaseIcon as V, IndentDecreaseIcon as j, FormatClearIcon as J, TableIcon as Oe, CodeIcon as De, QuoteIcon as Be, ListNumberedIcon as Fe, ListBulletIcon as Ne, Heading3Icon as we, Heading2Icon as Ue, Heading1Icon as Me, StrikethroughIcon as Ve, UnderlineIcon as je, ItalicIcon as Je, BoldIcon as Pe } from "../Icon/icons/editor.js";
11
- const qe = 6, nt = (P) => {
10
+ import { ToolbarMore as Fe } from "./components/ToolbarMore/ToolbarMore.js";
11
+ import { TextIcon as Me, InsertLinkIcon as N, InsertPhotoIcon as F, AlignLeftIcon as M, AlignCenterIcon as w, AlignRightIcon as U, AlignJustifyIcon as V, IndentIncreaseIcon as P, IndentDecreaseIcon as j, FormatClearIcon as J, TableIcon as we, CodeIcon as Ue, QuoteIcon as Ve, ListNumberedIcon as Pe, ListBulletIcon as je, Heading3Icon as Je, Heading2Icon as $e, Heading1Icon as qe, StrikethroughIcon as Ge, UnderlineIcon as Ke, ItalicIcon as Qe, BoldIcon as Ye } from "../Icon/icons/editor.js";
12
+ const We = 6, ct = ($) => {
12
13
  const {
13
- value: I,
14
- defaultValue: E = "",
15
- onChange: R,
14
+ value: C,
15
+ defaultValue: L = "",
16
+ onChange: T,
16
17
  placeholder: q = "Start typing...",
17
18
  disabled: i = !1,
18
19
  readOnly: o = !1,
19
- minHeight: T = ye,
20
+ minHeight: b = ye,
20
21
  maxHeight: m,
21
- toolbar: L = _e,
22
- className: G = "",
23
- testId: $,
22
+ toolbar: G = Le,
23
+ className: K = "",
24
+ testId: Q,
24
25
  id: Y,
25
- allowImagePaste: z = !0,
26
- ...K
27
- } = P, a = pe(null), [Q, W] = C(/* @__PURE__ */ new Set()), [X, H] = C("p"), [Z, ee] = C("#000000"), [te, ne] = C("#fef08a"), [ie, oe] = C([]), [re, le] = C([]);
28
- _(() => {
26
+ allowImagePaste: H = !0,
27
+ ...W
28
+ } = $, a = Te(null), _ = De(`(max-width: ${Be}px)`), O = _ ? Oe : G, [X, Z] = I(/* @__PURE__ */ new Set()), [ee, z] = I("p"), [te, ne] = I("#000000"), [ie, oe] = I("#fef08a"), [re, le] = I([]), [ae, se] = I([]);
29
+ y(() => {
29
30
  const e = "bear-rich-editor-styles";
30
31
  if (!document.getElementById(e)) {
31
32
  const n = document.createElement("style");
32
- n.id = e, n.textContent = Ee, document.head.appendChild(n);
33
+ n.id = e, n.textContent = He, document.head.appendChild(n);
33
34
  }
34
- }, []), _(() => {
35
- a.current && I !== void 0 && a.current.innerHTML !== I && (a.current.innerHTML = I);
36
- }, [I]), _(() => {
37
- a.current && E && !I && (a.current.innerHTML = E);
35
+ }, []), y(() => {
36
+ a.current && C !== void 0 && a.current.innerHTML !== C && (a.current.innerHTML = C);
37
+ }, [C]), y(() => {
38
+ a.current && L && !C && (a.current.innerHTML = L);
38
39
  }, []);
39
40
  const h = d(() => {
40
- W(be());
41
- const e = Re("formatBlock");
42
- e && H(e.toLowerCase().replace(/[<>]/g, ""));
41
+ Z(be());
42
+ const e = _e("formatBlock");
43
+ e && z(e.toLowerCase().replace(/[<>]/g, ""));
43
44
  }, []), l = d(() => {
44
- a.current && R && R(a.current.innerHTML), h();
45
- }, [R, h]), ae = d((e) => {
45
+ a.current && T && T(a.current.innerHTML), h();
46
+ }, [T, h]), ce = d((e) => {
46
47
  var s;
47
48
  if (i || o) return;
48
49
  (s = a.current) == null || s.focus();
49
- const n = O[e];
50
+ const n = B[e];
50
51
  if (!n) return;
51
52
  const c = "value" in n ? n.value : void 0;
52
53
  c ? u(n.command, c) : u(n.command), h(), l();
53
- }, [i, o, h, l]), se = d((e) => {
54
+ }, [i, o, h, l]), de = d((e) => {
54
55
  var n;
55
- i || o || ((n = a.current) == null || n.focus(), u("formatBlock", e), H(e), l());
56
- }, [i, o, l]), ce = d(() => {
56
+ i || o || ((n = a.current) == null || n.focus(), u("formatBlock", e), z(e), l());
57
+ }, [i, o, l]), ue = d(() => {
57
58
  var s;
58
59
  if (i || o) return;
59
60
  const e = window.getSelection(), n = e && e.toString().length > 0, c = prompt("Enter URL:", n ? "" : "https://");
60
- c && ((s = a.current) == null || s.focus(), Te(c), l());
61
+ c && ((s = a.current) == null || s.focus(), Ee(c), l());
61
62
  }, [i, o, l]), p = d((e, n) => {
62
63
  if (!e) return;
63
- (n === "text" ? oe : le)((s) => {
64
+ (n === "text" ? le : se)((s) => {
64
65
  const r = s.filter((g) => g !== e);
65
- return [e, ...r].slice(0, qe);
66
+ return [e, ...r].slice(0, We);
66
67
  });
67
- }, []), de = d((e) => {
68
+ }, []), fe = d((e) => {
68
69
  var n;
69
- i || o || ((n = a.current) == null || n.focus(), x(e), ee(e), p(e, "text"), l());
70
- }, [i, o, l, p]), ue = d((e) => {
70
+ i || o || ((n = a.current) == null || n.focus(), x(e), ne(e), p(e, "text"), l());
71
+ }, [i, o, l, p]), ge = d((e) => {
71
72
  var n;
72
- i || o || ((n = a.current) == null || n.focus(), S(e), ne(e), p(e, "highlight"), l());
73
- }, [i, o, l, p]), fe = d((e) => {
73
+ i || o || ((n = a.current) == null || n.focus(), A(e), oe(e), p(e, "highlight"), l());
74
+ }, [i, o, l, p]), he = d((e) => {
74
75
  var n;
75
76
  i || o || ((n = a.current) == null || n.focus(), x(e), l());
76
- }, [i, o, l]), ge = d((e) => {
77
+ }, [i, o, l]), Ie = d((e) => {
77
78
  var n;
78
- i || o || ((n = a.current) == null || n.focus(), S(e), l());
79
- }, [i, o, l]), he = d(async (e) => {
79
+ i || o || ((n = a.current) == null || n.focus(), A(e), l());
80
+ }, [i, o, l]), Ce = d(async (e) => {
80
81
  var c;
81
- if (!z) return;
82
+ if (!H) return;
82
83
  const n = (c = e.clipboardData) == null ? void 0 : c.items;
83
84
  if (n)
84
85
  for (let s = 0; s < n.length; s++) {
@@ -87,58 +88,58 @@ const qe = 6, nt = (P) => {
87
88
  e.preventDefault();
88
89
  const g = r.getAsFile();
89
90
  if (g) {
90
- const y = await v(g);
91
- A(y), l();
91
+ const E = await S(g);
92
+ v(E), l();
92
93
  }
93
94
  return;
94
95
  }
95
96
  }
96
- }, [z, l]), Ce = d(() => {
97
+ }, [H, l]), me = d(() => {
97
98
  if (i || o) return;
98
99
  const e = document.createElement("input");
99
100
  e.type = "file", e.accept = "image/*", e.onchange = async (n) => {
100
101
  var s, r;
101
102
  const c = (s = n.target.files) == null ? void 0 : s[0];
102
103
  if (c) {
103
- const g = await v(c);
104
- (r = a.current) == null || r.focus(), A(g), l();
104
+ const g = await S(c);
105
+ (r = a.current) == null || r.focus(), v(g), l();
105
106
  }
106
107
  }, e.click();
107
- }, [i, o, l]), Ie = {
108
- bold: /* @__PURE__ */ t(Pe, { size: 16 }),
109
- italic: /* @__PURE__ */ t(Je, { size: 16 }),
110
- underline: /* @__PURE__ */ t(je, { size: 16 }),
111
- strikethrough: /* @__PURE__ */ t(Ve, { size: 16 }),
112
- heading1: /* @__PURE__ */ t(Me, { size: 16 }),
113
- heading2: /* @__PURE__ */ t(Ue, { size: 16 }),
114
- heading3: /* @__PURE__ */ t(we, { size: 16 }),
115
- bulletList: /* @__PURE__ */ t(Ne, { size: 16 }),
116
- orderedList: /* @__PURE__ */ t(Fe, { size: 16 }),
117
- blockquote: /* @__PURE__ */ t(Be, { size: 16 }),
118
- code: /* @__PURE__ */ t(De, { size: 16 }),
119
- link: /* @__PURE__ */ t(B, { size: 16 }),
120
- alignLeft: /* @__PURE__ */ t(N, { size: 16 }),
108
+ }, [i, o, l]), pe = {
109
+ bold: /* @__PURE__ */ t(Ye, { size: 16 }),
110
+ italic: /* @__PURE__ */ t(Qe, { size: 16 }),
111
+ underline: /* @__PURE__ */ t(Ke, { size: 16 }),
112
+ strikethrough: /* @__PURE__ */ t(Ge, { size: 16 }),
113
+ heading1: /* @__PURE__ */ t(qe, { size: 16 }),
114
+ heading2: /* @__PURE__ */ t($e, { size: 16 }),
115
+ heading3: /* @__PURE__ */ t(Je, { size: 16 }),
116
+ bulletList: /* @__PURE__ */ t(je, { size: 16 }),
117
+ orderedList: /* @__PURE__ */ t(Pe, { size: 16 }),
118
+ blockquote: /* @__PURE__ */ t(Ve, { size: 16 }),
119
+ code: /* @__PURE__ */ t(Ue, { size: 16 }),
120
+ link: /* @__PURE__ */ t(N, { size: 16 }),
121
+ alignLeft: /* @__PURE__ */ t(M, { size: 16 }),
121
122
  alignCenter: /* @__PURE__ */ t(w, { size: 16 }),
122
123
  alignRight: /* @__PURE__ */ t(U, { size: 16 }),
123
- alignJustify: /* @__PURE__ */ t(M, { size: 16 }),
124
+ alignJustify: /* @__PURE__ */ t(V, { size: 16 }),
124
125
  image: /* @__PURE__ */ t(F, { size: 16 }),
125
- indent: /* @__PURE__ */ t(V, { size: 16 }),
126
+ indent: /* @__PURE__ */ t(P, { size: 16 }),
126
127
  outdent: /* @__PURE__ */ t(j, { size: 16 }),
127
128
  clearFormat: /* @__PURE__ */ t(J, { size: 16 }),
128
- table: /* @__PURE__ */ t(Oe, { size: 16 })
129
+ table: /* @__PURE__ */ t(we, { size: 16 })
129
130
  }, k = (e, n) => {
130
131
  if (e === "divider")
131
- return /* @__PURE__ */ t("div", { className: b("Bear-RichEditor__divider", ke) }, `divider-${n}`);
132
+ return /* @__PURE__ */ t("div", { className: R("Bear-RichEditor__divider", Ae) }, `divider-${n}`);
132
133
  if (e === "headingDropdown")
133
134
  return /* @__PURE__ */ t(
134
- Se,
135
+ Ne,
135
136
  {
136
- options: xe,
137
- value: X,
138
- onChange: se,
137
+ options: Se,
138
+ value: ee,
139
+ onChange: de,
139
140
  title: "Text Style",
140
141
  disabled: i || o,
141
- icon: /* @__PURE__ */ t(Ae, { size: 16 })
142
+ icon: /* @__PURE__ */ t(Me, { size: 16 })
142
143
  },
143
144
  "heading-dropdown"
144
145
  );
@@ -146,13 +147,13 @@ const qe = 6, nt = (P) => {
146
147
  return /* @__PURE__ */ t(
147
148
  D,
148
149
  {
149
- value: Z,
150
- onChange: de,
150
+ value: te,
151
+ onChange: fe,
151
152
  title: "Text Color",
152
153
  disabled: i || o,
153
154
  type: "text",
154
- recentColors: ie,
155
- onApplyLast: fe
155
+ recentColors: re,
156
+ onApplyLast: he
156
157
  },
157
158
  "text-color"
158
159
  );
@@ -160,13 +161,13 @@ const qe = 6, nt = (P) => {
160
161
  return /* @__PURE__ */ t(
161
162
  D,
162
163
  {
163
- value: te,
164
- onChange: ue,
164
+ value: ie,
165
+ onChange: ge,
165
166
  title: "Highlight Color",
166
167
  disabled: i || o,
167
168
  type: "highlight",
168
- recentColors: re,
169
- onApplyLast: ge
169
+ recentColors: ae,
170
+ onApplyLast: Ie
170
171
  },
171
172
  "highlight-color"
172
173
  );
@@ -174,9 +175,9 @@ const qe = 6, nt = (P) => {
174
175
  return /* @__PURE__ */ t(
175
176
  f,
176
177
  {
177
- icon: /* @__PURE__ */ t(B, { size: 16 }),
178
+ icon: /* @__PURE__ */ t(N, { size: 16 }),
178
179
  title: "Insert Link",
179
- onClick: ce,
180
+ onClick: ue,
180
181
  disabled: i || o
181
182
  },
182
183
  "link"
@@ -187,7 +188,7 @@ const qe = 6, nt = (P) => {
187
188
  {
188
189
  icon: /* @__PURE__ */ t(F, { size: 16 }),
189
190
  title: "Insert Image",
190
- onClick: Ce,
191
+ onClick: me,
191
192
  disabled: i || o
192
193
  },
193
194
  "image"
@@ -196,7 +197,7 @@ const qe = 6, nt = (P) => {
196
197
  return /* @__PURE__ */ t(
197
198
  f,
198
199
  {
199
- icon: /* @__PURE__ */ t(N, { size: 16 }),
200
+ icon: /* @__PURE__ */ t(M, { size: 16 }),
200
201
  title: "Align Left",
201
202
  onClick: () => {
202
203
  var r;
@@ -238,7 +239,7 @@ const qe = 6, nt = (P) => {
238
239
  return /* @__PURE__ */ t(
239
240
  f,
240
241
  {
241
- icon: /* @__PURE__ */ t(M, { size: 16 }),
242
+ icon: /* @__PURE__ */ t(V, { size: 16 }),
242
243
  title: "Justify",
243
244
  onClick: () => {
244
245
  var r;
@@ -252,7 +253,7 @@ const qe = 6, nt = (P) => {
252
253
  return /* @__PURE__ */ t(
253
254
  f,
254
255
  {
255
- icon: /* @__PURE__ */ t(V, { size: 16 }),
256
+ icon: /* @__PURE__ */ t(P, { size: 16 }),
256
257
  title: "Increase Indent",
257
258
  onClick: () => {
258
259
  var r;
@@ -291,7 +292,7 @@ const qe = 6, nt = (P) => {
291
292
  "clearFormat"
292
293
  );
293
294
  if (e === "more")
294
- return /* @__PURE__ */ t(ve, { disabled: i || o, children: [
295
+ return /* @__PURE__ */ t(Fe, { disabled: i || o, isMobile: _, children: (_ ? ve : [
295
296
  "alignLeft",
296
297
  "alignCenter",
297
298
  "alignRight",
@@ -301,35 +302,35 @@ const qe = 6, nt = (P) => {
301
302
  "blockquote",
302
303
  "code",
303
304
  "clearFormat"
304
- ].map((g, y) => k(g, y + 1e3)) }, "more");
305
- const c = O[e], s = Ie[e];
305
+ ]).map((g, E) => k(g, E + 1e3)) }, "more");
306
+ const c = B[e], s = pe[e];
306
307
  return !c || !s ? null : /* @__PURE__ */ t(
307
308
  f,
308
309
  {
309
310
  icon: s,
310
311
  title: c.title,
311
- active: Q.has(e),
312
- onClick: () => ae(e),
312
+ active: X.has(e),
313
+ onClick: () => ce(e),
313
314
  disabled: i || o
314
315
  },
315
316
  e
316
317
  );
317
318
  };
318
- return /* @__PURE__ */ me(
319
+ return /* @__PURE__ */ Re(
319
320
  "div",
320
321
  {
321
322
  id: Y,
322
- "data-testid": $,
323
- className: b(
323
+ "data-testid": Q,
324
+ className: R(
324
325
  "Bear-RichEditor",
325
- He,
326
+ xe,
326
327
  i && "Bear-RichEditor--disabled",
327
328
  o && "Bear-RichEditor--readonly",
328
- G
329
+ K
329
330
  ),
330
- ...K,
331
+ ...W,
331
332
  children: [
332
- L.length > 0 && /* @__PURE__ */ t("div", { className: b("Bear-RichEditor__toolbar", Le), children: L.map((e, n) => k(e, n)) }),
333
+ O.length > 0 && /* @__PURE__ */ t("div", { className: R("Bear-RichEditor__toolbar", ze), children: O.map((e, n) => k(e, n)) }),
333
334
  /* @__PURE__ */ t(
334
335
  "div",
335
336
  {
@@ -339,16 +340,16 @@ const qe = 6, nt = (P) => {
339
340
  onSelect: h,
340
341
  onKeyUp: h,
341
342
  onMouseUp: h,
342
- onPaste: he,
343
+ onPaste: Ce,
343
344
  "data-placeholder": q,
344
- className: b(
345
+ className: R(
345
346
  "Bear-RichEditor__content",
346
- ze,
347
+ ke,
347
348
  "[&:empty]:before:bear-content-[attr(data-placeholder)] [&:empty]:before:bear-text-gray-400 [&:empty]:before:bear-pointer-events-none",
348
349
  i && "Bear-RichEditor__content--disabled bear-opacity-50 bear-cursor-not-allowed"
349
350
  ),
350
351
  style: {
351
- minHeight: typeof T == "number" ? `${T}px` : T,
352
+ minHeight: typeof b == "number" ? `${b}px` : b,
352
353
  maxHeight: m ? typeof m == "number" ? `${m}px` : m : void 0,
353
354
  overflowY: m ? "auto" : void 0
354
355
  }
@@ -359,5 +360,5 @@ const qe = 6, nt = (P) => {
359
360
  );
360
361
  };
361
362
  export {
362
- nt as RichEditor
363
+ ct as RichEditor
363
364
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("react"),s=require("../../../../utils/cn.cjs"),i=require("../../RichEditor.const.cjs"),m=require("../../../Icon/icons/editor.cjs"),_=require("../../../Icon/icons/status.cjs"),C=p=>{const{value:r,onChange:f,title:y,disabled:o,type:n="text",recentColors:a=[],onApplyLast:h}=p,[b,c]=g.useState(!1),l=g.useRef(null);g.useEffect(()=>{const e=u=>{l.current&&!l.current.contains(u.target)&&c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const d=e=>{f(e),c(!1)},k=n==="text"?m.FormatColorTextIcon:m.HighlightIcon,x=a[0]||r;return t.jsxs("div",{ref:l,className:"Bear-RichEditor__color-picker relative flex items-center",children:[t.jsxs("button",{type:"button",title:y,disabled:o,onClick:()=>c(!b),className:s.cn("Bear-RichEditor__color-trigger",i.RICH_EDITOR_BUTTON_BASE_CLASSES,i.RICH_EDITOR_BUTTON_INACTIVE_CLASSES,"flex items-center gap-0.5",o&&`Bear-RichEditor__color-trigger--disabled ${i.RICH_EDITOR_BUTTON_DISABLED_CLASSES}`),children:[t.jsx(k,{size:16}),t.jsx("span",{className:"w-3 h-1 rounded-sm mt-0.5",style:{backgroundColor:r||(n==="text"?"#000000":"#fef08a")}})]}),x&&h&&t.jsx("button",{type:"button",title:`Apply ${n==="text"?"text":"highlight"} color`,disabled:o,onClick:()=>h(x),className:s.cn("Bear-RichEditor__color-apply","p-0.5 rounded transition-colors","text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700",o&&"opacity-50 cursor-not-allowed"),children:t.jsx(_.CheckIcon,{size:12})}),b&&t.jsxs("div",{className:"Bear-RichEditor__color-menu absolute bottom-full left-0 mb-1 p-3 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl min-w-[200px]",style:{zIndex:9999},children:[a.length>0&&t.jsxs("div",{className:"mb-3",children:[t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1.5",children:"Recent"}),t.jsx("div",{className:"flex gap-1",children:a.slice(0,6).map((e,u)=>t.jsx("button",{type:"button",onClick:()=>d(e),className:s.cn("w-6 h-6 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110",r===e&&"ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"),style:{backgroundColor:e},title:e},`recent-${u}`))})]}),t.jsx("div",{className:"grid grid-cols-8 gap-1",children:i.RICH_EDITOR_COLORS.map(e=>t.jsx("button",{type:"button",onClick:()=>d(e),className:s.cn("Bear-RichEditor__color-swatch","w-5 h-5 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110",r===e&&"ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"),style:{backgroundColor:e},title:e},e))}),t.jsxs("button",{type:"button",onClick:()=>d(""),className:"w-full mt-2 px-2 py-1.5 text-xs text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors",children:["Remove ",n==="text"?"color":"highlight"]})]})]})};exports.ToolbarColorPicker=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),S=require("react-dom"),i=require("../../../../utils/cn.cjs"),d=require("../../RichEditor.const.cjs"),j=require("../../../../hooks/useMediaQuery.cjs"),_=require("../../../Icon/icons/editor.cjs"),I=require("../../../Icon/icons/status.cjs"),N=R=>{const{value:s,onChange:w,title:v,disabled:c,type:a="text",recentColors:u=[],onApplyLast:p}=R,[l,g]=r.useState(!1),[x,b]=r.useState({top:0,left:0}),m=r.useRef(null),h=r.useRef(null),o=j.useMediaQuery("(max-width: 640px)");r.useEffect(()=>{if(l&&o&&h.current&&typeof document<"u"){const e=h.current.getBoundingClientRect(),n=e.top,C=window.innerHeight-e.bottom;C>=240||C>=n?b({top:e.bottom+4,left:Math.max(8,Math.min(e.left,window.innerWidth-220))}):b({top:e.top-244,left:Math.max(8,Math.min(e.left,window.innerWidth-220))})}},[l,o]),r.useEffect(()=>{const e=n=>{m.current&&!m.current.contains(n.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const f=e=>{w(e),g(!1)},E=a==="text"?_.FormatColorTextIcon:_.HighlightIcon,y=u[0]||s,k=t.jsxs("div",{className:i.cn("Bear-RichEditor__color-menu p-3 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl min-w-[200px] max-w-[min(90vw,240px)]",o?"fixed z-[9999]":"absolute bottom-full left-0 mb-1"),style:o?{top:x.top,left:x.left}:void 0,children:[u.length>0&&t.jsxs("div",{className:"mb-3",children:[t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1.5",children:"Recent"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:u.slice(0,6).map((e,n)=>t.jsx("button",{type:"button",onClick:()=>f(e),className:i.cn("w-6 h-6 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110 touch-manipulation",s===e&&"ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"),style:{backgroundColor:e},title:e},`recent-${n}`))})]}),t.jsx("div",{className:"grid grid-cols-8 gap-1",children:d.RICH_EDITOR_COLORS.map(e=>t.jsx("button",{type:"button",onClick:()=>f(e),className:i.cn("Bear-RichEditor__color-swatch w-5 h-5 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110 touch-manipulation",s===e&&"ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"),style:{backgroundColor:e},title:e},e))}),t.jsxs("button",{type:"button",onClick:()=>f(""),className:"w-full mt-2 px-2 py-1.5 text-xs text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors touch-manipulation",children:["Remove ",a==="text"?"color":"highlight"]})]});return t.jsxs("div",{ref:m,className:"Bear-RichEditor__color-picker relative flex items-center",children:[t.jsxs("button",{ref:h,type:"button",title:v,disabled:c,onClick:()=>g(!l),className:i.cn("Bear-RichEditor__color-trigger",d.RICH_EDITOR_BUTTON_BASE_CLASSES,d.RICH_EDITOR_BUTTON_INACTIVE_CLASSES,"flex items-center gap-0.5",c&&`Bear-RichEditor__color-trigger--disabled ${d.RICH_EDITOR_BUTTON_DISABLED_CLASSES}`),children:[t.jsx(E,{size:16}),t.jsx("span",{className:"w-3 h-1 rounded-sm mt-0.5",style:{backgroundColor:s||(a==="text"?"#000000":"#fef08a")}})]}),y&&p&&t.jsx("button",{type:"button",title:`Apply ${a==="text"?"text":"highlight"} color`,disabled:c,onClick:()=>p(y),className:i.cn("Bear-RichEditor__color-apply","p-0.5 rounded transition-colors","text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700",c&&"opacity-50 cursor-not-allowed"),children:t.jsx(I.CheckIcon,{size:12})}),l&&(o&&typeof document<"u"?S.createPortal(k,document.body):k)]})};exports.ToolbarColorPicker=N;
@@ -1,126 +1,136 @@
1
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { useState as k, useRef as y, useEffect as _ } from "react";
3
- import { cn as a } from "../../../../utils/cn.js";
4
- import { RICH_EDITOR_BUTTON_DISABLED_CLASSES as C, RICH_EDITOR_BUTTON_INACTIVE_CLASSES as E, RICH_EDITOR_BUTTON_BASE_CLASSES as R, RICH_EDITOR_COLORS as v } from "../../RichEditor.const.js";
5
- import { FormatColorTextIcon as I, HighlightIcon as N } from "../../../Icon/icons/editor.js";
6
- import { CheckIcon as S } from "../../../Icon/icons/status.js";
7
- const L = (p) => {
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import { useState as C, useRef as _, useEffect as w } from "react";
3
+ import { createPortal as N } from "react-dom";
4
+ import { cn as i } from "../../../../utils/cn.js";
5
+ import { RICH_EDITOR_COLORS as S, RICH_EDITOR_BUTTON_DISABLED_CLASSES as B, RICH_EDITOR_BUTTON_INACTIVE_CLASSES as T, RICH_EDITOR_BUTTON_BASE_CLASSES as O } from "../../RichEditor.const.js";
6
+ import { useMediaQuery as z } from "../../../../hooks/useMediaQuery.js";
7
+ import { FormatColorTextIcon as A, HighlightIcon as L } from "../../../Icon/icons/editor.js";
8
+ import { CheckIcon as M } from "../../../Icon/icons/status.js";
9
+ const Q = (R) => {
8
10
  const {
9
- value: o,
10
- onChange: b,
11
- title: f,
12
- disabled: n,
13
- type: i = "text",
14
- recentColors: l = [],
15
- onApplyLast: m
16
- } = p, [h, s] = k(!1), c = y(null);
17
- _(() => {
18
- const e = (g) => {
19
- c.current && !c.current.contains(g.target) && s(!1);
11
+ value: a,
12
+ onChange: v,
13
+ title: E,
14
+ disabled: l,
15
+ type: c = "text",
16
+ recentColors: d = [],
17
+ onApplyLast: g
18
+ } = R, [s, m] = C(!1), [h, b] = C({ top: 0, left: 0 }), u = _(null), p = _(null), o = z("(max-width: 640px)");
19
+ w(() => {
20
+ if (s && o && p.current && typeof document < "u") {
21
+ const t = p.current.getBoundingClientRect(), r = t.top, k = window.innerHeight - t.bottom;
22
+ k >= 240 || k >= r ? b({ top: t.bottom + 4, left: Math.max(8, Math.min(t.left, window.innerWidth - 220)) }) : b({ top: t.top - 244, left: Math.max(8, Math.min(t.left, window.innerWidth - 220)) });
23
+ }
24
+ }, [s, o]), w(() => {
25
+ const t = (r) => {
26
+ u.current && !u.current.contains(r.target) && m(!1);
20
27
  };
21
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
28
+ return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
22
29
  }, []);
23
- const d = (e) => {
24
- b(e), s(!1);
25
- }, x = i === "text" ? I : N, u = l[0] || o;
26
- return /* @__PURE__ */ r("div", { ref: c, className: "Bear-RichEditor__color-picker relative flex items-center", children: [
27
- /* @__PURE__ */ r(
30
+ const f = (t) => {
31
+ v(t), m(!1);
32
+ }, I = c === "text" ? A : L, x = d[0] || a, y = /* @__PURE__ */ n(
33
+ "div",
34
+ {
35
+ className: i(
36
+ "Bear-RichEditor__color-menu p-3 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl min-w-[200px] max-w-[min(90vw,240px)]",
37
+ o ? "fixed z-[9999]" : "absolute bottom-full left-0 mb-1"
38
+ ),
39
+ style: o ? { top: h.top, left: h.left } : void 0,
40
+ children: [
41
+ d.length > 0 && /* @__PURE__ */ n("div", { className: "mb-3", children: [
42
+ /* @__PURE__ */ e("p", { className: "text-xs text-gray-500 dark:text-gray-400 mb-1.5", children: "Recent" }),
43
+ /* @__PURE__ */ e("div", { className: "flex gap-1 flex-wrap", children: d.slice(0, 6).map((t, r) => /* @__PURE__ */ e(
44
+ "button",
45
+ {
46
+ type: "button",
47
+ onClick: () => f(t),
48
+ className: i(
49
+ "w-6 h-6 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110 touch-manipulation",
50
+ a === t && "ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"
51
+ ),
52
+ style: { backgroundColor: t },
53
+ title: t
54
+ },
55
+ `recent-${r}`
56
+ )) })
57
+ ] }),
58
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-8 gap-1", children: S.map((t) => /* @__PURE__ */ e(
59
+ "button",
60
+ {
61
+ type: "button",
62
+ onClick: () => f(t),
63
+ className: i(
64
+ "Bear-RichEditor__color-swatch w-5 h-5 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110 touch-manipulation",
65
+ a === t && "ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"
66
+ ),
67
+ style: { backgroundColor: t },
68
+ title: t
69
+ },
70
+ t
71
+ )) }),
72
+ /* @__PURE__ */ n(
73
+ "button",
74
+ {
75
+ type: "button",
76
+ onClick: () => f(""),
77
+ className: "w-full mt-2 px-2 py-1.5 text-xs text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors touch-manipulation",
78
+ children: [
79
+ "Remove ",
80
+ c === "text" ? "color" : "highlight"
81
+ ]
82
+ }
83
+ )
84
+ ]
85
+ }
86
+ );
87
+ return /* @__PURE__ */ n("div", { ref: u, className: "Bear-RichEditor__color-picker relative flex items-center", children: [
88
+ /* @__PURE__ */ n(
28
89
  "button",
29
90
  {
91
+ ref: p,
30
92
  type: "button",
31
- title: f,
32
- disabled: n,
33
- onClick: () => s(!h),
34
- className: a(
93
+ title: E,
94
+ disabled: l,
95
+ onClick: () => m(!s),
96
+ className: i(
35
97
  "Bear-RichEditor__color-trigger",
36
- R,
37
- E,
98
+ O,
99
+ T,
38
100
  "flex items-center gap-0.5",
39
- n && `Bear-RichEditor__color-trigger--disabled ${C}`
101
+ l && `Bear-RichEditor__color-trigger--disabled ${B}`
40
102
  ),
41
103
  children: [
42
- /* @__PURE__ */ t(x, { size: 16 }),
43
- /* @__PURE__ */ t(
104
+ /* @__PURE__ */ e(I, { size: 16 }),
105
+ /* @__PURE__ */ e(
44
106
  "span",
45
107
  {
46
108
  className: "w-3 h-1 rounded-sm mt-0.5",
47
- style: { backgroundColor: o || (i === "text" ? "#000000" : "#fef08a") }
109
+ style: { backgroundColor: a || (c === "text" ? "#000000" : "#fef08a") }
48
110
  }
49
111
  )
50
112
  ]
51
113
  }
52
114
  ),
53
- u && m && /* @__PURE__ */ t(
115
+ x && g && /* @__PURE__ */ e(
54
116
  "button",
55
117
  {
56
118
  type: "button",
57
- title: `Apply ${i === "text" ? "text" : "highlight"} color`,
58
- disabled: n,
59
- onClick: () => m(u),
60
- className: a(
119
+ title: `Apply ${c === "text" ? "text" : "highlight"} color`,
120
+ disabled: l,
121
+ onClick: () => g(x),
122
+ className: i(
61
123
  "Bear-RichEditor__color-apply",
62
124
  "p-0.5 rounded transition-colors",
63
125
  "text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700",
64
- n && "opacity-50 cursor-not-allowed"
126
+ l && "opacity-50 cursor-not-allowed"
65
127
  ),
66
- children: /* @__PURE__ */ t(S, { size: 12 })
128
+ children: /* @__PURE__ */ e(M, { size: 12 })
67
129
  }
68
130
  ),
69
- h && /* @__PURE__ */ r(
70
- "div",
71
- {
72
- className: "Bear-RichEditor__color-menu absolute bottom-full left-0 mb-1 p-3 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl min-w-[200px]",
73
- style: { zIndex: 9999 },
74
- children: [
75
- l.length > 0 && /* @__PURE__ */ r("div", { className: "mb-3", children: [
76
- /* @__PURE__ */ t("p", { className: "text-xs text-gray-500 dark:text-gray-400 mb-1.5", children: "Recent" }),
77
- /* @__PURE__ */ t("div", { className: "flex gap-1", children: l.slice(0, 6).map((e, g) => /* @__PURE__ */ t(
78
- "button",
79
- {
80
- type: "button",
81
- onClick: () => d(e),
82
- className: a(
83
- "w-6 h-6 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110",
84
- o === e && "ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"
85
- ),
86
- style: { backgroundColor: e },
87
- title: e
88
- },
89
- `recent-${g}`
90
- )) })
91
- ] }),
92
- /* @__PURE__ */ t("div", { className: "grid grid-cols-8 gap-1", children: v.map((e) => /* @__PURE__ */ t(
93
- "button",
94
- {
95
- type: "button",
96
- onClick: () => d(e),
97
- className: a(
98
- "Bear-RichEditor__color-swatch",
99
- "w-5 h-5 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110",
100
- o === e && "ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"
101
- ),
102
- style: { backgroundColor: e },
103
- title: e
104
- },
105
- e
106
- )) }),
107
- /* @__PURE__ */ r(
108
- "button",
109
- {
110
- type: "button",
111
- onClick: () => d(""),
112
- className: "w-full mt-2 px-2 py-1.5 text-xs text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors",
113
- children: [
114
- "Remove ",
115
- i === "text" ? "color" : "highlight"
116
- ]
117
- }
118
- )
119
- ]
120
- }
121
- )
131
+ s && (o && typeof document < "u" ? N(y, document.body) : y)
122
132
  ] });
123
133
  };
124
134
  export {
125
- L as ToolbarColorPicker
135
+ Q as ToolbarColorPicker
126
136
  };