@supersoniks/concorde 1.1.45 → 1.1.46
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/concorde-core.bundle.js +39 -24
- package/concorde-core.es.js +701 -231
- package/core/components/functional/fetch/fetch.d.ts +2 -1
- package/core/components/functional/list/list.d.ts +3 -1
- package/core/components/functional/list/list.js +3 -1
- package/core/components/functional/queue/queue.d.ts +8 -1
- package/core/components/functional/queue/queue.js +126 -62
- package/core/components/functional/sdui/sdui.d.ts +2 -1
- package/core/components/ui/alert/alert.d.ts +3 -0
- package/core/components/ui/alert/alert.js +33 -1
- package/core/components/ui/badge/badge.d.ts +1 -1
- package/core/components/ui/badge/badge.js +9 -3
- package/core/components/ui/button/button.d.ts +1 -0
- package/core/components/ui/form/checkbox/checkbox.d.ts +3 -0
- package/core/components/ui/form/checkbox/checkbox.js +14 -3
- package/core/components/ui/form/css/form-control.d.ts +1 -0
- package/core/components/ui/form/css/form-control.js +17 -0
- package/core/components/ui/form/input/input.d.ts +5 -3
- package/core/components/ui/form/input/input.js +47 -3
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +93 -13
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +181 -52
- package/core/components/ui/form/textarea/textarea.d.ts +1 -0
- package/core/components/ui/icon/icon.js +1 -1
- package/core/components/ui/modal/modal-close.js +2 -3
- package/core/components/ui/modal/modal-content.js +1 -0
- package/core/components/ui/modal/modal.d.ts +8 -0
- package/core/components/ui/modal/modal.js +34 -6
- package/core/components/ui/pop/pop.js +18 -7
- package/core/components/ui/theme/theme-collection/core-variables.js +18 -9
- package/core/components/ui/theme/theme.js +8 -3
- package/core/mixins/Fetcher.d.ts +2 -1
- package/core/mixins/Fetcher.js +42 -10
- package/core/mixins/FormCheckable.d.ts +1 -0
- package/core/mixins/FormElement.d.ts +1 -0
- package/core/mixins/FormElement.js +6 -2
- package/core/mixins/FormInput.d.ts +1 -0
- package/core/mixins/Subscriber.d.ts +1 -0
- package/core/mixins/Subscriber.js +12 -7
- package/core/utils/PublisherProxy.d.ts +30 -3
- package/core/utils/PublisherProxy.js +218 -6
- package/core/utils/api.d.ts +3 -0
- package/core/utils/api.js +3 -1
- package/mixins.d.ts +4 -1
- package/package.json +5 -1
|
@@ -4,87 +4,222 @@ 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 } from "lit";
|
|
7
|
+
import { html, LitElement, css, nothing } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
|
-
import { Subscriber, TemplatesContainer } from "@supersoniks/concorde/mixins";
|
|
9
|
+
import { FormInput, FormElement, Subscriber, TemplatesContainer, } from "@supersoniks/concorde/mixins";
|
|
10
10
|
import "@supersoniks/concorde/core/components/ui/form/input/input";
|
|
11
11
|
import "@supersoniks/concorde/core/components/ui/pop/pop";
|
|
12
12
|
import "@supersoniks/concorde/core/components/functional/queue/queue";
|
|
13
13
|
import "@supersoniks/concorde/core/components/ui/menu/menu-item";
|
|
14
14
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
15
|
+
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
15
16
|
/**
|
|
16
17
|
* Input avec autocomplete. Propose des valeurs à partir d'un sonic-queue.
|
|
17
18
|
* L'input permet de filtrer les choix de valeurs dans le sonic-pop.
|
|
18
19
|
* La valeur de cet input est ensuite retransmit au premier via un dataProvider.
|
|
19
20
|
*/
|
|
20
|
-
let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(Subscriber(LitElement)) {
|
|
21
|
+
let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(FormInput(FormElement(Subscriber(LitElement)))) {
|
|
21
22
|
constructor() {
|
|
22
23
|
super(...arguments);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Possibles mutualisation avec text
|
|
26
|
+
*/
|
|
27
|
+
this.size = "md";
|
|
26
28
|
this.placeholder = "";
|
|
27
29
|
this.filteredFields = "";
|
|
28
30
|
this.readonly = null;
|
|
29
31
|
this.dataProviderExpression = "";
|
|
30
32
|
this.key = "";
|
|
31
|
-
this.
|
|
32
|
-
|
|
33
|
+
this.searchParameter = "";
|
|
34
|
+
/**
|
|
35
|
+
* Les dataProviders
|
|
36
|
+
*/
|
|
37
|
+
this.searchDataProvider = "";
|
|
38
|
+
this.initSearchDataProvider = "";
|
|
39
|
+
this.queueDataProvider = "";
|
|
40
|
+
this.initQueueDataProvider = "";
|
|
41
|
+
this.lastValidSearch = "";
|
|
42
|
+
/**
|
|
43
|
+
* Les fonctions de gestion
|
|
44
|
+
*/
|
|
45
|
+
this.updateSearchParameter = (value) => {
|
|
46
|
+
if (value == "") {
|
|
47
|
+
this.lastValidSearch = "";
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.queryQueueListItem(this.queueDataProvider, this.findSelection, this.setSearchFromSelection);
|
|
51
|
+
};
|
|
52
|
+
this.initSearchParameter = () => {
|
|
53
|
+
this.queryQueueListItem(this.initQueueDataProvider, this.findSelection, this.setSearchFromSelection);
|
|
54
|
+
};
|
|
55
|
+
this.selectListItem = (listItem) => {
|
|
56
|
+
var _a;
|
|
57
|
+
(_a = this.formValuePublisher) === null || _a === void 0 ? void 0 : _a.set(listItem[this.name]);
|
|
58
|
+
};
|
|
59
|
+
this.findSearchedItem = (listItem) => {
|
|
60
|
+
var _a;
|
|
61
|
+
return (listItem[this.searchParameter || this.name] == ((_a = this.searchPublisher) === null || _a === void 0 ? void 0 : _a.get()));
|
|
62
|
+
};
|
|
63
|
+
this.findSelection = (listItem) => {
|
|
64
|
+
return listItem[this.name] == this.value;
|
|
65
|
+
};
|
|
66
|
+
this.setSearchFromSelection = (listItem) => {
|
|
67
|
+
var _a;
|
|
68
|
+
this.lastValidSearch = listItem[this.searchParameter || this.name];
|
|
69
|
+
(_a = this.searchPublisher) === null || _a === void 0 ? void 0 : _a.set(this.lastValidSearch);
|
|
70
|
+
};
|
|
71
|
+
this.updateActiveSelection = () => {
|
|
72
|
+
var _a, _b, _c;
|
|
73
|
+
this.queryQueueListItem(this.queueDataProvider, this.findSearchedItem, this.selectListItem);
|
|
74
|
+
if (!this.select &&
|
|
75
|
+
this.lastValidSearch &&
|
|
76
|
+
this.lastValidSearch != ((_a = this.searchPublisher) === null || _a === void 0 ? void 0 : _a.get()) &&
|
|
77
|
+
((_b = this.formValuePublisher) === null || _b === void 0 ? void 0 : _b.get())) {
|
|
78
|
+
(_c = this.formValuePublisher) === null || _c === void 0 ? void 0 : _c.set("");
|
|
79
|
+
}
|
|
80
|
+
};
|
|
33
81
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
82
|
+
connectedCallback() {
|
|
83
|
+
var _a, _b, _c;
|
|
84
|
+
super.connectedCallback();
|
|
85
|
+
/**
|
|
86
|
+
* Nom de la valeur de recherche
|
|
87
|
+
* Si non défini, on utilise name
|
|
88
|
+
**/
|
|
89
|
+
const searchParameter = this.searchParameter || this.name;
|
|
90
|
+
/**
|
|
91
|
+
* Nommage des différents dataProviders utilisés
|
|
92
|
+
*/
|
|
93
|
+
const formDataProvider = this.getAncestorAttributeValue("formDataProvider");
|
|
94
|
+
const dpPrefix = formDataProvider + "__autocomplete";
|
|
95
|
+
this.initSearchDataProvider = `${dpPrefix}_init_search__`;
|
|
96
|
+
this.initQueueDataProvider = `${dpPrefix}_init_queue__`;
|
|
97
|
+
this.searchDataProvider = `${dpPrefix}_search__`;
|
|
98
|
+
this.queueDataProvider = `${dpPrefix}_queue__`;
|
|
99
|
+
/**
|
|
100
|
+
* Les publishers utilisés plusieurs fois dans la classe son miss en propriétés privées de la classe
|
|
101
|
+
*/
|
|
102
|
+
const getPublisher = PublisherManager.get;
|
|
103
|
+
this.searchPublisher = getPublisher(this.searchDataProvider)[searchParameter];
|
|
104
|
+
this.formValuePublisher = getPublisher(formDataProvider)[this.name];
|
|
105
|
+
this.countPublisher = getPublisher(this.queueDataProvider).resultCount;
|
|
106
|
+
this.initCountPublisher = getPublisher(this.initQueueDataProvider).resultCount;
|
|
107
|
+
/**
|
|
108
|
+
* Si une valeur est fourrnie a l'initialisation, un queue spécifique appelle le service avec le name founi en paramètre
|
|
109
|
+
* Pour récupérer la valeur de searchParameter correspondante et renseigner l'input
|
|
110
|
+
**/
|
|
111
|
+
if (this.value) {
|
|
112
|
+
PublisherManager.get(this.initSearchDataProvider)[this.name] = this.value;
|
|
113
|
+
}
|
|
114
|
+
(_a = this.initCountPublisher) === null || _a === void 0 ? void 0 : _a.onAssign(this.initSearchParameter);
|
|
115
|
+
/**
|
|
116
|
+
* Lorsque la sélection change, on met à jour la valeur de recherche
|
|
117
|
+
*/
|
|
118
|
+
(_b = this.formValuePublisher) === null || _b === void 0 ? void 0 : _b.onAssign(this.updateSearchParameter);
|
|
119
|
+
/**
|
|
120
|
+
* Lorsque La valeur de recherche change, que le composant n'est pas en mode select
|
|
121
|
+
* et qu'elle est différente de la derniere recherche valide on désactive la selection
|
|
122
|
+
*/
|
|
123
|
+
(_c = this.countPublisher) === null || _c === void 0 ? void 0 : _c.onAssign(this.updateActiveSelection);
|
|
45
124
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
125
|
+
disconnectedCallback() {
|
|
126
|
+
var _a, _b, _c;
|
|
127
|
+
super.disconnectedCallback();
|
|
128
|
+
(_a = this.initCountPublisher) === null || _a === void 0 ? void 0 : _a.offAssign(this.initSearchParameter);
|
|
129
|
+
(_b = this.formValuePublisher) === null || _b === void 0 ? void 0 : _b.offAssign(this.updateSearchParameter);
|
|
130
|
+
(_c = this.countPublisher) === null || _c === void 0 ? void 0 : _c.offAssign(this.updateActiveSelection);
|
|
131
|
+
const getPublisher = PublisherManager.get;
|
|
132
|
+
getPublisher(this.initSearchDataProvider).delete();
|
|
133
|
+
getPublisher(this.initQueueDataProvider).delete();
|
|
134
|
+
getPublisher(this.searchDataProvider).delete();
|
|
135
|
+
getPublisher(this.queueDataProvider).delete();
|
|
51
136
|
}
|
|
52
|
-
|
|
53
|
-
|
|
137
|
+
queryQueueListItem(queueDataProvider, itemFinder, itemMutator) {
|
|
138
|
+
const queuePublisher = PublisherManager.get(queueDataProvider);
|
|
139
|
+
let listItem;
|
|
140
|
+
const listsDescriptors = queuePublisher.get();
|
|
141
|
+
if (!Array.isArray(listsDescriptors))
|
|
142
|
+
return;
|
|
143
|
+
for (const listDescriptor of listsDescriptors) {
|
|
144
|
+
const list = PublisherManager.get(listDescriptor.dataProvider).get();
|
|
145
|
+
if (!Array.isArray(list))
|
|
146
|
+
continue;
|
|
147
|
+
listItem = list.find(itemFinder);
|
|
148
|
+
console.log(listItem);
|
|
149
|
+
if (listItem) {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (listItem) {
|
|
154
|
+
itemMutator(listItem);
|
|
155
|
+
}
|
|
54
156
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this._label = value;
|
|
59
|
-
this.requestUpdate();
|
|
157
|
+
setSelectionRange(start, end) {
|
|
158
|
+
var _a;
|
|
159
|
+
(_a = this.querySelector("sonic-input")) === null || _a === void 0 ? void 0 : _a.setSelectionRange(start, end);
|
|
60
160
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
161
|
+
handleHide() {
|
|
162
|
+
var _a, _b, _c;
|
|
163
|
+
if (!this.select)
|
|
164
|
+
return;
|
|
165
|
+
if (((_a = this.searchPublisher) === null || _a === void 0 ? void 0 : _a.get()) == "") {
|
|
166
|
+
this.lastValidSearch = "";
|
|
167
|
+
(_b = this.formValuePublisher) === null || _b === void 0 ? void 0 : _b.set("");
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
(_c = this.searchPublisher) === null || _c === void 0 ? void 0 : _c.set(this.lastValidSearch);
|
|
64
171
|
}
|
|
65
172
|
render() {
|
|
66
173
|
return html `
|
|
67
|
-
<sonic-pop noToggle style="display:block;">
|
|
174
|
+
<sonic-pop noToggle style="display:block;" @hide=${this.handleHide}>
|
|
68
175
|
<sonic-input
|
|
176
|
+
debug
|
|
177
|
+
dataProvider="${this.initSearchDataProvider + Math.random()}"
|
|
178
|
+
formDataProvider="${this.searchDataProvider}"
|
|
69
179
|
type="search"
|
|
70
|
-
data-keyboard-nav="nav
|
|
180
|
+
data-keyboard-nav="${this.getAttribute("data-keyboard-nav") || ""}"
|
|
71
181
|
label="${ifDefined(this.label)}"
|
|
72
182
|
description="${ifDefined(this.description)}"
|
|
73
|
-
name="${ifDefined(this.name)}"
|
|
74
|
-
|
|
183
|
+
name="${ifDefined(this.searchParameter || this.name)}"
|
|
184
|
+
placeholder="${ifDefined(this.placeholder)}"
|
|
185
|
+
?readonly="${this.readonly}"
|
|
75
186
|
autocomplete="off"
|
|
76
187
|
clearable
|
|
77
|
-
|
|
188
|
+
inlineContent
|
|
189
|
+
size=${this.size}
|
|
190
|
+
>
|
|
191
|
+
${this.select
|
|
192
|
+
? html `
|
|
193
|
+
<sonic-icon
|
|
194
|
+
slot="suffix"
|
|
195
|
+
class="select-chevron"
|
|
196
|
+
name="nav-arrow-down"
|
|
197
|
+
.size=${this.size}
|
|
198
|
+
></sonic-icon>
|
|
199
|
+
`
|
|
200
|
+
: nothing}
|
|
201
|
+
</sonic-input>
|
|
78
202
|
<sonic-menu slot="content">
|
|
79
203
|
<sonic-queue
|
|
204
|
+
dataProvider="${this.queueDataProvider}"
|
|
80
205
|
filteredFields=${this.filteredFields}
|
|
81
206
|
dataProviderExpression="${this.dataProviderExpression}"
|
|
82
|
-
dataFilterProvider="${this.
|
|
207
|
+
dataFilterProvider="${this.searchDataProvider}"
|
|
83
208
|
key="${this.key}"
|
|
84
209
|
.templates=${this.templateList}
|
|
85
210
|
displayContents
|
|
86
211
|
>
|
|
87
212
|
</sonic-queue>
|
|
213
|
+
<sonic-queue
|
|
214
|
+
noLazyload
|
|
215
|
+
dataProvider="${this.initQueueDataProvider}"
|
|
216
|
+
filteredFields=${this.filteredFields}
|
|
217
|
+
dataProviderExpression="${this.dataProviderExpression}"
|
|
218
|
+
dataFilterProvider="${this.initSearchDataProvider}"
|
|
219
|
+
key="${this.key}"
|
|
220
|
+
displayContents
|
|
221
|
+
>
|
|
222
|
+
</sonic-queue>
|
|
88
223
|
</sonic-menu>
|
|
89
224
|
</sonic-pop>
|
|
90
225
|
`;
|
|
@@ -98,17 +233,8 @@ InputAutocomplete.styles = [
|
|
|
98
233
|
`,
|
|
99
234
|
];
|
|
100
235
|
__decorate([
|
|
101
|
-
property()
|
|
102
|
-
], InputAutocomplete.prototype, "
|
|
103
|
-
__decorate([
|
|
104
|
-
property()
|
|
105
|
-
], InputAutocomplete.prototype, "forceAutoFill", void 0);
|
|
106
|
-
__decorate([
|
|
107
|
-
property()
|
|
108
|
-
], InputAutocomplete.prototype, "description", null);
|
|
109
|
-
__decorate([
|
|
110
|
-
property()
|
|
111
|
-
], InputAutocomplete.prototype, "label", null);
|
|
236
|
+
property({ type: String })
|
|
237
|
+
], InputAutocomplete.prototype, "size", void 0);
|
|
112
238
|
__decorate([
|
|
113
239
|
property({ type: String })
|
|
114
240
|
], InputAutocomplete.prototype, "placeholder", void 0);
|
|
@@ -121,12 +247,15 @@ __decorate([
|
|
|
121
247
|
__decorate([
|
|
122
248
|
property({ type: String })
|
|
123
249
|
], InputAutocomplete.prototype, "dataProviderExpression", void 0);
|
|
250
|
+
__decorate([
|
|
251
|
+
property({ type: Boolean })
|
|
252
|
+
], InputAutocomplete.prototype, "select", void 0);
|
|
124
253
|
__decorate([
|
|
125
254
|
property({ type: String })
|
|
126
255
|
], InputAutocomplete.prototype, "key", void 0);
|
|
127
256
|
__decorate([
|
|
128
257
|
property({ type: String })
|
|
129
|
-
], InputAutocomplete.prototype, "
|
|
258
|
+
], InputAutocomplete.prototype, "searchParameter", void 0);
|
|
130
259
|
InputAutocomplete = __decorate([
|
|
131
260
|
customElement("sonic-input-autocomplete")
|
|
132
261
|
], InputAutocomplete);
|
|
@@ -55,6 +55,7 @@ declare const Textarea_base: {
|
|
|
55
55
|
getAttribute(name: string): string;
|
|
56
56
|
hasAttribute(attributeName: string): boolean;
|
|
57
57
|
disconnectedCallback(): void;
|
|
58
|
+
getBoundingClientRect(): DOMRect;
|
|
58
59
|
};
|
|
59
60
|
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/FormElement").FormElementInterface) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../../_types/types").CoreJSType>) & typeof LitElement;
|
|
60
61
|
export declare class Textarea extends Textarea_base {
|
|
@@ -44,7 +44,7 @@ let Icon = class Icon extends LitElement {
|
|
|
44
44
|
return;
|
|
45
45
|
this.renderId++;
|
|
46
46
|
const frameRenderId = this.renderId;
|
|
47
|
-
window.requestAnimationFrame(() => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
(window.queueMicrotask || window.requestAnimationFrame)(() => __awaiter(this, void 0, void 0, function* () {
|
|
48
48
|
if (frameRenderId != this.renderId) {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
@@ -26,9 +26,8 @@ ModalClose.styles = [
|
|
|
26
26
|
display: block;
|
|
27
27
|
align-self: flex-end;
|
|
28
28
|
height: 0;
|
|
29
|
-
top: 0;
|
|
30
|
-
|
|
31
|
-
padding-right: 0.5rem;
|
|
29
|
+
top: 0.5rem;
|
|
30
|
+
right: 0.5rem;
|
|
32
31
|
transform: translate3d(calc(var(--sc-modal-px)), calc(-1 * var(--sc-modal-py)), 0);
|
|
33
32
|
z-index: 20;
|
|
34
33
|
}
|
|
@@ -6,17 +6,25 @@ import "@supersoniks/concorde/core/components/ui/modal/modal-subtitle";
|
|
|
6
6
|
import "@supersoniks/concorde/core/components/ui/modal/modal-title";
|
|
7
7
|
declare type ModalCreateOptions = {
|
|
8
8
|
content?: string;
|
|
9
|
+
zIndex?: string;
|
|
10
|
+
paddingX?: string;
|
|
11
|
+
paddingY?: string;
|
|
12
|
+
width?: string;
|
|
13
|
+
maxWidth?: string;
|
|
14
|
+
removeOnHide?: boolean;
|
|
9
15
|
};
|
|
10
16
|
declare const Modal_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("@supersoniks/concorde/core/_types/types").CoreJSType>) & typeof LitElement;
|
|
11
17
|
export declare class Modal extends Modal_base {
|
|
12
18
|
static styles: import("lit").CSSResult[];
|
|
13
19
|
forceAction: boolean;
|
|
20
|
+
removeOnHide: boolean;
|
|
14
21
|
align: "center" | "right" | "left";
|
|
15
22
|
padding: string;
|
|
16
23
|
maxWidth: string;
|
|
17
24
|
maxHeight: string;
|
|
18
25
|
width: string;
|
|
19
26
|
height: string;
|
|
27
|
+
zIndex: string;
|
|
20
28
|
fullScreen: boolean;
|
|
21
29
|
visible: boolean;
|
|
22
30
|
modalWrapper: HTMLDivElement;
|
|
@@ -21,17 +21,33 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
23
23
|
this.forceAction = false;
|
|
24
|
+
this.removeOnHide = false;
|
|
24
25
|
this.align = "left";
|
|
25
26
|
this.padding = "var(--sc-modal-py) var(--sc-modal-px)";
|
|
26
27
|
this.maxWidth = "var(--sc-modal-max-w) ";
|
|
27
28
|
this.maxHeight = "var(--sc-modal-max-h) ";
|
|
28
29
|
this.width = "100%";
|
|
29
30
|
this.height = "auto";
|
|
31
|
+
this.zIndex = "var(--sc-modal-z-index)";
|
|
30
32
|
this.fullScreen = false;
|
|
31
33
|
this.visible = false;
|
|
32
34
|
}
|
|
33
35
|
static create(options) {
|
|
34
36
|
const modal = document.createElement(tagName);
|
|
37
|
+
// modal styles
|
|
38
|
+
if (options.removeOnHide === true)
|
|
39
|
+
modal.setAttribute("removeOnHide", "true");
|
|
40
|
+
if (options.maxWidth)
|
|
41
|
+
modal.maxWidth = options === null || options === void 0 ? void 0 : options.maxWidth;
|
|
42
|
+
if (options.width)
|
|
43
|
+
modal.width = options === null || options === void 0 ? void 0 : options.width;
|
|
44
|
+
if (options.paddingX)
|
|
45
|
+
modal.style.setProperty("--sc-modal-px", options === null || options === void 0 ? void 0 : options.paddingX);
|
|
46
|
+
if (options.paddingY)
|
|
47
|
+
modal.style.setProperty("--sc-modal-py", options === null || options === void 0 ? void 0 : options.paddingY);
|
|
48
|
+
if (options.zIndex)
|
|
49
|
+
modal.style.setProperty("--sc-modal-z-index", options === null || options === void 0 ? void 0 : options.zIndex);
|
|
50
|
+
// inner content
|
|
35
51
|
modal.innerHTML =
|
|
36
52
|
`<sonic-modal-close></sonic-modal-close><sonic-modal-content>${options.content}</sonic-modal-content>` || "";
|
|
37
53
|
const container = document.querySelector("sonic-theme") || document.body;
|
|
@@ -67,6 +83,7 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
67
83
|
maxHeight: this.maxHeight,
|
|
68
84
|
width: this.width,
|
|
69
85
|
height: this.height,
|
|
86
|
+
zIndex: this.zIndex,
|
|
70
87
|
borderRadius: this.fullScreen ? "0" : "var(--sc-modal-rounded)",
|
|
71
88
|
};
|
|
72
89
|
const modalWrapperStyles = {
|
|
@@ -105,7 +122,7 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
105
122
|
|
|
106
123
|
<div
|
|
107
124
|
class="overlay"
|
|
108
|
-
@click="${!this.forceAction ? this.hide :
|
|
125
|
+
@click="${!this.forceAction ? this.hide : null}"
|
|
109
126
|
${animate({
|
|
110
127
|
keyframeOptions: {
|
|
111
128
|
duration: 500,
|
|
@@ -130,6 +147,9 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
130
147
|
if (this.hasAttribute("resetDataProviderOnHide")) {
|
|
131
148
|
PublisherManager.get(this.getAttribute("resetDataProviderOnHide")).set({});
|
|
132
149
|
}
|
|
150
|
+
if (this.removeOnHide) {
|
|
151
|
+
this.remove();
|
|
152
|
+
}
|
|
133
153
|
}
|
|
134
154
|
dispose() {
|
|
135
155
|
this.hide();
|
|
@@ -138,9 +158,9 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
138
158
|
handleEscape(e) {
|
|
139
159
|
if (e.key === "Escape") {
|
|
140
160
|
const modals = [...document.querySelectorAll(tagName)];
|
|
141
|
-
modals.forEach((
|
|
142
|
-
if (!
|
|
143
|
-
|
|
161
|
+
modals.forEach((modal) => {
|
|
162
|
+
if (!modal.forceAction) {
|
|
163
|
+
modal.hide();
|
|
144
164
|
}
|
|
145
165
|
});
|
|
146
166
|
}
|
|
@@ -164,6 +184,7 @@ Modal.styles = [
|
|
|
164
184
|
--sc-modal-max-w: min(100vw, 64ch);
|
|
165
185
|
--sc-modal-max-h: 80vh;
|
|
166
186
|
--sc-modal-rounded: var(--sc-rounded-lg);
|
|
187
|
+
--sc-modal-z-index: 990;
|
|
167
188
|
}
|
|
168
189
|
|
|
169
190
|
* {
|
|
@@ -175,7 +196,7 @@ Modal.styles = [
|
|
|
175
196
|
bottom: 0;
|
|
176
197
|
left: 0;
|
|
177
198
|
width: 100%;
|
|
178
|
-
z-index:
|
|
199
|
+
z-index: calc(var(--sc-modal-z-index) + 1);
|
|
179
200
|
align-items: center;
|
|
180
201
|
justify-content: center;
|
|
181
202
|
flex-direction: column;
|
|
@@ -207,7 +228,7 @@ Modal.styles = [
|
|
|
207
228
|
top: 0;
|
|
208
229
|
right: 0;
|
|
209
230
|
bottom: 0;
|
|
210
|
-
z-index:
|
|
231
|
+
z-index: var(--sc-modal-z-index);
|
|
211
232
|
opacity: 0.8;
|
|
212
233
|
position: fixed;
|
|
213
234
|
}
|
|
@@ -226,6 +247,7 @@ Modal.styles = [
|
|
|
226
247
|
.modal {
|
|
227
248
|
max-width: none !important;
|
|
228
249
|
width: 100% !important;
|
|
250
|
+
border-radius: var(--sc-modal-rounded) var(--sc-modal-rounded) 0 0 !important;
|
|
229
251
|
}
|
|
230
252
|
}
|
|
231
253
|
|
|
@@ -270,6 +292,9 @@ Modal.styles = [
|
|
|
270
292
|
__decorate([
|
|
271
293
|
property({ type: Boolean })
|
|
272
294
|
], Modal.prototype, "forceAction", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
property({ type: Boolean })
|
|
297
|
+
], Modal.prototype, "removeOnHide", void 0);
|
|
273
298
|
__decorate([
|
|
274
299
|
property({ type: String, reflect: true })
|
|
275
300
|
], Modal.prototype, "align", void 0);
|
|
@@ -288,6 +313,9 @@ __decorate([
|
|
|
288
313
|
__decorate([
|
|
289
314
|
property({ type: String })
|
|
290
315
|
], Modal.prototype, "height", void 0);
|
|
316
|
+
__decorate([
|
|
317
|
+
property({ type: String })
|
|
318
|
+
], Modal.prototype, "zIndex", void 0);
|
|
291
319
|
__decorate([
|
|
292
320
|
property({ type: Boolean, reflect: true })
|
|
293
321
|
], Modal.prototype, "fullScreen", void 0);
|
|
@@ -51,11 +51,13 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
51
51
|
this.lastContentY = 0;
|
|
52
52
|
this.runPositioningLoop();
|
|
53
53
|
}
|
|
54
|
+
this.dispatchEvent(new CustomEvent("show"));
|
|
54
55
|
}
|
|
55
56
|
_hide() {
|
|
56
57
|
this.open = false;
|
|
57
58
|
this.popContent.setAttribute("tabindex", "-1");
|
|
58
59
|
this.positioningRuns = false;
|
|
60
|
+
this.dispatchEvent(new CustomEvent("hide"));
|
|
59
61
|
}
|
|
60
62
|
_handleClosePop(e) {
|
|
61
63
|
const path = e.composedPath();
|
|
@@ -66,7 +68,8 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
66
68
|
const isCloseManual = HTML.getAncestorAttributeValue(target, "data-on-select") === "keep";
|
|
67
69
|
if (e.type == "pointerdown" && popContainsTarget)
|
|
68
70
|
return;
|
|
69
|
-
if (e.type == "click" &&
|
|
71
|
+
if (e.type == "click" &&
|
|
72
|
+
((popContainsTarget && isCloseManual) || !popContentContainsTarget))
|
|
70
73
|
return;
|
|
71
74
|
pop._hide();
|
|
72
75
|
});
|
|
@@ -85,7 +88,6 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
85
88
|
firstUpdated(_changedProperties) {
|
|
86
89
|
super.firstUpdated(_changedProperties);
|
|
87
90
|
this.resizeObserver.observe(this.popContent);
|
|
88
|
-
this.computePosition(this.placement);
|
|
89
91
|
}
|
|
90
92
|
disconnectedCallback() {
|
|
91
93
|
super.disconnectedCallback();
|
|
@@ -144,9 +146,11 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
144
146
|
x = xRight;
|
|
145
147
|
if (contentRect.y < shiftPadding && placement == "top")
|
|
146
148
|
y = yBottom;
|
|
147
|
-
if (contentRect.x + contentRect.width > window.innerWidth - shiftPadding &&
|
|
149
|
+
if (contentRect.x + contentRect.width > window.innerWidth - shiftPadding &&
|
|
150
|
+
placement == "right")
|
|
148
151
|
x = xLeft;
|
|
149
|
-
if (contentRect.y + contentRect.height > window.innerHeight - shiftPadding &&
|
|
152
|
+
if (contentRect.y + contentRect.height > window.innerHeight - shiftPadding &&
|
|
153
|
+
placement == "bottom")
|
|
150
154
|
y = yTop;
|
|
151
155
|
this.lastContentX += x - contentRect.x;
|
|
152
156
|
this.lastContentY += y - contentRect.y;
|
|
@@ -162,10 +166,12 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
162
166
|
this.lastContentY += -contentRect.y;
|
|
163
167
|
}
|
|
164
168
|
if (contentRect.x + contentRect.width > window.innerWidth) {
|
|
165
|
-
this.lastContentX +=
|
|
169
|
+
this.lastContentX +=
|
|
170
|
+
window.innerWidth - (contentRect.x + contentRect.width);
|
|
166
171
|
}
|
|
167
172
|
if (contentRect.y + contentRect.height > window.innerHeight) {
|
|
168
|
-
this.lastContentY +=
|
|
173
|
+
this.lastContentY +=
|
|
174
|
+
window.innerHeight - (contentRect.y + contentRect.height);
|
|
169
175
|
}
|
|
170
176
|
Object.assign(this.popContent.style, {
|
|
171
177
|
left: `${this.lastContentX}px`,
|
|
@@ -174,11 +180,16 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
174
180
|
}
|
|
175
181
|
render() {
|
|
176
182
|
return html `
|
|
177
|
-
<slot
|
|
183
|
+
<slot
|
|
184
|
+
@click=${this._toggle}
|
|
185
|
+
@keydown=${this._toggle}
|
|
186
|
+
class="contents"
|
|
187
|
+
></slot>
|
|
178
188
|
<slot
|
|
179
189
|
name="content"
|
|
180
190
|
tabindex="-1"
|
|
181
191
|
part="content"
|
|
192
|
+
style="display: none;"
|
|
182
193
|
class="
|
|
183
194
|
${this.open ? "is-open" : ""}"
|
|
184
195
|
></slot>
|
|
@@ -2,12 +2,13 @@ import { css } from "lit";
|
|
|
2
2
|
export const coreVariables = css `
|
|
3
3
|
:host {
|
|
4
4
|
/* polices*/
|
|
5
|
-
--sc-font-family-base: "Inter var", "Inter", -apple-system, system-ui,
|
|
6
|
-
"Helvetica Neue", Arial,
|
|
5
|
+
--sc-font-family-base: "Inter var", "Inter", -apple-system, system-ui,
|
|
6
|
+
BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
|
7
|
+
sans-serif;
|
|
7
8
|
--sc-font-weight-base: 400;
|
|
8
9
|
--sc-font-style-base: normal;
|
|
9
10
|
|
|
10
|
-
--sc-headings-font-family: var(--sc-font-family-base);
|
|
11
|
+
--sc-headings-font-family: var(--sc-font-family-base), sans-serif;
|
|
11
12
|
--sc-headings-font-style: var(--sc-font-style-base);
|
|
12
13
|
--sc-headings-line-height: 1.1;
|
|
13
14
|
--sc-headings-font-weight: 700;
|
|
@@ -29,16 +30,23 @@ export const coreVariables = css `
|
|
|
29
30
|
/* 4 for rounded full*/
|
|
30
31
|
--sc-btn-rounded-intensity: 1.4;
|
|
31
32
|
--sc-btn-font-weight: 500;
|
|
32
|
-
--sc-btn-rounded: calc(
|
|
33
|
+
--sc-btn-rounded: calc(
|
|
34
|
+
(var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
|
|
35
|
+
var(--sc-btn-rounded-intensity)
|
|
36
|
+
);
|
|
33
37
|
|
|
34
38
|
/* Placeholder */
|
|
35
39
|
--sc-placeholder-bg: rgba(17, 24, 39, 0.05);
|
|
36
40
|
|
|
37
41
|
/* OMBRES */
|
|
38
|
-
--sc-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1),
|
|
39
|
-
|
|
40
|
-
--sc-shadow
|
|
41
|
-
|
|
42
|
+
--sc-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1),
|
|
43
|
+
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
44
|
+
--sc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1),
|
|
45
|
+
0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
46
|
+
--sc-shadow-lg: 0 10px 15px 0px rgb(0 0 0 / 0.1),
|
|
47
|
+
0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
48
|
+
--sc-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
|
|
49
|
+
0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
42
50
|
--sc-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
|
|
43
51
|
|
|
44
52
|
/* Forms */
|
|
@@ -50,7 +58,8 @@ export const coreVariables = css `
|
|
|
50
58
|
--sc-input-border-color: var(--sc-input-bg);
|
|
51
59
|
--sc-input-rounded-intensity: 1.4;
|
|
52
60
|
--sc-input-rounded: calc(
|
|
53
|
-
(var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
|
|
61
|
+
(var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
|
|
62
|
+
var(--sc-input-rounded-intensity)
|
|
54
63
|
);
|
|
55
64
|
--sc-label-font-weight: 500;
|
|
56
65
|
|
|
@@ -30,7 +30,8 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
30
30
|
const fontUrls = [];
|
|
31
31
|
for (let i = 0; i < ssLength; i++) {
|
|
32
32
|
const ss = stylesheets[i];
|
|
33
|
-
if (ss.href &&
|
|
33
|
+
if (ss.href &&
|
|
34
|
+
(ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
|
|
34
35
|
fontUrls.push(ss.href);
|
|
35
36
|
}
|
|
36
37
|
document.querySelectorAll("iframe").forEach((elt) => {
|
|
@@ -50,7 +51,11 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
50
51
|
}
|
|
51
52
|
getCssVariables() {
|
|
52
53
|
const names = [];
|
|
53
|
-
const stylesheets = [
|
|
54
|
+
const stylesheets = [
|
|
55
|
+
...Theme_1.styles.map((s) => s.styleSheet),
|
|
56
|
+
...Array.from(document.styleSheets),
|
|
57
|
+
];
|
|
58
|
+
console.log(stylesheets);
|
|
54
59
|
for (const stylesheet of stylesheets) {
|
|
55
60
|
try {
|
|
56
61
|
if (!stylesheet)
|
|
@@ -96,7 +101,7 @@ Theme.styles = [
|
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
:host([font]) {
|
|
99
|
-
font-family: var(--sc-font-family-base);
|
|
104
|
+
font-family: var(--sc-font-family-base), sans-serif;
|
|
100
105
|
font-weight: var(--sc-font-weight-base);
|
|
101
106
|
font-style: var(--sc-font-style-base);
|
|
102
107
|
}
|