@commercetools-uikit/localized-rich-text-input 19.20.0 → 19.21.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.
@@ -9,6 +9,7 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
9
9
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
10
10
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
11
11
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
12
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
12
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
13
14
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
14
15
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
@@ -477,12 +478,9 @@ const RequiredValueErrorMessage = () => jsxRuntime.jsx(messages.ErrorMessage, {
477
478
  RequiredValueErrorMessage.displayName = 'RequiredValueErrorMessage';
478
479
  var RequiredValueErrorMessage$1 = RequiredValueErrorMessage;
479
480
 
481
+ const _excluded = ["horizontalConstraint", "showExpandIcon"];
480
482
  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; }
481
483
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
482
- const defaultProps = {
483
- horizontalConstraint: 'scale',
484
- showExpandIcon: false
485
- };
486
484
  const expandedTranslationsReducer = (state, action) => {
487
485
  switch (action.type) {
488
486
  case 'toggle':
@@ -510,12 +508,17 @@ const expandedTranslationsReducer = (state, action) => {
510
508
  // can get quite confusing. We try to stick to expand/collapse for the
511
509
  // multiline inputs, while we use show/hide/open/close for the remaining
512
510
  // languages.
513
- const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((props, ref) => {
511
+ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((_ref, ref) => {
514
512
  var _context2;
513
+ let _ref$horizontalConstr = _ref.horizontalConstraint,
514
+ horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
515
+ _ref$showExpandIcon = _ref.showExpandIcon,
516
+ showExpandIcon = _ref$showExpandIcon === void 0 ? false : _ref$showExpandIcon,
517
+ props = _objectWithoutProperties(_ref, _excluded);
515
518
  if (!props.isReadOnly) {
516
519
  process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onChange === 'function', 'LocalizedRichTextInput: `onChange` is required when input is not read only.') : void 0;
517
520
  }
518
- if (props.showExpandIcon) {
521
+ if (showExpandIcon) {
519
522
  process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onClickExpand === 'function', 'LocalizedRichTextInput: "onClickExpand" is required when showExpandIcon is true') : void 0;
520
523
  }
521
524
  if (props.hideLanguageExpansionControls) {
@@ -575,7 +578,7 @@ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((props, ref) => {
575
578
  });
576
579
  const shouldRenderLanguagesControl = languages.length > 1 && !props.hideLanguageExpansionControls;
577
580
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
578
- max: props.horizontalConstraint,
581
+ max: horizontalConstraint,
579
582
  children: jsxRuntime.jsxs(Stack__default["default"], {
580
583
  scale: "xs",
581
584
  children: [jsxRuntime.jsx(Stack__default["default"], {
@@ -603,7 +606,7 @@ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((props, ref) => {
603
606
  warning: props.warnings && props.warnings[language],
604
607
  error: props.errors && props.errors[language],
605
608
  additionalInfo: props.additionalInfo && props.additionalInfo[language],
606
- showExpandIcon: props.showExpandIcon,
609
+ showExpandIcon: showExpandIcon,
607
610
  onClickExpand: props.onClickExpand,
608
611
  hasLanguagesControl: hasLanguagesControl,
609
612
  defaultExpandMultilineText: Boolean(props.defaultExpandMultilineText),
@@ -623,7 +626,6 @@ LocalizedRichTextInput.displayName = 'LocalizedRichTextInput';
623
626
  LocalizedRichTextInput.RequiredValueErrorMessage = RequiredValueErrorMessage$1;
624
627
  LocalizedRichTextInput.getId = localizedUtils.getId;
625
628
  LocalizedRichTextInput.getName = localizedUtils.getName;
626
- LocalizedRichTextInput.defaultProps = defaultProps;
627
629
  LocalizedRichTextInput.createLocalizedString = richTextUtils.localized.createLocalizedString;
628
630
  LocalizedRichTextInput.isEmpty = richTextUtils.localized.isEmpty;
629
631
  LocalizedRichTextInput.omitEmptyTranslations = richTextUtils.localized.omitEmptyTranslations;
@@ -631,7 +633,7 @@ LocalizedRichTextInput.isTouched = localizedUtils.isTouched;
631
633
  var LocalizedRichTextInput$1 = LocalizedRichTextInput;
632
634
 
633
635
  // NOTE: This string will be replaced on build time with the package version.
634
- var version = "19.20.0";
636
+ var version = "19.21.0";
635
637
 
636
638
  exports["default"] = LocalizedRichTextInput$1;
637
639
  exports.version = version;
@@ -9,6 +9,7 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
9
9
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
10
10
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
11
11
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
12
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
12
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
13
14
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
14
15
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
@@ -412,12 +413,9 @@ const RequiredValueErrorMessage = () => jsxRuntime.jsx(messages.ErrorMessage, {
412
413
  RequiredValueErrorMessage.displayName = 'RequiredValueErrorMessage';
413
414
  var RequiredValueErrorMessage$1 = RequiredValueErrorMessage;
414
415
 
416
+ const _excluded = ["horizontalConstraint", "showExpandIcon"];
415
417
  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; }
416
418
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
417
- const defaultProps = {
418
- horizontalConstraint: 'scale',
419
- showExpandIcon: false
420
- };
421
419
  const expandedTranslationsReducer = (state, action) => {
422
420
  switch (action.type) {
423
421
  case 'toggle':
@@ -445,10 +443,14 @@ const expandedTranslationsReducer = (state, action) => {
445
443
  // can get quite confusing. We try to stick to expand/collapse for the
446
444
  // multiline inputs, while we use show/hide/open/close for the remaining
447
445
  // languages.
448
- const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((props, ref) => {
446
+ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((_ref, ref) => {
449
447
  var _context2;
448
+ let _ref$horizontalConstr = _ref.horizontalConstraint,
449
+ horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
450
+ _ref$showExpandIcon = _ref.showExpandIcon,
451
+ showExpandIcon = _ref$showExpandIcon === void 0 ? false : _ref$showExpandIcon,
452
+ props = _objectWithoutProperties(_ref, _excluded);
450
453
  if (!props.isReadOnly) ;
451
- if (props.showExpandIcon) ;
452
454
  if (props.hideLanguageExpansionControls) ;
453
455
  const initialExpandedTranslationsState = _reduceInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](props.value)).call(_context2, (translations, locale) => _objectSpread(_objectSpread({}, translations), {}, {
454
456
  [locale]: Boolean(props.defaultExpandMultilineText)
@@ -504,7 +506,7 @@ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((props, ref) => {
504
506
  });
505
507
  const shouldRenderLanguagesControl = languages.length > 1 && !props.hideLanguageExpansionControls;
506
508
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
507
- max: props.horizontalConstraint,
509
+ max: horizontalConstraint,
508
510
  children: jsxRuntime.jsxs(Stack__default["default"], {
509
511
  scale: "xs",
510
512
  children: [jsxRuntime.jsx(Stack__default["default"], {
@@ -532,7 +534,7 @@ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((props, ref) => {
532
534
  warning: props.warnings && props.warnings[language],
533
535
  error: props.errors && props.errors[language],
534
536
  additionalInfo: props.additionalInfo && props.additionalInfo[language],
535
- showExpandIcon: props.showExpandIcon,
537
+ showExpandIcon: showExpandIcon,
536
538
  onClickExpand: props.onClickExpand,
537
539
  hasLanguagesControl: hasLanguagesControl,
538
540
  defaultExpandMultilineText: Boolean(props.defaultExpandMultilineText),
@@ -552,7 +554,6 @@ LocalizedRichTextInput.displayName = 'LocalizedRichTextInput';
552
554
  LocalizedRichTextInput.RequiredValueErrorMessage = RequiredValueErrorMessage$1;
553
555
  LocalizedRichTextInput.getId = localizedUtils.getId;
554
556
  LocalizedRichTextInput.getName = localizedUtils.getName;
555
- LocalizedRichTextInput.defaultProps = defaultProps;
556
557
  LocalizedRichTextInput.createLocalizedString = richTextUtils.localized.createLocalizedString;
557
558
  LocalizedRichTextInput.isEmpty = richTextUtils.localized.isEmpty;
558
559
  LocalizedRichTextInput.omitEmptyTranslations = richTextUtils.localized.omitEmptyTranslations;
@@ -560,7 +561,7 @@ LocalizedRichTextInput.isTouched = localizedUtils.isTouched;
560
561
  var LocalizedRichTextInput$1 = LocalizedRichTextInput;
561
562
 
562
563
  // NOTE: This string will be replaced on build time with the package version.
563
- var version = "19.20.0";
564
+ var version = "19.21.0";
564
565
 
565
566
  exports["default"] = LocalizedRichTextInput$1;
566
567
  exports.version = version;
@@ -5,6 +5,7 @@ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-st
5
5
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
6
6
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
7
7
  import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
8
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
8
9
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
9
10
  import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
10
11
  import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
@@ -449,12 +450,9 @@ const RequiredValueErrorMessage = () => jsx(ErrorMessage, {
449
450
  RequiredValueErrorMessage.displayName = 'RequiredValueErrorMessage';
450
451
  var RequiredValueErrorMessage$1 = RequiredValueErrorMessage;
451
452
 
453
+ const _excluded = ["horizontalConstraint", "showExpandIcon"];
452
454
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
453
455
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
454
- const defaultProps = {
455
- horizontalConstraint: 'scale',
456
- showExpandIcon: false
457
- };
458
456
  const expandedTranslationsReducer = (state, action) => {
459
457
  switch (action.type) {
460
458
  case 'toggle':
@@ -482,12 +480,17 @@ const expandedTranslationsReducer = (state, action) => {
482
480
  // can get quite confusing. We try to stick to expand/collapse for the
483
481
  // multiline inputs, while we use show/hide/open/close for the remaining
484
482
  // languages.
485
- const LocalizedRichTextInput = /*#__PURE__*/forwardRef((props, ref) => {
483
+ const LocalizedRichTextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
486
484
  var _context2;
485
+ let _ref$horizontalConstr = _ref.horizontalConstraint,
486
+ horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
487
+ _ref$showExpandIcon = _ref.showExpandIcon,
488
+ showExpandIcon = _ref$showExpandIcon === void 0 ? false : _ref$showExpandIcon,
489
+ props = _objectWithoutProperties(_ref, _excluded);
487
490
  if (!props.isReadOnly) {
488
491
  process.env.NODE_ENV !== "production" ? warning(typeof props.onChange === 'function', 'LocalizedRichTextInput: `onChange` is required when input is not read only.') : void 0;
489
492
  }
490
- if (props.showExpandIcon) {
493
+ if (showExpandIcon) {
491
494
  process.env.NODE_ENV !== "production" ? warning(typeof props.onClickExpand === 'function', 'LocalizedRichTextInput: "onClickExpand" is required when showExpandIcon is true') : void 0;
492
495
  }
493
496
  if (props.hideLanguageExpansionControls) {
@@ -547,7 +550,7 @@ const LocalizedRichTextInput = /*#__PURE__*/forwardRef((props, ref) => {
547
550
  });
548
551
  const shouldRenderLanguagesControl = languages.length > 1 && !props.hideLanguageExpansionControls;
549
552
  return jsx(Constraints.Horizontal, {
550
- max: props.horizontalConstraint,
553
+ max: horizontalConstraint,
551
554
  children: jsxs(Stack, {
552
555
  scale: "xs",
553
556
  children: [jsx(Stack, {
@@ -575,7 +578,7 @@ const LocalizedRichTextInput = /*#__PURE__*/forwardRef((props, ref) => {
575
578
  warning: props.warnings && props.warnings[language],
576
579
  error: props.errors && props.errors[language],
577
580
  additionalInfo: props.additionalInfo && props.additionalInfo[language],
578
- showExpandIcon: props.showExpandIcon,
581
+ showExpandIcon: showExpandIcon,
579
582
  onClickExpand: props.onClickExpand,
580
583
  hasLanguagesControl: hasLanguagesControl,
581
584
  defaultExpandMultilineText: Boolean(props.defaultExpandMultilineText),
@@ -595,7 +598,6 @@ LocalizedRichTextInput.displayName = 'LocalizedRichTextInput';
595
598
  LocalizedRichTextInput.RequiredValueErrorMessage = RequiredValueErrorMessage$1;
596
599
  LocalizedRichTextInput.getId = getId;
597
600
  LocalizedRichTextInput.getName = getName;
598
- LocalizedRichTextInput.defaultProps = defaultProps;
599
601
  LocalizedRichTextInput.createLocalizedString = localized.createLocalizedString;
600
602
  LocalizedRichTextInput.isEmpty = localized.isEmpty;
601
603
  LocalizedRichTextInput.omitEmptyTranslations = localized.omitEmptyTranslations;
@@ -603,6 +605,6 @@ LocalizedRichTextInput.isTouched = isTouched;
603
605
  var LocalizedRichTextInput$1 = LocalizedRichTextInput;
604
606
 
605
607
  // NOTE: This string will be replaced on build time with the package version.
606
- var version = "19.20.0";
608
+ var version = "19.21.0";
607
609
 
608
610
  export { LocalizedRichTextInput$1 as default, version };
@@ -100,7 +100,7 @@ export type TLocalizedRichTextInputProps = {
100
100
  /**
101
101
  * Shows an `expand` icon in the toolbar
102
102
  */
103
- showExpandIcon: boolean;
103
+ showExpandIcon?: boolean;
104
104
  /**
105
105
  * Called when the `expand` button is clicked
106
106
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/localized-rich-text-input",
3
3
  "description": "A controlled text input component for localized rich text input with validation states.",
4
- "version": "19.20.0",
4
+ "version": "19.21.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,21 +21,21 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
24
- "@commercetools-uikit/collapsible-motion": "19.20.0",
25
- "@commercetools-uikit/constraints": "19.20.0",
26
- "@commercetools-uikit/design-system": "19.20.0",
27
- "@commercetools-uikit/flat-button": "19.20.0",
28
- "@commercetools-uikit/hooks": "19.20.0",
29
- "@commercetools-uikit/icons": "19.20.0",
30
- "@commercetools-uikit/input-utils": "19.20.0",
31
- "@commercetools-uikit/localized-utils": "19.20.0",
32
- "@commercetools-uikit/messages": "19.20.0",
33
- "@commercetools-uikit/rich-text-utils": "19.20.0",
34
- "@commercetools-uikit/spacings-inline": "19.20.0",
35
- "@commercetools-uikit/spacings-stack": "19.20.0",
36
- "@commercetools-uikit/text": "19.20.0",
37
- "@commercetools-uikit/tooltip": "19.20.0",
38
- "@commercetools-uikit/utils": "19.20.0",
24
+ "@commercetools-uikit/collapsible-motion": "19.21.0",
25
+ "@commercetools-uikit/constraints": "19.21.0",
26
+ "@commercetools-uikit/design-system": "19.21.0",
27
+ "@commercetools-uikit/flat-button": "19.21.0",
28
+ "@commercetools-uikit/hooks": "19.21.0",
29
+ "@commercetools-uikit/icons": "19.21.0",
30
+ "@commercetools-uikit/input-utils": "19.21.0",
31
+ "@commercetools-uikit/localized-utils": "19.21.0",
32
+ "@commercetools-uikit/messages": "19.21.0",
33
+ "@commercetools-uikit/rich-text-utils": "19.21.0",
34
+ "@commercetools-uikit/spacings-inline": "19.21.0",
35
+ "@commercetools-uikit/spacings-stack": "19.21.0",
36
+ "@commercetools-uikit/text": "19.21.0",
37
+ "@commercetools-uikit/tooltip": "19.21.0",
38
+ "@commercetools-uikit/utils": "19.21.0",
39
39
  "@emotion/react": "^11.10.5",
40
40
  "@emotion/styled": "^11.10.5",
41
41
  "downshift": "6.1.12",