@maggioli-design-system/mds-accordion-timer 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-dc0bb58e.js +1017 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/mds-accordion-timer.cjs.entry.js +129 -0
- package/dist/cjs/mds-accordion-timer.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.css +3 -0
- package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +184 -0
- package/dist/collection/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +32 -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/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 +37 -0
- package/dist/collection/dictionary/variant.js +64 -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/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/custom-elements/index.d.ts +45 -0
- package/dist/custom-elements/index.js +141 -0
- package/dist/esm/index-468ab090.js +989 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/mds-accordion-timer.entry.js +125 -0
- package/dist/esm/mds-accordion-timer.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-468ab090.js +1 -0
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +1 -0
- package/dist/esm-es5/mds-accordion-timer.entry.js +1 -0
- package/dist/esm-es5/mds-accordion-timer.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/mds-accordion-timer/index.esm.js +0 -0
- package/dist/mds-accordion-timer/mds-accordion-timer.esm.js +1 -0
- package/dist/mds-accordion-timer/mds-accordion-timer.js +130 -0
- package/dist/mds-accordion-timer/p-104355eb.system.entry.js +1 -0
- package/dist/mds-accordion-timer/p-2c75936b.entry.js +1 -0
- package/dist/mds-accordion-timer/p-50ea2036.system.js +1 -0
- package/dist/mds-accordion-timer/p-74539cca.system.js +1 -0
- package/dist/mds-accordion-timer/p-a652c8b3.system.js +1 -0
- package/dist/mds-accordion-timer/p-ac3fdd27.js +1 -0
- package/dist/stats.json +471 -0
- package/dist/types/components/mds-accordion-timer/mds-accordion-timer.d.ts +37 -0
- package/dist/types/components.d.ts +49 -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/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 +5 -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 +1563 -0
- package/dist/types/types/autocomplete.d.ts +2 -0
- package/dist/types/types/button.d.ts +4 -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 +4 -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 +45 -0
- package/readme.md +24 -0
- package/src/components/mds-accordion-timer/mds-accordion-timer.css +3 -0
- package/src/components/mds-accordion-timer/mds-accordion-timer.tsx +159 -0
- package/src/components/mds-accordion-timer/readme.md +24 -0
- package/src/components/mds-accordion-timer/test/mds-accordion-timer.e2e.ts +11 -0
- package/src/components/mds-accordion-timer/test/mds-accordion-timer.spec.tsx +18 -0
- package/src/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +32 -0
- package/src/components.d.ts +49 -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/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 +46 -0
- package/src/dictionary/variant.ts +81 -0
- package/src/fixtures/cities.ts +116 -0
- package/src/interface/input-value.ts +5 -0
- package/src/types/autocomplete.ts +69 -0
- package/src/types/button.ts +24 -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 +35 -0
- package/src/types/variant.ts +72 -0
- package/www/build/index.esm.js +0 -0
- package/www/build/mds-accordion-timer.esm.js +1 -0
- package/www/build/mds-accordion-timer.js +130 -0
- package/www/build/p-104355eb.system.entry.js +1 -0
- package/www/build/p-2c75936b.entry.js +1 -0
- package/www/build/p-50ea2036.system.js +1 -0
- package/www/build/p-74539cca.system.js +1 -0
- package/www/build/p-a652c8b3.system.js +1 -0
- package/www/build/p-ac3fdd27.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,4 @@
|
|
|
1
|
+
export declare type TypographyType = 'action' | 'caption' | 'code' | 'detail' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'hack' | 'label' | 'option' | 'paragraph';
|
|
2
|
+
export declare type TypographyPrimaryType = 'action' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
3
|
+
export declare type TypographySecondaryType = 'caption' | 'detail' | 'label' | 'option' | 'paragraph';
|
|
4
|
+
export declare type TypographyMonoType = 'code' | 'hack';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare type ThemeStatusVariantType = 'error' | 'info' | 'success' | 'warning';
|
|
2
|
+
export declare type ThemeVariantType = 'dark' | 'light' | 'error' | 'info' | '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,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maggioli-design-system/mds-accordion-timer",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "mds-accordion-timer 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/custom-elements/index.js",
|
|
7
|
+
"es2015": "dist/esm/index.mjs",
|
|
8
|
+
"es2017": "dist/esm/index.mjs",
|
|
9
|
+
"types": "dist/custom-elements/index.d.ts",
|
|
10
|
+
"collection": "dist/collection/collection-manifest.json",
|
|
11
|
+
"collection:main": "dist/collection/index.js",
|
|
12
|
+
"unpkg": "dist/mds-accordion-timer/mds-accordion-timer.esm.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/",
|
|
15
|
+
"loader/",
|
|
16
|
+
"readme.md",
|
|
17
|
+
"src/",
|
|
18
|
+
"www/"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "stencil build --docs-readme"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@maggioli-design-system/mds-accordion-timer-item": "^1.0.0",
|
|
25
|
+
"@stencil/core": "^2.10.0"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"author": {
|
|
29
|
+
"name": "Vittorio Vittori",
|
|
30
|
+
"email": "vittorio.vittori@maggioli.it",
|
|
31
|
+
"url": "http://vit.to"
|
|
32
|
+
},
|
|
33
|
+
"contributors": [
|
|
34
|
+
{
|
|
35
|
+
"name": "Andrea Pruccoli",
|
|
36
|
+
"email": "andrea.pruccoli@maggioli.it",
|
|
37
|
+
"role": "Software Engineer"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "Vittorio Vittori",
|
|
41
|
+
"email": "vittorio.vittori@maggioli.it",
|
|
42
|
+
"role": "UX UI Designer"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# mds-accordion-timer
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<!-- Auto Generated Below -->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
| Property | Attribute | Description | Type | Default |
|
|
11
|
+
| ---------- | ---------- | ---------------------------------------------- | -------- | ------- |
|
|
12
|
+
| `duration` | `duration` | Sets the duration of the single accordion item | `number` | `5000` |
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Events
|
|
16
|
+
|
|
17
|
+
| Event | Description | Type |
|
|
18
|
+
| --------------- | ------------------------------------------ | --------------------- |
|
|
19
|
+
| `itemActivated` | Emits when the accordion changes it's item | `CustomEvent<number>` |
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
----------------------------------------------
|
|
23
|
+
|
|
24
|
+
Built with love @ **Maggioli Informatica / R&D Department**
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Component, Host, Element, Event, EventEmitter, h, Prop, Listen, State } from '@stencil/core'
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
tag: 'mds-accordion-timer',
|
|
5
|
+
styleUrl: 'mds-accordion-timer.css',
|
|
6
|
+
shadow: true,
|
|
7
|
+
})
|
|
8
|
+
export class MdsAccordionTimer {
|
|
9
|
+
|
|
10
|
+
private timer: number
|
|
11
|
+
private timeChecker: number
|
|
12
|
+
private timeStarted: number
|
|
13
|
+
private activeItemDurationTime: number
|
|
14
|
+
private children: NodeListOf<HTMLMdsAccordionTimerItemElement>
|
|
15
|
+
private activeItem: HTMLMdsAccordionTimerItemElement
|
|
16
|
+
@Element() private element: HTMLMdsAccordionTimerElement
|
|
17
|
+
|
|
18
|
+
@State() time = 0
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Sets the duration of the single accordion item
|
|
22
|
+
*/
|
|
23
|
+
@Prop() duration?: number = 5000
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Emits when the accordion changes it's item
|
|
27
|
+
*/
|
|
28
|
+
@Event() itemActivated: EventEmitter<number>
|
|
29
|
+
|
|
30
|
+
componentDidLoad (): void {
|
|
31
|
+
this.children = this.element.querySelectorAll<HTMLMdsAccordionTimerItemElement>('mds-accordion-timer-item')
|
|
32
|
+
this.children.forEach((item, key) => {
|
|
33
|
+
item.uuid = key
|
|
34
|
+
if (item.active) {
|
|
35
|
+
this.activeItem = item
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private clearIntervals = (): void => {
|
|
41
|
+
window.clearInterval(this.timer)
|
|
42
|
+
window.clearInterval(this.timeChecker)
|
|
43
|
+
this.timer = null
|
|
44
|
+
this.timeChecker = null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
connectedCallback (): void {
|
|
48
|
+
this.startTimer()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
disconnectedCallback (): void {
|
|
52
|
+
this.stopTimer()
|
|
53
|
+
this.clearIntervals()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private progress = (): number => {
|
|
57
|
+
return Math.abs(this.remainingTime() / this.duration - 1)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private addTimeListener = (): void => {
|
|
61
|
+
this.timeChecker = window.setInterval(() => {
|
|
62
|
+
const progress = this.progress()
|
|
63
|
+
if (this.activeItem !== undefined) {
|
|
64
|
+
this.activeItem.progress = progress
|
|
65
|
+
}
|
|
66
|
+
if (progress === 1) {
|
|
67
|
+
this.activeItem.progress = 0
|
|
68
|
+
this.startNext()
|
|
69
|
+
}
|
|
70
|
+
}, 100)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private beginningTime = (): number => {
|
|
74
|
+
this.timeStarted = (new Date()).getTime()
|
|
75
|
+
return this.timeStarted
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private remainingTime = (): number => {
|
|
79
|
+
const remainingTime:number = this.activeItemDurationTime - ( (new Date()).getTime() - this.timeStarted )
|
|
80
|
+
return remainingTime >= 0 ? remainingTime : 0
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private setActiveItem = (uuid: number): void => {
|
|
84
|
+
this.children.forEach((item, key) => {
|
|
85
|
+
if (key === uuid) {
|
|
86
|
+
item.active = true
|
|
87
|
+
this.activeItem = item
|
|
88
|
+
this.itemActivated.emit(uuid)
|
|
89
|
+
} else {
|
|
90
|
+
item.active = false
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private startNext = (): void => {
|
|
96
|
+
const nextUuid = this.activeItem.uuid + 1 > this.children.length - 1 ? 0 : this.activeItem.uuid + 1
|
|
97
|
+
this.setActiveItem(nextUuid)
|
|
98
|
+
this.startTimer()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private startTimer = (): void => {
|
|
102
|
+
this.clearIntervals()
|
|
103
|
+
this.time = this.beginningTime()
|
|
104
|
+
this.activeItemDurationTime = this.duration
|
|
105
|
+
this.addTimeListener()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private playTimer = (): void => {
|
|
109
|
+
this.beginningTime()
|
|
110
|
+
this.addTimeListener()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private pauseTimer = (): void => {
|
|
114
|
+
this.clearIntervals()
|
|
115
|
+
this.activeItemDurationTime = this.remainingTime()
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private stopTimer = (): void => {
|
|
119
|
+
this.clearIntervals()
|
|
120
|
+
this.time = null
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@Listen('clickActive')
|
|
124
|
+
onClickActive (event: CustomEvent<string>): void {
|
|
125
|
+
if (event.detail === this.activeItem.description) {
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
let selectedUuid: number
|
|
129
|
+
this.children.forEach(item => {
|
|
130
|
+
item.progress = 0
|
|
131
|
+
if (item.description === event.detail) {
|
|
132
|
+
selectedUuid = item.uuid
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
this.setActiveItem(selectedUuid)
|
|
136
|
+
this.startTimer()
|
|
137
|
+
this.pauseTimer()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@Listen('mouseEnterActive')
|
|
141
|
+
onMouseEnterActive (): void {
|
|
142
|
+
this.pauseTimer()
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@Listen('mouseLeaveActive')
|
|
146
|
+
onMouseLeaveActive (): void {
|
|
147
|
+
if (this.timeChecker === null) {
|
|
148
|
+
this.playTimer()
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
render () {
|
|
153
|
+
return (
|
|
154
|
+
<Host>
|
|
155
|
+
<slot></slot>
|
|
156
|
+
</Host>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# mds-accordion-timer
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<!-- Auto Generated Below -->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
| Property | Attribute | Description | Type | Default |
|
|
11
|
+
| ---------- | ---------- | ---------------------------------------------- | -------- | ------- |
|
|
12
|
+
| `duration` | `duration` | Sets the duration of the single accordion item | `number` | `5000` |
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Events
|
|
16
|
+
|
|
17
|
+
| Event | Description | Type |
|
|
18
|
+
| --------------- | ------------------------------------------ | --------------------- |
|
|
19
|
+
| `itemActivated` | Emits when the accordion changes it's item | `CustomEvent<number>` |
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
----------------------------------------------
|
|
23
|
+
|
|
24
|
+
Built with love @ **Maggioli Informatica / R&D Department**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { newE2EPage } from '@stencil/core/testing'
|
|
2
|
+
|
|
3
|
+
describe('mds-accordion-timer', () => {
|
|
4
|
+
it('renders', async () => {
|
|
5
|
+
const page = await newE2EPage()
|
|
6
|
+
await page.setContent('<mds-accordion-timer></mds-accordion-timer>')
|
|
7
|
+
|
|
8
|
+
const element = await page.find('mds-accordion-timer')
|
|
9
|
+
expect(element).toHaveClass('hydrated')
|
|
10
|
+
})
|
|
11
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { newSpecPage } from '@stencil/core/testing'
|
|
2
|
+
import { MdsAccordionTimer } from '../mds-accordion-timer'
|
|
3
|
+
|
|
4
|
+
describe('mds-accordion-timer', () => {
|
|
5
|
+
it('renders', async () => {
|
|
6
|
+
const page = await newSpecPage({
|
|
7
|
+
components: [MdsAccordionTimer],
|
|
8
|
+
html: '<mds-accordion-timer></mds-accordion-timer>',
|
|
9
|
+
})
|
|
10
|
+
expect(page.root).toEqualHtml(`
|
|
11
|
+
<mds-accordion-timer>
|
|
12
|
+
<mock:shadow-root>
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</mock:shadow-root>
|
|
15
|
+
</mds-accordion-timer>
|
|
16
|
+
`)
|
|
17
|
+
})
|
|
18
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import MdsAccordionTimer from '@component/mds-accordion-timer/mds-accordion-timer'
|
|
3
|
+
import faker from 'faker'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'UI / Accordion Timer',
|
|
7
|
+
component: MdsAccordionTimer,
|
|
8
|
+
argTypes: {
|
|
9
|
+
duration: {
|
|
10
|
+
type: { name: 'number', required: false },
|
|
11
|
+
description: 'Sets the duration of the single accordion item',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const Template = args =>
|
|
17
|
+
<div>
|
|
18
|
+
<mds-accordion-timer {...args}>
|
|
19
|
+
<mds-accordion-timer-item active description={ faker.lorem.sentence() }><mds-text>{ faker.lorem.paragraphs(2) }</mds-text></mds-accordion-timer-item>
|
|
20
|
+
<mds-accordion-timer-item description={ faker.lorem.sentence() }><mds-text>{ faker.lorem.paragraphs(2) }</mds-text></mds-accordion-timer-item>
|
|
21
|
+
<mds-accordion-timer-item description={ faker.lorem.sentence() }><mds-text>{ faker.lorem.paragraphs(2) }</mds-text></mds-accordion-timer-item>
|
|
22
|
+
<mds-accordion-timer-item description={ faker.lorem.sentence() }><mds-text>{ faker.lorem.paragraphs(2) }</mds-text></mds-accordion-timer-item>
|
|
23
|
+
<mds-accordion-timer-item description={ faker.lorem.sentence() }><mds-text>{ faker.lorem.paragraphs(2) }</mds-text></mds-accordion-timer-item>
|
|
24
|
+
</mds-accordion-timer>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
export const Default = Template.bind({})
|
|
28
|
+
|
|
29
|
+
export const Duration = Template.bind({})
|
|
30
|
+
Duration.args = {
|
|
31
|
+
duration: 1000,
|
|
32
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 MdsAccordionTimer {
|
|
10
|
+
/**
|
|
11
|
+
* Sets the duration of the single accordion item
|
|
12
|
+
*/
|
|
13
|
+
"duration"?: number;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
declare global {
|
|
17
|
+
interface HTMLMdsAccordionTimerElement extends Components.MdsAccordionTimer, HTMLStencilElement {
|
|
18
|
+
}
|
|
19
|
+
var HTMLMdsAccordionTimerElement: {
|
|
20
|
+
prototype: HTMLMdsAccordionTimerElement;
|
|
21
|
+
new (): HTMLMdsAccordionTimerElement;
|
|
22
|
+
};
|
|
23
|
+
interface HTMLElementTagNameMap {
|
|
24
|
+
"mds-accordion-timer": HTMLMdsAccordionTimerElement;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
declare namespace LocalJSX {
|
|
28
|
+
interface MdsAccordionTimer {
|
|
29
|
+
/**
|
|
30
|
+
* Sets the duration of the single accordion item
|
|
31
|
+
*/
|
|
32
|
+
"duration"?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Emits when the accordion changes it's item
|
|
35
|
+
*/
|
|
36
|
+
"onItemActivated"?: (event: CustomEvent<number>) => void;
|
|
37
|
+
}
|
|
38
|
+
interface IntrinsicElements {
|
|
39
|
+
"mds-accordion-timer": MdsAccordionTimer;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export { LocalJSX as JSX };
|
|
43
|
+
declare module "@stencil/core" {
|
|
44
|
+
export namespace JSX {
|
|
45
|
+
interface IntrinsicElements {
|
|
46
|
+
"mds-accordion-timer": LocalJSX.MdsAccordionTimer & JSXBase.HTMLAttributes<HTMLMdsAccordionTimerElement>;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -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,46 @@
|
|
|
1
|
+
const typographyDictionary = [
|
|
2
|
+
'action',
|
|
3
|
+
'caption',
|
|
4
|
+
'code',
|
|
5
|
+
'detail',
|
|
6
|
+
'h1',
|
|
7
|
+
'h2',
|
|
8
|
+
'h3',
|
|
9
|
+
'h4',
|
|
10
|
+
'h5',
|
|
11
|
+
'h6',
|
|
12
|
+
'hack',
|
|
13
|
+
'label',
|
|
14
|
+
'option',
|
|
15
|
+
'paragraph',
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
const typographyMonoDictionary = [
|
|
19
|
+
'code',
|
|
20
|
+
'hack',
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const typographyPrimaryDictionary = [
|
|
24
|
+
'action',
|
|
25
|
+
'h1',
|
|
26
|
+
'h2',
|
|
27
|
+
'h3',
|
|
28
|
+
'h4',
|
|
29
|
+
'h5',
|
|
30
|
+
'h6',
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
const typographySecondaryDictionary = [
|
|
34
|
+
'caption',
|
|
35
|
+
'detail',
|
|
36
|
+
'label',
|
|
37
|
+
'option',
|
|
38
|
+
'paragraph',
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
typographyDictionary,
|
|
43
|
+
typographyMonoDictionary,
|
|
44
|
+
typographyPrimaryDictionary,
|
|
45
|
+
typographySecondaryDictionary,
|
|
46
|
+
}
|