neatkit 0.12.0 → 0.13.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/Badge.cjs +1 -1
- package/dist/Badge.js +21 -21
- package/dist/Boundary.cjs +1 -1
- package/dist/Boundary.js +22 -22
- package/dist/Button-CTzvBhGH.cjs +1 -0
- package/dist/{Button-B0E-M8mp.js → Button-CyUpMPtt.js} +28 -26
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +1 -1
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +1 -1
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +1 -1
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +29 -26
- package/dist/{Table-Z8Q6XRkc.cjs → Table-BbH9oy3Z.cjs} +1 -1
- package/dist/{Table-B2G8CHJ9.js → Table-rTy_IuSv.js} +11 -11
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/components/Badge/Badge.d.ts +20 -12
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +4 -0
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/PinInput/PinInput.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Table/components/TableAction.d.ts +1 -1
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/tokens.d.ts +7 -5
- package/dist/{units-BmjPCccF.js → units-Bx_CBIy8.js} +6 -6
- package/dist/units-CpnLv2H4.cjs +1 -0
- package/package.json +1 -1
- package/dist/Button-6oWs-pyF.cjs +0 -1
- package/dist/units-PzuiQNnw.cjs +0 -1
package/dist/Badge.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react"),m=t.forwardRef(function(a,n){const{as:o,children:r,className:s,size:i="medium",tone:l="neutral",variant:u="outline",...d}=a,e=o??"span",c=e==="button"?{type:"button"}:void 0;return t.createElement(e,{...c,...d,ref:n,className:["nk-badge",s].filter(Boolean).join(" "),"data-size":i,"data-tone":l,"data-variant":u,children:r})});exports.default=m;
|
package/dist/Badge.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const c = l(function(a, e) {
|
|
1
|
+
import { forwardRef as l, createElement as u } from "react";
|
|
2
|
+
const B = l(function(e, n) {
|
|
4
3
|
const {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
as: a,
|
|
5
|
+
children: o,
|
|
6
|
+
className: r,
|
|
7
|
+
size: i = "medium",
|
|
8
|
+
tone: s = "neutral",
|
|
9
|
+
variant: d = "outline",
|
|
10
|
+
...c
|
|
11
|
+
} = e, t = a ?? "span";
|
|
12
|
+
return u(t, {
|
|
13
|
+
...t === "button" ? { type: "button" } : void 0,
|
|
14
|
+
...c,
|
|
15
|
+
ref: n,
|
|
16
|
+
className: ["nk-badge", r].filter(Boolean).join(" "),
|
|
17
|
+
"data-size": i,
|
|
18
|
+
"data-tone": s,
|
|
19
|
+
"data-variant": d,
|
|
20
|
+
children: o
|
|
21
|
+
});
|
|
22
22
|
});
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
B as default
|
|
25
25
|
};
|
package/dist/Boundary.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),W=require("./effects-D98vUn6N.cjs"),v=require("./units-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),W=require("./effects-D98vUn6N.cjs"),v=require("./units-CpnLv2H4.cjs"),I=[{minWidth:v.breakpoint("extra-large"),marginPercent:32,preferredWidth:1200},{minWidth:v.breakpoint("large"),marginPercent:20,preferredWidth:1100},{minWidth:v.breakpoint("medium"),marginPercent:14,preferredWidth:v.breakpoint("medium")},{minWidth:v.breakpoint("small"),marginPercent:8,preferredWidth:650}],F=16;function L(e){for(const n of I)if(e>=n.minWidth)return n}function O(e,n){if(!Number.isFinite(e)||!Number.isFinite(n)||e<v.breakpoint("small")||n<=0)return;const t=L(e);if(!t)return;const r=e*t.marginPercent/100,o=e-r*2,l=Math.min(t.preferredWidth,e-F),u=Math.max(o,l);let a=Math.floor(u/n);if(a%2===0&&(a-=1),!(a<3))return Math.min((a-1)*n,e)}function V(e,n){if(typeof e=="function"){e(n);return}e&&(e.current=n)}function _(){const e=new Set;let n;return{publish(t){n!==t&&(n=t,e.forEach(r=>r()))},read(){return n},subscribe(t){return e.add(t),()=>{e.delete(t)}}}}function T(e){if(e.clientWidth===0)return;const n=window.getComputedStyle(e),t=(Number.parseFloat(n.paddingLeft)||0)+(Number.parseFloat(n.paddingRight)||0);return Math.max(e.clientWidth-t,0)}function z(e){const t=window.getComputedStyle(e).getPropertyValue("--nk-cell").trim().match(/^([+]?(?:\d+\.?\d*|\.\d+))px$/i);if(!t)return;const r=Number.parseFloat(t[1]);return Number.isFinite(r)&&r>0?r:void 0}function A(e,n){const t=c.useRef(null),r=c.useRef(null),o=c.useRef(void 0),l=c.useRef(null),[u,a]=c.useState(void 0),[y,p]=c.useState(null);l.current||(l.current=_());const h=l.current,m=c.useCallback(i=>{const s=T(i);if(h.publish(s),!n||s===void 0){if(o.current===void 0)return;o.current=void 0,a(void 0);return}const g=z(i),b=g===void 0?void 0:O(s,g);o.current!==b&&(o.current=b,a(b))},[h,n]),d=c.useCallback(i=>{var g;if((g=r.current)==null||g.disconnect(),r.current=null,typeof ResizeObserver>"u")return;const s=new ResizeObserver(()=>m(i));s.observe(i),r.current=s},[m]),f=c.useCallback(i=>{var s;(s=r.current)==null||s.disconnect(),r.current=null,t.current=i,p(i),V(e,i),!(!i||typeof window>"u")&&(m(i),d(i))},[d,e,m]);return W.useIsomorphicLayoutEffect(()=>{t.current&&m(t.current)}),c.useEffect(()=>(t.current&&d(t.current),()=>{var i;(i=r.current)==null||i.disconnect(),r.current=null}),[d]),{contentWidth:u,rootElement:y,rootReference:f,width:h}}const q=1,w=new WeakMap;function S(e,n){const t=n.painters[n.painters.length-1],r=t?t():n.original,{style:o}=e;o.backgroundColor!==r.backgroundColor&&(o.backgroundColor=r.backgroundColor),o.colorScheme!==r.colorScheme&&(o.colorScheme=r.colorScheme)}function x(e,n){let t=w.get(e);if(!t){const{style:r}=e.documentElement;t={original:{backgroundColor:r.backgroundColor,colorScheme:r.colorScheme},painters:[]},w.set(e,t)}t.painters.push(n),S(e.documentElement,t)}function k(e,n){const t=w.get(e);if(!t)return;const r=t.painters.lastIndexOf(n);r!==-1&&t.painters.splice(r,1),S(e.documentElement,t),t.painters.length===0&&w.delete(e)}function C(e){const n=w.get(e);n&&S(e.documentElement,n)}function D(e){const{nested:n,rootElement:t,width:r}=e,o=c.useRef(!1);W.useIsomorphicLayoutEffect(()=>{if(!t)return;const l=t,{ownerDocument:u}=l;if(!u.defaultView)return;const a=u.defaultView;function y(){return l.clientWidth===0?!1:Math.abs(l.clientWidth-u.documentElement.clientWidth)<=q}function p(){const f=a.getComputedStyle(l);return{backgroundColor:f.backgroundColor,colorScheme:f.colorScheme}}function h(){const f=!n&&y();if(f===o.current){f&&C(u);return}f?x(u,p):k(u,p),o.current=f}h();const m=r.subscribe(h),d=typeof a.matchMedia=="function"?a.matchMedia("(prefers-color-scheme: dark)"):null;return d==null||d.addEventListener("change",h),()=>{m(),d==null||d.removeEventListener("change",h),o.current&&(k(u,p),o.current=!1)}},[n,t,r]),W.useIsomorphicLayoutEffect(()=>{!o.current||!t||C(t.ownerDocument)})}const j=c.forwardRef(function(n,t){const{as:r,children:o,className:l,style:u,theme:a="auto",accent:y,decoration:p="grid",width:h="narrow",height:m="content",spacing:d="standard",...f}=n,{contentWidth:i,rootElement:s,rootReference:g,width:b}=A(t,h==="narrow"),M=W.useBoundary();D({nested:M!==void 0,rootElement:s,width:b});const E=c.useMemo(()=>({boundaryElement:s,portalElement:s,width:b}),[s,b]),P=r??"div",R=y!==void 0?{...u,"--nk-accent":y}:u,B=i===void 0?void 0:{width:`${i}px`},N=c.createElement(P,{...f,ref:g,className:["nk-boundary",l].filter(Boolean).join(" "),"data-theme":a,"data-decoration":p,"data-width":h,"data-height":m,"data-spacing":d,style:R},c.createElement("div",{className:"nk-boundary__content",style:B},o));return c.createElement(W.BoundaryContext.Provider,{value:E},N)});exports.default=j;
|
package/dist/Boundary.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useRef as v, useState as M, useCallback as w, useEffect as O, forwardRef as z, useMemo as L, createElement as C } from "react";
|
|
3
3
|
import { a as S, u as T, B as _ } from "./effects-DGbA6Q2O.js";
|
|
4
|
-
import { b } from "./units-
|
|
4
|
+
import { b } from "./units-Bx_CBIy8.js";
|
|
5
5
|
const x = [
|
|
6
6
|
{
|
|
7
|
-
minWidth: b("
|
|
7
|
+
minWidth: b("extra-large"),
|
|
8
8
|
marginPercent: 32,
|
|
9
9
|
preferredWidth: 1200
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
minWidth: b("
|
|
12
|
+
minWidth: b("large"),
|
|
13
13
|
marginPercent: 20,
|
|
14
14
|
preferredWidth: 1100
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
minWidth: b("
|
|
17
|
+
minWidth: b("medium"),
|
|
18
18
|
marginPercent: 14,
|
|
19
|
-
preferredWidth: b("
|
|
19
|
+
preferredWidth: b("medium")
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
minWidth: b("
|
|
22
|
+
minWidth: b("small"),
|
|
23
23
|
marginPercent: 8,
|
|
24
24
|
preferredWidth: 650
|
|
25
25
|
}
|
|
@@ -29,7 +29,7 @@ function D(e) {
|
|
|
29
29
|
if (e >= n.minWidth) return n;
|
|
30
30
|
}
|
|
31
31
|
function $(e, n) {
|
|
32
|
-
if (!Number.isFinite(e) || !Number.isFinite(n) || e < b("
|
|
32
|
+
if (!Number.isFinite(e) || !Number.isFinite(n) || e < b("small") || n <= 0)
|
|
33
33
|
return;
|
|
34
34
|
const t = D(e);
|
|
35
35
|
if (!t) return;
|
|
@@ -79,9 +79,9 @@ function H(e) {
|
|
|
79
79
|
return Number.isFinite(r) && r > 0 ? r : void 0;
|
|
80
80
|
}
|
|
81
81
|
function U(e, n) {
|
|
82
|
-
const t = v(null), r = v(null), o = v(void 0), a = v(null), [c, s] = M(void 0), [y,
|
|
82
|
+
const t = v(null), r = v(null), o = v(void 0), a = v(null), [c, s] = M(void 0), [y, h] = M(null);
|
|
83
83
|
a.current || (a.current = q());
|
|
84
|
-
const f = a.current,
|
|
84
|
+
const f = a.current, m = w((i) => {
|
|
85
85
|
const u = G(i);
|
|
86
86
|
if (f.publish(u), !n || u === void 0) {
|
|
87
87
|
if (o.current === void 0) return;
|
|
@@ -95,20 +95,20 @@ function U(e, n) {
|
|
|
95
95
|
var p;
|
|
96
96
|
if ((p = r.current) == null || p.disconnect(), r.current = null, typeof ResizeObserver > "u") return;
|
|
97
97
|
const u = new ResizeObserver(
|
|
98
|
-
() =>
|
|
98
|
+
() => m(i)
|
|
99
99
|
);
|
|
100
100
|
u.observe(i), r.current = u;
|
|
101
101
|
},
|
|
102
|
-
[
|
|
102
|
+
[m]
|
|
103
103
|
), l = w(
|
|
104
104
|
(i) => {
|
|
105
105
|
var u;
|
|
106
|
-
(u = r.current) == null || u.disconnect(), r.current = null, t.current = i,
|
|
106
|
+
(u = r.current) == null || u.disconnect(), r.current = null, t.current = i, h(i), j(e, i), !(!i || typeof window > "u") && (m(i), d(i));
|
|
107
107
|
},
|
|
108
|
-
[d, e,
|
|
108
|
+
[d, e, m]
|
|
109
109
|
);
|
|
110
110
|
return S(() => {
|
|
111
|
-
t.current &&
|
|
111
|
+
t.current && m(t.current);
|
|
112
112
|
}), O(() => (t.current && d(t.current), () => {
|
|
113
113
|
var i;
|
|
114
114
|
(i = r.current) == null || i.disconnect(), r.current = null;
|
|
@@ -160,7 +160,7 @@ function Q(e) {
|
|
|
160
160
|
a.clientWidth - c.documentElement.clientWidth
|
|
161
161
|
) <= J;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function h() {
|
|
164
164
|
const l = s.getComputedStyle(a);
|
|
165
165
|
return {
|
|
166
166
|
backgroundColor: l.backgroundColor,
|
|
@@ -173,12 +173,12 @@ function Q(e) {
|
|
|
173
173
|
l && P(c);
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
l ? K(c,
|
|
176
|
+
l ? K(c, h) : B(c, h), o.current = l;
|
|
177
177
|
}
|
|
178
178
|
f();
|
|
179
|
-
const
|
|
179
|
+
const m = r.subscribe(f), d = typeof s.matchMedia == "function" ? s.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
180
180
|
return d == null || d.addEventListener("change", f), () => {
|
|
181
|
-
|
|
181
|
+
m(), d == null || d.removeEventListener("change", f), o.current && (B(c, h), o.current = !1);
|
|
182
182
|
};
|
|
183
183
|
}, [n, t, r]), S(() => {
|
|
184
184
|
!o.current || !t || P(t.ownerDocument);
|
|
@@ -193,9 +193,9 @@ const ee = z(
|
|
|
193
193
|
style: c,
|
|
194
194
|
theme: s = "auto",
|
|
195
195
|
accent: y,
|
|
196
|
-
decoration:
|
|
196
|
+
decoration: h = "grid",
|
|
197
197
|
width: f = "narrow",
|
|
198
|
-
height:
|
|
198
|
+
height: m = "content",
|
|
199
199
|
spacing: d = "standard",
|
|
200
200
|
...l
|
|
201
201
|
} = n, {
|
|
@@ -220,9 +220,9 @@ const ee = z(
|
|
|
220
220
|
ref: p,
|
|
221
221
|
className: ["nk-boundary", a].filter(Boolean).join(" "),
|
|
222
222
|
"data-theme": s,
|
|
223
|
-
"data-decoration":
|
|
223
|
+
"data-decoration": h,
|
|
224
224
|
"data-width": f,
|
|
225
|
-
"data-height":
|
|
225
|
+
"data-height": m,
|
|
226
226
|
"data-spacing": d,
|
|
227
227
|
style: F
|
|
228
228
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const r=require("react/jsx-runtime"),y=require("react"),B=require("./Icon-BFaHVAoQ.cjs"),K=require("./Spinner-BE0F4y2S.cjs");function x(t){return t==null||typeof t=="boolean"||typeof t=="string"&&!t.trim()?!1:Array.isArray(t)?t.some(x):y.isValidElement(t)&&t.type===y.Fragment?x(t.props.children):!0}function $(t,a){const l=t.getBoundingClientRect(),b=a.clientX-l.left,u=a.clientY-l.top;t.style.setProperty("--nk-button-glow-x",`${b}px`),t.style.setProperty("--nk-button-glow-y",`${u}px`)}const G=y.forwardRef(function(a,l){const{as:b,children:u,className:w,disabled:I,fullWidth:A=!1,icon:s,iconAlignment:k="left",loading:h=!1,onClick:q,onKeyDown:v,onMouseMove:D,role:g,shape:R="capsule",size:z="medium",tabIndex:P,textAlignment:E="center",tone:M,variant:N="primary",...c}=a,i=b??"button",o=I||h,S=!!s&&!x(u),d=i==="a"&&"href"in c&&typeof c.href=="string",f=typeof i=="string"&&i!=="button"&&!d,_=e=>{if(o){e.preventDefault(),e.stopPropagation();return}const n=q;n==null||n(e)},T=e=>{$(e.currentTarget,e);const n=D;n==null||n(e)},C=e=>{const n=v;n==null||n(e),!(e.defaultPrevented||o||!f||e.key!=="Enter"&&e.key!==" ")&&(e.preventDefault(),e.currentTarget.click())},j={"aria-disabled":o||void 0};i==="button"&&(j.type=c.type??"button");const F=d&&o?{href:void 0}:void 0;let m=g;d&&o?m=g??"link":f&&(m=g??"button");let p=P;return i!=="button"&&(d&&o?p=void 0:o?p=-1:f&&(p=P??0)),y.createElement(i,{...c,...j,...F,ref:l,"aria-busy":h||void 0,className:["nk-button",w].filter(Boolean).join(" "),"data-full-width":A||void 0,"data-icon-only":S||void 0,"data-shape":R,"data-size":z,"data-tone":M,"data-variant":N,onClick:_,onKeyDown:f?C:v,onMouseMove:T,role:m,tabIndex:p},r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"nk-button__content",style:{justifyContent:E},children:[s&&k==="left"?r.jsx(B.Icon,{type:s}):null,u,s&&k==="right"?r.jsx(B.Icon,{type:s}):null]}),h?r.jsx(K.Spinner,{"aria-hidden":"true","aria-label":void 0,className:"nk-button__spinner",role:void 0,size:16}):null]}))});exports.Button=G;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as B, Fragment as
|
|
3
|
-
import { forwardRef as
|
|
2
|
+
import { jsxs as B, Fragment as K, jsx as g } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as q, createElement as G, isValidElement as O, Fragment as V } from "react";
|
|
4
4
|
import { I as w } from "./Icon-Cj1s40xn.js";
|
|
5
|
-
import { S as
|
|
5
|
+
import { S as W } from "./Spinner-CmxlDlOk.js";
|
|
6
6
|
function h(t) {
|
|
7
|
-
return t == null || typeof t == "boolean" || typeof t == "string" && !t.trim() ? !1 : Array.isArray(t) ? t.some(h) :
|
|
7
|
+
return t == null || typeof t == "boolean" || typeof t == "string" && !t.trim() ? !1 : Array.isArray(t) ? t.some(h) : O(t) && t.type === V ? h(t.props.children) : !0;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function X(t, a) {
|
|
10
10
|
const s = t.getBoundingClientRect(), p = a.clientX - s.left, l = a.clientY - s.top;
|
|
11
11
|
t.style.setProperty("--nk-button-glow-x", `${p}px`), t.style.setProperty("--nk-button-glow-y", `${l}px`);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const Q = q(function(a, s) {
|
|
14
14
|
const {
|
|
15
15
|
as: p,
|
|
16
16
|
children: l,
|
|
@@ -22,46 +22,48 @@ const L = K(function(a, s) {
|
|
|
22
22
|
loading: y = !1,
|
|
23
23
|
onClick: j,
|
|
24
24
|
onKeyDown: v,
|
|
25
|
-
onMouseMove:
|
|
25
|
+
onMouseMove: z,
|
|
26
26
|
role: b,
|
|
27
|
-
shape:
|
|
27
|
+
shape: E = "capsule",
|
|
28
|
+
size: M = "medium",
|
|
28
29
|
tabIndex: x,
|
|
29
30
|
textAlignment: N = "center",
|
|
30
31
|
tone: R,
|
|
31
32
|
variant: S = "primary",
|
|
32
33
|
...u
|
|
33
|
-
} = a, i = p ?? "button", n = I || y, _ = !!r && !h(l), d = i === "a" && "href" in u && typeof u.href == "string", c = typeof i == "string" && i !== "button" && !d, F = (
|
|
34
|
+
} = a, i = p ?? "button", n = I || y, _ = !!r && !h(l), d = i === "a" && "href" in u && typeof u.href == "string", c = typeof i == "string" && i !== "button" && !d, F = (e) => {
|
|
34
35
|
if (n) {
|
|
35
|
-
|
|
36
|
+
e.preventDefault(), e.stopPropagation();
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
}, T = (
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
}, $ = (
|
|
45
|
-
const
|
|
46
|
-
|
|
39
|
+
const o = j;
|
|
40
|
+
o == null || o(e);
|
|
41
|
+
}, T = (e) => {
|
|
42
|
+
X(e.currentTarget, e);
|
|
43
|
+
const o = z;
|
|
44
|
+
o == null || o(e);
|
|
45
|
+
}, $ = (e) => {
|
|
46
|
+
const o = v;
|
|
47
|
+
o == null || o(e), !(e.defaultPrevented || n || !c || e.key !== "Enter" && e.key !== " ") && (e.preventDefault(), e.currentTarget.click());
|
|
47
48
|
}, P = { "aria-disabled": n || void 0 };
|
|
48
49
|
i === "button" && (P.type = u.type ?? "button");
|
|
49
|
-
const
|
|
50
|
+
const C = d && n ? { href: void 0 } : void 0;
|
|
50
51
|
let m = b;
|
|
51
52
|
d && n ? m = b ?? "link" : c && (m = b ?? "button");
|
|
52
53
|
let f = x;
|
|
53
|
-
return i !== "button" && (d && n ? f = void 0 : n ? f = -1 : c && (f = x ?? 0)),
|
|
54
|
+
return i !== "button" && (d && n ? f = void 0 : n ? f = -1 : c && (f = x ?? 0)), G(
|
|
54
55
|
i,
|
|
55
56
|
{
|
|
56
57
|
...u,
|
|
57
58
|
...P,
|
|
58
|
-
...
|
|
59
|
+
...C,
|
|
59
60
|
ref: s,
|
|
60
61
|
"aria-busy": y || void 0,
|
|
61
62
|
className: ["nk-button", A].filter(Boolean).join(" "),
|
|
62
63
|
"data-full-width": D || void 0,
|
|
63
64
|
"data-icon-only": _ || void 0,
|
|
64
|
-
"data-shape":
|
|
65
|
+
"data-shape": E,
|
|
66
|
+
"data-size": M,
|
|
65
67
|
"data-tone": R,
|
|
66
68
|
"data-variant": S,
|
|
67
69
|
onClick: F,
|
|
@@ -70,7 +72,7 @@ const L = K(function(a, s) {
|
|
|
70
72
|
role: m,
|
|
71
73
|
tabIndex: f
|
|
72
74
|
},
|
|
73
|
-
/* @__PURE__ */ B(
|
|
75
|
+
/* @__PURE__ */ B(K, { children: [
|
|
74
76
|
/* @__PURE__ */ B(
|
|
75
77
|
"span",
|
|
76
78
|
{
|
|
@@ -84,7 +86,7 @@ const L = K(function(a, s) {
|
|
|
84
86
|
}
|
|
85
87
|
),
|
|
86
88
|
y ? /* @__PURE__ */ g(
|
|
87
|
-
|
|
89
|
+
W,
|
|
88
90
|
{
|
|
89
91
|
"aria-hidden": "true",
|
|
90
92
|
"aria-label": void 0,
|
|
@@ -97,5 +99,5 @@ const L = K(function(a, s) {
|
|
|
97
99
|
);
|
|
98
100
|
});
|
|
99
101
|
export {
|
|
100
|
-
|
|
102
|
+
Q as B
|
|
101
103
|
};
|
package/dist/Button.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Button-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Button-CTzvBhGH.cjs");exports.default=e.Button;
|
package/dist/Button.js
CHANGED
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-CTzvBhGH.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,7 +1,7 @@
|
|
|
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-CyUpMPtt.js";
|
|
5
5
|
import { S as M } from "./Spinner-CmxlDlOk.js";
|
|
6
6
|
import { h as Q, r as W } from "./aria-Bv-xVREf.js";
|
|
7
7
|
import { a as X } from "./reference-CXMr27nM.js";
|
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-Z8Q6XRkc.cjs"),k=require("./Text-DWYlIcPj.cjs"),Z={bash:"Shell",c:"C","c++":"C++",cpp:"C++",css:"CSS",go:"Go",golang:"Go",html:"HTML",js:"JavaScript",javascript:"JavaScript",jsx:"JavaScript",json:"JSON",markdown:"Markdown",md:"Markdown",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",rs:"Rust",rust:"Rust",sh:"Shell",shell:"Shell",sql:"SQL",ts:"TypeScript",tsx:"TypeScript",typescript:"TypeScript",xml:"HTML",yaml:"YAML",yml:"YAML"};function ee(e){var a;const o=(a=e==null?void 0:e.split(/\s+/).find(f=>f.startsWith("language-")))==null?void 0:a.slice(9).toLowerCase();return o?Z[o]:void 0}const A="md-",B=["a","blockquote","br","code","del","em","h1","h2","h3","h4","h5","h6","hr","img","input","li","ol","p","picture","pre","section","source","strong","sup","table","tbody","td","th","thead","tr","ul"],ne={...H.defaultSchema,allowComments:!1,allowDoctypes:!1,ancestors:{...H.defaultSchema.ancestors,source:["picture"]},attributes:{"*":["dir","id","lang","title"],a:["ariaDescribedBy","ariaLabel","dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href","hrefLang"],code:[["className",/^language-[\w+-]+$/]],h2:[["className","sr-only"]],img:["alt","height","src","srcSet","width"],input:["checked",["disabled",!0],"readOnly",["type","checkbox"]],li:[["className","task-list-item"]],ol:["start",["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],source:["media","srcSet","type"],td:["align","colSpan","rowSpan"],th:["align","colSpan","rowSpan","scope"],ul:[["className","contains-task-list"]]},clobber:H.defaultSchema.clobber,clobberPrefix:A,strip:["script","style"],tagNames:[...B]};function re(e,o){const a=o.flags.replace(/[gy]/g,"");return new RegExp(o.source,a).test(e)}function te(e){if(!e)return null;try{const o=new URL(e);return o.protocol!=="http:"&&o.protocol!=="https:"||o.username||o.password?null:o}catch{return null}}function R(e,o,a){if(e.includes("\\")||/[\u0000-\u0020\u007f]/.test(e)||o===void 0)return;const f=/^[a-z][a-z\d+.-]*:/i.test(e),m=e.startsWith("//");if(o==="*")return!f&&!m||/^https?:/i.test(e)||m?e:void 0;const s=Array.isArray(o)?o:[o],t=te(a);try{let n=null;if(f?n=new URL(e):t&&(n=new URL(e,t)),!n||n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password)return;const r=n.href;return s.some(c=>re(r,c))?r:void 0}catch{return}}function v(e,o,a){if(!e)return;const m=e.split(",").map(s=>{const t=s.trim().split(/\s+/),[n,r]=t,u=r===void 0||/^(?:\d+w|(?:\d+(?:\.\d+)?|\.\d+)x)$/.test(r);if(t.length>2||!u||n===void 0||n.length===0)return null;const c=R(n,o,a);return c?`${c}${r?` ${r}`:""}`:null});if(!m.some(s=>s===null))return m.join(", ")}function oe(){function e(o){o.children=o.children.filter(a=>a.type!=="element"||a.tagName!=="input"||a.position===void 0),o.children.forEach(a=>{a.type==="element"&&e(a)})}return o=>e(o)}function S(e,o){return Array.isArray(e)?e.map(a=>typeof a=="string"?`${o}${a}`:a):typeof e=="string"?e.split(/\s+/).map(a=>`${o}${a}`).join(" "):e}function se(e){const{clobberPrefix:o,prefix:a}=e;function f(m){if(m.type==="element"){const{properties:s}=m;s.id=S(s.id,a),s.name=S(s.name,a),s.ariaDescribedBy=S(s.ariaDescribedBy,a),s.ariaLabelledBy=S(s.ariaLabelledBy,a),typeof s.href=="string"&&s.href.startsWith("#")&&(s.href=`#${o}${a}${s.href.slice(1)}`)}"children"in m&&m.children.forEach(f)}return m=>f(m)}function C(e){return e==="center"||e==="left"||e==="right"?e:void 0}function E(e){return e.type==="text"?e.value:"children"in e?e.children.map(E).join(""):""}function T(e){return typeof e=="string"?e:void 0}function ie(e){if(!e)return null;const o=e.children.find(n=>n.type==="element"&&n.tagName==="code");if(!o||e.children.some(n=>n!==o&&(n.type!=="text"||n.value.trim().length>0)))return null;const f=o.properties.className;let m;Array.isArray(f)?m=f.join(" "):typeof f=="string"&&(m=f);const s=o.children.map(E).join("").replace(/\n$/,"");return{codeProps:{className:m,dir:T(o.properties.dir),id:T(o.properties.id),lang:T(o.properties.lang),title:T(o.properties.title)},content:s}}function ae(e,o,a,f,m){return{a:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("a",{...i,className:["nk-markdown__link",r].filter(Boolean).join(" "),onClick:m,children:n})},blockquote:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx("blockquote",{...c,className:"nk-markdown__blockquote",children:n})},code:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("code",{...i,className:["nk-markdown__inline-code",r].filter(Boolean).join(" "),children:n})},h1:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h1",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"heading",weight:"semibold",children:n})},h2:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h2",className:["nk-markdown__heading",r!=null&&r.split(/\s+/).includes("sr-only")?"nk-markdown__visually-hidden":void 0].filter(Boolean).join(" "),size:"title",weight:"semibold",children:n})},h3:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h3",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"subtitle",weight:"semibold",children:n})},h4:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h4",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h5:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h5",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h6:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h6",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"medium",children:n})},hr:function(t){const{dangerouslySetInnerHTML:n,node:r,...u}=t;return d.jsx(Q.Divider,{...u})},img:function(t){const{alt:n,className:r,dangerouslySetInnerHTML:u,node:c,src:i,srcSet:l,...b}=t,x=R(typeof i=="string"?i:"",e,o),L=v(l,e,o);return x?d.jsx("img",{...b,alt:n??"",className:["nk-markdown__image",r].filter(Boolean).join(" "),decoding:"async",loading:"lazy",src:x,srcSet:L}):n?d.jsx("span",{className:"nk-markdown__blocked-image",children:n}):null},input:function(t){const{checked:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsxs(d.Fragment,{children:[d.jsx("input",{...i,"aria-label":n?"Completed task":"Incomplete task",checked:n,className:["nk-markdown__task-control","nk-markdown__visually-hidden",r].filter(Boolean).join(" "),disabled:!0,readOnly:!0,type:"checkbox"}),d.jsx("span",{"aria-hidden":"true",className:"nk-markdown__task",children:n?"☒":"☐"})]})},li:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("task-list-item"))??!1;return d.jsx("li",{...i,className:["nk-markdown__list-item",l?"nk-markdown__list-item--task":void 0].filter(Boolean).join(" "),children:n})},ol:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ol",{...i,className:["nk-markdown__list","nk-markdown__list--ordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})},p:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,className:["nk-markdown__paragraph",r].filter(Boolean).join(" "),children:n})},picture:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("picture",{...i,className:["nk-markdown__picture",r].filter(Boolean).join(" "),children:n})},pre:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,ref:c,...i}=t,l=ie(u);return l?d.jsx(X.Code,{code:l.content,codeProps:l.codeProps,language:ee(l.codeProps.className),maxHighlightLength:a,maxLineCount:f,preProps:i}):d.jsx("pre",{...i,children:n})},source:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,srcSet:c,...i}=t,l=v(c,e,o);return l?d.jsx("source",{...i,srcSet:l}):null},table:function(t){const{children:n,dangerouslySetInnerHTML:r,frame:u,node:c,...i}=t;return d.jsx(_.Table,{...i,children:n})},tbody:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Body,{...c,children:n})},td:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.Cell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},th:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.HeaderCell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},thead:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Head,{...c,children:n})},tr:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,onClick:c,...i}=t;return d.jsx(_.Table.Row,{...i,children:n})},ul:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ul",{...i,className:["nk-markdown__list","nk-markdown__list--unordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})}}}const le={clobberPrefix:""},ce=25e3,de="Markdown content exceeds the rendering limit.";function ue(e,o){if(!e.startsWith("#")||e.length===1)return null;let a=e.slice(1);try{a=decodeURIComponent(a)}catch{return null}return o.getElementById(a)}function me(e){const o=e.tabIndex<0&&!e.hasAttribute("tabindex");if(o&&e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),!!o){if(e.ownerDocument.activeElement!==e){e.removeAttribute("tabindex");return}e.addEventListener("blur",()=>e.removeAttribute("tabindex"),{once:!0})}}function fe(e,o){const a=e,f=new a.HashChangeEvent("hashchange",{newURL:e.location.href,oldURL:o});e.dispatchEvent(f)}function he(e){return e===null?null:Number.isFinite(e)?Math.max(0,Math.floor(e)):0}const pe=M.forwardRef(function(o,a){const{allowedImageSources:f,anchorPrefix:m="",className:s,content:t,dangerouslySetInnerHTML:n,imageBaseUrl:r,maxCodeHighlightLength:u,maxCodeLineCount:c,maxContentLength:i=ce,rehypePlugins:l,remarkPlugins:b,scrollOffset:g=128,style:x,...L}=o,P=he(i),D=P!==null&&t.length>P,j=M.useCallback(h=>{var N;if(h.defaultPrevented||h.button!==0||h.metaKey||h.ctrlKey||h.shiftKey||h.altKey)return;const y=h.currentTarget.getAttribute("href");if(!y)return;const w=ue(y,h.currentTarget.ownerDocument);if(!w||typeof w.scrollIntoView!="function")return;const p=w.ownerDocument.defaultView;if(!p)return;h.preventDefault();const z=((N=p.matchMedia)==null?void 0:N.call(p,"(prefers-reduced-motion: reduce)").matches)??!1,F=g===null||z?"auto":"smooth",U=p.location.href,K=p.location.hash!==y;p.location.hash!==y&&p.history.pushState(p.history.state,"",y),me(w),w.scrollIntoView({behavior:F,block:"start"}),K&&fe(p,U)},[g]),O=M.useMemo(()=>ae(f,r,u,c,j),[f,j,r,u,c]),q=M.useMemo(()=>[J,...b??[]],[b]),$=M.useMemo(()=>[W,...l??[],oe,V,[se,{clobberPrefix:A,prefix:m}],[H,ne]],[m,l]),I={...x};if(g!==null){const h=Number.isFinite(g)?Math.max(0,g):0;I["--nk-markdown-scroll-offset"]=`${h}px`}return d.jsx("div",{...L,ref:a,className:["nk-markdown",s].filter(Boolean).join(" "),style:I,children:D?d.jsx(Y.Alert,{role:"alert",tone:"warning",children:de}):d.jsx(G,{allowedElements:B,components:O,rehypePlugins:$,remarkPlugins:q,remarkRehypeOptions:le,children:t})})});exports.default=pe;
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),M=require("react"),G=require("react-markdown"),W=require("rehype-raw"),H=require("rehype-sanitize"),V=require("rehype-slug"),J=require("remark-gfm"),Y=require("./Alert-LJDkNUqH.cjs"),X=require("./Code-f0GWveGp.cjs"),Q=require("./Divider-C7XGlr26.cjs"),_=require("./Table-BbH9oy3Z.cjs"),k=require("./Text-DWYlIcPj.cjs"),Z={bash:"Shell",c:"C","c++":"C++",cpp:"C++",css:"CSS",go:"Go",golang:"Go",html:"HTML",js:"JavaScript",javascript:"JavaScript",jsx:"JavaScript",json:"JSON",markdown:"Markdown",md:"Markdown",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",rs:"Rust",rust:"Rust",sh:"Shell",shell:"Shell",sql:"SQL",ts:"TypeScript",tsx:"TypeScript",typescript:"TypeScript",xml:"HTML",yaml:"YAML",yml:"YAML"};function ee(e){var a;const o=(a=e==null?void 0:e.split(/\s+/).find(f=>f.startsWith("language-")))==null?void 0:a.slice(9).toLowerCase();return o?Z[o]:void 0}const A="md-",B=["a","blockquote","br","code","del","em","h1","h2","h3","h4","h5","h6","hr","img","input","li","ol","p","picture","pre","section","source","strong","sup","table","tbody","td","th","thead","tr","ul"],ne={...H.defaultSchema,allowComments:!1,allowDoctypes:!1,ancestors:{...H.defaultSchema.ancestors,source:["picture"]},attributes:{"*":["dir","id","lang","title"],a:["ariaDescribedBy","ariaLabel","dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href","hrefLang"],code:[["className",/^language-[\w+-]+$/]],h2:[["className","sr-only"]],img:["alt","height","src","srcSet","width"],input:["checked",["disabled",!0],"readOnly",["type","checkbox"]],li:[["className","task-list-item"]],ol:["start",["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],source:["media","srcSet","type"],td:["align","colSpan","rowSpan"],th:["align","colSpan","rowSpan","scope"],ul:[["className","contains-task-list"]]},clobber:H.defaultSchema.clobber,clobberPrefix:A,strip:["script","style"],tagNames:[...B]};function re(e,o){const a=o.flags.replace(/[gy]/g,"");return new RegExp(o.source,a).test(e)}function te(e){if(!e)return null;try{const o=new URL(e);return o.protocol!=="http:"&&o.protocol!=="https:"||o.username||o.password?null:o}catch{return null}}function R(e,o,a){if(e.includes("\\")||/[\u0000-\u0020\u007f]/.test(e)||o===void 0)return;const f=/^[a-z][a-z\d+.-]*:/i.test(e),m=e.startsWith("//");if(o==="*")return!f&&!m||/^https?:/i.test(e)||m?e:void 0;const s=Array.isArray(o)?o:[o],t=te(a);try{let n=null;if(f?n=new URL(e):t&&(n=new URL(e,t)),!n||n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password)return;const r=n.href;return s.some(c=>re(r,c))?r:void 0}catch{return}}function v(e,o,a){if(!e)return;const m=e.split(",").map(s=>{const t=s.trim().split(/\s+/),[n,r]=t,u=r===void 0||/^(?:\d+w|(?:\d+(?:\.\d+)?|\.\d+)x)$/.test(r);if(t.length>2||!u||n===void 0||n.length===0)return null;const c=R(n,o,a);return c?`${c}${r?` ${r}`:""}`:null});if(!m.some(s=>s===null))return m.join(", ")}function oe(){function e(o){o.children=o.children.filter(a=>a.type!=="element"||a.tagName!=="input"||a.position===void 0),o.children.forEach(a=>{a.type==="element"&&e(a)})}return o=>e(o)}function S(e,o){return Array.isArray(e)?e.map(a=>typeof a=="string"?`${o}${a}`:a):typeof e=="string"?e.split(/\s+/).map(a=>`${o}${a}`).join(" "):e}function se(e){const{clobberPrefix:o,prefix:a}=e;function f(m){if(m.type==="element"){const{properties:s}=m;s.id=S(s.id,a),s.name=S(s.name,a),s.ariaDescribedBy=S(s.ariaDescribedBy,a),s.ariaLabelledBy=S(s.ariaLabelledBy,a),typeof s.href=="string"&&s.href.startsWith("#")&&(s.href=`#${o}${a}${s.href.slice(1)}`)}"children"in m&&m.children.forEach(f)}return m=>f(m)}function C(e){return e==="center"||e==="left"||e==="right"?e:void 0}function E(e){return e.type==="text"?e.value:"children"in e?e.children.map(E).join(""):""}function T(e){return typeof e=="string"?e:void 0}function ie(e){if(!e)return null;const o=e.children.find(n=>n.type==="element"&&n.tagName==="code");if(!o||e.children.some(n=>n!==o&&(n.type!=="text"||n.value.trim().length>0)))return null;const f=o.properties.className;let m;Array.isArray(f)?m=f.join(" "):typeof f=="string"&&(m=f);const s=o.children.map(E).join("").replace(/\n$/,"");return{codeProps:{className:m,dir:T(o.properties.dir),id:T(o.properties.id),lang:T(o.properties.lang),title:T(o.properties.title)},content:s}}function ae(e,o,a,f,m){return{a:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("a",{...i,className:["nk-markdown__link",r].filter(Boolean).join(" "),onClick:m,children:n})},blockquote:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx("blockquote",{...c,className:"nk-markdown__blockquote",children:n})},code:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("code",{...i,className:["nk-markdown__inline-code",r].filter(Boolean).join(" "),children:n})},h1:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h1",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"heading",weight:"semibold",children:n})},h2:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h2",className:["nk-markdown__heading",r!=null&&r.split(/\s+/).includes("sr-only")?"nk-markdown__visually-hidden":void 0].filter(Boolean).join(" "),size:"title",weight:"semibold",children:n})},h3:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h3",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"subtitle",weight:"semibold",children:n})},h4:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h4",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h5:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h5",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h6:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h6",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"medium",children:n})},hr:function(t){const{dangerouslySetInnerHTML:n,node:r,...u}=t;return d.jsx(Q.Divider,{...u})},img:function(t){const{alt:n,className:r,dangerouslySetInnerHTML:u,node:c,src:i,srcSet:l,...b}=t,x=R(typeof i=="string"?i:"",e,o),L=v(l,e,o);return x?d.jsx("img",{...b,alt:n??"",className:["nk-markdown__image",r].filter(Boolean).join(" "),decoding:"async",loading:"lazy",src:x,srcSet:L}):n?d.jsx("span",{className:"nk-markdown__blocked-image",children:n}):null},input:function(t){const{checked:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsxs(d.Fragment,{children:[d.jsx("input",{...i,"aria-label":n?"Completed task":"Incomplete task",checked:n,className:["nk-markdown__task-control","nk-markdown__visually-hidden",r].filter(Boolean).join(" "),disabled:!0,readOnly:!0,type:"checkbox"}),d.jsx("span",{"aria-hidden":"true",className:"nk-markdown__task",children:n?"☒":"☐"})]})},li:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("task-list-item"))??!1;return d.jsx("li",{...i,className:["nk-markdown__list-item",l?"nk-markdown__list-item--task":void 0].filter(Boolean).join(" "),children:n})},ol:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ol",{...i,className:["nk-markdown__list","nk-markdown__list--ordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})},p:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,className:["nk-markdown__paragraph",r].filter(Boolean).join(" "),children:n})},picture:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("picture",{...i,className:["nk-markdown__picture",r].filter(Boolean).join(" "),children:n})},pre:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,ref:c,...i}=t,l=ie(u);return l?d.jsx(X.Code,{code:l.content,codeProps:l.codeProps,language:ee(l.codeProps.className),maxHighlightLength:a,maxLineCount:f,preProps:i}):d.jsx("pre",{...i,children:n})},source:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,srcSet:c,...i}=t,l=v(c,e,o);return l?d.jsx("source",{...i,srcSet:l}):null},table:function(t){const{children:n,dangerouslySetInnerHTML:r,frame:u,node:c,...i}=t;return d.jsx(_.Table,{...i,children:n})},tbody:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Body,{...c,children:n})},td:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.Cell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},th:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.HeaderCell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},thead:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Head,{...c,children:n})},tr:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,onClick:c,...i}=t;return d.jsx(_.Table.Row,{...i,children:n})},ul:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ul",{...i,className:["nk-markdown__list","nk-markdown__list--unordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})}}}const le={clobberPrefix:""},ce=25e3,de="Markdown content exceeds the rendering limit.";function ue(e,o){if(!e.startsWith("#")||e.length===1)return null;let a=e.slice(1);try{a=decodeURIComponent(a)}catch{return null}return o.getElementById(a)}function me(e){const o=e.tabIndex<0&&!e.hasAttribute("tabindex");if(o&&e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),!!o){if(e.ownerDocument.activeElement!==e){e.removeAttribute("tabindex");return}e.addEventListener("blur",()=>e.removeAttribute("tabindex"),{once:!0})}}function fe(e,o){const a=e,f=new a.HashChangeEvent("hashchange",{newURL:e.location.href,oldURL:o});e.dispatchEvent(f)}function he(e){return e===null?null:Number.isFinite(e)?Math.max(0,Math.floor(e)):0}const pe=M.forwardRef(function(o,a){const{allowedImageSources:f,anchorPrefix:m="",className:s,content:t,dangerouslySetInnerHTML:n,imageBaseUrl:r,maxCodeHighlightLength:u,maxCodeLineCount:c,maxContentLength:i=ce,rehypePlugins:l,remarkPlugins:b,scrollOffset:g=128,style:x,...L}=o,P=he(i),D=P!==null&&t.length>P,j=M.useCallback(h=>{var N;if(h.defaultPrevented||h.button!==0||h.metaKey||h.ctrlKey||h.shiftKey||h.altKey)return;const y=h.currentTarget.getAttribute("href");if(!y)return;const w=ue(y,h.currentTarget.ownerDocument);if(!w||typeof w.scrollIntoView!="function")return;const p=w.ownerDocument.defaultView;if(!p)return;h.preventDefault();const z=((N=p.matchMedia)==null?void 0:N.call(p,"(prefers-reduced-motion: reduce)").matches)??!1,F=g===null||z?"auto":"smooth",U=p.location.href,K=p.location.hash!==y;p.location.hash!==y&&p.history.pushState(p.history.state,"",y),me(w),w.scrollIntoView({behavior:F,block:"start"}),K&&fe(p,U)},[g]),O=M.useMemo(()=>ae(f,r,u,c,j),[f,j,r,u,c]),q=M.useMemo(()=>[J,...b??[]],[b]),$=M.useMemo(()=>[W,...l??[],oe,V,[se,{clobberPrefix:A,prefix:m}],[H,ne]],[m,l]),I={...x};if(g!==null){const h=Number.isFinite(g)?Math.max(0,g):0;I["--nk-markdown-scroll-offset"]=`${h}px`}return d.jsx("div",{...L,ref:a,className:["nk-markdown",s].filter(Boolean).join(" "),style:I,children:D?d.jsx(Y.Alert,{role:"alert",tone:"warning",children:de}):d.jsx(G,{allowedElements:B,components:O,rehypePlugins:$,remarkPlugins:q,remarkRehypeOptions:le,children:t})})});exports.default=pe;
|
package/dist/Markdown.js
CHANGED
|
@@ -9,7 +9,7 @@ import ee from "remark-gfm";
|
|
|
9
9
|
import { A as ne } from "./Alert-DQ5CCE0N.js";
|
|
10
10
|
import { C as re } from "./Code-pROJjsiG.js";
|
|
11
11
|
import { D as te } from "./Divider-DZgpYpr-.js";
|
|
12
|
-
import { T as _ } from "./Table-
|
|
12
|
+
import { T as _ } from "./Table-rTy_IuSv.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"),g=require("./effects-D98vUn6N.cjs"),$=require("./reference-C2guRuR0.cjs"),G=require("./Button-
|
|
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-CTzvBhGH.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
|
@@ -3,7 +3,7 @@ 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
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-
|
|
6
|
+
import { B as X } from "./Button-CyUpMPtt.js";
|
|
7
7
|
import { b as Y, P as Z, F as w, c as ee, d as oe } from "./usePresence-BTRY1_l-.js";
|
|
8
8
|
import { u as ae } from "./useFocusTrap-BxPazAL6.js";
|
|
9
9
|
import { u as se } from "./useScrollLock-Drd7OZRC.js";
|
package/dist/Sidebar.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"),t=require("react"),R=require("./effects-D98vUn6N.cjs"),H=require("./reference-C2guRuR0.cjs"),P=require("./usePresence-Dm0mls5p.cjs"),G=require("./Button-6oWs-pyF.cjs"),U=require("./Text-DWYlIcPj.cjs"),ae=require("./useFocusTrap-CrMcAu8s.cjs"),oe=require("./useScrollLock-Dy8MZaSn.cjs"),ie=require("./aria-DM-xYEHQ.cjs"),le=require("./useFloatingPosition-DQgw-w_Z.cjs"),ce=require("./Avatar-Belo7qAY.cjs"),ue=require("./Spinner-BE0F4y2S.cjs"),de=require("./Tooltip-DDPh_YFO.cjs"),fe=require("./units-PzuiQNnw.cjs");function be(s){const{label:n,onToggle:e,panelId:r,reference:b,side:u,sidebarOpen:i}=s;return l.jsx(G.Button,{ref:b,"aria-controls":r,"aria-expanded":i,"aria-haspopup":"dialog","aria-label":n,className:"nk-sidebar__fallback-trigger","data-side":u,icon:"burger",onClick:e})}const q=new WeakMap;function Z(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=Z(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=Z(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ve=()=>{};function O(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 W=t.forwardRef(function(n,e){const{children:r,className:b,presentation:u="both",...i}=n,o=O("Sidebar.Footer");return D(u,o==null?void 0:o.presentation)?l.jsx("div",{...i,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:u,className:i,label:o,presentation:y="both",...p}=n,S=O("Sidebar.Group"),c=`${t.useId()}-label`,h=o!=null&&typeof o!="boolean"&&(typeof o!="string"||o.trim()!=="");if(!D(y,S==null?void 0:S.presentation))return null;const d=b??(r===void 0&&h?c:void 0),a=!!(r??d);return t.createElement(a?"nav":"div",{...p,ref:e,"aria-label":r,"aria-labelledby":d,className:["nk-sidebar__group",i].filter(Boolean).join(" ")},h?l.jsx(U.Text,{as:"h2",className:"nk-sidebar__group-label",id:c,size:"subtitle",weight:"medium",children:o}):null,l.jsx("ul",{className:"nk-sidebar__list",children:u}))}),Se=t.forwardRef(function(n,e){const{children:r,className:b,presentation:u="both",...i}=n,o=O("Sidebar.Header");return D(u,o==null?void 0:o.presentation)?l.jsx("div",{...i,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:u,className:i,disabled:o=!1,icon:y,onClick:p,presentation:S="both",type:c,...h}=n,d=O("Sidebar.Item"),a=b??"button",f=a==="button",g=h,E=g.href!==void 0||g.to!==void 0;function v(k){if(o){k.preventDefault();return}p==null||p(k),d!=null&&d.open&&d.presentation==="overlay"&&!k.defaultPrevented&&d.requestOpenChange(!1,"item")}return D(S,d==null?void 0:d.presentation)?l.jsx("li",{className:"nk-sidebar__item-container",children:l.jsx(G.Button,{...h,ref:e,"aria-current":r?E?"page":"true":void 0,as:a,className:["nk-sidebar__item",i].filter(Boolean).join(" "),"data-active":r||void 0,disabled:o,fullWidth:!0,href:g.href,icon:y,onClick:v,shape:"rectangle",textAlignment:"left",type:f?c??"button":c,variant:"ghost",children:l.jsx("span",{className:"nk-sidebar__item-label",children:u})})}):null}),Ee=1;function Ce(s){return s==null?void 0:s.ResizeObserver}function xe(s){return s==null?void 0:s.MutationObserver}function _e(){const[s,n]=t.useState(!1),e=t.useRef(null),r=t.useCallback(i=>{const o=i.scrollHeight-i.scrollTop-i.clientHeight;n(o>Ee)},[]),b=t.useCallback(i=>{var g;if((g=e.current)==null||g.call(e),e.current=null,!i)return;const o=i;r(o);function y(){r(o)}const p=o.ownerDocument.defaultView;p==null||p.addEventListener("resize",y);const S=Ce(p),c=S?new S(y):void 0;function h(){c==null||c.disconnect(),c==null||c.observe(o);for(const E of o.children)c==null||c.observe(E)}h();function d(E){E.some(k=>k.type==="childList")&&h(),y()}const a=xe(p),f=a?new a(d):void 0;f==null||f.observe(o,{attributeFilter:["class","hidden","style"],characterData:!0,childList:!0,subtree:!0}),e.current=()=>{p==null||p.removeEventListener("resize",y),c==null||c.disconnect(),f==null||f.disconnect()}},[r]),u=t.useCallback(i=>{r(i.currentTarget)},[r]);return{containerReference:b,contentBelow:s,handleScroll:u}}function je(s,n){for(const e of t.Children.toArray(s)){if(t.isValidElement(e)&&e.type===t.Fragment){const r=ee(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===W?n.footerChildren.push(e):n.bodyChildren.push(e)}}function ee(s){const n={bodyChildren:[],footerChildren:[]};return je(s,n),n}function ne(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:b,height:u,open:i,panelId:o,panelReference:y,presentation:p,side:S,state:c,style:h,width:d,...a}=s,{containerReference:f,contentBelow:g,handleScroll:E}=_e(),v=p==="overlay",{bodyChildren:k,footerChildren:I}=ee(r),L=n??(e===void 0?"Sidebar":void 0),T=v&&i;let j=h;return(d!==void 0||u!==void 0)&&(j={...h},u!==void 0&&(j["--nk-sidebar-height"]=u),d!==void 0&&(j["--nk-sidebar-width"]=d)),l.jsxs("aside",{...a,ref:y,"aria-hidden":v&&!i?!0:void 0,"aria-label":v&&!i?void 0:L,"aria-labelledby":v&&!i?void 0:e,"aria-modal":T?"true":void 0,className:["nk-sidebar",b].filter(Boolean).join(" "),"data-responsive":p==="pending"||void 0,"data-side":S,"data-state":c,"data-variant":v?"overlay":"inline",id:o,role:T?"dialog":void 0,style:j,tabIndex:v?-1:void 0,children:[l.jsx("div",{ref:f,className:"nk-sidebar__body","data-content-below":g||void 0,onScroll:E,children:k}),I]})}function Ne(s){const{boundaries:n,initialFocusReference:e,lockScroll:r,ownerDocument:b,panelReference:u,presenceState:i,restoreFocus:o,sidebar:y,side:p,...S}=s,{id:c,open:h,requestOpenChange:d}=y,a=t.useContext(P.FocusScopeContext),f=t.useRef(null),[g,E]=t.useState(null),v=R.useBoundary("Sidebar").boundaryElement,k=P.useOverlayLayer(!0,v),I=t.useCallback(B=>{f.current=B,u(B),E(B)},[u]);R.useIsomorphicLayoutEffect(()=>{g&&(g.inert=!h)},[h,g]);const L=t.useCallback(()=>{d(!1,"escape")},[d]),T=t.useCallback(()=>{d(!1,"outside")},[d]);P.useDismissableLayer({boundary:v,active:h,boundaries:n,dismissOnEscape:!0,dismissOnPointerDownOutside:!0,layerId:k.id,onEscapeDismiss:L,onPointerDownOutsideDismiss:T,ownerDocument:b});const j=ae.useFocusTrap({boundary:v,active:h,container:g,initialFocusReference:e??f,layerId:k.id,restoreFocus:o});return oe.useScrollLock(r&&h,b,v),l.jsx(P.FocusScopeContext.Provider,{value:h?j:a,children:l.jsx("div",{className:"nk-sidebar__overlay","data-side":p,"data-state":i,role:"presentation",style:{zIndex:k.zIndex},children:l.jsx(ne,{...S,open:h,panelId:c,panelReference:I,presentation:"overlay",side:p,state:i})})})}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=O("Sidebar.Trigger"),r=n.props,b=H.getElementReference(n),u=e==null?void 0:e.registerTrigger,i=e==null?void 0:e.unregisterTrigger,o=t.useRef(null),y=t.useCallback(f=>{const g=o.current;g&&g!==f&&(i==null||i(g)),o.current=f,f&&(u==null||u(f)),H.assignElementReference(b,f)},[b,u,i]),p=t.useCallback(f=>{f.defaultPrevented||!e||e.requestOpenChange(!e.open,"trigger")},[e]);if(!e)return null;const{id:S,open:c,presentation:h,variant:d}=e,a=c&&h==="overlay";return t.cloneElement(n,le.resolveTriggerOverrides(r,{"aria-controls":a?ie.mergeIdentifiers(r["aria-controls"],S):r["aria-controls"],"aria-expanded":c,"aria-haspopup":r["aria-haspopup"]??"dialog",className:"nk-sidebar__trigger","data-sidebar-variant":d,onClick:p,ref:y}))}const Pe=t.forwardRef(function(n,e){const{actions:r,className:b,description:u,image:i,loading:o=!1,name:y,onClick:p,...S}=n,c=u!=null&&typeof u!="boolean",h=l.jsxs(l.Fragment,{children:[l.jsx(ce.Avatar,{alt:y,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:i}),l.jsxs("span",{className:"nk-sidebar__user-text",children:[l.jsx(U.Text,{as:"span",className:"nk-sidebar__user-name",children:y}),c?l.jsx(U.Text,{as:"span",className:"nk-sidebar__user-description",size:"caption",tone:"muted",children:u}):null]})]});return l.jsx("div",{...S,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:o?l.jsx(ue.Spinner,{className:"nk-sidebar__user-spinner",size:16}):l.jsxs(l.Fragment,{children:[p?l.jsx("button",{className:"nk-sidebar__user-details",onClick:p,type:"button",children:h}):l.jsx("div",{className:"nk-sidebar__user-details",children:h}),r!==void 0&&r.length>0?l.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(d=>{const{"aria-label":a,icon:f,label:g,...E}=d;return l.jsx(de.Tooltip2,{content:g,children:l.jsx(G.Button,{...E,"aria-label":a??g,className:"nk-sidebar__user-action",icon:f,shape:"rectangle",type:"button",variant:"ghost"})},g)})}):null]})})}),Te=()=>()=>{},X=()=>{};function Ie(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??Te,(e==null?void 0:e.read)??X,X);return s!=="responsive"?s:r===void 0?"pending":r>=fe.breakpoint("md")?"inline":"overlay"}const Le=32,Be=t.forwardRef(function(n,e){var Q;const{defaultOpen:r=!1,height:b,initialFocusReference:u,lockScroll:i=!0,onOpenChange:o,open:y,restoreFocus:p=!0,side:S="left",variant:c="responsive",width:h,...d}=n,a=R.useBoundary("Sidebar"),f=`${t.useId()}-sidebar`,g=t.useRef(Symbol("nk-sidebar")).current,E=t.useRef(null),v=Ie(c,a==null?void 0:a.width),k=y!==void 0,[I,L]=t.useState(r),[T,j]=t.useState(0),[B,re]=t.useState(!1),V=t.useRef(null),N=k?y:I,w=t.useRef(o);R.useIsomorphicLayoutEffect(()=>{w.current=o});const F=t.useCallback((m,C)=>{var x;N!==m&&(k||L(m),(x=w.current)==null||x.call(w,m,C))},[k,N]),z=t.useCallback(m=>{E.current=m,H.assignElementReference(e,m)},[e]),_=t.useMemo(()=>[E],[]),$=t.useCallback(m=>{_.push({current:m}),j(C=>C+1)},[_]),K=t.useCallback(m=>{const C=_.findIndex(x=>x.current===m);C>0&&_.splice(C,1),j(x=>Math.max(x-1,0))},[_]),te=t.useCallback(m=>{const C=V.current;if(C&&C!==m){const x=_.findIndex(se=>se.current===C);x>0&&_.splice(x,1)}V.current=m,m&&_.push({current:m})},[_]),A=t.useMemo(()=>({id:f,open:N,presentation:v,registerTrigger:$,requestOpenChange:F,unregisterTrigger:K,variant:c}),[N,f,v,$,F,K,c]);R.useIsomorphicLayoutEffect(()=>{const m=a==null?void 0:a.boundaryElement;if(!m)return;if(pe(m,g,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,g,A]),R.useIsomorphicLayoutEffect(()=>{const m=a==null?void 0:a.boundaryElement;if(m)return()=>he(m,g)},[a==null?void 0:a.boundaryElement,g]),t.useEffect(()=>{v==="inline"&&F(!1,"variant")},[v,F]),t.useEffect(()=>{var x;const m=(x=a==null?void 0:a.boundaryElement)==null?void 0:x.ownerDocument.defaultView;if(!m)return;const C=m.setTimeout(()=>re(!0),Le);return()=>m.clearTimeout(C)},[a==null?void 0:a.boundaryElement]);const M=P.usePresence(N&&v==="overlay"),Y=((Q=a==null?void 0:a.boundaryElement)==null?void 0:Q.ownerDocument)??(typeof document>"u"?null:document);if(v!=="overlay")return l.jsx(ne,{...d,height:b,open:!1,panelId:f,panelReference:z,presentation:v,side:S,width:h});const J=B&&T===0?l.jsx(P.Portal,{children:l.jsx(be,{label:`Open ${d["aria-label"]??"Sidebar"}`,onToggle:()=>F(!N,"trigger"),panelId:M.present?f:void 0,reference:te,side:S,sidebarOpen:N})}):null;return!M.present||!Y?J:l.jsxs(l.Fragment,{children:[J,l.jsx(P.Portal,{children:l.jsx(Ne,{...d,boundaries:_,initialFocusReference:u,lockScroll:i,ownerDocument:Y,panelReference:z,presenceState:M.state==="closing"?"closing":"open",restoreFocus:p,side:S,sidebar:A,width:h})})]})}),Fe=Object.assign(Be,{Footer:W,Group:ye,Header:Se,Item:ke,Trigger:Re,User:Pe});exports.default=Fe;
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),R=require("./effects-D98vUn6N.cjs"),H=require("./reference-C2guRuR0.cjs"),P=require("./usePresence-Dm0mls5p.cjs"),z=require("./Button-CTzvBhGH.cjs"),U=require("./Text-DWYlIcPj.cjs"),ae=require("./useFocusTrap-CrMcAu8s.cjs"),oe=require("./useScrollLock-Dy8MZaSn.cjs"),ie=require("./aria-DM-xYEHQ.cjs"),le=require("./useFloatingPosition-DQgw-w_Z.cjs"),ce=require("./Avatar-Belo7qAY.cjs"),ue=require("./Spinner-BE0F4y2S.cjs"),de=require("./Tooltip-DDPh_YFO.cjs"),fe=require("./units-CpnLv2H4.cjs");function be(s){const{label:n,onToggle:e,panelId:r,reference:b,side:u,sidebarOpen:i}=s;return l.jsx(z.Button,{ref:b,"aria-controls":r,"aria-expanded":i,"aria-haspopup":"dialog","aria-label":n,className:"nk-sidebar__fallback-trigger","data-side":u,icon:"burger",variant:"secondary",size:"large",onClick:e})}const q=new WeakMap;function Z(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=Z(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 me(s){var n;return s?(n=q.get(s))==null?void 0:n.state:void 0}function ge(s,n){if(!s)return()=>{};const e=Z(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ve=()=>{};function O(s){const n=R.useBoundary(s).boundaryElement,e=t.useCallback(b=>ge(n,b),[n]),r=t.useCallback(()=>me(n),[n]);return t.useSyncExternalStore(e,r,ve)}function D(s,n){return s==="both"||s===(n==="overlay"?"overlay":"inline")}const W=t.forwardRef(function(n,e){const{children:r,className:b,presentation:u="both",...i}=n,o=O("Sidebar.Footer");return D(u,o==null?void 0:o.presentation)?l.jsx("div",{...i,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:u,className:i,label:o,presentation:y="both",...p}=n,S=O("Sidebar.Group"),c=`${t.useId()}-label`,h=o!=null&&typeof o!="boolean"&&(typeof o!="string"||o.trim()!=="");if(!D(y,S==null?void 0:S.presentation))return null;const d=b??(r===void 0&&h?c:void 0),a=!!(r??d);return t.createElement(a?"nav":"div",{...p,ref:e,"aria-label":r,"aria-labelledby":d,className:["nk-sidebar__group",i].filter(Boolean).join(" ")},h?l.jsx(U.Text,{as:"h2",className:"nk-sidebar__group-label",id:c,size:"subtitle",weight:"medium",children:o}):null,l.jsx("ul",{className:"nk-sidebar__list",children:u}))}),Se=t.forwardRef(function(n,e){const{children:r,className:b,presentation:u="both",...i}=n,o=O("Sidebar.Header");return D(u,o==null?void 0:o.presentation)?l.jsx("div",{...i,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:u,className:i,disabled:o=!1,icon:y,onClick:p,presentation:S="both",type:c,...h}=n,d=O("Sidebar.Item"),a=b??"button",f=a==="button",m=h,E=m.href!==void 0||m.to!==void 0;function v(k){if(o){k.preventDefault();return}p==null||p(k),d!=null&&d.open&&d.presentation==="overlay"&&!k.defaultPrevented&&d.requestOpenChange(!1,"item")}return D(S,d==null?void 0:d.presentation)?l.jsx("li",{className:"nk-sidebar__item-container",children:l.jsx(z.Button,{...h,ref:e,"aria-current":r?E?"page":"true":void 0,as:a,className:["nk-sidebar__item",i].filter(Boolean).join(" "),"data-active":r||void 0,disabled:o,fullWidth:!0,href:m.href,icon:y,onClick:v,shape:"rectangle",size:"small",textAlignment:"left",type:f?c??"button":c,variant:"ghost",children:l.jsx("span",{className:"nk-sidebar__item-label",children:u})})}):null}),Ee=1;function Ce(s){return s==null?void 0:s.ResizeObserver}function xe(s){return s==null?void 0:s.MutationObserver}function _e(){const[s,n]=t.useState(!1),e=t.useRef(null),r=t.useCallback(i=>{const o=i.scrollHeight-i.scrollTop-i.clientHeight;n(o>Ee)},[]),b=t.useCallback(i=>{var m;if((m=e.current)==null||m.call(e),e.current=null,!i)return;const o=i;r(o);function y(){r(o)}const p=o.ownerDocument.defaultView;p==null||p.addEventListener("resize",y);const S=Ce(p),c=S?new S(y):void 0;function h(){c==null||c.disconnect(),c==null||c.observe(o);for(const E of o.children)c==null||c.observe(E)}h();function d(E){E.some(k=>k.type==="childList")&&h(),y()}const a=xe(p),f=a?new a(d):void 0;f==null||f.observe(o,{attributeFilter:["class","hidden","style"],characterData:!0,childList:!0,subtree:!0}),e.current=()=>{p==null||p.removeEventListener("resize",y),c==null||c.disconnect(),f==null||f.disconnect()}},[r]),u=t.useCallback(i=>{r(i.currentTarget)},[r]);return{containerReference:b,contentBelow:s,handleScroll:u}}function je(s,n){for(const e of t.Children.toArray(s)){if(t.isValidElement(e)&&e.type===t.Fragment){const r=ee(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===W?n.footerChildren.push(e):n.bodyChildren.push(e)}}function ee(s){const n={bodyChildren:[],footerChildren:[]};return je(s,n),n}function ne(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:b,height:u,open:i,panelId:o,panelReference:y,presentation:p,side:S,state:c,style:h,width:d,...a}=s,{containerReference:f,contentBelow:m,handleScroll:E}=_e(),v=p==="overlay",{bodyChildren:k,footerChildren:I}=ee(r),L=n??(e===void 0?"Sidebar":void 0),T=v&&i;let j=h;return(d!==void 0||u!==void 0)&&(j={...h},u!==void 0&&(j["--nk-sidebar-height"]=u),d!==void 0&&(j["--nk-sidebar-width"]=d)),l.jsxs("aside",{...a,ref:y,"aria-hidden":v&&!i?!0:void 0,"aria-label":v&&!i?void 0:L,"aria-labelledby":v&&!i?void 0:e,"aria-modal":T?"true":void 0,className:["nk-sidebar",b].filter(Boolean).join(" "),"data-responsive":p==="pending"||void 0,"data-side":S,"data-state":c,"data-variant":v?"overlay":"inline",id:o,role:T?"dialog":void 0,style:j,tabIndex:v?-1:void 0,children:[l.jsx("div",{ref:f,className:"nk-sidebar__body","data-content-below":m||void 0,onScroll:E,children:k}),I]})}function Ne(s){const{boundaries:n,initialFocusReference:e,lockScroll:r,ownerDocument:b,panelReference:u,presenceState:i,restoreFocus:o,sidebar:y,side:p,...S}=s,{id:c,open:h,requestOpenChange:d}=y,a=t.useContext(P.FocusScopeContext),f=t.useRef(null),[m,E]=t.useState(null),v=R.useBoundary("Sidebar").boundaryElement,k=P.useOverlayLayer(!0,v),I=t.useCallback(B=>{f.current=B,u(B),E(B)},[u]);R.useIsomorphicLayoutEffect(()=>{m&&(m.inert=!h)},[h,m]);const L=t.useCallback(()=>{d(!1,"escape")},[d]),T=t.useCallback(()=>{d(!1,"outside")},[d]);P.useDismissableLayer({boundary:v,active:h,boundaries:n,dismissOnEscape:!0,dismissOnPointerDownOutside:!0,layerId:k.id,onEscapeDismiss:L,onPointerDownOutsideDismiss:T,ownerDocument:b});const j=ae.useFocusTrap({boundary:v,active:h,container:m,initialFocusReference:e??f,layerId:k.id,restoreFocus:o});return oe.useScrollLock(r&&h,b,v),l.jsx(P.FocusScopeContext.Provider,{value:h?j:a,children:l.jsx("div",{className:"nk-sidebar__overlay","data-side":p,"data-state":i,role:"presentation",style:{zIndex:k.zIndex},children:l.jsx(ne,{...S,open:h,panelId:c,panelReference:I,presentation:"overlay",side:p,state:i})})})}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=O("Sidebar.Trigger"),r=n.props,b=H.getElementReference(n),u=e==null?void 0:e.registerTrigger,i=e==null?void 0:e.unregisterTrigger,o=t.useRef(null),y=t.useCallback(f=>{const m=o.current;m&&m!==f&&(i==null||i(m)),o.current=f,f&&(u==null||u(f)),H.assignElementReference(b,f)},[b,u,i]),p=t.useCallback(f=>{f.defaultPrevented||!e||e.requestOpenChange(!e.open,"trigger")},[e]);if(!e)return null;const{id:S,open:c,presentation:h,variant:d}=e,a=c&&h==="overlay";return t.cloneElement(n,le.resolveTriggerOverrides(r,{"aria-controls":a?ie.mergeIdentifiers(r["aria-controls"],S):r["aria-controls"],"aria-expanded":c,"aria-haspopup":r["aria-haspopup"]??"dialog",className:"nk-sidebar__trigger","data-sidebar-variant":d,onClick:p,ref:y}))}const Pe=t.forwardRef(function(n,e){const{actions:r,className:b,description:u,image:i,loading:o=!1,name:y,onClick:p,...S}=n,c=u!=null&&typeof u!="boolean",h=l.jsxs(l.Fragment,{children:[l.jsx(ce.Avatar,{alt:y,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:i}),l.jsxs("span",{className:"nk-sidebar__user-text",children:[l.jsx(U.Text,{as:"span",className:"nk-sidebar__user-name",children:y}),c?l.jsx(U.Text,{as:"span",className:"nk-sidebar__user-description",size:"caption",tone:"muted",children:u}):null]})]});return l.jsx("div",{...S,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:o?l.jsx(ue.Spinner,{className:"nk-sidebar__user-spinner",size:16}):l.jsxs(l.Fragment,{children:[p?l.jsx("button",{className:"nk-sidebar__user-details",onClick:p,type:"button",children:h}):l.jsx("div",{className:"nk-sidebar__user-details",children:h}),r!==void 0&&r.length>0?l.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(d=>{const{"aria-label":a,icon:f,label:m,...E}=d;return l.jsx(de.Tooltip2,{content:m,children:l.jsx(z.Button,{...E,"aria-label":a??m,className:"nk-sidebar__user-action",icon:f,shape:"rectangle",type:"button",variant:"ghost"})},m)})}):null]})})}),Te=()=>()=>{},X=()=>{};function Ie(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??Te,(e==null?void 0:e.read)??X,X);return s!=="responsive"?s:r===void 0?"pending":r>=fe.breakpoint("medium")?"inline":"overlay"}const Le=32,Be=t.forwardRef(function(n,e){var Q;const{defaultOpen:r=!1,height:b,initialFocusReference:u,lockScroll:i=!0,onOpenChange:o,open:y,restoreFocus:p=!0,side:S="left",variant:c="responsive",width:h,...d}=n,a=R.useBoundary("Sidebar"),f=`${t.useId()}-sidebar`,m=t.useRef(Symbol("nk-sidebar")).current,E=t.useRef(null),v=Ie(c,a==null?void 0:a.width),k=y!==void 0,[I,L]=t.useState(r),[T,j]=t.useState(0),[B,re]=t.useState(!1),G=t.useRef(null),N=k?y:I,w=t.useRef(o);R.useIsomorphicLayoutEffect(()=>{w.current=o});const F=t.useCallback((g,C)=>{var x;N!==g&&(k||L(g),(x=w.current)==null||x.call(w,g,C))},[k,N]),V=t.useCallback(g=>{E.current=g,H.assignElementReference(e,g)},[e]),_=t.useMemo(()=>[E],[]),$=t.useCallback(g=>{_.push({current:g}),j(C=>C+1)},[_]),K=t.useCallback(g=>{const C=_.findIndex(x=>x.current===g);C>0&&_.splice(C,1),j(x=>Math.max(x-1,0))},[_]),te=t.useCallback(g=>{const C=G.current;if(C&&C!==g){const x=_.findIndex(se=>se.current===C);x>0&&_.splice(x,1)}G.current=g,g&&_.push({current:g})},[_]),A=t.useMemo(()=>({id:f,open:N,presentation:v,registerTrigger:$,requestOpenChange:F,unregisterTrigger:K,variant:c}),[N,f,v,$,F,K,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"&&F(!1,"variant")},[v,F]),t.useEffect(()=>{var x;const g=(x=a==null?void 0:a.boundaryElement)==null?void 0:x.ownerDocument.defaultView;if(!g)return;const C=g.setTimeout(()=>re(!0),Le);return()=>g.clearTimeout(C)},[a==null?void 0:a.boundaryElement]);const M=P.usePresence(N&&v==="overlay"),Y=((Q=a==null?void 0:a.boundaryElement)==null?void 0:Q.ownerDocument)??(typeof document>"u"?null:document);if(v!=="overlay")return l.jsx(ne,{...d,height:b,open:!1,panelId:f,panelReference:V,presentation:v,side:S,width:h});const J=B&&T===0?l.jsx(P.Portal,{children:l.jsx(be,{label:`Open ${d["aria-label"]??"Sidebar"}`,onToggle:()=>F(!N,"trigger"),panelId:M.present?f:void 0,reference:te,side:S,sidebarOpen:N})}):null;return!M.present||!Y?J:l.jsxs(l.Fragment,{children:[J,l.jsx(P.Portal,{children:l.jsx(Ne,{...d,boundaries:_,initialFocusReference:u,lockScroll:i,ownerDocument:Y,panelReference:V,presenceState:M.state==="closing"?"closing":"open",restoreFocus:p,side:S,sidebar:A,width:h})})]})}),Fe=Object.assign(Be,{Footer:W,Group:ye,Header:Se,Item:ke,Trigger:Re,User:Pe});exports.default=Fe;
|