neatkit 0.4.2 → 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-BP2ZCmUf.js +7446 -0
- 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 +31 -0
- package/dist/Markdown.js +18411 -0
- 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/Button.d.ts +2 -2
- 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/Code.d.ts +47 -0
- package/dist/components/Code/index.d.ts +2 -0
- package/dist/components/Code/utils/highlight.d.ts +17 -0
- package/dist/components/Content/Content.d.ts +3 -3
- package/dist/components/Content/index.d.ts +2 -2
- 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/Markdown.d.ts +66 -0
- package/dist/components/Markdown/index.d.ts +3 -0
- package/dist/components/Markdown/utils/language.d.ts +9 -0
- package/dist/components/Markdown/utils/renderers.d.ts +15 -0
- package/dist/components/Markdown/utils/security.d.ts +66 -0
- 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/Table.d.ts +7 -11
- 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 +1 -26
- package/dist/index.js +6 -4409
- package/dist/reference-C2guRuR0.cjs +1 -0
- package/dist/reference-CXMr27nM.js +12 -0
- package/dist/style.css +1 -1
- package/dist/tokens.d.ts +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 +155 -2
package/dist/Radio.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),i=require("react"),v=require("./RadioGroupContext-BX9KnDek.cjs"),R=require("./Text-DWYlIcPj.cjs");function C(){const e=i.useContext(v.RadioGroupContext);if(!e)throw new Error("Radio must be rendered within RadioGroup");return e}function m(e,r,t){r.current=e,typeof t=="function"?t(e):t&&(t.current=e)}const _=i.forwardRef(function(r,t){const{children:d,className:f,disabled:p=!1,style:b,value:l,...h}=r,n=C(),c=i.useRef(null),a=n.disabled||p,s=n.value!==void 0,x=n.value===l,k=i.useCallback(o=>m(o,c,t),[t]);return i.useEffect(()=>{var o;!s&&a&&((o=c.current)!=null&&o.checked)&&(c.current.checked=!1)},[s,a]),u.jsxs("label",{className:["nk-radio",f].filter(Boolean).join(" "),"data-disabled":a||void 0,style:b,children:[u.jsx("input",{...h,ref:k,checked:s?!a&&x:void 0,className:"nk-radio__control",defaultChecked:s?void 0:!a&&n.defaultValue===l,disabled:a,name:n.name,onChange:n.onChange,required:n.required,type:"radio",value:l}),u.jsx("span",{"aria-hidden":"true",className:"nk-radio__visual"}),u.jsx(R.Text,{as:"span",className:"nk-radio__label",children:d})]})});exports.default=_;
|
package/dist/Radio.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as k, jsx as u } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as R, forwardRef as v, useRef as C, useCallback as x, useEffect as _ } from "react";
|
|
4
|
+
import { R as N } from "./RadioGroupContext-DbKM4zPZ.js";
|
|
5
|
+
import { T as g } from "./Text-rN6iDo0V.js";
|
|
6
|
+
function j() {
|
|
7
|
+
const e = R(N);
|
|
8
|
+
if (!e)
|
|
9
|
+
throw new Error("Radio must be rendered within RadioGroup");
|
|
10
|
+
return e;
|
|
11
|
+
}
|
|
12
|
+
function y(e, t, a) {
|
|
13
|
+
t.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
|
|
14
|
+
}
|
|
15
|
+
const V = v(function(t, a) {
|
|
16
|
+
const {
|
|
17
|
+
children: c,
|
|
18
|
+
className: d,
|
|
19
|
+
disabled: f = !1,
|
|
20
|
+
style: p,
|
|
21
|
+
value: r,
|
|
22
|
+
...m
|
|
23
|
+
} = t, o = j(), l = C(null), i = o.disabled || f, n = o.value !== void 0, h = o.value === r, b = x(
|
|
24
|
+
(s) => y(
|
|
25
|
+
s,
|
|
26
|
+
l,
|
|
27
|
+
a
|
|
28
|
+
),
|
|
29
|
+
[a]
|
|
30
|
+
);
|
|
31
|
+
return _(() => {
|
|
32
|
+
var s;
|
|
33
|
+
!n && i && ((s = l.current) != null && s.checked) && (l.current.checked = !1);
|
|
34
|
+
}, [n, i]), /* @__PURE__ */ k(
|
|
35
|
+
"label",
|
|
36
|
+
{
|
|
37
|
+
className: ["nk-radio", d].filter(Boolean).join(" "),
|
|
38
|
+
"data-disabled": i || void 0,
|
|
39
|
+
style: p,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ u(
|
|
42
|
+
"input",
|
|
43
|
+
{
|
|
44
|
+
...m,
|
|
45
|
+
ref: b,
|
|
46
|
+
checked: n ? !i && h : void 0,
|
|
47
|
+
className: "nk-radio__control",
|
|
48
|
+
defaultChecked: n ? void 0 : !i && o.defaultValue === r,
|
|
49
|
+
disabled: i,
|
|
50
|
+
name: o.name,
|
|
51
|
+
onChange: o.onChange,
|
|
52
|
+
required: o.required,
|
|
53
|
+
type: "radio",
|
|
54
|
+
value: r
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ u("span", { "aria-hidden": "true", className: "nk-radio__visual" }),
|
|
58
|
+
/* @__PURE__ */ u(g, { as: "span", className: "nk-radio__label", children: c })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
export {
|
|
64
|
+
V as default
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),R=require("react"),t=require("./aria-DKxpE8cA.cjs"),b=require("./field-control-NfLwcPj6.cjs"),j=require("./RadioGroupContext-BX9KnDek.cjs"),n=R.forwardRef(function(d,l){const{"aria-invalid":a,children:s,className:u,defaultValue:c,disabled:e=!1,invalid:i=!1,name:v,onChange:f,orientation:p="vertical",required:r=!1,value:m,...q}=d,g=i||t.hasInvalidState(a),x={defaultValue:c,disabled:e,name:v,onChange:f,required:r,value:m};return o.jsx(j.RadioGroupContext.Provider,{value:x,children:o.jsx("div",{...q,ref:l,"aria-disabled":e||void 0,"aria-invalid":t.resolveAriaInvalid(i,a),"aria-required":r||void 0,className:["nk-radio-group",u].filter(Boolean).join(" "),"data-disabled":e||void 0,"data-invalid":g||void 0,"data-orientation":p,role:"radiogroup",children:s})})});b.markFieldGroupControl(n,"group");exports.default=n;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as R } from "react";
|
|
4
|
+
import { r as g, h as x } from "./aria-DHnOMyYp.js";
|
|
5
|
+
import { m as G } from "./field-control-XAn_FKks.js";
|
|
6
|
+
import { R as I } from "./RadioGroupContext-DbKM4zPZ.js";
|
|
7
|
+
const b = R(
|
|
8
|
+
function(d, l) {
|
|
9
|
+
const {
|
|
10
|
+
"aria-invalid": i,
|
|
11
|
+
children: n,
|
|
12
|
+
className: t,
|
|
13
|
+
defaultValue: s,
|
|
14
|
+
disabled: a = !1,
|
|
15
|
+
invalid: o = !1,
|
|
16
|
+
name: u,
|
|
17
|
+
onChange: v,
|
|
18
|
+
orientation: m = "vertical",
|
|
19
|
+
required: r = !1,
|
|
20
|
+
value: f,
|
|
21
|
+
...p
|
|
22
|
+
} = d, c = o || x(i), h = {
|
|
23
|
+
defaultValue: s,
|
|
24
|
+
disabled: a,
|
|
25
|
+
name: u,
|
|
26
|
+
onChange: v,
|
|
27
|
+
required: r,
|
|
28
|
+
value: f
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ e(I.Provider, { value: h, children: /* @__PURE__ */ e(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
...p,
|
|
34
|
+
ref: l,
|
|
35
|
+
"aria-disabled": a || void 0,
|
|
36
|
+
"aria-invalid": g(o, i),
|
|
37
|
+
"aria-required": r || void 0,
|
|
38
|
+
className: ["nk-radio-group", t].filter(Boolean).join(" "),
|
|
39
|
+
"data-disabled": a || void 0,
|
|
40
|
+
"data-invalid": c || void 0,
|
|
41
|
+
"data-orientation": m,
|
|
42
|
+
role: "radiogroup",
|
|
43
|
+
children: n
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
G(b, "group");
|
|
49
|
+
export {
|
|
50
|
+
b as default
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react"),o=t.createContext(void 0);exports.RadioGroupContext=o;
|
package/dist/Select.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"),i=require("react"),G=require("./aria-DKxpE8cA.cjs"),K=require("./Icon-D8IZceys.cjs"),J=require("./usePresence-qe92UTvK.cjs");function ee(a,n,s){if(a.length===0)return-1;for(let c=1;c<=a.length;c+=1){const v=(n+s*c+a.length)%a.length;if(!a[v].disabled)return v}return-1}function xe(a,n,s){for(let c=1;c<=a.length;c+=1){const v=(s+c+a.length)%a.length,d=a[v];if(!d.disabled&&d.label.toLocaleLowerCase().startsWith(n))return v}return-1}function we(a){const n=new Set;a.forEach(s=>{if(n.has(s.value))throw new Error("Select option values must be unique");n.add(s.value)})}function Ie(a,n,s){n.current=a,typeof s=="function"?s(a):s&&(s.current=a)}function ke(a){const{"aria-invalid":n,children:s,className:c,defaultValue:v,disabled:d=!1,forwardedReference:o,invalid:p=!1,placeholder:x,style:f,value:h,...b}=a,k=G.resolveAriaInvalid(p,n),w=p||G.hasInvalidState(n);return l.jsxs("span",{className:["nk-select",c].filter(Boolean).join(" "),"data-disabled":d||void 0,"data-invalid":w||void 0,"data-mode":"native",style:f,children:[l.jsxs("select",{...b,ref:o,"aria-invalid":k,className:"nk-select__control",defaultValue:h===void 0?v??(x!==void 0?"":void 0):void 0,disabled:d,value:h,children:[x!==void 0?l.jsx("option",{disabled:!0,value:"",children:x}):null,s]}),l.jsx(K.Icon,{className:"nk-select__icon",type:"chevron-down"})]})}function De(a,n,s){const[c,v]=i.useState(null);return i.useEffect(()=>{if(!a||!n){v(null);return}const d=n.ownerDocument.defaultView;if(!d)return;const o=d;function p(){const h=n==null?void 0:n.getBoundingClientRect();if(!h)return;const b=8,k=4,w=o.innerHeight-h.bottom-k-b,E=h.top-k-b,j=w<160&&E>w,D=Math.max(72,j?E:w),y=s==null?void 0:s.getBoundingClientRect(),L=Math.max(h.width,(y==null?void 0:y.width)??h.width),r=Math.min(Math.max(b,h.left),Math.max(b,o.innerWidth-b-L)),R=j?Math.max(b,h.top-k-Math.min((y==null?void 0:y.height)??D,D)):h.bottom+k;v({left:r,maxHeight:D,minWidth:h.width,top:R})}p(),o.addEventListener("resize",p),o.addEventListener("scroll",p,!0);const x=o.ResizeObserver,f=x?new x(p):null;return f==null||f.observe(n),s&&(f==null||f.observe(s)),()=>{o.removeEventListener("resize",p),o.removeEventListener("scroll",p,!0),f==null||f.disconnect()}},[a,s,n]),c}function je(a){const{active:n,closeOnEscape:s,closeOnOutsideInteraction:c,highlightedIndex:v,id:d,listboxReference:o,onEscapeDismiss:p,onEscapeKeyDown:x,onHighlight:f,onOutsideDismiss:h,onPointerDownOutside:b,onSelect:k,options:w,ownerDocument:E,position:j,selectedValue:D,state:y,triggerReference:L}=a,r=i.useRef(null),R=J.useOverlayLayer(!0,E),N=i.useMemo(()=>[L,r],[L]),T=i.useCallback(u=>{r.current=u,o(u)},[o]);return J.useDismissableLayer({active:n,boundaries:N,dismissOnEscape:s,dismissOnPointerDownOutside:c,layerId:R.id,onEscapeDismiss:p,onEscapeKeyDown:x,onPointerDownOutside:b,onPointerDownOutsideDismiss:h,ownerDocument:E}),l.jsx("div",{"aria-hidden":n?void 0:!0,"aria-labelledby":d,className:"nk-select__listbox","data-state":y,id:`${d}-listbox`,ref:T,role:"listbox",style:j?{left:j.left,maxHeight:j.maxHeight,minWidth:j.minWidth,top:j.top,zIndex:R.zIndex}:{visibility:"hidden",zIndex:R.zIndex},children:w.map((u,P)=>l.jsxs("div",{"aria-disabled":u.disabled||void 0,"aria-selected":u.value===D,className:"nk-select__option","data-highlighted":P===v||void 0,"data-selected":u.value===D||void 0,id:`${d}-option-${P}`,onPointerDown:B=>{B.preventDefault(),u.disabled||k(u)},onPointerMove:()=>{u.disabled||f(P)},role:"option",children:[u.icon?l.jsx(K.Icon,{type:u.icon}):null,l.jsx("span",{className:"nk-select__option-label",children:u.label}),u.value===D?l.jsx(K.Icon,{className:"nk-select__check",type:"checkmark"}):null]},u.value))})}function _e(a){var ae;const{"aria-invalid":n,className:s,closeOnEscape:c=!0,closeOnOutsideInteraction:v=!0,defaultValue:d="",disabled:o=!1,displayOverride:p,form:x,forwardedReference:f,id:h,invalid:b=!1,name:k,onChange:w,onClick:E,onEscapeKeyDown:j,onKeyDown:D,onOpenChange:y,onPointerDownOutside:L,options:r,placeholder:R,portalContainer:N,required:T=!1,style:u,value:P,width:B,...ie}=a;we(r);const le=i.useId(),M=h??le,_=i.useRef(null),te=i.useRef(null),V=i.useRef(null),z=i.useRef(""),[W,oe]=i.useState(null),[m,re]=i.useState(!1),[O,q]=i.useState(-1),[ce,ne]=i.useState(d),A=P!==void 0,C=A?P:ce,de=r.find(e=>e.value===C),ue=b||G.hasInvalidState(n),fe=G.resolveAriaInvalid(b,n),X=J.usePresence(m),$=(N==null?void 0:N.ownerDocument)??((ae=_.current)==null?void 0:ae.ownerDocument)??(typeof document>"u"?null:document),he=De(X.present,_.current,W),me=B===void 0?u:{...u,width:B},F=p??de,ve=i.useCallback(e=>{Ie(e,_,f)},[f]),g=i.useCallback(e=>{m!==e&&(re(e),y==null||y(e))},[y,m]),Q=i.useCallback((e=1)=>{const t=r.findIndex(S=>S.value===C&&!S.disabled),I=e===1?-1:r.length;q(t>=0?t:ee(r,I,e)),g(!0)},[r,C,g]),se=i.useCallback(e=>{var t;e.disabled||(A||ne(e.value),g(!1),(t=_.current)==null||t.focus(),w==null||w(e.value))},[A,w,g]),pe=i.useCallback(()=>{var e;g(!1),(e=_.current)==null||e.focus()},[g]),be=i.useCallback(()=>{g(!1)},[g]);function ye(e){E==null||E(e),!(e.defaultPrevented||o)&&(m?g(!1):Q())}function ge(e){if(D==null||D(e),!(e.defaultPrevented||o)){if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const t=e.key==="ArrowDown"?1:-1;m?q(I=>ee(r,I,t)):Q(t);return}if(e.key==="Home"||e.key==="End"){if(e.preventDefault(),!m)Q(e.key==="Home"?1:-1);else{const t=e.key==="Home"?1:-1,I=t===1?-1:r.length;q(ee(r,I,t))}return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const t=r[O];m&&t?se(t):m||Q();return}if(e.key==="Tab"){g(!1);return}if(e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey){const t=e.currentTarget.ownerDocument.defaultView;if(!t)return;const I=e.key.toLocaleLowerCase(),S=z.current+I,Y=Array.from(S).every(Z=>Z===I);z.current=Y?I:S,V.current!==null&&t.clearTimeout(V.current),V.current=t.setTimeout(()=>{z.current="",V.current=null},500);const H=xe(r,z.current,O);H>=0&&(e.preventDefault(),m||g(!0),q(H))}}}return i.useEffect(()=>{var e;if(m&&O>=0){const t=$==null?void 0:$.getElementById(`${M}-option-${O}`);t&&(W!=null&&W.contains(t))&&((e=t.scrollIntoView)==null||e.call(t,{block:"nearest"}))}},[O,M,W,m]),i.useEffect(()=>{var I;const e=(I=_.current)==null?void 0:I.form;if(!e)return;function t(){const S=te.current,Y=A?C:d;if(S){const H=Array.from(S.options),Z=H.find(U=>U.value===Y)??H[0];H.forEach(U=>{U.defaultSelected=U===Z})}A||ne(d),g(!1)}return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)},[d,x,A,C,g]),i.useEffect(()=>()=>{var t;const e=(t=_.current)==null?void 0:t.ownerDocument.defaultView;e&&V.current!==null&&e.clearTimeout(V.current)},[]),l.jsxs("span",{className:["nk-select",s].filter(Boolean).join(" "),"data-disabled":o||void 0,"data-invalid":ue||void 0,"data-mode":"custom","data-open":m||void 0,style:me,children:[l.jsxs("button",{...ie,ref:ve,"aria-activedescendant":m&&O>=0?`${M}-option-${O}`:void 0,"aria-controls":`${M}-listbox`,"aria-expanded":m,"aria-haspopup":"listbox","aria-invalid":fe,"aria-required":T||void 0,"aria-autocomplete":"none",className:"nk-select__trigger",disabled:o,form:x,id:M,onClick:ye,onKeyDown:ge,role:"combobox",type:"button",children:[F?l.jsxs("span",{className:"nk-select__value",children:[F.icon?l.jsx(K.Icon,{type:F.icon}):null,l.jsx("span",{className:"nk-select__value-label",children:F.label})]}):l.jsx("span",{className:"nk-select__placeholder",children:R}),l.jsx(K.Icon,{className:"nk-select__icon",type:"chevron-down"})]}),k||T?l.jsxs("select",{ref:te,"aria-hidden":"true",className:"nk-select__form-control",disabled:o,form:x,name:k,onChange:()=>{},onInvalid:e=>{var t;e.preventDefault(),(t=_.current)==null||t.focus()},required:T,tabIndex:-1,value:C,children:[l.jsx("option",{value:""}),r.map(e=>l.jsx("option",{disabled:e.disabled,value:e.value,children:e.label},e.value))]}):null,X.present&&$?l.jsx(J.Portal,{container:N,inheritFrom:_.current,children:l.jsx(je,{active:m,closeOnEscape:c,closeOnOutsideInteraction:v,highlightedIndex:O,id:M,listboxReference:oe,onEscapeDismiss:pe,onEscapeKeyDown:j,onHighlight:q,onOutsideDismiss:be,onPointerDownOutside:L,onSelect:se,options:r,ownerDocument:$,position:he,selectedValue:C,state:X.state==="closing"?"closing":"open",triggerReference:_})}):null]})}const Ee=i.forwardRef(function(n,s){const{options:c}=n;return c!==void 0?l.jsx(_e,{...n,forwardedReference:s}):l.jsx(ke,{...n,forwardedReference:s})});exports.default=Ee;
|
package/dist/Select.js
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as f, jsxs as R } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as De, useId as _e, useRef as q, useState as z, useCallback as S, useEffect as Y, useMemo as Ee } from "react";
|
|
4
|
+
import { h as le, r as re } from "./aria-DHnOMyYp.js";
|
|
5
|
+
import { q as F } from "./Icon-uQmpr5P2.js";
|
|
6
|
+
import { a as Oe, P as Le, b as Ne, c as Pe } from "./usePresence-DSPt6aKi.js";
|
|
7
|
+
function te(a, t, i) {
|
|
8
|
+
if (a.length === 0) return -1;
|
|
9
|
+
for (let l = 1; l <= a.length; l += 1) {
|
|
10
|
+
const h = (t + i * l + a.length) % a.length;
|
|
11
|
+
if (!a[h].disabled) return h;
|
|
12
|
+
}
|
|
13
|
+
return -1;
|
|
14
|
+
}
|
|
15
|
+
function Se(a, t, i) {
|
|
16
|
+
for (let l = 1; l <= a.length; l += 1) {
|
|
17
|
+
const h = (i + l + a.length) % a.length, r = a[h];
|
|
18
|
+
if (!r.disabled && r.label.toLocaleLowerCase().startsWith(t))
|
|
19
|
+
return h;
|
|
20
|
+
}
|
|
21
|
+
return -1;
|
|
22
|
+
}
|
|
23
|
+
function Re(a) {
|
|
24
|
+
const t = /* @__PURE__ */ new Set();
|
|
25
|
+
a.forEach((i) => {
|
|
26
|
+
if (t.has(i.value))
|
|
27
|
+
throw new Error("Select option values must be unique");
|
|
28
|
+
t.add(i.value);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function Ve(a, t, i) {
|
|
32
|
+
t.current = a, typeof i == "function" ? i(a) : i && (i.current = a);
|
|
33
|
+
}
|
|
34
|
+
function Ce(a) {
|
|
35
|
+
const {
|
|
36
|
+
"aria-invalid": t,
|
|
37
|
+
children: i,
|
|
38
|
+
className: l,
|
|
39
|
+
defaultValue: h,
|
|
40
|
+
disabled: r = !1,
|
|
41
|
+
forwardedReference: s,
|
|
42
|
+
invalid: v = !1,
|
|
43
|
+
placeholder: b,
|
|
44
|
+
style: d,
|
|
45
|
+
value: u,
|
|
46
|
+
...p
|
|
47
|
+
} = a, k = re(v, t), w = v || le(t);
|
|
48
|
+
return /* @__PURE__ */ R(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
className: ["nk-select", l].filter(Boolean).join(" "),
|
|
52
|
+
"data-disabled": r || void 0,
|
|
53
|
+
"data-invalid": w || void 0,
|
|
54
|
+
"data-mode": "native",
|
|
55
|
+
style: d,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ R(
|
|
58
|
+
"select",
|
|
59
|
+
{
|
|
60
|
+
...p,
|
|
61
|
+
ref: s,
|
|
62
|
+
"aria-invalid": k,
|
|
63
|
+
className: "nk-select__control",
|
|
64
|
+
defaultValue: u === void 0 ? h ?? (b !== void 0 ? "" : void 0) : void 0,
|
|
65
|
+
disabled: r,
|
|
66
|
+
value: u,
|
|
67
|
+
children: [
|
|
68
|
+
b !== void 0 ? /* @__PURE__ */ f("option", { disabled: !0, value: "", children: b }) : null,
|
|
69
|
+
i
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ f(F, { className: "nk-select__icon", type: "chevron-down" })
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function He(a, t, i) {
|
|
79
|
+
const [l, h] = z(null);
|
|
80
|
+
return Y(() => {
|
|
81
|
+
if (!a || !t) {
|
|
82
|
+
h(null);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const r = t.ownerDocument.defaultView;
|
|
86
|
+
if (!r) return;
|
|
87
|
+
const s = r;
|
|
88
|
+
function v() {
|
|
89
|
+
const u = t == null ? void 0 : t.getBoundingClientRect();
|
|
90
|
+
if (!u) return;
|
|
91
|
+
const p = 8, k = 4, w = s.innerHeight - u.bottom - k - p, E = u.top - k - p, D = w < 160 && E > w, x = Math.max(
|
|
92
|
+
72,
|
|
93
|
+
D ? E : w
|
|
94
|
+
), y = i == null ? void 0 : i.getBoundingClientRect(), V = Math.max(
|
|
95
|
+
u.width,
|
|
96
|
+
(y == null ? void 0 : y.width) ?? u.width
|
|
97
|
+
), o = Math.min(
|
|
98
|
+
Math.max(p, u.left),
|
|
99
|
+
Math.max(
|
|
100
|
+
p,
|
|
101
|
+
s.innerWidth - p - V
|
|
102
|
+
)
|
|
103
|
+
), N = D ? Math.max(
|
|
104
|
+
p,
|
|
105
|
+
u.top - k - Math.min(
|
|
106
|
+
(y == null ? void 0 : y.height) ?? x,
|
|
107
|
+
x
|
|
108
|
+
)
|
|
109
|
+
) : u.bottom + k;
|
|
110
|
+
h({
|
|
111
|
+
left: o,
|
|
112
|
+
maxHeight: x,
|
|
113
|
+
minWidth: u.width,
|
|
114
|
+
top: N
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
v(), s.addEventListener("resize", v), s.addEventListener("scroll", v, !0);
|
|
118
|
+
const b = s.ResizeObserver, d = b ? new b(v) : null;
|
|
119
|
+
return d == null || d.observe(t), i && (d == null || d.observe(i)), () => {
|
|
120
|
+
s.removeEventListener("resize", v), s.removeEventListener("scroll", v, !0), d == null || d.disconnect();
|
|
121
|
+
};
|
|
122
|
+
}, [a, i, t]), l;
|
|
123
|
+
}
|
|
124
|
+
function Me(a) {
|
|
125
|
+
const {
|
|
126
|
+
active: t,
|
|
127
|
+
closeOnEscape: i,
|
|
128
|
+
closeOnOutsideInteraction: l,
|
|
129
|
+
highlightedIndex: h,
|
|
130
|
+
id: r,
|
|
131
|
+
listboxReference: s,
|
|
132
|
+
onEscapeDismiss: v,
|
|
133
|
+
onEscapeKeyDown: b,
|
|
134
|
+
onHighlight: d,
|
|
135
|
+
onOutsideDismiss: u,
|
|
136
|
+
onPointerDownOutside: p,
|
|
137
|
+
onSelect: k,
|
|
138
|
+
options: w,
|
|
139
|
+
ownerDocument: E,
|
|
140
|
+
position: D,
|
|
141
|
+
selectedValue: x,
|
|
142
|
+
state: y,
|
|
143
|
+
triggerReference: V
|
|
144
|
+
} = a, o = q(null), N = Ne(!0, E), C = Ee(
|
|
145
|
+
() => [V, o],
|
|
146
|
+
[V]
|
|
147
|
+
), $ = S(
|
|
148
|
+
(c) => {
|
|
149
|
+
o.current = c, s(c);
|
|
150
|
+
},
|
|
151
|
+
[s]
|
|
152
|
+
);
|
|
153
|
+
return Pe({
|
|
154
|
+
active: t,
|
|
155
|
+
boundaries: C,
|
|
156
|
+
dismissOnEscape: i,
|
|
157
|
+
dismissOnPointerDownOutside: l,
|
|
158
|
+
layerId: N.id,
|
|
159
|
+
onEscapeDismiss: v,
|
|
160
|
+
onEscapeKeyDown: b,
|
|
161
|
+
onPointerDownOutside: p,
|
|
162
|
+
onPointerDownOutsideDismiss: u,
|
|
163
|
+
ownerDocument: E
|
|
164
|
+
}), /* @__PURE__ */ f(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
"aria-hidden": t ? void 0 : !0,
|
|
168
|
+
"aria-labelledby": r,
|
|
169
|
+
className: "nk-select__listbox",
|
|
170
|
+
"data-state": y,
|
|
171
|
+
id: `${r}-listbox`,
|
|
172
|
+
ref: $,
|
|
173
|
+
role: "listbox",
|
|
174
|
+
style: D ? {
|
|
175
|
+
left: D.left,
|
|
176
|
+
maxHeight: D.maxHeight,
|
|
177
|
+
minWidth: D.minWidth,
|
|
178
|
+
top: D.top,
|
|
179
|
+
zIndex: N.zIndex
|
|
180
|
+
} : { visibility: "hidden", zIndex: N.zIndex },
|
|
181
|
+
children: w.map((c, H) => /* @__PURE__ */ R(
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
"aria-disabled": c.disabled || void 0,
|
|
185
|
+
"aria-selected": c.value === x,
|
|
186
|
+
className: "nk-select__option",
|
|
187
|
+
"data-highlighted": H === h || void 0,
|
|
188
|
+
"data-selected": c.value === x || void 0,
|
|
189
|
+
id: `${r}-option-${H}`,
|
|
190
|
+
onPointerDown: (Q) => {
|
|
191
|
+
Q.preventDefault(), c.disabled || k(c);
|
|
192
|
+
},
|
|
193
|
+
onPointerMove: () => {
|
|
194
|
+
c.disabled || d(H);
|
|
195
|
+
},
|
|
196
|
+
role: "option",
|
|
197
|
+
children: [
|
|
198
|
+
c.icon ? /* @__PURE__ */ f(F, { type: c.icon }) : null,
|
|
199
|
+
/* @__PURE__ */ f("span", { className: "nk-select__option-label", children: c.label }),
|
|
200
|
+
c.value === x ? /* @__PURE__ */ f(F, { className: "nk-select__check", type: "checkmark" }) : null
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
c.value
|
|
204
|
+
))
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function Ae(a) {
|
|
209
|
+
var oe;
|
|
210
|
+
const {
|
|
211
|
+
"aria-invalid": t,
|
|
212
|
+
className: i,
|
|
213
|
+
closeOnEscape: l = !0,
|
|
214
|
+
closeOnOutsideInteraction: h = !0,
|
|
215
|
+
defaultValue: r = "",
|
|
216
|
+
disabled: s = !1,
|
|
217
|
+
displayOverride: v,
|
|
218
|
+
form: b,
|
|
219
|
+
forwardedReference: d,
|
|
220
|
+
id: u,
|
|
221
|
+
invalid: p = !1,
|
|
222
|
+
name: k,
|
|
223
|
+
onChange: w,
|
|
224
|
+
onClick: E,
|
|
225
|
+
onEscapeKeyDown: D,
|
|
226
|
+
onKeyDown: x,
|
|
227
|
+
onOpenChange: y,
|
|
228
|
+
onPointerDownOutside: V,
|
|
229
|
+
options: o,
|
|
230
|
+
placeholder: N,
|
|
231
|
+
portalContainer: C,
|
|
232
|
+
required: $ = !1,
|
|
233
|
+
style: c,
|
|
234
|
+
value: H,
|
|
235
|
+
width: Q,
|
|
236
|
+
...ce
|
|
237
|
+
} = a;
|
|
238
|
+
Re(o);
|
|
239
|
+
const de = _e(), M = u ?? de, _ = q(null), ie = q(null), A = q(null), U = q(""), [K, ue] = z(null), [m, fe] = z(!1), [O, B] = z(-1), [me, ae] = z(r), W = H !== void 0, P = W ? H : me, he = o.find(
|
|
240
|
+
(e) => e.value === P
|
|
241
|
+
), ve = p || le(t), pe = re(p, t), Z = Oe(m), j = (C == null ? void 0 : C.ownerDocument) ?? ((oe = _.current) == null ? void 0 : oe.ownerDocument) ?? (typeof document > "u" ? null : document), ye = He(
|
|
242
|
+
Z.present,
|
|
243
|
+
_.current,
|
|
244
|
+
K
|
|
245
|
+
), ge = Q === void 0 ? c : { ...c, width: Q }, G = v ?? he, be = S(
|
|
246
|
+
(e) => {
|
|
247
|
+
Ve(
|
|
248
|
+
e,
|
|
249
|
+
_,
|
|
250
|
+
d
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
[d]
|
|
254
|
+
), g = S((e) => {
|
|
255
|
+
m !== e && (fe(e), y == null || y(e));
|
|
256
|
+
}, [y, m]), J = S((e = 1) => {
|
|
257
|
+
const n = o.findIndex(
|
|
258
|
+
(L) => L.value === P && !L.disabled
|
|
259
|
+
), I = e === 1 ? -1 : o.length;
|
|
260
|
+
B(
|
|
261
|
+
n >= 0 ? n : te(o, I, e)
|
|
262
|
+
), g(!0);
|
|
263
|
+
}, [o, P, g]), se = S((e) => {
|
|
264
|
+
var n;
|
|
265
|
+
e.disabled || (W || ae(e.value), g(!1), (n = _.current) == null || n.focus(), w == null || w(e.value));
|
|
266
|
+
}, [W, w, g]), we = S(() => {
|
|
267
|
+
var e;
|
|
268
|
+
g(!1), (e = _.current) == null || e.focus();
|
|
269
|
+
}, [g]), Ie = S(() => {
|
|
270
|
+
g(!1);
|
|
271
|
+
}, [g]);
|
|
272
|
+
function ke(e) {
|
|
273
|
+
E == null || E(e), !(e.defaultPrevented || s) && (m ? g(!1) : J());
|
|
274
|
+
}
|
|
275
|
+
function xe(e) {
|
|
276
|
+
if (x == null || x(e), !(e.defaultPrevented || s)) {
|
|
277
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
278
|
+
e.preventDefault();
|
|
279
|
+
const n = e.key === "ArrowDown" ? 1 : -1;
|
|
280
|
+
m ? B(
|
|
281
|
+
(I) => te(o, I, n)
|
|
282
|
+
) : J(n);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (e.key === "Home" || e.key === "End") {
|
|
286
|
+
if (e.preventDefault(), !m) J(e.key === "Home" ? 1 : -1);
|
|
287
|
+
else {
|
|
288
|
+
const n = e.key === "Home" ? 1 : -1, I = n === 1 ? -1 : o.length;
|
|
289
|
+
B(
|
|
290
|
+
te(o, I, n)
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
296
|
+
e.preventDefault();
|
|
297
|
+
const n = o[O];
|
|
298
|
+
m && n ? se(n) : m || J();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (e.key === "Tab") {
|
|
302
|
+
g(!1);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
306
|
+
const n = e.currentTarget.ownerDocument.defaultView;
|
|
307
|
+
if (!n) return;
|
|
308
|
+
const I = e.key.toLocaleLowerCase(), L = U.current + I, ee = Array.from(L).every((ne) => ne === I);
|
|
309
|
+
U.current = ee ? I : L, A.current !== null && n.clearTimeout(A.current), A.current = n.setTimeout(() => {
|
|
310
|
+
U.current = "", A.current = null;
|
|
311
|
+
}, 500);
|
|
312
|
+
const T = Se(
|
|
313
|
+
o,
|
|
314
|
+
U.current,
|
|
315
|
+
O
|
|
316
|
+
);
|
|
317
|
+
T >= 0 && (e.preventDefault(), m || g(!0), B(T));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return Y(() => {
|
|
322
|
+
var e;
|
|
323
|
+
if (m && O >= 0) {
|
|
324
|
+
const n = j == null ? void 0 : j.getElementById(
|
|
325
|
+
`${M}-option-${O}`
|
|
326
|
+
);
|
|
327
|
+
n && (K != null && K.contains(n)) && ((e = n.scrollIntoView) == null || e.call(n, { block: "nearest" }));
|
|
328
|
+
}
|
|
329
|
+
}, [O, M, K, m]), Y(() => {
|
|
330
|
+
var I;
|
|
331
|
+
const e = (I = _.current) == null ? void 0 : I.form;
|
|
332
|
+
if (!e) return;
|
|
333
|
+
function n() {
|
|
334
|
+
const L = ie.current, ee = W ? P : r;
|
|
335
|
+
if (L) {
|
|
336
|
+
const T = Array.from(L.options), ne = T.find(
|
|
337
|
+
(X) => X.value === ee
|
|
338
|
+
) ?? T[0];
|
|
339
|
+
T.forEach((X) => {
|
|
340
|
+
X.defaultSelected = X === ne;
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
W || ae(r), g(!1);
|
|
344
|
+
}
|
|
345
|
+
return e.addEventListener("reset", n), () => e.removeEventListener("reset", n);
|
|
346
|
+
}, [r, b, W, P, g]), Y(() => () => {
|
|
347
|
+
var n;
|
|
348
|
+
const e = (n = _.current) == null ? void 0 : n.ownerDocument.defaultView;
|
|
349
|
+
e && A.current !== null && e.clearTimeout(A.current);
|
|
350
|
+
}, []), /* @__PURE__ */ R(
|
|
351
|
+
"span",
|
|
352
|
+
{
|
|
353
|
+
className: ["nk-select", i].filter(Boolean).join(" "),
|
|
354
|
+
"data-disabled": s || void 0,
|
|
355
|
+
"data-invalid": ve || void 0,
|
|
356
|
+
"data-mode": "custom",
|
|
357
|
+
"data-open": m || void 0,
|
|
358
|
+
style: ge,
|
|
359
|
+
children: [
|
|
360
|
+
/* @__PURE__ */ R(
|
|
361
|
+
"button",
|
|
362
|
+
{
|
|
363
|
+
...ce,
|
|
364
|
+
ref: be,
|
|
365
|
+
"aria-activedescendant": m && O >= 0 ? `${M}-option-${O}` : void 0,
|
|
366
|
+
"aria-controls": `${M}-listbox`,
|
|
367
|
+
"aria-expanded": m,
|
|
368
|
+
"aria-haspopup": "listbox",
|
|
369
|
+
"aria-invalid": pe,
|
|
370
|
+
"aria-required": $ || void 0,
|
|
371
|
+
"aria-autocomplete": "none",
|
|
372
|
+
className: "nk-select__trigger",
|
|
373
|
+
disabled: s,
|
|
374
|
+
form: b,
|
|
375
|
+
id: M,
|
|
376
|
+
onClick: ke,
|
|
377
|
+
onKeyDown: xe,
|
|
378
|
+
role: "combobox",
|
|
379
|
+
type: "button",
|
|
380
|
+
children: [
|
|
381
|
+
G ? /* @__PURE__ */ R("span", { className: "nk-select__value", children: [
|
|
382
|
+
G.icon ? /* @__PURE__ */ f(F, { type: G.icon }) : null,
|
|
383
|
+
/* @__PURE__ */ f("span", { className: "nk-select__value-label", children: G.label })
|
|
384
|
+
] }) : /* @__PURE__ */ f("span", { className: "nk-select__placeholder", children: N }),
|
|
385
|
+
/* @__PURE__ */ f(F, { className: "nk-select__icon", type: "chevron-down" })
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
),
|
|
389
|
+
k || $ ? /* @__PURE__ */ R(
|
|
390
|
+
"select",
|
|
391
|
+
{
|
|
392
|
+
ref: ie,
|
|
393
|
+
"aria-hidden": "true",
|
|
394
|
+
className: "nk-select__form-control",
|
|
395
|
+
disabled: s,
|
|
396
|
+
form: b,
|
|
397
|
+
name: k,
|
|
398
|
+
onChange: () => {
|
|
399
|
+
},
|
|
400
|
+
onInvalid: (e) => {
|
|
401
|
+
var n;
|
|
402
|
+
e.preventDefault(), (n = _.current) == null || n.focus();
|
|
403
|
+
},
|
|
404
|
+
required: $,
|
|
405
|
+
tabIndex: -1,
|
|
406
|
+
value: P,
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ f("option", { value: "" }),
|
|
409
|
+
o.map((e) => /* @__PURE__ */ f(
|
|
410
|
+
"option",
|
|
411
|
+
{
|
|
412
|
+
disabled: e.disabled,
|
|
413
|
+
value: e.value,
|
|
414
|
+
children: e.label
|
|
415
|
+
},
|
|
416
|
+
e.value
|
|
417
|
+
))
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
) : null,
|
|
421
|
+
Z.present && j ? /* @__PURE__ */ f(
|
|
422
|
+
Le,
|
|
423
|
+
{
|
|
424
|
+
container: C,
|
|
425
|
+
inheritFrom: _.current,
|
|
426
|
+
children: /* @__PURE__ */ f(
|
|
427
|
+
Me,
|
|
428
|
+
{
|
|
429
|
+
active: m,
|
|
430
|
+
closeOnEscape: l,
|
|
431
|
+
closeOnOutsideInteraction: h,
|
|
432
|
+
highlightedIndex: O,
|
|
433
|
+
id: M,
|
|
434
|
+
listboxReference: ue,
|
|
435
|
+
onEscapeDismiss: we,
|
|
436
|
+
onEscapeKeyDown: D,
|
|
437
|
+
onHighlight: B,
|
|
438
|
+
onOutsideDismiss: Ie,
|
|
439
|
+
onPointerDownOutside: V,
|
|
440
|
+
onSelect: se,
|
|
441
|
+
options: o,
|
|
442
|
+
ownerDocument: j,
|
|
443
|
+
position: ye,
|
|
444
|
+
selectedValue: P,
|
|
445
|
+
state: Z.state === "closing" ? "closing" : "open",
|
|
446
|
+
triggerReference: _
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
}
|
|
450
|
+
) : null
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
const je = De(function(t, i) {
|
|
456
|
+
const { options: l } = t;
|
|
457
|
+
return l !== void 0 ? /* @__PURE__ */ f(
|
|
458
|
+
Ae,
|
|
459
|
+
{
|
|
460
|
+
...t,
|
|
461
|
+
forwardedReference: i
|
|
462
|
+
}
|
|
463
|
+
) : /* @__PURE__ */ f(
|
|
464
|
+
Ce,
|
|
465
|
+
{
|
|
466
|
+
...t,
|
|
467
|
+
forwardedReference: i
|
|
468
|
+
}
|
|
469
|
+
);
|
|
470
|
+
});
|
|
471
|
+
export {
|
|
472
|
+
je as default
|
|
473
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),c=require("react"),u=c.forwardRef(function(t,r){const{"aria-hidden":a=!0,className:n,height:i="1em",shape:e="rectangle",style:s,width:l=e==="circle"?"1em":"100%",...o}=t;return d.jsx("div",{...o,ref:r,"aria-hidden":a,className:["nk-skeleton",n].filter(Boolean).join(" "),"data-shape":e,style:{...s,width:l,height:i}})});exports.default=u;
|
package/dist/Skeleton.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
const p = m(function(t, a) {
|
|
4
|
+
const {
|
|
5
|
+
"aria-hidden": r = !0,
|
|
6
|
+
className: n,
|
|
7
|
+
height: o = "1em",
|
|
8
|
+
shape: e = "rectangle",
|
|
9
|
+
style: i,
|
|
10
|
+
width: s = e === "circle" ? "1em" : "100%",
|
|
11
|
+
...l
|
|
12
|
+
} = t;
|
|
13
|
+
return /* @__PURE__ */ d(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
...l,
|
|
17
|
+
ref: a,
|
|
18
|
+
"aria-hidden": r,
|
|
19
|
+
className: ["nk-skeleton", n].filter(Boolean).join(" "),
|
|
20
|
+
"data-shape": e,
|
|
21
|
+
style: { ...i, width: s, height: o }
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
p as default
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),l=require("react"),p=l.forwardRef(function(r,i){const{className:s="",color:n,size:e=48,style:t,...o}=r,a=typeof e=="number"?`${e}px`:e;return c.jsx("div",{ref:i,className:["nk-spinner",s].filter(Boolean).join(" "),style:{...t,width:e,height:e,fontSize:a,...n?{color:n}:void 0},role:"status","aria-label":"Loading",...o})});exports.Spinner=p;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p } from "react";
|
|
3
|
+
const d = p(function(o, r) {
|
|
4
|
+
const { className: i = "", color: n, size: e = 48, style: t, ...s } = o, a = typeof e == "number" ? `${e}px` : e;
|
|
5
|
+
return /* @__PURE__ */ l(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
ref: r,
|
|
9
|
+
className: ["nk-spinner", i].filter(Boolean).join(" "),
|
|
10
|
+
style: {
|
|
11
|
+
...t,
|
|
12
|
+
width: e,
|
|
13
|
+
height: e,
|
|
14
|
+
fontSize: a,
|
|
15
|
+
...n ? { color: n } : void 0
|
|
16
|
+
},
|
|
17
|
+
role: "status",
|
|
18
|
+
"aria-label": "Loading",
|
|
19
|
+
...s
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
d as S
|
|
25
|
+
};
|