@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
@@ -7,12 +7,11 @@ declare const SonicSDUI_base: {
7
7
  isFirstLoad: boolean;
8
8
  isLoading: boolean;
9
9
  lazyLoad?: boolean | undefined;
10
- noLoader?: boolean | undefined;
11
10
  iObserver: IntersectionObserver | null;
12
- isDefaultLoaderEnabled: boolean;
13
11
  isFetchEnabled: boolean;
12
+ fetchedData: any;
14
13
  _endPoint: string;
15
- props: (import("../../../_types/types").PublisherContentType & import("../../../utils/api").ResultTypeInterface) | null;
14
+ props: import("../../../utils/api").ResultTypeInterface | null;
16
15
  endPoint: string;
17
16
  requestId: number;
18
17
  refetchEveryMs: number;
@@ -49,10 +48,6 @@ declare const SonicSDUI_base: {
49
48
  getAttribute(name: string): string;
50
49
  hasAttribute(attributeName: string): boolean;
51
50
  getBoundingClientRect(): DOMRect;
52
- onConnected(callback: (component: any) => void): void;
53
- offConnected(callback: (component: any) => void): void;
54
- onDisconnected(callback: (component: any) => void): void;
55
- offDisconnected(callback: (component: any) => void): void;
56
51
  };
57
52
  } & (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
58
53
  /**
@@ -131,7 +131,15 @@ let Submit = class Submit extends Subscriber(LitElement) {
131
131
  result = await this.api?.delete(endPoint, formData, headerData);
132
132
  break;
133
133
  case "get":
134
- result = await this.api?.get(endPoint, headerData);
134
+ // add formData to endpoint
135
+ const params = new URLSearchParams();
136
+ if (formData) {
137
+ for (const key in formData) {
138
+ params.append(key, formData[key]);
139
+ }
140
+ }
141
+ const paramString = "?" + params.toString();
142
+ result = await this.api?.get(endPoint + paramString, headerData);
135
143
  break;
136
144
  default:
137
145
  result = await this.api?.post(endPoint, formData, headerData);
@@ -169,11 +177,10 @@ let Submit = class Submit extends Subscriber(LitElement) {
169
177
  : null;
170
178
  if (captchaPublisher) {
171
179
  captchaPublisher.captchaMethod = method;
172
- captchaPublisher.captchaAction =
173
- dataProvider?.split("?")[0] ?? this.getAncestorAttributeValue("formDataProvider") ?? "submit";
180
+ captchaPublisher.captchaAction = dataProvider?.split("?")[0] ?? this.getAncestorAttributeValue("formDataProvider") ?? "submit";
174
181
  captchaPublisher.captchaToken = "request_token";
175
182
  const captchaAssign = (token) => {
176
- if (token != "request_token") {
183
+ if (token != "request_token" && token != "") {
177
184
  sendData();
178
185
  // Après l'envoie des données, on supprime ce onAssign.
179
186
  // Sinon les handler se cumuleraient après plusieurs submit consécutifs.
@@ -5,17 +5,19 @@ export const customScroll = css `
5
5
  overflow-y: overlay !important;
6
6
  }
7
7
 
8
- .custom-scroll::-webkit-scrollbar {
9
- width: 0.5rem;
10
- height: 0.5rem;
11
- border: solid 0.15rem transparent;
12
- border-radius: var(--sc-rounded);
13
- background: transparent;
14
- }
8
+ @media (hover: hover) {
9
+ .custom-scroll::-webkit-scrollbar {
10
+ width: 0.5rem;
11
+ height: 0.5rem;
12
+ border: solid 0.15rem transparent;
13
+ border-radius: var(--sc-rounded);
14
+ background: transparent;
15
+ }
15
16
 
16
- .custom-scroll::-webkit-scrollbar-thumb {
17
- box-shadow: inset 0 0 2rem 2rem var(--sc-scrollbar-bg);
18
- border-radius: var(--sc-rounded);
19
- border: solid 0.15rem transparent;
17
+ .custom-scroll::-webkit-scrollbar-thumb {
18
+ box-shadow: inset 0 0 2rem 2rem var(--sc-scrollbar-bg);
19
+ border-radius: var(--sc-rounded);
20
+ border: solid 0.15rem transparent;
21
+ }
20
22
  }
21
23
  `;
@@ -3,7 +3,7 @@ export const fontSize = css `
3
3
  /*SIZES*/
4
4
  :host {
5
5
  --sc-fs: 1rem;
6
- --sc-lh: 1.2;
6
+ --sc-lh: 1.15;
7
7
  font-size: var(--sc-fs);
8
8
  line-height: var(--sc-lh);
9
9
  }
@@ -1,4 +1,12 @@
1
- import { LitElement } from "lit";
1
+ import { LitElement, nothing } from "lit";
2
+ declare const icon: {
3
+ warning: string;
4
+ success: string;
5
+ error: string;
6
+ info: string;
7
+ default: string;
8
+ };
9
+ export type AlertStatus = keyof typeof icon;
2
10
  /**
3
11
  * Affiche un message en ligne.
4
12
  * Soit par ses simples attributs "label" et "text", soit par son slot pour des messages plus complexes.
@@ -14,10 +22,13 @@ export declare class Alert extends LitElement {
14
22
  * Peut être renseigné dans le slot pour créer des messages plus complexes
15
23
  */
16
24
  text: string;
25
+ id: string;
17
26
  size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
18
27
  dismissible: boolean;
19
28
  background: boolean;
20
- status: "default" | "error" | "warning" | "primary" | "info";
21
- render(): import("lit-html").TemplateResult<1>;
29
+ status: AlertStatus;
30
+ dismissForever: boolean;
31
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
22
32
  close(): void;
23
33
  }
34
+ export {};
@@ -32,18 +32,28 @@ let Alert = class Alert extends LitElement {
32
32
  * Peut être renseigné dans le slot pour créer des messages plus complexes
33
33
  */
34
34
  this.text = "";
35
+ this.id = new Date().getTime().toString();
35
36
  this.dismissible = false;
36
37
  this.background = false;
37
38
  this.status = "default";
39
+ this.dismissForever = false;
38
40
  }
39
41
  render() {
42
+ // if dismiss forever, check if already dismissed
43
+ if (this.dismissForever) {
44
+ const dismissed = localStorage.getItem("sonic-alert-dismissed") || "{}";
45
+ const dismissedObj = JSON.parse(dismissed);
46
+ if (dismissedObj[this.id]) {
47
+ return nothing;
48
+ }
49
+ }
40
50
  return html `<div part="alert" class="alert">
41
- ${!this.noIcon
42
- ? html `<div>${this.status && html `<sonic-icon name=${icon[this.status]}></sonic-icon>`}</div>`
43
- : nothing}
51
+ <slot name="icon" class="${this.noIcon ? "hidden" : nothing}"
52
+ >${!this.noIcon ? html `<div>${this.status && html `<sonic-icon name=${icon[this.status]}></sonic-icon>`}</div>` : nothing}</slot
53
+ >
44
54
  <div>
45
55
  ${this.label ? html `<span class="label">${unsafeHTML(this.label)}</span>` : nothing}
46
- <slot>${this.text}</slot>
56
+ <div>${this.text}<slot></slot></div>
47
57
  </div>
48
58
  ${this.dismissible
49
59
  ? html `<sonic-button @click=${this.close} class="close-btn" variant="unstyled" shape="circle">
@@ -54,6 +64,13 @@ let Alert = class Alert extends LitElement {
54
64
  }
55
65
  close() {
56
66
  this.remove();
67
+ // if dismiss forever, save in localstorage
68
+ if (this.dismissForever) {
69
+ const dismissed = localStorage.getItem("sonic-alert-dismissed") || "{}";
70
+ const dismissedObj = JSON.parse(dismissed);
71
+ dismissedObj[this.id] = true;
72
+ localStorage.setItem("sonic-alert-dismissed", JSON.stringify(dismissedObj));
73
+ }
57
74
  }
58
75
  };
59
76
  Alert.styles = [
@@ -76,10 +93,13 @@ Alert.styles = [
76
93
  display: flex;
77
94
  gap: 0.4em;
78
95
  border-radius: var(--sc-alert-rounded);
96
+ overflow: hidden;
79
97
  }
80
98
 
81
99
  .label {
82
100
  font-weight: var(--sc-alert-label-fw);
101
+ margin-bottom: 0.15em;
102
+ display: block;
83
103
  }
84
104
 
85
105
  :host([status="warning"]) {
@@ -125,6 +145,10 @@ Alert.styles = [
125
145
  display: block;
126
146
  }
127
147
 
148
+ .hidden {
149
+ display: none !important;
150
+ }
151
+
128
152
  /*Rounded*/
129
153
  :host([size="xs"]) .alert {
130
154
  --sc-alert-rounded: var(--sc-rounded-sm);
@@ -154,6 +178,9 @@ __decorate([
154
178
  __decorate([
155
179
  property({ type: String })
156
180
  ], Alert.prototype, "text", void 0);
181
+ __decorate([
182
+ property({ type: String })
183
+ ], Alert.prototype, "id", void 0);
157
184
  __decorate([
158
185
  property({ type: String, reflect: true })
159
186
  ], Alert.prototype, "size", void 0);
@@ -166,6 +193,9 @@ __decorate([
166
193
  __decorate([
167
194
  property({ type: String, reflect: true })
168
195
  ], Alert.prototype, "status", void 0);
196
+ __decorate([
197
+ property({ type: Boolean, reflect: true })
198
+ ], Alert.prototype, "dismissForever", void 0);
169
199
  Alert = __decorate([
170
200
  customElement(tagName)
171
201
  ], Alert);
@@ -41,14 +41,15 @@ Badge.styles = [
41
41
  css `
42
42
  :host {
43
43
  --sc-badge-gap: 0.3em;
44
- --sc-badge-py: 0.17em;
45
- --sc-badge-px: 0.66em;
44
+ --sc-badge-py: 0.35em;
45
+ --sc-badge-px: 0.67em;
46
46
  --sc-fs: 1rem;
47
47
 
48
48
  --sc-badge-color: var(--sc-base-content, #1f2937);
49
49
  --sc-badge-bg: var(--sc-base-100, #e5e7eb);
50
50
 
51
- --sc-badge-border-with: var(--sc-form-border-width, 0.1rem);
51
+ /*--sc-badge-border-with: var(--sc-form-border-width, 0.1rem);*/
52
+ --sc-badge-border-with: 1px;
52
53
  --sc-badge-border-color: transparent;
53
54
  --sc-badge-border: var(--sc-badge-border-with) solid var(--sc-badge-border-color);
54
55
 
@@ -66,6 +67,7 @@ Badge.styles = [
66
67
 
67
68
  font-family: var(--sc-badge-ff, var(--sc-font-family-base, inherit));
68
69
  font-weight: var(--sc-badge-fw);
70
+ line-height: 1;
69
71
 
70
72
  padding-top: var(--sc-badge-py);
71
73
  padding-bottom: var(--sc-badge-py);
@@ -154,6 +156,11 @@ Badge.styles = [
154
156
  background: transparent;
155
157
  padding: 0;
156
158
  }
159
+ @media (forced-colors: active) {
160
+ :host([variant="ghost"][type]) {
161
+ padding: var(--sc-badge-py) var(--sc-badge-px);
162
+ }
163
+ }
157
164
 
158
165
  :host([variant="ghost"][type="default"]) {
159
166
  color: var(--sc-badge-color);
@@ -1,4 +1,8 @@
1
1
  import { LitElement, CSSResultGroup } from "lit";
2
+ import { Size } from "@supersoniks/concorde/core/components/ui/_css/size";
3
+ export type ButtonType = "default" | "primary" | "neutral" | "warning" | "danger" | "success" | "info";
4
+ export type ButtonShape = "default" | "circle" | "square" | "block";
5
+ export type ButtonVariant = "default" | "ghost" | "outline" | "unstyled" | "link";
2
6
  declare const Button_base: {
3
7
  new (...args: any[]): {
4
8
  _value: string | null;
@@ -23,6 +27,7 @@ declare const Button_base: {
23
27
  getFormPublisher(): any;
24
28
  updateDataValue(): void;
25
29
  handleBlur(e?: Event | undefined): void;
30
+ setValueFromPublisher(value: string | object | string[] | null | undefined): void;
26
31
  focus?: (() => void) | undefined;
27
32
  shadowRoot?: ShadowRoot | undefined;
28
33
  error: boolean;
@@ -59,10 +64,6 @@ declare const Button_base: {
59
64
  getAttribute(name: string): string;
60
65
  hasAttribute(attributeName: string): boolean;
61
66
  getBoundingClientRect(): DOMRect;
62
- onConnected(callback: (component: any) => void): void;
63
- offConnected(callback: (component: any) => void): void;
64
- onDisconnected(callback: (component: any) => void): void;
65
- offDisconnected(callback: (component: any) => void): void;
66
67
  };
67
68
  } & (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;
68
69
  /**
@@ -76,17 +77,17 @@ export declare class Button extends Button_base {
76
77
  /**
77
78
  * Le type change surtout la couleur composant
78
79
  */
79
- type: "default" | "primary" | "neutral" | "warning" | "danger" | "success" | "info";
80
+ type: ButtonType;
80
81
  /**
81
82
  * Le composant par defaut sans se paramètre à forte affordance
82
83
  * * gost : composant super léger visuellement
83
84
  * * outline : composant légé avec une bordure
84
85
  */
85
- variant: "default" | "ghost" | "outline" | "unstyled" | "link";
86
+ variant: ButtonVariant;
86
87
  /**
87
88
  * Taille du composant, implique notamment des modifications de typo et de marge interne
88
89
  */
89
- size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
90
+ size?: Size;
90
91
  /**
91
92
  * Forme du bouton, permet de le forcer en carré ou cercle
92
93
  */
@@ -115,6 +116,7 @@ export declare class Button extends Button_base {
115
116
  * Si un bouton n'a qu'une icone pour contenu, agrandi l'icone pour des raisons d'équilibre
116
117
  */
117
118
  icon: boolean;
119
+ download: string | null;
118
120
  /**
119
121
  * mode d'activation du bouton :
120
122
  * - strict : l'url courante match exactement avec le href du bouton
@@ -147,14 +149,21 @@ export declare class Button extends Button_base {
147
149
  */
148
150
  pushState: boolean;
149
151
  active: boolean;
152
+ autoRepeat: boolean;
153
+ ariaControls?: string;
154
+ sonicAriaExpanded?: boolean;
150
155
  handleNavigation(e: Event): void;
151
156
  handleChange(e?: Event): void;
157
+ pointerDownTime: number;
158
+ lastRepeatTime: number;
159
+ isRepeating: boolean;
160
+ handleRepeatStart(e: Event): void;
161
+ handleRepeatend: () => void;
162
+ repeat(): void;
152
163
  connectedCallback(): void;
153
164
  setCheckedValue(checked: true | null): void;
154
165
  disconnectedCallback(): void;
155
- private _location;
156
- set location(value: string);
157
- get location(): string;
166
+ location: string;
158
167
  willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
159
168
  render(): import("lit-html").TemplateResult<1>;
160
169
  onSlotChange(): void;
@@ -58,6 +58,7 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
58
58
  * Si un bouton n'a qu'une icone pour contenu, agrandi l'icone pour des raisons d'équilibre
59
59
  */
60
60
  this.icon = false;
61
+ this.download = null;
61
62
  /**
62
63
  * mode d'activation du bouton :
63
64
  * - strict : l'url courante match exactement avec le href du bouton
@@ -82,7 +83,18 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
82
83
  */
83
84
  this.pushState = false;
84
85
  this.active = false;
85
- this._location = "";
86
+ this.autoRepeat = false;
87
+ this.pointerDownTime = 0;
88
+ this.lastRepeatTime = 0;
89
+ this.isRepeating = false;
90
+ this.handleRepeatend = () => {
91
+ window.removeEventListener("pointerup", this.handleRepeatend);
92
+ window.removeEventListener("blur", this.handleRepeatend);
93
+ if (this.autoRepeat) {
94
+ this.isRepeating = false;
95
+ }
96
+ };
97
+ this.location = "";
86
98
  }
87
99
  set href(value) {
88
100
  this._href = value;
@@ -101,6 +113,8 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
101
113
  LocationHandler.changeFromComponent(this);
102
114
  }
103
115
  handleChange(e) {
116
+ if (e?.type == "click" && this.autoRepeat)
117
+ return;
104
118
  super.handleChange();
105
119
  if (this.pushState || this.goBack !== null) {
106
120
  e?.preventDefault();
@@ -117,6 +131,31 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
117
131
  formPublisher.set({});
118
132
  }
119
133
  }
134
+ handleRepeatStart(e) {
135
+ if (this.autoRepeat) {
136
+ this.handleChange(e);
137
+ this.pointerDownTime = Date.now();
138
+ this.isRepeating = true;
139
+ this.repeat();
140
+ }
141
+ window.addEventListener("pointerup", this.handleRepeatend);
142
+ window.addEventListener("blur", this.handleRepeatend);
143
+ }
144
+ repeat() {
145
+ if (!this.isRepeating)
146
+ return;
147
+ if (this.hasAttribute("disabled")) {
148
+ this.isRepeating = false;
149
+ return;
150
+ }
151
+ window.requestAnimationFrame(this.repeat.bind(this));
152
+ if (Date.now() - this.pointerDownTime < 500)
153
+ return;
154
+ if (Date.now() - this.lastRepeatTime < 100)
155
+ return;
156
+ this.handleChange();
157
+ this.lastRepeatTime = Date.now();
158
+ }
120
159
  connectedCallback() {
121
160
  super.connectedCallback();
122
161
  }
@@ -135,19 +174,13 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
135
174
  LocationHandler.offChange(this);
136
175
  super.disconnectedCallback();
137
176
  }
138
- set location(value) {
139
- if (typeof value !== "string")
140
- return;
141
- this._location = value;
142
- LocationHandler.updateComponentActiveState(this);
143
- }
144
- get location() {
145
- return this._location;
146
- }
147
177
  willUpdate(changedProperties) {
148
178
  if (changedProperties.has("href") || changedProperties.has("autoActive")) {
149
179
  LocationHandler.updateComponentActiveState(this);
150
180
  }
181
+ if (changedProperties.has("location")) {
182
+ LocationHandler.updateComponentActiveState(this);
183
+ }
151
184
  }
152
185
  render() {
153
186
  const btnStyles = {
@@ -162,9 +195,12 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
162
195
  part="button"
163
196
  class=${this.hasPrefix || this.hasSuffix ? "has-prefix-or-suffix" : ""}
164
197
  style=${styleMap(btnStyles)}
198
+ aria-controls=${ifDefined(this.ariaControls)}
199
+ aria-expanded=${ifDefined(this.sonicAriaExpanded)}
165
200
  aria-label=${ifDefined(this.ariaLabel)}
166
201
  aria-labelledby=${ifDefined(this.ariaLabelledby)}
167
202
  @click=${this.handleChange}
203
+ @pointerdown=${this.handleRepeatStart}
168
204
  >
169
205
  <slot @slotchange=${this.onSlotChange} part="prefix" name="prefix"></slot>
170
206
  <slot part="main" class="main-slot"></slot>
@@ -175,6 +211,7 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
175
211
  return this.href
176
212
  ? html `<a
177
213
  href="${this.href}"
214
+ download=${ifDefined(this.download)}
178
215
  target=${ifDefined(this.target)}
179
216
  aria-label=${ifDefined(this.ariaLabel)}
180
217
  aria-labelledby=${ifDefined(this.ariaLabelledby)}
@@ -201,6 +238,7 @@ Button.styles = [
201
238
  --sc-btn-fs: var(--sc-fs, 1rem);
202
239
  --sc-btn-fw: var(--sc-btn-font-weight);
203
240
  --sc-btn-ff: var(--sc-btn-font-family);
241
+ --sc-btn-fw: var(--sc-btn-font-weight);
204
242
 
205
243
  --sc-btn-height: var(--sc-form-height);
206
244
  --btn-color: var(--sc-btn-color, var(--sc-base-content));
@@ -364,8 +402,8 @@ Button.styles = [
364
402
  }
365
403
 
366
404
  :host([variant="outline"][type="default"]) button {
367
- border-color: var(--sc-base-400);
368
- color: var(--sc-base-500);
405
+ border-color: var(--sc-base-content);
406
+ color: var(--sc-base-content);
369
407
  background: transparent;
370
408
  }
371
409
 
@@ -407,10 +445,22 @@ Button.styles = [
407
445
  text-decoration: none;
408
446
  }
409
447
 
448
+ /* Alignement */
449
+ :host([align="left"]) button {
450
+ text-align: left !important;
451
+ }
452
+
453
+ :host([align="right"]) button {
454
+ text-align: right;
455
+ }
456
+
410
457
  /*SHAPE*/
411
458
  :host([shape="circle"]) button {
412
459
  border-radius: 50%;
413
460
  }
461
+ :host([shape="circle"]) .main-slot {
462
+ line-height: 1;
463
+ }
414
464
 
415
465
  :host([shape="circle"]) button,
416
466
  :host([shape="square"]) button {
@@ -442,20 +492,12 @@ Button.styles = [
442
492
  border-color: var(--sc-btn-active-bg);
443
493
  }
444
494
 
445
- :host([align="left"]) button {
446
- text-align: left;
447
- }
448
-
449
- :host([align="right"]) button {
450
- text-align: right;
451
- }
452
-
453
495
  .main-slot {
454
496
  flex-grow: 1;
455
497
  display: block;
456
498
  }
457
499
 
458
- :host([minWidth]) .main-slot {
500
+ :host([minWidth]:not([shape="block"])) .main-slot {
459
501
  flex-grow: 0;
460
502
  }
461
503
 
@@ -473,6 +515,7 @@ Button.styles = [
473
515
  }
474
516
 
475
517
  /*BOUTON Avec icone seulement*/
518
+ :host([icon]) ::slotted(:only-child),
476
519
  :host([icon]) ::slotted(sonic-icon) {
477
520
  font-size: 1.2em;
478
521
  vertical-align: middle;
@@ -559,6 +602,9 @@ __decorate([
559
602
  __decorate([
560
603
  property({ type: Boolean, reflect: true })
561
604
  ], Button.prototype, "icon", void 0);
605
+ __decorate([
606
+ property({ type: String })
607
+ ], Button.prototype, "download", void 0);
562
608
  __decorate([
563
609
  property({ type: String })
564
610
  ], Button.prototype, "autoActive", void 0);
@@ -592,9 +638,18 @@ __decorate([
592
638
  __decorate([
593
639
  property({ type: Boolean, reflect: true })
594
640
  ], Button.prototype, "active", void 0);
641
+ __decorate([
642
+ property({ type: Boolean, reflect: true })
643
+ ], Button.prototype, "autoRepeat", void 0);
644
+ __decorate([
645
+ property({ type: String, attribute: "data-aria-controls" })
646
+ ], Button.prototype, "ariaControls", void 0);
647
+ __decorate([
648
+ property({ type: Boolean, attribute: "data-aria-expanded" })
649
+ ], Button.prototype, "sonicAriaExpanded", void 0);
595
650
  __decorate([
596
651
  state()
597
- ], Button.prototype, "location", null);
652
+ ], Button.prototype, "location", void 0);
598
653
  Button = __decorate([
599
654
  customElement(tagName)
600
655
  ], Button);
@@ -1,7 +1,5 @@
1
1
  import { LitElement } from "lit";
2
- type AssignListener = {
3
- onAssign: (listener: (value: string) => void) => void;
4
- };
2
+ import Publisher from "@supersoniks/concorde/core/utils/PublisherProxy";
5
3
  declare const Captcha_base: (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface<import("@supersoniks/concorde/core/_types/types").CoreJSType>) & typeof LitElement;
6
4
  /**
7
5
  * 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.
@@ -12,9 +10,10 @@ declare const Captcha_base: (new (...args: any[]) => import("../../../mixins/Sub
12
10
  export declare class Captcha extends Captcha_base {
13
11
  key: string;
14
12
  action: string | null;
13
+ zIndex: number;
15
14
  formPublisher?: {
16
15
  needsCaptchaValidation: boolean;
17
- captchaToken: string | AssignListener;
16
+ captchaToken: Publisher<string> | string;
18
17
  captchaMethod?: {
19
18
  get: () => string;
20
19
  };
@@ -22,7 +21,9 @@ export declare class Captcha extends Captcha_base {
22
21
  get: () => string;
23
22
  };
24
23
  };
24
+ onCaptchaTokenChanged: (v: string) => void;
25
25
  connectedCallback(): void;
26
+ disconnectedCallback(): void;
26
27
  requestToken(): void;
27
28
  protected render(): import("lit-html").TemplateResult<1>;
28
29
  }
@@ -20,22 +20,43 @@ let Captcha = class Captcha extends Subscriber(LitElement) {
20
20
  super(...arguments);
21
21
  this.key = "";
22
22
  this.action = null;
23
+ this.zIndex = 9999;
24
+ this.onCaptchaTokenChanged = (v) => {
25
+ if (v == "request_token") {
26
+ if (this.formPublisher)
27
+ this.formPublisher.captchaToken = "";
28
+ this.requestToken();
29
+ }
30
+ };
23
31
  }
24
32
  connectedCallback() {
25
- const script = document.createElement("script");
26
- script.src = "https://www.google.com/recaptcha/api.js?render=" + this.key;
27
- document.head.appendChild(script);
33
+ //verifier que le script n'est pas déjà chargé
34
+ if (!document.getElementById("captcha-" + this.key)) {
35
+ const script = document.createElement("script");
36
+ script.src = "https://www.google.com/recaptcha/api.js?render=" + this.key;
37
+ script.id = "captcha-" + this.key;
38
+ document.head.appendChild(script);
39
+ }
28
40
  super.connectedCallback();
29
41
  this.formPublisher = PublisherManager.get(this.getAncestorAttributeValue("headersDataProvider") ?? this.getAncestorAttributeValue("formDataProvider"));
30
- if (this.formPublisher) {
42
+ // add css to document to force z-index
43
+ if (!document.getElementById("concorde-recaptcha-css")) {
44
+ const style = document.createElement("style");
45
+ style.innerHTML = ".grecaptcha-badge {z-index: 9999;}";
46
+ style.id = "concorde-recaptcha-css";
47
+ document.head.appendChild(style);
48
+ }
49
+ if (this.formPublisher && !this.formPublisher.captchaToken.get()) {
31
50
  this.formPublisher.needsCaptchaValidation = true;
32
- this.formPublisher.captchaToken.onAssign((v) => {
33
- if (v == "request_token") {
34
- this.requestToken();
35
- }
36
- });
51
+ this.formPublisher.captchaToken.onAssign(this.onCaptchaTokenChanged);
37
52
  }
38
53
  }
54
+ disconnectedCallback() {
55
+ if (this.formPublisher) {
56
+ this.formPublisher.captchaToken.offAssign(this.onCaptchaTokenChanged);
57
+ }
58
+ super.disconnectedCallback();
59
+ }
39
60
  requestToken() {
40
61
  if (!this.formPublisher)
41
62
  return;
@@ -63,6 +84,9 @@ __decorate([
63
84
  __decorate([
64
85
  property()
65
86
  ], Captcha.prototype, "action", void 0);
87
+ __decorate([
88
+ property({ type: Number })
89
+ ], Captcha.prototype, "zIndex", void 0);
66
90
  Captcha = __decorate([
67
91
  customElement(tagName)
68
92
  ], Captcha);
@@ -8,6 +8,8 @@ export declare class Divider extends LitElement {
8
8
  align: "left" | "right" | "center";
9
9
  vertical: boolean;
10
10
  noMargin: boolean;
11
+ dashed: boolean;
12
+ dotted: boolean;
11
13
  firstUpdated(changedProperties: Map<string | number | symbol, unknown>): void;
12
14
  render(): import("lit-html").TemplateResult<1>;
13
15
  }