@supersoniks/concorde 1.1.27 → 1.1.28

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.
@@ -18,7 +18,7 @@ declare const Button_base: {
18
18
  getFormPublisher(): any;
19
19
  updateDataValue(): void;
20
20
  error: true | null;
21
- autofocus: true | null;
21
+ autofocus: boolean;
22
22
  disabled: true | null;
23
23
  required: true | null;
24
24
  formDataProvider: string;
@@ -19,7 +19,7 @@ declare const Checkbox_base: {
19
19
  getFormPublisher(): any;
20
20
  updateDataValue(): void;
21
21
  error: true | null;
22
- autofocus: true | null;
22
+ autofocus: boolean;
23
23
  disabled: true | null;
24
24
  required: true | null;
25
25
  formDataProvider: string;
@@ -56,7 +56,7 @@ declare const Checkbox_base: {
56
56
  handleChange(e?: any): void;
57
57
  getValueForFormPublisher(): any;
58
58
  error: true | null;
59
- autofocus: true | null;
59
+ autofocus: boolean;
60
60
  disabled: true | null;
61
61
  required: true | null;
62
62
  formDataProvider: string;
@@ -62,7 +62,7 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
62
62
  .checked=${ifDefined(this.checked)}
63
63
  .name=${this.name}
64
64
  .value=${this.value}
65
- autofocus=${ifDefined(this.autofocus)}
65
+ ?autofocus=${this.autofocus}
66
66
 
67
67
  />
68
68
  <sonic-icon
@@ -73,7 +73,7 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
73
73
  <slot></slot>
74
74
  <slot name="description" class="${this.hasDescription ? "description" : "hidden"} ">
75
75
  ${this.description ? html `${this.description}` : ""}
76
- <slot>
76
+ </slot>
77
77
  </div>
78
78
  </label>
79
79
  `;
@@ -10,7 +10,7 @@ declare const Input_base: {
10
10
  handleChange(e?: any): void;
11
11
  getValueForFormPublisher(): any;
12
12
  error: true | null;
13
- autofocus: true | null;
13
+ autofocus: boolean;
14
14
  disabled: true | null;
15
15
  required: true | null;
16
16
  formDataProvider: string;
@@ -10,7 +10,7 @@ declare const Textarea_base: {
10
10
  handleChange(e?: any): void;
11
11
  getValueForFormPublisher(): any;
12
12
  error: true | null;
13
- autofocus: true | null;
13
+ autofocus: boolean;
14
14
  disabled: true | null;
15
15
  required: true | null;
16
16
  formDataProvider: string;
@@ -95,6 +95,10 @@ Icons.fontAwesomeNext = {
95
95
  if (!loadingGetPromises.has(url)) {
96
96
  let promise = new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
97
97
  let result = yield fetch(url);
98
+ if (!result.ok) {
99
+ resolve(`<b title="Erreur ${result.status}">😶</b>`);
100
+ return;
101
+ }
98
102
  try {
99
103
  let text = yield result.text();
100
104
  resolve(text);
@@ -1 +1 @@
1
- {}
1
+ { "core": { "cancel": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6.75827 17.2426L12.0009 12M17.2435 6.75736L12.0009 12M12.0009 12L6.75827 6.75736M12.0009 12L17.2435 17.2426\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "check-circled-outline": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7 12.5L10 15.5L17 8.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "check": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5 13L9 17L19 7\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "emoji-puzzled": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"24px\" height=\"24px\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" color=\"#000000\"><path d=\"M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"M11.5 15.5s1.5-2 4.5-2 4.5 2 4.5 2M3 4c0-2.754 4-2.754 4 0 0 1.967-2 1.64-2 4M5 11.01l.01-.011\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"M17.5 9a.5.5 0 110-1 .5.5 0 010 1zM10.5 9a.5.5 0 110-1 .5.5 0 010 1z\" fill=\"#000\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></svg>", "info-empty": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 11.5V16.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7.51L12.01 7.49889\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "loader": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-loader\"><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"6\"></line><line x1=\"12\" y1=\"18\" x2=\"12\" y2=\"22\"></line><line x1=\"4.93\" y1=\"4.93\" x2=\"7.76\" y2=\"7.76\"></line><line x1=\"16.24\" y1=\"16.24\" x2=\"19.07\" y2=\"19.07\"></line><line x1=\"2\" y1=\"12\" x2=\"6\" y2=\"12\"></line><line x1=\"18\" y1=\"12\" x2=\"22\" y2=\"12\"></line><line x1=\"4.93\" y1=\"19.07\" x2=\"7.76\" y2=\"16.24\"></line><line x1=\"16.24\" y1=\"7.76\" x2=\"19.07\" y2=\"4.93\"></line></svg>", "more-horiz": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18 12.5C18.2761 12.5 18.5 12.2761 18.5 12C18.5 11.7239 18.2761 11.5 18 11.5C17.7239 11.5 17.5 11.7239 17.5 12C17.5 12.2761 17.7239 12.5 18 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M6 12.5C6.27614 12.5 6.5 12.2761 6.5 12C6.5 11.7239 6.27614 11.5 6 11.5C5.72386 11.5 5.5 11.7239 5.5 12C5.5 12.2761 5.72386 12.5 6 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "more-vert": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 18.5C12.2761 18.5 12.5 18.2761 12.5 18C12.5 17.7239 12.2761 17.5 12 17.5C11.7239 17.5 11.5 17.7239 11.5 18C11.5 18.2761 11.7239 18.5 12 18.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 6.5C12.2761 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.2761 5.5 12 5.5C11.7239 5.5 11.5 5.72386 11.5 6C11.5 6.27614 11.7239 6.5 12 6.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "nav-arrow-down": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6 9L12 15L18 9\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "warning-circled-outline": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 7L12 13\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 17.01L12.01 16.9989\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n" } }
@@ -4,10 +4,12 @@ import { ToastStatus } from "@supersoniks/concorde/core/components/ui/toast/type
4
4
  export declare class SonicToastItem extends LitElement {
5
5
  static styles: import("lit").CSSResult[];
6
6
  title: string;
7
+ id: string;
7
8
  text: string;
8
9
  status: ToastStatus;
9
10
  ghost: boolean;
10
11
  preserve: boolean;
12
+ dismissForever: boolean;
11
13
  maxHeight: string;
12
14
  visible: boolean;
13
15
  render(): import("lit-html").TemplateResult<1> | typeof nothing;
@@ -20,14 +20,24 @@ let SonicToastItem = class SonicToastItem extends LitElement {
20
20
  constructor() {
21
21
  super(...arguments);
22
22
  this.title = "";
23
+ this.id = "";
23
24
  this.text = "";
24
25
  this.status = "";
25
26
  this.ghost = false;
26
27
  this.preserve = false;
28
+ this.dismissForever = false;
27
29
  this.maxHeight = '10rem';
28
30
  this.visible = true;
29
31
  }
30
32
  render() {
33
+ // check if the toast is dismissed
34
+ if (this.dismissForever) {
35
+ const dismissed = localStorage.getItem('sonic-toast-dismissed') || '{}';
36
+ const dismissedObj = JSON.parse(dismissed);
37
+ if (dismissedObj[this.id]) {
38
+ return nothing;
39
+ }
40
+ }
31
41
  if (!this.visible) {
32
42
  return nothing;
33
43
  }
@@ -58,6 +68,13 @@ let SonicToastItem = class SonicToastItem extends LitElement {
58
68
  if (!this.closest('sonic-toast')) {
59
69
  this.visible = false;
60
70
  }
71
+ if (this.dismissForever) {
72
+ // set in local Storage an Object with the id as key and if it's dismissed as value
73
+ const dismissed = localStorage.getItem('sonic-toast-dismissed') || '{}';
74
+ const dismissedObj = JSON.parse(dismissed);
75
+ dismissedObj[this.id] = true;
76
+ localStorage.setItem('sonic-toast-dismissed', JSON.stringify(dismissedObj));
77
+ }
61
78
  this.dispatchEvent(new CustomEvent("hide", { bubbles: true }));
62
79
  }
63
80
  show() {
@@ -239,6 +256,9 @@ SonicToastItem.styles = [
239
256
  __decorate([
240
257
  property({ type: String })
241
258
  ], SonicToastItem.prototype, "title", void 0);
259
+ __decorate([
260
+ property({ type: String })
261
+ ], SonicToastItem.prototype, "id", void 0);
242
262
  __decorate([
243
263
  property({ type: String })
244
264
  ], SonicToastItem.prototype, "text", void 0);
@@ -251,6 +271,9 @@ __decorate([
251
271
  __decorate([
252
272
  property({ type: Boolean })
253
273
  ], SonicToastItem.prototype, "preserve", void 0);
274
+ __decorate([
275
+ property({ type: Boolean })
276
+ ], SonicToastItem.prototype, "dismissForever", void 0);
254
277
  __decorate([
255
278
  property({ type: String })
256
279
  ], SonicToastItem.prototype, "maxHeight", void 0);
@@ -14,6 +14,7 @@ export declare class SonicToast extends LitElement {
14
14
  status: import("@supersoniks/concorde/core/components/ui/toast/types").ToastStatus | undefined;
15
15
  preserve: boolean | undefined;
16
16
  ghost: boolean | undefined;
17
+ dismissForever: boolean | undefined;
17
18
  } | null;
18
19
  removeItem(item: Toast): void;
19
20
  }
@@ -38,7 +38,11 @@ let SonicToast = class SonicToast extends LitElement {
38
38
  return nothing;
39
39
  return html `<div aria-live="polite" style=${styleMap(styles)}>
40
40
  ${repeat(this.toasts, (item) => item.id, (item) => html `
41
- <sonic-toast-item maxHeight=${isIframe ? 'none' : '10rem'} status=${item.status} ?ghost=${item.ghost} ?preserve=${item.preserve} id=${item.id}
41
+ <sonic-toast-item maxHeight=${isIframe ? 'none' : '10rem'}
42
+ status=${item.status}
43
+ ?ghost=${item.ghost}
44
+ ?dismissForever=${item.dismissForever}
45
+ ?preserve=${item.preserve} id=${item.id}
42
46
  @hide=${() => this.removeItem(item)}
43
47
  ${animate({
44
48
  keyframeOptions: {
@@ -70,6 +74,7 @@ let SonicToast = class SonicToast extends LitElement {
70
74
  }
71
75
  // ADD TOAST
72
76
  static add(conf) {
77
+ var _a;
73
78
  // Init toast area si absente (au <sonic-theme> ou <body< à défaut)
74
79
  if (!document.querySelector("sonic-toast")) {
75
80
  let toastComponent = document.createElement("sonic-toast");
@@ -78,7 +83,7 @@ let SonicToast = class SonicToast extends LitElement {
78
83
  }
79
84
  // Ajoute le toast à la liste
80
85
  let toastComponent = document.querySelector("sonic-toast");
81
- const nextId = new Date().valueOf();
86
+ const nextId = (_a = conf.id) !== null && _a !== void 0 ? _a : new Date().valueOf();
82
87
  const interactiveRegExp = new RegExp("</a>|</button>");
83
88
  const hasInteractive = interactiveRegExp.test(conf.text);
84
89
  const currentToast = {
@@ -88,7 +93,16 @@ let SonicToast = class SonicToast extends LitElement {
88
93
  status: conf.status,
89
94
  preserve: hasInteractive ? true : conf.preserve,
90
95
  ghost: conf.ghost,
96
+ dismissForever: conf.dismissForever,
91
97
  };
98
+ // check if the toast is dismissed
99
+ if (conf.dismissForever && conf.id) {
100
+ const dismissed = localStorage.getItem('sonic-toast-dismissed') || '{}';
101
+ const dismissedObj = JSON.parse(dismissed);
102
+ if (dismissedObj[conf.id]) {
103
+ return null;
104
+ }
105
+ }
92
106
  if (toastComponent.toasts.length > 0) {
93
107
  let toastA = Object.assign({}, currentToast);
94
108
  let toastB = Object.assign({}, toastComponent.toasts[toastComponent.toasts.length - 1]);
@@ -6,4 +6,5 @@ export declare type Toast = {
6
6
  status?: ToastStatus;
7
7
  preserve?: boolean;
8
8
  ghost?: boolean;
9
+ dismissForever?: boolean;
9
10
  };
@@ -43,7 +43,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
43
43
  getFormPublisher(): any;
44
44
  updateDataValue(): void;
45
45
  error: true | null;
46
- autofocus: true | null;
46
+ autofocus: boolean;
47
47
  disabled: true | null;
48
48
  required: true | null;
49
49
  formDataProvider: string;
@@ -97,10 +97,10 @@ const Form = (superClass) => {
97
97
  */
98
98
  getValueForFormPublisher() {
99
99
  let publisher = this.getFormPublisher();
100
- let currentValue = publisher[this.name].get();
101
100
  if (this.unique || this.radio) {
102
- return this.checked && this.value != null ? this.value : currentValue;
101
+ return this.checked && this.value != null ? this.value : null;
103
102
  }
103
+ let currentValue = publisher[this.name].get();
104
104
  if (!Array.isArray(currentValue)) {
105
105
  currentValue = [];
106
106
  }
@@ -6,7 +6,7 @@ export interface FormElementInterface extends SubscriberInterface {
6
6
  handleChange(e?: any): void;
7
7
  getValueForFormPublisher(): any;
8
8
  error: true | null;
9
- autofocus: true | null;
9
+ autofocus: boolean;
10
10
  disabled: true | null;
11
11
  required: true | null;
12
12
  formDataProvider: string;
@@ -22,7 +22,7 @@ const Form = (superClass) => {
22
22
  super();
23
23
  this.touched = false;
24
24
  this.error = null;
25
- this.autofocus = null;
25
+ this.autofocus = false;
26
26
  this.disabled = null;
27
27
  this.required = null;
28
28
  this.onValueAssign = null;
@@ -15,7 +15,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
15
15
  handleChange(e?: any): void;
16
16
  getValueForFormPublisher(): any;
17
17
  error: true | null;
18
- autofocus: true | null;
18
+ autofocus: boolean;
19
19
  disabled: true | null;
20
20
  required: true | null;
21
21
  formDataProvider: string;
package/mixins.d.ts CHANGED
@@ -56,7 +56,7 @@ export declare const FormCheckable: <T extends new (...args: any[]) => myFormEle
56
56
  getFormPublisher(): any;
57
57
  updateDataValue(): void;
58
58
  error: true | null;
59
- autofocus: true | null;
59
+ autofocus: boolean;
60
60
  disabled: true | null;
61
61
  required: true | null;
62
62
  formDataProvider: string;
@@ -96,7 +96,7 @@ export declare const FormInput: <T extends new (...args: any[]) => myFormElement
96
96
  handleChange(e?: any): void;
97
97
  getValueForFormPublisher(): any;
98
98
  error: true | null;
99
- autofocus: true | null;
99
+ autofocus: boolean;
100
100
  disabled: true | null;
101
101
  required: true | null;
102
102
  formDataProvider: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "1.1.27",
3
+ "version": "1.1.28",
4
4
  "customElements": "custom-elements.json",
5
5
  "license": "MIT",
6
6
  "publishConfig": {