@nr1e/qwik-ui 0.0.44 → 0.1.1

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,10 +3,20 @@ 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
- if (props?.visible && !props.visible.value) return null;
6
+ const visible = qwik.useSignal(props?.visible?.value ?? false);
7
+ if (!visible.value) return null;
8
+ qwik.useTask$(async ({ track }) => {
9
+ track(() => visible.value);
10
+ if (props?.visible) {
11
+ props.visible.value = visible.value;
12
+ }
13
+ if (!visible.value && props?.onDismiss$) {
14
+ props.onDismiss$();
15
+ }
16
+ });
7
17
  qwik.useVisibleTask$(({ cleanup }) => {
8
18
  const id = setTimeout(() => {
9
- if (props?.visible) props.visible.value = false;
19
+ visible.value = false;
10
20
  }, 6e3);
11
21
  cleanup(() => clearTimeout(id));
12
22
  });
@@ -1,10 +1,20 @@
1
1
  import { jsx } from "@builder.io/qwik/jsx-runtime";
2
- import { component$, useVisibleTask$, Slot } from "@builder.io/qwik";
2
+ import { component$, useSignal, useTask$, useVisibleTask$, Slot } from "@builder.io/qwik";
3
3
  const AutoDismiss = component$((props) => {
4
- if (props?.visible && !props.visible.value) return null;
4
+ const visible = useSignal(props?.visible?.value ?? false);
5
+ if (!visible.value) return null;
6
+ useTask$(async ({ track }) => {
7
+ track(() => visible.value);
8
+ if (props?.visible) {
9
+ props.visible.value = visible.value;
10
+ }
11
+ if (!visible.value && props?.onDismiss$) {
12
+ props.onDismiss$();
13
+ }
14
+ });
5
15
  useVisibleTask$(({ cleanup }) => {
6
16
  const id = setTimeout(() => {
7
- if (props?.visible) props.visible.value = false;
17
+ visible.value = false;
8
18
  }, 6e3);
9
19
  cleanup(() => clearTimeout(id));
10
20
  });
@@ -9,23 +9,35 @@ const DockLabel = qwik.component$((props) => {
9
9
  children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
10
10
  });
11
11
  });
12
- const DockItem = qwik.component$((props) => {
13
- const nav = qwikCity.useNavigate();
12
+ const DockButton = qwik.component$((props) => {
13
+ return /* @__PURE__ */ jsxRuntime.jsx("button", {
14
+ class: `${props.selected ? "bg-base-200" : ""} ${props.class ?? ""}`,
15
+ onClick$: async (event) => {
16
+ if (props.loading) {
17
+ props.loading.value = true;
18
+ }
19
+ await props.onClick$(event);
20
+ if (props.loading) {
21
+ props.loading.value = false;
22
+ }
23
+ },
24
+ children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
25
+ });
26
+ });
27
+ const DockLink = qwik.component$((props) => {
14
28
  return /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
15
- class: `${props.selected ? "bg-base-200" : ""} ${props.linkClass ?? ""}`,
29
+ class: `${props.selected ? "bg-base-200" : ""} ${props.class ?? ""}`,
16
30
  href: props.href,
17
31
  prefetch: props.prefetch ?? true,
18
32
  onClick$: async (event) => {
33
+ if (props.loading) {
34
+ props.loading.value = true;
35
+ }
19
36
  if (props.onClick$) {
20
37
  await props.onClick$(event);
21
- } else {
22
- if (props.loading) {
23
- props.loading.value = true;
24
- }
25
- await nav(props.href);
26
- if (props.loading) {
27
- props.loading.value = false;
28
- }
38
+ }
39
+ if (props.loading) {
40
+ props.loading.value = false;
29
41
  }
30
42
  },
31
43
  children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
@@ -38,5 +50,6 @@ const Dock = qwik.component$((props) => {
38
50
  });
39
51
  });
40
52
  exports.Dock = Dock;
41
- exports.DockItem = DockItem;
53
+ exports.DockButton = DockButton;
42
54
  exports.DockLabel = DockLabel;
55
+ exports.DockLink = DockLink;
@@ -1,29 +1,41 @@
1
1
  import { jsx } from "@builder.io/qwik/jsx-runtime";
2
2
  import { component$, Slot } from "@builder.io/qwik";
3
- import { useNavigate, Link } from "@builder.io/qwik-city";
3
+ import { Link } from "@builder.io/qwik-city";
4
4
  const DockLabel = component$((props) => {
5
5
  return /* @__PURE__ */ jsx("span", {
6
6
  class: `dock-label ${props?.class ?? ""}`,
7
7
  children: /* @__PURE__ */ jsx(Slot, {})
8
8
  });
9
9
  });
10
- const DockItem = component$((props) => {
11
- const nav = useNavigate();
10
+ const DockButton = component$((props) => {
11
+ return /* @__PURE__ */ jsx("button", {
12
+ class: `${props.selected ? "bg-base-200" : ""} ${props.class ?? ""}`,
13
+ onClick$: async (event) => {
14
+ if (props.loading) {
15
+ props.loading.value = true;
16
+ }
17
+ await props.onClick$(event);
18
+ if (props.loading) {
19
+ props.loading.value = false;
20
+ }
21
+ },
22
+ children: /* @__PURE__ */ jsx(Slot, {})
23
+ });
24
+ });
25
+ const DockLink = component$((props) => {
12
26
  return /* @__PURE__ */ jsx(Link, {
13
- class: `${props.selected ? "bg-base-200" : ""} ${props.linkClass ?? ""}`,
27
+ class: `${props.selected ? "bg-base-200" : ""} ${props.class ?? ""}`,
14
28
  href: props.href,
15
29
  prefetch: props.prefetch ?? true,
16
30
  onClick$: async (event) => {
31
+ if (props.loading) {
32
+ props.loading.value = true;
33
+ }
17
34
  if (props.onClick$) {
18
35
  await props.onClick$(event);
19
- } else {
20
- if (props.loading) {
21
- props.loading.value = true;
22
- }
23
- await nav(props.href);
24
- if (props.loading) {
25
- props.loading.value = false;
26
- }
36
+ }
37
+ if (props.loading) {
38
+ props.loading.value = false;
27
39
  }
28
40
  },
29
41
  children: /* @__PURE__ */ jsx(Slot, {})
@@ -37,6 +49,7 @@ const Dock = component$((props) => {
37
49
  });
38
50
  export {
39
51
  Dock,
40
- DockItem,
41
- DockLabel
52
+ DockButton,
53
+ DockLabel,
54
+ DockLink
42
55
  };
@@ -3,8 +3,25 @@ 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 MenuItem = qwik.component$((props) => {
7
- const nav = qwikCity.useNavigate();
6
+ const MenuButton = qwik.component$((props) => {
7
+ return /* @__PURE__ */ jsxRuntime.jsx("li", {
8
+ class: props.class ?? "",
9
+ children: /* @__PURE__ */ jsxRuntime.jsx("button", {
10
+ class: `truncate ${props.selected ? "bg-base-200" : ""} ${props.linkClass ?? ""}`,
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
+ children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
21
+ })
22
+ });
23
+ });
24
+ const MenuLink = qwik.component$((props) => {
8
25
  return /* @__PURE__ */ jsxRuntime.jsx("li", {
9
26
  class: props.class ?? "",
10
27
  children: /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
@@ -12,16 +29,14 @@ const MenuItem = qwik.component$((props) => {
12
29
  href: props.href,
13
30
  prefetch: props.prefetch ?? true,
14
31
  onClick$: async (event) => {
32
+ if (props.loading) {
33
+ props.loading.value = true;
34
+ }
15
35
  if (props.onClick$) {
16
36
  await props.onClick$(event);
17
- } else {
18
- if (props.loading) {
19
- props.loading.value = true;
20
- }
21
- await nav(props.href);
22
- if (props.loading) {
23
- props.loading.value = false;
24
- }
37
+ }
38
+ if (props.loading) {
39
+ props.loading.value = false;
25
40
  }
26
41
  },
27
42
  children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
@@ -61,8 +76,9 @@ const Menu = qwik.component$((props) => {
61
76
  });
62
77
  });
63
78
  exports.Menu = Menu;
79
+ exports.MenuButton = MenuButton;
64
80
  exports.MenuDivider = MenuDivider;
65
81
  exports.MenuGroup = MenuGroup;
66
82
  exports.MenuGroupSummary = MenuGroupSummary;
67
- exports.MenuItem = MenuItem;
83
+ exports.MenuLink = MenuLink;
68
84
  exports.Submenu = Submenu;
@@ -1,8 +1,25 @@
1
1
  import { jsx } from "@builder.io/qwik/jsx-runtime";
2
2
  import { component$, Slot } from "@builder.io/qwik";
3
- import { useNavigate, Link } from "@builder.io/qwik-city";
4
- const MenuItem = component$((props) => {
5
- const nav = useNavigate();
3
+ import { Link } from "@builder.io/qwik-city";
4
+ const MenuButton = component$((props) => {
5
+ return /* @__PURE__ */ jsx("li", {
6
+ class: props.class ?? "",
7
+ children: /* @__PURE__ */ jsx("button", {
8
+ class: `truncate ${props.selected ? "bg-base-200" : ""} ${props.linkClass ?? ""}`,
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
+ children: /* @__PURE__ */ jsx(Slot, {})
19
+ })
20
+ });
21
+ });
22
+ const MenuLink = component$((props) => {
6
23
  return /* @__PURE__ */ jsx("li", {
7
24
  class: props.class ?? "",
8
25
  children: /* @__PURE__ */ jsx(Link, {
@@ -10,16 +27,14 @@ const MenuItem = component$((props) => {
10
27
  href: props.href,
11
28
  prefetch: props.prefetch ?? true,
12
29
  onClick$: async (event) => {
30
+ if (props.loading) {
31
+ props.loading.value = true;
32
+ }
13
33
  if (props.onClick$) {
14
34
  await props.onClick$(event);
15
- } else {
16
- if (props.loading) {
17
- props.loading.value = true;
18
- }
19
- await nav(props.href);
20
- if (props.loading) {
21
- props.loading.value = false;
22
- }
35
+ }
36
+ if (props.loading) {
37
+ props.loading.value = false;
23
38
  }
24
39
  },
25
40
  children: /* @__PURE__ */ jsx(Slot, {})
@@ -60,9 +75,10 @@ const Menu = component$((props) => {
60
75
  });
61
76
  export {
62
77
  Menu,
78
+ MenuButton,
63
79
  MenuDivider,
64
80
  MenuGroup,
65
81
  MenuGroupSummary,
66
- MenuItem,
82
+ MenuLink,
67
83
  Submenu
68
84
  };
@@ -29,8 +29,9 @@ exports.AutoDismiss = autoDismiss.AutoDismiss;
29
29
  exports.CheckboxField = checkboxField.CheckboxField;
30
30
  exports.Dialog = dialog.Dialog;
31
31
  exports.Dock = dock.Dock;
32
- exports.DockItem = dock.DockItem;
32
+ exports.DockButton = dock.DockButton;
33
33
  exports.DockLabel = dock.DockLabel;
34
+ exports.DockLink = dock.DockLink;
34
35
  exports.DropUp = dropUp.DropUp;
35
36
  exports.DropUpButtonSelector = dropUp.DropUpButtonSelector;
36
37
  exports.DropUpItem = dropUp.DropUpItem;
@@ -39,10 +40,11 @@ exports.GoogleSignInButton = googleSignInButton.GoogleSignInButton;
39
40
  exports.GtmBody = gtm.GtmBody;
40
41
  exports.GtmHead = gtm.GtmHead;
41
42
  exports.Menu = menu.Menu;
43
+ exports.MenuButton = menu.MenuButton;
42
44
  exports.MenuDivider = menu.MenuDivider;
43
45
  exports.MenuGroup = menu.MenuGroup;
44
46
  exports.MenuGroupSummary = menu.MenuGroupSummary;
45
- exports.MenuItem = menu.MenuItem;
47
+ exports.MenuLink = menu.MenuLink;
46
48
  exports.Submenu = menu.Submenu;
47
49
  exports.MicrosoftSignInButton = microsoftSignInButton.MicrosoftSignInButton;
48
50
  exports.PaceBar = paceBar.PaceBar;
@@ -6,11 +6,11 @@ import { AlertWarning } from "./components/alert-warning.qwik.mjs";
6
6
  import { AutoDismiss } from "./components/auto-dismiss.qwik.mjs";
7
7
  import { CheckboxField } from "./components/checkbox-field.qwik.mjs";
8
8
  import { Dialog } from "./components/dialog.qwik.mjs";
9
- import { Dock, DockItem, DockLabel } from "./components/dock.qwik.mjs";
9
+ import { Dock, DockButton, DockLabel, DockLink } from "./components/dock.qwik.mjs";
10
10
  import { DropUp, DropUpButtonSelector, DropUpItem, DropUpSubmenu } from "./components/drop-up.qwik.mjs";
11
11
  import { GoogleSignInButton } from "./components/google-sign-in-button.qwik.mjs";
12
12
  import { GtmBody, GtmHead } from "./components/gtm.qwik.mjs";
13
- import { Menu, MenuDivider, MenuGroup, MenuGroupSummary, MenuItem, Submenu } from "./components/menu.qwik.mjs";
13
+ import { Menu, MenuButton, MenuDivider, MenuGroup, MenuGroupSummary, MenuLink, Submenu } from "./components/menu.qwik.mjs";
14
14
  import { MicrosoftSignInButton } from "./components/microsoft-sign-in-button.qwik.mjs";
15
15
  import { PaceBar } from "./components/pace-bar.qwik.mjs";
16
16
  import { SelectField } from "./components/select-field.qwik.mjs";
@@ -28,8 +28,9 @@ export {
28
28
  CheckboxField,
29
29
  Dialog,
30
30
  Dock,
31
- DockItem,
31
+ DockButton,
32
32
  DockLabel,
33
+ DockLink,
33
34
  DropUp,
34
35
  DropUpButtonSelector,
35
36
  DropUpItem,
@@ -38,10 +39,11 @@ export {
38
39
  GtmBody,
39
40
  GtmHead,
40
41
  Menu,
42
+ MenuButton,
41
43
  MenuDivider,
42
44
  MenuGroup,
43
45
  MenuGroupSummary,
44
- MenuItem,
46
+ MenuLink,
45
47
  MicrosoftSignInButton,
46
48
  PaceBar,
47
49
  SelectField,
@@ -1,6 +1,7 @@
1
- import { Signal } from '@builder.io/qwik';
1
+ import { QRL, Signal } from '@builder.io/qwik';
2
2
  export interface AutoDismissProps {
3
3
  class?: string;
4
4
  visible?: Signal<boolean>;
5
+ onDismiss$?: QRL<() => void>;
5
6
  }
6
7
  export declare const AutoDismiss: import("@builder.io/qwik").Component<AutoDismissProps | undefined>;
@@ -3,16 +3,22 @@ export interface DockLabelProps {
3
3
  class?: string;
4
4
  }
5
5
  export declare const DockLabel: import("@builder.io/qwik").Component<DockLabelProps | undefined>;
6
- export interface DockItemProps {
7
- href?: string;
6
+ export interface DockButtonProps {
7
+ class?: string;
8
+ selected?: boolean;
9
+ loading?: Signal<boolean>;
10
+ onClick$: QRL<(event: Event) => void>;
11
+ }
12
+ export declare const DockButton: import("@builder.io/qwik").Component<DockButtonProps>;
13
+ export interface DockLinkProps {
14
+ href: string;
8
15
  prefetch?: boolean;
9
16
  class?: string;
10
17
  selected?: boolean;
11
18
  loading?: Signal<boolean>;
12
19
  onClick$?: QRL<(event: Event) => void>;
13
- linkClass?: string;
14
20
  }
15
- export declare const DockItem: import("@builder.io/qwik").Component<DockItemProps>;
21
+ export declare const DockLink: import("@builder.io/qwik").Component<DockLinkProps>;
16
22
  export interface DockProps {
17
23
  class?: string;
18
24
  }
@@ -1,6 +1,14 @@
1
1
  import { QRL, Signal } from '@builder.io/qwik';
2
- export interface MenuItemProps {
3
- href?: string;
2
+ export interface MenuButtonProps {
3
+ class?: string;
4
+ loading?: Signal<boolean>;
5
+ selected?: boolean;
6
+ onClick$: QRL<(event: Event) => void>;
7
+ linkClass?: string;
8
+ }
9
+ export declare const MenuButton: import("@builder.io/qwik").Component<MenuButtonProps>;
10
+ export interface MenuLinkProps {
11
+ href: string;
4
12
  prefetch?: boolean;
5
13
  selected?: boolean;
6
14
  loading?: Signal<boolean>;
@@ -8,7 +16,7 @@ export interface MenuItemProps {
8
16
  class?: string;
9
17
  linkClass?: string;
10
18
  }
11
- export declare const MenuItem: import("@builder.io/qwik").Component<MenuItemProps>;
19
+ export declare const MenuLink: import("@builder.io/qwik").Component<MenuLinkProps>;
12
20
  export interface MenuGroupSummaryProps {
13
21
  class?: string;
14
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nr1e/qwik-ui",
3
- "version": "0.0.44",
3
+ "version": "0.1.1",
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.19"
39
+ "@nr1e/qwik-icons": "0.0.20"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@builder.io/qwik": "1.19.0",