@spscommerce/ds-react 8.23.9 → 8.23.11

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.js CHANGED
@@ -18565,7 +18565,8 @@ function Pu({
18565
18565
  !a && "d-none"
18566
18566
  ),
18567
18567
  tabIndex: 0,
18568
- onClick: V
18568
+ onClick: V,
18569
+ type: "button"
18569
18570
  },
18570
18571
  /* @__PURE__ */ s.createElement(
18571
18572
  "i",
@@ -18611,7 +18612,8 @@ function Pu({
18611
18612
  !o && "d-none"
18612
18613
  ),
18613
18614
  tabIndex: 0,
18614
- onClick: P
18615
+ onClick: P,
18616
+ type: "button"
18615
18617
  },
18616
18618
  /* @__PURE__ */ s.createElement(
18617
18619
  "i",
package/lib/index.umd.cjs CHANGED
@@ -3004,7 +3004,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
3004
3004
  </React.Fragment>
3005
3005
  );
3006
3006
  }
3007
- `}}}},tw={for:{type:"SpsFormMetaBase<any>",required:!0},description:"string",stronglySuggested:"boolean",help:"ReactNodeOrRenderFn",helpIcon:"SpsIcon",helpIconColor:"string",errors:"ReactNodeOrRenderFn"};function vi({children:e,className:t,description:n,for:r,stronglySuggested:s,help:a,helpIcon:l=G.SpsIcon.QUESTION_CIRCLE,helpIconColor:c="blue200",errors:p,unsafelyReplaceClassName:m,"data-testid":f,...u}){const{t:h}=o.useContext(He),S=o.useRef(null),y=o.useRef(null),T=o.useRef(null),w=o.useRef(null),[E,N]=o.useState(_e.HIDDEN),[M,I]=o.useState(_e.HIDDEN),[k,V]=o.useState(_e.HIDDEN),[B,C]=o.useState(_e.HIDDEN);function P(){V(_e.HIDDEN),N(_e.HIDDEN)}function O(){I(_e.HIDDEN),C(_e.HIDDEN)}function K(U){U.preventDefault(),O(),V(es(k))}function j(){return r&&(r instanceof Pn&&r.isVisibilyInvalid()||!(r instanceof Pn)&&!r.isValid())?[M,I]:r&&r instanceof Pn&&r.hasPreventativeErrors()?[B,C]:[_e.HIDDEN,()=>{}]}function _(){O();const[U,R]=j();R(es(U))}function ee(){O();const[,U]=j();U(_e.VISIBLE)}function A(U){U.preventDefault(),O(),N(es(E))}o.useEffect(()=>{r&&(r.onFocus=ee,r.onBlur=O)},[r]);const te=Y(m||"sps-form-group__label",t),[$,Z]=r instanceof Pn?[r,void 0]:[void 0,r];function se(){var U;if($){for(const R of["dateFormat","dateRangeOrder","dateValidity","required","minLength"])if($.hasError(R))return h(`design-system:label.errors.${R}`,{context:$.errors?$.errors[R]:""});if($.hasError("dateConstraint")){const R=(U=$.errors)==null?void 0:U.dateConstraint,q=R.minExceeded?"min":"max";return h(`design-system:label.errors.dateConstraint.${q}`,{context:R})}}return null}function W(){if($){for(const U of zt)if($.hasPreventativeError(U))return h(`design-system:label.preventativeErrors.${U}`)}return null}const[z,re]=xt(e,[{type:Ft}]);o.useEffect(()=>{$!=null&&$.hasPreventativeErrors()&&C(_e.VISIBLE)},[$==null?void 0:$.hasPreventativeErrors()]);const ne=o.useRef(null);return o.useEffect(()=>{function U(R){var q;(q=ne.current)!=null&&q.contains(R.target)||P()}return document.addEventListener("click",U),()=>{document.removeEventListener("click",U)}},[]),o.createElement(at,{ref:ne,formMeta:$,formControl:Z},o.createElement("label",{htmlFor:r&&"id"in r?r.id:void 0,className:te,"data-testid":f,...u},o.createElement("button",{className:Y("sps-icon-button-wrapper","suggested-icon",!s&&"d-none"),tabIndex:0,onClick:K},o.createElement("i",{ref:y,"data-testid":`${f}__suggested-icon`,className:Y("sps-icon","sps-icon-exclamation-triangle","orange200","sps-form-group__label-suggested-icon",!s&&"d-none")})),o.createElement("i",{ref:S,"data-testid":`${f}__error-icon`,className:Y("sps-icon","sps-icon-exclamation-circle","sps-form-group__label--error-icon"),onClick:_}),o.createElement("span",{ref:w,className:"sps-form-group__label-content"},re),o.createElement("button",{className:Y("sps-icon-button-wrapper",!a&&"d-none"),tabIndex:0,onClick:A},o.createElement("i",{ref:T,"data-testid":`${f}__help-icon`,className:Y("sps-icon",`sps-icon-${l}`,c,!a&&"d-none"),onClick:A})),z),o.createElement(Ot,{kind:G.TooltipKind.DEFAULT,for:T,showOn:G.TooltipShowTrigger.MANUAL,isShown:E,altPosition:G.Position.TOP_MIDDLE},yt(a)),o.createElement(Ot,{kind:G.TooltipKind.ERROR,for:S,showOn:G.TooltipShowTrigger.MANUAL,isShown:M,altPosition:G.Position.LEFT_MIDDLE},yt(p)||se()),($==null?void 0:$.hasPreventativeErrors())&&o.createElement(Ot,{kind:G.TooltipKind.WARNING,for:w,showOn:G.TooltipShowTrigger.MANUAL,isShown:B,altPosition:G.Position.LEFT_MIDDLE},yt(p)||W()),o.createElement(Ot,{kind:G.TooltipKind.DEFAULT,for:y,position:G.Position.TOP_LEFT,altPosition:G.Position.TOP_LEFT,showOn:G.TooltipShowTrigger.MANUAL,isShown:k},h("design-system:label.stronglySuggested")),n&&o.createElement("div",{className:"sps-form-control__description","data-testid":`${f}__description`},n))}Object.assign(vi,{props:tw,displayName:"SpsLabel"});const bu={general:{label:"General Usage",description:()=>o.createElement("p",null,"In almost all cases, input fields should be paired with a label describing the value to be entered into the field. Certain labels can be accompanied by icons to provide additional information or context about that particular field.")},basic:{label:"Basic Label",examples:{basic:{react:v.code`
3007
+ `}}}},tw={for:{type:"SpsFormMetaBase<any>",required:!0},description:"string",stronglySuggested:"boolean",help:"ReactNodeOrRenderFn",helpIcon:"SpsIcon",helpIconColor:"string",errors:"ReactNodeOrRenderFn"};function vi({children:e,className:t,description:n,for:r,stronglySuggested:s,help:a,helpIcon:l=G.SpsIcon.QUESTION_CIRCLE,helpIconColor:c="blue200",errors:p,unsafelyReplaceClassName:m,"data-testid":f,...u}){const{t:h}=o.useContext(He),S=o.useRef(null),y=o.useRef(null),T=o.useRef(null),w=o.useRef(null),[E,N]=o.useState(_e.HIDDEN),[M,I]=o.useState(_e.HIDDEN),[k,V]=o.useState(_e.HIDDEN),[B,C]=o.useState(_e.HIDDEN);function P(){V(_e.HIDDEN),N(_e.HIDDEN)}function O(){I(_e.HIDDEN),C(_e.HIDDEN)}function K(U){U.preventDefault(),O(),V(es(k))}function j(){return r&&(r instanceof Pn&&r.isVisibilyInvalid()||!(r instanceof Pn)&&!r.isValid())?[M,I]:r&&r instanceof Pn&&r.hasPreventativeErrors()?[B,C]:[_e.HIDDEN,()=>{}]}function _(){O();const[U,R]=j();R(es(U))}function ee(){O();const[,U]=j();U(_e.VISIBLE)}function A(U){U.preventDefault(),O(),N(es(E))}o.useEffect(()=>{r&&(r.onFocus=ee,r.onBlur=O)},[r]);const te=Y(m||"sps-form-group__label",t),[$,Z]=r instanceof Pn?[r,void 0]:[void 0,r];function se(){var U;if($){for(const R of["dateFormat","dateRangeOrder","dateValidity","required","minLength"])if($.hasError(R))return h(`design-system:label.errors.${R}`,{context:$.errors?$.errors[R]:""});if($.hasError("dateConstraint")){const R=(U=$.errors)==null?void 0:U.dateConstraint,q=R.minExceeded?"min":"max";return h(`design-system:label.errors.dateConstraint.${q}`,{context:R})}}return null}function W(){if($){for(const U of zt)if($.hasPreventativeError(U))return h(`design-system:label.preventativeErrors.${U}`)}return null}const[z,re]=xt(e,[{type:Ft}]);o.useEffect(()=>{$!=null&&$.hasPreventativeErrors()&&C(_e.VISIBLE)},[$==null?void 0:$.hasPreventativeErrors()]);const ne=o.useRef(null);return o.useEffect(()=>{function U(R){var q;(q=ne.current)!=null&&q.contains(R.target)||P()}return document.addEventListener("click",U),()=>{document.removeEventListener("click",U)}},[]),o.createElement(at,{ref:ne,formMeta:$,formControl:Z},o.createElement("label",{htmlFor:r&&"id"in r?r.id:void 0,className:te,"data-testid":f,...u},o.createElement("button",{className:Y("sps-icon-button-wrapper","suggested-icon",!s&&"d-none"),tabIndex:0,onClick:K,type:"button"},o.createElement("i",{ref:y,"data-testid":`${f}__suggested-icon`,className:Y("sps-icon","sps-icon-exclamation-triangle","orange200","sps-form-group__label-suggested-icon",!s&&"d-none")})),o.createElement("i",{ref:S,"data-testid":`${f}__error-icon`,className:Y("sps-icon","sps-icon-exclamation-circle","sps-form-group__label--error-icon"),onClick:_}),o.createElement("span",{ref:w,className:"sps-form-group__label-content"},re),o.createElement("button",{className:Y("sps-icon-button-wrapper",!a&&"d-none"),tabIndex:0,onClick:A,type:"button"},o.createElement("i",{ref:T,"data-testid":`${f}__help-icon`,className:Y("sps-icon",`sps-icon-${l}`,c,!a&&"d-none"),onClick:A})),z),o.createElement(Ot,{kind:G.TooltipKind.DEFAULT,for:T,showOn:G.TooltipShowTrigger.MANUAL,isShown:E,altPosition:G.Position.TOP_MIDDLE},yt(a)),o.createElement(Ot,{kind:G.TooltipKind.ERROR,for:S,showOn:G.TooltipShowTrigger.MANUAL,isShown:M,altPosition:G.Position.LEFT_MIDDLE},yt(p)||se()),($==null?void 0:$.hasPreventativeErrors())&&o.createElement(Ot,{kind:G.TooltipKind.WARNING,for:w,showOn:G.TooltipShowTrigger.MANUAL,isShown:B,altPosition:G.Position.LEFT_MIDDLE},yt(p)||W()),o.createElement(Ot,{kind:G.TooltipKind.DEFAULT,for:y,position:G.Position.TOP_LEFT,altPosition:G.Position.TOP_LEFT,showOn:G.TooltipShowTrigger.MANUAL,isShown:k},h("design-system:label.stronglySuggested")),n&&o.createElement("div",{className:"sps-form-control__description","data-testid":`${f}__description`},n))}Object.assign(vi,{props:tw,displayName:"SpsLabel"});const bu={general:{label:"General Usage",description:()=>o.createElement("p",null,"In almost all cases, input fields should be paired with a label describing the value to be entered into the field. Certain labels can be accompanied by icons to provide additional information or context about that particular field.")},basic:{label:"Basic Label",examples:{basic:{react:v.code`
3008
3008
  import {
3009
3009
  SpsLabel,
3010
3010
  SpsTextInput,
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.23.9",
4
+ "version": "8.23.11",
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.23.9",
50
- "@sps-woodland/tabs": "8.23.9",
51
- "@spscommerce/ds-colors": "8.23.9",
52
- "@spscommerce/ds-shared": "8.23.9",
53
- "@spscommerce/positioning": "8.23.9"
49
+ "@sps-woodland/illustrations": "8.23.11",
50
+ "@sps-woodland/tabs": "8.23.11",
51
+ "@spscommerce/ds-colors": "8.23.11",
52
+ "@spscommerce/ds-shared": "8.23.11",
53
+ "@spscommerce/positioning": "8.23.11"
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.23.9",
76
- "@sps-woodland/tabs": "8.23.9",
77
- "@spscommerce/ds-colors": "8.23.9",
78
- "@spscommerce/ds-shared": "8.23.9",
79
- "@spscommerce/positioning": "8.23.9",
80
- "test": "8.23.9"
75
+ "@sps-woodland/illustrations": "8.23.11",
76
+ "@sps-woodland/tabs": "8.23.11",
77
+ "@spscommerce/ds-colors": "8.23.11",
78
+ "@spscommerce/ds-shared": "8.23.11",
79
+ "@spscommerce/positioning": "8.23.11",
80
+ "test": "8.23.11"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "pnpm run build:js && pnpm run build:types",