@sps-woodland/focused-task 8.45.6 → 8.45.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/lib/index.js +1 -1
- package/lib/index.umd.cjs +1 -1
- package/lib/style.css +1 -1
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -1757,7 +1757,7 @@ var Yn = (e, t, n) => {
|
|
|
1757
1757
|
for (var [u, d] of e.compoundVariants)
|
|
1758
1758
|
Yn(u, r, e.defaultVariants) && (n += " " + d);
|
|
1759
1759
|
return n;
|
|
1760
|
-
}, tr = "pkg_sps-woodland_focused-
|
|
1760
|
+
}, tr = "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq0", nr = er({ defaultClassName: "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq1", variantClassNames: { fullWidth: { true: "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq2", false: "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq3" } }, defaultVariants: {}, compoundVariants: [] }), rr = "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq4", or = "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq5", ir = "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq7", ar = "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq8", lr = "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq9", sr = "pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psqa";
|
|
1761
1761
|
function ht({
|
|
1762
1762
|
children: e,
|
|
1763
1763
|
className: t = "",
|
package/lib/index.umd.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* {
|
|
4
4
|
overscroll-behavior: contain;
|
|
5
5
|
}
|
|
6
|
-
}`.trim(),document.head.prepend(o);let i=c=>{if(!(c.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){c.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&c.preventDefault()}},l=c=>{let f=T(c),s=c.relatedTarget;if(s&&$e(s))s.focus({preventScroll:!0}),lt(s,$e(f));else if(!s){var p;let b=(p=f.parentElement)===null||p===void 0?void 0:p.closest("[tabindex]");b?.focus({preventScroll:!0})}},a=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(c){let f=C(),s=f!=null&&$e(f);a.call(this,{...c,preventScroll:!0}),(!c||!c.preventScroll)&<(this,s)};let u=ce(Ce(document,"touchstart",r,{passive:!1,capture:!0}),Ce(document,"touchmove",i,{passive:!1,capture:!0}),Ce(document,"blur",l,!0));return()=>{e(),u(),o.remove(),HTMLElement.prototype.focus=a}}function se(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Ce(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function lt(e,t){t||!Y?at(e):Y.addEventListener("resize",()=>at(e),{once:!0})}function at(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let r=qe(n);if(r!==document.documentElement&&r!==document.body&&r!==n){let o=r.getBoundingClientRect(),i=n.getBoundingClientRect();if(i.top<o.top||i.bottom>o.top+n.clientHeight){let l=o.bottom;Y&&(l=Math.min(l,Y.offsetTop+Y.height));let a=i.top-o.top-((l-o.top)/2-i.height/2);r.scrollTo({top:Math.max(0,Math.min(r.scrollHeight-r.clientHeight,r.scrollTop+a)),behavior:"smooth"})}}n=r.parentElement}}const On=d.createContext({});function Mn(){var e;return(e=d.useContext(On))!==null&&e!==void 0?e:{}}const Dn=typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype;let ee=new WeakMap,M=[];function An(e,t){let n=G(e?.[0]),r=t instanceof n.Element?{root:t}:t;var o;let i=(o=r?.root)!==null&&o!==void 0?o:document.body,l=r?.shouldUseInert&&Dn,a=new Set(e),u=new Set,c=$=>l&&$ instanceof n.HTMLElement?$.inert:$.getAttribute("aria-hidden")==="true",f=($,E)=>{l&&$ instanceof n.HTMLElement?$.inert=E:E?$.setAttribute("aria-hidden","true"):($.removeAttribute("aria-hidden"),$ instanceof n.HTMLElement&&($.inert=!1))},s=new Set;if(A())for(let $ of e){let E=$;for(;E&&E!==i;){let w=E.getRootNode();"shadowRoot"in w&&s.add(w.shadowRoot),E=w.parentNode}}let p=$=>{for(let y of $.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))a.add(y);let E=y=>{if(u.has(y)||a.has(y)||y.parentElement&&u.has(y.parentElement)&&y.parentElement.getAttribute("role")!=="row")return NodeFilter.FILTER_REJECT;for(let tr of a)if(_(y,tr))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},w=De(N($),$,NodeFilter.SHOW_ELEMENT,{acceptNode:E}),V=E($);if(V===NodeFilter.FILTER_ACCEPT&&b($),V!==NodeFilter.FILTER_REJECT){let y=w.nextNode();for(;y!=null;)b(y),y=w.nextNode()}},b=$=>{var E;let w=(E=ee.get($))!==null&&E!==void 0?E:0;c($)&&w===0||(w===0&&f($,!0),u.add($),ee.set($,w+1))};M.length&&M[M.length-1].disconnect(),p(i);let h=new MutationObserver($=>{for(let E of $)if(E.type==="childList"){if(E.target.isConnected&&![...a,...u].some(w=>_(w,E.target)))for(let w of E.addedNodes)(w instanceof HTMLElement||w instanceof SVGElement)&&(w.dataset.liveAnnouncer==="true"||w.dataset.reactAriaTopLayer==="true")?a.add(w):w instanceof Element&&p(w);if(A()){for(let w of s)if(!w.isConnected){h.disconnect();break}}}});h.observe(i,{childList:!0,subtree:!0});let m=new Set;if(A())for(let $ of s){let E=new MutationObserver(w=>{for(let V of w)if(V.type==="childList"){if(V.target.isConnected&&![...a,...u].some(y=>_(y,V.target)))for(let y of V.addedNodes)(y instanceof HTMLElement||y instanceof SVGElement)&&(y.dataset.liveAnnouncer==="true"||y.dataset.reactAriaTopLayer==="true")?a.add(y):y instanceof Element&&p(y);if(A()){for(let y of s)if(!y.isConnected){h.disconnect();break}}}});E.observe($,{childList:!0,subtree:!0}),m.add(E)}let F={visibleNodes:a,hiddenNodes:u,observe(){h.observe(i,{childList:!0,subtree:!0})},disconnect(){h.disconnect()}};return M.push(F),()=>{if(h.disconnect(),A())for(let $ of m)$.disconnect();for(let $ of u){let E=ee.get($);E!=null&&(E===1?(f($,!1),ee.delete($)):ee.set($,E-1))}F===M[M.length-1]?(M.pop(),M.length&&M[M.length-1].observe()):M.splice(M.indexOf(F),1)}}const st=d.createContext(null);function In(e){let t=Oe(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[o,i]=d.useState(!1),l=d.useMemo(()=>({contain:o,setContain:i}),[o,i]),{getContainer:a}=Mn();if(!e.portalContainer&&a&&(n=a()),!n)return null;let u=e.children;return e.disableFocusManagement||(u=d.createElement(hn,{restoreFocus:!0,contain:(e.shouldContainFocus||o)&&!r},u)),u=d.createElement(st.Provider,{value:l},d.createElement(vn,null,u)),pt.createPortal(u,n)}function ut(){let e=d.useContext(st),t=e?.setContain;S(()=>{t?.(!0)},[t])}function Wn(e,t,n){let{overlayProps:r,underlayProps:o}=Cn({...e,isOpen:t.isOpen,onClose:t.close},n);return Fn({isDisabled:!t.isOpen}),ut(),d.useEffect(()=>{if(t.isOpen&&n.current)return An([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:Mt(r),underlayProps:o}}function Vn(e,t){let{role:n="dialog"}=e,r=xt();r=e["aria-label"]?void 0:r;let o=d.useRef(!1);return d.useEffect(()=>{if(t.current&&!t.current.contains(document.activeElement)){ye(t.current);let i=setTimeout(()=>{document.activeElement===t.current&&(o.current=!0,t.current&&(t.current.blur(),ye(t.current)),o.current=!1)},500);return()=>{clearTimeout(i)}}},[t]),ut(),{dialogProps:{...Ht(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e["aria-labelledby"]||r,onBlur:i=>{o.current&&i.stopPropagation()}},titleProps:{id:r}}}function Hn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function dt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ct(Object(n),!0).forEach(function(r){Hn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Kn=(e,t,n)=>{for(var r of Object.keys(e)){var o;if(e[r]!==((o=t[r])!==null&&o!==void 0?o:n[r]))return!1}return!0},Bn=e=>t=>{var n=e.defaultClassName,r=dt(dt({},e.defaultVariants),t);for(var o in r){var i,l=(i=r[o])!==null&&i!==void 0?i:e.defaultVariants[o];if(l!=null){var a=l;typeof a=="boolean"&&(a=a===!0?"true":"false");var u=e.variantClassNames[o][a];u&&(n+=" "+u)}}for(var[c,f]of e.compoundVariants)Kn(c,r,e.defaultVariants)&&(n+=" "+f);return n},jn="pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psq0",Rn=Bn({defaultClassName:"pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psq1",variantClassNames:{fullWidth:{true:"pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psq2",false:"pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psq3"}},defaultVariants:{},compoundVariants:[]}),qn="pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psq4",Gn="pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psq5",Un="pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psq7",zn="pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psq8",Jn="pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psq9",Xn="pkg_sps-woodland_focused-task__version_8_45_6__hash_1io4psqa";function Le({children:e,className:t="",...n}){return v.createElement("div",{className:x.cl(zn,t),...n},v.createElement("div",{className:x.cl(Jn)},v.createElement("div",{className:x.cl(Xn)},e)))}x.Metadata.set(Le,{name:"FocusedTaskActions"});function Qn({children:e,className:t,"data-testid":n,onBlur:r,onFocus:o,overlayProps:i,state:l,onClose:a,fullWidth:u=!1,...c}){const f=v.useRef(null),{modalProps:s,underlayProps:p}=Wn({...c},l,f),{dialogProps:b,titleProps:h}=Vn(c,f),m=x.combineEventHandlers(s.onFocus,b.onFocus,o),F=x.combineEventHandlers(s.onBlur,b.onBlur,r),$=x.useChildTestIdAttrBuilder({"data-testid":n}),[E,w]=x.selectChildren(e,[{type:Le}]);function V(){a&&typeof a=="function"&&a(),l.close()}const y=v.createElement(ft.Button,{"aria-label":"Close",onClick:V,kind:"icon",icon:"x",className:Gn});return v.createElement(In,null,v.createElement("div",{className:Un,"data-react-aria-top-layer":"true",...p,...c},v.createElement("div",{...s,...b,...i,onFocus:m,onBlur:F,...$("dialog"),ref:f,className:x.cl(jn,t)},v.createElement("div",{...h,className:qn},y),v.createElement("div",{className:Rn({fullWidth:u})},x.contentOf(w,l.close)),E&&E.length>0&&v.createElement(v.Fragment,null,x.contentOf(E,l.close)))))}function Fe(e){return e.state.isOpen?v.createElement(Qn,{...e},e.children):v.createElement(v.Fragment,null)}x.Metadata.set(Fe,{name:"FocusedTask",props:{fullWidth:{type:"boolean",default:"false"},onBlur:{type:"() => void"},onClose:{type:"() => void"},onFocus:{type:"() => void"}}});function Zn(e){let[t,n]=sn(e.isOpen,e.defaultOpen||!1,e.onOpenChange);const r=d.useCallback(()=>{n(!0)},[n]),o=d.useCallback(()=>{n(!1)},[n]),i=d.useCallback(()=>{n(!t)},[n,t]);return{isOpen:t,setOpen:n,open:r,close:o,toggle:i}}function Yn(e={}){const t=Zn(e),n=d.useRef(null),{triggerProps:r,overlayProps:o}=Ln({},t,n),{onPress:i,...l}=r;return{triggerProps:{...l,onClick:i?a=>i(a):void 0,ref:n},focusedTaskState:t,focusedTaskProps:{overlayProps:o,state:t}}}const er={"Focused Task":{components:[Fe],examples:{hooks:{label:"Using the Hook",description:()=>v.createElement(v.Fragment,null,v.createElement("p",null,"To use the focused task component, you must call the ",v.createElement("code",null,"useFocusedTask")," hook. Optional arguments for this hook include:"),v.createElement("dl",null,v.createElement("dt",null,v.createElement("code",null,"isOpen"),": boolean"),v.createElement("dd",null,"Whether the overlay is open by default (controlled)"),v.createElement("dt",null,v.createElement("code",null,"defaultOpen"),": boolean"),v.createElement("dd",null,"Whether the overlay is open by default (uncontrolled)."),v.createElement("dt",null,v.createElement("code",null,"onOpenChange"),": function"),v.createElement("dd",null,"Handler that is called when the overlay's open state changes.",v.createElement("code",null,"(isOpen: boolean) => void"))),v.createElement("h5",null,"Focused Task Props, Focused Task State, and Trigger Props"),v.createElement("p",null,"The ",v.createElement("code",null,"useFocusedTask")," returns an object with ",v.createElement("code",null,"focusedTaskProps"),","," ",v.createElement("code",null,"focusedTaskState")," and ",v.createElement("code",null,"triggerProps")),v.createElement("p",null,"The ",v.createElement("code",null,"triggerProps")," need to be spread on the element that triggers the focused task."),v.createElement("p",null,"The ",v.createElement("code",null,"focusedTaskState")," object (which is also included in ",v.createElement("code",null,"focusedTaskProps"),") allows programmatic access to the state of the focused task. This includes a read only"," ",v.createElement("code",null,"isOpen")," property, a ",v.createElement("code",null,"setOpen(isOpen: boolean)")," method which can be use to set whether the overlay is open, an ",v.createElement("code",null,"open()")," method which opens the overlay, a ",v.createElement("code",null,"close()")," method which closes the overlay and a"," ",v.createElement("code",null,"toggle()")," method that toggles the overlay's visiblity."),v.createElement("p",null,"The ",v.createElement("code",null,"focusedTaskProps")," should be spread on the actual ",v.createElement("code",null,"FocusedTask")," component."),v.createElement("p",null,"Please refer to the examples to see its implementation"))},standard:{label:"Standard",examples:{basic:{react:_e.code`
|
|
6
|
+
}`.trim(),document.head.prepend(o);let i=c=>{if(!(c.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){c.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&c.preventDefault()}},l=c=>{let f=T(c),s=c.relatedTarget;if(s&&$e(s))s.focus({preventScroll:!0}),lt(s,$e(f));else if(!s){var p;let b=(p=f.parentElement)===null||p===void 0?void 0:p.closest("[tabindex]");b?.focus({preventScroll:!0})}},a=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(c){let f=C(),s=f!=null&&$e(f);a.call(this,{...c,preventScroll:!0}),(!c||!c.preventScroll)&<(this,s)};let u=ce(Ce(document,"touchstart",r,{passive:!1,capture:!0}),Ce(document,"touchmove",i,{passive:!1,capture:!0}),Ce(document,"blur",l,!0));return()=>{e(),u(),o.remove(),HTMLElement.prototype.focus=a}}function se(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Ce(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function lt(e,t){t||!Y?at(e):Y.addEventListener("resize",()=>at(e),{once:!0})}function at(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let r=qe(n);if(r!==document.documentElement&&r!==document.body&&r!==n){let o=r.getBoundingClientRect(),i=n.getBoundingClientRect();if(i.top<o.top||i.bottom>o.top+n.clientHeight){let l=o.bottom;Y&&(l=Math.min(l,Y.offsetTop+Y.height));let a=i.top-o.top-((l-o.top)/2-i.height/2);r.scrollTo({top:Math.max(0,Math.min(r.scrollHeight-r.clientHeight,r.scrollTop+a)),behavior:"smooth"})}}n=r.parentElement}}const On=d.createContext({});function Mn(){var e;return(e=d.useContext(On))!==null&&e!==void 0?e:{}}const Dn=typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype;let ee=new WeakMap,M=[];function An(e,t){let n=G(e?.[0]),r=t instanceof n.Element?{root:t}:t;var o;let i=(o=r?.root)!==null&&o!==void 0?o:document.body,l=r?.shouldUseInert&&Dn,a=new Set(e),u=new Set,c=$=>l&&$ instanceof n.HTMLElement?$.inert:$.getAttribute("aria-hidden")==="true",f=($,E)=>{l&&$ instanceof n.HTMLElement?$.inert=E:E?$.setAttribute("aria-hidden","true"):($.removeAttribute("aria-hidden"),$ instanceof n.HTMLElement&&($.inert=!1))},s=new Set;if(A())for(let $ of e){let E=$;for(;E&&E!==i;){let w=E.getRootNode();"shadowRoot"in w&&s.add(w.shadowRoot),E=w.parentNode}}let p=$=>{for(let y of $.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))a.add(y);let E=y=>{if(u.has(y)||a.has(y)||y.parentElement&&u.has(y.parentElement)&&y.parentElement.getAttribute("role")!=="row")return NodeFilter.FILTER_REJECT;for(let tr of a)if(_(y,tr))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},w=De(N($),$,NodeFilter.SHOW_ELEMENT,{acceptNode:E}),V=E($);if(V===NodeFilter.FILTER_ACCEPT&&b($),V!==NodeFilter.FILTER_REJECT){let y=w.nextNode();for(;y!=null;)b(y),y=w.nextNode()}},b=$=>{var E;let w=(E=ee.get($))!==null&&E!==void 0?E:0;c($)&&w===0||(w===0&&f($,!0),u.add($),ee.set($,w+1))};M.length&&M[M.length-1].disconnect(),p(i);let h=new MutationObserver($=>{for(let E of $)if(E.type==="childList"){if(E.target.isConnected&&![...a,...u].some(w=>_(w,E.target)))for(let w of E.addedNodes)(w instanceof HTMLElement||w instanceof SVGElement)&&(w.dataset.liveAnnouncer==="true"||w.dataset.reactAriaTopLayer==="true")?a.add(w):w instanceof Element&&p(w);if(A()){for(let w of s)if(!w.isConnected){h.disconnect();break}}}});h.observe(i,{childList:!0,subtree:!0});let m=new Set;if(A())for(let $ of s){let E=new MutationObserver(w=>{for(let V of w)if(V.type==="childList"){if(V.target.isConnected&&![...a,...u].some(y=>_(y,V.target)))for(let y of V.addedNodes)(y instanceof HTMLElement||y instanceof SVGElement)&&(y.dataset.liveAnnouncer==="true"||y.dataset.reactAriaTopLayer==="true")?a.add(y):y instanceof Element&&p(y);if(A()){for(let y of s)if(!y.isConnected){h.disconnect();break}}}});E.observe($,{childList:!0,subtree:!0}),m.add(E)}let F={visibleNodes:a,hiddenNodes:u,observe(){h.observe(i,{childList:!0,subtree:!0})},disconnect(){h.disconnect()}};return M.push(F),()=>{if(h.disconnect(),A())for(let $ of m)$.disconnect();for(let $ of u){let E=ee.get($);E!=null&&(E===1?(f($,!1),ee.delete($)):ee.set($,E-1))}F===M[M.length-1]?(M.pop(),M.length&&M[M.length-1].observe()):M.splice(M.indexOf(F),1)}}const st=d.createContext(null);function In(e){let t=Oe(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[o,i]=d.useState(!1),l=d.useMemo(()=>({contain:o,setContain:i}),[o,i]),{getContainer:a}=Mn();if(!e.portalContainer&&a&&(n=a()),!n)return null;let u=e.children;return e.disableFocusManagement||(u=d.createElement(hn,{restoreFocus:!0,contain:(e.shouldContainFocus||o)&&!r},u)),u=d.createElement(st.Provider,{value:l},d.createElement(vn,null,u)),pt.createPortal(u,n)}function ut(){let e=d.useContext(st),t=e?.setContain;S(()=>{t?.(!0)},[t])}function Wn(e,t,n){let{overlayProps:r,underlayProps:o}=Cn({...e,isOpen:t.isOpen,onClose:t.close},n);return Fn({isDisabled:!t.isOpen}),ut(),d.useEffect(()=>{if(t.isOpen&&n.current)return An([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:Mt(r),underlayProps:o}}function Vn(e,t){let{role:n="dialog"}=e,r=xt();r=e["aria-label"]?void 0:r;let o=d.useRef(!1);return d.useEffect(()=>{if(t.current&&!t.current.contains(document.activeElement)){ye(t.current);let i=setTimeout(()=>{document.activeElement===t.current&&(o.current=!0,t.current&&(t.current.blur(),ye(t.current)),o.current=!1)},500);return()=>{clearTimeout(i)}}},[t]),ut(),{dialogProps:{...Ht(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e["aria-labelledby"]||r,onBlur:i=>{o.current&&i.stopPropagation()}},titleProps:{id:r}}}function Hn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function dt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ct(Object(n),!0).forEach(function(r){Hn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Kn=(e,t,n)=>{for(var r of Object.keys(e)){var o;if(e[r]!==((o=t[r])!==null&&o!==void 0?o:n[r]))return!1}return!0},Bn=e=>t=>{var n=e.defaultClassName,r=dt(dt({},e.defaultVariants),t);for(var o in r){var i,l=(i=r[o])!==null&&i!==void 0?i:e.defaultVariants[o];if(l!=null){var a=l;typeof a=="boolean"&&(a=a===!0?"true":"false");var u=e.variantClassNames[o][a];u&&(n+=" "+u)}}for(var[c,f]of e.compoundVariants)Kn(c,r,e.defaultVariants)&&(n+=" "+f);return n},jn="pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq0",Rn=Bn({defaultClassName:"pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq1",variantClassNames:{fullWidth:{true:"pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq2",false:"pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq3"}},defaultVariants:{},compoundVariants:[]}),qn="pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq4",Gn="pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq5",Un="pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq7",zn="pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq8",Jn="pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq9",Xn="pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psqa";function Le({children:e,className:t="",...n}){return v.createElement("div",{className:x.cl(zn,t),...n},v.createElement("div",{className:x.cl(Jn)},v.createElement("div",{className:x.cl(Xn)},e)))}x.Metadata.set(Le,{name:"FocusedTaskActions"});function Qn({children:e,className:t,"data-testid":n,onBlur:r,onFocus:o,overlayProps:i,state:l,onClose:a,fullWidth:u=!1,...c}){const f=v.useRef(null),{modalProps:s,underlayProps:p}=Wn({...c},l,f),{dialogProps:b,titleProps:h}=Vn(c,f),m=x.combineEventHandlers(s.onFocus,b.onFocus,o),F=x.combineEventHandlers(s.onBlur,b.onBlur,r),$=x.useChildTestIdAttrBuilder({"data-testid":n}),[E,w]=x.selectChildren(e,[{type:Le}]);function V(){a&&typeof a=="function"&&a(),l.close()}const y=v.createElement(ft.Button,{"aria-label":"Close",onClick:V,kind:"icon",icon:"x",className:Gn});return v.createElement(In,null,v.createElement("div",{className:Un,"data-react-aria-top-layer":"true",...p,...c},v.createElement("div",{...s,...b,...i,onFocus:m,onBlur:F,...$("dialog"),ref:f,className:x.cl(jn,t)},v.createElement("div",{...h,className:qn},y),v.createElement("div",{className:Rn({fullWidth:u})},x.contentOf(w,l.close)),E&&E.length>0&&v.createElement(v.Fragment,null,x.contentOf(E,l.close)))))}function Fe(e){return e.state.isOpen?v.createElement(Qn,{...e},e.children):v.createElement(v.Fragment,null)}x.Metadata.set(Fe,{name:"FocusedTask",props:{fullWidth:{type:"boolean",default:"false"},onBlur:{type:"() => void"},onClose:{type:"() => void"},onFocus:{type:"() => void"}}});function Zn(e){let[t,n]=sn(e.isOpen,e.defaultOpen||!1,e.onOpenChange);const r=d.useCallback(()=>{n(!0)},[n]),o=d.useCallback(()=>{n(!1)},[n]),i=d.useCallback(()=>{n(!t)},[n,t]);return{isOpen:t,setOpen:n,open:r,close:o,toggle:i}}function Yn(e={}){const t=Zn(e),n=d.useRef(null),{triggerProps:r,overlayProps:o}=Ln({},t,n),{onPress:i,...l}=r;return{triggerProps:{...l,onClick:i?a=>i(a):void 0,ref:n},focusedTaskState:t,focusedTaskProps:{overlayProps:o,state:t}}}const er={"Focused Task":{components:[Fe],examples:{hooks:{label:"Using the Hook",description:()=>v.createElement(v.Fragment,null,v.createElement("p",null,"To use the focused task component, you must call the ",v.createElement("code",null,"useFocusedTask")," hook. Optional arguments for this hook include:"),v.createElement("dl",null,v.createElement("dt",null,v.createElement("code",null,"isOpen"),": boolean"),v.createElement("dd",null,"Whether the overlay is open by default (controlled)"),v.createElement("dt",null,v.createElement("code",null,"defaultOpen"),": boolean"),v.createElement("dd",null,"Whether the overlay is open by default (uncontrolled)."),v.createElement("dt",null,v.createElement("code",null,"onOpenChange"),": function"),v.createElement("dd",null,"Handler that is called when the overlay's open state changes.",v.createElement("code",null,"(isOpen: boolean) => void"))),v.createElement("h5",null,"Focused Task Props, Focused Task State, and Trigger Props"),v.createElement("p",null,"The ",v.createElement("code",null,"useFocusedTask")," returns an object with ",v.createElement("code",null,"focusedTaskProps"),","," ",v.createElement("code",null,"focusedTaskState")," and ",v.createElement("code",null,"triggerProps")),v.createElement("p",null,"The ",v.createElement("code",null,"triggerProps")," need to be spread on the element that triggers the focused task."),v.createElement("p",null,"The ",v.createElement("code",null,"focusedTaskState")," object (which is also included in ",v.createElement("code",null,"focusedTaskProps"),") allows programmatic access to the state of the focused task. This includes a read only"," ",v.createElement("code",null,"isOpen")," property, a ",v.createElement("code",null,"setOpen(isOpen: boolean)")," method which can be use to set whether the overlay is open, an ",v.createElement("code",null,"open()")," method which opens the overlay, a ",v.createElement("code",null,"close()")," method which closes the overlay and a"," ",v.createElement("code",null,"toggle()")," method that toggles the overlay's visiblity."),v.createElement("p",null,"The ",v.createElement("code",null,"focusedTaskProps")," should be spread on the actual ",v.createElement("code",null,"FocusedTask")," component."),v.createElement("p",null,"Please refer to the examples to see its implementation"))},standard:{label:"Standard",examples:{basic:{react:_e.code`
|
|
7
7
|
import { FocusedTask, FocusedTaskActions, useFocusedTask } from "@sps-woodland/focused-task";
|
|
8
8
|
import { Button } from "@sps-woodland/buttons";
|
|
9
9
|
import { Card } from "@sps-woodland/cards";
|
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pkg_sps-woodland_focused-
|
|
1
|
+
.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq0{background-color:#f3f4f4;height:100%;left:0;overflow-x:hidden;overflow-y:auto;position:fixed;text-align:center;transition:top .3s ease;width:100%;padding-bottom:2rem}.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq1{margin:0 auto;max-width:1280px;padding:0 1rem 1rem}.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq2{max-width:100%}.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq4{margin:1rem auto .5rem;max-width:1280px;min-width:0;padding:0 1rem;text-align:right}.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq5{color:#4b5356;border-width:0;right:.5rem}.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq6{padding:0 .25rem}.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq7{position:fixed;z-index:1000;inset:0;background:#f3f4f4;display:flex;align-items:center;justify-content:center;padding:1rem}.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq8{align-items:center;background-color:#fff;bottom:0;box-shadow:0 -.0625rem .125rem #00000026;display:flex;height:3.125rem;justify-content:center;left:0;padding:.5rem;position:fixed;right:0;z-index:1}.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psq9{display:flex;max-width:1180px;width:100%}.pkg_sps-woodland_focused-task__version_8_45_8__hash_1io4psqa{align-items:center;display:flex;flex:1;white-space:nowrap;justify-content:center}.z-stratum-dropdown{z-index:1100}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sps-woodland/focused-task",
|
|
3
3
|
"description": "SPS Woodland Design System focused task component",
|
|
4
|
-
"version": "8.45.
|
|
4
|
+
"version": "8.45.8",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/focused-task",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@spscommerce/utils": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
30
30
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
31
31
|
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
32
|
-
"@sps-woodland/buttons": "8.45.
|
|
33
|
-
"@sps-woodland/core": "8.45.
|
|
34
|
-
"@sps-woodland/tokens": "8.45.
|
|
32
|
+
"@sps-woodland/buttons": "8.45.8",
|
|
33
|
+
"@sps-woodland/core": "8.45.8",
|
|
34
|
+
"@sps-woodland/tokens": "8.45.8"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@react-spectrum/provider": "3.11.0",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"@vanilla-extract/sprinkles": "1.5.1",
|
|
43
43
|
"react": "16.14.0",
|
|
44
44
|
"react-dom": "16.14.0",
|
|
45
|
-
"@sps-woodland/buttons": "8.45.
|
|
46
|
-
"@sps-woodland/core": "8.45.
|
|
47
|
-
"@sps-woodland/tokens": "8.45.
|
|
45
|
+
"@sps-woodland/buttons": "8.45.8",
|
|
46
|
+
"@sps-woodland/core": "8.45.8",
|
|
47
|
+
"@sps-woodland/tokens": "8.45.8"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"react-aria": "3.21.0",
|