@spscommerce/ds-react 7.12.0 → 7.12.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.cjs.js CHANGED
@@ -3386,7 +3386,7 @@ var r=n.defineLocale("zh-tw",{months:"\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u5
3386
3386
  </React.Fragment>
3387
3387
  );
3388
3388
  }
3389
- `}}}},IN={for:{type:"SpsFormMetaBase<any>",required:!0},description:"string",stronglySuggested:"boolean",help:"ReactNodeOrRenderFn",helpIcon:"SpsIcon",helpIconColor:"string",errors:"ReactNodeOrRenderFn"};function Wi({children:e,className:t,description:n,for:r,stronglySuggested:a,help:o,helpIcon:l=V.SpsIcon.QUESTION_CIRCLE,helpIconColor:c="blue200",errors:p,unsafelyReplaceClassName:u,"data-testid":m,...f}){const{t:h}=s.useContext(Re),g=s.useRef(null),E=s.useRef(null),w=s.useRef(null),T=s.useRef(null),[D,x]=s.useState(ye.HIDDEN),[k,b]=s.useState(ye.HIDDEN),[I,O]=s.useState(ye.HIDDEN),[M,L]=s.useState(ye.HIDDEN);function R(){x(ye.HIDDEN),b(ye.HIDDEN),O(ye.HIDDEN),L(ye.HIDDEN)}function W(){x(ye.DELAYED_HIDDEN),b(ye.DELAYED_HIDDEN),O(ye.DELAYED_HIDDEN)}function _(re){re.preventDefault(),R(),O(Ps(I))}function $(){return r&&(r instanceof wn&&r.isVisibilyInvalid()||!(r instanceof wn)&&!r.isValid())?[k,b]:r&&r instanceof wn&&r.hasPreventativeErrors()?[M,L]:o?[D,x]:a?[I,O]:[ye.HIDDEN,()=>{}]}function N(){R();const[re,ee]=$();ee(Ps(re))}function A(){R();const[,re]=$();re(ye.VISIBLE)}function te(re){re.preventDefault(),R(),x(Ps(D))}s.useEffect(()=>{r&&(r.onFocus=A,r.onBlur=R)},[r]);const Z=H(u||"sps-form-group__label",t),[U,X]=r instanceof wn?[r,void 0]:[void 0,r];function G(){var re;if(U){for(const ee of["dateFormat","dateRangeOrder","dateValidity","required"])if(U.hasError(ee))return h(`design-system:label.errors.${ee}`,{context:U.errors?U.errors[ee]:""});if(U.hasError("dateConstraint")){const ee=(re=U.errors)==null?void 0:re.dateConstraint,Y=ee.minExceeded?"min":"max";return h(`design-system:label.errors.dateConstraint.${Y}`,{context:ee})}}return null}function F(){if(U){for(const re of qt)if(U.hasPreventativeError(re))return h(`design-system:label.preventativeErrors.${re}`)}return null}const[J,q]=Et(e,[{type:Mt}]);return s.useEffect(()=>{U!=null&&U.hasPreventativeErrors()&&L(ye.VISIBLE)},[U==null?void 0:U.hasPreventativeErrors()]),s.createElement(nt,{formMeta:U,formControl:X},s.createElement("label",{htmlFor:r&&"id"in r?r.id:void 0,className:Z,"data-testid":m,...f},s.createElement("i",{ref:E,"data-testid":`${m}__suggested-icon`,className:H("sps-icon","sps-icon-exclamation-triangle","orange200","sps-form-group__label-suggested-icon",!a&&"d-none"),onClick:_,onMouseLeave:W}),s.createElement("i",{ref:g,"data-testid":`${m}__error-icon`,className:H("sps-icon","sps-icon-exclamation-circle","sps-form-group__label--error-icon"),onClick:N,onMouseLeave:W}),s.createElement("span",{ref:T,className:"sps-form-group__label-content"},q),s.createElement("i",{ref:w,"data-testid":`${m}__help-icon`,className:H("sps-icon",`sps-icon-${l}`,c,!o&&"d-none"),onClick:te,onMouseLeave:W}),J),s.createElement(gt,{kind:V.TooltipKind.DEFAULT,for:w,showOn:V.TooltipShowTrigger.MANUAL,isShown:D,altPosition:V.Position.TOP_MIDDLE},ct(o)),s.createElement(gt,{kind:V.TooltipKind.ERROR,for:g,showOn:V.TooltipShowTrigger.MANUAL,isShown:k,altPosition:V.Position.LEFT_MIDDLE},ct(p)||G()),(U==null?void 0:U.hasPreventativeErrors())&&s.createElement(gt,{kind:V.TooltipKind.WARNING,for:T,showOn:V.TooltipShowTrigger.MANUAL,isShown:M,altPosition:V.Position.LEFT_MIDDLE},ct(p)||F()),s.createElement(gt,{kind:V.TooltipKind.DEFAULT,for:E,position:V.Position.TOP_LEFT,altPosition:V.Position.TOP_LEFT,offsets:[13,20],showOn:V.TooltipShowTrigger.MANUAL,isShown:I},h("design-system:label.stronglySuggested")),n&&s.createElement("div",{className:"sps-form-control__description","data-testid":`${m}__description`},n))}Object.assign(Wi,{props:IN,displayName:"SpsLabel"});const xm={general:{label:"General Usage",description:()=>s.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:y.code`
3389
+ `}}}},IN={for:{type:"SpsFormMetaBase<any>",required:!0},description:"string",stronglySuggested:"boolean",help:"ReactNodeOrRenderFn",helpIcon:"SpsIcon",helpIconColor:"string",errors:"ReactNodeOrRenderFn"};function Wi({children:e,className:t,description:n,for:r,stronglySuggested:a,help:o,helpIcon:l=V.SpsIcon.QUESTION_CIRCLE,helpIconColor:c="blue200",errors:p,unsafelyReplaceClassName:u,"data-testid":m,...f}){const{t:h}=s.useContext(Re),g=s.useRef(null),E=s.useRef(null),w=s.useRef(null),T=s.useRef(null),[D,x]=s.useState(ye.HIDDEN),[k,b]=s.useState(ye.HIDDEN),[I,O]=s.useState(ye.HIDDEN),[M,L]=s.useState(ye.HIDDEN);function R(){x(ye.HIDDEN),b(ye.HIDDEN),O(ye.HIDDEN),L(ye.HIDDEN)}function W(){x(ye.DELAYED_HIDDEN),b(ye.DELAYED_HIDDEN),O(ye.DELAYED_HIDDEN)}function _(re){re.preventDefault(),R(),O(Ps(I))}function $(){return r&&(r instanceof wn&&r.isVisibilyInvalid()||!(r instanceof wn)&&!r.isValid())?[k,b]:r&&r instanceof wn&&r.hasPreventativeErrors()?[M,L]:o?[D,x]:a?[I,O]:[ye.HIDDEN,()=>{}]}function N(){R();const[re,ee]=$();ee(Ps(re))}function A(){R();const[,re]=$();re(ye.VISIBLE)}function te(re){re.preventDefault(),R(),x(Ps(D))}s.useEffect(()=>{r&&(r.onFocus=A,r.onBlur=R)},[r]);const Z=H(u||"sps-form-group__label",t),[U,X]=r instanceof wn?[r,void 0]:[void 0,r];function G(){var re;if(U){for(const ee of["dateFormat","dateRangeOrder","dateValidity","required","minLength"])if(U.hasError(ee))return h(`design-system:label.errors.${ee}`,{context:U.errors?U.errors[ee]:""});if(U.hasError("dateConstraint")){const ee=(re=U.errors)==null?void 0:re.dateConstraint,Y=ee.minExceeded?"min":"max";return h(`design-system:label.errors.dateConstraint.${Y}`,{context:ee})}}return null}function F(){if(U){for(const re of qt)if(U.hasPreventativeError(re))return h(`design-system:label.preventativeErrors.${re}`)}return null}const[J,q]=Et(e,[{type:Mt}]);return s.useEffect(()=>{U!=null&&U.hasPreventativeErrors()&&L(ye.VISIBLE)},[U==null?void 0:U.hasPreventativeErrors()]),s.createElement(nt,{formMeta:U,formControl:X},s.createElement("label",{htmlFor:r&&"id"in r?r.id:void 0,className:Z,"data-testid":m,...f},s.createElement("i",{ref:E,"data-testid":`${m}__suggested-icon`,className:H("sps-icon","sps-icon-exclamation-triangle","orange200","sps-form-group__label-suggested-icon",!a&&"d-none"),onClick:_,onMouseLeave:W}),s.createElement("i",{ref:g,"data-testid":`${m}__error-icon`,className:H("sps-icon","sps-icon-exclamation-circle","sps-form-group__label--error-icon"),onClick:N,onMouseLeave:W}),s.createElement("span",{ref:T,className:"sps-form-group__label-content"},q),s.createElement("i",{ref:w,"data-testid":`${m}__help-icon`,className:H("sps-icon",`sps-icon-${l}`,c,!o&&"d-none"),onClick:te,onMouseLeave:W}),J),s.createElement(gt,{kind:V.TooltipKind.DEFAULT,for:w,showOn:V.TooltipShowTrigger.MANUAL,isShown:D,altPosition:V.Position.TOP_MIDDLE},ct(o)),s.createElement(gt,{kind:V.TooltipKind.ERROR,for:g,showOn:V.TooltipShowTrigger.MANUAL,isShown:k,altPosition:V.Position.LEFT_MIDDLE},ct(p)||G()),(U==null?void 0:U.hasPreventativeErrors())&&s.createElement(gt,{kind:V.TooltipKind.WARNING,for:T,showOn:V.TooltipShowTrigger.MANUAL,isShown:M,altPosition:V.Position.LEFT_MIDDLE},ct(p)||F()),s.createElement(gt,{kind:V.TooltipKind.DEFAULT,for:E,position:V.Position.TOP_LEFT,altPosition:V.Position.TOP_LEFT,offsets:[13,20],showOn:V.TooltipShowTrigger.MANUAL,isShown:I},h("design-system:label.stronglySuggested")),n&&s.createElement("div",{className:"sps-form-control__description","data-testid":`${m}__description`},n))}Object.assign(Wi,{props:IN,displayName:"SpsLabel"});const xm={general:{label:"General Usage",description:()=>s.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:y.code`
3390
3390
  import {
3391
3391
  SpsLabel,
3392
3392
  SpsTextInput,
package/lib/index.es.js CHANGED
@@ -18091,7 +18091,8 @@ function Fu({
18091
18091
  "dateFormat",
18092
18092
  "dateRangeOrder",
18093
18093
  "dateValidity",
18094
- "required"
18094
+ "required",
18095
+ "minLength"
18095
18096
  ])
18096
18097
  if (W.hasError(X))
18097
18098
  return h(`design-system:label.errors.${X}`, { context: W.errors ? W.errors[X] : "" });
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.12.0",
4
+ "version": "7.12.1",
5
5
  "author": "SPS Commerce",
6
6
  "license": "UNLICENSED",
7
7
  "repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/ds-react",
@@ -41,11 +41,11 @@
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@react-stately/collections": "^3.6.0",
44
- "@sps-woodland/illustrations": "7.12.0",
45
- "@sps-woodland/tabs": "7.12.0",
46
- "@spscommerce/ds-colors": "7.12.0",
47
- "@spscommerce/ds-shared": "7.12.0",
48
- "@spscommerce/positioning": "7.12.0",
44
+ "@sps-woodland/illustrations": "7.12.1",
45
+ "@sps-woodland/tabs": "7.12.1",
46
+ "@spscommerce/ds-colors": "7.12.1",
47
+ "@spscommerce/ds-shared": "7.12.1",
48
+ "@spscommerce/positioning": "7.12.1",
49
49
  "@spscommerce/utils": "^6.11.3",
50
50
  "moment": "^2.25.3",
51
51
  "moment-timezone": "^0.5.28",
@@ -59,11 +59,11 @@
59
59
  "@react-types/select": "^3.6.1",
60
60
  "@react-types/shared": "^3.8.0",
61
61
  "@react-types/tabs": "^3.0.1",
62
- "@sps-woodland/illustrations": "7.12.0",
63
- "@sps-woodland/tabs": "7.12.0",
64
- "@spscommerce/ds-colors": "7.12.0",
65
- "@spscommerce/ds-shared": "7.12.0",
66
- "@spscommerce/positioning": "7.12.0",
62
+ "@sps-woodland/illustrations": "7.12.1",
63
+ "@sps-woodland/tabs": "7.12.1",
64
+ "@spscommerce/ds-colors": "7.12.1",
65
+ "@spscommerce/ds-shared": "7.12.1",
66
+ "@spscommerce/positioning": "7.12.1",
67
67
  "@spscommerce/utils": "^6.12.1",
68
68
  "@testing-library/dom": "^8.17.1",
69
69
  "@testing-library/react": "^10.0.0",
@@ -77,7 +77,7 @@
77
77
  "raf-stub": "^2.0.2",
78
78
  "react": "^16.9.0",
79
79
  "react-dom": "^16.9.0",
80
- "test": "7.12.0"
80
+ "test": "7.12.1"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "pnpm run build:js && pnpm run build:types",