@elliemae/ds-wysiwygeditor 2.2.1 → 2.3.0-alpha.4

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 (69) hide show
  1. package/cjs/DSWYSIWYGEditor.js +83 -72
  2. package/cjs/DSWYSIWYGEditor.js.map +7 -0
  3. package/cjs/components/CustomImageUploader.js +92 -94
  4. package/cjs/components/CustomImageUploader.js.map +7 -0
  5. package/cjs/components/CustomToolbar.js +172 -193
  6. package/cjs/components/CustomToolbar.js.map +7 -0
  7. package/cjs/components/DSWYSIWYGEditorImpl.js +147 -185
  8. package/cjs/components/DSWYSIWYGEditorImpl.js.map +7 -0
  9. package/cjs/components/ImageLibraryModal.js +75 -55
  10. package/cjs/components/ImageLibraryModal.js.map +7 -0
  11. package/cjs/components/InsertFieldModal.js +109 -142
  12. package/cjs/components/InsertFieldModal.js.map +7 -0
  13. package/cjs/components/TippedButton.js +56 -54
  14. package/cjs/components/TippedButton.js.map +7 -0
  15. package/cjs/components/TippedSelect.js +50 -39
  16. package/cjs/components/TippedSelect.js.map +7 -0
  17. package/cjs/components/colors.js +41 -21
  18. package/cjs/components/colors.js.map +7 -0
  19. package/cjs/components/customFields.js +66 -47
  20. package/cjs/components/customFields.js.map +7 -0
  21. package/cjs/constants.js +112 -38
  22. package/cjs/constants.js.map +7 -0
  23. package/cjs/index.js +39 -21
  24. package/cjs/index.js.map +7 -0
  25. package/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +37 -22
  26. package/cjs/quillMatchers/clipboardLinkWithTagMatcher.js.map +7 -0
  27. package/cjs/quillOverrides/IndentStyle.js +41 -19
  28. package/cjs/quillOverrides/IndentStyle.js.map +7 -0
  29. package/cjs/quillOverrides/LinkFormat.js +57 -39
  30. package/cjs/quillOverrides/LinkFormat.js.map +7 -0
  31. package/cjs/quillOverrides/PlainClipboard.js +41 -21
  32. package/cjs/quillOverrides/PlainClipboard.js.map +7 -0
  33. package/cjs/utils.js +41 -18
  34. package/cjs/utils.js.map +7 -0
  35. package/esm/DSWYSIWYGEditor.js +50 -58
  36. package/esm/DSWYSIWYGEditor.js.map +7 -0
  37. package/esm/components/CustomImageUploader.js +60 -81
  38. package/esm/components/CustomImageUploader.js.map +7 -0
  39. package/esm/components/CustomToolbar.js +145 -184
  40. package/esm/components/CustomToolbar.js.map +7 -0
  41. package/esm/components/DSWYSIWYGEditorImpl.js +113 -169
  42. package/esm/components/DSWYSIWYGEditorImpl.js.map +7 -0
  43. package/esm/components/ImageLibraryModal.js +46 -47
  44. package/esm/components/ImageLibraryModal.js.map +7 -0
  45. package/esm/components/InsertFieldModal.js +72 -124
  46. package/esm/components/InsertFieldModal.js.map +7 -0
  47. package/esm/components/TippedButton.js +27 -44
  48. package/esm/components/TippedButton.js.map +7 -0
  49. package/esm/components/TippedSelect.js +21 -31
  50. package/esm/components/TippedSelect.js.map +7 -0
  51. package/esm/components/colors.js +12 -17
  52. package/esm/components/colors.js.map +7 -0
  53. package/esm/components/customFields.js +38 -40
  54. package/esm/components/customFields.js.map +7 -0
  55. package/esm/constants.js +83 -30
  56. package/esm/constants.js.map +7 -0
  57. package/esm/index.js +10 -4
  58. package/esm/index.js.map +7 -0
  59. package/esm/quillMatchers/clipboardLinkWithTagMatcher.js +8 -18
  60. package/esm/quillMatchers/clipboardLinkWithTagMatcher.js.map +7 -0
  61. package/esm/quillOverrides/IndentStyle.js +12 -17
  62. package/esm/quillOverrides/IndentStyle.js.map +7 -0
  63. package/esm/quillOverrides/LinkFormat.js +28 -37
  64. package/esm/quillOverrides/LinkFormat.js.map +7 -0
  65. package/esm/quillOverrides/PlainClipboard.js +12 -19
  66. package/esm/quillOverrides/PlainClipboard.js.map +7 -0
  67. package/esm/utils.js +12 -14
  68. package/esm/utils.js.map +7 -0
  69. package/package.json +9 -9
@@ -1,101 +1,71 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/esnext.async-iterator.map.js';
3
- import 'core-js/modules/esnext.iterator.map.js';
4
- import 'core-js/modules/es.string.replace.js';
5
- import 'core-js/modules/web.dom-collections.iterator.js';
6
- import { useState } from 'react';
7
- import DSButton from '@elliemae/ds-button';
8
- import { ArrowheadDown } from '@elliemae/ds-icons';
9
- import DSDropdownMenu from '@elliemae/ds-dropdownmenu';
10
- import { fonts, sizes, sizesReal, colors } from '../constants.js';
11
- import { TippedButton } from './TippedButton.js';
12
- import { TippedSelect } from './TippedSelect.js';
13
- import { jsxs, Fragment } from 'react/jsx-runtime';
14
-
15
- var _span, _ArrowheadDown, _Divider, _Divider2, _Divider3, _Divider4, _Divider5, _Divider6, _Divider7, _Divider8, _Divider9, _CustomFields, _Divider10;
16
-
17
- const optionsToValues = options => options.map(opt => opt.toLowerCase().replace(' ', '-')); // Stateless Components -----------------------------------------
18
-
19
-
20
- const CustomFields = () => _span || (_span = /*#__PURE__*/_jsx("span", {}, void 0, "\u1438\u1433")); // eslint-disable-line react/jsx-one-expression-per-line
21
-
22
-
23
- const Color = _ref => {
24
- let {
25
- color
26
- } = _ref;
27
- return /*#__PURE__*/_jsx("option", {
28
- value: color
29
- });
30
- };
31
-
32
- const Colors = _ref2 => {
33
- let {
34
- className,
35
- tip,
36
- zIndex
37
- } = _ref2;
38
- return /*#__PURE__*/_jsx(TippedSelect, {
39
- className: className,
40
- tip: tip,
41
- zIndex: zIndex
42
- }, void 0, colors.map(color => /*#__PURE__*/_jsx(Color, {
43
- color: color
44
- }, color)));
45
- };
46
-
47
- const CustomDropdown = _ref3 => {
48
- let {
49
- options,
50
- label,
51
- onSelectMenuItem = () => null,
52
- onClickOutsideMenu = () => null,
53
- onClose = () => null,
54
- closeMenuOnItemSelection,
55
- isOpen,
56
- minWidth,
57
- maxWidth,
58
- zIndex = 10
59
- } = _ref3;
60
- return /*#__PURE__*/_jsx(DSDropdownMenu, {
61
- onClickOutsideMenu: onClickOutsideMenu,
62
- options: options,
63
- onSelectMenuItem: onSelectMenuItem,
64
- onClose: onClose,
65
- closeMenuOnItemSelection: closeMenuOnItemSelection,
66
- isOpen: isOpen,
67
- minWidth: minWidth,
68
- maxWidth: maxWidth,
69
- zIndex: zIndex,
70
- preventOverflow: "scrollParent",
71
- triggerComponent: /*#__PURE__*/_jsx(DSButton, {
72
- labelText: label,
73
- buttonType: "text",
74
- icon: _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx(ArrowheadDown, {}))
75
- })
76
- });
77
- };
78
-
79
- const Divider = () => /*#__PURE__*/_jsx("div", {
1
+ import * as React from "react";
2
+ import React2, { useState } from "react";
3
+ import DSButton from "@elliemae/ds-button";
4
+ import { ArrowheadDown } from "@elliemae/ds-icons";
5
+ import DSDropdownMenu from "@elliemae/ds-dropdownmenu";
6
+ import { colors, fonts, sizes, sizesReal } from "../constants";
7
+ import { TippedButton } from "./TippedButton";
8
+ import { TippedSelect } from "./TippedSelect";
9
+ const optionsToValues = (options) => options.map((opt) => opt.toLowerCase().replace(" ", "-"));
10
+ const CustomFields = () => /* @__PURE__ */ React2.createElement("span", null, "\u1438\u1433");
11
+ const Color = ({ color }) => /* @__PURE__ */ React2.createElement("option", {
12
+ value: color
13
+ });
14
+ const Colors = ({ className, tip, zIndex }) => /* @__PURE__ */ React2.createElement(TippedSelect, {
15
+ className,
16
+ tip,
17
+ zIndex
18
+ }, colors.map((color) => /* @__PURE__ */ React2.createElement(Color, {
19
+ key: color,
20
+ color
21
+ })));
22
+ const CustomDropdown = ({
23
+ options,
24
+ label,
25
+ onSelectMenuItem = () => null,
26
+ onClickOutsideMenu = () => null,
27
+ onClose = () => null,
28
+ closeMenuOnItemSelection,
29
+ isOpen,
30
+ minWidth,
31
+ maxWidth,
32
+ zIndex = 10
33
+ }) => /* @__PURE__ */ React2.createElement(DSDropdownMenu, {
34
+ onClickOutsideMenu,
35
+ options,
36
+ onSelectMenuItem,
37
+ onClose,
38
+ closeMenuOnItemSelection,
39
+ isOpen,
40
+ minWidth,
41
+ maxWidth,
42
+ zIndex,
43
+ preventOverflow: "scrollParent",
44
+ triggerComponent: /* @__PURE__ */ React2.createElement(DSButton, {
45
+ labelText: label,
46
+ buttonType: "text",
47
+ icon: /* @__PURE__ */ React2.createElement(ArrowheadDown, null)
48
+ })
49
+ });
50
+ const Divider = () => /* @__PURE__ */ React2.createElement("div", {
80
51
  style: {
81
- height: '21px',
82
- width: '1px',
83
- margin: '0 10px',
84
- padding: '0',
85
- borderLeft: '1px solid #bbb',
86
- display: 'inline-block'
52
+ height: "21px",
53
+ width: "1px",
54
+ margin: "0 10px",
55
+ padding: "0",
56
+ borderLeft: "1px solid #bbb",
57
+ display: "inline-block"
87
58
  }
88
59
  });
89
-
90
- const CustomToolbar = _ref4 => {
91
- let {
92
- customFields,
93
- customItems = [],
94
- hideItems = {},
95
- onShowHTML = () => {},
96
- id = 'toolbar',
97
- userProps
98
- } = _ref4;
60
+ const CustomToolbar = ({
61
+ customFields,
62
+ customItems = [],
63
+ hideItems = {},
64
+ onShowHTML = () => {
65
+ },
66
+ id = "toolbar",
67
+ userProps
68
+ }) => {
99
69
  const {
100
70
  HEADER,
101
71
  FONT,
@@ -119,153 +89,144 @@ const CustomToolbar = _ref4 => {
119
89
  SHOW_HTML
120
90
  } = hideItems;
121
91
  const [showHTML, setShowHTML] = useState(false);
122
-
123
- const handleShowHTML = e => {
92
+ const handleShowHTML = (e) => {
124
93
  e.preventDefault();
125
94
  setShowHTML(!showHTML);
126
95
  onShowHTML();
127
96
  };
128
-
129
- return /*#__PURE__*/_jsx("div", {
130
- id: id,
97
+ return /* @__PURE__ */ React2.createElement("div", {
98
+ id,
131
99
  className: "ds-ql-custom-toolbar"
132
- }, void 0, (!HEADER || !FONT || !FONT_SIZE) && /*#__PURE__*/_jsx("span", {
100
+ }, (!HEADER || !FONT || !FONT_SIZE) && /* @__PURE__ */ React2.createElement("span", {
133
101
  className: "ql-formats"
134
- }, void 0, !HEADER && /*#__PURE__*/jsxs(Fragment, {
135
- children: [/*#__PURE__*/_jsx(TippedSelect, {
136
- className: "ql-header",
137
- tip: "Header",
138
- values: ['', '1', '2', '3', '4', '5', '6'],
139
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1
140
- }), _Divider || (_Divider = /*#__PURE__*/_jsx(Divider, {}))]
141
- }), !FONT && /*#__PURE__*/jsxs(Fragment, {
142
- children: [/*#__PURE__*/_jsx(TippedSelect, {
143
- className: "ql-font",
144
- defaultValue: "sans-serif",
145
- options: fonts,
146
- tip: "Font",
147
- values: optionsToValues(fonts),
148
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1
149
- }), _Divider2 || (_Divider2 = /*#__PURE__*/_jsx(Divider, {}))]
150
- }), !FONT_SIZE && /*#__PURE__*/jsxs(Fragment, {
151
- children: [/*#__PURE__*/_jsx(TippedSelect, {
152
- className: "ql-size",
153
- options: sizes,
154
- tip: "Font Size",
155
- values: optionsToValues(sizesReal),
156
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1
157
- }), _Divider3 || (_Divider3 = /*#__PURE__*/_jsx(Divider, {}))]
158
- })), (!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && /*#__PURE__*/_jsx("span", {
102
+ }, !HEADER && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(TippedSelect, {
103
+ className: "ql-header",
104
+ tip: "Header",
105
+ values: ["", "1", "2", "3", "4", "5", "6"],
106
+ zIndex: userProps?.zIndex || 1
107
+ }), /* @__PURE__ */ React2.createElement(Divider, null)), !FONT && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(TippedSelect, {
108
+ className: "ql-font",
109
+ defaultValue: "sans-serif",
110
+ options: fonts,
111
+ tip: "Font",
112
+ values: optionsToValues(fonts),
113
+ zIndex: userProps?.zIndex || 1
114
+ }), /* @__PURE__ */ React2.createElement(Divider, null)), !FONT_SIZE && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(TippedSelect, {
115
+ className: "ql-size",
116
+ options: sizes,
117
+ tip: "Font Size",
118
+ values: optionsToValues(sizesReal),
119
+ zIndex: userProps?.zIndex || 1
120
+ }), /* @__PURE__ */ React2.createElement(Divider, null))), (!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && /* @__PURE__ */ React2.createElement("span", {
159
121
  className: "ql-formats"
160
- }, void 0, !BOLD && /*#__PURE__*/_jsx(TippedButton, {
161
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
122
+ }, !BOLD && /* @__PURE__ */ React2.createElement(TippedButton, {
123
+ zIndex: userProps?.zIndex || 1,
162
124
  className: "ql-bold",
163
125
  tip: "Bold"
164
- }), !ITALIC && /*#__PURE__*/_jsx(TippedButton, {
165
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
126
+ }), !ITALIC && /* @__PURE__ */ React2.createElement(TippedButton, {
127
+ zIndex: userProps?.zIndex || 1,
166
128
  className: "ql-italic",
167
129
  tip: "Italic"
168
- }), !UNDERLINE && /*#__PURE__*/_jsx(TippedButton, {
169
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
130
+ }), !UNDERLINE && /* @__PURE__ */ React2.createElement(TippedButton, {
131
+ zIndex: userProps?.zIndex || 1,
170
132
  className: "ql-underline",
171
133
  tip: "Underline"
172
- }), !STRIKE && /*#__PURE__*/_jsx(TippedButton, {
173
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
134
+ }), !STRIKE && /* @__PURE__ */ React2.createElement(TippedButton, {
135
+ zIndex: userProps?.zIndex || 1,
174
136
  className: "ql-strike",
175
137
  tip: "Strike"
176
- })), (!SUB || !SUPER) && /*#__PURE__*/_jsx("span", {
138
+ })), (!SUB || !SUPER) && /* @__PURE__ */ React2.createElement("span", {
177
139
  className: "ql-formats"
178
- }, void 0, !SUB && /*#__PURE__*/_jsx(TippedButton, {
179
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
140
+ }, !SUB && /* @__PURE__ */ React2.createElement(TippedButton, {
141
+ zIndex: userProps?.zIndex || 1,
180
142
  className: "ql-script",
181
143
  tip: "Sub",
182
144
  value: "sub"
183
- }), !SUPER && /*#__PURE__*/_jsx(TippedButton, {
184
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
145
+ }), !SUPER && /* @__PURE__ */ React2.createElement(TippedButton, {
146
+ zIndex: userProps?.zIndex || 1,
185
147
  className: "ql-script",
186
148
  tip: "Super",
187
149
  value: "super"
188
- }), _Divider4 || (_Divider4 = /*#__PURE__*/_jsx(Divider, {}))), (!ORDERED_LIST || !BULLET_LIST) && /*#__PURE__*/_jsx("span", {
150
+ }), /* @__PURE__ */ React2.createElement(Divider, null)), (!ORDERED_LIST || !BULLET_LIST) && /* @__PURE__ */ React2.createElement("span", {
189
151
  className: "ql-formats"
190
- }, void 0, !ORDERED_LIST && /*#__PURE__*/_jsx(TippedButton, {
191
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
152
+ }, !ORDERED_LIST && /* @__PURE__ */ React2.createElement(TippedButton, {
153
+ zIndex: userProps?.zIndex || 1,
192
154
  className: "ql-list",
193
155
  tip: "Ordered List",
194
156
  value: "ordered"
195
- }), !BULLET_LIST && /*#__PURE__*/_jsx(TippedButton, {
196
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
157
+ }), !BULLET_LIST && /* @__PURE__ */ React2.createElement(TippedButton, {
158
+ zIndex: userProps?.zIndex || 1,
197
159
  className: "ql-list",
198
160
  tip: "Bullet List",
199
161
  value: "bullet"
200
- })), (!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && /*#__PURE__*/_jsx("span", {
162
+ })), (!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && /* @__PURE__ */ React2.createElement("span", {
201
163
  className: "ql-formats"
202
- }, void 0, !INDENT_MINUS_ONE && /*#__PURE__*/_jsx(TippedButton, {
203
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
164
+ }, !INDENT_MINUS_ONE && /* @__PURE__ */ React2.createElement(TippedButton, {
165
+ zIndex: userProps?.zIndex || 1,
204
166
  className: "ql-indent",
205
167
  tip: "Indent -1",
206
168
  value: "-1"
207
- }), !INDENT_PLUS_ONE && /*#__PURE__*/_jsx(TippedButton, {
208
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
169
+ }), !INDENT_PLUS_ONE && /* @__PURE__ */ React2.createElement(TippedButton, {
170
+ zIndex: userProps?.zIndex || 1,
209
171
  className: "ql-indent",
210
172
  tip: "Indent +1",
211
173
  value: "+1"
212
- })), !ALIGN && /*#__PURE__*/_jsx("span", {
174
+ })), !ALIGN && /* @__PURE__ */ React2.createElement("span", {
213
175
  className: "ql-formats"
214
- }, void 0, /*#__PURE__*/_jsx(TippedSelect, {
215
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
176
+ }, /* @__PURE__ */ React2.createElement(TippedSelect, {
177
+ zIndex: userProps?.zIndex || 1,
216
178
  className: "ql-align",
217
179
  tip: "Align"
218
- }), _Divider5 || (_Divider5 = /*#__PURE__*/_jsx(Divider, {}))), (!FONT_COLOR || !FONT_BACKGROUND_COLOR) && /*#__PURE__*/_jsx("span", {
180
+ }), /* @__PURE__ */ React2.createElement(Divider, null)), (!FONT_COLOR || !FONT_BACKGROUND_COLOR) && /* @__PURE__ */ React2.createElement("span", {
219
181
  className: "ql-formats"
220
- }, void 0, !FONT_COLOR && /*#__PURE__*/_jsx(Colors, {
221
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
182
+ }, !FONT_COLOR && /* @__PURE__ */ React2.createElement(Colors, {
183
+ zIndex: userProps?.zIndex || 1,
222
184
  className: "ql-color",
223
185
  tip: "Font Color"
224
- }), !FONT_BACKGROUND_COLOR && /*#__PURE__*/_jsx(Colors, {
225
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
186
+ }), !FONT_BACKGROUND_COLOR && /* @__PURE__ */ React2.createElement(Colors, {
187
+ zIndex: userProps?.zIndex || 1,
226
188
  className: "ql-background",
227
189
  tip: "Font Background Color"
228
- }), _Divider6 || (_Divider6 = /*#__PURE__*/_jsx(Divider, {}))), (!HYPERLINK || !IMAGE) && /*#__PURE__*/_jsx("span", {
190
+ }), /* @__PURE__ */ React2.createElement(Divider, null)), (!HYPERLINK || !IMAGE) && /* @__PURE__ */ React2.createElement("span", {
229
191
  className: "ql-formats"
230
- }, void 0, !HYPERLINK && /*#__PURE__*/_jsx(TippedButton, {
231
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
192
+ }, !HYPERLINK && /* @__PURE__ */ React2.createElement(TippedButton, {
193
+ zIndex: userProps?.zIndex || 1,
232
194
  className: "ql-link",
233
195
  tip: "Hyperlink: Select Text First"
234
- }), !IMAGE && /*#__PURE__*/_jsx(TippedButton, {
235
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
196
+ }), !IMAGE && /* @__PURE__ */ React2.createElement(TippedButton, {
197
+ zIndex: userProps?.zIndex || 1,
236
198
  className: "ql-image",
237
199
  tip: "Insert Image"
238
- }), _Divider7 || (_Divider7 = /*#__PURE__*/_jsx(Divider, {}))), !CLEAR_FORMAT && /*#__PURE__*/_jsx("span", {
200
+ }), /* @__PURE__ */ React2.createElement(Divider, null)), !CLEAR_FORMAT && /* @__PURE__ */ React2.createElement("span", {
239
201
  className: "ql-formats"
240
- }, void 0, /*#__PURE__*/_jsx(TippedButton, {
241
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
202
+ }, /* @__PURE__ */ React2.createElement(TippedButton, {
203
+ zIndex: userProps?.zIndex || 1,
242
204
  className: "ql-clean",
243
205
  tip: "Clear Format (Select Text)"
244
- })), !SHOW_HTML && /*#__PURE__*/_jsx("span", {
206
+ })), !SHOW_HTML && /* @__PURE__ */ React2.createElement("span", {
245
207
  className: "ql-formats"
246
- }, void 0, _Divider8 || (_Divider8 = /*#__PURE__*/_jsx(Divider, {})), /*#__PURE__*/_jsx(TippedButton, {
247
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
208
+ }, /* @__PURE__ */ React2.createElement(Divider, null), /* @__PURE__ */ React2.createElement(TippedButton, {
209
+ zIndex: userProps?.zIndex || 1,
248
210
  style: {
249
- width: 'fit-content',
250
- color: '#1e79c2',
251
- fontWeight: '500'
211
+ width: "fit-content",
212
+ color: "#1e79c2",
213
+ fontWeight: "500"
252
214
  },
253
215
  onClick: handleShowHTML,
254
- tip: showHTML ? 'SHOW TEXT' : 'SHOW HTML',
216
+ tip: showHTML ? "SHOW TEXT" : "SHOW HTML",
255
217
  className: "ql-customFields-html"
256
- }, void 0, showHTML ? 'SHOW TEXT' : 'SHOW HTML')), customFields && /*#__PURE__*/_jsx("span", {
218
+ }, showHTML ? "SHOW TEXT" : "SHOW HTML")), customFields && /* @__PURE__ */ React2.createElement("span", {
257
219
  className: "ql-formats"
258
- }, void 0, _Divider9 || (_Divider9 = /*#__PURE__*/_jsx(Divider, {})), /*#__PURE__*/_jsx(TippedButton, {
259
- zIndex: (userProps === null || userProps === void 0 ? void 0 : userProps.zIndex) || 1,
220
+ }, /* @__PURE__ */ React2.createElement(Divider, null), /* @__PURE__ */ React2.createElement(TippedButton, {
221
+ zIndex: userProps?.zIndex || 1,
260
222
  className: "ql-customFields",
261
223
  tip: "Insert Custom Field"
262
- }, void 0, _CustomFields || (_CustomFields = /*#__PURE__*/_jsx(CustomFields, {})))), customItems && /*#__PURE__*/_jsx("span", {
263
- style: {
264
- display: 'inline-flex'
265
- }
266
- }, void 0, customItems.map(Item => /*#__PURE__*/jsxs(Fragment, {
267
- children: [_Divider10 || (_Divider10 = /*#__PURE__*/_jsx(Divider, {})), /*#__PURE__*/_jsx(Item, {})]
268
- }))));
224
+ }, /* @__PURE__ */ React2.createElement(CustomFields, null))), customItems && /* @__PURE__ */ React2.createElement("span", {
225
+ style: { display: "inline-flex" }
226
+ }, customItems.map((Item) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Divider, null), /* @__PURE__ */ React2.createElement(Item, null)))));
227
+ };
228
+ export {
229
+ CustomDropdown,
230
+ CustomToolbar
269
231
  };
270
-
271
- export { CustomDropdown, CustomToolbar };
232
+ //# sourceMappingURL=CustomToolbar.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/CustomToolbar.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/control-has-associated-label */\n/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\n/* eslint-disable react/button-has-type */\nimport React, { useState } from 'react';\nimport DSButton from '@elliemae/ds-button';\nimport { ArrowheadDown } from '@elliemae/ds-icons';\nimport DSDropdownMenu from '@elliemae/ds-dropdownmenu';\nimport { colors, fonts, sizes, sizesReal } from '../constants';\nimport { TippedButton } from './TippedButton';\nimport { TippedSelect } from './TippedSelect';\n\n// Functions -----------------------------------------\nconst optionsToValues = (options) => options.map((opt) => opt.toLowerCase().replace(' ', '-'));\n\n// Stateless Components -----------------------------------------\n\nconst CustomFields = () => <span>\u1438\u1433</span>; // eslint-disable-line react/jsx-one-expression-per-line\nconst Color = ({ color }) => <option value={color} />;\nconst Colors = ({ className, tip, zIndex }) => (\n <TippedSelect className={className} tip={tip} zIndex={zIndex}>\n {colors.map((color) => (\n <Color key={color} color={color} />\n ))}\n </TippedSelect>\n);\n\nexport const CustomDropdown = ({\n options,\n label,\n onSelectMenuItem = () => null,\n onClickOutsideMenu = () => null,\n onClose = () => null,\n closeMenuOnItemSelection,\n isOpen,\n minWidth,\n maxWidth,\n zIndex = 10,\n}) => (\n <DSDropdownMenu\n onClickOutsideMenu={onClickOutsideMenu}\n options={options}\n onSelectMenuItem={onSelectMenuItem}\n onClose={onClose}\n closeMenuOnItemSelection={closeMenuOnItemSelection}\n isOpen={isOpen}\n minWidth={minWidth}\n maxWidth={maxWidth}\n zIndex={zIndex}\n preventOverflow=\"scrollParent\"\n triggerComponent={<DSButton labelText={label} buttonType=\"text\" icon={<ArrowheadDown />} />}\n />\n);\n\nconst Divider = () => (\n <div\n style={{\n height: '21px',\n width: '1px',\n margin: '0 10px',\n padding: '0',\n borderLeft: '1px solid #bbb',\n display: 'inline-block',\n }}\n ></div>\n);\n\nexport const CustomToolbar = ({\n customFields,\n customItems = [],\n hideItems = {},\n onShowHTML = () => {},\n id = 'toolbar',\n userProps,\n}) => {\n const {\n HEADER,\n FONT,\n FONT_SIZE,\n BOLD,\n ITALIC,\n UNDERLINE,\n STRIKE,\n SUB,\n SUPER,\n ORDERED_LIST,\n BULLET_LIST,\n INDENT_MINUS_ONE,\n INDENT_PLUS_ONE,\n ALIGN,\n FONT_COLOR,\n FONT_BACKGROUND_COLOR,\n HYPERLINK,\n IMAGE,\n CLEAR_FORMAT,\n SHOW_HTML,\n } = hideItems;\n const [showHTML, setShowHTML] = useState(false);\n\n const handleShowHTML = (e) => {\n e.preventDefault();\n setShowHTML(!showHTML);\n onShowHTML();\n };\n\n return (\n <div id={id} className=\"ds-ql-custom-toolbar\">\n {(!HEADER || !FONT || !FONT_SIZE) && (\n <span className=\"ql-formats\">\n {!HEADER && (\n <>\n <TippedSelect\n className=\"ql-header\"\n tip=\"Header\"\n values={['', '1', '2', '3', '4', '5', '6']}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n {!FONT && (\n <>\n <TippedSelect\n className=\"ql-font\"\n defaultValue=\"sans-serif\"\n options={fonts}\n tip=\"Font\"\n values={optionsToValues(fonts)}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n {!FONT_SIZE && (\n <>\n <TippedSelect\n className=\"ql-size\"\n options={sizes}\n tip=\"Font Size\"\n values={optionsToValues(sizesReal)}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n </span>\n )}\n {(!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && (\n <span className=\"ql-formats\">\n {!BOLD && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-bold\" tip=\"Bold\" />}\n {!ITALIC && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-italic\" tip=\"Italic\" />}\n {!UNDERLINE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-underline\" tip=\"Underline\" />}\n {!STRIKE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-strike\" tip=\"Strike\" />}\n </span>\n )}\n {(!SUB || !SUPER) && (\n <span className=\"ql-formats\">\n {!SUB && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-script\" tip=\"Sub\" value=\"sub\" />}\n {!SUPER && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-script\" tip=\"Super\" value=\"super\" />}\n <Divider />\n </span>\n )}\n {(!ORDERED_LIST || !BULLET_LIST) && (\n <span className=\"ql-formats\">\n {!ORDERED_LIST && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-list\" tip=\"Ordered List\" value=\"ordered\" />\n )}\n {!BULLET_LIST && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-list\" tip=\"Bullet List\" value=\"bullet\" />\n )}\n </span>\n )}\n {(!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && (\n <span className=\"ql-formats\">\n {!INDENT_MINUS_ONE && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-indent\" tip=\"Indent -1\" value=\"-1\" />\n )}\n {!INDENT_PLUS_ONE && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-indent\" tip=\"Indent +1\" value=\"+1\" />\n )}\n </span>\n )}\n {!ALIGN && (\n <span className=\"ql-formats\">\n <TippedSelect zIndex={userProps?.zIndex || 1} className=\"ql-align\" tip=\"Align\" />\n <Divider />\n </span>\n )}\n {(!FONT_COLOR || !FONT_BACKGROUND_COLOR) && (\n <span className=\"ql-formats\">\n {!FONT_COLOR && <Colors zIndex={userProps?.zIndex || 1} className=\"ql-color\" tip=\"Font Color\" />}\n {!FONT_BACKGROUND_COLOR && (\n <Colors zIndex={userProps?.zIndex || 1} className=\"ql-background\" tip=\"Font Background Color\" />\n )}\n <Divider />\n </span>\n )}\n {(!HYPERLINK || !IMAGE) && (\n <span className=\"ql-formats\">\n {!HYPERLINK && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-link\" tip=\"Hyperlink: Select Text First\" />\n )}\n {!IMAGE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-image\" tip=\"Insert Image\" />}\n <Divider />\n </span>\n )}\n {!CLEAR_FORMAT && (\n <span className=\"ql-formats\">\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-clean\" tip=\"Clear Format (Select Text)\" />\n </span>\n )}\n {!SHOW_HTML && (\n <span className=\"ql-formats\">\n <Divider />\n <TippedButton\n zIndex={userProps?.zIndex || 1}\n style={{\n width: 'fit-content',\n color: '#1e79c2',\n fontWeight: '500',\n }}\n onClick={handleShowHTML}\n tip={showHTML ? 'SHOW TEXT' : 'SHOW HTML'}\n className=\"ql-customFields-html\"\n >\n {showHTML ? 'SHOW TEXT' : 'SHOW HTML'}\n </TippedButton>\n </span>\n )}\n {customFields && (\n <span className=\"ql-formats\">\n <Divider />\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-customFields\" tip=\"Insert Custom Field\">\n <CustomFields />\n </TippedButton>\n </span>\n )}\n {customItems && (\n <span style={{ display: 'inline-flex' }}>\n {customItems.map((Item) => (\n <>\n <Divider />\n <Item />\n </>\n ))}\n </span>\n )}\n </div>\n );\n};\n"],
5
+ "mappings": "AAAA;ACMA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,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