UNPKG

baig-react-accordion

Version:
2 lines (1 loc) 5.48 kB
import e,{useState as t}from'react';function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:'undefined'!=typeof Symbol&&e[Symbol.iterator]||e['@@iterator'];if(null!=r){var n,o,a,i,c=[],l=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t);else for(;!(l=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);l=!0);}catch(e){s=!0,o=e}finally{try{if(!l&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return c}}(e,t)||function(e,t){if(e){if('string'==typeof e)return r(e,t);var n={}.toString.call(e).slice(8,-1);return'Object'===n&&e.constructor&&(n=e.constructor.name),'Map'===n||'Set'===n?Array.from(e):'Arguments'===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e,t)||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 o(e){return o='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?e=>typeof e:e=>e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e,o(e)}var a={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},i=e.createContext&&e.createContext(a),c=['attr','size','title'];function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(this,arguments)}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((t=>Object.getOwnPropertyDescriptor(e,t).enumerable))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((t=>{d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((t=>{Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){var n;return n=((e,t)=>{if('object'!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||'default');if('object'!=o(n))return n;throw new TypeError('@@toPrimitive must return a primitive value.')}return('string'===t?String:Number)(e)})(t,'string'),(t='symbol'==o(n)?n:n+'')in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(t){return t&&t.map(((t,r)=>e.createElement(t.tag,m({key:r},t.attr),f(t.child))))}function p(t){return r=>e.createElement(y,s({attr:m({},t.attr)},r),f(t.child))}function y(t){var r=function(r){var n,o=t.attr,a=t.size,i=t.title,u=l(t,c),d=a||r.size||'1em';return r.className&&(n=r.className),t.className&&(n=(n?n+' ':'')+t.className),e.createElement('svg',s({stroke:'currentColor',fill:'currentColor',strokeWidth:'0'},r.attr,o,u,{className:n,style:m(m({color:t.color||r.color},r.style),t.style),height:d,width:d,xmlns:'http://www.w3.org/2000/svg'}),i&&e.createElement('title',null,i),t.children)};return void 0!==i?e.createElement(i.Consumer,null,(e=>r(e))):r(a)}function v(e){return p({tag:'svg',attr:{viewBox:'0 0 448 512'},child:[{tag:'path',attr:{d:'M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z'},child:[]}]})(e)}var b=[{id:1,question:'What is the purpose of the Baig React?',answer:'The Baig React is a collection of UI components, styles, and guidelines that ensure consistency and a unified user experience across our products. It simplifies the design and development process by providing ready-to-use components that can be easily customized and integrated into various applications.'},{id:2,question:'How does Baig React improve the development process?',answer:'By using Baig React, developers can quickly build and maintain applications with a consistent look and feel. The reusable components and standardized guidelines help reduce development time and improve collaboration among team members.'},{id:3,question:'What components are included in Baig React?',answer:'Baig React includes a wide range of components such as buttons, forms, modals, navigation bars, and more. Each component is designed to be flexible and easy to customize to fit various use cases and design requirements.'}],h=function(){var r=n(t(null),2),o=r[0],a=r[1];return e.createElement('div',{className:'accordion'},e.createElement('div',{className:'container'},b.map((t=>e.createElement('div',{key:t.id,className:'accordion-box'},e.createElement('div',{className:'accordion-header',onClick:function(){return e=t.id,void a(o===e?null:e);var e}},e.createElement('h3',{className:'accordion-question'},t.question),e.createElement(v,{className:'icon'})),o===t.id&&e.createElement('p',{className:'accordion-answer'},t.answer))))))};export{h as Accordion};