@spscommerce/ds-react 5.33.7 → 5.33.10

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
@@ -1419,6 +1419,17 @@ const SpsFormComponentWrapper = React.forwardRef((props2, ref2) => {
1419
1419
  onClick(event);
1420
1420
  }
1421
1421
  }
1422
+ React.useEffect(() => {
1423
+ function handleMouseDown(e2) {
1424
+ if (e2.target.classList.contains("sps-form-control__clear-btn")) {
1425
+ e2.preventDefault();
1426
+ }
1427
+ }
1428
+ document.addEventListener("mousedown", handleMouseDown);
1429
+ return () => {
1430
+ document.removeEventListener("mousedown", handleMouseDown);
1431
+ };
1432
+ }, []);
1422
1433
  return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, rest), {
1423
1434
  className: classes,
1424
1435
  ref: ref2,
@@ -2404,7 +2415,7 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
2404
2415
  ref: optionsRef,
2405
2416
  "data-testid": `${testId}-options`,
2406
2417
  style: optionsInlineStyles
2407
- }, !loading && !searchState.pending && zeroState && (searchState.value || !searchState.isAsync) && optionList.length === 0 && /* @__PURE__ */ React.createElement("div", {
2418
+ }, !loading && !searchState.pending && zeroState && optionList.length === 0 && /* @__PURE__ */ React.createElement("div", {
2408
2419
  className: "sps-option-list__zero-state"
2409
2420
  }, zeroState), (loading || searchState.pending) && /* @__PURE__ */ React.createElement("div", {
2410
2421
  className: "sps-option-list__loading"
@@ -31100,7 +31111,7 @@ function SpsPageSelector(props2) {
31100
31111
  }, [pageProp]);
31101
31112
  function updatePage(newPage) {
31102
31113
  const constrainedPage = constrain(newPage, [1, numPages]);
31103
- if (constrainedPage !== inputPage) {
31114
+ if (newPage !== page) {
31104
31115
  setPage(constrainedPage);
31105
31116
  setInputPage(constrainedPage);
31106
31117
  if (onPageChange && typeof onPageChange === "function") {
@@ -31108,10 +31119,8 @@ function SpsPageSelector(props2) {
31108
31119
  }
31109
31120
  }
31110
31121
  }
31111
- const debouncedPageUpdate = debounce(updatePage, 500);
31112
31122
  function onTextInputInput(event) {
31113
- setInputPage(event.target.value);
31114
- void debouncedPageUpdate(parseInt(event.target.value, 10));
31123
+ setInputPage(Number(event.target.value) || "");
31115
31124
  }
31116
31125
  const classes = clsx(unsafelyReplaceClassName || "sps-page-selector", className);
31117
31126
  const id2 = useElementId(null);
@@ -31126,7 +31135,9 @@ function SpsPageSelector(props2) {
31126
31135
  }, inputPage), /* @__PURE__ */ React.createElement("label", {
31127
31136
  htmlFor: id2.current,
31128
31137
  className: "sr-only"
31129
- }, t2("design-system:pagination.page")), /* @__PURE__ */ React.createElement("input", {
31138
+ }, t2("design-system:pagination.page")), /* @__PURE__ */ React.createElement(SpsForm, {
31139
+ onSubmit: () => updatePage(Number(inputPage))
31140
+ }, /* @__PURE__ */ React.createElement("input", {
31130
31141
  id: id2.current,
31131
31142
  type: "text",
31132
31143
  value: inputPage,
@@ -31134,8 +31145,9 @@ function SpsPageSelector(props2) {
31134
31145
  onChange: () => {
31135
31146
  },
31136
31147
  className: "sps-form-control sps-pagination__input",
31137
- disabled
31138
- })), /* @__PURE__ */ React.createElement("span", {
31148
+ disabled,
31149
+ onBlur: () => updatePage(Number(inputPage))
31150
+ }))), /* @__PURE__ */ React.createElement("span", {
31139
31151
  className: "sps-page-selector__total-pages",
31140
31152
  "data-testid": `${testId}_page-count`
31141
31153
  }, Number.isNaN(numPages) ? t2("design-system:pagination.ofMany") : t2("design-system:pagination.ofPageCount", { pageCount: numPages })), /* @__PURE__ */ React.createElement("div", {
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.33.7",
4
+ "version": "5.33.10",
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,11 +28,11 @@
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@react-stately/collections": "^3.3.3",
31
- "@spscommerce/ds-colors": "5.33.7",
32
- "@spscommerce/ds-illustrations": "5.33.7",
33
- "@spscommerce/ds-shared": "5.33.7",
34
- "@spscommerce/positioning": "5.33.7",
35
- "@spscommerce/utils": "5.33.7",
31
+ "@spscommerce/ds-colors": "5.33.10",
32
+ "@spscommerce/ds-illustrations": "5.33.10",
33
+ "@spscommerce/ds-shared": "5.33.10",
34
+ "@spscommerce/positioning": "5.33.10",
35
+ "@spscommerce/utils": "5.33.10",
36
36
  "moment": "^2.25.3",
37
37
  "moment-timezone": "^0.5.28",
38
38
  "react": "^16.9.0",
@@ -40,11 +40,11 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@react-stately/collections": "^3.3.3",
43
- "@spscommerce/ds-colors": "5.33.7",
44
- "@spscommerce/ds-illustrations": "5.33.7",
45
- "@spscommerce/ds-shared": "5.33.7",
46
- "@spscommerce/positioning": "5.33.7",
47
- "@spscommerce/utils": "5.33.7",
43
+ "@spscommerce/ds-colors": "5.33.10",
44
+ "@spscommerce/ds-illustrations": "5.33.10",
45
+ "@spscommerce/ds-shared": "5.33.10",
46
+ "@spscommerce/positioning": "5.33.10",
47
+ "@spscommerce/utils": "5.33.10",
48
48
  "@testing-library/react": "^9.3.2",
49
49
  "@types/prop-types": "^15.7.1",
50
50
  "@types/react": "^16.9.0",