@skeletonlabs/skeleton 1.9.0-dev.1226d909 → 1.9.0-dev.4e13b4f1

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.
@@ -10,21 +10,32 @@ export let regionTrail = "";
10
10
  export let hover = "bg-primary-hover-token";
11
11
  export let active = "bg-primary-active-token";
12
12
  export let spacing = "space-y-1";
13
+ export let aspectRatio = "aspect-square";
13
14
  setContext("active", active);
14
15
  setContext("hover", hover);
15
16
  setContext("spacing", spacing);
17
+ setContext("aspectRatio", aspectRatio);
16
18
  const cBase = "grid grid-rows-[auto_1fr_auto] overflow-y-auto";
19
+ const cRegionLead = "box-border";
20
+ const cRegionDefault = "box-border";
21
+ const cRegionTrail = "box-border";
17
22
  $:
18
23
  classesBase = `${cBase} ${background} ${border} ${width} ${height} ${gap} ${$$props.class || ""}`;
24
+ $:
25
+ classesRegionLead = `${cRegionLead} ${regionLead}`;
26
+ $:
27
+ classesRegionDefault = `${cRegionDefault} ${regionDefault}`;
28
+ $:
29
+ classesRegionTrail = `${cRegionTrail} ${regionTrail}`;
19
30
  </script>
20
31
 
21
32
  <!-- @component A vertical navigation rail component. -->
22
33
 
23
34
  <div class="app-rail {classesBase}" data-testid="app-rail">
24
35
  <!-- Slot: lead -->
25
- <div class="app-bar-lead {regionLead}"><slot name="lead" /></div>
36
+ <div class="app-bar-lead {classesRegionLead}"><slot name="lead" /></div>
26
37
  <!-- Slot: Default -->
27
- <div class="app-bar-default {regionDefault}"><slot /></div>
38
+ <div class="app-bar-default {classesRegionDefault}"><slot /></div>
28
39
  <!-- Slot: lead -->
29
- <div class="app-bar-trail {regionTrail}"><slot name="trail" /></div>
40
+ <div class="app-bar-trail {classesRegionTrail}"><slot name="trail" /></div>
30
41
  </div>
@@ -18,12 +18,14 @@ declare const __propDef: {
18
18
  regionDefault?: string | undefined;
19
19
  /** Rail: Provide arbitrary classes to the trail region.*/
20
20
  regionTrail?: string | undefined;
21
- /** Tile: Provide classes to set the tile hover background color.*/
21
+ /** Provide classes to set the tile/anchor hover background color.*/
22
22
  hover?: string | undefined;
23
- /** Tile: Provide classes to set the tile active tile background.*/
23
+ /** Provide classes to set the tile/anchor active tile background.*/
24
24
  active?: string | undefined;
25
- /** Tile: Provide classes to set the tile vertical spacing.*/
25
+ /** Provide classes to set the tile/anchor vertical spacing.*/
26
26
  spacing?: string | undefined;
27
+ /** Provide classes to set the tile/anchor aspect ratio.*/
28
+ aspectRatio?: string | undefined;
27
29
  };
28
30
  events: {
29
31
  [evt: string]: CustomEvent<any>;
@@ -5,15 +5,16 @@ export let regionLabel = "";
5
5
  export let hover = getContext("hover");
6
6
  export let active = getContext("active");
7
7
  export let spacing = getContext("spacing");
8
+ export let aspectRatio = getContext("aspectRatio");
8
9
  const cBase = "unstyled";
9
- const cWrapper = "w-full aspect-square flex flex-col justify-center items-stretch text-center space-y-1";
10
+ const cWrapper = "w-full flex flex-col justify-center items-stretch text-center space-y-1";
10
11
  const cLabel = "font-bold text-xs";
11
12
  $:
12
13
  classActive = selected ? active : "";
13
14
  $:
14
- classesBase = `${cBase} ${$$props.class || ""}`;
15
+ classesBase = `${cBase} ${$$props.class || ""}`;
15
16
  $:
16
- classesWrapper = `${cWrapper} ${hover} ${spacing} ${classActive}`;
17
+ classesWrapper = `${cWrapper} ${aspectRatio} ${hover} ${spacing} ${classActive}`;
17
18
  $:
18
19
  classesLead = `${regionLead}`;
19
20
  $:
@@ -11,6 +11,7 @@ declare const __propDef: {
11
11
  hover?: string | undefined;
12
12
  active?: string | undefined;
13
13
  spacing?: string | undefined;
14
+ aspectRatio?: string | undefined;
14
15
  };
15
16
  events: {
16
17
  click: MouseEvent;
@@ -8,17 +8,19 @@ export let regionLabel = "";
8
8
  export let hover = getContext("hover");
9
9
  export let active = getContext("active");
10
10
  export let spacing = getContext("spacing");
11
+ export let width = getContext("width");
12
+ export let aspectRatio = getContext("aspectRatio");
11
13
  const cBase = "cursor-pointer";
12
- const cWrapper = "w-full aspect-square flex flex-col justify-center items-stretch";
14
+ const cWrapper = "flex flex-col justify-center items-stretch";
13
15
  const cInterface = "text-center";
14
16
  const cLabel = "font-bold text-xs";
15
17
  let elemInput;
16
18
  $:
17
19
  classActive = group === value ? active : "";
18
20
  $:
19
- classesBase = `${cBase} ${$$props.class || ""}`;
21
+ classesBase = `${cBase} ${$$props.class || ""}`;
20
22
  $:
21
- classesWrapper = `${cWrapper} ${hover} ${classActive}`;
23
+ classesWrapper = `${cWrapper} ${aspectRatio} ${width} ${hover} ${classActive}`;
22
24
  $:
23
25
  classesInterface = `${cInterface} ${spacing}`;
24
26
  $:
@@ -17,6 +17,8 @@ declare const __propDef: {
17
17
  hover?: string | undefined;
18
18
  active?: string | undefined;
19
19
  spacing?: string | undefined;
20
+ width?: string | undefined;
21
+ aspectRatio?: string | undefined;
20
22
  };
21
23
  events: {
22
24
  mouseover: MouseEvent;
@@ -17,20 +17,18 @@ export let duration = 200;
17
17
  const deprecated = [whitelist, blacklist, duration];
18
18
  $:
19
19
  listedOptions = options;
20
- function filterByAllowed() {
20
+ function filterByAllowDeny() {
21
+ let _options = [...options];
21
22
  if (allowlist.length) {
22
- listedOptions = [...options].filter((option) => allowlist.includes(option.value));
23
- } else {
24
- listedOptions = [...options];
23
+ _options = _options.filter((option) => allowlist.includes(option.value));
25
24
  }
26
- }
27
- function filterByDenied() {
28
25
  if (denylist.length) {
29
- const denySet = new Set(denylist);
30
- listedOptions = [...options].filter((option) => !denySet.has(option.value));
31
- } else {
32
- listedOptions = [...options];
26
+ _options = _options.filter((option) => !denylist.includes(option.value));
27
+ }
28
+ if (!allowlist.length && !denylist.length) {
29
+ _options = options;
33
30
  }
31
+ listedOptions = _options;
34
32
  }
35
33
  function filterOptions() {
36
34
  let _options = [...listedOptions];
@@ -46,11 +44,8 @@ function onSelection(option) {
46
44
  dispatch("selection", option);
47
45
  }
48
46
  $:
49
- if (allowlist)
50
- filterByAllowed();
51
- $:
52
- if (denylist)
53
- filterByDenied();
47
+ if (allowlist.length || denylist.length)
48
+ filterByAllowDeny();
54
49
  $:
55
50
  optionsFiltered = input ? filterOptions() : listedOptions;
56
51
  $:
@@ -13,11 +13,13 @@ function iconClick(index) {
13
13
  index: index + 1
14
14
  });
15
15
  }
16
+ function isFull(value2, index) {
17
+ return Math.floor(value2) >= index + 1;
18
+ }
19
+ function isHalf(value2, index) {
20
+ return value2 === index + 0.5;
21
+ }
16
22
  const cBase = "w-full flex";
17
- $:
18
- elemInteractive = interactive ? "button" : "span";
19
- $:
20
- attrInteractive = interactive ? { type: "button" } : {};
21
23
  $:
22
24
  classesBase = `${cBase} ${text} ${fill} ${justify} ${spacing} ${$$props.class ?? ""}`;
23
25
  </script>
@@ -25,18 +27,26 @@ $:
25
27
  <div class="ratings {classesBase}" data-testid="rating-bar">
26
28
  <!-- eslint-disable-next-line @typescript-eslint/no-unused-vars -->
27
29
  {#each Array(max) as _, i}
28
- {#if Math.floor(value) >= i + 1}
29
- <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
30
- <slot name="full" />
31
- </svelte:element>
32
- {:else if value === i + 0.5}
33
- <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
34
- <slot name="half" />
35
- </svelte:element>
30
+ {#if interactive}
31
+ <button class="rating-icon {regionIcon}" type="button" on:click={() => iconClick(i)}>
32
+ {#if isFull(value, i)}
33
+ <slot name="full" />
34
+ {:else if isHalf(value, i)}
35
+ <slot name="half" />
36
+ {:else}
37
+ <slot name="empty" />
38
+ {/if}
39
+ </button>
36
40
  {:else}
37
- <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
38
- <slot name="empty" />
39
- </svelte:element>
41
+ <span class="rating-icon {regionIcon}">
42
+ {#if isFull(value, i)}
43
+ <slot name="full" />
44
+ {:else if isHalf(value, i)}
45
+ <slot name="half" />
46
+ {:else}
47
+ <slot name="empty" />
48
+ {/if}
49
+ </span>
40
50
  {/if}
41
51
  {/each}
42
52
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "1.9.0-dev.1226d909",
3
+ "version": "1.9.0-dev.4e13b4f1",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "repository": {