@momentum-design/components 0.105.1 → 0.105.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.
@@ -1,5 +1,5 @@
1
- export { default as Accordion } from './accordion';
2
1
  export { default as AccordionButton } from './accordionbutton';
2
+ export { default as Accordion } from './accordion';
3
3
  export { default as AccordionGroup } from './accordiongroup';
4
4
  export { default as AlertChip } from './alertchip';
5
5
  export { default as Animation } from './animation';
@@ -28,8 +28,8 @@ export { default as FormfieldGroup } from './formfieldgroup';
28
28
  export { default as FormfieldWrapper } from './formfieldwrapper';
29
29
  export { default as Icon } from './icon';
30
30
  export { default as IconProvider } from './iconprovider';
31
- export { default as InputChip } from './inputchip';
32
31
  export { default as Input } from './input';
32
+ export { default as InputChip } from './inputchip';
33
33
  export { default as Link } from './link';
34
34
  export { default as LinkButton } from './linkbutton';
35
35
  export { default as Linksimple } from './linksimple';
@@ -54,8 +54,8 @@ export { default as Progressbar } from './progressbar';
54
54
  export { default as Progressspinner } from './progressspinner';
55
55
  export { default as Radio } from './radio';
56
56
  export { default as RadioGroup } from './radiogroup';
57
- export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
58
57
  export { default as Searchfield } from './searchfield';
58
+ export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
59
59
  export { default as Select } from './select';
60
60
  export { default as Selectlistbox } from './selectlistbox';
61
61
  export { default as SideNavigation } from './sidenavigation';
@@ -73,9 +73,9 @@ export { default as TabList } from './tablist';
73
73
  export { default as Text } from './text';
74
74
  export { default as Textarea } from './textarea';
75
75
  export { default as ThemeProvider } from './themeprovider';
76
- export { default as Toggle } from './toggle';
77
- export { default as Tooltip } from './tooltip';
78
76
  export { default as Toast } from './toast';
77
+ export { default as Toggle } from './toggle';
79
78
  export { default as ToggleTip } from './toggletip';
79
+ export { default as Tooltip } from './tooltip';
80
80
  export { default as Typewriter } from './typewriter';
81
81
  export { default as VirtualizedList } from './virtualizedlist';
@@ -1,5 +1,5 @@
1
- export { default as Accordion } from './accordion';
2
1
  export { default as AccordionButton } from './accordionbutton';
2
+ export { default as Accordion } from './accordion';
3
3
  export { default as AccordionGroup } from './accordiongroup';
4
4
  export { default as AlertChip } from './alertchip';
5
5
  export { default as Animation } from './animation';
@@ -28,8 +28,8 @@ export { default as FormfieldGroup } from './formfieldgroup';
28
28
  export { default as FormfieldWrapper } from './formfieldwrapper';
29
29
  export { default as Icon } from './icon';
30
30
  export { default as IconProvider } from './iconprovider';
31
- export { default as InputChip } from './inputchip';
32
31
  export { default as Input } from './input';
32
+ export { default as InputChip } from './inputchip';
33
33
  export { default as Link } from './link';
34
34
  export { default as LinkButton } from './linkbutton';
35
35
  export { default as Linksimple } from './linksimple';
@@ -54,8 +54,8 @@ export { default as Progressbar } from './progressbar';
54
54
  export { default as Progressspinner } from './progressspinner';
55
55
  export { default as Radio } from './radio';
56
56
  export { default as RadioGroup } from './radiogroup';
57
- export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
58
57
  export { default as Searchfield } from './searchfield';
58
+ export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
59
59
  export { default as Select } from './select';
60
60
  export { default as Selectlistbox } from './selectlistbox';
61
61
  export { default as SideNavigation } from './sidenavigation';
@@ -73,9 +73,9 @@ export { default as TabList } from './tablist';
73
73
  export { default as Text } from './text';
74
74
  export { default as Textarea } from './textarea';
75
75
  export { default as ThemeProvider } from './themeprovider';
76
- export { default as Toggle } from './toggle';
77
- export { default as Tooltip } from './tooltip';
78
76
  export { default as Toast } from './toast';
77
+ export { default as Toggle } from './toggle';
79
78
  export { default as ToggleTip } from './toggletip';
79
+ export { default as Tooltip } from './tooltip';
80
80
  export { default as Typewriter } from './typewriter';
81
81
  export { default as VirtualizedList } from './virtualizedlist';
@@ -0,0 +1,7 @@
1
+ import type { Component } from '../../models';
2
+ import type { Constructor } from './index.types';
3
+ export declare class AutoFocusOnMountMixinInterface {
4
+ autoFocusOnMount?: boolean;
5
+ protected elementToAutoFocus: HTMLElement;
6
+ }
7
+ export declare const AutoFocusOnMountMixin: <T extends Constructor<Component>>(superClass: T) => Constructor<Component & AutoFocusOnMountMixinInterface> & T;
@@ -8,27 +8,36 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { property } from 'lit/decorators.js';
11
- export const AutoFocusMixin = (superClass) => {
11
+ export const AutoFocusOnMountMixin = (superClass) => {
12
12
  class InnerMixinClass extends superClass {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  /**
16
- * This property indicates whether the element should receive focus automatically when it is rendered.
16
+ * @internal
17
+ */
18
+ this.elementToAutoFocus = this;
19
+ /**
20
+ * This property indicates whether the element should receive focus automatically when it is mounted.
21
+ *
22
+ * It will not focus if the element is re-attached to the DOM after being removed.
23
+ *
17
24
  * @default false
18
25
  */
19
- this.autofocus = false;
26
+ this.autoFocusOnMount = false;
20
27
  }
21
- firstUpdated(changedProperties) {
28
+ async firstUpdated(changedProperties) {
22
29
  super.firstUpdated(changedProperties);
23
- if (this.autofocus) {
24
- this.focus();
30
+ if (this.autoFocusOnMount) {
31
+ // wait for the element to be fully updated before focusing
32
+ await this.updateComplete;
33
+ this.elementToAutoFocus.focus();
25
34
  }
26
35
  }
27
36
  }
28
37
  __decorate([
29
- property({ type: Boolean, reflect: true }),
38
+ property({ type: Boolean, reflect: true, attribute: 'auto-focus-on-mount' }),
30
39
  __metadata("design:type", Boolean)
31
- ], InnerMixinClass.prototype, "autofocus", void 0);
40
+ ], InnerMixinClass.prototype, "autoFocusOnMount", void 0);
32
41
  // Cast return type to your mixin's interface intersected with the superClass type
33
42
  return InnerMixinClass;
34
43
  };
@@ -1,7 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  import type { Constructor } from './index.types';
3
3
  export interface AssociatedFormControl {
4
- autofocus: boolean;
5
4
  disabled?: boolean;
6
5
  name: string;
7
6
  value: string | string[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.105.1",
4
+ "version": "0.105.3",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"
@@ -1,6 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import type { Constructor } from './index.types';
3
- export interface AutoFocusMixinInterface {
4
- autofocus?: boolean;
5
- }
6
- export declare const AutoFocusMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<AutoFocusMixinInterface> & T;