@councilbox/councilbox-ui 2.0.58 → 2.0.60
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/SafeHtml.js +3 -0
- package/ScrollbarOld.js +3 -0
- package/dist/HOCs/overlayA11yStack.js +1 -1
- package/dist/HOCs/useDynamicStyles.js +39 -4
- package/dist/build-index.js +21 -7
- package/dist/components/Accordion/Accordion.css +7 -1
- package/dist/components/Button/Button.js +79 -87
- package/dist/components/Button/button.css +171 -16
- package/dist/components/DatePicker/Calendar.js +3 -5
- package/dist/components/DatePicker/DatePicker.css +1 -1
- package/dist/components/DateRangePicker/RangeCalendar.js +2 -4
- package/dist/components/IconButton/IconButton.js +1 -1
- package/dist/components/Modal/Modal.js +13 -3
- package/dist/components/RichTextInput/RichTextInput.js +28 -7
- package/dist/components/SafeHtml/SafeHtml.js +82 -0
- package/dist/components/Scrollbar/Scrollbar.css +60 -19
- package/dist/components/Scrollbar/Scrollbar.js +386 -62
- package/dist/components/ScrollbarOld/DesignScrollbarOld.js +24 -0
- package/dist/components/ScrollbarOld/ScrollbarOld.css +38 -0
- package/dist/components/ScrollbarOld/ScrollbarOld.js +104 -0
- package/dist/components/SelectInput/SelectInput.js +1 -0
- package/dist/components/Stepper/Stepper.css +6 -1
- package/dist/components/Tabs/Tabs.js +1 -0
- package/dist/components/TextInput/TextInput.css +164 -1
- package/dist/components/TextInput/TextInput.js +171 -167
- package/dist/components/ThemeProvider/Colors.js +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.js +1 -7
- package/dist/components/Toast/toastStore.js +1 -0
- package/dist/styles/colorConsts.css +1 -1
- package/dist/styles/stylesheet.js +2 -50
- package/dist/testing/TestAutocomplete.js +1 -105
- package/dist/utils/sanitizeHtml.js +199 -0
- package/package.json +18 -32
- package/IconFont.js +0 -3
- package/dist/__snapshots__/storybook.test.js.snap +0 -104
- package/dist/components/1.Introduction.stories.mdx +0 -67
- package/dist/components/2.Changelog.stories.mdx +0 -595
- package/dist/components/3.Guide.stories.mdx +0 -235
- package/dist/components/Accordion/Accordion.stories.js +0 -44
- package/dist/components/Accordion/DesignAccordion.stories.js +0 -27
- package/dist/components/Alert/Alert.stories.js +0 -51
- package/dist/components/Avatar/Avatar.stories.js +0 -100
- package/dist/components/Avatar/DesignAvatar.stories.js +0 -64
- package/dist/components/Avatar/DesignAvatarText.stories.js +0 -123
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +0 -25
- package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +0 -118
- package/dist/components/Block/Block.stories.js +0 -45
- package/dist/components/Block/DesignBlock.stories.js +0 -35
- package/dist/components/Button/Button.stories.js +0 -72
- package/dist/components/ButtonBasic/ButtonBasic.stories.js +0 -108
- package/dist/components/Checkbox/Checkbox.stories.js +0 -41
- package/dist/components/DatePicker/DatePicker.stories.js +0 -180
- package/dist/components/DateRangePicker/DateRangePicker.stories.js +0 -147
- package/dist/components/DateTimePicker/DateTimePicker.stories.js +0 -144
- package/dist/components/DragDrop/DragDrop.stories.js +0 -55
- package/dist/components/DrawerPanel/DrawerPanel.stories.js +0 -51
- package/dist/components/DropDown/DesignDropDown.stories.js +0 -216
- package/dist/components/DropDown/DropDown.stories.js +0 -43
- package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +0 -128
- package/dist/components/EnhancedTable/EnhancedTable.stories.js +0 -49
- package/dist/components/FabButton/DesignFabButton.stories.js +0 -40
- package/dist/components/FabButton/FabButton.stories.js +0 -46
- package/dist/components/Grid/DesignGrid.stories.js +0 -45
- package/dist/components/Grid/Grid.stories.js +0 -37
- package/dist/components/Header/DesignHeader.stories.js +0 -65
- package/dist/components/Header/Header.stories.js +0 -99
- package/dist/components/IconButton/DesignIconButton.stories.js +0 -113
- package/dist/components/IconButton/IconButton.stories.js +0 -40
- package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +0 -21
- package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +0 -39
- package/dist/components/IconFont/IconFont.css +0 -0
- package/dist/components/IconFont/IconFont.js +0 -86
- package/dist/components/IconFont/IconFont.stories.js +0 -36
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +0 -272
- package/dist/components/InputPassword/InputPassword.stories.js +0 -75
- package/dist/components/InputText/InputText.stories.js +0 -100
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +0 -116
- package/dist/components/InputTextArea/InputTextArea.stories.js +0 -40
- package/dist/components/LoadingSection/LoadingSection.stories.js +0 -42
- package/dist/components/MenuItem/DesignMenuItem.stories.js +0 -54
- package/dist/components/MenuItem/MenuItem.stories.js +0 -53
- package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +0 -37
- package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +0 -37
- package/dist/components/Modal/DesignModal.stories.js +0 -39
- package/dist/components/Modal/Modal.stories.js +0 -67
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +0 -22
- package/dist/components/PaginationFooter/PaginationFooter.stories.js +0 -48
- package/dist/components/RadioButton/Radio.stories.js +0 -57
- package/dist/components/RichTextInput/DesignRichTextInput.stories.js +0 -113
- package/dist/components/RichTextInput/RichTextInput.stories.js +0 -33
- package/dist/components/Ripple/Ripple.stories.js +0 -39
- package/dist/components/Scrollbar/Scrollbar.stories.js +0 -37
- package/dist/components/SelectInput/SelectInput.stories.js +0 -81
- package/dist/components/Slider/Slider.stories.js +0 -37
- package/dist/components/Spacing/Spacing.stories.js +0 -32
- package/dist/components/Stars/Stars.stories.js +0 -37
- package/dist/components/Stepper/DesignStepper.stories.js +0 -130
- package/dist/components/Stepper/Stepper.stories.js +0 -41
- package/dist/components/Table/DesignTable.stories.js +0 -614
- package/dist/components/Table/Table.stories.js +0 -53
- package/dist/components/Tabs/Tabs.stories.js +0 -44
- package/dist/components/Tag/DesignTags.stories.js +0 -81
- package/dist/components/Tag/Tag.stories.js +0 -45
- package/dist/components/TextInput/TextInput.stories.js +0 -60
- package/dist/components/TimePicker/TimePicker.stories.js +0 -132
- package/dist/components/Timeline/DesignTimeline.stories.js +0 -19
- package/dist/components/Timeline/Timeline.stories.js +0 -37
- package/dist/components/Toast/DesignToast.stories.js +0 -174
- package/dist/components/Toast/Toast.stories.js +0 -33
- package/dist/components/Toggle/Toggle.stories.js +0 -42
- package/dist/components/Tooltip/DesignTooltip.stories.js +0 -45
- package/dist/components/Tooltip/Tooltip.stories.js +0 -33
- package/dist/components/Typography/Typography.stories.js +0 -73
- package/dist/fonts/IconNames.json +0 -6848
- package/dist/reportWebVitals.js +0 -28
- package/dist/storybook.test.js +0 -5
|
@@ -76,8 +76,7 @@ var RangeCalendar = function RangeCalendar(_ref) {
|
|
|
76
76
|
component: "span",
|
|
77
77
|
variant: "M",
|
|
78
78
|
fontWeight: 600,
|
|
79
|
-
className: prefixClass('cbx-calendar-headerLabel')
|
|
80
|
-
title: "".concat(resolvedMonths[panelDate.getMonth()], " ").concat(panelDate.getFullYear())
|
|
79
|
+
className: prefixClass('cbx-calendar-headerLabel')
|
|
81
80
|
}, "".concat(resolvedMonths[panelDate.getMonth()], " ").concat(panelDate.getFullYear())), isLastPanel ? /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
82
81
|
prefixClass: prefixClass,
|
|
83
82
|
className: "cbx-calendar-navButton",
|
|
@@ -98,8 +97,7 @@ var RangeCalendar = function RangeCalendar(_ref) {
|
|
|
98
97
|
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
99
98
|
key: "".concat(dayLabel, "-").concat(dayIndex),
|
|
100
99
|
className: prefixClass('cbx-calendar-weekday'),
|
|
101
|
-
"aria-hidden": "true"
|
|
102
|
-
title: dayLabel
|
|
100
|
+
"aria-hidden": "true"
|
|
103
101
|
}, dayLabel);
|
|
104
102
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
105
103
|
className: prefixClass('cbx-calendar-grid'),
|
|
@@ -234,7 +234,7 @@ var IconButton = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
234
234
|
'--hover-color': hoverColor
|
|
235
235
|
}, styles), style), stylesInLine)
|
|
236
236
|
}, props, {
|
|
237
|
-
"aria-label": ariaLabel || props['aria-label'] || tooltip || 'Botón'
|
|
237
|
+
"aria-label": ariaLabel || props['aria-label'] || tooltip || (text ? undefined : 'Botón')
|
|
238
238
|
}), progressAuto ? getProgressAuto() : progress && getProgress(), badge ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
239
239
|
className: prefixClass('cbx-IconButton-containerBadge')
|
|
240
240
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -167,11 +167,20 @@ var Modal = function Modal(_ref) {
|
|
|
167
167
|
onClick: acceptAction,
|
|
168
168
|
fullWidth: true
|
|
169
169
|
}, buttonAcceptProps))));
|
|
170
|
+
var backdropMouseDownRef = _react["default"].useRef(false);
|
|
171
|
+
var handleBackgroundMouseDown = function handleBackgroundMouseDown(e) {
|
|
172
|
+
var _contentRef$current;
|
|
173
|
+
backdropMouseDownRef.current = !((_contentRef$current = contentRef.current) !== null && _contentRef$current !== void 0 && _contentRef$current.contains(e.target));
|
|
174
|
+
};
|
|
170
175
|
var handleBackgroundClick = function handleBackgroundClick(e) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
var _contentRef$current2;
|
|
177
|
+
e.stopPropagation();
|
|
178
|
+
var startedOnBackdrop = backdropMouseDownRef.current;
|
|
179
|
+
backdropMouseDownRef.current = false;
|
|
180
|
+
if (disableBackdropClick || !startedOnBackdrop || (_contentRef$current2 = contentRef.current) !== null && _contentRef$current2 !== void 0 && _contentRef$current2.contains(e.target)) {
|
|
181
|
+
return;
|
|
174
182
|
}
|
|
183
|
+
requestClose === null || requestClose === void 0 ? void 0 : requestClose(false);
|
|
175
184
|
};
|
|
176
185
|
var handleContentClick = function handleContentClick(e) {
|
|
177
186
|
e.stopPropagation();
|
|
@@ -181,6 +190,7 @@ var Modal = function Modal(_ref) {
|
|
|
181
190
|
&& /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
182
191
|
ref: containerRef,
|
|
183
192
|
className: prefixClass("cbx-Modal-container ".concat(show ? 'show' : 'hide', " ").concat(classNameDialog || '', " ").concat(className || '', " ")),
|
|
193
|
+
onMouseDown: handleBackgroundMouseDown,
|
|
184
194
|
onClick: handleBackgroundClick,
|
|
185
195
|
onKeyDown: handleKeyDown,
|
|
186
196
|
id: modalId,
|
|
@@ -16,6 +16,7 @@ var _DropDown = _interopRequireDefault(require("../DropDown/DropDown"));
|
|
|
16
16
|
var _usePopoverPosition2 = _interopRequireDefault(require("../../HOCs/usePopoverPosition"));
|
|
17
17
|
var _useFallbackId = _interopRequireDefault(require("../../utils/useFallbackId"));
|
|
18
18
|
var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
|
|
19
|
+
var _sanitizeHtml = require("../../utils/sanitizeHtml");
|
|
19
20
|
var _excluded = ["id", "value", "onChange", "placeholder", "floatingText", "required", "errorText", "disabled", "maxChars", "allowPasteImage", "hideToolbar", "fullHeight", "borderless", "style", "className", "translate", "loadDraft", "saveDraft", "customButton", "toolbarExtra"];
|
|
20
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
21
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -243,7 +244,9 @@ var RichTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, r
|
|
|
243
244
|
};
|
|
244
245
|
_react["default"].useEffect(function () {
|
|
245
246
|
if (editorRef.current) {
|
|
246
|
-
|
|
247
|
+
// `value` entra sin sanitizar al editor via innerHTML: filtramos
|
|
248
|
+
// tags/atributos/URLs peligrosos antes de aplicarlo.
|
|
249
|
+
editorRef.current.innerHTML = (0, _sanitizeHtml.sanitizeEditorHtml)(value || '');
|
|
247
250
|
setCharCount((editorRef.current.textContent || '').length);
|
|
248
251
|
resetHistory(normalizeHtml(editorRef.current.innerHTML));
|
|
249
252
|
}
|
|
@@ -256,7 +259,7 @@ var RichTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, r
|
|
|
256
259
|
if (value === lastValueRef.current) return;
|
|
257
260
|
lastValueRef.current = value;
|
|
258
261
|
if (document.activeElement !== editorRef.current) {
|
|
259
|
-
editorRef.current.innerHTML = value || '';
|
|
262
|
+
editorRef.current.innerHTML = (0, _sanitizeHtml.sanitizeEditorHtml)(value || '');
|
|
260
263
|
setCharCount((editorRef.current.textContent || '').length);
|
|
261
264
|
resetHistory(normalizeHtml(editorRef.current.innerHTML));
|
|
262
265
|
}
|
|
@@ -410,7 +413,12 @@ var RichTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, r
|
|
|
410
413
|
return;
|
|
411
414
|
}
|
|
412
415
|
flushPendingHistory();
|
|
413
|
-
var href =
|
|
416
|
+
var href = (0, _sanitizeHtml.normalizeLinkHref)(url);
|
|
417
|
+
if (!href) {
|
|
418
|
+
// Esquema bloqueado (javascript:, data:, etc.): no insertamos.
|
|
419
|
+
setLinkOpen(false);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
414
422
|
var selection = window.getSelection();
|
|
415
423
|
if (selection && selection.rangeCount > 0 && selection.getRangeAt(0).collapsed) {
|
|
416
424
|
var range = selection.getRangeAt(0);
|
|
@@ -427,7 +435,12 @@ var RichTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, r
|
|
|
427
435
|
} else {
|
|
428
436
|
var _editorRef$current3;
|
|
429
437
|
document.execCommand('createLink', false, href);
|
|
430
|
-
|
|
438
|
+
// `querySelectorAll` recibe el href literal como atributo; usamos
|
|
439
|
+
// `CSS.escape` para que caracteres como `"` no rompan el selector.
|
|
440
|
+
var safeHref = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(href) : href.replace(/[^\w-]/g, function (ch) {
|
|
441
|
+
return "\\".concat(ch);
|
|
442
|
+
});
|
|
443
|
+
var createdAnchors = ((_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 ? void 0 : _editorRef$current3.querySelectorAll("a[href=\"".concat(safeHref, "\"]"))) || [];
|
|
431
444
|
for (var i = 0; i < createdAnchors.length; i += 1) {
|
|
432
445
|
createdAnchors[i].target = '_blank';
|
|
433
446
|
createdAnchors[i].rel = 'noopener noreferrer';
|
|
@@ -496,7 +509,12 @@ var RichTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, r
|
|
|
496
509
|
return;
|
|
497
510
|
}
|
|
498
511
|
flushPendingHistory();
|
|
499
|
-
var href =
|
|
512
|
+
var href = (0, _sanitizeHtml.normalizeLinkHref)(url);
|
|
513
|
+
if (!href) {
|
|
514
|
+
// Esquema bloqueado: cancelamos la edición y cerramos el editor.
|
|
515
|
+
closeLinkEditor();
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
500
518
|
activeLinkAnchor.setAttribute('href', href);
|
|
501
519
|
handleInput();
|
|
502
520
|
pushHistoryImmediate(normalizeHtml((_editorRef$current6 = editorRef.current) === null || _editorRef$current6 === void 0 ? void 0 : _editorRef$current6.innerHTML));
|
|
@@ -536,7 +554,9 @@ var RichTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, r
|
|
|
536
554
|
selection.removeAllRanges();
|
|
537
555
|
selection.addRange(endRange);
|
|
538
556
|
}
|
|
539
|
-
|
|
557
|
+
// Sanitizamos el HTML antes de pasarlo a execCommand: insertHTML lo
|
|
558
|
+
// parsea tal cual al DOM del editor.
|
|
559
|
+
document.execCommand('insertHTML', false, (0, _sanitizeHtml.sanitizeEditorHtml)(html));
|
|
540
560
|
handleInput();
|
|
541
561
|
pushHistoryImmediate(normalizeHtml(editorRef.current.innerHTML));
|
|
542
562
|
updateToolbarState();
|
|
@@ -581,7 +601,8 @@ var RichTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, r
|
|
|
581
601
|
return {
|
|
582
602
|
setValue: function setValue(html) {
|
|
583
603
|
if (!editorRef.current) return;
|
|
584
|
-
|
|
604
|
+
// Sanitizamos: `setValue` acepta HTML externo y acabará en innerHTML.
|
|
605
|
+
var normalized = (0, _sanitizeHtml.sanitizeEditorHtml)(html || '');
|
|
585
606
|
editorRef.current.innerHTML = normalized;
|
|
586
607
|
lastValueRef.current = normalized;
|
|
587
608
|
setCharCount((editorRef.current.textContent || '').length);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
11
|
+
var _sanitizeHtml = require("../../utils/sanitizeHtml");
|
|
12
|
+
var _excluded = ["html", "component", "className", "style", "sx", "sanitizeOptions", "prefixClass", "children"];
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
22
|
+
var toHtmlString = function toHtmlString(html) {
|
|
23
|
+
if (html === null || html === undefined || html === false) return '';
|
|
24
|
+
return typeof html === 'string' ? html : String(html);
|
|
25
|
+
};
|
|
26
|
+
var SafeHtml = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
27
|
+
var html = _ref.html,
|
|
28
|
+
component = _ref.component,
|
|
29
|
+
className = _ref.className,
|
|
30
|
+
style = _ref.style,
|
|
31
|
+
sx = _ref.sx,
|
|
32
|
+
sanitizeOptions = _ref.sanitizeOptions,
|
|
33
|
+
propPrefixClass = _ref.prefixClass,
|
|
34
|
+
children = _ref.children,
|
|
35
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
37
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
38
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
39
|
+
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
40
|
+
var Component = component || 'div';
|
|
41
|
+
var optionsKey = JSON.stringify({
|
|
42
|
+
extraForbidTags: (sanitizeOptions === null || sanitizeOptions === void 0 ? void 0 : sanitizeOptions.extraForbidTags) || [],
|
|
43
|
+
extraForbidAttrs: (sanitizeOptions === null || sanitizeOptions === void 0 ? void 0 : sanitizeOptions.extraForbidAttrs) || [],
|
|
44
|
+
allowTags: (sanitizeOptions === null || sanitizeOptions === void 0 ? void 0 : sanitizeOptions.allowTags) || [],
|
|
45
|
+
allowAttrs: (sanitizeOptions === null || sanitizeOptions === void 0 ? void 0 : sanitizeOptions.allowAttrs) || []
|
|
46
|
+
});
|
|
47
|
+
var sanitizedHtml = _react["default"].useMemo(function () {
|
|
48
|
+
return (0, _sanitizeHtml.sanitizeEditorHtml)(toHtmlString(html), JSON.parse(optionsKey));
|
|
49
|
+
}, [html, optionsKey]);
|
|
50
|
+
return /*#__PURE__*/_react["default"].createElement(Component, _extends({
|
|
51
|
+
ref: ref,
|
|
52
|
+
className: prefixClass("cbx-SafeHtml ".concat(className || '')),
|
|
53
|
+
style: _objectSpread(_objectSpread({}, style), stylesInLine)
|
|
54
|
+
}, props, {
|
|
55
|
+
dangerouslySetInnerHTML: {
|
|
56
|
+
__html: sanitizedHtml
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
});
|
|
60
|
+
SafeHtml.propTypes = {
|
|
61
|
+
html: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
62
|
+
component: _propTypes["default"].string,
|
|
63
|
+
className: _propTypes["default"].string,
|
|
64
|
+
style: _propTypes["default"].object,
|
|
65
|
+
sx: _propTypes["default"].object,
|
|
66
|
+
sanitizeOptions: _propTypes["default"].shape({
|
|
67
|
+
extraForbidTags: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
68
|
+
extraForbidAttrs: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
69
|
+
allowTags: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
70
|
+
allowAttrs: _propTypes["default"].arrayOf(_propTypes["default"].string)
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
SafeHtml.defaultProps = {
|
|
74
|
+
html: '',
|
|
75
|
+
component: 'div',
|
|
76
|
+
className: '',
|
|
77
|
+
style: undefined,
|
|
78
|
+
sx: undefined,
|
|
79
|
+
sanitizeOptions: undefined
|
|
80
|
+
};
|
|
81
|
+
var _default = SafeHtml;
|
|
82
|
+
exports["default"] = _default;
|
|
@@ -1,38 +1,79 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
1
|
+
.Scrollbar>.cbx-scrollbarNew-view {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
overflow-y: auto;
|
|
8
|
+
overflow-x: hidden;
|
|
3
9
|
scroll-behavior: smooth;
|
|
10
|
+
-webkit-overflow-scrolling: touch;
|
|
11
|
+
scrollbar-width: none;
|
|
4
12
|
}
|
|
5
13
|
|
|
6
|
-
.Scrollbar
|
|
7
|
-
|
|
14
|
+
.Scrollbar.ScrollbarMobile>.cbx-scrollbarNew-view {
|
|
15
|
+
scrollbar-width: auto;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.Scrollbar:not(.ScrollbarMobile)>.cbx-scrollbarNew-view::-webkit-scrollbar {
|
|
19
|
+
display: none;
|
|
8
20
|
}
|
|
9
21
|
|
|
10
|
-
.scrollbarBoth
|
|
11
|
-
|
|
12
|
-
margin-bottom: -0 !important;
|
|
13
|
-
overflow-x: auto !important;
|
|
22
|
+
.scrollbarBoth>.cbx-scrollbarNew-view {
|
|
23
|
+
overflow-x: auto;
|
|
14
24
|
}
|
|
15
25
|
|
|
16
|
-
.scrollbarOnlyY
|
|
17
|
-
overflow-x: hidden
|
|
18
|
-
margin-right: -17px !important;
|
|
19
|
-
margin-bottom: -0 !important;
|
|
26
|
+
.scrollbarOnlyY>.cbx-scrollbarNew-view {
|
|
27
|
+
overflow-x: hidden;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
|
-
.scrollflex
|
|
30
|
+
.scrollflex>.cbx-scrollbarNew-view {
|
|
23
31
|
display: flex;
|
|
24
32
|
flex-grow: 1;
|
|
25
33
|
min-height: 100%;
|
|
26
34
|
}
|
|
27
35
|
|
|
28
|
-
.
|
|
29
|
-
|
|
36
|
+
.cbx-scrollbarNew-trackVertical,
|
|
37
|
+
.cbx-scrollbarNew-trackHorizontal {
|
|
38
|
+
position: absolute;
|
|
39
|
+
opacity: 1;
|
|
40
|
+
transition-property: opacity;
|
|
41
|
+
transition-timing-function: ease;
|
|
30
42
|
}
|
|
31
43
|
|
|
32
|
-
.
|
|
33
|
-
|
|
44
|
+
.cbx-scrollbarNew-trackVertical {
|
|
45
|
+
top: 2px;
|
|
46
|
+
right: 2px;
|
|
47
|
+
bottom: 2px;
|
|
48
|
+
width: 6px;
|
|
49
|
+
border-radius: 3px;
|
|
34
50
|
}
|
|
35
51
|
|
|
36
|
-
.
|
|
37
|
-
|
|
52
|
+
.cbx-scrollbarNew-trackHorizontal {
|
|
53
|
+
left: 2px;
|
|
54
|
+
right: 2px;
|
|
55
|
+
bottom: 2px;
|
|
56
|
+
height: 6px;
|
|
57
|
+
border-radius: 3px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.cbx-scrollbarNew-thumbVertical,
|
|
61
|
+
.cbx-scrollbarNew-thumbHorizontal {
|
|
62
|
+
position: relative;
|
|
63
|
+
background-color: rgba(0, 0, 0, .2);
|
|
64
|
+
border-radius: inherit;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.cbx-scrollbarNew-thumbVertical {
|
|
69
|
+
width: 100%;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.cbx-scrollbarNew-thumbHorizontal {
|
|
73
|
+
height: 100%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ScrollbarMobile .cbx-scrollbarNew-trackVertical,
|
|
77
|
+
.ScrollbarMobile .cbx-scrollbarNew-trackHorizontal {
|
|
78
|
+
display: none;
|
|
38
79
|
}
|