@spscommerce/ds-react 8.4.3 → 8.4.5
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/incrementor/SpsIncrementor.d.ts +1 -0
- package/lib/index.cjs.js +2 -1
- package/lib/index.es.js +28 -25
- package/package.json +12 -12
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,
|
|
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
|
-
|
|
18010
|
-
|
|
18011
|
-
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18017
|
-
|
|
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
|
-
|
|
18020
|
-
}, [
|
|
18021
|
-
const
|
|
18022
|
-
|
|
18023
|
-
},
|
|
18024
|
-
return /* @__PURE__ */ s.createElement("div", { className:
|
|
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": `${
|
|
18029
|
-
onClick:
|
|
18030
|
+
"data-testid": `${m}__minus`,
|
|
18031
|
+
onClick: E,
|
|
18030
18032
|
disabled: n,
|
|
18031
|
-
"aria-label": `Subtract ${
|
|
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",
|
|
18039
|
-
value:
|
|
18040
|
-
onChange:
|
|
18040
|
+
className: K("sps-form-control", v && "sps-input--error"),
|
|
18041
|
+
value: h,
|
|
18042
|
+
onChange: N,
|
|
18041
18043
|
disabled: n,
|
|
18042
|
-
"data-testid": `${
|
|
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": `${
|
|
18050
|
-
onClick:
|
|
18051
|
+
"data-testid": `${m}__plus`,
|
|
18052
|
+
onClick: T,
|
|
18051
18053
|
disabled: n,
|
|
18052
|
-
"aria-label": `Add ${
|
|
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.
|
|
4
|
+
"version": "8.4.5",
|
|
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.
|
|
50
|
-
"@sps-woodland/tabs": "8.4.
|
|
51
|
-
"@spscommerce/ds-colors": "8.4.
|
|
52
|
-
"@spscommerce/ds-shared": "8.4.
|
|
53
|
-
"@spscommerce/positioning": "8.4.
|
|
49
|
+
"@sps-woodland/illustrations": "8.4.5",
|
|
50
|
+
"@sps-woodland/tabs": "8.4.5",
|
|
51
|
+
"@spscommerce/ds-colors": "8.4.5",
|
|
52
|
+
"@spscommerce/ds-shared": "8.4.5",
|
|
53
|
+
"@spscommerce/positioning": "8.4.5"
|
|
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.
|
|
76
|
-
"@sps-woodland/tabs": "8.4.
|
|
77
|
-
"@spscommerce/ds-colors": "8.4.
|
|
78
|
-
"@spscommerce/ds-shared": "8.4.
|
|
79
|
-
"@spscommerce/positioning": "8.4.
|
|
80
|
-
"test": "8.4.
|
|
75
|
+
"@sps-woodland/illustrations": "8.4.5",
|
|
76
|
+
"@sps-woodland/tabs": "8.4.5",
|
|
77
|
+
"@spscommerce/ds-colors": "8.4.5",
|
|
78
|
+
"@spscommerce/ds-shared": "8.4.5",
|
|
79
|
+
"@spscommerce/positioning": "8.4.5",
|
|
80
|
+
"test": "8.4.5"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "pnpm run build:js && pnpm run build:types",
|