@ballistix.digital/react-components 8.3.2-rc-94.0 → 8.3.2-rc-96.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.
- package/dist/index.d.ts +56 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +426 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +424 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -1
package/dist/index.js
CHANGED
|
@@ -25,6 +25,10 @@ var $iA2ta$lodashset = require("lodash/set");
|
|
|
25
25
|
var $iA2ta$luxon = require("luxon");
|
|
26
26
|
var $iA2ta$ballistixdigitalreacttailwindcssdatepicker = require("@ballistix.digital/react-tailwindcss-datepicker");
|
|
27
27
|
var $iA2ta$formik = require("formik");
|
|
28
|
+
var $iA2ta$ishotkey = require("is-hotkey");
|
|
29
|
+
var $iA2ta$slate = require("slate");
|
|
30
|
+
var $iA2ta$slatehistory = require("slate-history");
|
|
31
|
+
var $iA2ta$slatereact = require("slate-react");
|
|
28
32
|
var $iA2ta$reactdropzone = require("react-dropzone");
|
|
29
33
|
var $iA2ta$ubilabsreactgeosuggest = require("@ubilabs/react-geosuggest");
|
|
30
34
|
|
|
@@ -90,6 +94,7 @@ $parcel$export(module.exports, "DateRangeMenuForm", () => $7d3977a96c400c32$expo
|
|
|
90
94
|
$parcel$export(module.exports, "__DEPRECATED__CheckboxInputGroupForm", () => $03635ab4c6dbf412$export$2e2bcd8739ae039);
|
|
91
95
|
$parcel$export(module.exports, "CheckboxInput", () => $831573d0f77f2d6b$export$2e2bcd8739ae039);
|
|
92
96
|
$parcel$export(module.exports, "SwitchForm", () => $341e1fbf5ffaef7b$export$2e2bcd8739ae039);
|
|
97
|
+
$parcel$export(module.exports, "RichTextArea", () => $784e2eeeb6b1d65b$export$2e2bcd8739ae039);
|
|
93
98
|
$parcel$export(module.exports, "FileInputGroupForm", () => $079d45c48b1515dd$export$2e2bcd8739ae039);
|
|
94
99
|
$parcel$export(module.exports, "OpeningsHourInputGroupForm", () => $9f6cfd21b337aca9$export$2e2bcd8739ae039);
|
|
95
100
|
$parcel$export(module.exports, "AddressInputGroupForm", () => $7fcfa1d90c4a7e45$export$2e2bcd8739ae039);
|
|
@@ -6202,6 +6207,425 @@ var $341e1fbf5ffaef7b$export$2e2bcd8739ae039 = $341e1fbf5ffaef7b$var$Switch;
|
|
|
6202
6207
|
|
|
6203
6208
|
|
|
6204
6209
|
|
|
6210
|
+
|
|
6211
|
+
|
|
6212
|
+
|
|
6213
|
+
var $b964d0845ae86974$var$base = {
|
|
6214
|
+
container: 'border border-input rounded-lg overflow-hidden border-palette-lightGray',
|
|
6215
|
+
editor: {
|
|
6216
|
+
toolbar: {
|
|
6217
|
+
container: 'flex items-center gap-1 p-2 border-b border-border',
|
|
6218
|
+
button: 'h-6 w-6 text-[18px] hover:bg-gray-50 active:bg-gray-100 cursor-pointer rounded-sm',
|
|
6219
|
+
buttonActive: 'ring-2 ring-gray-900/10 bg-gray-100',
|
|
6220
|
+
icon: 'h-4! w-4!',
|
|
6221
|
+
divider: 'w-px h-6 bg-gray-200 mx-1'
|
|
6222
|
+
},
|
|
6223
|
+
area: {
|
|
6224
|
+
container: 'overflow-hidden p-4',
|
|
6225
|
+
editable: 'leading-7 focus:outline-none prose prose-sm max-w-none prose-headings:font-semibold prose-h1:text-2xl prose-h2:text-xl prose-p:my-3 prose-blockquote:my-3'
|
|
6226
|
+
}
|
|
6227
|
+
},
|
|
6228
|
+
elements: {
|
|
6229
|
+
blockquote: 'border-l-4 border-gray-300 pl-4 italic text-gray-600 bg-gray-50 rounded-r-md py-2 my-2',
|
|
6230
|
+
list: {
|
|
6231
|
+
bulleted: 'list-disc ml-6 space-y-1',
|
|
6232
|
+
numbered: 'list-decimal ml-6 space-y-1',
|
|
6233
|
+
item: ''
|
|
6234
|
+
},
|
|
6235
|
+
heading: {
|
|
6236
|
+
h1: 'text-2xl font-semibold tracking-tight',
|
|
6237
|
+
h2: 'text-xl font-semibold tracking-tight'
|
|
6238
|
+
},
|
|
6239
|
+
paragraph: '',
|
|
6240
|
+
code: 'px-1.5 py-0.5 rounded-md bg-gray-100 text-gray-800 font-mono text-[0.85em]'
|
|
6241
|
+
},
|
|
6242
|
+
align: {
|
|
6243
|
+
left: 'text-left',
|
|
6244
|
+
center: 'text-center',
|
|
6245
|
+
right: 'text-right',
|
|
6246
|
+
justify: 'text-justify'
|
|
6247
|
+
},
|
|
6248
|
+
readOnly: {
|
|
6249
|
+
container: ''
|
|
6250
|
+
}
|
|
6251
|
+
};
|
|
6252
|
+
var $b964d0845ae86974$var$styles = $b964d0845ae86974$var$base;
|
|
6253
|
+
var $b964d0845ae86974$export$2e2bcd8739ae039 = $b964d0845ae86974$var$styles;
|
|
6254
|
+
|
|
6255
|
+
|
|
6256
|
+
var $784e2eeeb6b1d65b$var$__assign = undefined && undefined.__assign || function() {
|
|
6257
|
+
$784e2eeeb6b1d65b$var$__assign = Object.assign || function(t) {
|
|
6258
|
+
for(var s, i = 1, n = arguments.length; i < n; i++){
|
|
6259
|
+
s = arguments[i];
|
|
6260
|
+
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6261
|
+
}
|
|
6262
|
+
return t;
|
|
6263
|
+
};
|
|
6264
|
+
return $784e2eeeb6b1d65b$var$__assign.apply(this, arguments);
|
|
6265
|
+
};
|
|
6266
|
+
var $784e2eeeb6b1d65b$var$HOTKEYS = {
|
|
6267
|
+
'mod+b': 'bold',
|
|
6268
|
+
'mod+i': 'italic',
|
|
6269
|
+
'mod+u': 'underline',
|
|
6270
|
+
'mod+`': 'code'
|
|
6271
|
+
};
|
|
6272
|
+
var $784e2eeeb6b1d65b$var$LIST_TYPES = [
|
|
6273
|
+
'numbered-list',
|
|
6274
|
+
'bulleted-list'
|
|
6275
|
+
];
|
|
6276
|
+
var $784e2eeeb6b1d65b$var$TEXT_ALIGN_TYPES = [
|
|
6277
|
+
'left',
|
|
6278
|
+
'center',
|
|
6279
|
+
'right',
|
|
6280
|
+
'justify'
|
|
6281
|
+
];
|
|
6282
|
+
var $784e2eeeb6b1d65b$var$TAG_BY_TYPE = {
|
|
6283
|
+
'block-quote': 'blockquote',
|
|
6284
|
+
'bulleted-list': 'ul',
|
|
6285
|
+
'numbered-list': 'ol',
|
|
6286
|
+
'heading-one': 'h1',
|
|
6287
|
+
'heading-two': 'h2',
|
|
6288
|
+
'list-item': 'li',
|
|
6289
|
+
paragraph: 'p'
|
|
6290
|
+
};
|
|
6291
|
+
var $784e2eeeb6b1d65b$var$CLASS_BY_TYPE = {
|
|
6292
|
+
'block-quote': (0, $b964d0845ae86974$export$2e2bcd8739ae039).elements.blockquote,
|
|
6293
|
+
'bulleted-list': (0, $b964d0845ae86974$export$2e2bcd8739ae039).elements.list.bulleted,
|
|
6294
|
+
'numbered-list': (0, $b964d0845ae86974$export$2e2bcd8739ae039).elements.list.numbered,
|
|
6295
|
+
'heading-one': (0, $b964d0845ae86974$export$2e2bcd8739ae039).elements.heading.h1,
|
|
6296
|
+
'heading-two': (0, $b964d0845ae86974$export$2e2bcd8739ae039).elements.heading.h2,
|
|
6297
|
+
'list-item': (0, $b964d0845ae86974$export$2e2bcd8739ae039).elements.list.item,
|
|
6298
|
+
paragraph: (0, $b964d0845ae86974$export$2e2bcd8739ae039).elements.paragraph
|
|
6299
|
+
};
|
|
6300
|
+
var $784e2eeeb6b1d65b$var$isAlignType = function(format) {
|
|
6301
|
+
return $784e2eeeb6b1d65b$var$TEXT_ALIGN_TYPES.includes(format);
|
|
6302
|
+
};
|
|
6303
|
+
var $784e2eeeb6b1d65b$var$isListType = function(format) {
|
|
6304
|
+
return $784e2eeeb6b1d65b$var$LIST_TYPES.includes(format);
|
|
6305
|
+
};
|
|
6306
|
+
var $784e2eeeb6b1d65b$var$isAlignElement = function(element) {
|
|
6307
|
+
return 'align' in element;
|
|
6308
|
+
};
|
|
6309
|
+
var $784e2eeeb6b1d65b$var$createTagElement = function(tag, options) {
|
|
6310
|
+
var attributes = options.attributes, key = options.key, className = options.className, children = options.children;
|
|
6311
|
+
var props = attributes ? $784e2eeeb6b1d65b$var$__assign($784e2eeeb6b1d65b$var$__assign({}, attributes), {
|
|
6312
|
+
className: className
|
|
6313
|
+
}) : {
|
|
6314
|
+
key: key,
|
|
6315
|
+
className: className
|
|
6316
|
+
};
|
|
6317
|
+
return /*#__PURE__*/ (0, $iA2ta$react.createElement)(tag, props, children);
|
|
6318
|
+
};
|
|
6319
|
+
var $784e2eeeb6b1d65b$var$applyMarks = function(content, marks) {
|
|
6320
|
+
if (marks.bold) content = (0, $iA2ta$reactjsxruntime.jsx)("strong", {
|
|
6321
|
+
children: content
|
|
6322
|
+
});
|
|
6323
|
+
if (marks.code) content = (0, $iA2ta$reactjsxruntime.jsx)("code", {
|
|
6324
|
+
className: (0, $b964d0845ae86974$export$2e2bcd8739ae039).elements.code,
|
|
6325
|
+
children: content
|
|
6326
|
+
});
|
|
6327
|
+
if (marks.italic) content = (0, $iA2ta$reactjsxruntime.jsx)("em", {
|
|
6328
|
+
children: content
|
|
6329
|
+
});
|
|
6330
|
+
if (marks.underline) content = (0, $iA2ta$reactjsxruntime.jsx)("u", {
|
|
6331
|
+
children: content
|
|
6332
|
+
});
|
|
6333
|
+
return content;
|
|
6334
|
+
};
|
|
6335
|
+
var $784e2eeeb6b1d65b$var$renderRichNode = function(node, options) {
|
|
6336
|
+
if (options === void 0) options = {};
|
|
6337
|
+
var attributes = options.attributes, providedChildren = options.children, key = options.key;
|
|
6338
|
+
if ((0, $iA2ta$slate.Text).isText(node)) {
|
|
6339
|
+
var content = $784e2eeeb6b1d65b$var$applyMarks(providedChildren !== null && providedChildren !== void 0 ? providedChildren : node.text, node);
|
|
6340
|
+
return attributes ? (0, $iA2ta$reactjsxruntime.jsx)("span", $784e2eeeb6b1d65b$var$__assign({}, attributes, {
|
|
6341
|
+
children: content
|
|
6342
|
+
})) : (0, $iA2ta$reactjsxruntime.jsx)((0, $iA2ta$react.Fragment), {
|
|
6343
|
+
children: content
|
|
6344
|
+
}, key);
|
|
6345
|
+
}
|
|
6346
|
+
var element = node;
|
|
6347
|
+
var type = (0, $iA2ta$lodash.get)(element, 'type', 'paragraph');
|
|
6348
|
+
var tag = (0, $iA2ta$lodash.get)($784e2eeeb6b1d65b$var$TAG_BY_TYPE, type, 'p');
|
|
6349
|
+
var baseClass = (0, $iA2ta$lodash.get)($784e2eeeb6b1d65b$var$CLASS_BY_TYPE, type, $784e2eeeb6b1d65b$var$CLASS_BY_TYPE.paragraph);
|
|
6350
|
+
var alignClass = $784e2eeeb6b1d65b$var$isAlignElement(element) ? (0, $iA2ta$lodash.get)((0, $b964d0845ae86974$export$2e2bcd8739ae039).align, element.align, '') : '';
|
|
6351
|
+
var renderChildNode = function(childNode, index) {
|
|
6352
|
+
return $784e2eeeb6b1d65b$var$renderRichNode(childNode, {
|
|
6353
|
+
key: index
|
|
6354
|
+
});
|
|
6355
|
+
};
|
|
6356
|
+
var renderedChildren = providedChildren !== null && providedChildren !== void 0 ? providedChildren : (0, $iA2ta$lodash.map)(element.children, renderChildNode);
|
|
6357
|
+
// Merge any className Slate might pass in attributes (rare) with ours
|
|
6358
|
+
var mergedClassName = (0, $622cd2936b18c771$export$4370d69198e9314a)(baseClass, alignClass, attributes === null || attributes === void 0 ? void 0 : attributes.className);
|
|
6359
|
+
return $784e2eeeb6b1d65b$var$createTagElement(tag, {
|
|
6360
|
+
attributes: attributes,
|
|
6361
|
+
key: key,
|
|
6362
|
+
className: mergedClassName,
|
|
6363
|
+
children: renderedChildren
|
|
6364
|
+
});
|
|
6365
|
+
};
|
|
6366
|
+
var $784e2eeeb6b1d65b$var$RichTextArea = function(_a) {
|
|
6367
|
+
var _b = _a.initialValue, initialValue = _b === void 0 ? '[{"type":"paragraph","children":[{"text":"Hello from initial value. Edit me!"}]}]' : _b, onChange = _a.onChange, _c = _a.placeholder, placeholder = _c === void 0 ? "Type something\u2026" : _c, className = _a.className, stylesOverrides = _a.styles, _d = _a.isReadOnly, isReadOnly = _d === void 0 ? false : _d, toolbarConfig = _a.toolbarConfig;
|
|
6368
|
+
var styles = (0, $iA2ta$react.useMemo)(function() {
|
|
6369
|
+
var result = (0, $iA2ta$lodash.cloneDeep)((0, $b964d0845ae86974$export$2e2bcd8739ae039));
|
|
6370
|
+
var keys = (0, $27f90b0cff19565d$export$be5d6ab3c5b84767)((0, $b964d0845ae86974$export$2e2bcd8739ae039));
|
|
6371
|
+
(0, $iA2ta$lodash.forEach)(keys, function(key) {
|
|
6372
|
+
(0, $iA2ta$lodash.set)(result, key, (0, $622cd2936b18c771$export$4370d69198e9314a)((0, $iA2ta$lodash.get)((0, $b964d0845ae86974$export$2e2bcd8739ae039), key), (0, $iA2ta$lodash.get)(stylesOverrides, key)));
|
|
6373
|
+
});
|
|
6374
|
+
return result;
|
|
6375
|
+
}, [
|
|
6376
|
+
stylesOverrides
|
|
6377
|
+
]);
|
|
6378
|
+
var defaultToolbarItems = (0, $iA2ta$react.useMemo)(function() {
|
|
6379
|
+
return [
|
|
6380
|
+
'bold',
|
|
6381
|
+
'italic',
|
|
6382
|
+
'underline',
|
|
6383
|
+
'code',
|
|
6384
|
+
'heading-one',
|
|
6385
|
+
'heading-two',
|
|
6386
|
+
'block-quote',
|
|
6387
|
+
'numbered-list',
|
|
6388
|
+
'bulleted-list',
|
|
6389
|
+
'left',
|
|
6390
|
+
'center',
|
|
6391
|
+
'right',
|
|
6392
|
+
'justify'
|
|
6393
|
+
];
|
|
6394
|
+
}, []);
|
|
6395
|
+
var enabledToolbarItems = (0, $iA2ta$react.useMemo)(function() {
|
|
6396
|
+
return (0, $iA2ta$lodash.uniq)(toolbarConfig !== null && toolbarConfig !== void 0 ? toolbarConfig : defaultToolbarItems);
|
|
6397
|
+
}, [
|
|
6398
|
+
toolbarConfig,
|
|
6399
|
+
defaultToolbarItems
|
|
6400
|
+
]);
|
|
6401
|
+
var editor = (0, $iA2ta$react.useMemo)(function() {
|
|
6402
|
+
return (0, $iA2ta$slatehistory.withHistory)((0, $iA2ta$slatereact.withReact)((0, $iA2ta$slate.createEditor)()));
|
|
6403
|
+
}, []);
|
|
6404
|
+
var renderElement = (0, $iA2ta$react.useCallback)(function(_a) {
|
|
6405
|
+
var element = _a.element, attributes = _a.attributes, children = _a.children;
|
|
6406
|
+
return $784e2eeeb6b1d65b$var$renderRichNode(element, {
|
|
6407
|
+
attributes: attributes,
|
|
6408
|
+
children: children
|
|
6409
|
+
});
|
|
6410
|
+
}, []);
|
|
6411
|
+
var renderLeaf = (0, $iA2ta$react.useCallback)(function(_a) {
|
|
6412
|
+
var leaf = _a.leaf, attributes = _a.attributes, children = _a.children;
|
|
6413
|
+
return $784e2eeeb6b1d65b$var$renderRichNode(leaf, {
|
|
6414
|
+
attributes: attributes,
|
|
6415
|
+
children: children
|
|
6416
|
+
});
|
|
6417
|
+
}, []);
|
|
6418
|
+
var handleChange = (0, $iA2ta$react.useCallback)(function(newValue) {
|
|
6419
|
+
if (!onChange) return;
|
|
6420
|
+
onChange(JSON.stringify(newValue));
|
|
6421
|
+
}, [
|
|
6422
|
+
onChange
|
|
6423
|
+
]);
|
|
6424
|
+
var parsedInitialValue = (0, $iA2ta$react.useMemo)(function() {
|
|
6425
|
+
try {
|
|
6426
|
+
return JSON.parse(initialValue);
|
|
6427
|
+
} catch (_a) {
|
|
6428
|
+
return [];
|
|
6429
|
+
}
|
|
6430
|
+
}, [
|
|
6431
|
+
initialValue
|
|
6432
|
+
]);
|
|
6433
|
+
var generateMarkButton = (0, $iA2ta$react.useCallback)(function(format, icon) {
|
|
6434
|
+
return (0, $iA2ta$lodash.includes)(enabledToolbarItems, format) && (0, $iA2ta$reactjsxruntime.jsx)($784e2eeeb6b1d65b$var$Button, {
|
|
6435
|
+
active: $784e2eeeb6b1d65b$export$72001287e2a5b413(editor, format),
|
|
6436
|
+
onMouseDown: function() {
|
|
6437
|
+
return $784e2eeeb6b1d65b$export$797ad2667b8015a8(editor, format);
|
|
6438
|
+
},
|
|
6439
|
+
icon: icon
|
|
6440
|
+
});
|
|
6441
|
+
}, [
|
|
6442
|
+
enabledToolbarItems,
|
|
6443
|
+
editor
|
|
6444
|
+
]);
|
|
6445
|
+
var generateBlockButton = (0, $iA2ta$react.useCallback)(function(format, icon) {
|
|
6446
|
+
return (0, $iA2ta$lodash.includes)(enabledToolbarItems, format) && (0, $iA2ta$reactjsxruntime.jsx)($784e2eeeb6b1d65b$var$BlockButton, {
|
|
6447
|
+
format: format,
|
|
6448
|
+
icon: icon
|
|
6449
|
+
});
|
|
6450
|
+
}, [
|
|
6451
|
+
enabledToolbarItems
|
|
6452
|
+
]);
|
|
6453
|
+
var renderToolbarGroups = (0, $iA2ta$react.useCallback)(function() {
|
|
6454
|
+
var sections = [];
|
|
6455
|
+
var marks = (0, $iA2ta$lodash.compact)([
|
|
6456
|
+
generateMarkButton('bold', 'bold'),
|
|
6457
|
+
generateMarkButton('italic', 'italic'),
|
|
6458
|
+
generateMarkButton('underline', 'underline'),
|
|
6459
|
+
generateMarkButton('code', 'code')
|
|
6460
|
+
]);
|
|
6461
|
+
if (!(0, $iA2ta$lodash.isEmpty)(marks)) sections.push(marks);
|
|
6462
|
+
var headings = (0, $iA2ta$lodash.compact)([
|
|
6463
|
+
generateBlockButton('heading-one', 'h1'),
|
|
6464
|
+
generateBlockButton('heading-two', 'h2'),
|
|
6465
|
+
generateBlockButton('block-quote', 'quote-left')
|
|
6466
|
+
]);
|
|
6467
|
+
if (!(0, $iA2ta$lodash.isEmpty)(headings)) sections.push(headings);
|
|
6468
|
+
var lists = (0, $iA2ta$lodash.compact)([
|
|
6469
|
+
generateBlockButton('numbered-list', 'list-ol'),
|
|
6470
|
+
generateBlockButton('bulleted-list', 'list-ul')
|
|
6471
|
+
]);
|
|
6472
|
+
if (!(0, $iA2ta$lodash.isEmpty)(lists)) sections.push(lists);
|
|
6473
|
+
var align = (0, $iA2ta$lodash.compact)([
|
|
6474
|
+
generateBlockButton('left', 'align-left'),
|
|
6475
|
+
generateBlockButton('center', 'align-center'),
|
|
6476
|
+
generateBlockButton('right', 'align-right'),
|
|
6477
|
+
generateBlockButton('justify', 'align-justify')
|
|
6478
|
+
]);
|
|
6479
|
+
if (!(0, $iA2ta$lodash.isEmpty)(align)) sections.push(align);
|
|
6480
|
+
return sections.map(function(group, index) {
|
|
6481
|
+
return (0, $iA2ta$reactjsxruntime.jsxs)((0, $iA2ta$react.Fragment), {
|
|
6482
|
+
children: [
|
|
6483
|
+
index > 0 && (0, $iA2ta$reactjsxruntime.jsx)("div", {
|
|
6484
|
+
className: styles.editor.toolbar.divider
|
|
6485
|
+
}),
|
|
6486
|
+
group
|
|
6487
|
+
]
|
|
6488
|
+
}, index);
|
|
6489
|
+
});
|
|
6490
|
+
}, [
|
|
6491
|
+
generateMarkButton,
|
|
6492
|
+
generateBlockButton,
|
|
6493
|
+
styles.editor.toolbar.divider
|
|
6494
|
+
]);
|
|
6495
|
+
if (isReadOnly && (0, $iA2ta$lodash.isEmpty)(parsedInitialValue)) return null;
|
|
6496
|
+
return isReadOnly ? (0, $iA2ta$reactjsxruntime.jsx)("div", {
|
|
6497
|
+
className: (0, $622cd2936b18c771$export$4370d69198e9314a)('prose prose-sm max-w-none', styles.readOnly.container, className),
|
|
6498
|
+
children: (0, $iA2ta$lodash.isArray)(parsedInitialValue) ? (0, $iA2ta$lodash.map)(parsedInitialValue, function(n, i) {
|
|
6499
|
+
return $784e2eeeb6b1d65b$var$renderRichNode(n, {
|
|
6500
|
+
key: i
|
|
6501
|
+
});
|
|
6502
|
+
}) : null
|
|
6503
|
+
}) : (0, $iA2ta$reactjsxruntime.jsx)((0, $iA2ta$slatereact.Slate), {
|
|
6504
|
+
editor: editor,
|
|
6505
|
+
initialValue: parsedInitialValue,
|
|
6506
|
+
onChange: handleChange,
|
|
6507
|
+
children: (0, $iA2ta$reactjsxruntime.jsxs)("div", {
|
|
6508
|
+
className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.container, className),
|
|
6509
|
+
children: [
|
|
6510
|
+
(0, $iA2ta$reactjsxruntime.jsx)("div", {
|
|
6511
|
+
className: styles.editor.toolbar.container,
|
|
6512
|
+
children: renderToolbarGroups()
|
|
6513
|
+
}),
|
|
6514
|
+
(0, $iA2ta$reactjsxruntime.jsx)("div", {
|
|
6515
|
+
className: styles.editor.area.container,
|
|
6516
|
+
children: (0, $iA2ta$reactjsxruntime.jsx)((0, $iA2ta$slatereact.Editable), {
|
|
6517
|
+
renderElement: renderElement,
|
|
6518
|
+
renderLeaf: renderLeaf,
|
|
6519
|
+
className: styles.editor.area.editable,
|
|
6520
|
+
placeholder: placeholder,
|
|
6521
|
+
spellCheck: true,
|
|
6522
|
+
autoFocus: true,
|
|
6523
|
+
onKeyDown: function(event) {
|
|
6524
|
+
(0, $iA2ta$lodash.forEach)($784e2eeeb6b1d65b$var$HOTKEYS, function(mark, hotkey) {
|
|
6525
|
+
if ((0, ($parcel$interopDefault($iA2ta$ishotkey)))(hotkey, event)) {
|
|
6526
|
+
event.preventDefault();
|
|
6527
|
+
$784e2eeeb6b1d65b$export$797ad2667b8015a8(editor, mark);
|
|
6528
|
+
}
|
|
6529
|
+
});
|
|
6530
|
+
}
|
|
6531
|
+
})
|
|
6532
|
+
})
|
|
6533
|
+
]
|
|
6534
|
+
})
|
|
6535
|
+
});
|
|
6536
|
+
};
|
|
6537
|
+
var $784e2eeeb6b1d65b$export$65eead07296cdb21 = function(editor, format) {
|
|
6538
|
+
var isActive = $784e2eeeb6b1d65b$export$d49b8615a8b45195(editor, format, $784e2eeeb6b1d65b$var$isAlignType(format) ? 'align' : 'type');
|
|
6539
|
+
var isList = $784e2eeeb6b1d65b$var$isListType(format);
|
|
6540
|
+
(0, $iA2ta$slate.Transforms).unwrapNodes(editor, {
|
|
6541
|
+
match: function(n) {
|
|
6542
|
+
return !(0, $iA2ta$slate.Editor).isEditor(n) && (0, $iA2ta$slate.Element).isElement(n) && $784e2eeeb6b1d65b$var$isListType(n.type) && !$784e2eeeb6b1d65b$var$isAlignType(format);
|
|
6543
|
+
},
|
|
6544
|
+
split: true
|
|
6545
|
+
});
|
|
6546
|
+
var newProperties = $784e2eeeb6b1d65b$var$isAlignType(format) ? {
|
|
6547
|
+
align: isActive ? undefined : format
|
|
6548
|
+
} : {
|
|
6549
|
+
type: isActive ? 'paragraph' : isList ? 'list-item' : format
|
|
6550
|
+
};
|
|
6551
|
+
(0, $iA2ta$slate.Transforms).setNodes(editor, newProperties);
|
|
6552
|
+
if (!isActive && isList) {
|
|
6553
|
+
var block = {
|
|
6554
|
+
type: format,
|
|
6555
|
+
children: []
|
|
6556
|
+
};
|
|
6557
|
+
(0, $iA2ta$slate.Transforms).wrapNodes(editor, block);
|
|
6558
|
+
}
|
|
6559
|
+
};
|
|
6560
|
+
var $784e2eeeb6b1d65b$export$797ad2667b8015a8 = function(editor, format) {
|
|
6561
|
+
var isActive = $784e2eeeb6b1d65b$export$72001287e2a5b413(editor, format);
|
|
6562
|
+
if (isActive) (0, $iA2ta$slate.Editor).removeMark(editor, format);
|
|
6563
|
+
else (0, $iA2ta$slate.Editor).addMark(editor, format, true);
|
|
6564
|
+
};
|
|
6565
|
+
var $784e2eeeb6b1d65b$export$d49b8615a8b45195 = function(editor, format, blockType) {
|
|
6566
|
+
if (blockType === void 0) blockType = 'type';
|
|
6567
|
+
var selection = editor.selection;
|
|
6568
|
+
if (!selection) return false;
|
|
6569
|
+
var match = Array.from((0, $iA2ta$slate.Editor).nodes(editor, {
|
|
6570
|
+
at: (0, $iA2ta$slate.Editor).unhangRange(editor, selection),
|
|
6571
|
+
match: function(n) {
|
|
6572
|
+
if (!(0, $iA2ta$slate.Editor).isEditor(n) && (0, $iA2ta$slate.Element).isElement(n)) {
|
|
6573
|
+
var element = n;
|
|
6574
|
+
if (blockType === 'align' && $784e2eeeb6b1d65b$var$isAlignElement(element)) return element.align === format;
|
|
6575
|
+
return element.type === format;
|
|
6576
|
+
}
|
|
6577
|
+
return false;
|
|
6578
|
+
}
|
|
6579
|
+
}))[0];
|
|
6580
|
+
return !!match;
|
|
6581
|
+
};
|
|
6582
|
+
var $784e2eeeb6b1d65b$export$72001287e2a5b413 = function(editor, format) {
|
|
6583
|
+
var marks = (0, $iA2ta$slate.Editor).marks(editor);
|
|
6584
|
+
return marks ? marks[format] === true : false;
|
|
6585
|
+
};
|
|
6586
|
+
var $784e2eeeb6b1d65b$var$Button = function(_a) {
|
|
6587
|
+
var active = _a.active, onMouseDown = _a.onMouseDown, icon = _a.icon;
|
|
6588
|
+
return (0, $iA2ta$reactjsxruntime.jsx)("button", {
|
|
6589
|
+
type: "button",
|
|
6590
|
+
"aria-pressed": active,
|
|
6591
|
+
className: (0, $622cd2936b18c771$export$4370d69198e9314a)((0, $b964d0845ae86974$export$2e2bcd8739ae039).editor.toolbar.button, active && (0, $b964d0845ae86974$export$2e2bcd8739ae039).editor.toolbar.buttonActive),
|
|
6592
|
+
onMouseDown: function(e) {
|
|
6593
|
+
e.preventDefault();
|
|
6594
|
+
onMouseDown();
|
|
6595
|
+
},
|
|
6596
|
+
children: (0, $iA2ta$reactjsxruntime.jsx)((0, $2125901b4a9afff9$export$2e2bcd8739ae039), {
|
|
6597
|
+
accessor: icon,
|
|
6598
|
+
type: "solid",
|
|
6599
|
+
className: (0, $b964d0845ae86974$export$2e2bcd8739ae039).editor.toolbar.icon
|
|
6600
|
+
})
|
|
6601
|
+
});
|
|
6602
|
+
};
|
|
6603
|
+
var $784e2eeeb6b1d65b$var$BlockButton = function(_a) {
|
|
6604
|
+
var format = _a.format, icon = _a.icon;
|
|
6605
|
+
var editor = (0, $iA2ta$slatereact.useSlate)();
|
|
6606
|
+
var active = $784e2eeeb6b1d65b$export$d49b8615a8b45195(editor, format, $784e2eeeb6b1d65b$var$isAlignType(format) ? 'align' : 'type');
|
|
6607
|
+
var handleMouseDown = (0, $iA2ta$react.useCallback)(function() {
|
|
6608
|
+
return $784e2eeeb6b1d65b$export$65eead07296cdb21(editor, format);
|
|
6609
|
+
}, [
|
|
6610
|
+
editor,
|
|
6611
|
+
format
|
|
6612
|
+
]);
|
|
6613
|
+
return (0, $iA2ta$reactjsxruntime.jsx)($784e2eeeb6b1d65b$var$Button, {
|
|
6614
|
+
active: active,
|
|
6615
|
+
onMouseDown: handleMouseDown,
|
|
6616
|
+
icon: icon
|
|
6617
|
+
});
|
|
6618
|
+
};
|
|
6619
|
+
var $784e2eeeb6b1d65b$export$2e2bcd8739ae039 = $784e2eeeb6b1d65b$var$RichTextArea;
|
|
6620
|
+
|
|
6621
|
+
|
|
6622
|
+
|
|
6623
|
+
|
|
6624
|
+
|
|
6625
|
+
|
|
6626
|
+
|
|
6627
|
+
|
|
6628
|
+
|
|
6205
6629
|
var $8d406a8542925512$var$base = {
|
|
6206
6630
|
container: '',
|
|
6207
6631
|
head: 'flex justify-between',
|