@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.
Files changed (121) hide show
  1. package/dist/cjs/index-dc0bb58e.js +1017 -0
  2. package/dist/cjs/index.cjs.js +2 -0
  3. package/dist/cjs/loader.cjs.js +21 -0
  4. package/dist/cjs/mds-accordion-timer.cjs.entry.js +129 -0
  5. package/dist/cjs/mds-accordion-timer.cjs.js +19 -0
  6. package/dist/collection/collection-manifest.json +12 -0
  7. package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.css +3 -0
  8. package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +184 -0
  9. package/dist/collection/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +32 -0
  10. package/dist/collection/dictionary/autocomplete.js +59 -0
  11. package/dist/collection/dictionary/button.js +26 -0
  12. package/dist/collection/dictionary/color.js +19 -0
  13. package/dist/collection/dictionary/icon.js +3 -0
  14. package/dist/collection/dictionary/input-text-type.js +13 -0
  15. package/dist/collection/dictionary/loading.js +5 -0
  16. package/dist/collection/dictionary/typography.js +37 -0
  17. package/dist/collection/dictionary/variant.js +64 -0
  18. package/dist/collection/fixtures/cities.js +110 -0
  19. package/dist/collection/interface/input-value.js +1 -0
  20. package/dist/collection/types/autocomplete.js +1 -0
  21. package/dist/collection/types/button.js +1 -0
  22. package/dist/collection/types/form-rel.js +1 -0
  23. package/dist/collection/types/input-text-type.js +1 -0
  24. package/dist/collection/types/input-value-type.js +1 -0
  25. package/dist/collection/types/loading.js +1 -0
  26. package/dist/collection/types/typography.js +1 -0
  27. package/dist/collection/types/variant.js +1 -0
  28. package/dist/custom-elements/index.d.ts +45 -0
  29. package/dist/custom-elements/index.js +141 -0
  30. package/dist/esm/index-468ab090.js +989 -0
  31. package/dist/esm/index.js +1 -0
  32. package/dist/esm/loader.js +17 -0
  33. package/dist/esm/mds-accordion-timer.entry.js +125 -0
  34. package/dist/esm/mds-accordion-timer.js +17 -0
  35. package/dist/esm/polyfills/core-js.js +11 -0
  36. package/dist/esm/polyfills/css-shim.js +1 -0
  37. package/dist/esm/polyfills/dom.js +79 -0
  38. package/dist/esm/polyfills/es5-html-element.js +1 -0
  39. package/dist/esm/polyfills/index.js +34 -0
  40. package/dist/esm/polyfills/system.js +6 -0
  41. package/dist/esm-es5/index-468ab090.js +1 -0
  42. package/dist/esm-es5/index.js +0 -0
  43. package/dist/esm-es5/loader.js +1 -0
  44. package/dist/esm-es5/mds-accordion-timer.entry.js +1 -0
  45. package/dist/esm-es5/mds-accordion-timer.js +1 -0
  46. package/dist/index.cjs.js +1 -0
  47. package/dist/index.js +1 -0
  48. package/dist/mds-accordion-timer/index.esm.js +0 -0
  49. package/dist/mds-accordion-timer/mds-accordion-timer.esm.js +1 -0
  50. package/dist/mds-accordion-timer/mds-accordion-timer.js +130 -0
  51. package/dist/mds-accordion-timer/p-104355eb.system.entry.js +1 -0
  52. package/dist/mds-accordion-timer/p-2c75936b.entry.js +1 -0
  53. package/dist/mds-accordion-timer/p-50ea2036.system.js +1 -0
  54. package/dist/mds-accordion-timer/p-74539cca.system.js +1 -0
  55. package/dist/mds-accordion-timer/p-a652c8b3.system.js +1 -0
  56. package/dist/mds-accordion-timer/p-ac3fdd27.js +1 -0
  57. package/dist/stats.json +471 -0
  58. package/dist/types/components/mds-accordion-timer/mds-accordion-timer.d.ts +37 -0
  59. package/dist/types/components.d.ts +49 -0
  60. package/dist/types/dictionary/autocomplete.d.ts +2 -0
  61. package/dist/types/dictionary/button.d.ts +5 -0
  62. package/dist/types/dictionary/color.d.ts +3 -0
  63. package/dist/types/dictionary/icon.d.ts +2 -0
  64. package/dist/types/dictionary/input-text-type.d.ts +2 -0
  65. package/dist/types/dictionary/loading.d.ts +2 -0
  66. package/dist/types/dictionary/typography.d.ts +5 -0
  67. package/dist/types/dictionary/variant.d.ts +9 -0
  68. package/dist/types/fixtures/cities.d.ts +2 -0
  69. package/dist/types/interface/input-value.d.ts +4 -0
  70. package/dist/types/stencil-public-runtime.d.ts +1563 -0
  71. package/dist/types/types/autocomplete.d.ts +2 -0
  72. package/dist/types/types/button.d.ts +4 -0
  73. package/dist/types/types/form-rel.d.ts +1 -0
  74. package/dist/types/types/input-text-type.d.ts +1 -0
  75. package/dist/types/types/input-value-type.d.ts +1 -0
  76. package/dist/types/types/loading.d.ts +1 -0
  77. package/dist/types/types/typography.d.ts +4 -0
  78. package/dist/types/types/variant.d.ts +10 -0
  79. package/loader/cdn.js +3 -0
  80. package/loader/index.cjs.js +3 -0
  81. package/loader/index.d.ts +12 -0
  82. package/loader/index.es2017.js +3 -0
  83. package/loader/index.js +4 -0
  84. package/loader/package.json +10 -0
  85. package/package.json +45 -0
  86. package/readme.md +24 -0
  87. package/src/components/mds-accordion-timer/mds-accordion-timer.css +3 -0
  88. package/src/components/mds-accordion-timer/mds-accordion-timer.tsx +159 -0
  89. package/src/components/mds-accordion-timer/readme.md +24 -0
  90. package/src/components/mds-accordion-timer/test/mds-accordion-timer.e2e.ts +11 -0
  91. package/src/components/mds-accordion-timer/test/mds-accordion-timer.spec.tsx +18 -0
  92. package/src/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +32 -0
  93. package/src/components.d.ts +49 -0
  94. package/src/dictionary/autocomplete.ts +62 -0
  95. package/src/dictionary/button.ts +35 -0
  96. package/src/dictionary/color.ts +24 -0
  97. package/src/dictionary/icon.ts +5 -0
  98. package/src/dictionary/input-text-type.ts +17 -0
  99. package/src/dictionary/loading.ts +9 -0
  100. package/src/dictionary/typography.ts +46 -0
  101. package/src/dictionary/variant.ts +81 -0
  102. package/src/fixtures/cities.ts +116 -0
  103. package/src/interface/input-value.ts +5 -0
  104. package/src/types/autocomplete.ts +69 -0
  105. package/src/types/button.ts +24 -0
  106. package/src/types/form-rel.ts +11 -0
  107. package/src/types/input-text-type.ts +11 -0
  108. package/src/types/input-value-type.ts +5 -0
  109. package/src/types/loading.ts +3 -0
  110. package/src/types/typography.ts +35 -0
  111. package/src/types/variant.ts +72 -0
  112. package/www/build/index.esm.js +0 -0
  113. package/www/build/mds-accordion-timer.esm.js +1 -0
  114. package/www/build/mds-accordion-timer.js +130 -0
  115. package/www/build/p-104355eb.system.entry.js +1 -0
  116. package/www/build/p-2c75936b.entry.js +1 -0
  117. package/www/build/p-50ea2036.system.js +1 -0
  118. package/www/build/p-74539cca.system.js +1 -0
  119. package/www/build/p-a652c8b3.system.js +1 -0
  120. package/www/build/p-ac3fdd27.js +1 -0
  121. package/www/host.config.json +15 -0
@@ -0,0 +1,110 @@
1
+ const citiesDictionary = [
2
+ 'Agrigento',
3
+ 'Alessandria',
4
+ 'Ancona',
5
+ 'Aosta',
6
+ 'Arezzo',
7
+ 'Ascoli Piceno',
8
+ 'Asti',
9
+ 'Avellino',
10
+ 'Bari',
11
+ 'Barletta-Andria-Trani',
12
+ 'Belluno',
13
+ 'Benevento',
14
+ 'Bergamo',
15
+ 'Biella',
16
+ 'Bologna',
17
+ 'Bolzano',
18
+ 'Brescia',
19
+ 'Brindisi',
20
+ 'Cagliari',
21
+ 'Caltanissetta',
22
+ 'Campobasso',
23
+ 'Caserta',
24
+ 'Catania',
25
+ 'Catanzaro',
26
+ 'Chieti',
27
+ 'Como',
28
+ 'Cosenza',
29
+ 'Cremona',
30
+ 'Crotone',
31
+ 'Cuneo',
32
+ 'Enna',
33
+ 'Fermo',
34
+ 'Ferrara',
35
+ 'Firenze',
36
+ 'Foggia',
37
+ 'Forlì-Cesena',
38
+ 'Frosinone',
39
+ 'Genova',
40
+ 'Gorizia',
41
+ 'Grosseto',
42
+ 'Imperia',
43
+ 'Isernia',
44
+ 'La Spezia',
45
+ 'L\'Aquila',
46
+ 'Latina',
47
+ 'Lecce',
48
+ 'Lecco',
49
+ 'Livorno',
50
+ 'Lodi',
51
+ 'Lucca',
52
+ 'Macerata',
53
+ 'Mantova',
54
+ 'Massa-Carrara',
55
+ 'Matera',
56
+ 'Messina',
57
+ 'Milano',
58
+ 'Modena',
59
+ 'Monza e della Brianza',
60
+ 'Napoli',
61
+ 'Novara',
62
+ 'Nuoro',
63
+ 'Oristano',
64
+ 'Padova',
65
+ 'Palermo',
66
+ 'Parma',
67
+ 'Pavia',
68
+ 'Perugia',
69
+ 'Pesaro e Urbino',
70
+ 'Pescara',
71
+ 'Piacenza',
72
+ 'Pisa',
73
+ 'Pistoia',
74
+ 'Pordenone',
75
+ 'Potenza',
76
+ 'Prato',
77
+ 'Ragusa',
78
+ 'Ravenna',
79
+ 'Reggio Calabria',
80
+ 'Reggio Emilia',
81
+ 'Rieti',
82
+ 'Rimini',
83
+ 'Roma',
84
+ 'Rovigo',
85
+ 'Salerno',
86
+ 'Sassari',
87
+ 'Savona',
88
+ 'Siena',
89
+ 'Siracusa',
90
+ 'Sondrio',
91
+ 'Sud Sardegna',
92
+ 'Taranto',
93
+ 'Teramo',
94
+ 'Terni',
95
+ 'Torino',
96
+ 'Trapani',
97
+ 'Trento',
98
+ 'Treviso',
99
+ 'Trieste',
100
+ 'Udine',
101
+ 'Varese',
102
+ 'Venezia',
103
+ 'Verbano-Cusio-Ossola',
104
+ 'Vercelli',
105
+ 'Verona',
106
+ 'Vibo Valentia',
107
+ 'Vicenza',
108
+ 'Viterbo',
109
+ ];
110
+ export { citiesDictionary, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,45 @@
1
+ /* MdsAccordionTimer custom elements bundle */
2
+
3
+ import type { Components, JSX } from "../types/components";
4
+
5
+ interface MdsAccordionTimer extends Components.MdsAccordionTimer, HTMLElement {}
6
+ export const MdsAccordionTimer: {
7
+ prototype: MdsAccordionTimer;
8
+ new (): MdsAccordionTimer;
9
+ };
10
+
11
+ /**
12
+ * Utility to define all custom elements within this package using the tag name provided in the component's source.
13
+ * When defining each custom element, it will also check it's safe to define by:
14
+ *
15
+ * 1. Ensuring the "customElements" registry is available in the global context (window).
16
+ * 2. The component tag name is not already defined.
17
+ *
18
+ * Use the standard [customElements.define()](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define)
19
+ * method instead to define custom elements individually, or to provide a different tag name.
20
+ */
21
+ export declare const defineCustomElements: (opts?: any) => void;
22
+
23
+ /**
24
+ * Used to manually set the base path where assets can be found.
25
+ * If the script is used as "module", it's recommended to use "import.meta.url",
26
+ * such as "setAssetPath(import.meta.url)". Other options include
27
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
28
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
29
+ * But do note that this configuration depends on how your script is bundled, or lack of
30
+ * bunding, and where your assets can be loaded from. Additionally custom bundling
31
+ * will have to ensure the static assets are copied to its build directory.
32
+ */
33
+ export declare const setAssetPath: (path: string) => void;
34
+
35
+ export interface SetPlatformOptions {
36
+ raf?: (c: FrameRequestCallback) => number;
37
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
38
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
39
+ ce?: (eventName: string, opts?: any) => CustomEvent;
40
+ }
41
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
42
+
43
+ export type { Components, JSX };
44
+
45
+ export * from '../types/components';
@@ -0,0 +1,141 @@
1
+ import { createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
2
+ export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
3
+
4
+ const mdsAccordionTimerCss = ":host{display:block}";
5
+
6
+ let MdsAccordionTimer$1 = class extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
11
+ this.itemActivated = createEvent(this, "itemActivated", 7);
12
+ this.time = 0;
13
+ /**
14
+ * Sets the duration of the single accordion item
15
+ */
16
+ this.duration = 5000;
17
+ this.clearIntervals = () => {
18
+ window.clearInterval(this.timer);
19
+ window.clearInterval(this.timeChecker);
20
+ this.timer = null;
21
+ this.timeChecker = null;
22
+ };
23
+ this.progress = () => {
24
+ return Math.abs(this.remainingTime() / this.duration - 1);
25
+ };
26
+ this.addTimeListener = () => {
27
+ this.timeChecker = window.setInterval(() => {
28
+ const progress = this.progress();
29
+ if (this.activeItem !== undefined) {
30
+ this.activeItem.progress = progress;
31
+ }
32
+ if (progress === 1) {
33
+ this.activeItem.progress = 0;
34
+ this.startNext();
35
+ }
36
+ }, 100);
37
+ };
38
+ this.beginningTime = () => {
39
+ this.timeStarted = (new Date()).getTime();
40
+ return this.timeStarted;
41
+ };
42
+ this.remainingTime = () => {
43
+ const remainingTime = this.activeItemDurationTime - ((new Date()).getTime() - this.timeStarted);
44
+ return remainingTime >= 0 ? remainingTime : 0;
45
+ };
46
+ this.setActiveItem = (uuid) => {
47
+ this.children.forEach((item, key) => {
48
+ if (key === uuid) {
49
+ item.active = true;
50
+ this.activeItem = item;
51
+ this.itemActivated.emit(uuid);
52
+ }
53
+ else {
54
+ item.active = false;
55
+ }
56
+ });
57
+ };
58
+ this.startNext = () => {
59
+ const nextUuid = this.activeItem.uuid + 1 > this.children.length - 1 ? 0 : this.activeItem.uuid + 1;
60
+ this.setActiveItem(nextUuid);
61
+ this.startTimer();
62
+ };
63
+ this.startTimer = () => {
64
+ this.clearIntervals();
65
+ this.time = this.beginningTime();
66
+ this.activeItemDurationTime = this.duration;
67
+ this.addTimeListener();
68
+ };
69
+ this.playTimer = () => {
70
+ this.beginningTime();
71
+ this.addTimeListener();
72
+ };
73
+ this.pauseTimer = () => {
74
+ this.clearIntervals();
75
+ this.activeItemDurationTime = this.remainingTime();
76
+ };
77
+ this.stopTimer = () => {
78
+ this.clearIntervals();
79
+ this.time = null;
80
+ };
81
+ }
82
+ componentDidLoad() {
83
+ this.children = this.element.querySelectorAll('mds-accordion-timer-item');
84
+ this.children.forEach((item, key) => {
85
+ item.uuid = key;
86
+ if (item.active) {
87
+ this.activeItem = item;
88
+ }
89
+ });
90
+ }
91
+ connectedCallback() {
92
+ this.startTimer();
93
+ }
94
+ disconnectedCallback() {
95
+ this.stopTimer();
96
+ this.clearIntervals();
97
+ }
98
+ onClickActive(event) {
99
+ if (event.detail === this.activeItem.description) {
100
+ return;
101
+ }
102
+ let selectedUuid;
103
+ this.children.forEach(item => {
104
+ item.progress = 0;
105
+ if (item.description === event.detail) {
106
+ selectedUuid = item.uuid;
107
+ }
108
+ });
109
+ this.setActiveItem(selectedUuid);
110
+ this.startTimer();
111
+ this.pauseTimer();
112
+ }
113
+ onMouseEnterActive() {
114
+ this.pauseTimer();
115
+ }
116
+ onMouseLeaveActive() {
117
+ if (this.timeChecker === null) {
118
+ this.playTimer();
119
+ }
120
+ }
121
+ render() {
122
+ return (h(Host, null, h("slot", null)));
123
+ }
124
+ get element() { return this; }
125
+ static get style() { return mdsAccordionTimerCss; }
126
+ };
127
+
128
+ const MdsAccordionTimer = /*@__PURE__*/proxyCustomElement(MdsAccordionTimer$1, [1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"clickActive","onClickActive"],[0,"mouseEnterActive","onMouseEnterActive"],[0,"mouseLeaveActive","onMouseLeaveActive"]]]);
129
+ const defineCustomElements = (opts) => {
130
+ if (typeof customElements !== 'undefined') {
131
+ [
132
+ MdsAccordionTimer
133
+ ].forEach(cmp => {
134
+ if (!customElements.get(cmp.is)) {
135
+ customElements.define(cmp.is, cmp, opts);
136
+ }
137
+ });
138
+ }
139
+ };
140
+
141
+ export { MdsAccordionTimer, defineCustomElements };