@commercetools-uikit/rich-text-utils 19.20.1 → 19.22.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.
|
@@ -34,6 +34,7 @@ var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/insta
|
|
|
34
34
|
require('prop-types');
|
|
35
35
|
var react = require('react');
|
|
36
36
|
var inputUtils = require('@commercetools-uikit/input-utils');
|
|
37
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
37
38
|
var _styled = require('@emotion/styled/base');
|
|
38
39
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
39
40
|
var designSystem = require('@commercetools-uikit/design-system');
|
|
@@ -1187,29 +1188,38 @@ const DropdownItemLabelWrapper = /*#__PURE__*/_styled__default["default"]("div",
|
|
|
1187
1188
|
target: "e1f4n71b0"
|
|
1188
1189
|
} )("margin:0 0 0 ", designSystem.designTokens.spacing20, ";" + ("" ));
|
|
1189
1190
|
|
|
1191
|
+
const _excluded$1 = ["components", "isMulti"];
|
|
1190
1192
|
function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1191
1193
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$1(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$1(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1192
|
-
const Label = _styled__default["default"]("div", {
|
|
1194
|
+
const Label = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1193
1195
|
target: "e176a1kh0"
|
|
1194
|
-
} );
|
|
1196
|
+
} )("" );
|
|
1195
1197
|
var _ref$1 = {
|
|
1196
1198
|
name: "bjn8wh",
|
|
1197
1199
|
styles: "position:relative"
|
|
1198
1200
|
} ;
|
|
1199
|
-
const Dropdown =
|
|
1201
|
+
const Dropdown = _ref2 => {
|
|
1200
1202
|
var _context;
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1203
|
+
let _ref2$components = _ref2.components,
|
|
1204
|
+
components = _ref2$components === void 0 ? {
|
|
1205
|
+
Item: DropdownItem,
|
|
1206
|
+
Label
|
|
1207
|
+
} : _ref2$components,
|
|
1208
|
+
_ref2$isMulti = _ref2.isMulti,
|
|
1209
|
+
isMulti = _ref2$isMulti === void 0 ? false : _ref2$isMulti,
|
|
1210
|
+
props = _objectWithoutProperties(_ref2, _excluded$1);
|
|
1211
|
+
const DropdownItem$1 = components.Item;
|
|
1212
|
+
const DropdownLabel = components.Label;
|
|
1213
|
+
const isIndeterminate = isMulti && _someInstanceProperty__default["default"](_context = props.options).call(_context, item => props.getIsItemSelected(item) === true);
|
|
1204
1214
|
const Downshift = DownshiftUntyped__default["default"];
|
|
1205
1215
|
return jsxRuntime.jsx(Downshift, {
|
|
1206
1216
|
onChange: props.onChange,
|
|
1207
1217
|
itemToString: headings => headings?.label || '',
|
|
1208
|
-
children:
|
|
1218
|
+
children: _ref3 => {
|
|
1209
1219
|
var _context2;
|
|
1210
|
-
let isOpen =
|
|
1211
|
-
getToggleButtonProps =
|
|
1212
|
-
getItemProps =
|
|
1220
|
+
let isOpen = _ref3.isOpen,
|
|
1221
|
+
getToggleButtonProps = _ref3.getToggleButtonProps,
|
|
1222
|
+
getItemProps = _ref3.getItemProps;
|
|
1213
1223
|
const toggleButtonProps = getToggleButtonProps();
|
|
1214
1224
|
return jsxRuntime.jsxs("div", {
|
|
1215
1225
|
children: [jsxRuntime.jsx(Tooltip__default["default"], {
|
|
@@ -1226,7 +1236,7 @@ const Dropdown = props => {
|
|
|
1226
1236
|
css: getButtonStyles({
|
|
1227
1237
|
isOpen,
|
|
1228
1238
|
isIndeterminate,
|
|
1229
|
-
isStyleButton: !
|
|
1239
|
+
isStyleButton: !isMulti,
|
|
1230
1240
|
isDisabled: props.isDisabled,
|
|
1231
1241
|
isReadOnly: props.isReadOnly
|
|
1232
1242
|
}),
|
|
@@ -1243,7 +1253,7 @@ const Dropdown = props => {
|
|
|
1243
1253
|
item
|
|
1244
1254
|
});
|
|
1245
1255
|
const dropdownItemProps = itemProps;
|
|
1246
|
-
return react$1.createElement(DropdownItem, _objectSpread$1(_objectSpread$1({}, dropdownItemProps), {}, {
|
|
1256
|
+
return react$1.createElement(DropdownItem$1, _objectSpread$1(_objectSpread$1({}, dropdownItemProps), {}, {
|
|
1247
1257
|
key: index,
|
|
1248
1258
|
value: item.value,
|
|
1249
1259
|
isSelected: props.getIsItemSelected(item)
|
|
@@ -1259,13 +1269,6 @@ const Dropdown = props => {
|
|
|
1259
1269
|
};
|
|
1260
1270
|
Dropdown.propTypes = {};
|
|
1261
1271
|
Dropdown.displayName = 'Dropdown';
|
|
1262
|
-
Dropdown.defaultProps = {
|
|
1263
|
-
components: {
|
|
1264
|
-
Item: DropdownItem,
|
|
1265
|
-
Label
|
|
1266
|
-
},
|
|
1267
|
-
isMulti: false
|
|
1268
|
-
};
|
|
1269
1272
|
var Dropdown$1 = Dropdown;
|
|
1270
1273
|
|
|
1271
1274
|
var messages = reactIntl.defineMessages({
|
|
@@ -1407,6 +1410,7 @@ const BlockButton = props => {
|
|
|
1407
1410
|
};
|
|
1408
1411
|
BlockButton.propTypes = {};
|
|
1409
1412
|
|
|
1413
|
+
const _excluded = ["styles"];
|
|
1410
1414
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1411
1415
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1412
1416
|
const MoreStylesDropdownLabel = () => jsxRuntime.jsx(MoreStylesIcon$1, {
|
|
@@ -1519,31 +1523,34 @@ var _ref = {
|
|
|
1519
1523
|
name: "1h10g35",
|
|
1520
1524
|
styles: "display:flex;flex-wrap:wrap;>*{margin-left:1px;}"
|
|
1521
1525
|
} ;
|
|
1522
|
-
const RichTextEditorBody = /*#__PURE__*/react.forwardRef((
|
|
1526
|
+
const RichTextEditorBody = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
1527
|
+
let _ref2$styles = _ref2.styles,
|
|
1528
|
+
styles = _ref2$styles === void 0 ? {} : _ref2$styles,
|
|
1529
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
1523
1530
|
// NOTE: the forwarded ref is an object of refs, thus making it a bit trickier to type.
|
|
1524
|
-
const
|
|
1525
|
-
registerContentNode =
|
|
1526
|
-
containerRef =
|
|
1531
|
+
const _ref3 = ref,
|
|
1532
|
+
registerContentNode = _ref3.registerContentNode,
|
|
1533
|
+
containerRef = _ref3.containerRef;
|
|
1527
1534
|
const intl = reactIntl.useIntl();
|
|
1528
1535
|
const editor = slateReact.useSlate();
|
|
1529
1536
|
const dropdownOptions = createMoreStylesDropdownOptions(intl);
|
|
1530
1537
|
const styleDropdownOptions = createStyleDropdownOptions(intl);
|
|
1531
1538
|
const hasUndos = editor.history.undos.length > 0;
|
|
1532
1539
|
const hasRedos = editor.history.redos.length > 0;
|
|
1533
|
-
const onClickBlock = react.useCallback(
|
|
1534
|
-
let format =
|
|
1540
|
+
const onClickBlock = react.useCallback(_ref4 => {
|
|
1541
|
+
let format = _ref4.value;
|
|
1535
1542
|
toggleBlock(editor, format);
|
|
1536
1543
|
}, [editor]);
|
|
1537
|
-
const onClickMoreStyleMark = react.useCallback(
|
|
1538
|
-
let format =
|
|
1544
|
+
const onClickMoreStyleMark = react.useCallback(_ref5 => {
|
|
1545
|
+
let format = _ref5.value;
|
|
1539
1546
|
toggleMark(editor, format);
|
|
1540
1547
|
}, [editor]);
|
|
1541
|
-
const getIsMoreStyleMarkItemSelected = react.useCallback(
|
|
1542
|
-
let format =
|
|
1548
|
+
const getIsMoreStyleMarkItemSelected = react.useCallback(_ref6 => {
|
|
1549
|
+
let format = _ref6.value;
|
|
1543
1550
|
return isMarkActive(editor, format);
|
|
1544
1551
|
}, [editor]);
|
|
1545
|
-
const getIsBlockItemSelected = react.useCallback(
|
|
1546
|
-
let format =
|
|
1552
|
+
const getIsBlockItemSelected = react.useCallback(_ref7 => {
|
|
1553
|
+
let format = _ref7.value;
|
|
1547
1554
|
return isBlockActive(editor, format);
|
|
1548
1555
|
}, [editor]);
|
|
1549
1556
|
|
|
@@ -1556,7 +1563,7 @@ const RichTextEditorBody = /*#__PURE__*/react.forwardRef((props, ref) => {
|
|
|
1556
1563
|
}, []);
|
|
1557
1564
|
if (props.showExpandIcon) ;
|
|
1558
1565
|
return jsxRuntime.jsxs(Container, {
|
|
1559
|
-
css:
|
|
1566
|
+
css: styles?.container,
|
|
1560
1567
|
hasError: props.hasError,
|
|
1561
1568
|
hasWarning: props.hasWarning,
|
|
1562
1569
|
isReadOnly: props.isReadOnly,
|
|
@@ -1720,15 +1727,11 @@ const RichTextEditorBody = /*#__PURE__*/react.forwardRef((props, ref) => {
|
|
|
1720
1727
|
})]
|
|
1721
1728
|
});
|
|
1722
1729
|
});
|
|
1723
|
-
const defaultProps = {
|
|
1724
|
-
styles: {}
|
|
1725
|
-
};
|
|
1726
1730
|
RichTextEditorBody.displayName = 'RichTextEditorBody';
|
|
1727
|
-
RichTextEditorBody.defaultProps = defaultProps;
|
|
1728
1731
|
var RichTextEditorBody$1 = RichTextEditorBody;
|
|
1729
1732
|
|
|
1730
1733
|
// NOTE: This string will be replaced on build time with the package version.
|
|
1731
|
-
var version = "19.
|
|
1734
|
+
var version = "19.22.0";
|
|
1732
1735
|
|
|
1733
1736
|
exports.Element = Element;
|
|
1734
1737
|
exports.HiddenInput = HiddenInput$1;
|