lutra 0.1.11 → 0.1.12

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,19 +1,25 @@
1
1
  <script lang="ts">
2
2
  import type { Component, Snippet } from "svelte";
3
+ import Icon from "./Icon.svelte";
3
4
 
4
5
  let {
5
6
  text,
6
7
  snippet,
7
8
  component: Comp,
8
- props
9
+ props,
10
+ icon
9
11
  }: {
10
12
  text?: string;
11
- snippet?: Snippet<any[]>;
13
+ snippet?: Snippet;
12
14
  component?: Component;
13
15
  props?: any;
16
+ icon?: string | Component;
14
17
  } = $props();
15
18
  </script>
16
19
 
20
+ {#if icon}
21
+ <Icon {icon} alt={text} />
22
+ {/if}
17
23
  {#if text}
18
24
  {text}
19
25
  {/if}
@@ -22,4 +28,10 @@
22
28
  {/if}
23
29
  {#if Comp}
24
30
  <Comp {...props} />
25
- {/if}
31
+ {/if}
32
+
33
+ <style>
34
+ :global(.Icon) {
35
+ margin-inline-end: var(--menu-item-icon-gap, var(--space-sm));
36
+ }
37
+ </style>
@@ -1,9 +1,10 @@
1
1
  import type { Component, Snippet } from "svelte";
2
2
  type $$ComponentProps = {
3
3
  text?: string;
4
- snippet?: Snippet<any[]>;
4
+ snippet?: Snippet;
5
5
  component?: Component;
6
6
  props?: any;
7
+ icon?: string | Component;
7
8
  };
8
9
  declare const MenuItemContent: Component<$$ComponentProps, {}, "">;
9
10
  type MenuItemContent = ReturnType<typeof MenuItemContent>;
@@ -9,9 +9,11 @@ export type MenuItem = {
9
9
  /** Text label of the item to display to the user. */
10
10
  text?: string;
11
11
  /** Snippet to display. */
12
- snippet?: Snippet<any[]>;
12
+ snippet?: Snippet;
13
13
  /** Component to display. */
14
14
  component?: Component;
15
+ /** Icon to display. Pass either a Svelte Component or an URL. Use the Icon component to recolor your icons according to the user theme. */
16
+ icon?: string | Component;
15
17
  /** Color to use for the item. */
16
18
  color?: StatusColorOrString;
17
19
  } | {
@@ -27,7 +29,7 @@ export type MenuItem = {
27
29
  /** Text label of the item to display to the user. */
28
30
  text?: string;
29
31
  /** Snippet to display. */
30
- snippet?: Snippet<any[]>;
32
+ snippet?: Snippet;
31
33
  /** Component to display. */
32
34
  component?: Component;
33
35
  /** Keyboard shortcut to display next to the item. */
@@ -65,7 +67,7 @@ export type TabbedContentItem = {
65
67
  /** Content to display when the item is selected. */
66
68
  text?: string;
67
69
  /** Snippet to display. */
68
- snippet?: Snippet<any[]>;
70
+ snippet?: Snippet;
69
71
  /** Component to display. */
70
72
  component?: Component;
71
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lutra",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",