2 lines
1.7 KiB
JavaScript
2 lines
1.7 KiB
JavaScript
import{R as e,r as s}from"./index-72c35bf5.js";import{c as i,I as E}from"./ImportSnippet-d5487731.js";import{U as y}from"./chunk-S4VUQJ4A-4afc748a.js";const d=t=>{const a=async l=>{const n=l.wrap?`var(${l.children})`:l.children;await navigator.clipboard.writeText(n),l.setCopied(!0)};return e.createElement("button",{className:"copy-btn",onClick:()=>a(t)},e.createElement("span",{className:"material-symbols-outlined"},"content_copy"),t.children,t.copied&&e.createElement("div",{className:"copy-tag"},"Copied"))},h=t=>{const[a,l]=s.useState(!1);let n;s.useEffect(()=>{n&&clearTimeout(n),n=setTimeout(()=>{l(!1)},1e3)},[a]);const c={...t,copied:a,setCopied:l};return t.column===0?e.createElement("div",{className:"swatch-container"},e.createElement("div",{className:"swatch",style:{backgroundColor:t.children}}),e.createElement("span",null,e.createElement(d,{...c},t.children))):t.children.map(r=>e.createElement("div",{key:r},e.createElement(d,{...c,wrap:!0},r)))},C=t=>e.createElement("td",null,e.createElement(h,{...t},t.children)),b=t=>e.createElement("tr",null,t.children.map((a,l)=>e.createElement(C,{...t,column:l,key:l},a))),f=t=>e.createElement("th",null,t.children),k=({title:t=null,body:a,copyable:l,mdnLink:n=null,included:c=!1,partial:r})=>{const o=["Colour","CSS variable"];return e.createElement(y,null,e.createElement("div",{className:i.title},t),e.createElement(E,{included:c,partial:r}),e.createElement("table",{className:i.table},e.createElement("thead",null,e.createElement("tr",null,o.map(m=>e.createElement(f,{key:m},m)))),e.createElement("tbody",null,a.map((m,u)=>e.createElement(b,{title:t,header:o,body:a,copyable:l,mdnLink:n,key:u},m)))))};export{k as C};
|
|
//# sourceMappingURL=Table-0eb10c75.js.map
|