@rededor/cura 1.2.0 → 1.3.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/cjs/{app-globals-4d07f363.js → app-globals-f33ceef8.js} +32 -1
- package/dist/cjs/app-globals-f33ceef8.js.map +1 -0
- package/dist/cjs/cura-accordion_12.cjs.entry.js +39 -38
- package/dist/cjs/cura-accordion_12.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-alert.cjs.entry.js +3 -2
- package/dist/cjs/cura-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-avatar.cjs.entry.js +1 -1
- package/dist/cjs/cura-badge-distance.cjs.entry.js +1 -1
- package/dist/cjs/cura-badge-number.cjs.entry.js +2 -2
- package/dist/cjs/cura-badge-number.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-outline.cjs.entry.js +1 -1
- package/dist/cjs/cura-button-select.cjs.entry.js +17 -9
- package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-transparent.cjs.entry.js +1 -1
- package/dist/cjs/cura-calendar.cjs.entry.js +2 -2
- package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-card.cjs.entry.js +1 -1
- package/dist/cjs/cura-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/cura-display.cjs.entry.js +1 -1
- package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js +1 -1
- package/dist/cjs/cura-dropdown-search-option.cjs.entry.js +2 -2
- package/dist/cjs/cura-dropdown-search.cjs.entry.js +21 -11
- package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-icons-view.cjs.entry.js +3 -3
- package/dist/cjs/cura-input-date.cjs.entry.js +45 -45
- package/dist/cjs/cura-input-date.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-loader-bar.cjs.entry.js +1 -1
- package/dist/cjs/cura-radio.cjs.entry.js +1 -1
- package/dist/cjs/cura-switch.cjs.entry.js +1 -1
- package/dist/cjs/cura-toast.cjs.entry.js +1 -1
- package/dist/cjs/cura-tooltip.cjs.entry.js +232 -0
- package/dist/cjs/cura-tooltip.cjs.entry.js.map +1 -0
- package/dist/cjs/cura.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/api/theme-presets/theme-presets.js +2 -0
- package/dist/collection/api/theme-presets/theme-presets.js.map +1 -1
- package/dist/collection/api/theme-presets/theme-richet.js +32 -0
- package/dist/collection/api/theme-presets/theme-richet.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.css +0 -6
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.js +41 -43
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.js.map +1 -1
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js +54 -36
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js.map +1 -1
- package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.css +61 -60
- package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js +41 -23
- package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js.map +1 -1
- package/dist/collection/components/badges/cura-badge-distance/cura-badge-distance.js +1 -1
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.css +0 -2
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js +1 -1
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js.map +1 -1
- 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 +36 -2
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +39 -11
- 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 +18 -7
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +1 -1
- package/dist/collection/components/cura-alert/cura-alert.css +25 -11
- package/dist/collection/components/cura-alert/cura-alert.js +2 -1
- package/dist/collection/components/cura-alert/cura-alert.js.map +1 -1
- package/dist/collection/components/cura-avatar/cura-avatar.js +1 -1
- package/dist/collection/components/cura-calendar/cura-calendar.css +1 -0
- package/dist/collection/components/cura-calendar/cura-calendar.js +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/cura-tooltip/cura-tooltip.css +159 -0
- package/dist/collection/components/cura-tooltip/cura-tooltip.js +397 -0
- package/dist/collection/components/cura-tooltip/cura-tooltip.js.map +1 -0
- package/dist/collection/components/cura-tooltip/cura-tooltip.stories.js +137 -0
- package/dist/collection/components/cura-tooltip/cura-tooltip.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.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 +20 -10
- 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 +15 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.js +69 -68
- package/dist/collection/components/forms/cura-input-date/cura-input-date.js.map +1 -1
- package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js +29 -10
- package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js +1 -1
- package/dist/collection/components/forms/cura-label/cura-label.js +1 -1
- package/dist/collection/components/forms/cura-radio/cura-radio.js +1 -1
- package/dist/collection/components/forms/cura-select/cura-select.js +3 -3
- package/dist/collection/components/forms/cura-select-options/cura-select-option.js +1 -1
- package/dist/collection/components/forms/cura-switch/cura-switch.js +1 -1
- package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.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.css +5 -1
- package/dist/collection/components/text/cura-heading/cura-heading.js +7 -6
- package/dist/collection/components/text/cura-heading/cura-heading.js.map +1 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +1 -1
- package/dist/components/cura-accordion-item.js +19 -12
- package/dist/components/cura-accordion-item.js.map +1 -1
- package/dist/components/cura-accordion.js +14 -15
- package/dist/components/cura-accordion.js.map +1 -1
- package/dist/components/cura-alert.js +3 -2
- package/dist/components/cura-alert.js.map +1 -1
- package/dist/components/cura-avatar.js +1 -1
- package/dist/components/cura-badge-distance.js +1 -1
- package/dist/components/cura-badge-number2.js +2 -2
- package/dist/components/cura-badge-number2.js.map +1 -1
- package/dist/components/cura-button-outline.js +1 -1
- package/dist/components/cura-button-select.js +18 -9
- 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-calendar2.js +2 -2
- package/dist/components/cura-calendar2.js.map +1 -1
- 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 +21 -11
- package/dist/components/cura-dropdown-search.js.map +1 -1
- package/dist/components/cura-heading2.js +8 -7
- package/dist/components/cura-heading2.js.map +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.js +54 -57
- package/dist/components/cura-input-date.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 +3 -3
- package/dist/components/cura-switch.js +1 -1
- package/dist/components/cura-toast.js +1 -1
- package/dist/components/cura-tooltip.d.ts +11 -0
- package/dist/components/cura-tooltip.js +291 -0
- package/dist/components/cura-tooltip.js.map +1 -0
- package/dist/components/index.js +33 -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-116a1cd6.entry.js → p-01e301d4.entry.js} +2 -2
- package/dist/cura/{p-c6508bd7.entry.js → p-022b22b6.entry.js} +2 -2
- package/dist/cura/p-0308cf6b.entry.js +2 -0
- package/dist/cura/p-0308cf6b.entry.js.map +1 -0
- package/dist/cura/p-22e921d9.entry.js +2 -0
- package/dist/cura/p-22e921d9.entry.js.map +1 -0
- package/dist/cura/p-2b9eadc7.entry.js +2 -0
- package/dist/cura/p-2b9eadc7.entry.js.map +1 -0
- package/dist/cura/{p-b2d5db22.entry.js → p-2c0f5497.entry.js} +2 -2
- package/dist/cura/p-5bb8302c.entry.js +2 -0
- package/dist/cura/p-5bb8302c.entry.js.map +1 -0
- package/dist/cura/{p-fcbf4311.entry.js → p-639c1b67.entry.js} +2 -2
- package/dist/cura/{p-2956f120.entry.js → p-7853ab16.entry.js} +2 -2
- package/dist/cura/{p-2956f120.entry.js.map → p-7853ab16.entry.js.map} +1 -1
- package/dist/cura/{p-41c3d47d.entry.js → p-81c66f2b.entry.js} +2 -2
- package/dist/cura/p-82b99090.js +2 -0
- package/dist/cura/p-82b99090.js.map +1 -0
- package/dist/cura/p-93525d68.entry.js +2 -0
- package/dist/cura/p-93525d68.entry.js.map +1 -0
- package/dist/cura/p-9991f7db.entry.js +2 -0
- package/dist/cura/p-9e3d26fe.entry.js +2 -0
- package/dist/cura/p-9e3d26fe.entry.js.map +1 -0
- package/dist/cura/{p-dcd2e5bb.entry.js → p-a7ecea4a.entry.js} +2 -2
- package/dist/cura/{p-33772510.entry.js → p-b0451cb3.entry.js} +2 -2
- package/dist/cura/{p-8f3db0fe.entry.js → p-b883e098.entry.js} +2 -2
- package/dist/cura/{p-907b3d12.entry.js → p-bfb5e9e1.entry.js} +2 -2
- package/dist/cura/{p-e5023e34.entry.js → p-c444e692.entry.js} +2 -2
- package/dist/cura/{p-fdce91a7.entry.js → p-d635501a.entry.js} +2 -2
- package/dist/cura/{p-fd083399.entry.js → p-df851816.entry.js} +2 -2
- package/dist/cura/{p-44e3325a.entry.js → p-e3d3bc3d.entry.js} +2 -2
- package/dist/cura/p-eda28278.entry.js +2 -0
- package/dist/cura/p-eda28278.entry.js.map +1 -0
- package/dist/esm/{app-globals-6ca7103d.js → app-globals-e54ee4c3.js} +32 -1
- package/dist/esm/app-globals-e54ee4c3.js.map +1 -0
- package/dist/esm/cura-accordion_12.entry.js +39 -38
- package/dist/esm/cura-accordion_12.entry.js.map +1 -1
- package/dist/esm/cura-alert.entry.js +3 -2
- package/dist/esm/cura-alert.entry.js.map +1 -1
- package/dist/esm/cura-avatar.entry.js +1 -1
- package/dist/esm/cura-badge-distance.entry.js +1 -1
- package/dist/esm/cura-badge-number.entry.js +2 -2
- package/dist/esm/cura-badge-number.entry.js.map +1 -1
- package/dist/esm/cura-button-outline.entry.js +1 -1
- package/dist/esm/cura-button-select.entry.js +17 -9
- package/dist/esm/cura-button-select.entry.js.map +1 -1
- package/dist/esm/cura-button-transparent.entry.js +1 -1
- package/dist/esm/cura-calendar.entry.js +2 -2
- package/dist/esm/cura-calendar.entry.js.map +1 -1
- package/dist/esm/cura-card.entry.js +1 -1
- package/dist/esm/cura-checkbox.entry.js +1 -1
- package/dist/esm/cura-display.entry.js +1 -1
- package/dist/esm/cura-dropdown-search-option-title.entry.js +1 -1
- package/dist/esm/cura-dropdown-search-option.entry.js +2 -2
- package/dist/esm/cura-dropdown-search.entry.js +21 -11
- package/dist/esm/cura-dropdown-search.entry.js.map +1 -1
- package/dist/esm/cura-icons-view.entry.js +3 -3
- package/dist/esm/cura-input-date.entry.js +45 -45
- package/dist/esm/cura-input-date.entry.js.map +1 -1
- package/dist/esm/cura-loader-bar.entry.js +1 -1
- package/dist/esm/cura-radio.entry.js +1 -1
- package/dist/esm/cura-switch.entry.js +1 -1
- package/dist/esm/cura-toast.entry.js +1 -1
- package/dist/esm/cura-tooltip.entry.js +228 -0
- package/dist/esm/cura-tooltip.entry.js.map +1 -0
- package/dist/esm/cura.js +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/types/api/theme-presets/theme-presets.d.ts +43 -0
- package/dist/types/api/theme-presets/theme-richet.d.ts +43 -0
- package/dist/types/components/accordion/cura-accordion/cura-accordion.d.ts +7 -3
- package/dist/types/components/accordion/cura-accordion/cura-accordion.stories.d.ts +38 -16
- package/dist/types/components/accordion/cura-accordion-item/cura-accordion-item.d.ts +8 -3
- package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +2 -0
- package/dist/types/components/buttons/cura-button-select/cura-button-select.stories.d.ts +14 -0
- package/dist/types/components/cura-tooltip/cura-tooltip.d.ts +25 -0
- package/dist/types/components/cura-tooltip/cura-tooltip.stories.d.ts +119 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +1 -0
- package/dist/types/components/forms/cura-input-date/cura-input-date.d.ts +19 -19
- package/dist/types/components/text/cura-heading/cura-heading.d.ts +1 -0
- package/dist/types/components.d.ts +75 -10
- package/package.json +2 -2
- package/dist/cjs/app-globals-4d07f363.js.map +0 -1
- package/dist/cura/p-0b7a7306.js +0 -2
- package/dist/cura/p-0b7a7306.js.map +0 -1
- package/dist/cura/p-2d267d23.entry.js +0 -2
- package/dist/cura/p-2d267d23.entry.js.map +0 -1
- package/dist/cura/p-4e14c01c.entry.js +0 -2
- package/dist/cura/p-b43b69f3.entry.js +0 -2
- package/dist/cura/p-b43b69f3.entry.js.map +0 -1
- package/dist/cura/p-be10b681.entry.js +0 -2
- package/dist/cura/p-be10b681.entry.js.map +0 -1
- package/dist/cura/p-cda24a1e.entry.js +0 -2
- package/dist/cura/p-cda24a1e.entry.js.map +0 -1
- package/dist/cura/p-e8bc6381.entry.js +0 -2
- package/dist/cura/p-e8bc6381.entry.js.map +0 -1
- package/dist/cura/p-ed97cf3c.entry.js +0 -2
- package/dist/cura/p-ed97cf3c.entry.js.map +0 -1
- package/dist/esm/app-globals-6ca7103d.js.map +0 -1
- /package/dist/cura/{p-116a1cd6.entry.js.map → p-01e301d4.entry.js.map} +0 -0
- /package/dist/cura/{p-c6508bd7.entry.js.map → p-022b22b6.entry.js.map} +0 -0
- /package/dist/cura/{p-b2d5db22.entry.js.map → p-2c0f5497.entry.js.map} +0 -0
- /package/dist/cura/{p-fcbf4311.entry.js.map → p-639c1b67.entry.js.map} +0 -0
- /package/dist/cura/{p-41c3d47d.entry.js.map → p-81c66f2b.entry.js.map} +0 -0
- /package/dist/cura/{p-4e14c01c.entry.js.map → p-9991f7db.entry.js.map} +0 -0
- /package/dist/cura/{p-dcd2e5bb.entry.js.map → p-a7ecea4a.entry.js.map} +0 -0
- /package/dist/cura/{p-33772510.entry.js.map → p-b0451cb3.entry.js.map} +0 -0
- /package/dist/cura/{p-8f3db0fe.entry.js.map → p-b883e098.entry.js.map} +0 -0
- /package/dist/cura/{p-907b3d12.entry.js.map → p-bfb5e9e1.entry.js.map} +0 -0
- /package/dist/cura/{p-e5023e34.entry.js.map → p-c444e692.entry.js.map} +0 -0
- /package/dist/cura/{p-fdce91a7.entry.js.map → p-d635501a.entry.js.map} +0 -0
- /package/dist/cura/{p-fd083399.entry.js.map → p-df851816.entry.js.map} +0 -0
- /package/dist/cura/{p-44e3325a.entry.js.map → p-e3d3bc3d.entry.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import { d as defineCustomElement$4 } from './cura-loader-circle2.js';
|
|
|
8
8
|
import { d as defineCustomElement$3 } from './cura-select2.js';
|
|
9
9
|
import { d as defineCustomElement$2 } from './cura-select-option2.js';
|
|
10
10
|
|
|
11
|
-
const curaInputDateCss = ":host{display:block}.container{display:flex;flex-direction:column}.container .calendar{padding:0px calc(var(--base-spacing) * 3px);margin-top:-8px;border-radius:0px 0px 4px 4px;border-top:0px;border-right:2px solid #D4D4D4;border-bottom:2px solid #D4D4D4;border-left:2px solid #D4D4D4;box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16))}";
|
|
11
|
+
const curaInputDateCss = ":host{display:block}.container{display:flex;flex-direction:column;position:relative}.container .calendar{padding:0px calc(var(--base-spacing) * 3px);margin-top:-8px;border-radius:0px 0px 4px 4px;border-top:0px;border-right:2px solid #D4D4D4;border-bottom:2px solid #D4D4D4;border-left:2px solid #D4D4D4;box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16));position:absolute;top:100%;z-index:10;display:none;opacity:0;pointer-events:none}.container .calendar.visible{box-sizing:border-box;display:block;opacity:1;pointer-events:auto;width:100%;background-color:#fff}";
|
|
12
12
|
const CuraInputDateStyle0 = curaInputDateCss;
|
|
13
13
|
|
|
14
14
|
const CuraInputDate$1 = /*@__PURE__*/ proxyCustomElement(class CuraInputDate extends HTMLElement {
|
|
@@ -17,6 +17,7 @@ const CuraInputDate$1 = /*@__PURE__*/ proxyCustomElement(class CuraInputDate ext
|
|
|
17
17
|
this.__registerHost();
|
|
18
18
|
this.__attachShadow();
|
|
19
19
|
this.dateChange = createEvent(this, "dateChange", 7);
|
|
20
|
+
this.statusInputChange = createEvent(this, "statusInputChange", 7);
|
|
20
21
|
this.label = '';
|
|
21
22
|
this.status = 'default';
|
|
22
23
|
this.size = 'medium';
|
|
@@ -31,17 +32,28 @@ const CuraInputDate$1 = /*@__PURE__*/ proxyCustomElement(class CuraInputDate ext
|
|
|
31
32
|
this.isCalendarVisible = false;
|
|
32
33
|
this.dates = [];
|
|
33
34
|
this.value = '';
|
|
35
|
+
this.dateSettings = {
|
|
36
|
+
placeholder: null,
|
|
37
|
+
mask: 'date',
|
|
38
|
+
mode: 'single',
|
|
39
|
+
};
|
|
34
40
|
}
|
|
35
41
|
connectedCallback() {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
this.styles
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const { fonts, colors, spacing } = window.CuraAPI.theme;
|
|
43
|
+
const weights = fonts.getWeights();
|
|
44
|
+
this.styles = {
|
|
45
|
+
'--base-spacing': spacing.getSpacing(),
|
|
46
|
+
'--neutral-purewhite': colors.getColor('neutral-purewhite'),
|
|
47
|
+
'--neutral-lighter': colors.getColor('neutral-lighter'),
|
|
48
|
+
'--neutral-base': colors.getColor('neutral-base'),
|
|
49
|
+
'--font-size': fonts.getSize(),
|
|
50
|
+
'--font-color': fonts.getColor(),
|
|
51
|
+
'--font-family': fonts.getFamily(),
|
|
52
|
+
'--font-weight-regular': weights.regular,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
componentWillLoad() {
|
|
56
|
+
this.updateDateSettings();
|
|
45
57
|
}
|
|
46
58
|
/**
|
|
47
59
|
* Callback for form association
|
|
@@ -49,33 +61,21 @@ const CuraInputDate$1 = /*@__PURE__*/ proxyCustomElement(class CuraInputDate ext
|
|
|
49
61
|
formAssociatedCallback(form) {
|
|
50
62
|
form.ariaLabel = this.label;
|
|
51
63
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* either for a date range ('dd/mm/yyyy - dd/mm/yyyy') or a single date ('dd/mm/yyyy')
|
|
57
|
-
*/
|
|
58
|
-
setPlaceholder() {
|
|
59
|
-
if (this.placeholder) {
|
|
60
|
-
return this.placeholder;
|
|
64
|
+
updateDateSettings() {
|
|
65
|
+
const newSettings = this.getDateSettings(this.enableRangeDates);
|
|
66
|
+
if (this.shouldUpdateDateSettings(newSettings)) {
|
|
67
|
+
this.dateSettings = newSettings;
|
|
61
68
|
}
|
|
62
|
-
return this.enableRangeDates ? 'dd/mm/aaaa - dd/mm/aaaa' : 'dd/mm/aaaa';
|
|
63
69
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return this.enableRangeDates ? 'dateRange' : 'date';
|
|
70
|
+
getDateSettings(isRange) {
|
|
71
|
+
return {
|
|
72
|
+
placeholder: this.placeholder || (isRange ? 'dd/mm/aaaa - dd/mm/aaaa' : 'dd/mm/aaaa'),
|
|
73
|
+
mask: isRange ? 'dateRange' : 'date',
|
|
74
|
+
mode: isRange ? 'range' : 'single',
|
|
75
|
+
};
|
|
71
76
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*
|
|
75
|
-
* @returns {'range' | 'single'}
|
|
76
|
-
*/
|
|
77
|
-
setMode() {
|
|
78
|
-
return this.enableRangeDates ? 'range' : 'single';
|
|
77
|
+
shouldUpdateDateSettings(newSettings) {
|
|
78
|
+
return this.dateSettings.placeholder !== newSettings.placeholder || this.dateSettings.mask !== newSettings.mask || this.dateSettings.mode !== newSettings.mode;
|
|
79
79
|
}
|
|
80
80
|
handleClick(ev) {
|
|
81
81
|
if (this.el.contains(ev.target)) {
|
|
@@ -104,8 +104,7 @@ const CuraInputDate$1 = /*@__PURE__*/ proxyCustomElement(class CuraInputDate ext
|
|
|
104
104
|
this.dateChange.emit(this.value);
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
|
-
this.
|
|
108
|
-
this.dates = [];
|
|
107
|
+
this.resetDates();
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
else if (simpleDateRegex.test(inputValue)) {
|
|
@@ -118,8 +117,7 @@ const CuraInputDate$1 = /*@__PURE__*/ proxyCustomElement(class CuraInputDate ext
|
|
|
118
117
|
this.dateChange.emit(this.value);
|
|
119
118
|
}
|
|
120
119
|
else {
|
|
121
|
-
this.
|
|
122
|
-
this.dates = [];
|
|
120
|
+
this.resetDates();
|
|
123
121
|
}
|
|
124
122
|
}
|
|
125
123
|
else {
|
|
@@ -132,6 +130,7 @@ const CuraInputDate$1 = /*@__PURE__*/ proxyCustomElement(class CuraInputDate ext
|
|
|
132
130
|
this.status = 'default';
|
|
133
131
|
this.value = '';
|
|
134
132
|
this.dateChange.emit(this.value);
|
|
133
|
+
this.statusInputChange.emit(this.status);
|
|
135
134
|
}
|
|
136
135
|
}
|
|
137
136
|
isDateValid(date) {
|
|
@@ -153,9 +152,14 @@ const CuraInputDate$1 = /*@__PURE__*/ proxyCustomElement(class CuraInputDate ext
|
|
|
153
152
|
const year = date.getFullYear();
|
|
154
153
|
return `${day}/${month}/${year}`;
|
|
155
154
|
}
|
|
155
|
+
resetDates() {
|
|
156
|
+
this.status = 'error';
|
|
157
|
+
this.dates = [];
|
|
158
|
+
this.statusInputChange.emit(this.status);
|
|
159
|
+
}
|
|
156
160
|
renderCalendarOrHelperText() {
|
|
157
161
|
if (this.isCalendarVisible) {
|
|
158
|
-
return (h("div", { class: "calendar" }, h("cura-calendar", { customDates: this.dates, mode: this.
|
|
162
|
+
return (h("div", { class: "calendar visible" }, h("cura-calendar", { customDates: this.dates, mode: this.dateSettings.mode, width: "100%", maxWidth: "400px", embedded: false, floating: false, disableFutureDates: this.disableFutureDates, disablePassDates: this.disablePassDates, onOnchangeday: e => {
|
|
159
163
|
const days = e.detail.days;
|
|
160
164
|
if (days.length === 1) {
|
|
161
165
|
this.value = this.parseDateToString(days[0]);
|
|
@@ -174,39 +178,32 @@ const CuraInputDate$1 = /*@__PURE__*/ proxyCustomElement(class CuraInputDate ext
|
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
render() {
|
|
177
|
-
return (h(Host, { key: '
|
|
181
|
+
return (h(Host, { key: 'a85d8edd29146ca4068bb0fb5f718a5b6426638e' }, h("div", { key: '99a69b37f9370bdf242d0dc698f707f28cf0325a', class: "container", style: this.styles }, h("cura-input-text", { key: '5f5450f7390792c1188e17f48a9d04f4339fc156', label: this.label, name: this.name, status: this.status, value: this.value, onFocus: () => this.showCalendar(), size: this.size, "icon-name": this.iconName, placeholder: this.dateSettings.placeholder, "mask-preset": this.dateSettings.mask, "enable-selection-mode": true, onKeyUp: event => this.handleInputDates(event), autocomplete: "off", onValueChange: event => this.handleChangeDates(event) }, this.renderCalendarOrHelperText()))));
|
|
178
182
|
}
|
|
179
183
|
static get formAssociated() { return true; }
|
|
180
184
|
get el() { return this; }
|
|
181
185
|
static get watchers() { return {
|
|
182
|
-
"enableRangeDates": ["
|
|
183
|
-
"disableFutureDates": ["isDateValid", "renderCalendarOrHelperText"],
|
|
184
|
-
"disablePassDates": ["isDateValid"],
|
|
185
|
-
"dates": ["renderCalendarOrHelperText"],
|
|
186
|
-
"isCalendarVisible": ["renderCalendarOrHelperText"]
|
|
186
|
+
"enableRangeDates": ["updateDateSettings"]
|
|
187
187
|
}; }
|
|
188
188
|
static get style() { return CuraInputDateStyle0; }
|
|
189
189
|
}, [65, "cura-input-date", {
|
|
190
190
|
"label": [513],
|
|
191
191
|
"status": [1537],
|
|
192
|
-
"size": [
|
|
192
|
+
"size": [513],
|
|
193
193
|
"name": [513],
|
|
194
|
-
"helperText": [
|
|
195
|
-
"enableRangeDates": [
|
|
196
|
-
"disableFutureDates": [
|
|
197
|
-
"disablePassDates": [
|
|
198
|
-
"iconName": [
|
|
194
|
+
"helperText": [513, "helper-text"],
|
|
195
|
+
"enableRangeDates": [516, "enable-range-dates"],
|
|
196
|
+
"disableFutureDates": [516, "disable-future-dates"],
|
|
197
|
+
"disablePassDates": [516, "disable-pass-dates"],
|
|
198
|
+
"iconName": [513, "icon-name"],
|
|
199
199
|
"placeholder": [513],
|
|
200
200
|
"styles": [32],
|
|
201
201
|
"isCalendarVisible": [32],
|
|
202
202
|
"dates": [32],
|
|
203
|
-
"value": [32]
|
|
203
|
+
"value": [32],
|
|
204
|
+
"dateSettings": [32]
|
|
204
205
|
}, [[8, "click", "handleClick"]], {
|
|
205
|
-
"enableRangeDates": ["
|
|
206
|
-
"disableFutureDates": ["isDateValid", "renderCalendarOrHelperText"],
|
|
207
|
-
"disablePassDates": ["isDateValid"],
|
|
208
|
-
"dates": ["renderCalendarOrHelperText"],
|
|
209
|
-
"isCalendarVisible": ["renderCalendarOrHelperText"]
|
|
206
|
+
"enableRangeDates": ["updateDateSettings"]
|
|
210
207
|
}]);
|
|
211
208
|
function defineCustomElement$1() {
|
|
212
209
|
if (typeof customElements === "undefined") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"cura-input-date.js","mappings":";;;;;;;;;;AAAA,MAAM,gBAAgB,GAAG,8WAA8W,CAAC;AACxY,4BAAe,gBAAgB;;MCSlBA,eAAa;;;;;;qBAMkB,EAAE;sBAKsC,SAAS;oBAKd,QAAQ;oBAK5C,EAAE;;;;;wBAyBiB,EAAE;2BAKP,IAAI;sBAQzC,EAAE;iCAEkB,KAAK;qBAElB,EAAE;qBAED,EAAE;;IAE5B,iBAAiB;QACf,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACxD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAC1E,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC/F,IAAI,CAAC,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;;","names":["CuraInputDate"],"sources":["src/components/forms/cura-input-date/cura-input-date.scss?tag=cura-input-date&encapsulation=shadow","src/components/forms/cura-input-date/cura-input-date.tsx"],"sourcesContent":["@import '../../../../src/scss/mixins/shadows.scss';\n@import '../../../../src/scss/mixins/spacing.scss';\n\n:host {\n display: block;\n}\n\n.container{\n display: flex;\n flex-direction: column;\n\n .calendar{\n padding: #{$spacing-none} #{$spacing-xxxs};\n margin-top: -8px;\n border-radius: 0px 0px 4px 4px;\n border-top: 0px;\n border-right: 2px solid #D4D4D4;\n border-bottom:2px solid #D4D4D4;\n border-left: 2px solid #D4D4D4;\n @include shadow-level3(--neutral-black-shadow);\n }\n}\n","import { Component, Element, Host, Listen, Prop, State, Watch, h, Event, EventEmitter } from '@stencil/core';\nimport { CuraInputTextCustomEvent } from '../../../components';\nimport { isAfter, isBefore } from 'date-fns';\n\n@Component({\n tag: 'cura-input-date',\n styleUrl: 'cura-input-date.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class CuraInputDate {\n @Element() el: HTMLElement;\n\n /**\n * Label text for the input date\n */\n @Prop({ reflect: true }) label?: string = '';\n\n /**\n * Indicates input status (default: default)\n */\n @Prop({ reflect: true, mutable: true }) status: 'error' | 'success' | 'default' = 'default';\n\n /**\n * Size of the input mode default: 'small', 'medium', or 'large' (default: 'medium')\n */\n @Prop({ reflect: true, mutable: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Name text for the input date\n */\n @Prop({ reflect: true }) name?: string = '';\n\n /**\n * Helper text displayed below the input\n */\n @Prop({ reflect: true, mutable: true }) helperText?: string;\n\n /**\n * Enables the date range selection mode, allowing users to select a period of dates\n */\n @Prop({ reflect: true, mutable: true }) enableRangeDates: boolean;\n\n /**\n * Controls whether future dates (dates before the current date) should be disabled\n */\n @Prop({ reflect: true, mutable: true }) disableFutureDates: boolean;\n\n /**\n * Controls whether past dates (dates before the current date) should be disabled\n */\n @Prop({ reflect: true, mutable: true }) disablePassDates: boolean;\n\n /**\n * Whether to display a cura icon (default: null)\n */\n @Prop({ reflect: true, mutable: true }) iconName?: string = '';\n\n /**\n * Placeholder text for the input\n */\n @Prop({ reflect: true }) placeholder?: string | null = null;\n\n /**\n * Emitted when the value of the input changes\n * @type {EventEmitter<string>}\n */\n @Event() dateChange: EventEmitter<string>;\n\n @State() styles = {};\n\n @State() isCalendarVisible: boolean = false;\n\n @State() dates: Date[] = [];\n\n @State() value?: string = '';\n\n connectedCallback() {\n const weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();\n this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor(`neutral-purewhite`);\n this.styles['--neutral-lighter'] = window.CuraAPI.theme.colors.getColor(`neutral-lighter`);\n this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-color'] = window.CuraAPI.theme.fonts.getColor();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-regular'] = weights.regular;\n }\n\n /**\n * Callback for form association\n */\n formAssociatedCallback(form: { ariaLabel: string }) {\n form.ariaLabel = this.label;\n }\n\n /**\n * Formats the placeholder based on the enableRangeDates flag\n *\n * @returns {string} A string representing the placeholder format,\n * either for a date range ('dd/mm/yyyy - dd/mm/yyyy') or a single date ('dd/mm/yyyy')\n */\n @Watch('enableRangeDates')\n setPlaceholder(): string {\n if (this.placeholder) {\n return this.placeholder;\n }\n return this.enableRangeDates ? 'dd/mm/aaaa - dd/mm/aaaa' : 'dd/mm/aaaa';\n }\n\n /**\n * Sets the mask type based on the enableRangeDates flag\n *\n * @returns {string} The mask type, either 'dateRange' or 'date'\n */\n @Watch('enableRangeDates')\n setMask(): string {\n return this.enableRangeDates ? 'dateRange' : 'date';\n }\n\n /**\n * Sets the mode type based on the enableRangeDates flag\n *\n * @returns {'range' | 'single'}\n */\n @Watch('enableRangeDates')\n setMode(): 'range' | 'single' {\n return this.enableRangeDates ? 'range' : 'single';\n }\n\n @Listen('click', { target: 'window' })\n handleClick(ev: { target: Node }) {\n if (this.el.contains(ev.target)) {\n return;\n }\n this.hideCalendar();\n }\n\n hideCalendar() {\n this.isCalendarVisible = false;\n }\n\n showCalendar() {\n this.isCalendarVisible = true;\n }\n\n handleInputDates(event: any) {\n const inputValue = event.target.value;\n\n const dateRangeRegex = /^(\\d{2}\\/\\d{2}\\/\\d{4})\\s*-\\s*(\\d{2}\\/\\d{2}\\/\\d{4})$/;\n const simpleDateRegex = /^(\\d{2}\\/\\d{2}\\/\\d{4})$/;\n\n if (dateRangeRegex.test(inputValue)) {\n const matches = inputValue.match(dateRangeRegex);\n const startDate = this.parseStringToDate(matches[1]);\n const endDate = this.parseStringToDate(matches[2]);\n if (this.isDateValid(startDate) && this.isDateValid(endDate)) {\n this.status = 'default';\n this.dates = [startDate, endDate];\n this.value = `${this.parseDateToString(startDate)} - ${this.parseDateToString(endDate)}`;\n this.dateChange.emit(this.value);\n } else {\n this.status = 'error';\n this.dates = [];\n }\n } else if (simpleDateRegex.test(inputValue)) {\n const matches = inputValue.match(simpleDateRegex);\n const singleDate = this.parseStringToDate(matches[1]);\n if (this.isDateValid(singleDate)) {\n this.status = 'default';\n this.dates = [singleDate];\n this.value = this.parseDateToString(singleDate);\n this.dateChange.emit(this.value);\n } else {\n this.status = 'error';\n this.dates = [];\n }\n } else {\n this.dates = [];\n }\n }\n\n handleChangeDates(event: CuraInputTextCustomEvent<string | number>) {\n if (event.detail === '') {\n this.dates = [];\n this.status = 'default';\n this.value = '';\n this.dateChange.emit(this.value);\n }\n }\n\n @Watch('disableFutureDates')\n @Watch('disablePassDates')\n isDateValid(date: Date) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n\n if (this.disablePassDates) return !isBefore(date, today);\n if (this.disableFutureDates) return !isAfter(date, today);\n return true;\n }\n\n parseStringToDate(dateString: string): Date {\n const [day, month, year] = dateString.split('/').map(Number);\n return new Date(year, month - 1, day);\n }\n\n parseDateToString(date: Date): string {\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const year = date.getFullYear();\n\n return `${day}/${month}/${year}`;\n }\n\n @Watch('dates')\n @Watch('isCalendarVisible')\n @Watch('disableFutureDates')\n renderCalendarOrHelperText() {\n if (this.isCalendarVisible) {\n return (\n <div class=\"calendar\">\n <cura-calendar\n customDates={this.dates}\n mode={this.setMode()}\n width=\"100%\"\n embedded={false}\n floating={false}\n disableFutureDates={this.disableFutureDates}\n disablePassDates={this.disablePassDates}\n onOnchangeday={e => {\n const days = e.detail.days;\n if (days.length === 1) {\n this.value = this.parseDateToString(days[0]);\n } else if (days.length > 0) {\n this.value = `${this.parseDateToString(days[0])} - ${this.parseDateToString(days[days.length - 1])}`;\n } else {\n this.value = '';\n }\n this.dateChange.emit(this.value);\n }}\n />\n </div>\n );\n } else {\n return this.helperText;\n }\n }\n\n render() {\n return (\n <Host>\n <div class=\"container\" style={this.styles}>\n <cura-input-text\n label={this.label}\n name={this.name}\n status={this.status}\n value={this.value}\n onFocus={() => this.showCalendar()}\n size={this.size}\n iconName={this.iconName}\n placeholder={this.setPlaceholder()}\n mask-preset={this.setMask()}\n enable-selection-mode={true}\n onKeyUp={event => this.handleInputDates(event)}\n autocomplete=\"off\"\n onValueChange={event => this.handleChangeDates(event)}\n >\n {this.renderCalendarOrHelperText()}\n </cura-input-text>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"cura-input-date.js","mappings":";;;;;;;;;;AAAA,MAAM,gBAAgB,GAAG,ilBAAilB,CAAC;AAC3mB,4BAAe,gBAAgB;;MCSlBA,eAAa;;;;;;;qBAMkB,EAAE;sBAKsC,SAAS;oBAK7B,QAAQ;oBAK7B,EAAE;;;;;wBAyBE,EAAE;2BAKQ,IAAI;sBAczC,EAAE;iCAEkB,KAAK;qBAElB,EAAE;qBAED,EAAE;4BAEJ;YACt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AM,EACnB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,EAClC,IAAI,EAAE,IAAI,CAAC,IAAI,eACJ,IAAI,CAAC,QAAQ,EACxB,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,iBAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,2BACZ,IAAI,EAC3B,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAC9C,YAAY,EAAC,KAAK,EAClB,aAAa,EAAE,KAAK,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAEpD,IAAI,CAAC,0BAA0B,EAAE,CAClB,CACd,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CuraInputDate"],"sources":["src/components/forms/cura-input-date/cura-input-date.scss?tag=cura-input-date&encapsulation=shadow","src/components/forms/cura-input-date/cura-input-date.tsx"],"sourcesContent":["@import '../../../../src/scss/mixins/shadows.scss';\n@import '../../../../src/scss/mixins/spacing.scss';\n\n:host {\n display: block;\n}\n\n.container{\n display: flex;\n flex-direction: column;\n position: relative;\n\n .calendar{\n padding: #{$spacing-none} #{$spacing-xxxs};\n margin-top: -8px;\n border-radius: 0px 0px 4px 4px;\n border-top: 0px;\n border-right: 2px solid #D4D4D4;\n border-bottom:2px solid #D4D4D4;\n border-left: 2px solid #D4D4D4;\n @include shadow-level3(--neutral-black-shadow);\n position: absolute;\n top: 100%; \n z-index: 10; \n display: none; \n opacity: 0;\n pointer-events: none; \n }\n\n .calendar.visible {\n box-sizing: border-box;\n display: block;\n opacity: 1;\n pointer-events: auto; \n width: 100%;\n background-color: #fff;\n }\n}\n","import { Component, Element, Host, Listen, Prop, State, Watch, h, Event, EventEmitter } from '@stencil/core';\nimport { CuraInputTextCustomEvent } from '../../../components';\nimport { isAfter, isBefore } from 'date-fns';\n\n@Component({\n tag: 'cura-input-date',\n styleUrl: 'cura-input-date.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class CuraInputDate {\n @Element() el: HTMLElement;\n\n /**\n * Label text for the input date\n */\n @Prop({ reflect: true }) label?: string = '';\n\n /**\n * Indicates input status (default: default)\n */\n @Prop({ reflect: true, mutable: true }) status: 'error' | 'success' | 'default' = 'default';\n\n /**\n * Size of the input mode default: 'small', 'medium', or 'large' (default: 'medium')\n */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Name text for the input date\n */\n @Prop({ reflect: true }) name?: string = '';\n\n /**\n * Helper text displayed below the input\n */\n @Prop({ reflect: true }) helperText?: string;\n\n /**\n * Enables the date range selection mode, allowing users to select a period of dates\n */\n @Prop({ reflect: true }) enableRangeDates: boolean;\n\n /**\n * Controls whether future dates (dates before the current date) should be disabled\n */\n @Prop({ reflect: true }) disableFutureDates: boolean;\n\n /**\n * Controls whether past dates (dates before the current date) should be disabled\n */\n @Prop({ reflect: true }) disablePassDates: boolean;\n\n /**\n * Whether to display a cura icon (default: null)\n */\n @Prop({ reflect: true }) iconName?: string = '';\n\n /**\n * Placeholder text for the input\n */\n @Prop({ reflect: true }) placeholder?: string | null = null;\n\n /**\n * Emitted when the value of the input changes\n * @type {EventEmitter<string>}\n */\n @Event() dateChange: EventEmitter<string>;\n\n /**\n * Emitted when the value of the status changes\n * @type {EventEmitter<string>}\n */\n @Event() statusInputChange: EventEmitter<string>;\n\n @State() styles = {};\n\n @State() isCalendarVisible: boolean = false;\n\n @State() dates: Date[] = [];\n\n @State() value?: string = '';\n\n @State() dateSettings = {\n placeholder: null,\n mask: 'date',\n mode: 'single',\n };\n\n connectedCallback() {\n const { fonts, colors, spacing } = window.CuraAPI.theme;\n const weights = fonts.getWeights();\n\n this.styles = {\n '--base-spacing': spacing.getSpacing(),\n '--neutral-purewhite': colors.getColor('neutral-purewhite'),\n '--neutral-lighter': colors.getColor('neutral-lighter'),\n '--neutral-base': colors.getColor('neutral-base'),\n '--font-size': fonts.getSize(),\n '--font-color': fonts.getColor(),\n '--font-family': fonts.getFamily(),\n '--font-weight-regular': weights.regular,\n };\n }\n\n componentWillLoad() {\n this.updateDateSettings();\n }\n\n /**\n * Callback for form association\n */\n formAssociatedCallback(form: { ariaLabel: string }) {\n form.ariaLabel = this.label;\n }\n\n @Watch('enableRangeDates')\n updateDateSettings() {\n const newSettings = this.getDateSettings(this.enableRangeDates);\n\n if (this.shouldUpdateDateSettings(newSettings)) {\n this.dateSettings = newSettings;\n }\n }\n\n getDateSettings(isRange: boolean) {\n return {\n placeholder: this.placeholder || (isRange ? 'dd/mm/aaaa - dd/mm/aaaa' : 'dd/mm/aaaa'),\n mask: isRange ? 'dateRange' : 'date',\n mode: isRange ? 'range' : 'single',\n };\n }\n\n shouldUpdateDateSettings(newSettings: any) {\n return this.dateSettings.placeholder !== newSettings.placeholder || this.dateSettings.mask !== newSettings.mask || this.dateSettings.mode !== newSettings.mode;\n }\n\n @Listen('click', { target: 'window' })\n handleClick(ev: { target: Node }) {\n if (this.el.contains(ev.target)) {\n return;\n }\n this.hideCalendar();\n }\n\n hideCalendar() {\n this.isCalendarVisible = false;\n }\n\n showCalendar() {\n this.isCalendarVisible = true;\n }\n\n handleInputDates(event: any) {\n const inputValue = event.target.value;\n\n const dateRangeRegex = /^(\\d{2}\\/\\d{2}\\/\\d{4})\\s*-\\s*(\\d{2}\\/\\d{2}\\/\\d{4})$/;\n const simpleDateRegex = /^(\\d{2}\\/\\d{2}\\/\\d{4})$/;\n\n if (dateRangeRegex.test(inputValue)) {\n const matches = inputValue.match(dateRangeRegex);\n const startDate = this.parseStringToDate(matches[1]);\n const endDate = this.parseStringToDate(matches[2]);\n if (this.isDateValid(startDate) && this.isDateValid(endDate)) {\n this.status = 'default';\n this.dates = [startDate, endDate];\n this.value = `${this.parseDateToString(startDate)} - ${this.parseDateToString(endDate)}`;\n this.dateChange.emit(this.value);\n } else {\n this.resetDates();\n }\n } else if (simpleDateRegex.test(inputValue)) {\n const matches = inputValue.match(simpleDateRegex);\n const singleDate = this.parseStringToDate(matches[1]);\n if (this.isDateValid(singleDate)) {\n this.status = 'default';\n this.dates = [singleDate];\n this.value = this.parseDateToString(singleDate);\n this.dateChange.emit(this.value);\n } else {\n this.resetDates();\n }\n } else {\n this.dates = [];\n }\n }\n\n handleChangeDates(event: CuraInputTextCustomEvent<string | number>) {\n if (event.detail === '') {\n this.dates = [];\n this.status = 'default';\n this.value = '';\n this.dateChange.emit(this.value);\n this.statusInputChange.emit(this.status);\n }\n }\n\n isDateValid(date: Date) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n\n if (this.disablePassDates) return !isBefore(date, today);\n if (this.disableFutureDates) return !isAfter(date, today);\n return true;\n }\n\n parseStringToDate(dateString: string): Date {\n const [day, month, year] = dateString.split('/').map(Number);\n return new Date(year, month - 1, day);\n }\n\n parseDateToString(date: Date): string {\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const year = date.getFullYear();\n\n return `${day}/${month}/${year}`;\n }\n\n resetDates() {\n this.status = 'error';\n this.dates = [];\n this.statusInputChange.emit(this.status);\n }\n\n renderCalendarOrHelperText() {\n if (this.isCalendarVisible) {\n return (\n <div class=\"calendar visible\">\n <cura-calendar\n customDates={this.dates}\n mode={this.dateSettings.mode as 'single' | 'range'}\n width=\"100%\"\n maxWidth=\"400px\"\n embedded={false}\n floating={false}\n disableFutureDates={this.disableFutureDates}\n disablePassDates={this.disablePassDates}\n onOnchangeday={e => {\n const days = e.detail.days;\n if (days.length === 1) {\n this.value = this.parseDateToString(days[0]);\n } else if (days.length > 0) {\n this.value = `${this.parseDateToString(days[0])} - ${this.parseDateToString(days[days.length - 1])}`;\n } else {\n this.value = '';\n }\n this.dateChange.emit(this.value);\n }}\n />\n </div>\n );\n } else {\n return this.helperText;\n }\n }\n\n render() {\n return (\n <Host>\n <div class=\"container\" style={this.styles}>\n <cura-input-text\n label={this.label}\n name={this.name}\n status={this.status}\n value={this.value}\n onFocus={() => this.showCalendar()}\n size={this.size}\n icon-name={this.iconName}\n placeholder={this.dateSettings.placeholder}\n mask-preset={this.dateSettings.mask}\n enable-selection-mode={true}\n onKeyUp={event => this.handleInputDates(event)}\n autocomplete=\"off\"\n onValueChange={event => this.handleChangeDates(event)}\n >\n {this.renderCalendarOrHelperText()}\n </cura-input-text>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -53,7 +53,7 @@ const CuraLabel = /*@__PURE__*/ proxyCustomElement(class CuraLabel extends HTMLE
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
render() {
|
|
56
|
-
return (h(Host, { key: '
|
|
56
|
+
return (h(Host, { key: 'ae255523f9f465d4e9f76dccf24e127a73d35b46', style: this.hostCSSProperties() }, h("p", { key: 'b517371dcedfcd256dff4fcaddfe40c946541513', style: this.styles, class: this.getClasses() }, h("slot", { key: '38ed6316d7882ba14a1e1710091be8d12158cd74' }))));
|
|
57
57
|
}
|
|
58
58
|
get host() { return this; }
|
|
59
59
|
static get watchers() { return {
|
|
@@ -23,7 +23,7 @@ const CuraLoaderBar = /*@__PURE__*/ proxyCustomElement(class CuraLoaderBar exten
|
|
|
23
23
|
this.setProgress();
|
|
24
24
|
}
|
|
25
25
|
render() {
|
|
26
|
-
return (h(Host, { key: '
|
|
26
|
+
return (h(Host, { key: 'af0397ee6a031081a84200da4863752ccbf937ce' }, h("div", { key: '5e054c2b571053bdb58b415a6ca642a8bc0385f3', id: "progress-bar", class: "progress-bar", style: this.styles }, h("span", { key: '2463789bf8737e13b6b5a49a1af4e51ce1637176', class: "progress-bar-fill" }))));
|
|
27
27
|
}
|
|
28
28
|
setColor() {
|
|
29
29
|
this.styles = Object.assign(Object.assign({}, this.styles), { '--neutral-base': window.CuraAPI.theme.colors.getColor(`neutral-base`, 0.2), '--color-base': window.CuraAPI.theme.colors.getColor(this.color) });
|
|
@@ -26,7 +26,7 @@ const CuraLoaderCircle = /*@__PURE__*/ proxyCustomElement(class CuraLoaderCircle
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
render() {
|
|
29
|
-
return (h(Host, { key: '
|
|
29
|
+
return (h(Host, { key: 'c7fb273559e35a8ac66c4a06e09150990dd62629', style: this.getStyles() }, h("svg", { key: '1ef6af84e79a0bf20c78d8f28129c890f990902f', viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: '37718a9e3271cce4d939b9ee4ab7123f39d7de39' }, h("circle", { key: '50284396589d4165a5e222b6e7aa7d7eba7d1f72', cx: "8", cy: "8", r: "7", stroke: "url(#paint0_linear_13485_11488)", "stroke-width": "2" }), h("path", { key: '1bd1557ecd739e50cacd67675d91aa56f63ec335', d: "M1 8C1 4.13401 4.11877 1 7.96596 1C9.53445 1 10.9819 1.52093 12.1462 2.4C12.8959 2.96601 13.5282 3.68049 14 4.5", "stroke-width": "2" })), h("defs", { key: '6c68b50e1cce6210827f55ade5f822c0398ebfae' }, h("linearGradient", { key: '9d8f1a4955b753070618e0998205a8b48a83976a', id: "paint0_linear_13485_11488", x1: "15.7", y1: "4.5", x2: "4.15", y2: "11.5", gradientUnits: "userSpaceOnUse" }, h("stop", { key: 'd81f6995a1de8007ede765a2f49d236f7fcff187' }), h("stop", { key: 'b88855e6b35f247fa1395c220e3c0ee76093a7d2', offset: "1" }))))));
|
|
30
30
|
}
|
|
31
31
|
static get style() { return CuraLoaderCircleStyle0; }
|
|
32
32
|
}, [1, "cura-loader-circle", {
|
|
@@ -21,7 +21,7 @@ const CuraPageTemplate$1 = /*@__PURE__*/ proxyCustomElement(class CuraPageTempla
|
|
|
21
21
|
return classes;
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: 'cc20723aa41b91ea1dc91ea638988b1758295194' }, h("div", { key: '77a47c8042fde17042614e9dfa451418f5599203', style: this.styles, class: "grid-template" }, h("div", { key: 'b6364534caa10c454c88cb0bee0cb15d5f5b3290', id: "sub-header" }, h("slot", { key: 'e9e8232ea90df3a7a9b41077c11b7471958b31ea', name: 'sub-header' })), h("div", { key: 'b5407cdf0d167f65a41c27b3056dffb8963f9494', id: "header" }, h("slot", { key: '75ca70a52852ba84507d836e20c3cd6e49b5ed7e', name: 'header' })), h("div", { key: 'b1a18551c7c91f0356a909d0187654af7cacfd9c', id: "pre-content" }, h("slot", { key: '46c5d27c42f0082115ed56b00ee5d9537a16b351', name: 'pre-content' })), h("div", { key: '9f9c30b4057d00cc026509eba99b8b066285f518', id: "content-container", class: this.getClasses() }, h("div", { key: '74c71d693d351e38183b501ab1ed955b1120bd13', id: "sidebar-left" }, h("slot", { key: 'f09fd413d695cb57cbdeba49192d0230dddb51ca', name: 'sidebar-left' })), h("div", { key: '60d8785cf429bbdc94132517707d672afa7cfca3', id: "content" }, h("slot", { key: 'd440f897831ff64fb3bed669728bf6d8c557037c', name: "content" }), h("slot", { key: '0e7fbe336f24608d80e7eda07869f58faf98c121' })), h("div", { key: 'e92ffc7632e10b98c25ea8f3dbe854bbdbd225a8', id: "sidebar-right" }, h("slot", { key: '9c9a8887643a1967df21c1d6625266ea119e828b', name: 'sidebar-right' }))), h("div", { key: '9ee23371a9d003db9ebb8b2f2d1803e71da01bd7', id: "post-body" }, h("slot", { key: '449fdc120956fd36f1fe71a7a5f2855a09baa9b3', name: 'post-body' })), h("div", { key: '31bc1a11a0152628a6bff3fee1b2cf739ef7cd82', id: "footer" }, h("slot", { key: '680ac49ea86a4945c13e52e8236e384d20a2867c', name: 'footer' })), h("div", { key: '1aebe595604aadc3b31e467d71532dd9d93301bf', id: "sub-footer" }, h("slot", { key: '58a2d0cebc85f73d09980b6daf8a04e7fceac133', name: 'sub-footer' })))));
|
|
25
25
|
}
|
|
26
26
|
get host() { return this; }
|
|
27
27
|
static get style() { return CuraPageTemplateStyle0; }
|
|
@@ -52,7 +52,7 @@ const CuraParagraph = /*@__PURE__*/ proxyCustomElement(class CuraParagraph exten
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
render() {
|
|
55
|
-
return (h(Host, { key: '
|
|
55
|
+
return (h(Host, { key: '0ee9f41b45e758b509a18ab8ff216482d9c83af4', style: this.hostCSSProperties() }, h("p", { key: '02edfbf600b0cb372e49ee8b6fc7192f19108997', style: this.styles, class: this.setsizeClass() }, h("slot", { key: '0b2bd3c94a190999cc8a8dec94b14aae2af2fa09' }))));
|
|
56
56
|
}
|
|
57
57
|
get host() { return this; }
|
|
58
58
|
static get watchers() { return {
|
|
@@ -131,7 +131,7 @@ const CuraRadio$1 = /*@__PURE__*/ proxyCustomElement(class CuraRadio extends HTM
|
|
|
131
131
|
return statusColors[this.status][type];
|
|
132
132
|
}
|
|
133
133
|
render() {
|
|
134
|
-
return (h(Host, { key: '
|
|
134
|
+
return (h(Host, { key: 'a0d89eeaf13690af56498ab584c22082b071b851' }, h("div", { key: '17a7ffae366d1942cdf8daccb0693434468040f8', class: this.getClasses(), style: this.styles }, h("div", { key: '2a03b1cc6eb6c26227bff90ec40f1f739e543613', class: "info" }, h("div", { key: '63a3f9a9f99504fc5f0e824a6398d502c2d7bec7', class: "label-wrapper" }, h("cura-label", { key: 'cddaf7347318cba1cd480352cde13321b44cc244', class: "label", size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && h("cura-paragraph", { key: 'b2f5f549427841feb97ba43e26930e62e7d8f432', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), h("cura-label", { key: '7d32540fd194b86224189d2ba3da8da4cae9d2a9', color: this.assignColor('message'), size: "xsmall", class: "message" }, h("slot", { key: 'c4e8fa9a1fb18040da0038aa5ea7e6bcb0ee17bc' }))), h("input", { key: 'eaebe407c25af0bc72df251451a652fc6376ef9a', type: "radio", class: `radio ${this.size.toLocaleLowerCase()}`, name: this.name, value: this.value, required: this.required, tabIndex: this.ontabindex, disabled: this.disabled, checked: this.checked, onClick: this.handleClick }))));
|
|
135
135
|
}
|
|
136
136
|
static get formAssociated() { return true; }
|
|
137
137
|
get host() { return this; }
|
|
@@ -42,7 +42,7 @@ const CuraSelectOption = /*@__PURE__*/ proxyCustomElement(class CuraSelectOption
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
render() {
|
|
45
|
-
return (h(Host, { key: '
|
|
45
|
+
return (h(Host, { key: 'd65a51c56c05c15db545fa9dec1da8849e45235d', slot: "option" }, h("div", { key: '892175c91b317d015f13f9d5d9bc0a956272a49f', class: this.getClasses(), style: this.styles }, h("cura-label", { key: 'aaabd66fc3e8e6beb0d840e4b12dbcfb3282e392', color: `${this.selected ? 'primary-base' : 'neutral-black'}`, size: this.getSize('label'), "margin-block": "0" }, h("slot", { key: 'a1570b98b56147b8cf8d0b01f504a19efbdf4749' })), this.selected && h("cura-icon", { key: 'fcd06691f5d18e460b14e5cd7ae99c06fec26e3f', name: 'check', size: this.getSize('icon'), color: "primary-base" }))));
|
|
46
46
|
}
|
|
47
47
|
get host() { return this; }
|
|
48
48
|
static get watchers() { return {
|
|
@@ -276,13 +276,13 @@ const CuraSelect = /*@__PURE__*/ proxyCustomElement(class CuraSelect extends HTM
|
|
|
276
276
|
return (h("cura-icon", { class: 'feedback-icon', name: icon, iconset: 'default', size: this.size === 'large' ? 20 : 16, color: this.getColor('icon'), style: this.styles }));
|
|
277
277
|
}
|
|
278
278
|
render() {
|
|
279
|
-
return (h(Host, { key: '
|
|
279
|
+
return (h(Host, { key: '1f9549c90dbc1c5a958488fdaa7e6b320730691a', style: this.styles }, h("div", { key: '52f93a983269e95bf4e19b590c47a8de472f9cb1', class: this.getClasses(), onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), onClick: this.handleClick }, this.label && (h("cura-label", { key: '1fbbdb175324020e975e515c07a7eb85e593eb19', class: 'label', weight: 'bold', size: this.size === 'large' ? 'small' : 'xsmall', color: this.getColor('label') }, this.label, " ", this.required && h("span", { key: 'b76d8b6fc6399af17f8345d097f70e29ef9a549e', class: 'required' }, "* "))), h("div", { key: '0f1484f9debd047eb99760adb2c2da6d124c39f0', class: {
|
|
280
280
|
'cura-input-field': true,
|
|
281
281
|
'open': this.isOpen
|
|
282
|
-
} }, this.renderIcon(), h("input", { key: '
|
|
282
|
+
} }, this.renderIcon(), h("input", { key: '2b10751ad085669523eeaba20a9d8736b4332dc0', type: "text", autocomplete: 'off', onFocus: () => (this.isFocused = true), onBlur: () => (this.isFocused = false), onKeyDown: this.handleKeyNavigation, "aria-required": String(this.required), "aria-disabled": String(this.disabled), "aria-invalid": String(this.status === 'error'), onInput: this.handleInputChange, style: this.styles, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.textInput, readonly: this.searchBehavior ? null : true }), h("cura-icon", { key: '965687e4884ab2da4de009ccee8a2607a80ca0d3', name: this.isOpen ? 'up' : 'down', class: "up-down-icon", color: this.disabled ? 'neutral-dark' : 'primary-base', size: 16, iconset: 'default' })), h("cura-label", { key: 'ec844637fe1b96ac3719a53fc4753a66dde5710f', class: "helper-text", size: 'xsmall', color: this.getColor('text'), weight: this.mode === 'transparent' ? 'bold' : 'regular' }, h("slot", { key: 'fdc615752aad7bc80ba97a380c4086a3e81fad48' })), this.isOpen && (h("div", { key: 'cac6207d71dabbf2ad7d6dd0f5a152d23f64e554', class: {
|
|
283
283
|
'menu': true,
|
|
284
284
|
'open': this.isOpen
|
|
285
|
-
} }, h("slot", { key: '
|
|
285
|
+
} }, h("slot", { key: '3414977f685fd5f7692e1b5fbcf8b8af11992fba', name: 'option' }))))));
|
|
286
286
|
}
|
|
287
287
|
static get formAssociated() { return true; }
|
|
288
288
|
get host() { return this; }
|
|
@@ -102,7 +102,7 @@ const CuraSwitch$1 = /*@__PURE__*/ proxyCustomElement(class CuraSwitch extends H
|
|
|
102
102
|
return classes;
|
|
103
103
|
}
|
|
104
104
|
render() {
|
|
105
|
-
return (h(Host, { key: '
|
|
105
|
+
return (h(Host, { key: '019642743001393249cba0ac937b861a0b309af3' }, h("div", { key: '32d6358af066b24b60fb2967891b0eda03027a25', class: this.getClasses(), style: this.styles }, h("div", { key: 'c29681689cbf04ee89afa793dd84f1a3c1198fb7', class: "info" }, h("cura-label", { key: '0865c7e0c45843769046039981382e4f7a9cf8cf', style: { textAlign: this.position === 'right' ? 'right' : 'left' }, class: "label", weight: "bold", size: this.size === 'large' ? 'medium' : 'xsmall', lineHeight: "125%", color: this.assignColor('neutral-white', 'neutral-black') }, this.label), h("cura-label", { key: 'b1fff87c188c2a1f306630a692c254dcacc5b03b', style: { textAlign: this.position === 'right' ? 'right' : 'left' }, color: this.assignColor('primary-lighter', 'neutral-dark'), size: "xsmall", class: "message" }, h("slot", { key: '553757a5022374bd10af67f4a0c449511203e2e6' }))), h("div", { key: 'a8babf17cdd9c8bb95225fce8501015859122ec6', onClick: this.toggleSwitch, class: "control" }, h("div", { key: '4828791117512af2526ed94b5981a0dab04b3e5c', class: `track ${this.size.toLowerCase()}` }, h("div", { key: '30a712271bcee777e9a3c79d04a2038db5b84869', class: `thumb ${this.size.toLowerCase()}`, tabIndex: this.ontabindex }))))));
|
|
106
106
|
}
|
|
107
107
|
static get formAssociated() { return true; }
|
|
108
108
|
static get watchers() { return {
|
|
@@ -33,7 +33,7 @@ const CuraToast$1 = /*@__PURE__*/ proxyCustomElement(class CuraToast extends HTM
|
|
|
33
33
|
this.setStyle();
|
|
34
34
|
}
|
|
35
35
|
render() {
|
|
36
|
-
return (h(Host, { key: '
|
|
36
|
+
return (h(Host, { key: 'eb867953a8c56ae385b1226686cbe1b1e9df4318' }, h("div", { key: 'c901632a6fb414c981b5c149fdd7081306ae1130', class: this.getClasses(), style: this.styles }, h("cura-icon", { key: '98c9a49501c71ee60c6ae1d783bba11d5bdce999', class: "default-icon", name: this.getNameIcon(), size: 16, color: `${this.type}-dark` }), h("div", { key: '19b2e0bd0d816e94f3b9d1f113f4b833e770cee3', class: "content" }, h("cura-heading", { key: '17ed67e5b531b45b94f8dbc7d65675f7a57308f9', level: 4, size: "xsmall", color: `${this.type}-dark`, weight: "bold", "margin-block": "0" }, this.label), h("cura-paragraph", { key: 'dd90e612d924dff9b3e9896dc29cef2541ae51af', color: `${this.type}-darker`, size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, h("slot", { key: '33cd9c1dd10ae6d3ebd857fab5c70ca7151f8a1b' })), h("slot", { key: '12d18bd482b957cdc5ee7a4fab20bdffe6bc647d', name: "actions" })), this.closeButton && h("cura-icon", { key: '3a83cdd43c6c11587013111c29673f916509b165', class: "close-icon", name: "close", size: 16, color: "error-dark", onClick: this.handleClose }), this.loader && !!this.autoCloseDelay && h("cura-loader-bar", { key: '13ec00fd7146119e9eab81ed6d52b1020d1eb1e8', color: `${this.type}-base`, progress: this.progress }))));
|
|
37
37
|
}
|
|
38
38
|
componentDidLoad() {
|
|
39
39
|
this.openContainer();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface CuraTooltip extends Components.CuraTooltip, HTMLElement {}
|
|
4
|
+
export const CuraTooltip: {
|
|
5
|
+
prototype: CuraTooltip;
|
|
6
|
+
new (): CuraTooltip;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|