@supersoniks/concorde 1.1.44 → 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/README.md +9 -7
- package/concorde-core.bundle.js +39 -24
- package/concorde-core.es.js +907 -320
- 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 +12 -7
- package/core/components/functional/queue/queue.d.ts +9 -2
- package/core/components/functional/queue/queue.js +131 -67
- package/core/components/functional/router/router.js +13 -4
- package/core/components/functional/sdui/sdui.d.ts +3 -2
- package/core/components/functional/sdui/sdui.js +1 -1
- package/core/components/functional/states/states.js +1 -0
- package/core/components/functional/value/value.js +3 -2
- 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/button/button.js +32 -28
- 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/select/select.js +16 -4
- package/core/components/ui/form/textarea/textarea.d.ts +1 -0
- package/core/components/ui/group/group.js +7 -1
- 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.d.ts +5 -4
- package/core/components/ui/pop/pop.js +85 -44
- package/core/components/ui/theme/theme-collection/core-variables.js +18 -9
- package/core/components/ui/theme/theme.js +8 -3
- package/core/components/ui/tooltip/tooltip.js +3 -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 +17 -12
- package/core/utils/PublisherProxy.d.ts +30 -3
- package/core/utils/PublisherProxy.js +218 -6
- package/core/utils/api.d.ts +29 -3
- package/core/utils/api.js +117 -24
- package/mixins.d.ts +4 -1
- package/package.json +7 -2
|
@@ -27,22 +27,34 @@ let Alert = class Alert extends LitElement {
|
|
|
27
27
|
* Titre du message d'erreur
|
|
28
28
|
*/
|
|
29
29
|
this.label = "";
|
|
30
|
+
this.noIcon = false;
|
|
30
31
|
/**
|
|
31
32
|
* Peut être renseigné dans le slot pour créer des messages plus complexes
|
|
32
33
|
*/
|
|
33
34
|
this.text = "";
|
|
35
|
+
this.dismissible = false;
|
|
34
36
|
this.background = false;
|
|
35
37
|
this.status = "default";
|
|
36
38
|
}
|
|
37
39
|
render() {
|
|
38
40
|
return html `<div part="alert" class="alert">
|
|
39
|
-
|
|
41
|
+
${!this.noIcon
|
|
42
|
+
? html `<div>${this.status && html `<sonic-icon name=${icon[this.status]}></sonic-icon>`}</div>`
|
|
43
|
+
: nothing}
|
|
40
44
|
<div>
|
|
41
45
|
${this.label ? html `<span class="label">${unsafeHTML(this.label)}</span>` : nothing}
|
|
42
46
|
<slot>${this.text}</slot>
|
|
43
47
|
</div>
|
|
48
|
+
${this.dismissible
|
|
49
|
+
? html `<sonic-button @click=${this.close} class="close-btn" variant="unstyled" shape="circle">
|
|
50
|
+
<sonic-icon name="cancel" size="lg"></sonic-icon>
|
|
51
|
+
</sonic-button>`
|
|
52
|
+
: nothing}
|
|
44
53
|
</div>`;
|
|
45
54
|
}
|
|
55
|
+
close() {
|
|
56
|
+
this.remove();
|
|
57
|
+
}
|
|
46
58
|
};
|
|
47
59
|
Alert.styles = [
|
|
48
60
|
fontSize,
|
|
@@ -84,10 +96,12 @@ Alert.styles = [
|
|
|
84
96
|
}
|
|
85
97
|
|
|
86
98
|
/*background*/
|
|
99
|
+
:host([dismissible]) .alert,
|
|
87
100
|
:host([background]) .alert {
|
|
88
101
|
background: var(--sc-base);
|
|
89
102
|
padding: 0.8em 1.15em;
|
|
90
103
|
}
|
|
104
|
+
:host([dismissible]) .alert:before,
|
|
91
105
|
:host([background]) .alert:before {
|
|
92
106
|
background-color: currentColor;
|
|
93
107
|
content: "";
|
|
@@ -101,6 +115,7 @@ Alert.styles = [
|
|
|
101
115
|
border-radius: var(--sc-alert-rounded);
|
|
102
116
|
pointer-events: none;
|
|
103
117
|
}
|
|
118
|
+
:host([dismissible]) > div,
|
|
104
119
|
:host([background]) > div {
|
|
105
120
|
z-index: 2;
|
|
106
121
|
position: relative;
|
|
@@ -117,17 +132,34 @@ Alert.styles = [
|
|
|
117
132
|
:host([size="sm"]) .alert {
|
|
118
133
|
--sc-alert-rounded: var(--sc-rounded-sm);
|
|
119
134
|
}
|
|
135
|
+
|
|
136
|
+
/*Dismissible*/
|
|
137
|
+
:host([dismissible]) .alert {
|
|
138
|
+
padding-right: 3rem;
|
|
139
|
+
}
|
|
140
|
+
:host([dismissible]) .close-btn {
|
|
141
|
+
padding: 0.5em;
|
|
142
|
+
position: absolute;
|
|
143
|
+
top: 0.25rem;
|
|
144
|
+
right: 0.25rem;
|
|
145
|
+
}
|
|
120
146
|
`,
|
|
121
147
|
];
|
|
122
148
|
__decorate([
|
|
123
149
|
property({ type: String })
|
|
124
150
|
], Alert.prototype, "label", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ type: Boolean, reflect: true })
|
|
153
|
+
], Alert.prototype, "noIcon", void 0);
|
|
125
154
|
__decorate([
|
|
126
155
|
property({ type: String })
|
|
127
156
|
], Alert.prototype, "text", void 0);
|
|
128
157
|
__decorate([
|
|
129
158
|
property({ type: String, reflect: true })
|
|
130
159
|
], Alert.prototype, "size", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: Boolean, reflect: true })
|
|
162
|
+
], Alert.prototype, "dismissible", void 0);
|
|
131
163
|
__decorate([
|
|
132
164
|
property({ type: Boolean, reflect: true })
|
|
133
165
|
], Alert.prototype, "background", void 0);
|
|
@@ -10,7 +10,7 @@ export declare class Badge extends LitElement {
|
|
|
10
10
|
/**
|
|
11
11
|
* Le type change surtout la couleur composant
|
|
12
12
|
*/
|
|
13
|
-
type: "default" | "primary" | "warning" | "danger" | "success" | "info";
|
|
13
|
+
type: "default" | "primary" | "warning" | "danger" | "success" | "info" | "neutral";
|
|
14
14
|
/**
|
|
15
15
|
* Le composant par defaut sans se paramètre à forte afordance
|
|
16
16
|
* * gost : composant super léger visuellement
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, LitElement, css } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
|
-
import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
9
|
+
import { fontSize, } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
10
10
|
const tagName = "sonic-badge";
|
|
11
11
|
/**
|
|
12
12
|
* Un badge simple avec deux slots, un nommé prefix et un nomé suffix de manière à pouvoir mettre (par exemple) une icone avant ou après le contenu.
|
|
@@ -50,9 +50,10 @@ Badge.styles = [
|
|
|
50
50
|
|
|
51
51
|
--sc-badge-border-with: var(--sc-form-border-width, 0.1rem);
|
|
52
52
|
--sc-badge-border-color: transparent;
|
|
53
|
-
--sc-badge-border: var(--sc-badge-border-with) solid
|
|
53
|
+
--sc-badge-border: var(--sc-badge-border-with) solid
|
|
54
|
+
var(--sc-badge-border-color);
|
|
54
55
|
|
|
55
|
-
--sc-badge-rounded:
|
|
56
|
+
--sc-badge-rounded: 0.85em;
|
|
56
57
|
--sc-badge-fw: var(--sc-font-weight-base);
|
|
57
58
|
|
|
58
59
|
display: inline-flex;
|
|
@@ -129,6 +130,11 @@ Badge.styles = [
|
|
|
129
130
|
--sc-badge-gap: 0.5em;
|
|
130
131
|
}
|
|
131
132
|
|
|
133
|
+
:host([contrast]) {
|
|
134
|
+
--sc-badge-color: var(--sc-contrast-content);
|
|
135
|
+
--sc-badge-bg: var(--sc-contrast);
|
|
136
|
+
}
|
|
137
|
+
|
|
132
138
|
/*OUTLINE*/
|
|
133
139
|
:host([variant="outline"][type]) {
|
|
134
140
|
border-width: var(--sc-badge-border-with) !important;
|
|
@@ -58,6 +58,7 @@ declare const Button_base: {
|
|
|
58
58
|
requestUpdate(): void;
|
|
59
59
|
getAttribute(name: string): string;
|
|
60
60
|
hasAttribute(attributeName: string): boolean;
|
|
61
|
+
getBoundingClientRect(): DOMRect;
|
|
61
62
|
};
|
|
62
63
|
} & (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;
|
|
63
64
|
/**
|
|
@@ -198,14 +198,14 @@ Button.styles = [
|
|
|
198
198
|
--sc-btn-ff: var(--sc-btn-font-family);
|
|
199
199
|
|
|
200
200
|
--sc-btn-height: var(--sc-form-height);
|
|
201
|
-
--sc-btn-color
|
|
202
|
-
--sc-btn-bg
|
|
201
|
+
--btn-color: var(--sc-btn-color, var(--sc-base-content));
|
|
202
|
+
--btn-bg: var(--sc-btn-bg, var(--sc-base-100));
|
|
203
203
|
|
|
204
204
|
--sc-btn-border-style: solid;
|
|
205
|
-
--sc-btn-border-
|
|
205
|
+
--sc-btn-border-width: var(--sc-form-border-width);
|
|
206
206
|
--sc-btn-border-color: transparent;
|
|
207
207
|
|
|
208
|
-
--sc-btn-outline-bg-hover
|
|
208
|
+
--btn-outline-bg-hover: var(--sc-btn-outline-bg-hover, var(--sc-base-100));
|
|
209
209
|
--sc-btn-ghost-bg-hover: var(--sc-base-100);
|
|
210
210
|
|
|
211
211
|
--sc-btn-active-color: var(--sc-base);
|
|
@@ -246,15 +246,15 @@ Button.styles = [
|
|
|
246
246
|
border-radius: var(--sc-item-rounded-tl) var(--sc-item-rounded-tr) var(--sc-item-rounded-br)
|
|
247
247
|
var(--sc-item-rounded-bl);
|
|
248
248
|
|
|
249
|
-
background: var(--
|
|
250
|
-
color: var(--
|
|
249
|
+
background: var(--btn-bg);
|
|
250
|
+
color: var(--btn-color);
|
|
251
251
|
|
|
252
252
|
padding-top: var(--sc-btn-py);
|
|
253
253
|
padding-bottom: var(--sc-btn-py);
|
|
254
254
|
padding-left: var(--sc-btn-px);
|
|
255
255
|
padding-right: var(--sc-btn-px);
|
|
256
256
|
|
|
257
|
-
border: var(--sc-btn-border-
|
|
257
|
+
border: var(--sc-btn-border-width) var(--sc-btn-border-style) var(--sc-btn-border-color);
|
|
258
258
|
min-height: var(--sc-btn-height);
|
|
259
259
|
}
|
|
260
260
|
|
|
@@ -273,33 +273,37 @@ Button.styles = [
|
|
|
273
273
|
|
|
274
274
|
/*TYPES*/
|
|
275
275
|
:host([type="default"]) button {
|
|
276
|
-
--
|
|
277
|
-
--
|
|
276
|
+
--btn-color: var(--sc-base-content);
|
|
277
|
+
--btn-bg: var(--sc-base-100);
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
:host([type="primary"]) button {
|
|
281
|
-
--
|
|
282
|
-
--
|
|
281
|
+
--btn-color: var(--sc-primary-content);
|
|
282
|
+
--btn-bg: var(--sc-primary);
|
|
283
283
|
}
|
|
284
284
|
:host([type="warning"]) button {
|
|
285
|
-
--
|
|
286
|
-
--
|
|
285
|
+
--btn-color: var(--sc-warning-content);
|
|
286
|
+
--btn-bg: var(--sc-warning);
|
|
287
287
|
}
|
|
288
288
|
:host([type="danger"]) button {
|
|
289
|
-
--
|
|
290
|
-
--
|
|
289
|
+
--btn-color: var(--sc-danger-content);
|
|
290
|
+
--btn-bg: var(--sc-danger);
|
|
291
291
|
}
|
|
292
292
|
:host([type="info"]) button {
|
|
293
|
-
--
|
|
294
|
-
--
|
|
293
|
+
--btn-color: var(--sc-info-content);
|
|
294
|
+
--btn-bg: var(--sc-info);
|
|
295
295
|
}
|
|
296
296
|
:host([type="success"]) button {
|
|
297
|
-
--
|
|
298
|
-
--
|
|
297
|
+
--btn-color: var(--sc-success-content);
|
|
298
|
+
--btn-bg: var(--sc-success);
|
|
299
299
|
}
|
|
300
300
|
:host([type="neutral"]) button {
|
|
301
|
-
--
|
|
302
|
-
--
|
|
301
|
+
--btn-color: var(--sc-base);
|
|
302
|
+
--btn-bg: var(--sc-base-600);
|
|
303
|
+
}
|
|
304
|
+
:host([type="custom"]) button {
|
|
305
|
+
--btn-color: var(--sc-btn-custom-color);
|
|
306
|
+
--btn-bg: var(--sc-btn-custom-bg);
|
|
303
307
|
}
|
|
304
308
|
|
|
305
309
|
/*UNSTYLED*/
|
|
@@ -324,12 +328,12 @@ Button.styles = [
|
|
|
324
328
|
|
|
325
329
|
/*GHOST*/
|
|
326
330
|
:host([variant="ghost"][type]) button {
|
|
327
|
-
color: var(--
|
|
331
|
+
color: var(--btn-bg);
|
|
328
332
|
background: transparent;
|
|
329
333
|
}
|
|
330
334
|
|
|
331
335
|
:host([variant="ghost"][type="default"]) button {
|
|
332
|
-
color: var(--
|
|
336
|
+
color: var(--btn-color);
|
|
333
337
|
background: transparent;
|
|
334
338
|
}
|
|
335
339
|
|
|
@@ -350,8 +354,8 @@ Button.styles = [
|
|
|
350
354
|
|
|
351
355
|
/*OUTLINE*/
|
|
352
356
|
:host([variant="outline"][type]) button {
|
|
353
|
-
border-color: var(--
|
|
354
|
-
color: var(--
|
|
357
|
+
border-color: var(--btn-bg);
|
|
358
|
+
color: var(--btn-bg);
|
|
355
359
|
background: transparent;
|
|
356
360
|
}
|
|
357
361
|
|
|
@@ -363,7 +367,7 @@ Button.styles = [
|
|
|
363
367
|
|
|
364
368
|
/*:host([variant="outline"]) button:focus,*/
|
|
365
369
|
:host([variant="outline"]) button:hover {
|
|
366
|
-
background: var(--
|
|
370
|
+
background: var(--btn-outline-bg-hover);
|
|
367
371
|
}
|
|
368
372
|
|
|
369
373
|
/*OUTLINE*/
|
|
@@ -388,7 +392,7 @@ Button.styles = [
|
|
|
388
392
|
}
|
|
389
393
|
|
|
390
394
|
:host([variant="link"][type]) button {
|
|
391
|
-
color: var(--
|
|
395
|
+
color: var(--btn-bg);
|
|
392
396
|
}
|
|
393
397
|
:host([variant="link"][type="default"]) button {
|
|
394
398
|
color: inherit;
|
|
@@ -408,7 +412,7 @@ Button.styles = [
|
|
|
408
412
|
:host([shape="square"]) button {
|
|
409
413
|
width: var(--sc-btn-height);
|
|
410
414
|
height: var(--sc-btn-height);
|
|
411
|
-
overflow: hidden
|
|
415
|
+
/*overflow: hidden;*/ /* fix bug #42622 */
|
|
412
416
|
padding: 0;
|
|
413
417
|
align-items: center;
|
|
414
418
|
justify-content: 0;
|
|
@@ -59,6 +59,7 @@ declare const Checkbox_base: {
|
|
|
59
59
|
requestUpdate(): void;
|
|
60
60
|
getAttribute(name: string): string;
|
|
61
61
|
hasAttribute(attributeName: string): boolean;
|
|
62
|
+
getBoundingClientRect(): DOMRect;
|
|
62
63
|
};
|
|
63
64
|
} & {
|
|
64
65
|
new (...args: any[]): {
|
|
@@ -136,6 +137,7 @@ declare const Checkbox_base: {
|
|
|
136
137
|
getAttribute(name: string): string;
|
|
137
138
|
hasAttribute(attributeName: string): boolean;
|
|
138
139
|
disconnectedCallback(): void;
|
|
140
|
+
getBoundingClientRect(): DOMRect;
|
|
139
141
|
};
|
|
140
142
|
} & (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;
|
|
141
143
|
/**
|
|
@@ -163,6 +165,7 @@ export declare class Checkbox extends Checkbox_base {
|
|
|
163
165
|
touched: boolean;
|
|
164
166
|
iconName: string;
|
|
165
167
|
indeterminateIconName: string;
|
|
168
|
+
showAsIndeterminate: boolean;
|
|
166
169
|
hasDescription: boolean;
|
|
167
170
|
hasLabel: boolean;
|
|
168
171
|
slotLabelNodes: Array<Node>;
|
|
@@ -41,6 +41,7 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
|
|
|
41
41
|
this.touched = false;
|
|
42
42
|
this.iconName = "check";
|
|
43
43
|
this.indeterminateIconName = "minus-small";
|
|
44
|
+
this.showAsIndeterminate = false;
|
|
44
45
|
this.hasDescription = false;
|
|
45
46
|
this.hasLabel = false;
|
|
46
47
|
}
|
|
@@ -56,7 +57,8 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
|
|
|
56
57
|
hasSlotOrProps() {
|
|
57
58
|
var _a, _b;
|
|
58
59
|
this.hasLabel = this.label || ((_a = this.slotLabelNodes) === null || _a === void 0 ? void 0 : _a.length) ? true : false;
|
|
59
|
-
this.hasDescription =
|
|
60
|
+
this.hasDescription =
|
|
61
|
+
this.description || ((_b = this.slotDescriptionNodes) === null || _b === void 0 ? void 0 : _b.length) ? true : false;
|
|
60
62
|
}
|
|
61
63
|
render() {
|
|
62
64
|
//let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
@@ -69,6 +71,7 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
|
|
|
69
71
|
@click=${this.handleChange}
|
|
70
72
|
@blur=${this.handleBlur}
|
|
71
73
|
?required=${this.required}
|
|
74
|
+
?data-indeterminate=${this.showAsIndeterminate}
|
|
72
75
|
.disabled=${ifDefined(this.disabled)}
|
|
73
76
|
.checked=${ifDefined(this.checked)}
|
|
74
77
|
.name=${this.name}
|
|
@@ -77,7 +80,9 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
|
|
|
77
80
|
aria-label=${ifDefined(this.ariaLabel)}
|
|
78
81
|
aria-labelledby=${ifDefined(this.ariaLabelledby)}
|
|
79
82
|
/>
|
|
80
|
-
<sonic-icon name="${this.checked == "indeterminate"
|
|
83
|
+
<sonic-icon name="${this.checked == "indeterminate" || this.showAsIndeterminate
|
|
84
|
+
? this.indeterminateIconName
|
|
85
|
+
: this.iconName}" class="sc-input-icon"></sonic-icon>
|
|
81
86
|
</span>
|
|
82
87
|
|
|
83
88
|
<div class="checkbox-text ${!this.hasDescription && !this.hasLabel ? "hidden" : "checkbox-text"}">
|
|
@@ -134,7 +139,8 @@ Checkbox.styles = [
|
|
|
134
139
|
outline: none;
|
|
135
140
|
margin: 0;
|
|
136
141
|
background-color: var(--sc-checkbox-bg);
|
|
137
|
-
border: var(--sc-checkbox-border-width) solid
|
|
142
|
+
border: var(--sc-checkbox-border-width) solid
|
|
143
|
+
var(--sc-checkbox-border-color);
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
input:focus,
|
|
@@ -169,11 +175,13 @@ Checkbox.styles = [
|
|
|
169
175
|
|
|
170
176
|
/*Active */
|
|
171
177
|
input:checked,
|
|
178
|
+
input[data-indeterminate],
|
|
172
179
|
input[checked] {
|
|
173
180
|
--sc-checkbox-border-color: var(--sc-primary);
|
|
174
181
|
--sc-checkbox-bg: var(--sc-primary);
|
|
175
182
|
}
|
|
176
183
|
input:checked + sonic-icon,
|
|
184
|
+
input[data-indeterminate] + sonic-icon,
|
|
177
185
|
input[checked] + sonic-icon {
|
|
178
186
|
--sc-checkbox-color: var(--sc-primary-content);
|
|
179
187
|
transform: translateX(-50%) translateY(-50%) scale(1);
|
|
@@ -228,6 +236,9 @@ __decorate([
|
|
|
228
236
|
__decorate([
|
|
229
237
|
property({ type: String })
|
|
230
238
|
], Checkbox.prototype, "indeterminateIconName", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
property({ type: Boolean })
|
|
241
|
+
], Checkbox.prototype, "showAsIndeterminate", void 0);
|
|
231
242
|
__decorate([
|
|
232
243
|
property({ type: Boolean })
|
|
233
244
|
], Checkbox.prototype, "hasDescription", void 0);
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
|
+
export const passwordToggle = css `
|
|
3
|
+
.password-toggle {
|
|
4
|
+
color: var(--sc-input-c);
|
|
5
|
+
font-size: var(--sc-input-fs);
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
margin-right: calc(-0.5 * var(--sc-input-px));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host([inlineContent]) .has-suffix .password-toggle {
|
|
11
|
+
margin-right: 0;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
2
14
|
export const label = css `
|
|
3
15
|
:host {
|
|
4
16
|
--sc-label-fs: var(--sc-fs, 1rem);
|
|
@@ -168,6 +180,11 @@ export const formControl = css `
|
|
|
168
180
|
margin-left: auto;
|
|
169
181
|
}
|
|
170
182
|
|
|
183
|
+
:host([inlineContent]) .no-suffix slot[name="suffix"],
|
|
184
|
+
:host([inlineContent]) .no-prefix slot[name="prefix"] {
|
|
185
|
+
display: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
171
188
|
/* :host([inlineContent]) .input {
|
|
172
189
|
|
|
173
190
|
}*/
|
|
@@ -50,14 +50,12 @@ declare const Input_base: {
|
|
|
50
50
|
removeAttribute(name: string): void;
|
|
51
51
|
initPublisher(): void;
|
|
52
52
|
getApiConfiguration(): import("../../../../utils/api").APIConfiguration;
|
|
53
|
-
/**
|
|
54
|
-
* Taille du composant, implique notamment des modifications de typo et de marge interne
|
|
55
|
-
*/
|
|
56
53
|
connectedCallback(): void;
|
|
57
54
|
requestUpdate(): void;
|
|
58
55
|
getAttribute(name: string): string;
|
|
59
56
|
hasAttribute(attributeName: string): boolean;
|
|
60
57
|
disconnectedCallback(): void;
|
|
58
|
+
getBoundingClientRect(): DOMRect;
|
|
61
59
|
};
|
|
62
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;
|
|
63
61
|
export declare class Input extends Input_base {
|
|
@@ -78,6 +76,7 @@ export declare class Input extends Input_base {
|
|
|
78
76
|
src?: string;
|
|
79
77
|
inlineContent: boolean;
|
|
80
78
|
disableInlineContentFocus: boolean;
|
|
79
|
+
showPasswordToggle: boolean;
|
|
81
80
|
slotLabelNodes: Array<Node>;
|
|
82
81
|
slotDescriptionNodes: Array<Node>;
|
|
83
82
|
slotSuffixNodes: Array<Node>;
|
|
@@ -87,15 +86,18 @@ export declare class Input extends Input_base {
|
|
|
87
86
|
hasLabel: boolean;
|
|
88
87
|
hasSuffix: boolean;
|
|
89
88
|
hasPrefix: boolean;
|
|
89
|
+
isPassword: boolean;
|
|
90
90
|
sameValueAsHandle?: (v: string) => void;
|
|
91
91
|
sameValueAsName?: string;
|
|
92
92
|
connectedCallback(): void;
|
|
93
93
|
disconnectedCallback(): void;
|
|
94
94
|
willUpdate(changedProperties: PropertyValues): void;
|
|
95
|
+
setSelectionRange(start: number, end: number): void;
|
|
95
96
|
hasSlotOrProps(): void;
|
|
96
97
|
inlineContentFocus(): void;
|
|
97
98
|
changeTimeoutId?: ReturnType<typeof setTimeout>;
|
|
98
99
|
handleChange(e?: Event): void;
|
|
100
|
+
togglePasswordVisibility(): void;
|
|
99
101
|
render(): import("lit-html").TemplateResult<1>;
|
|
100
102
|
}
|
|
101
103
|
export {};
|
|
@@ -5,10 +5,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { html, LitElement, css } from "lit";
|
|
8
|
-
import { customElement, property, queryAssignedNodes, state } from "lit/decorators.js";
|
|
8
|
+
import { customElement, property, queryAssignedNodes, state, } from "lit/decorators.js";
|
|
9
9
|
import { query } from "lit/decorators/query.js";
|
|
10
10
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
11
|
-
import { formControl, label, description } from "@supersoniks/concorde/core/components/ui/form/css/form-control";
|
|
11
|
+
import { formControl, label, description, passwordToggle, } from "@supersoniks/concorde/core/components/ui/form/css/form-control";
|
|
12
12
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
13
13
|
import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
14
14
|
import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
|
|
@@ -32,10 +32,12 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
32
32
|
this.readonly = false;
|
|
33
33
|
this.inlineContent = false;
|
|
34
34
|
this.disableInlineContentFocus = false;
|
|
35
|
+
this.showPasswordToggle = false;
|
|
35
36
|
this.hasDescription = false;
|
|
36
37
|
this.hasLabel = false;
|
|
37
38
|
this.hasSuffix = false;
|
|
38
39
|
this.hasPrefix = false;
|
|
40
|
+
this.isPassword = false;
|
|
39
41
|
}
|
|
40
42
|
connectedCallback() {
|
|
41
43
|
super.connectedCallback();
|
|
@@ -48,6 +50,11 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
48
50
|
return;
|
|
49
51
|
formPublisher[this.sameValueAsName].onAssign(this.sameValueAsHandle);
|
|
50
52
|
}
|
|
53
|
+
if (this.type == "password") {
|
|
54
|
+
this.isPassword = true;
|
|
55
|
+
this.showPasswordToggle = true;
|
|
56
|
+
this.inlineContent = true;
|
|
57
|
+
}
|
|
51
58
|
}
|
|
52
59
|
disconnectedCallback() {
|
|
53
60
|
super.disconnectedCallback();
|
|
@@ -62,10 +69,14 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
62
69
|
this.hasSlotOrProps();
|
|
63
70
|
super.willUpdate(changedProperties);
|
|
64
71
|
}
|
|
72
|
+
setSelectionRange(start, end) {
|
|
73
|
+
this.input.setSelectionRange(start, end);
|
|
74
|
+
}
|
|
65
75
|
hasSlotOrProps() {
|
|
66
76
|
var _a, _b, _c, _d;
|
|
67
77
|
this.hasLabel = this.label || ((_a = this.slotLabelNodes) === null || _a === void 0 ? void 0 : _a.length) ? true : false;
|
|
68
|
-
this.hasDescription =
|
|
78
|
+
this.hasDescription =
|
|
79
|
+
this.description || ((_b = this.slotDescriptionNodes) === null || _b === void 0 ? void 0 : _b.length) ? true : false;
|
|
69
80
|
this.hasSuffix = ((_c = this.slotSuffixNodes) === null || _c === void 0 ? void 0 : _c.length) ? true : false;
|
|
70
81
|
this.hasPrefix = ((_d = this.slotPrefixNodes) === null || _d === void 0 ? void 0 : _d.length) ? true : false;
|
|
71
82
|
}
|
|
@@ -84,10 +95,19 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
84
95
|
clearTimeout(this.changeTimeoutId);
|
|
85
96
|
this.changeTimeoutId = setTimeout(() => super.handleChange(e), parseInt(this.getAttribute("inputDelayMs")));
|
|
86
97
|
}
|
|
98
|
+
// toggle password visibility
|
|
99
|
+
togglePasswordVisibility() {
|
|
100
|
+
this.isPassword = !this.isPassword;
|
|
101
|
+
this._type = this.isPassword ? "password" : "text";
|
|
102
|
+
console.log(this.isPassword);
|
|
103
|
+
// this.type = this.isPassword ? "password" : "text";
|
|
104
|
+
}
|
|
87
105
|
render() {
|
|
88
106
|
const slotClasses = {
|
|
89
107
|
"has-prefix": this.hasPrefix,
|
|
90
108
|
"has-suffix": this.hasSuffix,
|
|
109
|
+
"no-suffix": !this.hasSuffix,
|
|
110
|
+
"no-prefix": !this.hasPrefix,
|
|
91
111
|
};
|
|
92
112
|
//let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
93
113
|
return html `
|
|
@@ -128,6 +148,20 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
128
148
|
.name=${this.name}
|
|
129
149
|
.value=${this.value}
|
|
130
150
|
/>
|
|
151
|
+
${this.showPasswordToggle
|
|
152
|
+
? html `<sonic-button
|
|
153
|
+
shape="circle"
|
|
154
|
+
class="password-toggle"
|
|
155
|
+
@click=${this.togglePasswordVisibility}
|
|
156
|
+
aria-label="Toggle password visibility"
|
|
157
|
+
variant="unstyled"
|
|
158
|
+
>
|
|
159
|
+
<sonic-icon
|
|
160
|
+
library="heroicons"
|
|
161
|
+
name=${this.isPassword ? "eye" : "eye-slash"}
|
|
162
|
+
></sonic-icon>
|
|
163
|
+
</sonic-button>`
|
|
164
|
+
: ""}
|
|
131
165
|
<slot name="suffix" @slotchange=${this.hasSlotOrProps}></slot>
|
|
132
166
|
</div>
|
|
133
167
|
</div>
|
|
@@ -148,11 +182,15 @@ Input.styles = [
|
|
|
148
182
|
formControl,
|
|
149
183
|
label,
|
|
150
184
|
description,
|
|
185
|
+
passwordToggle,
|
|
151
186
|
css `
|
|
152
187
|
:host([type="hidden"]) {
|
|
153
188
|
appearance: none !important;
|
|
154
189
|
display: none !important;
|
|
155
190
|
}
|
|
191
|
+
:host > .form-control {
|
|
192
|
+
position: relative;
|
|
193
|
+
}
|
|
156
194
|
`,
|
|
157
195
|
];
|
|
158
196
|
__decorate([
|
|
@@ -194,6 +232,9 @@ __decorate([
|
|
|
194
232
|
__decorate([
|
|
195
233
|
property({ type: Boolean })
|
|
196
234
|
], Input.prototype, "disableInlineContentFocus", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
property({ type: Boolean })
|
|
237
|
+
], Input.prototype, "showPasswordToggle", void 0);
|
|
197
238
|
__decorate([
|
|
198
239
|
queryAssignedNodes({ slot: "label" })
|
|
199
240
|
], Input.prototype, "slotLabelNodes", void 0);
|
|
@@ -221,6 +262,9 @@ __decorate([
|
|
|
221
262
|
__decorate([
|
|
222
263
|
state()
|
|
223
264
|
], Input.prototype, "hasPrefix", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
state()
|
|
267
|
+
], Input.prototype, "isPassword", void 0);
|
|
224
268
|
Input = __decorate([
|
|
225
269
|
customElement(tagName)
|
|
226
270
|
], Input);
|