@skeletonlabs/skeleton 1.5.1 → 1.6.1

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 (103) hide show
  1. package/LICENSE +1 -1
  2. package/dist/actions/Clipboard/additional-svelte-typings.d.ts +5 -0
  3. package/dist/actions/Clipboard/clipboard.js +25 -5
  4. package/dist/actions/Filters/filter.js +0 -4
  5. package/dist/actions/Filters/svg-filters/Apollo.svelte +1 -1
  6. package/dist/actions/Filters/svg-filters/BlueNight.svelte +1 -1
  7. package/dist/actions/Filters/svg-filters/Emerald.svelte +1 -1
  8. package/dist/actions/Filters/svg-filters/GreenFall.svelte +1 -1
  9. package/dist/actions/Filters/svg-filters/Noir.svelte +1 -14
  10. package/dist/actions/Filters/svg-filters/NoirLight.svelte +1 -1
  11. package/dist/actions/Filters/svg-filters/Rustic.svelte +1 -1
  12. package/dist/actions/Filters/svg-filters/Summer84.svelte +1 -1
  13. package/dist/actions/Filters/svg-filters/XPro.svelte +1 -1
  14. package/dist/actions/FocusTrap/focusTrap.js +19 -7
  15. package/dist/components/AppRail/AppRail.svelte +5 -6
  16. package/dist/components/AppRail/AppRail.svelte.d.ts +14 -15
  17. package/dist/components/AppRail/AppRailAnchor.svelte +41 -0
  18. package/dist/components/AppRail/AppRailAnchor.svelte.d.ts +33 -0
  19. package/dist/components/AppRail/AppRailTile.svelte +34 -41
  20. package/dist/components/AppRail/AppRailTile.svelte.d.ts +13 -14
  21. package/dist/components/Autocomplete/Autocomplete.svelte +2 -1
  22. package/dist/components/InputChip/InputChip.svelte +15 -2
  23. package/dist/components/Paginator/Paginator.svelte +16 -0
  24. package/dist/components/Paginator/Paginator.svelte.d.ts +5 -1
  25. package/dist/components/RangeSlider/RangeSlider.svelte +1 -1
  26. package/dist/components/Tab/Tab.svelte +5 -2
  27. package/dist/components/Tab/Tab.svelte.d.ts +2 -0
  28. package/dist/components/Table/Table.svelte +1 -1
  29. package/dist/components/Table/Table.svelte.d.ts +1 -1
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +1 -0
  32. package/{src/lib → dist}/styles/elements/buttons.css +2 -0
  33. package/{src/lib → dist}/styles/elements/forms.css +1 -1
  34. package/dist/tailwind/core.d.cts +5 -0
  35. package/dist/tailwind/generated/intellisense-classes.cjs +1 -0
  36. package/dist/tailwind/generated/intellisense-classes.d.cts +853 -0
  37. package/dist/tailwind/intellisense.d.cts +5 -0
  38. package/dist/tailwind/settings.d.cts +6 -0
  39. package/dist/tailwind/skeleton.d.cts +7 -0
  40. package/dist/tailwind/theme/colors.d.cts +2 -0
  41. package/dist/tailwind/tokens/backgrounds.d.cts +2 -0
  42. package/dist/tailwind/tokens/border-radius.d.cts +33 -0
  43. package/dist/tailwind/tokens/borders.d.cts +6 -0
  44. package/dist/tailwind/tokens/fills.d.cts +15 -0
  45. package/dist/tailwind/tokens/rings.d.cts +22 -0
  46. package/dist/tailwind/tokens/text.d.cts +21 -0
  47. package/{src/lib → dist}/themes/theme-gold-nouveau.css +4 -0
  48. package/{src/lib → dist}/themes/theme-modern.css +8 -0
  49. package/{src/lib → dist}/themes/theme-rocket.css +4 -0
  50. package/{src/lib → dist}/themes/theme-sahara.css +8 -0
  51. package/{src/lib → dist}/themes/theme-seafoam.css +8 -0
  52. package/{src/lib → dist}/themes/theme-skeleton.css +4 -0
  53. package/{src/lib → dist}/themes/theme-vintage.css +8 -0
  54. package/dist/utilities/CodeBlock/CodeBlock.svelte +1 -0
  55. package/dist/utilities/DataTable/types.d.ts +1 -1
  56. package/dist/utilities/LightSwitch/lightswitch.js +1 -0
  57. package/dist/utilities/Modal/Modal.svelte +2 -2
  58. package/dist/utilities/Popup/popup.js +18 -19
  59. package/dist/utilities/Toast/Toast.svelte +6 -1
  60. package/package.json +108 -111
  61. package/dist/types/index.d.ts +0 -1
  62. package/dist/types/index.js +0 -1
  63. package/dist/types/tailwind.d.ts +0 -4
  64. package/dist/types/tailwind.js +0 -2
  65. package/src/lib/tailwind/.DS_Store +0 -0
  66. package/src/lib/tailwind/generated/intellisense-classes.cjs +0 -1
  67. /package/{src/lib → dist}/styles/all.css +0 -0
  68. /package/{src/lib → dist}/styles/elements/alerts.css +0 -0
  69. /package/{src/lib → dist}/styles/elements/badges.css +0 -0
  70. /package/{src/lib → dist}/styles/elements/breadcrumbs.css +0 -0
  71. /package/{src/lib → dist}/styles/elements/cards.css +0 -0
  72. /package/{src/lib → dist}/styles/elements/chips.css +0 -0
  73. /package/{src/lib → dist}/styles/elements/codeblocks.css +0 -0
  74. /package/{src/lib → dist}/styles/elements/lists.css +0 -0
  75. /package/{src/lib → dist}/styles/elements/logo-clouds.css +0 -0
  76. /package/{src/lib → dist}/styles/elements/modals.css +0 -0
  77. /package/{src/lib → dist}/styles/elements/placeholders.css +0 -0
  78. /package/{src/lib → dist}/styles/elements/popups.css +0 -0
  79. /package/{src/lib → dist}/styles/elements/tables.css +0 -0
  80. /package/{src/lib → dist}/styles/partials/core.css +0 -0
  81. /package/{src/lib → dist}/styles/partials/elements.css +0 -0
  82. /package/{src/lib → dist}/styles/partials/tailwind.css +0 -0
  83. /package/{src/lib → dist}/styles/partials/typography-next.css +0 -0
  84. /package/{src/lib → dist}/styles/partials/typography-prose.css +0 -0
  85. /package/{src/lib → dist}/styles/partials/typography.css +0 -0
  86. /package/{src/lib → dist}/styles/partials/variants.css +0 -0
  87. /package/{src/lib → dist}/styles/skeleton-minimal.css +0 -0
  88. /package/{src/lib → dist}/styles/skeleton.css +0 -0
  89. /package/{src/lib → dist}/tailwind/core.cjs +0 -0
  90. /package/{src/lib → dist}/tailwind/intellisense.cjs +0 -0
  91. /package/{src/lib → dist}/tailwind/settings.cjs +0 -0
  92. /package/{src/lib → dist}/tailwind/skeleton.cjs +0 -0
  93. /package/{src/lib → dist}/tailwind/theme/colors.cjs +0 -0
  94. /package/{src/lib → dist}/tailwind/tokens/backgrounds.cjs +0 -0
  95. /package/{src/lib → dist}/tailwind/tokens/border-radius.cjs +0 -0
  96. /package/{src/lib → dist}/tailwind/tokens/borders.cjs +0 -0
  97. /package/{src/lib → dist}/tailwind/tokens/fills.cjs +0 -0
  98. /package/{src/lib → dist}/tailwind/tokens/rings.cjs +0 -0
  99. /package/{src/lib → dist}/tailwind/tokens/text.cjs +0 -0
  100. /package/{src/lib → dist}/themes/theme-crimson.css +0 -0
  101. /package/{src/lib → dist}/themes/theme-hamlindigo.css +0 -0
  102. /package/{src/lib → dist}/themes/theme-seasonal.css +0 -0
  103. /package/{src/lib → dist}/themes/theme-test.css +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Skeleton Labs, LLC
3
+ Copyright (c) 2023 Skeleton Labs, LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,5 @@
1
+ declare namespace svelteHTML {
2
+ interface HTMLAttributes<T> {
3
+ 'on:copyComplete'?: (event: any) => any;
4
+ }
5
+ }
@@ -1,23 +1,26 @@
1
1
  // Action: Clipboard
2
2
  export function clipboard(node, args) {
3
+ const fireCopyCompleteEvent = () => {
4
+ node.dispatchEvent(new CustomEvent('copyComplete'));
5
+ };
3
6
  const onClick = () => {
4
7
  // Handle `data-clipboard` target based on object key
5
8
  if (typeof args === 'object') {
6
9
  // Element Inner HTML
7
10
  if (Object.prototype.hasOwnProperty.call(args, 'element')) {
8
11
  const element = document.querySelector(`[data-clipboard="${args.element}"]`);
9
- copyToClipboard(element?.innerHTML);
12
+ copyToClipboard(element?.innerHTML, 'text/html').then(fireCopyCompleteEvent);
10
13
  return;
11
14
  }
12
15
  // Form Input Value
13
16
  if (Object.prototype.hasOwnProperty.call(args, 'input')) {
14
17
  const input = document.querySelector(`[data-clipboard="${args.input}"]`);
15
- copyToClipboard(input?.value);
18
+ copyToClipboard(input?.value).then(fireCopyCompleteEvent);
16
19
  return;
17
20
  }
18
21
  }
19
22
  // Handle everything else.
20
- copyToClipboard(args);
23
+ copyToClipboard(args).then(fireCopyCompleteEvent);
21
24
  };
22
25
  // Event Listener
23
26
  node.addEventListener('click', onClick);
@@ -32,6 +35,23 @@ export function clipboard(node, args) {
32
35
  };
33
36
  }
34
37
  // Shared copy method
35
- function copyToClipboard(data) {
36
- navigator.clipboard.writeText(String(data));
38
+ async function copyToClipboard(data, mimeType = 'text/plain') {
39
+ if (navigator.clipboard.write) {
40
+ await navigator.clipboard.write([
41
+ new ClipboardItem({
42
+ [mimeType]: new Blob([data], {
43
+ type: mimeType
44
+ }),
45
+ ['text/plain']: new Blob([data], {
46
+ type: 'text/plain'
47
+ })
48
+ })
49
+ ]);
50
+ }
51
+ else {
52
+ // fallback since .writeText has wider browser support
53
+ await new Promise((resolve) => {
54
+ resolve(navigator.clipboard.writeText(String(data)));
55
+ });
56
+ }
37
57
  }
@@ -1,9 +1,5 @@
1
1
  // Action: Filter
2
2
  export function filter(node, filterName) {
3
- // Return if Firefox browser
4
- const isFirefox = navigator.userAgent.indexOf('Firefox') > -1;
5
- if (isFirefox)
6
- return;
7
3
  // Return if no filterName provided
8
4
  if (filterName === undefined)
9
5
  return;
@@ -1,5 +1,5 @@
1
1
  <!-- Apollo: `filter: url(#Apollo)` -->
2
- <svg id="svg-filter-apollo" class="hidden">
2
+ <svg id="svg-filter-apollo" class="filter absolute -left-full w-0 h-0">
3
3
  <filter id="Apollo" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
4
4
  <feColorMatrix
5
5
  values="0.8 0.6 -0.4 0.1 0,
@@ -1,5 +1,5 @@
1
1
  <!-- BlueNight: `filter: url(#BlueNight)` -->
2
- <svg id="svg-filter-bluenight" class="hidden">
2
+ <svg id="svg-filter-bluenight" class="filter absolute -left-full w-0 h-0">
3
3
  <filter id="BlueNight" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
4
4
  <feColorMatrix
5
5
  type="matrix"
@@ -1,5 +1,5 @@
1
1
  <!-- Emerald: `filter: url(#Emerald)` -->
2
- <svg id="svg-filter-emerald" class="hidden">
2
+ <svg id="svg-filter-emerald" class="filter absolute -left-full w-0 h-0">
3
3
  <filter id="Emerald" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
4
4
  <!-- RGB, RGB, RGB, Opacity -->
5
5
  <feColorMatrix
@@ -1,5 +1,5 @@
1
1
  <!-- GreenFall: `filter: url(#GreenFall)` -->
2
- <svg id="svg-filter-greenfall" class="filter hidden">
2
+ <svg id="svg-filter-greenfall" class="filter absolute -left-full w-0 h-0">
3
3
  <filter
4
4
  id="GreenFall"
5
5
  x="-20%"
@@ -1,5 +1,5 @@
1
1
  <!-- Noir: `filter: url(#Noir)` -->
2
- <svg id="svg-filter-noir" class="hidden">
2
+ <svg id="svg-filter-noir" class="filter absolute -left-full w-0 h-0">
3
3
  <filter
4
4
  id="Noir"
5
5
  x="-20%"
@@ -12,19 +12,6 @@
12
12
  >
13
13
  <feColorMatrix type="saturate" values="0" x="0%" y="0%" width="100%" height="100%" in="SourceGraphic" result="colormatrix1" />
14
14
  <feBlend mode="lighten" x="0%" y="0%" width="100%" height="100%" in="colormatrix1" in2="colormatrix1" result="blend" />
15
- <feDiffuseLighting
16
- surfaceScale="7.7"
17
- diffuseConstant="7.3"
18
- lighting-color="#707070"
19
- x="0%"
20
- y="0%"
21
- width="100%"
22
- height="100%"
23
- in="blend"
24
- result="diffuseLighting"
25
- >
26
- <fePointLight x="200" y="157" z="200" />
27
- </feDiffuseLighting>
28
15
  <feBlend mode="multiply" x="0%" y="0%" width="100%" height="100%" in="colormatrix1" in2="diffuseLighting" result="blend1" />
29
16
  </filter>
30
17
  </svg>
@@ -1,5 +1,5 @@
1
1
  <!-- NoirLight: `filter: url(#NoirLight)` -->
2
- <svg id="svg-filter-noirlight" class="hidden">
2
+ <svg id="svg-filter-noirlight" class="filter absolute -left-full w-0 h-0">
3
3
  <filter
4
4
  id="NoirLight"
5
5
  x="-20%"
@@ -1,5 +1,5 @@
1
1
  <!-- Rustic: `filter: url(#Rustic)` -->
2
- <svg id="svg-filter-rustic" class="hidden">
2
+ <svg id="svg-filter-rustic" class="filter absolute -left-full w-0 h-0">
3
3
  <filter id="Rustic" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
4
4
  <feColorMatrix
5
5
  type="matrix"
@@ -1,5 +1,5 @@
1
1
  <!-- Summer84: `filter: url(#Summer84)` -->
2
- <svg id="svg-filter-summer84" class="hidden">
2
+ <svg id="svg-filter-summer84" class="filter absolute -left-full w-0 h-0">
3
3
  <filter id="Summer84" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
4
4
  <feColorMatrix
5
5
  type="matrix"
@@ -1,5 +1,5 @@
1
1
  <!-- XPro: `filter: url(#XPro)` -->
2
- <svg id="svg-filter-xpro" class="hidden">
2
+ <svg id="svg-filter-xpro" class="filter absolute -left-full w-0 h-0">
3
3
  <filter id="XPro" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
4
4
  <feColorMatrix
5
5
  type="matrix"
@@ -17,7 +17,7 @@ export function focusTrap(node, enabled) {
17
17
  elemFirst.focus();
18
18
  }
19
19
  }
20
- const onInit = () => {
20
+ const onScanElements = (fromObserver) => {
21
21
  if (enabled === false)
22
22
  return;
23
23
  // Gather all focusable elements
@@ -26,28 +26,40 @@ export function focusTrap(node, enabled) {
26
26
  // Set first/last focusable elements
27
27
  elemFirst = focusableElems[0];
28
28
  elemLast = focusableElems[focusableElems.length - 1];
29
- // Auto-focus first focusable element
30
- elemFirst.focus();
29
+ // Auto-focus first focusable element only when not called from observer
30
+ if (!fromObserver)
31
+ elemFirst.focus();
31
32
  // Listen for keydown on first & last element
32
33
  elemFirst.addEventListener('keydown', onFirstElemKeydown);
33
34
  elemLast.addEventListener('keydown', onLastElemKeydown);
34
35
  }
35
36
  };
36
- onInit();
37
- function onDestroy() {
37
+ onScanElements(false);
38
+ function onCleanUp() {
38
39
  if (elemFirst)
39
40
  elemFirst.removeEventListener('keydown', onFirstElemKeydown);
40
41
  if (elemLast)
41
42
  elemLast.removeEventListener('keydown', onLastElemKeydown);
42
43
  }
44
+ // When children of node are changed (added or removed)
45
+ const onObservationChange = (mutationRecords, observer) => {
46
+ if (mutationRecords.length) {
47
+ onCleanUp();
48
+ onScanElements(true);
49
+ }
50
+ return observer;
51
+ };
52
+ const observer = new MutationObserver(onObservationChange);
53
+ observer.observe(node, { childList: true, subtree: true });
43
54
  // Lifecycle
44
55
  return {
45
56
  update(newArgs) {
46
57
  enabled = newArgs;
47
- newArgs ? onInit() : onDestroy();
58
+ newArgs ? onScanElements(false) : onCleanUp();
48
59
  },
49
60
  destroy() {
50
- onDestroy();
61
+ onCleanUp();
62
+ observer.disconnect();
51
63
  }
52
64
  };
53
65
  }
@@ -1,19 +1,18 @@
1
1
  <script>import { setContext } from "svelte";
2
- import { writable } from "svelte/store";
3
- export let selected = writable(void 0);
4
2
  export let background = "bg-surface-100-800-token";
5
3
  export let border = "";
6
- export let active = "bg-primary-active-token";
7
- export let hover = "bg-primary-hover-token";
8
- export let width = "w-[70px] sm:w-20";
4
+ export let width = "w-20";
9
5
  export let height = "h-full";
10
6
  export let gap = "gap-0";
11
7
  export let regionLead = "";
12
8
  export let regionDefault = "";
13
9
  export let regionTrail = "";
14
- setContext("selected", selected);
10
+ export let hover = "bg-primary-hover-token";
11
+ export let active = "bg-primary-active-token";
12
+ export let spacing = "space-y-1";
15
13
  setContext("active", active);
16
14
  setContext("hover", hover);
15
+ setContext("spacing", spacing);
17
16
  const cBase = "grid grid-rows-[auto_1fr_auto] overflow-y-auto";
18
17
  $:
19
18
  classesBase = `${cBase} ${background} ${border} ${width} ${height} ${gap} ${$$props.class || ""}`;
@@ -1,30 +1,29 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { type Readable, type Writable } from 'svelte/store';
3
2
  declare const __propDef: {
4
3
  props: {
5
4
  [x: string]: any;
6
- /** Provide a writable or readable store to maintain navigation selection.*/
7
- selected?: Writable<any> | Readable<any> | undefined;
8
- /** Provide classes to set the background color.*/
5
+ /** Rail: Provide classes to set the background color.*/
9
6
  background?: string | undefined;
10
- /** Provide classes to set the background color.*/
7
+ /** Rail: Provide classes to set the background color.*/
11
8
  border?: string | undefined;
12
- /** Provide classes to set the tile active tile background.*/
13
- active?: string | undefined;
14
- /** Provide classes to set the tile hover background color.*/
15
- hover?: string | undefined;
16
- /** Provide classes to set the width.*/
9
+ /** Rail: Provide classes to set the width.*/
17
10
  width?: string | undefined;
18
- /** Provide classes to set the height.*/
11
+ /** Rail: Provide classes to set the height.*/
19
12
  height?: string | undefined;
20
- /** Provide a class to set the grid gap.*/
13
+ /** Rail: Provide a class to set the grid gap.*/
21
14
  gap?: string | undefined;
22
- /** Provide arbitrary classes to the lead region.*/
15
+ /** Rail: Provide arbitrary classes to the lead region.*/
23
16
  regionLead?: string | undefined;
24
- /** Provide arbitrary classes to the default region.*/
17
+ /** Rail: Provide arbitrary classes to the default region.*/
25
18
  regionDefault?: string | undefined;
26
- /** Provide arbitrary classes to the trail region.*/
19
+ /** Rail: Provide arbitrary classes to the trail region.*/
27
20
  regionTrail?: string | undefined;
21
+ /** Tile: Provide classes to set the tile hover background color.*/
22
+ hover?: string | undefined;
23
+ /** Tile: Provide classes to set the tile active tile background.*/
24
+ active?: string | undefined;
25
+ /** Tile: Provide classes to set the tile vertical spacing.*/
26
+ spacing?: string | undefined;
28
27
  };
29
28
  events: {
30
29
  [evt: string]: CustomEvent<any>;
@@ -0,0 +1,41 @@
1
+ <script>import { getContext } from "svelte";
2
+ export let selected = false;
3
+ export let regionLead = "";
4
+ export let regionLabel = "";
5
+ export let hover = getContext("hover");
6
+ export let active = getContext("active");
7
+ export let spacing = getContext("spacing");
8
+ const cBase = "unstyled";
9
+ const cWrapper = "w-full aspect-square flex flex-col justify-center items-stretch text-center space-y-1";
10
+ const cLabel = "font-bold text-xs";
11
+ $:
12
+ classActive = selected ? active : "";
13
+ $:
14
+ classesBase = `${cBase} ${$$props.class || ""}`;
15
+ $:
16
+ classesWrapper = `${cWrapper} ${hover} ${spacing} ${classActive}`;
17
+ $:
18
+ classesLead = `${regionLead}`;
19
+ $:
20
+ classesLabel = `${cLabel} ${regionLabel}`;
21
+ function prunedRestProps() {
22
+ delete $$restProps.class;
23
+ return $$restProps;
24
+ }
25
+ </script>
26
+
27
+ <a
28
+ class="app-rail-anchor {classesBase}"
29
+ href={$$props.href}
30
+ {...prunedRestProps()}
31
+ on:click
32
+ on:keydown
33
+ on:keyup
34
+ on:keypress
35
+ data-testid="app-rail-anchor"
36
+ >
37
+ <div class="app-rail-wrapper {classesWrapper}">
38
+ {#if $$slots.lead}<div class="app-rail-lead {classesLead}"><slot name="lead" /></div>{/if}
39
+ <div class="app-rail-label {classesLabel}"><slot /></div>
40
+ </div>
41
+ </a>
@@ -0,0 +1,33 @@
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
+ /** Provide arbitrary classes to style the lead region.*/
8
+ regionLead?: string | undefined;
9
+ /** Provide arbitrary classes to style the label region.*/
10
+ regionLabel?: string | undefined;
11
+ hover?: string | undefined;
12
+ active?: string | undefined;
13
+ spacing?: string | undefined;
14
+ };
15
+ events: {
16
+ click: MouseEvent;
17
+ keydown: KeyboardEvent;
18
+ keyup: KeyboardEvent;
19
+ keypress: KeyboardEvent;
20
+ } & {
21
+ [evt: string]: CustomEvent<any>;
22
+ };
23
+ slots: {
24
+ lead: {};
25
+ default: {};
26
+ };
27
+ };
28
+ export type AppRailAnchorProps = typeof __propDef.props;
29
+ export type AppRailAnchorEvents = typeof __propDef.events;
30
+ export type AppRailAnchorSlots = typeof __propDef.slots;
31
+ export default class AppRailAnchor extends SvelteComponentTyped<AppRailAnchorProps, AppRailAnchorEvents, AppRailAnchorSlots> {
32
+ }
33
+ export {};
@@ -1,32 +1,27 @@
1
- <script>import { createEventDispatcher, getContext } from "svelte";
2
- const dispatch = createEventDispatcher();
3
- export let value = void 0;
4
- export let tag = "button";
5
- export let label = "";
6
- export let regionIcon = "";
1
+ <script>import { getContext } from "svelte";
2
+ export let group;
3
+ export let name;
4
+ export let value;
5
+ export let regionLead = "";
7
6
  export let regionLabel = "";
8
- export let selected = getContext("selected");
9
- export let active = getContext("active");
10
7
  export let hover = getContext("hover");
11
- if ($$props.href) {
12
- tag = "a";
13
- if (value === void 0)
14
- value = $$props.href;
15
- }
16
- const cBase = "unstyled grid place-content-center place-items-center w-full aspect-square space-y-1.5 cursor-pointer";
17
- const cLabel = "font-bold text-xs text-center";
18
- function onClickHandler(event) {
19
- if (!String($selected) || !String(value))
20
- return;
21
- if (selected && "set" in selected) {
22
- selected.set(value);
23
- }
24
- dispatch("click", event);
25
- }
8
+ export let active = getContext("active");
9
+ export let spacing = getContext("spacing");
10
+ const cBase = "cursor-pointer";
11
+ const cWrapper = "w-full aspect-square flex flex-col justify-center items-stretch";
12
+ const cInterface = "text-center";
13
+ const cLabel = "font-bold text-xs";
14
+ let elemInput;
26
15
  $:
27
- classesActive = String($selected) && String(value) && $selected === value ? `${active}` : "";
16
+ classActive = group === value ? active : "";
28
17
  $:
29
- classesBase = `${cBase} ${hover} ${classesActive} ${$$props.class || ""}`;
18
+ classesBase = `${cBase} ${$$props.class || ""}`;
19
+ $:
20
+ classesWrapper = `${cWrapper} ${hover} ${classActive}`;
21
+ $:
22
+ classesInterface = `${cInterface} ${spacing}`;
23
+ $:
24
+ classesLead = `${regionLead}`;
30
25
  $:
31
26
  classesLabel = `${cLabel} ${regionLabel}`;
32
27
  function prunedRestProps() {
@@ -35,19 +30,17 @@ function prunedRestProps() {
35
30
  }
36
31
  </script>
37
32
 
38
- <!-- @component A navigation tile for the App Rail component. -->
39
-
40
- <div on:click={onClickHandler} on:keydown on:keyup on:keypress data-testid="app-rail-tile">
41
- <!-- IMPORTANT: avoid forwarding events on <svelte:element> tags per: -->
42
- <!-- https://github.com/skeletonlabs/skeleton/issues/727#issuecomment-1356859261 -->
43
- <svelte:element this={tag} {...prunedRestProps()} class="app-rail-tile {classesBase}">
44
- <!-- Slot: Default (icon) -->
45
- {#if $$slots.default}
46
- <div class="app-rail-tile-icon {regionIcon}"><slot /></div>
47
- {/if}
48
- <!-- Label -->
49
- {#if label}
50
- <div class="app-rail-tile-label {classesLabel}">{label}</div>
51
- {/if}
52
- </svelte:element>
53
- </div>
33
+ <label class="app-rail-tile {classesBase}" data-testid="app-rail-tile">
34
+ <!-- A11y attributes are not allowed on <label> -->
35
+ <div class="app-rail-wrapper {classesWrapper}" on:keydown on:keyup on:keypress>
36
+ <!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
37
+ <div class="h-0 w-0 overflow-hidden">
38
+ <input bind:this={elemInput} type="radio" bind:group {name} {value} {...prunedRestProps()} tabindex="-1" on:click on:change />
39
+ </div>
40
+ <!-- Interface -->
41
+ <div class="app-rail-interface {classesInterface}">
42
+ {#if $$slots.lead}<div class="app-rail-lead {classesLead}"><slot name="lead" /></div>{/if}
43
+ <div class="app-rail-label {classesLabel}"><slot /></div>
44
+ </div>
45
+ </div>
46
+ </label>
@@ -1,39 +1,38 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { Readable, Writable } from 'svelte/store';
3
2
  declare const __propDef: {
4
3
  props: {
5
4
  [x: string]: any;
6
- /** Provide a unique value, active tiles will be highlighted. href will be used if no value is provided.*/
7
- value?: any | undefined;
8
- /** Provide the element tag. Button or Anchor recommended.*/
9
- tag?: string | undefined;
10
- /** Provide the visible text label.*/
11
- label?: string | undefined;
12
- /** Provide arbitrary classes to style the icon region.*/
13
- regionIcon?: string | undefined;
5
+ /** Set the radio group binding value.*/
6
+ group: any;
7
+ /** Set a unique name value for the input.*/
8
+ name: string;
9
+ /** Set the input's value.*/
10
+ value: any;
11
+ /** Provide arbitrary classes to style the lead region.*/
12
+ regionLead?: string | undefined;
14
13
  /** Provide arbitrary classes to style the label region.*/
15
14
  regionLabel?: string | undefined;
16
- selected?: Writable<string> | Readable<string> | undefined;
17
- active?: string | undefined;
18
15
  hover?: string | undefined;
16
+ active?: string | undefined;
17
+ spacing?: string | undefined;
19
18
  };
20
19
  events: {
21
20
  keydown: KeyboardEvent;
22
21
  keyup: KeyboardEvent;
23
22
  keypress: KeyboardEvent;
24
- /** {{ event }} click - Fires when the component is clicked.*/
25
- click: CustomEvent<MouseEvent>;
23
+ click: MouseEvent;
24
+ change: Event;
26
25
  } & {
27
26
  [evt: string]: CustomEvent<any>;
28
27
  };
29
28
  slots: {
29
+ lead: {};
30
30
  default: {};
31
31
  };
32
32
  };
33
33
  export type AppRailTileProps = typeof __propDef.props;
34
34
  export type AppRailTileEvents = typeof __propDef.events;
35
35
  export type AppRailTileSlots = typeof __propDef.slots;
36
- /** A navigation tile for the App Rail component. */
37
36
  export default class AppRailTile extends SvelteComponentTyped<AppRailTileProps, AppRailTileEvents, AppRailTileSlots> {
38
37
  }
39
38
  export {};
@@ -15,7 +15,8 @@ export let whitelist = [];
15
15
  export let blacklist = [];
16
16
  export let duration = 200;
17
17
  const deprecated = [whitelist, blacklist, duration];
18
- let listedOptions = options;
18
+ $:
19
+ listedOptions = options;
19
20
  function filterByAllowed() {
20
21
  if (allowlist.length) {
21
22
  listedOptions = [...options].filter((option) => allowlist.includes(option.value));
@@ -1,4 +1,4 @@
1
- <script>import { createEventDispatcher } from "svelte/internal";
1
+ <script>import { createEventDispatcher, onMount } from "svelte/internal";
2
2
  import { fly, scale } from "svelte/transition";
3
3
  import { flip } from "svelte/animate";
4
4
  const dispatch = createEventDispatcher();
@@ -26,6 +26,19 @@ let inputValid = true;
26
26
  let chipValues = value.map((val) => {
27
27
  return { val, id: Math.random() };
28
28
  });
29
+ function resetFormHandler() {
30
+ value = [];
31
+ }
32
+ let selectElement;
33
+ onMount(() => {
34
+ if (!selectElement.form)
35
+ return;
36
+ const externalForm = selectElement.form;
37
+ externalForm.addEventListener("reset", resetFormHandler);
38
+ return () => {
39
+ externalForm.removeEventListener("reset", resetFormHandler);
40
+ };
41
+ });
29
42
  function onInputHandler() {
30
43
  inputValid = true;
31
44
  }
@@ -92,7 +105,7 @@ $:
92
105
  <div class="input-chip {classesBase}" class:opacity-50={$$restProps.disabled}>
93
106
  <!-- NOTE: Don't use `hidden` as it prevents `required` from operating -->
94
107
  <div class="h-0 overflow-hidden">
95
- <select bind:value {name} multiple {required} tabindex="-1">
108
+ <select bind:this={selectElement} bind:value {name} multiple {required} tabindex="-1">
96
109
  <!-- NOTE: options are required! -->
97
110
  {#each value as option}<option value={option}>{option}</option>{/each}
98
111
  </select>
@@ -9,6 +9,8 @@ export let amountText = "Items";
9
9
  export let buttonClasses = "btn-icon variant-filled";
10
10
  export let buttonTextPrevious = "&larr;";
11
11
  export let buttonTextNext = "&rarr;";
12
+ export let buttonTextFirst = "&laquo;";
13
+ export let buttonTextLast = "&raquo;";
12
14
  const cBase = "flex flex-col md:flex-row items-center space-y-4 md:space-y-0 md:space-x-4";
13
15
  const cLabel = "w-full md:w-auto";
14
16
  const cPageText = "whitespace-nowrap";
@@ -24,6 +26,14 @@ function onNext() {
24
26
  settings.offset++;
25
27
  dispatch("page", settings.offset);
26
28
  }
29
+ function onFirst() {
30
+ settings.offset = 0;
31
+ dispatch("page", settings.offset);
32
+ }
33
+ function onLast() {
34
+ settings.offset = settings.size / settings.limit - 1;
35
+ dispatch("page", settings.offset);
36
+ }
27
37
  $:
28
38
  classesBase = `${cBase} ${justify} ${$$props.class ?? ""}`;
29
39
  $:
@@ -48,11 +58,17 @@ $:
48
58
  </span>
49
59
  <!-- Arrows -->
50
60
  <div class="paginator-arrows space-x-2">
61
+ <button type="button" class="{buttonClasses}" on:click={() => { onFirst() }} disabled={disabled || settings.offset === 0}>
62
+ {@html buttonTextFirst}
63
+ </button>
51
64
  <button type="button" class="{buttonClasses}" on:click={() => { onPrev() }} disabled={disabled || settings.offset === 0}>
52
65
  {@html buttonTextPrevious}
53
66
  </button>
54
67
  <button type="button" class="{buttonClasses}" on:click={() => { onNext() }} disabled={disabled || (settings.offset + 1) * settings.limit >= settings.size}>
55
68
  {@html buttonTextNext}
56
69
  </button>
70
+ <button type="button" class="{buttonClasses}" on:click={() => { onLast() }} disabled={disabled || (settings.offset + 1) * settings.limit >= settings.size}>
71
+ {@html buttonTextLast}
72
+ </button>
57
73
  </div>
58
74
  </div>
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { PaginationSettings } from './types';
2
+ import type { PaginationSettings } from '../..';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  [x: string]: any;
@@ -21,6 +21,10 @@ declare const __propDef: {
21
21
  buttonTextPrevious?: string | undefined;
22
22
  /** Set the text label for the Next button.*/
23
23
  buttonTextNext?: string | undefined;
24
+ /** Set the text label for the First button.*/
25
+ buttonTextFirst?: string | undefined;
26
+ /** Set the text label for the Last button.*/
27
+ buttonTextLast?: string | undefined;
24
28
  };
25
29
  events: {
26
30
  /** {{ length: number }} amount - Fires when the amount selection input changes.*/
@@ -1,4 +1,4 @@
1
- <script>import { afterUpdate, tick } from "svelte";
1
+ <script>import { afterUpdate } from "svelte";
2
2
  export let name;
3
3
  export let id = String(Math.random());
4
4
  export let value = 0;