@supersoniks/concorde 1.1.28 → 1.1.31
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 +23 -23
- package/concorde-core.es.js +23 -23
- package/core/components/functional/date/date.js +8 -2
- package/core/components/functional/list/list.js +17 -11
- package/core/components/functional/submit/submit.js +46 -30
- package/core/components/functional/subscriber/subscriber.d.ts +2 -1
- package/core/components/functional/subscriber/subscriber.js +8 -0
- package/core/components/ui/_css/size.d.ts +1 -0
- package/core/components/ui/_css/size.js +26 -0
- package/core/components/ui/_css/type.d.ts +2 -0
- package/core/components/ui/_css/{types.js → type.js} +1 -1
- package/core/components/ui/alert/alert.d.ts +1 -1
- package/core/components/ui/alert/alert.js +7 -16
- package/core/components/ui/badge/badge.d.ts +1 -1
- package/core/components/ui/badge/badge.js +7 -6
- package/core/components/ui/button/button.d.ts +11 -6
- package/core/components/ui/button/button.js +32 -35
- package/core/components/ui/captcha/captcha.d.ts +16 -0
- package/core/components/ui/captcha/captcha.js +54 -0
- package/core/components/ui/card/card-header.js +1 -1
- package/core/components/ui/divider/divider.d.ts +1 -1
- package/core/components/ui/divider/divider.js +7 -3
- package/core/components/ui/form/checkbox/checkbox.d.ts +51 -11
- package/core/components/ui/form/checkbox/checkbox.js +10 -6
- package/core/components/ui/form/css/form-control.js +56 -31
- package/core/components/ui/form/input/input.d.ts +23 -19
- package/core/components/ui/form/input/input.js +35 -33
- package/core/components/ui/form/radio/radio.js +1 -2
- package/core/components/ui/form/select/select.d.ts +9 -9
- package/core/components/ui/form/select/select.js +8 -14
- package/core/components/ui/form/textarea/textarea.d.ts +18 -17
- package/core/components/ui/form/textarea/textarea.js +12 -23
- package/core/components/ui/icon/icon.js +4 -0
- package/core/components/ui/image/image.d.ts +0 -1
- package/core/components/ui/image/image.js +0 -23
- package/core/components/ui/pop/pop.d.ts +1 -0
- package/core/components/ui/pop/pop.js +8 -0
- package/core/components/ui/progress/progress.d.ts +1 -0
- package/core/components/ui/progress/progress.js +13 -20
- package/core/components/ui/table/table-td.d.ts +1 -0
- package/core/components/ui/table/table-td.js +6 -2
- package/core/components/ui/table/table-th.js +2 -2
- package/core/components/ui/table/table-tr.js +3 -2
- package/core/components/ui/table/table.d.ts +1 -1
- package/core/components/ui/table/table.js +3 -20
- package/core/components/ui/taxonomy/taxonomy.js +2 -1
- package/core/components/ui/theme/theme-collection/core-variables.js +19 -8
- package/core/components/ui/theme/theme.d.ts +9 -1
- package/core/components/ui/theme/theme.js +47 -2
- package/core/components/ui/toast/toast-item.js +25 -7
- package/core/components/ui/toast/toast.js +6 -2
- package/core/components/ui/ui.d.ts +1 -0
- package/core/components/ui/ui.js +1 -0
- package/core/mixins/Fetcher.js +4 -0
- package/core/mixins/FormCheckable.d.ts +3 -5
- package/core/mixins/FormCheckable.js +5 -2
- package/core/mixins/FormElement.d.ts +3 -2
- package/core/mixins/FormElement.js +8 -4
- package/core/mixins/FormInput.d.ts +6 -9
- package/core/mixins/FormInput.js +1 -3
- package/core/utils/PublisherProxy.d.mts +1 -1
- package/core/utils/PublisherProxy.mjs +3 -3
- package/core/utils/api.js +4 -2
- package/mixins.d.ts +8 -6
- package/package.json +7 -3
- package/core/components/ui/_css/types.d.ts +0 -2
|
@@ -0,0 +1,54 @@
|
|
|
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 { Subscriber } from "@supersoniks/concorde/mixins";
|
|
8
|
+
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
9
|
+
import { html, LitElement } from "lit";
|
|
10
|
+
import { customElement, property } from "lit/decorators.js";
|
|
11
|
+
const tagName = "sonic-captcha";
|
|
12
|
+
/**
|
|
13
|
+
* Un bouton simple avec deux slots, un nommé préfix et un nomé suffix de manière à pouvoir mettre (par exemple) une icone avant ou après le contenu.
|
|
14
|
+
* * L'objet et ses slot sont en display flex avec direction / alignement et justifications configurables
|
|
15
|
+
* * Le bouton est comparable au badge car il possèdent tous les deux les propriétés *type* (primary...), *variant*(outline, ghost), size(xs...)...
|
|
16
|
+
* * Le bouton possède cependant et notamment une propriété href contrairement à un badge
|
|
17
|
+
*/
|
|
18
|
+
let Captcha = class Captcha extends Subscriber(LitElement) {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.key = "";
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
const script = document.createElement("script");
|
|
25
|
+
script.src = "https://www.google.com/recaptcha/api.js?render=" + this.key;
|
|
26
|
+
document.head.appendChild(script);
|
|
27
|
+
super.connectedCallback();
|
|
28
|
+
this.formPublisher = PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"));
|
|
29
|
+
this.formPublisher.needsCaptchaValidation = true;
|
|
30
|
+
this.formPublisher.captchaToken.onAssign((v) => {
|
|
31
|
+
if (v == "request_token") {
|
|
32
|
+
this.requestToken();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
requestToken() {
|
|
37
|
+
const win = window;
|
|
38
|
+
win.grecaptcha.ready(() => {
|
|
39
|
+
win.grecaptcha.execute(this.key, { action: "submit" }).then((token) => {
|
|
40
|
+
this.formPublisher.captchaToken = token;
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return html ` <slot></slot> `;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
__decorate([
|
|
49
|
+
property()
|
|
50
|
+
], Captcha.prototype, "key", void 0);
|
|
51
|
+
Captcha = __decorate([
|
|
52
|
+
customElement(tagName)
|
|
53
|
+
], Captcha);
|
|
54
|
+
export { Captcha };
|
|
@@ -26,7 +26,7 @@ CardHeader.styles = [
|
|
|
26
26
|
css `
|
|
27
27
|
|
|
28
28
|
:host {
|
|
29
|
-
--sc-card-header-mb:
|
|
29
|
+
--sc-card-header-mb: 1.25rem;
|
|
30
30
|
--sc-card-header-font-size: 1.875rem;
|
|
31
31
|
--sc-card-header-font-weight: var(--sc-headings-font-weight);
|
|
32
32
|
--sc-card-header-font-style: var(--sc-headings-font-style);
|
|
@@ -4,7 +4,7 @@ export declare class Divider extends LitElement {
|
|
|
4
4
|
slotNodes: Array<Node>;
|
|
5
5
|
divider: HTMLDivElement;
|
|
6
6
|
label: string;
|
|
7
|
-
size
|
|
7
|
+
size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
8
8
|
align: "left" | "right" | "center";
|
|
9
9
|
firstUpdated(): void;
|
|
10
10
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -11,7 +11,6 @@ let Divider = class Divider extends LitElement {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.label = "";
|
|
14
|
-
this.size = "md";
|
|
15
14
|
this.align = "center";
|
|
16
15
|
}
|
|
17
16
|
firstUpdated() {
|
|
@@ -50,6 +49,11 @@ Divider.styles = [
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
/*SIZE*/
|
|
52
|
+
:host([size="2xs"]) {
|
|
53
|
+
--sc-divider-my: 0.35rem;
|
|
54
|
+
--sc-divider-fs: 0.68rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
:host([size="xs"]) {
|
|
54
58
|
--sc-divider-my: 0.5rem;
|
|
55
59
|
--sc-divider-fs: 0.75rem;
|
|
@@ -57,7 +61,7 @@ Divider.styles = [
|
|
|
57
61
|
|
|
58
62
|
:host([size="sm"]) {
|
|
59
63
|
--sc-divider-my: 0.75rem;
|
|
60
|
-
--sc-divider-fs: 0.
|
|
64
|
+
--sc-divider-fs: 0.875rem;
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
:host([size="md"]) {
|
|
@@ -73,7 +77,7 @@ Divider.styles = [
|
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
:host([size="2xl"]) {
|
|
76
|
-
--sc-divider-my:
|
|
80
|
+
--sc-divider-my: 3.35rem;
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
div {
|
|
@@ -18,12 +18,32 @@ declare const Checkbox_base: {
|
|
|
18
18
|
initPublisher(): void;
|
|
19
19
|
getFormPublisher(): any;
|
|
20
20
|
updateDataValue(): void;
|
|
21
|
-
|
|
21
|
+
handleBlur(e?: any): void;
|
|
22
|
+
error: boolean;
|
|
22
23
|
autofocus: boolean;
|
|
24
|
+
required: boolean;
|
|
23
25
|
disabled: true | null;
|
|
24
|
-
required: true | null;
|
|
25
26
|
formDataProvider: string;
|
|
26
|
-
props: any;
|
|
27
|
+
props: any; /**
|
|
28
|
+
* ### Le composent sonic-checkbox étend les mixins FormCheckable, FormInput, FormElement et Subscriber
|
|
29
|
+
* **FormElement :**
|
|
30
|
+
* * La propriété value est remplie automatiquement a l'aide de l'attribut name renseigné, ceci en prenant la valeur de la propriété du même nom dans les données du dataprovider associé.
|
|
31
|
+
* * Par défault lorsque modifie l'input, la valeur est également mise à jour via le même dataprovider
|
|
32
|
+
* * On peut cependant décider de mettre à jour la donnée à une autre adresse en renseigne l'attribut *formDataProvider*.
|
|
33
|
+
* * Par conséquent on peut par exemple le lier à un composant *queue* (via sa propriété *dataFilterProvider*) de manière à appeller en auto une api avec des filtres.
|
|
34
|
+
* * **FormInput **
|
|
35
|
+
* Uniquement des propriétés classiques d'un input HTML. La prise en compte est ici partielle, par exemple les propriétés *placeholder*, *readonly*, *pattern*, *min* et *max* n'ont pas de sens pour un checkbox.
|
|
36
|
+
* **FormCheckable :**
|
|
37
|
+
* * La propriété checked mise à true si la valeur de la propriété du même nom dans les données du dataprovider associé contient un propriété checked.
|
|
38
|
+
* **Comportements :**
|
|
39
|
+
* * multiple (par défaut):
|
|
40
|
+
* - on peut cocher plusieurs checkbox ayant le même *name*.
|
|
41
|
+
* - la valeur enregistrée dans la propriété nommé du même nom dans formDataProvider est un tableau avec les *value* des cases cochées ayant le même *name*.
|
|
42
|
+
* * unique (Ajouter l'attribute unique au composant a l'intégration):
|
|
43
|
+
* - on ne peut cocher qu'une seule checkbox ayant le même *name*.
|
|
44
|
+
* * radio (Ajouter l'attribute radio au composant a l'intégration):
|
|
45
|
+
* Comme unique, mais on ne peut pas décocher la case sauf en en cochant une autre, comme un bouton radio.
|
|
46
|
+
*/
|
|
27
47
|
isConnected: boolean;
|
|
28
48
|
getAncestorAttributeValue(attributeName: string): string;
|
|
29
49
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
@@ -49,22 +69,42 @@ declare const Checkbox_base: {
|
|
|
49
69
|
new (...args: any[]): {
|
|
50
70
|
validateFormElement(): void;
|
|
51
71
|
type: "number" | "search" | "file" | "button" | "password" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local";
|
|
52
|
-
tabindex
|
|
53
|
-
autocomplete
|
|
72
|
+
tabindex?: number | undefined;
|
|
73
|
+
autocomplete?: "url" | "name" | "language" | "on" | "tel" | "email" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "photo" | undefined;
|
|
54
74
|
getFormPublisher(): any;
|
|
55
75
|
updateDataValue(): void;
|
|
56
76
|
handleChange(e?: any): void;
|
|
77
|
+
handleBlur(e?: any): void;
|
|
57
78
|
getValueForFormPublisher(): any;
|
|
58
|
-
error:
|
|
79
|
+
error: boolean;
|
|
59
80
|
autofocus: boolean;
|
|
81
|
+
required: boolean;
|
|
60
82
|
disabled: true | null;
|
|
61
|
-
required: true | null;
|
|
62
83
|
formDataProvider: string;
|
|
63
84
|
_value: any;
|
|
64
85
|
value: any;
|
|
65
86
|
_name: string;
|
|
66
87
|
name: string;
|
|
67
|
-
props: any;
|
|
88
|
+
props: any; /**
|
|
89
|
+
* ### Le composent sonic-checkbox étend les mixins FormCheckable, FormInput, FormElement et Subscriber
|
|
90
|
+
* **FormElement :**
|
|
91
|
+
* * La propriété value est remplie automatiquement a l'aide de l'attribut name renseigné, ceci en prenant la valeur de la propriété du même nom dans les données du dataprovider associé.
|
|
92
|
+
* * Par défault lorsque modifie l'input, la valeur est également mise à jour via le même dataprovider
|
|
93
|
+
* * On peut cependant décider de mettre à jour la donnée à une autre adresse en renseigne l'attribut *formDataProvider*.
|
|
94
|
+
* * Par conséquent on peut par exemple le lier à un composant *queue* (via sa propriété *dataFilterProvider*) de manière à appeller en auto une api avec des filtres.
|
|
95
|
+
* * **FormInput **
|
|
96
|
+
* Uniquement des propriétés classiques d'un input HTML. La prise en compte est ici partielle, par exemple les propriétés *placeholder*, *readonly*, *pattern*, *min* et *max* n'ont pas de sens pour un checkbox.
|
|
97
|
+
* **FormCheckable :**
|
|
98
|
+
* * La propriété checked mise à true si la valeur de la propriété du même nom dans les données du dataprovider associé contient un propriété checked.
|
|
99
|
+
* **Comportements :**
|
|
100
|
+
* * multiple (par défaut):
|
|
101
|
+
* - on peut cocher plusieurs checkbox ayant le même *name*.
|
|
102
|
+
* - la valeur enregistrée dans la propriété nommé du même nom dans formDataProvider est un tableau avec les *value* des cases cochées ayant le même *name*.
|
|
103
|
+
* * unique (Ajouter l'attribute unique au composant a l'intégration):
|
|
104
|
+
* - on ne peut cocher qu'une seule checkbox ayant le même *name*.
|
|
105
|
+
* * radio (Ajouter l'attribute radio au composant a l'intégration):
|
|
106
|
+
* Comme unique, mais on ne peut pas décocher la case sauf en en cochant une autre, comme un bouton radio.
|
|
107
|
+
*/
|
|
68
108
|
isConnected: boolean;
|
|
69
109
|
getAncestorAttributeValue(attributeName: string): string;
|
|
70
110
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
@@ -92,10 +132,10 @@ export declare class Checkbox extends Checkbox_base {
|
|
|
92
132
|
static styles: CSSResultGroup[];
|
|
93
133
|
touched: boolean;
|
|
94
134
|
iconName: string;
|
|
95
|
-
description
|
|
96
|
-
label
|
|
135
|
+
description?: string;
|
|
136
|
+
label?: string;
|
|
97
137
|
slotDescriptionNodes: Array<Node>;
|
|
98
|
-
hasDescription:
|
|
138
|
+
hasDescription: boolean;
|
|
99
139
|
updated(): void;
|
|
100
140
|
connectedCallback(): void;
|
|
101
141
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -12,6 +12,7 @@ import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
|
12
12
|
import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
|
|
13
13
|
import FormCheckable from "@supersoniks/concorde/core/mixins/FormCheckable";
|
|
14
14
|
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
15
|
+
import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
15
16
|
/**
|
|
16
17
|
* ### Le composent sonic-checkbox étend les mixins FormCheckable, FormInput, FormElement et Subscriber
|
|
17
18
|
* **FormElement :**
|
|
@@ -38,8 +39,6 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
|
|
|
38
39
|
super(...arguments);
|
|
39
40
|
this.touched = false;
|
|
40
41
|
this.iconName = "check";
|
|
41
|
-
this.description = "";
|
|
42
|
-
this.label = "";
|
|
43
42
|
this.hasDescription = false;
|
|
44
43
|
}
|
|
45
44
|
updated() {
|
|
@@ -57,8 +56,9 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
|
|
|
57
56
|
<input
|
|
58
57
|
type="${this.type}"
|
|
59
58
|
@change=${this.handleChange}
|
|
59
|
+
@blur=${this.handleBlur}
|
|
60
|
+
?required=${this.required}
|
|
60
61
|
.disabled=${ifDefined(this.disabled)}
|
|
61
|
-
.required=${ifDefined(this.required)}
|
|
62
62
|
.checked=${ifDefined(this.checked)}
|
|
63
63
|
.name=${this.name}
|
|
64
64
|
.value=${this.value}
|
|
@@ -80,21 +80,24 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
Checkbox.styles = [
|
|
83
|
+
fontSize,
|
|
83
84
|
css `
|
|
84
|
-
|
|
85
85
|
:host{
|
|
86
86
|
--sc-checkbox-border-width: var(--sc-form-border-width);
|
|
87
87
|
--sc-checkbox-border-color: transparent;
|
|
88
88
|
}
|
|
89
|
+
|
|
89
90
|
* {
|
|
90
91
|
box-sizing: border-box;
|
|
91
92
|
}
|
|
93
|
+
|
|
92
94
|
.checkbox-container {
|
|
93
95
|
min-height: 1.4em;
|
|
94
96
|
display: flex;
|
|
95
97
|
gap: 0.5em;
|
|
96
98
|
line-height: 1.2;
|
|
97
99
|
align-items: flex-start;
|
|
100
|
+
font-size: var(--sc-fs);
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
.icon-container {
|
|
@@ -104,10 +107,11 @@ Checkbox.styles = [
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
input {
|
|
110
|
+
box-sizing: border-box;
|
|
107
111
|
appearance: none;
|
|
108
112
|
flex-shrink: 0;
|
|
109
|
-
height: 1.
|
|
110
|
-
width: 1.
|
|
113
|
+
height: calc(var(--sc-fs) * 1.25);
|
|
114
|
+
width: calc(var(--sc-fs) * 1.25);
|
|
111
115
|
display: block;
|
|
112
116
|
cursor: pointer;
|
|
113
117
|
border-radius: 0.25em;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
2
|
export const formControl = css `
|
|
3
|
+
|
|
3
4
|
* {
|
|
4
5
|
box-sizing: border-box;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
:host {
|
|
8
|
-
--sc-input-height: var(--sc-form-height
|
|
9
|
-
--sc-input-border-width: var(--sc-form-border-width
|
|
10
|
-
--sc-input-color: var(--sc-base-content
|
|
9
|
+
--sc-input-height: var(--sc-form-height);
|
|
10
|
+
--sc-input-border-width: var(--sc-form-border-width);
|
|
11
|
+
--sc-input-color: var(--sc-base-content);
|
|
11
12
|
|
|
12
|
-
--sc-item-rounded-tr: var(--sc-input-rounded
|
|
13
|
-
--sc-item-rounded-tl: var(--sc-input-rounded
|
|
14
|
-
--sc-item-rounded-bl: var(--sc-input-rounded
|
|
15
|
-
--sc-item-rounded-br: var(--sc-input-rounded
|
|
13
|
+
--sc-item-rounded-tr: var(--sc-input-rounded);
|
|
14
|
+
--sc-item-rounded-tl: var(--sc-input-rounded);
|
|
15
|
+
--sc-item-rounded-bl: var(--sc-input-rounded);
|
|
16
|
+
--sc-item-rounded-br: var(--sc-input-rounded);
|
|
16
17
|
|
|
18
|
+
--sc-input-fs: var(--sc-fs, 1rem) ;
|
|
17
19
|
--sc-input-ff: inherit;
|
|
18
20
|
--sc-input-py: 0.6em;
|
|
19
21
|
--sc-input-px: 1.15em;
|
|
@@ -25,8 +27,9 @@ export const formControl = css `
|
|
|
25
27
|
--sc-input-suffix-color: var(--sc-input-color);
|
|
26
28
|
--sc-input-suffix-bg: var(--sc-input-bg);
|
|
27
29
|
--sc-input-suffix-border-color: var(--sc-input-border-color);
|
|
28
|
-
|
|
29
|
-
--sc-label-
|
|
30
|
+
|
|
31
|
+
--sc-label-fs: var(--sc-fs, 1rem);
|
|
32
|
+
--sc-label-fw: var(--sc-label-font-weight);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
.form-element {
|
|
@@ -112,7 +115,8 @@ export const formControl = css `
|
|
|
112
115
|
display: flex;
|
|
113
116
|
flex-wrap: wrap;
|
|
114
117
|
align-items: center;
|
|
115
|
-
gap: 0.
|
|
118
|
+
gap: 0.35em;
|
|
119
|
+
min-height: var(--sc-form-height);
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
/*Disabled */
|
|
@@ -120,27 +124,10 @@ export const formControl = css `
|
|
|
120
124
|
cursor: not-allowed;
|
|
121
125
|
}
|
|
122
126
|
|
|
123
|
-
/*SIZE*/
|
|
124
|
-
:host {
|
|
125
|
-
--sc-input-fs: 1rem;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
:host([size="xs"]) {
|
|
129
|
-
--sc-input-fs: 0.75rem;
|
|
130
|
-
}
|
|
131
|
-
:host([size="sm"]) {
|
|
132
|
-
--sc-input-fs: 0.85rem;
|
|
133
|
-
}
|
|
134
|
-
:host([size="lg"]) {
|
|
135
|
-
--sc-input-fs: 1.2rem;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
127
|
:host([variant="ghost"]) .form-element {
|
|
139
128
|
--sc-input-bg: transparent;
|
|
140
129
|
}
|
|
141
130
|
|
|
142
|
-
|
|
143
|
-
|
|
144
131
|
/*Disbaled*/
|
|
145
132
|
:host([disabled]) .form-element {
|
|
146
133
|
pointer-events: none;
|
|
@@ -202,23 +189,61 @@ export const formControl = css `
|
|
|
202
189
|
display:none;
|
|
203
190
|
}
|
|
204
191
|
|
|
205
|
-
:host([touched]) :not(:focus):invalid {
|
|
192
|
+
:host([touched][required]) :not(:focus):invalid {
|
|
206
193
|
--sc-input-border-color: var(--sc-danger);
|
|
207
194
|
--sc-input-color: var(--sc-danger);
|
|
208
195
|
}
|
|
209
196
|
|
|
210
|
-
:host([touched]) :not(:focus):invalid + .select-chevron{
|
|
197
|
+
:host([touched][required]) :not(:focus):invalid + .select-chevron{
|
|
211
198
|
--sc-input-color: var(--sc-danger);
|
|
212
199
|
}
|
|
213
200
|
|
|
214
201
|
/*VALID*/
|
|
215
|
-
:host([touched]) :not([value=""]):not(:focus):valid {
|
|
202
|
+
:host([touched][required]) :not([value=""]):not(:focus):valid {
|
|
216
203
|
--sc-input-border-color: var(--sc-success);
|
|
217
204
|
--sc-input-color: var(--sc-success);
|
|
218
205
|
}
|
|
219
206
|
|
|
220
|
-
:host([touched]) :not(:focus):valid + .select-chevron{
|
|
207
|
+
:host([touched][required]) :not(:focus):valid + .select-chevron{
|
|
221
208
|
--sc-input-color: var(--sc-success);
|
|
222
209
|
}
|
|
223
210
|
|
|
211
|
+
/*Input COLOR*/
|
|
212
|
+
:host([type="color"]) .form-element {
|
|
213
|
+
padding: 0;
|
|
214
|
+
border: 0;
|
|
215
|
+
min-width: var(--sc-input-height);
|
|
216
|
+
}
|
|
217
|
+
input[type="color"]::-webkit-color-swatch-wrapper {
|
|
218
|
+
padding: 0;
|
|
219
|
+
}
|
|
220
|
+
input[type="color"]::-webkit-color-swatch {
|
|
221
|
+
border: none;
|
|
222
|
+
border-radius: var(--sc-item-rounded-tl) var(--sc-item-rounded-tr) var(--sc-item-rounded-br)
|
|
223
|
+
var(--sc-item-rounded-bl);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/*Input Image*/
|
|
227
|
+
:host([type="image"]) .form-element {
|
|
228
|
+
padding: 0;
|
|
229
|
+
border:none;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/*Input reset & image*/
|
|
233
|
+
input[type="reset"],
|
|
234
|
+
input[type="submit"] {
|
|
235
|
+
cursor: pointer;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/*Input search*/
|
|
239
|
+
input[type="search"]::-webkit-search-cancel-button {
|
|
240
|
+
appearance:none;
|
|
241
|
+
cursor:pointer;
|
|
242
|
+
height: .65em;
|
|
243
|
+
width: .65em;
|
|
244
|
+
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjEyMy4wNXB4IiBoZWlnaHQ9IjEyMy4wNXB4IiB2aWV3Qm94PSIwIDAgMTIzLjA1IDEyMy4wNSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTIzLjA1IDEyMy4wNTsiDQoJIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBhdGggZD0iTTEyMS4zMjUsMTAuOTI1bC04LjUtOC4zOTljLTIuMy0yLjMtNi4xLTIuMy04LjUsMGwtNDIuNCw0Mi4zOTlMMTguNzI2LDEuNzI2Yy0yLjMwMS0yLjMwMS02LjEwMS0yLjMwMS04LjUsMGwtOC41LDguNQ0KCQljLTIuMzAxLDIuMy0yLjMwMSw2LjEsMCw4LjVsNDMuMSw0My4xbC00Mi4zLDQyLjVjLTIuMywyLjMtMi4zLDYuMSwwLDguNWw4LjUsOC41YzIuMywyLjMsNi4xLDIuMyw4LjUsMGw0Mi4zOTktNDIuNGw0Mi40LDQyLjQNCgkJYzIuMywyLjMsNi4xLDIuMyw4LjUsMGw4LjUtOC41YzIuMy0yLjMsMi4zLTYuMSwwLTguNWwtNDIuNS00Mi40bDQyLjQtNDIuMzk5QzEyMy42MjUsMTcuMTI1LDEyMy42MjUsMTMuMzI1LDEyMS4zMjUsMTAuOTI1eiIvPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPC9zdmc+DQo=);
|
|
245
|
+
background-size: contain;
|
|
246
|
+
background-repeat: no-repeat;
|
|
247
|
+
}
|
|
248
|
+
|
|
224
249
|
`;
|
|
@@ -3,16 +3,17 @@ declare const Input_base: {
|
|
|
3
3
|
new (...args: any[]): {
|
|
4
4
|
validateFormElement(): void;
|
|
5
5
|
type: "number" | "search" | "file" | "button" | "password" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local";
|
|
6
|
-
tabindex
|
|
7
|
-
autocomplete
|
|
6
|
+
tabindex?: number | undefined;
|
|
7
|
+
autocomplete?: "url" | "name" | "language" | "on" | "tel" | "email" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "photo" | undefined;
|
|
8
8
|
getFormPublisher(): any;
|
|
9
9
|
updateDataValue(): void;
|
|
10
10
|
handleChange(e?: any): void;
|
|
11
|
+
handleBlur(e?: any): void;
|
|
11
12
|
getValueForFormPublisher(): any;
|
|
12
|
-
error:
|
|
13
|
+
error: boolean;
|
|
13
14
|
autofocus: boolean;
|
|
15
|
+
required: boolean;
|
|
14
16
|
disabled: true | null;
|
|
15
|
-
required: true | null;
|
|
16
17
|
formDataProvider: string;
|
|
17
18
|
_value: any;
|
|
18
19
|
value: any;
|
|
@@ -47,29 +48,32 @@ export declare class Input extends Input_base {
|
|
|
47
48
|
/**
|
|
48
49
|
* Taille du composant, implique notamment des modifications de typo et de marge interne
|
|
49
50
|
*/
|
|
50
|
-
size
|
|
51
|
-
list
|
|
52
|
-
placeholder
|
|
51
|
+
size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
52
|
+
list?: string;
|
|
53
|
+
placeholder?: string;
|
|
54
|
+
pattern?: string;
|
|
55
|
+
min?: string;
|
|
56
|
+
max?: string;
|
|
53
57
|
readonly: boolean;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
label: string;
|
|
61
|
-
description: string;
|
|
58
|
+
step?: number;
|
|
59
|
+
minlength?: number;
|
|
60
|
+
maxlength?: number;
|
|
61
|
+
src?: string;
|
|
62
|
+
label?: string;
|
|
63
|
+
description?: string;
|
|
62
64
|
inlineContent: boolean;
|
|
63
65
|
slotLabelNodes: Array<Node>;
|
|
64
66
|
slotDescriptionNodes: Array<Node>;
|
|
65
67
|
slotSuffixNodes: Array<Node>;
|
|
66
68
|
slotPrefixNodes: Array<Node>;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
input: HTMLInputElement;
|
|
70
|
+
hasDescription: boolean;
|
|
71
|
+
hasLabel: boolean;
|
|
72
|
+
hasSuffix: boolean;
|
|
73
|
+
hasPrefix: boolean;
|
|
71
74
|
updated(): void;
|
|
72
75
|
onSlotChange(): void;
|
|
76
|
+
inlineContentFocus(): void;
|
|
73
77
|
render(): import("lit-html").TemplateResult<1>;
|
|
74
78
|
}
|
|
75
79
|
export {};
|
|
@@ -6,12 +6,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, LitElement } from "lit";
|
|
8
8
|
import { customElement, property, queryAssignedNodes, state } from "lit/decorators.js";
|
|
9
|
+
import { query } from 'lit/decorators/query.js';
|
|
9
10
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
11
|
import { formControl } from "@supersoniks/concorde/core/components/ui/form/css/form-control";
|
|
11
12
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
12
13
|
import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
13
14
|
import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
|
|
14
15
|
import { classMap } from "lit/directives/class-map.js";
|
|
16
|
+
import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
15
17
|
/**
|
|
16
18
|
* ### Le composent sonic-input étend les mixins FormInput, FormElement et Subscriber
|
|
17
19
|
* **FormElement :**
|
|
@@ -26,25 +28,7 @@ const tagName = "sonic-input";
|
|
|
26
28
|
let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
27
29
|
constructor() {
|
|
28
30
|
super(...arguments);
|
|
29
|
-
/**
|
|
30
|
-
* Taille du composant, implique notamment des modifications de typo et de marge interne
|
|
31
|
-
*/
|
|
32
|
-
this.size = "";
|
|
33
|
-
this.list = null;
|
|
34
|
-
this.placeholder = "";
|
|
35
31
|
this.readonly = false;
|
|
36
|
-
this.pattern = null;
|
|
37
|
-
this.min = null;
|
|
38
|
-
this.max = null;
|
|
39
|
-
this.step = null;
|
|
40
|
-
this.minlength = null;
|
|
41
|
-
this.maxlength = null;
|
|
42
|
-
/*
|
|
43
|
-
* TODO
|
|
44
|
-
* Mutualiser avec le composant select
|
|
45
|
-
*/
|
|
46
|
-
this.label = "";
|
|
47
|
-
this.description = "";
|
|
48
32
|
this.inlineContent = false;
|
|
49
33
|
this.hasDescription = false;
|
|
50
34
|
this.hasLabel = false;
|
|
@@ -61,6 +45,13 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
61
45
|
onSlotChange() {
|
|
62
46
|
this.requestUpdate();
|
|
63
47
|
}
|
|
48
|
+
inlineContentFocus() {
|
|
49
|
+
var _a;
|
|
50
|
+
if (!this.inlineContent)
|
|
51
|
+
return;
|
|
52
|
+
console.log('oypouaze');
|
|
53
|
+
(_a = this.input) === null || _a === void 0 ? void 0 : _a.focus();
|
|
54
|
+
}
|
|
64
55
|
render() {
|
|
65
56
|
const slotClasses = {
|
|
66
57
|
"has-prefix": this.hasPrefix,
|
|
@@ -71,31 +62,33 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
71
62
|
>${this.label ? this.label : ""}<slot name="label" @slotchange=${this.onSlotChange}></slot
|
|
72
63
|
></label>
|
|
73
64
|
|
|
74
|
-
<div class="form-control ${classMap(slotClasses)}">
|
|
65
|
+
<div @click=${this.inlineContentFocus} class="form-control ${classMap(slotClasses)}">
|
|
75
66
|
<div class=" ${this.inlineContent ? "form-element form-element-wrapper" : "contents"}">
|
|
76
67
|
<slot name="prefix" @slotchange=${this.onSlotChange}></slot>
|
|
77
68
|
<input
|
|
78
69
|
id="form-element"
|
|
79
70
|
part="input"
|
|
80
71
|
class="form-element input"
|
|
81
|
-
type=${this.type}
|
|
82
72
|
@input=${this.handleChange}
|
|
83
|
-
|
|
73
|
+
@blur=${this.handleBlur}
|
|
74
|
+
type=${this.type}
|
|
75
|
+
disabled=${ifDefined(this.disabled)}
|
|
84
76
|
?readonly=${this.readonly}
|
|
77
|
+
?autofocus=${this.autofocus}
|
|
85
78
|
list=${ifDefined(this.list)}
|
|
86
|
-
autofocus=${ifDefined(this.autofocus)}
|
|
87
|
-
required=${ifDefined(this.required)}
|
|
88
79
|
tabindex=${ifDefined(this.tabindex)}
|
|
89
80
|
pattern=${ifDefined(this.pattern)}
|
|
90
81
|
min=${ifDefined(this.min)}
|
|
91
82
|
max=${ifDefined(this.max)}
|
|
92
83
|
step=${ifDefined(this.step)}
|
|
84
|
+
src=${ifDefined(this.src)}
|
|
93
85
|
minlength=${ifDefined(this.minlength)}
|
|
94
86
|
maxlength=${ifDefined(this.maxlength)}
|
|
95
|
-
placeholder
|
|
87
|
+
placeholder=${ifDefined(this.placeholder)}
|
|
88
|
+
required=${ifDefined(this.required)}
|
|
89
|
+
autocomplete=${ifDefined(this.autocomplete)}
|
|
96
90
|
.name=${this.name}
|
|
97
91
|
.value=${this.value}
|
|
98
|
-
autocomplete=${ifDefined(this.autocomplete)}
|
|
99
92
|
/>
|
|
100
93
|
<slot name="suffix" @slotchange=${this.onSlotChange}></slot>
|
|
101
94
|
</div>
|
|
@@ -106,9 +99,12 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
106
99
|
`;
|
|
107
100
|
}
|
|
108
101
|
};
|
|
109
|
-
Input.styles = [
|
|
102
|
+
Input.styles = [
|
|
103
|
+
fontSize,
|
|
104
|
+
formControl
|
|
105
|
+
];
|
|
110
106
|
__decorate([
|
|
111
|
-
property({ type: String })
|
|
107
|
+
property({ type: String, reflect: true })
|
|
112
108
|
], Input.prototype, "size", void 0);
|
|
113
109
|
__decorate([
|
|
114
110
|
property({ type: String })
|
|
@@ -116,9 +112,6 @@ __decorate([
|
|
|
116
112
|
__decorate([
|
|
117
113
|
property({ type: String })
|
|
118
114
|
], Input.prototype, "placeholder", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
property({ type: Boolean })
|
|
121
|
-
], Input.prototype, "readonly", void 0);
|
|
122
115
|
__decorate([
|
|
123
116
|
property({ type: String })
|
|
124
117
|
], Input.prototype, "pattern", void 0);
|
|
@@ -129,14 +122,20 @@ __decorate([
|
|
|
129
122
|
property({ type: String })
|
|
130
123
|
], Input.prototype, "max", void 0);
|
|
131
124
|
__decorate([
|
|
132
|
-
property({ type:
|
|
125
|
+
property({ type: Boolean })
|
|
126
|
+
], Input.prototype, "readonly", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
property({ type: Number })
|
|
133
129
|
], Input.prototype, "step", void 0);
|
|
134
130
|
__decorate([
|
|
135
|
-
property({ type:
|
|
131
|
+
property({ type: Number })
|
|
136
132
|
], Input.prototype, "minlength", void 0);
|
|
137
133
|
__decorate([
|
|
138
|
-
property({ type:
|
|
134
|
+
property({ type: Number })
|
|
139
135
|
], Input.prototype, "maxlength", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: String })
|
|
138
|
+
], Input.prototype, "src", void 0);
|
|
140
139
|
__decorate([
|
|
141
140
|
property({ type: String })
|
|
142
141
|
], Input.prototype, "label", void 0);
|
|
@@ -158,6 +157,9 @@ __decorate([
|
|
|
158
157
|
__decorate([
|
|
159
158
|
queryAssignedNodes({ slot: "prefix" })
|
|
160
159
|
], Input.prototype, "slotPrefixNodes", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
query('input')
|
|
162
|
+
], Input.prototype, "input", void 0);
|
|
161
163
|
__decorate([
|
|
162
164
|
state()
|
|
163
165
|
], Input.prototype, "hasDescription", void 0);
|