@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
|
@@ -29,7 +29,7 @@ ModalActions.styles = [
|
|
|
29
29
|
display: flex;
|
|
30
30
|
gap: 0.5rem;
|
|
31
31
|
margin-top: auto;
|
|
32
|
-
padding-top:
|
|
32
|
+
padding-top: 1.5rem;
|
|
33
33
|
}
|
|
34
34
|
`,
|
|
35
35
|
];
|
|
@@ -40,8 +40,3 @@ ModalActions = __decorate([
|
|
|
40
40
|
customElement(tagName)
|
|
41
41
|
], ModalActions);
|
|
42
42
|
export { ModalActions };
|
|
43
|
-
//Ajout pour Storybook
|
|
44
|
-
try {
|
|
45
|
-
customElements.define(tagName, ModalActions);
|
|
46
|
-
}
|
|
47
|
-
catch (e) { }
|
|
@@ -5,11 +5,12 @@ 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
|
import { html, LitElement, css } from "lit";
|
|
8
|
-
import { customElement } from "lit/decorators.js";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
9
10
|
const tagName = "sonic-modal-close";
|
|
10
11
|
let ModalClose = class ModalClose extends LitElement {
|
|
11
12
|
render() {
|
|
12
|
-
return html `<sonic-button shape="circle"
|
|
13
|
+
return html `<sonic-button reset=${ifDefined(this.reset)} shape="circle" @click=${this.handleClick}
|
|
13
14
|
><sonic-icon name="cancel" size="lg"></sonic-icon
|
|
14
15
|
></sonic-button>`;
|
|
15
16
|
}
|
|
@@ -21,19 +22,22 @@ let ModalClose = class ModalClose extends LitElement {
|
|
|
21
22
|
ModalClose.styles = [
|
|
22
23
|
css `
|
|
23
24
|
:host {
|
|
24
|
-
position:
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
position: sticky;
|
|
26
|
+
display: block;
|
|
27
|
+
align-self: flex-end;
|
|
28
|
+
height: 0;
|
|
29
|
+
top: 0;
|
|
30
|
+
padding-top: 0.5rem;
|
|
31
|
+
padding-right: 0.5rem;
|
|
32
|
+
transform: translate3d(calc(var(--sc-modal-px)), calc(-1 * var(--sc-modal-py)), 0);
|
|
27
33
|
z-index: 20;
|
|
28
34
|
}
|
|
29
35
|
`,
|
|
30
36
|
];
|
|
37
|
+
__decorate([
|
|
38
|
+
property()
|
|
39
|
+
], ModalClose.prototype, "reset", void 0);
|
|
31
40
|
ModalClose = __decorate([
|
|
32
41
|
customElement(tagName)
|
|
33
42
|
], ModalClose);
|
|
34
43
|
export { ModalClose };
|
|
35
|
-
//Ajout pour Storybook
|
|
36
|
-
try {
|
|
37
|
-
customElements.define(tagName, ModalClose);
|
|
38
|
-
}
|
|
39
|
-
catch (e) { }
|
|
@@ -17,9 +17,10 @@ ModalSubTitle.styles = [
|
|
|
17
17
|
:host {
|
|
18
18
|
font-size: 1.1rem;
|
|
19
19
|
display: block;
|
|
20
|
-
|
|
20
|
+
line-height: 1.1rem;
|
|
21
21
|
line-height: var(--sc-headings-line-height);
|
|
22
22
|
font-family: var(--sc-headings-font-family);
|
|
23
|
+
font-weight: var(--sc-headings-font-weight);
|
|
23
24
|
}
|
|
24
25
|
`,
|
|
25
26
|
];
|
|
@@ -27,8 +28,3 @@ ModalSubTitle = __decorate([
|
|
|
27
28
|
customElement(tagName)
|
|
28
29
|
], ModalSubTitle);
|
|
29
30
|
export { ModalSubTitle };
|
|
30
|
-
//Ajout pour Storybook
|
|
31
|
-
try {
|
|
32
|
-
customElements.define(tagName, ModalSubTitle);
|
|
33
|
-
}
|
|
34
|
-
catch (e) { }
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { LitElement, nothing } from "lit";
|
|
1
|
+
import { LitElement, nothing, PropertyValues } from "lit";
|
|
2
2
|
import "@supersoniks/concorde/core/components/ui/modal/modal-actions";
|
|
3
|
-
import "@supersoniks/concorde/core/components/ui/modal/modal-title";
|
|
4
|
-
import "@supersoniks/concorde/core/components/ui/modal/modal-subtitle";
|
|
5
|
-
import "@supersoniks/concorde/core/components/ui/modal/modal-content";
|
|
6
3
|
import "@supersoniks/concorde/core/components/ui/modal/modal-close";
|
|
4
|
+
import "@supersoniks/concorde/core/components/ui/modal/modal-content";
|
|
5
|
+
import "@supersoniks/concorde/core/components/ui/modal/modal-subtitle";
|
|
6
|
+
import "@supersoniks/concorde/core/components/ui/modal/modal-title";
|
|
7
7
|
declare type ModalCreateOptions = {
|
|
8
8
|
content?: string;
|
|
9
9
|
};
|
|
10
|
-
declare const Modal_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
10
|
+
declare const Modal_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("@supersoniks/concorde/core/_types/types").CoreJSType>) & typeof LitElement;
|
|
11
11
|
export declare class Modal extends Modal_base {
|
|
12
12
|
static styles: import("lit").CSSResult[];
|
|
13
|
-
|
|
14
|
-
hideOnEscape: boolean;
|
|
13
|
+
forceAction: boolean;
|
|
15
14
|
align: "center" | "right" | "left";
|
|
16
15
|
padding: string;
|
|
17
16
|
maxWidth: string;
|
|
@@ -26,6 +25,7 @@ export declare class Modal extends Modal_base {
|
|
|
26
25
|
static create(options: ModalCreateOptions): Modal;
|
|
27
26
|
connectedCallback(): void;
|
|
28
27
|
updated(): void;
|
|
28
|
+
willUpdate(_changedProperties: PropertyValues): void;
|
|
29
29
|
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
30
30
|
show(): void;
|
|
31
31
|
hide(): void;
|
|
@@ -4,24 +4,24 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html, LitElement, css, nothing } from "lit";
|
|
8
|
-
import { customElement, property, queryAssignedElements, query } from "lit/decorators.js";
|
|
9
|
-
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
7
|
import { animate, fadeIn, fadeOut } from "@lit-labs/motion";
|
|
11
|
-
import { styleMap } from "lit/directives/style-map.js";
|
|
12
8
|
import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
|
|
9
|
+
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
|
+
import { css, html, LitElement, nothing } from "lit";
|
|
11
|
+
import { customElement, property, query, queryAssignedElements } from "lit/decorators.js";
|
|
12
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
13
13
|
import "@supersoniks/concorde/core/components/ui/modal/modal-actions";
|
|
14
|
-
import "@supersoniks/concorde/core/components/ui/modal/modal-title";
|
|
15
|
-
import "@supersoniks/concorde/core/components/ui/modal/modal-subtitle";
|
|
16
|
-
import "@supersoniks/concorde/core/components/ui/modal/modal-content";
|
|
17
14
|
import "@supersoniks/concorde/core/components/ui/modal/modal-close";
|
|
15
|
+
import "@supersoniks/concorde/core/components/ui/modal/modal-content";
|
|
16
|
+
import "@supersoniks/concorde/core/components/ui/modal/modal-subtitle";
|
|
17
|
+
import "@supersoniks/concorde/core/components/ui/modal/modal-title";
|
|
18
|
+
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
18
19
|
const tagName = "sonic-modal";
|
|
19
20
|
let Modal = class Modal extends Subscriber(LitElement) {
|
|
20
21
|
constructor() {
|
|
21
22
|
super(...arguments);
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.align = "center";
|
|
23
|
+
this.forceAction = false;
|
|
24
|
+
this.align = "left";
|
|
25
25
|
this.padding = "var(--sc-modal-py) var(--sc-modal-px)";
|
|
26
26
|
this.maxWidth = "var(--sc-modal-max-w) ";
|
|
27
27
|
this.maxHeight = "var(--sc-modal-max-h) ";
|
|
@@ -34,13 +34,14 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
34
34
|
const modal = document.createElement(tagName);
|
|
35
35
|
modal.innerHTML =
|
|
36
36
|
`<sonic-modal-close></sonic-modal-close><sonic-modal-content>${options.content}</sonic-modal-content>` || "";
|
|
37
|
-
|
|
37
|
+
const container = document.querySelector("sonic-theme") || document.body;
|
|
38
38
|
container.appendChild(modal);
|
|
39
39
|
modal.show();
|
|
40
40
|
return modal;
|
|
41
41
|
}
|
|
42
42
|
connectedCallback() {
|
|
43
43
|
super.connectedCallback();
|
|
44
|
+
this.handleFullsceen();
|
|
44
45
|
}
|
|
45
46
|
updated() {
|
|
46
47
|
const currentModal = this;
|
|
@@ -51,10 +52,15 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
51
52
|
}, { once: true });
|
|
52
53
|
});
|
|
53
54
|
}
|
|
55
|
+
willUpdate(_changedProperties) {
|
|
56
|
+
if (_changedProperties.has("fullScreen")) {
|
|
57
|
+
this.handleFullsceen();
|
|
58
|
+
}
|
|
59
|
+
super.willUpdate(_changedProperties);
|
|
60
|
+
}
|
|
54
61
|
render() {
|
|
55
62
|
if (this.visible == false)
|
|
56
63
|
return nothing;
|
|
57
|
-
this.handleFullsceen();
|
|
58
64
|
const modalStyles = {
|
|
59
65
|
padding: this.padding,
|
|
60
66
|
maxWidth: this.maxWidth,
|
|
@@ -99,7 +105,7 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
99
105
|
|
|
100
106
|
<div
|
|
101
107
|
class="overlay"
|
|
102
|
-
@click="${this.
|
|
108
|
+
@click="${!this.forceAction ? this.hide : ""}"
|
|
103
109
|
${animate({
|
|
104
110
|
keyframeOptions: {
|
|
105
111
|
duration: 500,
|
|
@@ -121,6 +127,9 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
121
127
|
this.visible = false;
|
|
122
128
|
(_a = this.modalElement) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", "-1");
|
|
123
129
|
this.dispatchEvent(new CustomEvent("hide"));
|
|
130
|
+
if (this.hasAttribute("resetDataProviderOnHide")) {
|
|
131
|
+
PublisherManager.get(this.getAttribute("resetDataProviderOnHide")).set({});
|
|
132
|
+
}
|
|
124
133
|
}
|
|
125
134
|
dispose() {
|
|
126
135
|
this.hide();
|
|
@@ -130,7 +139,7 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
130
139
|
if (e.key === "Escape") {
|
|
131
140
|
const modals = [...document.querySelectorAll(tagName)];
|
|
132
141
|
modals.forEach((item) => {
|
|
133
|
-
if (this.
|
|
142
|
+
if (!this.forceAction) {
|
|
134
143
|
item.hide();
|
|
135
144
|
}
|
|
136
145
|
});
|
|
@@ -152,11 +161,8 @@ Modal.styles = [
|
|
|
152
161
|
:host {
|
|
153
162
|
--sc-modal-py: 2.5rem;
|
|
154
163
|
--sc-modal-px: 1.5rem;
|
|
155
|
-
--sc-modal-content: var(--sc-base-content);
|
|
156
|
-
--sc-modal-bg: var(--sc-base);
|
|
157
164
|
--sc-modal-max-w: min(100vw, 64ch);
|
|
158
165
|
--sc-modal-max-h: 80vh;
|
|
159
|
-
--sc-modal-scrollbar-bg: var(--sc-base-300);
|
|
160
166
|
--sc-modal-rounded: var(--sc-rounded-lg);
|
|
161
167
|
}
|
|
162
168
|
|
|
@@ -170,7 +176,6 @@ Modal.styles = [
|
|
|
170
176
|
left: 0;
|
|
171
177
|
width: 100%;
|
|
172
178
|
z-index: 990;
|
|
173
|
-
text-align: center;
|
|
174
179
|
align-items: center;
|
|
175
180
|
justify-content: center;
|
|
176
181
|
flex-direction: column;
|
|
@@ -178,18 +183,16 @@ Modal.styles = [
|
|
|
178
183
|
pointer-events: none;
|
|
179
184
|
}
|
|
180
185
|
|
|
181
|
-
|
|
182
186
|
.modal-content {
|
|
183
|
-
overflow-y: auto;
|
|
184
187
|
display: flex;
|
|
185
188
|
flex-direction: column;
|
|
186
|
-
text-align: center;
|
|
187
|
-
align-items: center;
|
|
188
189
|
min-height: 10rem;
|
|
190
|
+
line-height: 1.25;
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
.modal {
|
|
192
194
|
background: var(--sc-base);
|
|
195
|
+
color: var(--sc-base-content);
|
|
193
196
|
width: 100%;
|
|
194
197
|
box-shadow: var(--sc-shadow-lg);
|
|
195
198
|
border-radius: var(--sc-modal-rounded) var(--sc-modal-rounded) 0 0;
|
|
@@ -199,7 +202,7 @@ Modal.styles = [
|
|
|
199
202
|
}
|
|
200
203
|
|
|
201
204
|
.overlay {
|
|
202
|
-
background: var(--sc-base-200);
|
|
205
|
+
background: var(--sc-modal-overlay-bg, var(--sc-base-200));
|
|
203
206
|
left: 0;
|
|
204
207
|
top: 0;
|
|
205
208
|
right: 0;
|
|
@@ -210,12 +213,12 @@ Modal.styles = [
|
|
|
210
213
|
}
|
|
211
214
|
|
|
212
215
|
::slotted(sonic-modal-title) {
|
|
213
|
-
margin-bottom:
|
|
216
|
+
margin-bottom: 1.25rem;
|
|
214
217
|
}
|
|
215
218
|
|
|
216
219
|
::slotted(sonic-modal-subtitle) {
|
|
217
|
-
margin-top: -0.
|
|
218
|
-
margin-bottom:
|
|
220
|
+
margin-top: -0.9rem;
|
|
221
|
+
margin-bottom: 1.25rem;
|
|
219
222
|
}
|
|
220
223
|
|
|
221
224
|
@media (max-width: 767.5px) {
|
|
@@ -248,6 +251,11 @@ Modal.styles = [
|
|
|
248
251
|
align-items: flex-start;
|
|
249
252
|
}
|
|
250
253
|
|
|
254
|
+
:host([align="center"]) .modal-content {
|
|
255
|
+
text-align: center;
|
|
256
|
+
align-items: center;
|
|
257
|
+
}
|
|
258
|
+
|
|
251
259
|
:host([align="right"]) .modal-content {
|
|
252
260
|
text-align: right;
|
|
253
261
|
align-items: flex-end;
|
|
@@ -260,11 +268,8 @@ Modal.styles = [
|
|
|
260
268
|
`,
|
|
261
269
|
];
|
|
262
270
|
__decorate([
|
|
263
|
-
property({ type: Boolean
|
|
264
|
-
], Modal.prototype, "
|
|
265
|
-
__decorate([
|
|
266
|
-
property({ type: Boolean, reflect: true })
|
|
267
|
-
], Modal.prototype, "hideOnEscape", void 0);
|
|
271
|
+
property({ type: Boolean })
|
|
272
|
+
], Modal.prototype, "forceAction", void 0);
|
|
268
273
|
__decorate([
|
|
269
274
|
property({ type: String, reflect: true })
|
|
270
275
|
], Modal.prototype, "align", void 0);
|
|
@@ -303,10 +308,5 @@ Modal = __decorate([
|
|
|
303
308
|
], Modal);
|
|
304
309
|
export { Modal };
|
|
305
310
|
if (typeof window !== "undefined") {
|
|
306
|
-
|
|
307
|
-
win.SonicModal = Modal;
|
|
308
|
-
}
|
|
309
|
-
try {
|
|
310
|
-
customElements.define(tagName, Modal);
|
|
311
|
+
window.SonicModal = Modal;
|
|
311
312
|
}
|
|
312
|
-
catch (e) { }
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { LitElement } from
|
|
2
|
-
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
type PopPlacement = "bottom" | "top" | "right" | "left";
|
|
3
3
|
export declare class Pop extends LitElement {
|
|
4
4
|
static pops: Set<Pop>;
|
|
5
5
|
static styles: import("lit").CSSResult[];
|
|
6
6
|
open: boolean;
|
|
7
7
|
popBtn: HTMLElement;
|
|
8
8
|
popContent: HTMLElement;
|
|
9
|
-
toggle:
|
|
9
|
+
toggle: "true" | "false";
|
|
10
|
+
noToggle: boolean;
|
|
10
11
|
inline: boolean;
|
|
11
12
|
/**
|
|
12
13
|
* Ombre
|
|
13
14
|
*/
|
|
14
|
-
shadow:
|
|
15
|
+
shadow: "" | "none" | "sm" | "md" | "lg";
|
|
15
16
|
placement: PopPlacement;
|
|
16
17
|
positioningRuns: boolean;
|
|
17
18
|
lastContentX: number;
|
|
18
19
|
lastContentY: number;
|
|
19
20
|
runPositioning(): void;
|
|
20
|
-
_toggle(e:
|
|
21
|
+
_toggle(e: Event): void;
|
|
21
22
|
_show(): void;
|
|
22
23
|
_hide(): void;
|
|
23
24
|
_handleClosePop(e: Event): void;
|
|
@@ -5,21 +5,22 @@ 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 Pop_1;
|
|
8
|
-
import { html, LitElement, css } from
|
|
9
|
-
import { customElement, query, state, property } from
|
|
10
|
-
import HTML from
|
|
11
|
-
const tagName =
|
|
8
|
+
import { html, LitElement, css } from "lit";
|
|
9
|
+
import { customElement, query, state, property } from "lit/decorators.js";
|
|
10
|
+
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
11
|
+
const tagName = "sonic-pop";
|
|
12
12
|
let Pop = Pop_1 = class Pop extends LitElement {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.open = false;
|
|
16
|
-
this.toggle =
|
|
16
|
+
this.toggle = "true";
|
|
17
|
+
this.noToggle = false;
|
|
17
18
|
this.inline = false;
|
|
18
19
|
/**
|
|
19
20
|
* Ombre
|
|
20
21
|
*/
|
|
21
|
-
this.shadow =
|
|
22
|
-
this.placement =
|
|
22
|
+
this.shadow = "lg";
|
|
23
|
+
this.placement = "bottom";
|
|
23
24
|
this.positioningRuns = false;
|
|
24
25
|
this.lastContentX = Number.NaN;
|
|
25
26
|
this.lastContentY = Number.NaN;
|
|
@@ -32,16 +33,17 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
32
33
|
window.requestAnimationFrame(() => this.runPositioning());
|
|
33
34
|
}
|
|
34
35
|
_toggle(e) {
|
|
35
|
-
if (this.open && this.
|
|
36
|
+
if (this.open && this.noToggle)
|
|
36
37
|
return;
|
|
37
|
-
|
|
38
|
+
const keyboardEvent = e;
|
|
39
|
+
if (e.type == "keydown" && (keyboardEvent.key != "ArrowDown" || this.open))
|
|
38
40
|
return;
|
|
39
41
|
this.open = !this.open;
|
|
40
42
|
this.open ? this._show() : this._hide();
|
|
41
43
|
}
|
|
42
44
|
_show() {
|
|
43
45
|
this.open = true;
|
|
44
|
-
this.popContent.setAttribute(
|
|
46
|
+
this.popContent.setAttribute("tabindex", "0");
|
|
45
47
|
if (this.popBtn && this.popContent && !this.positioningRuns) {
|
|
46
48
|
this.positioningRuns = true;
|
|
47
49
|
this.lastContentX = Number.NaN;
|
|
@@ -51,19 +53,19 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
51
53
|
}
|
|
52
54
|
_hide() {
|
|
53
55
|
this.open = false;
|
|
54
|
-
this.popContent.setAttribute(
|
|
56
|
+
this.popContent.setAttribute("tabindex", "-1");
|
|
55
57
|
this.positioningRuns = false;
|
|
56
58
|
}
|
|
57
59
|
_handleClosePop(e) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
const path = e.composedPath();
|
|
61
|
+
const target = path[0];
|
|
60
62
|
Pop_1.pops.forEach((pop) => {
|
|
61
63
|
const popContainsTarget = path.includes(pop);
|
|
62
64
|
const popContentContainsTarget = path.includes(pop.querySelector('[slot="content"]'));
|
|
63
|
-
const isCloseManual = HTML.getAncestorAttributeValue(target,
|
|
64
|
-
if (e.type ==
|
|
65
|
+
const isCloseManual = HTML.getAncestorAttributeValue(target, "data-on-select") === "keep";
|
|
66
|
+
if (e.type == "pointerdown" && popContainsTarget)
|
|
65
67
|
return;
|
|
66
|
-
if (e.type ==
|
|
68
|
+
if (e.type == "click" && ((popContainsTarget && isCloseManual) || !popContentContainsTarget))
|
|
67
69
|
return;
|
|
68
70
|
pop._hide();
|
|
69
71
|
});
|
|
@@ -71,8 +73,8 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
71
73
|
connectedCallback() {
|
|
72
74
|
super.connectedCallback();
|
|
73
75
|
if (Pop_1.pops.size == 0) {
|
|
74
|
-
document.addEventListener(
|
|
75
|
-
document.addEventListener(
|
|
76
|
+
document.addEventListener("pointerdown", this._handleClosePop);
|
|
77
|
+
document.addEventListener("click", this._handleClosePop);
|
|
76
78
|
}
|
|
77
79
|
Pop_1.pops.add(this);
|
|
78
80
|
}
|
|
@@ -80,8 +82,8 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
80
82
|
super.disconnectedCallback();
|
|
81
83
|
Pop_1.pops.delete(this);
|
|
82
84
|
if (Pop_1.pops.size == 0) {
|
|
83
|
-
document.removeEventListener(
|
|
84
|
-
document.removeEventListener(
|
|
85
|
+
document.removeEventListener("pointerdown", this._handleClosePop);
|
|
86
|
+
document.removeEventListener("click", this._handleClosePop);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
_setUpMenu(placement) {
|
|
@@ -92,43 +94,43 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
92
94
|
const thisRect = this.getBoundingClientRect();
|
|
93
95
|
if (!this.offsetParent)
|
|
94
96
|
return;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
const bodyRect = this.offsetParent.getBoundingClientRect();
|
|
98
|
+
const x0 = thisRect.left - bodyRect.left;
|
|
99
|
+
const y0 = thisRect.top - bodyRect.top;
|
|
98
100
|
let x = x0, y = y0;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const yTop = y0 - contentRect.height - padding;
|
|
102
|
+
const xLeft = x0 - contentRect.width - 2 * padding;
|
|
103
|
+
const xRight = x0 + thisRect.width + 2 * padding;
|
|
104
|
+
const yBottom = y0 + thisRect.height + padding;
|
|
103
105
|
switch (placement) {
|
|
104
|
-
case
|
|
106
|
+
case "bottom":
|
|
105
107
|
y = yBottom;
|
|
106
108
|
break;
|
|
107
|
-
case
|
|
109
|
+
case "top":
|
|
108
110
|
y = yTop;
|
|
109
111
|
break;
|
|
110
|
-
case
|
|
112
|
+
case "left":
|
|
111
113
|
x = xLeft;
|
|
112
114
|
break;
|
|
113
|
-
case
|
|
115
|
+
case "right":
|
|
114
116
|
x = xRight;
|
|
115
117
|
break;
|
|
116
118
|
}
|
|
117
|
-
|
|
118
|
-
if (dxRight < 0 && placement ===
|
|
119
|
+
const dxRight = window.innerWidth - xRight - bodyRect.left - contentRect.width - shiftPadding;
|
|
120
|
+
if (dxRight < 0 && placement === "right")
|
|
119
121
|
x = xLeft;
|
|
120
|
-
if (dxRight < 0 && [
|
|
122
|
+
if (dxRight < 0 && ["top", "bottom"].includes(placement))
|
|
121
123
|
x = Math.max(x + dxRight, xLeft + thisRect.width);
|
|
122
|
-
|
|
123
|
-
if (dxLeft > shiftPadding && placement ===
|
|
124
|
+
const dxLeft = -bodyRect.left - xLeft;
|
|
125
|
+
if (dxLeft > shiftPadding && placement === "left")
|
|
124
126
|
x = xRight;
|
|
125
|
-
|
|
126
|
-
if (dyBottom < 0 && placement ===
|
|
127
|
+
const dyBottom = window.innerHeight - yBottom - bodyRect.top - contentRect.height - shiftPadding;
|
|
128
|
+
if (dyBottom < 0 && placement === "bottom")
|
|
127
129
|
y = yTop;
|
|
128
|
-
if (dyBottom < 0 && [
|
|
130
|
+
if (dyBottom < 0 && ["left", "right"].includes(placement))
|
|
129
131
|
y = Math.max(y + dyBottom, yTop + thisRect.height);
|
|
130
|
-
|
|
131
|
-
if (dyTop > -shiftPadding && placement ===
|
|
132
|
+
const dyTop = -bodyRect.top - yTop;
|
|
133
|
+
if (dyTop > -shiftPadding && placement === "top")
|
|
132
134
|
y = yBottom;
|
|
133
135
|
this.lastContentX = x;
|
|
134
136
|
this.lastContentY = y;
|
|
@@ -145,7 +147,7 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
145
147
|
tabindex="-1"
|
|
146
148
|
part="content"
|
|
147
149
|
class="
|
|
148
|
-
${this.open ?
|
|
150
|
+
${this.open ? "is-open" : ""}"
|
|
149
151
|
></slot>
|
|
150
152
|
`;
|
|
151
153
|
}
|
|
@@ -157,7 +159,7 @@ Pop.styles = [
|
|
|
157
159
|
display: inline-block;
|
|
158
160
|
vertical-align: middle;
|
|
159
161
|
}
|
|
160
|
-
slot[name=
|
|
162
|
+
slot[name="content"] {
|
|
161
163
|
max-width: 80vw;
|
|
162
164
|
background-color: var(--sc-base);
|
|
163
165
|
position: absolute;
|
|
@@ -172,7 +174,7 @@ Pop.styles = [
|
|
|
172
174
|
border-radius: min(calc(var(--sc-btn-rounded) * 2), 0.4em);
|
|
173
175
|
}
|
|
174
176
|
|
|
175
|
-
slot[name=
|
|
177
|
+
slot[name="content"].is-open {
|
|
176
178
|
transform: translateY(0) scale(1);
|
|
177
179
|
opacity: 1;
|
|
178
180
|
pointer-events: auto;
|
|
@@ -181,21 +183,21 @@ Pop.styles = [
|
|
|
181
183
|
}
|
|
182
184
|
|
|
183
185
|
/*OMBRE*/
|
|
184
|
-
:host([shadow]) slot[name=
|
|
185
|
-
:host([shadow=
|
|
186
|
-
:host([shadow=
|
|
186
|
+
:host([shadow]) slot[name="content"],
|
|
187
|
+
:host([shadow="md"]) slot[name="content"],
|
|
188
|
+
:host([shadow="true"]) slot[name="content"] {
|
|
187
189
|
box-shadow: var(--sc-shadow);
|
|
188
190
|
}
|
|
189
191
|
|
|
190
|
-
:host([shadow=
|
|
192
|
+
:host([shadow="sm"]) slot[name="content"] {
|
|
191
193
|
box-shadow: var(--sc-shadow-sm);
|
|
192
194
|
}
|
|
193
195
|
|
|
194
|
-
:host([shadow=
|
|
196
|
+
:host([shadow="none"]) slot[name="content"] {
|
|
195
197
|
box-shadow: none;
|
|
196
198
|
}
|
|
197
199
|
|
|
198
|
-
:host([shadow=
|
|
200
|
+
:host([shadow="lg"]) slot[name="content"] {
|
|
199
201
|
box-shadow: var(--sc-shadow-lg);
|
|
200
202
|
}
|
|
201
203
|
|
|
@@ -208,14 +210,17 @@ __decorate([
|
|
|
208
210
|
state()
|
|
209
211
|
], Pop.prototype, "open", void 0);
|
|
210
212
|
__decorate([
|
|
211
|
-
query(
|
|
213
|
+
query("slot:not([name=content])")
|
|
212
214
|
], Pop.prototype, "popBtn", void 0);
|
|
213
215
|
__decorate([
|
|
214
|
-
query(
|
|
216
|
+
query("slot[name=content]")
|
|
215
217
|
], Pop.prototype, "popContent", void 0);
|
|
216
218
|
__decorate([
|
|
217
219
|
property({ type: String })
|
|
218
220
|
], Pop.prototype, "toggle", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
property({ type: Boolean })
|
|
223
|
+
], Pop.prototype, "noToggle", void 0);
|
|
219
224
|
__decorate([
|
|
220
225
|
property({ type: Boolean, reflect: true })
|
|
221
226
|
], Pop.prototype, "inline", void 0);
|
|
@@ -229,8 +234,3 @@ Pop = Pop_1 = __decorate([
|
|
|
229
234
|
customElement(tagName)
|
|
230
235
|
], Pop);
|
|
231
236
|
export { Pop };
|
|
232
|
-
//Ajout pour la creation du cem notamment pour Storybook
|
|
233
|
-
try {
|
|
234
|
-
customElements.define(tagName, Pop);
|
|
235
|
-
}
|
|
236
|
-
catch (e) { }
|