@aiaiai-pt/design-system 0.61.2 → 0.62.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.
|
@@ -66,6 +66,21 @@
|
|
|
66
66
|
/** @type {string} — label for the "next" nav button */
|
|
67
67
|
nextLabel = 'NEXT',
|
|
68
68
|
|
|
69
|
+
/* Host-language text (atelier#2674): the summary and the navigation's
|
|
70
|
+
accessible names. Each count arrives already formatted. */
|
|
71
|
+
/** @type {(total: string) => string} — cursor-mode summary */
|
|
72
|
+
totalLabel = (total) => `${total} total`,
|
|
73
|
+
/** @type {(start: string, end: string, total: string) => string} — offset-mode range */
|
|
74
|
+
rangeLabel = (start, end, total) => `${start}–${end} of ${total}`,
|
|
75
|
+
/** @type {string} — accessible name of the page-size control */
|
|
76
|
+
rowsPerPageLabel = 'Rows per page',
|
|
77
|
+
/** @type {string} — accessible name of the previous-page button */
|
|
78
|
+
previousPageLabel = 'Previous page',
|
|
79
|
+
/** @type {string} — accessible name of the next-page button */
|
|
80
|
+
nextPageLabel = 'Next page',
|
|
81
|
+
/** @type {string | undefined} — BCP 47 locale the counts are formatted in */
|
|
82
|
+
locale = undefined,
|
|
83
|
+
|
|
69
84
|
/** @type {string} */
|
|
70
85
|
class: className = '',
|
|
71
86
|
...rest
|
|
@@ -87,13 +102,17 @@
|
|
|
87
102
|
total_items === undefined
|
|
88
103
|
? ''
|
|
89
104
|
: mode === 'cursor'
|
|
90
|
-
?
|
|
105
|
+
? totalLabel(total_items.toLocaleString(locale))
|
|
91
106
|
: (() => {
|
|
92
107
|
const start = (current_page - 1) * page_size + 1;
|
|
93
108
|
const end = Math.min(current_page * page_size, total_items);
|
|
94
109
|
return start > total_items
|
|
95
|
-
?
|
|
96
|
-
:
|
|
110
|
+
? totalLabel(total_items.toLocaleString(locale))
|
|
111
|
+
: rangeLabel(
|
|
112
|
+
start.toLocaleString(locale),
|
|
113
|
+
end.toLocaleString(locale),
|
|
114
|
+
total_items.toLocaleString(locale)
|
|
115
|
+
);
|
|
97
116
|
})()
|
|
98
117
|
);
|
|
99
118
|
|
|
@@ -138,7 +157,7 @@
|
|
|
138
157
|
value={page_size_value}
|
|
139
158
|
options={page_size_options}
|
|
140
159
|
onchange={(val) => on_page_size_change?.(Number(val))}
|
|
141
|
-
aria-label=
|
|
160
|
+
aria-label={rowsPerPageLabel}
|
|
142
161
|
/>
|
|
143
162
|
</div>
|
|
144
163
|
{/if}
|
|
@@ -150,15 +169,15 @@
|
|
|
150
169
|
<span class="pagination-spacer" aria-hidden="true"></span>
|
|
151
170
|
|
|
152
171
|
{#if mode === 'cursor'}
|
|
153
|
-
<button class="pagination-nav" disabled={!has_prev} onclick={on_prev} aria-label=
|
|
172
|
+
<button class="pagination-nav" disabled={!has_prev} onclick={on_prev} aria-label={previousPageLabel}>
|
|
154
173
|
{@render chevronLeft()}<span>{prevLabel}</span>
|
|
155
174
|
</button>
|
|
156
|
-
<button class="pagination-nav" disabled={!has_next} onclick={on_next} aria-label=
|
|
175
|
+
<button class="pagination-nav" disabled={!has_next} onclick={on_next} aria-label={nextPageLabel}>
|
|
157
176
|
<span>{nextLabel}</span>{@render chevronRight()}
|
|
158
177
|
</button>
|
|
159
178
|
|
|
160
179
|
{:else}
|
|
161
|
-
<button class="pagination-nav" disabled={current_page <= 1} onclick={() => on_page_change?.(current_page - 1)} aria-label=
|
|
180
|
+
<button class="pagination-nav" disabled={current_page <= 1} onclick={() => on_page_change?.(current_page - 1)} aria-label={previousPageLabel}>
|
|
162
181
|
{@render chevronLeft()}<span>{prevLabel}</span>
|
|
163
182
|
</button>
|
|
164
183
|
|
|
@@ -181,7 +200,7 @@
|
|
|
181
200
|
{/each}
|
|
182
201
|
</div>
|
|
183
202
|
|
|
184
|
-
<button class="pagination-nav" disabled={current_page >= (total_pages ?? current_page)} onclick={() => on_page_change?.(current_page + 1)} aria-label=
|
|
203
|
+
<button class="pagination-nav" disabled={current_page >= (total_pages ?? current_page)} onclick={() => on_page_change?.(current_page + 1)} aria-label={nextPageLabel}>
|
|
185
204
|
<span>{nextLabel}</span>{@render chevronRight()}
|
|
186
205
|
</button>
|
|
187
206
|
{/if}
|
|
@@ -46,6 +46,12 @@ declare const Pagination: import("svelte").Component<{
|
|
|
46
46
|
on_page_size_change?: any;
|
|
47
47
|
prevLabel?: string;
|
|
48
48
|
nextLabel?: string;
|
|
49
|
+
totalLabel?: Function;
|
|
50
|
+
rangeLabel?: Function;
|
|
51
|
+
rowsPerPageLabel?: string;
|
|
52
|
+
previousPageLabel?: string;
|
|
53
|
+
nextPageLabel?: string;
|
|
54
|
+
locale?: any;
|
|
49
55
|
class?: string;
|
|
50
56
|
} & Record<string, any>, {}, "">;
|
|
51
57
|
type $$ComponentProps = {
|
|
@@ -63,5 +69,11 @@ type $$ComponentProps = {
|
|
|
63
69
|
on_page_size_change?: any;
|
|
64
70
|
prevLabel?: string;
|
|
65
71
|
nextLabel?: string;
|
|
72
|
+
totalLabel?: Function;
|
|
73
|
+
rangeLabel?: Function;
|
|
74
|
+
rowsPerPageLabel?: string;
|
|
75
|
+
previousPageLabel?: string;
|
|
76
|
+
nextPageLabel?: string;
|
|
77
|
+
locale?: any;
|
|
66
78
|
class?: string;
|
|
67
79
|
} & Record<string, any>;
|