@dile/iconlib 1.1.0 → 1.2.1
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/dile-lucide-badge.js +3 -0
- package/package.json +2 -2
- package/src/DileLucideBadge.js +44 -0
- package/src/lucideBadgeStyles.js +77 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/iconlib",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Icon Component Library based on popular libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"UI",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "d1f3c6a38a24314454f4b06376a9279d9affb05a"
|
|
29
29
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { badgeStyles } from "./lucideBadgeStyles.js";
|
|
2
|
+
import '../dile-lucide-icon.js';
|
|
3
|
+
|
|
4
|
+
export class DileLucideBadge extends HTMLElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this.attachShadow({ mode: 'open' });
|
|
8
|
+
this.shadowRoot.adoptedStyleSheets = [badgeStyles];
|
|
9
|
+
this.icon = "dot";
|
|
10
|
+
this.variant = null;
|
|
11
|
+
this.rounded = false;
|
|
12
|
+
this.render();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
render() {
|
|
16
|
+
this.shadowRoot.innerHTML = `
|
|
17
|
+
<div class="badge-container">
|
|
18
|
+
<div class="icon-wrapper">
|
|
19
|
+
<dile-lucide-icon icon="${this.icon}"></dile-lucide-icon>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="text-wrapper">
|
|
22
|
+
<slot></slot>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static get observedAttributes() {
|
|
29
|
+
return ['icon', 'variant', 'rounded'];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
33
|
+
if (name === 'icon' && newValue !== null) {
|
|
34
|
+
this.icon = newValue;
|
|
35
|
+
this.render();
|
|
36
|
+
}
|
|
37
|
+
if (name === 'variant' && newValue !== null) {
|
|
38
|
+
this.variant = newValue;
|
|
39
|
+
}
|
|
40
|
+
if (name === 'rounded') {
|
|
41
|
+
this.rounded = newValue !== null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export const badgeStyles = new CSSStyleSheet();
|
|
2
|
+
badgeStyles.replaceSync(`
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
--dile-icon-color: var(--dile-lucide-badge-on-color, var(--dile-on-primary-color, #303030));
|
|
6
|
+
--dile-icon-size: var(--dile-lucide-badge-icon-size, 18px);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.badge-container {
|
|
10
|
+
display: inherit;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: var(--dile-lucide-badge-gap, 0.5rem);
|
|
13
|
+
padding: var(--dile-lucide-badge-padding, 0.375rem 0.75rem);
|
|
14
|
+
border-radius: var(--dile-lucide-badge-border-radius, 9999px);
|
|
15
|
+
background-color: var(--dile-lucide-badge-color, var(--dile-primary-color, #f3f3ae));
|
|
16
|
+
color: var(--dile-lucide-badge-on-color, var(--dile-on-primary-color, #303030));
|
|
17
|
+
font-size: var(--dile-lucide-badge-font-size, 0.8rem);
|
|
18
|
+
font-weight: var(--dile-lucide-badge-font-weight, 500);
|
|
19
|
+
border: var(--dile-lucide-badge-border-width, 0px) solid var(--dile-lucide-badge-border-color, transparent);
|
|
20
|
+
transition-duration: var(--dile-lucide-badge-transition-duration, 0.3s);
|
|
21
|
+
transition-timing-function: ease-in-out;
|
|
22
|
+
transition-property: background-color, color;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([variant="primary"]) .badge-container {
|
|
26
|
+
background-color: var(--dile-lucide-badge-primary, var(--dile-primary-color, #f3f3ae));
|
|
27
|
+
color: var(--dile-lucide-badge-on-primary, var(--dile-on-primary-color, #303030));
|
|
28
|
+
--dile-icon-color: var(--dile-lucide-badge-on-primary, var(--dile-on-primary-color, #303030));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([variant="secondary"]) .badge-container {
|
|
32
|
+
background-color: var(--dile-lucide-badge-secondary, var(--dile-secondary-color, #27a744));
|
|
33
|
+
color: var(--dile-lucide-badge-on-secondary, var(--dile-on-secondary-color, #ffffff));
|
|
34
|
+
--dile-icon-color: var(--dile-lucide-badge-on-secondary, var(--dile-on-secondary-color, #ffffff));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([variant="danger"]) .badge-container {
|
|
38
|
+
background-color: var(--dile-lucide-badge-danger, var(--dile-danger-color, #e34a1b));
|
|
39
|
+
color: var(--dile-lucide-badge-on-danger, var(--dile-on-danger-color, #ffffff));
|
|
40
|
+
--dile-icon-color: var(--dile-lucide-badge-on-danger, var(--dile-on-danger-color, #ffffff));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([variant="error"]) .badge-container {
|
|
44
|
+
background-color: var(--dile-lucide-badge-error, var(--dile-alert-error-color, #cf3535));
|
|
45
|
+
color: var(--dile-lucide-badge-on-error, var(--dile-on-alert-color, #ffffff));
|
|
46
|
+
--dile-icon-color: var(--dile-lucide-badge-on-error, var(--dile-on-alert-color, #ffffff));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:host([variant="success"]) .badge-container {
|
|
50
|
+
background-color: var(--dile-lucide-badge-success, var(--dile-alert-success-color, #00900f));
|
|
51
|
+
color: var(--dile-lucide-badge-on-success, var(--dile-on-alert-color, #ffffff));
|
|
52
|
+
--dile-icon-color: var(--dile-lucide-badge-on-success, var(--dile-on-alert-color, #ffffff));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host([variant="warning"]) .badge-container {
|
|
56
|
+
background-color: var(--dile-lucide-badge-warning, var(--dile-alert-warning-color, #d7b740));
|
|
57
|
+
color: var(--dile-lucide-badge-on-warning, var(--dile-on-alert-color, #ffffff));
|
|
58
|
+
--dile-icon-color: var(--dile-lucide-badge-on-warning, var(--dile-on-alert-color, #ffffff));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([variant="soft"]) .badge-container {
|
|
62
|
+
background-color: var(--dile-lucide-badge-soft, #2a7a9f);
|
|
63
|
+
color: var(--dile-lucide-badge-on-soft, #ffffff);
|
|
64
|
+
--dile-icon-color: var(--dile-lucide-badge-on-soft, #ffffff);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.icon-wrapper {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
line-height: 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.text-wrapper {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
}
|
|
77
|
+
`);
|