@nr1e/qwik-ui 0.1.3 → 1.0.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.
@@ -3,22 +3,31 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
4
  const qwik = require("@builder.io/qwik");
5
5
  const AutoDismiss = qwik.component$((props) => {
6
- const visible = qwik.useSignal(props?.visible?.value ?? false);
6
+ const visible = qwik.useSignal(props?.visible?.value ?? true);
7
7
  if (!visible.value) return null;
8
+ qwik.useTask$(async ({ track }) => {
9
+ track(() => props?.visible?.value);
10
+ if (props?.visible?.value && props.visible.value !== visible.value) {
11
+ visible.value = props.visible.value;
12
+ }
13
+ });
8
14
  qwik.useTask$(async ({ track }) => {
9
15
  track(() => visible.value);
10
- if (props?.visible) {
16
+ if (props?.visible?.value && props.visible.value !== visible.value) {
11
17
  props.visible.value = visible.value;
12
18
  }
13
19
  if (!visible.value && props?.onDismiss$) {
14
20
  props.onDismiss$();
15
21
  }
16
22
  });
17
- qwik.useVisibleTask$(({ cleanup }) => {
18
- const id = setTimeout(() => {
19
- visible.value = false;
20
- }, 6e3);
21
- cleanup(() => clearTimeout(id));
23
+ qwik.useVisibleTask$(({ track, cleanup }) => {
24
+ track(() => visible.value);
25
+ if (visible.value) {
26
+ const id = setTimeout(() => {
27
+ visible.value = false;
28
+ }, 6e3);
29
+ cleanup(() => clearTimeout(id));
30
+ }
22
31
  });
23
32
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
24
33
  class: [
@@ -1,22 +1,31 @@
1
1
  import { jsx } from "@builder.io/qwik/jsx-runtime";
2
2
  import { component$, useSignal, useTask$, useVisibleTask$, Slot } from "@builder.io/qwik";
3
3
  const AutoDismiss = component$((props) => {
4
- const visible = useSignal(props?.visible?.value ?? false);
4
+ const visible = useSignal(props?.visible?.value ?? true);
5
5
  if (!visible.value) return null;
6
+ useTask$(async ({ track }) => {
7
+ track(() => props?.visible?.value);
8
+ if (props?.visible?.value && props.visible.value !== visible.value) {
9
+ visible.value = props.visible.value;
10
+ }
11
+ });
6
12
  useTask$(async ({ track }) => {
7
13
  track(() => visible.value);
8
- if (props?.visible) {
14
+ if (props?.visible?.value && props.visible.value !== visible.value) {
9
15
  props.visible.value = visible.value;
10
16
  }
11
17
  if (!visible.value && props?.onDismiss$) {
12
18
  props.onDismiss$();
13
19
  }
14
20
  });
15
- useVisibleTask$(({ cleanup }) => {
16
- const id = setTimeout(() => {
17
- visible.value = false;
18
- }, 6e3);
19
- cleanup(() => clearTimeout(id));
21
+ useVisibleTask$(({ track, cleanup }) => {
22
+ track(() => visible.value);
23
+ if (visible.value) {
24
+ const id = setTimeout(() => {
25
+ visible.value = false;
26
+ }, 6e3);
27
+ cleanup(() => clearTimeout(id));
28
+ }
20
29
  });
21
30
  return /* @__PURE__ */ jsx("div", {
22
31
  class: [
@@ -3,24 +3,39 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
4
  const qwik = require("@builder.io/qwik");
5
5
  const qwikCity = require("@builder.io/qwik-city");
6
- const DropUpItem = qwik.component$((props) => {
7
- const nav = qwikCity.useNavigate();
6
+ const DropUpButton = qwik.component$((props) => {
8
7
  return /* @__PURE__ */ jsxRuntime.jsx("li", {
8
+ class: props.class ?? "",
9
+ children: /* @__PURE__ */ jsxRuntime.jsx("button", {
10
+ class: `text-nowrap ${props?.buttonClass ?? null}`,
11
+ onClick$: async (event) => {
12
+ if (props.loading) {
13
+ props.loading.value = true;
14
+ }
15
+ await props.onClick$(event);
16
+ if (props.loading) {
17
+ props.loading.value = false;
18
+ }
19
+ }
20
+ })
21
+ });
22
+ });
23
+ const DropUpLink = qwik.component$((props) => {
24
+ return /* @__PURE__ */ jsxRuntime.jsx("li", {
25
+ class: props.class ?? "",
9
26
  children: /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
10
27
  href: props.href,
11
28
  prefetch: props.prefetch,
12
- class: `text-nowrap ${props?.class ?? null}`,
29
+ class: `text-nowrap ${props?.linkClass ?? null}`,
13
30
  onClick$: async (event) => {
31
+ if (props.loading) {
32
+ props.loading.value = true;
33
+ }
14
34
  if (props.onClick$) {
15
35
  await props.onClick$(event);
16
- } else {
17
- if (props.loading) {
18
- props.loading.value = true;
19
- }
20
- await nav(props.href);
21
- if (props.loading) {
22
- props.loading.value = false;
23
- }
36
+ }
37
+ if (props.loading) {
38
+ props.loading.value = false;
24
39
  }
25
40
  },
26
41
  children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
@@ -43,12 +58,29 @@ const DropUpButtonSelector = qwik.component$((props) => {
43
58
  });
44
59
  });
45
60
  const DropUp = qwik.component$((props) => {
61
+ const open = qwik.useSignal(props?.open?.value ?? false);
62
+ qwik.useTask$(({ track }) => {
63
+ track(() => props?.open?.value);
64
+ if (props?.open?.value && props.open.value !== open.value) {
65
+ open.value = props.open.value;
66
+ }
67
+ });
68
+ qwik.useTask$(({ track }) => {
69
+ track(() => open.value);
70
+ if (props?.open?.value && props?.open?.value !== open.value) {
71
+ props.open.value = open.value;
72
+ }
73
+ });
46
74
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
47
- class: `dropdown dropdown-top ${props?.class ?? ""}`,
75
+ class: `dropdown dropdown-top ${open.value ? "dropdown-open" : "dropdown-close"} ${props?.class ?? ""}`,
76
+ onClick$: () => {
77
+ open.value = !open.value;
78
+ },
48
79
  children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
49
80
  });
50
81
  });
51
82
  exports.DropUp = DropUp;
83
+ exports.DropUpButton = DropUpButton;
52
84
  exports.DropUpButtonSelector = DropUpButtonSelector;
53
- exports.DropUpItem = DropUpItem;
85
+ exports.DropUpLink = DropUpLink;
54
86
  exports.DropUpSubmenu = DropUpSubmenu;
@@ -1,24 +1,39 @@
1
1
  import { jsx } from "@builder.io/qwik/jsx-runtime";
2
- import { component$, Slot } from "@builder.io/qwik";
3
- import { useNavigate, Link } from "@builder.io/qwik-city";
4
- const DropUpItem = component$((props) => {
5
- const nav = useNavigate();
2
+ import { component$, Slot, useSignal, useTask$ } from "@builder.io/qwik";
3
+ import { Link } from "@builder.io/qwik-city";
4
+ const DropUpButton = component$((props) => {
6
5
  return /* @__PURE__ */ jsx("li", {
6
+ class: props.class ?? "",
7
+ children: /* @__PURE__ */ jsx("button", {
8
+ class: `text-nowrap ${props?.buttonClass ?? null}`,
9
+ onClick$: async (event) => {
10
+ if (props.loading) {
11
+ props.loading.value = true;
12
+ }
13
+ await props.onClick$(event);
14
+ if (props.loading) {
15
+ props.loading.value = false;
16
+ }
17
+ }
18
+ })
19
+ });
20
+ });
21
+ const DropUpLink = component$((props) => {
22
+ return /* @__PURE__ */ jsx("li", {
23
+ class: props.class ?? "",
7
24
  children: /* @__PURE__ */ jsx(Link, {
8
25
  href: props.href,
9
26
  prefetch: props.prefetch,
10
- class: `text-nowrap ${props?.class ?? null}`,
27
+ class: `text-nowrap ${props?.linkClass ?? null}`,
11
28
  onClick$: async (event) => {
29
+ if (props.loading) {
30
+ props.loading.value = true;
31
+ }
12
32
  if (props.onClick$) {
13
33
  await props.onClick$(event);
14
- } else {
15
- if (props.loading) {
16
- props.loading.value = true;
17
- }
18
- await nav(props.href);
19
- if (props.loading) {
20
- props.loading.value = false;
21
- }
34
+ }
35
+ if (props.loading) {
36
+ props.loading.value = false;
22
37
  }
23
38
  },
24
39
  children: /* @__PURE__ */ jsx(Slot, {})
@@ -41,14 +56,31 @@ const DropUpButtonSelector = component$((props) => {
41
56
  });
42
57
  });
43
58
  const DropUp = component$((props) => {
59
+ const open = useSignal(props?.open?.value ?? false);
60
+ useTask$(({ track }) => {
61
+ track(() => props?.open?.value);
62
+ if (props?.open?.value && props.open.value !== open.value) {
63
+ open.value = props.open.value;
64
+ }
65
+ });
66
+ useTask$(({ track }) => {
67
+ track(() => open.value);
68
+ if (props?.open?.value && props?.open?.value !== open.value) {
69
+ props.open.value = open.value;
70
+ }
71
+ });
44
72
  return /* @__PURE__ */ jsx("div", {
45
- class: `dropdown dropdown-top ${props?.class ?? ""}`,
73
+ class: `dropdown dropdown-top ${open.value ? "dropdown-open" : "dropdown-close"} ${props?.class ?? ""}`,
74
+ onClick$: () => {
75
+ open.value = !open.value;
76
+ },
46
77
  children: /* @__PURE__ */ jsx(Slot, {})
47
78
  });
48
79
  });
49
80
  export {
50
81
  DropUp,
82
+ DropUpButton,
51
83
  DropUpButtonSelector,
52
- DropUpItem,
84
+ DropUpLink,
53
85
  DropUpSubmenu
54
86
  };
@@ -7,7 +7,7 @@ const MenuButton = qwik.component$((props) => {
7
7
  return /* @__PURE__ */ jsxRuntime.jsx("li", {
8
8
  class: props.class ?? "",
9
9
  children: /* @__PURE__ */ jsxRuntime.jsx("button", {
10
- class: `truncate ${props.selected ? "bg-base-200" : ""} ${props.linkClass ?? ""}`,
10
+ class: `truncate ${props.selected ? "bg-base-200" : ""} ${props.buttonClass ?? ""}`,
11
11
  onClick$: async (event) => {
12
12
  if (props.loading) {
13
13
  props.loading.value = true;
@@ -28,6 +28,7 @@ const MenuLink = qwik.component$((props) => {
28
28
  class: `truncate ${props.selected ? "bg-base-200" : ""} ${props.linkClass ?? ""}`,
29
29
  href: props.href,
30
30
  prefetch: props.prefetch ?? true,
31
+ target: props.target,
31
32
  onClick$: async (event) => {
32
33
  if (props.loading) {
33
34
  props.loading.value = true;
@@ -5,7 +5,7 @@ const MenuButton = component$((props) => {
5
5
  return /* @__PURE__ */ jsx("li", {
6
6
  class: props.class ?? "",
7
7
  children: /* @__PURE__ */ jsx("button", {
8
- class: `truncate ${props.selected ? "bg-base-200" : ""} ${props.linkClass ?? ""}`,
8
+ class: `truncate ${props.selected ? "bg-base-200" : ""} ${props.buttonClass ?? ""}`,
9
9
  onClick$: async (event) => {
10
10
  if (props.loading) {
11
11
  props.loading.value = true;
@@ -26,6 +26,7 @@ const MenuLink = component$((props) => {
26
26
  class: `truncate ${props.selected ? "bg-base-200" : ""} ${props.linkClass ?? ""}`,
27
27
  href: props.href,
28
28
  prefetch: props.prefetch ?? true,
29
+ target: props.target,
29
30
  onClick$: async (event) => {
30
31
  if (props.loading) {
31
32
  props.loading.value = true;
@@ -35,8 +35,9 @@ exports.DockLabel = dock.DockLabel;
35
35
  exports.DockLink = dock.DockLink;
36
36
  exports.FixedCenterBottom = fixedCenterBottom.FixedCenterBottom;
37
37
  exports.DropUp = dropUp.DropUp;
38
+ exports.DropUpButton = dropUp.DropUpButton;
38
39
  exports.DropUpButtonSelector = dropUp.DropUpButtonSelector;
39
- exports.DropUpItem = dropUp.DropUpItem;
40
+ exports.DropUpLink = dropUp.DropUpLink;
40
41
  exports.DropUpSubmenu = dropUp.DropUpSubmenu;
41
42
  exports.GoogleSignInButton = googleSignInButton.GoogleSignInButton;
42
43
  exports.GtmBody = gtm.GtmBody;
@@ -8,7 +8,7 @@ import { CheckboxField } from "./components/checkbox-field.qwik.mjs";
8
8
  import { Dialog } from "./components/dialog.qwik.mjs";
9
9
  import { Dock, DockButton, DockLabel, DockLink } from "./components/dock.qwik.mjs";
10
10
  import { FixedCenterBottom } from "./components/fixed-center-bottom.qwik.mjs";
11
- import { DropUp, DropUpButtonSelector, DropUpItem, DropUpSubmenu } from "./components/drop-up.qwik.mjs";
11
+ import { DropUp, DropUpButton, DropUpButtonSelector, DropUpLink, DropUpSubmenu } from "./components/drop-up.qwik.mjs";
12
12
  import { GoogleSignInButton } from "./components/google-sign-in-button.qwik.mjs";
13
13
  import { GtmBody, GtmHead } from "./components/gtm.qwik.mjs";
14
14
  import { Menu, MenuButton, MenuDivider, MenuGroup, MenuGroupSummary, MenuLink, Submenu } from "./components/menu.qwik.mjs";
@@ -33,8 +33,9 @@ export {
33
33
  DockLabel,
34
34
  DockLink,
35
35
  DropUp,
36
+ DropUpButton,
36
37
  DropUpButtonSelector,
37
- DropUpItem,
38
+ DropUpLink,
38
39
  DropUpSubmenu,
39
40
  FixedCenterBottom,
40
41
  GoogleSignInButton,
@@ -1,22 +1,30 @@
1
1
  import { QRL, Signal } from '@builder.io/qwik';
2
- export interface DropUpItemProps {
3
- href?: string;
2
+ export interface DropUpButtonProps {
3
+ loading?: Signal<boolean>;
4
+ onClick$: QRL<(event: Event) => void>;
5
+ class?: string;
6
+ buttonClass?: string;
7
+ }
8
+ export declare const DropUpButton: import("@builder.io/qwik").Component<DropUpButtonProps>;
9
+ export interface DropUpLinkProps {
10
+ href: string;
4
11
  prefetch?: boolean;
5
- selected?: boolean;
6
12
  loading?: Signal<boolean>;
7
13
  onClick$?: QRL<(event: Event) => void>;
8
14
  class?: string;
15
+ linkClass?: string;
9
16
  }
10
- export declare const DropUpItem: import("@builder.io/qwik").Component<DropUpItemProps>;
17
+ export declare const DropUpLink: import("@builder.io/qwik").Component<DropUpLinkProps>;
11
18
  export interface DropUpSubmenuProps {
12
19
  class?: string;
13
20
  }
14
21
  export declare const DropUpSubmenu: import("@builder.io/qwik").Component<DropUpSubmenuProps | undefined>;
15
- export interface DropUpButtonProps {
22
+ export interface DropUpButtonSelectorProps {
16
23
  class?: string;
17
24
  }
18
- export declare const DropUpButtonSelector: import("@builder.io/qwik").Component<DropUpButtonProps | undefined>;
25
+ export declare const DropUpButtonSelector: import("@builder.io/qwik").Component<DropUpButtonSelectorProps | undefined>;
19
26
  export interface DropUpProps {
20
27
  class?: string;
28
+ open?: Signal<boolean>;
21
29
  }
22
30
  export declare const DropUp: import("@builder.io/qwik").Component<DropUpProps | undefined>;
@@ -4,7 +4,7 @@ export interface MenuButtonProps {
4
4
  loading?: Signal<boolean>;
5
5
  selected?: boolean;
6
6
  onClick$: QRL<(event: Event) => void>;
7
- linkClass?: string;
7
+ buttonClass?: string;
8
8
  }
9
9
  export declare const MenuButton: import("@builder.io/qwik").Component<MenuButtonProps>;
10
10
  export interface MenuLinkProps {
@@ -15,6 +15,7 @@ export interface MenuLinkProps {
15
15
  onClick$?: QRL<(event: Event) => void>;
16
16
  class?: string;
17
17
  linkClass?: string;
18
+ target?: string;
18
19
  }
19
20
  export declare const MenuLink: import("@builder.io/qwik").Component<MenuLinkProps>;
20
21
  export interface MenuGroupSummaryProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nr1e/qwik-ui",
3
- "version": "0.1.3",
3
+ "version": "1.0.0",
4
4
  "description": "NR1E Qwik UI Library",
5
5
  "author": "NR1E, Inc.",
6
6
  "publishConfig": {
@@ -36,7 +36,7 @@
36
36
  "peerDependencies": {
37
37
  "@builder.io/qwik-city": "1.19.0",
38
38
  "tailwindcss-animated": "2.0.0",
39
- "@nr1e/qwik-icons": "0.0.20"
39
+ "@nr1e/qwik-icons": "0.0.24"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@builder.io/qwik": "1.19.0",