@skeletonlabs/skeleton 1.8.0-dev.cbef3c34 → 1.8.0-dev.ee949507

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,6 +1,7 @@
1
1
  <script>import { createEventDispatcher } from "svelte/internal";
2
2
  export let value = 0;
3
3
  export let max = 5;
4
+ export let interactive = false;
4
5
  export let text = "text-token";
5
6
  export let fill = "fill-token";
6
7
  export let justify = "justify-center";
@@ -13,6 +14,10 @@ function iconClick(index) {
13
14
  });
14
15
  }
15
16
  const cBase = "w-full flex";
17
+ $:
18
+ elemInteractive = interactive ? "button" : "span";
19
+ $:
20
+ attrInteractive = interactive ? { type: "button" } : {};
16
21
  $:
17
22
  classesBase = `${cBase} ${text} ${fill} ${justify} ${spacing} ${$$props.class ?? ""}`;
18
23
  </script>
@@ -21,11 +26,17 @@ $:
21
26
  <!-- eslint-disable-next-line @typescript-eslint/no-unused-vars -->
22
27
  {#each Array(max) as _, i}
23
28
  {#if Math.floor(value) >= i + 1}
24
- <button type="button" class="rating-icon {regionIcon}" on:click={() => iconClick(i)}><slot name="full" /></button>
29
+ <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
30
+ <slot name="full" />
31
+ </svelte:element>
25
32
  {:else if value === i + 0.5}
26
- <button type="button" class="rating-icon {regionIcon}" on:click={() => iconClick(i)}><slot name="half" /></button>
33
+ <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
34
+ <slot name="half" />
35
+ </svelte:element>
27
36
  {:else}
28
- <button type="button" class="rating-icon {regionIcon}" on:click={() => iconClick(i)}><slot name="empty" /></button>
37
+ <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
38
+ <slot name="empty" />
39
+ </svelte:element>
29
40
  {/if}
30
41
  {/each}
31
42
  </div>
@@ -6,6 +6,8 @@ declare const __propDef: {
6
6
  value?: number | undefined;
7
7
  /** Maximum rating value.*/
8
8
  max?: number | undefined;
9
+ /** Enables interactive mode for each rating icon.*/
10
+ interactive?: boolean | undefined;
9
11
  /** Provide classes to set the text color.*/
10
12
  text?: string | undefined;
11
13
  /** Provide classes to set the SVG fill color.*/
@@ -136,6 +136,7 @@ $:
136
136
  use:focusTrap={true}
137
137
  >
138
138
  <!-- Drawer -->
139
+ <!-- separate In/Out so anim values update -->
139
140
  <div
140
141
  bind:this={elemDrawer}
141
142
  class="drawer {classesDrawer}"
@@ -144,7 +145,8 @@ $:
144
145
  aria-modal="true"
145
146
  aria-labelledby={labelledby}
146
147
  aria-describedby={describedby}
147
- transition:fly|local={{ x: anim.x, y: anim.y, duration }}
148
+ in:fly|local={{ x: anim.x, y: anim.y, duration }}
149
+ out:fly|local={{ x: anim.x, y: anim.y, duration }}
148
150
  >
149
151
  <!-- Slot: Default -->
150
152
  <slot />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "1.8.0-dev.cbef3c34",
3
+ "version": "1.8.0-dev.ee949507",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "repository": {