neatkit 0.5.0 → 0.6.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/Alert-DQ5CCE0N.js +29 -0
- package/dist/Alert-LJDkNUqH.cjs +1 -0
- package/dist/Alert.cjs +1 -0
- package/dist/Alert.js +4 -0
- package/dist/Avatar.cjs +1 -0
- package/dist/Avatar.js +55 -0
- package/dist/Badge.cjs +1 -0
- package/dist/Badge.js +25 -0
- package/dist/Button-BAsLfA0D.js +99 -0
- package/dist/Button-D7JUO6Fs.cjs +1 -0
- package/dist/Button.cjs +1 -0
- package/dist/Button.js +5 -0
- package/dist/Card-CPq6dsut.js +34 -0
- package/dist/Card-CQ-8_1tO.cjs +1 -0
- package/dist/Card.cjs +1 -0
- package/dist/Card.js +4 -0
- package/dist/Checkbox-BvXM9VyY.js +68 -0
- package/dist/Checkbox-VQifZrZZ.cjs +1 -0
- package/dist/Checkbox.cjs +1 -0
- package/dist/Checkbox.js +5 -0
- package/dist/CheckboxGroup.cjs +1 -0
- package/dist/CheckboxGroup.js +144 -0
- package/dist/{Code-D4qqPnTN.js → Code-BP2ZCmUf.js} +4 -3
- package/dist/Code-eispVOW3.cjs +6 -0
- package/dist/Code.cjs +1 -0
- package/dist/Code.js +5 -0
- package/dist/Content.cjs +1 -0
- package/dist/Content.js +144 -0
- package/dist/Divider-BE15WVDI.js +42 -0
- package/dist/Divider-CJYbFcSX.cjs +1 -0
- package/dist/Divider.cjs +1 -0
- package/dist/Divider.js +4 -0
- package/dist/Field.cjs +1 -0
- package/dist/Field.js +115 -0
- package/dist/Icon-D8IZceys.cjs +1 -0
- package/dist/Icon-uQmpr5P2.js +1139 -0
- package/dist/Icon.cjs +1 -0
- package/dist/Icon.js +37 -0
- package/dist/Input.cjs +1 -0
- package/dist/Input.js +146 -0
- package/dist/{markdown.cjs → Markdown.cjs} +19 -19
- package/dist/{markdown.js → Markdown.js} +10 -8
- package/dist/Modal.cjs +1 -0
- package/dist/Modal.js +171 -0
- package/dist/PinInput.cjs +1 -0
- package/dist/PinInput.js +248 -0
- package/dist/Popover.cjs +1 -0
- package/dist/Popover.js +238 -0
- package/dist/Radio.cjs +1 -0
- package/dist/Radio.js +65 -0
- package/dist/RadioGroup.cjs +1 -0
- package/dist/RadioGroup.js +51 -0
- package/dist/RadioGroupContext-BX9KnDek.cjs +1 -0
- package/dist/RadioGroupContext-DbKM4zPZ.js +5 -0
- package/dist/Select.cjs +1 -0
- package/dist/Select.js +473 -0
- package/dist/Skeleton.cjs +1 -0
- package/dist/Skeleton.js +27 -0
- package/dist/Spinner-BXgw60UC.cjs +1 -0
- package/dist/Spinner-CVYvk6YK.js +25 -0
- package/dist/Spinner.cjs +1 -0
- package/dist/Spinner.js +4 -0
- package/dist/Surface-BttJYSDt.cjs +1 -0
- package/dist/Surface-vEFsZC12.js +17 -0
- package/dist/Switch.cjs +1 -0
- package/dist/Switch.js +39 -0
- package/dist/Table-83unQQOi.cjs +1 -0
- package/dist/Table-Cw8u-pEW.js +403 -0
- package/dist/Table.cjs +1 -0
- package/dist/Table.js +5 -0
- package/dist/Text-DWYlIcPj.cjs +1 -0
- package/dist/Text-rN6iDo0V.js +24 -0
- package/dist/Text.cjs +1 -0
- package/dist/Text.js +4 -0
- package/dist/TextArea.cjs +1 -0
- package/dist/TextArea.js +43 -0
- package/dist/Tooltip-BB82wNOE.cjs +1 -0
- package/dist/Tooltip-CqWK_GRD.js +236 -0
- package/dist/Tooltip.cjs +1 -0
- package/dist/Tooltip.js +6 -0
- package/dist/aria-DHnOMyYp.js +10 -0
- package/dist/aria-DKxpE8cA.cjs +1 -0
- package/dist/components/Alert/index.d.ts +1 -1
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/CheckboxGroup/index.d.ts +1 -1
- package/dist/components/Code/index.d.ts +1 -1
- package/dist/components/Content/index.d.ts +1 -1
- package/dist/components/Divider/index.d.ts +1 -1
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/Icon/index.d.ts +1 -1
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Markdown/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/PinInput/index.d.ts +1 -1
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Radio/index.d.ts +1 -1
- package/dist/components/RadioGroup/index.d.ts +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Skeleton/index.d.ts +1 -1
- package/dist/components/Spinner/index.d.ts +1 -1
- package/dist/components/Switch/index.d.ts +1 -1
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/TextArea/index.d.ts +1 -1
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/field-control-NfLwcPj6.cjs +1 -0
- package/dist/field-control-XAn_FKks.js +16 -0
- package/dist/focus-restoration-70WcQRr5.cjs +1 -0
- package/dist/focus-restoration-BvNZzrQA.js +16 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -2187
- package/dist/reference-C2guRuR0.cjs +1 -0
- package/dist/reference-CXMr27nM.js +12 -0
- package/dist/style.css +1 -1
- package/dist/units-BmjPCccF.js +90 -0
- package/dist/units-PzuiQNnw.cjs +1 -0
- package/dist/useFloatingPosition-CxzhAvy8.js +73 -0
- package/dist/useFloatingPosition-D1FqYy0l.cjs +1 -0
- package/dist/useFocusTrap--cgjy78G.cjs +1 -0
- package/dist/useFocusTrap-Da4nEash.js +134 -0
- package/dist/usePresence-DSPt6aKi.js +210 -0
- package/dist/usePresence-qe92UTvK.cjs +1 -0
- package/package.json +136 -11
- package/dist/Card-Ba5AcR4o.cjs +0 -1
- package/dist/Card-Cumb1Hon.js +0 -74
- package/dist/Code-CDHkXHVo.cjs +0 -6
- package/dist/Table-B5izJmMG.cjs +0 -1
- package/dist/Table-Gs5LkYRc.js +0 -2187
- package/dist/code.cjs +0 -1
- package/dist/code.js +0 -5
- package/dist/entries/code.d.ts +0 -1
- package/dist/entries/index.d.ts +0 -29
- package/dist/entries/markdown.d.ts +0 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as ju, jsx as $, Fragment as Wu } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as ts, useCallback as ns, useMemo as kn } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import { g as Qu, C as
|
|
6
|
-
import {
|
|
4
|
+
import { A as rs } from "./Alert-DQ5CCE0N.js";
|
|
5
|
+
import { g as Qu, C as us } from "./Code-BP2ZCmUf.js";
|
|
6
|
+
import { D as is } from "./Divider-BE15WVDI.js";
|
|
7
|
+
import { T as ot } from "./Table-Cw8u-pEW.js";
|
|
8
|
+
import { T as Qe } from "./Text-rN6iDo0V.js";
|
|
7
9
|
function Or(e) {
|
|
8
10
|
const t = [], n = String(e || "");
|
|
9
11
|
let r = n.indexOf(","), u = 0, i = !1;
|
|
@@ -17996,7 +17998,7 @@ function d1(e, t, n, r, u) {
|
|
|
17996
17998
|
node: l,
|
|
17997
17999
|
...c
|
|
17998
18000
|
} = a;
|
|
17999
|
-
return /* @__PURE__ */ $(
|
|
18001
|
+
return /* @__PURE__ */ $(is, { ...c });
|
|
18000
18002
|
},
|
|
18001
18003
|
img: function(a) {
|
|
18002
18004
|
const {
|
|
@@ -18142,7 +18144,7 @@ function d1(e, t, n, r, u) {
|
|
|
18142
18144
|
...f
|
|
18143
18145
|
} = a, d = h1(c);
|
|
18144
18146
|
return d ? /* @__PURE__ */ $(
|
|
18145
|
-
|
|
18147
|
+
us,
|
|
18146
18148
|
{
|
|
18147
18149
|
code: d.content,
|
|
18148
18150
|
codeProps: d.codeProps,
|
|
@@ -18304,7 +18306,7 @@ function b1(e, t) {
|
|
|
18304
18306
|
function A1(e) {
|
|
18305
18307
|
return e === null ? null : Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 0;
|
|
18306
18308
|
}
|
|
18307
|
-
const
|
|
18309
|
+
const y1 = ts(function(t, n) {
|
|
18308
18310
|
const {
|
|
18309
18311
|
allowedImageSources: r,
|
|
18310
18312
|
anchorPrefix: u = "",
|
|
@@ -18390,7 +18392,7 @@ const S1 = ts(function(t, n) {
|
|
|
18390
18392
|
ref: n,
|
|
18391
18393
|
className: ["nk-markdown", i].filter(Boolean).join(" "),
|
|
18392
18394
|
style: G,
|
|
18393
|
-
children: R ? /* @__PURE__ */ $(
|
|
18395
|
+
children: R ? /* @__PURE__ */ $(rs, { role: "alert", tone: "warning", children: E1 }) : /* @__PURE__ */ $(
|
|
18394
18396
|
d0,
|
|
18395
18397
|
{
|
|
18396
18398
|
allowedElements: Ya,
|
|
@@ -18405,5 +18407,5 @@ const S1 = ts(function(t, n) {
|
|
|
18405
18407
|
);
|
|
18406
18408
|
});
|
|
18407
18409
|
export {
|
|
18408
|
-
|
|
18410
|
+
y1 as default
|
|
18409
18411
|
};
|
package/dist/Modal.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),s=require("react"),$=require("./Button-D7JUO6Fs.cjs"),f=require("./usePresence-qe92UTvK.cjs"),A=require("./useFocusTrap--cgjy78G.cjs"),D=require("./Surface-BttJYSDt.cjs"),V=require("./Text-DWYlIcPj.cjs"),y=new WeakMap;function G(l,e){s.useEffect(()=>{if(!l||!e)return;const o=y.get(e);if(o)o.count+=1;else{const t=e.body,r=e.defaultView,u=r&&Number.parseFloat(r.getComputedStyle(t).paddingRight)||0,n=e.documentElement.clientWidth,c=r&&n>0?Math.max(0,r.innerWidth-n):0,b={count:1,overflow:t.style.overflow,paddingRight:t.style.paddingRight};y.set(e,b),t.style.overflow="hidden",c>0&&(t.style.paddingRight=`${u+c}px`)}return()=>{const t=y.get(e);t&&(t.count-=1,!(t.count>0)&&(e.body.style.overflow=t.overflow,e.body.style.paddingRight=t.paddingRight,y.delete(e)))}},[l,e])}function H(l,e,o){e.current=l,typeof o=="function"?o(l):o&&(o.current=l)}function J(l){const{"aria-label":e,"aria-labelledby":o,children:t,className:r,closeButtonLabel:u="Close modal",exitable:n=!0,forwardedReference:c,initialFocusReference:b,lockScroll:P=!0,onClose:i,open:a,ownerDocument:h,presenceState:x,restoreFocus:_=!0,role:B="dialog",style:I,title:p,trapFocus:S=!0,...M}=l,R=s.useRef(null),k=s.useRef(null),E=s.useContext(f.FocusScopeContext),L=`${s.useId()}-title`,[g,q]=s.useState(null),m=f.useOverlayLayer(!0,h),N=s.useMemo(()=>[R],[]),v=!!(p!=null&&p.trim()),O=b??(v?k:void 0),T=o??(e===void 0&&v?L:void 0),W=s.useCallback(F=>{H(F,R,c),q(F)},[c]);s.useLayoutEffect(()=>{g&&(g.inert=!a)},[g,a]);const w=s.useCallback(()=>{i==null||i("escape")},[i]),C=s.useCallback(()=>{i==null||i("outside")},[i]);f.useDismissableLayer({active:a,boundaries:N,dismissOnEscape:n,dismissOnPointerDownOutside:n,layerId:m.id,onEscapeDismiss:w,onPointerDownOutsideDismiss:C,ownerDocument:h});const z=A.useFocusTrap({active:a&&S,container:g,initialFocusReference:O,layerId:m.id,restoreFocus:_});G(P,h);const j=n?d.jsx($.Button,{"aria-label":u,className:"nk-modal__close",icon:"cross",onClick:()=>i==null?void 0:i("close-button"),shape:"rectangle",type:"button",variant:"ghost"}):null;return d.jsx(f.FocusScopeContext.Provider,{value:a&&S?z:E,children:d.jsx("div",{className:"nk-modal__overlay","data-state":x,role:"presentation",style:{zIndex:m.zIndex},children:d.jsxs(D.Surface,{...M,ref:W,"aria-hidden":a?void 0:!0,"aria-label":a?e:void 0,"aria-labelledby":a?T:void 0,"aria-modal":a?"true":void 0,className:["nk-modal",r].filter(Boolean).join(" "),"data-state":x,role:a?B:void 0,style:I,tabIndex:-1,children:[v?d.jsxs("div",{className:"nk-modal__header",children:[d.jsx(V.Text,{as:"h2",className:"nk-modal__title",id:L,ref:k,size:"subtitle",tabIndex:-1,weight:"semibold",children:p}),j]}):j,t]})})})}const K=s.forwardRef(function(e,o){const{open:t}=e,r=s.useRef(e);t&&(r.current=e);const u=t?e:r.current,{portalContainer:n}=u,c=f.usePresence(t),b=(n==null?void 0:n.ownerDocument)??(typeof document>"u"?null:document);return c.present?d.jsx(f.Portal,{container:n,children:d.jsx(J,{...u,forwardedReference:o,open:t,ownerDocument:b,presenceState:c.state==="closing"?"closing":"open"})}):null});exports.default=K;
|
package/dist/Modal.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as d, jsxs as B } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect as V, forwardRef as q, useRef as v, useContext as G, useId as H, useState as J, useMemo as K, useCallback as h, useLayoutEffect as Q } from "react";
|
|
4
|
+
import { B as U } from "./Button-BAsLfA0D.js";
|
|
5
|
+
import { a as X, P as Y, F as I, b as Z, c as ee } from "./usePresence-DSPt6aKi.js";
|
|
6
|
+
import { u as te } from "./useFocusTrap-Da4nEash.js";
|
|
7
|
+
import { S as oe } from "./Surface-vEFsZC12.js";
|
|
8
|
+
import { T as se } from "./Text-rN6iDo0V.js";
|
|
9
|
+
const p = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
function ae(n, e) {
|
|
11
|
+
V(() => {
|
|
12
|
+
if (!n || !e) return;
|
|
13
|
+
const o = p.get(e);
|
|
14
|
+
if (o)
|
|
15
|
+
o.count += 1;
|
|
16
|
+
else {
|
|
17
|
+
const t = e.body, l = e.defaultView, c = l && Number.parseFloat(
|
|
18
|
+
l.getComputedStyle(t).paddingRight
|
|
19
|
+
) || 0, s = e.documentElement.clientWidth, r = l && s > 0 ? Math.max(
|
|
20
|
+
0,
|
|
21
|
+
l.innerWidth - s
|
|
22
|
+
) : 0, u = {
|
|
23
|
+
count: 1,
|
|
24
|
+
overflow: t.style.overflow,
|
|
25
|
+
paddingRight: t.style.paddingRight
|
|
26
|
+
};
|
|
27
|
+
p.set(e, u), t.style.overflow = "hidden", r > 0 && (t.style.paddingRight = `${c + r}px`);
|
|
28
|
+
}
|
|
29
|
+
return () => {
|
|
30
|
+
const t = p.get(e);
|
|
31
|
+
t && (t.count -= 1, !(t.count > 0) && (e.body.style.overflow = t.overflow, e.body.style.paddingRight = t.paddingRight, p.delete(e)));
|
|
32
|
+
};
|
|
33
|
+
}, [n, e]);
|
|
34
|
+
}
|
|
35
|
+
function ie(n, e, o) {
|
|
36
|
+
e.current = n, typeof o == "function" ? o(n) : o && (o.current = n);
|
|
37
|
+
}
|
|
38
|
+
function ne(n) {
|
|
39
|
+
const {
|
|
40
|
+
"aria-label": e,
|
|
41
|
+
"aria-labelledby": o,
|
|
42
|
+
children: t,
|
|
43
|
+
className: l,
|
|
44
|
+
closeButtonLabel: c = "Close modal",
|
|
45
|
+
exitable: s = !0,
|
|
46
|
+
forwardedReference: r,
|
|
47
|
+
initialFocusReference: u,
|
|
48
|
+
lockScroll: E = !0,
|
|
49
|
+
onClose: a,
|
|
50
|
+
open: i,
|
|
51
|
+
ownerDocument: b,
|
|
52
|
+
presenceState: S,
|
|
53
|
+
restoreFocus: _ = !0,
|
|
54
|
+
role: M = "dialog",
|
|
55
|
+
style: N,
|
|
56
|
+
title: f,
|
|
57
|
+
trapFocus: k = !0,
|
|
58
|
+
...O
|
|
59
|
+
} = n, x = v(null), R = v(null), W = G(I), L = `${H()}-title`, [m, T] = J(null), g = Z(!0, b), w = K(() => [x], []), y = !!(f != null && f.trim()), j = u ?? (y ? R : void 0), z = o ?? (e === void 0 && y ? L : void 0), $ = h(
|
|
60
|
+
(P) => {
|
|
61
|
+
ie(P, x, r), T(P);
|
|
62
|
+
},
|
|
63
|
+
[r]
|
|
64
|
+
);
|
|
65
|
+
Q(() => {
|
|
66
|
+
m && (m.inert = !i);
|
|
67
|
+
}, [m, i]);
|
|
68
|
+
const A = h(() => {
|
|
69
|
+
a == null || a("escape");
|
|
70
|
+
}, [a]), C = h(() => {
|
|
71
|
+
a == null || a("outside");
|
|
72
|
+
}, [a]);
|
|
73
|
+
ee({
|
|
74
|
+
active: i,
|
|
75
|
+
boundaries: w,
|
|
76
|
+
dismissOnEscape: s,
|
|
77
|
+
dismissOnPointerDownOutside: s,
|
|
78
|
+
layerId: g.id,
|
|
79
|
+
onEscapeDismiss: A,
|
|
80
|
+
onPointerDownOutsideDismiss: C,
|
|
81
|
+
ownerDocument: b
|
|
82
|
+
});
|
|
83
|
+
const D = te({
|
|
84
|
+
active: i && k,
|
|
85
|
+
container: m,
|
|
86
|
+
initialFocusReference: j,
|
|
87
|
+
layerId: g.id,
|
|
88
|
+
restoreFocus: _
|
|
89
|
+
});
|
|
90
|
+
ae(E, b);
|
|
91
|
+
const F = s ? /* @__PURE__ */ d(
|
|
92
|
+
U,
|
|
93
|
+
{
|
|
94
|
+
"aria-label": c,
|
|
95
|
+
className: "nk-modal__close",
|
|
96
|
+
icon: "cross",
|
|
97
|
+
onClick: () => a == null ? void 0 : a("close-button"),
|
|
98
|
+
shape: "rectangle",
|
|
99
|
+
type: "button",
|
|
100
|
+
variant: "ghost"
|
|
101
|
+
}
|
|
102
|
+
) : null;
|
|
103
|
+
return /* @__PURE__ */ d(
|
|
104
|
+
I.Provider,
|
|
105
|
+
{
|
|
106
|
+
value: i && k ? D : W,
|
|
107
|
+
children: /* @__PURE__ */ d(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
className: "nk-modal__overlay",
|
|
111
|
+
"data-state": S,
|
|
112
|
+
role: "presentation",
|
|
113
|
+
style: { zIndex: g.zIndex },
|
|
114
|
+
children: /* @__PURE__ */ B(
|
|
115
|
+
oe,
|
|
116
|
+
{
|
|
117
|
+
...O,
|
|
118
|
+
ref: $,
|
|
119
|
+
"aria-hidden": i ? void 0 : !0,
|
|
120
|
+
"aria-label": i ? e : void 0,
|
|
121
|
+
"aria-labelledby": i ? z : void 0,
|
|
122
|
+
"aria-modal": i ? "true" : void 0,
|
|
123
|
+
className: ["nk-modal", l].filter(Boolean).join(" "),
|
|
124
|
+
"data-state": S,
|
|
125
|
+
role: i ? M : void 0,
|
|
126
|
+
style: N,
|
|
127
|
+
tabIndex: -1,
|
|
128
|
+
children: [
|
|
129
|
+
y ? /* @__PURE__ */ B("div", { className: "nk-modal__header", children: [
|
|
130
|
+
/* @__PURE__ */ d(
|
|
131
|
+
se,
|
|
132
|
+
{
|
|
133
|
+
as: "h2",
|
|
134
|
+
className: "nk-modal__title",
|
|
135
|
+
id: L,
|
|
136
|
+
ref: R,
|
|
137
|
+
size: "subtitle",
|
|
138
|
+
tabIndex: -1,
|
|
139
|
+
weight: "semibold",
|
|
140
|
+
children: f
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
F
|
|
144
|
+
] }) : F,
|
|
145
|
+
t
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
const pe = q(function(e, o) {
|
|
155
|
+
const { open: t } = e, l = v(e);
|
|
156
|
+
t && (l.current = e);
|
|
157
|
+
const c = t ? e : l.current, { portalContainer: s } = c, r = X(t), u = (s == null ? void 0 : s.ownerDocument) ?? (typeof document > "u" ? null : document);
|
|
158
|
+
return r.present ? /* @__PURE__ */ d(Y, { container: s, children: /* @__PURE__ */ d(
|
|
159
|
+
ne,
|
|
160
|
+
{
|
|
161
|
+
...c,
|
|
162
|
+
forwardedReference: o,
|
|
163
|
+
open: t,
|
|
164
|
+
ownerDocument: u,
|
|
165
|
+
presenceState: r.state === "closing" ? "closing" : "open"
|
|
166
|
+
}
|
|
167
|
+
) }) : null;
|
|
168
|
+
});
|
|
169
|
+
export {
|
|
170
|
+
pe as default
|
|
171
|
+
};
|
|
@@ -0,0 +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-DKxpE8cA.cjs"),$=3,B=10,H=4;function X(a){return Number.isFinite(a)?Math.min(B,Math.max($,Math.trunc(a))):H}function M(a,s,l){return(s==="numeric"?a.replace(/[^0-9]/g,""):a.replace(/[^0-9a-z]/gi,"").toUpperCase()).slice(0,l)}function Z(a,s,l){s.current=a,typeof l=="function"?l(a):l&&(l.current=a)}function J(a,s){var c;const l=(c=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(a),"value"))==null?void 0:c.set;l?l.call(a,s):a.value=s}function U(a,s,l){const c=Math.min(l-1,Math.max(0,s)),P=Math.min(c+1,a.value.length);a.focus(),a.setSelectionRange(c,P)}function Q(a){const{defaultValue:s,disabled:l,forwardedReference:c,length:P,mode:u,onChange:_,onComplete:y,onFocus:N,onKeyDown:p,onPaste:x,onSelect:b,readOnly:S,value:L}=a,n=X(P),k=M(s,u,n),w=v.useRef(null),[D,V]=v.useState(k),[E,d]=v.useState(0),f=L!==void 0,i=M(f?L:D,u,n),R=v.useCallback(t=>Z(t,w,c),[c]);v.useEffect(()=>{!f&&D!==i&&V(i)},[f,i,D]),v.useEffect(()=>{var o;if(f)return;const t=(o=w.current)==null?void 0:o.form;if(!t)return;const e=t.getRootNode();function r(h){h.target!==t||h.defaultPrevented||(V(k),d(0))}return e.addEventListener("reset",r),()=>e.removeEventListener("reset",r)},[f,k]);function j(t){const e=t.selectionStart??i.length;return Math.min(n-1,Math.max(0,e))}function T(t){const e=t.currentTarget,r=e.selectionStart??e.value.length,o=M(e.value,u,n),h=M(e.value.slice(0,r),u,n).length;e.value=o,f||V(o),_==null||_(t),o.length===n&&o!==i&&(y==null||y(o));const g=Math.min(n-1,h);d(g),e.setSelectionRange(g,Math.min(g+1,o.length))}function A(t){if(x==null||x(t),t.defaultPrevented||l||S)return;const e=M(t.clipboardData.getData("text"),u,n);if(t.preventDefault(),e.length===0)return;const r=t.currentTarget,o=r.selectionStart??i.length,h=r.selectionEnd??o,g=e.length===n?e:M(i.slice(0,o)+e+i.slice(h),u,n),C=e.length===n?n:Math.min(n,o+e.length);J(r,g),r.setSelectionRange(C,C),r.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,r=Math.min(n-1,Math.max(0,j(t.currentTarget)+e));d(r),U(t.currentTarget,r,n)}function O(t){N==null||N(t);const e=Math.min(n-1,i.length);d(e),U(t.currentTarget,e,n)}function F(t){b==null||b(t),d(j(t.currentTarget))}function q(t,e){if(t.preventDefault(),l)return;const r=w.current;r&&(d(e),U(r,e,n))}return{activeIndex:E,handleChange:T,handleFocus:O,handleKeyDown:z,handlePaste:A,handleSelect:F,handleSlotPointerDown:q,inputCallbackReference:R,length:n,renderedValue:i}}const W=v.forwardRef(function(s,l){const{"aria-invalid":c,autoCapitalize:P,autoComplete:u="one-time-code",className:_,censored:y=!1,defaultValue:N="",disabled:p=!1,invalid:x=!1,length:b=H,mode:S="numeric",onChange:L,onComplete:n,onFocus:k,onKeyDown:w,onPaste:D,onSelect:V,readOnly:E=!1,style:d,value:f,wrap:i=!1,...R}=s,{activeIndex:j,handleChange:T,handleFocus:A,handleKeyDown:z,handlePaste:O,handleSelect:F,handleSlotPointerDown:q,inputCallbackReference:t,length:e,renderedValue:r}=Q({defaultValue:N,disabled:p,forwardedReference:l,length:b,mode:S,onChange:L,onComplete:n,onFocus:k,onKeyDown:w,onPaste:D,onSelect:V,readOnly:E,value:f}),o=x||G.hasInvalidState(c),h=!i&&e>=6&&e%2===0,g=e/2,C={...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":o||void 0,"data-read-only":E||void 0,"data-wrap":i||void 0,style:C,children:[m.jsx("input",{...R,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:F,pattern:S==="numeric"?`[0-9]{${e}}`:`[0-9A-Za-z]{${e}}`,readOnly:E,spellCheck:!1,type:"text",value:r}),m.jsx("span",{"aria-hidden":"true",className:"nk-pin-input__slots",children:Array.from({length:e},(Y,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":j===I||void 0,onPointerDown:K=>q(K,I),children:y&&r[I]?m.jsx("span",{className:"nk-pin-input__censor"}):r[I]??""})]},I))})]})});exports.default=W;
|
package/dist/PinInput.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as G, jsx as b } from "react/jsx-runtime";
|
|
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-DHnOMyYp.js";
|
|
5
|
+
const W = 3, Y = 10, q = 4;
|
|
6
|
+
function ee(a) {
|
|
7
|
+
return Number.isFinite(a) ? Math.min(
|
|
8
|
+
Y,
|
|
9
|
+
Math.max(W, Math.trunc(a))
|
|
10
|
+
) : q;
|
|
11
|
+
}
|
|
12
|
+
function S(a, s, r) {
|
|
13
|
+
return (s === "numeric" ? a.replace(/[^0-9]/g, "") : a.replace(/[^0-9a-z]/gi, "").toUpperCase()).slice(0, r);
|
|
14
|
+
}
|
|
15
|
+
function te(a, s, r) {
|
|
16
|
+
s.current = a, typeof r == "function" ? r(a) : r && (r.current = a);
|
|
17
|
+
}
|
|
18
|
+
function ne(a, s) {
|
|
19
|
+
var c;
|
|
20
|
+
const r = (c = Object.getOwnPropertyDescriptor(
|
|
21
|
+
Object.getPrototypeOf(a),
|
|
22
|
+
"value"
|
|
23
|
+
)) == null ? void 0 : c.set;
|
|
24
|
+
r ? r.call(a, s) : a.value = s;
|
|
25
|
+
}
|
|
26
|
+
function U(a, s, r) {
|
|
27
|
+
const c = Math.min(r - 1, Math.max(0, s)), x = Math.min(c + 1, a.value.length);
|
|
28
|
+
a.focus(), a.setSelectionRange(c, x);
|
|
29
|
+
}
|
|
30
|
+
function ae(a) {
|
|
31
|
+
const {
|
|
32
|
+
defaultValue: s,
|
|
33
|
+
disabled: r,
|
|
34
|
+
forwardedReference: c,
|
|
35
|
+
length: x,
|
|
36
|
+
mode: u,
|
|
37
|
+
onChange: M,
|
|
38
|
+
onComplete: P,
|
|
39
|
+
onFocus: _,
|
|
40
|
+
onKeyDown: p,
|
|
41
|
+
onPaste: g,
|
|
42
|
+
onSelect: N,
|
|
43
|
+
readOnly: v,
|
|
44
|
+
value: L
|
|
45
|
+
} = a, n = ee(x), y = S(
|
|
46
|
+
s,
|
|
47
|
+
u,
|
|
48
|
+
n
|
|
49
|
+
), k = B(null), [w, D] = H(
|
|
50
|
+
y
|
|
51
|
+
), [V, d] = H(0), f = L !== void 0, i = S(
|
|
52
|
+
f ? L : w,
|
|
53
|
+
u,
|
|
54
|
+
n
|
|
55
|
+
), R = X(
|
|
56
|
+
(t) => te(
|
|
57
|
+
t,
|
|
58
|
+
k,
|
|
59
|
+
c
|
|
60
|
+
),
|
|
61
|
+
[c]
|
|
62
|
+
);
|
|
63
|
+
K(() => {
|
|
64
|
+
!f && w !== i && D(i);
|
|
65
|
+
}, [f, i, w]), K(() => {
|
|
66
|
+
var l;
|
|
67
|
+
if (f) return;
|
|
68
|
+
const t = (l = k.current) == null ? void 0 : l.form;
|
|
69
|
+
if (!t) return;
|
|
70
|
+
const e = t.getRootNode();
|
|
71
|
+
function o(h) {
|
|
72
|
+
h.target !== t || h.defaultPrevented || (D(y), d(0));
|
|
73
|
+
}
|
|
74
|
+
return e.addEventListener("reset", o), () => e.removeEventListener("reset", o);
|
|
75
|
+
}, [f, y]);
|
|
76
|
+
function C(t) {
|
|
77
|
+
const e = t.selectionStart ?? i.length;
|
|
78
|
+
return Math.min(n - 1, Math.max(0, e));
|
|
79
|
+
}
|
|
80
|
+
function T(t) {
|
|
81
|
+
const e = t.currentTarget, o = e.selectionStart ?? e.value.length, l = S(e.value, u, n), h = S(
|
|
82
|
+
e.value.slice(0, o),
|
|
83
|
+
u,
|
|
84
|
+
n
|
|
85
|
+
).length;
|
|
86
|
+
e.value = l, f || D(l), M == null || M(t), l.length === n && l !== i && (P == null || P(l));
|
|
87
|
+
const m = Math.min(n - 1, h);
|
|
88
|
+
d(m), e.setSelectionRange(
|
|
89
|
+
m,
|
|
90
|
+
Math.min(m + 1, l.length)
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function A(t) {
|
|
94
|
+
if (g == null || g(t), t.defaultPrevented || r || v) return;
|
|
95
|
+
const e = S(
|
|
96
|
+
t.clipboardData.getData("text"),
|
|
97
|
+
u,
|
|
98
|
+
n
|
|
99
|
+
);
|
|
100
|
+
if (t.preventDefault(), e.length === 0) return;
|
|
101
|
+
const o = t.currentTarget, l = o.selectionStart ?? i.length, h = o.selectionEnd ?? l, m = e.length === n ? e : S(
|
|
102
|
+
i.slice(0, l) + e + i.slice(h),
|
|
103
|
+
u,
|
|
104
|
+
n
|
|
105
|
+
), E = e.length === n ? n : Math.min(n, l + e.length);
|
|
106
|
+
ne(o, m), o.setSelectionRange(E, E), o.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
107
|
+
}
|
|
108
|
+
function z(t) {
|
|
109
|
+
if (p == null || p(t), t.defaultPrevented || t.key !== "ArrowLeft" && t.key !== "ArrowRight") return;
|
|
110
|
+
t.preventDefault();
|
|
111
|
+
const e = t.key === "ArrowLeft" ? -1 : 1, o = Math.min(
|
|
112
|
+
n - 1,
|
|
113
|
+
Math.max(0, C(t.currentTarget) + e)
|
|
114
|
+
);
|
|
115
|
+
d(o), U(t.currentTarget, o, n);
|
|
116
|
+
}
|
|
117
|
+
function F(t) {
|
|
118
|
+
_ == null || _(t);
|
|
119
|
+
const e = Math.min(n - 1, i.length);
|
|
120
|
+
d(e), U(t.currentTarget, e, n);
|
|
121
|
+
}
|
|
122
|
+
function O(t) {
|
|
123
|
+
N == null || N(t), d(C(t.currentTarget));
|
|
124
|
+
}
|
|
125
|
+
function j(t, e) {
|
|
126
|
+
if (t.preventDefault(), r) return;
|
|
127
|
+
const o = k.current;
|
|
128
|
+
o && (d(e), U(o, e, n));
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
activeIndex: V,
|
|
132
|
+
handleChange: T,
|
|
133
|
+
handleFocus: F,
|
|
134
|
+
handleKeyDown: z,
|
|
135
|
+
handlePaste: A,
|
|
136
|
+
handleSelect: O,
|
|
137
|
+
handleSlotPointerDown: j,
|
|
138
|
+
inputCallbackReference: R,
|
|
139
|
+
length: n,
|
|
140
|
+
renderedValue: i
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const se = Z(function(s, r) {
|
|
144
|
+
const {
|
|
145
|
+
"aria-invalid": c,
|
|
146
|
+
autoCapitalize: x,
|
|
147
|
+
autoComplete: u = "one-time-code",
|
|
148
|
+
className: M,
|
|
149
|
+
censored: P = !1,
|
|
150
|
+
defaultValue: _ = "",
|
|
151
|
+
disabled: p = !1,
|
|
152
|
+
invalid: g = !1,
|
|
153
|
+
length: N = q,
|
|
154
|
+
mode: v = "numeric",
|
|
155
|
+
onChange: L,
|
|
156
|
+
onComplete: n,
|
|
157
|
+
onFocus: y,
|
|
158
|
+
onKeyDown: k,
|
|
159
|
+
onPaste: w,
|
|
160
|
+
onSelect: D,
|
|
161
|
+
readOnly: V = !1,
|
|
162
|
+
style: d,
|
|
163
|
+
value: f,
|
|
164
|
+
wrap: i = !1,
|
|
165
|
+
...R
|
|
166
|
+
} = s, {
|
|
167
|
+
activeIndex: C,
|
|
168
|
+
handleChange: T,
|
|
169
|
+
handleFocus: A,
|
|
170
|
+
handleKeyDown: z,
|
|
171
|
+
handlePaste: F,
|
|
172
|
+
handleSelect: O,
|
|
173
|
+
handleSlotPointerDown: j,
|
|
174
|
+
inputCallbackReference: t,
|
|
175
|
+
length: e,
|
|
176
|
+
renderedValue: o
|
|
177
|
+
} = ae({
|
|
178
|
+
defaultValue: _,
|
|
179
|
+
disabled: p,
|
|
180
|
+
forwardedReference: r,
|
|
181
|
+
length: N,
|
|
182
|
+
mode: v,
|
|
183
|
+
onChange: L,
|
|
184
|
+
onComplete: n,
|
|
185
|
+
onFocus: y,
|
|
186
|
+
onKeyDown: k,
|
|
187
|
+
onPaste: w,
|
|
188
|
+
onSelect: D,
|
|
189
|
+
readOnly: V,
|
|
190
|
+
value: f
|
|
191
|
+
}), l = g || Q(c), h = !i && e >= 6 && e % 2 === 0, m = e / 2, E = {
|
|
192
|
+
...d,
|
|
193
|
+
"--nk-pin-input-columns": Math.ceil(e / 2)
|
|
194
|
+
};
|
|
195
|
+
return /* @__PURE__ */ G(
|
|
196
|
+
"span",
|
|
197
|
+
{
|
|
198
|
+
className: ["nk-pin-input", M].filter(Boolean).join(" "),
|
|
199
|
+
"data-disabled": p || void 0,
|
|
200
|
+
"data-invalid": l || void 0,
|
|
201
|
+
"data-read-only": V || void 0,
|
|
202
|
+
"data-wrap": i || void 0,
|
|
203
|
+
style: E,
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ b(
|
|
206
|
+
"input",
|
|
207
|
+
{
|
|
208
|
+
...R,
|
|
209
|
+
ref: t,
|
|
210
|
+
"aria-invalid": J(g, c),
|
|
211
|
+
autoCapitalize: x ?? (v === "alphanumeric" ? "characters" : "off"),
|
|
212
|
+
autoComplete: u,
|
|
213
|
+
className: "nk-pin-input__control",
|
|
214
|
+
disabled: p,
|
|
215
|
+
inputMode: v === "numeric" ? "numeric" : "text",
|
|
216
|
+
maxLength: e,
|
|
217
|
+
minLength: e,
|
|
218
|
+
onChange: T,
|
|
219
|
+
onFocus: A,
|
|
220
|
+
onKeyDown: z,
|
|
221
|
+
onPaste: F,
|
|
222
|
+
onSelect: O,
|
|
223
|
+
pattern: v === "numeric" ? `[0-9]{${e}}` : `[0-9A-Za-z]{${e}}`,
|
|
224
|
+
readOnly: V,
|
|
225
|
+
spellCheck: !1,
|
|
226
|
+
type: "text",
|
|
227
|
+
value: o
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ b("span", { "aria-hidden": "true", className: "nk-pin-input__slots", children: Array.from({ length: e }, (oe, I) => /* @__PURE__ */ G("span", { className: "nk-pin-input__slot-group", children: [
|
|
231
|
+
h && I === m ? /* @__PURE__ */ b("span", { className: "nk-pin-input__separator", children: "-" }) : null,
|
|
232
|
+
/* @__PURE__ */ b(
|
|
233
|
+
"span",
|
|
234
|
+
{
|
|
235
|
+
className: "nk-pin-input__slot",
|
|
236
|
+
"data-active": C === I || void 0,
|
|
237
|
+
onPointerDown: ($) => j($, I),
|
|
238
|
+
children: P && o[I] ? /* @__PURE__ */ b("span", { className: "nk-pin-input__censor" }) : o[I] ?? ""
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] }, I)) })
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
});
|
|
246
|
+
export {
|
|
247
|
+
se as default
|
|
248
|
+
};
|
package/dist/Popover.cjs
ADDED
|
@@ -0,0 +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"),_=require("./reference-C2guRuR0.cjs"),y=require("./usePresence-qe92UTvK.cjs"),Ce=require("./useFloatingPosition-D1FqYy0l.cjs"),Se=require("./useFocusTrap--cgjy78G.cjs"),Oe=require("./Surface-BttJYSDt.cjs");function we(n){const{inert:a,panelElement:c}=n;return t.useLayoutEffect(()=>{c&&(c.inert=a)},[a,c]),null}function De(n,a,c){a.current=n,_.assignElementReference(c,n)}function Fe(n,a,c){a.current=n,_.assignElementReference(c,n)}function je(n,a){const c=(n==null?void 0:n.split(/\s+/).filter(Boolean))??[];return c.includes(a)||c.push(a),c.join(" ")}function qe(n){const a=n.tagName.toLowerCase();return n.getAttribute("role")==="button"&&a!=="button"?!1:["button","input","select","summary","textarea"].includes(a)?!0:a==="a"&&n.hasAttribute("href")}function Le(n){return n==="grid"||n==="listbox"||n==="menu"||n==="tree"?n:"dialog"}const Ne=t.forwardRef(function(a,c){const{"aria-label":B,"aria-labelledby":ee,autoFocus:w=!0,children:te,className:re,closeOnEscape:ne=!0,closeOnOutsideInteraction:se=!0,defaultOpen:oe=!1,disabled:T=!1,initialFocusReference:h,onEscapeKeyDown:ae,onOpenChange:x,onPointerDownOutside:k,open:M,placement:K="bottom",portalContainer:I,restoreFocus:D=!0,role:z="dialog",style:A,tabIndex:ce,trapFocus:m=!1,trigger:d,...ie}=a;if(d.type===t.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const H=t.useId(),ue=t.useContext(y.FocusScopeContext),V=`${H}-popover`,o=d.props,$=_.getElementReference(d),U=o.id??`${H}-trigger`,P=T||o.disabled===!0||o["aria-disabled"]===!0||o["aria-disabled"]==="true",R=M!==void 0,[le,de]=t.useState(oe),r=R?M:le,C=y.usePresence(r),G=t.useRef(null),J=t.useRef(null),F=t.useRef("programmatic"),j=t.useRef(null),Q=t.useRef(r),S=t.useRef(null),[fe,pe]=t.useReducer(e=>e+1,0),[u,ge]=t.useState(null),[f,me]=t.useState(null),i=(I==null?void 0:I.ownerDocument)??(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),O=y.useOverlayLayer(C.present,i),be=t.useMemo(()=>[G,J],[]),p=Ce.useFloatingPosition(C.present,K,u,f),ve=t.useCallback(e=>{Fe(e,G,$),ge(e)},[$]),ye=t.useCallback(e=>{De(e,J,c),me(e)},[c]),g=t.useCallback((e,s)=>{r!==e&&(R?(j.current={open:e,reason:s},pe()):(F.current=s,de(e)),x==null||x(e,s))},[R,x,r]),he=t.useCallback(()=>{g(!1,"escape")},[g]),Pe=t.useCallback(()=>{g(!1,"outside")},[g]),Re=t.useCallback(e=>{var E;if(k==null||k(e),e.defaultPrevented)return;const s=(E=i==null?void 0:i.defaultView)==null?void 0:E.HTMLElement;S.current=s?e.composedPath().find(v=>v instanceof s&&v.tabIndex>=0)??e.target:e.target},[k,i]);y.useDismissableLayer({active:r,boundaries:be,dismissOnEscape:ne,dismissOnPointerDownOutside:se,layerId:O.id,onEscapeDismiss:he,onEscapeKeyDown:ae,onPointerDownOutside:Re,onPointerDownOutsideDismiss:Pe,ownerDocument:i});const Ee=Se.useFocusTrap({active:r&&m,autoFocus:w,container:f,initialFocusReference:h,layerId:O.id,restoreFocus:D});t.useEffect(()=>{if(!r||m||!w||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const s=h==null?void 0:h.current;(s&&f.contains(s)?s:f).focus({preventScroll:!0})}),()=>{e=!1}},[w,h,r,f,m]),t.useEffect(()=>{var Z;const e=Q.current;Q.current=r;const s=j.current,E=R?e!==r&&(s==null?void 0:s.open)===r?s.reason:"programmatic":F.current;if(j.current=null,r){F.current="programmatic",S.current=null;return}const v=i==null?void 0:i.activeElement,L=S.current,N=(Z=i==null?void 0:i.defaultView)==null?void 0:Z.HTMLElement,Ie=E==="outside"&&N&&L instanceof N&&v instanceof N&&(L===v||L.contains(v));e&&!m&&D&&!Ie&&(u==null||u.focus({preventScroll:!0})),S.current=null},[fe,R,r,i,D,m,u]),t.useEffect(()=>{T&&r&&g(!1,"programmatic")},[T,r,g]);function Te(e){var s;if(P){e.preventDefault(),e.stopPropagation();return}(s=o.onClick)==null||s.call(o,e),!e.defaultPrevented&&g(!r,"trigger")}function xe(e){var s;(s=o.onKeyDown)==null||s.call(o,e),!(e.defaultPrevented||P||qe(e.currentTarget)||e.key!=="Enter"&&e.key!==" ")&&(e.preventDefault(),e.currentTarget.click())}if(T)return d;const q=typeof d.type=="string",b=q?d.type:null,W=b==="a"&&typeof o.href=="string",X=q&&!(b==="button"||b==="input"||b==="select"||b==="summary"||b==="textarea"||W),Y=W&&P,ke=t.cloneElement(d,{"aria-controls":r?je(o["aria-controls"],V):o["aria-controls"],"aria-expanded":r,"aria-haspopup":o["aria-haspopup"]??Le(z),"aria-disabled":P?!0:o["aria-disabled"],className:[o.className,"nk-popover__trigger"].filter(Boolean).join(" "),href:Y?void 0:o.href,id:U,onClick:Te,onKeyDown:q?xe:o.onKeyDown,ref:ve,role:o.role??(Y?"link":X?"button":void 0),tabIndex:P?-1:o.tabIndex??(X?0:void 0)});return l.jsxs(l.Fragment,{children:[ke,l.jsx(y.FocusScopeContext.Provider,{value:r&&m?Ee:ue,children:C.present&&i?l.jsx(y.Portal,{container:I,inheritFrom:u,children:l.jsxs(Oe.Surface,{...ie,ref:ye,"aria-hidden":r?void 0:!0,"aria-label":r?B:void 0,"aria-labelledby":r?ee??(B===void 0?U:void 0):void 0,className:["nk-popover",re].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??K,"data-state":C.state==="closing"?"closing":"open",id:V,role:r?z:void 0,style:p?{...A,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:O.zIndex}:{...A,visibility:"hidden",zIndex:O.zIndex},tabIndex:ce??-1,children:[l.jsx(we,{inert:!r,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:te})]})}):null})]})});exports.default=Ne;
|