@umbraco-ui/uui-pagination 0.0.4 → 0.2.0
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.
- package/README.md +4 -0
- package/lib/index.js +14 -6
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
Umbraco style pagination component. By implementing a resizeObserver it changes the number of visible buttons to fit the width of the container it sits in. Check this out in the [Storybook](https://uui.umbraco.com/?path=/story/uui-pagination--aaa-overview). Uses `<uui-button></uui-button>` and `<uui-button-group></uui-button-group>`.
|
|
6
6
|
|
|
7
|
+
### See it in action
|
|
8
|
+
|
|
9
|
+
Preview the component on [Storybook](https://uui.umbraco.com/?path=/story/uui-pagination)
|
|
10
|
+
|
|
7
11
|
## Installation
|
|
8
12
|
|
|
9
13
|
### ES imports
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
|
|
2
|
+
import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
|
|
2
3
|
import { css, LitElement, html } from 'lit';
|
|
3
4
|
import { queryAll, query, property, state } from 'lit/decorators.js';
|
|
4
5
|
import { UUIEvent } from '@umbraco-ui/uui-base/lib/events';
|
|
@@ -41,6 +42,8 @@ let UUIPaginationElement = class extends LitElement {
|
|
|
41
42
|
if (!this.hasAttribute("role"))
|
|
42
43
|
this.setAttribute("role", "navigation");
|
|
43
44
|
this._visiblePages = this._generateVisiblePages(this.current);
|
|
45
|
+
demandCustomElement(this, "uui-button");
|
|
46
|
+
demandCustomElement(this, "uui-button-group");
|
|
44
47
|
}
|
|
45
48
|
disconnectedCallback() {
|
|
46
49
|
this._observer.disconnect();
|
|
@@ -109,7 +112,7 @@ let UUIPaginationElement = class extends LitElement {
|
|
|
109
112
|
look="outline"
|
|
110
113
|
class="nav"
|
|
111
114
|
role="listitem"
|
|
112
|
-
|
|
115
|
+
label="Go to first page"
|
|
113
116
|
?disabled=${this._current === 1}
|
|
114
117
|
@click=${() => this.goToPage(1)}>
|
|
115
118
|
First
|
|
@@ -121,7 +124,7 @@ let UUIPaginationElement = class extends LitElement {
|
|
|
121
124
|
look="outline"
|
|
122
125
|
class="nav"
|
|
123
126
|
role="listitem"
|
|
124
|
-
|
|
127
|
+
label="Go to previous page"
|
|
125
128
|
?disabled=${this._current === 1}
|
|
126
129
|
@click=${this.goToPreviousPage}>
|
|
127
130
|
Previous
|
|
@@ -133,7 +136,7 @@ let UUIPaginationElement = class extends LitElement {
|
|
|
133
136
|
look="outline"
|
|
134
137
|
role="listitem"
|
|
135
138
|
class="nav"
|
|
136
|
-
|
|
139
|
+
label="Go to next page"
|
|
137
140
|
?disabled=${this._current === this.total}
|
|
138
141
|
@click=${this.goToNextPage}>
|
|
139
142
|
Next
|
|
@@ -146,7 +149,7 @@ let UUIPaginationElement = class extends LitElement {
|
|
|
146
149
|
look="outline"
|
|
147
150
|
role="listitem"
|
|
148
151
|
class="nav"
|
|
149
|
-
|
|
152
|
+
label="Go to last page"
|
|
150
153
|
?disabled=${this.total === this._current}
|
|
151
154
|
@click=${() => this.goToPage(this.total)}>
|
|
152
155
|
Last
|
|
@@ -154,7 +157,12 @@ let UUIPaginationElement = class extends LitElement {
|
|
|
154
157
|
`;
|
|
155
158
|
}
|
|
156
159
|
renderDots() {
|
|
157
|
-
return html`<uui-button
|
|
160
|
+
return html`<uui-button
|
|
161
|
+
compact
|
|
162
|
+
look="outline"
|
|
163
|
+
tabindex="-1"
|
|
164
|
+
class="dots"
|
|
165
|
+
label="More pages"
|
|
158
166
|
>...</uui-button
|
|
159
167
|
> `;
|
|
160
168
|
}
|
|
@@ -163,7 +171,7 @@ let UUIPaginationElement = class extends LitElement {
|
|
|
163
171
|
compact
|
|
164
172
|
look="outline"
|
|
165
173
|
role="listitem"
|
|
166
|
-
|
|
174
|
+
label="Go to page ${page}"
|
|
167
175
|
class=${"page" + (page === this._current ? " active" : "")}
|
|
168
176
|
tabindex=${page === this._current ? "-1" : ""}
|
|
169
177
|
@click=${() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-pagination",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"custom-elements.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-base": "0.
|
|
34
|
-
"@umbraco-ui/uui-button": "0.1
|
|
35
|
-
"@umbraco-ui/uui-button-group": "0.
|
|
33
|
+
"@umbraco-ui/uui-base": "0.1.1",
|
|
34
|
+
"@umbraco-ui/uui-button": "0.2.1",
|
|
35
|
+
"@umbraco-ui/uui-button-group": "0.1.1"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-pagination",
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "3832880dc1f6f0db202b68530a11603299efe075"
|
|
47
47
|
}
|