@oicl/openbridge-webcomponents 2.0.0-next.137 → 2.0.0-next.138
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 +4091 -3919
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +150 -0
- package/dist/components/alert-subsystem-counter/alert-subsystem-counter.css.js +113 -0
- package/dist/components/alert-subsystem-counter/alert-subsystem-counter.css.js.map +1 -0
- package/dist/components/alert-subsystem-counter/alert-subsystem-counter.d.ts +108 -0
- package/dist/components/alert-subsystem-counter/alert-subsystem-counter.d.ts.map +1 -0
- package/dist/components/alert-subsystem-counter/alert-subsystem-counter.js +79 -0
- package/dist/components/alert-subsystem-counter/alert-subsystem-counter.js.map +1 -0
- package/package.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -55979,6 +55979,156 @@
|
|
|
55979
55979
|
}
|
|
55980
55980
|
]
|
|
55981
55981
|
},
|
|
55982
|
+
{
|
|
55983
|
+
"kind": "javascript-module",
|
|
55984
|
+
"path": "src/components/alert-subsystem-counter/alert-subsystem-counter.ts",
|
|
55985
|
+
"declarations": [
|
|
55986
|
+
{
|
|
55987
|
+
"kind": "class",
|
|
55988
|
+
"description": "`<obc-alert-subsystem-counter>` – A framed summary of a subsystem's alert\ncounts: a leading icon, a label, and a trailing set of slotted count badges.\n\nWhen there are no active alerts it shows a muted label and an empty-state\nmessage instead of the badges. The count badges themselves are supplied by\nthe consumer as slotted `obc-badge` elements; this component provides only\nthe frame, layout, label, and empty state.\n\n---\n\n### Features\n- **Orientation:** `horizontal` (single row) or `vertical` (badges on a line\n below the label).\n- **Alert state:** `hasAlert` toggles between an active (bold label, badges)\n and an inactive (muted label, empty text) presentation.\n- **Freeform label:** Pass a full title or an abbreviation — the label is\n plain text decided by the caller and truncates with an ellipsis.\n- **Configurable empty text:** Customize the message shown when there are no\n alerts via `emptyText`.\n- **Optional leading icon:** Provide an icon through the `icon` slot; omit it\n and the leading box collapses with no empty gap.\n\n---\n\n### Usage Guidelines\n- Use this component to give an at-a-glance count of outstanding alerts for a\n single subsystem, grouped by severity.\n- Provide one slotted badge per severity in the `badges` slot, typically\n `<obc-badge size=\"large\">` with a severity `type` and a `number`. The\n badge `type` values are the same severity vocabulary as `AlertType`\n (`alarm`, `warning`, `caution` and the `level-*` family); order them\n highest severity first, as `ALERT_SEVERITY_PRIORITY` does.\n- Set `hasAlert` to `false` to present the resolved/clear state; the badges\n are then not rendered and `emptyText` is shown. The component does not\n derive the state from the slotted badges — the consumer owns it.\n- Choose `vertical` orientation in narrow containers where the badges do not\n fit beside the label.\n- The counter is display-only: it renders no button and fires no events. For\n a clickable subsystem entry with badges, see `obc-tree-navigation-item`\n (`alertBadges`) or `obc-integration-fleet-button` (`alerts`).\n\n---\n\n### Slots\n\n| Slot Name | Renders When... | Purpose |\n|-----------|------------------------|----------------------------------------------------|\n| `icon` | The slot has content | Leading 24px icon (e.g. `<obi-placeholder>`). |\n| `badges` | `hasAlert` is true | Count badges, one per severity (`<obc-badge>`). |\n\n---\n\n### Example\n\n```html\n<obc-alert-subsystem-counter label=\"Label\" hasAlert>\n <obi-placeholder slot=\"icon\"></obi-placeholder>\n <obc-badge slot=\"badges\" size=\"large\" type=\"alarm\" .number=${9}></obc-badge>\n <obc-badge slot=\"badges\" size=\"large\" type=\"warning\" .number=${4}></obc-badge>\n <obc-badge slot=\"badges\" size=\"large\" type=\"caution\" .number=${2}></obc-badge>\n</obc-alert-subsystem-counter>\n```",
|
|
55989
|
+
"name": "ObcAlertSubsystemCounter",
|
|
55990
|
+
"slots": [
|
|
55991
|
+
{
|
|
55992
|
+
"description": "Optional leading 24px icon.",
|
|
55993
|
+
"name": "icon"
|
|
55994
|
+
},
|
|
55995
|
+
{
|
|
55996
|
+
"description": "Count badges shown when `hasAlert` is true.",
|
|
55997
|
+
"name": "badges"
|
|
55998
|
+
}
|
|
55999
|
+
],
|
|
56000
|
+
"members": [
|
|
56001
|
+
{
|
|
56002
|
+
"kind": "field",
|
|
56003
|
+
"name": "label",
|
|
56004
|
+
"type": {
|
|
56005
|
+
"text": "string"
|
|
56006
|
+
},
|
|
56007
|
+
"default": "''",
|
|
56008
|
+
"description": "The subsystem label. Pass a full title or an abbreviation as plain text.",
|
|
56009
|
+
"attribute": "label"
|
|
56010
|
+
},
|
|
56011
|
+
{
|
|
56012
|
+
"kind": "field",
|
|
56013
|
+
"name": "orientation",
|
|
56014
|
+
"type": {
|
|
56015
|
+
"text": "ObcAlertSubsystemCounterOrientation"
|
|
56016
|
+
},
|
|
56017
|
+
"description": "Layout direction: `horizontal` (default) keeps icon, label and badges in one row; `vertical` moves the badges (or empty text) to a line below the label.",
|
|
56018
|
+
"attribute": "orientation"
|
|
56019
|
+
},
|
|
56020
|
+
{
|
|
56021
|
+
"kind": "field",
|
|
56022
|
+
"name": "hasAlert",
|
|
56023
|
+
"type": {
|
|
56024
|
+
"text": "boolean"
|
|
56025
|
+
},
|
|
56026
|
+
"default": "false",
|
|
56027
|
+
"description": "Whether the subsystem has active alerts. `true` shows the label bold and renders the `badges` slot; `false` mutes the label and shows `emptyText` instead of the badges.",
|
|
56028
|
+
"attribute": "hasAlert"
|
|
56029
|
+
},
|
|
56030
|
+
{
|
|
56031
|
+
"kind": "field",
|
|
56032
|
+
"name": "emptyText",
|
|
56033
|
+
"type": {
|
|
56034
|
+
"text": "string"
|
|
56035
|
+
},
|
|
56036
|
+
"default": "'No alerts'",
|
|
56037
|
+
"description": "Text shown in the trailing area when `hasAlert` is `false`.\n\nAvailable when `hasAlert==false`.",
|
|
56038
|
+
"attribute": "emptyText",
|
|
56039
|
+
"availableWhen": "hasAlert==false",
|
|
56040
|
+
"availableWhenIf": {
|
|
56041
|
+
"arg": "hasAlert",
|
|
56042
|
+
"truthy": false
|
|
56043
|
+
}
|
|
56044
|
+
},
|
|
56045
|
+
{
|
|
56046
|
+
"kind": "field",
|
|
56047
|
+
"name": "hasIcon",
|
|
56048
|
+
"type": {
|
|
56049
|
+
"text": "boolean"
|
|
56050
|
+
},
|
|
56051
|
+
"privacy": "private",
|
|
56052
|
+
"default": "false"
|
|
56053
|
+
},
|
|
56054
|
+
{
|
|
56055
|
+
"kind": "method",
|
|
56056
|
+
"name": "handleIconSlotChange",
|
|
56057
|
+
"privacy": "private",
|
|
56058
|
+
"parameters": [
|
|
56059
|
+
{
|
|
56060
|
+
"name": "e",
|
|
56061
|
+
"type": {
|
|
56062
|
+
"text": "Event"
|
|
56063
|
+
}
|
|
56064
|
+
}
|
|
56065
|
+
]
|
|
56066
|
+
}
|
|
56067
|
+
],
|
|
56068
|
+
"attributes": [
|
|
56069
|
+
{
|
|
56070
|
+
"name": "label",
|
|
56071
|
+
"type": {
|
|
56072
|
+
"text": "string"
|
|
56073
|
+
},
|
|
56074
|
+
"default": "''",
|
|
56075
|
+
"description": "The subsystem label. Pass a full title or an abbreviation as plain text.",
|
|
56076
|
+
"fieldName": "label"
|
|
56077
|
+
},
|
|
56078
|
+
{
|
|
56079
|
+
"name": "orientation",
|
|
56080
|
+
"type": {
|
|
56081
|
+
"text": "ObcAlertSubsystemCounterOrientation"
|
|
56082
|
+
},
|
|
56083
|
+
"description": "Layout direction: `horizontal` (default) keeps icon, label and badges in one row; `vertical` moves the badges (or empty text) to a line below the label.",
|
|
56084
|
+
"fieldName": "orientation"
|
|
56085
|
+
},
|
|
56086
|
+
{
|
|
56087
|
+
"name": "hasAlert",
|
|
56088
|
+
"type": {
|
|
56089
|
+
"text": "boolean"
|
|
56090
|
+
},
|
|
56091
|
+
"default": "false",
|
|
56092
|
+
"description": "Whether the subsystem has active alerts. `true` shows the label bold and renders the `badges` slot; `false` mutes the label and shows `emptyText` instead of the badges.",
|
|
56093
|
+
"fieldName": "hasAlert"
|
|
56094
|
+
},
|
|
56095
|
+
{
|
|
56096
|
+
"name": "emptyText",
|
|
56097
|
+
"type": {
|
|
56098
|
+
"text": "string"
|
|
56099
|
+
},
|
|
56100
|
+
"default": "'No alerts'",
|
|
56101
|
+
"description": "Text shown in the trailing area when `hasAlert` is `false`.\n\nAvailable when `hasAlert==false`.",
|
|
56102
|
+
"fieldName": "emptyText"
|
|
56103
|
+
}
|
|
56104
|
+
],
|
|
56105
|
+
"superclass": {
|
|
56106
|
+
"name": "LitElement",
|
|
56107
|
+
"package": "lit"
|
|
56108
|
+
},
|
|
56109
|
+
"tagName": "obc-alert-subsystem-counter",
|
|
56110
|
+
"customElement": true
|
|
56111
|
+
}
|
|
56112
|
+
],
|
|
56113
|
+
"exports": [
|
|
56114
|
+
{
|
|
56115
|
+
"kind": "js",
|
|
56116
|
+
"name": "ObcAlertSubsystemCounter",
|
|
56117
|
+
"declaration": {
|
|
56118
|
+
"name": "ObcAlertSubsystemCounter",
|
|
56119
|
+
"module": "src/components/alert-subsystem-counter/alert-subsystem-counter.ts"
|
|
56120
|
+
}
|
|
56121
|
+
},
|
|
56122
|
+
{
|
|
56123
|
+
"kind": "custom-element-definition",
|
|
56124
|
+
"name": "obc-alert-subsystem-counter",
|
|
56125
|
+
"declaration": {
|
|
56126
|
+
"name": "ObcAlertSubsystemCounter",
|
|
56127
|
+
"module": "src/components/alert-subsystem-counter/alert-subsystem-counter.ts"
|
|
56128
|
+
}
|
|
56129
|
+
}
|
|
56130
|
+
]
|
|
56131
|
+
},
|
|
55982
56132
|
{
|
|
55983
56133
|
"kind": "javascript-module",
|
|
55984
56134
|
"path": "src/components/app-button/app-button.ts",
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
const componentStyle = css`* {
|
|
3
|
+
-webkit-tap-highlight-color: transparent;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.frame {
|
|
11
|
+
box-sizing: border-box; /* the host width is the frame width, border included */
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: 8px;
|
|
15
|
+
padding: 8px;
|
|
16
|
+
border-radius: 6px;
|
|
17
|
+
background: var(--container-section-color);
|
|
18
|
+
border: 1px solid var(--border-outline-color);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.frame.orientation-vertical {
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
align-items: stretch;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.leading-container {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex: 1 0 0; /* takes the width the badges leave over, so the label can truncate */
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: 4px;
|
|
31
|
+
min-width: 0; /* lets the label shrink below its text width */
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.icon {
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
width: var(--global-size-spacing-icon-icon-size-regular);
|
|
37
|
+
height: var(--global-size-spacing-icon-icon-size-regular);
|
|
38
|
+
color: var(--on-indent-neutral-color);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.icon.no-icon {
|
|
42
|
+
display: none; /* collapses the flex gap too, so an iconless counter has no leading hole */
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.label {
|
|
46
|
+
font-family: var(--global-typography-font-family);
|
|
47
|
+
font-weight: var(--global-typography-ui-body-font-weight);
|
|
48
|
+
font-size: var(--global-typography-ui-body-font-size);
|
|
49
|
+
line-height: var(--global-typography-ui-body-line-height);
|
|
50
|
+
font-feature-settings:
|
|
51
|
+
"liga" off,
|
|
52
|
+
"clig" off,
|
|
53
|
+
"ss04" on;
|
|
54
|
+
flex: 1 0 0;
|
|
55
|
+
min-width: 0; /* required for text-overflow to kick in inside a flex item */
|
|
56
|
+
padding-left: 4px;
|
|
57
|
+
color: var(--element-inactive-color);
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
text-overflow: ellipsis;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.frame.has-alert .label {
|
|
64
|
+
font-family: var(--global-typography-font-family);
|
|
65
|
+
font-weight: var(--global-typography-ui-body-active-font-weight);
|
|
66
|
+
font-size: var(--global-typography-ui-body-active-font-size);
|
|
67
|
+
line-height: var(--global-typography-ui-body-active-line-height);
|
|
68
|
+
font-feature-settings:
|
|
69
|
+
"liga" off,
|
|
70
|
+
"clig" off,
|
|
71
|
+
"ss04" on;
|
|
72
|
+
color: var(--on-indent-active-color);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.trailing-container {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-shrink: 0; /* badges keep their size; the label is what gives way */
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: 4px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.frame.orientation-horizontal .trailing-container {
|
|
83
|
+
justify-content: flex-end;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.frame.orientation-vertical .trailing-container {
|
|
87
|
+
align-self: flex-start; /* hugs its content under the label instead of stretching across the frame */
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.frame:not(.has-alert) .trailing-container {
|
|
91
|
+
justify-content: center;
|
|
92
|
+
/* same row height as the large badges it stands in for */
|
|
93
|
+
height: var(--ui-components-badge-min-size-large);
|
|
94
|
+
padding: 0 8px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.empty {
|
|
98
|
+
font-family: var(--global-typography-font-family);
|
|
99
|
+
font-weight: var(--global-typography-ui-label-font-weight);
|
|
100
|
+
font-size: var(--global-typography-ui-label-font-size);
|
|
101
|
+
line-height: var(--global-typography-ui-label-line-height);
|
|
102
|
+
font-feature-settings:
|
|
103
|
+
"liga" off,
|
|
104
|
+
"clig" off,
|
|
105
|
+
"ss04" on;
|
|
106
|
+
color: var(--element-inactive-color);
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
export {
|
|
111
|
+
componentStyle as default
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=alert-subsystem-counter.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-subsystem-counter.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* `ObcAlertSubsystemCounterOrientation` – Layout direction for the counter.
|
|
4
|
+
*
|
|
5
|
+
* - `horizontal`: Icon, label, and badges sit in a single row.
|
|
6
|
+
* - `vertical`: Badges (or empty text) sit on their own line below the label.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ObcAlertSubsystemCounterOrientation {
|
|
9
|
+
Horizontal = "horizontal",
|
|
10
|
+
Vertical = "vertical"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* `<obc-alert-subsystem-counter>` – A framed summary of a subsystem's alert
|
|
14
|
+
* counts: a leading icon, a label, and a trailing set of slotted count badges.
|
|
15
|
+
*
|
|
16
|
+
* When there are no active alerts it shows a muted label and an empty-state
|
|
17
|
+
* message instead of the badges. The count badges themselves are supplied by
|
|
18
|
+
* the consumer as slotted `obc-badge` elements; this component provides only
|
|
19
|
+
* the frame, layout, label, and empty state.
|
|
20
|
+
*
|
|
21
|
+
* ---
|
|
22
|
+
*
|
|
23
|
+
* ### Features
|
|
24
|
+
* - **Orientation:** `horizontal` (single row) or `vertical` (badges on a line
|
|
25
|
+
* below the label).
|
|
26
|
+
* - **Alert state:** `hasAlert` toggles between an active (bold label, badges)
|
|
27
|
+
* and an inactive (muted label, empty text) presentation.
|
|
28
|
+
* - **Freeform label:** Pass a full title or an abbreviation — the label is
|
|
29
|
+
* plain text decided by the caller and truncates with an ellipsis.
|
|
30
|
+
* - **Configurable empty text:** Customize the message shown when there are no
|
|
31
|
+
* alerts via `emptyText`.
|
|
32
|
+
* - **Optional leading icon:** Provide an icon through the `icon` slot; omit it
|
|
33
|
+
* and the leading box collapses with no empty gap.
|
|
34
|
+
*
|
|
35
|
+
* ---
|
|
36
|
+
*
|
|
37
|
+
* ### Usage Guidelines
|
|
38
|
+
* - Use this component to give an at-a-glance count of outstanding alerts for a
|
|
39
|
+
* single subsystem, grouped by severity.
|
|
40
|
+
* - Provide one slotted badge per severity in the `badges` slot, typically
|
|
41
|
+
* `<obc-badge size="large">` with a severity `type` and a `number`. The
|
|
42
|
+
* badge `type` values are the same severity vocabulary as `AlertType`
|
|
43
|
+
* (`alarm`, `warning`, `caution` and the `level-*` family); order them
|
|
44
|
+
* highest severity first, as `ALERT_SEVERITY_PRIORITY` does.
|
|
45
|
+
* - Set `hasAlert` to `false` to present the resolved/clear state; the badges
|
|
46
|
+
* are then not rendered and `emptyText` is shown. The component does not
|
|
47
|
+
* derive the state from the slotted badges — the consumer owns it.
|
|
48
|
+
* - Choose `vertical` orientation in narrow containers where the badges do not
|
|
49
|
+
* fit beside the label.
|
|
50
|
+
* - The counter is display-only: it renders no button and fires no events. For
|
|
51
|
+
* a clickable subsystem entry with badges, see `obc-tree-navigation-item`
|
|
52
|
+
* (`alertBadges`) or `obc-integration-fleet-button` (`alerts`).
|
|
53
|
+
*
|
|
54
|
+
* ---
|
|
55
|
+
*
|
|
56
|
+
* ### Slots
|
|
57
|
+
*
|
|
58
|
+
* | Slot Name | Renders When... | Purpose |
|
|
59
|
+
* |-----------|------------------------|----------------------------------------------------|
|
|
60
|
+
* | `icon` | The slot has content | Leading 24px icon (e.g. `<obi-placeholder>`). |
|
|
61
|
+
* | `badges` | `hasAlert` is true | Count badges, one per severity (`<obc-badge>`). |
|
|
62
|
+
*
|
|
63
|
+
* ---
|
|
64
|
+
*
|
|
65
|
+
* ### Example
|
|
66
|
+
*
|
|
67
|
+
* ```html
|
|
68
|
+
* <obc-alert-subsystem-counter label="Label" hasAlert>
|
|
69
|
+
* <obi-placeholder slot="icon"></obi-placeholder>
|
|
70
|
+
* <obc-badge slot="badges" size="large" type="alarm" .number=${9}></obc-badge>
|
|
71
|
+
* <obc-badge slot="badges" size="large" type="warning" .number=${4}></obc-badge>
|
|
72
|
+
* <obc-badge slot="badges" size="large" type="caution" .number=${2}></obc-badge>
|
|
73
|
+
* </obc-alert-subsystem-counter>
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @property label - The subsystem label. Pass a full title or an abbreviation as plain text.
|
|
77
|
+
* @property orientation - Layout direction: `horizontal` (default) keeps icon, label and badges in one row; `vertical` moves the badges (or empty text) to a line below the label.
|
|
78
|
+
* @property hasAlert - Whether the subsystem has active alerts. `true` shows the label bold and renders the `badges` slot; `false` mutes the label and shows `emptyText` instead of the badges.
|
|
79
|
+
* @property emptyText - Text shown in the trailing area when `hasAlert` is `false`.
|
|
80
|
+
* @availableWhen emptyText hasAlert==false
|
|
81
|
+
* @slot icon - Optional leading 24px icon.
|
|
82
|
+
* @slot badges - Count badges shown when `hasAlert` is true.
|
|
83
|
+
* @beta
|
|
84
|
+
*/
|
|
85
|
+
export declare class ObcAlertSubsystemCounter extends LitElement {
|
|
86
|
+
/** The subsystem label. Pass a full title or an abbreviation as plain text. */
|
|
87
|
+
label: string;
|
|
88
|
+
/** Layout direction: `horizontal` (default) keeps icon, label and badges in one row; `vertical` moves the badges (or empty text) to a line below the label. */
|
|
89
|
+
orientation: ObcAlertSubsystemCounterOrientation;
|
|
90
|
+
/** Whether the subsystem has active alerts. `true` shows the label bold and renders the `badges` slot; `false` mutes the label and shows `emptyText` instead of the badges. */
|
|
91
|
+
hasAlert: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Text shown in the trailing area when `hasAlert` is `false`.
|
|
94
|
+
*
|
|
95
|
+
* Available when `hasAlert==false`.
|
|
96
|
+
*/
|
|
97
|
+
emptyText: string;
|
|
98
|
+
private hasIcon;
|
|
99
|
+
private handleIconSlotChange;
|
|
100
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
101
|
+
static styles: import('lit').CSSResult;
|
|
102
|
+
}
|
|
103
|
+
declare global {
|
|
104
|
+
interface HTMLElementTagNameMap {
|
|
105
|
+
'obc-alert-subsystem-counter': ObcAlertSubsystemCounter;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=alert-subsystem-counter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-subsystem-counter.d.ts","sourceRoot":"","sources":["../../../src/components/alert-subsystem-counter/alert-subsystem-counter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAMhD;;;;;GAKG;AACH,oBAAY,mCAAmC;IAC7C,UAAU,eAAe;IACzB,QAAQ,aAAa;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,qBACa,wBAAyB,SAAQ,UAAU;IAC5B,KAAK,SAAM;IACX,WAAW,EAAE,mCAAmC,CACzB;IACtB,QAAQ,UAAS;IAClB,SAAS,SAAe;IAEzC,OAAO,CAAC,OAAO,CAAS;IAEjC,OAAO,CAAC,oBAAoB;IAKnB,MAAM;IAwBf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,6BAA6B,EAAE,wBAAwB,CAAC;KACzD;CACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { unsafeCSS, LitElement, html } from "lit";
|
|
2
|
+
import { property, state } from "lit/decorators.js";
|
|
3
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
4
|
+
import componentStyle from "./alert-subsystem-counter.css.js";
|
|
5
|
+
import { customElement } from "../../decorator.js";
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
13
|
+
if (kind && result) __defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
var ObcAlertSubsystemCounterOrientation = /* @__PURE__ */ ((ObcAlertSubsystemCounterOrientation2) => {
|
|
17
|
+
ObcAlertSubsystemCounterOrientation2["Horizontal"] = "horizontal";
|
|
18
|
+
ObcAlertSubsystemCounterOrientation2["Vertical"] = "vertical";
|
|
19
|
+
return ObcAlertSubsystemCounterOrientation2;
|
|
20
|
+
})(ObcAlertSubsystemCounterOrientation || {});
|
|
21
|
+
let ObcAlertSubsystemCounter = class extends LitElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.label = "";
|
|
25
|
+
this.orientation = "horizontal";
|
|
26
|
+
this.hasAlert = false;
|
|
27
|
+
this.emptyText = "No alerts";
|
|
28
|
+
this.hasIcon = false;
|
|
29
|
+
}
|
|
30
|
+
handleIconSlotChange(e) {
|
|
31
|
+
const slot = e.target;
|
|
32
|
+
this.hasIcon = slot.assignedNodes({ flatten: true }).length > 0;
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return html`
|
|
36
|
+
<div
|
|
37
|
+
class=${classMap({
|
|
38
|
+
frame: true,
|
|
39
|
+
["orientation-" + this.orientation]: true,
|
|
40
|
+
"has-alert": this.hasAlert
|
|
41
|
+
})}
|
|
42
|
+
>
|
|
43
|
+
<div class="leading-container">
|
|
44
|
+
<div class=${classMap({ icon: true, "no-icon": !this.hasIcon })}>
|
|
45
|
+
<slot name="icon" @slotchange=${this.handleIconSlotChange}></slot>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="label">${this.label}</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="trailing-container">
|
|
50
|
+
${this.hasAlert ? html`<slot name="badges" class="badges"></slot>` : html`<span class="empty">${this.emptyText}</span>`}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
ObcAlertSubsystemCounter.styles = unsafeCSS(componentStyle);
|
|
57
|
+
__decorateClass([
|
|
58
|
+
property({ type: String })
|
|
59
|
+
], ObcAlertSubsystemCounter.prototype, "label", 2);
|
|
60
|
+
__decorateClass([
|
|
61
|
+
property({ type: String })
|
|
62
|
+
], ObcAlertSubsystemCounter.prototype, "orientation", 2);
|
|
63
|
+
__decorateClass([
|
|
64
|
+
property({ type: Boolean })
|
|
65
|
+
], ObcAlertSubsystemCounter.prototype, "hasAlert", 2);
|
|
66
|
+
__decorateClass([
|
|
67
|
+
property({ type: String })
|
|
68
|
+
], ObcAlertSubsystemCounter.prototype, "emptyText", 2);
|
|
69
|
+
__decorateClass([
|
|
70
|
+
state()
|
|
71
|
+
], ObcAlertSubsystemCounter.prototype, "hasIcon", 2);
|
|
72
|
+
ObcAlertSubsystemCounter = __decorateClass([
|
|
73
|
+
customElement("obc-alert-subsystem-counter")
|
|
74
|
+
], ObcAlertSubsystemCounter);
|
|
75
|
+
export {
|
|
76
|
+
ObcAlertSubsystemCounter,
|
|
77
|
+
ObcAlertSubsystemCounterOrientation
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=alert-subsystem-counter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-subsystem-counter.js","sources":["../../../src/components/alert-subsystem-counter/alert-subsystem-counter.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './alert-subsystem-counter.css?inline';\nimport {customElement} from '../../decorator.js';\n\n/**\n * `ObcAlertSubsystemCounterOrientation` – Layout direction for the counter.\n *\n * - `horizontal`: Icon, label, and badges sit in a single row.\n * - `vertical`: Badges (or empty text) sit on their own line below the label.\n */\nexport enum ObcAlertSubsystemCounterOrientation {\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n}\n\n/**\n * `<obc-alert-subsystem-counter>` – A framed summary of a subsystem's alert\n * counts: a leading icon, a label, and a trailing set of slotted count badges.\n *\n * When there are no active alerts it shows a muted label and an empty-state\n * message instead of the badges. The count badges themselves are supplied by\n * the consumer as slotted `obc-badge` elements; this component provides only\n * the frame, layout, label, and empty state.\n *\n * ---\n *\n * ### Features\n * - **Orientation:** `horizontal` (single row) or `vertical` (badges on a line\n * below the label).\n * - **Alert state:** `hasAlert` toggles between an active (bold label, badges)\n * and an inactive (muted label, empty text) presentation.\n * - **Freeform label:** Pass a full title or an abbreviation — the label is\n * plain text decided by the caller and truncates with an ellipsis.\n * - **Configurable empty text:** Customize the message shown when there are no\n * alerts via `emptyText`.\n * - **Optional leading icon:** Provide an icon through the `icon` slot; omit it\n * and the leading box collapses with no empty gap.\n *\n * ---\n *\n * ### Usage Guidelines\n * - Use this component to give an at-a-glance count of outstanding alerts for a\n * single subsystem, grouped by severity.\n * - Provide one slotted badge per severity in the `badges` slot, typically\n * `<obc-badge size=\"large\">` with a severity `type` and a `number`. The\n * badge `type` values are the same severity vocabulary as `AlertType`\n * (`alarm`, `warning`, `caution` and the `level-*` family); order them\n * highest severity first, as `ALERT_SEVERITY_PRIORITY` does.\n * - Set `hasAlert` to `false` to present the resolved/clear state; the badges\n * are then not rendered and `emptyText` is shown. The component does not\n * derive the state from the slotted badges — the consumer owns it.\n * - Choose `vertical` orientation in narrow containers where the badges do not\n * fit beside the label.\n * - The counter is display-only: it renders no button and fires no events. For\n * a clickable subsystem entry with badges, see `obc-tree-navigation-item`\n * (`alertBadges`) or `obc-integration-fleet-button` (`alerts`).\n *\n * ---\n *\n * ### Slots\n *\n * | Slot Name | Renders When... | Purpose |\n * |-----------|------------------------|----------------------------------------------------|\n * | `icon` | The slot has content | Leading 24px icon (e.g. `<obi-placeholder>`). |\n * | `badges` | `hasAlert` is true | Count badges, one per severity (`<obc-badge>`). |\n *\n * ---\n *\n * ### Example\n *\n * ```html\n * <obc-alert-subsystem-counter label=\"Label\" hasAlert>\n * <obi-placeholder slot=\"icon\"></obi-placeholder>\n * <obc-badge slot=\"badges\" size=\"large\" type=\"alarm\" .number=${9}></obc-badge>\n * <obc-badge slot=\"badges\" size=\"large\" type=\"warning\" .number=${4}></obc-badge>\n * <obc-badge slot=\"badges\" size=\"large\" type=\"caution\" .number=${2}></obc-badge>\n * </obc-alert-subsystem-counter>\n * ```\n *\n * @property label - The subsystem label. Pass a full title or an abbreviation as plain text.\n * @property orientation - Layout direction: `horizontal` (default) keeps icon, label and badges in one row; `vertical` moves the badges (or empty text) to a line below the label.\n * @property hasAlert - Whether the subsystem has active alerts. `true` shows the label bold and renders the `badges` slot; `false` mutes the label and shows `emptyText` instead of the badges.\n * @property emptyText - Text shown in the trailing area when `hasAlert` is `false`.\n * @availableWhen emptyText hasAlert==false\n * @slot icon - Optional leading 24px icon.\n * @slot badges - Count badges shown when `hasAlert` is true.\n * @beta\n */\n@customElement('obc-alert-subsystem-counter')\nexport class ObcAlertSubsystemCounter extends LitElement {\n @property({type: String}) label = '';\n @property({type: String}) orientation: ObcAlertSubsystemCounterOrientation =\n ObcAlertSubsystemCounterOrientation.Horizontal;\n @property({type: Boolean}) hasAlert = false;\n @property({type: String}) emptyText = 'No alerts';\n\n @state() private hasIcon = false;\n\n private handleIconSlotChange(e: Event) {\n const slot = e.target as HTMLSlotElement;\n this.hasIcon = slot.assignedNodes({flatten: true}).length > 0;\n }\n\n override render() {\n return html`\n <div\n class=${classMap({\n frame: true,\n ['orientation-' + this.orientation]: true,\n 'has-alert': this.hasAlert,\n })}\n >\n <div class=\"leading-container\">\n <div class=${classMap({icon: true, 'no-icon': !this.hasIcon})}>\n <slot name=\"icon\" @slotchange=${this.handleIconSlotChange}></slot>\n </div>\n <div class=\"label\">${this.label}</div>\n </div>\n <div class=\"trailing-container\">\n ${this.hasAlert\n ? html`<slot name=\"badges\" class=\"badges\"></slot>`\n : html`<span class=\"empty\">${this.emptyText}</span>`}\n </div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-alert-subsystem-counter': ObcAlertSubsystemCounter;\n }\n}\n"],"names":["ObcAlertSubsystemCounterOrientation"],"mappings":";;;;;;;;;;;;;;;AAYO,IAAK,wDAAAA,yCAAL;AACLA,uCAAA,YAAA,IAAa;AACbA,uCAAA,UAAA,IAAW;AAFD,SAAAA;AAAA,GAAA,uCAAA,CAAA,CAAA;AA+EL,IAAM,2BAAN,cAAuC,WAAW;AAAA,EAAlD,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,QAAQ;AACR,SAAA,cACxB;AACyB,SAAA,WAAW;AACZ,SAAA,YAAY;AAE7B,SAAQ,UAAU;AAAA,EAAA;AAAA,EAEnB,qBAAqB,GAAU;AACrC,UAAM,OAAO,EAAE;AACf,SAAK,UAAU,KAAK,cAAc,EAAC,SAAS,KAAA,CAAK,EAAE,SAAS;AAAA,EAC9D;AAAA,EAES,SAAS;AAChB,WAAO;AAAA;AAAA,gBAEK,SAAS;AAAA,MACf,OAAO;AAAA,MACP,CAAC,iBAAiB,KAAK,WAAW,GAAG;AAAA,MACrC,aAAa,KAAK;AAAA,IAAA,CACnB,CAAC;AAAA;AAAA;AAAA,uBAGa,SAAS,EAAC,MAAM,MAAM,WAAW,CAAC,KAAK,QAAA,CAAQ,CAAC;AAAA,4CAC3B,KAAK,oBAAoB;AAAA;AAAA,+BAEtC,KAAK,KAAK;AAAA;AAAA;AAAA,YAG7B,KAAK,WACH,mDACA,2BAA2B,KAAK,SAAS,SAAS;AAAA;AAAA;AAAA;AAAA,EAI9D;AAGF;AAvCa,yBAsCK,SAAS,UAAU,cAAc;AArCvB,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GADb,yBACe,WAAA,SAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAFb,yBAEe,WAAA,eAAA,CAAA;AAEC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAJd,yBAIgB,WAAA,YAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GALb,yBAKe,WAAA,aAAA,CAAA;AAET,gBAAA;AAAA,EAAhB,MAAA;AAAM,GAPI,yBAOM,WAAA,WAAA,CAAA;AAPN,2BAAN,gBAAA;AAAA,EADN,cAAc,6BAA6B;AAAA,GAC/B,wBAAA;"}
|