@spscommerce/ds-react 7.17.1 → 7.17.2

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
@@ -12544,7 +12544,7 @@ function Pu({
12544
12544
  function Q(W) {
12545
12545
  const q = u || [];
12546
12546
  let z;
12547
- !q[0] || q[1] || J.isBefore(W, q[0]) ? z = [W, null] : (z = [q[0], W], x(!0), k && k.current && k.current.focus()), N && $(N) === "Before" && q[0] === null && q[1] === null && (z = [null, W], x(!0), k && k.current && k.current.focus()), N && $(N) === "After" && (x(!0), k && k.current && k.current.focus()), R(z), L(J.toStringRange(z)), K(void 0), (N && $(N) === "Before" && z && z[0] !== null || N && $(N) !== "Before" && $(N) !== "After") && O(null);
12547
+ !q[0] || q[1] || J.isBefore(W, q[0]) ? z = [W, null] : (z = [q[0], W], x(!0), k && k.current && k.current.focus()), N && H(N) === "Before" && q[0] === null && q[1] === null && (z = [null, W], x(!0), k && k.current && k.current.focus()), N && H(N) === "After" && (x(!0), k && k.current && k.current.focus()), R(z), L(J.toStringRange(z)), K(void 0), (N && H(N) === "Before" && z && z[0] !== null || N && H(N) !== "Before" && H(N) !== "After") && O(null);
12548
12548
  }
12549
12549
  function Z(W) {
12550
12550
  L(W.target.value);
@@ -12565,13 +12565,17 @@ function Pu({
12565
12565
  }
12566
12566
  }
12567
12567
  function H(W) {
12568
+ var q;
12569
+ return W && /^design-system:/.test(W.label) ? T(W.label) : (q = W == null ? void 0 : W.label) != null ? q : "";
12570
+ }
12571
+ function $(W) {
12568
12572
  if (m && (W == null ? void 0 : W.definition) !== f && m(typeof (W == null ? void 0 : W.definition) == "string" ? W == null ? void 0 : W.definition : ""), !W) {
12569
12573
  O(null), R(void 0);
12570
12574
  return;
12571
12575
  }
12572
12576
  O(W);
12573
12577
  const q = J.createRangeFromPreset(W);
12574
- if (W && $(W) === "Before")
12578
+ if (W && H(W) === "Before")
12575
12579
  if (u && u[0] && u[1]) {
12576
12580
  let z = J.createRangeFrom("-");
12577
12581
  z && R(z);
@@ -12579,7 +12583,7 @@ function Pu({
12579
12583
  let z = J.createRangeFrom(`-${J.toString(u && u[0])}`);
12580
12584
  z && R(z);
12581
12585
  }
12582
- else if (W && $(W) === "After")
12586
+ else if (W && H(W) === "After")
12583
12587
  if (u && u[0] && u[1]) {
12584
12588
  let z = J.createRangeFrom("-");
12585
12589
  z && R(z);
@@ -12597,15 +12601,12 @@ function Pu({
12597
12601
  J.createRangeFromPreset(z)
12598
12602
  )
12599
12603
  );
12600
- q ? H(q) : u[0] === null || u[1] === null || O(null);
12604
+ q ? $(q) : u[0] === null || u[1] === null || O(null);
12601
12605
  }
12602
12606
  }, [u]), s.useEffect(() => {
12603
- const W = N ? $(N) : "";
12604
- !u && !["Before", "After"].includes(W) ? U() : Array.isArray(u) && !N ? (u.every((q) => J.isValid(q) || q === null) && L(J.toStringRange(u)), K(void 0)) : Array.isArray(u) && u[0] && u[1] && (W === "Before" || W === "After") && u.every((q) => J.isValid(q) || q === null) ? L(J.toStringRange(u)) : Array.isArray(u) && N && L("");
12607
+ const W = ["Before", "After"].includes(H(N));
12608
+ N && !W ? L("") : Array.isArray(u) && (L(J.toStringRange(u)), N || K(void 0));
12605
12609
  }, [u, N]);
12606
- function $(W) {
12607
- return W && /^design-system:/.test(W.label) ? T(W.label) : W.label;
12608
- }
12609
12610
  const X = V(
12610
12611
  ld,
12611
12612
  "sps-text-input",
@@ -12628,7 +12629,7 @@ function Pu({
12628
12629
  className: "sps-datepicker__selected-preset"
12629
12630
  }, /* @__PURE__ */ s.createElement("span", {
12630
12631
  className: "sps-tag sps-tag--info"
12631
- }, $(N))), /* @__PURE__ */ s.createElement("input", {
12632
+ }, H(N))), /* @__PURE__ */ s.createElement("input", {
12632
12633
  type: "text",
12633
12634
  ref: k,
12634
12635
  className: "sps-text-input__input",
@@ -12662,32 +12663,32 @@ function Pu({
12662
12663
  className: "sps-custom-control__input",
12663
12664
  checked: !N,
12664
12665
  name: `sps-date-range-picker-${w}__range`,
12665
- onChange: () => H()
12666
+ onChange: () => $()
12666
12667
  }), /* @__PURE__ */ s.createElement("label", {
12667
12668
  className: "sps-custom-control__label",
12668
12669
  htmlFor: `sps-date-range-picker-${w}__range-custom`
12669
12670
  }, T("design-system:datepicker.preset.custom"))), p.map((W, q) => /* @__PURE__ */ s.createElement("div", {
12670
- key: $(W),
12671
+ key: H(W),
12671
12672
  className: "sps-custom-control sps-custom-radio sps-custom-control--no-error"
12672
12673
  }, /* @__PURE__ */ s.createElement("input", {
12673
12674
  type: "radio",
12674
12675
  "data-testid": `${g}_preset_option_${W.label}`,
12675
12676
  id: `sps-date-range-picker-${w}__range-${q}`,
12676
12677
  name: `sps-date-range-picker-${w}__range`,
12677
- onChange: () => H(W),
12678
+ onChange: () => $(W),
12678
12679
  checked: N != null && N.definition ? N.definition === W.definition : !1,
12679
12680
  className: "sps-custom-control__input"
12680
12681
  }), /* @__PURE__ */ s.createElement("label", {
12681
12682
  className: "sps-custom-control__label",
12682
12683
  htmlFor: `sps-date-range-picker-${w}__range-${q}`
12683
- }, $(W)))))), /* @__PURE__ */ s.createElement(Ea, {
12684
+ }, H(W)))))), /* @__PURE__ */ s.createElement(Ea, {
12684
12685
  "data-testid": `${g}_calendar`,
12685
12686
  selectedRange: Array.isArray(u) ? u : P,
12686
12687
  onNewSelection: Q,
12687
12688
  minDate: l,
12688
12689
  maxDate: o,
12689
12690
  showTwoMonths: h,
12690
- selectedPreset: N && $(N)
12691
+ selectedPreset: N && H(N)
12691
12692
  })));
12692
12693
  }
12693
12694
  Object.assign(Pu, {
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": "7.17.1",
4
+ "version": "7.17.2",
5
5
  "author": "SPS Commerce",
6
6
  "license": "UNLICENSED",
7
7
  "repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/ds-react",
@@ -46,11 +46,11 @@
46
46
  "moment-timezone": "^0.5.28",
47
47
  "react": "^16.9.0",
48
48
  "react-dom": "^16.9.0",
49
- "@sps-woodland/illustrations": "7.17.1",
50
- "@sps-woodland/tabs": "7.17.1",
51
- "@spscommerce/ds-colors": "7.17.1",
52
- "@spscommerce/ds-shared": "7.17.1",
53
- "@spscommerce/positioning": "7.17.1"
49
+ "@sps-woodland/illustrations": "7.17.2",
50
+ "@sps-woodland/tabs": "7.17.2",
51
+ "@spscommerce/ds-colors": "7.17.2",
52
+ "@spscommerce/ds-shared": "7.17.2",
53
+ "@spscommerce/positioning": "7.17.2"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@react-spectrum/provider": "^3.4.1",
@@ -72,12 +72,12 @@
72
72
  "raf-stub": "^2.0.2",
73
73
  "react": "^16.9.0",
74
74
  "react-dom": "^16.9.0",
75
- "@sps-woodland/illustrations": "7.17.1",
76
- "@sps-woodland/tabs": "7.17.1",
77
- "@spscommerce/ds-colors": "7.17.1",
78
- "@spscommerce/ds-shared": "7.17.1",
79
- "@spscommerce/positioning": "7.17.1",
80
- "test": "7.17.1"
75
+ "@sps-woodland/illustrations": "7.17.2",
76
+ "@sps-woodland/tabs": "7.17.2",
77
+ "@spscommerce/ds-colors": "7.17.2",
78
+ "@spscommerce/ds-shared": "7.17.2",
79
+ "@spscommerce/positioning": "7.17.2",
80
+ "test": "7.17.2"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "pnpm run build:js && pnpm run build:types",