@oicl/openbridge-webcomponents 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- package/.storybook/main.ts +2 -0
- package/.storybook/preview.ts +11 -0
- package/.vscode/launch.json +16 -0
- package/README.md +8 -0
- package/__snapshots__/alert-icon--primary.png +0 -0
- package/__snapshots__/application-alert-button--notification.png +0 -0
- package/__snapshots__/application-alert-button--running.png +0 -0
- package/__snapshots__/application-notification-message--large-single-message.png +0 -0
- package/__snapshots__/application-notification-message--large.png +0 -0
- package/__snapshots__/application-notification-message--primary.png +0 -0
- package/__snapshots__/button-rich-button--bottom-with-boarder.png +0 -0
- package/__snapshots__/button-rich-button--bottom.png +0 -0
- package/__snapshots__/button-rich-button--center.png +0 -0
- package/__snapshots__/button-rich-button--double-line.png +0 -0
- package/__snapshots__/button-rich-button--multi-line.png +0 -0
- package/__snapshots__/button-rich-button--regular-no-icons.png +0 -0
- package/__snapshots__/button-rich-button--regular.png +0 -0
- package/__snapshots__/button-rich-button--single-line.png +0 -0
- package/__snapshots__/button-rich-button--top-with-boarder.png +0 -0
- package/__snapshots__/button-rich-button--top.png +0 -0
- package/__snapshots__/button-rich-button--with-graphic-border.png +0 -0
- package/__snapshots__/button-rich-button--with-graphic.png +0 -0
- package/__snapshots__/button-rich-button--with-status.png +0 -0
- package/__snapshots__/button-vendor-button--primary.png +0 -0
- package/__snapshots__/icons-icon--list.png +0 -0
- package/__snapshots__/icons-icon--use-font-color.png +0 -0
- package/custom-elements.json +2331 -745
- package/dist/components/alert-button/alert-button.css.js +4 -12
- package/dist/components/alert-button/alert-button.css.js.map +1 -1
- package/dist/components/alert-button/alert-button.d.ts +11 -1
- package/dist/components/alert-button/alert-button.d.ts.map +1 -1
- package/dist/components/alert-button/alert-button.js +21 -1
- package/dist/components/alert-button/alert-button.js.map +1 -1
- package/dist/components/alert-icon/alert-icon.d.ts +36 -0
- package/dist/components/alert-icon/alert-icon.d.ts.map +1 -0
- package/dist/components/alert-icon/alert-icon.js +84 -0
- package/dist/components/alert-icon/alert-icon.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-silenced-a.d.ts +2 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-silenced-a.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-silenced-a.js +13 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-silenced-a.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-silenced-b.d.ts +2 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-silenced-b.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-silenced-b.js +20 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-silenced-b.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-unack-a.d.ts +2 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-unack-a.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-unack-a.js +12 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-unack-a.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-unack-b.d.ts +2 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-unack-b.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-unack-b.js +19 -0
- package/dist/components/alert-icon/icons/icon-14-alarm-unack-b.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-warning-unack-a.d.ts +2 -0
- package/dist/components/alert-icon/icons/icon-14-warning-unack-a.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-warning-unack-a.js +12 -0
- package/dist/components/alert-icon/icons/icon-14-warning-unack-a.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-warning-unack-b.d.ts +2 -0
- package/dist/components/alert-icon/icons/icon-14-warning-unack-b.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-14-warning-unack-b.js +12 -0
- package/dist/components/alert-icon/icons/icon-14-warning-unack-b.js.map +1 -0
- package/dist/components/alert-topbar-element/alert-topbar-element.d.ts +13 -0
- package/dist/components/alert-topbar-element/alert-topbar-element.d.ts.map +1 -1
- package/dist/components/alert-topbar-element/alert-topbar-element.js +10 -0
- package/dist/components/alert-topbar-element/alert-topbar-element.js.map +1 -1
- package/dist/components/rich-button/rich-button.css.js +182 -0
- package/dist/components/rich-button/rich-button.css.js.map +1 -0
- package/dist/components/rich-button/rich-button.d.ts +32 -0
- package/dist/components/rich-button/rich-button.d.ts.map +1 -0
- package/dist/components/rich-button/rich-button.js +113 -0
- package/dist/components/rich-button/rich-button.js.map +1 -0
- package/dist/components/vendor-button/vendor-button.css.js +48 -0
- package/dist/components/vendor-button/vendor-button.css.js.map +1 -0
- package/dist/components/vendor-button/vendor-button.d.ts +13 -0
- package/dist/components/vendor-button/vendor-button.d.ts.map +1 -0
- package/dist/components/vendor-button/vendor-button.js +42 -0
- package/dist/components/vendor-button/vendor-button.js.map +1 -0
- package/dist/icons/{icon-07-target-radar.d.ts → icon-01-content-copy.d.ts} +3 -3
- package/dist/icons/{icon-07-target-radar.d.ts.map → icon-01-content-copy.d.ts.map} +1 -1
- package/dist/icons/{icon-07-target-radar.js → icon-01-content-copy.js} +10 -10
- package/dist/icons/icon-01-content-copy.js.map +1 -0
- package/dist/icons/{icon-07-target-ias-selected.d.ts → icon-01-content-cut.d.ts} +3 -3
- package/dist/icons/icon-01-content-cut.d.ts.map +1 -0
- package/dist/icons/icon-01-content-cut.js +52 -0
- package/dist/icons/icon-01-content-cut.js.map +1 -0
- package/dist/icons/{icon-07-target-radar-selected.d.ts → icon-01-content-paste.d.ts} +3 -3
- package/dist/icons/icon-01-content-paste.d.ts.map +1 -0
- package/dist/icons/icon-01-content-paste.js +52 -0
- package/dist/icons/icon-01-content-paste.js.map +1 -0
- package/dist/icons/icon-02-dock-bottom.d.ts +14 -0
- package/dist/icons/icon-02-dock-bottom.d.ts.map +1 -0
- package/dist/icons/icon-02-dock-bottom.js +52 -0
- package/dist/icons/icon-02-dock-bottom.js.map +1 -0
- package/dist/icons/{icon-07-target-ias.d.ts → icon-02-dock-left.d.ts} +3 -3
- package/dist/icons/icon-02-dock-left.d.ts.map +1 -0
- package/dist/icons/{icon-07-target-ias.js → icon-02-dock-left.js} +10 -24
- package/dist/icons/icon-02-dock-left.js.map +1 -0
- package/dist/icons/icon-02-dock-right.d.ts +14 -0
- package/dist/icons/icon-02-dock-right.d.ts.map +1 -0
- package/dist/icons/icon-02-dock-right.js +52 -0
- package/dist/icons/icon-02-dock-right.js.map +1 -0
- package/dist/icons/icon-03-license.d.ts +14 -0
- package/dist/icons/icon-03-license.d.ts.map +1 -0
- package/dist/icons/icon-03-license.js +52 -0
- package/dist/icons/icon-03-license.js.map +1 -0
- package/dist/icons/icon-03-star-unchecked.js +1 -1
- package/dist/icons/icon-03-star-unchecked.js.map +1 -1
- package/dist/icons/icon-04-colorcalibrated.d.ts.map +1 -1
- package/dist/icons/icon-04-colorcalibrated.js +2 -14
- package/dist/icons/icon-04-colorcalibrated.js.map +1 -1
- package/dist/icons/icon-07-target-associated-ais-camera.d.ts +14 -0
- package/dist/icons/icon-07-target-associated-ais-camera.d.ts.map +1 -0
- package/dist/icons/icon-07-target-associated-ais-camera.js +54 -0
- package/dist/icons/icon-07-target-associated-ais-camera.js.map +1 -0
- package/dist/icons/icon-07-target-associated-camera-radar.d.ts +14 -0
- package/dist/icons/icon-07-target-associated-camera-radar.d.ts.map +1 -0
- package/dist/icons/icon-07-target-associated-camera-radar.js +52 -0
- package/dist/icons/icon-07-target-associated-camera-radar.js.map +1 -0
- package/dist/icons/icon-07-target-associated-radar-camera.d.ts +14 -0
- package/dist/icons/icon-07-target-associated-radar-camera.d.ts.map +1 -0
- package/dist/icons/icon-07-target-associated-radar-camera.js +54 -0
- package/dist/icons/icon-07-target-associated-radar-camera.js.map +1 -0
- package/dist/icons/icon-07-target-camera.d.ts +14 -0
- package/dist/icons/icon-07-target-camera.d.ts.map +1 -0
- package/dist/icons/icon-07-target-camera.js +52 -0
- package/dist/icons/icon-07-target-camera.js.map +1 -0
- package/dist/icons/icon-08-backward-fast.js +1 -1
- package/dist/icons/icon-08-backward-fast.js.map +1 -1
- package/dist/icons/icon-08-backward-stopped.js +1 -1
- package/dist/icons/icon-08-backward-stopped.js.map +1 -1
- package/dist/icons/icon-08-forward-fast.js +1 -1
- package/dist/icons/icon-08-forward-fast.js.map +1 -1
- package/dist/icons/icon-08-forward-stopped.js +1 -1
- package/dist/icons/icon-08-forward-stopped.js.map +1 -1
- package/dist/icons/icon-08-motor-off-horisontal.js +1 -1
- package/dist/icons/icon-08-motor-off-horisontal.js.map +1 -1
- package/dist/icons/icon-09-switch-horizontal-off-large.js +1 -1
- package/dist/icons/icon-09-switch-horizontal-off-large.js.map +1 -1
- package/dist/icons/icon-09-switch-horizontal-off.js +1 -1
- package/dist/icons/icon-09-switch-horizontal-off.js.map +1 -1
- package/dist/icons/icon-10-autonomous.js +3 -3
- package/dist/icons/icon-10-autonomous.js.map +1 -1
- package/dist/icons/icon-14-alert-rectified.js +1 -1
- package/dist/icons/icon-14-alert-rectified.js.map +1 -1
- package/dist/icons/icon-14-alertheader-aggregated-large.d.ts +14 -0
- package/dist/icons/icon-14-alertheader-aggregated-large.d.ts.map +1 -0
- package/dist/icons/icon-14-alertheader-aggregated-large.js +52 -0
- package/dist/icons/icon-14-alertheader-aggregated-large.js.map +1 -0
- package/dist/icons/icon-14-alertheader-group-large.d.ts +14 -0
- package/dist/icons/icon-14-alertheader-group-large.d.ts.map +1 -0
- package/dist/icons/icon-14-alertheader-group-large.js +54 -0
- package/dist/icons/icon-14-alertheader-group-large.js.map +1 -0
- package/dist/icons/icon-14-exclamationmark.js +4 -4
- package/dist/icons/icon-14-exclamationmark.js.map +1 -1
- package/dist/icons/icon-14-rectified.js +1 -1
- package/dist/icons/icon-14-rectified.js.map +1 -1
- package/dist/icons/icon-18-ais-anchored.js +4 -4
- package/dist/icons/icon-18-ais-anchored.js.map +1 -1
- package/dist/icons/icon-18-ais-notunderway.js +1 -1
- package/dist/icons/icon-18-ais-notunderway.js.map +1 -1
- package/dist/icons/icon-iec-02-ais-target-activated-selected.d.ts +14 -0
- package/dist/icons/icon-iec-02-ais-target-activated-selected.d.ts.map +1 -0
- package/dist/icons/icon-iec-02-ais-target-activated-selected.js +52 -0
- package/dist/icons/icon-iec-02-ais-target-activated-selected.js.map +1 -0
- package/dist/icons/icon-iec-02-ais-target-activated.d.ts +14 -0
- package/dist/icons/icon-iec-02-ais-target-activated.d.ts.map +1 -0
- package/dist/icons/icon-iec-02-ais-target-activated.js +52 -0
- package/dist/icons/icon-iec-02-ais-target-activated.js.map +1 -0
- package/dist/icons/icon-iec-02-associated-target-ais.d.ts +14 -0
- package/dist/icons/icon-iec-02-associated-target-ais.d.ts.map +1 -0
- package/dist/icons/icon-iec-02-associated-target-ais.js +52 -0
- package/dist/icons/icon-iec-02-associated-target-ais.js.map +1 -0
- package/dist/icons/icon-iec-02-associated-target-radar.d.ts +14 -0
- package/dist/icons/icon-iec-02-associated-target-radar.d.ts.map +1 -0
- package/dist/icons/icon-iec-02-associated-target-radar.js +52 -0
- package/dist/icons/icon-iec-02-associated-target-radar.js.map +1 -0
- package/dist/icons/icon-iec-02-radar-target-tracked-selected.d.ts +14 -0
- package/dist/icons/icon-iec-02-radar-target-tracked-selected.d.ts.map +1 -0
- package/dist/icons/icon-iec-02-radar-target-tracked-selected.js +60 -0
- package/dist/icons/icon-iec-02-radar-target-tracked-selected.js.map +1 -0
- package/dist/icons/icon-iec-02-radar-target-tracked.d.ts +14 -0
- package/dist/icons/icon-iec-02-radar-target-tracked.d.ts.map +1 -0
- package/dist/icons/icon-iec-02-radar-target-tracked.js +52 -0
- package/dist/icons/icon-iec-02-radar-target-tracked.js.map +1 -0
- package/dist/icons/index.d.ts +19 -4
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/index.js +19 -4
- package/dist/icons/index.js.map +1 -1
- package/dist/icons/names.d.ts.map +1 -1
- package/dist/icons/names.js +19 -4
- package/dist/icons/names.js.map +1 -1
- package/dist/navigation-instruments/thruster/thruster.d.ts +2 -1
- package/dist/navigation-instruments/thruster/thruster.d.ts.map +1 -1
- package/dist/navigation-instruments/thruster/thruster.js +45 -25
- package/dist/navigation-instruments/thruster/thruster.js.map +1 -1
- package/fix-generated.cjs +3 -0
- package/new-component.ts +7 -8
- package/package.json +5 -1
- package/script/convert-icons.ts +177 -0
- package/script/download-alert-icons.ts +180 -0
- package/script/download-icons.ts +7 -141
- package/src/components/alert-button/alert-button.css +1 -12
- package/src/components/alert-button/alert-button.stories.ts +2 -0
- package/src/components/alert-button/alert-button.ts +29 -4
- package/src/components/alert-icon/alert-icon.stories.ts +35 -0
- package/src/components/alert-icon/alert-icon.ts +75 -0
- package/src/components/alert-icon/icons/icon-14-alarm-silenced-a.ts +9 -0
- package/src/components/alert-icon/icons/icon-14-alarm-silenced-b.ts +16 -0
- package/src/components/alert-icon/icons/icon-14-alarm-unack-a.ts +8 -0
- package/src/components/alert-icon/icons/icon-14-alarm-unack-b.ts +15 -0
- package/src/components/alert-icon/icons/icon-14-warning-unack-a.ts +8 -0
- package/src/components/alert-icon/icons/icon-14-warning-unack-b.ts +8 -0
- package/src/components/alert-topbar-element/alert-topbar-element.stories.ts +4 -0
- package/src/components/alert-topbar-element/alert-topbar-element.ts +17 -0
- package/src/components/notification-message/notification-message.stories.ts +26 -10
- package/src/components/rich-button/rich-button.css +118 -0
- package/src/components/rich-button/rich-button.stories.ts +196 -0
- package/src/components/rich-button/rich-button.ts +95 -0
- package/src/components/vendor-button/vendor-button.css +10 -0
- package/src/components/vendor-button/vendor-button.stories.ts +19 -0
- package/src/components/vendor-button/vendor-button.ts +25 -0
- package/src/icons/icon-01-content-copy.ts +40 -0
- package/src/icons/icon-01-content-cut.ts +40 -0
- package/src/icons/icon-01-content-paste.ts +40 -0
- package/src/icons/icon-02-dock-bottom.ts +40 -0
- package/src/icons/icon-02-dock-left.ts +40 -0
- package/src/icons/icon-02-dock-right.ts +40 -0
- package/src/icons/icon-03-license.ts +40 -0
- package/src/icons/icon-03-star-unchecked.ts +1 -1
- package/src/icons/icon-04-colorcalibrated.ts +2 -14
- package/src/icons/icon-07-target-associated-ais-camera.ts +42 -0
- package/src/icons/icon-07-target-associated-camera-radar.ts +40 -0
- package/src/icons/icon-07-target-associated-radar-camera.ts +42 -0
- package/src/icons/icon-07-target-camera.ts +40 -0
- package/src/icons/icon-08-backward-fast.ts +1 -1
- package/src/icons/icon-08-backward-stopped.ts +1 -1
- package/src/icons/icon-08-forward-fast.ts +1 -1
- package/src/icons/icon-08-forward-stopped.ts +1 -1
- package/src/icons/icon-08-motor-off-horisontal.ts +1 -1
- package/src/icons/icon-09-switch-horizontal-off-large.ts +1 -1
- package/src/icons/icon-09-switch-horizontal-off.ts +1 -1
- package/src/icons/icon-10-autonomous.ts +3 -3
- package/src/icons/icon-14-alert-rectified.ts +1 -1
- package/src/icons/icon-14-alertheader-aggregated-large.ts +40 -0
- package/src/icons/icon-14-alertheader-group-large.ts +42 -0
- package/src/icons/icon-14-exclamationmark.ts +4 -4
- package/src/icons/icon-14-rectified.ts +1 -1
- package/src/icons/icon-18-ais-anchored.ts +4 -4
- package/src/icons/icon-18-ais-notunderway.ts +1 -1
- package/src/icons/icon-iec-02-ais-target-activated-selected.ts +40 -0
- package/src/icons/icon-iec-02-ais-target-activated.ts +40 -0
- package/src/icons/icon-iec-02-associated-target-ais.ts +40 -0
- package/src/icons/icon-iec-02-associated-target-radar.ts +40 -0
- package/src/icons/icon-iec-02-radar-target-tracked-selected.ts +48 -0
- package/src/icons/icon-iec-02-radar-target-tracked.ts +40 -0
- package/src/icons/index.ts +19 -4
- package/src/icons/names.ts +19 -4
- package/src/icons.stories.ts +78 -0
- package/src/navigation-instruments/thruster/thruster.stories.ts +18 -1
- package/src/navigation-instruments/thruster/thruster.ts +43 -27
- package/dist/icons/icon-07-target-ias-selected.d.ts.map +0 -1
- package/dist/icons/icon-07-target-ias-selected.js +0 -60
- package/dist/icons/icon-07-target-ias-selected.js.map +0 -1
- package/dist/icons/icon-07-target-ias.d.ts.map +0 -1
- package/dist/icons/icon-07-target-ias.js.map +0 -1
- package/dist/icons/icon-07-target-radar-selected.d.ts.map +0 -1
- package/dist/icons/icon-07-target-radar-selected.js +0 -60
- package/dist/icons/icon-07-target-radar-selected.js.map +0 -1
- package/dist/icons/icon-07-target-radar.js.map +0 -1
- package/src/icons/icon-07-target-ias-selected.ts +0 -48
- package/src/icons/icon-07-target-ias.ts +0 -54
- package/src/icons/icon-07-target-radar-selected.ts +0 -48
- package/src/icons/icon-07-target-radar.ts +0 -40
package/script/download-icons.ts
CHANGED
@@ -2,6 +2,12 @@ import * as Figma from 'figma-api';
|
|
2
2
|
import * as dotenv from 'dotenv';
|
3
3
|
import * as fs from 'fs';
|
4
4
|
import {GetFileResult} from 'figma-api/lib/api-types';
|
5
|
+
import {
|
6
|
+
getCssColorIcon,
|
7
|
+
getSingleColorIcon,
|
8
|
+
getStylesForNode,
|
9
|
+
kebabToUpperCamelCase,
|
10
|
+
} from './convert-icons';
|
5
11
|
|
6
12
|
dotenv.config();
|
7
13
|
|
@@ -141,7 +147,7 @@ export class Obi${upperCammelCaseName} extends LitElement {
|
|
141
147
|
\`;
|
142
148
|
}
|
143
149
|
|
144
|
-
static override styles =
|
150
|
+
static override styles = css\`
|
145
151
|
.wrapper {
|
146
152
|
height: 100%;
|
147
153
|
width: 100%;
|
@@ -175,144 +181,4 @@ declare global {
|
|
175
181
|
console.log('done');
|
176
182
|
}
|
177
183
|
|
178
|
-
function getSingleColorIcon(imageData: string, icon: IconRef): string {
|
179
|
-
// replace fill color with currentColor
|
180
|
-
const fillRegex = /fill="[^"]+"/g;
|
181
|
-
const replace = 'fill="currentColor"';
|
182
|
-
let imageDataNew = imageData.replace(fillRegex, replace);
|
183
|
-
|
184
|
-
// remove fillOpacity
|
185
|
-
const fillOpacityRegex = /fill-opacity="[^"]+"/g;
|
186
|
-
imageDataNew = imageDataNew.replace(fillOpacityRegex, '');
|
187
|
-
|
188
|
-
return imageDataNew;
|
189
|
-
}
|
190
|
-
|
191
|
-
function getCssColorIcon(imageData: string, icon: IconRef): string {
|
192
|
-
// replace fill color with currentColor
|
193
|
-
const fillRegex = /fill="([^"]+)"/g;
|
194
|
-
|
195
|
-
const replace = (match: string, color: string) => {
|
196
|
-
const cssClass = icon.styles[color];
|
197
|
-
if (cssClass === undefined) {
|
198
|
-
if (color === 'black') return 'fill="currentColor"';
|
199
|
-
if (color === 'none') return 'fill="none"';
|
200
|
-
if (color === 'white') return 'fill="none"';
|
201
|
-
console.warn(
|
202
|
-
'No css class for color',
|
203
|
-
color,
|
204
|
-
icon.name,
|
205
|
-
Object.keys(icon.styles)
|
206
|
-
);
|
207
|
-
return 'fill="currentColor"';
|
208
|
-
}
|
209
|
-
return `style="fill: var(--${cssClass.cssClass})"`;
|
210
|
-
};
|
211
|
-
imageData = imageData.replace(fillRegex, replace);
|
212
|
-
|
213
|
-
// remove fillOpacity
|
214
|
-
const fillOpacityRegex = /fill-opacity="[^"]+"/g;
|
215
|
-
imageData = imageData.replace(fillOpacityRegex, '');
|
216
|
-
|
217
|
-
return imageData;
|
218
|
-
}
|
219
|
-
|
220
|
-
function kebabToUpperCamelCase(kebabCase: string): string {
|
221
|
-
const words = kebabCase.replace(/ /g, '').split('-');
|
222
|
-
const upperCamelCase = words
|
223
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
224
|
-
.join('');
|
225
|
-
return upperCamelCase;
|
226
|
-
}
|
227
|
-
|
228
|
-
function getStylesForNode(
|
229
|
-
node: Figma.Node,
|
230
|
-
styles: {[styleId: string]: Figma.Style}
|
231
|
-
): {[colorCode: string]: {cssClass: string}} {
|
232
|
-
let out = {};
|
233
|
-
|
234
|
-
if ('children' in node) {
|
235
|
-
for (const child of node.children) {
|
236
|
-
out = {...out, ...getStylesForNode(child, styles)};
|
237
|
-
if ('fills' in child && 'styles' in child) {
|
238
|
-
let fils: string | undefined;
|
239
|
-
child.fills.forEach((fill) => {
|
240
|
-
if (fill.type === 'SOLID') {
|
241
|
-
if (fils !== undefined) {
|
242
|
-
console.warn(
|
243
|
-
'Multiple fills',
|
244
|
-
fils,
|
245
|
-
rgbaToHexOrColorName(fill.color!)
|
246
|
-
);
|
247
|
-
}
|
248
|
-
fils = rgbaToHexOrColorName(fill.color!);
|
249
|
-
}
|
250
|
-
});
|
251
|
-
if (fils !== undefined && child.styles && 'fill' in child.styles) {
|
252
|
-
const styleId = child.styles.fill as string;
|
253
|
-
const figmaStyle = styles[styleId];
|
254
|
-
const cssClass = styleToCssClass(figmaStyle);
|
255
|
-
out[fils] = {cssClass: cssClass};
|
256
|
-
}
|
257
|
-
}
|
258
|
-
if ('strokes' in child && 'styles' in child) {
|
259
|
-
let strokes: string;
|
260
|
-
child.strokes.forEach((fill) => {
|
261
|
-
if (fill.type === 'SOLID') {
|
262
|
-
if (strokes !== undefined) {
|
263
|
-
console.warn(
|
264
|
-
'Multiple strokes',
|
265
|
-
strokes,
|
266
|
-
rgbaToHexOrColorName(fill.color!)
|
267
|
-
);
|
268
|
-
}
|
269
|
-
strokes = rgbaToHexOrColorName(fill.color!);
|
270
|
-
}
|
271
|
-
});
|
272
|
-
if (strokes !== undefined && child.styles?.stroke) {
|
273
|
-
const styleId = child.styles.stroke;
|
274
|
-
const figmaStyle = styles[styleId];
|
275
|
-
const cssClass = styleToCssClass(figmaStyle);
|
276
|
-
out[strokes] = {cssClass: cssClass};
|
277
|
-
}
|
278
|
-
}
|
279
|
-
if ('fillOverrideTable' in child) {
|
280
|
-
for (const fill of Object.values(child.fillOverrideTable)) {
|
281
|
-
if (fill === null) continue;
|
282
|
-
if (!('inheritFillStyleId' in fill)) continue;
|
283
|
-
const styleId = fill.inheritFillStyleId;
|
284
|
-
const figmaStyle = styles[styleId];
|
285
|
-
const color = rgbaToHexOrColorName(fill.fills[0].color!);
|
286
|
-
const cssClass = styleToCssClass(figmaStyle);
|
287
|
-
out[color] = {cssClass: cssClass};
|
288
|
-
}
|
289
|
-
}
|
290
|
-
}
|
291
|
-
}
|
292
|
-
return out;
|
293
|
-
}
|
294
|
-
|
295
|
-
function decimalToHex(d: number): string {
|
296
|
-
const v = Math.round(d * 255).toString(16);
|
297
|
-
return v.length === 1 ? `0${v}` : v;
|
298
|
-
}
|
299
|
-
|
300
|
-
function rgbaToHexOrColorName(rgba: Figma.Color): string {
|
301
|
-
const isBlack = rgba.r === 0 && rgba.g === 0 && rgba.b === 0 && rgba.a === 1;
|
302
|
-
const isWhite = rgba.r === 1 && rgba.g === 1 && rgba.b === 1 && rgba.a === 1;
|
303
|
-
if (isBlack) {
|
304
|
-
return 'black';
|
305
|
-
} else if (isWhite) {
|
306
|
-
return 'white';
|
307
|
-
} else {
|
308
|
-
return `#${decimalToHex(rgba.r)}${decimalToHex(rgba.g)}${decimalToHex(
|
309
|
-
rgba.b
|
310
|
-
)}`.toUpperCase();
|
311
|
-
}
|
312
|
-
}
|
313
|
-
|
314
|
-
function styleToCssClass(style: Figma.Style): string {
|
315
|
-
return style.name.replace(/[\/ ]/g, '-').toLocaleLowerCase();
|
316
|
-
}
|
317
|
-
|
318
184
|
main();
|
@@ -32,10 +32,6 @@
|
|
32
32
|
}
|
33
33
|
}
|
34
34
|
|
35
|
-
& .badge {
|
36
|
-
color: var(--on-normal-active-color, #1A1A1A);
|
37
|
-
}
|
38
|
-
|
39
35
|
& .icon {
|
40
36
|
height: 24px;
|
41
37
|
width: 24px;
|
@@ -63,14 +59,7 @@
|
|
63
59
|
|
64
60
|
&.type-alarm {
|
65
61
|
@mixin style style=alarm visibleWrapperClass=.visible-wrapper;
|
66
|
-
|
67
|
-
& .visible-wrapper {
|
68
|
-
color: var(--on-alarm-active-color, #FFF);
|
69
|
-
|
70
|
-
& .badge {
|
71
|
-
color: var(--on-alarm-active-color, #FFF);
|
72
|
-
}
|
73
|
-
}
|
62
|
+
color: var(--on-alarm-active-color);
|
74
63
|
}
|
75
64
|
|
76
65
|
&.type-warning {
|
@@ -3,9 +3,18 @@ import {customElement, property} from 'lit/decorators.js';
|
|
3
3
|
import compentStyle from './alert-button.css?inline';
|
4
4
|
import '../../icons/icon-14-alerts';
|
5
5
|
import {AlertType} from '../../types';
|
6
|
+
import {classMap} from 'lit/directives/class-map.js';
|
6
7
|
|
7
8
|
/**
|
8
|
-
*
|
9
|
+
* Button used for alerts and notification
|
10
|
+
*
|
11
|
+
* @prop {number} nAlerts - Number of alerts.
|
12
|
+
* @prop {AlertType} alertType - Type of alert.
|
13
|
+
* @prop {boolean} standalone - If the button is standalone and not used together with an notification-message.
|
14
|
+
* @prop {boolean} counter - If the button should display a counter.
|
15
|
+
* @prop {boolean} blinkAlarmValue - This value should alternate between true and false to make the icon blink.
|
16
|
+
* It should be synchronized with the blinkValue of other alarms.
|
17
|
+
* @prop {boolean} blinkWarningValue - This value should alternate between true and false to make the icon blink.
|
9
18
|
*
|
10
19
|
* @fires click - Fires when the button is clicked.
|
11
20
|
*/
|
@@ -15,13 +24,29 @@ export class ObcAlertButton extends LitElement {
|
|
15
24
|
@property({type: String, attribute: 'alert-type'}) alertType = AlertType.None;
|
16
25
|
@property({type: Boolean}) standalone = false;
|
17
26
|
@property({type: Boolean}) counter = false;
|
27
|
+
@property({type: Boolean, attribute: 'blink-alarm-value'}) blinkAlarmValue =
|
28
|
+
false;
|
29
|
+
@property({type: Boolean, attribute: 'blink-warning-value'})
|
30
|
+
blinkWarningValue = false;
|
18
31
|
|
19
32
|
override render() {
|
33
|
+
let alertType = this.alertType;
|
34
|
+
if (this.alertType === AlertType.Alarm && !this.blinkAlarmValue) {
|
35
|
+
alertType = AlertType.None;
|
36
|
+
} else if (
|
37
|
+
this.alertType === AlertType.Warning &&
|
38
|
+
!this.blinkWarningValue
|
39
|
+
) {
|
40
|
+
alertType = AlertType.None;
|
41
|
+
}
|
20
42
|
return html`
|
21
43
|
<button
|
22
|
-
class
|
23
|
-
|
24
|
-
|
44
|
+
class=${classMap({
|
45
|
+
wrapper: true,
|
46
|
+
[`type-${alertType}`]: true,
|
47
|
+
counter: this.counter,
|
48
|
+
standalone: this.standalone,
|
49
|
+
})}
|
25
50
|
>
|
26
51
|
<div class="visible-wrapper">
|
27
52
|
<obi-14-alerts class="icon"></obi-14-alerts>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type {Meta, StoryObj} from '@storybook/web-components';
|
2
|
+
import {ObcAlertIcon, AlertIconNames} from './alert-icon';
|
3
|
+
import './alert-icon';
|
4
|
+
import {html} from 'lit';
|
5
|
+
|
6
|
+
const meta: Meta<typeof ObcAlertIcon> = {
|
7
|
+
title: 'Alert/Icon',
|
8
|
+
tags: ['autodocs'],
|
9
|
+
component: 'obc-alert-icon',
|
10
|
+
args: {
|
11
|
+
name: 'alarm-unack',
|
12
|
+
blinkValue: true,
|
13
|
+
},
|
14
|
+
argTypes: {
|
15
|
+
name: {
|
16
|
+
options: AlertIconNames,
|
17
|
+
control: {type: 'radio'},
|
18
|
+
},
|
19
|
+
blinkValue: {
|
20
|
+
control: {type: 'boolean'},
|
21
|
+
},
|
22
|
+
},
|
23
|
+
render: (args) =>
|
24
|
+
html` <div style="width:64px;height:64px">
|
25
|
+
<obc-alert-icon
|
26
|
+
?blink-value=${args.blinkValue}
|
27
|
+
name=${args.name}
|
28
|
+
></obc-alert-icon>
|
29
|
+
</div>`,
|
30
|
+
} satisfies Meta<ObcAlertIcon>;
|
31
|
+
|
32
|
+
export default meta;
|
33
|
+
type Story = StoryObj<ObcAlertIcon>;
|
34
|
+
|
35
|
+
export const Primary: Story = {};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import {LitElement, html, css} from 'lit';
|
2
|
+
import {customElement, property} from 'lit/decorators.js';
|
3
|
+
import {classMap} from 'lit/directives/class-map.js';
|
4
|
+
import {svg14AlarmSilencedA} from './icons/icon-14-alarm-silenced-a';
|
5
|
+
import {svg14AlarmSilencedB} from './icons/icon-14-alarm-silenced-b';
|
6
|
+
import {svg14AlarmUnackA} from './icons/icon-14-alarm-unack-a';
|
7
|
+
import {svg14AlarmUnackB} from './icons/icon-14-alarm-unack-b';
|
8
|
+
import {svg14WarningUnackA} from './icons/icon-14-warning-unack-a';
|
9
|
+
import {svg14WarningUnackB} from './icons/icon-14-warning-unack-b';
|
10
|
+
|
11
|
+
const mapping = {
|
12
|
+
'alarm-silenced': {a: svg14AlarmSilencedA, b: svg14AlarmSilencedB},
|
13
|
+
'alarm-unack': {a: svg14AlarmUnackA, b: svg14AlarmUnackB},
|
14
|
+
'warning-unack': {a: svg14WarningUnackA, b: svg14WarningUnackB},
|
15
|
+
};
|
16
|
+
|
17
|
+
export const AlertIconNames = Object.keys(mapping) as AlertIconName[];
|
18
|
+
export type AlertIconName = keyof typeof mapping;
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Icon used for alerts and notification with blinking effect
|
22
|
+
*
|
23
|
+
* @prop {boolean} blinkValue - This value should alternate between true and false to make the icon blink.
|
24
|
+
* @prop {AlertIconName} name - Name of the icon.
|
25
|
+
*/
|
26
|
+
@customElement('obc-alert-icon')
|
27
|
+
export class ObcAlertIcon extends LitElement {
|
28
|
+
@property({type: Boolean, attribute: 'blink-value'}) blinkValue = false;
|
29
|
+
@property({type: String}) name: AlertIconName = 'alarm-unack';
|
30
|
+
|
31
|
+
override render() {
|
32
|
+
const icons = mapping[this.name];
|
33
|
+
return html`
|
34
|
+
<div
|
35
|
+
class=${classMap({
|
36
|
+
wrapper: true,
|
37
|
+
'show-a': this.blinkValue,
|
38
|
+
'show-b': !this.blinkValue,
|
39
|
+
})}
|
40
|
+
>
|
41
|
+
<span class="a">${icons.a}</span>
|
42
|
+
<span class="b">${icons.b}</span>
|
43
|
+
</div>
|
44
|
+
`;
|
45
|
+
}
|
46
|
+
|
47
|
+
static override styles = css`
|
48
|
+
.wrapper {
|
49
|
+
height: 100%;
|
50
|
+
width: 100%;
|
51
|
+
}
|
52
|
+
.wrapper * {
|
53
|
+
height: 100%;
|
54
|
+
width: 100%;
|
55
|
+
}
|
56
|
+
.a,
|
57
|
+
.b {
|
58
|
+
display: none;
|
59
|
+
}
|
60
|
+
|
61
|
+
.show-a .a {
|
62
|
+
display: revert;
|
63
|
+
}
|
64
|
+
|
65
|
+
.show-b .b {
|
66
|
+
display: revert;
|
67
|
+
}
|
68
|
+
`;
|
69
|
+
}
|
70
|
+
|
71
|
+
declare global {
|
72
|
+
interface HTMLElementTagNameMap {
|
73
|
+
'obc-alert-icon': ObcAlertIcon;
|
74
|
+
}
|
75
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import {svg} from 'lit';
|
2
|
+
export const svg14AlarmSilencedA = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
3
|
+
<path d="M11.1409 1.51681C11.5032 0.82773 12.4968 0.827732 12.8591 1.51681L22.8888 20.5936C23.2254 21.2338 22.7573 22 22.0297 22H1.97033C1.24266 22 0.774615 21.2338 1.11121 20.5936L11.1409 1.51681Z" fill="var(--alarm-enabled-background-color)"/>
|
4
|
+
<path d="M6.99848 10.8967L7.88021 10.015L17.3 19.2682L16.4183 20.1499L15.1363 18.868C14.4859 19.387 13.7168 19.7747 12.8788 19.9623V18.6741C13.3791 18.5303 13.8356 18.2864 14.2421 17.98L11.6281 15.366V19.487L8.50138 16.3603H6V12.6082H8.50138L8.68273 12.4206L6.99848 10.8967Z" style="fill: var(--on-alarm-active-color)"/>
|
5
|
+
<path d="M15.7491 15.9476C15.9117 15.4911 16.0055 14.9971 16.0055 14.4843C16.0055 12.5019 14.6861 10.826 12.8788 10.2882V9C15.3864 9.56906 17.2562 11.8078 17.2562 14.4843C17.2562 15.3535 17.0561 16.1727 16.7059 16.9044L15.7491 15.9476Z" style="fill: var(--on-alarm-active-color)"/>
|
6
|
+
<path d="M12.8788 11.9641C13.8043 12.4269 14.4422 13.3774 14.4422 14.4843C14.4422 14.5343 14.4359 14.5843 14.4297 14.6344L12.8788 13.0835V11.9641Z" style="fill: var(--on-alarm-active-color)"/>
|
7
|
+
<path d="M10.4525 10.6572L11.6281 9.48152V11.8328L10.4525 10.6572Z" style="fill: var(--on-alarm-active-color)"/>
|
8
|
+
</svg>
|
9
|
+
`;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import {svg} from 'lit';
|
2
|
+
export const svg14AlarmSilencedB = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
3
|
+
<g clip-path="url(#clip0_850_47505)">
|
4
|
+
<path d="M13.3017 1.28413L12.8591 1.51681L13.3017 1.28413C12.752 0.238626 11.248 0.238621 10.6983 1.28413L11.1314 1.51182L10.6983 1.28413L0.668648 20.3609C0.154023 21.3397 0.872928 22.5 1.97033 22.5H22.0297C23.1271 22.5 23.846 21.3397 23.3314 20.3609L13.3017 1.28413Z" style="stroke: var(--element-neutral-color)" />
|
5
|
+
<path d="M6.99848 10.8967L7.88021 10.015L17.3 19.2682L16.4183 20.1499L15.1363 18.868C14.4859 19.387 13.7168 19.7747 12.8788 19.9623V18.6741C13.3791 18.5303 13.8356 18.2864 14.2421 17.98L11.6281 15.366V19.487L8.50138 16.3603H6V12.6082H8.50138L8.68273 12.4206L6.99848 10.8967Z" style="fill: var(--element-neutral-color)" />
|
6
|
+
<path d="M15.7491 15.9476C15.9117 15.4911 16.0055 14.9971 16.0055 14.4843C16.0055 12.5019 14.6861 10.826 12.8788 10.2882V9C15.3864 9.56906 17.2562 11.8078 17.2562 14.4843C17.2562 15.3535 17.0561 16.1727 16.7059 16.9044L15.7491 15.9476Z" style="fill: var(--element-neutral-color)" />
|
7
|
+
<path d="M12.8788 11.9641C13.8043 12.4269 14.4422 13.3774 14.4422 14.4843C14.4422 14.5343 14.4359 14.5843 14.4297 14.6344L12.8788 13.0835V11.9641Z" style="fill: var(--element-neutral-color)" />
|
8
|
+
<path d="M10.4525 10.6572L11.6281 9.48152V11.8328L10.4525 10.6572Z" style="fill: var(--element-neutral-color)" />
|
9
|
+
</g>
|
10
|
+
<defs>
|
11
|
+
<clipPath id="clip0_850_47505">
|
12
|
+
<rect width="24" height="24" fill="none"/>
|
13
|
+
</clipPath>
|
14
|
+
</defs>
|
15
|
+
</svg>
|
16
|
+
`;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import {svg} from 'lit';
|
2
|
+
export const svg14AlarmUnackA = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
3
|
+
<path d="M11.1409 1.51681C11.5032 0.82773 12.4968 0.827732 12.8591 1.51681L22.8888 20.5936C23.2254 21.2338 22.7573 22 22.0297 22H1.97033C1.24266 22 0.774615 21.2338 1.11121 20.5936L11.1409 1.51681Z" fill="var(--alarm-enabled-background-color)"/>
|
4
|
+
<path d="M8.50855 16.3814L11.6442 19.5171V9.4829L8.50855 12.6186H6V16.3814H8.50855Z" style="fill: var(--on-alarm-active-color)"/>
|
5
|
+
<path d="M14.4664 14.5C14.4664 13.39 13.8267 12.4367 12.8985 11.9726V17.0211C13.8267 16.5633 14.4664 15.61 14.4664 14.5Z" style="fill: var(--on-alarm-active-color)"/>
|
6
|
+
<path d="M12.8985 10.2919C14.7109 10.8312 16.0342 12.512 16.0342 14.5C16.0342 16.488 14.7109 18.1688 12.8985 18.7081V20C15.4133 19.4293 17.2885 17.1842 17.2885 14.5C17.2885 11.8159 15.4133 9.5707 12.8985 9V10.2919Z" style="fill: var(--on-alarm-active-color)"/>
|
7
|
+
</svg>
|
8
|
+
`;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import {svg} from 'lit';
|
2
|
+
export const svg14AlarmUnackB = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
3
|
+
<g clip-path="url(#clip0_850_47508)">
|
4
|
+
<path d="M13.3017 1.28413L12.8591 1.51681L13.3017 1.28413C12.752 0.238626 11.248 0.238621 10.6983 1.28413L11.1314 1.51182L10.6983 1.28413L0.668648 20.3609C0.154023 21.3397 0.872928 22.5 1.97033 22.5H22.0297C23.1271 22.5 23.846 21.3397 23.3314 20.3609L13.3017 1.28413Z" style="stroke: var(--element-neutral-color)" />
|
5
|
+
<path d="M8.50855 16.3814L11.6442 19.5171V9.4829L8.50855 12.6186H6V16.3814H8.50855Z" style="fill: var(--element-neutral-color)" />
|
6
|
+
<path d="M14.4664 14.5C14.4664 13.39 13.8267 12.4367 12.8985 11.9726V17.0211C13.8267 16.5633 14.4664 15.61 14.4664 14.5Z" style="fill: var(--element-neutral-color)" />
|
7
|
+
<path d="M12.8985 10.2919C14.7109 10.8312 16.0342 12.512 16.0342 14.5C16.0342 16.488 14.7109 18.1688 12.8985 18.7081V20C15.4133 19.4293 17.2885 17.1842 17.2885 14.5C17.2885 11.8159 15.4133 9.5707 12.8985 9V10.2919Z" style="fill: var(--element-neutral-color)" />
|
8
|
+
</g>
|
9
|
+
<defs>
|
10
|
+
<clipPath id="clip0_850_47508">
|
11
|
+
<rect width="24" height="24" fill="none"/>
|
12
|
+
</clipPath>
|
13
|
+
</defs>
|
14
|
+
</svg>
|
15
|
+
`;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import {svg} from 'lit';
|
2
|
+
export const svg14WarningUnackA = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
3
|
+
<circle cx="12" cy="12" r="10.5" style="fill: var(--warning-enabled-background-color)" style="stroke: var(--element-active-color)"/>
|
4
|
+
<path d="M8.50855 13.8814L11.6442 17.0171V6.9829L8.50855 10.1186H6V13.8814H8.50855Z" style="fill: var(--on-warning-active-color)" />
|
5
|
+
<path d="M14.4664 12C14.4664 10.89 13.8267 9.93672 12.8985 9.47263V14.5211C13.8267 14.0633 14.4664 13.11 14.4664 12Z" style="fill: var(--on-warning-active-color)" />
|
6
|
+
<path d="M12.8985 7.7919C14.7109 8.33124 16.0342 10.012 16.0342 12C16.0342 13.988 14.7109 15.6688 12.8985 16.2081V17.5C15.4133 16.9293 17.2885 14.6842 17.2885 12C17.2885 9.31585 15.4133 7.0707 12.8985 6.5V7.7919Z" style="fill: var(--on-warning-active-color)" />
|
7
|
+
</svg>
|
8
|
+
`;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import {svg} from 'lit';
|
2
|
+
export const svg14WarningUnackB = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
3
|
+
<circle cx="12" cy="12" r="10.5" style="stroke: var(--element-neutral-color)" />
|
4
|
+
<path d="M8.50855 13.8814L11.6442 17.0171V6.9829L8.50855 10.1186H6V13.8814H8.50855Z" style="fill: var(--element-neutral-color)" />
|
5
|
+
<path d="M14.4664 12C14.4664 10.89 13.8267 9.93672 12.8985 9.47263V14.5211C13.8267 14.0633 14.4664 13.11 14.4664 12Z" style="fill: var(--element-neutral-color)" />
|
6
|
+
<path d="M12.8985 7.7919C14.7109 8.33124 16.0342 10.012 16.0342 12C16.0342 13.988 14.7109 15.6688 12.8985 16.2081V17.5C15.4133 16.9293 17.2885 14.6842 17.2885 12C17.2885 9.31585 15.4133 7.0707 12.8985 6.5V7.7919Z" style="fill: var(--element-neutral-color)" />
|
7
|
+
</svg>
|
8
|
+
`;
|
@@ -18,6 +18,8 @@ const meta: Meta<typeof ObcAlertTopbarElement> = {
|
|
18
18
|
minimized: false,
|
19
19
|
showAck: true,
|
20
20
|
alertMuted: false,
|
21
|
+
blinkAlarmValue: true,
|
22
|
+
blinkWarningValue: true,
|
21
23
|
},
|
22
24
|
argTypes: {
|
23
25
|
alertType: {
|
@@ -30,6 +32,8 @@ const meta: Meta<typeof ObcAlertTopbarElement> = {
|
|
30
32
|
n-alerts=${args.nAlerts}
|
31
33
|
alert-type=${args.alertType}
|
32
34
|
max-width=${args.maxWidth}
|
35
|
+
?blink-alarm-value=${args.blinkAlarmValue}
|
36
|
+
?blink-warning-value=${args.blinkWarningValue}
|
33
37
|
?minimized=${args.minimized}
|
34
38
|
?show-ack=${args.showAck}
|
35
39
|
?alert-muted=${args.alertMuted}
|
@@ -13,18 +13,33 @@ import {classMap} from 'lit/directives/class-map.js';
|
|
13
13
|
* Element that displays the alert in topbar
|
14
14
|
* Use the element in the alerts slot in topbar
|
15
15
|
*
|
16
|
+
* @prop {number} nAlerts - Number of alerts.
|
17
|
+
* @prop {AlertType} alertType - Type of alert.
|
18
|
+
* @prop {boolean} blinkAlarmValue - This value should alternate between true and false to make the icon blink.
|
19
|
+
* It should be synchronized with the blinkValue of other alarms.
|
20
|
+
* @prop {boolean} blinkWarningValue - This value should alternate between true and false to make the icon blink.
|
21
|
+
* @prop {boolean} showAck - If the ack button should be shown.
|
22
|
+
* @prop {boolean} alertMuted - If the alert is muted.
|
23
|
+
* @prop {boolean} minimized - If the alert is minimized.
|
24
|
+
* @prop {number} maxWidth - The maximum width of the alert.
|
25
|
+
*
|
16
26
|
* @fires muteclick - Fired when the mute button is clicked
|
17
27
|
* @fires ackclick - Fired when the ack button is clicked
|
18
28
|
* @fires alertclick - Fired when the alert button is clicked
|
19
29
|
* @fires messageclick - Fired when the message is clicked
|
20
30
|
*
|
21
31
|
* @slot - The message to display in the alert element of type `obc-notification-message-item`
|
32
|
+
* @slot empty - The message to display when there are no alerts
|
22
33
|
*/
|
23
34
|
@customElement('obc-alert-topbar-element')
|
24
35
|
export class ObcAlertTopbarElement extends LitElement {
|
25
36
|
@property({type: Number, attribute: 'n-alerts'}) nAlerts = 0;
|
26
37
|
@property({type: String, attribute: 'alert-type'}) alertType: AlertType =
|
27
38
|
AlertType.None;
|
39
|
+
@property({type: Boolean, attribute: 'blink-alarm-value'}) blinkAlarmValue =
|
40
|
+
false;
|
41
|
+
@property({type: Boolean, attribute: 'blink-warning-value'})
|
42
|
+
blinkWarningValue = false;
|
28
43
|
@property({type: Boolean, attribute: 'show-ack'}) showAck = false;
|
29
44
|
@property({type: Boolean, attribute: 'alert-muted'}) alertMuted = false;
|
30
45
|
@property({type: Boolean}) minimized = false;
|
@@ -92,6 +107,8 @@ export class ObcAlertTopbarElement extends LitElement {
|
|
92
107
|
alert-type=${this.alertType}
|
93
108
|
n-alerts=${this.nAlerts}
|
94
109
|
?counter=${!empty}
|
110
|
+
?blink-alarm-value=${this.blinkAlarmValue}
|
111
|
+
?blink-warning-value=${this.blinkWarningValue}
|
95
112
|
@click=${() => this.dispatchEvent(new CustomEvent('alertclick'))}
|
96
113
|
></obc-alert-button>
|
97
114
|
</div>
|
@@ -2,7 +2,7 @@ import type {Meta, StoryObj} from '@storybook/web-components';
|
|
2
2
|
import {ObcNotificationMessage} from './notification-message';
|
3
3
|
import './notification-message';
|
4
4
|
import '../notification-message-item/notification-message-item';
|
5
|
-
import '
|
5
|
+
import '../alert-icon/alert-icon';
|
6
6
|
import {html} from 'lit';
|
7
7
|
|
8
8
|
const meta: Meta<typeof ObcNotificationMessage> = {
|
@@ -20,7 +20,11 @@ export const Primary: Story = {
|
|
20
20
|
render: () => html`
|
21
21
|
<obc-notification-message>
|
22
22
|
<obc-notification-message-item time="2023-01-01T13:37:01+01:00">
|
23
|
-
<
|
23
|
+
<obc-alert-icon
|
24
|
+
slot="icon"
|
25
|
+
name="alarm-unack"
|
26
|
+
blink-value
|
27
|
+
></obc-alert-icon>
|
24
28
|
<div slot="message">This is a message</div>
|
25
29
|
</obc-notification-message-item>
|
26
30
|
<div slot="empty">No active alerts</div>
|
@@ -40,11 +44,19 @@ export const Large: Story = {
|
|
40
44
|
render: () => html`
|
41
45
|
<obc-notification-message large>
|
42
46
|
<obc-notification-message-item time="2023-01-01T13:37:01+01:00">
|
43
|
-
<
|
47
|
+
<obc-alert-icon
|
48
|
+
slot="icon"
|
49
|
+
name="alarm-unack"
|
50
|
+
blink-value
|
51
|
+
></obc-alert-icon>
|
44
52
|
<div slot="message">This is a message</div>
|
45
53
|
</obc-notification-message-item>
|
46
54
|
<obc-notification-message-item time="2023-01-01T13:37:01+01:00">
|
47
|
-
<
|
55
|
+
<obc-alert-icon
|
56
|
+
slot="icon"
|
57
|
+
name="alarm-unack"
|
58
|
+
blink-value
|
59
|
+
></obc-alert-icon>
|
48
60
|
<div slot="message">This is a message</div>
|
49
61
|
</obc-notification-message-item>
|
50
62
|
<div slot="empty">No active alerts</div>
|
@@ -53,13 +65,17 @@ export const Large: Story = {
|
|
53
65
|
};
|
54
66
|
|
55
67
|
export const LargeSingleMessage: Story = {
|
56
|
-
render: () => `
|
68
|
+
render: () => html`
|
57
69
|
<obc-notification-message large>
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
70
|
+
<obc-notification-message-item time="2023-01-01T13:37:01+01:00">
|
71
|
+
<obc-alert-icon
|
72
|
+
slot="icon"
|
73
|
+
name="alarm-unack"
|
74
|
+
blink-value
|
75
|
+
></obc-alert-icon>
|
76
|
+
<div slot="message">This is a message</div>
|
77
|
+
</obc-notification-message-item>
|
78
|
+
<div slot="empty">No active alerts</div>
|
63
79
|
</obc-notification-message>
|
64
80
|
`,
|
65
81
|
};
|