@rededor/cura 0.5.4 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/iconset-default-list.ts +1 -1
- package/dist/assets/icons/iconset-default-tmp.svg +8 -0
- package/dist/assets/icons/iconset-default.svg +1 -1
- package/dist/cjs/app-globals-bcffd819.js +511 -0
- package/dist/cjs/app-globals-bcffd819.js.map +1 -0
- package/dist/cjs/cura-accordion_9.cjs.entry.js +544 -0
- package/dist/cjs/cura-accordion_9.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-alert.cjs.entry.js +57 -55
- package/dist/cjs/cura-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-avatar.cjs.entry.js +68 -0
- package/dist/cjs/cura-avatar.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-button-outline.cjs.entry.js +102 -71
- package/dist/cjs/cura-button-outline.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-select.cjs.entry.js +91 -85
- package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-transparent_2.cjs.entry.js +4055 -0
- package/dist/cjs/cura-button-transparent_2.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-calendar.cjs.entry.js +3913 -0
- package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-card.cjs.entry.js +53 -0
- package/dist/cjs/cura-card.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-checkbox.cjs.entry.js +168 -131
- package/dist/cjs/cura-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-display.cjs.entry.js +63 -62
- package/dist/cjs/cura-display.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js +22 -0
- package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-dropdown-search-option.cjs.entry.js +55 -0
- package/dist/cjs/cura-dropdown-search-option.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-dropdown-search.cjs.entry.js +209 -0
- package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-forms.definitions-c164f1b8.js +20 -0
- package/dist/cjs/cura-forms.definitions-c164f1b8.js.map +1 -0
- package/dist/cjs/cura-icon.definitions-8d714f6a.js +21 -0
- package/dist/cjs/cura-icon.definitions-8d714f6a.js.map +1 -0
- package/dist/cjs/cura-icons-view.cjs.entry.js +24 -23
- package/dist/cjs/cura-icons-view.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-radio.cjs.entry.js +142 -103
- package/dist/cjs/cura-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-select_2.cjs.entry.js +325 -0
- package/dist/cjs/cura-select_2.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-switch.cjs.entry.js +113 -78
- package/dist/cjs/cura-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/cura.cjs.js +13 -22
- package/dist/cjs/cura.cjs.js.map +1 -1
- package/dist/cjs/index-5b63ff7a.js +1529 -0
- package/dist/cjs/index-5b63ff7a.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +6 -31
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/collection/api/cura-api.js +30 -30
- package/dist/collection/api/cura-api.js.map +1 -1
- package/dist/collection/api/cura-api.type.js +2 -2
- package/dist/collection/api/cura-api.type.js.map +1 -1
- package/dist/collection/api/modules/cura-theme-breakpoints-module.js +10 -10
- package/dist/collection/api/modules/cura-theme-breakpoints-module.js.map +1 -1
- package/dist/collection/api/modules/cura-theme-colors-module.js +72 -72
- package/dist/collection/api/modules/cura-theme-colors-module.js.map +1 -1
- package/dist/collection/api/modules/cura-theme-fonts-module.js +28 -28
- package/dist/collection/api/modules/cura-theme-fonts-module.js.map +1 -1
- package/dist/collection/api/modules/cura-theme-module.js +66 -66
- package/dist/collection/api/modules/cura-theme-module.js.map +1 -1
- package/dist/collection/api/modules/cura-theme-spacing-module.js +9 -9
- package/dist/collection/api/modules/cura-theme-spacing-module.js.map +1 -1
- package/dist/collection/api/theme-presets/static.js +63 -63
- package/dist/collection/api/theme-presets/static.js.map +1 -1
- package/dist/collection/api/theme-presets/theme-default.js +41 -41
- package/dist/collection/api/theme-presets/theme-default.js.map +1 -1
- package/dist/collection/api/theme-presets/theme-legacy-default.js +24 -24
- package/dist/collection/api/theme-presets/theme-legacy-default.js.map +1 -1
- package/dist/collection/api/theme-presets/theme-maternity.js +38 -38
- package/dist/collection/api/theme-presets/theme-maternity.js.map +1 -1
- package/dist/collection/api/theme-presets/theme-oncology.js +46 -46
- package/dist/collection/api/theme-presets/theme-oncology.js.map +1 -1
- package/dist/collection/api/theme-presets/theme-presets.js +8 -8
- package/dist/collection/api/theme-presets/theme-presets.js.map +1 -1
- 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 +8 -0
- package/dist/collection/assets/icons/iconset-default.svg +1 -1
- package/dist/collection/assets/images/avatar/doctor-default.svg +8 -0
- package/dist/collection/assets/images/avatar/dora-default.svg +5 -0
- package/dist/collection/assets/images/avatar/patient-default.svg +12 -0
- package/dist/collection/assets/images/avatar/unit-default.svg +9 -0
- package/dist/collection/assets/images/logoCura.svg +15 -0
- package/dist/collection/assets-raw/icons/default/contacts.svg +3 -0
- package/dist/collection/assets-raw/icons/default/scheduleCancel.svg +3 -0
- package/dist/collection/collection-manifest.json +29 -21
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.js +267 -267
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.js.map +1 -1
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js +127 -127
- 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.js +196 -196
- package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js.map +1 -1
- package/dist/collection/components/buttons/cura-button/cura-button.css +112 -46
- package/dist/collection/components/buttons/cura-button/cura-button.js +368 -306
- package/dist/collection/components/buttons/cura-button/cura-button.js.map +1 -1
- package/dist/collection/components/buttons/cura-button/cura-button.stories.js +184 -159
- 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 +37 -64
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +374 -306
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js +184 -159
- 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 +36 -23
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +265 -260
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.css +32 -50
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +339 -306
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js +172 -159
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js.map +1 -1
- package/dist/collection/components/cura-alert/cura-alert.js +182 -164
- package/dist/collection/components/cura-alert/cura-alert.js.map +1 -1
- package/dist/collection/components/cura-alert/cura-alert.stories.js +90 -77
- package/dist/collection/components/cura-alert/cura-alert.stories.js.map +1 -1
- package/dist/collection/components/cura-avatar/cura-avatar.css +24 -0
- package/dist/collection/components/cura-avatar/cura-avatar.definitions.js +7 -0
- package/dist/collection/components/cura-avatar/cura-avatar.definitions.js.map +1 -0
- package/dist/collection/components/cura-avatar/cura-avatar.js +231 -0
- package/dist/collection/components/cura-avatar/cura-avatar.js.map +1 -0
- package/dist/collection/components/cura-avatar/cura-avatar.stories.js +198 -0
- package/dist/collection/components/cura-avatar/cura-avatar.stories.js.map +1 -0
- package/dist/collection/components/cura-calendar/cura-calendar.css +181 -0
- package/dist/collection/components/cura-calendar/cura-calendar.js +681 -0
- package/dist/collection/components/cura-calendar/cura-calendar.js.map +1 -0
- package/dist/collection/components/cura-calendar/cura-calendar.stories.js +126 -0
- package/dist/collection/components/cura-calendar/cura-calendar.stories.js.map +1 -0
- package/dist/collection/components/cura-card/cura-card.css +175 -0
- package/dist/collection/components/cura-card/cura-card.js +201 -0
- package/dist/collection/components/cura-card/cura-card.js.map +1 -0
- package/dist/collection/components/cura-card/cura-card.stories.js +127 -0
- package/dist/collection/components/cura-card/cura-card.stories.js.map +1 -0
- package/dist/collection/components/cura-icon/cura-icon.definitions.js +11 -11
- package/dist/collection/components/cura-icon/cura-icon.definitions.js.map +1 -1
- package/dist/collection/components/cura-icon/cura-icon.js +151 -151
- package/dist/collection/components/cura-icon/cura-icon.js.map +1 -1
- package/dist/collection/components/cura-icon/cura-icon.stories.js +60 -60
- package/dist/collection/components/cura-icon/cura-icon.stories.js.map +1 -1
- package/dist/collection/components/cura-icons-view/cura-icons-view.js +37 -37
- package/dist/collection/components/cura-icons-view/cura-icons-view.js.map +1 -1
- package/dist/collection/components/cura-icons-view/cura-icons-view.stories.js +7 -7
- package/dist/collection/components/cura-icons-view/cura-icons-view.stories.js.map +1 -1
- package/dist/collection/components/cura-page-template/cura-page-template.js +52 -52
- package/dist/collection/components/cura-page-template/cura-page-template.js.map +1 -1
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.css +19 -11
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +457 -427
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js.map +1 -1
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.stories.js +170 -170
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.css +50 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js +136 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js.map +1 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.js +56 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.css +10 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js +19 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js.map +1 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.css +149 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +384 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.stories.js +181 -0
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-forms.definitions.js +12 -12
- package/dist/collection/components/forms/cura-forms.definitions.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/cura-input-text.css +849 -139
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js +732 -641
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js +217 -196
- package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js +40 -40
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js.map +1 -1
- package/dist/collection/components/forms/cura-label/cura-label.js +187 -187
- package/dist/collection/components/forms/cura-label/cura-label.js.map +1 -1
- package/dist/collection/components/forms/cura-label/cura-label.stories.js +108 -108
- package/dist/collection/components/forms/cura-label/cura-label.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-radio/cura-radio.js +395 -363
- package/dist/collection/components/forms/cura-radio/cura-radio.js.map +1 -1
- package/dist/collection/components/forms/cura-radio/cura-radio.stories.js +150 -150
- package/dist/collection/components/forms/cura-radio/cura-radio.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-select/cura-select.css +519 -0
- package/dist/collection/components/forms/cura-select/cura-select.js +444 -0
- package/dist/collection/components/forms/cura-select/cura-select.js.map +1 -0
- package/dist/collection/components/forms/cura-select/cura-select.stories.js +144 -0
- package/dist/collection/components/forms/cura-select/cura-select.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-select-options/cura-select-option.css +28 -0
- package/dist/collection/components/forms/cura-select-options/cura-select-option.js +138 -0
- package/dist/collection/components/forms/cura-select-options/cura-select-option.js.map +1 -0
- package/dist/collection/components/forms/cura-switch/cura-switch.css +88 -24
- package/dist/collection/components/forms/cura-switch/cura-switch.js +292 -264
- package/dist/collection/components/forms/cura-switch/cura-switch.js.map +1 -1
- package/dist/collection/components/forms/cura-switch/cura-switch.stories.js +115 -115
- package/dist/collection/components/forms/cura-switch/cura-switch.stories.js.map +1 -1
- package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +74 -74
- package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js.map +1 -1
- package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.stories.js +41 -41
- package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.stories.js.map +1 -1
- package/dist/collection/components/text/cura-display/cura-display.js +174 -174
- package/dist/collection/components/text/cura-display/cura-display.js.map +1 -1
- package/dist/collection/components/text/cura-display/cura-display.stories.js +97 -97
- package/dist/collection/components/text/cura-display/cura-display.stories.js.map +1 -1
- package/dist/collection/components/text/cura-heading/cura-heading.js +220 -220
- package/dist/collection/components/text/cura-heading/cura-heading.js.map +1 -1
- package/dist/collection/components/text/cura-heading/cura-heading.stories.js +117 -117
- package/dist/collection/components/text/cura-heading/cura-heading.stories.js.map +1 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +168 -168
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js.map +1 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js +98 -98
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js.map +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/rededor-cura-start.js +7 -7
- package/dist/collection/rededor-cura-start.js.map +1 -1
- package/dist/collection/utils/utils.js +11 -11
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/cura-accordion-item.d.ts +2 -2
- package/dist/components/cura-accordion-item.js +62 -61
- package/dist/components/cura-accordion-item.js.map +1 -1
- package/dist/components/cura-accordion.d.ts +2 -2
- package/dist/components/cura-accordion.js +108 -104
- package/dist/components/cura-accordion.js.map +1 -1
- package/dist/components/cura-alert.d.ts +2 -2
- package/dist/components/cura-alert.js +93 -88
- package/dist/components/cura-alert.js.map +1 -1
- package/dist/components/cura-avatar.d.ts +11 -0
- package/dist/components/cura-avatar.js +95 -0
- package/dist/components/cura-avatar.js.map +1 -0
- package/dist/components/cura-button-outline.d.ts +2 -2
- package/dist/components/cura-button-outline.js +147 -109
- package/dist/components/cura-button-outline.js.map +1 -1
- package/dist/components/cura-button-select.d.ts +2 -2
- package/dist/components/cura-button-select.js +129 -113
- package/dist/components/cura-button-select.js.map +1 -1
- package/dist/components/cura-button-transparent.d.ts +2 -2
- package/dist/components/cura-button-transparent.js +1 -116
- package/dist/components/cura-button-transparent.js.map +1 -1
- package/dist/components/cura-button-transparent2.js +144 -0
- package/dist/components/cura-button-transparent2.js.map +1 -0
- package/dist/components/cura-button.d.ts +2 -2
- package/dist/components/cura-button.js +145 -109
- package/dist/components/cura-button.js.map +1 -1
- package/dist/components/cura-calendar.d.ts +11 -0
- package/dist/components/cura-calendar.js +3969 -0
- package/dist/components/cura-calendar.js.map +1 -0
- package/dist/components/cura-card.d.ts +11 -0
- package/dist/components/cura-card.js +75 -0
- package/dist/components/cura-card.js.map +1 -0
- package/dist/components/cura-checkbox.d.ts +2 -2
- package/dist/components/cura-checkbox.js +210 -174
- package/dist/components/cura-checkbox.js.map +1 -1
- package/dist/components/cura-display.d.ts +2 -2
- package/dist/components/cura-display.js +85 -81
- package/dist/components/cura-display.js.map +1 -1
- package/dist/components/cura-dropdown-search-option-title.d.ts +11 -0
- package/dist/components/cura-dropdown-search-option-title.js +42 -0
- package/dist/components/cura-dropdown-search-option-title.js.map +1 -0
- package/dist/components/cura-dropdown-search-option.d.ts +11 -0
- package/dist/components/cura-dropdown-search-option.js +82 -0
- package/dist/components/cura-dropdown-search-option.js.map +1 -0
- package/dist/components/cura-dropdown-search.d.ts +11 -0
- package/dist/components/cura-dropdown-search.js +272 -0
- package/dist/components/cura-dropdown-search.js.map +1 -0
- package/dist/components/cura-forms.definitions.js +12 -12
- package/dist/components/cura-forms.definitions.js.map +1 -1
- package/dist/components/cura-heading.d.ts +2 -2
- package/dist/components/cura-heading2.js +97 -93
- package/dist/components/cura-heading2.js.map +1 -1
- package/dist/components/cura-icon.d.ts +2 -2
- package/dist/components/cura-icon2.js +74 -69
- package/dist/components/cura-icon2.js.map +1 -1
- package/dist/components/cura-icons-view.d.ts +2 -2
- package/dist/components/cura-icons-view.js +57 -56
- package/dist/components/cura-icons-view.js.map +1 -1
- package/dist/components/cura-input-text.d.ts +2 -2
- package/dist/components/cura-input-text.js +1 -3954
- package/dist/components/cura-input-text.js.map +1 -1
- package/dist/{cjs/cura-input-text.cjs.entry.js → components/cura-input-text2.js} +393 -283
- package/dist/components/cura-input-text2.js.map +1 -0
- package/dist/components/cura-label.d.ts +2 -2
- package/dist/components/cura-label2.js +81 -77
- package/dist/components/cura-label2.js.map +1 -1
- package/dist/components/cura-loader-circle.d.ts +2 -2
- package/dist/components/cura-loader-circle2.js +41 -40
- package/dist/components/cura-loader-circle2.js.map +1 -1
- package/dist/components/cura-page-template.d.ts +2 -2
- package/dist/components/cura-page-template.js +36 -35
- package/dist/components/cura-page-template.js.map +1 -1
- package/dist/components/cura-paragraph.d.ts +2 -2
- package/dist/components/cura-paragraph2.js +79 -75
- package/dist/components/cura-paragraph2.js.map +1 -1
- package/dist/components/cura-radio.d.ts +2 -2
- package/dist/components/cura-radio.js +176 -139
- package/dist/components/cura-radio.js.map +1 -1
- package/dist/components/cura-select-option.d.ts +11 -0
- package/dist/components/cura-select-option.js +8 -0
- package/dist/components/cura-select-option.js.map +1 -0
- package/dist/components/cura-select-option2.js +87 -0
- package/dist/components/cura-select-option2.js.map +1 -0
- package/dist/components/cura-select.d.ts +11 -0
- package/dist/components/cura-select.js +8 -0
- package/dist/components/cura-select.js.map +1 -0
- package/dist/components/cura-select2.js +308 -0
- package/dist/components/cura-select2.js.map +1 -0
- package/dist/components/cura-switch.d.ts +2 -2
- package/dist/components/cura-switch.js +138 -105
- package/dist/components/cura-switch.js.map +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +482 -466
- 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/index.esm.js.map +1 -1
- package/dist/cura/p-12d75346.entry.js +2 -0
- package/dist/cura/p-12d75346.entry.js.map +1 -0
- package/dist/cura/p-2176f253.entry.js +2 -0
- package/dist/cura/p-2176f253.entry.js.map +1 -0
- package/dist/cura/p-22292bfa.entry.js +2 -0
- package/dist/cura/p-22292bfa.entry.js.map +1 -0
- package/dist/cura/p-2a8be665.entry.js +2 -0
- package/dist/cura/p-2a8be665.entry.js.map +1 -0
- package/dist/cura/p-2d70b515.entry.js +2 -0
- package/dist/cura/p-2d70b515.entry.js.map +1 -0
- package/dist/cura/p-3c2ebc3a.entry.js +2 -0
- package/dist/cura/p-3c2ebc3a.entry.js.map +1 -0
- package/dist/cura/p-45a0a5e8.entry.js +2 -0
- package/dist/cura/p-45a0a5e8.entry.js.map +1 -0
- package/dist/cura/p-586bbe43.js +3 -0
- package/dist/cura/p-586bbe43.js.map +1 -0
- package/dist/cura/p-5d8e3ee3.entry.js +2 -0
- package/dist/cura/p-5d8e3ee3.entry.js.map +1 -0
- package/dist/cura/{p-f8fffdc1.js → p-70c369b1.js} +1 -1
- package/dist/cura/p-70c369b1.js.map +1 -0
- package/dist/cura/p-7c41f034.entry.js +2 -0
- package/dist/cura/p-7c41f034.entry.js.map +1 -0
- package/dist/cura/p-8cecf9e5.entry.js +2 -0
- package/dist/cura/p-8cecf9e5.entry.js.map +1 -0
- package/dist/cura/p-94b5c3b3.entry.js +2 -0
- package/dist/cura/p-94b5c3b3.entry.js.map +1 -0
- package/dist/cura/p-a5456007.entry.js +2 -0
- package/dist/cura/p-a5456007.entry.js.map +1 -0
- package/dist/cura/{p-c791725b.js → p-a7221f0c.js} +1 -1
- package/dist/{esm-es5/cura-icon.definitions-a63d1862.js.map → cura/p-a7221f0c.js.map} +1 -1
- package/dist/cura/p-cd757625.entry.js +2 -0
- package/dist/cura/p-cd757625.entry.js.map +1 -0
- package/dist/cura/p-de870781.entry.js +2 -0
- package/dist/cura/p-de870781.entry.js.map +1 -0
- package/dist/cura/p-e661bcca.entry.js +2 -0
- package/dist/cura/p-e661bcca.entry.js.map +1 -0
- package/dist/cura/p-ee7388a5.entry.js +2 -0
- package/dist/cura/p-ee7388a5.entry.js.map +1 -0
- package/dist/cura/{p-3688570d.js → p-f9b8f665.js} +1 -1
- package/dist/{esm-es5/cura-forms.definitions-0f774253.js.map → cura/p-f9b8f665.js.map} +1 -1
- package/dist/cura/p-fb9bece3.entry.js +2 -0
- package/dist/cura/p-fb9bece3.entry.js.map +1 -0
- package/dist/esm/app-globals-f2da2b14.js +509 -0
- package/dist/esm/app-globals-f2da2b14.js.map +1 -0
- package/dist/esm/cura-accordion_9.entry.js +532 -0
- package/dist/esm/cura-accordion_9.entry.js.map +1 -0
- package/dist/esm/cura-alert.entry.js +57 -55
- package/dist/esm/cura-alert.entry.js.map +1 -1
- package/dist/esm/cura-avatar.entry.js +64 -0
- package/dist/esm/cura-avatar.entry.js.map +1 -0
- package/dist/esm/cura-button-outline.entry.js +102 -71
- package/dist/esm/cura-button-outline.entry.js.map +1 -1
- package/dist/esm/cura-button-select.entry.js +91 -85
- package/dist/esm/cura-button-select.entry.js.map +1 -1
- package/dist/esm/{cura-input-text.entry.js → cura-button-transparent_2.entry.js} +423 -276
- package/dist/esm/cura-button-transparent_2.entry.js.map +1 -0
- package/dist/esm/cura-calendar.entry.js +3909 -0
- package/dist/esm/cura-calendar.entry.js.map +1 -0
- package/dist/esm/cura-card.entry.js +49 -0
- package/dist/esm/cura-card.entry.js.map +1 -0
- package/dist/esm/cura-checkbox.entry.js +168 -131
- package/dist/esm/cura-checkbox.entry.js.map +1 -1
- package/dist/esm/cura-display.entry.js +63 -62
- package/dist/esm/cura-display.entry.js.map +1 -1
- package/dist/esm/cura-dropdown-search-option-title.entry.js +18 -0
- package/dist/esm/cura-dropdown-search-option-title.entry.js.map +1 -0
- package/dist/esm/cura-dropdown-search-option.entry.js +51 -0
- package/dist/esm/cura-dropdown-search-option.entry.js.map +1 -0
- package/dist/esm/cura-dropdown-search.entry.js +205 -0
- package/dist/esm/cura-dropdown-search.entry.js.map +1 -0
- package/dist/esm/cura-forms.definitions-2f963167.js +18 -0
- package/dist/esm/cura-forms.definitions-2f963167.js.map +1 -0
- package/dist/esm/cura-icon.definitions-aaa4e80f.js +18 -0
- package/dist/esm/cura-icon.definitions-aaa4e80f.js.map +1 -0
- package/dist/esm/cura-icons-view.entry.js +24 -23
- package/dist/esm/cura-icons-view.entry.js.map +1 -1
- package/dist/esm/cura-radio.entry.js +142 -103
- package/dist/esm/cura-radio.entry.js.map +1 -1
- package/dist/esm/cura-select_2.entry.js +320 -0
- package/dist/esm/cura-select_2.entry.js.map +1 -0
- package/dist/esm/cura-switch.entry.js +113 -78
- package/dist/esm/cura-switch.entry.js.map +1 -1
- package/dist/esm/cura.js +14 -23
- package/dist/esm/cura.js.map +1 -1
- package/dist/esm/index-b6c443d5.js +1500 -0
- package/dist/esm/index-b6c443d5.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +8 -33
- package/dist/esm/loader.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/loader/cdn.js +1 -3
- package/dist/loader/index.cjs.js +1 -3
- package/dist/loader/index.d.ts +4 -1
- package/dist/loader/index.es2017.js +1 -3
- package/dist/loader/index.js +1 -3
- package/dist/types/api/cura-api.d.ts +3 -3
- package/dist/types/api/cura-api.type.d.ts +44 -44
- package/dist/types/api/modules/cura-theme-breakpoints-module.d.ts +3 -3
- package/dist/types/api/modules/cura-theme-colors-module.d.ts +46 -46
- package/dist/types/api/modules/cura-theme-fonts-module.d.ts +22 -22
- package/dist/types/api/modules/cura-theme-module.d.ts +25 -25
- package/dist/types/api/modules/cura-theme-spacing-module.d.ts +4 -4
- package/dist/types/api/theme-presets/static.d.ts +62 -62
- package/dist/types/api/theme-presets/theme-default.d.ts +38 -38
- package/dist/types/api/theme-presets/theme-legacy-default.d.ts +38 -38
- package/dist/types/api/theme-presets/theme-maternity.d.ts +38 -38
- package/dist/types/api/theme-presets/theme-oncology.d.ts +45 -45
- package/dist/types/api/theme-presets/theme-presets.d.ts +175 -175
- package/dist/types/components/accordion/cura-accordion/cura-accordion.d.ts +37 -37
- package/dist/types/components/accordion/cura-accordion/cura-accordion.stories.d.ts +140 -140
- package/dist/types/components/accordion/cura-accordion-item/cura-accordion-item.d.ts +27 -27
- package/dist/types/components/buttons/cura-button/cura-button.d.ts +70 -59
- package/dist/types/components/buttons/cura-button/cura-button.stories.d.ts +184 -155
- package/dist/types/components/buttons/cura-button-outline/cura-button-outline.d.ts +70 -59
- package/dist/types/components/buttons/cura-button-outline/cura-button-outline.stories.d.ts +184 -155
- package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +48 -47
- package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.d.ts +65 -59
- package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.stories.d.ts +169 -155
- package/dist/types/components/cura-alert/cura-alert.d.ts +14 -13
- package/dist/types/components/cura-alert/cura-alert.stories.d.ts +85 -70
- package/dist/types/components/cura-avatar/cura-avatar.d.ts +24 -0
- package/dist/types/components/cura-avatar/cura-avatar.definitions.d.ts +14 -0
- package/dist/types/components/cura-avatar/cura-avatar.stories.d.ts +167 -0
- package/dist/types/components/cura-calendar/cura-calendar.d.ts +323 -0
- package/dist/types/components/cura-calendar/cura-calendar.stories.d.ts +128 -0
- package/dist/types/components/cura-card/cura-card.d.ts +48 -0
- package/dist/types/components/cura-card/cura-card.stories.d.ts +98 -0
- package/dist/types/components/cura-icon/cura-icon.d.ts +12 -12
- package/dist/types/components/cura-icon/cura-icon.definitions.d.ts +44 -44
- package/dist/types/components/cura-icon/cura-icon.stories.d.ts +56 -56
- package/dist/types/components/cura-icons-view/cura-icons-view.d.ts +6 -6
- package/dist/types/components/cura-icons-view/cura-icons-view.stories.d.ts +3 -3
- package/dist/types/components/cura-page-template/cura-page-template.d.ts +6 -6
- package/dist/types/components/forms/cura-checkbox/cura-checkbox.d.ts +111 -95
- package/dist/types/components/forms/cura-checkbox/cura-checkbox.stories.d.ts +193 -193
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.d.ts +27 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.d.ts +44 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.d.ts +3 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +103 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.stories.d.ts +112 -0
- package/dist/types/components/forms/cura-forms.definitions.d.ts +12 -12
- package/dist/types/components/forms/cura-input-text/cura-input-text.d.ts +169 -132
- package/dist/types/components/forms/cura-input-text/cura-input-text.stories.d.ts +241 -218
- package/dist/types/components/forms/cura-input-text/mask-presets/input-mask-presets.d.ts +1 -2
- package/dist/types/components/forms/cura-label/cura-label.d.ts +52 -52
- package/dist/types/components/forms/cura-label/cura-label.stories.d.ts +112 -112
- package/dist/types/components/forms/cura-radio/cura-radio.d.ts +96 -74
- package/dist/types/components/forms/cura-radio/cura-radio.stories.d.ts +162 -162
- package/dist/types/components/forms/cura-select/cura-select.d.ts +176 -0
- package/dist/types/components/forms/cura-select/cura-select.stories.d.ts +156 -0
- package/dist/types/components/forms/cura-select-options/cura-select-option.d.ts +17 -0
- package/dist/types/components/forms/cura-switch/cura-switch.d.ts +78 -57
- package/dist/types/components/forms/cura-switch/cura-switch.stories.d.ts +121 -121
- package/dist/types/components/loaders/cura-loader-circle/cura-loader-circle.d.ts +21 -21
- package/dist/types/components/loaders/cura-loader-circle/cura-loader-circle.stories.d.ts +35 -35
- package/dist/types/components/text/cura-display/cura-display.d.ts +47 -47
- package/dist/types/components/text/cura-display/cura-display.stories.d.ts +101 -101
- package/dist/types/components/text/cura-heading/cura-heading.d.ts +58 -58
- package/dist/types/components/text/cura-heading/cura-heading.stories.d.ts +127 -127
- package/dist/types/components/text/cura-paragraph/cura-paragraph.d.ts +47 -47
- package/dist/types/components/text/cura-paragraph/cura-paragraph.stories.d.ts +99 -99
- package/dist/types/components.d.ts +689 -13
- package/dist/types/index.d.ts +4 -4
- package/dist/types/rededor-cura-start.d.ts +4 -4
- package/dist/types/stencil-public-runtime.d.ts +51 -15
- package/package.json +5 -5
- package/dist/cjs/app-globals-2988084b.js +0 -511
- package/dist/cjs/app-globals-2988084b.js.map +0 -1
- package/dist/cjs/css-shim-83cf0349.js +0 -8
- package/dist/cjs/css-shim-83cf0349.js.map +0 -1
- package/dist/cjs/cura-accordion_8.cjs.entry.js +0 -445
- package/dist/cjs/cura-accordion_8.cjs.entry.js.map +0 -1
- package/dist/cjs/cura-button-transparent.cjs.entry.js +0 -83
- package/dist/cjs/cura-button-transparent.cjs.entry.js.map +0 -1
- package/dist/cjs/cura-forms.definitions-11be2ebd.js +0 -20
- package/dist/cjs/cura-forms.definitions-11be2ebd.js.map +0 -1
- package/dist/cjs/cura-icon.definitions-b73b0178.js +0 -21
- package/dist/cjs/cura-icon.definitions-b73b0178.js.map +0 -1
- package/dist/cjs/cura-input-text.cjs.entry.js.map +0 -1
- package/dist/cjs/cura-label.cjs.entry.js +0 -69
- package/dist/cjs/cura-label.cjs.entry.js.map +0 -1
- package/dist/cjs/index-7616f620.js +0 -2281
- package/dist/cjs/index-7616f620.js.map +0 -1
- package/dist/cjs/shadow-css-8baae635.js +0 -391
- package/dist/cjs/shadow-css-8baae635.js.map +0 -1
- package/dist/collection/utils/utils.spec.js +0 -16
- package/dist/collection/utils/utils.spec.js.map +0 -1
- package/dist/cura/cura.js +0 -133
- package/dist/cura/p-118112e5.system.js +0 -14
- package/dist/cura/p-118112e5.system.js.map +0 -1
- package/dist/cura/p-120926c5.system.js +0 -2
- package/dist/cura/p-120926c5.system.js.map +0 -1
- package/dist/cura/p-1228e771.entry.js +0 -2
- package/dist/cura/p-1228e771.entry.js.map +0 -1
- package/dist/cura/p-183305c3.js +0 -2
- package/dist/cura/p-183305c3.js.map +0 -1
- package/dist/cura/p-2d42ccf4.entry.js +0 -2
- package/dist/cura/p-2d42ccf4.entry.js.map +0 -1
- package/dist/cura/p-3688570d.js.map +0 -1
- package/dist/cura/p-36a83bc7.system.js +0 -3
- package/dist/cura/p-36a83bc7.system.js.map +0 -1
- package/dist/cura/p-3f3355f3.system.entry.js +0 -2
- package/dist/cura/p-3f3355f3.system.entry.js.map +0 -1
- package/dist/cura/p-3f5de5e2.entry.js +0 -2
- package/dist/cura/p-3f5de5e2.entry.js.map +0 -1
- package/dist/cura/p-3f6aaefc.system.js +0 -2
- package/dist/cura/p-3f6aaefc.system.js.map +0 -1
- package/dist/cura/p-48426f60.system.js +0 -2
- package/dist/cura/p-48426f60.system.js.map +0 -1
- package/dist/cura/p-4db87e8d.system.entry.js +0 -2
- package/dist/cura/p-4db87e8d.system.entry.js.map +0 -1
- package/dist/cura/p-51e00a16.entry.js +0 -2
- package/dist/cura/p-51e00a16.entry.js.map +0 -1
- package/dist/cura/p-72a9ed55.entry.js +0 -2
- package/dist/cura/p-72a9ed55.entry.js.map +0 -1
- package/dist/cura/p-75b2e4d1.system.entry.js +0 -2
- package/dist/cura/p-75b2e4d1.system.entry.js.map +0 -1
- package/dist/cura/p-880917c1.entry.js +0 -2
- package/dist/cura/p-880917c1.entry.js.map +0 -1
- package/dist/cura/p-8d959fb2.entry.js +0 -2
- package/dist/cura/p-8d959fb2.entry.js.map +0 -1
- package/dist/cura/p-9471c93e.system.entry.js +0 -2
- package/dist/cura/p-9471c93e.system.entry.js.map +0 -1
- package/dist/cura/p-98014544.entry.js +0 -2
- package/dist/cura/p-98014544.entry.js.map +0 -1
- package/dist/cura/p-98352c92.system.entry.js +0 -2
- package/dist/cura/p-98352c92.system.entry.js.map +0 -1
- package/dist/cura/p-a32889a4.system.js +0 -2
- package/dist/cura/p-a32889a4.system.js.map +0 -1
- package/dist/cura/p-ab8c9a8f.system.entry.js +0 -2
- package/dist/cura/p-ab8c9a8f.system.entry.js.map +0 -1
- package/dist/cura/p-ad194144.entry.js +0 -2
- package/dist/cura/p-ad194144.entry.js.map +0 -1
- package/dist/cura/p-b0e13882.system.entry.js +0 -2
- package/dist/cura/p-b0e13882.system.entry.js.map +0 -1
- package/dist/cura/p-ba66d7be.js +0 -3
- package/dist/cura/p-ba66d7be.js.map +0 -1
- package/dist/cura/p-bb3f9d05.entry.js +0 -2
- package/dist/cura/p-bb3f9d05.entry.js.map +0 -1
- package/dist/cura/p-beab48cd.js +0 -13
- package/dist/cura/p-beab48cd.js.map +0 -1
- package/dist/cura/p-c791725b.js.map +0 -1
- package/dist/cura/p-cb4e2a0c.system.entry.js +0 -2
- package/dist/cura/p-cb4e2a0c.system.entry.js.map +0 -1
- package/dist/cura/p-d3f9c888.system.js +0 -2
- package/dist/cura/p-d3f9c888.system.js.map +0 -1
- package/dist/cura/p-e5e259fd.system.entry.js +0 -2
- package/dist/cura/p-e5e259fd.system.entry.js.map +0 -1
- package/dist/cura/p-edeffbfc.entry.js +0 -2
- package/dist/cura/p-edeffbfc.entry.js.map +0 -1
- package/dist/cura/p-f51705c2.system.entry.js +0 -2
- package/dist/cura/p-f51705c2.system.entry.js.map +0 -1
- package/dist/cura/p-f89f2ecc.system.entry.js +0 -2
- package/dist/cura/p-f89f2ecc.system.entry.js.map +0 -1
- package/dist/cura/p-f8fffdc1.js.map +0 -1
- package/dist/cura/p-fc4ba4ce.system.js +0 -2
- package/dist/cura/p-fc4ba4ce.system.js.map +0 -1
- package/dist/cura/p-fef52079.entry.js +0 -2
- package/dist/cura/p-fef52079.entry.js.map +0 -1
- package/dist/cura/p-ffd41520.system.entry.js +0 -2
- package/dist/cura/p-ffd41520.system.entry.js.map +0 -1
- package/dist/esm/app-globals-29001758.js +0 -509
- package/dist/esm/app-globals-29001758.js.map +0 -1
- package/dist/esm/css-shim-d13f0738.js +0 -6
- package/dist/esm/css-shim-d13f0738.js.map +0 -1
- package/dist/esm/cura-accordion_8.entry.js +0 -434
- package/dist/esm/cura-accordion_8.entry.js.map +0 -1
- package/dist/esm/cura-button-transparent.entry.js +0 -79
- package/dist/esm/cura-button-transparent.entry.js.map +0 -1
- package/dist/esm/cura-forms.definitions-0f774253.js +0 -18
- package/dist/esm/cura-forms.definitions-0f774253.js.map +0 -1
- package/dist/esm/cura-icon.definitions-a63d1862.js +0 -18
- package/dist/esm/cura-icon.definitions-a63d1862.js.map +0 -1
- package/dist/esm/cura-input-text.entry.js.map +0 -1
- package/dist/esm/cura-label.entry.js +0 -65
- package/dist/esm/cura-label.entry.js.map +0 -1
- package/dist/esm/index-81f1a268.js +0 -2249
- package/dist/esm/index-81f1a268.js.map +0 -1
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/shadow-css-07b0c8c8.js +0 -389
- package/dist/esm/shadow-css-07b0c8c8.js.map +0 -1
- package/dist/esm-es5/app-globals-29001758.js +0 -2
- package/dist/esm-es5/app-globals-29001758.js.map +0 -1
- package/dist/esm-es5/css-shim-d13f0738.js +0 -2
- package/dist/esm-es5/css-shim-d13f0738.js.map +0 -1
- package/dist/esm-es5/cura-accordion_8.entry.js +0 -2
- package/dist/esm-es5/cura-accordion_8.entry.js.map +0 -1
- package/dist/esm-es5/cura-alert.entry.js +0 -2
- package/dist/esm-es5/cura-alert.entry.js.map +0 -1
- package/dist/esm-es5/cura-button-outline.entry.js +0 -2
- package/dist/esm-es5/cura-button-outline.entry.js.map +0 -1
- package/dist/esm-es5/cura-button-select.entry.js +0 -2
- package/dist/esm-es5/cura-button-select.entry.js.map +0 -1
- package/dist/esm-es5/cura-button-transparent.entry.js +0 -2
- package/dist/esm-es5/cura-button-transparent.entry.js.map +0 -1
- package/dist/esm-es5/cura-checkbox.entry.js +0 -2
- package/dist/esm-es5/cura-checkbox.entry.js.map +0 -1
- package/dist/esm-es5/cura-display.entry.js +0 -2
- package/dist/esm-es5/cura-display.entry.js.map +0 -1
- package/dist/esm-es5/cura-forms.definitions-0f774253.js +0 -2
- package/dist/esm-es5/cura-icon.definitions-a63d1862.js +0 -2
- package/dist/esm-es5/cura-icons-view.entry.js +0 -2
- package/dist/esm-es5/cura-icons-view.entry.js.map +0 -1
- package/dist/esm-es5/cura-input-text.entry.js +0 -2
- package/dist/esm-es5/cura-input-text.entry.js.map +0 -1
- package/dist/esm-es5/cura-label.entry.js +0 -2
- package/dist/esm-es5/cura-label.entry.js.map +0 -1
- package/dist/esm-es5/cura-radio.entry.js +0 -2
- package/dist/esm-es5/cura-radio.entry.js.map +0 -1
- package/dist/esm-es5/cura-switch.entry.js +0 -2
- package/dist/esm-es5/cura-switch.entry.js.map +0 -1
- package/dist/esm-es5/cura.js +0 -2
- package/dist/esm-es5/cura.js.map +0 -1
- package/dist/esm-es5/index-81f1a268.js +0 -3
- package/dist/esm-es5/index-81f1a268.js.map +0 -1
- package/dist/esm-es5/index.js +0 -2
- package/dist/esm-es5/index.js.map +0 -1
- package/dist/esm-es5/loader.js +0 -2
- package/dist/esm-es5/loader.js.map +0 -1
- package/dist/esm-es5/shadow-css-07b0c8c8.js +0 -13
- package/dist/esm-es5/shadow-css-07b0c8c8.js.map +0 -1
|
@@ -1,267 +1,295 @@
|
|
|
1
|
-
import { h, Host } from
|
|
2
|
-
import { formsSizes } from
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
import { formsSizes } from "../cura-forms.definitions";
|
|
3
3
|
export class CuraSwitch {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
this.sizes = {
|
|
6
|
+
large: { size: 64 },
|
|
7
|
+
medium: { size: 48 },
|
|
8
|
+
small: { size: 40 },
|
|
9
|
+
};
|
|
10
|
+
this.isDarkbackground = () => this.background === 'dark';
|
|
11
|
+
this.toggleSwitch = () => {
|
|
12
|
+
if (this.disabled)
|
|
13
|
+
return null;
|
|
14
|
+
this.checked = !this.checked;
|
|
15
|
+
this.internals.setFormValue(this.checked.toString());
|
|
16
|
+
this.onchange.emit({ checked: this.checked });
|
|
17
|
+
};
|
|
18
|
+
this.checked = false;
|
|
19
|
+
this.disabled = false;
|
|
20
|
+
this.label = '';
|
|
21
|
+
this.ontabindex = 0;
|
|
22
|
+
this.position = 'left';
|
|
23
|
+
this.size = 'medium';
|
|
24
|
+
this.background = 'light';
|
|
25
|
+
this.color = 'accent';
|
|
26
|
+
this.styles = {};
|
|
27
|
+
}
|
|
28
|
+
sizeHandler() {
|
|
29
|
+
this.styles = Object.assign(Object.assign({}, this.styles), { '--size-track': `${this.sizes[this.size].size}px`, '--size': `${formsSizes[this.size].size}px`, '--gap': `${formsSizes[this.size].gap}px` });
|
|
30
|
+
}
|
|
31
|
+
setColors() {
|
|
32
|
+
const colors = [
|
|
33
|
+
{ name: '--info-base', background: 'info-base' },
|
|
34
|
+
{ name: '--neutral-black-shadow', background: 'neutral-black', opacity: 0.16 },
|
|
35
|
+
{ name: '--neutral-purewhite', background: 'neutral-purewhite' },
|
|
36
|
+
{ name: '--neutral-medium', background: 'neutral-medium' },
|
|
37
|
+
{ name: '--neutral-pale', background: 'neutral-pale' },
|
|
38
|
+
{ name: '--neutral-dark-base', background: `neutral-${this.isDarkbackground() ? 'dark' : 'base'}` },
|
|
39
|
+
{ name: '--neutral-darker-medium', background: `neutral-${this.isDarkbackground() ? 'darker' : 'medium'}` },
|
|
40
|
+
{ name: '--neutral-black-neutral-pale', background: `${this.isDarkbackground() ? 'neutral-black' : 'neutral-pale'}` },
|
|
41
|
+
{ name: '--neutral-black-neutral-base', background: `${this.isDarkbackground() ? 'neutral-dark' : 'neutral-base'}` },
|
|
42
|
+
{ name: '--color-base-light', background: `${this.color}-light` },
|
|
43
|
+
{ name: '--color-dark', background: `${this.color}-dark` },
|
|
44
|
+
];
|
|
45
|
+
colors.forEach(color => {
|
|
46
|
+
this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.background, color === null || color === void 0 ? void 0 : color.opacity);
|
|
47
|
+
});
|
|
48
|
+
this.styles = Object.assign({}, this.styles);
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() {
|
|
51
|
+
this.sizeHandler();
|
|
52
|
+
this.setColors();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Callback for form association.
|
|
56
|
+
*/
|
|
57
|
+
formAssociatedCallback(form) {
|
|
58
|
+
form.ariaLabel = this.label;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Callback to restore the switch state from the form.
|
|
62
|
+
*/
|
|
63
|
+
formStateRestoreCallback(state) {
|
|
64
|
+
this.checked = state.value === 'true';
|
|
65
|
+
this.internals.setFormValue(this.checked.toString());
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Callback to reset the switch state when the form is reset.
|
|
69
|
+
*/
|
|
70
|
+
formResetCallback() {
|
|
71
|
+
this.checked = false;
|
|
72
|
+
this.internals.setValidity({});
|
|
73
|
+
this.internals.setFormValue(this.checked.toString());
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Callback to update the switch's disabled state when the form's disabled state changes.
|
|
77
|
+
*/
|
|
78
|
+
formDisabledCallback(disabled) {
|
|
79
|
+
this.disabled = disabled;
|
|
80
|
+
}
|
|
81
|
+
assignColor(colorDark, colorLight) {
|
|
82
|
+
if (this.disabled)
|
|
83
|
+
return this.isDarkbackground() ? 'neutral-dark' : 'neutral-dark';
|
|
84
|
+
return this.isDarkbackground() ? colorDark : colorLight;
|
|
85
|
+
}
|
|
86
|
+
getClasses() {
|
|
87
|
+
const classes = {};
|
|
88
|
+
classes['container'] = true;
|
|
89
|
+
classes['checked'] = this.checked;
|
|
90
|
+
classes['disabled'] = this.disabled;
|
|
91
|
+
classes['position'] = this.position === 'right';
|
|
92
|
+
return classes;
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
return (h(Host, { key: 'e0040434db080b1ccdb12a1389ca028f5c02f66a' }, h("div", { key: '6008f7aef47e0519e965c2be573dc1eacc001b6c', class: this.getClasses(), style: this.styles }, h("div", { key: 'a954404dce1c7eafd79cb3236e8761a3dc29f86e', class: "info" }, h("cura-label", { key: '6ff5cc1f26abad0f173c4e1330aaae43357b7737', 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: 'b82e4cb25ef94481642e1d5a2180eb4e12b8eff8', style: { textAlign: this.position === 'right' ? 'right' : 'left' }, color: this.assignColor('primary-lighter', 'neutral-dark'), size: "xsmall", class: "message" }, h("slot", { key: '243e906253614d9ce837e0c598b259ad7c87afb4' }))), h("div", { key: '36d0165722a6fae98ca829a5a2e89edef3694ff2', onClick: this.toggleSwitch, class: "control" }, h("div", { key: 'f9c0c7cbc84b655e37e7e8df1c2293c1260445ca', class: `track ${this.size.toLowerCase()}` }, h("div", { key: 'e5ca4006ad41a6cbf8d62ca612b52ef26fb7255f', class: `thumb ${this.size.toLowerCase()}`, tabIndex: this.ontabindex }))))));
|
|
96
|
+
}
|
|
97
|
+
static get is() { return "cura-switch"; }
|
|
98
|
+
static get encapsulation() { return "shadow"; }
|
|
99
|
+
static get formAssociated() { return true; }
|
|
100
|
+
static get originalStyleUrls() {
|
|
101
|
+
return {
|
|
102
|
+
"$": ["cura-switch.scss"]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
static get styleUrls() {
|
|
106
|
+
return {
|
|
107
|
+
"$": ["cura-switch.css"]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
static get properties() {
|
|
111
|
+
return {
|
|
112
|
+
"checked": {
|
|
113
|
+
"type": "boolean",
|
|
114
|
+
"mutable": true,
|
|
115
|
+
"complexType": {
|
|
116
|
+
"original": "boolean",
|
|
117
|
+
"resolved": "boolean",
|
|
118
|
+
"references": {}
|
|
119
|
+
},
|
|
120
|
+
"required": false,
|
|
121
|
+
"optional": false,
|
|
122
|
+
"docs": {
|
|
123
|
+
"tags": [],
|
|
124
|
+
"text": "Indicates whether the switch is checked or not."
|
|
125
|
+
},
|
|
126
|
+
"attribute": "checked",
|
|
127
|
+
"reflect": true,
|
|
128
|
+
"defaultValue": "false"
|
|
129
|
+
},
|
|
130
|
+
"disabled": {
|
|
131
|
+
"type": "boolean",
|
|
132
|
+
"mutable": false,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "boolean",
|
|
135
|
+
"resolved": "boolean",
|
|
136
|
+
"references": {}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": false,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": "Indicates whether the switch is disabled or not."
|
|
143
|
+
},
|
|
144
|
+
"attribute": "disabled",
|
|
145
|
+
"reflect": true,
|
|
146
|
+
"defaultValue": "false"
|
|
147
|
+
},
|
|
148
|
+
"label": {
|
|
149
|
+
"type": "string",
|
|
150
|
+
"mutable": false,
|
|
151
|
+
"complexType": {
|
|
152
|
+
"original": "string",
|
|
153
|
+
"resolved": "string",
|
|
154
|
+
"references": {}
|
|
155
|
+
},
|
|
156
|
+
"required": false,
|
|
157
|
+
"optional": false,
|
|
158
|
+
"docs": {
|
|
159
|
+
"tags": [],
|
|
160
|
+
"text": "The label text to display next to the switch."
|
|
161
|
+
},
|
|
162
|
+
"attribute": "label",
|
|
163
|
+
"reflect": true,
|
|
164
|
+
"defaultValue": "''"
|
|
165
|
+
},
|
|
166
|
+
"ontabindex": {
|
|
167
|
+
"type": "number",
|
|
168
|
+
"mutable": false,
|
|
169
|
+
"complexType": {
|
|
170
|
+
"original": "number",
|
|
171
|
+
"resolved": "number",
|
|
172
|
+
"references": {}
|
|
173
|
+
},
|
|
174
|
+
"required": false,
|
|
175
|
+
"optional": false,
|
|
176
|
+
"docs": {
|
|
177
|
+
"tags": [],
|
|
178
|
+
"text": "Tab index for the switch element.\nReflects as an HTML attribute."
|
|
179
|
+
},
|
|
180
|
+
"attribute": "ontabindex",
|
|
181
|
+
"reflect": true,
|
|
182
|
+
"defaultValue": "0"
|
|
183
|
+
},
|
|
184
|
+
"position": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"mutable": false,
|
|
187
|
+
"complexType": {
|
|
188
|
+
"original": "'left' | 'right'",
|
|
189
|
+
"resolved": "\"left\" | \"right\"",
|
|
190
|
+
"references": {}
|
|
191
|
+
},
|
|
192
|
+
"required": false,
|
|
193
|
+
"optional": false,
|
|
194
|
+
"docs": {
|
|
195
|
+
"tags": [],
|
|
196
|
+
"text": "Position of the label relative to the switch.\nCan be 'left' or 'right'."
|
|
197
|
+
},
|
|
198
|
+
"attribute": "position",
|
|
199
|
+
"reflect": true,
|
|
200
|
+
"defaultValue": "'left'"
|
|
201
|
+
},
|
|
202
|
+
"size": {
|
|
203
|
+
"type": "string",
|
|
204
|
+
"mutable": false,
|
|
205
|
+
"complexType": {
|
|
206
|
+
"original": "'small' | 'medium' | 'large'",
|
|
207
|
+
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
208
|
+
"references": {}
|
|
209
|
+
},
|
|
210
|
+
"required": false,
|
|
211
|
+
"optional": false,
|
|
212
|
+
"docs": {
|
|
213
|
+
"tags": [],
|
|
214
|
+
"text": "Size of the switch.\nCan be 'small', 'medium', or 'large'."
|
|
215
|
+
},
|
|
216
|
+
"attribute": "size",
|
|
217
|
+
"reflect": true,
|
|
218
|
+
"defaultValue": "'medium'"
|
|
219
|
+
},
|
|
220
|
+
"background": {
|
|
221
|
+
"type": "string",
|
|
222
|
+
"mutable": false,
|
|
223
|
+
"complexType": {
|
|
224
|
+
"original": "'dark' | 'light'",
|
|
225
|
+
"resolved": "\"dark\" | \"light\"",
|
|
226
|
+
"references": {}
|
|
227
|
+
},
|
|
228
|
+
"required": false,
|
|
229
|
+
"optional": false,
|
|
230
|
+
"docs": {
|
|
231
|
+
"tags": [],
|
|
232
|
+
"text": "Background style of the switch.\nCan be 'dark' or 'light'."
|
|
233
|
+
},
|
|
234
|
+
"attribute": "background",
|
|
235
|
+
"reflect": false,
|
|
236
|
+
"defaultValue": "'light'"
|
|
237
|
+
},
|
|
238
|
+
"color": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "string",
|
|
243
|
+
"resolved": "string",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "Accent color of the switch."
|
|
251
|
+
},
|
|
252
|
+
"attribute": "color",
|
|
253
|
+
"reflect": false,
|
|
254
|
+
"defaultValue": "'accent'"
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
static get states() {
|
|
259
|
+
return {
|
|
260
|
+
"styles": {}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
static get events() {
|
|
264
|
+
return [{
|
|
265
|
+
"method": "onchange",
|
|
266
|
+
"name": "onchange",
|
|
267
|
+
"bubbles": true,
|
|
268
|
+
"cancelable": true,
|
|
269
|
+
"composed": true,
|
|
270
|
+
"docs": {
|
|
271
|
+
"tags": [],
|
|
272
|
+
"text": ""
|
|
273
|
+
},
|
|
274
|
+
"complexType": {
|
|
275
|
+
"original": "{ checked: boolean }",
|
|
276
|
+
"resolved": "{ checked: boolean; }",
|
|
277
|
+
"references": {}
|
|
278
|
+
}
|
|
279
|
+
}];
|
|
280
|
+
}
|
|
281
|
+
static get watchers() {
|
|
282
|
+
return [{
|
|
283
|
+
"propName": "size",
|
|
284
|
+
"methodName": "sizeHandler"
|
|
285
|
+
}, {
|
|
286
|
+
"propName": "color",
|
|
287
|
+
"methodName": "setColors"
|
|
288
|
+
}, {
|
|
289
|
+
"propName": "background",
|
|
290
|
+
"methodName": "setColors"
|
|
291
|
+
}];
|
|
292
|
+
}
|
|
293
|
+
static get attachInternalsMemberName() { return "internals"; }
|
|
266
294
|
}
|
|
267
295
|
//# sourceMappingURL=cura-switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cura-switch.js","sourceRoot":"","sources":["../../../../src/components/forms/cura-switch/cura-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAQvD,MAAM,OAAO,UAAU;;IA0CrB,UAAK,GAAG;MACN,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;MACrB,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;MACtB,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;KACtB,CAAC;IAGF,qBAAgB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC;IA2CpD,iBAAY,GAAG,GAAG,EAAE;MAClB,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;MAE/B,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;MAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;IAC/C,CAAC,CAAC;mBA7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,IAAI,CAAC,KAAK,CACA;UACb,kBACE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,iBAAiB,EAAE,cAAc,CAAC,EAC1D,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,SAAS;YACf,eAAa,CACF,CACT;QAEN,WAAK,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,EAAC,SAAS;UAC9C,WAAK,KAAK,EAAE,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE;YAC5C,WAAK,KAAK,EAAE,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,GAAQ,CAC7E,CACF,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Event, h, Host, Watch, EventEmitter, State } from '@stencil/core';\nimport { formsSizes } from '../cura-forms.definitions';\n\n@Component({\n tag: 'cura-switch',\n styleUrl: 'cura-switch.scss',\n shadow: true,\n})\n\nexport class CuraSwitch {\n /**\n * Indicates whether the switch is checked or not.\n */\n @Prop({ reflect: true, mutable: true }) checked: boolean = false;\n /**\n * Indicates whether the switch is disabled or not.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n /**\n * The label text to display next to the switch.\n */\n @Prop({ reflect: true }) label: string = '';\n /**\n * Tab index for the switch element.\n * Reflects as an HTML attribute.\n */\n @Prop({ reflect: true }) ontabindex: number = 0;\n /**\n * Position of the label relative to the switch.\n * Can be 'left' or 'right'.\n */\n @Prop({ reflect: true }) position: \"left\" | \"right\" = 'left';\n /**\n * Size of the switch.\n * Can be 'small', 'medium', or 'large'.\n */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n /**\n * Background style of the switch.\n * Can be 'dark' or 'light'.\n */\n @Prop() background: 'dark' | 'light' = 'light';\n /**\n * Accent color of the switch.\n */\n @Prop() color = 'accent';\n\n @State() styles = {};\n\n @Event({ eventName: 'onchange', composed: true, cancelable: true, bubbles: true }) onchange: EventEmitter<{ checked: boolean }>;\n\n sizes = {\n \"large\": { size: 64 },\n \"medium\": { size: 48 },\n \"small\": { size: 40 },\n };\n\n\n isDarkbackground = () => this.background === 'dark';\n\n @Watch('size')\n sizeHandler() {\n this.styles = {\n ...this.styles,\n '--size-track': `${this.sizes[this.size].size}px`,\n '--size': `${formsSizes[this.size].size}px`,\n '--gap': `${formsSizes[this.size].gap}px`\n };\n }\n\n @Watch('color')\n @Watch('background')\n setColors() {\n const colors = [\n { name: '--info-base', background: 'info-base' },\n { name: '--neutral-medium', background: 'neutral-medium' },\n { name: '--color-lighter', background: `${this.color}-lighter` },\n { name: '--color-base-lighter-50', background: `${this.color}-${this.isDarkbackground() ? 'base' : 'lighter'}`, opacity: 0.5 },\n { name: '--color-base-light', background: `${this.color}-${this.isDarkbackground() ? 'base' : 'light'}` },\n { name: '--color-dark-light', background: `${this.color}-${this.isDarkbackground() ? 'dark' : 'light'}` },\n { name: '--primary-lighter-neutral-dark', background: this.isDarkbackground() ? 'primary-lighter' : 'neutral-dark' },\n { name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },\n { name: '--neutral-white-purewhite', background: `neutral-${this.isDarkbackground() ? 'white' : 'purewhite'}` },\n { name: '--primary-base-neutral-black-20', background: `${this.isDarkbackground() ? 'primary-base' : 'neutral-black'}`, opacity: 0.2 },\n { name: '--neutral-base-black-40', background: `neutral-${this.isDarkbackground() ? 'base' : 'black'}`, opacity: 0.4 },\n { name: '--primary-dark-neutral-base', background: `${this.isDarkbackground() ? 'primary-dark' : 'neutral-base'}` },\n { name: '--neutral-lighter', background: `${this.isDarkbackground() ? 'primary-base' : 'neutral-lighter'}` },\n ];\n\n colors.forEach(color => {\n this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.background, color?.opacity);\n });\n this.styles = { ...this.styles };\n\n }\n\n connectedCallback() {\n this.sizeHandler()\n this.setColors();\n }\n\n toggleSwitch = () => {\n if (this.disabled) return null;\n\n this.checked = !this.checked;\n this.onchange.emit({ checked: this.checked })\n };\n\n assignColor(colorDark: string, colorLight: string) {\n if (this.disabled) return this.isDarkbackground() ? 'primary-base' : 'neutral-medium';\n return this.isDarkbackground() ? colorDark : colorLight\n }\n\n getClasses() {\n const classes = {};\n classes['container'] = true;\n classes['checked'] = this.checked;\n classes['disabled'] = this.disabled;\n classes['position'] = this.position === 'right';\n\n return classes;\n }\n\n\n render() {\n return (\n <Host>\n <div class={this.getClasses()} style={this.styles}>\n <div class=\"info\">\n <cura-label class=\"label\"\n size={this.size === 'large' ? 'medium' : 'xsmall'}\n lineHeight=\"125%\"\n color={this.assignColor('neutral-white', 'neutral-black')}>\n {this.label}\n </cura-label>\n <cura-label\n color={this.assignColor('primary-lighter', 'neutral-dark')}\n size=\"xsmall\"\n class=\"message\">\n <slot></slot>\n </cura-label>\n </div>\n\n <div onClick={this.toggleSwitch} class=\"control\">\n <div class={`track ${this.size.toLowerCase()}`}>\n <div class={`thumb ${this.size.toLowerCase()}`} tabIndex={this.ontabindex}></div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cura-switch.js","sourceRoot":"","sources":["../../../../src/components/forms/cura-switch/cura-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAQvD,MAAM,OAAO,UAAU;;QA4CrB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Q,EAAE,IAAI,CAAC,UAAU,GAAQ,CAC7E,CACF,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Event, h, Host, Watch, EventEmitter, State, AttachInternals } from '@stencil/core';\nimport { formsSizes } from '../cura-forms.definitions';\n\n@Component({\n tag: 'cura-switch',\n styleUrl: 'cura-switch.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class CuraSwitch {\n /**\n * Indicates whether the switch is checked or not.\n */\n @Prop({ reflect: true, mutable: true }) checked: boolean = false;\n /**\n * Indicates whether the switch is disabled or not.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n /**\n * The label text to display next to the switch.\n */\n @Prop({ reflect: true }) label: string = '';\n /**\n * Tab index for the switch element.\n * Reflects as an HTML attribute.\n */\n @Prop({ reflect: true }) ontabindex: number = 0;\n /**\n * Position of the label relative to the switch.\n * Can be 'left' or 'right'.\n */\n @Prop({ reflect: true }) position: 'left' | 'right' = 'left';\n /**\n * Size of the switch.\n * Can be 'small', 'medium', or 'large'.\n */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n /**\n * Background style of the switch.\n * Can be 'dark' or 'light'.\n */\n @Prop() background: 'dark' | 'light' = 'light';\n /**\n * Accent color of the switch.\n */\n @Prop() color = 'accent';\n\n @State() styles = {};\n\n @Event({ eventName: 'onchange', composed: true, cancelable: true, bubbles: true }) onchange: EventEmitter<{ checked: boolean }>;\n\n @AttachInternals() internals: ElementInternals;\n\n sizes = {\n large: { size: 64 },\n medium: { size: 48 },\n small: { size: 40 },\n };\n\n isDarkbackground = () => this.background === 'dark';\n\n @Watch('size')\n sizeHandler() {\n this.styles = {\n ...this.styles,\n '--size-track': `${this.sizes[this.size].size}px`,\n '--size': `${formsSizes[this.size].size}px`,\n '--gap': `${formsSizes[this.size].gap}px`,\n };\n }\n\n @Watch('color')\n @Watch('background')\n setColors() {\n const colors = [\n { name: '--info-base', background: 'info-base' },\n { name: '--neutral-black-shadow', background: 'neutral-black', opacity: 0.16 },\n { name: '--neutral-purewhite', background: 'neutral-purewhite' },\n { name: '--neutral-medium', background: 'neutral-medium' },\n { name: '--neutral-pale', background: 'neutral-pale' },\n { name: '--neutral-dark-base', background: `neutral-${this.isDarkbackground() ? 'dark' : 'base'}` },\n { name: '--neutral-darker-medium', background: `neutral-${this.isDarkbackground() ? 'darker' : 'medium'}` },\n { name: '--neutral-black-neutral-pale', background: `${this.isDarkbackground() ? 'neutral-black' : 'neutral-pale'}` },\n { name: '--neutral-black-neutral-base', background: `${this.isDarkbackground() ? 'neutral-dark' : 'neutral-base'}` },\n { name: '--color-base-light', background: `${this.color}-light` },\n { name: '--color-dark', background: `${this.color}-dark` },\n ];\n\n colors.forEach(color => {\n this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.background, color?.opacity);\n });\n this.styles = { ...this.styles };\n }\n\n connectedCallback() {\n this.sizeHandler();\n this.setColors();\n }\n\n /**\n * Callback for form association.\n */\n formAssociatedCallback(form: { ariaLabel: string }) {\n form.ariaLabel = this.label;\n }\n\n /**\n * Callback to restore the switch state from the form.\n */\n formStateRestoreCallback(state: { value: string }) {\n this.checked = state.value === 'true';\n this.internals.setFormValue(this.checked.toString());\n }\n\n /**\n * Callback to reset the switch state when the form is reset.\n */\n formResetCallback() {\n this.checked = false;\n this.internals.setValidity({});\n this.internals.setFormValue(this.checked.toString());\n }\n\n /**\n * Callback to update the switch's disabled state when the form's disabled state changes.\n */\n formDisabledCallback(disabled: boolean) {\n this.disabled = disabled;\n }\n\n toggleSwitch = () => {\n if (this.disabled) return null;\n\n this.checked = !this.checked;\n this.internals.setFormValue(this.checked.toString());\n this.onchange.emit({ checked: this.checked });\n };\n\n assignColor(colorDark: string, colorLight: string) {\n if (this.disabled) return this.isDarkbackground() ? 'neutral-dark' : 'neutral-dark';\n return this.isDarkbackground() ? colorDark : colorLight;\n }\n\n getClasses() {\n const classes = {};\n classes['container'] = true;\n classes['checked'] = this.checked;\n classes['disabled'] = this.disabled;\n classes['position'] = this.position === 'right';\n\n return classes;\n }\n\n render() {\n return (\n <Host>\n <div class={this.getClasses()} style={this.styles}>\n <div class=\"info\">\n <cura-label\n style={{ textAlign: this.position === 'right' ? 'right' : 'left' }}\n class=\"label\"\n weight=\"bold\"\n size={this.size === 'large' ? 'medium' : 'xsmall'}\n lineHeight=\"125%\"\n color={this.assignColor('neutral-white', 'neutral-black')}\n >\n {this.label}\n </cura-label>\n <cura-label\n style={{ textAlign: this.position === 'right' ? 'right' : 'left' }}\n color={this.assignColor('primary-lighter', 'neutral-dark')}\n size=\"xsmall\"\n class=\"message\"\n >\n <slot></slot>\n </cura-label>\n </div>\n\n <div onClick={this.toggleSwitch} class=\"control\">\n <div class={`track ${this.size.toLowerCase()}`}>\n <div class={`thumb ${this.size.toLowerCase()}`} tabIndex={this.ontabindex}></div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|