noph-ui 0.42.0 → 0.42.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.
@@ -26,6 +26,8 @@
26
26
 
27
27
  const uid = $props.id()
28
28
 
29
+ const isLink = $derived(attributes.href != null && !disabled && !loading)
30
+
29
31
  const tooltipId = $derived(title && !disabled && !loading ? uid : undefined)
30
32
 
31
33
  let pressed = $state(false)
@@ -72,7 +74,7 @@
72
74
  {/if}
73
75
  {/snippet}
74
76
 
75
- {#if 'href' in attributes && !disabled && !loading}
77
+ {#if isLink}
76
78
  <a
77
79
  {...attributes}
78
80
  onclick={(event) => {
@@ -25,6 +25,8 @@
25
25
  }: IconButtonProps = $props()
26
26
 
27
27
  const uid = $props.id()
28
+
29
+ const isLink = $derived(attributes.href != null && !disabled && !loading)
28
30
  const tooltipId = $derived(title && !disabled && !loading ? uid : undefined)
29
31
 
30
32
  let pressed = $state(false)
@@ -62,7 +64,7 @@
62
64
  {/if}
63
65
  {/snippet}
64
66
 
65
- {#if 'href' in attributes && !disabled && !loading}
67
+ {#if isLink}
66
68
  <a
67
69
  {...attributes}
68
70
  onclick={(event) => {
@@ -3,14 +3,12 @@
3
3
  import type { MenuItemProps } from './types.js'
4
4
 
5
5
  let { ...attributes }: MenuItemProps = $props()
6
+
7
+ const isLink = $derived(attributes.href != null)
6
8
  </script>
7
9
 
8
10
  <div class="np-menu-item" role="none">
9
- {#if 'href' in attributes}
10
- <Item role="menuitem" {...attributes} variant="link" />
11
- {:else}
12
- <Item role="menuitem" {...attributes} variant="button" />
13
- {/if}
11
+ <Item role="menuitem" {...attributes} variant={isLink ? 'link' : 'button'} />
14
12
  </div>
15
13
 
16
14
  <style>
@@ -11,6 +11,8 @@
11
11
  icon,
12
12
  ...attributes
13
13
  }: NavigationDrawerItemProps = $props()
14
+
15
+ const isLink = $derived(attributes.href != null)
14
16
  </script>
15
17
 
16
18
  {#snippet content()}
@@ -26,7 +28,7 @@
26
28
  {/if}
27
29
  {/snippet}
28
30
 
29
- {#if 'href' in attributes}
31
+ {#if isLink}
30
32
  <a
31
33
  {...attributes}
32
34
  href={attributes.href}
@@ -6,6 +6,8 @@
6
6
 
7
7
  let { selected, icon, label, ...attributes }: NavigationRailItemProps = $props()
8
8
  let touchEl: HTMLSpanElement | undefined = $state()
9
+
10
+ const isLink = $derived(attributes.href != null)
9
11
  </script>
10
12
 
11
13
  {#snippet content()}
@@ -17,7 +19,7 @@
17
19
  <span class="np-touch" bind:this={touchEl}></span>
18
20
  {/snippet}
19
21
 
20
- {#if 'href' in attributes}
22
+ {#if isLink}
21
23
  <a
22
24
  {...attributes}
23
25
  href={attributes.href}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {