@skeletonlabs/skeleton 1.12.0-dev.b329241e → 2.0.0-dev.54f4eced

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.
Files changed (137) hide show
  1. package/dist/components/Accordion/Accordion.svelte +15 -3
  2. package/dist/components/Accordion/Accordion.svelte.d.ts +17 -23
  3. package/dist/components/Accordion/AccordionItem.svelte +8 -3
  4. package/dist/components/Accordion/AccordionItem.svelte.d.ts +15 -25
  5. package/dist/components/AppRail/AppRailTile.svelte +1 -1
  6. package/dist/components/Autocomplete/Autocomplete.svelte +17 -7
  7. package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +17 -27
  8. package/dist/components/Avatar/Avatar.svelte +1 -1
  9. package/dist/components/ConicGradient/ConicGradient.svelte +1 -1
  10. package/dist/components/FileButton/FileButton.svelte +2 -3
  11. package/dist/components/InputChip/InputChip.svelte +31 -4
  12. package/dist/components/InputChip/InputChip.svelte.d.ts +22 -27
  13. package/dist/components/Paginator/Paginator.svelte +17 -15
  14. package/dist/components/Paginator/Paginator.svelte.d.ts +2 -2
  15. package/dist/components/Paginator/types.d.ts +2 -2
  16. package/dist/components/Ratings/Ratings.svelte +1 -1
  17. package/dist/components/Stepper/Step.svelte +11 -2
  18. package/dist/components/Stepper/Step.svelte.d.ts +15 -12
  19. package/dist/components/Stepper/Stepper.svelte +21 -3
  20. package/dist/components/Stepper/Stepper.svelte.d.ts +17 -27
  21. package/dist/components/Tab/TabGroup.svelte +1 -1
  22. package/dist/components/Table/Table.svelte +1 -1
  23. package/dist/components/TreeView/TreeView.svelte +45 -2
  24. package/dist/components/TreeView/TreeView.svelte.d.ts +21 -0
  25. package/dist/components/TreeView/TreeViewDataDrivenItem.svelte +90 -0
  26. package/dist/components/TreeView/TreeViewDataDrivenItem.svelte.d.ts +27 -0
  27. package/dist/components/TreeView/TreeViewItem.svelte +220 -10
  28. package/dist/components/TreeView/TreeViewItem.svelte.d.ts +95 -2
  29. package/dist/components/TreeView/types.d.ts +18 -0
  30. package/dist/components/TreeView/types.js +1 -0
  31. package/dist/index.d.ts +15 -12
  32. package/dist/index.js +11 -12
  33. package/dist/internal/transitions.d.ts +10 -0
  34. package/dist/internal/transitions.js +11 -0
  35. package/dist/transitions/crossfade.d.ts +1 -0
  36. package/dist/transitions/crossfade.js +21 -0
  37. package/dist/types.d.ts +8 -0
  38. package/dist/types.js +1 -0
  39. package/dist/utilities/Drawer/Drawer.svelte +33 -12
  40. package/dist/utilities/Drawer/Drawer.svelte.d.ts +4 -2
  41. package/dist/utilities/Drawer/stores.d.ts +24 -1
  42. package/dist/utilities/Drawer/stores.js +31 -2
  43. package/dist/utilities/Drawer/types.d.ts +3 -0
  44. package/dist/utilities/Modal/Modal.svelte +21 -23
  45. package/dist/utilities/Modal/Modal.svelte.d.ts +17 -37
  46. package/dist/utilities/Modal/ModalTest.svelte +8 -0
  47. package/dist/utilities/Modal/ModalTest.svelte.d.ts +17 -0
  48. package/dist/utilities/Modal/stores.d.ts +24 -1
  49. package/dist/utilities/Modal/stores.js +31 -1
  50. package/dist/utilities/Modal/types.d.ts +1 -0
  51. package/dist/utilities/PrefersReducedMotion/PrefersReducedMotion.d.ts +7 -0
  52. package/dist/utilities/PrefersReducedMotion/PrefersReducedMotion.js +26 -0
  53. package/dist/utilities/TableOfContents/TableOfContents.svelte +56 -0
  54. package/dist/utilities/TableOfContents/TableOfContents.svelte.d.ts +34 -0
  55. package/dist/utilities/TableOfContents/crawler.d.ts +16 -0
  56. package/dist/utilities/TableOfContents/crawler.js +78 -0
  57. package/dist/utilities/TableOfContents/stores.d.ts +6 -0
  58. package/dist/utilities/TableOfContents/stores.js +5 -0
  59. package/dist/utilities/TableOfContents/types.d.ts +5 -0
  60. package/dist/utilities/TableOfContents/types.js +2 -0
  61. package/dist/utilities/Toast/Toast.svelte +24 -23
  62. package/dist/utilities/Toast/Toast.svelte.d.ts +17 -24
  63. package/dist/utilities/Toast/ToastTest.svelte +12 -0
  64. package/dist/utilities/Toast/ToastTest.svelte.d.ts +18 -0
  65. package/dist/utilities/Toast/stores.d.ts +27 -5
  66. package/dist/utilities/Toast/stores.js +60 -29
  67. package/dist/utilities/Toast/types.d.ts +1 -0
  68. package/dist/utilities/index.d.ts +18 -0
  69. package/dist/utilities/index.js +25 -0
  70. package/package.json +3 -16
  71. package/dist/components/TableOfContents/TableOfContents.svelte +0 -111
  72. package/dist/components/TableOfContents/TableOfContents.svelte.d.ts +0 -44
  73. package/dist/styles/all.css +0 -30
  74. package/dist/styles/elements/alerts.css +0 -17
  75. package/dist/styles/elements/badges.css +0 -31
  76. package/dist/styles/elements/breadcrumbs.css +0 -36
  77. package/dist/styles/elements/buttons.css +0 -109
  78. package/dist/styles/elements/cards.css +0 -32
  79. package/dist/styles/elements/chips.css +0 -22
  80. package/dist/styles/elements/codeblocks.css +0 -16
  81. package/dist/styles/elements/forms.css +0 -283
  82. package/dist/styles/elements/lists.css +0 -51
  83. package/dist/styles/elements/logo-clouds.css +0 -29
  84. package/dist/styles/elements/modals.css +0 -15
  85. package/dist/styles/elements/placeholders.css +0 -17
  86. package/dist/styles/elements/popups.css +0 -16
  87. package/dist/styles/elements/tables.css +0 -102
  88. package/dist/styles/partials/core.css +0 -66
  89. package/dist/styles/partials/elements.css +0 -20
  90. package/dist/styles/partials/tailwind.css +0 -16
  91. package/dist/styles/partials/typography-next.css +0 -99
  92. package/dist/styles/partials/typography-prose.css +0 -49
  93. package/dist/styles/partials/typography.css +0 -99
  94. package/dist/styles/partials/variants.css +0 -204
  95. package/dist/styles/skeleton-minimal.css +0 -30
  96. package/dist/styles/skeleton.css +0 -30
  97. package/dist/tailwind/core.cjs +0 -37
  98. package/dist/tailwind/core.d.cts +0 -5
  99. package/dist/tailwind/generated/intellisense-classes.cjs +0 -1
  100. package/dist/tailwind/generated/intellisense-classes.d.cts +0 -2729
  101. package/dist/tailwind/intellisense.cjs +0 -21
  102. package/dist/tailwind/intellisense.d.cts +0 -5
  103. package/dist/tailwind/settings.cjs +0 -20
  104. package/dist/tailwind/settings.d.cts +0 -6
  105. package/dist/tailwind/skeleton.cjs +0 -19
  106. package/dist/tailwind/skeleton.d.cts +0 -7
  107. package/dist/tailwind/theme/colors.cjs +0 -18
  108. package/dist/tailwind/theme/colors.d.cts +0 -2
  109. package/dist/tailwind/tokens/backgrounds.cjs +0 -39
  110. package/dist/tailwind/tokens/backgrounds.d.cts +0 -2
  111. package/dist/tailwind/tokens/border-radius.cjs +0 -21
  112. package/dist/tailwind/tokens/border-radius.d.cts +0 -33
  113. package/dist/tailwind/tokens/borders.cjs +0 -20
  114. package/dist/tailwind/tokens/borders.d.cts +0 -6
  115. package/dist/tailwind/tokens/fills.cjs +0 -20
  116. package/dist/tailwind/tokens/fills.d.cts +0 -15
  117. package/dist/tailwind/tokens/rings.cjs +0 -50
  118. package/dist/tailwind/tokens/rings.d.cts +0 -22
  119. package/dist/tailwind/tokens/text.cjs +0 -31
  120. package/dist/tailwind/tokens/text.d.cts +0 -21
  121. package/dist/themes/theme-crimson.css +0 -100
  122. package/dist/themes/theme-gold-nouveau.css +0 -143
  123. package/dist/themes/theme-hamlindigo.css +0 -109
  124. package/dist/themes/theme-modern.css +0 -134
  125. package/dist/themes/theme-rocket.css +0 -120
  126. package/dist/themes/theme-sahara.css +0 -133
  127. package/dist/themes/theme-seafoam.css +0 -128
  128. package/dist/themes/theme-seasonal.css +0 -114
  129. package/dist/themes/theme-skeleton.css +0 -119
  130. package/dist/themes/theme-test.css +0 -96
  131. package/dist/themes/theme-vintage.css +0 -131
  132. package/dist/utilities/DataTable/DataTable.d.ts +0 -19
  133. package/dist/utilities/DataTable/DataTable.js +0 -137
  134. package/dist/utilities/DataTable/types.d.ts +0 -33
  135. package/dist/utilities/DataTable/types.js +0 -2
  136. /package/dist/{utilities/DataTable → components/Table}/actions.d.ts +0 -0
  137. /package/dist/{utilities/DataTable → components/Table}/actions.js +0 -0
@@ -1,7 +1,10 @@
1
- <script>import { writable } from "svelte/store";
1
+ <script context="module">import { slide } from "svelte/transition";
2
+ import { prefersReducedMotionStore } from "../../index.js";
3
+ </script>
4
+
5
+ <script generics="TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition">import { writable } from "svelte/store";
2
6
  import { setContext } from "svelte";
3
7
  export let autocollapse = false;
4
- export let duration = 200;
5
8
  export let width = "w-full";
6
9
  export let spacing = "space-y-1";
7
10
  export let disabled = false;
@@ -13,10 +16,14 @@ export let caretClosed = "";
13
16
  export let regionControl = "";
14
17
  export let regionPanel = "space-y-4";
15
18
  export let regionCaret = "";
19
+ export let transitions = !$prefersReducedMotionStore;
20
+ export let transitionIn = slide;
21
+ export let transitionInParams = { duration: 200 };
22
+ export let transitionOut = slide;
23
+ export let transitionOutParams = { duration: 200 };
16
24
  const active = writable(null);
17
25
  setContext("active", active);
18
26
  setContext("autocollapse", autocollapse);
19
- setContext("duration", duration);
20
27
  setContext("disabled", disabled);
21
28
  setContext("padding", padding);
22
29
  setContext("hover", hover);
@@ -26,6 +33,11 @@ setContext("caretClosed", caretClosed);
26
33
  setContext("regionControl", regionControl);
27
34
  setContext("regionPanel", regionPanel);
28
35
  setContext("regionCaret", regionCaret);
36
+ setContext("transitions", transitions);
37
+ setContext("transitionIn", transitionIn);
38
+ setContext("transitionInParams", transitionInParams);
39
+ setContext("transitionOut", transitionOut);
40
+ setContext("transitionOutParams", transitionOutParams);
29
41
  $:
30
42
  classesBase = `${width} ${spacing} ${$$props.class ?? ""}`;
31
43
  </script>
@@ -1,45 +1,39 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
2
+ import { slide } from 'svelte/transition';
3
+ import { type Transition, type TransitionParams } from '../../index.js';
4
+ type SlideTransition = typeof slide;
5
+ declare class __sveltets_Render<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> {
6
+ props(): {
4
7
  [x: string]: any;
5
- /** Set the auto-collapse mode.*/
6
8
  autocollapse?: boolean | undefined;
7
- /** Set the drawer animation duration in milliseconds.*/
8
- duration?: number | undefined;
9
- /** Provide classes to set the accordion width.*/
10
9
  width?: string | undefined;
11
- /** Provide classes to set the vertical spacing between items.*/
12
10
  spacing?: string | undefined;
13
- /** Set the accordion disabled state for all items.*/
14
11
  disabled?: boolean | undefined;
15
- /** Provide classes to set the accordion item padding styles.*/
16
12
  padding?: string | undefined;
17
- /** Provide classes to set the accordion item hover styles.*/
18
13
  hover?: string | undefined;
19
- /** Provide classes to set the accordion item rounded styles.*/
20
14
  rounded?: string | undefined;
21
- /** Set the rotation of the item caret in the open state.*/
22
15
  caretOpen?: string | undefined;
23
- /** Set the rotation of the item caret in the closed state.*/
24
16
  caretClosed?: string | undefined;
25
- /** Provide arbitrary classes to the trigger button region.*/
26
17
  regionControl?: string | undefined;
27
- /** Provide arbitrary classes to the content panel region.*/
28
18
  regionPanel?: string | undefined;
29
- /** Provide arbitrary classes to the caret icon region.*/
30
19
  regionCaret?: string | undefined;
20
+ transitions?: boolean | undefined;
21
+ transitionIn?: TransitionIn | undefined;
22
+ transitionInParams?: TransitionParams<TransitionIn> | undefined;
23
+ transitionOut?: TransitionOut | undefined;
24
+ transitionOutParams?: TransitionParams<TransitionOut> | undefined;
31
25
  };
32
- events: {
26
+ events(): {} & {
33
27
  [evt: string]: CustomEvent<any>;
34
28
  };
35
- slots: {
29
+ slots(): {
36
30
  default: {};
37
31
  };
38
- };
39
- export type AccordionProps = typeof __propDef.props;
40
- export type AccordionEvents = typeof __propDef.events;
41
- export type AccordionSlots = typeof __propDef.slots;
32
+ }
33
+ export type AccordionProps<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['props']>;
34
+ export type AccordionEvents<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['events']>;
35
+ export type AccordionSlots<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['slots']>;
42
36
  /** The Accordion parent element. */
43
- export default class Accordion extends SvelteComponentTyped<AccordionProps, AccordionEvents, AccordionSlots> {
37
+ export default class Accordion<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> extends SvelteComponentTyped<AccordionProps<TransitionIn, TransitionOut>, AccordionEvents<TransitionIn, TransitionOut>, AccordionSlots<TransitionIn, TransitionOut>> {
44
38
  }
45
39
  export {};
@@ -1,6 +1,6 @@
1
1
  <script>import { getContext } from "svelte";
2
2
  import { createEventDispatcher } from "svelte";
3
- import { slide } from "svelte/transition";
3
+ import { dynamicTransition } from "../../internal/transitions.js";
4
4
  const dispatch = createEventDispatcher();
5
5
  export let open = false;
6
6
  export let id = String(Math.random());
@@ -10,7 +10,6 @@ const cControlCaret = "fill-current w-3 transition-transform duration-[200ms]";
10
10
  const cPanel = "";
11
11
  export let autocollapse = getContext("autocollapse");
12
12
  export let active = getContext("active");
13
- export let duration = getContext("duration");
14
13
  export let disabled = getContext("disabled");
15
14
  export let padding = getContext("padding");
16
15
  export let hover = getContext("hover");
@@ -20,6 +19,11 @@ export let caretClosed = getContext("caretClosed");
20
19
  export let regionControl = getContext("regionControl");
21
20
  export let regionPanel = getContext("regionPanel");
22
21
  export let regionCaret = getContext("regionCaret");
22
+ export let transitions = getContext("transitions");
23
+ export let transitionIn = getContext("transitionIn");
24
+ export let transitionInParams = getContext("transitionInParams");
25
+ export let transitionOut = getContext("transitionOut");
26
+ export let transitionOutParams = getContext("transitionOutParams");
23
27
  function setActive(event) {
24
28
  if (autocollapse === true) {
25
29
  active.set(id);
@@ -93,7 +97,8 @@ $:
93
97
  <div
94
98
  class="accordion-panel {classesPanel}"
95
99
  id="accordion-panel-{id}"
96
- transition:slide|local={{ duration }}
100
+ in:dynamicTransition|local={{ transition: transitionIn, params: transitionInParams, enabled: transitions }}
101
+ out:dynamicTransition|local={{ transition: transitionOut, params: transitionOutParams, enabled: transitions }}
97
102
  role="region"
98
103
  aria-hidden={!openState}
99
104
  aria-labelledby="accordion-control-{id}"
@@ -1,43 +1,33 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { Writable } from 'svelte/store';
3
- declare const __propDef: {
4
- props: {
3
+ import type { Transition, TransitionParams } from '../../index.js';
4
+ declare class __sveltets_Render<TransitionIn extends Transition, TransitionOut extends Transition> {
5
+ props(): {
5
6
  [x: string]: any;
6
- /** Set open by default on load.*/
7
7
  open?: boolean | undefined;
8
- /** Provide a unique input id. Auto-generated by default*/
9
8
  id?: string | undefined;
10
- /** Set the auto-collapse mode.*/
11
9
  autocollapse?: boolean | undefined;
12
- /** The writable store that houses the auto-collapse active item UUID.*/
13
10
  active?: Writable<string | null> | undefined;
14
- /** Set the drawer animation duration.*/
15
- duration?: number | undefined;
16
- /** Set the disabled state for this item.*/
17
11
  disabled?: boolean | undefined;
18
- /** Provide classes to set the accordion item padding styles.*/
19
12
  padding?: string | undefined;
20
- /** Provide classes to set the accordion item hover styles.*/
21
13
  hover?: string | undefined;
22
- /** Provide classes to set the accordion item rounded styles.*/
23
14
  rounded?: string | undefined;
24
- /** Provide arbitrary classes to the trigger button region.*/
25
15
  caretOpen?: string | undefined;
26
- /** Provide arbitrary classes to content panel region.*/
27
16
  caretClosed?: string | undefined;
28
- /** Provide arbitrary classes to the trigger button region.*/
29
17
  regionControl?: string | undefined;
30
- /** Provide arbitrary classes to content panel region.*/
31
18
  regionPanel?: string | undefined;
32
- /** Provide arbitrary classes caret icon region.*/
33
19
  regionCaret?: string | undefined;
20
+ transitions?: boolean | undefined;
21
+ transitionIn?: TransitionIn | undefined;
22
+ transitionInParams?: TransitionParams<TransitionIn> | undefined;
23
+ transitionOut?: TransitionOut | undefined;
24
+ transitionOutParams?: TransitionParams<TransitionOut> | undefined;
34
25
  };
35
- events: {
26
+ events(): {
36
27
  click: MouseEvent;
37
28
  keydown: KeyboardEvent;
38
29
  keyup: KeyboardEvent;
39
30
  keypress: KeyboardEvent;
40
- /** {{ event: Event, id: string, open: boolean, autocollapse: boolean }} toggle - Fires when an accordion item is toggled.*/
41
31
  toggle: CustomEvent<{
42
32
  event?: Event | undefined;
43
33
  id: string;
@@ -47,16 +37,16 @@ declare const __propDef: {
47
37
  } & {
48
38
  [evt: string]: CustomEvent<any>;
49
39
  };
50
- slots: {
40
+ slots(): {
51
41
  lead: {};
52
42
  summary: {};
53
43
  content: {};
54
44
  };
55
- };
56
- export type AccordionItemProps = typeof __propDef.props;
57
- export type AccordionItemEvents = typeof __propDef.events;
58
- export type AccordionItemSlots = typeof __propDef.slots;
45
+ }
46
+ export type AccordionItemProps<TransitionIn extends Transition, TransitionOut extends Transition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['props']>;
47
+ export type AccordionItemEvents<TransitionIn extends Transition, TransitionOut extends Transition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['events']>;
48
+ export type AccordionItemSlots<TransitionIn extends Transition, TransitionOut extends Transition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['slots']>;
59
49
  /** The Accordion child element. */
60
- export default class AccordionItem extends SvelteComponentTyped<AccordionItemProps, AccordionItemEvents, AccordionItemSlots> {
50
+ export default class AccordionItem<TransitionIn extends Transition, TransitionOut extends Transition> extends SvelteComponentTyped<AccordionItemProps<TransitionIn, TransitionOut>, AccordionItemEvents<TransitionIn, TransitionOut>, AccordionItemSlots<TransitionIn, TransitionOut>> {
61
51
  }
62
52
  export {};
@@ -35,7 +35,7 @@ function prunedRestProps() {
35
35
 
36
36
  <label class="app-rail-tile {classesBase}" data-testid="app-rail-tile" {title} on:mouseover on:mouseleave on:focus on:blur>
37
37
  <!-- A11y attributes are not allowed on <label> -->
38
- <!-- TODO: Remove for V2 -->
38
+ <!-- FIXME: resolve a11y warnings -->
39
39
  <!-- svelte-ignore a11y-no-static-element-interactions -->
40
40
  <div class="app-rail-wrapper {classesWrapper}" on:keydown on:keyup on:keypress>
41
41
  <!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
@@ -1,4 +1,9 @@
1
- <script>import { createEventDispatcher } from "svelte";
1
+ <script context="module">import { slide } from "svelte/transition";
2
+ import { prefersReducedMotionStore } from "../../index.js";
3
+ import { dynamicTransition } from "../../internal/transitions.js";
4
+ </script>
5
+
6
+ <script generics="TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition">import { createEventDispatcher } from "svelte";
2
7
  const dispatch = createEventDispatcher();
3
8
  export let input = void 0;
4
9
  export let options = [];
@@ -11,10 +16,11 @@ export let regionList = "list-nav";
11
16
  export let regionItem = "";
12
17
  export let regionButton = "w-full";
13
18
  export let regionEmpty = "text-center";
14
- export let whitelist = [];
15
- export let blacklist = [];
16
- export let duration = 200;
17
- const deprecated = [whitelist, blacklist, duration];
19
+ export let transitions = !$prefersReducedMotionStore;
20
+ export let transitionIn = slide;
21
+ export let transitionInParams = { duration: 200 };
22
+ export let transitionOut = slide;
23
+ export let transitionOutParams = { duration: 200 };
18
24
  $:
19
25
  listedOptions = options;
20
26
  function filterByAllowDeny(allowlist2, denylist2) {
@@ -63,13 +69,17 @@ $:
63
69
  classesEmpty = `${regionEmpty}`;
64
70
  </script>
65
71
 
66
- <!-- animate:flip={{ duration }} transition:slide|local={{ duration }} -->
72
+ <!-- animate:flip={{ duration }} -->
67
73
  <div class="autocomplete {classesBase}" data-testid="autocomplete">
68
74
  {#if optionsFiltered.length > 0}
69
75
  <nav class="autocomplete-nav {classesNav}">
70
76
  <ul class="autocomplete-list {classesList}">
71
77
  {#each optionsFiltered.slice(0, sliceLimit) as option (option)}
72
- <li class="autocomplete-item {classesItem}">
78
+ <li
79
+ class="autocomplete-item {classesItem}"
80
+ in:dynamicTransition|local={{ transition: transitionIn, params: transitionInParams, enabled: transitions }}
81
+ out:dynamicTransition|local={{ transition: transitionOut, params: transitionOutParams, enabled: transitions }}
82
+ >
73
83
  <button class="autocomplete-button {classesButton}" type="button" on:click={() => onSelection(option)} on:click on:keypress>
74
84
  {@html option.label}
75
85
  </button>
@@ -1,50 +1,40 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ import { slide } from 'svelte/transition';
3
+ import { type Transition, type TransitionParams } from '../../index.js';
4
+ type SlideTransition = typeof slide;
2
5
  import type { AutocompleteOption } from './types.js';
3
- declare const __propDef: {
4
- props: {
6
+ declare class __sveltets_Render<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> {
7
+ props(): {
5
8
  [x: string]: any;
6
- /** Bind the input value.*/
7
9
  input?: unknown;
8
- /** Define values for the list.*/
9
10
  options?: AutocompleteOption[] | undefined;
10
- /** Limit the total number of suggestions.*/
11
11
  limit?: number | undefined;
12
- /** Provide allowlist values.*/
13
12
  allowlist?: unknown[] | undefined;
14
- /** Provide denylist values.*/
15
13
  denylist?: unknown[] | undefined;
16
- /** Provide a HTML markup to display when no match is found.*/
17
14
  emptyState?: string | undefined;
18
- /** Provide arbitrary classes to nav element.*/
19
15
  regionNav?: string | undefined;
20
- /** Provide arbitrary classes to each list.*/
21
16
  regionList?: string | undefined;
22
- /** Provide arbitrary classes to each list item.*/
23
17
  regionItem?: string | undefined;
24
- /** Provide arbitrary classes to each button.*/
25
18
  regionButton?: string | undefined;
26
- /** Provide arbitrary classes to empty message.*/
27
19
  regionEmpty?: string | undefined;
28
- /** DEPRECATED: replace with allowlist*/
29
- whitelist?: unknown[] | undefined;
30
- /** DEPRECATED: replace with denylist*/
31
- blacklist?: unknown[] | undefined;
32
- /** DEPRECATED: Set the animation duration. Use zero to disable.*/
33
- duration?: number | undefined;
20
+ transitions?: boolean | undefined;
21
+ transitionIn?: TransitionIn | undefined;
22
+ transitionInParams?: TransitionParams<TransitionIn> | undefined;
23
+ transitionOut?: TransitionOut | undefined;
24
+ transitionOutParams?: TransitionParams<TransitionOut> | undefined;
34
25
  };
35
- events: {
26
+ events(): {
36
27
  click: MouseEvent;
37
28
  keypress: KeyboardEvent;
38
- /** {AutocompleteOption} selection - Fire on option select.*/
39
29
  selection: CustomEvent<AutocompleteOption>;
40
30
  } & {
41
31
  [evt: string]: CustomEvent<any>;
42
32
  };
43
- slots: {};
44
- };
45
- export type AutocompleteProps = typeof __propDef.props;
46
- export type AutocompleteEvents = typeof __propDef.events;
47
- export type AutocompleteSlots = typeof __propDef.slots;
48
- export default class Autocomplete extends SvelteComponentTyped<AutocompleteProps, AutocompleteEvents, AutocompleteSlots> {
33
+ slots(): {};
34
+ }
35
+ export type AutocompleteProps<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['props']>;
36
+ export type AutocompleteEvents<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['events']>;
37
+ export type AutocompleteSlots<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['slots']>;
38
+ export default class Autocomplete<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> extends SvelteComponentTyped<AutocompleteProps<TransitionIn, TransitionOut>, AutocompleteEvents<TransitionIn, TransitionOut>, AutocompleteSlots<TransitionIn, TransitionOut>> {
49
39
  }
50
40
  export {};
@@ -21,7 +21,7 @@ function prunedRestProps() {
21
21
  }
22
22
  </script>
23
23
 
24
- <!-- TODO: Remove for V2 -->
24
+ <!-- FIXME: resolve a11y warnings -->
25
25
  <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
26
26
  <figure class="avatar {classesBase}" data-testid="avatar" on:click on:keydown on:keyup on:keypress>
27
27
  {#if src}
@@ -64,7 +64,7 @@ $:
64
64
  {#if legend && generatedLegendList}
65
65
  <ul class="conic-list list {classesLegend}">
66
66
  {#each generatedLegendList as { color, label, value }}
67
- <!-- TODO: Remove for V2 -->
67
+ <!-- FIXME: resolve a11y warnings -->
68
68
  <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
69
69
  <li class="conic-item {hover}" on:click on:keydown on:keyup on:keypress>
70
70
  <span class="conic-swatch {cSwatch}" style:background={color} />
@@ -1,8 +1,7 @@
1
1
  <script>export let files = void 0;
2
2
  export let name;
3
3
  export let width = "";
4
- export let button = "variant-filled";
5
- const cButton = "btn";
4
+ export let button = "btn variant-filled";
6
5
  let elemFileInput;
7
6
  function onButtonClick() {
8
7
  elemFileInput.click();
@@ -14,7 +13,7 @@ function prunedRestProps() {
14
13
  $:
15
14
  classesBase = `${$$props.class ?? ""}`;
16
15
  $:
17
- classesButton = `${cButton} ${button} ${width}`;
16
+ classesButton = `${button} ${width}`;
18
17
  </script>
19
18
 
20
19
  <div class="file-button {classesBase}" data-testid="file-button">
@@ -1,5 +1,12 @@
1
- <script>import { createEventDispatcher, onMount } from "svelte";
2
- import { fly, scale } from "svelte/transition";
1
+ <script context="module">import { fly, scale } from "svelte/transition";
2
+ import { prefersReducedMotionStore } from "../../index.js";
3
+ import { dynamicTransition } from "../../internal/transitions.js";
4
+ </script>
5
+
6
+ <script
7
+
8
+ generics="ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition"
9
+ >import { createEventDispatcher, onMount } from "svelte";
3
10
  import { flip } from "svelte/animate";
4
11
  const dispatch = createEventDispatcher();
5
12
  export let input = "";
@@ -18,6 +25,15 @@ export let chips = "variant-filled";
18
25
  export let invalid = "input-error";
19
26
  export let padding = "p-2";
20
27
  export let rounded = "rounded-container-token";
28
+ export let transitions = !$prefersReducedMotionStore;
29
+ export let listTransitionIn = fly;
30
+ export let listTransitionInParams = { duration: 150, opacity: 0, y: -20 };
31
+ export let listTransitionOut = fly;
32
+ export let listTransitionOutParams = { duration: 150, opacity: 0, y: -20 };
33
+ export let chipTransitionIn = scale;
34
+ export let chipTransitionInParams = { duration: 150, opacity: 0 };
35
+ export let chipTransitionOut = scale;
36
+ export let chipTransitionOutParams = { duration: 150, opacity: 0 };
21
37
  const cBase = "textarea cursor-pointer";
22
38
  const cInterface = "space-y-4";
23
39
  const cChipList = "flex flex-wrap gap-2";
@@ -94,6 +110,12 @@ $:
94
110
  classesChipList = `${cChipList}`;
95
111
  $:
96
112
  classesInputField = `${cInputField}`;
113
+ $:
114
+ chipValues = value?.map((val, i) => {
115
+ if (chipValues[i]?.val === val)
116
+ return chipValues[i];
117
+ return { id: Math.random(), val };
118
+ }) || [];
97
119
  </script>
98
120
 
99
121
  <div class="input-chip {classesBase}" class:opacity-50={$$restProps.disabled}>
@@ -122,7 +144,11 @@ $:
122
144
  </form>
123
145
  <!-- Chip List -->
124
146
  {#if chipValues.length}
125
- <div class="input-chip-list {classesChipList}" transition:fly|local={{ duration, opacity: 0, y: -20 }}>
147
+ <div
148
+ class="input-chip-list {classesChipList}"
149
+ in:dynamicTransition|local={{ transition: listTransitionIn, params: listTransitionInParams, enabled: transitions }}
150
+ out:dynamicTransition|local={{ transition: listTransitionOut, params: listTransitionOutParams, enabled: transitions }}
151
+ >
126
152
  {#each chipValues as { id, val }, i (id)}
127
153
  <!-- Wrapping div required for FLIP animation -->
128
154
  <div animate:flip={{ duration }}>
@@ -136,7 +162,8 @@ $:
136
162
  on:keypress
137
163
  on:keydown
138
164
  on:keyup
139
- transition:scale|local={{ duration, opacity: 0 }}
165
+ in:dynamicTransition|local={{ transition: chipTransitionIn, params: chipTransitionInParams, enabled: transitions }}
166
+ out:dynamicTransition|local={{ transition: chipTransitionOut, params: chipTransitionOutParams, enabled: transitions }}
140
167
  >
141
168
  <span>{val}</span>
142
169
  <span>✕</span>
@@ -1,42 +1,38 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
2
+ import { fly, scale } from 'svelte/transition';
3
+ import { type Transition, type TransitionParams } from '../../index.js';
4
+ type FlyTransition = typeof fly;
5
+ type ScaleTransition = typeof scale;
6
+ declare class __sveltets_Render<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> {
7
+ props(): {
4
8
  [x: string]: any;
5
- /** Bind the input value.*/
6
9
  input?: string | undefined;
7
- /** Set a unique select input name.*/
8
10
  name: string;
9
- /** An array of values.*/
10
11
  value?: any[] | undefined;
11
- /** Provide a whitelist of accepted values.*/
12
12
  whitelist?: string[] | undefined;
13
- /** Maximum number of chips. Set -1 to disable.*/
14
13
  max?: number | undefined;
15
- /** Set the minimum character length.*/
16
14
  minlength?: number | undefined;
17
- /** Set the maximum character length.*/
18
15
  maxlength?: number | undefined;
19
- /** When enabled, allows for uppercase values.*/
20
16
  allowUpperCase?: boolean | undefined;
21
- /** When enabled, allows for duplicate values.*/
22
17
  allowDuplicates?: boolean | undefined;
23
- /** Provide a custom validator function.*/
24
18
  validation?: ((...args: any[]) => boolean) | undefined;
25
- /** The duration of the animated fly effect.*/
26
19
  duration?: number | undefined;
27
- /** Set the required state for this input field.*/
28
20
  required?: boolean | undefined;
29
- /** Provide classes or a variant to style the chips.*/
30
21
  chips?: string | undefined;
31
- /** {{ event: Event, input: any }} invalid - Fires when the input value is invalid.*/
32
22
  invalid?: string | undefined;
33
- /** Provide classes to set padding styles.*/
34
23
  padding?: string | undefined;
35
- /** Provide classes to set border radius styles.*/
36
24
  rounded?: string | undefined;
25
+ transitions?: boolean | undefined;
26
+ listTransitionIn?: ListTransitionIn | undefined;
27
+ listTransitionInParams?: TransitionParams<ListTransitionIn> | undefined;
28
+ listTransitionOut?: ListTransitionOut | undefined;
29
+ listTransitionOutParams?: TransitionParams<ListTransitionOut> | undefined;
30
+ chipTransitionIn?: ChipTransitionIn | undefined;
31
+ chipTransitionInParams?: TransitionParams<ChipTransitionIn> | undefined;
32
+ chipTransitionOut?: ChipTransitionOut | undefined;
33
+ chipTransitionOutParams?: TransitionParams<ChipTransitionOut> | undefined;
37
34
  };
38
- events: {
39
- /** Bind the input value.*/
35
+ events(): {
40
36
  input: Event;
41
37
  focus: FocusEvent;
42
38
  blur: FocusEvent;
@@ -44,7 +40,6 @@ declare const __propDef: {
44
40
  keypress: KeyboardEvent;
45
41
  keydown: KeyboardEvent;
46
42
  keyup: KeyboardEvent;
47
- /** {{ event: Event, chipIndex: number, chipValue: string }} add - Fires when a chip is added.*/
48
43
  add: CustomEvent<{
49
44
  event: SubmitEvent;
50
45
  chipIndex: number;
@@ -62,11 +57,11 @@ declare const __propDef: {
62
57
  } & {
63
58
  [evt: string]: CustomEvent<any>;
64
59
  };
65
- slots: {};
66
- };
67
- export type InputChipProps = typeof __propDef.props;
68
- export type InputChipEvents = typeof __propDef.events;
69
- export type InputChipSlots = typeof __propDef.slots;
70
- export default class InputChip extends SvelteComponentTyped<InputChipProps, InputChipEvents, InputChipSlots> {
60
+ slots(): {};
61
+ }
62
+ export type InputChipProps<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> = ReturnType<__sveltets_Render<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>['props']>;
63
+ export type InputChipEvents<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> = ReturnType<__sveltets_Render<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>['events']>;
64
+ export type InputChipSlots<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> = ReturnType<__sveltets_Render<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>['slots']>;
65
+ export default class InputChip<ListTransitionIn extends Transition = FlyTransition, ListTransitionOut extends Transition = FlyTransition, ChipTransitionIn extends Transition = ScaleTransition, ChipTransitionOut extends Transition = ScaleTransition> extends SvelteComponentTyped<InputChipProps<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>, InputChipEvents<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>, InputChipSlots<ListTransitionIn, ListTransitionOut, ChipTransitionIn, ChipTransitionOut>> {
71
66
  }
72
67
  export {};
@@ -1,7 +1,7 @@
1
1
  <script>import { createEventDispatcher } from "svelte";
2
2
  import { leftAngles, leftArrow, rightAngles, rightArrow } from "./icons.js";
3
3
  const dispatch = createEventDispatcher();
4
- export let settings = { offset: 0, limit: 5, size: 0, amounts: [1, 2, 5, 10] };
4
+ export let settings = { page: 0, limit: 5, size: 0, amounts: [1, 2, 5, 10] };
5
5
  export let disabled = false;
6
6
  export let showPreviousNextButtons = true;
7
7
  export let showFirstLastButtons = false;
@@ -29,16 +29,18 @@ const cLabel = "w-full md:w-auto";
29
29
  let lastPage = Math.max(0, Math.ceil(settings.size / settings.limit - 1));
30
30
  let controlPages = getNumerals();
31
31
  function onChangeLength() {
32
- settings.offset = 0;
33
32
  dispatch("amount", settings.limit);
34
33
  lastPage = Math.max(0, Math.ceil(settings.size / settings.limit - 1));
34
+ if (settings.page > lastPage) {
35
+ settings.page = lastPage;
36
+ }
35
37
  controlPages = getNumerals();
36
38
  }
37
39
  function gotoPage(page) {
38
40
  if (page < 0)
39
41
  return;
40
- settings.offset = page;
41
- dispatch("page", settings.offset);
42
+ settings.page = page;
43
+ dispatch("page", settings.page);
42
44
  controlPages = getNumerals();
43
45
  }
44
46
  function getFullNumerals() {
@@ -50,8 +52,8 @@ function getFullNumerals() {
50
52
  }
51
53
  function getNumerals() {
52
54
  const pages = [];
53
- const isWithinLeftSection = settings.offset < maxNumerals + 2;
54
- const isWithinRightSection = settings.offset > lastPage - (maxNumerals + 2);
55
+ const isWithinLeftSection = settings.page < maxNumerals + 2;
56
+ const isWithinRightSection = settings.page > lastPage - (maxNumerals + 2);
55
57
  if (lastPage <= maxNumerals * 2 + 1)
56
58
  return getFullNumerals();
57
59
  pages.push(0);
@@ -64,7 +66,7 @@ function getNumerals() {
64
66
  pages.push(i);
65
67
  }
66
68
  } else {
67
- for (let i = settings.offset - maxNumerals; i <= settings.offset + maxNumerals; i++) {
69
+ for (let i = settings.page - maxNumerals; i <= settings.page + maxNumerals; i++) {
68
70
  pages.push(i);
69
71
  }
70
72
  }
@@ -79,7 +81,7 @@ function updateSize(size) {
79
81
  }
80
82
  $:
81
83
  classesButtonActive = (page) => {
82
- return page === settings.offset ? `${active} pointer-events-none` : "";
84
+ return page === settings.page ? `${active} pointer-events-none` : "";
83
85
  };
84
86
  $:
85
87
  maxNumerals, onChangeLength();
@@ -121,7 +123,7 @@ $:
121
123
  on:click={() => {
122
124
  gotoPage(0);
123
125
  }}
124
- disabled={disabled || settings.offset === 0}
126
+ disabled={disabled || settings.page === 0}
125
127
  >
126
128
  {@html buttonTextFirst}
127
129
  </button>
@@ -133,9 +135,9 @@ $:
133
135
  aria-label={labelPrevious}
134
136
  class={buttonClasses}
135
137
  on:click={() => {
136
- gotoPage(settings.offset - 1);
138
+ gotoPage(settings.page - 1);
137
139
  }}
138
- disabled={disabled || settings.offset === 0}
140
+ disabled={disabled || settings.page === 0}
139
141
  >
140
142
  {@html buttonTextPrevious}
141
143
  </button>
@@ -144,7 +146,7 @@ $:
144
146
  {#if showNumerals === false}
145
147
  <!-- Details -->
146
148
  <button type="button" class="{buttonClasses} pointer-events-none !text-sm">
147
- {settings.offset * settings.limit + 1}-{Math.min(settings.offset * settings.limit + settings.limit, settings.size)}&nbsp;<span
149
+ {settings.page * settings.limit + 1}-{Math.min(settings.page * settings.limit + settings.limit, settings.size)}&nbsp;<span
148
150
  class="opacity-50">{separatorText} {settings.size}</span
149
151
  >
150
152
  </button>
@@ -163,9 +165,9 @@ $:
163
165
  aria-label={labelNext}
164
166
  class={buttonClasses}
165
167
  on:click={() => {
166
- gotoPage(settings.offset + 1);
168
+ gotoPage(settings.page + 1);
167
169
  }}
168
- disabled={disabled || (settings.offset + 1) * settings.limit >= settings.size}
170
+ disabled={disabled || (settings.page + 1) * settings.limit >= settings.size}
169
171
  >
170
172
  {@html buttonTextNext}
171
173
  </button>
@@ -179,7 +181,7 @@ $:
179
181
  on:click={() => {
180
182
  gotoPage(lastPage);
181
183
  }}
182
- disabled={disabled || (settings.offset + 1) * settings.limit >= settings.size}
184
+ disabled={disabled || (settings.page + 1) * settings.limit >= settings.size}
183
185
  >
184
186
  {@html buttonTextLast}
185
187
  </button>