@rededor/cura 0.5.2 → 0.5.3
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/icons/iconset-default-list.ts +1 -1
- package/dist/assets/icons/iconset-default-tmp.svg +4 -0
- package/dist/assets/icons/iconset-default.svg +1 -1
- package/dist/cjs/cura-accordion_8.cjs.entry.js +10 -17
- package/dist/cjs/cura-accordion_8.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-alert.cjs.entry.js +67 -0
- package/dist/cjs/cura-alert.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-button-outline.cjs.entry.js +1 -1
- package/dist/cjs/cura-button-select.cjs.entry.js +97 -0
- package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-button-transparent.cjs.entry.js +1 -1
- package/dist/cjs/cura-checkbox.cjs.entry.js +144 -0
- package/dist/cjs/cura-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-display.cjs.entry.js +1 -1
- package/dist/cjs/cura-forms.definitions-11be2ebd.js +20 -0
- package/dist/cjs/cura-forms.definitions-11be2ebd.js.map +1 -0
- package/dist/cjs/cura-icon.definitions-b73b0178.js +21 -0
- package/dist/cjs/cura-icon.definitions-b73b0178.js.map +1 -0
- package/dist/cjs/cura-icons-view.cjs.entry.js +13 -6
- package/dist/cjs/cura-icons-view.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-input-text.cjs.entry.js +3907 -0
- package/dist/cjs/cura-input-text.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-label.cjs.entry.js +1 -1
- package/dist/cjs/cura-radio.cjs.entry.js +114 -0
- package/dist/cjs/cura-radio.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-switch.cjs.entry.js +89 -0
- package/dist/cjs/cura-switch.cjs.entry.js.map +1 -0
- package/dist/cjs/cura.cjs.js +2 -2
- package/dist/cjs/{index-404d93e9.js → index-7616f620.js} +35 -1
- package/dist/cjs/index-7616f620.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/assets/icons/iconset-default-list.js +1 -1
- package/dist/collection/assets/icons/iconset-default-list.js.map +1 -1
- package/dist/collection/assets/icons/iconset-default-tmp.svg +4 -0
- package/dist/collection/assets/icons/iconset-default.svg +1 -1
- package/dist/collection/assets-raw/icons/default/swap.svg +3 -0
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/buttons/cura-button/cura-button.css +4 -0
- package/dist/collection/components/buttons/cura-button/cura-button.stories.js +2 -2
- package/dist/collection/components/buttons/cura-button/cura-button.stories.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.css +4 -0
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js +2 -2
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.css +139 -0
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +263 -0
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js.map +1 -0
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.css +4 -0
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js +2 -2
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js.map +1 -1
- package/dist/collection/components/cura-alert/cura-alert.css +30 -0
- package/dist/collection/components/cura-alert/cura-alert.js +167 -0
- package/dist/collection/components/cura-alert/cura-alert.js.map +1 -0
- package/dist/collection/components/cura-alert/cura-alert.stories.js +95 -0
- package/dist/collection/components/cura-alert/cura-alert.stories.js.map +1 -0
- package/dist/collection/components/cura-icon/cura-icon.definitions.js +15 -0
- package/dist/collection/components/cura-icon/cura-icon.definitions.js.map +1 -0
- package/dist/collection/components/cura-icon/cura-icon.js +9 -16
- package/dist/collection/components/cura-icon/cura-icon.js.map +1 -1
- package/dist/collection/components/cura-icon/cura-icon.stories.js +7 -6
- package/dist/collection/components/cura-icon/cura-icon.stories.js.map +1 -1
- package/dist/collection/components/cura-icons-view/cura-icons-view.css +16 -17
- package/dist/collection/components/cura-icons-view/cura-icons-view.js +10 -3
- package/dist/collection/components/cura-icons-view/cura-icons-view.js.map +1 -1
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.css +163 -0
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +431 -0
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js.map +1 -0
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.stories.js +196 -0
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-forms.definitions.js +15 -0
- package/dist/collection/components/forms/cura-forms.definitions.js.map +1 -0
- package/dist/collection/components/forms/cura-input-text/cura-input-text.css +326 -0
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js +655 -0
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js.map +1 -0
- package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js +224 -0
- package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js +46 -0
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js.map +1 -0
- package/dist/collection/components/forms/cura-radio/cura-radio.css +146 -0
- package/dist/collection/components/forms/cura-radio/cura-radio.js +365 -0
- package/dist/collection/components/forms/cura-radio/cura-radio.js.map +1 -0
- package/dist/collection/components/forms/cura-radio/cura-radio.stories.js +175 -0
- package/dist/collection/components/forms/cura-radio/cura-radio.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-switch/cura-switch.css +100 -0
- package/dist/collection/components/forms/cura-switch/cura-switch.js +266 -0
- package/dist/collection/components/forms/cura-switch/cura-switch.js.map +1 -0
- package/dist/collection/components/forms/cura-switch/cura-switch.stories.js +137 -0
- package/dist/collection/components/forms/cura-switch/cura-switch.stories.js.map +1 -0
- package/dist/components/cura-alert.d.ts +11 -0
- package/dist/components/cura-alert.js +105 -0
- package/dist/components/cura-alert.js.map +1 -0
- package/dist/components/cura-button-select.d.ts +11 -0
- package/dist/components/cura-button-select.js +127 -0
- package/dist/components/cura-button-select.js.map +1 -0
- package/dist/components/cura-checkbox.d.ts +11 -0
- package/dist/components/cura-checkbox.js +192 -0
- package/dist/components/cura-checkbox.js.map +1 -0
- package/dist/components/cura-forms.definitions.js +18 -0
- package/dist/components/cura-forms.definitions.js.map +1 -0
- package/dist/components/cura-heading.js +1 -100
- package/dist/components/cura-heading.js.map +1 -1
- package/dist/components/cura-heading2.js +104 -0
- package/dist/components/cura-heading2.js.map +1 -0
- package/dist/components/cura-icon2.js +24 -17
- package/dist/components/cura-icon2.js.map +1 -1
- package/dist/components/cura-icons-view.js +31 -7
- package/dist/components/cura-icons-view.js.map +1 -1
- package/dist/components/cura-input-text.d.ts +11 -0
- package/dist/components/cura-input-text.js +3961 -0
- package/dist/components/cura-input-text.js.map +1 -0
- package/dist/components/cura-label.js +1 -84
- package/dist/components/cura-label.js.map +1 -1
- package/dist/components/cura-label2.js +88 -0
- package/dist/components/cura-label2.js.map +1 -0
- package/dist/components/cura-paragraph.js +1 -82
- package/dist/components/cura-paragraph.js.map +1 -1
- package/dist/components/cura-paragraph2.js +86 -0
- package/dist/components/cura-paragraph2.js.map +1 -0
- package/dist/components/cura-radio.d.ts +11 -0
- package/dist/components/cura-radio.js +154 -0
- package/dist/components/cura-radio.js.map +1 -0
- package/dist/components/cura-switch.d.ts +11 -0
- package/dist/components/cura-switch.js +119 -0
- package/dist/components/cura-switch.js.map +1 -0
- package/dist/components/index.js +12 -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/cura.js +1 -1
- package/dist/cura/p-1228e771.entry.js +2 -0
- package/dist/cura/p-1228e771.entry.js.map +1 -0
- package/dist/cura/p-2d42ccf4.entry.js +2 -0
- package/dist/cura/p-2d42ccf4.entry.js.map +1 -0
- package/dist/cura/p-3688570d.js +2 -0
- package/dist/cura/p-3688570d.js.map +1 -0
- package/dist/cura/p-36a83bc7.system.js +3 -0
- package/dist/cura/p-36a83bc7.system.js.map +1 -0
- package/dist/cura/p-3f3355f3.system.entry.js +2 -0
- package/dist/cura/p-3f3355f3.system.entry.js.map +1 -0
- package/dist/cura/p-4df84c9e.entry.js +2 -0
- package/dist/cura/p-4df84c9e.entry.js.map +1 -0
- package/dist/cura/p-70cefaf8.entry.js +2 -0
- package/dist/cura/p-70cefaf8.entry.js.map +1 -0
- package/dist/cura/{p-0c79c54e.entry.js → p-72a9ed55.entry.js} +2 -2
- package/dist/cura/{p-7c8f3c77.system.entry.js → p-75b2e4d1.system.entry.js} +2 -2
- package/dist/cura/{p-03047b3e.entry.js → p-880917c1.entry.js} +2 -2
- package/dist/cura/{p-d47b9cfe.system.entry.js → p-9471c93e.system.entry.js} +2 -2
- package/dist/cura/p-98014544.entry.js +2 -0
- package/dist/cura/p-98014544.entry.js.map +1 -0
- package/dist/cura/{p-223924fb.system.entry.js → p-98352c92.system.entry.js} +2 -2
- package/dist/cura/p-a32889a4.system.js +2 -0
- package/dist/cura/p-a32889a4.system.js.map +1 -0
- package/dist/cura/p-a6d20c12.system.entry.js +2 -0
- package/dist/cura/p-a6d20c12.system.entry.js.map +1 -0
- package/dist/cura/p-ab8c9a8f.system.entry.js +2 -0
- package/dist/cura/p-ab8c9a8f.system.entry.js.map +1 -0
- package/dist/cura/{p-91b0f78e.entry.js → p-ad194144.entry.js} +2 -2
- package/dist/cura/p-b0e13882.system.entry.js +2 -0
- package/dist/cura/p-b0e13882.system.entry.js.map +1 -0
- package/dist/cura/p-ba66d7be.js +3 -0
- package/dist/cura/{p-c0c00396.system.js.map → p-ba66d7be.js.map} +1 -1
- package/dist/cura/p-bb3f9d05.entry.js +2 -0
- package/dist/cura/p-bb3f9d05.entry.js.map +1 -0
- package/dist/cura/p-c791725b.js +2 -0
- package/dist/cura/p-c791725b.js.map +1 -0
- package/dist/cura/p-c9afb94f.entry.js +2 -0
- package/dist/cura/p-c9afb94f.entry.js.map +1 -0
- package/dist/cura/p-d3f9c888.system.js +2 -0
- package/dist/cura/p-d3f9c888.system.js.map +1 -0
- package/dist/cura/{p-ca054b07.system.entry.js → p-e5e259fd.system.entry.js} +2 -2
- package/dist/cura/{p-49813052.entry.js → p-edeffbfc.entry.js} +2 -2
- package/dist/cura/p-eea5ca70.system.entry.js +2 -0
- package/dist/cura/p-eea5ca70.system.entry.js.map +1 -0
- package/dist/cura/p-f6e61abf.system.entry.js +2 -0
- package/dist/cura/p-f6e61abf.system.entry.js.map +1 -0
- package/dist/cura/p-f89f2ecc.system.entry.js +2 -0
- package/dist/cura/p-f89f2ecc.system.entry.js.map +1 -0
- package/dist/cura/p-fc4ba4ce.system.js +2 -0
- package/dist/cura/p-fc4ba4ce.system.js.map +1 -0
- package/dist/cura/p-fef52079.entry.js +2 -0
- package/dist/cura/p-fef52079.entry.js.map +1 -0
- package/dist/cura/p-ffd41520.system.entry.js +2 -0
- package/dist/cura/p-ffd41520.system.entry.js.map +1 -0
- package/dist/esm/cura-accordion_8.entry.js +10 -17
- package/dist/esm/cura-accordion_8.entry.js.map +1 -1
- package/dist/esm/cura-alert.entry.js +63 -0
- package/dist/esm/cura-alert.entry.js.map +1 -0
- package/dist/esm/cura-button-outline.entry.js +1 -1
- package/dist/esm/cura-button-select.entry.js +93 -0
- package/dist/esm/cura-button-select.entry.js.map +1 -0
- package/dist/esm/cura-button-transparent.entry.js +1 -1
- package/dist/esm/cura-checkbox.entry.js +140 -0
- package/dist/esm/cura-checkbox.entry.js.map +1 -0
- package/dist/esm/cura-display.entry.js +1 -1
- package/dist/esm/cura-forms.definitions-0f774253.js +18 -0
- package/dist/esm/cura-forms.definitions-0f774253.js.map +1 -0
- package/dist/esm/cura-icon.definitions-a63d1862.js +18 -0
- package/dist/esm/cura-icon.definitions-a63d1862.js.map +1 -0
- package/dist/esm/cura-icons-view.entry.js +13 -6
- package/dist/esm/cura-icons-view.entry.js.map +1 -1
- package/dist/esm/cura-input-text.entry.js +3903 -0
- package/dist/esm/cura-input-text.entry.js.map +1 -0
- package/dist/esm/cura-label.entry.js +1 -1
- package/dist/esm/cura-radio.entry.js +110 -0
- package/dist/esm/cura-radio.entry.js.map +1 -0
- package/dist/esm/cura-switch.entry.js +85 -0
- package/dist/esm/cura-switch.entry.js.map +1 -0
- package/dist/esm/cura.js +3 -3
- package/dist/esm/{index-d99da69e.js → index-81f1a268.js} +35 -2
- package/dist/{esm-es5/index-d99da69e.js.map → esm/index-81f1a268.js.map} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm-es5/cura-accordion_8.entry.js +1 -1
- package/dist/esm-es5/cura-accordion_8.entry.js.map +1 -1
- package/dist/esm-es5/cura-alert.entry.js +2 -0
- package/dist/esm-es5/cura-alert.entry.js.map +1 -0
- package/dist/esm-es5/cura-button-outline.entry.js +1 -1
- package/dist/esm-es5/cura-button-select.entry.js +2 -0
- package/dist/esm-es5/cura-button-select.entry.js.map +1 -0
- package/dist/esm-es5/cura-button-transparent.entry.js +1 -1
- package/dist/esm-es5/cura-checkbox.entry.js +2 -0
- package/dist/esm-es5/cura-checkbox.entry.js.map +1 -0
- package/dist/esm-es5/cura-display.entry.js +1 -1
- package/dist/esm-es5/cura-forms.definitions-0f774253.js +2 -0
- package/dist/esm-es5/cura-forms.definitions-0f774253.js.map +1 -0
- package/dist/esm-es5/cura-icon.definitions-a63d1862.js +2 -0
- package/dist/esm-es5/cura-icon.definitions-a63d1862.js.map +1 -0
- package/dist/esm-es5/cura-icons-view.entry.js +1 -1
- package/dist/esm-es5/cura-icons-view.entry.js.map +1 -1
- package/dist/esm-es5/cura-input-text.entry.js +2 -0
- package/dist/esm-es5/cura-input-text.entry.js.map +1 -0
- package/dist/esm-es5/cura-label.entry.js +1 -1
- package/dist/esm-es5/cura-radio.entry.js +2 -0
- package/dist/esm-es5/cura-radio.entry.js.map +1 -0
- package/dist/esm-es5/cura-switch.entry.js +2 -0
- package/dist/esm-es5/cura-switch.entry.js.map +1 -0
- package/dist/esm-es5/cura.js +1 -1
- package/dist/esm-es5/cura.js.map +1 -1
- package/dist/esm-es5/index-81f1a268.js +3 -0
- package/dist/esm-es5/index-81f1a268.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/types/components/buttons/cura-button/cura-button.d.ts +1 -1
- package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +51 -0
- package/dist/types/components/cura-alert/cura-alert.d.ts +16 -0
- package/dist/types/components/cura-alert/cura-alert.stories.d.ts +79 -0
- package/dist/types/components/cura-icon/cura-icon.d.ts +0 -42
- package/dist/types/components/cura-icon/cura-icon.definitions.d.ts +47 -0
- package/dist/types/components/cura-icons-view/cura-icons-view.d.ts +2 -1
- package/dist/types/components/forms/cura-checkbox/cura-checkbox.d.ts +100 -0
- package/dist/types/components/forms/cura-checkbox/cura-checkbox.stories.d.ts +199 -0
- package/dist/types/components/forms/cura-forms.definitions.d.ts +14 -0
- package/dist/types/components/forms/cura-input-text/cura-input-text.d.ts +138 -0
- package/dist/types/components/forms/cura-input-text/cura-input-text.stories.d.ts +224 -0
- package/dist/types/components/forms/cura-input-text/mask-presets/input-mask-presets.d.ts +5 -0
- package/dist/types/components/forms/cura-radio/cura-radio.d.ts +81 -0
- package/dist/types/components/forms/cura-radio/cura-radio.stories.d.ts +180 -0
- package/dist/types/components/forms/cura-switch/cura-switch.d.ts +62 -0
- package/dist/types/components/forms/cura-switch/cura-switch.stories.d.ts +135 -0
- package/dist/types/components.d.ts +602 -0
- package/package.json +5 -4
- package/dist/cjs/index-404d93e9.js.map +0 -1
- package/dist/cura/p-46d20db3.js +0 -3
- package/dist/cura/p-46d20db3.js.map +0 -1
- package/dist/cura/p-4bdbcdf0.system.entry.js +0 -2
- package/dist/cura/p-4bdbcdf0.system.entry.js.map +0 -1
- package/dist/cura/p-8b18b5f7.system.js +0 -2
- package/dist/cura/p-8b18b5f7.system.js.map +0 -1
- package/dist/cura/p-a0395f90.entry.js +0 -2
- package/dist/cura/p-a0395f90.entry.js.map +0 -1
- package/dist/cura/p-a7ef255f.entry.js +0 -2
- package/dist/cura/p-a7ef255f.entry.js.map +0 -1
- package/dist/cura/p-c0c00396.system.js +0 -3
- package/dist/cura/p-fc77814b.system.entry.js +0 -2
- package/dist/cura/p-fc77814b.system.entry.js.map +0 -1
- package/dist/esm/index-d99da69e.js.map +0 -1
- package/dist/esm-es5/index-d99da69e.js +0 -3
- /package/dist/cura/{p-0c79c54e.entry.js.map → p-72a9ed55.entry.js.map} +0 -0
- /package/dist/cura/{p-7c8f3c77.system.entry.js.map → p-75b2e4d1.system.entry.js.map} +0 -0
- /package/dist/cura/{p-03047b3e.entry.js.map → p-880917c1.entry.js.map} +0 -0
- /package/dist/cura/{p-d47b9cfe.system.entry.js.map → p-9471c93e.system.entry.js.map} +0 -0
- /package/dist/cura/{p-223924fb.system.entry.js.map → p-98352c92.system.entry.js.map} +0 -0
- /package/dist/cura/{p-91b0f78e.entry.js.map → p-ad194144.entry.js.map} +0 -0
- /package/dist/cura/{p-ca054b07.system.entry.js.map → p-e5e259fd.system.entry.js.map} +0 -0
- /package/dist/cura/{p-49813052.entry.js.map → p-edeffbfc.entry.js.map} +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Host, h } from '@stencil/core';
|
|
2
|
+
export class CuraAlert {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.handleClose = () => {
|
|
5
|
+
this.close.emit();
|
|
6
|
+
this.host.remove();
|
|
7
|
+
};
|
|
8
|
+
this.type = 'info';
|
|
9
|
+
this.floating = false;
|
|
10
|
+
this.label = undefined;
|
|
11
|
+
this.closeable = true;
|
|
12
|
+
this.styles = {};
|
|
13
|
+
}
|
|
14
|
+
setColors() {
|
|
15
|
+
const colors = [
|
|
16
|
+
{ name: '--color-lighter', theme: `${this.type}-lighter` },
|
|
17
|
+
{ name: '--neutral-black', theme: 'neutral-black' },
|
|
18
|
+
{ name: '--color-light', theme: `${this.type}-light` },
|
|
19
|
+
{ name: '--color-base', theme: `${this.type}-base` },
|
|
20
|
+
];
|
|
21
|
+
colors.forEach(color => {
|
|
22
|
+
this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.theme);
|
|
23
|
+
});
|
|
24
|
+
this.styles = Object.assign({}, this.styles);
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
this.setColors();
|
|
28
|
+
}
|
|
29
|
+
getClasses() {
|
|
30
|
+
const classes = {};
|
|
31
|
+
classes['conteiner'] = true;
|
|
32
|
+
classes['floating'] = this.floating;
|
|
33
|
+
return classes;
|
|
34
|
+
}
|
|
35
|
+
getNameIcon() {
|
|
36
|
+
const iconMapping = {
|
|
37
|
+
info: 'infoCircle',
|
|
38
|
+
success: 'checkCircle',
|
|
39
|
+
warning: 'alertCircle',
|
|
40
|
+
error: 'alertTriangle',
|
|
41
|
+
};
|
|
42
|
+
return iconMapping[this.type];
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return (h(Host, null, h("div", { class: this.getClasses(), style: this.styles }, h("cura-icon", { name: this.getNameIcon(), class: "icon-left", size: 16, color: `${this.type}-dark` }), h("div", { class: "content" }, h("cura-label", { class: "title", size: "small", color: "neutral-darker", weight: "bold" }, this.label), h("cura-paragraph", { class: "text", color: `${this.type}-darker`, size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, h("slot", null)), h("div", { class: "actions" }, h("slot", { name: "actions" }))), this.closeable ?
|
|
46
|
+
(h("cura-icon", { name: "close", size: 16, color: "error-dark", class: "icon-right", onClick: this.handleClose }))
|
|
47
|
+
: '')));
|
|
48
|
+
}
|
|
49
|
+
static get is() { return "cura-alert"; }
|
|
50
|
+
static get encapsulation() { return "shadow"; }
|
|
51
|
+
static get originalStyleUrls() {
|
|
52
|
+
return {
|
|
53
|
+
"$": ["cura-alert.scss"]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
static get styleUrls() {
|
|
57
|
+
return {
|
|
58
|
+
"$": ["cura-alert.css"]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
static get properties() {
|
|
62
|
+
return {
|
|
63
|
+
"type": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"mutable": false,
|
|
66
|
+
"complexType": {
|
|
67
|
+
"original": "'info' | 'success' | 'warning' | 'error'",
|
|
68
|
+
"resolved": "\"error\" | \"info\" | \"success\" | \"warning\"",
|
|
69
|
+
"references": {}
|
|
70
|
+
},
|
|
71
|
+
"required": false,
|
|
72
|
+
"optional": false,
|
|
73
|
+
"docs": {
|
|
74
|
+
"tags": [],
|
|
75
|
+
"text": ""
|
|
76
|
+
},
|
|
77
|
+
"attribute": "type",
|
|
78
|
+
"reflect": false,
|
|
79
|
+
"defaultValue": "'info'"
|
|
80
|
+
},
|
|
81
|
+
"floating": {
|
|
82
|
+
"type": "boolean",
|
|
83
|
+
"mutable": false,
|
|
84
|
+
"complexType": {
|
|
85
|
+
"original": "boolean",
|
|
86
|
+
"resolved": "boolean",
|
|
87
|
+
"references": {}
|
|
88
|
+
},
|
|
89
|
+
"required": false,
|
|
90
|
+
"optional": false,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": ""
|
|
94
|
+
},
|
|
95
|
+
"attribute": "floating",
|
|
96
|
+
"reflect": true,
|
|
97
|
+
"defaultValue": "false"
|
|
98
|
+
},
|
|
99
|
+
"label": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"mutable": false,
|
|
102
|
+
"complexType": {
|
|
103
|
+
"original": "string",
|
|
104
|
+
"resolved": "string",
|
|
105
|
+
"references": {}
|
|
106
|
+
},
|
|
107
|
+
"required": false,
|
|
108
|
+
"optional": false,
|
|
109
|
+
"docs": {
|
|
110
|
+
"tags": [],
|
|
111
|
+
"text": ""
|
|
112
|
+
},
|
|
113
|
+
"attribute": "label",
|
|
114
|
+
"reflect": true
|
|
115
|
+
},
|
|
116
|
+
"closeable": {
|
|
117
|
+
"type": "boolean",
|
|
118
|
+
"mutable": false,
|
|
119
|
+
"complexType": {
|
|
120
|
+
"original": "boolean",
|
|
121
|
+
"resolved": "boolean",
|
|
122
|
+
"references": {}
|
|
123
|
+
},
|
|
124
|
+
"required": false,
|
|
125
|
+
"optional": false,
|
|
126
|
+
"docs": {
|
|
127
|
+
"tags": [],
|
|
128
|
+
"text": ""
|
|
129
|
+
},
|
|
130
|
+
"attribute": "closeable",
|
|
131
|
+
"reflect": true,
|
|
132
|
+
"defaultValue": "true"
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
static get states() {
|
|
137
|
+
return {
|
|
138
|
+
"styles": {}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
static get events() {
|
|
142
|
+
return [{
|
|
143
|
+
"method": "close",
|
|
144
|
+
"name": "close",
|
|
145
|
+
"bubbles": true,
|
|
146
|
+
"cancelable": true,
|
|
147
|
+
"composed": true,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": ""
|
|
151
|
+
},
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "void",
|
|
154
|
+
"resolved": "void",
|
|
155
|
+
"references": {}
|
|
156
|
+
}
|
|
157
|
+
}];
|
|
158
|
+
}
|
|
159
|
+
static get elementRef() { return "host"; }
|
|
160
|
+
static get watchers() {
|
|
161
|
+
return [{
|
|
162
|
+
"propName": "type",
|
|
163
|
+
"methodName": "setColors"
|
|
164
|
+
}];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=cura-alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-alert.js","sourceRoot":"","sources":["../../../src/components/cura-alert/cura-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAA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;;;;;CACF","sourcesContent":["import { Component, Element, Prop, Host, h, State, Watch, Event, EventEmitter } from '@stencil/core';\n@Component({\n tag: 'cura-alert',\n styleUrl: 'cura-alert.scss',\n shadow: true,\n})\nexport class CuraAlert {\n @Element() host: HTMLElement;\n\n @Prop() type: 'info' | 'success' | 'warning' | 'error' = 'info';\n @Prop({ reflect: true }) floating = false;\n @Prop({ reflect: true }) label: string;\n @Prop({reflect: true}) closeable = true;\n @State()\n styles = {};\n\n @Event({ eventName: 'close' }) close: EventEmitter<void>;\n\n @Watch('type')\n setColors() {\n const colors = [\n { name: '--color-lighter', theme: `${this.type}-lighter` },\n { name: '--neutral-black', theme: 'neutral-black' },\n { name: '--color-light', theme: `${this.type}-light` },\n { name: '--color-base', theme: `${this.type}-base` },\n ];\n\n colors.forEach(color => {\n this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.theme);\n });\n this.styles = {...this.styles};\n }\n\n connectedCallback() {\n this.setColors();\n }\n\n getClasses() {\n const classes = {};\n classes['conteiner'] = true;\n classes['floating'] = this.floating;\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 iconMapping[this.type];\n }\n\n handleClose = () => {\n this.close.emit();\n this.host.remove();\n };\n\n render() {\n return (\n <Host>\n <div class={this.getClasses()} style={this.styles}>\n <cura-icon name={this.getNameIcon()} class=\"icon-left\" size={16} color={`${this.type}-dark`}></cura-icon>\n <div class=\"content\">\n <cura-label class=\"title\" size=\"small\" color=\"neutral-darker\" weight=\"bold\">\n {this.label}\n </cura-label>\n <cura-paragraph class=\"text\" color={`${this.type}-darker`} size=\"xsmall\" marginBlock=\"0\" lineHeight=\"133.33%\">\n <slot></slot>\n </cura-paragraph>\n <div class=\"actions\">\n <slot name=\"actions\"></slot>\n </div>\n </div>\n { this.closeable ?\n (<cura-icon name=\"close\" size={16} color=\"error-dark\" class=\"icon-right\" onClick={this.handleClose}></cura-icon>)\n : '' }\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
const renderCuraAlert = (label, args) => {
|
|
14
|
+
const block = `<cura-alert${label ? `
|
|
15
|
+
label="${label}"` : ''}${args.type && args.type !== 'info' ? `
|
|
16
|
+
type="${args.type}"` : ''}${args.closeable === false ? `
|
|
17
|
+
closeable="${args.closeable}"` : ''}${args.floating ? `
|
|
18
|
+
floating="${args.floating}"` : ''}>
|
|
19
|
+
${args.content}${args.actions ? `
|
|
20
|
+
<cura-paragraph slot="actions" margin-block="0" spot-color="${args.type}-dark" size="xsmall">${args.actions}</cura-paragraph>` : ''}
|
|
21
|
+
</cura-alert>
|
|
22
|
+
`;
|
|
23
|
+
return `${block}`;
|
|
24
|
+
};
|
|
25
|
+
export default {
|
|
26
|
+
title: 'Componentes/Feedback/Alert',
|
|
27
|
+
tags: ['autodocs'],
|
|
28
|
+
render: (_a) => {
|
|
29
|
+
var { label } = _a, args = __rest(_a, ["label"]);
|
|
30
|
+
return renderCuraAlert(label, args);
|
|
31
|
+
},
|
|
32
|
+
argTypes: {
|
|
33
|
+
floating: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Define se o alerta é flutuante e aplica o sombreamento.',
|
|
36
|
+
table: {
|
|
37
|
+
category: 'State',
|
|
38
|
+
defaultValue: { summary: false },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
closeable: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
description: 'Define se o alerta pode ser fechado.',
|
|
44
|
+
table: {
|
|
45
|
+
category: 'Properties',
|
|
46
|
+
defaultValue: { summary: true },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
type: {
|
|
50
|
+
control: { type: 'select' },
|
|
51
|
+
options: ['', 'info', 'success', 'warning', 'error'],
|
|
52
|
+
description: 'Tipos de alertas disponíveis: <b>info</b>, <b>success</b>, <b>warning</b>, <b>error</b>.',
|
|
53
|
+
table: {
|
|
54
|
+
category: 'Properties',
|
|
55
|
+
defaultValue: { summary: 'info' },
|
|
56
|
+
},
|
|
57
|
+
name: 'type',
|
|
58
|
+
},
|
|
59
|
+
label: {
|
|
60
|
+
control: 'text',
|
|
61
|
+
description: 'Título do alerta.',
|
|
62
|
+
table: {
|
|
63
|
+
category: 'Properties',
|
|
64
|
+
},
|
|
65
|
+
name: 'label',
|
|
66
|
+
},
|
|
67
|
+
actions: {
|
|
68
|
+
control: 'text',
|
|
69
|
+
description: 'Conteúdo de itens de ação do alerta. É projetado no slot nomeado `actions`.',
|
|
70
|
+
defaultValue: '',
|
|
71
|
+
table: {
|
|
72
|
+
category: 'Slot',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
content: {
|
|
76
|
+
control: 'text',
|
|
77
|
+
description: 'Conteúdo do texto principal do alerta. É projetado automaticamente dentro do slot padrão.',
|
|
78
|
+
defaultValue: '',
|
|
79
|
+
table: {
|
|
80
|
+
category: 'Slot',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
export const Alert = {
|
|
86
|
+
args: {
|
|
87
|
+
label: 'Título do alerta',
|
|
88
|
+
type: 'info',
|
|
89
|
+
closeable: true,
|
|
90
|
+
floating: false,
|
|
91
|
+
content: 'Texto explicativo para o alert.',
|
|
92
|
+
actions: '<a href="https://www.rededorsaoluiz.com.br" target="_blank">Link</a>',
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=cura-alert.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-alert.stories.js","sourceRoot":"","sources":["../../../src/components/cura-alert/cura-alert.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,IAAS,EAAE,EAAE;EACnD,MAAM,KAAK,GAAG,cAAc,KAAK,CAAC,CAAC,CAAC;WAC3B,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC;UACrD,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC;eAC1C,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;cAC1C,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE;IAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;gEAC8B,IAAI,CAAC,IAAI,wBAAwB,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,EAAE;;CAEpI,CAAC;EACA,OAAO,GAAG,KAAK,EAAE,CAAC;AACpB,CAAC,CAAA;AAED,eAAe;EACb,KAAK,EAAE,4BAA4B;EACnC,IAAI,EAAE,CAAC,UAAU,CAAC;EAClB,MAAM,EAAE,CAAC,EAAkB,EAAE,EAAE;QAAtB,EAAE,KAAK,OAAW,EAAN,IAAI,cAAhB,SAAkB,CAAF;IACvB,OAAO,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;EACtC,CAAC;EACD,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,EAAE,KAAK;IACf,OAAO,EAAE,iCAAiC;IAC1C,OAAO,EAAE,sEAAsE;GAChF;CACF,CAAC","sourcesContent":["const renderCuraAlert = (label: string, args: any) => {\n const block = `<cura-alert${label ? `\n label=\"${label}\"` : ''}${args.type && args.type !== 'info' ? `\n type=\"${args.type}\"` : ''}${args.closeable === false ? `\n closeable=\"${args.closeable}\"` : ''}${args.floating ? `\n floating=\"${args.floating}\"` : ''}>\n ${args.content}${args.actions ? `\n <cura-paragraph slot=\"actions\" margin-block=\"0\" spot-color=\"${args.type}-dark\" size=\"xsmall\">${args.actions}</cura-paragraph>` : ''}\n</cura-alert>\n`;\n return `${block}`;\n}\n\nexport default {\n title: 'Componentes/Feedback/Alert',\n tags: ['autodocs'],\n render: ({ label, ...args }) => {\n return renderCuraAlert(label, args);\n },\n argTypes: {\n floating: {\n control: 'boolean',\n description: 'Define se o alerta é flutuante e aplica o sombreamento.',\n table: {\n category: 'State',\n defaultValue: { summary: false },\n },\n },\n closeable: {\n control: 'boolean',\n description: 'Define se o alerta pode ser fechado.',\n table: {\n category: 'Properties',\n defaultValue: { summary: true },\n },\n },\n type: {\n control: { type: 'select' },\n options: ['', 'info', 'success', 'warning', 'error'],\n description: 'Tipos de alertas disponíveis: <b>info</b>, <b>success</b>, <b>warning</b>, <b>error</b>.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'info' },\n },\n name: 'type',\n },\n label: {\n control: 'text',\n description: 'Título do alerta.',\n table: {\n category: 'Properties',\n },\n name: 'label',\n },\n actions: {\n control: 'text',\n description: 'Conteúdo de itens de ação do alerta. É projetado no slot nomeado `actions`.',\n defaultValue: '',\n table: {\n category: 'Slot',\n },\n },\n content: {\n control: 'text',\n description: 'Conteúdo do texto principal do alerta. É projetado automaticamente dentro do slot padrão.',\n defaultValue: '',\n table: {\n category: 'Slot',\n },\n },\n },\n};\n\nexport const Alert = {\n args: {\n label: 'Título do alerta',\n type: 'info',\n closeable: true,\n floating: false,\n content: 'Texto explicativo para o alert.',\n actions: '<a href=\"https://www.rededorsaoluiz.com.br\" target=\"_blank\">Link</a>',\n },\n};\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const microIcons = ['arrowDown', 'arrowLeft', 'arrowRight', 'arrowUp', 'check', 'checkDouble', 'close', 'closeCircle', 'collapse', 'down', 'expand', 'linkExternal', 'link', 'left', 'minus', 'minusCircle', 'minusSquare', 'order', 'subItem', 'right', 'plus', 'plusCircle', 'plusSquare', 'up', 'filter', 'swap'];
|
|
2
|
+
export const iconSizes = {
|
|
3
|
+
"128": { size: 128, stroke: 5.25 },
|
|
4
|
+
"72": { size: 72, stroke: 3.5 },
|
|
5
|
+
"64": { size: 64, stroke: 3.25 },
|
|
6
|
+
"48": { size: 48, stroke: 2.75 },
|
|
7
|
+
"40": { size: 40, stroke: 2.5 },
|
|
8
|
+
"32": { size: 32, stroke: 2.25 },
|
|
9
|
+
"24": { size: 24, stroke: 2 },
|
|
10
|
+
"20": { size: 20, stroke: 1.75 },
|
|
11
|
+
"16": { size: 16, stroke: 1.5 },
|
|
12
|
+
"micro": { size: 12, stroke: 1.5 },
|
|
13
|
+
"default": { size: 24, stroke: 2 }
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=cura-icon.definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-icon.definitions.js","sourceRoot":"","sources":["../../../src/components/cura-icon/cura-icon.definitions.tsx"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,WAAW,EAAC,WAAW,EAAC,YAAY,EAAC,SAAS,EAAC,OAAO,EAAC,aAAa,EAAC,OAAO,EAAC,aAAa,EAAC,UAAU,EAAC,MAAM,EAAC,QAAQ,EAAC,cAAc,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,aAAa,EAAC,aAAa,EAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAC,MAAM,EAAC,YAAY,EAAC,YAAY,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,CAAC,CAAC;AAEnS,MAAM,CAAC,MAAM,SAAS,GAAG;EACvB,KAAK,EAAE,EAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC;EAChC,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAC;EAC7B,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAC;EAC9B,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAC;EAC9B,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAC;EAC7B,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAC;EAC9B,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAC;EAC3B,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAC;EAC9B,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAC;EAC7B,OAAO,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE;EACjC,SAAS,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAC;CACjC,CAAC","sourcesContent":["export const microIcons = ['arrowDown','arrowLeft','arrowRight','arrowUp','check','checkDouble','close','closeCircle','collapse','down','expand','linkExternal','link','left','minus','minusCircle','minusSquare','order','subItem','right','plus','plusCircle','plusSquare','up','filter','swap'];\n\nexport const iconSizes = {\n \"128\": {size: 128, stroke: 5.25},\n \"72\": {size: 72, stroke: 3.5},\n \"64\": {size: 64, stroke: 3.25},\n \"48\": {size: 48, stroke: 2.75},\n \"40\": {size: 40, stroke: 2.5},\n \"32\": {size: 32, stroke: 2.25},\n \"24\": {size: 24, stroke: 2},\n \"20\": {size: 20, stroke: 1.75},\n \"16\": {size: 16, stroke: 1.5},\n \"micro\": {size: 12, stroke: 1.5 },\n \"default\": {size: 24, stroke: 2}\n};\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
|
+
import { microIcons, iconSizes } from './cura-icon.definitions';
|
|
2
3
|
export class CuraIcon {
|
|
3
4
|
constructor() {
|
|
4
|
-
this.sizes = {
|
|
5
|
-
"128": { size: 128, stroke: 5.25 },
|
|
6
|
-
"72": { size: 72, stroke: 3.5 },
|
|
7
|
-
"64": { size: 64, stroke: 3.25 },
|
|
8
|
-
"48": { size: 48, stroke: 2.75 },
|
|
9
|
-
"40": { size: 40, stroke: 2.5 },
|
|
10
|
-
"32": { size: 32, stroke: 2.25 },
|
|
11
|
-
"24": { size: 24, stroke: 2 },
|
|
12
|
-
"20": { size: 20, stroke: 1.75 },
|
|
13
|
-
"16": { size: 16, stroke: 1.5 },
|
|
14
|
-
"default": { size: 24, stroke: 2 }
|
|
15
|
-
};
|
|
16
5
|
this.name = '';
|
|
17
6
|
this.color = 'neutral-base';
|
|
18
7
|
this.size = undefined;
|
|
@@ -20,14 +9,18 @@ export class CuraIcon {
|
|
|
20
9
|
this.disabled = false;
|
|
21
10
|
}
|
|
22
11
|
sizeHandler(size) {
|
|
12
|
+
if (size === 'micro' && !microIcons.includes(this.name)) {
|
|
13
|
+
size = 16;
|
|
14
|
+
console.warn(`Icon ${this.name} doesn't support micro size. Minimum size of 16 was applied instead.`);
|
|
15
|
+
}
|
|
23
16
|
const scaledStroke = (iconSize) => {
|
|
24
|
-
return `${
|
|
17
|
+
return `${iconSizes[iconSize].stroke * (iconSizes.default.size / iconSizes[iconSize].size)}px`;
|
|
25
18
|
};
|
|
26
|
-
this.setHostProperty('--size',
|
|
27
|
-
this.setHostProperty('--stroke',
|
|
19
|
+
this.setHostProperty('--size', iconSizes[`${size}`] ? `${iconSizes[size].size}px` : `${iconSizes.default.size}px`);
|
|
20
|
+
this.setHostProperty('--stroke', iconSizes[`${size}`] ? scaledStroke(size) : scaledStroke("default"));
|
|
28
21
|
}
|
|
29
22
|
colorHandler() {
|
|
30
|
-
this.setHostProperty('--color', window.CuraAPI.theme.colors.getColor(this.disabled ? 'neutral-light' : this.color));
|
|
23
|
+
this.setHostProperty('--color', window.CuraAPI.theme.colors.getColor(this.disabled ? 'neutral-light' : this.color || 'neutral'));
|
|
31
24
|
}
|
|
32
25
|
connectedCallback() {
|
|
33
26
|
this.assetsPath = window.CuraAPI.localAssetsPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cura-icon.js","sourceRoot":"","sources":["../../../src/components/cura-icon/cura-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"cura-icon.js","sourceRoot":"","sources":["../../../src/components/cura-icon/cura-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAOhE,MAAM,OAAO,QAAQ;;gBAEW,EAAE;iBAChB,cAAc;;mBAEG,SAAS;oBACvB,KAAK;;EAKxB,WAAW,CAAC,IAAqB;IAC/B,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAG;MACxD,IAAI,GAAG,EAAE,CAAC;MACV,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,sEAAsE,CAAC,CAAC;KACvG;IACD,MAAM,YAAY,GAAG,CAAC,QAAyB,EAAE,EAAE;MACjD,OAAO,GA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AAe,EACnC,KAAK,EAAC,4BAA4B;QAClC,WACE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,kBAAkB,IAAI,CAAC,OAAO,QAAQ,IAAI,CAAC,IAAI,EAAE,GAC1E,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, Element, Watch } from '@stencil/core';\nimport { microIcons, iconSizes } from './cura-icon.definitions';\n\n@Component({\n tag: 'cura-icon',\n styleUrl: 'cura-icon.scss',\n shadow: true\n})\nexport class CuraIcon {\n\n @Prop({reflect: true}) name = '';\n @Prop() color = 'neutral-base';\n @Prop() size: string | number;\n @Prop({reflect: true}) iconset = 'default';\n @Prop() disabled = false;\n\n @Element() host: HTMLElement;\n\n @Watch('size')\n sizeHandler(size: string | number) {\n if (size === 'micro' && !microIcons.includes(this.name) ) {\n size = 16;\n console.warn(`Icon ${this.name} doesn't support micro size. Minimum size of 16 was applied instead.`);\n }\n const scaledStroke = (iconSize: string | number) => {\n return `${iconSizes[iconSize].stroke * (iconSizes.default.size / iconSizes[iconSize].size)}px`;\n }\n this.setHostProperty('--size', iconSizes[`${size}`] ? `${iconSizes[size].size}px` : `${iconSizes.default.size}px`);\n this.setHostProperty('--stroke', iconSizes[`${size}`] ? scaledStroke(size) : scaledStroke(\"default\"));\n }\n\n @Watch('color')\n @Watch('disabled')\n colorHandler() {\n this.setHostProperty('--color', window.CuraAPI.theme.colors.getColor(this.disabled ? 'neutral-light' : this.color || 'neutral'));\n }\n\n assetsPath: string;\n\n connectedCallback() {\n this.assetsPath = window.CuraAPI.localAssetsPath;\n this.sizeHandler(this.size);\n this.colorHandler();\n }\n\n setHostProperty(prop: string, value: string) {\n this.host.style.setProperty(prop, value);\n }\n\n render() {\n return (\n <Host>\n <svg\n version=\"1.1\"\n viewBox=\"0 0 24 24\"\n preserveAspectRatio=\"xMidYMid meet\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <use\n xlinkHref={`${this.assetsPath}/icons/iconset-${this.iconset}.svg#${this.name}`}>\n </use>\n </svg>\n </Host>\n );\n }\n\n}\n"]}
|
|
@@ -12,6 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
import iconNames from '../../assets/icons/iconset-default-list';
|
|
14
14
|
import { getColorsWithDepths } from "../../utils/utils";
|
|
15
|
+
import { iconSizes } from './cura-icon.definitions';
|
|
15
16
|
const colors = getColorsWithDepths();
|
|
16
17
|
export default {
|
|
17
18
|
title: 'Componentes/Icons/Icon',
|
|
@@ -38,8 +39,8 @@ export default {
|
|
|
38
39
|
},
|
|
39
40
|
size: {
|
|
40
41
|
control: { type: 'select' },
|
|
41
|
-
options:
|
|
42
|
-
description: '
|
|
42
|
+
options: Object.keys(iconSizes).filter(key => key !== 'default'),
|
|
43
|
+
description: 'Define o tamanho. Alguns ícones suportam o tamanho <b>micro</b>. Consulte a documentação do iconset para mais detalhes.',
|
|
43
44
|
table: {
|
|
44
45
|
category: 'Properties',
|
|
45
46
|
defaultValue: { summary: '24' }
|
|
@@ -47,8 +48,8 @@ export default {
|
|
|
47
48
|
},
|
|
48
49
|
color: {
|
|
49
50
|
control: { type: 'select' },
|
|
50
|
-
options: colors,
|
|
51
|
-
description: '
|
|
51
|
+
options: ['', ...colors],
|
|
52
|
+
description: 'Define a cor do ícone. Aceita qualquer valor do esquema de cores do design system.',
|
|
52
53
|
table: {
|
|
53
54
|
category: 'Properties',
|
|
54
55
|
defaultValue: { summary: 'neutral' }
|
|
@@ -57,7 +58,7 @@ export default {
|
|
|
57
58
|
name: {
|
|
58
59
|
control: { type: 'select' },
|
|
59
60
|
options: iconNames,
|
|
60
|
-
description: '
|
|
61
|
+
description: 'Define o ícone pelo seu nome no iconset.',
|
|
61
62
|
table: {
|
|
62
63
|
category: 'Properties'
|
|
63
64
|
}
|
|
@@ -68,7 +69,7 @@ export const Icon = {
|
|
|
68
69
|
args: {
|
|
69
70
|
name: iconNames[0],
|
|
70
71
|
size: '24',
|
|
71
|
-
color: '
|
|
72
|
+
color: '',
|
|
72
73
|
disabled: false,
|
|
73
74
|
},
|
|
74
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cura-icon.stories.js","sourceRoot":"","sources":["../../../src/components/cura-icon/cura-icon.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,yCAAyC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"cura-icon.stories.js","sourceRoot":"","sources":["../../../src/components/cura-icon/cura-icon.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,yCAAyC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAC;AAErC,eAAe;EACb,KAAK,EAAE,wBAAwB;EAC/B,IAAI,EAAE,CAAC,UAAU,CAAC;EAClB,MAAM,EAAE,CAAC,EAAkB,EAAE,EAAE;QAAtB,EAAE,KAAK,OAAW,EAAN,IAAI,cAAhB,SAAkB,CAAF;IACvB,mFAAmF;IACnF,gCAAgC;IAChC,OAAO;UACD,IAAI,CAAC,IAAI;WACR,IAAI,CAAC,KAAK;UACX,IAAI,CAAC,IAAI;cACL,IAAI,CAAC,QAAQ;aACd,CAAC;EACZ,CAAC;EACD,QAAQ,EAAE;IACR,QAAQ,EAAE;MACR,OAAO,EAAE,SAAS;MAClB,WAAW,EAAE,qBAAqB;MAClC,KAAK,EAAE;QACL,QAAQ,EAAE,OAAO;QACjB,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,EAAC;OAClC;KACF;IACD,IAAI,EAAE;MACJ,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;MAC3B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC;MAChE,WAAW,EAAE,yHAAyH;MACtI,KAAK,EAAE;QACL,QAAQ,EAAE,YAAY;QACtB,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAC;OAC/B;KACF;IACD,KAAK,EAAE;MACL,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;MAC3B,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC;MACxB,WAAW,EAAE,oFAAoF;MACjG,KAAK,EAAE;QACL,QAAQ,EAAE,YAAY;QACtB,YAAY,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC;OACpC;KACF;IACD,IAAI,EAAE;MACJ,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE;MAC1B,OAAO,EAAE,SAAS;MAClB,WAAW,EAAE,0CAA0C;MACvD,KAAK,EAAE;QACL,QAAQ,EAAE,YAAY;OACvB;KACF;GACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG;EAClB,IAAI,EAAE;IACJ,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAClB,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,KAAK;GAChB;CACF,CAAC","sourcesContent":["import iconNames from '../../assets/icons/iconset-default-list';\nimport { getColorsWithDepths } from \"../../utils/utils\";\nimport { iconSizes } from './cura-icon.definitions';\n\nconst colors = getColorsWithDepths();\n\nexport default {\n title: 'Componentes/Icons/Icon',\n tags: ['autodocs'],\n render: ({ label, ...args }) => {\n // You can either use a function to create DOM elements or use a plain html string!\n // return `<div>${label}</div>`;\n return `<cura-icon\n name=\"${args.name}\"\n color=\"${args.color}\"\n size=\"${args.size}\"\n disabled=\"${args.disabled}\">\n</cura-icon>`;\n },\n argTypes: {\n disabled: {\n control: 'boolean',\n description: 'Estado desabilitado',\n table: {\n category: 'State',\n defaultValue: { summary: 'false'}\n }\n },\n size: {\n control: { type: 'select' },\n options: Object.keys(iconSizes).filter(key => key !== 'default'),\n description: 'Define o tamanho. Alguns ícones suportam o tamanho <b>micro</b>. Consulte a documentação do iconset para mais detalhes.',\n table: {\n category: 'Properties',\n defaultValue: { summary: '24'}\n }\n },\n color: {\n control: { type: 'select' },\n options: ['', ...colors],\n description: 'Define a cor do ícone. Aceita qualquer valor do esquema de cores do design system.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'neutral'}\n }\n },\n name: {\n control: {type: 'select' },\n options: iconNames,\n description: 'Define o ícone pelo seu nome no iconset.',\n table: {\n category: 'Properties'\n }\n }\n },\n};\n\nexport const Icon = {\n args: {\n name: iconNames[0],\n size: '24',\n color: '',\n disabled: false,\n },\n};\n"]}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
text-align: center;
|
|
19
|
+
align-items: center;
|
|
19
20
|
margin-right: 9px;
|
|
20
21
|
padding: 8px;
|
|
21
22
|
}
|
|
@@ -24,12 +25,13 @@
|
|
|
24
25
|
}
|
|
25
26
|
.iconSizes .size span {
|
|
26
27
|
font-size: 10px;
|
|
28
|
+
margin: 8px 0;
|
|
27
29
|
}
|
|
28
30
|
.iconSizes.invert {
|
|
29
31
|
margin-top: 12px;
|
|
30
32
|
}
|
|
31
33
|
.iconSizes.invert .size {
|
|
32
|
-
background-color: #
|
|
34
|
+
background-color: #2d2d2d;
|
|
33
35
|
color: #F6F6F6;
|
|
34
36
|
border-radius: 3px;
|
|
35
37
|
}
|
|
@@ -46,23 +48,20 @@
|
|
|
46
48
|
cursor: pointer;
|
|
47
49
|
opacity: 0.6;
|
|
48
50
|
transition: opacity 0.2s linear;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
width: 105px;
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
text-align: center;
|
|
55
|
+
align-items: center;
|
|
56
|
+
margin-bottom: 16px;
|
|
53
57
|
box-sizing: border-box;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
position: absolute;
|
|
58
|
-
top: -2px;
|
|
59
|
-
left: 50%;
|
|
60
|
-
transform: translateX(-50%) translateY(-100%);
|
|
61
|
-
display: none;
|
|
58
|
+
/* &.selected {
|
|
59
|
+
transform: scale(1.2);
|
|
60
|
+
} */
|
|
62
61
|
}
|
|
63
|
-
.icons .icon
|
|
64
|
-
|
|
62
|
+
.icons .icon cura-label {
|
|
63
|
+
margin-top: 8px;
|
|
65
64
|
}
|
|
66
|
-
.icons .icon
|
|
67
|
-
|
|
65
|
+
.icons .icon cura-paragraph {
|
|
66
|
+
margin-top: 4px;
|
|
68
67
|
}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
2
|
import iconsetdefaulticons from '../../assets/icons/iconset-default-list';
|
|
3
|
+
import { microIcons, iconSizes } from '../cura-icon/cura-icon.definitions';
|
|
3
4
|
export class CuraIconsView {
|
|
4
5
|
constructor() {
|
|
5
|
-
this.sizes =
|
|
6
|
+
this.sizes = Object.keys(iconSizes).filter(key => key !== 'default');
|
|
6
7
|
this.colors = ['primary', 'secondary', 'accent', 'info', 'warning', 'error', 'success', 'neutral'];
|
|
7
8
|
this.setSelected = (icon) => {
|
|
8
9
|
this.selected = icon;
|
|
9
10
|
};
|
|
10
|
-
this.selected =
|
|
11
|
+
this.selected = iconsetdefaulticons[0];
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
this.sizes.unshift(this.sizes.pop());
|
|
11
15
|
}
|
|
12
16
|
render() {
|
|
13
|
-
return (h(Host, null, h("div", { class: "iconDetail" }, h("
|
|
17
|
+
return (h(Host, null, h("div", { class: "iconDetail" }, h("cura-heading", { size: "small", "margin-block": "0 24px" }, "Icon: ", h("b", null, this.selected)), h("div", { class: "iconSizes" }, this.sizes.map(size => size === 'micro' && !microIcons.includes(this.selected) ? '' :
|
|
18
|
+
h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size }), h("span", null, size)))), h("div", { class: "iconSizes invert" }, this.sizes.map(size => size === 'micro' && !microIcons.includes(this.selected) ? '' :
|
|
19
|
+
h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size, color: "neutral-white" }), h("span", null, size))))), h("div", { class: "icons" }, iconsetdefaulticons.map(icon => h("div", { class: { icon: true, selected: icon === this.selected }, onClick: () => this.setSelected(icon) }, h("cura-icon", { name: icon, size: "32", color: icon === this.selected ? 'accent-dark' : 'neutral-dark' }), h("cura-label", { size: "xsmall", weight: icon === this.selected ? 'bold' : 'regular', color: icon === this.selected ? 'accent-dark' : 'neutral-dark' }, icon), !microIcons.includes(icon) ? '' :
|
|
20
|
+
h("cura-paragraph", { color: 'success-dark', size: "xsmall", "margin-block": "0px", "line-height": '100%' }, "MICRO"))))));
|
|
14
21
|
}
|
|
15
22
|
static get is() { return "cura-icons-view"; }
|
|
16
23
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cura-icons-view.js","sourceRoot":"","sources":["../../../src/components/cura-icons-view/cura-icons-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,mBAAmB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"cura-icons-view.js","sourceRoot":"","sources":["../../../src/components/cura-icons-view/cura-icons-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,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il/core';\nimport iconsetdefaulticons from '../../assets/icons/iconset-default-list';\nimport { microIcons, iconSizes } from '../cura-icon/cura-icon.definitions';\n\n@Component({\n tag: 'cura-icons-view',\n styleUrl: 'cura-icons-view.scss',\n shadow: true,\n})\nexport class CuraIconsView {\n\n sizes = Object.keys(iconSizes).filter(key => key !== 'default');\n colors = ['primary', 'secondary', 'accent', 'info', 'warning', 'error', 'success', 'neutral'];\n @State() selected = iconsetdefaulticons[0];\n\n connectedCallback() {\n this.sizes.unshift(this.sizes.pop());\n }\n\n setSelected = (icon) => {\n this.selected = icon;\n }\n\n render() {\n return (\n <Host>\n <div class=\"iconDetail\">\n <cura-heading size=\"small\" margin-block=\"0 24px\">Icon: <b>{ this.selected }</b></cura-heading>\n <div class=\"iconSizes\">\n { this.sizes.map( size =>\n size === 'micro' && !microIcons.includes(this.selected) ? '' :\n <div class=\"size\">\n <cura-icon name={this.selected} size={size}></cura-icon>\n <span>{ size }</span>\n </div>\n )}\n </div>\n <div class=\"iconSizes invert\">\n { this.sizes.map( size =>\n size === 'micro' && !microIcons.includes(this.selected) ? '' :\n <div class=\"size\">\n <cura-icon name={this.selected} size={size} color=\"neutral-white\"></cura-icon>\n <span>{ size }</span>\n </div>\n )}\n </div>\n </div>\n <div class=\"icons\">\n { iconsetdefaulticons.map(icon =>\n <div class={{icon: true, selected: icon === this.selected }} onClick={() => this.setSelected(icon)}>\n <cura-icon\n name={icon}\n size=\"32\"\n color={icon === this.selected ? 'accent-dark' : 'neutral-dark'}></cura-icon>\n <cura-label\n size=\"xsmall\"\n weight={icon === this.selected ? 'bold' : 'regular'}\n color={icon === this.selected ? 'accent-dark' : 'neutral-dark'}>{icon}</cura-label>\n { !microIcons.includes(icon) ? '' :\n <cura-paragraph\n color='success-dark'\n size=\"xsmall\"\n margin-block=\"0px\"\n line-height='100%'>MICRO</cura-paragraph>\n }\n </div>\n )}\n </div>\n </Host>\n );\n }\n\n}\n"]}
|