@spscommerce/ds-react 6.31.5 → 6.32.1

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
@@ -27770,13 +27770,13 @@ Object.assign(SpsSearchResultsBar, {
27770
27770
  displayName: "SpsSearchResultsBar"
27771
27771
  });
27772
27772
  const propsDoc$R = {
27773
- results: "number",
27773
+ results: "number || null",
27774
27774
  selections: "{ [key: string]: string[] }",
27775
27775
  zeroStateText: "string",
27776
27776
  onClear: "() => void"
27777
27777
  };
27778
27778
  const propTypes$R = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
27779
- results: propTypes$1I.exports.number,
27779
+ results: propTypes$1I.exports.oneOfType([propTypes$1I.exports.number, null]),
27780
27780
  selections: impl(),
27781
27781
  zeroStateText: propTypes$1I.exports.string,
27782
27782
  onClear: fun()
@@ -27784,7 +27784,7 @@ const propTypes$R = __spreadProps(__spreadValues({}, spsGlobalPropTypes), {
27784
27784
  function SpsSearchResultsBarV2(props2) {
27785
27785
  const _a = props2, {
27786
27786
  className,
27787
- results = 0,
27787
+ results,
27788
27788
  selections,
27789
27789
  zeroStateText,
27790
27790
  onClear,
@@ -27810,7 +27810,7 @@ function SpsSearchResultsBarV2(props2) {
27810
27810
  return /* @__PURE__ */ React.createElement("div", __spreadValues({
27811
27811
  className: classes,
27812
27812
  "data-testid": `${testId}`
27813
- }, rest), /* @__PURE__ */ React.createElement("div", {
27813
+ }, rest), results !== null && results !== void 0 && /* @__PURE__ */ React.createElement("div", {
27814
27814
  className: "sps-search-results-bar-v2__results"
27815
27815
  }, /* @__PURE__ */ React.createElement("span", {
27816
27816
  "data-testid": `${testId}__label`
@@ -27912,6 +27912,69 @@ const SpsSearchResultsBarExamples = {
27912
27912
  )
27913
27913
  }
27914
27914
  `
27915
+ },
27916
+ situational: {
27917
+ description: () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", null, "Unknown Results Count"), /* @__PURE__ */ React.createElement("p", null, "In cases where the exact count of results is not able to be determined, Results section won't be displayed.")),
27918
+ react: code`
27919
+ function Component() {
27920
+
27921
+ const [advSearch, setAdvSearch] = React.useState({
27922
+ isOpen: false
27923
+ });
27924
+
27925
+ const [showSearchBar, setShowSearchBar] = React.useState(true);
27926
+
27927
+ const initialSelections = {
27928
+ sender: ["Aktie Sports","Modells Sporting Goods", "Perry Sport"],
27929
+ receiver: ["FGL Sports", "Foot Asylum", "Hervis", "Lovell Rugby"],
27930
+ };
27931
+
27932
+ const [selections, setSelections] = React.useState(initialSelections);
27933
+
27934
+ const initValue = {
27935
+ searchText: "",
27936
+ };
27937
+
27938
+ const { formValue, formMeta, updateForm } = useSpsForm(initValue);
27939
+
27940
+ function handleToggleAdvancedSearch(isOpen) {
27941
+ setAdvSearch({ isOpen });
27942
+ }
27943
+
27944
+ function handleAdvancedSearchSubmit() {
27945
+ console.log("submit");
27946
+ setSelections(initialSelections);
27947
+ }
27948
+
27949
+ function handleClear() {
27950
+ setSelections({});
27951
+ }
27952
+
27953
+ return (
27954
+ <>
27955
+ <SpsListToolbar advancedSearch={advSearch}
27956
+ onToggleAdvancedSearch={handleToggleAdvancedSearch}
27957
+ >
27958
+ <SpsListToolbarSearch>
27959
+ <SpsTextInput
27960
+ value={formValue.searchText}
27961
+ formMeta={formMeta.fields.searchText}
27962
+ placeholder="Search fields"
27963
+ />
27964
+ <SpsButton kind={ButtonKind.ICON} icon={SpsIcon.SEARCH} />
27965
+ </SpsListToolbarSearch>
27966
+ <SpsSearchResultsBarV2
27967
+ onClear={handleClear}
27968
+ selections={selections}
27969
+ />
27970
+ </SpsListToolbar>
27971
+ <SpsAdvancedSearch {...advSearch} onSubmit={handleAdvancedSearchSubmit}>
27972
+ <i>insert form here</i>
27973
+ </SpsAdvancedSearch>
27974
+ </>
27975
+ )
27976
+ }
27977
+ `
27915
27978
  }
27916
27979
  }
27917
27980
  },
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": "6.31.5",
4
+ "version": "6.32.1",
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": "6.31.5",
32
- "@spscommerce/ds-illustrations": "6.31.5",
33
- "@spscommerce/ds-shared": "6.31.5",
34
- "@spscommerce/positioning": "6.31.5",
31
+ "@spscommerce/ds-colors": "6.32.1",
32
+ "@spscommerce/ds-illustrations": "6.32.1",
33
+ "@spscommerce/ds-shared": "6.32.1",
34
+ "@spscommerce/positioning": "6.32.1",
35
35
  "@spscommerce/utils": "^6.11.3",
36
36
  "moment": "^2.25.3",
37
37
  "moment-timezone": "^0.5.28",
@@ -40,10 +40,10 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@react-stately/collections": "^3.3.3",
43
- "@spscommerce/ds-colors": "6.31.5",
44
- "@spscommerce/ds-illustrations": "6.31.5",
45
- "@spscommerce/ds-shared": "6.31.5",
46
- "@spscommerce/positioning": "6.31.5",
43
+ "@spscommerce/ds-colors": "6.32.1",
44
+ "@spscommerce/ds-illustrations": "6.32.1",
45
+ "@spscommerce/ds-shared": "6.32.1",
46
+ "@spscommerce/positioning": "6.32.1",
47
47
  "@spscommerce/utils": "^6.11.3",
48
48
  "@testing-library/react": "^10.4.0",
49
49
  "@types/prop-types": "^15.7.1",