@maggioli-design-system/mds-accordion-timer 2.2.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-6821dfbc.js → index-b99075ba.js} +56 -9
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/mds-accordion-timer.cjs.entry.js +24 -24
- package/dist/cjs/mds-accordion-timer.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/common/keyboard-manager.js +40 -0
- package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +29 -29
- package/dist/collection/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +1 -1
- package/dist/collection/dictionary/icon.js +3 -1
- package/dist/collection/dictionary/typography.js +5 -1
- package/dist/components/mds-accordion-timer.js +24 -24
- package/dist/esm/{index-5ca2b649.js → index-bd689d6a.js} +56 -9
- package/dist/esm/loader.js +4 -4
- package/dist/esm/mds-accordion-timer.entry.js +24 -24
- package/dist/esm/mds-accordion-timer.js +4 -4
- package/dist/esm-es5/{index-5ca2b649.js → index-bd689d6a.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mds-accordion-timer.entry.js +1 -1
- package/dist/esm-es5/mds-accordion-timer.js +1 -1
- package/dist/mds-accordion-timer/mds-accordion-timer.esm.js +1 -1
- package/dist/mds-accordion-timer/mds-accordion-timer.js +1 -1
- package/dist/mds-accordion-timer/p-4620ac30.system.js +1 -0
- package/dist/mds-accordion-timer/{p-59116e2a.system.js → p-5029b85d.system.js} +2 -2
- package/dist/mds-accordion-timer/p-7df47654.system.entry.js +1 -0
- package/dist/mds-accordion-timer/p-a7b74010.js +2 -0
- package/dist/mds-accordion-timer/p-aae0027a.entry.js +1 -0
- package/dist/stats.json +68 -65
- package/dist/types/common/keyboard-manager.d.ts +11 -0
- package/dist/types/components/mds-accordion-timer/mds-accordion-timer.d.ts +6 -7
- package/dist/types/components.d.ts +1 -1
- package/dist/types/dictionary/icon.d.ts +2 -1
- package/dist/types/dictionary/typography.d.ts +2 -1
- package/dist/types/stencil-public-runtime.d.ts +11 -0
- package/dist/types/{types → type}/typography.d.ts +1 -0
- package/package.json +4 -4
- package/readme.md +3 -3
- package/src/common/keyboard-manager.ts +46 -0
- package/src/components/mds-accordion-timer/mds-accordion-timer.tsx +29 -29
- package/src/components/mds-accordion-timer/readme.md +3 -3
- package/src/components/mds-accordion-timer/test/mds-accordion-timer.stories.tsx +1 -1
- package/src/components.d.ts +1 -1
- package/src/dictionary/icon.ts +4 -0
- package/src/dictionary/typography.ts +9 -3
- package/src/fixtures/icons.json +174 -0
- package/src/fixtures/iconsauce.json +175 -0
- package/src/tailwind/components.css +1 -0
- package/src/{types → type}/typography.ts +4 -0
- package/www/build/mds-accordion-timer.esm.js +1 -1
- package/www/build/mds-accordion-timer.js +1 -1
- package/www/build/p-4620ac30.system.js +1 -0
- package/www/build/{p-59116e2a.system.js → p-5029b85d.system.js} +2 -2
- package/www/build/p-7df47654.system.entry.js +1 -0
- package/www/build/p-a7b74010.js +2 -0
- package/www/build/p-aae0027a.entry.js +1 -0
- package/dist/mds-accordion-timer/p-5d8e384d.js +0 -2
- package/dist/mds-accordion-timer/p-c4b2aa5c.system.js +0 -1
- package/dist/mds-accordion-timer/p-e66497f2.system.entry.js +0 -1
- package/dist/mds-accordion-timer/p-f0c71bfc.entry.js +0 -1
- package/www/build/p-5d8e384d.js +0 -2
- package/www/build/p-c4b2aa5c.system.js +0 -1
- package/www/build/p-e66497f2.system.entry.js +0 -1
- package/www/build/p-f0c71bfc.entry.js +0 -1
- /package/dist/collection/{types → type}/autocomplete.js +0 -0
- /package/dist/collection/{types → type}/button.js +0 -0
- /package/dist/collection/{types → type}/floating-ui.js +0 -0
- /package/dist/collection/{types → type}/form-rel.js +0 -0
- /package/dist/collection/{types → type}/input-text-type.js +0 -0
- /package/dist/collection/{types → type}/input-value-type.js +0 -0
- /package/dist/collection/{types → type}/loading.js +0 -0
- /package/dist/collection/{types → type}/typography.js +0 -0
- /package/dist/collection/{types → type}/variant.js +0 -0
- /package/dist/types/{types → type}/autocomplete.d.ts +0 -0
- /package/dist/types/{types → type}/button.d.ts +0 -0
- /package/dist/types/{types → type}/floating-ui.d.ts +0 -0
- /package/dist/types/{types → type}/form-rel.d.ts +0 -0
- /package/dist/types/{types → type}/input-text-type.d.ts +0 -0
- /package/dist/types/{types → type}/input-value-type.d.ts +0 -0
- /package/dist/types/{types → type}/loading.d.ts +0 -0
- /package/dist/types/{types → type}/variant.d.ts +0 -0
- /package/src/{types → type}/autocomplete.ts +0 -0
- /package/src/{types → type}/button.ts +0 -0
- /package/src/{types → type}/floating-ui.ts +0 -0
- /package/src/{types → type}/form-rel.ts +0 -0
- /package/src/{types → type}/input-text-type.ts +0 -0
- /package/src/{types → type}/input-value-type.ts +0 -0
- /package/src/{types → type}/loading.ts +0 -0
- /package/src/{types → type}/variant.ts +0 -0
|
@@ -111,6 +111,14 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
111
111
|
}
|
|
112
112
|
return vnode;
|
|
113
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* A utility function for creating a virtual DOM node from a tag and some
|
|
116
|
+
* possible text content.
|
|
117
|
+
*
|
|
118
|
+
* @param tag the tag for this element
|
|
119
|
+
* @param text possible text content for the node
|
|
120
|
+
* @returns a newly-minted virtual DOM node
|
|
121
|
+
*/
|
|
114
122
|
const newVNode = (tag, text) => {
|
|
115
123
|
const vnode = {
|
|
116
124
|
$flags$: 0,
|
|
@@ -122,6 +130,12 @@ const newVNode = (tag, text) => {
|
|
|
122
130
|
return vnode;
|
|
123
131
|
};
|
|
124
132
|
const Host = {};
|
|
133
|
+
/**
|
|
134
|
+
* Check whether a given node is a Host node or not
|
|
135
|
+
*
|
|
136
|
+
* @param node the virtual DOM node to check
|
|
137
|
+
* @returns whether it's a Host node or not
|
|
138
|
+
*/
|
|
125
139
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
126
140
|
/**
|
|
127
141
|
* Parse a new property value for a given property type.
|
|
@@ -300,6 +314,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
300
314
|
}
|
|
301
315
|
return elm;
|
|
302
316
|
};
|
|
317
|
+
/**
|
|
318
|
+
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
319
|
+
* add them to the DOM in the appropriate place.
|
|
320
|
+
*
|
|
321
|
+
* @param parentElm the DOM node which should be used as a parent for the new
|
|
322
|
+
* DOM nodes
|
|
323
|
+
* @param before a child of the `parentElm` which the new children should be
|
|
324
|
+
* inserted before (optional)
|
|
325
|
+
* @param parentVNode the parent virtual DOM node
|
|
326
|
+
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
|
327
|
+
* @param startIdx the index in the child virtual DOM nodes at which to start
|
|
328
|
+
* creating DOM nodes (inclusive)
|
|
329
|
+
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
|
330
|
+
* creating DOM nodes (inclusive)
|
|
331
|
+
*/
|
|
303
332
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
304
333
|
let containerElm = (parentElm);
|
|
305
334
|
let childNode;
|
|
@@ -316,6 +345,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
316
345
|
}
|
|
317
346
|
}
|
|
318
347
|
};
|
|
348
|
+
/**
|
|
349
|
+
* Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
|
|
350
|
+
* This can be used to, for instance, clean up after a list of children which
|
|
351
|
+
* should no longer be shown.
|
|
352
|
+
*
|
|
353
|
+
* This function also handles some of Stencil's slot relocation logic.
|
|
354
|
+
*
|
|
355
|
+
* @param vnodes a list of virtual DOM nodes to remove
|
|
356
|
+
* @param startIdx the index at which to start removing nodes (inclusive)
|
|
357
|
+
* @param endIdx the index at which to stop removing nodes (inclusive)
|
|
358
|
+
* @param vnode a VNode
|
|
359
|
+
* @param elm an element
|
|
360
|
+
*/
|
|
319
361
|
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
320
362
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
321
363
|
if ((vnode = vnodes[startIdx])) {
|
|
@@ -507,7 +549,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
507
549
|
*
|
|
508
550
|
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
509
551
|
* changing order within a `children` array or something along those lines then
|
|
510
|
-
* we could obtain a false
|
|
552
|
+
* we could obtain a false negative and then have to do needless re-rendering
|
|
553
|
+
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
|
511
554
|
*
|
|
512
555
|
* @param leftVNode the first VNode to check
|
|
513
556
|
* @param rightVNode the second VNode to check
|
|
@@ -549,6 +592,18 @@ const patch = (oldVNode, newVNode) => {
|
|
|
549
592
|
}
|
|
550
593
|
}
|
|
551
594
|
};
|
|
595
|
+
/**
|
|
596
|
+
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
597
|
+
*
|
|
598
|
+
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
|
599
|
+
* function will handle creating a virtual DOM tree with a single root, patching
|
|
600
|
+
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
|
601
|
+
* relocation, and reflecting attributes.
|
|
602
|
+
*
|
|
603
|
+
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
604
|
+
* the DOM node into which it should be rendered.
|
|
605
|
+
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
606
|
+
*/
|
|
552
607
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
553
608
|
const hostElm = hostRef.$hostElement$;
|
|
554
609
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
@@ -892,7 +947,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
892
947
|
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
893
948
|
}
|
|
894
949
|
endNewInstance();
|
|
895
|
-
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
896
950
|
}
|
|
897
951
|
if (Cstr.style) {
|
|
898
952
|
// this component has styles but we haven't registered them yet
|
|
@@ -921,11 +975,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
921
975
|
schedule();
|
|
922
976
|
}
|
|
923
977
|
};
|
|
924
|
-
const fireConnectedCallback = (instance) => {
|
|
925
|
-
{
|
|
926
|
-
safeCall(instance, 'connectedCallback');
|
|
927
|
-
}
|
|
928
|
-
};
|
|
929
978
|
const connectedCallback = (elm) => {
|
|
930
979
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
931
980
|
const hostRef = getHostRef(elm);
|
|
@@ -969,8 +1018,6 @@ const connectedCallback = (elm) => {
|
|
|
969
1018
|
// reattach any event listeners to the host
|
|
970
1019
|
// since they would have been removed when disconnected
|
|
971
1020
|
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
972
|
-
// fire off connectedCallback() on component instance
|
|
973
|
-
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
974
1021
|
}
|
|
975
1022
|
endConnected();
|
|
976
1023
|
}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-b99075ba.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Esm v2.22.
|
|
8
|
+
Stencil Client Patch Esm v2.22.2 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchEsm = () => {
|
|
11
11
|
return index.promiseResolve();
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["mds-accordion-timer.cjs",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"
|
|
17
|
+
return index.bootstrapLazy([["mds-accordion-timer.cjs",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"mdsAccordionTimerItemClickSelect","onClickActive"],[0,"mdsAccordionTimerItemMouseEnterSelect","onMouseEnterSelect"],[0,"mdsAccordionTimerItemMouseLeaveSelect","onMouseLeaveSelect"]]]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-b99075ba.js');
|
|
6
6
|
|
|
7
7
|
const mdsAccordionTimerCss = ":host{display:block}";
|
|
8
8
|
|
|
9
9
|
const MdsAccordionTimer = class {
|
|
10
10
|
constructor(hostRef) {
|
|
11
11
|
index.registerInstance(this, hostRef);
|
|
12
|
-
this.
|
|
12
|
+
this.changeEvent = index.createEvent(this, "mdsAccordionTimerChange", 7);
|
|
13
13
|
this.clearIntervals = () => {
|
|
14
14
|
window.clearInterval(this.timer);
|
|
15
15
|
window.clearInterval(this.timeChecker);
|
|
@@ -22,11 +22,11 @@ const MdsAccordionTimer = class {
|
|
|
22
22
|
this.addTimeListener = () => {
|
|
23
23
|
this.timeChecker = window.setInterval(() => {
|
|
24
24
|
const progress = this.progress();
|
|
25
|
-
if (this.
|
|
26
|
-
this.
|
|
25
|
+
if (this.selectedItem !== undefined) {
|
|
26
|
+
this.selectedItem.progress = progress;
|
|
27
27
|
}
|
|
28
28
|
if (progress === 1) {
|
|
29
|
-
this.
|
|
29
|
+
this.selectedItem.progress = 0;
|
|
30
30
|
this.startNext();
|
|
31
31
|
}
|
|
32
32
|
}, 100);
|
|
@@ -36,30 +36,30 @@ const MdsAccordionTimer = class {
|
|
|
36
36
|
return this.timeStarted;
|
|
37
37
|
};
|
|
38
38
|
this.remainingTime = () => {
|
|
39
|
-
const remainingTime = this.
|
|
39
|
+
const remainingTime = this.selectedItemDurationTime - ((new Date()).getTime() - this.timeStarted);
|
|
40
40
|
return remainingTime >= 0 ? remainingTime : 0;
|
|
41
41
|
};
|
|
42
|
-
this.
|
|
42
|
+
this.setSelectedItem = (uuid) => {
|
|
43
43
|
this.children.forEach((item, key) => {
|
|
44
44
|
if (key === uuid) {
|
|
45
|
-
item.
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
45
|
+
item.selected = true;
|
|
46
|
+
this.selectedItem = item;
|
|
47
|
+
this.changeEvent.emit(uuid);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
item.
|
|
50
|
+
item.selected = false;
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
this.startNext = () => {
|
|
55
|
-
const nextUuid = this.
|
|
56
|
-
this.
|
|
55
|
+
const nextUuid = this.selectedItem.uuid + 1 > this.children.length - 1 ? 0 : this.selectedItem.uuid + 1;
|
|
56
|
+
this.setSelectedItem(nextUuid);
|
|
57
57
|
this.startTimer();
|
|
58
58
|
};
|
|
59
59
|
this.startTimer = () => {
|
|
60
60
|
this.clearIntervals();
|
|
61
61
|
this.time = this.beginningTime();
|
|
62
|
-
this.
|
|
62
|
+
this.selectedItemDurationTime = this.duration;
|
|
63
63
|
this.addTimeListener();
|
|
64
64
|
};
|
|
65
65
|
this.playTimer = () => {
|
|
@@ -68,7 +68,7 @@ const MdsAccordionTimer = class {
|
|
|
68
68
|
};
|
|
69
69
|
this.pauseTimer = () => {
|
|
70
70
|
this.clearIntervals();
|
|
71
|
-
this.
|
|
71
|
+
this.selectedItemDurationTime = this.remainingTime();
|
|
72
72
|
};
|
|
73
73
|
this.stopTimer = () => {
|
|
74
74
|
this.clearIntervals();
|
|
@@ -81,20 +81,20 @@ const MdsAccordionTimer = class {
|
|
|
81
81
|
this.children = this.element.querySelectorAll('mds-accordion-timer-item');
|
|
82
82
|
this.children.forEach((item, key) => {
|
|
83
83
|
item.uuid = key;
|
|
84
|
-
if (item.
|
|
85
|
-
this.
|
|
84
|
+
if (item.selected) {
|
|
85
|
+
this.selectedItem = item;
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (this.selectedItem !== undefined) {
|
|
89
|
+
this.startTimer();
|
|
90
|
+
}
|
|
91
91
|
}
|
|
92
92
|
disconnectedCallback() {
|
|
93
93
|
this.stopTimer();
|
|
94
94
|
this.clearIntervals();
|
|
95
95
|
}
|
|
96
96
|
onClickActive(event) {
|
|
97
|
-
if (event.detail === this.
|
|
97
|
+
if (this.selectedItem && event.detail === this.selectedItem.description) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
let selectedUuid;
|
|
@@ -104,14 +104,14 @@ const MdsAccordionTimer = class {
|
|
|
104
104
|
selectedUuid = item.uuid;
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
|
-
this.
|
|
107
|
+
this.setSelectedItem(selectedUuid);
|
|
108
108
|
this.startTimer();
|
|
109
109
|
this.pauseTimer();
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
onMouseEnterSelect() {
|
|
112
112
|
this.pauseTimer();
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
onMouseLeaveSelect() {
|
|
115
115
|
if (this.timeChecker === null) {
|
|
116
116
|
this.playTimer();
|
|
117
117
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-b99075ba.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Browser v2.22.
|
|
8
|
+
Stencil Client Patch Browser v2.22.2 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchBrowser = () => {
|
|
11
11
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mds-accordion-timer.cjs.js', document.baseURI).href));
|
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["mds-accordion-timer.cjs",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"
|
|
20
|
+
return index.bootstrapLazy([["mds-accordion-timer.cjs",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"mdsAccordionTimerItemClickSelect","onClickActive"],[0,"mdsAccordionTimerItemMouseEnterSelect","onMouseEnterSelect"],[0,"mdsAccordionTimerItemMouseLeaveSelect","onMouseLeaveSelect"]]]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export class KeyboardManager {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.elements = [];
|
|
4
|
+
this.handleClickBehaviorDispatchEvent = (event) => {
|
|
5
|
+
if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {
|
|
6
|
+
event.target.click();
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
this.handleEscapeBehaviorDispatchEvent = (event) => {
|
|
10
|
+
if (event.code === 'Escape' && this.escapeCallback) {
|
|
11
|
+
this.escapeCallback();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
this.addElement = (el, name = 'element') => {
|
|
15
|
+
this.elements[name] = el;
|
|
16
|
+
};
|
|
17
|
+
this.attachClickBehavior = (name = 'element') => {
|
|
18
|
+
if (this.elements[name]) {
|
|
19
|
+
this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
this.detachClickBehavior = (name = 'element') => {
|
|
23
|
+
if (this.elements[name]) {
|
|
24
|
+
this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
this.attachEscapeBehavior = (callBack) => {
|
|
28
|
+
this.escapeCallback = callBack;
|
|
29
|
+
if (typeof window !== undefined) {
|
|
30
|
+
window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
this.detachEscapeBehavior = () => {
|
|
34
|
+
this.escapeCallback = null;
|
|
35
|
+
if (typeof window !== undefined) {
|
|
36
|
+
window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -13,11 +13,11 @@ export class MdsAccordionTimer {
|
|
|
13
13
|
this.addTimeListener = () => {
|
|
14
14
|
this.timeChecker = window.setInterval(() => {
|
|
15
15
|
const progress = this.progress();
|
|
16
|
-
if (this.
|
|
17
|
-
this.
|
|
16
|
+
if (this.selectedItem !== undefined) {
|
|
17
|
+
this.selectedItem.progress = progress;
|
|
18
18
|
}
|
|
19
19
|
if (progress === 1) {
|
|
20
|
-
this.
|
|
20
|
+
this.selectedItem.progress = 0;
|
|
21
21
|
this.startNext();
|
|
22
22
|
}
|
|
23
23
|
}, 100);
|
|
@@ -27,30 +27,30 @@ export class MdsAccordionTimer {
|
|
|
27
27
|
return this.timeStarted;
|
|
28
28
|
};
|
|
29
29
|
this.remainingTime = () => {
|
|
30
|
-
const remainingTime = this.
|
|
30
|
+
const remainingTime = this.selectedItemDurationTime - ((new Date()).getTime() - this.timeStarted);
|
|
31
31
|
return remainingTime >= 0 ? remainingTime : 0;
|
|
32
32
|
};
|
|
33
|
-
this.
|
|
33
|
+
this.setSelectedItem = (uuid) => {
|
|
34
34
|
this.children.forEach((item, key) => {
|
|
35
35
|
if (key === uuid) {
|
|
36
|
-
item.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
36
|
+
item.selected = true;
|
|
37
|
+
this.selectedItem = item;
|
|
38
|
+
this.changeEvent.emit(uuid);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
item.
|
|
41
|
+
item.selected = false;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
this.startNext = () => {
|
|
46
|
-
const nextUuid = this.
|
|
47
|
-
this.
|
|
46
|
+
const nextUuid = this.selectedItem.uuid + 1 > this.children.length - 1 ? 0 : this.selectedItem.uuid + 1;
|
|
47
|
+
this.setSelectedItem(nextUuid);
|
|
48
48
|
this.startTimer();
|
|
49
49
|
};
|
|
50
50
|
this.startTimer = () => {
|
|
51
51
|
this.clearIntervals();
|
|
52
52
|
this.time = this.beginningTime();
|
|
53
|
-
this.
|
|
53
|
+
this.selectedItemDurationTime = this.duration;
|
|
54
54
|
this.addTimeListener();
|
|
55
55
|
};
|
|
56
56
|
this.playTimer = () => {
|
|
@@ -59,7 +59,7 @@ export class MdsAccordionTimer {
|
|
|
59
59
|
};
|
|
60
60
|
this.pauseTimer = () => {
|
|
61
61
|
this.clearIntervals();
|
|
62
|
-
this.
|
|
62
|
+
this.selectedItemDurationTime = this.remainingTime();
|
|
63
63
|
};
|
|
64
64
|
this.stopTimer = () => {
|
|
65
65
|
this.clearIntervals();
|
|
@@ -72,20 +72,20 @@ export class MdsAccordionTimer {
|
|
|
72
72
|
this.children = this.element.querySelectorAll('mds-accordion-timer-item');
|
|
73
73
|
this.children.forEach((item, key) => {
|
|
74
74
|
item.uuid = key;
|
|
75
|
-
if (item.
|
|
76
|
-
this.
|
|
75
|
+
if (item.selected) {
|
|
76
|
+
this.selectedItem = item;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
if (this.selectedItem !== undefined) {
|
|
80
|
+
this.startTimer();
|
|
81
|
+
}
|
|
82
82
|
}
|
|
83
83
|
disconnectedCallback() {
|
|
84
84
|
this.stopTimer();
|
|
85
85
|
this.clearIntervals();
|
|
86
86
|
}
|
|
87
87
|
onClickActive(event) {
|
|
88
|
-
if (event.detail === this.
|
|
88
|
+
if (this.selectedItem && event.detail === this.selectedItem.description) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
let selectedUuid;
|
|
@@ -95,14 +95,14 @@ export class MdsAccordionTimer {
|
|
|
95
95
|
selectedUuid = item.uuid;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
this.
|
|
98
|
+
this.setSelectedItem(selectedUuid);
|
|
99
99
|
this.startTimer();
|
|
100
100
|
this.pauseTimer();
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
onMouseEnterSelect() {
|
|
103
103
|
this.pauseTimer();
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
onMouseLeaveSelect() {
|
|
106
106
|
if (this.timeChecker === null) {
|
|
107
107
|
this.playTimer();
|
|
108
108
|
}
|
|
@@ -151,8 +151,8 @@ export class MdsAccordionTimer {
|
|
|
151
151
|
}
|
|
152
152
|
static get events() {
|
|
153
153
|
return [{
|
|
154
|
-
"method": "
|
|
155
|
-
"name": "
|
|
154
|
+
"method": "changeEvent",
|
|
155
|
+
"name": "mdsAccordionTimerChange",
|
|
156
156
|
"bubbles": true,
|
|
157
157
|
"cancelable": true,
|
|
158
158
|
"composed": true,
|
|
@@ -170,20 +170,20 @@ export class MdsAccordionTimer {
|
|
|
170
170
|
static get elementRef() { return "element"; }
|
|
171
171
|
static get listeners() {
|
|
172
172
|
return [{
|
|
173
|
-
"name": "
|
|
173
|
+
"name": "mdsAccordionTimerItemClickSelect",
|
|
174
174
|
"method": "onClickActive",
|
|
175
175
|
"target": undefined,
|
|
176
176
|
"capture": false,
|
|
177
177
|
"passive": false
|
|
178
178
|
}, {
|
|
179
|
-
"name": "
|
|
180
|
-
"method": "
|
|
179
|
+
"name": "mdsAccordionTimerItemMouseEnterSelect",
|
|
180
|
+
"method": "onMouseEnterSelect",
|
|
181
181
|
"target": undefined,
|
|
182
182
|
"capture": false,
|
|
183
183
|
"passive": false
|
|
184
184
|
}, {
|
|
185
|
-
"name": "
|
|
186
|
-
"method": "
|
|
185
|
+
"name": "mdsAccordionTimerItemMouseLeaveSelect",
|
|
186
|
+
"method": "onMouseLeaveSelect",
|
|
187
187
|
"target": undefined,
|
|
188
188
|
"capture": false,
|
|
189
189
|
"passive": false
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
},
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
|
-
const Template = args => h("div", null, h("mds-accordion-timer", Object.assign({}, args), h("mds-accordion-timer-item", {
|
|
12
|
+
const Template = args => h("div", null, h("mds-accordion-timer", Object.assign({}, args), h("mds-accordion-timer-item", { description: "Blipbug" }, h("mds-text", null, "Blipbug presenta delle fattezze riconducibili agli insetti nello stadio pre-crisalide. Il suo corpo si sviluppa in lunghezza, ed \u00E8 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 \u00E8 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 \u00E8 bianco e ospita delle zampe anteriori color crema, ed infine, la parte finale, o la \"coda\", \u00E8 color denim e finisce con un'appendice a \"V\" un po' pi\u00FA grossa.")), h("mds-accordion-timer-item", { description: "Drednaw" }, h("mds-text", null, "Drednaw \u00E8 un Pok\u00E9mon quadrupede simile ad una tartaruga alligatore. Il corpo \u00E8 principalmente di colore turchese cos\u00EC come le zampe cilindriche e tozze, le quali terminano con tre unghie allungate e bianche. Sulle zampe anteriori, circa sulla loro met\u00E0, spuntanto delle protuberanze simili a scaglie di roccia color marroncino, ricorrenti anche nel resto del corpo: ad esempio, sul muso c'\u00E8 una protuberanza a zig-zag che ospita le sue narici; sulla coda sono alternate delle scaglie e attorno al guscio c'\u00E8 una cornice dello stesso colore; anche le placche superiori sembrano essere fatte di roccia, ma sono di un colore marrone scuro, invece che chiaro. Queste parti rocciose sembrano essere frastagliate, per niente levigate. Il suo volto presenta occhi bassi e imbronciati, con delle guance arancioni e sporgenti ed una bocca a zig-zag, la cui parte inferiore \u00E8 simile al beige, colore presente anche nelle placche del guscio inferiori, che stavolta fanno vedere la pelle a volte grinzosa del Pok\u00E9mon (in particolare attorno al collo e sulle zampe). Le sue scaglie di roccia sono spesso rivolte verso di dietro, dando l'idea di una roccia grezza e non liscia e lavorata.")), h("mds-accordion-timer-item", { description: "Orbeetle" }, h("mds-text", null, "Orbeetle presenta aspetti comuni ad una coccinella ormai matura. Il suo corpo si sviluppa attorno al guscio che \u00E8 di forma semisferica ed \u00E8 metallizzato in grigio (lo si pu\u00F2 vedere in particolare dalla parte inferiore di esso): la sua scocca \u00E8 rossa, con dei pois denim sopra di essa; \u00E8 bisezionata per permettere di aprirsi e attaccare con degli strani poteri. All'estremit\u00E0 del taglio intermedio \u00E8 incastonato il volto di Orbeetle, il quale presenta delle guance bianche con occhi imbronciati celesti, aventi sclere concentriche; sopra di essi ci sono due lunghe sopracciglia dorate a forma di \"V\" e ad incorniciare la faccia del Pok\u00E9mon \u00E8 una cornice grigia, che finisce, con delle striature, sul naso dello stesso. La bocca, assieme alle ginocchia e alla pancia, \u00E8 rossa. Il suo corpo \u00E8 piccolo ed \u00E8 costituito da una vita stretta con una bacino largo, da dove si sviluppano due cosce secche ed esili per poi finire con appuntiti gambali dorati; le sue braccia sono magre e biforcute, come se avessero artigli.")), h("mds-accordion-timer-item", { description: "Dottler" }, h("mds-text", null, "Dottler pu\u00F2 essere considerato la \"crisalide\" della linea evolutiva di Blipbug, vista la sua forma e il suo comportamento. Presenta un guscio di forma poligonale (molto simile a quella di un radar Doppler o di un radome) di color giallo sabbia, con dei pois blu scuro sugli spigoli; leggermente in basso \u00E8 presente la sua faccia di color arancione chiaro, sulla quale ci sono degli occhi celesti attorniati da un contorno arancione, da linee sottili e nere e da delle appendici blu simili a quelle dei Blipbug. Il Pok\u00E9mon non sembra essere dedito a muoversi se non fosse per le quattro zampette blu scuro su cui cammina.")), h("mds-accordion-timer-item", { description: "Centiskorch" }, h("mds-text", null, "Con l'evoluzione Sizzlipede diventa pi\u00F9 aggressivo, soprattutto grazie alla sua stazza pi\u00F9 grande e al suo enorme potenziale. Il corpo diventa pi\u00F9 lungo e si \"seziona\" in dodici parti, anche qui un'estremit\u00E0 \u00E8 la \"coda\" e l'altra \u00E8 la testa, queste due parti, assieme all'intera parte inferiore del corpo sono del rosso mattone presente nella sua pre-evo, mentre le \"parti\" comprese tra la coda e la testa restano marroni/bordeaux; questa volte, dello stesso colore della \"schiena\" sono le zampe, le quali son diventate pi\u00F9 minacciose e uncinate, questa volta sono dieci per ogni lato; marrone/bordeaux sono anche delle tenaglie. presenti in paia, sulla coda e sulla testa; su queste estremit\u00E0 son presenti quattro sbuffi o \"baffi\" di fuoco. Sulla testa \u00E8 presente un simbolo arancione chiaro a forma di punto esclamativo; stessa gamma cromatica \u00E8 presente nei segni circolari situati nella zona inferiore del corpo, i quali son formati, per\u00F2, anche da un anello e da un cerchio, pi\u00F9 interno, di colore giallo sabbia; non sono altro che i punti che Sizzlipede riscalda per attaccare e scottare le prede. I suoi occhi sono giallo elettrico con pupille triangolari color marrone e rovesciati."))));
|
|
13
13
|
export const Default = Template.bind({});
|
|
14
14
|
Default.story = lokiDisabled;
|
|
15
15
|
export const Duration = Template.bind({});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import jsonIconsDictionary from '../fixtures/icons.json';
|
|
2
|
+
import jsonMggIconsDictionary from '../fixtures/iconsauce.json';
|
|
2
3
|
const iconsDictionary = jsonIconsDictionary;
|
|
3
|
-
|
|
4
|
+
const mggIconsDictionary = jsonMggIconsDictionary;
|
|
5
|
+
export { iconsDictionary, mggIconsDictionary, };
|
|
@@ -21,6 +21,10 @@ const typographyVariationsDictionary = [
|
|
|
21
21
|
'read',
|
|
22
22
|
'code',
|
|
23
23
|
];
|
|
24
|
+
const typographyReadingVariationsDictionary = [
|
|
25
|
+
'info',
|
|
26
|
+
'read',
|
|
27
|
+
];
|
|
24
28
|
const typographyMonoDictionary = [
|
|
25
29
|
'snippet',
|
|
26
30
|
'hack',
|
|
@@ -56,4 +60,4 @@ const typographyTooltipDictionary = [
|
|
|
56
60
|
'detail',
|
|
57
61
|
'tip',
|
|
58
62
|
];
|
|
59
|
-
export { typographyDictionary,
|
|
63
|
+
export { typographyDictionary, typographyInfoDictionary, typographyReadingVariationsDictionary, typographyMonoDictionary, typographyReadDictionary, typographySmallerDictionary, typographyTitleDictionary, typographyTooltipDictionary, typographyVariationsDictionary, };
|