@moda/om 17.3.0 → 17.4.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.esm.js CHANGED
@@ -1286,14 +1286,15 @@ var classnames = {exports: {}};
1286
1286
  }
1287
1287
  }
1288
1288
  } else if (argType === 'object') {
1289
- if (arg.toString === Object.prototype.toString) {
1290
- for (var key in arg) {
1291
- if (hasOwn.call(arg, key) && arg[key]) {
1292
- classes.push(key);
1293
- }
1294
- }
1295
- } else {
1289
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
1296
1290
  classes.push(arg.toString());
1291
+ continue;
1292
+ }
1293
+
1294
+ for (var key in arg) {
1295
+ if (hasOwn.call(arg, key) && arg[key]) {
1296
+ classes.push(key);
1297
+ }
1297
1298
  }
1298
1299
  }
1299
1300
  }
@@ -1583,9 +1584,6 @@ function useMergeRefs(refs, defaultValue) {
1583
1584
  });
1584
1585
  }
1585
1586
 
1586
- // Only Node.JS has a process variable that is of [[Class]] process
1587
- Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
1588
-
1589
1587
  function ItoI(a) {
1590
1588
  return a;
1591
1589
  }
@@ -3385,6 +3383,7 @@ FocusLock.defaultProps = {
3385
3383
  onActivation: undefined,
3386
3384
  onDeactivation: undefined
3387
3385
  };
3386
+ var FocusLockUI = FocusLock;
3388
3387
 
3389
3388
  function deferAction(action) {
3390
3389
  // Hidding setImmediate from Webpack to avoid inserting polyfill
@@ -3398,28 +3397,9 @@ function deferAction(action) {
3398
3397
  }
3399
3398
  }
3400
3399
 
3401
- process.env.NODE_ENV !== "production" ? {
3402
- children: propTypes.exports.node.isRequired,
3403
- disabled: propTypes.exports.bool,
3404
- className: propTypes.exports.string
3405
- } : {};
3406
-
3407
- process.env.NODE_ENV !== "production" ? {
3408
- children: propTypes.exports.node.isRequired,
3409
- disabled: propTypes.exports.bool,
3410
- className: propTypes.exports.string
3411
- } : {};
3412
-
3413
- process.env.NODE_ENV !== "production" ? {
3414
- children: propTypes.exports.node.isRequired,
3415
- className: propTypes.exports.string
3416
- } : {};
3417
-
3418
3400
  var effectCar = createSidecarMedium();
3419
3401
  var focusHiddenMarker = 'data-focus-on-hidden';
3420
3402
 
3421
- _assign({}, RemoveScroll.classNames);
3422
-
3423
3403
  var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
3424
3404
  var _a = React.useState(false),
3425
3405
  lockProps = _a[0],
@@ -3461,7 +3441,7 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
3461
3441
  enabled: enabled && scrollLock
3462
3442
  });
3463
3443
 
3464
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FocusLock, {
3444
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FocusLockUI, {
3465
3445
  ref: parentRef,
3466
3446
  sideCar: sideCar,
3467
3447
  disabled: !(lockProps && enabled && focusLock),
@@ -4277,6 +4257,8 @@ var setFocus = function setFocus(topNode, lastNode, options) {
4277
4257
  }
4278
4258
  };
4279
4259
 
4260
+ var moveFocusInside = setFocus; //
4261
+
4280
4262
  /* eslint-disable no-mixed-operators */
4281
4263
 
4282
4264
  var focusOnBody = function focusOnBody() {
@@ -4395,7 +4377,7 @@ var activateTrap = function activateTrap() {
4395
4377
 
4396
4378
  document.body.focus();
4397
4379
  } else {
4398
- result = setFocus(workingArea, lastActiveFocus, {
4380
+ result = moveFocusInside(workingArea, lastActiveFocus, {
4399
4381
  focusOptions: focusOptions
4400
4382
  });
4401
4383
  lastPortaledElement = {};
@@ -4535,7 +4517,7 @@ mediumFocus.assignSyncMedium(onFocus);
4535
4517
  mediumBlur.assignMedium(onBlur);
4536
4518
  mediumEffect.assignMedium(function (cb) {
4537
4519
  return cb({
4538
- moveFocusInside: setFocus,
4520
+ moveFocusInside: moveFocusInside,
4539
4521
  focusInside: focusInside
4540
4522
  });
4541
4523
  });
@@ -9575,6 +9557,8 @@ var T = function T() {
9575
9557
  return true;
9576
9558
  };
9577
9559
 
9560
+ var otherwise = T;
9561
+
9578
9562
  function _isPlaceholder(a) {
9579
9563
  return a != null && _typeof(a) === 'object' && a['@@functional/placeholder'] === true;
9580
9564
  }
@@ -10735,6 +10719,8 @@ var cond = /*#__PURE__*/_curry1(function cond(pairs) {
10735
10719
  });
10736
10720
  });
10737
10721
 
10722
+ var cond$1 = cond;
10723
+
10738
10724
  var _Set = /*#__PURE__*/function () {
10739
10725
  function _Set() {
10740
10726
  /* globals Set */
@@ -11012,6 +10998,7 @@ var uniqBy = /*#__PURE__*/_curry2( /*#__PURE__*/_dispatchable([], _xuniqBy, func
11012
10998
  */
11013
10999
 
11014
11000
  var uniq = /*#__PURE__*/uniqBy(identity);
11001
+ var uniq$1 = uniq;
11015
11002
 
11016
11003
  function _isNumber(x) {
11017
11004
  return Object.prototype.toString.call(x) === '[object Number]';
@@ -11050,6 +11037,8 @@ var range = /*#__PURE__*/_curry2(function range(from, to) {
11050
11037
  return result;
11051
11038
  });
11052
11039
 
11040
+ var range$1 = range;
11041
+
11053
11042
  var __assign$2 = undefined && undefined.__assign || function () {
11054
11043
  __assign$2 = Object.assign || function (t) {
11055
11044
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -11150,7 +11139,7 @@ var MultiSelect = function MultiSelect(_ref) {
11150
11139
  dispatch({
11151
11140
  type: 'SELECT',
11152
11141
  payload: {
11153
- value: uniq([].concat(_toConsumableArray(values), [option.value]))
11142
+ value: uniq$1([].concat(_toConsumableArray(values), [option.value]))
11154
11143
  }
11155
11144
  });
11156
11145
  }, [dispatch, values]);
@@ -11351,7 +11340,7 @@ var DefinitionList = function DefinitionList(_ref) {
11351
11340
  }, rest), /*#__PURE__*/React__default.createElement("dt", null, term), /*#__PURE__*/React__default.createElement("dd", null, children));
11352
11341
  };
11353
11342
 
11354
- var _excluded$f = ["name", "children", "className", "virtual", "icon", "data-testid", "defaultExpanded", "expanded", "onToggle"];
11343
+ var _excluded$f = ["name", "children", "className", "virtual", "icon", "data-testid", "defaultExpanded", "expanded", "onToggle", "background", "border"];
11355
11344
  var Expandable = function Expandable(_ref) {
11356
11345
  var name = _ref.name,
11357
11346
  children = _ref.children,
@@ -11365,6 +11354,10 @@ var Expandable = function Expandable(_ref) {
11365
11354
  defaultExpanded = _ref$defaultExpanded === void 0 ? false : _ref$defaultExpanded,
11366
11355
  __expanded__ = _ref.expanded,
11367
11356
  onToggle = _ref.onToggle,
11357
+ _ref$background = _ref.background,
11358
+ background = _ref$background === void 0 ? 'light' : _ref$background,
11359
+ _ref$border = _ref.border,
11360
+ border = _ref$border === void 0 ? true : _ref$border,
11368
11361
  rest = _objectWithoutProperties(_ref, _excluded$f);
11369
11362
 
11370
11363
  var _useState = useState(defaultExpanded),
@@ -11382,13 +11375,13 @@ var Expandable = function Expandable(_ref) {
11382
11375
  onToggle === null || onToggle === void 0 ? void 0 : onToggle();
11383
11376
  }, [onToggle]);
11384
11377
  return /*#__PURE__*/React__default.createElement("div", _extends$1({
11385
- className: classNames('Expandable', {
11386
- 'Expandable--expanded': expanded
11378
+ className: classNames('Expandable', "Expandable--".concat(background, "-background"), {
11379
+ 'Expandable--expanded': expanded,
11380
+ 'Expandable--with-border': border,
11381
+ 'Expandable--plus-minus': icon === 'plus-minus'
11387
11382
  }, className)
11388
11383
  }, rest), /*#__PURE__*/React__default.createElement(Clickable, {
11389
- className: classNames('Expandable__name', {
11390
- 'Expandable__name--plusMinus': icon === 'plus-minus'
11391
- }),
11384
+ className: "Expandable__name",
11392
11385
  onClick: handleClick,
11393
11386
  "data-testid": dataTestId
11394
11387
  }, name, icon !== 'plus-minus' && /*#__PURE__*/React__default.createElement("div", {
@@ -11911,23 +11904,23 @@ var whenCurrentPageIsGreaterThanHalfTheTotal = function whenCurrentPageIsGreater
11911
11904
  };
11912
11905
 
11913
11906
  var showAllPages = function showAllPages(_, totalPages) {
11914
- return range(1, totalPages + 1);
11907
+ return range$1(1, totalPages + 1);
11915
11908
  };
11916
11909
 
11917
11910
  var showFirstNPagesAndLastPage = function showFirstNPagesAndLastPage(_, totalPages, maxPages) {
11918
- return [].concat(_toConsumableArray(range(1, maxPages)), [totalPages]);
11911
+ return [].concat(_toConsumableArray(range$1(1, maxPages)), [totalPages]);
11919
11912
  };
11920
11913
 
11921
11914
  var showTheLastNPages = function showTheLastNPages(_, totalPages, maxPages) {
11922
- return [1].concat(_toConsumableArray(range(totalPages - maxPages + 2, totalPages + 1)));
11915
+ return [1].concat(_toConsumableArray(range$1(totalPages - maxPages + 2, totalPages + 1)));
11923
11916
  };
11924
11917
 
11925
11918
  var showAGroupOfPagesCenteredOnTheCurrentPage = function showAGroupOfPagesCenteredOnTheCurrentPage(page, totalPages, maxPages) {
11926
11919
  var diff = Math.floor((maxPages - 2) / 2);
11927
- return [1].concat(_toConsumableArray(range(page - diff, page + diff + 1)), [totalPages]);
11920
+ return [1].concat(_toConsumableArray(range$1(page - diff, page + diff + 1)), [totalPages]);
11928
11921
  };
11929
11922
 
11930
- var determinePagesToShow = cond([[whenThereAreFewerPagesThanWeDisplay, showAllPages], [whenCurrentPageIsLessThanHalfTheTotal, showFirstNPagesAndLastPage], [whenCurrentPageIsGreaterThanHalfTheTotal, showTheLastNPages], [T, showAGroupOfPagesCenteredOnTheCurrentPage]]);
11923
+ var determinePagesToShow = cond$1([[whenThereAreFewerPagesThanWeDisplay, showAllPages], [whenCurrentPageIsLessThanHalfTheTotal, showFirstNPagesAndLastPage], [whenCurrentPageIsGreaterThanHalfTheTotal, showTheLastNPages], [otherwise, showAGroupOfPagesCenteredOnTheCurrentPage]]);
11931
11924
  var Paginator = function Paginator(_ref) {
11932
11925
  var selectedPage = _ref.selectedPage,
11933
11926
  totalPages = _ref.totalPages,