@rededor/cura 1.1.0 → 1.2.0-alpha.0
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/cura-assets.zip +0 -0
- package/dist/cjs/app-globals-4d07f363.js.map +1 -1
- package/dist/cjs/cura-accordion_12.cjs.entry.js +21 -15
- package/dist/cjs/cura-accordion_12.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-alert.cjs.entry.js +2 -2
- package/dist/cjs/cura-avatar.cjs.entry.js +2 -2
- package/dist/cjs/cura-badge-distance.cjs.entry.js +1 -1
- package/dist/cjs/cura-badge-number.cjs.entry.js +29 -0
- package/dist/cjs/cura-badge-number.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-button-outline.cjs.entry.js +2 -2
- package/dist/cjs/cura-button-select.cjs.entry.js +69 -58
- package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-transparent.cjs.entry.js +2 -2
- package/dist/cjs/cura-calendar.cjs.entry.js +120 -234
- package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-card.cjs.entry.js +2 -2
- 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 +3 -3
- package/dist/cjs/cura-dropdown-search.cjs.entry.js +30 -4
- package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-icons-view.cjs.entry.js +4 -4
- package/dist/cjs/cura-input-date.cjs.entry.js +188 -0
- package/dist/cjs/cura-input-date.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-loader-bar.cjs.entry.js +2 -2
- package/dist/cjs/cura-radio.cjs.entry.js +2 -2
- package/dist/cjs/cura-switch.cjs.entry.js +2 -2
- package/dist/cjs/cura-toast.cjs.entry.js +2 -2
- package/dist/cjs/cura.cjs.js +2 -2
- package/dist/cjs/index-6dc29195.js +126 -0
- package/dist/cjs/index-6dc29195.js.map +1 -0
- package/dist/cjs/{index-98e7ba54.js → index-e6d728ec.js} +70 -3
- package/dist/{esm/index-1ad98520.js.map → cjs/index-e6d728ec.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.css +30 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js +66 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js.map +1 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.stories.js +56 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.stories.js.map +1 -0
- package/dist/collection/components/buttons/cura-button/cura-button.js +1 -1
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +1 -1
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.css +49 -21
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +110 -113
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js +133 -0
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js.map +1 -0
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +1 -1
- package/dist/collection/components/cura-alert/cura-alert.js +1 -1
- package/dist/collection/components/cura-avatar/cura-avatar.js +1 -1
- package/dist/collection/components/cura-calendar/cura-calendar.css +2 -0
- package/dist/collection/components/cura-calendar/cura-calendar.js +79 -47
- package/dist/collection/components/cura-calendar/cura-calendar.js.map +1 -1
- package/dist/collection/components/cura-card/cura-card.js +1 -1
- package/dist/collection/components/cura-icon/cura-icon.js +1 -1
- package/dist/collection/components/cura-icons-view/cura-icons-view.js +3 -3
- package/dist/collection/components/cura-page-template/cura-page-template.js +1 -1
- package/dist/collection/components/cura-toast/cura-toast.js +1 -1
- 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.js +2 -2
- 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 +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +28 -2
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
- package/dist/collection/components/forms/cura-input-date/cura-input-date.css +79 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.js +424 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.js.map +1 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js +138 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-input-text/cura-input-text.css +5 -2
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js +41 -2
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js +73 -21
- package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js +3 -0
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.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.css +5 -2
- 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.js +1 -1
- 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-alert.js +1 -1
- package/dist/components/cura-avatar.js +1 -1
- package/dist/components/cura-badge-number.d.ts +11 -0
- package/dist/components/cura-badge-number.js +8 -0
- package/dist/components/cura-badge-number.js.map +1 -0
- package/dist/components/cura-badge-number2.js +49 -0
- package/dist/components/cura-badge-number2.js.map +1 -0
- package/dist/components/cura-button-outline.js +1 -1
- package/dist/components/cura-button-select.js +81 -65
- package/dist/components/cura-button-select.js.map +1 -1
- package/dist/components/cura-button-transparent2.js +1 -1
- package/dist/components/cura-button.js +1 -1
- package/dist/components/cura-calendar.js +1 -4073
- package/dist/components/cura-calendar.js.map +1 -1
- package/dist/components/cura-calendar2.js +4082 -0
- package/dist/components/cura-calendar2.js.map +1 -0
- package/dist/components/cura-card.js +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 +2 -2
- package/dist/components/cura-dropdown-search.js +29 -3
- package/dist/components/cura-dropdown-search.js.map +1 -1
- package/dist/components/cura-heading2.js +1 -1
- package/dist/components/cura-icon2.js +1 -1
- package/dist/components/cura-icons-view.js +3 -3
- package/dist/components/cura-input-date.d.ts +11 -0
- package/dist/components/cura-input-date.js +270 -0
- package/dist/components/cura-input-date.js.map +1 -0
- package/dist/components/cura-input-text2.js +10 -2
- package/dist/components/cura-input-text2.js.map +1 -1
- package/dist/components/cura-label2.js +1 -1
- package/dist/components/cura-loader-bar2.js +1 -1
- package/dist/components/cura-loader-circle2.js +1 -1
- package/dist/components/cura-page-template.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 +4 -4
- package/dist/components/cura-select2.js.map +1 -1
- package/dist/components/cura-switch.js +1 -1
- package/dist/components/cura-toast.js +1 -1
- 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-0b7a7306.js.map +1 -1
- package/dist/cura/{p-0d435e42.entry.js → p-116a1cd6.entry.js} +2 -2
- package/dist/cura/p-272c784a.js +2 -0
- package/dist/cura/p-272c784a.js.map +1 -0
- package/dist/cura/{p-4c7a2419.entry.js → p-2d267d23.entry.js} +2 -2
- package/dist/cura/{p-9b658260.entry.js → p-33772510.entry.js} +2 -2
- package/dist/cura/{p-afd2c148.entry.js → p-41c3d47d.entry.js} +2 -2
- package/dist/cura/{p-fbf20e5a.entry.js → p-44e3325a.entry.js} +2 -2
- package/dist/cura/p-4e14c01c.entry.js +2 -0
- package/dist/cura/p-563ba0cd.entry.js +2 -0
- package/dist/cura/p-563ba0cd.entry.js.map +1 -0
- package/dist/cura/{p-57b8b468.entry.js → p-8f3db0fe.entry.js} +2 -2
- package/dist/cura/{p-a00d2c68.entry.js → p-907b3d12.entry.js} +2 -2
- package/dist/cura/p-a2ae6bd2.entry.js +2 -0
- package/dist/cura/p-a2ae6bd2.entry.js.map +1 -0
- package/dist/cura/{p-6682619b.entry.js → p-b2d5db22.entry.js} +2 -2
- package/dist/cura/p-b43b69f3.entry.js +2 -0
- package/dist/cura/p-b43b69f3.entry.js.map +1 -0
- package/dist/cura/{p-5ac9d510.entry.js → p-be10b681.entry.js} +2 -2
- package/dist/cura/p-be10b681.entry.js.map +1 -0
- package/dist/cura/{p-a5cf0fd6.entry.js → p-c6508bd7.entry.js} +2 -2
- package/dist/cura/{p-2203e829.entry.js → p-dcd2e5bb.entry.js} +2 -2
- package/dist/cura/{p-84d8c67d.entry.js → p-e5023e34.entry.js} +2 -2
- package/dist/cura/p-e8bc6381.entry.js +2 -0
- package/dist/cura/p-e8bc6381.entry.js.map +1 -0
- package/dist/cura/p-ed97cf3c.entry.js +2 -0
- package/dist/cura/p-ed97cf3c.entry.js.map +1 -0
- package/dist/cura/{p-ad8a7e0f.entry.js → p-fcbf4311.entry.js} +2 -2
- package/dist/cura/{p-66c5cf5f.entry.js → p-fd083399.entry.js} +2 -2
- package/dist/cura/p-fd5ed6b0.js +3 -0
- package/dist/cura/p-fd5ed6b0.js.map +1 -0
- package/dist/cura/{p-f9433d24.entry.js → p-fdce91a7.entry.js} +2 -2
- package/dist/esm/app-globals-6ca7103d.js.map +1 -1
- package/dist/esm/cura-accordion_12.entry.js +21 -15
- package/dist/esm/cura-accordion_12.entry.js.map +1 -1
- package/dist/esm/cura-alert.entry.js +2 -2
- package/dist/esm/cura-avatar.entry.js +2 -2
- package/dist/esm/cura-badge-distance.entry.js +1 -1
- package/dist/esm/cura-badge-number.entry.js +25 -0
- package/dist/esm/cura-badge-number.entry.js.map +1 -0
- package/dist/esm/cura-button-outline.entry.js +2 -2
- package/dist/esm/cura-button-select.entry.js +69 -58
- package/dist/esm/cura-button-select.entry.js.map +1 -1
- package/dist/esm/cura-button-transparent.entry.js +2 -2
- package/dist/esm/cura-calendar.entry.js +51 -165
- package/dist/esm/cura-calendar.entry.js.map +1 -1
- package/dist/esm/cura-card.entry.js +2 -2
- 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 +3 -3
- package/dist/esm/cura-dropdown-search.entry.js +30 -4
- package/dist/esm/cura-dropdown-search.entry.js.map +1 -1
- package/dist/esm/cura-icons-view.entry.js +4 -4
- package/dist/esm/cura-input-date.entry.js +184 -0
- package/dist/esm/cura-input-date.entry.js.map +1 -0
- package/dist/esm/cura-loader-bar.entry.js +2 -2
- package/dist/esm/cura-radio.entry.js +2 -2
- package/dist/esm/cura-switch.entry.js +2 -2
- package/dist/esm/cura-toast.entry.js +2 -2
- package/dist/esm/cura.js +3 -3
- package/dist/esm/{index-1ad98520.js → index-747aad85.js} +70 -3
- package/dist/esm/index-747aad85.js.map +1 -0
- package/dist/esm/index-fbee309a.js +120 -0
- package/dist/esm/index-fbee309a.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/badges/cura-badge-number/cura-badge-number.d.ts +8 -0
- package/dist/types/components/badges/cura-badge-number/cura-badge-number.stories.d.ts +39 -0
- package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +12 -34
- package/dist/types/components/buttons/cura-button-select/cura-button-select.stories.d.ts +105 -0
- package/dist/types/components/cura-calendar/cura-calendar.d.ts +50 -42
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +2 -0
- package/dist/types/components/forms/cura-input-date/cura-input-date.d.ts +92 -0
- package/dist/types/components/forms/cura-input-date/cura-input-date.stories.d.ts +125 -0
- package/dist/types/components/forms/cura-input-text/cura-input-text.d.ts +6 -0
- package/dist/types/components/forms/cura-input-text/cura-input-text.stories.d.ts +15 -0
- package/dist/types/components.d.ts +158 -48
- package/package.json +2 -2
- package/dist/cjs/index-98e7ba54.js.map +0 -1
- package/dist/cura/p-312791fb.js +0 -3
- package/dist/cura/p-312791fb.js.map +0 -1
- package/dist/cura/p-42dfa3a7.entry.js +0 -2
- package/dist/cura/p-42dfa3a7.entry.js.map +0 -1
- package/dist/cura/p-5ac9d510.entry.js.map +0 -1
- package/dist/cura/p-a9cda3b1.entry.js +0 -2
- package/dist/cura/p-a9cda3b1.entry.js.map +0 -1
- package/dist/cura/p-df5c3a86.entry.js +0 -2
- package/dist/cura/p-df5c3a86.entry.js.map +0 -1
- package/dist/cura/p-dfc65f66.entry.js +0 -2
- /package/dist/cura/{p-0d435e42.entry.js.map → p-116a1cd6.entry.js.map} +0 -0
- /package/dist/cura/{p-4c7a2419.entry.js.map → p-2d267d23.entry.js.map} +0 -0
- /package/dist/cura/{p-9b658260.entry.js.map → p-33772510.entry.js.map} +0 -0
- /package/dist/cura/{p-afd2c148.entry.js.map → p-41c3d47d.entry.js.map} +0 -0
- /package/dist/cura/{p-fbf20e5a.entry.js.map → p-44e3325a.entry.js.map} +0 -0
- /package/dist/cura/{p-dfc65f66.entry.js.map → p-4e14c01c.entry.js.map} +0 -0
- /package/dist/cura/{p-57b8b468.entry.js.map → p-8f3db0fe.entry.js.map} +0 -0
- /package/dist/cura/{p-a00d2c68.entry.js.map → p-907b3d12.entry.js.map} +0 -0
- /package/dist/cura/{p-6682619b.entry.js.map → p-b2d5db22.entry.js.map} +0 -0
- /package/dist/cura/{p-a5cf0fd6.entry.js.map → p-c6508bd7.entry.js.map} +0 -0
- /package/dist/cura/{p-2203e829.entry.js.map → p-dcd2e5bb.entry.js.map} +0 -0
- /package/dist/cura/{p-84d8c67d.entry.js.map → p-e5023e34.entry.js.map} +0 -0
- /package/dist/cura/{p-ad8a7e0f.entry.js.map → p-fcbf4311.entry.js.map} +0 -0
- /package/dist/cura/{p-66c5cf5f.entry.js.map → p-fd083399.entry.js.map} +0 -0
- /package/dist/cura/{p-f9433d24.entry.js.map → p-fdce91a7.entry.js.map} +0 -0
|
@@ -1,45 +1,79 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
export class
|
|
2
|
+
export class CuraButtonSelect {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.theme = window.CuraAPI.theme;
|
|
5
|
-
this.size = 'medium';
|
|
6
|
-
this.disabled = false;
|
|
7
5
|
this.selected = false;
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
6
|
+
this.iconName = undefined;
|
|
7
|
+
this.size = undefined;
|
|
8
|
+
this.counter = undefined;
|
|
9
|
+
this.disabled = undefined;
|
|
10
|
+
this.background = undefined;
|
|
11
|
+
this.color = undefined;
|
|
12
12
|
this.hovered = false;
|
|
13
13
|
this.styles = {};
|
|
14
14
|
}
|
|
15
15
|
setColors() {
|
|
16
16
|
const colors = [
|
|
17
|
-
{ name: '--color-
|
|
18
|
-
{ name: '--color-
|
|
19
|
-
{ name: '--color-
|
|
20
|
-
{ name: '--
|
|
21
|
-
{ name: '--
|
|
22
|
-
{ name: '--
|
|
17
|
+
{ name: '--color-border', thema: this.background === 'light' ? `${this.color}-darker` : 'neutral-white' },
|
|
18
|
+
{ name: '--color-border-hover-pressed', thema: this.background === 'light' ? `${this.color}-dark` : `${this.color}-light` },
|
|
19
|
+
{ name: '--color-background-hover', thema: this.background === 'light' ? `${this.color}-light` : `${this.color}-dark` },
|
|
20
|
+
{ name: '--color-select', thema: this.background === 'light' ? `${this.color}-base` : 'neutral-white' },
|
|
21
|
+
{ name: '--color-select-hover-pressed', thema: this.background === 'light' ? `${this.color}-dark` : `${this.color}-lighter` },
|
|
22
|
+
{ name: '--color-select-focus', thema: this.background === 'light' ? `${this.color}-base` : `${this.color}-lighter` },
|
|
23
|
+
{ name: '--color-disable-select', thema: this.background === 'light' ? 'neutral-white' : 'neutral-black' },
|
|
24
|
+
{ name: '--color-border-disable-unselect', thema: 'neutral-dark' },
|
|
25
|
+
{ name: '--color-counter-disabled', thema: this.background === 'light' ? 'neutral-pale' : 'neutral-black' },
|
|
26
|
+
{ name: '--color-counter', thema: !this.disabled && 'primary-lighter' }
|
|
23
27
|
];
|
|
24
|
-
colors.forEach(color =>
|
|
25
|
-
|
|
26
|
-
});
|
|
28
|
+
colors.forEach(color => (this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.thema)));
|
|
29
|
+
this.styles = Object.assign({}, this.styles);
|
|
27
30
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.styles['--neutral-black'] = this.theme.colors.getColor("neutral-black");
|
|
36
|
-
this.styles['--primary-base'] = this.theme.colors.getColor("primary-base");
|
|
37
|
-
this.styles['--info-base'] = this.theme.colors.getColor("info-base");
|
|
31
|
+
getClasses() {
|
|
32
|
+
const classes = {};
|
|
33
|
+
classes[`${this.size.toLowerCase()}`] = true;
|
|
34
|
+
classes['icon'] = true;
|
|
35
|
+
classes['disabled'] = this.disabled;
|
|
36
|
+
classes['selected'] = this.selected;
|
|
37
|
+
return classes;
|
|
38
38
|
}
|
|
39
39
|
connectedCallback() {
|
|
40
|
-
this.setStyles();
|
|
41
40
|
this.setColors();
|
|
42
41
|
}
|
|
42
|
+
getLabelFontColor() {
|
|
43
|
+
if (this.disabled)
|
|
44
|
+
return 'neutral-dark';
|
|
45
|
+
if (this.background === 'dark') {
|
|
46
|
+
return this.selected ? 'neutral-black' : 'neutral-white';
|
|
47
|
+
}
|
|
48
|
+
if (this.background === 'light') {
|
|
49
|
+
return this.selected ? 'neutral-white' : 'neutral-black';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
getColorCounter() {
|
|
53
|
+
if (this.background === 'dark' && this.disabled) {
|
|
54
|
+
return !this.selected ? 'neutral-black' : 'neutral-dark';
|
|
55
|
+
}
|
|
56
|
+
if (this.background === 'light' && this.disabled) {
|
|
57
|
+
return 'neutral-pale';
|
|
58
|
+
}
|
|
59
|
+
return `${this.color}-lighter`;
|
|
60
|
+
}
|
|
61
|
+
getColorBagdeNumber() {
|
|
62
|
+
if (this.background === 'dark' && this.disabled) {
|
|
63
|
+
return this.selected ? 'neutral-black' : 'neutral-dark';
|
|
64
|
+
}
|
|
65
|
+
if (this.background === 'light' && this.disabled) {
|
|
66
|
+
return 'neutral-medium';
|
|
67
|
+
}
|
|
68
|
+
return `${this.color}-darker`;
|
|
69
|
+
}
|
|
70
|
+
getIcon() {
|
|
71
|
+
const iconSize = this.size === 'large' ? 24 : this.size === 'medium' ? 20 : 16;
|
|
72
|
+
return h("cura-icon", { class: "button-icon", name: this.iconName, size: iconSize, color: this.getLabelFontColor() });
|
|
73
|
+
}
|
|
74
|
+
getCounter() {
|
|
75
|
+
return (h("cura-badge-number", { color: this.getColorCounter() }, h("cura-label", { color: this.getColorBagdeNumber() }, this.counter)));
|
|
76
|
+
}
|
|
43
77
|
handleMouseEnter() {
|
|
44
78
|
if (this.disabled)
|
|
45
79
|
return;
|
|
@@ -48,37 +82,14 @@ export class CuraButtonOutline {
|
|
|
48
82
|
handleMouseLeave() {
|
|
49
83
|
this.hovered = false;
|
|
50
84
|
}
|
|
51
|
-
assignColor() {
|
|
52
|
-
if (!this.selected)
|
|
53
|
-
return 'primary-base';
|
|
54
|
-
const fontcolor = this.disabled
|
|
55
|
-
? (this.background === 'light' ? 'neutral-medium' : 'primary-base')
|
|
56
|
-
: this.selected && this.fontcolor === "dark" ? 'neutral-black' : "neutral-purewhite";
|
|
57
|
-
return fontcolor;
|
|
58
|
-
}
|
|
59
|
-
getIcon() {
|
|
60
|
-
if (!this.selected)
|
|
61
|
-
return;
|
|
62
|
-
const iconSize = this.size === 'small' ? 16 : this.size === 'medium' ? 20 : 24;
|
|
63
|
-
const iconName = this.hovered ? 'closeCircle' : 'checkCircle';
|
|
64
|
-
return h("cura-icon", { class: "button-icon", name: iconName, size: iconSize, color: this.assignColor() });
|
|
65
|
-
}
|
|
66
85
|
handleClick(e) {
|
|
67
86
|
if (this.disabled)
|
|
68
87
|
e.preventDefault();
|
|
69
88
|
this.selected = !this.selected;
|
|
70
89
|
this.onclick.emit({ selected: this.selected });
|
|
71
90
|
}
|
|
72
|
-
getClasses() {
|
|
73
|
-
const classes = {};
|
|
74
|
-
classes[`${this.size.toLowerCase()}`] = true;
|
|
75
|
-
classes[`icon-${this.iconPosition.toLowerCase()}`] = true;
|
|
76
|
-
classes['disabled'] = this.disabled;
|
|
77
|
-
classes['selected'] = this.selected;
|
|
78
|
-
return classes;
|
|
79
|
-
}
|
|
80
91
|
render() {
|
|
81
|
-
return (h(Host, { key: '
|
|
92
|
+
return (h(Host, { key: '5b612b060b0a7b40ede004322995f0e410da8759' }, h("button", { key: '616ae769e76d647a3806daf33376ca88eb75da5d', class: this.getClasses(), style: this.styles, disabled: this.disabled, onClick: e => this.handleClick(e), onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("div", { key: 'ef0a6f7ed31c7c2b4eb0f74e3713c0cc99b79080', class: "button-container" }, this.iconName ? this.getIcon() : null, h("cura-label", { key: '0366f6538cc0ccf76c072de862fe60d87fccb937', class: "label", lineHeight: "0%", color: this.getLabelFontColor(), weight: 'regular' }, h("slot", { key: '72a72cc3a128223e7f41212005caff8aefbf1454' })), this.counter ? this.getCounter() : null))));
|
|
82
93
|
}
|
|
83
94
|
static get is() { return "cura-button-select"; }
|
|
84
95
|
static get encapsulation() { return "shadow"; }
|
|
@@ -94,95 +105,91 @@ export class CuraButtonOutline {
|
|
|
94
105
|
}
|
|
95
106
|
static get properties() {
|
|
96
107
|
return {
|
|
97
|
-
"
|
|
98
|
-
"type": "
|
|
99
|
-
"mutable":
|
|
108
|
+
"selected": {
|
|
109
|
+
"type": "boolean",
|
|
110
|
+
"mutable": true,
|
|
100
111
|
"complexType": {
|
|
101
|
-
"original": "
|
|
102
|
-
"resolved": "
|
|
112
|
+
"original": "boolean",
|
|
113
|
+
"resolved": "boolean",
|
|
103
114
|
"references": {}
|
|
104
115
|
},
|
|
105
116
|
"required": false,
|
|
106
117
|
"optional": false,
|
|
107
118
|
"docs": {
|
|
108
119
|
"tags": [],
|
|
109
|
-
"text": "
|
|
120
|
+
"text": ""
|
|
110
121
|
},
|
|
111
|
-
"attribute": "
|
|
122
|
+
"attribute": "selected",
|
|
112
123
|
"reflect": true,
|
|
113
|
-
"defaultValue": "
|
|
124
|
+
"defaultValue": "false"
|
|
114
125
|
},
|
|
115
|
-
"
|
|
116
|
-
"type": "
|
|
117
|
-
"mutable":
|
|
126
|
+
"iconName": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"mutable": true,
|
|
118
129
|
"complexType": {
|
|
119
|
-
"original": "
|
|
120
|
-
"resolved": "
|
|
130
|
+
"original": "string",
|
|
131
|
+
"resolved": "string",
|
|
121
132
|
"references": {}
|
|
122
133
|
},
|
|
123
134
|
"required": false,
|
|
124
135
|
"optional": false,
|
|
125
136
|
"docs": {
|
|
126
137
|
"tags": [],
|
|
127
|
-
"text": "
|
|
138
|
+
"text": ""
|
|
128
139
|
},
|
|
129
|
-
"attribute": "
|
|
130
|
-
"reflect": true
|
|
131
|
-
"defaultValue": "false"
|
|
140
|
+
"attribute": "icon-name",
|
|
141
|
+
"reflect": true
|
|
132
142
|
},
|
|
133
|
-
"
|
|
134
|
-
"type": "
|
|
143
|
+
"size": {
|
|
144
|
+
"type": "string",
|
|
135
145
|
"mutable": false,
|
|
136
146
|
"complexType": {
|
|
137
|
-
"original": "
|
|
138
|
-
"resolved": "
|
|
147
|
+
"original": "'small' | 'medium' | 'large'",
|
|
148
|
+
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
139
149
|
"references": {}
|
|
140
150
|
},
|
|
141
151
|
"required": false,
|
|
142
152
|
"optional": false,
|
|
143
153
|
"docs": {
|
|
144
154
|
"tags": [],
|
|
145
|
-
"text": "
|
|
155
|
+
"text": ""
|
|
146
156
|
},
|
|
147
|
-
"attribute": "
|
|
148
|
-
"reflect": true
|
|
149
|
-
"defaultValue": "false"
|
|
157
|
+
"attribute": "size",
|
|
158
|
+
"reflect": true
|
|
150
159
|
},
|
|
151
|
-
"
|
|
152
|
-
"type": "
|
|
153
|
-
"mutable":
|
|
160
|
+
"counter": {
|
|
161
|
+
"type": "any",
|
|
162
|
+
"mutable": true,
|
|
154
163
|
"complexType": {
|
|
155
|
-
"original": "
|
|
156
|
-
"resolved": "
|
|
164
|
+
"original": "string | number | null",
|
|
165
|
+
"resolved": "number | string",
|
|
157
166
|
"references": {}
|
|
158
167
|
},
|
|
159
168
|
"required": false,
|
|
160
169
|
"optional": false,
|
|
161
170
|
"docs": {
|
|
162
171
|
"tags": [],
|
|
163
|
-
"text": "
|
|
172
|
+
"text": ""
|
|
164
173
|
},
|
|
165
|
-
"attribute": "
|
|
166
|
-
"reflect": true
|
|
167
|
-
"defaultValue": "'right'"
|
|
174
|
+
"attribute": "counter",
|
|
175
|
+
"reflect": true
|
|
168
176
|
},
|
|
169
|
-
"
|
|
170
|
-
"type": "
|
|
177
|
+
"disabled": {
|
|
178
|
+
"type": "boolean",
|
|
171
179
|
"mutable": false,
|
|
172
180
|
"complexType": {
|
|
173
|
-
"original": "
|
|
174
|
-
"resolved": "
|
|
181
|
+
"original": "boolean",
|
|
182
|
+
"resolved": "boolean",
|
|
175
183
|
"references": {}
|
|
176
184
|
},
|
|
177
185
|
"required": false,
|
|
178
186
|
"optional": false,
|
|
179
187
|
"docs": {
|
|
180
188
|
"tags": [],
|
|
181
|
-
"text": "
|
|
189
|
+
"text": ""
|
|
182
190
|
},
|
|
183
|
-
"attribute": "
|
|
184
|
-
"reflect":
|
|
185
|
-
"defaultValue": "'accent'"
|
|
191
|
+
"attribute": "disabled",
|
|
192
|
+
"reflect": true
|
|
186
193
|
},
|
|
187
194
|
"background": {
|
|
188
195
|
"type": "string",
|
|
@@ -196,29 +203,27 @@ export class CuraButtonOutline {
|
|
|
196
203
|
"optional": false,
|
|
197
204
|
"docs": {
|
|
198
205
|
"tags": [],
|
|
199
|
-
"text": "
|
|
206
|
+
"text": ""
|
|
200
207
|
},
|
|
201
208
|
"attribute": "background",
|
|
202
|
-
"reflect": false
|
|
203
|
-
"defaultValue": "'light'"
|
|
209
|
+
"reflect": false
|
|
204
210
|
},
|
|
205
|
-
"
|
|
211
|
+
"color": {
|
|
206
212
|
"type": "string",
|
|
207
213
|
"mutable": false,
|
|
208
214
|
"complexType": {
|
|
209
|
-
"original": "
|
|
210
|
-
"resolved": "
|
|
215
|
+
"original": "string",
|
|
216
|
+
"resolved": "string",
|
|
211
217
|
"references": {}
|
|
212
218
|
},
|
|
213
219
|
"required": false,
|
|
214
220
|
"optional": false,
|
|
215
221
|
"docs": {
|
|
216
222
|
"tags": [],
|
|
217
|
-
"text": "
|
|
223
|
+
"text": ""
|
|
218
224
|
},
|
|
219
|
-
"attribute": "
|
|
220
|
-
"reflect": false
|
|
221
|
-
"defaultValue": "'dark'"
|
|
225
|
+
"attribute": "color",
|
|
226
|
+
"reflect": false
|
|
222
227
|
}
|
|
223
228
|
};
|
|
224
229
|
}
|
|
@@ -240,12 +245,13 @@ export class CuraButtonOutline {
|
|
|
240
245
|
"text": ""
|
|
241
246
|
},
|
|
242
247
|
"complexType": {
|
|
243
|
-
"original": "{ selected: boolean
|
|
248
|
+
"original": "{ selected: boolean }",
|
|
244
249
|
"resolved": "{ selected: boolean; }",
|
|
245
250
|
"references": {}
|
|
246
251
|
}
|
|
247
252
|
}];
|
|
248
253
|
}
|
|
254
|
+
static get elementRef() { return "host"; }
|
|
249
255
|
static get watchers() {
|
|
250
256
|
return [{
|
|
251
257
|
"propName": "background",
|
|
@@ -253,15 +259,6 @@ export class CuraButtonOutline {
|
|
|
253
259
|
}, {
|
|
254
260
|
"propName": "color",
|
|
255
261
|
"methodName": "setColors"
|
|
256
|
-
}, {
|
|
257
|
-
"propName": "fontcolor",
|
|
258
|
-
"methodName": "setColors"
|
|
259
|
-
}, {
|
|
260
|
-
"propName": "background",
|
|
261
|
-
"methodName": "assignColor"
|
|
262
|
-
}, {
|
|
263
|
-
"propName": "fontcolor",
|
|
264
|
-
"methodName": "assignColor"
|
|
265
262
|
}];
|
|
266
263
|
}
|
|
267
264
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cura-button-select.js","sourceRoot":"","sources":["../../../../src/components/buttons/cura-button-select/cura-button-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"cura-button-select.js","sourceRoot":"","sources":["../../../../src/components/buttons/cura-button-select/cura-button-select.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,gBAAgB;;QAgB3B,UAAK,GAAG,MAAM,CAAC,OAAO,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C,OAAO,EAAC,UAAU,EAAC,IAAI,EAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAC,SAAS;wBACzF,8DAAa,CACF;oBACZ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CACpC,CACC,CACJ,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-button-select',\n styleUrl: 'cura-button-select.scss',\n shadow: true,\n})\nexport class CuraButtonSelect {\n @Element() host: HTMLElement;\n\n @Prop({ reflect: true, mutable: true }) selected = false;\n @Prop({ reflect: true, mutable: true }) iconName: string;\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large';\n @Prop({ reflect: true, mutable: true }) counter: string | number | null;\n @Prop({ reflect: true }) disabled: boolean;\n @Prop() background: 'dark' | 'light';\n @Prop() color: string;\n\n @State() hovered = false;\n @State() styles = {};\n\n @Event({ eventName: 'onclick' }) onclick: EventEmitter<{ selected: boolean }>;\n\n theme = window.CuraAPI.theme;\n\n weights;\n\n @Watch('background')\n @Watch('color')\n setColors() {\n const colors = [\n { name: '--color-border', thema: this.background === 'light' ? `${this.color}-darker` : 'neutral-white' },\n { name: '--color-border-hover-pressed', thema: this.background === 'light' ? `${this.color}-dark` : `${this.color}-light` },\n { name: '--color-background-hover', thema: this.background === 'light' ? `${this.color}-light` : `${this.color}-dark` },\n { name: '--color-select', thema: this.background === 'light' ? `${this.color}-base` : 'neutral-white' },\n { name: '--color-select-hover-pressed', thema: this.background === 'light' ? `${this.color}-dark` : `${this.color}-lighter` },\n { name: '--color-select-focus', thema: this.background === 'light' ? `${this.color}-base` : `${this.color}-lighter` },\n { name: '--color-disable-select', thema: this.background === 'light' ? 'neutral-white' : 'neutral-black' },\n { name: '--color-border-disable-unselect', thema: 'neutral-dark' },\n { name: '--color-counter-disabled', thema: this.background === 'light' ? 'neutral-pale' : 'neutral-black' },\n { name: '--color-counter', thema: !this.disabled && 'primary-lighter' }\n ];\n\n colors.forEach(color => (this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.thema)));\n this.styles = { ...this.styles };\n\n }\n\n getClasses() {\n const classes = {};\n classes[`${this.size.toLowerCase()}`] = true;\n classes['icon'] = true;\n classes['disabled'] = this.disabled;\n classes['selected'] = this.selected;\n return classes;\n }\n\n connectedCallback() {\n this.setColors();\n }\n\n getLabelFontColor() {\n if (this.disabled) return 'neutral-dark';\n\n if (this.background === 'dark') {\n return this.selected ? 'neutral-black' : 'neutral-white'\n }\n if (this.background === 'light') {\n return this.selected ? 'neutral-white' : 'neutral-black'\n }\n\n }\n\n getColorCounter() {\n if (this.background === 'dark' && this.disabled) {\n return !this.selected ? 'neutral-black' : 'neutral-dark'\n }\n\n if (this.background === 'light' && this.disabled) {\n return 'neutral-pale'\n }\n return `${this.color}-lighter`\n }\n\n getColorBagdeNumber() {\n\n if (this.background === 'dark' && this.disabled) {\n return this.selected ? 'neutral-black' : 'neutral-dark'\n }\n\n if (this.background === 'light' && this.disabled) {\n return 'neutral-medium'\n }\n\n return `${this.color}-darker`\n }\n\n getIcon() {\n const iconSize = this.size === 'large' ? 24 : this.size === 'medium' ? 20 : 16;\n\n return <cura-icon class=\"button-icon\" name={this.iconName} size={iconSize} color={this.getLabelFontColor()} />;\n }\n\n getCounter() {\n return (\n <cura-badge-number color={this.getColorCounter()}>\n <cura-label color={this.getColorBagdeNumber()}>{this.counter}</cura-label>\n </cura-badge-number>\n );\n }\n\n\n handleMouseEnter() {\n if (this.disabled) return;\n this.hovered = true;\n }\n\n handleMouseLeave() {\n this.hovered = false;\n }\n\n handleClick(e: Event) {\n if (this.disabled) e.preventDefault();\n this.selected = !this.selected;\n this.onclick.emit({ selected: this.selected });\n }\n\n render() {\n return (\n <Host>\n <button\n class={this.getClasses()}\n style={this.styles}\n disabled={this.disabled}\n onClick={e => this.handleClick(e)}\n onMouseEnter={() => this.handleMouseEnter()}\n onMouseLeave={() => this.handleMouseLeave()}\n >\n <div class=\"button-container\">\n {this.iconName ? this.getIcon() : null}\n <cura-label class=\"label\" lineHeight=\"0%\" color={this.getLabelFontColor()} weight='regular'>\n <slot></slot>\n </cura-label>\n {this.counter ? this.getCounter() : null}\n </div>\n </button>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,133 @@
|
|
|
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 renderCuraButtonSelect = (label, args) => {
|
|
15
|
+
const block = `<cura-button-select ${args.selected
|
|
16
|
+
? `
|
|
17
|
+
selected="${args.selected}"`
|
|
18
|
+
: ''}${args.disabled
|
|
19
|
+
? `
|
|
20
|
+
disabled="${args.disabled}"`
|
|
21
|
+
: ''}
|
|
22
|
+
${args.iconName
|
|
23
|
+
? `
|
|
24
|
+
icon-name="${args.iconName}"`
|
|
25
|
+
: ''}${args.size
|
|
26
|
+
? `
|
|
27
|
+
size="${args.size}"`
|
|
28
|
+
: ''}
|
|
29
|
+
${args.counter
|
|
30
|
+
? `
|
|
31
|
+
counter="${args.counter}"`
|
|
32
|
+
: ''}
|
|
33
|
+
${args.background
|
|
34
|
+
? `
|
|
35
|
+
background="${args.background}"`
|
|
36
|
+
: ''}
|
|
37
|
+
${args.color
|
|
38
|
+
? `
|
|
39
|
+
color="${args.color}"`
|
|
40
|
+
: ''}
|
|
41
|
+
>
|
|
42
|
+
${label}
|
|
43
|
+
</cura-button-select>
|
|
44
|
+
`;
|
|
45
|
+
return `${block}`;
|
|
46
|
+
};
|
|
47
|
+
export default {
|
|
48
|
+
title: 'Componentes/Buttons/Button Select',
|
|
49
|
+
tags: ['autodocs'],
|
|
50
|
+
render: (_a) => {
|
|
51
|
+
var { label } = _a, args = __rest(_a, ["label"]);
|
|
52
|
+
return renderCuraButtonSelect(label, args);
|
|
53
|
+
},
|
|
54
|
+
argTypes: {
|
|
55
|
+
label: {
|
|
56
|
+
control: 'text',
|
|
57
|
+
description: 'Texto puro com ou sem quebra de linha dentro do componente. Não é propriedade HTML.',
|
|
58
|
+
name: 'Label',
|
|
59
|
+
},
|
|
60
|
+
disabled: {
|
|
61
|
+
control: 'boolean',
|
|
62
|
+
description: 'Estado desabilitado.',
|
|
63
|
+
table: {
|
|
64
|
+
category: 'State',
|
|
65
|
+
defaultValue: { summary: false },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
selected: {
|
|
69
|
+
control: 'boolean',
|
|
70
|
+
description: 'Estado selecionado.',
|
|
71
|
+
table: {
|
|
72
|
+
category: 'State',
|
|
73
|
+
defaultValue: { summary: false },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
size: {
|
|
77
|
+
control: { type: 'inline-radio' },
|
|
78
|
+
options: ['small', 'medium', 'large'],
|
|
79
|
+
description: 'Tamanhos disponíveis.',
|
|
80
|
+
table: {
|
|
81
|
+
category: 'Properties',
|
|
82
|
+
defaultValue: { summary: 'large' }
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
color: {
|
|
86
|
+
control: { type: 'select' },
|
|
87
|
+
options: ['primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],
|
|
88
|
+
description: 'Cor fundamental do Design System sem profundidade (ex: primary).',
|
|
89
|
+
table: {
|
|
90
|
+
category: 'Properties',
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
iconName: {
|
|
94
|
+
control: { type: 'select' },
|
|
95
|
+
options: ['', ...iconNames],
|
|
96
|
+
description: 'Nome do ícone a ser utilizado no iconset.',
|
|
97
|
+
table: {
|
|
98
|
+
category: 'Icons'
|
|
99
|
+
},
|
|
100
|
+
name: 'icon-name'
|
|
101
|
+
},
|
|
102
|
+
background: {
|
|
103
|
+
control: { type: 'inline-radio' },
|
|
104
|
+
options: ['dark', 'light'],
|
|
105
|
+
description: 'Define cor clara ou escura do componente.',
|
|
106
|
+
table: {
|
|
107
|
+
category: 'Properties',
|
|
108
|
+
defaultValue: { summary: 'light' }
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
counter: {
|
|
112
|
+
control: 'number',
|
|
113
|
+
description: 'Define o número a ser exibido pelo componente',
|
|
114
|
+
table: {
|
|
115
|
+
category: 'Properties',
|
|
116
|
+
defaultValue: { summary: 1 },
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
export const Button = {
|
|
122
|
+
args: {
|
|
123
|
+
selected: false,
|
|
124
|
+
iconName: 'calendar',
|
|
125
|
+
size: 'medium',
|
|
126
|
+
counter: 1,
|
|
127
|
+
disabled: false,
|
|
128
|
+
background: 'light',
|
|
129
|
+
color: 'primary',
|
|
130
|
+
label: "Button"
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=cura-button-select.stories.js.map
|
package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-button-select.stories.js","sourceRoot":"","sources":["../../../../src/components/buttons/cura-button-select/cura-button-select.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,4CAA4C,CAAC;AAEnE,MAAM,sBAAsB,GAAG,CAAC,KAAa,EAAE,IAAS,EAAE,EAAE;IACxD,MAAM,KAAK,GAAG,uBAAuB,IAAI,CAAC,QAAQ;QAC9C,CAAC,CAAC;oBACU,IAAI,CAAC,QAAQ,GAAG;QAC5B,CAAC,CAAC,EACF,GAAG,IAAI,CAAC,QAAQ;QACZ,CAAC,CAAC;oBACM,IAAI,CAAC,QAAQ,GAAG;QACxB,CAAC,CAAC,EACN;IACJ,IAAI,CAAC,QAAQ;QACL,CAAC,CAAC;qBACO,IAAI,CAAC,QAAQ,GAAG;QACzB,CAAC,CAAC,EACN,GAAG,IAAI,CAAC,IAAI;QACR,CAAC,CAAC;gBACE,IAAI,CAAC,IAAI,GAAG;QAChB,CAAC,CAAC,EACN;IACJ,IAAI,CAAC,OAAO;QACJ,CAAC,CAAC;mBACK,IAAI,CAAC,OAAO,GAAG;QACtB,CAAC,CAAC,EACN;IACJ,IAAI,CAAC,UAAU;QACP,CAAC,CAAC;sBACQ,IAAI,CAAC,UAAU,GAAG;QAC5B,CAAC,CAAC,EACN;IACJ,IAAI,CAAC,KAAK;QACF,CAAC,CAAC;iBACG,IAAI,CAAC,KAAK,GAAG;QAClB,CAAC,CAAC,EACN;;IAEJ,KAAK;;OAEF,CAAC;IACJ,OAAO,GAAG,KAAK,EAAE,CAAC;AACtB,CAAC,CAAC;AAEF,eAAe;IACX,KAAK,EAAE,mCAAmC;IAC1C,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,MAAM,EAAE,CAAC,EAAkB,EAAE,EAAE;YAAtB,EAAE,KAAK,OAAW,EAAN,IAAI,cAAhB,SAAkB,CAAF;QACrB,OAAO,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;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R,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;YACjC,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YAC1B,WAAW,EAAE,2CAA2C;YACxD,KAAK,EAAE;gBACH,QAAQ,EAAE,YAAY;gBACtB,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;aACrC;SACJ;QACD,OAAO,EAAE;YACL,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,+CAA+C;YAC5D,KAAK,EAAE;gBACH,QAAQ,EAAE,YAAY;gBACtB,YAAY,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;aAC/B;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,IAAI,EAAE;QACF,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,OAAO;QACnB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,QAAQ;KAClB;CACJ,CAAC","sourcesContent":["import iconNames from '../../../assets/icons/iconset-default-list';\n\nconst renderCuraButtonSelect = (label: string, args: any) => {\n const block = `<cura-button-select ${args.selected\n ? `\n selected=\"${args.selected}\"`\n : ''\n }${args.disabled\n ? `\n disabled=\"${args.disabled}\"`\n : ''\n }\n ${args.iconName\n ? `\n icon-name=\"${args.iconName}\"`\n : ''\n }${args.size\n ? `\n size=\"${args.size}\"`\n : ''\n }\n ${args.counter\n ? `\n counter=\"${args.counter}\"`\n : ''\n }\n ${args.background\n ? `\n background=\"${args.background}\"`\n : ''\n }\n ${args.color\n ? `\n color=\"${args.color}\"`\n : ''\n }\n >\n ${label}\n </cura-button-select>\n `;\n return `${block}`;\n};\n\nexport default {\n title: 'Componentes/Buttons/Button Select',\n tags: ['autodocs'],\n render: ({ label, ...args }) => {\n return renderCuraButtonSelect(label, args);\n },\n argTypes: {\n label: {\n control: 'text',\n description: 'Texto puro com ou sem quebra de linha dentro do componente. Não é propriedade HTML.',\n name: 'Label',\n },\n disabled: {\n control: 'boolean',\n description: 'Estado desabilitado.',\n table: {\n category: 'State',\n defaultValue: { summary: false },\n },\n },\n selected: {\n control: 'boolean',\n description: 'Estado selecionado.',\n table: {\n category: 'State',\n defaultValue: { summary: false },\n },\n },\n size: {\n control: { type: 'inline-radio' },\n options: ['small', 'medium', 'large'],\n description: 'Tamanhos disponíveis.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'large' }\n }\n },\n color: {\n control: { type: 'select' },\n options: ['primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],\n description: 'Cor fundamental do Design System sem profundidade (ex: primary).',\n table: {\n category: 'Properties',\n }\n },\n iconName: {\n control: { type: 'select' },\n options: ['', ...iconNames],\n description: 'Nome do ícone a ser utilizado no iconset.',\n table: {\n category: 'Icons'\n },\n name: 'icon-name'\n },\n background: {\n control: { type: 'inline-radio' },\n options: ['dark', 'light'],\n description: 'Define cor clara ou escura do componente.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'light' }\n },\n },\n counter: {\n control: 'number',\n description: 'Define o número a ser exibido pelo componente',\n table: {\n category: 'Properties',\n defaultValue: { summary: 1 },\n },\n },\n },\n};\n\nexport const Button = {\n args: {\n selected: false,\n iconName: 'calendar',\n size: 'medium',\n counter: 1,\n disabled: false,\n background: 'light',\n color: 'primary',\n label: \"Button\"\n },\n};\n"]}
|
package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js
CHANGED
|
@@ -76,7 +76,7 @@ export class CuraButtonTransparent {
|
|
|
76
76
|
render() {
|
|
77
77
|
const symbolColor = this.getSymbolColor();
|
|
78
78
|
const labelSize = labelSizes[this.size] || labelSizes["default"];
|
|
79
|
-
return (h(Host, { key: '
|
|
79
|
+
return (h(Host, { key: 'd7bfd59d8a84d299a3d59dfd2d7b48ca6a9f56ee' }, this.href ? (h("a", { href: this.disabled ? '' : this.href, target: this.target, class: this.getClasses(), style: this.styles, onClick: (e) => this.handleClick(e), onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave() }, h("span", { class: "button-container" }, this.getIcon(), h("cura-label", { size: labelSize, lineHeight: '105%', color: symbolColor }, h("slot", null))), h("cura-loader-circle", { size: this.size, color: symbolColor }))) : (h("button", { class: this.getClasses(), style: this.styles, disabled: this.disabled || null, onClick: (e) => this.handleClick(e), onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave(), type: this.type }, h("span", { class: "button-container" }, this.getIcon(), h("cura-label", { size: labelSize, lineHeight: '105%', color: symbolColor }, h("slot", null))), h("cura-loader-circle", { size: this.size, color: symbolColor })))));
|
|
80
80
|
}
|
|
81
81
|
static get is() { return "cura-button-transparent"; }
|
|
82
82
|
static get encapsulation() { return "shadow"; }
|
|
@@ -43,7 +43,7 @@ export class CuraAlert {
|
|
|
43
43
|
return this.icon ? this.icon : iconMapping[this.type];
|
|
44
44
|
}
|
|
45
45
|
render() {
|
|
46
|
-
return (h(Host, { key: '
|
|
46
|
+
return (h(Host, { key: 'c5398d59da323dee68eed1cb7c27841df0e12d14' }, h("div", { key: 'd9bb0ab7a2106e710a113513e6eeb1297b9bd205', class: this.getClasses(), style: this.styles }, h("cura-icon", { key: '54665c81a59cbca3686abc6f5e388da32e2211ed', name: this.getNameIcon(), class: "icon-left", size: 16, color: `${this.type}-dark` }), h("div", { key: '466f9f4aed5096658de1e19521cefe2915b095af', class: "content" }, h("cura-label", { key: '6b3d9cd0352b5d5254305baa5a71a1b1782f637f', class: "title", size: "small", color: "neutral-darker", weight: "bold" }, this.label), h("cura-paragraph", { key: '5dbad5e65d88b59a81b7df97154071a607d73900', class: "text", color: `${this.type}-darker`, size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, h("slot", { key: 'cb75d38c35d34a7bee4e187c640a1269bad192b0' })), h("div", { key: 'a6930bb463601a2ba429b23fad61847e8dee01f3', class: "actions" }, h("slot", { key: '7f4fc8b08a870f578d0b241df00650ebf3db83e0', name: "actions" }))), this.closeable ?
|
|
47
47
|
(h("cura-icon", { name: "close", size: 16, color: "error-dark", class: "icon-right", onClick: this.handleClose }))
|
|
48
48
|
: '')));
|
|
49
49
|
}
|
|
@@ -39,7 +39,7 @@ export class CuraAvatar {
|
|
|
39
39
|
this.imageSrc = this.imageSrcDefault || `${this.assetsPath}/images/avatar/patient-default.svg`;
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
|
-
return (h(Host, { key: '
|
|
42
|
+
return (h(Host, { key: '2760534555a0483e7e30c5f3009ec0cf68d0973b', style: this.hostCSSProperties(), role: "img" }, h("div", { key: '3daf6dd066983dc63525c38b7da498147c0bf387', class: this.getClasses(), style: this.styles }, h("img", { key: 'a5f4de7983722fc3f750404fa985c312590b5e98', src: this.imageSrc || this.imageSrcDefault || `${this.assetsPath}/images/avatar/patient-default.svg`, onError: () => this.onSrcError() }))));
|
|
43
43
|
}
|
|
44
44
|
static get is() { return "cura-avatar"; }
|
|
45
45
|
static get encapsulation() { return "shadow"; }
|