quirk-ui 0.0.402 → 0.0.403

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),e=require("react");function c({}){const[r,n]=e.useState(0),t=e.useRef(null),u=e.useCallback(()=>{if(t.current){const a=t.current.getBoundingClientRect().width;n(a)}},[]);return e.useEffect(()=>(u(),()=>{}),[]),i.jsxs("p",{children:["Nav: ",r]})}exports.Navbar=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),e=require("react");function h({}){const[d,a]=e.useState(0),[l,t]=e.useState(null),[f,v]=e.useState(!1),i=e.useRef(null),s=e.useRef(null),o=e.useCallback(n=>{i.current&&!i.current.contains(n.target)&&t(null)},[]),u=e.useCallback(()=>{c(),typeof window<"u"&&window.innerWidth>768&&(v(!1),t(null),typeof document<"u"&&(document.body.style.overflow=""))},[]),c=e.useCallback(()=>{if(s.current){const n=s.current.getBoundingClientRect().width;a(n)}},[]);return e.useEffect(()=>{const n=typeof window<"u",r=typeof document<"u";return n&&window.addEventListener("resize",u),r&&document.addEventListener("click",o),c(),()=>{n&&window.removeEventListener("resize",u),r&&document.removeEventListener("click",o)}},[]),w.jsxs("p",{children:["Nav: ",d," ",l," ",f]})}exports.Navbar=h;
@@ -1,18 +1,30 @@
1
- import { jsxs as a } from "react/jsx-runtime";
2
- import { useState as s, useRef as u, useCallback as c, useEffect as o } from "react";
3
- function h({}) {
4
- const [e, r] = s(0), t = u(null), n = c(() => {
5
- if (t.current) {
6
- const i = t.current.getBoundingClientRect().width;
7
- r(i);
1
+ import { jsxs as h } from "react/jsx-runtime";
2
+ import { useState as n, useRef as f, useCallback as t, useEffect as p } from "react";
3
+ function N({}) {
4
+ const [a, l] = n(0), [m, i] = n(null), [v, w] = n(!1), o = f(null), s = f(null), d = t((e) => {
5
+ o.current && !o.current.contains(e.target) && i(null);
6
+ }, []), r = t(() => {
7
+ c(), typeof window < "u" && window.innerWidth > 768 && (w(!1), i(null), typeof document < "u" && (document.body.style.overflow = ""));
8
+ }, []), c = t(() => {
9
+ if (s.current) {
10
+ const e = s.current.getBoundingClientRect().width;
11
+ l(e);
8
12
  }
9
13
  }, []);
10
- return o(() => (n(), () => {
11
- }), []), /* @__PURE__ */ a("p", { children: [
14
+ return p(() => {
15
+ const e = typeof window < "u", u = typeof document < "u";
16
+ return e && window.addEventListener("resize", r), u && document.addEventListener("click", d), c(), () => {
17
+ e && window.removeEventListener("resize", r), u && document.removeEventListener("click", d);
18
+ };
19
+ }, []), /* @__PURE__ */ h("p", { children: [
12
20
  "Nav: ",
13
- e
21
+ a,
22
+ " ",
23
+ m,
24
+ " ",
25
+ v
14
26
  ] });
15
27
  }
16
28
  export {
17
- h as Navbar
29
+ N as Navbar
18
30
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.0.402",
4
+ "version": "0.0.403",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {