@maggioli-design-system/mds-accordion-timer 3.6.1 → 3.6.3

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 (60) hide show
  1. package/dist/cjs/{index-61e09d05.js → index-2cfccbaa.js} +17 -15
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mds-accordion-timer.cjs.entry.js +99 -99
  4. package/dist/cjs/mds-accordion-timer.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/common/aria.js +18 -18
  7. package/dist/collection/common/keyboard-manager.js +38 -38
  8. package/dist/collection/common/unit.js +7 -7
  9. package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +173 -173
  10. package/dist/collection/components/mds-accordion-timer/test/mds-accordion-timer.e2e.js +7 -7
  11. package/dist/collection/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +8 -8
  12. package/dist/collection/dictionary/autocomplete.js +56 -56
  13. package/dist/collection/dictionary/button.js +19 -19
  14. package/dist/collection/dictionary/color.js +14 -14
  15. package/dist/collection/dictionary/floating-ui.js +14 -14
  16. package/dist/collection/dictionary/input.js +31 -15
  17. package/dist/collection/dictionary/loading.js +2 -2
  18. package/dist/collection/dictionary/typography.js +46 -46
  19. package/dist/collection/dictionary/variant.js +54 -54
  20. package/dist/collection/fixtures/cities.js +107 -107
  21. package/dist/components/mds-accordion-timer.d.ts +2 -2
  22. package/dist/components/mds-accordion-timer.js +115 -115
  23. package/dist/documentation.json +2 -2
  24. package/dist/esm/{index-9c897c0f.js → index-df0a164e.js} +17 -15
  25. package/dist/esm/loader.js +2 -2
  26. package/dist/esm/mds-accordion-timer.entry.js +99 -99
  27. package/dist/esm/mds-accordion-timer.js +3 -3
  28. package/dist/esm-es5/{index-9c897c0f.js → index-df0a164e.js} +1 -1
  29. package/dist/esm-es5/loader.js +1 -1
  30. package/dist/esm-es5/mds-accordion-timer.entry.js +1 -1
  31. package/dist/esm-es5/mds-accordion-timer.js +1 -1
  32. package/dist/mds-accordion-timer/mds-accordion-timer.esm.js +1 -1
  33. package/dist/mds-accordion-timer/mds-accordion-timer.js +15 -15
  34. package/dist/mds-accordion-timer/{p-4cd26889.system.entry.js → p-09cc1589.system.entry.js} +1 -1
  35. package/dist/mds-accordion-timer/{p-e8d05a4f.system.js → p-0da95646.system.js} +1 -1
  36. package/dist/mds-accordion-timer/p-36be1c3e.js +2 -0
  37. package/dist/mds-accordion-timer/{p-1c301b51.system.js → p-8dd76b31.system.js} +1 -1
  38. package/{www/build/p-18045fbf.entry.js → dist/mds-accordion-timer/p-e57978cc.entry.js} +1 -1
  39. package/dist/stats.json +30 -30
  40. package/dist/types/common/keyboard-manager.d.ts +9 -9
  41. package/dist/types/components/mds-accordion-timer/mds-accordion-timer.d.ts +33 -33
  42. package/dist/types/components/mds-accordion-timer/test/mds-accordion-timer.stories.d.ts +8 -8
  43. package/dist/types/dictionary/input.d.ts +2 -1
  44. package/dist/types/interface/input-value.d.ts +1 -1
  45. package/dist/types/stencil-public-runtime.d.ts +8 -0
  46. package/documentation.json +14 -4
  47. package/package.json +4 -4
  48. package/src/components/mds-accordion-timer/mds-accordion-timer.css +1 -1
  49. package/src/dictionary/input.ts +18 -0
  50. package/src/fixtures/icons.json +3 -0
  51. package/src/fixtures/iconsauce.json +3 -0
  52. package/www/build/mds-accordion-timer.esm.js +1 -1
  53. package/www/build/mds-accordion-timer.js +15 -15
  54. package/www/build/{p-4cd26889.system.entry.js → p-09cc1589.system.entry.js} +1 -1
  55. package/www/build/{p-e8d05a4f.system.js → p-0da95646.system.js} +1 -1
  56. package/www/build/p-36be1c3e.js +2 -0
  57. package/www/build/{p-1c301b51.system.js → p-8dd76b31.system.js} +1 -1
  58. package/{dist/mds-accordion-timer/p-18045fbf.entry.js → www/build/p-e57978cc.entry.js} +1 -1
  59. package/dist/mds-accordion-timer/p-2f99e0f2.js +0 -2
  60. package/www/build/p-2f99e0f2.js +0 -2
@@ -947,10 +947,10 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
947
947
  */
948
948
  const proxyComponent = (Cstr, cmpMeta, flags) => {
949
949
  var _a;
950
+ const prototype = Cstr.prototype;
950
951
  if (cmpMeta.$members$) {
951
952
  // It's better to have a const than two Object.entries()
952
953
  const members = Object.entries(cmpMeta.$members$);
953
- const prototype = Cstr.prototype;
954
954
  members.map(([memberName, [memberFlags]]) => {
955
955
  if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
956
956
  ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
@@ -973,6 +973,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
973
973
  const attrNameToPropName = new Map();
974
974
  prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
975
975
  plt.jmp(() => {
976
+ var _a;
976
977
  const propName = attrNameToPropName.get(attrName);
977
978
  // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
978
979
  // in the case where an attribute was set inline.
@@ -1028,11 +1029,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1028
1029
  // 1. The instance is ready
1029
1030
  // 2. The watchers are ready
1030
1031
  // 3. The value has changed
1031
- if (!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1032
+ if (flags &&
1033
+ !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1032
1034
  flags & 128 /* HOST_FLAGS.isWatchReady */ &&
1033
1035
  newValue !== oldValue) {
1034
1036
  const instance = hostRef.$lazyInstance$ ;
1035
- const entry = cmpMeta.$watchers$[attrName];
1037
+ const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
1036
1038
  entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
1037
1039
  if (instance[callbackName] != null) {
1038
1040
  instance[callbackName].call(instance, newValue, oldValue, attrName);
@@ -1423,19 +1425,19 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1423
1425
  return module[exportName];
1424
1426
  }
1425
1427
 
1426
- if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1427
- const processMod = importedModule => {
1428
- cmpModules.set(bundleId, importedModule);
1429
- return importedModule[exportName];
1430
- }
1431
- switch(bundleId) {
1432
-
1433
- case 'mds-accordion-timer.cjs':
1434
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1435
- /* webpackMode: "lazy" */
1436
- './mds-accordion-timer.cjs.entry.js')); }).then(processMod, consoleError);
1428
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1429
+ const processMod = importedModule => {
1430
+ cmpModules.set(bundleId, importedModule);
1431
+ return importedModule[exportName];
1432
+ }
1433
+ switch(bundleId) {
1434
+
1435
+ case 'mds-accordion-timer.cjs':
1436
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1437
+ /* webpackMode: "lazy" */
1438
+ './mds-accordion-timer.cjs.entry.js')); }).then(processMod, consoleError);
1439
+ }
1437
1440
  }
1438
- }
1439
1441
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1440
1442
  /* @vite-ignore */
1441
1443
  /* webpackInclude: /\.entry\.js$/ */
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-61e09d05.js');
5
+ const index = require('./index-2cfccbaa.js');
6
6
 
7
7
  const defineCustomElements = (win, options) => {
8
8
  if (typeof window === 'undefined') return undefined;
@@ -2,115 +2,115 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-61e09d05.js');
5
+ const index = require('./index-2cfccbaa.js');
6
6
 
7
7
  const mdsAccordionTimerCss = ":host{--mds-accordion-timer-progress-bar-color:rgb(var(--tone-neutral-03));--mds-accordion-timer-progress-bar-background:rgb(var(--tone-neutral-08));--mds-accordion-timer-progress-bar-thickness:0.25rem;--mds-accordion-timer-duration:500ms;display:block}";
8
8
 
9
9
  const MdsAccordionTimer = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.changeEvent = index.createEvent(this, "mdsAccordionTimerChange", 7);
13
- this.clearIntervals = () => {
14
- window.clearInterval(this.timer);
15
- window.clearInterval(this.timeChecker);
16
- this.timeChecker = 0;
17
- };
18
- this.progress = () => {
19
- return Math.abs(this.remainingTime() / this.duration - 1);
20
- };
21
- this.addTimeListener = () => {
22
- this.timeChecker = window.setInterval(() => {
23
- const progress = this.progress();
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.changeEvent = index.createEvent(this, "mdsAccordionTimerChange", 7);
13
+ this.clearIntervals = () => {
14
+ window.clearInterval(this.timer);
15
+ window.clearInterval(this.timeChecker);
16
+ this.timeChecker = 0;
17
+ };
18
+ this.progress = () => {
19
+ return Math.abs(this.remainingTime() / this.duration - 1);
20
+ };
21
+ this.addTimeListener = () => {
22
+ this.timeChecker = window.setInterval(() => {
23
+ const progress = this.progress();
24
+ if (this.selectedItem !== undefined) {
25
+ this.selectedItem.progress = progress;
26
+ }
27
+ if (progress === 1) {
28
+ this.selectedItem.progress = 0;
29
+ this.startNext();
30
+ }
31
+ }, 100);
32
+ };
33
+ this.beginningTime = () => {
34
+ this.timeStarted = (new Date()).getTime();
35
+ return this.timeStarted;
36
+ };
37
+ this.remainingTime = () => {
38
+ const remainingTime = this.selectedItemDurationTime - ((new Date()).getTime() - this.timeStarted);
39
+ return remainingTime >= 0 ? remainingTime : 0;
40
+ };
41
+ this.setSelectedItem = (uuid) => {
42
+ this.children.forEach((item, key) => {
43
+ if (key === uuid) {
44
+ item.selected = true;
45
+ this.selectedItem = item;
46
+ this.changeEvent.emit();
47
+ }
48
+ else {
49
+ item.selected = false;
50
+ }
51
+ });
52
+ };
53
+ this.startNext = () => {
54
+ const nextUuid = this.selectedItem.uuid + 1 > this.children.length - 1 ? 0 : this.selectedItem.uuid + 1;
55
+ this.setSelectedItem(nextUuid);
56
+ this.startTimer();
57
+ };
58
+ this.startTimer = () => {
59
+ this.clearIntervals();
60
+ this.time = this.beginningTime();
61
+ this.selectedItemDurationTime = this.duration;
62
+ this.addTimeListener();
63
+ };
64
+ this.playTimer = () => {
65
+ this.beginningTime();
66
+ this.addTimeListener();
67
+ };
68
+ this.pauseTimer = () => {
69
+ this.clearIntervals();
70
+ this.selectedItemDurationTime = this.remainingTime();
71
+ };
72
+ this.stopTimer = () => {
73
+ this.clearIntervals();
74
+ };
75
+ this.time = 0;
76
+ this.duration = 10000;
77
+ }
78
+ componentDidLoad() {
79
+ this.children = this.element.querySelectorAll('mds-accordion-timer-item');
80
+ this.children.forEach((item, key) => {
81
+ item.uuid = key;
82
+ if (item.selected) {
83
+ this.selectedItem = item;
84
+ }
85
+ });
24
86
  if (this.selectedItem !== undefined) {
25
- this.selectedItem.progress = progress;
26
- }
27
- if (progress === 1) {
28
- this.selectedItem.progress = 0;
29
- this.startNext();
87
+ this.startTimer();
30
88
  }
31
- }, 100);
32
- };
33
- this.beginningTime = () => {
34
- this.timeStarted = (new Date()).getTime();
35
- return this.timeStarted;
36
- };
37
- this.remainingTime = () => {
38
- const remainingTime = this.selectedItemDurationTime - ((new Date()).getTime() - this.timeStarted);
39
- return remainingTime >= 0 ? remainingTime : 0;
40
- };
41
- this.setSelectedItem = (uuid) => {
42
- this.children.forEach((item, key) => {
43
- if (key === uuid) {
44
- item.selected = true;
45
- this.selectedItem = item;
46
- this.changeEvent.emit();
47
- }
48
- else {
49
- item.selected = false;
89
+ }
90
+ disconnectedCallback() {
91
+ this.stopTimer();
92
+ this.clearIntervals();
93
+ }
94
+ onClickActive(event) {
95
+ if (this.selectedItem) {
96
+ this.selectedItem.progress = 0;
50
97
  }
51
- });
52
- };
53
- this.startNext = () => {
54
- const nextUuid = this.selectedItem.uuid + 1 > this.children.length - 1 ? 0 : this.selectedItem.uuid + 1;
55
- this.setSelectedItem(nextUuid);
56
- this.startTimer();
57
- };
58
- this.startTimer = () => {
59
- this.clearIntervals();
60
- this.time = this.beginningTime();
61
- this.selectedItemDurationTime = this.duration;
62
- this.addTimeListener();
63
- };
64
- this.playTimer = () => {
65
- this.beginningTime();
66
- this.addTimeListener();
67
- };
68
- this.pauseTimer = () => {
69
- this.clearIntervals();
70
- this.selectedItemDurationTime = this.remainingTime();
71
- };
72
- this.stopTimer = () => {
73
- this.clearIntervals();
74
- };
75
- this.time = 0;
76
- this.duration = 10000;
77
- }
78
- componentDidLoad() {
79
- this.children = this.element.querySelectorAll('mds-accordion-timer-item');
80
- this.children.forEach((item, key) => {
81
- item.uuid = key;
82
- if (item.selected) {
83
- this.selectedItem = item;
84
- }
85
- });
86
- if (this.selectedItem !== undefined) {
87
- this.startTimer();
98
+ this.setSelectedItem(event.detail.uuid);
99
+ this.startTimer();
100
+ this.pauseTimer();
101
+ }
102
+ onMouseEnterSelect() {
103
+ this.pauseTimer();
88
104
  }
89
- }
90
- disconnectedCallback() {
91
- this.stopTimer();
92
- this.clearIntervals();
93
- }
94
- onClickActive(event) {
95
- if (this.selectedItem) {
96
- this.selectedItem.progress = 0;
105
+ onMouseLeaveSelect() {
106
+ if (this.timeChecker === 0) {
107
+ this.playTimer();
108
+ }
97
109
  }
98
- this.setSelectedItem(event.detail.uuid);
99
- this.startTimer();
100
- this.pauseTimer();
101
- }
102
- onMouseEnterSelect() {
103
- this.pauseTimer();
104
- }
105
- onMouseLeaveSelect() {
106
- if (this.timeChecker === 0) {
107
- this.playTimer();
110
+ render() {
111
+ return (index.h(index.Host, null, index.h("slot", null)));
108
112
  }
109
- }
110
- render() {
111
- return (index.h(index.Host, null, index.h("slot", null)));
112
- }
113
- get element() { return index.getElement(this); }
113
+ get element() { return index.getElement(this); }
114
114
  };
115
115
  MdsAccordionTimer.style = mdsAccordionTimerCss;
116
116
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-61e09d05.js');
5
+ const index = require('./index-2cfccbaa.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Browser v4.7.2 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Browser v4.8.0 | 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));
@@ -4,7 +4,7 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "4.7.2",
7
+ "version": "4.8.0",
8
8
  "typescriptVersion": "5.2.2"
9
9
  },
10
10
  "collections": [],
@@ -1,29 +1,29 @@
1
1
  const hash = (s) => {
2
- let i, h;
3
- for (i = 0, h = 0; i < s.length; i++) {
4
- h = Math.imul(31, h) + s.charCodeAt(i) | 0;
5
- }
6
- return h.toString();
2
+ let i, h;
3
+ for (i = 0, h = 0; i < s.length; i++) {
4
+ h = Math.imul(31, h) + s.charCodeAt(i) | 0;
5
+ }
6
+ return h.toString();
7
7
  };
8
8
  const randomInt = (max) => Math.floor(Math.random() * max);
9
9
  const unslugName = (name) => {
10
- var _a, _b, _c;
11
- return (_c = (_b = (_a = name.split('/')) === null || _a === void 0 ? void 0 : _a.slice(-1).pop()) === null || _b === void 0 ? void 0 : _b.replace(/-/g, ' ')) !== null && _c !== void 0 ? _c : name;
10
+ var _a, _b, _c;
11
+ return (_c = (_b = (_a = name.split('/')) === null || _a === void 0 ? void 0 : _a.slice(-1).pop()) === null || _b === void 0 ? void 0 : _b.replace(/-/g, ' ')) !== null && _c !== void 0 ? _c : name;
12
12
  };
13
13
  const setAttributeIfEmpty = (element, attribute, value) => {
14
- var _a;
15
- if (element.hasAttribute(attribute)) {
16
- return (_a = element.getAttribute(attribute)) !== null && _a !== void 0 ? _a : '';
17
- }
18
- element.setAttribute(attribute, value);
19
- return value;
14
+ var _a;
15
+ if (element.hasAttribute(attribute)) {
16
+ return (_a = element.getAttribute(attribute)) !== null && _a !== void 0 ? _a : '';
17
+ }
18
+ element.setAttribute(attribute, value);
19
+ return value;
20
20
  };
21
21
  const hashValue = (value) => `${value}-${hash(value)}`;
22
22
  const hashRandomValue = (value) => {
23
- const randomValue = randomInt(1000000);
24
- if (value) {
25
- return `${value}-${hash(randomValue.toString())}`;
26
- }
27
- return hash(randomValue.toString());
23
+ const randomValue = randomInt(1000000);
24
+ if (value) {
25
+ return `${value}-${hash(randomValue.toString())}`;
26
+ }
27
+ return hash(randomValue.toString());
28
28
  };
29
29
  export { unslugName, setAttributeIfEmpty, hashRandomValue, hashValue, };
@@ -1,40 +1,40 @@
1
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 (window !== undefined) {
30
- window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
31
- }
32
- };
33
- this.detachEscapeBehavior = () => {
34
- this.escapeCallback = () => { return; };
35
- if (window !== undefined) {
36
- window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
37
- }
38
- };
39
- }
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 (window !== undefined) {
30
+ window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
31
+ }
32
+ };
33
+ this.detachEscapeBehavior = () => {
34
+ this.escapeCallback = () => { return; };
35
+ if (window !== undefined) {
36
+ window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
37
+ }
38
+ };
39
+ }
40
40
  }
@@ -1,10 +1,10 @@
1
1
  const cssDurationToMilliseconds = (duration, defaultValue = 1000) => {
2
- if (duration.includes('s')) {
3
- return Number(duration.replace('s', '')) * 1000;
4
- }
5
- if (duration.includes('ms')) {
6
- return Number(duration.replace('s', ''));
7
- }
8
- return defaultValue;
2
+ if (duration.includes('s')) {
3
+ return Number(duration.replace('s', '')) * 1000;
4
+ }
5
+ if (duration.includes('ms')) {
6
+ return Number(duration.replace('s', ''));
7
+ }
8
+ return defaultValue;
9
9
  };
10
10
  export { cssDurationToMilliseconds, };