@maggioli-design-system/mds-paginator 1.0.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/dist/cjs/index-970ace02.js +1203 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/mds-paginator.cjs.entry.js +59 -0
- package/dist/cjs/mds-paginator.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/mds-paginator/mds-paginator.css +73 -0
- package/dist/collection/components/mds-paginator/mds-paginator.js +114 -0
- package/dist/collection/components/mds-paginator/test/mds-paginator.stories.js +26 -0
- package/dist/collection/dictionary/autocomplete.js +59 -0
- package/dist/collection/dictionary/button.js +26 -0
- package/dist/collection/dictionary/color.js +19 -0
- package/dist/collection/dictionary/floating-ui.js +19 -0
- package/dist/collection/dictionary/icon.js +3 -0
- package/dist/collection/dictionary/input-text-type.js +13 -0
- package/dist/collection/dictionary/loading.js +5 -0
- package/dist/collection/dictionary/typography.js +59 -0
- package/dist/collection/dictionary/variant.js +65 -0
- package/dist/collection/fixtures/cities.js +110 -0
- package/dist/collection/interface/input-value.js +1 -0
- package/dist/collection/types/autocomplete.js +1 -0
- package/dist/collection/types/button.js +1 -0
- package/dist/collection/types/floating-ui.js +1 -0
- package/dist/collection/types/form-rel.js +1 -0
- package/dist/collection/types/input-text-type.js +1 -0
- package/dist/collection/types/input-value-type.js +1 -0
- package/dist/collection/types/loading.js +1 -0
- package/dist/collection/types/typography.js +1 -0
- package/dist/collection/types/variant.js +1 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +2 -0
- package/dist/components/mds-paginator.d.ts +11 -0
- package/dist/components/mds-paginator.js +76 -0
- package/dist/esm/index-2c9f4cc7.js +1175 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/mds-paginator.entry.js +55 -0
- package/dist/esm/mds-paginator.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm-es5/index-2c9f4cc7.js +2 -0
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +1 -0
- package/dist/esm-es5/mds-paginator.entry.js +1 -0
- package/dist/esm-es5/mds-paginator.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/mds-paginator/index.esm.js +0 -0
- package/dist/mds-paginator/mds-paginator.esm.js +1 -0
- package/dist/mds-paginator/mds-paginator.js +130 -0
- package/dist/mds-paginator/p-1af6182a.entry.js +1 -0
- package/dist/mds-paginator/p-4e602610.js +2 -0
- package/dist/mds-paginator/p-50ea2036.system.js +1 -0
- package/dist/mds-paginator/p-580a8708.system.js +2 -0
- package/dist/mds-paginator/p-628f5264.system.js +1 -0
- package/dist/mds-paginator/p-d71311fc.system.entry.js +1 -0
- package/dist/stats.json +487 -0
- package/dist/types/components/mds-paginator/mds-paginator.d.ts +20 -0
- package/dist/types/components/mds-paginator/test/mds-paginator.stories.d.ts +22 -0
- package/dist/types/components.d.ts +61 -0
- package/dist/types/dictionary/autocomplete.d.ts +2 -0
- package/dist/types/dictionary/button.d.ts +5 -0
- package/dist/types/dictionary/color.d.ts +3 -0
- package/dist/types/dictionary/floating-ui.d.ts +3 -0
- package/dist/types/dictionary/icon.d.ts +2 -0
- package/dist/types/dictionary/input-text-type.d.ts +2 -0
- package/dist/types/dictionary/loading.d.ts +2 -0
- package/dist/types/dictionary/typography.d.ts +9 -0
- package/dist/types/dictionary/variant.d.ts +9 -0
- package/dist/types/fixtures/cities.d.ts +2 -0
- package/dist/types/interface/input-value.d.ts +4 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/types/autocomplete.d.ts +2 -0
- package/dist/types/types/button.d.ts +4 -0
- package/dist/types/types/floating-ui.d.ts +2 -0
- package/dist/types/types/form-rel.d.ts +1 -0
- package/dist/types/types/input-text-type.d.ts +1 -0
- package/dist/types/types/input-value-type.d.ts +1 -0
- package/dist/types/types/loading.d.ts +1 -0
- package/dist/types/types/typography.d.ts +8 -0
- package/dist/types/types/variant.d.ts +10 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +47 -0
- package/readme.md +40 -0
- package/src/components/mds-paginator/.gitlab-ci.yml +25 -0
- package/src/components/mds-paginator/mds-paginator.css +41 -0
- package/src/components/mds-paginator/mds-paginator.tsx +78 -0
- package/src/components/mds-paginator/readme.md +25 -0
- package/src/components/mds-paginator/test/mds-paginator.e2e.ts +12 -0
- package/src/components/mds-paginator/test/mds-paginator.spec.tsx +19 -0
- package/src/components/mds-paginator/test/mds-paginator.stories.tsx +31 -0
- package/src/components.d.ts +61 -0
- package/src/dictionary/autocomplete.ts +62 -0
- package/src/dictionary/button.ts +35 -0
- package/src/dictionary/color.ts +24 -0
- package/src/dictionary/floating-ui.ts +25 -0
- package/src/dictionary/icon.ts +5 -0
- package/src/dictionary/input-text-type.ts +17 -0
- package/src/dictionary/loading.ts +9 -0
- package/src/dictionary/typography.ts +76 -0
- package/src/dictionary/variant.ts +82 -0
- package/src/fixtures/cities.ts +116 -0
- package/src/fixtures/icons.json +65 -0
- package/src/interface/input-value.ts +5 -0
- package/src/tailwind/components.css +14 -0
- package/src/types/autocomplete.ts +69 -0
- package/src/types/button.ts +24 -0
- package/src/types/floating-ui.ts +17 -0
- package/src/types/form-rel.ts +11 -0
- package/src/types/input-text-type.ts +11 -0
- package/src/types/input-value-type.ts +5 -0
- package/src/types/loading.ts +3 -0
- package/src/types/typography.ts +57 -0
- package/src/types/variant.ts +73 -0
- package/www/build/index.esm.js +0 -0
- package/www/build/mds-paginator.esm.js +1 -0
- package/www/build/mds-paginator.js +130 -0
- package/www/build/p-1af6182a.entry.js +1 -0
- package/www/build/p-4e602610.js +2 -0
- package/www/build/p-50ea2036.system.js +1 -0
- package/www/build/p-580a8708.system.js +2 -0
- package/www/build/p-628f5264.system.js +1 -0
- package/www/build/p-d71311fc.system.entry.js +1 -0
- package/www/host.config.json +15 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare type AutocompleteType = 'additional-name' | 'address' | 'address-level1' | 'address-level2' | 'address-level3' | 'address-level4' | 'address-line1' | 'address-line2' | 'address-line3' | 'bday' | 'bday-day' | 'bday-month' | 'bday-year' | 'cc-additional-name' | 'cc-csc' | 'cc-exp' | 'cc-exp-month' | 'cc-exp-year' | 'cc-family-name' | 'cc-family-name' | 'cc-given-name' | 'cc-name' | 'cc-number' | 'cc-type' | 'country' | 'country-name' | 'current-password' | 'email' | 'family-name' | 'given-name' | 'honorific-prefix' | 'honorific-suffix' | 'impp' | 'language' | 'name' | 'new-password' | 'nickname' | 'off' | 'on' | 'one-time-code' | 'organization' | 'organization-title' | 'photo' | 'postal-code' | 'sex' | 'street-address' | 'tel' | 'tel-area-code' | 'tel-country-code' | 'tel-extension' | 'tel-local' | 'tel-national' | 'transaction-amount' | 'transaction-currency' | 'url' | 'username';
|
|
2
|
+
export declare type InputTextType = 'date' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'textarea' | 'time' | 'url';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare type ButtonType = 'a' | 'button' | 'reset' | 'submit';
|
|
2
|
+
export declare type ButtonSizeType = 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
export declare type ButtonIconPositionType = 'left' | 'right';
|
|
4
|
+
export declare type ButtonVariantType = 'primary' | 'dark' | 'light' | 'error' | 'info' | 'success' | 'warning';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type FormRelType = 'external' | 'help' | 'license' | 'next' | 'nofollow' | 'noopener' | 'noreferrer' | 'opener' | 'prev' | 'search';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type InputTextType = 'date' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'textarea' | 'time' | 'url';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type InputValueType = null | number | string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type LoadingType = 'eager' | 'lazy';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type TypographyType = 'action' | 'caption' | 'code' | 'detail' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'hack' | 'label' | 'option' | 'paragraph' | 'tip';
|
|
2
|
+
export declare type TypographyVariants = 'title' | 'info' | 'read' | 'mono';
|
|
3
|
+
export declare type TypographyTitleType = 'action' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
4
|
+
export declare type TypographyInfoType = 'caption' | 'detail' | 'label' | 'option' | 'paragraph' | 'tip';
|
|
5
|
+
export declare type TypographyReadType = 'caption' | 'detail' | 'paragraph';
|
|
6
|
+
export declare type TypographySmallerType = 'tip' | 'option';
|
|
7
|
+
export declare type TypographyMonoType = 'code' | 'hack';
|
|
8
|
+
export declare type TypographyTooltipType = 'caption' | 'detail' | 'tip';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare type ThemeStatusVariantType = 'error' | 'info' | 'success' | 'warning';
|
|
2
|
+
export declare type ThemeVariantType = 'dark' | 'error' | 'info' | 'light' | 'primary' | 'success' | 'warning';
|
|
3
|
+
export declare type ThemeFullVariantType = 'amaranth' | 'aqua' | 'blue' | 'dark' | 'error' | 'green' | 'info' | 'light' | 'lime' | 'orange' | 'orchid' | 'sky' | 'success' | 'violet' | 'warning' | 'yellow';
|
|
4
|
+
export declare type ThemeLuminanceVariantType = 'dark' | 'light';
|
|
5
|
+
export declare type LabelVariantType = 'amaranth' | 'aqua' | 'blue' | 'green' | 'lime' | 'orange' | 'orchid' | 'sky' | 'violet' | 'yellow';
|
|
6
|
+
export declare type ActionVariantType = 'primary' | 'dark' | 'light';
|
|
7
|
+
export declare type StateVariantType = 'disabled' | 'focused' | 'readonly';
|
|
8
|
+
export declare type ToneVariantType = 'strong' | 'weak' | 'ghost' | 'quiet';
|
|
9
|
+
export declare type ToneSimpleVariantType = 'strong' | 'weak' | 'quiet';
|
|
10
|
+
export declare type ToneMinimalVariantType = 'strong' | 'weak';
|
package/loader/cdn.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from '../dist/types/components';
|
|
2
|
+
export interface CustomElementsDefineOptions {
|
|
3
|
+
exclude?: string[];
|
|
4
|
+
resourcesUrl?: string;
|
|
5
|
+
syncQueue?: boolean;
|
|
6
|
+
jmp?: (c: Function) => any;
|
|
7
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
8
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
9
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
|
|
12
|
+
export declare function applyPolyfills(): Promise<void>;
|
package/loader/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
(function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
|
|
3
|
+
export * from '../dist/esm/polyfills/index.js';
|
|
4
|
+
export * from '../dist/esm-es5/loader.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maggioli-design-system/mds-paginator",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "mds-paginator is a web-component from Maggioli Design System Magma, built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScirpt framework you are using.",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"es2015": "dist/esm/index.mjs",
|
|
8
|
+
"es2017": "dist/esm/index.mjs",
|
|
9
|
+
"types": "dist/types/components.d.ts",
|
|
10
|
+
"collection": "dist/collection/collection-manifest.json",
|
|
11
|
+
"collection:main": "dist/collection/index.js",
|
|
12
|
+
"unpkg": "dist/mds-paginator/mds-paginator.esm.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/",
|
|
15
|
+
"loader/",
|
|
16
|
+
"readme.md",
|
|
17
|
+
"src/",
|
|
18
|
+
"www/"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rm src/components.d.ts || true && stencil build --docs-readme",
|
|
22
|
+
"prepublishOnly": "npm run build",
|
|
23
|
+
"test": "stencil test --spec --e2e"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@maggioli-design-system/styles": "^8.0.0",
|
|
27
|
+
"@stencil/core": "^2.17.0"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"author": {
|
|
31
|
+
"name": "Vittorio Vittori",
|
|
32
|
+
"email": "vittorio.vittori@maggioli.it",
|
|
33
|
+
"url": "http://vit.to"
|
|
34
|
+
},
|
|
35
|
+
"contributors": [
|
|
36
|
+
{
|
|
37
|
+
"name": "Andrea Pruccoli",
|
|
38
|
+
"email": "andrea.pruccoli@maggioli.it",
|
|
39
|
+
"role": "Software Engineer"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "Vittorio Vittori",
|
|
43
|
+
"email": "vittorio.vittori@maggioli.it",
|
|
44
|
+
"role": "UX UI Designer"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# mds-paginator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<!-- Auto Generated Below -->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
| Property | Attribute | Description | Type | Default |
|
|
11
|
+
| ------------- | -------------- | ---------------------------------------------------- | -------- | ------- |
|
|
12
|
+
| `currentPage` | `current-page` | Specifies the current page selected in the paginator | `number` | `1` |
|
|
13
|
+
| `pages` | `pages` | Specifies the number of total pages to be handled | `0` | `0` |
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Events
|
|
17
|
+
|
|
18
|
+
| Event | Description | Type |
|
|
19
|
+
| ------------------ | ---------------------------- | --------------------- |
|
|
20
|
+
| `pageChangedEvent` | Emits when a page is changed | `CustomEvent<number>` |
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
### Depends on
|
|
26
|
+
|
|
27
|
+
- [mds-paginator-item](../mds-paginator-item)
|
|
28
|
+
|
|
29
|
+
### Graph
|
|
30
|
+
```mermaid
|
|
31
|
+
graph TD;
|
|
32
|
+
mds-paginator --> mds-paginator-item
|
|
33
|
+
mds-paginator-item --> mds-icon
|
|
34
|
+
mds-paginator-item --> mds-text
|
|
35
|
+
style mds-paginator fill:#f9f,stroke:#333,stroke-width:4px
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
----------------------------------------------
|
|
39
|
+
|
|
40
|
+
Built with love @ **Maggioli Informatica / R&D Department**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.base-paginator:
|
|
2
|
+
variables:
|
|
3
|
+
COMPONENT: mds-paginator
|
|
4
|
+
|
|
5
|
+
# ISOLATE
|
|
6
|
+
paginator-isolate:
|
|
7
|
+
extends: [.base-isolate, .base-paginator]
|
|
8
|
+
dependencies: [base-stencil-build]
|
|
9
|
+
|
|
10
|
+
# TEST
|
|
11
|
+
paginator-publish-test:
|
|
12
|
+
extends: [.base-stencil-publish-test, .base-paginator]
|
|
13
|
+
dependencies: [base-stencil-build, paginator-isolate]
|
|
14
|
+
|
|
15
|
+
# PUBLISH
|
|
16
|
+
paginator-publish:
|
|
17
|
+
extends: [.base-stencil-publish, .base-paginator]
|
|
18
|
+
dependencies: [base-stencil-build, paginator-isolate]
|
|
19
|
+
needs: [base-stencil-build, paginator-isolate, paginator-publish-test]
|
|
20
|
+
|
|
21
|
+
# INSTALL TEST
|
|
22
|
+
paginator-install-test:
|
|
23
|
+
extends: [.base-stencil-install-test, .base-paginator]
|
|
24
|
+
needs: [paginator-publish]
|
|
25
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@tailwind utilities;
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* @prop --background: Sets the background-color of the pages area and the item
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
|
|
9
|
+
--background: theme('colors.tone-neutral-09');
|
|
10
|
+
|
|
11
|
+
@apply
|
|
12
|
+
flex
|
|
13
|
+
gap-1
|
|
14
|
+
items-center;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pages {
|
|
18
|
+
@apply
|
|
19
|
+
flex
|
|
20
|
+
flex-shrink
|
|
21
|
+
items-center
|
|
22
|
+
overflow-auto
|
|
23
|
+
mx-2
|
|
24
|
+
p-2
|
|
25
|
+
rounded-full
|
|
26
|
+
scroll-smooth;
|
|
27
|
+
|
|
28
|
+
background-color: var(--background);
|
|
29
|
+
gap: 2px;
|
|
30
|
+
|
|
31
|
+
/* scroll-snap-type: x mandatory; */
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host () .pages {
|
|
35
|
+
-ms-overflow-style: none;
|
|
36
|
+
scrollbar-width: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.pages::-webkit-scrollbar {
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Component, Element, Event, EventEmitter, Host, h, Prop } from '@stencil/core'
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
tag: 'mds-paginator',
|
|
5
|
+
styleUrl: 'mds-paginator.css',
|
|
6
|
+
shadow: true,
|
|
7
|
+
})
|
|
8
|
+
export class MdsPaginator {
|
|
9
|
+
|
|
10
|
+
@Element() private element: HTMLMdsPaginatorElement
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Specifies the number of total pages to be handled
|
|
14
|
+
*/
|
|
15
|
+
@Prop() readonly pages? = 0
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Specifies the current page selected in the paginator
|
|
19
|
+
*/
|
|
20
|
+
@Prop({ mutable: true, reflect: true }) currentPage? = 1
|
|
21
|
+
|
|
22
|
+
componentDidLoad (): void {
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
this.goToPage(this.currentPage)
|
|
25
|
+
}, 10)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Emits when a page is changed
|
|
30
|
+
*/
|
|
31
|
+
@Event() pageChangedEvent: EventEmitter<number>
|
|
32
|
+
|
|
33
|
+
private scrollPage = (): void => {
|
|
34
|
+
const elementIndex = this.currentPage - 2
|
|
35
|
+
const pagesElement = this.element.shadowRoot.querySelector<HTMLDivElement>('.pages')
|
|
36
|
+
const pagesItems = pagesElement.querySelectorAll<HTMLMdsPaginatorItemElement>('mds-paginator-item')
|
|
37
|
+
|
|
38
|
+
if (elementIndex < 0) {
|
|
39
|
+
pagesElement.scrollLeft = 0
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (elementIndex > pagesItems.length - 1) {
|
|
44
|
+
const pageItem = pagesItems[pagesItems.length - 1]
|
|
45
|
+
pagesElement.scrollLeft = pageItem.offsetLeft - pagesElement.offsetLeft
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const pageItem = pagesItems[elementIndex]
|
|
50
|
+
pagesElement.scrollLeft = pageItem.offsetLeft - pagesElement.offsetLeft - (pagesElement.offsetWidth / 2) + (pageItem.offsetWidth / 2)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private goToPage = (selectedPage: number): void => {
|
|
54
|
+
if (selectedPage < 1 || selectedPage > this.pages) {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
this.currentPage = selectedPage
|
|
58
|
+
this.scrollPage()
|
|
59
|
+
this.pageChangedEvent.emit(this.currentPage)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
render () {
|
|
63
|
+
return (
|
|
64
|
+
<Host>
|
|
65
|
+
<mds-paginator-item icon="mi/baseline/arrow-back" disabled={this.currentPage === 1} onClick={() => this.goToPage(this.currentPage - 1)}/>
|
|
66
|
+
{ this.pages > 0 && <mds-paginator-item active={this.currentPage === 1} onClick={() => this.goToPage(1)}>1</mds-paginator-item>}
|
|
67
|
+
{ this.pages > 2 &&
|
|
68
|
+
<div class="pages">
|
|
69
|
+
{ Array.from(Array(this.pages - 2).keys()).map( i => <mds-paginator-item key={i} active={this.currentPage === i + 2} onClick={() => this.goToPage(i + 2)}>{ i + 2 }</mds-paginator-item>) }
|
|
70
|
+
</div>
|
|
71
|
+
}
|
|
72
|
+
{ this.pages && <mds-paginator-item active={this.currentPage === this.pages} onClick={() => this.goToPage(this.pages)}>{ this.pages }</mds-paginator-item>}
|
|
73
|
+
<mds-paginator-item icon="mi/baseline/arrow-forward" disabled={this.currentPage === this.pages} onClick={() => this.goToPage(this.currentPage + 1)}/>
|
|
74
|
+
</Host>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# mds-paginator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<!-- Auto Generated Below -->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
| Property | Attribute | Description | Type | Default |
|
|
11
|
+
| ------------- | -------------- | ---------------------------------------------------- | -------- | ------- |
|
|
12
|
+
| `currentPage` | `current-page` | Specifies the current page selected in the paginator | `number` | `1` |
|
|
13
|
+
| `pages` | `pages` | Specifies the number of total pages to be handled | `0` | `0` |
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Events
|
|
17
|
+
|
|
18
|
+
| Event | Description | Type |
|
|
19
|
+
| ------------------ | ---------------------------- | --------------------- |
|
|
20
|
+
| `pageChangedEvent` | Emits when a page is changed | `CustomEvent<number>` |
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
----------------------------------------------
|
|
24
|
+
|
|
25
|
+
Built with love @ **Maggioli Informatica / R&D Department**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { newE2EPage } from '@stencil/core/testing'
|
|
2
|
+
|
|
3
|
+
describe('mds-paginator', () => {
|
|
4
|
+
it('renders', async () => {
|
|
5
|
+
const page = await newE2EPage()
|
|
6
|
+
await page.setContent('<mds-paginator></mds-paginator>')
|
|
7
|
+
|
|
8
|
+
const element = await page.find('mds-paginator')
|
|
9
|
+
// expect(element).toHaveClass('hydrated')
|
|
10
|
+
expect(true).toBe(true)
|
|
11
|
+
})
|
|
12
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { newSpecPage } from '@stencil/core/testing'
|
|
2
|
+
import { MdsPaginator } from '../mds-paginator'
|
|
3
|
+
|
|
4
|
+
describe('mds-paginator', () => {
|
|
5
|
+
it('renders', async () => {
|
|
6
|
+
const page = await newSpecPage({
|
|
7
|
+
components: [MdsPaginator],
|
|
8
|
+
html: '<mds-paginator></mds-paginator>',
|
|
9
|
+
})
|
|
10
|
+
// expect(page.root).toEqualHtml(`
|
|
11
|
+
// <mds-paginator>
|
|
12
|
+
// <mock:shadow-root>
|
|
13
|
+
// <slot></slot>
|
|
14
|
+
// </mock:shadow-root>
|
|
15
|
+
// </mds-paginator>
|
|
16
|
+
// `)
|
|
17
|
+
expect(true).toBe(true)
|
|
18
|
+
})
|
|
19
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { h } from '@stencil/core'
|
|
2
|
+
import { lokiDisabled } from '@test/loki-disabled'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'UI / Paginator',
|
|
6
|
+
argTypes: {
|
|
7
|
+
pages: {
|
|
8
|
+
type: { name: 'number', required: false },
|
|
9
|
+
description: 'Specifies the number of total pages to be handled',
|
|
10
|
+
},
|
|
11
|
+
'current-page': {
|
|
12
|
+
type: { name: 'number', required: false },
|
|
13
|
+
description: 'Specifies the current page selected in the paginator',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
const Template = args =>
|
|
18
|
+
<mds-paginator {...args}/>
|
|
19
|
+
|
|
20
|
+
export const Default = Template.bind({})
|
|
21
|
+
Default.args = {
|
|
22
|
+
pages: 32,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const currentPage = Template.bind({})
|
|
26
|
+
currentPage.args = {
|
|
27
|
+
'current-page': 16,
|
|
28
|
+
pages: 32,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
currentPage.story = lokiDisabled
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/**
|
|
4
|
+
* This is an autogenerated file created by the Stencil compiler.
|
|
5
|
+
* It contains typing information for all components that exist in this project.
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
|
|
8
|
+
export namespace Components {
|
|
9
|
+
interface MdsPaginator {
|
|
10
|
+
/**
|
|
11
|
+
* Specifies the current page selected in the paginator
|
|
12
|
+
*/
|
|
13
|
+
"currentPage"?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Specifies the number of total pages to be handled
|
|
16
|
+
*/
|
|
17
|
+
"pages"?: 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export interface MdsPaginatorCustomEvent<T> extends CustomEvent<T> {
|
|
21
|
+
detail: T;
|
|
22
|
+
target: HTMLMdsPaginatorElement;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLMdsPaginatorElement extends Components.MdsPaginator, HTMLStencilElement {
|
|
26
|
+
}
|
|
27
|
+
var HTMLMdsPaginatorElement: {
|
|
28
|
+
prototype: HTMLMdsPaginatorElement;
|
|
29
|
+
new (): HTMLMdsPaginatorElement;
|
|
30
|
+
};
|
|
31
|
+
interface HTMLElementTagNameMap {
|
|
32
|
+
"mds-paginator": HTMLMdsPaginatorElement;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
declare namespace LocalJSX {
|
|
36
|
+
interface MdsPaginator {
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the current page selected in the paginator
|
|
39
|
+
*/
|
|
40
|
+
"currentPage"?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Emits when a page is changed
|
|
43
|
+
*/
|
|
44
|
+
"onPageChangedEvent"?: (event: MdsPaginatorCustomEvent<number>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Specifies the number of total pages to be handled
|
|
47
|
+
*/
|
|
48
|
+
"pages"?: 0;
|
|
49
|
+
}
|
|
50
|
+
interface IntrinsicElements {
|
|
51
|
+
"mds-paginator": MdsPaginator;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export { LocalJSX as JSX };
|
|
55
|
+
declare module "@stencil/core" {
|
|
56
|
+
export namespace JSX {
|
|
57
|
+
interface IntrinsicElements {
|
|
58
|
+
"mds-paginator": LocalJSX.MdsPaginator & JSXBase.HTMLAttributes<HTMLMdsPaginatorElement>;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const autoCompleteDictionary = [
|
|
2
|
+
'additional-name',
|
|
3
|
+
'address',
|
|
4
|
+
'address-level1',
|
|
5
|
+
'address-level2',
|
|
6
|
+
'address-level3',
|
|
7
|
+
'address-level4',
|
|
8
|
+
'address-line1',
|
|
9
|
+
'address-line2',
|
|
10
|
+
'address-line3',
|
|
11
|
+
'bday',
|
|
12
|
+
'bday-day',
|
|
13
|
+
'bday-month',
|
|
14
|
+
'bday-year',
|
|
15
|
+
'cc-additional-name',
|
|
16
|
+
'cc-csc',
|
|
17
|
+
'cc-exp',
|
|
18
|
+
'cc-exp-month',
|
|
19
|
+
'cc-exp-year',
|
|
20
|
+
'cc-family-name',
|
|
21
|
+
'cc-family-name',
|
|
22
|
+
'cc-given-name',
|
|
23
|
+
'cc-name',
|
|
24
|
+
'cc-number',
|
|
25
|
+
'cc-type',
|
|
26
|
+
'country',
|
|
27
|
+
'country-name',
|
|
28
|
+
'current-password',
|
|
29
|
+
'email',
|
|
30
|
+
'family-name',
|
|
31
|
+
'given-name',
|
|
32
|
+
'honorific-prefix',
|
|
33
|
+
'honorific-suffix',
|
|
34
|
+
'impp',
|
|
35
|
+
'language',
|
|
36
|
+
'name',
|
|
37
|
+
'new-password',
|
|
38
|
+
'nickname',
|
|
39
|
+
'off',
|
|
40
|
+
'on',
|
|
41
|
+
'one-time-code',
|
|
42
|
+
'organization',
|
|
43
|
+
'organization-title',
|
|
44
|
+
'photo',
|
|
45
|
+
'postal-code',
|
|
46
|
+
'sex',
|
|
47
|
+
'street-address',
|
|
48
|
+
'tel',
|
|
49
|
+
'tel-area-code',
|
|
50
|
+
'tel-country-code',
|
|
51
|
+
'tel-extension',
|
|
52
|
+
'tel-local',
|
|
53
|
+
'tel-national',
|
|
54
|
+
'transaction-amount',
|
|
55
|
+
'transaction-currency',
|
|
56
|
+
'url',
|
|
57
|
+
'username',
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
autoCompleteDictionary,
|
|
62
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const buttonVariantDictionary = [
|
|
2
|
+
'dark',
|
|
3
|
+
'error',
|
|
4
|
+
'info',
|
|
5
|
+
'light',
|
|
6
|
+
'primary',
|
|
7
|
+
'success',
|
|
8
|
+
'warning',
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
const buttonToneVariantDictionary = [
|
|
12
|
+
'strong',
|
|
13
|
+
'weak',
|
|
14
|
+
'ghost',
|
|
15
|
+
'quiet',
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
const buttonSizeDictionary = [
|
|
19
|
+
'sm',
|
|
20
|
+
'md',
|
|
21
|
+
'lg',
|
|
22
|
+
'xl',
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const buttonIconPositionDictionary = [
|
|
26
|
+
'left',
|
|
27
|
+
'right',
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
buttonSizeDictionary,
|
|
32
|
+
buttonToneVariantDictionary,
|
|
33
|
+
buttonVariantDictionary,
|
|
34
|
+
buttonIconPositionDictionary,
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const colorLabelDictionary = [
|
|
2
|
+
'amaranth',
|
|
3
|
+
'aqua',
|
|
4
|
+
'blue',
|
|
5
|
+
'green',
|
|
6
|
+
'lime',
|
|
7
|
+
'orange',
|
|
8
|
+
'orchid',
|
|
9
|
+
'sky',
|
|
10
|
+
'violet',
|
|
11
|
+
'yellow',
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
const colorStatusDictionary = [
|
|
15
|
+
'error',
|
|
16
|
+
'info',
|
|
17
|
+
'success',
|
|
18
|
+
'warning',
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
colorLabelDictionary,
|
|
23
|
+
colorStatusDictionary,
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
const floatingUIPlacementDictionary = [
|
|
3
|
+
'bottom',
|
|
4
|
+
'bottom-end',
|
|
5
|
+
'bottom-start',
|
|
6
|
+
'left',
|
|
7
|
+
'left-end',
|
|
8
|
+
'left-start',
|
|
9
|
+
'right',
|
|
10
|
+
'right-end',
|
|
11
|
+
'right-start',
|
|
12
|
+
'top',
|
|
13
|
+
'top-end',
|
|
14
|
+
'top-start',
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
const floatingUIStrategyDictionary = [
|
|
18
|
+
'absolute',
|
|
19
|
+
'fixed',
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
floatingUIPlacementDictionary,
|
|
24
|
+
floatingUIStrategyDictionary,
|
|
25
|
+
}
|