@skeletonlabs/skeleton 1.8.0-dev.ff3a4f2f → 1.9.0-dev.760e846d
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,4 +1,12 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
/** @slot header - Insert fixed header content, such as Skeleton's App Bar component.
|
|
3
|
+
* @slot sidebarLeft - Hidden when empty. Allows you to set fixed left sidebar content.
|
|
4
|
+
* @slot sidebarRight - Hidden when empty. Allows you to set fixed right sidebar content.
|
|
5
|
+
* @slot pageHeader - Insert content that resides above your page content. Great for global alerts.
|
|
6
|
+
* @slot pageFooter - Insert content that resides below your page content. Recommended for most layouts.
|
|
7
|
+
* @slot footer - Insert fixed footer content. Not recommended for most layouts.
|
|
8
|
+
*/
|
|
9
|
+
import type { SvelteEvent } from '../../index.js';
|
|
2
10
|
declare const __propDef: {
|
|
3
11
|
props: {
|
|
4
12
|
[x: string]: any;
|
|
@@ -20,9 +28,7 @@ declare const __propDef: {
|
|
|
20
28
|
slotFooter?: string | undefined;
|
|
21
29
|
};
|
|
22
30
|
events: {
|
|
23
|
-
scroll:
|
|
24
|
-
} & {
|
|
25
|
-
[evt: string]: CustomEvent<any>;
|
|
31
|
+
scroll: SvelteEvent<UIEvent, HTMLDivElement>;
|
|
26
32
|
};
|
|
27
33
|
slots: {
|
|
28
34
|
header: {};
|
|
@@ -19,14 +19,18 @@ export let buttonTextPrevious = leftArrow;
|
|
|
19
19
|
export let buttonTextNext = rightArrow;
|
|
20
20
|
export let buttonTextFirst = leftAngles;
|
|
21
21
|
export let buttonTextLast = rightAngles;
|
|
22
|
+
export let labelFirst = "First page";
|
|
23
|
+
export let labelPrevious = "Previous page";
|
|
24
|
+
export let labelNext = "Next page";
|
|
25
|
+
export let labelLast = "Last page";
|
|
22
26
|
const cBase = "flex flex-col md:flex-row items-center space-y-4 md:space-y-0 md:space-x-4";
|
|
23
27
|
const cLabel = "w-full md:w-auto";
|
|
24
|
-
let lastPage = Math.ceil(settings.size / settings.limit - 1);
|
|
28
|
+
let lastPage = Math.max(0, Math.ceil(settings.size / settings.limit - 1));
|
|
25
29
|
let controlPages = getNumerals();
|
|
26
30
|
function onChangeLength() {
|
|
27
31
|
settings.offset = 0;
|
|
28
32
|
dispatch("amount", settings.limit);
|
|
29
|
-
lastPage = Math.ceil(settings.size / settings.limit - 1);
|
|
33
|
+
lastPage = Math.max(0, Math.ceil(settings.size / settings.limit - 1));
|
|
30
34
|
controlPages = getNumerals();
|
|
31
35
|
}
|
|
32
36
|
function gotoPage(page) {
|
|
@@ -68,12 +72,18 @@ function getNumerals() {
|
|
|
68
72
|
pages.push(lastPage);
|
|
69
73
|
return pages;
|
|
70
74
|
}
|
|
75
|
+
function updateSize(size) {
|
|
76
|
+
lastPage = Math.max(0, Math.ceil(size / settings.limit - 1));
|
|
77
|
+
controlPages = getNumerals();
|
|
78
|
+
}
|
|
71
79
|
$:
|
|
72
80
|
classesButtonActive = (page) => {
|
|
73
81
|
return page === settings.offset ? `${active} pointer-events-none` : "";
|
|
74
82
|
};
|
|
75
83
|
$:
|
|
76
84
|
maxNumerals, onChangeLength();
|
|
85
|
+
$:
|
|
86
|
+
updateSize(settings.size);
|
|
77
87
|
$:
|
|
78
88
|
classesBase = `${cBase} ${justify} ${$$props.class ?? ""}`;
|
|
79
89
|
$:
|
|
@@ -105,6 +115,7 @@ $:
|
|
|
105
115
|
{#if showFirstLastButtons}
|
|
106
116
|
<button
|
|
107
117
|
type="button"
|
|
118
|
+
aria-label={labelFirst}
|
|
108
119
|
class={buttonClasses}
|
|
109
120
|
on:click={() => {
|
|
110
121
|
gotoPage(0);
|
|
@@ -118,6 +129,7 @@ $:
|
|
|
118
129
|
{#if showPreviousNextButtons}
|
|
119
130
|
<button
|
|
120
131
|
type="button"
|
|
132
|
+
aria-label={labelPrevious}
|
|
121
133
|
class={buttonClasses}
|
|
122
134
|
on:click={() => {
|
|
123
135
|
gotoPage(settings.offset - 1);
|
|
@@ -147,6 +159,7 @@ $:
|
|
|
147
159
|
{#if showPreviousNextButtons}
|
|
148
160
|
<button
|
|
149
161
|
type="button"
|
|
162
|
+
aria-label={labelNext}
|
|
150
163
|
class={buttonClasses}
|
|
151
164
|
on:click={() => {
|
|
152
165
|
gotoPage(settings.offset + 1);
|
|
@@ -160,6 +173,7 @@ $:
|
|
|
160
173
|
{#if showFirstLastButtons}
|
|
161
174
|
<button
|
|
162
175
|
type="button"
|
|
176
|
+
aria-label={labelLast}
|
|
163
177
|
class={buttonClasses}
|
|
164
178
|
on:click={() => {
|
|
165
179
|
gotoPage(lastPage);
|
|
@@ -39,6 +39,14 @@ declare const __propDef: {
|
|
|
39
39
|
buttonTextFirst?: string | undefined;
|
|
40
40
|
/** Set the label for the Last button.*/
|
|
41
41
|
buttonTextLast?: string | undefined;
|
|
42
|
+
/** Provide the ARIA label for the First page button.*/
|
|
43
|
+
labelFirst?: string | undefined;
|
|
44
|
+
/** Provide the ARIA label for the Previous page button.*/
|
|
45
|
+
labelPrevious?: string | undefined;
|
|
46
|
+
/** Provide the ARIA label for the Next page button.*/
|
|
47
|
+
labelNext?: string | undefined;
|
|
48
|
+
/** Provide the ARIA label for the Last page button.*/
|
|
49
|
+
labelLast?: string | undefined;
|
|
42
50
|
};
|
|
43
51
|
events: {
|
|
44
52
|
/** {{ length: number }} amount - Fires when the amount selection input changes.*/
|
|
@@ -108,6 +108,8 @@ export function popup(triggerNode, args) {
|
|
|
108
108
|
elemPopup.style.display = 'block';
|
|
109
109
|
elemPopup.style.opacity = '1';
|
|
110
110
|
elemPopup.style.pointerEvents = 'auto';
|
|
111
|
+
// enable popup interactions
|
|
112
|
+
elemPopup.removeAttribute('inert');
|
|
111
113
|
// Trigger Floating UI autoUpdate (open only)
|
|
112
114
|
// https://floating-ui.com/docs/autoUpdate
|
|
113
115
|
popupState.autoUpdateCleanup = autoUpdate(triggerNode, elemPopup, render);
|
|
@@ -127,7 +129,8 @@ export function popup(triggerNode, args) {
|
|
|
127
129
|
args.state({ state: popupState.open });
|
|
128
130
|
// Update the DOM
|
|
129
131
|
elemPopup.style.opacity = '0';
|
|
130
|
-
|
|
132
|
+
// disable popup interactions
|
|
133
|
+
elemPopup.setAttribute('inert', '');
|
|
131
134
|
// Cleanup Floating UI autoUpdate (close only)
|
|
132
135
|
if (popupState.autoUpdateCleanup)
|
|
133
136
|
popupState.autoUpdateCleanup();
|