fuma 2.0.37 → 2.0.38

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.
@@ -1,11 +1,16 @@
1
1
  <script lang="ts" generics="RelationItem extends {id: string | number}">
2
- import { createEventDispatcher, tick, type ComponentProps, type Snippet } from 'svelte'
2
+ import {
3
+ createEventDispatcher,
4
+ tick,
5
+ type Component,
6
+ type ComponentProps,
7
+ type Snippet
8
+ } from 'svelte'
3
9
  import type { HTMLInputAttributes } from 'svelte/elements'
4
10
  import debounce from 'debounce'
5
11
  import { toast } from 'svelte-sonner'
6
12
 
7
13
  import { USE_COERCE_JSON } from '../../utils/constant.js'
8
- import { Icon } from '../icon/index.js'
9
14
  import { DropDown } from '../menu/index.js'
10
15
  import { FormControl, SelectorList } from './index.js'
11
16
  import type { TippyProps } from '../../utils/tippy.js'
@@ -31,6 +36,8 @@
31
36
  export let input: HTMLInputAttributes | undefined = undefined
32
37
  export let append: Snippet | undefined = undefined
33
38
  export let disabled = false
39
+ export let shortcutKey = ''
40
+ export let Icon: Component<{ class: string }> | undefined = undefined
34
41
 
35
42
  let klass = ''
36
43
  export { klass as class }
@@ -95,26 +102,28 @@
95
102
  <div class="contents" slot="activator">
96
103
  <FormControl {key} {label} {error} class={klass}>
97
104
  {#snippet children({ key })}
98
- <div class="flex grow gap-2" class:hidden={item}>
99
- <div class="input grow pr-2">
100
- <input
101
- type="text"
102
- id={key}
103
- bind:this={inputElement}
104
- bind:value={searchValue}
105
- on:input={(e) => searchItemsDebounce(e.currentTarget.value)}
106
- on:focus={handleFocus}
107
- on:blur={handleBlur}
108
- autocomplete="off"
109
- {placeholder}
110
- class="grow"
111
- size={8}
112
- {...input}
113
- />
114
- <RelationAfter {isLoading} {createUrl} {createTitle} {createIcon} />
115
- </div>
116
- {@render append?.()}
117
- </div>
105
+ <label class="input" class:hidden={item}>
106
+ <svelte:component this={Icon} class="h-5 opacity-70" />
107
+ <input
108
+ type="text"
109
+ id={key}
110
+ bind:this={inputElement}
111
+ bind:value={searchValue}
112
+ on:input={(e) => searchItemsDebounce(e.currentTarget.value)}
113
+ on:focus={handleFocus}
114
+ on:blur={handleBlur}
115
+ autocomplete="off"
116
+ {placeholder}
117
+ class="grow"
118
+ size={8}
119
+ {...input}
120
+ />
121
+ <RelationAfter {isLoading} {createUrl} {createTitle} {createIcon} />
122
+ {#if shortcutKey}
123
+ <kbd class="kbd kbd-xs text-base-content/50">{shortcutKey}</kbd>
124
+ {/if}
125
+ </label>
126
+ {@render append?.()}
118
127
 
119
128
  {#if item}
120
129
  {#if noSlotItemWrapper}
@@ -126,7 +135,11 @@
126
135
  on:click|stopPropagation={() => clear()}
127
136
  class="input h-auto min-h-10 w-full grow items-start pt-2 pr-2"
128
137
  >
138
+ <svelte:component this={Icon} class="h-5 opacity-70" />
129
139
  {@render slotItem(item)}
140
+ {#if shortcutKey}
141
+ <kbd class="kbd kbd-xs text-base-content/50">{shortcutKey}</kbd>
142
+ {/if}
130
143
  </button>
131
144
  {/if}
132
145
  <input
@@ -1,4 +1,4 @@
1
- import { type ComponentProps, type Snippet } from 'svelte';
1
+ import { type Component, type ComponentProps, type Snippet } from 'svelte';
2
2
  import type { HTMLInputAttributes } from 'svelte/elements';
3
3
  import { DropDown } from '../menu/index.js';
4
4
  import type { TippyProps } from '../../utils/tippy.js';
@@ -25,6 +25,10 @@ declare class __sveltets_Render<RelationItem extends {
25
25
  input?: HTMLInputAttributes | undefined;
26
26
  append?: Snippet | undefined;
27
27
  disabled?: boolean;
28
+ shortcutKey?: string;
29
+ Icon?: Component<{
30
+ class: string;
31
+ }, {}, string> | undefined;
28
32
  class?: string;
29
33
  classList?: string;
30
34
  inputElement?: HTMLInputElement | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "2.0.37",
3
+ "version": "2.0.38",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",