@baishuyun/ui-base 6.7.2 → 6.8.2

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 (218) hide show
  1. package/dist/Amap/{Amap-Dnvu_pUP.js → Amap-BNnmSPnl.js} +1 -1
  2. package/dist/Amap/AmapCircle/index.js +4 -3
  3. package/dist/Amap/{AmapCircle-Wfn43qco.js → AmapCircle-BDW6pnNR.js} +1 -1
  4. package/dist/Amap/AmapMarker/index.js +5 -4
  5. package/dist/Amap/{AmapMarker-CMlzx_nj.js → AmapMarker-CdoPWdff.js} +2 -2
  6. package/dist/Amap/AmapMarkerCluster/index.js +5 -4
  7. package/dist/Amap/{AmapMarkerCluster-MDUfcIqP.js → AmapMarkerCluster-CSIxiVC5.js} +2 -2
  8. package/dist/Amap/AmapProvider/index.js +5 -4
  9. package/dist/Amap/{AmapProvider-CGedZdvQ.js → AmapProvider-Cwi6WOe0.js} +2 -2
  10. package/dist/Amap/hooks/index.js +3 -2
  11. package/dist/Amap/{hooks-DwRvpafb.js → hooks-DAN31s_-.js} +1 -1
  12. package/dist/Amap/index.js +11 -10
  13. package/dist/Calendar/{AllDaySection-Bd5Po_DI.js → AllDaySection-a96dIzs3.js} +4 -4
  14. package/dist/Calendar/{Calendar-Bs4S-6rW.js → Calendar-DnQrN8KB.js} +13 -13
  15. package/dist/Calendar/{CurrentTimeIndicator-twXtFHIp.js → CurrentTimeIndicator-CNKsVEXH.js} +1 -1
  16. package/dist/Calendar/{EventCard-CvEnWcKd.js → EventCard-B1LoBxth.js} +3 -3
  17. package/dist/Calendar/{TimeGrid-DPtU6Qvo.js → TimeGrid-DIw8oCqY.js} +2 -2
  18. package/dist/Calendar/context/index.js +2 -1
  19. package/dist/Calendar/index.js +21 -20
  20. package/dist/Calendar/subcomponents/AllDaySection/index.js +8 -7
  21. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +5 -4
  22. package/dist/Calendar/subcomponents/EventCard/index.js +6 -5
  23. package/dist/Calendar/subcomponents/TimeAxis/index.js +4 -3
  24. package/dist/Calendar/subcomponents/TimeGrid/index.js +4 -3
  25. package/dist/Calendar/{theme-BRVmxhqD.js → theme-xnrMsnkg.js} +2 -2
  26. package/dist/Calendar/utils/index.js +4 -3
  27. package/dist/Calendar/utils/layout/index.js +3 -2
  28. package/dist/Calendar/utils/theme/index.js +2 -1
  29. package/dist/Card/{Card-BjWdQRjq.js → Card-CtKLNh3n.js} +1 -1
  30. package/dist/Card/index.js +3 -2
  31. package/dist/CheckBox/{CheckBox-D7bCjlkU.js → CheckBox-ByWSy9Yr.js} +1 -1
  32. package/dist/CheckBox/{CheckBox-GtT43IQ8.js → CheckBox-nBm0u6zX.js} +1 -1
  33. package/dist/CheckBox/index.js +4 -3
  34. package/dist/ColorPicker/{ColorPicker-Hjs4Vp5a.js → ColorPicker-CL57cSDG.js} +7 -6
  35. package/dist/ColorPicker/index.js +8 -7
  36. package/dist/ConfigProvider/index.js +3 -2
  37. package/dist/DatePicker/{DatePicker-C_ssCNGN.js → DatePicker-C0XbZmrZ.js} +7 -7
  38. package/dist/DatePicker/{DatePickerPanel-DNDw-H39.js → DatePickerPanel-BEn16cat.js} +6 -5
  39. package/dist/DatePicker/index.js +9 -8
  40. package/dist/DatePicker/style/index.js +2 -1
  41. package/dist/DatePicker/{style-BwmM26RP.js → style-CNtPPsZp.js} +1 -1
  42. package/dist/DropDown/{DropDown-DYhDwsNm.js → DropDown-yDH9V_9Y.js} +8 -8
  43. package/dist/DropDown/index.js +12 -10
  44. package/dist/DropDown/style/index.js +2 -1
  45. package/dist/DropDown/{style-BSgosymi.js → style-Fdp-U4md.js} +1 -1
  46. package/dist/Editor/{Buttons-D1fP8aYo.js → Buttons-BivKInBV.js} +147 -127
  47. package/dist/Editor/ToolbarPlugin/Buttons/index.js +19 -17
  48. package/dist/Editor/constants/index.js +1 -0
  49. package/dist/Editor/index.js +286 -174
  50. package/dist/Gantt/GanttChart/index.js +19 -17
  51. package/dist/Gantt/{GanttChart-VoKzDvu-.js → GanttChart-CDw1IQ4F.js} +9 -9
  52. package/dist/Gantt/GanttTable/index.js +12 -10
  53. package/dist/Gantt/{GanttTable-l-pMVjWe.js → GanttTable-xbXD_PWI.js} +5 -5
  54. package/dist/Gantt/GanttToolBar/index.js +15 -13
  55. package/dist/Gantt/{GanttToolBar-Bm_4cVHF.js → GanttToolBar-BTeTsR6Z.js} +4 -4
  56. package/dist/Gantt/{collapseKeys-_ShTXPKt.js → collapseKeys-B4SOVHjd.js} +2 -2
  57. package/dist/Gantt/index.js +27 -24
  58. package/dist/Gantt/{theme-CiMD9Y6i.js → theme-DLNvgM9X.js} +1 -1
  59. package/dist/Gantt/{timelineViewConfig-CLIpppp0.js → timelineViewConfig-9HArvbmb.js} +1 -1
  60. package/dist/Gantt/utils/index.js +6 -5
  61. package/dist/Gantt/utils/theme/index.js +2 -1
  62. package/dist/Icon/index.js +2 -1
  63. package/dist/InputTag/InputTag-hzCCJQ1z.js +144 -0
  64. package/dist/InputTag/index.js +7 -4
  65. package/dist/Loading/Loading-DiywS7ex.js +19 -0
  66. package/dist/Loading/index.js +4 -1
  67. package/dist/Modal/{Modal-GGHNlZv3.js → Modal-LiztSF7x.js} +1 -1
  68. package/dist/Modal/index.js +3 -2
  69. package/dist/NotFoundContent/index.js +2 -1
  70. package/dist/Radio/{Radio-CMAwZdP7.js → Radio-CX9cUqb7.js} +12 -12
  71. package/dist/Radio/index.js +2 -1
  72. package/dist/ScrollBar/{ScrollBar-CnwYQfXM.js → ScrollBar-QhXVe8zd.js} +1 -1
  73. package/dist/ScrollBar/index.js +3 -2
  74. package/dist/Segmented/{Segmented-Ck2ZmfF7.js → Segmented-BDz1hMDT.js} +1 -1
  75. package/dist/Segmented/index.js +2 -1
  76. package/dist/Select/{Select-CwABtVnS.js → Select-D6EK7whJ.js} +202 -201
  77. package/dist/Select/{SelectInputSearch-dfBUnTCY.js → SelectInputSearch-COUzreau.js} +2 -2
  78. package/dist/Select/index.js +15 -14
  79. package/dist/Table/{Table-ByNcMkaT.js → Table-yQXQEk6d.js} +5 -5
  80. package/dist/Table/hooks/index.js +2 -1
  81. package/dist/Table/{hooks-uCDY9dqx.js → hooks-BceUZQQm.js} +1 -1
  82. package/dist/Table/index.js +9 -8
  83. package/dist/Table/{processRowspan-nIGqGyHh.js → processRowspan-B0WELhG2.js} +1 -1
  84. package/dist/Table/style/index.js +2 -1
  85. package/dist/Table/{style-x9xfw6te.js → style-DgiPEsSp.js} +1 -1
  86. package/dist/Table/utils/index.js +2 -1
  87. package/dist/Tabs/Tabs-BiKW70CL.js +398 -0
  88. package/dist/Tabs/index.js +7 -4
  89. package/dist/Tooltip/{Tooltip-DWWWYn1a.js → Tooltip-Ch9lti_7.js} +1 -1
  90. package/dist/Tooltip/index.js +2 -1
  91. package/dist/Tree/index.js +5 -4
  92. package/dist/Tree/utils/index.js +1 -0
  93. package/dist/components/DropDown/interface.d.ts +167 -169
  94. package/dist/components/Editor/LengthBadge.d.ts +6 -0
  95. package/dist/components/Editor/ToolbarPlugin/BaseButton/BaseButton.d.ts +1 -1
  96. package/dist/components/Editor/ToolbarPlugin/ToolbarPlugin.d.ts +5 -1
  97. package/dist/components/Editor/ToolbarPlugin/context/EditorToolbarThemeContext.d.ts +6 -0
  98. package/dist/components/Editor/ToolbarPlugin/interface.d.ts +30 -32
  99. package/dist/components/Editor/index.d.ts +1 -1
  100. package/dist/components/Editor/interface.d.ts +118 -60
  101. package/dist/components/Editor/plugins/MaxLengthPlugin.d.ts +7 -0
  102. package/dist/components/Editor/utils/resolveEditorToolbarThemeVars.d.ts +5 -0
  103. package/dist/components/Editor/utils/textLength.d.ts +4 -0
  104. package/dist/components/InputTag/interface.d.ts +32 -32
  105. package/dist/components/Radio/interface.d.ts +95 -97
  106. package/dist/components/Tabs/TabSelect/interface.d.ts +23 -25
  107. package/dist/components/Tabs/interface.d.ts +58 -60
  108. package/dist/components/Tree/types/node.d.ts +19 -19
  109. package/dist/components/Tree/types/tree.d.ts +81 -83
  110. package/dist/components/index.d.ts +2 -0
  111. package/dist/index.js +54 -51
  112. package/dist/locale/index.d.ts +1 -1
  113. package/dist/locale/lang/en-US.json.d.ts +177 -166
  114. package/dist/locale/lang/zh-CN.json.d.ts +177 -166
  115. package/dist/locale/lang/zh-TW.json.d.ts +177 -166
  116. package/dist/style.css +1 -1
  117. package/dist/vendors/{ConfigProvider-AQTr7T_c.js → ConfigProvider-DxrZpdIb.js} +23 -1
  118. package/dist/vendors/{LocaleContext-CBcJzvUD.js → LocaleContext-Dcw6C1LX.js} +11 -0
  119. package/dist/vendors/{Tree-DMC_MSw1.js → Tree-DXmVRDn0.js} +10 -9
  120. package/dist/vendors/{useLocale-DZ8XW2VL.js → useLocale-BKZX2_zw.js} +1 -1
  121. package/dist/vendors/version-4HBYLKDL.js +6 -0
  122. package/dist/vite-env.d.ts +13 -10
  123. package/dist/vitest-matchers.d.ts +0 -1
  124. package/package.json +8 -8
  125. package/dist/InputTag/InputTag-25vFChWE.js +0 -143
  126. package/dist/Loading/Loading--cdn92gm.js +0 -15
  127. package/dist/Tabs/Tabs-ZRWBbBdF.js +0 -410
  128. package/dist/components/Amap/AmapMarker/__tests__/AmapMarker.test.d.ts +0 -1
  129. package/dist/components/Amap/AmapMarkerCluster/__tests__/AmapMarkerCluster.test.d.ts +0 -1
  130. package/dist/components/Amap/AmapProvider/__tests__/AmapProvider.test.d.ts +0 -1
  131. package/dist/components/Amap/__tests__/Amap.test.d.ts +0 -1
  132. package/dist/components/Amap/hooks/__tests__/useCurrentLocation.test.d.ts +0 -1
  133. package/dist/components/Calendar/__tests__/Calendar.contract.test.d.ts +0 -1
  134. package/dist/components/Calendar/__tests__/algorithm/monthLayoutAlgorithm.test.d.ts +0 -1
  135. package/dist/components/Calendar/subcomponents/DateDisplay/__tests__/DateDisplay.weekPicker.test.d.ts +0 -1
  136. package/dist/components/Calendar/subcomponents/DayView/__tests__/CalendarDay.dayFilter.test.d.ts +0 -1
  137. package/dist/components/Calendar/subcomponents/EventCard/__tests__/EventCard.tooltip.test.d.ts +0 -1
  138. package/dist/components/Calendar/utils/__tests__/dateUtils.test.d.ts +0 -1
  139. package/dist/components/Calendar/utils/__tests__/eventUtils.contract.test.d.ts +0 -1
  140. package/dist/components/Calendar/utils/__tests__/normalizeData.test.d.ts +0 -1
  141. package/dist/components/Calendar/utils/theme/__tests__/platformTheme.test.d.ts +0 -1
  142. package/dist/components/Calendar/utils/theme/__tests__/resolveCalendarThemeVars.test.d.ts +0 -1
  143. package/dist/components/Calendar/utils/theme/__tests__/resolveScheduleColorVars.test.d.ts +0 -1
  144. package/dist/components/Calendar/utils/theme/__tests__/resolveSubcomponentThemes.test.d.ts +0 -1
  145. package/dist/components/ConfigProvider/__tests__/ConfigProvider.test.d.ts +0 -1
  146. package/dist/components/DatePicker/__tests__/DatePicker.getPopupContainer.test.d.ts +0 -1
  147. package/dist/components/DatePicker/__tests__/DatePicker.triggerActiveClassName.test.d.ts +0 -1
  148. package/dist/components/DatePicker/__tests__/DatePickerPanel.dom.test.d.ts +0 -1
  149. package/dist/components/DatePicker/style/__tests__/resolveDatePickerThemeVars.test.d.ts +0 -1
  150. package/dist/components/DatePicker/utils/__tests__/normalizePickerValue.test.d.ts +0 -1
  151. package/dist/components/DropDown/__tests__/DropDown.test.d.ts +0 -1
  152. package/dist/components/DropDown/style/__tests__/resolveDropDownThemeVars.test.d.ts +0 -1
  153. package/dist/components/Gantt/GanttChart/OffscreenTaskIndicators/__tests__/OffscreenTaskIndicators.test.d.ts +0 -1
  154. package/dist/components/Gantt/GanttChart/hooks/__tests__/timelineFocus.contract.test.d.ts +0 -1
  155. package/dist/components/Gantt/GanttChart/hooks/__tests__/useGanttColumnVirtual.test.d.ts +0 -1
  156. package/dist/components/Gantt/GanttChart/hooks/__tests__/useGanttDrag.clippedQuarterMonth.test.d.ts +0 -0
  157. package/dist/components/Gantt/GanttChart/hooks/__tests__/useOffscreenIndicators.test.d.ts +0 -1
  158. package/dist/components/Gantt/GanttChart/hooks/__tests__/useTimelineViewportController.test.d.ts +0 -0
  159. package/dist/components/Gantt/GanttChart/utils/__tests__/dateRangeNormalizer.subday.test.d.ts +0 -1
  160. package/dist/components/Gantt/GanttChart/utils/__tests__/dragEngine.quarterMonth.test.d.ts +0 -1
  161. package/dist/components/Gantt/GanttChart/utils/__tests__/dragEngine.subday.test.d.ts +0 -1
  162. package/dist/components/Gantt/GanttChart/utils/__tests__/headerBuilder.quarterMonth.test.d.ts +0 -1
  163. package/dist/components/Gantt/GanttChart/utils/__tests__/headerBuilder.subday.test.d.ts +0 -1
  164. package/dist/components/Gantt/GanttChart/utils/__tests__/quarterMonthScale.test.d.ts +0 -1
  165. package/dist/components/Gantt/GanttChart/utils/__tests__/subdayScale.contract.test.d.ts +0 -1
  166. package/dist/components/Gantt/GanttChart/utils/__tests__/timelineMarkers.test.d.ts +0 -1
  167. package/dist/components/Gantt/GanttChart/utils/__tests__/timelineRange.test.d.ts +0 -1
  168. package/dist/components/Gantt/GanttChart/utils/__tests__/timelineViewConfig.test.d.ts +0 -1
  169. package/dist/components/Gantt/GanttChart/utils/__tests__/timelineViewportEngine.test.d.ts +0 -1
  170. package/dist/components/Gantt/__tests__/Gantt.contract.test.d.ts +0 -0
  171. package/dist/components/Gantt/__tests__/Gantt.grouped.contract.test.d.ts +0 -0
  172. package/dist/components/Gantt/__tests__/GanttBars.renderWindow.test.d.ts +0 -1
  173. package/dist/components/Gantt/__tests__/GanttChart.contract.test.d.ts +0 -0
  174. package/dist/components/Gantt/__tests__/GanttSummaryBar.tooltip.test.d.ts +0 -1
  175. package/dist/components/Gantt/__tests__/GanttToolBar.test.d.ts +0 -1
  176. package/dist/components/Gantt/__tests__/filterItemsByCollapse.test.d.ts +0 -1
  177. package/dist/components/Gantt/__tests__/interface.contract.types.test.d.ts +0 -1
  178. package/dist/components/Gantt/__tests__/timezoneUtils.test.d.ts +0 -1
  179. package/dist/components/Gantt/__tests__/useBarTooltipHover.test.d.ts +0 -1
  180. package/dist/components/Gantt/__tests__/useGanttHighlight.test.d.ts +0 -1
  181. package/dist/components/Gantt/__tests__/useTaskBarPointer.test.d.ts +0 -1
  182. package/dist/components/Gantt/utils/theme/__tests__/resolveGanttTheme.test.d.ts +0 -1
  183. package/dist/components/Gantt/utils/theme/__tests__/resolveGanttThemeVars.test.d.ts +0 -1
  184. package/dist/components/Gantt/utils/theme/__tests__/resolveTableThemeFromGantt.test.d.ts +0 -1
  185. package/dist/components/ScrollBar/__tests__/ScrollBar.test.d.ts +0 -1
  186. package/dist/components/Select/__tests__/Select.getPopupContainer.test.d.ts +0 -1
  187. package/dist/components/Select/__tests__/Select.optionDisabled.test.d.ts +0 -1
  188. package/dist/components/Table/__tests__/HeaderCell.test.d.ts +0 -1
  189. package/dist/components/Table/__tests__/TableBody.test.d.ts +0 -1
  190. package/dist/components/Table/__tests__/processRowspan.test.d.ts +0 -1
  191. package/dist/components/Table/style/__tests__/resolveTableThemeVars.test.d.ts +0 -1
  192. package/dist/components/Tooltip/__tests__/Tooltip.test.d.ts +0 -1
  193. package/dist/components/Tree/Tree.test.d.ts +0 -1
  194. package/dist/locale/__tests__/locale.test.d.ts +0 -1
  195. /package/dist/Amap/{AmapContext-CFmsMycg.js → AmapContext-D7Njjm5a.js} +0 -0
  196. /package/dist/Amap/{useMarkerInfoWindowController-BvP2jo7K.js → useMarkerInfoWindowController-BQmhR0N7.js} +0 -0
  197. /package/dist/Calendar/{TimeAxis-D7bgZDKs.js → TimeAxis-C9e2BdYs.js} +0 -0
  198. /package/dist/Calendar/{colorUtils-lXNjGoCk.js → colorUtils-CBLTsDX0.js} +0 -0
  199. /package/dist/Calendar/{context-CBJnz0IH.js → context-4tCN5X33.js} +0 -0
  200. /package/dist/Calendar/{layout-BglMom3m.js → layout-Dz-grtu9.js} +0 -0
  201. /package/dist/DatePicker/{ensureDayjsPlugins-CVL-fnAl.js → ensureDayjsPlugins-Cn9Bkjkj.js} +0 -0
  202. /package/dist/DatePicker/{pickerLocale-BeMlfhKu.js → pickerLocale-BRnNjLcv.js} +0 -0
  203. /package/dist/Gantt/{GanttHighlightContext-grda5bhd.js → GanttHighlightContext-ChThr8ia.js} +0 -0
  204. /package/dist/Gantt/{columnResize-DV1tSBx_.js → columnResize-jG0Wy2PC.js} +0 -0
  205. /package/dist/Gantt/{constants-BObDP0h6.js → constants-LIz5jwed.js} +0 -0
  206. /package/dist/Gantt/{highlightTarget-DrP0_NrM.js → highlightTarget-BpkYTonb.js} +0 -0
  207. /package/dist/Icon/{Icon-SQ5tu-yG.js → Icon-BBDcb-yw.js} +0 -0
  208. /package/dist/NotFoundContent/{NotFoundContent-J-TEnljc.js → NotFoundContent-BLmzWNBi.js} +0 -0
  209. /package/dist/ScrollBar/{style-B1NkMGtS.js → style-D26azwz6.js} +0 -0
  210. /package/dist/Table/{constants-CcwjDbe7.js → constants-kRpjsoet.js} +0 -0
  211. /package/dist/vendors/{animations-Mlw78WYo.js → animations-rwUbyoT0.js} +0 -0
  212. /package/dist/vendors/{color-BQYy0Wgy.js → color-D6XBXROa.js} +0 -0
  213. /package/dist/vendors/{cssVars-B8o94Yao.js → cssVars-BYg1matG.js} +0 -0
  214. /package/dist/vendors/{mergeRefs-Bai1cIzv.js → mergeRefs-Bsywq1Vo.js} +0 -0
  215. /package/dist/vendors/{useFloatingOverlay-WbbHmuT-.js → useFloatingOverlay-BApqkHSu.js} +0 -0
  216. /package/dist/vendors/{useFloatingPortal-C8V67X0v.js → useFloatingPortal-CmVJbuRm.js} +0 -0
  217. /package/dist/vendors/{useLatchedPopupPortalRoot-hwf14FJ5.js → useLatchedPopupPortalRoot-4fVhqVT4.js} +0 -0
  218. /package/dist/{components/Amap/AmapCircle/__tests__/AmapCircle.test.d.ts → version.d.ts} +0 -0
@@ -1,74 +1,91 @@
1
- import "../ScrollBar/style-B1NkMGtS.js";
2
- import "../Icon/Icon-SQ5tu-yG.js";
3
- import "../vendors/LocaleContext-CBcJzvUD.js";
4
- import "../Modal/Modal-GGHNlZv3.js";
5
- import "../ColorPicker/ColorPicker-Hjs4Vp5a.js";
6
- import "../vendors/useFloatingOverlay-WbbHmuT-.js";
7
- import "../vendors/useLocale-DZ8XW2VL.js";
8
- import "../vendors/color-BQYy0Wgy.js";
9
- import "../vendors/useLatchedPopupPortalRoot-hwf14FJ5.js";
10
- import "../Select/SelectInputSearch-dfBUnTCY.js";
11
- import "../CheckBox/CheckBox-D7bCjlkU.js";
12
- import "../CheckBox/CheckBox-GtT43IQ8.js";
13
- import "../NotFoundContent/NotFoundContent-J-TEnljc.js";
14
- import "../ScrollBar/ScrollBar-CnwYQfXM.js";
15
- import "../vendors/useFloatingPortal-C8V67X0v.js";
16
- import "../DropDown/DropDown-DYhDwsNm.js";
17
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s } from "./Buttons-D1fP8aYo.js";
18
- import { DEFAULT_BACKGROUND_COLOR as c, DEFAULT_FONT_COLOR as l, DEFAULT_FONT_SIZE as u } from "./constants/index.js";
19
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
20
- import m, { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
21
- import b from "clsx";
22
- import { LexicalComposer as x } from "@lexical/react/LexicalComposer";
23
- import { RichTextPlugin as S } from "@lexical/react/LexicalRichTextPlugin";
24
- import { ContentEditable as C } from "@lexical/react/LexicalContentEditable";
25
- import { HistoryPlugin as w } from "@lexical/react/LexicalHistoryPlugin";
26
- import { OnChangePlugin as T } from "@lexical/react/LexicalOnChangePlugin";
27
- import { LexicalErrorBoundary as E } from "@lexical/react/LexicalErrorBoundary";
28
- import { $generateHtmlFromNodes as D, $generateNodesFromDOM as O } from "@lexical/html";
29
- import { $applyNodeReplacement as ee, $createParagraphNode as te, $getNodeByKey as ne, $getRoot as re, $getRoot as k, $getSelection as A, $insertNodes as j, $isElementNode as M, $isRangeSelection as N, $isRootOrShadowRoot as ie, $isTextNode as P, COMMAND_PRIORITY_EDITOR as ae, COMMAND_PRIORITY_LOW as oe, DecoratorNode as se, KEY_ENTER_COMMAND as ce, TextNode as F } from "lexical";
30
- import { useLexicalComposerContext as I, useLexicalComposerContext as L } from "@lexical/react/LexicalComposerContext";
31
- import { $getSelectionStyleValueForProperty as R, $patchStyleText as z } from "@lexical/selection";
32
- import { $findMatchingParent as B } from "@lexical/utils";
33
- import { $isLinkNode as V, AutoLinkNode as H, LinkNode as U } from "@lexical/link";
34
- import { LinkPlugin as W } from "@lexical/react/LexicalLinkPlugin";
35
- //#region src/components/Editor/ToolbarPlugin/ToolbarPlugin.module.scss
36
- var G = {
37
- "bsy-lexical__toolbar": "_bsy-lexical__toolbar_n60av_1",
38
- "bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_n60av_9",
39
- "bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_n60av_15"
1
+ import "../vendors/version-4HBYLKDL.js";
2
+ import "../ScrollBar/style-D26azwz6.js";
3
+ import "../Icon/Icon-BBDcb-yw.js";
4
+ import "../vendors/LocaleContext-Dcw6C1LX.js";
5
+ import "../Modal/Modal-LiztSF7x.js";
6
+ import "../ColorPicker/ColorPicker-CL57cSDG.js";
7
+ import "../vendors/useFloatingOverlay-BApqkHSu.js";
8
+ import "../vendors/useLocale-BKZX2_zw.js";
9
+ import "../vendors/color-D6XBXROa.js";
10
+ import "../vendors/useLatchedPopupPortalRoot-4fVhqVT4.js";
11
+ import { t as e } from "../vendors/cssVars-BYg1matG.js";
12
+ import "../Select/SelectInputSearch-COUzreau.js";
13
+ import "../CheckBox/CheckBox-ByWSy9Yr.js";
14
+ import "../CheckBox/CheckBox-nBm0u6zX.js";
15
+ import "../NotFoundContent/NotFoundContent-BLmzWNBi.js";
16
+ import "../ScrollBar/ScrollBar-QhXVe8zd.js";
17
+ import "../vendors/useFloatingPortal-CmVJbuRm.js";
18
+ import "../DropDown/DropDown-yDH9V_9Y.js";
19
+ import "../DropDown/style-Fdp-U4md.js";
20
+ import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, u as l } from "./Buttons-BivKInBV.js";
21
+ import { DEFAULT_BACKGROUND_COLOR as u, DEFAULT_FONT_COLOR as d, DEFAULT_FONT_SIZE as f } from "./constants/index.js";
22
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
23
+ import g, { useCallback as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
24
+ import S from "clsx";
25
+ import { LexicalComposer as C } from "@lexical/react/LexicalComposer";
26
+ import { RichTextPlugin as w } from "@lexical/react/LexicalRichTextPlugin";
27
+ import { ContentEditable as T } from "@lexical/react/LexicalContentEditable";
28
+ import { HistoryPlugin as E } from "@lexical/react/LexicalHistoryPlugin";
29
+ import { OnChangePlugin as ee } from "@lexical/react/LexicalOnChangePlugin";
30
+ import { LexicalErrorBoundary as te } from "@lexical/react/LexicalErrorBoundary";
31
+ import { $generateHtmlFromNodes as ne, $generateNodesFromDOM as re } from "@lexical/html";
32
+ import { $applyNodeReplacement as D, $createParagraphNode as O, $getNodeByKey as k, $getRoot as ie, $getRoot as A, $getSelection as j, $insertNodes as M, $isElementNode as ae, $isRangeSelection as N, $isRootOrShadowRoot as oe, $isTextNode as se, COMMAND_PRIORITY_EDITOR as ce, COMMAND_PRIORITY_LOW as le, DecoratorNode as ue, KEY_ENTER_COMMAND as P, RootNode as F, TextNode as I } from "lexical";
33
+ import { useLexicalComposerContext as de, useLexicalComposerContext as L } from "@lexical/react/LexicalComposerContext";
34
+ import { $getSelectionStyleValueForProperty as R, $patchStyleText as fe, $trimTextContentFromAnchor as z } from "@lexical/selection";
35
+ import { $findMatchingParent as B, $restoreEditorState as V } from "@lexical/utils";
36
+ import { $isLinkNode as pe, AutoLinkNode as me, LinkNode as he } from "@lexical/link";
37
+ import { useLexicalEditable as ge } from "@lexical/react/useLexicalEditable";
38
+ import { LinkPlugin as _e } from "@lexical/react/LexicalLinkPlugin";
39
+ //#region src/components/Editor/utils/resolveEditorToolbarThemeVars.ts
40
+ var H = (e) => {
41
+ if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
42
+ }, ve = (t) => {
43
+ if (!t) return {};
44
+ let n = {};
45
+ return e(n, "--bsy-editor-toolbar-bg", t.bg), e(n, "--bsy-editor-toolbar-border-color", t.borderColor), e(n, "--bsy-editor-toolbar-padding", t.padding), e(n, "--bsy-editor-toolbar-gap", H(t.gap)), e(n, "--bsy-editor-toolbar-group-gap", H(t.groupGap)), e(n, "--bsy-editor-toolbar-divider-color", t.dividerColor), e(n, "--bsy-editor-toolbar-divider-size", H(t.dividerSize)), e(n, "--bsy-editor-toolbar-divider-margin", H(t.dividerMargin)), e(n, "--bsy-editor-toolbar-color-icon", t.colorIcon), e(n, "--bsy-editor-toolbar-item-hover-bg", t.itemHoverBg), e(n, "--bsy-editor-toolbar-item-hover-color", t.itemHoverColor), e(n, "--bsy-editor-toolbar-item-active-bg", t.itemActiveBg), e(n, "--bsy-editor-toolbar-item-active-color", t.itemActiveColor), e(n, "--bsy-editor-toolbar-item-padding", H(t.itemPadding)), e(n, "--bsy-editor-toolbar-item-border-radius", H(t.itemBorderRadius)), e(n, "--bsy-editor-toolbar-icon-size", H(t.iconSize)), n;
46
+ }, U = (e) => {
47
+ if (typeof e == "number" && Number.isFinite(e)) return e;
48
+ if (typeof e == "string") {
49
+ let t = Number.parseFloat(e);
50
+ if (Number.isFinite(t)) return t;
51
+ }
52
+ return 14;
53
+ }, W = {
54
+ "bsy-lexical__toolbar": "_bsy-lexical__toolbar_1tygc_1",
55
+ "bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_1tygc_10",
56
+ "bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_1tygc_16"
40
57
  };
41
58
  //#endregion
42
59
  //#region src/components/Editor/hooks/useTextFormatsState.ts
43
- function le() {
44
- let [e] = L(), [t, n] = y({
60
+ function ye() {
61
+ let [e] = L(), [t, n] = x({
45
62
  bold: !1,
46
63
  italic: !1,
47
64
  underline: !1,
48
- fontSize: u,
49
- fontColor: l,
50
- backgroundColor: c,
65
+ fontSize: f,
66
+ fontColor: d,
67
+ backgroundColor: u,
51
68
  align: "left",
52
69
  link: void 0
53
70
  });
54
- return g(() => e.registerUpdateListener(({ editorState: e }) => {
71
+ return v(() => e.registerUpdateListener(({ editorState: e }) => {
55
72
  e.read(() => {
56
- let e = A();
73
+ let e = j();
57
74
  if (N(e)) {
58
- let t = R(e, "font-size", u), r = R(e, "color", l), i = R(e, "background-color", c), a = e.anchor.getNode(), o = a.getKey() === "root" ? a : B(a, (e) => {
75
+ let t = R(e, "font-size", f), r = R(e, "color", d), i = R(e, "background-color", u), a = e.anchor.getNode(), o = a.getKey() === "root" ? a : B(a, (e) => {
59
76
  let t = e.getParent();
60
- return t !== null && ie(t);
77
+ return t !== null && oe(t);
61
78
  });
62
79
  o === null && (o = a.getTopLevelElementOrThrow());
63
- let s = {}, d = B(a, V);
64
- d ? (s.link = d.getURL(), s.linkText = d.getTextContent(), s.newBlank = d.getTarget() === "_blank") : s.linkText = e.getTextContent(), n({
80
+ let s = {}, c = B(a, pe);
81
+ c ? (s.link = c.getURL(), s.linkText = c.getTextContent(), s.newBlank = c.getTarget() === "_blank") : s.linkText = e.getTextContent(), n({
65
82
  bold: e.hasFormat("bold"),
66
83
  italic: e.hasFormat("italic"),
67
84
  underline: e.hasFormat("underline"),
68
85
  fontSize: t,
69
86
  fontColor: r,
70
87
  backgroundColor: i,
71
- align: M(o) ? o.getFormatType() : "left",
88
+ align: ae(o) ? o.getFormatType() : "left",
72
89
  link: s
73
90
  });
74
91
  }
@@ -77,30 +94,39 @@ function le() {
77
94
  }
78
95
  //#endregion
79
96
  //#region src/components/Editor/ToolbarPlugin/context/TextFormatProvider.tsx
80
- var ue = (e) => {
81
- let t = le();
82
- return /* @__PURE__ */ f(r.Provider, {
97
+ var be = (e) => {
98
+ let t = ye();
99
+ return /* @__PURE__ */ m(l.Provider, {
83
100
  value: t,
84
101
  children: e.children
85
102
  });
86
- }, de = (e) => {
87
- let { config: t = [], style: n } = e, r = (e, t) => {
88
- let n = typeof e == "string" ? e : e.name, r = i(n);
89
- return r ? typeof e == "string" ? /* @__PURE__ */ f(r, {}, `${n}-${t}`) : /* @__PURE__ */ f(r, { ...e.props }, `${n}-${t}`) : (console.warn(`[ToolbarPlugin] Button "${n}" is not registered.`), null);
103
+ }, xe = (e) => {
104
+ let { config: t = [], style: n, theme: r } = e, o = y(() => ve(r), [r]), s = y(() => ({ iconSize: U(r?.iconSize) }), [r?.iconSize]), c = (e, t) => {
105
+ let n = typeof e == "string" ? e : e.name, r = a(n);
106
+ return r ? typeof e == "string" ? /* @__PURE__ */ m(r, {}, `${n}-${t}`) : /* @__PURE__ */ m(r, { ...e.props }, `${n}-${t}`) : (console.warn(`[ToolbarPlugin] Button "${n}" is not registered.`), null);
90
107
  };
91
- return /* @__PURE__ */ f(ue, { children: /* @__PURE__ */ f("div", {
92
- className: G["bsy-lexical__toolbar"],
93
- style: n,
94
- children: t.map((e, n) => /* @__PURE__ */ p("div", {
95
- className: G["bsy-lexical__toolbar-group"],
96
- "data-group": e.key,
97
- children: [e.buttons.map((e, t) => r(e, t)), n < t.length - 1 && /* @__PURE__ */ f("div", { className: G["bsy-lexical__toolbar-divider"] })]
98
- }, e.key + n))
99
- }) });
108
+ return /* @__PURE__ */ m(i, {
109
+ value: s,
110
+ children: /* @__PURE__ */ m(be, { children: /* @__PURE__ */ m("div", {
111
+ className: W["bsy-lexical__toolbar"],
112
+ style: {
113
+ ...o,
114
+ ...n
115
+ },
116
+ children: t.map((e, n) => /* @__PURE__ */ h("div", {
117
+ className: W["bsy-lexical__toolbar-group"],
118
+ "data-group": e.key,
119
+ children: [e.buttons.map((e, t) => c(e, t)), n < t.length - 1 && /* @__PURE__ */ m("div", { className: W["bsy-lexical__toolbar-divider"] })]
120
+ }, e.key + n))
121
+ }) })
122
+ });
123
+ }, G = {
124
+ "bsy-lexical-editor": "_bsy-lexical-editor_tsu2x_1",
125
+ "bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_tsu2x_7",
126
+ "bsy-lexical-editor__content-editable--with-length-badge": "_bsy-lexical-editor__content-editable--with-length-badge_tsu2x_14",
127
+ "bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_tsu2x_17",
128
+ "bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_tsu2x_33"
100
129
  }, K = {
101
- "bsy-lexical-editor": "_bsy-lexical-editor_19ssw_1",
102
- "bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_19ssw_6"
103
- }, q = {
104
130
  imageWrapper: "_imageWrapper_y06h3_1",
105
131
  selected: "_selected_y06h3_8",
106
132
  resizing: "_resizing_y06h3_12",
@@ -110,19 +136,19 @@ var ue = (e) => {
110
136
  topRight: "_topRight_y06h3_49",
111
137
  bottomLeft: "_bottomLeft_y06h3_54",
112
138
  bottomRight: "_bottomRight_y06h3_59"
113
- }, fe = ({ src: e, altText: t, width: n, height: r, nodeKey: i }) => {
114
- let [a] = L(), [o, s] = y(!1), [c, l] = y(null), u = v(null), [_, x] = y({
139
+ }, Se = ({ src: e, altText: t, width: n, height: r, nodeKey: i }) => {
140
+ let [a] = L(), [o, s] = x(!1), [c, l] = x(null), u = b(null), [d, f] = x({
115
141
  width: n || void 0,
116
142
  height: r || void 0
117
- }), S = h(() => {
118
- n && r && x({
143
+ }), y = _(() => {
144
+ n && r && f({
119
145
  width: n,
120
146
  height: r
121
147
  });
122
- }, [n, r]), C = h((e, t) => {
148
+ }, [n, r]), C = _((e, t) => {
123
149
  if (e.preventDefault(), e.stopPropagation(), !u.current) return;
124
- let n = _.width || u.current.offsetWidth, r = _.height || u.current.offsetHeight, i = n / r;
125
- (!_.width || !_.height) && x({
150
+ let n = d.width || u.current.offsetWidth, r = d.height || u.current.offsetHeight, i = n / r;
151
+ (!d.width || !d.height) && f({
126
152
  width: n,
127
153
  height: r
128
154
  }), l({
@@ -134,7 +160,7 @@ var ue = (e) => {
134
160
  aspectRatio: i,
135
161
  direction: t
136
162
  });
137
- }, [_]), w = h((e) => {
163
+ }, [d]), w = _((e) => {
138
164
  if (!c?.isResizing) return;
139
165
  let t = e.clientX - c.startX, n;
140
166
  switch (c.direction) {
@@ -153,22 +179,22 @@ var ue = (e) => {
153
179
  default: n = Math.max(50, c.startWidth + t);
154
180
  }
155
181
  let r = n / c.aspectRatio;
156
- x({
182
+ f({
157
183
  width: n,
158
184
  height: r
159
185
  });
160
- }, [c]), T = h(() => {
186
+ }, [c]), T = _(() => {
161
187
  c?.isResizing && (a.update(() => {
162
- let e = ne(i);
163
- pe(e) && e.setWidthAndHeight(_.width, _.height);
188
+ let e = k(i);
189
+ Ce(e) && e.setWidthAndHeight(d.width, d.height);
164
190
  }), l(null));
165
191
  }, [
166
192
  a,
167
193
  i,
168
- _,
194
+ d,
169
195
  c
170
196
  ]);
171
- m.useEffect(() => {
197
+ g.useEffect(() => {
172
198
  if (c?.isResizing) return document.addEventListener("mousemove", w), document.addEventListener("mouseup", T), () => {
173
199
  document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", T);
174
200
  };
@@ -177,62 +203,62 @@ var ue = (e) => {
177
203
  w,
178
204
  T
179
205
  ]);
180
- let E = h(() => {
206
+ let E = _(() => {
181
207
  s(!0);
182
208
  }, []);
183
- return g(() => a.registerUpdateListener(({ editorState: e }) => {
209
+ return v(() => a.registerUpdateListener(({ editorState: e }) => {
184
210
  e.read(() => {
185
- let e = A();
211
+ let e = j();
186
212
  N(e) && !e.getNodes().some((e) => e.getKey() === i || e.getParent() && e.getParent()?.getKey() === i) && o && s(!1);
187
213
  });
188
214
  }), [
189
215
  a,
190
216
  i,
191
217
  o
192
- ]), g(() => {
218
+ ]), v(() => {
193
219
  let e = (e) => {
194
220
  o && u.current && !u.current.contains(e.target) && s(!1);
195
221
  };
196
222
  if (o) return document.addEventListener("mousedown", e), () => {
197
223
  document.removeEventListener("mousedown", e);
198
224
  };
199
- }, [o]), /* @__PURE__ */ p("div", {
200
- className: b(q.imageWrapper, {
201
- [q.selected]: o,
202
- [q.resizing]: c?.isResizing
225
+ }, [o]), /* @__PURE__ */ h("div", {
226
+ className: S(K.imageWrapper, {
227
+ [K.selected]: o,
228
+ [K.resizing]: c?.isResizing
203
229
  }),
204
- children: [/* @__PURE__ */ f("img", {
230
+ children: [/* @__PURE__ */ m("img", {
205
231
  ref: u,
206
232
  src: e,
207
233
  alt: t,
208
- className: q.image,
234
+ className: K.image,
209
235
  style: {
210
- width: _.width,
211
- height: _.height
236
+ width: d.width,
237
+ height: d.height
212
238
  },
213
- onLoad: S,
239
+ onLoad: y,
214
240
  onClick: E,
215
241
  draggable: !1
216
- }), o && /* @__PURE__ */ p(d, { children: [
217
- /* @__PURE__ */ f("div", {
218
- className: b(q.resizeHandle, q.bottomRight),
242
+ }), o && /* @__PURE__ */ h(p, { children: [
243
+ /* @__PURE__ */ m("div", {
244
+ className: S(K.resizeHandle, K.bottomRight),
219
245
  onMouseDown: (e) => C(e, "bottom-right")
220
246
  }),
221
- /* @__PURE__ */ f("div", {
222
- className: b(q.resizeHandle, q.bottomLeft),
247
+ /* @__PURE__ */ m("div", {
248
+ className: S(K.resizeHandle, K.bottomLeft),
223
249
  onMouseDown: (e) => C(e, "bottom-left")
224
250
  }),
225
- /* @__PURE__ */ f("div", {
226
- className: b(q.resizeHandle, q.topRight),
251
+ /* @__PURE__ */ m("div", {
252
+ className: S(K.resizeHandle, K.topRight),
227
253
  onMouseDown: (e) => C(e, "top-right")
228
254
  }),
229
- /* @__PURE__ */ f("div", {
230
- className: b(q.resizeHandle, q.topLeft),
255
+ /* @__PURE__ */ m("div", {
256
+ className: S(K.resizeHandle, K.topLeft),
231
257
  onMouseDown: (e) => C(e, "top-left")
232
258
  })
233
259
  ] })]
234
260
  });
235
- }, J = class e extends se {
261
+ }, q = class e extends ue {
236
262
  static getType() {
237
263
  return "image";
238
264
  }
@@ -278,7 +304,7 @@ var ue = (e) => {
278
304
  n.__width = e, n.__height = t;
279
305
  }
280
306
  decorate() {
281
- return /* @__PURE__ */ f(fe, {
307
+ return /* @__PURE__ */ m(Se, {
282
308
  src: this.__src,
283
309
  altText: this.__altText,
284
310
  width: this.__width,
@@ -288,13 +314,13 @@ var ue = (e) => {
288
314
  }
289
315
  static importDOM() {
290
316
  return { img: () => ({
291
- conversion: me,
317
+ conversion: we,
292
318
  priority: 0
293
319
  }) };
294
320
  }
295
321
  static importJSON(e) {
296
322
  let { src: t, altText: n, width: r, height: i } = e;
297
- return Y({
323
+ return J({
298
324
  src: t,
299
325
  altText: n,
300
326
  width: r,
@@ -315,13 +341,13 @@ var ue = (e) => {
315
341
  return !0;
316
342
  }
317
343
  };
318
- function Y({ src: e, altText: t, width: n, height: r, key: i }) {
319
- return new J(e, t, n, r, i);
344
+ function J({ src: e, altText: t, width: n, height: r, key: i }) {
345
+ return new q(e, t, n, r, i);
320
346
  }
321
- function pe(e) {
322
- return e instanceof J;
347
+ function Ce(e) {
348
+ return e instanceof q;
323
349
  }
324
- function me(e) {
350
+ function we(e) {
325
351
  if (e instanceof HTMLImageElement) {
326
352
  let { src: t, alt: n, style: r } = e, i, a;
327
353
  if (r.width) {
@@ -332,7 +358,7 @@ function me(e) {
332
358
  let e = parseInt(r.height, 10);
333
359
  isNaN(e) || (a = e);
334
360
  }
335
- return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: Y({
361
+ return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: J({
336
362
  src: t,
337
363
  altText: n,
338
364
  width: i,
@@ -343,23 +369,23 @@ function me(e) {
343
369
  }
344
370
  //#endregion
345
371
  //#region src/components/Editor/plugins/ImagePlugin.tsx
346
- function he() {
372
+ function Te() {
347
373
  let [e] = L();
348
- return g(() => e.registerCommand(a, (e) => (j([Y(e)]), !0), ae), [e]), null;
374
+ return v(() => e.registerCommand(o, (e) => (M([J(e)]), !0), ce), [e]), null;
349
375
  }
350
376
  //#endregion
351
377
  //#region src/components/Editor/plugins/EnterKeyPlugin.tsx
352
- function ge() {
353
- let [e] = L(), t = v(0);
354
- return g(() => e.registerCommand(ce, (n) => {
378
+ function Ee() {
379
+ let [e] = L(), t = b(0);
380
+ return v(() => e.registerCommand(P, (n) => {
355
381
  let r = Date.now(), i = r - t.current;
356
382
  return t.current = r, i < 250 && i > 0 ? (e.update(() => {
357
- let e = A();
383
+ let e = j();
358
384
  if (N(e)) {
359
385
  let t = e.anchor.getNode().getTopLevelElement();
360
386
  if (t && t.getTextContent().trim() === "") {
361
- let n = te();
362
- z(e, {
387
+ let n = O();
388
+ fe(e, {
363
389
  "background-color": "",
364
390
  color: "",
365
391
  "font-size": "",
@@ -372,57 +398,143 @@ function ge() {
372
398
  }
373
399
  }
374
400
  }), n?.preventDefault(), !0) : !1;
375
- }, oe), [e]), null;
401
+ }, le), [e]), null;
402
+ }
403
+ //#endregion
404
+ //#region src/components/Editor/plugins/MaxLengthPlugin.tsx
405
+ function De({ maxLength: e, onMaxLengthExceed: t }) {
406
+ let [n] = L(), r = b(t);
407
+ return r.current = t, v(() => {
408
+ let t = null;
409
+ return n.registerNodeTransform(F, (i) => {
410
+ let a = i.getTextContentSize();
411
+ if (a <= e) return;
412
+ let o = n.getEditorState(), s = o.read(() => i.getTextContentSize()), c = a - e, l = j();
413
+ if (s === e && t !== o) {
414
+ t = o, V(n, o), r.current?.();
415
+ return;
416
+ }
417
+ if (N(l) && l.isCollapsed()) {
418
+ z(n, l.anchor, c), r.current?.();
419
+ return;
420
+ }
421
+ i.selectEnd();
422
+ let u = j();
423
+ N(u) && (z(n, u.anchor, c), r.current?.());
424
+ });
425
+ }, [n, e]), null;
426
+ }
427
+ //#endregion
428
+ //#region src/components/Editor/LengthBadge.tsx
429
+ var Y = ({ current: e, maxLength: t }) => {
430
+ let n = e > t;
431
+ return /* @__PURE__ */ h("div", {
432
+ className: S(G["bsy-lexical-editor__length-badge"], n && G["bsy-lexical-editor__length-badge--exceeded"]),
433
+ "aria-live": "polite",
434
+ children: [
435
+ e,
436
+ "/",
437
+ t
438
+ ]
439
+ });
440
+ };
441
+ Y.displayName = "BsyLexicalEditorLengthBadge";
442
+ //#endregion
443
+ //#region src/components/Editor/utils/textLength.ts
444
+ function Oe(e) {
445
+ return typeof e == "number" && Number.isFinite(e) && e > 0;
446
+ }
447
+ function ke(e, t) {
448
+ let n = A(), r = n.getTextContentSize();
449
+ if (r <= t) return !1;
450
+ let i = r - t;
451
+ n.selectEnd();
452
+ let a = j();
453
+ return N(a) ? z(e, a.anchor, i) : Ae(i), !0;
454
+ }
455
+ function Ae(e) {
456
+ let t = e, n = A().getAllTextNodes();
457
+ for (let e = n.length - 1; e >= 0 && t > 0; e--) {
458
+ let r = n[e], i = r.getTextContent();
459
+ i.length !== 0 && (i.length <= t ? (t -= i.length, r.remove()) : (r.setTextContent(i.slice(0, i.length - t)), t = 0));
460
+ }
376
461
  }
377
462
  //#endregion
378
463
  //#region src/components/Editor/EditorCore.tsx
379
464
  var X = (e) => {
380
- let { height: t = 126, onChange: n, toolbar: r } = e, [i] = L(), a = v(null), o = v(null), c = _(() => ({
381
- containerRef: a,
382
- getPopupContainer: () => a.current || document.body
383
- }), []), l = h((e) => {
465
+ let { height: t = 126, onChange: n, toolbar: r, theme: i, maxLength: a, onMaxLengthExceed: o } = e, [s] = L(), l = b(null), u = b(null), d = b(o);
466
+ d.current = o;
467
+ let f = Oe(a) ? a : void 0, [p, g] = x(0), C = y(() => ({
468
+ containerRef: l,
469
+ getPopupContainer: () => l.current || document.body
470
+ }), []), D = _((e) => {
384
471
  e.read(() => {
385
- let t = k().getTextContent(), r = D(i, null), a = !t.trim() && (r === "<p><br></p>" || r === "<p></p>" || r === "" || /^<p>\s*<br>\s*<\/p>$/.test(r)) ? null : r;
386
- o.current = a, n({
472
+ let t = A().getTextContent(), r = ne(s, null), i = !t.trim() && (r === "<p><br></p>" || r === "<p></p>" || r === "" || /^<p>\s*<br>\s*<\/p>$/.test(r)) ? null : r;
473
+ u.current = i, f !== void 0 && g(t.length), n({
387
474
  text: t,
388
- html: a
475
+ html: i
389
476
  }, e);
390
- });
391
- }, [n, i]);
392
- g(() => {
393
- e.value !== void 0 && e.value !== o.current && i.update(() => {
394
- k().clear(), e.value && e.value.trim() && j(O(i, new DOMParser().parseFromString(e.value, "text/html")));
395
- });
396
- }, [e.value, i]);
397
- let u = r?.config?.length ? r?.config : [], d = i.isEditable();
398
- return /* @__PURE__ */ f(s.Provider, {
399
- value: c,
400
- children: /* @__PURE__ */ p("div", {
401
- ref: a,
402
- className: K["bsy-lexical-editor"],
403
- onClick: () => {
404
- d || (i.setEditable(!0), i.focus(() => {}, { defaultSelection: "rootEnd" }));
477
+ }, { editor: s });
478
+ }, [
479
+ n,
480
+ s,
481
+ f
482
+ ]);
483
+ v(() => {
484
+ f !== void 0 && s.getEditorState().read(() => {
485
+ g(A().getTextContentSize());
486
+ }, { editor: s });
487
+ }, [s, f]), v(() => {
488
+ if (e.value !== void 0 && e.value !== u.current) {
489
+ let t = !1;
490
+ s.update(() => {
491
+ A().clear(), e.value && e.value.trim() && (M(re(s, new DOMParser().parseFromString(e.value, "text/html"))), f !== void 0 && (t = ke(s, f)));
492
+ }), t && d.current?.();
493
+ }
494
+ }, [
495
+ e.value,
496
+ s,
497
+ f
498
+ ]);
499
+ let O = r?.config?.length ? r?.config : [], k = ge();
500
+ return /* @__PURE__ */ m(c.Provider, {
501
+ value: C,
502
+ children: /* @__PURE__ */ h("div", {
503
+ ref: l,
504
+ className: G["bsy-lexical-editor"],
505
+ onClick: (e) => {
506
+ let t = s.getRootElement(), n = e.target;
507
+ !t || !n || !t.contains(n) || s.isEditable() || s.setEditable(!0);
405
508
  },
406
509
  children: [
407
- u.length > 0 && /* @__PURE__ */ f(de, {
408
- config: u,
409
- style: { ...r?.style }
510
+ O.length > 0 && /* @__PURE__ */ m(xe, {
511
+ config: O,
512
+ theme: i?.toolbar,
513
+ style: r?.style
410
514
  }),
411
- /* @__PURE__ */ f(S, {
412
- contentEditable: /* @__PURE__ */ f(C, {
413
- className: K["bsy-lexical-editor__content-editable"],
515
+ /* @__PURE__ */ m(w, {
516
+ contentEditable: /* @__PURE__ */ m(T, {
517
+ className: S(G["bsy-lexical-editor__content-editable"], f !== void 0 && G["bsy-lexical-editor__content-editable--with-length-badge"]),
414
518
  style: {
415
519
  height: t,
416
- cursor: d ? "auto" : "text"
520
+ cursor: k ? "auto" : "text"
417
521
  }
418
522
  }),
419
- ErrorBoundary: E
523
+ ErrorBoundary: te
524
+ }),
525
+ /* @__PURE__ */ m(_e, {}),
526
+ /* @__PURE__ */ m(Te, {}),
527
+ /* @__PURE__ */ m(Ee, {}),
528
+ f !== void 0 && /* @__PURE__ */ m(De, {
529
+ maxLength: f,
530
+ onMaxLengthExceed: o
420
531
  }),
421
- /* @__PURE__ */ f(W, {}),
422
- /* @__PURE__ */ f(he, {}),
423
- /* @__PURE__ */ f(ge, {}),
424
- /* @__PURE__ */ f(w, {}),
425
- /* @__PURE__ */ f(T, { onChange: l })
532
+ /* @__PURE__ */ m(E, {}),
533
+ /* @__PURE__ */ m(ee, { onChange: D }),
534
+ f !== void 0 && /* @__PURE__ */ m(Y, {
535
+ current: p,
536
+ maxLength: f
537
+ })
426
538
  ]
427
539
  })
428
540
  });
@@ -430,7 +542,7 @@ var X = (e) => {
430
542
  X.displayName = "BsyLexicalEditorCore";
431
543
  //#endregion
432
544
  //#region src/components/Editor/nodes/ExtendedTextNode.tsx
433
- var Z = class e extends F {
545
+ var Z = class e extends I {
434
546
  constructor(e, t) {
435
547
  super(e, t);
436
548
  }
@@ -441,7 +553,7 @@ var Z = class e extends F {
441
553
  return new e(t.__text, t.__key);
442
554
  }
443
555
  static importDOM() {
444
- let e = F.importDOM();
556
+ let e = I.importDOM();
445
557
  return {
446
558
  ...e,
447
559
  code: () => ({
@@ -471,14 +583,14 @@ var Z = class e extends F {
471
583
  };
472
584
  }
473
585
  static importJSON(e) {
474
- return _e().updateFromJSON(e);
586
+ return je().updateFromJSON(e);
475
587
  }
476
588
  isSimpleText() {
477
589
  return this.__type === "extended-text" && this.__mode === 0;
478
590
  }
479
591
  };
480
- function _e(e = "") {
481
- return ee(new Z(e));
592
+ function je(e = "") {
593
+ return D(new Z(e));
482
594
  }
483
595
  function Q(e) {
484
596
  return (t) => {
@@ -491,7 +603,7 @@ function Q(e) {
491
603
  ...r,
492
604
  forChild: (e, t) => {
493
605
  let n = (r?.forChild ?? ((e) => e))(e, t);
494
- if (P(n)) {
606
+ if (se(n)) {
495
607
  let e = [
496
608
  i ? `background-color: ${i}` : null,
497
609
  a ? `color: ${a}` : null,
@@ -511,8 +623,8 @@ function Q(e) {
511
623
  //#region src/components/Editor/Editor.tsx
512
624
  var $ = (e) => {
513
625
  let { autoFocus: t = !1 } = e;
514
- return /* @__PURE__ */ f(x, {
515
- initialConfig: _(() => ({
626
+ return /* @__PURE__ */ m(C, {
627
+ initialConfig: y(() => ({
516
628
  namespace: "bsyLexicalEditor",
517
629
  onError: (e) => {
518
630
  console.error("Lexical error", e);
@@ -527,20 +639,20 @@ var $ = (e) => {
527
639
  link: "editor-link"
528
640
  },
529
641
  nodes: [
530
- U,
531
- H,
532
- J,
642
+ he,
643
+ me,
644
+ q,
533
645
  Z,
534
646
  {
535
- replace: F,
647
+ replace: I,
536
648
  with: (e) => new Z(e.__text),
537
649
  withKlass: Z
538
650
  }
539
651
  ]
540
652
  }), [t]),
541
- children: /* @__PURE__ */ f(X, { ...e })
653
+ children: /* @__PURE__ */ m(X, { ...e })
542
654
  });
543
655
  };
544
656
  $.displayName = "BsyLexicalEditor";
545
657
  //#endregion
546
- export { re as $getRoot, t as BaseButton, $ as default, o as listRegisteredToolbarButtons, n as registerToolbarButton, e as unregisterToolbarButton, I as useLexicalComposerContext };
658
+ export { ie as $getRoot, n as BaseButton, $ as default, s as listRegisteredToolbarButtons, r as registerToolbarButton, t as unregisterToolbarButton, de as useLexicalComposerContext };