@supersoniks/concorde 1.0.5 → 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.
- package/README.md +16 -8
- package/cli.js +69 -0
- package/core/components/functional/date/date.d.ts +34 -0
- package/core/components/functional/date/date.js +187 -0
- package/core/components/functional/example/example.d.ts +7 -0
- package/core/components/functional/example/example.js +25 -0
- package/core/components/functional/fetch/fetch.d.ts +49 -0
- package/core/components/functional/fetch/fetch.js +38 -0
- package/core/components/functional/functional.d.ts +11 -0
- package/core/components/functional/functional.js +11 -0
- package/core/components/functional/if/if.d.ts +12 -0
- package/core/components/functional/if/if.js +43 -0
- package/core/components/functional/list/list.d.ts +67 -0
- package/core/components/functional/list/list.js +132 -0
- package/core/components/functional/queue/queue.d.ts +42 -0
- package/core/components/functional/queue/queue.js +184 -0
- package/core/components/functional/router/redirect.d.ts +18 -0
- package/core/components/functional/router/redirect.js +57 -0
- package/core/components/functional/router/router.d.ts +26 -0
- package/core/components/functional/router/router.js +104 -0
- package/core/components/functional/states/states.d.ts +28 -0
- package/core/components/functional/states/states.js +139 -0
- package/core/components/functional/submit/submit.d.ts +24 -0
- package/core/components/functional/submit/submit.js +108 -0
- package/{types/core/components → core/components/functional/subscriber}/subscriber.d.ts +5 -1
- package/core/components/functional/subscriber/subscriber.js +30 -0
- package/core/components/ui/alert/alert.d.ts +20 -0
- package/core/components/ui/alert/alert.js +150 -0
- package/core/components/ui/badge/badge.d.ts +24 -0
- package/core/components/ui/badge/badge.js +177 -0
- package/core/components/ui/button/button.d.ts +125 -0
- package/core/components/ui/button/button.js +558 -0
- package/core/components/ui/divider/divider.d.ts +11 -0
- package/core/components/ui/divider/divider.js +144 -0
- package/core/components/ui/form/checkbox/checkbox.d.ts +120 -0
- package/core/components/ui/form/checkbox/checkbox.js +203 -0
- package/core/components/ui/form/css/form-control.d.ts +1 -0
- package/core/components/ui/form/css/form-control.js +219 -0
- package/core/components/ui/form/fieldset/fieldset.d.ts +15 -0
- package/core/components/ui/form/fieldset/fieldset.js +70 -0
- package/core/components/ui/form/fieldset/legend.d.ts +11 -0
- package/core/components/ui/form/fieldset/legend.js +92 -0
- package/core/components/ui/form/form-layout/form-actions.d.ts +6 -0
- package/core/components/ui/form/form-layout/form-actions.js +23 -0
- package/core/components/ui/form/form-layout/form-layout.d.ts +9 -0
- package/core/components/ui/form/form-layout/form-layout.js +58 -0
- package/core/components/ui/form/input/input.d.ts +84 -0
- package/core/components/ui/form/input/input.js +180 -0
- package/core/components/ui/form/radio/radio.d.ts +12 -0
- package/core/components/ui/form/radio/radio.js +55 -0
- package/core/components/ui/form/select/select.d.ts +39 -0
- package/core/components/ui/form/select/select.js +220 -0
- package/core/components/ui/form/textarea/textarea.d.ts +69 -0
- package/core/components/ui/form/textarea/textarea.js +150 -0
- package/core/components/ui/group/group.d.ts +6 -0
- package/core/components/ui/group/group.js +57 -0
- package/core/components/ui/icon/icon.d.ts +17 -0
- package/core/components/ui/icon/icon.js +93 -0
- package/core/components/ui/icon/icons.d.ts +13 -0
- package/core/components/ui/icon/icons.js +25 -0
- package/core/components/ui/icon/icons.json +1 -0
- package/core/components/ui/image/image.d.ts +14 -0
- package/core/components/ui/image/image.js +152 -0
- package/core/components/ui/link/link.d.ts +16 -0
- package/core/components/ui/link/link.js +70 -0
- package/core/components/ui/loader/loader.d.ts +20 -0
- package/core/components/ui/loader/loader.js +94 -0
- package/{types → core}/components/ui/loader/styles/fixed.d.ts +0 -0
- package/core/components/ui/loader/styles/fixed.js +57 -0
- package/{types → core}/components/ui/loader/styles/inline.d.ts +0 -0
- package/core/components/ui/loader/styles/inline.js +71 -0
- package/core/components/ui/menu/menu-item.d.ts +5 -0
- package/core/components/ui/menu/menu-item.js +37 -0
- package/core/components/ui/menu/menu.d.ts +26 -0
- package/core/components/ui/menu/menu.js +125 -0
- package/core/components/ui/modal/modal-actions.d.ts +7 -0
- package/core/components/ui/modal/modal-actions.js +46 -0
- package/core/components/ui/modal/modal-close.d.ts +6 -0
- package/core/components/ui/modal/modal-close.js +38 -0
- package/core/components/ui/modal/modal-content.d.ts +5 -0
- package/core/components/ui/modal/modal-content.js +29 -0
- package/core/components/ui/modal/modal-subtitle.d.ts +5 -0
- package/core/components/ui/modal/modal-subtitle.js +33 -0
- package/core/components/ui/modal/modal-title.d.ts +5 -0
- package/core/components/ui/modal/modal-title.js +33 -0
- package/core/components/ui/modal/modal.d.ts +36 -0
- package/core/components/ui/modal/modal.js +325 -0
- package/core/components/ui/pop/pop.d.ts +28 -0
- package/core/components/ui/pop/pop.js +223 -0
- package/core/components/ui/tabs/tab.d.ts +6 -0
- package/core/components/ui/tabs/tab.js +46 -0
- package/core/components/ui/tabs/tabs.d.ts +14 -0
- package/core/components/ui/tabs/tabs.js +127 -0
- package/core/components/ui/taxonomy/taxonomy.d.ts +41 -0
- package/core/components/ui/taxonomy/taxonomy.js +113 -0
- package/core/components/ui/theme/css/tailwind.css +3 -0
- package/core/components/ui/theme/css/tailwind.d.ts +2 -0
- package/core/components/ui/theme/theme-collection/core-variables.d.ts +1 -0
- package/core/components/ui/theme/theme-collection/core-variables.js +50 -0
- package/{types/components → core/components/ui}/theme/theme-collection/dark.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/dark.js +41 -0
- package/{types/components → core/components/ui}/theme/theme-collection/light.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/light.js +35 -0
- package/core/components/ui/theme/theme.d.ts +11 -0
- package/core/components/ui/theme/theme.js +105 -0
- package/core/components/ui/toast/message-subscriber.d.ts +17 -0
- package/core/components/ui/toast/message-subscriber.js +85 -0
- package/{types → core}/components/ui/toast/toast.d.ts +10 -8
- package/core/components/ui/toast/toast.js +260 -0
- package/core/components/ui/tooltip/tooltip.d.ts +7 -0
- package/core/components/ui/tooltip/tooltip.js +68 -0
- package/core/components/ui/ui.d.ts +27 -0
- package/core/components/ui/ui.js +34 -0
- package/core/core.d.ts +3 -0
- package/core/core.js +7 -0
- package/core/mixins/Fetcher.d.ts +69 -0
- package/core/mixins/Fetcher.js +147 -0
- package/core/mixins/FormCheckable.d.ts +72 -0
- package/core/mixins/FormCheckable.js +144 -0
- package/core/mixins/FormElement.d.ts +21 -0
- package/core/mixins/FormElement.js +229 -0
- package/core/mixins/FormInput.d.ts +49 -0
- package/core/mixins/FormInput.js +33 -0
- package/core/mixins/Subscriber.d.ts +30 -0
- package/core/mixins/Subscriber.js +379 -0
- package/core/mixins/TemplatesContainer.d.ts +12 -0
- package/core/mixins/TemplatesContainer.js +60 -0
- package/core/mixins/mixins.d.ts +6 -0
- package/core/mixins/mixins.js +6 -0
- package/core/utils/Arrays.d.ts +97 -0
- package/core/utils/Arrays.js +136 -0
- package/core/utils/DataBindObserver.d.ts +74 -0
- package/core/utils/DataBindObserver.js +252 -0
- package/core/utils/Format.d.ts +11 -0
- package/core/utils/Format.js +22 -0
- package/core/utils/HTML.d.ts +13 -0
- package/core/utils/HTML.js +26 -0
- package/core/utils/LocationHandler.d.ts +44 -0
- package/core/utils/LocationHandler.js +96 -0
- package/core/utils/Objects.d.ts +23 -0
- package/core/utils/Objects.js +63 -0
- package/core/utils/PublisherProxy.d.mts +110 -0
- package/core/utils/PublisherProxy.mjs +365 -0
- package/core/utils/api.d.ts +66 -0
- package/core/utils/api.js +145 -0
- package/package.json +179 -21
- package/LICENSE +0 -43
- package/dist/concorde.bundle.js +0 -3620
- package/types/components/event/event-card/event-card.d.ts +0 -10
- package/types/components/event/event-title/event-title.d.ts +0 -7
- package/types/components/event/event.d.ts +0 -8
- package/types/components/giftcards/giftcard/giftcard.d.ts +0 -15
- package/types/components/illustration/illustration.d.ts +0 -16
- package/types/components/product/prices-form/price-button/price-button.d.ts +0 -25
- package/types/components/product/prices-form/prices-form.d.ts +0 -23
- package/types/components/theme/theme-collection/bootstrap5.d.ts +0 -1
- package/types/components/theme/theme-collection/dracula.d.ts +0 -1
- package/types/components/theme/theme.d.ts +0 -8
- package/types/components/ui/button/button.d.ts +0 -13
- package/types/components/ui/loader/loader.d.ts +0 -15
- package/types/components/ui/modal/modal.d.ts +0 -17
- package/types/components/ui/tooltip/tooltip.d.ts +0 -9
- package/types/core/components/fetch.d.ts +0 -6
- package/types/core/components/list.d.ts +0 -9
- package/types/core/components/queue.d.ts +0 -15
- package/types/core/components/taxonomy.d.ts +0 -13
- package/types/core/components/text-formatted.d.ts +0 -15
- package/types/core/components/text.d.ts +0 -9
- package/types/core/core.d.ts +0 -7
- package/types/core/mixins/Fetcher.d.ts +0 -9
- package/types/core/mixins/Subscriber.d.ts +0 -13
- package/types/core/utils/api.d.ts +0 -16
- package/types/index.d.ts +0 -12
- package/types/styles/button/button.d.ts +0 -1
- package/types/styles/prose/prose.d.ts +0 -2
|
@@ -0,0 +1,127 @@
|
|
|
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, query } from "lit/decorators.js";
|
|
9
|
+
import { ResizeController } from "@lit-labs/observers/resize_controller.js";
|
|
10
|
+
import { tailwind } from "../theme/theme";
|
|
11
|
+
let Tabs = class Tabs extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.size = "md";
|
|
15
|
+
this.direction = "column";
|
|
16
|
+
this.icon = false;
|
|
17
|
+
this._resizeController = new ResizeController(this, {});
|
|
18
|
+
}
|
|
19
|
+
updated(_changedProperties) {
|
|
20
|
+
super.updated(_changedProperties);
|
|
21
|
+
this._setChildrenSize();
|
|
22
|
+
}
|
|
23
|
+
firstUpdated() {
|
|
24
|
+
const tabsMenu = this.menu;
|
|
25
|
+
let isDown = false;
|
|
26
|
+
let startX;
|
|
27
|
+
let scrollLeft;
|
|
28
|
+
tabsMenu.addEventListener("mousedown", (e) => {
|
|
29
|
+
isDown = true;
|
|
30
|
+
tabsMenu.classList.add("active");
|
|
31
|
+
startX = e.pageX - tabsMenu.offsetLeft;
|
|
32
|
+
scrollLeft = tabsMenu.scrollLeft;
|
|
33
|
+
});
|
|
34
|
+
tabsMenu.addEventListener("mouseleave", () => {
|
|
35
|
+
isDown = false;
|
|
36
|
+
tabsMenu.classList.remove("active");
|
|
37
|
+
});
|
|
38
|
+
tabsMenu.addEventListener("mouseup", () => {
|
|
39
|
+
isDown = false;
|
|
40
|
+
tabsMenu.classList.remove("active");
|
|
41
|
+
});
|
|
42
|
+
tabsMenu.addEventListener("mousemove", (e) => {
|
|
43
|
+
if (!isDown)
|
|
44
|
+
return;
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
const x = e.pageX - tabsMenu.offsetLeft;
|
|
47
|
+
const walk = (x - startX) * 1.5; //scroll-fast
|
|
48
|
+
tabsMenu.scrollLeft = scrollLeft - walk;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
_setChildrenSize() {
|
|
52
|
+
if (this.size) {
|
|
53
|
+
const children = this.querySelectorAll("sonic-button, sonic-tabs-item");
|
|
54
|
+
children.forEach((elt) => {
|
|
55
|
+
if (!elt.hasAttribute("size")) {
|
|
56
|
+
elt.setAttribute("size", this.size);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
return html `<menu part="tabs"
|
|
63
|
+
><slot></slot>
|
|
64
|
+
<sonic-pop class="flex" >
|
|
65
|
+
<sonic-tab >
|
|
66
|
+
<sonic-icon prefix="iconoir" class="my-auto" size="xl" name="more-vert"></sonic-icon>
|
|
67
|
+
</sonic-tab>
|
|
68
|
+
<sonic-menu slot="content"></sonic-menu>
|
|
69
|
+
<sonic-pop>
|
|
70
|
+
</menu>`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
Tabs.styles = [
|
|
74
|
+
tailwind,
|
|
75
|
+
css `
|
|
76
|
+
:host {
|
|
77
|
+
display: block;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
menu::-webkit-scrollbar {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
menu {
|
|
85
|
+
-ms-overflow-style: none;
|
|
86
|
+
scrollbar-width: none;
|
|
87
|
+
overflow-x: scroll;
|
|
88
|
+
display: flex;
|
|
89
|
+
max-width: 100%;
|
|
90
|
+
flex-direction: row;
|
|
91
|
+
padding: 0.5em;
|
|
92
|
+
margin: 0;
|
|
93
|
+
gap: 0.15rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host([icon]) {
|
|
97
|
+
--sc-icon-size: 1.6em;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
:host([icon]) ::slotted(sonic-tab) {
|
|
101
|
+
font-size: 85em;
|
|
102
|
+
border: 7px solid;
|
|
103
|
+
text-transform: uppercase;
|
|
104
|
+
}
|
|
105
|
+
`,
|
|
106
|
+
];
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ type: String, reflect: true })
|
|
109
|
+
], Tabs.prototype, "size", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: String, reflect: true })
|
|
112
|
+
], Tabs.prototype, "direction", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
property({ type: Boolean, reflect: true })
|
|
115
|
+
], Tabs.prototype, "icon", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
query("menu")
|
|
118
|
+
], Tabs.prototype, "menu", void 0);
|
|
119
|
+
Tabs = __decorate([
|
|
120
|
+
customElement("sonic-tabs")
|
|
121
|
+
], Tabs);
|
|
122
|
+
export { Tabs };
|
|
123
|
+
//Ajout pour la creation du cem notamment pour Storybook
|
|
124
|
+
try {
|
|
125
|
+
customElements.define("sonic-tabs", Tabs);
|
|
126
|
+
}
|
|
127
|
+
catch (e) { }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LitElement, nothing } from "lit";
|
|
2
|
+
import "../icon/icon";
|
|
3
|
+
import "../badge/badge";
|
|
4
|
+
/**
|
|
5
|
+
* Le composant taxonomy crée un badge (*sonic-badge*) contenant une liste de termes préfixés par une icone (*sonic-icon*) optionelle séparées par une chaine html séparatrice (*separator*)
|
|
6
|
+
*/
|
|
7
|
+
export declare class Taxonomy extends LitElement {
|
|
8
|
+
static styles: import("lit").CSSResult;
|
|
9
|
+
/**
|
|
10
|
+
* Identifiant d'icone passé en interne au composant *sonic-icon*
|
|
11
|
+
*/
|
|
12
|
+
icon: any;
|
|
13
|
+
/**
|
|
14
|
+
* Tableau d'objets de la forme :{*key*_name:*"Une taxonomie"*} ou *key* correspond à la valeur fournie à la propriété *key*.
|
|
15
|
+
* Dans ce cas *"une taxonomie"* sera un des termes affiches dans le composant.
|
|
16
|
+
*/
|
|
17
|
+
taxonomy: never[];
|
|
18
|
+
/**
|
|
19
|
+
* Chaque terme sera séparé par la valeur contenue dans cette propriété
|
|
20
|
+
*/
|
|
21
|
+
separator: string;
|
|
22
|
+
/**
|
|
23
|
+
* La clée utilisé pour extraire le terme de la donnée. (voir la propriété *taxonomy*)
|
|
24
|
+
*/
|
|
25
|
+
key: string;
|
|
26
|
+
/**
|
|
27
|
+
* Le type change surtout la couleur composant : voir *Badge*, *Button*
|
|
28
|
+
*/
|
|
29
|
+
type: "primary" | "warning" | "danger" | "success" | "info" | "default";
|
|
30
|
+
/**
|
|
31
|
+
* Le composant par defaut sans se paramètre à forte afordance
|
|
32
|
+
* * gost : composant super léger visuellement
|
|
33
|
+
* * outline : composant légé avec une bordure
|
|
34
|
+
*/
|
|
35
|
+
variant: "default" | "outline";
|
|
36
|
+
/**
|
|
37
|
+
* Taille du composant, implique notamment des modifications de typo et de marge interne
|
|
38
|
+
*/
|
|
39
|
+
size: "md" | "xs" | "sm" | "lg";
|
|
40
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
41
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
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 { css, html, LitElement, nothing } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
10
|
+
import "../icon/icon";
|
|
11
|
+
import "../badge/badge";
|
|
12
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
13
|
+
/**
|
|
14
|
+
* Le composant taxonomy crée un badge (*sonic-badge*) contenant une liste de termes préfixés par une icone (*sonic-icon*) optionelle séparées par une chaine html séparatrice (*separator*)
|
|
15
|
+
*/
|
|
16
|
+
let Taxonomy = class Taxonomy extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
/**
|
|
20
|
+
* Identifiant d'icone passé en interne au composant *sonic-icon*
|
|
21
|
+
*/
|
|
22
|
+
this.icon = {};
|
|
23
|
+
/**
|
|
24
|
+
* Tableau d'objets de la forme :{*key*_name:*"Une taxonomie"*} ou *key* correspond à la valeur fournie à la propriété *key*.
|
|
25
|
+
* Dans ce cas *"une taxonomie"* sera un des termes affiches dans le composant.
|
|
26
|
+
*/
|
|
27
|
+
this.taxonomy = [];
|
|
28
|
+
/**
|
|
29
|
+
* Chaque terme sera séparé par la valeur contenue dans cette propriété
|
|
30
|
+
*/
|
|
31
|
+
this.separator = ", ";
|
|
32
|
+
/**
|
|
33
|
+
* La clée utilisé pour extraire le terme de la donnée. (voir la propriété *taxonomy*)
|
|
34
|
+
*/
|
|
35
|
+
this.key = "";
|
|
36
|
+
/**
|
|
37
|
+
* Le type change surtout la couleur composant : voir *Badge*, *Button*
|
|
38
|
+
*/
|
|
39
|
+
this.type = "default";
|
|
40
|
+
/**
|
|
41
|
+
* Le composant par defaut sans se paramètre à forte afordance
|
|
42
|
+
* * gost : composant super léger visuellement
|
|
43
|
+
* * outline : composant légé avec une bordure
|
|
44
|
+
*/
|
|
45
|
+
this.variant = "default";
|
|
46
|
+
/**
|
|
47
|
+
* Taille du composant, implique notamment des modifications de typo et de marge interne
|
|
48
|
+
*/
|
|
49
|
+
this.size = "md";
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
if (!this.taxonomy)
|
|
53
|
+
return nothing;
|
|
54
|
+
let key = this.key + "_display";
|
|
55
|
+
let taxo = this.taxonomy.filter((elt) => elt != null && (elt[key] === true || elt[key] == "1" || !elt.hasOwnProperty(key)));
|
|
56
|
+
if (taxo.length === 0) {
|
|
57
|
+
this.style.display = "none";
|
|
58
|
+
return nothing;
|
|
59
|
+
}
|
|
60
|
+
this.style.removeProperty("display");
|
|
61
|
+
return html `
|
|
62
|
+
<sonic-badge type=${this.type} variant=${this.variant} size=${this.size}>
|
|
63
|
+
<sonic-icon slot="prefix" name=${this.icon.name} prefix=${this.icon.prefix}></sonic-icon>
|
|
64
|
+
<span class="taxonomy-list">
|
|
65
|
+
${repeat(taxo, (item) => item[this.key + "_id"], (item) => {
|
|
66
|
+
return html `<span> ${item[this.key + "_name"]}</span
|
|
67
|
+
><span class="sonic-taxonomy-separator">${unsafeHTML(this.separator)}</span>`;
|
|
68
|
+
})}
|
|
69
|
+
</span>
|
|
70
|
+
</sonic-badge>
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
Taxonomy.styles = css `
|
|
75
|
+
:host .sonic-taxonomy-separator:last-child {
|
|
76
|
+
display: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.taxonomy-list {
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-wrap: wrap;
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
__decorate([
|
|
85
|
+
property({ type: Object })
|
|
86
|
+
], Taxonomy.prototype, "icon", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
property({ type: Array })
|
|
89
|
+
], Taxonomy.prototype, "taxonomy", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
property({ type: String })
|
|
92
|
+
], Taxonomy.prototype, "separator", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ type: String })
|
|
95
|
+
], Taxonomy.prototype, "key", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
property({ type: String, reflect: true })
|
|
98
|
+
], Taxonomy.prototype, "type", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
property({ type: String, reflect: true })
|
|
101
|
+
], Taxonomy.prototype, "variant", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
property({ type: String, reflect: true })
|
|
104
|
+
], Taxonomy.prototype, "size", void 0);
|
|
105
|
+
Taxonomy = __decorate([
|
|
106
|
+
customElement("sonic-taxonomy")
|
|
107
|
+
], Taxonomy);
|
|
108
|
+
export { Taxonomy };
|
|
109
|
+
//Ajout pour la creation du cem notamment pour Storybook
|
|
110
|
+
try {
|
|
111
|
+
customElements.define("sonic-taxonomy", Taxonomy);
|
|
112
|
+
}
|
|
113
|
+
catch (e) { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const coreVariables: import("lit").CSSResult;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export const coreVariables = css `
|
|
3
|
+
:host {
|
|
4
|
+
/* --sc-rfs: 16px; */
|
|
5
|
+
|
|
6
|
+
/* polices*/
|
|
7
|
+
--sc-font-family-base: "neue-haas-unica", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
8
|
+
"Helvetica Neue", Arial, sans-serif;
|
|
9
|
+
--sc-font-weight-base: 400;
|
|
10
|
+
--sc-font-style-base: inherit;
|
|
11
|
+
|
|
12
|
+
--sc-headings-font-family: var(--sc-font-family-base);
|
|
13
|
+
--sc-headings-font-style: var(--sc-font-family-base);
|
|
14
|
+
--sc-headings-line-height: 1.1;
|
|
15
|
+
--sc-headings-font-weight: 700;
|
|
16
|
+
--sc-headings-text-transform: none;
|
|
17
|
+
|
|
18
|
+
/* Button*/
|
|
19
|
+
--sc-btn-font-weight: var(--sc-font-weight-base);
|
|
20
|
+
--sc-btn-font-family: var(--sc-font-family-base);
|
|
21
|
+
--sc-btn-font-style: var(--sc-font-weight-base);
|
|
22
|
+
|
|
23
|
+
/* ROUNDED*/
|
|
24
|
+
--sc-btn-rounded: 0.38em;
|
|
25
|
+
--sc-input-rounded: 0.38em;
|
|
26
|
+
|
|
27
|
+
--sc-rounded-sm: calc(var(--sc-rounded) * 0.5);
|
|
28
|
+
--sc-rounded: 0.35rem;
|
|
29
|
+
--sc-rounded-md: calc(var(--sc-rounded) * 1.8);
|
|
30
|
+
--sc-rounded-lg: calc(var(--sc-rounded) * 3.5);
|
|
31
|
+
--sc-rounded-xl: calc(var(--sc-rounded) * 7);
|
|
32
|
+
|
|
33
|
+
/* Placeholder */
|
|
34
|
+
--sc-placeholder-bg: rgba(17, 24, 39, 0.05);
|
|
35
|
+
|
|
36
|
+
/* Images*/
|
|
37
|
+
--sc-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
38
|
+
--sc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
39
|
+
--sc-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
40
|
+
--sc-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
41
|
+
--sc-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
|
|
42
|
+
|
|
43
|
+
/* formulaires*/
|
|
44
|
+
--sc-form-border-width: 0.1rem;
|
|
45
|
+
|
|
46
|
+
/*Couleurs -- textes sur images*/
|
|
47
|
+
--sc-contrast-content: #fff;
|
|
48
|
+
--sc-contrast: #0f172a;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
const darkCss = css `
|
|
3
|
+
--sc-primary: var(--sc-dark-primary, var(--sc-base-700));
|
|
4
|
+
--sc-info: var(--sc-dark-info, #3abff8);
|
|
5
|
+
--sc-danger: var(--sc-dark-danger, #f87272);
|
|
6
|
+
--sc-warning: var(--sc-dark-warning, #fbbd23);
|
|
7
|
+
--sc-success: var(--sc-dark-success, #36d399);
|
|
8
|
+
|
|
9
|
+
--sc-primary-content: var(--sc-dark-primary-content, #002b3d);
|
|
10
|
+
--sc-info-content: var(--sc-dark-info-content, #002b3d);
|
|
11
|
+
--sc-danger-content: var(--sc-dark-danger-content, #382800);
|
|
12
|
+
--sc-warning-content: var(--sc-dark-warning-content, #382800);
|
|
13
|
+
--sc-success-content: var(--sc-dark-success-content, #003320);
|
|
14
|
+
|
|
15
|
+
--sc-base: var(--sc-dark-base, #1f2937);
|
|
16
|
+
--sc-base-100: var(--sc-dark-base-100, #262f3d);
|
|
17
|
+
--sc-base-200: var(--sc-dark-base-200, #2c3543);
|
|
18
|
+
--sc-base-300: var(--sc-dark-base-300, #38414e);
|
|
19
|
+
--sc-base-400: var(--sc-dark-base-400, #515964);
|
|
20
|
+
--sc-base-500: var(--sc-dark-base-500, #828891);
|
|
21
|
+
--sc-base-600: var(--sc-dark-base-600, #b4b8be);
|
|
22
|
+
--sc-base-700: var(--sc-dark-base-700, #cdd0d5);
|
|
23
|
+
--sc-base-800: var(--sc-dark-base-800, #d9dce0);
|
|
24
|
+
--sc-base-900: var(--sc-dark-base-900, #e5e7eb);
|
|
25
|
+
--sc-base-content: var(--sc-dark-base-content, #e5e7eb);
|
|
26
|
+
|
|
27
|
+
--sc-input-border-color: var(--sc-dark-input-border-color, var(--sc-base-100));
|
|
28
|
+
--sc-input-bg: var(--sc-dark-input-bg, var(--sc-base-100));
|
|
29
|
+
--sc-input-color: var(--sc-dark-input-color, var(--sc-base-content));
|
|
30
|
+
`;
|
|
31
|
+
export const dark = css `
|
|
32
|
+
:host([theme="dark"]) {
|
|
33
|
+
${darkCss}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (prefers-color-scheme: dark) {
|
|
37
|
+
:host([theme="auto"]) {
|
|
38
|
+
${darkCss}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export const light = css `
|
|
3
|
+
:host {
|
|
4
|
+
/*Boutons*/
|
|
5
|
+
--sc-primary: var(--sc-base-800);
|
|
6
|
+
--sc-info: #2563eb;
|
|
7
|
+
--sc-danger: #f43f5e;
|
|
8
|
+
--sc-warning: #f97316;
|
|
9
|
+
--sc-success: #14b8a6;
|
|
10
|
+
|
|
11
|
+
--sc-primary-content: var(--sc-base);
|
|
12
|
+
--sc-info-content: var(--sc-base);
|
|
13
|
+
--sc-danger-content: var(--sc-base);
|
|
14
|
+
--sc-warning-content: var(--sc-base);
|
|
15
|
+
--sc-success-content: var(--sc-base);
|
|
16
|
+
|
|
17
|
+
/*Bases*/
|
|
18
|
+
--sc-base: #fff;
|
|
19
|
+
--sc-base-100: #f1f5f9;
|
|
20
|
+
--sc-base-200: #e2e8f0;
|
|
21
|
+
--sc-base-300: #cbd5e1;
|
|
22
|
+
--sc-base-400: #94a3b8;
|
|
23
|
+
--sc-base-500: #64748b;
|
|
24
|
+
--sc-base-600: #475569;
|
|
25
|
+
--sc-base-700: #334155;
|
|
26
|
+
--sc-base-800: #1e293b;
|
|
27
|
+
--sc-base-900: #0f172a;
|
|
28
|
+
--sc-base-content: var(--sc-base-700);
|
|
29
|
+
|
|
30
|
+
/*formulaires*/
|
|
31
|
+
--sc-input-border-color: var(--sc-base-100);
|
|
32
|
+
--sc-input-bg: var(--sc-base-100);
|
|
33
|
+
--sc-input-color: var(--sc-base-content);
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare const tailwind: import("lit").CSSResult;
|
|
3
|
+
export declare class Theme extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
postCSSVars(): void;
|
|
7
|
+
receiveMessage(event: any): void;
|
|
8
|
+
theme: string;
|
|
9
|
+
getCssVariables(): Record<string, string>;
|
|
10
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
var Theme_1;
|
|
8
|
+
import { html, LitElement, css, unsafeCSS } from "lit";
|
|
9
|
+
import { customElement, property } from "lit/decorators.js";
|
|
10
|
+
import { coreVariables } from "./theme-collection/core-variables";
|
|
11
|
+
import { light } from "./theme-collection/light";
|
|
12
|
+
import { dark } from "./theme-collection/dark";
|
|
13
|
+
import tailwindImport from "./css/tailwind.css?inline";
|
|
14
|
+
export const tailwind = css `
|
|
15
|
+
${unsafeCSS(tailwindImport)}
|
|
16
|
+
`;
|
|
17
|
+
let Theme = Theme_1 = class Theme extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.theme = "light";
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback();
|
|
24
|
+
window.addEventListener("message", (e) => this.receiveMessage(e), false);
|
|
25
|
+
this.postCSSVars();
|
|
26
|
+
}
|
|
27
|
+
postCSSVars() {
|
|
28
|
+
const stylesheets = document.styleSheets;
|
|
29
|
+
const ssLength = stylesheets.length;
|
|
30
|
+
let fontUrls = [];
|
|
31
|
+
for (let i = 0; i < ssLength; i++) {
|
|
32
|
+
let ss = stylesheets[i];
|
|
33
|
+
if (ss.href && (ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
|
|
34
|
+
fontUrls.push(ss.href);
|
|
35
|
+
}
|
|
36
|
+
document.querySelectorAll("iframe").forEach((elt) => {
|
|
37
|
+
var _a;
|
|
38
|
+
return (_a = elt.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
39
|
+
type: "SonicTheme",
|
|
40
|
+
variables: this.getCssVariables(),
|
|
41
|
+
fonts: fontUrls,
|
|
42
|
+
}, "*");
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
receiveMessage(event) {
|
|
46
|
+
let data = event.data;
|
|
47
|
+
if (!data.type || data.type != "GetSonicTheme")
|
|
48
|
+
return;
|
|
49
|
+
this.postCSSVars();
|
|
50
|
+
}
|
|
51
|
+
getCssVariables() {
|
|
52
|
+
let names = [];
|
|
53
|
+
let stylesheets = [...Theme_1.styles.map((s) => s.styleSheet), ...Array.from(document.styleSheets)];
|
|
54
|
+
for (let stylesheet of stylesheets) {
|
|
55
|
+
try {
|
|
56
|
+
let rules = stylesheet === null || stylesheet === void 0 ? void 0 : stylesheet.cssRules;
|
|
57
|
+
for (let rule of rules) {
|
|
58
|
+
if (!rule.style)
|
|
59
|
+
continue;
|
|
60
|
+
for (let name of rule.style) {
|
|
61
|
+
if (names.includes(name) || name.indexOf("--sc") !== 0)
|
|
62
|
+
continue;
|
|
63
|
+
names.push(name);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (e) { }
|
|
68
|
+
}
|
|
69
|
+
let style = window.getComputedStyle(this);
|
|
70
|
+
let result = {};
|
|
71
|
+
names.forEach((name) => (result[name] = style.getPropertyValue(name)));
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
return html `<slot></slot>`;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
Theme.styles = [
|
|
79
|
+
light,
|
|
80
|
+
dark,
|
|
81
|
+
coreVariables,
|
|
82
|
+
css `
|
|
83
|
+
:host([background]) {
|
|
84
|
+
display: block !important;
|
|
85
|
+
background: var(--sc-base) !important;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:host([color]) {
|
|
89
|
+
color: var(--sc-base-content);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:host([font]) {
|
|
93
|
+
font-family: var(--sc-font-family-base);
|
|
94
|
+
font-weight: var(--sc-font-weight-base);
|
|
95
|
+
font-style: var(--sc-font-style-base);
|
|
96
|
+
}
|
|
97
|
+
`,
|
|
98
|
+
];
|
|
99
|
+
__decorate([
|
|
100
|
+
property({ type: String, reflect: true })
|
|
101
|
+
], Theme.prototype, "theme", void 0);
|
|
102
|
+
Theme = Theme_1 = __decorate([
|
|
103
|
+
customElement("sonic-theme")
|
|
104
|
+
], Theme);
|
|
105
|
+
export { Theme };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare const MessageSubscriber_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
3
|
+
export declare class MessageSubscriber extends MessageSubscriber_base {
|
|
4
|
+
_messages: Array<any>;
|
|
5
|
+
success: boolean | null;
|
|
6
|
+
status: boolean | null;
|
|
7
|
+
get messages(): Array<any>;
|
|
8
|
+
set messages(value: Array<any>);
|
|
9
|
+
_message: string;
|
|
10
|
+
get message(): string;
|
|
11
|
+
set message(value: string);
|
|
12
|
+
_data: Record<string, any>[] | string;
|
|
13
|
+
get data(): string | Record<string, any>[];
|
|
14
|
+
set data(value: string | Record<string, any>[]);
|
|
15
|
+
render(): symbol;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { LitElement, nothing } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
|
+
import { SonicToast } from "./toast";
|
|
11
|
+
//Superbe mix de multples versions d'api.
|
|
12
|
+
let MessageSubscriber = class MessageSubscriber extends Subscriber(LitElement) {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this._messages = [];
|
|
16
|
+
this.success = null;
|
|
17
|
+
this.status = null;
|
|
18
|
+
this._message = "";
|
|
19
|
+
this._data = ""; //👍 quel plaisir mmmm.... 😭😭😭
|
|
20
|
+
}
|
|
21
|
+
get messages() {
|
|
22
|
+
return this._messages;
|
|
23
|
+
}
|
|
24
|
+
set messages(value) {
|
|
25
|
+
this._messages = value;
|
|
26
|
+
if (!this.messages)
|
|
27
|
+
return;
|
|
28
|
+
value.forEach((message) => {
|
|
29
|
+
if (message.type == "public")
|
|
30
|
+
SonicToast.add({ text: message.content, status: message.status });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
get message() {
|
|
34
|
+
return this._message;
|
|
35
|
+
}
|
|
36
|
+
set message(value) {
|
|
37
|
+
this._message = value;
|
|
38
|
+
if (!this.message)
|
|
39
|
+
return;
|
|
40
|
+
if (this.props.success !== false)
|
|
41
|
+
return;
|
|
42
|
+
if (this.props.public_message)
|
|
43
|
+
return;
|
|
44
|
+
//OUi OUi il faut afficher "message" que si success est parfaitement égal à false et qu'il n'y a rien dans public_message.
|
|
45
|
+
SonicToast.add({ text: this.message, status: "error" });
|
|
46
|
+
}
|
|
47
|
+
get data() {
|
|
48
|
+
return this._data;
|
|
49
|
+
}
|
|
50
|
+
set data(value) {
|
|
51
|
+
this._data = value;
|
|
52
|
+
const toastOptions = { text: "Votre produit a bien été ajouté", status: "success" };
|
|
53
|
+
if (Array.isArray(this.data) && this.props.success === true)
|
|
54
|
+
SonicToast.add(toastOptions);
|
|
55
|
+
if (this.data == "" && this.props.status === true)
|
|
56
|
+
SonicToast.add(toastOptions);
|
|
57
|
+
if (this.props.success !== false)
|
|
58
|
+
return;
|
|
59
|
+
if (this.props.public_message)
|
|
60
|
+
return;
|
|
61
|
+
SonicToast.add({ text: this.data, status: "error" });
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
return nothing;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
__decorate([
|
|
68
|
+
property({ type: Boolean })
|
|
69
|
+
], MessageSubscriber.prototype, "success", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
property({ type: Boolean })
|
|
72
|
+
], MessageSubscriber.prototype, "status", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: Array })
|
|
75
|
+
], MessageSubscriber.prototype, "messages", null);
|
|
76
|
+
__decorate([
|
|
77
|
+
property({ type: String })
|
|
78
|
+
], MessageSubscriber.prototype, "message", null);
|
|
79
|
+
__decorate([
|
|
80
|
+
property()
|
|
81
|
+
], MessageSubscriber.prototype, "data", null);
|
|
82
|
+
MessageSubscriber = __decorate([
|
|
83
|
+
customElement("sonic-toast-message-subscriber")
|
|
84
|
+
], MessageSubscriber);
|
|
85
|
+
export { MessageSubscriber };
|