@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
@@ -5,7 +5,7 @@ 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, queryAssignedElements, state } from "lit/decorators.js";
8
+ import { customElement, property, queryAssignedNodes, state } from "lit/decorators.js";
9
9
  import { classMap } from "lit/directives/class-map.js";
10
10
  import { ifDefined } from "lit/directives/if-defined.js";
11
11
  import { repeat } from "lit/directives/repeat.js";
@@ -29,9 +29,22 @@ let Select = class Select extends FormElement(Subscriber(LitElement)) {
29
29
  this.valueKey = "value";
30
30
  this.wordingKey = "wording";
31
31
  this.multiple = false;
32
+ this.status = "default";
32
33
  this._options = [];
33
34
  this.hasDoneFirstUpdate = false;
34
35
  this._value = "";
36
+ this.updateOptions = () => {
37
+ const options = this.querySelectorAll("option");
38
+ if (options.length > 0) {
39
+ this.options = Array.from(options).map((option) => {
40
+ return {
41
+ value: option.value,
42
+ wording: option.text,
43
+ selected: option.hasAttribute("selected"),
44
+ };
45
+ });
46
+ }
47
+ };
35
48
  /*
36
49
  * TODO
37
50
  * Mutualiser avec le composant textarea / input
@@ -85,16 +98,7 @@ let Select = class Select extends FormElement(Subscriber(LitElement)) {
85
98
  connectedCallback() {
86
99
  super.connectedCallback();
87
100
  this.hasSlotOrProps();
88
- const options = this.querySelectorAll("option");
89
- if (options.length > 0) {
90
- this.options = Array.from(options).map((option) => {
91
- return {
92
- value: option.value,
93
- wording: option.text,
94
- selected: option.hasAttribute("selected"),
95
- };
96
- });
97
- }
101
+ this.updateOptions();
98
102
  }
99
103
  get description() {
100
104
  return this._description;
@@ -173,9 +177,9 @@ let Select = class Select extends FormElement(Subscriber(LitElement)) {
173
177
  <slot name="suffix" @slotchange=${this.hasSlotOrProps}></slot>
174
178
  </div>
175
179
 
176
- <slot name="description" @slotchange=${this.hasSlotOrProps} class="${this.hasDescription ? "form-description" : "hidden"}">
177
- ${this.description ? html `${unsafeHTML(this.description)}` : ""}
178
- </slot>
180
+ <slot name="description" @slotchange=${this.hasSlotOrProps} class="${this.hasDescription ? "form-description" : "hidden"}"
181
+ >${this.description ? html `${unsafeHTML(this.description)}` : ""}</slot
182
+ >
179
183
  `;
180
184
  }
181
185
  };
@@ -246,6 +250,9 @@ __decorate([
246
250
  __decorate([
247
251
  property({ type: Number })
248
252
  ], Select.prototype, "selectSize", void 0);
253
+ __decorate([
254
+ property({ type: String, reflect: true })
255
+ ], Select.prototype, "status", void 0);
249
256
  __decorate([
250
257
  property({ type: Array })
251
258
  ], Select.prototype, "options", null);
@@ -262,16 +269,16 @@ __decorate([
262
269
  property()
263
270
  ], Select.prototype, "label", null);
264
271
  __decorate([
265
- queryAssignedElements({ slot: "label", flatten: true })
272
+ queryAssignedNodes({ slot: "label", flatten: true })
266
273
  ], Select.prototype, "slotLabelNodes", void 0);
267
274
  __decorate([
268
- queryAssignedElements({ slot: "description", flatten: true })
275
+ queryAssignedNodes({ slot: "description", flatten: true })
269
276
  ], Select.prototype, "slotDescriptionNodes", void 0);
270
277
  __decorate([
271
- queryAssignedElements({ slot: "suffix", flatten: true })
278
+ queryAssignedNodes({ slot: "suffix", flatten: true })
272
279
  ], Select.prototype, "slotSuffixNodes", void 0);
273
280
  __decorate([
274
- queryAssignedElements({ slot: "prefix", flatten: true })
281
+ queryAssignedNodes({ slot: "prefix", flatten: true })
275
282
  ], Select.prototype, "slotPrefixNodes", void 0);
276
283
  __decorate([
277
284
  state()
@@ -9,13 +9,15 @@ declare const Textarea_base: {
9
9
  description: string | undefined;
10
10
  _label?: string | undefined;
11
11
  label: string | undefined;
12
+ status: "error" | "default" | "success" | "warning" | "info";
12
13
  tabindex?: number | undefined;
13
- autocomplete?: "url" | "name" | "on" | "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday-day" | "bday-month" | "bday-year" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "new-password" | "one-time-code" | "organization" | "postal-code" | "street-address" | "transaction-amount" | "transaction-currency" | "username" | "email" | "tel" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-national" | "language" | "nickname" | "organization-title" | "cc-additional-name" | "bday" | "sex" | "impp" | "photo" | undefined;
14
+ autocomplete?: "url" | "name" | "off" | "on" | "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday-day" | "bday-month" | "bday-year" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "new-password" | "one-time-code" | "organization" | "postal-code" | "street-address" | "transaction-amount" | "transaction-currency" | "username" | "email" | "tel" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-national" | "language" | "nickname" | "organization-title" | "cc-additional-name" | "bday" | "sex" | "impp" | "photo" | undefined;
14
15
  getFormPublisher(): any;
15
16
  updateDataValue(): void;
16
17
  handleChange(e?: Event | undefined): void;
17
18
  handleBlur(e?: Event | undefined): void;
18
19
  getValueForFormPublisher(): string | object | string[] | null | undefined;
20
+ setValueFromPublisher(value: string | object | string[] | null | undefined): void;
19
21
  focus?: (() => void) | undefined;
20
22
  shadowRoot?: ShadowRoot | undefined;
21
23
  error: boolean;
@@ -56,10 +58,6 @@ declare const Textarea_base: {
56
58
  hasAttribute(attributeName: string): boolean;
57
59
  disconnectedCallback(): void;
58
60
  getBoundingClientRect(): DOMRect;
59
- onConnected(callback: (component: any) => void): void;
60
- offConnected(callback: (component: any) => void): void;
61
- onDisconnected(callback: (component: any) => void): void;
62
- offDisconnected(callback: (component: any) => void): void;
63
61
  };
64
62
  } & (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;
65
63
  export declare class Textarea extends Textarea_base {
@@ -72,6 +70,7 @@ export declare class Textarea extends Textarea_base {
72
70
  wrap?: "hard" | "soft";
73
71
  readonly: boolean;
74
72
  placeholder?: string;
73
+ resize?: "none" | "both" | "horizontal" | "vertical" | "block" | "inline";
75
74
  slotLabelNodes: Array<Node>;
76
75
  slotDescriptionNodes: Array<Node>;
77
76
  hasDescription: boolean;
@@ -4,16 +4,17 @@ 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
- import { html, LitElement, css } from "lit";
8
- import { customElement, property, state, queryAssignedElements } from "lit/decorators.js";
7
+ import { css, html, LitElement } from "lit";
8
+ import { customElement, property, queryAssignedNodes, state } from "lit/decorators.js";
9
9
  import { ifDefined } from "lit/directives/if-defined.js";
10
- import { formControl, label, description } from "@supersoniks/concorde/core/components/ui/form/css/form-control";
10
+ import { description, formControl, label } from "@supersoniks/concorde/core/components/ui/form/css/form-control";
11
11
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
12
12
  import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
13
13
  import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
14
14
  import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
15
15
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
16
16
  import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
17
+ import { styleMap } from "lit/directives/style-map.js";
17
18
  const tagName = "sonic-textarea";
18
19
  let Textarea = class Textarea extends FormInput(FormElement(Subscriber(LitElement))) {
19
20
  constructor() {
@@ -49,15 +50,18 @@ let Textarea = class Textarea extends FormInput(FormElement(Subscriber(LitElemen
49
50
  textarea.reportValidity();
50
51
  }
51
52
  render() {
53
+ const textAreaStyle = {
54
+ resize: this.resize,
55
+ };
52
56
  // let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
53
57
  return html `
54
- <label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
58
+ <label for="${this.id || "form-element"}" class="${this.hasLabel ? "form-label" : "hidden"}"
55
59
  >${this.label ? unsafeHTML(this.label /*+ labelStarSuffix*/) : ""}<slot name="label" @slotchange=${this.hasSlotOrProps}></slot
56
60
  ></label>
57
61
 
58
62
  <div class="form-control">
59
63
  <textarea
60
- id="form-element"
64
+ id="${this.id || "form-element"}"
61
65
  @input=${this.handleChange}
62
66
  @blur=${this.handleBlur}
63
67
  disabled=${ifDefined(this.disabled)}
@@ -76,14 +80,15 @@ let Textarea = class Textarea extends FormInput(FormElement(Subscriber(LitElemen
76
80
  class="form-element textarea custom-scroll"
77
81
  aria-label=${ifDefined(this.ariaLabel)}
78
82
  aria-labelledby=${ifDefined(this.ariaLabelledby)}
83
+ style=${styleMap(textAreaStyle)}
79
84
  >
80
85
  ${this.value}</textarea
81
86
  >
82
87
  </div>
83
88
 
84
- <slot name="description" @slotchange=${this.hasSlotOrProps} class="${this.hasDescription ? "form-description" : "hidden"}">
85
- ${this.description ? html `${unsafeHTML(this.description)}` : ""}
86
- </slot>
89
+ <slot name="description" @slotchange=${this.hasSlotOrProps} class="${this.hasDescription ? "form-description" : "hidden"}"
90
+ >${this.description ? html `${unsafeHTML(this.description)}` : ""}</slot
91
+ >
87
92
  `;
88
93
  }
89
94
  };
@@ -95,6 +100,7 @@ Textarea.styles = [
95
100
  customScroll,
96
101
  css `
97
102
  textarea {
103
+ overflow-y: auto !important;
98
104
  font-size: inherit;
99
105
  }
100
106
  `,
@@ -124,10 +130,13 @@ __decorate([
124
130
  property({ type: String })
125
131
  ], Textarea.prototype, "placeholder", void 0);
126
132
  __decorate([
127
- queryAssignedElements({ slot: "label", flatten: true })
133
+ property({ type: String })
134
+ ], Textarea.prototype, "resize", void 0);
135
+ __decorate([
136
+ queryAssignedNodes({ slot: "label", flatten: true })
128
137
  ], Textarea.prototype, "slotLabelNodes", void 0);
129
138
  __decorate([
130
- queryAssignedElements({ slot: "description", flatten: true })
139
+ queryAssignedNodes({ slot: "description", flatten: true })
131
140
  ], Textarea.prototype, "slotDescriptionNodes", void 0);
132
141
  __decorate([
133
142
  state()
@@ -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 { styleMap } from "lit/directives/style-map.js";
9
- import { customElement, property, state, queryAssignedElements } from "lit/decorators.js";
9
+ import { customElement, property, state, queryAssignedNodes } from "lit/decorators.js";
10
10
  import { label, description } from "@supersoniks/concorde/core/components/ui/form/css/form-control";
11
11
  import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
12
12
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
@@ -101,10 +101,10 @@ __decorate([
101
101
  property({ type: String })
102
102
  ], Group.prototype, "description", void 0);
103
103
  __decorate([
104
- queryAssignedElements({ slot: "label", flatten: true })
104
+ queryAssignedNodes({ slot: "label", flatten: true })
105
105
  ], Group.prototype, "slotLabelNodes", void 0);
106
106
  __decorate([
107
- queryAssignedElements({ slot: "description", flatten: true })
107
+ queryAssignedNodes({ slot: "description", flatten: true })
108
108
  ], Group.prototype, "slotDescriptionNodes", void 0);
109
109
  __decorate([
110
110
  state()
@@ -51,10 +51,11 @@ Icon.styles = css `
51
51
  width: fit-content;
52
52
  height: fit-content;
53
53
  vertical-align: -0.125em;
54
+ flex-shrink: 0;
54
55
  }
55
56
  svg {
56
57
  height: var(--sc-icon-size, 1em);
57
- width: var(--sc-icon-size, 1em);
58
+ width: 1.4em;
58
59
  overflow: visible;
59
60
  }
60
61
 
@@ -4,10 +4,6 @@ export declare type IconConf = {
4
4
  library?: string;
5
5
  };
6
6
  export default class Icons {
7
- static fontAwesomeNext: {
8
- get: (params: IconConf) => Promise<import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/unsafe-html").UnsafeHTMLDirective>>;
9
- };
10
- static registerIcons(newIcons: Record<string, Record<string, string>>): void;
11
7
  static default: {
12
8
  get: (params: IconConf) => Promise<import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/unsafe-html").UnsafeHTMLDirective>>;
13
9
  };
@@ -49,20 +49,9 @@ const iconCachStr = sessionStorage.getItem("sonicIconsCache");
49
49
  const iconCache = iconCachStr ? JSON.parse(iconCachStr) : { icons: {}, names: [] };
50
50
  const iconCacheMaxSize = 100;
51
51
  class Icons {
52
- static registerIcons(newIcons) {
53
- const record = icons;
54
- for (const prefix in newIcons) {
55
- const newObj = newIcons[prefix];
56
- const currentRecord = record[prefix] || {};
57
- for (const name in newObj) {
58
- currentRecord[name] = newObj[name];
59
- }
60
- record[prefix] = currentRecord;
61
- }
62
- }
63
52
  }
64
53
  _a = Icons;
65
- Icons.fontAwesomeNext = {
54
+ Icons.default = {
66
55
  get: async (params) => {
67
56
  const library = params.library;
68
57
  if (!params.name)
@@ -75,19 +64,18 @@ Icons.fontAwesomeNext = {
75
64
  if (library == "custom") {
76
65
  enableCustomLibrary();
77
66
  }
78
- if (library && libraries[library]) {
67
+ if (library && library in libraries) {
79
68
  const libraryItem = libraries[library];
80
69
  const prefix = params.prefix || libraryItem.defaultPrefix || "";
81
70
  const libIcons = iconsAsRecord[library] || {};
82
71
  iconsAsRecord[library] = libIcons;
83
72
  const libIconsKey = prefix + "-" + name;
84
- // if(!libIcons )libIcons = iconsAsRecord[library] = {};
85
73
  /**
86
74
  * Si l'icone a déjà été chargée on ne la recharge pas
87
75
  */
88
76
  if (libIcons[libIconsKey])
89
77
  return unsafeHTML(libIcons[libIconsKey]);
90
- const url = libraryItem.url.replace("$prefix", prefix).replace("$name", name);
78
+ const url = (libraryItem.url || "").replace("$prefix", prefix).replace("$name", name);
91
79
  /**
92
80
  * MiniCache de session
93
81
  */
@@ -135,5 +123,4 @@ Icons.fontAwesomeNext = {
135
123
  return unsafeHTML(iconsAsRecord["core"][params.name] || "");
136
124
  },
137
125
  };
138
- Icons.default = _a.fontAwesomeNext;
139
126
  export default Icons;
@@ -1,10 +1,11 @@
1
- import { LitElement } from "lit";
1
+ import { LitElement, PropertyValues } from "lit";
2
2
  export declare class Link extends LitElement {
3
3
  static styles: import("lit").CSSResult[];
4
4
  href: string;
5
5
  private _location;
6
6
  get location(): string;
7
7
  set location(value: string);
8
+ ariaLabel: null;
8
9
  /**
9
10
  * mode d'activation du bouton :
10
11
  * - strict : l'url courante match exactement avec le href du bouton
@@ -13,6 +14,7 @@ export declare class Link extends LitElement {
13
14
  */
14
15
  autoActive: "strict" | "partial" | "disabled";
15
16
  connectedCallback(): void;
17
+ setFocusable(): void;
16
18
  disconnectedCallback(): void;
17
19
  private _target;
18
20
  set target(newTarget: string | null);
@@ -20,7 +22,8 @@ export declare class Link extends LitElement {
20
22
  /**
21
23
  * Si présent on passe en mode pushstate
22
24
  */
23
- pushState: null;
25
+ pushState: boolean | null;
24
26
  handlePushState(e: Event): void;
27
+ updated(changedProperties: PropertyValues): void;
25
28
  render(): import("lit-html").TemplateResult<1>;
26
29
  }
@@ -5,7 +5,7 @@ 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 LocationHandler from "@supersoniks/concorde/core/utils/LocationHandler";
8
- import { html, LitElement, css } from "lit";
8
+ import { html, LitElement, css, nothing } from "lit";
9
9
  import { customElement, property } from "lit/decorators.js";
10
10
  import { ifDefined } from "lit/directives/if-defined.js";
11
11
  import Electron from "@supersoniks/concorde/core/utils/Electron";
@@ -15,6 +15,7 @@ let Link = class Link extends LitElement {
15
15
  super(...arguments);
16
16
  this.href = "";
17
17
  this._location = "";
18
+ this.ariaLabel = null;
18
19
  /**
19
20
  * mode d'activation du bouton :
20
21
  * - strict : l'url courante match exactement avec le href du bouton
@@ -40,8 +41,23 @@ let Link = class Link extends LitElement {
40
41
  LocationHandler.onChange(this);
41
42
  this.location = document.location.href.replace(document.location.origin, "");
42
43
  }
44
+ // on Enter keypress we trigger a click on the link tag
45
+ this.addEventListener("keypress", (e) => {
46
+ if (e.key === "Enter") {
47
+ this.shadowRoot?.querySelector("a")?.click();
48
+ }
49
+ });
50
+ this.setFocusable();
43
51
  super.connectedCallback();
44
52
  }
53
+ setFocusable() {
54
+ if (this.href) {
55
+ this.setAttribute("tabIndex", "0");
56
+ }
57
+ else {
58
+ this.removeAttribute("tabIndex");
59
+ }
60
+ }
45
61
  disconnectedCallback() {
46
62
  LocationHandler.offChange(this);
47
63
  super.disconnectedCallback();
@@ -58,11 +74,21 @@ let Link = class Link extends LitElement {
58
74
  e.preventDefault();
59
75
  LocationHandler.changeFromComponent(this);
60
76
  }
77
+ updated(changedProperties) {
78
+ if (changedProperties.has("href")) {
79
+ this.setFocusable();
80
+ }
81
+ }
61
82
  render() {
62
83
  if (!this.href)
63
84
  return html `<slot></slot>`;
64
85
  return html `
65
- <a href="${this.href}" target=${ifDefined(this.target)} @click=${this.pushState ? this.handlePushState : null}>
86
+ <a
87
+ href="${this.href}"
88
+ aria-label=${this.ariaLabel || nothing}
89
+ target=${ifDefined(this.target)}
90
+ @click=${this.pushState ? this.handlePushState : null}
91
+ >
66
92
  <slot></slot>
67
93
  </a>
68
94
  `;
@@ -80,6 +106,9 @@ Link.styles = [
80
106
  __decorate([
81
107
  property({ type: String })
82
108
  ], Link.prototype, "href", void 0);
109
+ __decorate([
110
+ property({ type: String, attribute: "data-aria-label" })
111
+ ], Link.prototype, "ariaLabel", void 0);
83
112
  __decorate([
84
113
  property({ type: String })
85
114
  ], Link.prototype, "autoActive", void 0);
@@ -1,7 +1,9 @@
1
1
  import { LitElement } from "lit";
2
+ export type LoaderMode = "inline" | "fixed" | "noDelay";
2
3
  type LoaderConf = {
3
4
  mode?: string;
4
5
  container?: HTMLElement;
6
+ noDelay?: boolean;
5
7
  };
6
8
  export declare class Loader extends LitElement {
7
9
  static styles: import("lit").CSSResult[];
@@ -14,7 +16,8 @@ export declare class Loader extends LitElement {
14
16
  * * inline : Loader dans le contenu
15
17
  * * fixed : Loader global par dessus la page
16
18
  */
17
- mode: "inline" | "fixed";
19
+ mode: LoaderMode;
20
+ noDelay: boolean;
18
21
  render(): import("lit-html").TemplateResult<1>;
19
22
  }
20
23
  export {};
@@ -9,6 +9,7 @@ import { html, LitElement, css } from "lit";
9
9
  import { customElement, property } from "lit/decorators.js";
10
10
  import { inline } from "@supersoniks/concorde/core/components/ui/loader/styles/inline";
11
11
  import { fixed } from "@supersoniks/concorde/core/components/ui/loader/styles/fixed";
12
+ import { Theme } from "@supersoniks/concorde/core/components/ui/theme/theme";
12
13
  const tagName = "sonic-loader";
13
14
  let Loader = Loader_1 = class Loader extends LitElement {
14
15
  constructor() {
@@ -19,6 +20,7 @@ let Loader = Loader_1 = class Loader extends LitElement {
19
20
  * * fixed : Loader global par dessus la page
20
21
  */
21
22
  this.mode = "fixed";
23
+ this.noDelay = false;
22
24
  }
23
25
  static show(conf) {
24
26
  if (!Loader_1.loader)
@@ -28,8 +30,10 @@ let Loader = Loader_1 = class Loader extends LitElement {
28
30
  conf = {};
29
31
  if (conf.mode)
30
32
  loader.setAttribute("mode", conf.mode);
33
+ if (conf.noDelay)
34
+ loader.setAttribute("noDelay", "");
31
35
  if (!conf.container) {
32
- conf.container = document.querySelector("sonic-theme") || document.body;
36
+ conf.container = Theme.getPopContainer();
33
37
  conf.mode = "fixed";
34
38
  }
35
39
  conf.container.appendChild(loader);
@@ -43,7 +47,7 @@ let Loader = Loader_1 = class Loader extends LitElement {
43
47
  Loader_1.loader.remove();
44
48
  }
45
49
  render() {
46
- return html `<div class="sonic-loader sonic-loader--${this.mode} ">
50
+ return html `<div class="sonic-loader sonic-loader--${this.mode} ${this.noDelay ? "sonic-loader--nodelay" : ""} ">
47
51
  <div></div>
48
52
  <div></div>
49
53
  <div></div>
@@ -64,7 +68,8 @@ Loader.styles = [
64
68
  opacity: 0;
65
69
  animation: showLoader 0.5s 0.5s forwards;
66
70
  }
67
- .sonic-loader--inline {
71
+ .sonic-loader--inline,
72
+ .sonic-loader--nodelay {
68
73
  animation-delay: 0s;
69
74
  }
70
75
 
@@ -83,6 +88,9 @@ Loader.callCounter = 0;
83
88
  __decorate([
84
89
  property({ type: String })
85
90
  ], Loader.prototype, "mode", void 0);
91
+ __decorate([
92
+ property({ type: Boolean })
93
+ ], Loader.prototype, "noDelay", void 0);
86
94
  Loader = Loader_1 = __decorate([
87
95
  customElement(tagName)
88
96
  ], Loader);
@@ -1,40 +1,39 @@
1
1
  import { css } from "lit";
2
2
  export const inline = css `
3
-
4
3
  :host([align="left"]) .sonic-loader--inline {
5
- margin-left:0;
4
+ margin-left: 0;
6
5
  }
7
-
6
+
8
7
  :host([align="right"]) .sonic-loader--inline {
9
- margin-left:auto;
10
- margin-right:0;
8
+ margin-left: auto;
9
+ margin-right: 0;
11
10
  }
12
11
  .sonic-loader--inline {
13
- display:block;
12
+ display: block;
14
13
  position: relative;
15
14
  width: 80px;
16
- height: 80px;
17
- margin:auto;
18
- z-index:20;
15
+ height: 24px;
16
+ margin: auto;
17
+ z-index: 20;
19
18
  }
20
- .sonic-loader--inline div {
19
+ .sonic-loader--inline div {
21
20
  position: absolute;
22
- top: 33px;
21
+ top: 5px;
23
22
  width: 13px;
24
23
  height: 13px;
25
24
  border-radius: 50%;
26
- background:var(--sc-loader-bg);
25
+ background: var(--sc-loader-bg);
27
26
  animation-timing-function: cubic-bezier(0, 1, 1, 0);
28
27
  }
29
- .sonic-loader--inline div:nth-child(1) {
28
+ .sonic-loader--inline div:nth-child(1) {
30
29
  left: 8px;
31
30
  animation: lds-ellipsis1 0.6s infinite;
32
31
  }
33
- .sonic-loader--inline div:nth-child(2) {
32
+ .sonic-loader--inline div:nth-child(2) {
34
33
  left: 8px;
35
34
  animation: lds-ellipsis2 0.6s infinite;
36
35
  }
37
- .sonic-loader--inline div:nth-child(3) {
36
+ .sonic-loader--inline div:nth-child(3) {
38
37
  left: 32px;
39
38
  animation: lds-ellipsis2 0.6s infinite;
40
39
  }
@@ -67,5 +66,4 @@ export const inline = css `
67
66
  transform: translate(24px, 0);
68
67
  }
69
68
  }
70
-
71
69
  `;
@@ -21,7 +21,8 @@ let MenuItem = class MenuItem extends Button {
21
21
  if (!this.hasAttribute("shape")) {
22
22
  this.shape = "block";
23
23
  }
24
- if (!this.hasAttribute("align")) {
24
+ const isSquareOrCircle = this.shape === "square" || this.shape === "circle";
25
+ if (!this.hasAttribute("align") && !isSquareOrCircle) {
25
26
  this.align = "left";
26
27
  }
27
28
  super.connectedCallback();
@@ -144,7 +144,9 @@ let MenuItems = class MenuItems extends LitElement {
144
144
  elt.setAttribute("size", this.size);
145
145
  }
146
146
  if (this.align) {
147
- elt.setAttribute("align", this.align);
147
+ if (elt.getAttribute("shape") != "square" && elt.getAttribute("shape") != "circle") {
148
+ elt.setAttribute("align", this.align);
149
+ }
148
150
  }
149
151
  if (this.direction == "row") {
150
152
  if (elt.getAttribute("shape") == "block") {
@@ -253,13 +255,7 @@ MenuItems.styles = [
253
255
  rgba(0, 0, 0, 1) 90%,
254
256
  rgba(0, 0, 0, 0) 100%
255
257
  );
256
- mask-image: linear-gradient(
257
- to right,
258
- rgba(0, 0, 0, 0) 0%,
259
- rgba(0, 0, 0, 1) 10%,
260
- rgba(0, 0, 0, 1) 90%,
261
- rgba(0, 0, 0, 0) 100%
262
- );
258
+ mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0) 100%);
263
259
  }
264
260
  :host([scrollable][direction="column"].shadow-top) {
265
261
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
@@ -270,20 +266,8 @@ MenuItems.styles = [
270
266
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
271
267
  }
272
268
  :host([scrollable][direction="column"].shadow-top.shadow-bottom) {
273
- -webkit-mask-image: linear-gradient(
274
- to top,
275
- rgba(0, 0, 0, 0) 0%,
276
- rgba(0, 0, 0, 1) 10%,
277
- rgba(0, 0, 0, 1) 90%,
278
- rgba(0, 0, 0, 0) 100%
279
- );
280
- mask-image: linear-gradient(
281
- to bottom,
282
- rgba(0, 0, 0, 0) 0%,
283
- rgba(0, 0, 0, 1) 10%,
284
- rgba(0, 0, 0, 1) 90%,
285
- rgba(0, 0, 0, 0) 100%
286
- );
269
+ -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0) 100%);
270
+ mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0) 100%);
287
271
  }
288
272
  `,
289
273
  ];
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { html, LitElement, css } from "lit";
8
8
  import { customElement, property } from "lit/decorators.js";
9
9
  import { ifDefined } from "lit/directives/if-defined.js";
10
+ import HTML from "@supersoniks/concorde/core/utils/HTML";
10
11
  const tagName = "sonic-modal-close";
11
12
  let ModalClose = class ModalClose extends LitElement {
12
13
  render() {
@@ -15,7 +16,7 @@ let ModalClose = class ModalClose extends LitElement {
15
16
  ></sonic-button>`;
16
17
  }
17
18
  handleClick() {
18
- const parentModal = this.closest("sonic-modal");
19
+ const parentModal = HTML.getClosestElement(this, "sonic-modal");
19
20
  parentModal.hide();
20
21
  }
21
22
  };