@maggioli-design-system/mds-stepper-bar-item
Advanced tools
Comparing version 5.6.0 to 5.6.1
export class KeyboardManager { | ||
constructor() { | ||
this.elements = []; | ||
this.elements = new Map(); | ||
this.handleClickBehaviorDispatchEvent = (event) => { | ||
if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') { | ||
if (event.code === 'Enter' || event.code === 'NumpadEnter') { | ||
event.target.click(); | ||
@@ -15,16 +15,21 @@ } | ||
this.addElement = (el, name = 'element') => { | ||
this.elements[name] = el; | ||
if (!el) { | ||
throw Error(`Passed an ${el} element parameter to KeyboardManager.addElement`); | ||
} | ||
this.elements.set(name, el); | ||
}; | ||
this.removeElement = (name = 'element') => { | ||
this.detachClickBehavior(name); | ||
this.elements.delete(name); | ||
}; | ||
this.attachClickBehavior = (name = 'element') => { | ||
if (this.elements[name]) { | ||
this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent); | ||
} | ||
var _a; | ||
(_a = this.elements.get(name)) === null || _a === void 0 ? void 0 : _a.addEventListener('keydown', this.handleClickBehaviorDispatchEvent); | ||
}; | ||
this.detachClickBehavior = (name = 'element') => { | ||
if (this.elements[name]) { | ||
this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent); | ||
} | ||
var _a; | ||
(_a = this.elements.get(name)) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', this.handleClickBehaviorDispatchEvent); | ||
}; | ||
this.attachEscapeBehavior = (callBack) => { | ||
this.escapeCallback = callBack; | ||
this.attachEscapeBehavior = (callback) => { | ||
this.escapeCallback = callback; | ||
if (window !== undefined) { | ||
@@ -31,0 +36,0 @@ window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this)); |
{ | ||
"timestamp": "2024-02-13T14:13:19", | ||
"timestamp": "2024-02-16T18:42:19", | ||
"compiler": { | ||
@@ -4,0 +4,0 @@ "name": "@stencil/core", |
{ | ||
"timestamp": "2024-02-13T14:13:19", | ||
"timestamp": "2024-02-16T18:42:19", | ||
"compiler": { | ||
@@ -4,0 +4,0 @@ "name": "node", |
@@ -7,6 +7,7 @@ export declare class KeyboardManager { | ||
addElement: (el: HTMLElement, name?: string) => void; | ||
removeElement: (name?: string) => void; | ||
attachClickBehavior: (name?: string) => void; | ||
detachClickBehavior: (name?: string) => void; | ||
attachEscapeBehavior: (callBack: () => void) => void; | ||
attachEscapeBehavior: (callback: () => void) => void; | ||
detachEscapeBehavior: () => void; | ||
} |
{ | ||
"timestamp": "2024-02-13T13:44:43", | ||
"timestamp": "2024-02-16T18:14:59", | ||
"compiler": { | ||
@@ -593,2 +593,7 @@ "name": "@stencil/core", | ||
}, | ||
"src/components/mds-horizontal-scroll/meta/types.ts::ViewportType": { | ||
"declaration": "export type ViewportType =\n | 'all'\n | 'tv'\n | 'xlarge'\n | 'large'\n | 'wide'\n | 'desktop'\n | 'tablet'\n | 'none'", | ||
"docstring": "", | ||
"path": "src/components/mds-horizontal-scroll/meta/types.ts" | ||
}, | ||
"src/components/mds-horizontal-scroll/meta/types.ts::SnapType": { | ||
@@ -684,6 +689,6 @@ "declaration": "export type SnapType =\n | 'center'\n | 'end'\n | 'none'\n | 'start'", | ||
}, | ||
"src/type/input.ts::InputValueType": { | ||
"declaration": "export type InputValueType =\n | null\n | number\n | string\n | undefined", | ||
"src/components/mds-input-switch/meta/event-detail.ts::MdsInputSwitchEventDetail": { | ||
"declaration": "export interface MdsInputSwitchEventDetail {\n name: string\n checked: boolean\n value: string\n}", | ||
"docstring": "", | ||
"path": "src/type/input.ts" | ||
"path": "src/components/mds-input-switch/meta/event-detail.ts" | ||
}, | ||
@@ -690,0 +695,0 @@ "src/components/mds-input-upload/meta/types.ts::AttachmentSort": { |
{ | ||
"name": "@maggioli-design-system/mds-stepper-bar-item", | ||
"version": "5.6.0", | ||
"version": "5.6.1", | ||
"description": "mds-stepper-bar-item 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.", | ||
@@ -26,4 +26,4 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@maggioli-design-system/mds-badge": "2.9.0", | ||
"@maggioli-design-system/mds-text": "4.3.2", | ||
"@maggioli-design-system/mds-badge": "2.9.1", | ||
"@maggioli-design-system/mds-text": "4.3.3", | ||
"@maggioli-design-system/styles": "14.2.1", | ||
@@ -30,0 +30,0 @@ "@stencil/core": "4.10.0", |
export class KeyboardManager { | ||
private escapeCallback: () => void | ||
private elements = [] | ||
private elements = new Map<string, HTMLElement>() | ||
private handleClickBehaviorDispatchEvent = (event: KeyboardEvent): void => { | ||
if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') { | ||
if (event.code === 'Enter' || event.code === 'NumpadEnter') { | ||
(event.target as HTMLElement).click() | ||
@@ -18,19 +18,23 @@ } | ||
addElement = (el: HTMLElement, name = 'element'): void => { | ||
this.elements[name] = el | ||
if (!el) { | ||
throw Error(`Passed an ${el} element parameter to KeyboardManager.addElement`) | ||
} | ||
this.elements.set(name, el) | ||
} | ||
removeElement = (name: string = 'element'): void => { | ||
this.detachClickBehavior(name) | ||
this.elements.delete(name) | ||
} | ||
attachClickBehavior = (name = 'element'): void => { | ||
if (this.elements[name]) { | ||
this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent) | ||
} | ||
this.elements.get(name)?.addEventListener('keydown', this.handleClickBehaviorDispatchEvent) | ||
} | ||
detachClickBehavior = (name = 'element'): void => { | ||
if (this.elements[name]) { | ||
this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent) | ||
} | ||
this.elements.get(name)?.removeEventListener('keydown', this.handleClickBehaviorDispatchEvent) | ||
} | ||
attachEscapeBehavior = (callBack: () => void): void => { | ||
this.escapeCallback = callBack | ||
attachEscapeBehavior = (callback: () => void): void => { | ||
this.escapeCallback = callback | ||
if (window !== undefined) { | ||
@@ -42,3 +46,3 @@ window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this)) | ||
detachEscapeBehavior = (): void => { | ||
this.escapeCallback = () => {return} | ||
this.escapeCallback = () => { return } | ||
if (window !== undefined) { | ||
@@ -45,0 +49,0 @@ window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this)) |
@@ -54,2 +54,3 @@ [ | ||
"mgg/card-stamping", | ||
"mgg/check-small", | ||
"mgg/checklist", | ||
@@ -56,0 +57,0 @@ "mgg/checklist-settings", |
@@ -42,2 +42,3 @@ [ | ||
"mgg/card-stamping", | ||
"mgg/check-small", | ||
"mgg/checklist-settings", | ||
@@ -44,0 +45,0 @@ "mgg/checklist", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
988028
14298
+ Added@maggioli-design-system/mds-badge@2.9.1(transitive)
+ Added@maggioli-design-system/mds-text@4.3.3(transitive)
- Removed@maggioli-design-system/mds-badge@2.9.0(transitive)
- Removed@maggioli-design-system/mds-text@4.3.2(transitive)