@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.cjs.js CHANGED
@@ -32,7 +32,11 @@ function getAugmentedNamespace(n) {
32
32
  var f = n.default;
33
33
  if (typeof f == "function") {
34
34
  var a = function a () {
35
- if (this instanceof a) {
35
+ var isInstance = false;
36
+ try {
37
+ isInstance = this instanceof a;
38
+ } catch {}
39
+ if (isInstance) {
36
40
  return Reflect.construct(f, arguments, this.constructor);
37
41
  }
38
42
  return f.apply(this, arguments);
@@ -1697,13 +1701,14 @@ var RemoveScroll = /*#__PURE__*/React__namespace.forwardRef(function (props, par
1697
1701
  enabled = props.enabled,
1698
1702
  shards = props.shards,
1699
1703
  sideCar = props.sideCar,
1704
+ noRelative = props.noRelative,
1700
1705
  noIsolation = props.noIsolation,
1701
1706
  inert = props.inert,
1702
1707
  allowPinchZoom = props.allowPinchZoom,
1703
1708
  _b = props.as,
1704
1709
  Container = _b === void 0 ? 'div' : _b,
1705
1710
  gapMode = props.gapMode,
1706
- rest = __rest$a(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1711
+ rest = __rest$a(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1707
1712
  var SideCar = sideCar;
1708
1713
  var containerRef = useMergeRefs([ref, parentRef]);
1709
1714
  var containerProps = __assign$a(__assign$a({}, rest), callbacks);
@@ -1711,6 +1716,7 @@ var RemoveScroll = /*#__PURE__*/React__namespace.forwardRef(function (props, par
1711
1716
  sideCar: effectCar$1,
1712
1717
  removeScrollBar: removeScrollBar,
1713
1718
  shards: shards,
1719
+ noRelative: noRelative,
1714
1720
  noIsolation: noIsolation,
1715
1721
  inert: inert,
1716
1722
  setCallbacks: setCallbacks,
@@ -4785,6 +4791,9 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
4785
4791
  var availableScroll = 0;
4786
4792
  var availableScrollTop = 0;
4787
4793
  do {
4794
+ if (!target) {
4795
+ break;
4796
+ }
4788
4797
  var _a = getScrollVariables(axis, target),
4789
4798
  position = _a[0],
4790
4799
  scroll_1 = _a[1],
@@ -4796,11 +4805,10 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
4796
4805
  availableScrollTop += position;
4797
4806
  }
4798
4807
  }
4799
- if (target instanceof ShadowRoot) {
4800
- target = target.host;
4801
- } else {
4802
- target = target.parentNode;
4803
- }
4808
+ var parent_1 = target.parentNode;
4809
+ // we will "bubble" from ShadowDom in case we are, or just to the parent in normal case
4810
+ // this is the same logic used in focus-lock
4811
+ target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
4804
4812
  } while (
4805
4813
  // portaled content
4806
4814
  !targetInLock && target !== document.body ||
@@ -4975,6 +4983,7 @@ function RemoveScrollSideCar(props) {
4975
4983
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, inert ? /*#__PURE__*/React__namespace.createElement(Style, {
4976
4984
  styles: generateStyle(id)
4977
4985
  }) : null, removeScrollBar ? /*#__PURE__*/React__namespace.createElement(RemoveScrollBar, {
4986
+ noRelative: props.noRelative,
4978
4987
  gapMode: props.gapMode
4979
4988
  }) : null);
4980
4989
  }
@@ -6339,6 +6348,23 @@ function _filter(fn, list) {
6339
6348
  return result;
6340
6349
  }
6341
6350
 
6351
+ function _filterMap(fn, map) {
6352
+ var result = new Map();
6353
+ var iterator = map.entries();
6354
+ var current = iterator.next();
6355
+ while (!current.done) {
6356
+ if (fn(current.value[1])) {
6357
+ result.set(current.value[0], current.value[1]);
6358
+ }
6359
+ current = iterator.next();
6360
+ }
6361
+ return result;
6362
+ }
6363
+
6364
+ function _isMap(x) {
6365
+ return Object.prototype.toString.call(x) === '[object Map]';
6366
+ }
6367
+
6342
6368
  function _isObject(x) {
6343
6369
  return Object.prototype.toString.call(x) === '[object Object]';
6344
6370
  }
@@ -6364,7 +6390,7 @@ function _xfilter(f) {
6364
6390
  /**
6365
6391
  * Takes a predicate and a `Filterable`, and returns a new filterable of the
6366
6392
  * same type containing the members of the given filterable which satisfy the
6367
- * given predicate. Filterable objects include plain objects or any object
6393
+ * given predicate. Filterable objects include plain objects, Maps, or any object
6368
6394
  * that has a filter method such as `Array`.
6369
6395
  *
6370
6396
  * Dispatches to the `filter` method of the second argument, if present.
@@ -6395,7 +6421,7 @@ var filter = /*#__PURE__*/_curry2(/*#__PURE__*/_dispatchable(['fantasy-land/filt
6395
6421
  acc[key] = filterable[key];
6396
6422
  }
6397
6423
  return acc;
6398
- }, {}, keys(filterable)) :
6424
+ }, {}, keys(filterable)) : _isMap(filterable) ? _filterMap(pred, filterable) :
6399
6425
  // else
6400
6426
  _filter(pred, filterable);
6401
6427
  }));
@@ -9500,6 +9526,17 @@ function requireCardTypes() {
9500
9526
  name: "CVC",
9501
9527
  size: 3
9502
9528
  }
9529
+ },
9530
+ verve: {
9531
+ niceType: "Verve",
9532
+ type: "verve",
9533
+ 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],
9534
+ gaps: [4, 8, 12],
9535
+ lengths: [16, 18, 19],
9536
+ code: {
9537
+ name: "CVV",
9538
+ size: 3
9539
+ }
9503
9540
  }
9504
9541
  };
9505
9542
  cardTypes_1 = cardTypes;
@@ -9686,13 +9723,14 @@ function requireDist$2() {
9686
9723
  DISCOVER: "discover",
9687
9724
  JCB: "jcb",
9688
9725
  UNIONPAY: "unionpay",
9726
+ VERVE: "verve",
9689
9727
  MAESTRO: "maestro",
9690
9728
  ELO: "elo",
9691
9729
  MIR: "mir",
9692
9730
  HIPER: "hiper",
9693
9731
  HIPERCARD: "hipercard"
9694
9732
  };
9695
- 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];
9733
+ 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];
9696
9734
  var testOrder = (0, clone_1.clone)(ORIGINAL_TEST_ORDER);
9697
9735
  function findType(cardType) {
9698
9736
  return customCards[cardType] || cardTypes[cardType];
@@ -10742,7 +10780,7 @@ var useSelect = function useSelect(_ref) {
10742
10780
  };
10743
10781
  };
10744
10782
 
10745
- var _excluded$j = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value", "dataTestId", "colorSwatch", "extraOption"];
10783
+ var _excluded$j = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value", "dataTestId", "colorSwatch", "extraOption", "paddingRight"];
10746
10784
  var Select = function Select(_ref) {
10747
10785
  var _ref2;
10748
10786
  var _ref$allowAutoFill = _ref.allowAutoFill,
@@ -10769,6 +10807,7 @@ var Select = function Select(_ref) {
10769
10807
  dataTestId = _ref.dataTestId,
10770
10808
  colorSwatch = _ref.colorSwatch,
10771
10809
  extraOption = _ref.extraOption,
10810
+ paddingRight = _ref.paddingRight,
10772
10811
  rest = _objectWithoutProperties(_ref, _excluded$j);
10773
10812
  var _useSelect = useSelect({
10774
10813
  value: value,
@@ -10832,7 +10871,7 @@ var Select = function Select(_ref) {
10832
10871
  value: state.value
10833
10872
  }), /*#__PURE__*/React.createElement(Clickable, {
10834
10873
  id: idRef && "Select__value--".concat(idRef),
10835
- className: "Select__value",
10874
+ className: classNames('Select__value', _defineProperty$1({}, "Select__value--padding-".concat(paddingRight), paddingRight != null)),
10836
10875
  disabled: disabled,
10837
10876
  onClick: handleToggle,
10838
10877
  "data-test-id": dataTestId,