@supersoniks/concorde 1.1.27 → 1.1.30
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/README.md +0 -0
- package/cli.js +0 -0
- package/concorde-core.bundle.js +21 -22
- package/concorde-core.es.js +22 -23
- package/core/components/functional/subscriber/subscriber.d.ts +2 -1
- package/core/components/functional/subscriber/subscriber.js +8 -0
- package/core/components/ui/_css/size.d.ts +1 -0
- package/core/components/ui/_css/size.js +26 -0
- package/core/components/ui/_css/type.d.ts +2 -0
- package/core/components/ui/_css/{types.js → type.js} +1 -1
- package/core/components/ui/alert/alert.d.ts +1 -1
- package/core/components/ui/alert/alert.js +6 -15
- package/core/components/ui/badge/badge.d.ts +1 -1
- package/core/components/ui/badge/badge.js +7 -6
- package/core/components/ui/button/button.d.ts +12 -7
- package/core/components/ui/button/button.js +32 -35
- package/core/components/ui/card/card-header.js +1 -1
- package/core/components/ui/divider/divider.d.ts +1 -1
- package/core/components/ui/divider/divider.js +7 -3
- package/core/components/ui/form/checkbox/checkbox.d.ts +13 -11
- package/core/components/ui/form/checkbox/checkbox.js +12 -8
- package/core/components/ui/form/css/form-control.js +56 -31
- package/core/components/ui/form/input/input.d.ts +24 -20
- package/core/components/ui/form/input/input.js +35 -33
- package/core/components/ui/form/radio/radio.js +1 -2
- package/core/components/ui/form/select/select.d.ts +9 -9
- package/core/components/ui/form/select/select.js +8 -14
- package/core/components/ui/form/textarea/textarea.d.ts +19 -18
- package/core/components/ui/form/textarea/textarea.js +12 -23
- package/core/components/ui/icon/icon.js +4 -0
- package/core/components/ui/icon/icons.js +4 -0
- package/core/components/ui/icon/icons.json +1 -1
- package/core/components/ui/image/image.d.ts +0 -1
- package/core/components/ui/image/image.js +0 -23
- package/core/components/ui/pop/pop.d.ts +1 -0
- package/core/components/ui/pop/pop.js +8 -0
- package/core/components/ui/progress/progress.d.ts +1 -0
- package/core/components/ui/progress/progress.js +13 -20
- package/core/components/ui/table/table-td.d.ts +1 -0
- package/core/components/ui/table/table-td.js +6 -2
- package/core/components/ui/table/table-th.js +2 -2
- package/core/components/ui/table/table-tr.js +3 -2
- package/core/components/ui/table/table.d.ts +1 -1
- package/core/components/ui/table/table.js +3 -20
- package/core/components/ui/theme/css/tailwind.css +0 -0
- package/core/components/ui/theme/css/tailwind.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/core-variables.js +19 -8
- package/core/components/ui/theme/theme.d.ts +8 -1
- package/core/components/ui/theme/theme.js +42 -1
- package/core/components/ui/toast/toast-item.d.ts +2 -0
- package/core/components/ui/toast/toast-item.js +24 -1
- package/core/components/ui/toast/toast.d.ts +1 -0
- package/core/components/ui/toast/toast.js +16 -2
- package/core/components/ui/toast/types.d.ts +1 -0
- package/core/mixins/FormCheckable.d.ts +4 -3
- package/core/mixins/FormCheckable.js +4 -1
- package/core/mixins/FormElement.d.ts +4 -3
- package/core/mixins/FormElement.js +9 -5
- package/core/mixins/FormInput.d.ts +7 -6
- package/core/mixins/FormInput.js +1 -3
- package/mixins.d.ts +10 -8
- package/package.json +5 -3
- package/core/components/ui/_css/types.d.ts +0 -2
|
@@ -18,7 +18,6 @@ let Image = class Image extends LitElement {
|
|
|
18
18
|
this.ratio = "auto";
|
|
19
19
|
this.objectPosition = "center center";
|
|
20
20
|
this.imageRendering = "auto";
|
|
21
|
-
this.shadow = "none";
|
|
22
21
|
this.cover = false;
|
|
23
22
|
}
|
|
24
23
|
render() {
|
|
@@ -83,25 +82,6 @@ Image.styles = [
|
|
|
83
82
|
--sc-img-radius: 0 !important;
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
/*OMBRE*/
|
|
87
|
-
:host([shadow]) > div,
|
|
88
|
-
:host([shadow="md"]) > div,
|
|
89
|
-
:host([shadow="true"]) > div {
|
|
90
|
-
box-shadow: var(--sc-shadow);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
:host([shadow="sm"]) > div {
|
|
94
|
-
box-shadow: var(--sc-shadow-sm);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
:host([shadow="none"]) > div {
|
|
98
|
-
box-shadow: none;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
:host([shadow="lg"]) > div {
|
|
102
|
-
box-shadow: var(--sc-shadow-lg);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
85
|
:host([cover]),
|
|
106
86
|
:host([cover]) > div,
|
|
107
87
|
:host([cover]) img {
|
|
@@ -136,9 +116,6 @@ __decorate([
|
|
|
136
116
|
__decorate([
|
|
137
117
|
property({ type: String })
|
|
138
118
|
], Image.prototype, "imageRendering", void 0);
|
|
139
|
-
__decorate([
|
|
140
|
-
property({ type: String, reflect: true })
|
|
141
|
-
], Image.prototype, "shadow", void 0);
|
|
142
119
|
__decorate([
|
|
143
120
|
property({ type: Boolean, reflect: true })
|
|
144
121
|
], Image.prototype, "cover", void 0);
|
|
@@ -14,6 +14,7 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.open = false;
|
|
16
16
|
this.toggle = "true";
|
|
17
|
+
this.inline = false;
|
|
17
18
|
/**
|
|
18
19
|
* Ombre
|
|
19
20
|
*/
|
|
@@ -196,6 +197,10 @@ Pop.styles = [
|
|
|
196
197
|
:host([shadow="lg"]) slot[name="content"] {
|
|
197
198
|
box-shadow: var(--sc-shadow-lg);
|
|
198
199
|
}
|
|
200
|
+
|
|
201
|
+
:host([inline]) {
|
|
202
|
+
vertical-align: baseline;
|
|
203
|
+
}
|
|
199
204
|
`,
|
|
200
205
|
];
|
|
201
206
|
__decorate([
|
|
@@ -210,6 +215,9 @@ __decorate([
|
|
|
210
215
|
__decorate([
|
|
211
216
|
property({ type: String })
|
|
212
217
|
], Pop.prototype, "toggle", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
property({ type: Boolean, reflect: true })
|
|
220
|
+
], Pop.prototype, "inline", void 0);
|
|
213
221
|
__decorate([
|
|
214
222
|
property({ type: String, reflect: true })
|
|
215
223
|
], Pop.prototype, "shadow", void 0);
|
|
@@ -3,6 +3,7 @@ export declare class Progress extends LitElement {
|
|
|
3
3
|
static styles: import("lit").CSSResult[];
|
|
4
4
|
value?: number;
|
|
5
5
|
max: number;
|
|
6
|
+
invert: boolean;
|
|
6
7
|
type: "default" | "primary" | "warning" | "danger" | "success" | "info";
|
|
7
8
|
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
8
9
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -7,11 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { html, LitElement, css } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
9
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
10
11
|
const tagName = "sonic-progress";
|
|
11
12
|
let Progress = class Progress extends LitElement {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments);
|
|
14
15
|
this.max = 100;
|
|
16
|
+
this.invert = false;
|
|
15
17
|
this.type = "default";
|
|
16
18
|
this.size = "md";
|
|
17
19
|
}
|
|
@@ -26,12 +28,13 @@ let Progress = class Progress extends LitElement {
|
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
Progress.styles = [
|
|
31
|
+
fontSize,
|
|
29
32
|
css `
|
|
30
33
|
:host {
|
|
31
34
|
--sc-progress-bg: var(--sc-input-bg, var(--sc-base-100, #f5f5f5));
|
|
32
35
|
--sc-progress-color: var(--sc-base-content, #1f2937);
|
|
33
|
-
--sc-progress-height: .
|
|
34
|
-
--sc-progress-fs: 1rem;
|
|
36
|
+
--sc-progress-height: .6em;
|
|
37
|
+
--sc-progress-fs: var(--sc-fs, 1rem);
|
|
35
38
|
--sc-progress-fw: 500;
|
|
36
39
|
--sc-progress-rounded: var(--sc-rounded-lg);
|
|
37
40
|
display: block;
|
|
@@ -103,25 +106,11 @@ Progress.styles = [
|
|
|
103
106
|
--sc-progress-color: var(--sc-success);
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
--sc-progress-height:.25rem;
|
|
109
|
-
--sc-progress-fs: 0.68rem;
|
|
109
|
+
:host([invert]) {
|
|
110
|
+
--sc-progress-bg: var(--sc-base-700);
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
--sc-progress-height:.4rem;
|
|
114
|
-
--sc-progress-fs: 0.85rem;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
:host([size="lg"]) {
|
|
118
|
-
--sc-progress-height:1rem;
|
|
119
|
-
--sc-progress-fs: 1.25rem;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
:host([size="xl"]) {
|
|
123
|
-
--sc-progress-height:1.5rem;
|
|
124
|
-
--sc-progress-fs: 1.5rem;
|
|
112
|
+
:host([type="default"][invert]) {
|
|
113
|
+
--sc-progress-color: var(--sc-base);
|
|
125
114
|
}
|
|
126
115
|
|
|
127
116
|
slot[name="remaining"] {
|
|
@@ -135,6 +124,7 @@ Progress.styles = [
|
|
|
135
124
|
display:flex;
|
|
136
125
|
justify-content: space-between;
|
|
137
126
|
gap:.5em;
|
|
127
|
+
margin-top:.15em;
|
|
138
128
|
}
|
|
139
129
|
`
|
|
140
130
|
];
|
|
@@ -144,6 +134,9 @@ __decorate([
|
|
|
144
134
|
__decorate([
|
|
145
135
|
property({ type: Number })
|
|
146
136
|
], Progress.prototype, "max", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
property({ type: Boolean })
|
|
139
|
+
], Progress.prototype, "invert", void 0);
|
|
147
140
|
__decorate([
|
|
148
141
|
property({ type: String, reflect: true })
|
|
149
142
|
], Progress.prototype, "type", void 0);
|
|
@@ -9,11 +9,12 @@ import { customElement, property } from "lit/decorators.js";
|
|
|
9
9
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
10
|
import { styleMap } from "lit/directives/style-map.js";
|
|
11
11
|
const tagName = "sonic-td";
|
|
12
|
-
import {
|
|
12
|
+
import { typeColor } from "@supersoniks/concorde/core/components/ui/_css/type";
|
|
13
13
|
let TableTd = class TableTd extends LitElement {
|
|
14
14
|
render() {
|
|
15
15
|
const styles = {
|
|
16
16
|
textAlign: this.align,
|
|
17
|
+
verticalAlign: this.vAlign,
|
|
17
18
|
minWidth: this.minWidth,
|
|
18
19
|
};
|
|
19
20
|
return html `<td
|
|
@@ -27,7 +28,7 @@ let TableTd = class TableTd extends LitElement {
|
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
30
|
TableTd.styles = [
|
|
30
|
-
|
|
31
|
+
typeColor,
|
|
31
32
|
css `
|
|
32
33
|
:host {
|
|
33
34
|
display: contents;
|
|
@@ -48,6 +49,9 @@ __decorate([
|
|
|
48
49
|
__decorate([
|
|
49
50
|
property({ type: String })
|
|
50
51
|
], TableTd.prototype, "align", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
property({ type: String })
|
|
54
|
+
], TableTd.prototype, "vAlign", void 0);
|
|
51
55
|
__decorate([
|
|
52
56
|
property({ type: String })
|
|
53
57
|
], TableTd.prototype, "minWidth", void 0);
|
|
@@ -8,7 +8,7 @@ import { html, LitElement, css } from "lit";
|
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
9
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
10
|
import { styleMap } from "lit/directives/style-map.js";
|
|
11
|
-
import {
|
|
11
|
+
import { typeColor } from "@supersoniks/concorde/core/components/ui/_css/type";
|
|
12
12
|
const tagName = "sonic-th";
|
|
13
13
|
let TableTh = class TableTh extends LitElement {
|
|
14
14
|
render() {
|
|
@@ -27,7 +27,7 @@ let TableTh = class TableTh extends LitElement {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
TableTh.styles = [
|
|
30
|
-
|
|
30
|
+
typeColor,
|
|
31
31
|
css `
|
|
32
32
|
:host {
|
|
33
33
|
display: contents;
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, LitElement, css } from "lit";
|
|
8
8
|
import { customElement } from "lit/decorators.js";
|
|
9
|
-
import {
|
|
9
|
+
import { typeColor } from "@supersoniks/concorde/core/components/ui/_css/type";
|
|
10
10
|
const tagName = "sonic-tr";
|
|
11
11
|
let TableTr = class TableTr extends LitElement {
|
|
12
12
|
render() {
|
|
@@ -14,11 +14,12 @@ let TableTr = class TableTr extends LitElement {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
TableTr.styles = [
|
|
17
|
-
|
|
17
|
+
typeColor,
|
|
18
18
|
css `
|
|
19
19
|
:host {
|
|
20
20
|
display: table-row;
|
|
21
21
|
}
|
|
22
|
+
|
|
22
23
|
`
|
|
23
24
|
];
|
|
24
25
|
TableTr = __decorate([
|
|
@@ -8,7 +8,7 @@ import "@supersoniks/concorde/core/components/ui/table/table-tfoot";
|
|
|
8
8
|
import "@supersoniks/concorde/core/components/ui/table/table-caption";
|
|
9
9
|
export declare class Table extends LitElement {
|
|
10
10
|
static styles: import("lit").CSSResult[];
|
|
11
|
-
size
|
|
11
|
+
size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
12
12
|
striped: boolean;
|
|
13
13
|
sticky: boolean;
|
|
14
14
|
bordered: boolean;
|
|
@@ -15,11 +15,11 @@ import "@supersoniks/concorde/core/components/ui/table/table-thead";
|
|
|
15
15
|
import "@supersoniks/concorde/core/components/ui/table/table-tbody";
|
|
16
16
|
import "@supersoniks/concorde/core/components/ui/table/table-tfoot";
|
|
17
17
|
import "@supersoniks/concorde/core/components/ui/table/table-caption";
|
|
18
|
+
import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
18
19
|
const tagName = "sonic-table";
|
|
19
20
|
let Table = class Table extends LitElement {
|
|
20
21
|
constructor() {
|
|
21
22
|
super(...arguments);
|
|
22
|
-
this.size = "md";
|
|
23
23
|
this.striped = false;
|
|
24
24
|
this.sticky = false;
|
|
25
25
|
this.bordered = false;
|
|
@@ -41,6 +41,7 @@ let Table = class Table extends LitElement {
|
|
|
41
41
|
};
|
|
42
42
|
Table.styles = [
|
|
43
43
|
customScroll,
|
|
44
|
+
fontSize,
|
|
44
45
|
css `
|
|
45
46
|
:host {
|
|
46
47
|
--sc-table-fw: var(--sc-font-weight-base);
|
|
@@ -56,38 +57,20 @@ Table.styles = [
|
|
|
56
57
|
--sc-table-th-py: calc(1.8 * var(--sc-table-td-py) );
|
|
57
58
|
--sc-table-td-px: .5em;
|
|
58
59
|
--sc-table-td-py: .5em;
|
|
59
|
-
|
|
60
60
|
display:block;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.table-container {
|
|
63
|
+
:host([maxHeight]) .table-container {
|
|
64
64
|
overflow-x: auto;
|
|
65
65
|
-webkit-overflow-scrolling: touch;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
.table {
|
|
69
69
|
width: 100%;
|
|
70
|
-
font-size: var(--sc-table-fs);
|
|
71
70
|
display: table;
|
|
72
71
|
box-sizing:border-box;
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
/*SIZES*/
|
|
76
|
-
:host([size="2xs"]) {
|
|
77
|
-
--sc-table-fs: 0.6rem;
|
|
78
|
-
}
|
|
79
|
-
:host([size="xs"]) {
|
|
80
|
-
--sc-table-fs: 0.75rem;
|
|
81
|
-
}
|
|
82
|
-
:host([size="sm"]) {
|
|
83
|
-
--sc-table-fs: 0.85rem;
|
|
84
|
-
}
|
|
85
|
-
:host([size="lg"]) {
|
|
86
|
-
--sc-table-fs: 1.2rem;
|
|
87
|
-
}
|
|
88
|
-
:host([size="xl"]) {
|
|
89
|
-
--sc-table-fs: 1.5rem;
|
|
90
|
-
}
|
|
91
74
|
:host([bordered]) .table-container {
|
|
92
75
|
border:var(--sc-border-width) solid var(--sc-table-border-color) !important;
|
|
93
76
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -20,35 +20,46 @@ export const coreVariables = css `
|
|
|
20
20
|
|
|
21
21
|
/* ROUNDED*/
|
|
22
22
|
--sc-rounded-sm: calc(var(--sc-rounded) * 0.5);
|
|
23
|
-
--sc-rounded: 0.
|
|
23
|
+
--sc-rounded: 0.375rem;
|
|
24
24
|
--sc-rounded-md: calc(var(--sc-rounded) * 1.8);
|
|
25
25
|
--sc-rounded-lg: calc(var(--sc-rounded) * 3.5);
|
|
26
26
|
--sc-rounded-xl: calc(var(--sc-rounded) * 7);
|
|
27
|
+
--sc-rounded-size-intensity: calc((1em - 1rem) * .4);
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
/* 4 for rounded full*/
|
|
30
|
+
--sc-btn-rounded-intensity : 1.4;
|
|
31
|
+
--sc-btn-font-weight: 500;
|
|
32
|
+
--sc-btn-rounded: calc((var(--sc-rounded) + var(--sc-rounded-size-intensity)) * var(--sc-btn-rounded-intensity) );
|
|
29
33
|
|
|
30
34
|
/* Placeholder */
|
|
31
35
|
--sc-placeholder-bg: rgba(17, 24, 39, 0.05);
|
|
32
36
|
|
|
33
|
-
/*
|
|
37
|
+
/* OMBRES */
|
|
34
38
|
--sc-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
35
39
|
--sc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
36
40
|
--sc-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
37
41
|
--sc-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
38
42
|
--sc-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
|
|
39
43
|
|
|
40
|
-
/*
|
|
41
|
-
--sc-border-width: max(1px, 0.
|
|
44
|
+
/* Forms */
|
|
45
|
+
--sc-border-width: max(1px, 0.12rem);
|
|
46
|
+
--sc-form-height : 2.5em;
|
|
42
47
|
--sc-form-border-width: var(--sc-border-width);
|
|
43
48
|
--sc-input-bg: var(--sc-base-100);
|
|
44
49
|
--sc-input-border-color: var(--sc-input-bg);
|
|
45
|
-
--sc-input-rounded
|
|
50
|
+
--sc-input-rounded-intensity : 1.4;
|
|
51
|
+
--sc-input-rounded: calc((var(--sc-rounded) + var(--sc-rounded-size-intensity)) * var(--sc-input-rounded-intensity) );
|
|
52
|
+
--sc-label-font-weight: 500;
|
|
46
53
|
|
|
47
|
-
/*
|
|
54
|
+
/* Contrast -- ex : Text on images */
|
|
48
55
|
--sc-contrast-content: #fff;
|
|
49
|
-
--sc-contrast: #
|
|
56
|
+
--sc-contrast: #11151f;
|
|
50
57
|
|
|
51
58
|
/*Scrollbar*/
|
|
52
59
|
--sc-scrollbar-bg : var(--sc-base-400);
|
|
60
|
+
|
|
61
|
+
/*Body*/
|
|
62
|
+
--sc-body-bg: var(--sc-base);
|
|
63
|
+
|
|
53
64
|
}
|
|
54
65
|
`;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
export declare class Theme extends LitElement {
|
|
3
3
|
static styles: import("lit").CSSResult[];
|
|
4
|
+
theme: string;
|
|
5
|
+
background: boolean;
|
|
6
|
+
color: boolean;
|
|
7
|
+
font: boolean;
|
|
8
|
+
contrastDarkMode: boolean;
|
|
4
9
|
connectedCallback(): void;
|
|
10
|
+
updated(): void;
|
|
5
11
|
postCSSVars(): void;
|
|
6
12
|
receiveMessage(event: any): void;
|
|
7
|
-
theme: string;
|
|
8
13
|
getCssVariables(): Record<string, string>;
|
|
14
|
+
contrast(color: string, percent: number): string;
|
|
15
|
+
contrastBg(): void;
|
|
9
16
|
render(): import("lit-html").TemplateResult<1>;
|
|
10
17
|
}
|
|
@@ -15,12 +15,19 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
17
|
this.theme = "light";
|
|
18
|
+
this.background = false;
|
|
19
|
+
this.color = false;
|
|
20
|
+
this.font = false;
|
|
21
|
+
this.contrastDarkMode = false;
|
|
18
22
|
}
|
|
19
23
|
connectedCallback() {
|
|
20
24
|
super.connectedCallback();
|
|
21
25
|
window.addEventListener("message", (e) => this.receiveMessage(e), false);
|
|
22
26
|
this.postCSSVars();
|
|
23
27
|
}
|
|
28
|
+
updated() {
|
|
29
|
+
this.contrastBg();
|
|
30
|
+
}
|
|
24
31
|
postCSSVars() {
|
|
25
32
|
const stylesheets = document.styleSheets;
|
|
26
33
|
const ssLength = stylesheets.length;
|
|
@@ -68,6 +75,24 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
68
75
|
names.forEach((name) => (result[name] = style.getPropertyValue(name)));
|
|
69
76
|
return result;
|
|
70
77
|
}
|
|
78
|
+
// function to darken a color based on an hexa value
|
|
79
|
+
contrast(color, percent) {
|
|
80
|
+
let num = parseInt(color.replace("#", ""), 16), amt = Math.round(2.55 * percent), R = (num >> 16) + amt, B = ((num >> 8) & 0x00ff) + amt, G = (num & 0x0000ff) + amt;
|
|
81
|
+
return ("#" +
|
|
82
|
+
(0x1000000 +
|
|
83
|
+
(R < 255 ? (R < 1 ? 0 : R) : 255) * 0x10000 +
|
|
84
|
+
(B < 255 ? (B < 1 ? 0 : B) : 255) * 0x100 +
|
|
85
|
+
(G < 255 ? (G < 1 ? 0 : G) : 255))
|
|
86
|
+
.toString(16)
|
|
87
|
+
.slice(1));
|
|
88
|
+
}
|
|
89
|
+
// get de computed value of --sc-base and darken it
|
|
90
|
+
contrastBg() {
|
|
91
|
+
if (this.theme === "dark" && this.contrastDarkMode && this.background) {
|
|
92
|
+
let baseColor = window.getComputedStyle(this).getPropertyValue("--sc-base");
|
|
93
|
+
this.style.setProperty("--sc-body-bg", this.contrast(baseColor, -2.5));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
71
96
|
render() {
|
|
72
97
|
return html `<slot></slot>`;
|
|
73
98
|
}
|
|
@@ -79,7 +104,11 @@ Theme.styles = [
|
|
|
79
104
|
css `
|
|
80
105
|
:host([background]) {
|
|
81
106
|
display: block !important;
|
|
82
|
-
background: var(--sc-
|
|
107
|
+
background: var(--sc-body-bg) !important;
|
|
108
|
+
min-height: 100vh;
|
|
109
|
+
}
|
|
110
|
+
:host([contrastDarkMode]) {
|
|
111
|
+
transition: background-color 2.5s ease;
|
|
83
112
|
}
|
|
84
113
|
|
|
85
114
|
:host([color]) {
|
|
@@ -96,6 +125,18 @@ Theme.styles = [
|
|
|
96
125
|
__decorate([
|
|
97
126
|
property({ type: String, reflect: true })
|
|
98
127
|
], Theme.prototype, "theme", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: Boolean, reflect: true })
|
|
130
|
+
], Theme.prototype, "background", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
property({ type: Boolean, reflect: true })
|
|
133
|
+
], Theme.prototype, "color", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
property({ type: Boolean, reflect: true })
|
|
136
|
+
], Theme.prototype, "font", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
property({ type: Boolean, reflect: true })
|
|
139
|
+
], Theme.prototype, "contrastDarkMode", void 0);
|
|
99
140
|
Theme = Theme_1 = __decorate([
|
|
100
141
|
customElement(tagName)
|
|
101
142
|
], Theme);
|
|
@@ -4,10 +4,12 @@ import { ToastStatus } from "@supersoniks/concorde/core/components/ui/toast/type
|
|
|
4
4
|
export declare class SonicToastItem extends LitElement {
|
|
5
5
|
static styles: import("lit").CSSResult[];
|
|
6
6
|
title: string;
|
|
7
|
+
id: string;
|
|
7
8
|
text: string;
|
|
8
9
|
status: ToastStatus;
|
|
9
10
|
ghost: boolean;
|
|
10
11
|
preserve: boolean;
|
|
12
|
+
dismissForever: boolean;
|
|
11
13
|
maxHeight: string;
|
|
12
14
|
visible: boolean;
|
|
13
15
|
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
@@ -20,14 +20,24 @@ let SonicToastItem = class SonicToastItem extends LitElement {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
super(...arguments);
|
|
22
22
|
this.title = "";
|
|
23
|
+
this.id = "";
|
|
23
24
|
this.text = "";
|
|
24
25
|
this.status = "";
|
|
25
26
|
this.ghost = false;
|
|
26
27
|
this.preserve = false;
|
|
28
|
+
this.dismissForever = false;
|
|
27
29
|
this.maxHeight = '10rem';
|
|
28
30
|
this.visible = true;
|
|
29
31
|
}
|
|
30
32
|
render() {
|
|
33
|
+
// check if the toast is dismissed
|
|
34
|
+
if (this.dismissForever) {
|
|
35
|
+
const dismissed = localStorage.getItem('sonic-toast-dismissed') || '{}';
|
|
36
|
+
const dismissedObj = JSON.parse(dismissed);
|
|
37
|
+
if (dismissedObj[this.id]) {
|
|
38
|
+
return nothing;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
31
41
|
if (!this.visible) {
|
|
32
42
|
return nothing;
|
|
33
43
|
}
|
|
@@ -58,6 +68,13 @@ let SonicToastItem = class SonicToastItem extends LitElement {
|
|
|
58
68
|
if (!this.closest('sonic-toast')) {
|
|
59
69
|
this.visible = false;
|
|
60
70
|
}
|
|
71
|
+
if (this.dismissForever) {
|
|
72
|
+
// set in local Storage an Object with the id as key and if it's dismissed as value
|
|
73
|
+
const dismissed = localStorage.getItem('sonic-toast-dismissed') || '{}';
|
|
74
|
+
const dismissedObj = JSON.parse(dismissed);
|
|
75
|
+
dismissedObj[this.id] = true;
|
|
76
|
+
localStorage.setItem('sonic-toast-dismissed', JSON.stringify(dismissedObj));
|
|
77
|
+
}
|
|
61
78
|
this.dispatchEvent(new CustomEvent("hide", { bubbles: true }));
|
|
62
79
|
}
|
|
63
80
|
show() {
|
|
@@ -107,7 +124,7 @@ SonicToastItem.styles = [
|
|
|
107
124
|
}
|
|
108
125
|
|
|
109
126
|
.sonic-toast-content {
|
|
110
|
-
padding: 1em
|
|
127
|
+
padding: 1em 2.5rem 1em 1em;
|
|
111
128
|
display: flex;
|
|
112
129
|
gap: 0.5rem;
|
|
113
130
|
overflow: auto;
|
|
@@ -239,6 +256,9 @@ SonicToastItem.styles = [
|
|
|
239
256
|
__decorate([
|
|
240
257
|
property({ type: String })
|
|
241
258
|
], SonicToastItem.prototype, "title", void 0);
|
|
259
|
+
__decorate([
|
|
260
|
+
property({ type: String })
|
|
261
|
+
], SonicToastItem.prototype, "id", void 0);
|
|
242
262
|
__decorate([
|
|
243
263
|
property({ type: String })
|
|
244
264
|
], SonicToastItem.prototype, "text", void 0);
|
|
@@ -251,6 +271,9 @@ __decorate([
|
|
|
251
271
|
__decorate([
|
|
252
272
|
property({ type: Boolean })
|
|
253
273
|
], SonicToastItem.prototype, "preserve", void 0);
|
|
274
|
+
__decorate([
|
|
275
|
+
property({ type: Boolean })
|
|
276
|
+
], SonicToastItem.prototype, "dismissForever", void 0);
|
|
254
277
|
__decorate([
|
|
255
278
|
property({ type: String })
|
|
256
279
|
], SonicToastItem.prototype, "maxHeight", void 0);
|
|
@@ -14,6 +14,7 @@ export declare class SonicToast extends LitElement {
|
|
|
14
14
|
status: import("@supersoniks/concorde/core/components/ui/toast/types").ToastStatus | undefined;
|
|
15
15
|
preserve: boolean | undefined;
|
|
16
16
|
ghost: boolean | undefined;
|
|
17
|
+
dismissForever: boolean | undefined;
|
|
17
18
|
} | null;
|
|
18
19
|
removeItem(item: Toast): void;
|
|
19
20
|
}
|
|
@@ -38,7 +38,11 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
38
38
|
return nothing;
|
|
39
39
|
return html `<div aria-live="polite" style=${styleMap(styles)}>
|
|
40
40
|
${repeat(this.toasts, (item) => item.id, (item) => html `
|
|
41
|
-
<sonic-toast-item maxHeight=${isIframe ? 'none' : '10rem'}
|
|
41
|
+
<sonic-toast-item maxHeight=${isIframe ? 'none' : '10rem'}
|
|
42
|
+
status=${item.status}
|
|
43
|
+
?ghost=${item.ghost}
|
|
44
|
+
?dismissForever=${item.dismissForever}
|
|
45
|
+
?preserve=${item.preserve} id=${item.id}
|
|
42
46
|
@hide=${() => this.removeItem(item)}
|
|
43
47
|
${animate({
|
|
44
48
|
keyframeOptions: {
|
|
@@ -70,6 +74,7 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
70
74
|
}
|
|
71
75
|
// ADD TOAST
|
|
72
76
|
static add(conf) {
|
|
77
|
+
var _a;
|
|
73
78
|
// Init toast area si absente (au <sonic-theme> ou <body< à défaut)
|
|
74
79
|
if (!document.querySelector("sonic-toast")) {
|
|
75
80
|
let toastComponent = document.createElement("sonic-toast");
|
|
@@ -78,7 +83,7 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
78
83
|
}
|
|
79
84
|
// Ajoute le toast à la liste
|
|
80
85
|
let toastComponent = document.querySelector("sonic-toast");
|
|
81
|
-
const nextId = new Date().valueOf();
|
|
86
|
+
const nextId = (_a = conf.id) !== null && _a !== void 0 ? _a : new Date().valueOf();
|
|
82
87
|
const interactiveRegExp = new RegExp("</a>|</button>");
|
|
83
88
|
const hasInteractive = interactiveRegExp.test(conf.text);
|
|
84
89
|
const currentToast = {
|
|
@@ -88,7 +93,16 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
88
93
|
status: conf.status,
|
|
89
94
|
preserve: hasInteractive ? true : conf.preserve,
|
|
90
95
|
ghost: conf.ghost,
|
|
96
|
+
dismissForever: conf.dismissForever,
|
|
91
97
|
};
|
|
98
|
+
// check if the toast is dismissed
|
|
99
|
+
if (conf.dismissForever && conf.id) {
|
|
100
|
+
const dismissed = localStorage.getItem('sonic-toast-dismissed') || '{}';
|
|
101
|
+
const dismissedObj = JSON.parse(dismissed);
|
|
102
|
+
if (dismissedObj[conf.id]) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
92
106
|
if (toastComponent.toasts.length > 0) {
|
|
93
107
|
let toastA = Object.assign({}, currentToast);
|
|
94
108
|
let toastB = Object.assign({}, toastComponent.toasts[toastComponent.toasts.length - 1]);
|
|
@@ -42,10 +42,11 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
42
42
|
initPublisher(): void;
|
|
43
43
|
getFormPublisher(): any;
|
|
44
44
|
updateDataValue(): void;
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
handleBlur(e?: any): void;
|
|
46
|
+
error: boolean;
|
|
47
|
+
autofocus: boolean;
|
|
48
|
+
required: boolean;
|
|
47
49
|
disabled: true | null;
|
|
48
|
-
required: true | null;
|
|
49
50
|
formDataProvider: string;
|
|
50
51
|
props: any;
|
|
51
52
|
isConnected: boolean;
|
|
@@ -98,9 +98,12 @@ const Form = (superClass) => {
|
|
|
98
98
|
getValueForFormPublisher() {
|
|
99
99
|
let publisher = this.getFormPublisher();
|
|
100
100
|
let currentValue = publisher[this.name].get();
|
|
101
|
-
if (this.
|
|
101
|
+
if (this.radio) {
|
|
102
102
|
return this.checked && this.value != null ? this.value : currentValue;
|
|
103
103
|
}
|
|
104
|
+
if (this.unique) {
|
|
105
|
+
return this.checked && this.value != null ? this.value : null;
|
|
106
|
+
}
|
|
104
107
|
if (!Array.isArray(currentValue)) {
|
|
105
108
|
currentValue = [];
|
|
106
109
|
}
|
|
@@ -4,11 +4,12 @@ export interface FormElementInterface extends SubscriberInterface {
|
|
|
4
4
|
getFormPublisher(): any;
|
|
5
5
|
updateDataValue(): void;
|
|
6
6
|
handleChange(e?: any): void;
|
|
7
|
+
handleBlur(e?: any): void;
|
|
7
8
|
getValueForFormPublisher(): any;
|
|
8
|
-
error:
|
|
9
|
-
autofocus:
|
|
9
|
+
error: boolean;
|
|
10
|
+
autofocus: boolean;
|
|
11
|
+
required: boolean;
|
|
10
12
|
disabled: true | null;
|
|
11
|
-
required: true | null;
|
|
12
13
|
formDataProvider: string;
|
|
13
14
|
_value: any;
|
|
14
15
|
get value(): any;
|