@bentoproject/accordion
Advanced tools
Comparing version 1.2204160405.0 to 1.2204182206.0
; | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=function(n){return t(n,"__esModule",{value:!0})},a=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var c,a=i(r),f=0,l=a.length;f<l;f++)c=a[f],u.call(n,c)||"default"===c||t(n,c,{get:function(n){return r[n]}.bind(null,c),enumerable:!(o=e(r,c))||o.enumerable});return n}(c(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 p(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 s(n){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):p(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,c=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(c)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 y(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 c(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return D},BentoAccordionContent:function(){return K},BentoAccordionHeader:function(){return J},BentoAccordionSection:function(){return G}});var m=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}m.hasOwnProperty,m.toString;var j=a(require("@bentoproject/core")),O=a(require("@bentoproject/core")),S=a(require("@bentoproject/core")),w=a(require("@bentoproject/core"));function x(n){var r,t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(t=n.tabindex)&&void 0!==t?t:n.tabIndex)&&void 0!==r?r:e}a(require("@bentoproject/core")),a(require("@bentoproject/core")),Array.isArray;var A,M=["Webkit","webkit","Moz","moz","ms","O","o"];function I(n,r,t){if(E(r))return r;var e;A||(e=Object.create(null),A=e);var i=A[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<M.length;t++){var e=M[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(A[r]=i)}return i}function Y(n,r,t,e,i){var o=I(n.style,r,i);if(o){var u,c=e?t+e:t;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),M.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function q(n,r,t){var e=I(n.style,r,t);if(e)return E(e)?n.style.getPropertyValue(e):n.style[e]}function C(n,r){for(var t in r)Y(n,t,r[t])}function E(n){return n.startsWith("--")}function z(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 B(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var k,H=["animate","as","children","expandSingleSection","id"],P=["animate","as","children","expanded","id","onExpandStateChange"],T=j.createContext({}),_=j.createContext({}),U={},W={},Z=(k=0,function(){return String(++k)}),$=function(){return String(Math.floor(1e5*Math.random()))},D=(0,S.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,c=n.expandSingleSection,a=void 0!==c&&c,f=n.id,l=y(n,H),v=h((0,O.useState)(U),2),p=v[0],m=v[1],S=(0,O.useRef)(W),w=h((0,O.useState)($),1)[0],x=f||"a".concat(w);(0,O.useEffect)((function(){a&&m((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[a]);var A=(0,O.useCallback)((function(n,r,t){var e=t.current;return m((function(t){return F(n,r,t,a)})),S.current=s(s({},S.current),{},b({},n,e)),function(){m((function(r){return g(r,n)})),S.current=g(S.current,n)}}),[a]),M=(0,O.useCallback)((function(n,r){m((function(t){var e=null!=r?r:!t[n],i=F(n,e,t,a);return d().then((function(){for(var n in t){var r=S.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[a]),I=(0,O.useCallback)((function(n,r){var t;return null!==(t=p[n])&&void 0!==t?t:r}),[p]),Y=(0,O.useCallback)((function(n){if(n)n in p&&M(n);else if(!a)for(var r in p)M(r)}),[p,M,a]),q=(0,O.useCallback)((function(n){if(n)I(n,!0)||M(n);else if(!a)for(var r in p)I(r,!0)||M(r)}),[p,M,I,a]),C=(0,O.useCallback)((function(n){if(n)I(n,!1)&&M(n);else for(var r in p)I(r,!1)&&M(r)}),[p,M,I]);(0,O.useImperativeHandle)(r,(function(){return{toggle:Y,expand:q,collapse:C}}),[Y,C,q]);var E=(0,O.useMemo)((function(){return{registerSection:A,toggleExpanded:M,isExpanded:I,animate:e,prefix:x}}),[A,M,I,e,x]);return j.createElement(o,s({id:f},l),j.createElement(T.Provider,{value:E},u))}));function F(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=s(s({},t),{},b({},n,r));return i}function G(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,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,l=y(n,P),v=h((0,O.useState)(Z),1)[0],b=a||v,p=h((0,O.useState)($),1)[0],m=h((0,O.useState)(c),2),g=m[0],S=m[1],w=h((0,O.useState)(null),2),x=w[0],A=w[1],M=h((0,O.useState)(null),2),I=M[0],Y=M[1],q=(0,O.useContext)(T),C=q.animate,E=q.isExpanded,z=q.prefix,B=q.registerSection,k=q.toggleExpanded,H=E?E(b,c):g,U=null!=C?C:t,W=x||"".concat(z||"a","-content-").concat(b,"-").concat(p),D=I||"".concat(z||"a","-header-").concat(b,"-").concat(p),F=(0,O.useRef)(null);F.current=f,(0,O.useLayoutEffect)((function(){if(B)return B(b,c,F)}),[B,b,c]);var G=(0,O.useCallback)((function(n){k?k(b,n):S((function(r){var t=null!=n?n:!r;return d().then((function(){var n=F.current;n&&n(t)})),t}))}),[b,k]),J=(0,O.useMemo)((function(){return{animate:U,contentId:W,headerId:D,expanded:H,toggleHandler:G,setContentId:A,setHeaderId:Y}}),[U,W,D,H,G]);return j.createElement(i,s({},l),j.createElement(_.Provider,{value:J},o))}function J(n){var r="class",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,v=y(n,["as","children","id","role",r].map(l)),d=(0,O.useContext)(_),b=d.contentId,p=d.expanded,h=d.headerId,m=d.setHeaderId,g=d.toggleHandler;return(0,O.useLayoutEffect)((function(){m&&m(o)}),[m,o]),j.createElement(e,s(s({},v),{},{id:h,role:c,class:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabindex:x(v),"aria-controls":b,onClick:function(){return g()},"aria-expanded":String(p)}),i)}function K(n){var r="class",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,v=y(n,["as","children","id","role",r].map(l)),d=(0,O.useRef)(null),b=(0,O.useRef)(!1),p=(0,O.useContext)(_),h=p.animate,m=p.contentId,g=p.expanded,S=p.headerId,x=p.setContentId;return(0,O.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,O.useLayoutEffect)((function(){x&&x(o)}),[x,o]),(0,O.useLayoutEffect)((function(){var n=b.current,r=d.current;if(h&&n&&r&&r.animate)return g?function(n){return z(n,(function(){var r=q(n,"height"),t=q(n,"opacity"),e=q(n,"overflowY");C(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;C(n,{height:r,opacity:t,overflowY:e});var o=B(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 z(n,(function(){var r=n.offsetHeight,t=B(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]),j.createElement(w.WithAmpContext,{renderable:g},j.createElement(e,s(s({},v),{},{ref:d,class:f+" section-child-76fac82"+(g?"":" content-hidden-76fac82"),id:m,"aria-labelledby":S,role:c}),i))}D.displayName="Accordion"; | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=function(n){return t(n,"__esModule",{value:!0})},a=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var c,a=i(r),f=0,l=a.length;f<l;f++)c=a[f],u.call(n,c)||"default"===c||t(n,c,{get:function(n){return r[n]}.bind(null,c),enumerable:!(o=e(r,c))||o.enumerable});return n}(c(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 p(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 s(n){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):p(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,c=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(c)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 y(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 c(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return D},BentoAccordionContent:function(){return K},BentoAccordionHeader:function(){return J},BentoAccordionSection:function(){return G}});var m=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}m.hasOwnProperty,m.toString;var j=a(require("@bentoproject/core/preact")),O=a(require("@bentoproject/core/preact")),S=a(require("@bentoproject/core/preact")),w=a(require("@bentoproject/core/preact"));function x(n){var r,t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(t=n.tabindex)&&void 0!==t?t:n.tabIndex)&&void 0!==r?r:e}a(require("@bentoproject/core/preact")),a(require("@bentoproject/core/preact")),Array.isArray;var A,M=["Webkit","webkit","Moz","moz","ms","O","o"];function I(n,r,t){if(E(r))return r;var e;A||(e=Object.create(null),A=e);var i=A[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<M.length;t++){var e=M[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(A[r]=i)}return i}function Y(n,r,t,e,i){var o=I(n.style,r,i);if(o){var u,c=e?t+e:t;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),M.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function q(n,r,t){var e=I(n.style,r,t);if(e)return E(e)?n.style.getPropertyValue(e):n.style[e]}function C(n,r){for(var t in r)Y(n,t,r[t])}function E(n){return n.startsWith("--")}function z(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 B(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var k,H=["animate","as","children","expandSingleSection","id"],P=["animate","as","children","expanded","id","onExpandStateChange"],T=j.createContext({}),_=j.createContext({}),U={},W={},Z=(k=0,function(){return String(++k)}),$=function(){return String(Math.floor(1e5*Math.random()))},D=(0,S.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,c=n.expandSingleSection,a=void 0!==c&&c,f=n.id,l=y(n,H),v=h((0,O.useState)(U),2),p=v[0],m=v[1],S=(0,O.useRef)(W),w=h((0,O.useState)($),1)[0],x=f||"a".concat(w);(0,O.useEffect)((function(){a&&m((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[a]);var A=(0,O.useCallback)((function(n,r,t){var e=t.current;return m((function(t){return F(n,r,t,a)})),S.current=s(s({},S.current),{},b({},n,e)),function(){m((function(r){return g(r,n)})),S.current=g(S.current,n)}}),[a]),M=(0,O.useCallback)((function(n,r){m((function(t){var e=null!=r?r:!t[n],i=F(n,e,t,a);return d().then((function(){for(var n in t){var r=S.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[a]),I=(0,O.useCallback)((function(n,r){var t;return null!==(t=p[n])&&void 0!==t?t:r}),[p]),Y=(0,O.useCallback)((function(n){if(n)n in p&&M(n);else if(!a)for(var r in p)M(r)}),[p,M,a]),q=(0,O.useCallback)((function(n){if(n)I(n,!0)||M(n);else if(!a)for(var r in p)I(r,!0)||M(r)}),[p,M,I,a]),C=(0,O.useCallback)((function(n){if(n)I(n,!1)&&M(n);else for(var r in p)I(r,!1)&&M(r)}),[p,M,I]);(0,O.useImperativeHandle)(r,(function(){return{toggle:Y,expand:q,collapse:C}}),[Y,C,q]);var E=(0,O.useMemo)((function(){return{registerSection:A,toggleExpanded:M,isExpanded:I,animate:e,prefix:x}}),[A,M,I,e,x]);return j.createElement(o,s({id:f},l),j.createElement(T.Provider,{value:E},u))}));function F(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=s(s({},t),{},b({},n,r));return i}function G(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,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,l=y(n,P),v=h((0,O.useState)(Z),1)[0],b=a||v,p=h((0,O.useState)($),1)[0],m=h((0,O.useState)(c),2),g=m[0],S=m[1],w=h((0,O.useState)(null),2),x=w[0],A=w[1],M=h((0,O.useState)(null),2),I=M[0],Y=M[1],q=(0,O.useContext)(T),C=q.animate,E=q.isExpanded,z=q.prefix,B=q.registerSection,k=q.toggleExpanded,H=E?E(b,c):g,U=null!=C?C:t,W=x||"".concat(z||"a","-content-").concat(b,"-").concat(p),D=I||"".concat(z||"a","-header-").concat(b,"-").concat(p),F=(0,O.useRef)(null);F.current=f,(0,O.useLayoutEffect)((function(){if(B)return B(b,c,F)}),[B,b,c]);var G=(0,O.useCallback)((function(n){k?k(b,n):S((function(r){var t=null!=n?n:!r;return d().then((function(){var n=F.current;n&&n(t)})),t}))}),[b,k]),J=(0,O.useMemo)((function(){return{animate:U,contentId:W,headerId:D,expanded:H,toggleHandler:G,setContentId:A,setHeaderId:Y}}),[U,W,D,H,G]);return j.createElement(i,s({},l),j.createElement(_.Provider,{value:J},o))}function J(n){var r="class",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,v=y(n,["as","children","id","role",r].map(l)),d=(0,O.useContext)(_),b=d.contentId,p=d.expanded,h=d.headerId,m=d.setHeaderId,g=d.toggleHandler;return(0,O.useLayoutEffect)((function(){m&&m(o)}),[m,o]),j.createElement(e,s(s({},v),{},{id:h,role:c,class:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabindex:x(v),"aria-controls":b,onClick:function(){return g()},"aria-expanded":String(p)}),i)}function K(n){var r="class",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,v=y(n,["as","children","id","role",r].map(l)),d=(0,O.useRef)(null),b=(0,O.useRef)(!1),p=(0,O.useContext)(_),h=p.animate,m=p.contentId,g=p.expanded,S=p.headerId,x=p.setContentId;return(0,O.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,O.useLayoutEffect)((function(){x&&x(o)}),[x,o]),(0,O.useLayoutEffect)((function(){var n=b.current,r=d.current;if(h&&n&&r&&r.animate)return g?function(n){return z(n,(function(){var r=q(n,"height"),t=q(n,"opacity"),e=q(n,"overflowY");C(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;C(n,{height:r,opacity:t,overflowY:e});var o=B(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 z(n,(function(){var r=n.offsetHeight,t=B(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]),j.createElement(w.WithAmpContext,{renderable:g},j.createElement(e,s(s({},v),{},{ref:d,class:f+" section-child-76fac82"+(g?"":" content-hidden-76fac82"),id:m,"aria-labelledby":S,role:c}),i))}D.displayName="Accordion"; | ||
//# sourceMappingURL=component-preact.js.map |
@@ -109,10 +109,10 @@ var __create = Object.create; | ||
// src/bento/components/bento-accordion/1.0/component.js | ||
var Preact = __toModule(require("@bentoproject/core")); | ||
var import_preact = __toModule(require("@bentoproject/core")); | ||
var import_compat = __toModule(require("@bentoproject/core")); | ||
var import_context2 = __toModule(require("@bentoproject/core")); | ||
var Preact = __toModule(require("@bentoproject/core/preact")); | ||
var import_preact = __toModule(require("@bentoproject/core/preact")); | ||
var import_compat = __toModule(require("@bentoproject/core/preact")); | ||
var import_context2 = __toModule(require("@bentoproject/core/preact")); | ||
// src/preact/utils.js | ||
var import__ = __toModule(require("@bentoproject/core")); | ||
var import_context = __toModule(require("@bentoproject/core")); | ||
var import__ = __toModule(require("@bentoproject/core/preact")); | ||
var import_context = __toModule(require("@bentoproject/core/preact")); | ||
function propName(name) { | ||
@@ -119,0 +119,0 @@ return name; |
@@ -62,10 +62,10 @@ // src/bento/components/bento-accordion/1.0/component.jss.js | ||
createElement | ||
} from "@bentoproject/core"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "@bentoproject/core"; | ||
import { forwardRef } from "@bentoproject/core"; | ||
import { WithAmpContext } from "@bentoproject/core"; | ||
} from "@bentoproject/core/preact"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "@bentoproject/core/preact"; | ||
import { forwardRef } from "@bentoproject/core/preact"; | ||
import { WithAmpContext } from "@bentoproject/core/preact"; | ||
// src/preact/utils.js | ||
import { useCallback, useLayoutEffect } from "@bentoproject/core"; | ||
import { useAmpContext } from "@bentoproject/core"; | ||
import { useCallback, useLayoutEffect } from "@bentoproject/core/preact"; | ||
import { useAmpContext } from "@bentoproject/core/preact"; | ||
function propName(name) { | ||
@@ -72,0 +72,0 @@ return name; |
; | ||
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 u,{hasOwnProperty:l,toString:d}=Object.prototype;function f(n,t){return Object.keys(n).reduce(((e,r)=>(t.includes(r)||(e[r]=n[r]),e)),{})}import{createContext as s,createElement as p}from"@bentoproject/core";import{useCallback as b,useContext as h,useEffect as m,useImperativeHandle as g,useLayoutEffect as v,useMemo as y,useRef as j,useState as x}from"@bentoproject/core";import{forwardRef as S}from"@bentoproject/core";import{WithAmpContext as O}from"@bentoproject/core";import{useCallback as w,useLayoutEffect as I}from"@bentoproject/core";import{useAmpContext as $}from"@bentoproject/core";function E(n,t=0){var e,r;return null!==(e=null!==(r=n.tabindex)&&void 0!==r?r:n.tabIndex)&&void 0!==e?e:t}var Y=["Webkit","webkit","Moz","moz","ms","O","o"];function C(n,t,e){if(H(t))return t;u||(u=Object.create(null));let r=u[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<Y.length;e++){const r=Y[e]+t;if(void 0!==n[r])return r}return""}(n,e);void 0!==n[o]&&(r=o)}e||(u[t]=r)}return r}function M(n,t,e,r,o){const i=C(n.style,t,o);if(!i)return;const c=r?e+r:e;n.style.setProperty(function(n){const t=n.replace(/[A-Z]/g,(n=>"-"+n.toLowerCase()));return Y.some((n=>t.startsWith(n+"-")))?`-${t}`:t}(i),c)}function k(n,t,e){const r=C(n.style,t,e);if(r)return H(r)?n.style.getPropertyValue(r):n.style[r]}function z(n,t){for(const e in t)M(n,e,t[e])}function H(n){return n.startsWith("--")}function P(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 A(n){const t=window.innerHeight,e=Math.abs(n)/t*500;return Math.min(Math.max(e,200),500)}var L=["animate","as","children","expandSingleSection","id"],T=["animate","as","children","expanded","id","onExpandStateChange"],W=s({}),Z=s({}),q={},B={},D=function(){let n=0;return()=>String(++n)}(),F=()=>String(Math.floor(1e5*Math.random())),G=S((function(n,t){let{animate:e=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,d=a(n,L);const[s,h]=x(q),v=j(B),[S]=x(F),O=l||`a${S}`;m((()=>{u&&h((n=>{const t={};let e=0;for(const r in n)t[r]=n[r]&&0==e++;return t}))}),[u]);const w=b(((n,t,{current:e})=>(h((e=>J(n,t,e,u))),v.current=c(c({},v.current),{},{[n]:e}),()=>{h((t=>f(t,n))),v.current=f(v.current,n)})),[u]),I=b(((n,t)=>{h((e=>{const o=null!=t?t:!e[n],i=J(n,o,e,u);return r().then((()=>{for(const n in e){const t=v.current[n];t&&e[n]!=i[n]&&t(i[n])}})),i}))}),[u]),$=b(((n,t)=>{var e;return null!==(e=s[n])&&void 0!==e?e:t}),[s]),E=b((n=>{if(n)n in s&&I(n);else if(!u)for(const n in s)I(n)}),[s,I,u]),Y=b((n=>{if(n)$(n,!0)||I(n);else if(!u)for(const n in s)$(n,!0)||I(n)}),[s,I,$,u]),C=b((n=>{if(n)$(n,!1)&&I(n);else for(const n in s)$(n,!1)&&I(n)}),[s,I,$]);g(t,(()=>({toggle:E,expand:Y,collapse:C})),[E,C,Y]);const M=y((()=>({registerSection:w,toggleExpanded:I,isExpanded:$,animate:e,prefix:O})),[w,I,$,e,O]);return p(o,c({id:l},d),p(W.Provider,{value:M},i))}));function J(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 K(n){let{animate:t=!1,as:e="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,T);const[f]=x(D),s=u||f,[m]=x(F),[g,S]=x(i),[O,w]=x(null),[I,$]=x(null),{animate:E,isExpanded:Y,prefix:C,registerSection:M,toggleExpanded:k}=h(W),z=Y?Y(s,i):g,H=null!=E?E:t,P=O||`${C||"a"}-content-${s}-${m}`,A=I||`${C||"a"}-header-${s}-${m}`,L=j(null);L.current=l,v((()=>{if(M)return M(s,i,L)}),[M,s,i]);const q=b((n=>{k?k(s,n):S((t=>{const e=null!=n?n:!t;return r().then((()=>{const n=L.current;n&&n(e)})),e}))}),[s,k]),B=y((()=>({animate:H,contentId:P,headerId:A,expanded:z,toggleHandler:q,setContentId:w,setHeaderId:$})),[H,P,A,z,q]);return p(e,c({},d),p(Z.Provider,{value:B},o))}function N(n){let t="class",{as:r="div",children:o,id:i,role:u="button",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const{contentId:f,expanded:s,headerId:b,setHeaderId:m,toggleHandler:g}=h(Z);return v((()=>{m&&m(i)}),[m,i]),p(r,c(c({},d),{},{id:b,role:u,class:`${l} section-child-76fac82 header-76fac82`,tabindex:E(d),"aria-controls":f,onClick:()=>g(),"aria-expanded":String(s)}),o)}function Q(n){let t="class",{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=j(null),s=j(!1),{animate:b,contentId:g,expanded:y,headerId:x,setContentId:S}=h(Z);return m((()=>(s.current=!0,()=>s.current=!1)),[]),v((()=>{S&&S(i)}),[S,i]),v((()=>{const n=s.current,t=f.current;if(b&&n&&t&&t.animate)return y?function(n){return P(n,(()=>{const t=k(n,"height"),e=k(n,"opacity"),r=k(n,"overflowY");z(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;z(n,{height:t,opacity:e,overflowY:r});const i=A(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 P(n,(()=>{const t=n.offsetHeight,e=A(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)}),[y,b]),p(O,{renderable:y},p(r,c(c({},d),{},{ref:f,class:l+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:g,"aria-labelledby":x,role:u}),o))}G.displayName="Accordion";export{G as BentoAccordion,Q as BentoAccordionContent,N as BentoAccordionHeader,K 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 u,{hasOwnProperty:l,toString:d}=Object.prototype;function f(n,t){return Object.keys(n).reduce(((e,r)=>(t.includes(r)||(e[r]=n[r]),e)),{})}import{createContext as s,createElement as p}from"@bentoproject/core/preact";import{useCallback as b,useContext as h,useEffect as m,useImperativeHandle as g,useLayoutEffect as v,useMemo as y,useRef as j,useState as x}from"@bentoproject/core/preact";import{forwardRef as S}from"@bentoproject/core/preact";import{WithAmpContext as O}from"@bentoproject/core/preact";import{useCallback as w,useLayoutEffect as I}from"@bentoproject/core/preact";import{useAmpContext as $}from"@bentoproject/core/preact";function E(n,t=0){var e,r;return null!==(e=null!==(r=n.tabindex)&&void 0!==r?r:n.tabIndex)&&void 0!==e?e:t}var Y=["Webkit","webkit","Moz","moz","ms","O","o"];function C(n,t,e){if(H(t))return t;u||(u=Object.create(null));let r=u[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<Y.length;e++){const r=Y[e]+t;if(void 0!==n[r])return r}return""}(n,e);void 0!==n[o]&&(r=o)}e||(u[t]=r)}return r}function M(n,t,e,r,o){const i=C(n.style,t,o);if(!i)return;const c=r?e+r:e;n.style.setProperty(function(n){const t=n.replace(/[A-Z]/g,(n=>"-"+n.toLowerCase()));return Y.some((n=>t.startsWith(n+"-")))?`-${t}`:t}(i),c)}function k(n,t,e){const r=C(n.style,t,e);if(r)return H(r)?n.style.getPropertyValue(r):n.style[r]}function z(n,t){for(const e in t)M(n,e,t[e])}function H(n){return n.startsWith("--")}function P(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 A(n){const t=window.innerHeight,e=Math.abs(n)/t*500;return Math.min(Math.max(e,200),500)}var L=["animate","as","children","expandSingleSection","id"],T=["animate","as","children","expanded","id","onExpandStateChange"],W=s({}),Z=s({}),q={},B={},D=function(){let n=0;return()=>String(++n)}(),F=()=>String(Math.floor(1e5*Math.random())),G=S((function(n,t){let{animate:e=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,d=a(n,L);const[s,h]=x(q),v=j(B),[S]=x(F),O=l||`a${S}`;m((()=>{u&&h((n=>{const t={};let e=0;for(const r in n)t[r]=n[r]&&0==e++;return t}))}),[u]);const w=b(((n,t,{current:e})=>(h((e=>J(n,t,e,u))),v.current=c(c({},v.current),{},{[n]:e}),()=>{h((t=>f(t,n))),v.current=f(v.current,n)})),[u]),I=b(((n,t)=>{h((e=>{const o=null!=t?t:!e[n],i=J(n,o,e,u);return r().then((()=>{for(const n in e){const t=v.current[n];t&&e[n]!=i[n]&&t(i[n])}})),i}))}),[u]),$=b(((n,t)=>{var e;return null!==(e=s[n])&&void 0!==e?e:t}),[s]),E=b((n=>{if(n)n in s&&I(n);else if(!u)for(const n in s)I(n)}),[s,I,u]),Y=b((n=>{if(n)$(n,!0)||I(n);else if(!u)for(const n in s)$(n,!0)||I(n)}),[s,I,$,u]),C=b((n=>{if(n)$(n,!1)&&I(n);else for(const n in s)$(n,!1)&&I(n)}),[s,I,$]);g(t,(()=>({toggle:E,expand:Y,collapse:C})),[E,C,Y]);const M=y((()=>({registerSection:w,toggleExpanded:I,isExpanded:$,animate:e,prefix:O})),[w,I,$,e,O]);return p(o,c({id:l},d),p(W.Provider,{value:M},i))}));function J(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 K(n){let{animate:t=!1,as:e="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,T);const[f]=x(D),s=u||f,[m]=x(F),[g,S]=x(i),[O,w]=x(null),[I,$]=x(null),{animate:E,isExpanded:Y,prefix:C,registerSection:M,toggleExpanded:k}=h(W),z=Y?Y(s,i):g,H=null!=E?E:t,P=O||`${C||"a"}-content-${s}-${m}`,A=I||`${C||"a"}-header-${s}-${m}`,L=j(null);L.current=l,v((()=>{if(M)return M(s,i,L)}),[M,s,i]);const q=b((n=>{k?k(s,n):S((t=>{const e=null!=n?n:!t;return r().then((()=>{const n=L.current;n&&n(e)})),e}))}),[s,k]),B=y((()=>({animate:H,contentId:P,headerId:A,expanded:z,toggleHandler:q,setContentId:w,setHeaderId:$})),[H,P,A,z,q]);return p(e,c({},d),p(Z.Provider,{value:B},o))}function N(n){let t="class",{as:r="div",children:o,id:i,role:u="button",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const{contentId:f,expanded:s,headerId:b,setHeaderId:m,toggleHandler:g}=h(Z);return v((()=>{m&&m(i)}),[m,i]),p(r,c(c({},d),{},{id:b,role:u,class:`${l} section-child-76fac82 header-76fac82`,tabindex:E(d),"aria-controls":f,onClick:()=>g(),"aria-expanded":String(s)}),o)}function Q(n){let t="class",{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=j(null),s=j(!1),{animate:b,contentId:g,expanded:y,headerId:x,setContentId:S}=h(Z);return m((()=>(s.current=!0,()=>s.current=!1)),[]),v((()=>{S&&S(i)}),[S,i]),v((()=>{const n=s.current,t=f.current;if(b&&n&&t&&t.animate)return y?function(n){return P(n,(()=>{const t=k(n,"height"),e=k(n,"opacity"),r=k(n,"overflowY");z(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;z(n,{height:t,opacity:e,overflowY:r});const i=A(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 P(n,(()=>{const t=n.offsetHeight,e=A(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)}),[y,b]),p(O,{renderable:y},p(r,c(c({},d),{},{ref:f,class:l+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:g,"aria-labelledby":x,role:u}),o))}G.displayName="Accordion";export{G as BentoAccordion,Q as BentoAccordionContent,N as BentoAccordionHeader,K as BentoAccordionSection}; | ||
//# sourceMappingURL=component-preact.module.js.map |
; | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=function(n){return t(n,"__esModule",{value:!0})},a=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var c,a=i(r),f=0,l=a.length;f<l;f++)c=a[f],u.call(n,c)||"default"===c||t(n,c,{get:function(n){return r[n]}.bind(null,c),enumerable:!(o=e(r,c))||o.enumerable});return n}(c(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 s(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?s(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):s(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,c=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(c)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 p(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 c(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return $},BentoAccordionContent:function(){return J},BentoAccordionHeader:function(){return G},BentoAccordionSection:function(){return F}});var y=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}y.hasOwnProperty,y.toString;var j=a(require("@bentoproject/core")),O=a(require("@bentoproject/core")),S=a(require("react")),w=a(require("@bentoproject/core"));function x(n){var r,t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(t=n.tabindex)&&void 0!==t?t:n.tabIndex)&&void 0!==r?r:e}a(require("@bentoproject/core")),a(require("@bentoproject/core")),Array.isArray;var A,I=["Webkit","webkit","Moz","moz","ms","O","o"];function M(n,r,t){if(E(r))return r;var e;A||(e=Object.create(null),A=e);var i=A[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<I.length;t++){var e=I[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(A[r]=i)}return i}function Y(n,r,t,e,i){var o=M(n.style,r,i);if(o){var u,c=e?t+e:t;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),I.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function q(n,r,t){var e=M(n.style,r,t);if(e)return E(e)?n.style.getPropertyValue(e):n.style[e]}function C(n,r){for(var t in r)Y(n,t,r[t])}function E(n){return n.startsWith("--")}function z(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 B(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var N,k=["animate","as","children","expandSingleSection","id"],H=["animate","as","children","expanded","id","onExpandStateChange"],P=j.createContext({}),T=j.createContext({}),_={},U={},W=(N=0,function(){return String(++N)}),Z=function(){return String(Math.floor(1e5*Math.random()))},$=(0,S.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,c=n.expandSingleSection,a=void 0!==c&&c,f=n.id,l=p(n,k),v=m((0,O.useState)(_),2),s=v[0],y=v[1],S=(0,O.useRef)(U),w=m((0,O.useState)(Z),1)[0],x=f||"a".concat(w);(0,O.useEffect)((function(){a&&y((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[a]);var A=(0,O.useCallback)((function(n,r,t){var e=t.current;return y((function(t){return D(n,r,t,a)})),S.current=h(h({},S.current),{},b({},n,e)),function(){y((function(r){return g(r,n)})),S.current=g(S.current,n)}}),[a]),I=(0,O.useCallback)((function(n,r){y((function(t){var e=null!=r?r:!t[n],i=D(n,e,t,a);return d().then((function(){for(var n in t){var r=S.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[a]),M=(0,O.useCallback)((function(n,r){var t;return null!==(t=s[n])&&void 0!==t?t:r}),[s]),Y=(0,O.useCallback)((function(n){if(n)n in s&&I(n);else if(!a)for(var r in s)I(r)}),[s,I,a]),q=(0,O.useCallback)((function(n){if(n)M(n,!0)||I(n);else if(!a)for(var r in s)M(r,!0)||I(r)}),[s,I,M,a]),C=(0,O.useCallback)((function(n){if(n)M(n,!1)&&I(n);else for(var r in s)M(r,!1)&&I(r)}),[s,I,M]);(0,O.useImperativeHandle)(r,(function(){return{toggle:Y,expand:q,collapse:C}}),[Y,C,q]);var E=(0,O.useMemo)((function(){return{registerSection:A,toggleExpanded:I,isExpanded:M,animate:e,prefix:x}}),[A,I,M,e,x]);return j.createElement(o,h({id:f},l),j.createElement(P.Provider,{value:E},u))}));function D(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 F(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,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,l=p(n,H),v=m((0,O.useState)(W),1)[0],b=a||v,s=m((0,O.useState)(Z),1)[0],y=m((0,O.useState)(c),2),g=y[0],S=y[1],w=m((0,O.useState)(null),2),x=w[0],A=w[1],I=m((0,O.useState)(null),2),M=I[0],Y=I[1],q=(0,O.useContext)(P),C=q.animate,E=q.isExpanded,z=q.prefix,B=q.registerSection,N=q.toggleExpanded,k=E?E(b,c):g,_=null!=C?C:t,U=x||"".concat(z||"a","-content-").concat(b,"-").concat(s),$=M||"".concat(z||"a","-header-").concat(b,"-").concat(s),D=(0,O.useRef)(null);D.current=f,(0,O.useLayoutEffect)((function(){if(B)return B(b,c,D)}),[B,b,c]);var F=(0,O.useCallback)((function(n){N?N(b,n):S((function(r){var t=null!=n?n:!r;return d().then((function(){var n=D.current;n&&n(t)})),t}))}),[b,N]),G=(0,O.useMemo)((function(){return{animate:_,contentId:U,headerId:$,expanded:k,toggleHandler:F,setContentId:A,setHeaderId:Y}}),[_,U,$,k,F]);return j.createElement(i,h({},l),j.createElement(T.Provider,{value:G},o))}function G(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,v=p(n,["as","children","id","role",r].map(l)),d=(0,O.useContext)(T),b=d.contentId,s=d.expanded,m=d.headerId,y=d.setHeaderId,g=d.toggleHandler;return(0,O.useLayoutEffect)((function(){y&&y(o)}),[y,o]),j.createElement(e,h(h({},v),{},{id:m,role:c,className:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabIndex:x(v),"aria-controls":b,onClick:function(){return g()},"aria-expanded":String(s)}),i)}function J(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,v=p(n,["as","children","id","role",r].map(l)),d=(0,O.useRef)(null),b=(0,O.useRef)(!1),s=(0,O.useContext)(T),m=s.animate,y=s.contentId,g=s.expanded,S=s.headerId,x=s.setContentId;return(0,O.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,O.useLayoutEffect)((function(){x&&x(o)}),[x,o]),(0,O.useLayoutEffect)((function(){var n=b.current,r=d.current;if(m&&n&&r&&r.animate)return g?function(n){return z(n,(function(){var r=q(n,"height"),t=q(n,"opacity"),e=q(n,"overflowY");C(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;C(n,{height:r,opacity:t,overflowY:e});var o=B(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 z(n,(function(){var r=n.offsetHeight,t=B(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]),j.createElement(w.WithAmpContext,{renderable:g},j.createElement(e,h(h({},v),{},{ref:d,className:f+" section-child-76fac82"+(g?"":" content-hidden-76fac82"),id:y,"aria-labelledby":S,role:c}),i))}$.displayName="Accordion"; | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=function(n){return t(n,"__esModule",{value:!0})},a=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var c,a=i(r),f=0,l=a.length;f<l;f++)c=a[f],u.call(n,c)||"default"===c||t(n,c,{get:function(n){return r[n]}.bind(null,c),enumerable:!(o=e(r,c))||o.enumerable});return n}(c(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 p(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 s(n){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):p(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,c=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(c)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 m(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 c(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return $},BentoAccordionContent:function(){return J},BentoAccordionHeader:function(){return G},BentoAccordionSection:function(){return F}});var y=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}y.hasOwnProperty,y.toString;var j=a(require("@bentoproject/core/react")),O=a(require("@bentoproject/core/react")),S=a(require("@bentoproject/core/react")),w=a(require("@bentoproject/core/react"));function x(n){var r,t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(t=n.tabindex)&&void 0!==t?t:n.tabIndex)&&void 0!==r?r:e}a(require("@bentoproject/core/react")),a(require("@bentoproject/core/react")),Array.isArray;var A,I=["Webkit","webkit","Moz","moz","ms","O","o"];function M(n,r,t){if(E(r))return r;var e;A||(e=Object.create(null),A=e);var i=A[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<I.length;t++){var e=I[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(A[r]=i)}return i}function Y(n,r,t,e,i){var o=M(n.style,r,i);if(o){var u,c=e?t+e:t;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),I.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function q(n,r,t){var e=M(n.style,r,t);if(e)return E(e)?n.style.getPropertyValue(e):n.style[e]}function C(n,r){for(var t in r)Y(n,t,r[t])}function E(n){return n.startsWith("--")}function z(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 B(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var N,k=["animate","as","children","expandSingleSection","id"],H=["animate","as","children","expanded","id","onExpandStateChange"],P=j.createContext({}),T=j.createContext({}),_={},U={},W=(N=0,function(){return String(++N)}),Z=function(){return String(Math.floor(1e5*Math.random()))},$=(0,S.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,c=n.expandSingleSection,a=void 0!==c&&c,f=n.id,l=m(n,k),v=h((0,O.useState)(_),2),p=v[0],y=v[1],S=(0,O.useRef)(U),w=h((0,O.useState)(Z),1)[0],x=f||"a".concat(w);(0,O.useEffect)((function(){a&&y((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[a]);var A=(0,O.useCallback)((function(n,r,t){var e=t.current;return y((function(t){return D(n,r,t,a)})),S.current=s(s({},S.current),{},b({},n,e)),function(){y((function(r){return g(r,n)})),S.current=g(S.current,n)}}),[a]),I=(0,O.useCallback)((function(n,r){y((function(t){var e=null!=r?r:!t[n],i=D(n,e,t,a);return d().then((function(){for(var n in t){var r=S.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[a]),M=(0,O.useCallback)((function(n,r){var t;return null!==(t=p[n])&&void 0!==t?t:r}),[p]),Y=(0,O.useCallback)((function(n){if(n)n in p&&I(n);else if(!a)for(var r in p)I(r)}),[p,I,a]),q=(0,O.useCallback)((function(n){if(n)M(n,!0)||I(n);else if(!a)for(var r in p)M(r,!0)||I(r)}),[p,I,M,a]),C=(0,O.useCallback)((function(n){if(n)M(n,!1)&&I(n);else for(var r in p)M(r,!1)&&I(r)}),[p,I,M]);(0,O.useImperativeHandle)(r,(function(){return{toggle:Y,expand:q,collapse:C}}),[Y,C,q]);var E=(0,O.useMemo)((function(){return{registerSection:A,toggleExpanded:I,isExpanded:M,animate:e,prefix:x}}),[A,I,M,e,x]);return j.createElement(o,s({id:f},l),j.createElement(P.Provider,{value:E},u))}));function D(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=s(s({},t),{},b({},n,r));return i}function F(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,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,l=m(n,H),v=h((0,O.useState)(W),1)[0],b=a||v,p=h((0,O.useState)(Z),1)[0],y=h((0,O.useState)(c),2),g=y[0],S=y[1],w=h((0,O.useState)(null),2),x=w[0],A=w[1],I=h((0,O.useState)(null),2),M=I[0],Y=I[1],q=(0,O.useContext)(P),C=q.animate,E=q.isExpanded,z=q.prefix,B=q.registerSection,N=q.toggleExpanded,k=E?E(b,c):g,_=null!=C?C:t,U=x||"".concat(z||"a","-content-").concat(b,"-").concat(p),$=M||"".concat(z||"a","-header-").concat(b,"-").concat(p),D=(0,O.useRef)(null);D.current=f,(0,O.useLayoutEffect)((function(){if(B)return B(b,c,D)}),[B,b,c]);var F=(0,O.useCallback)((function(n){N?N(b,n):S((function(r){var t=null!=n?n:!r;return d().then((function(){var n=D.current;n&&n(t)})),t}))}),[b,N]),G=(0,O.useMemo)((function(){return{animate:_,contentId:U,headerId:$,expanded:k,toggleHandler:F,setContentId:A,setHeaderId:Y}}),[_,U,$,k,F]);return j.createElement(i,s({},l),j.createElement(T.Provider,{value:G},o))}function G(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,v=m(n,["as","children","id","role",r].map(l)),d=(0,O.useContext)(T),b=d.contentId,p=d.expanded,h=d.headerId,y=d.setHeaderId,g=d.toggleHandler;return(0,O.useLayoutEffect)((function(){y&&y(o)}),[y,o]),j.createElement(e,s(s({},v),{},{id:h,role:c,className:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabIndex:x(v),"aria-controls":b,onClick:function(){return g()},"aria-expanded":String(p)}),i)}function J(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,v=m(n,["as","children","id","role",r].map(l)),d=(0,O.useRef)(null),b=(0,O.useRef)(!1),p=(0,O.useContext)(T),h=p.animate,y=p.contentId,g=p.expanded,S=p.headerId,x=p.setContentId;return(0,O.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,O.useLayoutEffect)((function(){x&&x(o)}),[x,o]),(0,O.useLayoutEffect)((function(){var n=b.current,r=d.current;if(h&&n&&r&&r.animate)return g?function(n){return z(n,(function(){var r=q(n,"height"),t=q(n,"opacity"),e=q(n,"overflowY");C(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;C(n,{height:r,opacity:t,overflowY:e});var o=B(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 z(n,(function(){var r=n.offsetHeight,t=B(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]),j.createElement(w.WithAmpContext,{renderable:g},j.createElement(e,s(s({},v),{},{ref:d,className:f+" section-child-76fac82"+(g?"":" content-hidden-76fac82"),id:y,"aria-labelledby":S,role:c}),i))}$.displayName="Accordion"; | ||
//# sourceMappingURL=component-react.js.map |
@@ -109,10 +109,10 @@ var __create = Object.create; | ||
// src/bento/components/bento-accordion/1.0/component.js | ||
var Preact = __toModule(require("@bentoproject/core")); | ||
var import_preact = __toModule(require("@bentoproject/core")); | ||
var import_compat = __toModule(require("react")); | ||
var import_context2 = __toModule(require("@bentoproject/core")); | ||
var Preact = __toModule(require("@bentoproject/core/react")); | ||
var import_preact = __toModule(require("@bentoproject/core/react")); | ||
var import_compat = __toModule(require("@bentoproject/core/react")); | ||
var import_context2 = __toModule(require("@bentoproject/core/react")); | ||
// src/preact/utils.js | ||
var import__ = __toModule(require("@bentoproject/core")); | ||
var import_context = __toModule(require("@bentoproject/core")); | ||
var import__ = __toModule(require("@bentoproject/core/react")); | ||
var import_context = __toModule(require("@bentoproject/core/react")); | ||
function tabindexFromProps(props, fallback) { | ||
@@ -119,0 +119,0 @@ var _ref, _props$tabindex; |
@@ -62,10 +62,10 @@ // src/bento/components/bento-accordion/1.0/component.jss.js | ||
createElement | ||
} from "@bentoproject/core"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "@bentoproject/core"; | ||
import { forwardRef } from "react"; | ||
import { WithAmpContext } from "@bentoproject/core"; | ||
} from "@bentoproject/core/react"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "@bentoproject/core/react"; | ||
import { forwardRef } from "@bentoproject/core/react"; | ||
import { WithAmpContext } from "@bentoproject/core/react"; | ||
// src/preact/utils.js | ||
import { useCallback, useLayoutEffect } from "@bentoproject/core"; | ||
import { useAmpContext } from "@bentoproject/core"; | ||
import { useCallback, useLayoutEffect } from "@bentoproject/core/react"; | ||
import { useAmpContext } from "@bentoproject/core/react"; | ||
function tabindexFromProps(props, fallback = 0) { | ||
@@ -72,0 +72,0 @@ var _ref, _props$tabindex; |
; | ||
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 u,{hasOwnProperty:l,toString:d}=Object.prototype;function f(n,t){return Object.keys(n).reduce(((e,r)=>(t.includes(r)||(e[r]=n[r]),e)),{})}import{createContext as s,createElement as p}from"@bentoproject/core";import{useCallback as b,useContext as m,useEffect as h,useImperativeHandle as g,useLayoutEffect as v,useMemo as y,useRef as j,useState as x}from"@bentoproject/core";import{forwardRef as S}from"react";import{WithAmpContext as O}from"@bentoproject/core";import{useCallback as w,useLayoutEffect as I}from"@bentoproject/core";import{useAmpContext as $}from"@bentoproject/core";function E(n,t=0){var e,r;return null!==(e=null!==(r=n.tabindex)&&void 0!==r?r:n.tabIndex)&&void 0!==e?e:t}var Y=["Webkit","webkit","Moz","moz","ms","O","o"];function C(n,t,e){if(H(t))return t;u||(u=Object.create(null));let r=u[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<Y.length;e++){const r=Y[e]+t;if(void 0!==n[r])return r}return""}(n,e);void 0!==n[o]&&(r=o)}e||(u[t]=r)}return r}function M(n,t,e,r,o){const i=C(n.style,t,o);if(!i)return;const c=r?e+r:e;n.style.setProperty(function(n){const t=n.replace(/[A-Z]/g,(n=>"-"+n.toLowerCase()));return Y.some((n=>t.startsWith(n+"-")))?`-${t}`:t}(i),c)}function k(n,t,e){const r=C(n.style,t,e);if(r)return H(r)?n.style.getPropertyValue(r):n.style[r]}function z(n,t){for(const e in t)M(n,e,t[e])}function H(n){return n.startsWith("--")}function N(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 P(n){const t=window.innerHeight,e=Math.abs(n)/t*500;return Math.min(Math.max(e,200),500)}var A=["animate","as","children","expandSingleSection","id"],L=["animate","as","children","expanded","id","onExpandStateChange"],T=s({}),W=s({}),Z={},q={},B=function(){let n=0;return()=>String(++n)}(),D=()=>String(Math.floor(1e5*Math.random())),F=S((function(n,t){let{animate:e=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,d=a(n,A);const[s,m]=x(Z),v=j(q),[S]=x(D),O=l||`a${S}`;h((()=>{u&&m((n=>{const t={};let e=0;for(const r in n)t[r]=n[r]&&0==e++;return t}))}),[u]);const w=b(((n,t,{current:e})=>(m((e=>G(n,t,e,u))),v.current=c(c({},v.current),{},{[n]:e}),()=>{m((t=>f(t,n))),v.current=f(v.current,n)})),[u]),I=b(((n,t)=>{m((e=>{const o=null!=t?t:!e[n],i=G(n,o,e,u);return r().then((()=>{for(const n in e){const t=v.current[n];t&&e[n]!=i[n]&&t(i[n])}})),i}))}),[u]),$=b(((n,t)=>{var e;return null!==(e=s[n])&&void 0!==e?e:t}),[s]),E=b((n=>{if(n)n in s&&I(n);else if(!u)for(const n in s)I(n)}),[s,I,u]),Y=b((n=>{if(n)$(n,!0)||I(n);else if(!u)for(const n in s)$(n,!0)||I(n)}),[s,I,$,u]),C=b((n=>{if(n)$(n,!1)&&I(n);else for(const n in s)$(n,!1)&&I(n)}),[s,I,$]);g(t,(()=>({toggle:E,expand:Y,collapse:C})),[E,C,Y]);const M=y((()=>({registerSection:w,toggleExpanded:I,isExpanded:$,animate:e,prefix:O})),[w,I,$,e,O]);return p(o,c({id:l},d),p(T.Provider,{value:M},i))}));function G(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 J(n){let{animate:t=!1,as:e="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,L);const[f]=x(B),s=u||f,[h]=x(D),[g,S]=x(i),[O,w]=x(null),[I,$]=x(null),{animate:E,isExpanded:Y,prefix:C,registerSection:M,toggleExpanded:k}=m(T),z=Y?Y(s,i):g,H=null!=E?E:t,N=O||`${C||"a"}-content-${s}-${h}`,P=I||`${C||"a"}-header-${s}-${h}`,A=j(null);A.current=l,v((()=>{if(M)return M(s,i,A)}),[M,s,i]);const Z=b((n=>{k?k(s,n):S((t=>{const e=null!=n?n:!t;return r().then((()=>{const n=A.current;n&&n(e)})),e}))}),[s,k]),q=y((()=>({animate:H,contentId:N,headerId:P,expanded:z,toggleHandler:Z,setContentId:w,setHeaderId:$})),[H,N,P,z,Z]);return p(e,c({},d),p(W.Provider,{value:q},o))}function K(n){let t="className",{as:r="div",children:o,id:i,role:u="button",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const{contentId:f,expanded:s,headerId:b,setHeaderId:h,toggleHandler:g}=m(W);return v((()=>{h&&h(i)}),[h,i]),p(r,c(c({},d),{},{id:b,role:u,className:`${l} section-child-76fac82 header-76fac82`,tabIndex:E(d),"aria-controls":f,onClick:()=>g(),"aria-expanded":String(s)}),o)}function Q(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=j(null),s=j(!1),{animate:b,contentId:g,expanded:y,headerId:x,setContentId:S}=m(W);return h((()=>(s.current=!0,()=>s.current=!1)),[]),v((()=>{S&&S(i)}),[S,i]),v((()=>{const n=s.current,t=f.current;if(b&&n&&t&&t.animate)return y?function(n){return N(n,(()=>{const t=k(n,"height"),e=k(n,"opacity"),r=k(n,"overflowY");z(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;z(n,{height:t,opacity:e,overflowY:r});const i=P(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 N(n,(()=>{const t=n.offsetHeight,e=P(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)}),[y,b]),p(O,{renderable:y},p(r,c(c({},d),{},{ref:f,className:l+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:g,"aria-labelledby":x,role:u}),o))}F.displayName="Accordion";export{F as BentoAccordion,Q as BentoAccordionContent,K as BentoAccordionHeader,J as BentoAccordionSection}; | ||
var n;function e(n){return(e="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 t(n){var t=function(n,t){if("object"!==e(n)||null===n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var o=r.call(n,"string");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===e(t)?t:String(t)}function r(){return n||(n=Promise.resolve(void 0))}function o(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function i(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.push.apply(t,r)}return t}function c(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?i(Object(t),!0).forEach((function(e){o(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}function a(n,e){if(null==n)return{};var t,r,o={},i=Object.keys(n);for(r=0;r<i.length;r++)t=i[r],e.indexOf(t)>=0||(o[t]=n[t]);return o}var u,{hasOwnProperty:l,toString:d}=Object.prototype;function f(n,e){return Object.keys(n).reduce(((t,r)=>(e.includes(r)||(t[r]=n[r]),t)),{})}import{createContext as s,createElement as p}from"@bentoproject/core/react";import{useCallback as b,useContext as m,useEffect as h,useImperativeHandle as g,useLayoutEffect as v,useMemo as y,useRef as j,useState as x}from"@bentoproject/core/react";import{forwardRef as S}from"@bentoproject/core/react";import{WithAmpContext as O}from"@bentoproject/core/react";import{useCallback as w,useLayoutEffect as I}from"@bentoproject/core/react";import{useAmpContext as $}from"@bentoproject/core/react";function E(n,e=0){var t,r;return null!==(t=null!==(r=n.tabindex)&&void 0!==r?r:n.tabIndex)&&void 0!==t?t:e}var Y=["Webkit","webkit","Moz","moz","ms","O","o"];function C(n,e,t){if(H(e))return e;u||(u=Object.create(null));let r=u[e];if(!r||t){if(r=e,void 0===n[e]){const t=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(e),o=function(n,e){for(let t=0;t<Y.length;t++){const r=Y[t]+e;if(void 0!==n[r])return r}return""}(n,t);void 0!==n[o]&&(r=o)}t||(u[e]=r)}return r}function M(n,e,t,r,o){const i=C(n.style,e,o);if(!i)return;const c=r?t+r:t;n.style.setProperty(function(n){const e=n.replace(/[A-Z]/g,(n=>"-"+n.toLowerCase()));return Y.some((n=>e.startsWith(n+"-")))?`-${e}`:e}(i),c)}function k(n,e,t){const r=C(n.style,e,t);if(r)return H(r)?n.style.getPropertyValue(r):n.style[r]}function z(n,e){for(const t in e)M(n,t,e[t])}function H(n){return n.startsWith("--")}function N(n,e,t){n.classList.add("i-amphtml-animating");let r=e();return r.onfinish=r.oncancel=()=>{r=null,t&&t(),n.classList.remove("i-amphtml-animating")},()=>{r&&r.cancel()}}function P(n){const e=window.innerHeight,t=Math.abs(n)/e*500;return Math.min(Math.max(t,200),500)}var A=["animate","as","children","expandSingleSection","id"],L=["animate","as","children","expanded","id","onExpandStateChange"],T=s({}),W=s({}),Z={},q={},B=function(){let n=0;return()=>String(++n)}(),D=()=>String(Math.floor(1e5*Math.random())),F=S((function(n,e){let{animate:t=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,d=a(n,A);const[s,m]=x(Z),v=j(q),[S]=x(D),O=l||`a${S}`;h((()=>{u&&m((n=>{const e={};let t=0;for(const r in n)e[r]=n[r]&&0==t++;return e}))}),[u]);const w=b(((n,e,{current:t})=>(m((t=>G(n,e,t,u))),v.current=c(c({},v.current),{},{[n]:t}),()=>{m((e=>f(e,n))),v.current=f(v.current,n)})),[u]),I=b(((n,e)=>{m((t=>{const o=null!=e?e:!t[n],i=G(n,o,t,u);return r().then((()=>{for(const n in t){const e=v.current[n];e&&t[n]!=i[n]&&e(i[n])}})),i}))}),[u]),$=b(((n,e)=>{var t;return null!==(t=s[n])&&void 0!==t?t:e}),[s]),E=b((n=>{if(n)n in s&&I(n);else if(!u)for(const n in s)I(n)}),[s,I,u]),Y=b((n=>{if(n)$(n,!0)||I(n);else if(!u)for(const n in s)$(n,!0)||I(n)}),[s,I,$,u]),C=b((n=>{if(n)$(n,!1)&&I(n);else for(const n in s)$(n,!1)&&I(n)}),[s,I,$]);g(e,(()=>({toggle:E,expand:Y,collapse:C})),[E,C,Y]);const M=y((()=>({registerSection:w,toggleExpanded:I,isExpanded:$,animate:t,prefix:O})),[w,I,$,t,O]);return p(o,c({id:l},d),p(T.Provider,{value:M},i))}));function G(n,e,t,r){let o;if(r&&e){o={[n]:e};for(const e in t)e!=n&&(o[e]=!1)}else o=c(c({},t),{},{[n]:e});return o}function J(n){let{animate:e=!1,as:t="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,L);const[f]=x(B),s=u||f,[h]=x(D),[g,S]=x(i),[O,w]=x(null),[I,$]=x(null),{animate:E,isExpanded:Y,prefix:C,registerSection:M,toggleExpanded:k}=m(T),z=Y?Y(s,i):g,H=null!=E?E:e,N=O||`${C||"a"}-content-${s}-${h}`,P=I||`${C||"a"}-header-${s}-${h}`,A=j(null);A.current=l,v((()=>{if(M)return M(s,i,A)}),[M,s,i]);const Z=b((n=>{k?k(s,n):S((e=>{const t=null!=n?n:!e;return r().then((()=>{const n=A.current;n&&n(t)})),t}))}),[s,k]),q=y((()=>({animate:H,contentId:N,headerId:P,expanded:z,toggleHandler:Z,setContentId:w,setHeaderId:$})),[H,N,P,z,Z]);return p(t,c({},d),p(W.Provider,{value:q},o))}function K(n){let e="className",{as:r="div",children:o,id:i,role:u="button",[e]:l=""}=n,d=a(n,["as","children","id","role",e].map(t));const{contentId:f,expanded:s,headerId:b,setHeaderId:h,toggleHandler:g}=m(W);return v((()=>{h&&h(i)}),[h,i]),p(r,c(c({},d),{},{id:b,role:u,className:`${l} section-child-76fac82 header-76fac82`,tabIndex:E(d),"aria-controls":f,onClick:()=>g(),"aria-expanded":String(s)}),o)}function Q(n){let e="className",{as:r="div",children:o,id:i,role:u="region",[e]:l=""}=n,d=a(n,["as","children","id","role",e].map(t));const f=j(null),s=j(!1),{animate:b,contentId:g,expanded:y,headerId:x,setContentId:S}=m(W);return h((()=>(s.current=!0,()=>s.current=!1)),[]),v((()=>{S&&S(i)}),[S,i]),v((()=>{const n=s.current,e=f.current;if(b&&n&&e&&e.animate)return y?function(n){return N(n,(()=>{const e=k(n,"height"),t=k(n,"opacity"),r=k(n,"overflowY");z(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;z(n,{height:e,opacity:t,overflowY:r});const i=P(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})}))}(e):function(n){return N(n,(()=>{const e=n.offsetHeight,t=P(e);return n.animate([{height:e+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(e)}),[y,b]),p(O,{renderable:y},p(r,c(c({},d),{},{ref:f,className:l+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:g,"aria-labelledby":x,role:u}),o))}F.displayName="Accordion";export{F as BentoAccordion,Q as BentoAccordionContent,K as BentoAccordionHeader,J as BentoAccordionSection}; | ||
//# sourceMappingURL=component-react.module.js.map |
{ | ||
"name": "@bentoproject/accordion", | ||
"version": "1.2204160405.0", | ||
"version": "1.2204182206.0", | ||
"description": "Displays content sections that can be collapsed and expanded.", | ||
@@ -31,4 +31,5 @@ "author": "Bento Authors", | ||
"dist/*", | ||
"react.js", | ||
"styles.css" | ||
"styles.css", | ||
"preact", | ||
"react" | ||
], | ||
@@ -46,4 +47,4 @@ "repository": { | ||
"dependencies": { | ||
"@bentoproject/core": "0.2204160405.0" | ||
"@bentoproject/core": "0.2204182206.0" | ||
} | ||
} |
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
744608
31
+ Added@bentoproject/core@0.2204182206.0(transitive)
- Removed@bentoproject/core@0.2204160405.0(transitive)