@reliability-design/web 1.4.8 → 1.4.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/CHANGELOG.md +214 -0
- package/custom-elements.json +18600 -0
- package/dist/components/rel-accordion/README.md +9 -2
- package/dist/components/rel-alert/README.md +5 -8
- package/dist/components/rel-autocomplete/README.md +209 -208
- package/dist/components/rel-avatar/README.md +228 -118
- package/dist/components/rel-breadcrumb/README.md +1 -0
- package/dist/components/rel-button/README.md +9 -9
- package/dist/components/rel-calendar/README.md +111 -109
- package/dist/components/rel-cardmedia/README.md +1 -1
- package/dist/components/rel-carousel/README.md +187 -186
- package/dist/components/rel-checkbox/README.md +159 -146
- package/dist/components/rel-chip/README.md +141 -138
- package/dist/components/rel-container/README.md +1 -1
- package/dist/components/rel-date-picker/README.md +221 -200
- package/dist/components/rel-drawer/README.md +4 -4
- package/dist/components/rel-kbd/README.md +188 -141
- package/dist/components/rel-layout/README.md +34 -34
- package/dist/components/rel-menu/README.md +17 -10
- package/dist/components/rel-menubar/README.md +218 -218
- package/dist/components/rel-otp/README.md +4 -8
- package/dist/components/rel-pagination/README.md +141 -100
- package/dist/components/rel-popover/README.md +220 -203
- package/dist/components/rel-radio/README.md +142 -131
- package/dist/components/rel-range-picker/README.md +194 -165
- package/dist/components/rel-resizable/README.md +220 -199
- package/dist/components/rel-segmented-button/README.md +158 -156
- package/dist/components/rel-select/README.md +22 -16
- package/dist/components/rel-sheet/README.md +3 -2
- package/dist/components/rel-signature-pad/README.md +161 -0
- package/dist/components/rel-slider/README.md +140 -131
- package/dist/components/rel-snackbar/README.md +170 -168
- package/dist/components/rel-split-button/README.md +129 -0
- package/dist/components/rel-stepper/README.md +171 -162
- package/dist/components/rel-switch/README.md +122 -117
- package/dist/components/rel-tab/README.md +184 -173
- package/dist/components/rel-textfield/README.md +23 -30
- package/dist/components/rel-time-picker/README.md +188 -164
- package/dist/components/rel-toast/README.md +20 -11
- package/dist/components/rel-tooltip/README.md +5 -4
- package/dist/components/rel-tree/README.md +157 -0
- package/dist/components/rel-upload/README.md +8 -5
- package/dist/index.d.mts +1698 -607
- package/dist/index.d.ts +1698 -607
- package/dist/index.js +12276 -6347
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12218 -6296
- package/dist/index.mjs.map +1 -1
- package/dist/styles/motion.css +31 -0
- package/dist/styles/motion.tokens.json +38 -0
- package/dist/styles/vars.css +88 -64
- package/dist/{vars-DXX6QOAG.css → vars-E22LYFMV.css} +88 -64
- package/package.json +60 -37
- package/dist/styles/focus-ring.ts +0 -84
|
@@ -1,100 +1,141 @@
|
|
|
1
|
-
# rel-pagination
|
|
2
|
-
|
|
3
|
-
Page navigation implementing the Figma "Pagination" component in its three **Type** layouts: `extended` (prev/next ghost buttons around numbered page chips, with a windowed ellipsis for long ranges), `compact` (prev/next around a "Page X of Y" readout) and `count-text` (a "1–10 of 50" item range with the nav on the right). Use it under tables, lists and search results that load one page at a time. It never fetches data or reads the URL: listen for `rel-change` and load the requested page yourself.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- Extended (default): numbered pages, uncontrolled -->
|
|
9
|
-
<rel-pagination
|
|
10
|
-
|
|
11
|
-
<!-- Extended with the "Viewing page X of Y" caption -->
|
|
12
|
-
<rel-pagination
|
|
13
|
-
|
|
14
|
-
<!-- Compact: prev / "Page X of Y" / next -->
|
|
15
|
-
<rel-pagination type="compact"
|
|
16
|
-
|
|
17
|
-
<!-- Count-text: item range computed from
|
|
18
|
-
<rel-pagination type="count-text"
|
|
19
|
-
|
|
20
|
-
<!-- Controlled: the parent owns the page -->
|
|
21
|
-
<rel-pagination id="results" page="1"
|
|
22
|
-
<script>
|
|
23
|
-
const pager = document.getElementById('results');
|
|
24
|
-
pager.addEventListener('rel-change', (e) => {
|
|
25
|
-
loadResults(e.detail.page).then(() => {
|
|
26
|
-
pager.page = e.detail.page; // commit once the data is in
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<!-- Disabled while loading -->
|
|
32
|
-
<rel-pagination
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<!--
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
|
71
|
-
| --- | --- |
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
1
|
+
# rel-pagination
|
|
2
|
+
|
|
3
|
+
Page navigation implementing the Figma "Pagination" component in its three **Type** layouts: `extended` (prev/next ghost buttons around numbered page chips, with a windowed ellipsis for long ranges), `compact` (prev/next around a "Page X of Y" readout) and `count-text` (a "1–10 of 50" item range with the nav on the right). Use it under tables, lists and search results that load one page at a time. It never fetches data or reads the URL: listen for `rel-change` and load the requested page yourself.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Extended (default): numbered pages, uncontrolled -->
|
|
9
|
+
<rel-pagination total-pages="12" default-page="3"></rel-pagination>
|
|
10
|
+
|
|
11
|
+
<!-- Extended with the "Viewing page X of Y" caption -->
|
|
12
|
+
<rel-pagination total-pages="20" show-label></rel-pagination>
|
|
13
|
+
|
|
14
|
+
<!-- Compact: prev / "Page X of Y" / next -->
|
|
15
|
+
<rel-pagination type="compact" total-pages="8"></rel-pagination>
|
|
16
|
+
|
|
17
|
+
<!-- Count-text: item range computed from total-items and per-page -->
|
|
18
|
+
<rel-pagination type="count-text" total-items="137" per-page="25"></rel-pagination>
|
|
19
|
+
|
|
20
|
+
<!-- Controlled: the parent owns the page -->
|
|
21
|
+
<rel-pagination id="results" page="1" total-pages="40" ariaLabel="Search results pagination"></rel-pagination>
|
|
22
|
+
<script>
|
|
23
|
+
const pager = document.getElementById('results');
|
|
24
|
+
pager.addEventListener('rel-change', (e) => {
|
|
25
|
+
loadResults(e.detail.page).then(() => {
|
|
26
|
+
pager.page = e.detail.page; // commit once the data is in
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<!-- Disabled while loading -->
|
|
32
|
+
<rel-pagination total-pages="12" disabled></rel-pagination>
|
|
33
|
+
|
|
34
|
+
<!-- New in 1.5.0. Page select: prev / "Page [dropdown] of Y" / next; the dropdown jumps to any page -->
|
|
35
|
+
<rel-pagination type="page-select" total-pages="40"></rel-pagination>
|
|
36
|
+
|
|
37
|
+
<!-- New in 1.5.0. A rows-per-page selector after the navigation (Figma "Extended with Rows").
|
|
38
|
+
Works with every type; choosing a value updates per-page and returns to page 1. -->
|
|
39
|
+
<rel-pagination total-items="137" per-page="20" show-rows-per-page></rel-pagination>
|
|
40
|
+
<rel-pagination type="count-text" total-items="137" per-page="25"
|
|
41
|
+
show-rows-per-page rows-per-page-options="[25, 50, 100]"></rel-pagination>
|
|
42
|
+
<script>
|
|
43
|
+
document.querySelector('rel-pagination[show-rows-per-page]')
|
|
44
|
+
.addEventListener('rel-per-page-change', (e) => reload({ perPage: e.detail.perPage, page: 1 }));
|
|
45
|
+
</script>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Without `show-rows-per-page` there is no rows-per-page selector, and every type except `page-select` has no jump-to-page control: those are the defaults, so existing markup renders exactly as before.
|
|
49
|
+
|
|
50
|
+
### Deprecated aliases
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<!-- Lowercase-joined attribute spellings → kebab-case (since 1.5.0; still work, log a one-time
|
|
54
|
+
console notice, removed in 3.0). camelCase markup (totalPages="12") lands on these too. -->
|
|
55
|
+
<rel-pagination totalpages="12" defaultpage="3" showlabel></rel-pagination>
|
|
56
|
+
<rel-pagination type="count-text" totalitems="137" perpage="25" hreftemplate="?page={page}"></rel-pagination>
|
|
57
|
+
<!-- canonical -->
|
|
58
|
+
<rel-pagination total-pages="12" default-page="3" show-label></rel-pagination>
|
|
59
|
+
<rel-pagination type="count-text" total-items="137" per-page="25" href-template="?page={page}"></rel-pagination>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
<!-- readme-gen:start -->
|
|
63
|
+
|
|
64
|
+
<!-- Generated from rel-pagination.ts — do not edit; run readme-generate.mjs -->
|
|
65
|
+
|
|
66
|
+
## API
|
|
67
|
+
|
|
68
|
+
### Attributes / Properties
|
|
69
|
+
|
|
70
|
+
| Property | Attribute | Type | Default | Description |
|
|
71
|
+
| --- | --- | --- | --- | --- |
|
|
72
|
+
| `type` | `type` | `"extended" \| "compact" \| "count-text" \| "page-select"` | `"extended"` | Figma "Type": `extended` = prev/next + numbered page buttons (auto-collapses to compact under 480px container width), `compact` = prev/next + "Page X of Y", `count-text` = "start–end of total" item range + prev/next around the current page number, `page-select` = prev/next around "Page [select] of Y", a dropdown that jumps to any page (new in 1.5.0). Every type except `page-select` has no jump-to-page control. Reflected. |
|
|
73
|
+
| `page` | `page` | `number` | `undefined` | Controlled current page (1-based). When set, the element only emits `rel-change` and waits for the parent to update `page`; leave unset for uncontrolled behaviour. |
|
|
74
|
+
| `defaultPage` | `default-page` | `number` | `1` | Starting page for uncontrolled use (ignored when `page` is set). The `defaultpage` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
75
|
+
| `totalPages` | `total-pages` | `number` | `0` | Total number of pages. `0` (the default) lets `totalItems` / `perPage` compute the page count instead. The `totalpages` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
76
|
+
| `totalItems` | `total-items` | `number` | `0` | Total item count; with `perPage` it computes the page count when `totalPages` is `0` and is the "of N" figure in the count-text readout. The `totalitems` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
77
|
+
| `perPage` | `per-page` | `number` | `10` | Items per page, used to compute the page count from `totalItems` and the "start–end" range in the count-text readout. The `perpage` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
78
|
+
| `showLabel` | `show-label` | `boolean` | `false` | Shows a "Viewing page X of Y" caption under the extended layout (ignored by the other types). Off by default. The `showlabel` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
79
|
+
| `disabled` | `disabled` | `boolean` | `false` | Dims the whole control to 40% opacity, shows a `not-allowed` cursor and ignores every page change. Reflected. |
|
|
80
|
+
| `hrefTemplate` | `href-template` | `string` | `""` | Reserved for link-mode pagination. Currently accepted but not rendered: every page control is a `<button>`, so navigate in your `rel-change` handler instead. The `hreftemplate` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
81
|
+
| `ariaLabel` | `arialabel` | `string` | `"Pagination"` | Accessible name of the `role="navigation"` landmark (attribute `ariaLabel`). Set it when a page contains more than one pagination control. |
|
|
82
|
+
| `showRowsPerPage` | `show-rows-per-page` | `boolean` | `false` | New in 1.5.0. Adds a rows-per-page selector after the navigation, with any `type` (Figma "Extended with Rows" is `type="extended"` with this set). Choosing a value sets `perPage`, fires `rel-per-page-change` and returns to page 1. Off by default: no rows-per-page selector. |
|
|
83
|
+
| `rowsPerPageOptions` | `rows-per-page-options` | `number[]` | `[10, 20, 50, 100]` | New in 1.5.0. The values the rows-per-page selector offers (a number array, or a JSON array in the attribute). The current `perPage` is added to the list when it is not in it. |
|
|
84
|
+
| `rowsPerPageLabel` | `rows-per-page-label` | `string` | `"Results per Page"` | New in 1.5.0. Text before the rows-per-page selector, also its accessible name. |
|
|
85
|
+
|
|
86
|
+
## Events
|
|
87
|
+
|
|
88
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
89
|
+
| --- | --- | --- | --- |
|
|
90
|
+
| `rel-change` | `{ page: newPage }` | bubbles / composed | Fired when the user picks another page (prev/next or a page number). Detail: `{ page: number }` (1-based). In controlled mode the parent must then set `page`. |
|
|
91
|
+
| `rel-per-page-change` | `{ perPage }` | bubbles / composed | New in 1.5.0. Fired when the user picks a value in the rows-per-page selector (`show-rows-per-page`). Detail: `{ perPage: number }`. `perPage` is already updated; the element then returns to page 1 (in controlled mode it fires `rel-change` with `{ page: 1 }` for the parent to commit). |
|
|
92
|
+
|
|
93
|
+
## Slots
|
|
94
|
+
|
|
95
|
+
| Slot | Description |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| — | This element has no slots. |
|
|
98
|
+
|
|
99
|
+
## CSS Parts
|
|
100
|
+
|
|
101
|
+
| Part | Description |
|
|
102
|
+
| --- | --- |
|
|
103
|
+
| `base` | The `role="navigation"` root of the extended layout (page buttons plus the optional "Viewing page" label). |
|
|
104
|
+
| `label` | The `role="navigation"` root row of the count-text layout (item-range text plus prev/next nav). |
|
|
105
|
+
| `page-select` | The `rel-select` of the `page-select` layout (the jump-to-page dropdown). New in 1.5.0. |
|
|
106
|
+
| `rows-per-page` | The rows-per-page block (its text plus the `rel-select`), rendered with `show-rows-per-page`. New in 1.5.0. |
|
|
107
|
+
|
|
108
|
+
<!-- readme-gen:end -->
|
|
109
|
+
|
|
110
|
+
## Accessibility
|
|
111
|
+
|
|
112
|
+
- The control is a `role="navigation"` landmark named by `ariaLabel` (default "Pagination"); give each pager on a page a distinct name.
|
|
113
|
+
- Prev/next are native buttons labelled "Previous page" / "Next page"; they are disabled (not hidden) on the first / last page.
|
|
114
|
+
- Each page chip is a native button labelled "Page N" with `aria-current="page"` on the current one. Abbreviated first/last chips (e.g. "368k") keep the exact number in their `title`.
|
|
115
|
+
- Every page change is announced to screen readers as "Page N of M" via the shared live region.
|
|
116
|
+
- If a prev/next button becomes disabled while it has focus (you reached the first/last page), focus moves to the other nav button instead of being lost.
|
|
117
|
+
- `type="page-select"` (new in 1.5.0): the dropdown is a `rel-select` combobox named "Page (of N)", so it is read as, for example, "Page (of 40), 3". The visible "Page" and "of N" texts are hidden from assistive technology because the name already carries them. It sits inside the navigation landmark, and picking a page is announced like any other page change.
|
|
118
|
+
- `show-rows-per-page` (new in 1.5.0): the rows-per-page dropdown is a `rel-select` combobox named by `rows-per-page-label` (default "Results per Page"), placed after the navigation landmark rather than inside it. Its visible text is hidden from assistive technology for the same reason.
|
|
119
|
+
- `disabled` also disables both dropdowns.
|
|
120
|
+
|
|
121
|
+
| Key | Action |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `Tab` / `Shift+Tab` | Move between the prev button, page chips (or the page dropdown) and next button, then the rows-per-page dropdown |
|
|
124
|
+
| `Enter` / `Space` | Activate the focused button (native behaviour); on a dropdown, open it |
|
|
125
|
+
| `ArrowDown` / `ArrowUp`, `Enter`, `Escape` (dropdown open) | Move the highlight, pick the highlighted value, close without picking (rel-select's keyboard model) |
|
|
126
|
+
| Typing (page dropdown open) | Filters the page list; the first match is highlighted |
|
|
127
|
+
|
|
128
|
+
The page chips and nav buttons have no arrow-key navigation; they are regular tab stops.
|
|
129
|
+
|
|
130
|
+
## Notes / Edge Cases
|
|
131
|
+
|
|
132
|
+
- **Attribute names.** Multi-word attributes are kebab-case: `total-pages`, `default-page`, `total-items`, `per-page`, `show-label`, `href-template`. They are observed like any other attribute, so later changes apply. The older lowercase spellings (which camelCase markup also produces, since HTML attribute names are case-insensitive) still work since 1.5.0 but log a one-time console notice and are removed in 3.0; see Deprecated aliases. `ariaLabel` keeps its `arialabel` attribute.
|
|
133
|
+
- **Page count.** `totalPages` wins when greater than `0`; otherwise the count is `ceil(totalItems / perPage)`. With neither set the element renders no page chips and both nav buttons disabled.
|
|
134
|
+
- **Controlled vs uncontrolled.** With `page` unset the element tracks the current page itself starting at `defaultPage`. Once `page` is set it stays on that page until the parent changes it — clicking only emits `rel-change`.
|
|
135
|
+
- **Ellipsis window.** Up to 7 pages render in full. Beyond that: the first 5 + last near the start, first + last 5 near the end, otherwise first, current ±1 and last, with `…` between. Far first/last chips abbreviate large numbers (`10000` → `10k`, `2500000` → `2.5M`); chips inside the window are never abbreviated.
|
|
136
|
+
- **Responsive.** `extended` uses a container query on the host: between 480px and 768px only first, last and current ±1 stay visible; under 480px the whole control swaps to the compact layout (media-query fallback for browsers without container queries). The `label` part belongs to the `count-text` layout, not to the "Viewing page" caption.
|
|
137
|
+
- **`hrefTemplate`** is accepted but currently unused — chips are always buttons, not links. Perform navigation in the `rel-change` handler.
|
|
138
|
+
- **`rel-change` is not fired** for the current page, out-of-range pages, or while `disabled`.
|
|
139
|
+
- **Page select.** The dropdown lists every page. Above 1,000 pages it lists a window of 1,000 around the current page plus the first and last, so the list stays fast. In controlled mode the dropdown snaps back to `page` until the parent commits the new one.
|
|
140
|
+
- **Rows per page.** `rows-per-page-options` defaults to `[10, 20, 50, 100]`; the current `per-page` is added when it is not in the list. A pick sets `perPage`, fires `rel-per-page-change` (`{ perPage }`), then returns to page 1: uncontrolled, the element moves and fires `rel-change` with `{ page: 1 }`; controlled, it only fires `rel-change` with `{ page: 1 }`. When it is already on page 1, no `rel-change` fires. The inner dropdowns' own `changed` / `rel-change` events stop at the dropdown, so a listener on the pagination only ever sees `{ page }`.
|
|
141
|
+
- **Narrow containers.** With `show-rows-per-page` the navigation and the rows-per-page block share one row, 16px apart, and wrap onto two rows when they do not fit.
|