@moda/om 21.2.0 → 21.3.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.
Files changed (29) hide show
  1. package/dist/index.cjs.js +51 -12
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +51 -12
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/src/components/Select/Select.d.ts +1 -0
  6. package/dist/styles.css +1 -1
  7. package/package.json +43 -45
  8. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +3 -3
  9. package/src/components/Breakpoint/Breakpoint.stories.tsx +1 -1
  10. package/src/components/Button/Button.stories.tsx +1 -1
  11. package/src/components/Button/Button.test.tsx +1 -1
  12. package/src/components/Checkbox/Checkbox.test.tsx +2 -2
  13. package/src/components/Clickable/Clickable.stories.tsx +1 -1
  14. package/src/components/ColorSwatch/ColorSwatch.stories.tsx +1 -1
  15. package/src/components/ControlLink/ControlLink.stories.tsx +1 -1
  16. package/src/components/Field/Field.stories.tsx +1 -1
  17. package/src/components/Modal/Modal.test.tsx +4 -4
  18. package/src/components/Paginator/Paginator.stories.tsx +1 -1
  19. package/src/components/SearchInput/SearchInput.stories.tsx +1 -1
  20. package/src/components/Select/Select.scss +6 -0
  21. package/src/components/Select/Select.stories.tsx +1 -1
  22. package/src/components/Select/Select.test.tsx +2 -2
  23. package/src/components/Select/Select.tsx +5 -1
  24. package/src/components/SelectableButton/SelectableButton.stories.tsx +1 -1
  25. package/src/components/Tag/Tag.stories.tsx +1 -1
  26. package/src/components/Tag/Tag.test.tsx +1 -1
  27. package/src/components/Toast/Toast.stories.tsx +1 -1
  28. package/src/components/Toast/Toast.test.tsx +1 -1
  29. package/src/hooks/useKeyboardListNavigation.spec.ts +4 -4
package/dist/index.esm.js CHANGED
@@ -12,7 +12,11 @@ function getAugmentedNamespace(n) {
12
12
  var f = n.default;
13
13
  if (typeof f == "function") {
14
14
  var a = function a () {
15
- if (this instanceof a) {
15
+ var isInstance = false;
16
+ try {
17
+ isInstance = this instanceof a;
18
+ } catch {}
19
+ if (isInstance) {
16
20
  return Reflect.construct(f, arguments, this.constructor);
17
21
  }
18
22
  return f.apply(this, arguments);
@@ -1677,13 +1681,14 @@ var RemoveScroll = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
1677
1681
  enabled = props.enabled,
1678
1682
  shards = props.shards,
1679
1683
  sideCar = props.sideCar,
1684
+ noRelative = props.noRelative,
1680
1685
  noIsolation = props.noIsolation,
1681
1686
  inert = props.inert,
1682
1687
  allowPinchZoom = props.allowPinchZoom,
1683
1688
  _b = props.as,
1684
1689
  Container = _b === void 0 ? 'div' : _b,
1685
1690
  gapMode = props.gapMode,
1686
- rest = __rest$a(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1691
+ rest = __rest$a(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1687
1692
  var SideCar = sideCar;
1688
1693
  var containerRef = useMergeRefs([ref, parentRef]);
1689
1694
  var containerProps = __assign$a(__assign$a({}, rest), callbacks);
@@ -1691,6 +1696,7 @@ var RemoveScroll = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
1691
1696
  sideCar: effectCar$1,
1692
1697
  removeScrollBar: removeScrollBar,
1693
1698
  shards: shards,
1699
+ noRelative: noRelative,
1694
1700
  noIsolation: noIsolation,
1695
1701
  inert: inert,
1696
1702
  setCallbacks: setCallbacks,
@@ -4765,6 +4771,9 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
4765
4771
  var availableScroll = 0;
4766
4772
  var availableScrollTop = 0;
4767
4773
  do {
4774
+ if (!target) {
4775
+ break;
4776
+ }
4768
4777
  var _a = getScrollVariables(axis, target),
4769
4778
  position = _a[0],
4770
4779
  scroll_1 = _a[1],
@@ -4776,11 +4785,10 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
4776
4785
  availableScrollTop += position;
4777
4786
  }
4778
4787
  }
4779
- if (target instanceof ShadowRoot) {
4780
- target = target.host;
4781
- } else {
4782
- target = target.parentNode;
4783
- }
4788
+ var parent_1 = target.parentNode;
4789
+ // we will "bubble" from ShadowDom in case we are, or just to the parent in normal case
4790
+ // this is the same logic used in focus-lock
4791
+ target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
4784
4792
  } while (
4785
4793
  // portaled content
4786
4794
  !targetInLock && target !== document.body ||
@@ -4955,6 +4963,7 @@ function RemoveScrollSideCar(props) {
4955
4963
  return /*#__PURE__*/React.createElement(React.Fragment, null, inert ? /*#__PURE__*/React.createElement(Style, {
4956
4964
  styles: generateStyle(id)
4957
4965
  }) : null, removeScrollBar ? /*#__PURE__*/React.createElement(RemoveScrollBar, {
4966
+ noRelative: props.noRelative,
4958
4967
  gapMode: props.gapMode
4959
4968
  }) : null);
4960
4969
  }
@@ -6319,6 +6328,23 @@ function _filter(fn, list) {
6319
6328
  return result;
6320
6329
  }
6321
6330
 
6331
+ function _filterMap(fn, map) {
6332
+ var result = new Map();
6333
+ var iterator = map.entries();
6334
+ var current = iterator.next();
6335
+ while (!current.done) {
6336
+ if (fn(current.value[1])) {
6337
+ result.set(current.value[0], current.value[1]);
6338
+ }
6339
+ current = iterator.next();
6340
+ }
6341
+ return result;
6342
+ }
6343
+
6344
+ function _isMap(x) {
6345
+ return Object.prototype.toString.call(x) === '[object Map]';
6346
+ }
6347
+
6322
6348
  function _isObject(x) {
6323
6349
  return Object.prototype.toString.call(x) === '[object Object]';
6324
6350
  }
@@ -6344,7 +6370,7 @@ function _xfilter(f) {
6344
6370
  /**
6345
6371
  * Takes a predicate and a `Filterable`, and returns a new filterable of the
6346
6372
  * same type containing the members of the given filterable which satisfy the
6347
- * given predicate. Filterable objects include plain objects or any object
6373
+ * given predicate. Filterable objects include plain objects, Maps, or any object
6348
6374
  * that has a filter method such as `Array`.
6349
6375
  *
6350
6376
  * Dispatches to the `filter` method of the second argument, if present.
@@ -6375,7 +6401,7 @@ var filter = /*#__PURE__*/_curry2(/*#__PURE__*/_dispatchable(['fantasy-land/filt
6375
6401
  acc[key] = filterable[key];
6376
6402
  }
6377
6403
  return acc;
6378
- }, {}, keys(filterable)) :
6404
+ }, {}, keys(filterable)) : _isMap(filterable) ? _filterMap(pred, filterable) :
6379
6405
  // else
6380
6406
  _filter(pred, filterable);
6381
6407
  }));
@@ -9480,6 +9506,17 @@ function requireCardTypes() {
9480
9506
  name: "CVC",
9481
9507
  size: 3
9482
9508
  }
9509
+ },
9510
+ verve: {
9511
+ niceType: "Verve",
9512
+ type: "verve",
9513
+ patterns: [[506099, 506127], 506129, [506133, 506150], [506158, 506163], 506166, 506168, 506170, 506173, [506176, 506180], 506184, [506187, 506188], 506191, 506195, 506197, 507865, 507866, [507868, 507877], [507880, 507888], 507900, 507941],
9514
+ gaps: [4, 8, 12],
9515
+ lengths: [16, 18, 19],
9516
+ code: {
9517
+ name: "CVV",
9518
+ size: 3
9519
+ }
9483
9520
  }
9484
9521
  };
9485
9522
  cardTypes_1 = cardTypes;
@@ -9666,13 +9703,14 @@ function requireDist$2() {
9666
9703
  DISCOVER: "discover",
9667
9704
  JCB: "jcb",
9668
9705
  UNIONPAY: "unionpay",
9706
+ VERVE: "verve",
9669
9707
  MAESTRO: "maestro",
9670
9708
  ELO: "elo",
9671
9709
  MIR: "mir",
9672
9710
  HIPER: "hiper",
9673
9711
  HIPERCARD: "hipercard"
9674
9712
  };
9675
- var ORIGINAL_TEST_ORDER = [cardNames.VISA, cardNames.MASTERCARD, cardNames.AMERICAN_EXPRESS, cardNames.DINERS_CLUB, cardNames.DISCOVER, cardNames.JCB, cardNames.UNIONPAY, cardNames.MAESTRO, cardNames.ELO, cardNames.MIR, cardNames.HIPER, cardNames.HIPERCARD];
9713
+ var ORIGINAL_TEST_ORDER = [cardNames.VISA, cardNames.MASTERCARD, cardNames.AMERICAN_EXPRESS, cardNames.DINERS_CLUB, cardNames.DISCOVER, cardNames.JCB, cardNames.UNIONPAY, cardNames.VERVE, cardNames.MAESTRO, cardNames.ELO, cardNames.MIR, cardNames.HIPER, cardNames.HIPERCARD];
9676
9714
  var testOrder = (0, clone_1.clone)(ORIGINAL_TEST_ORDER);
9677
9715
  function findType(cardType) {
9678
9716
  return customCards[cardType] || cardTypes[cardType];
@@ -10722,7 +10760,7 @@ var useSelect = function useSelect(_ref) {
10722
10760
  };
10723
10761
  };
10724
10762
 
10725
- var _excluded$j = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value", "dataTestId", "colorSwatch", "extraOption"];
10763
+ var _excluded$j = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value", "dataTestId", "colorSwatch", "extraOption", "paddingRight"];
10726
10764
  var Select = function Select(_ref) {
10727
10765
  var _ref2;
10728
10766
  var _ref$allowAutoFill = _ref.allowAutoFill,
@@ -10749,6 +10787,7 @@ var Select = function Select(_ref) {
10749
10787
  dataTestId = _ref.dataTestId,
10750
10788
  colorSwatch = _ref.colorSwatch,
10751
10789
  extraOption = _ref.extraOption,
10790
+ paddingRight = _ref.paddingRight,
10752
10791
  rest = _objectWithoutProperties(_ref, _excluded$j);
10753
10792
  var _useSelect = useSelect({
10754
10793
  value: value,
@@ -10812,7 +10851,7 @@ var Select = function Select(_ref) {
10812
10851
  value: state.value
10813
10852
  }), /*#__PURE__*/React__default.createElement(Clickable, {
10814
10853
  id: idRef && "Select__value--".concat(idRef),
10815
- className: "Select__value",
10854
+ className: classNames('Select__value', _defineProperty$1({}, "Select__value--padding-".concat(paddingRight), paddingRight != null)),
10816
10855
  disabled: disabled,
10817
10856
  onClick: handleToggle,
10818
10857
  "data-test-id": dataTestId,