@kubex/zinc 1.0.25 → 1.0.98
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/.claude/project.md +556 -0
- package/.github/workflows/js_build_and_deploy.yaml +9 -10
- package/dist/custom-elements.json +13431 -8728
- package/dist/vscode.html-custom-data.json +571 -37
- package/dist/web-types.json +1439 -181
- package/dist/zn.d.ts +1642 -661
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +1406 -891
- package/docs/_utilities/code-previews.cjs +10 -1
- package/docs/assets/scripts/docs.js +42 -18
- package/docs/data/data-table.json +229 -66
- package/docs/data/empty.json +6 -0
- package/docs/data/products-table.json +41 -193
- package/docs/pages/components/action-bar.md +121 -6
- package/docs/pages/components/alert.md +118 -15
- package/docs/pages/components/animated-button.md +299 -0
- package/docs/pages/components/audio-select.md +534 -0
- package/docs/pages/components/bulk-actions.md +79 -5
- package/docs/pages/components/button-group.md +235 -27
- package/docs/pages/components/button.md +139 -1
- package/docs/pages/components/chart.md +365 -9
- package/docs/pages/components/checkbox.md +387 -58
- package/docs/pages/components/chip.md +253 -33
- package/docs/pages/components/collapsible.md +393 -46
- package/docs/pages/components/cols.md +152 -30
- package/docs/pages/components/confirm.md +182 -16
- package/docs/pages/components/copy-button.md +169 -6
- package/docs/pages/components/data-select.md +194 -15
- package/docs/pages/components/data-table-filter.md +96 -5
- package/docs/pages/components/data-table-search.md +451 -0
- package/docs/pages/components/data-table-sort.md +66 -5
- package/docs/pages/components/data-table.md +727 -66
- package/docs/pages/components/datepicker.md +402 -7
- package/docs/pages/components/defined-label.md +120 -5
- package/docs/pages/components/dialog.md +339 -59
- package/docs/pages/components/dropdown.md +366 -11
- package/docs/pages/components/editor.md +604 -7
- package/docs/pages/components/empty-state.md +315 -16
- package/docs/pages/components/expanding-action.md +212 -28
- package/docs/pages/components/file.md +421 -12
- package/docs/pages/components/filter-container.md +158 -5
- package/docs/pages/components/filter-wrapper.md +167 -6
- package/docs/pages/components/form-group.md +383 -6
- package/docs/pages/components/hover-container.md +237 -6
- package/docs/pages/components/icon-picker.md +121 -0
- package/docs/pages/components/icon.md +454 -48
- package/docs/pages/components/inline-edit.md +787 -19
- package/docs/pages/components/input-group.md +207 -13
- package/docs/pages/components/input.md +194 -0
- package/docs/pages/components/key-container.md +115 -0
- package/docs/pages/components/key.md +101 -0
- package/docs/pages/components/menu.md +512 -6
- package/docs/pages/components/note.md +239 -36
- package/docs/pages/components/opt-group.md +107 -0
- package/docs/pages/components/pagination.md +332 -6
- package/docs/pages/components/pane.md +222 -6
- package/docs/pages/components/panel.md +213 -26
- package/docs/pages/components/popup.md +1354 -6
- package/docs/pages/components/priority-list.md +233 -0
- package/docs/pages/components/progress-bar.md +387 -6
- package/docs/pages/components/radio-group.md +242 -5
- package/docs/pages/components/radio.md +474 -6
- package/docs/pages/components/rating.md +331 -7
- package/docs/pages/components/reveal.md +524 -6
- package/docs/pages/components/scroll-container.md +552 -6
- package/docs/pages/components/select.md +762 -160
- package/docs/pages/components/skeleton.md +473 -30
- package/docs/pages/components/slideout.md +261 -5
- package/docs/pages/components/sp.md +99 -41
- package/docs/pages/components/split-button.md +347 -9
- package/docs/pages/components/split-pane.md +445 -6
- package/docs/pages/components/stat.md +549 -9
- package/docs/pages/components/status-indicator.md +230 -1
- package/docs/pages/components/stepper.md +563 -6
- package/docs/pages/components/tabs.md +439 -13
- package/docs/pages/components/textarea.md +415 -17
- package/docs/pages/components/tile.md +385 -26
- package/docs/pages/components/toggle.md +424 -6
- package/docs/pages/components/tooltip.md +367 -0
- package/docs/pages/components/translation-group.md +210 -0
- package/docs/pages/components/translations.md +319 -19
- package/docs/pages/components/vertical-stepper.md +401 -8
- package/docs/pages/components/well.md +300 -3
- package/docs/pages/getting-started/form-controls.md +162 -0
- package/docs/pages/index.md +116 -15
- package/package.json +5 -6
- package/scss/_global-spacing.scss +4 -0
- package/scss/_root.scss +2 -2
- package/scss/boot.scss +19 -0
- package/scss/shared/layout.scss +5 -0
- package/scss/themes/_light.scss +3 -3
- package/src/components/alert/alert.scss +1 -0
- package/src/components/animated-button/README.md +306 -0
- package/src/components/animated-button/animated-button.component.ts +229 -0
- package/src/components/animated-button/animated-button.scss +228 -0
- package/src/components/animated-button/animated-button.test.ts +143 -0
- package/src/components/animated-button/index.ts +12 -0
- package/src/components/button/button.component.ts +5 -0
- package/src/components/button-group/button-group.component.ts +25 -13
- package/src/components/button-group/button-group.scss +6 -0
- package/src/components/checkbox/checkbox.component.ts +4 -0
- package/src/components/checkbox/checkbox.scss +7 -4
- package/src/components/checkbox-group/checkbox-group.scss +7 -0
- package/src/components/chip/chip.component.ts +7 -2
- package/src/components/chip/chip.scss +16 -2
- package/src/components/collapsible/collapsible.component.ts +27 -20
- package/src/components/cols/cols.component.ts +14 -2
- package/src/components/cols/cols.scss +6 -12
- package/src/components/confirm/confirm.component.ts +7 -0
- package/src/components/copy-button/copy-button.component.ts +12 -11
- package/src/components/data-select/data-select.component.ts +215 -44
- package/src/components/data-select/data-select.scss +66 -6
- package/src/components/data-select/providers/currency-data-provider.ts +20 -6
- package/src/components/data-select/providers/provider.ts +1 -0
- package/src/components/data-select/providers/us-state-data-provider.ts +68 -0
- package/src/components/data-table/data-table.component.ts +81 -22
- package/src/components/data-table-search/data-table-search.component.ts +184 -0
- package/src/components/data-table-search/data-table-search.scss +17 -0
- package/src/components/data-table-search/data-table-search.test.ts +11 -0
- package/src/components/data-table-search/index.ts +12 -0
- package/src/components/datepicker/datepicker.component.ts +347 -13
- package/src/components/dialog/dialog.component.ts +1 -1
- package/src/components/empty-state/empty-state.scss +6 -1
- package/src/components/header/header.scss +3 -3
- package/src/components/icon/icon.component.ts +23 -1
- package/src/components/icon/icon.scss +23 -0
- package/src/components/icon-picker/brand-icons.ts +24 -0
- package/src/components/icon-picker/icon-picker.component.ts +407 -0
- package/src/components/icon-picker/icon-picker.scss +205 -0
- package/src/components/icon-picker/index.ts +12 -0
- package/src/components/icon-picker/line-icons.ts +612 -0
- package/src/components/icon-picker/material-icons.ts +14543 -0
- package/src/components/inline-edit/inline-edit.component.ts +190 -46
- package/src/components/inline-edit/inline-edit.scss +29 -0
- package/src/components/inline-edit/inline-edit.test.ts +314 -1
- package/src/components/input/input.component.ts +324 -5
- package/src/components/input/input.scss +87 -0
- package/src/components/input-group/input-group.component.ts +28 -7
- package/src/components/input-group/input-group.scss +48 -10
- package/src/components/item/item.component.ts +11 -2
- package/src/components/item/item.scss +7 -0
- package/src/components/key/index.ts +12 -0
- package/src/components/key/key.component.ts +47 -0
- package/src/components/key/key.scss +38 -0
- package/src/components/key-container/index.ts +12 -0
- package/src/components/key-container/key-container.component.ts +142 -0
- package/src/components/key-container/key-container.scss +33 -0
- package/src/components/menu-item/menu-item.component.ts +20 -0
- package/src/components/menu-item/menu-item.scss +69 -2
- package/src/components/navbar/navbar.component.ts +103 -11
- package/src/components/navbar/navbar.scss +6 -1
- package/src/components/opt-group/index.ts +12 -0
- package/src/components/opt-group/opt-group.component.ts +74 -0
- package/src/components/opt-group/opt-group.scss +37 -0
- package/src/components/opt-group/opt-group.test.ts +27 -0
- package/src/components/option/option.component.ts +1 -16
- package/src/components/option/option.scss +4 -0
- package/src/components/panel/panel.component.ts +10 -8
- package/src/components/panel/panel.scss +20 -0
- package/src/components/priority-list/index.ts +12 -0
- package/src/components/priority-list/priority-list.component.ts +611 -0
- package/src/components/priority-list/priority-list.scss +185 -0
- package/src/components/priority-list/priority-list.test.ts +139 -0
- package/src/components/progress-bar/progress-bar.component.ts +22 -16
- package/src/components/radio/radio.scss +10 -3
- package/src/components/select/select.component.ts +812 -72
- package/src/components/select/select.scss +108 -2
- package/src/components/select/select.test.ts +147 -2
- package/src/components/settings-container/settings-container.component.ts +44 -19
- package/src/components/settings-container/settings-container.scss +1 -1
- package/src/components/skeleton/skeleton.component.ts +6 -1
- package/src/components/slideout/slideout.scss +8 -3
- package/src/components/sp/sp.component.ts +3 -1
- package/src/components/sp/sp.scss +19 -0
- package/src/components/stepper/stepper.component.ts +16 -10
- package/src/components/textarea/textarea.scss +0 -4
- package/src/components/tile/tile.component.ts +12 -3
- package/src/components/tile/tile.scss +1 -1
- package/src/components/timer/timer.component.ts +15 -2
- package/src/components/toggle/toggle.component.ts +29 -26
- package/src/components/toggle/toggle.scss +13 -1
- package/src/components/translation-group/index.ts +12 -0
- package/src/components/translation-group/translation-group.component.ts +207 -0
- package/src/components/translation-group/translation-group.scss +8 -0
- package/src/components/translations/translations.component.ts +90 -44
- package/src/components/translations/translations.scss +4 -0
- package/src/components/vertical-stepper/vertical-stepper.component.ts +14 -9
- package/src/events/events.ts +12 -7
- package/src/events/zn-language-change.ts +7 -0
- package/src/events/zn-purchase.ts +11 -0
- package/src/events/zn-redirect.ts +7 -0
- package/src/events/zn-reorder.ts +7 -0
- package/src/events/zn-search-change.ts +11 -0
- package/src/events/zn-submit.ts +1 -1
- package/src/form-control.scss +4 -0
- package/src/internal/form-navigation.ts +510 -0
- package/src/internal/form.ts +6 -0
- package/src/zinc.ts +91 -83
|
@@ -1,22 +1,348 @@
|
|
|
1
1
|
---
|
|
2
2
|
meta:
|
|
3
3
|
title: Pagination
|
|
4
|
-
description:
|
|
4
|
+
description: Pagination components help users navigate through pages of content.
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
```html:preview
|
|
9
|
-
<zn-pagination></zn-pagination>
|
|
9
|
+
<zn-pagination total="100" limit="10" page="1" uri="#page#"></zn-pagination>
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
+
Pagination controls allow users to navigate through large sets of data by dividing content into discrete pages. The component automatically generates page number buttons, previous/next navigation, and handles the display logic for showing a reasonable number of page buttons.
|
|
13
|
+
|
|
12
14
|
## Examples
|
|
13
15
|
|
|
14
|
-
###
|
|
16
|
+
### Basic Pagination
|
|
17
|
+
|
|
18
|
+
Use the `total`, `limit`, and `page` attributes to configure the pagination. The `uri` attribute defines the URL pattern for page links, where `#page#` will be replaced with the page number.
|
|
19
|
+
|
|
20
|
+
```html:preview
|
|
21
|
+
<zn-pagination total="250" limit="25" page="1" uri="/items?page=#page#"></zn-pagination>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Current Page
|
|
25
|
+
|
|
26
|
+
The `page` attribute sets the currently active page. The active page is highlighted and non-clickable.
|
|
27
|
+
|
|
28
|
+
```html:preview
|
|
29
|
+
<zn-pagination total="200" limit="20" page="5" uri="#page#"></zn-pagination>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Different Page Sizes
|
|
33
|
+
|
|
34
|
+
Use the `limit` attribute to control how many items are shown per page. This affects the total number of pages calculated.
|
|
35
|
+
|
|
36
|
+
```html:preview
|
|
37
|
+
<zn-pagination total="100" limit="10" page="1" uri="#page#"></zn-pagination>
|
|
38
|
+
<br />
|
|
39
|
+
<zn-pagination total="100" limit="20" page="1" uri="#page#"></zn-pagination>
|
|
40
|
+
<br />
|
|
41
|
+
<zn-pagination total="100" limit="50" page="1" uri="#page#"></zn-pagination>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### First Page
|
|
45
|
+
|
|
46
|
+
When on the first page, the "Previous" button is disabled.
|
|
47
|
+
|
|
48
|
+
```html:preview
|
|
49
|
+
<zn-pagination total="100" limit="10" page="1" uri="#page#"></zn-pagination>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Last Page
|
|
53
|
+
|
|
54
|
+
When on the last page, the "Next" button is disabled.
|
|
55
|
+
|
|
56
|
+
```html:preview
|
|
57
|
+
<zn-pagination total="100" limit="10" page="10" uri="#page#"></zn-pagination>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Middle Pages
|
|
61
|
+
|
|
62
|
+
When navigating through middle pages, the component shows up to 5 page buttons centered around the current page, with Previous and Next buttons enabled.
|
|
63
|
+
|
|
64
|
+
```html:preview
|
|
65
|
+
<zn-pagination total="200" limit="10" page="8" uri="#page#"></zn-pagination>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Few Pages
|
|
69
|
+
|
|
70
|
+
When there are 5 or fewer total pages, all page numbers are displayed.
|
|
71
|
+
|
|
72
|
+
```html:preview
|
|
73
|
+
<zn-pagination total="50" limit="10" page="3" uri="#page#"></zn-pagination>
|
|
74
|
+
<br />
|
|
75
|
+
<zn-pagination total="30" limit="10" page="2" uri="#page#"></zn-pagination>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Many Pages
|
|
79
|
+
|
|
80
|
+
For larger datasets with many pages, the component shows a window of up to 5 page buttons. The window adjusts based on the current page position.
|
|
81
|
+
|
|
82
|
+
```html:preview
|
|
83
|
+
<zn-pagination total="1000" limit="10" page="1" uri="#page#"></zn-pagination>
|
|
84
|
+
<br />
|
|
85
|
+
<zn-pagination total="1000" limit="10" page="50" uri="#page#"></zn-pagination>
|
|
86
|
+
<br />
|
|
87
|
+
<zn-pagination total="1000" limit="10" page="100" uri="#page#"></zn-pagination>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Custom URI Patterns
|
|
91
|
+
|
|
92
|
+
The `uri` attribute supports any URL pattern. Use `#page#` as a placeholder for the page number.
|
|
93
|
+
|
|
94
|
+
```html:preview
|
|
95
|
+
<zn-pagination total="150" limit="15" page="3" uri="/products/category/electronics?page=#page#"></zn-pagination>
|
|
96
|
+
<br />
|
|
97
|
+
<zn-pagination total="150" limit="15" page="3" uri="/api/users/#page#"></zn-pagination>
|
|
98
|
+
<br />
|
|
99
|
+
<zn-pagination total="150" limit="15" page="3" uri="?q=search&page=#page#&sort=asc"></zn-pagination>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Dynamic Pagination with JavaScript
|
|
103
|
+
|
|
104
|
+
You can dynamically update pagination properties to respond to data changes.
|
|
105
|
+
|
|
106
|
+
```html:preview
|
|
107
|
+
<div id="pagination-demo">
|
|
108
|
+
<div style="margin-bottom: 1rem; padding: 1rem; background: #f5f5f5; border-radius: 4px;">
|
|
109
|
+
<strong>Current Settings:</strong>
|
|
110
|
+
<div id="settings-display" style="margin-top: 0.5rem; font-family: monospace; font-size: 13px;"></div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<zn-pagination id="dynamic-pagination" total="100" limit="10" page="1" uri="#page#"></zn-pagination>
|
|
114
|
+
|
|
115
|
+
<div style="margin-top: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap;">
|
|
116
|
+
<zn-button id="set-page-1" size="small">Go to Page 1</zn-button>
|
|
117
|
+
<zn-button id="set-page-5" size="small">Go to Page 5</zn-button>
|
|
118
|
+
<zn-button id="set-total-50" size="small" color="info">Set Total: 50</zn-button>
|
|
119
|
+
<zn-button id="set-total-200" size="small" color="info">Set Total: 200</zn-button>
|
|
120
|
+
<zn-button id="set-limit-5" size="small" color="success">Set Limit: 5</zn-button>
|
|
121
|
+
<zn-button id="set-limit-20" size="small" color="success">Set Limit: 20</zn-button>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<script type="module">
|
|
126
|
+
const pagination = document.querySelector('#dynamic-pagination');
|
|
127
|
+
const display = document.querySelector('#settings-display');
|
|
128
|
+
|
|
129
|
+
function updateDisplay() {
|
|
130
|
+
const totalPages = Math.ceil(pagination.total / pagination.limit);
|
|
131
|
+
display.innerHTML = `
|
|
132
|
+
Page: ${pagination.page} / ${totalPages}<br>
|
|
133
|
+
Total Items: ${pagination.total}<br>
|
|
134
|
+
Items per Page: ${pagination.limit}<br>
|
|
135
|
+
URI Pattern: ${pagination.uri}
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Initial display
|
|
140
|
+
updateDisplay();
|
|
141
|
+
|
|
142
|
+
// Listen for attribute changes
|
|
143
|
+
const observer = new MutationObserver(updateDisplay);
|
|
144
|
+
observer.observe(pagination, { attributes: true });
|
|
145
|
+
|
|
146
|
+
document.querySelector('#set-page-1').addEventListener('click', () => {
|
|
147
|
+
pagination.page = 1;
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
document.querySelector('#set-page-5').addEventListener('click', () => {
|
|
151
|
+
pagination.page = 5;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
document.querySelector('#set-total-50').addEventListener('click', () => {
|
|
155
|
+
pagination.total = 50;
|
|
156
|
+
pagination.page = Math.min(pagination.page, Math.ceil(50 / pagination.limit));
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
document.querySelector('#set-total-200').addEventListener('click', () => {
|
|
160
|
+
pagination.total = 200;
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
document.querySelector('#set-limit-5').addEventListener('click', () => {
|
|
164
|
+
pagination.limit = 5;
|
|
165
|
+
pagination.page = Math.min(pagination.page, Math.ceil(pagination.total / 5));
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
document.querySelector('#set-limit-20').addEventListener('click', () => {
|
|
169
|
+
pagination.limit = 20;
|
|
170
|
+
pagination.page = Math.min(pagination.page, Math.ceil(pagination.total / 20));
|
|
171
|
+
});
|
|
172
|
+
</script>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Pagination with Data Table
|
|
176
|
+
|
|
177
|
+
A common use case is pairing pagination with a data table or list of items.
|
|
178
|
+
|
|
179
|
+
```html:preview
|
|
180
|
+
<div id="table-pagination-demo">
|
|
181
|
+
<div style="margin-bottom: 1rem; padding: 1rem; background: #f5f5f5; border-radius: 4px;">
|
|
182
|
+
<div id="item-list" style="font-family: monospace; font-size: 13px; line-height: 1.6;"></div>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<zn-pagination id="table-pagination" total="50" limit="5" page="1" uri="#page#"></zn-pagination>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<script type="module">
|
|
189
|
+
const pagination = document.querySelector('#table-pagination');
|
|
190
|
+
const itemList = document.querySelector('#item-list');
|
|
191
|
+
|
|
192
|
+
// Generate sample data
|
|
193
|
+
const totalItems = 50;
|
|
194
|
+
const items = Array.from({ length: totalItems }, (_, i) => ({
|
|
195
|
+
id: i + 1,
|
|
196
|
+
name: `Item ${i + 1}`,
|
|
197
|
+
description: `Description for item ${i + 1}`
|
|
198
|
+
}));
|
|
199
|
+
|
|
200
|
+
function renderItems() {
|
|
201
|
+
const { page, limit } = pagination;
|
|
202
|
+
const startIndex = (page - 1) * limit;
|
|
203
|
+
const endIndex = Math.min(startIndex + limit, totalItems);
|
|
204
|
+
const pageItems = items.slice(startIndex, endIndex);
|
|
205
|
+
|
|
206
|
+
itemList.innerHTML = `
|
|
207
|
+
<strong>Showing items ${startIndex + 1}-${endIndex} of ${totalItems}</strong><br><br>
|
|
208
|
+
${pageItems.map(item => `${item.id}. ${item.name} - ${item.description}`).join('<br>')}
|
|
209
|
+
`;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Initial render
|
|
213
|
+
renderItems();
|
|
214
|
+
|
|
215
|
+
// Listen for page changes
|
|
216
|
+
const observer = new MutationObserver((mutations) => {
|
|
217
|
+
mutations.forEach((mutation) => {
|
|
218
|
+
if (mutation.attributeName === 'page') {
|
|
219
|
+
renderItems();
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
observer.observe(pagination, { attributes: true });
|
|
224
|
+
|
|
225
|
+
// Handle link clicks (in a real app, you'd use proper routing)
|
|
226
|
+
document.addEventListener('click', (e) => {
|
|
227
|
+
if (e.target.closest('#table-pagination a')) {
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
const href = e.target.closest('a').getAttribute('href');
|
|
230
|
+
const pageMatch = href.match(/(\d+)/);
|
|
231
|
+
if (pageMatch) {
|
|
232
|
+
pagination.page = parseInt(pageMatch[1]);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
</script>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Single Page
|
|
240
|
+
|
|
241
|
+
When the total number of items fits within a single page, only page 1 is shown with disabled Previous and Next buttons.
|
|
242
|
+
|
|
243
|
+
```html:preview
|
|
244
|
+
<zn-pagination total="8" limit="10" page="1" uri="#page#"></zn-pagination>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Empty State
|
|
248
|
+
|
|
249
|
+
When there are no items (total is 0), the pagination shows page 0 with disabled buttons.
|
|
250
|
+
|
|
251
|
+
```html:preview
|
|
252
|
+
<zn-pagination total="0" limit="10" page="1" uri="#page#"></zn-pagination>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Properties
|
|
256
|
+
|
|
257
|
+
The pagination component exposes the following attributes and properties:
|
|
258
|
+
|
|
259
|
+
| Property | Attribute | Type | Default | Description |
|
|
260
|
+
|----------|-----------|------|---------|-------------|
|
|
261
|
+
| `limit` | `limit` | `number` | `10` | Number of items to display per page. This determines how many pages are calculated from the total. |
|
|
262
|
+
| `total` | `total` | `number` | `0` | Total number of items across all pages. Used to calculate the total number of pages. |
|
|
263
|
+
| `page` | `page` | `number` | `1` | Current active page number. The page button matching this number will be highlighted. |
|
|
264
|
+
| `uri` | `uri` | `string` | `""` | URI pattern for page links. Use `#page#` as a placeholder that will be replaced with the actual page number. |
|
|
265
|
+
|
|
266
|
+
## Behavior
|
|
267
|
+
|
|
268
|
+
### Page Button Display Logic
|
|
269
|
+
|
|
270
|
+
The pagination component uses intelligent logic to display page buttons:
|
|
271
|
+
|
|
272
|
+
- If there are 5 or fewer total pages, all page numbers are shown
|
|
273
|
+
- If there are more than 5 pages, a window of up to 5 page buttons is displayed
|
|
274
|
+
- When on page 1, buttons 1-5 are shown (or up to the last page if fewer than 5)
|
|
275
|
+
- When on the last page, the last 5 pages are shown (or from page 1 if fewer than 5 pages after adjustment)
|
|
276
|
+
- When on middle pages, the current page is centered with 2 pages on each side when possible
|
|
277
|
+
- The active page button is highlighted and not clickable
|
|
278
|
+
- Previous button is disabled on page 1
|
|
279
|
+
- Next button is disabled on the last page
|
|
280
|
+
|
|
281
|
+
### Link Generation
|
|
282
|
+
|
|
283
|
+
The component generates links using the `uri` pattern:
|
|
284
|
+
|
|
285
|
+
- The `#page#` placeholder is replaced with the actual page number
|
|
286
|
+
- If `uri` is empty, no links are generated
|
|
287
|
+
- The active page button does not generate a link
|
|
288
|
+
- Previous and Next buttons generate links for page-1 and page+1 respectively
|
|
289
|
+
|
|
290
|
+
### Accessibility
|
|
291
|
+
|
|
292
|
+
- Active page is indicated with visual styling (primary color, bold weight)
|
|
293
|
+
- Disabled buttons show reduced opacity and have cursor: not-allowed
|
|
294
|
+
- All buttons are keyboard accessible via standard tab navigation
|
|
295
|
+
- Links use semantic HTML `<a>` elements for proper navigation
|
|
296
|
+
|
|
297
|
+
## Styling
|
|
298
|
+
|
|
299
|
+
The pagination component supports customization through CSS variables and theme tokens:
|
|
300
|
+
|
|
301
|
+
- Background color uses `--zn-panel` and `--zn-panel-opacity`
|
|
302
|
+
- Text color uses `--zn-text`
|
|
303
|
+
- Shadow effect uses `--zn-shadow`
|
|
304
|
+
- Active state uses `--zn-primary`
|
|
305
|
+
- Border radius uses `--zn-spacing-small`
|
|
306
|
+
- Padding and spacing use standard Zinc spacing tokens
|
|
307
|
+
|
|
308
|
+
### CSS Parts
|
|
309
|
+
|
|
310
|
+
While the component does not currently expose CSS parts, you can style it using standard CSS selectors on the host element.
|
|
311
|
+
|
|
312
|
+
## Best Practices
|
|
313
|
+
|
|
314
|
+
### When to Use Pagination
|
|
315
|
+
|
|
316
|
+
- Use pagination for large datasets that would be overwhelming to display all at once
|
|
317
|
+
- Ideal for tables, search results, product listings, and content feeds
|
|
318
|
+
- Consider pagination when you have more than 25-50 items to display
|
|
319
|
+
|
|
320
|
+
### Choosing Page Size
|
|
321
|
+
|
|
322
|
+
- Common page sizes are 10, 20, 25, 50, or 100 items
|
|
323
|
+
- Smaller page sizes (10-25) work well for detailed content like product cards
|
|
324
|
+
- Larger page sizes (50-100) work well for compact lists or tables
|
|
325
|
+
- Consider your users' needs and the type of content being displayed
|
|
326
|
+
|
|
327
|
+
### URI Patterns
|
|
328
|
+
|
|
329
|
+
- Use clear, RESTful URL patterns like `/items?page=#page#`
|
|
330
|
+
- Ensure page URLs are shareable and bookmarkable
|
|
331
|
+
- Consider including other query parameters in your URI pattern
|
|
332
|
+
- For SPAs, you might use hash-based routing like `#/page/#page#`
|
|
333
|
+
|
|
334
|
+
### Accessibility Considerations
|
|
15
335
|
|
|
16
|
-
|
|
336
|
+
- Always provide a way to navigate to the first and last pages
|
|
337
|
+
- Ensure keyboard navigation works properly
|
|
338
|
+
- Consider adding ARIA labels for screen readers
|
|
339
|
+
- Test with keyboard-only navigation
|
|
17
340
|
|
|
18
|
-
###
|
|
341
|
+
### Performance Tips
|
|
19
342
|
|
|
20
|
-
|
|
343
|
+
- Load only the data for the current page from your backend
|
|
344
|
+
- Use URL parameters to maintain page state across refreshes
|
|
345
|
+
- Consider implementing infinite scroll as an alternative for certain use cases
|
|
346
|
+
- Cache page data when appropriate to improve navigation speed
|
|
21
347
|
|
|
22
348
|
|
|
@@ -1,22 +1,238 @@
|
|
|
1
1
|
---
|
|
2
2
|
meta:
|
|
3
3
|
title: Pane
|
|
4
|
-
description:
|
|
4
|
+
description: A flexible container component for organizing content with optional headers and automatic overflow handling.
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
Panes are versatile container components designed to manage content layout with automatic scrolling, flexible display, and seamless integration with headers. They serve as the primary building blocks for organizing page content in a structured, scrollable format.
|
|
9
|
+
|
|
8
10
|
```html:preview
|
|
9
|
-
<zn-
|
|
11
|
+
<div style="height: 400px; border: 1px solid var(--zn-color-neutral-300);">
|
|
12
|
+
<zn-pane>
|
|
13
|
+
<zn-header caption="Example Pane" description="A basic pane with header"></zn-header>
|
|
14
|
+
<p>This is the main content area of the pane. It will automatically scroll when the content exceeds the available space.</p>
|
|
15
|
+
<p>The pane component provides a flexible container with built-in overflow handling and padding.</p>
|
|
16
|
+
<p>You can add any content here, and it will be properly contained within the pane.</p>
|
|
17
|
+
</zn-pane>
|
|
18
|
+
</div>
|
|
10
19
|
```
|
|
11
20
|
|
|
12
21
|
## Examples
|
|
13
22
|
|
|
14
|
-
###
|
|
23
|
+
### Basic Pane
|
|
24
|
+
|
|
25
|
+
A simple pane with default padding displays content in a flexible, scrollable container. The pane automatically manages overflow and applies standard spacing around the content.
|
|
26
|
+
|
|
27
|
+
```html:preview
|
|
28
|
+
<div style="height: 300px; border: 1px solid var(--zn-color-neutral-300);">
|
|
29
|
+
<zn-pane>
|
|
30
|
+
<p>This is a basic pane with default padding.</p>
|
|
31
|
+
<p>Content is automatically wrapped with the standard spacing.</p>
|
|
32
|
+
<p>The pane will scroll if content exceeds the available height.</p>
|
|
33
|
+
</zn-pane>
|
|
34
|
+
</div>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Pane with Header
|
|
38
|
+
|
|
39
|
+
When a `zn-header` is included as a child element, the pane automatically integrates it as a sticky header at the top. The header remains visible while scrolling through the content.
|
|
40
|
+
|
|
41
|
+
```html:preview
|
|
42
|
+
<div style="height: 400px; border: 1px solid var(--zn-color-neutral-300);">
|
|
43
|
+
<zn-pane>
|
|
44
|
+
<zn-header caption="Customer Details"
|
|
45
|
+
description="View and manage customer information"
|
|
46
|
+
icon="person">
|
|
47
|
+
<zn-button slot="actions" primary>Save</zn-button>
|
|
48
|
+
<zn-button slot="actions">Cancel</zn-button>
|
|
49
|
+
</zn-header>
|
|
50
|
+
|
|
51
|
+
<h3>Customer Information</h3>
|
|
52
|
+
<p>Name: John Smith</p>
|
|
53
|
+
<p>Email: john.smith@example.com</p>
|
|
54
|
+
<p>Phone: (555) 123-4567</p>
|
|
55
|
+
|
|
56
|
+
<h3>Address</h3>
|
|
57
|
+
<p>123 Main Street</p>
|
|
58
|
+
<p>Anytown, ST 12345</p>
|
|
59
|
+
|
|
60
|
+
<h3>Order History</h3>
|
|
61
|
+
<p>Total Orders: 15</p>
|
|
62
|
+
<p>Last Order: 2025-01-15</p>
|
|
63
|
+
</zn-pane>
|
|
64
|
+
</div>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Flush Pane
|
|
68
|
+
|
|
69
|
+
Use the `flush` attribute to remove all padding from the content area. This is useful when working with components that need to extend to the edges of the pane, such as tables, tabs, or other full-width layouts.
|
|
70
|
+
|
|
71
|
+
```html:preview
|
|
72
|
+
<div style="height: 400px; border: 1px solid var(--zn-color-neutral-300);">
|
|
73
|
+
<zn-pane flush>
|
|
74
|
+
<zn-header caption="Flush Content"></zn-header>
|
|
75
|
+
<zn-tabs flush>
|
|
76
|
+
<zn-navbar slot="top">
|
|
77
|
+
<li tab>Overview</li>
|
|
78
|
+
<li tab="details">Details</li>
|
|
79
|
+
<li tab="settings">Settings</li>
|
|
80
|
+
</zn-navbar>
|
|
81
|
+
|
|
82
|
+
<zn-sp id="" divide no-gap>
|
|
83
|
+
<div style="padding: var(--zn-spacing-medium);">
|
|
84
|
+
<h3>Overview Tab</h3>
|
|
85
|
+
<p>This content extends to the edges of the pane.</p>
|
|
86
|
+
</div>
|
|
87
|
+
<div style="padding: var(--zn-spacing-medium);">
|
|
88
|
+
<p>No extra padding around the tabs component.</p>
|
|
89
|
+
</div>
|
|
90
|
+
</zn-sp>
|
|
15
91
|
|
|
16
|
-
|
|
92
|
+
<zn-sp id="details" divide no-gap>
|
|
93
|
+
<div style="padding: var(--zn-spacing-medium);">
|
|
94
|
+
<h3>Details Tab</h3>
|
|
95
|
+
<p>Details content goes here.</p>
|
|
96
|
+
</div>
|
|
97
|
+
</zn-sp>
|
|
98
|
+
|
|
99
|
+
<zn-sp id="settings" divide no-gap>
|
|
100
|
+
<div style="padding: var(--zn-spacing-medium);">
|
|
101
|
+
<h3>Settings Tab</h3>
|
|
102
|
+
<p>Settings content goes here.</p>
|
|
103
|
+
</div>
|
|
104
|
+
</zn-sp>
|
|
105
|
+
</zn-tabs>
|
|
106
|
+
</zn-pane>
|
|
107
|
+
</div>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Scrollable Content
|
|
111
|
+
|
|
112
|
+
Panes automatically handle overflow with scrollbars when content exceeds the available height. The header remains sticky while content scrolls beneath it.
|
|
113
|
+
|
|
114
|
+
```html:preview
|
|
115
|
+
<div style="height: 300px; border: 1px solid var(--zn-color-neutral-300);">
|
|
116
|
+
<zn-pane>
|
|
117
|
+
<zn-header caption="Long Content" description="Scroll to see more"></zn-header>
|
|
118
|
+
<h3>Section 1</h3>
|
|
119
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
|
17
120
|
|
|
18
|
-
|
|
121
|
+
<h3>Section 2</h3>
|
|
122
|
+
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
|
|
19
123
|
|
|
20
|
-
|
|
124
|
+
<h3>Section 3</h3>
|
|
125
|
+
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
|
|
126
|
+
|
|
127
|
+
<h3>Section 4</h3>
|
|
128
|
+
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
129
|
+
|
|
130
|
+
<h3>Section 5</h3>
|
|
131
|
+
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.</p>
|
|
132
|
+
|
|
133
|
+
<h3>Section 6</h3>
|
|
134
|
+
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum.</p>
|
|
135
|
+
</zn-pane>
|
|
136
|
+
</div>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Nested Panes
|
|
140
|
+
|
|
141
|
+
Panes can be nested within layouts or other container components to create complex, multi-section interfaces with independent scrolling regions.
|
|
142
|
+
|
|
143
|
+
```html:preview
|
|
144
|
+
<div style="height: 400px; display: flex; gap: 10px;">
|
|
145
|
+
<div style="flex: 1; border: 1px solid var(--zn-color-neutral-300);">
|
|
146
|
+
<zn-pane>
|
|
147
|
+
<zn-header caption="Left Pane" icon="list"></zn-header>
|
|
148
|
+
<h4>Navigation</h4>
|
|
149
|
+
<ul>
|
|
150
|
+
<li>Dashboard</li>
|
|
151
|
+
<li>Customers</li>
|
|
152
|
+
<li>Orders</li>
|
|
153
|
+
<li>Products</li>
|
|
154
|
+
<li>Reports</li>
|
|
155
|
+
<li>Settings</li>
|
|
156
|
+
</ul>
|
|
157
|
+
</zn-pane>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div style="flex: 2; border: 1px solid var(--zn-color-neutral-300);">
|
|
161
|
+
<zn-pane>
|
|
162
|
+
<zn-header caption="Main Content" icon="article">
|
|
163
|
+
<zn-button slot="actions" primary>Action</zn-button>
|
|
164
|
+
</zn-header>
|
|
165
|
+
<h3>Content Area</h3>
|
|
166
|
+
<p>This is the main content area with independent scrolling.</p>
|
|
167
|
+
<p>Each pane manages its own overflow and scrolling behavior.</p>
|
|
168
|
+
<p>You can have multiple panes side by side or stacked vertically.</p>
|
|
169
|
+
</zn-pane>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Flush Pane with Data Table
|
|
175
|
+
|
|
176
|
+
A common pattern is using a flush pane with data tables or other components that manage their own spacing and borders.
|
|
177
|
+
|
|
178
|
+
```html:preview
|
|
179
|
+
<div style="height: 400px; border: 1px solid var(--zn-color-neutral-300);">
|
|
180
|
+
<zn-pane flush>
|
|
181
|
+
<zn-header caption="Customer List" description="All active customers">
|
|
182
|
+
<zn-button slot="actions" primary icon="add">Add Customer</zn-button>
|
|
183
|
+
</zn-header>
|
|
184
|
+
<zn-sp divide no-gap flush>
|
|
185
|
+
<div style="padding: var(--zn-spacing-medium);">
|
|
186
|
+
<strong>Customer 1</strong> - john@example.com
|
|
187
|
+
</div>
|
|
188
|
+
<div style="padding: var(--zn-spacing-medium);">
|
|
189
|
+
<strong>Customer 2</strong> - jane@example.com
|
|
190
|
+
</div>
|
|
191
|
+
<div style="padding: var(--zn-spacing-medium);">
|
|
192
|
+
<strong>Customer 3</strong> - bob@example.com
|
|
193
|
+
</div>
|
|
194
|
+
<div style="padding: var(--zn-spacing-medium);">
|
|
195
|
+
<strong>Customer 4</strong> - alice@example.com
|
|
196
|
+
</div>
|
|
197
|
+
<div style="padding: var(--zn-spacing-medium);">
|
|
198
|
+
<strong>Customer 5</strong> - charlie@example.com
|
|
199
|
+
</div>
|
|
200
|
+
</zn-sp>
|
|
201
|
+
</zn-pane>
|
|
202
|
+
</div>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Full Height Layout
|
|
206
|
+
|
|
207
|
+
Panes are designed to work within full-height layouts, automatically expanding to fill the available space and managing overflow appropriately.
|
|
208
|
+
|
|
209
|
+
```html:preview
|
|
210
|
+
<div style="height: 500px; border: 1px solid var(--zn-color-neutral-300);">
|
|
211
|
+
<zn-pane>
|
|
212
|
+
<zn-header caption="Dashboard"
|
|
213
|
+
description="System overview and metrics"
|
|
214
|
+
icon="dashboard">
|
|
215
|
+
<zn-button slot="actions" icon="refresh">Refresh</zn-button>
|
|
216
|
+
</zn-header>
|
|
217
|
+
|
|
218
|
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--zn-spacing-medium);">
|
|
219
|
+
<zn-stat caption="Total Users" value="1,234"></zn-stat>
|
|
220
|
+
<zn-stat caption="Active Sessions" value="567"></zn-stat>
|
|
221
|
+
<zn-stat caption="Revenue" value="$12,345"></zn-stat>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<h3>Recent Activity</h3>
|
|
225
|
+
<p>New user registration: john.doe@example.com</p>
|
|
226
|
+
<p>Order placed: #12345</p>
|
|
227
|
+
<p>Payment received: $99.99</p>
|
|
228
|
+
<p>Support ticket opened: #456</p>
|
|
229
|
+
|
|
230
|
+
<h3>System Status</h3>
|
|
231
|
+
<p>All systems operational</p>
|
|
232
|
+
<p>Last backup: 2025-01-23 02:00 AM</p>
|
|
233
|
+
<p>Uptime: 99.9%</p>
|
|
234
|
+
</zn-pane>
|
|
235
|
+
</div>
|
|
236
|
+
```
|
|
21
237
|
|
|
22
238
|
|