neatkit 0.18.0 → 0.18.2
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 +1 -1
- package/dist/Markdown.js +1 -1
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +2 -2
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +2 -2
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +1 -1
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +3 -3
- package/dist/{Table-DTxKbMgJ.cjs → Table-CJmczuqs.cjs} +1 -1
- package/dist/{Table-CURYs469.js → Table-DL02k8n8.js} +1 -1
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/{Tooltip-tzVg8Bky.cjs → Tooltip-DhSawjGg.cjs} +1 -1
- package/dist/{Tooltip-BuRMZ4p_.js → Tooltip-DiGwnVOH.js} +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/components/Modal/Modal.d.ts +4 -1
- package/dist/style.css +1 -1
- package/dist/{useFocusTrap-BL3fDmTs.js → useFocusTrap-BnreoiCP.js} +1 -1
- package/dist/{useFocusTrap-C--8mnsI.cjs → useFocusTrap-C2Iw9BGP.cjs} +1 -1
- package/dist/usePresence-DrCnSPkG.js +235 -0
- package/dist/usePresence-WXhrarsC.cjs +1 -0
- package/package.json +1 -1
- package/dist/usePresence-BYnWctTh.js +0 -232
- package/dist/usePresence-HVr855AK.cjs +0 -1
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-DTxKbMgJ.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","b","blockquote","br","code","del","details","em","h1","h2","h3","h4","h5","h6","hr","img","input","li","ol","p","picture","pre","section","source","strong","summary","sup","table","tbody","td","th","thead","tr","ul"],ne={...H.defaultSchema,allowComments:!1,allowDoctypes:!1,ancestors:{...H.defaultSchema.ancestors,source:["picture"],summary:["details"]},attributes:{"*":["dir","id","lang","title"],a:["ariaDescribedBy","ariaLabel","dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href","hrefLang"],code:[["className",/^language-[\w+-]+$/]],details:["open"],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",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",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-CJmczuqs.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","b","blockquote","br","code","del","details","em","h1","h2","h3","h4","h5","h6","hr","img","input","li","ol","p","picture","pre","section","source","strong","summary","sup","table","tbody","td","th","thead","tr","ul"],ne={...H.defaultSchema,allowComments:!1,allowDoctypes:!1,ancestors:{...H.defaultSchema.ancestors,source:["picture"],summary:["details"]},attributes:{"*":["dir","id","lang","title"],a:["ariaDescribedBy","ariaLabel","dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href","hrefLang"],code:[["className",/^language-[\w+-]+$/]],details:["open"],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",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",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-
|
|
12
|
+
import { T as _ } from "./Table-DL02k8n8.js";
|
|
13
13
|
import { T as k } from "./Text-rN6iDo0V.js";
|
|
14
14
|
const oe = {
|
|
15
15
|
bash: "Shell",
|
package/dist/Modal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),o=require("react"),h=require("./effects-D98vUn6N.cjs"),$=require("./reference-C2guRuR0.cjs"),f=require("./usePresence-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),o=require("react"),h=require("./effects-D98vUn6N.cjs"),$=require("./reference-C2guRuR0.cjs"),f=require("./usePresence-WXhrarsC.cjs"),G=require("./useFocusTrap-C2Iw9BGP.cjs"),H=require("./useScrollLock-Dy8MZaSn.cjs"),J=require("./Surface-BttJYSDt.cjs"),K=require("./Button-DyO8fkk1.cjs"),Q=require("./Text-DWYlIcPj.cjs"),U=o.forwardRef(function(e,r){const{children:a,className:d,spacing:l="standard",...c}=e;return n.jsx("div",{...c,ref:r,className:["nk-modal__footer",d].filter(Boolean).join(" "),"data-spacing":l,children:a})}),V=o.forwardRef(function(e,r){const{children:a,className:d,spacing:l="standard",tabIndex:c=0,...u}=e;return n.jsx("div",{...u,ref:r,className:["nk-modal__body",d].filter(Boolean).join(" "),"data-spacing":l,tabIndex:c,children:a})});function W(i,e,r){e.current=i,$.assignElementReference(r,i)}function X(i){const{"aria-label":e,"aria-labelledby":r,children:a,className:d,closeButtonLabel:l="Close modal",exitable:c=!0,forwardedReference:u,initialFocusReference:m,lockScroll:b=!0,onClose:s,open:t,ownerDocument:R,presenceState:j,restoreFocus:I=!0,role:L="dialog",style:N,title:p,trapFocus:k=!0,...q}=i,B=o.useRef(null),_=o.useRef(null),P=o.useContext(f.FocusScopeContext),M=`${o.useId()}-title`,[y,w]=o.useState(null),v=h.useBoundary("Modal").boundaryElement,x=f.useOverlayLayer(!0,v),D=o.useMemo(()=>[B],[]),g=!!(p!=null&&p.trim()),E=m??(g?_:void 0),O=r??(e===void 0&&g?M:void 0),T=o.useCallback(F=>{W(F,B,u),w(F)},[u]);h.useIsomorphicLayoutEffect(()=>{y&&(y.inert=!t)},[y,t]);const C=o.useCallback(()=>{s==null||s("escape")},[s]),z=o.useCallback(()=>{s==null||s("outside")},[s]);f.useDismissableLayer({boundary:v,active:t,boundaries:D,dismissOnEscape:c,dismissOnOutsideInteraction:c?"consume":"none",layerId:x.id,onEscapeDismiss:C,onOutsideDismiss:z,ownerDocument:R});const A=G.useFocusTrap({boundary:v,active:t&&k,container:y,initialFocusReference:E,layerId:x.id,restoreFocus:I});H.useScrollLock(b,R,v);const S=c?n.jsx(K.Button,{"aria-label":l,className:"nk-modal__close",icon:"cross",onClick:()=>s==null?void 0:s("close-button"),shape:"rectangle",type:"button",variant:"ghost"}):null;return n.jsx(f.FocusScopeContext.Provider,{value:t&&k?A:P,children:n.jsx("div",{className:"nk-modal__overlay","data-state":j,role:"presentation",style:{zIndex:x.zIndex},children:n.jsx("div",{className:"nk-modal__viewport",children:n.jsxs(J.Surface,{...q,ref:T,"aria-hidden":t?void 0:!0,"aria-label":t?e:void 0,"aria-labelledby":t?O:void 0,"aria-modal":t?"true":void 0,className:["nk-modal",d].filter(Boolean).join(" "),"data-state":j,role:t?L:void 0,style:N,tabIndex:-1,children:[g?n.jsxs("div",{className:"nk-modal__header",children:[n.jsx(Q.Text,{as:"h2",className:"nk-modal__title",id:M,ref:_,size:"subtitle",tabIndex:-1,weight:"semibold",children:p}),S]}):S,a]})})})})}const Y=o.forwardRef(function(e,r){const{open:a}=e,d=h.useBoundary("Modal"),l=o.useRef(e);a&&(l.current=e);const c=a?e:l.current,u=f.usePresence(a),m=d.boundaryElement,b=(m==null?void 0:m.ownerDocument)??(typeof document>"u"?null:document);return!u.present||!b?null:n.jsx(f.Portal,{children:n.jsx(X,{...c,forwardedReference:r,open:a,ownerDocument:b,presenceState:u.state==="closing"?"closing":"open"})})}),Z=Object.assign(Y,{Body:V,Footer:U});exports.default=Z;
|
package/dist/Modal.js
CHANGED
|
@@ -3,8 +3,8 @@ import { jsx as r, jsxs as L } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef as B, useRef as g, useContext as J, useId as K, useState as Q, useMemo as U, useCallback as h } from "react";
|
|
4
4
|
import { u as D, a as V } from "./effects-DGbA6Q2O.js";
|
|
5
5
|
import { a as W } from "./reference-CXMr27nM.js";
|
|
6
|
-
import { b as X, P as Y, F as S, c as Z, d as ee } from "./usePresence-
|
|
7
|
-
import { u as oe } from "./useFocusTrap-
|
|
6
|
+
import { b as X, P as Y, F as S, c as Z, d as ee } from "./usePresence-DrCnSPkG.js";
|
|
7
|
+
import { u as oe } from "./useFocusTrap-BnreoiCP.js";
|
|
8
8
|
import { u as ae } from "./useScrollLock-Drd7OZRC.js";
|
|
9
9
|
import { S as se } from "./Surface-vEFsZC12.js";
|
|
10
10
|
import { B as ne } from "./Button-Dsr1zrKT.js";
|
package/dist/Popover.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),r=require("react"),je=require("./aria-DM-xYEHQ.cjs"),se=require("./effects-D98vUn6N.cjs"),B=require("./reference-C2guRuR0.cjs"),ne=require("./useFloatingPosition-DPVO2E8O.cjs"),P=require("./usePresence-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),r=require("react"),je=require("./aria-DM-xYEHQ.cjs"),se=require("./effects-D98vUn6N.cjs"),B=require("./reference-C2guRuR0.cjs"),ne=require("./useFloatingPosition-DPVO2E8O.cjs"),P=require("./usePresence-WXhrarsC.cjs"),we=require("./useFocusTrap-C2Iw9BGP.cjs"),Le=require("./Surface-BttJYSDt.cjs");function De(n){const{inert:i,panelElement:c}=n;return se.useIsomorphicLayoutEffect(()=>{c&&(c.inert=i)},[i,c]),null}function Ne(n,i,c){i.current=n,B.assignElementReference(c,n)}function _e(n,i,c){i.current=n,B.assignElementReference(c,n)}function Me(n){const i=n.tagName.toLowerCase();return n.getAttribute("role")==="button"&&i!=="button"?!1:["button","input","select","summary","textarea"].includes(i)?!0:i==="a"&&n.hasAttribute("href")}function Be(n){return n==="grid"||n==="listbox"||n==="menu"||n==="tree"?n:"dialog"}const ze=r.forwardRef(function(i,c){const{"aria-label":z,"aria-labelledby":oe,align:A="center",autoFocus:j=!0,children:ae,className:ie,defaultOpen:ce=!1,disabled:x=!1,initialFocusReference:R,onEscapeKeyDown:ue,onOpenChange:k,onPointerDownOutside:I,open:H,placement:K="bottom",persistent:le=!1,restoreFocus:w=!0,role:V="dialog",style:$,tabIndex:de,trapFocus:b=!1,trigger:d,...fe}=i;if(d.type===r.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const U=r.useId(),pe=r.useContext(P.FocusScopeContext),G=`${U}-popover`,o=d.props,J=B.getElementReference(d),Q=o.id??`${U}-trigger`,v=x||o.disabled===!0||o["aria-disabled"]===!0||o["aria-disabled"]==="true",T=H!==void 0,[ge,me]=r.useState(ce),t=T?H:ge,C=P.usePresence(t),W=r.useRef(null),X=r.useRef(null),L=r.useRef("programmatic"),D=r.useRef(null),Y=r.useRef(t),E=r.useRef(null),[be,ve]=r.useReducer(e=>e+1,0),[u,ye]=r.useState(null),[f,he]=r.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),S=se.useBoundary("Popover").boundaryElement,O=P.useOverlayLayer(C.present,S),Pe=r.useMemo(()=>[W,X],[]),p=ne.useFloatingPosition(C.present,K,u,f,S,A),Re=r.useCallback(e=>{_e(e,W,J),ye(e)},[J]),Te=r.useCallback(e=>{Ne(e,X,c),he(e)},[c]),g=r.useCallback((e,s)=>{t!==e&&(T?(D.current={open:e,reason:s},ve()):(L.current=s,me(e)),k==null||k(e,s))},[T,k,t]),Ee=r.useCallback(()=>{g(!1,"escape")},[g]),xe=r.useCallback(()=>{g(!1,"outside")},[g]),ke=r.useCallback(e=>{var m;if(I==null||I(e),e.defaultPrevented)return;const s=(m=a==null?void 0:a.defaultView)==null?void 0:m.HTMLElement;s?E.current=e.composedPath().find(h=>h instanceof s&&h.tabIndex>=0)??e.target:E.current=e.target},[I,a]);P.useDismissableLayer({boundary:S,active:t,boundaries:Pe,dismissOnEscape:!0,dismissOnOutsideInteraction:le?"none":"pass-through",layerId:O.id,onEscapeDismiss:Ee,onEscapeKeyDown:ue,onOutsideDismiss:xe,onPointerDownOutside:ke,ownerDocument:a});const Ie=we.useFocusTrap({boundary:S,active:t&&b,autoFocus:j,container:f,initialFocusReference:R,layerId:O.id,restoreFocus:w});r.useEffect(()=>{if(!t||b||!j||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const s=R==null?void 0:R.current;(s&&f.contains(s)?s:f).focus({preventScroll:!0})}),()=>{e=!1}},[j,R,t,f,b]),r.useEffect(()=>{var te;const e=Y.current;Y.current=t;const s=D.current;let m=L.current;if(T&&(m="programmatic",e!==t&&(s==null?void 0:s.open)===t&&(m=s.reason)),D.current=null,t){L.current="programmatic",E.current=null;return}const h=a==null?void 0:a.activeElement,_=E.current,M=(te=a==null?void 0:a.defaultView)==null?void 0:te.HTMLElement,Fe=m==="outside"&&M&&_ instanceof M&&h instanceof M&&(_===h||_.contains(h));e&&!b&&w&&!Fe&&(u==null||u.focus({preventScroll:!0})),E.current=null},[be,T,t,a,w,b,u]),r.useEffect(()=>{x&&t&&g(!1,"programmatic")},[x,t,g]);function Ce(e){if(v){e.preventDefault(),e.stopPropagation();return}e.defaultPrevented||g(!t,"trigger")}function Se(e){e.defaultPrevented||v||Me(e.currentTarget)||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),e.currentTarget.click())}if(x)return d;const N=typeof d.type=="string",y=N?d.type:null,Z=y==="a"&&typeof o.href=="string",ee=N&&!(y==="button"||y==="input"||y==="select"||y==="summary"||y==="textarea"||Z),re=Z&&v;let q=o.role;q===void 0&&(re?q="link":ee&&(q="button"));let F=o.tabIndex;F===void 0&&ee&&(F=0),v&&(F=-1);const Oe=v?{...o,onClick:void 0}:o,qe=r.cloneElement(d,ne.resolveTriggerOverrides(Oe,{"aria-controls":t?je.mergeIdentifiers(o["aria-controls"],G):o["aria-controls"],"aria-expanded":t,"aria-haspopup":o["aria-haspopup"]??Be(V),"aria-disabled":v?!0:o["aria-disabled"],className:"nk-popover__trigger",href:re?void 0:o.href,id:Q,onClick:Ce,onKeyDown:N?Se:void 0,ref:Re,role:q,tabIndex:F}));return l.jsxs(l.Fragment,{children:[qe,l.jsx(P.FocusScopeContext.Provider,{value:t&&b?Ie:pe,children:C.present&&a?l.jsx(P.Portal,{children:l.jsxs(Le.Surface,{...fe,ref:Te,"aria-hidden":t?void 0:!0,"aria-label":t?z:void 0,"aria-labelledby":t?oe??(z===void 0?Q:void 0):void 0,className:["nk-popover",ie].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??K,"data-align":A,"data-state":C.state==="closing"?"closing":"open",id:G,role:t?V:void 0,style:p?{...$,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:O.zIndex}:{...$,visibility:"hidden",zIndex:O.zIndex},tabIndex:de??-1,children:[l.jsx(De,{inert:!t,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:ae})]})}):null})]})});exports.default=ze;
|
package/dist/Popover.js
CHANGED
|
@@ -5,8 +5,8 @@ import { m as je } from "./aria-Bv-xVREf.js";
|
|
|
5
5
|
import { u as He, a as Ke } from "./effects-DGbA6Q2O.js";
|
|
6
6
|
import { g as Ve, a as ae } from "./reference-CXMr27nM.js";
|
|
7
7
|
import { u as Ue, r as Ge } from "./useFloatingPosition-DktY7k-t.js";
|
|
8
|
-
import { F as se, b as Je, c as Qe, d as We, P as Xe } from "./usePresence-
|
|
9
|
-
import { u as Ye } from "./useFocusTrap-
|
|
8
|
+
import { F as se, b as Je, c as Qe, d as We, P as Xe } from "./usePresence-DrCnSPkG.js";
|
|
9
|
+
import { u as Ye } from "./useFocusTrap-BnreoiCP.js";
|
|
10
10
|
import { S as Ze } from "./Surface-vEFsZC12.js";
|
|
11
11
|
function er(t) {
|
|
12
12
|
const { inert: a, panelElement: i } = t;
|
package/dist/Select.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),r=require("react"),J=require("./effects-D98vUn6N.cjs"),K=require("./aria-DM-xYEHQ.cjs"),Ie=require("./reference-C2guRuR0.cjs"),M=require("./Icon-Yl22zVSN.cjs"),F=require("./usePresence-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),r=require("react"),J=require("./effects-D98vUn6N.cjs"),K=require("./aria-DM-xYEHQ.cjs"),Ie=require("./reference-C2guRuR0.cjs"),M=require("./Icon-Yl22zVSN.cjs"),F=require("./usePresence-WXhrarsC.cjs"),ne=require("./useAnchoredPosition-CrdY2Eat.cjs");function ge(t){const{form:n,onReset:s,resetValue:o,triggerReference:a}=t,l=r.useRef(null);return r.useEffect(()=>{var u;const f=(u=a.current)==null?void 0:u.form;if(!f)return;function d(){const v=l.current;if(v){const x=Array.from(v.options),I=x.find(p=>p.value===o)??x[0];x.forEach(p=>{p.defaultSelected=p===I})}s()}return f.addEventListener("reset",d),()=>f.removeEventListener("reset",d)},[n,s,o,a]),l}const T=8,G=4,ke=160,we=72;function Re(t,n,s,o="start"){const a=s.bottom-t.bottom-G-T,l=t.top-s.top-G-T,f=a<ke&&l>a,d=Math.max(we,f?l:a),u=Math.max(t.width,(n==null?void 0:n.width)??t.width),v=s.left+T,x=ne.calculateAlignedPosition(o,t.left,t.width,u),I=Math.min(Math.max(v,x),Math.max(v,s.right-T-u)),p=f?Math.max(s.top+T,t.top-G-Math.min((n==null?void 0:n.height)??d,d)):t.bottom+G;return{left:I,maxHeight:d,minWidth:t.width,top:p}}function _e(t,n,s,o,a="start"){const l=r.useCallback(f=>{const{panelSize:d,triggerBounds:u,visibleBounds:v}=f;return Re(u,d,v,a)},[a]);return ne.useAnchoredPosition({active:t,boundary:o,fit:l,panel:s,trigger:n})}const Ee=500;function je(t){const n=r.useRef(""),s=r.useRef(null),o=r.useRef(null);return r.useEffect(()=>()=>{const a=o.current;a&&s.current!==null&&a.clearTimeout(s.current)},[]),r.useCallback(a=>{var u;const l=(u=t.current)==null?void 0:u.ownerDocument.defaultView;if(!l)return null;o.current=l;const f=n.current+a,d=Array.from(f).every(v=>v===a);return n.current=d?a:f,s.current!==null&&l.clearTimeout(s.current),s.current=l.setTimeout(()=>{n.current="",s.current=null},Ee),n.current},[t])}function Q(t,n,s){if(t.length===0)return-1;for(let o=1;o<=t.length;o+=1){const a=(n+s*o+t.length)%t.length;if(!t[a].disabled)return a}return-1}function De(t,n,s){for(let o=1;o<=t.length;o+=1){const a=(s+o+t.length)%t.length,l=t[a];if(!l.disabled&&l.label.toLocaleLowerCase().startsWith(n))return a}return-1}function Oe(t){const n=new Set;t.forEach(s=>{if(n.has(s.value))throw new Error("Select option values must be unique");n.add(s.value)})}function Se(t){const{active:n,align:s,highlightedIndex:o,id:a,listboxReference:l,onEscapeDismiss:f,onEscapeKeyDown:d,onHighlight:u,onOutsideDismiss:v,onPointerDownOutside:x,onSelect:I,options:p,ownerDocument:E,persistent:B,position:g,selectedValue:w,state:U,triggerReference:m}=t,H=r.useRef(null),L=J.useBoundary("Select").boundaryElement,j=F.useOverlayLayer(!0,L),q=r.useMemo(()=>[m,H],[m]),V=r.useCallback(h=>{H.current=h,l(h)},[l]);return F.useDismissableLayer({active:n,boundaries:q,boundary:L,dismissOnEscape:!0,dismissOnOutsideInteraction:B?"none":"pass-through",layerId:j.id,onEscapeDismiss:f,onEscapeKeyDown:d,onOutsideDismiss:v,onPointerDownOutside:x,ownerDocument:E}),c.jsx("div",{"aria-hidden":n?void 0:!0,"aria-labelledby":a,className:"nk-select__listbox","data-align":s,"data-state":U,id:`${a}-listbox`,ref:V,role:"listbox",style:g?{left:g.left,maxHeight:g.maxHeight,minWidth:g.minWidth,top:g.top,zIndex:j.zIndex}:{visibility:"hidden",zIndex:j.zIndex},children:p.map((h,A)=>c.jsxs("div",{"aria-disabled":h.disabled||void 0,"aria-selected":h.value===w,className:"nk-select__option","data-highlighted":A===o||void 0,"data-selected":h.value===w||void 0,id:`${a}-option-${A}`,onPointerDown:X=>{X.preventDefault(),h.disabled||I(h)},onPointerMove:()=>{h.disabled||u(A)},role:"option",children:[h.icon?c.jsx(M.Icon,{type:h.icon}):null,c.jsx("span",{className:"nk-select__option-label",children:h.label}),h.value===w?c.jsx(M.Icon,{className:"nk-select__check",type:"checkmark"}):null]},h.value))})}function Le(t,n,s){n.current=t,Ie.assignElementReference(s,t)}function Ae(t){var ee;const{"aria-invalid":n,align:s="start",className:o,defaultValue:a="",disabled:l=!1,displayOverride:f,form:d,forwardedReference:u,id:v,invalid:x=!1,name:I,onChange:p,onClick:E,onEscapeKeyDown:B,onKeyDown:g,onOpenChange:w,onPointerDownOutside:U,options:m,placeholder:H,persistent:L=!1,required:j=!1,style:q,value:V,width:h,...A}=t;Oe(m);const X=r.useId(),D=v??X,k=r.useRef(null),[C,se]=r.useState(null),[b,ae]=r.useState(!1),[R,N]=r.useState(-1),[le,Z]=r.useState(a),O=V!==void 0,S=O?V:le,re=m.find(e=>e.value===S),ie=x||K.hasInvalidState(n),oe=K.resolveAriaInvalid(x,n),Y=F.usePresence(b),P=((ee=k.current)==null?void 0:ee.ownerDocument)??(typeof document>"u"?null:document),ce=J.useBoundary("Select").boundaryElement,de=_e(Y.present,k.current,C,ce,s),ue=je(k),fe=h===void 0?q:{...q,width:h},W=f??re,he=r.useCallback(e=>Le(e,k,u),[u]),y=r.useCallback(e=>{b!==e&&(ae(e),w==null||w(e))},[w,b]),me=r.useCallback(()=>{O||Z(a),y(!1)},[a,O,y]),ve=ge({form:d,onReset:me,resetValue:O?S:a,triggerReference:k}),$=r.useCallback((e=1)=>{const i=m.findIndex(te=>te.value===S&&!te.disabled),_=e===1?-1:m.length;N(i>=0?i:Q(m,_,e)),y(!0)},[m,S,y]),z=r.useCallback(e=>{var i;l||e.disabled||(O||Z(e.value),y(!1),(i=k.current)==null||i.focus(),p==null||p(e.value))},[l,O,p,y]),pe=r.useCallback(()=>{var e;y(!1),(e=k.current)==null||e.focus()},[y]),be=r.useCallback(()=>{y(!1)},[y]);function ye(e){E==null||E(e),!(e.defaultPrevented||l)&&(b?y(!1):$())}function xe(e){if(g==null||g(e),!(e.defaultPrevented||l)){if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const i=e.key==="ArrowDown"?1:-1;b?N(_=>Q(m,_,i)):$(i);return}if(e.key==="Home"||e.key==="End"){if(e.preventDefault(),!b)$(e.key==="Home"?1:-1);else{const i=e.key==="Home"?1:-1,_=i===1?-1:m.length;N(Q(m,_,i))}return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const i=m[R];b&&i?z(i):b||$();return}if(e.key==="Tab"){L||y(!1);return}if(e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey){const i=ue(e.key.toLocaleLowerCase());if(i===null)return;const _=De(m,i,R);_>=0&&(e.preventDefault(),b||y(!0),N(_))}}}return r.useEffect(()=>{l&&y(!1)},[l,y]),r.useEffect(()=>{var e;if(b&&R>=0){const i=P==null?void 0:P.getElementById(`${D}-option-${R}`);i&&(C!=null&&C.contains(i))&&((e=i.scrollIntoView)==null||e.call(i,{block:"nearest"}))}},[R,D,C,b]),c.jsxs("span",{className:["nk-select",o].filter(Boolean).join(" "),"data-disabled":l||void 0,"data-invalid":ie||void 0,"data-mode":"custom","data-open":b||void 0,style:fe,children:[c.jsxs("button",{...A,ref:he,"aria-activedescendant":b&&R>=0?`${D}-option-${R}`:void 0,"aria-controls":`${D}-listbox`,"aria-expanded":b,"aria-haspopup":"listbox","aria-invalid":oe,"aria-required":j||void 0,"aria-autocomplete":"none",className:"nk-select__trigger",disabled:l,form:d,id:D,onClick:ye,onKeyDown:xe,role:"combobox",type:"button",children:[W?c.jsxs("span",{className:"nk-select__value",children:[W.icon?c.jsx(M.Icon,{type:W.icon}):null,c.jsx("span",{className:"nk-select__value-label",children:W.label})]}):c.jsx("span",{className:"nk-select__placeholder",children:H}),c.jsx(M.Icon,{className:"nk-select__icon",type:"chevron-down"})]}),I||j?c.jsxs("select",{ref:ve,"aria-hidden":"true",className:"nk-select__form-control",disabled:l,form:d,name:I,onChange:()=>{},onInvalid:e=>{var i;e.preventDefault(),(i=k.current)==null||i.focus()},required:j,tabIndex:-1,value:S,children:[c.jsx("option",{value:""}),m.map(e=>c.jsx("option",{disabled:e.disabled,value:e.value,children:e.label},e.value))]}):null,Y.present&&P?c.jsx(F.Portal,{children:c.jsx(Se,{active:b,align:s,highlightedIndex:R,id:D,listboxReference:se,onEscapeDismiss:pe,onEscapeKeyDown:B,onHighlight:N,onOutsideDismiss:be,onPointerDownOutside:U,onSelect:z,options:m,ownerDocument:P,persistent:L,position:de,selectedValue:S,state:Y.state==="closing"?"closing":"open",triggerReference:k})}):null]})}function Ce(t){const{"aria-invalid":n,children:s,className:o,defaultValue:a,disabled:l=!1,forwardedReference:f,invalid:d=!1,placeholder:u,style:v,value:x,...I}=t,p=K.resolveAriaInvalid(d,n),E=d||K.hasInvalidState(n);return c.jsxs("span",{className:["nk-select",o].filter(Boolean).join(" "),"data-disabled":l||void 0,"data-invalid":E||void 0,"data-mode":"native",style:v,children:[c.jsxs("select",{...I,ref:f,"aria-invalid":p,className:"nk-select__control",defaultValue:x===void 0?a??(u!==void 0?"":void 0):void 0,disabled:l,value:x,children:[u!==void 0?c.jsx("option",{disabled:!0,value:"",children:u}):null,s]}),c.jsx(M.Icon,{className:"nk-select__icon",type:"chevron-down"})]})}const Ne=r.forwardRef(function(n,s){const{options:o}=n;return J.useBoundary("Select"),o!==void 0?c.jsx(Ae,{...n,forwardedReference:s}):c.jsx(Ce,{...n,forwardedReference:s})});exports.default=Ne;
|
package/dist/Select.js
CHANGED
|
@@ -5,7 +5,7 @@ import { u as z } from "./effects-DGbA6Q2O.js";
|
|
|
5
5
|
import { h as se, r as le } from "./aria-Bv-xVREf.js";
|
|
6
6
|
import { a as Re } from "./reference-CXMr27nM.js";
|
|
7
7
|
import { I as W } from "./Icon-B9-_-fzr.js";
|
|
8
|
-
import { c as De, d as Oe, b as Le, P as Ne } from "./usePresence-
|
|
8
|
+
import { c as De, d as Oe, b as Le, P as Ne } from "./usePresence-DrCnSPkG.js";
|
|
9
9
|
import { c as Ae, u as Pe } from "./useAnchoredPosition-xI79veB2.js";
|
|
10
10
|
function Te(t) {
|
|
11
11
|
const { form: n, onReset: a, resetValue: r, triggerReference: s } = t, l = P(null);
|
package/dist/Sidebar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),t=require("react"),R=require("./effects-D98vUn6N.cjs"),U=require("./reference-C2guRuR0.cjs"),T=require("./usePresence-HVr855AK.cjs"),z=require("./Button-DyO8fkk1.cjs"),G=require("./Text-DWYlIcPj.cjs"),ie=require("./useFocusTrap-C--8mnsI.cjs"),oe=require("./useScrollLock-Dy8MZaSn.cjs"),le=require("./aria-DM-xYEHQ.cjs"),ce=require("./useFloatingPosition-DPVO2E8O.cjs"),de=require("./Avatar-Belo7qAY.cjs"),H=require("./Skeleton-CBS-MN5x.cjs"),ue=require("./Tooltip-tzVg8Bky.cjs"),fe=require("./units-CUnzOlBy.cjs");function be(s){const{label:n,onToggle:e,panelId:r,reference:b,side:d,sidebarOpen:l}=s;return o.jsx(z.Button,{ref:b,"aria-controls":r,"aria-expanded":l,"aria-haspopup":"dialog","aria-label":n,className:"nk-sidebar__fallback-trigger","data-side":d,icon:"burger",variant:"secondary",size:"large",onClick:e})}const q=new WeakMap;function W(s){const n=q.get(s);if(n)return n;const e={listeners:new Set,owner:null,state:void 0};return q.set(s,e),e}function pe(s,n,e){const r=W(s);return r.owner!==null&&r.owner!==n?!1:(r.owner=n,r.state=e,r.listeners.forEach(b=>b()),!0)}function he(s,n){const e=q.get(s);!e||e.owner!==n||(e.owner=null,e.state=void 0,e.listeners.forEach(r=>r()))}function ge(s){var n;return s?(n=q.get(s))==null?void 0:n.state:void 0}function me(s,n){if(!s)return()=>{};const e=W(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ve=()=>{};function F(s){const n=R.useBoundary(s).boundaryElement,e=t.useCallback(b=>me(n,b),[n]),r=t.useCallback(()=>ge(n),[n]);return t.useSyncExternalStore(e,r,ve)}function D(s,n){return s==="both"||s===(n==="overlay"?"overlay":"inline")}const ee=t.forwardRef(function(n,e){const{children:r,className:b,presentation:d="both",...l}=n,i=F("Sidebar.Footer");return D(d,i==null?void 0:i.presentation)?o.jsx("div",{...l,ref:e,className:["nk-sidebar__footer",b].filter(Boolean).join(" "),children:r}):null}),ye=t.forwardRef(function(n,e){const{"aria-label":r,"aria-labelledby":b,children:d,className:l,label:i,presentation:S="both",...p}=n,y=F("Sidebar.Group"),c=`${t.useId()}-label`,h=i!=null&&typeof i!="boolean"&&(typeof i!="string"||i.trim()!=="");if(!D(S,y==null?void 0:y.presentation))return null;const u=b??(r===void 0&&h?c:void 0),a=!!(r??u);return t.createElement(a?"nav":"div",{...p,ref:e,"aria-label":r,"aria-labelledby":u,className:["nk-sidebar__group",l].filter(Boolean).join(" ")},h?o.jsx(G.Text,{as:"h2",className:"nk-sidebar__group-label",id:c,size:"subtitle",weight:"medium",children:i}):null,o.jsx("ul",{className:"nk-sidebar__list",children:d}))}),Se=t.forwardRef(function(n,e){const{children:r,className:b,presentation:d="both",...l}=n,i=F("Sidebar.Header");return D(d,i==null?void 0:i.presentation)?o.jsx("div",{...l,ref:e,className:["nk-sidebar__header",b].filter(Boolean).join(" "),children:r}):null}),ke=t.forwardRef(function(n,e){const{active:r=!1,as:b,children:d,className:l,disabled:i=!1,icon:S,onClick:p,presentation:y="both",type:c,...h}=n,u=F("Sidebar.Item"),a=b??"button",f=a==="button",m=h,E=m.href!==void 0||m.to!==void 0;function v(k){if(i){k.preventDefault();return}p==null||p(k),u!=null&&u.open&&u.presentation==="overlay"&&!k.defaultPrevented&&u.requestOpenChange(!1,"item")}return D(y,u==null?void 0:u.presentation)?o.jsx("li",{className:"nk-sidebar__item-container",children:o.jsx(z.Button,{...h,ref:e,"aria-current":r?E?"page":"true":void 0,as:a,className:["nk-sidebar__item",l].filter(Boolean).join(" "),"data-active":r||void 0,disabled:i,fullWidth:!0,href:m.href,icon:S,onClick:v,shape:"rectangle",size:"small",textAlignment:"left",type:f?c??"button":c,variant:"ghost",children:o.jsx("span",{className:"nk-sidebar__item-label",children:d})})}):null}),xe=1;function Ee(s){return s==null?void 0:s.ResizeObserver}function Ce(s){return s==null?void 0:s.MutationObserver}function _e(){const[s,n]=t.useState(!1),e=t.useRef(null),r=t.useCallback(l=>{const i=l.scrollHeight-l.scrollTop-l.clientHeight;n(i>xe)},[]),b=t.useCallback(l=>{var m;if((m=e.current)==null||m.call(e),e.current=null,!l)return;const i=l;r(i);function S(){r(i)}const p=i.ownerDocument.defaultView;p==null||p.addEventListener("resize",S);const y=Ee(p),c=y?new y(S):void 0;function h(){c==null||c.disconnect(),c==null||c.observe(i);for(const E of i.children)c==null||c.observe(E)}h();function u(E){E.some(k=>k.type==="childList")&&h(),S()}const a=Ce(p),f=a?new a(u):void 0;f==null||f.observe(i,{attributeFilter:["class","hidden","style"],characterData:!0,childList:!0,subtree:!0}),e.current=()=>{p==null||p.removeEventListener("resize",S),c==null||c.disconnect(),f==null||f.disconnect()}},[r]),d=t.useCallback(l=>{r(l.currentTarget)},[r]);return{containerReference:b,contentBelow:s,handleScroll:d}}function je(s,n){for(const e of t.Children.toArray(s)){if(t.isValidElement(e)&&e.type===t.Fragment){const r=ne(e.props.children);r.bodyChildren.length>0&&n.bodyChildren.push(t.cloneElement(e,void 0,...r.bodyChildren)),r.footerChildren.length>0&&n.footerChildren.push(t.cloneElement(e,void 0,...r.footerChildren));continue}t.isValidElement(e)&&e.type===ee?n.footerChildren.push(e):n.bodyChildren.push(e)}}function ne(s){const n={bodyChildren:[],footerChildren:[]};return je(s,n),n}function re(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:b,height:d,open:l,panelId:i,panelReference:S,presentation:p,side:y,state:c,style:h,width:u,...a}=s,{containerReference:f,contentBelow:m,handleScroll:E}=_e(),v=p==="overlay",{bodyChildren:k,footerChildren:P}=ne(r),B=n??(e===void 0?"Sidebar":void 0),I=v&&l;let j=h;return(u!==void 0||d!==void 0)&&(j={...h},d!==void 0&&(j["--nk-sidebar-height"]=d),u!==void 0&&(j["--nk-sidebar-width"]=u)),o.jsxs("aside",{...a,ref:S,"aria-hidden":v&&!l?!0:void 0,"aria-label":v&&!l?void 0:B,"aria-labelledby":v&&!l?void 0:e,"aria-modal":I?"true":void 0,className:["nk-sidebar",b].filter(Boolean).join(" "),"data-responsive":p==="pending"||void 0,"data-side":y,"data-state":c,"data-variant":v?"overlay":"inline",id:i,role:I?"dialog":void 0,style:j,tabIndex:v?-1:void 0,children:[o.jsx("div",{ref:f,className:"nk-sidebar__body","data-content-below":m||void 0,onScroll:E,children:k}),P]})}function Ne(s){const{boundaries:n,initialFocusReference:e,lockScroll:r,ownerDocument:b,panelReference:d,presenceState:l,restoreFocus:i,sidebar:S,side:p,...y}=s,{id:c,open:h,requestOpenChange:u}=S,a=t.useContext(T.FocusScopeContext),f=t.useRef(null),[m,E]=t.useState(null),v=R.useBoundary("Sidebar").boundaryElement,k=T.useOverlayLayer(!0,v),P=t.useCallback(L=>{f.current=L,d(L),E(L)},[d]);R.useIsomorphicLayoutEffect(()=>{m&&(m.inert=!h)},[h,m]);const B=t.useCallback(()=>{u(!1,"escape")},[u]),I=t.useCallback(()=>{u(!1,"outside")},[u]);T.useDismissableLayer({boundary:v,active:h,boundaries:n,dismissOnEscape:!0,dismissOnOutsideInteraction:"consume",layerId:k.id,onEscapeDismiss:B,onOutsideDismiss:I,ownerDocument:b});const j=ie.useFocusTrap({boundary:v,active:h,container:m,initialFocusReference:e??f,layerId:k.id,restoreFocus:i});return oe.useScrollLock(r&&h,b,v),o.jsx(T.FocusScopeContext.Provider,{value:h?j:a,children:o.jsx("div",{className:"nk-sidebar__overlay","data-side":p,"data-state":l,role:"presentation",style:{zIndex:k.zIndex},children:o.jsx(re,{...y,open:h,panelId:c,panelReference:P,presentation:"overlay",side:p,state:l})})})}function Re(s){const{children:n}=s;if(n.type===t.Fragment)throw new Error("Sidebar.Trigger requires a single non-Fragment child");const e=F("Sidebar.Trigger"),r=n.props,b=U.getElementReference(n),d=e==null?void 0:e.registerTrigger,l=e==null?void 0:e.unregisterTrigger,i=t.useRef(null),S=t.useCallback(f=>{const m=i.current;m&&m!==f&&(l==null||l(m)),i.current=f,f&&(d==null||d(f)),U.assignElementReference(b,f)},[b,d,l]),p=t.useCallback(f=>{f.defaultPrevented||!e||e.requestOpenChange(!e.open,"trigger")},[e]);if(!e)return null;const{id:y,open:c,presentation:h,variant:u}=e,a=c&&h==="overlay";return t.cloneElement(n,ce.resolveTriggerOverrides(r,{"aria-controls":a?le.mergeIdentifiers(r["aria-controls"],y):r["aria-controls"],"aria-expanded":c,"aria-haspopup":r["aria-haspopup"]??"dialog",className:"nk-sidebar__trigger","data-sidebar-variant":u,onClick:p,ref:S}))}const Te=t.forwardRef(function(n,e){const{actions:r,className:b,description:d,image:l,loading:i=!1,name:S,onClick:p,...y}=n,c=d!=null&&typeof d!="boolean";if(i)return o.jsx("div",{...y,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:o.jsxs("div",{"aria-label":"Loading user",className:"nk-sidebar__user-details",role:"status",children:[o.jsx(H.Skeleton,{className:"nk-sidebar__user-avatar",height:"var(--nk-space-32)",shape:"ellipse",width:"var(--nk-space-32)"}),o.jsxs("div",{className:"nk-sidebar__user-text",style:{gap:"var(--nk-space-8)"},children:[o.jsx(H.Skeleton,{height:"var(--nk-space-16)",width:"70%"}),c?o.jsx(H.Skeleton,{height:"var(--nk-space-12)",width:"50%"}):null]})]})});const h=o.jsxs(o.Fragment,{children:[o.jsx(de.Avatar,{alt:S,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:l}),o.jsxs("span",{className:"nk-sidebar__user-text",children:[o.jsx(G.Text,{as:"span",weight:"medium",children:S}),c?o.jsx(G.Text,{as:"span",size:"caption",tone:"muted",children:d}):null]})]});return o.jsxs("div",{...y,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:[p?o.jsx("button",{className:"nk-sidebar__user-details",onClick:p,type:"button",children:h}):o.jsx("div",{className:"nk-sidebar__user-details",children:h}),r!=null&&r.length?o.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(({"aria-label":u,icon:a,label:f,...m})=>o.jsx(ue.Tooltip2,{content:f,children:o.jsx(z.Button,{...m,"aria-label":u??f,className:"nk-sidebar__user-action",icon:a,shape:"rectangle",type:"button",variant:"ghost"})},f))}):null]})}),Ie=()=>()=>{},Z=()=>{};function Pe(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??Ie,(e==null?void 0:e.read)??Z,Z);return s!=="responsive"?s:r===void 0?"pending":r>=fe.breakpoint("medium")?"inline":"overlay"}const Be=32,Le=t.forwardRef(function(n,e){var X;const{defaultOpen:r=!1,height:b,initialFocusReference:d,lockScroll:l=!0,onOpenChange:i,open:S,restoreFocus:p=!0,side:y="left",variant:c="responsive",width:h,...u}=n,a=R.useBoundary("Sidebar"),f=`${t.useId()}-sidebar`,m=t.useRef(Symbol("nk-sidebar")).current,E=t.useRef(null),v=Pe(c,a==null?void 0:a.width),k=S!==void 0,[P,B]=t.useState(r),[I,j]=t.useState(0),[L,te]=t.useState(!1),V=t.useRef(null),N=k?S:P,w=t.useRef(i);R.useIsomorphicLayoutEffect(()=>{w.current=i});const O=t.useCallback((g,x)=>{var C;N!==g&&(k||B(g),(C=w.current)==null||C.call(w,g,x))},[k,N]),$=t.useCallback(g=>{E.current=g,U.assignElementReference(e,g)},[e]),_=t.useMemo(()=>[E],[]),K=t.useCallback(g=>{_.push({current:g}),j(x=>x+1)},[_]),Y=t.useCallback(g=>{const x=_.findIndex(C=>C.current===g);x>0&&_.splice(x,1),j(C=>Math.max(C-1,0))},[_]),se=t.useCallback(g=>{const x=V.current;if(x&&x!==g){const C=_.findIndex(ae=>ae.current===x);C>0&&_.splice(C,1)}V.current=g,g&&_.push({current:g})},[_]),A=t.useMemo(()=>({id:f,open:N,presentation:v,registerTrigger:K,requestOpenChange:O,unregisterTrigger:Y,variant:c}),[N,f,v,K,O,Y,c]);R.useIsomorphicLayoutEffect(()=>{const g=a==null?void 0:a.boundaryElement;if(!g)return;if(pe(g,m,A)===!1)throw new Error("A Boundary supports one Sidebar. Neatkit resolves Trigger, Group, and Item interactions against the single Sidebar published to the nearest Boundary, so give each Sidebar a Boundary of its own.")},[a==null?void 0:a.boundaryElement,m,A]),R.useIsomorphicLayoutEffect(()=>{const g=a==null?void 0:a.boundaryElement;if(g)return()=>he(g,m)},[a==null?void 0:a.boundaryElement,m]),t.useEffect(()=>{v==="inline"&&O(!1,"variant")},[v,O]),t.useEffect(()=>{var C;const g=(C=a==null?void 0:a.boundaryElement)==null?void 0:C.ownerDocument.defaultView;if(!g)return;const x=g.setTimeout(()=>te(!0),Be);return()=>g.clearTimeout(x)},[a==null?void 0:a.boundaryElement]);const M=T.usePresence(N&&v==="overlay"),J=((X=a==null?void 0:a.boundaryElement)==null?void 0:X.ownerDocument)??(typeof document>"u"?null:document);if(v!=="overlay")return o.jsx(re,{...u,height:b,open:!1,panelId:f,panelReference:$,presentation:v,side:y,width:h});const Q=L&&I===0?o.jsx(T.Portal,{children:o.jsx(be,{label:`Open ${u["aria-label"]??"Sidebar"}`,onToggle:()=>O(!N,"trigger"),panelId:M.present?f:void 0,reference:se,side:y,sidebarOpen:N})}):null;return!M.present||!J?Q:o.jsxs(o.Fragment,{children:[Q,o.jsx(T.Portal,{children:o.jsx(Ne,{...u,boundaries:_,initialFocusReference:d,lockScroll:l,ownerDocument:J,panelReference:$,presenceState:M.state==="closing"?"closing":"open",restoreFocus:p,side:y,sidebar:A,width:h})})]})}),Oe=Object.assign(Le,{Footer:ee,Group:ye,Header:Se,Item:ke,Trigger:Re,User:Te});exports.default=Oe;
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),t=require("react"),R=require("./effects-D98vUn6N.cjs"),U=require("./reference-C2guRuR0.cjs"),T=require("./usePresence-WXhrarsC.cjs"),z=require("./Button-DyO8fkk1.cjs"),G=require("./Text-DWYlIcPj.cjs"),ie=require("./useFocusTrap-C2Iw9BGP.cjs"),oe=require("./useScrollLock-Dy8MZaSn.cjs"),le=require("./aria-DM-xYEHQ.cjs"),ce=require("./useFloatingPosition-DPVO2E8O.cjs"),de=require("./Avatar-Belo7qAY.cjs"),H=require("./Skeleton-CBS-MN5x.cjs"),ue=require("./Tooltip-DhSawjGg.cjs"),fe=require("./units-CUnzOlBy.cjs");function be(s){const{label:n,onToggle:e,panelId:r,reference:b,side:d,sidebarOpen:l}=s;return o.jsx(z.Button,{ref:b,"aria-controls":r,"aria-expanded":l,"aria-haspopup":"dialog","aria-label":n,className:"nk-sidebar__fallback-trigger","data-side":d,icon:"burger",variant:"secondary",size:"large",onClick:e})}const q=new WeakMap;function W(s){const n=q.get(s);if(n)return n;const e={listeners:new Set,owner:null,state:void 0};return q.set(s,e),e}function pe(s,n,e){const r=W(s);return r.owner!==null&&r.owner!==n?!1:(r.owner=n,r.state=e,r.listeners.forEach(b=>b()),!0)}function he(s,n){const e=q.get(s);!e||e.owner!==n||(e.owner=null,e.state=void 0,e.listeners.forEach(r=>r()))}function ge(s){var n;return s?(n=q.get(s))==null?void 0:n.state:void 0}function me(s,n){if(!s)return()=>{};const e=W(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ve=()=>{};function F(s){const n=R.useBoundary(s).boundaryElement,e=t.useCallback(b=>me(n,b),[n]),r=t.useCallback(()=>ge(n),[n]);return t.useSyncExternalStore(e,r,ve)}function D(s,n){return s==="both"||s===(n==="overlay"?"overlay":"inline")}const ee=t.forwardRef(function(n,e){const{children:r,className:b,presentation:d="both",...l}=n,i=F("Sidebar.Footer");return D(d,i==null?void 0:i.presentation)?o.jsx("div",{...l,ref:e,className:["nk-sidebar__footer",b].filter(Boolean).join(" "),children:r}):null}),ye=t.forwardRef(function(n,e){const{"aria-label":r,"aria-labelledby":b,children:d,className:l,label:i,presentation:S="both",...p}=n,y=F("Sidebar.Group"),c=`${t.useId()}-label`,h=i!=null&&typeof i!="boolean"&&(typeof i!="string"||i.trim()!=="");if(!D(S,y==null?void 0:y.presentation))return null;const u=b??(r===void 0&&h?c:void 0),a=!!(r??u);return t.createElement(a?"nav":"div",{...p,ref:e,"aria-label":r,"aria-labelledby":u,className:["nk-sidebar__group",l].filter(Boolean).join(" ")},h?o.jsx(G.Text,{as:"h2",className:"nk-sidebar__group-label",id:c,size:"subtitle",weight:"medium",children:i}):null,o.jsx("ul",{className:"nk-sidebar__list",children:d}))}),Se=t.forwardRef(function(n,e){const{children:r,className:b,presentation:d="both",...l}=n,i=F("Sidebar.Header");return D(d,i==null?void 0:i.presentation)?o.jsx("div",{...l,ref:e,className:["nk-sidebar__header",b].filter(Boolean).join(" "),children:r}):null}),ke=t.forwardRef(function(n,e){const{active:r=!1,as:b,children:d,className:l,disabled:i=!1,icon:S,onClick:p,presentation:y="both",type:c,...h}=n,u=F("Sidebar.Item"),a=b??"button",f=a==="button",m=h,E=m.href!==void 0||m.to!==void 0;function v(k){if(i){k.preventDefault();return}p==null||p(k),u!=null&&u.open&&u.presentation==="overlay"&&!k.defaultPrevented&&u.requestOpenChange(!1,"item")}return D(y,u==null?void 0:u.presentation)?o.jsx("li",{className:"nk-sidebar__item-container",children:o.jsx(z.Button,{...h,ref:e,"aria-current":r?E?"page":"true":void 0,as:a,className:["nk-sidebar__item",l].filter(Boolean).join(" "),"data-active":r||void 0,disabled:i,fullWidth:!0,href:m.href,icon:S,onClick:v,shape:"rectangle",size:"small",textAlignment:"left",type:f?c??"button":c,variant:"ghost",children:o.jsx("span",{className:"nk-sidebar__item-label",children:d})})}):null}),xe=1;function Ee(s){return s==null?void 0:s.ResizeObserver}function Ce(s){return s==null?void 0:s.MutationObserver}function _e(){const[s,n]=t.useState(!1),e=t.useRef(null),r=t.useCallback(l=>{const i=l.scrollHeight-l.scrollTop-l.clientHeight;n(i>xe)},[]),b=t.useCallback(l=>{var m;if((m=e.current)==null||m.call(e),e.current=null,!l)return;const i=l;r(i);function S(){r(i)}const p=i.ownerDocument.defaultView;p==null||p.addEventListener("resize",S);const y=Ee(p),c=y?new y(S):void 0;function h(){c==null||c.disconnect(),c==null||c.observe(i);for(const E of i.children)c==null||c.observe(E)}h();function u(E){E.some(k=>k.type==="childList")&&h(),S()}const a=Ce(p),f=a?new a(u):void 0;f==null||f.observe(i,{attributeFilter:["class","hidden","style"],characterData:!0,childList:!0,subtree:!0}),e.current=()=>{p==null||p.removeEventListener("resize",S),c==null||c.disconnect(),f==null||f.disconnect()}},[r]),d=t.useCallback(l=>{r(l.currentTarget)},[r]);return{containerReference:b,contentBelow:s,handleScroll:d}}function je(s,n){for(const e of t.Children.toArray(s)){if(t.isValidElement(e)&&e.type===t.Fragment){const r=ne(e.props.children);r.bodyChildren.length>0&&n.bodyChildren.push(t.cloneElement(e,void 0,...r.bodyChildren)),r.footerChildren.length>0&&n.footerChildren.push(t.cloneElement(e,void 0,...r.footerChildren));continue}t.isValidElement(e)&&e.type===ee?n.footerChildren.push(e):n.bodyChildren.push(e)}}function ne(s){const n={bodyChildren:[],footerChildren:[]};return je(s,n),n}function re(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:b,height:d,open:l,panelId:i,panelReference:S,presentation:p,side:y,state:c,style:h,width:u,...a}=s,{containerReference:f,contentBelow:m,handleScroll:E}=_e(),v=p==="overlay",{bodyChildren:k,footerChildren:P}=ne(r),B=n??(e===void 0?"Sidebar":void 0),I=v&&l;let j=h;return(u!==void 0||d!==void 0)&&(j={...h},d!==void 0&&(j["--nk-sidebar-height"]=d),u!==void 0&&(j["--nk-sidebar-width"]=u)),o.jsxs("aside",{...a,ref:S,"aria-hidden":v&&!l?!0:void 0,"aria-label":v&&!l?void 0:B,"aria-labelledby":v&&!l?void 0:e,"aria-modal":I?"true":void 0,className:["nk-sidebar",b].filter(Boolean).join(" "),"data-responsive":p==="pending"||void 0,"data-side":y,"data-state":c,"data-variant":v?"overlay":"inline",id:i,role:I?"dialog":void 0,style:j,tabIndex:v?-1:void 0,children:[o.jsx("div",{ref:f,className:"nk-sidebar__body","data-content-below":m||void 0,onScroll:E,children:k}),P]})}function Ne(s){const{boundaries:n,initialFocusReference:e,lockScroll:r,ownerDocument:b,panelReference:d,presenceState:l,restoreFocus:i,sidebar:S,side:p,...y}=s,{id:c,open:h,requestOpenChange:u}=S,a=t.useContext(T.FocusScopeContext),f=t.useRef(null),[m,E]=t.useState(null),v=R.useBoundary("Sidebar").boundaryElement,k=T.useOverlayLayer(!0,v),P=t.useCallback(L=>{f.current=L,d(L),E(L)},[d]);R.useIsomorphicLayoutEffect(()=>{m&&(m.inert=!h)},[h,m]);const B=t.useCallback(()=>{u(!1,"escape")},[u]),I=t.useCallback(()=>{u(!1,"outside")},[u]);T.useDismissableLayer({boundary:v,active:h,boundaries:n,dismissOnEscape:!0,dismissOnOutsideInteraction:"consume",layerId:k.id,onEscapeDismiss:B,onOutsideDismiss:I,ownerDocument:b});const j=ie.useFocusTrap({boundary:v,active:h,container:m,initialFocusReference:e??f,layerId:k.id,restoreFocus:i});return oe.useScrollLock(r&&h,b,v),o.jsx(T.FocusScopeContext.Provider,{value:h?j:a,children:o.jsx("div",{className:"nk-sidebar__overlay","data-side":p,"data-state":l,role:"presentation",style:{zIndex:k.zIndex},children:o.jsx(re,{...y,open:h,panelId:c,panelReference:P,presentation:"overlay",side:p,state:l})})})}function Re(s){const{children:n}=s;if(n.type===t.Fragment)throw new Error("Sidebar.Trigger requires a single non-Fragment child");const e=F("Sidebar.Trigger"),r=n.props,b=U.getElementReference(n),d=e==null?void 0:e.registerTrigger,l=e==null?void 0:e.unregisterTrigger,i=t.useRef(null),S=t.useCallback(f=>{const m=i.current;m&&m!==f&&(l==null||l(m)),i.current=f,f&&(d==null||d(f)),U.assignElementReference(b,f)},[b,d,l]),p=t.useCallback(f=>{f.defaultPrevented||!e||e.requestOpenChange(!e.open,"trigger")},[e]);if(!e)return null;const{id:y,open:c,presentation:h,variant:u}=e,a=c&&h==="overlay";return t.cloneElement(n,ce.resolveTriggerOverrides(r,{"aria-controls":a?le.mergeIdentifiers(r["aria-controls"],y):r["aria-controls"],"aria-expanded":c,"aria-haspopup":r["aria-haspopup"]??"dialog",className:"nk-sidebar__trigger","data-sidebar-variant":u,onClick:p,ref:S}))}const Te=t.forwardRef(function(n,e){const{actions:r,className:b,description:d,image:l,loading:i=!1,name:S,onClick:p,...y}=n,c=d!=null&&typeof d!="boolean";if(i)return o.jsx("div",{...y,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:o.jsxs("div",{"aria-label":"Loading user",className:"nk-sidebar__user-details",role:"status",children:[o.jsx(H.Skeleton,{className:"nk-sidebar__user-avatar",height:"var(--nk-space-32)",shape:"ellipse",width:"var(--nk-space-32)"}),o.jsxs("div",{className:"nk-sidebar__user-text",style:{gap:"var(--nk-space-8)"},children:[o.jsx(H.Skeleton,{height:"var(--nk-space-16)",width:"70%"}),c?o.jsx(H.Skeleton,{height:"var(--nk-space-12)",width:"50%"}):null]})]})});const h=o.jsxs(o.Fragment,{children:[o.jsx(de.Avatar,{alt:S,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:l}),o.jsxs("span",{className:"nk-sidebar__user-text",children:[o.jsx(G.Text,{as:"span",weight:"medium",children:S}),c?o.jsx(G.Text,{as:"span",size:"caption",tone:"muted",children:d}):null]})]});return o.jsxs("div",{...y,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:[p?o.jsx("button",{className:"nk-sidebar__user-details",onClick:p,type:"button",children:h}):o.jsx("div",{className:"nk-sidebar__user-details",children:h}),r!=null&&r.length?o.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(({"aria-label":u,icon:a,label:f,...m})=>o.jsx(ue.Tooltip2,{content:f,children:o.jsx(z.Button,{...m,"aria-label":u??f,className:"nk-sidebar__user-action",icon:a,shape:"rectangle",type:"button",variant:"ghost"})},f))}):null]})}),Ie=()=>()=>{},Z=()=>{};function Pe(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??Ie,(e==null?void 0:e.read)??Z,Z);return s!=="responsive"?s:r===void 0?"pending":r>=fe.breakpoint("medium")?"inline":"overlay"}const Be=32,Le=t.forwardRef(function(n,e){var X;const{defaultOpen:r=!1,height:b,initialFocusReference:d,lockScroll:l=!0,onOpenChange:i,open:S,restoreFocus:p=!0,side:y="left",variant:c="responsive",width:h,...u}=n,a=R.useBoundary("Sidebar"),f=`${t.useId()}-sidebar`,m=t.useRef(Symbol("nk-sidebar")).current,E=t.useRef(null),v=Pe(c,a==null?void 0:a.width),k=S!==void 0,[P,B]=t.useState(r),[I,j]=t.useState(0),[L,te]=t.useState(!1),V=t.useRef(null),N=k?S:P,w=t.useRef(i);R.useIsomorphicLayoutEffect(()=>{w.current=i});const O=t.useCallback((g,x)=>{var C;N!==g&&(k||B(g),(C=w.current)==null||C.call(w,g,x))},[k,N]),$=t.useCallback(g=>{E.current=g,U.assignElementReference(e,g)},[e]),_=t.useMemo(()=>[E],[]),K=t.useCallback(g=>{_.push({current:g}),j(x=>x+1)},[_]),Y=t.useCallback(g=>{const x=_.findIndex(C=>C.current===g);x>0&&_.splice(x,1),j(C=>Math.max(C-1,0))},[_]),se=t.useCallback(g=>{const x=V.current;if(x&&x!==g){const C=_.findIndex(ae=>ae.current===x);C>0&&_.splice(C,1)}V.current=g,g&&_.push({current:g})},[_]),A=t.useMemo(()=>({id:f,open:N,presentation:v,registerTrigger:K,requestOpenChange:O,unregisterTrigger:Y,variant:c}),[N,f,v,K,O,Y,c]);R.useIsomorphicLayoutEffect(()=>{const g=a==null?void 0:a.boundaryElement;if(!g)return;if(pe(g,m,A)===!1)throw new Error("A Boundary supports one Sidebar. Neatkit resolves Trigger, Group, and Item interactions against the single Sidebar published to the nearest Boundary, so give each Sidebar a Boundary of its own.")},[a==null?void 0:a.boundaryElement,m,A]),R.useIsomorphicLayoutEffect(()=>{const g=a==null?void 0:a.boundaryElement;if(g)return()=>he(g,m)},[a==null?void 0:a.boundaryElement,m]),t.useEffect(()=>{v==="inline"&&O(!1,"variant")},[v,O]),t.useEffect(()=>{var C;const g=(C=a==null?void 0:a.boundaryElement)==null?void 0:C.ownerDocument.defaultView;if(!g)return;const x=g.setTimeout(()=>te(!0),Be);return()=>g.clearTimeout(x)},[a==null?void 0:a.boundaryElement]);const M=T.usePresence(N&&v==="overlay"),J=((X=a==null?void 0:a.boundaryElement)==null?void 0:X.ownerDocument)??(typeof document>"u"?null:document);if(v!=="overlay")return o.jsx(re,{...u,height:b,open:!1,panelId:f,panelReference:$,presentation:v,side:y,width:h});const Q=L&&I===0?o.jsx(T.Portal,{children:o.jsx(be,{label:`Open ${u["aria-label"]??"Sidebar"}`,onToggle:()=>O(!N,"trigger"),panelId:M.present?f:void 0,reference:se,side:y,sidebarOpen:N})}):null;return!M.present||!J?Q:o.jsxs(o.Fragment,{children:[Q,o.jsx(T.Portal,{children:o.jsx(Ne,{...u,boundaries:_,initialFocusReference:d,lockScroll:l,ownerDocument:J,panelReference:$,presenceState:M.state==="closing"?"closing":"open",restoreFocus:p,side:y,sidebar:A,width:h})})]})}),Oe=Object.assign(Le,{Footer:ee,Group:ye,Header:Se,Item:ke,Trigger:Re,User:Te});exports.default=Oe;
|
package/dist/Sidebar.js
CHANGED
|
@@ -3,16 +3,16 @@ import { jsx as u, jsxs as I, Fragment as le } from "react/jsx-runtime";
|
|
|
3
3
|
import { useCallback as k, useSyncExternalStore as ce, forwardRef as O, useId as de, createElement as Se, useState as D, useRef as L, Children as ke, isValidElement as re, Fragment as ue, cloneElement as $, useContext as _e, useMemo as te, useEffect as ae } from "react";
|
|
4
4
|
import { u as K, a as M } from "./effects-DGbA6Q2O.js";
|
|
5
5
|
import { g as Ee, a as fe } from "./reference-CXMr27nM.js";
|
|
6
|
-
import { F as se, c as Ce, d as Ne, b as Te, P as ie } from "./usePresence-
|
|
6
|
+
import { F as se, c as Ce, d as Ne, b as Te, P as ie } from "./usePresence-DrCnSPkG.js";
|
|
7
7
|
import { B as Y } from "./Button-Dsr1zrKT.js";
|
|
8
8
|
import { T as V } from "./Text-rN6iDo0V.js";
|
|
9
|
-
import { u as Pe } from "./useFocusTrap-
|
|
9
|
+
import { u as Pe } from "./useFocusTrap-BnreoiCP.js";
|
|
10
10
|
import { u as Ie } from "./useScrollLock-Drd7OZRC.js";
|
|
11
11
|
import { m as Le } from "./aria-Bv-xVREf.js";
|
|
12
12
|
import { r as Be } from "./useFloatingPosition-DktY7k-t.js";
|
|
13
13
|
import { A as Oe } from "./Avatar-DjDCFqNG.js";
|
|
14
14
|
import { S as z } from "./Skeleton-CEWiIR1S.js";
|
|
15
|
-
import { T as Re } from "./Tooltip-
|
|
15
|
+
import { T as Re } from "./Tooltip-DiGwnVOH.js";
|
|
16
16
|
import { b as Fe } from "./units-nWP5zzIH.js";
|
|
17
17
|
function xe(t) {
|
|
18
18
|
const { label: n, onToggle: e, panelId: r, reference: f, side: l, sidebarOpen: i } = t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const r=require("react/jsx-runtime"),o=require("react"),H=require("./reference-C2guRuR0.cjs"),D=require("./Surface-BttJYSDt.cjs"),K=require("./Button-DyO8fkk1.cjs"),O=require("./Tooltip-
|
|
1
|
+
"use client";"use strict";const r=require("react/jsx-runtime"),o=require("react"),H=require("./reference-C2guRuR0.cjs"),D=require("./Surface-BttJYSDt.cjs"),K=require("./Button-DyO8fkk1.cjs"),O=require("./Tooltip-DhSawjGg.cjs"),j=o.createContext("body"),w=o.forwardRef(function(l,e){const{align:t="left",children:s,className:i,scope:c="col",sticky:b=!1,...d}=l;return r.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 o.Children.toArray(n)){if(o.isValidElement(l)&&l.type===o.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 r.jsx(O.Tooltip2,{content:t,children:r.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 r.jsx("td",{className:"nk-table__cell nk-table__action-cell","data-align":"right",onClick:e,children:l.length>0?r.jsx("span",{className:"nk-table__action-list",children:l.map(t=>o.createElement(F,{...t,key:t.label}))}):null})}const q=o.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 r.jsx("tbody",{...b,ref:e,className:["nk-table__body",s].filter(Boolean).join(" "),children:d&&c!==void 0?r.jsxs("tr",{className:"nk-table__row",children:[r.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"}),r.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:h,children:r.jsx("div",{className:"nk-table__empty-content",children:c})}),r.jsx(P,{actions:[]})]}):r.jsx(j.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=o.forwardRef(function(l,e){const{align:t="left",children:s,className:i,format:c,title:b,truncate:d,value:h,...k}=l,{rowTrigger:a,...u}=k,p=z(h,s,c),f=d===void 0?void 0:{maxWidth:d},_=b??(d===void 0?void 0:V(p));return r.jsxs("td",{...u,ref:e,className:["nk-table__cell",i].filter(Boolean).join(" "),"data-align":t,title:_,children:[(a==null?void 0:a.kind)==="link"&&a.linkProperties?r.jsx("a",{ref:a.reference,"aria-label":a.ariaLabel,className:"nk-table__row-trigger",download:a.linkProperties.download,href:a.linkProperties.href,hrefLang:a.linkProperties.hrefLang,onClick:a.linkProperties.onNavigate,rel:a.linkProperties.rel,target:a.linkProperties.target}):null,(a==null?void 0:a.kind)==="button"?r.jsx("button",{ref:a.reference,"aria-label":a.ariaLabel,className:"nk-table__row-trigger",onClick:a.onClick,type:"button"}):null,d!==void 0?r.jsx("span",{className:"nk-table__truncated-content",style:f,children:p}):p]})}),M=o.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return r.jsx("tfoot",{...i,ref:e,className:["nk-table__foot",s].filter(Boolean).join(" "),children:r.jsx(j.Provider,{value:"foot",children:t})})}),Y=o.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return r.jsx("thead",{...i,ref:e,className:["nk-table__head",s].filter(Boolean).join(" "),children:r.jsx(j.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 o.Children.map(i,c=>o.isValidElement(c)?c.type===o.Fragment?o.cloneElement(c,void 0,t(c.props.children)):!e&&c.type===E?(e=!0,o.cloneElement(c,{rowTrigger:l})):c:c)}const s=t(n);return{attached:e,content:s}}const Q=o.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return r.jsx(w,{...i,ref:e,align:"right",className:["nk-table__action-header-cell",s].filter(Boolean).join(" "),children:t??r.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),U=o.forwardRef(function(l,e){const{"aria-label":t,actions:s,children:i,className:c,download:b,href:d,hrefLang:h,onClick:k,onNavigate:a,rel:u,target:p,...f}=l,_=o.useRef(null),x=o.useContext(j),g=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 C;d!==void 0?C={ariaLabel:N,kind:"link",linkProperties:{download:b,href:d,hrefLang:h,onNavigate:a,rel:u,target:p},reference:T}:k!==void 0&&(C={ariaLabel:N,kind:"button",onClick:k,reference:T});const B=C?J(i,C):{content:i};function L(m){if(m.defaultPrevented)return;const y=m.target;if(!(y instanceof Element)||G(y,m.currentTarget))return;const v=_.current;if(!v)return;const R=v.ownerDocument.defaultView;if(!R){v.click();return}v.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=x==="head"?r.jsx(Q,{}):r.jsx(P,{actions:s??[]}),I=x==="head"?r.jsx("th",{"aria-hidden":"true",className:"nk-table__header-cell nk-table__overscroll-start-cell"}):r.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"});return r.jsxs("tr",{...f,ref:e,"aria-label":g?void 0:t,className:["nk-table__row",c].filter(Boolean).join(" "),"data-interactive":g||void 0,onClick:g?L:void 0,children:[I,B.content,A]})});function W(){const n=o.useRef(null),l=o.useRef(null),[e,t]=o.useState(!1),[s,i]=o.useState(!1);o.useEffect(()=>{const b=n.current,d=l.current;if(!b||!d)return;const h=b,k=d;function a(){const _=h.scrollWidth>h.clientWidth;t(_),_||i(!1)}a();const u=h.ownerDocument.defaultView;u==null||u.addEventListener("resize",a);const p=u==null?void 0:u.ResizeObserver,f=p?new p(a):void 0;return f==null||f.observe(h),f==null||f.observe(k),()=>{u==null||u.removeEventListener("resize",a),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=o.forwardRef(function(l,e){const{"aria-label":t,children:s,className:i,containerClassName:c,frame:b="outline",spacing:d="standard",...h}=l,{containerReference:k,contentReference:a,isScrollable:u,isScrolled:p,handleScroll:f}=W(),_=t?`${t} scroll area`:"Scrollable table",x=o.useCallback(g=>{a.current=g,H.assignElementReference(e,g)},[a,e]);return r.jsx(D.Surface,{ref:k,"aria-label":u?_:void 0,className:["nk-table",c].filter(Boolean).join(" "),"data-frame":b,"data-scrolled":p||void 0,"data-spacing":d,onScroll:f,role:u?"region":void 0,tabIndex:u?0:void 0,children:r.jsx("table",{...h,ref:x,"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;
|
|
@@ -4,7 +4,7 @@ import { createContext as V, forwardRef as _, Children as L, isValidElement as j
|
|
|
4
4
|
import { a as G } from "./reference-CXMr27nM.js";
|
|
5
5
|
import { S as J } from "./Surface-vEFsZC12.js";
|
|
6
6
|
import { B as Q } from "./Button-Dsr1zrKT.js";
|
|
7
|
-
import { T as U } from "./Tooltip-
|
|
7
|
+
import { T as U } from "./Tooltip-DiGwnVOH.js";
|
|
8
8
|
const T = V("body"), I = _(function(l, e) {
|
|
9
9
|
const {
|
|
10
10
|
align: t = "left",
|
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-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-CJmczuqs.cjs");exports.default=e.Table;
|
package/dist/Table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const m=require("react/jsx-runtime"),n=require("react"),be=require("./aria-DM-xYEHQ.cjs"),W=require("./reference-C2guRuR0.cjs"),G=require("./useFloatingPosition-DPVO2E8O.cjs"),Ee=require("./effects-D98vUn6N.cjs"),F=require("./usePresence-
|
|
1
|
+
"use client";"use strict";const m=require("react/jsx-runtime"),n=require("react"),be=require("./aria-DM-xYEHQ.cjs"),W=require("./reference-C2guRuR0.cjs"),G=require("./useFloatingPosition-DPVO2E8O.cjs"),Ee=require("./effects-D98vUn6N.cjs"),F=require("./usePresence-WXhrarsC.cjs"),ye=require("./focus-restoration-70WcQRr5.cjs"),Ie=require("./Surface-BttJYSDt.cjs"),he=500,K=n.createContext(null);function De(s){const{children:p,delay:i=he}=s,c=n.useMemo(()=>({delay:i}),[i]);return m.jsx(K.Provider,{value:c,children:p})}const Q=500,J=100;function ve(s,p,i,c){p.current=s,W.assignElementReference(i,s),W.assignElementReference(c,s)}function Pe(s){return Number.isFinite(s)?Math.max(0,s):Q}const Le=n.forwardRef(function(p,i){const{children:c,align:B="center",className:X,content:d,contentClassName:Z,contentStyle:N,delay:ee,disabled:g=!1,onOpenChange:I,placement:S="top",style:ne}=p;if(d==null||typeof d=="boolean"||typeof d=="string"&&!d.trim())throw new Error("Tooltip content must not be empty");if(c.type===n.Fragment)throw new Error("Tooltip requires a single non-Fragment trigger");const V=`${n.useId()}-tooltip`,k=n.useContext(K),O=c.props,A=W.getElementReference(c),T=n.useRef(null),C=n.useRef(null),z=n.useRef(g),_=n.useRef(!1),h=n.useRef(null),D=n.useRef(null),v=n.useRef(null),P=n.useRef(!1),R=n.useRef(!1),w=n.useRef(!1),u=n.useRef(!1),[b,re]=n.useState(null),[te,oe]=n.useState(null),[L,se]=n.useState(!1);z.current=g;const x=Pe(ee??(k==null?void 0:k.delay)??Q),E=F.usePresence(L),Y=(b==null?void 0:b.ownerDocument)??(typeof document>"u"?null:document),M=Ee.useBoundary("Tooltip").boundaryElement,q=F.useOverlayLayer(E.present,M),l=G.useFloatingPosition(E.present,S,b,te,M,B),ce=n.useMemo(()=>[T,C],[]),ie=be.mergeIdentifiers(O["aria-describedby"],V),ue=L&&E.present?ie:O["aria-describedby"],H=n.useCallback(e=>{ve(e,T,A,i),re(e)},[i,A]),le=n.useCallback(e=>{C.current=e,e||(u.current=!1),oe(e)},[]),t=n.useCallback(()=>{const e=h.current;e&&e.ownerWindow.clearTimeout(e.timerId),h.current=null},[]),o=n.useCallback(()=>{const e=D.current;e&&e.ownerWindow.clearTimeout(e.timerId),D.current=null},[]),y=n.useCallback(()=>{const e=v.current;e&&e.ownerWindow.clearTimeout(e.timerId),v.current=null},[]),r=n.useCallback(e=>{_.current!==e&&(e||(u.current=!1),_.current=e,se(e),I==null||I(e))},[I]),j=n.useCallback(e=>{var U,$;if(o(),R.current||w.current||u.current)return;if(e===0){r(!1);return}const a=((U=T.current)==null?void 0:U.ownerDocument.defaultView)??(($=C.current)==null?void 0:$.ownerDocument.defaultView);if(!a){r(!1);return}const f=a.setTimeout(()=>{D.current=null,!R.current&&!w.current&&!u.current&&r(!1)},e);D.current={ownerWindow:a,timerId:f}},[o,r]),ae=n.useCallback(()=>{var f;if(t(),o(),x===0){r(!0);return}const e=(f=T.current)==null?void 0:f.ownerDocument.defaultView;if(!e)return;const a=e.setTimeout(()=>{h.current=null,z.current||r(!0)},x);h.current={ownerWindow:e,timerId:a}},[o,t,x,r]);function fe(e){if(R.current=!0,o(),P.current||ye.isElementFocusRestoration(e.currentTarget)){t();return}t(),r(!0)}function de(e){e.currentTarget.contains(e.relatedTarget)||(R.current=!1,t(),j(0))}function me(){w.current=!0,ae()}function pe(){w.current=!1,t(),j(J)}function ge(){u.current=!0,o()}function Te(){u.current=!1,j(J)}function Re(){var f;t(),o(),r(!1);const e=(f=T.current)==null?void 0:f.ownerDocument.defaultView;if(!e)return;P.current=!0,y();const a=e.setTimeout(()=>{P.current=!1,v.current=null},0);v.current={ownerWindow:e,timerId:a}}if(F.useDismissableLayer({boundary:M,active:L,boundaries:ce,dismissOnOutsideInteraction:"pass-through",layerId:q.id,onEscapeDismiss:()=>r(!1),onOutsideDismiss:()=>r(!1),ownerDocument:Y}),n.useEffect(()=>{g&&(t(),o(),y(),P.current=!1,R.current=!1,w.current=!1,u.current=!1,_.current&&r(!1))},[o,t,y,g,r]),n.useEffect(()=>{},[b]),n.useEffect(()=>()=>{t(),o(),y()},[o,t,y]),g)return n.cloneElement(c,{ref:H});const we=n.cloneElement(c,G.resolveTriggerOverrides(O,{"aria-describedby":ue,className:["nk-tooltip__trigger",X].filter(Boolean).join(" "),onBlur:de,onFocus:fe,onMouseEnter:me,onMouseLeave:pe,onPointerDown:Re,ref:H,style:ne}));return m.jsxs(m.Fragment,{children:[we,E.present&&Y?m.jsx(F.Portal,{children:m.jsxs(Ie.Surface,{ref:le,"aria-hidden":L?void 0:!0,className:["nk-tooltip",Z].filter(Boolean).join(" "),"data-placement":(l==null?void 0:l.placement)??S,"data-align":B,"data-state":E.state==="closing"?"closing":"open",id:V,onMouseEnter:ge,onMouseLeave:Te,role:"tooltip",style:l?{...N,"--nk-tooltip-arrow-offset":`${l.arrowOffset}px`,left:l.left,top:l.top,zIndex:q.zIndex}:{...N,visibility:"hidden",zIndex:q.zIndex},children:[m.jsx("span",{"aria-hidden":"true",className:"nk-tooltip__arrow"}),d]})}):null]})}),Fe=Object.assign(Le,{Provider:De});exports.Tooltip2=Fe;
|
|
@@ -5,7 +5,7 @@ import { m as Oe } from "./aria-Bv-xVREf.js";
|
|
|
5
5
|
import { g as _e, a as Q } from "./reference-CXMr27nM.js";
|
|
6
6
|
import { u as Me, r as xe } from "./useFloatingPosition-DktY7k-t.js";
|
|
7
7
|
import { u as We } from "./effects-DGbA6Q2O.js";
|
|
8
|
-
import { b as ke, c as Be, d as Ne, P as Ve } from "./usePresence-
|
|
8
|
+
import { b as ke, c as Be, d as Ne, P as Ve } from "./usePresence-DrCnSPkG.js";
|
|
9
9
|
import { i as Ae } from "./focus-restoration-BvNZzrQA.js";
|
|
10
10
|
import { S as Ce } from "./Surface-vEFsZC12.js";
|
|
11
11
|
const je = 500, ee = De(null);
|
package/dist/Tooltip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-DhSawjGg.cjs");exports.default=e.Tooltip2;
|
package/dist/Tooltip.js
CHANGED
|
@@ -7,7 +7,7 @@ export type { ModalFooterProps } from "./components/ModalFooter";
|
|
|
7
7
|
/** A type representing an interaction that requests Modal closure. */
|
|
8
8
|
export type ModalCloseReason = "close-button" | "escape" | "outside";
|
|
9
9
|
/** A type representing the internal spacing applied to a Modal region. */
|
|
10
|
-
export type ModalSpacing = "none" | "standard";
|
|
10
|
+
export type ModalSpacing = "none" | "standard" | "spacious";
|
|
11
11
|
/** A type representing the complete compound Modal component. */
|
|
12
12
|
type ModalComponent = typeof ModalRoot & {
|
|
13
13
|
/** The content region that scrolls beneath the Modal heading. */
|
|
@@ -46,6 +46,9 @@ export type ModalProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onCl
|
|
|
46
46
|
* regions cannot fit, the panel also scrolls to keep them reachable. The panel
|
|
47
47
|
* accepts native sizing styles.
|
|
48
48
|
*
|
|
49
|
+
* Without a title, the close button floats over the top-right corner.
|
|
50
|
+
* Consumers can reserve room for it in their content layout when needed.
|
|
51
|
+
*
|
|
49
52
|
* @param props - The properties that configure the Modal.
|
|
50
53
|
* @param forwardedReference - The reference assigned to the Modal panel.
|
|
51
54
|
*
|