@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.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {jsx as $4MPRY$jsx, jsxs as $4MPRY$jsxs, Fragment as $4MPRY$Fragment} from "react/jsx-runtime";
|
|
2
2
|
import {ArrowPathIcon as $4MPRY$ArrowPathIcon, ChevronDownIcon as $4MPRY$ChevronDownIcon, EllipsisVerticalIcon as $4MPRY$EllipsisVerticalIcon, ExclamationCircleIcon as $4MPRY$ExclamationCircleIcon, ChevronDoubleLeftIcon as $4MPRY$ChevronDoubleLeftIcon, ChevronLeftIcon as $4MPRY$ChevronLeftIcon, ChevronRightIcon as $4MPRY$ChevronRightIcon, ChevronDoubleRightIcon as $4MPRY$ChevronDoubleRightIcon, ChevronUpDownIcon as $4MPRY$ChevronUpDownIcon, ChevronUpIcon as $4MPRY$ChevronUpIcon, HomeIcon as $4MPRY$HomeIcon, ArrowLongLeftIcon as $4MPRY$ArrowLongLeftIcon, ArrowLongRightIcon as $4MPRY$ArrowLongRightIcon} from "@heroicons/react/20/solid";
|
|
3
|
-
import {set as $4MPRY$set, get as $4MPRY$get, isArray as $4MPRY$isArray, map as $4MPRY$map, padStart as $4MPRY$padStart, concat as $4MPRY$concat, isNil as $4MPRY$isNil, noop as $4MPRY$noop, toSafeInteger as $4MPRY$toSafeInteger, indexOf as $4MPRY$indexOf, compact as $4MPRY$compact, forEach as $4MPRY$forEach, assign as $4MPRY$assign, includes as $4MPRY$includes, isEmpty as $4MPRY$isEmpty, some as $4MPRY$some, findIndex as $4MPRY$findIndex, last as $4MPRY$last, first as $4MPRY$first, find as $4MPRY$find, times as $4MPRY$times, pick as $4MPRY$pick, intersection as $4MPRY$intersection, trim as $4MPRY$trim, lastIndexOf as $4MPRY$lastIndexOf} from "lodash";
|
|
4
|
-
import $4MPRY$react, {useState as $4MPRY$useState, useMemo as $4MPRY$useMemo, useRef as $4MPRY$useRef, Children as $4MPRY$Children, Fragment as $4MPRY$Fragment1, useCallback as $4MPRY$useCallback, useEffect as $4MPRY$useEffect} from "react";
|
|
3
|
+
import {set as $4MPRY$set, get as $4MPRY$get, isArray as $4MPRY$isArray, map as $4MPRY$map, padStart as $4MPRY$padStart, concat as $4MPRY$concat, isNil as $4MPRY$isNil, noop as $4MPRY$noop, toSafeInteger as $4MPRY$toSafeInteger, indexOf as $4MPRY$indexOf, compact as $4MPRY$compact, forEach as $4MPRY$forEach, assign as $4MPRY$assign, includes as $4MPRY$includes, isEmpty as $4MPRY$isEmpty, some as $4MPRY$some, findIndex as $4MPRY$findIndex, last as $4MPRY$last, first as $4MPRY$first, find as $4MPRY$find, times as $4MPRY$times, pick as $4MPRY$pick, intersection as $4MPRY$intersection, cloneDeep as $4MPRY$cloneDeep, uniq as $4MPRY$uniq, trim as $4MPRY$trim, lastIndexOf as $4MPRY$lastIndexOf} from "lodash";
|
|
4
|
+
import $4MPRY$react, {useState as $4MPRY$useState, useMemo as $4MPRY$useMemo, useRef as $4MPRY$useRef, Children as $4MPRY$Children, Fragment as $4MPRY$Fragment1, useCallback as $4MPRY$useCallback, useEffect as $4MPRY$useEffect, createElement as $4MPRY$createElement} from "react";
|
|
5
5
|
import $4MPRY$lodashget from "lodash/get";
|
|
6
6
|
import {library as $4MPRY$library} from "@fortawesome/fontawesome-svg-core";
|
|
7
7
|
import {fab as $4MPRY$fab} from "@fortawesome/free-brands-svg-icons";
|
|
@@ -25,6 +25,10 @@ import $4MPRY$lodashset from "lodash/set";
|
|
|
25
25
|
import {DateTime as $4MPRY$DateTime} from "luxon";
|
|
26
26
|
import $4MPRY$ballistixdigitalreacttailwindcssdatepicker from "@ballistix.digital/react-tailwindcss-datepicker";
|
|
27
27
|
import {FormikProvider as $4MPRY$FormikProvider, FieldArray as $4MPRY$FieldArray, useFormik as $4MPRY$useFormik} from "formik";
|
|
28
|
+
import $4MPRY$ishotkey from "is-hotkey";
|
|
29
|
+
import {Text as $4MPRY$Text, createEditor as $4MPRY$createEditor, Transforms as $4MPRY$Transforms, Editor as $4MPRY$Editor, Element as $4MPRY$Element} from "slate";
|
|
30
|
+
import {withHistory as $4MPRY$withHistory} from "slate-history";
|
|
31
|
+
import {withReact as $4MPRY$withReact, Slate as $4MPRY$Slate, Editable as $4MPRY$Editable, useSlate as $4MPRY$useSlate} from "slate-react";
|
|
28
32
|
import {useDropzone as $4MPRY$useDropzone} from "react-dropzone";
|
|
29
33
|
import $4MPRY$ubilabsreactgeosuggest from "@ubilabs/react-geosuggest";
|
|
30
34
|
|
|
@@ -6133,6 +6137,425 @@ var $10ded3c19afe27a9$export$2e2bcd8739ae039 = $10ded3c19afe27a9$var$Switch;
|
|
|
6133
6137
|
|
|
6134
6138
|
|
|
6135
6139
|
|
|
6140
|
+
|
|
6141
|
+
|
|
6142
|
+
|
|
6143
|
+
var $293d351fa67aae30$var$base = {
|
|
6144
|
+
container: 'border border-input rounded-lg overflow-hidden border-palette-lightGray',
|
|
6145
|
+
editor: {
|
|
6146
|
+
toolbar: {
|
|
6147
|
+
container: 'flex items-center gap-1 p-2 border-b border-border',
|
|
6148
|
+
button: 'h-6 w-6 text-[18px] hover:bg-gray-50 active:bg-gray-100 cursor-pointer rounded-sm',
|
|
6149
|
+
buttonActive: 'ring-2 ring-gray-900/10 bg-gray-100',
|
|
6150
|
+
icon: 'h-4! w-4!',
|
|
6151
|
+
divider: 'w-px h-6 bg-gray-200 mx-1'
|
|
6152
|
+
},
|
|
6153
|
+
area: {
|
|
6154
|
+
container: 'overflow-hidden p-4',
|
|
6155
|
+
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'
|
|
6156
|
+
}
|
|
6157
|
+
},
|
|
6158
|
+
elements: {
|
|
6159
|
+
blockquote: 'border-l-4 border-gray-300 pl-4 italic text-gray-600 bg-gray-50 rounded-r-md py-2 my-2',
|
|
6160
|
+
list: {
|
|
6161
|
+
bulleted: 'list-disc ml-6 space-y-1',
|
|
6162
|
+
numbered: 'list-decimal ml-6 space-y-1',
|
|
6163
|
+
item: ''
|
|
6164
|
+
},
|
|
6165
|
+
heading: {
|
|
6166
|
+
h1: 'text-2xl font-semibold tracking-tight',
|
|
6167
|
+
h2: 'text-xl font-semibold tracking-tight'
|
|
6168
|
+
},
|
|
6169
|
+
paragraph: '',
|
|
6170
|
+
code: 'px-1.5 py-0.5 rounded-md bg-gray-100 text-gray-800 font-mono text-[0.85em]'
|
|
6171
|
+
},
|
|
6172
|
+
align: {
|
|
6173
|
+
left: 'text-left',
|
|
6174
|
+
center: 'text-center',
|
|
6175
|
+
right: 'text-right',
|
|
6176
|
+
justify: 'text-justify'
|
|
6177
|
+
},
|
|
6178
|
+
readOnly: {
|
|
6179
|
+
container: ''
|
|
6180
|
+
}
|
|
6181
|
+
};
|
|
6182
|
+
var $293d351fa67aae30$var$styles = $293d351fa67aae30$var$base;
|
|
6183
|
+
var $293d351fa67aae30$export$2e2bcd8739ae039 = $293d351fa67aae30$var$styles;
|
|
6184
|
+
|
|
6185
|
+
|
|
6186
|
+
var $aa6702347bcd9c62$var$__assign = undefined && undefined.__assign || function() {
|
|
6187
|
+
$aa6702347bcd9c62$var$__assign = Object.assign || function(t) {
|
|
6188
|
+
for(var s, i = 1, n = arguments.length; i < n; i++){
|
|
6189
|
+
s = arguments[i];
|
|
6190
|
+
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6191
|
+
}
|
|
6192
|
+
return t;
|
|
6193
|
+
};
|
|
6194
|
+
return $aa6702347bcd9c62$var$__assign.apply(this, arguments);
|
|
6195
|
+
};
|
|
6196
|
+
var $aa6702347bcd9c62$var$HOTKEYS = {
|
|
6197
|
+
'mod+b': 'bold',
|
|
6198
|
+
'mod+i': 'italic',
|
|
6199
|
+
'mod+u': 'underline',
|
|
6200
|
+
'mod+`': 'code'
|
|
6201
|
+
};
|
|
6202
|
+
var $aa6702347bcd9c62$var$LIST_TYPES = [
|
|
6203
|
+
'numbered-list',
|
|
6204
|
+
'bulleted-list'
|
|
6205
|
+
];
|
|
6206
|
+
var $aa6702347bcd9c62$var$TEXT_ALIGN_TYPES = [
|
|
6207
|
+
'left',
|
|
6208
|
+
'center',
|
|
6209
|
+
'right',
|
|
6210
|
+
'justify'
|
|
6211
|
+
];
|
|
6212
|
+
var $aa6702347bcd9c62$var$TAG_BY_TYPE = {
|
|
6213
|
+
'block-quote': 'blockquote',
|
|
6214
|
+
'bulleted-list': 'ul',
|
|
6215
|
+
'numbered-list': 'ol',
|
|
6216
|
+
'heading-one': 'h1',
|
|
6217
|
+
'heading-two': 'h2',
|
|
6218
|
+
'list-item': 'li',
|
|
6219
|
+
paragraph: 'p'
|
|
6220
|
+
};
|
|
6221
|
+
var $aa6702347bcd9c62$var$CLASS_BY_TYPE = {
|
|
6222
|
+
'block-quote': (0, $293d351fa67aae30$export$2e2bcd8739ae039).elements.blockquote,
|
|
6223
|
+
'bulleted-list': (0, $293d351fa67aae30$export$2e2bcd8739ae039).elements.list.bulleted,
|
|
6224
|
+
'numbered-list': (0, $293d351fa67aae30$export$2e2bcd8739ae039).elements.list.numbered,
|
|
6225
|
+
'heading-one': (0, $293d351fa67aae30$export$2e2bcd8739ae039).elements.heading.h1,
|
|
6226
|
+
'heading-two': (0, $293d351fa67aae30$export$2e2bcd8739ae039).elements.heading.h2,
|
|
6227
|
+
'list-item': (0, $293d351fa67aae30$export$2e2bcd8739ae039).elements.list.item,
|
|
6228
|
+
paragraph: (0, $293d351fa67aae30$export$2e2bcd8739ae039).elements.paragraph
|
|
6229
|
+
};
|
|
6230
|
+
var $aa6702347bcd9c62$var$isAlignType = function(format) {
|
|
6231
|
+
return $aa6702347bcd9c62$var$TEXT_ALIGN_TYPES.includes(format);
|
|
6232
|
+
};
|
|
6233
|
+
var $aa6702347bcd9c62$var$isListType = function(format) {
|
|
6234
|
+
return $aa6702347bcd9c62$var$LIST_TYPES.includes(format);
|
|
6235
|
+
};
|
|
6236
|
+
var $aa6702347bcd9c62$var$isAlignElement = function(element) {
|
|
6237
|
+
return 'align' in element;
|
|
6238
|
+
};
|
|
6239
|
+
var $aa6702347bcd9c62$var$createTagElement = function(tag, options) {
|
|
6240
|
+
var attributes = options.attributes, key = options.key, className = options.className, children = options.children;
|
|
6241
|
+
var props = attributes ? $aa6702347bcd9c62$var$__assign($aa6702347bcd9c62$var$__assign({}, attributes), {
|
|
6242
|
+
className: className
|
|
6243
|
+
}) : {
|
|
6244
|
+
key: key,
|
|
6245
|
+
className: className
|
|
6246
|
+
};
|
|
6247
|
+
return /*#__PURE__*/ (0, $4MPRY$createElement)(tag, props, children);
|
|
6248
|
+
};
|
|
6249
|
+
var $aa6702347bcd9c62$var$applyMarks = function(content, marks) {
|
|
6250
|
+
if (marks.bold) content = (0, $4MPRY$jsx)("strong", {
|
|
6251
|
+
children: content
|
|
6252
|
+
});
|
|
6253
|
+
if (marks.code) content = (0, $4MPRY$jsx)("code", {
|
|
6254
|
+
className: (0, $293d351fa67aae30$export$2e2bcd8739ae039).elements.code,
|
|
6255
|
+
children: content
|
|
6256
|
+
});
|
|
6257
|
+
if (marks.italic) content = (0, $4MPRY$jsx)("em", {
|
|
6258
|
+
children: content
|
|
6259
|
+
});
|
|
6260
|
+
if (marks.underline) content = (0, $4MPRY$jsx)("u", {
|
|
6261
|
+
children: content
|
|
6262
|
+
});
|
|
6263
|
+
return content;
|
|
6264
|
+
};
|
|
6265
|
+
var $aa6702347bcd9c62$var$renderRichNode = function(node, options) {
|
|
6266
|
+
if (options === void 0) options = {};
|
|
6267
|
+
var attributes = options.attributes, providedChildren = options.children, key = options.key;
|
|
6268
|
+
if ((0, $4MPRY$Text).isText(node)) {
|
|
6269
|
+
var content = $aa6702347bcd9c62$var$applyMarks(providedChildren !== null && providedChildren !== void 0 ? providedChildren : node.text, node);
|
|
6270
|
+
return attributes ? (0, $4MPRY$jsx)("span", $aa6702347bcd9c62$var$__assign({}, attributes, {
|
|
6271
|
+
children: content
|
|
6272
|
+
})) : (0, $4MPRY$jsx)((0, $4MPRY$Fragment1), {
|
|
6273
|
+
children: content
|
|
6274
|
+
}, key);
|
|
6275
|
+
}
|
|
6276
|
+
var element = node;
|
|
6277
|
+
var type = (0, $4MPRY$get)(element, 'type', 'paragraph');
|
|
6278
|
+
var tag = (0, $4MPRY$get)($aa6702347bcd9c62$var$TAG_BY_TYPE, type, 'p');
|
|
6279
|
+
var baseClass = (0, $4MPRY$get)($aa6702347bcd9c62$var$CLASS_BY_TYPE, type, $aa6702347bcd9c62$var$CLASS_BY_TYPE.paragraph);
|
|
6280
|
+
var alignClass = $aa6702347bcd9c62$var$isAlignElement(element) ? (0, $4MPRY$get)((0, $293d351fa67aae30$export$2e2bcd8739ae039).align, element.align, '') : '';
|
|
6281
|
+
var renderChildNode = function(childNode, index) {
|
|
6282
|
+
return $aa6702347bcd9c62$var$renderRichNode(childNode, {
|
|
6283
|
+
key: index
|
|
6284
|
+
});
|
|
6285
|
+
};
|
|
6286
|
+
var renderedChildren = providedChildren !== null && providedChildren !== void 0 ? providedChildren : (0, $4MPRY$map)(element.children, renderChildNode);
|
|
6287
|
+
// Merge any className Slate might pass in attributes (rare) with ours
|
|
6288
|
+
var mergedClassName = (0, $66c3dcaaa74b5389$export$4370d69198e9314a)(baseClass, alignClass, attributes === null || attributes === void 0 ? void 0 : attributes.className);
|
|
6289
|
+
return $aa6702347bcd9c62$var$createTagElement(tag, {
|
|
6290
|
+
attributes: attributes,
|
|
6291
|
+
key: key,
|
|
6292
|
+
className: mergedClassName,
|
|
6293
|
+
children: renderedChildren
|
|
6294
|
+
});
|
|
6295
|
+
};
|
|
6296
|
+
var $aa6702347bcd9c62$var$RichTextArea = function(_a) {
|
|
6297
|
+
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;
|
|
6298
|
+
var styles = (0, $4MPRY$useMemo)(function() {
|
|
6299
|
+
var result = (0, $4MPRY$cloneDeep)((0, $293d351fa67aae30$export$2e2bcd8739ae039));
|
|
6300
|
+
var keys = (0, $ba1db6dce71c3f25$export$be5d6ab3c5b84767)((0, $293d351fa67aae30$export$2e2bcd8739ae039));
|
|
6301
|
+
(0, $4MPRY$forEach)(keys, function(key) {
|
|
6302
|
+
(0, $4MPRY$set)(result, key, (0, $66c3dcaaa74b5389$export$4370d69198e9314a)((0, $4MPRY$get)((0, $293d351fa67aae30$export$2e2bcd8739ae039), key), (0, $4MPRY$get)(stylesOverrides, key)));
|
|
6303
|
+
});
|
|
6304
|
+
return result;
|
|
6305
|
+
}, [
|
|
6306
|
+
stylesOverrides
|
|
6307
|
+
]);
|
|
6308
|
+
var defaultToolbarItems = (0, $4MPRY$useMemo)(function() {
|
|
6309
|
+
return [
|
|
6310
|
+
'bold',
|
|
6311
|
+
'italic',
|
|
6312
|
+
'underline',
|
|
6313
|
+
'code',
|
|
6314
|
+
'heading-one',
|
|
6315
|
+
'heading-two',
|
|
6316
|
+
'block-quote',
|
|
6317
|
+
'numbered-list',
|
|
6318
|
+
'bulleted-list',
|
|
6319
|
+
'left',
|
|
6320
|
+
'center',
|
|
6321
|
+
'right',
|
|
6322
|
+
'justify'
|
|
6323
|
+
];
|
|
6324
|
+
}, []);
|
|
6325
|
+
var enabledToolbarItems = (0, $4MPRY$useMemo)(function() {
|
|
6326
|
+
return (0, $4MPRY$uniq)(toolbarConfig !== null && toolbarConfig !== void 0 ? toolbarConfig : defaultToolbarItems);
|
|
6327
|
+
}, [
|
|
6328
|
+
toolbarConfig,
|
|
6329
|
+
defaultToolbarItems
|
|
6330
|
+
]);
|
|
6331
|
+
var editor = (0, $4MPRY$useMemo)(function() {
|
|
6332
|
+
return (0, $4MPRY$withHistory)((0, $4MPRY$withReact)((0, $4MPRY$createEditor)()));
|
|
6333
|
+
}, []);
|
|
6334
|
+
var renderElement = (0, $4MPRY$useCallback)(function(_a) {
|
|
6335
|
+
var element = _a.element, attributes = _a.attributes, children = _a.children;
|
|
6336
|
+
return $aa6702347bcd9c62$var$renderRichNode(element, {
|
|
6337
|
+
attributes: attributes,
|
|
6338
|
+
children: children
|
|
6339
|
+
});
|
|
6340
|
+
}, []);
|
|
6341
|
+
var renderLeaf = (0, $4MPRY$useCallback)(function(_a) {
|
|
6342
|
+
var leaf = _a.leaf, attributes = _a.attributes, children = _a.children;
|
|
6343
|
+
return $aa6702347bcd9c62$var$renderRichNode(leaf, {
|
|
6344
|
+
attributes: attributes,
|
|
6345
|
+
children: children
|
|
6346
|
+
});
|
|
6347
|
+
}, []);
|
|
6348
|
+
var handleChange = (0, $4MPRY$useCallback)(function(newValue) {
|
|
6349
|
+
if (!onChange) return;
|
|
6350
|
+
onChange(JSON.stringify(newValue));
|
|
6351
|
+
}, [
|
|
6352
|
+
onChange
|
|
6353
|
+
]);
|
|
6354
|
+
var parsedInitialValue = (0, $4MPRY$useMemo)(function() {
|
|
6355
|
+
try {
|
|
6356
|
+
return JSON.parse(initialValue);
|
|
6357
|
+
} catch (_a) {
|
|
6358
|
+
return [];
|
|
6359
|
+
}
|
|
6360
|
+
}, [
|
|
6361
|
+
initialValue
|
|
6362
|
+
]);
|
|
6363
|
+
var generateMarkButton = (0, $4MPRY$useCallback)(function(format, icon) {
|
|
6364
|
+
return (0, $4MPRY$includes)(enabledToolbarItems, format) && (0, $4MPRY$jsx)($aa6702347bcd9c62$var$Button, {
|
|
6365
|
+
active: $aa6702347bcd9c62$export$72001287e2a5b413(editor, format),
|
|
6366
|
+
onMouseDown: function() {
|
|
6367
|
+
return $aa6702347bcd9c62$export$797ad2667b8015a8(editor, format);
|
|
6368
|
+
},
|
|
6369
|
+
icon: icon
|
|
6370
|
+
});
|
|
6371
|
+
}, [
|
|
6372
|
+
enabledToolbarItems,
|
|
6373
|
+
editor
|
|
6374
|
+
]);
|
|
6375
|
+
var generateBlockButton = (0, $4MPRY$useCallback)(function(format, icon) {
|
|
6376
|
+
return (0, $4MPRY$includes)(enabledToolbarItems, format) && (0, $4MPRY$jsx)($aa6702347bcd9c62$var$BlockButton, {
|
|
6377
|
+
format: format,
|
|
6378
|
+
icon: icon
|
|
6379
|
+
});
|
|
6380
|
+
}, [
|
|
6381
|
+
enabledToolbarItems
|
|
6382
|
+
]);
|
|
6383
|
+
var renderToolbarGroups = (0, $4MPRY$useCallback)(function() {
|
|
6384
|
+
var sections = [];
|
|
6385
|
+
var marks = (0, $4MPRY$compact)([
|
|
6386
|
+
generateMarkButton('bold', 'bold'),
|
|
6387
|
+
generateMarkButton('italic', 'italic'),
|
|
6388
|
+
generateMarkButton('underline', 'underline'),
|
|
6389
|
+
generateMarkButton('code', 'code')
|
|
6390
|
+
]);
|
|
6391
|
+
if (!(0, $4MPRY$isEmpty)(marks)) sections.push(marks);
|
|
6392
|
+
var headings = (0, $4MPRY$compact)([
|
|
6393
|
+
generateBlockButton('heading-one', 'h1'),
|
|
6394
|
+
generateBlockButton('heading-two', 'h2'),
|
|
6395
|
+
generateBlockButton('block-quote', 'quote-left')
|
|
6396
|
+
]);
|
|
6397
|
+
if (!(0, $4MPRY$isEmpty)(headings)) sections.push(headings);
|
|
6398
|
+
var lists = (0, $4MPRY$compact)([
|
|
6399
|
+
generateBlockButton('numbered-list', 'list-ol'),
|
|
6400
|
+
generateBlockButton('bulleted-list', 'list-ul')
|
|
6401
|
+
]);
|
|
6402
|
+
if (!(0, $4MPRY$isEmpty)(lists)) sections.push(lists);
|
|
6403
|
+
var align = (0, $4MPRY$compact)([
|
|
6404
|
+
generateBlockButton('left', 'align-left'),
|
|
6405
|
+
generateBlockButton('center', 'align-center'),
|
|
6406
|
+
generateBlockButton('right', 'align-right'),
|
|
6407
|
+
generateBlockButton('justify', 'align-justify')
|
|
6408
|
+
]);
|
|
6409
|
+
if (!(0, $4MPRY$isEmpty)(align)) sections.push(align);
|
|
6410
|
+
return sections.map(function(group, index) {
|
|
6411
|
+
return (0, $4MPRY$jsxs)((0, $4MPRY$Fragment1), {
|
|
6412
|
+
children: [
|
|
6413
|
+
index > 0 && (0, $4MPRY$jsx)("div", {
|
|
6414
|
+
className: styles.editor.toolbar.divider
|
|
6415
|
+
}),
|
|
6416
|
+
group
|
|
6417
|
+
]
|
|
6418
|
+
}, index);
|
|
6419
|
+
});
|
|
6420
|
+
}, [
|
|
6421
|
+
generateMarkButton,
|
|
6422
|
+
generateBlockButton,
|
|
6423
|
+
styles.editor.toolbar.divider
|
|
6424
|
+
]);
|
|
6425
|
+
if (isReadOnly && (0, $4MPRY$isEmpty)(parsedInitialValue)) return null;
|
|
6426
|
+
return isReadOnly ? (0, $4MPRY$jsx)("div", {
|
|
6427
|
+
className: (0, $66c3dcaaa74b5389$export$4370d69198e9314a)('prose prose-sm max-w-none', styles.readOnly.container, className),
|
|
6428
|
+
children: (0, $4MPRY$isArray)(parsedInitialValue) ? (0, $4MPRY$map)(parsedInitialValue, function(n, i) {
|
|
6429
|
+
return $aa6702347bcd9c62$var$renderRichNode(n, {
|
|
6430
|
+
key: i
|
|
6431
|
+
});
|
|
6432
|
+
}) : null
|
|
6433
|
+
}) : (0, $4MPRY$jsx)((0, $4MPRY$Slate), {
|
|
6434
|
+
editor: editor,
|
|
6435
|
+
initialValue: parsedInitialValue,
|
|
6436
|
+
onChange: handleChange,
|
|
6437
|
+
children: (0, $4MPRY$jsxs)("div", {
|
|
6438
|
+
className: (0, $66c3dcaaa74b5389$export$4370d69198e9314a)(styles.container, className),
|
|
6439
|
+
children: [
|
|
6440
|
+
(0, $4MPRY$jsx)("div", {
|
|
6441
|
+
className: styles.editor.toolbar.container,
|
|
6442
|
+
children: renderToolbarGroups()
|
|
6443
|
+
}),
|
|
6444
|
+
(0, $4MPRY$jsx)("div", {
|
|
6445
|
+
className: styles.editor.area.container,
|
|
6446
|
+
children: (0, $4MPRY$jsx)((0, $4MPRY$Editable), {
|
|
6447
|
+
renderElement: renderElement,
|
|
6448
|
+
renderLeaf: renderLeaf,
|
|
6449
|
+
className: styles.editor.area.editable,
|
|
6450
|
+
placeholder: placeholder,
|
|
6451
|
+
spellCheck: true,
|
|
6452
|
+
autoFocus: true,
|
|
6453
|
+
onKeyDown: function(event) {
|
|
6454
|
+
(0, $4MPRY$forEach)($aa6702347bcd9c62$var$HOTKEYS, function(mark, hotkey) {
|
|
6455
|
+
if ((0, $4MPRY$ishotkey)(hotkey, event)) {
|
|
6456
|
+
event.preventDefault();
|
|
6457
|
+
$aa6702347bcd9c62$export$797ad2667b8015a8(editor, mark);
|
|
6458
|
+
}
|
|
6459
|
+
});
|
|
6460
|
+
}
|
|
6461
|
+
})
|
|
6462
|
+
})
|
|
6463
|
+
]
|
|
6464
|
+
})
|
|
6465
|
+
});
|
|
6466
|
+
};
|
|
6467
|
+
var $aa6702347bcd9c62$export$65eead07296cdb21 = function(editor, format) {
|
|
6468
|
+
var isActive = $aa6702347bcd9c62$export$d49b8615a8b45195(editor, format, $aa6702347bcd9c62$var$isAlignType(format) ? 'align' : 'type');
|
|
6469
|
+
var isList = $aa6702347bcd9c62$var$isListType(format);
|
|
6470
|
+
(0, $4MPRY$Transforms).unwrapNodes(editor, {
|
|
6471
|
+
match: function(n) {
|
|
6472
|
+
return !(0, $4MPRY$Editor).isEditor(n) && (0, $4MPRY$Element).isElement(n) && $aa6702347bcd9c62$var$isListType(n.type) && !$aa6702347bcd9c62$var$isAlignType(format);
|
|
6473
|
+
},
|
|
6474
|
+
split: true
|
|
6475
|
+
});
|
|
6476
|
+
var newProperties = $aa6702347bcd9c62$var$isAlignType(format) ? {
|
|
6477
|
+
align: isActive ? undefined : format
|
|
6478
|
+
} : {
|
|
6479
|
+
type: isActive ? 'paragraph' : isList ? 'list-item' : format
|
|
6480
|
+
};
|
|
6481
|
+
(0, $4MPRY$Transforms).setNodes(editor, newProperties);
|
|
6482
|
+
if (!isActive && isList) {
|
|
6483
|
+
var block = {
|
|
6484
|
+
type: format,
|
|
6485
|
+
children: []
|
|
6486
|
+
};
|
|
6487
|
+
(0, $4MPRY$Transforms).wrapNodes(editor, block);
|
|
6488
|
+
}
|
|
6489
|
+
};
|
|
6490
|
+
var $aa6702347bcd9c62$export$797ad2667b8015a8 = function(editor, format) {
|
|
6491
|
+
var isActive = $aa6702347bcd9c62$export$72001287e2a5b413(editor, format);
|
|
6492
|
+
if (isActive) (0, $4MPRY$Editor).removeMark(editor, format);
|
|
6493
|
+
else (0, $4MPRY$Editor).addMark(editor, format, true);
|
|
6494
|
+
};
|
|
6495
|
+
var $aa6702347bcd9c62$export$d49b8615a8b45195 = function(editor, format, blockType) {
|
|
6496
|
+
if (blockType === void 0) blockType = 'type';
|
|
6497
|
+
var selection = editor.selection;
|
|
6498
|
+
if (!selection) return false;
|
|
6499
|
+
var match = Array.from((0, $4MPRY$Editor).nodes(editor, {
|
|
6500
|
+
at: (0, $4MPRY$Editor).unhangRange(editor, selection),
|
|
6501
|
+
match: function(n) {
|
|
6502
|
+
if (!(0, $4MPRY$Editor).isEditor(n) && (0, $4MPRY$Element).isElement(n)) {
|
|
6503
|
+
var element = n;
|
|
6504
|
+
if (blockType === 'align' && $aa6702347bcd9c62$var$isAlignElement(element)) return element.align === format;
|
|
6505
|
+
return element.type === format;
|
|
6506
|
+
}
|
|
6507
|
+
return false;
|
|
6508
|
+
}
|
|
6509
|
+
}))[0];
|
|
6510
|
+
return !!match;
|
|
6511
|
+
};
|
|
6512
|
+
var $aa6702347bcd9c62$export$72001287e2a5b413 = function(editor, format) {
|
|
6513
|
+
var marks = (0, $4MPRY$Editor).marks(editor);
|
|
6514
|
+
return marks ? marks[format] === true : false;
|
|
6515
|
+
};
|
|
6516
|
+
var $aa6702347bcd9c62$var$Button = function(_a) {
|
|
6517
|
+
var active = _a.active, onMouseDown = _a.onMouseDown, icon = _a.icon;
|
|
6518
|
+
return (0, $4MPRY$jsx)("button", {
|
|
6519
|
+
type: "button",
|
|
6520
|
+
"aria-pressed": active,
|
|
6521
|
+
className: (0, $66c3dcaaa74b5389$export$4370d69198e9314a)((0, $293d351fa67aae30$export$2e2bcd8739ae039).editor.toolbar.button, active && (0, $293d351fa67aae30$export$2e2bcd8739ae039).editor.toolbar.buttonActive),
|
|
6522
|
+
onMouseDown: function(e) {
|
|
6523
|
+
e.preventDefault();
|
|
6524
|
+
onMouseDown();
|
|
6525
|
+
},
|
|
6526
|
+
children: (0, $4MPRY$jsx)((0, $77cd4416ca4a0639$export$2e2bcd8739ae039), {
|
|
6527
|
+
accessor: icon,
|
|
6528
|
+
type: "solid",
|
|
6529
|
+
className: (0, $293d351fa67aae30$export$2e2bcd8739ae039).editor.toolbar.icon
|
|
6530
|
+
})
|
|
6531
|
+
});
|
|
6532
|
+
};
|
|
6533
|
+
var $aa6702347bcd9c62$var$BlockButton = function(_a) {
|
|
6534
|
+
var format = _a.format, icon = _a.icon;
|
|
6535
|
+
var editor = (0, $4MPRY$useSlate)();
|
|
6536
|
+
var active = $aa6702347bcd9c62$export$d49b8615a8b45195(editor, format, $aa6702347bcd9c62$var$isAlignType(format) ? 'align' : 'type');
|
|
6537
|
+
var handleMouseDown = (0, $4MPRY$useCallback)(function() {
|
|
6538
|
+
return $aa6702347bcd9c62$export$65eead07296cdb21(editor, format);
|
|
6539
|
+
}, [
|
|
6540
|
+
editor,
|
|
6541
|
+
format
|
|
6542
|
+
]);
|
|
6543
|
+
return (0, $4MPRY$jsx)($aa6702347bcd9c62$var$Button, {
|
|
6544
|
+
active: active,
|
|
6545
|
+
onMouseDown: handleMouseDown,
|
|
6546
|
+
icon: icon
|
|
6547
|
+
});
|
|
6548
|
+
};
|
|
6549
|
+
var $aa6702347bcd9c62$export$2e2bcd8739ae039 = $aa6702347bcd9c62$var$RichTextArea;
|
|
6550
|
+
|
|
6551
|
+
|
|
6552
|
+
|
|
6553
|
+
|
|
6554
|
+
|
|
6555
|
+
|
|
6556
|
+
|
|
6557
|
+
|
|
6558
|
+
|
|
6136
6559
|
var $43437b181b294db2$var$base = {
|
|
6137
6560
|
container: '',
|
|
6138
6561
|
head: 'flex justify-between',
|
|
@@ -7284,5 +7707,5 @@ var $bcc7539df5bef927$export$1476d5e67a64a695 = function(str) {
|
|
|
7284
7707
|
|
|
7285
7708
|
|
|
7286
7709
|
|
|
7287
|
-
export {$4f6dca59bb6d6d50$export$2e2bcd8739ae039 as AvatarElement, $9a29d5e0e3b54abe$export$2e2bcd8739ae039 as AlertElement, $a5045567c9b3a96e$export$2e2bcd8739ae039 as BadgeElement, $b237e6d2d86a5c92$export$2e2bcd8739ae039 as TooltipElement, $bc407adcad543f74$export$2e2bcd8739ae039 as ButtonElement, $c827cec2b56530a4$export$2e2bcd8739ae039 as ButtonGroupElement, $edc4ba41affb9483$export$2e2bcd8739ae039 as DropdownElement, $77cd4416ca4a0639$export$2e2bcd8739ae039 as IconElement, $307aa6ad38171d38$export$2e2bcd8739ae039 as CollapsibleElement, $49931a5175dab103$export$2e2bcd8739ae039 as ProgressTrackElement, $7b4ae85c2b92d7dd$export$2e2bcd8739ae039 as InputGroupForm, $2e39e1fa3f910477$export$2e2bcd8739ae039 as ContainerLayout, $47c668decea293b6$export$2e2bcd8739ae039 as DividerLayout, $40af42a6ff486398$export$2e2bcd8739ae039 as ListContainerLayout, $d8086708b0fe8d97$export$2e2bcd8739ae039 as MediaObjectLayout, $11b7c597538c2257$export$2e2bcd8739ae039 as PanelLayout, $4421fdc946e7dd6c$export$2e2bcd8739ae039 as TableList, $df469b72efb8986e$export$2e2bcd8739ae039 as TableList2, $fc6e6482f238e9ea$export$4b44a5cb9651fe5e as createColumnHelper, $797c6dd505f17788$export$2e2bcd8739ae039 as BreadcrumbsNavigation, $8239f5cdc1851973$export$2e2bcd8739ae039 as PanelPaginationNavigation, $56d2586955e116da$export$2e2bcd8739ae039 as PagePaginationNavigation, $fa0fc9b7e04a1799$export$2e2bcd8739ae039 as TabNavigation, $860faaa2c7bb1f36$export$2e2bcd8739ae039 as VerticalNavigation, $d467f992ffa88739$export$2e2bcd8739ae039 as ModalOverlay, $0a39296cb800ec26$export$2e2bcd8739ae039 as NotificationOverlay, $434e0b441c881466$export$2e2bcd8739ae039 as SlideOverOverlay, $28232825d538e297$export$2e2bcd8739ae039 as TableColumnOptionsCustom, $b38b76ffa80a65c8$export$2e2bcd8739ae039 as TableExportCustom, $40038b27a5148d69$export$2e2bcd8739ae039 as SelectMenuForm, $66c3dcaaa74b5389$export$7493424cf90fe793 as fromSelectMenuOptionToStringValue, $66c3dcaaa74b5389$export$4370d69198e9314a as toClassName, $66c3dcaaa74b5389$export$91d20e9290e3c358 as toAddressString, $66c3dcaaa74b5389$export$ba96624aa3b67894 as toAddressUrl, $66c3dcaaa74b5389$export$f3f93e5bb54c3de5 as toNationalRegistryNumberString, $66c3dcaaa74b5389$export$648c405ef8d23fec as toPriceString, $66c3dcaaa74b5389$export$155f7ed6f228c17c as toReadableFileSize, $66c3dcaaa74b5389$export$b2669f8969cc59be as toUserName, $66c3dcaaa74b5389$export$d9f806f9324c35ff as toUserInitials, $4e61e073e8ab55ca$export$b7c4e1545c61edee as toDateString, $4e61e073e8ab55ca$export$b489b1fb1454ddcf as toTimeString, $4e61e073e8ab55ca$export$c03bb0116ee09d4b as isValidDate, $4e61e073e8ab55ca$export$9b56e83e909e2c38 as toDateTimeString, $4e61e073e8ab55ca$export$1771f44233a5f72 as toDaysDifference, $4e61e073e8ab55ca$export$8649d02bd537ff66 as latestDateString, $4e61e073e8ab55ca$export$df20409d3177a2e0 as toDateValue, $4e61e073e8ab55ca$export$8a6f307d1b8b1960 as toTimeValue, $4e61e073e8ab55ca$export$8de20099c30464f2 as toUTCDate, $be69f9fa947058ae$export$2e2bcd8739ae039 as DateMenuForm, $00ca07f933061d8a$export$2e2bcd8739ae039 as DateRangeMenuForm, $e964500960620598$export$2e2bcd8739ae039 as __DEPRECATED__CheckboxInputGroupForm, $785bf8949af26aa5$export$2e2bcd8739ae039 as CheckboxInput, $10ded3c19afe27a9$export$2e2bcd8739ae039 as SwitchForm, $b1b6aa72505b2474$export$2e2bcd8739ae039 as FileInputGroupForm, $39e9223269e270c7$export$2e2bcd8739ae039 as OpeningsHourInputGroupForm, $c7f1fe1c3b2d56f5$export$2e2bcd8739ae039 as AddressInputGroupForm, $382ffb7c1faa0f62$export$4564041bcff0e281 as useExcel, $48d5b0ffa682dc0b$export$2e2bcd8739ae039 as useExcelMapper, $3f6ca002faff40a3$export$2e2bcd8739ae039 as useColumnHelper, $bcc7539df5bef927$export$1476d5e67a64a695 as escapeSpecialCharacters};
|
|
7710
|
+
export {$4f6dca59bb6d6d50$export$2e2bcd8739ae039 as AvatarElement, $9a29d5e0e3b54abe$export$2e2bcd8739ae039 as AlertElement, $a5045567c9b3a96e$export$2e2bcd8739ae039 as BadgeElement, $b237e6d2d86a5c92$export$2e2bcd8739ae039 as TooltipElement, $bc407adcad543f74$export$2e2bcd8739ae039 as ButtonElement, $c827cec2b56530a4$export$2e2bcd8739ae039 as ButtonGroupElement, $edc4ba41affb9483$export$2e2bcd8739ae039 as DropdownElement, $77cd4416ca4a0639$export$2e2bcd8739ae039 as IconElement, $307aa6ad38171d38$export$2e2bcd8739ae039 as CollapsibleElement, $49931a5175dab103$export$2e2bcd8739ae039 as ProgressTrackElement, $7b4ae85c2b92d7dd$export$2e2bcd8739ae039 as InputGroupForm, $2e39e1fa3f910477$export$2e2bcd8739ae039 as ContainerLayout, $47c668decea293b6$export$2e2bcd8739ae039 as DividerLayout, $40af42a6ff486398$export$2e2bcd8739ae039 as ListContainerLayout, $d8086708b0fe8d97$export$2e2bcd8739ae039 as MediaObjectLayout, $11b7c597538c2257$export$2e2bcd8739ae039 as PanelLayout, $4421fdc946e7dd6c$export$2e2bcd8739ae039 as TableList, $df469b72efb8986e$export$2e2bcd8739ae039 as TableList2, $fc6e6482f238e9ea$export$4b44a5cb9651fe5e as createColumnHelper, $797c6dd505f17788$export$2e2bcd8739ae039 as BreadcrumbsNavigation, $8239f5cdc1851973$export$2e2bcd8739ae039 as PanelPaginationNavigation, $56d2586955e116da$export$2e2bcd8739ae039 as PagePaginationNavigation, $fa0fc9b7e04a1799$export$2e2bcd8739ae039 as TabNavigation, $860faaa2c7bb1f36$export$2e2bcd8739ae039 as VerticalNavigation, $d467f992ffa88739$export$2e2bcd8739ae039 as ModalOverlay, $0a39296cb800ec26$export$2e2bcd8739ae039 as NotificationOverlay, $434e0b441c881466$export$2e2bcd8739ae039 as SlideOverOverlay, $28232825d538e297$export$2e2bcd8739ae039 as TableColumnOptionsCustom, $b38b76ffa80a65c8$export$2e2bcd8739ae039 as TableExportCustom, $40038b27a5148d69$export$2e2bcd8739ae039 as SelectMenuForm, $66c3dcaaa74b5389$export$7493424cf90fe793 as fromSelectMenuOptionToStringValue, $66c3dcaaa74b5389$export$4370d69198e9314a as toClassName, $66c3dcaaa74b5389$export$91d20e9290e3c358 as toAddressString, $66c3dcaaa74b5389$export$ba96624aa3b67894 as toAddressUrl, $66c3dcaaa74b5389$export$f3f93e5bb54c3de5 as toNationalRegistryNumberString, $66c3dcaaa74b5389$export$648c405ef8d23fec as toPriceString, $66c3dcaaa74b5389$export$155f7ed6f228c17c as toReadableFileSize, $66c3dcaaa74b5389$export$b2669f8969cc59be as toUserName, $66c3dcaaa74b5389$export$d9f806f9324c35ff as toUserInitials, $4e61e073e8ab55ca$export$b7c4e1545c61edee as toDateString, $4e61e073e8ab55ca$export$b489b1fb1454ddcf as toTimeString, $4e61e073e8ab55ca$export$c03bb0116ee09d4b as isValidDate, $4e61e073e8ab55ca$export$9b56e83e909e2c38 as toDateTimeString, $4e61e073e8ab55ca$export$1771f44233a5f72 as toDaysDifference, $4e61e073e8ab55ca$export$8649d02bd537ff66 as latestDateString, $4e61e073e8ab55ca$export$df20409d3177a2e0 as toDateValue, $4e61e073e8ab55ca$export$8a6f307d1b8b1960 as toTimeValue, $4e61e073e8ab55ca$export$8de20099c30464f2 as toUTCDate, $be69f9fa947058ae$export$2e2bcd8739ae039 as DateMenuForm, $00ca07f933061d8a$export$2e2bcd8739ae039 as DateRangeMenuForm, $e964500960620598$export$2e2bcd8739ae039 as __DEPRECATED__CheckboxInputGroupForm, $785bf8949af26aa5$export$2e2bcd8739ae039 as CheckboxInput, $10ded3c19afe27a9$export$2e2bcd8739ae039 as SwitchForm, $aa6702347bcd9c62$export$2e2bcd8739ae039 as RichTextArea, $b1b6aa72505b2474$export$2e2bcd8739ae039 as FileInputGroupForm, $39e9223269e270c7$export$2e2bcd8739ae039 as OpeningsHourInputGroupForm, $c7f1fe1c3b2d56f5$export$2e2bcd8739ae039 as AddressInputGroupForm, $382ffb7c1faa0f62$export$4564041bcff0e281 as useExcel, $48d5b0ffa682dc0b$export$2e2bcd8739ae039 as useExcelMapper, $3f6ca002faff40a3$export$2e2bcd8739ae039 as useColumnHelper, $bcc7539df5bef927$export$1476d5e67a64a695 as escapeSpecialCharacters};
|
|
7288
7711
|
//# sourceMappingURL=index.esm.js.map
|