neatkit 0.7.0 → 0.9.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/Avatar-Belo7qAY.cjs +1 -0
- package/dist/Avatar-DjDCFqNG.js +55 -0
- package/dist/Avatar.cjs +1 -1
- package/dist/Avatar.js +2 -52
- package/dist/Boundary.cjs +1 -0
- package/dist/Boundary.js +176 -0
- package/dist/Button-BV5OUXpc.js +101 -0
- package/dist/Button-DU4j_IED.cjs +1 -0
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.js +213 -2
- package/dist/Code-B7s_rN0G.cjs +4 -0
- package/dist/Code-Bp2X1k-g.js +224 -0
- package/dist/Code.cjs +1 -1
- package/dist/Code.js +1 -1
- package/dist/Divider-C7XGlr26.cjs +1 -0
- package/dist/{Divider-BE15WVDI.js → Divider-DZgpYpr-.js} +1 -1
- package/dist/Divider.cjs +1 -1
- package/dist/Divider.js +1 -1
- package/dist/Icon-BIBzgznI.cjs +1 -0
- package/dist/{Icon-uQmpr5P2.js → Icon-CxK1wlGk.js} +194 -181
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +2 -35
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +70 -79
- package/dist/Markdown.cjs +1 -31
- package/dist/Markdown.js +469 -18066
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +100 -122
- package/dist/PinInput.cjs +1 -1
- package/dist/PinInput.js +1 -1
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +171 -165
- package/dist/Radio.cjs +1 -1
- package/dist/Radio.js +86 -41
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +326 -315
- package/dist/Sidebar.cjs +1 -0
- package/dist/Sidebar.js +490 -0
- package/dist/Skeleton.cjs +1 -1
- package/dist/Skeleton.js +20 -16
- package/dist/Switch.cjs +1 -1
- package/dist/Switch.js +1 -1
- package/dist/Table-CADupJEU.js +423 -0
- package/dist/Table-qetwZpTC.cjs +1 -0
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/TextArea.cjs +1 -1
- package/dist/TextArea.js +1 -1
- package/dist/Tooltip-B2d5ss7S.cjs +1 -0
- package/dist/Tooltip-BK64rkxV.js +231 -0
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +2 -3
- package/dist/albert-sans-cb3e34c4.woff2 +0 -0
- package/dist/aria-Bntn6ad_.cjs +1 -0
- package/dist/aria-CeA9QfD1.js +15 -0
- package/dist/components/Boundary/Boundary.d.ts +65 -0
- package/dist/components/Boundary/contexts/BoundaryContext.d.ts +28 -0
- package/dist/components/Boundary/hooks/useBoundary.d.ts +19 -0
- package/dist/components/Boundary/hooks/useBoundaryWidth.d.ts +23 -0
- package/dist/components/Boundary/index.d.ts +2 -0
- package/dist/components/Boundary/utils/width.d.ts +11 -0
- package/dist/components/Checkbox/Checkbox.d.ts +9 -1
- package/dist/components/{CheckboxGroup → Checkbox/components}/CheckboxGroup.d.ts +2 -2
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/utils/checkbox-option.d.ts +17 -0
- package/dist/components/Icon/Icon.d.ts +1 -0
- package/dist/components/Icon/icons/GearIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ImageIcon.d.ts +11 -0
- package/dist/components/Icon/index.d.ts +0 -33
- package/dist/components/Icon/utils/registry.d.ts +2 -0
- package/dist/components/Input/Input.d.ts +1 -9
- package/dist/components/Modal/Modal.d.ts +0 -4
- package/dist/components/PinInput/PinInput.d.ts +1 -1
- package/dist/components/Popover/Popover.d.ts +2 -6
- package/dist/components/Portal/Portal.d.ts +11 -8
- package/dist/components/Portal/hooks/useDismissableLayer.d.ts +2 -0
- package/dist/components/Portal/hooks/useFloatingPosition.d.ts +4 -3
- package/dist/components/Portal/hooks/useFocusTrap.d.ts +2 -0
- package/dist/components/Portal/hooks/useScrollLock.d.ts +9 -3
- package/dist/components/Portal/utils/boundary-focus.d.ts +23 -0
- package/dist/components/Portal/utils/floating-position.d.ts +43 -9
- package/dist/components/Portal/utils/overlay-stack.d.ts +22 -10
- package/dist/components/Portal/utils/scroll-container.d.ts +13 -0
- package/dist/components/Radio/Radio.d.ts +9 -1
- package/dist/components/{RadioGroup → Radio/components}/RadioGroup.d.ts +9 -2
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +0 -2
- package/dist/components/Select/utils/listbox-position.d.ts +28 -0
- package/dist/components/Sidebar/Sidebar.d.ts +113 -0
- package/dist/components/Sidebar/components/SidebarFooter.d.ts +24 -0
- package/dist/components/Sidebar/components/SidebarGroup.d.ts +31 -0
- package/dist/components/Sidebar/components/SidebarHeader.d.ts +29 -0
- package/dist/components/Sidebar/components/SidebarItem.d.ts +46 -0
- package/dist/components/Sidebar/components/SidebarOverlay.d.ts +38 -0
- package/dist/components/Sidebar/components/SidebarPanel.d.ts +47 -0
- package/dist/components/Sidebar/components/SidebarTrigger.d.ts +47 -0
- package/dist/components/Sidebar/components/SidebarUser.d.ts +59 -0
- package/dist/components/Sidebar/hooks/usePresentation.d.ts +14 -0
- package/dist/components/Sidebar/hooks/useSidebar.d.ts +9 -0
- package/dist/components/Sidebar/index.d.ts +2 -0
- package/dist/components/Sidebar/utils/presentation.d.ts +12 -0
- package/dist/components/Sidebar/utils/state.d.ts +62 -0
- package/dist/components/Skeleton/Skeleton.d.ts +21 -5
- package/dist/components/Table/Table.d.ts +21 -249
- package/dist/components/Table/components/TableAction.d.ts +18 -0
- package/dist/components/Table/components/TableActionCell.d.ts +15 -0
- package/dist/components/Table/components/TableActionHeaderCell.d.ts +13 -0
- package/dist/components/Table/components/TableBody.d.ts +27 -0
- package/dist/components/Table/components/TableCell.d.ts +42 -0
- package/dist/components/Table/components/TableFoot.d.ts +19 -0
- package/dist/components/Table/components/TableHead.d.ts +19 -0
- package/dist/components/Table/components/TableHeaderCell.d.ts +23 -0
- package/dist/components/Table/components/TableRow.d.ts +67 -0
- package/dist/components/Table/contexts/TableContext.d.ts +4 -0
- package/dist/components/Table/hooks/useHorizontalOverflow.d.ts +25 -0
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Table/utils/cell.d.ts +25 -0
- package/dist/components/Table/utils/children.d.ts +18 -0
- package/dist/components/Table/utils/trigger.d.ts +54 -0
- package/dist/components/Tooltip/Tooltip.d.ts +10 -4
- package/dist/components/Tooltip/TooltipProvider.d.ts +1 -1
- package/dist/components/Tooltip/index.d.ts +0 -1
- package/dist/effects-D5CWf-Pl.js +8 -0
- package/dist/effects-D85L_7zM.cjs +1 -0
- package/dist/floating-position-DIjh2wnP.cjs +1 -0
- package/dist/floating-position-DvR6e334.js +50 -0
- package/dist/style.css +1 -1
- package/dist/tokens.d.ts +1 -0
- package/dist/useFloatingPosition-B3ZC-v3v.js +43 -0
- package/dist/useFloatingPosition-GzkP9dCc.cjs +1 -0
- package/dist/useFocusTrap-BrFZdMqQ.cjs +1 -0
- package/dist/useFocusTrap-DhVnlboe.js +136 -0
- package/dist/usePresence-B5RYv4e1.cjs +1 -0
- package/dist/usePresence-CqegYqy4.js +221 -0
- package/dist/useScrollLock-Drd7OZRC.js +62 -0
- package/dist/useScrollLock-Dy8MZaSn.cjs +1 -0
- package/dist/utils/aria.d.ts +9 -0
- package/dist/utils/effects.d.ts +12 -0
- package/package.json +12 -16
- package/dist/Button-BAsLfA0D.js +0 -99
- package/dist/Button-D7JUO6Fs.cjs +0 -1
- package/dist/Checkbox-BvXM9VyY.js +0 -68
- package/dist/Checkbox-VQifZrZZ.cjs +0 -1
- package/dist/CheckboxGroup.cjs +0 -1
- package/dist/CheckboxGroup.js +0 -144
- package/dist/Code-BP2ZCmUf.js +0 -7446
- package/dist/Code-eispVOW3.cjs +0 -6
- package/dist/Content.cjs +0 -1
- package/dist/Content.js +0 -144
- package/dist/Divider-CJYbFcSX.cjs +0 -1
- package/dist/Icon-D8IZceys.cjs +0 -1
- package/dist/RadioGroup.cjs +0 -1
- package/dist/RadioGroup.js +0 -51
- package/dist/RadioGroupContext-BX9KnDek.cjs +0 -1
- package/dist/RadioGroupContext-DbKM4zPZ.js +0 -5
- package/dist/Table-83unQQOi.cjs +0 -1
- package/dist/Table-Cw8u-pEW.js +0 -403
- package/dist/Tooltip-BB82wNOE.cjs +0 -1
- package/dist/Tooltip-CqWK_GRD.js +0 -236
- package/dist/aria-DHnOMyYp.js +0 -10
- package/dist/aria-DKxpE8cA.cjs +0 -1
- package/dist/components/CheckboxGroup/index.d.ts +0 -2
- package/dist/components/Content/Content.d.ts +0 -60
- package/dist/components/Content/hooks/useContentLayout.d.ts +0 -18
- package/dist/components/Content/index.d.ts +0 -2
- package/dist/components/Content/utils/layout.d.ts +0 -11
- package/dist/components/RadioGroup/index.d.ts +0 -2
- package/dist/useFloatingPosition-CxzhAvy8.js +0 -73
- package/dist/useFloatingPosition-D1FqYy0l.cjs +0 -1
- package/dist/useFocusTrap--cgjy78G.cjs +0 -1
- package/dist/useFocusTrap-Da4nEash.js +0 -134
- package/dist/usePresence-DSPt6aKi.js +0 -210
- package/dist/usePresence-qe92UTvK.cjs +0 -1
- /package/dist/components/{CheckboxGroup → Checkbox}/contexts/CheckboxGroupContext.d.ts +0 -0
- /package/dist/components/{CheckboxGroup → Checkbox}/hooks/useCheckboxGroup.d.ts +0 -0
- /package/dist/components/{RadioGroup → Radio}/contexts/RadioGroupContext.d.ts +0 -0
- /package/dist/components/{RadioGroup → Radio}/hooks/useRadioGroup.d.ts +0 -0
package/dist/Modal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),s=require("react"),A=require("./effects-D85L_7zM.cjs"),$=require("./Button-DU4j_IED.cjs"),r=require("./usePresence-B5RYv4e1.cjs"),G=require("./useFocusTrap-BrFZdMqQ.cjs"),H=require("./useScrollLock-Dy8MZaSn.cjs"),J=require("./Surface-BttJYSDt.cjs"),K=require("./Text-DWYlIcPj.cjs");function Q(c,t,a){t.current=c,typeof a=="function"?a(c):a&&(a.current=c)}function U(c){const{"aria-label":t,"aria-labelledby":a,children:l,className:v,closeButtonLabel:m="Close modal",exitable:i=!0,forwardedReference:u,initialFocusReference:d,lockScroll:f=!0,onClose:e,open:o,ownerDocument:g,presenceState:k,restoreFocus:R=!0,role:F="dialog",style:I,title:b,trapFocus:S=!0,...P}=c,j=s.useRef(null),_=s.useRef(null),q=s.useContext(r.FocusScopeContext),B=`${s.useId()}-title`,[y,M]=s.useState(null),p=r.useBoundary("Modal").boundaryElement,x=r.useOverlayLayer(!0,p),E=s.useMemo(()=>[j],[]),h=!!(b!=null&&b.trim()),N=d??(h?_:void 0),O=a??(t===void 0&&h?B:void 0),T=s.useCallback(L=>{Q(L,j,u),M(L)},[u]);A.useIsomorphicLayoutEffect(()=>{y&&(y.inert=!o)},[y,o]);const w=s.useCallback(()=>{e==null||e("escape")},[e]),C=s.useCallback(()=>{e==null||e("outside")},[e]);r.useDismissableLayer({boundary:p,active:o,boundaries:E,dismissOnEscape:i,dismissOnPointerDownOutside:i,layerId:x.id,onEscapeDismiss:w,onPointerDownOutsideDismiss:C,ownerDocument:g});const z=G.useFocusTrap({boundary:p,active:o&&S,container:y,initialFocusReference:N,layerId:x.id,restoreFocus:R});H.useScrollLock(f,g,p);const D=i?n.jsx($.Button,{"aria-label":m,className:"nk-modal__close",icon:"cross",onClick:()=>e==null?void 0:e("close-button"),shape:"rectangle",type:"button",variant:"ghost"}):null;return n.jsx(r.FocusScopeContext.Provider,{value:o&&S?z:q,children:n.jsx("div",{className:"nk-modal__overlay","data-state":k,role:"presentation",style:{zIndex:x.zIndex},children:n.jsx("div",{className:"nk-modal__viewport",children:n.jsxs(J.Surface,{...P,ref:T,"aria-hidden":o?void 0:!0,"aria-label":o?t: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?n.jsxs("div",{className:"nk-modal__header",children:[n.jsx(K.Text,{as:"h2",className:"nk-modal__title",id:B,ref:_,size:"subtitle",tabIndex:-1,weight:"semibold",children:b}),D]}):D,l]})})})})}const V=s.forwardRef(function(t,a){const{open:l}=t,v=r.useBoundary("Modal"),m=s.useRef(t);l&&(m.current=t);const i=l?t:m.current,u=r.usePresence(l),d=v.boundaryElement,f=(d==null?void 0:d.ownerDocument)??(typeof document>"u"?null:document);return!u.present||!f?null:n.jsx(r.Portal,{children:n.jsx(U,{...i,forwardedReference:a,open:l,ownerDocument:f,presenceState:u.state==="closing"?"closing":"open"})})});exports.default=V;
|
package/dist/Modal.js
CHANGED
|
@@ -1,171 +1,149 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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]);
|
|
2
|
+
import { jsx as t, jsxs as F } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as H, useRef as g, useContext as J, useId as K, useState as Q, useMemo as U, useCallback as h } from "react";
|
|
4
|
+
import { u as V } from "./effects-D5CWf-Pl.js";
|
|
5
|
+
import { B as W } from "./Button-BV5OUXpc.js";
|
|
6
|
+
import { b as E, c as X, P as Y, F as P, d as Z, e as ee } from "./usePresence-CqegYqy4.js";
|
|
7
|
+
import { u as oe } from "./useFocusTrap-DhVnlboe.js";
|
|
8
|
+
import { u as ae } from "./useScrollLock-Drd7OZRC.js";
|
|
9
|
+
import { S as se } from "./Surface-vEFsZC12.js";
|
|
10
|
+
import { T as te } from "./Text-rN6iDo0V.js";
|
|
11
|
+
function ne(n, a, s) {
|
|
12
|
+
a.current = n, typeof s == "function" ? s(n) : s && (s.current = n);
|
|
34
13
|
}
|
|
35
|
-
function
|
|
36
|
-
e.current = n, typeof o == "function" ? o(n) : o && (o.current = n);
|
|
37
|
-
}
|
|
38
|
-
function ne(n) {
|
|
14
|
+
function re(n) {
|
|
39
15
|
const {
|
|
40
|
-
"aria-label":
|
|
41
|
-
"aria-labelledby":
|
|
42
|
-
children:
|
|
43
|
-
className:
|
|
44
|
-
closeButtonLabel:
|
|
45
|
-
exitable:
|
|
46
|
-
forwardedReference:
|
|
47
|
-
initialFocusReference:
|
|
48
|
-
lockScroll:
|
|
49
|
-
onClose:
|
|
50
|
-
open:
|
|
51
|
-
ownerDocument:
|
|
52
|
-
presenceState:
|
|
53
|
-
restoreFocus:
|
|
16
|
+
"aria-label": a,
|
|
17
|
+
"aria-labelledby": s,
|
|
18
|
+
children: r,
|
|
19
|
+
className: b,
|
|
20
|
+
closeButtonLabel: d = "Close modal",
|
|
21
|
+
exitable: i = !0,
|
|
22
|
+
forwardedReference: l,
|
|
23
|
+
initialFocusReference: c,
|
|
24
|
+
lockScroll: u = !0,
|
|
25
|
+
onClose: e,
|
|
26
|
+
open: o,
|
|
27
|
+
ownerDocument: k,
|
|
28
|
+
presenceState: x,
|
|
29
|
+
restoreFocus: R = !0,
|
|
54
30
|
role: M = "dialog",
|
|
55
31
|
style: N,
|
|
56
|
-
title:
|
|
57
|
-
trapFocus:
|
|
58
|
-
...
|
|
59
|
-
} = n,
|
|
60
|
-
(
|
|
61
|
-
|
|
32
|
+
title: m,
|
|
33
|
+
trapFocus: D = !0,
|
|
34
|
+
...w
|
|
35
|
+
} = n, B = g(null), I = g(null), O = J(P), L = `${K()}-title`, [f, T] = Q(null), p = E("Modal").boundaryElement, y = Z(!0, p), j = U(() => [B], []), v = !!(m != null && m.trim()), z = c ?? (v ? I : void 0), A = s ?? (a === void 0 && v ? L : void 0), C = h(
|
|
36
|
+
(_) => {
|
|
37
|
+
ne(_, B, l), T(_);
|
|
62
38
|
},
|
|
63
|
-
[
|
|
39
|
+
[l]
|
|
64
40
|
);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, [
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
}, [
|
|
71
|
-
|
|
72
|
-
}, [
|
|
41
|
+
V(() => {
|
|
42
|
+
f && (f.inert = !o);
|
|
43
|
+
}, [f, o]);
|
|
44
|
+
const $ = h(() => {
|
|
45
|
+
e == null || e("escape");
|
|
46
|
+
}, [e]), q = h(() => {
|
|
47
|
+
e == null || e("outside");
|
|
48
|
+
}, [e]);
|
|
73
49
|
ee({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
50
|
+
boundary: p,
|
|
51
|
+
active: o,
|
|
52
|
+
boundaries: j,
|
|
53
|
+
dismissOnEscape: i,
|
|
54
|
+
dismissOnPointerDownOutside: i,
|
|
55
|
+
layerId: y.id,
|
|
56
|
+
onEscapeDismiss: $,
|
|
57
|
+
onPointerDownOutsideDismiss: q,
|
|
58
|
+
ownerDocument: k
|
|
82
59
|
});
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
60
|
+
const G = oe({
|
|
61
|
+
boundary: p,
|
|
62
|
+
active: o && D,
|
|
63
|
+
container: f,
|
|
64
|
+
initialFocusReference: z,
|
|
65
|
+
layerId: y.id,
|
|
66
|
+
restoreFocus: R
|
|
89
67
|
});
|
|
90
|
-
ae(
|
|
91
|
-
const
|
|
92
|
-
|
|
68
|
+
ae(u, k, p);
|
|
69
|
+
const S = i ? /* @__PURE__ */ t(
|
|
70
|
+
W,
|
|
93
71
|
{
|
|
94
|
-
"aria-label":
|
|
72
|
+
"aria-label": d,
|
|
95
73
|
className: "nk-modal__close",
|
|
96
74
|
icon: "cross",
|
|
97
|
-
onClick: () =>
|
|
75
|
+
onClick: () => e == null ? void 0 : e("close-button"),
|
|
98
76
|
shape: "rectangle",
|
|
99
77
|
type: "button",
|
|
100
78
|
variant: "ghost"
|
|
101
79
|
}
|
|
102
80
|
) : null;
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
-
|
|
81
|
+
return /* @__PURE__ */ t(
|
|
82
|
+
P.Provider,
|
|
105
83
|
{
|
|
106
|
-
value:
|
|
107
|
-
children: /* @__PURE__ */
|
|
84
|
+
value: o && D ? G : O,
|
|
85
|
+
children: /* @__PURE__ */ t(
|
|
108
86
|
"div",
|
|
109
87
|
{
|
|
110
88
|
className: "nk-modal__overlay",
|
|
111
|
-
"data-state":
|
|
89
|
+
"data-state": x,
|
|
112
90
|
role: "presentation",
|
|
113
|
-
style: { zIndex:
|
|
114
|
-
children: /* @__PURE__ */
|
|
115
|
-
|
|
91
|
+
style: { zIndex: y.zIndex },
|
|
92
|
+
children: /* @__PURE__ */ t("div", { className: "nk-modal__viewport", children: /* @__PURE__ */ F(
|
|
93
|
+
se,
|
|
116
94
|
{
|
|
117
|
-
...
|
|
118
|
-
ref:
|
|
119
|
-
"aria-hidden":
|
|
120
|
-
"aria-label":
|
|
121
|
-
"aria-labelledby":
|
|
122
|
-
"aria-modal":
|
|
123
|
-
className: ["nk-modal",
|
|
124
|
-
"data-state":
|
|
125
|
-
role:
|
|
95
|
+
...w,
|
|
96
|
+
ref: C,
|
|
97
|
+
"aria-hidden": o ? void 0 : !0,
|
|
98
|
+
"aria-label": o ? a : void 0,
|
|
99
|
+
"aria-labelledby": o ? A : void 0,
|
|
100
|
+
"aria-modal": o ? "true" : void 0,
|
|
101
|
+
className: ["nk-modal", b].filter(Boolean).join(" "),
|
|
102
|
+
"data-state": x,
|
|
103
|
+
role: o ? M : void 0,
|
|
126
104
|
style: N,
|
|
127
105
|
tabIndex: -1,
|
|
128
106
|
children: [
|
|
129
|
-
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
|
|
107
|
+
v ? /* @__PURE__ */ F("div", { className: "nk-modal__header", children: [
|
|
108
|
+
/* @__PURE__ */ t(
|
|
109
|
+
te,
|
|
132
110
|
{
|
|
133
111
|
as: "h2",
|
|
134
112
|
className: "nk-modal__title",
|
|
135
113
|
id: L,
|
|
136
|
-
ref:
|
|
114
|
+
ref: I,
|
|
137
115
|
size: "subtitle",
|
|
138
116
|
tabIndex: -1,
|
|
139
117
|
weight: "semibold",
|
|
140
|
-
children:
|
|
118
|
+
children: m
|
|
141
119
|
}
|
|
142
120
|
),
|
|
143
|
-
|
|
144
|
-
] }) :
|
|
145
|
-
|
|
121
|
+
S
|
|
122
|
+
] }) : S,
|
|
123
|
+
r
|
|
146
124
|
]
|
|
147
125
|
}
|
|
148
|
-
)
|
|
126
|
+
) })
|
|
149
127
|
}
|
|
150
128
|
)
|
|
151
129
|
}
|
|
152
130
|
);
|
|
153
131
|
}
|
|
154
|
-
const
|
|
155
|
-
const { open:
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
return
|
|
159
|
-
|
|
132
|
+
const ye = H(function(a, s) {
|
|
133
|
+
const { open: r } = a, b = E("Modal"), d = g(a);
|
|
134
|
+
r && (d.current = a);
|
|
135
|
+
const i = r ? a : d.current, l = X(r), c = b.boundaryElement, u = (c == null ? void 0 : c.ownerDocument) ?? (typeof document > "u" ? null : document);
|
|
136
|
+
return !l.present || !u ? null : /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(
|
|
137
|
+
re,
|
|
160
138
|
{
|
|
161
|
-
...
|
|
162
|
-
forwardedReference:
|
|
163
|
-
open:
|
|
139
|
+
...i,
|
|
140
|
+
forwardedReference: s,
|
|
141
|
+
open: r,
|
|
164
142
|
ownerDocument: u,
|
|
165
|
-
presenceState:
|
|
143
|
+
presenceState: l.state === "closing" ? "closing" : "open"
|
|
166
144
|
}
|
|
167
|
-
) })
|
|
145
|
+
) });
|
|
168
146
|
});
|
|
169
147
|
export {
|
|
170
|
-
|
|
148
|
+
ye as default
|
|
171
149
|
};
|
package/dist/PinInput.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react/jsx-runtime"),v=require("react"),G=require("./aria-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react/jsx-runtime"),v=require("react"),G=require("./aria-Bntn6ad_.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as G, jsx as b } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as B, useState as H, useCallback as X, useEffect as K, forwardRef as Z } from "react";
|
|
4
|
-
import { r as J, h as Q } from "./aria-
|
|
4
|
+
import { r as J, h as Q } from "./aria-CeA9QfD1.js";
|
|
5
5
|
const W = 3, Y = 10, q = 4;
|
|
6
6
|
function ee(a) {
|
|
7
7
|
return Number.isFinite(a) ? Math.min(
|
package/dist/Popover.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),Oe=require("./aria-Bntn6ad_.cjs"),qe=require("./effects-D85L_7zM.cjs"),M=require("./reference-C2guRuR0.cjs"),b=require("./usePresence-B5RYv4e1.cjs"),we=require("./useFloatingPosition-GzkP9dCc.cjs"),De=require("./useFocusTrap-BrFZdMqQ.cjs"),Fe=require("./Surface-BttJYSDt.cjs");function je(o){const{inert:i,panelElement:c}=o;return qe.useIsomorphicLayoutEffect(()=>{c&&(c.inert=i)},[i,c]),null}function Le(o,i,c){i.current=o,M.assignElementReference(c,o)}function Ne(o,i,c){i.current=o,M.assignElementReference(c,o)}function _e(o){const i=o.tagName.toLowerCase();return o.getAttribute("role")==="button"&&i!=="button"?!1:["button","input","select","summary","textarea"].includes(i)?!0:i==="a"&&o.hasAttribute("href")}function Be(o){return o==="grid"||o==="listbox"||o==="menu"||o==="tree"?o:"dialog"}const Me=t.forwardRef(function(i,c){const{"aria-label":K,"aria-labelledby":re,autoFocus:D=!0,children:ne,className:se,closeOnEscape:oe=!0,closeOnOutsideInteraction:ae=!0,defaultOpen:ie=!1,disabled:x=!1,initialFocusReference:E,onEscapeKeyDown:ce,onOpenChange:k,onPointerDownOutside:I,open:z,placement:A="bottom",restoreFocus:F=!0,role:H="dialog",style:V,tabIndex:ue,trapFocus:v=!1,trigger:d,...le}=i;if(d.type===t.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const $=t.useId(),de=t.useContext(b.FocusScopeContext),U=`${$}-popover`,s=d.props,G=M.getElementReference(d),J=s.id??`${$}-trigger`,P=x||s.disabled===!0||s["aria-disabled"]===!0||s["aria-disabled"]==="true",R=z!==void 0,[fe,pe]=t.useState(ie),r=R?z:fe,C=b.usePresence(r),Q=t.useRef(null),W=t.useRef(null),j=t.useRef("programmatic"),L=t.useRef(null),X=t.useRef(r),T=t.useRef(null),[ge,me]=t.useReducer(e=>e+1,0),[u,be]=t.useState(null),[f,ve]=t.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),S=b.useBoundary("Popover").boundaryElement,O=b.useOverlayLayer(C.present,S),ye=t.useMemo(()=>[Q,W],[]),p=we.useFloatingPosition(C.present,A,u,f,S),he=t.useCallback(e=>{Ne(e,Q,G),be(e)},[G]),Ee=t.useCallback(e=>{Le(e,W,c),ve(e)},[c]),g=t.useCallback((e,n)=>{r!==e&&(R?(L.current={open:e,reason:n},me()):(j.current=n,pe(e)),k==null||k(e,n))},[R,k,r]),Pe=t.useCallback(()=>{g(!1,"escape")},[g]),Re=t.useCallback(()=>{g(!1,"outside")},[g]),Te=t.useCallback(e=>{var m;if(I==null||I(e),e.defaultPrevented)return;const n=(m=a==null?void 0:a.defaultView)==null?void 0:m.HTMLElement;n?T.current=e.composedPath().find(h=>h instanceof n&&h.tabIndex>=0)??e.target:T.current=e.target},[I,a]);b.useDismissableLayer({boundary:S,active:r,boundaries:ye,dismissOnEscape:oe,dismissOnPointerDownOutside:ae,layerId:O.id,onEscapeDismiss:Pe,onEscapeKeyDown:ce,onPointerDownOutside:Te,onPointerDownOutsideDismiss:Re,ownerDocument:a});const xe=De.useFocusTrap({boundary:S,active:r&&v,autoFocus:D,container:f,initialFocusReference:E,layerId:O.id,restoreFocus:F});t.useEffect(()=>{if(!r||v||!D||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const n=E==null?void 0:E.current;(n&&f.contains(n)?n:f).focus({preventScroll:!0})}),()=>{e=!1}},[D,E,r,f,v]),t.useEffect(()=>{var te;const e=X.current;X.current=r;const n=L.current;let m=j.current;if(R&&(m="programmatic",e!==r&&(n==null?void 0:n.open)===r&&(m=n.reason)),L.current=null,r){j.current="programmatic",T.current=null;return}const h=a==null?void 0:a.activeElement,_=T.current,B=(te=a==null?void 0:a.defaultView)==null?void 0:te.HTMLElement,Se=m==="outside"&&B&&_ instanceof B&&h instanceof B&&(_===h||_.contains(h));e&&!v&&F&&!Se&&(u==null||u.focus({preventScroll:!0})),T.current=null},[ge,R,r,a,F,v,u]),t.useEffect(()=>{x&&r&&g(!1,"programmatic")},[x,r,g]);function ke(e){var n;if(P){e.preventDefault(),e.stopPropagation();return}(n=s.onClick)==null||n.call(s,e),!e.defaultPrevented&&g(!r,"trigger")}function Ie(e){var n;(n=s.onKeyDown)==null||n.call(s,e),!(e.defaultPrevented||P||_e(e.currentTarget)||e.key!=="Enter"&&e.key!==" ")&&(e.preventDefault(),e.currentTarget.click())}if(x)return d;const N=typeof d.type=="string",y=N?d.type:null,Y=y==="a"&&typeof s.href=="string",Z=N&&!(y==="button"||y==="input"||y==="select"||y==="summary"||y==="textarea"||Y),ee=Y&&P;let q=s.role;q===void 0&&(ee?q="link":Z&&(q="button"));let w=s.tabIndex;w===void 0&&Z&&(w=0),P&&(w=-1);const Ce=t.cloneElement(d,{"aria-controls":r?Oe.mergeIdentifiers(s["aria-controls"],U):s["aria-controls"],"aria-expanded":r,"aria-haspopup":s["aria-haspopup"]??Be(H),"aria-disabled":P?!0:s["aria-disabled"],className:[s.className,"nk-popover__trigger"].filter(Boolean).join(" "),href:ee?void 0:s.href,id:J,onClick:ke,onKeyDown:N?Ie:s.onKeyDown,ref:he,role:q,tabIndex:w});return l.jsxs(l.Fragment,{children:[Ce,l.jsx(b.FocusScopeContext.Provider,{value:r&&v?xe:de,children:C.present&&a?l.jsx(b.Portal,{children:l.jsxs(Fe.Surface,{...le,ref:Ee,"aria-hidden":r?void 0:!0,"aria-label":r?K:void 0,"aria-labelledby":r?re??(K===void 0?J:void 0):void 0,className:["nk-popover",se].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??A,"data-state":C.state==="closing"?"closing":"open",id:U,role:r?H:void 0,style:p?{...V,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:O.zIndex}:{...V,visibility:"hidden",zIndex:O.zIndex},tabIndex:ue??-1,children:[l.jsx(je,{inert:!r,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:ne})]})}):null})]})});exports.default=Me;
|