@spscommerce/ds-react 5.2.0 → 5.2.3
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 +1 -1
- package/lib/index.es.js +3 -1
- package/package.json +9 -9
package/lib/index.cjs.js
CHANGED
|
@@ -4773,7 +4773,7 @@ var a=n.defineLocale("zh-tw",{months:"\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u5
|
|
|
4773
4773
|
<SpsMicroBlock kind={FeedbackBlockKind.ERROR} message="Uh oh, big problems."/>
|
|
4774
4774
|
`}}},tipBlock:{label:"Tip Micro Block",examples:{tipBlock:{jsx:D.code`
|
|
4775
4775
|
<SpsMicroBlock kind={FeedbackBlockKind.TIP} message="Pro Tip: Don't be a loser."/>
|
|
4776
|
-
`}}}},yI={kind:"ModalKind",size:"ModalSize",title:"string",onClose:"() => void",focusElementOnOpen:"React.MutableRefObject<HTMLElement>"},TI=W(I({},J),{kind:ge(O.ModalKind),size:ge(O.ModalSize),title:C.exports.string,onClose:ae(),focusElementOnOpen:Gt()});function Nr({children:e}){return s.createElement("div",{className:"sps-modal__footer"},e)}Object.assign(Nr,{props:{},propTypes:{},displayName:"SpsModalV2Footer"});function el(p){var f=p,{children:e,className:t,id:n,kind:a=O.ModalKind.GENERAL,size:o=O.ModalSize.SMALL,onClose:i,focusElementOnOpen:l,title:c}=f,u=Z(f,["children","className","id","kind","size","onClose","focusElementOnOpen","title"]);const m=aa(n),b=B("sps-modal","z-stratum-dialog",`sps-modal--${a}`,`sps-modal--${o}`,t),{t:v}=s.useContext(We),T=s.useRef(),[k,g]=s.useState(!1);s.useEffect(()=>{const N=`${window.innerWidth-document.body.clientWidth}px`;return document.body.style.paddingRight=N,document.body.style.overflow="hidden",document.querySelectorAll(".z-stratum-bar").forEach(M=>{M.style.paddingRight=N}),g(!0),()=>{document.body.style.paddingRight="initial",document.body.style.overflow="auto",document.querySelectorAll(".z-stratum-bar").forEach(M=>{M.style.paddingRight="
|
|
4776
|
+
`}}}},yI={kind:"ModalKind",size:"ModalSize",title:"string",onClose:"() => void",focusElementOnOpen:"React.MutableRefObject<HTMLElement>"},TI=W(I({},J),{kind:ge(O.ModalKind),size:ge(O.ModalSize),title:C.exports.string,onClose:ae(),focusElementOnOpen:Gt()});function Nr({children:e}){return s.createElement("div",{className:"sps-modal__footer"},e)}Object.assign(Nr,{props:{},propTypes:{},displayName:"SpsModalV2Footer"});function el(p){var f=p,{children:e,className:t,id:n,kind:a=O.ModalKind.GENERAL,size:o=O.ModalSize.SMALL,onClose:i,focusElementOnOpen:l,title:c}=f,u=Z(f,["children","className","id","kind","size","onClose","focusElementOnOpen","title"]);const m=aa(n),b=B("sps-modal","z-stratum-dialog",`sps-modal--${a}`,`sps-modal--${o}`,t),{t:v}=s.useContext(We),T=s.useRef(),[k,g]=s.useState(!1);s.useEffect(()=>{const N=`${window.innerWidth-document.body.clientWidth}px`;return document.body.style.paddingRight=N,document.body.style.overflow="hidden",document.querySelectorAll(".z-stratum-bar").forEach(M=>{M.tempPaddingRightHolder=M.style.paddingRight,M.style.paddingRight=N}),g(!0),()=>{document.body.style.paddingRight="initial",document.body.style.overflow="auto",document.querySelectorAll(".z-stratum-bar").forEach(M=>{M.style.paddingRight=M.tempPaddingRightHolder||"",delete M.tempPaddingRightHolder})}},[]),s.useEffect(()=>{l&&l.current?l.current.focus():T.current&&T.current.focus()},[l,k]);const w=s.useCallback(N=>{if(N&&N.key==="Escape"&&i&&i(),N&&N.key==="Tab"){const M=T.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),L=M[0],_=M[M.length-1];M.length===0?N.preventDefault():N.shiftKey&&N.target===L?(N.preventDefault(),_.focus()):!N.shiftKey&&N.target===_&&(N.preventDefault(),L.focus())}},[i]),[[E],y]=Ft(e,[{type:Nr}]);return k?s.createElement("div",{id:m.current,role:"dialog","aria-modal":!0,"aria-labelledby":`${m.current}-title`,className:b,onKeyDown:w,tabIndex:-1,ref:T},s.createElement("div",W(I({},u),{className:"sps-modal__dialog"}),s.createElement("div",{className:"sps-modal__titlebar"},s.createElement("div",{className:"sps-modal__title",id:`${m.current}-title`},c||v(`design-system:modal.defaultTitle.${a}`)),i&&s.createElement("div",{className:"sps-button sps-button--icon",onClick:i},s.createElement("button",{"aria-label":v("design-system:modal.close"),type:"button"},s.createElement("i",{className:"sps-icon sps-icon-x"})))),s.createElement("div",{className:"sps-modal__body"},s.createElement(Mt.Provider,{value:{parentElementRef:T,fixed:!0}},y)),E||s.createElement("div",{className:"sps-modal__footer"},s.createElement(Ye,{kind:a===O.ModalKind.SERIOUS_WARNING?O.ButtonKind.DELETE:O.ButtonKind.KEY,onClick:i},v("design-system:modal.defaultButtonLabel"))))):s.createElement(s.Fragment,null)}Object.assign(el,{props:yI,propTypes:TI,displayName:"SpsModalV2"});const bf={generalUsage:{label:"General Usage",description:({NavigateTo:e})=>s.createElement(s.Fragment,null,s.createElement("h5",{className:"mt-2"},"Use a Modal:"),s.createElement("ul",null,s.createElement("li",null,"When the user needs to confirm a basic decision, such as deleting a record."),s.createElement("li",null,"When important information needs to be displayed to the user before continuing."),s.createElement("li",null,"When a simple selection, such as a single form input, is required before proceeding.")),s.createElement("h5",null,"Avoid a Modal:"),s.createElement("ul",null,s.createElement("li",null,"When a complex form is required. Use a"," ",s.createElement(e,{to:"Focused Task"},"Focused Task View")," instead."),s.createElement("li",null,"When sharing non-critical or tertiary information. Use a"," ",s.createElement(e,{to:"Growlers"},"Growler")," instead."))),examples:{noCloseButton:{description:()=>s.createElement(s.Fragment,null,s.createElement("h5",null,"Close Button"),s.createElement("p",null,"Remove the Close Button in the upper right of the Modal if the user must choose the course of action before proceeding.")),react:D.code`
|
|
4777
4777
|
function Component() {
|
|
4778
4778
|
const [showModal, setShowModal] = React.useState(false);
|
|
4779
4779
|
|
package/lib/index.es.js
CHANGED
|
@@ -28270,6 +28270,7 @@ function SpsModalV2(_u) {
|
|
|
28270
28270
|
document.body.style.paddingRight = scrollbarWidth;
|
|
28271
28271
|
document.body.style.overflow = "hidden";
|
|
28272
28272
|
document.querySelectorAll(".z-stratum-bar").forEach((element) => {
|
|
28273
|
+
element.tempPaddingRightHolder = element.style.paddingRight;
|
|
28273
28274
|
element.style.paddingRight = scrollbarWidth;
|
|
28274
28275
|
});
|
|
28275
28276
|
setBodyIsReady(true);
|
|
@@ -28277,7 +28278,8 @@ function SpsModalV2(_u) {
|
|
|
28277
28278
|
document.body.style.paddingRight = "initial";
|
|
28278
28279
|
document.body.style.overflow = "auto";
|
|
28279
28280
|
document.querySelectorAll(".z-stratum-bar").forEach((element) => {
|
|
28280
|
-
element.style.paddingRight = "
|
|
28281
|
+
element.style.paddingRight = element.tempPaddingRightHolder || "";
|
|
28282
|
+
delete element.tempPaddingRightHolder;
|
|
28281
28283
|
});
|
|
28282
28284
|
};
|
|
28283
28285
|
}, []);
|
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": "5.2.
|
|
4
|
+
"version": "5.2.3",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-react",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@react-stately/collections": "^3.3.3",
|
|
31
|
-
"@spscommerce/ds-colors": "5.2.
|
|
32
|
-
"@spscommerce/ds-shared": "5.2.
|
|
33
|
-
"@spscommerce/positioning": "5.2.
|
|
34
|
-
"@spscommerce/utils": "5.2.
|
|
31
|
+
"@spscommerce/ds-colors": "5.2.3",
|
|
32
|
+
"@spscommerce/ds-shared": "5.2.3",
|
|
33
|
+
"@spscommerce/positioning": "5.2.3",
|
|
34
|
+
"@spscommerce/utils": "5.2.3",
|
|
35
35
|
"moment": "^2.25.3",
|
|
36
36
|
"moment-timezone": "^0.5.28",
|
|
37
37
|
"react": "^16.9.0",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@react-stately/collections": "^3.3.3",
|
|
42
|
-
"@spscommerce/ds-colors": "5.2.
|
|
43
|
-
"@spscommerce/ds-shared": "5.2.
|
|
44
|
-
"@spscommerce/positioning": "5.2.
|
|
45
|
-
"@spscommerce/utils": "5.2.
|
|
42
|
+
"@spscommerce/ds-colors": "5.2.3",
|
|
43
|
+
"@spscommerce/ds-shared": "5.2.3",
|
|
44
|
+
"@spscommerce/positioning": "5.2.3",
|
|
45
|
+
"@spscommerce/utils": "5.2.3",
|
|
46
46
|
"@testing-library/jest-dom": "^4.2.4",
|
|
47
47
|
"@testing-library/react": "^9.3.2",
|
|
48
48
|
"@types/prop-types": "^15.7.1",
|