@haiilo/catalyst 8.1.0 → 8.2.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/catalyst/catalyst.css +4 -9
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.esm.js +2 -2
- package/dist/catalyst/{p-85d057f0.js → p-6ae13953.js} +1 -1
- package/dist/catalyst/p-6cd4fa1e.js +3 -0
- package/dist/catalyst/p-6cd4fa1e.js.map +1 -0
- package/dist/catalyst/p-a05fbea3.entry.js +10 -0
- package/dist/catalyst/p-a05fbea3.entry.js.map +1 -0
- package/dist/catalyst/scss/core/_dialog.scss +1 -1
- package/dist/catalyst/scss/core/_form.scss +2 -1
- package/dist/catalyst/scss/core/_typography.scss +1 -7
- package/dist/cjs/cat-alert_26.cjs.entry.js +3899 -3883
- package/dist/cjs/cat-alert_26.cjs.entry.js.map +1 -1
- package/dist/cjs/catalyst.cjs.js +3 -3
- package/dist/cjs/catalyst.cjs.js.map +1 -1
- package/dist/cjs/{index-1e7eef7e.js → index-eb056d5e.js} +51 -13
- package/dist/cjs/index-eb056d5e.js.map +1 -0
- package/dist/cjs/index.cjs.js +73 -73
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{of-395b2f57.js → of-2b7161d2.js} +155 -155
- package/dist/cjs/of-2b7161d2.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/cat-alert/cat-alert.e2e.js +7 -7
- package/dist/collection/components/cat-alert/cat-alert.e2e.js.map +1 -1
- package/dist/collection/components/cat-alert/cat-alert.js +98 -98
- package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
- package/dist/collection/components/cat-alert/cat-alert.spec.js +7 -7
- package/dist/collection/components/cat-alert/cat-alert.spec.js.map +1 -1
- package/dist/collection/components/cat-avatar/cat-avatar.e2e.js +6 -6
- package/dist/collection/components/cat-avatar/cat-avatar.e2e.js.map +1 -1
- package/dist/collection/components/cat-avatar/cat-avatar.js +218 -218
- package/dist/collection/components/cat-avatar/cat-avatar.js.map +1 -1
- package/dist/collection/components/cat-avatar/cat-avatar.spec.js +7 -7
- package/dist/collection/components/cat-avatar/cat-avatar.spec.js.map +1 -1
- package/dist/collection/components/cat-badge/cat-badge.e2e.js +6 -6
- package/dist/collection/components/cat-badge/cat-badge.e2e.js.map +1 -1
- package/dist/collection/components/cat-badge/cat-badge.js +117 -117
- package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
- package/dist/collection/components/cat-badge/cat-badge.spec.js +7 -7
- package/dist/collection/components/cat-badge/cat-badge.spec.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.css +2 -1
- package/dist/collection/components/cat-button/cat-button.e2e.js +6 -6
- package/dist/collection/components/cat-button/cat-button.e2e.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.js +693 -693
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.spec.js +7 -7
- package/dist/collection/components/cat-button/cat-button.spec.js.map +1 -1
- package/dist/collection/components/cat-button-group/cat-button-group.e2e.js +6 -6
- package/dist/collection/components/cat-button-group/cat-button-group.e2e.js.map +1 -1
- package/dist/collection/components/cat-button-group/cat-button-group.js +47 -47
- package/dist/collection/components/cat-button-group/cat-button-group.js.map +1 -1
- package/dist/collection/components/cat-button-group/cat-button-group.spec.js +7 -7
- package/dist/collection/components/cat-button-group/cat-button-group.spec.js.map +1 -1
- package/dist/collection/components/cat-card/cat-card.e2e.js +6 -6
- package/dist/collection/components/cat-card/cat-card.e2e.js.map +1 -1
- package/dist/collection/components/cat-card/cat-card.js +15 -15
- package/dist/collection/components/cat-card/cat-card.js.map +1 -1
- package/dist/collection/components/cat-card/cat-card.spec.js +7 -7
- package/dist/collection/components/cat-card/cat-card.spec.js.map +1 -1
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +2 -1
- package/dist/collection/components/cat-checkbox/cat-checkbox.e2e.js +6 -6
- package/dist/collection/components/cat-checkbox/cat-checkbox.e2e.js.map +1 -1
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +441 -441
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
- package/dist/collection/components/cat-checkbox/cat-checkbox.spec.js +7 -7
- package/dist/collection/components/cat-checkbox/cat-checkbox.spec.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.config.js +62 -62
- package/dist/collection/components/cat-datepicker/cat-datepicker.config.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.e2e.js +7 -7
- package/dist/collection/components/cat-datepicker/cat-datepicker.e2e.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.format.js +20 -20
- package/dist/collection/components/cat-datepicker/cat-datepicker.format.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.js +720 -707
- package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.locale.js +39 -39
- package/dist/collection/components/cat-datepicker/cat-datepicker.locale.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.spec.js +7 -7
- package/dist/collection/components/cat-datepicker/cat-datepicker.spec.js.map +1 -1
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.e2e.js +7 -7
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.e2e.js.map +1 -1
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js +244 -244
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js.map +1 -1
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.spec.js +7 -7
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.spec.js.map +1 -1
- package/dist/collection/components/cat-dropdown/cat-dropdown.e2e.js +6 -6
- package/dist/collection/components/cat-dropdown/cat-dropdown.e2e.js.map +1 -1
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +300 -300
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-dropdown/cat-dropdown.spec.js +7 -7
- package/dist/collection/components/cat-dropdown/cat-dropdown.spec.js.map +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.e2e.js +6 -6
- package/dist/collection/components/cat-form-group/cat-form-group.e2e.js.map +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.js +107 -107
- package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.spec.js +7 -7
- package/dist/collection/components/cat-form-group/cat-form-group.spec.js.map +1 -1
- package/dist/collection/components/cat-form-hint/cat-form-hint.js +9 -9
- package/dist/collection/components/cat-form-hint/cat-form-hint.js.map +1 -1
- package/dist/collection/components/cat-form-hint/cat-form-hint.spec.js +7 -7
- package/dist/collection/components/cat-form-hint/cat-form-hint.spec.js.map +1 -1
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js +71 -71
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -1
- package/dist/collection/components/cat-i18n/cat-i18n-registry.spec.js +3 -3
- package/dist/collection/components/cat-i18n/cat-i18n-registry.spec.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.js +77 -77
- package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.spec.js +3 -3
- package/dist/collection/components/cat-icon/cat-icon-registry.spec.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon.e2e.js +7 -7
- package/dist/collection/components/cat-icon/cat-icon.e2e.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon.js +97 -97
- package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon.spec.js +7 -7
- package/dist/collection/components/cat-icon/cat-icon.spec.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.e2e.js +7 -7
- package/dist/collection/components/cat-input/cat-input.e2e.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.js +768 -768
- package/dist/collection/components/cat-input/cat-input.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.spec.js +7 -7
- package/dist/collection/components/cat-input/cat-input.spec.js.map +1 -1
- package/dist/collection/components/cat-notification/cat-notification.js +59 -59
- package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
- package/dist/collection/components/cat-notification/cat-notification.spec.js +3 -3
- package/dist/collection/components/cat-notification/cat-notification.spec.js.map +1 -1
- package/dist/collection/components/cat-pagination/cat-pagination.e2e.js +10 -10
- package/dist/collection/components/cat-pagination/cat-pagination.e2e.js.map +1 -1
- package/dist/collection/components/cat-pagination/cat-pagination.js +274 -274
- package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
- package/dist/collection/components/cat-pagination/cat-pagination.spec.js +7 -7
- package/dist/collection/components/cat-pagination/cat-pagination.spec.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.e2e.js +6 -6
- package/dist/collection/components/cat-radio/cat-radio.e2e.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.js +378 -378
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.spec.js +7 -7
- package/dist/collection/components/cat-radio/cat-radio.spec.js.map +1 -1
- package/dist/collection/components/cat-radio-group/cat-radio-group.e2e.js +6 -6
- package/dist/collection/components/cat-radio-group/cat-radio-group.e2e.js.map +1 -1
- package/dist/collection/components/cat-radio-group/cat-radio-group.js +278 -278
- package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
- package/dist/collection/components/cat-radio-group/cat-radio-group.spec.js +7 -7
- package/dist/collection/components/cat-radio-group/cat-radio-group.spec.js.map +1 -1
- package/dist/collection/components/cat-scrollable/cat-scrollable.e2e.js +6 -6
- package/dist/collection/components/cat-scrollable/cat-scrollable.e2e.js.map +1 -1
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +287 -287
- package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
- package/dist/collection/components/cat-scrollable/cat-scrollable.spec.js +7 -7
- package/dist/collection/components/cat-scrollable/cat-scrollable.spec.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.e2e.js +10 -10
- package/dist/collection/components/cat-select/cat-select.e2e.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.js +1143 -1143
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.spec.js +7 -7
- package/dist/collection/components/cat-select/cat-select.spec.js.map +1 -1
- package/dist/collection/components/cat-select/connectors.js +13 -13
- package/dist/collection/components/cat-select/connectors.js.map +1 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js +1379 -1379
- package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.e2e.js +6 -6
- package/dist/collection/components/cat-skeleton/cat-skeleton.e2e.js.map +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.js +120 -120
- package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.spec.js +7 -7
- package/dist/collection/components/cat-skeleton/cat-skeleton.spec.js.map +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.e2e.js +6 -6
- package/dist/collection/components/cat-spinner/cat-spinner.e2e.js.map +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.js +60 -60
- package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.spec.js +7 -7
- package/dist/collection/components/cat-spinner/cat-spinner.spec.js.map +1 -1
- package/dist/collection/components/cat-tab/cat-tab.e2e.js +6 -6
- package/dist/collection/components/cat-tab/cat-tab.e2e.js.map +1 -1
- package/dist/collection/components/cat-tab/cat-tab.js +230 -211
- package/dist/collection/components/cat-tab/cat-tab.js.map +1 -1
- package/dist/collection/components/cat-tab/cat-tab.spec.js +7 -7
- package/dist/collection/components/cat-tab/cat-tab.spec.js.map +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.css +3 -0
- package/dist/collection/components/cat-tabs/cat-tabs.e2e.js +6 -6
- package/dist/collection/components/cat-tabs/cat-tabs.e2e.js.map +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.js +222 -215
- package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.spec.js +7 -7
- package/dist/collection/components/cat-tabs/cat-tabs.spec.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.e2e.js +7 -7
- package/dist/collection/components/cat-textarea/cat-textarea.e2e.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.js +586 -586
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.spec.js +7 -7
- package/dist/collection/components/cat-textarea/cat-textarea.spec.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.e2e.js +6 -6
- package/dist/collection/components/cat-toggle/cat-toggle.e2e.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.js +421 -421
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.spec.js +7 -7
- package/dist/collection/components/cat-toggle/cat-toggle.spec.js.map +1 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.css +3 -0
- package/dist/collection/components/cat-tooltip/cat-tooltip.e2e.js +6 -6
- package/dist/collection/components/cat-tooltip/cat-tooltip.e2e.js.map +1 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +297 -296
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.spec.js +12 -8
- package/dist/collection/components/cat-tooltip/cat-tooltip.spec.js.map +1 -1
- package/dist/collection/scss/core/_dialog.scss +1 -1
- package/dist/collection/scss/core/_form.scss +2 -1
- package/dist/collection/scss/core/_typography.scss +1 -7
- package/dist/collection/utils/breakpoints.js +6 -6
- package/dist/collection/utils/breakpoints.js.map +1 -1
- package/dist/collection/utils/coerce.js +3 -3
- package/dist/collection/utils/coerce.js.map +1 -1
- package/dist/collection/utils/find-closest.js +6 -6
- package/dist/collection/utils/find-closest.js.map +1 -1
- package/dist/collection/utils/first-tabbable.js +1 -1
- package/dist/collection/utils/first-tabbable.js.map +1 -1
- package/dist/collection/utils/load-img.js +6 -6
- package/dist/collection/utils/load-img.js.map +1 -1
- package/dist/collection/utils/media-matcher.js +30 -30
- package/dist/collection/utils/media-matcher.js.map +1 -1
- package/dist/collection/utils/media-matcher.spec.js +32 -32
- package/dist/collection/utils/media-matcher.spec.js.map +1 -1
- package/dist/collection/utils/platform.js +34 -34
- package/dist/collection/utils/platform.js.map +1 -1
- package/dist/collection/utils/setDefault.js +4 -4
- package/dist/collection/utils/setDefault.js.map +1 -1
- package/dist/components/cat-alert.d.ts +2 -2
- package/dist/components/cat-alert.js +56 -56
- package/dist/components/cat-alert.js.map +1 -1
- package/dist/components/cat-avatar.d.ts +2 -2
- package/dist/components/cat-avatar2.js +93 -93
- package/dist/components/cat-avatar2.js.map +1 -1
- package/dist/components/cat-badge.d.ts +2 -2
- package/dist/components/cat-badge.js +32 -32
- package/dist/components/cat-badge.js.map +1 -1
- package/dist/components/cat-button-group.d.ts +2 -2
- package/dist/components/cat-button-group.js +31 -31
- package/dist/components/cat-button-group.js.map +1 -1
- package/dist/components/cat-button.d.ts +2 -2
- package/dist/components/cat-button2.js +277 -277
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-card.d.ts +2 -2
- package/dist/components/cat-card.js +20 -20
- package/dist/components/cat-card.js.map +1 -1
- package/dist/components/cat-checkbox.d.ts +2 -2
- package/dist/components/cat-checkbox2.js +108 -108
- package/dist/components/cat-checkbox2.js.map +1 -1
- package/dist/components/cat-datepicker-inline.d.ts +2 -2
- package/dist/components/cat-datepicker-inline.js +89 -89
- package/dist/components/cat-datepicker-inline.js.map +1 -1
- package/dist/components/cat-datepicker.d.ts +2 -2
- package/dist/components/cat-datepicker.js +203 -194
- package/dist/components/cat-datepicker.js.map +1 -1
- package/dist/components/cat-datepicker.locale.js +121 -121
- package/dist/components/cat-datepicker.locale.js.map +1 -1
- package/dist/components/cat-dropdown.d.ts +2 -2
- package/dist/components/cat-dropdown2.js +177 -177
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-form-group.d.ts +2 -2
- package/dist/components/cat-form-group.js +55 -55
- package/dist/components/cat-form-group.js.map +1 -1
- package/dist/components/cat-form-hint.js +9 -9
- package/dist/components/cat-form-hint.js.map +1 -1
- package/dist/components/cat-i18n-registry.js +71 -71
- package/dist/components/cat-i18n-registry.js.map +1 -1
- package/dist/components/cat-icon-registry.js +77 -77
- package/dist/components/cat-icon-registry.js.map +1 -1
- package/dist/components/cat-icon.d.ts +2 -2
- package/dist/components/cat-icon2.js +32 -32
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.d.ts +2 -2
- package/dist/components/cat-input2.js +219 -219
- package/dist/components/cat-input2.js.map +1 -1
- package/dist/components/cat-pagination.d.ts +2 -2
- package/dist/components/cat-pagination.js +103 -103
- package/dist/components/cat-pagination.js.map +1 -1
- package/dist/components/cat-radio-group.d.ts +2 -2
- package/dist/components/cat-radio-group.js +113 -113
- package/dist/components/cat-radio-group.js.map +1 -1
- package/dist/components/cat-radio.d.ts +2 -2
- package/dist/components/cat-radio.js +93 -93
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-scrollable.d.ts +2 -2
- package/dist/components/cat-scrollable2.js +118 -118
- package/dist/components/cat-scrollable2.js.map +1 -1
- package/dist/components/cat-select-demo.d.ts +2 -2
- package/dist/components/cat-select-demo.js +1438 -1438
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select.d.ts +2 -2
- package/dist/components/cat-select2.js +666 -666
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-skeleton.d.ts +2 -2
- package/dist/components/cat-skeleton2.js +53 -53
- package/dist/components/cat-skeleton2.js.map +1 -1
- package/dist/components/cat-spinner.d.ts +2 -2
- package/dist/components/cat-spinner2.js +27 -27
- package/dist/components/cat-spinner2.js.map +1 -1
- package/dist/components/cat-tab.d.ts +2 -2
- package/dist/components/cat-tab.js +48 -46
- package/dist/components/cat-tab.js.map +1 -1
- package/dist/components/cat-tabs.d.ts +2 -2
- package/dist/components/cat-tabs.js +120 -113
- package/dist/components/cat-tabs.js.map +1 -1
- package/dist/components/cat-textarea.d.ts +2 -2
- package/dist/components/cat-textarea.js +178 -178
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-toggle.d.ts +2 -2
- package/dist/components/cat-toggle.js +104 -104
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/cat-tooltip.d.ts +2 -2
- package/dist/components/cat-tooltip.js +144 -143
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/coerce.js +3 -3
- package/dist/components/coerce.js.map +1 -1
- package/dist/components/index.js +72 -72
- package/dist/components/index.js.map +1 -1
- package/dist/esm/cat-alert_26.entry.js +3899 -3883
- package/dist/esm/cat-alert_26.entry.js.map +1 -1
- package/dist/esm/catalyst.js +4 -4
- package/dist/esm/catalyst.js.map +1 -1
- package/dist/esm/{index-30a221a3.js → index-acddba36.js} +51 -13
- package/dist/esm/index-acddba36.js.map +1 -0
- package/dist/esm/index.js +74 -74
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{of-04d3d9e1.js → of-4f92b30b.js} +155 -155
- package/dist/esm/of-4f92b30b.js.map +1 -0
- package/dist/types/components/cat-alert/cat-alert.d.ts +17 -17
- package/dist/types/components/cat-avatar/cat-avatar.d.ts +41 -41
- package/dist/types/components/cat-badge/cat-badge.d.ts +22 -22
- package/dist/types/components/cat-button/cat-button.d.ts +151 -151
- package/dist/types/components/cat-button-group/cat-button-group.d.ts +9 -9
- package/dist/types/components/cat-card/cat-card.d.ts +1 -1
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +97 -97
- package/dist/types/components/cat-datepicker/cat-datepicker.config.d.ts +12 -12
- package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +153 -149
- package/dist/types/components/cat-datepicker-inline/cat-datepicker-inline.d.ts +45 -45
- package/dist/types/components/cat-dropdown/cat-dropdown.d.ts +49 -49
- package/dist/types/components/cat-form-group/cat-form-group.d.ts +23 -23
- package/dist/types/components/cat-form-hint/cat-form-hint.d.ts +6 -6
- package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +17 -17
- package/dist/types/components/cat-icon/cat-icon-registry.d.ts +12 -12
- package/dist/types/components/cat-icon/cat-icon.d.ts +18 -18
- package/dist/types/components/cat-input/cat-input.d.ts +167 -167
- package/dist/types/components/cat-notification/cat-notification.d.ts +31 -31
- package/dist/types/components/cat-pagination/cat-pagination.d.ts +52 -52
- package/dist/types/components/cat-radio/cat-radio.d.ts +83 -83
- package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +49 -49
- package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +49 -49
- package/dist/types/components/cat-select/cat-select.d.ts +221 -221
- package/dist/types/components/cat-select/connectors.d.ts +5 -5
- package/dist/types/components/cat-select-demo/cat-select-demo.d.ts +11 -11
- package/dist/types/components/cat-skeleton/cat-skeleton.d.ts +23 -23
- package/dist/types/components/cat-spinner/cat-spinner.d.ts +10 -10
- package/dist/types/components/cat-tab/cat-tab.d.ts +48 -42
- package/dist/types/components/cat-tabs/cat-tabs.d.ts +40 -39
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +131 -131
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +93 -93
- package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +64 -64
- package/dist/types/components.d.ts +10 -2
- package/dist/types/stencil-public-runtime.d.ts +8 -0
- package/dist/types/utils/breakpoints.d.ts +1 -1
- package/dist/types/utils/media-matcher.d.ts +10 -10
- package/dist/types/utils/platform.d.ts +16 -16
- package/dist/types/utils/setDefault.d.ts +2 -2
- package/package.json +18 -18
- package/dist/catalyst/p-1bd44896.js +0 -3
- package/dist/catalyst/p-1bd44896.js.map +0 -1
- package/dist/catalyst/p-dc953306.entry.js +0 -10
- package/dist/catalyst/p-dc953306.entry.js.map +0 -1
- package/dist/cjs/index-1e7eef7e.js.map +0 -1
- package/dist/cjs/of-395b2f57.js.map +0 -1
- package/dist/esm/index-30a221a3.js.map +0 -1
- package/dist/esm/of-04d3d9e1.js.map +0 -1
- /package/dist/catalyst/{p-85d057f0.js.map → p-6ae13953.js.map} +0 -0
|
@@ -320,739 +320,739 @@ var autosizeInput = function (element, options) {
|
|
|
320
320
|
const catSelectCss = ".hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;display:flex;flex-direction:column;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem;line-height:1.125rem}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.primary.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.primary.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.primary.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-bg-primary-hover{transition:background-color 125ms, color 125ms}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.primary.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.primary.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.primary.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-link-primary,.cat-text-primary-hover{transition:color 125ms}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important;--cat-primary-text:cat-token(\"color.theme.primaryInverted.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.primaryInverted.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.primaryInverted.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-bg-primaryInverted-hover{transition:background-color 125ms, color 125ms}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important;--cat-primary-text:cat-token(\"color.theme.primaryInverted.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.primaryInverted.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.primaryInverted.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 125ms}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.secondary.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.secondary.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.secondary.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-bg-secondary-hover{transition:background-color 125ms, color 125ms}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.secondary.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.secondary.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.secondary.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}.cat-link-secondary,.cat-text-secondary-hover{transition:color 125ms}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important;--cat-primary-text:cat-token(\"color.theme.secondaryInverted.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.secondaryInverted.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.secondaryInverted.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-bg-secondaryInverted-hover{transition:background-color 125ms, color 125ms}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important;--cat-primary-text:cat-token(\"color.theme.secondaryInverted.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.secondaryInverted.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.secondaryInverted.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 125ms}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-info{background-color:rgb(var(--cat-success-bg, 0, 115, 230)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.info.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.info.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.info.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-bg-info-hover{transition:background-color 125ms, color 125ms}.cat-bg-info-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 107, 227)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.info.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.info.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.info.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-text-info,.cat-link-info{color:rgb(var(--cat-success-text, 0, 115, 230)) !important}.cat-link-info,.cat-text-info-hover{transition:color 125ms}.cat-link-info:hover,.cat-text-info-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 107, 227)) !important}.cat-link-info:active,.cat-text-info-hover:active{color:rgb(var(--cat-success-text-active, 0, 96, 223)) !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.success.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.success.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.success.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-bg-success-hover{transition:background-color 125ms, color 125ms}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.success.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.success.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.success.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}.cat-link-success,.cat-text-success-hover{transition:color 125ms}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important;--cat-primary-text:cat-token(\"color.theme.warning.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.warning.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.warning.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-bg-warning-hover{transition:background-color 125ms, color 125ms}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important;--cat-primary-text:cat-token(\"color.theme.warning.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.warning.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.warning.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}.cat-link-warning,.cat-text-warning-hover{transition:color 125ms}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.danger.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.danger.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.danger.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-bg-danger-hover{transition:background-color 125ms, color 125ms}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important;--cat-primary-text:cat-token(\"color.theme.danger.fill\", $wrap: false);--cat-primary-text-hover:cat-token(\"color.theme.danger.fill-hover\", $wrap: false);--cat-primary-text-active:cat-token(\"color.theme.danger.fill-active\", $wrap: false);--cat-link-decoration:underline}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}.cat-link-danger,.cat-text-danger-hover{transition:color 125ms}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-text-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-bg-muted{background-color:#f2f4f7 !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.input-field:not(.input-horizontal) .label-container.hidden,.textarea-field:not(.textarea-horizontal) .label-container.hidden,.select-field:not(.select-horizontal) .label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container{flex-basis:var(--label-size, 33.33%)}.label-container .label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-optional,.label-character-count{display:inline-flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem}.label-character-count{margin-left:auto}.input-horizontal .label-container.hidden label,.textarea-horizontal .label-container.hidden label,.select-horizontal .label-container.hidden label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}:host{display:flex;flex-direction:column;gap:0.5rem;line-height:1.25rem;position:relative}:host([hidden]){display:none}label{align-self:flex-start}label.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.select-field,.select-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.select-field.select-horizontal{flex-direction:row;gap:1rem}.select-wrapper{display:flex;align-items:flex-start;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:inset 0 0 0 1px rgb(var(--border-color));transition:box-shadow 125ms linear;padding:0.25rem;--border-color:var(--cat-border-color-dark, 215, 219, 224);}.select-wrapper:not(.select-disabled):hover{box-shadow:inset 0 0 0 1px rgb(var(--border-color)), 0 0 0 1px rgb(var(--border-color))}.select-wrapper:focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-1px}.select-wrapper.select-invalid{--border-color:var(--cat-danger-bg, 217, 52, 13), 0.2}.select-wrapper:has(input:-webkit-autofill),.select-wrapper:has(input:-webkit-autofill):hover,.select-wrapper:has(input:-webkit-autofill):focus{background-color:#e8f0fe}:host(.cat-error) .select-wrapper{box-shadow:0 0 0 1px rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) .select-wrapper:not(.input-disabled):hover{box-shadow:0 0 0 2px rgb(var(--cat-danger-bg, 217, 52, 13))}.select-disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108));pointer-events:none}.select-wrapper-inner{display:flex;flex:1 1 auto;flex-wrap:wrap;align-items:center;gap:0.25rem;min-width:0}.select-wrapper-inner>cat-avatar{display:inline-block;padding-left:0.5rem}.select-wrapper-inner>cat-avatar+.select-input{padding-left:0.25rem}.select-wrapper-inner cat-avatar{--cat-avatar-size:1.25rem;--cat-avatar-font-size:0.5rem}.select-input{font:inherit;background:none;border:none;outline:none;padding:0.375rem 0.5rem;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select-input::placeholder{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.select-disabled .select-input{cursor:inherit}.select-pills{display:contents}.pill{display:inline-flex;align-items:center;gap:0.5rem;padding:0.25rem 0.5rem;background:#f2f4f7;border-radius:var(--cat-border-radius-s, 0.125rem);white-space:nowrap;min-width:0}.pill>span{overflow:hidden;text-overflow:ellipsis;flex:1 1 0%}.pill>cat-button{margin-right:-0.25rem;margin-left:-0.25rem}.select-btn{transition:transform 125ms linear}.select-btn::part(button){outline:none}cat-spinner{padding:0.375rem}.icon-suffix{padding:0.25rem}.select-btn-open{transform:rotate(180deg)}.select-dropdown{position:fixed;right:0;background:white;display:none;overflow:auto;box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);border-radius:var(--cat-border-radius-m, 0.25rem);border:1px solid rgb(var(--cat-border-color, 235, 236, 240));z-index:calc(var(--cat-z-index, 1000) + 100);width:max-content;top:0;left:0}.select-options-wrapper{max-height:16rem;width:100%}.select-empty{margin:1rem 0;padding:0 1.25rem}.select-options{list-style-type:none;margin:0;padding:0.5rem 0}.select-options cat-checkbox,.select-options .select-option-single{margin:0;padding:0.5rem 1rem}.select-option-inner{display:flex;gap:0.5rem}.select-option-inner cat-avatar{--cat-avatar-size:1.25rem;--cat-avatar-font-size:0.5rem}.select-option-text{flex:1 1 0%;min-width:0}.select-option-single{cursor:pointer}.select-input-transparent-caret{caret-color:transparent}.select-option-empty,.select-option-loading{padding:0.5rem 1rem}.select-option:hover{background-color:rgba(var(--cat-secondary-bg, 105, 118, 135), 0.05)}.select-option-active{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-2px}.select-option-label{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-wrap:break-word;word-break:break-word}.select-option-description{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
|
|
321
321
|
|
|
322
322
|
const INIT_STATE = {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
323
|
+
term: '',
|
|
324
|
+
isOpen: false,
|
|
325
|
+
isLoading: false,
|
|
326
|
+
isResolving: false,
|
|
327
|
+
options: [],
|
|
328
|
+
selection: [],
|
|
329
|
+
tempSelection: [],
|
|
330
|
+
activeOptionIndex: -1,
|
|
331
|
+
activeSelectionIndex: -1
|
|
332
332
|
};
|
|
333
333
|
let nextUniqueId = 0;
|
|
334
334
|
let nextTagUniqueId = 0;
|
|
335
335
|
const CatSelect = /*@__PURE__*/ proxyCustomElement(class CatSelect extends HTMLElement {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
get id() {
|
|
376
|
-
return this.identifier || this._id;
|
|
377
|
-
}
|
|
378
|
-
onConnectorChanged(connector) {
|
|
379
|
-
this.reset(connector);
|
|
380
|
-
this.resolve();
|
|
381
|
-
}
|
|
382
|
-
onValueChanged() {
|
|
383
|
-
!this.valueChangedBySelection ? this.resolve() : (this.valueChangedBySelection = false);
|
|
384
|
-
}
|
|
385
|
-
onErrorsChanged(value) {
|
|
386
|
-
if (!coerceBoolean(this.errorUpdate)) {
|
|
387
|
-
this.errorMap = undefined;
|
|
336
|
+
constructor() {
|
|
337
|
+
super();
|
|
338
|
+
this.__registerHost();
|
|
339
|
+
this.__attachShadow();
|
|
340
|
+
this.catOpen = createEvent(this, "catOpen", 7);
|
|
341
|
+
this.catClose = createEvent(this, "catClose", 7);
|
|
342
|
+
this.catChange = createEvent(this, "catChange", 7);
|
|
343
|
+
this.catBlur = createEvent(this, "catBlur", 7);
|
|
344
|
+
this._id = `cat-input-${nextUniqueId++}`;
|
|
345
|
+
this.term$ = new Subject();
|
|
346
|
+
this.more$ = new Subject();
|
|
347
|
+
this.valueChangedBySelection = false;
|
|
348
|
+
this.connector = undefined;
|
|
349
|
+
this.state = INIT_STATE;
|
|
350
|
+
this.hasSlottedLabel = false;
|
|
351
|
+
this.hasSlottedHint = false;
|
|
352
|
+
this.errorMap = undefined;
|
|
353
|
+
this.requiredMarker = 'optional';
|
|
354
|
+
this.horizontal = false;
|
|
355
|
+
this.multiple = false;
|
|
356
|
+
this.debounce = 250;
|
|
357
|
+
this.placement = 'bottom-start';
|
|
358
|
+
this.value = undefined;
|
|
359
|
+
this.disabled = false;
|
|
360
|
+
this.placeholder = undefined;
|
|
361
|
+
this.hint = undefined;
|
|
362
|
+
this.identifier = undefined;
|
|
363
|
+
this.label = '';
|
|
364
|
+
this.name = undefined;
|
|
365
|
+
this.labelHidden = false;
|
|
366
|
+
this.required = false;
|
|
367
|
+
this.clearable = false;
|
|
368
|
+
this.tags = false;
|
|
369
|
+
this.tagHint = undefined;
|
|
370
|
+
this.noItems = undefined;
|
|
371
|
+
this.errors = undefined;
|
|
372
|
+
this.errorUpdate = 0;
|
|
373
|
+
this.nativeAttributes = undefined;
|
|
388
374
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
? value.reduce((acc, err) => ({ ...acc, [err]: undefined }), {})
|
|
392
|
-
: value === true
|
|
393
|
-
? {}
|
|
394
|
-
: value || undefined;
|
|
395
|
-
this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();
|
|
375
|
+
get id() {
|
|
376
|
+
return this.identifier || this._id;
|
|
396
377
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (changed('isOpen')) {
|
|
401
|
-
this.update();
|
|
378
|
+
onConnectorChanged(connector) {
|
|
379
|
+
this.reset(connector);
|
|
380
|
+
this.resolve();
|
|
402
381
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
?.querySelector(`#select-${this.id}-option-${this.state.activeOptionIndex}`)
|
|
406
|
-
?.scrollIntoView({ block: 'nearest' });
|
|
382
|
+
onValueChanged() {
|
|
383
|
+
!this.valueChangedBySelection ? this.resolve() : (this.valueChangedBySelection = false);
|
|
407
384
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
this.hide();
|
|
412
|
-
}
|
|
413
|
-
const idsSelected = this.state.selection.map(item => item.item.id);
|
|
414
|
-
if (!this.tags) {
|
|
415
|
-
if (this.multiple) {
|
|
416
|
-
newValue = idsSelected;
|
|
385
|
+
onErrorsChanged(value) {
|
|
386
|
+
if (!coerceBoolean(this.errorUpdate)) {
|
|
387
|
+
this.errorMap = undefined;
|
|
417
388
|
}
|
|
418
389
|
else {
|
|
419
|
-
|
|
390
|
+
this.errorMapSrc = Array.isArray(value)
|
|
391
|
+
? value.reduce((acc, err) => ({ ...acc, [err]: undefined }), {})
|
|
392
|
+
: value === true
|
|
393
|
+
? {}
|
|
394
|
+
: value || undefined;
|
|
395
|
+
this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();
|
|
420
396
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
.map(item => item.render.label);
|
|
427
|
-
if (this.multiple) {
|
|
428
|
-
newValue = { ids, tags };
|
|
397
|
+
}
|
|
398
|
+
onStateChanged(newState, oldState) {
|
|
399
|
+
const changed = (key) => newState[key] !== oldState[key];
|
|
400
|
+
if (changed('isOpen')) {
|
|
401
|
+
this.update();
|
|
429
402
|
}
|
|
430
|
-
|
|
431
|
-
|
|
403
|
+
if (changed('activeOptionIndex') && this.state.activeOptionIndex >= 0) {
|
|
404
|
+
this.dropdown
|
|
405
|
+
?.querySelector(`#select-${this.id}-option-${this.state.activeOptionIndex}`)
|
|
406
|
+
?.scrollIntoView({ block: 'nearest' });
|
|
407
|
+
}
|
|
408
|
+
if (changed('selection')) {
|
|
409
|
+
let newValue;
|
|
410
|
+
if (!this.multiple && this.state.selection.length) {
|
|
411
|
+
this.hide();
|
|
412
|
+
}
|
|
413
|
+
const idsSelected = this.state.selection.map(item => item.item.id);
|
|
414
|
+
if (!this.tags) {
|
|
415
|
+
if (this.multiple) {
|
|
416
|
+
newValue = idsSelected;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
newValue = idsSelected.length ? idsSelected[0] : '';
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
const ids = idsSelected.filter(id => !id.startsWith(`select-${this.id}-tag`));
|
|
424
|
+
const tags = this.state.selection
|
|
425
|
+
.filter(item => item.item.id.startsWith(`select-${this.id}-tag`))
|
|
426
|
+
.map(item => item.render.label);
|
|
427
|
+
if (this.multiple) {
|
|
428
|
+
newValue = { ids, tags };
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
newValue = { id: ids.length ? ids[0] : '', tag: tags.length ? tags[0] : '' };
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (!oldState.isResolving) {
|
|
435
|
+
this.valueChangedBySelection = true;
|
|
436
|
+
this.value = newValue;
|
|
437
|
+
}
|
|
438
|
+
this.catChange.emit();
|
|
439
|
+
this.showErrorsIfTimeout();
|
|
432
440
|
}
|
|
433
|
-
}
|
|
434
|
-
if (!oldState.isResolving) {
|
|
435
|
-
this.valueChangedBySelection = true;
|
|
436
|
-
this.value = newValue;
|
|
437
|
-
}
|
|
438
|
-
this.catChange.emit();
|
|
439
|
-
this.showErrorsIfTimeout();
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
componentDidLoad() {
|
|
443
|
-
if (this.input) {
|
|
444
|
-
autosizeInput(this.input);
|
|
445
|
-
}
|
|
446
|
-
if (this.trigger && this.dropdown) {
|
|
447
|
-
autoUpdate(this.trigger, this.dropdown, () => this.update());
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
componentWillRender() {
|
|
451
|
-
this.onErrorsChanged(this.errors);
|
|
452
|
-
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
453
|
-
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
454
|
-
if (!this.label && !this.hasSlottedLabel) {
|
|
455
|
-
loglevel.warn('[A11y] Missing ARIA label on select', this);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
onBlur(event) {
|
|
459
|
-
if (!this.multiple && this.state.activeOptionIndex >= 0) {
|
|
460
|
-
if (this.tags && this.state.options[this.state.activeOptionIndex].item.id === `select-${this.id}-option-tag`) {
|
|
461
|
-
this.createTag(this.state.term);
|
|
462
|
-
}
|
|
463
|
-
else {
|
|
464
|
-
this.select(this.state.options[this.state.activeOptionIndex]);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
this.hide();
|
|
468
|
-
// Conditionally remove selection if the option was not manually selected through click or enter key press
|
|
469
|
-
if (!this.multiple && (!this.tags || !this.state.selection?.length)) {
|
|
470
|
-
if (this.state.tempSelection?.length) {
|
|
471
|
-
this.patchState({
|
|
472
|
-
activeSelectionIndex: -1,
|
|
473
|
-
selection: this.state.tempSelection,
|
|
474
|
-
tempSelection: [],
|
|
475
|
-
options: [],
|
|
476
|
-
term: this.state.tempSelection[0].render.label
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
else if (!this.state.selection?.length) {
|
|
480
|
-
this.patchState({
|
|
481
|
-
activeSelectionIndex: -1,
|
|
482
|
-
selection: [],
|
|
483
|
-
tempSelection: [],
|
|
484
|
-
options: [],
|
|
485
|
-
term: ''
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
else {
|
|
490
|
-
this.patchState({ activeSelectionIndex: -1 });
|
|
491
|
-
}
|
|
492
|
-
this.catBlur.emit(event);
|
|
493
|
-
if (coerceBoolean(this.errorUpdate)) {
|
|
494
|
-
this.showErrors();
|
|
495
441
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
442
|
+
componentDidLoad() {
|
|
443
|
+
if (this.input) {
|
|
444
|
+
autosizeInput(this.input);
|
|
445
|
+
}
|
|
446
|
+
if (this.trigger && this.dropdown) {
|
|
447
|
+
autoUpdate(this.trigger, this.dropdown, () => this.update());
|
|
448
|
+
}
|
|
501
449
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
this.
|
|
505
|
-
this.
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
this.toggleTag(this.state.options[0]);
|
|
450
|
+
componentWillRender() {
|
|
451
|
+
this.onErrorsChanged(this.errors);
|
|
452
|
+
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
453
|
+
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
454
|
+
if (!this.label && !this.hasSlottedLabel) {
|
|
455
|
+
loglevel.warn('[A11y] Missing ARIA label on select', this);
|
|
509
456
|
}
|
|
510
|
-
|
|
511
|
-
|
|
457
|
+
}
|
|
458
|
+
onBlur(event) {
|
|
459
|
+
if (!this.multiple && this.state.activeOptionIndex >= 0) {
|
|
460
|
+
if (this.tags && this.state.options[this.state.activeOptionIndex].item.id === `select-${this.id}-option-tag`) {
|
|
461
|
+
this.createTag(this.state.term);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
this.select(this.state.options[this.state.activeOptionIndex]);
|
|
465
|
+
}
|
|
512
466
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
467
|
+
this.hide();
|
|
468
|
+
// Conditionally remove selection if the option was not manually selected through click or enter key press
|
|
469
|
+
if (!this.multiple && (!this.tags || !this.state.selection?.length)) {
|
|
470
|
+
if (this.state.tempSelection?.length) {
|
|
471
|
+
this.patchState({
|
|
472
|
+
activeSelectionIndex: -1,
|
|
473
|
+
selection: this.state.tempSelection,
|
|
474
|
+
tempSelection: [],
|
|
475
|
+
options: [],
|
|
476
|
+
term: this.state.tempSelection[0].render.label
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
else if (!this.state.selection?.length) {
|
|
480
|
+
this.patchState({
|
|
481
|
+
activeSelectionIndex: -1,
|
|
482
|
+
selection: [],
|
|
483
|
+
tempSelection: [],
|
|
484
|
+
options: [],
|
|
485
|
+
term: ''
|
|
486
|
+
});
|
|
487
|
+
}
|
|
518
488
|
}
|
|
519
489
|
else {
|
|
520
|
-
|
|
490
|
+
this.patchState({ activeSelectionIndex: -1 });
|
|
491
|
+
}
|
|
492
|
+
this.catBlur.emit(event);
|
|
493
|
+
if (coerceBoolean(this.errorUpdate)) {
|
|
494
|
+
this.showErrors();
|
|
521
495
|
}
|
|
522
|
-
}
|
|
523
|
-
else if (this.tags && event.key === 'Enter' && this.state.activeOptionIndex < 0) {
|
|
524
|
-
this.createTag(this.state.term);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
else if (event.key === 'Escape') {
|
|
528
|
-
if (this.hide()) {
|
|
529
|
-
event.stopPropagation();
|
|
530
|
-
}
|
|
531
496
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
this.deselect(this.state.selection[this.state.activeSelectionIndex].item.id);
|
|
497
|
+
onKeyDown(event) {
|
|
498
|
+
const isInputFocused = this.hostElement.shadowRoot?.activeElement === this.input;
|
|
499
|
+
if (['ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'].includes(event.key)) {
|
|
500
|
+
this.onArrowKeyDown(event);
|
|
537
501
|
}
|
|
538
|
-
else if (
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
502
|
+
else if (['Enter', ' '].includes(event.key) && isInputFocused) {
|
|
503
|
+
if (this.tags &&
|
|
504
|
+
this.state.activeOptionIndex === 0 &&
|
|
505
|
+
this.state.options[0].item.id === `select-${this.id}-option-tag`) {
|
|
506
|
+
event.preventDefault();
|
|
507
|
+
if (this.multiple) {
|
|
508
|
+
this.toggleTag(this.state.options[0]);
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
this.createTag(this.state.options[0].render.label);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
else if (this.state.activeOptionIndex >= 0) {
|
|
515
|
+
event.preventDefault();
|
|
516
|
+
if (this.multiple) {
|
|
517
|
+
this.toggle(this.state.options[this.state.activeOptionIndex]);
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
this.select(this.state.options[this.state.activeOptionIndex]);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
else if (this.tags && event.key === 'Enter' && this.state.activeOptionIndex < 0) {
|
|
524
|
+
this.createTag(this.state.term);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
else if (event.key === 'Escape') {
|
|
528
|
+
if (this.hide()) {
|
|
529
|
+
event.stopPropagation();
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
else if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
533
|
+
this.input?.focus();
|
|
534
|
+
if (!this.multiple || !this.state.term || (this.input?.selectionStart === 0 && event.key === 'Backspace')) {
|
|
535
|
+
if (this.state.activeSelectionIndex >= 0) {
|
|
536
|
+
this.deselect(this.state.selection[this.state.activeSelectionIndex].item.id);
|
|
537
|
+
}
|
|
538
|
+
else if (this.state.selection.length) {
|
|
539
|
+
const selectionClone = [...this.state.selection];
|
|
540
|
+
selectionClone.pop();
|
|
541
|
+
this.patchState({
|
|
542
|
+
selection: selectionClone,
|
|
543
|
+
tempSelection: this.state.term ? [...this.state.selection] : []
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
else if (event.key === 'Tab') {
|
|
549
|
+
this.trigger?.setAttribute('tabindex', '-1');
|
|
550
|
+
if (this.multiple) {
|
|
551
|
+
this.patchState({ activeSelectionIndex: -1, activeOptionIndex: -1 });
|
|
552
|
+
}
|
|
553
|
+
else if (this.state.activeOptionIndex >= 0) {
|
|
554
|
+
if (this.tags && this.state.options[this.state.activeOptionIndex].item.id === `select-${this.id}-option-tag`) {
|
|
555
|
+
this.createTag(this.state.term);
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
this.select(this.state.options[this.state.activeOptionIndex]);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
else if (event.key.length === 1) {
|
|
563
|
+
this.input?.focus();
|
|
545
564
|
}
|
|
546
|
-
}
|
|
547
565
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
if (this.tags && this.state.options[this.state.activeOptionIndex].item.id === `select-${this.id}-option-tag`) {
|
|
555
|
-
this.createTag(this.state.term);
|
|
566
|
+
onKeyUp(event) {
|
|
567
|
+
if (event.key === 'Tab' && !event.shiftKey) {
|
|
568
|
+
this.hostElement.shadowRoot?.activeElement === this.trigger && this.input?.focus();
|
|
569
|
+
if (this.hostElement.shadowRoot?.activeElement === this.input) {
|
|
570
|
+
this.show();
|
|
571
|
+
}
|
|
556
572
|
}
|
|
557
|
-
else {
|
|
558
|
-
|
|
573
|
+
else if (event.key === 'Tab' && event.shiftKey) {
|
|
574
|
+
const clearButton = this.trigger?.querySelector(`#select-clear-btn-${this.id}`);
|
|
575
|
+
if (clearButton) {
|
|
576
|
+
this.hostElement.shadowRoot?.activeElement === clearButton && this.show();
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
this.show();
|
|
580
|
+
}
|
|
559
581
|
}
|
|
560
|
-
}
|
|
561
582
|
}
|
|
562
|
-
|
|
563
|
-
|
|
583
|
+
/**
|
|
584
|
+
* Connect the functions of the select
|
|
585
|
+
*
|
|
586
|
+
* @param connector - The {@link CatSelectConnector} of the select.
|
|
587
|
+
*/
|
|
588
|
+
async connect(connector) {
|
|
589
|
+
this.connector = connector;
|
|
590
|
+
let number$;
|
|
591
|
+
this.subscription?.unsubscribe();
|
|
592
|
+
this.subscription = this.term$
|
|
593
|
+
.asObservable()
|
|
594
|
+
.pipe(debounce(term => (term ? timer(this.debounce) : of(0))), distinctUntilChanged(), tap(() => (number$ = this.more$.pipe(filter(() => !this.state.isLoading), scan(n => n + 1, 0), startWith(0)))), tap(() => this.patchState({ options: [] })), switchMap(term => number$.pipe(tap(() => this.patchState({ isLoading: true })), switchMap(number => connector.retrieve(term, number)), tap(page => this.patchState({ isLoading: false, totalElements: page.totalElements })), takeWhile(page => !page.last, true), scan((items, page) => [...items, ...page.content], []))))
|
|
595
|
+
.subscribe(items => {
|
|
596
|
+
const options = this.toSelectItems(connector, items);
|
|
597
|
+
if (this.tags &&
|
|
598
|
+
this.state.term.trim().length &&
|
|
599
|
+
!options.find(value1 => value1.render.label.toLowerCase() === this.state.term.toLowerCase())) {
|
|
600
|
+
let label;
|
|
601
|
+
if (this.isTagSelected(this.state.term)) {
|
|
602
|
+
label = this.state.selection.find(item => item.render.label.toLowerCase() === this.state.term.toLowerCase())
|
|
603
|
+
?.render.label;
|
|
604
|
+
}
|
|
605
|
+
options.unshift({
|
|
606
|
+
item: { id: `select-${this.id}-option-tag` },
|
|
607
|
+
render: { label: label ? label : this.state.term }
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
this.patchState({
|
|
611
|
+
options
|
|
612
|
+
});
|
|
613
|
+
});
|
|
564
614
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
615
|
+
render() {
|
|
616
|
+
return (h(Host, null, h("div", { class: {
|
|
617
|
+
'select-field': true,
|
|
618
|
+
'select-horizontal': this.horizontal
|
|
619
|
+
} }, h("div", { class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, part: "label" }, h("span", { class: "label-wrapper" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, h("div", { class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")"))))))), h("div", { class: "select-container" }, h("div", { class: { 'select-wrapper': true, 'select-disabled': this.disabled, 'select-invalid': this.invalid }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, h("div", { class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (h("span", { class: {
|
|
620
|
+
pill: true,
|
|
621
|
+
'select-no-open': true,
|
|
622
|
+
'select-option-active': this.state.activeSelectionIndex === i
|
|
623
|
+
}, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", null, item.render.label), !this.disabled && (h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1, "data-dropdown-no-close": true }))))))) : this.state.selection.length && this.state.selection[0].render.avatar ? (h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: this.state.selection[0].render.avatar.initials ?? '' })) : null, h("input", { ...this.nativeAttributes, part: "input", class: "select-input", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hasHint ? this.id + '-hint' : undefined, onInput: this.onInput.bind(this), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving })), this.state.isResolving && h("cat-spinner", null), this.invalid && (h("cat-icon", { icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
|
|
624
|
+
!this.disabled &&
|
|
625
|
+
!this.state.isResolving &&
|
|
626
|
+
this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: catI18nRegistry.t('input.clear'), onCatClick: () => this.clear(), "data-dropdown-no-close": true })) : null, !this.state.isResolving && (h("cat-button", { iconOnly: true, icon: "$cat:select-open", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? catI18nRegistry.t('select.close') : catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving, "data-dropdown-no-close": true }))), this.hasHint && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))), h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, h("ul", { class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isLoading
|
|
627
|
+
? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (h("li", { class: "select-option-loading" }, h("cat-skeleton", { variant: "body", lines: 1 }), h("cat-skeleton", { variant: "body", lines: 1 }))))
|
|
628
|
+
: !this.state.options.length &&
|
|
629
|
+
!this.tags && (h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catI18nRegistry.t('select.empty')))))))));
|
|
572
630
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (clearButton) {
|
|
576
|
-
this.hostElement.shadowRoot?.activeElement === clearButton && this.show();
|
|
577
|
-
}
|
|
578
|
-
else {
|
|
579
|
-
this.show();
|
|
580
|
-
}
|
|
631
|
+
get hasHint() {
|
|
632
|
+
return !!this.hint || !!this.hasSlottedHint || this.invalid;
|
|
581
633
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
634
|
+
get invalid() {
|
|
635
|
+
return !!Object.keys(this.errorMap || {}).length;
|
|
636
|
+
}
|
|
637
|
+
get optionsList() {
|
|
638
|
+
return this.state.options.map((item, i) => {
|
|
639
|
+
const isTagOption = this.tags && item.item.id === `select-${this.id}-option-tag`;
|
|
640
|
+
const isOptionSelected = this.isSelected(item.item.id) || (this.tags && this.isTagSelected(item.render.label));
|
|
641
|
+
const getLabel = () => {
|
|
642
|
+
if (isTagOption) {
|
|
643
|
+
return item.render.label + this.tagTextHelp;
|
|
644
|
+
}
|
|
645
|
+
return item.render.label;
|
|
646
|
+
};
|
|
647
|
+
return (h("li", { role: "option", class: "select-option", id: `select-${this.id}-option-${i}`, "aria-selected": isOptionSelected ? 'true' : 'false' }, this.multiple ? (h("cat-checkbox", { class: { 'select-option-active': this.state.activeOptionIndex === i }, checked: isOptionSelected, tabIndex: -1, labelLeft: true, onFocus: () => this.input?.focus(), onCatChange: e => {
|
|
648
|
+
!isTagOption ? this.toggle(item) : this.toggleTag(item);
|
|
649
|
+
e.stopPropagation();
|
|
650
|
+
} }, h("span", { slot: "label", class: "select-option-inner" }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))) : (h("div", { class: {
|
|
651
|
+
'select-option-inner': true,
|
|
652
|
+
'select-option-single': true,
|
|
653
|
+
'select-option-active': this.state.activeOptionIndex === i
|
|
654
|
+
}, onFocus: () => this.input?.focus(), onClick: () => (isTagOption ? this.createTag(item.render.label) : this.select(item)), tabIndex: -1 }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))));
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
resolve() {
|
|
658
|
+
const connector = this.connector;
|
|
659
|
+
if (!connector) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
this.patchState({ isResolving: true });
|
|
663
|
+
const ids = this.initIds();
|
|
664
|
+
let tags;
|
|
665
|
+
if (this.tags) {
|
|
666
|
+
tags = this.initTags();
|
|
604
667
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
668
|
+
const data$ = ids.length ? connector.resolve(ids).pipe(first()) : of([]);
|
|
669
|
+
data$.pipe(catchError(() => of([]))).subscribe(items => {
|
|
670
|
+
const selection = this.toSelectItems(connector, items);
|
|
671
|
+
if (this.tags) {
|
|
672
|
+
tags
|
|
673
|
+
.filter(tag => !this.isTagSelected(tag, selection))
|
|
674
|
+
.forEach((tag, index) => {
|
|
675
|
+
const item = { id: `select-${this.id}-tag-${index}`, name: tag };
|
|
676
|
+
selection.push({ item, render: { label: item.name } });
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
this.patchState({
|
|
680
|
+
isResolving: false,
|
|
681
|
+
selection,
|
|
682
|
+
term: !this.multiple && selection.length ? selection[0].render.label : ''
|
|
683
|
+
});
|
|
608
684
|
});
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
!this.disabled &&
|
|
625
|
-
!this.state.isResolving &&
|
|
626
|
-
this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: catI18nRegistry.t('input.clear'), onCatClick: () => this.clear(), "data-dropdown-no-close": true })) : null, !this.state.isResolving && (h("cat-button", { iconOnly: true, icon: "$cat:select-open", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? catI18nRegistry.t('select.close') : catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving, "data-dropdown-no-close": true }))), this.hasHint && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))), h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, h("ul", { class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isLoading
|
|
627
|
-
? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (h("li", { class: "select-option-loading" }, h("cat-skeleton", { variant: "body", lines: 1 }), h("cat-skeleton", { variant: "body", lines: 1 }))))
|
|
628
|
-
: !this.state.options.length &&
|
|
629
|
-
!this.tags && (h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catI18nRegistry.t('select.empty')))))))));
|
|
630
|
-
}
|
|
631
|
-
get hasHint() {
|
|
632
|
-
return !!this.hint || !!this.hasSlottedHint || this.invalid;
|
|
633
|
-
}
|
|
634
|
-
get invalid() {
|
|
635
|
-
return !!Object.keys(this.errorMap || {}).length;
|
|
636
|
-
}
|
|
637
|
-
get optionsList() {
|
|
638
|
-
return this.state.options.map((item, i) => {
|
|
639
|
-
const isTagOption = this.tags && item.item.id === `select-${this.id}-option-tag`;
|
|
640
|
-
const isOptionSelected = this.isSelected(item.item.id) || (this.tags && this.isTagSelected(item.render.label));
|
|
641
|
-
const getLabel = () => {
|
|
642
|
-
if (isTagOption) {
|
|
643
|
-
return item.render.label + this.tagTextHelp;
|
|
685
|
+
}
|
|
686
|
+
toSelectItems(connector, items) {
|
|
687
|
+
return items.map(item => ({
|
|
688
|
+
item: { ...item, id: connector.customId ? connector.customId(item) : item.id },
|
|
689
|
+
render: connector.render(item)
|
|
690
|
+
}));
|
|
691
|
+
}
|
|
692
|
+
show() {
|
|
693
|
+
if (!this.state.isOpen && this.connector) {
|
|
694
|
+
// reconnect to reset the connection, i.e. the pagination
|
|
695
|
+
this.connect(this.connector);
|
|
696
|
+
this.patchState({ isOpen: true });
|
|
697
|
+
this.catOpen.emit();
|
|
698
|
+
this.term$.next('');
|
|
699
|
+
this.input?.classList.remove('select-input-transparent-caret');
|
|
644
700
|
}
|
|
645
|
-
return item.render.label;
|
|
646
|
-
};
|
|
647
|
-
return (h("li", { role: "option", class: "select-option", id: `select-${this.id}-option-${i}`, "aria-selected": isOptionSelected ? 'true' : 'false' }, this.multiple ? (h("cat-checkbox", { class: { 'select-option-active': this.state.activeOptionIndex === i }, checked: isOptionSelected, tabIndex: -1, labelLeft: true, onFocus: () => this.input?.focus(), onCatChange: e => {
|
|
648
|
-
!isTagOption ? this.toggle(item) : this.toggleTag(item);
|
|
649
|
-
e.stopPropagation();
|
|
650
|
-
} }, h("span", { slot: "label", class: "select-option-inner" }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))) : (h("div", { class: {
|
|
651
|
-
'select-option-inner': true,
|
|
652
|
-
'select-option-single': true,
|
|
653
|
-
'select-option-active': this.state.activeOptionIndex === i
|
|
654
|
-
}, onFocus: () => this.input?.focus(), onClick: () => (isTagOption ? this.createTag(item.render.label) : this.select(item)), tabIndex: -1 }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))));
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
resolve() {
|
|
658
|
-
const connector = this.connector;
|
|
659
|
-
if (!connector) {
|
|
660
|
-
return;
|
|
661
701
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
702
|
+
hide() {
|
|
703
|
+
if (this.state.isOpen) {
|
|
704
|
+
this.patchState({ isOpen: false, activeOptionIndex: -1 });
|
|
705
|
+
this.catClose.emit();
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
return false;
|
|
667
709
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
if (this.tags) {
|
|
672
|
-
tags
|
|
673
|
-
.filter(tag => !this.isTagSelected(tag, selection))
|
|
674
|
-
.forEach((tag, index) => {
|
|
675
|
-
const item = { id: `select-${this.id}-tag-${index}`, name: tag };
|
|
676
|
-
selection.push({ item, render: { label: item.name } });
|
|
677
|
-
});
|
|
678
|
-
}
|
|
679
|
-
this.patchState({
|
|
680
|
-
isResolving: false,
|
|
681
|
-
selection,
|
|
682
|
-
term: !this.multiple && selection.length ? selection[0].render.label : ''
|
|
683
|
-
});
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
toSelectItems(connector, items) {
|
|
687
|
-
return items.map(item => ({
|
|
688
|
-
item: { ...item, id: connector.customId ? connector.customId(item) : item.id },
|
|
689
|
-
render: connector.render(item)
|
|
690
|
-
}));
|
|
691
|
-
}
|
|
692
|
-
show() {
|
|
693
|
-
if (!this.state.isOpen && this.connector) {
|
|
694
|
-
// reconnect to reset the connection, i.e. the pagination
|
|
695
|
-
this.connect(this.connector);
|
|
696
|
-
this.patchState({ isOpen: true });
|
|
697
|
-
this.catOpen.emit();
|
|
698
|
-
this.term$.next('');
|
|
699
|
-
this.input?.classList.remove('select-input-transparent-caret');
|
|
710
|
+
search(term) {
|
|
711
|
+
this.patchState({ term, activeOptionIndex: -1, activeSelectionIndex: -1 });
|
|
712
|
+
this.term$.next(term);
|
|
700
713
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
if (this.state.isOpen) {
|
|
704
|
-
this.patchState({ isOpen: false, activeOptionIndex: -1 });
|
|
705
|
-
this.catClose.emit();
|
|
706
|
-
return true;
|
|
714
|
+
isSelected(id) {
|
|
715
|
+
return this.state.selection.findIndex(s => s.item.id === id) >= 0;
|
|
707
716
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
this.
|
|
726
|
-
}
|
|
727
|
-
this.patchState({ selection: newSelection, tempSelection: [] });
|
|
728
|
-
if (this.multiple && this.state.term.trim() && this.input) {
|
|
729
|
-
this.patchState({ term: '', activeOptionIndex: -1 });
|
|
730
|
-
this.term$.next('');
|
|
731
|
-
this.input.value = '';
|
|
732
|
-
}
|
|
717
|
+
select(item) {
|
|
718
|
+
if (!this.isSelected(item.item.id)) {
|
|
719
|
+
let newSelection;
|
|
720
|
+
if (this.multiple) {
|
|
721
|
+
newSelection = [...this.state.selection, item];
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
newSelection = [item];
|
|
725
|
+
this.search(item.render.label);
|
|
726
|
+
}
|
|
727
|
+
this.patchState({ selection: newSelection, tempSelection: [] });
|
|
728
|
+
if (this.multiple && this.state.term.trim() && this.input) {
|
|
729
|
+
this.patchState({ term: '', activeOptionIndex: -1 });
|
|
730
|
+
this.term$.next('');
|
|
731
|
+
this.input.value = '';
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
this.setTransparentCaret();
|
|
733
735
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
});
|
|
736
|
+
deselect(id) {
|
|
737
|
+
if (this.isSelected(id)) {
|
|
738
|
+
this.patchState({
|
|
739
|
+
selection: this.state.selection.filter(item => item.item.id !== id),
|
|
740
|
+
activeSelectionIndex: -1
|
|
741
|
+
});
|
|
742
|
+
}
|
|
742
743
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
: this.select(item);
|
|
750
|
-
}
|
|
751
|
-
clear() {
|
|
752
|
-
if (this.input && this.state.term) {
|
|
753
|
-
this.patchState({ selection: [], term: '', activeOptionIndex: -1, tempSelection: [] });
|
|
754
|
-
this.term$.next('');
|
|
755
|
-
this.input.value = '';
|
|
744
|
+
toggle(item) {
|
|
745
|
+
this.isSelected(item.item.id)
|
|
746
|
+
? this.deselect(item.item.id)
|
|
747
|
+
: this.tags && this.isTagSelected(item.render.label)
|
|
748
|
+
? this.removeTag(item.render.label)
|
|
749
|
+
: this.select(item);
|
|
756
750
|
}
|
|
757
|
-
|
|
758
|
-
|
|
751
|
+
clear() {
|
|
752
|
+
if (this.input && this.state.term) {
|
|
753
|
+
this.patchState({ selection: [], term: '', activeOptionIndex: -1, tempSelection: [] });
|
|
754
|
+
this.term$.next('');
|
|
755
|
+
this.input.value = '';
|
|
756
|
+
}
|
|
757
|
+
else {
|
|
758
|
+
this.patchState({ selection: [], tempSelection: [] });
|
|
759
|
+
}
|
|
759
760
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
this.state = INIT_STATE;
|
|
766
|
-
}
|
|
767
|
-
onClick(event) {
|
|
768
|
-
if (this.disabled) {
|
|
769
|
-
return;
|
|
761
|
+
reset(connector) {
|
|
762
|
+
this.connector = connector ?? this.connector;
|
|
763
|
+
this.subscription?.unsubscribe();
|
|
764
|
+
this.subscription = undefined;
|
|
765
|
+
this.state = INIT_STATE;
|
|
770
766
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
767
|
+
onClick(event) {
|
|
768
|
+
if (this.disabled) {
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
const elem = event.target;
|
|
772
|
+
this.trigger?.setAttribute('tabindex', '0');
|
|
773
|
+
this.input?.focus();
|
|
774
|
+
if (elem === this.trigger ||
|
|
775
|
+
elem === this.input ||
|
|
776
|
+
elem.classList.contains('select-btn') ||
|
|
777
|
+
elem.nodeName === 'SPAN') {
|
|
778
|
+
this.state.isOpen ? this.hide() : this.show();
|
|
779
|
+
}
|
|
779
780
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
781
|
+
onInput() {
|
|
782
|
+
this.search(this.input?.value.trim() || '');
|
|
783
|
+
if (!this.multiple) {
|
|
784
|
+
if (this.state.selection.length) {
|
|
785
|
+
const selectionClone = [...this.state.selection];
|
|
786
|
+
selectionClone.pop();
|
|
787
|
+
this.patchState({ selection: selectionClone, tempSelection: [...this.state.selection] });
|
|
788
|
+
}
|
|
789
|
+
if (!this.input?.value.trim()) {
|
|
790
|
+
this.patchState({ tempSelection: [] });
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
this.show();
|
|
792
794
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
795
|
+
update() {
|
|
796
|
+
if (this.trigger && this.dropdown) {
|
|
797
|
+
computePosition(this.trigger, this.dropdown, {
|
|
798
|
+
strategy: 'fixed',
|
|
799
|
+
placement: this.placement,
|
|
800
|
+
middleware: [offset(CatSelect.DROPDOWN_OFFSET), flip()]
|
|
801
|
+
}).then(({ x, y, placement }) => {
|
|
802
|
+
if (this.dropdown) {
|
|
803
|
+
this.dropdown.dataset.placement = placement;
|
|
804
|
+
Object.assign(this.dropdown.style, {
|
|
805
|
+
width: `${this.trigger?.clientWidth}px`,
|
|
806
|
+
left: `${x}px`,
|
|
807
|
+
top: `${y}px`
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
});
|
|
809
811
|
}
|
|
810
|
-
});
|
|
811
812
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
this.state = { ...this.state, ...update };
|
|
815
|
-
}
|
|
816
|
-
isPillboxActive() {
|
|
817
|
-
return this.state.activeSelectionIndex >= 0;
|
|
818
|
-
}
|
|
819
|
-
get activeDescendant() {
|
|
820
|
-
let activeDescendant = undefined;
|
|
821
|
-
if (this.state.activeOptionIndex >= 0) {
|
|
822
|
-
activeDescendant = `select-${this.id}-option-${this.state.activeOptionIndex}`;
|
|
813
|
+
patchState(update) {
|
|
814
|
+
this.state = { ...this.state, ...update };
|
|
823
815
|
}
|
|
824
|
-
|
|
825
|
-
|
|
816
|
+
isPillboxActive() {
|
|
817
|
+
return this.state.activeSelectionIndex >= 0;
|
|
826
818
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
this.input?.focus();
|
|
832
|
-
switch (event.key) {
|
|
833
|
-
case 'ArrowDown':
|
|
834
|
-
preventDefault = true;
|
|
835
|
-
this.state.isOpen
|
|
836
|
-
? this.patchState({
|
|
837
|
-
activeOptionIndex: Math.min(this.state.activeOptionIndex + 1, this.state.options.length - 1),
|
|
838
|
-
activeSelectionIndex: -1
|
|
839
|
-
})
|
|
840
|
-
: this.show();
|
|
841
|
-
break;
|
|
842
|
-
case 'ArrowUp':
|
|
843
|
-
preventDefault = true;
|
|
844
|
-
this.state.activeOptionIndex >= 0
|
|
845
|
-
? this.patchState({
|
|
846
|
-
activeOptionIndex: Math.max(this.state.activeOptionIndex - 1, -1),
|
|
847
|
-
activeSelectionIndex: -1
|
|
848
|
-
})
|
|
849
|
-
: this.hide();
|
|
850
|
-
break;
|
|
851
|
-
case 'ArrowLeft':
|
|
852
|
-
if (this.input?.selectionStart === 0) {
|
|
853
|
-
preventDefault = true;
|
|
854
|
-
let index;
|
|
855
|
-
this.state.activeSelectionIndex > 0
|
|
856
|
-
? (index = Math.max(this.state.activeSelectionIndex - 1, -1))
|
|
857
|
-
: (index = this.state.selection.length - 1);
|
|
858
|
-
this.patchState({ activeSelectionIndex: index, activeOptionIndex: -1 });
|
|
819
|
+
get activeDescendant() {
|
|
820
|
+
let activeDescendant = undefined;
|
|
821
|
+
if (this.state.activeOptionIndex >= 0) {
|
|
822
|
+
activeDescendant = `select-${this.id}-option-${this.state.activeOptionIndex}`;
|
|
859
823
|
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
if (this.state.activeSelectionIndex >= 0) {
|
|
863
|
-
preventDefault = true;
|
|
864
|
-
let index = -1;
|
|
865
|
-
if (this.state.activeSelectionIndex < this.state.selection.length - 1) {
|
|
866
|
-
index = Math.min(this.state.activeSelectionIndex + 1, this.state.selection.length - 1);
|
|
867
|
-
}
|
|
868
|
-
else if (!this.state.term) {
|
|
869
|
-
index = 0;
|
|
870
|
-
}
|
|
871
|
-
this.patchState({ activeSelectionIndex: index, activeOptionIndex: -1 });
|
|
824
|
+
else if (this.state.activeSelectionIndex >= 0) {
|
|
825
|
+
activeDescendant = `select-${this.id}-selection-${this.state.activeSelectionIndex}`;
|
|
872
826
|
}
|
|
827
|
+
return activeDescendant;
|
|
873
828
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
829
|
+
onArrowKeyDown(event) {
|
|
830
|
+
let preventDefault = false;
|
|
831
|
+
this.input?.focus();
|
|
832
|
+
switch (event.key) {
|
|
833
|
+
case 'ArrowDown':
|
|
834
|
+
preventDefault = true;
|
|
835
|
+
this.state.isOpen
|
|
836
|
+
? this.patchState({
|
|
837
|
+
activeOptionIndex: Math.min(this.state.activeOptionIndex + 1, this.state.options.length - 1),
|
|
838
|
+
activeSelectionIndex: -1
|
|
839
|
+
})
|
|
840
|
+
: this.show();
|
|
841
|
+
break;
|
|
842
|
+
case 'ArrowUp':
|
|
843
|
+
preventDefault = true;
|
|
844
|
+
this.state.activeOptionIndex >= 0
|
|
845
|
+
? this.patchState({
|
|
846
|
+
activeOptionIndex: Math.max(this.state.activeOptionIndex - 1, -1),
|
|
847
|
+
activeSelectionIndex: -1
|
|
848
|
+
})
|
|
849
|
+
: this.hide();
|
|
850
|
+
break;
|
|
851
|
+
case 'ArrowLeft':
|
|
852
|
+
if (this.input?.selectionStart === 0) {
|
|
853
|
+
preventDefault = true;
|
|
854
|
+
let index;
|
|
855
|
+
this.state.activeSelectionIndex > 0
|
|
856
|
+
? (index = Math.max(this.state.activeSelectionIndex - 1, -1))
|
|
857
|
+
: (index = this.state.selection.length - 1);
|
|
858
|
+
this.patchState({ activeSelectionIndex: index, activeOptionIndex: -1 });
|
|
859
|
+
}
|
|
860
|
+
break;
|
|
861
|
+
case 'ArrowRight':
|
|
862
|
+
if (this.state.activeSelectionIndex >= 0) {
|
|
863
|
+
preventDefault = true;
|
|
864
|
+
let index = -1;
|
|
865
|
+
if (this.state.activeSelectionIndex < this.state.selection.length - 1) {
|
|
866
|
+
index = Math.min(this.state.activeSelectionIndex + 1, this.state.selection.length - 1);
|
|
867
|
+
}
|
|
868
|
+
else if (!this.state.term) {
|
|
869
|
+
index = 0;
|
|
870
|
+
}
|
|
871
|
+
this.patchState({ activeSelectionIndex: index, activeOptionIndex: -1 });
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
if (preventDefault) {
|
|
875
|
+
event.preventDefault();
|
|
876
|
+
event.stopPropagation();
|
|
877
|
+
}
|
|
877
878
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
return this.tagHint && !this.isTagSelected(this.state.term) ? ' (' + this.tagHint + ')' : '';
|
|
881
|
-
}
|
|
882
|
-
isTagSelected(term, selection = this.state.selection) {
|
|
883
|
-
return selection.findIndex(item => item.render.label.toLowerCase() === term.toLowerCase()) >= 0;
|
|
884
|
-
}
|
|
885
|
-
createTag(term) {
|
|
886
|
-
if (term.trim().length && !this.isTagSelected(term)) {
|
|
887
|
-
const value = this.value;
|
|
888
|
-
const tags = value?.tags;
|
|
889
|
-
const tag = { id: `select-${this.id}-tag-${tags?.length ? tags?.length + nextTagUniqueId++ : 0}`, name: term };
|
|
890
|
-
this.select({ item: tag, render: { label: tag.name } });
|
|
879
|
+
get tagTextHelp() {
|
|
880
|
+
return this.tagHint && !this.isTagSelected(this.state.term) ? ' (' + this.tagHint + ')' : '';
|
|
891
881
|
}
|
|
892
|
-
this.
|
|
893
|
-
|
|
894
|
-
removeTag(label) {
|
|
895
|
-
if (this.isTagSelected(label)) {
|
|
896
|
-
const item = this.state.selection.find(item => item.render.label.toLowerCase() === label.toLowerCase());
|
|
897
|
-
item && this.deselect(item.item.id);
|
|
882
|
+
isTagSelected(term, selection = this.state.selection) {
|
|
883
|
+
return selection.findIndex(item => item.render.label.toLowerCase() === term.toLowerCase()) >= 0;
|
|
898
884
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
if (this.value) {
|
|
906
|
-
if (!this.tags) {
|
|
907
|
-
if (this.multiple) {
|
|
908
|
-
ids = this.value;
|
|
885
|
+
createTag(term) {
|
|
886
|
+
if (term.trim().length && !this.isTagSelected(term)) {
|
|
887
|
+
const value = this.value;
|
|
888
|
+
const tags = value?.tags;
|
|
889
|
+
const tag = { id: `select-${this.id}-tag-${tags?.length ? tags?.length + nextTagUniqueId++ : 0}`, name: term };
|
|
890
|
+
this.select({ item: tag, render: { label: tag.name } });
|
|
909
891
|
}
|
|
910
|
-
|
|
911
|
-
|
|
892
|
+
this.setTransparentCaret();
|
|
893
|
+
}
|
|
894
|
+
removeTag(label) {
|
|
895
|
+
if (this.isTagSelected(label)) {
|
|
896
|
+
const item = this.state.selection.find(item => item.render.label.toLowerCase() === label.toLowerCase());
|
|
897
|
+
item && this.deselect(item.item.id);
|
|
912
898
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
899
|
+
}
|
|
900
|
+
toggleTag(item) {
|
|
901
|
+
this.isTagSelected(item.render.label) ? this.removeTag(item.render.label) : this.createTag(item.render.label);
|
|
902
|
+
}
|
|
903
|
+
initIds() {
|
|
904
|
+
let ids = [];
|
|
905
|
+
if (this.value) {
|
|
906
|
+
if (!this.tags) {
|
|
907
|
+
if (this.multiple) {
|
|
908
|
+
ids = this.value;
|
|
909
|
+
}
|
|
910
|
+
else {
|
|
911
|
+
ids = [this.value];
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
else {
|
|
915
|
+
if (this.multiple) {
|
|
916
|
+
const value = this.value;
|
|
917
|
+
ids = value.ids ? value.ids : [];
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
const value = this.value;
|
|
921
|
+
ids = value.id ? [value.id] : [];
|
|
922
|
+
}
|
|
923
|
+
}
|
|
918
924
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
925
|
+
return ids;
|
|
926
|
+
}
|
|
927
|
+
initTags() {
|
|
928
|
+
let tags = [];
|
|
929
|
+
if (this.value) {
|
|
930
|
+
if (this.multiple) {
|
|
931
|
+
const value = this.value;
|
|
932
|
+
tags = value.tags ? value.tags : [];
|
|
933
|
+
}
|
|
934
|
+
else {
|
|
935
|
+
const value = this.value;
|
|
936
|
+
tags = value.tag ? [value.tag] : [];
|
|
937
|
+
}
|
|
922
938
|
}
|
|
923
|
-
|
|
939
|
+
return tags;
|
|
924
940
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
if (this.multiple) {
|
|
931
|
-
const value = this.value;
|
|
932
|
-
tags = value.tags ? value.tags : [];
|
|
933
|
-
}
|
|
934
|
-
else {
|
|
935
|
-
const value = this.value;
|
|
936
|
-
tags = value.tag ? [value.tag] : [];
|
|
937
|
-
}
|
|
941
|
+
setTransparentCaret() {
|
|
942
|
+
if (!this.multiple) {
|
|
943
|
+
this.hide();
|
|
944
|
+
this.input?.classList.add('select-input-transparent-caret');
|
|
945
|
+
}
|
|
938
946
|
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
setTransparentCaret() {
|
|
942
|
-
if (!this.multiple) {
|
|
943
|
-
this.hide();
|
|
944
|
-
this.input?.classList.add('select-input-transparent-caret');
|
|
947
|
+
showErrors() {
|
|
948
|
+
this.errorMap = this.errorMapSrc;
|
|
945
949
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);
|
|
955
|
-
return true;
|
|
950
|
+
showErrorsIfTimeout() {
|
|
951
|
+
const errorUpdate = coerceNumber(this.errorUpdate, null);
|
|
952
|
+
if (errorUpdate !== null) {
|
|
953
|
+
typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);
|
|
954
|
+
this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);
|
|
955
|
+
return true;
|
|
956
|
+
}
|
|
957
|
+
return false;
|
|
956
958
|
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
this.showErrors();
|
|
959
|
+
showErrorsIfNoFocus() {
|
|
960
|
+
const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.input;
|
|
961
|
+
if (!hasFocus) {
|
|
962
|
+
this.showErrors();
|
|
963
|
+
}
|
|
963
964
|
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
static get style() { return catSelectCss; }
|
|
965
|
+
get hostElement() { return this; }
|
|
966
|
+
static get watchers() { return {
|
|
967
|
+
"connector": ["onConnectorChanged"],
|
|
968
|
+
"value": ["onValueChanged"],
|
|
969
|
+
"errors": ["onErrorsChanged"],
|
|
970
|
+
"state": ["onStateChanged"]
|
|
971
|
+
}; }
|
|
972
|
+
static get style() { return catSelectCss; }
|
|
973
973
|
}, [1, "cat-select", {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
974
|
+
"requiredMarker": [1, "required-marker"],
|
|
975
|
+
"horizontal": [4],
|
|
976
|
+
"multiple": [4],
|
|
977
|
+
"debounce": [2],
|
|
978
|
+
"placement": [1],
|
|
979
|
+
"value": [1025],
|
|
980
|
+
"disabled": [4],
|
|
981
|
+
"placeholder": [1],
|
|
982
|
+
"hint": [1],
|
|
983
|
+
"identifier": [1],
|
|
984
|
+
"label": [1],
|
|
985
|
+
"name": [1],
|
|
986
|
+
"labelHidden": [4, "label-hidden"],
|
|
987
|
+
"required": [4],
|
|
988
|
+
"clearable": [4],
|
|
989
|
+
"tags": [4],
|
|
990
|
+
"tagHint": [1, "tag-hint"],
|
|
991
|
+
"noItems": [1, "no-items"],
|
|
992
|
+
"errors": [4],
|
|
993
|
+
"errorUpdate": [8, "error-update"],
|
|
994
|
+
"nativeAttributes": [16],
|
|
995
|
+
"connector": [32],
|
|
996
|
+
"state": [32],
|
|
997
|
+
"hasSlottedLabel": [32],
|
|
998
|
+
"hasSlottedHint": [32],
|
|
999
|
+
"errorMap": [32],
|
|
1000
|
+
"connect": [64]
|
|
1001
|
+
}, [[0, "blur", "onBlur"], [0, "keydown", "onKeyDown"], [0, "keyup", "onKeyUp"]], {
|
|
1002
|
+
"connector": ["onConnectorChanged"],
|
|
1003
|
+
"value": ["onValueChanged"],
|
|
1004
|
+
"errors": ["onErrorsChanged"],
|
|
1005
|
+
"state": ["onStateChanged"]
|
|
1006
|
+
}]);
|
|
1007
1007
|
CatSelect.SKELETON_COUNT = 4;
|
|
1008
1008
|
CatSelect.DROPDOWN_OFFSET = 4;
|
|
1009
1009
|
function defineCustomElement() {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1010
|
+
if (typeof customElements === "undefined") {
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
const components = ["cat-select", "cat-avatar", "cat-button", "cat-checkbox", "cat-icon", "cat-scrollable", "cat-skeleton", "cat-spinner"];
|
|
1014
|
+
components.forEach(tagName => { switch (tagName) {
|
|
1015
|
+
case "cat-select":
|
|
1016
|
+
if (!customElements.get(tagName)) {
|
|
1017
|
+
customElements.define(tagName, CatSelect);
|
|
1018
|
+
}
|
|
1019
|
+
break;
|
|
1020
|
+
case "cat-avatar":
|
|
1021
|
+
if (!customElements.get(tagName)) {
|
|
1022
|
+
defineCustomElement$7();
|
|
1023
|
+
}
|
|
1024
|
+
break;
|
|
1025
|
+
case "cat-button":
|
|
1026
|
+
if (!customElements.get(tagName)) {
|
|
1027
|
+
defineCustomElement$6();
|
|
1028
|
+
}
|
|
1029
|
+
break;
|
|
1030
|
+
case "cat-checkbox":
|
|
1031
|
+
if (!customElements.get(tagName)) {
|
|
1032
|
+
defineCustomElement$5();
|
|
1033
|
+
}
|
|
1034
|
+
break;
|
|
1035
|
+
case "cat-icon":
|
|
1036
|
+
if (!customElements.get(tagName)) {
|
|
1037
|
+
defineCustomElement$4();
|
|
1038
|
+
}
|
|
1039
|
+
break;
|
|
1040
|
+
case "cat-scrollable":
|
|
1041
|
+
if (!customElements.get(tagName)) {
|
|
1042
|
+
defineCustomElement$3();
|
|
1043
|
+
}
|
|
1044
|
+
break;
|
|
1045
|
+
case "cat-skeleton":
|
|
1046
|
+
if (!customElements.get(tagName)) {
|
|
1047
|
+
defineCustomElement$2();
|
|
1048
|
+
}
|
|
1049
|
+
break;
|
|
1050
|
+
case "cat-spinner":
|
|
1051
|
+
if (!customElements.get(tagName)) {
|
|
1052
|
+
defineCustomElement$1();
|
|
1053
|
+
}
|
|
1054
|
+
break;
|
|
1055
|
+
} });
|
|
1056
1056
|
}
|
|
1057
1057
|
|
|
1058
1058
|
export { CatSelect as C, concat as c, defineCustomElement as d, take as t };
|