@supersoniks/concorde 1.0.7 → 1.0.8

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 (175) hide show
  1. package/README.md +16 -8
  2. package/cli.js +69 -0
  3. package/core/components/functional/date/date.d.ts +34 -0
  4. package/core/components/functional/date/date.js +187 -0
  5. package/core/components/functional/example/example.d.ts +7 -0
  6. package/core/components/functional/example/example.js +25 -0
  7. package/core/components/functional/fetch/fetch.d.ts +49 -0
  8. package/core/components/functional/fetch/fetch.js +38 -0
  9. package/core/components/functional/functional.d.ts +11 -0
  10. package/core/components/functional/functional.js +11 -0
  11. package/core/components/functional/if/if.d.ts +12 -0
  12. package/core/components/functional/if/if.js +43 -0
  13. package/core/components/functional/list/list.d.ts +67 -0
  14. package/core/components/functional/list/list.js +132 -0
  15. package/core/components/functional/queue/queue.d.ts +42 -0
  16. package/core/components/functional/queue/queue.js +184 -0
  17. package/core/components/functional/router/redirect.d.ts +18 -0
  18. package/core/components/functional/router/redirect.js +57 -0
  19. package/core/components/functional/router/router.d.ts +26 -0
  20. package/core/components/functional/router/router.js +104 -0
  21. package/core/components/functional/states/states.d.ts +28 -0
  22. package/core/components/functional/states/states.js +139 -0
  23. package/core/components/functional/submit/submit.d.ts +24 -0
  24. package/core/components/functional/submit/submit.js +108 -0
  25. package/{types/core/components → core/components/functional/subscriber}/subscriber.d.ts +5 -1
  26. package/core/components/functional/subscriber/subscriber.js +30 -0
  27. package/core/components/ui/alert/alert.d.ts +20 -0
  28. package/core/components/ui/alert/alert.js +150 -0
  29. package/core/components/ui/badge/badge.d.ts +24 -0
  30. package/core/components/ui/badge/badge.js +177 -0
  31. package/core/components/ui/button/button.d.ts +125 -0
  32. package/core/components/ui/button/button.js +558 -0
  33. package/core/components/ui/divider/divider.d.ts +11 -0
  34. package/core/components/ui/divider/divider.js +144 -0
  35. package/core/components/ui/form/checkbox/checkbox.d.ts +120 -0
  36. package/core/components/ui/form/checkbox/checkbox.js +203 -0
  37. package/core/components/ui/form/css/form-control.d.ts +1 -0
  38. package/core/components/ui/form/css/form-control.js +219 -0
  39. package/core/components/ui/form/fieldset/fieldset.d.ts +15 -0
  40. package/core/components/ui/form/fieldset/fieldset.js +70 -0
  41. package/core/components/ui/form/fieldset/legend.d.ts +11 -0
  42. package/core/components/ui/form/fieldset/legend.js +92 -0
  43. package/core/components/ui/form/form-layout/form-actions.d.ts +6 -0
  44. package/core/components/ui/form/form-layout/form-actions.js +23 -0
  45. package/core/components/ui/form/form-layout/form-layout.d.ts +9 -0
  46. package/core/components/ui/form/form-layout/form-layout.js +58 -0
  47. package/core/components/ui/form/input/input.d.ts +84 -0
  48. package/core/components/ui/form/input/input.js +180 -0
  49. package/core/components/ui/form/radio/radio.d.ts +12 -0
  50. package/core/components/ui/form/radio/radio.js +55 -0
  51. package/core/components/ui/form/select/select.d.ts +39 -0
  52. package/core/components/ui/form/select/select.js +220 -0
  53. package/core/components/ui/form/textarea/textarea.d.ts +69 -0
  54. package/core/components/ui/form/textarea/textarea.js +150 -0
  55. package/core/components/ui/group/group.d.ts +6 -0
  56. package/core/components/ui/group/group.js +57 -0
  57. package/core/components/ui/icon/icon.d.ts +17 -0
  58. package/core/components/ui/icon/icon.js +93 -0
  59. package/core/components/ui/icon/icons.d.ts +13 -0
  60. package/core/components/ui/icon/icons.js +25 -0
  61. package/core/components/ui/icon/icons.json +1 -0
  62. package/core/components/ui/image/image.d.ts +14 -0
  63. package/core/components/ui/image/image.js +152 -0
  64. package/core/components/ui/link/link.d.ts +16 -0
  65. package/core/components/ui/link/link.js +70 -0
  66. package/core/components/ui/loader/loader.d.ts +20 -0
  67. package/core/components/ui/loader/loader.js +94 -0
  68. package/{types → core}/components/ui/loader/styles/fixed.d.ts +0 -0
  69. package/core/components/ui/loader/styles/fixed.js +57 -0
  70. package/{types → core}/components/ui/loader/styles/inline.d.ts +0 -0
  71. package/core/components/ui/loader/styles/inline.js +71 -0
  72. package/core/components/ui/menu/menu-item.d.ts +5 -0
  73. package/core/components/ui/menu/menu-item.js +37 -0
  74. package/core/components/ui/menu/menu.d.ts +26 -0
  75. package/core/components/ui/menu/menu.js +125 -0
  76. package/core/components/ui/modal/modal-actions.d.ts +7 -0
  77. package/core/components/ui/modal/modal-actions.js +46 -0
  78. package/core/components/ui/modal/modal-close.d.ts +6 -0
  79. package/core/components/ui/modal/modal-close.js +38 -0
  80. package/core/components/ui/modal/modal-content.d.ts +5 -0
  81. package/core/components/ui/modal/modal-content.js +29 -0
  82. package/core/components/ui/modal/modal-subtitle.d.ts +5 -0
  83. package/core/components/ui/modal/modal-subtitle.js +33 -0
  84. package/core/components/ui/modal/modal-title.d.ts +5 -0
  85. package/core/components/ui/modal/modal-title.js +33 -0
  86. package/core/components/ui/modal/modal.d.ts +36 -0
  87. package/core/components/ui/modal/modal.js +325 -0
  88. package/core/components/ui/pop/pop.d.ts +28 -0
  89. package/core/components/ui/pop/pop.js +223 -0
  90. package/core/components/ui/tabs/tab.d.ts +6 -0
  91. package/core/components/ui/tabs/tab.js +46 -0
  92. package/core/components/ui/tabs/tabs.d.ts +14 -0
  93. package/core/components/ui/tabs/tabs.js +127 -0
  94. package/core/components/ui/taxonomy/taxonomy.d.ts +41 -0
  95. package/core/components/ui/taxonomy/taxonomy.js +113 -0
  96. package/core/components/ui/theme/css/tailwind.css +3 -0
  97. package/core/components/ui/theme/css/tailwind.d.ts +2 -0
  98. package/core/components/ui/theme/theme-collection/core-variables.d.ts +1 -0
  99. package/core/components/ui/theme/theme-collection/core-variables.js +50 -0
  100. package/{types/components → core/components/ui}/theme/theme-collection/dark.d.ts +0 -0
  101. package/core/components/ui/theme/theme-collection/dark.js +41 -0
  102. package/{types/components → core/components/ui}/theme/theme-collection/light.d.ts +0 -0
  103. package/core/components/ui/theme/theme-collection/light.js +35 -0
  104. package/core/components/ui/theme/theme.d.ts +11 -0
  105. package/core/components/ui/theme/theme.js +105 -0
  106. package/core/components/ui/toast/message-subscriber.d.ts +17 -0
  107. package/core/components/ui/toast/message-subscriber.js +85 -0
  108. package/{types → core}/components/ui/toast/toast.d.ts +10 -8
  109. package/core/components/ui/toast/toast.js +260 -0
  110. package/core/components/ui/tooltip/tooltip.d.ts +7 -0
  111. package/core/components/ui/tooltip/tooltip.js +68 -0
  112. package/core/components/ui/ui.d.ts +27 -0
  113. package/core/components/ui/ui.js +34 -0
  114. package/core/core.d.ts +3 -0
  115. package/core/core.js +7 -0
  116. package/core/mixins/Fetcher.d.ts +69 -0
  117. package/core/mixins/Fetcher.js +147 -0
  118. package/core/mixins/FormCheckable.d.ts +72 -0
  119. package/core/mixins/FormCheckable.js +144 -0
  120. package/core/mixins/FormElement.d.ts +21 -0
  121. package/core/mixins/FormElement.js +229 -0
  122. package/core/mixins/FormInput.d.ts +49 -0
  123. package/core/mixins/FormInput.js +33 -0
  124. package/core/mixins/Subscriber.d.ts +30 -0
  125. package/core/mixins/Subscriber.js +379 -0
  126. package/core/mixins/TemplatesContainer.d.ts +12 -0
  127. package/core/mixins/TemplatesContainer.js +60 -0
  128. package/core/mixins/mixins.d.ts +6 -0
  129. package/core/mixins/mixins.js +6 -0
  130. package/core/utils/Arrays.d.ts +97 -0
  131. package/core/utils/Arrays.js +136 -0
  132. package/core/utils/DataBindObserver.d.ts +74 -0
  133. package/core/utils/DataBindObserver.js +252 -0
  134. package/core/utils/Format.d.ts +11 -0
  135. package/core/utils/Format.js +22 -0
  136. package/core/utils/HTML.d.ts +13 -0
  137. package/core/utils/HTML.js +26 -0
  138. package/core/utils/LocationHandler.d.ts +44 -0
  139. package/core/utils/LocationHandler.js +96 -0
  140. package/core/utils/Objects.d.ts +23 -0
  141. package/core/utils/Objects.js +63 -0
  142. package/core/utils/PublisherProxy.d.mts +110 -0
  143. package/core/utils/PublisherProxy.mjs +365 -0
  144. package/core/utils/api.d.ts +66 -0
  145. package/core/utils/api.js +145 -0
  146. package/package.json +179 -21
  147. package/LICENSE +0 -43
  148. package/dist/concorde.bundle.js +0 -3620
  149. package/types/components/event/event-card/event-card.d.ts +0 -10
  150. package/types/components/event/event-title/event-title.d.ts +0 -7
  151. package/types/components/event/event.d.ts +0 -8
  152. package/types/components/giftcards/giftcard/giftcard.d.ts +0 -15
  153. package/types/components/illustration/illustration.d.ts +0 -16
  154. package/types/components/product/prices-form/price-button/price-button.d.ts +0 -25
  155. package/types/components/product/prices-form/prices-form.d.ts +0 -23
  156. package/types/components/theme/theme-collection/bootstrap5.d.ts +0 -1
  157. package/types/components/theme/theme-collection/dracula.d.ts +0 -1
  158. package/types/components/theme/theme.d.ts +0 -8
  159. package/types/components/ui/button/button.d.ts +0 -13
  160. package/types/components/ui/loader/loader.d.ts +0 -15
  161. package/types/components/ui/modal/modal.d.ts +0 -17
  162. package/types/components/ui/tooltip/tooltip.d.ts +0 -9
  163. package/types/core/components/fetch.d.ts +0 -6
  164. package/types/core/components/list.d.ts +0 -9
  165. package/types/core/components/queue.d.ts +0 -15
  166. package/types/core/components/taxonomy.d.ts +0 -13
  167. package/types/core/components/text-formatted.d.ts +0 -15
  168. package/types/core/components/text.d.ts +0 -9
  169. package/types/core/core.d.ts +0 -7
  170. package/types/core/mixins/Fetcher.d.ts +0 -9
  171. package/types/core/mixins/Subscriber.d.ts +0 -13
  172. package/types/core/utils/api.d.ts +0 -16
  173. package/types/index.d.ts +0 -12
  174. package/types/styles/button/button.d.ts +0 -1
  175. package/types/styles/prose/prose.d.ts +0 -2
@@ -0,0 +1,558 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import LocationHandler from "@supersoniks/concorde/core/utils/LocationHandler";
8
+ import { html, LitElement, css } from "lit";
9
+ import { customElement, property, queryAssignedElements, state } from "lit/decorators.js";
10
+ import { styleMap } from "lit/directives/style-map.js";
11
+ import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
12
+ import FormCheckable from "@supersoniks/concorde/core/mixins/FormCheckable";
13
+ import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
14
+ /**
15
+ * 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.
16
+ * * L'objet et ses slot sont en display flex avec direction / alignement et justifications configurables
17
+ * * Le bouton est comparable au badge car il possèdent tous les deux les propriétés *type* (primary...), *variant*(outline, ghost), size(xs...)...
18
+ * * Le bouton possède cependant et notamment une propriété href contrairement à un badge
19
+ */
20
+ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElement))) {
21
+ constructor() {
22
+ super(...arguments);
23
+ /**
24
+ * Le type change surtout la couleur composant
25
+ */
26
+ this.type = "default";
27
+ /**
28
+ * Le composant par defaut sans se paramètre à forte affordance
29
+ * * gost : composant super léger visuellement
30
+ * * outline : composant légé avec une bordure
31
+ */
32
+ this.variant = "default";
33
+ /**
34
+ * Taille du composant, implique notamment des modifications de typo et de marge interne
35
+ */
36
+ this.size = "md";
37
+ /**
38
+ * Forme du bouton, permet de le forcer en carré ou cercle
39
+ */
40
+ this.shape = "default";
41
+ /**
42
+ * Propriété de direction *flex* appliquée à l'élément contenant les *slots*
43
+ */
44
+ this.direction = "row";
45
+ /**
46
+ * Propriété align-items de *flex* appliquée à l'élément contenant les *slots*
47
+ */
48
+ this.align = "center";
49
+ /**
50
+ * Propriété justify-content de *flex* appliquée à l'élément contenant les *slots*
51
+ */
52
+ this.justify = "center";
53
+ /**
54
+ * Propriété text-align du bouton
55
+ */
56
+ this.textAlign = "center";
57
+ /**
58
+ * Propriété min-width du bouton
59
+ */
60
+ this.minWidth = "0";
61
+ /**
62
+ * Laisse apparaitre un loader en remplacement du contenu du bouton.
63
+ * Désactive également le clic sur le bouton
64
+ */
65
+ this.loading = false;
66
+ this.hasPrefix = false;
67
+ this.hasSuffix = false;
68
+ /**
69
+ * L'url
70
+ */
71
+ this._href = "";
72
+ /**
73
+ * Si présent on passe en mode pushstate
74
+ */
75
+ this.pushState = null;
76
+ this.active = false;
77
+ this._location = "";
78
+ }
79
+ set href(value) {
80
+ this._href = value;
81
+ if (this.href && this.href.indexOf("http") != 0) {
82
+ LocationHandler.onChange(this);
83
+ this.location = document.location.href.replace(document.location.origin, "");
84
+ }
85
+ else
86
+ LocationHandler.offChange(this);
87
+ this.requestUpdate();
88
+ }
89
+ get href() {
90
+ return this._href;
91
+ }
92
+ handlePushState(e) {
93
+ e.preventDefault();
94
+ LocationHandler.changeFromComponent(this);
95
+ }
96
+ handleChange(e) {
97
+ super.handleChange(e);
98
+ if (this.pushState) {
99
+ e.preventDefault();
100
+ e.stopPropagation();
101
+ LocationHandler.changeFromComponent(this);
102
+ }
103
+ }
104
+ connectedCallback() {
105
+ super.connectedCallback();
106
+ }
107
+ // _checked: true | null = null;
108
+ // @property() get checked(): true | null {
109
+ // return this._checked;
110
+ // }
111
+ // set checked(checked: true | null) {
112
+ // if (this.name) {
113
+ // if (checked == this._checked) return;
114
+ // super.setCheckedValue(checked);
115
+ // if (this._checked) this.setAttribute("active", "true");
116
+ // else this.removeAttribute("active");
117
+ // }
118
+ // }
119
+ setCheckedValue(checked) {
120
+ if (this.name) {
121
+ if (checked == this._checked)
122
+ return;
123
+ super.setCheckedValue(checked);
124
+ if (this._checked)
125
+ this.setAttribute("active", "true");
126
+ else
127
+ this.removeAttribute("active");
128
+ }
129
+ }
130
+ disconnectedCallback() {
131
+ LocationHandler.offChange(this);
132
+ super.disconnectedCallback();
133
+ }
134
+ get location() {
135
+ return this._location;
136
+ }
137
+ set location(value) {
138
+ this._location = value;
139
+ LocationHandler.updateComponentActiveState(this);
140
+ }
141
+ render() {
142
+ const btnStyles = {
143
+ flexDirection: this.direction,
144
+ alignItems: this.align,
145
+ justifyContent: this.justify,
146
+ textAlign: this.textAlign,
147
+ minWidth: this.minWidth,
148
+ };
149
+ const btn = html `
150
+ <button part="button" class=${this.hasPrefix || this.hasSuffix ? 'has-prefix-or-suffix' : ''} style=${styleMap(btnStyles)} @click=${this.handleChange}>
151
+ <slot @slotchange=${this.onSlotChange} part="prefix" name="prefix"></slot>
152
+ <slot part="main" class="main-slot"></slot>
153
+ <slot @slotchange=${this.onSlotChange} part="suffix" name="suffix"></slot>
154
+ ${this.loading == true ? html `<sonic-icon prefix="iconoir" name="notch" class="loader"></sonic-icon>` : ""}
155
+ </button>
156
+ `;
157
+ return this.href
158
+ ? html `<a href="${this.href}" @click=${this.pushState ? this.handlePushState : null}>${btn}</a>`
159
+ : html `${btn}`;
160
+ }
161
+ onSlotChange() {
162
+ var _a, _b;
163
+ this.hasPrefix = !!((_a = this.prefixes) === null || _a === void 0 ? void 0 : _a.length);
164
+ this.hasSuffix = !!((_b = this.suffixes) === null || _b === void 0 ? void 0 : _b.length);
165
+ }
166
+ };
167
+ Button.styles = [
168
+ css `
169
+ * {
170
+ box-sizing: border-box;
171
+ }
172
+ :host {
173
+ --sc-btn-gap: 0.35em;
174
+ --sc-btn-py: 0.25em;
175
+ --sc-btn-px: 1.1em;
176
+ --sc-btn-fs: 1rem;
177
+ --sc-btn-fw: var(--sc-btn-font-weight);
178
+ --sc-btn-ff: var(--sc-btn-font-family);
179
+
180
+ --sc-btn-height: var(--sc-form-height, 2.5em);
181
+ --sc-btn-color: var(--sc-base-content, #1f2937);
182
+ --sc-btn-bg: var(--sc-base-100, #e5e7eb);
183
+
184
+ --sc-btn-border-style: solid;
185
+ --sc-btn-border-with: var(--sc-form-border-width, 0.1rem);
186
+ --sc-btn-border-color: transparent;
187
+
188
+ --sc-btn-outline-bg-hover: var(--sc-base-100);
189
+ --sc-btn-ghost-bg-hover: var(--sc-base-100);
190
+
191
+ --sc-btn-active-color: var(--sc-base);
192
+ --sc-btn-hover-filter: brightness(0.97);
193
+ --sc-btn-active-filter: brightness(0.96);
194
+ --sc-btn-active-bg: var(--sc-base-content);
195
+
196
+ --sc-item-rounded-tr: var(--sc-btn-rounded);
197
+ --sc-item-rounded-tl: var(--sc-btn-rounded);
198
+ --sc-item-rounded-bl: var(--sc-btn-rounded);
199
+ --sc-item-rounded-br: var(--sc-btn-rounded);
200
+
201
+ display: inline-flex;
202
+ vertical-align: middle;
203
+ box-sizing: border-box;
204
+ }
205
+
206
+ :host a {
207
+ display: contents;
208
+ }
209
+
210
+ :host button {
211
+ display: flex;
212
+ flex: 1;
213
+ box-sizing: border-box;
214
+ flex-wrap: wrap;
215
+ align-items: center;
216
+ justify-content: center;
217
+
218
+ font-family: var(--sc-btn-ff);
219
+ font-weight: var(--sc-btn-fw);
220
+ font-size: var(--sc-btn-fs);
221
+
222
+ cursor: pointer;
223
+ text-align: center;
224
+ line-height: 1.2;
225
+ border-radius: var(--sc-item-rounded-tl) var(--sc-item-rounded-tr) var(--sc-item-rounded-br)
226
+ var(--sc-item-rounded-bl);
227
+
228
+ background: var(--sc-btn-bg);
229
+ color: var(--sc-btn-color);
230
+
231
+ padding-top: var(--sc-btn-py);
232
+ padding-bottom: var(--sc-btn-py);
233
+ padding-left: var(--sc-btn-px);
234
+ padding-right: var(--sc-btn-px);
235
+
236
+ border: var(--sc-btn-border-with) var(--sc-btn-border-style) var(--sc-btn-border-color);
237
+ min-height: var(--sc-btn-height);
238
+ }
239
+
240
+ :host button.has-prefix-or-suffix {
241
+ gap: var(--sc-btn-gap);
242
+ }
243
+
244
+ :host button:focus,
245
+ :host button:hover {
246
+ filter: var(--sc-btn-hover-filter);
247
+ }
248
+
249
+ :host button:active {
250
+ filter: var(--sc-btn-active-filter);
251
+ }
252
+
253
+ /*TYPES*/
254
+ :host([type="default"]) button {
255
+ --sc-btn-color: var(--sc-base-content);
256
+ --sc-btn-bg: var(--sc-base-100);
257
+ }
258
+
259
+ :host([type="primary"]) button {
260
+ --sc-btn-color: var(--sc-primary-content);
261
+ --sc-btn-bg: var(--sc-primary);
262
+ }
263
+ :host([type="warning"]) button {
264
+ --sc-btn-color: var(--sc-warning-content);
265
+ --sc-btn-bg: var(--sc-warning);
266
+ }
267
+ :host([type="danger"]) button {
268
+ --sc-btn-color: var(--sc-danger-content);
269
+ --sc-btn-bg: var(--sc-danger);
270
+ }
271
+ :host([type="info"]) button {
272
+ --sc-btn-color: var(--sc-info-content);
273
+ --sc-btn-bg: var(--sc-info);
274
+ }
275
+ :host([type="success"]) button {
276
+ --sc-btn-color: var(--sc-success-content);
277
+ --sc-btn-bg: var(--sc-success);
278
+ }
279
+ :host([type="neutral"]) button {
280
+ --sc-btn-color: var(--sc-base);
281
+ --sc-btn-bg: var(--sc-base-600);
282
+ }
283
+
284
+ /*SIZE*/
285
+ :host([size="xs"]) {
286
+ --sc-btn-fs: 0.75rem;
287
+ }
288
+ :host([size="sm"]) {
289
+ --sc-btn-fs: 0.85rem;
290
+ }
291
+ :host([size="lg"]) {
292
+ --sc-btn-fs: 1.2rem;
293
+ }
294
+ :host([size="xl"]) {
295
+ --sc-btn-fs: 1.5rem;
296
+ }
297
+
298
+ /*UNSTYLED*/
299
+ :host([variant="unstyled"]) button {
300
+ all: unset;
301
+ transition: 0.1s;
302
+ display: inline-flex;
303
+ cursor: pointer;
304
+ --sc-btn-height: auto;
305
+ --sc-btn-width: auto;
306
+ }
307
+
308
+ /*GESTION DU FOCUS*/
309
+ :host(:not([disabled])) button:focus {
310
+ box-shadow: 0 0 0 0.18rem var(--sc-base-300);
311
+ border-color: var(--sc-base-300) !important;
312
+ outline: none;
313
+ }
314
+
315
+ /*GHOST*/
316
+ :host([variant="ghost"][type]) button {
317
+ color: var(--sc-btn-bg);
318
+ background: transparent;
319
+ }
320
+
321
+ :host([variant="ghost"][type="default"]) button {
322
+ color: var(--sc-btn-color);
323
+ background: transparent;
324
+ }
325
+
326
+ /*:host([variant="ghost"]) button:focus,*/
327
+ :host([variant="ghost"]) button:hover {
328
+ background: var(--sc-btn-ghost-bg-hover);
329
+ filter: none;
330
+ }
331
+
332
+ :host([active][variant="ghost"]) button {
333
+ background: var(--sc-btn-ghost-bg-hover);
334
+ filter: none;
335
+ }
336
+
337
+ :host([active][variant="ghost"]) button:hover {
338
+ filter: var(--sc-btn-hover-filter);
339
+ }
340
+
341
+ /*OUTLINE*/
342
+ :host([variant="outline"][type]) button {
343
+ border-color: var(--sc-btn-bg);
344
+ color: var(--sc-btn-bg);
345
+ background: transparent;
346
+ }
347
+
348
+ :host([variant="outline"][type="default"]) button {
349
+ border-color: var(--sc-base-400);
350
+ color: var(--sc-base-500);
351
+ background: transparent;
352
+ }
353
+
354
+ /*:host([variant="outline"]) button:focus,*/
355
+ :host([variant="outline"]) button:hover {
356
+ background: var(--sc-btn-outline-bg-hover);
357
+ }
358
+
359
+ /*OUTLINE*/
360
+ :host([variant="link"]) {
361
+ vertical-align: baseline;
362
+ }
363
+
364
+ :host([variant="link"]) button {
365
+ text-decoration: underline;
366
+ padding: 0;
367
+ background: none;
368
+ border: none;
369
+ font-size: inherit;
370
+ min-height: 0;
371
+ color: inherit;
372
+ }
373
+
374
+ :host([variant="link"][type]) button {
375
+ color: var(--sc-btn-bg);
376
+ }
377
+ :host([variant="link"][type="default"]) button {
378
+ color: inherit;
379
+ }
380
+
381
+ :host([variant="link"]) button:focus,
382
+ :host([variant="link"]) button:hover {
383
+ text-decoration: none;
384
+ }
385
+
386
+ /*SHAPE*/
387
+ :host([shape="circle"]) button {
388
+ border-radius: 50%;
389
+ }
390
+
391
+ :host([shape="circle"]) button,
392
+ :host([shape="square"]) button {
393
+ width: var(--sc-btn-height);
394
+ height: var(--sc-btn-height);
395
+ overflow: hidden;
396
+ padding: 0;
397
+ align-items: center;
398
+ justify-content: 0;
399
+ }
400
+
401
+ :host([shape="block"]),
402
+ :host([shape="block"]) button {
403
+ width: 100%;
404
+ }
405
+
406
+ :host([disabled]) {
407
+ opacity: 0.3;
408
+ pointer-events: none;
409
+ user-select: none;
410
+ }
411
+
412
+ /*ACTIVE*/
413
+ :host([active]:not([variant="ghost"])) button {
414
+ background: var(--sc-btn-active-bg);
415
+ color: var(--sc-btn-active-color);
416
+ border-color: var(--sc-btn-active-bg);
417
+ }
418
+
419
+ :host([textAlign="left"]) button {
420
+ text-align: left;
421
+ }
422
+
423
+ :host([textAlign="right"]) button {
424
+ text-align: right;
425
+ }
426
+
427
+ .main-slot {
428
+ flex-grow: 1;
429
+ display: block;
430
+ /*align-items: center;
431
+ justify-content: center;*/
432
+ }
433
+
434
+ slot[name="suffix"],
435
+ slot[name="prefix"] {
436
+ flex-shrink: 0;
437
+ }
438
+
439
+ /*ALIGNEMENT DES ICONES
440
+ permet de tous les avoir alignés dans un menu
441
+ */
442
+ ::slotted(sonic-icon) {
443
+ min-width: 1.3em;
444
+ text-align: center;
445
+ }
446
+
447
+ /*Tooltip ne joue pas sur le layout*/
448
+ sonic-tooltip {
449
+ display: contents;
450
+ }
451
+
452
+ /*OUTLINE*/
453
+ :host(:not([active])) ::slotted([swap="on"]) {
454
+ display: none;
455
+ }
456
+
457
+ :host([active]) ::slotted([swap="off"]) {
458
+ display: none;
459
+ }
460
+
461
+ /*Loading*/
462
+ :host([loading]) {
463
+ pointer-events: none;
464
+ position: relative;
465
+ }
466
+
467
+ :host([loading]) slot {
468
+ opacity: 0 !important;
469
+ pointer-events: none;
470
+ }
471
+ /*Loading*/
472
+ :host([loading]) .loader {
473
+ position: absolute;
474
+ top: 50%;
475
+ left: 50%;
476
+ transform: translate(-50%, -50%);
477
+ display: flex;
478
+ align-items: center;
479
+ justify-content: center;
480
+ line-height: 0;
481
+ height: var(--sc-btn-ff);
482
+ width: var(--sc-btn-ff);
483
+ animation: rotation 2s infinite linear;
484
+ }
485
+
486
+ @keyframes rotation {
487
+ from {
488
+ transform-origin: 50% 50%;
489
+ transform: translate(-50%, -50%) rotate(0deg);
490
+ }
491
+ to {
492
+ transform-origin: 50% 50%;
493
+ transform: translate(-50%, -50%) rotate(359deg);
494
+ }
495
+ }
496
+ `,
497
+ ];
498
+ __decorate([
499
+ property({ type: String, reflect: true })
500
+ ], Button.prototype, "type", void 0);
501
+ __decorate([
502
+ property({ type: String, reflect: true })
503
+ ], Button.prototype, "variant", void 0);
504
+ __decorate([
505
+ property({ type: String, reflect: true })
506
+ ], Button.prototype, "size", void 0);
507
+ __decorate([
508
+ property({ type: String, reflect: true })
509
+ ], Button.prototype, "shape", void 0);
510
+ __decorate([
511
+ property({ type: String })
512
+ ], Button.prototype, "direction", void 0);
513
+ __decorate([
514
+ property({ type: String, reflect: true })
515
+ ], Button.prototype, "align", void 0);
516
+ __decorate([
517
+ property({ type: String })
518
+ ], Button.prototype, "justify", void 0);
519
+ __decorate([
520
+ property({ type: String, reflect: true })
521
+ ], Button.prototype, "textAlign", void 0);
522
+ __decorate([
523
+ property({ type: String })
524
+ ], Button.prototype, "minWidth", void 0);
525
+ __decorate([
526
+ property({ type: Boolean, reflect: true })
527
+ ], Button.prototype, "loading", void 0);
528
+ __decorate([
529
+ state()
530
+ ], Button.prototype, "hasPrefix", void 0);
531
+ __decorate([
532
+ state()
533
+ ], Button.prototype, "hasSuffix", void 0);
534
+ __decorate([
535
+ queryAssignedElements({ flatten: true, slot: 'prefix' })
536
+ ], Button.prototype, "prefixes", void 0);
537
+ __decorate([
538
+ queryAssignedElements({ flatten: true, slot: 'suffix' })
539
+ ], Button.prototype, "suffixes", void 0);
540
+ __decorate([
541
+ property({ type: String })
542
+ ], Button.prototype, "href", null);
543
+ __decorate([
544
+ property({ type: Boolean })
545
+ ], Button.prototype, "pushState", void 0);
546
+ __decorate([
547
+ property({ type: Boolean, reflect: true })
548
+ ], Button.prototype, "active", void 0);
549
+ Button = __decorate([
550
+ customElement("sonic-button")
551
+ ], Button);
552
+ export { Button };
553
+ //Ajout pour Storybook
554
+ try {
555
+ customElements.define("sonic-button", Button);
556
+ }
557
+ catch (e) { }
558
+ export const SonicButton = Button;
@@ -0,0 +1,11 @@
1
+ import { LitElement } from "lit";
2
+ export declare class Divider extends LitElement {
3
+ static styles: import("lit").CSSResult[];
4
+ slotNodes: Array<Node>;
5
+ divider: HTMLDivElement;
6
+ label: string;
7
+ size: "xs" | "md" | "sm" | "lg";
8
+ align: "left" | "right" | "center";
9
+ firstUpdated(): void;
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ }
@@ -0,0 +1,144 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, LitElement, css } from "lit";
8
+ import { customElement, property, queryAssignedNodes, query } from "lit/decorators.js";
9
+ let Divider = class Divider extends LitElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.label = "";
13
+ this.size = "md";
14
+ this.align = "center";
15
+ }
16
+ firstUpdated() {
17
+ var _a, _b;
18
+ if (this.label || ((_a = this.slotNodes) === null || _a === void 0 ? void 0 : _a.length)) {
19
+ (_b = this.divider) === null || _b === void 0 ? void 0 : _b.classList.add("has-text");
20
+ }
21
+ }
22
+ render() {
23
+ return html `<div part="divider">
24
+ <span class="text">${this.label}<slot></slot></span>
25
+ </div>`;
26
+ }
27
+ };
28
+ Divider.styles = [
29
+ css `
30
+ :host {
31
+ --sc-divider-my: 0.5rem;
32
+ --sc-divider-mx: 0;
33
+ --sc-divider-border-width: min(2px, 0.15rem);
34
+ --sc-divider-border-color: var(--sc-base-200);
35
+ --sc-divider-border-style: solid;
36
+ --sc-divider-color: var(--sc-base-500);
37
+ --sc-divider-ff: var(--sc-font-family-base);
38
+ --sc-divider-fs: 1rem;
39
+ --sc-divider-fw: var(--sc-font-weight-base);
40
+ --sc-divider-fst: var(--sc-font-style-base);
41
+
42
+ margin: var(--sc-divider-my) var(--sc-divider-mx);
43
+ font-size: var(--sc-divider-fs);
44
+ font-style: var(--sc-divider-fst);
45
+ font-family: var(--sc-divider-ff);
46
+ font-weight: var(--sc-divider-fw);
47
+ color: var(--sc-divider-color);
48
+ display: block;
49
+ }
50
+
51
+ /*SIZE*/
52
+ :host([size="xs"]) {
53
+ --sc-divider-my: 0.5rem;
54
+ --sc-divider-fs: 0.75rem;
55
+ }
56
+
57
+ :host([size="sm"]) {
58
+ --sc-divider-my: 0.75rem;
59
+ --sc-divider-fs: 0.85rem;
60
+ }
61
+
62
+ :host([size="md"]) {
63
+ --sc-divider-my: 1.25rem;
64
+ }
65
+
66
+ :host([size="lg"]) {
67
+ --sc-divider-my: 1.85rem;
68
+ }
69
+
70
+ :host([size="xl"]) {
71
+ --sc-divider-my: 2.25rem;
72
+ }
73
+
74
+ :host([size="2xl"]) {
75
+ --sc-divider-my: 3rem;
76
+ }
77
+
78
+ div {
79
+ display: flex;
80
+ align-items: center;
81
+ width: 100%;
82
+ }
83
+
84
+ div:before {
85
+ content: "";
86
+ flex-grow: 1;
87
+ border-top: var(--sc-divider-border-width) var(--sc-divider-border-style) var(--sc-divider-border-color);
88
+ width: 100%;
89
+ }
90
+
91
+ div:after {
92
+ content: "";
93
+ flex-grow: 1;
94
+ border-top: var(--sc-divider-border-width) var(--sc-divider-border-style) var(--sc-divider-border-color);
95
+ width: 100%;
96
+ }
97
+
98
+ /*ALIGNEMENT*/
99
+ :host([align="left"]) div:before {
100
+ display: none;
101
+ }
102
+
103
+ :host([align="right"]) div:after {
104
+ display: none;
105
+ }
106
+
107
+ /*TEXT*/
108
+ .text {
109
+ flex-shrink: 0;
110
+ max-width: 80%;
111
+ }
112
+
113
+ .no-text .text {
114
+ display: none;
115
+ }
116
+
117
+ .has-text {
118
+ gap: 0.5rem;
119
+ }
120
+ `,
121
+ ];
122
+ __decorate([
123
+ queryAssignedNodes()
124
+ ], Divider.prototype, "slotNodes", void 0);
125
+ __decorate([
126
+ query("div")
127
+ ], Divider.prototype, "divider", void 0);
128
+ __decorate([
129
+ property({ type: String })
130
+ ], Divider.prototype, "label", void 0);
131
+ __decorate([
132
+ property({ type: String, reflect: true })
133
+ ], Divider.prototype, "size", void 0);
134
+ __decorate([
135
+ property({ type: String, reflect: true })
136
+ ], Divider.prototype, "align", void 0);
137
+ Divider = __decorate([
138
+ customElement("sonic-divider")
139
+ ], Divider);
140
+ export { Divider };
141
+ try {
142
+ customElements.define("sonic-divider", Divider);
143
+ }
144
+ catch (e) { }