@sixbell-telco/sdk 0.71.0 → 1.0.1
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/CHANGELOG.md +307 -26
- package/README.md +285 -224
- package/_index.css +452 -0
- package/components/accordion/accordion-item/accordion-item.component.d.ts +1 -1
- package/components/audio-player/audio-timeline/audio-timeline.component.d.ts +2 -2
- package/components/audio-player/button-play/button-play.component.d.ts +6 -6
- package/components/audio-player/services/audio.service.d.ts +1 -0
- package/components/audio-player/src/audio-player.component.d.ts +14 -8
- package/components/audio-player/volume-control/volume-control.component.d.ts +2 -2
- package/components/avatar/src/avatar.component.d.ts +116 -8
- package/components/badge/src/badge.component.d.ts +69 -7
- package/components/button/src/button.component.d.ts +120 -8
- package/components/card/card-actions/card-actions.component.d.ts +29 -1
- package/components/card/card-content/card-content.component.d.ts +25 -0
- package/components/card/card-title/card-title.component.d.ts +22 -0
- package/components/card/src/card.component.d.ts +90 -5
- package/components/countdown/src/countdown.component.d.ts +2 -6
- package/components/dropdown/dropdown-item/dropdown-item.component.d.ts +35 -2
- package/components/dropdown/src/dropdown.component.d.ts +151 -9
- package/components/dual-list/src/dual-list.component.d.ts +7 -8
- package/components/file-upload/file-dropzone/file-dropzone.component.d.ts +254 -0
- package/components/file-upload/file-uploader/file-uploader.component.d.ts +209 -0
- package/components/file-upload/index.d.ts +5 -0
- package/components/file-upload/public-api.d.ts +4 -0
- package/components/file-upload/shared/types/file-upload.d.ts +8 -0
- package/components/forms/checkbox/src/checkbox.component.d.ts +68 -5
- package/components/forms/combobox/src/combobox.component.d.ts +476 -39
- package/components/forms/datepicker/src/datepicker.component.d.ts +2 -2
- package/components/forms/form-error/src/form-error.component.d.ts +2 -2
- package/components/forms/input/input-content/input-content.component.d.ts +8 -0
- package/components/forms/input/public-api.d.ts +1 -0
- package/components/forms/input/src/input.component.d.ts +148 -25
- package/components/forms/radio/src/radio.component.d.ts +83 -7
- package/components/forms/range/src/range.component.d.ts +101 -6
- package/components/forms/select/src/select.component.d.ts +316 -24
- package/components/forms/switch/src/switch.component.d.ts +74 -7
- package/components/forms/textarea/src/textarea.component.d.ts +172 -16
- package/components/forms/toggle/src/toggle.component.d.ts +3 -3
- package/components/icon/src/icon.component.d.ts +5 -5
- package/components/link/src/link.component.d.ts +1 -1
- package/components/modal/modal-actions/modal-actions.component.d.ts +1 -1
- package/components/modal/src/modal.component.d.ts +10 -10
- package/components/notification/src/notification.component.d.ts +2 -3
- package/components/paginator/components/pagination-item/pagination-item.component.d.ts +64 -15
- package/components/paginator/src/paginator.component.d.ts +93 -2
- package/components/product-card/src/product-card.component.d.ts +7 -8
- package/components/progress/src/progress.component.d.ts +59 -4
- package/components/tab/directives/tab-content/tab-content.directive.d.ts +1 -1
- package/components/tab/directives/tab-header/tab-header.directive.d.ts +1 -1
- package/components/tab/src/tab.component.d.ts +3 -3
- package/components/table/public-api.d.ts +2 -0
- package/components/table/src/table.component.d.ts +160 -14
- package/components/table/table-action/table-action.component.d.ts +49 -0
- package/components/table/table-actions/table-actions.component.d.ts +25 -0
- package/components/table/table-header-checkbox/table-header-checkbox.component.d.ts +42 -0
- package/components/table/table-row-checkbox/table-row-checkbox.component.d.ts +46 -0
- package/components/toast/toast-message/toast-message.component.d.ts +3 -3
- package/components/tooltip/public-api.d.ts +1 -0
- package/components/tooltip/src/tooltip.component.d.ts +66 -5
- package/components/tooltip/tooltip-content/tooltip-content.component.d.ts +38 -0
- package/components/wizard/public-api.d.ts +2 -3
- package/components/wizard/services/wizard.service.d.ts +221 -0
- package/components/wizard/wizard-actions/wizard-actions.component.d.ts +8 -0
- package/components/wizard/wizard-content/wizard-content.component.d.ts +67 -13
- package/components/wizard/wizard-marker/wizard-marker.component.d.ts +81 -6
- package/components/wizard/wizard-step/wizard-step.component.d.ts +76 -9
- package/components/wizard/wizard-sub-step/wizard-sub-step.component.d.ts +91 -9
- package/components/wizard/wizard-wrapper/wizard-wrapper.component.d.ts +152 -16
- package/directives/auto-focus/index.d.ts +5 -0
- package/directives/auto-focus/public-api.d.ts +1 -0
- package/directives/auto-focus/src/autofocus.directive.d.ts +93 -0
- package/directives/click-outside/src/click-outside.directive.d.ts +48 -3
- package/directives/only-numbers/index.d.ts +5 -0
- package/directives/only-numbers/public-api.d.ts +1 -0
- package/directives/only-numbers/src/just-numbers.directive.d.ts +9 -0
- package/directives/typography/src/typography.directive.d.ts +47 -1
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs +10 -12
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs +119 -69
- package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs +109 -19
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-badge.mjs +92 -46
- package/fesm2022/sixbell-telco-sdk-components-badge.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-button.mjs +153 -34
- package/fesm2022/sixbell-telco-sdk-components-button.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-card.mjs +195 -33
- package/fesm2022/sixbell-telco-sdk-components-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-countdown.mjs +8 -11
- package/fesm2022/sixbell-telco-sdk-components-countdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +197 -26
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +30 -18
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs +706 -0
- package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs +85 -25
- package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +996 -113
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +11 -11
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs +13 -12
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +221 -121
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs +98 -26
- package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs +117 -25
- package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +671 -74
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs +95 -45
- package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs +236 -75
- package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs +74 -258
- package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-icon.mjs +23 -14
- package/fesm2022/sixbell-telco-sdk-components-icon.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-link.mjs +16 -16
- package/fesm2022/sixbell-telco-sdk-components-link.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs +39 -36
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-notification.mjs +16 -9
- package/fesm2022/sixbell-telco-sdk-components-notification.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +189 -59
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs +35 -43
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-progress.mjs +60 -12
- package/fesm2022/sixbell-telco-sdk-components-progress.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-tab.mjs +33 -35
- package/fesm2022/sixbell-telco-sdk-components-tab.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-table.mjs +403 -58
- package/fesm2022/sixbell-telco-sdk-components-table.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs +28 -44
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-tooltip.mjs +112 -10
- package/fesm2022/sixbell-telco-sdk-components-tooltip.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-wizard.mjs +897 -161
- package/fesm2022/sixbell-telco-sdk-components-wizard.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +206 -0
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-directives-click-outside.mjs +54 -11
- package/fesm2022/sixbell-telco-sdk-directives-click-outside.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs +52 -0
- package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-directives-typography.mjs +66 -15
- package/fesm2022/sixbell-telco-sdk-directives-typography.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-cn.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-generators-uuid.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-pipes-extract-extension.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-utils-pipes-extract-extension.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-pipes-time.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-utils-pipes-time.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs.map +1 -1
- package/package.json +49 -145
- package/sixbell-telco-sdk-1.0.1.tgz +0 -0
- package/_index.scss +0 -146
- package/assets/styles/combobox.scss +0 -454
- package/components/file-upload/file-dropzone/index.d.ts +0 -5
- package/components/file-upload/file-dropzone/public-api.d.ts +0 -1
- package/components/file-upload/file-dropzone/src/file-dropzone.component.d.ts +0 -68
- package/components/file-upload/file-uploader/index.d.ts +0 -5
- package/components/file-upload/file-uploader/public-api.d.ts +0 -1
- package/components/file-upload/file-uploader/src/file-uploader.component.d.ts +0 -46
- package/esm2022/components/accordion/accordion-item/accordion-item.component.mjs +0 -43
- package/esm2022/components/accordion/public-api.mjs +0 -3
- package/esm2022/components/accordion/sixbell-telco-sdk-components-accordion.mjs +0 -5
- package/esm2022/components/accordion/src/accordion.component.mjs +0 -13
- package/esm2022/components/audio-player/audio-timeline/audio-timeline.component.mjs +0 -76
- package/esm2022/components/audio-player/button-play/button-play.component.mjs +0 -71
- package/esm2022/components/audio-player/public-api.mjs +0 -4
- package/esm2022/components/audio-player/services/audio.service.mjs +0 -189
- package/esm2022/components/audio-player/sixbell-telco-sdk-components-audio-player.mjs +0 -5
- package/esm2022/components/audio-player/src/audio-player.component.mjs +0 -84
- package/esm2022/components/audio-player/track-info/track-info.component.mjs +0 -17
- package/esm2022/components/audio-player/volume-control/volume-control.component.mjs +0 -83
- package/esm2022/components/avatar/public-api.mjs +0 -2
- package/esm2022/components/avatar/sixbell-telco-sdk-components-avatar.mjs +0 -5
- package/esm2022/components/avatar/src/avatar.component.mjs +0 -59
- package/esm2022/components/badge/public-api.mjs +0 -2
- package/esm2022/components/badge/sixbell-telco-sdk-components-badge.mjs +0 -5
- package/esm2022/components/badge/src/badge.component.mjs +0 -76
- package/esm2022/components/button/public-api.mjs +0 -2
- package/esm2022/components/button/sixbell-telco-sdk-components-button.mjs +0 -5
- package/esm2022/components/button/src/button.component.mjs +0 -84
- package/esm2022/components/card/card-actions/card-actions.component.mjs +0 -22
- package/esm2022/components/card/card-content/card-content.component.mjs +0 -12
- package/esm2022/components/card/card-title/card-title.component.mjs +0 -12
- package/esm2022/components/card/public-api.mjs +0 -5
- package/esm2022/components/card/sixbell-telco-sdk-components-card.mjs +0 -5
- package/esm2022/components/card/src/card.component.mjs +0 -32
- package/esm2022/components/countdown/public-api.mjs +0 -2
- package/esm2022/components/countdown/sixbell-telco-sdk-components-countdown.mjs +0 -5
- package/esm2022/components/countdown/src/countdown.component.mjs +0 -60
- package/esm2022/components/dropdown/dropdown-item/dropdown-item.component.mjs +0 -24
- package/esm2022/components/dropdown/public-api.mjs +0 -3
- package/esm2022/components/dropdown/sixbell-telco-sdk-components-dropdown.mjs +0 -5
- package/esm2022/components/dropdown/src/dropdown.component.mjs +0 -127
- package/esm2022/components/dual-list/public-api.mjs +0 -2
- package/esm2022/components/dual-list/sixbell-telco-sdk-components-dual-list.mjs +0 -5
- package/esm2022/components/dual-list/src/dual-list.component.mjs +0 -174
- package/esm2022/components/file-upload/file-dropzone/public-api.mjs +0 -2
- package/esm2022/components/file-upload/file-dropzone/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs +0 -5
- package/esm2022/components/file-upload/file-dropzone/src/file-dropzone.component.mjs +0 -232
- package/esm2022/components/file-upload/file-dropzone/src/file-dropzone.constants.mjs +0 -7
- package/esm2022/components/file-upload/file-uploader/public-api.mjs +0 -2
- package/esm2022/components/file-upload/file-uploader/sixbell-telco-sdk-components-file-upload-file-uploader.mjs +0 -5
- package/esm2022/components/file-upload/file-uploader/src/file-uploader.component.mjs +0 -114
- package/esm2022/components/forms/checkbox/public-api.mjs +0 -2
- package/esm2022/components/forms/checkbox/sixbell-telco-sdk-components-forms-checkbox.mjs +0 -5
- package/esm2022/components/forms/checkbox/src/checkbox.component.mjs +0 -94
- package/esm2022/components/forms/combobox/public-api.mjs +0 -2
- package/esm2022/components/forms/combobox/sixbell-telco-sdk-components-forms-combobox.mjs +0 -5
- package/esm2022/components/forms/combobox/src/combobox.component.mjs +0 -165
- package/esm2022/components/forms/datepicker/public-api.mjs +0 -3
- package/esm2022/components/forms/datepicker/sixbell-telco-sdk-components-forms-datepicker.mjs +0 -5
- package/esm2022/components/forms/datepicker/src/datepicker-format-month.pipe.mjs +0 -20
- package/esm2022/components/forms/datepicker/src/datepicker.component.mjs +0 -190
- package/esm2022/components/forms/form-error/public-api.mjs +0 -2
- package/esm2022/components/forms/form-error/sixbell-telco-sdk-components-forms-form-error.mjs +0 -5
- package/esm2022/components/forms/form-error/src/form-error.component.mjs +0 -32
- package/esm2022/components/forms/input/public-api.mjs +0 -2
- package/esm2022/components/forms/input/sixbell-telco-sdk-components-forms-input.mjs +0 -5
- package/esm2022/components/forms/input/src/input.component.mjs +0 -201
- package/esm2022/components/forms/radio/public-api.mjs +0 -2
- package/esm2022/components/forms/radio/sixbell-telco-sdk-components-forms-radio.mjs +0 -5
- package/esm2022/components/forms/radio/src/radio.component.mjs +0 -96
- package/esm2022/components/forms/range/public-api.mjs +0 -2
- package/esm2022/components/forms/range/sixbell-telco-sdk-components-forms-range.mjs +0 -5
- package/esm2022/components/forms/range/src/range.component.mjs +0 -103
- package/esm2022/components/forms/select/public-api.mjs +0 -2
- package/esm2022/components/forms/select/sixbell-telco-sdk-components-forms-select.mjs +0 -5
- package/esm2022/components/forms/select/src/select.component.mjs +0 -138
- package/esm2022/components/forms/switch/public-api.mjs +0 -2
- package/esm2022/components/forms/switch/sixbell-telco-sdk-components-forms-switch.mjs +0 -5
- package/esm2022/components/forms/switch/src/switch.component.mjs +0 -108
- package/esm2022/components/forms/textarea/public-api.mjs +0 -2
- package/esm2022/components/forms/textarea/sixbell-telco-sdk-components-forms-textarea.mjs +0 -5
- package/esm2022/components/forms/textarea/src/textarea.component.mjs +0 -167
- package/esm2022/components/forms/toggle/public-api.mjs +0 -2
- package/esm2022/components/forms/toggle/sixbell-telco-sdk-components-forms-toggle.mjs +0 -5
- package/esm2022/components/forms/toggle/src/toggle.component.mjs +0 -404
- package/esm2022/components/icon/heroicons/mini/public-api.mjs +0 -2
- package/esm2022/components/icon/heroicons/mini/sixbell-telco-sdk-components-icon-heroicons-mini.mjs +0 -5
- package/esm2022/components/icon/heroicons/outline/public-api.mjs +0 -2
- package/esm2022/components/icon/heroicons/outline/sixbell-telco-sdk-components-icon-heroicons-outline.mjs +0 -5
- package/esm2022/components/icon/heroicons/solid/public-api.mjs +0 -2
- package/esm2022/components/icon/heroicons/solid/sixbell-telco-sdk-components-icon-heroicons-solid.mjs +0 -5
- package/esm2022/components/icon/ionicons/public-api.mjs +0 -2
- package/esm2022/components/icon/ionicons/sixbell-telco-sdk-components-icon-ionicons.mjs +0 -5
- package/esm2022/components/icon/material/baseline/public-api.mjs +0 -2
- package/esm2022/components/icon/material/baseline/sixbell-telco-sdk-components-icon-material-baseline.mjs +0 -5
- package/esm2022/components/icon/material/outline/public-api.mjs +0 -2
- package/esm2022/components/icon/material/outline/sixbell-telco-sdk-components-icon-material-outline.mjs +0 -5
- package/esm2022/components/icon/material/round/public-api.mjs +0 -2
- package/esm2022/components/icon/material/round/sixbell-telco-sdk-components-icon-material-round.mjs +0 -5
- package/esm2022/components/icon/material/sharp/public-api.mjs +0 -2
- package/esm2022/components/icon/material/sharp/sixbell-telco-sdk-components-icon-material-sharp.mjs +0 -5
- package/esm2022/components/icon/public-api.mjs +0 -2
- package/esm2022/components/icon/sixbell-telco-sdk-components-icon.mjs +0 -5
- package/esm2022/components/icon/src/icon.component.mjs +0 -41
- package/esm2022/components/link/public-api.mjs +0 -2
- package/esm2022/components/link/sixbell-telco-sdk-components-link.mjs +0 -5
- package/esm2022/components/link/src/link.component.mjs +0 -63
- package/esm2022/components/modal/modal-actions/modal-actions.component.mjs +0 -22
- package/esm2022/components/modal/modal-content/modal-content.component.mjs +0 -12
- package/esm2022/components/modal/modal-title/modal-title.component.mjs +0 -13
- package/esm2022/components/modal/public-api.mjs +0 -5
- package/esm2022/components/modal/sixbell-telco-sdk-components-modal.mjs +0 -5
- package/esm2022/components/modal/src/modal.component.mjs +0 -154
- package/esm2022/components/notification/public-api.mjs +0 -2
- package/esm2022/components/notification/sixbell-telco-sdk-components-notification.mjs +0 -5
- package/esm2022/components/notification/src/notification.component.mjs +0 -55
- package/esm2022/components/paginator/components/pagination-item/pagination-item.component.mjs +0 -113
- package/esm2022/components/paginator/public-api.mjs +0 -3
- package/esm2022/components/paginator/sixbell-telco-sdk-components-paginator.mjs +0 -5
- package/esm2022/components/paginator/src/paginator.component.mjs +0 -52
- package/esm2022/components/product-card/directives/product-card-actions.directive.mjs +0 -15
- package/esm2022/components/product-card/directives/product-card-content.directive.mjs +0 -15
- package/esm2022/components/product-card/directives/product-card-header.directive.mjs +0 -15
- package/esm2022/components/product-card/public-api.mjs +0 -5
- package/esm2022/components/product-card/sixbell-telco-sdk-components-product-card.mjs +0 -5
- package/esm2022/components/product-card/src/product-card.component.mjs +0 -140
- package/esm2022/components/progress/public-api.mjs +0 -2
- package/esm2022/components/progress/sixbell-telco-sdk-components-progress.mjs +0 -5
- package/esm2022/components/progress/src/progress.component.mjs +0 -43
- package/esm2022/components/tab/directives/tab-content/tab-content.directive.mjs +0 -51
- package/esm2022/components/tab/directives/tab-header/tab-header.directive.mjs +0 -56
- package/esm2022/components/tab/public-api.mjs +0 -4
- package/esm2022/components/tab/sixbell-telco-sdk-components-tab.mjs +0 -5
- package/esm2022/components/tab/src/tab.component.mjs +0 -42
- package/esm2022/components/table/public-api.mjs +0 -4
- package/esm2022/components/table/sixbell-telco-sdk-components-table.mjs +0 -5
- package/esm2022/components/table/src/table.component.mjs +0 -143
- package/esm2022/components/table/table-header-checkbox/table-header-checkbox.component.mjs +0 -25
- package/esm2022/components/table/table-row-checkbox/table-row-checkbox.component.mjs +0 -26
- package/esm2022/components/toast/public-api.mjs +0 -4
- package/esm2022/components/toast/services/toast.service.mjs +0 -67
- package/esm2022/components/toast/sixbell-telco-sdk-components-toast.mjs +0 -5
- package/esm2022/components/toast/toast-message/toast-message.component.mjs +0 -80
- package/esm2022/components/toast/toasts-container/toasts-container.component.mjs +0 -41
- package/esm2022/components/tooltip/public-api.mjs +0 -2
- package/esm2022/components/tooltip/sixbell-telco-sdk-components-tooltip.mjs +0 -5
- package/esm2022/components/tooltip/src/tooltip.component.mjs +0 -45
- package/esm2022/components/wizard/public-api.mjs +0 -6
- package/esm2022/components/wizard/sixbell-telco-sdk-components-wizard.mjs +0 -5
- package/esm2022/components/wizard/wizard-content/wizard-content.component.mjs +0 -30
- package/esm2022/components/wizard/wizard-marker/wizard-marker.component.mjs +0 -24
- package/esm2022/components/wizard/wizard-step/wizard-step.component.mjs +0 -44
- package/esm2022/components/wizard/wizard-sub-step/wizard-sub-step.component.mjs +0 -34
- package/esm2022/components/wizard/wizard-wrapper/wizard-wrapper.component.mjs +0 -88
- package/esm2022/directives/click-outside/public-api.mjs +0 -2
- package/esm2022/directives/click-outside/sixbell-telco-sdk-directives-click-outside.mjs +0 -5
- package/esm2022/directives/click-outside/src/click-outside.directive.mjs +0 -30
- package/esm2022/directives/typography/public-api.mjs +0 -2
- package/esm2022/directives/typography/sixbell-telco-sdk-directives-typography.mjs +0 -5
- package/esm2022/directives/typography/src/typography.directive.mjs +0 -68
- package/esm2022/public_api.mjs +0 -2
- package/esm2022/sixbell-telco-sdk.mjs +0 -5
- package/esm2022/utils/cn/public-api.mjs +0 -2
- package/esm2022/utils/cn/sixbell-telco-sdk-utils-cn.mjs +0 -5
- package/esm2022/utils/cn/src/cn.mjs +0 -6
- package/esm2022/utils/generators/uuid/public-api.mjs +0 -2
- package/esm2022/utils/generators/uuid/sixbell-telco-sdk-utils-generators-uuid.mjs +0 -5
- package/esm2022/utils/generators/uuid/src/uuid.mjs +0 -5
- package/esm2022/utils/pipes/extract-extension/public-api.mjs +0 -2
- package/esm2022/utils/pipes/extract-extension/sixbell-telco-sdk-utils-pipes-extract-extension.mjs +0 -5
- package/esm2022/utils/pipes/extract-extension/src/extract-extension.mjs +0 -30
- package/esm2022/utils/pipes/time/public-api.mjs +0 -2
- package/esm2022/utils/pipes/time/sixbell-telco-sdk-utils-pipes-time.mjs +0 -5
- package/esm2022/utils/pipes/time/src/time.pipe.mjs +0 -19
- package/esm2022/utils/pipes/to-bytes-extesion/public-api.mjs +0 -2
- package/esm2022/utils/pipes/to-bytes-extesion/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs +0 -5
- package/esm2022/utils/pipes/to-bytes-extesion/src/to-bytes.pipe.mjs +0 -29
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs +0 -245
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs.map +0 -1
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-uploader.mjs +0 -121
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-uploader.mjs.map +0 -1
- /package/assets/styles/{toast.scss → toast.css} +0 -0
- /package/components/file-upload/{file-dropzone/src/file-dropzone.constants.d.ts → shared/const/file-upload.constants.d.ts} +0 -0
|
@@ -1,168 +1,1051 @@
|
|
|
1
|
+
import { CdkListbox, CdkOption } from '@angular/cdk/listbox';
|
|
2
|
+
import * as i1 from '@angular/cdk/overlay';
|
|
3
|
+
import { OverlayModule } from '@angular/cdk/overlay';
|
|
4
|
+
import { PortalModule } from '@angular/cdk/portal';
|
|
1
5
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, model, output,
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { NgSelectModule } from '@ng-select/ng-select';
|
|
7
|
-
import { InputComponent } from '@sixbell-telco/sdk/components/forms/input';
|
|
8
|
-
import { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';
|
|
6
|
+
import { inject, input, model, output, signal, viewChild, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
7
|
+
import { toObservable, toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
8
|
+
import { FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
+
import { TranslateService, TranslatePipe } from '@ngx-translate/core';
|
|
9
10
|
import { cn } from '@sixbell-telco/sdk/utils/cn';
|
|
10
11
|
import { cva } from 'class-variance-authority';
|
|
12
|
+
import { BadgeComponent } from '@sixbell-telco/sdk/components/badge';
|
|
13
|
+
import { IconComponent } from '@sixbell-telco/sdk/components/icon';
|
|
14
|
+
import { matSearchOutline, matKeyboardArrowDownOutline, matCheckOutline, matCloseOutline } from '@sixbell-telco/sdk/components/icon/material/outline';
|
|
15
|
+
import { Subject, switchMap, startWith, debounceTime, distinctUntilChanged } from 'rxjs';
|
|
11
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @fileoverview Combobox Component
|
|
19
|
+
*
|
|
20
|
+
* A comprehensive combobox component with advanced features including:
|
|
21
|
+
* - Single and multiple selection modes
|
|
22
|
+
* - Real-time search with debouncing
|
|
23
|
+
* - Keyboard navigation support (Arrow keys, Enter, Space)
|
|
24
|
+
* - Form validation integration
|
|
25
|
+
* - Accessibility compliance with CDK Listbox
|
|
26
|
+
* - Customizable styling variants and sizes
|
|
27
|
+
* - Animation states for smooth transitions
|
|
28
|
+
*/
|
|
12
29
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
13
|
-
|
|
30
|
+
// ==============================================================================
|
|
31
|
+
// IMPORTS
|
|
32
|
+
// ==============================================================================
|
|
33
|
+
// Angular CDK
|
|
34
|
+
// ==============================================================================
|
|
35
|
+
// COMPONENT STYLES
|
|
36
|
+
// ==============================================================================
|
|
37
|
+
/**
|
|
38
|
+
* Class variance authority configuration for combobox styling
|
|
39
|
+
*/
|
|
40
|
+
const comboboxComponent = cva(['w-full', 'min-w-fit', 'text-pretty', 'font-body', 'font-normal', 'select', 'leading-normal', 'bg-none'], {
|
|
14
41
|
variants: {
|
|
15
42
|
variant: {
|
|
16
|
-
primary: ['
|
|
17
|
-
secondary: ['
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
'round-sm': ['[&>*]:rounded-[var(--rounded-btn-sm)_!important]'],
|
|
25
|
-
'round-md': ['[&>*]:rounded-[var(--rounded-btn-md)_!important]'],
|
|
26
|
-
'round-lg': ['[&>*]:rounded-[var(--rounded-btn-lg)_!important]'],
|
|
43
|
+
primary: ['select-primary'],
|
|
44
|
+
secondary: ['select-secondary'],
|
|
45
|
+
tertiary: ['select-tertiary'],
|
|
46
|
+
accent: ['select-accent'],
|
|
47
|
+
info: ['select-info'],
|
|
48
|
+
success: ['select-success'],
|
|
49
|
+
error: ['select-error'],
|
|
50
|
+
warning: ['select-warning'],
|
|
27
51
|
},
|
|
28
52
|
size: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
53
|
+
xs: ['select-xs'],
|
|
54
|
+
sm: ['select-sm'],
|
|
55
|
+
md: ['select-md'],
|
|
56
|
+
lg: ['select-lg'],
|
|
57
|
+
xl: ['select-xl'],
|
|
32
58
|
},
|
|
33
59
|
},
|
|
34
60
|
compoundVariants: [],
|
|
35
61
|
defaultVariants: {
|
|
36
62
|
variant: 'secondary',
|
|
37
|
-
shape: 'round-sm',
|
|
38
63
|
size: 'md',
|
|
39
64
|
},
|
|
40
65
|
});
|
|
66
|
+
// ==============================================================================
|
|
67
|
+
// COMPONENT
|
|
68
|
+
// ==============================================================================
|
|
41
69
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
70
|
+
* A customizable combobox component with search functionality, multiple selection modes,
|
|
71
|
+
* and keyboard navigation support. Implements Angular's ControlValueAccessor interface
|
|
72
|
+
* for seamless integration with reactive forms.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```html
|
|
76
|
+
* <st-combobox
|
|
77
|
+
* [(value)]="selectedValue"
|
|
78
|
+
* [options]="availableOptions"
|
|
79
|
+
* displayKey="name"
|
|
80
|
+
* valueKey="id"
|
|
81
|
+
* placeholder="Select an option"
|
|
82
|
+
* variant="primary"
|
|
83
|
+
* size="md">
|
|
84
|
+
* </st-combobox>
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* // Multiple selection
|
|
90
|
+
* <st-combobox
|
|
91
|
+
* [(value)]="selectedValues"
|
|
92
|
+
* [options]="options"
|
|
93
|
+
* selectionType="multiple"
|
|
94
|
+
* [allowClear]="true">
|
|
95
|
+
* </st-combobox>
|
|
96
|
+
* ```
|
|
46
97
|
*/
|
|
47
98
|
class ComboboxComponent {
|
|
48
|
-
//
|
|
99
|
+
// ==============================================================================
|
|
100
|
+
// SERVICES
|
|
101
|
+
// ==============================================================================
|
|
102
|
+
/**
|
|
103
|
+
* Angular translation service for internationalization
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
translateService = inject(TranslateService);
|
|
107
|
+
// ==============================================================================
|
|
108
|
+
// INPUT PROPERTIES
|
|
109
|
+
// ==============================================================================
|
|
110
|
+
/**
|
|
111
|
+
* The visual style variant of the combobox
|
|
112
|
+
* @default 'secondary'
|
|
113
|
+
*/
|
|
49
114
|
variant = input('secondary');
|
|
50
|
-
|
|
115
|
+
/**
|
|
116
|
+
* The size variant of the combobox
|
|
117
|
+
* @default 'md'
|
|
118
|
+
*/
|
|
51
119
|
size = input('md');
|
|
52
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Whether to use ghost (transparent) styling
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
ghost = input(false);
|
|
125
|
+
/**
|
|
126
|
+
* The HTML name attribute for the underlying form control
|
|
127
|
+
*/
|
|
53
128
|
name = input(null);
|
|
129
|
+
/**
|
|
130
|
+
* Placeholder text displayed when no option is selected
|
|
131
|
+
*/
|
|
132
|
+
placeholder = input('');
|
|
133
|
+
/**
|
|
134
|
+
* Whether the combobox is disabled
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
137
|
+
disabled = model(false);
|
|
138
|
+
/**
|
|
139
|
+
* Label text displayed above the combobox
|
|
140
|
+
*/
|
|
54
141
|
label = input('');
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
loading = input(false);
|
|
59
|
-
search = '';
|
|
60
|
-
// Options properties
|
|
61
|
-
trackBy = input('id');
|
|
62
|
-
key = input('name');
|
|
63
|
-
// Form control properties
|
|
142
|
+
/**
|
|
143
|
+
* Parent form group for reactive forms integration
|
|
144
|
+
*/
|
|
64
145
|
parentForm = input(null);
|
|
146
|
+
/**
|
|
147
|
+
* The form control name when used within a reactive form
|
|
148
|
+
*/
|
|
65
149
|
formControlName = input('');
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Whether to show a clear button next to the selected value(s) in the trigger
|
|
152
|
+
* Works for both single and multiple selection modes
|
|
153
|
+
* @default true
|
|
154
|
+
*/
|
|
155
|
+
allowClear = input(true);
|
|
156
|
+
/**
|
|
157
|
+
* Whether to show a "Clear All" button at the bottom of the dropdown for multiple selection
|
|
158
|
+
* Only applies when selectionType is 'multiple'
|
|
159
|
+
* @default true
|
|
160
|
+
*/
|
|
161
|
+
allowClearAll = input(true);
|
|
162
|
+
/**
|
|
163
|
+
* Placeholder text for the search input field
|
|
164
|
+
* @default 'Search...'
|
|
165
|
+
*/
|
|
166
|
+
searchPlaceholder = input('');
|
|
167
|
+
/**
|
|
168
|
+
* Text displayed when no search results are found
|
|
169
|
+
* @default 'No results found'
|
|
170
|
+
*/
|
|
171
|
+
noResultsText = input('');
|
|
172
|
+
/**
|
|
173
|
+
* The current selected value(s)
|
|
174
|
+
* For single selection: any | null
|
|
175
|
+
* For multiple selection: any[]
|
|
176
|
+
*/
|
|
177
|
+
value = model(null);
|
|
178
|
+
/**
|
|
179
|
+
* Array of available options to select from
|
|
180
|
+
*/
|
|
181
|
+
options = input([]);
|
|
182
|
+
/**
|
|
183
|
+
* The object property to use for display text when options are objects
|
|
184
|
+
* Falls back to common property names if not specified
|
|
185
|
+
*/
|
|
186
|
+
displayKey = input('');
|
|
187
|
+
/**
|
|
188
|
+
* The object property to use as the value when options are objects
|
|
189
|
+
* Uses the entire object if not specified
|
|
190
|
+
*/
|
|
191
|
+
valueKey = input('');
|
|
192
|
+
/**
|
|
193
|
+
* Selection mode: 'single' for single selection, 'multiple' for multi-select
|
|
194
|
+
* @default 'single'
|
|
195
|
+
*/
|
|
196
|
+
selectionType = input('single');
|
|
197
|
+
/**
|
|
198
|
+
* Whether to enable debounced search functionality
|
|
199
|
+
* @default false
|
|
200
|
+
*/
|
|
201
|
+
searchDebounced = input(false);
|
|
202
|
+
/**
|
|
203
|
+
* Debounce time in milliseconds for search input
|
|
204
|
+
* @default 300
|
|
205
|
+
*/
|
|
206
|
+
searchDebounceTime = input(300);
|
|
207
|
+
/**
|
|
208
|
+
* Event emitted when combobox loses focus
|
|
209
|
+
*/
|
|
210
|
+
blurred = output();
|
|
211
|
+
/**
|
|
212
|
+
* Event emitted when selection changes
|
|
213
|
+
*/
|
|
214
|
+
valueUpdated = output();
|
|
215
|
+
/**
|
|
216
|
+
* Event emitted when search query changes with filtered results
|
|
217
|
+
*/
|
|
218
|
+
searchQuery = output();
|
|
219
|
+
// ==============================================================================
|
|
220
|
+
// ICONS
|
|
221
|
+
// ==============================================================================
|
|
222
|
+
/** Search icon for the search input */
|
|
223
|
+
iconSearch = matSearchOutline;
|
|
224
|
+
/** Dropdown chevron icon */
|
|
225
|
+
iconChevronDown = matKeyboardArrowDownOutline;
|
|
226
|
+
/** Check icon for selected options */
|
|
227
|
+
iconCheck = matCheckOutline;
|
|
228
|
+
/** Close/clear icon */
|
|
229
|
+
iconClose = matCloseOutline;
|
|
230
|
+
// ==============================================================================
|
|
231
|
+
// PRIVATE PROPERTIES
|
|
232
|
+
// ==============================================================================
|
|
233
|
+
/** Internal search input value */
|
|
234
|
+
searchValue = signal('');
|
|
235
|
+
/** Processed search term after debouncing */
|
|
236
|
+
searchTerm = signal('');
|
|
237
|
+
/** RxJS subject for search input handling */
|
|
238
|
+
searchSubject = new Subject();
|
|
239
|
+
/** Current animation state of the overlay */
|
|
240
|
+
animationState = signal('closed');
|
|
241
|
+
/** Trigger for blur events in form validation */
|
|
242
|
+
blurTrigger = signal(0);
|
|
243
|
+
/** Active option index for keyboard navigation */
|
|
244
|
+
activeOptionIndex = signal(-1);
|
|
245
|
+
// ==============================================================================
|
|
246
|
+
// VIEW CHILDREN
|
|
247
|
+
// ==============================================================================
|
|
248
|
+
/** Reference to the trigger button element */
|
|
249
|
+
triggerRef = viewChild('trigger');
|
|
250
|
+
/** Reference to the search input element */
|
|
251
|
+
searchInputRef = viewChild('searchInput');
|
|
252
|
+
/** Reference to the options list container */
|
|
253
|
+
optionsList = viewChild('optionsList');
|
|
254
|
+
/** Reference to the CDK listbox for keyboard navigation */
|
|
255
|
+
listbox = viewChild('listbox');
|
|
256
|
+
// ==============================================================================
|
|
257
|
+
// SIGNALS
|
|
258
|
+
// ==============================================================================
|
|
259
|
+
/** Width of the trigger button for overlay positioning */
|
|
260
|
+
triggerWidth = signal(0);
|
|
261
|
+
// ==============================================================================
|
|
262
|
+
// FORM CONTROL INTEGRATION
|
|
263
|
+
// ==============================================================================
|
|
264
|
+
/** Form control reference for reactive forms */
|
|
265
|
+
formControl = computed(() => this.parentForm()?.get(this.formControlName()));
|
|
266
|
+
/** Observable stream of form control */
|
|
267
|
+
formControl$ = toObservable(this.formControl);
|
|
268
|
+
/** Stream of form control status changes */
|
|
269
|
+
statusChanges$ = this.formControl$.pipe(switchMap((control) => control?.statusChanges.pipe(startWith(control.status)) || []));
|
|
270
|
+
/** Stream of form control value changes */
|
|
271
|
+
stateChanges$ = this.formControl$.pipe(switchMap((control) => control?.valueChanges.pipe(startWith(control.value)) || []));
|
|
272
|
+
/** Signal for form control status */
|
|
273
|
+
statusSignal = toSignal(this.statusChanges$);
|
|
274
|
+
/** Signal for form control state */
|
|
275
|
+
stateSignal = toSignal(this.stateChanges$);
|
|
276
|
+
// ==============================================================================
|
|
277
|
+
// CONTROL VALUE ACCESSOR
|
|
278
|
+
// ==============================================================================
|
|
279
|
+
/** Callback function for value changes */
|
|
280
|
+
onChange = (value) => { };
|
|
281
|
+
/** Callback function for touch events */
|
|
282
|
+
onTouched = () => { };
|
|
283
|
+
// ==============================================================================
|
|
284
|
+
// CONSTRUCTOR
|
|
285
|
+
// ==============================================================================
|
|
286
|
+
constructor() {
|
|
287
|
+
this.setupSearchHandling();
|
|
288
|
+
this.setupSearchQueryEmission();
|
|
81
289
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
290
|
+
// ==============================================================================
|
|
291
|
+
// COMPUTED PROPERTIES
|
|
292
|
+
// ==============================================================================
|
|
293
|
+
/**
|
|
294
|
+
* Filtered options based on current search term
|
|
295
|
+
* @returns Array of options that match the search criteria
|
|
296
|
+
*/
|
|
297
|
+
filteredOptions = computed(() => {
|
|
298
|
+
const options = this.options();
|
|
299
|
+
const search = this.searchTerm().toLowerCase().trim();
|
|
300
|
+
if (!search)
|
|
301
|
+
return options;
|
|
302
|
+
return options.filter((option) => {
|
|
303
|
+
const displayValue = this.getDisplayValue(option).toLowerCase();
|
|
304
|
+
return displayValue.includes(search);
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
/**
|
|
308
|
+
* Whether the overlay is currently open or in the process of opening/closing
|
|
309
|
+
* @returns True if overlay is visible or animating
|
|
310
|
+
*/
|
|
311
|
+
isOpen = computed(() => {
|
|
312
|
+
const state = this.animationState();
|
|
313
|
+
return state === 'opening' || state === 'open' || state === 'closing';
|
|
314
|
+
});
|
|
315
|
+
/**
|
|
316
|
+
* Whether the overlay is currently animating to open state
|
|
317
|
+
* @returns True if overlay is opening or open
|
|
318
|
+
*/
|
|
319
|
+
isAnimatingOpen = computed(() => {
|
|
320
|
+
const state = this.animationState();
|
|
321
|
+
return state === 'opening' || state === 'open';
|
|
322
|
+
});
|
|
323
|
+
/**
|
|
324
|
+
* Current animation state for template binding
|
|
325
|
+
* @returns Current animation state
|
|
326
|
+
*/
|
|
327
|
+
dataState = computed(() => this.animationState());
|
|
328
|
+
/**
|
|
329
|
+
* Display value for the selected option(s)
|
|
330
|
+
* @returns Formatted display string based on selection type and current value
|
|
331
|
+
*/
|
|
332
|
+
displayValue = computed(() => {
|
|
333
|
+
const selectionType = this.selectionType();
|
|
334
|
+
const currentValue = this.value();
|
|
335
|
+
if (selectionType === 'multiple') {
|
|
336
|
+
const selected = Array.isArray(currentValue) ? currentValue : [];
|
|
337
|
+
if (selected.length === 0)
|
|
338
|
+
return this.translatedPlaceholder();
|
|
339
|
+
// Validate that all selected values exist in options
|
|
340
|
+
const validSelected = selected.filter((value) => this.isValidValue(value));
|
|
341
|
+
if (validSelected.length === 0)
|
|
342
|
+
return this.translatedPlaceholder();
|
|
343
|
+
if (validSelected.length === 1)
|
|
344
|
+
return this.getDisplayValue(validSelected[0]);
|
|
345
|
+
return `${validSelected.length} items selected`;
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
// For single selection, only show display value if it's valid
|
|
349
|
+
if (!currentValue || !this.isValidValue(currentValue)) {
|
|
350
|
+
return this.translatedPlaceholder();
|
|
351
|
+
}
|
|
352
|
+
return this.getDisplayValue(currentValue);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
/**
|
|
356
|
+
* Display information for multiple selection showing first item and additional count
|
|
357
|
+
* @returns Object with first item display and additional count, or null for single selection
|
|
358
|
+
*/
|
|
359
|
+
multipleDisplayInfo = computed(() => {
|
|
360
|
+
const selectionType = this.selectionType();
|
|
361
|
+
const currentValue = this.value();
|
|
362
|
+
if (selectionType === 'multiple') {
|
|
363
|
+
const selected = Array.isArray(currentValue) ? currentValue : [];
|
|
364
|
+
if (selected.length === 0)
|
|
365
|
+
return null;
|
|
366
|
+
if (selected.length === 1)
|
|
367
|
+
return { firstItem: this.getDisplayValue(selected[0]), additionalCount: 0 };
|
|
368
|
+
return {
|
|
369
|
+
firstItem: this.getDisplayValue(selected[0]),
|
|
370
|
+
additionalCount: selected.length - 1,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
return null;
|
|
374
|
+
});
|
|
375
|
+
/**
|
|
376
|
+
* Whether the clear button should be shown
|
|
377
|
+
* @returns True if there's a valid selected value and clear is allowed
|
|
378
|
+
*/
|
|
379
|
+
showClearButton = computed(() => {
|
|
380
|
+
if (!this.allowClear() || this.disabled()) {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
const currentValue = this.value();
|
|
384
|
+
if (!currentValue)
|
|
385
|
+
return false;
|
|
386
|
+
if (this.selectionType() === 'multiple') {
|
|
387
|
+
// For multiple selection, check if we have any valid values
|
|
388
|
+
const selected = Array.isArray(currentValue) ? currentValue : [];
|
|
389
|
+
return selected.some((value) => this.isValidValue(value));
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
// For single selection, check if the value is valid
|
|
393
|
+
return this.isValidValue(currentValue);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
/**
|
|
397
|
+
* Base CSS classes for the combobox component
|
|
398
|
+
* @internal
|
|
399
|
+
*/
|
|
400
|
+
componentClass = computed(() => {
|
|
111
401
|
return cn(comboboxComponent({
|
|
112
402
|
variant: this.variant(),
|
|
113
|
-
shape: this.shape(),
|
|
114
403
|
size: this.size(),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
404
|
+
}), { 'select-ghost': this.ghost() });
|
|
405
|
+
});
|
|
406
|
+
/**
|
|
407
|
+
* Error state CSS classes
|
|
408
|
+
* @internal
|
|
409
|
+
*/
|
|
410
|
+
errorClass = computed(() => {
|
|
119
411
|
return cn(comboboxComponent({
|
|
120
412
|
variant: 'error',
|
|
121
|
-
shape: this.shape(),
|
|
122
413
|
size: this.size(),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
414
|
+
}), { 'select-ghost': this.ghost() });
|
|
415
|
+
});
|
|
416
|
+
/**
|
|
417
|
+
* Success state CSS classes
|
|
418
|
+
* @internal
|
|
419
|
+
*/
|
|
420
|
+
successClass = computed(() => {
|
|
127
421
|
return cn(comboboxComponent({
|
|
128
422
|
variant: 'success',
|
|
129
|
-
shape: this.shape(),
|
|
130
423
|
size: this.size(),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
424
|
+
}), { 'select-ghost': this.ghost() });
|
|
425
|
+
});
|
|
426
|
+
/**
|
|
427
|
+
* Validation-aware CSS classes based on form control state
|
|
428
|
+
* @internal
|
|
429
|
+
*/
|
|
430
|
+
validationClass = computed(() => {
|
|
431
|
+
const control = this.formControl();
|
|
432
|
+
const trigger = this.blurTrigger();
|
|
433
|
+
if (!control)
|
|
434
|
+
return this.componentClass();
|
|
435
|
+
const isTouched = control.touched || trigger > 0;
|
|
436
|
+
this.statusSignal();
|
|
437
|
+
this.stateSignal();
|
|
438
|
+
if (control.dirty || isTouched) {
|
|
439
|
+
if (control.invalid)
|
|
440
|
+
return this.errorClass();
|
|
441
|
+
if (control.valid)
|
|
442
|
+
return this.successClass();
|
|
443
|
+
}
|
|
444
|
+
return this.componentClass();
|
|
445
|
+
});
|
|
446
|
+
/**
|
|
447
|
+
* CSS classes for the search input field
|
|
448
|
+
* @internal
|
|
449
|
+
*/
|
|
450
|
+
searchInputClass = computed(() => {
|
|
451
|
+
return cn('input bg-base-200 w-full border-transparent focus-within:outline-none focus:border-transparent focus:outline-none', {
|
|
452
|
+
'input-xs': this.size() === 'xs',
|
|
453
|
+
'input-sm': this.size() === 'sm',
|
|
454
|
+
'input-md': this.size() === 'md',
|
|
455
|
+
'input-lg': this.size() === 'lg',
|
|
456
|
+
'input-xl': this.size() === 'xl',
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
/**
|
|
460
|
+
* CSS classes for the options menu
|
|
461
|
+
* @internal
|
|
462
|
+
*/
|
|
463
|
+
menuClass = computed(() => {
|
|
464
|
+
return cn('menu flex-nowrap max-h-72 overflow-y-auto overscroll-contain w-full p-0 focus-within:outline-none focus:outline-none focus-visible:outline-none', {
|
|
465
|
+
'menu-xs': this.size() === 'xs',
|
|
466
|
+
'menu-sm': this.size() === 'sm',
|
|
467
|
+
'menu-md': this.size() === 'md',
|
|
468
|
+
'menu-lg': this.size() === 'lg',
|
|
469
|
+
'menu-xl': this.size() === 'xl',
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
/**
|
|
473
|
+
* CSS classes for the badge
|
|
474
|
+
* @internal
|
|
475
|
+
*/
|
|
476
|
+
badgeClass = computed(() => {
|
|
477
|
+
const size = this.size();
|
|
478
|
+
switch (size) {
|
|
479
|
+
case 'xs':
|
|
480
|
+
case 'sm':
|
|
481
|
+
return 'xs';
|
|
482
|
+
case 'md':
|
|
483
|
+
return 'sm';
|
|
484
|
+
case 'lg':
|
|
485
|
+
return 'md';
|
|
486
|
+
case 'xl':
|
|
487
|
+
return 'lg';
|
|
488
|
+
default:
|
|
489
|
+
return 'sm';
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
/**
|
|
493
|
+
* Translated search placeholder text
|
|
494
|
+
* @returns Translated placeholder or input value
|
|
495
|
+
*/
|
|
496
|
+
translatedSearchPlaceholder = computed(() => {
|
|
497
|
+
const customPlaceholder = this.searchPlaceholder();
|
|
498
|
+
return customPlaceholder || this.translateService.instant('sdk.combobox.searchPlaceholder');
|
|
499
|
+
});
|
|
500
|
+
/**
|
|
501
|
+
* Translated main placeholder text
|
|
502
|
+
* @returns Translated placeholder or input value
|
|
503
|
+
*/
|
|
504
|
+
translatedPlaceholder = computed(() => {
|
|
505
|
+
const customPlaceholder = this.placeholder();
|
|
506
|
+
return customPlaceholder || this.translateService.instant('sdk.combobox.placeholder');
|
|
507
|
+
});
|
|
508
|
+
/**
|
|
509
|
+
* Translated no results text
|
|
510
|
+
* @returns Translated no results text or input value
|
|
511
|
+
*/
|
|
512
|
+
translatedNoResultsText = computed(() => {
|
|
513
|
+
const customNoResults = this.noResultsText();
|
|
514
|
+
return customNoResults || this.translateService.instant('sdk.combobox.noResultsFound');
|
|
515
|
+
});
|
|
516
|
+
/**
|
|
517
|
+
* Current search input value for template binding
|
|
518
|
+
* @returns Current search value
|
|
519
|
+
*/
|
|
520
|
+
get currentSearchValue() {
|
|
521
|
+
return this.searchValue();
|
|
522
|
+
}
|
|
523
|
+
// ==============================================================================
|
|
524
|
+
// LIFECYCLE METHODS
|
|
525
|
+
// ==============================================================================
|
|
526
|
+
/**
|
|
527
|
+
* Angular lifecycle hook called after view initialization
|
|
528
|
+
* Updates the trigger width for proper overlay positioning
|
|
529
|
+
*/
|
|
530
|
+
ngAfterViewInit() {
|
|
531
|
+
this.updateTriggerWidth();
|
|
532
|
+
}
|
|
533
|
+
// ==============================================================================
|
|
534
|
+
// CONTROL VALUE ACCESSOR IMPLEMENTATION
|
|
535
|
+
// ==============================================================================
|
|
536
|
+
/**
|
|
537
|
+
* Writes a new value to the component
|
|
538
|
+
* @param value - The new value to set
|
|
539
|
+
*/
|
|
540
|
+
writeValue(value) {
|
|
541
|
+
// Only set the value if it's null/undefined or if it's valid
|
|
542
|
+
if (!value) {
|
|
543
|
+
this.value.set(value);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (this.selectionType() === 'multiple') {
|
|
547
|
+
// For multiple selection, filter out invalid values
|
|
548
|
+
if (Array.isArray(value)) {
|
|
549
|
+
const validValues = value.filter((v) => this.isValidValue(v));
|
|
550
|
+
this.value.set(validValues.length > 0 ? validValues : []);
|
|
140
551
|
}
|
|
141
|
-
else
|
|
142
|
-
|
|
552
|
+
else {
|
|
553
|
+
this.value.set([]);
|
|
143
554
|
}
|
|
144
555
|
}
|
|
145
|
-
|
|
556
|
+
else {
|
|
557
|
+
// For single selection, only set if valid
|
|
558
|
+
const isValid = this.isValidValue(value);
|
|
559
|
+
this.value.set(isValid ? value : null);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Registers a callback function to be called when the value changes
|
|
564
|
+
* @param fn - The callback function
|
|
565
|
+
*/
|
|
566
|
+
registerOnChange(fn) {
|
|
567
|
+
this.onChange = fn;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Registers a callback function to be called when the component is touched
|
|
571
|
+
* @param fn - The callback function
|
|
572
|
+
*/
|
|
573
|
+
registerOnTouched(fn) {
|
|
574
|
+
this.onTouched = fn;
|
|
575
|
+
}
|
|
576
|
+
// ==============================================================================
|
|
577
|
+
// PUBLIC METHODS
|
|
578
|
+
// ==============================================================================
|
|
579
|
+
/**
|
|
580
|
+
* Toggles the overlay open/closed state
|
|
581
|
+
* Handles focus management and animation state transitions
|
|
582
|
+
*/
|
|
583
|
+
toggleOverlay() {
|
|
584
|
+
const currentState = this.animationState();
|
|
585
|
+
if (currentState === 'closed') {
|
|
586
|
+
this.updateTriggerWidth();
|
|
587
|
+
this.animationState.set('opening');
|
|
588
|
+
// Focus search input after opening
|
|
589
|
+
setTimeout(() => {
|
|
590
|
+
this.searchInputRef()?.nativeElement?.focus();
|
|
591
|
+
// Set first option as active by default
|
|
592
|
+
this.setDefaultActiveOption();
|
|
593
|
+
}, 100);
|
|
594
|
+
}
|
|
595
|
+
else if (currentState === 'open') {
|
|
596
|
+
this.animationState.set('closing');
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Handles animation end events to update state
|
|
601
|
+
* @param event - The animation event
|
|
602
|
+
*/
|
|
603
|
+
onAnimationEnd(event) {
|
|
604
|
+
if (event.animationName === 'fade-in-up') {
|
|
605
|
+
this.animationState.set('open');
|
|
606
|
+
}
|
|
607
|
+
else if (event.animationName === 'fade-out-down') {
|
|
608
|
+
this.animationState.set('closed');
|
|
609
|
+
this.clearSearch();
|
|
610
|
+
this.triggerBlur();
|
|
611
|
+
// Return focus to trigger button for better keyboard navigation
|
|
612
|
+
setTimeout(() => {
|
|
613
|
+
this.triggerRef()?.nativeElement?.focus();
|
|
614
|
+
}, 0);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Handles overlay detachment
|
|
619
|
+
* Cleans up state and triggers blur
|
|
620
|
+
*/
|
|
621
|
+
handleDetach() {
|
|
622
|
+
this.animationState.set('closed');
|
|
623
|
+
this.clearSearch();
|
|
624
|
+
this.triggerBlur();
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Handles clicks outside the component
|
|
628
|
+
* @param event - The mouse event
|
|
629
|
+
*/
|
|
630
|
+
handleClickOutside(event) {
|
|
631
|
+
if (this.animationState() === 'open') {
|
|
632
|
+
this.animationState.set('closing');
|
|
633
|
+
}
|
|
634
|
+
event.stopPropagation();
|
|
635
|
+
this.triggerBlur();
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Handles search input changes
|
|
639
|
+
* @param event - The input event
|
|
640
|
+
*/
|
|
641
|
+
handleSearchInput(event) {
|
|
642
|
+
const target = event.target;
|
|
643
|
+
const searchValue = target.value;
|
|
644
|
+
this.searchValue.set(searchValue);
|
|
645
|
+
if (this.searchDebounced()) {
|
|
646
|
+
this.searchSubject.next(searchValue);
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
this.searchTerm.set(searchValue);
|
|
650
|
+
// Set first option as active after search
|
|
651
|
+
setTimeout(() => this.setDefaultActiveOption(), 0);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Handles option selection
|
|
656
|
+
* @param option - The selected option
|
|
657
|
+
*/
|
|
658
|
+
handleOptionSelect(option) {
|
|
659
|
+
const selectionType = this.selectionType();
|
|
660
|
+
const currentValue = this.value();
|
|
661
|
+
if (selectionType === 'multiple') {
|
|
662
|
+
const currentValues = Array.isArray(currentValue) ? currentValue : [];
|
|
663
|
+
const optionValue = this.getOptionValue(option);
|
|
664
|
+
const isSelected = this.isOptionSelected(option);
|
|
665
|
+
let newValues;
|
|
666
|
+
if (isSelected) {
|
|
667
|
+
newValues = currentValues.filter((value) => this.getOptionValue(value) !== optionValue);
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
newValues = [...currentValues, option];
|
|
671
|
+
}
|
|
672
|
+
this.value.set(newValues);
|
|
673
|
+
this.onChange(newValues);
|
|
674
|
+
this.valueUpdated.emit(newValues);
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
this.value.set(option);
|
|
678
|
+
this.onChange(option);
|
|
679
|
+
this.valueUpdated.emit(option);
|
|
680
|
+
this.animationState.set('closing');
|
|
681
|
+
}
|
|
682
|
+
this.onTouched();
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Handles CDK listbox selection changes
|
|
686
|
+
* @param event - The selection change event
|
|
687
|
+
*/
|
|
688
|
+
handleSelectionChange(event) {
|
|
689
|
+
if (event.option) {
|
|
690
|
+
this.handleOptionSelect(event.option.value);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Handles keyboard events for option selection
|
|
695
|
+
* @param event - The keyboard event
|
|
696
|
+
*/
|
|
697
|
+
handleListboxKeydown(event) {
|
|
698
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
699
|
+
event.preventDefault();
|
|
700
|
+
event.stopPropagation();
|
|
701
|
+
const focusedOption = this.optionsList()?.nativeElement.querySelector('.cdk-option-active');
|
|
702
|
+
if (focusedOption) {
|
|
703
|
+
const optionIndex = parseInt(focusedOption.getAttribute('data-option-index') || '0');
|
|
704
|
+
const filteredOptions = this.filteredOptions();
|
|
705
|
+
if (optionIndex >= 0 && optionIndex < filteredOptions.length) {
|
|
706
|
+
this.handleOptionSelect(filteredOptions[optionIndex]);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Handles keyboard events on the search input for navigation and selection
|
|
713
|
+
* @param event - The keyboard event
|
|
714
|
+
*/
|
|
715
|
+
handleSearchKeydown(event) {
|
|
716
|
+
const filteredOptions = this.filteredOptions();
|
|
717
|
+
const currentIndex = this.activeOptionIndex();
|
|
718
|
+
switch (event.key) {
|
|
719
|
+
case 'ArrowDown': {
|
|
720
|
+
event.preventDefault();
|
|
721
|
+
event.stopPropagation();
|
|
722
|
+
const nextIndex = currentIndex < filteredOptions.length - 1 ? currentIndex + 1 : 0;
|
|
723
|
+
this.setActiveOption(nextIndex);
|
|
724
|
+
break;
|
|
725
|
+
}
|
|
726
|
+
case 'ArrowUp': {
|
|
727
|
+
event.preventDefault();
|
|
728
|
+
event.stopPropagation();
|
|
729
|
+
const prevIndex = currentIndex > 0 ? currentIndex - 1 : filteredOptions.length - 1;
|
|
730
|
+
this.setActiveOption(prevIndex);
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
case 'Enter':
|
|
734
|
+
event.preventDefault();
|
|
735
|
+
event.stopPropagation();
|
|
736
|
+
if (currentIndex >= 0 && currentIndex < filteredOptions.length) {
|
|
737
|
+
this.handleOptionSelect(filteredOptions[currentIndex]);
|
|
738
|
+
}
|
|
739
|
+
break;
|
|
740
|
+
case 'Tab': {
|
|
741
|
+
// Allow Tab only to clear button in multiple selection mode
|
|
742
|
+
const isMultipleSelection = this.selectionType() === 'multiple';
|
|
743
|
+
const hasSelectedValues = this.value() && this.isArray(this.value()) && this.value().length > 0;
|
|
744
|
+
if (isMultipleSelection && hasSelectedValues) {
|
|
745
|
+
// Allow default Tab behavior to go to clear button
|
|
746
|
+
break;
|
|
747
|
+
}
|
|
748
|
+
else {
|
|
749
|
+
// Prevent tabbing out of the search input
|
|
750
|
+
event.preventDefault();
|
|
751
|
+
event.stopPropagation();
|
|
752
|
+
}
|
|
753
|
+
break;
|
|
754
|
+
}
|
|
755
|
+
case 'Escape':
|
|
756
|
+
event.preventDefault();
|
|
757
|
+
event.stopPropagation();
|
|
758
|
+
this.animationState.set('closing');
|
|
759
|
+
this.activeOptionIndex.set(-1);
|
|
760
|
+
break;
|
|
761
|
+
default:
|
|
762
|
+
// For other keys (including space), set first option as active for typing
|
|
763
|
+
setTimeout(() => this.setDefaultActiveOption(), 0);
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Handles keyboard events on the clear all button
|
|
769
|
+
* @param event - The keyboard event
|
|
770
|
+
*/
|
|
771
|
+
handleClearButtonKeydown(event) {
|
|
772
|
+
if (event.key === 'Tab') {
|
|
773
|
+
// Prevent default Tab behavior and focus back to search input
|
|
774
|
+
event.preventDefault();
|
|
775
|
+
event.stopPropagation();
|
|
776
|
+
this.searchInputRef()?.nativeElement?.focus();
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Handles keyboard events on the trigger button
|
|
781
|
+
* @param event - The keyboard event
|
|
782
|
+
*/
|
|
783
|
+
handleTriggerKeydown(event) {
|
|
784
|
+
switch (event.key) {
|
|
785
|
+
case 'ArrowDown':
|
|
786
|
+
case 'ArrowUp':
|
|
787
|
+
case 'Enter':
|
|
788
|
+
case ' ':
|
|
789
|
+
event.preventDefault();
|
|
790
|
+
event.stopPropagation();
|
|
791
|
+
if (this.animationState() === 'closed') {
|
|
792
|
+
this.toggleOverlay();
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
// If already open, handle navigation
|
|
796
|
+
this.handleListboxKeydown(event);
|
|
797
|
+
}
|
|
798
|
+
break;
|
|
799
|
+
case 'Escape':
|
|
800
|
+
if (this.animationState() === 'open') {
|
|
801
|
+
event.preventDefault();
|
|
802
|
+
event.stopPropagation();
|
|
803
|
+
this.animationState.set('closing');
|
|
804
|
+
}
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Clears the current selection
|
|
810
|
+
*/
|
|
811
|
+
clearSelection() {
|
|
812
|
+
if (this.selectionType() === 'multiple') {
|
|
813
|
+
this.value.set([]);
|
|
814
|
+
this.onChange([]);
|
|
815
|
+
this.valueUpdated.emit([]);
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
this.value.set(null);
|
|
819
|
+
this.onChange(null);
|
|
820
|
+
this.valueUpdated.emit(null);
|
|
821
|
+
}
|
|
822
|
+
this.onTouched();
|
|
823
|
+
// Focus back to search input after clearing
|
|
824
|
+
setTimeout(() => {
|
|
825
|
+
this.searchInputRef()?.nativeElement?.focus();
|
|
826
|
+
// Set first option as active by default after clearing
|
|
827
|
+
this.setDefaultActiveOption();
|
|
828
|
+
}, 0);
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Handles clear selection button click
|
|
832
|
+
* @param event - The click event
|
|
833
|
+
*/
|
|
834
|
+
handleClearSelection(event) {
|
|
835
|
+
event.stopPropagation();
|
|
836
|
+
this.clearSelection();
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Checks if an option is currently selected
|
|
840
|
+
* @param option - The option to check
|
|
841
|
+
* @returns True if the option is selected
|
|
842
|
+
*/
|
|
843
|
+
isOptionSelected(option) {
|
|
844
|
+
const selectionType = this.selectionType();
|
|
845
|
+
const currentValue = this.value();
|
|
846
|
+
const optionValue = this.getOptionValue(option);
|
|
847
|
+
if (selectionType === 'multiple') {
|
|
848
|
+
const selected = Array.isArray(currentValue) ? currentValue : [];
|
|
849
|
+
return selected.some((value) => this.getOptionValue(value) === optionValue);
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
return currentValue && this.getOptionValue(currentValue) === optionValue;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Checks if an option is currently active for keyboard navigation
|
|
857
|
+
* @param index - The option index
|
|
858
|
+
* @returns True if the option is active
|
|
859
|
+
*/
|
|
860
|
+
isActiveOption(index) {
|
|
861
|
+
return this.activeOptionIndex() === index;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Gets the display value for an option
|
|
865
|
+
* @param option - The option to get display value for
|
|
866
|
+
* @returns The display string for the option
|
|
867
|
+
*/
|
|
868
|
+
getDisplayValue(option) {
|
|
869
|
+
if (!option)
|
|
870
|
+
return '';
|
|
871
|
+
const displayKey = this.displayKey();
|
|
872
|
+
if (displayKey && typeof option === 'object') {
|
|
873
|
+
return option[displayKey] || '';
|
|
874
|
+
}
|
|
875
|
+
if (typeof option === 'object') {
|
|
876
|
+
const commonKeys = ['name', 'label', 'text', 'title', 'displayName'];
|
|
877
|
+
for (const key of commonKeys) {
|
|
878
|
+
if (option[key] !== undefined && option[key] !== null) {
|
|
879
|
+
return String(option[key]);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
const keys = Object.keys(option);
|
|
883
|
+
for (const key of keys) {
|
|
884
|
+
const value = option[key];
|
|
885
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
886
|
+
return String(value);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return JSON.stringify(option);
|
|
890
|
+
}
|
|
891
|
+
return String(option);
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Type guard to check if a value is an array
|
|
895
|
+
* @param value - The value to check
|
|
896
|
+
* @returns True if the value is an array
|
|
897
|
+
*/
|
|
898
|
+
isArray(value) {
|
|
899
|
+
return Array.isArray(value);
|
|
900
|
+
}
|
|
901
|
+
// ==============================================================================
|
|
902
|
+
// PRIVATE METHODS
|
|
903
|
+
// ==============================================================================
|
|
904
|
+
/**
|
|
905
|
+
* Updates the trigger button width for overlay positioning
|
|
906
|
+
*/
|
|
907
|
+
updateTriggerWidth() {
|
|
908
|
+
if (this.triggerRef) {
|
|
909
|
+
const width = this.triggerRef()?.nativeElement.offsetWidth;
|
|
910
|
+
if (!width)
|
|
911
|
+
return;
|
|
912
|
+
this.triggerWidth.set(width);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Gets the value property from an option
|
|
917
|
+
* @param option - The option to get value from
|
|
918
|
+
* @returns The option value
|
|
919
|
+
*/
|
|
920
|
+
getOptionValue(option) {
|
|
921
|
+
if (!option)
|
|
922
|
+
return option;
|
|
923
|
+
const valueKey = this.valueKey();
|
|
924
|
+
return valueKey && typeof option === 'object' ? option[valueKey] : option;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Checks if a value is valid (exists in options)
|
|
928
|
+
* @param value - The value to validate
|
|
929
|
+
* @returns True if the value exists in the options array
|
|
930
|
+
*/
|
|
931
|
+
isValidValue(value) {
|
|
932
|
+
if (!value)
|
|
933
|
+
return false;
|
|
934
|
+
const options = this.options();
|
|
935
|
+
return options.some((option) => {
|
|
936
|
+
if (typeof option === 'string' && typeof value === 'string') {
|
|
937
|
+
return option === value;
|
|
938
|
+
}
|
|
939
|
+
// For objects, check if the value matches the option or its value property
|
|
940
|
+
const optionValue = this.getOptionValue(option);
|
|
941
|
+
const currentValue = this.getOptionValue(value);
|
|
942
|
+
return optionValue === currentValue || option === value;
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Triggers blur event for form validation
|
|
947
|
+
*/
|
|
948
|
+
triggerBlur() {
|
|
949
|
+
this.blurTrigger.update((val) => val + 1);
|
|
950
|
+
this.onTouched();
|
|
951
|
+
this.blurred.emit(this.value());
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Clears the search input and term
|
|
955
|
+
*/
|
|
956
|
+
clearSearch() {
|
|
957
|
+
this.searchValue.set('');
|
|
958
|
+
this.searchTerm.set('');
|
|
959
|
+
this.activeOptionIndex.set(-1);
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Sets up reactive search handling with debouncing
|
|
963
|
+
* The debounce time updates reactively when the input changes
|
|
964
|
+
*/
|
|
965
|
+
setupSearchHandling() {
|
|
966
|
+
const debounceTime$ = toObservable(this.searchDebounceTime);
|
|
967
|
+
debounceTime$
|
|
968
|
+
.pipe(switchMap((currentDebounceTime) => {
|
|
969
|
+
return this.searchSubject.pipe(debounceTime(currentDebounceTime), distinctUntilChanged());
|
|
970
|
+
}), takeUntilDestroyed())
|
|
971
|
+
.subscribe((searchValue) => {
|
|
972
|
+
this.searchTerm.set(searchValue);
|
|
973
|
+
// Set first option as active after debounced search
|
|
974
|
+
setTimeout(() => this.setDefaultActiveOption(), 0);
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Sets the active option for keyboard navigation
|
|
979
|
+
* @param index - The index of the option to make active
|
|
980
|
+
*/
|
|
981
|
+
setActiveOption(index) {
|
|
982
|
+
this.activeOptionIndex.set(index);
|
|
983
|
+
this.updateActiveOptionVisually();
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Sets the first option as active by default
|
|
987
|
+
*/
|
|
988
|
+
setDefaultActiveOption() {
|
|
989
|
+
const filteredOptions = this.filteredOptions();
|
|
990
|
+
if (filteredOptions.length > 0) {
|
|
991
|
+
this.setActiveOption(0);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Updates the visual state of the active option
|
|
996
|
+
*/
|
|
997
|
+
updateActiveOptionVisually() {
|
|
998
|
+
if (!this.optionsList()?.nativeElement)
|
|
999
|
+
return;
|
|
1000
|
+
// Remove active class from all options
|
|
1001
|
+
const allOptions = this.optionsList()?.nativeElement.querySelectorAll('[data-option-index]');
|
|
1002
|
+
if (!allOptions)
|
|
1003
|
+
return;
|
|
1004
|
+
allOptions.forEach((option) => {
|
|
1005
|
+
option.classList.remove('cdk-option-active');
|
|
1006
|
+
});
|
|
1007
|
+
// Add active class to current option
|
|
1008
|
+
const currentIndex = this.activeOptionIndex();
|
|
1009
|
+
if (currentIndex >= 0) {
|
|
1010
|
+
const activeOption = this.optionsList()?.nativeElement.querySelector(`[data-option-index="${currentIndex}"]`);
|
|
1011
|
+
if (activeOption) {
|
|
1012
|
+
activeOption.classList.add('cdk-option-active');
|
|
1013
|
+
// Scroll into view if needed
|
|
1014
|
+
activeOption.scrollIntoView({ block: 'nearest' });
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Sets up the search query emission effect
|
|
1020
|
+
* Emits search results whenever the search term or options change
|
|
1021
|
+
*/
|
|
1022
|
+
setupSearchQueryEmission() {
|
|
1023
|
+
effect(() => {
|
|
1024
|
+
const query = this.searchTerm();
|
|
1025
|
+
const results = this.filteredOptions();
|
|
1026
|
+
// Emit the search query event with current query and filtered results
|
|
1027
|
+
this.searchQuery.emit({ query, results });
|
|
1028
|
+
});
|
|
146
1029
|
}
|
|
147
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
148
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1030
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ComboboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1031
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: ComboboxComponent, isStandalone: true, selector: "st-combobox", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, ghost: { classPropertyName: "ghost", publicName: "ghost", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, allowClearAll: { classPropertyName: "allowClearAll", publicName: "allowClearAll", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, noResultsText: { classPropertyName: "noResultsText", publicName: "noResultsText", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, displayKey: { classPropertyName: "displayKey", publicName: "displayKey", isSignal: true, isRequired: false, transformFunction: null }, valueKey: { classPropertyName: "valueKey", publicName: "valueKey", isSignal: true, isRequired: false, transformFunction: null }, selectionType: { classPropertyName: "selectionType", publicName: "selectionType", isSignal: true, isRequired: false, transformFunction: null }, searchDebounced: { classPropertyName: "searchDebounced", publicName: "searchDebounced", isSignal: true, isRequired: false, transformFunction: null }, searchDebounceTime: { classPropertyName: "searchDebounceTime", publicName: "searchDebounceTime", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", value: "valueChange", blurred: "blurred", valueUpdated: "valueUpdated", searchQuery: "searchQuery" }, providers: [
|
|
149
1032
|
{
|
|
150
1033
|
provide: NG_VALUE_ACCESSOR,
|
|
151
1034
|
useExisting: ComboboxComponent,
|
|
152
1035
|
multi: true,
|
|
153
1036
|
},
|
|
154
|
-
], ngImport: i0, template: "<
|
|
1037
|
+
], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "searchInputRef", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "optionsList", first: true, predicate: ["optionsList"], descendants: true, isSignal: true }, { propertyName: "listbox", first: true, predicate: ["listbox"], descendants: true, isSignal: true }], ngImport: i0, template: "@let isOpen = this.isOpen(); @let isAnimatingOpen = this.isAnimatingOpen(); @let triggerWidth = this.triggerWidth();\n@let dataState = this.dataState(); @let filteredOptions = this.filteredOptions(); @let displayValue = this.displayValue();\n@let multipleDisplayInfo = this.multipleDisplayInfo(); @let label = this.label();\n\n<fieldset class=\"fieldset p-0\">\n\t@if (label) {\n\t\t<legend class=\"fieldset-legend font-body pt-0 text-pretty\">{{ label }}</legend>\n\t}\n\n\t<button\n\t\t#trigger\n\t\t[class]=\"validationClass()\"\n\t\t(click)=\"toggleOverlay()\"\n\t\t(keydown)=\"handleTriggerKeydown($event)\"\n\t\ttype=\"button\"\n\t\tcdkOverlayOrigin\n\t\taria-haspopup=\"true\"\n\t\trole=\"combobox\"\n\t\t[attr.aria-controls]=\"'combobox-list'\"\n\t\t[attr.aria-expanded]=\"isOpen\"\n\t\t[disabled]=\"disabled()\"\n\t>\n\t\t<span class=\"flex-1 truncate text-left\">\n\t\t\t@if (selectionType() === 'multiple' && multipleDisplayInfo) {\n\t\t\t\t<span class=\"inline-flex items-center gap-2\">\n\t\t\t\t\t<span class=\"truncate\">{{ multipleDisplayInfo.firstItem }}</span>\n\t\t\t\t\t@if (multipleDisplayInfo.additionalCount > 0) {\n\t\t\t\t\t\t<st-badge [size]=\"badgeClass()\">+{{ multipleDisplayInfo.additionalCount }}</st-badge>\n\t\t\t\t\t}\n\t\t\t\t</span>\n\t\t\t} @else {\n\t\t\t\t{{ displayValue }}\n\t\t\t}\n\t\t</span>\n\t\t<div class=\"inline-flex items-center justify-items-end gap-2\">\n\t\t\t<!-- Clear button for both single and multiple selection -->\n\t\t\t@if (showClearButton()) {\n\t\t\t\t<div class=\"grid translate-x-full place-content-center\">\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclass=\"btn font-body btn-sm btn-secondary h-[1.5em] w-[1.5em] items-center p-0 align-top [font-size:inherit] leading-normal font-medium text-pretty\"\n\t\t\t\t\t\t(click)=\"handleClearSelection($event)\"\n\t\t\t\t\t\t(keydown.enter)=\"handleClearSelection($event)\"\n\t\t\t\t\t\t(keydown.space)=\"handleClearSelection($event)\"\n\t\t\t\t\t\t[attr.aria-label]=\"'sdk.combobox.clearSelection' | translate\"\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<st-icon [icon]=\"iconClose\"></st-icon>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\t<st-icon\n\t\t\t\tclass=\"h-[1.5em] w-[1.5em] flex-0 translate-x-full transition-transform duration-200\"\n\t\t\t\t[class.rotate-180]=\"isAnimatingOpen\"\n\t\t\t\t[icon]=\"iconChevronDown\"\n\t\t\t></st-icon>\n\t\t</div>\n\t</button>\n\n\t<ng-template\n\t\tcdkConnectedOverlay\n\t\t[cdkConnectedOverlayOrigin]=\"trigger\"\n\t\t[cdkConnectedOverlayOpen]=\"isOpen\"\n\t\t[cdkConnectedOverlayWidth]=\"triggerWidth\"\n\t\t[cdkConnectedOverlayMinWidth]=\"triggerWidth\"\n\t\t(detach)=\"handleDetach()\"\n\t\t(overlayOutsideClick)=\"handleClickOutside($event)\"\n\t>\n\t\t<div\n\t\t\tclass=\"bg-base-200 rounded-box shadow-primary border-neutral data-[state=closing]:animate-fade-out-down data-[state=opening]:animate-fade-in-up data-[state=open]:animate-fade-in-up data-[state=closing]:animate-duration-150 data-[state=opening]:animate-duration-150 data-[state=open]:animate-duration-150 mt-1 w-full overflow-hidden border border-solid\"\n\t\t\t(animationend)=\"onAnimationEnd($event)\"\n\t\t\t[attr.data-state]=\"dataState\"\n\t\t>\n\t\t\t<!-- Search Input -->\n\t\t\t<div class=\"border-neutral border-b\">\n\t\t\t\t@let searchInputClass = this.searchInputClass();\n\t\t\t\t<div [class]=\"searchInputClass\">\n\t\t\t\t\t<st-icon class=\"text-base-placeholder\" [icon]=\"iconSearch\"></st-icon>\n\t\t\t\t\t<input\n\t\t\t\t\t\t#searchInput\n\t\t\t\t\t\tclass=\"placeholder:text-base-placeholder w-full border-transparent py-0 focus-within:outline-none focus:border-transparent focus:outline-none\"\n\t\t\t\t\t\t[value]=\"currentSearchValue\"\n\t\t\t\t\t\t(input)=\"handleSearchInput($event)\"\n\t\t\t\t\t\t(keydown)=\"handleSearchKeydown($event)\"\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t[placeholder]=\"translatedSearchPlaceholder()\"\n\t\t\t\t\t\t[attr.aria-label]=\"'sdk.combobox.searchOptions' | translate\"\n\t\t\t\t\t\t[disabled]=\"!isOpen\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<!-- Options List -->\n\t\t\t@let menuClass = this.menuClass();\n\t\t\t<ul\n\t\t\t\t[class]=\"menuClass\"\n\t\t\t\tcdkListbox\n\t\t\t\tcdkListboxUseActiveDescendant\n\t\t\t\t[cdkListboxMultiple]=\"selectionType() === 'multiple'\"\n\t\t\t\taria-labelledby=\"Combobox options\"\n\t\t\t\trole=\"listbox\"\n\t\t\t\t#optionsList\n\t\t\t\t[tabindex]=\"-1\"\n\t\t\t\t(keydown)=\"handleListboxKeydown($event)\"\n\t\t\t\t(selectionChange)=\"handleSelectionChange($event)\"\n\t\t\t>\n\t\t\t\t@for (option of filteredOptions; track $index) {\n\t\t\t\t\t<li [cdkOption]=\"option\" class=\"group\" [attr.data-option-index]=\"$index\" [class.cdk-option-active]=\"isActiveOption($index)\">\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tclass=\"group-[.cdk-option-active]:bg-base-300 font-body flex w-full items-center justify-between rounded-none px-4 py-2 text-left leading-normal font-normal text-pretty transition-colors duration-150 ease-in-out\"\n\t\t\t\t\t\t\t(click)=\"handleOptionSelect(option)\"\n\t\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"flex-1 truncate\">{{ getDisplayValue(option) }}</span>\n\n\t\t\t\t\t\t\t@if (isOptionSelected(option)) {\n\t\t\t\t\t\t\t\t<st-icon class=\"h-4 w-4 shrink-0\" [icon]=\"iconCheck\"></st-icon>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</li>\n\t\t\t\t}\n\n\t\t\t\t<!-- Empty state -->\n\t\t\t\t@if (filteredOptions.length === 0) {\n\t\t\t\t\t<li class=\"text-base-content/60 px-4 py-2 text-center\">\n\t\t\t\t\t\t<span>{{ translatedNoResultsText() }}</span>\n\t\t\t\t\t</li>\n\t\t\t\t}\n\t\t\t</ul>\n\n\t\t\t<!-- Clear All button for multiple selection -->\n\t\t\t@if (selectionType() === 'multiple' && allowClearAll() && value() && isArray(value()) && value().length > 0) {\n\t\t\t\t<div class=\"border-base-300 border-t p-2\">\n\t\t\t\t\t<button type=\"button\" class=\"btn btn-outline btn-sm w-full\" (click)=\"clearSelection()\" (keydown)=\"handleClearButtonKeydown($event)\">\n\t\t\t\t\t\t{{ 'sdk.combobox.clearAll' | translate }}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\t</ng-template>\n\n\t<!-- Hidden label for accessibility -->\n\t<label class=\"sr-only\" [for]=\"name()\">{{ label }}</label>\n\n\t<!-- Additional content -->\n\t<ng-content></ng-content>\n</fieldset>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: PortalModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: CdkListbox, selector: "[cdkListbox]", inputs: ["id", "tabindex", "cdkListboxValue", "cdkListboxMultiple", "cdkListboxDisabled", "cdkListboxUseActiveDescendant", "cdkListboxOrientation", "cdkListboxCompareWith", "cdkListboxNavigationWrapDisabled", "cdkListboxNavigatesDisabledOptions"], outputs: ["cdkListboxValueChange"], exportAs: ["cdkListbox"] }, { kind: "directive", type: CdkOption, selector: "[cdkOption]", inputs: ["id", "cdkOption", "cdkOptionTypeaheadLabel", "cdkOptionDisabled", "tabindex"], exportAs: ["cdkOption"] }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }, { kind: "component", type: BadgeComponent, selector: "st-badge", inputs: ["variant", "size", "outline", "soft", "dash", "ghost", "icon", "iconPosition"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
155
1038
|
}
|
|
156
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1039
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ComboboxComponent, decorators: [{
|
|
157
1040
|
type: Component,
|
|
158
|
-
args: [{ selector: 'st-combobox',
|
|
1041
|
+
args: [{ selector: 'st-combobox', imports: [FormsModule, ReactiveFormsModule, PortalModule, OverlayModule, CdkListbox, CdkOption, IconComponent, BadgeComponent, TranslatePipe], providers: [
|
|
159
1042
|
{
|
|
160
1043
|
provide: NG_VALUE_ACCESSOR,
|
|
161
1044
|
useExisting: ComboboxComponent,
|
|
162
1045
|
multi: true,
|
|
163
1046
|
},
|
|
164
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<
|
|
165
|
-
}] });
|
|
1047
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let isOpen = this.isOpen(); @let isAnimatingOpen = this.isAnimatingOpen(); @let triggerWidth = this.triggerWidth();\n@let dataState = this.dataState(); @let filteredOptions = this.filteredOptions(); @let displayValue = this.displayValue();\n@let multipleDisplayInfo = this.multipleDisplayInfo(); @let label = this.label();\n\n<fieldset class=\"fieldset p-0\">\n\t@if (label) {\n\t\t<legend class=\"fieldset-legend font-body pt-0 text-pretty\">{{ label }}</legend>\n\t}\n\n\t<button\n\t\t#trigger\n\t\t[class]=\"validationClass()\"\n\t\t(click)=\"toggleOverlay()\"\n\t\t(keydown)=\"handleTriggerKeydown($event)\"\n\t\ttype=\"button\"\n\t\tcdkOverlayOrigin\n\t\taria-haspopup=\"true\"\n\t\trole=\"combobox\"\n\t\t[attr.aria-controls]=\"'combobox-list'\"\n\t\t[attr.aria-expanded]=\"isOpen\"\n\t\t[disabled]=\"disabled()\"\n\t>\n\t\t<span class=\"flex-1 truncate text-left\">\n\t\t\t@if (selectionType() === 'multiple' && multipleDisplayInfo) {\n\t\t\t\t<span class=\"inline-flex items-center gap-2\">\n\t\t\t\t\t<span class=\"truncate\">{{ multipleDisplayInfo.firstItem }}</span>\n\t\t\t\t\t@if (multipleDisplayInfo.additionalCount > 0) {\n\t\t\t\t\t\t<st-badge [size]=\"badgeClass()\">+{{ multipleDisplayInfo.additionalCount }}</st-badge>\n\t\t\t\t\t}\n\t\t\t\t</span>\n\t\t\t} @else {\n\t\t\t\t{{ displayValue }}\n\t\t\t}\n\t\t</span>\n\t\t<div class=\"inline-flex items-center justify-items-end gap-2\">\n\t\t\t<!-- Clear button for both single and multiple selection -->\n\t\t\t@if (showClearButton()) {\n\t\t\t\t<div class=\"grid translate-x-full place-content-center\">\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclass=\"btn font-body btn-sm btn-secondary h-[1.5em] w-[1.5em] items-center p-0 align-top [font-size:inherit] leading-normal font-medium text-pretty\"\n\t\t\t\t\t\t(click)=\"handleClearSelection($event)\"\n\t\t\t\t\t\t(keydown.enter)=\"handleClearSelection($event)\"\n\t\t\t\t\t\t(keydown.space)=\"handleClearSelection($event)\"\n\t\t\t\t\t\t[attr.aria-label]=\"'sdk.combobox.clearSelection' | translate\"\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<st-icon [icon]=\"iconClose\"></st-icon>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\t<st-icon\n\t\t\t\tclass=\"h-[1.5em] w-[1.5em] flex-0 translate-x-full transition-transform duration-200\"\n\t\t\t\t[class.rotate-180]=\"isAnimatingOpen\"\n\t\t\t\t[icon]=\"iconChevronDown\"\n\t\t\t></st-icon>\n\t\t</div>\n\t</button>\n\n\t<ng-template\n\t\tcdkConnectedOverlay\n\t\t[cdkConnectedOverlayOrigin]=\"trigger\"\n\t\t[cdkConnectedOverlayOpen]=\"isOpen\"\n\t\t[cdkConnectedOverlayWidth]=\"triggerWidth\"\n\t\t[cdkConnectedOverlayMinWidth]=\"triggerWidth\"\n\t\t(detach)=\"handleDetach()\"\n\t\t(overlayOutsideClick)=\"handleClickOutside($event)\"\n\t>\n\t\t<div\n\t\t\tclass=\"bg-base-200 rounded-box shadow-primary border-neutral data-[state=closing]:animate-fade-out-down data-[state=opening]:animate-fade-in-up data-[state=open]:animate-fade-in-up data-[state=closing]:animate-duration-150 data-[state=opening]:animate-duration-150 data-[state=open]:animate-duration-150 mt-1 w-full overflow-hidden border border-solid\"\n\t\t\t(animationend)=\"onAnimationEnd($event)\"\n\t\t\t[attr.data-state]=\"dataState\"\n\t\t>\n\t\t\t<!-- Search Input -->\n\t\t\t<div class=\"border-neutral border-b\">\n\t\t\t\t@let searchInputClass = this.searchInputClass();\n\t\t\t\t<div [class]=\"searchInputClass\">\n\t\t\t\t\t<st-icon class=\"text-base-placeholder\" [icon]=\"iconSearch\"></st-icon>\n\t\t\t\t\t<input\n\t\t\t\t\t\t#searchInput\n\t\t\t\t\t\tclass=\"placeholder:text-base-placeholder w-full border-transparent py-0 focus-within:outline-none focus:border-transparent focus:outline-none\"\n\t\t\t\t\t\t[value]=\"currentSearchValue\"\n\t\t\t\t\t\t(input)=\"handleSearchInput($event)\"\n\t\t\t\t\t\t(keydown)=\"handleSearchKeydown($event)\"\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t[placeholder]=\"translatedSearchPlaceholder()\"\n\t\t\t\t\t\t[attr.aria-label]=\"'sdk.combobox.searchOptions' | translate\"\n\t\t\t\t\t\t[disabled]=\"!isOpen\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<!-- Options List -->\n\t\t\t@let menuClass = this.menuClass();\n\t\t\t<ul\n\t\t\t\t[class]=\"menuClass\"\n\t\t\t\tcdkListbox\n\t\t\t\tcdkListboxUseActiveDescendant\n\t\t\t\t[cdkListboxMultiple]=\"selectionType() === 'multiple'\"\n\t\t\t\taria-labelledby=\"Combobox options\"\n\t\t\t\trole=\"listbox\"\n\t\t\t\t#optionsList\n\t\t\t\t[tabindex]=\"-1\"\n\t\t\t\t(keydown)=\"handleListboxKeydown($event)\"\n\t\t\t\t(selectionChange)=\"handleSelectionChange($event)\"\n\t\t\t>\n\t\t\t\t@for (option of filteredOptions; track $index) {\n\t\t\t\t\t<li [cdkOption]=\"option\" class=\"group\" [attr.data-option-index]=\"$index\" [class.cdk-option-active]=\"isActiveOption($index)\">\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tclass=\"group-[.cdk-option-active]:bg-base-300 font-body flex w-full items-center justify-between rounded-none px-4 py-2 text-left leading-normal font-normal text-pretty transition-colors duration-150 ease-in-out\"\n\t\t\t\t\t\t\t(click)=\"handleOptionSelect(option)\"\n\t\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"flex-1 truncate\">{{ getDisplayValue(option) }}</span>\n\n\t\t\t\t\t\t\t@if (isOptionSelected(option)) {\n\t\t\t\t\t\t\t\t<st-icon class=\"h-4 w-4 shrink-0\" [icon]=\"iconCheck\"></st-icon>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</li>\n\t\t\t\t}\n\n\t\t\t\t<!-- Empty state -->\n\t\t\t\t@if (filteredOptions.length === 0) {\n\t\t\t\t\t<li class=\"text-base-content/60 px-4 py-2 text-center\">\n\t\t\t\t\t\t<span>{{ translatedNoResultsText() }}</span>\n\t\t\t\t\t</li>\n\t\t\t\t}\n\t\t\t</ul>\n\n\t\t\t<!-- Clear All button for multiple selection -->\n\t\t\t@if (selectionType() === 'multiple' && allowClearAll() && value() && isArray(value()) && value().length > 0) {\n\t\t\t\t<div class=\"border-base-300 border-t p-2\">\n\t\t\t\t\t<button type=\"button\" class=\"btn btn-outline btn-sm w-full\" (click)=\"clearSelection()\" (keydown)=\"handleClearButtonKeydown($event)\">\n\t\t\t\t\t\t{{ 'sdk.combobox.clearAll' | translate }}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\t</ng-template>\n\n\t<!-- Hidden label for accessibility -->\n\t<label class=\"sr-only\" [for]=\"name()\">{{ label }}</label>\n\n\t<!-- Additional content -->\n\t<ng-content></ng-content>\n</fieldset>\n" }]
|
|
1048
|
+
}], ctorParameters: () => [] });
|
|
166
1049
|
|
|
167
1050
|
/**
|
|
168
1051
|
* Generated bundle index. Do not edit.
|