fuma 0.1.32 → 0.1.34

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.
@@ -32,7 +32,7 @@ async function select(index = focusIndex) {
32
32
  }
33
33
  </script>
34
34
 
35
- <DropDown {tippyProps} isWidthOfActivator>
35
+ <DropDown {tippyProps}>
36
36
  <div class="contents" slot="activator">
37
37
  <FormControl {...props} let:key>
38
38
  <div class="flex grow gap-2" class:hidden={selectedOption}>
@@ -61,7 +61,7 @@ async function handleBlur() {
61
61
  }
62
62
  </script>
63
63
 
64
- <DropDown {tippyProps} disable={flatMode} isWidthOfActivator>
64
+ <DropDown {tippyProps} disable={flatMode}>
65
65
  <div class="contents" slot="activator">
66
66
  <FormControl {key} {label} {error} class={klass} let:key>
67
67
  <div class="flex grow gap-2" class:hidden={item}>
@@ -74,7 +74,7 @@ async function handleBlur() {
74
74
  }
75
75
  </script>
76
76
 
77
- <DropDown bind:this={dropdown} disable={flatMode} isWidthOfActivator>
77
+ <DropDown bind:this={dropdown} disable={flatMode}>
78
78
  <div slot="activator">
79
79
  <FormControl {key} {label} {error} class={klass}>
80
80
  <div class="flex flex-col gap-2">
@@ -25,8 +25,8 @@ function onSelect(index) {
25
25
  }
26
26
  </script>
27
27
 
28
- <DropDown bind:this={dropDown} isWidthOfActivator>
29
- <div class="contents" slot="activator">
28
+ <DropDown bind:this={dropDown}>
29
+ <svelte:fragment slot="activator">
30
30
  <FormControl {...props} let:key>
31
31
  <button
32
32
  bind:this={button}
@@ -46,7 +46,7 @@ function onSelect(index) {
46
46
  </button>
47
47
  <input type="hidden" name={key} {value} />
48
48
  </FormControl>
49
- </div>
49
+ </svelte:fragment>
50
50
 
51
51
  <SelectorList
52
52
  trigger={button}
@@ -10,17 +10,15 @@ const dispatch = createEventDispatcher();
10
10
  </script>
11
11
 
12
12
  {#if isLoading}
13
- <div class:right-10={createUrl} transition:fade|local>
13
+ <div in:fade|local>
14
14
  <Icon
15
15
  path={mdiLoading}
16
16
  class="w-9"
17
17
  classSVG="animate-spin fill-primary-ligther stroke-primary-ligther"
18
18
  />
19
19
  </div>
20
- {/if}
21
-
22
- {#if createUrl}
23
- <a href={createUrl} class="btn btn-square btn-sm">
20
+ {:else if createUrl}
21
+ <a href={createUrl} class="btn btn-square btn-sm" in:fade|local={{ duration: 200 }}>
24
22
  <Icon path={createIcon} on:click={() => dispatch('create')} title={createTitle} />
25
23
  </a>
26
24
  {/if}
@@ -26,7 +26,6 @@ export let hideOnNav = true;
26
26
  export let tip = void 0;
27
27
  export let disable = false;
28
28
  export let content = void 0;
29
- export let isWidthOfActivator = false;
30
29
  let activator;
31
30
  beforeNavigate(() => hideOnNav && hide());
32
31
  onMount(() => {
@@ -94,7 +93,6 @@ export function setTippyProps(props) {
94
93
 
95
94
  <div class="hidden">
96
95
  <div
97
- style={isWidthOfActivator ? `width: ${activator?.offsetWidth}px;` : ''}
98
96
  class="{klass} max-h-80 overflow-auto rounded-lg border bg-base-100 p-1 shadow-lg"
99
97
  bind:this={content}
100
98
  >
@@ -15,7 +15,6 @@ declare const __propDef: {
15
15
  tip?: TippyInstance | undefined;
16
16
  disable?: boolean | undefined;
17
17
  content?: HTMLDivElement | undefined;
18
- isWidthOfActivator?: boolean | undefined;
19
18
  hide?: (() => void) | undefined;
20
19
  show?: (() => void) | undefined;
21
20
  setTippyProps?: ((props: Partial<TippyProps>) => void) | undefined;
@@ -0,0 +1,40 @@
1
+ <script>import { createEventDispatcher } from "svelte";
2
+ import { SelectorList, DropDown, Icon } from "../index.js";
3
+ import { parseOptions } from "../../utils/options.js";
4
+ import { mdiUnfoldMoreHorizontal } from "@mdi/js";
5
+ export let options;
6
+ $:
7
+ _options = parseOptions(options);
8
+ let trigger;
9
+ let dropDown;
10
+ const dispatch = createEventDispatcher();
11
+ function onSelect(index) {
12
+ const option = _options[index];
13
+ dispatch("select", option.value);
14
+ dropDown.hide();
15
+ }
16
+ </script>
17
+
18
+ <DropDown bind:this={dropDown}>
19
+ <div class="contents" bind:this={trigger} slot="activator">
20
+ <slot>
21
+ <button type="button" class="flex h-12 items-center gap-2 rounded-lg border pl-4 pr-2">
22
+ <span>Menu</span>
23
+ <Icon class="ml-auto" path={mdiUnfoldMoreHorizontal} size={18} />
24
+ </button>
25
+ </slot>
26
+ </div>
27
+
28
+ <SelectorList
29
+ {trigger}
30
+ items={_options.map((opt) => ({ id: opt.value, ...opt }))}
31
+ let:item
32
+ on:select={({ detail }) => onSelect(detail)}
33
+ class="w-full"
34
+ >
35
+ {#if item.icon}
36
+ <Icon path={item.icon} size={18} class="opacity-70" />
37
+ {/if}
38
+ <span class="whitespace-nowrap pr-4">{item.label}</span>
39
+ </SelectorList>
40
+ </DropDown>
@@ -0,0 +1,21 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type Options } from '../../utils/options.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ options: Options;
6
+ };
7
+ events: {
8
+ select: CustomEvent<string>;
9
+ } & {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {
13
+ default: {};
14
+ };
15
+ };
16
+ export type DropDownMenuProps = typeof __propDef.props;
17
+ export type DropDownMenuEvents = typeof __propDef.events;
18
+ export type DropDownMenuSlots = typeof __propDef.slots;
19
+ export default class DropDownMenu extends SvelteComponent<DropDownMenuProps, DropDownMenuEvents, DropDownMenuSlots> {
20
+ }
21
+ export {};
@@ -1,2 +1,3 @@
1
1
  export { default as DropDown } from './DropDown.svelte';
2
2
  export { default as ContextMenu } from './ContextMenu.svelte';
3
+ export { default as DropDownMenu } from './DropDownMenu.svelte';
@@ -1,2 +1,3 @@
1
1
  export { default as DropDown } from './DropDown.svelte';
2
2
  export { default as ContextMenu } from './ContextMenu.svelte';
3
+ export { default as DropDownMenu } from './DropDownMenu.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod and more",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",