@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.71 → 2.0.0-next.73
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/bundle/openbridge-webcomponents.bundle.js +92 -13
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +116 -14
- package/dist/components/alert-menu-item/alert-menu-item.d.ts +39 -1
- package/dist/components/alert-menu-item/alert-menu-item.d.ts.map +1 -1
- package/dist/components/alert-menu-item/alert-menu-item.js +41 -0
- package/dist/components/alert-menu-item/alert-menu-item.js.map +1 -1
- package/dist/components/message-menu-item/message-menu-item.d.ts +4 -0
- package/dist/components/message-menu-item/message-menu-item.d.ts.map +1 -1
- package/dist/components/message-menu-item/message-menu-item.js +10 -0
- package/dist/components/message-menu-item/message-menu-item.js.map +1 -1
- package/dist/integration-systems/integration-vessel-menu/integration-vessel-menu.css.js +17 -2
- package/dist/integration-systems/integration-vessel-menu/integration-vessel-menu.css.js.map +1 -1
- package/dist/integration-systems/integration-vessel-menu/integration-vessel-menu.d.ts +24 -2
- package/dist/integration-systems/integration-vessel-menu/integration-vessel-menu.d.ts.map +1 -1
- package/dist/integration-systems/integration-vessel-menu/integration-vessel-menu.js +32 -11
- package/dist/integration-systems/integration-vessel-menu/integration-vessel-menu.js.map +1 -1
- package/package.json +1 -1
- package/src/components/alert-menu-item/alert-menu-item.stories.ts +40 -1
- package/src/components/alert-menu-item/alert-menu-item.ts +67 -1
- package/src/components/message-menu-item/message-menu-item.stories.ts +18 -0
- package/src/components/message-menu-item/message-menu-item.ts +6 -0
- package/src/integration-systems/integration-vessel-menu/integration-vessel-menu.css +15 -2
- package/src/integration-systems/integration-vessel-menu/integration-vessel-menu.stories.ts +102 -72
- package/src/integration-systems/integration-vessel-menu/integration-vessel-menu.ts +45 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-menu-item.js","sources":["../../../src/components/message-menu-item/message-menu-item.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport compentStyle from './message-menu-item.css?inline';\nimport {classMap} from 'lit/directives/class-map.js';\nimport '../button/button.js';\nimport '../../icons/icon-chevron-down-google.js';\nimport '../../icons/icon-chevron-up-google.js';\nimport {customElement} from '../../decorator.js';\nimport '../../icons/icon-alerts-shelf.js';\n\nexport enum ObcMessageMenuItemSize {\n SingleLine = 'single-line',\n DoubleLine = 'double-line',\n}\n\n/**\n * `<obc-message-menu-item>` – An expandable message or notification item for use in message lists, notification panels, or alert menus.\n *\n * Displays a concise message row with optional icons, title, description, timestamp, and action buttons. Clicking the item expands it to reveal the full content. Designed for scannable lists where users may need to quickly review and act on individual messages.\n *\n * ## Features\n *\n * - **Size Variants:**\n * - `single-line`: Compact layout with title and description on one line (default).\n * - `double-line`: Two-line layout with title on top and description below.\n * - When clicked, both variants expand to show full multi-line content.\n *\n * - **Stack Direction:**\n * - `stackVertical=false` (default): Action buttons appear inline to the right of the content.\n * - `stackVertical=true`: Action buttons appear below the content, spanning full width.\n *\n * - **Icon Options:**\n * - Primary and secondary icon slots for visual context or status indicators.\n * - Enhanced icon mode (`enhancedIcon`) increases icon size for emphasis.\n * - Trailing icon slot (horizontal layout only) for additional actions.\n * - Shelved state (`isShelved`) displays a shelf icon automatically.\n *\n * - **Actions:**\n * - Supports up to two action buttons via `primaryActionLabel` and `secondaryActionLabel`.\n * - In vertical layout, action buttons expand to full width.\n *\n * - **Timestamp:**\n * - Optional day and time display via `day` and `time` properties.\n *\n * ## Usage Guidelines\n *\n * Use `obc-message-menu-item` to present individual notifications, alerts, or messages within a scrollable list. Ideal for scenarios where users need to quickly scan items, expand for details, or take immediate action.\n *\n * - Use `single-line` for high-density lists where space is limited.\n * - Use `double-line` when the description needs more visibility in the collapsed state.\n * - Keep `stackVertical=false` (default) when actions should be quickly accessible inline.\n * - Use `stackVertical=true` when actions need more prominence or when space is narrow.\n * - Enable `enhancedIcon` to highlight important or priority messages.\n * - Use `isShelved` to indicate messages that have been temporarily set aside.\n *\n * ## Slots\n *\n * Text content for `title`, `description`, and `action-label` supports both props (for plain text) and slots (for rich HTML like `CO<sub>2</sub>`).\n * To use a slot, set the corresponding `has*Slot` prop to `true`.\n *\n * | Slot Name | Enabled By | Purpose |\n * |------------------|--------------------------|---------------------------------------------------|\n * | `title` | `hasTitleSlot=true` | Message title. Use slot for rich HTML. |\n * | `description` | `hasDescriptionSlot=true`| Message description. Use slot for rich HTML. |\n * | `action-label` | `hasActionLabelSlot=true`| Primary action button label. Use slot for rich HTML. |\n * | `primary-icon` | `hasPrimaryIcon=true` | Main icon representing message type or status. |\n * | `secondary-icon` | `hasSecondaryIcon=true` | Additional icon for secondary status or context. |\n * | `trailing-icon` | `hasTrailingIcon=true` (horizontal only) | Icon button after action buttons. |\n *\n * ## Events\n *\n * - `message-click` – Fired when the message item is clicked. Detail includes `{ open: boolean }`.\n * - `primary-action-click` – Fired when the primary action button is clicked.\n * - `secondary-action-click` – Fired when the secondary action button is clicked.\n *\n * ## Example\n *\n * Using props (simple text):\n * ```html\n * <obc-message-menu-item\n * size=\"double-line\"\n * title=\"System Update\"\n * description=\"A new update is available for installation.\"\n * day=\"Yesterday\"\n * time=\"14:32\"\n * primaryActionLabel=\"Install\"\n * hasPrimaryIcon\n * >\n * <obi-placeholder slot=\"primary-icon\"></obi-placeholder>\n * </obc-message-menu-item>\n * ```\n *\n * Using slots (rich HTML):\n * ```html\n * <obc-message-menu-item\n * size=\"double-line\"\n * day=\"Yesterday\"\n * time=\"14:32\"\n * hasPrimaryIcon\n * hasTitleSlot\n * hasDescriptionSlot\n * hasActionLabelSlot\n * >\n * <span slot=\"title\">High CO<sub>2</sub> level</span>\n * <span slot=\"description\">CO<sub>2</sub> concentration exceeds safe limits.</span>\n * <span slot=\"action-label\">Acknowledge</span>\n * <obi-placeholder slot=\"primary-icon\"></obi-placeholder>\n * </obc-message-menu-item>\n * ```\n *\n * @slot title - Message title (shown when `hasTitleSlot` is true).\n * @slot description - Message description (shown when `hasDescriptionSlot` is true).\n * @slot action-label - Primary action button label (shown when `hasActionLabelSlot` is true).\n * @slot primary-icon - Main icon representing the message type or status (shown when `hasPrimaryIcon` is true).\n * @slot secondary-icon - Additional icon for secondary status/context (shown when `hasSecondaryIcon` is true).\n * @slot trailing-icon - Icon after action buttons, horizontal layout only (shown when `hasTrailingIcon` is true).\n * @fires message-click {CustomEvent<{open: boolean}>} Fired when the message item is clicked.\n * @fires primary-action-click {CustomEvent<void>} Fired when the primary action button is clicked.\n * @fires secondary-action-click {CustomEvent<void>} Fired when the secondary action button is clicked.\n */\n@customElement('obc-message-menu-item')\nexport class ObcMessageMenuItem extends LitElement {\n // Layout properties\n @property({type: String}) size: ObcMessageMenuItemSize =\n ObcMessageMenuItemSize.SingleLine;\n @property({type: Boolean}) stackVertical = false;\n @property({type: Boolean}) enhancedIcon = false;\n @property({type: Boolean}) open = false;\n\n // Text content properties\n @property({type: String}) override title = '';\n @property({type: String}) description = '';\n @property({type: String}) day = '';\n @property({type: String}) time = '';\n @property({type: String}) primaryActionLabel = '';\n @property({type: String}) secondaryActionLabel = '';\n\n // Visibility properties for icons (slots)\n @property({type: Boolean}) hasPrimaryIcon = false;\n @property({type: Boolean}) hasSecondaryIcon = false;\n @property({type: Boolean}) hasTrailingIcon = false;\n @property({type: Boolean}) isShelved = false;\n\n @property({type: Boolean}) hasActionLabelSlot = false;\n\n private get activeSize() {\n if (this.open) {\n return 'multi-line';\n }\n return this.size;\n }\n\n private get hasTimestamp() {\n return this.time !== '' || this.day !== '';\n }\n\n private get hasDay() {\n return this.day !== '';\n }\n\n private get hasPrimaryAction() {\n return this.primaryActionLabel !== '' || this.hasActionLabelSlot;\n }\n\n private get hasSecondaryAction() {\n return this.secondaryActionLabel !== '';\n }\n\n private get isVertical() {\n return this.stackVertical;\n }\n\n private handleKeyDown(e: KeyboardEvent) {\n // Only handle key events on the wrapper itself, not on nested interactive elements\n if (e.target !== e.currentTarget) {\n return;\n }\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.handleMessageClick();\n }\n }\n\n private handleMessageClick() {\n this.open = !this.open;\n\n this.dispatchEvent(\n new CustomEvent('message-click', {\n detail: {\n open: this.open,\n },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handlePrimaryActionClick(e: Event) {\n e.stopPropagation();\n\n this.dispatchEvent(\n new CustomEvent('primary-action-click', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleSecondaryActionClick(e: Event) {\n e.stopPropagation();\n\n this.dispatchEvent(\n new CustomEvent('secondary-action-click', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n override render() {\n return html`\n <div\n class=${classMap({\n wrapper: true,\n ['active-size-' + this.activeSize]: true,\n ['size-' + this.size]: true,\n ['enhanced-icon']: this.enhancedIcon,\n ['has-date']: this.hasTimestamp,\n ['stack-vertical']: this.stackVertical,\n ['stack-horizontal']: !this.stackVertical,\n })}\n role=\"button\"\n tabindex=\"0\"\n @click=${this.handleMessageClick}\n @keydown=${this.handleKeyDown}\n >\n <div class=\"content-container\">\n <div class=\"icon-container\">\n ${this.isShelved\n ? html`<div class=\"icon\">\n <obi-alerts-shelf></obi-alerts-shelf>\n </div>`\n : nothing}\n ${this.hasPrimaryIcon\n ? html`<div class=\"icon primary\">\n <slot name=\"primary-icon\"></slot>\n </div>`\n : nothing}\n ${this.hasSecondaryIcon\n ? html`<div class=\"icon secondary\">\n <slot name=\"secondary-icon\"></slot>\n </div>`\n : nothing}\n </div>\n <div class=\"text-container\">\n <div class=\"title-container\">\n <slot name=\"title\">${this.title}</slot>\n </div>\n <div class=\"description-container\">\n <slot name=\"description\">${this.description}</slot>\n </div>\n ${this.hasTimestamp\n ? html`<div class=\"date-container\">\n ${this.hasDay ? html`<span>${this.day}</span>` : nothing}\n <span>${this.time}</span>\n </div>`\n : nothing}\n <div class=\"chevron\">\n ${this.open\n ? html`<obi-chevron-up-google></obi-chevron-up-google>`\n : html`<obi-chevron-down-google></obi-chevron-down-google>`}\n </div>\n </div>\n </div>\n ${this.hasPrimaryAction ||\n this.hasSecondaryAction ||\n (this.hasTrailingIcon && !this.isVertical)\n ? html`<div class=\"action-button-container\" part=\"action-container\">\n ${this.hasSecondaryAction\n ? html`<obc-button\n variant=\"normal\"\n .fullWidth=${this.isVertical}\n @click=${this.handleSecondaryActionClick}\n >\n ${this.secondaryActionLabel}\n </obc-button>`\n : nothing}\n ${this.hasPrimaryAction\n ? html`<obc-button\n variant=\"normal\"\n .fullWidth=${this.isVertical}\n @click=${this.handlePrimaryActionClick}\n >\n ${this.hasActionLabelSlot\n ? html`<slot name=\"action-label\"></slot>`\n : this.primaryActionLabel}\n </obc-button>`\n : nothing}\n ${this.hasTrailingIcon && !this.isVertical\n ? html`<div class=\"trailing-icon\" part=\"trailing-icon\">\n <slot name=\"trailing-icon\"></slot>\n </div>`\n : nothing}\n </div>`\n : nothing}\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-message-menu-item': ObcMessageMenuItem;\n }\n}\n"],"names":["ObcMessageMenuItemSize"],"mappings":";;;;;;;;;;;;;;;;;;;AAUO,IAAK,2CAAAA,4BAAL;AACLA,0BAAA,YAAA,IAAa;AACbA,0BAAA,YAAA,IAAa;AAFH,SAAAA;AAAA,GAAA,0BAAA,CAAA,CAAA;AA+GL,IAAM,qBAAN,cAAiC,WAAW;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AAEqB,SAAA,OACxB;AACyB,SAAA,gBAAgB;AAChB,SAAA,eAAe;AACf,SAAA,OAAO;AAGR,SAAS,QAAQ;AACjB,SAAA,cAAc;AACd,SAAA,MAAM;AACN,SAAA,OAAO;AACP,SAAA,qBAAqB;AACrB,SAAA,uBAAuB;AAGtB,SAAA,iBAAiB;AACjB,SAAA,mBAAmB;AACnB,SAAA,kBAAkB;AAClB,SAAA,YAAY;AAEZ,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A,oBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAnBd,mBAmBgB,WAAA,mBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GApBd,mBAoBgB,WAAA,aAAA,CAAA;AAEA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAtBd,mBAsBgB,WAAA,sBAAA,CAAA;AAtBhB,qBAAN,gBAAA;AAAA,EADN,cAAc,uBAAuB;AAAA,GACzB,kBAAA;"}
|
|
1
|
+
{"version":3,"file":"message-menu-item.js","sources":["../../../src/components/message-menu-item/message-menu-item.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport compentStyle from './message-menu-item.css?inline';\nimport {classMap} from 'lit/directives/class-map.js';\nimport '../button/button.js';\nimport '../../icons/icon-chevron-down-google.js';\nimport '../../icons/icon-chevron-up-google.js';\nimport {customElement} from '../../decorator.js';\nimport '../../icons/icon-alerts-shelf.js';\n\nexport enum ObcMessageMenuItemSize {\n SingleLine = 'single-line',\n DoubleLine = 'double-line',\n}\n\n/**\n * `<obc-message-menu-item>` – An expandable message or notification item for use in message lists, notification panels, or alert menus.\n *\n * Displays a concise message row with optional icons, title, description, timestamp, and action buttons. Clicking the item expands it to reveal the full content. Designed for scannable lists where users may need to quickly review and act on individual messages.\n *\n * ## Features\n *\n * - **Size Variants:**\n * - `single-line`: Compact layout with title and description on one line (default).\n * - `double-line`: Two-line layout with title on top and description below.\n * - When clicked, both variants expand to show full multi-line content.\n *\n * - **Stack Direction:**\n * - `stackVertical=false` (default): Action buttons appear inline to the right of the content.\n * - `stackVertical=true`: Action buttons appear below the content, spanning full width.\n *\n * - **Icon Options:**\n * - Primary and secondary icon slots for visual context or status indicators.\n * - Enhanced icon mode (`enhancedIcon`) increases icon size for emphasis.\n * - Trailing icon slot (horizontal layout only) for additional actions.\n * - Shelved state (`isShelved`) displays a shelf icon automatically.\n *\n * - **Actions:**\n * - Supports up to two action buttons via `primaryActionLabel` and `secondaryActionLabel`.\n * - Each action can be independently disabled by setting `enablePrimaryAction` or `enableSecondaryAction` to `false`.\n * - In vertical layout, action buttons expand to full width.\n *\n * - **Timestamp:**\n * - Optional day and time display via `day` and `time` properties.\n *\n * ## Usage Guidelines\n *\n * Use `obc-message-menu-item` to present individual notifications, alerts, or messages within a scrollable list. Ideal for scenarios where users need to quickly scan items, expand for details, or take immediate action.\n *\n * - Use `single-line` for high-density lists where space is limited.\n * - Use `double-line` when the description needs more visibility in the collapsed state.\n * - Keep `stackVertical=false` (default) when actions should be quickly accessible inline.\n * - Use `stackVertical=true` when actions need more prominence or when space is narrow.\n * - Enable `enhancedIcon` to highlight important or priority messages.\n * - Use `isShelved` to indicate messages that have been temporarily set aside.\n * - Set `enablePrimaryAction` / `enableSecondaryAction` to `false` when an action is temporarily unavailable (e.g. awaiting a precondition) rather than removing the button.\n *\n * ## Slots\n *\n * Text content for `title`, `description`, and `action-label` supports both props (for plain text) and slots (for rich HTML like `CO<sub>2</sub>`).\n * To use a slot, set the corresponding `has*Slot` prop to `true`.\n *\n * | Slot Name | Enabled By | Purpose |\n * |------------------|--------------------------|---------------------------------------------------|\n * | `title` | `hasTitleSlot=true` | Message title. Use slot for rich HTML. |\n * | `description` | `hasDescriptionSlot=true`| Message description. Use slot for rich HTML. |\n * | `action-label` | `hasActionLabelSlot=true`| Primary action button label. Use slot for rich HTML. |\n * | `primary-icon` | `hasPrimaryIcon=true` | Main icon representing message type or status. |\n * | `secondary-icon` | `hasSecondaryIcon=true` | Additional icon for secondary status or context. |\n * | `trailing-icon` | `hasTrailingIcon=true` (horizontal only) | Icon button after action buttons. |\n *\n * ## Events\n *\n * - `message-click` – Fired when the message item is clicked. Detail includes `{ open: boolean }`.\n * - `primary-action-click` – Fired when the primary action button is clicked.\n * - `secondary-action-click` – Fired when the secondary action button is clicked.\n *\n * ## Example\n *\n * Using props (simple text):\n * ```html\n * <obc-message-menu-item\n * size=\"double-line\"\n * title=\"System Update\"\n * description=\"A new update is available for installation.\"\n * day=\"Yesterday\"\n * time=\"14:32\"\n * primaryActionLabel=\"Install\"\n * hasPrimaryIcon\n * >\n * <obi-placeholder slot=\"primary-icon\"></obi-placeholder>\n * </obc-message-menu-item>\n * ```\n *\n * Using slots (rich HTML):\n * ```html\n * <obc-message-menu-item\n * size=\"double-line\"\n * day=\"Yesterday\"\n * time=\"14:32\"\n * hasPrimaryIcon\n * hasTitleSlot\n * hasDescriptionSlot\n * hasActionLabelSlot\n * >\n * <span slot=\"title\">High CO<sub>2</sub> level</span>\n * <span slot=\"description\">CO<sub>2</sub> concentration exceeds safe limits.</span>\n * <span slot=\"action-label\">Acknowledge</span>\n * <obi-placeholder slot=\"primary-icon\"></obi-placeholder>\n * </obc-message-menu-item>\n * ```\n *\n * @slot title - Message title (shown when `hasTitleSlot` is true).\n * @slot description - Message description (shown when `hasDescriptionSlot` is true).\n * @slot action-label - Primary action button label (shown when `hasActionLabelSlot` is true).\n * @slot primary-icon - Main icon representing the message type or status (shown when `hasPrimaryIcon` is true).\n * @slot secondary-icon - Additional icon for secondary status/context (shown when `hasSecondaryIcon` is true).\n * @slot trailing-icon - Icon after action buttons, horizontal layout only (shown when `hasTrailingIcon` is true).\n * @fires message-click {CustomEvent<{open: boolean}>} Fired when the message item is clicked.\n * @fires primary-action-click {CustomEvent<void>} Fired when the primary action button is clicked.\n * @fires secondary-action-click {CustomEvent<void>} Fired when the secondary action button is clicked.\n */\n@customElement('obc-message-menu-item')\nexport class ObcMessageMenuItem extends LitElement {\n // Layout properties\n @property({type: String}) size: ObcMessageMenuItemSize =\n ObcMessageMenuItemSize.SingleLine;\n @property({type: Boolean}) stackVertical = false;\n @property({type: Boolean}) enhancedIcon = false;\n @property({type: Boolean}) open = false;\n\n // Text content properties\n @property({type: String}) override title = '';\n @property({type: String}) description = '';\n @property({type: String}) day = '';\n @property({type: String}) time = '';\n @property({type: String}) primaryActionLabel = '';\n @property({type: String}) secondaryActionLabel = '';\n @property({type: Boolean, attribute: false}) enablePrimaryAction = true;\n @property({type: Boolean, attribute: false}) enableSecondaryAction = true;\n\n // Visibility properties for icons (slots)\n @property({type: Boolean}) hasPrimaryIcon = false;\n @property({type: Boolean}) hasSecondaryIcon = false;\n @property({type: Boolean}) hasTrailingIcon = false;\n @property({type: Boolean}) isShelved = false;\n\n @property({type: Boolean}) hasActionLabelSlot = false;\n\n private get activeSize() {\n if (this.open) {\n return 'multi-line';\n }\n return this.size;\n }\n\n private get hasTimestamp() {\n return this.time !== '' || this.day !== '';\n }\n\n private get hasDay() {\n return this.day !== '';\n }\n\n private get hasPrimaryAction() {\n return this.primaryActionLabel !== '' || this.hasActionLabelSlot;\n }\n\n private get hasSecondaryAction() {\n return this.secondaryActionLabel !== '';\n }\n\n private get isVertical() {\n return this.stackVertical;\n }\n\n private handleKeyDown(e: KeyboardEvent) {\n // Only handle key events on the wrapper itself, not on nested interactive elements\n if (e.target !== e.currentTarget) {\n return;\n }\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.handleMessageClick();\n }\n }\n\n private handleMessageClick() {\n this.open = !this.open;\n\n this.dispatchEvent(\n new CustomEvent('message-click', {\n detail: {\n open: this.open,\n },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handlePrimaryActionClick(e: Event) {\n e.stopPropagation();\n\n this.dispatchEvent(\n new CustomEvent('primary-action-click', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleSecondaryActionClick(e: Event) {\n e.stopPropagation();\n\n this.dispatchEvent(\n new CustomEvent('secondary-action-click', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n override render() {\n return html`\n <div\n class=${classMap({\n wrapper: true,\n ['active-size-' + this.activeSize]: true,\n ['size-' + this.size]: true,\n ['enhanced-icon']: this.enhancedIcon,\n ['has-date']: this.hasTimestamp,\n ['stack-vertical']: this.stackVertical,\n ['stack-horizontal']: !this.stackVertical,\n })}\n role=\"button\"\n tabindex=\"0\"\n @click=${this.handleMessageClick}\n @keydown=${this.handleKeyDown}\n >\n <div class=\"content-container\">\n <div class=\"icon-container\">\n ${this.isShelved\n ? html`<div class=\"icon\">\n <obi-alerts-shelf></obi-alerts-shelf>\n </div>`\n : nothing}\n ${this.hasPrimaryIcon\n ? html`<div class=\"icon primary\">\n <slot name=\"primary-icon\"></slot>\n </div>`\n : nothing}\n ${this.hasSecondaryIcon\n ? html`<div class=\"icon secondary\">\n <slot name=\"secondary-icon\"></slot>\n </div>`\n : nothing}\n </div>\n <div class=\"text-container\">\n <div class=\"title-container\">\n <slot name=\"title\">${this.title}</slot>\n </div>\n <div class=\"description-container\">\n <slot name=\"description\">${this.description}</slot>\n </div>\n ${this.hasTimestamp\n ? html`<div class=\"date-container\">\n ${this.hasDay ? html`<span>${this.day}</span>` : nothing}\n <span>${this.time}</span>\n </div>`\n : nothing}\n <div class=\"chevron\">\n ${this.open\n ? html`<obi-chevron-up-google></obi-chevron-up-google>`\n : html`<obi-chevron-down-google></obi-chevron-down-google>`}\n </div>\n </div>\n </div>\n ${this.hasPrimaryAction ||\n this.hasSecondaryAction ||\n (this.hasTrailingIcon && !this.isVertical)\n ? html`<div class=\"action-button-container\" part=\"action-container\">\n ${this.hasSecondaryAction\n ? html`<obc-button\n variant=\"normal\"\n .fullWidth=${this.isVertical}\n @click=${this.handleSecondaryActionClick}\n ?disabled=${!this.enableSecondaryAction}\n >\n ${this.secondaryActionLabel}\n </obc-button>`\n : nothing}\n ${this.hasPrimaryAction\n ? html`<obc-button\n variant=\"normal\"\n .fullWidth=${this.isVertical}\n @click=${this.handlePrimaryActionClick}\n ?disabled=${!this.enablePrimaryAction}\n >\n ${this.hasActionLabelSlot\n ? html`<slot name=\"action-label\"></slot>`\n : this.primaryActionLabel}\n </obc-button>`\n : nothing}\n ${this.hasTrailingIcon && !this.isVertical\n ? html`<div class=\"trailing-icon\" part=\"trailing-icon\">\n <slot name=\"trailing-icon\"></slot>\n </div>`\n : nothing}\n </div>`\n : nothing}\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-message-menu-item': ObcMessageMenuItem;\n }\n}\n"],"names":["ObcMessageMenuItemSize"],"mappings":";;;;;;;;;;;;;;;;;;;AAUO,IAAK,2CAAAA,4BAAL;AACLA,0BAAA,YAAA,IAAa;AACbA,0BAAA,YAAA,IAAa;AAFH,SAAAA;AAAA,GAAA,0BAAA,CAAA,CAAA;AAiHL,IAAM,qBAAN,cAAiC,WAAW;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AAEqB,SAAA,OACxB;AACyB,SAAA,gBAAgB;AAChB,SAAA,eAAe;AACf,SAAA,OAAO;AAGR,SAAS,QAAQ;AACjB,SAAA,cAAc;AACd,SAAA,MAAM;AACN,SAAA,OAAO;AACP,SAAA,qBAAqB;AACrB,SAAA,uBAAuB;AACJ,SAAA,sBAAsB;AACtB,SAAA,wBAAwB;AAG1C,SAAA,iBAAiB;AACjB,SAAA,mBAAmB;AACnB,SAAA,kBAAkB;AAClB,SAAA,YAAY;AAEZ,SAAA,qBAAqB;AAAA,EAAA;AAAA,EAEhD,IAAY,aAAa;AACvB,QAAI,KAAK,MAAM;AACb,aAAO;AAAA,IACT;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,eAAe;AACzB,WAAO,KAAK,SAAS,MAAM,KAAK,QAAQ;AAAA,EAC1C;AAAA,EAEA,IAAY,SAAS;AACnB,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,IAAY,mBAAmB;AAC7B,WAAO,KAAK,uBAAuB,MAAM,KAAK;AAAA,EAChD;AAAA,EAEA,IAAY,qBAAqB;AAC/B,WAAO,KAAK,yBAAyB;AAAA,EACvC;AAAA,EAEA,IAAY,aAAa;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,cAAc,G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A;AAEA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAxBd,mBAwBgB,WAAA,sBAAA,CAAA;AAxBhB,qBAAN,gBAAA;AAAA,EADN,cAAc,uBAAuB;AAAA,GACzB,kBAAA;"}
|
|
@@ -8,6 +8,10 @@ const componentStyle = css`
|
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
.wrapper {
|
|
12
16
|
border-color: var(--integration-normal-enabled-border-color);
|
|
13
17
|
background-color: var(--integration-normal-enabled-background-color);
|
|
@@ -18,6 +22,7 @@ const componentStyle = css`
|
|
|
18
22
|
display: flex;
|
|
19
23
|
flex-direction: column;
|
|
20
24
|
align-items: center;
|
|
25
|
+
height: 100%;
|
|
21
26
|
background: var(--container-global-color);
|
|
22
27
|
border-radius: var(
|
|
23
28
|
--app-components-integration-system-dropdown-menu-border-radius
|
|
@@ -44,6 +49,10 @@ const componentStyle = css`
|
|
|
44
49
|
border-radius: 12px;
|
|
45
50
|
}
|
|
46
51
|
|
|
52
|
+
.footer-container.hidden {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
.content-area {
|
|
48
57
|
display: flex;
|
|
49
58
|
flex-direction: column;
|
|
@@ -53,6 +62,10 @@ const componentStyle = css`
|
|
|
53
62
|
border-radius: 8px;
|
|
54
63
|
}
|
|
55
64
|
|
|
65
|
+
.content-area.hidden {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
56
69
|
.footer-container slot[name="buttons"]::slotted(*) {
|
|
57
70
|
display: flex;
|
|
58
71
|
flex: 1 1 0px;
|
|
@@ -67,7 +80,8 @@ const componentStyle = css`
|
|
|
67
80
|
gap: var(--app-components-integration-system-menu-action-spacing);
|
|
68
81
|
}
|
|
69
82
|
|
|
70
|
-
.buttons-slot
|
|
83
|
+
.buttons-slot,
|
|
84
|
+
.content-slot {
|
|
71
85
|
display: contents;
|
|
72
86
|
}
|
|
73
87
|
|
|
@@ -81,12 +95,13 @@ const componentStyle = css`
|
|
|
81
95
|
border-radius: 8px;
|
|
82
96
|
}
|
|
83
97
|
|
|
84
|
-
.content-container.
|
|
98
|
+
.content-container.hidden {
|
|
85
99
|
display: none;
|
|
86
100
|
}
|
|
87
101
|
|
|
88
102
|
.alertlist {
|
|
89
103
|
width: 100%;
|
|
104
|
+
height: 100%;
|
|
90
105
|
}
|
|
91
106
|
|
|
92
107
|
.leading-icon {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-vessel-menu.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integration-vessel-menu.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,17 +2,39 @@ import { LitElement } from 'lit';
|
|
|
2
2
|
import '../../components/button/button.js';
|
|
3
3
|
import '../../components/icon-button/icon-button.js';
|
|
4
4
|
import '../../icons/icon-placeholder.js';
|
|
5
|
+
import '../../icons/icon-unacknowledged.js';
|
|
5
6
|
import '../../building-blocks/alert-list/alert-list.js';
|
|
6
7
|
/**
|
|
7
8
|
* `<obc-integration-vessel-menu>` – A menu to be shown when selecting a obc-integration-button from a obc-integration-bar.
|
|
8
9
|
*
|
|
10
|
+
* ## Sizing
|
|
11
|
+
*
|
|
12
|
+
* The menu hugs its content and never reserves more space than its slotted
|
|
13
|
+
* sections need; it deliberately does not impose a height of its own. Sizing is
|
|
14
|
+
* owned by the consumer, since only the consumer knows how large the menu may
|
|
15
|
+
* grow in a given layout.
|
|
16
|
+
*
|
|
17
|
+
* From a web components perspective, drive the size from the host element and
|
|
18
|
+
* the slotted light-DOM nodes — not from component properties:
|
|
19
|
+
*
|
|
20
|
+
* - **Bound the whole menu** by giving the host element a definite `height`. The
|
|
21
|
+
* menu fills that height and the alert list scrolls within the remaining space
|
|
22
|
+
* while the footer and content keep their size. This is the recommended
|
|
23
|
+
* approach. (A `max-height` alone will not bound the list — the internal
|
|
24
|
+
* scroll needs a definite height to resolve against.)
|
|
25
|
+
* - **Size sections independently** (advanced) by sizing the slotted nodes
|
|
26
|
+
* directly — e.g. a fixed-height `content` element, or a capped, scrollable
|
|
27
|
+
* wrapper around the `alarms` items.
|
|
28
|
+
* - **Leave it unbounded** to let the menu grow with its content.
|
|
29
|
+
*
|
|
9
30
|
* @slot buttons - Buttons shown in the footer.
|
|
10
31
|
* @slot content - Main content shown in the content area.
|
|
11
32
|
* @slot alarms - Alarm items rendered inside the alert list.
|
|
12
33
|
*/
|
|
13
34
|
export declare class ObcIntegrationVesselMenu extends LitElement {
|
|
14
|
-
|
|
15
|
-
|
|
35
|
+
hasActions: boolean;
|
|
36
|
+
hasAlertList: boolean;
|
|
37
|
+
hasContent: boolean;
|
|
16
38
|
protected render(): import('lit-html').TemplateResult<1>;
|
|
17
39
|
static styles: import('lit').CSSResult;
|
|
18
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-vessel-menu.d.ts","sourceRoot":"","sources":["../../../src/integration-systems/integration-vessel-menu/integration-vessel-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAMhD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,6CAA6C,CAAC;AACrD,OAAO,iCAAiC,CAAC;AACzC,OAAO,gDAAgD,CAAC;AAExD
|
|
1
|
+
{"version":3,"file":"integration-vessel-menu.d.ts","sourceRoot":"","sources":["../../../src/integration-systems/integration-vessel-menu/integration-vessel-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAMhD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,6CAA6C,CAAC;AACrD,OAAO,iCAAiC,CAAC;AACzC,OAAO,oCAAoC,CAAC;AAC5C,OAAO,gDAAgD,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,qBACa,wBAAyB,SAAQ,UAAU;IACT,UAAU,UAAQ;IAClB,YAAY,UAAQ;IACpB,UAAU,UAAQ;cAE5C,MAAM;IAuCzB,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,6BAA6B,EAAE,wBAAwB,CAAC;KACzD;CACF"}
|
|
@@ -6,6 +6,7 @@ import componentStyle from "./integration-vessel-menu.css.js";
|
|
|
6
6
|
import "../../components/button/button.js";
|
|
7
7
|
import "../../components/icon-button/icon-button.js";
|
|
8
8
|
import "../../icons/icon-placeholder.js";
|
|
9
|
+
import "../../icons/icon-unacknowledged.js";
|
|
9
10
|
import "../../building-blocks/alert-list/alert-list.js";
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,29 +21,43 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
20
21
|
let ObcIntegrationVesselMenu = class extends LitElement {
|
|
21
22
|
constructor() {
|
|
22
23
|
super(...arguments);
|
|
23
|
-
this.
|
|
24
|
+
this.hasActions = true;
|
|
25
|
+
this.hasAlertList = true;
|
|
26
|
+
this.hasContent = true;
|
|
24
27
|
}
|
|
25
28
|
render() {
|
|
26
29
|
return html`
|
|
27
|
-
<div
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
<div class="wrapper">
|
|
31
|
+
<div
|
|
32
|
+
class=${classMap({
|
|
33
|
+
"footer-container": true,
|
|
34
|
+
hidden: !this.hasActions
|
|
30
35
|
})}
|
|
31
|
-
|
|
32
|
-
<div class="footer-container">
|
|
36
|
+
>
|
|
33
37
|
<slot name="buttons" class="buttons-slot"></slot>
|
|
34
38
|
</div>
|
|
35
|
-
<div
|
|
36
|
-
|
|
39
|
+
<div
|
|
40
|
+
class=${classMap({
|
|
41
|
+
"content-area": true,
|
|
42
|
+
hidden: !this.hasContent
|
|
43
|
+
})}
|
|
44
|
+
>
|
|
45
|
+
<slot name="content" class="content-slot"></slot>
|
|
37
46
|
</div>
|
|
38
47
|
<div
|
|
39
48
|
class=${classMap({
|
|
40
49
|
"content-container": true,
|
|
41
|
-
|
|
50
|
+
hidden: !this.hasAlertList
|
|
42
51
|
})}
|
|
43
52
|
>
|
|
44
53
|
<obc-alert-list class="alertlist"
|
|
45
54
|
><slot name="alarms"></slot>
|
|
55
|
+
<div slot="empty-icon">
|
|
56
|
+
<obi-unacknowledged></obi-unacknowledged>
|
|
57
|
+
</div>
|
|
58
|
+
<div slot="empty-title">
|
|
59
|
+
<span>No alerts</span>
|
|
60
|
+
</div>
|
|
46
61
|
</obc-alert-list>
|
|
47
62
|
</div>
|
|
48
63
|
</div>
|
|
@@ -51,8 +66,14 @@ let ObcIntegrationVesselMenu = class extends LitElement {
|
|
|
51
66
|
};
|
|
52
67
|
ObcIntegrationVesselMenu.styles = unsafeCSS(componentStyle);
|
|
53
68
|
__decorateClass([
|
|
54
|
-
property({ type: Boolean })
|
|
55
|
-
], ObcIntegrationVesselMenu.prototype, "
|
|
69
|
+
property({ type: Boolean, attribute: false })
|
|
70
|
+
], ObcIntegrationVesselMenu.prototype, "hasActions", 2);
|
|
71
|
+
__decorateClass([
|
|
72
|
+
property({ type: Boolean, attribute: false })
|
|
73
|
+
], ObcIntegrationVesselMenu.prototype, "hasAlertList", 2);
|
|
74
|
+
__decorateClass([
|
|
75
|
+
property({ type: Boolean, attribute: false })
|
|
76
|
+
], ObcIntegrationVesselMenu.prototype, "hasContent", 2);
|
|
56
77
|
ObcIntegrationVesselMenu = __decorateClass([
|
|
57
78
|
customElement("obc-integration-vessel-menu")
|
|
58
79
|
], ObcIntegrationVesselMenu);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-vessel-menu.js","sources":["../../../src/integration-systems/integration-vessel-menu/integration-vessel-menu.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement} from '../../decorator.js';\nimport componentStyle from './integration-vessel-menu.css?inline';\n\nimport '../../components/button/button.js';\nimport '../../components/icon-button/icon-button.js';\nimport '../../icons/icon-placeholder.js';\nimport '../../building-blocks/alert-list/alert-list.js';\n\n/**\n * `<obc-integration-vessel-menu>` – A menu to be shown when selecting a obc-integration-button from a obc-integration-bar.\n *\n * @slot buttons - Buttons shown in the footer.\n * @slot content - Main content shown in the content area.\n * @slot alarms - Alarm items rendered inside the alert list.\n */\n\n@customElement('obc-integration-vessel-menu')\nexport class ObcIntegrationVesselMenu extends LitElement {\n
|
|
1
|
+
{"version":3,"file":"integration-vessel-menu.js","sources":["../../../src/integration-systems/integration-vessel-menu/integration-vessel-menu.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement} from '../../decorator.js';\nimport componentStyle from './integration-vessel-menu.css?inline';\n\nimport '../../components/button/button.js';\nimport '../../components/icon-button/icon-button.js';\nimport '../../icons/icon-placeholder.js';\nimport '../../icons/icon-unacknowledged.js';\nimport '../../building-blocks/alert-list/alert-list.js';\n\n/**\n * `<obc-integration-vessel-menu>` – A menu to be shown when selecting a obc-integration-button from a obc-integration-bar.\n *\n * ## Sizing\n *\n * The menu hugs its content and never reserves more space than its slotted\n * sections need; it deliberately does not impose a height of its own. Sizing is\n * owned by the consumer, since only the consumer knows how large the menu may\n * grow in a given layout.\n *\n * From a web components perspective, drive the size from the host element and\n * the slotted light-DOM nodes — not from component properties:\n *\n * - **Bound the whole menu** by giving the host element a definite `height`. The\n * menu fills that height and the alert list scrolls within the remaining space\n * while the footer and content keep their size. This is the recommended\n * approach. (A `max-height` alone will not bound the list — the internal\n * scroll needs a definite height to resolve against.)\n * - **Size sections independently** (advanced) by sizing the slotted nodes\n * directly — e.g. a fixed-height `content` element, or a capped, scrollable\n * wrapper around the `alarms` items.\n * - **Leave it unbounded** to let the menu grow with its content.\n *\n * @slot buttons - Buttons shown in the footer.\n * @slot content - Main content shown in the content area.\n * @slot alarms - Alarm items rendered inside the alert list.\n */\n\n@customElement('obc-integration-vessel-menu')\nexport class ObcIntegrationVesselMenu extends LitElement {\n @property({type: Boolean, attribute: false}) hasActions = true;\n @property({type: Boolean, attribute: false}) hasAlertList = true;\n @property({type: Boolean, attribute: false}) hasContent = true;\n\n protected override render() {\n return html`\n <div class=\"wrapper\">\n <div\n class=${classMap({\n 'footer-container': true,\n hidden: !this.hasActions,\n })}\n >\n <slot name=\"buttons\" class=\"buttons-slot\"></slot>\n </div>\n <div\n class=${classMap({\n 'content-area': true,\n hidden: !this.hasContent,\n })}\n >\n <slot name=\"content\" class=\"content-slot\"></slot>\n </div>\n <div\n class=${classMap({\n 'content-container': true,\n hidden: !this.hasAlertList,\n })}\n >\n <obc-alert-list class=\"alertlist\"\n ><slot name=\"alarms\"></slot>\n <div slot=\"empty-icon\">\n <obi-unacknowledged></obi-unacknowledged>\n </div>\n <div slot=\"empty-title\">\n <span>No alerts</span>\n </div>\n </obc-alert-list>\n </div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-integration-vessel-menu': ObcIntegrationVesselMenu;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCO,IAAM,2BAAN,cAAuC,WAAW;AAAA,EAAlD,cAAA;AAAA,UAAA,GAAA,SAAA;AACwC,SAAA,aAAa;AACb,SAAA,eAAe;AACf,SAAA,aAAa;AAAA,EAAA;AAAA,EAEvC,SAAS;AAC1B,WAAO;AAAA;AAAA;AAAA,kBAGO,SAAS;AAAA,MACf,oBAAoB;AAAA,MACpB,QAAQ,CAAC,KAAK;AAAA,IAAA,CACf,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKM,SAAS;AAAA,MACf,gBAAgB;AAAA,MAChB,QAAQ,CAAC,KAAK;AAAA,IAAA,CACf,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKM,SAAS;AAAA,MACf,qBAAqB;AAAA,MACrB,QAAQ,CAAC,KAAK;AAAA,IAAA,CACf,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcV;AAGF;AA7Ca,yBA4CK,SAAS,UAAU,cAAc;AA3CJ,gBAAA;AAAA,EAA5C,SAAS,EAAC,MAAM,SAAS,WAAW,OAAM;AAAA,GADhC,yBACkC,WAAA,cAAA,CAAA;AACA,gBAAA;AAAA,EAA5C,SAAS,EAAC,MAAM,SAAS,WAAW,OAAM;AAAA,GAFhC,yBAEkC,WAAA,gBAAA,CAAA;AACA,gBAAA;AAAA,EAA5C,SAAS,EAAC,MAAM,SAAS,WAAW,OAAM;AAAA,GAHhC,yBAGkC,WAAA,cAAA,CAAA;AAHlC,2BAAN,gBAAA;AAAA,EADN,cAAc,6BAA6B;AAAA,GAC/B,wBAAA;"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,11 @@ import {html, nothing} from 'lit';
|
|
|
3
3
|
import './alert-menu-item.js';
|
|
4
4
|
import '../../icons/icon-engine.js';
|
|
5
5
|
import '../alert-icon/alert-icon.js';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ObcAlertMenuItem,
|
|
8
|
+
ObcAlertMenuItemActionState,
|
|
9
|
+
ObcAlertMenuItemStatus,
|
|
10
|
+
} from './alert-menu-item.js';
|
|
7
11
|
|
|
8
12
|
const meta: Meta<ObcAlertMenuItem> = {
|
|
9
13
|
title: 'Application Components/Alerts/Alert Menu Item',
|
|
@@ -17,6 +21,9 @@ const meta: Meta<ObcAlertMenuItem> = {
|
|
|
17
21
|
status: ObcAlertMenuItemStatus.Unacknowledged,
|
|
18
22
|
hasIcon: false,
|
|
19
23
|
shelved: false,
|
|
24
|
+
secondaryActionLabel: '',
|
|
25
|
+
primaryActionState: ObcAlertMenuItemActionState.Enabled,
|
|
26
|
+
secondaryActionState: ObcAlertMenuItemActionState.Enabled,
|
|
20
27
|
},
|
|
21
28
|
render: (args) => html`
|
|
22
29
|
<obc-alert-menu-item
|
|
@@ -27,6 +34,9 @@ const meta: Meta<ObcAlertMenuItem> = {
|
|
|
27
34
|
.shelved=${args.shelved}
|
|
28
35
|
.hasIcon=${args.hasIcon}
|
|
29
36
|
.status=${args.status}
|
|
37
|
+
.secondaryActionLabel=${args.secondaryActionLabel}
|
|
38
|
+
.primaryActionState=${args.primaryActionState}
|
|
39
|
+
.secondaryActionState=${args.secondaryActionState}
|
|
30
40
|
>
|
|
31
41
|
<obc-alert-icon slot="alert-icon" type="alarm" active></obc-alert-icon>
|
|
32
42
|
${args.hasIcon ? html`<obi-engine slot="icon"></obi-engine>` : nothing}
|
|
@@ -43,6 +53,15 @@ const meta: Meta<ObcAlertMenuItem> = {
|
|
|
43
53
|
},
|
|
44
54
|
hasIcon: {control: 'boolean'},
|
|
45
55
|
shelved: {control: 'boolean'},
|
|
56
|
+
secondaryActionLabel: {control: 'text'},
|
|
57
|
+
primaryActionState: {
|
|
58
|
+
control: 'select',
|
|
59
|
+
options: Object.values(ObcAlertMenuItemActionState),
|
|
60
|
+
},
|
|
61
|
+
secondaryActionState: {
|
|
62
|
+
control: 'select',
|
|
63
|
+
options: Object.values(ObcAlertMenuItemActionState),
|
|
64
|
+
},
|
|
46
65
|
},
|
|
47
66
|
};
|
|
48
67
|
|
|
@@ -83,3 +102,23 @@ export const NoAckWarning: Story = {
|
|
|
83
102
|
status: ObcAlertMenuItemStatus.NoAckWarning,
|
|
84
103
|
},
|
|
85
104
|
};
|
|
105
|
+
|
|
106
|
+
export const WithSecondaryAction: Story = {
|
|
107
|
+
args: {
|
|
108
|
+
secondaryActionLabel: 'Mute',
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const SecondaryActionDisabled: Story = {
|
|
113
|
+
args: {
|
|
114
|
+
secondaryActionLabel: 'Mute',
|
|
115
|
+
secondaryActionState: ObcAlertMenuItemActionState.Disabled,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const PrimaryActionNone: Story = {
|
|
120
|
+
args: {
|
|
121
|
+
secondaryActionLabel: 'Mute',
|
|
122
|
+
primaryActionState: ObcAlertMenuItemActionState.None,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
@@ -20,6 +20,18 @@ export enum ObcAlertMenuItemStatus {
|
|
|
20
20
|
Rectified = 'rectified',
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Appearance of an alert menu item action.
|
|
25
|
+
* - `enabled`: Action is shown and interactive (default).
|
|
26
|
+
* - `disabled`: Action is shown but cannot be triggered.
|
|
27
|
+
* - `none`: Action is removed and takes no space.
|
|
28
|
+
*/
|
|
29
|
+
export enum ObcAlertMenuItemActionState {
|
|
30
|
+
Enabled = 'enabled',
|
|
31
|
+
Disabled = 'disabled',
|
|
32
|
+
None = 'none',
|
|
33
|
+
}
|
|
34
|
+
|
|
23
35
|
/**
|
|
24
36
|
* `<obc-alert-menu-item>` – A list item component for displaying alert or notification entries with status, icons, and action controls.
|
|
25
37
|
*
|
|
@@ -33,7 +45,8 @@ export enum ObcAlertMenuItemStatus {
|
|
|
33
45
|
* - **Icon Support:** Optional secondary icon (e.g., system or source) and a primary alert icon. Tertiary "shelved" icon appears if the alert is shelved.
|
|
34
46
|
* - **Time and Day Display:** Optionally shows day and/or time for the alert occurrence.
|
|
35
47
|
* - **Expandable:** Can be toggled open/closed for additional details (via click).
|
|
36
|
-
* - **Action
|
|
48
|
+
* - **Action Buttons:** Displays an "ACK" button for unacknowledged alerts and an optional secondary action (label set via `secondaryActionLabel`); each triggers an event when clicked.
|
|
49
|
+
* - Each action's appearance is controlled independently via `primaryActionState` / `secondaryActionState` (`enabled`, `disabled`, or `none`).
|
|
37
50
|
* - **Animated Intro:** Optional animation when the item appears.
|
|
38
51
|
* - **Size Options:** Supports single-line or multi-line layouts (see `size` property).
|
|
39
52
|
*
|
|
@@ -44,6 +57,8 @@ export enum ObcAlertMenuItemStatus {
|
|
|
44
57
|
* - Provide a relevant icon in the `alert-icon` slot to visually indicate the alert type.
|
|
45
58
|
* - Use the `icon` slot for a source/system icon if needed.
|
|
46
59
|
* - Only show the "ACK" action for alerts that require acknowledgment.
|
|
60
|
+
* - Provide `secondaryActionLabel` to add a second action alongside ACK.
|
|
61
|
+
* - Use `primaryActionState` / `secondaryActionState` to temporarily disable an action (`disabled`) or remove it without leaving a gap (`none`).
|
|
47
62
|
* - Use the `shelved` property to indicate alerts that are temporarily deferred.
|
|
48
63
|
*
|
|
49
64
|
* ### Slots
|
|
@@ -54,6 +69,7 @@ export enum ObcAlertMenuItemStatus {
|
|
|
54
69
|
*
|
|
55
70
|
* ### Events
|
|
56
71
|
* - **ack-click** – Fired when the ACK action button is clicked.
|
|
72
|
+
* - **ack-secondary-click** – Fired when the secondary action button is clicked.
|
|
57
73
|
* - **item-click** – Fired when the alert menu item is clicked (toggles open/closed).
|
|
58
74
|
*
|
|
59
75
|
* ### Best Practices
|
|
@@ -81,6 +97,7 @@ export enum ObcAlertMenuItemStatus {
|
|
|
81
97
|
* @slot icon - Optional secondary icon (e.g., source/system).
|
|
82
98
|
*
|
|
83
99
|
* @fires ack-click {CustomEvent<void>} Fired when the ACK action button is clicked.
|
|
100
|
+
* @fires ack-secondary-click {CustomEvent<void>} Fired when the secondary action button is clicked.
|
|
84
101
|
* @fires item-click {CustomEvent<void>} Fired when the alert menu item is clicked.
|
|
85
102
|
*/
|
|
86
103
|
@customElement('obc-alert-menu-item')
|
|
@@ -146,10 +163,51 @@ export class ObcAlertMenuItem extends LitElement {
|
|
|
146
163
|
*/
|
|
147
164
|
@property({type: Boolean}) animateIntro = false;
|
|
148
165
|
|
|
166
|
+
/**
|
|
167
|
+
* The label for the secondary action button.
|
|
168
|
+
* Unlike the primary (ACK) action, the secondary label is not derived from
|
|
169
|
+
* `status`; it must be provided explicitly. The secondary action is only
|
|
170
|
+
* shown when a non-empty label is set and `secondaryActionState` is not
|
|
171
|
+
* `none`.
|
|
172
|
+
*/
|
|
173
|
+
@property({type: String}) secondaryActionLabel = '';
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Controls the appearance of the primary (ACK) action.
|
|
177
|
+
* See {@link ObcAlertMenuItemActionState} for the available states.
|
|
178
|
+
*/
|
|
179
|
+
@property({type: String}) primaryActionState: ObcAlertMenuItemActionState =
|
|
180
|
+
ObcAlertMenuItemActionState.Enabled;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Controls the appearance of the secondary action.
|
|
184
|
+
* See {@link ObcAlertMenuItemActionState} for the available states.
|
|
185
|
+
*/
|
|
186
|
+
@property({type: String}) secondaryActionState: ObcAlertMenuItemActionState =
|
|
187
|
+
ObcAlertMenuItemActionState.None;
|
|
188
|
+
|
|
149
189
|
private get primaryActionLabel() {
|
|
190
|
+
if (this.primaryActionState === ObcAlertMenuItemActionState.None) {
|
|
191
|
+
return '';
|
|
192
|
+
}
|
|
150
193
|
return this.status === ObcAlertMenuItemStatus.Unacknowledged ? 'ACK' : '';
|
|
151
194
|
}
|
|
152
195
|
|
|
196
|
+
private get secondaryActionLabelToShow() {
|
|
197
|
+
if (this.secondaryActionState === ObcAlertMenuItemActionState.None) {
|
|
198
|
+
return '';
|
|
199
|
+
}
|
|
200
|
+
return this.secondaryActionLabel;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private get primaryActionDisabled() {
|
|
204
|
+
return this.primaryActionState === ObcAlertMenuItemActionState.Disabled;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private get secondaryActionDisabled() {
|
|
208
|
+
return this.secondaryActionState === ObcAlertMenuItemActionState.Disabled;
|
|
209
|
+
}
|
|
210
|
+
|
|
153
211
|
private get hasTrailingIcon() {
|
|
154
212
|
// True when we need the action container but don't have an ACK button
|
|
155
213
|
return this.status !== ObcAlertMenuItemStatus.Unacknowledged;
|
|
@@ -164,6 +222,10 @@ export class ObcAlertMenuItem extends LitElement {
|
|
|
164
222
|
this.dispatchEvent(new CustomEvent('ack-click'));
|
|
165
223
|
}
|
|
166
224
|
|
|
225
|
+
private handleSecondaryActionClick() {
|
|
226
|
+
this.dispatchEvent(new CustomEvent('ack-secondary-click'));
|
|
227
|
+
}
|
|
228
|
+
|
|
167
229
|
override render() {
|
|
168
230
|
return html`
|
|
169
231
|
<obc-message-menu-item
|
|
@@ -172,6 +234,9 @@ export class ObcAlertMenuItem extends LitElement {
|
|
|
172
234
|
.day=${this.day}
|
|
173
235
|
.time=${this.time}
|
|
174
236
|
.primaryActionLabel=${this.primaryActionLabel}
|
|
237
|
+
.secondaryActionLabel=${this.secondaryActionLabelToShow}
|
|
238
|
+
.enablePrimaryAction=${!this.primaryActionDisabled}
|
|
239
|
+
.enableSecondaryAction=${!this.secondaryActionDisabled}
|
|
175
240
|
.size=${this.size}
|
|
176
241
|
.open=${this.open}
|
|
177
242
|
.hasSecondaryIcon=${this.hasIcon}
|
|
@@ -181,6 +246,7 @@ export class ObcAlertMenuItem extends LitElement {
|
|
|
181
246
|
hasPrimaryIcon
|
|
182
247
|
@message-click=${this.handleMessageClick}
|
|
183
248
|
@primary-action-click=${this.handleActionClick}
|
|
249
|
+
@secondary-action-click=${this.handleSecondaryActionClick}
|
|
184
250
|
>
|
|
185
251
|
<slot name="alert-icon" slot="primary-icon"></slot>
|
|
186
252
|
<slot name="title" slot="title">${this.title}</slot>
|
|
@@ -36,6 +36,8 @@ const meta: Meta<ObcMessageMenuItem> = {
|
|
|
36
36
|
time: {control: 'text'},
|
|
37
37
|
primaryActionLabel: {control: 'text'},
|
|
38
38
|
secondaryActionLabel: {control: 'text'},
|
|
39
|
+
enablePrimaryAction: {control: 'boolean'},
|
|
40
|
+
enableSecondaryAction: {control: 'boolean'},
|
|
39
41
|
// Icon slots
|
|
40
42
|
hasPrimaryIcon: {control: 'boolean'},
|
|
41
43
|
hasSecondaryIcon: {control: 'boolean'},
|
|
@@ -57,6 +59,8 @@ const meta: Meta<ObcMessageMenuItem> = {
|
|
|
57
59
|
time: '',
|
|
58
60
|
primaryActionLabel: '',
|
|
59
61
|
secondaryActionLabel: '',
|
|
62
|
+
enablePrimaryAction: true,
|
|
63
|
+
enableSecondaryAction: true,
|
|
60
64
|
hasPrimaryIcon: false,
|
|
61
65
|
hasSecondaryIcon: false,
|
|
62
66
|
hasTrailingIcon: false,
|
|
@@ -75,6 +79,8 @@ const meta: Meta<ObcMessageMenuItem> = {
|
|
|
75
79
|
.time=${args.time}
|
|
76
80
|
.primaryActionLabel=${args.primaryActionLabel}
|
|
77
81
|
.secondaryActionLabel=${args.secondaryActionLabel}
|
|
82
|
+
.enablePrimaryAction=${args.enablePrimaryAction}
|
|
83
|
+
.enableSecondaryAction=${args.enableSecondaryAction}
|
|
78
84
|
.hasPrimaryIcon=${args.hasPrimaryIcon}
|
|
79
85
|
.hasSecondaryIcon=${args.hasSecondaryIcon}
|
|
80
86
|
.hasTrailingIcon=${args.hasTrailingIcon}
|
|
@@ -259,6 +265,18 @@ export const HorizontalWithTwoActions: Story = {
|
|
|
259
265
|
},
|
|
260
266
|
};
|
|
261
267
|
|
|
268
|
+
export const HorizontalWithOneDisabledAction: Story = {
|
|
269
|
+
args: {
|
|
270
|
+
size: ObcMessageMenuItemSize.DoubleLine,
|
|
271
|
+
hasPrimaryIcon: true,
|
|
272
|
+
day: 'Yesterday',
|
|
273
|
+
time: '09:12:34',
|
|
274
|
+
primaryActionLabel: 'Action',
|
|
275
|
+
secondaryActionLabel: 'Action 2',
|
|
276
|
+
enableSecondaryAction: false,
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
|
|
262
280
|
export const HorizontalWithTrailingIcon: Story = {
|
|
263
281
|
args: {
|
|
264
282
|
size: ObcMessageMenuItemSize.DoubleLine,
|
|
@@ -37,6 +37,7 @@ export enum ObcMessageMenuItemSize {
|
|
|
37
37
|
*
|
|
38
38
|
* - **Actions:**
|
|
39
39
|
* - Supports up to two action buttons via `primaryActionLabel` and `secondaryActionLabel`.
|
|
40
|
+
* - Each action can be independently disabled by setting `enablePrimaryAction` or `enableSecondaryAction` to `false`.
|
|
40
41
|
* - In vertical layout, action buttons expand to full width.
|
|
41
42
|
*
|
|
42
43
|
* - **Timestamp:**
|
|
@@ -52,6 +53,7 @@ export enum ObcMessageMenuItemSize {
|
|
|
52
53
|
* - Use `stackVertical=true` when actions need more prominence or when space is narrow.
|
|
53
54
|
* - Enable `enhancedIcon` to highlight important or priority messages.
|
|
54
55
|
* - Use `isShelved` to indicate messages that have been temporarily set aside.
|
|
56
|
+
* - Set `enablePrimaryAction` / `enableSecondaryAction` to `false` when an action is temporarily unavailable (e.g. awaiting a precondition) rather than removing the button.
|
|
55
57
|
*
|
|
56
58
|
* ## Slots
|
|
57
59
|
*
|
|
@@ -134,6 +136,8 @@ export class ObcMessageMenuItem extends LitElement {
|
|
|
134
136
|
@property({type: String}) time = '';
|
|
135
137
|
@property({type: String}) primaryActionLabel = '';
|
|
136
138
|
@property({type: String}) secondaryActionLabel = '';
|
|
139
|
+
@property({type: Boolean, attribute: false}) enablePrimaryAction = true;
|
|
140
|
+
@property({type: Boolean, attribute: false}) enableSecondaryAction = true;
|
|
137
141
|
|
|
138
142
|
// Visibility properties for icons (slots)
|
|
139
143
|
@property({type: Boolean}) hasPrimaryIcon = false;
|
|
@@ -281,6 +285,7 @@ export class ObcMessageMenuItem extends LitElement {
|
|
|
281
285
|
variant="normal"
|
|
282
286
|
.fullWidth=${this.isVertical}
|
|
283
287
|
@click=${this.handleSecondaryActionClick}
|
|
288
|
+
?disabled=${!this.enableSecondaryAction}
|
|
284
289
|
>
|
|
285
290
|
${this.secondaryActionLabel}
|
|
286
291
|
</obc-button>`
|
|
@@ -290,6 +295,7 @@ export class ObcMessageMenuItem extends LitElement {
|
|
|
290
295
|
variant="normal"
|
|
291
296
|
.fullWidth=${this.isVertical}
|
|
292
297
|
@click=${this.handlePrimaryActionClick}
|
|
298
|
+
?disabled=${!this.enablePrimaryAction}
|
|
293
299
|
>
|
|
294
300
|
${this.hasActionLabelSlot
|
|
295
301
|
? html`<slot name="action-label"></slot>`
|