@italia/pagination 1.0.0-alpha.10
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/AUTHORS +1 -0
- package/LICENSE +11 -0
- package/README.md +29 -0
- package/custom-elements.json +735 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/it-pagination-item.d.ts +26 -0
- package/dist/src/it-pagination-item.d.ts.map +1 -0
- package/dist/src/it-pagination-item.js +491 -0
- package/dist/src/it-pagination-item.js.map +1 -0
- package/dist/src/it-pagination.d.ts +49 -0
- package/dist/src/it-pagination.d.ts.map +1 -0
- package/dist/src/it-pagination.js +819 -0
- package/dist/src/it-pagination.js.map +1 -0
- package/dist/src/types.d.ts +5 -0
- package/dist/src/types.d.ts.map +1 -0
- package/package.json +70 -0
- package/styles/globals.scss +167 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ItPagination } from './it-pagination.js';
|
|
2
|
+
export { ItPaginationItem } from './it-pagination-item.js';
|
|
3
|
+
import '../index-Cxqk6BEN.js';
|
|
4
|
+
import 'lit/directive.js';
|
|
5
|
+
import 'lit';
|
|
6
|
+
import 'lit/decorators.js';
|
|
7
|
+
import 'lit/directives/when.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseComponent } from '@italia/globals';
|
|
2
|
+
export declare class ItPaginationItem extends BaseComponent {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
static shadowRootOptions: {
|
|
5
|
+
delegatesFocus: boolean;
|
|
6
|
+
clonable?: boolean;
|
|
7
|
+
customElementRegistry?: CustomElementRegistry;
|
|
8
|
+
mode: ShadowRootMode;
|
|
9
|
+
serializable?: boolean;
|
|
10
|
+
slotAssignment?: SlotAssignmentMode;
|
|
11
|
+
};
|
|
12
|
+
page: string;
|
|
13
|
+
current: boolean;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
16
|
+
private updateSlottedElements;
|
|
17
|
+
private handleSlotChange;
|
|
18
|
+
private handleClick;
|
|
19
|
+
render(): import("lit").TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'it-pagination-item': ItPaginationItem;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=it-pagination-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"it-pagination-item.d.ts","sourceRoot":"","sources":["../../src/it-pagination-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,qBACa,gBAAiB,SAAQ,aAAa;IACjD,MAAM,CAAC,MAAM,0BAAU;IAEvB,MAAM,CAAC,iBAAiB;;;;;;;MAAgE;IAGxF,IAAI,SAAM;IAGV,OAAO,UAAS;IAGhB,QAAQ,UAAS;IAER,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IAS1E,OAAO,CAAC,qBAAqB;IA0B7B,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,WAAW;IAmBV,MAAM;CAUhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF"}
|
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
import { B as BaseComponent, _ as __decorate, a as __metadata } from '../index-Cxqk6BEN.js';
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
|
+
import 'lit/directive.js';
|
|
5
|
+
|
|
6
|
+
var styles = css`/***************************** 1 ****************************************/
|
|
7
|
+
/***************************** 2 ****************************************/
|
|
8
|
+
/***************************** 1 ****************************************/
|
|
9
|
+
/***************************** 2 ****************************************/
|
|
10
|
+
/***************************** 1 ****************************************/
|
|
11
|
+
/***************************** 2 ****************************************/
|
|
12
|
+
/***************************** 3 ****************************************/
|
|
13
|
+
/***************************** 1 ****************************************/
|
|
14
|
+
/***************************** 2 ****************************************/
|
|
15
|
+
/***************************** 3 ****************************************/
|
|
16
|
+
/***************************** NEUTRAL 1 ****************************************/
|
|
17
|
+
/***************************** NEUTRAL 2 ****************************************/
|
|
18
|
+
/***************************** NEUTRAL 2 / 3 ****************************************/
|
|
19
|
+
*,
|
|
20
|
+
*::before,
|
|
21
|
+
*::after {
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
26
|
+
:root {
|
|
27
|
+
scroll-behavior: smooth;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
body {
|
|
32
|
+
margin: 0;
|
|
33
|
+
-webkit-text-size-adjust: 100%;
|
|
34
|
+
-webkit-tap-highlight-color: hsla(0, 0%, 0%, 0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
hr {
|
|
38
|
+
margin: 1rem 0;
|
|
39
|
+
color: inherit;
|
|
40
|
+
border: 0;
|
|
41
|
+
border-top: 1px solid;
|
|
42
|
+
opacity: 0.25;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
p {
|
|
46
|
+
margin-top: 0;
|
|
47
|
+
margin-bottom: var(--bsi-paragraph-spacing);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
abbr[title] {
|
|
51
|
+
text-decoration: underline dotted;
|
|
52
|
+
cursor: help;
|
|
53
|
+
text-decoration-skip-ink: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
address {
|
|
57
|
+
margin-bottom: var(--bsi-spacing-s);
|
|
58
|
+
font-style: normal;
|
|
59
|
+
line-height: inherit;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ol,
|
|
63
|
+
ul {
|
|
64
|
+
padding-left: var(--bsi-spacing-l);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ol,
|
|
68
|
+
ul,
|
|
69
|
+
dl {
|
|
70
|
+
margin-top: 0;
|
|
71
|
+
margin-bottom: var(--bsi-spacing-s);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
ol ol,
|
|
75
|
+
ul ul,
|
|
76
|
+
ol ul,
|
|
77
|
+
ul ol {
|
|
78
|
+
margin-bottom: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
dt {
|
|
82
|
+
font-weight: var(--bsi-font-weight-strong);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
dd {
|
|
86
|
+
margin-bottom: var(--bsi-spacing-xxs);
|
|
87
|
+
margin-left: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
blockquote {
|
|
91
|
+
margin: 0 0 var(--bsi-spacing-s);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
sub,
|
|
95
|
+
sup {
|
|
96
|
+
position: relative;
|
|
97
|
+
font-size: var(--bsi-font-size-1);
|
|
98
|
+
line-height: 0;
|
|
99
|
+
vertical-align: baseline;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
sub {
|
|
103
|
+
bottom: -0.25em;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
sup {
|
|
107
|
+
top: -0.5em;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
a {
|
|
111
|
+
color: var(--bsi-color-link);
|
|
112
|
+
text-decoration: underline;
|
|
113
|
+
text-decoration-skip-ink: auto;
|
|
114
|
+
text-underline-offset: 2px;
|
|
115
|
+
}
|
|
116
|
+
a:hover {
|
|
117
|
+
color: var(--bsi-color-link-hover);
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
pre,
|
|
122
|
+
code,
|
|
123
|
+
kbd,
|
|
124
|
+
samp {
|
|
125
|
+
font-size: 1em;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
pre {
|
|
129
|
+
display: block;
|
|
130
|
+
margin-top: 0;
|
|
131
|
+
margin-bottom: var(--bsi-paragraph-spacing);
|
|
132
|
+
overflow: auto;
|
|
133
|
+
}
|
|
134
|
+
pre code {
|
|
135
|
+
word-break: normal;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
a > code {
|
|
139
|
+
color: inherit;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
figure {
|
|
143
|
+
margin: 0 0 1rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
img,
|
|
147
|
+
svg {
|
|
148
|
+
vertical-align: middle;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
table {
|
|
152
|
+
caption-side: bottom;
|
|
153
|
+
border-collapse: collapse;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
caption {
|
|
157
|
+
padding-top: 0.5rem;
|
|
158
|
+
padding-bottom: 0.5rem;
|
|
159
|
+
color: hsl(210, 17%, 44%);
|
|
160
|
+
text-align: left;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
th {
|
|
164
|
+
text-align: inherit;
|
|
165
|
+
text-align: -webkit-match-parent;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
thead,
|
|
169
|
+
tbody,
|
|
170
|
+
tfoot,
|
|
171
|
+
tr,
|
|
172
|
+
td,
|
|
173
|
+
th {
|
|
174
|
+
border-color: inherit;
|
|
175
|
+
border-style: solid;
|
|
176
|
+
border-width: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
label {
|
|
180
|
+
display: inline-block;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
button {
|
|
184
|
+
border-radius: 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
button:focus:not(:focus-visible) {
|
|
188
|
+
outline: 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
input,
|
|
192
|
+
button,
|
|
193
|
+
select,
|
|
194
|
+
optgroup,
|
|
195
|
+
textarea {
|
|
196
|
+
margin: 0;
|
|
197
|
+
font-family: inherit;
|
|
198
|
+
font-size: inherit;
|
|
199
|
+
line-height: inherit;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
button,
|
|
203
|
+
select {
|
|
204
|
+
text-transform: none;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
[role=button] {
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
select {
|
|
212
|
+
word-wrap: normal;
|
|
213
|
+
}
|
|
214
|
+
select:disabled {
|
|
215
|
+
opacity: 1;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
[list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
|
|
219
|
+
display: none !important;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
button,
|
|
223
|
+
[type=button],
|
|
224
|
+
[type=reset],
|
|
225
|
+
[type=submit] {
|
|
226
|
+
-webkit-appearance: button;
|
|
227
|
+
}
|
|
228
|
+
button:not(:disabled),
|
|
229
|
+
[type=button]:not(:disabled),
|
|
230
|
+
[type=reset]:not(:disabled),
|
|
231
|
+
[type=submit]:not(:disabled) {
|
|
232
|
+
cursor: pointer;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
::-moz-focus-inner {
|
|
236
|
+
padding: 0;
|
|
237
|
+
border-style: none;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
textarea {
|
|
241
|
+
resize: vertical;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
fieldset {
|
|
245
|
+
min-width: 0;
|
|
246
|
+
padding: 0;
|
|
247
|
+
margin: 0;
|
|
248
|
+
border: 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
::-webkit-datetime-edit-fields-wrapper,
|
|
252
|
+
::-webkit-datetime-edit-text,
|
|
253
|
+
::-webkit-datetime-edit-minute,
|
|
254
|
+
::-webkit-datetime-edit-hour-field,
|
|
255
|
+
::-webkit-datetime-edit-day-field,
|
|
256
|
+
::-webkit-datetime-edit-month-field,
|
|
257
|
+
::-webkit-datetime-edit-year-field {
|
|
258
|
+
padding: 0;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
::-webkit-inner-spin-button {
|
|
262
|
+
height: auto;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
[type=search] {
|
|
266
|
+
outline-offset: -2px;
|
|
267
|
+
-webkit-appearance: textfield;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* rtl:raw:
|
|
271
|
+
[type="tel"],
|
|
272
|
+
[type="url"],
|
|
273
|
+
[type="email"],
|
|
274
|
+
[type="number"] {
|
|
275
|
+
direction: ltr;
|
|
276
|
+
}
|
|
277
|
+
*/
|
|
278
|
+
::-webkit-search-decoration {
|
|
279
|
+
-webkit-appearance: none;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
::-webkit-color-swatch-wrapper {
|
|
283
|
+
padding: 0;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
::file-selector-button {
|
|
287
|
+
font: inherit;
|
|
288
|
+
-webkit-appearance: button;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
output {
|
|
292
|
+
display: inline-block;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
iframe {
|
|
296
|
+
border: 0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
summary {
|
|
300
|
+
display: list-item;
|
|
301
|
+
cursor: pointer;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
progress {
|
|
305
|
+
vertical-align: baseline;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
[hidden] {
|
|
309
|
+
display: none !important;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.pagescroll-scroll-disabled {
|
|
313
|
+
scroll-behavior: auto !important;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
:host {
|
|
317
|
+
display: flex;
|
|
318
|
+
padding-left: 0;
|
|
319
|
+
list-style: none;
|
|
320
|
+
height: fit-content;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
::slotted(a.page-link) {
|
|
324
|
+
position: relative;
|
|
325
|
+
display: flex;
|
|
326
|
+
min-width: var(--bsi-pagination-item-size);
|
|
327
|
+
align-items: center;
|
|
328
|
+
justify-content: center;
|
|
329
|
+
padding: var(--bsi-pagination-padding-y) var(--bsi-pagination-padding-x);
|
|
330
|
+
border: var(--bsi-pagination-border-width) solid var(--bsi-pagination-border-color);
|
|
331
|
+
border-radius: var(--bsi-pagination-border-radius);
|
|
332
|
+
color: var(--bsi-pagination-link-color) !important;
|
|
333
|
+
font-weight: var(--bsi-font-weight-solid);
|
|
334
|
+
gap: 0.25rem;
|
|
335
|
+
font-size: var(--bsi-pagination-font-size, 1rem);
|
|
336
|
+
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
337
|
+
}
|
|
338
|
+
@media (prefers-reduced-motion: reduce) {
|
|
339
|
+
::slotted(a.page-link) {
|
|
340
|
+
transition: none;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
::slotted(a.page-link):hover {
|
|
344
|
+
--bsi-pagination-border-color: var(--bsi-color-border-primary-hover);
|
|
345
|
+
--bsi-pagination-link-color: var(--bsi-color-link-hover);
|
|
346
|
+
text-decoration: underline;
|
|
347
|
+
}
|
|
348
|
+
::slotted(a.page-link):focus-visible {
|
|
349
|
+
outline: 2px solid #0066cc !important;
|
|
350
|
+
outline-offset: 2px !important;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
::slotted(span.page-link) {
|
|
354
|
+
position: relative;
|
|
355
|
+
display: flex;
|
|
356
|
+
min-width: var(--bsi-pagination-item-size);
|
|
357
|
+
align-items: center;
|
|
358
|
+
justify-content: center;
|
|
359
|
+
padding: var(--bsi-pagination-padding-y) var(--bsi-pagination-padding-x);
|
|
360
|
+
border: var(--bsi-pagination-border-width) solid var(--bsi-pagination-border-color);
|
|
361
|
+
border-radius: var(--bsi-pagination-border-radius);
|
|
362
|
+
color: var(--bsi-pagination-link-color) !important;
|
|
363
|
+
font-weight: var(--bsi-font-weight-solid);
|
|
364
|
+
gap: 0.25rem;
|
|
365
|
+
font-size: var(--bsi-pagination-font-size, 1rem);
|
|
366
|
+
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
367
|
+
}
|
|
368
|
+
@media (prefers-reduced-motion: reduce) {
|
|
369
|
+
::slotted(span.page-link) {
|
|
370
|
+
transition: none;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.page-item.active ::slotted(.page-link) {
|
|
375
|
+
--bsi-pagination-border-color: var(--bsi-color-border-primary-active);
|
|
376
|
+
--bsi-pagination-link-color: var(--bsi-color-link-active);
|
|
377
|
+
pointer-events: none;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.page-item.disabled ::slotted(.page-link) {
|
|
381
|
+
border-color: var(--bsi-pagination-disabled-border-color);
|
|
382
|
+
background-color: var(--bsi-pagination-disabled-bg);
|
|
383
|
+
color: var(--bsi-pagination-disabled-color);
|
|
384
|
+
pointer-events: none;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
:host(:first-of-type) ::slotted(.page-link) {
|
|
388
|
+
border-top-left-radius: var(--bsi-pagination-border-radius);
|
|
389
|
+
border-bottom-left-radius: var(--bsi-pagination-border-radius);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
:host(:last-of-type) ::slotted(.page-link) {
|
|
393
|
+
border-top-right-radius: var(--bsi-pagination-border-radius);
|
|
394
|
+
border-bottom-right-radius: var(--bsi-pagination-border-radius);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.page-link[aria-current] {
|
|
398
|
+
--bsi-pagination-border-color: var(--bsi-color-border-primary-active);
|
|
399
|
+
--bsi-pagination-link-color: var(--bsi-color-link-active);
|
|
400
|
+
pointer-events: none;
|
|
401
|
+
}`;
|
|
402
|
+
|
|
403
|
+
let ItPaginationItem = class ItPaginationItem extends BaseComponent {
|
|
404
|
+
constructor() {
|
|
405
|
+
super(...arguments);
|
|
406
|
+
this.page = '';
|
|
407
|
+
this.current = false;
|
|
408
|
+
this.disabled = false;
|
|
409
|
+
}
|
|
410
|
+
updated(changedProperties) {
|
|
411
|
+
super.updated?.(changedProperties);
|
|
412
|
+
// When current or disabled state changes, update the slotted elements
|
|
413
|
+
if (changedProperties.has('current') || changedProperties.has('disabled')) {
|
|
414
|
+
this.updateSlottedElements();
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
updateSlottedElements() {
|
|
418
|
+
const slot = this.shadowRoot?.querySelector('slot');
|
|
419
|
+
if (!slot)
|
|
420
|
+
return;
|
|
421
|
+
const assignedElements = slot.assignedElements();
|
|
422
|
+
assignedElements.forEach((element) => {
|
|
423
|
+
// Gestione accessibilità per l'elemento interno (es. <a> o <button>)
|
|
424
|
+
if (this.current) {
|
|
425
|
+
element.setAttribute('aria-current', 'page');
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
element.removeAttribute('aria-current');
|
|
429
|
+
}
|
|
430
|
+
if (this.disabled) {
|
|
431
|
+
element.setAttribute('aria-disabled', 'true');
|
|
432
|
+
element.setAttribute('tabindex', '-1');
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
element.removeAttribute('aria-disabled');
|
|
436
|
+
element.removeAttribute('tabindex');
|
|
437
|
+
}
|
|
438
|
+
element.classList.add('page-link');
|
|
439
|
+
element.removeEventListener('click', this.handleClick);
|
|
440
|
+
element.addEventListener('click', this.handleClick.bind(this));
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
handleSlotChange() {
|
|
444
|
+
// Initial setup when slot content changes
|
|
445
|
+
this.updateSlottedElements();
|
|
446
|
+
}
|
|
447
|
+
handleClick(e) {
|
|
448
|
+
// Se disabilitato o già attivo, ignoriamo il click
|
|
449
|
+
if (this.disabled || this.current) {
|
|
450
|
+
e.preventDefault();
|
|
451
|
+
e.stopPropagation();
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
// Emettiamo un evento "interno" che il padre (ItPagination) ascolterà.
|
|
455
|
+
// Usiamo bubbles: true per risalire il DOM fino al padre.
|
|
456
|
+
this.dispatchEvent(new CustomEvent('it-item-click', {
|
|
457
|
+
detail: { page: this.page },
|
|
458
|
+
bubbles: true,
|
|
459
|
+
composed: true,
|
|
460
|
+
}));
|
|
461
|
+
}
|
|
462
|
+
render() {
|
|
463
|
+
// La classe 'page-item' va sul contenitore LI per Bootstrap
|
|
464
|
+
const liClasses = this.composeClass('page-item', this.current && 'active', this.disabled && 'disabled');
|
|
465
|
+
return html `
|
|
466
|
+
<li class="${liClasses}">
|
|
467
|
+
<slot @slotchange="${this.handleSlotChange}"></slot>
|
|
468
|
+
</li>
|
|
469
|
+
`;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
ItPaginationItem.styles = styles;
|
|
473
|
+
ItPaginationItem.shadowRootOptions = { ...BaseComponent.shadowRootOptions, delegatesFocus: true };
|
|
474
|
+
__decorate([
|
|
475
|
+
property({ type: String, reflect: true }),
|
|
476
|
+
__metadata("design:type", Object)
|
|
477
|
+
], ItPaginationItem.prototype, "page", void 0);
|
|
478
|
+
__decorate([
|
|
479
|
+
property({ type: Boolean, reflect: true }),
|
|
480
|
+
__metadata("design:type", Object)
|
|
481
|
+
], ItPaginationItem.prototype, "current", void 0);
|
|
482
|
+
__decorate([
|
|
483
|
+
property({ type: Boolean, reflect: true }),
|
|
484
|
+
__metadata("design:type", Object)
|
|
485
|
+
], ItPaginationItem.prototype, "disabled", void 0);
|
|
486
|
+
ItPaginationItem = __decorate([
|
|
487
|
+
customElement('it-pagination-item')
|
|
488
|
+
], ItPaginationItem);
|
|
489
|
+
|
|
490
|
+
export { ItPaginationItem };
|
|
491
|
+
//# sourceMappingURL=it-pagination-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"it-pagination-item.js","sources":["../../../src/it-pagination-item.ts"],"sourcesContent":["import { BaseComponent } from '@italia/globals';\nimport { html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport styles from './pagination-item.scss';\n\n@customElement('it-pagination-item')\nexport class ItPaginationItem extends BaseComponent {\n static styles = styles;\n\n static shadowRootOptions = { ...BaseComponent.shadowRootOptions, delegatesFocus: true };\n\n @property({ type: String, reflect: true })\n page = '';\n\n @property({ type: Boolean, reflect: true })\n current = false;\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n override updated(changedProperties: Map<string | number | symbol, unknown>) {\n super.updated?.(changedProperties);\n\n // When current or disabled state changes, update the slotted elements\n if (changedProperties.has('current') || changedProperties.has('disabled')) {\n this.updateSlottedElements();\n }\n }\n\n private updateSlottedElements() {\n const slot = this.shadowRoot?.querySelector('slot') as HTMLSlotElement;\n if (!slot) return;\n\n const assignedElements = slot.assignedElements();\n assignedElements.forEach((element) => {\n // Gestione accessibilità per l'elemento interno (es. <a> o <button>)\n if (this.current) {\n element.setAttribute('aria-current', 'page');\n } else {\n element.removeAttribute('aria-current');\n }\n\n if (this.disabled) {\n element.setAttribute('aria-disabled', 'true');\n element.setAttribute('tabindex', '-1');\n } else {\n element.removeAttribute('aria-disabled');\n element.removeAttribute('tabindex');\n }\n element.classList.add('page-link');\n element.removeEventListener('click', this.handleClick);\n element.addEventListener('click', this.handleClick.bind(this));\n });\n }\n\n private handleSlotChange() {\n // Initial setup when slot content changes\n this.updateSlottedElements();\n }\n\n private handleClick(e: any) {\n // Se disabilitato o già attivo, ignoriamo il click\n if (this.disabled || this.current) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n // Emettiamo un evento \"interno\" che il padre (ItPagination) ascolterà.\n // Usiamo bubbles: true per risalire il DOM fino al padre.\n this.dispatchEvent(\n new CustomEvent('it-item-click', {\n detail: { page: this.page },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n override render() {\n // La classe 'page-item' va sul contenitore LI per Bootstrap\n const liClasses = this.composeClass('page-item', this.current && 'active', this.disabled && 'disabled');\n\n return html`\n <li class=\"${liClasses}\">\n <slot @slotchange=\"${this.handleSlotChange}\"></slot>\n </li>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-pagination-item': ItPaginationItem;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,aAAa,CAAA;AAA5C,IAAA,WAAA,GAAA;;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,gBAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAGhB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAC1B,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAZN,gBAAgB,GAAA,UAAA,CAAA;IAD5B,aAAa,CAAC,oBAAoB;AACtB,CAAA,EAAA,gBAAgB,CAmF5B;;;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseComponent } from '@italia/globals';
|
|
2
|
+
import type { PaginationAlignment } from './types.js';
|
|
3
|
+
export declare class ItPagination extends BaseComponent {
|
|
4
|
+
static styles: import("lit").CSSResult;
|
|
5
|
+
static shadowRootOptions: {
|
|
6
|
+
delegatesFocus: boolean;
|
|
7
|
+
clonable?: boolean;
|
|
8
|
+
customElementRegistry?: CustomElementRegistry;
|
|
9
|
+
mode: ShadowRootMode;
|
|
10
|
+
serializable?: boolean;
|
|
11
|
+
slotAssignment?: SlotAssignmentMode;
|
|
12
|
+
};
|
|
13
|
+
private paginationItems;
|
|
14
|
+
private prevElements;
|
|
15
|
+
private nextElements;
|
|
16
|
+
private totalElements;
|
|
17
|
+
value: string;
|
|
18
|
+
total: undefined;
|
|
19
|
+
align: PaginationAlignment;
|
|
20
|
+
disableResponsive: boolean;
|
|
21
|
+
simpleMode: boolean;
|
|
22
|
+
visiblePages: number;
|
|
23
|
+
itAriaLabel: string;
|
|
24
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
25
|
+
private emitPageChange;
|
|
26
|
+
private handleItemClick;
|
|
27
|
+
private handlePrevClick;
|
|
28
|
+
private handleNextClick;
|
|
29
|
+
private updatePaginationItemsClasses;
|
|
30
|
+
private updatePaginationItems;
|
|
31
|
+
private updateNavigationButtons;
|
|
32
|
+
private handleSlotChange;
|
|
33
|
+
private handlePrevSlotChange;
|
|
34
|
+
private handleNextSlotChange;
|
|
35
|
+
private handleTotalSlotChange;
|
|
36
|
+
/**
|
|
37
|
+
* Calculate which pages to display based on simpleMode and visiblePages
|
|
38
|
+
* Returns an array of page numbers to show
|
|
39
|
+
*/
|
|
40
|
+
private calculatePages;
|
|
41
|
+
render(): import("lit").TemplateResult<1>;
|
|
42
|
+
private handlePageClick;
|
|
43
|
+
}
|
|
44
|
+
declare global {
|
|
45
|
+
interface HTMLElementTagNameMap {
|
|
46
|
+
'it-pagination': ItPagination;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=it-pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"it-pagination.d.ts","sourceRoot":"","sources":["../../src/it-pagination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtD,qBACa,YAAa,SAAQ,aAAa;IAC7C,MAAM,CAAC,MAAM,0BAAU;IAEvB,MAAM,CAAC,iBAAiB;;;;;;;MAAgE;IAGxF,OAAO,CAAC,eAAe,CAAsB;IAG7C,OAAO,CAAC,YAAY,CAAiB;IAGrC,OAAO,CAAC,YAAY,CAAiB;IAGrC,OAAO,CAAC,aAAa,CAAiB;IAGtC,KAAK,SAAO;IAGZ,KAAK,YAAa;IAGlB,KAAK,EAAE,mBAAmB,CAAY;IAGtC,iBAAiB,UAAS;IAG1B,UAAU,UAAS;IAGnB,YAAY,SAAK;IAGjB,WAAW,SAAM;IAER,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IAkB1E,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,4BAA4B;IAgCpC,OAAO,CAAC,qB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