@spscommerce/ds-react 5.4.1 → 5.5.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/lib/index.es.js CHANGED
@@ -1317,7 +1317,8 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
1317
1317
  specialAction,
1318
1318
  unsafelyReplaceClassName,
1319
1319
  loading,
1320
- filterByTextAndCaptionKey
1320
+ filterByTextAndCaptionKey,
1321
+ "data-testid": testId
1321
1322
  } = _a, rest = __objRest(_a, [
1322
1323
  "captionKey",
1323
1324
  "comparisonKey",
@@ -1351,7 +1352,8 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
1351
1352
  "specialAction",
1352
1353
  "unsafelyReplaceClassName",
1353
1354
  "loading",
1354
- "filterByTextAndCaptionKey"
1355
+ "filterByTextAndCaptionKey",
1356
+ "data-testid"
1355
1357
  ]);
1356
1358
  const specialActionOption = React.useMemo(() => specialAction ? new SpsOptionListOption(specialAction, {
1357
1359
  textKey: "label",
@@ -1573,10 +1575,12 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
1573
1575
  tabIndex: -1,
1574
1576
  ref: rootRef,
1575
1577
  style: posStyle,
1576
- onMouseLeave: () => setHighlightedOptionIndex(-1)
1578
+ onMouseLeave: () => setHighlightedOptionIndex(-1),
1579
+ "data-testid": testId
1577
1580
  }, rest), searchElement, /* @__PURE__ */ React.createElement("div", {
1578
1581
  className: optionsClasses,
1579
- ref: optionsRef
1582
+ ref: optionsRef,
1583
+ "data-testid": `${testId}-options`
1580
1584
  }, !loading && !searchState.pending && zeroState && (searchState.value || !searchState.isAsync) && optionList.length === 0 && /* @__PURE__ */ React.createElement("div", {
1581
1585
  className: "sps-option-list__zero-state"
1582
1586
  }, zeroState), (loading || searchState.pending) && /* @__PURE__ */ React.createElement("div", {
@@ -1593,7 +1597,8 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
1593
1597
  onClick: (event) => handleOptionClick(event, option),
1594
1598
  onMouseOver: () => setHighlightedOptionIndex(i2),
1595
1599
  tabIndex: -1,
1596
- ref: highlightedOptionIndex === i2 ? highlightedOptionRef : null
1600
+ ref: highlightedOptionIndex === i2 ? highlightedOptionRef : null,
1601
+ "data-testid": `${testId}-option-${i2}`
1597
1602
  }, option.value && option.value.icon && /* @__PURE__ */ React.createElement("i", {
1598
1603
  className: clsx("sps-icon", "sps-option-list__option-icon", `sps-icon-${String(option.value.icon)}`)
1599
1604
  }), (!option.value || !option.value.icon && anyOptionHasIcon) && /* @__PURE__ */ React.createElement("span", {
@@ -29520,7 +29525,8 @@ const SpsSelect = React.forwardRef((props2, ref2) => {
29520
29525
  value: valueProp,
29521
29526
  zeroState,
29522
29527
  loading,
29523
- filterByTextAndCaptionKey
29528
+ filterByTextAndCaptionKey,
29529
+ "data-testid": testId
29524
29530
  } = _a, rest = __objRest(_a, [
29525
29531
  "action",
29526
29532
  "autoFixWidth",
@@ -29544,7 +29550,8 @@ const SpsSelect = React.forwardRef((props2, ref2) => {
29544
29550
  "value",
29545
29551
  "zeroState",
29546
29552
  "loading",
29547
- "filterByTextAndCaptionKey"
29553
+ "filterByTextAndCaptionKey",
29554
+ "data-testid"
29548
29555
  ]);
29549
29556
  const meta = formMeta || formControl2;
29550
29557
  const { wrapperId, controlId } = useFormControlId(id2, meta);
@@ -29666,21 +29673,25 @@ const SpsSelect = React.forwardRef((props2, ref2) => {
29666
29673
  formMeta,
29667
29674
  ref: rootElement,
29668
29675
  role: "listbox",
29669
- "aria-owns": state.optionIds
29676
+ "aria-owns": state.optionIds,
29677
+ "data-testid": testId
29670
29678
  }, rest), /* @__PURE__ */ React.createElement("div", {
29671
29679
  className: clsx("sps-select__dropctrl", disabled && "disabled"),
29672
29680
  id: controlId,
29673
29681
  tabIndex: 0,
29674
29682
  onClick: handleControlButtonClick,
29675
29683
  ref: controlButton,
29676
- title: valueText
29684
+ title: valueText,
29685
+ "data-testid": `${testId}-dropctrl`
29677
29686
  }, /* @__PURE__ */ React.createElement("div", {
29678
29687
  className: "sps-select__dropctrl-content"
29679
29688
  }, /* @__PURE__ */ React.createElement("span", {
29680
- className: clsx("sps-select__value", !state.text && "sps-select__value--placeholder")
29689
+ className: clsx("sps-select__value", !state.text && "sps-select__value--placeholder"),
29690
+ "data-testid": `${testId}-value`
29681
29691
  }, valueText), state.value && !notClearable && !disabled && /* @__PURE__ */ React.createElement("i", {
29682
29692
  className: "sps-icon sps-icon-x-circle sps-select__clear-btn",
29683
- onClick: handleClearIconClick
29693
+ onClick: handleClearIconClick,
29694
+ "data-testid": `${testId}-clear-value`
29684
29695
  }), /* @__PURE__ */ React.createElement("i", {
29685
29696
  className: "sps-icon sps-icon-chevron-down"
29686
29697
  }))), /* @__PURE__ */ React.createElement(SpsOptionList, {
@@ -29708,7 +29719,8 @@ const SpsSelect = React.forwardRef((props2, ref2) => {
29708
29719
  onOptionListChanged: handleOptionListChanged,
29709
29720
  zeroState,
29710
29721
  ignoreWidthStyles: autoFixWidth,
29711
- loading
29722
+ loading,
29723
+ "data-testid": `${testId}-option-list`
29712
29724
  }));
29713
29725
  });
29714
29726
  Object.assign(SpsSelect, {
@@ -33803,6 +33815,7 @@ const SpsTextInput = React.forwardRef((_G, ref2) => {
33803
33815
  value,
33804
33816
  disabled
33805
33817
  }, rest)), value && !disabled && /* @__PURE__ */ React.createElement("i", {
33818
+ "data-testid": `${testId}__input_clear`,
33806
33819
  className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
33807
33820
  onClick: clear
33808
33821
  })));
@@ -1 +1,2 @@
1
1
  export declare function waitATick(): void;
2
+ export declare function wait(delay?: number): Promise<unknown>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spscommerce/ds-react",
3
3
  "description": "SPS Design System React components",
4
- "version": "5.4.1",
4
+ "version": "5.5.0",
5
5
  "author": "SPS Commerce",
6
6
  "license": "UNLICENSED",
7
7
  "repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-react",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@react-stately/collections": "^3.3.3",
31
- "@spscommerce/ds-colors": "5.4.1",
32
- "@spscommerce/ds-shared": "5.4.1",
33
- "@spscommerce/positioning": "5.4.1",
34
- "@spscommerce/utils": "5.4.1",
31
+ "@spscommerce/ds-colors": "5.5.0",
32
+ "@spscommerce/ds-shared": "5.5.0",
33
+ "@spscommerce/positioning": "5.5.0",
34
+ "@spscommerce/utils": "5.5.0",
35
35
  "moment": "^2.25.3",
36
36
  "moment-timezone": "^0.5.28",
37
37
  "react": "^16.9.0",
@@ -39,10 +39,10 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@react-stately/collections": "^3.3.3",
42
- "@spscommerce/ds-colors": "5.4.1",
43
- "@spscommerce/ds-shared": "5.4.1",
44
- "@spscommerce/positioning": "5.4.1",
45
- "@spscommerce/utils": "5.4.1",
42
+ "@spscommerce/ds-colors": "5.5.0",
43
+ "@spscommerce/ds-shared": "5.5.0",
44
+ "@spscommerce/positioning": "5.5.0",
45
+ "@spscommerce/utils": "5.5.0",
46
46
  "@testing-library/jest-dom": "^4.2.4",
47
47
  "@testing-library/react": "^9.3.2",
48
48
  "@types/prop-types": "^15.7.1",