@supersoniks/concorde 1.1.45 → 1.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/concorde-core.bundle.js +39 -24
  2. package/concorde-core.es.js +701 -231
  3. package/core/components/functional/fetch/fetch.d.ts +2 -1
  4. package/core/components/functional/list/list.d.ts +3 -1
  5. package/core/components/functional/list/list.js +3 -1
  6. package/core/components/functional/queue/queue.d.ts +8 -1
  7. package/core/components/functional/queue/queue.js +126 -62
  8. package/core/components/functional/sdui/sdui.d.ts +2 -1
  9. package/core/components/ui/alert/alert.d.ts +3 -0
  10. package/core/components/ui/alert/alert.js +33 -1
  11. package/core/components/ui/badge/badge.d.ts +1 -1
  12. package/core/components/ui/badge/badge.js +9 -3
  13. package/core/components/ui/button/button.d.ts +1 -0
  14. package/core/components/ui/form/checkbox/checkbox.d.ts +3 -0
  15. package/core/components/ui/form/checkbox/checkbox.js +14 -3
  16. package/core/components/ui/form/css/form-control.d.ts +1 -0
  17. package/core/components/ui/form/css/form-control.js +17 -0
  18. package/core/components/ui/form/input/input.d.ts +5 -3
  19. package/core/components/ui/form/input/input.js +47 -3
  20. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +93 -13
  21. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +181 -52
  22. package/core/components/ui/form/textarea/textarea.d.ts +1 -0
  23. package/core/components/ui/icon/icon.js +1 -1
  24. package/core/components/ui/modal/modal-close.js +2 -3
  25. package/core/components/ui/modal/modal-content.js +1 -0
  26. package/core/components/ui/modal/modal.d.ts +8 -0
  27. package/core/components/ui/modal/modal.js +34 -6
  28. package/core/components/ui/pop/pop.js +18 -7
  29. package/core/components/ui/theme/theme-collection/core-variables.js +18 -9
  30. package/core/components/ui/theme/theme.js +8 -3
  31. package/core/mixins/Fetcher.d.ts +2 -1
  32. package/core/mixins/Fetcher.js +42 -10
  33. package/core/mixins/FormCheckable.d.ts +1 -0
  34. package/core/mixins/FormElement.d.ts +1 -0
  35. package/core/mixins/FormElement.js +6 -2
  36. package/core/mixins/FormInput.d.ts +1 -0
  37. package/core/mixins/Subscriber.d.ts +1 -0
  38. package/core/mixins/Subscriber.js +12 -7
  39. package/core/utils/PublisherProxy.d.ts +30 -3
  40. package/core/utils/PublisherProxy.js +218 -6
  41. package/core/utils/api.d.ts +3 -0
  42. package/core/utils/api.js +3 -1
  43. package/mixins.d.ts +4 -1
  44. package/package.json +5 -1
@@ -19,7 +19,7 @@ declare const Fetch_base: {
19
19
  onInvalidate?: (() => void) | undefined;
20
20
  disconnectedCallback(): void;
21
21
  connectedCallback(): void;
22
- firstUpdated(): void;
22
+ handleLazyLoad(): void;
23
23
  onIntersection(entries: IntersectionObserverEntry[]): void;
24
24
  propertyMap: object;
25
25
  isConnected: boolean;
@@ -45,6 +45,7 @@ declare const Fetch_base: {
45
45
  requestUpdate(): void;
46
46
  getAttribute(name: string): string;
47
47
  hasAttribute(attributeName: string): boolean;
48
+ getBoundingClientRect(): DOMRect;
48
49
  };
49
50
  } & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
50
51
  /**
@@ -24,7 +24,7 @@ declare const List_base: {
24
24
  onInvalidate?: (() => void) | undefined;
25
25
  disconnectedCallback(): void;
26
26
  connectedCallback(): void;
27
- firstUpdated(): void;
27
+ handleLazyLoad(): void;
28
28
  onIntersection(entries: IntersectionObserverEntry[]): void;
29
29
  propertyMap: object;
30
30
  isConnected: boolean;
@@ -50,6 +50,7 @@ declare const List_base: {
50
50
  requestUpdate(): void;
51
51
  getAttribute(name: string): string;
52
52
  hasAttribute(attributeName: string): boolean;
53
+ getBoundingClientRect(): DOMRect;
53
54
  };
54
55
  } & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
55
56
  /**
@@ -81,6 +82,7 @@ export declare class List extends List_base {
81
82
  */
82
83
  idKey: string;
83
84
  connectedCallback(): void;
85
+ disconnectedCallback(): void;
84
86
  renderLoadingState(): DirectiveResult<typeof TemplateContentDirective> | TemplateResult;
85
87
  renderNoResultState(): TemplateResult<1>;
86
88
  formatProps(): (import("../../../_types/types").CoreJSType[] & {
@@ -53,6 +53,9 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
53
53
  this.isLoading = true;
54
54
  super.connectedCallback();
55
55
  }
56
+ disconnectedCallback() {
57
+ super.disconnectedCallback();
58
+ }
56
59
  renderLoadingState() {
57
60
  return this.templateParts["skeleton"]
58
61
  ? templateContent(this.templateParts["skeleton"])
@@ -150,7 +153,6 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
150
153
  }
151
154
  if (key == "_sonic_http_response_")
152
155
  return nothing;
153
- ;
154
156
  if (typeof key != "string" && typeof key != "number")
155
157
  return nothing;
156
158
  const pub = this.publisher[key];
@@ -3,6 +3,7 @@ import "@supersoniks/concorde/core/components/functional/list/list";
3
3
  import { PublisherProxy } from "@supersoniks/concorde/core/utils/PublisherProxy";
4
4
  type QueueItem = {
5
5
  id: string;
6
+ endPoint: string;
6
7
  dataProvider: string;
7
8
  offset: number;
8
9
  limit: number;
@@ -27,19 +28,25 @@ export default class Queue extends Queue_base {
27
28
  /**
28
29
  * Durée cible en ms d'une requête pour afficher 1 lot.
29
30
  */
31
+ cache: RequestCache;
30
32
  targetRequestDuration: number;
31
33
  limit: number;
34
+ lazyBoundsRatio: number;
32
35
  offset: number;
33
36
  resultCount: number;
37
+ noLazyload: boolean;
34
38
  filteredFields: string;
35
39
  disconnectedCallback(): void;
36
40
  static instanceCounter: number;
37
- connectedCallback(): void;
41
+ instanceId: number;
42
+ localStorage: string;
43
+ connectedCallback(): Promise<void>;
38
44
  filterPublisher: PublisherProxy | null;
39
45
  configFilter(): void;
40
46
  filterTimeoutId?: ReturnType<typeof setTimeout>;
41
47
  searchHash: string;
42
48
  requestId: number;
49
+ isFirstRequest: boolean;
43
50
  updateFilteredContent(): void;
44
51
  /**
45
52
  * Cette expression est utilisée comme modèle par le composant Queue pour renseigngner le dataProvider de la [liste](./?path=/docs/core-components-functional-list-list--basic) créée.
@@ -4,11 +4,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14
+ });
15
+ };
7
16
  var Queue_1;
8
17
  import { html, LitElement, nothing } from "lit";
9
18
  import { customElement, property } from "lit/decorators.js";
10
19
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
11
- import { repeat } from "lit/directives/repeat.js";
20
+ import { map } from "lit/directives/map.js";
12
21
  import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
13
22
  import "@supersoniks/concorde/core/components/functional/list/list";
14
23
  import { HTML } from "@supersoniks/concorde/utils";
@@ -31,18 +40,24 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
31
40
  /**
32
41
  * Durée cible en ms d'une requête pour afficher 1 lot.
33
42
  */
43
+ this.cache = "default";
34
44
  this.targetRequestDuration = 500;
35
45
  /*
36
46
  * Quantité d'éléments devant être chargés dans le premier lot.
37
47
  * Cette valeur est mise à jour ensuite par Queue pour chauq lot pour se rapprocher tanque possible de *targetRequestDuration*
38
48
  */
39
49
  this.limit = 5;
50
+ this.lazyBoundsRatio = 1;
40
51
  this.offset = 0;
41
52
  this.resultCount = 0;
53
+ this.noLazyload = false;
42
54
  this.filteredFields = "";
55
+ this.instanceId = 0;
56
+ this.localStorage = "disabled";
43
57
  this.filterPublisher = null;
44
58
  this.searchHash = "";
45
59
  this.requestId = 0;
60
+ this.isFirstRequest = true;
46
61
  /**
47
62
  * Cette expression est utilisée comme modèle par le composant Queue pour renseigngner le dataProvider de la [liste](./?path=/docs/core-components-functional-list-list--basic) créée.
48
63
  * * l'expression *$offset* est alors remplacée par le numéro de l'élément à partir duquel démarrer
@@ -63,33 +78,47 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
63
78
  return;
64
79
  }
65
80
  connectedCallback() {
66
- this.noShadowDom = "";
67
- this.defferedDebug = this.hasAttribute("debug") || null;
68
- /**Compat avec states et routing **/
69
- if (!this.dataProviderExpression) {
70
- this.dataProviderExpression = HTML.getAncestorAttributeValue(this.parentElement, "dataProvider") || "";
71
- }
72
- if (!this.dataProvider)
73
- this.dataProvider = "sonic-queue-" + Queue_1.instanceCounter++;
74
- this.configFilter();
75
- super.connectedCallback();
76
- this.key = this.getAttribute("key");
77
- if (!this.templates)
78
- this.templates = Array.from(this.querySelectorAll("template"));
79
- this.lastRequestTime = new Date().getTime();
80
- const func = window.requestAnimationFrame;
81
- func(() => this.next());
81
+ const _super = Object.create(null, {
82
+ connectedCallback: { get: () => super.connectedCallback }
83
+ });
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ this.instanceId = Queue_1.instanceCounter++;
86
+ this.localStorage = this.getAttribute("localStorage") || this.localStorage;
87
+ this.removeAttribute("localStorage");
88
+ this.noShadowDom = "";
89
+ this.defferedDebug = this.hasAttribute("debug") || null;
90
+ /**Compat avec states et routing **/
91
+ if (!this.dataProvider)
92
+ this.dataProvider =
93
+ this.dataProviderExpression ||
94
+ "sonic-queue-" +
95
+ this.instanceId +
96
+ "-" +
97
+ Math.random().toString(36).substring(7);
98
+ if (!this.dataProviderExpression) {
99
+ this.dataProviderExpression =
100
+ HTML.getAncestorAttributeValue(this.parentElement, "dataProvider") ||
101
+ "";
102
+ }
103
+ _super.connectedCallback.call(this);
104
+ this.key = this.getAttribute("key");
105
+ if (!this.templates)
106
+ this.templates = Array.from(this.querySelectorAll("template"));
107
+ this.lastRequestTime = new Date().getTime();
108
+ yield PublisherManager.getInstance().isLocalStrorageReady;
109
+ this.configFilter();
110
+ });
82
111
  }
83
112
  configFilter() {
84
113
  var _a;
85
114
  const dataFilterProvider = this.getAncestorAttributeValue("dataFilterProvider");
86
- if (!dataFilterProvider)
115
+ if (!dataFilterProvider) {
116
+ this.next();
87
117
  return;
88
- this.filterPublisher = PublisherManager.getInstance().get(dataFilterProvider);
118
+ }
119
+ this.filterPublisher =
120
+ PublisherManager.getInstance().get(dataFilterProvider);
89
121
  (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.onInternalMutation(() => {
90
- var _a;
91
- if (Object.keys((_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get()).length == 0)
92
- return;
93
122
  this.updateFilteredContent();
94
123
  });
95
124
  }
@@ -108,12 +137,14 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
108
137
  let value = filterData[f];
109
138
  if (Array.isArray(value))
110
139
  value = value.filter((v) => v !== null);
111
- if ((this.filteredFields && !filteredFieldsArray.includes(f)) || value == null || value.toString() === "")
140
+ if ((this.filteredFields && !filteredFieldsArray.includes(f)) ||
141
+ value == null ||
142
+ value.toString() === "")
112
143
  continue;
113
144
  searchParams.set(f, filterData[f].toString());
114
145
  }
115
146
  const searchHash = searchParams.toString();
116
- if (searchHash == this.searchHash)
147
+ if (searchHash == this.searchHash && !this.isFirstRequest)
117
148
  return;
118
149
  this.searchHash = searchHash;
119
150
  /**
@@ -124,20 +155,22 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
124
155
  }
125
156
  this.listDataProviders = [];
126
157
  clearTimeout(this.filterTimeoutId);
127
- this.filterTimeoutId = setTimeout(() => {
158
+ this.filterTimeoutId = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
128
159
  const count = this.resultCount;
129
160
  this.props = null;
130
161
  //On garde le décompte au cas ou il n'y aurait pas rechargement
131
- this.resultCount = count;
132
162
  this.requestId++;
133
- this.next();
134
- }, 250);
163
+ this.resultCount = count;
164
+ yield PublisherManager.getInstance().isLocalStrorageReady;
165
+ window.requestAnimationFrame(() => this.next());
166
+ }), this.isFirstRequest ? 0 : 400);
167
+ this.isFirstRequest = false;
135
168
  }
136
169
  resetDuration() {
137
170
  this.lastRequestTime = new Date().getTime();
138
171
  }
139
172
  next(e) {
140
- var _a, _b;
173
+ var _a;
141
174
  let offset = this.offset;
142
175
  const newTime = new Date().getTime();
143
176
  const requestDuration = newTime - this.lastRequestTime;
@@ -146,14 +179,17 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
146
179
  * Un ne repasse donc à 0 qu'à partir du premier chargement.
147
180
  * */
148
181
  if (!this.nextHadEvent && e) {
182
+ this.publisher.resultCount = 0;
149
183
  this.resultCount = 0;
150
184
  }
151
185
  this.nextHadEvent = !!e;
152
186
  if (e) {
153
- if (e.detail.requestId != this.requestId)
187
+ if (e.detail.requestId < this.requestId)
154
188
  return;
155
189
  this.resultCount += e.detail.props.length;
156
- if (!e.detail.isFirstLoad || !e.detail.props.length || this.dataProviderExpression.indexOf("$offset") == -1) {
190
+ if (!e.detail.isFirstLoad ||
191
+ !e.detail.props.length ||
192
+ this.dataProviderExpression.indexOf("$offset") == -1) {
157
193
  this.publisher.resultCount = this.resultCount;
158
194
  return;
159
195
  }
@@ -166,22 +202,27 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
166
202
  else {
167
203
  const props = this.props;
168
204
  const item = props[props.length - 1];
169
- offset = parseInt(item.offset.toString()) + parseInt(item.limit.toString());
205
+ offset =
206
+ parseInt(item.offset.toString()) + parseInt(item.limit.toString());
170
207
  }
171
- if (requestDuration > 0 && e)
208
+ if (requestDuration > 0 && e && !this.localStorage)
172
209
  this.limit = Math.round((this.limit / requestDuration) * this.targetRequestDuration);
173
210
  if (this.limit < 1)
174
211
  this.limit = 1;
175
212
  if (this.limit > 15)
176
213
  this.limit = 15;
177
- let dataProvider = this.dataProviderExpression.replace("$offset", offset + "").replace("$limit", this.limit + "");
214
+ let dataProvider = this.dataProviderExpression
215
+ .replace("$offset", offset + "")
216
+ .replace("$limit", this.limit + "");
178
217
  const split = dataProvider.split("?");
179
218
  const endpoint = split.shift();
180
219
  const searchParams = new URLSearchParams(split.join("?"));
181
220
  const filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
182
221
  const filteredFieldsArray = this.filteredFields.split(" ");
183
222
  for (const f in filterData) {
184
- if ((this.filteredFields && !filteredFieldsArray.includes(f)) || filterData[f] == null)
223
+ if ((this.filteredFields && filteredFieldsArray.includes(f)) ||
224
+ filterData[f] == null ||
225
+ filterData[f] == "")
185
226
  continue;
186
227
  searchParams.set(f, filterData[f]);
187
228
  }
@@ -189,12 +230,13 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
189
230
  this.searchHash = searchParams.toString();
190
231
  dataProvider = endpoint + "?" + searchParams.toString();
191
232
  this.listDataProviders.push(dataProvider);
192
- this.currentScrollPosition = (_b = document.scrollingElement) === null || _b === void 0 ? void 0 : _b.scrollTop;
233
+ // this.currentScrollPosition = document.scrollingElement?.scrollTop;
193
234
  const newProps = [
194
235
  ...this.props,
195
236
  {
196
237
  id: searchParams.toString() + "/" + this.props.length,
197
- dataProvider: dataProvider,
238
+ dataProvider: dataProvider + "_item_from_queue_" + this.instanceId,
239
+ endPoint: dataProvider,
198
240
  offset: offset,
199
241
  limit: this.limit,
200
242
  },
@@ -204,36 +246,49 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
204
246
  this.lastRequestTime = new Date().getTime();
205
247
  }
206
248
  render() {
207
- if (this.currentScrollPosition) {
208
- window.requestAnimationFrame(() => {
209
- if (document.scrollingElement && this.currentScrollPosition != undefined)
210
- document.scrollingElement.scrollTop = this.currentScrollPosition;
211
- this.currentScrollPosition = undefined;
212
- });
213
- }
249
+ /**
250
+ * supression du retablisment de la scroll pos.
251
+ **/
252
+ // if (this.currentScrollPosition) {
253
+ // window.requestAnimationFrame(() => {
254
+ // if (document.scrollingElement && this.currentScrollPosition != undefined)
255
+ // document.scrollingElement.scrollTop = this.currentScrollPosition;
256
+ // this.currentScrollPosition = undefined;
257
+ // });
258
+ // }
214
259
  if (!Array.isArray(this.props))
215
260
  return nothing;
261
+ let lazyload = !this.noLazyload;
262
+ if (this.props.length == 1) {
263
+ lazyload = false;
264
+ }
216
265
  return html `
217
- ${repeat(this.props, (item) => item.id, (item, index) => {
266
+ ${map(this.props, (item, index) => {
218
267
  var _a;
219
- const templates = index == 0 ? this.templates : (_a = this.templates) === null || _a === void 0 ? void 0 : _a.filter((elt) => elt.getAttribute("data-value") != "no-item");
268
+ const templates = index == 0
269
+ ? this.templates
270
+ : (_a = this.templates) === null || _a === void 0 ? void 0 : _a.filter((elt) => elt.getAttribute("data-value") != "no-item");
220
271
  return html `
221
- <sonic-list
222
- fetch
223
- displayContents
224
- lazyload
225
- requestId=${this.requestId}
226
- .itemPropertyMap=${this.itemPropertyMap}
227
- ?debug=${this.defferedDebug === true}
228
- @load=${this.next}
229
- key=${this.key}
230
- @loading=${this.resetDuration}
231
- dataProvider="${item.dataProvider}"
232
- idKey=${this.idKey}
233
- .templates=${templates}
234
- >
235
- </sonic-list>
236
- `;
272
+ <sonic-list
273
+ fetch
274
+ cache=${this.cache}
275
+ displayContents
276
+ lazyBoundsRatio=${this.lazyBoundsRatio}
277
+ ?lazyload=${lazyload}
278
+ localStorage=${this.localStorage}
279
+ requestId=${this.requestId}
280
+ .itemPropertyMap=${this.itemPropertyMap}
281
+ ?debug=${this.defferedDebug === true}
282
+ @load=${this.next}
283
+ key=${this.key}
284
+ @loading=${this.resetDuration}
285
+ dataProvider="${item.dataProvider}"
286
+ endPoint="${item.endPoint}"
287
+ idKey=${this.idKey}
288
+ .templates=${templates}
289
+ >
290
+ </sonic-list>
291
+ `;
237
292
  })}
238
293
  `;
239
294
  }
@@ -245,18 +300,27 @@ __decorate([
245
300
  __decorate([
246
301
  property({ type: Object })
247
302
  ], Queue.prototype, "itemPropertyMap", void 0);
303
+ __decorate([
304
+ property()
305
+ ], Queue.prototype, "cache", void 0);
248
306
  __decorate([
249
307
  property()
250
308
  ], Queue.prototype, "targetRequestDuration", void 0);
251
309
  __decorate([
252
310
  property()
253
311
  ], Queue.prototype, "limit", void 0);
312
+ __decorate([
313
+ property()
314
+ ], Queue.prototype, "lazyBoundsRatio", void 0);
254
315
  __decorate([
255
316
  property()
256
317
  ], Queue.prototype, "offset", void 0);
257
318
  __decorate([
258
319
  property()
259
320
  ], Queue.prototype, "resultCount", void 0);
321
+ __decorate([
322
+ property({ type: Boolean })
323
+ ], Queue.prototype, "noLazyload", void 0);
260
324
  __decorate([
261
325
  property()
262
326
  ], Queue.prototype, "filteredFields", void 0);
@@ -19,7 +19,7 @@ declare const SonicSDUI_base: {
19
19
  onInvalidate?: (() => void) | undefined;
20
20
  disconnectedCallback(): void;
21
21
  connectedCallback(): void;
22
- firstUpdated(): void;
22
+ handleLazyLoad(): void;
23
23
  onIntersection(entries: IntersectionObserverEntry[]): void;
24
24
  propertyMap: object;
25
25
  isConnected: boolean;
@@ -45,6 +45,7 @@ declare const SonicSDUI_base: {
45
45
  requestUpdate(): void;
46
46
  getAttribute(name: string): string;
47
47
  hasAttribute(attributeName: string): boolean;
48
+ getBoundingClientRect(): DOMRect;
48
49
  };
49
50
  } & (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
50
51
  /**
@@ -9,12 +9,15 @@ export declare class Alert extends LitElement {
9
9
  * Titre du message d'erreur
10
10
  */
11
11
  label: string;
12
+ noIcon: boolean;
12
13
  /**
13
14
  * Peut être renseigné dans le slot pour créer des messages plus complexes
14
15
  */
15
16
  text: string;
16
17
  size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
18
+ dismissible: boolean;
17
19
  background: boolean;
18
20
  status: "default" | "error" | "warning" | "primary" | "info";
19
21
  render(): import("lit-html").TemplateResult<1>;
22
+ close(): void;
20
23
  }
@@ -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
- <div>${this.status && html `<sonic-icon name=${icon[this.status]}></sonic-icon>`}</div>
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 var(--sc-badge-border-color);
53
+ --sc-badge-border: var(--sc-badge-border-with) solid
54
+ var(--sc-badge-border-color);
54
55
 
55
- --sc-badge-rounded: 99px;
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
  /**
@@ -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>;