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

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 (337) hide show
  1. package/dist/index.js +4694 -75
  2. package/dist/modules/components/alert/alertContainer/index.js +22 -0
  3. package/dist/modules/components/alert/alertContent/index.js +9 -0
  4. package/dist/modules/components/alert/alertDescription/index.js +9 -0
  5. package/dist/modules/components/alert/alertIcon/index.js +20 -0
  6. package/dist/modules/components/alert/alertTitle/index.js +9 -0
  7. package/dist/modules/components/audioPlayer/index.js +76 -0
  8. package/dist/modules/components/audioUpload/hasFileContent/index.js +63 -0
  9. package/dist/modules/components/audioUpload/index.js +80 -0
  10. package/dist/modules/components/audioUpload/noFileContent/index.js +46 -0
  11. package/dist/modules/components/badge/index.js +23 -0
  12. package/dist/modules/components/button/index.js +33 -0
  13. package/dist/modules/components/calendar/_calendarProvider.js +65 -0
  14. package/dist/modules/components/calendar/_viewService.js +141 -0
  15. package/dist/modules/components/calendar/calendarContainer/index.js +8 -0
  16. package/dist/modules/components/calendar/calendarHeader/index.js +73 -0
  17. package/dist/modules/components/calendar/calendarTableBody/index.js +11 -0
  18. package/dist/modules/components/calendar/calendarTableContainer/index.js +8 -0
  19. package/dist/modules/components/calendar/calendarTableHeader/index.js +11 -0
  20. package/dist/modules/components/calendar/calendarTableTd/index.js +24 -0
  21. package/dist/modules/components/calendar/index.js +50 -0
  22. package/dist/modules/components/cardTab/cardTabButton/index.js +30 -0
  23. package/dist/modules/components/cardTab/cardTabContainer/index.js +29 -0
  24. package/dist/modules/components/cardTab/cardTabContext.js +13 -0
  25. package/dist/modules/components/checkbox/index.js +65 -0
  26. package/dist/modules/components/clientOnly.js +9 -0
  27. package/dist/modules/components/currencyInput/index.js +140 -0
  28. package/dist/modules/components/divider/index.js +13 -0
  29. package/dist/modules/components/drawer/drawerContainer/index.js +44 -0
  30. package/dist/modules/components/drawer/drawerContext.js +13 -0
  31. package/dist/modules/components/drawer/drawerHeader/index.js +28 -0
  32. package/dist/modules/components/facebookPixel/facebookPixel.client.js +19 -0
  33. package/dist/modules/components/facebookPixel/index.js +9 -0
  34. package/dist/modules/components/facebookPixel/pixel.js +53 -0
  35. package/dist/modules/components/fieldError/index.js +9 -0
  36. package/dist/modules/components/fieldLabel/index.js +13 -0
  37. package/dist/modules/components/fieldWrapper/index.js +14 -0
  38. package/dist/modules/components/fileUpload/hasFileContent/index.js +68 -0
  39. package/dist/modules/components/fileUpload/index.js +73 -0
  40. package/dist/modules/components/fileUpload/noFileContent/index.js +46 -0
  41. package/dist/modules/components/fullCalendar/_fullCalendarProvider.js +48 -0
  42. package/dist/modules/components/fullCalendar/_viewService.js +106 -0
  43. package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +8 -0
  44. package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +79 -0
  45. package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +34 -0
  46. package/dist/modules/components/fullCalendar/dayCalendar/index.js +11 -0
  47. package/dist/modules/components/fullCalendar/fullCalendarContainer/index.js +8 -0
  48. package/dist/modules/components/fullCalendar/fullCalendarHeader/index.js +72 -0
  49. package/dist/modules/components/fullCalendar/index.js +31 -0
  50. package/dist/modules/components/fullCalendar/monthlyCalendar/index.js +13 -0
  51. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +37 -0
  52. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +11 -0
  53. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +10 -0
  54. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +11 -0
  55. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +37 -0
  56. package/dist/modules/components/fullCalendar/weekCalendar/index.js +13 -0
  57. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +79 -0
  58. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +21 -0
  59. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +10 -0
  60. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +20 -0
  61. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +40 -0
  62. package/dist/modules/components/googleAnalytics/googleAnalytics.client.js +8 -0
  63. package/dist/modules/components/googleAnalytics/googleAnalytics.js +18 -0
  64. package/dist/modules/components/googleAnalytics/index.js +10 -0
  65. package/dist/modules/components/googleAnalytics/snippets/generateGAElements.js +16 -0
  66. package/dist/modules/components/googleTagManager/googleTagManager.client.js +8 -0
  67. package/dist/modules/components/googleTagManager/googleTagManager.js +49 -0
  68. package/dist/modules/components/googleTagManager/index.js +28 -0
  69. package/dist/modules/components/googleTagManager/snippets/appendToDataLayer.js +9 -0
  70. package/dist/modules/components/googleTagManager/snippets/generateGTMElements.js +24 -0
  71. package/dist/modules/components/iconButton/index.js +30 -0
  72. package/dist/modules/components/imageUpload/hasFileContent/index.js +64 -0
  73. package/dist/modules/components/imageUpload/index.js +83 -0
  74. package/dist/modules/components/imageUpload/noFileContent/index.js +46 -0
  75. package/dist/modules/components/input/index.js +121 -0
  76. package/dist/modules/components/mapView/index.js +33 -0
  77. package/dist/modules/components/mapView/mapView.client.js +52 -0
  78. package/dist/modules/components/maskedInput/index.js +113 -0
  79. package/dist/modules/components/modal/modalContainer/index.js +43 -0
  80. package/dist/modules/components/modal/modalContext.js +13 -0
  81. package/dist/modules/components/modal/modalFooter/index.js +9 -0
  82. package/dist/modules/components/modal/modalHeader/index.js +28 -0
  83. package/dist/modules/components/multiSelect/index.js +155 -0
  84. package/dist/modules/components/multiSelect/multiSelectChevron/index.js +22 -0
  85. package/dist/modules/components/multiSelect/multiSelectContainer/index.js +30 -0
  86. package/dist/modules/components/multiSelect/multiSelectContent/index.js +9 -0
  87. package/dist/modules/components/multiSelect/multiSelectMark/index.js +23 -0
  88. package/dist/modules/components/multiSelect/multiSelectOption/index.js +14 -0
  89. package/dist/modules/components/multiSelect/multiSelectOptionsContainer/index.js +46 -0
  90. package/dist/modules/components/multiSelect/multiSelectOverlay/index.js +9 -0
  91. package/dist/modules/components/multiSelect/multiSelectSpinner/index.js +17 -0
  92. package/dist/modules/components/pagination/chevronButton/index.js +18 -0
  93. package/dist/modules/components/pagination/currentButton/index.js +8 -0
  94. package/dist/modules/components/pagination/index.js +84 -0
  95. package/dist/modules/components/pagination/pageButton/index.js +9 -0
  96. package/dist/modules/components/pagination/paginationService.js +49 -0
  97. package/dist/modules/components/pagination/spread/index.js +9 -0
  98. package/dist/modules/components/phoneInput/index.js +152 -0
  99. package/dist/modules/components/phoneInput/phoneInputContainer/index.js +20 -0
  100. package/dist/modules/components/phoneInput/phoneInputCountriesOverlay/index.js +9 -0
  101. package/dist/modules/components/phoneInput/phoneInputCountryOption/index.js +16 -0
  102. package/dist/modules/components/phoneInput/phoneInputCountryOptionsContainer/index.js +44 -0
  103. package/dist/modules/components/phoneInput/phoneInputCountrySelector/index.js +22 -0
  104. package/dist/modules/components/phoneInput/phoneInputMask/index.js +62 -0
  105. package/dist/modules/components/popover/index.js +37 -0
  106. package/dist/modules/components/radio/radioBox/index.js +43 -0
  107. package/dist/modules/components/radio/radioContext.js +20 -0
  108. package/dist/modules/components/radio/radioGroup/index.js +65 -0
  109. package/dist/modules/components/richText/blockButton/index.js +24 -0
  110. package/dist/modules/components/richText/element/index.js +59 -0
  111. package/dist/modules/components/richText/index.js +136 -0
  112. package/dist/modules/components/richText/insertImage/index.js +106 -0
  113. package/dist/modules/components/richText/insertVideo/index.js +98 -0
  114. package/dist/modules/components/richText/leaf/index.js +7 -0
  115. package/dist/modules/components/richText/markButton/index.js +23 -0
  116. package/dist/modules/components/richText/toolbar/index.js +8 -0
  117. package/dist/modules/components/searchPlaces.js +67 -0
  118. package/dist/modules/components/select/index.js +145 -0
  119. package/dist/modules/components/select/selectChevron/index.js +22 -0
  120. package/dist/modules/components/select/selectContainer/index.js +30 -0
  121. package/dist/modules/components/select/selectContent/index.js +9 -0
  122. package/dist/modules/components/select/selectOption/index.js +14 -0
  123. package/dist/modules/components/select/selectOptionsContainer/index.js +46 -0
  124. package/dist/modules/components/select/selectOverlay/index.js +9 -0
  125. package/dist/modules/components/select/selectSpinner/index.js +10 -0
  126. package/dist/modules/components/slider/index.js +42 -0
  127. package/dist/modules/components/switch/index.js +63 -0
  128. package/dist/modules/components/tab/tabButton/index.js +30 -0
  129. package/dist/modules/components/tab/tabContainer/index.js +29 -0
  130. package/dist/modules/components/tab/tabContext.js +13 -0
  131. package/dist/modules/components/table/tableBody/index.js +15 -0
  132. package/dist/modules/components/table/tableCaption/index.js +9 -0
  133. package/dist/modules/components/table/tableContainer/index.js +9 -0
  134. package/dist/modules/components/table/tableFooter/index.js +12 -0
  135. package/dist/modules/components/table/tableHeader/index.js +12 -0
  136. package/dist/modules/components/textarea/index.js +70 -0
  137. package/dist/modules/components/tooltip/index.js +46 -0
  138. package/dist/modules/hooks/useAutomation.js +28 -0
  139. package/dist/modules/hooks/useDrawer.js +20 -0
  140. package/dist/modules/hooks/useForm.js +8 -0
  141. package/dist/modules/hooks/useHydrated.js +15 -0
  142. package/dist/modules/hooks/useModal.js +20 -0
  143. package/dist/modules/hooks/useScopedParams.js +18 -0
  144. package/dist/modules/hooks/useScrollLock.js +21 -0
  145. package/dist/modules/hooks/useSearchAutomation.js +15 -0
  146. package/dist/modules/hooks/useSlider.js +14 -0
  147. package/dist/modules/hooks/useToast.js +11 -0
  148. package/dist/modules/index.js +144 -0
  149. package/dist/modules/providers/drawerProvider.js +31 -0
  150. package/dist/modules/providers/formProvider.js +18 -0
  151. package/dist/modules/providers/modalProvider.js +34 -0
  152. package/dist/modules/providers/placesProvider.js +18 -0
  153. package/dist/modules/providers/toastProvider.js +52 -0
  154. package/dist/modules/services/extractTextFromNode.js +7 -0
  155. package/dist/modules/services/fieldTemplate.js +24 -0
  156. package/dist/modules/services/iconRenderer.js +8 -0
  157. package/dist/modules/services/isBlockActive.js +15 -0
  158. package/dist/modules/services/isMarkActive.js +8 -0
  159. package/dist/modules/services/maskCurrencyValues.js +14 -0
  160. package/dist/modules/services/toHtml.js +7 -0
  161. package/dist/modules/services/toRichTextValue.js +9 -0
  162. package/dist/modules/services/toggleBlock.js +20 -0
  163. package/dist/modules/services/toggleMark.js +8 -0
  164. package/dist/modules/style.css +1 -0
  165. package/dist/modules/templates/badResponses.js +14 -0
  166. package/dist/modules/templates/richTextTemplates.js +14 -0
  167. package/dist/modules/templates/successResponses.js +4 -0
  168. package/dist/modules/utils/phoneInputUtilities.js +32 -0
  169. package/dist/modules/utils/richTextUtilities.js +77 -0
  170. package/package.json +208 -208
  171. package/dist/components/alert/alertContainer/index.js +0 -71
  172. package/dist/components/alert/alertContent/index.js +0 -26
  173. package/dist/components/alert/alertDescription/index.js +0 -25
  174. package/dist/components/alert/alertIcon/index.js +0 -43
  175. package/dist/components/alert/alertTitle/index.js +0 -27
  176. package/dist/components/audioPlayer/index.js +0 -112
  177. package/dist/components/audioUpload/hasFileContent/index.js +0 -26
  178. package/dist/components/audioUpload/index.js +0 -95
  179. package/dist/components/audioUpload/noFileContent/index.js +0 -29
  180. package/dist/components/badge/index.js +0 -41
  181. package/dist/components/button/index.js +0 -51
  182. package/dist/components/calendar/_calendarProvider.js +0 -58
  183. package/dist/components/calendar/_viewService.js +0 -179
  184. package/dist/components/calendar/calendarContainer/index.js +0 -6
  185. package/dist/components/calendar/calendarHeader/index.js +0 -13
  186. package/dist/components/calendar/calendarTableBody/index.js +0 -9
  187. package/dist/components/calendar/calendarTableContainer/index.js +0 -6
  188. package/dist/components/calendar/calendarTableHeader/index.js +0 -9
  189. package/dist/components/calendar/calendarTableTd/index.js +0 -15
  190. package/dist/components/calendar/index.js +0 -54
  191. package/dist/components/cardTab/cardTabButton/index.js +0 -40
  192. package/dist/components/cardTab/cardTabContainer/index.js +0 -42
  193. package/dist/components/cardTab/cardTabContext.js +0 -10
  194. package/dist/components/checkbox/index.js +0 -71
  195. package/dist/components/clientOnly.js +0 -31
  196. package/dist/components/currencyInput/index.js +0 -126
  197. package/dist/components/divider/index.js +0 -28
  198. package/dist/components/drawer/drawerContainer/index.js +0 -38
  199. package/dist/components/drawer/drawerContext.js +0 -10
  200. package/dist/components/drawer/drawerHeader/index.js +0 -33
  201. package/dist/components/facebookPixel/facebookPixel.client.js +0 -23
  202. package/dist/components/facebookPixel/index.js +0 -45
  203. package/dist/components/facebookPixel/pixel.js +0 -111
  204. package/dist/components/fieldError/index.js +0 -26
  205. package/dist/components/fieldLabel/index.js +0 -23
  206. package/dist/components/fieldWrapper/index.js +0 -27
  207. package/dist/components/fileUpload/hasFileContent/index.js +0 -34
  208. package/dist/components/fileUpload/index.js +0 -89
  209. package/dist/components/fileUpload/noFileContent/index.js +0 -29
  210. package/dist/components/fullCalendar/_fullCalendarProvider.js +0 -36
  211. package/dist/components/fullCalendar/_viewService.js +0 -144
  212. package/dist/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +0 -6
  213. package/dist/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +0 -105
  214. package/dist/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +0 -24
  215. package/dist/components/fullCalendar/dayCalendar/index.js +0 -9
  216. package/dist/components/fullCalendar/fullCalendarContainer/index.js +0 -6
  217. package/dist/components/fullCalendar/fullCalendarHeader/index.js +0 -37
  218. package/dist/components/fullCalendar/index.js +0 -52
  219. package/dist/components/fullCalendar/monthlyCalendar/index.js +0 -8
  220. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +0 -29
  221. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +0 -9
  222. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +0 -6
  223. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +0 -9
  224. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +0 -30
  225. package/dist/components/fullCalendar/weekCalendar/index.js +0 -8
  226. package/dist/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +0 -102
  227. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +0 -11
  228. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +0 -6
  229. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +0 -10
  230. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +0 -25
  231. package/dist/components/googleAnalytics/googleAnalytics.client.js +0 -8
  232. package/dist/components/googleAnalytics/googleAnalytics.js +0 -23
  233. package/dist/components/googleAnalytics/index.js +0 -31
  234. package/dist/components/googleAnalytics/snippets/generateGAElements.js +0 -16
  235. package/dist/components/googleTagManager/googleTagManager.client.js +0 -8
  236. package/dist/components/googleTagManager/googleTagManager.js +0 -52
  237. package/dist/components/googleTagManager/index.js +0 -47
  238. package/dist/components/googleTagManager/snippets/appendToDataLayer.js +0 -7
  239. package/dist/components/googleTagManager/snippets/generateGTMElements.js +0 -25
  240. package/dist/components/iconButton/index.js +0 -38
  241. package/dist/components/imageUpload/hasFileContent/index.js +0 -24
  242. package/dist/components/imageUpload/index.js +0 -101
  243. package/dist/components/imageUpload/noFileContent/index.js +0 -29
  244. package/dist/components/input/index.js +0 -94
  245. package/dist/components/mapView/index.js +0 -53
  246. package/dist/components/mapView/mapView.client.js +0 -51
  247. package/dist/components/maskedInput/index.js +0 -108
  248. package/dist/components/modal/modalContainer/index.js +0 -40
  249. package/dist/components/modal/modalContext.js +0 -10
  250. package/dist/components/modal/modalFooter/index.js +0 -32
  251. package/dist/components/modal/modalHeader/index.js +0 -34
  252. package/dist/components/multiSelect/index.js +0 -135
  253. package/dist/components/multiSelect/multiSelectChevron/index.js +0 -18
  254. package/dist/components/multiSelect/multiSelectContainer/index.js +0 -11
  255. package/dist/components/multiSelect/multiSelectContent/index.js +0 -8
  256. package/dist/components/multiSelect/multiSelectMark/index.js +0 -11
  257. package/dist/components/multiSelect/multiSelectOption/index.js +0 -10
  258. package/dist/components/multiSelect/multiSelectOptionsContainer/index.js +0 -44
  259. package/dist/components/multiSelect/multiSelectOverlay/index.js +0 -9
  260. package/dist/components/multiSelect/multiSelectSpinner/index.js +0 -10
  261. package/dist/components/pagination/chevronButton/index.js +0 -9
  262. package/dist/components/pagination/currentButton/index.js +0 -6
  263. package/dist/components/pagination/index.js +0 -46
  264. package/dist/components/pagination/pageButton/index.js +0 -7
  265. package/dist/components/pagination/paginationService.js +0 -62
  266. package/dist/components/pagination/spread/index.js +0 -7
  267. package/dist/components/phoneInput/index.js +0 -127
  268. package/dist/components/phoneInput/phoneInputContainer/index.js +0 -11
  269. package/dist/components/phoneInput/phoneInputCountriesOverlay/index.js +0 -9
  270. package/dist/components/phoneInput/phoneInputCountryOption/index.js +0 -10
  271. package/dist/components/phoneInput/phoneInputCountryOptionsContainer/index.js +0 -40
  272. package/dist/components/phoneInput/phoneInputCountrySelector/index.js +0 -9
  273. package/dist/components/phoneInput/phoneInputMask/index.js +0 -37
  274. package/dist/components/popover/index.js +0 -62
  275. package/dist/components/radio/radioBox/index.js +0 -48
  276. package/dist/components/radio/radioContext.js +0 -11
  277. package/dist/components/radio/radioGroup/index.js +0 -58
  278. package/dist/components/richText/blockButton/index.js +0 -18
  279. package/dist/components/richText/element/index.js +0 -26
  280. package/dist/components/richText/index.js +0 -136
  281. package/dist/components/richText/insertImage/index.js +0 -33
  282. package/dist/components/richText/insertVideo/index.js +0 -51
  283. package/dist/components/richText/leaf/index.js +0 -13
  284. package/dist/components/richText/markButton/index.js +0 -16
  285. package/dist/components/richText/toolbar/index.js +0 -6
  286. package/dist/components/searchPlaces.js +0 -99
  287. package/dist/components/select/index.js +0 -134
  288. package/dist/components/select/selectChevron/index.js +0 -18
  289. package/dist/components/select/selectContainer/index.js +0 -11
  290. package/dist/components/select/selectContent/index.js +0 -8
  291. package/dist/components/select/selectOption/index.js +0 -10
  292. package/dist/components/select/selectOptionsContainer/index.js +0 -44
  293. package/dist/components/select/selectOverlay/index.js +0 -9
  294. package/dist/components/select/selectSpinner/index.js +0 -10
  295. package/dist/components/slider/index.js +0 -79
  296. package/dist/components/switch/index.js +0 -66
  297. package/dist/components/tab/tabButton/index.js +0 -40
  298. package/dist/components/tab/tabContainer/index.js +0 -42
  299. package/dist/components/tab/tabContext.js +0 -10
  300. package/dist/components/table/tableBody/index.js +0 -34
  301. package/dist/components/table/tableCaption/index.js +0 -24
  302. package/dist/components/table/tableContainer/index.js +0 -37
  303. package/dist/components/table/tableFooter/index.js +0 -23
  304. package/dist/components/table/tableHeader/index.js +0 -25
  305. package/dist/components/textarea/index.js +0 -80
  306. package/dist/components/tooltip/index.js +0 -96
  307. package/dist/hooks/useAutomation.js +0 -74
  308. package/dist/hooks/useDrawer.js +0 -20
  309. package/dist/hooks/useForm.js +0 -35
  310. package/dist/hooks/useHydrated.js +0 -26
  311. package/dist/hooks/useModal.js +0 -20
  312. package/dist/hooks/useScopedParams.js +0 -55
  313. package/dist/hooks/useScrollLock.js +0 -46
  314. package/dist/hooks/useSearchAutomation.js +0 -64
  315. package/dist/hooks/useSlider.js +0 -35
  316. package/dist/hooks/useToast.js +0 -28
  317. package/dist/providers/drawerProvider.js +0 -54
  318. package/dist/providers/formProvider.js +0 -34
  319. package/dist/providers/modalProvider.js +0 -58
  320. package/dist/providers/placesProvider.js +0 -40
  321. package/dist/providers/toastProvider.js +0 -62
  322. package/dist/services/extractTextFromNode.js +0 -5
  323. package/dist/services/fieldTemplate.js +0 -11
  324. package/dist/services/iconRenderer.js +0 -13
  325. package/dist/services/isBlockActive.js +0 -14
  326. package/dist/services/isMarkActive.js +0 -6
  327. package/dist/services/maskCurrencyValues.js +0 -23
  328. package/dist/services/toHtml.js +0 -22
  329. package/dist/services/toRichTextValue.js +0 -34
  330. package/dist/services/toggleBlock.js +0 -32
  331. package/dist/services/toggleMark.js +0 -10
  332. package/dist/templates/badResponses.js +0 -12
  333. package/dist/templates/richTextTemplates.js +0 -12
  334. package/dist/templates/successResponses.js +0 -2
  335. package/dist/types/richTextTypes.js +0 -1
  336. package/dist/utils/phoneInputUtilities.js +0 -37
  337. package/dist/utils/richTextUtilities.js +0 -89
@@ -1,127 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { findCountryMask, formatToPhone, removeNonNumeric, } from "@arkyn/shared";
3
- import { countries } from "@arkyn/templates";
4
- import { useId, useRef, useState } from "react";
5
- import { useForm } from "../../hooks/useForm";
6
- import { FieldTemplate } from "../../services/fieldTemplate";
7
- import { PhoneInputContainer } from "./phoneInputContainer";
8
- import { PhoneInputCountriesOverlay } from "./phoneInputCountriesOverlay";
9
- import { PhoneInputCountryOption } from "./phoneInputCountryOption";
10
- import { PhoneInputCountryOptionsContainer } from "./phoneInputCountryOptionsContainer";
11
- import { PhoneInputCountrySelector } from "./phoneInputCountrySelector";
12
- import { PhoneInputMask } from "./phoneInputMask";
13
- /**
14
- * PhoneInput — phone number field with an integrated country selector and automatic mask formatting.
15
- *
16
- * The visible input is masked according to the selected country's phone format.
17
- * The hidden `<input>` stores a numeric string prefixed with the country dial code for form submission.
18
- * Integrates with `useForm` to display validation errors by field name.
19
- *
20
- * @param props.name - Field name for form submission. Required.
21
- * @param props.label - Label text displayed above the input.
22
- * @param props.showAsterisk - Appends `*` to the label.
23
- * @param props.errorMessage - Validation error message.
24
- * @param props.size - Input size (`md` | `lg`). Default: "md"
25
- * @param props.variant - Visual style variant. Default: "solid"
26
- * @param props.disabled - Disables all interactions. Default: false
27
- * @param props.readOnly - Prevents editing. Default: false
28
- * @param props.isLoading - Shows loading state and disables interactions. Default: false
29
- * @param props.defaultValue - Uncontrolled default phone value.
30
- * @param props.value - Controlled phone value (without country code).
31
- * @param props.onChange - Callback fired on change — receives numeric string with country code.
32
- * @param props.defaultCountryIso - ISO code of the initially selected country. Default: "BR"
33
- * @param props.searchCountryPlaceholder - Placeholder for country search. Default: "Pesquisar país"
34
- * @param props.notFoundCountryText - Text shown when no country matches. Default: "Nenhum país encontrado"
35
- * @param props.orientation - Layout direction. Default: "vertical"
36
- * @param props.unShowFieldTemplate - Skips wrapper, label, and error rendering. Default: false
37
- *
38
- * @returns PhoneInput JSX element wrapped in `FieldTemplate`.
39
- *
40
- * @example
41
- * ```tsx
42
- * // Basic
43
- * <PhoneInput name="phone" label="Phone" />
44
- *
45
- * // Controlled with outline variant
46
- * <PhoneInput
47
- * name="contactPhone"
48
- * label="Contact Phone"
49
- * value={phone}
50
- * onChange={(v) => setPhone(v)}
51
- * variant="outline"
52
- * size="lg"
53
- * />
54
- *
55
- * // Pre-selected country (US)
56
- * <PhoneInput
57
- * name="phone"
58
- * label="Phone"
59
- * defaultCountryIso="US"
60
- * showAsterisk
61
- * />
62
- * ```
63
- */
64
- function PhoneInput(props) {
65
- const { defaultCountryIso, value: rawValue, label, className: wrapperClassName = "", disabled = false, errorMessage: baseErrorMessage, isLoading = false, readOnly = false, size = "md", defaultValue = "", variant = "solid", showAsterisk, name, onChange, searchCountryPlaceholder = "Pesquisar país", notFoundCountryText = "Nenhum país encontrado", id, unShowFieldTemplate = false, orientation = "vertical", } = props;
66
- const brasilCountry = countries.find((country) => country.iso === "BR");
67
- const defaultData = defaultValue ? formatToPhone(defaultValue) : "";
68
- const defaultCountry = defaultValue
69
- ? findCountryMask(defaultValue)[1]
70
- : brasilCountry;
71
- const [isFocused, setIsFocused] = useState(false);
72
- const [search, setSearch] = useState("");
73
- const [showCountryOptions, setShowCountryOptions] = useState(false);
74
- const [internalValue, setValue] = useState(defaultData);
75
- const value = rawValue !== undefined ? rawValue : internalValue;
76
- const [currentCountry, setCurrentCountry] = useState(defaultCountry);
77
- const { fieldErrors } = useForm();
78
- const phoneInputRef = useRef(null);
79
- const phoneInputId = id || useId();
80
- const errorMessage = baseErrorMessage || fieldErrors?.[name];
81
- const isError = !!errorMessage;
82
- const isDisabled = disabled || isLoading;
83
- const inputPhoneMaskRef = useRef(null);
84
- function handleContainerFocus() {
85
- if (isDisabled)
86
- return;
87
- if (isFocused || showCountryOptions)
88
- return;
89
- setIsFocused(true);
90
- if (inputPhoneMaskRef.current)
91
- inputPhoneMaskRef.current.focus();
92
- }
93
- function handleOpenCountryOptions() {
94
- setShowCountryOptions(true);
95
- setIsFocused(true);
96
- }
97
- function handleCloseCountryOptions() {
98
- setShowCountryOptions(false);
99
- setIsFocused(false);
100
- }
101
- function handleInputFocus() {
102
- setIsFocused(true);
103
- }
104
- function handleInputBlur() {
105
- setIsFocused(false);
106
- }
107
- function filterCountryFunction(country) {
108
- return country.name.toLowerCase().includes(search.toLowerCase());
109
- }
110
- function inputValue(props) {
111
- let returnValue = currentCountry.code;
112
- returnValue += removeNonNumeric(props || value);
113
- return returnValue;
114
- }
115
- return (_jsx(FieldTemplate, { name: name, label: label, showAsterisk: showAsterisk, className: wrapperClassName, errorMessage: errorMessage, unShowFieldTemplate: unShowFieldTemplate, orientation: orientation, children: _jsxs(PhoneInputContainer, { disabled: isDisabled, isError: isError, isLoading: isLoading, isFocused: isFocused, readOnly: readOnly, size: size, variant: variant, onFocus: handleContainerFocus, children: [_jsx(PhoneInputCountrySelector, { currentCountry: currentCountry, onClick: handleOpenCountryOptions, size: size }), _jsxs(PhoneInputCountryOptionsContainer, { isOpen: isDisabled ? false : readOnly ? false : showCountryOptions, search: search, placeholder: searchCountryPlaceholder, onSearch: setSearch, children: [countries
116
- .filter((country) => filterCountryFunction(country))
117
- .map((country) => (_jsx(PhoneInputCountryOption, { country: country, handleChangeValue: () => {
118
- setCurrentCountry(country);
119
- setShowCountryOptions(false);
120
- setValue("");
121
- }, isActive: country.iso === currentCountry.iso, size: size }, country.iso))), countries.filter((country) => filterCountryFunction(country))
122
- .length === 0 && _jsx("p", { children: notFoundCountryText })] }), _jsx(PhoneInputCountriesOverlay, { isOpen: isDisabled ? false : readOnly ? false : showCountryOptions, onClick: handleCloseCountryOptions }), _jsx(PhoneInputMask, { id: phoneInputId, ref: inputPhoneMaskRef, readonly: readOnly, currentCountry: currentCountry, value: value, disabled: isDisabled, onBlur: handleInputBlur, onFocus: handleInputFocus, size: size, onChange: (e) => {
123
- setValue(e);
124
- onChange && onChange(inputValue(e));
125
- } }), _jsx("input", { ref: phoneInputRef, type: "hidden", name: name, value: inputValue() })] }) }));
126
- }
127
- export { PhoneInput };
@@ -1,11 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import "./styles.css";
3
- function PhoneInputContainer(props) {
4
- const { children, onFocus, disabled, isError, isLoading, isFocused, className: baseClassName = "", readOnly, variant, size, } = props;
5
- const errored = isError ? "errored" : "";
6
- const opacity = disabled || readOnly || isLoading ? "opacity" : "";
7
- const focused = isFocused ? "focused" : "";
8
- const className = `arkynPhoneInputContainer ${variant} ${size} ${opacity} ${errored} ${focused} ${baseClassName}`;
9
- return (_jsx("section", { className: className.trim(), onClick: onFocus, children: children }));
10
- }
11
- export { PhoneInputContainer };
@@ -1,9 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import "./styles.css";
3
- function PhoneInputCountriesOverlay(props) {
4
- const { isOpen, onClick } = props;
5
- if (!isOpen)
6
- return _jsx(_Fragment, {});
7
- return (_jsx("aside", { className: "arkynPhoneInputCountriesOverlay", onClick: onClick }));
8
- }
9
- export { PhoneInputCountriesOverlay };
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Check } from "lucide-react";
3
- import "./styles.css";
4
- function PhoneInputCountryOption(props) {
5
- const { country, isActive, handleChangeValue, size } = props;
6
- const hasActive = isActive ? "active" : "";
7
- const className = `arkynPhoneInputCountryOption ${size} ${hasActive}`;
8
- return (_jsxs("div", { onClick: () => handleChangeValue(country), className: className, children: [_jsx("img", { src: country.flag, alt: country.name, className: "flag" }), country.name, " ", _jsx("span", { children: country.code }), _jsx(Check, { className: "check" })] }));
9
- }
10
- export { PhoneInputCountryOption };
@@ -1,40 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from "react";
3
- import { useScrollLock } from "../../../hooks/useScrollLock";
4
- import "./styles.css";
5
- function PhoneInputCountryOptionsContainer(props) {
6
- const { children, isOpen, onSearch, search, placeholder } = props;
7
- const containerRef = useRef(null);
8
- const [position, setPosition] = useState("bottom");
9
- function handleSearch(e) {
10
- onSearch(e.target.value);
11
- }
12
- useScrollLock(isOpen);
13
- useEffect(() => {
14
- if (!isOpen)
15
- return;
16
- const checkContainerPosition = () => {
17
- if (!containerRef.current)
18
- return;
19
- const parentElement = containerRef.current.parentElement;
20
- if (!parentElement)
21
- return;
22
- const parentRect = parentElement.getBoundingClientRect();
23
- const viewportHeight = window.innerHeight;
24
- const estimatedContainerHeight = 300;
25
- const spaceBelow = viewportHeight - parentRect.bottom;
26
- if (spaceBelow < estimatedContainerHeight &&
27
- parentRect.top > estimatedContainerHeight) {
28
- setPosition("top");
29
- }
30
- else {
31
- setPosition("bottom");
32
- }
33
- };
34
- checkContainerPosition();
35
- }, [isOpen]);
36
- if (!isOpen)
37
- return _jsx(_Fragment, {});
38
- return (_jsxs("div", { className: `arkynPhoneInputCountryOptionsContainer ${position}`, ref: containerRef, children: [_jsx("input", { type: "search", name: "search-select", className: "arkynPhoneInputCountryOptionsContainerSearchSelect", value: search, id: "input-search", placeholder: placeholder, onChange: handleSearch }), children] }));
39
- }
40
- export { PhoneInputCountryOptionsContainer };
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronDown } from "lucide-react";
3
- import { Divider } from "../../divider";
4
- import "./styles.css";
5
- function PhoneInputCountrySelector(props) {
6
- const { currentCountry, onClick } = props;
7
- return (_jsxs("div", { className: "phoneInputSelectCountry", onClick: onClick, children: [_jsx("img", { className: "flag", src: currentCountry.flag, alt: currentCountry.name }), _jsx(ChevronDown, { className: "chevronDown", strokeWidth: 2.5 }), _jsx(Divider, { orientation: "vertical" })] }));
8
- }
9
- export { PhoneInputCountrySelector };
@@ -1,37 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { InputMask } from "@react-input/mask";
3
- import { forwardRef, useEffect, useState, } from "react";
4
- import { applyMask, clear, getMask, MAX_LENGTH, TYPES, } from "../../../utils/phoneInputUtilities";
5
- import "./style.css";
6
- const BaseInput = forwardRef((props, ref) => {
7
- return _jsx("input", { ref: ref, ...props });
8
- });
9
- const PhoneInputMask = forwardRef((props, ref) => {
10
- const { onFocus, readonly, onBlur, size, onChange, value, currentCountry, disabled, id, } = props;
11
- const [isMounted, setIsMounted] = useState(false);
12
- const mask = typeof currentCountry.mask === "string"
13
- ? currentCountry.mask
14
- : currentCountry.mask[0];
15
- useEffect(() => {
16
- if (isMounted)
17
- onChange(mask);
18
- else
19
- setIsMounted(true);
20
- }, [currentCountry]);
21
- const className = `phoneInputMask ${size}`;
22
- function handleChange(event) {
23
- let value = clear(event.target.value);
24
- const mask = getMask(value);
25
- let nextLength = value.length;
26
- if (nextLength > MAX_LENGTH)
27
- return;
28
- value = applyMask(value, TYPES[mask]);
29
- event.target.value = value;
30
- onChange(value);
31
- }
32
- if (currentCountry.code === "+55") {
33
- return (_jsx("input", { id: id, value: value, onChange: handleChange, className: className, onFocus: onFocus, onBlur: onBlur, disabled: disabled, ref: ref }));
34
- }
35
- return (_jsx(InputMask, { id: id, value: value, readOnly: readonly, onChange: (e) => onChange(e.target.value), className: className, component: BaseInput, onFocus: onFocus, onBlur: onBlur, disabled: disabled, mask: mask, showMask: true, replacement: { _: /\d/ }, ref: ref }));
36
- });
37
- export { PhoneInputMask };
@@ -1,62 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { motion } from "framer-motion";
3
- import { useState } from "react";
4
- import { useScrollLock } from "../../hooks/useScrollLock";
5
- import "./styles.css";
6
- /**
7
- * Popover — floating panel that appears relative to a trigger element.
8
- *
9
- * Clicking outside the popover (or clicking the content when `closeOnClick` is set)
10
- * dismisses it. Locks body scroll while open.
11
- *
12
- * @param props.children - Content to display inside the panel. Required.
13
- * @param props.button - Trigger element that opens the popover. Required.
14
- * @param props.closeOnClick - Clicking the content also closes the popover. Default: false
15
- * @param props.orientation - Panel position relative to the trigger. Default: "bottomLeft"
16
- * @param props.className - Additional CSS class for the root element.
17
- *
18
- * @returns Popover JSX element with trigger, animated panel, and outside-click overlay.
19
- *
20
- * @example
21
- * ```tsx
22
- * // Basic dropdown menu
23
- * <Popover button={<Button>Options</Button>} closeOnClick>
24
- * <ul>
25
- * <li onClick={handleEdit}>Edit</li>
26
- * <li onClick={handleDelete}>Delete</li>
27
- * </ul>
28
- * </Popover>
29
- *
30
- * // User profile menu (bottom-right)
31
- * <Popover
32
- * button={<IconButton icon={User} aria-label="Account" />}
33
- * orientation="bottomRight"
34
- * closeOnClick
35
- * >
36
- * <nav>
37
- * <a href="/profile">Profile</a>
38
- * <a href="/settings">Settings</a>
39
- * <a href="/logout">Sign out</a>
40
- * </nav>
41
- * </Popover>
42
- *
43
- * // Filter panel (top-left)
44
- * <Popover button={<Badge>Filters</Badge>} orientation="topLeft">
45
- * <Input name="search" placeholder="Search..." />
46
- * <Select name="status" options={statusOptions} />
47
- * </Popover>
48
- * ```
49
- */
50
- function Popover(props) {
51
- const { children, button, closeOnClick, className: baseClassName = "", orientation = "bottomLeft", } = props;
52
- const [isOpen, setIsOpen] = useState(false);
53
- const visible = isOpen ? "visibleTrue" : "visibleFalse";
54
- const className = `arkynPopover ${orientation} ${visible} ${baseClassName}`;
55
- function handleOpenPopover() {
56
- if (!isOpen)
57
- setIsOpen(true);
58
- }
59
- useScrollLock(isOpen);
60
- return (_jsxs("div", { className: className, onClick: handleOpenPopover, children: [button, _jsx(motion.div, { style: { visibility: isOpen ? "visible" : "hidden" }, transition: { ease: "easeOut", duration: 0 }, initial: { opacity: 0 }, animate: { opacity: isOpen ? 1 : 0 }, exit: { opacity: 0 }, onClick: () => closeOnClick && setIsOpen(false), className: "arkynPopoverContent", children: children }), isOpen && (_jsx("div", { onClick: () => setIsOpen(false), className: "arkynPopoverOverlay" }))] }));
61
- }
62
- export { Popover };
@@ -1,48 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRadioGroup } from "../radioContext";
3
- import "./styles.css";
4
- /**
5
- * RadioBox — individual option inside a `RadioGroup`. Renders as a `<label>` + hidden `<button>` pair.
6
- *
7
- * Reads active value, size, error state, and disabled state from `RadioGroup` context.
8
- * Must be used as a direct child of `RadioGroup`.
9
- *
10
- * @param props.value - Option value. Required.
11
- * @param props.children - Option label content (text, icons, or rich markup).
12
- * @param props.disabled - Disables this option (group can also disable all options).
13
- * @param props.size - Size override. Inherits from group by default.
14
- *
15
- * **...Other valid HTML `<button>` properties**
16
- *
17
- * @returns RadioBox JSX element.
18
- *
19
- * @example
20
- * ```tsx
21
- * <RadioGroup name="plan" label="Choose a plan" onChange={setPlan}>
22
- * <RadioBox value="basic">Basic — $9/mo</RadioBox>
23
- * <RadioBox value="pro">Pro — $29/mo</RadioBox>
24
- * <RadioBox value="enterprise" disabled>Enterprise — contact us</RadioBox>
25
- * </RadioGroup>
26
- * ```
27
- */
28
- function RadioBox(props) {
29
- const { value: componentValue, size: componentSize, disabled, children, className: baseClassName = "", onClick, onFocus, ...rest } = props;
30
- const { handleChange, size: groupSize, value, isError, disabled: groupDisabled, } = useRadioGroup();
31
- const isChecked = value === componentValue;
32
- const size = componentSize || groupSize;
33
- const isDisabled = disabled || groupDisabled;
34
- const checkedClass = isChecked ? "checkedTrue" : "checkedFalse";
35
- const errorClass = !!isError ? "errorTrue" : "errorFalse";
36
- const disabledClass = isDisabled ? "disabledTrue" : "disabledFalse";
37
- const className = `arkynRadioBox ${size} ${checkedClass} ${errorClass} ${disabledClass} ${baseClassName}`;
38
- function handleClick(event) {
39
- onClick && onClick(event);
40
- handleChange(componentValue);
41
- }
42
- function handleFocus(event) {
43
- onFocus && onFocus(event);
44
- handleChange(componentValue);
45
- }
46
- return (_jsxs("label", { className: className.trim(), children: [_jsx("button", { type: "button", disabled: isDisabled, onClick: handleClick, onFocus: handleFocus, ...rest }), children] }));
47
- }
48
- export { RadioBox };
@@ -1,11 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from "react";
3
- const radioContext = createContext({});
4
- function RadioProvider(props) {
5
- const { children, size, isError, handleChange, value, disabled } = props;
6
- return (_jsx(radioContext.Provider, { value: { handleChange, value, size, isError, disabled }, children: children }));
7
- }
8
- function useRadioGroup() {
9
- return useContext(radioContext);
10
- }
11
- export { RadioProvider, useRadioGroup };
@@ -1,58 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { useForm } from "../../../hooks/useForm";
4
- import { FieldTemplate } from "../../../services/fieldTemplate";
5
- import { RadioProvider } from "../radioContext";
6
- import "./styles.css";
7
- /**
8
- * RadioGroup — managed group of `RadioBox` options with form integration.
9
- *
10
- * Renders a hidden `<input>` for native form submission. Reads `fieldErrors[name]` from
11
- * the nearest `FormProvider` when no `errorMessage` is explicitly provided.
12
- *
13
- * @param props.name - Form field name. Required.
14
- * @param props.label - Label displayed above the group.
15
- * @param props.showAsterisk - Appends `*` to the label. Default: false
16
- * @param props.value - Controlled selection.
17
- * @param props.defaultValue - Initial selection (uncontrolled). Default: `""`
18
- * @param props.onChange - Called with the newly selected value.
19
- * @param props.size - Size for all child `RadioBox` elements. Default: `"md"`
20
- * @param props.disabled - Disables all options. Default: false
21
- * @param props.errorMessage - Validation error message.
22
- * @param props.unShowFieldTemplate - Omit label/error wrapper. Default: false
23
- *
24
- * **...Other valid HTML `<div>` properties**
25
- *
26
- * @returns RadioGroup JSX element.
27
- *
28
- * @example
29
- * ```tsx
30
- * // Uncontrolled with label
31
- * <RadioGroup name="gender" label="Gender" showAsterisk defaultValue="male">
32
- * <RadioBox value="male">Male</RadioBox>
33
- * <RadioBox value="female">Female</RadioBox>
34
- * <RadioBox value="other">Other</RadioBox>
35
- * </RadioGroup>
36
- *
37
- * // Controlled with change handler
38
- * <RadioGroup name="plan" label="Subscription plan" value={plan} onChange={setPlan}>
39
- * <RadioBox value="basic">Basic — $9/mo</RadioBox>
40
- * <RadioBox value="pro">Pro — $29/mo</RadioBox>
41
- * </RadioGroup>
42
- * ```
43
- */
44
- function RadioGroup(props) {
45
- const { defaultValue = "", name, label, showAsterisk, errorMessage: baseErrorMessage, value: forceValue, onChange, size = "md", className: wrapperClassName = "", disabled = false, unShowFieldTemplate = false, orientation = "vertical", ...rest } = props;
46
- const [value, setValue] = useState(defaultValue);
47
- const { fieldErrors } = useForm();
48
- function handleChange(value) {
49
- setValue(value);
50
- if (onChange)
51
- onChange(value);
52
- }
53
- const errorMessage = baseErrorMessage || fieldErrors?.[name];
54
- const isError = !!errorMessage;
55
- const className = `arkynRadioGroup ${size}`;
56
- return (_jsx(FieldTemplate, { name: name, label: label, showAsterisk: showAsterisk, className: wrapperClassName, errorMessage: errorMessage, unShowFieldTemplate: unShowFieldTemplate, orientation: orientation, children: _jsxs(RadioProvider, { isError: isError, size: size, value: forceValue || value, handleChange: handleChange, disabled: disabled, children: [_jsx("input", { style: { display: "none" }, type: "text", readOnly: true, name: name, value: forceValue || value }), _jsx("div", { className: className.trim(), ...rest })] }) }));
57
- }
58
- export { RadioGroup };
@@ -1,18 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useSlate } from "slate-react";
3
- import { isBlockActive } from "../../../services/isBlockActive";
4
- import { toggleBlock } from "../../../services/toggleBlock";
5
- import { textAlignTypes } from "../../../templates/richTextTemplates";
6
- import "./styles.css";
7
- function BlockButton({ format, icon: Icon }) {
8
- const editor = useSlate();
9
- const blockType = textAlignTypes.includes(format) ? "align" : "type";
10
- const isActive = isBlockActive(editor, format, blockType);
11
- const activeClass = isActive ? "activeTrue" : "activeFalse";
12
- function handleMouseDown(event) {
13
- event.preventDefault();
14
- toggleBlock(editor, format);
15
- }
16
- return (_jsx("button", { type: "button", className: "arkynRichTextBlockButton " + activeClass, onMouseDown: handleMouseDown, children: _jsx(Icon, {}) }));
17
- }
18
- export { BlockButton };
@@ -1,26 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import "./styles.css";
3
- function Element({ attributes, children, element }) {
4
- const style = { textAlign: element.align };
5
- switch (element.type) {
6
- case "blockQuote":
7
- return (_jsx("blockquote", { className: "arkynElementBlockquote", style: style, ...attributes, children: children }));
8
- case "bulletedList":
9
- return (_jsx("ul", { className: "arkynElementBulletList", style: style, ...attributes, children: children }));
10
- case "headingOne":
11
- return (_jsx("h1", { className: "arkynElementHeadingOne", style: style, ...attributes, children: children }));
12
- case "headingTwo":
13
- return (_jsx("h2", { className: "arkynElementHeadingTwo", style: style, ...attributes, children: children }));
14
- case "listItem":
15
- return (_jsx("li", { className: "arkynElementListItem", style: style, ...attributes, children: children }));
16
- case "numberedList":
17
- return (_jsx("ol", { className: "arkynElementNumberedList", style: style, ...attributes, children: children }));
18
- case "image":
19
- return (_jsxs("div", { style: style, ...attributes, children: [_jsx("img", { className: "arkynElementImage", alt: "arkynElementImage", src: element?.src || "" }), children] }));
20
- case "video":
21
- return (_jsxs("div", { style: style, ...attributes, children: [_jsx("iframe", { className: "arkynElementVideo", src: element?.src || "", title: "YouTube video player", allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share", referrerPolicy: "strict-origin-when-cross-origin", allowFullScreen: true }), children] }));
22
- default:
23
- return (_jsx("p", { className: "arkynElementParagraph", style: style, ...attributes, children: children }));
24
- }
25
- }
26
- export { Element };
@@ -1,136 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import isHotkey from "is-hotkey";
3
- import { AlignCenter, AlignJustify, AlignLeft, AlignRight, Bold, Code, Heading1, Heading2, Italic, Quote, Underline, } from "lucide-react";
4
- import { useCallback, useId, useMemo, useRef, useState } from "react";
5
- import { createEditor, Transforms } from "slate";
6
- import { withHistory } from "slate-history";
7
- import { Editable, Slate, withReact } from "slate-react";
8
- import { BlockButton } from "./blockButton";
9
- import { Element } from "./element";
10
- import { InsertImage } from "./insertImage";
11
- import { InsertVideo } from "./insertVideo";
12
- import { Leaf } from "./leaf";
13
- import { MarkButton } from "./markButton";
14
- import { Toolbar } from "./toolbar";
15
- import { useForm } from "../../hooks/useForm";
16
- import { extractTextFromNode } from "../../services/extractTextFromNode";
17
- import { FieldTemplate } from "../../services/fieldTemplate";
18
- import { toggleMark } from "../../services/toggleMark";
19
- import { hotKeys, initialValue } from "../../templates/richTextTemplates";
20
- import "./styles.css";
21
- /**
22
- * RichText — WYSIWYG rich-text editor built on Slate.js with a configurable toolbar.
23
- *
24
- * **Toolbar features:** bold, italic, underline, code, H1/H2, block quote, alignment (left/center/right/justify), image and video insertion.
25
- *
26
- * Editor content is stored as a Slate JSON string in a hidden `<input>` for form submission.
27
- * Integrates with `useForm` to display validation errors by field name.
28
- *
29
- * @param props.name - Field name for form submission. Required.
30
- * @param props.label - Label text displayed above the editor.
31
- * @param props.hiddenButtons - Toolbar button keys to hide (e.g. `["image", "code"]`).
32
- * @param props.imageConfig - Enables image insertion; contains the upload endpoint and modal labels.
33
- * @param props.defaultValue - Initial editor content as a Slate JSON string. Default: "[]"
34
- * @param props.maxLimit - Maximum character count. Default: 10000
35
- * @param props.enforceCharacterLimit - Prevents typing past `maxLimit`. Default: false
36
- * @param props.onChangeCharactersCount - Callback fired on every keystroke — receives the current character count.
37
- * @param props.onChange - Callback fired when editor content changes — receives the Slate `Descendant[]`.
38
- * @param props.baseErrorMessage - Custom error message (overrides `useForm` context error).
39
- * @param props.isError - Forces the error visual state.
40
- * @param props.id - Custom id for the editable area element.
41
- * @param props.showAsterisk - Appends `*` to the label.
42
- * @param props.orientation - Layout direction. Default: "horizontal"
43
- * @param props.unShowFieldTemplate - Skips wrapper, label, and error rendering. Default: false
44
- *
45
- * @returns RichText JSX element wrapped in `FieldTemplate`.
46
- *
47
- * @example
48
- * ```tsx
49
- * // Basic
50
- * <RichText name="content" />
51
- *
52
- * // With character limit and hidden toolbar buttons
53
- * <RichText
54
- * name="description"
55
- * label="Description"
56
- * maxLimit={500}
57
- * enforceCharacterLimit
58
- * hiddenButtons={["image", "video", "code"]}
59
- * onChangeCharactersCount={(n) => setCharCount(n)}
60
- * />
61
- *
62
- * // With image upload support
63
- * <RichText
64
- * name="article"
65
- * label="Article Body"
66
- * imageConfig={{ action: "/api/upload" }}
67
- * />
68
- * ```
69
- */
70
- function RichText(props) {
71
- const { name, hiddenButtons, imageConfig, videoConfig, className: wrapperClassName = "", defaultValue = "[]", enforceCharacterLimit = false, onChangeCharactersCount, baseErrorMessage, maxLimit = 10000, onChange, isError: baseIsError, label, showAsterisk, id, orientation = "vertical", unShowFieldTemplate = false, } = props;
72
- const editor = useMemo(() => withHistory(withReact(createEditor())), []);
73
- const { fieldErrors } = useForm();
74
- function getDefaultNodes() {
75
- try {
76
- const parsedNodes = JSON.parse(defaultValue);
77
- if (!Array.isArray(parsedNodes))
78
- return initialValue;
79
- if (parsedNodes.length <= 0)
80
- return initialValue;
81
- const isValidNodes = parsedNodes.every((node) => typeof node === "object" &&
82
- node !== null &&
83
- "type" in node &&
84
- "children" in node);
85
- return isValidNodes ? parsedNodes : initialValue;
86
- }
87
- catch (error) {
88
- return initialValue;
89
- }
90
- }
91
- const textFromNodes = extractTextFromNode(getDefaultNodes());
92
- const [charactersCount, setCharactersCount] = useState(textFromNodes.length);
93
- const [inputValue, setInputValue] = useState(JSON.stringify(getDefaultNodes()) || "[]");
94
- const [onFocus, setOnFocus] = useState(false);
95
- const ref = useRef(null);
96
- const inputId = id || useId();
97
- const errorMessage = baseErrorMessage || fieldErrors?.[name];
98
- const isError = baseIsError || !!errorMessage;
99
- const renderLeaf = useCallback(Leaf, []);
100
- const renderElement = useCallback(Element, []);
101
- function handleChange(value) {
102
- const text = extractTextFromNode(value);
103
- setCharactersCount(text.length);
104
- onChangeCharactersCount && onChangeCharactersCount(text.length);
105
- if (enforceCharacterLimit && text.length >= maxLimit) {
106
- return;
107
- }
108
- else {
109
- setInputValue(JSON.stringify(value));
110
- onChange && onChange(value);
111
- editor.children = value;
112
- Transforms.setNodes(editor, { children: value });
113
- }
114
- }
115
- const focusClass = onFocus ? "focusTrue" : "focusFalse";
116
- const errorClass = isError
117
- ? "errorTrue"
118
- : maxLimit < charactersCount
119
- ? "errorTrue"
120
- : "errorFalse";
121
- const className = `arkynRichText ${errorClass} ${focusClass}`;
122
- const restatesCharacters = maxLimit - charactersCount;
123
- function buttonIsNotHidden(format) {
124
- return !hiddenButtons?.includes(format);
125
- }
126
- return (_jsx(FieldTemplate, { name: name, label: label, showAsterisk: showAsterisk, className: wrapperClassName, errorMessage: errorMessage, unShowFieldTemplate: unShowFieldTemplate, orientation: orientation, children: _jsxs(Slate, { editor: editor, initialValue: getDefaultNodes(), onChange: handleChange, onValueChange: handleChange, children: [_jsxs("div", { className: className, children: [_jsxs(Toolbar, { children: [buttonIsNotHidden("headingOne") && (_jsx(BlockButton, { format: "headingOne", icon: Heading1 })), buttonIsNotHidden("headingTwo") && (_jsx(BlockButton, { format: "headingTwo", icon: Heading2 })), buttonIsNotHidden("blockQuote") && (_jsx(BlockButton, { format: "blockQuote", icon: Quote })), buttonIsNotHidden("bold") && (_jsx(MarkButton, { format: "bold", icon: Bold })), buttonIsNotHidden("italic") && (_jsx(MarkButton, { format: "italic", icon: Italic })), buttonIsNotHidden("underline") && (_jsx(MarkButton, { format: "underline", icon: Underline })), buttonIsNotHidden("code") && (_jsx(MarkButton, { format: "code", icon: Code })), buttonIsNotHidden("left") && (_jsx(BlockButton, { format: "left", icon: AlignLeft })), buttonIsNotHidden("right") && (_jsx(BlockButton, { format: "right", icon: AlignRight })), buttonIsNotHidden("center") && (_jsx(BlockButton, { format: "center", icon: AlignCenter })), buttonIsNotHidden("justify") && (_jsx(BlockButton, { format: "justify", icon: AlignJustify })), imageConfig && buttonIsNotHidden("image") && (_jsx(InsertImage, { ...imageConfig })), buttonIsNotHidden("video") && _jsx(InsertVideo, { ...videoConfig })] }), _jsx(Editable, { className: "editorContainer", renderElement: renderElement, renderLeaf: renderLeaf, spellCheck: true, ref: ref, id: inputId, onFocus: () => setOnFocus(true), onBlur: () => setOnFocus(false), onKeyDown: (event) => {
127
- for (const hotkey in hotKeys) {
128
- if (isHotkey(hotkey, event)) {
129
- event.preventDefault();
130
- const mark = hotKeys[hotkey];
131
- toggleMark(editor, mark);
132
- }
133
- }
134
- } }), restatesCharacters < 0 && (_jsx("div", { className: "restatesCharacters", children: restatesCharacters }))] }), _jsx("input", { type: "hidden", name: name, value: inputValue.slice(0, maxLimit) }), _jsx("input", { type: "hidden", name: `${name}Count`, value: charactersCount })] }) }));
135
- }
136
- export { RichText };