@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.
- 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,325 @@
|
|
|
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, nothing } from "lit";
|
|
8
|
+
import { customElement, property, queryAssignedElements, query } from "lit/decorators.js";
|
|
9
|
+
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
|
+
import { animate, fadeIn, fadeOut } from "@lit-labs/motion";
|
|
11
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
12
|
+
import "./modal-actions";
|
|
13
|
+
import "./modal-title";
|
|
14
|
+
import "./modal-subtitle";
|
|
15
|
+
import "./modal-content";
|
|
16
|
+
import "./modal-close";
|
|
17
|
+
let Modal = class Modal extends Subscriber(LitElement) {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.hideOnOverlayClick = true;
|
|
21
|
+
this.hideOnEscape = true;
|
|
22
|
+
this.align = "center";
|
|
23
|
+
this.padding = "var(--sc-modal-py) var(--sc-modal-px)";
|
|
24
|
+
this.maxWidth = "var(--sc-modal-max-w) ";
|
|
25
|
+
this.maxHeight = "var(--sc-modal-max-h) ";
|
|
26
|
+
this.width = "100%";
|
|
27
|
+
this.height = "auto";
|
|
28
|
+
this.fullScreen = false;
|
|
29
|
+
this.visible = false;
|
|
30
|
+
}
|
|
31
|
+
static create(options) {
|
|
32
|
+
const modal = document.createElement("sonic-modal");
|
|
33
|
+
modal.innerHTML =
|
|
34
|
+
`<sonic-modal-close></sonic-modal-close><sonic-modal-content>${options.content}</sonic-modal-content>` || "";
|
|
35
|
+
let container = document.querySelector("sonic-theme") || document.body;
|
|
36
|
+
container.appendChild(modal);
|
|
37
|
+
modal.show();
|
|
38
|
+
return modal;
|
|
39
|
+
}
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
super.connectedCallback();
|
|
42
|
+
}
|
|
43
|
+
updated() {
|
|
44
|
+
const currentModal = this;
|
|
45
|
+
document.addEventListener("keydown", this.handleEscape);
|
|
46
|
+
currentModal.closeBtn.forEach((closeBtn) => {
|
|
47
|
+
closeBtn.addEventListener("click", function () {
|
|
48
|
+
currentModal.hide();
|
|
49
|
+
}, { once: true });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
if (this.visible == false)
|
|
54
|
+
return nothing;
|
|
55
|
+
this.handleFullsceen();
|
|
56
|
+
const modalStyles = {
|
|
57
|
+
padding: this.padding,
|
|
58
|
+
maxWidth: this.maxWidth,
|
|
59
|
+
maxHeight: this.maxHeight,
|
|
60
|
+
width: this.width,
|
|
61
|
+
height: this.height,
|
|
62
|
+
borderRadius: this.fullScreen ? "0" : "var(--sc-modal-rounded)",
|
|
63
|
+
};
|
|
64
|
+
const modalWrapperStyles = {
|
|
65
|
+
maxWidth: this.maxWidth,
|
|
66
|
+
maxHeight: this.maxHeight,
|
|
67
|
+
width: this.width,
|
|
68
|
+
height: this.height,
|
|
69
|
+
borderRadius: this.fullScreen ? "0" : "var(--sc-modal-rounded)",
|
|
70
|
+
};
|
|
71
|
+
return html `<div
|
|
72
|
+
class="modal-wrapper"
|
|
73
|
+
style=${styleMap(modalWrapperStyles)}
|
|
74
|
+
${animate({
|
|
75
|
+
out: fadeOut,
|
|
76
|
+
})}
|
|
77
|
+
tabindex="0"
|
|
78
|
+
>
|
|
79
|
+
<div
|
|
80
|
+
part="modal"
|
|
81
|
+
class="modal"
|
|
82
|
+
style=${styleMap(modalStyles)}
|
|
83
|
+
${animate({
|
|
84
|
+
keyframeOptions: {
|
|
85
|
+
duration: 400,
|
|
86
|
+
easing: `cubic-bezier(0.250, 0.250, 0.420, 1.225)`,
|
|
87
|
+
},
|
|
88
|
+
in: [{ transform: "translateY(25%) scale(1)", boxShadow: "0 0 0 rgba(0,0,0,0)", opacity: 0 }],
|
|
89
|
+
out: [{ transform: "translateY(20%) scale(1)", boxShadow: "0 0 0 rgba(0,0,0,0)", opacity: 0 }],
|
|
90
|
+
})}
|
|
91
|
+
>
|
|
92
|
+
<div class="modal-content">
|
|
93
|
+
<slot></slot>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<div
|
|
99
|
+
class="overlay"
|
|
100
|
+
@click="${this.hideOnOverlayClick ? this.hide : ""}"
|
|
101
|
+
${animate({
|
|
102
|
+
keyframeOptions: {
|
|
103
|
+
duration: 500,
|
|
104
|
+
},
|
|
105
|
+
in: fadeIn,
|
|
106
|
+
out: [{ opacity: 0, pointerEvents: "none" }],
|
|
107
|
+
})}
|
|
108
|
+
></div>`;
|
|
109
|
+
}
|
|
110
|
+
show() {
|
|
111
|
+
var _a, _b;
|
|
112
|
+
this.visible = true;
|
|
113
|
+
(_a = this.modalElement) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", "0");
|
|
114
|
+
(_b = this.modalElement) === null || _b === void 0 ? void 0 : _b.focus();
|
|
115
|
+
this.dispatchEvent(new CustomEvent("show"));
|
|
116
|
+
}
|
|
117
|
+
hide() {
|
|
118
|
+
var _a;
|
|
119
|
+
this.visible = false;
|
|
120
|
+
(_a = this.modalElement) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", "-1");
|
|
121
|
+
this.dispatchEvent(new CustomEvent("hide"));
|
|
122
|
+
}
|
|
123
|
+
dispose() {
|
|
124
|
+
this.hide();
|
|
125
|
+
this.remove();
|
|
126
|
+
}
|
|
127
|
+
handleEscape(e) {
|
|
128
|
+
if (e.key === "Escape") {
|
|
129
|
+
const modals = [...document.querySelectorAll("sonic-modal")];
|
|
130
|
+
modals.forEach((item) => {
|
|
131
|
+
if (this.hideOnEscape == true) {
|
|
132
|
+
item.hide();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
handleFullsceen() {
|
|
138
|
+
// set fullscreen
|
|
139
|
+
if (this.fullScreen) {
|
|
140
|
+
this.width = "100%";
|
|
141
|
+
this.height = "100%";
|
|
142
|
+
this.maxWidth = "none";
|
|
143
|
+
this.maxHeight = "none";
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
Modal.styles = [
|
|
148
|
+
css `
|
|
149
|
+
:host {
|
|
150
|
+
--sc-modal-py: 2.5rem;
|
|
151
|
+
--sc-modal-px: 1.5rem;
|
|
152
|
+
--sc-modal-content: var(--sc-base-content);
|
|
153
|
+
--sc-modal-bg: var(--sc-base);
|
|
154
|
+
--sc-modal-max-w: min(100vw, 64ch);
|
|
155
|
+
--sc-modal-max-h: 80vh;
|
|
156
|
+
--sc-modal-scrollbar-bg: var(--sc-base-300);
|
|
157
|
+
--sc-modal-rounded: var(--sc-rounded-lg);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
* {
|
|
161
|
+
box-sizing: border-box;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.modal-wrapper {
|
|
165
|
+
position: fixed;
|
|
166
|
+
bottom: 0;
|
|
167
|
+
left: 0;
|
|
168
|
+
width: 100%;
|
|
169
|
+
z-index: 990;
|
|
170
|
+
text-align: center;
|
|
171
|
+
align-items: center;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
flex-direction: column;
|
|
174
|
+
display: flex;
|
|
175
|
+
pointer-events: none;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/*SCROLLBAR*/
|
|
179
|
+
.modal-content::-webkit-scrollbar-track {
|
|
180
|
+
z-index: 20;
|
|
181
|
+
background-color: transparent;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.modal-content::-webkit-scrollbar {
|
|
185
|
+
width: 0.9rem;
|
|
186
|
+
background-color: transparent;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.modal-content::-webkit-scrollbar-thumb {
|
|
190
|
+
background-color: var(--sc-modal-scrollbar-bg);
|
|
191
|
+
border: 0.3rem solid rgba(0, 0, 0, 0);
|
|
192
|
+
background-clip: padding-box;
|
|
193
|
+
border-radius: var(--sc-modal-rounded);
|
|
194
|
+
}
|
|
195
|
+
.modal-content {
|
|
196
|
+
overflow-y: auto;
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-direction: column;
|
|
199
|
+
text-align: center;
|
|
200
|
+
align-items: center;
|
|
201
|
+
min-height: 10rem;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.modal {
|
|
205
|
+
background: var(--sc-base);
|
|
206
|
+
width: 100%;
|
|
207
|
+
box-shadow: var(--sc-shadow-lg);
|
|
208
|
+
border-radius: var(--sc-modal-rounded) var(--sc-modal-rounded) 0 0;
|
|
209
|
+
pointer-events: auto;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
transform: translateZ(0);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.overlay {
|
|
215
|
+
background: var(--sc-base-200);
|
|
216
|
+
left: 0;
|
|
217
|
+
top: 0;
|
|
218
|
+
right: 0;
|
|
219
|
+
bottom: 0;
|
|
220
|
+
z-index: 900;
|
|
221
|
+
opacity: 0.8;
|
|
222
|
+
position: fixed;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
::slotted(sonic-modal-title) {
|
|
226
|
+
margin-bottom: 1rem;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
::slotted(sonic-modal-subtitle) {
|
|
230
|
+
margin-top: -0.45rem;
|
|
231
|
+
margin-bottom: 1rem;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@media (max-width: 767.5px) {
|
|
235
|
+
.modal-wrapper,
|
|
236
|
+
.modal {
|
|
237
|
+
max-width: none !important;
|
|
238
|
+
width: 100% !important;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@media (min-width: 768px) {
|
|
243
|
+
.modal-wrapper {
|
|
244
|
+
top: 50%;
|
|
245
|
+
left: 50%;
|
|
246
|
+
bottom: auto;
|
|
247
|
+
right: auto;
|
|
248
|
+
transform: translateX(-50%) translateY(-50%);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.modal {
|
|
252
|
+
top: 50%;
|
|
253
|
+
bottom: auto;
|
|
254
|
+
right: auto;
|
|
255
|
+
border-radius: var(--sc-modal-rounded);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
:host([align="left"]) .modal-content {
|
|
260
|
+
text-align: left;
|
|
261
|
+
align-items: flex-start;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
:host([align="right"]) .modal-content {
|
|
265
|
+
text-align: right;
|
|
266
|
+
align-items: flex-end;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* Border radius */
|
|
270
|
+
:host([rounded="none"]) modal {
|
|
271
|
+
--sc-img-radius: 0 !important;
|
|
272
|
+
}
|
|
273
|
+
`,
|
|
274
|
+
];
|
|
275
|
+
__decorate([
|
|
276
|
+
property({ type: Boolean, reflect: true })
|
|
277
|
+
], Modal.prototype, "hideOnOverlayClick", void 0);
|
|
278
|
+
__decorate([
|
|
279
|
+
property({ type: Boolean, reflect: true })
|
|
280
|
+
], Modal.prototype, "hideOnEscape", void 0);
|
|
281
|
+
__decorate([
|
|
282
|
+
property({ type: String, reflect: true })
|
|
283
|
+
], Modal.prototype, "align", void 0);
|
|
284
|
+
__decorate([
|
|
285
|
+
property({ type: String })
|
|
286
|
+
], Modal.prototype, "padding", void 0);
|
|
287
|
+
__decorate([
|
|
288
|
+
property({ type: String })
|
|
289
|
+
], Modal.prototype, "maxWidth", void 0);
|
|
290
|
+
__decorate([
|
|
291
|
+
property({ type: String })
|
|
292
|
+
], Modal.prototype, "maxHeight", void 0);
|
|
293
|
+
__decorate([
|
|
294
|
+
property({ type: String })
|
|
295
|
+
], Modal.prototype, "width", void 0);
|
|
296
|
+
__decorate([
|
|
297
|
+
property({ type: String })
|
|
298
|
+
], Modal.prototype, "height", void 0);
|
|
299
|
+
__decorate([
|
|
300
|
+
property({ type: Boolean, reflect: true })
|
|
301
|
+
], Modal.prototype, "fullScreen", void 0);
|
|
302
|
+
__decorate([
|
|
303
|
+
property({ type: Boolean, reflect: true })
|
|
304
|
+
], Modal.prototype, "visible", void 0);
|
|
305
|
+
__decorate([
|
|
306
|
+
query(".modal-wrapper")
|
|
307
|
+
], Modal.prototype, "modalWrapper", void 0);
|
|
308
|
+
__decorate([
|
|
309
|
+
query(".modal")
|
|
310
|
+
], Modal.prototype, "modalElement", void 0);
|
|
311
|
+
__decorate([
|
|
312
|
+
queryAssignedElements({ selector: "sonic-modal-close" })
|
|
313
|
+
], Modal.prototype, "closeBtn", void 0);
|
|
314
|
+
Modal = __decorate([
|
|
315
|
+
customElement("sonic-modal")
|
|
316
|
+
], Modal);
|
|
317
|
+
export { Modal };
|
|
318
|
+
if (typeof window !== "undefined") {
|
|
319
|
+
let win = window;
|
|
320
|
+
win.SonicModal = Modal;
|
|
321
|
+
}
|
|
322
|
+
try {
|
|
323
|
+
customElements.define("sonic-modal", Modal);
|
|
324
|
+
}
|
|
325
|
+
catch (e) { }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare type PopPlacement = "bottom" | "top" | "right" | "left";
|
|
3
|
+
export declare class Pop extends LitElement {
|
|
4
|
+
static pops: Set<Pop>;
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
open: boolean;
|
|
7
|
+
popBtn: HTMLElement;
|
|
8
|
+
popContent: HTMLElement;
|
|
9
|
+
toggle: "true" | "false";
|
|
10
|
+
/**
|
|
11
|
+
* Ombre
|
|
12
|
+
*/
|
|
13
|
+
shadow: "" | "none" | "sm" | "md" | "lg";
|
|
14
|
+
placement: PopPlacement;
|
|
15
|
+
positioningRuns: boolean;
|
|
16
|
+
lastContentX: number;
|
|
17
|
+
lastContentY: number;
|
|
18
|
+
runPositioning(): void;
|
|
19
|
+
_toggle(e: any): void;
|
|
20
|
+
_show(): void;
|
|
21
|
+
_hide(): void;
|
|
22
|
+
_handleClosePop(e: Event): void;
|
|
23
|
+
connectedCallback(): void;
|
|
24
|
+
disconnectedCallback(): void;
|
|
25
|
+
_setUpMenu(placement: PopPlacement): void;
|
|
26
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,223 @@
|
|
|
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 Pop_1;
|
|
8
|
+
import { html, LitElement, css } from "lit";
|
|
9
|
+
import { customElement, query, state, property } from "lit/decorators.js";
|
|
10
|
+
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
11
|
+
let Pop = Pop_1 = class Pop extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.open = false;
|
|
15
|
+
this.toggle = "true";
|
|
16
|
+
/**
|
|
17
|
+
* Ombre
|
|
18
|
+
*/
|
|
19
|
+
this.shadow = "lg";
|
|
20
|
+
this.placement = "bottom";
|
|
21
|
+
this.positioningRuns = false;
|
|
22
|
+
this.lastContentX = Number.NaN;
|
|
23
|
+
this.lastContentY = Number.NaN;
|
|
24
|
+
}
|
|
25
|
+
runPositioning() {
|
|
26
|
+
if (!this.positioningRuns)
|
|
27
|
+
return;
|
|
28
|
+
this.positioningRuns = true;
|
|
29
|
+
this._setUpMenu(this.placement);
|
|
30
|
+
window.requestAnimationFrame(() => this.runPositioning());
|
|
31
|
+
}
|
|
32
|
+
_toggle(e) {
|
|
33
|
+
if (this.open && this.toggle == "false")
|
|
34
|
+
return;
|
|
35
|
+
if (e.type == "keydown" && (e.key != "ArrowDown" || this.open))
|
|
36
|
+
return;
|
|
37
|
+
this.open = !this.open;
|
|
38
|
+
this.open ? this._show() : this._hide();
|
|
39
|
+
}
|
|
40
|
+
_show() {
|
|
41
|
+
this.open = true;
|
|
42
|
+
this.popContent.setAttribute("tabindex", "0");
|
|
43
|
+
if (this.popBtn && this.popContent && !this.positioningRuns) {
|
|
44
|
+
this.positioningRuns = true;
|
|
45
|
+
this.lastContentX = Number.NaN;
|
|
46
|
+
this.lastContentY = Number.NaN;
|
|
47
|
+
this.runPositioning();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
_hide() {
|
|
51
|
+
this.open = false;
|
|
52
|
+
this.popContent.setAttribute("tabindex", "-1");
|
|
53
|
+
this.positioningRuns = false;
|
|
54
|
+
}
|
|
55
|
+
_handleClosePop(e) {
|
|
56
|
+
let target = e.target;
|
|
57
|
+
Pop_1.pops.forEach((pop) => {
|
|
58
|
+
var _a;
|
|
59
|
+
const popContainsTarget = pop.contains(target);
|
|
60
|
+
const popContentContainsTarget = (_a = pop.querySelector('[slot="content"]')) === null || _a === void 0 ? void 0 : _a.contains(target);
|
|
61
|
+
const isCloseManual = HTML.getAncestorAttributeValue(target, "data-on-select") === "keep";
|
|
62
|
+
if (e.type == "pointerdown" && popContainsTarget)
|
|
63
|
+
return;
|
|
64
|
+
if (e.type == "click" && ((popContainsTarget && isCloseManual) || !popContentContainsTarget))
|
|
65
|
+
return;
|
|
66
|
+
pop._hide();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
connectedCallback() {
|
|
70
|
+
super.connectedCallback();
|
|
71
|
+
if (Pop_1.pops.size == 0) {
|
|
72
|
+
document.addEventListener("pointerdown", this._handleClosePop);
|
|
73
|
+
document.addEventListener("click", this._handleClosePop);
|
|
74
|
+
}
|
|
75
|
+
Pop_1.pops.add(this);
|
|
76
|
+
}
|
|
77
|
+
disconnectedCallback() {
|
|
78
|
+
super.disconnectedCallback();
|
|
79
|
+
Pop_1.pops.delete(this);
|
|
80
|
+
if (Pop_1.pops.size == 0) {
|
|
81
|
+
document.removeEventListener("pointerdown", this._handleClosePop);
|
|
82
|
+
document.removeEventListener("click", this._handleClosePop);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
_setUpMenu(placement) {
|
|
86
|
+
var _a;
|
|
87
|
+
const contentRect = (_a = this.popContent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
88
|
+
const padding = 8;
|
|
89
|
+
const shiftPadding = 20;
|
|
90
|
+
const thisRect = this.getBoundingClientRect();
|
|
91
|
+
if (!this.offsetParent)
|
|
92
|
+
return;
|
|
93
|
+
let bodyRect = this.offsetParent.getBoundingClientRect();
|
|
94
|
+
let x0 = thisRect.left - bodyRect.left;
|
|
95
|
+
let y0 = thisRect.top - bodyRect.top;
|
|
96
|
+
let x = x0, y = y0;
|
|
97
|
+
let yTop = y0 - contentRect.height - padding;
|
|
98
|
+
let xLeft = x0 - contentRect.width - 2 * padding;
|
|
99
|
+
let xRight = x0 + thisRect.width + 2 * padding;
|
|
100
|
+
let yBottom = y0 + thisRect.height + padding;
|
|
101
|
+
switch (placement) {
|
|
102
|
+
case "bottom":
|
|
103
|
+
y = yBottom;
|
|
104
|
+
break;
|
|
105
|
+
case "top":
|
|
106
|
+
y = yTop;
|
|
107
|
+
break;
|
|
108
|
+
case "left":
|
|
109
|
+
x = xLeft;
|
|
110
|
+
break;
|
|
111
|
+
case "right":
|
|
112
|
+
x = xRight;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
let dxRight = window.innerWidth - xRight - bodyRect.left - contentRect.width - shiftPadding;
|
|
116
|
+
if (dxRight < 0 && placement === "right")
|
|
117
|
+
x = xLeft;
|
|
118
|
+
if (dxRight < 0 && ["top", "bottom"].includes(placement))
|
|
119
|
+
x = Math.max(x + dxRight, xLeft + thisRect.width);
|
|
120
|
+
let dxLeft = -bodyRect.left - xLeft;
|
|
121
|
+
if (dxLeft > shiftPadding && placement === "left")
|
|
122
|
+
x = xRight;
|
|
123
|
+
let dyBottom = window.innerHeight - yBottom - bodyRect.top - contentRect.height - shiftPadding;
|
|
124
|
+
if (dyBottom < 0 && placement === "bottom")
|
|
125
|
+
y = yTop;
|
|
126
|
+
if (dyBottom < 0 && ["left", "right"].includes(placement))
|
|
127
|
+
y = Math.max(y + dyBottom, yTop + thisRect.height);
|
|
128
|
+
let dyTop = -bodyRect.top - yTop;
|
|
129
|
+
if (dyTop > -shiftPadding && placement === "top")
|
|
130
|
+
y = yBottom;
|
|
131
|
+
this.lastContentX = x;
|
|
132
|
+
this.lastContentY = y;
|
|
133
|
+
Object.assign(this.popContent.style, {
|
|
134
|
+
left: `${x}px`,
|
|
135
|
+
top: `${y}px`,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
render() {
|
|
139
|
+
return html `
|
|
140
|
+
<slot @click=${this._toggle} @keydown=${this._toggle} class="contents"></slot>
|
|
141
|
+
<slot
|
|
142
|
+
name="content"
|
|
143
|
+
tabindex="-1"
|
|
144
|
+
part="content"
|
|
145
|
+
class="
|
|
146
|
+
${this.open ? "is-open" : ""}"
|
|
147
|
+
></slot>
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
Pop.pops = new Set();
|
|
152
|
+
Pop.styles = [
|
|
153
|
+
css `
|
|
154
|
+
:host {
|
|
155
|
+
display: inline-block;
|
|
156
|
+
vertical-align: middle;
|
|
157
|
+
}
|
|
158
|
+
slot[name="content"] {
|
|
159
|
+
background-color: var(--sc-base);
|
|
160
|
+
position: absolute;
|
|
161
|
+
z-index: 50;
|
|
162
|
+
display: block;
|
|
163
|
+
transform: translateY(1rem) scale(0.95);
|
|
164
|
+
opacity: 0;
|
|
165
|
+
pointer-events: none;
|
|
166
|
+
transition: 0.2s ease;
|
|
167
|
+
border-radius: min(calc(var(--sc-btn-rounded) * 2), 0.4em);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
slot[name="content"].is-open {
|
|
171
|
+
transform: translateY(0) scale(1);
|
|
172
|
+
opacity: 1;
|
|
173
|
+
pointer-events: auto;
|
|
174
|
+
transition: 0.2s cubic-bezier(0.25, 0.25, 0.42, 1.225);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/*OMBRE*/
|
|
178
|
+
:host([shadow]) slot[name="content"],
|
|
179
|
+
:host([shadow="md"]) slot[name="content"],
|
|
180
|
+
:host([shadow="true"]) slot[name="content"] {
|
|
181
|
+
box-shadow: var(--sc-shadow);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
:host([shadow="sm"]) slot[name="content"] {
|
|
185
|
+
box-shadow: var(--sc-shadow-sm);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
:host([shadow="none"]) slot[name="content"] {
|
|
189
|
+
box-shadow: none;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:host([shadow="lg"]) slot[name="content"] {
|
|
193
|
+
box-shadow: var(--sc-shadow-lg);
|
|
194
|
+
}
|
|
195
|
+
`,
|
|
196
|
+
];
|
|
197
|
+
__decorate([
|
|
198
|
+
state()
|
|
199
|
+
], Pop.prototype, "open", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
query("slot:not([name=content])")
|
|
202
|
+
], Pop.prototype, "popBtn", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
query("slot[name=content]")
|
|
205
|
+
], Pop.prototype, "popContent", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
property({ type: String })
|
|
208
|
+
], Pop.prototype, "toggle", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
property({ type: String, reflect: true })
|
|
211
|
+
], Pop.prototype, "shadow", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: String })
|
|
214
|
+
], Pop.prototype, "placement", void 0);
|
|
215
|
+
Pop = Pop_1 = __decorate([
|
|
216
|
+
customElement("sonic-pop")
|
|
217
|
+
], Pop);
|
|
218
|
+
export { Pop };
|
|
219
|
+
//Ajout pour la creation du cem notamment pour Storybook
|
|
220
|
+
try {
|
|
221
|
+
customElements.define("sonic-pop", Pop);
|
|
222
|
+
}
|
|
223
|
+
catch (e) { }
|
|
@@ -0,0 +1,46 @@
|
|
|
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 } from "lit";
|
|
8
|
+
import { customElement } from "lit/decorators.js";
|
|
9
|
+
import { Button } from "../button/button";
|
|
10
|
+
let Tab = class Tab extends Button {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
if (!this.hasAttribute("variant")) {
|
|
16
|
+
this.variant = "ghost";
|
|
17
|
+
}
|
|
18
|
+
super.connectedCallback();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
Tab.styles = [
|
|
22
|
+
Button.styles,
|
|
23
|
+
css `
|
|
24
|
+
:host {
|
|
25
|
+
--sc-tab-white-space : nowrap;
|
|
26
|
+
--sc-tab-flex-wrap : nowrap ;
|
|
27
|
+
flex-wrap:nowrap;
|
|
28
|
+
scroll-snap-align: start;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
button {
|
|
32
|
+
flex-wrap:var(--sc-tab-flex-wrap) !important;
|
|
33
|
+
white-space:var(--sc-tab-white-space);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
`,
|
|
37
|
+
];
|
|
38
|
+
Tab = __decorate([
|
|
39
|
+
customElement("sonic-tab")
|
|
40
|
+
], Tab);
|
|
41
|
+
export { Tab };
|
|
42
|
+
//Ajout pour Storybook
|
|
43
|
+
try {
|
|
44
|
+
customElements.define("sonic-tab", Tab);
|
|
45
|
+
}
|
|
46
|
+
catch (e) { }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from "lit";
|
|
2
|
+
import { ResizeController } from "@lit-labs/observers/resize_controller.js";
|
|
3
|
+
export declare class Tabs extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
size: "md" | "xs" | "sm" | "lg";
|
|
6
|
+
direction: "" | "row" | "column";
|
|
7
|
+
icon: boolean;
|
|
8
|
+
menu: HTMLElement;
|
|
9
|
+
_resizeController: ResizeController;
|
|
10
|
+
updated(_changedProperties: PropertyValues): void;
|
|
11
|
+
firstUpdated(): void;
|
|
12
|
+
_setChildrenSize(): void;
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
}
|