@moda/om 16.2.1 → 16.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [16.3.0](https://github.com/ModaOperandi/om/compare/v16.2.1...v16.3.0) (2022-07-06)
7
+
8
+
9
+ ### Features
10
+
11
+ * **select:** adds data-test-id to Select component ([#2790](https://github.com/ModaOperandi/om/issues/2790)) ([2ba14ed](https://github.com/ModaOperandi/om/commit/2ba14ed15c7d588bf735fbb4202e09495d58e341))
12
+
6
13
  ## [16.2.1](https://github.com/ModaOperandi/om/compare/v16.2.0...v16.2.1) (2022-07-01)
7
14
 
8
15
 
package/dist/index.cjs.js CHANGED
@@ -1000,20 +1000,20 @@ var typography_1 = typography;
1000
1000
 
1001
1001
  var text = function text(name, font) {
1002
1002
  if (font === void 0) {
1003
- font = "sans";
1003
+ font = 'sans';
1004
1004
  }
1005
1005
 
1006
- var treatment = typography_1.typography["text-treatments"][name];
1006
+ var treatment = typography_1.typography['text-treatments'][name];
1007
1007
  return __assign$b(__assign$b({}, treatment), {
1008
- "font-family": typography_1.typography.fonts[font].join(","),
1009
- "line-height": "" + treatment["line-height"]
1008
+ 'font-family': typography_1.typography.fonts[font].join(','),
1009
+ 'line-height': "".concat(treatment['line-height'])
1010
1010
  });
1011
1011
  };
1012
1012
 
1013
1013
  helpers.text = text;
1014
1014
 
1015
1015
  var remToUnitlessPx = function remToUnitlessPx(value) {
1016
- return parseFloat(value) * parseInt(typography_1.typography["root-font-size"], 0);
1016
+ return parseFloat(value) * parseInt(typography_1.typography['root-font-size'], 10);
1017
1017
  };
1018
1018
 
1019
1019
  helpers.remToUnitlessPx = remToUnitlessPx;
@@ -1022,18 +1022,19 @@ var color = function color(name, alpha) {
1022
1022
  var _a;
1023
1023
 
1024
1024
  var color = colors_1.colors.all[name];
1025
- return alpha != null ? colorString.to.rgb(__spreadArray$1(__spreadArray$1([], ((_a = colorString.get.rgb(color)) === null || _a === void 0 ? void 0 : _a.slice(0, 3)) || [], true), [alpha], false)) : color;
1025
+ return alpha != null ? // eslint-disable-next-line @typescript-eslint/no-magic-numbers
1026
+ colorString.to.rgb(__spreadArray$1(__spreadArray$1([], ((_a = colorString.get.rgb(color)) === null || _a === void 0 ? void 0 : _a.slice(0, 3)) || [], true), [alpha], false)) : color;
1026
1027
  };
1027
1028
 
1028
1029
  helpers.color = color;
1029
1030
 
1030
- var spacing = function spacing(ty, rx, b, l) {
1031
- return [ty, rx, b, l].reduce(function (acc, v) {
1031
+ var spacing = function spacing(topY, rightX, bottom, left) {
1032
+ return [topY, rightX, bottom, left].reduce(function (acc, value) {
1032
1033
  var _a;
1033
1034
 
1034
- if (v === undefined) return acc;
1035
- return [acc, (_a = space_1.space.scale[v]) !== null && _a !== void 0 ? _a : v].join(" ");
1036
- }, "");
1035
+ if (value === undefined) return acc;
1036
+ return [acc, (_a = space_1.space.scale[value]) !== null && _a !== void 0 ? _a : value].join(' ');
1037
+ }, '');
1037
1038
  };
1038
1039
 
1039
1040
  helpers.spacing = spacing;
@@ -1042,12 +1043,18 @@ helpers.spacing = spacing;
1042
1043
 
1043
1044
  var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function (o, m, k, k2) {
1044
1045
  if (k2 === undefined) k2 = k;
1045
- Object.defineProperty(o, k2, {
1046
- enumerable: true,
1047
- get: function get() {
1048
- return m[k];
1049
- }
1050
- });
1046
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1047
+
1048
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1049
+ desc = {
1050
+ enumerable: true,
1051
+ get: function get() {
1052
+ return m[k];
1053
+ }
1054
+ };
1055
+ }
1056
+
1057
+ Object.defineProperty(o, k2, desc);
1051
1058
  } : function (o, m, k, k2) {
1052
1059
  if (k2 === undefined) k2 = k;
1053
1060
  o[k2] = m[k];
@@ -9213,7 +9220,8 @@ var SelectOption = function SelectOption(_ref) {
9213
9220
  selected = _ref.selected,
9214
9221
  option = _ref.option,
9215
9222
  onClick = _ref.onClick,
9216
- className = _ref.className;
9223
+ className = _ref.className,
9224
+ dataTestId = _ref.dataTestId;
9217
9225
  var ref = React.useRef(null);
9218
9226
  var handleClick = React.useCallback(function (event) {
9219
9227
  event.preventDefault();
@@ -9235,13 +9243,14 @@ var SelectOption = function SelectOption(_ref) {
9235
9243
  'SelectOption--disabled': option.disabled
9236
9244
  }),
9237
9245
  onClick: handleClick,
9246
+ "data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(option.label.replace(' ', '-')) : undefined,
9238
9247
  "aria-label": option.label,
9239
9248
  "aria-selected": selected,
9240
9249
  role: "option"
9241
9250
  }, option.label);
9242
9251
  };
9243
9252
 
9244
- var _excluded$m = ["idRef", "searchable", "autoFocus", "options", "selectedOption", "onSelect", "onFocus", "className"];
9253
+ var _excluded$m = ["idRef", "searchable", "autoFocus", "options", "selectedOption", "onSelect", "onFocus", "className", "dataTestId"];
9245
9254
  var SelectOptions = function SelectOptions(_ref) {
9246
9255
  var idRef = _ref.idRef,
9247
9256
  searchable = _ref.searchable,
@@ -9252,6 +9261,7 @@ var SelectOptions = function SelectOptions(_ref) {
9252
9261
  onSelect = _ref.onSelect,
9253
9262
  onFocus = _ref.onFocus,
9254
9263
  className = _ref.className,
9264
+ dataTestId = _ref.dataTestId,
9255
9265
  rest = _objectWithoutProperties(_ref, _excluded$m);
9256
9266
 
9257
9267
  var _useState = React.useState(''),
@@ -9309,6 +9319,7 @@ var SelectOptions = function SelectOptions(_ref) {
9309
9319
  id: "SelectOption--".concat(option.value, "-").concat(idRef),
9310
9320
  key: option.value,
9311
9321
  option: option,
9322
+ dataTestId: dataTestId,
9312
9323
  active: (activeOption === null || activeOption === void 0 ? void 0 : activeOption.value) === option.value,
9313
9324
  selected: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value,
9314
9325
  onClick: onSelect
@@ -9430,7 +9441,7 @@ var useSelect = function useSelect(_ref) {
9430
9441
  };
9431
9442
  };
9432
9443
 
9433
- var _excluded$l = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value"];
9444
+ var _excluded$l = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value", "dataTestId"];
9434
9445
  var Select = function Select(_ref) {
9435
9446
  var _ref2;
9436
9447
 
@@ -9456,6 +9467,7 @@ var Select = function Select(_ref) {
9456
9467
  _ref$shiftIconLeftwar = _ref.shiftIconLeftwards,
9457
9468
  shiftIconLeftwards = _ref$shiftIconLeftwar === void 0 ? false : _ref$shiftIconLeftwar,
9458
9469
  value = _ref.value,
9470
+ dataTestId = _ref.dataTestId,
9459
9471
  rest = _objectWithoutProperties(_ref, _excluded$l);
9460
9472
 
9461
9473
  var _useSelect = useSelect({
@@ -9524,6 +9536,7 @@ var Select = function Select(_ref) {
9524
9536
  className: "Select__value",
9525
9537
  disabled: disabled,
9526
9538
  onClick: handleToggle,
9539
+ "data-test-id": dataTestId,
9527
9540
  "aria-haspopup": "listbox",
9528
9541
  "aria-expanded": state.mode === Mode.Open,
9529
9542
  "aria-labelledby": "Select__label--".concat(idRef, " Select__value--").concat(idRef),
@@ -9543,6 +9556,7 @@ var Select = function Select(_ref) {
9543
9556
  'Select__options--up': dropDirection === 'up',
9544
9557
  'Select__options--down': dropDirection === 'down'
9545
9558
  }),
9559
+ dataTestId: dataTestId,
9546
9560
  searchable: searchable,
9547
9561
  options: options,
9548
9562
  onSelect: handleSelect,