@supersoniks/concorde 1.1.40 → 1.1.42
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 +12 -12
- package/concorde-core.es.js +1518 -1002
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +59 -0
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +219 -0
- package/core/components/functional/sdui/sdui.d.ts +81 -21
- package/core/components/functional/sdui/sdui.js +190 -78
- package/core/components/functional/sdui/types.d.ts +35 -0
- package/core/components/functional/sdui/types.js +1 -0
- package/core/components/ui/alert/alert.d.ts +2 -2
- package/core/components/ui/alert/alert.js +12 -11
- package/core/components/ui/divider/divider.js +1 -1
- package/core/components/ui/form/checkbox/checkbox.js +2 -1
- package/core/components/ui/form/fieldset/legend.js +1 -1
- package/core/components/ui/form/input/input.d.ts +4 -0
- package/core/components/ui/form/input/input.js +20 -3
- package/core/components/ui/form/input/password-helper.d.ts +25 -0
- package/core/components/ui/form/input/password-helper.js +118 -0
- package/core/components/ui/form/input/same-value-helper.d.ts +16 -0
- package/core/components/ui/form/input/same-value-helper.js +76 -0
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +35 -0
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +137 -0
- package/core/components/ui/form/select/select.js +5 -1
- package/core/components/ui/form/textarea/textarea.js +5 -1
- package/core/components/ui/pop/pop.d.ts +4 -4
- package/core/components/ui/pop/pop.js +43 -42
- package/core/components/ui/ui.d.ts +3 -0
- package/core/components/ui/ui.js +3 -0
- package/core/mixins/Fetcher.js +6 -2
- package/core/utils/HTML.d.ts +8 -0
- package/core/utils/HTML.js +41 -0
- package/package.json +11 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement, nothing } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import { Subscriber } from "@supersoniks/concorde/mixins";
|
|
10
|
+
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
11
|
+
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
12
|
+
const tagName = "sonic-password-helper"; // For Astro.build
|
|
13
|
+
let SonicComponent = class SonicComponent extends Subscriber(LitElement) {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.minChars = 8;
|
|
17
|
+
this.hasNoChar = true;
|
|
18
|
+
this.hasEnoughChars = false;
|
|
19
|
+
this.hasMinuscule = false;
|
|
20
|
+
this.hasMajuscule = false;
|
|
21
|
+
this.hasNumber = false;
|
|
22
|
+
this.hasSpecialChar = false;
|
|
23
|
+
this.wording_password_helper_decription = "Le mot de passe doit contenir au moins :";
|
|
24
|
+
this.wording_password_helper_min_length = "8 caractères";
|
|
25
|
+
this.wording_password_helper_lower_case = "1 minuscule";
|
|
26
|
+
this.wording_password_helper_upper_case = "1 majuscule";
|
|
27
|
+
this.wording_password_helper_number = "1 chiffre";
|
|
28
|
+
this.wording_password_helper_special_char = "1 caractère spécial";
|
|
29
|
+
}
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
super.connectedCallback();
|
|
32
|
+
if (this.name) {
|
|
33
|
+
this.checkValue = (v) => {
|
|
34
|
+
if (v) {
|
|
35
|
+
this.hasNoChar = v.length == 0;
|
|
36
|
+
this.hasEnoughChars = v.length > this.minChars;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.hasNoChar = true;
|
|
40
|
+
this.hasEnoughChars = false;
|
|
41
|
+
}
|
|
42
|
+
this.hasMinuscule = /[a-z]/.test(v);
|
|
43
|
+
this.hasMajuscule = /[A-Z]/.test(v);
|
|
44
|
+
this.hasNumber = /[0-9]/.test(v);
|
|
45
|
+
this.hasSpecialChar = /[!"#$%&'()*+,\-\.\/:;<=>?@[\]^_`{|}~]/.test(v);
|
|
46
|
+
};
|
|
47
|
+
PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"))[this.name].onAssign(this.checkValue);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
disconnectedCallback() {
|
|
51
|
+
if (this.checkValue && this.name) {
|
|
52
|
+
PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"))[this.name].offAssign(this.checkValue);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
getIcon(test) {
|
|
56
|
+
return test
|
|
57
|
+
? html `<sonic-icon library="heroicons" , name="face-smile"></sonic-icon>`
|
|
58
|
+
: html `<sonic-icon library="heroicons" , name="x-circle"></sonic-icon>`;
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
if (this.hasNoChar)
|
|
62
|
+
return nothing;
|
|
63
|
+
return html `
|
|
64
|
+
<div>${this.wording_password_helper_decription}</div>
|
|
65
|
+
<div>${this.getIcon(this.hasEnoughChars)} ${this.wording_password_helper_min_length}</div>
|
|
66
|
+
<div>${this.getIcon(this.hasMinuscule)} ${this.wording_password_helper_lower_case}</div>
|
|
67
|
+
<div>${this.getIcon(this.hasMajuscule)} ${this.wording_password_helper_upper_case}</div>
|
|
68
|
+
<div>${this.getIcon(this.hasNumber)} ${this.wording_password_helper_number}</div>
|
|
69
|
+
<div>${this.getIcon(this.hasSpecialChar)} ${this.wording_password_helper_special_char}</div>
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
__decorate([
|
|
74
|
+
property()
|
|
75
|
+
], SonicComponent.prototype, "name", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
property()
|
|
78
|
+
], SonicComponent.prototype, "minChars", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
state()
|
|
81
|
+
], SonicComponent.prototype, "hasNoChar", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
state()
|
|
84
|
+
], SonicComponent.prototype, "hasEnoughChars", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
state()
|
|
87
|
+
], SonicComponent.prototype, "hasMinuscule", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
state()
|
|
90
|
+
], SonicComponent.prototype, "hasMajuscule", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
state()
|
|
93
|
+
], SonicComponent.prototype, "hasNumber", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
state()
|
|
96
|
+
], SonicComponent.prototype, "hasSpecialChar", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
property()
|
|
99
|
+
], SonicComponent.prototype, "wording_password_helper_decription", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
property()
|
|
102
|
+
], SonicComponent.prototype, "wording_password_helper_min_length", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
property()
|
|
105
|
+
], SonicComponent.prototype, "wording_password_helper_lower_case", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
property()
|
|
108
|
+
], SonicComponent.prototype, "wording_password_helper_upper_case", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
property()
|
|
111
|
+
], SonicComponent.prototype, "wording_password_helper_number", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
property()
|
|
114
|
+
], SonicComponent.prototype, "wording_password_helper_special_char", void 0);
|
|
115
|
+
SonicComponent = __decorate([
|
|
116
|
+
customElement(tagName)
|
|
117
|
+
], SonicComponent);
|
|
118
|
+
export { SonicComponent };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement, nothing } from "lit";
|
|
2
|
+
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
3
|
+
declare const SonicComponent_base: (new (...args: any[]) => import("../../../../mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
4
|
+
export declare class SonicComponent extends SonicComponent_base {
|
|
5
|
+
name?: string;
|
|
6
|
+
sameValueAs?: string;
|
|
7
|
+
descriptionWhenEqual: string;
|
|
8
|
+
descriptionWhenNotEqual: string;
|
|
9
|
+
areEqual: boolean;
|
|
10
|
+
hasNoChar: boolean;
|
|
11
|
+
checkValue?: (v: string) => void;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
disconnectedCallback(): void;
|
|
14
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement, nothing } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import { Subscriber } from "@supersoniks/concorde/mixins";
|
|
10
|
+
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
11
|
+
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
12
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
13
|
+
const tagName = "sonic-same-value-helper"; // For Astro.build
|
|
14
|
+
let SonicComponent = class SonicComponent extends Subscriber(LitElement) {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.descriptionWhenEqual = "Correspondance : oui";
|
|
18
|
+
this.descriptionWhenNotEqual = "Correspondance : non";
|
|
19
|
+
this.areEqual = false;
|
|
20
|
+
this.hasNoChar = true;
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback();
|
|
24
|
+
let formDataProvider = PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"));
|
|
25
|
+
if (this.name && this.sameValueAs) {
|
|
26
|
+
this.checkValue = (v) => {
|
|
27
|
+
if (v)
|
|
28
|
+
this.hasNoChar = v.length == 0;
|
|
29
|
+
else
|
|
30
|
+
this.hasNoChar = true;
|
|
31
|
+
if (this.name && this.sameValueAs) {
|
|
32
|
+
this.areEqual = formDataProvider[this.name].get() == formDataProvider[this.sameValueAs].get();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
formDataProvider[this.name].onAssign(this.checkValue);
|
|
36
|
+
formDataProvider[this.sameValueAs].onAssign(this.checkValue);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
if (this.checkValue && this.name && this.sameValueAs) {
|
|
41
|
+
let formDataProvider = PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"));
|
|
42
|
+
formDataProvider[this.name].offAssign(this.checkValue);
|
|
43
|
+
formDataProvider[this.sameValueAs].offAssign(this.checkValue);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//TODO Multilangue
|
|
47
|
+
render() {
|
|
48
|
+
if (this.hasNoChar)
|
|
49
|
+
return nothing;
|
|
50
|
+
return html `
|
|
51
|
+
<span> ${this.areEqual ? unsafeHTML(this.descriptionWhenEqual) : unsafeHTML(this.descriptionWhenNotEqual)} </span>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
__decorate([
|
|
56
|
+
property()
|
|
57
|
+
], SonicComponent.prototype, "name", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
property()
|
|
60
|
+
], SonicComponent.prototype, "sameValueAs", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
property()
|
|
63
|
+
], SonicComponent.prototype, "descriptionWhenEqual", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
property()
|
|
66
|
+
], SonicComponent.prototype, "descriptionWhenNotEqual", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
state()
|
|
69
|
+
], SonicComponent.prototype, "areEqual", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
state()
|
|
72
|
+
], SonicComponent.prototype, "hasNoChar", void 0);
|
|
73
|
+
SonicComponent = __decorate([
|
|
74
|
+
customElement(tagName)
|
|
75
|
+
], SonicComponent);
|
|
76
|
+
export { SonicComponent };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "@supersoniks/concorde/core/components/ui/form/input/input";
|
|
3
|
+
import "@supersoniks/concorde/core/components/ui/pop/pop";
|
|
4
|
+
import "@supersoniks/concorde/core/components/functional/queue/queue";
|
|
5
|
+
import "@supersoniks/concorde/core/components/ui/menu/menu-item";
|
|
6
|
+
declare const InputAutocomplete_base: (new (...args: any[]) => import("../../../../mixins/TemplatesContainer").TemplatesContainerInterface) & (new (...args: any[]) => import("../../../../mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
7
|
+
/**
|
|
8
|
+
* TODO Améliorer et valider le fonctionnement avec JB et Julien. Puis possiblement merger sur concorde
|
|
9
|
+
* Input avec autocomplete. Propose des valeurs à partir d'un sonic-queue.
|
|
10
|
+
* L'input permet de filtrer les choix de valeurs dans le sonic-pop.
|
|
11
|
+
* La valeur de cet input est ensuite retransmit au premier via un dataProvider.
|
|
12
|
+
*/
|
|
13
|
+
export declare class InputAutocomplete extends InputAutocomplete_base {
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
_name: string;
|
|
16
|
+
get name(): string;
|
|
17
|
+
set name(value: string);
|
|
18
|
+
forceAutoFill: boolean;
|
|
19
|
+
_description?: string;
|
|
20
|
+
get description(): string | undefined;
|
|
21
|
+
set description(value: string | undefined);
|
|
22
|
+
_label?: string;
|
|
23
|
+
get label(): string | undefined;
|
|
24
|
+
set label(value: string | undefined);
|
|
25
|
+
placeholder: string;
|
|
26
|
+
filteredFields: string;
|
|
27
|
+
readonly: boolean | null;
|
|
28
|
+
dataProviderExpression: string;
|
|
29
|
+
key: string;
|
|
30
|
+
value: string;
|
|
31
|
+
formDataProvider: string;
|
|
32
|
+
connectedCallback(): void;
|
|
33
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement, css } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { Subscriber, TemplatesContainer } from "@supersoniks/concorde/mixins";
|
|
10
|
+
import "@supersoniks/concorde/core/components/ui/form/input/input";
|
|
11
|
+
import "@supersoniks/concorde/core/components/ui/pop/pop";
|
|
12
|
+
import "@supersoniks/concorde/core/components/functional/queue/queue";
|
|
13
|
+
import "@supersoniks/concorde/core/components/ui/menu/menu-item";
|
|
14
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
15
|
+
/**
|
|
16
|
+
* TODO Améliorer et valider le fonctionnement avec JB et Julien. Puis possiblement merger sur concorde
|
|
17
|
+
* Input avec autocomplete. Propose des valeurs à partir d'un sonic-queue.
|
|
18
|
+
* L'input permet de filtrer les choix de valeurs dans le sonic-pop.
|
|
19
|
+
* La valeur de cet input est ensuite retransmit au premier via un dataProvider.
|
|
20
|
+
*/
|
|
21
|
+
let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(Subscriber(LitElement)) {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
// Filtering input
|
|
25
|
+
this._name = "";
|
|
26
|
+
this.forceAutoFill = false;
|
|
27
|
+
this.placeholder = "";
|
|
28
|
+
this.filteredFields = "";
|
|
29
|
+
this.readonly = null;
|
|
30
|
+
this.dataProviderExpression = "";
|
|
31
|
+
this.key = "";
|
|
32
|
+
this.value = "";
|
|
33
|
+
this.formDataProvider = "";
|
|
34
|
+
}
|
|
35
|
+
get name() {
|
|
36
|
+
return this._name;
|
|
37
|
+
}
|
|
38
|
+
set name(value) {
|
|
39
|
+
if (this.hasAttribute("name") && !this.forceAutoFill)
|
|
40
|
+
value = this.getAttribute("name");
|
|
41
|
+
this._name = value;
|
|
42
|
+
this.requestUpdate();
|
|
43
|
+
}
|
|
44
|
+
get description() {
|
|
45
|
+
return this._description;
|
|
46
|
+
}
|
|
47
|
+
set description(value) {
|
|
48
|
+
if (this.hasAttribute("description") && !this.forceAutoFill)
|
|
49
|
+
value = this.getAttribute("description");
|
|
50
|
+
this._description = value;
|
|
51
|
+
this.requestUpdate();
|
|
52
|
+
}
|
|
53
|
+
get label() {
|
|
54
|
+
return this._label;
|
|
55
|
+
}
|
|
56
|
+
set label(value) {
|
|
57
|
+
if (this.hasAttribute("label") && !this.forceAutoFill)
|
|
58
|
+
value = this.getAttribute("label");
|
|
59
|
+
this._label = value;
|
|
60
|
+
this.requestUpdate();
|
|
61
|
+
}
|
|
62
|
+
connectedCallback() {
|
|
63
|
+
this.formDataProvider = this.getAncestorAttributeValue("formDataProvider");
|
|
64
|
+
super.connectedCallback();
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
return html `
|
|
68
|
+
<sonic-pop toggle="false" style="display:block;">
|
|
69
|
+
<sonic-input
|
|
70
|
+
type="text"
|
|
71
|
+
data-keyboard-nav="nav-autocomplete"
|
|
72
|
+
label="${ifDefined(this.label)}"
|
|
73
|
+
description="${ifDefined(this.description)}"
|
|
74
|
+
name="${ifDefined(this.name)}"
|
|
75
|
+
value="${ifDefined(this.value)}"
|
|
76
|
+
clearable
|
|
77
|
+
></sonic-input>
|
|
78
|
+
<sonic-menu slot="content">
|
|
79
|
+
<sonic-queue
|
|
80
|
+
filteredFields=${this.filteredFields}
|
|
81
|
+
dataProviderExpression="${this.dataProviderExpression}"
|
|
82
|
+
dataFilterProvider="${this.formDataProvider}"
|
|
83
|
+
key="${this.key}"
|
|
84
|
+
.templates=${this.templateList}
|
|
85
|
+
displayContents
|
|
86
|
+
>
|
|
87
|
+
</sonic-queue>
|
|
88
|
+
</sonic-menu>
|
|
89
|
+
</sonic-pop>
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
InputAutocomplete.styles = [
|
|
94
|
+
css `
|
|
95
|
+
:host {
|
|
96
|
+
display: block;
|
|
97
|
+
}
|
|
98
|
+
`,
|
|
99
|
+
];
|
|
100
|
+
__decorate([
|
|
101
|
+
property()
|
|
102
|
+
], InputAutocomplete.prototype, "name", null);
|
|
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);
|
|
112
|
+
__decorate([
|
|
113
|
+
property({ type: String })
|
|
114
|
+
], InputAutocomplete.prototype, "placeholder", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
property()
|
|
117
|
+
], InputAutocomplete.prototype, "filteredFields", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
property({ type: Boolean })
|
|
120
|
+
], InputAutocomplete.prototype, "readonly", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
property({ type: String })
|
|
123
|
+
], InputAutocomplete.prototype, "dataProviderExpression", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ type: String })
|
|
126
|
+
], InputAutocomplete.prototype, "key", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
property({ type: String })
|
|
129
|
+
], InputAutocomplete.prototype, "value", void 0);
|
|
130
|
+
InputAutocomplete = __decorate([
|
|
131
|
+
customElement("sonic-input-autocomplete")
|
|
132
|
+
], InputAutocomplete);
|
|
133
|
+
export { InputAutocomplete };
|
|
134
|
+
// //Ajout pour custom-elements-manifest pour storybook notamment
|
|
135
|
+
// try {
|
|
136
|
+
// customElements.define("sonic-input-autocomplete", InputAutocomplete);
|
|
137
|
+
// } catch (e) {}
|
|
@@ -123,9 +123,13 @@ let Select = class Select extends FormElement(Subscriber(LitElement)) {
|
|
|
123
123
|
"has-prefix": this.hasPrefix,
|
|
124
124
|
"has-suffix": this.hasSuffix,
|
|
125
125
|
};
|
|
126
|
+
//let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
126
127
|
return html `
|
|
127
128
|
<label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
|
|
128
|
-
>${this.label ? unsafeHTML(this.label) : ""}<slot
|
|
129
|
+
>${this.label ? unsafeHTML(this.label /*+ labelStarSuffix*/) : ""}<slot
|
|
130
|
+
name="label"
|
|
131
|
+
@slotchange=${this.onSlotChange}
|
|
132
|
+
></slot
|
|
129
133
|
></label>
|
|
130
134
|
|
|
131
135
|
<div class="form-control ${classMap(slotClasses)}">
|
|
@@ -48,9 +48,13 @@ let Textarea = class Textarea extends FormInput(FormElement(Subscriber(LitElemen
|
|
|
48
48
|
textarea.reportValidity();
|
|
49
49
|
}
|
|
50
50
|
render() {
|
|
51
|
+
// let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
51
52
|
return html `
|
|
52
53
|
<label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
|
|
53
|
-
>${this.label ? unsafeHTML(this.label) : ""}<slot
|
|
54
|
+
>${this.label ? unsafeHTML(this.label /*+ labelStarSuffix*/) : ""}<slot
|
|
55
|
+
name="label"
|
|
56
|
+
@slotchange=${this.onSlotChange}
|
|
57
|
+
></slot
|
|
54
58
|
></label>
|
|
55
59
|
|
|
56
60
|
<div class="form-control">
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { LitElement } from
|
|
2
|
-
declare type PopPlacement =
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare 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
10
|
inline: boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Ombre
|
|
13
13
|
*/
|
|
14
|
-
shadow:
|
|
14
|
+
shadow: '' | 'none' | 'sm' | 'md' | 'lg';
|
|
15
15
|
placement: PopPlacement;
|
|
16
16
|
positioningRuns: boolean;
|
|
17
17
|
lastContentX: number;
|
|
@@ -5,21 +5,21 @@ 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
17
|
this.inline = false;
|
|
18
18
|
/**
|
|
19
19
|
* Ombre
|
|
20
20
|
*/
|
|
21
|
-
this.shadow =
|
|
22
|
-
this.placement =
|
|
21
|
+
this.shadow = 'lg';
|
|
22
|
+
this.placement = 'bottom';
|
|
23
23
|
this.positioningRuns = false;
|
|
24
24
|
this.lastContentX = Number.NaN;
|
|
25
25
|
this.lastContentY = Number.NaN;
|
|
@@ -32,16 +32,16 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
32
32
|
window.requestAnimationFrame(() => this.runPositioning());
|
|
33
33
|
}
|
|
34
34
|
_toggle(e) {
|
|
35
|
-
if (this.open && this.toggle ==
|
|
35
|
+
if (this.open && this.toggle == 'false')
|
|
36
36
|
return;
|
|
37
|
-
if (e.type ==
|
|
37
|
+
if (e.type == 'keydown' && (e.key != 'ArrowDown' || this.open))
|
|
38
38
|
return;
|
|
39
39
|
this.open = !this.open;
|
|
40
40
|
this.open ? this._show() : this._hide();
|
|
41
41
|
}
|
|
42
42
|
_show() {
|
|
43
43
|
this.open = true;
|
|
44
|
-
this.popContent.setAttribute(
|
|
44
|
+
this.popContent.setAttribute('tabindex', '0');
|
|
45
45
|
if (this.popBtn && this.popContent && !this.positioningRuns) {
|
|
46
46
|
this.positioningRuns = true;
|
|
47
47
|
this.lastContentX = Number.NaN;
|
|
@@ -51,7 +51,7 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
51
51
|
}
|
|
52
52
|
_hide() {
|
|
53
53
|
this.open = false;
|
|
54
|
-
this.popContent.setAttribute(
|
|
54
|
+
this.popContent.setAttribute('tabindex', '-1');
|
|
55
55
|
this.positioningRuns = false;
|
|
56
56
|
}
|
|
57
57
|
_handleClosePop(e) {
|
|
@@ -60,10 +60,10 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
60
60
|
Pop_1.pops.forEach((pop) => {
|
|
61
61
|
const popContainsTarget = path.includes(pop);
|
|
62
62
|
const popContentContainsTarget = path.includes(pop.querySelector('[slot="content"]'));
|
|
63
|
-
const isCloseManual = HTML.getAncestorAttributeValue(target,
|
|
64
|
-
if (e.type ==
|
|
63
|
+
const isCloseManual = HTML.getAncestorAttributeValue(target, 'data-on-select') === 'keep';
|
|
64
|
+
if (e.type == 'pointerdown' && popContainsTarget)
|
|
65
65
|
return;
|
|
66
|
-
if (e.type ==
|
|
66
|
+
if (e.type == 'click' && ((popContainsTarget && isCloseManual) || !popContentContainsTarget))
|
|
67
67
|
return;
|
|
68
68
|
pop._hide();
|
|
69
69
|
});
|
|
@@ -71,8 +71,8 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
71
71
|
connectedCallback() {
|
|
72
72
|
super.connectedCallback();
|
|
73
73
|
if (Pop_1.pops.size == 0) {
|
|
74
|
-
document.addEventListener(
|
|
75
|
-
document.addEventListener(
|
|
74
|
+
document.addEventListener('pointerdown', this._handleClosePop);
|
|
75
|
+
document.addEventListener('click', this._handleClosePop);
|
|
76
76
|
}
|
|
77
77
|
Pop_1.pops.add(this);
|
|
78
78
|
}
|
|
@@ -80,8 +80,8 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
80
80
|
super.disconnectedCallback();
|
|
81
81
|
Pop_1.pops.delete(this);
|
|
82
82
|
if (Pop_1.pops.size == 0) {
|
|
83
|
-
document.removeEventListener(
|
|
84
|
-
document.removeEventListener(
|
|
83
|
+
document.removeEventListener('pointerdown', this._handleClosePop);
|
|
84
|
+
document.removeEventListener('click', this._handleClosePop);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
_setUpMenu(placement) {
|
|
@@ -101,34 +101,34 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
101
101
|
let xRight = x0 + thisRect.width + 2 * padding;
|
|
102
102
|
let yBottom = y0 + thisRect.height + padding;
|
|
103
103
|
switch (placement) {
|
|
104
|
-
case
|
|
104
|
+
case 'bottom':
|
|
105
105
|
y = yBottom;
|
|
106
106
|
break;
|
|
107
|
-
case
|
|
107
|
+
case 'top':
|
|
108
108
|
y = yTop;
|
|
109
109
|
break;
|
|
110
|
-
case
|
|
110
|
+
case 'left':
|
|
111
111
|
x = xLeft;
|
|
112
112
|
break;
|
|
113
|
-
case
|
|
113
|
+
case 'right':
|
|
114
114
|
x = xRight;
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
117
|
let dxRight = window.innerWidth - xRight - bodyRect.left - contentRect.width - shiftPadding;
|
|
118
|
-
if (dxRight < 0 && placement ===
|
|
118
|
+
if (dxRight < 0 && placement === 'right')
|
|
119
119
|
x = xLeft;
|
|
120
|
-
if (dxRight < 0 && [
|
|
120
|
+
if (dxRight < 0 && ['top', 'bottom'].includes(placement))
|
|
121
121
|
x = Math.max(x + dxRight, xLeft + thisRect.width);
|
|
122
122
|
let dxLeft = -bodyRect.left - xLeft;
|
|
123
|
-
if (dxLeft > shiftPadding && placement ===
|
|
123
|
+
if (dxLeft > shiftPadding && placement === 'left')
|
|
124
124
|
x = xRight;
|
|
125
125
|
let dyBottom = window.innerHeight - yBottom - bodyRect.top - contentRect.height - shiftPadding;
|
|
126
|
-
if (dyBottom < 0 && placement ===
|
|
126
|
+
if (dyBottom < 0 && placement === 'bottom')
|
|
127
127
|
y = yTop;
|
|
128
|
-
if (dyBottom < 0 && [
|
|
128
|
+
if (dyBottom < 0 && ['left', 'right'].includes(placement))
|
|
129
129
|
y = Math.max(y + dyBottom, yTop + thisRect.height);
|
|
130
130
|
let dyTop = -bodyRect.top - yTop;
|
|
131
|
-
if (dyTop > -shiftPadding && placement ===
|
|
131
|
+
if (dyTop > -shiftPadding && placement === 'top')
|
|
132
132
|
y = yBottom;
|
|
133
133
|
this.lastContentX = x;
|
|
134
134
|
this.lastContentY = y;
|
|
@@ -145,7 +145,7 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
145
145
|
tabindex="-1"
|
|
146
146
|
part="content"
|
|
147
147
|
class="
|
|
148
|
-
${this.open ?
|
|
148
|
+
${this.open ? 'is-open' : ''}"
|
|
149
149
|
></slot>
|
|
150
150
|
`;
|
|
151
151
|
}
|
|
@@ -157,7 +157,8 @@ Pop.styles = [
|
|
|
157
157
|
display: inline-block;
|
|
158
158
|
vertical-align: middle;
|
|
159
159
|
}
|
|
160
|
-
slot[name=
|
|
160
|
+
slot[name='content'] {
|
|
161
|
+
max-width: 80vw;
|
|
161
162
|
background-color: var(--sc-base);
|
|
162
163
|
position: absolute;
|
|
163
164
|
z-index: 50;
|
|
@@ -165,36 +166,36 @@ Pop.styles = [
|
|
|
165
166
|
transform: translateY(1rem) scale(0.95);
|
|
166
167
|
opacity: 0;
|
|
167
168
|
pointer-events: none;
|
|
168
|
-
transition-duration: 0.15s
|
|
169
|
+
transition-duration: 0.15s;
|
|
169
170
|
transition-timing-function: ease;
|
|
170
|
-
transition-property:all;
|
|
171
|
+
transition-property: all;
|
|
171
172
|
border-radius: min(calc(var(--sc-btn-rounded) * 2), 0.4em);
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
slot[name=
|
|
175
|
+
slot[name='content'].is-open {
|
|
175
176
|
transform: translateY(0) scale(1);
|
|
176
177
|
opacity: 1;
|
|
177
178
|
pointer-events: auto;
|
|
178
|
-
transition-property:scale, opacity;
|
|
179
|
+
transition-property: scale, opacity;
|
|
179
180
|
transition-timing-function: cubic-bezier(0.25, 0.25, 0.42, 1.225);
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
/*OMBRE*/
|
|
183
|
-
:host([shadow]) slot[name=
|
|
184
|
-
:host([shadow=
|
|
185
|
-
:host([shadow=
|
|
184
|
+
:host([shadow]) slot[name='content'],
|
|
185
|
+
:host([shadow='md']) slot[name='content'],
|
|
186
|
+
:host([shadow='true']) slot[name='content'] {
|
|
186
187
|
box-shadow: var(--sc-shadow);
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
:host([shadow=
|
|
190
|
+
:host([shadow='sm']) slot[name='content'] {
|
|
190
191
|
box-shadow: var(--sc-shadow-sm);
|
|
191
192
|
}
|
|
192
193
|
|
|
193
|
-
:host([shadow=
|
|
194
|
+
:host([shadow='none']) slot[name='content'] {
|
|
194
195
|
box-shadow: none;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
:host([shadow=
|
|
198
|
+
:host([shadow='lg']) slot[name='content'] {
|
|
198
199
|
box-shadow: var(--sc-shadow-lg);
|
|
199
200
|
}
|
|
200
201
|
|
|
@@ -207,10 +208,10 @@ __decorate([
|
|
|
207
208
|
state()
|
|
208
209
|
], Pop.prototype, "open", void 0);
|
|
209
210
|
__decorate([
|
|
210
|
-
query(
|
|
211
|
+
query('slot:not([name=content])')
|
|
211
212
|
], Pop.prototype, "popBtn", void 0);
|
|
212
213
|
__decorate([
|
|
213
|
-
query(
|
|
214
|
+
query('slot[name=content]')
|
|
214
215
|
], Pop.prototype, "popContent", void 0);
|
|
215
216
|
__decorate([
|
|
216
217
|
property({ type: String })
|
|
@@ -4,6 +4,9 @@ import "./button/button";
|
|
|
4
4
|
import "./link/link";
|
|
5
5
|
import "./progress/progress";
|
|
6
6
|
import "./form/input/input";
|
|
7
|
+
import "./form/input-autocomplete/input-autocomplete";
|
|
8
|
+
import "./form/input/password-helper";
|
|
9
|
+
import "./form/input/same-value-helper";
|
|
7
10
|
import "./form/checkbox/checkbox";
|
|
8
11
|
import "./form/radio/radio";
|
|
9
12
|
import "./form/select/select";
|