@toptal/picasso 19.2.0 → 19.3.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 (262) hide show
  1. package/Icon/Bold16.d.ts +10 -0
  2. package/Icon/Bold16.js +23 -0
  3. package/Icon/Bold16.js.map +1 -0
  4. package/Icon/Italic16.d.ts +10 -0
  5. package/Icon/Italic16.js +23 -0
  6. package/Icon/Italic16.js.map +1 -0
  7. package/Icon/ListOrdered16.d.ts +10 -0
  8. package/Icon/ListOrdered16.js +23 -0
  9. package/Icon/ListOrdered16.js.map +1 -0
  10. package/Icon/ListUnordered16.d.ts +10 -0
  11. package/Icon/ListUnordered16.js +23 -0
  12. package/Icon/ListUnordered16.js.map +1 -0
  13. package/Icon/index.d.ts +4 -0
  14. package/Icon/index.js +4 -0
  15. package/Icon/index.js.map +1 -1
  16. package/ListItem/styles.d.ts +1 -1
  17. package/QuillEditor/QuillEditor.d.ts +32 -0
  18. package/QuillEditor/QuillEditor.js +42 -0
  19. package/QuillEditor/QuillEditor.js.map +1 -0
  20. package/QuillEditor/constants.d.ts +1 -0
  21. package/QuillEditor/constants.js +2 -0
  22. package/QuillEditor/constants.js.map +1 -0
  23. package/QuillEditor/formats/bold.d.ts +8 -0
  24. package/QuillEditor/formats/bold.js +18 -0
  25. package/QuillEditor/formats/bold.js.map +1 -0
  26. package/QuillEditor/formats/header.d.ts +8 -0
  27. package/QuillEditor/formats/header.js +20 -0
  28. package/QuillEditor/formats/header.js.map +1 -0
  29. package/QuillEditor/formats/index.d.ts +3 -0
  30. package/QuillEditor/formats/index.js +4 -0
  31. package/QuillEditor/formats/index.js.map +1 -0
  32. package/QuillEditor/formats/use-typography-classes.d.ts +2 -0
  33. package/QuillEditor/formats/use-typography-classes.js +7 -0
  34. package/QuillEditor/formats/use-typography-classes.js.map +1 -0
  35. package/QuillEditor/hooks/index.d.ts +6 -0
  36. package/QuillEditor/hooks/index.js +7 -0
  37. package/QuillEditor/hooks/index.js.map +1 -0
  38. package/QuillEditor/hooks/useDefaultValue/index.d.ts +1 -0
  39. package/QuillEditor/hooks/useDefaultValue/index.js +2 -0
  40. package/QuillEditor/hooks/useDefaultValue/index.js.map +1 -0
  41. package/QuillEditor/hooks/useDefaultValue/useDefaultValue.d.ts +7 -0
  42. package/QuillEditor/hooks/useDefaultValue/useDefaultValue.js +15 -0
  43. package/QuillEditor/hooks/useDefaultValue/useDefaultValue.js.map +1 -0
  44. package/QuillEditor/hooks/useDisabledEditor/index.d.ts +1 -0
  45. package/QuillEditor/hooks/useDisabledEditor/index.js +2 -0
  46. package/QuillEditor/hooks/useDisabledEditor/index.js.map +1 -0
  47. package/QuillEditor/hooks/useDisabledEditor/useDisabledEditor.d.ts +6 -0
  48. package/QuillEditor/hooks/useDisabledEditor/useDisabledEditor.js +11 -0
  49. package/QuillEditor/hooks/useDisabledEditor/useDisabledEditor.js.map +1 -0
  50. package/QuillEditor/hooks/useFocus/index.d.ts +1 -0
  51. package/QuillEditor/hooks/useFocus/index.js +2 -0
  52. package/QuillEditor/hooks/useFocus/index.js.map +1 -0
  53. package/QuillEditor/hooks/useFocus/useFocus.d.ts +6 -0
  54. package/QuillEditor/hooks/useFocus/useFocus.js +13 -0
  55. package/QuillEditor/hooks/useFocus/useFocus.js.map +1 -0
  56. package/QuillEditor/hooks/useKeyBindings/index.d.ts +1 -0
  57. package/QuillEditor/hooks/useKeyBindings/index.js +2 -0
  58. package/QuillEditor/hooks/useKeyBindings/index.js.map +1 -0
  59. package/QuillEditor/hooks/useKeyBindings/useKeyBindings.d.ts +7 -0
  60. package/QuillEditor/hooks/useKeyBindings/useKeyBindings.js +32 -0
  61. package/QuillEditor/hooks/useKeyBindings/useKeyBindings.js.map +1 -0
  62. package/QuillEditor/hooks/useQuillInstance/index.d.ts +1 -0
  63. package/QuillEditor/hooks/useQuillInstance/index.js +2 -0
  64. package/QuillEditor/hooks/useQuillInstance/index.js.map +1 -0
  65. package/QuillEditor/hooks/useQuillInstance/useQuillInstance.d.ts +9 -0
  66. package/QuillEditor/hooks/useQuillInstance/useQuillInstance.js +68 -0
  67. package/QuillEditor/hooks/useQuillInstance/useQuillInstance.js.map +1 -0
  68. package/QuillEditor/hooks/useSubscribeToQuillEvents/index.d.ts +1 -0
  69. package/QuillEditor/hooks/useSubscribeToQuillEvents/index.js +2 -0
  70. package/QuillEditor/hooks/useSubscribeToQuillEvents/index.js.map +1 -0
  71. package/QuillEditor/hooks/useSubscribeToQuillEvents/useSubscribeToQuillEvents.d.ts +10 -0
  72. package/QuillEditor/hooks/useSubscribeToQuillEvents/useSubscribeToQuillEvents.js +64 -0
  73. package/QuillEditor/hooks/useSubscribeToQuillEvents/useSubscribeToQuillEvents.js.map +1 -0
  74. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/index.d.ts +1 -0
  75. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/index.js +2 -0
  76. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/index.js.map +1 -0
  77. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/useSubscribeToTextEditorEvents.d.ts +6 -0
  78. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/useSubscribeToTextEditorEvents.js +23 -0
  79. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/useSubscribeToTextEditorEvents.js.map +1 -0
  80. package/QuillEditor/index.d.ts +4 -0
  81. package/QuillEditor/index.js +4 -0
  82. package/QuillEditor/index.js.map +1 -0
  83. package/QuillEditor/styles.d.ts +3 -0
  84. package/QuillEditor/styles.js +100 -0
  85. package/QuillEditor/styles.js.map +1 -0
  86. package/QuillEditor/types.d.ts +27 -0
  87. package/QuillEditor/types.js +2 -0
  88. package/QuillEditor/types.js.map +1 -0
  89. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/getCleanupOnAllContentRemovalHandler.d.ts +3 -0
  90. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/getCleanupOnAllContentRemovalHandler.js +22 -0
  91. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/getCleanupOnAllContentRemovalHandler.js.map +1 -0
  92. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/index.d.ts +1 -0
  93. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/index.js +2 -0
  94. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/index.js.map +1 -0
  95. package/QuillEditor/utils/getEditorChangeHandler/getEditorChangeHandler.d.ts +7 -0
  96. package/QuillEditor/utils/getEditorChangeHandler/getEditorChangeHandler.js +41 -0
  97. package/QuillEditor/utils/getEditorChangeHandler/getEditorChangeHandler.js.map +1 -0
  98. package/QuillEditor/utils/getEditorChangeHandler/index.d.ts +1 -0
  99. package/QuillEditor/utils/getEditorChangeHandler/index.js +2 -0
  100. package/QuillEditor/utils/getEditorChangeHandler/index.js.map +1 -0
  101. package/QuillEditor/utils/getFormatChangeHandler/getFormatChangeHandler.d.ts +3 -0
  102. package/QuillEditor/utils/getFormatChangeHandler/getFormatChangeHandler.js +13 -0
  103. package/QuillEditor/utils/getFormatChangeHandler/getFormatChangeHandler.js.map +1 -0
  104. package/QuillEditor/utils/getFormatChangeHandler/index.d.ts +2 -0
  105. package/QuillEditor/utils/getFormatChangeHandler/index.js +3 -0
  106. package/QuillEditor/utils/getFormatChangeHandler/index.js.map +1 -0
  107. package/QuillEditor/utils/getSelectionChangeHandler/getSelectionChangeHandler.d.ts +4 -0
  108. package/QuillEditor/utils/getSelectionChangeHandler/getSelectionChangeHandler.js +19 -0
  109. package/QuillEditor/utils/getSelectionChangeHandler/getSelectionChangeHandler.js.map +1 -0
  110. package/QuillEditor/utils/getSelectionChangeHandler/index.d.ts +1 -0
  111. package/QuillEditor/utils/getSelectionChangeHandler/index.js +2 -0
  112. package/QuillEditor/utils/getSelectionChangeHandler/index.js.map +1 -0
  113. package/QuillEditor/utils/getTextChangeHandler/getTextChangeHandler.d.ts +3 -0
  114. package/QuillEditor/utils/getTextChangeHandler/getTextChangeHandler.js +22 -0
  115. package/QuillEditor/utils/getTextChangeHandler/getTextChangeHandler.js.map +1 -0
  116. package/QuillEditor/utils/getTextChangeHandler/index.d.ts +1 -0
  117. package/QuillEditor/utils/getTextChangeHandler/index.js +2 -0
  118. package/QuillEditor/utils/getTextChangeHandler/index.js.map +1 -0
  119. package/QuillEditor/utils/getTextLengthChangeHandler/getTextLengthChangeHandler.d.ts +4 -0
  120. package/QuillEditor/utils/getTextLengthChangeHandler/getTextLengthChangeHandler.js +9 -0
  121. package/QuillEditor/utils/getTextLengthChangeHandler/getTextLengthChangeHandler.js.map +1 -0
  122. package/QuillEditor/utils/getTextLengthChangeHandler/index.d.ts +1 -0
  123. package/QuillEditor/utils/getTextLengthChangeHandler/index.js +2 -0
  124. package/QuillEditor/utils/getTextLengthChangeHandler/index.js.map +1 -0
  125. package/QuillEditor/utils/remove-classes/index.d.ts +1 -0
  126. package/QuillEditor/utils/remove-classes/index.js +2 -0
  127. package/QuillEditor/utils/remove-classes/index.js.map +1 -0
  128. package/QuillEditor/utils/remove-classes/remove-classes.d.ts +2 -0
  129. package/QuillEditor/utils/remove-classes/remove-classes.js +3 -0
  130. package/QuillEditor/utils/remove-classes/remove-classes.js.map +1 -0
  131. package/QuillEditor/utils/remove-cursor-span/index.d.ts +1 -0
  132. package/QuillEditor/utils/remove-cursor-span/index.js +2 -0
  133. package/QuillEditor/utils/remove-cursor-span/index.js.map +1 -0
  134. package/QuillEditor/utils/remove-cursor-span/remove-cursor-span.d.ts +2 -0
  135. package/QuillEditor/utils/remove-cursor-span/remove-cursor-span.js +5 -0
  136. package/QuillEditor/utils/remove-cursor-span/remove-cursor-span.js.map +1 -0
  137. package/RichTextEditor/RichTextEditor.d.ts +63 -0
  138. package/RichTextEditor/RichTextEditor.js +77 -0
  139. package/RichTextEditor/RichTextEditor.js.map +1 -0
  140. package/RichTextEditor/hooks/index.d.ts +6 -0
  141. package/RichTextEditor/hooks/index.js +7 -0
  142. package/RichTextEditor/hooks/index.js.map +1 -0
  143. package/RichTextEditor/hooks/useCounter/index.d.ts +1 -0
  144. package/RichTextEditor/hooks/useCounter/index.js +2 -0
  145. package/RichTextEditor/hooks/useCounter/index.js.map +1 -0
  146. package/RichTextEditor/hooks/useCounter/useCounter.d.ts +14 -0
  147. package/RichTextEditor/hooks/useCounter/useCounter.js +68 -0
  148. package/RichTextEditor/hooks/useCounter/useCounter.js.map +1 -0
  149. package/RichTextEditor/hooks/useOnFocus/index.d.ts +1 -0
  150. package/RichTextEditor/hooks/useOnFocus/index.js +2 -0
  151. package/RichTextEditor/hooks/useOnFocus/index.js.map +1 -0
  152. package/RichTextEditor/hooks/useOnFocus/useOnFocus.d.ts +16 -0
  153. package/RichTextEditor/hooks/useOnFocus/useOnFocus.js +44 -0
  154. package/RichTextEditor/hooks/useOnFocus/useOnFocus.js.map +1 -0
  155. package/RichTextEditor/hooks/useOnSelectionChange/index.d.ts +1 -0
  156. package/RichTextEditor/hooks/useOnSelectionChange/index.js +2 -0
  157. package/RichTextEditor/hooks/useOnSelectionChange/index.js.map +1 -0
  158. package/RichTextEditor/hooks/useOnSelectionChange/useOnSelectionChange.d.ts +10 -0
  159. package/RichTextEditor/hooks/useOnSelectionChange/useOnSelectionChange.js +15 -0
  160. package/RichTextEditor/hooks/useOnSelectionChange/useOnSelectionChange.js.map +1 -0
  161. package/RichTextEditor/hooks/useOnTextFormat/index.d.ts +1 -0
  162. package/RichTextEditor/hooks/useOnTextFormat/index.js +2 -0
  163. package/RichTextEditor/hooks/useOnTextFormat/index.js.map +1 -0
  164. package/RichTextEditor/hooks/useOnTextFormat/useOnTextFormat.d.ts +10 -0
  165. package/RichTextEditor/hooks/useOnTextFormat/useOnTextFormat.js +30 -0
  166. package/RichTextEditor/hooks/useOnTextFormat/useOnTextFormat.js.map +1 -0
  167. package/RichTextEditor/hooks/useTextEditorState/index.d.ts +1 -0
  168. package/RichTextEditor/hooks/useTextEditorState/index.js +2 -0
  169. package/RichTextEditor/hooks/useTextEditorState/index.js.map +1 -0
  170. package/RichTextEditor/hooks/useTextEditorState/useTextEditorState.d.ts +7 -0
  171. package/RichTextEditor/hooks/useTextEditorState/useTextEditorState.js +8 -0
  172. package/RichTextEditor/hooks/useTextEditorState/useTextEditorState.js.map +1 -0
  173. package/RichTextEditor/hooks/useToolbarHandlers/index.d.ts +1 -0
  174. package/RichTextEditor/hooks/useToolbarHandlers/index.js +2 -0
  175. package/RichTextEditor/hooks/useToolbarHandlers/index.js.map +1 -0
  176. package/RichTextEditor/hooks/useToolbarHandlers/useToolbarHandlers.d.ts +16 -0
  177. package/RichTextEditor/hooks/useToolbarHandlers/useToolbarHandlers.js +61 -0
  178. package/RichTextEditor/hooks/useToolbarHandlers/useToolbarHandlers.js.map +1 -0
  179. package/RichTextEditor/index.d.ts +7 -0
  180. package/RichTextEditor/index.js +3 -0
  181. package/RichTextEditor/index.js.map +1 -0
  182. package/RichTextEditor/store/index.d.ts +9 -0
  183. package/RichTextEditor/store/index.js +11 -0
  184. package/RichTextEditor/store/index.js.map +1 -0
  185. package/RichTextEditor/store/toolbar/actionTypes.d.ts +9 -0
  186. package/RichTextEditor/store/toolbar/actionTypes.js +10 -0
  187. package/RichTextEditor/store/toolbar/actionTypes.js.map +1 -0
  188. package/RichTextEditor/store/toolbar/actions.d.ts +11 -0
  189. package/RichTextEditor/store/toolbar/actions.js +17 -0
  190. package/RichTextEditor/store/toolbar/actions.js.map +1 -0
  191. package/RichTextEditor/store/toolbar/index.d.ts +6 -0
  192. package/RichTextEditor/store/toolbar/index.js +7 -0
  193. package/RichTextEditor/store/toolbar/index.js.map +1 -0
  194. package/RichTextEditor/store/toolbar/initialState.d.ts +3 -0
  195. package/RichTextEditor/store/toolbar/initialState.js +11 -0
  196. package/RichTextEditor/store/toolbar/initialState.js.map +1 -0
  197. package/RichTextEditor/store/toolbar/reducer.d.ts +3 -0
  198. package/RichTextEditor/store/toolbar/reducer.js +22 -0
  199. package/RichTextEditor/store/toolbar/reducer.js.map +1 -0
  200. package/RichTextEditor/store/toolbar/types.d.ts +40 -0
  201. package/RichTextEditor/store/toolbar/types.js +2 -0
  202. package/RichTextEditor/store/toolbar/types.js.map +1 -0
  203. package/RichTextEditor/store/types.d.ts +5 -0
  204. package/RichTextEditor/store/types.js +2 -0
  205. package/RichTextEditor/store/types.js.map +1 -0
  206. package/RichTextEditor/styles.d.ts +3 -0
  207. package/RichTextEditor/styles.js +23 -0
  208. package/RichTextEditor/styles.js.map +1 -0
  209. package/RichTextEditor/types.d.ts +2 -0
  210. package/RichTextEditor/types.js +2 -0
  211. package/RichTextEditor/types.js.map +1 -0
  212. package/RichTextEditor/utils/convertFormat.d.ts +8 -0
  213. package/RichTextEditor/utils/convertFormat.js +19 -0
  214. package/RichTextEditor/utils/convertFormat.js.map +1 -0
  215. package/RichTextEditorButton/RichTextEditorButton.d.ts +18 -0
  216. package/RichTextEditorButton/RichTextEditorButton.js +38 -0
  217. package/RichTextEditorButton/RichTextEditorButton.js.map +1 -0
  218. package/RichTextEditorButton/index.d.ts +1 -0
  219. package/RichTextEditorButton/index.js +2 -0
  220. package/RichTextEditorButton/index.js.map +1 -0
  221. package/RichTextEditorButton/styles.d.ts +3 -0
  222. package/RichTextEditorButton/styles.js +16 -0
  223. package/RichTextEditorButton/styles.js.map +1 -0
  224. package/RichTextEditorCounter/RichTextEditorCounter.d.ts +10 -0
  225. package/RichTextEditorCounter/RichTextEditorCounter.js +17 -0
  226. package/RichTextEditorCounter/RichTextEditorCounter.js.map +1 -0
  227. package/RichTextEditorCounter/index.d.ts +1 -0
  228. package/RichTextEditorCounter/index.js +2 -0
  229. package/RichTextEditorCounter/index.js.map +1 -0
  230. package/RichTextEditorCounter/styles.d.ts +3 -0
  231. package/RichTextEditorCounter/styles.js +27 -0
  232. package/RichTextEditorCounter/styles.js.map +1 -0
  233. package/RichTextEditorToolbar/RichTextEditorToolbar.d.ts +22 -0
  234. package/RichTextEditorToolbar/RichTextEditorToolbar.js +44 -0
  235. package/RichTextEditorToolbar/RichTextEditorToolbar.js.map +1 -0
  236. package/RichTextEditorToolbar/index.d.ts +2 -0
  237. package/RichTextEditorToolbar/index.js +3 -0
  238. package/RichTextEditorToolbar/index.js.map +1 -0
  239. package/RichTextEditorToolbar/styles.d.ts +5 -0
  240. package/RichTextEditorToolbar/styles.js +27 -0
  241. package/RichTextEditorToolbar/styles.js.map +1 -0
  242. package/RichTextEditorToolbar/types.d.ts +6 -0
  243. package/RichTextEditorToolbar/types.js +2 -0
  244. package/RichTextEditorToolbar/types.js.map +1 -0
  245. package/Typography/Typography.js +11 -13
  246. package/Typography/Typography.js.map +1 -1
  247. package/Typography/styles.d.ts +1 -1
  248. package/Typography/styles.js +121 -114
  249. package/Typography/styles.js.map +1 -1
  250. package/Typography/utils/get-typography-class-name/get-typography-class-name.d.ts +3 -0
  251. package/Typography/utils/get-typography-class-name/get-typography-class-name.js +15 -0
  252. package/Typography/utils/get-typography-class-name/get-typography-class-name.js.map +1 -0
  253. package/Typography/utils/get-typography-class-name/index.d.ts +1 -0
  254. package/Typography/utils/get-typography-class-name/index.js +2 -0
  255. package/Typography/utils/get-typography-class-name/index.js.map +1 -0
  256. package/index.d.ts +2 -0
  257. package/index.js +1 -0
  258. package/index.js.map +1 -1
  259. package/package.json +6 -1
  260. package/Typography/utils/index.d.ts +0 -1
  261. package/Typography/utils/index.js +0 -2
  262. package/Typography/utils/index.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ import { useCallback } from 'react';
2
+ import { actions as toolbarActions } from '../../store/toolbar';
3
+ import { convertBoldFromEditorValue, convertItalicFromEditorValue, convertListFromEditorValue, convertHeaderFromEditorValue } from '../../utils/convertFormat';
4
+ const useOnTextFormat = ({ dispatch }) => {
5
+ const handleTextFormat = useCallback((e) => {
6
+ switch (e.formatName) {
7
+ case 'bold': {
8
+ const boldValue = convertBoldFromEditorValue(e.value);
9
+ return toolbarActions.setBold(dispatch)(boldValue);
10
+ }
11
+ case 'italic': {
12
+ const italicValue = convertItalicFromEditorValue(e.value);
13
+ return toolbarActions.setItalic(dispatch)(italicValue);
14
+ }
15
+ case 'list': {
16
+ const listValue = convertListFromEditorValue(e.value);
17
+ return toolbarActions.setList(dispatch)(listValue);
18
+ }
19
+ case 'header': {
20
+ const headerValue = convertHeaderFromEditorValue(e.value);
21
+ return toolbarActions.setHeader(dispatch)(headerValue);
22
+ }
23
+ default:
24
+ throw Error(`TextEditor - useOnTextFormat is not implemented for ${e}`);
25
+ }
26
+ }, [dispatch]);
27
+ return { handleTextFormat };
28
+ };
29
+ export default useOnTextFormat;
30
+ //# sourceMappingURL=useOnTextFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOnTextFormat.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/hooks/useOnTextFormat/useOnTextFormat.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,OAAO,CAAA;AAG7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAE/D,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,2BAA2B,CAAA;AAMlC,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAS,EAAE,EAAE;IAC9C,MAAM,gBAAgB,GAAG,WAAW,CAClC,CAAC,CAAyB,EAAE,EAAE;QAC5B,QAAQ,CAAC,CAAC,UAAU,EAAE;YACpB,KAAK,MAAM,CAAC,CAAC;gBACX,MAAM,SAAS,GAAG,0BAA0B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;gBAErD,OAAO,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAA;aACnD;YACD,KAAK,QAAQ,CAAC,CAAC;gBACb,MAAM,WAAW,GAAG,4BAA4B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;gBAEzD,OAAO,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAA;aACvD;YACD,KAAK,MAAM,CAAC,CAAC;gBACX,MAAM,SAAS,GAAG,0BAA0B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;gBAErD,OAAO,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAA;aACnD;YACD,KAAK,QAAQ,CAAC,CAAC;gBACb,MAAM,WAAW,GAAG,4BAA4B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;gBAEzD,OAAO,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAA;aACvD;YACD;gBACE,MAAM,KAAK,CACT,uDAAuD,CAAC,EAAE,CAC3D,CAAA;SACJ;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAA;IAED,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAC7B,CAAC,CAAA;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1 @@
1
+ export { default } from './useTextEditorState';
@@ -0,0 +1,2 @@
1
+ export { default } from './useTextEditorState';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/hooks/useTextEditorState/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA"}
@@ -0,0 +1,7 @@
1
+ declare const useTextEditorState: () => {
2
+ state: {
3
+ toolbar: import("../../store/toolbar").ToolbarStateType;
4
+ };
5
+ dispatch: import("react").Dispatch<import("../../store/toolbar").ToolbarActionsType>;
6
+ };
7
+ export default useTextEditorState;
@@ -0,0 +1,8 @@
1
+ import { useReducer } from 'react';
2
+ import { combinedReducers, initialState } from '../../store';
3
+ const useTextEditorState = () => {
4
+ const [state, dispatch] = useReducer(combinedReducers, initialState);
5
+ return { state, dispatch };
6
+ };
7
+ export default useTextEditorState;
8
+ //# sourceMappingURL=useTextEditorState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTextEditorState.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/hooks/useTextEditorState/useTextEditorState.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE5D,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC9B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAA;IAEpE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;AAC5B,CAAC,CAAA;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1 @@
1
+ export { default } from './useToolbarHandlers';
@@ -0,0 +1,2 @@
1
+ export { default } from './useToolbarHandlers';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/hooks/useToolbarHandlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { TextFormatHandler } from '../../../QuillEditor';
2
+ import { SelectOnChangeHandler, ButtonHandlerType } from '../../../RichTextEditorToolbar';
3
+ import { FormatType } from '../../store/toolbar';
4
+ declare type Props = {
5
+ editorRef: React.RefObject<HTMLDivElement | null>;
6
+ handleTextFormat: TextFormatHandler;
7
+ format: FormatType;
8
+ };
9
+ declare const useToolbarHandlers: ({ editorRef, handleTextFormat, format }: Props) => {
10
+ handleBold: ButtonHandlerType;
11
+ handleItalic: ButtonHandlerType;
12
+ handleOrdered: ButtonHandlerType;
13
+ handleUnordered: ButtonHandlerType;
14
+ handleHeader: SelectOnChangeHandler;
15
+ };
16
+ export default useToolbarHandlers;
@@ -0,0 +1,61 @@
1
+ import { useCallback } from 'react';
2
+ import { CUSTOM_QUILL_EDITOR_FORMAT_EVENT } from '../../../QuillEditor';
3
+ import { convertHeaderToEditorValue } from '../../utils/convertFormat';
4
+ const useToolbarHandlers = ({ editorRef, handleTextFormat, format }) => {
5
+ const sendFormatEvent = useCallback((detail) => {
6
+ var _a;
7
+ const formatEvent = new CustomEvent(CUSTOM_QUILL_EDITOR_FORMAT_EVENT, {
8
+ detail
9
+ });
10
+ (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.dispatchEvent(formatEvent);
11
+ }, [editorRef]);
12
+ const handleBold = () => {
13
+ const bold = !format.bold;
14
+ sendFormatEvent({ bold });
15
+ handleTextFormat({
16
+ formatName: 'bold',
17
+ value: bold
18
+ });
19
+ };
20
+ const handleItalic = () => {
21
+ const italic = !format.italic;
22
+ sendFormatEvent({ italic });
23
+ handleTextFormat({
24
+ formatName: 'italic',
25
+ value: italic
26
+ });
27
+ };
28
+ const handleOrdered = () => {
29
+ const list = format.list === 'ordered' ? undefined : 'ordered';
30
+ sendFormatEvent({ list });
31
+ handleTextFormat({
32
+ formatName: 'list',
33
+ value: list
34
+ });
35
+ };
36
+ const handleUnordered = () => {
37
+ const list = format.list === 'bullet' ? undefined : 'bullet';
38
+ sendFormatEvent({ list });
39
+ handleTextFormat({
40
+ formatName: 'list',
41
+ value: list
42
+ });
43
+ };
44
+ const handleHeader = event => {
45
+ const header = convertHeaderToEditorValue(event.target.value);
46
+ sendFormatEvent(header ? { header, bold: false, italic: false } : { header });
47
+ handleTextFormat({
48
+ formatName: 'header',
49
+ value: header
50
+ });
51
+ };
52
+ return {
53
+ handleBold,
54
+ handleItalic,
55
+ handleOrdered,
56
+ handleUnordered,
57
+ handleHeader
58
+ };
59
+ };
60
+ export default useToolbarHandlers;
61
+ //# sourceMappingURL=useToolbarHandlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolbarHandlers.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/hooks/useToolbarHandlers/useToolbarHandlers.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEnC,OAAO,EAEL,gCAAgC,EAEjC,MAAM,sBAAsB,CAAA;AAM7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAQtE,MAAM,kBAAkB,GAAG,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAS,EAAE,EAAE;IAC5E,MAAM,eAAe,GAAG,WAAW,CACjC,CAAC,MAAiC,EAAE,EAAE;;QACpC,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,gCAAgC,EAAE;YACpE,MAAM;SACP,CAAC,CAAA;QAEF,MAAA,SAAS,CAAC,OAAO,0CAAE,aAAa,CAAC,WAAW,CAAC,CAAA;IAC/C,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAA;IAED,MAAM,UAAU,GAAsB,GAAG,EAAE;QACzC,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAA;QAEzB,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QACzB,gBAAgB,CAAC;YACf,UAAU,EAAE,MAAM;YAClB,KAAK,EAAE,IAAI;SACZ,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,YAAY,GAAsB,GAAG,EAAE;QAC3C,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,MAAM,CAAA;QAE7B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;QAC3B,gBAAgB,CAAC;YACf,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,MAAM;SACd,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,aAAa,GAAsB,GAAG,EAAE;QAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA;QAE9D,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QACzB,gBAAgB,CAAC;YACf,UAAU,EAAE,MAAM;YAClB,KAAK,EAAE,IAAI;SACZ,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,eAAe,GAAsB,GAAG,EAAE;QAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAA;QAE5D,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QACzB,gBAAgB,CAAC;YACf,UAAU,EAAE,MAAM;YAClB,KAAK,EAAE,IAAI;SACZ,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,YAAY,GAA0B,KAAK,CAAC,EAAE;QAClD,MAAM,MAAM,GAAG,0BAA0B,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAE7D,eAAe,CACb,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAC7D,CAAA;QACD,gBAAgB,CAAC;YACf,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,MAAM;SACd,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,OAAO;QACL,UAAU;QACV,YAAY;QACZ,aAAa;QACb,eAAe;QACf,YAAY;KACb,CAAA;AACH,CAAC,CAAA;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { OmitInternalProps } from '@toptal/picasso-shared';
2
+ import { Props } from './RichTextEditor';
3
+ import { FormatType, HeaderValue } from './store/toolbar';
4
+ export { default } from './RichTextEditor';
5
+ export type { FormatType, HeaderValue };
6
+ export * from './types';
7
+ export declare type RichTextEditorProps = OmitInternalProps<Props>;
@@ -0,0 +1,3 @@
1
+ export { default } from './RichTextEditor';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/RichTextEditor/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,cAAc,SAAS,CAAA"}
@@ -0,0 +1,9 @@
1
+ import * as toolbarStore from './toolbar';
2
+ import { StateType, ActionsType } from './types';
3
+ export * from './types';
4
+ export declare const combinedReducers: (state: StateType, action: ActionsType) => {
5
+ toolbar: toolbarStore.ToolbarStateType;
6
+ };
7
+ export declare const initialState: {
8
+ toolbar: toolbarStore.ToolbarStateType;
9
+ };
@@ -0,0 +1,11 @@
1
+ import * as toolbarStore from './toolbar';
2
+ export * from './types';
3
+ export const combinedReducers = (state, action) => {
4
+ return {
5
+ toolbar: toolbarStore.reducer(state.toolbar, action)
6
+ };
7
+ };
8
+ export const initialState = {
9
+ toolbar: toolbarStore.initialState
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/RichTextEditor/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,WAAW,CAAA;AAGzC,cAAc,SAAS,CAAA;AAEvB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAgB,EAAE,MAAmB,EAAE,EAAE;IACxE,OAAO;QACL,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;KACrD,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,YAAY,CAAC,YAAY;CACnC,CAAA"}
@@ -0,0 +1,9 @@
1
+ declare const actionTypes: {
2
+ readonly bold: "TOOLBAR/SET_BOLD";
3
+ readonly header: "TOOLBAR/SET_HEADER";
4
+ readonly italic: "TOOLBAR/SET_ITALIC";
5
+ readonly list: "TOOLBAR/SET_LIST";
6
+ readonly disabled: "TOOLBAR/SET_DISABLED";
7
+ readonly resetFormat: "TOOLBAR/RESET_FORMAT";
8
+ };
9
+ export default actionTypes;
@@ -0,0 +1,10 @@
1
+ const actionTypes = {
2
+ bold: 'TOOLBAR/SET_BOLD',
3
+ header: 'TOOLBAR/SET_HEADER',
4
+ italic: 'TOOLBAR/SET_ITALIC',
5
+ list: 'TOOLBAR/SET_LIST',
6
+ disabled: 'TOOLBAR/SET_DISABLED',
7
+ resetFormat: 'TOOLBAR/RESET_FORMAT'
8
+ };
9
+ export default actionTypes;
10
+ //# sourceMappingURL=actionTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionTypes.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/store/toolbar/actionTypes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,oBAAoB;IAC5B,MAAM,EAAE,oBAAoB;IAC5B,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,sBAAsB;IAChC,WAAW,EAAE,sBAAsB;CAC3B,CAAA;AAEV,eAAe,WAAW,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { Dispatch } from 'react';
2
+ import { SetBoldActionType, SetHeaderActionType, SetItalicActionType, SetListActionType, SetDisabled, ResetFormatType } from './types';
3
+ declare const actions: {
4
+ setBold: (dispatch: Dispatch<SetBoldActionType>) => (payload: SetBoldActionType['payload']) => void;
5
+ setItalic: (dispatch: Dispatch<SetItalicActionType>) => (payload: SetItalicActionType['payload']) => void;
6
+ setHeader: (dispatch: Dispatch<SetHeaderActionType>) => (payload: SetHeaderActionType['payload']) => void;
7
+ setList: (dispatch: Dispatch<SetListActionType>) => (payload: SetListActionType['payload']) => void;
8
+ setDisabled: (dispatch: Dispatch<SetDisabled>) => (payload: boolean) => void;
9
+ resetFormat: (dispatch: Dispatch<ResetFormatType>) => () => void;
10
+ };
11
+ export default actions;
@@ -0,0 +1,17 @@
1
+ import actionTypes from './actionTypes';
2
+ const setBold = (dispatch) => (payload) => dispatch({ type: actionTypes.bold, payload });
3
+ const setItalic = (dispatch) => (payload) => dispatch({ type: actionTypes.italic, payload });
4
+ const setHeader = (dispatch) => (payload) => dispatch({ type: actionTypes.header, payload });
5
+ const setList = (dispatch) => (payload) => dispatch({ type: actionTypes.list, payload });
6
+ const setDisabled = (dispatch) => (payload) => dispatch({ type: actionTypes.disabled, payload });
7
+ const resetFormat = (dispatch) => () => dispatch({ type: actionTypes.resetFormat });
8
+ const actions = {
9
+ setBold,
10
+ setItalic,
11
+ setHeader,
12
+ setList,
13
+ setDisabled,
14
+ resetFormat
15
+ };
16
+ export default actions;
17
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/store/toolbar/actions.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,eAAe,CAAA;AAUvC,MAAM,OAAO,GAAG,CAAC,QAAqC,EAAE,EAAE,CAAC,CACzD,OAAqC,EACrC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;AAElD,MAAM,SAAS,GAAG,CAAC,QAAuC,EAAE,EAAE,CAAC,CAC7D,OAAuC,EACvC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;AAEpD,MAAM,SAAS,GAAG,CAAC,QAAuC,EAAE,EAAE,CAAC,CAC7D,OAAuC,EACvC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;AAEpD,MAAM,OAAO,GAAG,CAAC,QAAqC,EAAE,EAAE,CAAC,CACzD,OAAqC,EACrC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;AAElD,MAAM,WAAW,GAAG,CAAC,QAA+B,EAAE,EAAE,CAAC,CAAC,OAAgB,EAAE,EAAE,CAC5E,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAA;AAEnD,MAAM,WAAW,GAAG,CAAC,QAAmC,EAAE,EAAE,CAAC,GAAG,EAAE,CAChE,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAA;AAE7C,MAAM,OAAO,GAAG;IACd,OAAO;IACP,SAAS;IACT,SAAS;IACT,OAAO;IACP,WAAW;IACX,WAAW;CACZ,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,6 @@
1
+ import actions from './actions';
2
+ import reducer from './reducer';
3
+ import initialState from './initialState';
4
+ import actionTypes from './actionTypes';
5
+ export * from './types';
6
+ export { actions, actionTypes, reducer, initialState };
@@ -0,0 +1,7 @@
1
+ import actions from './actions';
2
+ import reducer from './reducer';
3
+ import initialState from './initialState';
4
+ import actionTypes from './actionTypes';
5
+ export * from './types';
6
+ export { actions, actionTypes, reducer, initialState };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/store/toolbar/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,WAAW,MAAM,eAAe,CAAA;AAEvC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { ToolbarStateType } from './types';
2
+ declare const initialState: ToolbarStateType;
3
+ export default initialState;
@@ -0,0 +1,11 @@
1
+ const initialState = {
2
+ format: {
3
+ bold: false,
4
+ header: '',
5
+ italic: false,
6
+ list: false
7
+ },
8
+ disabled: true
9
+ };
10
+ export default initialState;
11
+ //# sourceMappingURL=initialState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initialState.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/store/toolbar/initialState.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAqB;IACrC,MAAM,EAAE;QACN,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,KAAK;KACZ;IACD,QAAQ,EAAE,IAAI;CACf,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { ToolbarReducerType } from './types';
2
+ declare const reducer: ToolbarReducerType;
3
+ export default reducer;
@@ -0,0 +1,22 @@
1
+ import actionTypes from './actionTypes';
2
+ import initialState from './initialState';
3
+ const reducer = (state = initialState, action) => {
4
+ switch (action.type) {
5
+ case actionTypes.bold:
6
+ return Object.assign(Object.assign({}, state), { format: Object.assign(Object.assign({}, state.format), { bold: action.payload }) });
7
+ case actionTypes.italic:
8
+ return Object.assign(Object.assign({}, state), { format: Object.assign(Object.assign({}, state.format), { italic: action.payload }) });
9
+ case actionTypes.header:
10
+ return Object.assign(Object.assign({}, state), { format: Object.assign(Object.assign({}, state.format), { header: action.payload }) });
11
+ case actionTypes.list:
12
+ return Object.assign(Object.assign({}, state), { format: Object.assign(Object.assign({}, state.format), { list: action.payload }) });
13
+ case actionTypes.disabled:
14
+ return Object.assign(Object.assign({}, state), { disabled: action.payload });
15
+ case actionTypes.resetFormat:
16
+ return Object.assign(Object.assign({}, state), { format: initialState.format });
17
+ default:
18
+ return state;
19
+ }
20
+ };
21
+ export default reducer;
22
+ //# sourceMappingURL=reducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/store/toolbar/reducer.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAA;AAEvC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAEzC,MAAM,OAAO,GAAuB,CAAC,KAAK,GAAG,YAAY,EAAE,MAAM,EAAE,EAAE;IACnE,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,WAAW,CAAC,IAAI;YACnB,uCACK,KAAK,KACR,MAAM,kCAAO,KAAK,CAAC,MAAM,KAAE,IAAI,EAAE,MAAM,CAAC,OAAO,OAChD;QACH,KAAK,WAAW,CAAC,MAAM;YACrB,uCACK,KAAK,KACR,MAAM,kCAAO,KAAK,CAAC,MAAM,KAAE,MAAM,EAAE,MAAM,CAAC,OAAO,OAClD;QACH,KAAK,WAAW,CAAC,MAAM;YACrB,uCACK,KAAK,KACR,MAAM,kCAAO,KAAK,CAAC,MAAM,KAAE,MAAM,EAAE,MAAM,CAAC,OAAO,OAClD;QACH,KAAK,WAAW,CAAC,IAAI;YACnB,uCACK,KAAK,KACR,MAAM,kCAAO,KAAK,CAAC,MAAM,KAAE,IAAI,EAAE,MAAM,CAAC,OAAO,OAChD;QAEH,KAAK,WAAW,CAAC,QAAQ;YACvB,uCACK,KAAK,KACR,QAAQ,EAAE,MAAM,CAAC,OAAO,IACzB;QAEH,KAAK,WAAW,CAAC,WAAW;YAC1B,uCACK,KAAK,KACR,MAAM,EAAE,YAAY,CAAC,MAAM,IAC5B;QAEH;YACE,OAAO,KAAK,CAAA;KACf;AACH,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,40 @@
1
+ import actionTypes from './actionTypes';
2
+ export declare type HeaderValue = '3' | '';
3
+ export declare type BoldValue = boolean;
4
+ export declare type ItalicValue = boolean;
5
+ export declare type ListValue = 'bullet' | 'ordered' | false;
6
+ export declare type FormatType = {
7
+ bold: BoldValue;
8
+ italic: ItalicValue;
9
+ list: ListValue;
10
+ header: HeaderValue;
11
+ };
12
+ export declare type ToolbarStateType = {
13
+ format: FormatType;
14
+ disabled: boolean;
15
+ };
16
+ export declare type SetBoldActionType = {
17
+ type: typeof actionTypes.bold;
18
+ payload: ToolbarStateType['format']['bold'];
19
+ };
20
+ export declare type SetItalicActionType = {
21
+ type: typeof actionTypes.italic;
22
+ payload: ToolbarStateType['format']['italic'];
23
+ };
24
+ export declare type SetListActionType = {
25
+ type: typeof actionTypes.list;
26
+ payload: ToolbarStateType['format']['list'];
27
+ };
28
+ export declare type SetHeaderActionType = {
29
+ type: typeof actionTypes.header;
30
+ payload: ToolbarStateType['format']['header'];
31
+ };
32
+ export declare type SetDisabled = {
33
+ type: typeof actionTypes.disabled;
34
+ payload: boolean;
35
+ };
36
+ export declare type ResetFormatType = {
37
+ type: typeof actionTypes.resetFormat;
38
+ };
39
+ export declare type ToolbarActionsType = SetBoldActionType | SetItalicActionType | SetListActionType | SetHeaderActionType | SetDisabled | ResetFormatType;
40
+ export declare type ToolbarReducerType = (state: ToolbarStateType | undefined, action: ToolbarActionsType) => ToolbarStateType;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/RichTextEditor/store/toolbar/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ToolbarStateType, ToolbarActionsType } from './toolbar/types';
2
+ export declare type StateType = {
3
+ toolbar: ToolbarStateType;
4
+ };
5
+ export declare type ActionsType = ToolbarActionsType;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/RichTextEditor/store/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { Theme } from '@material-ui/core/styles';
2
+ declare const _default: ({ palette, sizes }: Theme) => import("@material-ui/styles").StyleRules<{}, "disabled" | "error" | "focused" | "editorWrapper">;
3
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import { outline } from '@toptal/picasso-shared';
2
+ import { createStyles } from '@material-ui/core/styles';
3
+ export default ({ palette, sizes }) => createStyles({
4
+ editorWrapper: {
5
+ position: 'relative',
6
+ borderRadius: sizes.borderRadius.small,
7
+ border: `1px solid ${palette.grey.light2}`,
8
+ padding: '0.5em',
9
+ '&:hover:not($disabled):not($error)': {
10
+ borderColor: palette.grey.main2
11
+ }
12
+ },
13
+ disabled: {
14
+ pointerEvents: 'none',
15
+ background: palette.grey.lighter,
16
+ border: `1px solid ${palette.grey.lighter2}`
17
+ },
18
+ error: {
19
+ borderColor: palette.red.main
20
+ },
21
+ focused: Object.assign({ borderColor: palette.grey.main2 }, outline(palette.primary.main))
22
+ });
23
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/RichTextEditor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAS,MAAM,0BAA0B,CAAA;AAE9D,eAAe,CAAC,EAAE,OAAO,EAAE,KAAK,EAAS,EAAE,EAAE,CAC3C,YAAY,CAAC;IACX,aAAa,EAAE;QACb,QAAQ,EAAE,UAAU;QACpB,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK;QACtC,MAAM,EAAE,aAAa,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE;QAC1C,OAAO,EAAE,OAAO;QAEhB,oCAAoC,EAAE;YACpC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;SAChC;KACF;IAED,QAAQ,EAAE;QACR,aAAa,EAAE,MAAM;QACrB,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO;QAChC,MAAM,EAAE,aAAa,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE;KAC7C;IAED,KAAK,EAAE;QACL,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;KAC9B;IAED,OAAO,kBACL,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,IAC5B,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CACjC;CACF,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { ChangeHandler } from '../QuillEditor';
2
+ export declare type RichTextEditorChangeHandler = ChangeHandler;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/RichTextEditor/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { FormatType as EditorFormatType, BoldValue as EditorBoldValue, ItalicValue as EditorItalicValue, ListValue as EditorListValue, HeaderValue as EditorHeaderValue } from '../../QuillEditor';
2
+ import { FormatType as ToolbarFormatType, HeaderValue } from '../store/toolbar';
3
+ export declare const convertBoldFromEditorValue: (bold: EditorBoldValue) => boolean;
4
+ export declare const convertItalicFromEditorValue: (italic: EditorItalicValue) => boolean;
5
+ export declare const convertListFromEditorValue: (list: EditorListValue) => false | "bullet" | "ordered";
6
+ export declare const convertHeaderFromEditorValue: (header: EditorHeaderValue) => "" | "3";
7
+ export declare const getToolbarFormatFromEditorFormat: (format: EditorFormatType) => ToolbarFormatType;
8
+ export declare const convertHeaderToEditorValue: (header: HeaderValue) => EditorHeaderValue;
@@ -0,0 +1,19 @@
1
+ export const convertBoldFromEditorValue = (bold) => bold || false;
2
+ export const convertItalicFromEditorValue = (italic) => italic || false;
3
+ export const convertListFromEditorValue = (list) => list || false;
4
+ export const convertHeaderFromEditorValue = (header) => header ? '3' : '';
5
+ export const getToolbarFormatFromEditorFormat = (format) => {
6
+ return {
7
+ bold: convertBoldFromEditorValue(format.bold),
8
+ italic: convertItalicFromEditorValue(format.italic),
9
+ list: convertListFromEditorValue(format.list),
10
+ header: convertHeaderFromEditorValue(format.header)
11
+ };
12
+ };
13
+ export const convertHeaderToEditorValue = (header) => {
14
+ if (header === '') {
15
+ return undefined;
16
+ }
17
+ return 3;
18
+ };
19
+ //# sourceMappingURL=convertFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertFormat.js","sourceRoot":"","sources":["../../../src/RichTextEditor/utils/convertFormat.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAqB,EAAE,EAAE,CAClE,IAAI,IAAI,KAAK,CAAA;AACf,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,MAAyB,EAAE,EAAE,CACxE,MAAM,IAAI,KAAK,CAAA;AACjB,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAqB,EAAE,EAAE,CAClE,IAAI,IAAI,KAAK,CAAA;AACf,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,MAAyB,EAAE,EAAE,CACxE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;AAEnB,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC9C,MAAwB,EACL,EAAE;IACrB,OAAO;QACL,IAAI,EAAE,0BAA0B,CAAC,MAAM,CAAC,IAAI,CAAC;QAC7C,MAAM,EAAE,4BAA4B,CAAC,MAAM,CAAC,MAAM,CAAC;QACnD,IAAI,EAAE,0BAA0B,CAAC,MAAM,CAAC,IAAI,CAAC;QAC7C,MAAM,EAAE,4BAA4B,CAAC,MAAM,CAAC,MAAM,CAAC;KACpD,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,MAAmB,EACA,EAAE;IACrB,IAAI,MAAM,KAAK,EAAE,EAAE;QACjB,OAAO,SAAS,CAAA;KACjB;IAED,OAAO,CAAC,CAAA;AACV,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { BaseProps } from '@toptal/picasso-shared';
3
+ declare type Props = BaseProps & {
4
+ active: boolean;
5
+ disabled: boolean;
6
+ icon: ReactElement;
7
+ onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
8
+ };
9
+ declare const RichTextEditorButton: {
10
+ (props: Props): JSX.Element;
11
+ defaultProps: {
12
+ active: boolean;
13
+ disabled: boolean;
14
+ onClick: () => void;
15
+ };
16
+ displayName: string;
17
+ };
18
+ export default RichTextEditorButton;
@@ -0,0 +1,38 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React from 'react';
13
+ import cx from 'classnames';
14
+ import { makeStyles } from '@material-ui/core';
15
+ import Button from '../Button';
16
+ import styles from './styles';
17
+ // Using { index: 10 } to inject CSS generated classes after the button's classes
18
+ // in order to prevent Button's styles to override custom TextEditorButton styles
19
+ // Related Jira issue: https://toptal-core.atlassian.net/browse/FX-1520
20
+ const useStyles = makeStyles(styles, {
21
+ name: 'TextEditorButton',
22
+ index: 10
23
+ });
24
+ const RichTextEditorButton = (props) => {
25
+ const { icon, onClick, active, className, style, disabled } = props, rest = __rest(props, ["icon", "onClick", "active", "className", "style", "disabled"]);
26
+ const classes = useStyles(props);
27
+ return (React.createElement(Button.Circular, Object.assign({ variant: 'flat', onClick: onClick, icon: icon, style: style, className: cx(classes.button, {
28
+ [classes.activeButton]: active
29
+ }, className), disabled: disabled }, rest)));
30
+ };
31
+ RichTextEditorButton.defaultProps = {
32
+ active: false,
33
+ disabled: false,
34
+ onClick: () => { }
35
+ };
36
+ RichTextEditorButton.displayName = 'RichTextEditorButton';
37
+ export default RichTextEditorButton;
38
+ //# sourceMappingURL=RichTextEditorButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichTextEditorButton.js","sourceRoot":"","sources":["../../src/RichTextEditorButton/RichTextEditorButton.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAuB,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAS,MAAM,mBAAmB,CAAA;AAGrD,OAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,OAAO,MAAM,MAAM,UAAU,CAAA;AAS7B,iFAAiF;AACjF,iFAAiF;AACjF,uEAAuE;AACvE,MAAM,SAAS,GAAG,UAAU,CAAQ,MAAM,EAAE;IAC1C,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,EAAE;CACV,CAAC,CAAA;AAEF,MAAM,oBAAoB,GAAG,CAAC,KAAY,EAAE,EAAE;IAC5C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAAtE,+DAA8D,CAAQ,CAAA;IAC5E,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;IAEhC,OAAO,CACL,oBAAC,MAAM,CAAC,QAAQ,kBACd,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,EAAE,CACX,OAAO,CAAC,MAAM,EACd;YACE,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM;SAC/B,EACD,SAAS,CACV,EACD,QAAQ,EAAE,QAAQ,IACd,IAAI,EACR,CACH,CAAA;AACH,CAAC,CAAA;AAED,oBAAoB,CAAC,YAAY,GAAG;IAClC,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;CAClB,CAAA;AAED,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAA;AAEzD,eAAe,oBAAoB,CAAA"}
@@ -0,0 +1 @@
1
+ export { default } from './RichTextEditorButton';
@@ -0,0 +1,2 @@
1
+ export { default } from './RichTextEditorButton';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/RichTextEditorButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Theme } from '@material-ui/core/styles';
2
+ declare const _default: ({ palette, sizes }: Theme) => import("@material-ui/styles").StyleRules<{}, "button" | "activeButton">;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { createStyles } from '@material-ui/core/styles';
2
+ export default ({ palette, sizes }) => createStyles({
3
+ button: {
4
+ borderRadius: sizes.borderRadius.small,
5
+ '&+&': {
6
+ marginLeft: '0.5em'
7
+ }
8
+ },
9
+ activeButton: {
10
+ backgroundColor: palette.grey.dark,
11
+ '&:not(:hover) svg': {
12
+ fill: palette.common.white
13
+ }
14
+ }
15
+ });
16
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/RichTextEditorButton/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAS,MAAM,0BAA0B,CAAA;AAE9D,eAAe,CAAC,EAAE,OAAO,EAAE,KAAK,EAAS,EAAE,EAAE,CAC3C,YAAY,CAAC;IACX,MAAM,EAAE;QACN,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK;QAEtC,KAAK,EAAE;YACL,UAAU,EAAE,OAAO;SACpB;KACF;IAED,YAAY,EAAE;QACZ,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;QAElC,mBAAmB,EAAE;YACnB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK;SAC3B;KACF;CACF,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { BaseProps } from '@toptal/picasso-shared';
2
+ declare type Props = BaseProps & {
3
+ message?: string;
4
+ error?: boolean;
5
+ };
6
+ declare const RichTextEditorCounter: {
7
+ ({ message, error, className, style, "data-testid": dataTestId }: Props): JSX.Element;
8
+ displayName: string;
9
+ };
10
+ export default RichTextEditorCounter;