@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.
Files changed (54) hide show
  1. package/README.md +9 -7
  2. package/concorde-core.bundle.js +39 -24
  3. package/concorde-core.es.js +907 -320
  4. package/core/components/functional/fetch/fetch.d.ts +2 -1
  5. package/core/components/functional/list/list.d.ts +3 -1
  6. package/core/components/functional/list/list.js +12 -7
  7. package/core/components/functional/queue/queue.d.ts +9 -2
  8. package/core/components/functional/queue/queue.js +131 -67
  9. package/core/components/functional/router/router.js +13 -4
  10. package/core/components/functional/sdui/sdui.d.ts +3 -2
  11. package/core/components/functional/sdui/sdui.js +1 -1
  12. package/core/components/functional/states/states.js +1 -0
  13. package/core/components/functional/value/value.js +3 -2
  14. package/core/components/ui/alert/alert.d.ts +3 -0
  15. package/core/components/ui/alert/alert.js +33 -1
  16. package/core/components/ui/badge/badge.d.ts +1 -1
  17. package/core/components/ui/badge/badge.js +9 -3
  18. package/core/components/ui/button/button.d.ts +1 -0
  19. package/core/components/ui/button/button.js +32 -28
  20. package/core/components/ui/form/checkbox/checkbox.d.ts +3 -0
  21. package/core/components/ui/form/checkbox/checkbox.js +14 -3
  22. package/core/components/ui/form/css/form-control.d.ts +1 -0
  23. package/core/components/ui/form/css/form-control.js +17 -0
  24. package/core/components/ui/form/input/input.d.ts +5 -3
  25. package/core/components/ui/form/input/input.js +47 -3
  26. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +93 -13
  27. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +181 -52
  28. package/core/components/ui/form/select/select.js +16 -4
  29. package/core/components/ui/form/textarea/textarea.d.ts +1 -0
  30. package/core/components/ui/group/group.js +7 -1
  31. package/core/components/ui/icon/icon.js +1 -1
  32. package/core/components/ui/modal/modal-close.js +2 -3
  33. package/core/components/ui/modal/modal-content.js +1 -0
  34. package/core/components/ui/modal/modal.d.ts +8 -0
  35. package/core/components/ui/modal/modal.js +34 -6
  36. package/core/components/ui/pop/pop.d.ts +5 -4
  37. package/core/components/ui/pop/pop.js +85 -44
  38. package/core/components/ui/theme/theme-collection/core-variables.js +18 -9
  39. package/core/components/ui/theme/theme.js +8 -3
  40. package/core/components/ui/tooltip/tooltip.js +3 -3
  41. package/core/mixins/Fetcher.d.ts +2 -1
  42. package/core/mixins/Fetcher.js +42 -10
  43. package/core/mixins/FormCheckable.d.ts +1 -0
  44. package/core/mixins/FormElement.d.ts +1 -0
  45. package/core/mixins/FormElement.js +6 -2
  46. package/core/mixins/FormInput.d.ts +1 -0
  47. package/core/mixins/Subscriber.d.ts +1 -0
  48. package/core/mixins/Subscriber.js +17 -12
  49. package/core/utils/PublisherProxy.d.ts +30 -3
  50. package/core/utils/PublisherProxy.js +218 -6
  51. package/core/utils/api.d.ts +29 -3
  52. package/core/utils/api.js +117 -24
  53. package/mixins.d.ts +4 -1
  54. package/package.json +7 -2
@@ -21,17 +21,33 @@ let Modal = class Modal extends Subscriber(LitElement) {
21
21
  constructor() {
22
22
  super(...arguments);
23
23
  this.forceAction = false;
24
+ this.removeOnHide = false;
24
25
  this.align = "left";
25
26
  this.padding = "var(--sc-modal-py) var(--sc-modal-px)";
26
27
  this.maxWidth = "var(--sc-modal-max-w) ";
27
28
  this.maxHeight = "var(--sc-modal-max-h) ";
28
29
  this.width = "100%";
29
30
  this.height = "auto";
31
+ this.zIndex = "var(--sc-modal-z-index)";
30
32
  this.fullScreen = false;
31
33
  this.visible = false;
32
34
  }
33
35
  static create(options) {
34
36
  const modal = document.createElement(tagName);
37
+ // modal styles
38
+ if (options.removeOnHide === true)
39
+ modal.setAttribute("removeOnHide", "true");
40
+ if (options.maxWidth)
41
+ modal.maxWidth = options === null || options === void 0 ? void 0 : options.maxWidth;
42
+ if (options.width)
43
+ modal.width = options === null || options === void 0 ? void 0 : options.width;
44
+ if (options.paddingX)
45
+ modal.style.setProperty("--sc-modal-px", options === null || options === void 0 ? void 0 : options.paddingX);
46
+ if (options.paddingY)
47
+ modal.style.setProperty("--sc-modal-py", options === null || options === void 0 ? void 0 : options.paddingY);
48
+ if (options.zIndex)
49
+ modal.style.setProperty("--sc-modal-z-index", options === null || options === void 0 ? void 0 : options.zIndex);
50
+ // inner content
35
51
  modal.innerHTML =
36
52
  `<sonic-modal-close></sonic-modal-close><sonic-modal-content>${options.content}</sonic-modal-content>` || "";
37
53
  const container = document.querySelector("sonic-theme") || document.body;
@@ -67,6 +83,7 @@ let Modal = class Modal extends Subscriber(LitElement) {
67
83
  maxHeight: this.maxHeight,
68
84
  width: this.width,
69
85
  height: this.height,
86
+ zIndex: this.zIndex,
70
87
  borderRadius: this.fullScreen ? "0" : "var(--sc-modal-rounded)",
71
88
  };
72
89
  const modalWrapperStyles = {
@@ -105,7 +122,7 @@ let Modal = class Modal extends Subscriber(LitElement) {
105
122
 
106
123
  <div
107
124
  class="overlay"
108
- @click="${!this.forceAction ? this.hide : ""}"
125
+ @click="${!this.forceAction ? this.hide : null}"
109
126
  ${animate({
110
127
  keyframeOptions: {
111
128
  duration: 500,
@@ -130,6 +147,9 @@ let Modal = class Modal extends Subscriber(LitElement) {
130
147
  if (this.hasAttribute("resetDataProviderOnHide")) {
131
148
  PublisherManager.get(this.getAttribute("resetDataProviderOnHide")).set({});
132
149
  }
150
+ if (this.removeOnHide) {
151
+ this.remove();
152
+ }
133
153
  }
134
154
  dispose() {
135
155
  this.hide();
@@ -138,9 +158,9 @@ let Modal = class Modal extends Subscriber(LitElement) {
138
158
  handleEscape(e) {
139
159
  if (e.key === "Escape") {
140
160
  const modals = [...document.querySelectorAll(tagName)];
141
- modals.forEach((item) => {
142
- if (!this.forceAction) {
143
- item.hide();
161
+ modals.forEach((modal) => {
162
+ if (!modal.forceAction) {
163
+ modal.hide();
144
164
  }
145
165
  });
146
166
  }
@@ -164,6 +184,7 @@ Modal.styles = [
164
184
  --sc-modal-max-w: min(100vw, 64ch);
165
185
  --sc-modal-max-h: 80vh;
166
186
  --sc-modal-rounded: var(--sc-rounded-lg);
187
+ --sc-modal-z-index: 990;
167
188
  }
168
189
 
169
190
  * {
@@ -175,7 +196,7 @@ Modal.styles = [
175
196
  bottom: 0;
176
197
  left: 0;
177
198
  width: 100%;
178
- z-index: 990;
199
+ z-index: calc(var(--sc-modal-z-index) + 1);
179
200
  align-items: center;
180
201
  justify-content: center;
181
202
  flex-direction: column;
@@ -207,7 +228,7 @@ Modal.styles = [
207
228
  top: 0;
208
229
  right: 0;
209
230
  bottom: 0;
210
- z-index: 900;
231
+ z-index: var(--sc-modal-z-index);
211
232
  opacity: 0.8;
212
233
  position: fixed;
213
234
  }
@@ -226,6 +247,7 @@ Modal.styles = [
226
247
  .modal {
227
248
  max-width: none !important;
228
249
  width: 100% !important;
250
+ border-radius: var(--sc-modal-rounded) var(--sc-modal-rounded) 0 0 !important;
229
251
  }
230
252
  }
231
253
 
@@ -270,6 +292,9 @@ Modal.styles = [
270
292
  __decorate([
271
293
  property({ type: Boolean })
272
294
  ], Modal.prototype, "forceAction", void 0);
295
+ __decorate([
296
+ property({ type: Boolean })
297
+ ], Modal.prototype, "removeOnHide", void 0);
273
298
  __decorate([
274
299
  property({ type: String, reflect: true })
275
300
  ], Modal.prototype, "align", void 0);
@@ -288,6 +313,9 @@ __decorate([
288
313
  __decorate([
289
314
  property({ type: String })
290
315
  ], Modal.prototype, "height", void 0);
316
+ __decorate([
317
+ property({ type: String })
318
+ ], Modal.prototype, "zIndex", void 0);
291
319
  __decorate([
292
320
  property({ type: Boolean, reflect: true })
293
321
  ], Modal.prototype, "fullScreen", void 0);
@@ -1,4 +1,4 @@
1
- import { LitElement } from "lit";
1
+ import { LitElement, PropertyValues } from "lit";
2
2
  type PopPlacement = "bottom" | "top" | "right" | "left";
3
3
  export declare class Pop extends LitElement {
4
4
  static pops: Set<Pop>;
@@ -6,7 +6,6 @@ export declare class Pop extends LitElement {
6
6
  open: boolean;
7
7
  popBtn: HTMLElement;
8
8
  popContent: HTMLElement;
9
- toggle: "true" | "false";
10
9
  noToggle: boolean;
11
10
  inline: boolean;
12
11
  /**
@@ -17,14 +16,16 @@ export declare class Pop extends LitElement {
17
16
  positioningRuns: boolean;
18
17
  lastContentX: number;
19
18
  lastContentY: number;
20
- runPositioning(): void;
19
+ resizeObserver: ResizeObserver;
20
+ runPositioningLoop(): void;
21
21
  _toggle(e: Event): void;
22
22
  _show(): void;
23
23
  _hide(): void;
24
24
  _handleClosePop(e: Event): void;
25
25
  connectedCallback(): void;
26
+ protected firstUpdated(_changedProperties: PropertyValues): void;
26
27
  disconnectedCallback(): void;
27
- _setUpMenu(placement: PopPlacement): void;
28
+ computePosition(placement: PopPlacement): void;
28
29
  render(): import("lit-html").TemplateResult<1>;
29
30
  }
30
31
  export {};
@@ -13,7 +13,6 @@ let Pop = Pop_1 = class Pop extends LitElement {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  this.open = false;
16
- this.toggle = "true";
17
16
  this.noToggle = false;
18
17
  this.inline = false;
19
18
  /**
@@ -22,15 +21,16 @@ let Pop = Pop_1 = class Pop extends LitElement {
22
21
  this.shadow = "lg";
23
22
  this.placement = "bottom";
24
23
  this.positioningRuns = false;
25
- this.lastContentX = Number.NaN;
26
- this.lastContentY = Number.NaN;
24
+ this.lastContentX = 0;
25
+ this.lastContentY = 0;
26
+ this.resizeObserver = new ResizeObserver(() => this.computePosition(this.placement));
27
27
  }
28
- runPositioning() {
28
+ runPositioningLoop() {
29
29
  if (!this.positioningRuns)
30
30
  return;
31
31
  this.positioningRuns = true;
32
- this._setUpMenu(this.placement);
33
- window.requestAnimationFrame(() => this.runPositioning());
32
+ this.computePosition(this.placement);
33
+ window.requestAnimationFrame(() => this.runPositioningLoop());
34
34
  }
35
35
  _toggle(e) {
36
36
  if (this.open && this.noToggle)
@@ -42,19 +42,22 @@ let Pop = Pop_1 = class Pop extends LitElement {
42
42
  this.open ? this._show() : this._hide();
43
43
  }
44
44
  _show() {
45
+ this.popContent.style.removeProperty("display");
45
46
  this.open = true;
46
47
  this.popContent.setAttribute("tabindex", "0");
47
48
  if (this.popBtn && this.popContent && !this.positioningRuns) {
48
49
  this.positioningRuns = true;
49
- this.lastContentX = Number.NaN;
50
- this.lastContentY = Number.NaN;
51
- this.runPositioning();
50
+ this.lastContentX = 0;
51
+ this.lastContentY = 0;
52
+ this.runPositioningLoop();
52
53
  }
54
+ this.dispatchEvent(new CustomEvent("show"));
53
55
  }
54
56
  _hide() {
55
57
  this.open = false;
56
58
  this.popContent.setAttribute("tabindex", "-1");
57
59
  this.positioningRuns = false;
60
+ this.dispatchEvent(new CustomEvent("hide"));
58
61
  }
59
62
  _handleClosePop(e) {
60
63
  const path = e.composedPath();
@@ -65,7 +68,8 @@ let Pop = Pop_1 = class Pop extends LitElement {
65
68
  const isCloseManual = HTML.getAncestorAttributeValue(target, "data-on-select") === "keep";
66
69
  if (e.type == "pointerdown" && popContainsTarget)
67
70
  return;
68
- if (e.type == "click" && ((popContainsTarget && isCloseManual) || !popContentContainsTarget))
71
+ if (e.type == "click" &&
72
+ ((popContainsTarget && isCloseManual) || !popContentContainsTarget))
69
73
  return;
70
74
  pop._hide();
71
75
  });
@@ -78,6 +82,13 @@ let Pop = Pop_1 = class Pop extends LitElement {
78
82
  }
79
83
  Pop_1.pops.add(this);
80
84
  }
85
+ // /*
86
+ // On attends le premier rendu pour observer les changements de taille car popup content n'est pas encore défini sinon
87
+ // */
88
+ firstUpdated(_changedProperties) {
89
+ super.firstUpdated(_changedProperties);
90
+ this.resizeObserver.observe(this.popContent);
91
+ }
81
92
  disconnectedCallback() {
82
93
  super.disconnectedCallback();
83
94
  Pop_1.pops.delete(this);
@@ -85,22 +96,20 @@ let Pop = Pop_1 = class Pop extends LitElement {
85
96
  document.removeEventListener("pointerdown", this._handleClosePop);
86
97
  document.removeEventListener("click", this._handleClosePop);
87
98
  }
99
+ this.resizeObserver.unobserve(this.popContent);
88
100
  }
89
- _setUpMenu(placement) {
90
- var _a;
91
- const contentRect = (_a = this.popContent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
101
+ computePosition(placement) {
102
+ var _a, _b, _c;
103
+ let contentRect = (_a = this.popContent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
92
104
  const padding = 8;
93
- const shiftPadding = 20;
105
+ const shiftPadding = 5;
94
106
  const thisRect = this.getBoundingClientRect();
95
- if (!this.offsetParent)
96
- return;
97
- const bodyRect = this.offsetParent.getBoundingClientRect();
98
- const x0 = thisRect.left - bodyRect.left;
99
- const y0 = thisRect.top - bodyRect.top;
107
+ const x0 = thisRect.left;
108
+ const y0 = thisRect.top;
100
109
  let x = x0, y = y0;
101
110
  const yTop = y0 - contentRect.height - padding;
102
- const xLeft = x0 - contentRect.width - 2 * padding;
103
- const xRight = x0 + thisRect.width + 2 * padding;
111
+ const xLeft = x0 - contentRect.width - padding;
112
+ const xRight = x0 + thisRect.width + padding;
104
113
  const yBottom = y0 + thisRect.height + padding;
105
114
  switch (placement) {
106
115
  case "bottom":
@@ -116,36 +125,71 @@ let Pop = Pop_1 = class Pop extends LitElement {
116
125
  x = xRight;
117
126
  break;
118
127
  }
119
- const dxRight = window.innerWidth - xRight - bodyRect.left - contentRect.width - shiftPadding;
120
- if (dxRight < 0 && placement === "right")
121
- x = xLeft;
122
- if (dxRight < 0 && ["top", "bottom"].includes(placement))
123
- x = Math.max(x + dxRight, xLeft + thisRect.width);
124
- const dxLeft = -bodyRect.left - xLeft;
125
- if (dxLeft > shiftPadding && placement === "left")
128
+ // const dxRight = window.innerWidth - xRight - bodyRect.left - contentRect.width - shiftPadding;
129
+ // if (dxRight < 0 && placement === "right") x = xLeft;
130
+ // if (dxRight < 0 && ["top", "bottom"].includes(placement)) x = Math.max(x + dxRight, xLeft + thisRect.width);
131
+ // const dxLeft = -bodyRect.left - xLeft;
132
+ // if (dxLeft > shiftPadding && placement === "left") x = xRight;
133
+ // const dyBottom = window.innerHeight - yBottom - bodyRect.top - contentRect.height - shiftPadding;
134
+ // if (dyBottom < 0 && placement === "bottom") y = yTop;
135
+ // if (dyBottom < 0 && ["left", "right"].includes(placement)) y = Math.max(y + dyBottom, yTop + thisRect.height);
136
+ // const dyTop = -bodyRect.top - yTop;
137
+ // if (dyTop > -shiftPadding && placement === "top") y = yBottom;
138
+ this.lastContentX += x - contentRect.x;
139
+ this.lastContentY += y - contentRect.y;
140
+ Object.assign(this.popContent.style, {
141
+ left: `${this.lastContentX}px`,
142
+ top: `${this.lastContentY}px`,
143
+ });
144
+ contentRect = (_b = this.popContent) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
145
+ if (contentRect.x < shiftPadding && placement == "left")
126
146
  x = xRight;
127
- const dyBottom = window.innerHeight - yBottom - bodyRect.top - contentRect.height - shiftPadding;
128
- if (dyBottom < 0 && placement === "bottom")
129
- y = yTop;
130
- if (dyBottom < 0 && ["left", "right"].includes(placement))
131
- y = Math.max(y + dyBottom, yTop + thisRect.height);
132
- const dyTop = -bodyRect.top - yTop;
133
- if (dyTop > -shiftPadding && placement === "top")
147
+ if (contentRect.y < shiftPadding && placement == "top")
134
148
  y = yBottom;
135
- this.lastContentX = x;
136
- this.lastContentY = y;
149
+ if (contentRect.x + contentRect.width > window.innerWidth - shiftPadding &&
150
+ placement == "right")
151
+ x = xLeft;
152
+ if (contentRect.y + contentRect.height > window.innerHeight - shiftPadding &&
153
+ placement == "bottom")
154
+ y = yTop;
155
+ this.lastContentX += x - contentRect.x;
156
+ this.lastContentY += y - contentRect.y;
157
+ Object.assign(this.popContent.style, {
158
+ left: `${this.lastContentX}px`,
159
+ top: `${this.lastContentY}px`,
160
+ });
161
+ contentRect = (_c = this.popContent) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
162
+ if (contentRect.x < 0) {
163
+ this.lastContentX += -contentRect.x;
164
+ }
165
+ if (contentRect.y < 0) {
166
+ this.lastContentY += -contentRect.y;
167
+ }
168
+ if (contentRect.x + contentRect.width > window.innerWidth) {
169
+ this.lastContentX +=
170
+ window.innerWidth - (contentRect.x + contentRect.width);
171
+ }
172
+ if (contentRect.y + contentRect.height > window.innerHeight) {
173
+ this.lastContentY +=
174
+ window.innerHeight - (contentRect.y + contentRect.height);
175
+ }
137
176
  Object.assign(this.popContent.style, {
138
- left: `${x}px`,
139
- top: `${y}px`,
177
+ left: `${this.lastContentX}px`,
178
+ top: `${this.lastContentY}px`,
140
179
  });
141
180
  }
142
181
  render() {
143
182
  return html `
144
- <slot @click=${this._toggle} @keydown=${this._toggle} class="contents"></slot>
183
+ <slot
184
+ @click=${this._toggle}
185
+ @keydown=${this._toggle}
186
+ class="contents"
187
+ ></slot>
145
188
  <slot
146
189
  name="content"
147
190
  tabindex="-1"
148
191
  part="content"
192
+ style="display: none;"
149
193
  class="
150
194
  ${this.open ? "is-open" : ""}"
151
195
  ></slot>
@@ -174,7 +218,7 @@ Pop.styles = [
174
218
  border-radius: min(calc(var(--sc-btn-rounded) * 2), 0.4em);
175
219
  }
176
220
 
177
- slot[name="content"].is-open {
221
+ slot[name="content"].is-open:not(.is-empty) {
178
222
  transform: translateY(0) scale(1);
179
223
  opacity: 1;
180
224
  pointer-events: auto;
@@ -215,9 +259,6 @@ __decorate([
215
259
  __decorate([
216
260
  query("slot[name=content]")
217
261
  ], Pop.prototype, "popContent", void 0);
218
- __decorate([
219
- property({ type: String })
220
- ], Pop.prototype, "toggle", void 0);
221
262
  __decorate([
222
263
  property({ type: Boolean })
223
264
  ], Pop.prototype, "noToggle", void 0);
@@ -2,12 +2,13 @@ import { css } from "lit";
2
2
  export const coreVariables = css `
3
3
  :host {
4
4
  /* polices*/
5
- --sc-font-family-base: "Inter var", "Inter", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto,
6
- "Helvetica Neue", Arial, sans-serif;
5
+ --sc-font-family-base: "Inter var", "Inter", -apple-system, system-ui,
6
+ BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
7
+ sans-serif;
7
8
  --sc-font-weight-base: 400;
8
9
  --sc-font-style-base: normal;
9
10
 
10
- --sc-headings-font-family: var(--sc-font-family-base);
11
+ --sc-headings-font-family: var(--sc-font-family-base), sans-serif;
11
12
  --sc-headings-font-style: var(--sc-font-style-base);
12
13
  --sc-headings-line-height: 1.1;
13
14
  --sc-headings-font-weight: 700;
@@ -29,16 +30,23 @@ export const coreVariables = css `
29
30
  /* 4 for rounded full*/
30
31
  --sc-btn-rounded-intensity: 1.4;
31
32
  --sc-btn-font-weight: 500;
32
- --sc-btn-rounded: calc((var(--sc-rounded) + var(--sc-rounded-size-intensity)) * var(--sc-btn-rounded-intensity));
33
+ --sc-btn-rounded: calc(
34
+ (var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
35
+ var(--sc-btn-rounded-intensity)
36
+ );
33
37
 
34
38
  /* Placeholder */
35
39
  --sc-placeholder-bg: rgba(17, 24, 39, 0.05);
36
40
 
37
41
  /* OMBRES */
38
- --sc-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
39
- --sc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
40
- --sc-shadow-lg: 0 10px 15px 0px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
41
- --sc-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
42
+ --sc-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1),
43
+ 0 1px 2px -1px rgb(0 0 0 / 0.1);
44
+ --sc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1),
45
+ 0 2px 4px -2px rgb(0 0 0 / 0.1);
46
+ --sc-shadow-lg: 0 10px 15px 0px rgb(0 0 0 / 0.1),
47
+ 0 4px 6px -4px rgb(0 0 0 / 0.1);
48
+ --sc-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
49
+ 0 8px 10px -6px rgb(0 0 0 / 0.1);
42
50
  --sc-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
43
51
 
44
52
  /* Forms */
@@ -50,7 +58,8 @@ export const coreVariables = css `
50
58
  --sc-input-border-color: var(--sc-input-bg);
51
59
  --sc-input-rounded-intensity: 1.4;
52
60
  --sc-input-rounded: calc(
53
- (var(--sc-rounded) + var(--sc-rounded-size-intensity)) * var(--sc-input-rounded-intensity)
61
+ (var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
62
+ var(--sc-input-rounded-intensity)
54
63
  );
55
64
  --sc-label-font-weight: 500;
56
65
 
@@ -30,7 +30,8 @@ let Theme = Theme_1 = class Theme extends LitElement {
30
30
  const fontUrls = [];
31
31
  for (let i = 0; i < ssLength; i++) {
32
32
  const ss = stylesheets[i];
33
- if (ss.href && (ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
33
+ if (ss.href &&
34
+ (ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
34
35
  fontUrls.push(ss.href);
35
36
  }
36
37
  document.querySelectorAll("iframe").forEach((elt) => {
@@ -50,7 +51,11 @@ let Theme = Theme_1 = class Theme extends LitElement {
50
51
  }
51
52
  getCssVariables() {
52
53
  const names = [];
53
- const stylesheets = [...Theme_1.styles.map((s) => s.styleSheet), ...Array.from(document.styleSheets)];
54
+ const stylesheets = [
55
+ ...Theme_1.styles.map((s) => s.styleSheet),
56
+ ...Array.from(document.styleSheets),
57
+ ];
58
+ console.log(stylesheets);
54
59
  for (const stylesheet of stylesheets) {
55
60
  try {
56
61
  if (!stylesheet)
@@ -96,7 +101,7 @@ Theme.styles = [
96
101
  }
97
102
 
98
103
  :host([font]) {
99
- font-family: var(--sc-font-family-base);
104
+ font-family: var(--sc-font-family-base), sans-serif;
100
105
  font-weight: var(--sc-font-weight-base);
101
106
  font-style: var(--sc-font-style-base);
102
107
  }
@@ -38,14 +38,14 @@ Tooltip.styles = [
38
38
  opacity: 0;
39
39
  pointer-events: none;
40
40
  background: var(--sc-base-content, #111827);
41
- padding: 0.25rem;
42
- border-radius: 0.25rem;
41
+ padding: 0.32rem 0.25rem;
42
+ border-radius: var(--sc-rounded);
43
43
  color: var(--sc-base, #fff);
44
44
  z-index: 999;
45
45
  display: none;
46
46
  line-height: 1.1;
47
47
  width: max-content;
48
- max-width: 20rem;
48
+ max-width: 18rem;
49
49
  white-space: pre-line;
50
50
  font-weight: var(--sc-tooltip-fw);
51
51
  }
@@ -54,7 +54,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, P
54
54
  /**
55
55
  * Première update, le comportement de lazyload est géré ici a l'aide d'un intersection observer.
56
56
  */
57
- firstUpdated(): void;
57
+ handleLazyLoad(): void;
58
58
  onIntersection(entries: IntersectionObserverEntry[]): void;
59
59
  propertyMap: object;
60
60
  isConnected: boolean;
@@ -80,6 +80,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, P
80
80
  requestUpdate(): void;
81
81
  getAttribute(name: string): string;
82
82
  hasAttribute(attributeName: string): boolean;
83
+ getBoundingClientRect(): DOMRect;
83
84
  };
84
85
  } & T;
85
86
  export default Fetcher;
@@ -87,29 +87,46 @@ const Fetcher = (superClass, propsType) => {
87
87
  return;
88
88
  // if (!this.dataProvider) return;
89
89
  this.dispatchEvent(new CustomEvent("loading", { detail: this }));
90
- this.isLoading = true;
91
- this.requestUpdate();
90
+ if (this.getAttribute("localStorage") === "enabled") {
91
+ yield PublisherManager.getInstance().isLocalStrorageReady;
92
+ }
93
+ if (!this.isConnected)
94
+ return;
92
95
  const hasLoader = this.isDefaultLoaderEnabled && !this.hasAttribute("noLoader");
93
- if (hasLoader)
96
+ if (hasLoader) {
94
97
  Loader.show();
98
+ }
95
99
  const headerData = PublisherManager.getInstance()
96
100
  .get(this.getAncestorAttributeValue("headersDataProvider"))
97
101
  .get();
102
+ this.isLoading = true;
103
+ if (Objects.isObject(this.props) && Object.keys(this.props || {}).length > 0 && this.isFirstLoad) {
104
+ this.dispatchEvent(new CustomEvent("load", { detail: this }));
105
+ this.isFirstLoad = false;
106
+ this.isLoading = false;
107
+ }
98
108
  let data = yield this.api.get(this.endPoint || this.dataProvider || "", headerData);
109
+ if (!this.isConnected) {
110
+ if (hasLoader)
111
+ Loader.hide();
112
+ return;
113
+ }
99
114
  // Je garde ça mais normalement ça n'arrive jamais
100
115
  if (!data) {
101
116
  SonicToast.add({ text: "Network Error", status: "error" });
102
117
  this.isLoading = false;
103
- if (hasLoader)
118
+ if (hasLoader) {
104
119
  Loader.hide();
120
+ }
105
121
  return;
106
122
  }
107
123
  // Si data ne contient que la réponse HTTP, avec un statut not ok, on affiche un message
108
124
  else if (data._sonic_http_response_ && !data._sonic_http_response_.ok && Object.keys(data).length === 1) {
109
125
  SonicToast.add({ text: "Network Error", status: "error" });
110
126
  }
111
- if (hasLoader)
127
+ if (hasLoader) {
112
128
  Loader.hide();
129
+ }
113
130
  if (this.key) {
114
131
  const response = data._sonic_http_response_;
115
132
  /* preserveOtherKeys s'exprime lorsque le paramètre "key" est défini
@@ -138,11 +155,10 @@ const Fetcher = (superClass, propsType) => {
138
155
  connectedCallback() {
139
156
  var _a;
140
157
  // this.noShadowDom = "";
158
+ super.connectedCallback();
141
159
  if (!this.isFetchEnabled) {
142
- super.connectedCallback();
143
160
  return;
144
161
  }
145
- super.connectedCallback();
146
162
  this.key = this.getAttribute("key");
147
163
  if (this.props) {
148
164
  this.publisher.set(this.props);
@@ -153,25 +169,38 @@ const Fetcher = (superClass, propsType) => {
153
169
  if (lazyLoad === null) {
154
170
  this._fetchData();
155
171
  }
172
+ else {
173
+ this.handleLazyLoad();
174
+ }
156
175
  }
157
176
  /**
158
177
  * Première update, le comportement de lazyload est géré ici a l'aide d'un intersection observer.
159
178
  */
160
- firstUpdated() {
179
+ handleLazyLoad() {
161
180
  const lazyLoad = this.getAttribute("lazyload");
162
181
  if (lazyLoad === null) {
163
182
  return;
164
183
  }
184
+ const rect = this.getBoundingClientRect();
185
+ if (rect.x < window.innerWidth && rect.right > 0 && rect.y < window.innerHeight && rect.right > 0) {
186
+ this._fetchData();
187
+ return;
188
+ }
189
+ const boundsRatio = parseFloat(this.getAttribute("lazyBoundsRatio") || "1");
165
190
  const options = {
166
191
  root: null,
167
- rootMargin: Math.max(window.innerWidth, window.innerHeight) + "px",
192
+ rootMargin: Math.max(window.innerWidth * boundsRatio, window.innerHeight * boundsRatio) + "px",
168
193
  };
169
194
  this.iObserver = new IntersectionObserver((entries) => this.onIntersection(entries), options);
170
- let elt = this.shadowRoot ? this.shadowRoot.children[0] : this.children[0];
195
+ /**
196
+ * on retire cette partie car finalement on mets systématiquement un span pour la détection de l'intersection
197
+ */
198
+ let elt = (this.shadowRoot ? this.shadowRoot.children[0] : this.children[0]);
171
199
  if (elt && elt.nodeName.toLocaleLowerCase() == "slot")
172
200
  elt = elt.children[0];
173
201
  if (!elt || elt.nodeName.toLocaleLowerCase() == "template") {
174
202
  elt = document.createElement("span");
203
+ // const elt = document.createElement("span");
175
204
  this.appendChild(elt);
176
205
  }
177
206
  if (elt) {
@@ -182,9 +211,12 @@ const Fetcher = (superClass, propsType) => {
182
211
  }
183
212
  }
184
213
  onIntersection(entries) {
214
+ var _a;
185
215
  for (const e of entries) {
186
216
  if (e.isIntersecting && this.isFirstLoad) {
187
217
  this._fetchData();
218
+ (_a = this.iObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
219
+ break;
188
220
  }
189
221
  }
190
222
  }
@@ -81,6 +81,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
81
81
  requestUpdate(): void;
82
82
  getAttribute(name: string): string;
83
83
  hasAttribute(attributeName: string): boolean;
84
+ getBoundingClientRect(): DOMRect;
84
85
  };
85
86
  } & T;
86
87
  export default Form;
@@ -11,6 +11,7 @@ export interface FormElementInterface extends SubscriberInterface {
11
11
  getValueForFormPublisher(): FormElementValue;
12
12
  validateFormElement(): void;
13
13
  focus?: () => void;
14
+ forceAutoFill: boolean;
14
15
  shadowRoot?: ShadowRoot;
15
16
  error: boolean;
16
17
  autofocus: boolean;
@@ -74,7 +74,8 @@ const Form = (superClass) => {
74
74
  }
75
75
  getFormPublisher() {
76
76
  if (!this.formDataProvider)
77
- this.formDataProvider = this.getAncestorAttributeValue("formDataProvider");
77
+ this.formDataProvider =
78
+ this.getAncestorAttributeValue("formDataProvider");
78
79
  if (this.formDataProvider) {
79
80
  return PublisherManager.get(this.formDataProvider);
80
81
  }
@@ -120,7 +121,9 @@ const Form = (superClass) => {
120
121
  }
121
122
  initPublisher() {
122
123
  let formPublisher = this.getFormPublisher();
123
- const value = this.hasAncestorAttribute("initFromPublisher") && this._name && formPublisher[this._name].get()
124
+ const value = this.hasAncestorAttribute("initFromPublisher") &&
125
+ this._name &&
126
+ formPublisher[this._name].get()
124
127
  ? formPublisher[this._name].get()
125
128
  : this.getAttribute("value");
126
129
  if (this._name && this.publisher)
@@ -219,6 +222,7 @@ const Form = (superClass) => {
219
222
  if (elt && elt.focus) {
220
223
  elt.focus();
221
224
  e.preventDefault();
225
+ e.stopPropagation();
222
226
  }
223
227
  });
224
228
  }