@arkyn/components 3.0.1-beta.156 → 3.0.1-beta.158

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 (177) hide show
  1. package/dist/components/calendar/_viewService.d.ts +1 -1
  2. package/dist/components/fullCalendar/_viewService.d.ts +2 -2
  3. package/dist/hooks/useScopedParams.d.ts +1 -1
  4. package/dist/index.js +4347 -4683
  5. package/dist/modules/components/alert/alertContainer/index.js +25 -20
  6. package/dist/modules/components/alert/alertContent/index.js +11 -8
  7. package/dist/modules/components/alert/alertDescription/index.js +11 -8
  8. package/dist/modules/components/alert/alertIcon/index.js +27 -19
  9. package/dist/modules/components/alert/alertTitle/index.js +11 -8
  10. package/dist/modules/components/audioPlayer/index.js +74 -75
  11. package/dist/modules/components/audioUpload/hasFileContent/index.js +54 -62
  12. package/dist/modules/components/audioUpload/index.js +71 -79
  13. package/dist/modules/components/audioUpload/noFileContent/index.js +35 -45
  14. package/dist/modules/components/badge/index.js +26 -22
  15. package/dist/modules/components/button/index.js +39 -32
  16. package/dist/modules/components/calendar/_calendarProvider.js +38 -63
  17. package/dist/modules/components/calendar/_viewService.js +132 -140
  18. package/dist/modules/components/calendar/calendarContainer/index.js +10 -7
  19. package/dist/modules/components/calendar/calendarHeader/index.js +51 -72
  20. package/dist/modules/components/calendar/calendarTableBody/index.js +12 -10
  21. package/dist/modules/components/calendar/calendarTableContainer/index.js +10 -7
  22. package/dist/modules/components/calendar/calendarTableHeader/index.js +13 -10
  23. package/dist/modules/components/calendar/calendarTableTd/index.js +20 -23
  24. package/dist/modules/components/calendar/index.js +31 -49
  25. package/dist/modules/components/cardTab/cardTabButton/index.js +19 -29
  26. package/dist/modules/components/cardTab/cardTabContainer/index.js +22 -28
  27. package/dist/modules/components/cardTab/cardTabContext.js +13 -11
  28. package/dist/modules/components/checkbox/index.js +37 -64
  29. package/dist/modules/components/clientOnly.js +8 -8
  30. package/dist/modules/components/currencyInput/index.js +110 -138
  31. package/dist/modules/components/divider/index.js +10 -11
  32. package/dist/modules/components/drawer/drawerContainer/index.js +40 -43
  33. package/dist/modules/components/drawer/drawerContext.js +13 -11
  34. package/dist/modules/components/drawer/drawerHeader/index.js +20 -27
  35. package/dist/modules/components/facebookPixel/facebookPixel.client.js +8 -18
  36. package/dist/modules/components/facebookPixel/index.js +8 -8
  37. package/dist/modules/components/facebookPixel/pixel.js +47 -52
  38. package/dist/modules/components/fieldError/index.js +12 -8
  39. package/dist/modules/components/fieldLabel/index.js +11 -12
  40. package/dist/modules/components/fieldWrapper/index.js +12 -13
  41. package/dist/modules/components/fileUpload/hasFileContent/index.js +59 -67
  42. package/dist/modules/components/fileUpload/index.js +65 -72
  43. package/dist/modules/components/fileUpload/noFileContent/index.js +35 -45
  44. package/dist/modules/components/fullCalendar/_fullCalendarProvider.js +33 -46
  45. package/dist/modules/components/fullCalendar/_viewService.js +100 -105
  46. package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +10 -7
  47. package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +70 -78
  48. package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +28 -33
  49. package/dist/modules/components/fullCalendar/dayCalendar/index.js +12 -9
  50. package/dist/modules/components/fullCalendar/fullCalendarContainer/index.js +10 -7
  51. package/dist/modules/components/fullCalendar/fullCalendarHeader/index.js +67 -70
  52. package/dist/modules/components/fullCalendar/index.js +30 -30
  53. package/dist/modules/components/fullCalendar/monthlyCalendar/index.js +9 -12
  54. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +28 -36
  55. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +11 -9
  56. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +10 -9
  57. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +13 -10
  58. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +35 -36
  59. package/dist/modules/components/fullCalendar/weekCalendar/index.js +8 -11
  60. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +70 -78
  61. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +17 -20
  62. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +9 -8
  63. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +16 -19
  64. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +34 -39
  65. package/dist/modules/components/googleAnalytics/googleAnalytics.client.js +7 -7
  66. package/dist/modules/components/googleAnalytics/googleAnalytics.js +17 -17
  67. package/dist/modules/components/googleAnalytics/index.js +9 -9
  68. package/dist/modules/components/googleAnalytics/snippets/generateGAElements.js +10 -12
  69. package/dist/modules/components/googleTagManager/googleTagManager.client.js +6 -6
  70. package/dist/modules/components/googleTagManager/googleTagManager.js +44 -48
  71. package/dist/modules/components/googleTagManager/index.js +16 -27
  72. package/dist/modules/components/googleTagManager/snippets/appendToDataLayer.js +8 -8
  73. package/dist/modules/components/googleTagManager/snippets/generateGTMElements.js +19 -20
  74. package/dist/modules/components/iconButton/index.js +31 -29
  75. package/dist/modules/components/imageUpload/hasFileContent/index.js +46 -63
  76. package/dist/modules/components/imageUpload/index.js +65 -82
  77. package/dist/modules/components/imageUpload/noFileContent/index.js +35 -45
  78. package/dist/modules/components/input/index.js +92 -120
  79. package/dist/modules/components/mapView/index.js +27 -31
  80. package/dist/modules/components/mapView/mapView.client.js +49 -51
  81. package/dist/modules/components/maskedInput/index.js +101 -112
  82. package/dist/modules/components/modal/modalContainer/index.js +49 -42
  83. package/dist/modules/components/modal/modalContext.js +13 -11
  84. package/dist/modules/components/modal/modalFooter/index.js +10 -7
  85. package/dist/modules/components/modal/modalHeader/index.js +20 -27
  86. package/dist/modules/components/multiSelect/index.js +115 -154
  87. package/dist/modules/components/multiSelect/multiSelectChevron/index.js +18 -21
  88. package/dist/modules/components/multiSelect/multiSelectContainer/index.js +13 -29
  89. package/dist/modules/components/multiSelect/multiSelectContent/index.js +11 -8
  90. package/dist/modules/components/multiSelect/multiSelectMark/index.js +19 -22
  91. package/dist/modules/components/multiSelect/multiSelectOption/index.js +17 -13
  92. package/dist/modules/components/multiSelect/multiSelectOptionsContainer/index.js +35 -45
  93. package/dist/modules/components/multiSelect/multiSelectOverlay/index.js +11 -8
  94. package/dist/modules/components/multiSelect/multiSelectSpinner/index.js +13 -16
  95. package/dist/modules/components/pagination/chevronButton/index.js +17 -17
  96. package/dist/modules/components/pagination/currentButton/index.js +11 -7
  97. package/dist/modules/components/pagination/index.js +51 -83
  98. package/dist/modules/components/pagination/pageButton/index.js +12 -8
  99. package/dist/modules/components/pagination/paginationService.js +33 -48
  100. package/dist/modules/components/pagination/spread/index.js +10 -7
  101. package/dist/modules/components/phoneInput/index.js +103 -151
  102. package/dist/modules/components/phoneInput/phoneInputContainer/index.js +12 -19
  103. package/dist/modules/components/phoneInput/phoneInputCountriesOverlay/index.js +11 -8
  104. package/dist/modules/components/phoneInput/phoneInputCountryOption/index.js +23 -15
  105. package/dist/modules/components/phoneInput/phoneInputCountryOptionsContainer/index.js +33 -43
  106. package/dist/modules/components/phoneInput/phoneInputCountrySelector/index.js +25 -21
  107. package/dist/modules/components/phoneInput/phoneInputMask/index.js +46 -62
  108. package/dist/modules/components/popover/index.js +37 -36
  109. package/dist/modules/components/radio/radioBox/index.js +24 -42
  110. package/dist/modules/components/radio/radioContext.js +20 -18
  111. package/dist/modules/components/radio/radioGroup/index.js +41 -64
  112. package/dist/modules/components/richText/blockButton/index.js +20 -23
  113. package/dist/modules/components/richText/element/index.js +72 -58
  114. package/dist/modules/components/richText/index.js +143 -135
  115. package/dist/modules/components/richText/insertImage/index.js +94 -105
  116. package/dist/modules/components/richText/insertVideo/index.js +85 -97
  117. package/dist/modules/components/richText/leaf/index.js +9 -6
  118. package/dist/modules/components/richText/markButton/index.js +19 -22
  119. package/dist/modules/components/richText/toolbar/index.js +10 -7
  120. package/dist/modules/components/searchPlaces.js +57 -66
  121. package/dist/modules/components/select/index.js +112 -144
  122. package/dist/modules/components/select/selectChevron/index.js +18 -21
  123. package/dist/modules/components/select/selectContainer/index.js +13 -29
  124. package/dist/modules/components/select/selectContent/index.js +11 -8
  125. package/dist/modules/components/select/selectOption/index.js +17 -13
  126. package/dist/modules/components/select/selectOptionsContainer/index.js +35 -45
  127. package/dist/modules/components/select/selectOverlay/index.js +11 -8
  128. package/dist/modules/components/select/selectSpinner/index.js +13 -9
  129. package/dist/modules/components/slider/index.js +34 -41
  130. package/dist/modules/components/switch/index.js +35 -62
  131. package/dist/modules/components/tab/tabButton/index.js +19 -29
  132. package/dist/modules/components/tab/tabContainer/index.js +22 -28
  133. package/dist/modules/components/tab/tabContext.js +12 -10
  134. package/dist/modules/components/table/tableBody/index.js +19 -14
  135. package/dist/modules/components/table/tableCaption/index.js +15 -8
  136. package/dist/modules/components/table/tableContainer/index.js +12 -8
  137. package/dist/modules/components/table/tableFooter/index.js +18 -11
  138. package/dist/modules/components/table/tableHeader/index.js +12 -11
  139. package/dist/modules/components/textarea/index.js +51 -69
  140. package/dist/modules/components/tooltip/index.js +34 -45
  141. package/dist/modules/hooks/useAutomation.js +35 -27
  142. package/dist/modules/hooks/useDrawer.js +17 -19
  143. package/dist/modules/hooks/useForm.js +6 -6
  144. package/dist/modules/hooks/useHydrated.js +7 -12
  145. package/dist/modules/hooks/useModal.js +17 -19
  146. package/dist/modules/hooks/useScopedParams.js +17 -17
  147. package/dist/modules/hooks/useScrollLock.js +19 -19
  148. package/dist/modules/hooks/useSearchAutomation.js +31 -14
  149. package/dist/modules/hooks/useSlider.js +13 -13
  150. package/dist/modules/hooks/useToast.js +8 -9
  151. package/dist/modules/index.js +72 -144
  152. package/dist/modules/providers/drawerProvider.js +35 -30
  153. package/dist/modules/providers/formProvider.js +11 -16
  154. package/dist/modules/providers/modalProvider.js +39 -33
  155. package/dist/modules/providers/placesProvider.js +16 -16
  156. package/dist/modules/providers/toastProvider.js +45 -51
  157. package/dist/modules/services/extractTextFromNode.js +6 -6
  158. package/dist/modules/services/fieldTemplate.js +22 -23
  159. package/dist/modules/services/iconRenderer.js +14 -7
  160. package/dist/modules/services/isBlockActive.js +12 -14
  161. package/dist/modules/services/isMarkActive.js +6 -6
  162. package/dist/modules/services/maskCurrencyValues.js +11 -12
  163. package/dist/modules/services/toHtml.js +6 -6
  164. package/dist/modules/services/toRichTextValue.js +7 -7
  165. package/dist/modules/services/toggleBlock.js +20 -19
  166. package/dist/modules/services/toggleMark.js +7 -7
  167. package/dist/modules/style.css +2 -1
  168. package/dist/modules/templates/badResponses.js +13 -13
  169. package/dist/modules/templates/richTextTemplates.js +17 -14
  170. package/dist/modules/templates/successResponses.js +9 -4
  171. package/dist/modules/utils/phoneInputUtilities.js +18 -28
  172. package/dist/modules/utils/richTextUtilities.js +88 -75
  173. package/dist/services/fieldTemplate.d.ts +1 -1
  174. package/dist/services/fieldTemplate.d.ts.map +1 -1
  175. package/dist/style.css +2 -1
  176. package/package.json +4 -4
  177. package/styles.d.ts +2 -0
@@ -1,59 +1,73 @@
1
- import { jsx as s, jsxs as l } from "react/jsx-runtime";
2
- /* empty css */
3
- function i({ attributes: e, children: a, element: c }) {
4
- const r = { textAlign: c.align };
5
- switch (c.type) {
6
- case "blockQuote":
7
- return /* @__PURE__ */ s(
8
- "blockquote",
9
- {
10
- className: "arkynElementBlockquote",
11
- style: r,
12
- ...e,
13
- children: a
14
- }
15
- );
16
- case "bulletedList":
17
- return /* @__PURE__ */ s("ul", { className: "arkynElementBulletList", style: r, ...e, children: a });
18
- case "headingOne":
19
- return /* @__PURE__ */ s("h1", { className: "arkynElementHeadingOne", style: r, ...e, children: a });
20
- case "headingTwo":
21
- return /* @__PURE__ */ s("h2", { className: "arkynElementHeadingTwo", style: r, ...e, children: a });
22
- case "listItem":
23
- return /* @__PURE__ */ s("li", { className: "arkynElementListItem", style: r, ...e, children: a });
24
- case "numberedList":
25
- return /* @__PURE__ */ s("ol", { className: "arkynElementNumberedList", style: r, ...e, children: a });
26
- case "image":
27
- return /* @__PURE__ */ l("div", { style: r, ...e, children: [
28
- /* @__PURE__ */ s(
29
- "img",
30
- {
31
- className: "arkynElementImage",
32
- alt: "arkynElementImage",
33
- src: (c == null ? void 0 : c.src) || ""
34
- }
35
- ),
36
- a
37
- ] });
38
- case "video":
39
- return /* @__PURE__ */ l("div", { style: r, ...e, children: [
40
- /* @__PURE__ */ s(
41
- "iframe",
42
- {
43
- className: "arkynElementVideo",
44
- src: (c == null ? void 0 : c.src) || "",
45
- title: "YouTube video player",
46
- allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
47
- referrerPolicy: "strict-origin-when-cross-origin",
48
- allowFullScreen: !0
49
- }
50
- ),
51
- a
52
- ] });
53
- default:
54
- return /* @__PURE__ */ s("p", { className: "arkynElementParagraph", style: r, ...e, children: a });
55
- }
1
+ /* empty css */
2
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
3
+ //#region src/components/richText/element/index.tsx
4
+ function n({ attributes: n, children: r, element: i }) {
5
+ let a = { textAlign: i.align };
6
+ switch (i.type) {
7
+ case "blockQuote": return /* @__PURE__ */ e("blockquote", {
8
+ className: "arkynElementBlockquote",
9
+ style: a,
10
+ ...n,
11
+ children: r
12
+ });
13
+ case "bulletedList": return /* @__PURE__ */ e("ul", {
14
+ className: "arkynElementBulletList",
15
+ style: a,
16
+ ...n,
17
+ children: r
18
+ });
19
+ case "headingOne": return /* @__PURE__ */ e("h1", {
20
+ className: "arkynElementHeadingOne",
21
+ style: a,
22
+ ...n,
23
+ children: r
24
+ });
25
+ case "headingTwo": return /* @__PURE__ */ e("h2", {
26
+ className: "arkynElementHeadingTwo",
27
+ style: a,
28
+ ...n,
29
+ children: r
30
+ });
31
+ case "listItem": return /* @__PURE__ */ e("li", {
32
+ className: "arkynElementListItem",
33
+ style: a,
34
+ ...n,
35
+ children: r
36
+ });
37
+ case "numberedList": return /* @__PURE__ */ e("ol", {
38
+ className: "arkynElementNumberedList",
39
+ style: a,
40
+ ...n,
41
+ children: r
42
+ });
43
+ case "image": return /* @__PURE__ */ t("div", {
44
+ style: a,
45
+ ...n,
46
+ children: [/* @__PURE__ */ e("img", {
47
+ className: "arkynElementImage",
48
+ alt: "arkynElementImage",
49
+ src: i?.src || ""
50
+ }), r]
51
+ });
52
+ case "video": return /* @__PURE__ */ t("div", {
53
+ style: a,
54
+ ...n,
55
+ children: [/* @__PURE__ */ e("iframe", {
56
+ className: "arkynElementVideo",
57
+ src: i?.src || "",
58
+ title: "YouTube video player",
59
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
60
+ referrerPolicy: "strict-origin-when-cross-origin",
61
+ allowFullScreen: !0
62
+ }), r]
63
+ });
64
+ default: return /* @__PURE__ */ e("p", {
65
+ className: "arkynElementParagraph",
66
+ style: a,
67
+ ...n,
68
+ children: r
69
+ });
70
+ }
56
71
  }
57
- export {
58
- i as Element
59
- };
72
+ //#endregion
73
+ export { n as Element };
@@ -1,136 +1,144 @@
1
- import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
- import Y from "is-hotkey";
3
- import { Heading1 as Z, Heading2 as _, Quote as ee, Bold as re, Italic as te, Underline as oe, Code as ne, AlignLeft as ie, AlignRight as se, AlignCenter as ae, AlignJustify as ce } from "lucide-react";
4
- import { useMemo as le, useState as g, useRef as me, useId as fe, useCallback as F } from "react";
5
- import { createEditor as ue, Transforms as de } from "slate";
6
- import { withHistory as he } from "slate-history";
7
- import { withReact as pe, Slate as ge, Editable as Ce } from "slate-react";
8
- import { BlockButton as n } from "./blockButton/index.js";
9
- import { Element as ye } from "./element/index.js";
10
- import { InsertImage as Ne } from "./insertImage/index.js";
11
- import { InsertVideo as be } from "./insertVideo/index.js";
12
- import { Leaf as ke } from "./leaf/index.js";
13
- import { MarkButton as l } from "./markButton/index.js";
14
- import { Toolbar as Te } from "./toolbar/index.js";
15
- import { useForm as xe } from "../../hooks/useForm.js";
16
- import { extractTextFromNode as I } from "../../services/extractTextFromNode.js";
17
- import { FieldTemplate as Fe } from "../../services/fieldTemplate.js";
18
- import { toggleMark as Ie } from "../../services/toggleMark.js";
19
- import { hotKeys as V, initialValue as m } from "../../templates/richTextTemplates.js";
20
- /* empty css */
21
- function Ge(w) {
22
- const {
23
- name: s,
24
- hiddenButtons: f,
25
- imageConfig: C,
26
- videoConfig: A,
27
- className: E = "",
28
- defaultValue: O = "[]",
29
- enforceCharacterLimit: S = !1,
30
- onChangeCharactersCount: y,
31
- baseErrorMessage: j,
32
- maxLimit: a = 1e4,
33
- onChange: N,
34
- isError: H,
35
- label: L,
36
- showAsterisk: M,
37
- id: R,
38
- orientation: v = "vertical",
39
- unShowFieldTemplate: B = !1
40
- } = w, c = le(() => he(pe(ue())), []), { fieldErrors: u } = xe();
41
- function d() {
42
- try {
43
- const r = JSON.parse(O);
44
- return Array.isArray(r) ? r.length <= 0 ? m : r.every(
45
- (i) => typeof i == "object" && i !== null && "type" in i && "children" in i
46
- ) ? r : m : m;
47
- } catch {
48
- return m;
49
- }
50
- }
51
- const J = I(d()), [h, D] = g(J.length), [Q, $] = g(
52
- JSON.stringify(d()) || "[]"
53
- ), [K, b] = g(!1), U = me(null), q = R || fe(), k = j || (u == null ? void 0 : u[s]), z = H || !!k, G = F(ke, []), P = F(ye, []);
54
- function T(r) {
55
- const o = I(r);
56
- D(o.length), y && y(o.length), !(S && o.length >= a) && ($(JSON.stringify(r)), N && N(r), c.children = r, de.setNodes(c, { children: r }));
57
- }
58
- const W = K ? "focusTrue" : "focusFalse", X = `arkynRichText ${z || a < h ? "errorTrue" : "errorFalse"} ${W}`, x = a - h;
59
- function t(r) {
60
- return !(f != null && f.includes(r));
61
- }
62
- return /* @__PURE__ */ e(
63
- Fe,
64
- {
65
- name: s,
66
- label: L,
67
- showAsterisk: M,
68
- className: E,
69
- errorMessage: k,
70
- unShowFieldTemplate: B,
71
- orientation: v,
72
- children: /* @__PURE__ */ p(
73
- ge,
74
- {
75
- editor: c,
76
- initialValue: d(),
77
- onChange: T,
78
- onValueChange: T,
79
- children: [
80
- /* @__PURE__ */ p("div", { className: X, children: [
81
- /* @__PURE__ */ p(Te, { children: [
82
- t("headingOne") && /* @__PURE__ */ e(n, { format: "headingOne", icon: Z }),
83
- t("headingTwo") && /* @__PURE__ */ e(n, { format: "headingTwo", icon: _ }),
84
- t("blockQuote") && /* @__PURE__ */ e(n, { format: "blockQuote", icon: ee }),
85
- t("bold") && /* @__PURE__ */ e(l, { format: "bold", icon: re }),
86
- t("italic") && /* @__PURE__ */ e(l, { format: "italic", icon: te }),
87
- t("underline") && /* @__PURE__ */ e(l, { format: "underline", icon: oe }),
88
- t("code") && /* @__PURE__ */ e(l, { format: "code", icon: ne }),
89
- t("left") && /* @__PURE__ */ e(n, { format: "left", icon: ie }),
90
- t("right") && /* @__PURE__ */ e(n, { format: "right", icon: se }),
91
- t("center") && /* @__PURE__ */ e(n, { format: "center", icon: ae }),
92
- t("justify") && /* @__PURE__ */ e(n, { format: "justify", icon: ce }),
93
- C && t("image") && /* @__PURE__ */ e(Ne, { ...C }),
94
- t("video") && /* @__PURE__ */ e(be, { ...A })
95
- ] }),
96
- /* @__PURE__ */ e(
97
- Ce,
98
- {
99
- className: "editorContainer",
100
- renderElement: P,
101
- renderLeaf: G,
102
- spellCheck: !0,
103
- ref: U,
104
- id: q,
105
- onFocus: () => b(!0),
106
- onBlur: () => b(!1),
107
- onKeyDown: (r) => {
108
- for (const o in V)
109
- if (Y(o, r)) {
110
- r.preventDefault();
111
- const i = V[o];
112
- Ie(c, i);
113
- }
114
- }
115
- }
116
- ),
117
- x < 0 && /* @__PURE__ */ e("div", { className: "restatesCharacters", children: x })
118
- ] }),
119
- /* @__PURE__ */ e(
120
- "input",
121
- {
122
- type: "hidden",
123
- name: s,
124
- value: Q.slice(0, a)
125
- }
126
- ),
127
- /* @__PURE__ */ e("input", { type: "hidden", name: `${s}Count`, value: h })
128
- ]
129
- }
130
- )
131
- }
132
- );
1
+ import { useForm as e } from "../../hooks/useForm.js";
2
+ import { FieldTemplate as t } from "../../services/fieldTemplate.js";
3
+ import { hotKeys as n, initialValue as r } from "../../templates/richTextTemplates.js";
4
+ import { BlockButton as i } from "./blockButton/index.js";
5
+ import { Element as ee } from "./element/index.js";
6
+ import { InsertImage as a } from "./insertImage/index.js";
7
+ import { InsertVideo as o } from "./insertVideo/index.js";
8
+ import { Leaf as te } from "./leaf/index.js";
9
+ import { toggleMark as ne } from "../../services/toggleMark.js";
10
+ import { MarkButton as s } from "./markButton/index.js";
11
+ import { Toolbar as c } from "./toolbar/index.js";
12
+ import { extractTextFromNode as l } from "../../services/extractTextFromNode.js";
13
+ /* empty css */
14
+ import { useCallback as u, useId as d, useMemo as f, useRef as p, useState as m } from "react";
15
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
16
+ import { AlignCenter as re, AlignJustify as ie, AlignLeft as ae, AlignRight as oe, Bold as se, Code as ce, Heading1 as _, Heading2 as v, Italic as y, Quote as b, Underline as x } from "lucide-react";
17
+ import S from "is-hotkey";
18
+ import { Transforms as C, createEditor as w } from "slate";
19
+ import { withHistory as T } from "slate-history";
20
+ import { Editable as E, Slate as D, withReact as O } from "slate-react";
21
+ //#region src/components/richText/index.tsx
22
+ function k(k) {
23
+ let { name: A, hiddenButtons: j, imageConfig: M, videoConfig: N, className: P = "", defaultValue: F = "[]", enforceCharacterLimit: I = !1, onChangeCharactersCount: L, baseErrorMessage: R, maxLimit: z = 1e4, onChange: B, isError: le, label: V, showAsterisk: H, id: U, orientation: W = "vertical", unShowFieldTemplate: ue = !1 } = k, G = f(() => T(O(w())), []), { fieldErrors: de } = e();
24
+ function K() {
25
+ try {
26
+ let e = JSON.parse(F);
27
+ return !Array.isArray(e) || e.length <= 0 ? r : e.every((e) => typeof e == "object" && !!e && "type" in e && "children" in e) ? e : r;
28
+ } catch {
29
+ return r;
30
+ }
31
+ }
32
+ let [q, fe] = m(l(K()).length), [pe, me] = m(JSON.stringify(K()) || "[]"), [he, J] = m(!1), ge = p(null), _e = U || d(), Y = R || de?.[A], ve = le || !!Y, ye = u(te, []), X = u(ee, []);
33
+ function Z(e) {
34
+ let t = l(e);
35
+ fe(t.length), L && L(t.length), !(I && t.length >= z) && (me(JSON.stringify(e)), B && B(e), G.children = e, C.setNodes(G, { children: e }));
36
+ }
37
+ let be = `arkynRichText ${ve || z < q ? "errorTrue" : "errorFalse"} ${he ? "focusTrue" : "focusFalse"}`, Q = z - q;
38
+ function $(e) {
39
+ return !j?.includes(e);
40
+ }
41
+ return /* @__PURE__ */ h(t, {
42
+ name: A,
43
+ label: V,
44
+ showAsterisk: H,
45
+ className: P,
46
+ errorMessage: Y,
47
+ unShowFieldTemplate: ue,
48
+ orientation: W,
49
+ children: /* @__PURE__ */ g(D, {
50
+ editor: G,
51
+ initialValue: K(),
52
+ onChange: Z,
53
+ onValueChange: Z,
54
+ children: [
55
+ /* @__PURE__ */ g("div", {
56
+ className: be,
57
+ children: [
58
+ /* @__PURE__ */ g(c, { children: [
59
+ $("headingOne") && /* @__PURE__ */ h(i, {
60
+ format: "headingOne",
61
+ icon: _
62
+ }),
63
+ $("headingTwo") && /* @__PURE__ */ h(i, {
64
+ format: "headingTwo",
65
+ icon: v
66
+ }),
67
+ $("blockQuote") && /* @__PURE__ */ h(i, {
68
+ format: "blockQuote",
69
+ icon: b
70
+ }),
71
+ $("bold") && /* @__PURE__ */ h(s, {
72
+ format: "bold",
73
+ icon: se
74
+ }),
75
+ $("italic") && /* @__PURE__ */ h(s, {
76
+ format: "italic",
77
+ icon: y
78
+ }),
79
+ $("underline") && /* @__PURE__ */ h(s, {
80
+ format: "underline",
81
+ icon: x
82
+ }),
83
+ $("code") && /* @__PURE__ */ h(s, {
84
+ format: "code",
85
+ icon: ce
86
+ }),
87
+ $("left") && /* @__PURE__ */ h(i, {
88
+ format: "left",
89
+ icon: ae
90
+ }),
91
+ $("right") && /* @__PURE__ */ h(i, {
92
+ format: "right",
93
+ icon: oe
94
+ }),
95
+ $("center") && /* @__PURE__ */ h(i, {
96
+ format: "center",
97
+ icon: re
98
+ }),
99
+ $("justify") && /* @__PURE__ */ h(i, {
100
+ format: "justify",
101
+ icon: ie
102
+ }),
103
+ M && $("image") && /* @__PURE__ */ h(a, { ...M }),
104
+ $("video") && /* @__PURE__ */ h(o, { ...N })
105
+ ] }),
106
+ /* @__PURE__ */ h(E, {
107
+ className: "editorContainer",
108
+ renderElement: X,
109
+ renderLeaf: ye,
110
+ spellCheck: !0,
111
+ ref: ge,
112
+ id: _e,
113
+ onFocus: () => J(!0),
114
+ onBlur: () => J(!1),
115
+ onKeyDown: (e) => {
116
+ for (let t in n) if (S(t, e)) {
117
+ e.preventDefault();
118
+ let r = n[t];
119
+ ne(G, r);
120
+ }
121
+ }
122
+ }),
123
+ Q < 0 && /* @__PURE__ */ h("div", {
124
+ className: "restatesCharacters",
125
+ children: Q
126
+ })
127
+ ]
128
+ }),
129
+ /* @__PURE__ */ h("input", {
130
+ type: "hidden",
131
+ name: A,
132
+ value: pe.slice(0, z)
133
+ }),
134
+ /* @__PURE__ */ h("input", {
135
+ type: "hidden",
136
+ name: `${A}Count`,
137
+ value: q
138
+ })
139
+ ]
140
+ })
141
+ });
133
142
  }
134
- export {
135
- Ge as RichText
136
- };
143
+ //#endregion
144
+ export { k as RichText };
@@ -1,106 +1,95 @@
1
- import { jsxs as a, Fragment as s, jsx as e } from "react/jsx-runtime";
2
- import { Image as T } from "lucide-react";
3
- import { useState as l } from "react";
4
- import { useSlate as U } from "slate-react";
5
- import { Button as d } from "../../button/index.js";
6
- import { ImageUpload as L } from "../../imageUpload/index.js";
7
- import { Input as R } from "../../input/index.js";
8
- import { ModalContainer as k } from "../../modal/modalContainer/index.js";
9
- import { ModalFooter as M } from "../../modal/modalFooter/index.js";
10
- import { ModalHeader as w } from "../../modal/modalHeader/index.js";
11
- import { TabButton as c } from "../../tab/tabButton/index.js";
12
- import { TabContainer as V } from "../../tab/tabContainer/index.js";
13
- /* empty css */
14
- function J(u) {
15
- const {
16
- action: p,
17
- tabLabels: i = ["Adicionar URL", "Upload de arquivo"],
18
- modalCancelButton: h = "Cancelar",
19
- modalConfirmButton: f = "Confirmar",
20
- modalInputImageLabel: g = "Imagem:",
21
- modalInputUrlLabel: I = "URL da imagem:",
22
- modalTitle: b = "Inserir imagem"
23
- } = u, x = U(), [y, o] = l(!1), [t, m] = l(""), [n, C] = l("url");
24
- function v(r) {
25
- r.preventDefault(), !(!t || t === "") && (x.insertNodes([
26
- { type: "paragraph", children: [{ text: "" }] },
27
- { type: "image", src: t, children: [{ text: "" }] },
28
- { type: "paragraph", children: [{ text: "" }] }
29
- ]), o(!1));
30
- }
31
- return /* @__PURE__ */ a(s, { children: [
32
- /* @__PURE__ */ e(
33
- "button",
34
- {
35
- type: "button",
36
- className: "arkynRichTextInsertImage",
37
- onMouseDown: () => o(!0),
38
- children: /* @__PURE__ */ e(T, {})
39
- }
40
- ),
41
- /* @__PURE__ */ a(
42
- k,
43
- {
44
- isVisible: y,
45
- makeInvisible: () => o(!1),
46
- children: [
47
- /* @__PURE__ */ e(w, { children: b }),
48
- /* @__PURE__ */ a("div", { className: "arkynRichTextInsertImageModalContent", children: [
49
- /* @__PURE__ */ a(V, { defaultValue: n, onChange: C, children: [
50
- /* @__PURE__ */ e(c, { value: "url", children: i[0] }),
51
- /* @__PURE__ */ e(c, { value: "file", children: i[1] })
52
- ] }),
53
- n === "url" && /* @__PURE__ */ a(s, { children: [
54
- /* @__PURE__ */ e(
55
- R,
56
- {
57
- type: "text",
58
- name: "richTextImageURL",
59
- label: I,
60
- showAsterisk: !0,
61
- defaultValue: t,
62
- onChange: (r) => m(r.target.value)
63
- }
64
- ),
65
- t && /* @__PURE__ */ e(
66
- "img",
67
- {
68
- className: "arkynRichTextInsertImageModalPreviewImage",
69
- src: t,
70
- alt: "preview"
71
- }
72
- )
73
- ] }),
74
- n === "file" && /* @__PURE__ */ e(
75
- L,
76
- {
77
- name: "richTextImageURL",
78
- action: p,
79
- label: g,
80
- showAsterisk: !0,
81
- defaultValue: t,
82
- onChange: (r) => m(r)
83
- }
84
- )
85
- ] }),
86
- /* @__PURE__ */ a(M, { children: [
87
- /* @__PURE__ */ e(
88
- d,
89
- {
90
- type: "button",
91
- scheme: "danger",
92
- variant: "outline",
93
- onClick: () => o(!1),
94
- children: h
95
- }
96
- ),
97
- /* @__PURE__ */ e(d, { type: "button", onClick: v, children: f })
98
- ] })
99
- ]
100
- }
101
- )
102
- ] });
1
+ import { Button as e } from "../../button/index.js";
2
+ import { Input as t } from "../../input/index.js";
3
+ import { ImageUpload as n } from "../../imageUpload/index.js";
4
+ import { ModalContainer as r } from "../../modal/modalContainer/index.js";
5
+ import { ModalFooter as i } from "../../modal/modalFooter/index.js";
6
+ import { ModalHeader as a } from "../../modal/modalHeader/index.js";
7
+ import { TabButton as o } from "../../tab/tabButton/index.js";
8
+ import { TabContainer as s } from "../../tab/tabContainer/index.js";
9
+ /* empty css */
10
+ import { useState as c } from "react";
11
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
12
+ import { Image as f } from "lucide-react";
13
+ import { useSlate as p } from "slate-react";
14
+ //#region src/components/richText/insertImage/index.tsx
15
+ function m(m) {
16
+ let { action: h, tabLabels: g = ["Adicionar URL", "Upload de arquivo"], modalCancelButton: _ = "Cancelar", modalConfirmButton: v = "Confirmar", modalInputImageLabel: y = "Imagem:", modalInputUrlLabel: b = "URL da imagem:", modalTitle: x = "Inserir imagem" } = m, S = p(), [C, w] = c(!1), [T, E] = c(""), [D, O] = c("url");
17
+ function k(e) {
18
+ e.preventDefault(), !(!T || T === "") && (S.insertNodes([
19
+ {
20
+ type: "paragraph",
21
+ children: [{ text: "" }]
22
+ },
23
+ {
24
+ type: "image",
25
+ src: T,
26
+ children: [{ text: "" }]
27
+ },
28
+ {
29
+ type: "paragraph",
30
+ children: [{ text: "" }]
31
+ }
32
+ ]), w(!1));
33
+ }
34
+ return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("button", {
35
+ type: "button",
36
+ className: "arkynRichTextInsertImage",
37
+ onMouseDown: () => w(!0),
38
+ children: /* @__PURE__ */ u(f, {})
39
+ }), /* @__PURE__ */ d(r, {
40
+ isVisible: C,
41
+ makeInvisible: () => w(!1),
42
+ children: [
43
+ /* @__PURE__ */ u(a, { children: x }),
44
+ /* @__PURE__ */ d("div", {
45
+ className: "arkynRichTextInsertImageModalContent",
46
+ children: [
47
+ /* @__PURE__ */ d(s, {
48
+ defaultValue: D,
49
+ onChange: O,
50
+ children: [/* @__PURE__ */ u(o, {
51
+ value: "url",
52
+ children: g[0]
53
+ }), /* @__PURE__ */ u(o, {
54
+ value: "file",
55
+ children: g[1]
56
+ })]
57
+ }),
58
+ D === "url" && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(t, {
59
+ type: "text",
60
+ name: "richTextImageURL",
61
+ label: b,
62
+ showAsterisk: !0,
63
+ defaultValue: T,
64
+ onChange: (e) => E(e.target.value)
65
+ }), T && /* @__PURE__ */ u("img", {
66
+ className: "arkynRichTextInsertImageModalPreviewImage",
67
+ src: T,
68
+ alt: "preview"
69
+ })] }),
70
+ D === "file" && /* @__PURE__ */ u(n, {
71
+ name: "richTextImageURL",
72
+ action: h,
73
+ label: y,
74
+ showAsterisk: !0,
75
+ defaultValue: T,
76
+ onChange: (e) => E(e)
77
+ })
78
+ ]
79
+ }),
80
+ /* @__PURE__ */ d(i, { children: [/* @__PURE__ */ u(e, {
81
+ type: "button",
82
+ scheme: "danger",
83
+ variant: "outline",
84
+ onClick: () => w(!1),
85
+ children: _
86
+ }), /* @__PURE__ */ u(e, {
87
+ type: "button",
88
+ onClick: k,
89
+ children: v
90
+ })] })
91
+ ]
92
+ })] });
103
93
  }
104
- export {
105
- J as InsertImage
106
- };
94
+ //#endregion
95
+ export { m as InsertImage };