neatkit 0.10.0 → 0.11.0
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/Boundary.cjs +1 -1
- package/dist/Boundary.js +191 -120
- package/dist/{Button-CVe9T_Zw.cjs → Button-DtrX4X-s.cjs} +1 -1
- package/dist/{Button-D6rXvcqq.js → Button-LmEHdRkW.js} +1 -1
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.js +2 -2
- package/dist/Field.cjs +1 -1
- package/dist/Field.js +57 -62
- package/dist/Icon-CMSHMSDJ.cjs +1 -0
- package/dist/{Icon-CxK1wlGk.js → Icon-NT3kRJYz.js} +275 -94
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +2 -2
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +1 -1
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +4 -4
- package/dist/PinInput.cjs +1 -1
- package/dist/PinInput.js +1 -1
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +117 -119
- package/dist/Radio.cjs +1 -1
- package/dist/Radio.js +1 -1
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +12 -11
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +373 -324
- package/dist/Switch.cjs +1 -1
- package/dist/Switch.js +1 -1
- package/dist/{Table-BqWBgMTU.cjs → Table-Bjw9lUKS.cjs} +1 -1
- package/dist/{Table-DutHfiXR.js → Table-GeoE4h-u.js} +2 -2
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/TextArea.cjs +1 -1
- package/dist/TextArea.js +1 -1
- package/dist/Tooltip-CpyROf6x.js +225 -0
- package/dist/Tooltip-DDPh_YFO.cjs +1 -0
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/aria-Bv-xVREf.js +17 -0
- package/dist/aria-DM-xYEHQ.cjs +1 -0
- package/dist/components/Boundary/hooks/useDocumentBackground.d.ts +28 -0
- package/dist/components/Icon/icons/AppleIcon.d.ts +11 -0
- package/dist/components/Icon/icons/BingIcon.d.ts +11 -0
- package/dist/components/Icon/icons/FacebookIcon.d.ts +11 -0
- package/dist/components/Icon/icons/GoogleIcon.d.ts +11 -0
- package/dist/components/Icon/icons/InstagramIcon.d.ts +11 -0
- package/dist/components/Icon/icons/MicrosoftIcon.d.ts +11 -0
- package/dist/components/Icon/icons/TwitterIcon.d.ts +11 -0
- package/dist/components/Icon/utils/registry.d.ts +7 -0
- package/dist/components/PinInput/PinInput.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Sidebar/components/SidebarFallbackTrigger.d.ts +32 -0
- package/dist/components/Sidebar/components/SidebarPanel.d.ts +1 -1
- package/dist/components/Sidebar/components/SidebarTrigger.d.ts +4 -0
- package/dist/effects-D98vUn6N.cjs +1 -0
- package/dist/effects-DGbA6Q2O.js +18 -0
- package/dist/style.css +1 -1
- package/dist/useFloatingPosition-DQgw-w_Z.cjs +1 -0
- package/dist/useFloatingPosition-MGoyautY.js +57 -0
- package/dist/{useFocusTrap-C0IcCdNf.js → useFocusTrap-BxPazAL6.js} +1 -1
- package/dist/{useFocusTrap-gAK_402D.cjs → useFocusTrap-CrMcAu8s.cjs} +1 -1
- package/dist/{usePresence-CqegYqy4.js → usePresence-BTRY1_l-.js} +47 -56
- package/dist/usePresence-Dm0mls5p.cjs +1 -0
- package/dist/utils/aria.d.ts +4 -5
- package/dist/utils/trigger.d.ts +46 -0
- package/package.json +1 -1
- package/dist/Icon-BIBzgznI.cjs +0 -1
- package/dist/Tooltip-CCuE-hfp.cjs +0 -1
- package/dist/Tooltip-CeyRKNv4.js +0 -231
- package/dist/aria-Bntn6ad_.cjs +0 -1
- package/dist/aria-CeA9QfD1.js +0 -15
- package/dist/effects-D5CWf-Pl.js +0 -8
- package/dist/effects-D85L_7zM.cjs +0 -1
- package/dist/useFloatingPosition-Dq8xpr3E.js +0 -27
- package/dist/useFloatingPosition-g5kXywoB.cjs +0 -1
- package/dist/usePresence-B5RYv4e1.cjs +0 -1
package/dist/Input.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),t=require("react"),x=require("./Button-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),t=require("react"),x=require("./Button-DtrX4X-s.cjs"),$=require("./Spinner-BE0F4y2S.cjs"),S=require("./aria-DM-xYEHQ.cjs"),F=require("./reference-C2guRuR0.cjs");function v(e){return Array.isArray(e)?e.length>0:e!=null&&String(e).length>0}function G(e,s,n){s.current=e,F.assignElementReference(n,e)}function J(e){var n;const s=(n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value"))==null?void 0:n.set;s?s.call(e,""):e.value=""}const K=t.forwardRef(function(s,n){const{"aria-busy":V,"aria-invalid":b,className:m,clearable:y=!1,defaultValue:g,disabled:C=!1,id:A,invalid:h=!1,loading:l=!1,onChange:d,readOnly:p=!1,style:N,type:r="text",value:o,...P}=s,q=t.useId(),I=t.useRef(null),[O,R]=t.useState(v(g)),[c,w]=t.useState(!1);t.useEffect(()=>{r!=="password"&&w(!1)},[r]);const B=t.useCallback(a=>G(a,I,n),[n]),f=A??`${q}-control`,u=C||l,T=h||S.hasInvalidState(b),E=o!==void 0?v(o):O,D=r==="password"&&c?"text":r,H=S.resolveAriaInvalid(h,b),_=y&&E&&!p&&!u,j=r==="password"&&!l,k=_||j;function M(a){o===void 0&&R(v(a.currentTarget.value)),d==null||d(a)}function U(){const a=I.current;a&&(J(a),a.dispatchEvent(new Event("input",{bubbles:!0})),a.focus())}function z(){w(a=>!a)}return i.jsxs("div",{className:["nk-input",m].filter(Boolean).join(" "),"data-clearable":y||void 0,"data-disabled":u||void 0,"data-invalid":T||void 0,"data-loading":l||void 0,"data-read-only":p||void 0,"data-has-trailing-action":k||void 0,style:N,children:[i.jsx("input",{...P,ref:B,"aria-busy":l?!0:V,"aria-invalid":H,className:"nk-input__control",defaultValue:g,disabled:u,id:f,onChange:M,readOnly:p,type:D,value:o}),k?i.jsxs("span",{className:"nk-input__trailing",children:[_?i.jsx(x.Button,{"aria-controls":f,"aria-label":"Clear input",className:"nk-input__action",icon:"cross",onClick:U,shape:"rectangle",type:"button",variant:"ghost"}):null,j?i.jsx(x.Button,{"aria-controls":f,"aria-label":c?"Hide password":"Show password","aria-pressed":c,className:"nk-input__action",disabled:u,icon:c?"eye-off":"eye",onClick:z,shape:"rectangle",type:"button",variant:"ghost"}):null]}):null,l?i.jsx($.Spinner,{"aria-hidden":"true","aria-label":void 0,className:"nk-input__spinner",role:void 0,size:14}):null]})});exports.default=K;
|
package/dist/Input.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as _, jsx as d } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as F, useId as G, useRef as J, useState as V, useEffect as K, useCallback as L } from "react";
|
|
4
|
-
import { B as C } from "./Button-
|
|
4
|
+
import { B as C } from "./Button-LmEHdRkW.js";
|
|
5
5
|
import { S as M } from "./Spinner-CmxlDlOk.js";
|
|
6
|
-
import { h as Q, r as W } from "./aria-
|
|
6
|
+
import { h as Q, r as W } from "./aria-Bv-xVREf.js";
|
|
7
7
|
import { a as X } from "./reference-CXMr27nM.js";
|
|
8
8
|
function f(a) {
|
|
9
9
|
return Array.isArray(a) ? a.length > 0 : a != null && String(a).length > 0;
|
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-B7s_rN0G.cjs"),Q=require("./Divider-C7XGlr26.cjs"),_=require("./Table-BqWBgMTU.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(l=>re(r,l))?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 l=R(n,o,a);return l?`${l}${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:l,...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,...l}=t;return d.jsx("blockquote",{...l,className:"nk-markdown__blockquote",children:n})},code:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,...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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,src:i,srcSet:c,...b}=t,x=R(typeof i=="string"?i:"",e,o),L=v(c,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:l,...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:l,...i}=t,c=(r==null?void 0:r.split(/\s+/).includes("task-list-item"))??!1;return d.jsx("li",{...i,className:["nk-markdown__list-item",c?"nk-markdown__list-item--task":void 0].filter(Boolean).join(" "),children:n})},ol:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,...i}=t,c=(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",c?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})},p:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,className:["nk-markdown__paragraph",r].filter(Boolean).join(" "),children:n})},picture:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,...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:l,...i}=t,c=ie(u);return c?d.jsx(X.Code,{code:c.content,codeProps:c.codeProps,language:ee(c.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:l,...i}=t,c=v(l,e,o);return c?d.jsx("source",{...i,srcSet:c}):null},table:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...l}=t;return d.jsx(_.Table,{...l,children:n})},tbody:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...l}=t;return d.jsx(_.Table.Body,{...l,children:n})},td:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:l,style:i,...c}=t;return d.jsx(_.Table.Cell,{...c,align:C((i==null?void 0:i.textAlign)??n),children:r})},th:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:l,style:i,...c}=t;return d.jsx(_.Table.HeaderCell,{...c,align:C((i==null?void 0:i.textAlign)??n),children:r})},thead:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...l}=t;return d.jsx(_.Table.Head,{...l,children:n})},tr:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,onClick:l,...i}=t;return d.jsx(_.Table.Row,{...i,children:n})},ul:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,...i}=t,c=(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",c?"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:l,maxContentLength:i=ce,rehypePlugins:c,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,l,j),[f,j,r,u,l]),q=M.useMemo(()=>[J,...b??[]],[b]),$=M.useMemo(()=>[W,...c??[],oe,V,[se,{clobberPrefix:A,prefix:m}],[H,ne]],[m,c]),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-B7s_rN0G.cjs"),Q=require("./Divider-C7XGlr26.cjs"),_=require("./Table-Bjw9lUKS.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(l=>re(r,l))?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 l=R(n,o,a);return l?`${l}${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:l,...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,...l}=t;return d.jsx("blockquote",{...l,className:"nk-markdown__blockquote",children:n})},code:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,...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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,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:l,src:i,srcSet:c,...b}=t,x=R(typeof i=="string"?i:"",e,o),L=v(c,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:l,...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:l,...i}=t,c=(r==null?void 0:r.split(/\s+/).includes("task-list-item"))??!1;return d.jsx("li",{...i,className:["nk-markdown__list-item",c?"nk-markdown__list-item--task":void 0].filter(Boolean).join(" "),children:n})},ol:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,...i}=t,c=(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",c?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})},p:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,ref:i,...c}=t;return d.jsx(k.Text,{...c,className:["nk-markdown__paragraph",r].filter(Boolean).join(" "),children:n})},picture:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,...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:l,...i}=t,c=ie(u);return c?d.jsx(X.Code,{code:c.content,codeProps:c.codeProps,language:ee(c.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:l,...i}=t,c=v(l,e,o);return c?d.jsx("source",{...i,srcSet:c}):null},table:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...l}=t;return d.jsx(_.Table,{...l,children:n})},tbody:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...l}=t;return d.jsx(_.Table.Body,{...l,children:n})},td:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:l,style:i,...c}=t;return d.jsx(_.Table.Cell,{...c,align:C((i==null?void 0:i.textAlign)??n),children:r})},th:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:l,style:i,...c}=t;return d.jsx(_.Table.HeaderCell,{...c,align:C((i==null?void 0:i.textAlign)??n),children:r})},thead:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...l}=t;return d.jsx(_.Table.Head,{...l,children:n})},tr:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,onClick:l,...i}=t;return d.jsx(_.Table.Row,{...i,children:n})},ul:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:l,...i}=t,c=(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",c?"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:l,maxContentLength:i=ce,rehypePlugins:c,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,l,j),[f,j,r,u,l]),q=M.useMemo(()=>[J,...b??[]],[b]),$=M.useMemo(()=>[W,...c??[],oe,V,[se,{clobberPrefix:A,prefix:m}],[H,ne]],[m,c]),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-Bp2X1k-g.js";
|
|
11
11
|
import { D as te } from "./Divider-DZgpYpr-.js";
|
|
12
|
-
import { T as _ } from "./Table-
|
|
12
|
+
import { T as _ } from "./Table-GeoE4h-u.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 t=require("react/jsx-runtime"),s=require("react"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),s=require("react"),g=require("./effects-D98vUn6N.cjs"),$=require("./reference-C2guRuR0.cjs"),G=require("./Button-DtrX4X-s.cjs"),r=require("./usePresence-Dm0mls5p.cjs"),H=require("./useFocusTrap-CrMcAu8s.cjs"),J=require("./useScrollLock-Dy8MZaSn.cjs"),K=require("./Surface-BttJYSDt.cjs"),Q=require("./Text-DWYlIcPj.cjs");function U(c,n,l){n.current=c,$.assignElementReference(l,c)}function V(c){const{"aria-label":n,"aria-labelledby":l,children:a,className:v,closeButtonLabel:f="Close modal",exitable:i=!0,forwardedReference:u,initialFocusReference:d,lockScroll:m=!0,onClose:e,open:o,ownerDocument:R,presenceState:k,restoreFocus:q=!0,role:F="dialog",style:I,title:b,trapFocus:S=!0,...P}=c,j=s.useRef(null),_=s.useRef(null),w=s.useContext(r.FocusScopeContext),B=`${s.useId()}-title`,[y,E]=s.useState(null),p=g.useBoundary("Modal").boundaryElement,x=r.useOverlayLayer(!0,p),M=s.useMemo(()=>[j],[]),h=!!(b!=null&&b.trim()),N=d??(h?_:void 0),O=l??(n===void 0&&h?B:void 0),T=s.useCallback(L=>{U(L,j,u),E(L)},[u]);g.useIsomorphicLayoutEffect(()=>{y&&(y.inert=!o)},[y,o]);const C=s.useCallback(()=>{e==null||e("escape")},[e]),z=s.useCallback(()=>{e==null||e("outside")},[e]);r.useDismissableLayer({boundary:p,active:o,boundaries:M,dismissOnEscape:i,dismissOnPointerDownOutside:i,layerId:x.id,onEscapeDismiss:C,onPointerDownOutsideDismiss:z,ownerDocument:R});const A=H.useFocusTrap({boundary:p,active:o&&S,container:y,initialFocusReference:N,layerId:x.id,restoreFocus:q});J.useScrollLock(m,R,p);const D=i?t.jsx(G.Button,{"aria-label":f,className:"nk-modal__close",icon:"cross",onClick:()=>e==null?void 0:e("close-button"),shape:"rectangle",type:"button",variant:"ghost"}):null;return t.jsx(r.FocusScopeContext.Provider,{value:o&&S?A:w,children:t.jsx("div",{className:"nk-modal__overlay","data-state":k,role:"presentation",style:{zIndex:x.zIndex},children:t.jsx("div",{className:"nk-modal__viewport",children:t.jsxs(K.Surface,{...P,ref:T,"aria-hidden":o?void 0:!0,"aria-label":o?n:void 0,"aria-labelledby":o?O:void 0,"aria-modal":o?"true":void 0,className:["nk-modal",v].filter(Boolean).join(" "),"data-state":k,role:o?F:void 0,style:I,tabIndex:-1,children:[h?t.jsxs("div",{className:"nk-modal__header",children:[t.jsx(Q.Text,{as:"h2",className:"nk-modal__title",id:B,ref:_,size:"subtitle",tabIndex:-1,weight:"semibold",children:b}),D]}):D,a]})})})})}const W=s.forwardRef(function(n,l){const{open:a}=n,v=g.useBoundary("Modal"),f=s.useRef(n);a&&(f.current=n);const i=a?n:f.current,u=r.usePresence(a),d=v.boundaryElement,m=(d==null?void 0:d.ownerDocument)??(typeof document>"u"?null:document);return!u.present||!m?null:t.jsx(r.Portal,{children:t.jsx(V,{...i,forwardedReference:l,open:a,ownerDocument:m,presenceState:u.state==="closing"?"closing":"open"})})});exports.default=W;
|
package/dist/Modal.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as s, jsxs as _ } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as H, useRef as g, useContext as J, useId as K, useState as Q, useMemo as U, useCallback as h } from "react";
|
|
4
|
-
import { u as V } from "./effects-
|
|
4
|
+
import { u as E, a as V } from "./effects-DGbA6Q2O.js";
|
|
5
5
|
import { a as W } from "./reference-CXMr27nM.js";
|
|
6
|
-
import { B as X } from "./Button-
|
|
7
|
-
import { b as
|
|
8
|
-
import { u as ae } from "./useFocusTrap-
|
|
6
|
+
import { B as X } from "./Button-LmEHdRkW.js";
|
|
7
|
+
import { b as Y, P as Z, F as w, c as ee, d as oe } from "./usePresence-BTRY1_l-.js";
|
|
8
|
+
import { u as ae } from "./useFocusTrap-BxPazAL6.js";
|
|
9
9
|
import { u as se } from "./useScrollLock-Drd7OZRC.js";
|
|
10
10
|
import { S as ne } from "./Surface-vEFsZC12.js";
|
|
11
11
|
import { T as te } from "./Text-rN6iDo0V.js";
|
package/dist/PinInput.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react/jsx-runtime"),v=require("react"),G=require("./aria-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react/jsx-runtime"),v=require("react"),G=require("./aria-DM-xYEHQ.cjs"),$=require("./reference-C2guRuR0.cjs"),B=3,X=10,H=4;function Z(r){return Number.isFinite(r)?Math.min(X,Math.max(B,Math.trunc(r))):H}function M(r,s,o){return(s==="numeric"?r.replace(/[^0-9]/g,""):r.replace(/[^0-9a-z]/gi,"").toUpperCase()).slice(0,o)}function J(r,s,o){s.current=r,$.assignElementReference(o,r)}function Q(r,s){var c;const o=(c=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),"value"))==null?void 0:c.set;o?o.call(r,s):r.value=s}function U(r,s,o){const c=Math.min(o-1,Math.max(0,s)),P=Math.min(c+1,r.value.length);r.focus(),r.setSelectionRange(c,P)}function W(r){const{defaultValue:s,disabled:o,forwardedReference:c,length:P,mode:u,onChange:_,onComplete:N,onFocus:w,onKeyDown:p,onPaste:x,onSelect:y,readOnly:S,value:V}=r,n=Z(P),R=M(s,u,n),b=v.useRef(null),[k,D]=v.useState(R),[E,d]=v.useState(0),f=V!==void 0,i=M(f?V:k,u,n),C=v.useCallback(t=>J(t,b,c),[c]);v.useEffect(()=>{!f&&k!==i&&D(i)},[f,i,k]),v.useEffect(()=>{var l;if(f)return;const t=(l=b.current)==null?void 0:l.form;if(!t)return;const e=t.getRootNode();function a(h){h.target!==t||h.defaultPrevented||(D(R),d(0))}return e.addEventListener("reset",a),()=>e.removeEventListener("reset",a)},[f,R]);function L(t){const e=t.selectionStart??i.length;return Math.min(n-1,Math.max(0,e))}function T(t){const e=t.currentTarget,a=e.selectionStart??e.value.length,l=M(e.value,u,n),h=M(e.value.slice(0,a),u,n).length;e.value=l,f||D(l),_==null||_(t),l.length===n&&l!==i&&(N==null||N(l));const g=Math.min(n-1,h);d(g),e.setSelectionRange(g,Math.min(g+1,l.length))}function A(t){if(x==null||x(t),t.defaultPrevented||o||S)return;const e=M(t.clipboardData.getData("text"),u,n);if(t.preventDefault(),e.length===0)return;const a=t.currentTarget,l=a.selectionStart??i.length,h=a.selectionEnd??l,g=e.length===n?e:M(i.slice(0,l)+e+i.slice(h),u,n),j=e.length===n?n:Math.min(n,l+e.length);Q(a,g),a.setSelectionRange(j,j),a.dispatchEvent(new Event("input",{bubbles:!0}))}function z(t){if(p==null||p(t),t.defaultPrevented||t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;t.preventDefault();const e=t.key==="ArrowLeft"?-1:1,a=Math.min(n-1,Math.max(0,L(t.currentTarget)+e));d(a),U(t.currentTarget,a,n)}function O(t){w==null||w(t);const e=Math.min(n-1,i.length);d(e),U(t.currentTarget,e,n)}function q(t){y==null||y(t),d(L(t.currentTarget))}function F(t,e){if(t.preventDefault(),o)return;const a=b.current;a&&(d(e),U(a,e,n))}return{activeIndex:E,handleChange:T,handleFocus:O,handleKeyDown:z,handlePaste:A,handleSelect:q,handleSlotPointerDown:F,inputCallbackReference:C,length:n,renderedValue:i}}const Y=v.forwardRef(function(s,o){const{"aria-invalid":c,autoCapitalize:P,autoComplete:u="one-time-code",className:_,censored:N=!1,defaultValue:w="",disabled:p=!1,invalid:x=!1,length:y=H,mode:S="numeric",onChange:V,onComplete:n,onFocus:R,onKeyDown:b,onPaste:k,onSelect:D,readOnly:E=!1,style:d,value:f,wrap:i=!1,...C}=s,{activeIndex:L,handleChange:T,handleFocus:A,handleKeyDown:z,handlePaste:O,handleSelect:q,handleSlotPointerDown:F,inputCallbackReference:t,length:e,renderedValue:a}=W({defaultValue:w,disabled:p,forwardedReference:o,length:y,mode:S,onChange:V,onComplete:n,onFocus:R,onKeyDown:b,onPaste:k,onSelect:D,readOnly:E,value:f}),l=x||G.hasInvalidState(c),h=!i&&e>=6&&e%2===0,g=e/2,j={...d,"--nk-pin-input-columns":Math.ceil(e/2)};return m.jsxs("span",{className:["nk-pin-input",_].filter(Boolean).join(" "),"data-disabled":p||void 0,"data-invalid":l||void 0,"data-read-only":E||void 0,"data-wrap":i||void 0,style:j,children:[m.jsx("input",{...C,ref:t,"aria-invalid":G.resolveAriaInvalid(x,c),autoCapitalize:P??(S==="alphanumeric"?"characters":"off"),autoComplete:u,className:"nk-pin-input__control",disabled:p,inputMode:S==="numeric"?"numeric":"text",maxLength:e,minLength:e,onChange:T,onFocus:A,onKeyDown:z,onPaste:O,onSelect:q,pattern:S==="numeric"?`[0-9]{${e}}`:`[0-9A-Za-z]{${e}}`,readOnly:E,spellCheck:!1,type:"text",value:a}),m.jsx("span",{"aria-hidden":"true",className:"nk-pin-input__slots",children:Array.from({length:e},(ee,I)=>m.jsxs("span",{className:"nk-pin-input__slot-group",children:[h&&I===g?m.jsx("span",{className:"nk-pin-input__separator",children:"-"}):null,m.jsx("span",{className:"nk-pin-input__slot","data-active":L===I||void 0,onPointerDown:K=>F(K,I),children:N&&a[I]?m.jsx("span",{className:"nk-pin-input__censor"}):a[I]??""})]},I))})]})});exports.default=Y;
|
package/dist/PinInput.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as G, jsx as V } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as B, useState as H, useCallback as X, useEffect as K, forwardRef as Z } from "react";
|
|
4
|
-
import { r as J, h as Q } from "./aria-
|
|
4
|
+
import { r as J, h as Q } from "./aria-Bv-xVREf.js";
|
|
5
5
|
import { a as W } from "./reference-CXMr27nM.js";
|
|
6
6
|
const Y = 3, ee = 10, q = 4;
|
|
7
7
|
function te(r) {
|
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"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),r=require("react"),we=require("./aria-DM-xYEHQ.cjs"),ne=require("./effects-D98vUn6N.cjs"),B=require("./reference-C2guRuR0.cjs"),te=require("./useFloatingPosition-DQgw-w_Z.cjs"),h=require("./usePresence-Dm0mls5p.cjs"),je=require("./useFocusTrap-CrMcAu8s.cjs"),De=require("./Surface-BttJYSDt.cjs");function Le(n){const{inert:i,panelElement:c}=n;return ne.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":se,autoFocus:w=!0,children:oe,className:ae,closeOnEscape:ie=!0,closeOnOutsideInteraction:ce=!0,defaultOpen:ue=!1,disabled:x=!1,initialFocusReference:E,onEscapeKeyDown:le,onOpenChange:k,onPointerDownOutside:I,open:A,placement:H="bottom",restoreFocus:j=!0,role:K="dialog",style:V,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 $=r.useId(),pe=r.useContext(h.FocusScopeContext),U=`${$}-popover`,o=d.props,G=B.getElementReference(d),J=o.id??`${$}-trigger`,v=x||o.disabled===!0||o["aria-disabled"]===!0||o["aria-disabled"]==="true",R=A!==void 0,[ge,me]=r.useState(ue),t=R?A:ge,C=h.usePresence(t),Q=r.useRef(null),W=r.useRef(null),D=r.useRef("programmatic"),L=r.useRef(null),X=r.useRef(t),T=r.useRef(null),[be,ve]=r.useReducer(e=>e+1,0),[u,ye]=r.useState(null),[f,Pe]=r.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),O=ne.useBoundary("Popover").boundaryElement,S=h.useOverlayLayer(C.present,O),he=r.useMemo(()=>[Q,W],[]),p=te.useFloatingPosition(C.present,H,u,f,O),Ee=r.useCallback(e=>{_e(e,Q,G),ye(e)},[G]),Re=r.useCallback(e=>{Ne(e,W,c),Pe(e)},[c]),g=r.useCallback((e,s)=>{t!==e&&(R?(L.current={open:e,reason:s},ve()):(D.current=s,me(e)),k==null||k(e,s))},[R,k,t]),Te=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?T.current=e.composedPath().find(P=>P instanceof s&&P.tabIndex>=0)??e.target:T.current=e.target},[I,a]);h.useDismissableLayer({boundary:O,active:t,boundaries:he,dismissOnEscape:ie,dismissOnPointerDownOutside:ce,layerId:S.id,onEscapeDismiss:Te,onEscapeKeyDown:le,onPointerDownOutside:ke,onPointerDownOutsideDismiss:xe,ownerDocument:a});const Ie=je.useFocusTrap({boundary:O,active:t&&b,autoFocus:w,container:f,initialFocusReference:E,layerId:S.id,restoreFocus:j});r.useEffect(()=>{if(!t||b||!w||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const s=E==null?void 0:E.current;(s&&f.contains(s)?s:f).focus({preventScroll:!0})}),()=>{e=!1}},[w,E,t,f,b]),r.useEffect(()=>{var re;const e=X.current;X.current=t;const s=L.current;let m=D.current;if(R&&(m="programmatic",e!==t&&(s==null?void 0:s.open)===t&&(m=s.reason)),L.current=null,t){D.current="programmatic",T.current=null;return}const P=a==null?void 0:a.activeElement,_=T.current,M=(re=a==null?void 0:a.defaultView)==null?void 0:re.HTMLElement,Fe=m==="outside"&&M&&_ instanceof M&&P instanceof M&&(_===P||_.contains(P));e&&!b&&j&&!Fe&&(u==null||u.focus({preventScroll:!0})),T.current=null},[be,R,t,a,j,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 Oe(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,Y=y==="a"&&typeof o.href=="string",Z=N&&!(y==="button"||y==="input"||y==="select"||y==="summary"||y==="textarea"||Y),ee=Y&&v;let q=o.role;q===void 0&&(ee?q="link":Z&&(q="button"));let F=o.tabIndex;F===void 0&&Z&&(F=0),v&&(F=-1);const Se=v?{...o,onClick:void 0}:o,qe=r.cloneElement(d,te.resolveTriggerOverrides(Se,{"aria-controls":t?we.mergeIdentifiers(o["aria-controls"],U):o["aria-controls"],"aria-expanded":t,"aria-haspopup":o["aria-haspopup"]??Be(K),"aria-disabled":v?!0:o["aria-disabled"],className:"nk-popover__trigger",href:ee?void 0:o.href,id:J,onClick:Ce,onKeyDown:N?Oe:void 0,ref:Ee,role:q,tabIndex:F}));return l.jsxs(l.Fragment,{children:[qe,l.jsx(h.FocusScopeContext.Provider,{value:t&&b?Ie:pe,children:C.present&&a?l.jsx(h.Portal,{children:l.jsxs(De.Surface,{...fe,ref:Re,"aria-hidden":t?void 0:!0,"aria-label":t?z:void 0,"aria-labelledby":t?se??(z===void 0?J:void 0):void 0,className:["nk-popover",ae].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??H,"data-state":C.state==="closing"?"closing":"open",id:U,role:t?K:void 0,style:p?{...V,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:S.zIndex}:{...V,visibility:"hidden",zIndex:S.zIndex},tabIndex:de??-1,children:[l.jsx(Le,{inert:!t,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:oe})]})}):null})]})});exports.default=ze;
|
package/dist/Popover.js
CHANGED
|
@@ -1,230 +1,228 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as ne, Fragment as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { m as
|
|
5
|
-
import { u as
|
|
6
|
-
import { g as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { u as
|
|
10
|
-
import { S as
|
|
11
|
-
function
|
|
12
|
-
const { inert: a, panelElement: i } =
|
|
13
|
-
return
|
|
2
|
+
import { jsxs as ne, Fragment as Ne, jsx as I } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as _e, Fragment as Be, useId as qe, useContext as ze, useState as A, useRef as y, useReducer as Ae, useMemo as Me, useCallback as h, useEffect as M, cloneElement as $e } from "react";
|
|
4
|
+
import { m as je } from "./aria-Bv-xVREf.js";
|
|
5
|
+
import { u as He, a as Ke } from "./effects-DGbA6Q2O.js";
|
|
6
|
+
import { g as Ve, a as se } from "./reference-CXMr27nM.js";
|
|
7
|
+
import { u as Ue, r as Ge } from "./useFloatingPosition-MGoyautY.js";
|
|
8
|
+
import { F as oe, b as Je, c as Qe, d as We, P as Xe } from "./usePresence-BTRY1_l-.js";
|
|
9
|
+
import { u as Ye } from "./useFocusTrap-BxPazAL6.js";
|
|
10
|
+
import { S as Ze } from "./Surface-vEFsZC12.js";
|
|
11
|
+
function er(t) {
|
|
12
|
+
const { inert: a, panelElement: i } = t;
|
|
13
|
+
return Ke(() => {
|
|
14
14
|
i && (i.inert = a);
|
|
15
15
|
}, [a, i]), null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
a.current =
|
|
17
|
+
function rr(t, a, i) {
|
|
18
|
+
a.current = t, se(i, t);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
a.current =
|
|
20
|
+
function tr(t, a, i) {
|
|
21
|
+
a.current = t, se(i, t);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const a =
|
|
25
|
-
return
|
|
23
|
+
function nr(t) {
|
|
24
|
+
const a = t.tagName.toLowerCase();
|
|
25
|
+
return t.getAttribute("role") === "button" && a !== "button" ? !1 : ["button", "input", "select", "summary", "textarea"].includes(a) ? !0 : a === "a" && t.hasAttribute("href");
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function or(t) {
|
|
28
|
+
return t === "grid" || t === "listbox" || t === "menu" || t === "tree" ? t : "dialog";
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const mr = _e(function(a, i) {
|
|
31
31
|
const {
|
|
32
|
-
"aria-label":
|
|
32
|
+
"aria-label": $,
|
|
33
33
|
"aria-labelledby": ae,
|
|
34
|
-
autoFocus:
|
|
34
|
+
autoFocus: D = !0,
|
|
35
35
|
children: ie,
|
|
36
36
|
className: ce,
|
|
37
37
|
closeOnEscape: le = !0,
|
|
38
38
|
closeOnOutsideInteraction: ue = !0,
|
|
39
39
|
defaultOpen: de = !1,
|
|
40
40
|
disabled: R = !1,
|
|
41
|
-
initialFocusReference:
|
|
41
|
+
initialFocusReference: P,
|
|
42
42
|
onEscapeKeyDown: fe,
|
|
43
43
|
onOpenChange: x,
|
|
44
|
-
onPointerDownOutside:
|
|
45
|
-
open:
|
|
46
|
-
placement:
|
|
44
|
+
onPointerDownOutside: O,
|
|
45
|
+
open: j,
|
|
46
|
+
placement: H = "bottom",
|
|
47
47
|
restoreFocus: L = !0,
|
|
48
|
-
role:
|
|
48
|
+
role: K = "dialog",
|
|
49
49
|
style: V,
|
|
50
50
|
tabIndex: pe,
|
|
51
|
-
trapFocus:
|
|
51
|
+
trapFocus: g = !1,
|
|
52
52
|
trigger: l,
|
|
53
|
-
...
|
|
53
|
+
...ge
|
|
54
54
|
} = a;
|
|
55
55
|
if (l.type === Be)
|
|
56
56
|
throw new Error("Popover requires a single non-Fragment trigger");
|
|
57
|
-
const U =
|
|
57
|
+
const U = qe(), me = ze(oe), G = `${U}-popover`, o = l.props, J = Ve(l), Q = o.id ?? `${U}-trigger`, m = R || o.disabled === !0 || o["aria-disabled"] === !0 || o["aria-disabled"] === "true", T = j !== void 0, [be, ve] = A(de), r = T ? j : be, k = Je(r), W = y(null), X = y(null), N = y("programmatic"), _ = y(null), Y = y(r), E = y(null), [ye, he] = Ae(
|
|
58
58
|
(e) => e + 1,
|
|
59
59
|
0
|
|
60
|
-
), [c, Pe] =
|
|
60
|
+
), [c, Pe] = A(null), [u, Te] = A(null), s = (c == null ? void 0 : c.ownerDocument) ?? (typeof document > "u" ? null : document), C = He("Popover").boundaryElement, S = Qe(k.present, C), Ee = Me(
|
|
61
61
|
() => [W, X],
|
|
62
62
|
[]
|
|
63
|
-
), d =
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
), d = Ue(
|
|
64
|
+
k.present,
|
|
65
|
+
H,
|
|
66
66
|
c,
|
|
67
67
|
u,
|
|
68
|
-
|
|
69
|
-
), Ie =
|
|
68
|
+
C
|
|
69
|
+
), Ie = h(
|
|
70
70
|
(e) => {
|
|
71
|
-
|
|
71
|
+
tr(
|
|
72
72
|
e,
|
|
73
73
|
W,
|
|
74
74
|
J
|
|
75
75
|
), Pe(e);
|
|
76
76
|
},
|
|
77
77
|
[J]
|
|
78
|
-
), Re =
|
|
78
|
+
), Re = h(
|
|
79
79
|
(e) => {
|
|
80
|
-
|
|
80
|
+
rr(
|
|
81
81
|
e,
|
|
82
82
|
X,
|
|
83
83
|
i
|
|
84
|
-
),
|
|
84
|
+
), Te(e);
|
|
85
85
|
},
|
|
86
86
|
[i]
|
|
87
|
-
), f =
|
|
88
|
-
r !== e && (
|
|
87
|
+
), f = h((e, n) => {
|
|
88
|
+
r !== e && (T ? (_.current = {
|
|
89
89
|
open: e,
|
|
90
|
-
reason:
|
|
91
|
-
}, he()) : (N.current =
|
|
92
|
-
}, [
|
|
90
|
+
reason: n
|
|
91
|
+
}, he()) : (N.current = n, ve(e)), x == null || x(e, n));
|
|
92
|
+
}, [T, x, r]), xe = h(() => {
|
|
93
93
|
f(!1, "escape");
|
|
94
|
-
}, [f]),
|
|
94
|
+
}, [f]), Oe = h(() => {
|
|
95
95
|
f(!1, "outside");
|
|
96
|
-
}, [f]),
|
|
96
|
+
}, [f]), ke = h((e) => {
|
|
97
97
|
var p;
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
(
|
|
102
|
-
) ?? e.target :
|
|
103
|
-
}, [
|
|
104
|
-
|
|
105
|
-
boundary:
|
|
98
|
+
if (O == null || O(e), e.defaultPrevented) return;
|
|
99
|
+
const n = (p = s == null ? void 0 : s.defaultView) == null ? void 0 : p.HTMLElement;
|
|
100
|
+
n ? E.current = e.composedPath().find(
|
|
101
|
+
(v) => v instanceof n && v.tabIndex >= 0
|
|
102
|
+
) ?? e.target : E.current = e.target;
|
|
103
|
+
}, [O, s]);
|
|
104
|
+
We({
|
|
105
|
+
boundary: C,
|
|
106
106
|
active: r,
|
|
107
|
-
boundaries:
|
|
107
|
+
boundaries: Ee,
|
|
108
108
|
dismissOnEscape: le,
|
|
109
109
|
dismissOnPointerDownOutside: ue,
|
|
110
|
-
layerId:
|
|
110
|
+
layerId: S.id,
|
|
111
111
|
onEscapeDismiss: xe,
|
|
112
112
|
onEscapeKeyDown: fe,
|
|
113
|
-
onPointerDownOutside:
|
|
114
|
-
onPointerDownOutsideDismiss:
|
|
113
|
+
onPointerDownOutside: ke,
|
|
114
|
+
onPointerDownOutsideDismiss: Oe,
|
|
115
115
|
ownerDocument: s
|
|
116
116
|
});
|
|
117
|
-
const
|
|
118
|
-
boundary:
|
|
119
|
-
active: r &&
|
|
120
|
-
autoFocus:
|
|
117
|
+
const Ce = Ye({
|
|
118
|
+
boundary: C,
|
|
119
|
+
active: r && g,
|
|
120
|
+
autoFocus: D,
|
|
121
121
|
container: u,
|
|
122
|
-
initialFocusReference:
|
|
123
|
-
layerId:
|
|
122
|
+
initialFocusReference: P,
|
|
123
|
+
layerId: S.id,
|
|
124
124
|
restoreFocus: L
|
|
125
125
|
});
|
|
126
|
-
|
|
127
|
-
if (!r ||
|
|
126
|
+
M(() => {
|
|
127
|
+
if (!r || g || !D || !u) return;
|
|
128
128
|
let e = !0;
|
|
129
129
|
return Promise.resolve().then(() => {
|
|
130
130
|
if (!e) return;
|
|
131
|
-
const
|
|
132
|
-
(
|
|
131
|
+
const n = P == null ? void 0 : P.current;
|
|
132
|
+
(n && u.contains(n) ? n : u).focus({ preventScroll: !0 });
|
|
133
133
|
}), () => {
|
|
134
134
|
e = !1;
|
|
135
135
|
};
|
|
136
|
-
}, [
|
|
136
|
+
}, [D, P, r, u, g]), M(() => {
|
|
137
137
|
var te;
|
|
138
138
|
const e = Y.current;
|
|
139
139
|
Y.current = r;
|
|
140
|
-
const
|
|
140
|
+
const n = _.current;
|
|
141
141
|
let p = N.current;
|
|
142
|
-
if (
|
|
143
|
-
N.current = "programmatic",
|
|
142
|
+
if (T && (p = "programmatic", e !== r && (n == null ? void 0 : n.open) === r && (p = n.reason)), _.current = null, r) {
|
|
143
|
+
N.current = "programmatic", E.current = null;
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
-
const
|
|
147
|
-
e && !
|
|
146
|
+
const v = s == null ? void 0 : s.activeElement, q = E.current, z = (te = s == null ? void 0 : s.defaultView) == null ? void 0 : te.HTMLElement, Le = p === "outside" && z && q instanceof z && v instanceof z && (q === v || q.contains(v));
|
|
147
|
+
e && !g && L && !Le && (c == null || c.focus({ preventScroll: !0 })), E.current = null;
|
|
148
148
|
}, [
|
|
149
149
|
ye,
|
|
150
|
-
|
|
150
|
+
T,
|
|
151
151
|
r,
|
|
152
152
|
s,
|
|
153
153
|
L,
|
|
154
|
-
|
|
154
|
+
g,
|
|
155
155
|
c
|
|
156
|
-
]),
|
|
156
|
+
]), M(() => {
|
|
157
157
|
R && r && f(!1, "programmatic");
|
|
158
158
|
}, [R, r, f]);
|
|
159
|
-
function
|
|
160
|
-
|
|
161
|
-
if (P) {
|
|
159
|
+
function Se(e) {
|
|
160
|
+
if (m) {
|
|
162
161
|
e.preventDefault(), e.stopPropagation();
|
|
163
162
|
return;
|
|
164
163
|
}
|
|
165
|
-
|
|
164
|
+
e.defaultPrevented || f(!r, "trigger");
|
|
166
165
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
(t = n.onKeyDown) == null || t.call(n, e), !(e.defaultPrevented || P || rr(e.currentTarget) || e.key !== "Enter" && e.key !== " ") && (e.preventDefault(), e.currentTarget.click());
|
|
166
|
+
function we(e) {
|
|
167
|
+
e.defaultPrevented || m || nr(e.currentTarget) || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), e.currentTarget.click());
|
|
170
168
|
}
|
|
171
169
|
if (R) return l;
|
|
172
|
-
const
|
|
173
|
-
let
|
|
174
|
-
|
|
175
|
-
let
|
|
176
|
-
|
|
177
|
-
const
|
|
170
|
+
const B = typeof l.type == "string", b = B ? l.type : null, Z = b === "a" && typeof o.href == "string", ee = B && !(b === "button" || b === "input" || b === "select" || b === "summary" || b === "textarea" || Z), re = Z && m;
|
|
171
|
+
let w = o.role;
|
|
172
|
+
w === void 0 && (re ? w = "link" : ee && (w = "button"));
|
|
173
|
+
let F = o.tabIndex;
|
|
174
|
+
F === void 0 && ee && (F = 0), m && (F = -1);
|
|
175
|
+
const Fe = m ? { ...o, onClick: void 0 } : o, De = $e(
|
|
178
176
|
l,
|
|
179
|
-
{
|
|
180
|
-
"aria-controls": r ?
|
|
177
|
+
Ge(Fe, {
|
|
178
|
+
"aria-controls": r ? je(o["aria-controls"], G) : o["aria-controls"],
|
|
181
179
|
"aria-expanded": r,
|
|
182
|
-
"aria-haspopup":
|
|
183
|
-
"aria-disabled":
|
|
184
|
-
className:
|
|
185
|
-
href: re ? void 0 :
|
|
180
|
+
"aria-haspopup": o["aria-haspopup"] ?? or(K),
|
|
181
|
+
"aria-disabled": m ? !0 : o["aria-disabled"],
|
|
182
|
+
className: "nk-popover__trigger",
|
|
183
|
+
href: re ? void 0 : o.href,
|
|
186
184
|
id: Q,
|
|
187
|
-
onClick:
|
|
188
|
-
onKeyDown:
|
|
185
|
+
onClick: Se,
|
|
186
|
+
onKeyDown: B ? we : void 0,
|
|
189
187
|
ref: Ie,
|
|
190
|
-
role:
|
|
191
|
-
tabIndex:
|
|
192
|
-
}
|
|
188
|
+
role: w,
|
|
189
|
+
tabIndex: F
|
|
190
|
+
})
|
|
193
191
|
);
|
|
194
|
-
return /* @__PURE__ */ ne(
|
|
195
|
-
|
|
192
|
+
return /* @__PURE__ */ ne(Ne, { children: [
|
|
193
|
+
De,
|
|
196
194
|
/* @__PURE__ */ I(
|
|
197
195
|
oe.Provider,
|
|
198
196
|
{
|
|
199
|
-
value: r &&
|
|
200
|
-
children:
|
|
201
|
-
|
|
197
|
+
value: r && g ? Ce : me,
|
|
198
|
+
children: k.present && s ? /* @__PURE__ */ I(Xe, { children: /* @__PURE__ */ ne(
|
|
199
|
+
Ze,
|
|
202
200
|
{
|
|
203
|
-
...
|
|
201
|
+
...ge,
|
|
204
202
|
ref: Re,
|
|
205
203
|
"aria-hidden": r ? void 0 : !0,
|
|
206
|
-
"aria-label": r ?
|
|
207
|
-
"aria-labelledby": r ? ae ?? (
|
|
204
|
+
"aria-label": r ? $ : void 0,
|
|
205
|
+
"aria-labelledby": r ? ae ?? ($ === void 0 ? Q : void 0) : void 0,
|
|
208
206
|
className: ["nk-popover", ce].filter(Boolean).join(" "),
|
|
209
|
-
"data-placement": (d == null ? void 0 : d.placement) ??
|
|
210
|
-
"data-state":
|
|
207
|
+
"data-placement": (d == null ? void 0 : d.placement) ?? H,
|
|
208
|
+
"data-state": k.state === "closing" ? "closing" : "open",
|
|
211
209
|
id: G,
|
|
212
|
-
role: r ?
|
|
210
|
+
role: r ? K : void 0,
|
|
213
211
|
style: d ? {
|
|
214
212
|
...V,
|
|
215
213
|
"--nk-popover-arrow-offset": `${d.arrowOffset}px`,
|
|
216
214
|
left: d.left,
|
|
217
215
|
top: d.top,
|
|
218
|
-
zIndex:
|
|
216
|
+
zIndex: S.zIndex
|
|
219
217
|
} : {
|
|
220
218
|
...V,
|
|
221
219
|
visibility: "hidden",
|
|
222
|
-
zIndex:
|
|
220
|
+
zIndex: S.zIndex
|
|
223
221
|
},
|
|
224
222
|
tabIndex: pe ?? -1,
|
|
225
223
|
children: [
|
|
226
224
|
/* @__PURE__ */ I(
|
|
227
|
-
|
|
225
|
+
er,
|
|
228
226
|
{
|
|
229
227
|
inert: !r,
|
|
230
228
|
panelElement: u
|
|
@@ -240,5 +238,5 @@ const pr = Ne(function(a, i) {
|
|
|
240
238
|
] });
|
|
241
239
|
});
|
|
242
240
|
export {
|
|
243
|
-
|
|
241
|
+
mr as default
|
|
244
242
|
};
|
package/dist/Radio.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"),r=require("react"),C=require("./reference-C2guRuR0.cjs"),m=require("./aria-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),r=require("react"),C=require("./reference-C2guRuR0.cjs"),m=require("./aria-DM-xYEHQ.cjs"),j=require("./field-control-NfLwcPj6.cjs"),q=require("./Text-DWYlIcPj.cjs"),x=r.createContext(void 0),g=r.forwardRef(function(l,t){const{"aria-invalid":c,children:v,className:p,defaultValue:R,disabled:o=!1,invalid:f=!1,name:e,onChange:u,orientation:a="vertical",required:n=!1,value:b,...h}=l,s=f||m.hasInvalidState(c),k={defaultValue:R,disabled:o,name:e,onChange:u,required:n,value:b};return d.jsx(x.Provider,{value:k,children:d.jsx("div",{...h,ref:t,"aria-disabled":o||void 0,"aria-invalid":m.resolveAriaInvalid(f,c),"aria-required":n||void 0,className:["nk-radio-group",p].filter(Boolean).join(" "),"data-disabled":o||void 0,"data-invalid":s||void 0,"data-orientation":a,role:"radiogroup",children:v})})});j.markFieldGroupControl(g,"group");function _(){const i=r.useContext(x);if(!i)throw new Error("Radio must be rendered within RadioGroup");return i}function G(i,l,t){l.current=i,C.assignElementReference(t,i)}const N=r.forwardRef(function(l,t){const{children:c,className:v,disabled:p=!1,style:R,value:o,...f}=l,e=_(),u=r.useRef(null),a=e.disabled||p,n=e.value!==void 0,b=e.value===o,h=r.useCallback(s=>G(s,u,t),[t]);return r.useEffect(()=>{var s;!n&&a&&((s=u.current)!=null&&s.checked)&&(u.current.checked=!1)},[n,a]),d.jsxs("label",{className:["nk-radio",v].filter(Boolean).join(" "),"data-disabled":a||void 0,style:R,children:[d.jsx("input",{...f,ref:h,checked:n?!a&&b:void 0,className:"nk-radio__control",defaultChecked:n?void 0:!a&&e.defaultValue===o,disabled:a,name:e.name,onChange:e.onChange,required:e.required,type:"radio",value:o}),d.jsx("span",{"aria-hidden":"true",className:"nk-radio__visual"}),d.jsx(q.Text,{as:"span",className:"nk-radio__label",children:c})]})}),w=Object.assign(N,{Group:g});exports.default=w;
|
package/dist/Radio.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as l, jsxs as g } from "react/jsx-runtime";
|
|
3
3
|
import { createContext as x, forwardRef as R, useContext as G, useRef as N, useCallback as _, useEffect as j } from "react";
|
|
4
4
|
import { a as q } from "./reference-CXMr27nM.js";
|
|
5
|
-
import { r as I, h as V } from "./aria-
|
|
5
|
+
import { r as I, h as V } from "./aria-Bv-xVREf.js";
|
|
6
6
|
import { m as w } from "./field-control-XAn_FKks.js";
|
|
7
7
|
import { T as E } from "./Text-rN6iDo0V.js";
|
|
8
8
|
const b = x(void 0), k = R(
|