@spscommerce/ds-react 8.4.3 → 8.4.4

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.
@@ -3,6 +3,7 @@ import type { SpsGlobalPropTypes } from "../prop-types";
3
3
  export declare type SpsIncrementorProps = React.PropsWithChildren<SpsGlobalPropTypes & {
4
4
  autoComplete?: string;
5
5
  disabled?: boolean;
6
+ defaultValue?: number;
6
7
  min?: number;
7
8
  max?: number;
8
9
  step?: number;
package/lib/index.cjs.js CHANGED
@@ -2813,7 +2813,7 @@ var r=n.defineLocale("zh-tw",{months:"\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u5
2813
2813
  </SpsForm>
2814
2814
  )
2815
2815
  }
2816
- `}}}},vN={disabled:"boolean",min:"number",max:"number",step:"number",onValueChange:"(newValue: number) => void"};function $i(e){const{autoComplete:t,disabled:n,min:r=Number.MIN_SAFE_INTEGER,max:a=Number.MAX_SAFE_INTEGER,step:o=1,onValueChange:l,unsafelyReplaceClassName:c,className:p,"data-testid":f,...m}=e,[u,h]=s.useState(Math.max(r,0)),[g,v]=s.useState(!1);s.useEffect(()=>{l&&typeof l=="function"&&l(u),v(u<r||u>a)},[u]);const w=()=>u<=r?!1:(u>a?h(a):h(x=>x-o),!0),T=()=>u>=a?!1:(u<r?h(r):h(x=>x+o),!0),E=x=>{x.target.value!==""&&h(parseInt(x.target.value,10))},N=c||H("sps-incrementor sps-input-group sps-input-group__append",p);return s.createElement("div",{className:N,...m,"data-testid":f},s.createElement("div",{className:"sps-button sps-button--icon"},s.createElement("button",{type:"button","data-testid":`${f}__minus`,onClick:w,disabled:n,"aria-label":`Subtract ${o}`},s.createElement("i",{className:"sps-icon sps-icon-minus","aria-hidden":"true"}))),s.createElement("div",{className:"sps-text-input"},s.createElement("input",{type:"text",className:H("sps-form-control",g&&"sps-input--error"),value:u,onChange:E,disabled:n,"data-testid":`${f}__input`,autoComplete:t})),s.createElement("div",{className:"sps-button sps-button--icon"},s.createElement("button",{type:"button","data-testid":`${f}__plus`,onClick:T,disabled:n,"aria-label":`Add ${o}`},s.createElement("i",{className:"sps-icon sps-icon-plus-sign","aria-hidden":"true"}))))}Object.assign($i,{props:vN,displayName:"SpsIncrementor"});const pm={stepExample:{label:"Incrementor",description:"info about incrementor",examples:{stacked:{react:y.code`
2816
+ `}}}},vN={disabled:"boolean",defaultValue:"number",min:"number",max:"number",step:"number",onValueChange:"(newValue: number) => void"};function $i(e){const{autoComplete:t,disabled:n,defaultValue:r=0,min:a=Number.MIN_SAFE_INTEGER,max:o=Number.MAX_SAFE_INTEGER,step:l=1,onValueChange:c,unsafelyReplaceClassName:p,className:f,"data-testid":m,...u}=e,[h,g]=s.useState(Math.max(a,r)),[v,w]=s.useState(!1);s.useEffect(()=>{c&&typeof c=="function"&&c(h),w(h<a||h>o)},[h]);const T=()=>h<=a?!1:(h>o?g(o):g(I=>Math.max(I-l,a)),!0),E=()=>h>=o?!1:(h<a?g(a):g(I=>I+l),!0),N=I=>{I.target.value!==""&&g(parseInt(I.target.value,10))},x=p||H("sps-incrementor sps-input-group sps-input-group__append",f);return s.createElement("div",{className:x,...u,"data-testid":m},s.createElement("div",{className:"sps-button sps-button--icon"},s.createElement("button",{type:"button","data-testid":`${m}__minus`,onClick:T,disabled:n,"aria-label":`Subtract ${l}`},s.createElement("i",{className:"sps-icon sps-icon-minus","aria-hidden":"true"}))),s.createElement("div",{className:"sps-text-input"},s.createElement("input",{type:"text",className:H("sps-form-control",v&&"sps-input--error"),value:h,onChange:N,disabled:n,"data-testid":`${m}__input`,autoComplete:t})),s.createElement("div",{className:"sps-button sps-button--icon"},s.createElement("button",{type:"button","data-testid":`${m}__plus`,onClick:E,disabled:n,"aria-label":`Add ${l}`},s.createElement("i",{className:"sps-icon sps-icon-plus-sign","aria-hidden":"true"}))))}Object.assign($i,{props:vN,displayName:"SpsIncrementor"});const pm={stepExample:{label:"Incrementor",description:"info about incrementor",examples:{stacked:{react:y.code`
2817
2817
  import { SpsIncrementor } from "@spscommerce/ds-react";
2818
2818
  function Component () {
2819
2819
  const [value, setValue] = React.useState("");
@@ -2823,6 +2823,7 @@ var r=n.defineLocale("zh-tw",{months:"\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u5
2823
2823
  return (
2824
2824
  <React.Fragment>
2825
2825
  <SpsIncrementor
2826
+ defaultValue={1}
2826
2827
  min={0}
2827
2828
  max={10}
2828
2829
  step={2}
package/lib/index.es.js CHANGED
@@ -17997,6 +17997,7 @@ const ZD = {
17997
17997
  }
17998
17998
  }, XD = {
17999
17999
  disabled: "boolean",
18000
+ defaultValue: "number",
18000
18001
  min: "number",
18001
18002
  max: "number",
18002
18003
  step: "number",
@@ -18006,50 +18007,51 @@ function Tu(e) {
18006
18007
  const {
18007
18008
  autoComplete: t,
18008
18009
  disabled: n,
18009
- min: r = Number.MIN_SAFE_INTEGER,
18010
- max: a = Number.MAX_SAFE_INTEGER,
18011
- step: o = 1,
18012
- onValueChange: l,
18013
- unsafelyReplaceClassName: c,
18014
- className: p,
18015
- "data-testid": f,
18016
- ...m
18017
- } = e, [u, h] = s.useState(Math.max(r, 0)), [g, v] = s.useState(!1);
18010
+ defaultValue: r = 0,
18011
+ min: a = Number.MIN_SAFE_INTEGER,
18012
+ max: o = Number.MAX_SAFE_INTEGER,
18013
+ step: l = 1,
18014
+ onValueChange: c,
18015
+ unsafelyReplaceClassName: p,
18016
+ className: f,
18017
+ "data-testid": m,
18018
+ ...u
18019
+ } = e, [h, g] = s.useState(Math.max(a, r)), [v, w] = s.useState(!1);
18018
18020
  s.useEffect(() => {
18019
- l && typeof l == "function" && l(u), v(u < r || u > a);
18020
- }, [u]);
18021
- const w = () => u <= r ? !1 : (u > a ? h(a) : h((x) => x - o), !0), E = () => u >= a ? !1 : (u < r ? h(r) : h((x) => x + o), !0), T = (x) => {
18022
- x.target.value !== "" && h(parseInt(x.target.value, 10));
18023
- }, N = c || K("sps-incrementor sps-input-group sps-input-group__append", p);
18024
- return /* @__PURE__ */ s.createElement("div", { className: N, ...m, "data-testid": f }, /* @__PURE__ */ s.createElement("div", { className: "sps-button sps-button--icon" }, /* @__PURE__ */ s.createElement(
18021
+ c && typeof c == "function" && c(h), w(h < a || h > o);
18022
+ }, [h]);
18023
+ const E = () => h <= a ? !1 : (h > o ? g(o) : g((I) => Math.max(I - l, a)), !0), T = () => h >= o ? !1 : (h < a ? g(a) : g((I) => I + l), !0), N = (I) => {
18024
+ I.target.value !== "" && g(parseInt(I.target.value, 10));
18025
+ }, x = p || K("sps-incrementor sps-input-group sps-input-group__append", f);
18026
+ return /* @__PURE__ */ s.createElement("div", { className: x, ...u, "data-testid": m }, /* @__PURE__ */ s.createElement("div", { className: "sps-button sps-button--icon" }, /* @__PURE__ */ s.createElement(
18025
18027
  "button",
18026
18028
  {
18027
18029
  type: "button",
18028
- "data-testid": `${f}__minus`,
18029
- onClick: w,
18030
+ "data-testid": `${m}__minus`,
18031
+ onClick: E,
18030
18032
  disabled: n,
18031
- "aria-label": `Subtract ${o}`
18033
+ "aria-label": `Subtract ${l}`
18032
18034
  },
18033
18035
  /* @__PURE__ */ s.createElement("i", { className: "sps-icon sps-icon-minus", "aria-hidden": "true" })
18034
18036
  )), /* @__PURE__ */ s.createElement("div", { className: "sps-text-input" }, /* @__PURE__ */ s.createElement(
18035
18037
  "input",
18036
18038
  {
18037
18039
  type: "text",
18038
- className: K("sps-form-control", g && "sps-input--error"),
18039
- value: u,
18040
- onChange: T,
18040
+ className: K("sps-form-control", v && "sps-input--error"),
18041
+ value: h,
18042
+ onChange: N,
18041
18043
  disabled: n,
18042
- "data-testid": `${f}__input`,
18044
+ "data-testid": `${m}__input`,
18043
18045
  autoComplete: t
18044
18046
  }
18045
18047
  )), /* @__PURE__ */ s.createElement("div", { className: "sps-button sps-button--icon" }, /* @__PURE__ */ s.createElement(
18046
18048
  "button",
18047
18049
  {
18048
18050
  type: "button",
18049
- "data-testid": `${f}__plus`,
18050
- onClick: E,
18051
+ "data-testid": `${m}__plus`,
18052
+ onClick: T,
18051
18053
  disabled: n,
18052
- "aria-label": `Add ${o}`
18054
+ "aria-label": `Add ${l}`
18053
18055
  },
18054
18056
  /* @__PURE__ */ s.createElement("i", { className: "sps-icon sps-icon-plus-sign", "aria-hidden": "true" })
18055
18057
  )));
@@ -18074,6 +18076,7 @@ const QD = {
18074
18076
  return (
18075
18077
  <React.Fragment>
18076
18078
  <SpsIncrementor
18079
+ defaultValue={1}
18077
18080
  min={0}
18078
18081
  max={10}
18079
18082
  step={2}
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": "8.4.3",
4
+ "version": "8.4.4",
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": "8.4.3",
50
- "@sps-woodland/tabs": "8.4.3",
51
- "@spscommerce/ds-colors": "8.4.3",
52
- "@spscommerce/ds-shared": "8.4.3",
53
- "@spscommerce/positioning": "8.4.3"
49
+ "@sps-woodland/illustrations": "8.4.4",
50
+ "@sps-woodland/tabs": "8.4.4",
51
+ "@spscommerce/ds-colors": "8.4.4",
52
+ "@spscommerce/ds-shared": "8.4.4",
53
+ "@spscommerce/positioning": "8.4.4"
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": "8.4.3",
76
- "@sps-woodland/tabs": "8.4.3",
77
- "@spscommerce/ds-colors": "8.4.3",
78
- "@spscommerce/ds-shared": "8.4.3",
79
- "@spscommerce/positioning": "8.4.3",
80
- "test": "8.4.3"
75
+ "@sps-woodland/illustrations": "8.4.4",
76
+ "@sps-woodland/tabs": "8.4.4",
77
+ "@spscommerce/ds-colors": "8.4.4",
78
+ "@spscommerce/ds-shared": "8.4.4",
79
+ "@spscommerce/positioning": "8.4.4",
80
+ "test": "8.4.4"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "pnpm run build:js && pnpm run build:types",