@onereach/ui-components 2.63.0-beta.1907.0 → 2.63.1-beta.1936.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/v2/OrCardCollection-5d5046f1.js +227 -0
  2. package/dist/v2/{OrConfirm-8d149ece.js → OrConfirm-edc537b3.js} +1 -1
  3. package/dist/v2/{OrIconButton-5883eba0.js → OrIconButton-2088a37f.js} +1 -1
  4. package/dist/v2/{OrInlineInput-16a343c1.js → OrInlineInput-da65c72a.js} +9 -8
  5. package/dist/v2/{OrInlineTextarea-f154bdf5.js → OrInlineTextarea-da66759a.js} +9 -8
  6. package/dist/v2/{OrInput-4a50fe57.js → OrInput-655bed71.js} +9 -7
  7. package/dist/v2/{OrModal-64c5ae2e.js → OrModal-a1452b11.js} +1 -1
  8. package/dist/v2/{OrNotification-9c164908.js → OrNotification-ac420f39.js} +1 -1
  9. package/dist/v2/{OrSearch-a247f072.js → OrSearch-287a08a9.js} +1 -1
  10. package/dist/v2/OrSegmentedControl-17df63b8.js +236 -0
  11. package/dist/v2/{OrSelect-f416b7aa.js → OrSelect-1a353817.js} +4 -4
  12. package/dist/v2/OrSortHeader-a6004b24.js +133 -0
  13. package/dist/v2/{OrTabs-b4a9740b.js → OrTabs-f2a60b41.js} +1 -1
  14. package/dist/v2/{OrTag-ab03c4f7.js → OrTag-1ced4e58.js} +1 -1
  15. package/dist/v2/{OrTextarea-8773d494.js → OrTextarea-cc70afc9.js} +5 -5
  16. package/dist/v2/{OrTooltip-caeac590.js → OrTooltip-afe7030b.js} +33 -3
  17. package/dist/v2/components/index.d.ts +3 -0
  18. package/dist/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +17 -0
  19. package/dist/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +98 -0
  20. package/dist/v2/components/or-card-collection-v3/index.d.ts +3 -0
  21. package/dist/v2/components/or-card-collection-v3/props.d.ts +4 -0
  22. package/dist/v2/components/or-card-collection-v3/styles.d.ts +6 -0
  23. package/dist/v2/components/or-card-collection-v3/types.d.ts +7 -0
  24. package/dist/v2/components/{or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts → or-segmented-control-v3/OrSegmentedControl.stories3.d.ts} +1 -1
  25. package/dist/v2/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts +77 -0
  26. package/dist/v2/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +47 -0
  27. package/dist/v2/components/or-segmented-control-v3/components/or-segmented-control-item/styles.d.ts +3 -0
  28. package/dist/v2/components/or-segmented-control-v3/index.d.ts +3 -0
  29. package/dist/v2/components/or-segmented-control-v3/props.d.ts +4 -0
  30. package/dist/v2/components/or-segmented-control-v3/styles.d.ts +3 -0
  31. package/dist/v2/components/or-segmented-control-v3/types.d.ts +4 -0
  32. package/dist/{v3/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts → v2/components/or-sort-header-v3/OrSortHeader.stories3.d.ts} +1 -1
  33. package/dist/v2/components/or-sort-header-v3/OrSortHeader.vue.d.ts +57 -0
  34. package/dist/v2/components/or-sort-header-v3/index.d.ts +2 -0
  35. package/dist/v2/components/or-sort-header-v3/styles.d.ts +1 -0
  36. package/dist/v2/components/or-sort-header-v3/types.d.ts +4 -0
  37. package/dist/v2/components/or-tooltip-v3/styles.d.ts +2 -0
  38. package/dist/v2/index.js +17 -14
  39. package/dist/v2/index11.js +20 -1
  40. package/dist/v2/index12.js +3 -12
  41. package/dist/v2/index13.js +3 -2
  42. package/dist/v2/index14.js +11 -5
  43. package/dist/v2/index15.js +5 -14
  44. package/dist/v2/index16.js +4 -19
  45. package/dist/v2/index17.js +28 -4
  46. package/dist/v2/index18.js +3 -7
  47. package/dist/v2/index19.js +5 -23
  48. package/dist/v2/index2.js +17 -14
  49. package/dist/v2/index20.js +25 -21
  50. package/dist/v2/index21.js +21 -18
  51. package/dist/v2/index22.js +20 -2
  52. package/dist/v2/index23.js +2 -4
  53. package/dist/v2/index24.js +2 -1
  54. package/dist/v2/index25.js +1 -2
  55. package/dist/v2/index26.js +2 -2
  56. package/dist/v2/index27.js +4 -7
  57. package/dist/v2/index28.js +6 -2
  58. package/dist/v2/index29.js +3 -3
  59. package/dist/v2/index30.js +3 -10
  60. package/dist/v2/index31.js +9 -12
  61. package/dist/v2/index32.js +11 -1
  62. package/dist/v2/index33.js +1 -1
  63. package/dist/v2/index34.js +1 -16
  64. package/dist/v2/index35.js +17 -17
  65. package/dist/v2/index36.js +17 -17
  66. package/dist/v2/index37.js +16 -1
  67. package/dist/v2/index38.js +1 -17
  68. package/dist/v2/index39.js +18 -22
  69. package/dist/v2/index40.js +22 -2
  70. package/dist/v2/index41.js +3 -3
  71. package/dist/v2/index42.js +1 -1
  72. package/dist/v2/index43.js +3 -20
  73. package/dist/v2/index44.js +1 -7
  74. package/dist/v2/index45.js +24 -1
  75. package/dist/v2/index46.js +3 -3
  76. package/dist/v2/index47.js +1 -2
  77. package/dist/v2/index48.js +2 -9
  78. package/dist/v2/index49.js +10 -17
  79. package/dist/v2/index50.js +17 -13
  80. package/dist/v2/index51.js +13 -14
  81. package/dist/v2/index52.js +14 -13
  82. package/dist/v2/index53.js +12 -15
  83. package/dist/v2/index54.js +16 -1
  84. package/dist/v2/index55.js +2 -6
  85. package/dist/v2/index56.js +1 -5
  86. package/dist/v2/index57.js +10 -3
  87. package/dist/v2/index58.js +2 -4
  88. package/dist/v2/index59.js +5 -3
  89. package/dist/v2/index60.js +2 -1
  90. package/dist/v2/index61.js +2 -5
  91. package/dist/v2/index62.js +6 -334
  92. package/dist/v2/index63.js +4 -4
  93. package/dist/v2/index64.js +2 -16
  94. package/dist/v2/index65.js +15 -24
  95. package/dist/v2/index66.js +26 -4
  96. package/dist/v2/index67.js +2 -1
  97. package/dist/v2/index68.js +3 -4
  98. package/dist/v2/index69.js +3 -4
  99. package/dist/v2/index70.js +3 -10
  100. package/dist/v2/index71.js +3 -6
  101. package/dist/v2/index72.js +4 -4
  102. package/dist/v2/index73.js +15 -6
  103. package/dist/v2/index74.js +2 -2
  104. package/dist/v2/index75.js +6 -3
  105. package/dist/v2/index76.js +4 -3
  106. package/dist/v2/index77.js +1 -2
  107. package/dist/v2/index78.js +2 -14
  108. package/dist/v2/index79.js +2 -10
  109. package/dist/v2/index80.js +5 -4
  110. package/dist/v2/index81.js +12 -2
  111. package/dist/v2/index82.js +14 -2
  112. package/dist/v2/index83.js +2 -3
  113. package/dist/v2/index84.js +2 -8
  114. package/dist/v2/index85.js +2 -20
  115. package/dist/v2/index86.js +8 -18
  116. package/dist/v2/index87.js +21 -1
  117. package/dist/v2/index88.js +17 -16
  118. package/dist/v2/index89.js +1 -1
  119. package/dist/v2/index90.js +17 -9
  120. package/dist/v2/index91.js +2 -12
  121. package/dist/v2/index92.js +10 -1
  122. package/dist/v2/index93.js +12 -6
  123. package/dist/v2/index94.js +1 -2
  124. package/dist/v2/index95.js +7 -0
  125. package/dist/v2/index96.js +3 -0
  126. package/dist/v2/{types-fb93ea4e.js → types-89aad7fb.js} +1 -1
  127. package/dist/v3/OrCardCollection-c6f3ac23.js +198 -0
  128. package/dist/v3/{OrConfirm-456ddee1.js → OrConfirm-0bafcc7b.js} +1 -1
  129. package/dist/v3/{OrIconButton-b8066b5d.js → OrIconButton-5fb3a9aa.js} +1 -1
  130. package/dist/v3/{OrInlineInput-280768ba.js → OrInlineInput-d9bbc08c.js} +9 -6
  131. package/dist/v3/{OrInlineTextarea-0f63f344.js → OrInlineTextarea-d5a97ed9.js} +9 -6
  132. package/dist/v3/{OrInput-3eef7945.js → OrInput-db4813b4.js} +11 -6
  133. package/dist/v3/{OrModal-f67d37d3.js → OrModal-3a43b7e7.js} +1 -1
  134. package/dist/v3/{OrNotification-fefa1cb4.js → OrNotification-433d16f7.js} +1 -1
  135. package/dist/v3/{OrSearch-15a70678.js → OrSearch-0c29f499.js} +1 -1
  136. package/dist/v3/OrSegmentedControl-2bbc0f22.js +184 -0
  137. package/dist/v3/{OrSelect-9d300f55.js → OrSelect-323a87b4.js} +7 -5
  138. package/dist/v3/OrSortHeader-5eba50cd.js +104 -0
  139. package/dist/v3/{OrTabs-194ca950.js → OrTabs-ac0be933.js} +1 -1
  140. package/dist/v3/{OrTag-144b4ab8.js → OrTag-deaff080.js} +1 -1
  141. package/dist/v3/{OrTextarea-09aa33dc.js → OrTextarea-98895b2a.js} +6 -4
  142. package/dist/v3/{OrTooltip-30e05f9e.js → OrTooltip-36c6728c.js} +33 -3
  143. package/dist/v3/components/index.d.ts +3 -0
  144. package/dist/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +17 -0
  145. package/dist/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +98 -0
  146. package/dist/v3/components/or-card-collection-v3/index.d.ts +3 -0
  147. package/dist/v3/components/or-card-collection-v3/props.d.ts +4 -0
  148. package/dist/v3/components/or-card-collection-v3/styles.d.ts +6 -0
  149. package/dist/v3/components/or-card-collection-v3/types.d.ts +7 -0
  150. package/dist/v3/components/or-segmented-control-v3/OrSegmentedControl.stories3.d.ts +12 -0
  151. package/dist/v3/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts +77 -0
  152. package/dist/v3/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +47 -0
  153. package/dist/v3/components/or-segmented-control-v3/components/or-segmented-control-item/styles.d.ts +3 -0
  154. package/dist/v3/components/or-segmented-control-v3/index.d.ts +3 -0
  155. package/dist/v3/components/or-segmented-control-v3/props.d.ts +4 -0
  156. package/dist/v3/components/or-segmented-control-v3/styles.d.ts +3 -0
  157. package/dist/v3/components/or-segmented-control-v3/types.d.ts +4 -0
  158. package/dist/v3/components/or-sort-header-v3/OrSortHeader.stories3.d.ts +12 -0
  159. package/dist/v3/components/or-sort-header-v3/OrSortHeader.vue.d.ts +57 -0
  160. package/dist/v3/components/or-sort-header-v3/index.d.ts +2 -0
  161. package/dist/v3/components/or-sort-header-v3/styles.d.ts +1 -0
  162. package/dist/v3/components/or-sort-header-v3/types.d.ts +4 -0
  163. package/dist/v3/components/or-tooltip-v3/styles.d.ts +2 -0
  164. package/dist/v3/index.js +17 -14
  165. package/dist/v3/index11.js +19 -1
  166. package/dist/v3/index12.js +3 -11
  167. package/dist/v3/index13.js +3 -2
  168. package/dist/v3/index14.js +9 -4
  169. package/dist/v3/index15.js +4 -11
  170. package/dist/v3/index16.js +3 -17
  171. package/dist/v3/index17.js +25 -4
  172. package/dist/v3/index18.js +3 -6
  173. package/dist/v3/index19.js +5 -20
  174. package/dist/v3/index2.js +17 -14
  175. package/dist/v3/index20.js +21 -20
  176. package/dist/v3/index21.js +20 -15
  177. package/dist/v3/index22.js +16 -1
  178. package/dist/v3/index23.js +2 -4
  179. package/dist/v3/index24.js +2 -1
  180. package/dist/v3/index25.js +1 -2
  181. package/dist/v3/index26.js +2 -2
  182. package/dist/v3/index27.js +4 -6
  183. package/dist/v3/index28.js +5 -2
  184. package/dist/v3/index29.js +3 -3
  185. package/dist/v3/index30.js +3 -9
  186. package/dist/v3/index31.js +8 -11
  187. package/dist/v3/index32.js +10 -1
  188. package/dist/v3/index33.js +1 -1
  189. package/dist/v3/index34.js +1 -15
  190. package/dist/v3/index35.js +16 -14
  191. package/dist/v3/index36.js +14 -16
  192. package/dist/v3/index37.js +16 -2
  193. package/dist/v3/index38.js +2 -17
  194. package/dist/v3/index39.js +17 -17
  195. package/dist/v3/index40.js +16 -1
  196. package/dist/v3/index41.js +3 -3
  197. package/dist/v3/index42.js +1 -1
  198. package/dist/v3/index43.js +3 -16
  199. package/dist/v3/index44.js +1 -7
  200. package/dist/v3/index45.js +20 -1
  201. package/dist/v3/index46.js +3 -3
  202. package/dist/v3/index47.js +1 -2
  203. package/dist/v3/index48.js +2 -8
  204. package/dist/v3/index49.js +9 -14
  205. package/dist/v3/index50.js +14 -12
  206. package/dist/v3/index51.js +12 -11
  207. package/dist/v3/index52.js +11 -12
  208. package/dist/v3/index53.js +11 -11
  209. package/dist/v3/index54.js +12 -1
  210. package/dist/v3/index55.js +2 -5
  211. package/dist/v3/index56.js +1 -5
  212. package/dist/v3/index57.js +9 -3
  213. package/dist/v3/index58.js +2 -4
  214. package/dist/v3/index59.js +5 -3
  215. package/dist/v3/index60.js +2 -1
  216. package/dist/v3/index61.js +1 -4
  217. package/dist/v3/index62.js +6 -307
  218. package/dist/v3/index63.js +4 -4
  219. package/dist/v3/index64.js +2 -15
  220. package/dist/v3/index65.js +13 -22
  221. package/dist/v3/index66.js +24 -3
  222. package/dist/v3/index67.js +2 -1
  223. package/dist/v3/index68.js +3 -4
  224. package/dist/v3/index69.js +3 -4
  225. package/dist/v3/index70.js +3 -9
  226. package/dist/v3/index71.js +3 -4
  227. package/dist/v3/index72.js +4 -4
  228. package/dist/v3/index73.js +11 -5
  229. package/dist/v3/index74.js +2 -2
  230. package/dist/v3/index75.js +5 -2
  231. package/dist/v3/index76.js +4 -3
  232. package/dist/v3/index77.js +1 -2
  233. package/dist/v3/index78.js +2 -13
  234. package/dist/v3/index79.js +2 -9
  235. package/dist/v3/index80.js +5 -4
  236. package/dist/v3/index81.js +11 -1
  237. package/dist/v3/index82.js +13 -1
  238. package/dist/v3/index83.js +1 -3
  239. package/dist/v3/index84.js +1 -8
  240. package/dist/v3/index85.js +2 -17
  241. package/dist/v3/index86.js +7 -14
  242. package/dist/v3/index87.js +18 -1
  243. package/dist/v3/index88.js +14 -15
  244. package/dist/v3/index89.js +1 -1
  245. package/dist/v3/index90.js +15 -6
  246. package/dist/v3/index91.js +2 -11
  247. package/dist/v3/index92.js +8 -1
  248. package/dist/v3/index93.js +11 -6
  249. package/dist/v3/index94.js +1 -2
  250. package/dist/v3/index95.js +7 -0
  251. package/dist/v3/index96.js +3 -0
  252. package/dist/v3/{types-a2a8f948.js → types-d5d4ab32.js} +1 -1
  253. package/package.json +2 -8
  254. package/src/components/index.ts +3 -0
  255. package/src/components/or-card-collection-v3/OrCardCollection.docs.mdx +3 -0
  256. package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +162 -0
  257. package/src/components/or-card-collection-v3/OrCardCollection.vue +210 -0
  258. package/src/components/or-card-collection-v3/index.ts +3 -0
  259. package/src/components/or-card-collection-v3/props.ts +4 -0
  260. package/src/components/or-card-collection-v3/styles.ts +53 -0
  261. package/src/components/or-card-collection-v3/types.ts +8 -0
  262. package/src/components/or-checkbox-v3/OrCheckbox.stories3.ts +1 -1
  263. package/src/components/or-inline-input-v3/OrInlineInput.vue +14 -12
  264. package/src/components/or-inline-textarea-v3/OrInlineTextarea.vue +14 -12
  265. package/src/components/or-input-v3/OrInput.vue +33 -29
  266. package/src/components/or-radio-v3/OrRadio.stories3.ts +1 -1
  267. package/src/components/or-segmented-control-v3/OrSegmentedControl.docs.mdx +7 -0
  268. package/src/components/or-segmented-control-v3/OrSegmentedControl.stories3.ts +106 -0
  269. package/src/components/or-segmented-control-v3/OrSegmentedControl.vue +107 -0
  270. package/src/components/or-segmented-control-v3/components/or-segmented-control-item/OrSegmentedControlItem.vue +64 -0
  271. package/src/components/or-segmented-control-v3/components/or-segmented-control-item/styles.ts +50 -0
  272. package/src/components/or-segmented-control-v3/index.ts +3 -0
  273. package/src/components/or-segmented-control-v3/props.ts +4 -0
  274. package/src/components/or-segmented-control-v3/styles.ts +24 -0
  275. package/src/components/or-segmented-control-v3/types.ts +4 -0
  276. package/src/components/or-select-v3/OrSelect.vue +5 -3
  277. package/src/components/or-sort-header-v3/OrSortHeader.docs.mdx +3 -0
  278. package/src/components/or-sort-header-v3/OrSortHeader.stories3.ts +132 -0
  279. package/src/components/or-sort-header-v3/OrSortHeader.vue +111 -0
  280. package/src/components/or-sort-header-v3/index.ts +2 -0
  281. package/src/components/or-sort-header-v3/styles.ts +23 -0
  282. package/src/components/or-sort-header-v3/types.ts +4 -0
  283. package/src/components/or-switch-v3/OrSwitch.stories3.ts +1 -1
  284. package/src/components/or-tabs-v3/OrTabs.stories3.ts +9 -4
  285. package/src/components/or-tabs-v3/OrTabs.vue +1 -1
  286. package/src/components/or-textarea-v3/OrTextarea.vue +12 -10
  287. package/src/components/or-tooltip-v3/OrTooltip.vue +3 -2
  288. package/src/components/or-tooltip-v3/styles.ts +55 -0
  289. package/src/hooks/useClassAttribute.ts +1 -1
  290. package/dist/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -111
  291. package/dist/v2/components/or-rich-text-editor-v3/index.d.ts +0 -1
  292. package/dist/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -7
  293. package/dist/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -111
  294. package/dist/v3/components/or-rich-text-editor-v3/index.d.ts +0 -1
  295. package/dist/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -7
  296. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +0 -16
  297. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +0 -57
  298. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +0 -322
  299. package/src/components/or-rich-text-editor-v3/index.ts +0 -1
  300. package/src/components/or-rich-text-editor-v3/styles.ts +0 -71
@@ -1,322 +0,0 @@
1
- <template>
2
- <div
3
- ref="root"
4
- v-bind="$attrs"
5
- :class="rootStyles"
6
- >
7
- <or-label>
8
- {{ description }}
9
- </or-label>
10
- <div
11
- ref="containerRef"
12
- :class="containerStyles"
13
- @click="handleEditorClick()"
14
- >
15
- <div :class="toolbarContainerStyles">
16
- <div
17
- v-for="tool in toolbar"
18
- :key="tool"
19
- :class="toolbarStyles"
20
- >
21
- <div
22
- v-for="item in tool"
23
- :key="item"
24
- :class="toolbarButtonStyles(item)"
25
- >
26
- <or-icon-button
27
- :tooltip="{text: iconTooltipsEnum[item], placement: 'top'}"
28
- :icon="{icon: iconsEnum[item], variant: 'inherit', size: 's'}"
29
- @click="handleToolbarClick(item)"
30
- />
31
- </div>
32
- </div>
33
- </div>
34
- <div
35
- ref="editorRef"
36
- :class="editorInputStyles"
37
- />
38
- </div>
39
- </div>
40
- </template>
41
-
42
- <script lang="ts">
43
- import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
44
- import { useClassAttribute } from '../../hooks';
45
- import { Editor } from '@tiptap/core';
46
- import StarterKit from '@tiptap/starter-kit';
47
- import Underline from '@tiptap/extension-underline';
48
- import Link from '@tiptap/extension-link';
49
- import Highlight from '@tiptap/extension-highlight';
50
- import Placeholder from '@tiptap/extension-placeholder';
51
- import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
52
- import { OrLabelV3 as OrLabel } from '../or-label-v3';
53
- import { flatMap } from 'lodash';
54
- import {
55
- EditorContainer,
56
- EditorContainerFilled,
57
- ToolbarContainer,
58
- Toolbar,
59
- ToolbarButtonActive,
60
- ToolbarButton,
61
- EditorInput,
62
- } from './styles';
63
-
64
- export default defineComponent({
65
- name: 'OrRichTextEditor',
66
-
67
- components: {
68
- OrIconButton,
69
- OrLabel,
70
- },
71
-
72
- inheritAttrs: false,
73
-
74
- props: {
75
- modelValue: {
76
- type: String,
77
- default: '',
78
- required: false,
79
- },
80
- toolbar: {
81
- type: Array,
82
- default: () => [['bold', 'italic', 'strike'], ['underline', 'highlight'], ['link'], ['bulletList', 'orderedList'], ['undo', 'redo']],
83
- },
84
- description: {
85
- type: String,
86
- default: '',
87
- },
88
- placeholder: {
89
- type: String,
90
- default: 'Write something...',
91
- },
92
- autofocus: {
93
- type: Boolean,
94
- default: false,
95
- },
96
- },
97
-
98
- emits: ['update:modelValue'],
99
-
100
- setup(props, { emit }) {
101
- // Refs
102
- let editor = null as Editor | null;
103
- const editorRef = ref<HTMLDivElement>();
104
- const containerRef = ref<HTMLDivElement>();
105
- const isActive = ref<{[key: string]: boolean;}>({});
106
- const isFilled = ref<boolean>(false);
107
- const iconsEnum = ref<{[key: string]: string;}>({
108
- bold: 'format_bold',
109
- italic: 'format_italic',
110
- underline: 'format_underlined',
111
- strike: 'format_strikethrough',
112
- bulletList: 'format_list_bulleted',
113
- orderedList: 'format_list_numbered',
114
- link: 'link',
115
- highlight: 'highlight',
116
- redo: 'redo',
117
- undo: 'undo',
118
- });
119
-
120
- const iconTooltipsEnum = ref<{[key: string]: string;}>({
121
- bold: 'Bold',
122
- italic: 'Italic',
123
- underline: 'Underline',
124
- strike: 'Strike',
125
- bulletList: 'Bulleted List',
126
- orderedList: 'Numbered List',
127
- link: 'Link',
128
- highlight: 'Highlight',
129
- redo: 'Redo',
130
- undo: 'Undo',
131
- });
132
-
133
- onMounted(() => {
134
- editor = new Editor({
135
- onUpdate: ({ editor }) => {
136
- setActiveFormats();
137
- const html = editor.getHTML();
138
- const text = editor.getText();
139
- emit('update:modelValue', text === '' ? text : html);
140
- isFilled.value = text !== '';
141
- },
142
- element: editorRef.value,
143
- content: props.modelValue,
144
- autofocus: props.autofocus,
145
- extensions: [
146
- StarterKit,
147
- Underline,
148
- Link.configure({
149
- openOnClick: true,
150
- linkOnPaste: true,
151
- autolink: false,
152
- protocols: ['ftp', 'mailto', 'http', 'https'],
153
- validate: href => /^https?:\/\//.test(href),
154
- HTMLAttributes: {
155
- class: 'text-primary cursor-pointer',
156
- },
157
- }),
158
- Highlight,
159
- Placeholder
160
- .configure({
161
- placeholder: props.placeholder,
162
- emptyEditorClass: 'is-editor-empty text-outline',
163
- }),
164
- ],
165
- editorProps: {
166
- attributes: {
167
- class: 'focus:outline-none',
168
- },
169
- },
170
- });
171
- setActiveFormats();
172
- isFilled.value = props.modelValue !== '';
173
- });
174
-
175
- onBeforeUnmount(() => {
176
- editor?.destroy();
177
- });
178
-
179
- // Methods
180
- const handleEditorClick = () => {
181
- setActiveFormats();
182
- editor?.commands.focus();
183
- };
184
-
185
- const handleToolbarClick = (item: string) => {
186
- if (item === 'bulletList' || item === 'orderedList') {
187
- item === 'bulletList' ? editor?.commands.toggleBulletList() : editor?.commands.toggleOrderedList();
188
- }
189
- else if (item === 'link') {
190
- setLink();
191
- }
192
- else if (item === 'undo' || item === 'redo') {
193
- item === 'undo' ? editor?.commands.undo() : editor?.commands.redo();
194
- }
195
- else {
196
- editor?.chain().focus().toggleMark(item).run();
197
- }
198
- };
199
-
200
- const setLink = () => {
201
- const previousUrl = editor?.getAttributes('link').href;
202
- const url = window.prompt('URL', previousUrl);
203
-
204
- // cancelled
205
- if (url === null) {
206
- return;
207
- }
208
-
209
- // empty
210
- if (url === '') {
211
- editor?.chain().focus().extendMarkRange('link').unsetLink().run();
212
- return;
213
- }
214
-
215
- // update link
216
- editor?.chain()
217
- .focus()
218
- .extendMarkRange('link')
219
- .setLink({ href: url })
220
- .run();
221
- };
222
-
223
- const setActiveFormats = () => {
224
- const toolbarList = flatMap(props.toolbar) as string[];
225
- toolbarList.forEach((item) => {
226
- isActive.value[item] = editor?.isActive(item) || false;
227
- });
228
- };
229
-
230
- // Styles
231
- const classAttribute = useClassAttribute();
232
-
233
- const rootStyles = computed(() => {
234
- return [
235
- 'or-rich-text-editor',
236
- classAttribute.value,
237
- ];
238
- });
239
-
240
- const containerStyles = computed(() => {
241
- return [
242
- ...EditorContainer,
243
- ...(isFilled.value ? EditorContainerFilled : []),
244
- ];
245
- });
246
-
247
- const toolbarContainerStyles = computed(() => {
248
- return [
249
- ...ToolbarContainer,
250
- ];
251
- });
252
-
253
- const toolbarStyles = computed(() => {
254
- return [
255
- ...Toolbar,
256
- ];
257
- });
258
-
259
- const editorInputStyles = computed(() => {
260
- return [
261
- 'tiptap-editor',
262
- ...EditorInput,
263
- ];
264
- });
265
-
266
- const toolbarButtonStyles = (item: string) => {
267
- return [
268
- // Layout
269
- 'flex',
270
- // Spacing
271
- 'gap-md',
272
- ...isActive.value[item] ? ToolbarButtonActive : ToolbarButton,
273
- ];
274
- };
275
-
276
- //Effects
277
- watch(() => props.modelValue, (value) => {
278
- if (value !== editor?.getHTML()) {
279
- editor?.commands.setContent(value);
280
- }
281
- });
282
-
283
- return {
284
- editor,
285
- editorRef,
286
- containerRef,
287
- iconsEnum,
288
- handleToolbarClick,
289
- handleEditorClick,
290
- isActive,
291
- iconTooltipsEnum,
292
- containerStyles,
293
- toolbarContainerStyles,
294
- toolbarStyles,
295
- rootStyles,
296
- toolbarButtonStyles,
297
- editorInputStyles,
298
- };
299
- },
300
- });
301
- </script>
302
-
303
- <style lang="scss">
304
- .tiptap-editor {
305
- ol { //see if editor can not inherit it
306
- margin: 0 24px;
307
- list-style: decimal;
308
- }
309
-
310
- ul {
311
- margin: 0 24px;
312
- list-style: initial;
313
- }
314
-
315
- .is-editor-empty::before {
316
- content: attr(data-placeholder);
317
- height: 0;
318
- pointer-events: none;
319
- float: left;
320
- }
321
- }
322
- </style>
@@ -1 +0,0 @@
1
- export { default as OrRichTextEditor } from './OrRichTextEditor.vue';
@@ -1,71 +0,0 @@
1
- export const EditorContainer: string[] = [
2
- // Colors
3
- 'border-disabled',
4
- 'dark:border-outline-dark',
5
- 'focus-within:theme-border-1-primary',
6
- 'dark:focus-within:theme-border-1-primary-dark',
7
- 'focus-within:bg-primary-opacity-0-08',
8
- 'dark:focus-within:bg-primary-opacity-0-08-dark',
9
- 'focus-within:theme-outline-primary',
10
- 'dark:focus-within:theme-outline-primary-dark',
11
-
12
- // Sizing
13
- 'border-1',
14
- 'rounded-md',
15
- ];
16
-
17
- export const EditorContainerFilled: string[] = [
18
- //Colors
19
- 'bg-primary-opacity-0-08',
20
- 'dark:bg-primary-opacity-0-08-dark',
21
- ];
22
-
23
- export const ToolbarContainer: string[] = [
24
- // Layout
25
- 'flex',
26
- //Spacing
27
- 'py-sm',
28
- //Sizing
29
- 'border-b-1',
30
- //Colors
31
- 'border-b-disabled',
32
- 'dark:border-b-outline-dark',
33
- ];
34
-
35
- export const Toolbar: string[] = [
36
- // Layout
37
- 'flex',
38
- // Spacing
39
- 'px-sm',
40
- 'gap-md',
41
- // Sizing
42
- 'border-r-1',
43
- //Colors
44
- 'border-r-disabled',
45
- 'dark:border-r-outline-dark',
46
- // Last child
47
- 'last-of-type:border-none',
48
- ];
49
-
50
- export const ToolbarButton: string[] = [
51
- // Typography
52
- 'text-on-disabled',
53
- 'dark:text-outline-dark',
54
- ];
55
-
56
- export const ToolbarButtonActive: string[] = [
57
- // Typography
58
- 'text-on-background',
59
- 'dark:text-on-background-dark',
60
- ];
61
-
62
- export const EditorInput: string[] = [
63
- // Spacing
64
- 'p-sm',
65
- // Typography
66
- 'typography-body-2-regular',
67
- 'text-on-background',
68
- 'dark:text-on-background-dark',
69
- // Sizing
70
- 'min-h-[88px]',
71
- ];