@invopop/popui 0.1.95 → 0.1.96

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.
@@ -27,14 +27,23 @@
27
27
  }: MenuItemProps = $props()
28
28
 
29
29
  let resolvedIcon: IconSource | undefined = $state()
30
- let itemStyles = $derived(
31
- clsx('flex-1 min-w-0 px-2 py-1.5 h-8', {
32
- 'text-foreground-inverse font-medium': !isFolderItem,
33
- 'text-foreground-inverse-secondary': isFolderItem && !active,
34
- 'bg-background-selected-inverse text-white': active,
30
+ let rowStyles = $derived(
31
+ clsx('flex items-center rounded-lg border border-transparent p-1', {
32
+ 'gap-1.5': action || collapsable,
33
+ 'bg-background-selected-inverse': active,
35
34
  'hover:bg-background-selected-inverse': !active
36
35
  })
37
36
  )
37
+ let buttonStyles = $derived(
38
+ clsx(
39
+ 'flex-1 min-w-0 h-6 cursor-pointer text-base flex items-center hover:text-white focus:text-white',
40
+ {
41
+ 'text-foreground-inverse font-medium': !isFolderItem,
42
+ 'text-foreground-inverse-secondary': isFolderItem && !active,
43
+ 'text-white': active
44
+ }
45
+ )
46
+ )
38
47
  let wrapperStyles = $derived(
39
48
  clsx({
40
49
  'group/menu-item ml-4 border-l border-white-10 pl-2 pt-0.5 relative': isFolderItem
@@ -63,12 +72,12 @@
63
72
  data-menu-item-tree-indicator
64
73
  ></div>
65
74
  {/if}
66
- <div class={clsx('flex items-center', { 'gap-1.5': action })} data-menu-item-row>
75
+ <div class={rowStyles} data-menu-item-row>
67
76
  <button
68
77
  onclick={handleClick}
69
78
  title={label}
70
79
  data-menu-item-button
71
- class="cursor-pointer {itemStyles} text-base border border-transparent flex items-center justify-between hover:text-white focus:text-white rounded-lg"
80
+ class={buttonStyles}
72
81
  >
73
82
  <span class="flex items-center space-x-1.5 min-w-0 flex-1" data-menu-item-content>
74
83
  {#if imageUrl}
@@ -91,24 +100,21 @@
91
100
  <TagBeta />
92
101
  {/if}
93
102
  </span>
94
- {#if collapsable}
95
- <button
96
- class="cursor-pointer"
97
- data-menu-item-chevron
98
- onclick={(e) => {
99
- e.stopPropagation()
100
- open = !open
101
- }}
102
- >
103
- <Icon src={open ? ChevronDown : ChevronRight} class="h-4 w-4 text-white-40" />
104
- </button>
105
- {/if}
106
103
  </button>
107
104
  {#if action}
108
105
  <span class="shrink-0" data-menu-item-action>
109
106
  {@render action()}
110
107
  </span>
111
108
  {/if}
109
+ {#if collapsable}
110
+ <button
111
+ class="shrink-0 cursor-pointer"
112
+ data-menu-item-chevron
113
+ onclick={() => (open = !open)}
114
+ >
115
+ <Icon src={open ? ChevronDown : ChevronRight} class="h-4 w-4 text-white-40" />
116
+ </button>
117
+ {/if}
112
118
  </div>
113
119
  {#if children?.length && (open || !collapsable)}
114
120
  <ul data-menu-item-children>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.95",
4
+ "version": "0.1.96",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },