@supersoniks/concorde 2.0.2 → 2.0.3

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 (102) hide show
  1. package/README.md +1 -0
  2. package/concorde-core.bundle.js +748 -690
  3. package/concorde-core.es.js +3897 -3116
  4. package/core/_types/types.d.ts +2 -4
  5. package/core/components/functional/date/date.d.ts +4 -2
  6. package/core/components/functional/date/date.js +28 -13
  7. package/core/components/functional/fetch/fetch.d.ts +9 -10
  8. package/core/components/functional/fetch/fetch.js +21 -5
  9. package/core/components/functional/list/list.d.ts +7 -10
  10. package/core/components/functional/list/list.js +19 -4
  11. package/core/components/functional/queue/queue.d.ts +3 -2
  12. package/core/components/functional/queue/queue.js +66 -61
  13. package/core/components/functional/router/router.d.ts +1 -0
  14. package/core/components/functional/router/router.js +12 -1
  15. package/core/components/functional/sdui/sdui.d.ts +2 -7
  16. package/core/components/functional/submit/submit.js +11 -4
  17. package/core/components/ui/_css/scroll.js +13 -11
  18. package/core/components/ui/_css/size.js +1 -1
  19. package/core/components/ui/alert/alert.d.ts +14 -3
  20. package/core/components/ui/alert/alert.js +34 -4
  21. package/core/components/ui/badge/badge.js +10 -3
  22. package/core/components/ui/button/button.d.ts +19 -10
  23. package/core/components/ui/button/button.js +77 -22
  24. package/core/components/ui/captcha/captcha.d.ts +5 -4
  25. package/core/components/ui/captcha/captcha.js +33 -9
  26. package/core/components/ui/divider/divider.d.ts +2 -0
  27. package/core/components/ui/divider/divider.js +17 -2
  28. package/core/components/ui/form/checkbox/checkbox.d.ts +24 -9
  29. package/core/components/ui/form/checkbox/checkbox.js +4 -6
  30. package/core/components/ui/form/css/form-control.js +40 -7
  31. package/core/components/ui/form/fieldset/fieldset.d.ts +1 -0
  32. package/core/components/ui/form/fieldset/fieldset.js +14 -1
  33. package/core/components/ui/form/fieldset/legend-description.js +3 -3
  34. package/core/components/ui/form/fieldset/legend.js +2 -8
  35. package/core/components/ui/form/input/input.d.ts +4 -5
  36. package/core/components/ui/form/input/input.js +17 -13
  37. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +3 -5
  38. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +9 -9
  39. package/core/components/ui/form/select/select.d.ts +4 -1
  40. package/core/components/ui/form/select/select.js +25 -18
  41. package/core/components/ui/form/textarea/textarea.d.ts +4 -5
  42. package/core/components/ui/form/textarea/textarea.js +19 -10
  43. package/core/components/ui/group/group.js +3 -3
  44. package/core/components/ui/icon/icon.js +2 -1
  45. package/core/components/ui/icon/icons.d.ts +0 -4
  46. package/core/components/ui/icon/icons.js +3 -16
  47. package/core/components/ui/link/link.d.ts +5 -2
  48. package/core/components/ui/link/link.js +31 -2
  49. package/core/components/ui/loader/loader.d.ts +4 -1
  50. package/core/components/ui/loader/loader.js +11 -3
  51. package/core/components/ui/loader/styles/inline.js +14 -16
  52. package/core/components/ui/menu/menu-item.js +2 -1
  53. package/core/components/ui/menu/menu.js +6 -22
  54. package/core/components/ui/modal/modal-close.js +2 -1
  55. package/core/components/ui/modal/modal.d.ts +13 -1
  56. package/core/components/ui/modal/modal.js +70 -10
  57. package/core/components/ui/pop/pop.d.ts +9 -3
  58. package/core/components/ui/pop/pop.js +46 -23
  59. package/core/components/ui/table/table-tr.d.ts +10 -2
  60. package/core/components/ui/table/table-tr.js +30 -2
  61. package/core/components/ui/table/table.d.ts +1 -0
  62. package/core/components/ui/table/table.js +7 -1
  63. package/core/components/ui/theme/theme-collection/core-variables.js +8 -19
  64. package/core/components/ui/theme/theme.d.ts +6 -0
  65. package/core/components/ui/theme/theme.js +11 -13
  66. package/core/components/ui/toast/message-subscriber.d.ts +0 -8
  67. package/core/components/ui/toast/message-subscriber.js +0 -46
  68. package/core/components/ui/toast/toast-item.js +31 -40
  69. package/core/components/ui/toast/toast.d.ts +5 -1
  70. package/core/components/ui/toast/toast.js +80 -13
  71. package/core/components/ui/tooltip/tooltip.d.ts +3 -1
  72. package/core/components/ui/tooltip/tooltip.js +22 -0
  73. package/core/decorators/Subscriber.d.ts +3 -3
  74. package/core/decorators/Subscriber.js +64 -21
  75. package/core/directives/DataProvider.d.ts +12 -7
  76. package/core/directives/DataProvider.js +23 -8
  77. package/core/directives/Wording.d.ts +42 -0
  78. package/core/directives/Wording.js +202 -0
  79. package/core/mixins/Fetcher.d.ts +8 -11
  80. package/core/mixins/Fetcher.js +38 -22
  81. package/core/mixins/FormCheckable.d.ts +1 -4
  82. package/core/mixins/FormElement.d.ts +1 -0
  83. package/core/mixins/FormElement.js +3 -6
  84. package/core/mixins/FormInput.d.ts +3 -5
  85. package/core/mixins/FormInput.js +4 -0
  86. package/core/mixins/Subscriber.d.ts +0 -4
  87. package/core/mixins/Subscriber.js +13 -89
  88. package/core/mixins/TemplatesContainer.js +9 -0
  89. package/core/utils/Format.d.ts +1 -0
  90. package/core/utils/Format.js +16 -0
  91. package/core/utils/HTML.d.ts +13 -0
  92. package/core/utils/HTML.js +42 -3
  93. package/core/utils/Objects.d.ts +1 -0
  94. package/core/utils/Objects.js +5 -0
  95. package/core/utils/PublisherProxy.d.ts +16 -10
  96. package/core/utils/PublisherProxy.js +100 -64
  97. package/core/utils/Utils.d.ts +1 -0
  98. package/core/utils/Utils.js +5 -0
  99. package/core/utils/api.d.ts +26 -0
  100. package/core/utils/api.js +135 -3
  101. package/mixins.d.ts +6 -16
  102. package/package.json +7 -2
@@ -4,8 +4,12 @@ import "@supersoniks/concorde/core/components/ui/modal/modal-close";
4
4
  import "@supersoniks/concorde/core/components/ui/modal/modal-content";
5
5
  import "@supersoniks/concorde/core/components/ui/modal/modal-subtitle";
6
6
  import "@supersoniks/concorde/core/components/ui/modal/modal-title";
7
+ import { DirectiveResult } from "lit/directive.js";
7
8
  declare type ModalCreateOptions = {
8
- content?: string;
9
+ title?: string | DirectiveResult;
10
+ subtitle?: string | DirectiveResult;
11
+ content?: string | DirectiveResult;
12
+ actions?: string | DirectiveResult;
9
13
  zIndex?: string;
10
14
  paddingX?: string;
11
15
  paddingY?: string;
@@ -14,12 +18,16 @@ declare type ModalCreateOptions = {
14
18
  height?: string;
15
19
  maxHeight?: string;
16
20
  removeOnHide?: boolean;
21
+ forceAction?: boolean;
22
+ removeHashOnHide?: boolean;
17
23
  };
18
24
  declare const Modal_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("@supersoniks/concorde/core/_types/types").CoreJSType>) & typeof LitElement;
19
25
  export declare class Modal extends Modal_base {
20
26
  static styles: import("lit").CSSResult[];
27
+ static modals: Array<Modal>;
21
28
  forceAction: boolean;
22
29
  removeOnHide: boolean;
30
+ removeHashOnHide: boolean;
23
31
  align: "center" | "right" | "left";
24
32
  padding: string;
25
33
  maxWidth: string;
@@ -27,6 +35,7 @@ export declare class Modal extends Modal_base {
27
35
  width: string;
28
36
  height: string;
29
37
  zIndex: string;
38
+ options?: ModalCreateOptions;
30
39
  fullScreen: boolean;
31
40
  visible: boolean;
32
41
  modalWrapper: HTMLDivElement;
@@ -34,12 +43,15 @@ export declare class Modal extends Modal_base {
34
43
  closeBtn: Array<HTMLElement>;
35
44
  static create(options: ModalCreateOptions): Modal;
36
45
  connectedCallback(): void;
46
+ disconnectedCallback(): void;
37
47
  updated(): void;
38
48
  willUpdate(_changedProperties: PropertyValues): void;
39
49
  render(): import("lit-html").TemplateResult<1> | typeof nothing;
50
+ modalFragment(optionKey: keyof ModalCreateOptions): import("lit-html").TemplateResult<1> | typeof nothing;
40
51
  show(): void;
41
52
  hide(): void;
42
53
  dispose(): void;
54
+ static disposeAll(): void;
43
55
  handleEscape(e: KeyboardEvent): void;
44
56
  handleFullsceen(): void;
45
57
  }
@@ -4,6 +4,7 @@ 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 Modal_1;
7
8
  import { animate, fadeIn, fadeOut } from "@lit-labs/motion";
8
9
  import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
9
10
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
@@ -16,12 +17,15 @@ import "@supersoniks/concorde/core/components/ui/modal/modal-content";
16
17
  import "@supersoniks/concorde/core/components/ui/modal/modal-subtitle";
17
18
  import "@supersoniks/concorde/core/components/ui/modal/modal-title";
18
19
  import { PublisherManager } from "@supersoniks/concorde/utils";
20
+ import { Theme } from "@supersoniks/concorde/core/components/ui/theme/theme";
21
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
19
22
  const tagName = "sonic-modal";
20
- let Modal = class Modal extends Subscriber(LitElement) {
23
+ let Modal = Modal_1 = class Modal extends Subscriber(LitElement) {
21
24
  constructor() {
22
25
  super(...arguments);
23
26
  this.forceAction = false;
24
27
  this.removeOnHide = false;
28
+ this.removeHashOnHide = false;
25
29
  this.align = "left";
26
30
  this.padding = "var(--sc-modal-py) var(--sc-modal-px)";
27
31
  this.maxWidth = "var(--sc-modal-max-w) ";
@@ -35,6 +39,9 @@ let Modal = class Modal extends Subscriber(LitElement) {
35
39
  static create(options) {
36
40
  const modal = document.createElement(tagName);
37
41
  // modal styles
42
+ modal.options = options;
43
+ if (options.removeHashOnHide === true)
44
+ modal.setAttribute("removeHashOnHide", "true");
38
45
  if (options.removeOnHide === true)
39
46
  modal.setAttribute("removeOnHide", "true");
40
47
  if (options.maxWidth)
@@ -45,23 +52,28 @@ let Modal = class Modal extends Subscriber(LitElement) {
45
52
  modal.maxHeight = options?.maxHeight;
46
53
  if (options.height)
47
54
  modal.height = options?.height;
55
+ if (options.forceAction)
56
+ modal.forceAction = true;
48
57
  if (options.paddingX)
49
58
  modal.style.setProperty("--sc-modal-px", options?.paddingX);
50
59
  if (options.paddingY)
51
60
  modal.style.setProperty("--sc-modal-py", options?.paddingY);
52
61
  if (options.zIndex)
53
62
  modal.style.setProperty("--sc-modal-z-index", options?.zIndex);
54
- // inner content
55
- modal.innerHTML = `<sonic-modal-close></sonic-modal-close><sonic-modal-content>${options.content}</sonic-modal-content>` || "";
56
- const container = document.querySelector("sonic-theme") || document.body;
63
+ const container = Theme.getPopContainer();
57
64
  container.appendChild(modal);
58
65
  modal.show();
59
66
  return modal;
60
67
  }
61
68
  connectedCallback() {
69
+ Modal_1.modals.push(this);
62
70
  super.connectedCallback();
63
71
  this.handleFullsceen();
64
72
  }
73
+ disconnectedCallback() {
74
+ Modal_1.modals.splice(Modal_1.modals.indexOf(this), 1);
75
+ super.disconnectedCallback();
76
+ }
65
77
  updated() {
66
78
  const currentModal = this;
67
79
  document.addEventListener("keydown", this.handleEscape);
@@ -117,12 +129,14 @@ let Modal = class Modal extends Subscriber(LitElement) {
117
129
  out: [{ transform: "translateY(20%) scale(1)", boxShadow: "0 0 0 rgba(0,0,0,0)", opacity: 0 }],
118
130
  })}
119
131
  >
120
- <div class="modal-content ">
132
+ <div class="modal-content">
133
+ ${!this.options?.forceAction ? html `<sonic-modal-close></sonic-modal-close>` : nothing} ${this.modalFragment("title")}
134
+ ${this.modalFragment("subtitle")} ${this.modalFragment("content")} ${this.modalFragment("actions")}
135
+
121
136
  <slot></slot>
122
137
  </div>
123
138
  </div>
124
139
  </div>
125
-
126
140
  <div
127
141
  class="overlay"
128
142
  @click="${!this.forceAction ? this.hide : null}"
@@ -135,6 +149,32 @@ let Modal = class Modal extends Subscriber(LitElement) {
135
149
  })}
136
150
  ></div>`;
137
151
  }
152
+ modalFragment(optionKey) {
153
+ const optionValue = this.options?.[optionKey];
154
+ if (!optionValue)
155
+ return nothing;
156
+ let output;
157
+ // si object c'est une template Result
158
+ //@todo, faire mieux...
159
+ if (optionValue instanceof Object) {
160
+ output = optionValue;
161
+ }
162
+ else {
163
+ output = unsafeHTML(optionValue);
164
+ }
165
+ switch (optionKey) {
166
+ case "title":
167
+ return html `<sonic-modal-title>${output}</sonic-modal-title>`;
168
+ case "subtitle":
169
+ return html `<sonic-modal-subtitle>${output}</sonic-modal-subtitle>`;
170
+ case "content":
171
+ return html `<sonic-modal-content>${output}</sonic-modal-content>`;
172
+ case "actions":
173
+ return html `<sonic-modal-actions>${output}</sonic-modal-actions>`;
174
+ default:
175
+ return nothing;
176
+ }
177
+ }
138
178
  show() {
139
179
  this.visible = true;
140
180
  this.modalElement?.setAttribute("tabindex", "0");
@@ -151,15 +191,25 @@ let Modal = class Modal extends Subscriber(LitElement) {
151
191
  if (this.removeOnHide) {
152
192
  this.remove();
153
193
  }
194
+ setTimeout(() => {
195
+ this.dispatchEvent(new CustomEvent("hidden"));
196
+ if (this.removeHashOnHide) {
197
+ window.history.replaceState({}, "", window.location.pathname);
198
+ }
199
+ }, 480);
154
200
  }
155
201
  dispose() {
156
202
  this.hide();
157
203
  this.remove();
158
204
  }
205
+ static disposeAll() {
206
+ Modal_1.modals.forEach((modal) => {
207
+ modal.dispose();
208
+ });
209
+ }
159
210
  handleEscape(e) {
160
211
  if (e.key === "Escape") {
161
- const modals = [...document.querySelectorAll(tagName)];
162
- modals.forEach((modal) => {
212
+ Modal_1.modals.forEach((modal) => {
163
213
  if (!modal.forceAction) {
164
214
  modal.hide();
165
215
  }
@@ -182,7 +232,7 @@ Modal.styles = [
182
232
  :host {
183
233
  --sc-modal-py: 2.5rem;
184
234
  --sc-modal-px: 1.5rem;
185
- --sc-modal-max-w: min(100vw, 64ch);
235
+ --sc-modal-max-w: min(100vw, 40rem);
186
236
  --sc-modal-max-h: 85vh;
187
237
  --sc-modal-rounded: var(--sc-rounded-lg);
188
238
  --sc-modal-z-index: 990;
@@ -237,6 +287,9 @@ Modal.styles = [
237
287
  ::slotted(sonic-modal-title) {
238
288
  margin-bottom: 1.25rem;
239
289
  }
290
+ :host([align="left"]) ::slotted(sonic-modal-title) {
291
+ padding-right: 1em;
292
+ }
240
293
 
241
294
  ::slotted(sonic-modal-subtitle) {
242
295
  margin-top: -0.9rem;
@@ -290,12 +343,16 @@ Modal.styles = [
290
343
  }
291
344
  `,
292
345
  ];
346
+ Modal.modals = [];
293
347
  __decorate([
294
348
  property({ type: Boolean })
295
349
  ], Modal.prototype, "forceAction", void 0);
296
350
  __decorate([
297
351
  property({ type: Boolean })
298
352
  ], Modal.prototype, "removeOnHide", void 0);
353
+ __decorate([
354
+ property({ type: Boolean })
355
+ ], Modal.prototype, "removeHashOnHide", void 0);
299
356
  __decorate([
300
357
  property({ type: String, reflect: true })
301
358
  ], Modal.prototype, "align", void 0);
@@ -317,6 +374,9 @@ __decorate([
317
374
  __decorate([
318
375
  property({ type: String })
319
376
  ], Modal.prototype, "zIndex", void 0);
377
+ __decorate([
378
+ property({ type: Object })
379
+ ], Modal.prototype, "options", void 0);
320
380
  __decorate([
321
381
  property({ type: Boolean, reflect: true })
322
382
  ], Modal.prototype, "fullScreen", void 0);
@@ -332,7 +392,7 @@ __decorate([
332
392
  __decorate([
333
393
  queryAssignedElements({ selector: "sonic-modal-close" })
334
394
  ], Modal.prototype, "closeBtn", void 0);
335
- Modal = __decorate([
395
+ Modal = Modal_1 = __decorate([
336
396
  customElement(tagName)
337
397
  ], Modal);
338
398
  export { Modal };
@@ -18,9 +18,15 @@ export declare class Pop extends LitElement {
18
18
  lastContentY: number;
19
19
  resizeObserver: ResizeObserver;
20
20
  runPositioningLoop(): void;
21
- _toggle(e: Event): void;
22
- _show(): void;
23
- _hide(): void;
21
+ toggle(e: Event): void;
22
+ show(): void;
23
+ hide(): void;
24
+ /**
25
+ * Remonte dans la structure html de parents en parents et si ils on une position relative ou absolute, on met leur z-index élévé
26
+ */
27
+ ancestorsHavingZIndex: Set<HTMLElement>;
28
+ setMaxZindex(): void;
29
+ resetZindexes(): void;
24
30
  _handleClosePop(e: Event): void;
25
31
  connectedCallback(): void;
26
32
  protected firstUpdated(_changedProperties: PropertyValues): void;
@@ -24,6 +24,10 @@ let Pop = Pop_1 = class Pop extends LitElement {
24
24
  this.lastContentX = 0;
25
25
  this.lastContentY = 0;
26
26
  this.resizeObserver = new ResizeObserver(() => this.computePosition(this.placement));
27
+ /**
28
+ * Remonte dans la structure html de parents en parents et si ils on une position relative ou absolute, on met leur z-index élévé
29
+ */
30
+ this.ancestorsHavingZIndex = new Set();
27
31
  }
28
32
  runPositioningLoop() {
29
33
  if (!this.positioningRuns)
@@ -32,16 +36,17 @@ let Pop = Pop_1 = class Pop extends LitElement {
32
36
  this.computePosition(this.placement);
33
37
  window.requestAnimationFrame(() => this.runPositioningLoop());
34
38
  }
35
- _toggle(e) {
39
+ toggle(e) {
36
40
  if (this.open && this.noToggle)
37
41
  return;
38
42
  const keyboardEvent = e;
39
43
  if (e.type == "keydown" && (keyboardEvent.key != "ArrowDown" || this.open))
40
44
  return;
41
45
  this.open = !this.open;
42
- this.open ? this._show() : this._hide();
46
+ this.open ? this.show() : this.hide();
43
47
  }
44
- _show() {
48
+ show() {
49
+ this.setMaxZindex();
45
50
  this.popContent.style.removeProperty("display");
46
51
  this.open = true;
47
52
  this.popContent.setAttribute("tabindex", "0");
@@ -53,12 +58,39 @@ let Pop = Pop_1 = class Pop extends LitElement {
53
58
  }
54
59
  this.dispatchEvent(new CustomEvent("show"));
55
60
  }
56
- _hide() {
61
+ hide() {
62
+ this.resetZindexes();
57
63
  this.open = false;
58
64
  this.popContent.setAttribute("tabindex", "-1");
59
65
  this.positioningRuns = false;
60
66
  this.dispatchEvent(new CustomEvent("hide"));
61
67
  }
68
+ setMaxZindex() {
69
+ HTML.everyAncestors(this, (parent) => {
70
+ const htmlElement = parent;
71
+ if (!htmlElement.className)
72
+ return true;
73
+ if ([...htmlElement.classList].includes("@container")) {
74
+ const style = htmlElement.style;
75
+ style.zIndex = "999999999";
76
+ //n'appliquer l'ajout du style "position:relative" que si il n'est pas déjà présent dans le style calculé
77
+ const computedStyle = getComputedStyle(htmlElement);
78
+ if (computedStyle.position !== "relative" && computedStyle.position !== "absolute") {
79
+ style.position = "relative";
80
+ }
81
+ this.ancestorsHavingZIndex.add(parent);
82
+ return false;
83
+ }
84
+ return true;
85
+ });
86
+ }
87
+ resetZindexes() {
88
+ this.ancestorsHavingZIndex.forEach((elt) => {
89
+ elt.style.removeProperty("position");
90
+ elt.style.removeProperty("z-index");
91
+ });
92
+ this.ancestorsHavingZIndex.clear();
93
+ }
62
94
  _handleClosePop(e) {
63
95
  const path = e.composedPath();
64
96
  const target = path[0];
@@ -68,10 +100,9 @@ let Pop = Pop_1 = class Pop extends LitElement {
68
100
  const isCloseManual = HTML.getAncestorAttributeValue(target, "data-on-select") === "keep";
69
101
  if (e.type == "pointerdown" && popContainsTarget)
70
102
  return;
71
- if (e.type == "click" &&
72
- ((popContainsTarget && isCloseManual) || !popContentContainsTarget))
103
+ if (e.type == "click" && ((popContainsTarget && isCloseManual) || !popContentContainsTarget))
73
104
  return;
74
- pop._hide();
105
+ pop.hide();
75
106
  });
76
107
  }
77
108
  connectedCallback() {
@@ -145,11 +176,9 @@ let Pop = Pop_1 = class Pop extends LitElement {
145
176
  x = xRight;
146
177
  if (contentRect.y < shiftPadding && placement == "top")
147
178
  y = yBottom;
148
- if (contentRect.x + contentRect.width > window.innerWidth - shiftPadding &&
149
- placement == "right")
179
+ if (contentRect.x + contentRect.width > window.innerWidth - shiftPadding && placement == "right")
150
180
  x = xLeft;
151
- if (contentRect.y + contentRect.height > window.innerHeight - shiftPadding &&
152
- placement == "bottom")
181
+ if (contentRect.y + contentRect.height > window.innerHeight - shiftPadding && placement == "bottom")
153
182
  y = yTop;
154
183
  this.lastContentX += x - contentRect.x;
155
184
  this.lastContentY += y - contentRect.y;
@@ -165,12 +194,10 @@ let Pop = Pop_1 = class Pop extends LitElement {
165
194
  this.lastContentY += -contentRect.y;
166
195
  }
167
196
  if (contentRect.x + contentRect.width > window.innerWidth) {
168
- this.lastContentX +=
169
- window.innerWidth - (contentRect.x + contentRect.width);
197
+ this.lastContentX += window.innerWidth - (contentRect.x + contentRect.width);
170
198
  }
171
199
  if (contentRect.y + contentRect.height > window.innerHeight) {
172
- this.lastContentY +=
173
- window.innerHeight - (contentRect.y + contentRect.height);
200
+ this.lastContentY += window.innerHeight - (contentRect.y + contentRect.height);
174
201
  }
175
202
  Object.assign(this.popContent.style, {
176
203
  left: `${this.lastContentX}px`,
@@ -179,18 +206,14 @@ let Pop = Pop_1 = class Pop extends LitElement {
179
206
  }
180
207
  render() {
181
208
  return html `
182
- <slot
183
- @click=${this._toggle}
184
- @keydown=${this._toggle}
185
- class="contents"
186
- ></slot>
209
+ <slot @click=${this.toggle} @keydown=${this.toggle} class="contents"></slot>
187
210
  <slot
188
211
  name="content"
189
212
  tabindex="-1"
190
213
  part="content"
191
214
  style="display: none;"
192
215
  class="
193
- ${this.open ? "is-open" : ""}"
216
+ ${this.open ? "is-open" : ""}"
194
217
  ></slot>
195
218
  `;
196
219
  }
@@ -205,8 +228,8 @@ Pop.styles = [
205
228
  slot[name="content"] {
206
229
  max-width: 80vw;
207
230
  background-color: var(--sc-base);
208
- position: absolute;
209
- z-index: 50;
231
+ position: fixed;
232
+ z-index: 99999;
210
233
  display: block;
211
234
  transform: translateY(1rem) scale(0.95);
212
235
  opacity: 0;
@@ -1,5 +1,13 @@
1
- import { LitElement } from "lit";
2
- export declare class TableTr extends LitElement {
1
+ import { LitElement, PropertyValues } from "lit";
2
+ import { ListItemMetadata } from "@supersoniks/concorde/core/components/functional/list/list";
3
+ declare const TableTr_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
4
+ export declare class TableTr extends TableTr_base {
3
5
  static styles: import("lit").CSSResult[];
6
+ _metadata_: ListItemMetadata;
7
+ even?: boolean;
8
+ odd?: boolean;
9
+ last?: boolean;
10
+ willUpdate(changedProperties: PropertyValues): void;
4
11
  render(): import("lit-html").TemplateResult<1>;
5
12
  }
13
+ export {};
@@ -5,10 +5,23 @@ 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 } from "lit/decorators.js";
8
+ import { customElement, property } from "lit/decorators.js";
9
9
  import { typeColor } from "@supersoniks/concorde/core/components/ui/_css/type";
10
+ import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
10
11
  const tagName = "sonic-tr";
11
- let TableTr = class TableTr extends LitElement {
12
+ let TableTr = class TableTr extends Subscriber(LitElement) {
13
+ constructor() {
14
+ super(...arguments);
15
+ this._metadata_ = {};
16
+ }
17
+ willUpdate(changedProperties) {
18
+ if (changedProperties.has("_metadata_")) {
19
+ this.even = !!this._metadata_.even;
20
+ this.odd = !!this._metadata_.odd;
21
+ this.last = !!this._metadata_.lastChild;
22
+ }
23
+ super.willUpdate(changedProperties);
24
+ }
12
25
  render() {
13
26
  return html `<slot></slot>`;
14
27
  }
@@ -27,11 +40,26 @@ TableTr.styles = [
27
40
  background: var(--sc-table-bg) !important;
28
41
  }
29
42
 
43
+ :host([last]) {
44
+ --sc-table-td-border-b: none;
45
+ }
30
46
  :host(:hover) {
31
47
  background: var(--sc-table-hover-bg) !important;
32
48
  }
33
49
  `,
34
50
  ];
51
+ __decorate([
52
+ property({ type: Object })
53
+ ], TableTr.prototype, "_metadata_", void 0);
54
+ __decorate([
55
+ property({ type: Boolean, reflect: true })
56
+ ], TableTr.prototype, "even", void 0);
57
+ __decorate([
58
+ property({ type: Boolean, reflect: true })
59
+ ], TableTr.prototype, "odd", void 0);
60
+ __decorate([
61
+ property({ type: Boolean, reflect: true })
62
+ ], TableTr.prototype, "last", void 0);
35
63
  TableTr = __decorate([
36
64
  customElement(tagName)
37
65
  ], TableTr);
@@ -10,6 +10,7 @@ export declare class Table extends LitElement {
10
10
  static styles: import("lit").CSSResult[];
11
11
  size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
12
12
  bordered: boolean;
13
+ rounded: boolean;
13
14
  noCustomScroll: boolean;
14
15
  maxHeight?: string;
15
16
  render(): import("lit-html").TemplateResult<1>;
@@ -21,6 +21,7 @@ let Table = class Table extends LitElement {
21
21
  constructor() {
22
22
  super(...arguments);
23
23
  this.bordered = false;
24
+ this.rounded = false;
24
25
  this.noCustomScroll = false;
25
26
  }
26
27
  render() {
@@ -75,7 +76,9 @@ Table.styles = [
75
76
  }
76
77
 
77
78
  :host([bordered]) .table-container {
78
- border: var(--sc-border-width) solid var(--sc-table-border-color) !important;
79
+ border: var(--sc-border-width) solid var(--sc-table-border-color);
80
+ border-radius: var(--sc-rounded);
81
+ --sc-table-td-border-b: var(--sc-border-width) solid var(--sc-table-border-color);
79
82
  }
80
83
  `,
81
84
  ];
@@ -85,6 +88,9 @@ __decorate([
85
88
  __decorate([
86
89
  property({ type: Boolean, reflect: true })
87
90
  ], Table.prototype, "bordered", void 0);
91
+ __decorate([
92
+ property({ type: Boolean, reflect: true })
93
+ ], Table.prototype, "rounded", void 0);
88
94
  __decorate([
89
95
  property({ type: Boolean, reflect: true })
90
96
  ], Table.prototype, "noCustomScroll", void 0);
@@ -2,8 +2,7 @@ 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,
6
- BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
5
+ --sc-font-family-base: "Inter var", "Inter", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
7
6
  sans-serif;
8
7
  --sc-font-weight-base: 400;
9
8
  --sc-font-style-base: normal;
@@ -30,37 +29,27 @@ export const coreVariables = css `
30
29
  /* 4 for rounded full*/
31
30
  --sc-btn-rounded-intensity: 1.4;
32
31
  --sc-btn-font-weight: 500;
33
- --sc-btn-rounded: calc(
34
- (var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
35
- var(--sc-btn-rounded-intensity)
36
- );
32
+ --sc-btn-rounded: calc((var(--sc-rounded) + var(--sc-rounded-size-intensity)) * var(--sc-btn-rounded-intensity));
37
33
 
38
34
  /* Placeholder */
39
35
  --sc-placeholder-bg: rgba(17, 24, 39, 0.05);
40
36
 
41
37
  /* OMBRES */
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);
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);
50
42
  --sc-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
51
43
 
52
44
  /* Forms */
53
45
  --sc-border-width: max(1px, 0.12rem);
54
- --sc-border-color: var(--sc-base-200);
46
+ --sc-border-color: var(--sc-base-100);
55
47
  --sc-form-height: 2.5em;
56
48
  --sc-form-border-width: var(--sc-border-width);
57
49
  --sc-input-bg: var(--sc-base-100);
58
50
  --sc-input-border-color: var(--sc-input-bg);
59
51
  --sc-input-rounded-intensity: 1.4;
60
- --sc-input-rounded: calc(
61
- (var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
62
- var(--sc-input-rounded-intensity)
63
- );
52
+ --sc-input-rounded: calc((var(--sc-rounded) + var(--sc-rounded-size-intensity)) * var(--sc-input-rounded-intensity));
64
53
  --sc-label-font-weight: 500;
65
54
 
66
55
  /* Contrast -- ex : Text on images */
@@ -1,6 +1,12 @@
1
1
  import { LitElement } from "lit";
2
2
  export declare class Theme extends LitElement {
3
3
  static styles: import("lit").CSSResult[];
4
+ static instance: Theme | undefined;
5
+ constructor();
6
+ /**
7
+ * retourne le conteneur de tout ce qui pop : popups / modale / tooltip? / dropdown / ...
8
+ */
9
+ static getPopContainer(): HTMLElement;
4
10
  theme: string;
5
11
  background: boolean;
6
12
  color: boolean;
@@ -14,15 +14,23 @@ import { PublisherManager } from "@supersoniks/concorde/utils";
14
14
  const tagName = "sonic-theme";
15
15
  let Theme = Theme_1 = class Theme extends LitElement {
16
16
  constructor() {
17
- super(...arguments);
17
+ super();
18
18
  this.theme = "light";
19
19
  this.background = false;
20
20
  this.color = false;
21
21
  this.font = false;
22
+ Theme_1.instance = this;
23
+ }
24
+ /**
25
+ * retourne le conteneur de tout ce qui pop : popups / modale / tooltip? / dropdown / ...
26
+ */
27
+ static getPopContainer() {
28
+ return Theme_1.instance || document.body;
22
29
  }
23
30
  connectedCallback() {
24
31
  super.connectedCallback();
25
32
  window.addEventListener("message", (e) => this.receiveMessage(e), false);
33
+ window.dispatchEvent(new CustomEvent("SonicThemeReady"));
26
34
  this.postCSSVars();
27
35
  }
28
36
  postCSSVars() {
@@ -31,8 +39,7 @@ let Theme = Theme_1 = class Theme extends LitElement {
31
39
  const fontUrls = [];
32
40
  for (let i = 0; i < ssLength; i++) {
33
41
  const ss = stylesheets[i];
34
- if (ss.href &&
35
- (ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
42
+ if (ss.href && (ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
36
43
  fontUrls.push(ss.href);
37
44
  }
38
45
  const theme = {
@@ -53,10 +60,7 @@ let Theme = Theme_1 = class Theme extends LitElement {
53
60
  }
54
61
  getCssVariables() {
55
62
  const names = [];
56
- const stylesheets = [
57
- ...Theme_1.styles.map((s) => s.styleSheet),
58
- ...Array.from(document.styleSheets),
59
- ];
63
+ const stylesheets = [...Theme_1.styles.map((s) => s.styleSheet), ...Array.from(document.styleSheets)];
60
64
  for (const stylesheet of stylesheets) {
61
65
  try {
62
66
  if (!stylesheet)
@@ -91,12 +95,6 @@ Theme.styles = [
91
95
  dark,
92
96
  coreVariables,
93
97
  css `
94
- :host([background]) {
95
- display: block !important;
96
- background: var(--sc-body-bg) !important;
97
- min-height: 100vh;
98
- }
99
-
100
98
  :host([color]) {
101
99
  color: var(--sc-base-content);
102
100
  }
@@ -11,16 +11,8 @@ type APIResult = {
11
11
  declare const MessageSubscriber_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<APIResult>) & typeof LitElement;
12
12
  export declare class MessageSubscriber extends MessageSubscriber_base {
13
13
  _messages: Array<Message>;
14
- success: boolean | null;
15
- status: boolean | null;
16
14
  get messages(): Message[];
17
15
  set messages(value: Message[]);
18
- _message: string;
19
- get message(): string;
20
- set message(value: string);
21
- _data: object | string;
22
- get data(): string | object;
23
- set data(value: string | object);
24
16
  render(): symbol;
25
17
  }
26
18
  export {};