@supersoniks/concorde 1.1.42 → 1.1.44
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/components.js +2 -3
- package/concorde-core.bundle.js +37 -35
- package/concorde-core.es.js +5283 -4453
- package/core/_types/types.d.ts +31 -0
- package/core/_types/types.js +2 -0
- package/core/components/functional/date/date.d.ts +13 -5
- package/core/components/functional/date/date.js +57 -38
- package/core/components/functional/example/example.d.ts +1 -1
- package/core/components/functional/example/example.js +1 -1
- package/core/components/functional/fetch/fetch.d.ts +45 -6
- package/core/components/functional/fetch/fetch.js +2 -6
- package/core/components/functional/functional.d.ts +2 -0
- package/core/components/functional/functional.js +2 -0
- package/core/components/functional/if/if.d.ts +3 -0
- package/core/components/functional/if/if.js +6 -12
- package/core/components/functional/if/if.test.d.ts +1 -0
- package/core/components/functional/if/if.test.js +44 -0
- package/core/components/functional/list/list.d.ts +44 -12
- package/core/components/functional/list/list.js +54 -49
- package/core/components/functional/mix/mix.d.ts +22 -0
- package/core/components/functional/mix/mix.js +102 -0
- package/core/components/functional/queue/queue.d.ts +27 -5
- package/core/components/functional/queue/queue.js +88 -26
- package/core/components/functional/router/redirect.d.ts +11 -2
- package/core/components/functional/router/redirect.js +7 -12
- package/core/components/functional/router/router.d.ts +15 -1
- package/core/components/functional/router/router.js +11 -16
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +1 -2
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +56 -45
- package/core/components/functional/sdui/default-library.json +108 -0
- package/core/components/functional/sdui/sdui-utils.d.ts +5 -0
- package/core/components/functional/sdui/sdui-utils.js +63 -0
- package/core/components/functional/sdui/sdui.d.ts +21 -13
- package/core/components/functional/sdui/sdui.js +70 -44
- package/core/components/functional/sdui/types.d.ts +10 -8
- package/core/components/functional/states/states.d.ts +20 -4
- package/core/components/functional/states/states.js +15 -20
- package/core/components/functional/submit/submit.d.ts +16 -1
- package/core/components/functional/submit/submit.js +95 -25
- package/core/components/functional/subscriber/subscriber.d.ts +4 -1
- package/core/components/functional/subscriber/subscriber.js +1 -6
- package/core/components/functional/value/value.d.ts +7 -0
- package/core/components/functional/value/value.js +26 -0
- package/core/components/ui/_css/scroll.js +6 -7
- package/core/components/ui/_css/size.d.ts +1 -0
- package/core/components/ui/_css/size.js +3 -1
- package/core/components/ui/alert/alert.d.ts +2 -2
- package/core/components/ui/alert/alert.js +11 -16
- package/core/components/ui/badge/badge.d.ts +3 -1
- package/core/components/ui/badge/badge.js +36 -22
- package/core/components/ui/button/button.d.ts +28 -23
- package/core/components/ui/button/button.js +60 -43
- package/core/components/ui/captcha/captcha.d.ts +14 -2
- package/core/components/ui/captcha/captcha.js +18 -13
- package/core/components/ui/card/card-footer.js +1 -8
- package/core/components/ui/card/card-header-descripton.js +3 -9
- package/core/components/ui/card/card-header.js +6 -7
- package/core/components/ui/card/card-main.js +0 -5
- package/core/components/ui/card/card.d.ts +1 -1
- package/core/components/ui/card/card.js +30 -12
- package/core/components/ui/divider/divider.d.ts +2 -0
- package/core/components/ui/divider/divider.js +43 -16
- package/core/components/ui/form/checkbox/checkbox.d.ts +86 -25
- package/core/components/ui/form/checkbox/checkbox.js +53 -28
- package/core/components/ui/form/css/form-control.d.ts +2 -0
- package/core/components/ui/form/css/form-control.js +145 -67
- package/core/components/ui/form/fieldset/fieldset.d.ts +8 -1
- package/core/components/ui/form/fieldset/fieldset.js +45 -8
- package/core/components/ui/form/fieldset/legend-description.js +0 -5
- package/core/components/ui/form/fieldset/legend.js +3 -6
- package/core/components/ui/form/form-actions/form-actions.d.ts +2 -0
- package/core/components/ui/form/form-actions/form-actions.js +26 -11
- package/core/components/ui/form/form-layout/form-layout.d.ts +5 -2
- package/core/components/ui/form/form-layout/form-layout.js +31 -9
- package/core/components/ui/form/input/input.d.ts +26 -24
- package/core/components/ui/form/input/input.js +87 -52
- package/core/components/ui/form/input/password-helper.d.ts +1 -1
- package/core/components/ui/form/input/password-helper.js +4 -3
- package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
- package/core/components/ui/form/input/same-value-helper.js +3 -2
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +2 -3
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +2 -6
- package/core/components/ui/form/radio/radio.d.ts +6 -0
- package/core/components/ui/form/radio/radio.js +7 -12
- package/core/components/ui/form/select/select.d.ts +25 -8
- package/core/components/ui/form/select/select.js +72 -41
- package/core/components/ui/form/textarea/textarea.d.ts +21 -19
- package/core/components/ui/form/textarea/textarea.js +29 -36
- package/core/components/ui/group/group.d.ts +11 -1
- package/core/components/ui/group/group.js +79 -17
- package/core/components/ui/icon/icon.d.ts +10 -3
- package/core/components/ui/icon/icon.js +16 -15
- package/core/components/ui/icon/icons.js +25 -20
- package/core/components/ui/icon/icons.json +1 -1
- package/core/components/ui/image/image.js +0 -5
- package/core/components/ui/link/link.d.ts +1 -1
- package/core/components/ui/link/link.js +2 -6
- package/core/components/ui/loader/loader.d.ts +1 -1
- package/core/components/ui/loader/loader.js +3 -9
- package/core/components/ui/menu/menu-item.js +4 -9
- package/core/components/ui/menu/menu.d.ts +9 -1
- package/core/components/ui/menu/menu.js +182 -27
- package/core/components/ui/modal/modal-actions.js +1 -6
- package/core/components/ui/modal/modal-close.d.ts +1 -0
- package/core/components/ui/modal/modal-close.js +14 -10
- package/core/components/ui/modal/modal-content.js +0 -5
- package/core/components/ui/modal/modal-subtitle.js +2 -6
- package/core/components/ui/modal/modal-title.js +0 -5
- package/core/components/ui/modal/modal.d.ts +7 -7
- package/core/components/ui/modal/modal.js +37 -37
- package/core/components/ui/pop/pop.d.ts +6 -5
- package/core/components/ui/pop/pop.js +57 -57
- package/core/components/ui/progress/progress.js +34 -32
- package/core/components/ui/table/table-caption.js +5 -10
- package/core/components/ui/table/table-tbody.js +10 -14
- package/core/components/ui/table/table-td.d.ts +2 -0
- package/core/components/ui/table/table-td.js +8 -5
- package/core/components/ui/table/table-tfoot.js +5 -7
- package/core/components/ui/table/table-th.d.ts +2 -0
- package/core/components/ui/table/table-th.js +12 -9
- package/core/components/ui/table/table-thead.js +1 -6
- package/core/components/ui/table/table-tr.js +4 -6
- package/core/components/ui/table/table.d.ts +0 -3
- package/core/components/ui/table/table.js +14 -31
- package/core/components/ui/theme/theme-collection/core-variables.js +13 -11
- package/core/components/ui/theme/theme-collection/dark.js +1 -1
- package/core/components/ui/theme/theme.d.ts +1 -6
- package/core/components/ui/theme/theme.js +19 -46
- package/core/components/ui/toast/message-subscriber.d.ts +16 -7
- package/core/components/ui/toast/message-subscriber.js +10 -8
- package/core/components/ui/toast/toast-item.js +1 -1
- package/core/components/ui/toast/toast.d.ts +3 -2
- package/core/components/ui/toast/toast.js +33 -19
- package/core/components/ui/toast/types.d.ts +3 -2
- package/core/components/ui/tooltip/tooltip.d.ts +1 -0
- package/core/components/ui/tooltip/tooltip.js +36 -15
- package/core/components/ui/ui.d.ts +1 -1
- package/core/components/ui/ui.js +1 -4
- package/core/core.js +5 -6
- package/core/mixins/Fetcher.d.ts +20 -13
- package/core/mixins/Fetcher.js +44 -19
- package/core/mixins/FormCheckable.d.ts +25 -13
- package/core/mixins/FormCheckable.js +180 -23
- package/core/mixins/FormElement.d.ts +17 -9
- package/core/mixins/FormElement.js +56 -39
- package/core/mixins/FormInput.d.ts +22 -12
- package/core/mixins/FormInput.js +4 -3
- package/core/mixins/Subscriber.d.ts +12 -8
- package/core/mixins/Subscriber.js +51 -48
- package/core/mixins/TemplatesContainer.d.ts +2 -1
- package/core/mixins/TemplatesContainer.js +2 -2
- package/core/utils/Arrays.d.ts +15 -15
- package/core/utils/Arrays.js +12 -9
- package/core/utils/DataBindObserver.d.ts +18 -11
- package/core/utils/DataBindObserver.js +47 -54
- package/core/utils/Electron.d.ts +5 -1
- package/core/utils/Electron.js +4 -2
- package/core/utils/HTML.d.ts +9 -2
- package/core/utils/HTML.js +24 -5
- package/core/utils/LocationHandler.d.ts +6 -5
- package/core/utils/LocationHandler.js +27 -16
- package/core/utils/Objects.d.ts +7 -4
- package/core/utils/Objects.js +37 -9
- package/core/utils/{PublisherProxy.d.mts → PublisherProxy.d.ts} +49 -34
- package/core/utils/{PublisherProxy.mjs → PublisherProxy.js} +107 -77
- package/core/utils/Utils.d.ts +3 -0
- package/core/utils/Utils.js +18 -0
- package/core/utils/api.d.ts +26 -9
- package/core/utils/api.js +62 -45
- package/img/concorde-logo.svg +1 -0
- package/img/concorde.png +0 -0
- package/img/concorde_def.png +0 -0
- package/mixins.d.ts +53 -29
- package/mixins.js +3 -4
- package/package.json +51 -12
- package/svg/regular/plane.svg +1 -0
- package/svg/solid/plane.svg +1 -0
- package/test-utils/TestUtils.d.ts +4 -0
- package/test-utils/TestUtils.js +12 -0
- package/utils.d.ts +3 -1
- package/utils.js +7 -5
- package/core/components/functional/configuration/configuration.d.ts +0 -5
- package/core/components/functional/configuration/configuration.js +0 -22
- package/core/components/ui/tabs/tab.d.ts +0 -6
- package/core/components/ui/tabs/tab.js +0 -46
- package/core/components/ui/tabs/tabs.d.ts +0 -15
- package/core/components/ui/tabs/tabs.js +0 -129
- package/core/components/ui/taxonomy/taxonomy.d.ts +0 -41
- package/core/components/ui/taxonomy/taxonomy.js +0 -115
|
@@ -5,15 +5,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var Theme_1;
|
|
8
|
-
import { html, LitElement, css
|
|
8
|
+
import { html, LitElement, css } from "lit";
|
|
9
9
|
import { customElement, property } from "lit/decorators.js";
|
|
10
10
|
import { coreVariables } from "@supersoniks/concorde/core/components/ui/theme/theme-collection/core-variables";
|
|
11
11
|
import { light } from "@supersoniks/concorde/core/components/ui/theme/theme-collection/light";
|
|
12
12
|
import { dark } from "@supersoniks/concorde/core/components/ui/theme/theme-collection/dark";
|
|
13
|
-
import tailwindImport from "./css/tailwind.css?inline";
|
|
14
|
-
export const tailwind = css `
|
|
15
|
-
${unsafeCSS(tailwindImport)}
|
|
16
|
-
`;
|
|
17
13
|
const tagName = "sonic-theme";
|
|
18
14
|
let Theme = Theme_1 = class Theme extends LitElement {
|
|
19
15
|
constructor() {
|
|
@@ -22,22 +18,18 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
22
18
|
this.background = false;
|
|
23
19
|
this.color = false;
|
|
24
20
|
this.font = false;
|
|
25
|
-
this.contrastDarkMode = false;
|
|
26
21
|
}
|
|
27
22
|
connectedCallback() {
|
|
28
23
|
super.connectedCallback();
|
|
29
24
|
window.addEventListener("message", (e) => this.receiveMessage(e), false);
|
|
30
25
|
this.postCSSVars();
|
|
31
26
|
}
|
|
32
|
-
updated() {
|
|
33
|
-
this.contrastBg();
|
|
34
|
-
}
|
|
35
27
|
postCSSVars() {
|
|
36
28
|
const stylesheets = document.styleSheets;
|
|
37
29
|
const ssLength = stylesheets.length;
|
|
38
|
-
|
|
30
|
+
const fontUrls = [];
|
|
39
31
|
for (let i = 0; i < ssLength; i++) {
|
|
40
|
-
|
|
32
|
+
const ss = stylesheets[i];
|
|
41
33
|
if (ss.href && (ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
|
|
42
34
|
fontUrls.push(ss.href);
|
|
43
35
|
}
|
|
@@ -51,52 +43,39 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
51
43
|
});
|
|
52
44
|
}
|
|
53
45
|
receiveMessage(event) {
|
|
54
|
-
|
|
46
|
+
const data = event.data;
|
|
55
47
|
if (!data.type || data.type != "GetSonicTheme")
|
|
56
48
|
return;
|
|
57
49
|
this.postCSSVars();
|
|
58
50
|
}
|
|
59
51
|
getCssVariables() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
for (
|
|
52
|
+
const names = [];
|
|
53
|
+
const stylesheets = [...Theme_1.styles.map((s) => s.styleSheet), ...Array.from(document.styleSheets)];
|
|
54
|
+
for (const stylesheet of stylesheets) {
|
|
63
55
|
try {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
if (!stylesheet)
|
|
57
|
+
continue;
|
|
58
|
+
const rules = stylesheet.cssRules;
|
|
59
|
+
for (const rule of rules) {
|
|
60
|
+
if (!("style" in rule))
|
|
67
61
|
continue;
|
|
68
|
-
|
|
62
|
+
const style = rule.style;
|
|
63
|
+
for (const name of style) {
|
|
69
64
|
if (names.includes(name) || name.indexOf("--sc") !== 0)
|
|
70
65
|
continue;
|
|
71
66
|
names.push(name);
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
}
|
|
75
|
-
catch (e) {
|
|
70
|
+
catch (e) {
|
|
71
|
+
console.log("Erreur lors de la récupération des variables CSS");
|
|
72
|
+
}
|
|
76
73
|
}
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
const style = window.getComputedStyle(this);
|
|
75
|
+
const result = {};
|
|
79
76
|
names.forEach((name) => (result[name] = style.getPropertyValue(name)));
|
|
80
77
|
return result;
|
|
81
78
|
}
|
|
82
|
-
// function to darken a color based on an hexa value
|
|
83
|
-
contrast(color, percent) {
|
|
84
|
-
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;
|
|
85
|
-
return ("#" +
|
|
86
|
-
(0x1000000 +
|
|
87
|
-
(R < 255 ? (R < 1 ? 0 : R) : 255) * 0x10000 +
|
|
88
|
-
(B < 255 ? (B < 1 ? 0 : B) : 255) * 0x100 +
|
|
89
|
-
(G < 255 ? (G < 1 ? 0 : G) : 255))
|
|
90
|
-
.toString(16)
|
|
91
|
-
.slice(1));
|
|
92
|
-
}
|
|
93
|
-
// get de computed value of --sc-base and darken it
|
|
94
|
-
contrastBg() {
|
|
95
|
-
if (this.theme === "dark" && this.contrastDarkMode && this.background) {
|
|
96
|
-
let baseColor = window.getComputedStyle(this).getPropertyValue("--sc-base");
|
|
97
|
-
this.style.setProperty("--sc-body-bg", this.contrast(baseColor, -2.5));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
79
|
render() {
|
|
101
80
|
return html `<slot></slot>`;
|
|
102
81
|
}
|
|
@@ -111,9 +90,6 @@ Theme.styles = [
|
|
|
111
90
|
background: var(--sc-body-bg) !important;
|
|
112
91
|
min-height: 100vh;
|
|
113
92
|
}
|
|
114
|
-
:host([contrastDarkMode]) {
|
|
115
|
-
transition: background-color 2.5s ease;
|
|
116
|
-
}
|
|
117
93
|
|
|
118
94
|
:host([color]) {
|
|
119
95
|
color: var(--sc-base-content);
|
|
@@ -138,9 +114,6 @@ __decorate([
|
|
|
138
114
|
__decorate([
|
|
139
115
|
property({ type: Boolean, reflect: true })
|
|
140
116
|
], Theme.prototype, "font", void 0);
|
|
141
|
-
__decorate([
|
|
142
|
-
property({ type: Boolean, reflect: true })
|
|
143
|
-
], Theme.prototype, "contrastDarkMode", void 0);
|
|
144
117
|
Theme = Theme_1 = __decorate([
|
|
145
118
|
customElement(tagName)
|
|
146
119
|
], Theme);
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
|
|
2
|
+
import { Message } from "@supersoniks/concorde/la-billetterie/_types/swagger";
|
|
3
|
+
type APIResult = {
|
|
4
|
+
data?: object | string;
|
|
5
|
+
message?: string;
|
|
6
|
+
public_message?: string;
|
|
7
|
+
success?: boolean;
|
|
8
|
+
messages?: Message[];
|
|
9
|
+
status?: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare const MessageSubscriber_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<APIResult>) & typeof LitElement;
|
|
3
12
|
export declare class MessageSubscriber extends MessageSubscriber_base {
|
|
4
|
-
_messages: Array<
|
|
13
|
+
_messages: Array<Message>;
|
|
5
14
|
success: boolean | null;
|
|
6
15
|
status: boolean | null;
|
|
7
|
-
get messages():
|
|
8
|
-
set messages(value:
|
|
16
|
+
get messages(): Message[];
|
|
17
|
+
set messages(value: Message[]);
|
|
9
18
|
_message: string;
|
|
10
19
|
get message(): string;
|
|
11
20
|
set message(value: string);
|
|
12
|
-
_data:
|
|
13
|
-
get data(): string |
|
|
14
|
-
set data(value: string |
|
|
21
|
+
_data: object | string;
|
|
22
|
+
get data(): string | object;
|
|
23
|
+
set data(value: string | object);
|
|
15
24
|
render(): symbol;
|
|
16
25
|
}
|
|
17
26
|
export {};
|
|
@@ -10,7 +10,7 @@ import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
|
10
10
|
import { SonicToast } from "@supersoniks/concorde/core/components/ui/toast/toast";
|
|
11
11
|
const tagName = "sonic-toast-message-subscriber";
|
|
12
12
|
//Superbe mix de multples versions d'api.
|
|
13
|
-
let MessageSubscriber = class MessageSubscriber extends Subscriber(LitElement) {
|
|
13
|
+
let MessageSubscriber = class MessageSubscriber extends Subscriber(LitElement, {}) {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
this._messages = [];
|
|
@@ -28,19 +28,20 @@ let MessageSubscriber = class MessageSubscriber extends Subscriber(LitElement) {
|
|
|
28
28
|
return;
|
|
29
29
|
value.forEach((message) => {
|
|
30
30
|
if (message.type == "public")
|
|
31
|
-
SonicToast.add({ text: message.content, status: message.status });
|
|
31
|
+
SonicToast.add({ text: message.content || "", status: message.status });
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
get message() {
|
|
35
35
|
return this._message;
|
|
36
36
|
}
|
|
37
37
|
set message(value) {
|
|
38
|
+
var _a, _b;
|
|
38
39
|
this._message = value;
|
|
39
40
|
if (!this.message)
|
|
40
41
|
return;
|
|
41
|
-
if (this.props.success !== false)
|
|
42
|
+
if (((_a = this.props) === null || _a === void 0 ? void 0 : _a.success) !== false)
|
|
42
43
|
return;
|
|
43
|
-
if (this.props.public_message)
|
|
44
|
+
if ((_b = this.props) === null || _b === void 0 ? void 0 : _b.public_message)
|
|
44
45
|
return;
|
|
45
46
|
//OUi OUi il faut afficher "message" que si success est parfaitement égal à false et qu'il n'y a rien dans public_message.
|
|
46
47
|
SonicToast.add({ text: this.message, status: "error" });
|
|
@@ -49,15 +50,16 @@ let MessageSubscriber = class MessageSubscriber extends Subscriber(LitElement) {
|
|
|
49
50
|
return this._data;
|
|
50
51
|
}
|
|
51
52
|
set data(value) {
|
|
53
|
+
var _a, _b, _c, _d;
|
|
52
54
|
this._data = value;
|
|
53
55
|
const toastOptions = { text: "Votre produit a bien été ajouté", status: "success" };
|
|
54
|
-
if (Array.isArray(this.data) && this.props.success === true)
|
|
56
|
+
if (Array.isArray(this.data) && ((_a = this.props) === null || _a === void 0 ? void 0 : _a.success) === true)
|
|
55
57
|
SonicToast.add(toastOptions);
|
|
56
|
-
if (this.data == "" && this.props.status === true)
|
|
58
|
+
if (this.data == "" && ((_b = this.props) === null || _b === void 0 ? void 0 : _b.status) === true)
|
|
57
59
|
SonicToast.add(toastOptions);
|
|
58
|
-
if (this.props.success !== false)
|
|
60
|
+
if (((_c = this.props) === null || _c === void 0 ? void 0 : _c.success) !== false)
|
|
59
61
|
return;
|
|
60
|
-
if (this.props.public_message)
|
|
62
|
+
if ((_d = this.props) === null || _d === void 0 ? void 0 : _d.public_message)
|
|
61
63
|
return;
|
|
62
64
|
SonicToast.add({ text: this.data, status: "error" });
|
|
63
65
|
}
|
|
@@ -11,10 +11,11 @@ export declare class SonicToast extends LitElement {
|
|
|
11
11
|
id: number;
|
|
12
12
|
text: string;
|
|
13
13
|
title: string | undefined;
|
|
14
|
-
status: import("@supersoniks/concorde/core/components/ui/toast/types").ToastStatus
|
|
14
|
+
status: import("@supersoniks/concorde/core/components/ui/toast/types").ToastStatus;
|
|
15
15
|
preserve: boolean | undefined;
|
|
16
16
|
ghost: boolean | undefined;
|
|
17
17
|
dismissForever: boolean | undefined;
|
|
18
18
|
} | null;
|
|
19
|
-
removeItem(
|
|
19
|
+
static removeItem(toastToRemove?: Toast): void;
|
|
20
|
+
removeItem(toastToRemove?: Toast): void;
|
|
20
21
|
}
|
|
@@ -29,22 +29,23 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
29
29
|
pointerEvents: "none",
|
|
30
30
|
gap: "1rem",
|
|
31
31
|
display: "flex",
|
|
32
|
-
margin: "1rem"
|
|
32
|
+
margin: "1rem",
|
|
33
33
|
};
|
|
34
34
|
if (!isIframe) {
|
|
35
|
-
styles = Object.assign(Object.assign({}, styles), { margin: "0", width: "calc(100% - 2.5rem)", position: "fixed", bottom: "1.25rem", right: "1.25rem", zIndex: "
|
|
35
|
+
styles = Object.assign(Object.assign({}, styles), { margin: "0", width: "calc(100% - 2.5rem)", position: "fixed", bottom: "1.25rem", right: "1.25rem", zIndex: "10000", maxWidth: "64ch", flexDirection: "column-reverse" });
|
|
36
36
|
}
|
|
37
37
|
// ${window.parent == window ? "fixed-area" : ""}
|
|
38
38
|
if (!this.toasts)
|
|
39
39
|
return nothing;
|
|
40
40
|
return html `<div aria-live="polite" style=${styleMap(styles)}>
|
|
41
41
|
${repeat(this.toasts, (item) => item.id, (item) => html `
|
|
42
|
-
<sonic-toast-item
|
|
42
|
+
<sonic-toast-item
|
|
43
|
+
maxHeight=${isIframe ? "none" : "10rem"}
|
|
43
44
|
status=${ifDefined(item.status)}
|
|
44
45
|
title=${ifDefined(item.title)}
|
|
45
46
|
?ghost=${item.ghost}
|
|
46
47
|
?dismissForever=${item.dismissForever}
|
|
47
|
-
?preserve=${item.preserve}
|
|
48
|
+
?preserve=${item.preserve}
|
|
48
49
|
id=${ifDefined(item.id)}
|
|
49
50
|
@hide=${() => this.removeItem(item)}
|
|
50
51
|
${animate({
|
|
@@ -71,7 +72,7 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
71
72
|
</div>`;
|
|
72
73
|
}
|
|
73
74
|
static removeAll() {
|
|
74
|
-
|
|
75
|
+
const toastComponent = document.querySelector("sonic-toast");
|
|
75
76
|
if (!toastComponent)
|
|
76
77
|
return;
|
|
77
78
|
toastComponent.toasts = toastComponent.toasts.filter((item) => item.ghost);
|
|
@@ -81,14 +82,14 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
81
82
|
var _a;
|
|
82
83
|
// Init toast area si absente (au <sonic-theme> ou <body< à défaut)
|
|
83
84
|
if (!document.querySelector("sonic-toast")) {
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
const toastComponent = document.createElement("sonic-toast");
|
|
86
|
+
const container = document.querySelector("sonic-theme") || document.body;
|
|
86
87
|
container.prepend(toastComponent);
|
|
87
88
|
}
|
|
88
89
|
// Ajoute le toast à la liste
|
|
89
|
-
|
|
90
|
+
const toastComponent = document.querySelector("sonic-toast");
|
|
90
91
|
const nextId = (_a = conf.id) !== null && _a !== void 0 ? _a : new Date().valueOf();
|
|
91
|
-
const interactiveRegExp = new RegExp("</a
|
|
92
|
+
const interactiveRegExp = new RegExp("</a>|</.*?button>|</.*?input>|</.*?textarea>|</.*?select>");
|
|
92
93
|
const hasInteractive = interactiveRegExp.test(conf.text);
|
|
93
94
|
const currentToast = {
|
|
94
95
|
id: nextId,
|
|
@@ -101,26 +102,40 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
101
102
|
};
|
|
102
103
|
// check if the toast is dismissed
|
|
103
104
|
if (conf.dismissForever && conf.id) {
|
|
104
|
-
const dismissed = localStorage.getItem(
|
|
105
|
+
const dismissed = localStorage.getItem("sonic-toast-dismissed") || "{}";
|
|
105
106
|
const dismissedObj = JSON.parse(dismissed);
|
|
106
107
|
if (dismissedObj[conf.id]) {
|
|
107
108
|
return null;
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
if (toastComponent.toasts.length > 0) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
const toastA = Object.assign({}, currentToast);
|
|
113
|
+
for (const toast of toastComponent.toasts) {
|
|
114
|
+
const toastB = Object.assign({}, toast);
|
|
115
|
+
toastA.id = toastB.id = 0;
|
|
116
|
+
if ( /*!currentToast.preserve && */Objects.shallowEqual(toastA, toastB)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
121
|
toastComponent.toasts = [...toastComponent.toasts, currentToast];
|
|
119
122
|
return currentToast;
|
|
120
123
|
}
|
|
124
|
+
static removeItem(toastToRemove) {
|
|
125
|
+
const toastComponent = document.querySelector("sonic-toast");
|
|
126
|
+
if (!toastComponent)
|
|
127
|
+
return;
|
|
128
|
+
toastComponent.removeItem(toastToRemove);
|
|
129
|
+
}
|
|
121
130
|
// Remove Toast
|
|
122
|
-
removeItem(
|
|
123
|
-
|
|
131
|
+
removeItem(toastToRemove) {
|
|
132
|
+
if (!toastToRemove)
|
|
133
|
+
return;
|
|
134
|
+
this.toasts = this.toasts.filter((toast) => {
|
|
135
|
+
toast = Object.assign({}, toast);
|
|
136
|
+
delete toast.id;
|
|
137
|
+
return !Objects.shallowEqual(toast, toastToRemove, false);
|
|
138
|
+
});
|
|
124
139
|
}
|
|
125
140
|
};
|
|
126
141
|
__decorate([
|
|
@@ -131,6 +146,5 @@ SonicToast = __decorate([
|
|
|
131
146
|
], SonicToast);
|
|
132
147
|
export { SonicToast };
|
|
133
148
|
if (typeof window !== "undefined") {
|
|
134
|
-
|
|
135
|
-
win.SonicToast = SonicToast;
|
|
149
|
+
window.SonicToast = SonicToast;
|
|
136
150
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { Message } from "@supersoniks/concorde/la-billetterie/_types/swagger";
|
|
2
|
+
export type ToastStatus = Message["status"] | "" | "success";
|
|
3
|
+
export type Toast = {
|
|
3
4
|
id?: number;
|
|
4
5
|
text: string;
|
|
5
6
|
title?: string;
|
|
@@ -14,23 +14,22 @@ let Tooltip = class Tooltip extends LitElement {
|
|
|
14
14
|
this.disabled = false;
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
|
-
|
|
18
|
-
return html `<div
|
|
19
|
-
data-tooltip-text="${this.label.trim().replace(" ", " ")}"
|
|
20
|
-
class="tooltip ${disabledClass}"
|
|
21
|
-
>
|
|
17
|
+
const disabledClass = this.disabled || this.label == "" ? "disabled" : "";
|
|
18
|
+
return html `<div data-tooltip-text="${this.label.trim().replace(" ", " ")}" class="tooltip ${disabledClass}">
|
|
22
19
|
<slot></slot>
|
|
23
20
|
</div>`;
|
|
24
21
|
}
|
|
25
22
|
};
|
|
26
23
|
Tooltip.styles = [
|
|
27
24
|
css `
|
|
28
|
-
|
|
25
|
+
:host {
|
|
29
26
|
position: relative;
|
|
30
|
-
display: flex;
|
|
27
|
+
display: inline-flex;
|
|
31
28
|
align-items: center;
|
|
32
29
|
text-align: center;
|
|
30
|
+
--sc-tooltip-fw: var(--sc-font-weight-base);
|
|
33
31
|
}
|
|
32
|
+
|
|
34
33
|
.tooltip:before {
|
|
35
34
|
position: absolute;
|
|
36
35
|
content: attr(data-tooltip-text);
|
|
@@ -38,9 +37,6 @@ Tooltip.styles = [
|
|
|
38
37
|
display: block;
|
|
39
38
|
opacity: 0;
|
|
40
39
|
pointer-events: none;
|
|
41
|
-
bottom: calc(100% + 0.25rem);
|
|
42
|
-
left: 50%;
|
|
43
|
-
transform: translateX(-50%);
|
|
44
40
|
background: var(--sc-base-content, #111827);
|
|
45
41
|
padding: 0.25rem;
|
|
46
42
|
border-radius: 0.25rem;
|
|
@@ -50,16 +46,46 @@ Tooltip.styles = [
|
|
|
50
46
|
line-height: 1.1;
|
|
51
47
|
width: max-content;
|
|
52
48
|
max-width: 20rem;
|
|
49
|
+
white-space: pre-line;
|
|
50
|
+
font-weight: var(--sc-tooltip-fw);
|
|
53
51
|
}
|
|
54
52
|
.tooltip:not(.disabled):hover:before {
|
|
55
53
|
opacity: 1;
|
|
56
54
|
display: block;
|
|
57
55
|
}
|
|
56
|
+
|
|
57
|
+
:host(:not([placement])) .tooltip:before,
|
|
58
|
+
:host([placement="top"]) .tooltip:before {
|
|
59
|
+
bottom: calc(100% + 0.25rem);
|
|
60
|
+
left: 50%;
|
|
61
|
+
transform: translateX(-50%);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([placement="bottom"]) .tooltip:before {
|
|
65
|
+
top: calc(100% + 0.25rem);
|
|
66
|
+
left: 50%;
|
|
67
|
+
transform: translateX(-50%);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:host([placement="left"]) .tooltip:before {
|
|
71
|
+
top: 50%;
|
|
72
|
+
right: calc(100% + 0.25rem);
|
|
73
|
+
transform: translateY(-50%);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([placement="right"]) .tooltip:before {
|
|
77
|
+
top: 50%;
|
|
78
|
+
transform: translateY(-50%);
|
|
79
|
+
left: calc(100% + 0.25rem);
|
|
80
|
+
}
|
|
58
81
|
`,
|
|
59
82
|
];
|
|
60
83
|
__decorate([
|
|
61
84
|
property({ type: String })
|
|
62
85
|
], Tooltip.prototype, "label", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
property({ type: String, reflect: true })
|
|
88
|
+
], Tooltip.prototype, "placement", void 0);
|
|
63
89
|
__decorate([
|
|
64
90
|
property({ type: Boolean })
|
|
65
91
|
], Tooltip.prototype, "disabled", void 0);
|
|
@@ -67,8 +93,3 @@ Tooltip = __decorate([
|
|
|
67
93
|
customElement(tagName)
|
|
68
94
|
], Tooltip);
|
|
69
95
|
export { Tooltip };
|
|
70
|
-
//Ajout pour la creation du cem notamment pour Storybook
|
|
71
|
-
try {
|
|
72
|
-
customElements.define(tagName, Tooltip);
|
|
73
|
-
}
|
|
74
|
-
catch (e) { }
|
|
@@ -19,7 +19,7 @@ import "./group/group";
|
|
|
19
19
|
import "./icon/icon";
|
|
20
20
|
import "./image/image";
|
|
21
21
|
import "./loader/loader";
|
|
22
|
-
import "
|
|
22
|
+
import "../../../la-billetterie/components/event/atoms/taxonomy/taxonomy";
|
|
23
23
|
import "./menu/menu";
|
|
24
24
|
import "./modal/modal";
|
|
25
25
|
import "./alert/alert";
|
package/core/components/ui/ui.js
CHANGED
|
@@ -23,12 +23,9 @@ import "./group/group";
|
|
|
23
23
|
import "./icon/icon";
|
|
24
24
|
import "./image/image";
|
|
25
25
|
import "./loader/loader";
|
|
26
|
-
import "
|
|
26
|
+
import "../../../la-billetterie/components/event/atoms/taxonomy/taxonomy";
|
|
27
27
|
//Menu
|
|
28
28
|
import "./menu/menu";
|
|
29
|
-
//Tabs
|
|
30
|
-
// import "./tabs/tabs";
|
|
31
|
-
// import "./tabs/tab";
|
|
32
29
|
// Misc
|
|
33
30
|
import "./modal/modal";
|
|
34
31
|
import "./alert/alert";
|
package/core/core.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "./components/functional/functional";
|
|
2
2
|
import "./components/ui/ui";
|
|
3
3
|
import "./mixins/mixins";
|
|
4
|
-
import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy
|
|
4
|
+
import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
5
5
|
import DataBindObserver from "./utils/DataBindObserver";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
win.SonicDataBindObserver = DataBindObserver;
|
|
6
|
+
if (!window.SonicPublisherManager)
|
|
7
|
+
window.SonicPublisherManager = PublisherManager;
|
|
8
|
+
if (!window.SonicDataBindObserver)
|
|
9
|
+
window.SonicDataBindObserver = DataBindObserver;
|
package/core/mixins/Fetcher.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
2
|
import "@supersoniks/concorde/core/components/ui/button/button";
|
|
3
3
|
import { SubscriberInterface } from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import API from "@supersoniks/concorde/core/utils/api";
|
|
5
|
+
import { PublisherContentType } from "../_types/types";
|
|
6
|
+
import { MixinArgsType } from "../_types/types";
|
|
7
|
+
import { ResultTypeInterface } from "@supersoniks/concorde/core/utils/api";
|
|
8
|
+
type Constructor<T> = new (...args: MixinArgsType[]) => T;
|
|
9
|
+
declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, PropsType extends PublisherContentType = PublisherContentType>(superClass: T, propsType?: PropsType | undefined) => {
|
|
10
|
+
new (...args: MixinArgsType[]): {
|
|
7
11
|
api: API | null;
|
|
8
12
|
/**
|
|
9
13
|
* Après le chargement des données on traverse l'objet reçu en fonctione de la cible exprimées dans cette propriété avec la dot syntaxe.
|
|
10
14
|
* C'est cette donnée cible qui est injectée dans les pros et donc disponible via le publisher disponible globalement via PublisherManager.get(dataProvider)
|
|
11
15
|
*/
|
|
12
|
-
key:
|
|
16
|
+
key: string;
|
|
13
17
|
/**
|
|
14
18
|
* isFirstLoad vaut true jusqu'au premier chargement de données
|
|
15
19
|
*/
|
|
@@ -32,7 +36,11 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
|
|
|
32
36
|
*/
|
|
33
37
|
isFetchEnabled: boolean;
|
|
34
38
|
_endPoint: string;
|
|
39
|
+
props: (PropsType & ResultTypeInterface) | null;
|
|
35
40
|
endPoint: string;
|
|
41
|
+
requestId: number;
|
|
42
|
+
refetchEveryMs: number;
|
|
43
|
+
refetchTimeOutId?: NodeJS.Timeout | undefined;
|
|
36
44
|
/**
|
|
37
45
|
*
|
|
38
46
|
* C'est ici que les données sont chargées via l'utilitaire API
|
|
@@ -40,7 +48,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
|
|
|
40
48
|
* Un Toast est affiché si le chargement échoue
|
|
41
49
|
*/
|
|
42
50
|
_fetchData(): Promise<void>;
|
|
43
|
-
onInvalidate
|
|
51
|
+
onInvalidate?: (() => void) | undefined;
|
|
44
52
|
disconnectedCallback(): void;
|
|
45
53
|
connectedCallback(): void;
|
|
46
54
|
/**
|
|
@@ -48,13 +56,11 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
|
|
|
48
56
|
*/
|
|
49
57
|
firstUpdated(): void;
|
|
50
58
|
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
51
|
-
|
|
52
|
-
propertyMap: Object;
|
|
59
|
+
propertyMap: object;
|
|
53
60
|
isConnected: boolean;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*/
|
|
61
|
+
children: HTMLCollection;
|
|
62
|
+
appendChild(node: Node): Node;
|
|
63
|
+
getAncestorAttributeValue(attributeName: string): string;
|
|
58
64
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
59
65
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
60
66
|
publisher: any;
|
|
@@ -63,6 +69,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
|
|
|
63
69
|
debug: HTMLElement | null;
|
|
64
70
|
defferedDebug: boolean | null;
|
|
65
71
|
displayContents: boolean;
|
|
72
|
+
shadowRoot?: ShadowRoot | undefined;
|
|
66
73
|
dispatchEvent(event: Event): void;
|
|
67
74
|
setAttribute(name: string, value: string): void;
|
|
68
75
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -72,7 +79,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
|
|
|
72
79
|
getApiConfiguration(): import("@supersoniks/concorde/core/utils/api").APIConfiguration;
|
|
73
80
|
requestUpdate(): void;
|
|
74
81
|
getAttribute(name: string): string;
|
|
75
|
-
hasAttribute(attributeName:
|
|
82
|
+
hasAttribute(attributeName: string): boolean;
|
|
76
83
|
};
|
|
77
84
|
} & T;
|
|
78
85
|
export default Fetcher;
|