@supersoniks/concorde 1.1.45 → 1.1.46

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 (44) hide show
  1. package/concorde-core.bundle.js +39 -24
  2. package/concorde-core.es.js +701 -231
  3. package/core/components/functional/fetch/fetch.d.ts +2 -1
  4. package/core/components/functional/list/list.d.ts +3 -1
  5. package/core/components/functional/list/list.js +3 -1
  6. package/core/components/functional/queue/queue.d.ts +8 -1
  7. package/core/components/functional/queue/queue.js +126 -62
  8. package/core/components/functional/sdui/sdui.d.ts +2 -1
  9. package/core/components/ui/alert/alert.d.ts +3 -0
  10. package/core/components/ui/alert/alert.js +33 -1
  11. package/core/components/ui/badge/badge.d.ts +1 -1
  12. package/core/components/ui/badge/badge.js +9 -3
  13. package/core/components/ui/button/button.d.ts +1 -0
  14. package/core/components/ui/form/checkbox/checkbox.d.ts +3 -0
  15. package/core/components/ui/form/checkbox/checkbox.js +14 -3
  16. package/core/components/ui/form/css/form-control.d.ts +1 -0
  17. package/core/components/ui/form/css/form-control.js +17 -0
  18. package/core/components/ui/form/input/input.d.ts +5 -3
  19. package/core/components/ui/form/input/input.js +47 -3
  20. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +93 -13
  21. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +181 -52
  22. package/core/components/ui/form/textarea/textarea.d.ts +1 -0
  23. package/core/components/ui/icon/icon.js +1 -1
  24. package/core/components/ui/modal/modal-close.js +2 -3
  25. package/core/components/ui/modal/modal-content.js +1 -0
  26. package/core/components/ui/modal/modal.d.ts +8 -0
  27. package/core/components/ui/modal/modal.js +34 -6
  28. package/core/components/ui/pop/pop.js +18 -7
  29. package/core/components/ui/theme/theme-collection/core-variables.js +18 -9
  30. package/core/components/ui/theme/theme.js +8 -3
  31. package/core/mixins/Fetcher.d.ts +2 -1
  32. package/core/mixins/Fetcher.js +42 -10
  33. package/core/mixins/FormCheckable.d.ts +1 -0
  34. package/core/mixins/FormElement.d.ts +1 -0
  35. package/core/mixins/FormElement.js +6 -2
  36. package/core/mixins/FormInput.d.ts +1 -0
  37. package/core/mixins/Subscriber.d.ts +1 -0
  38. package/core/mixins/Subscriber.js +12 -7
  39. package/core/utils/PublisherProxy.d.ts +30 -3
  40. package/core/utils/PublisherProxy.js +218 -6
  41. package/core/utils/api.d.ts +3 -0
  42. package/core/utils/api.js +3 -1
  43. package/mixins.d.ts +4 -1
  44. package/package.json +5 -1
@@ -41,6 +41,7 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
41
41
  this.touched = false;
42
42
  this.iconName = "check";
43
43
  this.indeterminateIconName = "minus-small";
44
+ this.showAsIndeterminate = false;
44
45
  this.hasDescription = false;
45
46
  this.hasLabel = false;
46
47
  }
@@ -56,7 +57,8 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
56
57
  hasSlotOrProps() {
57
58
  var _a, _b;
58
59
  this.hasLabel = this.label || ((_a = this.slotLabelNodes) === null || _a === void 0 ? void 0 : _a.length) ? true : false;
59
- this.hasDescription = this.description || ((_b = this.slotDescriptionNodes) === null || _b === void 0 ? void 0 : _b.length) ? true : false;
60
+ this.hasDescription =
61
+ this.description || ((_b = this.slotDescriptionNodes) === null || _b === void 0 ? void 0 : _b.length) ? true : false;
60
62
  }
61
63
  render() {
62
64
  //let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
@@ -69,6 +71,7 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
69
71
  @click=${this.handleChange}
70
72
  @blur=${this.handleBlur}
71
73
  ?required=${this.required}
74
+ ?data-indeterminate=${this.showAsIndeterminate}
72
75
  .disabled=${ifDefined(this.disabled)}
73
76
  .checked=${ifDefined(this.checked)}
74
77
  .name=${this.name}
@@ -77,7 +80,9 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
77
80
  aria-label=${ifDefined(this.ariaLabel)}
78
81
  aria-labelledby=${ifDefined(this.ariaLabelledby)}
79
82
  />
80
- <sonic-icon name="${this.checked == "indeterminate" ? this.indeterminateIconName : this.iconName}" class="sc-input-icon"></sonic-icon>
83
+ <sonic-icon name="${this.checked == "indeterminate" || this.showAsIndeterminate
84
+ ? this.indeterminateIconName
85
+ : this.iconName}" class="sc-input-icon"></sonic-icon>
81
86
  </span>
82
87
 
83
88
  <div class="checkbox-text ${!this.hasDescription && !this.hasLabel ? "hidden" : "checkbox-text"}">
@@ -134,7 +139,8 @@ Checkbox.styles = [
134
139
  outline: none;
135
140
  margin: 0;
136
141
  background-color: var(--sc-checkbox-bg);
137
- border: var(--sc-checkbox-border-width) solid var(--sc-checkbox-border-color);
142
+ border: var(--sc-checkbox-border-width) solid
143
+ var(--sc-checkbox-border-color);
138
144
  }
139
145
 
140
146
  input:focus,
@@ -169,11 +175,13 @@ Checkbox.styles = [
169
175
 
170
176
  /*Active */
171
177
  input:checked,
178
+ input[data-indeterminate],
172
179
  input[checked] {
173
180
  --sc-checkbox-border-color: var(--sc-primary);
174
181
  --sc-checkbox-bg: var(--sc-primary);
175
182
  }
176
183
  input:checked + sonic-icon,
184
+ input[data-indeterminate] + sonic-icon,
177
185
  input[checked] + sonic-icon {
178
186
  --sc-checkbox-color: var(--sc-primary-content);
179
187
  transform: translateX(-50%) translateY(-50%) scale(1);
@@ -228,6 +236,9 @@ __decorate([
228
236
  __decorate([
229
237
  property({ type: String })
230
238
  ], Checkbox.prototype, "indeterminateIconName", void 0);
239
+ __decorate([
240
+ property({ type: Boolean })
241
+ ], Checkbox.prototype, "showAsIndeterminate", void 0);
231
242
  __decorate([
232
243
  property({ type: Boolean })
233
244
  ], Checkbox.prototype, "hasDescription", void 0);
@@ -1,3 +1,4 @@
1
+ export declare const passwordToggle: import("lit").CSSResult;
1
2
  export declare const label: import("lit").CSSResult;
2
3
  export declare const description: import("lit").CSSResult;
3
4
  export declare const formControl: import("lit").CSSResult;
@@ -1,4 +1,16 @@
1
1
  import { css } from "lit";
2
+ export const passwordToggle = css `
3
+ .password-toggle {
4
+ color: var(--sc-input-c);
5
+ font-size: var(--sc-input-fs);
6
+ cursor: pointer;
7
+ margin-right: calc(-0.5 * var(--sc-input-px));
8
+ }
9
+
10
+ :host([inlineContent]) .has-suffix .password-toggle {
11
+ margin-right: 0;
12
+ }
13
+ `;
2
14
  export const label = css `
3
15
  :host {
4
16
  --sc-label-fs: var(--sc-fs, 1rem);
@@ -168,6 +180,11 @@ export const formControl = css `
168
180
  margin-left: auto;
169
181
  }
170
182
 
183
+ :host([inlineContent]) .no-suffix slot[name="suffix"],
184
+ :host([inlineContent]) .no-prefix slot[name="prefix"] {
185
+ display: none;
186
+ }
187
+
171
188
  /* :host([inlineContent]) .input {
172
189
 
173
190
  }*/
@@ -50,14 +50,12 @@ declare const Input_base: {
50
50
  removeAttribute(name: string): void;
51
51
  initPublisher(): void;
52
52
  getApiConfiguration(): import("../../../../utils/api").APIConfiguration;
53
- /**
54
- * Taille du composant, implique notamment des modifications de typo et de marge interne
55
- */
56
53
  connectedCallback(): void;
57
54
  requestUpdate(): void;
58
55
  getAttribute(name: string): string;
59
56
  hasAttribute(attributeName: string): boolean;
60
57
  disconnectedCallback(): void;
58
+ getBoundingClientRect(): DOMRect;
61
59
  };
62
60
  } & (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;
63
61
  export declare class Input extends Input_base {
@@ -78,6 +76,7 @@ export declare class Input extends Input_base {
78
76
  src?: string;
79
77
  inlineContent: boolean;
80
78
  disableInlineContentFocus: boolean;
79
+ showPasswordToggle: boolean;
81
80
  slotLabelNodes: Array<Node>;
82
81
  slotDescriptionNodes: Array<Node>;
83
82
  slotSuffixNodes: Array<Node>;
@@ -87,15 +86,18 @@ export declare class Input extends Input_base {
87
86
  hasLabel: boolean;
88
87
  hasSuffix: boolean;
89
88
  hasPrefix: boolean;
89
+ isPassword: boolean;
90
90
  sameValueAsHandle?: (v: string) => void;
91
91
  sameValueAsName?: string;
92
92
  connectedCallback(): void;
93
93
  disconnectedCallback(): void;
94
94
  willUpdate(changedProperties: PropertyValues): void;
95
+ setSelectionRange(start: number, end: number): void;
95
96
  hasSlotOrProps(): void;
96
97
  inlineContentFocus(): void;
97
98
  changeTimeoutId?: ReturnType<typeof setTimeout>;
98
99
  handleChange(e?: Event): void;
100
+ togglePasswordVisibility(): void;
99
101
  render(): import("lit-html").TemplateResult<1>;
100
102
  }
101
103
  export {};
@@ -5,10 +5,10 @@ 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, queryAssignedNodes, state } from "lit/decorators.js";
8
+ import { customElement, property, queryAssignedNodes, state, } from "lit/decorators.js";
9
9
  import { query } from "lit/decorators/query.js";
10
10
  import { ifDefined } from "lit/directives/if-defined.js";
11
- import { formControl, label, description } from "@supersoniks/concorde/core/components/ui/form/css/form-control";
11
+ import { formControl, label, description, passwordToggle, } from "@supersoniks/concorde/core/components/ui/form/css/form-control";
12
12
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
13
13
  import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
14
14
  import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
@@ -32,10 +32,12 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
32
32
  this.readonly = false;
33
33
  this.inlineContent = false;
34
34
  this.disableInlineContentFocus = false;
35
+ this.showPasswordToggle = false;
35
36
  this.hasDescription = false;
36
37
  this.hasLabel = false;
37
38
  this.hasSuffix = false;
38
39
  this.hasPrefix = false;
40
+ this.isPassword = false;
39
41
  }
40
42
  connectedCallback() {
41
43
  super.connectedCallback();
@@ -48,6 +50,11 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
48
50
  return;
49
51
  formPublisher[this.sameValueAsName].onAssign(this.sameValueAsHandle);
50
52
  }
53
+ if (this.type == "password") {
54
+ this.isPassword = true;
55
+ this.showPasswordToggle = true;
56
+ this.inlineContent = true;
57
+ }
51
58
  }
52
59
  disconnectedCallback() {
53
60
  super.disconnectedCallback();
@@ -62,10 +69,14 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
62
69
  this.hasSlotOrProps();
63
70
  super.willUpdate(changedProperties);
64
71
  }
72
+ setSelectionRange(start, end) {
73
+ this.input.setSelectionRange(start, end);
74
+ }
65
75
  hasSlotOrProps() {
66
76
  var _a, _b, _c, _d;
67
77
  this.hasLabel = this.label || ((_a = this.slotLabelNodes) === null || _a === void 0 ? void 0 : _a.length) ? true : false;
68
- this.hasDescription = this.description || ((_b = this.slotDescriptionNodes) === null || _b === void 0 ? void 0 : _b.length) ? true : false;
78
+ this.hasDescription =
79
+ this.description || ((_b = this.slotDescriptionNodes) === null || _b === void 0 ? void 0 : _b.length) ? true : false;
69
80
  this.hasSuffix = ((_c = this.slotSuffixNodes) === null || _c === void 0 ? void 0 : _c.length) ? true : false;
70
81
  this.hasPrefix = ((_d = this.slotPrefixNodes) === null || _d === void 0 ? void 0 : _d.length) ? true : false;
71
82
  }
@@ -84,10 +95,19 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
84
95
  clearTimeout(this.changeTimeoutId);
85
96
  this.changeTimeoutId = setTimeout(() => super.handleChange(e), parseInt(this.getAttribute("inputDelayMs")));
86
97
  }
98
+ // toggle password visibility
99
+ togglePasswordVisibility() {
100
+ this.isPassword = !this.isPassword;
101
+ this._type = this.isPassword ? "password" : "text";
102
+ console.log(this.isPassword);
103
+ // this.type = this.isPassword ? "password" : "text";
104
+ }
87
105
  render() {
88
106
  const slotClasses = {
89
107
  "has-prefix": this.hasPrefix,
90
108
  "has-suffix": this.hasSuffix,
109
+ "no-suffix": !this.hasSuffix,
110
+ "no-prefix": !this.hasPrefix,
91
111
  };
92
112
  //let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
93
113
  return html `
@@ -128,6 +148,20 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
128
148
  .name=${this.name}
129
149
  .value=${this.value}
130
150
  />
151
+ ${this.showPasswordToggle
152
+ ? html `<sonic-button
153
+ shape="circle"
154
+ class="password-toggle"
155
+ @click=${this.togglePasswordVisibility}
156
+ aria-label="Toggle password visibility"
157
+ variant="unstyled"
158
+ >
159
+ <sonic-icon
160
+ library="heroicons"
161
+ name=${this.isPassword ? "eye" : "eye-slash"}
162
+ ></sonic-icon>
163
+ </sonic-button>`
164
+ : ""}
131
165
  <slot name="suffix" @slotchange=${this.hasSlotOrProps}></slot>
132
166
  </div>
133
167
  </div>
@@ -148,11 +182,15 @@ Input.styles = [
148
182
  formControl,
149
183
  label,
150
184
  description,
185
+ passwordToggle,
151
186
  css `
152
187
  :host([type="hidden"]) {
153
188
  appearance: none !important;
154
189
  display: none !important;
155
190
  }
191
+ :host > .form-control {
192
+ position: relative;
193
+ }
156
194
  `,
157
195
  ];
158
196
  __decorate([
@@ -194,6 +232,9 @@ __decorate([
194
232
  __decorate([
195
233
  property({ type: Boolean })
196
234
  ], Input.prototype, "disableInlineContentFocus", void 0);
235
+ __decorate([
236
+ property({ type: Boolean })
237
+ ], Input.prototype, "showPasswordToggle", void 0);
197
238
  __decorate([
198
239
  queryAssignedNodes({ slot: "label" })
199
240
  ], Input.prototype, "slotLabelNodes", void 0);
@@ -221,6 +262,9 @@ __decorate([
221
262
  __decorate([
222
263
  state()
223
264
  ], Input.prototype, "hasPrefix", void 0);
265
+ __decorate([
266
+ state()
267
+ ], Input.prototype, "isPassword", void 0);
224
268
  Input = __decorate([
225
269
  customElement(tagName)
226
270
  ], Input);
@@ -3,7 +3,67 @@ import "@supersoniks/concorde/core/components/ui/form/input/input";
3
3
  import "@supersoniks/concorde/core/components/ui/pop/pop";
4
4
  import "@supersoniks/concorde/core/components/functional/queue/queue";
5
5
  import "@supersoniks/concorde/core/components/ui/menu/menu-item";
6
- declare const InputAutocomplete_base: (new (...args: any[]) => import("../../../../mixins/TemplatesContainer").TemplatesContainerInterface) & (new (...args: any[]) => import("../../../../mixins/Subscriber").SubscriberInterface<import("../../../../_types/types").CoreJSType>) & typeof LitElement;
6
+ import { Size } from "../../_css/size";
7
+ type ListItem = Record<string, string>;
8
+ declare const InputAutocomplete_base: (new (...args: any[]) => import("../../../../mixins/TemplatesContainer").TemplatesContainerInterface) & {
9
+ new (...args: any[]): {
10
+ validateFormElement(): void;
11
+ forceAutoFill: boolean;
12
+ _type: "number" | "search" | "file" | "button" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local" | "password";
13
+ type: "number" | "search" | "file" | "button" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local" | "password";
14
+ _description?: string | undefined;
15
+ description: string | undefined;
16
+ _label?: string | undefined;
17
+ label: string | undefined;
18
+ tabindex?: number | undefined;
19
+ 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;
20
+ getFormPublisher(): any;
21
+ updateDataValue(): void;
22
+ handleChange(e?: Event | undefined): void;
23
+ handleBlur(e?: Event | undefined): void;
24
+ getValueForFormPublisher(): string | object | string[] | null | undefined;
25
+ focus?: (() => void) | undefined;
26
+ shadowRoot?: ShadowRoot | undefined;
27
+ error: boolean;
28
+ autofocus: boolean;
29
+ required: boolean;
30
+ disabled: true | null;
31
+ formDataProvider: string;
32
+ ariaLabelledby?: string | undefined;
33
+ ariaLabel?: string | undefined;
34
+ _value: string | object | string[] | null | undefined;
35
+ value: string | object | string[] | null | undefined;
36
+ _name: string;
37
+ name: string;
38
+ props: import("../../../../_types/types").CoreJSType;
39
+ propertyMap: object;
40
+ isConnected: boolean;
41
+ children: HTMLCollection;
42
+ appendChild(node: Node): Node;
43
+ getAncestorAttributeValue(attributeName: string): string;
44
+ hasAncestorAttribute(attributeName: string): boolean;
45
+ querySelectorAll(selector: string): NodeListOf<Element>;
46
+ publisher: any;
47
+ dataProvider: string | null;
48
+ noShadowDom: string | null;
49
+ debug: HTMLElement | null;
50
+ defferedDebug: boolean | null;
51
+ displayContents: boolean;
52
+ dispatchEvent(event: Event): void;
53
+ setAttribute(name: string, value: string): void;
54
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
55
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
56
+ removeAttribute(name: string): void;
57
+ initPublisher(): void;
58
+ getApiConfiguration(): import("../../../../utils/api").APIConfiguration;
59
+ connectedCallback(): void;
60
+ requestUpdate(): void;
61
+ getAttribute(name: string): string;
62
+ hasAttribute(attributeName: string): boolean;
63
+ disconnectedCallback(): void;
64
+ getBoundingClientRect(): DOMRect;
65
+ };
66
+ } & (new (...args: any[]) => import("../../../../mixins/FormElement").FormElementInterface) & (new (...args: any[]) => import("../../../../mixins/Subscriber").SubscriberInterface<import("../../../../_types/types").CoreJSType>) & typeof LitElement;
7
67
  /**
8
68
  * Input avec autocomplete. Propose des valeurs à partir d'un sonic-queue.
9
69
  * L'input permet de filtrer les choix de valeurs dans le sonic-pop.
@@ -11,24 +71,44 @@ declare const InputAutocomplete_base: (new (...args: any[]) => import("../../../
11
71
  */
12
72
  export declare class InputAutocomplete extends InputAutocomplete_base {
13
73
  static styles: import("lit").CSSResult[];
14
- _name: string;
15
- get name(): string;
16
- set name(value: string);
17
- forceAutoFill: boolean;
18
- _description?: string;
19
- get description(): string | undefined;
20
- set description(value: string | undefined);
21
- _label?: string;
22
- get label(): string | undefined;
23
- set label(value: string | undefined);
74
+ /**
75
+ * Possibles mutualisation avec text
76
+ */
77
+ size: Size;
24
78
  placeholder: string;
25
79
  filteredFields: string;
26
80
  readonly: boolean | null;
27
81
  dataProviderExpression: string;
82
+ select?: boolean;
28
83
  key: string;
29
- value: string;
84
+ searchParameter: string;
85
+ /**
86
+ * Les dataProviders
87
+ */
88
+ private searchDataProvider;
89
+ private initSearchDataProvider;
90
+ private queueDataProvider;
91
+ private initQueueDataProvider;
92
+ private lastValidSearch;
93
+ private searchPublisher?;
94
+ private countPublisher?;
95
+ private initCountPublisher?;
96
+ private formValuePublisher?;
97
+ /**
98
+ * Les fonctions de gestion
99
+ */
100
+ private updateSearchParameter;
101
+ private initSearchParameter;
102
+ private selectListItem;
103
+ private findSearchedItem;
104
+ private findSelection;
105
+ private setSearchFromSelection;
106
+ private updateActiveSelection;
30
107
  connectedCallback(): void;
31
- formDataProvider: string;
108
+ disconnectedCallback(): void;
109
+ queryQueueListItem(queueDataProvider: string, itemFinder: (listItem: ListItem) => boolean, itemMutator: (listItem: ListItem) => void): void;
110
+ setSelectionRange(start: number, end: number): void;
111
+ handleHide(): void;
32
112
  render(): import("lit-html").TemplateResult<1>;
33
113
  }
34
114
  export {};