@supersoniks/concorde 1.1.30 → 1.1.34

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 (46) hide show
  1. package/README.md +0 -0
  2. package/cli.js +0 -0
  3. package/concorde-core.bundle.js +102 -114
  4. package/concorde-core.es.js +7586 -54
  5. package/core/components/functional/date/date.js +8 -2
  6. package/core/components/functional/list/list.js +17 -11
  7. package/core/components/functional/queue/queue.d.ts +4 -1
  8. package/core/components/functional/queue/queue.js +16 -3
  9. package/core/components/functional/submit/submit.js +62 -33
  10. package/core/components/ui/_css/size.js +24 -24
  11. package/core/components/ui/alert/alert.js +1 -1
  12. package/core/components/ui/button/button.d.ts +3 -2
  13. package/core/components/ui/captcha/captcha.d.ts +17 -0
  14. package/core/components/ui/captcha/captcha.js +64 -0
  15. package/core/components/ui/form/checkbox/checkbox.d.ts +9 -4
  16. package/core/components/ui/form/checkbox/checkbox.js +28 -35
  17. package/core/components/ui/form/fieldset/legend.d.ts +7 -2
  18. package/core/components/ui/form/fieldset/legend.js +34 -8
  19. package/core/components/ui/form/input/input.d.ts +6 -2
  20. package/core/components/ui/form/input/input.js +4 -13
  21. package/core/components/ui/form/select/select.d.ts +7 -2
  22. package/core/components/ui/form/select/select.js +32 -7
  23. package/core/components/ui/form/textarea/textarea.d.ts +6 -2
  24. package/core/components/ui/form/textarea/textarea.js +2 -7
  25. package/core/components/ui/taxonomy/taxonomy.js +2 -1
  26. package/core/components/ui/theme/css/tailwind.css +0 -0
  27. package/core/components/ui/theme/css/tailwind.d.ts +0 -0
  28. package/core/components/ui/theme/theme.d.ts +1 -0
  29. package/core/components/ui/theme/theme.js +5 -1
  30. package/core/components/ui/toast/toast-item.js +24 -6
  31. package/core/components/ui/toast/toast.js +6 -2
  32. package/core/components/ui/ui.d.ts +1 -0
  33. package/core/components/ui/ui.js +1 -0
  34. package/core/mixins/Fetcher.js +4 -0
  35. package/core/mixins/FormCheckable.d.ts +3 -8
  36. package/core/mixins/FormCheckable.js +4 -15
  37. package/core/mixins/FormElement.js +7 -0
  38. package/core/mixins/FormInput.d.ts +8 -9
  39. package/core/mixins/FormInput.js +39 -2
  40. package/core/mixins/Subscriber.js +4 -0
  41. package/core/utils/PublisherProxy.d.mts +1 -1
  42. package/core/utils/PublisherProxy.mjs +3 -3
  43. package/core/utils/api.d.ts +4 -0
  44. package/core/utils/api.js +29 -3
  45. package/mixins.d.ts +9 -2
  46. package/package.json +3 -1
@@ -57,13 +57,17 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
57
57
  * Retourne un tableau des différentes parties de la date en fonction des options données, de la date de début et de fin.
58
58
  */
59
59
  getDatesParts(start_date, end_date, options) {
60
- const format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
61
60
  let start = this.startDateObject;
62
61
  start.setTime(start_date * 1000);
63
62
  let parts = null;
64
63
  if (end_date > 0) {
65
64
  let end = this.endDateObject;
66
65
  end.setTime(end_date * 1000);
66
+ if (start.toJSON().substring(0, 10) != end.toJSON().substring(0, 10)) {
67
+ delete options.hour;
68
+ delete options.minute;
69
+ }
70
+ let format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
67
71
  parts = format.formatRangeToParts(start, end);
68
72
  if (this.designMode) {
69
73
  for (let part of parts) {
@@ -85,8 +89,10 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
85
89
  parts.unshift({ type: "from", value: this.duAu[0] + " ", source: "shared" });
86
90
  }
87
91
  }
88
- else
92
+ else {
93
+ let format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
89
94
  parts = format.formatToParts(start);
95
+ }
90
96
  parts[0].value = Format.ucFirst(parts[0].value);
91
97
  parts = parts.filter((p) => p.hidden !== true);
92
98
  return parts;
@@ -4,7 +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
- import { html, LitElement, css } from "lit";
7
+ import { html, LitElement, css, nothing } from "lit";
8
8
  import { customElement, property } from "lit/decorators.js";
9
9
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
10
10
  import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
@@ -18,7 +18,7 @@ import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesConta
18
18
  /**
19
19
  * ### List boucle sur sa propriété "props" et crée des éléments a partir des données en bouclant également sur ses templates.
20
20
  *
21
- * Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
21
+ * Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
22
22
  *
23
23
  * * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web.<br>
24
24
  * Voir [fetcher](./?path=/docs/core-components-functional-fetch--basic) pour la configuration des autres attributs.
@@ -62,14 +62,13 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
62
62
  : html `<sonic-loader mode="inline"></sonic-loader>`;
63
63
  }
64
64
  renderNoResultState() {
65
- return html `
66
- <div class="sonic-no-result-container">
67
- <sonic-icon name="emoji-puzzled" size="lg"></sonic-icon
68
- ><span class="sonic-no-result-text">${this.props}</span>
69
- </div>`;
65
+ return html ` <div class="sonic-no-result-container">
66
+ <sonic-icon name="emoji-puzzled" size="lg"></sonic-icon><span class="sonic-no-result-text">${this.props}</span>
67
+ </div>`;
70
68
  }
71
69
  formatProps() {
72
70
  let props = this.props;
71
+ let response = props._sonic_http_response_;
73
72
  let extractValues = this.hasAttribute("extractValues");
74
73
  //si props n'est pas un tableau on l'adapte
75
74
  if (!Array.isArray(props)) {
@@ -77,9 +76,14 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
77
76
  props = Object.entries(props).map(([k, v]) => ({ key: k, value: v }));
78
77
  }
79
78
  else {
80
- props = [props];
79
+ if (!response || response.ok)
80
+ props = [props];
81
+ else {
82
+ props = [];
83
+ }
81
84
  }
82
85
  }
86
+ props._sonic_http_response_ = response;
83
87
  return props;
84
88
  }
85
89
  render() {
@@ -121,12 +125,14 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
121
125
  ${repeat(props, (item, index) => item[this.idKey] || index, (item, index) => {
122
126
  let templatePartName = item[this.templateKey];
123
127
  let hasCustomTemplate = templatePartName && this.templateParts[templatePartName];
124
- counter++;
125
- if (hasCustomTemplate)
126
- counter = -1;
127
128
  let key = extractValues ? item.key : index;
129
+ if (key == "_sonic_http_response_")
130
+ return nothing;
128
131
  let pub = this.publisher[key];
129
132
  pub._key_ = key + "";
133
+ counter++;
134
+ if (hasCustomTemplate)
135
+ counter = -1;
130
136
  return (item &&
131
137
  html `
132
138
  <sonic-subscriber
@@ -1,5 +1,5 @@
1
1
  import { LitElement, nothing } from "lit";
2
- import '@supersoniks/concorde/core/components/functional/list/list';
2
+ import "@supersoniks/concorde/core/components/functional/list/list";
3
3
  import { PublisherProxy } from "@supersoniks/concorde/core/utils/PublisherProxy.mjs";
4
4
  declare const Queue_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
5
5
  export default class Queue extends Queue_base {
@@ -14,6 +14,9 @@ export default class Queue extends Queue_base {
14
14
  limit: number;
15
15
  offset: number;
16
16
  filteredFields: string;
17
+ _displayContents: boolean;
18
+ set displayContents(value: boolean);
19
+ get displayContents(): boolean;
17
20
  static instanceCounter: number;
18
21
  connectedCallback(): void;
19
22
  filterPublisher: PublisherProxy | null;
@@ -8,10 +8,10 @@ var Queue_1;
8
8
  import { html, LitElement, nothing } from "lit";
9
9
  import { customElement, property } from "lit/decorators.js";
10
10
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
11
- import { repeat } from 'lit/directives/repeat.js';
11
+ import { repeat } from "lit/directives/repeat.js";
12
12
  import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy.mjs";
13
13
  import { ifDefined } from "lit/directives/if-defined.js";
14
- import '@supersoniks/concorde/core/components/functional/list/list';
14
+ import "@supersoniks/concorde/core/components/functional/list/list";
15
15
  /**
16
16
  *### Une Queue charge du contenu par lot selon l'expression renseignée dans l'attribut *dataProviderExpression*.
17
17
  * * Chaque lot est chargé par un composant [List](./?path=/docs/core-components-functional-list-list--basic) dont le dataProvider créé à partir de l'attribut dataProviderExpression
@@ -39,6 +39,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
39
39
  this.limit = 5;
40
40
  this.offset = 0;
41
41
  this.filteredFields = "";
42
+ this._displayContents = false;
42
43
  this.filterPublisher = null;
43
44
  this.filterTimeoutId = undefined;
44
45
  /**
@@ -52,6 +53,12 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
52
53
  this.currentScrollPosition = undefined;
53
54
  this.listDataProviders = [];
54
55
  }
56
+ set displayContents(value) {
57
+ this._displayContents = value;
58
+ }
59
+ get displayContents() {
60
+ return this._displayContents;
61
+ }
55
62
  connectedCallback() {
56
63
  this.noShadowDom = "";
57
64
  this.defferedDebug = this.hasAttribute("debug") || null;
@@ -142,6 +149,8 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
142
149
  this.lastRequestTime = new Date().getTime();
143
150
  }
144
151
  render() {
152
+ let displayStyle = this.displayContents ? "contents" : "inline";
153
+ this.style.display = displayStyle;
145
154
  if (this.currentScrollPosition) {
146
155
  window.requestAnimationFrame(() => {
147
156
  if (document.scrollingElement)
@@ -154,10 +163,11 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
154
163
  return html `
155
164
  ${repeat(this.props, (item) => item.id, (item, index) => {
156
165
  var _a;
157
- let templates = index == 0 ? this.templates : (_a = this.templates) === null || _a === void 0 ? void 0 : _a.filter(elt => elt.getAttribute("data-value") != "no-item");
166
+ let templates = index == 0 ? this.templates : (_a = this.templates) === null || _a === void 0 ? void 0 : _a.filter((elt) => elt.getAttribute("data-value") != "no-item");
158
167
  return html `
159
168
  <sonic-list
160
169
  fetch
170
+ style=${displayStyle}
161
171
  .itemPropertyMap=${this.itemPropertyMap}
162
172
  debug=${ifDefined(this.defferedDebug)}
163
173
  @load=${this.next}
@@ -192,6 +202,9 @@ __decorate([
192
202
  __decorate([
193
203
  property()
194
204
  ], Queue.prototype, "filteredFields", void 0);
205
+ __decorate([
206
+ property()
207
+ ], Queue.prototype, "displayContents", null);
195
208
  __decorate([
196
209
  property({ type: String })
197
210
  ], Queue.prototype, "dataProviderExpression", void 0);
@@ -55,55 +55,84 @@ let Submit = class Submit extends Subscriber(LitElement) {
55
55
  this.api = new API(this.getApiConfiguration());
56
56
  }
57
57
  submit() {
58
- var _a, _b, _c, _d, _e;
58
+ var _a, _b, _c;
59
59
  return __awaiter(this, void 0, void 0, function* () {
60
60
  const formPublisher = PublisherManager.getInstance().get(this.getAncestorAttributeValue("formDataProvider"));
61
61
  //
62
- // Validation du formulaire
62
+ // Validation du formulaire
63
63
  formPublisher.isFormValid = true;
64
64
  formPublisher.invalidate();
65
65
  if (!formPublisher.isFormValid.get())
66
66
  return;
67
- this.publisher.disabled = true;
67
+ if (this.publisher)
68
+ this.publisher.disabled = true;
68
69
  formPublisher.isFormValid;
69
70
  //
70
71
  //Recup données
71
72
  let method = ((_a = this.getAttribute("method")) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) || "post";
72
- let postData = formPublisher.get();
73
- delete postData.isFormValid;
74
- let headerData = PublisherManager.getInstance().get(this.getAncestorAttributeValue("headersDataProvider")).get();
73
+ let sendAsFormData = this.hasAttribute("sendAsFormData");
74
+ let formData = formPublisher.get();
75
+ delete formData.isFormValid;
76
+ const headerPublisher = PublisherManager.getInstance().get(this.getAncestorAttributeValue("headersDataProvider"));
77
+ let headerData = headerPublisher.get();
75
78
  let result = null;
76
79
  let dataProvider = this.getAncestorAttributeValue("dataProvider");
77
80
  let endPoint = this.endPoint || dataProvider;
78
81
  Loader.show();
79
- //
80
- //envoi données
81
- switch (method) {
82
- case "put":
83
- result = yield ((_b = this.api) === null || _b === void 0 ? void 0 : _b.put(endPoint, postData, headerData));
84
- break;
85
- case "delete":
86
- result = yield ((_c = this.api) === null || _c === void 0 ? void 0 : _c.delete(endPoint, postData, headerData));
87
- break;
88
- case "get":
89
- result = yield ((_d = this.api) === null || _d === void 0 ? void 0 : _d.get(endPoint));
90
- break;
91
- default:
92
- result = yield ((_e = this.api) === null || _e === void 0 ? void 0 : _e.post(endPoint, postData, headerData));
93
- break;
94
- }
95
- Loader.hide();
96
- if (!result)
97
- result = { messages: [{ content: "Network Error", status: "error" }] };
98
- let clearedDataProvider = this.getAncestorAttributeValue("clearedDataOnSuccess");
99
- if (clearedDataProvider) {
100
- clearedDataProvider.split(" ").forEach(dataProvider => PublisherManager.get(dataProvider).set({}));
82
+ let sendData = () => __awaiter(this, void 0, void 0, function* () {
83
+ var _d, _e, _f, _g, _h;
84
+ //
85
+ //envoi données
86
+ if (sendAsFormData) {
87
+ result = yield ((_d = this.api) === null || _d === void 0 ? void 0 : _d.submitFormData(endPoint, formData, headerData));
88
+ }
89
+ else {
90
+ switch (method) {
91
+ case "put":
92
+ result = yield ((_e = this.api) === null || _e === void 0 ? void 0 : _e.put(endPoint, formData, headerData));
93
+ break;
94
+ case "delete":
95
+ result = yield ((_f = this.api) === null || _f === void 0 ? void 0 : _f.delete(endPoint, formData, headerData));
96
+ break;
97
+ case "get":
98
+ result = yield ((_g = this.api) === null || _g === void 0 ? void 0 : _g.get(endPoint, headerData));
99
+ break;
100
+ default:
101
+ result = yield ((_h = this.api) === null || _h === void 0 ? void 0 : _h.post(endPoint, formData, headerData));
102
+ break;
103
+ }
104
+ }
105
+ Loader.hide();
106
+ //Je garde ça, mais normalement il y a toujours quelquechose
107
+ if (!result)
108
+ result = { messages: [{ content: "Network Error", status: "error" }] };
109
+ let clearedDataProvider = this.getAncestorAttributeValue("clearedDataOnSuccess");
110
+ if (clearedDataProvider) {
111
+ clearedDataProvider.split(" ").forEach((dataProvider) => PublisherManager.get(dataProvider).set({}));
112
+ }
113
+ if (this.submitResultKey) {
114
+ result = Objects.traverse(result, this.submitResultKey.split("."), true);
115
+ }
116
+ PublisherManager.getInstance().get(this.getAncestorAttributeValue("submitResultDataProvider")).set(result);
117
+ if (this.publisher)
118
+ this.publisher.disabled = false;
119
+ });
120
+ let captchaPublisher = headerPublisher.needsCaptchaValidation.get()
121
+ ? headerPublisher
122
+ : formPublisher.needsCaptchaValidation.get()
123
+ ? formPublisher
124
+ : null;
125
+ if (captchaPublisher) {
126
+ captchaPublisher.action = method + "//" + ((_c = (_b = dataProvider === null || dataProvider === void 0 ? void 0 : dataProvider.split("?")[0]) !== null && _b !== void 0 ? _b : this.getAncestorAttributeValue("formDataProvider")) !== null && _c !== void 0 ? _c : "submit");
127
+ captchaPublisher.captchaToken = "request_token";
128
+ captchaPublisher.captchaToken.onAssign((token) => {
129
+ if (token != "request_token")
130
+ sendData();
131
+ });
101
132
  }
102
- if (this.submitResultKey) {
103
- result = Objects.traverse(result, this.submitResultKey.split("."), true);
133
+ else {
134
+ sendData();
104
135
  }
105
- PublisherManager.getInstance().get(this.getAncestorAttributeValue("submitResultDataProvider")).set(result);
106
- this.publisher.disabled = false;
107
136
  });
108
137
  }
109
138
  render() {
@@ -111,7 +140,7 @@ let Submit = class Submit extends Subscriber(LitElement) {
111
140
  }
112
141
  };
113
142
  Submit.styles = css `
114
- [data-disabled]{
143
+ [data-disabled] {
115
144
  opacity: 0.3;
116
145
  pointer-events: none;
117
146
  user-select: none;
@@ -1,26 +1,26 @@
1
1
  import { css } from "lit";
2
- export const fontSize = css `
3
- /*SIZES*/
4
- :host {
5
- --sc-fs: 1rem;
6
- font-size: var(--sc-fs);
7
- }
8
- :host([size="2xs"]) {
9
- --sc-fs: 0.68rem;
10
- }
11
- :host([size="xs"]) {
12
- --sc-fs: 0.75rem;
13
- }
14
- :host([size="sm"]) {
15
- --sc-fs: 0.875rem;
16
- }
17
- :host([size="lg"]) {
18
- --sc-fs: 1.125rem;
19
- }
20
- :host([size="xl"]) {
21
- --sc-fs: 1.25rem;
22
- }
23
- :host([size="2xl"]) {
24
- --sc-fs: 1.5rem;
25
- }
2
+ export const fontSize = css `
3
+ /*SIZES*/
4
+ :host {
5
+ --sc-fs: 1rem;
6
+ font-size: var(--sc-fs);
7
+ }
8
+ :host([size="2xs"]) {
9
+ --sc-fs: 0.68rem;
10
+ }
11
+ :host([size="xs"]) {
12
+ --sc-fs: 0.75rem;
13
+ }
14
+ :host([size="sm"]) {
15
+ --sc-fs: 0.875rem;
16
+ }
17
+ :host([size="lg"]) {
18
+ --sc-fs: 1.125rem;
19
+ }
20
+ :host([size="xl"]) {
21
+ --sc-fs: 1.25rem;
22
+ }
23
+ :host([size="2xl"]) {
24
+ --sc-fs: 1.5rem;
25
+ }
26
26
  `;
@@ -67,7 +67,7 @@ Alert.styles = [
67
67
  line-height: 1.2;
68
68
  border-radius: var(--sc-alert-rounded);
69
69
  }
70
-
70
+ z
71
71
  .label {
72
72
  font-weight: var(--sc-alert-label-fw);
73
73
  }
@@ -3,8 +3,7 @@ declare const Button_base: {
3
3
  new (...args: any[]): {
4
4
  _value: string | null;
5
5
  value: string | null;
6
- _name: string;
7
- name: string;
6
+ forceAutoFill: boolean;
8
7
  unique: true | null;
9
8
  radio: true | null;
10
9
  _checked: true | null;
@@ -23,6 +22,8 @@ declare const Button_base: {
23
22
  required: boolean;
24
23
  disabled: true | null;
25
24
  formDataProvider: string;
25
+ _name: string;
26
+ name: string;
26
27
  props: any;
27
28
  isConnected: boolean;
28
29
  getAncestorAttributeValue(attributeName: string): string;
@@ -0,0 +1,17 @@
1
+ import { LitElement } from "lit";
2
+ declare const Captcha_base: (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface) & typeof LitElement;
3
+ /**
4
+ * Un bouton simple avec deux slots, un nommé préfix et un nomé suffix de manière à pouvoir mettre (par exemple) une icone avant ou après le contenu.
5
+ * * L'objet et ses slot sont en display flex avec direction / alignement et justifications configurables
6
+ * * Le bouton est comparable au badge car il possèdent tous les deux les propriétés *type* (primary...), *variant*(outline, ghost), size(xs...)...
7
+ * * Le bouton possède cependant et notamment une propriété href contrairement à un badge
8
+ */
9
+ export declare class Captcha extends Captcha_base {
10
+ key: string;
11
+ action: string | null;
12
+ formPublisher: any;
13
+ connectedCallback(): void;
14
+ requestToken(): void;
15
+ protected render(): import("lit-html").TemplateResult<1>;
16
+ }
17
+ export {};
@@ -0,0 +1,64 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Subscriber } from "@supersoniks/concorde/mixins";
8
+ import { PublisherManager } from "@supersoniks/concorde/utils";
9
+ import { html, LitElement } from "lit";
10
+ import { customElement, property } from "lit/decorators.js";
11
+ const tagName = "sonic-captcha";
12
+ /**
13
+ * Un bouton simple avec deux slots, un nommé préfix et un nomé suffix de manière à pouvoir mettre (par exemple) une icone avant ou après le contenu.
14
+ * * L'objet et ses slot sont en display flex avec direction / alignement et justifications configurables
15
+ * * Le bouton est comparable au badge car il possèdent tous les deux les propriétés *type* (primary...), *variant*(outline, ghost), size(xs...)...
16
+ * * Le bouton possède cependant et notamment une propriété href contrairement à un badge
17
+ */
18
+ let Captcha = class Captcha extends Subscriber(LitElement) {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.key = "";
22
+ this.action = null;
23
+ }
24
+ connectedCallback() {
25
+ var _a;
26
+ const script = document.createElement("script");
27
+ script.src = "https://www.google.com/recaptcha/api.js?render=" + this.key;
28
+ document.head.appendChild(script);
29
+ super.connectedCallback();
30
+ this.formPublisher = PublisherManager.get((_a = this.getAncestorAttributeValue("headersDataProvider")) !== null && _a !== void 0 ? _a : this.getAncestorAttributeValue("formDataProvider"));
31
+ this.formPublisher.needsCaptchaValidation = true;
32
+ this.formPublisher.captchaToken.onAssign((v) => {
33
+ if (v == "request_token") {
34
+ this.requestToken();
35
+ }
36
+ });
37
+ }
38
+ requestToken() {
39
+ var _a, _b, _c;
40
+ const win = window;
41
+ // On récupère l'action liée au recaptcha,
42
+ // et on vérifie qu'il ne contienne que des caractères alpha-numériques, underscore et slash
43
+ let action = ((_c = (_a = this.action) !== null && _a !== void 0 ? _a : (_b = this.formPublisher.action) === null || _b === void 0 ? void 0 : _b.get()) !== null && _c !== void 0 ? _c : "submit").replace(/[^\w_\/]/g, "_");
44
+ delete this.formPublisher.action;
45
+ win.grecaptcha.ready(() => {
46
+ win.grecaptcha.execute(this.key, { action: action }).then((token) => {
47
+ this.formPublisher.captchaToken = token;
48
+ });
49
+ });
50
+ }
51
+ render() {
52
+ return html ` <slot></slot> `;
53
+ }
54
+ };
55
+ __decorate([
56
+ property()
57
+ ], Captcha.prototype, "key", void 0);
58
+ __decorate([
59
+ property()
60
+ ], Captcha.prototype, "action", void 0);
61
+ Captcha = __decorate([
62
+ customElement(tagName)
63
+ ], Captcha);
64
+ export { Captcha };
@@ -4,8 +4,7 @@ declare const Checkbox_base: {
4
4
  new (...args: any[]): {
5
5
  _value: string | null;
6
6
  value: string | null;
7
- _name: string;
8
- name: string;
7
+ forceAutoFill: boolean;
9
8
  unique: true | null;
10
9
  radio: true | null;
11
10
  _checked: true | null;
@@ -24,6 +23,8 @@ declare const Checkbox_base: {
24
23
  required: boolean;
25
24
  disabled: true | null;
26
25
  formDataProvider: string;
26
+ _name: string;
27
+ name: string;
27
28
  props: any;
28
29
  isConnected: boolean;
29
30
  getAncestorAttributeValue(attributeName: string): string;
@@ -49,7 +50,13 @@ declare const Checkbox_base: {
49
50
  } & {
50
51
  new (...args: any[]): {
51
52
  validateFormElement(): void;
53
+ forceAutoFill: boolean;
54
+ _type: "number" | "search" | "file" | "button" | "password" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local";
52
55
  type: "number" | "search" | "file" | "button" | "password" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local";
56
+ _description?: string | undefined;
57
+ description: string | undefined;
58
+ _label?: string | undefined;
59
+ label: string | undefined;
53
60
  tabindex?: number | undefined;
54
61
  autocomplete?: "url" | "name" | "language" | "on" | "tel" | "email" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "photo" | undefined;
55
62
  getFormPublisher(): any;
@@ -94,8 +101,6 @@ export declare class Checkbox extends Checkbox_base {
94
101
  static styles: CSSResultGroup[];
95
102
  touched: boolean;
96
103
  iconName: string;
97
- description?: string;
98
- label?: string;
99
104
  slotDescriptionNodes: Array<Node>;
100
105
  hasDescription: boolean;
101
106
  updated(): void;
@@ -51,40 +51,38 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
51
51
  }
52
52
  render() {
53
53
  return html `
54
- <label class="checkbox-container ${this.disabled ? "disabled" : ""}">
55
- <span class="icon-container">
56
- <input
57
- type="${this.type}"
58
- @change=${this.handleChange}
59
- @blur=${this.handleBlur}
60
- ?required=${this.required}
61
- .disabled=${ifDefined(this.disabled)}
62
- .checked=${ifDefined(this.checked)}
63
- .name=${this.name}
64
- .value=${this.value}
65
- ?autofocus=${this.autofocus}
66
-
67
- />
68
- <sonic-icon
69
- name="${this.iconName}" class="sc-input-icon"></sonic-icon>
70
- </span>
71
- <div class="checkbox-text">
72
- ${this.label ? this.label : ""}
73
- <slot></slot>
74
- <slot name="description" class="${this.hasDescription ? "description" : "hidden"} ">
75
- ${this.description ? html `${this.description}` : ""}
76
- </slot>
77
- </div>
78
- </label>
54
+ <label class="checkbox-container ${this.disabled ? "disabled" : ""}">
55
+ <span class="icon-container">
56
+ <input
57
+ type="${this.type}"
58
+ @change=${this.handleChange}
59
+ @blur=${this.handleBlur}
60
+ ?required=${this.required}
61
+ .disabled=${ifDefined(this.disabled)}
62
+ .checked=${ifDefined(this.checked)}
63
+ .name=${this.name}
64
+ .value=${this.value}
65
+ ?autofocus=${this.autofocus}
66
+ />
67
+ <sonic-icon name="${this.iconName}" class="sc-input-icon"></sonic-icon>
68
+ </span>
69
+ <div class="checkbox-text">
70
+ ${this.label ? this.label : ""}
71
+ <slot></slot>
72
+ <slot name="description" class="${this.hasDescription ? "description" : "hidden"} ">
73
+ ${this.description ? html `${this.description}` : ""}
74
+ </slot>
75
+ </div>
76
+ </label>
79
77
  `;
80
78
  }
81
79
  };
82
80
  Checkbox.styles = [
83
81
  fontSize,
84
82
  css `
85
- :host{
83
+ :host {
86
84
  --sc-checkbox-border-width: var(--sc-form-border-width);
87
- --sc-checkbox-border-color: transparent;
85
+ --sc-checkbox-border-color: transparent;
88
86
  }
89
87
 
90
88
  * {
@@ -119,7 +117,7 @@ Checkbox.styles = [
119
117
  outline: none;
120
118
  margin: 0;
121
119
  background-color: var(--sc-base-200);
122
- border:var(--sc-checkbox-border-width) solid var(--sc-checkbox-border-color);
120
+ border: var(--sc-checkbox-border-width) solid var(--sc-checkbox-border-color);
123
121
  }
124
122
 
125
123
  input:focus,
@@ -188,13 +186,14 @@ Checkbox.styles = [
188
186
  }
189
187
 
190
188
  /*ERROR*/
189
+ /*
191
190
  :host([touched]) .checkbox-container:has(input:not(:focus):invalid) {
192
191
  --sc-checkbox-border-color:var(--sc-danger);
193
192
  }
194
193
  :host([touched]) .checkbox-container:has(input:not(:focus):invalid) .checkbox-text{
195
194
  color:var(--sc-danger);
196
195
  }
197
-
196
+ */
198
197
  `,
199
198
  ];
200
199
  __decorate([
@@ -203,12 +202,6 @@ __decorate([
203
202
  __decorate([
204
203
  property({ type: String })
205
204
  ], Checkbox.prototype, "iconName", void 0);
206
- __decorate([
207
- property({ type: String })
208
- ], Checkbox.prototype, "description", void 0);
209
- __decorate([
210
- property({ type: String })
211
- ], Checkbox.prototype, "label", void 0);
212
205
  __decorate([
213
206
  queryAssignedNodes({ slot: "description" })
214
207
  ], Checkbox.prototype, "slotDescriptionNodes", void 0);
@@ -2,8 +2,13 @@ import { LitElement } from "lit";
2
2
  import "@supersoniks/concorde/core/components/ui/form/fieldset/legend-description";
3
3
  export declare class Legend extends LitElement {
4
4
  static styles: import("lit").CSSResult[];
5
- description?: string;
6
- label?: string;
5
+ forceAutoFill: boolean;
6
+ _description?: string;
7
+ get description(): string | undefined;
8
+ set description(value: string | undefined);
9
+ _label?: string;
10
+ get label(): string | undefined;
11
+ set label(value: string | undefined);
7
12
  iconName?: string;
8
13
  iconLibrary?: string;
9
14
  iconPrefix?: string;