@baloise/ds-core 19.9.4-nightly.20260513 → 19.9.5
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/components/all.d.ts +0 -2
- package/components/all.js +0 -3
- package/components/animation.decorator.js +1 -1
- package/components/bal-accordion.js +1 -1
- package/components/bal-app.js +102 -1
- package/components/bal-button2.js +1 -1
- package/components/bal-carousel-item.js +1 -1
- package/components/bal-checkbox-group.js +21 -3
- package/components/bal-checkbox2.js +21 -4
- package/components/bal-date-calendar2.js +1 -1
- package/components/bal-date.js +1 -1
- package/components/bal-dropdown.js +1 -1
- package/components/bal-field.js +1 -1
- package/components/bal-footer.js +1 -1
- package/components/bal-form.js +1 -1
- package/components/bal-input-stepper.js +1 -1
- package/components/bal-list-item-accordion-body2.js +1 -1
- package/components/bal-list-item2.js +1 -1
- package/components/bal-logo2.js +1 -1
- package/components/bal-modal.js +1 -1
- package/components/bal-nav.js +65 -53
- package/components/bal-navbar-brand.js +1 -1
- package/components/bal-option-list2.js +1 -1
- package/components/bal-popup2.js +1 -1
- package/components/bal-radio-group.js +1 -1
- package/components/bal-segment-item.js +1 -1
- package/components/bal-select2.js +23 -11
- package/components/bal-spinner2.js +1 -1
- package/components/bal-stage-image.js +1 -1
- package/components/bal-switch.js +1 -74
- package/{dist/esm/bal-switch.entry.js → components/bal-switch2.js} +36 -8
- package/components/bal-tabs2.js +29 -17
- package/components/breakpoints.subject.js +1 -1
- package/components/element-states.decorator.js +1 -1
- package/components/floating-ui.js +1 -1
- package/components/focus.decorator.js +1 -1
- package/components/form-input.js +1 -1
- package/components/helpers.js +1 -1
- package/components/index.js +449 -5
- package/components/mutation.decorator.js +1 -1
- package/components/overlays.js +1 -1
- package/components/resize.decorator.js +1 -1
- package/components/swipe.subject.js +1 -1
- package/components/swiper.util.js +1 -1
- package/components/tokens.esm.js +1 -1
- package/components/visibility.decorator.js +1 -1
- package/dist/baloise-design-system/baloise-design-system.esm.js +1 -1
- package/dist/baloise-design-system/baloise-design-system.js +1 -1
- package/dist/baloise-design-system/index.esm.js +1 -1
- package/dist/baloise-design-system/{p-09d63730a7.entry.js → p-1bb5b8696e.entry.js} +1 -1
- package/dist/baloise-design-system/p-1d7406989c.system.entry.js +1 -0
- package/dist/baloise-design-system/{p-0b1aeaaed8.entry.js → p-3850595dd0.entry.js} +1 -1
- package/dist/baloise-design-system/{p-81c4b117a6.system.entry.js → p-43dd693355.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-8f510eed45.entry.js → p-477359bbf9.entry.js} +1 -1
- package/dist/baloise-design-system/{p-873a0bf9d9.system.entry.js → p-59129fb1d1.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-CIBedZ4h.js → p-5GEK9UQy.js} +1 -1
- package/dist/baloise-design-system/{p-8bc92b4b2e.system.entry.js → p-607125007c.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-38888ff243.system.entry.js → p-64d45da025.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-89a45b7719.system.entry.js → p-68baccfba9.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-8da007a406.entry.js → p-68f77714ab.entry.js} +1 -1
- package/dist/baloise-design-system/{p-9459a04689.system.entry.js → p-6c3d087d59.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-627def5e99.entry.js → p-74fe27789f.entry.js} +1 -1
- package/dist/baloise-design-system/{p-41e1ac82bb.entry.js → p-8268d61dd6.entry.js} +1 -1
- package/dist/baloise-design-system/{p-b273a2f73a.entry.js → p-8e3412d465.entry.js} +1 -1
- package/dist/baloise-design-system/p-BFRjY4w3.js +1 -1
- package/dist/baloise-design-system/p-BRAmUyPx.system.js +1 -1
- package/dist/baloise-design-system/p-Bk7UdnZ5.system.js +1 -0
- package/dist/baloise-design-system/p-CKN3W8qn.js +1 -0
- package/dist/baloise-design-system/{p-x0vPGP6t.system.js → p-CPHPFMUC.system.js} +1 -1
- package/dist/baloise-design-system/{p-3VlTyI5Z.system.js → p-CsPrCX4f.system.js} +1 -1
- package/dist/baloise-design-system/{p-CWajPM1f.system.js → p-DLLNm5Gs.system.js} +1 -1
- package/dist/baloise-design-system/{p-BQ-ZBPGz.js → p-DvLv1IDC.js} +1 -1
- package/dist/baloise-design-system/{p-DOmwcY8I.system.js → p-DxnFuP0T.system.js} +1 -1
- package/dist/baloise-design-system/{p-BeOuHPcP.js → p-Oz8SBVmc.js} +1 -1
- package/dist/baloise-design-system/p-aDM_iThE.system.js +1 -0
- package/dist/baloise-design-system/{p-bd8e1fd900.entry.js → p-af05694fd5.entry.js} +1 -1
- package/dist/baloise-design-system/{p-2bd8d02b81.entry.js → p-b670d9cae9.entry.js} +1 -1
- package/dist/baloise-design-system/{p-46986c305d.system.entry.js → p-b6e82651ef.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-4df7edd98f.entry.js → p-bac3d30df3.entry.js} +1 -1
- package/dist/baloise-design-system/{p-1922f177ca.system.entry.js → p-bbeeefc31a.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-b75d71bb54.entry.js → p-c31dc8146b.entry.js} +1 -1
- package/dist/baloise-design-system/{p-439f4eac54.system.entry.js → p-c4a244b558.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-4f5b4d3b9e.entry.js → p-c5ae87f18e.entry.js} +1 -1
- package/dist/baloise-design-system/{p-15a9d2bdb4.entry.js → p-c8b853074f.entry.js} +1 -1
- package/dist/baloise-design-system/{p-8058e17e38.system.entry.js → p-d21134a60b.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-c6f0c6f765.system.entry.js → p-d5bd821ab7.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-d9349f5eb0.entry.js +1 -0
- package/dist/baloise-design-system/{p-7d611a8e60.entry.js → p-e6f03ecdd0.entry.js} +1 -1
- package/dist/baloise-design-system/{p-c72c874ad0.system.entry.js → p-eb2f5b22de.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-4b6f33ea10.system.entry.js → p-f2435a528c.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-2cab716afd.system.entry.js → p-fa728470a3.system.entry.js} +1 -1
- package/dist/cjs/{global-BOGOCc0T.js → app-globals-D4xKyILL.js} +4 -2
- package/dist/cjs/bal-carousel_2.cjs.entry.js +3 -3
- package/dist/cjs/{bal-dropdown_3.cjs.entry.js → bal-check_7.cjs.entry.js} +815 -9
- package/dist/cjs/bal-field_5.cjs.entry.js +3 -3
- package/dist/cjs/bal-hint_5.cjs.entry.js +3 -3
- package/dist/cjs/bal-list_8.cjs.entry.js +3 -3
- package/dist/cjs/bal-logo.cjs.entry.js +3 -3
- package/dist/cjs/bal-nav_8.cjs.entry.js +3 -3
- package/dist/cjs/bal-navbar_5.cjs.entry.js +3 -3
- package/dist/cjs/bal-pagination.cjs.entry.js +3 -3
- package/dist/cjs/bal-progress-bar.cjs.entry.js +4 -4
- package/dist/cjs/{bal-radio_2.cjs.entry.js → bal-radio_3.cjs.entry.js} +50 -0
- package/dist/cjs/bal-segment_2.cjs.entry.js +4 -4
- package/dist/cjs/bal-shape.cjs.entry.js +1 -1
- package/dist/cjs/bal-steps.cjs.entry.js +3 -3
- package/dist/cjs/bal-tab-item_2.cjs.entry.js +3 -3
- package/dist/cjs/baloise-design-system.cjs.js +2 -3
- package/dist/cjs/{breakpoints.decorator-CDD6cOv6.js → breakpoints.decorator-DPrGtqtk.js} +1 -1
- package/dist/cjs/{breakpoints.subject-DpuyBCjh.js → breakpoints.subject-C1p-ePFH.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/initialize-BzrcZo6Y.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -3
- package/dist/cjs/{tokens.esm-LV2Uuiay.js → tokens.esm-BWWYqtq4.js} +1 -1
- package/dist/cjs/{window-resize.decorator-C-w0-60C.js → window-resize.decorator-DRN0wiUR.js} +1 -1
- package/dist/collection/collection-manifest.json +15 -17
- package/dist/collection/components/bal-checkbox/bal-checkbox.js +2 -3
- package/dist/collection/utils/constants/version.constant.js +1 -1
- package/dist/esm/{global-Llrc69_N.js → app-globals-Blx--ecs.js} +4 -2
- package/dist/esm/bal-carousel_2.entry.js +3 -3
- package/dist/esm/{bal-dropdown_3.entry.js → bal-check_7.entry.js} +815 -13
- package/dist/esm/bal-field_5.entry.js +3 -3
- package/dist/esm/bal-hint_5.entry.js +3 -3
- package/dist/esm/bal-list_8.entry.js +3 -3
- package/dist/esm/bal-logo.entry.js +3 -3
- package/dist/esm/bal-nav_8.entry.js +3 -3
- package/dist/esm/bal-navbar_5.entry.js +3 -3
- package/dist/esm/bal-pagination.entry.js +3 -3
- package/dist/esm/bal-progress-bar.entry.js +4 -4
- package/dist/esm/{bal-radio_2.entry.js → bal-radio_3.entry.js} +50 -1
- package/dist/esm/bal-segment_2.entry.js +4 -4
- package/dist/esm/bal-shape.entry.js +1 -1
- package/dist/esm/bal-steps.entry.js +3 -3
- package/dist/esm/bal-tab-item_2.entry.js +3 -3
- package/dist/esm/baloise-design-system.js +2 -3
- package/dist/esm/{breakpoints.decorator-DcfCKRvu.js → breakpoints.decorator-DwhK_t2m.js} +1 -1
- package/dist/esm/{breakpoints.subject-9qUvMXOC.js → breakpoints.subject-PxavGndB.js} +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/initialize-W3od-FM9.js +1 -1
- package/dist/esm/loader.js +2 -3
- package/dist/esm/{tokens.esm-CvA86VZU.js → tokens.esm-Dk6PruGq.js} +1 -1
- package/dist/esm/{window-resize.decorator-DNh3w5KW.js → window-resize.decorator-DiNYHJee.js} +1 -1
- package/dist/esm-es5/app-globals-Blx--ecs.js +1 -0
- package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
- package/dist/esm-es5/bal-check_7.entry.js +1 -0
- package/dist/esm-es5/bal-field_5.entry.js +1 -1
- package/dist/esm-es5/bal-hint_5.entry.js +1 -1
- package/dist/esm-es5/bal-list_8.entry.js +1 -1
- package/dist/esm-es5/bal-logo.entry.js +1 -1
- package/dist/esm-es5/bal-nav_8.entry.js +1 -1
- package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
- package/dist/esm-es5/bal-pagination.entry.js +1 -1
- package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
- package/dist/esm-es5/{bal-radio_2.entry.js → bal-radio_3.entry.js} +1 -1
- package/dist/esm-es5/bal-segment_2.entry.js +1 -1
- package/dist/esm-es5/bal-shape.entry.js +1 -1
- package/dist/esm-es5/bal-steps.entry.js +1 -1
- package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
- package/dist/esm-es5/baloise-design-system.js +1 -1
- package/dist/esm-es5/{breakpoints.decorator-DcfCKRvu.js → breakpoints.decorator-DwhK_t2m.js} +1 -1
- package/dist/esm-es5/{breakpoints.subject-9qUvMXOC.js → breakpoints.subject-PxavGndB.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/initialize-W3od-FM9.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{window-resize.decorator-DNh3w5KW.js → window-resize.decorator-DiNYHJee.js} +1 -1
- package/dist/types/components.d.ts +0 -75
- package/package.json +6 -6
- package/components/bal-app2.js +0 -104
- package/components/bal-doc-app.d.ts +0 -11
- package/components/bal-doc-app.js +0 -264
- package/components/initialize.js +0 -450
- package/dist/baloise-design-system/p-00d493e589.system.entry.js +0 -1
- package/dist/baloise-design-system/p-21ea7b32f1.system.entry.js +0 -1
- package/dist/baloise-design-system/p-24185181f1.system.entry.js +0 -1
- package/dist/baloise-design-system/p-2dbbdfb785.system.entry.js +0 -1
- package/dist/baloise-design-system/p-5965694a0f.entry.js +0 -1
- package/dist/baloise-design-system/p-75f3abf19e.system.entry.js +0 -1
- package/dist/baloise-design-system/p-90d225c57c.system.entry.js +0 -1
- package/dist/baloise-design-system/p-9ca0a9bf5c.entry.js +0 -1
- package/dist/baloise-design-system/p-BvSkuJ_n.js +0 -1
- package/dist/baloise-design-system/p-BzIZLOtt.system.js +0 -1
- package/dist/baloise-design-system/p-C_qvcMEM.system.js +0 -1
- package/dist/baloise-design-system/p-DrynNwPm.system.js +0 -1
- package/dist/baloise-design-system/p-Ectc3YAG.js +0 -1
- package/dist/baloise-design-system/p-a97c5309f7.entry.js +0 -1
- package/dist/baloise-design-system/p-f217ad88a9.entry.js +0 -1
- package/dist/baloise-design-system/p-f7b16f08ab.entry.js +0 -1
- package/dist/baloise-design-system/p-fc9a46b295.entry.js +0 -1
- package/dist/cjs/app-globals-DcKvQZAC.js +0 -7
- package/dist/cjs/bal-check.cjs.entry.js +0 -55
- package/dist/cjs/bal-checkbox_2.cjs.entry.js +0 -734
- package/dist/cjs/bal-doc-app.cjs.entry.js +0 -231
- package/dist/cjs/bal-radio-icon.cjs.entry.js +0 -55
- package/dist/cjs/bal-switch.cjs.entry.js +0 -50
- package/dist/collection/components/docs/bal-doc-app/bal-doc-app.css +0 -1
- package/dist/collection/components/docs/bal-doc-app/bal-doc-app.js +0 -248
- package/dist/esm/app-globals-CIj5uAPM.js +0 -5
- package/dist/esm/bal-check.entry.js +0 -53
- package/dist/esm/bal-checkbox_2.entry.js +0 -731
- package/dist/esm/bal-doc-app.entry.js +0 -229
- package/dist/esm/bal-radio-icon.entry.js +0 -53
- package/dist/esm-es5/app-globals-CIj5uAPM.js +0 -1
- package/dist/esm-es5/bal-check.entry.js +0 -1
- package/dist/esm-es5/bal-checkbox_2.entry.js +0 -1
- package/dist/esm-es5/bal-doc-app.entry.js +0 -1
- package/dist/esm-es5/bal-dropdown_3.entry.js +0 -1
- package/dist/esm-es5/bal-radio-icon.entry.js +0 -1
- package/dist/esm-es5/bal-switch.entry.js +0 -1
- package/dist/esm-es5/global-Llrc69_N.js +0 -1
- package/dist/types/components/docs/bal-doc-app/bal-doc-app.d.ts +0 -21
- package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/icons/src/index.d.ts +0 -82
- /package/dist/baloise-design-system/{p-CvA86VZU.js → p-Dk6PruGq.js} +0 -0
- /package/dist/baloise-design-system/{p-BpG6m494.system.js → p-Nqmo3uHl.system.js} +0 -0
- /package/dist/esm-es5/{tokens.esm-CvA86VZU.js → tokens.esm-Dk6PruGq.js} +0 -0
|
@@ -1,734 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-feA4skrY.js');
|
|
4
|
-
var tslib_es6 = require('./tslib.es6-DrfCPgT9.js');
|
|
5
|
-
var aria = require('./aria-BzkqcV7W.js');
|
|
6
|
-
var attributes = require('./attributes-Cp0kpySW.js');
|
|
7
|
-
var bem = require('./bem-p0PWVN8n.js');
|
|
8
|
-
var focusVisible = require('./focus-visible-DFZa8IIA.js');
|
|
9
|
-
var form = require('./form-BSlIiqcR.js');
|
|
10
|
-
var formInput = require('./form-input-BwFB4Rej.js');
|
|
11
|
-
var helpers = require('./helpers-HuaiWXrB.js');
|
|
12
|
-
var log = require('./log-CXDMiw7o.js');
|
|
13
|
-
var elementStates_decorator = require('./element-states.decorator-BG2oNUsO.js');
|
|
14
|
-
var keyboard_helpers = require('./keyboard.helpers-BkZpVT-9.js');
|
|
15
|
-
var array = require('./array-Db63Hhl1.js');
|
|
16
|
-
var focus_decorator = require('./focus.decorator-BL2kLsNv.js');
|
|
17
|
-
var mutation_decorator = require('./mutation.decorator-BolUYaKD.js');
|
|
18
|
-
require('./browser-BwmkTmm8.js');
|
|
19
|
-
require('./config.utils-Civnz2jT.js');
|
|
20
|
-
require('./listener-DspXpqzY.js');
|
|
21
|
-
require('./index-BZ67Dcnb.js');
|
|
22
|
-
require('./_commonjsHelpers-BJu3ubxk.js');
|
|
23
|
-
require('./index-BobQkZjn.js');
|
|
24
|
-
|
|
25
|
-
const balCheckboxCss = "@media (hover: hover)and (pointer: fine){.bal-checkbox.bal-focused{-webkit-box-shadow:var(--bal-focus-shadow) !important;box-shadow:var(--bal-focus-shadow) !important}}:root{--bal-checkbox-symbol-size:1.5rem;--bal-checkbox-symbol-border-width:2px;--bal-checkbox-symbol-background:transparent;--bal-checkbox-label-min-height:1.5rem;--bal-checkbox-button-background-hover:var(--bal-color-grey-2);--bal-checkbox-button-background-active:var(--bal-color-grey-2);--bal-checkbox-button-background-checked:var(--bal-color-primary);--bal-checkbox-button-background-checked-hover:var(--bal-color-light-blue-5);--bal-checkbox-button-background-checked-active:var(--bal-color-primary-6);--bal-checkbox-button-background-invalid:var(--bal-color-danger-1);--bal-checkbox-button-background-invalid-hover:var(--bal-color-danger-1);--bal-checkbox-button-background-invalid-active:var(--bal-color-danger-1);--bal-checkbox-button-background-invalid-checked:var(--bal-color-border-danger);--bal-checkbox-button-background-invalid-checked-hover:var(--bal-color-danger-5);--bal-checkbox-button-background-invalid-checked-active:var(--bal-color-danger-6);--bal-checkbox-button-background-disabled-hover-active:var(--bal-color-grey-2);--bal-checkbox-button-background-disabled-checked-hover-active:var(--bal-color-border-grey-dark);--bal-checkbox-button-background:transparent;--bal-checkbox-button-background-checked-green:var(--bal-color-green-1);--bal-checkbox-button-background-checked-purple:var(--bal-color-purple-1);--bal-checkbox-button-background-checked-red:var(--bal-color-red-1);--bal-checkbox-button-background-checked-yellow:var(--bal-color-yellow-1);--bal-checkbox-button-background-disabled:var(--bal-color-grey-1);--bal-checkbox-button-background-hover:var(--bal-color-grey-1);--bal-checkbox-button-border-color:var(--bal-color-primary);--bal-checkbox-button-border-color-hover:var(--bal-color-light-blue-5);--bal-checkbox-button-border-color-active:var(--bal-color-primary-6);--bal-checkbox-button-border-color-invalid:var(--bal-color-border-danger);--bal-checkbox-button-border-color-invalid-hover:var(--bal-color-danger-5);--bal-checkbox-button-border-color-invalid-active:var(--bal-color-danger-6);--bal-checkbox-button-border-color-invalid-checked:var(--bal-color-border-danger);--bal-checkbox-button-border-color-invalid-checked-hover:var(--bal-color-danger-5);--bal-checkbox-button-border-color-invalid-checked-active:var(--bal-color-danger-6);--bal-checkbox-button-border-color-disabled-hover-active:var(--bal-color-border-grey-dark);--bal-checkbox-button-border-color-disabled-checked-hover-active:var(--bal-color-border-grey-dark);--bal-checkbox-tile-background:transparent;--bal-checkbox-tile-background-hover:var(--bal-color-grey-1);--bal-checkbox-tile-background-disabled:var(--bal-color-grey-1);--bal-checkbox-tile-background-invalid-hover:var(--bal-color-danger-1);--bal-checkbox-tile-background-invalid-active:var(--bal-color-danger-1);--bal-checkbox-tile-background-checked-green:var(--bal-color-green-1);--bal-checkbox-tile-background-checked-purple:var(--bal-color-purple-1);--bal-checkbox-tile-background-checked-red:var(--bal-color-red-1);--bal-checkbox-tile-background-checked-yellow:var(--bal-color-yellow-1);--bal-checkbox-tile-border-style:var(--bal-form-field-control-border-style);--bal-checkbox-tile-border-radius:var(--bal-form-field-control-radius);--bal-checkbox-tile-border-width:var(--bal-form-field-control-border-width);--bal-checkbox-tile-padding:var(--bal-text-size-medium);--bal-checkbox-tile-border-color:var(--bal-color-border);--bal-checkbox-tile-border-color-hover:var(--bal-color-border-primary-hovered);--bal-checkbox-tile-border-color-active:var(--bal-color-border-primary-pressed);--bal-checkbox-tile-border-color-invalid-hover:var(--bal-color-border-danger-hovered);--bal-checkbox-tile-border-color-invalid-active:var(--bal-color-border-danger-pressed);--bal-checkbox-tile-border-color-checked:var(--bal-color-border-primary);--bal-checkbox-tile-border-color-invalid:var(--bal-color-border-danger);--bal-checkbox-tile-border-color-disabled:var(--bal-color-border-grey-dark)}.bal-checkbox{position:relative;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-align:center;align-items:center;outline:none;min-width:var(--bal-checkbox-symbol-size);border-radius:var(--bal-radius-normal);cursor:pointer}.bal-checkbox .bal-checkbox__label{cursor:pointer}.bal-checkbox--invisible{position:absolute !important;left:0;top:0;margin:0;padding:0;opacity:0;outline:0;border:none;width:1px;height:1px;clip:rect(1px, 1px, 1px, 1px);overflow:hidden}.bal-checkbox.bal-checkbox--flat{min-height:var(--bal-checkbox-symbol-size)}.bal-checkbox:not(.bal-checkbox--flat){min-height:3rem}.bal-checkbox--invalid{color:var(--bal-form-field-label-danger-color)}.bal-checkbox--disabled,.bal-checkbox--disabled .bal-checkbox__label{color:var(--bal-form-field-label-disabled-color);cursor:default}.bal-checkbox__input{position:absolute !important;left:0;top:0;margin:0;padding:0;opacity:0;outline:0;border:none;width:1px;height:1px;clip:rect(1px, 1px, 1px, 1px);overflow:hidden;width:100%;height:100%}.bal-checkbox__label{display:-ms-flexbox;display:flex;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-align:center;align-items:center;gap:.5rem;-ms-flex-direction:row;flex-direction:row}.bal-checkbox__label__text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:left;contain:layout style;font-family:var(--bal-font-family-text);padding-top:.25rem;padding-bottom:.25rem;width:100%}.bal-checkbox__label__text--hidden{display:none}.bal-checkbox__label__icon{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}@media (hover: hover)and (pointer: fine){.bal-checkbox:not(.bal-checkbox--button):not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--hovered .bal-checkbox__label__text,.bal-checkbox:not(.bal-checkbox--button):not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):hover .bal-checkbox__label__text{color:var(--bal-color-text-primary-hovered)}.bal-checkbox:not(.bal-checkbox--button):not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--hovered .bal-checkbox__label__icon,.bal-checkbox:not(.bal-checkbox--button):not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):hover .bal-checkbox__label__icon{color:var(--bal-color-text-primary-hovered)}}.bal-checkbox:not(.bal-checkbox--button):not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--pressed .bal-checkbox__label__text,.bal-checkbox:not(.bal-checkbox--button):not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):active .bal-checkbox__label__text{color:var(--bal-color-text-primary-pressed)}.bal-checkbox:not(.bal-checkbox--button):not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--pressed .bal-checkbox__label__icon,.bal-checkbox:not(.bal-checkbox--button):not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):active .bal-checkbox__label__icon{color:var(--bal-color-text-primary-pressed)}@media (hover: hover)and (pointer: fine){.bal-checkbox--invalid:not(.bal-checkbox--button):not(.bal-checkbox--disabled).bal-checkbox--hovered .bal-checkbox__label__text,.bal-checkbox--invalid:not(.bal-checkbox--button):not(.bal-checkbox--disabled):hover .bal-checkbox__label__text{color:var(--bal-color-text-danger-hovered)}.bal-checkbox--invalid:not(.bal-checkbox--button):not(.bal-checkbox--disabled).bal-checkbox--hovered .bal-checkbox__label__icon,.bal-checkbox--invalid:not(.bal-checkbox--button):not(.bal-checkbox--disabled):hover .bal-checkbox__label__icon{color:var(--bal-color-text-danger-hovered)}}.bal-checkbox--invalid:not(.bal-checkbox--button):not(.bal-checkbox--disabled).bal-checkbox--pressed .bal-checkbox__label__text,.bal-checkbox--invalid:not(.bal-checkbox--button):not(.bal-checkbox--disabled):active .bal-checkbox__label__text{color:var(--bal-color-text-danger-pressed)}.bal-checkbox--invalid:not(.bal-checkbox--button):not(.bal-checkbox--disabled).bal-checkbox--pressed .bal-checkbox__label__icon,.bal-checkbox--invalid:not(.bal-checkbox--button):not(.bal-checkbox--disabled):active .bal-checkbox__label__icon{color:var(--bal-color-text-danger-pressed)}.bal-checkbox--button{-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--bal-space-x-small);-ms-flex-pack:center;justify-content:center;-ms-flex-align:start;align-items:flex-start;padding-left:.75rem;padding-right:.75rem;min-width:3rem;border-width:2px;border-style:var(--bal-form-field-control-border-style);border-radius:var(--bal-form-field-control-radius);border-color:var(--bal-checkbox-button-border-color)}.bal-checkbox--button.bal-checkbox--checked{background:var(--bal-checkbox-button-background-checked);color:var(--bal-color-white)}.bal-checkbox--button.bal-checkbox--checked .bal-checkbox__label__text,.bal-checkbox--button.bal-checkbox--checked .bal-checkbox__label__text .link{color:var(--bal-color-white)}.bal-checkbox--button.bal-checkbox--invalid{border-color:var(--bal-color-border-danger);color:var(--bal-color-text-danger-hovered);background:var(--bal-color-danger-1)}.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked{color:var(--bal-color-white);background:var(--bal-color-border-danger)}.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked .bal-checkbox__label__text,.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked .bal-checkbox__label__text .link{color:var(--bal-color-white)}.bal-checkbox--button.bal-checkbox--disabled{border-color:var(--bal-color-grey-4);background:var(--bal-color-grey-2)}.bal-checkbox--button.bal-checkbox--disabled .bal-checkbox__label__text{color:var(--bal-color-text-grey)}.bal-checkbox--button.bal-checkbox--disabled.bal-checkbox--checked{background:var(--bal-color-grey-4);color:var(--bal-color-white)}.bal-checkbox--button.bal-checkbox--disabled.bal-checkbox--checked .bal-checkbox__label__text,.bal-checkbox--button.bal-checkbox--disabled.bal-checkbox--checked .bal-checkbox__label__text .link{color:var(--bal-color-white)}@media (hover: hover)and (pointer: fine){.bal-checkbox--button:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--hovered,.bal-checkbox--button:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):hover{background:var(--bal-color-grey-2);border-color:var(--bal-color-border-primary-hovered)}.bal-checkbox--button:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--hovered .bal-checkbox__label__text,.bal-checkbox--button:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):hover .bal-checkbox__label__text{color:var(--bal-color-text-primary-hovered)}}.bal-checkbox--button:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--pressed,.bal-checkbox--button:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):active{background:var(--bal-color-grey-2);border-color:var(--bal-color-border-primary-pressed)}.bal-checkbox--button:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--pressed .bal-checkbox__label__text,.bal-checkbox--button:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):active .bal-checkbox__label__text{color:var(--bal-color-text-primary-pressed)}@media (hover: hover)and (pointer: fine){.bal-checkbox--button.bal-checkbox--checked:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--hovered,.bal-checkbox--button.bal-checkbox--checked:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):hover{background:var(--bal-color-border-primary-hovered);border-color:var(--bal-color-border-primary-hovered)}.bal-checkbox--button.bal-checkbox--checked:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--hovered .bal-checkbox__label__text,.bal-checkbox--button.bal-checkbox--checked:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):hover .bal-checkbox__label__text{color:var(--bal-color-white)}}.bal-checkbox--button.bal-checkbox--checked:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--pressed,.bal-checkbox--button.bal-checkbox--checked:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):active{background:var(--bal-color-border-primary-pressed);border-color:var(--bal-color-border-primary-pressed)}.bal-checkbox--button.bal-checkbox--checked:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--pressed .bal-checkbox__label__text,.bal-checkbox--button.bal-checkbox--checked:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):active .bal-checkbox__label__text{color:var(--bal-color-white)}@media (hover: hover)and (pointer: fine){.bal-checkbox--button.bal-checkbox--invalid:not(.bal-checkbox--disabled).bal-checkbox--hovered,.bal-checkbox--button.bal-checkbox--invalid:not(.bal-checkbox--disabled):hover{background:var(--bal-color-danger-1);border-color:var(--bal-color-border-danger-hovered)}.bal-checkbox--button.bal-checkbox--invalid:not(.bal-checkbox--disabled).bal-checkbox--hovered .bal-checkbox__label__text,.bal-checkbox--button.bal-checkbox--invalid:not(.bal-checkbox--disabled):hover .bal-checkbox__label__text{color:var(--bal-color-text-danger-hovered)}}.bal-checkbox--button.bal-checkbox--invalid:not(.bal-checkbox--disabled).bal-checkbox--pressed,.bal-checkbox--button.bal-checkbox--invalid:not(.bal-checkbox--disabled):active{background:var(--bal-color-danger-1);border-color:var(--bal-color-border-danger-pressed)}.bal-checkbox--button.bal-checkbox--invalid:not(.bal-checkbox--disabled).bal-checkbox--pressed .bal-checkbox__label__text,.bal-checkbox--button.bal-checkbox--invalid:not(.bal-checkbox--disabled):active .bal-checkbox__label__text{color:var(--bal-color-text-danger-pressed)}@media (hover: hover)and (pointer: fine){.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked:not(.bal-checkbox--disabled).bal-checkbox--hovered,.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked:not(.bal-checkbox--disabled):hover{background:var(--bal-color-border-danger-hovered);border-color:var(--bal-color-border-danger-hovered)}.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked:not(.bal-checkbox--disabled).bal-checkbox--hovered .bal-checkbox__label__text,.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked:not(.bal-checkbox--disabled):hover .bal-checkbox__label__text{color:var(--bal-color-white)}}.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked:not(.bal-checkbox--disabled).bal-checkbox--pressed,.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked:not(.bal-checkbox--disabled):active{background:var(--bal-color-border-danger-pressed);border-color:var(--bal-color-border-danger-pressed)}.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked:not(.bal-checkbox--disabled).bal-checkbox--pressed .bal-checkbox__label__text,.bal-checkbox--button.bal-checkbox--invalid.bal-checkbox--checked:not(.bal-checkbox--disabled):active .bal-checkbox__label__text{color:var(--bal-color-white)}.bal-checkbox--tile{display:block;-ms-flex:0 0 100%;flex:0 0 100%;background:var(--bal-checkbox-tile-background);border-style:var(--bal-checkbox-tile-border-style);border-radius:var(--bal-checkbox-tile-border-radius);border-width:var(--bal-checkbox-tile-border-width);border-color:var(--bal-checkbox-tile-border-color);padding:var(--bal-checkbox-tile-padding)}.bal-checkbox--tile .bal-checkbox__label{height:100%;-ms-flex-align:stretch;align-items:stretch}.bal-checkbox--tile.bal-checkbox--checked{border-color:var(--bal-checkbox-tile-border-color-checked)}.bal-checkbox--tile.bal-checkbox--invalid{border-color:var(--bal-checkbox-tile-border-color-invalid)}.bal-checkbox--tile.bal-checkbox--disabled{background:var(--bal-checkbox-tile-background-disabled);border-color:var(--bal-checkbox-tile-border-color-disabled);cursor:default}@media (hover: hover)and (pointer: fine){.bal-checkbox--tile:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--hovered,.bal-checkbox--tile:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):hover{background:var(--bal-checkbox-tile-background-hover);border-color:var(--bal-checkbox-tile-border-color-hover)}}.bal-checkbox--tile:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid).bal-checkbox--pressed,.bal-checkbox--tile:not(.bal-checkbox--disabled):not(.bal-checkbox--invalid):active{background:var(--bal-checkbox-tile-background-hover);border-color:var(--bal-checkbox-tile-border-color-active)}@media (hover: hover)and (pointer: fine){.bal-checkbox--tile.bal-checkbox--invalid:not(.bal-checkbox--disabled).bal-checkbox--hovered,.bal-checkbox--tile.bal-checkbox--invalid:not(.bal-checkbox--disabled):hover{background:var(--bal-checkbox-tile-background-invalid-hover);border-color:var(--bal-checkbox-tile-border-color-invalid-hover)}}.bal-checkbox--tile.bal-checkbox--invalid:not(.bal-checkbox--disabled).bal-checkbox--pressed,.bal-checkbox--tile.bal-checkbox--invalid:not(.bal-checkbox--disabled):active{background:var(--bal-checkbox-tile-background-invalid-active);border-color:var(--bal-checkbox-tile-border-color-invalid-active)}.bal-checkbox--tile-color-green:not(.bal-checkbox--disabled).bal-checkbox--checked,.bal-checkbox--tile-color-green:not(.bal-checkbox--disabled).bal-checkbox--checked.bal-checkbox--hovered,.bal-checkbox--tile-color-green:not(.bal-checkbox--disabled).bal-checkbox--checked:hover{background:var(--bal-checkbox-tile-background-checked-green)}.bal-checkbox--tile-color-red:not(.bal-checkbox--disabled).bal-checkbox--checked,.bal-checkbox--tile-color-red:not(.bal-checkbox--disabled).bal-checkbox--checked.bal-checkbox--hovered,.bal-checkbox--tile-color-red:not(.bal-checkbox--disabled).bal-checkbox--checked:hover{background:var(--bal-checkbox-tile-background-checked-red)}.bal-checkbox--tile-color-purple:not(.bal-checkbox--disabled).bal-checkbox--checked,.bal-checkbox--tile-color-purple:not(.bal-checkbox--disabled).bal-checkbox--checked.bal-checkbox--hovered,.bal-checkbox--tile-color-purple:not(.bal-checkbox--disabled).bal-checkbox--checked:hover{background:var(--bal-checkbox-tile-background-checked-purple)}.bal-checkbox--tile-color-yellow:not(.bal-checkbox--disabled).bal-checkbox--checked,.bal-checkbox--tile-color-yellow:not(.bal-checkbox--disabled).bal-checkbox--checked.bal-checkbox--hovered,.bal-checkbox--tile-color-yellow:not(.bal-checkbox--disabled).bal-checkbox--checked:hover{background:var(--bal-checkbox-tile-background-checked-yellow)}@media screen and (min-width: 769px),print{.bal-checkbox--column-2{-ms-flex:0 0 calc(50% - var(--bal-space-normal)*1/2);flex:0 0 calc(50% - var(--bal-space-normal)*1/2)}.bal-checkbox--column-3{-ms-flex:0 0 calc(33.3333333333% - var(--bal-space-normal)*2/3);flex:0 0 calc(33.3333333333% - var(--bal-space-normal)*2/3)}.bal-checkbox--column-4{-ms-flex:0 0 calc(25% - var(--bal-space-normal)*3/4);flex:0 0 calc(25% - var(--bal-space-normal)*3/4)}}@media screen and (max-width: 768px){.bal-checkbox--column-mobile-2{-ms-flex:0 0 calc(50% - var(--bal-space-normal)*1/2);flex:0 0 calc(50% - var(--bal-space-normal)*1/2)}.bal-checkbox--column-mobile-3{-ms-flex:0 0 calc(33.3333333333% - var(--bal-space-normal)*2/3);flex:0 0 calc(33.3333333333% - var(--bal-space-normal)*2/3)}.bal-checkbox--column-mobile-4{-ms-flex:0 0 calc(25% - var(--bal-space-normal)*3/4);flex:0 0 calc(25% - var(--bal-space-normal)*3/4)}}@media screen and (min-width: 769px),print{.bal-checkbox--column-tablet-2{-ms-flex:0 0 calc(50% - var(--bal-space-normal)*1/2);flex:0 0 calc(50% - var(--bal-space-normal)*1/2)}.bal-checkbox--column-tablet-3{-ms-flex:0 0 calc(33.3333333333% - var(--bal-space-normal)*2/3);flex:0 0 calc(33.3333333333% - var(--bal-space-normal)*2/3)}.bal-checkbox--column-tablet-4{-ms-flex:0 0 calc(25% - var(--bal-space-normal)*3/4);flex:0 0 calc(25% - var(--bal-space-normal)*3/4)}}@media screen and (min-width: 1024px){.bal-checkbox--column-2{-ms-flex:0 0 calc(50% - var(--bal-space-normal)*1/2);flex:0 0 calc(50% - var(--bal-space-normal)*1/2)}.bal-checkbox--column-3{-ms-flex:0 0 calc(33.3333333333% - var(--bal-space-normal)*2/3);flex:0 0 calc(33.3333333333% - var(--bal-space-normal)*2/3)}.bal-checkbox--column-4{-ms-flex:0 0 calc(25% - var(--bal-space-normal)*3/4);flex:0 0 calc(25% - var(--bal-space-normal)*3/4)}}";
|
|
26
|
-
|
|
27
|
-
const Checkbox = class {
|
|
28
|
-
constructor(hostRef) {
|
|
29
|
-
index.registerInstance(this, hostRef);
|
|
30
|
-
this.balFocus = index.createEvent(this, "balFocus");
|
|
31
|
-
this.balBlur = index.createEvent(this, "balBlur");
|
|
32
|
-
this.balChange = index.createEvent(this, "balChange");
|
|
33
|
-
this.inputId = `bal-cb-${checkboxIds++}`;
|
|
34
|
-
this.inheritedAttributes = {};
|
|
35
|
-
this.keyboardMode = true;
|
|
36
|
-
this.hasLabel = true;
|
|
37
|
-
this.focused = false;
|
|
38
|
-
this.ariaForm = form.defaultBalAriaForm;
|
|
39
|
-
/**
|
|
40
|
-
* Track focus state
|
|
41
|
-
* If `true` checkbox needs to remain focused
|
|
42
|
-
*/
|
|
43
|
-
this.wasFocused = false;
|
|
44
|
-
this.outerElementState = {
|
|
45
|
-
hovered: false,
|
|
46
|
-
pressed: false,
|
|
47
|
-
};
|
|
48
|
-
this.innerElementState = {
|
|
49
|
-
hovered: false,
|
|
50
|
-
pressed: false,
|
|
51
|
-
};
|
|
52
|
-
this.mergedElementState = {
|
|
53
|
-
hovered: false,
|
|
54
|
-
pressed: false,
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* PUBLIC PROPERTY API
|
|
58
|
-
* ------------------------------------------------------
|
|
59
|
-
*/
|
|
60
|
-
/**
|
|
61
|
-
* The name of the control, which is submitted with the form data.
|
|
62
|
-
*/
|
|
63
|
-
this.name = this.inputId;
|
|
64
|
-
/**
|
|
65
|
-
* Label of the radio item.
|
|
66
|
-
*/
|
|
67
|
-
this.label = '';
|
|
68
|
-
/**
|
|
69
|
-
* If `true` the checkbox has no label
|
|
70
|
-
*/
|
|
71
|
-
this.labelHidden = false;
|
|
72
|
-
/**
|
|
73
|
-
* If `true` the control is no padding
|
|
74
|
-
*/
|
|
75
|
-
this.flat = false;
|
|
76
|
-
/**
|
|
77
|
-
* Defines the layout of the checkbox button
|
|
78
|
-
*/
|
|
79
|
-
this.interface = 'checkbox';
|
|
80
|
-
/**
|
|
81
|
-
* A DOMString representing the value of the checkbox. This is not displayed on the
|
|
82
|
-
* client-side, but on the server this is the value given to the data
|
|
83
|
-
* submitted with the checkbox's name.
|
|
84
|
-
*/
|
|
85
|
-
this.value = 'on';
|
|
86
|
-
/**
|
|
87
|
-
* If `true`, the checkbox is selected.
|
|
88
|
-
*/
|
|
89
|
-
this.checked = false;
|
|
90
|
-
this.initialValue = false;
|
|
91
|
-
/**
|
|
92
|
-
* If `true`, the element is not mutable, focusable, or even submitted with the form. The user can neither edit nor focus on the control, nor its form control descendants.
|
|
93
|
-
*/
|
|
94
|
-
this.disabled = false;
|
|
95
|
-
/**
|
|
96
|
-
* If `true` the element can not mutated, meaning the user can not edit the control.
|
|
97
|
-
*/
|
|
98
|
-
this.readonly = false;
|
|
99
|
-
/**
|
|
100
|
-
* If `true`, the user must fill in a value before submitting a form.
|
|
101
|
-
*/
|
|
102
|
-
this.required = false;
|
|
103
|
-
/**
|
|
104
|
-
* If `true`, in Angular reactive forms the control will not be set invalid
|
|
105
|
-
*/
|
|
106
|
-
this.autoInvalidOff = false;
|
|
107
|
-
/**
|
|
108
|
-
* If `true`, the value will not be send with a form submit
|
|
109
|
-
*/
|
|
110
|
-
this.nonSubmit = false;
|
|
111
|
-
/**
|
|
112
|
-
* If `true` the component gets a invalid style.
|
|
113
|
-
*/
|
|
114
|
-
this.invalid = false;
|
|
115
|
-
/**
|
|
116
|
-
* @internal
|
|
117
|
-
*/
|
|
118
|
-
this.hovered = false;
|
|
119
|
-
/**
|
|
120
|
-
* @internal
|
|
121
|
-
*/
|
|
122
|
-
this.pressed = false;
|
|
123
|
-
/**
|
|
124
|
-
* @internal
|
|
125
|
-
*/
|
|
126
|
-
this.colSize = 1;
|
|
127
|
-
/**
|
|
128
|
-
* @internal
|
|
129
|
-
*/
|
|
130
|
-
this.colSizeTablet = 1;
|
|
131
|
-
/**
|
|
132
|
-
* @internal
|
|
133
|
-
*/
|
|
134
|
-
this.colSizeMobile = 1;
|
|
135
|
-
this.setChecked = (state) => {
|
|
136
|
-
this.checked = state;
|
|
137
|
-
this.balChange.emit(this.checked);
|
|
138
|
-
};
|
|
139
|
-
this.toggleChecked = (ev) => {
|
|
140
|
-
ev.preventDefault();
|
|
141
|
-
this.setFocus();
|
|
142
|
-
this.setChecked(!this.checked);
|
|
143
|
-
};
|
|
144
|
-
this.onClick = (ev) => {
|
|
145
|
-
if (this.disabled) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const element = ev.target;
|
|
149
|
-
if (element && element.href) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (this.wasFocused) {
|
|
153
|
-
this.focused = true;
|
|
154
|
-
}
|
|
155
|
-
this.toggleChecked(ev);
|
|
156
|
-
};
|
|
157
|
-
this.onFocus = (ev) => {
|
|
158
|
-
if (this.disabled || this.readonly) {
|
|
159
|
-
this.focused = false;
|
|
160
|
-
return formInput.stopEventBubbling(ev);
|
|
161
|
-
}
|
|
162
|
-
this.balFocus.emit(ev);
|
|
163
|
-
if (this.keyboardMode) {
|
|
164
|
-
this.focused = true;
|
|
165
|
-
this.wasFocused = true;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
this.onBlur = (ev) => {
|
|
169
|
-
if (this.disabled || this.readonly) {
|
|
170
|
-
return formInput.stopEventBubbling(ev);
|
|
171
|
-
}
|
|
172
|
-
this.balBlur.emit(ev);
|
|
173
|
-
this.focused = false;
|
|
174
|
-
};
|
|
175
|
-
this.onPointerDown = () => (this.keyboardMode = false);
|
|
176
|
-
this.onKeydown = (ev) => {
|
|
177
|
-
if (!keyboard_helpers.isSpaceKey(ev)) {
|
|
178
|
-
this.wasFocused = false;
|
|
179
|
-
}
|
|
180
|
-
this.keyboardMode = focusVisible.FOCUS_KEYS.includes(ev.key);
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
createLogger(log) {
|
|
184
|
-
this.log = log;
|
|
185
|
-
}
|
|
186
|
-
hoveredChanged() {
|
|
187
|
-
this.innerElementState = {
|
|
188
|
-
hovered: this.hovered,
|
|
189
|
-
pressed: this.pressed,
|
|
190
|
-
};
|
|
191
|
-
this.mergeElementState();
|
|
192
|
-
}
|
|
193
|
-
pressedChanged() {
|
|
194
|
-
this.innerElementState = {
|
|
195
|
-
hovered: this.hovered,
|
|
196
|
-
pressed: this.pressed,
|
|
197
|
-
};
|
|
198
|
-
this.mergeElementState();
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* LIFECYCLE
|
|
202
|
-
* ------------------------------------------------------
|
|
203
|
-
*/
|
|
204
|
-
connectedCallback() {
|
|
205
|
-
this.hoveredChanged();
|
|
206
|
-
if (this.group) {
|
|
207
|
-
this.updateState();
|
|
208
|
-
this.group.addEventListener('balChange', () => this.updateState());
|
|
209
|
-
}
|
|
210
|
-
this.initialValue = this.checked;
|
|
211
|
-
this.el.addEventListener('keydown', this.onKeydown);
|
|
212
|
-
this.el.addEventListener('touchstart', this.onPointerDown);
|
|
213
|
-
this.el.addEventListener('mousedown', this.onPointerDown);
|
|
214
|
-
}
|
|
215
|
-
componentWillLoad() {
|
|
216
|
-
this.inheritedAttributes = attributes.inheritAttributes(this.el, ['aria-label', 'tabindex', 'title']);
|
|
217
|
-
}
|
|
218
|
-
componentWillRender() {
|
|
219
|
-
this.interactionChildElements.forEach(el => {
|
|
220
|
-
el.disabled = this.disabled || this.readonly;
|
|
221
|
-
el.invalid = this.invalid;
|
|
222
|
-
el.checked = this.checked;
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
disconnectedCallback() {
|
|
226
|
-
if (this.group) {
|
|
227
|
-
this.group.removeEventListener('balChange', () => this.updateState());
|
|
228
|
-
}
|
|
229
|
-
this.el.removeEventListener('keydown', this.onKeydown);
|
|
230
|
-
this.el.removeEventListener('touchstart', this.onPointerDown);
|
|
231
|
-
this.el.removeEventListener('mousedown', this.onPointerDown);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* LISTENERS
|
|
235
|
-
* ------------------------------------------------------
|
|
236
|
-
*/
|
|
237
|
-
listenOnClick(ev) {
|
|
238
|
-
if ((this.disabled || this.readonly) &&
|
|
239
|
-
ev.target &&
|
|
240
|
-
(ev.target === this.el || helpers.isDescendant(this.el, ev.target))) {
|
|
241
|
-
formInput.stopEventBubbling(ev);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
resetHandler(ev) {
|
|
245
|
-
const formElement = ev.target;
|
|
246
|
-
if (formElement === null || formElement === void 0 ? void 0 : formElement.contains(this.el)) {
|
|
247
|
-
this.checked = this.initialValue;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
elementStateListener(info) {
|
|
251
|
-
this.outerElementState = info;
|
|
252
|
-
this.mergeElementState();
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* PUBLIC METHODS
|
|
256
|
-
* ------------------------------------------------------
|
|
257
|
-
*/
|
|
258
|
-
/**
|
|
259
|
-
* Sets the focus on the checkbox input element.
|
|
260
|
-
*/
|
|
261
|
-
async setFocus() {
|
|
262
|
-
formInput.inputSetFocus(this);
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Sets blur on the native `input`. Use this method instead of the global
|
|
266
|
-
* `input.blur()`.
|
|
267
|
-
* @internal
|
|
268
|
-
*/
|
|
269
|
-
async setBlur() {
|
|
270
|
-
formInput.inputSetBlur(this);
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Returns the native `<input>` element used under the hood.
|
|
274
|
-
*/
|
|
275
|
-
getInputElement() {
|
|
276
|
-
return Promise.resolve(this.nativeInput);
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Options of the tab like label, value etc.
|
|
280
|
-
*/
|
|
281
|
-
async getOption() {
|
|
282
|
-
return this.option;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* @internal
|
|
286
|
-
*/
|
|
287
|
-
async updateState() {
|
|
288
|
-
if (this.group && this.group.control && Array.isArray(this.group.value)) {
|
|
289
|
-
const newChecked = this.group.value.includes(this.value);
|
|
290
|
-
if (newChecked !== this.checked) {
|
|
291
|
-
this.checked = newChecked;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* @internal
|
|
297
|
-
*/
|
|
298
|
-
async setAriaForm(ariaForm) {
|
|
299
|
-
this.ariaForm = Object.assign({}, ariaForm);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* GETTERS
|
|
303
|
-
* ------------------------------------------------------
|
|
304
|
-
*/
|
|
305
|
-
get group() {
|
|
306
|
-
return this.el.closest('bal-checkbox-group');
|
|
307
|
-
}
|
|
308
|
-
get interactionChildElements() {
|
|
309
|
-
return Array.from(this.el.querySelectorAll('bal-check, bal-switch, bal-icon'));
|
|
310
|
-
}
|
|
311
|
-
get option() {
|
|
312
|
-
return {
|
|
313
|
-
name: this.name,
|
|
314
|
-
value: this.value,
|
|
315
|
-
checked: this.checked,
|
|
316
|
-
label: this.label,
|
|
317
|
-
labelHidden: this.labelHidden,
|
|
318
|
-
flat: this.flat,
|
|
319
|
-
interface: this.interface,
|
|
320
|
-
disabled: this.disabled,
|
|
321
|
-
readonly: this.readonly,
|
|
322
|
-
required: this.required,
|
|
323
|
-
nonSubmit: this.nonSubmit,
|
|
324
|
-
invalid: this.invalid,
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* EVENT HANDLERS
|
|
329
|
-
* ------------------------------------------------------
|
|
330
|
-
*/
|
|
331
|
-
mergeElementState() {
|
|
332
|
-
this.mergedElementState = {
|
|
333
|
-
hovered: this.outerElementState.hovered || this.innerElementState.hovered,
|
|
334
|
-
pressed: this.outerElementState.pressed || this.innerElementState.pressed,
|
|
335
|
-
};
|
|
336
|
-
this.interactionChildElements.forEach(el => {
|
|
337
|
-
el.hovered = this.mergedElementState.hovered;
|
|
338
|
-
el.pressed = this.mergedElementState.pressed;
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* RENDER
|
|
343
|
-
* ------------------------------------------------------
|
|
344
|
-
*/
|
|
345
|
-
render() {
|
|
346
|
-
const block = bem.BEM.block('checkbox');
|
|
347
|
-
const inputEl = block.element('input');
|
|
348
|
-
const labelEl = block.element('label');
|
|
349
|
-
const labelTextEl = labelEl.element('text');
|
|
350
|
-
const labelIconEl = labelEl.element('icon');
|
|
351
|
-
const focused = this.focused && this.buttonTabindex !== -1;
|
|
352
|
-
const inputAttributes = this.inheritedAttributes;
|
|
353
|
-
if (this.buttonTabindex !== undefined) {
|
|
354
|
-
inputAttributes.tabIndex = this.buttonTabindex;
|
|
355
|
-
}
|
|
356
|
-
const hasFormControl = !this.nonSubmit;
|
|
357
|
-
const id = this.ariaForm.controlId || this.inputId;
|
|
358
|
-
const labelId = this.ariaForm.labelId || null;
|
|
359
|
-
const LabelTag = hasFormControl ? 'label' : 'span';
|
|
360
|
-
const Icon = this.interface === 'switch' ? 'bal-switch' : 'bal-check';
|
|
361
|
-
return (index.h(index.Host, { key: 'eaa9cf2ba9de2a203b98515939ff117c89dc16cf', "aria-checked": `${this.checked}`, "aria-disabled": aria.ariaBooleanToString(this.disabled), "aria-invalid": this.invalid === true ? 'true' : 'false', "aria-hidden": aria.ariaBooleanToString(this.disabled || this.nonSubmit), "aria-focused": focused ? 'true' : null, "aria-labelledby": labelId, "aria-describedby": this.ariaForm.messageId, class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ 'bal-focused': focused }, block.class()), block.modifier('checkbox').class()), block.modifier('button').class(this.interface === 'button')), block.modifier('switch').class(this.interface === 'switch')), block.modifier('tile').class(this.interface === 'tile')), block.modifier(`tile-color-${this.color}`).class(this.interface === 'tile' && !!this.color)), block.modifier('focused').class(this.focused)), block.modifier('invalid').class(this.invalid)), block.modifier('checked').class(this.checked)), block.modifier('flat').class(this.flat)), block.modifier('disabled').class(this.disabled || this.readonly)), block.modifier('hovered').class(this.mergedElementState.hovered)), block.modifier('pressed').class(this.mergedElementState.pressed)), block.modifier(`column-${this.colSize}`).class(this.interface === 'tile' && this.colSize > 1)), block
|
|
362
|
-
.modifier(`column-tablet-${this.colSizeTablet}`)
|
|
363
|
-
.class(this.interface === 'tile' && this.colSizeTablet > 1)), block
|
|
364
|
-
.modifier(`column-mobile-${this.colSizeMobile}`)
|
|
365
|
-
.class(this.interface === 'tile' && this.colSizeMobile > 1)), onClick: this.onClick }, index.h(LabelTag, { key: '6fd849f4768bc7155eb5db297713bc82aeab6dfe', class: Object.assign({}, labelEl.class()), "data-testid": "bal-checkbox-label" }, hasFormControl ? (index.h("input", Object.assign({ id: id, type: "checkbox", "data-testid": "bal-checkbox-input", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled || this.nonSubmit, readonly: this.readonly, class: Object.assign({}, inputEl.class()), "aria-hidden": aria.ariaBooleanToString(this.nonSubmit), "aria-invalid": this.invalid === true ? 'true' : 'false', "aria-describedby": this.ariaForm.messageId, onChange: ev => this.toggleChecked(ev), onFocus: ev => this.onFocus(ev), onBlur: ev => this.onBlur(ev), ref: inputEl => (this.nativeInput = inputEl) }, inputAttributes))) : (''), this.interface !== 'tile' ? (index.h("div", { class: Object.assign({}, labelIconEl.class()) }, index.h(Icon, { checked: this.checked, disabled: this.disabled || this.readonly, invalid: this.invalid, inverted: this.interface === 'button' && this.checked, hovered: this.mergedElementState.hovered, pressed: this.mergedElementState.pressed }))) : (''), index.h("div", { key: 'ca1ec209d9211082db1d0905e599eea5e6803244', class: Object.assign(Object.assign({}, labelTextEl.class()), labelTextEl.modifier('hidden').class(this.labelHidden)) }, index.h("slot", { key: 'a2a3c8124d7d47bf300b229fe01e62fa198961c0' })))));
|
|
366
|
-
}
|
|
367
|
-
get el() { return index.getElement(this); }
|
|
368
|
-
static get watchers() { return {
|
|
369
|
-
"hovered": ["hoveredChanged"],
|
|
370
|
-
"pressed": ["pressedChanged"]
|
|
371
|
-
}; }
|
|
372
|
-
};
|
|
373
|
-
tslib_es6.__decorate([
|
|
374
|
-
log.Logger('bal-checkbox'),
|
|
375
|
-
tslib_es6.__metadata("design:type", Function),
|
|
376
|
-
tslib_es6.__metadata("design:paramtypes", [Function]),
|
|
377
|
-
tslib_es6.__metadata("design:returntype", void 0)
|
|
378
|
-
], Checkbox.prototype, "createLogger", null);
|
|
379
|
-
tslib_es6.__decorate([
|
|
380
|
-
elementStates_decorator.ListenToElementStates(),
|
|
381
|
-
tslib_es6.__metadata("design:type", Function),
|
|
382
|
-
tslib_es6.__metadata("design:paramtypes", [Object]),
|
|
383
|
-
tslib_es6.__metadata("design:returntype", void 0)
|
|
384
|
-
], Checkbox.prototype, "elementStateListener", null);
|
|
385
|
-
let checkboxIds = 0;
|
|
386
|
-
Checkbox.style = balCheckboxCss;
|
|
387
|
-
|
|
388
|
-
const balCheckboxGroupCss = ".bal-checkbox-group{display:inline-block;position:relative;width:100%}.bal-checkbox-group__inner{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-align:stretch;align-items:stretch;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--bal-space-normal)}.bal-checkbox-group__inner--button{-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex:1;flex:1;gap:var(--bal-space-x-small)}@media screen and (min-width: 769px),print{.bal-checkbox-group__inner--button{-ms-flex-direction:row;flex-direction:row}}.bal-checkbox-group__inner--expanded{-ms-flex-align:stretch;align-items:stretch}.bal-checkbox-group__inner--expanded .bal-checkbox{-ms-flex:1;flex:1}@media screen and (max-width: 768px){.bal-checkbox-group__inner--expanded .bal-checkbox{width:100%}}.bal-checkbox-group__inner--button.bal-checkbox-group__inner--vertical{gap:var(--bal-space-x-small)}.bal-checkbox-group__inner--vertical{-ms-flex-direction:column;flex-direction:column;border-radius:var(--bal-radius-normal);gap:0}@media screen and (min-width: 769px),print{.bal-checkbox-group__inner--vertical{-ms-flex-align:start;align-items:flex-start}}@media screen and (max-width: 768px){.bal-checkbox-group__inner--vertical-mobile{-ms-flex-direction:column;flex-direction:column;border-radius:var(--bal-radius-normal);gap:0}}";
|
|
389
|
-
|
|
390
|
-
const CheckboxGroup = class {
|
|
391
|
-
constructor(hostRef) {
|
|
392
|
-
index.registerInstance(this, hostRef);
|
|
393
|
-
this.balChange = index.createEvent(this, "balChange");
|
|
394
|
-
this.balFocus = index.createEvent(this, "balFocus");
|
|
395
|
-
this.balBlur = index.createEvent(this, "balBlur");
|
|
396
|
-
this.inputId = `bal-cg-${checkboxGroupIds++}`;
|
|
397
|
-
this.inheritedAttributes = {};
|
|
398
|
-
this.ariaForm = form.defaultBalAriaForm;
|
|
399
|
-
/**
|
|
400
|
-
* Defines the layout of the checkbox button
|
|
401
|
-
*/
|
|
402
|
-
this.interface = undefined;
|
|
403
|
-
/**
|
|
404
|
-
* If `true` it acts as the main form control
|
|
405
|
-
*/
|
|
406
|
-
this.control = false;
|
|
407
|
-
/**
|
|
408
|
-
* The name of the control, which is submitted with the form data.
|
|
409
|
-
*/
|
|
410
|
-
this.name = this.inputId;
|
|
411
|
-
/**
|
|
412
|
-
* Displays the checkboxes vertically
|
|
413
|
-
*/
|
|
414
|
-
this.vertical = false;
|
|
415
|
-
/**
|
|
416
|
-
* If `true`, the controls will be vertically on mobile devices.
|
|
417
|
-
*/
|
|
418
|
-
this.verticalOnMobile = false;
|
|
419
|
-
/**
|
|
420
|
-
* Uses the whole width
|
|
421
|
-
*/
|
|
422
|
-
this.expanded = false;
|
|
423
|
-
/**
|
|
424
|
-
* If `true`, the element is not mutable, focusable, or even submitted with the form. The user can neither edit nor focus on the control, nor its form control descendants.
|
|
425
|
-
*/
|
|
426
|
-
this.invalid = undefined;
|
|
427
|
-
/**
|
|
428
|
-
* If `true`, the user cannot interact with the checkboxes.
|
|
429
|
-
*/
|
|
430
|
-
this.disabled = undefined;
|
|
431
|
-
/**
|
|
432
|
-
* If `true`, the user cannot interact with the checkboxes.
|
|
433
|
-
*/
|
|
434
|
-
this.readonly = undefined;
|
|
435
|
-
/**
|
|
436
|
-
* The value of the control.
|
|
437
|
-
*/
|
|
438
|
-
this.value = [];
|
|
439
|
-
/**
|
|
440
|
-
* Defines the column size like the grid.
|
|
441
|
-
*/
|
|
442
|
-
this.columns = 1;
|
|
443
|
-
/**
|
|
444
|
-
* Defines the column size for tablet and bigger like the grid.
|
|
445
|
-
*/
|
|
446
|
-
this.columnsTablet = 1;
|
|
447
|
-
/**
|
|
448
|
-
* Defines the column size for mobile and bigger like the grid.
|
|
449
|
-
*/
|
|
450
|
-
this.columnsMobile = 1;
|
|
451
|
-
/**
|
|
452
|
-
* If `true`, in Angular reactive forms the control will not be set invalid
|
|
453
|
-
*/
|
|
454
|
-
this.autoInvalidOff = false;
|
|
455
|
-
/**
|
|
456
|
-
* LISTENERS
|
|
457
|
-
* ------------------------------------------------------
|
|
458
|
-
*/
|
|
459
|
-
this.hasFocus = false;
|
|
460
|
-
this.mutationObserverActive = true;
|
|
461
|
-
/**
|
|
462
|
-
* EVENT BINDING
|
|
463
|
-
* ------------------------------------------------------
|
|
464
|
-
*/
|
|
465
|
-
this.onClick = (ev) => {
|
|
466
|
-
if (!this.control) {
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
const element = ev.target;
|
|
470
|
-
if (element.href) {
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
const selectedCheckbox = ev.target && ev.target.closest('bal-checkbox');
|
|
474
|
-
if (selectedCheckbox) {
|
|
475
|
-
if (selectedCheckbox.disabled || selectedCheckbox.readonly) {
|
|
476
|
-
return ev.stopPropagation();
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
this.updateValues();
|
|
480
|
-
};
|
|
481
|
-
this.onOptionChange = async () => {
|
|
482
|
-
this.sync();
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
createLogger(log) {
|
|
486
|
-
this.log = log;
|
|
487
|
-
}
|
|
488
|
-
async optionChanged() {
|
|
489
|
-
if (this.control) {
|
|
490
|
-
this.onOptionChange();
|
|
491
|
-
this.mutationObserverActive = this.options === undefined;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
invalidChanged(value) {
|
|
495
|
-
if (this.control) {
|
|
496
|
-
if (value !== undefined) {
|
|
497
|
-
this.getCheckboxes().forEach(child => {
|
|
498
|
-
child.invalid = value;
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
disabledChanged(value) {
|
|
504
|
-
if (this.control) {
|
|
505
|
-
if (value !== undefined) {
|
|
506
|
-
this.getCheckboxes().forEach(child => {
|
|
507
|
-
child.disabled = value;
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
readonlyChanged(value) {
|
|
513
|
-
if (this.control) {
|
|
514
|
-
if (value !== undefined) {
|
|
515
|
-
this.getCheckboxes().forEach(child => {
|
|
516
|
-
child.readonly = value;
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
valueChanged(_value, oldValue) {
|
|
522
|
-
if (this.control) {
|
|
523
|
-
if (!array.areArraysEqual(this.value, oldValue)) {
|
|
524
|
-
this.onOptionChange();
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
else {
|
|
528
|
-
this.onOptionChange();
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
columnsChanged(value) {
|
|
532
|
-
this.getCheckboxes().forEach(checkbox => (checkbox.colSize = value));
|
|
533
|
-
}
|
|
534
|
-
columnsTabletChanged(value) {
|
|
535
|
-
this.getCheckboxes().forEach(checkbox => (checkbox.colSizeTablet = value));
|
|
536
|
-
}
|
|
537
|
-
columnsMobileChanged(value) {
|
|
538
|
-
this.getCheckboxes().forEach(checkbox => (checkbox.colSizeMobile = value));
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* LIFECYCLE
|
|
542
|
-
* ------------------------------------------------------
|
|
543
|
-
*/
|
|
544
|
-
connectedCallback() {
|
|
545
|
-
if (this.control) {
|
|
546
|
-
this.mutationObserverActive = this.options === undefined;
|
|
547
|
-
this.valueChanged(this.value, []);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
componentWillLoad() {
|
|
551
|
-
if (this.control) {
|
|
552
|
-
this.inheritedAttributes = attributes.inheritAttributes(this.el, ['aria-label', 'tabindex', 'title']);
|
|
553
|
-
this.disabledChanged(this.disabled);
|
|
554
|
-
this.invalidChanged(this.invalid);
|
|
555
|
-
this.readonlyChanged(this.readonly);
|
|
556
|
-
}
|
|
557
|
-
this.columnsChanged(this.columns);
|
|
558
|
-
this.columnsTabletChanged(this.columnsTablet);
|
|
559
|
-
this.columnsMobileChanged(this.columnsMobile);
|
|
560
|
-
this.onOptionChange();
|
|
561
|
-
}
|
|
562
|
-
focusInListener(ev) {
|
|
563
|
-
this.balFocus.emit(ev);
|
|
564
|
-
}
|
|
565
|
-
focusOutListener(ev) {
|
|
566
|
-
this.balBlur.emit(ev);
|
|
567
|
-
}
|
|
568
|
-
mutationListener() {
|
|
569
|
-
if (this.control) {
|
|
570
|
-
this.disabledChanged(this.disabled);
|
|
571
|
-
this.readonlyChanged(this.readonly);
|
|
572
|
-
}
|
|
573
|
-
this.columnsChanged(this.columns);
|
|
574
|
-
this.columnsTabletChanged(this.columnsTablet);
|
|
575
|
-
this.columnsMobileChanged(this.columnsMobile);
|
|
576
|
-
this.onOptionChange();
|
|
577
|
-
}
|
|
578
|
-
listenOnCheckboxChange(ev) {
|
|
579
|
-
if (this.control) {
|
|
580
|
-
if (helpers.isDescendant(this.el, ev.target)) {
|
|
581
|
-
formInput.stopEventBubbling(ev);
|
|
582
|
-
this.updateValues();
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
resetHandler(ev) {
|
|
587
|
-
const formElement = ev.target;
|
|
588
|
-
if (formElement === null || formElement === void 0 ? void 0 : formElement.contains(this.el)) {
|
|
589
|
-
if (this.control) {
|
|
590
|
-
this.value = [];
|
|
591
|
-
}
|
|
592
|
-
this.onOptionChange();
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
checkboxFocusListener(ev) {
|
|
596
|
-
const { target } = ev;
|
|
597
|
-
if (target && helpers.isDescendant(this.el, target) && helpers.hasTagName(target, 'bal-checkbox')) {
|
|
598
|
-
formInput.stopEventBubbling(ev);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
checkboxBlurListener(ev) {
|
|
602
|
-
const { target } = ev;
|
|
603
|
-
if (target && helpers.isDescendant(this.el, target) && helpers.hasTagName(target, 'bal-checkbox')) {
|
|
604
|
-
formInput.stopEventBubbling(ev);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* PUBLIC METHODS
|
|
609
|
-
* ------------------------------------------------------
|
|
610
|
-
*/
|
|
611
|
-
/** @internal */
|
|
612
|
-
async setValue(value) {
|
|
613
|
-
if (this.control) {
|
|
614
|
-
this.value = value;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Find the options properties by its value
|
|
619
|
-
*/
|
|
620
|
-
async getOptionByValue(value) {
|
|
621
|
-
const options = this.options;
|
|
622
|
-
if (options) {
|
|
623
|
-
return options.find(option => option.value === value);
|
|
624
|
-
}
|
|
625
|
-
return undefined;
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* @internal
|
|
629
|
-
*/
|
|
630
|
-
async setAriaForm(ariaForm) {
|
|
631
|
-
this.ariaForm = Object.assign({}, ariaForm);
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* PRIVATE METHODS
|
|
635
|
-
* ------------------------------------------------------
|
|
636
|
-
*/
|
|
637
|
-
sync() {
|
|
638
|
-
if (this.control) {
|
|
639
|
-
const isChecked = (checkbox) => {
|
|
640
|
-
for (let index = 0; index < this.value.length; index++) {
|
|
641
|
-
const valueItem = this.value[index];
|
|
642
|
-
if (valueItem !== undefined && valueItem.toString() === checkbox.value.toString()) {
|
|
643
|
-
return true;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
return false;
|
|
647
|
-
};
|
|
648
|
-
this.getCheckboxes().forEach((checkbox) => {
|
|
649
|
-
checkbox.checked = isChecked(checkbox);
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
this.getCheckboxes().forEach((checkbox) => {
|
|
653
|
-
if (this.interface) {
|
|
654
|
-
checkbox.interface = this.interface;
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* GETTERS
|
|
660
|
-
* ------------------------------------------------------
|
|
661
|
-
*/
|
|
662
|
-
getCheckboxes() {
|
|
663
|
-
return Array.from(this.el.querySelectorAll('bal-checkbox'));
|
|
664
|
-
}
|
|
665
|
-
updateValues() {
|
|
666
|
-
// generate new value array out of the checked checkboxes
|
|
667
|
-
const newValue = [];
|
|
668
|
-
this.getCheckboxes().forEach(cb => {
|
|
669
|
-
if (cb.checked) {
|
|
670
|
-
newValue.push(cb.value);
|
|
671
|
-
}
|
|
672
|
-
});
|
|
673
|
-
if (!array.areArraysEqual(this.value, newValue)) {
|
|
674
|
-
this.value = [...newValue];
|
|
675
|
-
this.balChange.emit(this.value);
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* RENDER
|
|
680
|
-
* ------------------------------------------------------
|
|
681
|
-
*/
|
|
682
|
-
render() {
|
|
683
|
-
const block = bem.BEM.block('checkbox-group');
|
|
684
|
-
const innerEl = block.element('inner');
|
|
685
|
-
const rawOptions = this.options || [];
|
|
686
|
-
const options = rawOptions.map(option => {
|
|
687
|
-
if (typeof option.html === 'function') {
|
|
688
|
-
return Object.assign(Object.assign({}, option), { html: option.html() });
|
|
689
|
-
}
|
|
690
|
-
return option;
|
|
691
|
-
});
|
|
692
|
-
return (index.h(index.Host, Object.assign({ class: Object.assign({}, block.class()), role: "group", "aria-labelledby": this.ariaForm.labelId, "aria-describedby": this.ariaForm.messageId, "aria-disabled": aria.ariaBooleanToString(this.disabled), "aria-invalid": aria.ariaBooleanToString(this.invalid), onClick: this.onClick }, this.inheritedAttributes), index.h("div", { class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, innerEl.class()), innerEl.modifier('vertical-mobile').class(this.verticalOnMobile)), innerEl.modifier('vertical').class(this.vertical)), innerEl.modifier('expanded').class(this.expanded)), innerEl.modifier('button').class(this.interface === 'button')) }, index.h("slot", null), options.map(option => (index.h("bal-checkbox", { key: option.value, name: option.name, value: option.value, labelHidden: option.labelHidden, flat: option.flat, interface: option.interface, disabled: option.disabled, readonly: option.readonly, required: option.required, nonSubmit: !!option.nonSubmit, invalid: option.invalid, innerHTML: option.html }))))));
|
|
693
|
-
}
|
|
694
|
-
get el() { return index.getElement(this); }
|
|
695
|
-
static get watchers() { return {
|
|
696
|
-
"options": ["optionChanged"],
|
|
697
|
-
"invalid": ["invalidChanged"],
|
|
698
|
-
"disabled": ["disabledChanged"],
|
|
699
|
-
"readonly": ["readonlyChanged"],
|
|
700
|
-
"value": ["valueChanged"],
|
|
701
|
-
"columns": ["columnsChanged"],
|
|
702
|
-
"columnsTablet": ["columnsTabletChanged"],
|
|
703
|
-
"columnsMobile": ["columnsMobileChanged"]
|
|
704
|
-
}; }
|
|
705
|
-
};
|
|
706
|
-
tslib_es6.__decorate([
|
|
707
|
-
log.Logger('bal-checkbox-group'),
|
|
708
|
-
tslib_es6.__metadata("design:type", Function),
|
|
709
|
-
tslib_es6.__metadata("design:paramtypes", [Function]),
|
|
710
|
-
tslib_es6.__metadata("design:returntype", void 0)
|
|
711
|
-
], CheckboxGroup.prototype, "createLogger", null);
|
|
712
|
-
tslib_es6.__decorate([
|
|
713
|
-
focus_decorator.ListenToFocus(),
|
|
714
|
-
tslib_es6.__metadata("design:type", Function),
|
|
715
|
-
tslib_es6.__metadata("design:paramtypes", [Object]),
|
|
716
|
-
tslib_es6.__metadata("design:returntype", void 0)
|
|
717
|
-
], CheckboxGroup.prototype, "focusInListener", null);
|
|
718
|
-
tslib_es6.__decorate([
|
|
719
|
-
focus_decorator.ListenToFocus(),
|
|
720
|
-
tslib_es6.__metadata("design:type", Function),
|
|
721
|
-
tslib_es6.__metadata("design:paramtypes", [Object]),
|
|
722
|
-
tslib_es6.__metadata("design:returntype", void 0)
|
|
723
|
-
], CheckboxGroup.prototype, "focusOutListener", null);
|
|
724
|
-
tslib_es6.__decorate([
|
|
725
|
-
mutation_decorator.ListenToMutation({ tags: ['bal-checkbox-group', 'bal-checkbox'], attributes: false, characterData: false }),
|
|
726
|
-
tslib_es6.__metadata("design:type", Function),
|
|
727
|
-
tslib_es6.__metadata("design:paramtypes", []),
|
|
728
|
-
tslib_es6.__metadata("design:returntype", void 0)
|
|
729
|
-
], CheckboxGroup.prototype, "mutationListener", null);
|
|
730
|
-
let checkboxGroupIds = 0;
|
|
731
|
-
CheckboxGroup.style = balCheckboxGroupCss;
|
|
732
|
-
|
|
733
|
-
exports.bal_checkbox = Checkbox;
|
|
734
|
-
exports.bal_checkbox_group = CheckboxGroup;
|