@m3e/paginator 1.1.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.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 matraic
4
+ Contact: matraic@yahoo.com
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/NOTICE.md ADDED
@@ -0,0 +1,8 @@
1
+ # NOTICE
2
+
3
+ This package includes code adapted from third-party sources under the MIT license:
4
+
5
+ - Angular Material Paginator
6
+ Source: https://github.com/angular/components
7
+ License: MIT
8
+ Copyright (c) Google LLC
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @m3e/paginator
2
+
3
+ The `m3e-paginator` component is a compact, accessible paginator control for navigating paged data sets. It provides semantic first/previous/next/last navigation controls and an optional page-size selector that integrates with Material design tokens and `m3e-form-field` variants to ensure consistent typography, density, and spacing across applications.
4
+
5
+ > **This package is part of [M3E](https://github.com/matraic/m3e) monorepo**, a unified suite of Material 3 web components. [Explore the docs](https://matraic.github.io/m3e) to see them in action.
6
+
7
+ ## ๐Ÿ“ฆ Installation
8
+
9
+ ```bash
10
+ npm install @m3e/paginator
11
+ ```
12
+
13
+ ## ๐Ÿ’ป Editor Integration
14
+
15
+ This package includes a [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest) to support enhanced editor tooling and developer experience.
16
+
17
+ ### Visual Studio Code
18
+
19
+ To enable autocomplete and hover documentation for `@m3e/paginator`, install the [Custom Elements Manifest Language Server](https://marketplace.visualstudio.com/items?itemName=pwrs.cem-language-server-vscode) extension. It will automatically detect the manifest bundled with this package and surface tag names, attributes, slots, and events in supported files.
20
+
21
+ Alternately, you can explicitly reference the `html-custom-data.json` and `css-custom-data.json` in your workspace settings:
22
+
23
+ ```json
24
+ {
25
+ "html.customData": ["./node_modules/@m3e/paginator/dist/html-custom-data.json"],
26
+ "css.customData": ["./node_modules/@m3e/paginator/dist/css-custom-data.json"]
27
+ }
28
+ ```
29
+
30
+ ## ๐Ÿš€ Native Module Support
31
+
32
+ This package uses [JavaScript Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#module_specifiers). To use it directly in a browser without a bundler, use a module script similar to the following.
33
+
34
+ ```html
35
+ <script type="module" src="/node_modules/@m3e/paginator/dist/index.js"></script>
36
+ ```
37
+
38
+ You also need a module script for `@m3e/form-field`, `@m3e/select`, `@m3e/option`, `@m3e/icon-button`, and `@m3e/tooltip` due to being a dependency.
39
+
40
+ ```html
41
+ <script type="module" src="/node_modules/@m3e/form-field/dist/index.js"></script>
42
+ <script type="module" src="/node_modules/@m3e/select/dist/index.js"></script>
43
+ <script type="module" src="/node_modules/@m3e/option/dist/index.js"></script>
44
+ <script type="module" src="/node_modules/@m3e/icon-button/dist/index.js"></script>
45
+ <script type="module" src="/node_modules/@m3e/tooltip/dist/index.js"></script>
46
+ ```
47
+
48
+ In addition, you must use an [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap) to include dependencies.
49
+
50
+ ```html
51
+ <script type="importmap">
52
+ {
53
+ "imports": {
54
+ "lit": "https://cdn.jsdelivr.net/npm/lit@3.3.0/+esm",
55
+ "@m3e/core": "/node_modules/@m3e/core/dist/index.js",
56
+ "@m3e/core/a11y": "/node_modules/@m3e/core/dist/a11y.js",
57
+ "@m3e/core/anchoring": "/node_modules/@m3e/core/dist/anchoring.js",
58
+ "@m3e/core/platform": "/node_modules/@m3e/core/dist/platform.js"
59
+ }
60
+ }
61
+ </script>
62
+ ```
63
+
64
+ > For production, use index.min.js, a11y.min.js, anchoring.min.js, and platform.min.js for faster load times.
65
+
66
+ ## ๐Ÿ—‚๏ธ Elements
67
+
68
+ - `m3e-paginator` โ€” Provides navigation for paged information, typically used with a table.
69
+
70
+ ## ๐Ÿงช Example
71
+
72
+ The following example illustrates use of the `m3e-paginator`. In this example, there are 300 total records and the first/last navigation controls are shown.
73
+
74
+ ```html
75
+ <m3e-paginator show-first-last-buttons length="300"></m3e-paginator>
76
+ ```
77
+
78
+ ## ๐Ÿ“– API Reference
79
+
80
+ This section details the attributes, slots, events and CSS custom properties available for the `m3e-paginator` component.
81
+
82
+ ### โš™๏ธ Attributes
83
+
84
+ | Attribute | Type | Default | Description |
85
+ | ------------------------- | ----------------- | ------------------- | --------------------------------------------------------------------------- |
86
+ | `disabled` | `boolean` | `false` | Whether the element is disabled. |
87
+ | `first-page-label` | `string` | `"First page"` | The accessible label given to the button used to move to the first page. |
88
+ | `hide-page-size` | `boolean` | `false` | Whether to hide page size selection. |
89
+ | `items-per-page-label` | `string` | `"Items per page:"` | The label for the page size selector. |
90
+ | `last-page-label` | `string` | `"Last page"` | The accessible label given to the button used to move to the last page. |
91
+ | `length` | `number` | `0` | The length of the total number of items which are being paginated. |
92
+ | `next-page-label` | `string` | `"Next page"` | The accessible label given to the button used to move to the next page. |
93
+ | `page-index` | `number` | `0` | The zero-based page index of the displayed list of items. |
94
+ | `page-size` | `number \| "all"` | `50` | The number of items to display in a page. |
95
+ | `page-sizes` | `string` | `"5,10,25,50,100"` | A comma separated list of available page sizes. |
96
+ | `page-size-variant` | `string` | `"outlined"` | The appearance variant of the page size field. |
97
+ | `previous-page-label` | `string` | `"Previous page"` | The accessible label given to the button used to move to the previous page. |
98
+ | `show-first-last-buttons` | `boolean` | `false` | Whether to show first/last buttons. |
99
+
100
+ ### ๐Ÿ”” Events
101
+
102
+ | Event | Description |
103
+ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
104
+ | `page` | Emitted when a user selects a different page size or navigates to another page. Event detail: `{ previousPageIndex, pageIndex, pageSize, length }`. |
105
+
106
+ ### ๐Ÿงฉ Slots
107
+
108
+ | Slot | Description |
109
+ | -------------------- | ------------------------------------- |
110
+ | `first-page-icon` | Slot for a custom first-page icon. |
111
+ | `previous-page-icon` | Slot for a custom previous-page icon. |
112
+ | `next-page-icon` | Slot for a custom next-page icon. |
113
+ | `last-page-icon` | Slot for a custom last-page icon. |
114
+
115
+ ### ๐ŸŽ›๏ธ CSS Custom Properties
116
+
117
+ | Property | Description |
118
+ | ----------------------------- | ------------------------------------------- |
119
+ | `--m3e-paginator-font-size` | The font size used for paginator text. |
120
+ | `--m3e-paginator-font-weight` | The font weight used for paginator text. |
121
+ | `--m3e-paginator-line-height` | The line height used for paginator text. |
122
+ | `--m3e-paginator-tracking` | The letter-spacing used for paginator text. |
123
+
124
+ ## ๐Ÿค Contributing
125
+
126
+ See the root monorepo `CONTRIBUTING.md` for guidelines on contributing to this package.
127
+
128
+ ## ๐Ÿ“„ License
129
+
130
+ This package is licensed under the MIT License.
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "properties": [
5
+ {
6
+ "name": "--m3e-paginator-font-size",
7
+ "description": "The font size used for paginator text.",
8
+ "values": []
9
+ },
10
+ {
11
+ "name": "--m3e-paginator-font-weight",
12
+ "description": "The font weight used for paginator text.",
13
+ "values": []
14
+ },
15
+ {
16
+ "name": "--m3e-paginator-line-height",
17
+ "description": "The line height used for paginator text.",
18
+ "values": []
19
+ },
20
+ {
21
+ "name": "--m3e-paginator-tracking",
22
+ "description": "The letter-spacing used for paginator text.",
23
+ "values": []
24
+ },
25
+ {
26
+ "name": "--m3e-nav-bar-height",
27
+ "description": "Height of the navigation bar.",
28
+ "values": []
29
+ },
30
+ {
31
+ "name": "--m3e-nav-bar-container-color",
32
+ "description": "Background color of the navigation bar container.",
33
+ "values": []
34
+ },
35
+ {
36
+ "name": "--m3e-nav-bar-vertical-item-width",
37
+ "description": "Minimum width of vertical nav items.",
38
+ "values": []
39
+ }
40
+ ],
41
+ "pseudoElements": []
42
+ }