@outbook/webcomponents-notification-alert 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_lib/_notification-alert.style.js +4 -0
- package/_lib/constants.js +1 -0
- package/_lib/icon-list.js +8 -0
- package/notification-alert.js +5 -12
- package/package.json +6 -4
- package/_notification-alert.scss +0 -62
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { css } from 'lit';
|
|
3
|
+
|
|
4
|
+
export default css`:host{display:block;--alert--font-size: 1.25rem;--alert--line-height: 2rem;--alert--icon-size: 2rem;--alert--color: light-dark( oklch(20.5% 0 0deg), oklch(92.2% 0 0deg) )}:host([type=info]){--alert--color: light-dark( oklch(39.1% 0.09 240.876deg), oklch(90.1% 0.058 230.902deg) )}:host([type=success]){--alert--color: light-dark( oklch(39.3% 0.095 152.535deg), oklch(92.5% 0.084 155.995deg) )}:host([type=error]){--alert--color: light-dark( oklch(39.6% 0.141 25.723deg), oklch(88.5% 0.062 18.334deg) )}:host([type=warning]){--alert--color: light-dark( oklch(41.4% 0.112 45.904deg), oklch(92.4% 0.12 95.746deg) )}:host([size=small]){--alert--font-size: 1rem;--alert--line-height: 1.5rem;--alert--icon-size: 1.5rem}.notification-alert{display:flex;box-sizing:border-box}.notification-alert__icon{width:var(--alert--icon-size);height:var(--alert--icon-size);margin-right:0.5rem}.notification-alert__text{font-size:var(--alert--font-size);line-height:var(--alert--line-height);margin:0}.notification-alert__icon,.notification-alert__text{color:var(--alert--color)}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SIZE_LIST = ['small', 'medium'];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { svg } from 'lit';
|
|
2
|
+
|
|
3
|
+
export const ICON_LIST = {
|
|
4
|
+
error: svg`<path d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm0-160q17 0 28.5-11.5T520-480v-160q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v160q0 17 11.5 28.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/>`,
|
|
5
|
+
info: svg`<path d="M480-280q17 0 28.5-11.5T520-320v-160q0-17-11.5-28.5T480-520q-17 0-28.5 11.5T440-480v160q0 17 11.5 28.5T480-280Zm0-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/>`,
|
|
6
|
+
success: svg`<path d="m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z"/>`,
|
|
7
|
+
warning: svg`<path d="M109-120q-11 0-20-5.5T75-140q-5-9-5.5-19.5T75-180l370-640q6-10 15.5-15t19.5-5q10 0 19.5 5t15.5 15l370 640q6 10 5.5 20.5T885-140q-5 9-14 14.5t-20 5.5H109Zm69-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm0-120q17 0 28.5-11.5T520-400v-120q0-17-11.5-28.5T480-560q-17 0-28.5 11.5T440-520v120q0 17 11.5 28.5T480-360Zm0-100Z"/>`
|
|
8
|
+
};
|
package/notification-alert.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { html, LitElement
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
2
|
import { classMap } from 'lit/directives/class-map.js';
|
|
3
3
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
4
|
import { TypeIcon } from '@outbook/webcomponents-type-icon/shadow';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
error: svg`<path d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm0-160q17 0 28.5-11.5T520-480v-160q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v160q0 17 11.5 28.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/>`,
|
|
9
|
-
info: svg`<path d="M480-280q17 0 28.5-11.5T520-320v-160q0-17-11.5-28.5T480-520q-17 0-28.5 11.5T440-480v160q0 17 11.5 28.5T480-280Zm0-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/>`,
|
|
10
|
-
success: svg`<path d="m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z"/>`,
|
|
11
|
-
warning: svg`<path d="M109-120q-11 0-20-5.5T75-140q-5-9-5.5-19.5T75-180l370-640q6-10 15.5-15t19.5-5q10 0 19.5 5t15.5 15l370 640q6 10 5.5 20.5T885-140q-5 9-14 14.5t-20 5.5H109Zm69-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm0-120q17 0 28.5-11.5T520-400v-120q0-17-11.5-28.5T480-560q-17 0-28.5 11.5T440-520v120q0 17 11.5 28.5T480-360Zm0-100Z"/>`
|
|
12
|
-
};
|
|
5
|
+
import { ICON_LIST } from './_lib/icon-list.js';
|
|
6
|
+
import { SIZE_LIST } from './_lib/constants.js';
|
|
7
|
+
import styleComponent from './_lib/_notification-alert.style.js';
|
|
13
8
|
|
|
14
9
|
class ComponentNotificationAlert extends LitElement {
|
|
15
10
|
static properties = {
|
|
@@ -19,9 +14,7 @@ class ComponentNotificationAlert extends LitElement {
|
|
|
19
14
|
testId: { type: String }
|
|
20
15
|
};
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
17
|
+
static styles = styleComponent;
|
|
25
18
|
|
|
26
19
|
render() {
|
|
27
20
|
const iconName = ICON_LIST[this.type] ? this.type : 'info';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outbook/webcomponents-notification-alert",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"main": "notification-alert.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -21,9 +21,11 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"description": "Web components notification-alert",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@outbook/
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
"@outbook/webcomponents-type-icon": ">=1.1.1"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@outbook/colorful": ">=1.1.2",
|
|
28
|
+
"@outbook/design-decisions": ">=1.1.1"
|
|
27
29
|
},
|
|
28
30
|
"peerDependencies": {
|
|
29
31
|
"sass": "^1.97.2",
|
package/_notification-alert.scss
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
@use '@outbook/design-decisions/measures';
|
|
2
|
-
@use '@outbook/colorful/palettes-oklch' as colors;
|
|
3
|
-
|
|
4
|
-
$webcomponent-notification-alert-loaded: false !default;
|
|
5
|
-
|
|
6
|
-
$-baseline: measures.$baseline;
|
|
7
|
-
|
|
8
|
-
@mixin style() {
|
|
9
|
-
@if not $webcomponent-notification-alert-loaded {
|
|
10
|
-
$webcomponent-notification-alert-loaded: true !global;
|
|
11
|
-
|
|
12
|
-
outbook-notification-alert {
|
|
13
|
-
--alert--font-size: #{$-baseline * 2.5};
|
|
14
|
-
--alert--line-height: #{$-baseline * 4};
|
|
15
|
-
--alert--icon-size: #{$-baseline * 4};
|
|
16
|
-
--alert--color: light-dark(#{colors.$neutral_900}, #{colors.$neutral_200});
|
|
17
|
-
|
|
18
|
-
&[type="info"] {
|
|
19
|
-
--alert--color: light-dark(#{colors.$sky_900}, #{colors.$sky_200});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&[type="success"] {
|
|
23
|
-
--alert--color: light-dark(#{colors.$green_900}, #{colors.$green_200});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&[type="error"] {
|
|
27
|
-
--alert--color: light-dark(#{colors.$red_900}, #{colors.$red_200});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&[type="warning"] {
|
|
31
|
-
--alert--color: light-dark(#{colors.$amber_900}, #{colors.$amber_200});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&[size="small"] {
|
|
35
|
-
--alert--font-size: #{$-baseline * 2};
|
|
36
|
-
--alert--line-height: #{$-baseline * 3};
|
|
37
|
-
--alert--icon-size: #{$-baseline * 3};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.notification-alert {
|
|
41
|
-
display: flex;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.notification-alert__icon {
|
|
45
|
-
width: var(--alert--icon-size);
|
|
46
|
-
height: var(--alert--icon-size);
|
|
47
|
-
margin-right: #{$-baseline};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.notification-alert__text {
|
|
51
|
-
font-size: var(--alert--font-size);
|
|
52
|
-
line-height: var(--alert--line-height);
|
|
53
|
-
margin: 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.notification-alert__icon,
|
|
57
|
-
.notification-alert__text {
|
|
58
|
-
color: var(--alert--color);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|