@momentum-design/components 0.134.21 → 0.135.0

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 (50) hide show
  1. package/dist/browser/index.js +582 -477
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/datepicker/datepicker.component.d.ts +5 -0
  4. package/dist/components/datepicker/datepicker.component.js +96 -26
  5. package/dist/components/formfieldwrapper/formfieldwrapper.component.js +7 -3
  6. package/dist/components/formfieldwrapper/formfieldwrapper.constants.js +2 -7
  7. package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +10 -0
  8. package/dist/components/formfieldwrapper/formfieldwrapper.types.d.ts +2 -2
  9. package/dist/components/formfieldwrapper/formfieldwrapper.utils.js +2 -11
  10. package/dist/components/formfieldwrapper/index.d.ts +1 -0
  11. package/dist/components/formfieldwrapper/index.js +1 -0
  12. package/dist/components/menubar/menubar.component.js +2 -1
  13. package/dist/components/menupopover/menupopover.component.d.ts +1 -1
  14. package/dist/components/menupopover/menupopover.component.js +4 -4
  15. package/dist/components/navmenuitem/navmenuitem.component.d.ts +32 -2
  16. package/dist/components/navmenuitem/navmenuitem.component.js +146 -9
  17. package/dist/components/navmenuitem/navmenuitem.constants.d.ts +1 -0
  18. package/dist/components/navmenuitem/navmenuitem.constants.js +1 -0
  19. package/dist/components/navmenuitem/navmenuitem.styles.js +16 -5
  20. package/dist/components/sidenavigation/sidenavigation.component.d.ts +43 -3
  21. package/dist/components/sidenavigation/sidenavigation.component.js +240 -8
  22. package/dist/components/sidenavigation/sidenavigation.constants.d.ts +6 -1
  23. package/dist/components/sidenavigation/sidenavigation.constants.js +6 -1
  24. package/dist/components/sidenavigation/sidenavigation.context.d.ts +6 -1
  25. package/dist/components/sidenavigation/sidenavigation.context.js +36 -11
  26. package/dist/components/sidenavigation/sidenavigation.types.d.ts +3 -2
  27. package/dist/components/sidenavigation/sidenavigationbase.d.ts +8 -0
  28. package/dist/components/sidenavigation/sidenavigationbase.js +7 -0
  29. package/dist/components/statusmessage/index.d.ts +9 -0
  30. package/dist/components/statusmessage/index.js +8 -0
  31. package/dist/components/statusmessage/statusmessage.component.d.ts +54 -0
  32. package/dist/components/statusmessage/statusmessage.component.js +80 -0
  33. package/dist/components/statusmessage/statusmessage.constants.d.ts +28 -0
  34. package/dist/components/statusmessage/statusmessage.constants.js +31 -0
  35. package/dist/components/statusmessage/statusmessage.styles.d.ts +2 -0
  36. package/dist/components/statusmessage/statusmessage.styles.js +66 -0
  37. package/dist/components/statusmessage/statusmessage.types.d.ts +5 -0
  38. package/dist/components/statusmessage/statusmessage.types.js +2 -0
  39. package/dist/custom-elements.json +283 -10
  40. package/dist/index.d.ts +4 -2
  41. package/dist/index.js +2 -1
  42. package/dist/models/provider/provider.component.d.ts +2 -2
  43. package/dist/models/provider/provider.component.js +13 -0
  44. package/dist/react/index.d.ts +1 -0
  45. package/dist/react/index.js +1 -0
  46. package/dist/react/navmenuitem/index.d.ts +4 -2
  47. package/dist/react/navmenuitem/index.js +3 -1
  48. package/dist/react/statusmessage/index.d.ts +37 -0
  49. package/dist/react/statusmessage/index.js +32 -0
  50. package/package.json +1 -1
@@ -0,0 +1,54 @@
1
+ import { CSSResult } from 'lit';
2
+ import { Component } from '../../models';
3
+ import type { StatusMessageSeverity } from './statusmessage.types';
4
+ /**
5
+ * The status message is a compact inline message used to communicate helper, validation, or status text with an optional severity icon. It is intentionally lightweight and does not behave like an alert or live region by default.
6
+ *
7
+ * **When to use**
8
+ *
9
+ * - Use `mdc-statusmessage` for short inline messages that sit near a related control, setting, or content region.
10
+ * - Use a severity when the message needs a visual state such as error, warning, success, or priority.
11
+ * - Use the `icon` slot when a custom visual icon is required instead of the built-in severity icon.
12
+ *
13
+ * **When not to use**
14
+ *
15
+ * - Use `mdc-banner`, `mdc-toast`, or `mdc-announcementdialog` when the message needs more prominence, actions, dismissal, or system-level announcement behaviour.
16
+ * - Use form components' `help-text` APIs for standard field helper or validation text; those components compose `mdc-statusmessage` internally.
17
+ * - Use plain `mdc-text` when no severity styling or icon treatment is needed.
18
+ *
19
+ * @tagname mdc-statusmessage
20
+ *
21
+ * @dependency mdc-icon
22
+ * @dependency mdc-text
23
+ *
24
+ * @slot default - Message content. Slotted content takes precedence over the `message` attribute.
25
+ * @slot icon - Custom icon content. Overrides the default severity icon.
26
+ *
27
+ * @csspart container - The container for the icon and message text.
28
+ * @csspart icon - The default severity icon slot or rendered icon.
29
+ * @csspart text - The rendered message text when using the `message` attribute.
30
+ *
31
+ * @cssproperty --mdc-statusmessage-color - Color for the icon and message text.
32
+ * @cssproperty --mdc-statusmessage-font-size - Font size for the message text.
33
+ * @cssproperty --mdc-statusmessage-font-weight - Font weight for the message text.
34
+ * @cssproperty --mdc-statusmessage-line-height - Line height for the message text.
35
+ * @cssproperty --mdc-statusmessage-gap - Gap between the icon and message text.
36
+ * @cssproperty --mdc-statusmessage-icon-size - Width and height of the default severity icon.
37
+ */
38
+ declare class StatusMessage extends Component {
39
+ /**
40
+ * The severity used to set the status message color and default icon.
41
+ * Can be `default`, `error`, `warning`, `success`, or `priority`.
42
+ * @default default
43
+ */
44
+ severity: StatusMessageSeverity;
45
+ /**
46
+ * Message text to render when no default slot content is provided.
47
+ */
48
+ message?: string;
49
+ private renderIcon;
50
+ private renderMessage;
51
+ render(): import("lit-html").TemplateResult<1>;
52
+ static styles: Array<CSSResult>;
53
+ }
54
+ export default StatusMessage;
@@ -0,0 +1,80 @@
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
+ // AI-Assisted
11
+ import { html, nothing } from 'lit';
12
+ import { property } from 'lit/decorators.js';
13
+ import { Component } from '../../models';
14
+ import { DEFAULTS, STATUSMESSAGE_ICON_NAME_BY_SEVERITY } from './statusmessage.constants';
15
+ import styles from './statusmessage.styles';
16
+ /**
17
+ * @tagname mdc-statusmessage
18
+ *
19
+ * @dependency mdc-icon
20
+ * @dependency mdc-text
21
+ *
22
+ * @slot default - Message content. Slotted content takes precedence over the `message` attribute.
23
+ * @slot icon - Custom icon content. Overrides the default severity icon.
24
+ *
25
+ * @csspart container - The container for the icon and message text.
26
+ * @csspart icon - The default severity icon slot or rendered icon.
27
+ * @csspart text - The rendered message text when using the `message` attribute.
28
+ *
29
+ * @cssproperty --mdc-statusmessage-color - Color for the icon and message text.
30
+ * @cssproperty --mdc-statusmessage-font-size - Font size for the message text.
31
+ * @cssproperty --mdc-statusmessage-font-weight - Font weight for the message text.
32
+ * @cssproperty --mdc-statusmessage-line-height - Line height for the message text.
33
+ * @cssproperty --mdc-statusmessage-gap - Gap between the icon and message text.
34
+ * @cssproperty --mdc-statusmessage-icon-size - Width and height of the default severity icon.
35
+ */
36
+ class StatusMessage extends Component {
37
+ constructor() {
38
+ super(...arguments);
39
+ /**
40
+ * The severity used to set the status message color and default icon.
41
+ * Can be `default`, `error`, `warning`, `success`, or `priority`.
42
+ * @default default
43
+ */
44
+ this.severity = DEFAULTS.SEVERITY;
45
+ }
46
+ renderIcon() {
47
+ const icon = STATUSMESSAGE_ICON_NAME_BY_SEVERITY[this.severity || DEFAULTS.SEVERITY];
48
+ if (!icon) {
49
+ return nothing;
50
+ }
51
+ return html `<mdc-icon part="icon" name="${icon}"></mdc-icon>`;
52
+ }
53
+ renderMessage() {
54
+ if (!this.message) {
55
+ return nothing;
56
+ }
57
+ return html `
58
+ <mdc-text part="text" tagname="${DEFAULTS.TEXT_TAGNAME}" type="${DEFAULTS.TEXT_TYPE}">${this.message}</mdc-text>
59
+ `;
60
+ }
61
+ render() {
62
+ return html `
63
+ <div part="container">
64
+ <slot name="icon" part="icon">${this.renderIcon()}</slot>
65
+ <slot part="text">${this.renderMessage()}</slot>
66
+ </div>
67
+ `;
68
+ }
69
+ }
70
+ StatusMessage.styles = [...Component.styles, ...styles];
71
+ __decorate([
72
+ property({ type: String, reflect: true }),
73
+ __metadata("design:type", String)
74
+ ], StatusMessage.prototype, "severity", void 0);
75
+ __decorate([
76
+ property({ type: String, reflect: true }),
77
+ __metadata("design:type", String)
78
+ ], StatusMessage.prototype, "message", void 0);
79
+ export default StatusMessage;
80
+ // End AI-Assisted
@@ -0,0 +1,28 @@
1
+ import type { IconNames } from '../icon/icon.types';
2
+ declare const TAG_NAME: "mdc-statusmessage";
3
+ declare const STATUSMESSAGE_SEVERITY: {
4
+ readonly DEFAULT: "default";
5
+ readonly ERROR: "error";
6
+ readonly PRIORITY: "priority";
7
+ readonly SUCCESS: "success";
8
+ readonly WARNING: "warning";
9
+ };
10
+ declare const STATUSMESSAGE_ICON_NAMES: {
11
+ readonly ERROR: Extract<IconNames, "error-legacy-badge-filled">;
12
+ readonly WARNING: Extract<IconNames, "warning-badge-filled">;
13
+ readonly SUCCESS: Extract<IconNames, "check-circle-badge-filled">;
14
+ readonly PRIORITY: Extract<IconNames, "priority-badge-filled">;
15
+ };
16
+ declare const STATUSMESSAGE_ICON_NAME_BY_SEVERITY: {
17
+ readonly default: "";
18
+ readonly error: "error-legacy-badge-filled";
19
+ readonly warning: "warning-badge-filled";
20
+ readonly success: "check-circle-badge-filled";
21
+ readonly priority: "priority-badge-filled";
22
+ };
23
+ declare const DEFAULTS: {
24
+ readonly SEVERITY: "default";
25
+ readonly TEXT_TAGNAME: "span";
26
+ readonly TEXT_TYPE: "body-midsize-regular";
27
+ };
28
+ export { DEFAULTS, STATUSMESSAGE_ICON_NAME_BY_SEVERITY, STATUSMESSAGE_ICON_NAMES, STATUSMESSAGE_SEVERITY, TAG_NAME };
@@ -0,0 +1,31 @@
1
+ // AI-Assisted
2
+ import utils from '../../utils/tag-name';
3
+ import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
4
+ const TAG_NAME = utils.constructTagName('statusmessage');
5
+ const STATUSMESSAGE_SEVERITY = {
6
+ DEFAULT: 'default',
7
+ ERROR: 'error',
8
+ PRIORITY: 'priority',
9
+ SUCCESS: 'success',
10
+ WARNING: 'warning',
11
+ };
12
+ const STATUSMESSAGE_ICON_NAMES = {
13
+ ERROR: 'error-legacy-badge-filled',
14
+ WARNING: 'warning-badge-filled',
15
+ SUCCESS: 'check-circle-badge-filled',
16
+ PRIORITY: 'priority-badge-filled',
17
+ };
18
+ const STATUSMESSAGE_ICON_NAME_BY_SEVERITY = {
19
+ [STATUSMESSAGE_SEVERITY.DEFAULT]: '',
20
+ [STATUSMESSAGE_SEVERITY.ERROR]: STATUSMESSAGE_ICON_NAMES.ERROR,
21
+ [STATUSMESSAGE_SEVERITY.WARNING]: STATUSMESSAGE_ICON_NAMES.WARNING,
22
+ [STATUSMESSAGE_SEVERITY.SUCCESS]: STATUSMESSAGE_ICON_NAMES.SUCCESS,
23
+ [STATUSMESSAGE_SEVERITY.PRIORITY]: STATUSMESSAGE_ICON_NAMES.PRIORITY,
24
+ };
25
+ const DEFAULTS = {
26
+ SEVERITY: STATUSMESSAGE_SEVERITY.DEFAULT,
27
+ TEXT_TAGNAME: VALID_TEXT_TAGS.SPAN,
28
+ TEXT_TYPE: TYPE.BODY_MIDSIZE_REGULAR,
29
+ };
30
+ export { DEFAULTS, STATUSMESSAGE_ICON_NAME_BY_SEVERITY, STATUSMESSAGE_ICON_NAMES, STATUSMESSAGE_SEVERITY, TAG_NAME };
31
+ // End AI-Assisted
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,66 @@
1
+ // AI-Assisted
2
+ import { css } from 'lit';
3
+ const styles = css `
4
+ :host {
5
+ --mdc-statusmessage-color: var(--mds-color-theme-text-secondary-normal);
6
+ --mdc-statusmessage-font-size: var(--mds-font-apps-body-midsize-regular-font-size);
7
+ --mdc-statusmessage-font-weight: var(--mds-font-apps-body-midsize-regular-font-weight);
8
+ --mdc-statusmessage-line-height: var(--mds-font-apps-body-midsize-regular-line-height);
9
+ --mdc-statusmessage-gap: 0.5rem;
10
+ --mdc-statusmessage-icon-size: 1rem;
11
+
12
+ display: block;
13
+ width: fit-content;
14
+ color: var(--mdc-statusmessage-color);
15
+ font-size: var(--mdc-statusmessage-font-size);
16
+ font-weight: var(--mdc-statusmessage-font-weight);
17
+ line-height: var(--mdc-statusmessage-line-height);
18
+ }
19
+
20
+ :host([severity='error']) {
21
+ --mdc-statusmessage-color: var(--mds-color-theme-text-error-normal);
22
+ }
23
+
24
+ :host([severity='warning']) {
25
+ --mdc-statusmessage-color: var(--mds-color-theme-text-warning-normal);
26
+ }
27
+
28
+ :host([severity='success']) {
29
+ --mdc-statusmessage-color: var(--mds-color-theme-text-success-normal);
30
+ }
31
+
32
+ :host([severity='priority']) {
33
+ --mdc-statusmessage-color: var(--mds-color-theme-text-accent-normal);
34
+ }
35
+
36
+ [part='container'] {
37
+ display: flex;
38
+ align-items: center;
39
+ gap: var(--mdc-statusmessage-gap);
40
+ width: 100%;
41
+ color: var(--mdc-statusmessage-color);
42
+ font-size: var(--mdc-statusmessage-font-size);
43
+ font-weight: var(--mdc-statusmessage-font-weight);
44
+ line-height: var(--mdc-statusmessage-line-height);
45
+ }
46
+
47
+ [part='icon'],
48
+ ::slotted([slot='icon']) {
49
+ --mdc-icon-size: var(--mdc-statusmessage-icon-size);
50
+
51
+ align-self: flex-start;
52
+ flex-shrink: 0;
53
+ height: var(--mdc-statusmessage-icon-size);
54
+ margin-block-start: 0.125rem;
55
+ }
56
+
57
+ [part='text'],
58
+ ::slotted(*) {
59
+ color: inherit;
60
+ font-size: inherit;
61
+ font-weight: inherit;
62
+ line-height: inherit;
63
+ }
64
+ `;
65
+ export default [styles];
66
+ // End AI-Assisted
@@ -0,0 +1,5 @@
1
+ import type { ValueOf } from '../../utils/types';
2
+ import { STATUSMESSAGE_ICON_NAME_BY_SEVERITY, STATUSMESSAGE_SEVERITY } from './statusmessage.constants';
3
+ type StatusMessageSeverity = ValueOf<typeof STATUSMESSAGE_SEVERITY>;
4
+ type StatusMessageIcon = ValueOf<typeof STATUSMESSAGE_ICON_NAME_BY_SEVERITY>;
5
+ export type { StatusMessageIcon, StatusMessageSeverity };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ // End AI-Assisted