@skeletonlabs/skeleton 1.7.1 → 1.8.0-dev.94c6548f

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,3 +1,6 @@
1
- export declare function filter(node: HTMLElement, filterName: string): {
2
- update(newArgs: any): void;
1
+ type Filters = ['Apollo', 'BlueNight', 'Emerald', 'GreenFall', 'Noir', 'NoirLight', 'Rustic', 'Summer84', 'XPro'];
2
+ type FilterName = `#${Filters[number]}` | (string & {});
3
+ export declare function filter(node: HTMLElement, filterName: FilterName): {
4
+ update(newArgs: FilterName): void;
3
5
  } | undefined;
6
+ export {};
@@ -23,9 +23,9 @@ const cInterface = "space-y-4";
23
23
  const cChipList = "flex flex-wrap gap-2";
24
24
  const cInputField = "unstyled bg-transparent border-0 !ring-0 p-0 w-full";
25
25
  let inputValid = true;
26
- let chipValues = value.map((val) => {
26
+ let chipValues = value?.map((val) => {
27
27
  return { val, id: Math.random() };
28
- });
28
+ }) || [];
29
29
  function resetFormHandler() {
30
30
  value = [];
31
31
  }
@@ -95,11 +95,11 @@ $:
95
95
  $:
96
96
  classesInputField = `${cInputField}`;
97
97
  $:
98
- chipValues = value.map((val, i) => {
98
+ chipValues = value?.map((val, i) => {
99
99
  if (chipValues[i]?.val === val)
100
100
  return chipValues[i];
101
101
  return { id: Math.random(), val };
102
- });
102
+ }) || [];
103
103
  </script>
104
104
 
105
105
  <div class="input-chip {classesBase}" class:opacity-50={$$restProps.disabled}>
@@ -0,0 +1,42 @@
1
+ <script>import { createEventDispatcher } from "svelte/internal";
2
+ export let value = 0;
3
+ export let max = 5;
4
+ export let interactive = false;
5
+ export let text = "text-token";
6
+ export let fill = "fill-token";
7
+ export let justify = "justify-center";
8
+ export let spacing = "space-x-2";
9
+ export let regionIcon = "";
10
+ const dispatch = createEventDispatcher();
11
+ function iconClick(index) {
12
+ dispatch("icon", {
13
+ index: index + 1
14
+ });
15
+ }
16
+ const cBase = "w-full flex";
17
+ $:
18
+ elemInteractive = interactive ? "button" : "span";
19
+ $:
20
+ attrInteractive = interactive ? { type: "button" } : {};
21
+ $:
22
+ classesBase = `${cBase} ${text} ${fill} ${justify} ${spacing} ${$$props.class ?? ""}`;
23
+ </script>
24
+
25
+ <div class="ratings {classesBase}" data-testid="rating-bar">
26
+ <!-- eslint-disable-next-line @typescript-eslint/no-unused-vars -->
27
+ {#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>
36
+ {:else}
37
+ <svelte:element this={elemInteractive} {...attrInteractive} class="rating-icon {regionIcon}" on:click={() => iconClick(i)}>
38
+ <slot name="empty" />
39
+ </svelte:element>
40
+ {/if}
41
+ {/each}
42
+ </div>
@@ -0,0 +1,36 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ /** Current rating value.*/
6
+ value?: number | undefined;
7
+ /** Maximum rating value.*/
8
+ max?: number | undefined;
9
+ /** Enables interactive mode for each rating icon.*/
10
+ interactive?: boolean | undefined;
11
+ /** Provide classes to set the text color.*/
12
+ text?: string | undefined;
13
+ /** Provide classes to set the SVG fill color.*/
14
+ fill?: string | undefined;
15
+ /** Provide classes to set the flexbox justification.*/
16
+ justify?: string | undefined;
17
+ /** Provide classes to set the horizontal spacing style.*/
18
+ spacing?: string | undefined;
19
+ /** Provide arbitrary classes to the icon region.*/
20
+ regionIcon?: string | undefined;
21
+ };
22
+ events: {
23
+ [evt: string]: CustomEvent<any>;
24
+ };
25
+ slots: {
26
+ full: {};
27
+ half: {};
28
+ empty: {};
29
+ };
30
+ };
31
+ export type RatingsProps = typeof __propDef.props;
32
+ export type RatingsEvents = typeof __propDef.events;
33
+ export type RatingsSlots = typeof __propDef.slots;
34
+ export default class Ratings extends SvelteComponentTyped<RatingsProps, RatingsEvents, RatingsSlots> {
35
+ }
36
+ export {};
@@ -2,6 +2,7 @@
2
2
  export let group;
3
3
  export let name;
4
4
  export let value;
5
+ export let title = "";
5
6
  export let controls = "";
6
7
  export let regionTab = "";
7
8
  export let active = getContext("active");
@@ -67,7 +68,7 @@ function prunedRestProps() {
67
68
  }
68
69
  </script>
69
70
 
70
- <label class={classesBase}>
71
+ <label class={classesBase} {title}>
71
72
  <!-- A11y attributes are not allowed on <label> -->
72
73
  <div
73
74
  class="tab {classesTab}"
@@ -8,6 +8,8 @@ declare const __propDef: {
8
8
  name: string;
9
9
  /** Set the input's value.*/
10
10
  value: any;
11
+ /** Provide a hoverable title attribute for the tab.*/
12
+ title?: string | undefined;
11
13
  /** Set the ARIA controls value to define which panel this tab controls.*/
12
14
  controls?: string | undefined;
13
15
  /** Provide arbitrary classes to style the tab region.*/
@@ -0,0 +1,44 @@
1
+ <script>import { getContext } from "svelte";
2
+ export let selected = false;
3
+ export let controls = "";
4
+ export let active = getContext("active");
5
+ export let hover = getContext("hover");
6
+ export let flex = getContext("flex");
7
+ export let padding = getContext("padding");
8
+ export let rounded = getContext("rounded");
9
+ export let spacing = getContext("spacing");
10
+ const cBase = "text-center cursor-pointer transition-colors duration-100";
11
+ const cInterface = "";
12
+ $:
13
+ classesActive = selected ? active : hover;
14
+ $:
15
+ classesBase = `${cBase} ${flex} ${padding} ${rounded} ${classesActive} ${$$props.class ?? ""}`;
16
+ $:
17
+ classesInterface = `${cInterface} ${spacing}`;
18
+ function prunedRestProps() {
19
+ delete $$restProps.class;
20
+ return $$restProps;
21
+ }
22
+ </script>
23
+
24
+ <a
25
+ class="tab-anchor {classesBase}"
26
+ href={$$props.href}
27
+ {...prunedRestProps()}
28
+ aria-controls={controls}
29
+ on:click
30
+ on:keydown
31
+ on:keyup
32
+ on:keypress
33
+ on:mouseover
34
+ on:mouseleave
35
+ on:focus
36
+ on:blur
37
+ data-testid="tab-anchor"
38
+ >
39
+ <!-- Interface -->
40
+ <div class="tab-interface {classesInterface}">
41
+ {#if $$slots.lead}<div class="tab-lead"><slot name="lead" /></div>{/if}
42
+ <div class="tab-label"><slot /></div>
43
+ </div>
44
+ </a>
@@ -0,0 +1,44 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ /** Enables the active state styles when set true.*/
6
+ selected?: boolean | undefined;
7
+ /** Set the ARIA controls value to define which panel this tab controls.*/
8
+ controls?: string | undefined;
9
+ /** Provide classes to style each tab's active styles.*/
10
+ active?: string | undefined;
11
+ /** Provide classes to style each tab's hover styles.*/
12
+ hover?: string | undefined;
13
+ /** Provide classes to style each tab's flex styles.*/
14
+ flex?: string | undefined;
15
+ /** Provide classes to style each tab's padding styles.*/
16
+ padding?: string | undefined;
17
+ /** Provide classes to style each tab's box radius styles.*/
18
+ rounded?: string | undefined;
19
+ /** Provide classes to set the vertical spacing between items.*/
20
+ spacing?: string | undefined;
21
+ };
22
+ events: {
23
+ click: MouseEvent;
24
+ keydown: KeyboardEvent;
25
+ keyup: KeyboardEvent;
26
+ keypress: KeyboardEvent;
27
+ mouseover: MouseEvent;
28
+ mouseleave: MouseEvent;
29
+ focus: FocusEvent;
30
+ blur: FocusEvent;
31
+ } & {
32
+ [evt: string]: CustomEvent<any>;
33
+ };
34
+ slots: {
35
+ lead: {};
36
+ default: {};
37
+ };
38
+ };
39
+ export type TabAnchorProps = typeof __propDef.props;
40
+ export type TabAnchorEvents = typeof __propDef.events;
41
+ export type TabAnchorSlots = typeof __propDef.slots;
42
+ export default class TabAnchor extends SvelteComponentTyped<TabAnchorProps, TabAnchorEvents, TabAnchorSlots> {
43
+ }
44
+ export {};
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ export { default as ListBoxItem } from './components/ListBox/ListBoxItem.svelte'
38
38
  export { default as Paginator } from './components/Paginator/Paginator.svelte';
39
39
  export { default as ProgressBar } from './components/ProgressBar/ProgressBar.svelte';
40
40
  export { default as ProgressRadial } from './components/ProgressRadial/ProgressRadial.svelte';
41
+ export { default as Ratings } from './components/Ratings/Ratings.svelte';
41
42
  export { default as RadioGroup } from './components/Radio/RadioGroup.svelte';
42
43
  export { default as RadioItem } from './components/Radio/RadioItem.svelte';
43
44
  export { default as RangeSlider } from './components/RangeSlider/RangeSlider.svelte';
@@ -47,6 +48,7 @@ export { default as Step } from './components/Stepper/Step.svelte';
47
48
  export { default as Table } from './components/Table/Table.svelte';
48
49
  export { default as TabGroup } from './components/Tab/TabGroup.svelte';
49
50
  export { default as Tab } from './components/Tab/Tab.svelte';
51
+ export { default as TabAnchor } from './components/Tab/TabAnchor.svelte';
50
52
  export { default as TableOfContents } from './components/TableOfContents/TableOfContents.svelte';
51
53
  export { default as CodeBlock } from './utilities/CodeBlock/CodeBlock.svelte';
52
54
  export { default as Modal } from './utilities/Modal/Modal.svelte';
package/dist/index.js CHANGED
@@ -47,6 +47,7 @@ export { default as ListBoxItem } from './components/ListBox/ListBoxItem.svelte'
47
47
  export { default as Paginator } from './components/Paginator/Paginator.svelte';
48
48
  export { default as ProgressBar } from './components/ProgressBar/ProgressBar.svelte';
49
49
  export { default as ProgressRadial } from './components/ProgressRadial/ProgressRadial.svelte';
50
+ export { default as Ratings } from './components/Ratings/Ratings.svelte';
50
51
  export { default as RadioGroup } from './components/Radio/RadioGroup.svelte';
51
52
  export { default as RadioItem } from './components/Radio/RadioItem.svelte';
52
53
  export { default as RangeSlider } from './components/RangeSlider/RangeSlider.svelte';
@@ -56,6 +57,7 @@ export { default as Step } from './components/Stepper/Step.svelte';
56
57
  export { default as Table } from './components/Table/Table.svelte';
57
58
  export { default as TabGroup } from './components/Tab/TabGroup.svelte';
58
59
  export { default as Tab } from './components/Tab/Tab.svelte';
60
+ export { default as TabAnchor } from './components/Tab/TabAnchor.svelte';
59
61
  export { default as TableOfContents } from './components/TableOfContents/TableOfContents.svelte';
60
62
  // Utility Components
61
63
  export { default as CodeBlock } from './utilities/CodeBlock/CodeBlock.svelte';
@@ -10,9 +10,9 @@
10
10
  @apply prose-headings:text-token;
11
11
  /* @apply prose-lead:{utility}; */
12
12
  @apply prose-h1:font-heading-token prose-h1:text-3xl prose-h1:md:text-5xl;
13
- @apply prose-h2:font-heading-token prose-h1:text-2xl prose-h1:md:text-4xl;
14
- @apply prose-h3:font-heading-token prose-h1:text-xl prose-h1:md:text-2xl;
15
- @apply prose-h4:font-heading-token prose-h1:text-lg prose-h1:md:text-xl;
13
+ @apply prose-h2:font-heading-token prose-h2:text-2xl prose-h2:md:text-4xl;
14
+ @apply prose-h3:font-heading-token prose-h3:text-xl prose-h3:md:text-2xl;
15
+ @apply prose-h4:font-heading-token prose-h4:text-lg prose-h4:md:text-xl;
16
16
  @apply prose-p:text-base;
17
17
  /* @apply prose-a:{utility}; */
18
18
  @apply prose-a:text-primary-700 prose-a:dark:text-primary-500 prose-a:hover:brightness-110 prose-a:underline;