@momentum-design/components 0.28.2 → 0.28.4

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 (40) hide show
  1. package/dist/browser/index.js +169 -157
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/avatar/avatar.component.js +4 -4
  4. package/dist/components/avatar/avatar.styles.js +20 -20
  5. package/dist/components/buttonsimple/buttonsimple.component.d.ts +1 -7
  6. package/dist/components/buttonsimple/buttonsimple.component.js +6 -13
  7. package/dist/components/checkbox/checkbox.component.d.ts +26 -13
  8. package/dist/components/checkbox/checkbox.component.js +62 -22
  9. package/dist/components/formfieldgroup/formfieldgroup.component.js +2 -1
  10. package/dist/components/input/input.component.d.ts +59 -72
  11. package/dist/components/input/input.component.js +85 -100
  12. package/dist/components/radio/radio.component.d.ts +51 -36
  13. package/dist/components/radio/radio.component.js +126 -46
  14. package/dist/components/radio/radio.styles.js +4 -0
  15. package/dist/components/radiogroup/radiogroup.component.d.ts +7 -2
  16. package/dist/components/radiogroup/radiogroup.component.js +26 -3
  17. package/dist/components/themeprovider/themeprovider.component.d.ts +1 -1
  18. package/dist/components/themeprovider/themeprovider.component.js +1 -1
  19. package/dist/components/toggle/toggle.component.d.ts +43 -24
  20. package/dist/components/toggle/toggle.component.js +79 -31
  21. package/dist/components/toggle/toggle.constants.d.ts +1 -0
  22. package/dist/components/toggle/toggle.constants.js +1 -0
  23. package/dist/components/virtualizedlist/virtualizedlist.component.js +2 -2
  24. package/dist/components/virtualizedlist/virtualizedlist.styles.js +9 -11
  25. package/dist/custom-elements.json +1471 -570
  26. package/dist/react/index.d.ts +1 -1
  27. package/dist/react/index.js +1 -1
  28. package/dist/react/themeprovider/index.d.ts +1 -1
  29. package/dist/react/themeprovider/index.js +1 -1
  30. package/dist/utils/mixins/FormInternalsMixin.d.ts +38 -0
  31. package/dist/utils/mixins/FormInternalsMixin.js +79 -0
  32. package/package.json +1 -1
  33. package/dist/utils/mixins/NameMixin.d.ts +0 -6
  34. package/dist/utils/mixins/NameMixin.js +0 -29
  35. package/dist/utils/mixins/ReadonlyMixin.d.ts +0 -6
  36. package/dist/utils/mixins/ReadonlyMixin.js +0 -29
  37. package/dist/utils/mixins/RequiredMixin.d.ts +0 -6
  38. package/dist/utils/mixins/RequiredMixin.js +0 -29
  39. package/dist/utils/mixins/ValueMixin.d.ts +0 -6
  40. package/dist/utils/mixins/ValueMixin.js +0 -28
@@ -21,6 +21,6 @@ export { default as RadioGroup } from './radiogroup';
21
21
  export { default as Spinner } from './spinner';
22
22
  export { default as Tab } from './tab';
23
23
  export { default as Text } from './text';
24
- export { default as ThemeProvider } from './themeprovider';
25
24
  export { default as Toggle } from './toggle';
25
+ export { default as ThemeProvider } from './themeprovider';
26
26
  export { default as VirtualizedList } from './virtualizedlist';
@@ -21,6 +21,6 @@ export { default as RadioGroup } from './radiogroup';
21
21
  export { default as Spinner } from './spinner';
22
22
  export { default as Tab } from './tab';
23
23
  export { default as Text } from './text';
24
- export { default as ThemeProvider } from './themeprovider';
25
24
  export { default as Toggle } from './toggle';
25
+ export { default as ThemeProvider } from './themeprovider';
26
26
  export { default as VirtualizedList } from './virtualizedlist';
@@ -23,7 +23,7 @@ import Component from '../../components/themeprovider';
23
23
  * @cssproperty --mdc-themeprovider-letter-spacing-adjustment - Option to override the default letter-spacing,
24
24
  * default: `-0.25px` (this is to match the old CiscoSans)
25
25
  * @cssproperty --mdc-themeprovider-font-feature-settings - Option to override the font feature settings,
26
- * default: `normal`
26
+ * default: `"ss02" on`
27
27
  * @cssproperty --mdc-themeprovider-scrollbar-track-color - Option to override the color of the scrollbar track.
28
28
  * @cssproperty --mdc-themeprovider-scrollbar-thumb-color - Option to override the color of the scrollbar thumb.
29
29
  * @cssproperty --mdc-themeprovider-scrollbar-thumb-hover-color - Option to override the color of the
@@ -26,7 +26,7 @@ import { TAG_NAME } from '../../components/themeprovider/themeprovider.constants
26
26
  * @cssproperty --mdc-themeprovider-letter-spacing-adjustment - Option to override the default letter-spacing,
27
27
  * default: `-0.25px` (this is to match the old CiscoSans)
28
28
  * @cssproperty --mdc-themeprovider-font-feature-settings - Option to override the font feature settings,
29
- * default: `normal`
29
+ * default: `"ss02" on`
30
30
  * @cssproperty --mdc-themeprovider-scrollbar-track-color - Option to override the color of the scrollbar track.
31
31
  * @cssproperty --mdc-themeprovider-scrollbar-thumb-color - Option to override the color of the scrollbar thumb.
32
32
  * @cssproperty --mdc-themeprovider-scrollbar-thumb-hover-color - Option to override the color of the
@@ -0,0 +1,38 @@
1
+ import { LitElement } from 'lit';
2
+ import type { Constructor } from './index.types';
3
+ export interface AssociatedFormControl {
4
+ autofocus: boolean;
5
+ disabled: boolean;
6
+ name: string;
7
+ value: string | string[];
8
+ pattern?: string;
9
+ min?: number | string;
10
+ max?: number | string;
11
+ step?: number;
12
+ required?: boolean;
13
+ minLength?: number;
14
+ maxLength?: number;
15
+ validationMessage?: string;
16
+ readonly form: HTMLFormElement | null;
17
+ readonly validity: ValidityState;
18
+ readonly willValidate: boolean;
19
+ checkValidity(): boolean;
20
+ reportValidity(): boolean;
21
+ formDisabledCallback?(disabled: boolean): void;
22
+ formResetCallback(): void;
23
+ formStateRestoreCallback(state: string | FormData | File, mode: 'restore' | 'autocomplete'): void;
24
+ }
25
+ export interface FormInternalsMixinInterface {
26
+ name: string;
27
+ value: string;
28
+ form: HTMLFormElement | null;
29
+ validity: ValidityState;
30
+ validationMessage: string;
31
+ willValidate: boolean;
32
+ internals: ElementInternals;
33
+ inputElement: HTMLInputElement;
34
+ setValidity(): void;
35
+ checkValidity(): boolean;
36
+ reportValidity(): boolean;
37
+ }
38
+ export declare const FormInternalsMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<FormInternalsMixinInterface> & T;
@@ -0,0 +1,79 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { property, query } from 'lit/decorators.js';
11
+ import { v4 as uuidv4 } from 'uuid';
12
+ export const FormInternalsMixin = (superClass) => {
13
+ class InnerMixinClass extends superClass {
14
+ /** @internal */
15
+ get form() {
16
+ return this.internals.form;
17
+ }
18
+ get validity() {
19
+ return this.internals.validity;
20
+ }
21
+ get willValidate() {
22
+ return this.internals.willValidate;
23
+ }
24
+ constructor(...args) {
25
+ super(args);
26
+ /**
27
+ * Indicates the name of the component group.
28
+ * They are used to group elements in a form together.
29
+ * @default ''
30
+ */
31
+ this.name = '';
32
+ /**
33
+ * Indicates the value of the component group (ex: input, checkbox, radio, select etc...)
34
+ * @default ''
35
+ */
36
+ this.value = '';
37
+ /** @internal */
38
+ this.internals = this.attachInternals();
39
+ this.id = `mdc-input-${uuidv4()}`;
40
+ }
41
+ /**
42
+ * Sets the validity of the input field based on the input field's validity.
43
+ * @returns void
44
+ */
45
+ setValidity() {
46
+ if (this.inputElement) {
47
+ this.internals.setValidity(this.inputElement.validity, this.inputElement.validationMessage, this.inputElement);
48
+ }
49
+ }
50
+ checkValidity() {
51
+ this.setValidity();
52
+ return this.internals.checkValidity();
53
+ }
54
+ reportValidity() {
55
+ this.setValidity();
56
+ return this.internals.reportValidity();
57
+ }
58
+ }
59
+ /** @internal */
60
+ InnerMixinClass.formAssociated = true;
61
+ __decorate([
62
+ property({ reflect: true, type: String }),
63
+ __metadata("design:type", Object)
64
+ ], InnerMixinClass.prototype, "name", void 0);
65
+ __decorate([
66
+ property({ reflect: true, type: String }),
67
+ __metadata("design:type", Object)
68
+ ], InnerMixinClass.prototype, "value", void 0);
69
+ __decorate([
70
+ property({ reflect: true, type: String, attribute: 'validation-message' }),
71
+ __metadata("design:type", String)
72
+ ], InnerMixinClass.prototype, "validationMessage", void 0);
73
+ __decorate([
74
+ query('input'),
75
+ __metadata("design:type", HTMLInputElement)
76
+ ], InnerMixinClass.prototype, "inputElement", void 0);
77
+ // Cast return type to your mixin's interface intersected with the superClass type
78
+ return InnerMixinClass;
79
+ };
package/package.json CHANGED
@@ -38,5 +38,5 @@
38
38
  "lit": "^3.2.0",
39
39
  "uuid": "^11.0.5"
40
40
  },
41
- "version": "0.28.2"
41
+ "version": "0.28.4"
42
42
  }
@@ -1,6 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import type { Constructor } from './index.types';
3
- export interface NameMixinInterface {
4
- name: string;
5
- }
6
- export declare const NameMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<NameMixinInterface> & T;
@@ -1,29 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { property } from 'lit/decorators.js';
11
- export const NameMixin = (superClass) => {
12
- class InnerMixinClass extends superClass {
13
- constructor() {
14
- super(...arguments);
15
- /**
16
- * Indicates the name of the component group (ex: checkbox, radio group).
17
- * They are used to group elements in a form together.
18
- * @default ''
19
- */
20
- this.name = '';
21
- }
22
- }
23
- __decorate([
24
- property({ reflect: true, type: String }),
25
- __metadata("design:type", Object)
26
- ], InnerMixinClass.prototype, "name", void 0);
27
- // Cast return type to your mixin's interface intersected with the superClass type
28
- return InnerMixinClass;
29
- };
@@ -1,6 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import type { Constructor } from './index.types';
3
- export interface ReadonlyMixinInterface {
4
- readonly: boolean;
5
- }
6
- export declare const ReadonlyMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<ReadonlyMixinInterface> & T;
@@ -1,29 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { property } from 'lit/decorators.js';
11
- export const ReadonlyMixin = (superClass) => {
12
- class InnerMixinClass extends superClass {
13
- constructor() {
14
- super(...arguments);
15
- /**
16
- * Indicates whether the component is readonly.
17
- * When the component is readonly, it is not editable.
18
- * @default false
19
- */
20
- this.readonly = false;
21
- }
22
- }
23
- __decorate([
24
- property({ reflect: true, type: Boolean }),
25
- __metadata("design:type", Object)
26
- ], InnerMixinClass.prototype, "readonly", void 0);
27
- // Cast return type to your mixin's interface intersected with the superClass type
28
- return InnerMixinClass;
29
- };
@@ -1,6 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import type { Constructor } from './index.types';
3
- export interface RequiredMixinInterface {
4
- required: boolean;
5
- }
6
- export declare const RequiredMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<RequiredMixinInterface> & T;
@@ -1,29 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { property } from 'lit/decorators.js';
11
- export const RequiredMixin = (superClass) => {
12
- class InnerMixinClass extends superClass {
13
- constructor() {
14
- super(...arguments);
15
- /**
16
- * Indicates whether the component is required.
17
- * When the component is required, it is a mandatory field.
18
- * @default false
19
- */
20
- this.required = false;
21
- }
22
- }
23
- __decorate([
24
- property({ reflect: true, type: Boolean }),
25
- __metadata("design:type", Object)
26
- ], InnerMixinClass.prototype, "required", void 0);
27
- // Cast return type to your mixin's interface intersected with the superClass type
28
- return InnerMixinClass;
29
- };
@@ -1,6 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import type { Constructor } from './index.types';
3
- export interface ValueMixinInterface {
4
- value: string;
5
- }
6
- export declare const ValueMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<ValueMixinInterface> & T;
@@ -1,28 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { property } from 'lit/decorators.js';
11
- export const ValueMixin = (superClass) => {
12
- class InnerMixinClass extends superClass {
13
- constructor() {
14
- super(...arguments);
15
- /**
16
- * Indicates the value of the component group (ex: input, checkbox, radio, select etc...)
17
- * @default ''
18
- */
19
- this.value = '';
20
- }
21
- }
22
- __decorate([
23
- property({ reflect: true, type: String }),
24
- __metadata("design:type", Object)
25
- ], InnerMixinClass.prototype, "value", void 0);
26
- // Cast return type to your mixin's interface intersected with the superClass type
27
- return InnerMixinClass;
28
- };