@memobit/libs 3.0.0 → 3.1.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 (300) hide show
  1. package/dist/components/Accordion/Accordion.css +1 -0
  2. package/dist/components/Accordion/Accordion2.js +79 -0
  3. package/dist/components/AlertDialog/AlertDialog.css +1 -0
  4. package/dist/components/AlertDialog/AlertDialog2.js +26 -0
  5. package/dist/components/AnalogClock/AnalogClock.css +1 -0
  6. package/dist/components/AnalogClock/AnalogClock2.js +293 -0
  7. package/dist/components/AngleSlider/AngleSlider.css +1 -0
  8. package/dist/components/AngleSlider/AngleSlider2.js +135 -0
  9. package/dist/components/AppHeader/AppHeader.css +1 -0
  10. package/dist/components/AppHeader/AppHeader2.js +44 -0
  11. package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal.css +1 -0
  12. package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal2.js +138 -0
  13. package/dist/components/Auth/Login/Login.css +1 -0
  14. package/dist/components/Auth/Login/Login2.js +155 -0
  15. package/dist/components/Auth/MfaSetupModal/MfaSetupModal.css +1 -0
  16. package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +327 -0
  17. package/dist/components/AvatarInitials/AvatarInitials.css +1 -0
  18. package/dist/components/AvatarInitials/AvatarInitials2.js +73 -0
  19. package/dist/components/BMI/BMI.css +1 -0
  20. package/dist/components/BMI/BMI2.js +53 -0
  21. package/dist/components/BMI/bmiUtils.js +265 -0
  22. package/dist/components/Badge/Badge.css +1 -0
  23. package/dist/components/Badge/Badge2.js +30 -0
  24. package/dist/components/Banner/Banner.css +1 -0
  25. package/dist/components/Banner/Banner2.js +57 -0
  26. package/dist/components/Blockquote/Blockquote.css +1 -0
  27. package/dist/components/Blockquote/Blockquote2.js +55 -0
  28. package/dist/components/Breadcrumb/Breadcrumb.css +1 -0
  29. package/dist/components/Breadcrumb/Breadcrumb2.js +36 -0
  30. package/dist/components/BulkActionBar/BulkActionBar.css +1 -0
  31. package/dist/components/BulkActionBar/BulkActionBar2.js +39 -0
  32. package/dist/components/Button/Button.css +1 -0
  33. package/dist/components/Button/Button2.js +32 -0
  34. package/dist/components/Calendar/Calendar.css +1 -0
  35. package/dist/components/Calendar/Calendar2.js +279 -0
  36. package/dist/components/CalendarHeatmap/CalendarHeatmap.css +1 -0
  37. package/dist/components/CalendarHeatmap/CalendarHeatmap2.js +91 -0
  38. package/dist/components/Card/Card.css +1 -0
  39. package/dist/components/Card/Card2.js +47 -0
  40. package/dist/components/Checkbox/Checkbox.css +1 -0
  41. package/dist/components/Checkbox/Checkbox2.js +35 -0
  42. package/dist/components/Chip/Chip.css +1 -0
  43. package/dist/components/Chip/Chip2.js +31 -0
  44. package/dist/components/CollapsibleSection/CollapsibleSection.css +1 -0
  45. package/dist/components/CollapsibleSection/CollapsibleSection2.js +68 -0
  46. package/dist/components/ColorPicker/ColorPicker.css +1 -0
  47. package/dist/components/ColorPicker/ColorPicker2.js +257 -0
  48. package/dist/components/CommandPalette/CommandPalette.css +1 -0
  49. package/dist/components/CommandPalette/CommandPalette2.js +97 -0
  50. package/dist/components/Confetti/Confetti.css +1 -0
  51. package/dist/components/Confetti/Confetti2.js +175 -0
  52. package/dist/components/ConfirmDialog/ConfirmDialog.css +1 -0
  53. package/dist/components/ConfirmDialog/ConfirmDialog2.js +37 -0
  54. package/dist/components/ConfirmPopover/ConfirmPopover.css +1 -0
  55. package/dist/components/ConfirmPopover/ConfirmPopover2.js +55 -0
  56. package/dist/components/ContextMenu/ContextMenu.css +1 -0
  57. package/dist/components/ContextMenu/ContextMenu2.js +53 -0
  58. package/dist/components/ContextToast/ContextToast.css +1 -0
  59. package/dist/components/ContextToast/ContextToast2.js +96 -0
  60. package/dist/components/ControlPanel/ControlPanel.css +1 -0
  61. package/dist/components/ControlPanel/ControlPanel.types.js +21 -0
  62. package/dist/components/ControlPanel/ControlPanel2.js +137 -0
  63. package/dist/components/ControlPanel/ControlPanelContext.js +31 -0
  64. package/dist/components/ControlPanel/ControlPanelFilter.js +386 -0
  65. package/dist/components/ControlPanel/ControlPanelNav.js +74 -0
  66. package/dist/components/ControlPanel/ControlPanelOptions.js +197 -0
  67. package/dist/components/CopyButton/CopyButton.css +1 -0
  68. package/dist/components/CopyButton/CopyButton2.js +48 -0
  69. package/dist/components/CountryWithFlag/CountryWithFlag.css +1 -0
  70. package/dist/components/CountryWithFlag/CountryWithFlag2.js +21 -0
  71. package/dist/components/DataView/DataView.CardView.js +189 -0
  72. package/dist/components/DataView/DataView.ColumnSelector.js +51 -0
  73. package/dist/components/DataView/DataView.MiniSort.js +25 -0
  74. package/dist/components/DataView/DataView.css +1 -0
  75. package/dist/components/DataView/DataView2.js +433 -0
  76. package/dist/components/DatePicker/DatePicker.css +1 -0
  77. package/dist/components/DatePicker/DatePicker2.js +151 -0
  78. package/dist/components/DateRangePicker/DateRangePicker.css +1 -0
  79. package/dist/components/DateRangePicker/DateRangePicker2.js +223 -0
  80. package/dist/components/DayAgenda/DayAgenda.css +1 -0
  81. package/dist/components/DayAgenda/DayAgenda2.js +120 -0
  82. package/dist/components/DiffViewer/DiffViewer.css +1 -0
  83. package/dist/components/DiffViewer/DiffViewer2.js +270 -0
  84. package/dist/components/Drawer/Drawer.css +1 -0
  85. package/dist/components/Drawer/Drawer2.js +119 -0
  86. package/dist/components/Dropdown/Dropdown.css +1 -0
  87. package/dist/components/Dropdown/Dropdown2.js +413 -0
  88. package/dist/components/EmojiPicker/EmojiPicker.css +1 -0
  89. package/dist/components/EmojiPicker/EmojiPicker2.js +789 -0
  90. package/dist/components/EmojiPicker/emojiKeywords/activities.js +508 -0
  91. package/dist/components/EmojiPicker/emojiKeywords/animals.js +501 -0
  92. package/dist/components/EmojiPicker/emojiKeywords/food.js +540 -0
  93. package/dist/components/EmojiPicker/emojiKeywords/index.js +21 -0
  94. package/dist/components/EmojiPicker/emojiKeywords/objects.js +652 -0
  95. package/dist/components/EmojiPicker/emojiKeywords/people.js +488 -0
  96. package/dist/components/EmojiPicker/emojiKeywords/smileys.js +538 -0
  97. package/dist/components/EmojiPicker/emojiKeywords/symbols.js +597 -0
  98. package/dist/components/EmojiPicker/emojiKeywords/travel.js +507 -0
  99. package/dist/components/EmptyState/EmptyState.css +1 -0
  100. package/dist/components/EmptyState/EmptyState2.js +47 -0
  101. package/dist/components/ErrorBoundary/ErrorBoundary.css +1 -0
  102. package/dist/components/ErrorBoundary/ErrorBoundary2.js +37 -0
  103. package/dist/components/EventCalendar/EventCalendar.Chip.js +45 -0
  104. package/dist/components/EventCalendar/EventCalendar.Month.js +118 -0
  105. package/dist/components/EventCalendar/EventCalendar.Week.js +131 -0
  106. package/dist/components/EventCalendar/EventCalendar.css +1 -0
  107. package/dist/components/EventCalendar/EventCalendar.helpers.js +72 -0
  108. package/dist/components/EventCalendar/EventCalendar2.js +157 -0
  109. package/dist/components/FileDropzone/FileDropzone.css +1 -0
  110. package/dist/components/FileDropzone/FileDropzone2.js +71 -0
  111. package/dist/components/Flag/Flag.css +1 -0
  112. package/dist/components/Flag/Flag2.js +36 -0
  113. package/dist/components/FloatButton/FloatButton.css +1 -0
  114. package/dist/components/FloatButton/FloatButton2.js +68 -0
  115. package/dist/components/FloatingWindow/FloatingWindow.css +1 -0
  116. package/dist/components/FloatingWindow/FloatingWindow2.js +203 -0
  117. package/dist/components/FolderBrowserModal/FolderBrowserModal.css +1 -0
  118. package/dist/components/FolderBrowserModal/FolderBrowserModal2.js +144 -0
  119. package/dist/components/Grid/Col.js +17 -0
  120. package/dist/components/Grid/Grid.css +1 -0
  121. package/dist/components/Grid/Grid2.js +28 -0
  122. package/dist/components/Icon/Icon.css +1 -0
  123. package/dist/components/Icon/Icon2.js +23 -0
  124. package/dist/components/IconPicker/IconPicker.css +1 -0
  125. package/dist/components/IconPicker/IconPicker2.js +51 -0
  126. package/dist/components/InfiniteScroll/InfiniteScroll.css +1 -0
  127. package/dist/components/InfiniteScroll/InfiniteScroll2.js +66 -0
  128. package/dist/components/InputDate/InputDate.css +1 -0
  129. package/dist/components/InputDate/InputDate2.js +87 -0
  130. package/dist/components/InputEmail/InputEmail.css +1 -0
  131. package/dist/components/InputEmail/InputEmail2.js +73 -0
  132. package/dist/components/InputFile/InputFile.css +1 -0
  133. package/dist/components/InputFile/InputFile2.js +41 -0
  134. package/dist/components/InputMask/InputMask.css +1 -0
  135. package/dist/components/InputMask/InputMask2.js +163 -0
  136. package/dist/components/InputNumber/InputNumber.css +1 -0
  137. package/dist/components/InputNumber/InputNumber2.js +60 -0
  138. package/dist/components/InputPIN/InputPIN.css +1 -0
  139. package/dist/components/InputPIN/InputPIN2.js +121 -0
  140. package/dist/components/InputPassword/InputPassword.css +1 -0
  141. package/dist/components/InputPassword/InputPassword2.js +47 -0
  142. package/dist/components/InputPhone/InputPhone.css +1 -0
  143. package/dist/components/InputPhone/InputPhone2.js +82 -0
  144. package/dist/components/InputSearch/InputSearch.css +1 -0
  145. package/dist/components/InputSearch/InputSearch2.js +53 -0
  146. package/dist/components/InputText/InputText.css +1 -0
  147. package/dist/components/InputText/InputText2.js +47 -0
  148. package/dist/components/InputTextarea/InputTextarea.css +1 -0
  149. package/dist/components/InputTextarea/InputTextarea2.js +46 -0
  150. package/dist/components/InputTime/InputTime.css +1 -0
  151. package/dist/components/InputTime/InputTime2.js +85 -0
  152. package/dist/components/InputUrl/InputUrl.css +1 -0
  153. package/dist/components/InputUrl/InputUrl2.js +65 -0
  154. package/dist/components/JourneyWizard/JourneyWizard.css +1 -0
  155. package/dist/components/JourneyWizard/JourneyWizard2.js +147 -0
  156. package/dist/components/List/List.css +1 -0
  157. package/dist/components/List/List2.js +28 -0
  158. package/dist/components/Loading/Loading.css +1 -0
  159. package/dist/components/Loading/Loading2.js +11 -0
  160. package/dist/components/MenuHamburger/MenuHamburger.css +1 -0
  161. package/dist/components/MenuHamburger/MenuHamburger2.js +65 -0
  162. package/dist/components/MiniSort/MiniSort.css +1 -0
  163. package/dist/components/MiniSort/MiniSort2.js +52 -0
  164. package/dist/components/MiniStatsCard/MiniStatsCard.css +1 -0
  165. package/dist/components/MiniStatsCard/MiniStatsCard2.js +67 -0
  166. package/dist/components/Minimap/Minimap.css +1 -0
  167. package/dist/components/Minimap/Minimap2.js +62 -0
  168. package/dist/components/Modal/Modal.css +1 -0
  169. package/dist/components/Modal/Modal2.js +87 -0
  170. package/dist/components/NavBar/NavBar.css +1 -0
  171. package/dist/components/NavBar/NavBar2.js +64 -0
  172. package/dist/components/NotificationPanel/NotificationPanel.css +1 -0
  173. package/dist/components/NotificationPanel/NotificationPanel2.js +66 -0
  174. package/dist/components/Pagination/Pagination.css +1 -0
  175. package/dist/components/Pagination/Pagination2.js +92 -0
  176. package/dist/components/PieChart/PieChart.css +1 -0
  177. package/dist/components/PieChart/PieChart2.js +142 -0
  178. package/dist/components/Popover/Popover.css +1 -0
  179. package/dist/components/Popover/Popover2.js +109 -0
  180. package/dist/components/Popover/hooks/Popover.hook.js +33 -0
  181. package/dist/components/ProgressBar/ProgressBar.css +1 -0
  182. package/dist/components/ProgressBar/ProgressBar2.js +48 -0
  183. package/dist/components/ProgressRing/ProgressRing.css +1 -0
  184. package/dist/components/ProgressRing/ProgressRing2.js +54 -0
  185. package/dist/components/QuantitySelector/QuantitySelector.css +1 -0
  186. package/dist/components/QuantitySelector/QuantitySelector2.js +94 -0
  187. package/dist/components/QuickAdd/QuickAdd.css +1 -0
  188. package/dist/components/QuickAdd/QuickAdd2.js +56 -0
  189. package/dist/components/QuickNumberUpdate/QuickNumberUpdate.css +1 -0
  190. package/dist/components/QuickNumberUpdate/QuickNumberUpdate2.js +52 -0
  191. package/dist/components/QuickOptionUpdate/QuickOptionUpdate.css +1 -0
  192. package/dist/components/QuickOptionUpdate/QuickOptionUpdate2.js +67 -0
  193. package/dist/components/Radio/Radio.css +1 -0
  194. package/dist/components/Radio/Radio2.js +36 -0
  195. package/dist/components/RangeSlider/RangeSlider.css +1 -0
  196. package/dist/components/RangeSlider/RangeSlider2.js +157 -0
  197. package/dist/components/Rating/Rating.css +1 -0
  198. package/dist/components/Rating/Rating2.js +148 -0
  199. package/dist/components/Rating/RatingIcon.js +102 -0
  200. package/dist/components/RichTextEditor/RichTextEditor.css +1 -0
  201. package/dist/components/RichTextEditor/RichTextEditor2.js +212 -0
  202. package/dist/components/RichTextEditor/RteLinkPrompt.js +42 -0
  203. package/dist/components/RichTextEditor/RteTableToolbar.js +95 -0
  204. package/dist/components/RichTextEditor/RteToolbar.js +106 -0
  205. package/dist/components/RichTextEditor/helpers.js +73 -0
  206. package/dist/components/RichTextEditor/hooks/useEditorHistory.js +39 -0
  207. package/dist/components/RichTextEditor/hooks/useLinkPrompt.js +61 -0
  208. package/dist/components/RichTextEditor/hooks/useTableOps.js +134 -0
  209. package/dist/components/RollingNumber/RollingNumber.css +1 -0
  210. package/dist/components/RollingNumber/RollingNumber2.js +71 -0
  211. package/dist/components/ScrollToTop/ScrollToTop.css +1 -0
  212. package/dist/components/ScrollToTop/ScrollToTop2.js +40 -0
  213. package/dist/components/Separator/Separator.css +1 -0
  214. package/dist/components/Separator/Separator2.js +39 -0
  215. package/dist/components/Sidebar/Sidebar.css +1 -0
  216. package/dist/components/Sidebar/Sidebar2.js +115 -0
  217. package/dist/components/Sidebar/SidebarContext.js +31 -0
  218. package/dist/components/SignalStrength/SignalStrength.css +1 -0
  219. package/dist/components/SignalStrength/SignalStrength2.js +56 -0
  220. package/dist/components/Skeleton/Skeleton.css +1 -0
  221. package/dist/components/Skeleton/Skeleton2.js +50 -0
  222. package/dist/components/Slider/Slider.css +1 -0
  223. package/dist/components/Slider/Slider2.js +39 -0
  224. package/dist/components/SplitPanel/SplitPanel.css +1 -0
  225. package/dist/components/SplitPanel/SplitPanel2.js +69 -0
  226. package/dist/components/Splitter/Splitter.css +1 -0
  227. package/dist/components/Splitter/Splitter2.js +89 -0
  228. package/dist/components/StackedBar/StackedBar.css +1 -0
  229. package/dist/components/StackedBar/StackedBar2.js +50 -0
  230. package/dist/components/Stats/Stats.css +1 -0
  231. package/dist/components/Stats/Stats2.js +26 -0
  232. package/dist/components/StickyBar/StickyBar.css +1 -0
  233. package/dist/components/StickyBar/StickyBar2.js +29 -0
  234. package/dist/components/SuggestionsList/SuggestionsList.css +1 -0
  235. package/dist/components/SuggestionsList/SuggestionsList2.js +121 -0
  236. package/dist/components/ThemeSettings/ThemeContext.js +138 -0
  237. package/dist/components/ThemeSettings/ThemeContextValue.js +5 -0
  238. package/dist/components/ThemeSettings/ThemeSettings.css +1 -0
  239. package/dist/components/ThemeSettings/ThemeSettings2.js +245 -0
  240. package/dist/components/ThemeSettings/themeConfig.js +7 -0
  241. package/dist/components/ThemeSettings/useTheme.js +10 -0
  242. package/dist/components/TimePicker/TimePicker.css +1 -0
  243. package/dist/components/TimePicker/TimePicker2.js +118 -0
  244. package/dist/components/TimePicker/TimeSpinner.js +59 -0
  245. package/dist/components/Timeline/Timeline.css +1 -0
  246. package/dist/components/Timeline/Timeline2.js +57 -0
  247. package/dist/components/TimelineMarkers/TimelineMarkers.css +1 -0
  248. package/dist/components/TimelineMarkers/TimelineMarkers2.js +73 -0
  249. package/dist/components/TipsOfTheDay/TipsOfTheDay.css +1 -0
  250. package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +24 -0
  251. package/dist/components/Toast/Toast.css +1 -0
  252. package/dist/components/Toast/Toast2.js +39 -0
  253. package/dist/components/ToggleButtons/ToggleButtons.css +1 -0
  254. package/dist/components/ToggleButtons/ToggleButtons2.js +47 -0
  255. package/dist/components/ToggleSwitch/ToggleSwitch.css +1 -0
  256. package/dist/components/ToggleSwitch/ToggleSwitch2.js +27 -0
  257. package/dist/components/Toolbar/Toolbar.css +1 -0
  258. package/dist/components/Toolbar/Toolbar2.js +129 -0
  259. package/dist/components/Tooltip/Tooltip.css +1 -0
  260. package/dist/components/Tooltip/Tooltip2.js +93 -0
  261. package/dist/components/TourHud/TourHud.css +1 -0
  262. package/dist/components/TourHud/TourHud2.js +70 -0
  263. package/dist/components/Transition/Transition.css +1 -0
  264. package/dist/components/Transition/Transition2.js +68 -0
  265. package/dist/components/Tree/Tree.css +1 -0
  266. package/dist/components/Tree/Tree2.js +95 -0
  267. package/dist/components/VirtualList/VirtualList.css +1 -0
  268. package/dist/components/VirtualList/VirtualList2.js +64 -0
  269. package/dist/components/WHtR/WHtR.css +1 -0
  270. package/dist/components/WHtR/WHtR2.js +115 -0
  271. package/dist/contexts/AuthContext/AuthContext.js +113 -0
  272. package/dist/helpers/AppPersistenceStorage.js +50 -0
  273. package/dist/helpers/Datetime.js +114 -0
  274. package/dist/helpers/Format.js +21 -0
  275. package/dist/helpers/Highlight.js +36 -0
  276. package/dist/helpers/HtmlContent.js +118 -0
  277. package/dist/helpers/LogicalOperators.js +15 -0
  278. package/dist/helpers/Numbers.js +15 -0
  279. package/dist/helpers/Pagination.js +7 -0
  280. package/dist/helpers/Search.js +15 -0
  281. package/dist/helpers/Strings.js +10 -0
  282. package/dist/helpers/Urls.js +68 -0
  283. package/dist/helpers/VersionInfo.js +36 -0
  284. package/dist/hooks/useAppPersistence.js +51 -0
  285. package/dist/hooks/useAuth/useAuth.js +10 -0
  286. package/dist/hooks/useBodyScrollLock.js +31 -0
  287. package/dist/hooks/useBreakpoint.js +65 -0
  288. package/dist/hooks/useComponentEffect.js +8 -0
  289. package/dist/hooks/useSwipe.js +45 -0
  290. package/dist/index.css +1 -2
  291. package/dist/index.esm.js +1 -17211
  292. package/dist/index.js +348 -0
  293. package/dist/mfa.js +4 -0
  294. package/dist/node_modules/qrcode.react/lib/esm/index.js +979 -0
  295. package/dist/validators/Vin.js +69 -0
  296. package/dist/version.js +8 -0
  297. package/dist/version.json +4 -4
  298. package/package.json +8 -7
  299. package/dist/mfa.esm.js +0 -1293
  300. package/dist/useAuth-BBqdDG2z.js +0 -467
@@ -0,0 +1,212 @@
1
+ import './RichTextEditor.css';
2
+ import { htmlToMarkdown as ae } from "../../helpers/HtmlContent.js";
3
+ import { DEFAULT_TABLE_HTML as se } from "./helpers.js";
4
+ import { useEditorHistory as ie } from "./hooks/useEditorHistory.js";
5
+ import { useLinkPrompt as ce } from "./hooks/useLinkPrompt.js";
6
+ import { useTableOps as le } from "./hooks/useTableOps.js";
7
+ import { RteLinkPrompt as de } from "./RteLinkPrompt.js";
8
+ import { RteTableToolbar as me } from "./RteTableToolbar.js";
9
+ import { RteToolbar as pe } from "./RteToolbar.js";
10
+ /* empty css */
11
+ import { useCallback as c, useEffect as ue, useRef as w, useState as fe } from "react";
12
+ import { jsx as u, jsxs as E } from "react/jsx-runtime";
13
+ var xe = ({ advanced: D = !1, error: g, format: L = "html", id: v, label: A, onBlur: M, onChange: b, placeholder: U, required: H = !1, value: x }) => {
14
+ const a = w(null), h = w(!1), P = w(null), [k, B] = fe(/* @__PURE__ */ new Set());
15
+ ue(() => {
16
+ const e = a.current;
17
+ if (!e || h.current) return;
18
+ const t = x ?? "";
19
+ e.innerHTML !== t && (e.innerHTML = t);
20
+ }, [x]);
21
+ const s = c(() => {
22
+ const e = a.current;
23
+ if (!e || !b) return;
24
+ h.current = !0;
25
+ const t = e.innerHTML.replace(/ /g, " ");
26
+ b(L === "markdown" ? ae(t) : t), setTimeout(() => {
27
+ h.current = !1;
28
+ }, 0);
29
+ }, [L, b]), { snapshotForUndo: p, undo: T, redo: C } = ie(a, h, s), { showLinkPrompt: F, linkUrl: O, setLinkUrl: _, linkText: $, setLinkText: j, editingAnchorRef: q, openLinkPrompt: R, confirmLink: I, cancelLink: z } = ce({
30
+ editorRef: a,
31
+ snapshotForUndo: p,
32
+ emitChange: s
33
+ }), { activeTable: W, tableToolbarPos: N, showTableToolbar: K, hideTableToolbar: S, addRowAbove: G, addRowBelow: J, removeRow: Q, addColumnLeft: V, addColumnRight: X, removeColumn: Y, deleteTable: Z } = le({
34
+ editorRef: a,
35
+ snapshotForUndo: p,
36
+ emitChange: s
37
+ }), l = c(() => {
38
+ const e = [
39
+ "bold",
40
+ "italic",
41
+ "underline",
42
+ "insertUnorderedList",
43
+ "insertOrderedList"
44
+ ], t = /* @__PURE__ */ new Set();
45
+ e.forEach((n) => {
46
+ try {
47
+ document.queryCommandState(n) && t.add(n);
48
+ } catch {
49
+ }
50
+ });
51
+ const r = window.getSelection();
52
+ if (r && r.rangeCount > 0) {
53
+ let n = r.getRangeAt(0).commonAncestorContainer;
54
+ for (; n && n !== a.current; ) {
55
+ if (n.nodeType === Node.ELEMENT_NODE) {
56
+ const o = n.tagName.toLowerCase();
57
+ if (/^h[1-6]$/.test(o)) {
58
+ t.add(o);
59
+ break;
60
+ }
61
+ o === "pre" && t.add("pre");
62
+ }
63
+ n = n.parentNode;
64
+ }
65
+ }
66
+ B(t);
67
+ }, []), f = c((e, t) => {
68
+ a.current?.focus(), document.execCommand(e, !1, t), l(), s();
69
+ }, [s, l]), ee = c((e) => {
70
+ const t = `h${e}`, r = k.has(t);
71
+ f("formatBlock", r ? "p" : t);
72
+ }, [k, f]), te = c(() => {
73
+ p();
74
+ const e = a.current;
75
+ if (!e) return;
76
+ e.focus();
77
+ const t = window.getSelection();
78
+ if (!t || t.rangeCount === 0) return;
79
+ const r = t.getRangeAt(0), n = document.createElement("li");
80
+ n.setAttribute("data-task", "true");
81
+ const o = document.createElement("input");
82
+ o.type = "checkbox", o.style.marginRight = "6px";
83
+ const i = document.createElement("span");
84
+ i.textContent = "​", n.appendChild(o), n.appendChild(i);
85
+ const d = document.createElement("ul");
86
+ d.className = "rte-task-list", d.appendChild(n), r.deleteContents(), r.insertNode(d);
87
+ const m = document.createRange();
88
+ m.setStart(i, 1), m.collapse(!0), t.removeAllRanges(), t.addRange(m), s();
89
+ }, [p, s]), ne = c(() => {
90
+ f("insertHTML", se);
91
+ }, [f]), oe = c((e) => {
92
+ const t = e.target, r = t.closest("a");
93
+ if (r) {
94
+ e.preventDefault(), R(r), l();
95
+ return;
96
+ }
97
+ const n = t.closest("table");
98
+ n ? K(n) : S(), l();
99
+ }, [
100
+ R,
101
+ l,
102
+ K,
103
+ S
104
+ ]), re = c((e) => {
105
+ if ((e.ctrlKey || e.metaKey) && e.key === "z") {
106
+ e.preventDefault(), e.shiftKey ? C() : T();
107
+ return;
108
+ }
109
+ const t = e.key.length === 1 && !e.ctrlKey && !e.metaKey, r = [
110
+ "Enter",
111
+ "Backspace",
112
+ "Delete",
113
+ " "
114
+ ].includes(e.key);
115
+ if ((t || r) && p(), e.key === "Enter" && !e.shiftKey) {
116
+ const n = window.getSelection();
117
+ if (n && n.rangeCount > 0) {
118
+ let o = n.getRangeAt(0).commonAncestorContainer;
119
+ for (; o && o !== a.current; ) {
120
+ if (o.classList?.contains("rte-task-list")) {
121
+ e.preventDefault();
122
+ const i = document.createElement("li");
123
+ i.setAttribute("data-task", "true");
124
+ const d = document.createElement("input");
125
+ d.type = "checkbox", d.style.marginRight = "6px";
126
+ const m = document.createElement("span");
127
+ m.textContent = "​", i.appendChild(d), i.appendChild(m), o.appendChild(i);
128
+ const y = document.createRange();
129
+ y.setStart(m, 1), y.collapse(!0), n.removeAllRanges(), n.addRange(y);
130
+ return;
131
+ }
132
+ o = o.parentNode;
133
+ }
134
+ }
135
+ }
136
+ }, [
137
+ p,
138
+ T,
139
+ C
140
+ ]);
141
+ return /* @__PURE__ */ E("div", {
142
+ className: "rte-wrapper",
143
+ children: [
144
+ A && /* @__PURE__ */ E("label", {
145
+ htmlFor: v,
146
+ className: "rte-label",
147
+ children: [A, H && /* @__PURE__ */ u("span", {
148
+ className: "rte-required",
149
+ children: "*"
150
+ })]
151
+ }),
152
+ /* @__PURE__ */ E("div", {
153
+ className: `rte-container ${g ? "rte-container--error" : ""}`,
154
+ style: { position: "relative" },
155
+ children: [
156
+ /* @__PURE__ */ u(pe, {
157
+ advanced: D,
158
+ isActive: (e) => k.has(e),
159
+ exec: f,
160
+ applyHeading: ee,
161
+ insertTaskList: te,
162
+ openLinkPrompt: () => R(),
163
+ insertTable: ne,
164
+ undo: T,
165
+ redo: C
166
+ }),
167
+ F && /* @__PURE__ */ u(de, {
168
+ isEditing: !!q.current,
169
+ linkText: $,
170
+ linkUrl: O,
171
+ setLinkText: j,
172
+ setLinkUrl: _,
173
+ confirmLink: I,
174
+ cancelLink: z
175
+ }),
176
+ W && N && /* @__PURE__ */ u(me, {
177
+ pos: N,
178
+ toolbarRef: P,
179
+ addRowAbove: G,
180
+ addRowBelow: J,
181
+ removeRow: Q,
182
+ addColumnLeft: V,
183
+ addColumnRight: X,
184
+ removeColumn: Y,
185
+ deleteTable: Z
186
+ }),
187
+ /* @__PURE__ */ u("div", {
188
+ ref: a,
189
+ id: v,
190
+ className: "rte-editor",
191
+ contentEditable: !0,
192
+ suppressContentEditableWarning: !0,
193
+ "data-placeholder": U,
194
+ onInput: s,
195
+ onKeyUp: l,
196
+ onMouseUp: l,
197
+ onClick: oe,
198
+ onKeyDown: re,
199
+ onBlur: M
200
+ })
201
+ ]
202
+ }),
203
+ g && /* @__PURE__ */ u("span", {
204
+ className: "rte-error-message",
205
+ children: g
206
+ })
207
+ ]
208
+ });
209
+ };
210
+ export {
211
+ xe as RichTextEditor
212
+ };
@@ -0,0 +1,42 @@
1
+ import "react";
2
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
3
+ var k = ({ isEditing: r, linkText: i, linkUrl: o, setLinkText: p, setLinkUrl: s, confirmLink: n, cancelLink: l }) => /* @__PURE__ */ a("div", {
4
+ className: "rte-link-prompt",
5
+ children: [
6
+ /* @__PURE__ */ e("input", {
7
+ className: "rte-link-input",
8
+ type: "text",
9
+ placeholder: "Display text (optional)",
10
+ value: i,
11
+ onChange: (t) => p(t.target.value)
12
+ }),
13
+ /* @__PURE__ */ e("input", {
14
+ className: "rte-link-input",
15
+ type: "url",
16
+ placeholder: "https://example.com",
17
+ value: o,
18
+ onChange: (t) => s(t.target.value),
19
+ onKeyDown: (t) => {
20
+ t.key === "Enter" && n(), t.key === "Escape" && l();
21
+ },
22
+ autoFocus: !0
23
+ }),
24
+ /* @__PURE__ */ a("div", {
25
+ className: "rte-link-actions",
26
+ children: [/* @__PURE__ */ e("button", {
27
+ type: "button",
28
+ className: "rte-link-btn rte-link-btn--confirm",
29
+ onClick: n,
30
+ children: r ? "Update" : "Insert"
31
+ }), /* @__PURE__ */ e("button", {
32
+ type: "button",
33
+ className: "rte-link-btn rte-link-btn--cancel",
34
+ onClick: l,
35
+ children: "Cancel"
36
+ })]
37
+ })
38
+ ]
39
+ });
40
+ export {
41
+ k as RteLinkPrompt
42
+ };
@@ -0,0 +1,95 @@
1
+ import { Tooltip as e } from "../Tooltip/Tooltip2.js";
2
+ import "react";
3
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
4
+ var N = ({ pos: o, toolbarRef: r, addRowAbove: a, addRowBelow: b, removeRow: n, addColumnLeft: i, addColumnRight: c, removeColumn: d, deleteTable: s }) => /* @__PURE__ */ l("div", {
5
+ ref: r,
6
+ className: "rte-table-toolbar",
7
+ style: {
8
+ top: o.top,
9
+ left: o.left
10
+ },
11
+ onMouseDown: (m) => m.preventDefault(),
12
+ children: [
13
+ /* @__PURE__ */ l("div", {
14
+ className: "rte-table-toolbar-group",
15
+ children: [
16
+ /* @__PURE__ */ t(e, {
17
+ title: "Add row above",
18
+ children: /* @__PURE__ */ t("button", {
19
+ type: "button",
20
+ className: "rte-table-toolbar-btn",
21
+ onClick: a,
22
+ children: "↑ Row"
23
+ })
24
+ }),
25
+ /* @__PURE__ */ t(e, {
26
+ title: "Add row below",
27
+ children: /* @__PURE__ */ t("button", {
28
+ type: "button",
29
+ className: "rte-table-toolbar-btn",
30
+ onClick: b,
31
+ children: "↓ Row"
32
+ })
33
+ }),
34
+ /* @__PURE__ */ t(e, {
35
+ title: "Remove last row",
36
+ children: /* @__PURE__ */ t("button", {
37
+ type: "button",
38
+ className: "rte-table-toolbar-btn rte-table-toolbar-btn--danger",
39
+ onClick: n,
40
+ children: "− Row"
41
+ })
42
+ })
43
+ ]
44
+ }),
45
+ /* @__PURE__ */ t("div", { className: "rte-table-toolbar-divider" }),
46
+ /* @__PURE__ */ l("div", {
47
+ className: "rte-table-toolbar-group",
48
+ children: [
49
+ /* @__PURE__ */ t(e, {
50
+ title: "Add column left",
51
+ children: /* @__PURE__ */ t("button", {
52
+ type: "button",
53
+ className: "rte-table-toolbar-btn",
54
+ onClick: i,
55
+ children: "← Col"
56
+ })
57
+ }),
58
+ /* @__PURE__ */ t(e, {
59
+ title: "Add column right",
60
+ children: /* @__PURE__ */ t("button", {
61
+ type: "button",
62
+ className: "rte-table-toolbar-btn",
63
+ onClick: c,
64
+ children: "→ Col"
65
+ })
66
+ }),
67
+ /* @__PURE__ */ t(e, {
68
+ title: "Remove last column",
69
+ children: /* @__PURE__ */ t("button", {
70
+ type: "button",
71
+ className: "rte-table-toolbar-btn rte-table-toolbar-btn--danger",
72
+ onClick: d,
73
+ children: "− Col"
74
+ })
75
+ })
76
+ ]
77
+ }),
78
+ /* @__PURE__ */ t("div", { className: "rte-table-toolbar-divider" }),
79
+ /* @__PURE__ */ t("div", {
80
+ className: "rte-table-toolbar-group",
81
+ children: /* @__PURE__ */ t(e, {
82
+ title: "Delete table",
83
+ children: /* @__PURE__ */ t("button", {
84
+ type: "button",
85
+ className: "rte-table-toolbar-btn rte-table-toolbar-btn--danger",
86
+ onClick: s,
87
+ children: "✕ Table"
88
+ })
89
+ })
90
+ })
91
+ ]
92
+ });
93
+ export {
94
+ N as RteTableToolbar
95
+ };
@@ -0,0 +1,106 @@
1
+ import { Icon as i } from "../Icon/Icon2.js";
2
+ import { Tooltip as a } from "../Tooltip/Tooltip2.js";
3
+ import { ADVANCED_BUTTONS as h, HEADING_LEVELS as v, HISTORY_BUTTONS as N, TOOLBAR_BUTTONS as D } from "./helpers.js";
4
+ import "react";
5
+ import { Fragment as f, jsx as e, jsxs as r } from "react/jsx-runtime";
6
+ var k = ({ advanced: m, isActive: l, exec: n, applyHeading: c, insertTaskList: d, openLinkPrompt: s, insertTable: u, undo: b, redo: p }) => /* @__PURE__ */ r("div", {
7
+ className: "rte-toolbar",
8
+ children: [
9
+ /* @__PURE__ */ e("div", {
10
+ className: "rte-toolbar-group",
11
+ children: N.map((t) => /* @__PURE__ */ e(a, {
12
+ title: t.title,
13
+ children: /* @__PURE__ */ e("button", {
14
+ type: "button",
15
+ className: "rte-toolbar-btn",
16
+ onMouseDown: (o) => {
17
+ o.preventDefault(), t.command === "undo" ? b() : p();
18
+ },
19
+ children: t.label
20
+ })
21
+ }, t.command))
22
+ }),
23
+ /* @__PURE__ */ e("div", { className: "rte-toolbar-divider" }),
24
+ /* @__PURE__ */ r("div", {
25
+ className: "rte-toolbar-group",
26
+ children: [D.map((t) => /* @__PURE__ */ e(a, {
27
+ title: t.title,
28
+ children: /* @__PURE__ */ e("button", {
29
+ type: "button",
30
+ className: `rte-toolbar-btn ${l(t.command) ? "rte-toolbar-btn--active" : ""}`,
31
+ onMouseDown: (o) => {
32
+ o.preventDefault(), n(t.command, t.value);
33
+ },
34
+ children: t.label
35
+ })
36
+ }, t.command)), /* @__PURE__ */ e(a, {
37
+ title: "Task List",
38
+ children: /* @__PURE__ */ r("button", {
39
+ type: "button",
40
+ className: "rte-toolbar-btn",
41
+ onMouseDown: (t) => {
42
+ t.preventDefault(), d();
43
+ },
44
+ children: [/* @__PURE__ */ e(i, { name: "checkmark" }), " List"]
45
+ })
46
+ })]
47
+ }),
48
+ /* @__PURE__ */ e("div", { className: "rte-toolbar-divider" }),
49
+ /* @__PURE__ */ e("div", {
50
+ className: "rte-toolbar-group",
51
+ children: v.map((t) => /* @__PURE__ */ e(a, {
52
+ title: `Heading ${t}`,
53
+ children: /* @__PURE__ */ r("button", {
54
+ type: "button",
55
+ className: `rte-toolbar-btn rte-toolbar-btn--heading ${l(`h${t}`) ? "rte-toolbar-btn--active" : ""}`,
56
+ onMouseDown: (o) => {
57
+ o.preventDefault(), c(t);
58
+ },
59
+ children: ["H", t]
60
+ })
61
+ }, t))
62
+ }),
63
+ /* @__PURE__ */ e("div", { className: "rte-toolbar-divider" }),
64
+ /* @__PURE__ */ e("div", {
65
+ className: "rte-toolbar-group",
66
+ children: /* @__PURE__ */ e(a, {
67
+ title: "Insert Link",
68
+ children: /* @__PURE__ */ r("button", {
69
+ type: "button",
70
+ className: "rte-toolbar-btn",
71
+ onMouseDown: (t) => {
72
+ t.preventDefault(), s();
73
+ },
74
+ children: [/* @__PURE__ */ e(i, { name: "link" }), " Link"]
75
+ })
76
+ })
77
+ }),
78
+ m && /* @__PURE__ */ r(f, { children: [/* @__PURE__ */ e("div", { className: "rte-toolbar-divider" }), /* @__PURE__ */ r("div", {
79
+ className: "rte-toolbar-group",
80
+ children: [h.map((t) => /* @__PURE__ */ e(a, {
81
+ title: t.title,
82
+ children: /* @__PURE__ */ e("button", {
83
+ type: "button",
84
+ className: `rte-toolbar-btn ${l(t.value ?? t.command) ? "rte-toolbar-btn--active" : ""}`,
85
+ onMouseDown: (o) => {
86
+ o.preventDefault(), n(t.command, t.value);
87
+ },
88
+ children: t.label
89
+ })
90
+ }, t.command + (t.value ?? ""))), /* @__PURE__ */ e(a, {
91
+ title: "Insert Table",
92
+ children: /* @__PURE__ */ e("button", {
93
+ type: "button",
94
+ className: "rte-toolbar-btn",
95
+ onMouseDown: (t) => {
96
+ t.preventDefault(), u();
97
+ },
98
+ children: "Table"
99
+ })
100
+ })]
101
+ })] })
102
+ ]
103
+ });
104
+ export {
105
+ k as RteToolbar
106
+ };
@@ -0,0 +1,73 @@
1
+ var r = [
2
+ {
3
+ command: "bold",
4
+ label: "B",
5
+ title: "Bold (Ctrl+B)"
6
+ },
7
+ {
8
+ command: "italic",
9
+ label: "I",
10
+ title: "Italic (Ctrl+I)"
11
+ },
12
+ {
13
+ command: "underline",
14
+ label: "U",
15
+ title: "Underline (Ctrl+U)"
16
+ },
17
+ {
18
+ command: "insertUnorderedList",
19
+ label: "• List",
20
+ title: "Unordered List"
21
+ },
22
+ {
23
+ command: "insertOrderedList",
24
+ label: "1. List",
25
+ title: "Ordered List"
26
+ }
27
+ ], a = [{
28
+ command: "undo",
29
+ label: "↩ Undo",
30
+ title: "Undo (Ctrl+Z)"
31
+ }, {
32
+ command: "redo",
33
+ label: "↪ Redo",
34
+ title: "Redo (Ctrl+Shift+Z)"
35
+ }], n = [
36
+ 1,
37
+ 2,
38
+ 3,
39
+ 4,
40
+ 5,
41
+ 6
42
+ ], o = [{
43
+ command: "formatBlock",
44
+ value: "pre",
45
+ label: "Code Block",
46
+ title: "Code Block",
47
+ isAdvanced: !0
48
+ }], i = (d) => {
49
+ const e = document.createElement("tr");
50
+ for (let l = 0; l < d; l++) {
51
+ const t = document.createElement("td");
52
+ t.setAttribute("contenteditable", "true"), t.textContent = "Cell", e.appendChild(t);
53
+ }
54
+ return e;
55
+ }, c = `
56
+ <table class="rte-table">
57
+ <thead>
58
+ <tr><th contenteditable="true">Header 1</th><th contenteditable="true">Header 2</th><th contenteditable="true">Header 3</th></tr>
59
+ </thead>
60
+ <tbody>
61
+ <tr><td contenteditable="true">Cell</td><td contenteditable="true">Cell</td><td contenteditable="true">Cell</td></tr>
62
+ <tr><td contenteditable="true">Cell</td><td contenteditable="true">Cell</td><td contenteditable="true">Cell</td></tr>
63
+ </tbody>
64
+ </table><p><br></p>
65
+ `;
66
+ export {
67
+ o as ADVANCED_BUTTONS,
68
+ c as DEFAULT_TABLE_HTML,
69
+ n as HEADING_LEVELS,
70
+ a as HISTORY_BUTTONS,
71
+ r as TOOLBAR_BUTTONS,
72
+ i as makeTableRow
73
+ };
@@ -0,0 +1,39 @@
1
+ import { useCallback as s, useRef as T } from "react";
2
+ var H = 100, M = (n, u, c) => {
3
+ const t = T([]), e = T([]);
4
+ return {
5
+ snapshotForUndo: s(() => {
6
+ const r = n.current;
7
+ r && (t.current.push(r.innerHTML), t.current.length > H && t.current.shift(), e.current = []);
8
+ }, [n]),
9
+ undo: s(() => {
10
+ const r = n.current;
11
+ if (!r || t.current.length === 0) return;
12
+ e.current.push(r.innerHTML);
13
+ const o = t.current.pop();
14
+ u.current = !0, r.innerHTML = o, setTimeout(() => {
15
+ u.current = !1;
16
+ }, 0), c();
17
+ }, [
18
+ n,
19
+ u,
20
+ c
21
+ ]),
22
+ redo: s(() => {
23
+ const r = n.current;
24
+ if (!r || e.current.length === 0) return;
25
+ t.current.push(r.innerHTML);
26
+ const o = e.current.pop();
27
+ u.current = !0, r.innerHTML = o, setTimeout(() => {
28
+ u.current = !1;
29
+ }, 0), c();
30
+ }, [
31
+ n,
32
+ u,
33
+ c
34
+ ])
35
+ };
36
+ };
37
+ export {
38
+ M as useEditorHistory
39
+ };
@@ -0,0 +1,61 @@
1
+ import { useCallback as a, useRef as k, useState as f } from "react";
2
+ var h = ({ editorRef: m, snapshotForUndo: d, emitChange: g }) => {
3
+ const [p, u] = f(!1), [t, i] = f(""), [o, c] = f(""), s = k(null), n = k(null);
4
+ return {
5
+ showLinkPrompt: p,
6
+ linkUrl: t,
7
+ setLinkUrl: i,
8
+ linkText: o,
9
+ setLinkText: c,
10
+ editingAnchorRef: n,
11
+ openLinkPrompt: a((r) => {
12
+ if (r)
13
+ n.current = r, c(r.textContent ?? ""), i(r.getAttribute("href") ?? "");
14
+ else {
15
+ n.current = null;
16
+ const e = window.getSelection();
17
+ e && e.rangeCount > 0 && (s.current = e.getRangeAt(0).cloneRange(), c(e.toString())), i("");
18
+ }
19
+ u(!0);
20
+ }, []),
21
+ confirmLink: a(() => {
22
+ const r = m.current;
23
+ if (r) {
24
+ if (r.focus(), n.current) {
25
+ const e = n.current;
26
+ if (t)
27
+ e.setAttribute("href", t), o && (e.textContent = o);
28
+ else {
29
+ const l = e.parentNode;
30
+ for (; e.firstChild; ) l?.insertBefore(e.firstChild, e);
31
+ l?.removeChild(e);
32
+ }
33
+ n.current = null;
34
+ } else {
35
+ d();
36
+ const e = window.getSelection();
37
+ if (s.current && (e?.removeAllRanges(), e?.addRange(s.current)), t) if (o && e?.toString() === "") document.execCommand("insertHTML", !1, `<a href="${t}" target="_blank" rel="noopener noreferrer">${o}</a>`);
38
+ else {
39
+ document.execCommand("createLink", !1, t);
40
+ const l = e?.anchorNode?.parentElement?.closest("a");
41
+ l && (l.setAttribute("target", "_blank"), l.setAttribute("rel", "noopener noreferrer"));
42
+ }
43
+ s.current = null;
44
+ }
45
+ u(!1), i(""), c(""), g();
46
+ }
47
+ }, [
48
+ m,
49
+ t,
50
+ o,
51
+ d,
52
+ g
53
+ ]),
54
+ cancelLink: a(() => {
55
+ u(!1), i(""), c(""), s.current = null, n.current = null;
56
+ }, [])
57
+ };
58
+ };
59
+ export {
60
+ h as useLinkPrompt
61
+ };