@ptlm-azulejo/pagination 0.0.1-alpha.125
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 +4 -0
- package/README.md +128 -0
- package/dist/index.js +3226 -0
- package/dist/index.umd.cjs +1 -0
- package/dist/packages/Pagination/index.d.ts +3 -0
- package/dist/packages/Pagination/index.d.ts.map +1 -0
- package/dist/packages/Pagination/src/index.vue.d.ts +120 -0
- package/dist/packages/Pagination/src/index.vue.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +46 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Pagination
|
|
2
|
+
|
|
3
|
+
Pagination is a navigation component that allows users to browse through large sets of content by dividing it into discrete pages. Also known as pager, page navigator, or page selector.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the pagination, the theme package, and **the font package matching your
|
|
8
|
+
project's brand**:
|
|
9
|
+
|
|
10
|
+
**Leroy Merlin projects**
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @ptlm-azulejo/pagination @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
|
|
14
|
+
# or
|
|
15
|
+
yarn add @ptlm-azulejo/pagination @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Adeo projects**
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @ptlm-azulejo/pagination @ptlm-azulejo/themes @ptlm-azulejo/fonts-adeo
|
|
22
|
+
# or
|
|
23
|
+
yarn add @ptlm-azulejo/pagination @ptlm-azulejo/themes @ptlm-azulejo/fonts-adeo
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Styles & theming
|
|
27
|
+
|
|
28
|
+
The component ships no colors or typeface of its own — it reads design tokens from
|
|
29
|
+
CSS variables at runtime. Those tokens come from `@ptlm-azulejo/themes`, and **the
|
|
30
|
+
brand is selected by a class on your app's `<html>` element**, so switching brand
|
|
31
|
+
never touches component code.
|
|
32
|
+
|
|
33
|
+
| Project | Preset stylesheet | Root class | Typeface | Font package |
|
|
34
|
+
| ------------ | ----------------------------------------------- | ------------- | --------------- | ---------------------------------- |
|
|
35
|
+
| Leroy Merlin | `@ptlm-azulejo/themes/presets/leroy-merlin.css` | `preset-lm` | LeroyMerlinSans | `@ptlm-azulejo/fonts-leroy-merlin` |
|
|
36
|
+
| Adeo | `@ptlm-azulejo/themes/presets/adeo.css` | `preset-adeo` | Roboto | `@ptlm-azulejo/fonts-adeo` |
|
|
37
|
+
|
|
38
|
+
**Leroy Merlin projects**
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import '@ptlm-azulejo/themes/presets/leroy-merlin.css'
|
|
42
|
+
import '@ptlm-azulejo/fonts-leroy-merlin'
|
|
43
|
+
import '@ptlm-azulejo/pagination/style.css'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<html lang="pt" class="preset-lm"></html>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Adeo projects**
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
import '@ptlm-azulejo/themes/presets/adeo.css'
|
|
54
|
+
import '@ptlm-azulejo/fonts-adeo'
|
|
55
|
+
import '@ptlm-azulejo/pagination/style.css'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<html lang="pt" class="preset-adeo"></html>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> The preset class is what resolves the brand at runtime. Without it — even with
|
|
63
|
+
> the stylesheets imported — the component renders uncolored and in a fallback
|
|
64
|
+
> typeface. See the [themes package](../themes/README.md) for brand switching,
|
|
65
|
+
> dark mode, and custom brands.
|
|
66
|
+
|
|
67
|
+
### Light and dark mode
|
|
68
|
+
|
|
69
|
+
Add `data-theme` alongside the brand class to pin the color scheme. Leave it off
|
|
70
|
+
and the preset follows the OS `prefers-color-scheme`:
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<html lang="pt" class="preset-lm" data-theme="dark"></html>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Why the font package is separate
|
|
77
|
+
|
|
78
|
+
The preset only _names_ its typeface in `--font-family` and ships no font files.
|
|
79
|
+
[Loading them is your app's job](../themes/README.md#fonts), as with upstream
|
|
80
|
+
Mozaic, so you keep control of hosting, subsetting and preload. Without the
|
|
81
|
+
matching font package, `font-sans` falls back to a generic sans-serif. A
|
|
82
|
+
multi-brand app can install both and switch by swapping the `.preset-*` class:
|
|
83
|
+
only the active brand's file is ever downloaded.
|
|
84
|
+
|
|
85
|
+
## Props
|
|
86
|
+
|
|
87
|
+
| Name | Type | Default | Description |
|
|
88
|
+
| ------------- | -------------------- | --------------- | --------------------------------------------------- |
|
|
89
|
+
| `id` | `string` | — | Unique identifier for the pagination |
|
|
90
|
+
| `modelValue` | `number` | — | Selected page value (`v-model`) |
|
|
91
|
+
| `options` | `PaginationOption[]` | — | Available pages with `text`, `value`, optional `id` |
|
|
92
|
+
| `ariaLabel` | `string` | `'pagination'` | Accessible name for the navigation landmark |
|
|
93
|
+
| `selectLabel` | `string` | `'Select page'` | Accessible label for the page select |
|
|
94
|
+
| `compact` | `boolean` | `false` | Circular previous/next buttons, no select |
|
|
95
|
+
| `ui` | `PaginationUi` | `{}` | Per-part Tailwind class overrides |
|
|
96
|
+
|
|
97
|
+
## Events
|
|
98
|
+
|
|
99
|
+
| Name | Payload | Description |
|
|
100
|
+
| ------------------- | ---------- | -------------------------------------------------- |
|
|
101
|
+
| `update:modelValue` | `[number]` | Emitted when the selected page changes (`v-model`) |
|
|
102
|
+
|
|
103
|
+
## Basic usage
|
|
104
|
+
|
|
105
|
+
```vue
|
|
106
|
+
<script setup>
|
|
107
|
+
import { ref } from 'vue'
|
|
108
|
+
import { AzPagination } from '@ptlm-azulejo/pagination'
|
|
109
|
+
|
|
110
|
+
const page = ref(10)
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<template>
|
|
114
|
+
<AzPagination
|
|
115
|
+
id="results-pagination"
|
|
116
|
+
v-model="page"
|
|
117
|
+
aria-label="pagination"
|
|
118
|
+
select-label="Select page"
|
|
119
|
+
:options="[
|
|
120
|
+
{ text: 'Page 1 of 99', value: 1 },
|
|
121
|
+
{ text: 'Page 2 of 99', value: 2 },
|
|
122
|
+
{ text: 'Page 3 of 99', value: 3 },
|
|
123
|
+
{ text: 'Page 10 of 99', value: 10 },
|
|
124
|
+
{ text: 'Page 99 of 99', value: 99 },
|
|
125
|
+
]"
|
|
126
|
+
/>
|
|
127
|
+
</template>
|
|
128
|
+
```
|