@moda/om 21.7.1 → 21.8.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
@@ -336,18 +336,18 @@ requireFocusVisible();
336
336
 
337
337
  var dist$4 = {};
338
338
 
339
- var colors = {};
339
+ var colors$1 = {};
340
340
 
341
341
  var hasRequiredColors;
342
342
  function requireColors() {
343
- if (hasRequiredColors) return colors;
343
+ if (hasRequiredColors) return colors$1;
344
344
  hasRequiredColors = 1;
345
- Object.defineProperty(colors, "__esModule", {
345
+ Object.defineProperty(colors$1, "__esModule", {
346
346
  value: true
347
347
  });
348
- colors.colors = void 0;
348
+ colors$1.colors = void 0;
349
349
  // THIS FILE IS AUTO-GENERATED. DO NOT EDIT.
350
- colors.colors = {
350
+ colors$1.colors = {
351
351
  "all": {
352
352
  "coal": "rgb(0, 0, 0)",
353
353
  "ink": "rgb(25, 26, 27)",
@@ -432,7 +432,7 @@ function requireColors() {
432
432
  "silver": "rgb(217, 217, 217)"
433
433
  }
434
434
  };
435
- return colors;
435
+ return colors$1;
436
436
  }
437
437
 
438
438
  var typography = {};
@@ -574,7 +574,7 @@ function requireBreakpoints() {
574
574
 
575
575
  var helpers = {};
576
576
 
577
- var colorNames = {
577
+ var colors = {
578
578
  aliceblue: [240, 248, 255],
579
579
  antiquewhite: [250, 235, 215],
580
580
  aqua: [0, 255, 255],
@@ -724,6 +724,8 @@ var colorNames = {
724
724
  yellow: [255, 255, 0],
725
725
  yellowgreen: [154, 205, 50]
726
726
  };
727
+ for (var key in colors) Object.freeze(colors[key]);
728
+ var colorNames = Object.freeze(colors);
727
729
 
728
730
  var reverseNames = Object.create(null);
729
731
 
@@ -775,8 +777,8 @@ cs.get.rgb = function (string) {
775
777
  }
776
778
  var abbr = /^#([a-f\d]{3,4})$/i;
777
779
  var hex = /^#([a-f\d]{6})([a-f\d]{2})?$/i;
778
- var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
779
- var per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
780
+ var rgba = /^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i;
781
+ var per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i;
780
782
  var keyword = /^(\w+)$/;
781
783
  var rgb = [0, 0, 0, 1];
782
784
  var match;
@@ -804,7 +806,7 @@ cs.get.rgb = function (string) {
804
806
  }
805
807
  } else if (match = string.match(rgba)) {
806
808
  for (i = 0; i < 3; i++) {
807
- rgb[i] = Number.parseInt(match[i + 1], 10);
809
+ rgb[i] = Number.parseFloat(match[i + 1]);
808
810
  }
809
811
  if (match[4]) {
810
812
  rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
@@ -816,14 +818,16 @@ cs.get.rgb = function (string) {
816
818
  if (match[4]) {
817
819
  rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
818
820
  }
819
- } else if (match = string.match(keyword)) {
821
+ } else if (match = string.toLowerCase().match(keyword)) {
820
822
  if (match[1] === 'transparent') {
821
823
  return [0, 0, 0, 0];
822
824
  }
823
825
  if (!Object.hasOwn(colorNames, match[1])) {
824
826
  return null;
825
827
  }
826
- rgb = colorNames[match[1]];
828
+
829
+ // eslint-disable-next-line unicorn/prefer-spread
830
+ rgb = colorNames[match[1]].slice();
827
831
  rgb[3] = 1;
828
832
  return rgb;
829
833
  } else {
@@ -839,7 +843,7 @@ cs.get.hsl = function (string) {
839
843
  if (!string) {
840
844
  return null;
841
845
  }
842
- var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
846
+ var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i;
843
847
  var match = string.match(hsl);
844
848
  if (match) {
845
849
  var alpha = Number.parseFloat(match[4]);
@@ -855,7 +859,7 @@ cs.get.hwb = function (string) {
855
859
  if (!string) {
856
860
  return null;
857
861
  }
858
- var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
862
+ var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i;
859
863
  var match = string.match(hwb);
860
864
  if (match) {
861
865
  var alpha = Number.parseFloat(match[4]);
@@ -3096,8 +3100,6 @@ var extractRef$2 = function extractRef(ref) {
3096
3100
  var effectCar = createSidecarMedium();
3097
3101
  var focusHiddenMarker = 'data-focus-on-hidden';
3098
3102
 
3099
- __assign$a({}, RemoveScroll.classNames);
3100
-
3101
3103
  var PREVENT_SCROLL = {
3102
3104
  preventScroll: true
3103
3105
  };
@@ -4870,6 +4872,13 @@ function RemoveScrollSideCar(props) {
4870
4872
  if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
4871
4873
  return false;
4872
4874
  }
4875
+ // allow drag selection (iOS); check if selection's anchorNode is the same as target or contains target
4876
+ var selection = window.getSelection();
4877
+ var anchorNode = selection && selection.anchorNode;
4878
+ var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
4879
+ if (isTouchingSelection) {
4880
+ return false;
4881
+ }
4873
4882
  var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
4874
4883
  if (!canBeScrolledInMainDirection) {
4875
4884
  return true;
@@ -9546,14 +9555,13 @@ function requireClone() {
9546
9555
  Object.defineProperty(clone, "__esModule", {
9547
9556
  value: true
9548
9557
  });
9549
- clone.clone = void 0;
9558
+ clone.clone = clone$1;
9550
9559
  function clone$1(originalObject) {
9551
9560
  if (!originalObject) {
9552
9561
  return null;
9553
9562
  }
9554
9563
  return JSON.parse(JSON.stringify(originalObject));
9555
9564
  }
9556
- clone.clone = clone$1;
9557
9565
  return clone;
9558
9566
  }
9559
9567
 
@@ -9569,7 +9577,7 @@ function requireMatches() {
9569
9577
  Object.defineProperty(matches, "__esModule", {
9570
9578
  value: true
9571
9579
  });
9572
- matches.matches = void 0;
9580
+ matches.matches = matches$1;
9573
9581
  function matchesRange(cardNumber, min, max) {
9574
9582
  var maxLengthToCheck = String(min).length;
9575
9583
  var substr = cardNumber.substr(0, maxLengthToCheck);
@@ -9588,7 +9596,6 @@ function requireMatches() {
9588
9596
  }
9589
9597
  return matchesPattern(cardNumber, pattern);
9590
9598
  }
9591
- matches.matches = matches$1;
9592
9599
  return matches;
9593
9600
  }
9594
9601
 
@@ -9599,7 +9606,7 @@ function requireAddMatchingCardsToResults() {
9599
9606
  Object.defineProperty(addMatchingCardsToResults, "__esModule", {
9600
9607
  value: true
9601
9608
  });
9602
- addMatchingCardsToResults.addMatchingCardsToResults = void 0;
9609
+ addMatchingCardsToResults.addMatchingCardsToResults = addMatchingCardsToResults$1;
9603
9610
  var clone_1 = requireClone();
9604
9611
  var matches_1 = requireMatches();
9605
9612
  function addMatchingCardsToResults$1(cardNumber, cardConfiguration, results) {
@@ -9622,7 +9629,6 @@ function requireAddMatchingCardsToResults() {
9622
9629
  break;
9623
9630
  }
9624
9631
  }
9625
- addMatchingCardsToResults.addMatchingCardsToResults = addMatchingCardsToResults$1;
9626
9632
  return addMatchingCardsToResults;
9627
9633
  }
9628
9634
 
@@ -9635,11 +9641,10 @@ function requireIsValidInputType() {
9635
9641
  Object.defineProperty(isValidInputType, "__esModule", {
9636
9642
  value: true
9637
9643
  });
9638
- isValidInputType.isValidInputType = void 0;
9644
+ isValidInputType.isValidInputType = isValidInputType$1;
9639
9645
  function isValidInputType$1(cardNumber) {
9640
9646
  return typeof cardNumber === "string" || cardNumber instanceof String;
9641
9647
  }
9642
- isValidInputType.isValidInputType = isValidInputType$1;
9643
9648
  return isValidInputType;
9644
9649
  }
9645
9650
 
@@ -9652,7 +9657,7 @@ function requireFindBestMatch() {
9652
9657
  Object.defineProperty(findBestMatch, "__esModule", {
9653
9658
  value: true
9654
9659
  });
9655
- findBestMatch.findBestMatch = void 0;
9660
+ findBestMatch.findBestMatch = findBestMatch$1;
9656
9661
  function hasEnoughResultsToDetermineBestMatch(results) {
9657
9662
  var numberOfResultsWithMaxStrengthProperty = results.filter(function (result) {
9658
9663
  return result.matchStrength;
@@ -9682,7 +9687,6 @@ function requireFindBestMatch() {
9682
9687
  return bestMatch;
9683
9688
  });
9684
9689
  }
9685
- findBestMatch.findBestMatch = findBestMatch$1;
9686
9690
  return findBestMatch;
9687
9691
  }
9688
9692
 
@@ -9876,6 +9880,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
9876
9880
  disabled: disabled,
9877
9881
  placeholder: placeholder,
9878
9882
  "aria-label": label || placeholder,
9883
+ "aria-invalid": error ? true : undefined,
9879
9884
  ref: ref,
9880
9885
  onChange: function onChange(event) {
9881
9886
  _onChange === null || _onChange === void 0 || _onChange(event.target.value);
@@ -11159,11 +11164,16 @@ var Field = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
11159
11164
  label = _ref.label,
11160
11165
  placeholder = _ref.placeholder,
11161
11166
  rest = _objectWithoutProperties(_ref, _excluded$h);
11167
+ var id = useId();
11168
+ var errorId = "".concat(id, "-error");
11162
11169
  var fieldContextValue = useMemo(function () {
11163
11170
  return {
11164
11171
  displaysError: Boolean(error)
11165
11172
  };
11166
11173
  }, [error]);
11174
+
11175
+ // Combine any existing aria-describedby with our error ID
11176
+ var ariaDescribedBy = [rest['aria-describedby'], error ? errorId : null].filter(Boolean).join(' ') || undefined;
11167
11177
  return /*#__PURE__*/React__default.createElement(FormControlContext.Provider, {
11168
11178
  value: fieldContextValue
11169
11179
  }, /*#__PURE__*/React__default.createElement("label", {
@@ -11177,18 +11187,22 @@ var Field = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
11177
11187
  error: error,
11178
11188
  placeholder: placeholder,
11179
11189
  label: label,
11180
- shiftIconLeftwards: error && children.type === Select
11190
+ shiftIconLeftwards: error && children.type === Select,
11191
+ 'aria-describedby': ariaDescribedBy
11181
11192
  }, rest), children.props)), error && /*#__PURE__*/React__default.createElement("span", {
11182
11193
  className: "Field__icon"
11183
11194
  }, /*#__PURE__*/React__default.createElement(Warning16, null))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({
11184
11195
  ref: ref,
11185
11196
  placeholder: placeholder,
11186
11197
  label: label,
11187
- error: error
11198
+ error: error,
11199
+ "aria-describedby": ariaDescribedBy
11188
11200
  }, rest)), error && /*#__PURE__*/React__default.createElement("span", {
11189
11201
  className: "Field__icon"
11190
11202
  }, /*#__PURE__*/React__default.createElement(Warning16, null)))), error && /*#__PURE__*/React__default.createElement("span", {
11191
- className: "Field__error"
11203
+ id: errorId,
11204
+ className: "Field__error",
11205
+ role: "alert"
11192
11206
  }, error)));
11193
11207
  });
11194
11208
  Field.displayName = 'Field';
@@ -12645,9 +12659,10 @@ var Tab = function Tab(_ref) {
12645
12659
  var TabList = function TabList(_ref) {
12646
12660
  var tabs = _ref.tabs,
12647
12661
  onTabSelected = _ref.onTabSelected,
12648
- activePanel = _ref.activePanel;
12662
+ activePanel = _ref.activePanel,
12663
+ className = _ref.className;
12649
12664
  return /*#__PURE__*/React__default.createElement("div", {
12650
- className: "TabList"
12665
+ className: classNames('TabList', className)
12651
12666
  }, tabs.map(function (tab) {
12652
12667
  return /*#__PURE__*/React__default.createElement(Tab, {
12653
12668
  key: tab.name,
@@ -12679,13 +12694,14 @@ var TabPanels = function TabPanels(_ref) {
12679
12694
  }));
12680
12695
  };
12681
12696
 
12682
- var _excluded$4 = ["tabs", "onTabClicked", "defaultActiveTab", "activeTab", "className"];
12697
+ var _excluded$4 = ["tabs", "onTabClicked", "defaultActiveTab", "activeTab", "className", "tabListClassName"];
12683
12698
  var Tabs = function Tabs(_ref) {
12684
12699
  var tabs = _ref.tabs,
12685
12700
  onTabClicked = _ref.onTabClicked,
12686
12701
  defaultActiveTab = _ref.defaultActiveTab,
12687
12702
  activeTab = _ref.activeTab,
12688
12703
  className = _ref.className,
12704
+ tabListClassName = _ref.tabListClassName,
12689
12705
  rest = _objectWithoutProperties(_ref, _excluded$4);
12690
12706
  var _useState = useState(activeTab || defaultActiveTab || tabs[0].name),
12691
12707
  _useState2 = _slicedToArray(_useState, 2),
@@ -12703,7 +12719,8 @@ var Tabs = function Tabs(_ref) {
12703
12719
  }, rest), /*#__PURE__*/React__default.createElement(TabList, {
12704
12720
  tabs: tabs,
12705
12721
  onTabSelected: handleTabClick,
12706
- activePanel: activePanel
12722
+ activePanel: activePanel,
12723
+ className: tabListClassName
12707
12724
  }), /*#__PURE__*/React__default.createElement(TabPanels, {
12708
12725
  panels: tabs,
12709
12726
  activePanel: activePanel