@invopop/popui 0.1.77 → 0.1.79

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.
@@ -15,7 +15,7 @@
15
15
  let items = $derived(
16
16
  actions.map((a) => ({
17
17
  label: a.label,
18
- value: a,
18
+ value: a.slug || a.label,
19
19
  icon: a.icon,
20
20
  separator: a.separator,
21
21
  destructive: a.destructive,
@@ -42,9 +42,11 @@
42
42
 
43
43
  <BaseDropdown bind:isOpen bind:this={actionDropdown} {trigger}>
44
44
  <DrawerContext
45
+ autofocus
45
46
  {items}
46
47
  onclick={(e) => {
47
- onclick?.(e)
48
+ const action = actions.find((a) => (a.slug || a.label) === e)
49
+ onclick?.(action)
48
50
  actionDropdown?.toggle()
49
51
  }}
50
52
  />
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { Icon } from '@steeze-ui/svelte-icon'
3
- import { Search, Slash } from '@invopop/ui-icons'
3
+ import { Search, Command } from '@invopop/ui-icons'
4
4
  import { onDestroy, onMount } from 'svelte'
5
5
  import clsx from 'clsx'
6
6
  import ShortcutWrapper from './ShortcutWrapper.svelte'
@@ -25,11 +25,16 @@
25
25
  return
26
26
  }
27
27
 
28
+ if (!event.ctrlKey && !event.metaKey) {
29
+ return
30
+ }
31
+
28
32
  // We allow to type the GLOBAL SEARCH KEY on text fields
29
33
  if (isInputFocused()) {
30
34
  return
31
35
  }
32
36
 
37
+ event.preventDefault()
33
38
  onOpen?.()
34
39
  }
35
40
 
@@ -46,8 +51,13 @@
46
51
  <Icon src={Search} class="size-4 text-foreground-inverse shrink-0" />
47
52
  {#if !collapsed}
48
53
  <span class="text-foreground-inverse-secondary text-base flex-1 text-left">Search</span>
49
- <ShortcutWrapper theme="navigation">
50
- <Icon src={Slash} class="size-3" />
51
- </ShortcutWrapper>
54
+ <div class="flex items-center gap-1">
55
+ <ShortcutWrapper theme="navigation">
56
+ <Icon src={Command} class="size-3" />
57
+ </ShortcutWrapper>
58
+ <ShortcutWrapper theme="navigation">
59
+ <span class="text-sm font-semibold uppercase">{GLOBAL_SEARCH_KEY}</span>
60
+ </ShortcutWrapper>
61
+ </div>
52
62
  {/if}
53
63
  </button>
@@ -104,7 +104,7 @@
104
104
 
105
105
  <div class={wrapperStyles}>
106
106
  {#if isFolderItem && (highlight || active)}
107
- <div class="border-l border-white h-3 w-px absolute top-[14px] left-0 -m-px"></div>
107
+ <div class="border-l border-white h-3 w-px absolute top-3.5 left-0 -m-px"></div>
108
108
  {/if}
109
109
  <button
110
110
  use:floatingRef
@@ -147,7 +147,7 @@
147
147
  onmouseleave={handleBlur}
148
148
  class="pt-4 z-30"
149
149
  >
150
- <DrawerContext onclick={handleClickChild} {items} />
150
+ <DrawerContext autofocus onclick={handleClickChild} {items} />
151
151
  </div>
152
152
  {/if}
153
153
  {:else if open || !collapsable}
@@ -1 +1 @@
1
- export declare const GLOBAL_SEARCH_KEY = "/";
1
+ export declare const GLOBAL_SEARCH_KEY = "k";
package/dist/constants.js CHANGED
@@ -1 +1 @@
1
- export const GLOBAL_SEARCH_KEY = '/';
1
+ export const GLOBAL_SEARCH_KEY = 'k';
@@ -122,6 +122,7 @@
122
122
  <BaseButton icon={Sliders} variant="outline" size="md" />
123
123
  {/snippet}
124
124
  <DrawerContext
125
+ autofocus
125
126
  items={itemsWithActions}
126
127
  {groups}
127
128
  draggable
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.77",
4
+ "version": "0.1.79",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },