@spscommerce/ds-react 5.10.5 → 5.10.6

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
@@ -1760,11 +1760,15 @@ function useOptionListOptions(props2, searchState, searchStatePatch) {
1760
1760
  const [optionList, setOptionList] = React.useState(Object.freeze([]));
1761
1761
  const [anyOptionHasIcon, setAnyOptionHasIcon] = React.useState(false);
1762
1762
  const promiseRef = React.useRef(null);
1763
- const update2 = React.useMemo(() => typeof props2.options === "function" ? debounce(updateOptions, typeof props2.searchDebounce !== "undefined" ? props2.searchDebounce : 500) : updateOptions, [props2.options, props2.disabledOptions]);
1763
+ const optionsRef = React.useRef(props2.options);
1764
+ if (typeof props2.options !== "function") {
1765
+ optionsRef.current = props2.options;
1766
+ }
1767
+ const update2 = React.useMemo(() => typeof optionsRef.current === "function" ? debounce(updateOptions, typeof props2.searchDebounce !== "undefined" ? props2.searchDebounce : 500) : updateOptions, [optionsRef.current, props2.disabledOptions]);
1764
1768
  React.useEffect(() => {
1765
1769
  void update2(props2, searchState, searchStatePatch, setOptionList, setAnyOptionHasIcon, promiseRef);
1766
1770
  }, [
1767
- props2.options,
1771
+ optionsRef.current,
1768
1772
  searchState.value,
1769
1773
  props2.disabledOptions
1770
1774
  ]);
@@ -2396,17 +2400,17 @@ function documentClickHandlerFactory(rootRef, popupRef, doHidePopup) {
2396
2400
  function useInputPopup(rootRef, popupRef) {
2397
2401
  const suppressPopup = React.useRef(false);
2398
2402
  const [showPopup, setShowPopup] = React.useState(false);
2399
- function doShowPopup() {
2403
+ const doShowPopup = React.useCallback(() => {
2400
2404
  if (suppressPopup.current) {
2401
2405
  suppressPopup.current = false;
2402
2406
  } else {
2403
2407
  setShowPopup(true);
2404
2408
  }
2405
- }
2409
+ }, []);
2406
2410
  const doHidePopup = React.useCallback((suppressNextShow = false) => {
2407
2411
  setShowPopup(false);
2408
2412
  suppressPopup.current = suppressNextShow;
2409
- }, [setShowPopup]);
2413
+ }, []);
2410
2414
  useDocumentEventListener("click", documentClickHandlerFactory, [
2411
2415
  rootRef,
2412
2416
  popupRef,
@@ -36998,7 +37002,8 @@ function SpsDatepickerV2(_W) {
36998
37002
  maxDate,
36999
37003
  minDate,
37000
37004
  onChange,
37001
- value
37005
+ value,
37006
+ "data-testid": testId
37002
37007
  } = _X, rest = __objRest(_X, [
37003
37008
  "children",
37004
37009
  "className",
@@ -37008,7 +37013,8 @@ function SpsDatepickerV2(_W) {
37008
37013
  "maxDate",
37009
37014
  "minDate",
37010
37015
  "onChange",
37011
- "value"
37016
+ "value",
37017
+ "data-testid"
37012
37018
  ]);
37013
37019
  const { wrapperId, controlId } = useFormControlId(id2, formMeta);
37014
37020
  const rootRef = React.useRef(null);
@@ -37071,7 +37077,8 @@ function SpsDatepickerV2(_W) {
37071
37077
  onClick: doShowPopup,
37072
37078
  onFocus: doShowPopup,
37073
37079
  value: stringValue,
37074
- disabled
37080
+ disabled,
37081
+ "data-testid": `${testId}_date_input`
37075
37082
  }, rest)), value && !disabled && /* @__PURE__ */ React.createElement("i", {
37076
37083
  className: "sps-icon sps-icon-x-circle sps-form-control__clear-btn",
37077
37084
  onClick: clear
@@ -37080,6 +37087,7 @@ function SpsDatepickerV2(_W) {
37080
37087
  attachTo: rootRef,
37081
37088
  ref: datepickerPopupRef
37082
37089
  }, /* @__PURE__ */ React.createElement(SpsDatepickerCalendar, {
37090
+ "data-testid": `${testId}_calendar`,
37083
37091
  selectedDate: value,
37084
37092
  onNewSelection: handleNewSelection,
37085
37093
  minDate,
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.10.5",
4
+ "version": "5.10.6",
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.10.5",
32
- "@spscommerce/ds-shared": "5.10.5",
33
- "@spscommerce/positioning": "5.10.5",
34
- "@spscommerce/utils": "5.10.5",
31
+ "@spscommerce/ds-colors": "5.10.6",
32
+ "@spscommerce/ds-shared": "5.10.6",
33
+ "@spscommerce/positioning": "5.10.6",
34
+ "@spscommerce/utils": "5.10.6",
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.10.5",
43
- "@spscommerce/ds-shared": "5.10.5",
44
- "@spscommerce/positioning": "5.10.5",
45
- "@spscommerce/utils": "5.10.5",
42
+ "@spscommerce/ds-colors": "5.10.6",
43
+ "@spscommerce/ds-shared": "5.10.6",
44
+ "@spscommerce/positioning": "5.10.6",
45
+ "@spscommerce/utils": "5.10.6",
46
46
  "@testing-library/react": "^9.3.2",
47
47
  "@types/prop-types": "^15.7.1",
48
48
  "@types/react": "^16.9.0",