@maggioli-design-system/mds-accordion-timer 3.0.0 → 3.2.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 (73) hide show
  1. package/dist/cjs/{index-d958b818.js → index-b99075ba.js} +0 -8
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/mds-accordion-timer.cjs.entry.js +24 -24
  4. package/dist/cjs/mds-accordion-timer.cjs.js +2 -2
  5. package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +31 -31
  6. package/dist/collection/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +1 -1
  7. package/dist/components/mds-accordion-timer.js +24 -24
  8. package/dist/esm/{index-22b73a3a.js → index-bd689d6a.js} +0 -8
  9. package/dist/esm/loader.js +3 -3
  10. package/dist/esm/mds-accordion-timer.entry.js +24 -24
  11. package/dist/esm/mds-accordion-timer.js +3 -3
  12. package/dist/esm-es5/{index-22b73a3a.js → index-bd689d6a.js} +1 -1
  13. package/dist/esm-es5/loader.js +1 -1
  14. package/dist/esm-es5/mds-accordion-timer.entry.js +1 -1
  15. package/dist/esm-es5/mds-accordion-timer.js +1 -1
  16. package/dist/mds-accordion-timer/mds-accordion-timer.esm.js +1 -1
  17. package/dist/mds-accordion-timer/mds-accordion-timer.js +1 -1
  18. package/dist/mds-accordion-timer/p-2bfbd758.system.entry.js +1 -0
  19. package/dist/mds-accordion-timer/p-4620ac30.system.js +1 -0
  20. package/dist/mds-accordion-timer/{p-3face4e0.system.js → p-5029b85d.system.js} +2 -2
  21. package/dist/mds-accordion-timer/p-8d875f1d.entry.js +1 -0
  22. package/dist/mds-accordion-timer/p-a7b74010.js +2 -0
  23. package/dist/stats.json +66 -66
  24. package/dist/types/components/mds-accordion-timer/mds-accordion-timer.d.ts +6 -7
  25. package/dist/types/components.d.ts +1 -1
  26. package/package.json +2 -2
  27. package/readme.md +3 -3
  28. package/src/components/mds-accordion-timer/mds-accordion-timer.tsx +29 -29
  29. package/src/components/mds-accordion-timer/readme.md +3 -3
  30. package/src/components/mds-accordion-timer/test/mds-accordion-timer.stories.tsx +1 -1
  31. package/src/components.d.ts +1 -1
  32. package/www/build/mds-accordion-timer.esm.js +1 -1
  33. package/www/build/mds-accordion-timer.js +1 -1
  34. package/www/build/p-2bfbd758.system.entry.js +1 -0
  35. package/www/build/p-4620ac30.system.js +1 -0
  36. package/www/build/{p-3face4e0.system.js → p-5029b85d.system.js} +2 -2
  37. package/www/build/p-8d875f1d.entry.js +1 -0
  38. package/www/build/p-a7b74010.js +2 -0
  39. package/dist/mds-accordion-timer/p-118bf4e5.system.entry.js +0 -1
  40. package/dist/mds-accordion-timer/p-9084d19f.js +0 -2
  41. package/dist/mds-accordion-timer/p-c6d75694.system.js +0 -1
  42. package/dist/mds-accordion-timer/p-f44da2be.entry.js +0 -1
  43. package/www/build/p-118bf4e5.system.entry.js +0 -1
  44. package/www/build/p-9084d19f.js +0 -2
  45. package/www/build/p-c6d75694.system.js +0 -1
  46. package/www/build/p-f44da2be.entry.js +0 -1
  47. /package/dist/collection/{types → type}/autocomplete.js +0 -0
  48. /package/dist/collection/{types → type}/button.js +0 -0
  49. /package/dist/collection/{types → type}/floating-ui.js +0 -0
  50. /package/dist/collection/{types → type}/form-rel.js +0 -0
  51. /package/dist/collection/{types → type}/input-text-type.js +0 -0
  52. /package/dist/collection/{types → type}/input-value-type.js +0 -0
  53. /package/dist/collection/{types → type}/loading.js +0 -0
  54. /package/dist/collection/{types → type}/typography.js +0 -0
  55. /package/dist/collection/{types → type}/variant.js +0 -0
  56. /package/dist/types/{types → type}/autocomplete.d.ts +0 -0
  57. /package/dist/types/{types → type}/button.d.ts +0 -0
  58. /package/dist/types/{types → type}/floating-ui.d.ts +0 -0
  59. /package/dist/types/{types → type}/form-rel.d.ts +0 -0
  60. /package/dist/types/{types → type}/input-text-type.d.ts +0 -0
  61. /package/dist/types/{types → type}/input-value-type.d.ts +0 -0
  62. /package/dist/types/{types → type}/loading.d.ts +0 -0
  63. /package/dist/types/{types → type}/typography.d.ts +0 -0
  64. /package/dist/types/{types → type}/variant.d.ts +0 -0
  65. /package/src/{types → type}/autocomplete.ts +0 -0
  66. /package/src/{types → type}/button.ts +0 -0
  67. /package/src/{types → type}/floating-ui.ts +0 -0
  68. /package/src/{types → type}/form-rel.ts +0 -0
  69. /package/src/{types → type}/input-text-type.ts +0 -0
  70. /package/src/{types → type}/input-value-type.ts +0 -0
  71. /package/src/{types → type}/loading.ts +0 -0
  72. /package/src/{types → type}/typography.ts +0 -0
  73. /package/src/{types → type}/variant.ts +0 -0
package/dist/stats.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-03-02T09:55:44",
2
+ "timestamp": "2023-03-14T14:54:29",
3
3
  "compiler": {
4
4
  "name": "node",
5
5
  "version": "18.3.0"
@@ -30,15 +30,15 @@
30
30
  "./dist/collection/dictionary/variant.js",
31
31
  "./dist/collection/fixtures/cities.js",
32
32
  "./dist/collection/interface/input-value.js",
33
- "./dist/collection/types/autocomplete.js",
34
- "./dist/collection/types/button.js",
35
- "./dist/collection/types/floating-ui.js",
36
- "./dist/collection/types/form-rel.js",
37
- "./dist/collection/types/input-text-type.js",
38
- "./dist/collection/types/input-value-type.js",
39
- "./dist/collection/types/loading.js",
40
- "./dist/collection/types/typography.js",
41
- "./dist/collection/types/variant.js"
33
+ "./dist/collection/type/autocomplete.js",
34
+ "./dist/collection/type/button.js",
35
+ "./dist/collection/type/floating-ui.js",
36
+ "./dist/collection/type/form-rel.js",
37
+ "./dist/collection/type/input-text-type.js",
38
+ "./dist/collection/type/input-value-type.js",
39
+ "./dist/collection/type/loading.js",
40
+ "./dist/collection/type/typography.js",
41
+ "./dist/collection/type/variant.js"
42
42
  ]
43
43
  },
44
44
  {
@@ -55,17 +55,17 @@
55
55
  "name": "dist-lazy",
56
56
  "files": 35,
57
57
  "generatedFiles": [
58
- "./dist/cjs/index-d958b818.js",
58
+ "./dist/cjs/index-b99075ba.js",
59
59
  "./dist/cjs/index.cjs.js",
60
60
  "./dist/cjs/loader.cjs.js",
61
61
  "./dist/cjs/mds-accordion-timer.cjs.entry.js",
62
62
  "./dist/cjs/mds-accordion-timer.cjs.js",
63
- "./dist/esm-es5/index-22b73a3a.js",
63
+ "./dist/esm-es5/index-bd689d6a.js",
64
64
  "./dist/esm-es5/index.js",
65
65
  "./dist/esm-es5/loader.js",
66
66
  "./dist/esm-es5/mds-accordion-timer.entry.js",
67
67
  "./dist/esm-es5/mds-accordion-timer.js",
68
- "./dist/esm/index-22b73a3a.js",
68
+ "./dist/esm/index-bd689d6a.js",
69
69
  "./dist/esm/index.js",
70
70
  "./dist/esm/loader.js",
71
71
  "./dist/esm/mds-accordion-timer.entry.js",
@@ -75,21 +75,21 @@
75
75
  "./dist/mds-accordion-timer/index.esm.js",
76
76
  "./dist/mds-accordion-timer/mds-accordion-timer.esm.js",
77
77
  "./dist/mds-accordion-timer/mds-accordion-timer.js",
78
- "./dist/mds-accordion-timer/p-118bf4e5.system.entry.js",
79
- "./dist/mds-accordion-timer/p-3face4e0.system.js",
78
+ "./dist/mds-accordion-timer/p-2bfbd758.system.entry.js",
79
+ "./dist/mds-accordion-timer/p-4620ac30.system.js",
80
+ "./dist/mds-accordion-timer/p-5029b85d.system.js",
80
81
  "./dist/mds-accordion-timer/p-50ea2036.system.js",
81
- "./dist/mds-accordion-timer/p-9084d19f.js",
82
- "./dist/mds-accordion-timer/p-c6d75694.system.js",
83
- "./dist/mds-accordion-timer/p-f44da2be.entry.js",
82
+ "./dist/mds-accordion-timer/p-8d875f1d.entry.js",
83
+ "./dist/mds-accordion-timer/p-a7b74010.js",
84
84
  "./www/build/index.esm.js",
85
85
  "./www/build/mds-accordion-timer.esm.js",
86
86
  "./www/build/mds-accordion-timer.js",
87
- "./www/build/p-118bf4e5.system.entry.js",
88
- "./www/build/p-3face4e0.system.js",
87
+ "./www/build/p-2bfbd758.system.entry.js",
88
+ "./www/build/p-4620ac30.system.js",
89
+ "./www/build/p-5029b85d.system.js",
89
90
  "./www/build/p-50ea2036.system.js",
90
- "./www/build/p-9084d19f.js",
91
- "./www/build/p-c6d75694.system.js",
92
- "./www/build/p-f44da2be.entry.js"
91
+ "./www/build/p-8d875f1d.entry.js",
92
+ "./www/build/p-a7b74010.js"
93
93
  ]
94
94
  },
95
95
  {
@@ -122,12 +122,12 @@
122
122
  "components": [
123
123
  "mds-accordion-timer"
124
124
  ],
125
- "bundleId": "p-f44da2be",
126
- "fileName": "p-f44da2be.entry.js",
125
+ "bundleId": "p-8d875f1d",
126
+ "fileName": "p-8d875f1d.entry.js",
127
127
  "imports": [
128
- "p-9084d19f.js"
128
+ "p-a7b74010.js"
129
129
  ],
130
- "originalByteSize": 3432
130
+ "originalByteSize": 3512
131
131
  }
132
132
  ],
133
133
  "esm": [
@@ -139,9 +139,9 @@
139
139
  "bundleId": "mds-accordion-timer",
140
140
  "fileName": "mds-accordion-timer.entry.js",
141
141
  "imports": [
142
- "index-22b73a3a.js"
142
+ "index-bd689d6a.js"
143
143
  ],
144
- "originalByteSize": 3436
144
+ "originalByteSize": 3516
145
145
  }
146
146
  ],
147
147
  "es5": [
@@ -153,9 +153,9 @@
153
153
  "bundleId": "mds-accordion-timer",
154
154
  "fileName": "mds-accordion-timer.entry.js",
155
155
  "imports": [
156
- "index-22b73a3a.js"
156
+ "index-bd689d6a.js"
157
157
  ],
158
- "originalByteSize": 3436
158
+ "originalByteSize": 3516
159
159
  }
160
160
  ],
161
161
  "system": [
@@ -164,12 +164,12 @@
164
164
  "components": [
165
165
  "mds-accordion-timer"
166
166
  ],
167
- "bundleId": "p-118bf4e5.system",
168
- "fileName": "p-118bf4e5.system.entry.js",
167
+ "bundleId": "p-2bfbd758.system",
168
+ "fileName": "p-2bfbd758.system.entry.js",
169
169
  "imports": [
170
- "p-3face4e0.system.js"
170
+ "p-5029b85d.system.js"
171
171
  ],
172
- "originalByteSize": 4378
172
+ "originalByteSize": 4458
173
173
  }
174
174
  ],
175
175
  "commonjs": [
@@ -181,9 +181,9 @@
181
181
  "bundleId": "mds-accordion-timer.cjs",
182
182
  "fileName": "mds-accordion-timer.cjs.entry.js",
183
183
  "imports": [
184
- "index-d958b818.js"
184
+ "index-b99075ba.js"
185
185
  ],
186
- "originalByteSize": 3483
186
+ "originalByteSize": 3563
187
187
  }
188
188
  ]
189
189
  },
@@ -207,8 +207,8 @@
207
207
  "excludeFromCollection": false,
208
208
  "events": [
209
209
  {
210
- "name": "itemActivated",
211
- "method": "itemActivated",
210
+ "name": "mdsAccordionTimerChange",
211
+ "method": "changeEvent",
212
212
  "bubbles": true,
213
213
  "cancelable": true,
214
214
  "composed": true,
@@ -217,8 +217,8 @@
217
217
  "text": "Emits when the accordion changes it's item"
218
218
  },
219
219
  "complexType": {
220
- "original": "number",
221
- "resolved": "number",
220
+ "original": "void",
221
+ "resolved": "void",
222
222
  "references": {}
223
223
  },
224
224
  "internal": false
@@ -229,20 +229,20 @@
229
229
  "legacyContext": [],
230
230
  "listeners": [
231
231
  {
232
- "name": "activeClicked",
232
+ "name": "mdsAccordionTimerItemClickSelect",
233
233
  "method": "onClickActive",
234
234
  "capture": false,
235
235
  "passive": false
236
236
  },
237
237
  {
238
- "name": "activeMouseEnter",
239
- "method": "onMouseEnterActive",
238
+ "name": "mdsAccordionTimerItemMouseEnterSelect",
239
+ "method": "onMouseEnterSelect",
240
240
  "capture": false,
241
241
  "passive": false
242
242
  },
243
243
  {
244
- "name": "activeMouseLeave",
245
- "method": "onMouseLeaveActive",
244
+ "name": "mdsAccordionTimerItemMouseLeaveSelect",
245
+ "method": "onMouseLeaveSelect",
246
246
  "capture": false,
247
247
  "passive": false
248
248
  }
@@ -321,28 +321,28 @@
321
321
  "methods": [],
322
322
  "listeners": [
323
323
  {
324
- "name": "activeClicked",
324
+ "name": "mdsAccordionTimerItemClickSelect",
325
325
  "method": "onClickActive",
326
326
  "capture": false,
327
327
  "passive": false
328
328
  },
329
329
  {
330
- "name": "activeMouseEnter",
331
- "method": "onMouseEnterActive",
330
+ "name": "mdsAccordionTimerItemMouseEnterSelect",
331
+ "method": "onMouseEnterSelect",
332
332
  "capture": false,
333
333
  "passive": false
334
334
  },
335
335
  {
336
- "name": "activeMouseLeave",
337
- "method": "onMouseLeaveActive",
336
+ "name": "mdsAccordionTimerItemMouseLeaveSelect",
337
+ "method": "onMouseLeaveSelect",
338
338
  "capture": false,
339
339
  "passive": false
340
340
  }
341
341
  ],
342
342
  "events": [
343
343
  {
344
- "name": "itemActivated",
345
- "method": "itemActivated",
344
+ "name": "mdsAccordionTimerChange",
345
+ "method": "changeEvent",
346
346
  "bubbles": true,
347
347
  "cancelable": true,
348
348
  "composed": true,
@@ -351,8 +351,8 @@
351
351
  "text": "Emits when the accordion changes it's item"
352
352
  },
353
353
  "complexType": {
354
- "original": "number",
355
- "resolved": "number",
354
+ "original": "void",
355
+ "resolved": "void",
356
356
  "references": {}
357
357
  },
358
358
  "internal": false
@@ -395,7 +395,7 @@
395
395
  "hasComponentWillRenderFn": false,
396
396
  "hasComponentDidRenderFn": false,
397
397
  "hasComponentDidUnloadFn": false,
398
- "hasConnectedCallbackFn": true,
398
+ "hasConnectedCallbackFn": false,
399
399
  "hasDisconnectedCallbackFn": true,
400
400
  "hasElement": false,
401
401
  "hasEvent": true,
@@ -450,7 +450,7 @@
450
450
  ],
451
451
  "componentGraph": {
452
452
  "sc-mds-accordion-timer": [
453
- "p-9084d19f.js"
453
+ "p-a7b74010.js"
454
454
  ]
455
455
  },
456
456
  "sourceGraph": {
@@ -472,15 +472,15 @@
472
472
  "./src/dictionary/variant.ts": [],
473
473
  "./src/fixtures/cities.ts": [],
474
474
  "./src/interface/input-value.ts": [],
475
- "./src/types/autocomplete.ts": [],
476
- "./src/types/button.ts": [],
477
- "./src/types/floating-ui.ts": [],
478
- "./src/types/form-rel.ts": [],
479
- "./src/types/input-text-type.ts": [],
480
- "./src/types/input-value-type.ts": [],
481
- "./src/types/loading.ts": [],
482
- "./src/types/typography.ts": [],
483
- "./src/types/variant.ts": []
475
+ "./src/type/autocomplete.ts": [],
476
+ "./src/type/button.ts": [],
477
+ "./src/type/floating-ui.ts": [],
478
+ "./src/type/form-rel.ts": [],
479
+ "./src/type/input-text-type.ts": [],
480
+ "./src/type/input-value-type.ts": [],
481
+ "./src/type/loading.ts": [],
482
+ "./src/type/typography.ts": [],
483
+ "./src/type/variant.ts": []
484
484
  },
485
485
  "collections": []
486
486
  }
@@ -3,9 +3,9 @@ export declare class MdsAccordionTimer {
3
3
  private timer;
4
4
  private timeChecker;
5
5
  private timeStarted;
6
- private activeItemDurationTime;
6
+ private selectedItemDurationTime;
7
7
  private children;
8
- private activeItem;
8
+ private selectedItem;
9
9
  private element;
10
10
  time: number;
11
11
  /**
@@ -15,23 +15,22 @@ export declare class MdsAccordionTimer {
15
15
  /**
16
16
  * Emits when the accordion changes it's item
17
17
  */
18
- itemActivated: EventEmitter<number>;
18
+ changeEvent: EventEmitter<void>;
19
19
  componentDidLoad(): void;
20
20
  private clearIntervals;
21
- connectedCallback(): void;
22
21
  disconnectedCallback(): void;
23
22
  private progress;
24
23
  private addTimeListener;
25
24
  private beginningTime;
26
25
  private remainingTime;
27
- private setActiveItem;
26
+ private setSelectedItem;
28
27
  private startNext;
29
28
  private startTimer;
30
29
  private playTimer;
31
30
  private pauseTimer;
32
31
  private stopTimer;
33
32
  onClickActive(event: CustomEvent<string>): void;
34
- onMouseEnterActive(): void;
35
- onMouseLeaveActive(): void;
33
+ onMouseEnterSelect(): void;
34
+ onMouseLeaveSelect(): void;
36
35
  render(): any;
37
36
  }
@@ -37,7 +37,7 @@ declare namespace LocalJSX {
37
37
  /**
38
38
  * Emits when the accordion changes it's item
39
39
  */
40
- "onItemActivated"?: (event: MdsAccordionTimerCustomEvent<number>) => void;
40
+ "onMdsAccordionTimerChange"?: (event: MdsAccordionTimerCustomEvent<void>) => void;
41
41
  }
42
42
  interface IntrinsicElements {
43
43
  "mds-accordion-timer": MdsAccordionTimer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-design-system/mds-accordion-timer",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
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
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "test": "stencil test --spec --e2e"
24
24
  },
25
25
  "dependencies": {
26
- "@maggioli-design-system/mds-accordion-timer-item": "^3.0.0",
26
+ "@maggioli-design-system/mds-accordion-timer-item": "^3.1.0",
27
27
  "@maggioli-design-system/styles": "^11.2.1",
28
28
  "@stencil/core": "^2.22.2"
29
29
  },
package/readme.md CHANGED
@@ -14,9 +14,9 @@
14
14
 
15
15
  ## Events
16
16
 
17
- | Event | Description | Type |
18
- | --------------- | ------------------------------------------ | --------------------- |
19
- | `itemActivated` | Emits when the accordion changes it's item | `CustomEvent<number>` |
17
+ | Event | Description | Type |
18
+ | ------------------------- | ------------------------------------------ | ------------------- |
19
+ | `mdsAccordionTimerChange` | Emits when the accordion changes it's item | `CustomEvent<void>` |
20
20
 
21
21
 
22
22
  ----------------------------------------------
@@ -10,9 +10,9 @@ export class MdsAccordionTimer {
10
10
  private timer: number
11
11
  private timeChecker: number
12
12
  private timeStarted: number
13
- private activeItemDurationTime: number
13
+ private selectedItemDurationTime: number
14
14
  private children: NodeListOf<HTMLMdsAccordionTimerItemElement>
15
- private activeItem: HTMLMdsAccordionTimerItemElement
15
+ private selectedItem: HTMLMdsAccordionTimerItemElement
16
16
  @Element() private element: HTMLMdsAccordionTimerElement
17
17
 
18
18
  @State() time = 0
@@ -25,16 +25,20 @@ export class MdsAccordionTimer {
25
25
  /**
26
26
  * Emits when the accordion changes it's item
27
27
  */
28
- @Event() itemActivated: EventEmitter<number>
28
+ @Event({ eventName: 'mdsAccordionTimerChange' }) changeEvent: EventEmitter<void>
29
29
 
30
30
  componentDidLoad (): void {
31
31
  this.children = this.element.querySelectorAll<HTMLMdsAccordionTimerItemElement>('mds-accordion-timer-item')
32
32
  this.children.forEach((item, key) => {
33
33
  item.uuid = key
34
- if (item.active) {
35
- this.activeItem = item
34
+ if (item.selected) {
35
+ this.selectedItem = item
36
36
  }
37
37
  })
38
+
39
+ if (this.selectedItem !== undefined) {
40
+ this.startTimer()
41
+ }
38
42
  }
39
43
 
40
44
  private clearIntervals = (): void => {
@@ -44,10 +48,6 @@ export class MdsAccordionTimer {
44
48
  this.timeChecker = null
45
49
  }
46
50
 
47
- connectedCallback (): void {
48
- this.startTimer()
49
- }
50
-
51
51
  disconnectedCallback (): void {
52
52
  this.stopTimer()
53
53
  this.clearIntervals()
@@ -60,11 +60,11 @@ export class MdsAccordionTimer {
60
60
  private addTimeListener = (): void => {
61
61
  this.timeChecker = window.setInterval(() => {
62
62
  const progress = this.progress()
63
- if (this.activeItem !== undefined) {
64
- this.activeItem.progress = progress
63
+ if (this.selectedItem !== undefined) {
64
+ this.selectedItem.progress = progress
65
65
  }
66
66
  if (progress === 1) {
67
- this.activeItem.progress = 0
67
+ this.selectedItem.progress = 0
68
68
  this.startNext()
69
69
  }
70
70
  }, 100)
@@ -76,32 +76,32 @@ export class MdsAccordionTimer {
76
76
  }
77
77
 
78
78
  private remainingTime = (): number => {
79
- const remainingTime:number = this.activeItemDurationTime - ( (new Date()).getTime() - this.timeStarted )
79
+ const remainingTime:number = this.selectedItemDurationTime - ( (new Date()).getTime() - this.timeStarted )
80
80
  return remainingTime >= 0 ? remainingTime : 0
81
81
  }
82
82
 
83
- private setActiveItem = (uuid: number): void => {
83
+ private setSelectedItem = (uuid: number): void => {
84
84
  this.children.forEach((item, key) => {
85
85
  if (key === uuid) {
86
- item.active = true
87
- this.activeItem = item
88
- this.itemActivated.emit(uuid)
86
+ item.selected = true
87
+ this.selectedItem = item
88
+ this.changeEvent.emit()
89
89
  } else {
90
- item.active = false
90
+ item.selected = false
91
91
  }
92
92
  })
93
93
  }
94
94
 
95
95
  private startNext = (): void => {
96
- const nextUuid = this.activeItem.uuid + 1 > this.children.length - 1 ? 0 : this.activeItem.uuid + 1
97
- this.setActiveItem(nextUuid)
96
+ const nextUuid = this.selectedItem.uuid + 1 > this.children.length - 1 ? 0 : this.selectedItem.uuid + 1
97
+ this.setSelectedItem(nextUuid)
98
98
  this.startTimer()
99
99
  }
100
100
 
101
101
  private startTimer = (): void => {
102
102
  this.clearIntervals()
103
103
  this.time = this.beginningTime()
104
- this.activeItemDurationTime = this.duration
104
+ this.selectedItemDurationTime = this.duration
105
105
  this.addTimeListener()
106
106
  }
107
107
 
@@ -112,7 +112,7 @@ export class MdsAccordionTimer {
112
112
 
113
113
  private pauseTimer = (): void => {
114
114
  this.clearIntervals()
115
- this.activeItemDurationTime = this.remainingTime()
115
+ this.selectedItemDurationTime = this.remainingTime()
116
116
  }
117
117
 
118
118
  private stopTimer = (): void => {
@@ -120,9 +120,9 @@ export class MdsAccordionTimer {
120
120
  this.time = null
121
121
  }
122
122
 
123
- @Listen('activeClicked')
123
+ @Listen('mdsAccordionTimerItemClickSelect')
124
124
  onClickActive (event: CustomEvent<string>): void {
125
- if (event.detail === this.activeItem.description) {
125
+ if (this.selectedItem && event.detail === this.selectedItem.description) {
126
126
  return
127
127
  }
128
128
  let selectedUuid: number
@@ -132,18 +132,18 @@ export class MdsAccordionTimer {
132
132
  selectedUuid = item.uuid
133
133
  }
134
134
  })
135
- this.setActiveItem(selectedUuid)
135
+ this.setSelectedItem(selectedUuid)
136
136
  this.startTimer()
137
137
  this.pauseTimer()
138
138
  }
139
139
 
140
- @Listen('activeMouseEnter')
141
- onMouseEnterActive (): void {
140
+ @Listen('mdsAccordionTimerItemMouseEnterSelect')
141
+ onMouseEnterSelect (): void {
142
142
  this.pauseTimer()
143
143
  }
144
144
 
145
- @Listen('activeMouseLeave')
146
- onMouseLeaveActive (): void {
145
+ @Listen('mdsAccordionTimerItemMouseLeaveSelect')
146
+ onMouseLeaveSelect (): void {
147
147
  if (this.timeChecker === null) {
148
148
  this.playTimer()
149
149
  }
@@ -14,9 +14,9 @@
14
14
 
15
15
  ## Events
16
16
 
17
- | Event | Description | Type |
18
- | --------------- | ------------------------------------------ | --------------------- |
19
- | `itemActivated` | Emits when the accordion changes it's item | `CustomEvent<number>` |
17
+ | Event | Description | Type |
18
+ | ------------------------- | ------------------------------------------ | ------------------- |
19
+ | `mdsAccordionTimerChange` | Emits when the accordion changes it's item | `CustomEvent<void>` |
20
20
 
21
21
 
22
22
  ----------------------------------------------
@@ -14,7 +14,7 @@ export default {
14
14
  const Template = args =>
15
15
  <div>
16
16
  <mds-accordion-timer {...args}>
17
- <mds-accordion-timer-item active description="Blipbug">
17
+ <mds-accordion-timer-item description="Blipbug">
18
18
  <mds-text>Blipbug presenta delle fattezze riconducibili agli insetti nello stadio pre-crisalide. Il suo corpo si sviluppa in lunghezza, ed è formato principalmente da tre parti: la sua grande testa, il suo collo (molto simile ad un collare), e il corpo vero e proprio. La prima di queste è suddivisa in una parte color crema e una parte color denim; dello stesso colore sono le appenidici a forma di "V" che si trovano sopra e ai lati della testa. I suoi occhi sono enormi e grigi, ed hanno delle sottilissime sopracciglia sopra di essi. Il suo "collare", anch'esso color denim, presenta delle "setole" giallo sabbia, con le quali percepisce i segnali esterni: stesso colore si presenta nel segmento centrale della sua parte inferiore, dove sono presenti un primo paio di zampe crema. Il segmento superiore del corpo è bianco e ospita delle zampe anteriori color crema, ed infine, la parte finale, o la "coda", è color denim e finisce con un'appendice a "V" un po' piú grossa.</mds-text>
19
19
  </mds-accordion-timer-item>
20
20
  <mds-accordion-timer-item description="Drednaw">
@@ -37,7 +37,7 @@ declare namespace LocalJSX {
37
37
  /**
38
38
  * Emits when the accordion changes it's item
39
39
  */
40
- "onItemActivated"?: (event: MdsAccordionTimerCustomEvent<number>) => void;
40
+ "onMdsAccordionTimerChange"?: (event: MdsAccordionTimerCustomEvent<void>) => void;
41
41
  }
42
42
  interface IntrinsicElements {
43
43
  "mds-accordion-timer": MdsAccordionTimer;
@@ -1 +1 @@
1
- import{p as e,b as o}from"./p-9084d19f.js";export{s as setNonce}from"./p-9084d19f.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-f44da2be",[[1,"mds-accordion-timer",{duration:[2],time:[32]},[[0,"activeClicked","onClickActive"],[0,"activeMouseEnter","onMouseEnterActive"],[0,"activeMouseLeave","onMouseLeaveActive"]]]]]],e)));
1
+ import{p as e,b as o}from"./p-a7b74010.js";export{s as setNonce}from"./p-a7b74010.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-8d875f1d",[[1,"mds-accordion-timer",{duration:[2],time:[32]},[[0,"mdsAccordionTimerItemClickSelect","onClickActive"],[0,"mdsAccordionTimerItemMouseEnterSelect","onMouseEnterSelect"],[0,"mdsAccordionTimerItemMouseLeaveSelect","onMouseLeaveSelect"]]]]]],e)));
@@ -115,7 +115,7 @@ DOMTokenList
115
115
  var resourcesUrl = scriptElm ? scriptElm.getAttribute('data-resources-url') || scriptElm.src : '';
116
116
  var start = function() {
117
117
  // if src is not present then origin is "null", and new URL() throws TypeError: Failed to construct 'URL': Invalid base URL
118
- var url = new URL('./p-c6d75694.system.js', new URL(resourcesUrl, window.location.origin !== 'null' ? window.location.origin : undefined));
118
+ var url = new URL('./p-4620ac30.system.js', new URL(resourcesUrl, window.location.origin !== 'null' ? window.location.origin : undefined));
119
119
  System.import(url.href);
120
120
  };
121
121
 
@@ -0,0 +1 @@
1
+ System.register(["./p-5029b85d.system.js"],(function(e){"use strict";var t,i,n,r,s;return{setters:[function(e){t=e.r;i=e.c;n=e.h;r=e.H;s=e.g}],execute:function(){var c=":host{display:block}";var o=e("mds_accordion_timer",function(){function e(e){var n=this;t(this,e);this.changeEvent=i(this,"mdsAccordionTimerChange",7);this.clearIntervals=function(){window.clearInterval(n.timer);window.clearInterval(n.timeChecker);n.timer=null;n.timeChecker=null};this.progress=function(){return Math.abs(n.remainingTime()/n.duration-1)};this.addTimeListener=function(){n.timeChecker=window.setInterval((function(){var e=n.progress();if(n.selectedItem!==undefined){n.selectedItem.progress=e}if(e===1){n.selectedItem.progress=0;n.startNext()}}),100)};this.beginningTime=function(){n.timeStarted=(new Date).getTime();return n.timeStarted};this.remainingTime=function(){var e=n.selectedItemDurationTime-((new Date).getTime()-n.timeStarted);return e>=0?e:0};this.setSelectedItem=function(e){n.children.forEach((function(t,i){if(i===e){t.selected=true;n.selectedItem=t;n.changeEvent.emit()}else{t.selected=false}}))};this.startNext=function(){var e=n.selectedItem.uuid+1>n.children.length-1?0:n.selectedItem.uuid+1;n.setSelectedItem(e);n.startTimer()};this.startTimer=function(){n.clearIntervals();n.time=n.beginningTime();n.selectedItemDurationTime=n.duration;n.addTimeListener()};this.playTimer=function(){n.beginningTime();n.addTimeListener()};this.pauseTimer=function(){n.clearIntervals();n.selectedItemDurationTime=n.remainingTime()};this.stopTimer=function(){n.clearIntervals();n.time=null};this.time=0;this.duration=1e4}e.prototype.componentDidLoad=function(){var e=this;this.children=this.element.querySelectorAll("mds-accordion-timer-item");this.children.forEach((function(t,i){t.uuid=i;if(t.selected){e.selectedItem=t}}));if(this.selectedItem!==undefined){this.startTimer()}};e.prototype.disconnectedCallback=function(){this.stopTimer();this.clearIntervals()};e.prototype.onClickActive=function(e){if(this.selectedItem&&e.detail===this.selectedItem.description){return}var t;this.children.forEach((function(i){i.progress=0;if(i.description===e.detail){t=i.uuid}}));this.setSelectedItem(t);this.startTimer();this.pauseTimer()};e.prototype.onMouseEnterSelect=function(){this.pauseTimer()};e.prototype.onMouseLeaveSelect=function(){if(this.timeChecker===null){this.playTimer()}};e.prototype.render=function(){return n(r,null,n("slot",null))};Object.defineProperty(e.prototype,"element",{get:function(){return s(this)},enumerable:false,configurable:true});return e}());o.style=c}}}));
@@ -0,0 +1 @@
1
+ System.register(["./p-5029b85d.system.js"],(function(e,t){"use strict";var r,n;return{setters:[function(t){r=t.p;n=t.b;e("setNonce",t.s)}],execute:function(){var e=function(){var e=t.meta.url;var n={};if(e!==""){n.resourcesUrl=new URL(".",e).href}return r(n)};e().then((function(e){return n([["p-2bfbd758.system",[[1,"mds-accordion-timer",{duration:[2],time:[32]},[[0,"mdsAccordionTimerItemClickSelect","onClickActive"],[0,"mdsAccordionTimerItemMouseEnterSelect","onMouseEnterSelect"],[0,"mdsAccordionTimerItemMouseLeaveSelect","onMouseLeaveSelect"]]]]]],e)}))}}}));