@lifesg/react-design-system 2.0.0-canary.7 → 2.0.0-canary.8
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/cjs/index.js +10 -4
- package/cjs/index.js.map +1 -1
- package/file-upload/index.js +228 -222
- package/file-upload/index.js.map +1 -1
- package/form/index.js +189 -183
- package/form/index.js.map +1 -1
- package/index.js +10 -4
- package/index.js.map +1 -1
- package/input-group/index.js +1 -1
- package/input-group/index.js.map +1 -1
- package/input-multi-select/index.js +5 -5
- package/input-multi-select/index.js.map +1 -1
- package/input-range-select/index.js +12 -12
- package/input-range-select/index.js.map +1 -1
- package/input-select/index.js +1 -1
- package/input-select/index.js.map +1 -1
- package/otp-input/index.js +11 -5
- package/otp-input/index.js.map +1 -1
- package/package.json +1 -1
- package/pagination/index.js +1 -1
- package/pagination/index.js.map +1 -1
- package/phone-number-input/index.js +1 -1
- package/phone-number-input/index.js.map +1 -1
- package/popover/index.js +7 -1
- package/popover/index.js.map +1 -1
- package/popover/popover.styles.d.ts +1 -0
- package/predictive-text-input/index.js +1 -1
- package/predictive-text-input/index.js.map +1 -1
- package/toast/index.js +1 -1
- package/toast/index.js.map +1 -1
- package/toast/toast.d.ts +1 -1
- package/toast/types.d.ts +2 -0
package/popover/index.js
CHANGED
|
@@ -363,5 +363,11 @@ var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.pr
|
|
|
363
363
|
background: none;
|
|
364
364
|
border: none;
|
|
365
365
|
padding: 0;
|
|
366
|
-
`,Cn=
|
|
366
|
+
`,Cn=c.div`
|
|
367
|
+
overflow-y: scroll;
|
|
368
|
+
|
|
369
|
+
::-webkit-scrollbar {
|
|
370
|
+
display: none; /* Chrome/Safari/Webkit */
|
|
371
|
+
}
|
|
372
|
+
`,Tn=({children:r,visible:l,onMobileClose:c,...s})=>{const u=s["data-testid"]||"popover",[d,f]=o("none"),p=i(null),m=h.exports.useMediaQuery({maxWidth:y.mobileL}),g=i(d);a((()=>(w(),window.addEventListener("resize",Z(v,300)),()=>{window.removeEventListener("resize",Z(v,300))})),[]);const v=()=>{w()},b=()=>{c&&c()},w=()=>{const e=F();var t;e&&(t=e,g.current=t,f(t))},F=()=>{if(p.current){const e=p.current.getBoundingClientRect(),t=24,n=e.y<t,r=window.innerWidth-t;return e.x<t?n?"top-left":"left":e.x+e.width>r?n?"top-right":"right":("top-left"===g.current||"left"===g.current)&&e.x-e.width/2>t||("top-right"===g.current||"right"===g.current)&&e.x+2*e.width<r?n?"top-center":"none":n?"top-center":void 0}},S=()=>"string"==typeof r?t(cn.BodySmall,{children:r}):r;return e(n,{children:[t(En,{ref:p,"data-testid":u,$visible:l,$offset:d,...s,children:t(pn,{children:S()})}),m&&t(Sn,{show:l,onOverlayClick:b,children:t(Dn,{onClose:b,children:t(Cn,{children:S()})})})]})},zn=(n,r)=>l=>{const{onPopoverAppear:c,onPopoverDismiss:s,...u}=l,d=r.trigger||"click",f=u,[p,m]=o(!1),g=i(),v=h.exports.useMediaQuery({maxWidth:y.mobileL});a((()=>{if(!v)return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}}),[p]);const b=e=>{g&&!g.current.contains(e.target)&&(p&&m(!1),s&&s())};return e(Hn,{id:"popover-hoc-wrapper",ref:g,children:[t(kn,{id:`popover-hoc-trigger${r["data-testid"]&&`-${r["data-testid"]}`}`,type:"button",onClick:e=>{e.preventDefault(),("click"===d||v)&&(m(!p),!p&&c&&c(),p&&s&&s())},onMouseEnter:()=>{"hover"!==d||v||m(!0)},onMouseLeave:()=>{"hover"===d&&p&&!v&&m(!1)},"aria-label":"popover-button",children:t(n,{...f})}),t(Tn,{visible:p,id:r.id,"data-testid":r["data-testid"],onMobileClose:()=>{m(!1)},children:r.content})]})};export{Tn as Popover,zn as withPopover};
|
|
367
373
|
//# sourceMappingURL=index.js.map
|