@rededor/cura 1.0.0-alpha.0 → 1.0.0-alpha.2
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/dist/assets/assets/images/avatar/doctor-default.svg +8 -0
- package/dist/assets/assets/images/avatar/dora-default.svg +5 -0
- package/dist/assets/assets/images/avatar/patient-default.svg +12 -0
- package/dist/assets/assets/images/avatar/unit-default.svg +9 -0
- package/dist/assets/assets/images/logoCura.svg +15 -0
- package/dist/cjs/cura-accordion_9.cjs.entry.js +7 -7
- package/dist/cjs/cura-accordion_9.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-alert.cjs.entry.js +1 -1
- package/dist/cjs/cura-avatar.cjs.entry.js +1 -1
- package/dist/cjs/cura-button-outline.cjs.entry.js +3 -3
- package/dist/cjs/cura-button-outline.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-select.cjs.entry.js +3 -3
- package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-transparent_2.cjs.entry.js +3 -3
- package/dist/cjs/cura-button-transparent_2.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-calendar.cjs.entry.js +1 -1
- package/dist/cjs/cura-card.cjs.entry.js +1 -1
- package/dist/cjs/cura-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/cura-display.cjs.entry.js +2 -2
- package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js +2 -2
- package/dist/cjs/cura-dropdown-search-option.cjs.entry.js +17 -9
- package/dist/cjs/cura-dropdown-search-option.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-dropdown-search.cjs.entry.js +27 -11
- package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-icons-view.cjs.entry.js +1 -1
- package/dist/cjs/cura-loader-bar.cjs.entry.js +46 -0
- package/dist/cjs/cura-loader-bar.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-radio.cjs.entry.js +2 -2
- package/dist/cjs/cura-select_2.cjs.entry.js +5 -5
- package/dist/cjs/cura-switch.cjs.entry.js +2 -2
- package/dist/cjs/cura-toast.cjs.entry.js +106 -0
- package/dist/cjs/cura-toast.cjs.entry.js.map +1 -0
- package/dist/cjs/cura.cjs.js +3 -3
- package/dist/cjs/cura.cjs.js.map +1 -1
- package/dist/cjs/{index-5b63ff7a.js → index-98e7ba54.js} +46 -31
- package/dist/cjs/index-98e7ba54.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +4 -2
- package/dist/collection/components/buttons/cura-button/cura-button.js +6 -6
- package/dist/collection/components/buttons/cura-button/cura-button.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +6 -6
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +6 -6
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +6 -6
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js.map +1 -1
- package/dist/collection/components/cura-toast/cura-toast.css +161 -0
- package/dist/collection/components/cura-toast/cura-toast.js +261 -0
- package/dist/collection/components/cura-toast/cura-toast.js.map +1 -0
- package/dist/collection/components/cura-toast/cura-toast.stories.js +149 -0
- package/dist/collection/components/cura-toast/cura-toast.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.css +4 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js +33 -7
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js.map +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.js +10 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.css +6 -2
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +61 -9
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.stories.js +28 -4
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-label/cura-label.js +1 -1
- package/dist/collection/components/forms/cura-radio/cura-radio.js +1 -1
- package/dist/collection/components/forms/cura-select/cura-select.js +3 -3
- package/dist/collection/components/forms/cura-select-options/cura-select-option.js +1 -1
- package/dist/collection/components/forms/cura-switch/cura-switch.js +1 -1
- package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.css +21 -0
- package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.js +95 -0
- package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.js.map +1 -0
- package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.stories.js +54 -0
- package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.stories.js.map +1 -0
- package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +1 -1
- package/dist/collection/components/text/cura-display/cura-display.js +1 -1
- package/dist/collection/components/text/cura-heading/cura-heading.js +1 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +1 -1
- package/dist/components/cura-button-outline.js +3 -3
- package/dist/components/cura-button-outline.js.map +1 -1
- package/dist/components/cura-button-select.js +3 -3
- package/dist/components/cura-button-select.js.map +1 -1
- package/dist/components/cura-button-transparent2.js +3 -3
- package/dist/components/cura-button-transparent2.js.map +1 -1
- package/dist/components/cura-button.js +3 -3
- package/dist/components/cura-button.js.map +1 -1
- package/dist/components/cura-checkbox.js +1 -1
- package/dist/components/cura-display.js +1 -1
- package/dist/components/cura-dropdown-search-option-title.js +1 -1
- package/dist/components/cura-dropdown-search-option.js +17 -8
- package/dist/components/cura-dropdown-search-option.js.map +1 -1
- package/dist/components/cura-dropdown-search.js +28 -10
- package/dist/components/cura-dropdown-search.js.map +1 -1
- package/dist/components/cura-heading2.js +1 -1
- package/dist/components/cura-label2.js +1 -1
- package/dist/components/cura-loader-bar.d.ts +11 -0
- package/dist/components/cura-loader-bar.js +8 -0
- package/dist/components/cura-loader-bar.js.map +1 -0
- package/dist/components/cura-loader-bar2.js +64 -0
- package/dist/components/cura-loader-bar2.js.map +1 -0
- package/dist/components/cura-loader-circle2.js +1 -1
- package/dist/components/cura-paragraph2.js +1 -1
- package/dist/components/cura-radio.js +1 -1
- package/dist/components/cura-select-option2.js +1 -1
- package/dist/components/cura-select2.js +3 -3
- package/dist/components/cura-switch.js +1 -1
- package/dist/components/cura-toast.d.ts +11 -0
- package/dist/components/cura-toast.js +157 -0
- package/dist/components/cura-toast.js.map +1 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/cura.esm.js.map +1 -1
- package/dist/cura/p-039b3701.entry.js +2 -0
- package/dist/cura/p-039b3701.entry.js.map +1 -0
- package/dist/cura/{p-cd757625.entry.js → p-260edb61.entry.js} +2 -2
- package/dist/cura/p-29790bb5.entry.js +2 -0
- package/dist/cura/p-29790bb5.entry.js.map +1 -0
- package/dist/cura/p-312791fb.js +3 -0
- package/dist/cura/p-312791fb.js.map +1 -0
- package/dist/cura/p-4eaeb590.entry.js +2 -0
- package/dist/cura/p-4eaeb590.entry.js.map +1 -0
- package/dist/cura/p-5e5f37c7.entry.js +2 -0
- package/dist/cura/p-5e5f37c7.entry.js.map +1 -0
- package/dist/cura/{p-a5456007.entry.js → p-5fcfbf32.entry.js} +2 -2
- package/dist/cura/{p-7c41f034.entry.js → p-6373c7cd.entry.js} +2 -2
- package/dist/cura/{p-22292bfa.entry.js → p-67e34464.entry.js} +2 -2
- package/dist/cura/{p-ee7388a5.entry.js → p-8433fec9.entry.js} +2 -2
- package/dist/cura/{p-2d70b515.entry.js → p-86b6e638.entry.js} +2 -2
- package/dist/cura/p-86b6e638.entry.js.map +1 -0
- package/dist/cura/{p-45a0a5e8.entry.js → p-9a4094e3.entry.js} +2 -2
- package/dist/cura/p-a5e53dd4.entry.js +2 -0
- package/dist/cura/{p-2a8be665.entry.js.map → p-a5e53dd4.entry.js.map} +1 -1
- package/dist/cura/{p-8cecf9e5.entry.js → p-a9dad622.entry.js} +2 -2
- package/dist/cura/p-af2036a7.entry.js +2 -0
- package/dist/cura/{p-e661bcca.entry.js → p-b0d66386.entry.js} +2 -2
- package/dist/cura/p-b1148bb2.entry.js +2 -0
- package/dist/cura/p-b1148bb2.entry.js.map +1 -0
- package/dist/cura/{p-fb9bece3.entry.js → p-c63f4695.entry.js} +2 -2
- package/dist/cura/p-e1253a09.entry.js +2 -0
- package/dist/cura/p-e1253a09.entry.js.map +1 -0
- package/dist/cura/{p-12d75346.entry.js → p-e622006c.entry.js} +2 -2
- package/dist/cura/p-e622006c.entry.js.map +1 -0
- package/dist/esm/cura-accordion_9.entry.js +7 -7
- package/dist/esm/cura-accordion_9.entry.js.map +1 -1
- package/dist/esm/cura-alert.entry.js +1 -1
- package/dist/esm/cura-avatar.entry.js +1 -1
- package/dist/esm/cura-button-outline.entry.js +3 -3
- package/dist/esm/cura-button-outline.entry.js.map +1 -1
- package/dist/esm/cura-button-select.entry.js +3 -3
- package/dist/esm/cura-button-select.entry.js.map +1 -1
- package/dist/esm/cura-button-transparent_2.entry.js +3 -3
- package/dist/esm/cura-button-transparent_2.entry.js.map +1 -1
- package/dist/esm/cura-calendar.entry.js +1 -1
- package/dist/esm/cura-card.entry.js +1 -1
- package/dist/esm/cura-checkbox.entry.js +2 -2
- package/dist/esm/cura-display.entry.js +2 -2
- package/dist/esm/cura-dropdown-search-option-title.entry.js +2 -2
- package/dist/esm/cura-dropdown-search-option.entry.js +17 -9
- package/dist/esm/cura-dropdown-search-option.entry.js.map +1 -1
- package/dist/esm/cura-dropdown-search.entry.js +27 -11
- package/dist/esm/cura-dropdown-search.entry.js.map +1 -1
- package/dist/esm/cura-icons-view.entry.js +1 -1
- package/dist/esm/cura-loader-bar.entry.js +42 -0
- package/dist/esm/cura-loader-bar.entry.js.map +1 -0
- package/dist/esm/cura-radio.entry.js +2 -2
- package/dist/esm/cura-select_2.entry.js +5 -5
- package/dist/esm/cura-switch.entry.js +2 -2
- package/dist/esm/cura-toast.entry.js +102 -0
- package/dist/esm/cura-toast.entry.js.map +1 -0
- package/dist/esm/cura.js +4 -4
- package/dist/esm/cura.js.map +1 -1
- package/dist/esm/{index-b6c443d5.js → index-1ad98520.js} +46 -31
- package/dist/esm/index-1ad98520.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/buttons/cura-button/cura-button.d.ts +1 -1
- package/dist/types/components/buttons/cura-button-outline/cura-button-outline.d.ts +1 -1
- package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +1 -1
- package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.d.ts +1 -1
- package/dist/types/components/cura-toast/cura-toast.d.ts +26 -0
- package/dist/types/components/cura-toast/cura-toast.stories.d.ts +119 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.d.ts +4 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.d.ts +11 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +16 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.stories.d.ts +33 -2
- package/dist/types/components/loaders/cura-loader-bar/cura-loader-bar.d.ts +12 -0
- package/dist/types/components/loaders/cura-loader-bar/cura-loader-bar.stories.d.ts +39 -0
- package/dist/types/components.d.ts +92 -8
- package/dist/types/stencil-public-runtime.d.ts +4 -0
- package/package.json +4 -4
- package/dist/cjs/index-5b63ff7a.js.map +0 -1
- package/dist/cura/p-12d75346.entry.js.map +0 -1
- package/dist/cura/p-2176f253.entry.js +0 -2
- package/dist/cura/p-2a8be665.entry.js +0 -2
- package/dist/cura/p-2d70b515.entry.js.map +0 -1
- package/dist/cura/p-3c2ebc3a.entry.js +0 -2
- package/dist/cura/p-3c2ebc3a.entry.js.map +0 -1
- package/dist/cura/p-586bbe43.js +0 -3
- package/dist/cura/p-586bbe43.js.map +0 -1
- package/dist/cura/p-5d8e3ee3.entry.js +0 -2
- package/dist/cura/p-5d8e3ee3.entry.js.map +0 -1
- package/dist/cura/p-94b5c3b3.entry.js +0 -2
- package/dist/cura/p-94b5c3b3.entry.js.map +0 -1
- package/dist/cura/p-de870781.entry.js +0 -2
- package/dist/cura/p-de870781.entry.js.map +0 -1
- package/dist/esm/index-b6c443d5.js.map +0 -1
- /package/dist/assets/{icons → assets/icons}/iconset-default-list.ts +0 -0
- /package/dist/assets/{icons → assets/icons}/iconset-default-tmp.svg +0 -0
- /package/dist/assets/{icons → assets/icons}/iconset-default.svg +0 -0
- /package/dist/cura/{p-cd757625.entry.js.map → p-260edb61.entry.js.map} +0 -0
- /package/dist/cura/{p-a5456007.entry.js.map → p-5fcfbf32.entry.js.map} +0 -0
- /package/dist/cura/{p-7c41f034.entry.js.map → p-6373c7cd.entry.js.map} +0 -0
- /package/dist/cura/{p-22292bfa.entry.js.map → p-67e34464.entry.js.map} +0 -0
- /package/dist/cura/{p-ee7388a5.entry.js.map → p-8433fec9.entry.js.map} +0 -0
- /package/dist/cura/{p-45a0a5e8.entry.js.map → p-9a4094e3.entry.js.map} +0 -0
- /package/dist/cura/{p-8cecf9e5.entry.js.map → p-a9dad622.entry.js.map} +0 -0
- /package/dist/cura/{p-2176f253.entry.js.map → p-af2036a7.entry.js.map} +0 -0
- /package/dist/cura/{p-e661bcca.entry.js.map → p-b0d66386.entry.js.map} +0 -0
- /package/dist/cura/{p-fb9bece3.entry.js.map → p-c63f4695.entry.js.map} +0 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
export class CuraToast {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.handleClose = () => {
|
|
5
|
+
this.close.emit();
|
|
6
|
+
this.closeContainer();
|
|
7
|
+
};
|
|
8
|
+
this.type = 'info';
|
|
9
|
+
this.position = 'top-right';
|
|
10
|
+
this.icon = undefined;
|
|
11
|
+
this.label = undefined;
|
|
12
|
+
this.closeButton = true;
|
|
13
|
+
this.loader = true;
|
|
14
|
+
this.autoCloseDelay = 10000;
|
|
15
|
+
this.styles = {};
|
|
16
|
+
this.progress = 0;
|
|
17
|
+
}
|
|
18
|
+
handleChangeType() {
|
|
19
|
+
this.setStyle();
|
|
20
|
+
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
this.setStyle();
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return (h(Host, { key: '8a49bdd99528c7b50b1b8a0de6ee0d985ffd5a11' }, h("div", { key: '6e560327e729ecb9fc9e6c081cc4d3b1131f892c', class: this.getClasses(), style: this.styles }, h("cura-icon", { key: '25efc30bc808e9f04be780ddf5bdc7edc3e56725', class: "default-icon", name: this.getNameIcon(), size: 16, color: `${this.type}-dark` }), h("div", { key: 'b1cbab08ae6845f8f544d4497b786fdfae645b72', class: "content" }, h("cura-heading", { key: '6d64c4fc8c43862f8fc5dba886b34a904a81208d', level: 4, size: "xsmall", color: `${this.type}-dark`, weight: "bold", "margin-block": "0" }, this.label), h("cura-paragraph", { key: 'fa990a332ca8caf8b110b643b39c44a17bb8de67', color: `${this.type}-darker`, size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, h("slot", { key: 'ec9ab2abe06b0d67ea71725abe3a02aca1a736c6' })), h("slot", { key: 'dc08874d1145bb7e62cac9081014d17ad0095f53', name: "actions" })), this.closeButton && h("cura-icon", { key: '3f22011909ed7074962a2ccec8ffe05bb9b01feb', class: "close-icon", name: "close", size: 16, color: "error-dark", onClick: this.handleClose }), this.loader && !!this.autoCloseDelay && h("cura-loader-bar", { key: '2e4168859d19170702a690bed3a20d28029cf7dc', color: `${this.type}-base`, progress: this.progress }))));
|
|
26
|
+
}
|
|
27
|
+
componentDidLoad() {
|
|
28
|
+
this.openContainer();
|
|
29
|
+
this.startAnimation();
|
|
30
|
+
}
|
|
31
|
+
setStyle() {
|
|
32
|
+
this.styles = Object.assign(Object.assign({}, this.styles), { '--neutral-purewhite': window.CuraAPI.theme.colors.getColor(`neutral-purewhite`), '--neutral-base': window.CuraAPI.theme.colors.getColor(`neutral-base`, 0.2), '--primary-base': window.CuraAPI.theme.colors.getColor(`primary-base`), '--color-base': window.CuraAPI.theme.colors.getColor(`${this.type}-base`) });
|
|
33
|
+
}
|
|
34
|
+
getClasses() {
|
|
35
|
+
const [firstPosition, secondPosition] = this.position.split('-');
|
|
36
|
+
const classes = {};
|
|
37
|
+
classes['container'] = true;
|
|
38
|
+
classes[firstPosition] = true;
|
|
39
|
+
classes[secondPosition] = true;
|
|
40
|
+
if (this.loader) {
|
|
41
|
+
classes['loader'] = true;
|
|
42
|
+
}
|
|
43
|
+
return classes;
|
|
44
|
+
}
|
|
45
|
+
getNameIcon() {
|
|
46
|
+
const iconMapping = {
|
|
47
|
+
info: 'infoCircle',
|
|
48
|
+
success: 'checkCircle',
|
|
49
|
+
warning: 'alertCircle',
|
|
50
|
+
error: 'alertTriangle',
|
|
51
|
+
};
|
|
52
|
+
return this.icon ? this.icon : iconMapping[this.type];
|
|
53
|
+
}
|
|
54
|
+
openContainer() {
|
|
55
|
+
this.container = this.host.shadowRoot.querySelector('.container');
|
|
56
|
+
this.container.classList.add('active');
|
|
57
|
+
}
|
|
58
|
+
closeContainer() {
|
|
59
|
+
this.container.classList.remove('active');
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
this.host.remove();
|
|
62
|
+
}, 500);
|
|
63
|
+
}
|
|
64
|
+
startAnimation() {
|
|
65
|
+
if (!!this.autoCloseDelay) {
|
|
66
|
+
if (this.loader) {
|
|
67
|
+
this.progress = 0;
|
|
68
|
+
let intervalId = setInterval(() => {
|
|
69
|
+
if (this.progress >= 100) {
|
|
70
|
+
clearInterval(intervalId);
|
|
71
|
+
this.closeContainer();
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.progress++;
|
|
75
|
+
}
|
|
76
|
+
}, this.autoCloseDelay / 100);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
let intervalId = setInterval(() => {
|
|
80
|
+
clearInterval(intervalId);
|
|
81
|
+
this.closeContainer();
|
|
82
|
+
}, this.autoCloseDelay);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
static get is() { return "cura-toast"; }
|
|
87
|
+
static get encapsulation() { return "shadow"; }
|
|
88
|
+
static get originalStyleUrls() {
|
|
89
|
+
return {
|
|
90
|
+
"$": ["cura-toast.scss"]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
static get styleUrls() {
|
|
94
|
+
return {
|
|
95
|
+
"$": ["cura-toast.css"]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
static get properties() {
|
|
99
|
+
return {
|
|
100
|
+
"type": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"mutable": false,
|
|
103
|
+
"complexType": {
|
|
104
|
+
"original": "'info' | 'success' | 'warning' | 'error'",
|
|
105
|
+
"resolved": "\"error\" | \"info\" | \"success\" | \"warning\"",
|
|
106
|
+
"references": {}
|
|
107
|
+
},
|
|
108
|
+
"required": false,
|
|
109
|
+
"optional": false,
|
|
110
|
+
"docs": {
|
|
111
|
+
"tags": [],
|
|
112
|
+
"text": ""
|
|
113
|
+
},
|
|
114
|
+
"attribute": "type",
|
|
115
|
+
"reflect": false,
|
|
116
|
+
"defaultValue": "'info'"
|
|
117
|
+
},
|
|
118
|
+
"position": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'",
|
|
123
|
+
"resolved": "\"bottom-center\" | \"bottom-left\" | \"bottom-right\" | \"top-center\" | \"top-left\" | \"top-right\"",
|
|
124
|
+
"references": {}
|
|
125
|
+
},
|
|
126
|
+
"required": false,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": ""
|
|
131
|
+
},
|
|
132
|
+
"attribute": "position",
|
|
133
|
+
"reflect": false,
|
|
134
|
+
"defaultValue": "'top-right'"
|
|
135
|
+
},
|
|
136
|
+
"icon": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"mutable": false,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "string",
|
|
141
|
+
"resolved": "string",
|
|
142
|
+
"references": {}
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"optional": false,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": ""
|
|
149
|
+
},
|
|
150
|
+
"attribute": "icon",
|
|
151
|
+
"reflect": true
|
|
152
|
+
},
|
|
153
|
+
"label": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "string",
|
|
158
|
+
"resolved": "string",
|
|
159
|
+
"references": {}
|
|
160
|
+
},
|
|
161
|
+
"required": false,
|
|
162
|
+
"optional": false,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": ""
|
|
166
|
+
},
|
|
167
|
+
"attribute": "label",
|
|
168
|
+
"reflect": true
|
|
169
|
+
},
|
|
170
|
+
"closeButton": {
|
|
171
|
+
"type": "boolean",
|
|
172
|
+
"mutable": false,
|
|
173
|
+
"complexType": {
|
|
174
|
+
"original": "boolean",
|
|
175
|
+
"resolved": "boolean",
|
|
176
|
+
"references": {}
|
|
177
|
+
},
|
|
178
|
+
"required": false,
|
|
179
|
+
"optional": false,
|
|
180
|
+
"docs": {
|
|
181
|
+
"tags": [],
|
|
182
|
+
"text": ""
|
|
183
|
+
},
|
|
184
|
+
"attribute": "close-button",
|
|
185
|
+
"reflect": true,
|
|
186
|
+
"defaultValue": "true"
|
|
187
|
+
},
|
|
188
|
+
"loader": {
|
|
189
|
+
"type": "boolean",
|
|
190
|
+
"mutable": false,
|
|
191
|
+
"complexType": {
|
|
192
|
+
"original": "boolean",
|
|
193
|
+
"resolved": "boolean",
|
|
194
|
+
"references": {}
|
|
195
|
+
},
|
|
196
|
+
"required": false,
|
|
197
|
+
"optional": false,
|
|
198
|
+
"docs": {
|
|
199
|
+
"tags": [],
|
|
200
|
+
"text": ""
|
|
201
|
+
},
|
|
202
|
+
"attribute": "loader",
|
|
203
|
+
"reflect": true,
|
|
204
|
+
"defaultValue": "true"
|
|
205
|
+
},
|
|
206
|
+
"autoCloseDelay": {
|
|
207
|
+
"type": "number",
|
|
208
|
+
"mutable": false,
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "number",
|
|
211
|
+
"resolved": "number",
|
|
212
|
+
"references": {}
|
|
213
|
+
},
|
|
214
|
+
"required": false,
|
|
215
|
+
"optional": false,
|
|
216
|
+
"docs": {
|
|
217
|
+
"tags": [],
|
|
218
|
+
"text": ""
|
|
219
|
+
},
|
|
220
|
+
"attribute": "auto-close-delay",
|
|
221
|
+
"reflect": true,
|
|
222
|
+
"defaultValue": "10000"
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
static get states() {
|
|
227
|
+
return {
|
|
228
|
+
"styles": {},
|
|
229
|
+
"progress": {}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
static get events() {
|
|
233
|
+
return [{
|
|
234
|
+
"method": "close",
|
|
235
|
+
"name": "close",
|
|
236
|
+
"bubbles": true,
|
|
237
|
+
"cancelable": true,
|
|
238
|
+
"composed": true,
|
|
239
|
+
"docs": {
|
|
240
|
+
"tags": [],
|
|
241
|
+
"text": ""
|
|
242
|
+
},
|
|
243
|
+
"complexType": {
|
|
244
|
+
"original": "void",
|
|
245
|
+
"resolved": "void",
|
|
246
|
+
"references": {}
|
|
247
|
+
}
|
|
248
|
+
}];
|
|
249
|
+
}
|
|
250
|
+
static get elementRef() { return "host"; }
|
|
251
|
+
static get watchers() {
|
|
252
|
+
return [{
|
|
253
|
+
"propName": "type",
|
|
254
|
+
"methodName": "handleChangeType"
|
|
255
|
+
}, {
|
|
256
|
+
"propName": "position",
|
|
257
|
+
"methodName": "handleChangeType"
|
|
258
|
+
}];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=cura-toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-toast.js","sourceRoot":"","sources":["../../../src/components/cura-toast/cura-toast.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAOrG,MAAM,OAAO,SAAS;;QAqGpB,gBAAW,GAAG,GAAG,EAAE;YACjB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAClB,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;oBArGuD,MAAM;wBACgD,WAAW;;;2BAGnF,IAAI;sBACT,IAAI;8BACI,KAAK;sBAE7B,EAAE;wBACA,CAAC;;IAMrB,gBAAgB;QACd,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAID,iBAAiB;QACf,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,4DAAK,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM;gBAC/C,kE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AC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1C,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACrB,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC;IAOD,cAAc;QACZ,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;gBAClB,IAAI,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;oBAChC,IAAI,IAAI,CAAC,QAAQ,IAAI,GAAG,EAAE,CAAC;wBACzB,aAAa,CAAC,UAAU,CAAC,CAAC;wBAC1B,IAAI,CAAC,cAAc,EAAE,CAAC;oBACxB,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,CAAC;gBACH,CAAC,EAAE,IAAI,CAAC,cAAc,GAAC,GAAG,CAAC,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACN,IAAI,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;oBAChC,aAAa,CAAC,UAAU,CAAC,CAAC;oBAC1B,IAAI,CAAC,cAAc,EAAE,CAAC;gBACxB,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Prop, Host, h, State, Watch, Event, EventEmitter } from '@stencil/core';\n\n@Component({\n tag: 'cura-toast',\n styleUrl: 'cura-toast.scss',\n shadow: true,\n})\nexport class CuraToast {\n @Element() host: HTMLElement;\n\n @Prop() type: 'info' | 'success' | 'warning' | 'error' = 'info';\n @Prop() position: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' = 'top-right';\n @Prop({ reflect: true }) icon: string;\n @Prop({ reflect: true }) label: string;\n @Prop({ reflect: true }) closeButton = true;\n @Prop({ reflect: true }) loader = true;\n @Prop({ reflect: true }) autoCloseDelay = 10000;\n \n @State() styles = {};\n @State() progress = 0;\n\n @Event({ eventName: 'close' }) close: EventEmitter<void>;\n\n @Watch('type')\n @Watch('position')\n handleChangeType() {\n this.setStyle();\n }\n\n container: HTMLElement;\n\n connectedCallback() {\n this.setStyle();\n }\n\n render() {\n return (\n <Host>\n <div class={this.getClasses()} style={this.styles}>\n <cura-icon class=\"default-icon\" name={this.getNameIcon()} size={16} color={`${this.type}-dark`}></cura-icon>\n <div class=\"content\">\n <cura-heading level={4} size=\"xsmall\" color={`${this.type}-dark`} weight=\"bold\" margin-block=\"0\">\n {this.label}\n </cura-heading>\n <cura-paragraph color={`${this.type}-darker`} size=\"xsmall\" marginBlock=\"0\" lineHeight=\"133.33%\">\n <slot></slot>\n </cura-paragraph>\n <slot name=\"actions\"></slot>\n </div>\n {this.closeButton && <cura-icon class=\"close-icon\" name=\"close\" size={16} color=\"error-dark\" onClick={this.handleClose}></cura-icon>}\n {this.loader && !!this.autoCloseDelay && <cura-loader-bar color={`${this.type}-base`} progress={this.progress}></cura-loader-bar>}\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.openContainer();\n this.startAnimation();\n }\n\n setStyle() {\n this.styles = {\n ...this.styles,\n '--neutral-purewhite': window.CuraAPI.theme.colors.getColor(`neutral-purewhite`),\n '--neutral-base': window.CuraAPI.theme.colors.getColor(`neutral-base`, 0.2),\n '--primary-base': window.CuraAPI.theme.colors.getColor(`primary-base`),\n '--color-base': window.CuraAPI.theme.colors.getColor(`${this.type}-base`)\n }\n }\n\n getClasses() {\n const [firstPosition, secondPosition] = this.position.split('-');\n const classes = {};\n\n classes['container'] = true;\n classes[firstPosition] = true;\n classes[secondPosition] = true;\n\n if (this.loader) {\n classes['loader'] = true;\n }\n\n return classes;\n }\n\n getNameIcon() {\n const iconMapping = {\n info: 'infoCircle',\n success: 'checkCircle',\n warning: 'alertCircle',\n error: 'alertTriangle',\n };\n return this.icon ? this.icon : iconMapping[this.type];\n }\n\n openContainer() {\n this.container = this.host.shadowRoot.querySelector('.container') as HTMLElement;\n this.container.classList.add('active');\n }\n\n closeContainer() {\n this.container.classList.remove('active');\n setTimeout(() => {\n this.host.remove();\n }, 500);\n }\n\n handleClose = () => {\n this.close.emit();\n this.closeContainer();\n };\n\n startAnimation() {\n if (!!this.autoCloseDelay) {\n if (this.loader) {\n this.progress = 0;\n let intervalId = setInterval(() => {\n if (this.progress >= 100) {\n clearInterval(intervalId);\n this.closeContainer();\n } else {\n this.progress++;\n }\n }, this.autoCloseDelay/100);\n } else {\n let intervalId = setInterval(() => {\n clearInterval(intervalId);\n this.closeContainer();\n }, this.autoCloseDelay);\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import iconNames from "../../assets/icons/iconset-default-list";
|
|
14
|
+
const renderCuraToast = (args) => {
|
|
15
|
+
return `<div style="width: 100%; height: 250px;">
|
|
16
|
+
<cura-toast
|
|
17
|
+
${args.label ? `label="${args.label}"` : ''}
|
|
18
|
+
${args.type && args.type !== 'info' ? `type="${args.type}"` : ''}
|
|
19
|
+
${args.position && args.position !== 'top-right' ? `position="${args.position}"` : ''}
|
|
20
|
+
${args.closeButton !== true ? `close-button="${args.closeButton}"` : ''}
|
|
21
|
+
${args.loader !== true ? `loader="${args.loader}"` : ''}
|
|
22
|
+
${args.icon ? `icon="${args.icon}"` : ''}
|
|
23
|
+
${args.autoCloseDelay !== 10000 ? `auto-close-delay="${args.autoCloseDelay}"` : ''}>
|
|
24
|
+
${args.content}
|
|
25
|
+
${args.actions}
|
|
26
|
+
</cura-toast>
|
|
27
|
+
</div>`;
|
|
28
|
+
};
|
|
29
|
+
export default {
|
|
30
|
+
title: 'Componentes/Feedback/Toast',
|
|
31
|
+
tags: ['autodocs'],
|
|
32
|
+
render: (_a) => {
|
|
33
|
+
var args = __rest(_a, []);
|
|
34
|
+
return renderCuraToast(args);
|
|
35
|
+
},
|
|
36
|
+
argTypes: {
|
|
37
|
+
label: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
description: 'Título do toast.',
|
|
40
|
+
table: {
|
|
41
|
+
category: 'Properties',
|
|
42
|
+
},
|
|
43
|
+
name: 'label',
|
|
44
|
+
},
|
|
45
|
+
type: {
|
|
46
|
+
control: { type: 'select' },
|
|
47
|
+
options: ['', 'info', 'success', 'warning', 'error'],
|
|
48
|
+
description: 'Tipos de alertas disponíveis: <b>info</b>, <b>success</b>, <b>warning</b>, <b>error</b>.',
|
|
49
|
+
table: {
|
|
50
|
+
category: 'Properties',
|
|
51
|
+
defaultValue: { summary: 'info' },
|
|
52
|
+
},
|
|
53
|
+
name: 'type',
|
|
54
|
+
},
|
|
55
|
+
position: {
|
|
56
|
+
control: { type: 'select' },
|
|
57
|
+
options: ['', 'top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'],
|
|
58
|
+
description: 'Posição do Toast na tela',
|
|
59
|
+
table: {
|
|
60
|
+
category: 'Properties',
|
|
61
|
+
defaultValue: { summary: 'top-right' },
|
|
62
|
+
},
|
|
63
|
+
name: 'position',
|
|
64
|
+
},
|
|
65
|
+
closeButton: {
|
|
66
|
+
control: 'boolean',
|
|
67
|
+
description: 'Define se o alerta pode ser fechado.',
|
|
68
|
+
table: {
|
|
69
|
+
category: 'Properties',
|
|
70
|
+
defaultValue: { summary: true },
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
loader: {
|
|
74
|
+
control: 'boolean',
|
|
75
|
+
description: 'Define se mostra ou não a barra de progresso',
|
|
76
|
+
table: {
|
|
77
|
+
category: 'Properties',
|
|
78
|
+
defaultValue: { summary: true },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
icon: {
|
|
82
|
+
control: { type: 'select' },
|
|
83
|
+
options: ['', ...iconNames],
|
|
84
|
+
description: 'Nome do ícone personalizado.',
|
|
85
|
+
table: {
|
|
86
|
+
category: 'Icons',
|
|
87
|
+
defaultValue: { summary: 'De acordo com o tipo de alert.' },
|
|
88
|
+
},
|
|
89
|
+
name: 'icon'
|
|
90
|
+
},
|
|
91
|
+
autoCloseDelay: {
|
|
92
|
+
control: 'number',
|
|
93
|
+
description: 'Define a quantidade de tempo, em milisegundos, que o toast ficará aberto.',
|
|
94
|
+
table: {
|
|
95
|
+
category: 'Properties',
|
|
96
|
+
defaultValue: { summary: 10000 },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
content: {
|
|
100
|
+
control: 'text',
|
|
101
|
+
description: 'Conteúdo do texto principal do toast. É projetado automaticamente dentro do slot padrão.',
|
|
102
|
+
defaultValue: '',
|
|
103
|
+
table: {
|
|
104
|
+
category: 'Slot',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
actions: {
|
|
108
|
+
control: 'text',
|
|
109
|
+
description: 'Conteúdo da ações de links e botões',
|
|
110
|
+
defaultValue: '',
|
|
111
|
+
table: {
|
|
112
|
+
category: 'Slot',
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
export const Toast = {
|
|
118
|
+
args: {
|
|
119
|
+
label: 'Título do toast',
|
|
120
|
+
type: 'info',
|
|
121
|
+
position: 'top-right',
|
|
122
|
+
closeButton: true,
|
|
123
|
+
loader: true,
|
|
124
|
+
icon: '',
|
|
125
|
+
autoCloseDelay: 10000,
|
|
126
|
+
content: 'Texto explicativo para o toast.',
|
|
127
|
+
actions: `<div slot="actions">
|
|
128
|
+
<cura-paragraph spot-color="primary" size="xsmall" margin-block="8px 0">
|
|
129
|
+
<a href="http://www.google.com" target="_blank" rel="noopener noreferrer">Link</a>
|
|
130
|
+
<a href="http://www.google.com" target="_blank" rel="noopener noreferrer" style="margin-left: 8px">Link</a>
|
|
131
|
+
</cura-paragraph>
|
|
132
|
+
<div style="display: flex; justify-content: space-between; gap: 8px; margin-top: 12px;">
|
|
133
|
+
<cura-button-outline
|
|
134
|
+
size="small"
|
|
135
|
+
color="primary"
|
|
136
|
+
style="width: 100%;">
|
|
137
|
+
Button
|
|
138
|
+
</cura-button-outline>
|
|
139
|
+
<cura-button
|
|
140
|
+
size="small"
|
|
141
|
+
color="accent"
|
|
142
|
+
style="width: 100%;">
|
|
143
|
+
Button
|
|
144
|
+
</cura-button>
|
|
145
|
+
</div>
|
|
146
|
+
</div>`
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=cura-toast.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-toast.stories.js","sourceRoot":"","sources":["../../../src/components/cura-toast/cura-toast.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,yCAAyC,CAAC;AAEhE,MAAM,eAAe,GAAG,CAAC,IAAS,EAAE,EAAE;IACpC,OAAO;;MAEH,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE;MACzC,IAAI,CAAC,IAA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AQ,EAAE,YAAY;gBACtB,YAAY,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;aACjC;SACF;QACH,OAAO,EAAE;YACL,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,0FAA0F;YACvG,YAAY,EAAE,EAAE;YAChB,KAAK,EAAE;gBACL,QAAQ,EAAE,MAAM;aACjB;SACF;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,qCAAqC;YAClD,YAAY,EAAE,EAAE;YAChB,KAAK,EAAE;gBACL,QAAQ,EAAE,MAAM;aACjB;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE;QACJ,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,MAAM;QACd,QAAQ,EAAE,WAAW;QACnB,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,EAAE;QACV,cAAc,EAAE,KAAK;QACnB,OAAO,EAAE,iCAAiC;QAC1C,OAAO,EAAE;;;;;;;;;;;;;;;;;;;qBAmBQ;KAClB;CACF,CAAC","sourcesContent":["import iconNames from '../../assets/icons/iconset-default-list';\n\nconst renderCuraToast = (args: any) => {\n return `<div style=\"width: 100%; height: 250px;\">\n <cura-toast\n ${args.label ? `label=\"${args.label}\"` : ''}\n ${args.type && args.type !== 'info' ? `type=\"${args.type}\"` : ''}\n ${args.position && args.position !== 'top-right' ? `position=\"${args.position}\"` : ''}\n ${args.closeButton !== true ? `close-button=\"${args.closeButton}\"` : ''}\n ${args.loader !== true ? `loader=\"${args.loader}\"` : ''}\n ${args.icon ? `icon=\"${args.icon}\"` : ''}\n ${args.autoCloseDelay !== 10000 ? `auto-close-delay=\"${args.autoCloseDelay}\"` : ''}>\n\t\t${args.content}\n\t\t${args.actions}\n </cura-toast>\n </div>`;\n}\n\nexport default {\n title: 'Componentes/Feedback/Toast',\n tags: ['autodocs'],\n render: ({ ...args }) => {\n return renderCuraToast(args);\n },\n argTypes: {\n label: {\n\t\t\tcontrol: 'text',\n\t\t\tdescription: 'Título do toast.',\n\t\t\ttable: {\n\t\t\t\t\tcategory: 'Properties',\n\t\t\t},\n\t\t\tname: 'label',\n },\n type: {\n\t\t\tcontrol: { type: 'select' },\n\t\t\toptions: ['', 'info', 'success', 'warning', 'error'],\n\t\t\tdescription: 'Tipos de alertas disponíveis: <b>info</b>, <b>success</b>, <b>warning</b>, <b>error</b>.',\n\t\t\ttable: {\n\t\t\t\t\tcategory: 'Properties',\n\t\t\t\t\tdefaultValue: { summary: 'info' },\n\t\t\t},\n\t\t\tname: 'type',\n },\n\t\tposition: {\n\t\t\tcontrol: { type: 'select' },\n\t\t\toptions: ['', 'top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'],\n\t\t\tdescription: 'Posição do Toast na tela',\n\t\t\ttable: {\n\t\t\t\tcategory: 'Properties',\n\t\t\t\tdefaultValue: { summary: 'top-right' },\n\t\t\t},\n\t\t\tname: 'position',\n\t\t},\n closeButton: {\n control: 'boolean',\n description: 'Define se o alerta pode ser fechado.',\n table: {\n category: 'Properties',\n defaultValue: { summary: true },\n },\n },\n\t\tloader: {\n control: 'boolean',\n description: 'Define se mostra ou não a barra de progresso',\n table: {\n category: 'Properties',\n defaultValue: { summary: true },\n },\n },\n icon: {\n control: {type: 'select' },\n options: ['', ...iconNames],\n description: 'Nome do ícone personalizado.',\n table: {\n category: 'Icons',\n defaultValue: { summary: 'De acordo com o tipo de alert.' },\n },\n name: 'icon'\n },\n\t\tautoCloseDelay: {\n control: 'number',\n description: 'Define a quantidade de tempo, em milisegundos, que o toast ficará aberto.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 10000 },\n },\n },\n\t\tcontent: {\n control: 'text',\n description: 'Conteúdo do texto principal do toast. É projetado automaticamente dentro do slot padrão.',\n defaultValue: '',\n table: {\n category: 'Slot',\n },\n },\n actions: {\n control: 'text',\n description: 'Conteúdo da ações de links e botões',\n defaultValue: '',\n table: {\n category: 'Slot',\n },\n }\n },\n};\n\nexport const Toast = {\n args: {\n label: 'Título do toast',\n type: 'info',\n\t\tposition: 'top-right',\n closeButton: true,\n loader: true,\n icon: '',\n\t\tautoCloseDelay: 10000,\n content: 'Texto explicativo para o toast.',\n actions: `<div slot=\"actions\">\n <cura-paragraph spot-color=\"primary\" size=\"xsmall\" margin-block=\"8px 0\">\n <a href=\"http://www.google.com\" target=\"_blank\" rel=\"noopener noreferrer\">Link</a>\n <a href=\"http://www.google.com\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"margin-left: 8px\">Link</a>\n </cura-paragraph>\n <div style=\"display: flex; justify-content: space-between; gap: 8px; margin-top: 12px;\">\n <cura-button-outline\n size=\"small\"\n color=\"primary\"\n style=\"width: 100%;\">\n Button\n </cura-button-outline>\n <cura-button\n size=\"small\"\n color=\"accent\"\n style=\"width: 100%;\">\n Button\n </cura-button>\n </div>\n </div>`\n },\n};\n"]}
|
|
@@ -147,7 +147,7 @@ export class CuraCheckbox {
|
|
|
147
147
|
return h("cura-icon", { class: "icon", name: iconName, size: iconSize, color: iconColor });
|
|
148
148
|
}
|
|
149
149
|
render() {
|
|
150
|
-
return (h(Host, { key: '
|
|
150
|
+
return (h(Host, { key: 'b74eebdbcaed952fa2157c3cbb3a84ce92bb9e6c' }, h("div", { key: 'e18e4e5aa12a3e298db65399ebf002aa991100f2', class: this.getClasses(), style: this.styles, onClick: this.handleClick }, h("div", { key: 'fdbcf3ec4b12bf9c6d80cded5ce9d17c4f5e2a39', class: "info" }, h("div", { key: 'cbe76b43956bed00ab638b953a44d941ffb748d5', class: "label-wrapper" }, h("cura-label", { key: '259c5e5e63a6d36ed15845899eaf8c76b2b50273', class: "label", weight: 'bold', size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && h("cura-paragraph", { key: '42d8b2777d4790bd8f83a7ddc939c6ab584b5cf0', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), h("cura-label", { key: 'bcafaacf64c8967f78a3e9b7ecfe6d1412517ea3', color: this.assignColor('message'), size: "xsmall", class: "message" }, h("slot", { key: 'c9cc9e74cc9048ead8375a158253491e1aae4dfe' }))), h("div", { key: 'e63ba7ef796c9d46cf4729facf1be985b8174028', class: 'checkbox', tabIndex: this.ontabindex }, h("input", { key: '2e7e2e302e577f26d8022fe4a0108f0e6727450f', type: "checkbox", name: this.name, value: this.value, disabled: this.disabled, required: this.required, checked: this.checked, indeterminate: this.indeterminate }), this.getIcon()))));
|
|
151
151
|
}
|
|
152
152
|
static get is() { return "cura-checkbox"; }
|
|
153
153
|
static get encapsulation() { return "shadow"; }
|
|
@@ -25,6 +25,9 @@ li {
|
|
|
25
25
|
box-sizing: border-box;
|
|
26
26
|
cursor: pointer;
|
|
27
27
|
}
|
|
28
|
+
li.disabled {
|
|
29
|
+
cursor: default;
|
|
30
|
+
}
|
|
28
31
|
li.hovered {
|
|
29
32
|
background-color: var(--neutral-white);
|
|
30
33
|
}
|
|
@@ -45,6 +48,6 @@ li ::slotted(div[slot=action]) {
|
|
|
45
48
|
li.selected {
|
|
46
49
|
background-color: var(--primary-lighter);
|
|
47
50
|
}
|
|
48
|
-
li:hover {
|
|
51
|
+
li:hover:not(.disabled) {
|
|
49
52
|
background-color: var(--neutral-white);
|
|
50
53
|
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
export class CuraDropdownSearchOption {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.handleOptionClick = () => {
|
|
5
|
-
this.
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
this.handleOptionClick = (e) => {
|
|
5
|
+
if (this.selectable) {
|
|
6
|
+
this.selected = !this.selected;
|
|
7
|
+
this.optionSelected.emit(this.value);
|
|
8
|
+
this.updateIconColor();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
e.stopImmediatePropagation();
|
|
13
|
+
}
|
|
8
14
|
};
|
|
9
15
|
this.value = undefined;
|
|
10
16
|
this.selected = false;
|
|
17
|
+
this.selectable = true;
|
|
11
18
|
this.hovered = false;
|
|
12
19
|
this.styles = {};
|
|
13
20
|
}
|
|
@@ -28,10 +35,11 @@ export class CuraDropdownSearchOption {
|
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
37
|
render() {
|
|
31
|
-
return (h(Host, { key: '
|
|
32
|
-
hovered: this.hovered,
|
|
38
|
+
return (h(Host, { key: 'aa4b585c3f67a74d1371430200ad309f74015af6', style: this.styles, slot: "dropdown-search-option" }, h("ul", { key: '5413964e5e10e68e4ff2ac30f68f6e22cff6dcc1' }, h("li", { key: '3aab9b7d5e3904e57a7310addc4b15a51453d31d', onClick: (e) => this.handleOptionClick(e), value: this.value, class: {
|
|
39
|
+
hovered: this.selectable ? this.hovered : false,
|
|
33
40
|
selected: this.selected,
|
|
34
|
-
|
|
41
|
+
disabled: !this.selectable
|
|
42
|
+
} }, h("slot", { key: '030c06f2e9bcfd0169b8d94c8976cd4b1e25b834', name: "image" }), h("cura-heading", { key: 'f5bd16d815a853a41d98aac09517359a5e1b432d', size: "xsmall", lineHeight: "16px", marginBlock: "0px", weight: "bold", color: "neutral-black" }, h("slot", { key: '878d1db64dc98c57530adf947cbc216ac1ce1be0' })), h("slot", { key: '81c92fcb864bc8f2324cc353574123705fc386a8', name: "action" })))));
|
|
35
43
|
}
|
|
36
44
|
static get is() { return "cura-dropdown-search-option"; }
|
|
37
45
|
static get encapsulation() { return "shadow"; }
|
|
@@ -82,6 +90,24 @@ export class CuraDropdownSearchOption {
|
|
|
82
90
|
"reflect": true,
|
|
83
91
|
"defaultValue": "false"
|
|
84
92
|
},
|
|
93
|
+
"selectable": {
|
|
94
|
+
"type": "boolean",
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "boolean",
|
|
98
|
+
"resolved": "boolean",
|
|
99
|
+
"references": {}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": false,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [],
|
|
105
|
+
"text": "Indicates if the dropdown search is selectable."
|
|
106
|
+
},
|
|
107
|
+
"attribute": "selectable",
|
|
108
|
+
"reflect": true,
|
|
109
|
+
"defaultValue": "true"
|
|
110
|
+
},
|
|
85
111
|
"hovered": {
|
|
86
112
|
"type": "boolean",
|
|
87
113
|
"mutable": true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cura-dropdown-search-option.js","sourceRoot":"","sources":["../../../../../src/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOrG,MAAM,OAAO,wBAAwB;;
|
|
1
|
+
{"version":3,"file":"cura-dropdown-search-option.js","sourceRoot":"","sources":["../../../../../src/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOrG,MAAM,OAAO,wBAAwB;;QAwC3B,sBAAiB,GAAG,CAAC,CAAQ,EAAE,EAAE;YACvC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAC/B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACrC,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,CAAC,CAAC,wBAAw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AC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EACzC,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE;wBACL,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;wBAC/C,QAAQ,EAAE,IAAI,CAAC,QAAQ;wBACvB,QAAQ,EAAE,CAAC,IAAI,CAAC,UAAU;qBAC3B;oBAED,6DAAM,IAAI,EAAC,OAAO,GAAQ;oBAC1B,qEAAc,IAAI,EAAC,QAAQ,EAAC,UAAU,EAAC,MAAM,EAAC,WAAW,EAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,KAAK,EAAC,eAAe;wBACjG,8DAAa,CACA;oBACf,6DAAM,IAAI,EAAC,QAAQ,GAAQ,CACxB,CACF,CACA,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-dropdown-search-option',\n styleUrl: 'cura-dropdown-search-option.scss',\n shadow: true,\n})\nexport class CuraDropdownSearchOption {\n /**\n * The value of the dropdown search option.\n */\n @Prop({ reflect: true }) value: string;\n\n /**\n * Indicates if the dropdown search option is selected.\n */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false;\n\n /**\n * Indicates if the dropdown search is selectable.\n */\n @Prop({ reflect: true }) selectable: boolean = true;\n\n /**\n * Indicates if the dropdown search option is hovered.\n */\n @Prop({ reflect: true, mutable: true }) hovered: boolean = false;\n\n @State() styles = {};\n\n /**\n * Event emitted when the option is selected.\n */\n @Event() optionSelected: EventEmitter<string>;\n\n @Element() hostElement: HTMLElement;\n\n weights;\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor(`neutral-purewhite`);\n this.styles['--neutral-light'] = window.CuraAPI.theme.colors.getColor(`neutral-light`);\n this.styles['--neutral-white'] = window.CuraAPI.theme.colors.getColor(`neutral-white`);\n this.styles['--primary-lighter'] = window.CuraAPI.theme.colors.getColor(`primary-lighter`, 50);\n }\n\n private handleOptionClick = (e: Event) => {\n if (this.selectable) {\n this.selected = !this.selected;\n this.optionSelected.emit(this.value);\n this.updateIconColor();\n } else {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n };\n\n componentDidLoad() {\n this.updateIconColor();\n }\n\n @Watch('selected')\n private updateIconColor() {\n const iconElement = this.hostElement.querySelector('[slot=\"image\"] cura-icon');\n if (iconElement) {\n iconElement.setAttribute('color', this.selected ? 'primary' : 'neutral-dark');\n }\n }\n\n render() {\n return (\n <Host style={this.styles} slot=\"dropdown-search-option\">\n <ul>\n <li\n onClick={(e) => this.handleOptionClick(e)}\n value={this.value}\n class={{\n hovered: this.selectable ? this.hovered : false,\n selected: this.selected,\n disabled: !this.selectable\n }}\n >\n <slot name=\"image\"></slot>\n <cura-heading size=\"xsmall\" lineHeight=\"16px\" marginBlock=\"0px\" weight=\"bold\" color=\"neutral-black\">\n <slot></slot>\n </cura-heading>\n <slot name=\"action\"></slot>\n </li>\n </ul>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const renderCuraDropdownSearchOption = (args) => {
|
|
2
|
-
return `<cura-dropdown-search-option value="${args.value}">
|
|
2
|
+
return `<cura-dropdown-search-option value="${args.value}"${args.selectable === false ? ` selectable="false"` : ''}>
|
|
3
3
|
${args.image ? `<div slot="image">${args.image}</div>` : ''}
|
|
4
4
|
${args.content}
|
|
5
5
|
${args.action ? `<div slot="action">
|
|
@@ -22,6 +22,14 @@ export default {
|
|
|
22
22
|
category: 'Properties',
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
|
+
selectable: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Define se a opção pode ou não ser selecionada.',
|
|
28
|
+
table: {
|
|
29
|
+
category: 'Properties',
|
|
30
|
+
defaultValue: { summary: true },
|
|
31
|
+
},
|
|
32
|
+
},
|
|
25
33
|
image: {
|
|
26
34
|
control: 'text',
|
|
27
35
|
description: 'Conteúdo do slot `image`.',
|
|
@@ -48,6 +56,7 @@ export default {
|
|
|
48
56
|
export const DropdownSearchOption = {
|
|
49
57
|
args: {
|
|
50
58
|
value: 'Clinica Médica Geral',
|
|
59
|
+
selectable: true,
|
|
51
60
|
image: '<cura-icon size="24" name="medical"></cura-icon>',
|
|
52
61
|
content: 'Clinica Médica Geral',
|
|
53
62
|
action: `<cura-button-transparent font-color="dark" color='primary' icon-name='delete' size='small' icon-only={true}></cura-button-transparent>`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cura-dropdown-search-option.stories.js","sourceRoot":"","sources":["../../../../../src/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.tsx"],"names":[],"mappings":"AAAA,MAAM,8BAA8B,GAAG,CAAC,IAAS,EAAE,EAAE;IACnD,OAAO,uCAAuC,IAAI,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"cura-dropdown-search-option.stories.js","sourceRoot":"","sources":["../../../../../src/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.tsx"],"names":[],"mappings":"AAAA,MAAM,8BAA8B,GAAG,CAAC,IAAS,EAAE,EAAE;IACnD,OAAO,uCAAuC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE;MAC9G,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE;MACzD,IAAI,CAAC,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ura-dropdown-search-option value=\"${args.value}\"${args.selectable === false ? ` selectable=\"false\"` : ''}>\n ${args.image ? `<div slot=\"image\">${args.image}</div>` : ''}\n ${args.content}\n ${args.action ? `<div slot=\"action\">\n ${args.action}\n </div>` : ''}\n</cura-dropdown-search-option>\n `;\n};\n\nexport default {\n title: 'Componentes/DropdownSearch/DropdownSearchOption',\n tags: ['autodocs'],\n\n render: args => {\n return renderCuraDropdownSearchOption(args);\n },\n argTypes: {\n value: {\n control: 'text',\n description: 'Valor da opção.',\n table: {\n category: 'Properties',\n },\n },\n selectable: {\n control: 'boolean',\n description: 'Define se a opção pode ou não ser selecionada.',\n table: {\n category: 'Properties',\n defaultValue: { summary: true },\n },\n },\n image: {\n control: 'text',\n description: 'Conteúdo do slot `image`.',\n table: {\n category: 'Slots',\n },\n },\n content: {\n control: 'text',\n description: 'Conteúdo do slot. É englobado por um `<cura-heading>`',\n table: {\n category: 'Slots',\n },\n },\n action: {\n control: 'text',\n description: 'Conteúdo do slot `action`.',\n table: {\n category: 'Slots',\n },\n },\n },\n};\n\nexport const DropdownSearchOption = {\n args: {\n value: 'Clinica Médica Geral',\n selectable: true,\n image: '<cura-icon size=\"24\" name=\"medical\"></cura-icon>',\n content: 'Clinica Médica Geral',\n action: `<cura-button-transparent font-color=\"dark\" color='primary' icon-name='delete' size='small' icon-only={true}></cura-button-transparent>`,\n },\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
export class CuraDropdownSearchOptionTitle {
|
|
3
3
|
render() {
|
|
4
|
-
return (h(Host, { key: '
|
|
4
|
+
return (h(Host, { key: 'd27a47a6d61497f488c449188b2c6036529350cc', slot: "dropdown-search-option" }, h("cura-label", { key: 'ba63e9fce7392087551ccc7fb46a83cffa6785c9', color: "neutral-dark", size: "xsmall", lineHeight: "16px", marginBlock: "0" }, h("slot", { key: 'f14d41a3ed995f6f9a946e7d96e5c0b0208310ad' }))));
|
|
5
5
|
}
|
|
6
6
|
static get is() { return "cura-dropdown-search-option-title"; }
|
|
7
7
|
static get encapsulation() { return "shadow"; }
|