@oicl/openbridge-webcomponents 2.0.0-next.71 → 2.0.0-next.72
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 +44 -0
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +101 -2
- 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/package.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -39931,7 +39931,7 @@
|
|
|
39931
39931
|
"declarations": [
|
|
39932
39932
|
{
|
|
39933
39933
|
"kind": "class",
|
|
39934
|
-
"description": "`<obc-alert-menu-item>` – A list item component for displaying alert or notification entries with status, icons, and action controls.\n\nPresents a concise summary of an alert or message, including status, title, description, and optional icons. Designed for use in alert menus, notification drawers, or similar lists where users need to review and acknowledge alerts efficiently.\n\n### Features\n- **Status Variants:** Supports multiple alert states via the `status` property:\n - **Unacknowledged:** Shows an action button (ACK) for user acknowledgment.\n - **Caution, Acknowledged, Rectified:** Display different visual cues for alert progression.\n - **NoAckAlarm / NoAckWarning:** Show special icons indicating unacknowledged alarms or warnings.\n- **Icon Support:** Optional secondary icon (e.g., system or source) and a primary alert icon. Tertiary \"shelved\" icon appears if the alert is shelved.\n- **Time and Day Display:** Optionally shows day and/or time for the alert occurrence.\n- **Expandable:** Can be toggled open/closed for additional details (via click).\n- **Action
|
|
39934
|
+
"description": "`<obc-alert-menu-item>` – A list item component for displaying alert or notification entries with status, icons, and action controls.\n\nPresents a concise summary of an alert or message, including status, title, description, and optional icons. Designed for use in alert menus, notification drawers, or similar lists where users need to review and acknowledge alerts efficiently.\n\n### Features\n- **Status Variants:** Supports multiple alert states via the `status` property:\n - **Unacknowledged:** Shows an action button (ACK) for user acknowledgment.\n - **Caution, Acknowledged, Rectified:** Display different visual cues for alert progression.\n - **NoAckAlarm / NoAckWarning:** Show special icons indicating unacknowledged alarms or warnings.\n- **Icon Support:** Optional secondary icon (e.g., system or source) and a primary alert icon. Tertiary \"shelved\" icon appears if the alert is shelved.\n- **Time and Day Display:** Optionally shows day and/or time for the alert occurrence.\n- **Expandable:** Can be toggled open/closed for additional details (via click).\n- **Action Buttons:** Displays an \"ACK\" button for unacknowledged alerts and an optional secondary action (label set via `secondaryActionLabel`); each triggers an event when clicked.\n - Each action's appearance is controlled independently via `primaryActionState` / `secondaryActionState` (`enabled`, `disabled`, or `none`).\n- **Animated Intro:** Optional animation when the item appears.\n- **Size Options:** Supports single-line or multi-line layouts (see `size` property).\n\n### Usage Guidelines\nUse `obc-alert-menu-item` to represent individual alerts or notifications in a menu, list, or notification center. Ideal for scenarios where users need to quickly scan, identify, and acknowledge alerts. The component is best suited for transient or actionable notifications rather than persistent banners.\n\n- Use the `status` property to reflect the current state of the alert.\n- Provide a relevant icon in the `alert-icon` slot to visually indicate the alert type.\n- Use the `icon` slot for a source/system icon if needed.\n- Only show the \"ACK\" action for alerts that require acknowledgment.\n- Provide `secondaryActionLabel` to add a second action alongside ACK.\n- Use `primaryActionState` / `secondaryActionState` to temporarily disable an action (`disabled`) or remove it without leaving a gap (`none`).\n- Use the `shelved` property to indicate alerts that are temporarily deferred.\n\n### Slots\n| Slot Name | Renders When... | Purpose |\n|---------------|-------------------------------|------------------------------------------------------|\n| alert-icon | Always | Main alert icon representing the alert type. |\n| icon | If `hasIcon` is true | Secondary icon (e.g., system/source of alert). |\n\n### Events\n- **ack-click** – Fired when the ACK action button is clicked.\n- **ack-secondary-click** – Fired when the secondary action button is clicked.\n- **item-click** – Fired when the alert menu item is clicked (toggles open/closed).\n\n### Best Practices\n- Only display the ACK action for alerts that require acknowledgment.\n- Use concise titles and descriptions for quick scanning.\n- For grouped alerts, ensure each item has a unique status and icon as appropriate.\n- Avoid overloading with too many icons; use secondary and tertiary icons only when necessary.\n- Follow standard notification design guidelines: keep actionable items prominent, and use color/iconography to indicate severity or status.\n\n**Example:**\n```\n<obc-alert-menu-item\n status=\"unacknowledged\"\n title=\"Engine Temperature High\"\n description=\"Port main engine temperature exceeds normal operating range\"\n time=\"14:30\"\n hasIcon\n>\n <obc-alert-icon slot=\"alert-icon\" type=\"alarm\" active></obc-alert-icon>\n <obi-engine slot=\"icon\"></obi-engine>\n</obc-alert-menu-item>\n```",
|
|
39935
39935
|
"name": "ObcAlertMenuItem",
|
|
39936
39936
|
"slots": [
|
|
39937
39937
|
{
|
|
@@ -40041,12 +40041,58 @@
|
|
|
40041
40041
|
"description": "Whether to animate the item's appearance (intro animation).",
|
|
40042
40042
|
"attribute": "animateIntro"
|
|
40043
40043
|
},
|
|
40044
|
+
{
|
|
40045
|
+
"kind": "field",
|
|
40046
|
+
"name": "secondaryActionLabel",
|
|
40047
|
+
"type": {
|
|
40048
|
+
"text": "string"
|
|
40049
|
+
},
|
|
40050
|
+
"default": "''",
|
|
40051
|
+
"description": "The label for the secondary action button.\nUnlike the primary (ACK) action, the secondary label is not derived from\n`status`; it must be provided explicitly. The secondary action is only\nshown when a non-empty label is set and `secondaryActionState` is not\n`none`.",
|
|
40052
|
+
"attribute": "secondaryActionLabel"
|
|
40053
|
+
},
|
|
40054
|
+
{
|
|
40055
|
+
"kind": "field",
|
|
40056
|
+
"name": "primaryActionState",
|
|
40057
|
+
"type": {
|
|
40058
|
+
"text": "ObcAlertMenuItemActionState"
|
|
40059
|
+
},
|
|
40060
|
+
"description": "Controls the appearance of the primary (ACK) action.\nSee ObcAlertMenuItemActionState for the available states.",
|
|
40061
|
+
"attribute": "primaryActionState"
|
|
40062
|
+
},
|
|
40063
|
+
{
|
|
40064
|
+
"kind": "field",
|
|
40065
|
+
"name": "secondaryActionState",
|
|
40066
|
+
"type": {
|
|
40067
|
+
"text": "ObcAlertMenuItemActionState"
|
|
40068
|
+
},
|
|
40069
|
+
"description": "Controls the appearance of the secondary action.\nSee ObcAlertMenuItemActionState for the available states.",
|
|
40070
|
+
"attribute": "secondaryActionState"
|
|
40071
|
+
},
|
|
40044
40072
|
{
|
|
40045
40073
|
"kind": "field",
|
|
40046
40074
|
"name": "primaryActionLabel",
|
|
40047
40075
|
"privacy": "private",
|
|
40048
40076
|
"readonly": true
|
|
40049
40077
|
},
|
|
40078
|
+
{
|
|
40079
|
+
"kind": "field",
|
|
40080
|
+
"name": "secondaryActionLabelToShow",
|
|
40081
|
+
"privacy": "private",
|
|
40082
|
+
"readonly": true
|
|
40083
|
+
},
|
|
40084
|
+
{
|
|
40085
|
+
"kind": "field",
|
|
40086
|
+
"name": "primaryActionDisabled",
|
|
40087
|
+
"privacy": "private",
|
|
40088
|
+
"readonly": true
|
|
40089
|
+
},
|
|
40090
|
+
{
|
|
40091
|
+
"kind": "field",
|
|
40092
|
+
"name": "secondaryActionDisabled",
|
|
40093
|
+
"privacy": "private",
|
|
40094
|
+
"readonly": true
|
|
40095
|
+
},
|
|
40050
40096
|
{
|
|
40051
40097
|
"kind": "field",
|
|
40052
40098
|
"name": "hasTrailingIcon",
|
|
@@ -40062,6 +40108,11 @@
|
|
|
40062
40108
|
"kind": "method",
|
|
40063
40109
|
"name": "handleActionClick",
|
|
40064
40110
|
"privacy": "private"
|
|
40111
|
+
},
|
|
40112
|
+
{
|
|
40113
|
+
"kind": "method",
|
|
40114
|
+
"name": "handleSecondaryActionClick",
|
|
40115
|
+
"privacy": "private"
|
|
40065
40116
|
}
|
|
40066
40117
|
],
|
|
40067
40118
|
"events": [
|
|
@@ -40078,6 +40129,13 @@
|
|
|
40078
40129
|
"text": "CustomEvent"
|
|
40079
40130
|
},
|
|
40080
40131
|
"description": "{CustomEvent<void>} Fired when the ACK action button is clicked."
|
|
40132
|
+
},
|
|
40133
|
+
{
|
|
40134
|
+
"name": "ack-secondary-click",
|
|
40135
|
+
"type": {
|
|
40136
|
+
"text": "CustomEvent"
|
|
40137
|
+
},
|
|
40138
|
+
"description": "{CustomEvent<void>} Fired when the secondary action button is clicked."
|
|
40081
40139
|
}
|
|
40082
40140
|
],
|
|
40083
40141
|
"attributes": [
|
|
@@ -40165,6 +40223,31 @@
|
|
|
40165
40223
|
"default": "false",
|
|
40166
40224
|
"description": "Whether to animate the item's appearance (intro animation).",
|
|
40167
40225
|
"fieldName": "animateIntro"
|
|
40226
|
+
},
|
|
40227
|
+
{
|
|
40228
|
+
"name": "secondaryActionLabel",
|
|
40229
|
+
"type": {
|
|
40230
|
+
"text": "string"
|
|
40231
|
+
},
|
|
40232
|
+
"default": "''",
|
|
40233
|
+
"description": "The label for the secondary action button.\nUnlike the primary (ACK) action, the secondary label is not derived from\n`status`; it must be provided explicitly. The secondary action is only\nshown when a non-empty label is set and `secondaryActionState` is not\n`none`.",
|
|
40234
|
+
"fieldName": "secondaryActionLabel"
|
|
40235
|
+
},
|
|
40236
|
+
{
|
|
40237
|
+
"name": "primaryActionState",
|
|
40238
|
+
"type": {
|
|
40239
|
+
"text": "ObcAlertMenuItemActionState"
|
|
40240
|
+
},
|
|
40241
|
+
"description": "Controls the appearance of the primary (ACK) action.\nSee ObcAlertMenuItemActionState for the available states.",
|
|
40242
|
+
"fieldName": "primaryActionState"
|
|
40243
|
+
},
|
|
40244
|
+
{
|
|
40245
|
+
"name": "secondaryActionState",
|
|
40246
|
+
"type": {
|
|
40247
|
+
"text": "ObcAlertMenuItemActionState"
|
|
40248
|
+
},
|
|
40249
|
+
"description": "Controls the appearance of the secondary action.\nSee ObcAlertMenuItemActionState for the available states.",
|
|
40250
|
+
"fieldName": "secondaryActionState"
|
|
40168
40251
|
}
|
|
40169
40252
|
],
|
|
40170
40253
|
"superclass": {
|
|
@@ -49918,7 +50001,7 @@
|
|
|
49918
50001
|
"declarations": [
|
|
49919
50002
|
{
|
|
49920
50003
|
"kind": "class",
|
|
49921
|
-
"description": "`<obc-message-menu-item>` – An expandable message or notification item for use in message lists, notification panels, or alert menus.\n\nDisplays 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\nUse `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\nText content for `title`, `description`, and `action-label` supports both props (for plain text) and slots (for rich HTML like `CO<sub>2</sub>`).\nTo 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\nUsing 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\nUsing 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```",
|
|
50004
|
+
"description": "`<obc-message-menu-item>` – An expandable message or notification item for use in message lists, notification panels, or alert menus.\n\nDisplays 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\nUse `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\nText content for `title`, `description`, and `action-label` supports both props (for plain text) and slots (for rich HTML like `CO<sub>2</sub>`).\nTo 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\nUsing 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\nUsing 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```",
|
|
49922
50005
|
"name": "ObcMessageMenuItem",
|
|
49923
50006
|
"slots": [
|
|
49924
50007
|
{
|
|
@@ -50036,6 +50119,22 @@
|
|
|
50036
50119
|
"default": "''",
|
|
50037
50120
|
"attribute": "secondaryActionLabel"
|
|
50038
50121
|
},
|
|
50122
|
+
{
|
|
50123
|
+
"kind": "field",
|
|
50124
|
+
"name": "enablePrimaryAction",
|
|
50125
|
+
"type": {
|
|
50126
|
+
"text": "boolean"
|
|
50127
|
+
},
|
|
50128
|
+
"default": "true"
|
|
50129
|
+
},
|
|
50130
|
+
{
|
|
50131
|
+
"kind": "field",
|
|
50132
|
+
"name": "enableSecondaryAction",
|
|
50133
|
+
"type": {
|
|
50134
|
+
"text": "boolean"
|
|
50135
|
+
},
|
|
50136
|
+
"default": "true"
|
|
50137
|
+
},
|
|
50039
50138
|
{
|
|
50040
50139
|
"kind": "field",
|
|
50041
50140
|
"name": "hasPrimaryIcon",
|
|
@@ -13,6 +13,17 @@ export declare enum ObcAlertMenuItemStatus {
|
|
|
13
13
|
NoAckWarning = "no-ack-warning",
|
|
14
14
|
Rectified = "rectified"
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Appearance of an alert menu item action.
|
|
18
|
+
* - `enabled`: Action is shown and interactive (default).
|
|
19
|
+
* - `disabled`: Action is shown but cannot be triggered.
|
|
20
|
+
* - `none`: Action is removed and takes no space.
|
|
21
|
+
*/
|
|
22
|
+
export declare enum ObcAlertMenuItemActionState {
|
|
23
|
+
Enabled = "enabled",
|
|
24
|
+
Disabled = "disabled",
|
|
25
|
+
None = "none"
|
|
26
|
+
}
|
|
16
27
|
/**
|
|
17
28
|
* `<obc-alert-menu-item>` – A list item component for displaying alert or notification entries with status, icons, and action controls.
|
|
18
29
|
*
|
|
@@ -26,7 +37,8 @@ export declare enum ObcAlertMenuItemStatus {
|
|
|
26
37
|
* - **Icon Support:** Optional secondary icon (e.g., system or source) and a primary alert icon. Tertiary "shelved" icon appears if the alert is shelved.
|
|
27
38
|
* - **Time and Day Display:** Optionally shows day and/or time for the alert occurrence.
|
|
28
39
|
* - **Expandable:** Can be toggled open/closed for additional details (via click).
|
|
29
|
-
* - **Action
|
|
40
|
+
* - **Action Buttons:** Displays an "ACK" button for unacknowledged alerts and an optional secondary action (label set via `secondaryActionLabel`); each triggers an event when clicked.
|
|
41
|
+
* - Each action's appearance is controlled independently via `primaryActionState` / `secondaryActionState` (`enabled`, `disabled`, or `none`).
|
|
30
42
|
* - **Animated Intro:** Optional animation when the item appears.
|
|
31
43
|
* - **Size Options:** Supports single-line or multi-line layouts (see `size` property).
|
|
32
44
|
*
|
|
@@ -37,6 +49,8 @@ export declare enum ObcAlertMenuItemStatus {
|
|
|
37
49
|
* - Provide a relevant icon in the `alert-icon` slot to visually indicate the alert type.
|
|
38
50
|
* - Use the `icon` slot for a source/system icon if needed.
|
|
39
51
|
* - Only show the "ACK" action for alerts that require acknowledgment.
|
|
52
|
+
* - Provide `secondaryActionLabel` to add a second action alongside ACK.
|
|
53
|
+
* - Use `primaryActionState` / `secondaryActionState` to temporarily disable an action (`disabled`) or remove it without leaving a gap (`none`).
|
|
40
54
|
* - Use the `shelved` property to indicate alerts that are temporarily deferred.
|
|
41
55
|
*
|
|
42
56
|
* ### Slots
|
|
@@ -47,6 +61,7 @@ export declare enum ObcAlertMenuItemStatus {
|
|
|
47
61
|
*
|
|
48
62
|
* ### Events
|
|
49
63
|
* - **ack-click** – Fired when the ACK action button is clicked.
|
|
64
|
+
* - **ack-secondary-click** – Fired when the secondary action button is clicked.
|
|
50
65
|
* - **item-click** – Fired when the alert menu item is clicked (toggles open/closed).
|
|
51
66
|
*
|
|
52
67
|
* ### Best Practices
|
|
@@ -74,6 +89,7 @@ export declare enum ObcAlertMenuItemStatus {
|
|
|
74
89
|
* @slot icon - Optional secondary icon (e.g., source/system).
|
|
75
90
|
*
|
|
76
91
|
* @fires ack-click {CustomEvent<void>} Fired when the ACK action button is clicked.
|
|
92
|
+
* @fires ack-secondary-click {CustomEvent<void>} Fired when the secondary action button is clicked.
|
|
77
93
|
* @fires item-click {CustomEvent<void>} Fired when the alert menu item is clicked.
|
|
78
94
|
*/
|
|
79
95
|
export declare class ObcAlertMenuItem extends LitElement {
|
|
@@ -126,10 +142,32 @@ export declare class ObcAlertMenuItem extends LitElement {
|
|
|
126
142
|
* Whether to animate the item's appearance (intro animation).
|
|
127
143
|
*/
|
|
128
144
|
animateIntro: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* The label for the secondary action button.
|
|
147
|
+
* Unlike the primary (ACK) action, the secondary label is not derived from
|
|
148
|
+
* `status`; it must be provided explicitly. The secondary action is only
|
|
149
|
+
* shown when a non-empty label is set and `secondaryActionState` is not
|
|
150
|
+
* `none`.
|
|
151
|
+
*/
|
|
152
|
+
secondaryActionLabel: string;
|
|
153
|
+
/**
|
|
154
|
+
* Controls the appearance of the primary (ACK) action.
|
|
155
|
+
* See {@link ObcAlertMenuItemActionState} for the available states.
|
|
156
|
+
*/
|
|
157
|
+
primaryActionState: ObcAlertMenuItemActionState;
|
|
158
|
+
/**
|
|
159
|
+
* Controls the appearance of the secondary action.
|
|
160
|
+
* See {@link ObcAlertMenuItemActionState} for the available states.
|
|
161
|
+
*/
|
|
162
|
+
secondaryActionState: ObcAlertMenuItemActionState;
|
|
129
163
|
private get primaryActionLabel();
|
|
164
|
+
private get secondaryActionLabelToShow();
|
|
165
|
+
private get primaryActionDisabled();
|
|
166
|
+
private get secondaryActionDisabled();
|
|
130
167
|
private get hasTrailingIcon();
|
|
131
168
|
private handleMessageClick;
|
|
132
169
|
private handleActionClick;
|
|
170
|
+
private handleSecondaryActionClick;
|
|
133
171
|
render(): import('lit-html').TemplateResult<1>;
|
|
134
172
|
static styles: import('lit').CSSResult;
|
|
135
173
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-menu-item.d.ts","sourceRoot":"","sources":["../../../src/components/alert-menu-item/alert-menu-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAKzD,OAAO,2CAA2C,CAAC;AACnD,OAAO,6BAA6B,CAAC;AACrC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,EAAC,sBAAsB,EAAC,MAAM,2CAA2C,CAAC;AAGjF,oBAAY,sBAAsB;IAChC,cAAc,mBAAmB;IACjC,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,UAAU,iBAAiB;IAC3B,YAAY,mBAAmB;IAC/B,SAAS,cAAc;CACxB;AAED
|
|
1
|
+
{"version":3,"file":"alert-menu-item.d.ts","sourceRoot":"","sources":["../../../src/components/alert-menu-item/alert-menu-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAKzD,OAAO,2CAA2C,CAAC;AACnD,OAAO,6BAA6B,CAAC;AACrC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,EAAC,sB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C7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF"}
|
|
@@ -27,6 +27,12 @@ var ObcAlertMenuItemStatus = /* @__PURE__ */ ((ObcAlertMenuItemStatus2) => {
|
|
|
27
27
|
ObcAlertMenuItemStatus2["Rectified"] = "rectified";
|
|
28
28
|
return ObcAlertMenuItemStatus2;
|
|
29
29
|
})(ObcAlertMenuItemStatus || {});
|
|
30
|
+
var ObcAlertMenuItemActionState = /* @__PURE__ */ ((ObcAlertMenuItemActionState2) => {
|
|
31
|
+
ObcAlertMenuItemActionState2["Enabled"] = "enabled";
|
|
32
|
+
ObcAlertMenuItemActionState2["Disabled"] = "disabled";
|
|
33
|
+
ObcAlertMenuItemActionState2["None"] = "none";
|
|
34
|
+
return ObcAlertMenuItemActionState2;
|
|
35
|
+
})(ObcAlertMenuItemActionState || {});
|
|
30
36
|
let ObcAlertMenuItem = class extends LitElement {
|
|
31
37
|
constructor() {
|
|
32
38
|
super(...arguments);
|
|
@@ -40,10 +46,28 @@ let ObcAlertMenuItem = class extends LitElement {
|
|
|
40
46
|
this.open = false;
|
|
41
47
|
this.size = ObcMessageMenuItemSize.SingleLine;
|
|
42
48
|
this.animateIntro = false;
|
|
49
|
+
this.secondaryActionLabel = "";
|
|
50
|
+
this.primaryActionState = "enabled";
|
|
51
|
+
this.secondaryActionState = "none";
|
|
43
52
|
}
|
|
44
53
|
get primaryActionLabel() {
|
|
54
|
+
if (this.primaryActionState === "none") {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
45
57
|
return this.status === "unacknowledged" ? "ACK" : "";
|
|
46
58
|
}
|
|
59
|
+
get secondaryActionLabelToShow() {
|
|
60
|
+
if (this.secondaryActionState === "none") {
|
|
61
|
+
return "";
|
|
62
|
+
}
|
|
63
|
+
return this.secondaryActionLabel;
|
|
64
|
+
}
|
|
65
|
+
get primaryActionDisabled() {
|
|
66
|
+
return this.primaryActionState === "disabled";
|
|
67
|
+
}
|
|
68
|
+
get secondaryActionDisabled() {
|
|
69
|
+
return this.secondaryActionState === "disabled";
|
|
70
|
+
}
|
|
47
71
|
get hasTrailingIcon() {
|
|
48
72
|
return this.status !== "unacknowledged";
|
|
49
73
|
}
|
|
@@ -54,6 +78,9 @@ let ObcAlertMenuItem = class extends LitElement {
|
|
|
54
78
|
handleActionClick() {
|
|
55
79
|
this.dispatchEvent(new CustomEvent("ack-click"));
|
|
56
80
|
}
|
|
81
|
+
handleSecondaryActionClick() {
|
|
82
|
+
this.dispatchEvent(new CustomEvent("ack-secondary-click"));
|
|
83
|
+
}
|
|
57
84
|
render() {
|
|
58
85
|
return html`
|
|
59
86
|
<obc-message-menu-item
|
|
@@ -62,6 +89,9 @@ let ObcAlertMenuItem = class extends LitElement {
|
|
|
62
89
|
.day=${this.day}
|
|
63
90
|
.time=${this.time}
|
|
64
91
|
.primaryActionLabel=${this.primaryActionLabel}
|
|
92
|
+
.secondaryActionLabel=${this.secondaryActionLabelToShow}
|
|
93
|
+
.enablePrimaryAction=${!this.primaryActionDisabled}
|
|
94
|
+
.enableSecondaryAction=${!this.secondaryActionDisabled}
|
|
65
95
|
.size=${this.size}
|
|
66
96
|
.open=${this.open}
|
|
67
97
|
.hasSecondaryIcon=${this.hasIcon}
|
|
@@ -71,6 +101,7 @@ let ObcAlertMenuItem = class extends LitElement {
|
|
|
71
101
|
hasPrimaryIcon
|
|
72
102
|
@message-click=${this.handleMessageClick}
|
|
73
103
|
@primary-action-click=${this.handleActionClick}
|
|
104
|
+
@secondary-action-click=${this.handleSecondaryActionClick}
|
|
74
105
|
>
|
|
75
106
|
<slot name="alert-icon" slot="primary-icon"></slot>
|
|
76
107
|
<slot name="title" slot="title">${this.title}</slot>
|
|
@@ -127,11 +158,21 @@ __decorateClass([
|
|
|
127
158
|
__decorateClass([
|
|
128
159
|
property({ type: Boolean })
|
|
129
160
|
], ObcAlertMenuItem.prototype, "animateIntro", 2);
|
|
161
|
+
__decorateClass([
|
|
162
|
+
property({ type: String })
|
|
163
|
+
], ObcAlertMenuItem.prototype, "secondaryActionLabel", 2);
|
|
164
|
+
__decorateClass([
|
|
165
|
+
property({ type: String })
|
|
166
|
+
], ObcAlertMenuItem.prototype, "primaryActionState", 2);
|
|
167
|
+
__decorateClass([
|
|
168
|
+
property({ type: String })
|
|
169
|
+
], ObcAlertMenuItem.prototype, "secondaryActionState", 2);
|
|
130
170
|
ObcAlertMenuItem = __decorateClass([
|
|
131
171
|
customElement("obc-alert-menu-item")
|
|
132
172
|
], ObcAlertMenuItem);
|
|
133
173
|
export {
|
|
134
174
|
ObcAlertMenuItem,
|
|
175
|
+
ObcAlertMenuItemActionState,
|
|
135
176
|
ObcAlertMenuItemStatus
|
|
136
177
|
};
|
|
137
178
|
//# sourceMappingURL=alert-menu-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-menu-item.js","sources":["../../../src/components/alert-menu-item/alert-menu-item.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {choose} from 'lit/directives/choose.js';\n\nimport compentStyle from './alert-menu-item.css?inline';\nimport '../message-menu-item/message-menu-item.js';\nimport '../alert-icon/alert-icon.js';\nimport '../../icons/icon-alerts-shelf.js';\nimport '../../icons/icon-alarm-noack-iec.js';\nimport '../../icons/icon-warning-noack-iec.js';\nimport {ObcMessageMenuItemSize} from '../message-menu-item/message-menu-item.js';\nimport {customElement} from '../../decorator.js';\n\nexport enum ObcAlertMenuItemStatus {\n Unacknowledged = 'unacknowledged',\n Caution = 'caution',\n Acknowledged = 'acknowledged',\n NoAckAlarm = 'no-ack-alarm',\n NoAckWarning = 'no-ack-warning',\n Rectified = 'rectified',\n}\n\n/**\n * `<obc-alert-menu-item>` – A list item component for displaying alert or notification entries with status, icons, and action controls.\n *\n * Presents a concise summary of an alert or message, including status, title, description, and optional icons. Designed for use in alert menus, notification drawers, or similar lists where users need to review and acknowledge alerts efficiently.\n *\n * ### Features\n * - **Status Variants:** Supports multiple alert states via the `status` property:\n * - **Unacknowledged:** Shows an action button (ACK) for user acknowledgment.\n * - **Caution, Acknowledged, Rectified:** Display different visual cues for alert progression.\n * - **NoAckAlarm / NoAckWarning:** Show special icons indicating unacknowledged alarms or warnings.\n * - **Icon Support:** Optional secondary icon (e.g., system or source) and a primary alert icon. Tertiary \"shelved\" icon appears if the alert is shelved.\n * - **Time and Day Display:** Optionally shows day and/or time for the alert occurrence.\n * - **Expandable:** Can be toggled open/closed for additional details (via click).\n * - **Action Button:** Displays an \"ACK\" button for unacknowledged alerts; triggers an event when clicked.\n * - **Animated Intro:** Optional animation when the item appears.\n * - **Size Options:** Supports single-line or multi-line layouts (see `size` property).\n *\n * ### Usage Guidelines\n * Use `obc-alert-menu-item` to represent individual alerts or notifications in a menu, list, or notification center. Ideal for scenarios where users need to quickly scan, identify, and acknowledge alerts. The component is best suited for transient or actionable notifications rather than persistent banners.\n *\n * - Use the `status` property to reflect the current state of the alert.\n * - Provide a relevant icon in the `alert-icon` slot to visually indicate the alert type.\n * - Use the `icon` slot for a source/system icon if needed.\n * - Only show the \"ACK\" action for alerts that require acknowledgment.\n * - Use the `shelved` property to indicate alerts that are temporarily deferred.\n *\n * ### Slots\n * | Slot Name | Renders When... | Purpose |\n * |---------------|-------------------------------|------------------------------------------------------|\n * | alert-icon | Always | Main alert icon representing the alert type. |\n * | icon | If `hasIcon` is true | Secondary icon (e.g., system/source of alert). |\n *\n * ### Events\n * - **ack-click** – Fired when the ACK action button is clicked.\n * - **item-click** – Fired when the alert menu item is clicked (toggles open/closed).\n *\n * ### Best Practices\n * - Only display the ACK action for alerts that require acknowledgment.\n * - Use concise titles and descriptions for quick scanning.\n * - For grouped alerts, ensure each item has a unique status and icon as appropriate.\n * - Avoid overloading with too many icons; use secondary and tertiary icons only when necessary.\n * - Follow standard notification design guidelines: keep actionable items prominent, and use color/iconography to indicate severity or status.\n *\n * **Example:**\n * ```\n * <obc-alert-menu-item\n * status=\"unacknowledged\"\n * title=\"Engine Temperature High\"\n * description=\"Port main engine temperature exceeds normal operating range\"\n * time=\"14:30\"\n * hasIcon\n * >\n * <obc-alert-icon slot=\"alert-icon\" type=\"alarm\" active></obc-alert-icon>\n * <obi-engine slot=\"icon\"></obi-engine>\n * </obc-alert-menu-item>\n * ```\n *\n * @slot alert-icon - The main alert icon representing the alert type.\n * @slot icon - Optional secondary icon (e.g., source/system).\n *\n * @fires ack-click {CustomEvent<void>} Fired when the ACK action button is clicked.\n * @fires item-click {CustomEvent<void>} Fired when the alert menu item is clicked.\n */\n@customElement('obc-alert-menu-item')\nexport class ObcAlertMenuItem extends LitElement {\n /**\n * Whether to display a secondary icon (e.g., system/source) in the item.\n * When true, the `icon` slot is rendered.\n */\n @property({type: Boolean}) hasIcon = false;\n\n /**\n * Indicates if the alert is shelved (temporarily deferred).\n * When true, a tertiary icon is shown to represent the shelved state.\n */\n @property({type: Boolean, reflect: true}) shelved = false;\n\n /**\n * The title of the alert.\n */\n @property({type: String}) override title = '';\n\n /**\n * The description of the alert.\n */\n @property({type: String}) description = '';\n\n /**\n * The day label for the alert (e.g., \"Yesterday\").\n */\n @property({type: String}) day = '';\n\n /**\n * The time label for the alert (e.g., \"14:30\").\n */\n @property({type: String}) time = '';\n\n /**\n * The current status of the alert item.\n * Determines visual style, icon, and action button visibility.\n * Possible values: 'unacknowledged', 'caution', 'acknowledged', 'no-ack-alarm', 'no-ack-warning', 'rectified'.\n * Default is 'unacknowledged'.\n */\n @property({type: String, reflect: true}) status =\n ObcAlertMenuItemStatus.Unacknowledged;\n\n /**\n * Whether the item is expanded/open to show additional details.\n * Toggled by clicking the item.\n */\n @property({type: Boolean}) open = false;\n\n /**\n * Layout size of the menu item.\n * Controls whether content is single-line or multi-line.\n * Possible values: 'single-line', 'multi-line'.\n * Default is 'single-line'.\n */\n @property({type: String}) size: ObcMessageMenuItemSize =\n ObcMessageMenuItemSize.SingleLine;\n\n /**\n * Whether to animate the item's appearance (intro animation).\n */\n @property({type: Boolean}) animateIntro = false;\n\n private get primaryActionLabel() {\n return this.status === ObcAlertMenuItemStatus.Unacknowledged ? 'ACK' : '';\n }\n\n private get hasTrailingIcon() {\n // True when we need the action container but don't have an ACK button\n return this.status !== ObcAlertMenuItemStatus.Unacknowledged;\n }\n\n private handleMessageClick() {\n this.dispatchEvent(new CustomEvent('item-click'));\n this.open = !this.open;\n }\n\n private handleActionClick() {\n this.dispatchEvent(new CustomEvent('ack-click'));\n }\n\n override render() {\n return html`\n <obc-message-menu-item\n .title=${this.title}\n .description=${this.description}\n .day=${this.day}\n .time=${this.time}\n .primaryActionLabel=${this.primaryActionLabel}\n .size=${this.size}\n .open=${this.open}\n .hasSecondaryIcon=${this.hasIcon}\n .isShelved=${this.shelved}\n .hasTrailingIcon=${this.hasTrailingIcon}\n enhancedIcon\n hasPrimaryIcon\n @message-click=${this.handleMessageClick}\n @primary-action-click=${this.handleActionClick}\n >\n <slot name=\"alert-icon\" slot=\"primary-icon\"></slot>\n <slot name=\"title\" slot=\"title\">${this.title}</slot>\n <slot name=\"description\" slot=\"description\">${this.description}</slot>\n ${this.hasIcon\n ? html`<slot name=\"icon\" slot=\"secondary-icon\"></slot>`\n : nothing}\n ${choose(this.status, [\n [\n ObcAlertMenuItemStatus.NoAckAlarm,\n () =>\n html`<obi-alarm-noack-iec\n slot=\"trailing-icon\"\n useCssColor\n ></obi-alarm-noack-iec>`,\n ],\n [\n ObcAlertMenuItemStatus.NoAckWarning,\n () =>\n html`<obi-warning-noack-iec\n slot=\"trailing-icon\"\n useCssColor\n ></obi-warning-noack-iec>`,\n ],\n ])}\n </obc-message-menu-item>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ob-alert-menu-item': ObcAlertMenuItem;\n }\n}\n"],"names":["ObcAlertMenuItemStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaO,IAAK,2CAAAA,4BAAL;AACLA,0BAAA,gBAAA,IAAiB;AACjBA,0BAAA,SAAA,IA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hB,mBAAN,gBAAA;AAAA,EADN,cAAc,qBAAqB;AAAA,GACvB,gBAAA;"}
|
|
1
|
+
{"version":3,"file":"alert-menu-item.js","sources":["../../../src/components/alert-menu-item/alert-menu-item.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {choose} from 'lit/directives/choose.js';\n\nimport compentStyle from './alert-menu-item.css?inline';\nimport '../message-menu-item/message-menu-item.js';\nimport '../alert-icon/alert-icon.js';\nimport '../../icons/icon-alerts-shelf.js';\nimport '../../icons/icon-alarm-noack-iec.js';\nimport '../../icons/icon-warning-noack-iec.js';\nimport {ObcMessageMenuItemSize} from '../message-menu-item/message-menu-item.js';\nimport {customElement} from '../../decorator.js';\n\nexport enum ObcAlertMenuItemStatus {\n Unacknowledged = 'unacknowledged',\n Caution = 'caution',\n Acknowledged = 'acknowledged',\n NoAckAlarm = 'no-ack-alarm',\n NoAckWarning = 'no-ack-warning',\n Rectified = 'rectified',\n}\n\n/**\n * Appearance of an alert menu item action.\n * - `enabled`: Action is shown and interactive (default).\n * - `disabled`: Action is shown but cannot be triggered.\n * - `none`: Action is removed and takes no space.\n */\nexport enum ObcAlertMenuItemActionState {\n Enabled = 'enabled',\n Disabled = 'disabled',\n None = 'none',\n}\n\n/**\n * `<obc-alert-menu-item>` – A list item component for displaying alert or notification entries with status, icons, and action controls.\n *\n * Presents a concise summary of an alert or message, including status, title, description, and optional icons. Designed for use in alert menus, notification drawers, or similar lists where users need to review and acknowledge alerts efficiently.\n *\n * ### Features\n * - **Status Variants:** Supports multiple alert states via the `status` property:\n * - **Unacknowledged:** Shows an action button (ACK) for user acknowledgment.\n * - **Caution, Acknowledged, Rectified:** Display different visual cues for alert progression.\n * - **NoAckAlarm / NoAckWarning:** Show special icons indicating unacknowledged alarms or warnings.\n * - **Icon Support:** Optional secondary icon (e.g., system or source) and a primary alert icon. Tertiary \"shelved\" icon appears if the alert is shelved.\n * - **Time and Day Display:** Optionally shows day and/or time for the alert occurrence.\n * - **Expandable:** Can be toggled open/closed for additional details (via click).\n * - **Action Buttons:** Displays an \"ACK\" button for unacknowledged alerts and an optional secondary action (label set via `secondaryActionLabel`); each triggers an event when clicked.\n * - Each action's appearance is controlled independently via `primaryActionState` / `secondaryActionState` (`enabled`, `disabled`, or `none`).\n * - **Animated Intro:** Optional animation when the item appears.\n * - **Size Options:** Supports single-line or multi-line layouts (see `size` property).\n *\n * ### Usage Guidelines\n * Use `obc-alert-menu-item` to represent individual alerts or notifications in a menu, list, or notification center. Ideal for scenarios where users need to quickly scan, identify, and acknowledge alerts. The component is best suited for transient or actionable notifications rather than persistent banners.\n *\n * - Use the `status` property to reflect the current state of the alert.\n * - Provide a relevant icon in the `alert-icon` slot to visually indicate the alert type.\n * - Use the `icon` slot for a source/system icon if needed.\n * - Only show the \"ACK\" action for alerts that require acknowledgment.\n * - Provide `secondaryActionLabel` to add a second action alongside ACK.\n * - Use `primaryActionState` / `secondaryActionState` to temporarily disable an action (`disabled`) or remove it without leaving a gap (`none`).\n * - Use the `shelved` property to indicate alerts that are temporarily deferred.\n *\n * ### Slots\n * | Slot Name | Renders When... | Purpose |\n * |---------------|-------------------------------|------------------------------------------------------|\n * | alert-icon | Always | Main alert icon representing the alert type. |\n * | icon | If `hasIcon` is true | Secondary icon (e.g., system/source of alert). |\n *\n * ### Events\n * - **ack-click** – Fired when the ACK action button is clicked.\n * - **ack-secondary-click** – Fired when the secondary action button is clicked.\n * - **item-click** – Fired when the alert menu item is clicked (toggles open/closed).\n *\n * ### Best Practices\n * - Only display the ACK action for alerts that require acknowledgment.\n * - Use concise titles and descriptions for quick scanning.\n * - For grouped alerts, ensure each item has a unique status and icon as appropriate.\n * - Avoid overloading with too many icons; use secondary and tertiary icons only when necessary.\n * - Follow standard notification design guidelines: keep actionable items prominent, and use color/iconography to indicate severity or status.\n *\n * **Example:**\n * ```\n * <obc-alert-menu-item\n * status=\"unacknowledged\"\n * title=\"Engine Temperature High\"\n * description=\"Port main engine temperature exceeds normal operating range\"\n * time=\"14:30\"\n * hasIcon\n * >\n * <obc-alert-icon slot=\"alert-icon\" type=\"alarm\" active></obc-alert-icon>\n * <obi-engine slot=\"icon\"></obi-engine>\n * </obc-alert-menu-item>\n * ```\n *\n * @slot alert-icon - The main alert icon representing the alert type.\n * @slot icon - Optional secondary icon (e.g., source/system).\n *\n * @fires ack-click {CustomEvent<void>} Fired when the ACK action button is clicked.\n * @fires ack-secondary-click {CustomEvent<void>} Fired when the secondary action button is clicked.\n * @fires item-click {CustomEvent<void>} Fired when the alert menu item is clicked.\n */\n@customElement('obc-alert-menu-item')\nexport class ObcAlertMenuItem extends LitElement {\n /**\n * Whether to display a secondary icon (e.g., system/source) in the item.\n * When true, the `icon` slot is rendered.\n */\n @property({type: Boolean}) hasIcon = false;\n\n /**\n * Indicates if the alert is shelved (temporarily deferred).\n * When true, a tertiary icon is shown to represent the shelved state.\n */\n @property({type: Boolean, reflect: true}) shelved = false;\n\n /**\n * The title of the alert.\n */\n @property({type: String}) override title = '';\n\n /**\n * The description of the alert.\n */\n @property({type: String}) description = '';\n\n /**\n * The day label for the alert (e.g., \"Yesterday\").\n */\n @property({type: String}) day = '';\n\n /**\n * The time label for the alert (e.g., \"14:30\").\n */\n @property({type: String}) time = '';\n\n /**\n * The current status of the alert item.\n * Determines visual style, icon, and action button visibility.\n * Possible values: 'unacknowledged', 'caution', 'acknowledged', 'no-ack-alarm', 'no-ack-warning', 'rectified'.\n * Default is 'unacknowledged'.\n */\n @property({type: String, reflect: true}) status =\n ObcAlertMenuItemStatus.Unacknowledged;\n\n /**\n * Whether the item is expanded/open to show additional details.\n * Toggled by clicking the item.\n */\n @property({type: Boolean}) open = false;\n\n /**\n * Layout size of the menu item.\n * Controls whether content is single-line or multi-line.\n * Possible values: 'single-line', 'multi-line'.\n * Default is 'single-line'.\n */\n @property({type: String}) size: ObcMessageMenuItemSize =\n ObcMessageMenuItemSize.SingleLine;\n\n /**\n * Whether to animate the item's appearance (intro animation).\n */\n @property({type: Boolean}) animateIntro = false;\n\n /**\n * The label for the secondary action button.\n * Unlike the primary (ACK) action, the secondary label is not derived from\n * `status`; it must be provided explicitly. The secondary action is only\n * shown when a non-empty label is set and `secondaryActionState` is not\n * `none`.\n */\n @property({type: String}) secondaryActionLabel = '';\n\n /**\n * Controls the appearance of the primary (ACK) action.\n * See {@link ObcAlertMenuItemActionState} for the available states.\n */\n @property({type: String}) primaryActionState: ObcAlertMenuItemActionState =\n ObcAlertMenuItemActionState.Enabled;\n\n /**\n * Controls the appearance of the secondary action.\n * See {@link ObcAlertMenuItemActionState} for the available states.\n */\n @property({type: String}) secondaryActionState: ObcAlertMenuItemActionState =\n ObcAlertMenuItemActionState.None;\n\n private get primaryActionLabel() {\n if (this.primaryActionState === ObcAlertMenuItemActionState.None) {\n return '';\n }\n return this.status === ObcAlertMenuItemStatus.Unacknowledged ? 'ACK' : '';\n }\n\n private get secondaryActionLabelToShow() {\n if (this.secondaryActionState === ObcAlertMenuItemActionState.None) {\n return '';\n }\n return this.secondaryActionLabel;\n }\n\n private get primaryActionDisabled() {\n return this.primaryActionState === ObcAlertMenuItemActionState.Disabled;\n }\n\n private get secondaryActionDisabled() {\n return this.secondaryActionState === ObcAlertMenuItemActionState.Disabled;\n }\n\n private get hasTrailingIcon() {\n // True when we need the action container but don't have an ACK button\n return this.status !== ObcAlertMenuItemStatus.Unacknowledged;\n }\n\n private handleMessageClick() {\n this.dispatchEvent(new CustomEvent('item-click'));\n this.open = !this.open;\n }\n\n private handleActionClick() {\n this.dispatchEvent(new CustomEvent('ack-click'));\n }\n\n private handleSecondaryActionClick() {\n this.dispatchEvent(new CustomEvent('ack-secondary-click'));\n }\n\n override render() {\n return html`\n <obc-message-menu-item\n .title=${this.title}\n .description=${this.description}\n .day=${this.day}\n .time=${this.time}\n .primaryActionLabel=${this.primaryActionLabel}\n .secondaryActionLabel=${this.secondaryActionLabelToShow}\n .enablePrimaryAction=${!this.primaryActionDisabled}\n .enableSecondaryAction=${!this.secondaryActionDisabled}\n .size=${this.size}\n .open=${this.open}\n .hasSecondaryIcon=${this.hasIcon}\n .isShelved=${this.shelved}\n .hasTrailingIcon=${this.hasTrailingIcon}\n enhancedIcon\n hasPrimaryIcon\n @message-click=${this.handleMessageClick}\n @primary-action-click=${this.handleActionClick}\n @secondary-action-click=${this.handleSecondaryActionClick}\n >\n <slot name=\"alert-icon\" slot=\"primary-icon\"></slot>\n <slot name=\"title\" slot=\"title\">${this.title}</slot>\n <slot name=\"description\" slot=\"description\">${this.description}</slot>\n ${this.hasIcon\n ? html`<slot name=\"icon\" slot=\"secondary-icon\"></slot>`\n : nothing}\n ${choose(this.status, [\n [\n ObcAlertMenuItemStatus.NoAckAlarm,\n () =>\n html`<obi-alarm-noack-iec\n slot=\"trailing-icon\"\n useCssColor\n ></obi-alarm-noack-iec>`,\n ],\n [\n ObcAlertMenuItemStatus.NoAckWarning,\n () =>\n html`<obi-warning-noack-iec\n slot=\"trailing-icon\"\n useCssColor\n ></obi-warning-noack-iec>`,\n ],\n ])}\n </obc-message-menu-item>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ob-alert-menu-item': ObcAlertMenuItem;\n }\n}\n"],"names":["ObcAlertMenuItemStatus","ObcAlertMenuItemActionState"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaO,IAAK,2CAAAA,4BAAL;AACLA,0BAAA,gBAAA,IAAiB;AACjBA,0BAAA,SAAA,IAAU;AACVA,0BAAA,cAAA,IAAe;AACfA,0BAAA,YAAA,IAAa;AACbA,0BAAA,cAAA,IAAe;AACfA,0BAAA,WAAA,IAAY;AANF,SAAAA;AAAA,GAAA,0BAAA,CAAA,CAAA;AAeL,IAAK,gDAAAC,iCAAL;AACLA,+BAAA,SAAA,IAAU;AACVA,+BAAA,UAAA,IAAW;AACXA,+BAAA,MAAA,IAAO;AAHG,SAAAA;AAAA,GAAA,+BAAA,CAAA,CAAA;A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;AAQe,gBAAA;AAAA,EAAxC,SAAS,EAAC,MAAM,QAAQ,SAAS,MAAK;AAAA,GAvC5B,iBAuC8B,WAAA,UAAA,CAAA;AAOd,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA9Cd,iBA8CgB,WAAA,QAAA,CAAA;AAQD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAtDb,iBAsDe,WAAA,QAAA,CAAA;AAMC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA5Dd,iBA4DgB,WAAA,gBAAA,CAAA;AASD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GArEb,iBAqEe,WAAA,wBAAA,CAAA;AAMA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GA3Eb,iBA2Ee,WAAA,sBAAA,CAAA;AAOA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAlFb,iBAkFe,WAAA,wBAAA,CAAA;AAlFf,mBAAN,gBAAA;AAAA,EADN,cAAc,qBAAqB;AAAA,GACvB,gBAAA;"}
|
|
@@ -31,6 +31,7 @@ export declare enum ObcMessageMenuItemSize {
|
|
|
31
31
|
*
|
|
32
32
|
* - **Actions:**
|
|
33
33
|
* - Supports up to two action buttons via `primaryActionLabel` and `secondaryActionLabel`.
|
|
34
|
+
* - Each action can be independently disabled by setting `enablePrimaryAction` or `enableSecondaryAction` to `false`.
|
|
34
35
|
* - In vertical layout, action buttons expand to full width.
|
|
35
36
|
*
|
|
36
37
|
* - **Timestamp:**
|
|
@@ -46,6 +47,7 @@ export declare enum ObcMessageMenuItemSize {
|
|
|
46
47
|
* - Use `stackVertical=true` when actions need more prominence or when space is narrow.
|
|
47
48
|
* - Enable `enhancedIcon` to highlight important or priority messages.
|
|
48
49
|
* - Use `isShelved` to indicate messages that have been temporarily set aside.
|
|
50
|
+
* - Set `enablePrimaryAction` / `enableSecondaryAction` to `false` when an action is temporarily unavailable (e.g. awaiting a precondition) rather than removing the button.
|
|
49
51
|
*
|
|
50
52
|
* ## Slots
|
|
51
53
|
*
|
|
@@ -123,6 +125,8 @@ export declare class ObcMessageMenuItem extends LitElement {
|
|
|
123
125
|
time: string;
|
|
124
126
|
primaryActionLabel: string;
|
|
125
127
|
secondaryActionLabel: string;
|
|
128
|
+
enablePrimaryAction: boolean;
|
|
129
|
+
enableSecondaryAction: boolean;
|
|
126
130
|
hasPrimaryIcon: boolean;
|
|
127
131
|
hasSecondaryIcon: boolean;
|
|
128
132
|
hasTrailingIcon: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-menu-item.d.ts","sourceRoot":"","sources":["../../../src/components/message-menu-item/message-menu-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAIzD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yCAAyC,CAAC;AACjD,OAAO,uCAAuC,CAAC;AAE/C,OAAO,kCAAkC,CAAC;AAE1C,oBAAY,sBAAsB;IAChC,UAAU,gBAAgB;IAC1B,UAAU,gBAAgB;CAC3B;AAED
|
|
1
|
+
{"version":3,"file":"message-menu-item.d.ts","sourceRoot":"","sources":["../../../src/components/message-menu-item/message-menu-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAIzD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yCAAyC,CAAC;AACjD,OAAO,uCAAuC,CAAC;AAE/C,OAAO,kCAAkC,CAAC;AAE1C,oBAAY,sBAAsB;IAChC,UAAU,gBAAgB;IAC1B,UAAU,gBAAgB;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0GG;AACH,qBACa,kBAAmB,SAAQ,UAAU;IAEtB,IAAI,EAAE,sBAAsB,CAClB;IACT,aAAa,UAAS;IACtB,YAAY,UAAS;IACrB,IAAI,UAAS;IAGL,KAAK,SAAM;IACpB,WAAW,SAAM;IACjB,GAAG,SAAM;IACT,IAAI,SAAM;IACV,kBAAkB,SAAM;IACxB,oBAAoB,SAAM;IACP,mBAAmB,UAAQ;IAC3B,qBAAqB,UAAQ;IAG/C,cAAc,UAAS;IACvB,gBAAgB,UAAS;IACzB,eAAe,UAAS;IACxB,SAAS,UAAS;IAElB,kBAAkB,UAAS;IAEtD,OAAO,KAAK,UAAU,GAKrB;IAED,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,KAAK,MAAM,GAEjB;IAED,OAAO,KAAK,gBAAgB,GAE3B;IAED,OAAO,KAAK,kBAAkB,GAE7B;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,0BAA0B;IAWzB,MAAM;IA4Ff,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,uBAAuB,EAAE,kBAAkB,CAAC;KAC7C;CACF"}
|
|
@@ -35,6 +35,8 @@ let ObcMessageMenuItem = class extends LitElement {
|
|
|
35
35
|
this.time = "";
|
|
36
36
|
this.primaryActionLabel = "";
|
|
37
37
|
this.secondaryActionLabel = "";
|
|
38
|
+
this.enablePrimaryAction = true;
|
|
39
|
+
this.enableSecondaryAction = true;
|
|
38
40
|
this.hasPrimaryIcon = false;
|
|
39
41
|
this.hasSecondaryIcon = false;
|
|
40
42
|
this.hasTrailingIcon = false;
|
|
@@ -151,6 +153,7 @@ let ObcMessageMenuItem = class extends LitElement {
|
|
|
151
153
|
variant="normal"
|
|
152
154
|
.fullWidth=${this.isVertical}
|
|
153
155
|
@click=${this.handleSecondaryActionClick}
|
|
156
|
+
?disabled=${!this.enableSecondaryAction}
|
|
154
157
|
>
|
|
155
158
|
${this.secondaryActionLabel}
|
|
156
159
|
</obc-button>` : nothing}
|
|
@@ -158,6 +161,7 @@ let ObcMessageMenuItem = class extends LitElement {
|
|
|
158
161
|
variant="normal"
|
|
159
162
|
.fullWidth=${this.isVertical}
|
|
160
163
|
@click=${this.handlePrimaryActionClick}
|
|
164
|
+
?disabled=${!this.enablePrimaryAction}
|
|
161
165
|
>
|
|
162
166
|
${this.hasActionLabelSlot ? html`<slot name="action-label"></slot>` : this.primaryActionLabel}
|
|
163
167
|
</obc-button>` : nothing}
|
|
@@ -200,6 +204,12 @@ __decorateClass([
|
|
|
200
204
|
__decorateClass([
|
|
201
205
|
property({ type: String })
|
|
202
206
|
], ObcMessageMenuItem.prototype, "secondaryActionLabel", 2);
|
|
207
|
+
__decorateClass([
|
|
208
|
+
property({ type: Boolean, attribute: false })
|
|
209
|
+
], ObcMessageMenuItem.prototype, "enablePrimaryAction", 2);
|
|
210
|
+
__decorateClass([
|
|
211
|
+
property({ type: Boolean, attribute: false })
|
|
212
|
+
], ObcMessageMenuItem.prototype, "enableSecondaryAction", 2);
|
|
203
213
|
__decorateClass([
|
|
204
214
|
property({ type: Boolean })
|
|
205
215
|
], ObcMessageMenuItem.prototype, "hasPrimaryIcon", 2);
|
|
@@ -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,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,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AA,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,Y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