neatkit 0.13.5 → 0.13.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Markdown.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),M=require("react"),G=require("react-markdown"),W=require("rehype-raw"),H=require("rehype-sanitize"),V=require("rehype-slug"),J=require("remark-gfm"),Y=require("./Alert-LJDkNUqH.cjs"),X=require("./Code-f0GWveGp.cjs"),Q=require("./Divider-C7XGlr26.cjs"),_=require("./Table-D99tLXpo.cjs"),k=require("./Text-DWYlIcPj.cjs"),Z={bash:"Shell",c:"C","c++":"C++",cpp:"C++",css:"CSS",go:"Go",golang:"Go",html:"HTML",js:"JavaScript",javascript:"JavaScript",jsx:"JavaScript",json:"JSON",markdown:"Markdown",md:"Markdown",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",rs:"Rust",rust:"Rust",sh:"Shell",shell:"Shell",sql:"SQL",ts:"TypeScript",tsx:"TypeScript",typescript:"TypeScript",xml:"HTML",yaml:"YAML",yml:"YAML"};function ee(e){var a;const o=(a=e==null?void 0:e.split(/\s+/).find(f=>f.startsWith("language-")))==null?void 0:a.slice(9).toLowerCase();return o?Z[o]:void 0}const A="md-",B=["a","blockquote","br","code","del","em","h1","h2","h3","h4","h5","h6","hr","img","input","li","ol","p","picture","pre","section","source","strong","sup","table","tbody","td","th","thead","tr","ul"],ne={...H.defaultSchema,allowComments:!1,allowDoctypes:!1,ancestors:{...H.defaultSchema.ancestors,source:["picture"]},attributes:{"*":["dir","id","lang","title"],a:["ariaDescribedBy","ariaLabel","dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href","hrefLang"],code:[["className",/^language-[\w+-]+$/]],h2:[["className","sr-only"]],img:["alt","height","src","srcSet","width"],input:["checked",["disabled",!0],"readOnly",["type","checkbox"]],li:[["className","task-list-item"]],ol:["start",["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],source:["media","srcSet","type"],td:["align","colSpan","rowSpan"],th:["align","colSpan","rowSpan","scope"],ul:[["className","contains-task-list"]]},clobber:H.defaultSchema.clobber,clobberPrefix:A,strip:["script","style"],tagNames:[...B]};function re(e,o){const a=o.flags.replace(/[gy]/g,"");return new RegExp(o.source,a).test(e)}function te(e){if(!e)return null;try{const o=new URL(e);return o.protocol!=="http:"&&o.protocol!=="https:"||o.username||o.password?null:o}catch{return null}}function R(e,o,a){if(e.includes("\\")||/[\u0000-\u0020\u007f]/.test(e)||o===void 0)return;const f=/^[a-z][a-z\d+.-]*:/i.test(e),m=e.startsWith("//");if(o==="*")return!f&&!m||/^https?:/i.test(e)||m?e:void 0;const s=Array.isArray(o)?o:[o],t=te(a);try{let n=null;if(f?n=new URL(e):t&&(n=new URL(e,t)),!n||n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password)return;const r=n.href;return s.some(c=>re(r,c))?r:void 0}catch{return}}function v(e,o,a){if(!e)return;const m=e.split(",").map(s=>{const t=s.trim().split(/\s+/),[n,r]=t,u=r===void 0||/^(?:\d+w|(?:\d+(?:\.\d+)?|\.\d+)x)$/.test(r);if(t.length>2||!u||n===void 0||n.length===0)return null;const c=R(n,o,a);return c?`${c}${r?` ${r}`:""}`:null});if(!m.some(s=>s===null))return m.join(", ")}function oe(){function e(o){o.children=o.children.filter(a=>a.type!=="element"||a.tagName!=="input"||a.position===void 0),o.children.forEach(a=>{a.type==="element"&&e(a)})}return o=>e(o)}function S(e,o){return Array.isArray(e)?e.map(a=>typeof a=="string"?`${o}${a}`:a):typeof e=="string"?e.split(/\s+/).map(a=>`${o}${a}`).join(" "):e}function se(e){const{clobberPrefix:o,prefix:a}=e;function f(m){if(m.type==="element"){const{properties:s}=m;s.id=S(s.id,a),s.name=S(s.name,a),s.ariaDescribedBy=S(s.ariaDescribedBy,a),s.ariaLabelledBy=S(s.ariaLabelledBy,a),typeof s.href=="string"&&s.href.startsWith("#")&&(s.href=`#${o}${a}${s.href.slice(1)}`)}"children"in m&&m.children.forEach(f)}return m=>f(m)}function C(e){return e==="center"||e==="left"||e==="right"?e:void 0}function E(e){return e.type==="text"?e.value:"children"in e?e.children.map(E).join(""):""}function T(e){return typeof e=="string"?e:void 0}function ie(e){if(!e)return null;const o=e.children.find(n=>n.type==="element"&&n.tagName==="code");if(!o||e.children.some(n=>n!==o&&(n.type!=="text"||n.value.trim().length>0)))return null;const f=o.properties.className;let m;Array.isArray(f)?m=f.join(" "):typeof f=="string"&&(m=f);const s=o.children.map(E).join("").replace(/\n$/,"");return{codeProps:{className:m,dir:T(o.properties.dir),id:T(o.properties.id),lang:T(o.properties.lang),title:T(o.properties.title)},content:s}}function ae(e,o,a,f,m){return{a:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("a",{...i,className:["nk-markdown__link",r].filter(Boolean).join(" "),onClick:m,children:n})},blockquote:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx("blockquote",{...c,className:"nk-markdown__blockquote",children:n})},code:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("code",{...i,className:["nk-markdown__inline-code",r].filter(Boolean).join(" "),children:n})},h1:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h1",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"heading",weight:"semibold",children:n})},h2:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h2",className:["nk-markdown__heading",r!=null&&r.split(/\s+/).includes("sr-only")?"nk-markdown__visually-hidden":void 0].filter(Boolean).join(" "),size:"title",weight:"semibold",children:n})},h3:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h3",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"subtitle",weight:"semibold",children:n})},h4:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h4",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h5:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h5",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h6:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h6",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"medium",children:n})},hr:function(t){const{dangerouslySetInnerHTML:n,node:r,...u}=t;return d.jsx(Q.Divider,{...u})},img:function(t){const{alt:n,className:r,dangerouslySetInnerHTML:u,node:c,src:i,srcSet:l,...b}=t,x=R(typeof i=="string"?i:"",e,o),L=v(l,e,o);return x?d.jsx("img",{...b,alt:n??"",className:["nk-markdown__image",r].filter(Boolean).join(" "),decoding:"async",loading:"lazy",src:x,srcSet:L}):n?d.jsx("span",{className:"nk-markdown__blocked-image",children:n}):null},input:function(t){const{checked:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsxs(d.Fragment,{children:[d.jsx("input",{...i,"aria-label":n?"Completed task":"Incomplete task",checked:n,className:["nk-markdown__task-control","nk-markdown__visually-hidden",r].filter(Boolean).join(" "),disabled:!0,readOnly:!0,type:"checkbox"}),d.jsx("span",{"aria-hidden":"true",className:"nk-markdown__task",children:n?"☒":"☐"})]})},li:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("task-list-item"))??!1;return d.jsx("li",{...i,className:["nk-markdown__list-item",l?"nk-markdown__list-item--task":void 0].filter(Boolean).join(" "),children:n})},ol:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ol",{...i,className:["nk-markdown__list","nk-markdown__list--ordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})},p:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,className:["nk-markdown__paragraph",r].filter(Boolean).join(" "),children:n})},picture:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("picture",{...i,className:["nk-markdown__picture",r].filter(Boolean).join(" "),children:n})},pre:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,ref:c,...i}=t,l=ie(u);return l?d.jsx(X.Code,{code:l.content,codeProps:l.codeProps,language:ee(l.codeProps.className),maxHighlightLength:a,maxLineCount:f,preProps:i}):d.jsx("pre",{...i,children:n})},source:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,srcSet:c,...i}=t,l=v(c,e,o);return l?d.jsx("source",{...i,srcSet:l}):null},table:function(t){const{children:n,dangerouslySetInnerHTML:r,frame:u,node:c,...i}=t;return d.jsx(_.Table,{...i,children:n})},tbody:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Body,{...c,children:n})},td:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.Cell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},th:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.HeaderCell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},thead:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Head,{...c,children:n})},tr:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,onClick:c,...i}=t;return d.jsx(_.Table.Row,{...i,children:n})},ul:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ul",{...i,className:["nk-markdown__list","nk-markdown__list--unordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})}}}const le={clobberPrefix:""},ce=25e3,de="Markdown content exceeds the rendering limit.";function ue(e,o){if(!e.startsWith("#")||e.length===1)return null;let a=e.slice(1);try{a=decodeURIComponent(a)}catch{return null}return o.getElementById(a)}function me(e){const o=e.tabIndex<0&&!e.hasAttribute("tabindex");if(o&&e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),!!o){if(e.ownerDocument.activeElement!==e){e.removeAttribute("tabindex");return}e.addEventListener("blur",()=>e.removeAttribute("tabindex"),{once:!0})}}function fe(e,o){const a=e,f=new a.HashChangeEvent("hashchange",{newURL:e.location.href,oldURL:o});e.dispatchEvent(f)}function he(e){return e===null?null:Number.isFinite(e)?Math.max(0,Math.floor(e)):0}const pe=M.forwardRef(function(o,a){const{allowedImageSources:f,anchorPrefix:m="",className:s,content:t,dangerouslySetInnerHTML:n,imageBaseUrl:r,maxCodeHighlightLength:u,maxCodeLineCount:c,maxContentLength:i=ce,rehypePlugins:l,remarkPlugins:b,scrollOffset:g=128,style:x,...L}=o,P=he(i),D=P!==null&&t.length>P,j=M.useCallback(h=>{var N;if(h.defaultPrevented||h.button!==0||h.metaKey||h.ctrlKey||h.shiftKey||h.altKey)return;const y=h.currentTarget.getAttribute("href");if(!y)return;const w=ue(y,h.currentTarget.ownerDocument);if(!w||typeof w.scrollIntoView!="function")return;const p=w.ownerDocument.defaultView;if(!p)return;h.preventDefault();const z=((N=p.matchMedia)==null?void 0:N.call(p,"(prefers-reduced-motion: reduce)").matches)??!1,F=g===null||z?"auto":"smooth",U=p.location.href,K=p.location.hash!==y;p.location.hash!==y&&p.history.pushState(p.history.state,"",y),me(w),w.scrollIntoView({behavior:F,block:"start"}),K&&fe(p,U)},[g]),O=M.useMemo(()=>ae(f,r,u,c,j),[f,j,r,u,c]),q=M.useMemo(()=>[J,...b??[]],[b]),$=M.useMemo(()=>[W,...l??[],oe,V,[se,{clobberPrefix:A,prefix:m}],[H,ne]],[m,l]),I={...x};if(g!==null){const h=Number.isFinite(g)?Math.max(0,g):0;I["--nk-markdown-scroll-offset"]=`${h}px`}return d.jsx("div",{...L,ref:a,className:["nk-markdown",s].filter(Boolean).join(" "),style:I,children:D?d.jsx(Y.Alert,{role:"alert",tone:"warning",children:de}):d.jsx(G,{allowedElements:B,components:O,rehypePlugins:$,remarkPlugins:q,remarkRehypeOptions:le,children:t})})});exports.default=pe;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),M=require("react"),G=require("react-markdown"),W=require("rehype-raw"),H=require("rehype-sanitize"),V=require("rehype-slug"),J=require("remark-gfm"),Y=require("./Alert-LJDkNUqH.cjs"),X=require("./Code-f0GWveGp.cjs"),Q=require("./Divider-C7XGlr26.cjs"),_=require("./Table-CV7YUKzw.cjs"),k=require("./Text-DWYlIcPj.cjs"),Z={bash:"Shell",c:"C","c++":"C++",cpp:"C++",css:"CSS",go:"Go",golang:"Go",html:"HTML",js:"JavaScript",javascript:"JavaScript",jsx:"JavaScript",json:"JSON",markdown:"Markdown",md:"Markdown",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",rs:"Rust",rust:"Rust",sh:"Shell",shell:"Shell",sql:"SQL",ts:"TypeScript",tsx:"TypeScript",typescript:"TypeScript",xml:"HTML",yaml:"YAML",yml:"YAML"};function ee(e){var a;const o=(a=e==null?void 0:e.split(/\s+/).find(f=>f.startsWith("language-")))==null?void 0:a.slice(9).toLowerCase();return o?Z[o]:void 0}const A="md-",B=["a","blockquote","br","code","del","em","h1","h2","h3","h4","h5","h6","hr","img","input","li","ol","p","picture","pre","section","source","strong","sup","table","tbody","td","th","thead","tr","ul"],ne={...H.defaultSchema,allowComments:!1,allowDoctypes:!1,ancestors:{...H.defaultSchema.ancestors,source:["picture"]},attributes:{"*":["dir","id","lang","title"],a:["ariaDescribedBy","ariaLabel","dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href","hrefLang"],code:[["className",/^language-[\w+-]+$/]],h2:[["className","sr-only"]],img:["alt","height","src","srcSet","width"],input:["checked",["disabled",!0],"readOnly",["type","checkbox"]],li:[["className","task-list-item"]],ol:["start",["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],source:["media","srcSet","type"],td:["align","colSpan","rowSpan"],th:["align","colSpan","rowSpan","scope"],ul:[["className","contains-task-list"]]},clobber:H.defaultSchema.clobber,clobberPrefix:A,strip:["script","style"],tagNames:[...B]};function re(e,o){const a=o.flags.replace(/[gy]/g,"");return new RegExp(o.source,a).test(e)}function te(e){if(!e)return null;try{const o=new URL(e);return o.protocol!=="http:"&&o.protocol!=="https:"||o.username||o.password?null:o}catch{return null}}function R(e,o,a){if(e.includes("\\")||/[\u0000-\u0020\u007f]/.test(e)||o===void 0)return;const f=/^[a-z][a-z\d+.-]*:/i.test(e),m=e.startsWith("//");if(o==="*")return!f&&!m||/^https?:/i.test(e)||m?e:void 0;const s=Array.isArray(o)?o:[o],t=te(a);try{let n=null;if(f?n=new URL(e):t&&(n=new URL(e,t)),!n||n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password)return;const r=n.href;return s.some(c=>re(r,c))?r:void 0}catch{return}}function v(e,o,a){if(!e)return;const m=e.split(",").map(s=>{const t=s.trim().split(/\s+/),[n,r]=t,u=r===void 0||/^(?:\d+w|(?:\d+(?:\.\d+)?|\.\d+)x)$/.test(r);if(t.length>2||!u||n===void 0||n.length===0)return null;const c=R(n,o,a);return c?`${c}${r?` ${r}`:""}`:null});if(!m.some(s=>s===null))return m.join(", ")}function oe(){function e(o){o.children=o.children.filter(a=>a.type!=="element"||a.tagName!=="input"||a.position===void 0),o.children.forEach(a=>{a.type==="element"&&e(a)})}return o=>e(o)}function S(e,o){return Array.isArray(e)?e.map(a=>typeof a=="string"?`${o}${a}`:a):typeof e=="string"?e.split(/\s+/).map(a=>`${o}${a}`).join(" "):e}function se(e){const{clobberPrefix:o,prefix:a}=e;function f(m){if(m.type==="element"){const{properties:s}=m;s.id=S(s.id,a),s.name=S(s.name,a),s.ariaDescribedBy=S(s.ariaDescribedBy,a),s.ariaLabelledBy=S(s.ariaLabelledBy,a),typeof s.href=="string"&&s.href.startsWith("#")&&(s.href=`#${o}${a}${s.href.slice(1)}`)}"children"in m&&m.children.forEach(f)}return m=>f(m)}function C(e){return e==="center"||e==="left"||e==="right"?e:void 0}function E(e){return e.type==="text"?e.value:"children"in e?e.children.map(E).join(""):""}function T(e){return typeof e=="string"?e:void 0}function ie(e){if(!e)return null;const o=e.children.find(n=>n.type==="element"&&n.tagName==="code");if(!o||e.children.some(n=>n!==o&&(n.type!=="text"||n.value.trim().length>0)))return null;const f=o.properties.className;let m;Array.isArray(f)?m=f.join(" "):typeof f=="string"&&(m=f);const s=o.children.map(E).join("").replace(/\n$/,"");return{codeProps:{className:m,dir:T(o.properties.dir),id:T(o.properties.id),lang:T(o.properties.lang),title:T(o.properties.title)},content:s}}function ae(e,o,a,f,m){return{a:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("a",{...i,className:["nk-markdown__link",r].filter(Boolean).join(" "),onClick:m,children:n})},blockquote:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx("blockquote",{...c,className:"nk-markdown__blockquote",children:n})},code:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("code",{...i,className:["nk-markdown__inline-code",r].filter(Boolean).join(" "),children:n})},h1:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h1",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"heading",weight:"semibold",children:n})},h2:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h2",className:["nk-markdown__heading",r!=null&&r.split(/\s+/).includes("sr-only")?"nk-markdown__visually-hidden":void 0].filter(Boolean).join(" "),size:"title",weight:"semibold",children:n})},h3:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h3",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"subtitle",weight:"semibold",children:n})},h4:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h4",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h5:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h5",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h6:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h6",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"medium",children:n})},hr:function(t){const{dangerouslySetInnerHTML:n,node:r,...u}=t;return d.jsx(Q.Divider,{...u})},img:function(t){const{alt:n,className:r,dangerouslySetInnerHTML:u,node:c,src:i,srcSet:l,...b}=t,x=R(typeof i=="string"?i:"",e,o),L=v(l,e,o);return x?d.jsx("img",{...b,alt:n??"",className:["nk-markdown__image",r].filter(Boolean).join(" "),decoding:"async",loading:"lazy",src:x,srcSet:L}):n?d.jsx("span",{className:"nk-markdown__blocked-image",children:n}):null},input:function(t){const{checked:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsxs(d.Fragment,{children:[d.jsx("input",{...i,"aria-label":n?"Completed task":"Incomplete task",checked:n,className:["nk-markdown__task-control","nk-markdown__visually-hidden",r].filter(Boolean).join(" "),disabled:!0,readOnly:!0,type:"checkbox"}),d.jsx("span",{"aria-hidden":"true",className:"nk-markdown__task",children:n?"☒":"☐"})]})},li:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("task-list-item"))??!1;return d.jsx("li",{...i,className:["nk-markdown__list-item",l?"nk-markdown__list-item--task":void 0].filter(Boolean).join(" "),children:n})},ol:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ol",{...i,className:["nk-markdown__list","nk-markdown__list--ordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})},p:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,className:["nk-markdown__paragraph",r].filter(Boolean).join(" "),children:n})},picture:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("picture",{...i,className:["nk-markdown__picture",r].filter(Boolean).join(" "),children:n})},pre:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,ref:c,...i}=t,l=ie(u);return l?d.jsx(X.Code,{code:l.content,codeProps:l.codeProps,language:ee(l.codeProps.className),maxHighlightLength:a,maxLineCount:f,preProps:i}):d.jsx("pre",{...i,children:n})},source:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,srcSet:c,...i}=t,l=v(c,e,o);return l?d.jsx("source",{...i,srcSet:l}):null},table:function(t){const{children:n,dangerouslySetInnerHTML:r,frame:u,node:c,...i}=t;return d.jsx(_.Table,{...i,children:n})},tbody:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Body,{...c,children:n})},td:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.Cell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},th:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.HeaderCell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},thead:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Head,{...c,children:n})},tr:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,onClick:c,...i}=t;return d.jsx(_.Table.Row,{...i,children:n})},ul:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ul",{...i,className:["nk-markdown__list","nk-markdown__list--unordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})}}}const le={clobberPrefix:""},ce=25e3,de="Markdown content exceeds the rendering limit.";function ue(e,o){if(!e.startsWith("#")||e.length===1)return null;let a=e.slice(1);try{a=decodeURIComponent(a)}catch{return null}return o.getElementById(a)}function me(e){const o=e.tabIndex<0&&!e.hasAttribute("tabindex");if(o&&e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),!!o){if(e.ownerDocument.activeElement!==e){e.removeAttribute("tabindex");return}e.addEventListener("blur",()=>e.removeAttribute("tabindex"),{once:!0})}}function fe(e,o){const a=e,f=new a.HashChangeEvent("hashchange",{newURL:e.location.href,oldURL:o});e.dispatchEvent(f)}function he(e){return e===null?null:Number.isFinite(e)?Math.max(0,Math.floor(e)):0}const pe=M.forwardRef(function(o,a){const{allowedImageSources:f,anchorPrefix:m="",className:s,content:t,dangerouslySetInnerHTML:n,imageBaseUrl:r,maxCodeHighlightLength:u,maxCodeLineCount:c,maxContentLength:i=ce,rehypePlugins:l,remarkPlugins:b,scrollOffset:g=128,style:x,...L}=o,P=he(i),D=P!==null&&t.length>P,j=M.useCallback(h=>{var N;if(h.defaultPrevented||h.button!==0||h.metaKey||h.ctrlKey||h.shiftKey||h.altKey)return;const y=h.currentTarget.getAttribute("href");if(!y)return;const w=ue(y,h.currentTarget.ownerDocument);if(!w||typeof w.scrollIntoView!="function")return;const p=w.ownerDocument.defaultView;if(!p)return;h.preventDefault();const z=((N=p.matchMedia)==null?void 0:N.call(p,"(prefers-reduced-motion: reduce)").matches)??!1,F=g===null||z?"auto":"smooth",U=p.location.href,K=p.location.hash!==y;p.location.hash!==y&&p.history.pushState(p.history.state,"",y),me(w),w.scrollIntoView({behavior:F,block:"start"}),K&&fe(p,U)},[g]),O=M.useMemo(()=>ae(f,r,u,c,j),[f,j,r,u,c]),q=M.useMemo(()=>[J,...b??[]],[b]),$=M.useMemo(()=>[W,...l??[],oe,V,[se,{clobberPrefix:A,prefix:m}],[H,ne]],[m,l]),I={...x};if(g!==null){const h=Number.isFinite(g)?Math.max(0,g):0;I["--nk-markdown-scroll-offset"]=`${h}px`}return d.jsx("div",{...L,ref:a,className:["nk-markdown",s].filter(Boolean).join(" "),style:I,children:D?d.jsx(Y.Alert,{role:"alert",tone:"warning",children:de}):d.jsx(G,{allowedElements:B,components:O,rehypePlugins:$,remarkPlugins:q,remarkRehypeOptions:le,children:t})})});exports.default=pe;
package/dist/Markdown.js CHANGED
@@ -9,7 +9,7 @@ import ee from "remark-gfm";
9
9
  import { A as ne } from "./Alert-DQ5CCE0N.js";
10
10
  import { C as re } from "./Code-pROJjsiG.js";
11
11
  import { D as te } from "./Divider-DZgpYpr-.js";
12
- import { T as _ } from "./Table-BJr_ALL8.js";
12
+ import { T as _ } from "./Table-DGWYiRfU.js";
13
13
  import { T as k } from "./Text-rN6iDo0V.js";
14
14
  const oe = {
15
15
  bash: "Shell",
@@ -0,0 +1 @@
1
+ "use client";"use strict";const o=require("react/jsx-runtime"),a=require("react"),H=require("./reference-C2guRuR0.cjs"),D=require("./Surface-BttJYSDt.cjs"),K=require("./Button-CTzvBhGH.cjs"),O=require("./Tooltip-CxcO3Vu-.cjs"),v=a.createContext("body"),w=a.forwardRef(function(l,e){const{align:t="left",children:s,className:i,scope:c="col",sticky:b=!1,...d}=l;return o.jsx("th",{...d,ref:e,className:["nk-table__header-cell",i].filter(Boolean).join(" "),"data-align":t,"data-sticky":b||void 0,scope:c,children:s})});function S(n){for(const l of a.Children.toArray(n)){if(a.isValidElement(l)&&l.type===a.Fragment){if(S(l.props.children))return!0;continue}return!0}return!1}function F(n){const{"aria-label":l,icon:e,label:t,...s}=n;return o.jsx(O.Tooltip2,{content:t,children:o.jsx(K.Button,{...s,"aria-label":l??t,icon:e,shape:"rectangle",size:"small",type:"button",variant:"ghost"})})}function P(n){const{actions:l}=n;function e(t){t.stopPropagation()}return o.jsx("td",{className:"nk-table__cell nk-table__action-cell","data-align":"right",onClick:e,children:l.length>0?o.jsx("span",{className:"nk-table__action-list",children:l.map(t=>a.createElement(F,{...t,key:t.label}))}):null})}const q=a.forwardRef(function(l,e){const{children:t,className:s,emptyColumnCount:i=1,emptyMessage:c,...b}=l,d=!S(t),h=Number.isFinite(i)?Math.max(1,Math.floor(i)):1;return o.jsx("tbody",{...b,ref:e,className:["nk-table__body",s].filter(Boolean).join(" "),children:d&&c!==void 0?o.jsxs("tr",{className:"nk-table__row",children:[o.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"}),o.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:h,children:o.jsx("div",{className:"nk-table__empty-content",children:c})}),o.jsx(P,{actions:[]})]}):o.jsx(v.Provider,{value:"body",children:t})})});function z(n,l,e){return n===void 0?l:e?e(n):n instanceof Date?Number.isNaN(n.getTime())?"Invalid Date":n.toISOString().slice(0,10):typeof n=="boolean"?n?"Yes":"No":n}function V(n){if(typeof n=="number"||typeof n=="string")return String(n)}const E=a.forwardRef(function(l,e){const{align:t="left",children:s,className:i,format:c,title:b,truncate:d,value:h,...k}=l,{rowTrigger:r,...u}=k,p=z(h,s,c),f=d===void 0?void 0:{maxWidth:d},_=b??(d===void 0?void 0:V(p));return o.jsxs("td",{...u,ref:e,className:["nk-table__cell",i].filter(Boolean).join(" "),"data-align":t,title:_,children:[(r==null?void 0:r.kind)==="link"&&r.linkProperties?o.jsx("a",{ref:r.reference,"aria-label":r.ariaLabel,className:"nk-table__row-trigger",download:r.linkProperties.download,href:r.linkProperties.href,hrefLang:r.linkProperties.hrefLang,onClick:r.linkProperties.onNavigate,rel:r.linkProperties.rel,target:r.linkProperties.target}):null,(r==null?void 0:r.kind)==="button"?o.jsx("button",{ref:r.reference,"aria-label":r.ariaLabel,className:"nk-table__row-trigger",onClick:r.onClick,type:"button"}):null,d!==void 0?o.jsx("span",{className:"nk-table__truncated-content",style:f,children:p}):p]})}),M=a.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return o.jsx("tfoot",{...i,ref:e,className:["nk-table__foot",s].filter(Boolean).join(" "),children:o.jsx(v.Provider,{value:"foot",children:t})})}),Y=a.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return o.jsx("thead",{...i,ref:e,className:["nk-table__head",s].filter(Boolean).join(" "),children:o.jsx(v.Provider,{value:"head",children:t})})}),X=["a[href]","audio[controls]","button","iframe","input","label","select","summary","textarea","video[controls]","[contenteditable]:not([contenteditable='false'])"].join(","),$=new Set(["button","checkbox","combobox","grid","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","radiogroup","scrollbar","searchbox","slider","spinbutton","switch","tab","tablist","textbox","tree","treegrid","treeitem"]);function G(n,l){var t;let e=n;for(;e&&e!==l;){if(e.matches(X)||(((t=e.getAttribute("role"))==null?void 0:t.split(/\s+/))??[]).some(i=>$.has(i)))return!0;e=e.parentElement}return!1}function J(n,l){let e=!1;function t(i){return a.Children.map(i,c=>a.isValidElement(c)?c.type===a.Fragment?a.cloneElement(c,void 0,t(c.props.children)):!e&&c.type===E?(e=!0,a.cloneElement(c,{rowTrigger:l})):c:c)}const s=t(n);return{attached:e,content:s}}const Q=a.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return o.jsx(w,{...i,ref:e,align:"right",className:["nk-table__action-header-cell",s].filter(Boolean).join(" "),children:t??o.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),U=a.forwardRef(function(l,e){const{"aria-label":t,actions:s,children:i,className:c,download:b,href:d,hrefLang:h,onClick:k,onNavigate:r,rel:u,target:p,...f}=l,_=a.useRef(null),g=a.useContext(v),j=d!==void 0||k!==void 0,N=(t==null?void 0:t.trim())||(d!==void 0?"Open row":"Activate row");function T(m){_.current=m}let x;d!==void 0?x={ariaLabel:N,kind:"link",linkProperties:{download:b,href:d,hrefLang:h,onNavigate:r,rel:u,target:p},reference:T}:k!==void 0&&(x={ariaLabel:N,kind:"button",onClick:k,reference:T});const B=x?J(i,x):{content:i};function L(m){if(m.defaultPrevented)return;const y=m.target;if(!(y instanceof Element)||G(y,m.currentTarget))return;const C=_.current;if(!C)return;const R=C.ownerDocument.defaultView;if(!R){C.click();return}C.dispatchEvent(new R.MouseEvent("click",{altKey:m.altKey,bubbles:!0,button:m.button,buttons:m.buttons,cancelable:!0,clientX:m.clientX,clientY:m.clientY,ctrlKey:m.ctrlKey,metaKey:m.metaKey,shiftKey:m.shiftKey}))}const A=g==="head"?o.jsx(Q,{}):o.jsx(P,{actions:s??[]}),I=g==="head"?o.jsx("th",{"aria-hidden":"true",className:"nk-table__header-cell nk-table__overscroll-start-cell"}):o.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"});return o.jsxs("tr",{...f,ref:e,"aria-label":j?void 0:t,className:["nk-table__row",c].filter(Boolean).join(" "),"data-interactive":j||void 0,onClick:j?L:void 0,children:[I,B.content,A]})});function W(){const n=a.useRef(null),l=a.useRef(null),[e,t]=a.useState(!1),[s,i]=a.useState(!1);a.useEffect(()=>{const b=n.current,d=l.current;if(!b||!d)return;const h=b,k=d;function r(){const _=h.scrollWidth>h.clientWidth;t(_),_||i(!1)}r();const u=h.ownerDocument.defaultView;u==null||u.addEventListener("resize",r);const p=u==null?void 0:u.ResizeObserver,f=p?new p(r):void 0;return f==null||f.observe(h),f==null||f.observe(k),()=>{u==null||u.removeEventListener("resize",r),f==null||f.disconnect()}},[]);function c(b){i(e&&b.currentTarget.scrollLeft>1)}return{containerReference:n,contentReference:l,isScrollable:e,isScrolled:s,handleScroll:c}}const Z=a.forwardRef(function(l,e){const{"aria-label":t,children:s,className:i,containerClassName:c,frame:b="outline",...d}=l,{containerReference:h,contentReference:k,isScrollable:r,isScrolled:u,handleScroll:p}=W(),f=t?`${t} scroll area`:"Scrollable table",_=a.useCallback(g=>{k.current=g,H.assignElementReference(e,g)},[k,e]);return o.jsx(D.Surface,{ref:h,"aria-label":r?f:void 0,className:["nk-table",c].filter(Boolean).join(" "),"data-frame":b,"data-scrolled":u||void 0,onScroll:p,role:r?"region":void 0,tabIndex:r?0:void 0,children:o.jsx("table",{...d,ref:_,"aria-label":t,className:["nk-table__element",i].filter(Boolean).join(" "),children:s})})}),ee=Object.assign(Z,{Body:q,Cell:E,Foot:M,HeaderCell:w,Head:Y,Row:U});exports.Table=ee;
@@ -0,0 +1,449 @@
1
+ "use client";
2
+ import { jsx as o, jsxs as R } from "react/jsx-runtime";
3
+ import { createContext as V, forwardRef as _, Children as L, isValidElement as j, Fragment as A, createElement as Y, cloneElement as E, useRef as y, useContext as X, useState as B, useEffect as $, useCallback as q } from "react";
4
+ import { a as G } from "./reference-CXMr27nM.js";
5
+ import { S as J } from "./Surface-vEFsZC12.js";
6
+ import { B as Q } from "./Button-CyUpMPtt.js";
7
+ import { T as U } from "./Tooltip-WwAWQ_Kq.js";
8
+ const N = V("body"), I = _(function(l, e) {
9
+ const {
10
+ align: t = "left",
11
+ children: i,
12
+ className: a,
13
+ scope: c = "col",
14
+ sticky: f = !1,
15
+ ...s
16
+ } = l;
17
+ return /* @__PURE__ */ o(
18
+ "th",
19
+ {
20
+ ...s,
21
+ ref: e,
22
+ className: ["nk-table__header-cell", a].filter(Boolean).join(" "),
23
+ "data-align": t,
24
+ "data-sticky": f || void 0,
25
+ scope: c,
26
+ children: i
27
+ }
28
+ );
29
+ });
30
+ function H(n) {
31
+ for (const l of L.toArray(n)) {
32
+ if (j(l) && l.type === A) {
33
+ if (H(l.props.children)) return !0;
34
+ continue;
35
+ }
36
+ return !0;
37
+ }
38
+ return !1;
39
+ }
40
+ function W(n) {
41
+ const {
42
+ "aria-label": l,
43
+ icon: e,
44
+ label: t,
45
+ ...i
46
+ } = n;
47
+ return /* @__PURE__ */ o(U, { content: t, children: /* @__PURE__ */ o(
48
+ Q,
49
+ {
50
+ ...i,
51
+ "aria-label": l ?? t,
52
+ icon: e,
53
+ shape: "rectangle",
54
+ size: "small",
55
+ type: "button",
56
+ variant: "ghost"
57
+ }
58
+ ) });
59
+ }
60
+ function D(n) {
61
+ const { actions: l } = n;
62
+ function e(t) {
63
+ t.stopPropagation();
64
+ }
65
+ return /* @__PURE__ */ o(
66
+ "td",
67
+ {
68
+ className: "nk-table__cell nk-table__action-cell",
69
+ "data-align": "right",
70
+ onClick: e,
71
+ children: l.length > 0 ? /* @__PURE__ */ o("span", { className: "nk-table__action-list", children: l.map((t) => /* @__PURE__ */ Y(W, { ...t, key: t.label })) }) : null
72
+ }
73
+ );
74
+ }
75
+ const Z = _(
76
+ function(l, e) {
77
+ const {
78
+ children: t,
79
+ className: i,
80
+ emptyColumnCount: a = 1,
81
+ emptyMessage: c,
82
+ ...f
83
+ } = l, s = !H(t), m = Number.isFinite(a) ? Math.max(1, Math.floor(a)) : 1;
84
+ return /* @__PURE__ */ o(
85
+ "tbody",
86
+ {
87
+ ...f,
88
+ ref: e,
89
+ className: ["nk-table__body", i].filter(Boolean).join(" "),
90
+ children: s && c !== void 0 ? /* @__PURE__ */ R("tr", { className: "nk-table__row", children: [
91
+ /* @__PURE__ */ o(
92
+ "td",
93
+ {
94
+ "aria-hidden": "true",
95
+ className: "nk-table__cell nk-table__overscroll-start-cell"
96
+ }
97
+ ),
98
+ /* @__PURE__ */ o(
99
+ "td",
100
+ {
101
+ className: "nk-table__cell nk-table__empty-cell",
102
+ colSpan: m,
103
+ children: /* @__PURE__ */ o("div", { className: "nk-table__empty-content", children: c })
104
+ }
105
+ ),
106
+ /* @__PURE__ */ o(D, { actions: [] })
107
+ ] }) : /* @__PURE__ */ o(N.Provider, { value: "body", children: t })
108
+ }
109
+ );
110
+ }
111
+ );
112
+ function ee(n, l, e) {
113
+ return n === void 0 ? l : e ? e(n) : n instanceof Date ? Number.isNaN(n.getTime()) ? "Invalid Date" : n.toISOString().slice(0, 10) : typeof n == "boolean" ? n ? "Yes" : "No" : n;
114
+ }
115
+ function te(n) {
116
+ if (typeof n == "number" || typeof n == "string")
117
+ return String(n);
118
+ }
119
+ const K = _(
120
+ function(l, e) {
121
+ const {
122
+ align: t = "left",
123
+ children: i,
124
+ className: a,
125
+ format: c,
126
+ title: f,
127
+ truncate: s,
128
+ value: m,
129
+ ...h
130
+ } = l, { rowTrigger: r, ...d } = h, p = ee(m, i, c), u = s === void 0 ? void 0 : { maxWidth: s }, k = f ?? (s === void 0 ? void 0 : te(p));
131
+ return /* @__PURE__ */ R(
132
+ "td",
133
+ {
134
+ ...d,
135
+ ref: e,
136
+ className: ["nk-table__cell", a].filter(Boolean).join(" "),
137
+ "data-align": t,
138
+ title: k,
139
+ children: [
140
+ (r == null ? void 0 : r.kind) === "link" && r.linkProperties ? /* @__PURE__ */ o(
141
+ "a",
142
+ {
143
+ ref: r.reference,
144
+ "aria-label": r.ariaLabel,
145
+ className: "nk-table__row-trigger",
146
+ download: r.linkProperties.download,
147
+ href: r.linkProperties.href,
148
+ hrefLang: r.linkProperties.hrefLang,
149
+ onClick: r.linkProperties.onNavigate,
150
+ rel: r.linkProperties.rel,
151
+ target: r.linkProperties.target
152
+ }
153
+ ) : null,
154
+ (r == null ? void 0 : r.kind) === "button" ? /* @__PURE__ */ o(
155
+ "button",
156
+ {
157
+ ref: r.reference,
158
+ "aria-label": r.ariaLabel,
159
+ className: "nk-table__row-trigger",
160
+ onClick: r.onClick,
161
+ type: "button"
162
+ }
163
+ ) : null,
164
+ s !== void 0 ? /* @__PURE__ */ o("span", { className: "nk-table__truncated-content", style: u, children: p }) : p
165
+ ]
166
+ }
167
+ );
168
+ }
169
+ ), ne = _(
170
+ function(l, e) {
171
+ const { children: t, className: i, ...a } = l;
172
+ return /* @__PURE__ */ o(
173
+ "tfoot",
174
+ {
175
+ ...a,
176
+ ref: e,
177
+ className: ["nk-table__foot", i].filter(Boolean).join(" "),
178
+ children: /* @__PURE__ */ o(N.Provider, { value: "foot", children: t })
179
+ }
180
+ );
181
+ }
182
+ ), le = _(
183
+ function(l, e) {
184
+ const { children: t, className: i, ...a } = l;
185
+ return /* @__PURE__ */ o(
186
+ "thead",
187
+ {
188
+ ...a,
189
+ ref: e,
190
+ className: ["nk-table__head", i].filter(Boolean).join(" "),
191
+ children: /* @__PURE__ */ o(N.Provider, { value: "head", children: t })
192
+ }
193
+ );
194
+ }
195
+ ), re = [
196
+ "a[href]",
197
+ "audio[controls]",
198
+ "button",
199
+ "iframe",
200
+ "input",
201
+ "label",
202
+ "select",
203
+ "summary",
204
+ "textarea",
205
+ "video[controls]",
206
+ "[contenteditable]:not([contenteditable='false'])"
207
+ ].join(","), oe = /* @__PURE__ */ new Set([
208
+ "button",
209
+ "checkbox",
210
+ "combobox",
211
+ "grid",
212
+ "link",
213
+ "listbox",
214
+ "menu",
215
+ "menubar",
216
+ "menuitem",
217
+ "menuitemcheckbox",
218
+ "menuitemradio",
219
+ "option",
220
+ "radio",
221
+ "radiogroup",
222
+ "scrollbar",
223
+ "searchbox",
224
+ "slider",
225
+ "spinbutton",
226
+ "switch",
227
+ "tab",
228
+ "tablist",
229
+ "textbox",
230
+ "tree",
231
+ "treegrid",
232
+ "treeitem"
233
+ ]);
234
+ function ae(n, l) {
235
+ var t;
236
+ let e = n;
237
+ for (; e && e !== l; ) {
238
+ if (e.matches(re) || (((t = e.getAttribute("role")) == null ? void 0 : t.split(/\s+/)) ?? []).some((a) => oe.has(a)))
239
+ return !0;
240
+ e = e.parentElement;
241
+ }
242
+ return !1;
243
+ }
244
+ function ie(n, l) {
245
+ let e = !1;
246
+ function t(a) {
247
+ return L.map(a, (c) => j(c) ? c.type === A ? E(
248
+ c,
249
+ void 0,
250
+ t(
251
+ c.props.children
252
+ )
253
+ ) : !e && c.type === K ? (e = !0, E(
254
+ c,
255
+ { rowTrigger: l }
256
+ )) : c : c);
257
+ }
258
+ const i = t(n);
259
+ return { attached: e, content: i };
260
+ }
261
+ const ce = _(function(l, e) {
262
+ const { children: t, className: i, ...a } = l;
263
+ return /* @__PURE__ */ o(
264
+ I,
265
+ {
266
+ ...a,
267
+ ref: e,
268
+ align: "right",
269
+ className: ["nk-table__action-header-cell", i].filter(Boolean).join(" "),
270
+ children: t ?? /* @__PURE__ */ o("span", { className: "nk-table__visually-hidden", children: "Row actions" })
271
+ }
272
+ );
273
+ }), se = _(
274
+ function(l, e) {
275
+ const {
276
+ "aria-label": t,
277
+ actions: i,
278
+ children: a,
279
+ className: c,
280
+ download: f,
281
+ href: s,
282
+ hrefLang: m,
283
+ onClick: h,
284
+ onNavigate: r,
285
+ rel: d,
286
+ target: p,
287
+ ...u
288
+ } = l, k = y(null), g = X(N), T = s !== void 0 || h !== void 0, S = (t == null ? void 0 : t.trim()) || (s !== void 0 ? "Open row" : "Activate row");
289
+ function P(b) {
290
+ k.current = b;
291
+ }
292
+ let v;
293
+ s !== void 0 ? v = {
294
+ ariaLabel: S,
295
+ kind: "link",
296
+ linkProperties: {
297
+ download: f,
298
+ href: s,
299
+ hrefLang: m,
300
+ onNavigate: r,
301
+ rel: d,
302
+ target: p
303
+ },
304
+ reference: P
305
+ } : h !== void 0 && (v = {
306
+ ariaLabel: S,
307
+ kind: "button",
308
+ onClick: h,
309
+ reference: P
310
+ });
311
+ const O = v ? ie(a, v) : { content: a };
312
+ function z(b) {
313
+ if (b.defaultPrevented) return;
314
+ const w = b.target;
315
+ if (!(w instanceof Element) || ae(w, b.currentTarget)) return;
316
+ const C = k.current;
317
+ if (!C) return;
318
+ const x = C.ownerDocument.defaultView;
319
+ if (!x) {
320
+ C.click();
321
+ return;
322
+ }
323
+ C.dispatchEvent(new x.MouseEvent("click", {
324
+ altKey: b.altKey,
325
+ bubbles: !0,
326
+ button: b.button,
327
+ buttons: b.buttons,
328
+ cancelable: !0,
329
+ clientX: b.clientX,
330
+ clientY: b.clientY,
331
+ ctrlKey: b.ctrlKey,
332
+ metaKey: b.metaKey,
333
+ shiftKey: b.shiftKey
334
+ }));
335
+ }
336
+ const F = g === "head" ? /* @__PURE__ */ o(ce, {}) : /* @__PURE__ */ o(D, { actions: i ?? [] }), M = g === "head" ? /* @__PURE__ */ o(
337
+ "th",
338
+ {
339
+ "aria-hidden": "true",
340
+ className: "nk-table__header-cell nk-table__overscroll-start-cell"
341
+ }
342
+ ) : /* @__PURE__ */ o(
343
+ "td",
344
+ {
345
+ "aria-hidden": "true",
346
+ className: "nk-table__cell nk-table__overscroll-start-cell"
347
+ }
348
+ );
349
+ return /* @__PURE__ */ R(
350
+ "tr",
351
+ {
352
+ ...u,
353
+ ref: e,
354
+ "aria-label": T ? void 0 : t,
355
+ className: ["nk-table__row", c].filter(Boolean).join(" "),
356
+ "data-interactive": T || void 0,
357
+ onClick: T ? z : void 0,
358
+ children: [
359
+ M,
360
+ O.content,
361
+ F
362
+ ]
363
+ }
364
+ );
365
+ }
366
+ );
367
+ function de() {
368
+ const n = y(null), l = y(null), [e, t] = B(!1), [i, a] = B(!1);
369
+ $(() => {
370
+ const f = n.current, s = l.current;
371
+ if (!f || !s) return;
372
+ const m = f, h = s;
373
+ function r() {
374
+ const k = m.scrollWidth > m.clientWidth;
375
+ t(k), k || a(!1);
376
+ }
377
+ r();
378
+ const d = m.ownerDocument.defaultView;
379
+ d == null || d.addEventListener("resize", r);
380
+ const p = d == null ? void 0 : d.ResizeObserver, u = p ? new p(r) : void 0;
381
+ return u == null || u.observe(m), u == null || u.observe(h), () => {
382
+ d == null || d.removeEventListener("resize", r), u == null || u.disconnect();
383
+ };
384
+ }, []);
385
+ function c(f) {
386
+ a(e && f.currentTarget.scrollLeft > 1);
387
+ }
388
+ return {
389
+ containerReference: n,
390
+ contentReference: l,
391
+ isScrollable: e,
392
+ isScrolled: i,
393
+ handleScroll: c
394
+ };
395
+ }
396
+ const ue = _(function(l, e) {
397
+ const {
398
+ "aria-label": t,
399
+ children: i,
400
+ className: a,
401
+ containerClassName: c,
402
+ frame: f = "outline",
403
+ ...s
404
+ } = l, {
405
+ containerReference: m,
406
+ contentReference: h,
407
+ isScrollable: r,
408
+ isScrolled: d,
409
+ handleScroll: p
410
+ } = de(), u = t ? `${t} scroll area` : "Scrollable table", k = q(
411
+ (g) => {
412
+ h.current = g, G(e, g);
413
+ },
414
+ [h, e]
415
+ );
416
+ return /* @__PURE__ */ o(
417
+ J,
418
+ {
419
+ ref: m,
420
+ "aria-label": r ? u : void 0,
421
+ className: ["nk-table", c].filter(Boolean).join(" "),
422
+ "data-frame": f,
423
+ "data-scrolled": d || void 0,
424
+ onScroll: p,
425
+ role: r ? "region" : void 0,
426
+ tabIndex: r ? 0 : void 0,
427
+ children: /* @__PURE__ */ o(
428
+ "table",
429
+ {
430
+ ...s,
431
+ ref: k,
432
+ "aria-label": t,
433
+ className: ["nk-table__element", a].filter(Boolean).join(" "),
434
+ children: i
435
+ }
436
+ )
437
+ }
438
+ );
439
+ }), _e = Object.assign(ue, {
440
+ Body: Z,
441
+ Cell: K,
442
+ Foot: ne,
443
+ HeaderCell: I,
444
+ Head: le,
445
+ Row: se
446
+ });
447
+ export {
448
+ _e as T
449
+ };
package/dist/Table.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-D99tLXpo.cjs");exports.default=e.Table;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-CV7YUKzw.cjs");exports.default=e.Table;
package/dist/Table.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { T as a } from "./Table-BJr_ALL8.js";
2
+ import { T as a } from "./Table-DGWYiRfU.js";
3
3
  export {
4
4
  a as default
5
5
  };