@rededor/cura 0.5.2 → 0.5.4
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 +145 -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 +115 -0
- package/dist/cjs/cura-radio.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-switch.cjs.entry.js +90 -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 +432 -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 +366 -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 +267 -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 +193 -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 +155 -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 +120 -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-3f5de5e2.entry.js +2 -0
- package/dist/cura/p-3f5de5e2.entry.js.map +1 -0
- package/dist/cura/p-4db87e8d.system.entry.js +2 -0
- package/dist/cura/p-4db87e8d.system.entry.js.map +1 -0
- package/dist/cura/p-51e00a16.entry.js +2 -0
- package/dist/cura/p-51e00a16.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-8d959fb2.entry.js +2 -0
- package/dist/cura/p-8d959fb2.entry.js.map +1 -0
- 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-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-cb4e2a0c.system.entry.js +2 -0
- package/dist/cura/p-cb4e2a0c.system.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-f51705c2.system.entry.js +2 -0
- package/dist/cura/p-f51705c2.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 +141 -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 +111 -0
- package/dist/esm/cura-radio.entry.js.map +1 -0
- package/dist/esm/cura-switch.entry.js +86 -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,163 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
width: fit-content;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Container e Layout */
|
|
9
|
+
.container {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
flex-direction: row-reverse;
|
|
13
|
+
gap: var(--gap);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.position.container {
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
}
|
|
19
|
+
.position .label-wrapper {
|
|
20
|
+
justify-content: end;
|
|
21
|
+
}
|
|
22
|
+
.position .message {
|
|
23
|
+
text-align: right;
|
|
24
|
+
}
|
|
25
|
+
.position .label {
|
|
26
|
+
order: 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.info {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.label-wrapper {
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: start;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: 5px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Control e Checkbox */
|
|
42
|
+
.control {
|
|
43
|
+
width: fit-content;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.checkbox {
|
|
49
|
+
appearance: none;
|
|
50
|
+
border: 2px solid var(--primary-base-neutral-medium);
|
|
51
|
+
border-radius: 4px;
|
|
52
|
+
background: var(--neutral-lighter-neutral-purewhite);
|
|
53
|
+
flex: 1 0;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
position: relative;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
width: var(--size);
|
|
61
|
+
height: var(--size);
|
|
62
|
+
flex: 0 0 var(--size);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.icon {
|
|
66
|
+
position: absolute;
|
|
67
|
+
display: flex;
|
|
68
|
+
opacity: 0;
|
|
69
|
+
transition: opacity 0.3s;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Estados de Foco */
|
|
73
|
+
.checkbox:focus {
|
|
74
|
+
border-color: var(--info-base) !important;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Estado Disabled */
|
|
78
|
+
.disabled .checkbox {
|
|
79
|
+
background: var(--primary-darker-neutral-white);
|
|
80
|
+
border-color: var(--primary-base-neutral-base);
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
}
|
|
83
|
+
.disabled .checkbox:hover {
|
|
84
|
+
border-color: var(--primary-base-neutral-base) !important;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.disabled.checked .checkbox,
|
|
88
|
+
.disabled.indeterminate .checkbox {
|
|
89
|
+
background: var(--primary-base-neutral-white);
|
|
90
|
+
border-color: var(--primary-base-neutral-base);
|
|
91
|
+
}
|
|
92
|
+
.disabled.checked .checkbox:hover,
|
|
93
|
+
.disabled.indeterminate .checkbox:hover {
|
|
94
|
+
border-color: var(--primary-base-neutral-base) !important;
|
|
95
|
+
background: var(--primary-base-neutral-white);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.disabled .checkbox:focus {
|
|
99
|
+
border-color: var(--primary-base-neutral-base);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Estado Checked */
|
|
103
|
+
.checked .checkbox,
|
|
104
|
+
.indeterminate .checkbox {
|
|
105
|
+
border-color: var(--color-dark);
|
|
106
|
+
background: var(--color-base);
|
|
107
|
+
}
|
|
108
|
+
.checked .checkbox:hover,
|
|
109
|
+
.indeterminate .checkbox:hover {
|
|
110
|
+
border-color: var(--color-light) !important;
|
|
111
|
+
background: var(--color-lighter);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.checked .icon,
|
|
115
|
+
.indeterminate .icon {
|
|
116
|
+
opacity: 1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Hover para não disabled, checked, indeterminate */
|
|
120
|
+
:not(.disabled):not(.checked):not(.indeterminate) .checkbox:hover {
|
|
121
|
+
border-color: var(--primary-base-neutral-dark);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Estado Success */
|
|
125
|
+
.success .checkbox {
|
|
126
|
+
border-color: var(--success-base);
|
|
127
|
+
background: var(--success-lighter);
|
|
128
|
+
}
|
|
129
|
+
.success .checkbox:hover {
|
|
130
|
+
border-color: var(--success-base) !important;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.success.checked .checkbox {
|
|
134
|
+
border-color: var(--success-dark-base);
|
|
135
|
+
background: var(--success-base-lighter);
|
|
136
|
+
}
|
|
137
|
+
.success.checked .checkbox:hover {
|
|
138
|
+
border-color: var(--success-dark-base);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* Estado Error */
|
|
142
|
+
.error .checkbox {
|
|
143
|
+
border-color: var(--error-base);
|
|
144
|
+
background: var(--error-lighter);
|
|
145
|
+
}
|
|
146
|
+
.error .checkbox:hover {
|
|
147
|
+
border-color: var(--error-base) !important;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.error.checked .checkbox {
|
|
151
|
+
border-color: var(--error-dark-base);
|
|
152
|
+
background: var(--error-base-lighter);
|
|
153
|
+
}
|
|
154
|
+
.error.checked .checkbox:hover {
|
|
155
|
+
border-color: var(--error-dark-base);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Input */
|
|
159
|
+
input {
|
|
160
|
+
appearance: none;
|
|
161
|
+
-webkit-appearance: none;
|
|
162
|
+
-moz-appearance: none;
|
|
163
|
+
}
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { formsSizes } from '../cura-forms.definitions';
|
|
3
|
+
export class CuraCheckbox {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.isDarkbackground = () => this.background === 'dark';
|
|
6
|
+
this.isDarkIconColor = () => this.iconColor === 'dark';
|
|
7
|
+
/**
|
|
8
|
+
* Handles click event on the checkbox.
|
|
9
|
+
* Emits onchange event with value, checked, and indeterminate states.
|
|
10
|
+
*/
|
|
11
|
+
this.handleClick = () => {
|
|
12
|
+
if (this.disabled)
|
|
13
|
+
return;
|
|
14
|
+
this.indeterminate = false;
|
|
15
|
+
this.checked = !this.checked;
|
|
16
|
+
this.onchange.emit({ value: this.value, checked: this.checked, indeterminate: this.indeterminate });
|
|
17
|
+
};
|
|
18
|
+
this.checked = false;
|
|
19
|
+
this.indeterminate = false;
|
|
20
|
+
this.status = 'default';
|
|
21
|
+
this.disabled = false;
|
|
22
|
+
this.required = false;
|
|
23
|
+
this.label = undefined;
|
|
24
|
+
this.ontabindex = 0;
|
|
25
|
+
this.position = 'left';
|
|
26
|
+
this.value = undefined;
|
|
27
|
+
this.name = undefined;
|
|
28
|
+
this.size = 'medium';
|
|
29
|
+
this.background = 'light';
|
|
30
|
+
this.iconColor = 'dark';
|
|
31
|
+
this.color = 'accent';
|
|
32
|
+
this.styles = {};
|
|
33
|
+
}
|
|
34
|
+
sizeHandler() {
|
|
35
|
+
this.styles = Object.assign(Object.assign({}, this.styles), { '--size': `${formsSizes[this.size].size}px`, '--gap': `${formsSizes[this.size].gap}px` });
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Watches changes in color and background properties to update styles.
|
|
39
|
+
*/
|
|
40
|
+
setColors() {
|
|
41
|
+
const colors = [
|
|
42
|
+
{ name: '--color-base', background: `${this.color}-base` },
|
|
43
|
+
{ name: '--color-lighter', background: `${this.color}-lighter` },
|
|
44
|
+
{ name: '--color-light', background: `${this.color}-light` },
|
|
45
|
+
{ name: '--color-dark', background: `${this.color}-dark` },
|
|
46
|
+
{ name: '--info-base', background: 'info-base' },
|
|
47
|
+
{ name: '--error-base', background: 'error-base' },
|
|
48
|
+
{ name: '--success-lighter', background: 'success-lighter' },
|
|
49
|
+
{ name: '--success-base', background: 'success-base' },
|
|
50
|
+
{ name: '--success-dark', background: 'success-dark' },
|
|
51
|
+
{ name: '--error-lighter', background: 'error-lighter' },
|
|
52
|
+
{ name: '--primary-base-neutral-white', background: this.isDarkbackground() ? 'primary-base' : 'neutral-white' },
|
|
53
|
+
{ name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },
|
|
54
|
+
{ name: '--neutral-lighter-neutral-purewhite', background: this.isDarkbackground() ? 'neutral-lighter' : 'neutral-purewhite' },
|
|
55
|
+
{ name: '--primary-darker-neutral-white', background: this.isDarkbackground() ? 'primary-darker' : 'neutral-white' },
|
|
56
|
+
{ name: '--primary-base-neutral-base', background: this.isDarkbackground() ? 'primary-base' : 'neutral-base' },
|
|
57
|
+
{ name: '--primary-base-neutral-dark', background: this.isDarkbackground() ? 'primary-base' : 'neutral-dark' },
|
|
58
|
+
{ name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },
|
|
59
|
+
{ name: '--success-base-lighter', background: this.isDarkbackground() ? 'success-base' : 'success-lighter' },
|
|
60
|
+
{ name: '--success-dark-base', background: this.isDarkbackground() ? 'success-dark' : 'success-base' },
|
|
61
|
+
{ name: '--error-base-lighter', background: this.isDarkbackground() ? 'error-base' : 'error-lighter' },
|
|
62
|
+
{ name: '--error-dark-base', background: this.isDarkbackground() ? 'error-dark' : 'error-base' },
|
|
63
|
+
];
|
|
64
|
+
colors.forEach(color => {
|
|
65
|
+
this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.background);
|
|
66
|
+
});
|
|
67
|
+
this.styles = Object.assign({}, this.styles);
|
|
68
|
+
}
|
|
69
|
+
connectedCallback() {
|
|
70
|
+
this.sizeHandler();
|
|
71
|
+
this.setColors();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Retrieves classes based on component state for conditional styling.
|
|
75
|
+
*/
|
|
76
|
+
getClasses() {
|
|
77
|
+
const classes = {};
|
|
78
|
+
classes['container'] = true;
|
|
79
|
+
classes['checked'] = this.checked;
|
|
80
|
+
classes['disabled'] = this.disabled;
|
|
81
|
+
classes['indeterminate'] = this.indeterminate;
|
|
82
|
+
classes['position'] = this.position === 'right';
|
|
83
|
+
classes[this.status] = true;
|
|
84
|
+
return classes;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Assigns color based on status and background theme.
|
|
88
|
+
* @param defaultColor Default color.
|
|
89
|
+
*/
|
|
90
|
+
assignColor(type) {
|
|
91
|
+
if (this.disabled)
|
|
92
|
+
return this.isDarkbackground() ? 'primary-darker' : 'neutral-medium';
|
|
93
|
+
const statusColors = {
|
|
94
|
+
success: {
|
|
95
|
+
icon: 'success-dark',
|
|
96
|
+
label: this.isDarkbackground() ? 'success-lighter' : 'success-darker',
|
|
97
|
+
message: this.isDarkbackground() ? 'success-base' : 'success-dark'
|
|
98
|
+
},
|
|
99
|
+
error: {
|
|
100
|
+
icon: 'error-dark',
|
|
101
|
+
label: this.isDarkbackground() ? 'error-lighter' : 'neutral-darker',
|
|
102
|
+
message: this.isDarkbackground() ? 'error-base' : 'error-dark'
|
|
103
|
+
},
|
|
104
|
+
default: {
|
|
105
|
+
icon: this.isDarkIconColor() ? 'neutral-black' : 'neutral-purewhite',
|
|
106
|
+
label: this.isDarkbackground() ? 'neutral-white' : 'neutral-black',
|
|
107
|
+
message: this.isDarkbackground() ? 'primary-lighter' : 'neutral-dark'
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return statusColors[this.status][type];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Retrieves icon element based on checkbox state.
|
|
114
|
+
*/
|
|
115
|
+
getIcon() {
|
|
116
|
+
const iconName = this.indeterminate ? 'minus' : "check";
|
|
117
|
+
const iconColor = this.assignColor('icon');
|
|
118
|
+
const iconSize = this.size === 'large' ? 20 : "micro";
|
|
119
|
+
return h("cura-icon", { class: "icon", name: iconName, size: iconSize, color: iconColor });
|
|
120
|
+
}
|
|
121
|
+
render() {
|
|
122
|
+
return (h(Host, null, h("div", { class: this.getClasses(), style: this.styles }, h("div", { class: "info" }, h("div", { class: "label-wrapper" }, h("cura-label", { class: "label", size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && h("cura-paragraph", { lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), h("cura-label", { color: this.assignColor('message'), size: "xsmall", class: "message" }, h("slot", null))), h("div", { class: "checkbox", onClick: this.handleClick, tabIndex: this.ontabindex }, h("input", { type: "checkbox", name: this.name, value: this.value, disabled: this.disabled, required: this.required, checked: this.checked, indeterminate: this.indeterminate }), this.getIcon()))));
|
|
123
|
+
}
|
|
124
|
+
static get is() { return "cura-checkbox"; }
|
|
125
|
+
static get encapsulation() { return "shadow"; }
|
|
126
|
+
static get originalStyleUrls() {
|
|
127
|
+
return {
|
|
128
|
+
"$": ["cura-checkbox.scss"]
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
static get styleUrls() {
|
|
132
|
+
return {
|
|
133
|
+
"$": ["cura-checkbox.css"]
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
static get properties() {
|
|
137
|
+
return {
|
|
138
|
+
"checked": {
|
|
139
|
+
"type": "boolean",
|
|
140
|
+
"mutable": true,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "boolean",
|
|
143
|
+
"resolved": "boolean",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": "Reflects the checked state of the checkbox.\nMutable property allowing state change."
|
|
151
|
+
},
|
|
152
|
+
"attribute": "checked",
|
|
153
|
+
"reflect": true,
|
|
154
|
+
"defaultValue": "false"
|
|
155
|
+
},
|
|
156
|
+
"indeterminate": {
|
|
157
|
+
"type": "boolean",
|
|
158
|
+
"mutable": true,
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "boolean",
|
|
161
|
+
"resolved": "boolean",
|
|
162
|
+
"references": {}
|
|
163
|
+
},
|
|
164
|
+
"required": false,
|
|
165
|
+
"optional": false,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": "Reflects the indeterminate state of the checkbox.\nMutable property allowing state change."
|
|
169
|
+
},
|
|
170
|
+
"attribute": "indeterminate",
|
|
171
|
+
"reflect": true,
|
|
172
|
+
"defaultValue": "false"
|
|
173
|
+
},
|
|
174
|
+
"status": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"mutable": true,
|
|
177
|
+
"complexType": {
|
|
178
|
+
"original": "'error' | 'success' | 'default'",
|
|
179
|
+
"resolved": "\"default\" | \"error\" | \"success\"",
|
|
180
|
+
"references": {}
|
|
181
|
+
},
|
|
182
|
+
"required": false,
|
|
183
|
+
"optional": false,
|
|
184
|
+
"docs": {
|
|
185
|
+
"tags": [],
|
|
186
|
+
"text": "Status of the checkbox.\nCan be 'error', 'success', or 'default'."
|
|
187
|
+
},
|
|
188
|
+
"attribute": "status",
|
|
189
|
+
"reflect": true,
|
|
190
|
+
"defaultValue": "'default'"
|
|
191
|
+
},
|
|
192
|
+
"disabled": {
|
|
193
|
+
"type": "boolean",
|
|
194
|
+
"mutable": false,
|
|
195
|
+
"complexType": {
|
|
196
|
+
"original": "boolean",
|
|
197
|
+
"resolved": "boolean",
|
|
198
|
+
"references": {}
|
|
199
|
+
},
|
|
200
|
+
"required": false,
|
|
201
|
+
"optional": false,
|
|
202
|
+
"docs": {
|
|
203
|
+
"tags": [],
|
|
204
|
+
"text": "Reflects the disabled state of the checkbox."
|
|
205
|
+
},
|
|
206
|
+
"attribute": "disabled",
|
|
207
|
+
"reflect": true,
|
|
208
|
+
"defaultValue": "false"
|
|
209
|
+
},
|
|
210
|
+
"required": {
|
|
211
|
+
"type": "boolean",
|
|
212
|
+
"mutable": false,
|
|
213
|
+
"complexType": {
|
|
214
|
+
"original": "boolean",
|
|
215
|
+
"resolved": "boolean",
|
|
216
|
+
"references": {}
|
|
217
|
+
},
|
|
218
|
+
"required": false,
|
|
219
|
+
"optional": false,
|
|
220
|
+
"docs": {
|
|
221
|
+
"tags": [],
|
|
222
|
+
"text": "Reflects the required state of the checkbox."
|
|
223
|
+
},
|
|
224
|
+
"attribute": "required",
|
|
225
|
+
"reflect": true,
|
|
226
|
+
"defaultValue": "false"
|
|
227
|
+
},
|
|
228
|
+
"label": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"mutable": false,
|
|
231
|
+
"complexType": {
|
|
232
|
+
"original": "string",
|
|
233
|
+
"resolved": "string",
|
|
234
|
+
"references": {}
|
|
235
|
+
},
|
|
236
|
+
"required": false,
|
|
237
|
+
"optional": false,
|
|
238
|
+
"docs": {
|
|
239
|
+
"tags": [],
|
|
240
|
+
"text": "Text label associated with the checkbox."
|
|
241
|
+
},
|
|
242
|
+
"attribute": "label",
|
|
243
|
+
"reflect": true
|
|
244
|
+
},
|
|
245
|
+
"ontabindex": {
|
|
246
|
+
"type": "number",
|
|
247
|
+
"mutable": false,
|
|
248
|
+
"complexType": {
|
|
249
|
+
"original": "number",
|
|
250
|
+
"resolved": "number",
|
|
251
|
+
"references": {}
|
|
252
|
+
},
|
|
253
|
+
"required": false,
|
|
254
|
+
"optional": false,
|
|
255
|
+
"docs": {
|
|
256
|
+
"tags": [],
|
|
257
|
+
"text": "Specifies the tabindex of the checkbox."
|
|
258
|
+
},
|
|
259
|
+
"attribute": "ontabindex",
|
|
260
|
+
"reflect": true,
|
|
261
|
+
"defaultValue": "0"
|
|
262
|
+
},
|
|
263
|
+
"position": {
|
|
264
|
+
"type": "string",
|
|
265
|
+
"mutable": false,
|
|
266
|
+
"complexType": {
|
|
267
|
+
"original": "'left' | 'right'",
|
|
268
|
+
"resolved": "\"left\" | \"right\"",
|
|
269
|
+
"references": {}
|
|
270
|
+
},
|
|
271
|
+
"required": false,
|
|
272
|
+
"optional": false,
|
|
273
|
+
"docs": {
|
|
274
|
+
"tags": [],
|
|
275
|
+
"text": "Position of the label relative to the checkbox.\nCan be 'left' or 'right'."
|
|
276
|
+
},
|
|
277
|
+
"attribute": "position",
|
|
278
|
+
"reflect": true,
|
|
279
|
+
"defaultValue": "'left'"
|
|
280
|
+
},
|
|
281
|
+
"value": {
|
|
282
|
+
"type": "string",
|
|
283
|
+
"mutable": false,
|
|
284
|
+
"complexType": {
|
|
285
|
+
"original": "string",
|
|
286
|
+
"resolved": "string",
|
|
287
|
+
"references": {}
|
|
288
|
+
},
|
|
289
|
+
"required": false,
|
|
290
|
+
"optional": false,
|
|
291
|
+
"docs": {
|
|
292
|
+
"tags": [],
|
|
293
|
+
"text": "Value associated with the checkbox."
|
|
294
|
+
},
|
|
295
|
+
"attribute": "value",
|
|
296
|
+
"reflect": true
|
|
297
|
+
},
|
|
298
|
+
"name": {
|
|
299
|
+
"type": "string",
|
|
300
|
+
"mutable": false,
|
|
301
|
+
"complexType": {
|
|
302
|
+
"original": "string",
|
|
303
|
+
"resolved": "string",
|
|
304
|
+
"references": {}
|
|
305
|
+
},
|
|
306
|
+
"required": false,
|
|
307
|
+
"optional": false,
|
|
308
|
+
"docs": {
|
|
309
|
+
"tags": [],
|
|
310
|
+
"text": "Name attribute of the checkbox."
|
|
311
|
+
},
|
|
312
|
+
"attribute": "name",
|
|
313
|
+
"reflect": true
|
|
314
|
+
},
|
|
315
|
+
"size": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"mutable": false,
|
|
318
|
+
"complexType": {
|
|
319
|
+
"original": "'small' | 'medium' | 'large'",
|
|
320
|
+
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
321
|
+
"references": {}
|
|
322
|
+
},
|
|
323
|
+
"required": false,
|
|
324
|
+
"optional": false,
|
|
325
|
+
"docs": {
|
|
326
|
+
"tags": [],
|
|
327
|
+
"text": "Size of the checkbox.\nCan be 'small', 'medium', or 'large'."
|
|
328
|
+
},
|
|
329
|
+
"attribute": "size",
|
|
330
|
+
"reflect": true,
|
|
331
|
+
"defaultValue": "'medium'"
|
|
332
|
+
},
|
|
333
|
+
"background": {
|
|
334
|
+
"type": "string",
|
|
335
|
+
"mutable": false,
|
|
336
|
+
"complexType": {
|
|
337
|
+
"original": "'dark' | 'light'",
|
|
338
|
+
"resolved": "\"dark\" | \"light\"",
|
|
339
|
+
"references": {}
|
|
340
|
+
},
|
|
341
|
+
"required": false,
|
|
342
|
+
"optional": false,
|
|
343
|
+
"docs": {
|
|
344
|
+
"tags": [],
|
|
345
|
+
"text": "Background theme of the checkbox.\nCan be 'dark' or 'light'."
|
|
346
|
+
},
|
|
347
|
+
"attribute": "background",
|
|
348
|
+
"reflect": false,
|
|
349
|
+
"defaultValue": "'light'"
|
|
350
|
+
},
|
|
351
|
+
"iconColor": {
|
|
352
|
+
"type": "string",
|
|
353
|
+
"mutable": false,
|
|
354
|
+
"complexType": {
|
|
355
|
+
"original": "'dark' | 'light'",
|
|
356
|
+
"resolved": "\"dark\" | \"light\"",
|
|
357
|
+
"references": {}
|
|
358
|
+
},
|
|
359
|
+
"required": false,
|
|
360
|
+
"optional": false,
|
|
361
|
+
"docs": {
|
|
362
|
+
"tags": [],
|
|
363
|
+
"text": "iconColor theme of the checkbox.\nCan be 'dark' or 'light'."
|
|
364
|
+
},
|
|
365
|
+
"attribute": "icon-color",
|
|
366
|
+
"reflect": false,
|
|
367
|
+
"defaultValue": "'dark'"
|
|
368
|
+
},
|
|
369
|
+
"color": {
|
|
370
|
+
"type": "string",
|
|
371
|
+
"mutable": false,
|
|
372
|
+
"complexType": {
|
|
373
|
+
"original": "string",
|
|
374
|
+
"resolved": "string",
|
|
375
|
+
"references": {}
|
|
376
|
+
},
|
|
377
|
+
"required": false,
|
|
378
|
+
"optional": false,
|
|
379
|
+
"docs": {
|
|
380
|
+
"tags": [],
|
|
381
|
+
"text": "Color theme of the checkbox."
|
|
382
|
+
},
|
|
383
|
+
"attribute": "color",
|
|
384
|
+
"reflect": false,
|
|
385
|
+
"defaultValue": "'accent'"
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
static get states() {
|
|
390
|
+
return {
|
|
391
|
+
"styles": {}
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
static get events() {
|
|
395
|
+
return [{
|
|
396
|
+
"method": "onchange",
|
|
397
|
+
"name": "onchange",
|
|
398
|
+
"bubbles": true,
|
|
399
|
+
"cancelable": true,
|
|
400
|
+
"composed": true,
|
|
401
|
+
"docs": {
|
|
402
|
+
"tags": [],
|
|
403
|
+
"text": ""
|
|
404
|
+
},
|
|
405
|
+
"complexType": {
|
|
406
|
+
"original": "{ value: string, checked: boolean, indeterminate: boolean }",
|
|
407
|
+
"resolved": "{ value: string; checked: boolean; indeterminate: boolean; }",
|
|
408
|
+
"references": {}
|
|
409
|
+
}
|
|
410
|
+
}];
|
|
411
|
+
}
|
|
412
|
+
static get elementRef() { return "host"; }
|
|
413
|
+
static get watchers() {
|
|
414
|
+
return [{
|
|
415
|
+
"propName": "size",
|
|
416
|
+
"methodName": "sizeHandler"
|
|
417
|
+
}, {
|
|
418
|
+
"propName": "color",
|
|
419
|
+
"methodName": "setColors"
|
|
420
|
+
}, {
|
|
421
|
+
"propName": "background",
|
|
422
|
+
"methodName": "setColors"
|
|
423
|
+
}, {
|
|
424
|
+
"propName": "background",
|
|
425
|
+
"methodName": "assignColor"
|
|
426
|
+
}, {
|
|
427
|
+
"propName": "iconColor",
|
|
428
|
+
"methodName": "assignColor"
|
|
429
|
+
}];
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
//# sourceMappingURL=cura-checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-checkbox.js","sourceRoot":"","sources":["../../../../src/components/forms/cura-checkbox/cura-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAQvD,MAAM,OAAO,YAAY;;IAuEvB,qBAAgB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC;IAEpD,oBAAe,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC;IAuDlD;;;OAGG;IACH,gBAAW,GAAG,GAAG,EAAE;MACjB,IAAI,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,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,aAAa,EAAE,IAAI,CAAC,aAAa,GACjC;UACD,IAAI,CAAC,OAAO,EAAE,CACX,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Event, Element, h, Host, Watch, EventEmitter, State } from '@stencil/core';\nimport { formsSizes } from '../cura-forms.definitions';\n\n@Component({\n tag: 'cura-checkbox',\n styleUrl: 'cura-checkbox.scss',\n shadow: true,\n})\n\nexport class CuraCheckbox {\n /**\n * Reflects the checked state of the checkbox.\n * Mutable property allowing state change.\n */\n @Prop({ reflect: true, mutable: true }) checked: boolean = false;\n /**\n * Reflects the indeterminate state of the checkbox.\n * Mutable property allowing state change.\n */\n @Prop({ reflect: true, mutable: true }) indeterminate: boolean = false;\n /**\n * Status of the checkbox.\n * Can be 'error', 'success', or 'default'.\n */\n @Prop({ reflect: true, mutable: true }) status: 'error' | 'success' | 'default' = 'default';\n /**\n * Reflects the disabled state of the checkbox.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n /**\n * Reflects the required state of the checkbox.\n */\n @Prop({ reflect: true }) required: boolean = false;\n /**\n * Text label associated with the checkbox.\n */\n @Prop({ reflect: true }) label: string;\n /**\n * Specifies the tabindex of the checkbox.\n */\n @Prop({ reflect: true }) ontabindex: number = 0;\n /**\n * Position of the label relative to the checkbox.\n * Can be 'left' or 'right'.\n */\n @Prop({ reflect: true }) position: 'left' | 'right' = 'left';\n /**\n * Value associated with the checkbox.\n */\n @Prop({ reflect: true }) value: string;\n /**\n * Name attribute of the checkbox.\n */\n @Prop({ reflect: true }) name: string;\n /**\n * Size of the checkbox.\n * Can be 'small', 'medium', or 'large'.\n */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n /**\n * Background theme of the checkbox.\n * Can be 'dark' or 'light'.\n */\n @Prop() background: 'dark' | 'light' = 'light';\n /**\n * iconColor theme of the checkbox.\n * Can be 'dark' or 'light'.\n */\n @Prop() iconColor: 'dark' | 'light' = 'dark';\n /**\n * Color theme of the checkbox.\n */\n @Prop() color = 'accent';\n\n @State() styles = {};\n\n @Element() host: HTMLElement;\n\n @Event() onchange: EventEmitter<{ value: string, checked: boolean, indeterminate: boolean }>;\n\n isDarkbackground = () => this.background === 'dark';\n\n isDarkIconColor = () => this.iconColor === 'dark';\n\n\n @Watch('size')\n sizeHandler() {\n this.styles = {\n ...this.styles,\n '--size': `${formsSizes[this.size].size}px`,\n '--gap': `${formsSizes[this.size].gap}px`\n };\n }\n\n\n /**\n * Watches changes in color and background properties to update styles.\n */\n @Watch('color')\n @Watch('background')\n setColors() {\n const colors = [\n { name: '--color-base', background: `${this.color}-base` },\n { name: '--color-lighter', background: `${this.color}-lighter` },\n { name: '--color-light', background: `${this.color}-light` },\n { name: '--color-dark', background: `${this.color}-dark` },\n { name: '--info-base', background: 'info-base' },\n { name: '--error-base', background: 'error-base' },\n { name: '--success-lighter', background: 'success-lighter' },\n { name: '--success-base', background: 'success-base' },\n { name: '--success-dark', background: 'success-dark' },\n { name: '--error-lighter', background: 'error-lighter' },\n { name: '--primary-base-neutral-white', background: this.isDarkbackground() ? 'primary-base' : 'neutral-white' },\n { name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },\n { name: '--neutral-lighter-neutral-purewhite', background: this.isDarkbackground() ? 'neutral-lighter' : 'neutral-purewhite' },\n { name: '--primary-darker-neutral-white', background: this.isDarkbackground() ? 'primary-darker' : 'neutral-white' },\n { name: '--primary-base-neutral-base', background: this.isDarkbackground() ? 'primary-base' : 'neutral-base' },\n { name: '--primary-base-neutral-dark', background: this.isDarkbackground() ? 'primary-base' : 'neutral-dark' },\n { name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },\n { name: '--success-base-lighter', background: this.isDarkbackground() ? 'success-base' : 'success-lighter' },\n { name: '--success-dark-base', background: this.isDarkbackground() ? 'success-dark' : 'success-base' },\n { name: '--error-base-lighter', background: this.isDarkbackground() ? 'error-base' : 'error-lighter' },\n { name: '--error-dark-base', background: this.isDarkbackground() ? 'error-dark' : 'error-base' },\n ];\n\n colors.forEach(color => {\n this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.background);\n });\n this.styles = { ...this.styles };\n\n }\n\n connectedCallback() {\n this.sizeHandler()\n this.setColors();\n }\n\n /**\n * Handles click event on the checkbox.\n * Emits onchange event with value, checked, and indeterminate states.\n */\n handleClick = () => {\n if (this.disabled) return;\n\n this.indeterminate = false;\n this.checked = !this.checked;\n this.onchange.emit({ value: this.value, checked: this.checked, indeterminate: this.indeterminate });\n };\n\n /**\n * Retrieves classes based on component state for conditional styling.\n */\n getClasses() {\n const classes = {};\n classes['container'] = true;\n classes['checked'] = this.checked;\n classes['disabled'] = this.disabled;\n classes['indeterminate'] = this.indeterminate;\n classes['position'] = this.position === 'right';\n classes[this.status] = true;\n\n return classes;\n }\n\n /**\n * Assigns color based on status and background theme.\n * @param defaultColor Default color.\n */\n\n @Watch('background')\n @Watch('iconColor')\n assignColor(type: 'icon' | 'label' | 'message',) {\n if (this.disabled) return this.isDarkbackground() ? 'primary-darker' : 'neutral-medium';\n\n const statusColors = {\n success: {\n icon: 'success-dark',\n label: this.isDarkbackground() ? 'success-lighter' : 'success-darker',\n message: this.isDarkbackground() ? 'success-base' : 'success-dark'\n },\n error: {\n icon: 'error-dark',\n label: this.isDarkbackground() ? 'error-lighter' : 'neutral-darker',\n message: this.isDarkbackground() ? 'error-base' : 'error-dark'\n },\n default: {\n icon: this.isDarkIconColor() ? 'neutral-black' : 'neutral-purewhite',\n label: this.isDarkbackground() ? 'neutral-white' : 'neutral-black',\n message: this.isDarkbackground() ? 'primary-lighter' : 'neutral-dark'\n }\n };\n\n return statusColors[this.status][type];\n }\n\n /**\n * Retrieves icon element based on checkbox state.\n */\n getIcon() {\n const iconName = this.indeterminate ? 'minus' : \"check\"\n const iconColor = this.assignColor('icon');\n const iconSize = this.size === 'large' ? 20 : \"micro\"\n\n return <cura-icon class=\"icon\" name={iconName} size={iconSize} color={iconColor}></cura-icon>\n }\n\n\n render() {\n return (\n <Host>\n <div class={this.getClasses()} style={this.styles}>\n <div class=\"info\">\n <div class=\"label-wrapper\">\n <cura-label\n class=\"label\"\n size={this.size === 'large' ? 'medium' : 'xsmall'}\n color={this.assignColor('label')}>\n {this.label}\n </cura-label>\n {this.required && <cura-paragraph lineHeight='0%' marginBlock='0' color=\"error-base\" >* </cura-paragraph>}\n </div>\n <cura-label\n color={this.assignColor('message')}\n size=\"xsmall\"\n class=\"message\">\n <slot></slot>\n </cura-label>\n </div>\n <div class={\"checkbox\"} onClick={this.handleClick} tabIndex={this.ontabindex}>\n <input\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n required={this.required}\n checked={this.checked}\n indeterminate={this.indeterminate}\n />\n {this.getIcon()}\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|