mottled-library
Advanced tools
Comparing version 0.0.11-beta2 to 0.0.11-beta3
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e);const n=e.createContext({activeItem:"",setToggle:e=>{console.log(e)}}),l=({value:t,title:l,children:o,titleClass:s,contentClass:c,status:r})=>{const{activeItem:i,setToggle:d}=(()=>{const t=e.useContext(n);if(!t)throw new Error("No context found for Accordion");return t})(),u=i===t;return a.default.createElement("div",{className:r&&`_mottled_item__${r}`},a.default.createElement("button",{className:"_mottled_item_title ".concat(""+(!u||"single"!==r&&"last"!==r?"":"content_closed ")).concat(s||""),"aria-controls":`${t}-panel`,"aria-disabled":"false","aria-expanded":u,id:`${t}-header`,onClick:()=>d(t),type:"button",value:t},l),a.default.createElement("section",{className:"_mottled_item_content ".concat(""+(!u||"single"!==r&&"last"!==r?"":"content_expanded ")).concat(c||""),"aria-hidden":!u,"aria-labelledby":`${t}-header`,hidden:!u},o))};exports.Accordion=({titles:t,contents:o,defaultExpanded:s,titleClass:c,contentClass:r})=>{const[i,d]=e.useState(null==s?void 0:s.toString()),u=e.useCallback((e=>{d((()=>i!==e?e:""))}),[d,i]),m=e.useMemo((()=>({activeItem:i,setToggle:u,defaultExpanded:s})),[u,i,s]);return t.length!==o.length?(console.error("Titles do not have same length as contents."),a.default.createElement("div",null,"Titles given do not have same length as contents. Please check the input parameters.")):a.default.createElement(n.Provider,{value:m},t.map(((e,n)=>{const s=1===t.length?"single":0===n?"first":n===(null==t?void 0:t.length)-1?"last":void 0;return a.default.createElement(l,{title:e,value:n.toString(),titleClass:c,contentClass:r,status:s},o[n])})))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e);const n=e.createContext({activeItem:"",setToggle:e=>{console.log(e)}}),l=({value:t,title:l,children:o,titleClass:s,contentClass:c,status:r})=>{const{activeItem:i,setToggle:d}=(()=>{const t=e.useContext(n);if(!t)throw new Error("No context found for Accordion");return t})(),u=i===t;return a.default.createElement("div",{className:r&&`_mottled_item _mi__${r}`},a.default.createElement("button",{className:"_mottled_item_title ".concat(""+(!u||"single"!==r&&"last"!==r?"":"content_closed ")).concat(s||""),"aria-controls":`${t}-panel`,"aria-disabled":"false","aria-expanded":u,id:`${t}-header`,onClick:()=>d(t),type:"button",value:t},l),a.default.createElement("section",{className:"_mottled_item_content ".concat(""+(!u||"single"!==r&&"last"!==r?"":"content_expanded ")).concat(c||""),"aria-hidden":!u,"aria-labelledby":`${t}-header`,hidden:!u},o))};exports.Accordion=({titles:t,contents:o,defaultExpanded:s,titleClass:c,contentClass:r})=>{const[i,d]=e.useState(null==s?void 0:s.toString()),u=e.useCallback((e=>{d((()=>i!==e?e:""))}),[d,i]),m=e.useMemo((()=>({activeItem:i,setToggle:u,defaultExpanded:s})),[u,i,s]);return t.length!==o.length?(console.error("Titles do not have same length as contents."),a.default.createElement("div",null,"Titles given do not have same length as contents. Please check the input parameters.")):a.default.createElement(n.Provider,{value:m},t.map(((e,n)=>{const s=1===t.length?"single":0===n?"first":n===(null==t?void 0:t.length)-1?"last":void 0;return a.default.createElement(l,{title:e,value:n.toString(),titleClass:c,contentClass:r,status:s},o[n])})))}; |
{ | ||
"name": "mottled-library", | ||
"version": "0.0.11-beta2", | ||
"version": "0.0.11-beta3", | ||
"author": "Parity Team <admin@parity.io>", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
Sorry, the diff of this file is not supported yet
4045352