@maggioli-design-system/mds-push-notification 1.4.0 → 1.4.1
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/collection/common/keyboard-manager.js +16 -11
- package/dist/documentation.json +1 -1
- package/dist/stats.json +1 -1
- package/dist/types/common/keyboard-manager.d.ts +2 -1
- package/documentation.json +9 -5
- package/package.json +4 -4
- package/readme.md +0 -1
- package/src/common/keyboard-manager.ts +16 -12
- package/src/fixtures/icons.json +1 -0
- package/src/fixtures/iconsauce.json +1 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export class KeyboardManager {
|
|
2
2
|
constructor() {
|
|
3
|
-
this.elements =
|
|
3
|
+
this.elements = new Map();
|
|
4
4
|
this.handleClickBehaviorDispatchEvent = (event) => {
|
|
5
|
-
if (event.code === '
|
|
5
|
+
if (event.code === 'Enter' || event.code === 'NumpadEnter') {
|
|
6
6
|
event.target.click();
|
|
7
7
|
}
|
|
8
8
|
};
|
|
@@ -12,20 +12,25 @@ export class KeyboardManager {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
this.addElement = (el, name = 'element') => {
|
|
15
|
-
|
|
15
|
+
if (!el) {
|
|
16
|
+
throw Error(`Passed an ${el} element parameter to KeyboardManager.addElement`);
|
|
17
|
+
}
|
|
18
|
+
this.elements.set(name, el);
|
|
19
|
+
};
|
|
20
|
+
this.removeElement = (name = 'element') => {
|
|
21
|
+
this.detachClickBehavior(name);
|
|
22
|
+
this.elements.delete(name);
|
|
16
23
|
};
|
|
17
24
|
this.attachClickBehavior = (name = 'element') => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
25
|
+
var _a;
|
|
26
|
+
(_a = this.elements.get(name)) === null || _a === void 0 ? void 0 : _a.addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
|
|
21
27
|
};
|
|
22
28
|
this.detachClickBehavior = (name = 'element') => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
29
|
+
var _a;
|
|
30
|
+
(_a = this.elements.get(name)) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', this.handleClickBehaviorDispatchEvent);
|
|
26
31
|
};
|
|
27
|
-
this.attachEscapeBehavior = (
|
|
28
|
-
this.escapeCallback =
|
|
32
|
+
this.attachEscapeBehavior = (callback) => {
|
|
33
|
+
this.escapeCallback = callback;
|
|
29
34
|
if (window !== undefined) {
|
|
30
35
|
window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
31
36
|
}
|
package/dist/documentation.json
CHANGED
package/dist/stats.json
CHANGED
|
@@ -4,8 +4,9 @@ export declare class KeyboardManager {
|
|
|
4
4
|
private handleClickBehaviorDispatchEvent;
|
|
5
5
|
private handleEscapeBehaviorDispatchEvent;
|
|
6
6
|
addElement: (el: HTMLElement, name?: string) => void;
|
|
7
|
+
removeElement: (name?: string) => void;
|
|
7
8
|
attachClickBehavior: (name?: string) => void;
|
|
8
9
|
detachClickBehavior: (name?: string) => void;
|
|
9
|
-
attachEscapeBehavior: (
|
|
10
|
+
attachEscapeBehavior: (callback: () => void) => void;
|
|
10
11
|
detachEscapeBehavior: () => void;
|
|
11
12
|
}
|
package/documentation.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2024-02-
|
|
2
|
+
"timestamp": "2024-02-16T18:14:59",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.10.0",
|
|
@@ -361,7 +361,6 @@
|
|
|
361
361
|
"mds-button"
|
|
362
362
|
],
|
|
363
363
|
"mds-avatar": [
|
|
364
|
-
"mds-text",
|
|
365
364
|
"mds-img",
|
|
366
365
|
"mds-icon"
|
|
367
366
|
],
|
|
@@ -569,6 +568,11 @@
|
|
|
569
568
|
"docstring": "",
|
|
570
569
|
"path": "src/components/mds-header/meta/event-detail.ts"
|
|
571
570
|
},
|
|
571
|
+
"src/components/mds-horizontal-scroll/meta/types.ts::ViewportType": {
|
|
572
|
+
"declaration": "export type ViewportType =\n | 'all'\n | 'tv'\n | 'xlarge'\n | 'large'\n | 'wide'\n | 'desktop'\n | 'tablet'\n | 'none'",
|
|
573
|
+
"docstring": "",
|
|
574
|
+
"path": "src/components/mds-horizontal-scroll/meta/types.ts"
|
|
575
|
+
},
|
|
572
576
|
"src/components/mds-horizontal-scroll/meta/types.ts::SnapType": {
|
|
573
577
|
"declaration": "export type SnapType =\n | 'center'\n | 'end'\n | 'none'\n | 'start'",
|
|
574
578
|
"docstring": "",
|
|
@@ -659,10 +663,10 @@
|
|
|
659
663
|
"docstring": "",
|
|
660
664
|
"path": "src/components/mds-input-switch/meta/types.ts"
|
|
661
665
|
},
|
|
662
|
-
"src/
|
|
663
|
-
"declaration": "export
|
|
666
|
+
"src/components/mds-input-switch/meta/event-detail.ts::MdsInputSwitchEventDetail": {
|
|
667
|
+
"declaration": "export interface MdsInputSwitchEventDetail {\n name: string\n checked: boolean\n value: string\n}",
|
|
664
668
|
"docstring": "",
|
|
665
|
-
"path": "src/
|
|
669
|
+
"path": "src/components/mds-input-switch/meta/event-detail.ts"
|
|
666
670
|
},
|
|
667
671
|
"src/components/mds-input-upload/meta/types.ts::AttachmentSort": {
|
|
668
672
|
"declaration": "enum AttachmentSort {\n status = 'status',\n date = 'date',\n}",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maggioli-design-system/mds-push-notification",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "mds-push-notification is a web-component from Magma Design System, 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",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"test": "stencil test --spec --e2e"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@maggioli-design-system/mds-button": "4.17.
|
|
28
|
-
"@maggioli-design-system/mds-icon": "2.10.
|
|
29
|
-
"@maggioli-design-system/mds-text": "4.3.
|
|
27
|
+
"@maggioli-design-system/mds-button": "4.17.1",
|
|
28
|
+
"@maggioli-design-system/mds-icon": "2.10.1",
|
|
29
|
+
"@maggioli-design-system/mds-text": "4.3.3",
|
|
30
30
|
"@maggioli-design-system/styles": "14.2.1",
|
|
31
31
|
"@stencil/core": "4.10.0"
|
|
32
32
|
},
|
package/readme.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export class KeyboardManager {
|
|
2
2
|
private escapeCallback: () => void
|
|
3
|
-
private elements =
|
|
3
|
+
private elements = new Map<string, HTMLElement>()
|
|
4
4
|
|
|
5
5
|
private handleClickBehaviorDispatchEvent = (event: KeyboardEvent): void => {
|
|
6
|
-
if (event.code === '
|
|
6
|
+
if (event.code === 'Enter' || event.code === 'NumpadEnter') {
|
|
7
7
|
(event.target as HTMLElement).click()
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -15,30 +15,34 @@ export class KeyboardManager {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
addElement = (el: HTMLElement, name = 'element'): void => {
|
|
18
|
-
|
|
18
|
+
if (!el) {
|
|
19
|
+
throw Error(`Passed an ${el} element parameter to KeyboardManager.addElement`)
|
|
20
|
+
}
|
|
21
|
+
this.elements.set(name, el)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
removeElement = (name: string = 'element'): void => {
|
|
25
|
+
this.detachClickBehavior(name)
|
|
26
|
+
this.elements.delete(name)
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
attachClickBehavior = (name = 'element'): void => {
|
|
22
|
-
|
|
23
|
-
this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent)
|
|
24
|
-
}
|
|
30
|
+
this.elements.get(name)?.addEventListener('keydown', this.handleClickBehaviorDispatchEvent)
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
detachClickBehavior = (name = 'element'): void => {
|
|
28
|
-
|
|
29
|
-
this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent)
|
|
30
|
-
}
|
|
34
|
+
this.elements.get(name)?.removeEventListener('keydown', this.handleClickBehaviorDispatchEvent)
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
attachEscapeBehavior = (
|
|
34
|
-
this.escapeCallback =
|
|
37
|
+
attachEscapeBehavior = (callback: () => void): void => {
|
|
38
|
+
this.escapeCallback = callback
|
|
35
39
|
if (window !== undefined) {
|
|
36
40
|
window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this))
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
detachEscapeBehavior = (): void => {
|
|
41
|
-
this.escapeCallback = () => {return}
|
|
45
|
+
this.escapeCallback = () => { return }
|
|
42
46
|
if (window !== undefined) {
|
|
43
47
|
window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this))
|
|
44
48
|
}
|
package/src/fixtures/icons.json
CHANGED