neatkit 0.9.0 → 0.10.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.
Files changed (67) hide show
  1. package/dist/{Button-DU4j_IED.cjs → Button-CVe9T_Zw.cjs} +1 -1
  2. package/dist/{Button-BV5OUXpc.js → Button-D6rXvcqq.js} +1 -1
  3. package/dist/Button.cjs +1 -1
  4. package/dist/Button.js +1 -1
  5. package/dist/Checkbox.cjs +1 -1
  6. package/dist/Checkbox.js +111 -110
  7. package/dist/Input.cjs +1 -1
  8. package/dist/Input.js +52 -51
  9. package/dist/Markdown.cjs +1 -1
  10. package/dist/Markdown.js +1 -1
  11. package/dist/Modal.cjs +1 -1
  12. package/dist/Modal.js +57 -56
  13. package/dist/PinInput.cjs +1 -1
  14. package/dist/PinInput.js +88 -87
  15. package/dist/Popover.cjs +1 -1
  16. package/dist/Popover.js +2 -2
  17. package/dist/Progress.cjs +1 -0
  18. package/dist/Progress.js +40 -0
  19. package/dist/Radio.cjs +1 -1
  20. package/dist/Radio.js +48 -47
  21. package/dist/Select.cjs +1 -1
  22. package/dist/Select.js +363 -359
  23. package/dist/Sidebar.cjs +1 -1
  24. package/dist/Sidebar.js +44 -44
  25. package/dist/Spinner-BE0F4y2S.cjs +1 -0
  26. package/dist/Spinner-CmxlDlOk.js +23 -0
  27. package/dist/Spinner.cjs +1 -1
  28. package/dist/Spinner.js +1 -1
  29. package/dist/{Table-qetwZpTC.cjs → Table-BqWBgMTU.cjs} +1 -1
  30. package/dist/{Table-CADupJEU.js → Table-DutHfiXR.js} +2 -2
  31. package/dist/Table.cjs +1 -1
  32. package/dist/Table.js +1 -1
  33. package/dist/{Tooltip-B2d5ss7S.cjs → Tooltip-CCuE-hfp.cjs} +1 -1
  34. package/dist/{Tooltip-BK64rkxV.js → Tooltip-CeyRKNv4.js} +1 -1
  35. package/dist/Tooltip.cjs +1 -1
  36. package/dist/Tooltip.js +1 -1
  37. package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +59 -0
  38. package/dist/components/Progress/Progress.d.ts +38 -0
  39. package/dist/components/Progress/index.d.ts +2 -0
  40. package/dist/components/Progress/utils/value.d.ts +25 -0
  41. package/dist/components/Select/Select.d.ts +6 -74
  42. package/dist/components/Select/components/CustomSelect.d.ts +59 -0
  43. package/dist/components/Select/components/NativeSelect.d.ts +26 -0
  44. package/dist/components/Select/components/SelectListbox.d.ts +50 -0
  45. package/dist/components/Select/hooks/useSelectFormReset.d.ts +27 -0
  46. package/dist/components/Select/hooks/useSelectPosition.d.ts +12 -0
  47. package/dist/components/Select/hooks/useTypeahead.d.ts +14 -0
  48. package/dist/components/Select/utils/options.d.ts +38 -0
  49. package/dist/components/Sidebar/Sidebar.d.ts +30 -24
  50. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +3 -4
  51. package/dist/components/Sidebar/components/SidebarPanel.d.ts +2 -2
  52. package/dist/style.css +1 -1
  53. package/dist/useAnchoredPosition-C0VS7hm6.js +105 -0
  54. package/dist/useAnchoredPosition-D7GRFzoX.cjs +1 -0
  55. package/dist/useFloatingPosition-Dq8xpr3E.js +27 -0
  56. package/dist/useFloatingPosition-g5kXywoB.cjs +1 -0
  57. package/dist/useFocusTrap-C0IcCdNf.js +136 -0
  58. package/dist/useFocusTrap-gAK_402D.cjs +1 -0
  59. package/package.json +6 -1
  60. package/dist/Spinner-BXgw60UC.cjs +0 -1
  61. package/dist/Spinner-CVYvk6YK.js +0 -25
  62. package/dist/floating-position-DIjh2wnP.cjs +0 -1
  63. package/dist/floating-position-DvR6e334.js +0 -50
  64. package/dist/useFloatingPosition-B3ZC-v3v.js +0 -43
  65. package/dist/useFloatingPosition-GzkP9dCc.cjs +0 -1
  66. package/dist/useFocusTrap-BrFZdMqQ.cjs +0 -1
  67. package/dist/useFocusTrap-DhVnlboe.js +0 -136
@@ -1,25 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- "use strict";const T={bottom:"top",left:"right",right:"left",top:"bottom"};function x(h,i){const t=Math.min(12,i/2);return Math.min(Math.max(t,h),i-t)}function E(h){return T[h]}function _(h,i){return i==="left"||i==="right"?h.width:h.height}function A(h,i,t){const e=Math.max(h.left,0),o=Math.max(h.top,0),l=Math.min(h.right,i),M=Math.min(h.bottom,t);return l<=e||M<=o?h:{bottom:M,left:e,right:l,top:o}}function F(h,i,t,e,o){const l={bottom:o.bottom-t.bottom-i*2,left:t.left-o.left-i*2,right:o.right-t.right-i*2,top:t.top-o.top-i*2},M=E(h),P=_(e,h),f=l[h]<P&&l[M]>l[h]?M:h;let m=t.left+(t.width-e.width)/2,c=t.top+(t.height-e.height)/2;f==="top"?c=t.top-e.height-i:f==="bottom"?c=t.bottom+i:f==="left"?m=t.left-e.width-i:m=t.right+i;const w=o.left+i,O=o.top+i;m=Math.min(Math.max(w,m),Math.max(w,o.right-i-e.width)),c=Math.min(Math.max(O,c),Math.max(O,o.bottom-i-e.height));let a;return f==="top"||f==="bottom"?a=x(t.left+t.width/2-m,e.width):a=x(t.top+t.height/2-c,e.height),{arrowOffset:a,left:m,placement:f,top:c}}exports.calculateFloatingPosition=F;exports.getVisibleBounds=A;
@@ -1,50 +0,0 @@
1
- const E = {
2
- bottom: "top",
3
- left: "right",
4
- right: "left",
5
- top: "bottom"
6
- };
7
- function x(i, h) {
8
- const t = Math.min(12, h / 2);
9
- return Math.min(Math.max(t, i), h - t);
10
- }
11
- function P(i) {
12
- return E[i];
13
- }
14
- function _(i, h) {
15
- return h === "left" || h === "right" ? i.width : i.height;
16
- }
17
- function p(i, h, t) {
18
- const e = Math.max(i.left, 0), f = Math.max(i.top, 0), o = Math.min(i.right, h), M = Math.min(i.bottom, t);
19
- return o <= e || M <= f ? i : { bottom: M, left: e, right: o, top: f };
20
- }
21
- function F(i, h, t, e, f) {
22
- const o = {
23
- bottom: f.bottom - t.bottom - h * 2,
24
- left: t.left - f.left - h * 2,
25
- right: f.right - t.right - h * 2,
26
- top: t.top - f.top - h * 2
27
- }, M = P(i), T = _(e, i), m = o[i] < T && o[M] > o[i] ? M : i;
28
- let l = t.left + (t.width - e.width) / 2, c = t.top + (t.height - e.height) / 2;
29
- m === "top" ? c = t.top - e.height - h : m === "bottom" ? c = t.bottom + h : m === "left" ? l = t.left - e.width - h : l = t.right + h;
30
- const O = f.left + h, a = f.top + h;
31
- l = Math.min(
32
- Math.max(O, l),
33
- Math.max(O, f.right - h - e.width)
34
- ), c = Math.min(
35
- Math.max(a, c),
36
- Math.max(a, f.bottom - h - e.height)
37
- );
38
- let w;
39
- return m === "top" || m === "bottom" ? w = x(
40
- t.left + t.width / 2 - l,
41
- e.width
42
- ) : w = x(
43
- t.top + t.height / 2 - c,
44
- e.height
45
- ), { arrowOffset: w, left: l, placement: m, top: c };
46
- }
47
- export {
48
- F as c,
49
- p as g
50
- };
@@ -1,43 +0,0 @@
1
- import { useState as v, useEffect as E } from "react";
2
- import { c as S, g as A } from "./floating-position-DvR6e334.js";
3
- const N = 8;
4
- function V(d, r, n, s, c) {
5
- const [m, p] = v(null);
6
- return E(() => {
7
- if (!d || !n || !s || !c) {
8
- p(null);
9
- return;
10
- }
11
- const B = n, L = s, i = c, f = n.ownerDocument.defaultView;
12
- if (!f) return;
13
- const o = f, C = o.getComputedStyle(n), a = Number.parseFloat(
14
- C.getPropertyValue("--nk-space-8")
15
- ), P = Number.isFinite(a) ? a : N;
16
- function e() {
17
- const w = B.getBoundingClientRect(), F = L.getBoundingClientRect(), l = i.getBoundingClientRect(), u = S(
18
- r,
19
- P,
20
- w,
21
- F,
22
- A(
23
- l,
24
- o.innerWidth,
25
- o.innerHeight
26
- )
27
- );
28
- p({
29
- ...u,
30
- left: u.left - l.left - i.clientLeft + i.scrollLeft,
31
- top: u.top - l.top - i.clientTop + i.scrollTop
32
- });
33
- }
34
- e(), o.addEventListener("scroll", e, !0), o.addEventListener("resize", e);
35
- const g = o.ResizeObserver, t = g ? new g(e) : null;
36
- return t == null || t.observe(n), t == null || t.observe(s), t == null || t.observe(c), () => {
37
- o.removeEventListener("scroll", e, !0), o.removeEventListener("resize", e), t == null || t.disconnect();
38
- };
39
- }, [d, c, s, r, n]), m;
40
- }
41
- export {
42
- V as u
43
- };
@@ -1 +0,0 @@
1
- "use strict";const B=require("react"),L=require("./floating-position-DIjh2wnP.cjs"),S=8;function A(d,r,o,s,c){const[P,p]=B.useState(null);return B.useEffect(()=>{if(!d||!o||!s||!c){p(null);return}const C=o,F=s,i=c,a=o.ownerDocument.defaultView;if(!a)return;const n=a,m=n.getComputedStyle(o),f=Number.parseFloat(m.getPropertyValue("--nk-space-8")),w=Number.isFinite(f)?f:S;function e(){const v=C.getBoundingClientRect(),E=F.getBoundingClientRect(),u=i.getBoundingClientRect(),l=L.calculateFloatingPosition(r,w,v,E,L.getVisibleBounds(u,n.innerWidth,n.innerHeight));p({...l,left:l.left-u.left-i.clientLeft+i.scrollLeft,top:l.top-u.top-i.clientTop+i.scrollTop})}e(),n.addEventListener("scroll",e,!0),n.addEventListener("resize",e);const g=n.ResizeObserver,t=g?new g(e):null;return t==null||t.observe(o),t==null||t.observe(s),t==null||t.observe(c),()=>{n.removeEventListener("scroll",e,!0),n.removeEventListener("resize",e),t==null||t.disconnect()}},[d,c,s,r,o]),P}exports.useFloatingPosition=A;
@@ -1 +0,0 @@
1
- "use strict";const h=require("react"),E=require("./usePresence-B5RYv4e1.cjs"),N=require("./focus-restoration-70WcQRr5.cjs"),V=["a[href]","area[href]","button","input:not([type=hidden])","select","textarea","iframe","[contenteditable]:not([contenteditable='false'])","[tabindex]"].join(",");function B(n,o){let t=n;for(;t;){if(t.hidden||t.inert||t.getAttribute("aria-hidden")==="true")return!0;const s=t.ownerDocument.defaultView,e=s==null?void 0:s.getComputedStyle(t);if((e==null?void 0:e.display)==="none"||(e==null?void 0:e.visibility)==="hidden")return!0;if(t===o)break;t=t.parentElement}return!1}function K(n,o){var u;const t=(u=n.ownerDocument.defaultView)==null?void 0:u.HTMLInputElement;if(!t||!(n instanceof t)||n.type!=="radio"||!n.name)return!0;const s=o.filter(c=>c instanceof t&&c.type==="radio"&&c.name===n.name&&c.form===n.form),e=s.find(c=>c.checked);return e?e===n:s[0]===n}function P(n){const o=Array.from(n.querySelectorAll(V)).filter(t=>!t.matches(":disabled")&&t.tabIndex>=0&&!B(t,n));return o.filter(t=>K(t,o))}function C(n,o){const t=[n,...o];return[...new Set(t.flatMap(e=>P(e)))].sort((e,u)=>{var a;if(e===u)return 0;const c=e.compareDocumentPosition(u),m=((a=e.ownerDocument.defaultView)==null?void 0:a.Node.DOCUMENT_POSITION_FOLLOWING)??4;return c&m?-1:1})}function w(n,o,t){return t?n.contains(t)||[...o].some(s=>s.contains(t)):!1}function _(n){const{active:o,autoFocus:t=!0,boundary:s,container:e,initialFocusReference:u,layerId:c,restoreFocus:m=!0}=n,a=h.useRef(new Set),S=h.useCallback(f=>(a.current.add(f),()=>a.current.delete(f)),[]),k=h.useMemo(()=>({registerBranch:S}),[S]);return E.useOverlayFocusLayer(o&&!!e,s,c),h.useEffect(()=>{var g,I;if(!o||!e||!s)return;const f=s,i=e.ownerDocument,L=(g=i.defaultView)==null?void 0:g.HTMLElement,T=(I=i.defaultView)==null?void 0:I.Node,p=L&&i.activeElement instanceof L?i.activeElement:null;let v=!0;function O(){const r=u==null?void 0:u.current;(r&&w(e,a.current,r)?r:C(e,a.current)[0]??e).focus({preventScroll:!0})}function D(r){if(r.key!=="Tab"||!E.isTopmostFocusLayer(f,c)||E.isFocusInsideAnotherOverlay(i,f))return;const l=C(e,a.current);if(l.length===0){r.preventDefault(),e==null||e.focus({preventScroll:!0});return}const y=l[0],b=l[l.length-1],d=i.activeElement,q=w(e,a.current,d),A=!l.some(M=>M===d)&&(d===e||d===(u==null?void 0:u.current));if(!q||A){r.preventDefault(),(r.shiftKey?b:y).focus();return}r.shiftKey&&d===y?(r.preventDefault(),b.focus()):!r.shiftKey&&d===b&&(r.preventDefault(),y.focus())}function F(r){E.isTopmostFocusLayer(f,c)&&!E.isFocusInsideAnotherOverlay(i,f)&&T&&r.target instanceof T&&!w(e,a.current,r.target)&&O()}return i.addEventListener("keydown",D,!0),i.addEventListener("focusin",F,!0),t&&Promise.resolve().then(()=>{v&&O()}),()=>{v=!1,i.removeEventListener("keydown",D,!0),i.removeEventListener("focusin",F,!0),m&&(p!=null&&p.isConnected)&&N.restoreElementFocus(p)}},[o,t,s,e,u,c,m]),k}exports.useFocusTrap=_;
@@ -1,136 +0,0 @@
1
- import { useRef as V, useCallback as q, useMemo as x, useEffect as B } from "react";
2
- import { u as K, i as C, a as I } from "./usePresence-CqegYqy4.js";
3
- import { r as _ } from "./focus-restoration-BvNZzrQA.js";
4
- const H = [
5
- "a[href]",
6
- "area[href]",
7
- "button",
8
- "input:not([type=hidden])",
9
- "select",
10
- "textarea",
11
- "iframe",
12
- "[contenteditable]:not([contenteditable='false'])",
13
- "[tabindex]"
14
- ].join(",");
15
- function P(n, o) {
16
- let t = n;
17
- for (; t; ) {
18
- if (t.hidden || t.inert || t.getAttribute("aria-hidden") === "true")
19
- return !0;
20
- const s = t.ownerDocument.defaultView, e = s == null ? void 0 : s.getComputedStyle(t);
21
- if ((e == null ? void 0 : e.display) === "none" || (e == null ? void 0 : e.visibility) === "hidden")
22
- return !0;
23
- if (t === o) break;
24
- t = t.parentElement;
25
- }
26
- return !1;
27
- }
28
- function G(n, o) {
29
- var u;
30
- const t = (u = n.ownerDocument.defaultView) == null ? void 0 : u.HTMLInputElement;
31
- if (!t || !(n instanceof t) || n.type !== "radio" || !n.name)
32
- return !0;
33
- const s = o.filter(
34
- (c) => c instanceof t && c.type === "radio" && c.name === n.name && c.form === n.form
35
- ), e = s.find((c) => c.checked);
36
- return e ? e === n : s[0] === n;
37
- }
38
- function R(n) {
39
- const o = Array.from(
40
- n.querySelectorAll(H)
41
- ).filter((t) => !t.matches(":disabled") && t.tabIndex >= 0 && !P(t, n));
42
- return o.filter(
43
- (t) => G(t, o)
44
- );
45
- }
46
- function F(n, o) {
47
- const t = [n, ...o];
48
- return [...new Set(
49
- t.flatMap(
50
- (e) => R(e)
51
- )
52
- )].sort((e, u) => {
53
- var a;
54
- if (e === u) return 0;
55
- const c = e.compareDocumentPosition(u), m = ((a = e.ownerDocument.defaultView) == null ? void 0 : a.Node.DOCUMENT_POSITION_FOLLOWING) ?? 4;
56
- return c & m ? -1 : 1;
57
- });
58
- }
59
- function y(n, o, t) {
60
- return t ? n.contains(t) || [...o].some((s) => s.contains(t)) : !1;
61
- }
62
- function Q(n) {
63
- const {
64
- active: o,
65
- autoFocus: t = !0,
66
- boundary: s,
67
- container: e,
68
- initialFocusReference: u,
69
- layerId: c,
70
- restoreFocus: m = !0
71
- } = n, a = V(/* @__PURE__ */ new Set()), b = q((f) => (a.current.add(f), () => a.current.delete(f)), []), k = x(() => ({ registerBranch: b }), [b]);
72
- return K(o && !!e, s, c), B(() => {
73
- var T, g;
74
- if (!o || !e || !s) return;
75
- const f = s, i = e.ownerDocument, w = (T = i.defaultView) == null ? void 0 : T.HTMLElement, S = (g = i.defaultView) == null ? void 0 : g.Node, E = w && i.activeElement instanceof w ? i.activeElement : null;
76
- let L = !0;
77
- function v() {
78
- const r = u == null ? void 0 : u.current;
79
- (r && y(
80
- e,
81
- a.current,
82
- r
83
- ) ? r : F(
84
- e,
85
- a.current
86
- )[0] ?? e).focus({ preventScroll: !0 });
87
- }
88
- function D(r) {
89
- if (r.key !== "Tab" || !C(f, c) || I(i, f))
90
- return;
91
- const l = F(
92
- e,
93
- a.current
94
- );
95
- if (l.length === 0) {
96
- r.preventDefault(), e == null || e.focus({ preventScroll: !0 });
97
- return;
98
- }
99
- const p = l[0], h = l[l.length - 1], d = i.activeElement, M = y(
100
- e,
101
- a.current,
102
- d
103
- ), N = !l.some(
104
- (A) => A === d
105
- ) && (d === e || d === (u == null ? void 0 : u.current));
106
- if (!M || N) {
107
- r.preventDefault(), (r.shiftKey ? h : p).focus();
108
- return;
109
- }
110
- r.shiftKey && d === p ? (r.preventDefault(), h.focus()) : !r.shiftKey && d === h && (r.preventDefault(), p.focus());
111
- }
112
- function O(r) {
113
- C(f, c) && !I(i, f) && S && r.target instanceof S && !y(
114
- e,
115
- a.current,
116
- r.target
117
- ) && v();
118
- }
119
- return i.addEventListener("keydown", D, !0), i.addEventListener("focusin", O, !0), t && Promise.resolve().then(() => {
120
- L && v();
121
- }), () => {
122
- L = !1, i.removeEventListener("keydown", D, !0), i.removeEventListener("focusin", O, !0), m && (E != null && E.isConnected) && _(E);
123
- };
124
- }, [
125
- o,
126
- t,
127
- s,
128
- e,
129
- u,
130
- c,
131
- m
132
- ]), k;
133
- }
134
- export {
135
- Q as u
136
- };