@bentoproject/accordion
Advanced tools
Comparing version 1.2112021656.0 to 1.2112032204.0
@@ -1,1 +0,1 @@ | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,a=function(n){return t(n,"__esModule",{value:!0})},c=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var a,c=i(r),f=0,l=c.length;f<l;f++)a=c[f],u.call(n,a)||"default"===a||t(n,a,{get:function(n){return r[n]}.bind(null,a),enumerable:!(o=e(r,a))||o.enumerable});return n}(a(t(null!=n?r(o(n)):{},"default",n&&n.__esModule&&"default"in n?{get:function(){return n.default},enumerable:!0}:{value:n,enumerable:!0})),n)};function f(n){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function l(n){var r=function(n,r){if("object"!==f(n)||null===n)return n;var t=n[Symbol.toPrimitive];if(void 0!==t){var e=t.call(n,"string");if("object"!==f(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===f(r)?r:String(r)}function v(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t<r;t++)e[t]=n[t];return e}function d(){return n||(n=Promise.resolve(void 0))}function b(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function y(n,r){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),t.push.apply(t,e)}return t}function m(n){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?y(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):y(Object(t)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))}))}return n}function h(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var e,i,o=[],u=!0,a=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){a=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(a)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return v(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?v(n,r):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(n,r){if(null==n)return{};var t,e,i={},o=Object.keys(n);for(e=0;e<o.length;e++)t=o[e],r.indexOf(t)>=0||(i[t]=n[t]);return i}!function(n,r){for(var e in a(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return cn},BentoAccordionContent:function(){return dn},BentoAccordionHeader:function(){return vn},BentoAccordionSection:function(){return ln}});var p=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}p.hasOwnProperty,p.toString;var j=c(require("react")),O=(c(require("react-dom")),c(require("react")));function S(n,r,t){return j.createElement.apply(void 0,arguments)}function w(n){return j.createContext(n,void 0)}function x(n){return O.useState(n)}function A(n){return O.useRef(n)}function M(n,r){O.useEffect(n,r)}function z(n,r){O.useLayoutEffect(n,r)}function I(n){return O.useContext(n)}function Y(n,r){return O.useMemo(n,r)}function C(n,r){return O.useCallback(n,r)}var E,q,B=c(require("react")),N=["ref"],k="undefined"!=typeof Symbol&&(null===(E=Symbol.for)||void 0===E?void 0:E.call(Symbol,"react.forward_ref"))||3911,H=B.options.__b;B.options.__b=function(n){var r;null!==(r=n.type)&&void 0!==r&&r.Bl&&n.ref&&(n.props.ref=n.ref,n.ref=null),null==H||H(n)};var _,P=["auto","lazy","eager","unload"],T=(b(q={},"auto",0),b(q,"lazy",1),b(q,"eager",2),b(q,"unload",3),q);function U(n,r){var t=T[n]||0,e=T[r]||0,i=Math.max(t,e);return P[i]}function W(){return _||(_=w({renderable:!0,playable:!0,loading:"auto"}))}function $(n){var r=n.children,t=n.loading,e=void 0===t?"auto":t,i=n.notify,o=n.playable,u=void 0===o||o,a=n.renderable,c=void 0===a||a,f=I(W()),l=c&&f.renderable,v=l&&u&&f.playable,d=U(l?"auto":"lazy",U(e,f.loading)),b=i||f.notify,y=Y((function(){return{renderable:l,playable:v,loading:d,notify:b}}),[l,v,d,b]);return S(W().Provider,{children:r,value:y})}Array.isArray;var D,F=["Webkit","webkit","Moz","moz","ms","O","o"];function G(n,r,t){if(Q(r))return r;var e;D||(e=Object.create(null),D=e);var i=D[r];if(!i||t){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var t=0;t<F.length;t++){var e=F[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(D[r]=i)}return i}function J(n,r,t,e,i){var o=G(n.style,r,i);if(o){var u=e?t+e:t;Q(o)?n.style.setProperty(o,u):n.style[o]=u}}function K(n,r,t){var e=G(n.style,r,t);if(e)return Q(e)?n.style.getPropertyValue(e):n.style[e]}function L(n,r){for(var t in r)J(n,t,r[t])}function Q(n){return n.startsWith("--")}function R(n,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var e=r();return e.onfinish=e.oncancel=function(){e=null,t&&t(),n.classList.remove("i-amphtml-animating")},function(){e&&e.cancel()}}function V(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var X,Z=["animate","as","children","expandSingleSection","id"],nn=["animate","as","children","expanded","id","onExpandStateChange"],rn=w({}),tn=w({}),en={},on={},un=(X=0,function(){return String(++X)}),an=function(){return String(Math.floor(1e5*Math.random()))},cn=function(n){function r(n){var r=n.ref;return function(n,r){var t=n.animate,e=void 0!==t&&t,i=n.as,o=void 0===i?"section":i,u=n.children,a=n.expandSingleSection,c=void 0!==a&&a,f=n.id,l=s(n,Z),v=h(x(en),2),y=v[0],p=v[1],j=A(on),w=h(x(an),1)[0],z=f||"a".concat(w);M((function(){c&&p((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[c]);var I=C((function(n,r,t){var e=t.current;return p((function(t){return fn(n,r,t,c)})),j.current=m(m({},j.current),{},b({},n,e)),function(){p((function(r){return g(r,n)})),j.current=g(j.current,n)}}),[c]),E=C((function(n,r){p((function(t){var e=null!=r?r:!t[n],i=fn(n,e,t,c);return d().then((function(){for(var n in t){var r=j.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[c]),q=C((function(n,r){var t;return null!==(t=y[n])&&void 0!==t?t:r}),[y]),B=C((function(n){if(n)n in y&&E(n);else if(!c)for(var r in y)E(r)}),[y,E,c]),N=C((function(n){if(n)q(n,!0)||E(n);else if(!c)for(var r in y)q(r,!0)||E(r)}),[y,E,q,c]),k=C((function(n){if(n)q(n,!1)&&E(n);else for(var r in y)q(r,!1)&&E(r)}),[y,E,q]);!function(n,r,t){O.useImperativeHandle(n,(function(){return{toggle:B,expand:N,collapse:k}}),t)}(r,0,[B,k,N]);var H=Y((function(){return{registerSection:I,toggleExpanded:E,isExpanded:q,animate:e,prefix:z}}),[I,E,q,e,z]);return S(o,m({id:f},l),S(rn.Provider,{value:H},u))}(s(n,N),r)}return r.$$typeof=k,r.render=r,r.prototype.isReactComponent=!0,r.Bl=!0,r}();function fn(n,r,t,e){var i;if(e&&r)for(var o in i=b({},n,r),t)o!=n&&(i[o]=!1);else i=m(m({},t),{},b({},n,r));return i}function ln(n){var r=n.animate,t=void 0!==r&&r,e=n.as,i=void 0===e?"section":e,o=n.children,u=n.expanded,a=void 0!==u&&u,c=n.id,f=n.onExpandStateChange,l=s(n,nn),v=h(x(un),1)[0],b=c||v,y=h(x(an),1)[0],p=h(x(a),2),g=p[0],j=p[1],O=h(x(null),2),w=O[0],M=O[1],E=h(x(null),2),q=E[0],B=E[1],N=I(rn),k=N.animate,H=N.isExpanded,_=N.prefix,P=N.registerSection,T=N.toggleExpanded,U=H?H(b,a):g,W=null!=k?k:t,$=w||"".concat(_||"a","-content-").concat(b,"-").concat(y),D=q||"".concat(_||"a","-header-").concat(b,"-").concat(y),F=A(null);F.current=f,z((function(){if(P)return P(b,a,F)}),[P,b,a]);var G=C((function(n){T?T(b,n):j((function(r){var t=null!=n?n:!r;return d().then((function(){var n=F.current;n&&n(t)})),t}))}),[b,T]),J=Y((function(){return{animate:W,contentId:$,headerId:D,expanded:U,toggleHandler:G,setContentId:M,setHeaderId:B}}),[W,$,D,U,G]);return S(i,m({},l),S(tn.Provider,{value:J},o))}function vn(n){var r="className",t="tabindex",e=n.as,i=void 0===e?"div":e,o=n.children,u=n.id,a=n.role,c=void 0===a?"button":a,f=n[r],v=void 0===f?"":f,d=n[t],b=void 0===d?0:d,y=s(n,["as","children","id","role",r,t].map(l)),h=I(tn),p=h.contentId,g=h.expanded,j=h.headerId,O=h.setHeaderId,w=h.toggleHandler;return z((function(){O&&O(u)}),[O,u]),S(i,m(m({},y),{},{id:j,role:c,className:"".concat(v," ").concat("section-child-00fce3c"," ").concat("header-00fce3c"),tabindex:b,"aria-controls":p,onClick:function(){return w()},"aria-expanded":String(g)}),o)}function dn(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,a=void 0===u?"region":u,c=n[r],f=void 0===c?"":c,v=s(n,["as","children","id","role",r].map(l)),d=A(null),b=A(!1),y=I(tn),h=y.animate,p=y.contentId,g=y.expanded,j=y.headerId,O=y.setContentId;return M((function(){return b.current=!0,function(){return b.current=!1}}),[]),z((function(){O&&O(o)}),[O,o]),z((function(){var n=b.current,r=d.current;if(h&&n&&r&&r.animate)return g?function(n){return R(n,(function(){var r=K(n,"height"),t=K(n,"opacity"),e=K(n,"overflowY");L(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;L(n,{height:r,opacity:t,overflowY:e});var o=V(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return R(n,(function(){var r=n.offsetHeight,t=V(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(r)}),[g,h]),S($,{renderable:g},S(e,m(m({},v),{},{ref:d,className:f+" section-child-00fce3c"+(g?"":" content-hidden-00fce3c"),id:p,"aria-labelledby":j,role:a}),i))}cn.displayName="Accordion"; | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,a=function(n){return t(n,"__esModule",{value:!0})},c=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var a,c=i(r),f=0,l=c.length;f<l;f++)a=c[f],u.call(n,a)||"default"===a||t(n,a,{get:function(n){return r[n]}.bind(null,a),enumerable:!(o=e(r,a))||o.enumerable});return n}(a(t(null!=n?r(o(n)):{},"default",n&&n.__esModule&&"default"in n?{get:function(){return n.default},enumerable:!0}:{value:n,enumerable:!0})),n)};function f(n){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function l(n){var r=function(n,r){if("object"!==f(n)||null===n)return n;var t=n[Symbol.toPrimitive];if(void 0!==t){var e=t.call(n,"string");if("object"!==f(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===f(r)?r:String(r)}function v(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t<r;t++)e[t]=n[t];return e}function d(){return n||(n=Promise.resolve(void 0))}function b(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function y(n,r){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),t.push.apply(t,e)}return t}function h(n){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?y(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):y(Object(t)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))}))}return n}function m(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var e,i,o=[],u=!0,a=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){a=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(a)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return v(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?v(n,r):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(n,r){if(null==n)return{};var t,e,i={},o=Object.keys(n);for(e=0;e<o.length;e++)t=o[e],r.indexOf(t)>=0||(i[t]=n[t]);return i}!function(n,r){for(var e in a(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return en},BentoAccordionContent:function(){return cn},BentoAccordionHeader:function(){return an},BentoAccordionSection:function(){return un}});var p=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}p.hasOwnProperty,p.toString;var j=c(require("react")),O=(c(require("react-dom")),c(require("react")));function S(n,r,t){return j.createElement.apply(void 0,arguments)}function w(n){return j.createContext(n,void 0)}function x(n){return O.useState(n)}function A(n){return O.useRef(n)}function M(n,r){O.useEffect(n,r)}function z(n,r){O.useLayoutEffect(n,r)}function I(n){return O.useContext(n)}function Y(n,r){return O.useMemo(n,r)}function C(n,r){return O.useCallback(n,r)}var E,q,B=c(require("react")),N=["auto","lazy","eager","unload"],k=(b(E={},"auto",0),b(E,"lazy",1),b(E,"eager",2),b(E,"unload",3),E);function H(n,r){var t=k[n]||0,e=k[r]||0,i=Math.max(t,e);return N[i]}function P(){return q||(q=w({renderable:!0,playable:!0,loading:"auto"}))}function T(n){var r=n.children,t=n.loading,e=void 0===t?"auto":t,i=n.notify,o=n.playable,u=void 0===o||o,a=n.renderable,c=void 0===a||a,f=I(P()),l=c&&f.renderable,v=l&&u&&f.playable,d=H(l?"auto":"lazy",H(e,f.loading)),b=i||f.notify,y=Y((function(){return{renderable:l,playable:v,loading:d,notify:b}}),[l,v,d,b]);return S(P().Provider,{children:r,value:y})}Array.isArray;var _,U=["Webkit","webkit","Moz","moz","ms","O","o"];function W(n,r,t){if(G(r))return r;var e;_||(e=Object.create(null),_=e);var i=_[r];if(!i||t){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var t=0;t<U.length;t++){var e=U[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(_[r]=i)}return i}function $(n,r,t,e,i){var o=W(n.style,r,i);if(o){var u=e?t+e:t;G(o)?n.style.setProperty(o,u):n.style[o]=u}}function D(n,r,t){var e=W(n.style,r,t);if(e)return G(e)?n.style.getPropertyValue(e):n.style[e]}function F(n,r){for(var t in r)$(n,t,r[t])}function G(n){return n.startsWith("--")}function J(n,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var e=r();return e.onfinish=e.oncancel=function(){e=null,t&&t(),n.classList.remove("i-amphtml-animating")},function(){e&&e.cancel()}}function K(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var L,Q=["animate","as","children","expandSingleSection","id"],R=["animate","as","children","expanded","id","onExpandStateChange"],V=w({}),X=w({}),Z={},nn={},rn=(L=0,function(){return String(++L)}),tn=function(){return String(Math.floor(1e5*Math.random()))},en=(0,B.forwardRef)((function(n,r){var t=n.animate,e=void 0!==t&&t,i=n.as,o=void 0===i?"section":i,u=n.children,a=n.expandSingleSection,c=void 0!==a&&a,f=n.id,l=s(n,Q),v=m(x(Z),2),y=v[0],p=v[1],j=A(nn),w=m(x(tn),1)[0],z=f||"a".concat(w);M((function(){c&&p((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[c]);var I=C((function(n,r,t){var e=t.current;return p((function(t){return on(n,r,t,c)})),j.current=h(h({},j.current),{},b({},n,e)),function(){p((function(r){return g(r,n)})),j.current=g(j.current,n)}}),[c]),E=C((function(n,r){p((function(t){var e=null!=r?r:!t[n],i=on(n,e,t,c);return d().then((function(){for(var n in t){var r=j.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[c]),q=C((function(n,r){var t;return null!==(t=y[n])&&void 0!==t?t:r}),[y]),B=C((function(n){if(n)n in y&&E(n);else if(!c)for(var r in y)E(r)}),[y,E,c]),N=C((function(n){if(n)q(n,!0)||E(n);else if(!c)for(var r in y)q(r,!0)||E(r)}),[y,E,q,c]),k=C((function(n){if(n)q(n,!1)&&E(n);else for(var r in y)q(r,!1)&&E(r)}),[y,E,q]);!function(n,r,t){O.useImperativeHandle(n,(function(){return{toggle:B,expand:N,collapse:k}}),t)}(r,0,[B,k,N]);var H=Y((function(){return{registerSection:I,toggleExpanded:E,isExpanded:q,animate:e,prefix:z}}),[I,E,q,e,z]);return S(o,h({id:f},l),S(V.Provider,{value:H},u))}));function on(n,r,t,e){var i;if(e&&r)for(var o in i=b({},n,r),t)o!=n&&(i[o]=!1);else i=h(h({},t),{},b({},n,r));return i}function un(n){var r=n.animate,t=void 0!==r&&r,e=n.as,i=void 0===e?"section":e,o=n.children,u=n.expanded,a=void 0!==u&&u,c=n.id,f=n.onExpandStateChange,l=s(n,R),v=m(x(rn),1)[0],b=c||v,y=m(x(tn),1)[0],p=m(x(a),2),g=p[0],j=p[1],O=m(x(null),2),w=O[0],M=O[1],E=m(x(null),2),q=E[0],B=E[1],N=I(V),k=N.animate,H=N.isExpanded,P=N.prefix,T=N.registerSection,_=N.toggleExpanded,U=H?H(b,a):g,W=null!=k?k:t,$=w||"".concat(P||"a","-content-").concat(b,"-").concat(y),D=q||"".concat(P||"a","-header-").concat(b,"-").concat(y),F=A(null);F.current=f,z((function(){if(T)return T(b,a,F)}),[T,b,a]);var G=C((function(n){_?_(b,n):j((function(r){var t=null!=n?n:!r;return d().then((function(){var n=F.current;n&&n(t)})),t}))}),[b,_]),J=Y((function(){return{animate:W,contentId:$,headerId:D,expanded:U,toggleHandler:G,setContentId:M,setHeaderId:B}}),[W,$,D,U,G]);return S(i,h({},l),S(X.Provider,{value:J},o))}function an(n){var r="className",t="tabindex",e=n.as,i=void 0===e?"div":e,o=n.children,u=n.id,a=n.role,c=void 0===a?"button":a,f=n[r],v=void 0===f?"":f,d=n[t],b=void 0===d?0:d,y=s(n,["as","children","id","role",r,t].map(l)),m=I(X),p=m.contentId,g=m.expanded,j=m.headerId,O=m.setHeaderId,w=m.toggleHandler;return z((function(){O&&O(u)}),[O,u]),S(i,h(h({},y),{},{id:j,role:c,className:"".concat(v," ").concat("section-child-00fce3c"," ").concat("header-00fce3c"),tabindex:b,"aria-controls":p,onClick:function(){return w()},"aria-expanded":String(g)}),o)}function cn(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,a=void 0===u?"region":u,c=n[r],f=void 0===c?"":c,v=s(n,["as","children","id","role",r].map(l)),d=A(null),b=A(!1),y=I(X),m=y.animate,p=y.contentId,g=y.expanded,j=y.headerId,O=y.setContentId;return M((function(){return b.current=!0,function(){return b.current=!1}}),[]),z((function(){O&&O(o)}),[O,o]),z((function(){var n=b.current,r=d.current;if(m&&n&&r&&r.animate)return g?function(n){return J(n,(function(){var r=D(n,"height"),t=D(n,"opacity"),e=D(n,"overflowY");F(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;F(n,{height:r,opacity:t,overflowY:e});var o=K(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return J(n,(function(){var r=n.offsetHeight,t=K(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(r)}),[g,m]),S(T,{renderable:g},S(e,h(h({},v),{},{ref:d,className:f+" section-child-00fce3c"+(g?"":" content-hidden-00fce3c"),id:p,"aria-labelledby":j,role:a}),i))}en.displayName="Accordion"; |
@@ -143,52 +143,5 @@ var __create = Object.create; | ||
// src/preact/compat.js | ||
var import_preact = __toModule(require("react")); | ||
// extensions/amp-accordion/1.0/component.js | ||
var import_compat = __toModule(require("react")); | ||
// src/core/mode/prod.js | ||
function isProd() { | ||
return false; | ||
} | ||
// src/preact/compat.js | ||
var _excluded = ["ref"]; | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) | ||
return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) | ||
continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
var REACT_FORWARD_SYMBOL = typeof Symbol !== "undefined" && (Symbol.for == null ? void 0 : Symbol.for("react.forward_ref")) || 3911; | ||
var oldDiff = import_preact.options["__b"]; | ||
import_preact.options["__b"] = newDiff; | ||
function newDiff(vnode) { | ||
var _vnode$type; | ||
if ((_vnode$type = vnode["type"]) != null && _vnode$type.forwardRef_ && vnode["ref"]) { | ||
vnode["props"]["ref"] = vnode["ref"]; | ||
vnode["ref"] = null; | ||
} | ||
oldDiff == null ? void 0 : oldDiff(vnode); | ||
} | ||
function forwardRef(Component) { | ||
function Forward(props) { | ||
var ref = props.ref, clone = _objectWithoutPropertiesLoose(props, _excluded); | ||
return Component(clone, ref); | ||
} | ||
Forward.$$typeof = REACT_FORWARD_SYMBOL; | ||
Forward.render = Forward; | ||
Forward.prototype.isReactComponent = true; | ||
Forward.forwardRef_ = true; | ||
if (!isProd()) { | ||
Forward.displayName = "ForwardRef(" + (Component.displayName || Component.name) + ")"; | ||
} | ||
return Forward; | ||
} | ||
// src/core/constants/loading-instructions.js | ||
@@ -398,4 +351,4 @@ var _MAP; | ||
// extensions/amp-accordion/1.0/component.js | ||
var _excluded2 = ["animate", "as", "children", "expandSingleSection", "id"]; | ||
var _excluded22 = ["animate", "as", "children", "expanded", "id", "onExpandStateChange"]; | ||
var _excluded = ["animate", "as", "children", "expandSingleSection", "id"]; | ||
var _excluded2 = ["animate", "as", "children", "expanded", "id", "onExpandStateChange"]; | ||
function _toPropertyKey(arg) { | ||
@@ -431,3 +384,3 @@ var key = _toPrimitive(arg, "string"); | ||
} | ||
function _objectWithoutPropertiesLoose2(source, excluded) { | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) | ||
@@ -453,3 +406,3 @@ return {}; | ||
function BentoAccordionWithRef(_ref, ref) { | ||
var _ref$animate = _ref.animate, animate2 = _ref$animate === void 0 ? false : _ref$animate, _ref$as = _ref.as, Comp = _ref$as === void 0 ? "section" : _ref$as, children = _ref.children, _ref$expandSingleSect = _ref.expandSingleSection, expandSingleSection = _ref$expandSingleSect === void 0 ? false : _ref$expandSingleSect, id = _ref.id, rest = _objectWithoutPropertiesLoose2(_ref, _excluded2); | ||
var _ref$animate = _ref.animate, animate2 = _ref$animate === void 0 ? false : _ref$animate, _ref$as = _ref.as, Comp = _ref$as === void 0 ? "section" : _ref$as, children = _ref.children, _ref$expandSingleSect = _ref.expandSingleSection, expandSingleSection = _ref$expandSingleSect === void 0 ? false : _ref$expandSingleSect, id = _ref.id, rest = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
var _useState = useState2(EMPTY_EXPANDED_MAP), expandedMap = _useState[0], setExpandedMap = _useState[1]; | ||
@@ -568,3 +521,3 @@ var eventMapRef = useRef2(EMPTY_EVENT_MAP); | ||
} | ||
var BentoAccordion = forwardRef(BentoAccordionWithRef); | ||
var BentoAccordion = (0, import_compat.forwardRef)(BentoAccordionWithRef); | ||
BentoAccordion.displayName = "Accordion"; | ||
@@ -588,3 +541,3 @@ function setExpanded(id, value, expandedMap, expandSingleSection) { | ||
function BentoAccordionSection(_ref3) { | ||
var _ref3$animate = _ref3.animate, defaultAnimate = _ref3$animate === void 0 ? false : _ref3$animate, _ref3$as = _ref3.as, Comp = _ref3$as === void 0 ? "section" : _ref3$as, children = _ref3.children, _ref3$expanded = _ref3.expanded, defaultExpanded = _ref3$expanded === void 0 ? false : _ref3$expanded, propId = _ref3.id, onExpandStateChange = _ref3.onExpandStateChange, rest = _objectWithoutPropertiesLoose2(_ref3, _excluded22); | ||
var _ref3$animate = _ref3.animate, defaultAnimate = _ref3$animate === void 0 ? false : _ref3$animate, _ref3$as = _ref3.as, Comp = _ref3$as === void 0 ? "section" : _ref3$as, children = _ref3.children, _ref3$expanded = _ref3.expanded, defaultExpanded = _ref3$expanded === void 0 ? false : _ref3$expanded, propId = _ref3.id, onExpandStateChange = _ref3.onExpandStateChange, rest = _objectWithoutPropertiesLoose(_ref3, _excluded2); | ||
var _useState3 = useState2(generateSectionId), genId = _useState3[0]; | ||
@@ -640,3 +593,3 @@ var id = propId || genId; | ||
function BentoAccordionHeader(_ref4) { | ||
var _propName = "className", _propName2 = "tabindex", _ref4$as = _ref4.as, Comp = _ref4$as === void 0 ? "div" : _ref4$as, children = _ref4.children, id = _ref4.id, _ref4$role = _ref4.role, role = _ref4$role === void 0 ? "button" : _ref4$role, _ref4$_propName = _ref4[_propName], className = _ref4$_propName === void 0 ? "" : _ref4$_propName, _ref4$_propName2 = _ref4[_propName2], tabIndex = _ref4$_propName2 === void 0 ? 0 : _ref4$_propName2, rest = _objectWithoutPropertiesLoose2(_ref4, ["as", "children", "id", "role", _propName, _propName2].map(_toPropertyKey)); | ||
var _propName = "className", _propName2 = "tabindex", _ref4$as = _ref4.as, Comp = _ref4$as === void 0 ? "div" : _ref4$as, children = _ref4.children, id = _ref4.id, _ref4$role = _ref4.role, role = _ref4$role === void 0 ? "button" : _ref4$role, _ref4$_propName = _ref4[_propName], className = _ref4$_propName === void 0 ? "" : _ref4$_propName, _ref4$_propName2 = _ref4[_propName2], tabIndex = _ref4$_propName2 === void 0 ? 0 : _ref4$_propName2, rest = _objectWithoutPropertiesLoose(_ref4, ["as", "children", "id", "role", _propName, _propName2].map(_toPropertyKey)); | ||
var _useContext2 = useContext2(SectionContext), contentId = _useContext2.contentId, expanded = _useContext2.expanded, headerId = _useContext2.headerId, setHeaderId = _useContext2.setHeaderId, toggleHandler = _useContext2.toggleHandler; | ||
@@ -662,3 +615,3 @@ useLayoutEffect2(function() { | ||
var _objstr; | ||
var _propName3 = "className", _ref5$as = _ref5.as, Comp = _ref5$as === void 0 ? "div" : _ref5$as, children = _ref5.children, id = _ref5.id, _ref5$role = _ref5.role, role = _ref5$role === void 0 ? "region" : _ref5$role, _ref5$_propName = _ref5[_propName3], className = _ref5$_propName === void 0 ? "" : _ref5$_propName, rest = _objectWithoutPropertiesLoose2(_ref5, ["as", "children", "id", "role", _propName3].map(_toPropertyKey)); | ||
var _propName3 = "className", _ref5$as = _ref5.as, Comp = _ref5$as === void 0 ? "div" : _ref5$as, children = _ref5.children, id = _ref5.id, _ref5$role = _ref5.role, role = _ref5$role === void 0 ? "region" : _ref5$role, _ref5$_propName = _ref5[_propName3], className = _ref5$_propName === void 0 ? "" : _ref5$_propName, rest = _objectWithoutPropertiesLoose(_ref5, ["as", "children", "id", "role", _propName3].map(_toPropertyKey)); | ||
var ref = useRef2(null); | ||
@@ -665,0 +618,0 @@ var hasMountedRef = useRef2(false); |
@@ -111,54 +111,5 @@ // extensions/amp-accordion/1.0/component.jss.js | ||
// src/preact/compat.js | ||
import { options } from "react"; | ||
// extensions/amp-accordion/1.0/component.js | ||
import { forwardRef } from "react"; | ||
// src/core/mode/prod.js | ||
function isProd() { | ||
return false; | ||
} | ||
// src/preact/compat.js | ||
var _excluded = ["ref"]; | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) | ||
return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) | ||
continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
var REACT_FORWARD_SYMBOL = typeof Symbol !== "undefined" && (Symbol.for == null ? void 0 : Symbol.for("react.forward_ref")) || 3911; | ||
var oldDiff = options["__b"]; | ||
options["__b"] = newDiff; | ||
function newDiff(vnode) { | ||
var _vnode$type; | ||
if ((_vnode$type = vnode["type"]) != null && _vnode$type.forwardRef_ && vnode["ref"]) { | ||
vnode["props"]["ref"] = vnode["ref"]; | ||
vnode["ref"] = null; | ||
} | ||
oldDiff == null ? void 0 : oldDiff(vnode); | ||
} | ||
function forwardRef(Component) { | ||
function Forward(props) { | ||
const { | ||
ref | ||
} = props, clone = _objectWithoutPropertiesLoose(props, _excluded); | ||
return Component(clone, ref); | ||
} | ||
Forward.$$typeof = REACT_FORWARD_SYMBOL; | ||
Forward.render = Forward; | ||
Forward.prototype.isReactComponent = true; | ||
Forward.forwardRef_ = true; | ||
if (!isProd()) { | ||
Forward.displayName = `ForwardRef(${Component.displayName || Component.name})`; | ||
} | ||
return Forward; | ||
} | ||
// src/core/constants/loading-instructions.js | ||
@@ -369,4 +320,4 @@ var Loading_Enum = { | ||
// extensions/amp-accordion/1.0/component.js | ||
var _excluded2 = ["animate", "as", "children", "expandSingleSection", "id"]; | ||
var _excluded22 = ["animate", "as", "children", "expanded", "id", "onExpandStateChange"]; | ||
var _excluded = ["animate", "as", "children", "expandSingleSection", "id"]; | ||
var _excluded2 = ["animate", "as", "children", "expanded", "id", "onExpandStateChange"]; | ||
function _toPropertyKey(arg) { | ||
@@ -402,3 +353,3 @@ var key = _toPrimitive(arg, "string"); | ||
} | ||
function _objectWithoutPropertiesLoose2(source, excluded) { | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) | ||
@@ -430,3 +381,3 @@ return {}; | ||
id | ||
} = _ref, rest = _objectWithoutPropertiesLoose2(_ref, _excluded2); | ||
} = _ref, rest = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
const [expandedMap, setExpandedMap] = useState2(EMPTY_EXPANDED_MAP); | ||
@@ -569,3 +520,3 @@ const eventMapRef = useRef2(EMPTY_EVENT_MAP); | ||
onExpandStateChange | ||
} = _ref2, rest = _objectWithoutPropertiesLoose2(_ref2, _excluded22); | ||
} = _ref2, rest = _objectWithoutPropertiesLoose(_ref2, _excluded2); | ||
const [genId] = useState2(generateSectionId); | ||
@@ -632,3 +583,3 @@ const id = propId || genId; | ||
[_propName2]: tabIndex = 0 | ||
} = _ref3, rest = _objectWithoutPropertiesLoose2(_ref3, ["as", "children", "id", "role", _propName, _propName2].map(_toPropertyKey)); | ||
} = _ref3, rest = _objectWithoutPropertiesLoose(_ref3, ["as", "children", "id", "role", _propName, _propName2].map(_toPropertyKey)); | ||
const { | ||
@@ -663,3 +614,3 @@ contentId, | ||
[_propName3]: className = "" | ||
} = _ref4, rest = _objectWithoutPropertiesLoose2(_ref4, ["as", "children", "id", "role", _propName3].map(_toPropertyKey)); | ||
} = _ref4, rest = _objectWithoutPropertiesLoose(_ref4, ["as", "children", "id", "role", _propName3].map(_toPropertyKey)); | ||
const ref = useRef2(null); | ||
@@ -666,0 +617,0 @@ const hasMountedRef = useRef2(false); |
@@ -1,1 +0,1 @@ | ||
var n;function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function e(n){var e=function(n,e){if("object"!==t(n)||null===n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var o=r.call(n,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===t(e)?e:String(e)}function r(){return n||(n=Promise.resolve(void 0))}function o(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function i(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),e.push.apply(e,r)}return e}function c(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?i(Object(e),!0).forEach((function(t){o(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function a(n,t){if(null==n)return{};var e,r,o={},i=Object.keys(n);for(r=0;r<i.length;r++)e=i[r],t.indexOf(e)>=0||(o[e]=n[e]);return o}var{hasOwnProperty:u,toString:l}=Object.prototype;function d(n,t){return Object.keys(n).reduce(((e,r)=>(t.includes(r)||(e[r]=n[r]),e)),{})}import{cloneElement as f,createContext as s,createElement as b,createRef as h,toChildArray as m}from"react";import{hydrate as p,render as v}from"react-dom";import{useCallback as g,useContext as y,useEffect as S,useImperativeHandle as x,useLayoutEffect as j,useMemo as O,useRef as w,useState as I}from"react";function $(n,t,e){return b.apply(void 0,arguments)}function z(n){return s(n,void 0)}function E(n){return I(n)}function M(n){return w(n)}function Y(n,t){S(n,t)}function C(n,t){j(n,t)}function H(n){return y(n)}function N(n,t){return O(n,t)}function k(n,t){return g(n,t)}import{options as P}from"react";var A,T=["ref"],W="undefined"!=typeof Symbol&&(null===(A=Symbol.for)||void 0===A?void 0:A.call(Symbol,"react.forward_ref"))||3911,_=P.__b;P.__b=function(n){var t;null!==(t=n.type)&&void 0!==t&&t.mf&&n.ref&&(n.props.ref=n.ref,n.ref=null),null==_||_(n)};var q,B,D=["auto","lazy","eager","unload"],F={auto:0,lazy:1,eager:2,unload:3};function G(n,t){const e=F[n]||0,r=F[t]||0,o=Math.max(e,r);return D[o]}function J(){return q||(q=z({renderable:!0,playable:!0,loading:"auto"}))}function K({children:n,loading:t="auto",notify:e,playable:r=!0,renderable:o=!0}){const i=H(J()),c=o&&i.renderable,a=c&&r&&i.playable,u=G(c?"auto":"lazy",G(t,i.loading)),l=e||i.notify,d=N((()=>({renderable:c,playable:a,loading:u,notify:l})),[c,a,u,l]);return $(J().Provider,{children:n,value:d})}var L=["Webkit","webkit","Moz","moz","ms","O","o"];function Q(n,t,e){if(X(t))return t;B||(B=Object.create(null));let r=B[t];if(!r||e){if(r=t,void 0===n[t]){const e=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(t),o=function(n,t){for(let e=0;e<L.length;e++){const r=L[e]+t;if(void 0!==n[r])return r}return""}(n,e);void 0!==n[o]&&(r=o)}e||(B[t]=r)}return r}function R(n,t,e,r,o){const i=Q(n.style,t,o);if(!i)return;const c=r?e+r:e;X(i)?n.style.setProperty(i,c):n.style[i]=c}function U(n,t,e){const r=Q(n.style,t,e);if(r)return X(r)?n.style.getPropertyValue(r):n.style[r]}function V(n,t){for(const e in t)R(n,e,t[e])}function X(n){return n.startsWith("--")}function Z(n,t,e){n.classList.add("i-amphtml-animating");let r=t();return r.onfinish=r.oncancel=()=>{r=null,e&&e(),n.classList.remove("i-amphtml-animating")},()=>{r&&r.cancel()}}function nn(n){const t=window.innerHeight,e=Math.abs(n)/t*500;return Math.min(Math.max(e,200),500)}var tn=["animate","as","children","expandSingleSection","id"],en=["animate","as","children","expanded","id","onExpandStateChange"],rn=z({}),on=z({}),cn={},an={},un=function(){let n=0;return()=>String(++n)}(),ln=()=>String(Math.floor(1e5*Math.random())),dn=function(n){function t(n){const{ref:t}=n;return function(n,t){let{animate:e=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,f=a(n,tn);const[s,b]=E(cn),h=M(an),[m]=E(ln),p=l||`a${m}`;Y((()=>{u&&b((n=>{const t={};let e=0;for(const r in n)t[r]=n[r]&&0==e++;return t}))}),[u]);const v=k(((n,t,{current:e})=>(b((e=>fn(n,t,e,u))),h.current=c(c({},h.current),{},{[n]:e}),()=>{b((t=>d(t,n))),h.current=d(h.current,n)})),[u]),g=k(((n,t)=>{b((e=>{const o=null!=t?t:!e[n],i=fn(n,o,e,u);return r().then((()=>{for(const n in e){const t=h.current[n];t&&e[n]!=i[n]&&t(i[n])}})),i}))}),[u]),y=k(((n,t)=>{var e;return null!==(e=s[n])&&void 0!==e?e:t}),[s]),S=k((n=>{if(n)n in s&&g(n);else if(!u)for(const n in s)g(n)}),[s,g,u]),j=k((n=>{if(n)y(n,!0)||g(n);else if(!u)for(const n in s)y(n,!0)||g(n)}),[s,g,y,u]),O=k((n=>{if(n)y(n,!1)&&g(n);else for(const n in s)y(n,!1)&&g(n)}),[s,g,y]);!function(n,t,e){x(n,(()=>({toggle:S,expand:j,collapse:O})),e)}(t,0,[S,O,j]);const w=N((()=>({registerSection:v,toggleExpanded:g,isExpanded:y,animate:e,prefix:p})),[v,g,y,e,p]);return $(o,c({id:l},f),$(rn.Provider,{value:w},i))}(a(n,T),t)}return t.$$typeof=W,t.render=t,t.prototype.isReactComponent=!0,t.mf=!0,t}();function fn(n,t,e,r){let o;if(r&&t){o={[n]:t};for(const t in e)t!=n&&(o[t]=!1)}else o=c(c({},e),{},{[n]:t});return o}function sn(n){let{animate:t=!1,as:e="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,en);const[f]=E(un),s=u||f,[b]=E(ln),[h,m]=E(i),[p,v]=E(null),[g,y]=E(null),{animate:S,isExpanded:x,prefix:j,registerSection:O,toggleExpanded:w}=H(rn),I=x?x(s,i):h,z=null!=S?S:t,Y=p||`${j||"a"}-content-${s}-${b}`,P=g||`${j||"a"}-header-${s}-${b}`,A=M(null);A.current=l,C((()=>{if(O)return O(s,i,A)}),[O,s,i]);const T=k((n=>{w?w(s,n):m((t=>{const e=null!=n?n:!t;return r().then((()=>{const n=A.current;n&&n(e)})),e}))}),[s,w]),W=N((()=>({animate:z,contentId:Y,headerId:P,expanded:I,toggleHandler:T,setContentId:v,setHeaderId:y})),[z,Y,P,I,T]);return $(e,c({},d),$(on.Provider,{value:W},o))}function bn(n){let t="className",r="tabindex",{as:o="div",children:i,id:u,role:l="button",[t]:d="",[r]:f=0}=n,s=a(n,["as","children","id","role",t,r].map(e));const{contentId:b,expanded:h,headerId:m,setHeaderId:p,toggleHandler:v}=H(on);return C((()=>{p&&p(u)}),[p,u]),$(o,c(c({},s),{},{id:m,role:l,className:`${d} section-child-00fce3c header-00fce3c`,tabindex:f,"aria-controls":b,onClick:()=>v(),"aria-expanded":String(h)}),i)}function hn(n){let t="className",{as:r="div",children:o,id:i,role:u="region",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const f=M(null),s=M(!1),{animate:b,contentId:h,expanded:m,headerId:p,setContentId:v}=H(on);return Y((()=>(s.current=!0,()=>s.current=!1)),[]),C((()=>{v&&v(i)}),[v,i]),C((()=>{const n=s.current,t=f.current;if(b&&n&&t&&t.animate)return m?function(n){return Z(n,(()=>{const t=U(n,"height"),e=U(n,"opacity"),r=U(n,"overflowY");V(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;V(n,{height:t,opacity:e,overflowY:r});const i=nn(o);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(t):function(n){return Z(n,(()=>{const t=n.offsetHeight,e=nn(t);return n.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(t)}),[m,b]),$(K,{renderable:m},$(r,c(c({},d),{},{ref:f,className:l+" section-child-00fce3c"+(m?"":" content-hidden-00fce3c"),id:h,"aria-labelledby":p,role:u}),o))}dn.displayName="Accordion";export{dn as BentoAccordion,hn as BentoAccordionContent,bn as BentoAccordionHeader,sn as BentoAccordionSection}; | ||
var n;function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function e(n){var e=function(n,e){if("object"!==t(n)||null===n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var o=r.call(n,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===t(e)?e:String(e)}function r(){return n||(n=Promise.resolve(void 0))}function o(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function i(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),e.push.apply(e,r)}return e}function c(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?i(Object(e),!0).forEach((function(t){o(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function a(n,t){if(null==n)return{};var e,r,o={},i=Object.keys(n);for(r=0;r<i.length;r++)e=i[r],t.indexOf(e)>=0||(o[e]=n[e]);return o}var{hasOwnProperty:u,toString:l}=Object.prototype;function d(n,t){return Object.keys(n).reduce(((e,r)=>(t.includes(r)||(e[r]=n[r]),e)),{})}import{cloneElement as f,createContext as s,createElement as b,createRef as h,toChildArray as p}from"react";import{hydrate as m,render as g}from"react-dom";import{useCallback as v,useContext as y,useEffect as x,useImperativeHandle as S,useLayoutEffect as j,useMemo as O,useRef as w,useState as I}from"react";function $(n,t,e){return b.apply(void 0,arguments)}function z(n){return s(n,void 0)}function E(n){return I(n)}function M(n){return w(n)}function Y(n,t){x(n,t)}function C(n,t){j(n,t)}function H(n){return y(n)}function N(n,t){return O(n,t)}function k(n,t){return v(n,t)}import{forwardRef as P}from"react";var A,T,W=["auto","lazy","eager","unload"],q={auto:0,lazy:1,eager:2,unload:3};function B(n,t){const e=q[n]||0,r=q[t]||0,o=Math.max(e,r);return W[o]}function D(){return A||(A=z({renderable:!0,playable:!0,loading:"auto"}))}function F({children:n,loading:t="auto",notify:e,playable:r=!0,renderable:o=!0}){const i=H(D()),c=o&&i.renderable,a=c&&r&&i.playable,u=B(c?"auto":"lazy",B(t,i.loading)),l=e||i.notify,d=N((()=>({renderable:c,playable:a,loading:u,notify:l})),[c,a,u,l]);return $(D().Provider,{children:n,value:d})}var G=["Webkit","webkit","Moz","moz","ms","O","o"];function J(n,t,e){if(R(t))return t;T||(T=Object.create(null));let r=T[t];if(!r||e){if(r=t,void 0===n[t]){const e=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(t),o=function(n,t){for(let e=0;e<G.length;e++){const r=G[e]+t;if(void 0!==n[r])return r}return""}(n,e);void 0!==n[o]&&(r=o)}e||(T[t]=r)}return r}function K(n,t,e,r,o){const i=J(n.style,t,o);if(!i)return;const c=r?e+r:e;R(i)?n.style.setProperty(i,c):n.style[i]=c}function L(n,t,e){const r=J(n.style,t,e);if(r)return R(r)?n.style.getPropertyValue(r):n.style[r]}function Q(n,t){for(const e in t)K(n,e,t[e])}function R(n){return n.startsWith("--")}function U(n,t,e){n.classList.add("i-amphtml-animating");let r=t();return r.onfinish=r.oncancel=()=>{r=null,e&&e(),n.classList.remove("i-amphtml-animating")},()=>{r&&r.cancel()}}function V(n){const t=window.innerHeight,e=Math.abs(n)/t*500;return Math.min(Math.max(e,200),500)}var X=["animate","as","children","expandSingleSection","id"],Z=["animate","as","children","expanded","id","onExpandStateChange"],_=z({}),nn=z({}),tn={},en={},rn=function(){let n=0;return()=>String(++n)}(),on=()=>String(Math.floor(1e5*Math.random())),cn=P((function(n,t){let{animate:e=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,f=a(n,X);const[s,b]=E(tn),h=M(en),[p]=E(on),m=l||`a${p}`;Y((()=>{u&&b((n=>{const t={};let e=0;for(const r in n)t[r]=n[r]&&0==e++;return t}))}),[u]);const g=k(((n,t,{current:e})=>(b((e=>an(n,t,e,u))),h.current=c(c({},h.current),{},{[n]:e}),()=>{b((t=>d(t,n))),h.current=d(h.current,n)})),[u]),v=k(((n,t)=>{b((e=>{const o=null!=t?t:!e[n],i=an(n,o,e,u);return r().then((()=>{for(const n in e){const t=h.current[n];t&&e[n]!=i[n]&&t(i[n])}})),i}))}),[u]),y=k(((n,t)=>{var e;return null!==(e=s[n])&&void 0!==e?e:t}),[s]),x=k((n=>{if(n)n in s&&v(n);else if(!u)for(const n in s)v(n)}),[s,v,u]),j=k((n=>{if(n)y(n,!0)||v(n);else if(!u)for(const n in s)y(n,!0)||v(n)}),[s,v,y,u]),O=k((n=>{if(n)y(n,!1)&&v(n);else for(const n in s)y(n,!1)&&v(n)}),[s,v,y]);!function(n,t,e){S(n,(()=>({toggle:x,expand:j,collapse:O})),e)}(t,0,[x,O,j]);const w=N((()=>({registerSection:g,toggleExpanded:v,isExpanded:y,animate:e,prefix:m})),[g,v,y,e,m]);return $(o,c({id:l},f),$(_.Provider,{value:w},i))}));function an(n,t,e,r){let o;if(r&&t){o={[n]:t};for(const t in e)t!=n&&(o[t]=!1)}else o=c(c({},e),{},{[n]:t});return o}function un(n){let{animate:t=!1,as:e="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,Z);const[f]=E(rn),s=u||f,[b]=E(on),[h,p]=E(i),[m,g]=E(null),[v,y]=E(null),{animate:x,isExpanded:S,prefix:j,registerSection:O,toggleExpanded:w}=H(_),I=S?S(s,i):h,z=null!=x?x:t,Y=m||`${j||"a"}-content-${s}-${b}`,P=v||`${j||"a"}-header-${s}-${b}`,A=M(null);A.current=l,C((()=>{if(O)return O(s,i,A)}),[O,s,i]);const T=k((n=>{w?w(s,n):p((t=>{const e=null!=n?n:!t;return r().then((()=>{const n=A.current;n&&n(e)})),e}))}),[s,w]),W=N((()=>({animate:z,contentId:Y,headerId:P,expanded:I,toggleHandler:T,setContentId:g,setHeaderId:y})),[z,Y,P,I,T]);return $(e,c({},d),$(nn.Provider,{value:W},o))}function ln(n){let t="className",r="tabindex",{as:o="div",children:i,id:u,role:l="button",[t]:d="",[r]:f=0}=n,s=a(n,["as","children","id","role",t,r].map(e));const{contentId:b,expanded:h,headerId:p,setHeaderId:m,toggleHandler:g}=H(nn);return C((()=>{m&&m(u)}),[m,u]),$(o,c(c({},s),{},{id:p,role:l,className:`${d} section-child-00fce3c header-00fce3c`,tabindex:f,"aria-controls":b,onClick:()=>g(),"aria-expanded":String(h)}),i)}function dn(n){let t="className",{as:r="div",children:o,id:i,role:u="region",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const f=M(null),s=M(!1),{animate:b,contentId:h,expanded:p,headerId:m,setContentId:g}=H(nn);return Y((()=>(s.current=!0,()=>s.current=!1)),[]),C((()=>{g&&g(i)}),[g,i]),C((()=>{const n=s.current,t=f.current;if(b&&n&&t&&t.animate)return p?function(n){return U(n,(()=>{const t=L(n,"height"),e=L(n,"opacity"),r=L(n,"overflowY");Q(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;Q(n,{height:t,opacity:e,overflowY:r});const i=V(o);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(t):function(n){return U(n,(()=>{const t=n.offsetHeight,e=V(t);return n.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(t)}),[p,b]),$(F,{renderable:p},$(r,c(c({},d),{},{ref:f,className:l+" section-child-00fce3c"+(p?"":" content-hidden-00fce3c"),id:h,"aria-labelledby":m,role:u}),o))}cn.displayName="Accordion";export{cn as BentoAccordion,dn as BentoAccordionContent,ln as BentoAccordionHeader,un as BentoAccordionSection}; |
{ | ||
"name": "@bentoproject/accordion", | ||
"version": "1.2112021656.0", | ||
"version": "1.2112032204.0", | ||
"description": "Displays content sections that can be collapsed and expanded.", | ||
@@ -5,0 +5,0 @@ "author": "Bento Authors", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1883417
11685