@supersoniks/concorde 1.1.42 → 1.1.44

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 (189) hide show
  1. package/components.js +2 -3
  2. package/concorde-core.bundle.js +37 -35
  3. package/concorde-core.es.js +5283 -4453
  4. package/core/_types/types.d.ts +31 -0
  5. package/core/_types/types.js +2 -0
  6. package/core/components/functional/date/date.d.ts +13 -5
  7. package/core/components/functional/date/date.js +57 -38
  8. package/core/components/functional/example/example.d.ts +1 -1
  9. package/core/components/functional/example/example.js +1 -1
  10. package/core/components/functional/fetch/fetch.d.ts +45 -6
  11. package/core/components/functional/fetch/fetch.js +2 -6
  12. package/core/components/functional/functional.d.ts +2 -0
  13. package/core/components/functional/functional.js +2 -0
  14. package/core/components/functional/if/if.d.ts +3 -0
  15. package/core/components/functional/if/if.js +6 -12
  16. package/core/components/functional/if/if.test.d.ts +1 -0
  17. package/core/components/functional/if/if.test.js +44 -0
  18. package/core/components/functional/list/list.d.ts +44 -12
  19. package/core/components/functional/list/list.js +54 -49
  20. package/core/components/functional/mix/mix.d.ts +22 -0
  21. package/core/components/functional/mix/mix.js +102 -0
  22. package/core/components/functional/queue/queue.d.ts +27 -5
  23. package/core/components/functional/queue/queue.js +88 -26
  24. package/core/components/functional/router/redirect.d.ts +11 -2
  25. package/core/components/functional/router/redirect.js +7 -12
  26. package/core/components/functional/router/router.d.ts +15 -1
  27. package/core/components/functional/router/router.js +11 -16
  28. package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +1 -2
  29. package/core/components/functional/sdui/SDUIDescriptorTransformer.js +56 -45
  30. package/core/components/functional/sdui/default-library.json +108 -0
  31. package/core/components/functional/sdui/sdui-utils.d.ts +5 -0
  32. package/core/components/functional/sdui/sdui-utils.js +63 -0
  33. package/core/components/functional/sdui/sdui.d.ts +21 -13
  34. package/core/components/functional/sdui/sdui.js +70 -44
  35. package/core/components/functional/sdui/types.d.ts +10 -8
  36. package/core/components/functional/states/states.d.ts +20 -4
  37. package/core/components/functional/states/states.js +15 -20
  38. package/core/components/functional/submit/submit.d.ts +16 -1
  39. package/core/components/functional/submit/submit.js +95 -25
  40. package/core/components/functional/subscriber/subscriber.d.ts +4 -1
  41. package/core/components/functional/subscriber/subscriber.js +1 -6
  42. package/core/components/functional/value/value.d.ts +7 -0
  43. package/core/components/functional/value/value.js +26 -0
  44. package/core/components/ui/_css/scroll.js +6 -7
  45. package/core/components/ui/_css/size.d.ts +1 -0
  46. package/core/components/ui/_css/size.js +3 -1
  47. package/core/components/ui/alert/alert.d.ts +2 -2
  48. package/core/components/ui/alert/alert.js +11 -16
  49. package/core/components/ui/badge/badge.d.ts +3 -1
  50. package/core/components/ui/badge/badge.js +36 -22
  51. package/core/components/ui/button/button.d.ts +28 -23
  52. package/core/components/ui/button/button.js +60 -43
  53. package/core/components/ui/captcha/captcha.d.ts +14 -2
  54. package/core/components/ui/captcha/captcha.js +18 -13
  55. package/core/components/ui/card/card-footer.js +1 -8
  56. package/core/components/ui/card/card-header-descripton.js +3 -9
  57. package/core/components/ui/card/card-header.js +6 -7
  58. package/core/components/ui/card/card-main.js +0 -5
  59. package/core/components/ui/card/card.d.ts +1 -1
  60. package/core/components/ui/card/card.js +30 -12
  61. package/core/components/ui/divider/divider.d.ts +2 -0
  62. package/core/components/ui/divider/divider.js +43 -16
  63. package/core/components/ui/form/checkbox/checkbox.d.ts +86 -25
  64. package/core/components/ui/form/checkbox/checkbox.js +53 -28
  65. package/core/components/ui/form/css/form-control.d.ts +2 -0
  66. package/core/components/ui/form/css/form-control.js +145 -67
  67. package/core/components/ui/form/fieldset/fieldset.d.ts +8 -1
  68. package/core/components/ui/form/fieldset/fieldset.js +45 -8
  69. package/core/components/ui/form/fieldset/legend-description.js +0 -5
  70. package/core/components/ui/form/fieldset/legend.js +3 -6
  71. package/core/components/ui/form/form-actions/form-actions.d.ts +2 -0
  72. package/core/components/ui/form/form-actions/form-actions.js +26 -11
  73. package/core/components/ui/form/form-layout/form-layout.d.ts +5 -2
  74. package/core/components/ui/form/form-layout/form-layout.js +31 -9
  75. package/core/components/ui/form/input/input.d.ts +26 -24
  76. package/core/components/ui/form/input/input.js +87 -52
  77. package/core/components/ui/form/input/password-helper.d.ts +1 -1
  78. package/core/components/ui/form/input/password-helper.js +4 -3
  79. package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
  80. package/core/components/ui/form/input/same-value-helper.js +3 -2
  81. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +2 -3
  82. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +2 -6
  83. package/core/components/ui/form/radio/radio.d.ts +6 -0
  84. package/core/components/ui/form/radio/radio.js +7 -12
  85. package/core/components/ui/form/select/select.d.ts +25 -8
  86. package/core/components/ui/form/select/select.js +72 -41
  87. package/core/components/ui/form/textarea/textarea.d.ts +21 -19
  88. package/core/components/ui/form/textarea/textarea.js +29 -36
  89. package/core/components/ui/group/group.d.ts +11 -1
  90. package/core/components/ui/group/group.js +79 -17
  91. package/core/components/ui/icon/icon.d.ts +10 -3
  92. package/core/components/ui/icon/icon.js +16 -15
  93. package/core/components/ui/icon/icons.js +25 -20
  94. package/core/components/ui/icon/icons.json +1 -1
  95. package/core/components/ui/image/image.js +0 -5
  96. package/core/components/ui/link/link.d.ts +1 -1
  97. package/core/components/ui/link/link.js +2 -6
  98. package/core/components/ui/loader/loader.d.ts +1 -1
  99. package/core/components/ui/loader/loader.js +3 -9
  100. package/core/components/ui/menu/menu-item.js +4 -9
  101. package/core/components/ui/menu/menu.d.ts +9 -1
  102. package/core/components/ui/menu/menu.js +182 -27
  103. package/core/components/ui/modal/modal-actions.js +1 -6
  104. package/core/components/ui/modal/modal-close.d.ts +1 -0
  105. package/core/components/ui/modal/modal-close.js +14 -10
  106. package/core/components/ui/modal/modal-content.js +0 -5
  107. package/core/components/ui/modal/modal-subtitle.js +2 -6
  108. package/core/components/ui/modal/modal-title.js +0 -5
  109. package/core/components/ui/modal/modal.d.ts +7 -7
  110. package/core/components/ui/modal/modal.js +37 -37
  111. package/core/components/ui/pop/pop.d.ts +6 -5
  112. package/core/components/ui/pop/pop.js +57 -57
  113. package/core/components/ui/progress/progress.js +34 -32
  114. package/core/components/ui/table/table-caption.js +5 -10
  115. package/core/components/ui/table/table-tbody.js +10 -14
  116. package/core/components/ui/table/table-td.d.ts +2 -0
  117. package/core/components/ui/table/table-td.js +8 -5
  118. package/core/components/ui/table/table-tfoot.js +5 -7
  119. package/core/components/ui/table/table-th.d.ts +2 -0
  120. package/core/components/ui/table/table-th.js +12 -9
  121. package/core/components/ui/table/table-thead.js +1 -6
  122. package/core/components/ui/table/table-tr.js +4 -6
  123. package/core/components/ui/table/table.d.ts +0 -3
  124. package/core/components/ui/table/table.js +14 -31
  125. package/core/components/ui/theme/theme-collection/core-variables.js +13 -11
  126. package/core/components/ui/theme/theme-collection/dark.js +1 -1
  127. package/core/components/ui/theme/theme.d.ts +1 -6
  128. package/core/components/ui/theme/theme.js +19 -46
  129. package/core/components/ui/toast/message-subscriber.d.ts +16 -7
  130. package/core/components/ui/toast/message-subscriber.js +10 -8
  131. package/core/components/ui/toast/toast-item.js +1 -1
  132. package/core/components/ui/toast/toast.d.ts +3 -2
  133. package/core/components/ui/toast/toast.js +33 -19
  134. package/core/components/ui/toast/types.d.ts +3 -2
  135. package/core/components/ui/tooltip/tooltip.d.ts +1 -0
  136. package/core/components/ui/tooltip/tooltip.js +36 -15
  137. package/core/components/ui/ui.d.ts +1 -1
  138. package/core/components/ui/ui.js +1 -4
  139. package/core/core.js +5 -6
  140. package/core/mixins/Fetcher.d.ts +20 -13
  141. package/core/mixins/Fetcher.js +44 -19
  142. package/core/mixins/FormCheckable.d.ts +25 -13
  143. package/core/mixins/FormCheckable.js +180 -23
  144. package/core/mixins/FormElement.d.ts +17 -9
  145. package/core/mixins/FormElement.js +56 -39
  146. package/core/mixins/FormInput.d.ts +22 -12
  147. package/core/mixins/FormInput.js +4 -3
  148. package/core/mixins/Subscriber.d.ts +12 -8
  149. package/core/mixins/Subscriber.js +51 -48
  150. package/core/mixins/TemplatesContainer.d.ts +2 -1
  151. package/core/mixins/TemplatesContainer.js +2 -2
  152. package/core/utils/Arrays.d.ts +15 -15
  153. package/core/utils/Arrays.js +12 -9
  154. package/core/utils/DataBindObserver.d.ts +18 -11
  155. package/core/utils/DataBindObserver.js +47 -54
  156. package/core/utils/Electron.d.ts +5 -1
  157. package/core/utils/Electron.js +4 -2
  158. package/core/utils/HTML.d.ts +9 -2
  159. package/core/utils/HTML.js +24 -5
  160. package/core/utils/LocationHandler.d.ts +6 -5
  161. package/core/utils/LocationHandler.js +27 -16
  162. package/core/utils/Objects.d.ts +7 -4
  163. package/core/utils/Objects.js +37 -9
  164. package/core/utils/{PublisherProxy.d.mts → PublisherProxy.d.ts} +49 -34
  165. package/core/utils/{PublisherProxy.mjs → PublisherProxy.js} +107 -77
  166. package/core/utils/Utils.d.ts +3 -0
  167. package/core/utils/Utils.js +18 -0
  168. package/core/utils/api.d.ts +26 -9
  169. package/core/utils/api.js +62 -45
  170. package/img/concorde-logo.svg +1 -0
  171. package/img/concorde.png +0 -0
  172. package/img/concorde_def.png +0 -0
  173. package/mixins.d.ts +53 -29
  174. package/mixins.js +3 -4
  175. package/package.json +51 -12
  176. package/svg/regular/plane.svg +1 -0
  177. package/svg/solid/plane.svg +1 -0
  178. package/test-utils/TestUtils.d.ts +4 -0
  179. package/test-utils/TestUtils.js +12 -0
  180. package/utils.d.ts +3 -1
  181. package/utils.js +7 -5
  182. package/core/components/functional/configuration/configuration.d.ts +0 -5
  183. package/core/components/functional/configuration/configuration.js +0 -22
  184. package/core/components/ui/tabs/tab.d.ts +0 -6
  185. package/core/components/ui/tabs/tab.js +0 -46
  186. package/core/components/ui/tabs/tabs.d.ts +0 -15
  187. package/core/components/ui/tabs/tabs.js +0 -129
  188. package/core/components/ui/taxonomy/taxonomy.d.ts +0 -41
  189. package/core/components/ui/taxonomy/taxonomy.js +0 -115
@@ -1,4 +1,4 @@
1
- import { LitElement, CSSResultGroup } from "lit";
1
+ import { LitElement, CSSResultGroup, PropertyValues } from "lit";
2
2
  import "@supersoniks/concorde/core/components/ui/icon/icon";
3
3
  declare const Checkbox_base: {
4
4
  new (...args: any[]): {
@@ -7,27 +7,39 @@ declare const Checkbox_base: {
7
7
  forceAutoFill: boolean;
8
8
  unique: true | null;
9
9
  radio: true | null;
10
- _checked: true | null;
11
- checked: true | null;
10
+ unCheckOnDisconnect: boolean;
11
+ _checked: true | "indeterminate" | null;
12
+ checked: true | "indeterminate" | null;
12
13
  validateFormElement(): void;
13
- setCheckedValue(checked: true | null): void;
14
+ checksAll(): boolean;
15
+ setCheckedValue(checked: true | "indeterminate" | null): void;
14
16
  handleChange(): void;
15
17
  getValueForFormPublisher(): any;
16
- setFormValueFromPublisher(value: any): void;
17
- initPublisher(): void;
18
+ setFormValueFromPublisher(value: string | (string | null)[] | null): void;
19
+ getCheckAllPublisher(): any;
20
+ updateAllChecked: () => void;
21
+ onChecksAllRequest: (value: string) => void;
22
+ disconnectedCallback(): void;
23
+ connectedCallback(): void;
18
24
  getFormPublisher(): any;
19
25
  updateDataValue(): void;
20
- handleBlur(e?: any): void;
26
+ handleBlur(e?: Event | undefined): void;
27
+ focus?: (() => void) | undefined;
28
+ shadowRoot?: ShadowRoot | undefined;
21
29
  error: boolean;
22
30
  autofocus: boolean;
23
31
  required: boolean;
24
32
  disabled: true | null;
25
33
  formDataProvider: string;
34
+ ariaLabelledby?: string | undefined;
35
+ ariaLabel?: string | undefined;
26
36
  _name: string;
27
37
  name: string;
28
- props: any;
29
- propertyMap: Object;
38
+ props: import("../../../../_types/types").CoreJSType;
39
+ propertyMap: object;
30
40
  isConnected: boolean;
41
+ children: HTMLCollection;
42
+ appendChild(node: Node): Node;
31
43
  getAncestorAttributeValue(attributeName: string): string;
32
44
  hasAncestorAttribute(attributeName: string): boolean;
33
45
  querySelectorAll(selector: string): NodeListOf<Element>;
@@ -42,19 +54,18 @@ declare const Checkbox_base: {
42
54
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
43
55
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
44
56
  removeAttribute(name: string): void;
57
+ initPublisher(): void;
45
58
  getApiConfiguration(): import("../../../../utils/api").APIConfiguration;
46
- connectedCallback(): void;
47
59
  requestUpdate(): void;
48
60
  getAttribute(name: string): string;
49
- hasAttribute(attributeName: String): boolean;
50
- disconnectedCallback(): void;
61
+ hasAttribute(attributeName: string): boolean;
51
62
  };
52
63
  } & {
53
64
  new (...args: any[]): {
54
65
  validateFormElement(): void;
55
66
  forceAutoFill: boolean;
56
- _type: "number" | "search" | "file" | "button" | "password" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local";
57
- type: "number" | "search" | "file" | "button" | "password" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local";
67
+ _type: "number" | "search" | "file" | "button" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local" | "password";
68
+ type: "number" | "search" | "file" | "button" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local" | "password";
58
69
  _description?: string | undefined;
59
70
  description: string | undefined;
60
71
  _label?: string | undefined;
@@ -63,21 +74,47 @@ declare const Checkbox_base: {
63
74
  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;
64
75
  getFormPublisher(): any;
65
76
  updateDataValue(): void;
66
- handleChange(e?: any): void;
67
- handleBlur(e?: any): void;
68
- getValueForFormPublisher(): any;
77
+ handleChange(e?: Event | undefined): void;
78
+ handleBlur(e?: Event | undefined): void;
79
+ /**
80
+ * ### Le composent sonic-checkbox étend les mixins FormCheckable, FormInput, FormElement et Subscriber
81
+ * **FormElement :**
82
+ * * La propriété value est remplie automatiquement a l'aide de l'attribut name renseigné, ceci en prenant la valeur de la propriété du même nom dans les données du dataprovider associé.
83
+ * * Par défault lorsque modifie l'input, la valeur est également mise à jour via le même dataprovider
84
+ * * On peut cependant décider de mettre à jour la donnée à une autre adresse en renseigne l'attribut *formDataProvider*.
85
+ * * Par conséquent on peut par exemple le lier à un composant *queue* (via sa propriété *dataFilterProvider*) de manière à appeller en auto une api avec des filtres.
86
+ * * **FormInput **
87
+ * Uniquement des propriétés classiques d'un input HTML. La prise en compte est ici partielle, par exemple les propriétés *placeholder*, *readonly*, *pattern*, *min* et *max* n'ont pas de sens pour un checkbox.
88
+ * **FormCheckable :**
89
+ * * La propriété checked mise à true si la valeur de la propriété du même nom dans les données du dataprovider associé contient un propriété checked.
90
+ * **Comportements :**
91
+ * * multiple (par défaut):
92
+ * - on peut cocher plusieurs checkbox ayant le même *name*.
93
+ * - la valeur enregistrée dans la propriété nommé du même nom dans formDataProvider est un tableau avec les *value* des cases cochées ayant le même *name*.
94
+ * * unique (Ajouter l'attribute unique au composant a l'intégration):
95
+ * - on ne peut cocher qu'une seule checkbox ayant le même *name*.
96
+ * * radio (Ajouter l'attribute radio au composant a l'intégration):
97
+ * Comme unique, mais on ne peut pas décocher la case sauf en en cochant une autre, comme un bouton radio.
98
+ */
99
+ getValueForFormPublisher(): string | object | string[] | null | undefined;
100
+ focus?: (() => void) | undefined;
101
+ shadowRoot?: ShadowRoot | undefined;
69
102
  error: boolean;
70
103
  autofocus: boolean;
71
104
  required: boolean;
72
105
  disabled: true | null;
73
106
  formDataProvider: string;
74
- _value: any;
75
- value: any;
107
+ ariaLabelledby?: string | undefined;
108
+ ariaLabel?: string | undefined;
109
+ _value: string | object | string[] | null | undefined;
110
+ value: string | object | string[] | null | undefined;
76
111
  _name: string;
77
112
  name: string;
78
- props: any;
79
- propertyMap: Object;
113
+ props: import("../../../../_types/types").CoreJSType;
114
+ propertyMap: object;
80
115
  isConnected: boolean;
116
+ children: HTMLCollection;
117
+ appendChild(node: Node): Node;
81
118
  getAncestorAttributeValue(attributeName: string): string;
82
119
  hasAncestorAttribute(attributeName: string): boolean;
83
120
  querySelectorAll(selector: string): NodeListOf<Element>;
@@ -97,18 +134,42 @@ declare const Checkbox_base: {
97
134
  connectedCallback(): void;
98
135
  requestUpdate(): void;
99
136
  getAttribute(name: string): string;
100
- hasAttribute(attributeName: String): boolean;
137
+ hasAttribute(attributeName: string): boolean;
101
138
  disconnectedCallback(): void;
102
139
  };
103
- } & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/FormElement").FormElementInterface) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
140
+ } & (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;
141
+ /**
142
+ * ### Le composent sonic-checkbox étend les mixins FormCheckable, FormInput, FormElement et Subscriber
143
+ * **FormElement :**
144
+ * * La propriété value est remplie automatiquement a l'aide de l'attribut name renseigné, ceci en prenant la valeur de la propriété du même nom dans les données du dataprovider associé.
145
+ * * Par défault lorsque modifie l'input, la valeur est également mise à jour via le même dataprovider
146
+ * * On peut cependant décider de mettre à jour la donnée à une autre adresse en renseigne l'attribut *formDataProvider*.
147
+ * * Par conséquent on peut par exemple le lier à un composant *queue* (via sa propriété *dataFilterProvider*) de manière à appeller en auto une api avec des filtres.
148
+ * * **FormInput **
149
+ * Uniquement des propriétés classiques d'un input HTML. La prise en compte est ici partielle, par exemple les propriétés *placeholder*, *readonly*, *pattern*, *min* et *max* n'ont pas de sens pour un checkbox.
150
+ * **FormCheckable :**
151
+ * * La propriété checked mise à true si la valeur de la propriété du même nom dans les données du dataprovider associé contient un propriété checked.
152
+ * **Comportements :**
153
+ * * multiple (par défaut):
154
+ * - on peut cocher plusieurs checkbox ayant le même *name*.
155
+ * - la valeur enregistrée dans la propriété nommé du même nom dans formDataProvider est un tableau avec les *value* des cases cochées ayant le même *name*.
156
+ * * unique (Ajouter l'attribute unique au composant a l'intégration):
157
+ * - on ne peut cocher qu'une seule checkbox ayant le même *name*.
158
+ * * radio (Ajouter l'attribute radio au composant a l'intégration):
159
+ * Comme unique, mais on ne peut pas décocher la case sauf en en cochant une autre, comme un bouton radio.
160
+ */
104
161
  export declare class Checkbox extends Checkbox_base {
105
162
  static styles: CSSResultGroup[];
106
163
  touched: boolean;
107
164
  iconName: string;
108
- slotDescriptionNodes: Array<Node>;
165
+ indeterminateIconName: string;
109
166
  hasDescription: boolean;
110
- updated(): void;
167
+ hasLabel: boolean;
168
+ slotLabelNodes: Array<Node>;
169
+ slotDescriptionNodes: Array<Node>;
111
170
  connectedCallback(): void;
171
+ willUpdate(changedProperties: PropertyValues): void;
172
+ hasSlotOrProps(): void;
112
173
  render(): import("lit-html").TemplateResult<1>;
113
174
  }
114
175
  export {};
@@ -14,6 +14,7 @@ import FormCheckable from "@supersoniks/concorde/core/mixins/FormCheckable";
14
14
  import "@supersoniks/concorde/core/components/ui/icon/icon";
15
15
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
16
16
  import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
17
+ const tagName = "sonic-checkbox";
17
18
  /**
18
19
  * ### Le composent sonic-checkbox étend les mixins FormCheckable, FormInput, FormElement et Subscriber
19
20
  * **FormElement :**
@@ -34,30 +35,38 @@ import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
34
35
  * * radio (Ajouter l'attribute radio au composant a l'intégration):
35
36
  * Comme unique, mais on ne peut pas décocher la case sauf en en cochant une autre, comme un bouton radio.
36
37
  */
37
- const tagName = "sonic-checkbox";
38
38
  let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscriber(LitElement)))) {
39
39
  constructor() {
40
40
  super(...arguments);
41
41
  this.touched = false;
42
42
  this.iconName = "check";
43
+ this.indeterminateIconName = "minus-small";
43
44
  this.hasDescription = false;
44
- }
45
- updated() {
46
- var _a;
47
- this.hasDescription = this.description || ((_a = this.slotDescriptionNodes) === null || _a === void 0 ? void 0 : _a.length) ? true : false;
45
+ this.hasLabel = false;
48
46
  }
49
47
  connectedCallback() {
50
48
  this.type = "checkbox";
49
+ this.hasSlotOrProps();
51
50
  super.connectedCallback();
52
51
  }
52
+ willUpdate(changedProperties) {
53
+ this.hasSlotOrProps();
54
+ super.willUpdate(changedProperties);
55
+ }
56
+ hasSlotOrProps() {
57
+ var _a, _b;
58
+ 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
+ }
53
61
  render() {
54
62
  //let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
55
63
  return html `
56
64
  <label class="checkbox-container ${this.disabled ? "disabled" : ""}">
65
+
57
66
  <span class="icon-container">
58
67
  <input
59
68
  type="${this.type}"
60
- @change=${this.handleChange}
69
+ @click=${this.handleChange}
61
70
  @blur=${this.handleBlur}
62
71
  ?required=${this.required}
63
72
  .disabled=${ifDefined(this.disabled)}
@@ -65,16 +74,20 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
65
74
  .name=${this.name}
66
75
  .value=${this.value}
67
76
  ?autofocus=${this.autofocus}
77
+ aria-label=${ifDefined(this.ariaLabel)}
78
+ aria-labelledby=${ifDefined(this.ariaLabelledby)}
68
79
  />
69
- <sonic-icon name="${this.iconName}" class="sc-input-icon"></sonic-icon>
80
+ <sonic-icon name="${this.checked == "indeterminate" ? this.indeterminateIconName : this.iconName}" class="sc-input-icon"></sonic-icon>
70
81
  </span>
71
- <div class="checkbox-text">
72
- ${this.label ? unsafeHTML(this.label /*+ labelStarSuffix*/) : ""}
73
- <slot></slot>
74
- <slot name="description" class="${this.hasDescription ? "description" : "hidden"} ">
75
- ${this.description ? html `${unsafeHTML(this.description)}` : ""}
76
- </slot>
77
- </div>
82
+
83
+ <div class="checkbox-text ${!this.hasDescription && !this.hasLabel ? "hidden" : "checkbox-text"}">
84
+ ${this.label ? unsafeHTML(this.label /*+ labelStarSuffix*/) : ""}
85
+ <slot @slotchange=${this.hasSlotOrProps}></slot>
86
+ <slot @slotchange=${this.hasSlotOrProps} name="description" class="${this.hasDescription ? "description" : "hidden"} ">
87
+ ${this.description ? html `${unsafeHTML(this.description)}` : ""}
88
+ </slot>
89
+ </div>
90
+ </label>
78
91
  </label>
79
92
  `;
80
93
  }
@@ -84,7 +97,9 @@ Checkbox.styles = [
84
97
  css `
85
98
  :host {
86
99
  --sc-checkbox-border-width: var(--sc-form-border-width);
87
- --sc-checkbox-border-color: transparent;
100
+ --sc-checkbox-border-color: var(--sc-input-border-color);
101
+ --sc-checkbox-bg: var(--sc-input-bg);
102
+ --sc-checkbox-color: transparent;
88
103
  }
89
104
 
90
105
  * {
@@ -118,7 +133,7 @@ Checkbox.styles = [
118
133
  transition: 0.2s;
119
134
  outline: none;
120
135
  margin: 0;
121
- background-color: var(--sc-base-200);
136
+ background-color: var(--sc-checkbox-bg);
122
137
  border: var(--sc-checkbox-border-width) solid var(--sc-checkbox-border-color);
123
138
  }
124
139
 
@@ -138,7 +153,7 @@ Checkbox.styles = [
138
153
  left: 50%;
139
154
  transform: translateX(-50%) translateY(-50%) scale(0);
140
155
  transition: transform 0.2s ease-in-out;
141
- color: var(--sc-primary-content);
156
+ color: var(--sc-checkbox-color);
142
157
  }
143
158
 
144
159
  /* .checkbox-text {
@@ -154,12 +169,13 @@ Checkbox.styles = [
154
169
 
155
170
  /*Active */
156
171
  input:checked,
157
- input[checked="true"] {
158
- background: var(--sc-primary);
172
+ input[checked] {
173
+ --sc-checkbox-border-color: var(--sc-primary);
174
+ --sc-checkbox-bg: var(--sc-primary);
159
175
  }
160
-
161
176
  input:checked + sonic-icon,
162
- input[checked="true"] + sonic-icon {
177
+ input[checked] + sonic-icon {
178
+ --sc-checkbox-color: var(--sc-primary-content);
163
179
  transform: translateX(-50%) translateY(-50%) scale(1);
164
180
  }
165
181
  /*DISABLED */
@@ -174,6 +190,11 @@ Checkbox.styles = [
174
190
  opacity: 0.6;
175
191
  }
176
192
 
193
+ /*INPUT HOVER*/
194
+ :host(:not([disabled])) label:hover input {
195
+ filter: brightness(0.97);
196
+ }
197
+
177
198
  ::slotted(a) {
178
199
  color: inherit;
179
200
  text-decoration: underline !important;
@@ -205,17 +226,21 @@ __decorate([
205
226
  property({ type: String })
206
227
  ], Checkbox.prototype, "iconName", void 0);
207
228
  __decorate([
208
- queryAssignedNodes({ slot: "description" })
209
- ], Checkbox.prototype, "slotDescriptionNodes", void 0);
229
+ property({ type: String })
230
+ ], Checkbox.prototype, "indeterminateIconName", void 0);
210
231
  __decorate([
211
232
  property({ type: Boolean })
212
233
  ], Checkbox.prototype, "hasDescription", void 0);
234
+ __decorate([
235
+ property({ type: Boolean })
236
+ ], Checkbox.prototype, "hasLabel", void 0);
237
+ __decorate([
238
+ queryAssignedNodes()
239
+ ], Checkbox.prototype, "slotLabelNodes", void 0);
240
+ __decorate([
241
+ queryAssignedNodes({ slot: "description" })
242
+ ], Checkbox.prototype, "slotDescriptionNodes", void 0);
213
243
  Checkbox = __decorate([
214
244
  customElement(tagName)
215
245
  ], Checkbox);
216
246
  export { Checkbox };
217
- //Ajout pour Storybook
218
- try {
219
- customElements.define(tagName, Checkbox);
220
- }
221
- catch (e) { }
@@ -1 +1,3 @@
1
+ export declare const label: import("lit").CSSResult;
2
+ export declare const description: import("lit").CSSResult;
1
3
  export declare const formControl: import("lit").CSSResult;