@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.
@@ -0,0 +1,819 @@
1
+ import { B as BaseComponent, _ as __decorate, a as __metadata } from '../index-Cxqk6BEN.js';
2
+ import { css, html } from 'lit';
3
+ import { when } from 'lit/directives/when.js';
4
+ import { queryAssignedElements, property, customElement } from 'lit/decorators.js';
5
+ import 'lit/directive.js';
6
+
7
+ var styles = css`/***************************** 1 ****************************************/
8
+ /***************************** 2 ****************************************/
9
+ /***************************** 1 ****************************************/
10
+ /***************************** 2 ****************************************/
11
+ /***************************** 1 ****************************************/
12
+ /***************************** 2 ****************************************/
13
+ /***************************** 3 ****************************************/
14
+ /***************************** 1 ****************************************/
15
+ /***************************** 2 ****************************************/
16
+ /***************************** 3 ****************************************/
17
+ /***************************** NEUTRAL 1 ****************************************/
18
+ /***************************** NEUTRAL 2 ****************************************/
19
+ /***************************** NEUTRAL 2 / 3 ****************************************/
20
+ *,
21
+ *::before,
22
+ *::after {
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ @media (prefers-reduced-motion: no-preference) {
27
+ :root {
28
+ scroll-behavior: smooth;
29
+ }
30
+ }
31
+
32
+ body {
33
+ margin: 0;
34
+ -webkit-text-size-adjust: 100%;
35
+ -webkit-tap-highlight-color: hsla(0, 0%, 0%, 0);
36
+ }
37
+
38
+ hr {
39
+ margin: 1rem 0;
40
+ color: inherit;
41
+ border: 0;
42
+ border-top: 1px solid;
43
+ opacity: 0.25;
44
+ }
45
+
46
+ p {
47
+ margin-top: 0;
48
+ margin-bottom: var(--bsi-paragraph-spacing);
49
+ }
50
+
51
+ abbr[title] {
52
+ text-decoration: underline dotted;
53
+ cursor: help;
54
+ text-decoration-skip-ink: none;
55
+ }
56
+
57
+ address {
58
+ margin-bottom: var(--bsi-spacing-s);
59
+ font-style: normal;
60
+ line-height: inherit;
61
+ }
62
+
63
+ ol,
64
+ ul {
65
+ padding-left: var(--bsi-spacing-l);
66
+ }
67
+
68
+ ol,
69
+ ul,
70
+ dl {
71
+ margin-top: 0;
72
+ margin-bottom: var(--bsi-spacing-s);
73
+ }
74
+
75
+ ol ol,
76
+ ul ul,
77
+ ol ul,
78
+ ul ol {
79
+ margin-bottom: 0;
80
+ }
81
+
82
+ dt {
83
+ font-weight: var(--bsi-font-weight-strong);
84
+ }
85
+
86
+ dd {
87
+ margin-bottom: var(--bsi-spacing-xxs);
88
+ margin-left: 0;
89
+ }
90
+
91
+ blockquote {
92
+ margin: 0 0 var(--bsi-spacing-s);
93
+ }
94
+
95
+ sub,
96
+ sup {
97
+ position: relative;
98
+ font-size: var(--bsi-font-size-1);
99
+ line-height: 0;
100
+ vertical-align: baseline;
101
+ }
102
+
103
+ sub {
104
+ bottom: -0.25em;
105
+ }
106
+
107
+ sup {
108
+ top: -0.5em;
109
+ }
110
+
111
+ a {
112
+ color: var(--bsi-color-link);
113
+ text-decoration: underline;
114
+ text-decoration-skip-ink: auto;
115
+ text-underline-offset: 2px;
116
+ }
117
+ a:hover {
118
+ color: var(--bsi-color-link-hover);
119
+ cursor: pointer;
120
+ }
121
+
122
+ pre,
123
+ code,
124
+ kbd,
125
+ samp {
126
+ font-size: 1em;
127
+ }
128
+
129
+ pre {
130
+ display: block;
131
+ margin-top: 0;
132
+ margin-bottom: var(--bsi-paragraph-spacing);
133
+ overflow: auto;
134
+ }
135
+ pre code {
136
+ word-break: normal;
137
+ }
138
+
139
+ a > code {
140
+ color: inherit;
141
+ }
142
+
143
+ figure {
144
+ margin: 0 0 1rem;
145
+ }
146
+
147
+ img,
148
+ svg {
149
+ vertical-align: middle;
150
+ }
151
+
152
+ table {
153
+ caption-side: bottom;
154
+ border-collapse: collapse;
155
+ }
156
+
157
+ caption {
158
+ padding-top: 0.5rem;
159
+ padding-bottom: 0.5rem;
160
+ color: hsl(210, 17%, 44%);
161
+ text-align: left;
162
+ }
163
+
164
+ th {
165
+ text-align: inherit;
166
+ text-align: -webkit-match-parent;
167
+ }
168
+
169
+ thead,
170
+ tbody,
171
+ tfoot,
172
+ tr,
173
+ td,
174
+ th {
175
+ border-color: inherit;
176
+ border-style: solid;
177
+ border-width: 0;
178
+ }
179
+
180
+ label {
181
+ display: inline-block;
182
+ }
183
+
184
+ button {
185
+ border-radius: 0;
186
+ }
187
+
188
+ button:focus:not(:focus-visible) {
189
+ outline: 0;
190
+ }
191
+
192
+ input,
193
+ button,
194
+ select,
195
+ optgroup,
196
+ textarea {
197
+ margin: 0;
198
+ font-family: inherit;
199
+ font-size: inherit;
200
+ line-height: inherit;
201
+ }
202
+
203
+ button,
204
+ select {
205
+ text-transform: none;
206
+ }
207
+
208
+ [role=button] {
209
+ cursor: pointer;
210
+ }
211
+
212
+ select {
213
+ word-wrap: normal;
214
+ }
215
+ select:disabled {
216
+ opacity: 1;
217
+ }
218
+
219
+ [list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
220
+ display: none !important;
221
+ }
222
+
223
+ button,
224
+ [type=button],
225
+ [type=reset],
226
+ [type=submit] {
227
+ -webkit-appearance: button;
228
+ }
229
+ button:not(:disabled),
230
+ [type=button]:not(:disabled),
231
+ [type=reset]:not(:disabled),
232
+ [type=submit]:not(:disabled) {
233
+ cursor: pointer;
234
+ }
235
+
236
+ ::-moz-focus-inner {
237
+ padding: 0;
238
+ border-style: none;
239
+ }
240
+
241
+ textarea {
242
+ resize: vertical;
243
+ }
244
+
245
+ fieldset {
246
+ min-width: 0;
247
+ padding: 0;
248
+ margin: 0;
249
+ border: 0;
250
+ }
251
+
252
+ ::-webkit-datetime-edit-fields-wrapper,
253
+ ::-webkit-datetime-edit-text,
254
+ ::-webkit-datetime-edit-minute,
255
+ ::-webkit-datetime-edit-hour-field,
256
+ ::-webkit-datetime-edit-day-field,
257
+ ::-webkit-datetime-edit-month-field,
258
+ ::-webkit-datetime-edit-year-field {
259
+ padding: 0;
260
+ }
261
+
262
+ ::-webkit-inner-spin-button {
263
+ height: auto;
264
+ }
265
+
266
+ [type=search] {
267
+ outline-offset: -2px;
268
+ -webkit-appearance: textfield;
269
+ }
270
+
271
+ /* rtl:raw:
272
+ [type="tel"],
273
+ [type="url"],
274
+ [type="email"],
275
+ [type="number"] {
276
+ direction: ltr;
277
+ }
278
+ */
279
+ ::-webkit-search-decoration {
280
+ -webkit-appearance: none;
281
+ }
282
+
283
+ ::-webkit-color-swatch-wrapper {
284
+ padding: 0;
285
+ }
286
+
287
+ ::file-selector-button {
288
+ font: inherit;
289
+ -webkit-appearance: button;
290
+ }
291
+
292
+ output {
293
+ display: inline-block;
294
+ }
295
+
296
+ iframe {
297
+ border: 0;
298
+ }
299
+
300
+ summary {
301
+ display: list-item;
302
+ cursor: pointer;
303
+ }
304
+
305
+ progress {
306
+ vertical-align: baseline;
307
+ }
308
+
309
+ [hidden] {
310
+ display: none !important;
311
+ }
312
+
313
+ .visually-hidden,
314
+ .visually-hidden-focusable:not(:focus):not(:focus-within) {
315
+ position: absolute !important;
316
+ width: 1px !important;
317
+ height: 1px !important;
318
+ padding: 0 !important;
319
+ margin: -1px !important;
320
+ overflow: hidden !important;
321
+ clip: rect(0, 0, 0, 0) !important;
322
+ white-space: nowrap !important;
323
+ border: 0 !important;
324
+ }
325
+
326
+ :host {
327
+ --bsi-pagination-padding-x: 0.75rem;
328
+ --bsi-pagination-padding-y: 0.375rem;
329
+ --bsi-pagination-font-size: 1rem;
330
+ --bsi-pagination-color: var(--bsi-color-link);
331
+ --bsi-pagination-bg: hsl(0, 0%, 100%);
332
+ --bsi-pagination-border-width: 0;
333
+ --bsi-pagination-border-color: hsl(0, 0%, 83%);
334
+ --bsi-pagination-border-radius: 4px;
335
+ --bsi-pagination-hover-color: var(--bsi-color-link-hover);
336
+ --bsi-pagination-hover-bg: hsl(0, 0%, 90%);
337
+ --bsi-pagination-hover-border-color: hsl(0, 0%, 83%);
338
+ --bsi-pagination-focus-color: var(--bsi-color-link-hover);
339
+ --bsi-pagination-focus-bg: hsl(0, 0%, 90%);
340
+ --bsi-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
341
+ --bsi-pagination-active-color: hsl(0, 0%, 100%);
342
+ --bsi-pagination-active-bg: hsl(210, 100%, 40%);
343
+ --bsi-pagination-active-border-color: hsl(210, 100%, 40%);
344
+ --bsi-pagination-disabled-color: hsl(0, 0%, 32%);
345
+ --bsi-pagination-disabled-bg: hsl(0, 0%, 100%);
346
+ --bsi-pagination-disabled-border-color: hsl(0, 0%, 83%);
347
+ --bsi-pagination-padding-x: var(--bsi-spacing-s);
348
+ --bsi-pagination-padding-y: var(--bsi-spacing-xxs);
349
+ --bsi-pagination-link-color: var(--bsi-color-link);
350
+ --bsi-pagination-background: transparent;
351
+ --bsi-pagination-border-width: 2px;
352
+ --bsi-pagination-border-color: transparent;
353
+ --bsi-pagination-border-radius: 4px;
354
+ --bsi-pagination-item-size: 3rem;
355
+ --bsi-pagination-font-size: var(--bsi-label-font-size);
356
+ display: flex;
357
+ padding-left: 0;
358
+ list-style: none;
359
+ width: 100%;
360
+ }
361
+
362
+ :host a {
363
+ text-decoration: unset !important;
364
+ }
365
+
366
+ .pagination-wrapper {
367
+ display: flex;
368
+ flex-wrap: wrap;
369
+ align-items: center;
370
+ gap: 1rem;
371
+ margin-block: var(--bsi-spacing-xxs);
372
+ }
373
+
374
+ .pagination-wrapper.pagination-total {
375
+ display: flex;
376
+ flex-direction: column;
377
+ flex-wrap: wrap;
378
+ align-items: center;
379
+ justify-content: center;
380
+ }
381
+
382
+ .pagination {
383
+ display: flex;
384
+ align-items: center;
385
+ padding: 0;
386
+ margin: 0;
387
+ gap: 8px;
388
+ }
389
+
390
+ .pagination-wrapper.pagination-total .pagination {
391
+ margin-bottom: var(--bsi-spacing-xxs);
392
+ }
393
+
394
+ .pagination-next-wrapper,
395
+ .pagination-prev-wrapper {
396
+ display: flex;
397
+ align-items: center;
398
+ }
399
+
400
+ .page-item {
401
+ display: flex;
402
+ padding-left: 0;
403
+ list-style: none;
404
+ height: fit-content;
405
+ }
406
+ .page-item .page-link {
407
+ position: relative;
408
+ display: flex;
409
+ min-width: var(--bsi-pagination-item-size);
410
+ align-items: center;
411
+ justify-content: center;
412
+ padding: var(--bsi-pagination-padding-y) var(--bsi-pagination-padding-x);
413
+ border: var(--bsi-pagination-border-width) solid var(--bsi-pagination-border-color);
414
+ border-radius: var(--bsi-pagination-border-radius);
415
+ color: var(--bsi-pagination-link-color) !important;
416
+ font-weight: var(--bsi-font-weight-solid);
417
+ gap: 0.25rem;
418
+ font-size: var(--bsi-pagination-font-size, 1rem);
419
+ 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;
420
+ }
421
+ @media (prefers-reduced-motion: reduce) {
422
+ .page-item .page-link {
423
+ transition: none;
424
+ }
425
+ }
426
+ .page-item a.page-link:hover {
427
+ --bsi-pagination-link-color: var(--bsi-color-link-hover);
428
+ text-decoration: underline !important;
429
+ }
430
+ .page-item a.page-link:focus-visible {
431
+ border-color: hsl(0, 0%, 0%) !important;
432
+ box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
433
+ outline: 3px solid transparent !important;
434
+ outline-offset: 3px !important;
435
+ }
436
+ .page-item span.page-link {
437
+ pointer-events: none;
438
+ }
439
+
440
+ ::slotted([slot=page-changer]),
441
+ ::slotted([slot=jump-to-page]),
442
+ ::slotted([slot=total]) {
443
+ display: inline-flex;
444
+ align-items: center;
445
+ }
446
+
447
+ ::slotted([slot=total]) {
448
+ margin-bottom: var(--bsi-spacing-s) !important;
449
+ color: var(--bsi-color-text-secondary);
450
+ font-size: var(--bsi-label-font-size) !important;
451
+ font-weight: var(--bsi-font-weight-solid) !important;
452
+ text-align: center;
453
+ }
454
+
455
+ ::slotted([slot=prev]),
456
+ ::slotted([slot=next]) {
457
+ position: relative;
458
+ display: flex;
459
+ min-width: var(--bsi-pagination-item-size);
460
+ height: var(--bsi-pagination-item-size);
461
+ align-items: center;
462
+ justify-content: center;
463
+ padding: var(--bsi-pagination-padding-y) var(--bsi-pagination-padding-x);
464
+ border: var(--bsi-pagination-border-width) solid var(--bsi-pagination-border-color);
465
+ border-radius: var(--bsi-pagination-border-radius);
466
+ color: var(--bsi-pagination-link-color) !important;
467
+ font-weight: var(--bsi-font-weight-solid);
468
+ font-size: var(--bsi-pagination-font-size, 1rem);
469
+ }
470
+
471
+ :host([align=center]) {
472
+ justify-content: center;
473
+ margin: auto;
474
+ }
475
+
476
+ :host([align=end]) {
477
+ width: 100%;
478
+ justify-content: flex-end;
479
+ }
480
+
481
+ :where(:host([responsive])) .pagination-wrapper {
482
+ flex-direction: column;
483
+ align-items: stretch;
484
+ }
485
+ @media (min-width: 576px) {
486
+ :where(:host([responsive])) .pagination-wrapper {
487
+ flex-direction: row;
488
+ align-items: center;
489
+ }
490
+ }
491
+
492
+ :where(:host([responsive])) .pagination-wrapper .pagination {
493
+ width: 100%;
494
+ }
495
+ @media (min-width: 576px) {
496
+ :where(:host([responsive])) .pagination-wrapper .pagination {
497
+ width: auto;
498
+ justify-content: center;
499
+ }
500
+ }
501
+
502
+ .page-link[aria-current] {
503
+ --bsi-pagination-border-color: var(--bsi-color-border-primary-active);
504
+ --bsi-pagination-link-color: var(--bsi-color-link-active);
505
+ pointer-events: none;
506
+ }
507
+
508
+ .page-item.more {
509
+ display: none;
510
+ }
511
+ @media (min-width: 576px) {
512
+ .page-item.more {
513
+ display: flex;
514
+ }
515
+ }`;
516
+
517
+ /* eslint-disable lit-a11y/click-events-have-key-events */
518
+ let ItPagination = class ItPagination extends BaseComponent {
519
+ constructor() {
520
+ super(...arguments);
521
+ this.value = '1';
522
+ this.total = undefined;
523
+ this.align = 'center';
524
+ this.disableResponsive = false;
525
+ this.simpleMode = false;
526
+ this.visiblePages = 5;
527
+ this.itAriaLabel = '';
528
+ }
529
+ updated(changedProperties) {
530
+ super.updated?.(changedProperties);
531
+ if (changedProperties.has('value') ||
532
+ changedProperties.has('total') ||
533
+ changedProperties.has('simpleMode') ||
534
+ changedProperties.has('visiblePages')) {
535
+ this.updatePaginationItems();
536
+ this.updatePaginationItemsClasses();
537
+ this.updateNavigationButtons();
538
+ }
539
+ if (changedProperties.has('disableResponsive') && changedProperties.get('disableResponsive') !== undefined) {
540
+ this.updatePaginationItemsClasses();
541
+ }
542
+ }
543
+ emitPageChange(newPage) {
544
+ const currentPage = parseInt(this.value, 10);
545
+ const totalPages = this.total ? parseInt(this.total, 10) : this.paginationItems.length;
546
+ if (newPage < 1)
547
+ return;
548
+ if (totalPages > 0 && newPage > totalPages)
549
+ return;
550
+ if (newPage === currentPage)
551
+ return;
552
+ const event = new CustomEvent('it-pagination-change', {
553
+ detail: { page: newPage },
554
+ bubbles: true,
555
+ composed: true,
556
+ });
557
+ this.dispatchEvent(event);
558
+ this.value = newPage.toString();
559
+ }
560
+ handleItemClick(e) {
561
+ e.stopPropagation(); // Fermiamo l'evento interno, non serve che esca
562
+ const page = parseInt(e.detail.page, 10);
563
+ if (!Number.isNaN(page)) {
564
+ this.emitPageChange(page);
565
+ }
566
+ }
567
+ handlePrevClick(e) {
568
+ e.preventDefault();
569
+ const currentPage = parseInt(this.value, 10);
570
+ if (currentPage > 1) {
571
+ this.emitPageChange(currentPage - 1);
572
+ }
573
+ }
574
+ handleNextClick(e) {
575
+ e.preventDefault();
576
+ const currentPage = parseInt(this.value, 10);
577
+ const totalPages = this.total ? parseInt(this.total, 10) : this.paginationItems.length;
578
+ // Se non c'è 'total', assumiamo che ci siano altre pagine finché ci sono items
579
+ if (!totalPages || currentPage < totalPages) {
580
+ this.emitPageChange(currentPage + 1);
581
+ }
582
+ }
583
+ updatePaginationItemsClasses() {
584
+ if (this.paginationItems.length) {
585
+ const pages = this.calculatePages();
586
+ this.paginationItems.forEach((item) => {
587
+ const isCurrentPage = item.page === this.value;
588
+ const itemPageNum = parseInt(item.page, 10);
589
+ const isInVisiblePages = pages.includes(itemPageNum);
590
+ // Remove all classes first
591
+ item.classList.remove('d-none', 'd-sm-flex');
592
+ // In simple mode, hide all pagination items (we render current/total instead)
593
+ if (this.simpleMode) {
594
+ item.classList.add('d-none');
595
+ return;
596
+ }
597
+ // In more mode, hide items not in visible pages
598
+ if (!isInVisiblePages) {
599
+ item.classList.add('d-none');
600
+ return;
601
+ }
602
+ // Apply responsive hiding for non-current pages (when NOT disabled)
603
+ if (!this.disableResponsive && !isCurrentPage) {
604
+ item.classList.add('d-none', 'd-sm-flex');
605
+ }
606
+ });
607
+ }
608
+ }
609
+ updatePaginationItems() {
610
+ if (this.paginationItems.length) {
611
+ this.paginationItems.forEach((item) => {
612
+ const isCurrentPage = item.page === this.value;
613
+ // eslint-disable-next-line no-param-reassign
614
+ item.current = isCurrentPage;
615
+ });
616
+ }
617
+ }
618
+ updateNavigationButtons() {
619
+ const currentPage = parseInt(this.value, 10);
620
+ const totalPages = this.total ? parseInt(this.total, 10) : this.paginationItems.length;
621
+ // Update prev button visual state
622
+ if (this.prevElements.length) {
623
+ this.prevElements.forEach((el) => {
624
+ if (currentPage <= 1) {
625
+ el.setAttribute('aria-disabled', 'true');
626
+ el.classList.add('disabled');
627
+ // el.setAttribute('tabindex', '-1');
628
+ }
629
+ else {
630
+ el.removeAttribute('aria-disabled');
631
+ el.classList.remove('disabled');
632
+ }
633
+ el.classList.add('page-link');
634
+ });
635
+ }
636
+ // Update next button visual state
637
+ if (this.nextElements.length) {
638
+ this.nextElements.forEach((el) => {
639
+ if (totalPages && currentPage >= totalPages) {
640
+ el.setAttribute('aria-disabled', 'true');
641
+ el.classList.add('disabled');
642
+ }
643
+ else {
644
+ el.removeAttribute('aria-disabled');
645
+ el.classList.remove('disabled');
646
+ }
647
+ el.classList.add('page-link');
648
+ });
649
+ }
650
+ }
651
+ handleSlotChange() {
652
+ this.updatePaginationItems();
653
+ this.updatePaginationItemsClasses();
654
+ this.updateNavigationButtons();
655
+ }
656
+ handlePrevSlotChange() {
657
+ this.updateNavigationButtons();
658
+ }
659
+ handleNextSlotChange() {
660
+ this.updateNavigationButtons();
661
+ }
662
+ handleTotalSlotChange() {
663
+ // Update component and rerender when total slot changes
664
+ this.requestUpdate();
665
+ }
666
+ /**
667
+ * Calculate which pages to display based on simpleMode and visiblePages
668
+ * Returns an array of page numbers to show
669
+ */
670
+ calculatePages() {
671
+ const currentPage = parseInt(this.value, 10);
672
+ const totalPages = this.total ? parseInt(this.total, 10) : this.paginationItems.length;
673
+ if (this.simpleMode) {
674
+ return [currentPage];
675
+ }
676
+ if (totalPages <= this.visiblePages) {
677
+ // If total pages is less than visiblePages, show all
678
+ return Array.from({ length: totalPages }, (_, i) => i + 1);
679
+ }
680
+ // More mode: calculate which pages to show
681
+ const halfVisiblePages = Math.floor(this.visiblePages / 2);
682
+ let start = currentPage > halfVisiblePages ? currentPage - halfVisiblePages : 1;
683
+ // Calculate the length based on visible pages
684
+ const length = this.visiblePages;
685
+ // Adjust start if we're near the end
686
+ if (currentPage >= totalPages) {
687
+ start -= halfVisiblePages;
688
+ }
689
+ else if (currentPage >= totalPages - halfVisiblePages) {
690
+ start -= totalPages - (currentPage + 1);
691
+ }
692
+ // Make sure start is at least 1
693
+ if (start < 1) {
694
+ start = 1;
695
+ }
696
+ return Array.from({ length }, (_, i) => i + start).filter((page) => page <= totalPages);
697
+ }
698
+ render() {
699
+ const navClasses = this.composeClass('pagination-wrapper', this.totalElements.length > 0 && 'pagination-total');
700
+ const ulClasses = this.composeClass('pagination', this.disableResponsive && 'pagination-responsive');
701
+ const currentPage = parseInt(this.value, 10);
702
+ const totalPages = this.total ? parseInt(this.total, 10) : this.paginationItems.length;
703
+ const pages = this.calculatePages();
704
+ const showFirstPage = totalPages > this.visiblePages && pages[0] > 1;
705
+ const showFirstEllipsis = totalPages > this.visiblePages && pages[0] > 2;
706
+ const showLastPage = totalPages > this.visiblePages && pages[pages.length - 1] < totalPages;
707
+ const showLastEllipsis = totalPages > this.visiblePages && pages[pages.length - 1] < totalPages - 1;
708
+ return html `
709
+ <nav class="${navClasses}" aria-label="${this.itAriaLabel}">
710
+ <ul class="${ulClasses}" @it-item-click="${this.handleItemClick}" part="pagination-list">
711
+ <li class="pagination-prev-wrapper page-item" @click="${this.handlePrevClick}">
712
+ <slot name="prev" @slotchange="${this.handlePrevSlotChange}"></slot>
713
+ </li>
714
+
715
+ ${when(this.simpleMode, () => html `
716
+ <li class="page-item visually-hidden">
717
+ <a class="page-link" href="#" aria-current="page"> Pagina ${currentPage} di ${totalPages} </a>
718
+ </li>
719
+ <li class="page-item active" part="current-page-simple-mode">
720
+ <span class="page-link" aria-current="page">${currentPage}</span>
721
+ </li>
722
+ <li class="page-item" aria-hidden="true"><span class="page-link">/</span></li>
723
+ <li class="page-item" part="total-pages-simple-mode">
724
+ <span class="page-link">${totalPages}</span>
725
+ </li>
726
+ `, () => html `
727
+ ${when(showFirstPage, () => html `
728
+ <li class="page-item more">
729
+ <a class="page-link" href="#" @click="${(e) => this.handlePageClick(e, 1)}">1</a>
730
+ </li>
731
+ `)}
732
+ ${when(showFirstEllipsis, () => html `
733
+ <li class="page-item more">
734
+ <span class="page-link">...</span>
735
+ </li>
736
+ `)}
737
+ <slot @slotchange="${this.handleSlotChange}"></slot>
738
+ ${when(showLastEllipsis, () => html `
739
+ <li class="page-item more">
740
+ <span class="page-link">...</span>
741
+ </li>
742
+ `)}
743
+ ${when(showLastPage, () => html `
744
+ <li class="page-item more">
745
+ <a class="page-link" href="#" @click="${(e) => this.handlePageClick(e, totalPages)}">
746
+ ${totalPages}
747
+ </a>
748
+ </li>
749
+ `)}
750
+ `)}
751
+
752
+ <li class="pagination-next-wrapper page-item" @click="${this.handleNextClick}">
753
+ <slot name="next" @slotchange="${this.handleNextSlotChange}"></slot>
754
+ </li>
755
+ </ul>
756
+
757
+ <slot name="page-changer"></slot>
758
+ <slot name="jump-to-page"></slot>
759
+ <slot name="total" @slotchange="${this.handleTotalSlotChange}"></slot>
760
+ </nav>
761
+ `;
762
+ }
763
+ handlePageClick(e, page) {
764
+ e.preventDefault();
765
+ this.emitPageChange(page);
766
+ }
767
+ };
768
+ ItPagination.styles = styles;
769
+ ItPagination.shadowRootOptions = { ...BaseComponent.shadowRootOptions, delegatesFocus: true };
770
+ __decorate([
771
+ queryAssignedElements({ selector: 'it-pagination-item' }),
772
+ __metadata("design:type", Array)
773
+ ], ItPagination.prototype, "paginationItems", void 0);
774
+ __decorate([
775
+ queryAssignedElements({ slot: 'prev' }),
776
+ __metadata("design:type", Array)
777
+ ], ItPagination.prototype, "prevElements", void 0);
778
+ __decorate([
779
+ queryAssignedElements({ slot: 'next' }),
780
+ __metadata("design:type", Array)
781
+ ], ItPagination.prototype, "nextElements", void 0);
782
+ __decorate([
783
+ queryAssignedElements({ slot: 'total' }),
784
+ __metadata("design:type", Array)
785
+ ], ItPagination.prototype, "totalElements", void 0);
786
+ __decorate([
787
+ property({ type: String, reflect: true }),
788
+ __metadata("design:type", Object)
789
+ ], ItPagination.prototype, "value", void 0);
790
+ __decorate([
791
+ property({ type: String, reflect: true }),
792
+ __metadata("design:type", Object)
793
+ ], ItPagination.prototype, "total", void 0);
794
+ __decorate([
795
+ property({ type: String, reflect: true }),
796
+ __metadata("design:type", String)
797
+ ], ItPagination.prototype, "align", void 0);
798
+ __decorate([
799
+ property({ type: Boolean, reflect: true }),
800
+ __metadata("design:type", Object)
801
+ ], ItPagination.prototype, "disableResponsive", void 0);
802
+ __decorate([
803
+ property({ type: Boolean, reflect: true, attribute: 'simple-mode' }),
804
+ __metadata("design:type", Object)
805
+ ], ItPagination.prototype, "simpleMode", void 0);
806
+ __decorate([
807
+ property({ type: Number, reflect: true, attribute: 'visible-pages' }),
808
+ __metadata("design:type", Object)
809
+ ], ItPagination.prototype, "visiblePages", void 0);
810
+ __decorate([
811
+ property({ type: String, attribute: 'it-aria-label', reflect: true }),
812
+ __metadata("design:type", Object)
813
+ ], ItPagination.prototype, "itAriaLabel", void 0);
814
+ ItPagination = __decorate([
815
+ customElement('it-pagination')
816
+ ], ItPagination);
817
+
818
+ export { ItPagination };
819
+ //# sourceMappingURL=it-pagination.js.map