@govbr-ds/webcomponents 2.4.0 → 2.6.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/README.md +2 -2
- package/cem/custom-elements.json +4438 -1034
- package/cem/webcomponents.html-custom-data.json +491 -160
- package/dist/cjs/br-avatar.cjs.entry.js +4 -4
- package/dist/cjs/br-breadcrumb-item.cjs.entry.js +2 -2
- package/dist/cjs/br-breadcrumb.cjs.entry.js +11 -11
- package/dist/cjs/br-button_2.cjs.entry.js +6 -6
- package/dist/cjs/br-card.cjs.entry.js +4 -4
- package/dist/cjs/br-carousel-page.cjs.entry.js +3 -3
- package/dist/cjs/br-carousel.cjs.entry.js +5 -5
- package/dist/cjs/br-checkbox-group.cjs.entry.js +4 -4
- package/dist/cjs/br-checkbox.cjs.entry.js +5 -5
- package/dist/cjs/br-checkgroup.cjs.entry.js +2 -2
- package/dist/cjs/br-collapse_2.cjs.entry.js +10 -10
- package/dist/cjs/br-cookiebar-cookie.cjs.entry.js +3 -3
- package/dist/cjs/br-cookiebar-group.cjs.entry.js +4 -4
- package/dist/cjs/br-cookiebar-header.cjs.entry.js +3 -3
- package/dist/cjs/br-cookiebar-link.cjs.entry.js +3 -3
- package/dist/cjs/br-cookiebar-note-group.cjs.entry.js +3 -3
- package/dist/cjs/br-cookiebar-note.cjs.entry.js +3 -3
- package/dist/cjs/br-cookiebar.cjs.entry.js +5 -5
- package/dist/cjs/br-crumb.cjs.entry.js +2 -2
- package/dist/cjs/br-date-picker_3.cjs.entry.js +165 -78
- package/dist/cjs/br-datetime-picker.cjs.entry.js +11 -28
- package/dist/cjs/br-divider.cjs.entry.js +4 -4
- package/dist/cjs/br-dropdown.cjs.entry.js +677 -0
- package/dist/cjs/br-footer-category.cjs.entry.js +4 -4
- package/dist/cjs/br-footer-item.cjs.entry.js +3 -3
- package/dist/cjs/br-footer-legal.cjs.entry.js +3 -3
- package/dist/cjs/br-footer-logo.cjs.entry.js +3 -3
- package/dist/cjs/br-footer-social.cjs.entry.js +3 -3
- package/dist/cjs/br-footer.cjs.entry.js +5 -5
- package/dist/cjs/br-header-function.cjs.entry.js +3 -3
- package/dist/cjs/br-header-link.cjs.entry.js +3 -3
- package/dist/cjs/br-header-list.cjs.entry.js +4 -4
- package/dist/cjs/br-header-logo.cjs.entry.js +3 -3
- package/dist/cjs/br-header.cjs.entry.js +6 -6
- package/dist/cjs/br-icon.cjs.entry.js +173 -159
- package/dist/cjs/br-input_2.cjs.entry.js +1427 -0
- package/dist/cjs/br-item.cjs.entry.js +4 -4
- package/dist/cjs/br-link.cjs.entry.js +9 -9
- package/dist/cjs/br-magic-button.cjs.entry.js +11 -12
- package/dist/cjs/br-menu-group.cjs.entry.js +3 -3
- package/dist/cjs/br-menu-header.cjs.entry.js +3 -3
- package/dist/cjs/br-menu-info.cjs.entry.js +3 -3
- package/dist/cjs/br-menu-item.cjs.entry.js +3 -3
- package/dist/cjs/br-menu-link.cjs.entry.js +3 -3
- package/dist/cjs/br-menu-list.cjs.entry.js +2 -2
- package/dist/cjs/br-menu-logo.cjs.entry.js +3 -3
- package/dist/cjs/br-menu-social.cjs.entry.js +2 -2
- package/dist/cjs/br-menu.cjs.entry.js +5 -5
- package/dist/cjs/br-modal.cjs.entry.js +2 -2
- package/dist/cjs/br-notification-body.cjs.entry.js +3 -3
- package/dist/cjs/br-notification-header.cjs.entry.js +3 -3
- package/dist/cjs/br-notification-item.cjs.entry.js +3 -3
- package/dist/cjs/br-notification.cjs.entry.js +4 -4
- package/dist/cjs/br-pagination_2.cjs.entry.js +2578 -0
- package/dist/cjs/br-radio-group.cjs.entry.js +5 -5
- package/dist/cjs/br-radio.cjs.entry.js +5 -5
- package/dist/cjs/br-scrim.cjs.entry.js +4 -4
- package/dist/cjs/br-select-input_3.cjs.entry.js +49 -103
- package/dist/cjs/br-sign-in.cjs.entry.js +4 -4
- package/dist/cjs/br-skip-link-item.cjs.entry.js +2 -2
- package/dist/cjs/br-skip-link.cjs.entry.js +3 -3
- package/dist/cjs/br-skiplink-item.cjs.entry.js +3 -3
- package/dist/cjs/br-slider.cjs.entry.js +4 -4
- package/dist/cjs/br-step_2.cjs.entry.js +7 -7
- package/dist/cjs/br-switch.cjs.entry.js +5 -5
- package/dist/cjs/br-tab-item.cjs.entry.js +3 -3
- package/dist/cjs/br-tab.cjs.entry.js +8 -8
- package/dist/cjs/br-table-action_6.cjs.entry.js +1500 -0
- package/dist/cjs/br-table-body.cjs.entry.js +4 -16
- package/dist/cjs/br-table-header.cjs.entry.js +4 -16
- package/dist/cjs/br-table.cjs.entry.js +2616 -433
- package/dist/cjs/br-tag.cjs.entry.js +5 -5
- package/dist/cjs/br-textarea.cjs.entry.js +4 -4
- package/dist/cjs/br-tooltip.cjs.entry.js +5 -29
- package/dist/cjs/br-upload.cjs.entry.js +5 -5
- package/dist/cjs/br-wizard-panel.cjs.entry.js +3 -3
- package/dist/cjs/br-wizard.cjs.entry.js +3 -3
- package/dist/cjs/{datetime-picker-constants-CCeI5iW7.js → datetime-picker-constants-CTf1kVJ1.js} +1 -0
- package/dist/cjs/helpers-DkkDubv1.js +28 -0
- package/dist/cjs/{icon.utils-DF6kMskA.js → icon.utils-CMs0ukvR.js} +1 -1
- package/dist/cjs/{iconify-icon-DfODV9bf.js → iconify-icon-LjavbM-D.js} +103 -57
- package/dist/cjs/{index-Bc30P_6z.js → index-BP8UIQro.js} +34 -34
- package/dist/cjs/{index-C-IpVFDH.js → index-Caoez3xb.js} +64 -16
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{isValid-CduHZTFc.js → isValid-DgJ-noPS.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{slot-DAllytTj.js → slot-CjaqqX7y.js} +1 -1
- package/dist/cjs/table.utils-De-9_NgJ.js +749 -0
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/avatar/avatar.css +1 -1
- package/dist/collection/components/avatar/avatar.js +21 -21
- package/dist/collection/components/breadcrumb/breadcrumb-item/breadcrumb-item.js +4 -12
- package/dist/collection/components/breadcrumb/breadcrumb.css +1 -1
- package/dist/collection/components/breadcrumb/breadcrumb.js +39 -34
- package/dist/collection/components/breadcrumb/crumb/crumb.js +2 -13
- package/dist/collection/components/button/button.css +1 -1
- package/dist/collection/components/button/button.js +22 -22
- package/dist/collection/components/card/card.css +1 -1
- package/dist/collection/components/card/card.js +20 -22
- package/dist/collection/components/carousel/carousel-page/carousel-page.css +1 -1
- package/dist/collection/components/carousel/carousel-page/carousel-page.js +3 -13
- package/dist/collection/components/carousel/carousel.css +1 -1
- package/dist/collection/components/carousel/carousel.js +25 -32
- package/dist/collection/components/checkbox/checkbox.css +1 -1
- package/dist/collection/components/checkbox/checkbox.js +18 -24
- package/dist/collection/components/checkbox-group/checkbox-group.css +1 -1
- package/dist/collection/components/checkbox-group/checkbox-group.js +19 -20
- package/dist/collection/components/checkgroup/checkgroup.js +2 -14
- package/dist/collection/components/collapse/collapse.css +1 -1
- package/dist/collection/components/collapse/collapse.js +33 -29
- package/dist/collection/components/cookiebar/cookiebar-cookie/cookiebar-cookie.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-cookie/cookiebar-cookie.js +3 -16
- package/dist/collection/components/cookiebar/cookiebar-group/cookiebar-group.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-group/cookiebar-group.js +4 -17
- package/dist/collection/components/cookiebar/cookiebar-header/cookiebar-header.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-header/cookiebar-header.js +3 -16
- package/dist/collection/components/cookiebar/cookiebar-link/cookiebar-link.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-link/cookiebar-link.js +3 -15
- package/dist/collection/components/cookiebar/cookiebar-note/cookiebar-note.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-note/cookiebar-note.js +3 -14
- package/dist/collection/components/cookiebar/cookiebar-note-group/cookiebar-note-group.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-note-group/cookiebar-note-group.js +3 -14
- package/dist/collection/components/cookiebar/cookiebar.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar.js +33 -28
- package/dist/collection/components/datetime-picker/date-picker/date-picker-locale.js +62 -15
- package/dist/collection/components/datetime-picker/date-picker/date-picker.css +1 -1
- package/dist/collection/components/datetime-picker/date-picker/date-picker.js +123 -74
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.css +1 -1
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.js +5 -15
- package/dist/collection/components/datetime-picker/datetime-picker.css +1 -1
- package/dist/collection/components/datetime-picker/datetime-picker.js +23 -27
- package/dist/collection/components/datetime-picker/datetime-picker.utils.js +6 -6
- package/dist/collection/components/datetime-picker/time-picker/time-picker.css +1 -1
- package/dist/collection/components/datetime-picker/time-picker/time-picker.js +7 -17
- package/dist/collection/components/divider/divider.css +1 -1
- package/dist/collection/components/divider/divider.js +15 -19
- package/dist/collection/components/dropdown/dropdown.css +1 -1
- package/dist/collection/components/dropdown/dropdown.js +27 -28
- package/dist/collection/components/footer/footer-category/footer-category.css +1 -1
- package/dist/collection/components/footer/footer-category/footer-category.js +4 -17
- package/dist/collection/components/footer/footer-item/footer-item.css +1 -1
- package/dist/collection/components/footer/footer-item/footer-item.js +3 -16
- package/dist/collection/components/footer/footer-legal/footer-legal.css +1 -1
- package/dist/collection/components/footer/footer-legal/footer-legal.js +2 -16
- package/dist/collection/components/footer/footer-logo/footer-logo.css +1 -1
- package/dist/collection/components/footer/footer-logo/footer-logo.js +3 -16
- package/dist/collection/components/footer/footer-social/footer-social.css +1 -1
- package/dist/collection/components/footer/footer-social/footer-social.js +4 -16
- package/dist/collection/components/footer/footer.css +1 -1
- package/dist/collection/components/footer/footer.js +25 -29
- package/dist/collection/components/header/header-function/header-function.css +1 -1
- package/dist/collection/components/header/header-function/header-function.js +10 -14
- package/dist/collection/components/header/header-link/header-link.css +1 -1
- package/dist/collection/components/header/header-link/header-link.js +3 -16
- package/dist/collection/components/header/header-list/header-list.css +1 -1
- package/dist/collection/components/header/header-list/header-list.js +4 -17
- package/dist/collection/components/header/header-logo/header-logo.css +1 -1
- package/dist/collection/components/header/header-logo/header-logo.js +3 -16
- package/dist/collection/components/header/header.css +1 -1
- package/dist/collection/components/header/header.js +33 -30
- package/dist/collection/components/icon/default-icons-cache.js +159 -146
- package/dist/collection/components/icon/icon.css +1 -1
- package/dist/collection/components/icon/icon.js +38 -29
- package/dist/collection/components/icon/icon.utils.js +1 -1
- package/dist/collection/components/input/input.css +1 -1
- package/dist/collection/components/input/input.js +216 -30
- package/dist/collection/components/item/item.css +1 -1
- package/dist/collection/components/item/item.js +18 -22
- package/dist/collection/components/link/link.css +1 -1
- package/dist/collection/components/link/link.js +25 -29
- package/dist/collection/components/list/list.css +1 -1
- package/dist/collection/components/list/list.js +17 -21
- package/dist/collection/components/loading/loading.css +1 -1
- package/dist/collection/components/loading/loading.js +17 -24
- package/dist/collection/components/magic-button/magic-button.css +1 -1
- package/dist/collection/components/magic-button/magic-button.js +21 -29
- package/dist/collection/components/menu/menu-group/menu-group.css +1 -1
- package/dist/collection/components/menu/menu-group/menu-group.js +3 -16
- package/dist/collection/components/menu/menu-header/menu-header.css +1 -1
- package/dist/collection/components/menu/menu-header/menu-header.js +3 -16
- package/dist/collection/components/menu/menu-info/menu-info.css +1 -1
- package/dist/collection/components/menu/menu-info/menu-info.js +2 -15
- package/dist/collection/components/menu/menu-item/menu-item.css +1 -1
- package/dist/collection/components/menu/menu-item/menu-item.js +3 -16
- package/dist/collection/components/menu/menu-link/menu-link.css +1 -1
- package/dist/collection/components/menu/menu-link/menu-link.js +5 -17
- package/dist/collection/components/menu/menu-list/menu-list.css +1 -1
- package/dist/collection/components/menu/menu-list/menu-list.js +2 -15
- package/dist/collection/components/menu/menu-logo/menu-logo.css +1 -1
- package/dist/collection/components/menu/menu-logo/menu-logo.js +2 -15
- package/dist/collection/components/menu/menu-social/menu-social.css +1 -1
- package/dist/collection/components/menu/menu-social/menu-social.js +3 -16
- package/dist/collection/components/menu/menu.css +1 -1
- package/dist/collection/components/menu/menu.js +28 -35
- package/dist/collection/components/message/message.css +1 -1
- package/dist/collection/components/message/message.js +22 -25
- package/dist/collection/components/modal/modal.css +1 -1
- package/dist/collection/components/modal/modal.js +18 -21
- package/dist/collection/components/notification/notification-body/notification-body.css +1 -1
- package/dist/collection/components/notification/notification-body/notification-body.js +3 -13
- package/dist/collection/components/notification/notification-header/notification-header.css +1 -1
- package/dist/collection/components/notification/notification-header/notification-header.js +3 -14
- package/dist/collection/components/notification/notification-item/notification-item.css +1 -1
- package/dist/collection/components/notification/notification-item/notification-item.js +3 -16
- package/dist/collection/components/notification/notification.css +1 -1
- package/dist/collection/components/notification/notification.js +20 -29
- package/dist/collection/components/pagination/pagination.css +1 -1
- package/dist/collection/components/pagination/pagination.js +19 -27
- package/dist/collection/components/radio/radio.css +1 -1
- package/dist/collection/components/radio/radio.js +17 -20
- package/dist/collection/components/radio-group/radio-group.css +1 -1
- package/dist/collection/components/radio-group/radio-group.js +20 -20
- package/dist/collection/components/scrim/scrim.css +1 -1
- package/dist/collection/components/scrim/scrim.js +14 -17
- package/dist/collection/components/select/select-input/select-input.css +1 -1
- package/dist/collection/components/select/select-input/select-input.js +48 -102
- package/dist/collection/components/select/select-list/select-list.css +1 -1
- package/dist/collection/components/select/select-list/select-list.js +52 -15
- package/dist/collection/components/select/select-option/select-option.css +1 -1
- package/dist/collection/components/select/select-option/select-option.js +13 -17
- package/dist/collection/components/select/select.css +1 -1
- package/dist/collection/components/select/select.js +104 -110
- package/dist/collection/components/sign-in/sign-in.css +1 -1
- package/dist/collection/components/sign-in/sign-in.js +12 -16
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item-alias.js +8 -4
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item.css +1 -1
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item.js +5 -15
- package/dist/collection/components/skip-link/skip-link.css +1 -1
- package/dist/collection/components/skip-link/skip-link.js +18 -24
- package/dist/collection/components/slider/slider.css +1 -1
- package/dist/collection/components/slider/slider.js +18 -28
- package/dist/collection/components/step/step-item/step-item.css +1 -1
- package/dist/collection/components/step/step-item/step-item.js +5 -15
- package/dist/collection/components/step/step.css +1 -1
- package/dist/collection/components/step/step.js +16 -25
- package/dist/collection/components/switch/switch.css +1 -1
- package/dist/collection/components/switch/switch.js +16 -20
- package/dist/collection/components/tab/tab-item/tab-item.css +1 -1
- package/dist/collection/components/tab/tab-item/tab-item.js +6 -16
- package/dist/collection/components/tab/tab.css +1 -1
- package/dist/collection/components/tab/tab.js +24 -31
- package/dist/collection/components/table/table-action/table-action.css +1 -0
- package/dist/collection/components/table/table-action/table-action.js +349 -0
- package/dist/collection/components/table/table-bar/table-bar.css +1 -0
- package/dist/collection/components/table/table-bar/table-bar.js +652 -0
- package/dist/collection/components/table/table-body/table-body.css +1 -1
- package/dist/collection/components/table/table-body/table-body.js +11 -26
- package/dist/collection/components/table/table-cell/table-cell.css +1 -1
- package/dist/collection/components/table/table-cell/table-cell.js +555 -91
- package/dist/collection/components/table/table-footer/table-footer.css +1 -0
- package/dist/collection/components/table/table-footer/table-footer.js +233 -0
- package/dist/collection/components/table/table-header/table-header.css +1 -1
- package/dist/collection/components/table/table-header/table-header.js +10 -26
- package/dist/collection/components/table/table-header-cell/table-header-cell.css +1 -1
- package/dist/collection/components/table/table-header-cell/table-header-cell.js +286 -95
- package/dist/collection/components/table/table-row/table-row.css +1 -1
- package/dist/collection/components/table/table-row/table-row.js +311 -66
- package/dist/collection/components/table/table.actions-tooltip.js +33 -0
- package/dist/collection/components/table/{table-constants.js → table.constants.js} +54 -77
- package/dist/collection/components/table/table.css +1 -1
- package/dist/collection/components/table/table.data.js +461 -0
- package/dist/collection/components/table/table.expansion.elements.js +70 -0
- package/dist/collection/components/table/table.expansion.js +179 -0
- package/dist/collection/components/table/table.grouping.js +97 -0
- package/dist/collection/components/table/table.header-height.js +47 -0
- package/dist/collection/components/table/table.js +2499 -625
- package/dist/collection/components/table/table.keyboard.js +340 -0
- package/dist/collection/components/table/table.scroll-shadows.js +36 -0
- package/dist/collection/components/table/table.selection.elements.js +63 -0
- package/dist/collection/components/table/table.selection.js +239 -0
- package/dist/collection/components/table/table.tokens.js +28 -0
- package/dist/collection/components/table/table.types.js +1 -0
- package/dist/collection/components/table/table.utils.js +75 -0
- package/dist/collection/components/table/table.virtual-list.js +342 -0
- package/dist/collection/components/tag/tag.css +1 -1
- package/dist/collection/components/tag/tag.js +17 -26
- package/dist/collection/components/textarea/textarea.css +1 -1
- package/dist/collection/components/textarea/textarea.js +14 -22
- package/dist/collection/components/tooltip/tooltip.css +1 -1
- package/dist/collection/components/tooltip/tooltip.js +15 -45
- package/dist/collection/components/upload/upload.css +1 -1
- package/dist/collection/components/upload/upload.js +36 -29
- package/dist/collection/components/wizard/wizard-panel/wizard-panel.css +1 -1
- package/dist/collection/components/wizard/wizard-panel/wizard-panel.js +3 -13
- package/dist/collection/components/wizard/wizard.css +1 -1
- package/dist/collection/components/wizard/wizard.js +22 -26
- package/dist/collection/pages/components/select/remote-options.js +87 -0
- package/dist/collection/pages/scripts/code-editor.js +28 -3
- package/dist/collection/pages/scripts/pageLoader.js +286 -20
- package/dist/collection/pages/scripts/pageloader-preview.js +3 -1
- package/dist/collection/shared/utils/slot.js +1 -1
- package/dist/components/br-avatar.js +1 -1
- package/dist/components/br-breadcrumb-item.js +1 -1
- package/dist/components/br-breadcrumb.js +1 -1
- package/dist/components/br-button.js +1 -1
- package/dist/components/br-card.js +1 -1
- package/dist/components/br-carousel-page.js +1 -1
- package/dist/components/br-carousel.js +1 -1
- package/dist/components/br-checkbox-group.js +1 -1
- package/dist/components/br-checkbox.js +1 -1
- package/dist/components/br-checkgroup.js +1 -1
- package/dist/components/br-collapse.js +1 -1
- package/dist/components/br-cookiebar-cookie.js +1 -1
- package/dist/components/br-cookiebar-group.js +1 -1
- package/dist/components/br-cookiebar-header.js +1 -1
- package/dist/components/br-cookiebar-link.js +1 -1
- package/dist/components/br-cookiebar-note-group.js +1 -1
- package/dist/components/br-cookiebar-note.js +1 -1
- package/dist/components/br-cookiebar.js +1 -1
- package/dist/components/br-crumb.js +1 -1
- package/dist/components/br-date-picker.js +1 -1
- package/dist/components/br-datetime-input.js +1 -1
- package/dist/components/br-datetime-picker.js +1 -1
- package/dist/components/br-divider.js +1 -1
- package/dist/components/br-dropdown.js +1 -1
- package/dist/components/br-footer-category.js +1 -1
- package/dist/components/br-footer-item.js +1 -1
- package/dist/components/br-footer-legal.js +1 -1
- package/dist/components/br-footer-logo.js +1 -1
- package/dist/components/br-footer-social.js +1 -1
- package/dist/components/br-footer.js +1 -1
- package/dist/components/br-header-function.js +1 -1
- package/dist/components/br-header-link.js +1 -1
- package/dist/components/br-header-list.js +1 -1
- package/dist/components/br-header-logo.js +1 -1
- package/dist/components/br-header.js +1 -1
- package/dist/components/br-icon.js +1 -1
- package/dist/components/br-input.js +1 -1
- package/dist/components/br-item.js +1 -1
- package/dist/components/br-link.js +1 -1
- package/dist/components/br-list.js +1 -1
- package/dist/components/br-loading.js +1 -1
- package/dist/components/br-magic-button.js +1 -1
- package/dist/components/br-menu-group.js +1 -1
- package/dist/components/br-menu-header.js +1 -1
- package/dist/components/br-menu-info.js +1 -1
- package/dist/components/br-menu-item.js +1 -1
- package/dist/components/br-menu-link.js +1 -1
- package/dist/components/br-menu-list.js +1 -1
- package/dist/components/br-menu-logo.js +1 -1
- package/dist/components/br-menu-social.js +1 -1
- package/dist/components/br-menu.js +1 -1
- package/dist/components/br-message.js +1 -1
- package/dist/components/br-modal.js +1 -1
- package/dist/components/br-notification-body.js +1 -1
- package/dist/components/br-notification-header.js +1 -1
- package/dist/components/br-notification-item.js +1 -1
- package/dist/components/br-notification.js +1 -1
- package/dist/components/br-pagination.js +1 -1
- package/dist/components/br-radio-group.js +1 -1
- package/dist/components/br-radio.js +1 -1
- package/dist/components/br-scrim.js +1 -1
- package/dist/components/br-select-input.js +1 -1
- package/dist/components/br-select-list.js +1 -1
- package/dist/components/br-select-option.js +1 -1
- package/dist/components/br-select.js +1 -1
- package/dist/components/br-sign-in.js +1 -1
- package/dist/components/br-skip-link-item.js +1 -1
- package/dist/components/br-skip-link.js +1 -1
- package/dist/components/br-skiplink-item.js +1 -1
- package/dist/components/br-slider.js +1 -1
- package/dist/components/br-step-item.js +1 -1
- package/dist/components/br-step.js +1 -1
- package/dist/components/br-switch.js +1 -1
- package/dist/components/br-tab-item.js +1 -1
- package/dist/components/br-tab.js +1 -1
- package/dist/components/br-table-action.d.ts +11 -0
- package/dist/components/br-table-action.js +5 -0
- package/dist/components/br-table-bar.d.ts +11 -0
- package/dist/components/br-table-bar.js +5 -0
- package/dist/components/br-table-body.js +1 -1
- package/dist/components/br-table-cell.js +1 -1
- package/dist/components/br-table-footer.d.ts +11 -0
- package/dist/components/br-table-footer.js +5 -0
- package/dist/components/br-table-header-cell.js +1 -1
- package/dist/components/br-table-header.js +1 -1
- package/dist/components/br-table-row.js +1 -1
- package/dist/components/br-table.js +1 -1
- package/dist/components/br-tag.js +1 -1
- package/dist/components/br-textarea.js +1 -1
- package/dist/components/br-time-picker.js +1 -1
- package/dist/components/br-tooltip.js +1 -1
- package/dist/components/br-upload.js +1 -1
- package/dist/components/br-wizard-panel.js +1 -1
- package/dist/components/br-wizard.js +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-082jxuTj.js +5 -0
- package/dist/components/p-381n6AwK.js +5 -0
- package/dist/components/p-B5_zbRAr.js +5 -0
- package/dist/components/p-BE1gDPwC.js +5 -0
- package/dist/components/p-BV-c2pxt.js +5 -0
- package/dist/components/p-BfFbYAuJ.js +5 -0
- package/dist/components/{p-ta-24T1Z.js → p-Bi2E_w9Q.js} +1 -1
- package/dist/components/p-Bk8YcMql.js +5 -0
- package/dist/components/p-C3ISxUGw.js +5 -0
- package/dist/components/p-C3J0TVQO.js +5 -0
- package/dist/components/p-C6m13lCc.js +5 -0
- package/dist/components/{p-DBmwzG9E.js → p-CCWJ-H33.js} +1 -1
- package/dist/components/p-CJuHirYK.js +5 -0
- package/dist/components/{p-PV731d8s.js → p-CKS7ggLM.js} +1 -1
- package/dist/components/p-COSFBwu9.js +5 -0
- package/dist/components/{p-DsO4F0Cz.js → p-CVz_akHx.js} +1 -1
- package/dist/components/p-CWPrXYam.js +5 -0
- package/dist/components/p-C_DC6oQW.js +16 -0
- package/dist/components/p-Ca89D_0s.js +5 -0
- package/dist/components/p-CbN58CFi.js +5 -0
- package/dist/components/p-CjjxTkKb.js +5 -0
- package/dist/components/p-Ck9t4WSb.js +5 -0
- package/dist/components/p-CvfVwD6_.js +5 -0
- package/dist/components/p-D-1sfjhG.js +5 -0
- package/dist/components/p-D-p4vLlP.js +5 -0
- package/dist/components/p-D6DArHGH.js +5 -0
- package/dist/components/p-DD3BItoS.js +5 -0
- package/dist/components/{p-jOb1hCPi.js → p-DEIKwFIf.js} +1 -1
- package/dist/components/p-DHHAIESt.js +5 -0
- package/dist/components/{p-Jk_KQE5V.js → p-DMj5iO7_.js} +1 -1
- package/dist/components/p-DUI-S07G.js +5 -0
- package/dist/components/p-D_K9JH6J.js +5 -0
- package/dist/components/p-DiQp2Lap.js +5 -0
- package/dist/components/{p-rMnkh3Cy.js → p-Dn36Mj2E.js} +1 -1
- package/dist/components/{p-D-3G3Ioq.js → p-Dvbqhybt.js} +1 -1
- package/dist/components/p-Dy7MSvt-.js +5 -0
- package/dist/components/p-DywTXNHQ.js +5 -0
- package/dist/components/p-Ft_P7Roz.js +5 -0
- package/dist/components/{p-CbgKdASU.js → p-JkJjzmGm.js} +1 -1
- package/dist/components/p-KuiFoKDl.js +5 -0
- package/dist/components/p-MiiczSWA.js +5 -0
- package/dist/components/p-Um3K2SHu.js +5 -0
- package/dist/components/p-YxddSP6q.js +5 -0
- package/dist/components/p-Zk91ebVT.js +5 -0
- package/dist/components/p-jv2oG0vH.js +5 -0
- package/dist/components/p-nrG_Gd0c.js +5 -0
- package/dist/components/p-syLEZrcg.js +5 -0
- package/dist/components/p-ydfWTgrA.js +5 -0
- package/dist/esm/br-avatar.entry.js +5 -5
- package/dist/esm/br-breadcrumb-item.entry.js +2 -2
- package/dist/esm/br-breadcrumb.entry.js +12 -12
- package/dist/esm/br-button_2.entry.js +7 -7
- package/dist/esm/br-card.entry.js +4 -4
- package/dist/esm/br-carousel-page.entry.js +3 -3
- package/dist/esm/br-carousel.entry.js +6 -6
- package/dist/esm/br-checkbox-group.entry.js +5 -5
- package/dist/esm/br-checkbox.entry.js +6 -6
- package/dist/esm/br-checkgroup.entry.js +2 -2
- package/dist/esm/br-collapse_2.entry.js +11 -11
- package/dist/esm/br-cookiebar-cookie.entry.js +3 -3
- package/dist/esm/br-cookiebar-group.entry.js +4 -4
- package/dist/esm/br-cookiebar-header.entry.js +3 -3
- package/dist/esm/br-cookiebar-link.entry.js +4 -4
- package/dist/esm/br-cookiebar-note-group.entry.js +3 -3
- package/dist/esm/br-cookiebar-note.entry.js +3 -3
- package/dist/esm/br-cookiebar.entry.js +6 -6
- package/dist/esm/br-crumb.entry.js +2 -2
- package/dist/esm/br-date-picker_3.entry.js +165 -78
- package/dist/esm/br-datetime-picker.entry.js +10 -27
- package/dist/esm/br-divider.entry.js +5 -5
- package/dist/esm/br-dropdown.entry.js +675 -0
- package/dist/esm/br-footer-category.entry.js +4 -4
- package/dist/esm/br-footer-item.entry.js +4 -4
- package/dist/esm/br-footer-legal.entry.js +3 -3
- package/dist/esm/br-footer-logo.entry.js +4 -4
- package/dist/esm/br-footer-social.entry.js +4 -4
- package/dist/esm/br-footer.entry.js +6 -6
- package/dist/esm/br-header-function.entry.js +4 -4
- package/dist/esm/br-header-link.entry.js +4 -4
- package/dist/esm/br-header-list.entry.js +4 -4
- package/dist/esm/br-header-logo.entry.js +4 -4
- package/dist/esm/br-header.entry.js +7 -7
- package/dist/esm/br-icon.entry.js +174 -160
- package/dist/esm/br-input_2.entry.js +1424 -0
- package/dist/esm/br-item.entry.js +5 -5
- package/dist/esm/br-link.entry.js +10 -10
- package/dist/esm/br-magic-button.entry.js +12 -13
- package/dist/esm/br-menu-group.entry.js +3 -3
- package/dist/esm/br-menu-header.entry.js +3 -3
- package/dist/esm/br-menu-info.entry.js +3 -3
- package/dist/esm/br-menu-item.entry.js +4 -4
- package/dist/esm/br-menu-link.entry.js +4 -4
- package/dist/esm/br-menu-list.entry.js +2 -2
- package/dist/esm/br-menu-logo.entry.js +3 -3
- package/dist/esm/br-menu-social.entry.js +3 -3
- package/dist/esm/br-menu.entry.js +6 -6
- package/dist/esm/br-modal.entry.js +3 -3
- package/dist/esm/br-notification-body.entry.js +3 -3
- package/dist/esm/br-notification-header.entry.js +3 -3
- package/dist/esm/br-notification-item.entry.js +4 -4
- package/dist/esm/br-notification.entry.js +5 -5
- package/dist/esm/br-pagination_2.entry.js +2575 -0
- package/dist/esm/br-radio-group.entry.js +6 -6
- package/dist/esm/br-radio.entry.js +6 -6
- package/dist/esm/br-scrim.entry.js +5 -5
- package/dist/esm/br-select-input_3.entry.js +50 -104
- package/dist/esm/br-sign-in.entry.js +5 -5
- package/dist/esm/br-skip-link-item.entry.js +2 -2
- package/dist/esm/br-skip-link.entry.js +4 -4
- package/dist/esm/br-skiplink-item.entry.js +4 -4
- package/dist/esm/br-slider.entry.js +5 -5
- package/dist/esm/br-step_2.entry.js +8 -8
- package/dist/esm/br-switch.entry.js +6 -6
- package/dist/esm/br-tab-item.entry.js +4 -4
- package/dist/esm/br-tab.entry.js +9 -9
- package/dist/esm/br-table-action_6.entry.js +1493 -0
- package/dist/esm/br-table-body.entry.js +4 -16
- package/dist/esm/br-table-header.entry.js +4 -16
- package/dist/esm/br-table.entry.js +2591 -408
- package/dist/esm/br-tag.entry.js +6 -6
- package/dist/esm/br-textarea.entry.js +5 -5
- package/dist/esm/br-tooltip.entry.js +6 -30
- package/dist/esm/br-upload.entry.js +6 -6
- package/dist/esm/br-wizard-panel.entry.js +3 -3
- package/dist/esm/br-wizard.entry.js +4 -4
- package/dist/esm/{datetime-picker-constants-DDc4sADe.js → datetime-picker-constants-1l4_-FEJ.js} +1 -1
- package/dist/esm/helpers-BNW9pAhl.js +26 -0
- package/dist/esm/{icon.utils-zlORkiHQ.js → icon.utils-CXDYKUBz.js} +1 -1
- package/dist/esm/{iconify-icon-D3usVJE2.js → iconify-icon-C_DC6oQW.js} +103 -57
- package/dist/esm/{index-CytVKoHT.js → index-BQRBKuY0.js} +64 -17
- package/dist/esm/{index-ConyRdJe.js → index-CwL52661.js} +34 -35
- package/dist/esm/index.js +2 -2
- package/dist/esm/{isValid-Bee0Uvqc.js → isValid-wU7S6MI2.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{props-D07GjR4_.js → props-BbxNgEcJ.js} +1 -1
- package/dist/esm/{slot-BIG-yees.js → slot-Bt01zQ7-.js} +1 -1
- package/dist/esm/table.utils-CtVdlcgI.js +706 -0
- package/dist/esm/webcomponents.js +3 -3
- package/dist/hydrate/index.js +6573 -3030
- package/dist/hydrate/index.mjs +6573 -3030
- package/dist/types/components/avatar/avatar.d.ts +20 -20
- package/dist/types/components/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +3 -11
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +30 -25
- package/dist/types/components/breadcrumb/crumb/crumb.d.ts +1 -12
- package/dist/types/components/button/button.d.ts +20 -20
- package/dist/types/components/card/card.d.ts +19 -21
- package/dist/types/components/carousel/carousel-page/carousel-page.d.ts +2 -12
- package/dist/types/components/carousel/carousel.d.ts +22 -29
- package/dist/types/components/checkbox/checkbox.d.ts +16 -22
- package/dist/types/components/checkbox-group/checkbox-group.d.ts +17 -18
- package/dist/types/components/checkgroup/checkgroup.d.ts +1 -13
- package/dist/types/components/collapse/collapse.d.ts +26 -22
- package/dist/types/components/cookiebar/cookiebar-cookie/cookiebar-cookie.d.ts +2 -15
- package/dist/types/components/cookiebar/cookiebar-group/cookiebar-group.d.ts +2 -15
- package/dist/types/components/cookiebar/cookiebar-header/cookiebar-header.d.ts +2 -15
- package/dist/types/components/cookiebar/cookiebar-link/cookiebar-link.d.ts +2 -14
- package/dist/types/components/cookiebar/cookiebar-note/cookiebar-note.d.ts +2 -13
- package/dist/types/components/cookiebar/cookiebar-note-group/cookiebar-note-group.d.ts +2 -13
- package/dist/types/components/cookiebar/cookiebar.d.ts +30 -25
- package/dist/types/components/datetime-picker/date-picker/date-picker-locale.d.ts +12 -4
- package/dist/types/components/datetime-picker/date-picker/date-picker.d.ts +57 -11
- package/dist/types/components/datetime-picker/datetime-input/datetime-input.d.ts +2 -12
- package/dist/types/components/datetime-picker/datetime-picker.d.ts +22 -26
- package/dist/types/components/datetime-picker/time-picker/time-picker.d.ts +3 -13
- package/dist/types/components/divider/divider.d.ts +14 -18
- package/dist/types/components/dropdown/dropdown.d.ts +21 -20
- package/dist/types/components/footer/footer-category/footer-category.d.ts +2 -15
- package/dist/types/components/footer/footer-item/footer-item.d.ts +2 -15
- package/dist/types/components/footer/footer-legal/footer-legal.d.ts +1 -15
- package/dist/types/components/footer/footer-logo/footer-logo.d.ts +2 -15
- package/dist/types/components/footer/footer-social/footer-social.d.ts +4 -17
- package/dist/types/components/footer/footer.d.ts +23 -27
- package/dist/types/components/header/header-function/header-function.d.ts +9 -13
- package/dist/types/components/header/header-link/header-link.d.ts +2 -15
- package/dist/types/components/header/header-list/header-list.d.ts +2 -15
- package/dist/types/components/header/header-logo/header-logo.d.ts +2 -15
- package/dist/types/components/header/header.d.ts +29 -26
- package/dist/types/components/icon/icon.d.ts +27 -22
- package/dist/types/components/icon/icon.utils.d.ts +1 -1
- package/dist/types/components/input/input.d.ts +46 -23
- package/dist/types/components/input/input.types.d.ts +18 -0
- package/dist/types/components/item/item.d.ts +17 -21
- package/dist/types/components/link/link.d.ts +18 -22
- package/dist/types/components/list/list.d.ts +16 -20
- package/dist/types/components/loading/loading.d.ts +16 -23
- package/dist/types/components/magic-button/magic-button.d.ts +17 -25
- package/dist/types/components/menu/menu-group/menu-group.d.ts +2 -15
- package/dist/types/components/menu/menu-header/menu-header.d.ts +2 -15
- package/dist/types/components/menu/menu-info/menu-info.d.ts +1 -14
- package/dist/types/components/menu/menu-item/menu-item.d.ts +2 -15
- package/dist/types/components/menu/menu-link/menu-link.d.ts +4 -16
- package/dist/types/components/menu/menu-list/menu-list.d.ts +2 -15
- package/dist/types/components/menu/menu-logo/menu-logo.d.ts +1 -14
- package/dist/types/components/menu/menu-social/menu-social.d.ts +4 -18
- package/dist/types/components/menu/menu.d.ts +25 -32
- package/dist/types/components/message/message.d.ts +21 -24
- package/dist/types/components/modal/modal.d.ts +18 -21
- package/dist/types/components/notification/notification-body/notification-body.d.ts +2 -12
- package/dist/types/components/notification/notification-header/notification-header.d.ts +2 -13
- package/dist/types/components/notification/notification-item/notification-item.d.ts +2 -15
- package/dist/types/components/notification/notification.d.ts +18 -27
- package/dist/types/components/pagination/pagination.d.ts +13 -21
- package/dist/types/components/radio/radio.d.ts +15 -18
- package/dist/types/components/radio-group/radio-group.d.ts +18 -18
- package/dist/types/components/scrim/scrim.d.ts +12 -15
- package/dist/types/components/select/select-input/select-input.d.ts +12 -14
- package/dist/types/components/select/select-list/select-list.d.ts +13 -12
- package/dist/types/components/select/select-option/select-option.d.ts +8 -11
- package/dist/types/components/select/select.d.ts +42 -94
- package/dist/types/components/sign-in/sign-in.d.ts +11 -15
- package/dist/types/components/skip-link/skip-link-item/skip-link-item-alias.d.ts +7 -3
- package/dist/types/components/skip-link/skip-link-item/skip-link-item.d.ts +4 -14
- package/dist/types/components/skip-link/skip-link.d.ts +17 -23
- package/dist/types/components/slider/slider.d.ts +18 -28
- package/dist/types/components/step/step-item/step-item.d.ts +2 -12
- package/dist/types/components/step/step.d.ts +15 -24
- package/dist/types/components/switch/switch.d.ts +14 -18
- package/dist/types/components/tab/tab-item/tab-item.d.ts +6 -16
- package/dist/types/components/tab/tab.d.ts +20 -27
- package/dist/types/components/table/table-action/table-action.d.ts +107 -0
- package/dist/types/components/table/table-bar/table-bar.d.ts +193 -0
- package/dist/types/components/table/table-body/table-body.d.ts +10 -25
- package/dist/types/components/table/table-cell/table-cell.d.ts +177 -46
- package/dist/types/components/table/table-footer/table-footer.d.ts +40 -0
- package/dist/types/components/table/table-footer/table-footer.types.d.ts +12 -0
- package/dist/types/components/table/table-header/table-header.d.ts +9 -25
- package/dist/types/components/table/table-header-cell/table-header-cell.d.ts +101 -62
- package/dist/types/components/table/table-row/table-row.d.ts +87 -38
- package/dist/types/components/table/table.actions-tooltip.d.ts +11 -0
- package/dist/types/components/table/{table-constants.d.ts → table.constants.d.ts} +50 -77
- package/dist/types/components/table/table.d.ts +601 -229
- package/dist/types/components/table/table.data.d.ts +78 -0
- package/dist/types/components/table/table.expansion.d.ts +65 -0
- package/dist/types/components/table/table.expansion.elements.d.ts +30 -0
- package/dist/types/components/table/table.grouping.d.ts +25 -0
- package/dist/types/components/table/table.header-height.d.ts +17 -0
- package/dist/types/components/table/table.keyboard.d.ts +53 -0
- package/dist/types/components/table/table.scroll-shadows.d.ts +11 -0
- package/dist/types/components/table/table.selection.d.ts +84 -0
- package/dist/types/components/table/table.selection.elements.d.ts +42 -0
- package/dist/types/components/table/table.tokens.d.ts +24 -0
- package/dist/types/components/table/table.types.d.ts +199 -0
- package/dist/types/components/table/table.utils.d.ts +52 -0
- package/dist/types/components/table/table.virtual-list.d.ts +96 -0
- package/dist/types/components/tag/tag.d.ts +15 -24
- package/dist/types/components/textarea/textarea.d.ts +13 -21
- package/dist/types/components/tooltip/tooltip.d.ts +12 -18
- package/dist/types/components/upload/upload.d.ts +20 -27
- package/dist/types/components/wizard/wizard-panel/wizard-panel.d.ts +2 -12
- package/dist/types/components/wizard/wizard.d.ts +21 -25
- package/dist/types/components.d.ts +4646 -5087
- package/dist/webcomponents/index.esm.js +1 -1
- package/dist/webcomponents/{p-6f1a4fbe.entry.js → p-07e80bf8.entry.js} +1 -1
- package/dist/webcomponents/p-10d81622.entry.js +5 -0
- package/dist/webcomponents/p-12d5f533.entry.js +5 -0
- package/dist/webcomponents/p-15699e8a.entry.js +5 -0
- package/dist/webcomponents/{p-7fda8b89.entry.js → p-15e2f5cc.entry.js} +1 -1
- package/dist/webcomponents/{p-198aa844.entry.js → p-16d27d5c.entry.js} +1 -1
- package/dist/webcomponents/p-18d3fab8.entry.js +5 -0
- package/dist/webcomponents/{p-DDc4sADe.js → p-1l4_-FEJ.js} +1 -1
- package/dist/webcomponents/p-23c916d9.entry.js +5 -0
- package/dist/webcomponents/p-2aee69fd.entry.js +5 -0
- package/dist/webcomponents/p-2d3db296.entry.js +5 -0
- package/dist/webcomponents/p-2ed6afdd.entry.js +5 -0
- package/dist/webcomponents/{p-42b60169.entry.js → p-30c865e6.entry.js} +1 -1
- package/dist/webcomponents/p-32afb78c.entry.js +5 -0
- package/dist/webcomponents/p-33d24cbd.entry.js +5 -0
- package/dist/webcomponents/p-35d63edd.entry.js +5 -0
- package/dist/webcomponents/p-3b1ff55e.entry.js +5 -0
- package/dist/webcomponents/p-3c7246cf.entry.js +5 -0
- package/dist/webcomponents/{p-6a293be8.entry.js → p-407e7b69.entry.js} +1 -1
- package/dist/webcomponents/p-41b12e3c.entry.js +5 -0
- package/dist/webcomponents/p-47adc17f.entry.js +5 -0
- package/dist/webcomponents/{p-18cf093a.entry.js → p-48fc8e56.entry.js} +1 -1
- package/dist/webcomponents/p-4a44c8b8.entry.js +5 -0
- package/dist/webcomponents/{p-ac68355e.entry.js → p-4b0f3701.entry.js} +1 -1
- package/dist/webcomponents/p-4b66200c.entry.js +5 -0
- package/dist/webcomponents/{p-5a7c2031.entry.js → p-4c0a1c05.entry.js} +1 -1
- package/dist/webcomponents/p-4c72d706.entry.js +5 -0
- package/dist/webcomponents/p-505173e0.entry.js +5 -0
- package/dist/webcomponents/p-50caea68.entry.js +5 -0
- package/dist/webcomponents/p-5419fd2c.entry.js +5 -0
- package/dist/webcomponents/{p-20477061.entry.js → p-5693e0e7.entry.js} +1 -1
- package/dist/webcomponents/p-58247764.entry.js +5 -0
- package/dist/webcomponents/p-5d0f4851.entry.js +5 -0
- package/dist/webcomponents/p-60c949c8.entry.js +5 -0
- package/dist/webcomponents/p-61b84035.entry.js +5 -0
- package/dist/webcomponents/p-62a74e0a.entry.js +5 -0
- package/dist/webcomponents/p-6450913e.entry.js +5 -0
- package/dist/webcomponents/p-66c8b8d9.entry.js +5 -0
- package/dist/webcomponents/{p-b55425b7.entry.js → p-67281ef1.entry.js} +1 -1
- package/dist/webcomponents/{p-0fc112fc.entry.js → p-6e128c7a.entry.js} +1 -1
- package/dist/webcomponents/p-725e92ab.entry.js +5 -0
- package/dist/webcomponents/{p-09c79c1d.entry.js → p-74726f20.entry.js} +1 -1
- package/dist/webcomponents/p-75bd655b.entry.js +5 -0
- package/dist/webcomponents/p-7bf78e48.entry.js +5 -0
- package/dist/webcomponents/p-7cc28ecf.entry.js +5 -0
- package/dist/webcomponents/p-7ec01a99.entry.js +5 -0
- package/dist/webcomponents/{p-2c8595d3.entry.js → p-7f17dbca.entry.js} +1 -1
- package/dist/webcomponents/p-8120f3ce.entry.js +5 -0
- package/dist/webcomponents/p-8ded7870.entry.js +5 -0
- package/dist/webcomponents/p-9ab989d1.entry.js +5 -0
- package/dist/webcomponents/p-9be642ff.entry.js +5 -0
- package/dist/webcomponents/p-9d41995a.entry.js +5 -0
- package/dist/webcomponents/p-C_DC6oQW.js +16 -0
- package/dist/webcomponents/{p-EbtQZm5s.js → p-CjVabz-h.js} +1 -1
- package/dist/webcomponents/{p-fOJu6uZR.js → p-CpE_G6IZ.js} +1 -1
- package/dist/webcomponents/{p-ConyRdJe.js → p-CwL52661.js} +2 -2
- package/dist/webcomponents/p-DnwERaeQ.js +5 -0
- package/dist/webcomponents/p-Zk91ebVT.js +5 -0
- package/dist/webcomponents/p-_BMaB_68.js +5 -0
- package/dist/webcomponents/p-a150b61d.entry.js +5 -0
- package/dist/webcomponents/p-a264acf6.entry.js +5 -0
- package/dist/webcomponents/p-a5616523.entry.js +5 -0
- package/dist/webcomponents/p-ae3dfb9c.entry.js +5 -0
- package/dist/webcomponents/p-b1aeb805.entry.js +5 -0
- package/dist/webcomponents/p-b8eea3ef.entry.js +5 -0
- package/dist/webcomponents/p-c6952f8d.entry.js +5 -0
- package/dist/webcomponents/p-c743e5c5.entry.js +5 -0
- package/dist/webcomponents/p-d0c659c3.entry.js +5 -0
- package/dist/webcomponents/p-d3dec923.entry.js +5 -0
- package/dist/webcomponents/{p-31a4694a.entry.js → p-d5405bbe.entry.js} +1 -1
- package/dist/webcomponents/{p-794b701b.entry.js → p-d6d3a552.entry.js} +1 -1
- package/dist/webcomponents/p-dab66328.entry.js +5 -0
- package/dist/webcomponents/{p-8116ee93.entry.js → p-db02533d.entry.js} +1 -1
- package/dist/webcomponents/p-dda22999.entry.js +5 -0
- package/dist/webcomponents/p-e2a46f44.entry.js +5 -0
- package/dist/webcomponents/{p-67774920.entry.js → p-e3680ff8.entry.js} +1 -1
- package/dist/webcomponents/p-e5b9652d.entry.js +5 -0
- package/dist/webcomponents/{p-fb76b1e0.entry.js → p-e7f02302.entry.js} +1 -1
- package/dist/webcomponents/p-f0720e23.entry.js +5 -0
- package/dist/webcomponents/p-f244009d.entry.js +5 -0
- package/dist/webcomponents/p-f32c40ee.entry.js +5 -0
- package/dist/webcomponents/p-f697abbd.entry.js +5 -0
- package/dist/webcomponents/p-f7ed35ef.entry.js +5 -0
- package/dist/webcomponents/p-f8576e0a.entry.js +5 -0
- package/dist/webcomponents/p-fcc62731.entry.js +5 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/br-dropdown_2.cjs.entry.js +0 -2299
- package/dist/cjs/br-input.cjs.entry.js +0 -715
- package/dist/cjs/br-loading.cjs.entry.js +0 -567
- package/dist/cjs/br-pagination.cjs.entry.js +0 -916
- package/dist/cjs/br-table-cell.cjs.entry.js +0 -201
- package/dist/cjs/br-table-header-cell.cjs.entry.js +0 -189
- package/dist/cjs/br-table-row.cjs.entry.js +0 -95
- package/dist/cjs/table-constants-BOPSay0B.js +0 -183
- package/dist/collection/components/table/table-tokens.js +0 -50
- package/dist/collection/components/table/table-utils.js +0 -44
- package/dist/collection/pages/components/select/remote.js +0 -33
- package/dist/collection/pages/components/select/virtualized.js +0 -13
- package/dist/components/p-5h-W9_JR.js +0 -5
- package/dist/components/p-848QkYoM.js +0 -5
- package/dist/components/p-BFHvuEnN.js +0 -5
- package/dist/components/p-BH6QYnAr.js +0 -5
- package/dist/components/p-BcW8O6h2.js +0 -5
- package/dist/components/p-BicHMcSS.js +0 -5
- package/dist/components/p-Bs7iRQTG.js +0 -5
- package/dist/components/p-Bvrw9yWR.js +0 -5
- package/dist/components/p-BzQFMh9j.js +0 -5
- package/dist/components/p-CBHd0-fF.js +0 -5
- package/dist/components/p-CCPHCJjw.js +0 -5
- package/dist/components/p-CXMwM9m4.js +0 -5
- package/dist/components/p-CeNELttN.js +0 -5
- package/dist/components/p-CjtmJTLO.js +0 -5
- package/dist/components/p-D3usVJE2.js +0 -16
- package/dist/components/p-DDu3JV_r.js +0 -5
- package/dist/components/p-DFWqyfUe.js +0 -5
- package/dist/components/p-DL6xuxGG.js +0 -5
- package/dist/components/p-DOX9Uwk1.js +0 -5
- package/dist/components/p-DUq7uT2-.js +0 -5
- package/dist/components/p-Devw08cc.js +0 -5
- package/dist/components/p-Di96UxvH.js +0 -5
- package/dist/components/p-DiLI514I.js +0 -5
- package/dist/components/p-Dp3MsSXu.js +0 -5
- package/dist/components/p-DuLHFTpa.js +0 -5
- package/dist/components/p-DusornQ0.js +0 -5
- package/dist/components/p-OQpiDEK9.js +0 -5
- package/dist/components/p-XW6Hp_Jk.js +0 -5
- package/dist/esm/br-dropdown_2.entry.js +0 -2296
- package/dist/esm/br-input.entry.js +0 -713
- package/dist/esm/br-loading.entry.js +0 -565
- package/dist/esm/br-pagination.entry.js +0 -914
- package/dist/esm/br-table-cell.entry.js +0 -199
- package/dist/esm/br-table-header-cell.entry.js +0 -187
- package/dist/esm/br-table-row.entry.js +0 -93
- package/dist/esm/table-constants-CXMwM9m4.js +0 -170
- package/dist/types/components/table/table-tokens.d.ts +0 -46
- package/dist/types/components/table/table-types.d.ts +0 -107
- package/dist/types/components/table/table-utils.d.ts +0 -47
- package/dist/webcomponents/p-01801ac1.entry.js +0 -5
- package/dist/webcomponents/p-05b459f2.entry.js +0 -5
- package/dist/webcomponents/p-08ac6f09.entry.js +0 -5
- package/dist/webcomponents/p-09817344.entry.js +0 -5
- package/dist/webcomponents/p-13babfc4.entry.js +0 -5
- package/dist/webcomponents/p-15022ab7.entry.js +0 -5
- package/dist/webcomponents/p-172d42c2.entry.js +0 -5
- package/dist/webcomponents/p-1ba60d13.entry.js +0 -5
- package/dist/webcomponents/p-1bb96641.entry.js +0 -5
- package/dist/webcomponents/p-21feda62.entry.js +0 -5
- package/dist/webcomponents/p-23a5cfd7.entry.js +0 -5
- package/dist/webcomponents/p-32ea6342.entry.js +0 -5
- package/dist/webcomponents/p-3658adcf.entry.js +0 -5
- package/dist/webcomponents/p-37914e63.entry.js +0 -5
- package/dist/webcomponents/p-3b0dd0ff.entry.js +0 -5
- package/dist/webcomponents/p-42c9c6c5.entry.js +0 -5
- package/dist/webcomponents/p-473561f2.entry.js +0 -5
- package/dist/webcomponents/p-47c490ef.entry.js +0 -5
- package/dist/webcomponents/p-4b01c60f.entry.js +0 -5
- package/dist/webcomponents/p-5a5ed7d8.entry.js +0 -5
- package/dist/webcomponents/p-609cf652.entry.js +0 -5
- package/dist/webcomponents/p-614683d9.entry.js +0 -5
- package/dist/webcomponents/p-67605757.entry.js +0 -5
- package/dist/webcomponents/p-67d62559.entry.js +0 -5
- package/dist/webcomponents/p-695dbeb0.entry.js +0 -5
- package/dist/webcomponents/p-7352d459.entry.js +0 -5
- package/dist/webcomponents/p-745213f7.entry.js +0 -5
- package/dist/webcomponents/p-7ee564a1.entry.js +0 -5
- package/dist/webcomponents/p-821341dc.entry.js +0 -5
- package/dist/webcomponents/p-8aa6f07c.entry.js +0 -5
- package/dist/webcomponents/p-8ddf3ce3.entry.js +0 -5
- package/dist/webcomponents/p-95f3c44a.entry.js +0 -5
- package/dist/webcomponents/p-96dbb585.entry.js +0 -5
- package/dist/webcomponents/p-9815ab95.entry.js +0 -5
- package/dist/webcomponents/p-9e0324a7.entry.js +0 -5
- package/dist/webcomponents/p-CJipT0in.js +0 -5
- package/dist/webcomponents/p-CXMwM9m4.js +0 -5
- package/dist/webcomponents/p-D3usVJE2.js +0 -16
- package/dist/webcomponents/p-a038be16.entry.js +0 -5
- package/dist/webcomponents/p-a32d17cb.entry.js +0 -5
- package/dist/webcomponents/p-a46f068e.entry.js +0 -5
- package/dist/webcomponents/p-a89b684d.entry.js +0 -5
- package/dist/webcomponents/p-af888d13.entry.js +0 -5
- package/dist/webcomponents/p-b0124459.entry.js +0 -5
- package/dist/webcomponents/p-b063c12f.entry.js +0 -5
- package/dist/webcomponents/p-b07bfdc5.entry.js +0 -5
- package/dist/webcomponents/p-b5d25332.entry.js +0 -5
- package/dist/webcomponents/p-b609b464.entry.js +0 -5
- package/dist/webcomponents/p-b66ab52d.entry.js +0 -5
- package/dist/webcomponents/p-b8d4ace3.entry.js +0 -5
- package/dist/webcomponents/p-c717c745.entry.js +0 -5
- package/dist/webcomponents/p-ce3d689c.entry.js +0 -5
- package/dist/webcomponents/p-d08b6266.entry.js +0 -5
- package/dist/webcomponents/p-d6165aa0.entry.js +0 -5
- package/dist/webcomponents/p-dacb7e2c.entry.js +0 -5
- package/dist/webcomponents/p-db309a11.entry.js +0 -5
- package/dist/webcomponents/p-dc23cb2e.entry.js +0 -5
- package/dist/webcomponents/p-e241caf3.entry.js +0 -5
- package/dist/webcomponents/p-e661c024.entry.js +0 -5
- package/dist/webcomponents/p-e7107869.entry.js +0 -5
- package/dist/webcomponents/p-eb94199d.entry.js +0 -5
- package/dist/webcomponents/p-f8993ae4.entry.js +0 -5
- package/dist/webcomponents/p-f99d8c9c.entry.js +0 -5
- package/dist/webcomponents/p-fdcb54a3.entry.js +0 -5
- package/dist/webcomponents/p-fed02286.entry.js +0 -5
- /package/dist/collection/components/table/{table-types.js → table-footer/table-footer.types.js} +0 -0
- /package/dist/components/{p-5z6jgH1D.js → p-BNckUhK6.js} +0 -0
- /package/dist/webcomponents/{p-BIG-yees.js → p-Bt01zQ7-.js} +0 -0
- /package/dist/webcomponents/{p-zlORkiHQ.js → p-CXDYKUBz.js} +0 -0
|
@@ -1,2296 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Construído por SERPRO
|
|
3
|
-
* © https://serpro.gov.br/ - MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-ConyRdJe.js';
|
|
6
|
-
import { l as listenForExternalBlockingSurface } from './floating-surface-dismiss-BWXfdbQH.js';
|
|
7
|
-
import { F as FloatingUIManager } from './floating-ui-CskvaxD5.js';
|
|
8
|
-
import { g as generateUniqueId } from './id-BeJxz5TQ.js';
|
|
9
|
-
import { i as isNil } from './isNil-B-qLmYZC.js';
|
|
10
|
-
import { g as getScrollBehavior } from './motion-DWhzxlCx.js';
|
|
11
|
-
import { f as findComposedOwner, c as createMicrotaskReconciler } from './ownership-CDtFCbKp.js';
|
|
12
|
-
import { r as resolveAllowedPropValue, b as resolveIntegerPropValue, a as resolveDensity, c as resolveNumberPropValue } from './props-D07GjR4_.js';
|
|
13
|
-
import { d as dispatchNativeFormEvent } from './event-6Da1SZ3J.js';
|
|
14
|
-
import { i as isFormControlDisabled, g as getFormValidationState, s as safeSetFormValue, e as syncNativeFormValidity, r as resolveFormValidator } from './validator-BkWWrDEr.js';
|
|
15
|
-
import { r as reportInvalidPropValue } from './prop-warning-BlGV-x0w.js';
|
|
16
|
-
import { h as hasNamedLightDomSlot, a as hasAssignedSlotContent } from './slot-BIG-yees.js';
|
|
17
|
-
import { S as SELECT_ALL_OPTION_VALUE, t as transitionAllSelection, a as transitionSelection, f as filterSelectOptions } from './select.utils-BYsh2ZdE.js';
|
|
18
|
-
import './floating-ui.dom-D9Zo6FlV.js';
|
|
19
|
-
|
|
20
|
-
const dropdownCss = () => `*,*::before,*::after{box-sizing:border-box}:host{line-height:var(--font-line-height-medium);-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}main{display:block}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace;font-size:1em}a{background-color:rgba(0,0,0,0)}b,strong{font-weight:bolder}small{font-size:80%}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:var(--font-line-height-medium);margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{appearance:none}::-webkit-file-upload-button{appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.d-none{display:none !important}@media (min-width: 576px){.d-sm-block{display:block !important}.d-sm-flex{display:flex !important}}[data-toggle=dropdown]+*{position:absolute}.dropdown{position:relative}.dropdown [data-toggle=dropdown]+*{box-shadow:var(--surface-shadow-sm);left:0;position:absolute;top:100%}.dropdown>.br-notification{left:auto;right:0}.dropdown .br-item{--color:var(--color-light);--color-rgb:var(--color-light-rgb);--text-color:var(--color-light);--interactive:var(--interactive-light);--interactive-rgb:var(--color-rgb);--visited:var(--visited-light);--hover:var(--hover-light);--pressed:var(--pressed-light);--focus-color:var(--focus-color-light);--focus:var(--focus-color-light);--item-padding-y:var(--spacing-scale-2x);background-color:var(--background-light);color:var(--color)}.dropdown .br-item:not(:last-child){border-bottom:1px solid var(--border-color)}.dropdown .br-item.selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}.justify-content-start{justify-content:flex-start !important}.justify-content-end{justify-content:flex-end !important}.justify-content-center{justify-content:center !important}.align-items-center{align-items:center !important}.col,[class*=col-]{padding-left:calc(var(--grid-gutter)*.5);padding-right:calc(var(--grid-gutter)*.5);width:100%}.col{flex:1 0 0%;min-width:8.3333333333%}.col-auto{flex:0 0 auto;width:auto}.col-2{flex-basis:16.6666666667%;max-width:16.6666666667%}.container,.container-fluid,.container-lg{--grid-margin:var(--grid-portrait-margin);--grid-maxwidth:var(--grid-portrait-maxwidth);margin-left:auto;margin-right:auto;max-width:var(--grid-maxwidth);padding-left:var(--grid-margin);padding-right:var(--grid-margin);width:100%}.row{--grid-gutter:var(--grid-portrait-gutter);display:flex;flex-wrap:wrap;margin-left:calc(var(--grid-gutter)*-0.5);margin-right:calc(var(--grid-gutter)*-0.5)}@media (min-width: 576px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-sm) - var(--grid-tablet-margin))}.col-sm-4{flex-basis:33.3333333333%;max-width:33.3333333333%}}@media (min-width: 992px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-md) - var(--grid-tablet-margin))}}@media (min-width: 1280px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-desktop-margin)}.row{--grid-gutter:var(--grid-desktop-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-lg) - var(--grid-desktop-margin))}.col-lg-3{flex-basis:25%;max-width:25%}}@media (min-width: 1600px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tv-margin)}.row{--grid-gutter:var(--grid-tv-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-xl) - var(--grid-tv-margin))}}.ease{animation-timing-function:cubic-bezier(0.25, 0.1, 0.25, 1)}.ease-out{animation-timing-function:cubic-bezier(0, 0, 0.58, 1)}.ease-in-out{animation-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}.fast{animation-duration:var(--duration-fast)}.slow{animation-duration:var(--duration-slow)}.mt-1{margin-top:var(--spacing-scale-half) !important}.mr-1{margin-right:var(--spacing-scale-half) !important}.mb-1{margin-bottom:var(--spacing-scale-half) !important}.ml-1{margin-left:var(--spacing-scale-half) !important}.mx-3{margin-left:var(--spacing-scale-2x) !important;margin-right:var(--spacing-scale-2x) !important}.mb-4{margin-bottom:var(--spacing-scale-3x) !important}.ml-auto{margin-left:auto !important}.pt-half{padding-top:var(--spacing-scale-half) !important}@media (min-width: 576px){.ml-sm-0{margin-left:var(--spacing-scale-default) !important}}.highlight{background:var(--status-highlight-background) linear-gradient(var(--status-highlight-overlay), var(--status-highlight-overlay));color:var(--status-highlight-text);padding:0 var(--spacing-scale-half)}[disabled],.disabled{cursor:not-allowed;opacity:var(--disabled)}[disabled] *,.disabled *{pointer-events:none}fieldset[disabled]{opacity:1}.text-center{text-align:center !important}.text-right{text-align:right !important}.text-nowrap{white-space:nowrap !important}.text-uppercase{text-transform:uppercase !important}.text-bold{font-weight:700 !important}.text-base{font-size:var(--font-size-scale-base) !important}.text-down-01{font-size:var(--font-size-scale-down-01) !important}@media (min-width: 576px){.text-sm-center{text-align:center !important}.text-sm-left{text-align:left !important}.text-sm-right{text-align:right !important}}p{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-2x);margin-top:0}p a{text-decoration:underline}@media (min-width: 576px){p{font-size:var(--font-size-scale-up-01)}}a{--focus-offset:var(--spacing-scale-half)}a:focus{outline:none}a.focus-visible,a:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}a:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}a:not(:disabled):active{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--pressed)), rgba(var(--interactive-rgb), var(--pressed)))}a{color:var(--interactive);text-decoration:none}.main-content a{text-decoration:underline}button{cursor:pointer}img{max-width:100%;vertical-align:middle}h2,.h2{color:var(--color);font-size:var(--font-size-scale-up-03);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2xh);margin-top:var(--spacing-scale-3xh);padding-bottom:var(--spacing-scale-2xh)}@media (min-width: 576px){.h2,h2{font-size:var(--font-size-scale-up-05);font-weight:var(--font-weight-regular)}}ul,ol{margin-bottom:var(--spacing-scale-2x);margin-top:0;padding:0 0 0 var(--spacing-scale-5x)}table{--table-background:var(--background);--table-color:var(--color);--table-border-color:var(--gray-20);--table-border-style:solid;--table-border-width:1px;--table-hover:var(--color-rgb);--table-padding:var(--spacing-scale-3x);--table-font-weight:var(--font-weight-medium);--table-th-background:var(--background-alternative);--table-th-font-weight:var(--font-weight-semi-bold);--table-row-size:var(--spacing-scale-2x);border-collapse:collapse;width:100%}tr.selected,tr.is-selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}label,.label{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half)}fieldset,.fieldset{border:var(--surface-width-none);margin-bottom:var(--spacing-scale-5x);margin-top:0;padding:0}legend,.legend{color:var(--color);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2x);margin-top:var(--spacing-scale-2x)}::placeholder,.placeholder{color:var(--color-light);font-size:var(--font-size-scale-base);font-style:italic;font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half);margin-top:var(--spacing-scale-half);opacity:1}input,textarea,.input{color:var(--color-light);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-half)}pre,.pre{background:var(--gray-5);margin:var(--spacing-scale-2x) 0 var(--spacing-scale-4x);padding:var(--spacing-scale-2x)}*[data-toggle=collapse]:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}*[data-toggle=collapse]:focus{outline:none}*[data-toggle=collapse].focus-visible,*[data-toggle=collapse]:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}@media (prefers-reduced-motion: reduce){:host,:host::before,:host::after,:host *,:host *::before,:host *::after{animation:none !important;scroll-behavior:auto !important;transition:none !important}}:host-context([data-wbc-reduced-motion=true])::before,:host-context([data-wbc-reduced-motion=true])::after,:host-context([data-wbc-reduced-motion=true]) *,:host-context([data-wbc-reduced-motion=true]) *::before,:host-context([data-wbc-reduced-motion=true]) *::after{animation:none !important;scroll-behavior:auto !important;transition:none !important}:host{display:inline-block;position:relative}:host #trigger{display:inline-flex;align-items:center;cursor:pointer;outline:none}:host [part=trigger-arrow]{margin-left:var(--spacing-scale-half)}:host #trigger::slotted([slot=trigger]):focus:focus{outline:none}:host #trigger::slotted([slot=trigger]):focus.focus-visible,:host #trigger::slotted([slot=trigger]):focus:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}:host ::slotted([slot=target] *:focus):focus{outline:none}:host ::slotted([slot=target] *:focus).focus-visible,:host ::slotted([slot=target] *:focus):focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}:host #target{display:none;visibility:hidden;pointer-events:none;opacity:0;transition:none}@media (prefers-reduced-motion: no-preference){:host #target{transition:opacity var(--duration-fast, 300ms) var(--animation-ease-out, ease-out)}}:host #target{position:absolute;z-index:var(--z-index-layer-1);box-shadow:var(--surface-shadow-sm);border-radius:0}:host #target:focus:focus{outline:none}:host #target:focus.focus-visible,:host #target:focus:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}:host([match-trigger-width]) #target{box-sizing:border-box}:host([arrow-position=left]) [part=trigger-arrow]{margin-left:0;margin-right:var(--spacing-scale-half)}:host([is-open]) #target{display:block;width:max-content}:host([is-open]) #target[data-positioned=true]{visibility:visible;pointer-events:auto;opacity:1}@media (max-width: 575px){:host([is-open]:not([match-trigger-width])) #target{width:var(--dropdown-target-width, 100vw) !important;max-width:var(--dropdown-target-max-width, 100vw) !important}}`;
|
|
21
|
-
|
|
22
|
-
const Dropdown = class {
|
|
23
|
-
constructor(hostRef) {
|
|
24
|
-
registerInstance(this, hostRef);
|
|
25
|
-
this.brDidOpen = createEvent(this, "brDidOpen", 7);
|
|
26
|
-
this.brDidClose = createEvent(this, "brDidClose", 7);
|
|
27
|
-
this.brDropdownChange = createEvent(this, "brDropdownChange", 7);
|
|
28
|
-
this.brDropdownOpenChange = createEvent(this, "brDropdownOpenChange", 6);
|
|
29
|
-
/**
|
|
30
|
-
* Identificador único do componente.
|
|
31
|
-
* Quando omitido, um valor é gerado automaticamente.
|
|
32
|
-
*
|
|
33
|
-
* > **Padrão:** valor único gerado por generateUniqueId().
|
|
34
|
-
*
|
|
35
|
-
* > **Uso compartilhado:** mantenha esta descrição idêntica em todos os componentes que usam `customId`.
|
|
36
|
-
*/
|
|
37
|
-
this.customId = generateUniqueId();
|
|
38
|
-
/**
|
|
39
|
-
* Indica se o dropdown está aberto ou fechado.
|
|
40
|
-
* Esta propriedade é refletida no DOM e pode ser alterada externamente.
|
|
41
|
-
* O valor padrão é falso (fechado).
|
|
42
|
-
*/
|
|
43
|
-
this.isOpen = false;
|
|
44
|
-
/**
|
|
45
|
-
* Define o posicionamento do target (alvo) em relação ao trigger (acionador).
|
|
46
|
-
*/
|
|
47
|
-
this.placement = 'bottom-start';
|
|
48
|
-
/**
|
|
49
|
-
* Exibe uma seta ao lado do elemento acionador.
|
|
50
|
-
* O valor padrão é falso para preservar a apresentação dos triggers existentes.
|
|
51
|
-
*/
|
|
52
|
-
this.showArrow = false;
|
|
53
|
-
/**
|
|
54
|
-
* Define o posicionamento da seta ('left' ou 'right') em relação ao elemento acionador.
|
|
55
|
-
* O valor padrão é 'right'.
|
|
56
|
-
*/
|
|
57
|
-
this.arrowPosition = 'right';
|
|
58
|
-
/**
|
|
59
|
-
* Define se o dropdown deve permanecer aberto quando outro dropdown é aberto.
|
|
60
|
-
* Quando definido como false (padrão), o dropdown será fechado automaticamente quando outro dropdown for aberto.
|
|
61
|
-
* Quando definido como true, o dropdown permanecerá aberto mesmo quando outro dropdown for aberto.
|
|
62
|
-
*/
|
|
63
|
-
this.preventAutoDismiss = false;
|
|
64
|
-
/**
|
|
65
|
-
* Faz o painel acompanhar a largura do acionador enquanto estiver aberto.
|
|
66
|
-
* O valor padrão `false` preserva a largura determinada pelo conteúdo.
|
|
67
|
-
*/
|
|
68
|
-
this.matchTriggerWidth = false;
|
|
69
|
-
/**
|
|
70
|
-
* Define o z-index do elemento target (alvo) do dropdown.
|
|
71
|
-
* Permite customizar a ordem de sobreposição do painel dropdown em relação aos demais elementos da página.
|
|
72
|
-
* O valor padrão utiliza a variável CSS do design system: var(--z-index-layer-1).
|
|
73
|
-
*/
|
|
74
|
-
this.targetZIndex = 'var(--z-index-layer-1)';
|
|
75
|
-
/**
|
|
76
|
-
* Desabilita a interação com o componente.
|
|
77
|
-
*
|
|
78
|
-
* > **Uso compartilhado:** mantenha esta descrição idêntica em todos os componentes que usam `disabled`.
|
|
79
|
-
*/
|
|
80
|
-
this.disabled = false;
|
|
81
|
-
/**
|
|
82
|
-
* Método chamado sempre que a propriedade `isOpen` muda.
|
|
83
|
-
* Emite um evento com o novo estado do dropdown.
|
|
84
|
-
*/
|
|
85
|
-
this.pendingOpenInit = false;
|
|
86
|
-
this.clickListenerAttached = false;
|
|
87
|
-
this.semanticTriggerElement = null;
|
|
88
|
-
this.targetElement = null;
|
|
89
|
-
this.dropdownItems = [];
|
|
90
|
-
this.dropdownLinks = [];
|
|
91
|
-
this.focusableElement = null;
|
|
92
|
-
this.triggerKeydownHandler = (event) => {
|
|
93
|
-
if (this.disabled)
|
|
94
|
-
return;
|
|
95
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
96
|
-
event.preventDefault();
|
|
97
|
-
this.handleTriggerBehavior(event);
|
|
98
|
-
}
|
|
99
|
-
else if (event.key === 'Escape') {
|
|
100
|
-
event.preventDefault();
|
|
101
|
-
this.hide();
|
|
102
|
-
this.focusOnTriggerElement();
|
|
103
|
-
}
|
|
104
|
-
else if (event.key === 'ArrowDown' && this.isOpen) {
|
|
105
|
-
event.preventDefault();
|
|
106
|
-
this.initializeDropdownItems();
|
|
107
|
-
const [firstFocusable] = this.getTabCycle();
|
|
108
|
-
if (firstFocusable)
|
|
109
|
-
this.focusOnElement(firstFocusable);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
this.handleTriggerSlotChange = () => {
|
|
113
|
-
this.syncTriggerAccessibility();
|
|
114
|
-
this.syncTriggerAccessibilityAfterHydration();
|
|
115
|
-
};
|
|
116
|
-
this.targetKeydownHandler = (event) => {
|
|
117
|
-
if (event.key === 'Escape') {
|
|
118
|
-
event.preventDefault();
|
|
119
|
-
this.hide();
|
|
120
|
-
this.focusOnTriggerElement();
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Alterna o estado do dropdown entre aberto e fechado.
|
|
125
|
-
*/
|
|
126
|
-
this.toggle = (event) => {
|
|
127
|
-
if (this.disabled)
|
|
128
|
-
return;
|
|
129
|
-
event.stopPropagation();
|
|
130
|
-
this.isOpen = !this.isOpen;
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Handler para eventos de keydown nos itens não-link.
|
|
134
|
-
* Setas, Home e End navegam entre estes itens; Tab percorre o ciclo único
|
|
135
|
-
* (links e itens na ordem do documento).
|
|
136
|
-
*/
|
|
137
|
-
this.handleItemKeydown = (event) => {
|
|
138
|
-
const item = event.currentTarget;
|
|
139
|
-
const key = event.key;
|
|
140
|
-
const currentIndex = this.dropdownItems.indexOf(item);
|
|
141
|
-
const lastIndex = this.dropdownItems.length - 1;
|
|
142
|
-
switch (key) {
|
|
143
|
-
case 'ArrowUp':
|
|
144
|
-
event.preventDefault();
|
|
145
|
-
if (currentIndex <= 0) {
|
|
146
|
-
this.focusOnElement(this.dropdownItems[lastIndex]);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
this.focusOnElement(this.dropdownItems[currentIndex - 1]);
|
|
150
|
-
}
|
|
151
|
-
break;
|
|
152
|
-
case 'ArrowDown':
|
|
153
|
-
event.preventDefault();
|
|
154
|
-
if (currentIndex >= lastIndex) {
|
|
155
|
-
this.focusOnElement(this.dropdownItems[0]);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
this.focusOnElement(this.dropdownItems[currentIndex + 1]);
|
|
159
|
-
}
|
|
160
|
-
break;
|
|
161
|
-
case 'Home':
|
|
162
|
-
event.preventDefault();
|
|
163
|
-
this.focusOnElement(this.dropdownItems[0]);
|
|
164
|
-
break;
|
|
165
|
-
case 'End':
|
|
166
|
-
event.preventDefault();
|
|
167
|
-
this.focusOnElement(this.dropdownItems[lastIndex]);
|
|
168
|
-
break;
|
|
169
|
-
case 'Enter':
|
|
170
|
-
case ' ':
|
|
171
|
-
event.preventDefault();
|
|
172
|
-
item.click();
|
|
173
|
-
this.hide();
|
|
174
|
-
this.focusOnTriggerElement();
|
|
175
|
-
break;
|
|
176
|
-
case 'Tab':
|
|
177
|
-
event.preventDefault();
|
|
178
|
-
this.cycleTabFocus(item, event.shiftKey);
|
|
179
|
-
break;
|
|
180
|
-
case 'Escape':
|
|
181
|
-
event.preventDefault();
|
|
182
|
-
this.hide();
|
|
183
|
-
this.focusOnTriggerElement();
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Handler específico para links. Tab percorre o ciclo único (links e itens).
|
|
189
|
-
*/
|
|
190
|
-
this.handleLinkKeydown = (event) => {
|
|
191
|
-
const link = event.currentTarget;
|
|
192
|
-
const key = event.key;
|
|
193
|
-
switch (key) {
|
|
194
|
-
case 'ArrowUp':
|
|
195
|
-
case 'ArrowDown':
|
|
196
|
-
case 'Home':
|
|
197
|
-
case 'End':
|
|
198
|
-
event.preventDefault();
|
|
199
|
-
event.stopPropagation();
|
|
200
|
-
break;
|
|
201
|
-
case 'Tab':
|
|
202
|
-
event.preventDefault();
|
|
203
|
-
this.cycleTabFocus(link, event.shiftKey);
|
|
204
|
-
break;
|
|
205
|
-
case 'Enter':
|
|
206
|
-
case ' ':
|
|
207
|
-
if (key === ' ' && link.tagName.toLowerCase() === 'a') {
|
|
208
|
-
event.preventDefault();
|
|
209
|
-
}
|
|
210
|
-
setTimeout(() => this.hide(), 100);
|
|
211
|
-
break;
|
|
212
|
-
case 'Escape':
|
|
213
|
-
event.preventDefault();
|
|
214
|
-
this.hide();
|
|
215
|
-
this.focusOnTriggerElement();
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
get effectivePlacement() {
|
|
221
|
-
return resolveAllowedPropValue(this.el, 'placement', this.placement, ['bottom-start', 'bottom-end', 'top-start', 'top-end', 'left', 'right', 'bottom', 'top'], 'bottom-start');
|
|
222
|
-
}
|
|
223
|
-
get effectiveArrowPosition() {
|
|
224
|
-
return resolveAllowedPropValue(this.el, 'arrowPosition', this.arrowPosition, ['left', 'right'], 'right');
|
|
225
|
-
}
|
|
226
|
-
isOpenChanged(newValue) {
|
|
227
|
-
if (newValue) {
|
|
228
|
-
// Esconde o alvo imediatamente, antes do primeiro ciclo de renderização.
|
|
229
|
-
// O Floating UI calcula a posição de forma assíncrona; sem este estado
|
|
230
|
-
// explícito o alvo pode aparecer por um frame na origem (sobre o trigger)
|
|
231
|
-
// e então saltar para a posição final.
|
|
232
|
-
this.hideTargetUntilPositioned();
|
|
233
|
-
this.attachClickListener();
|
|
234
|
-
this.attachOpenListeners();
|
|
235
|
-
this.brDidOpen.emit({ id: this.customId });
|
|
236
|
-
this.pendingOpenInit = true;
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
this.detachClickListener();
|
|
240
|
-
this.detachOpenListeners();
|
|
241
|
-
this.cleanupPositioning();
|
|
242
|
-
this.brDidClose.emit({ id: this.customId });
|
|
243
|
-
if (this.triggerElement !== null && this.triggerElement !== undefined) {
|
|
244
|
-
this.focusOnTriggerElement();
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
this.brDropdownChange.emit({ isOpen: newValue });
|
|
248
|
-
this.brDropdownOpenChange.emit({ open: newValue });
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Aplica o novo valor de z-index ao elemento target.
|
|
252
|
-
*/
|
|
253
|
-
targetZIndexChanged() {
|
|
254
|
-
this.updateTargetZIndex();
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Evento emitido quando o dropdown é aberto.
|
|
258
|
-
* Este evento é usado para implementar o auto-dismiss de outros dropdowns.
|
|
259
|
-
*
|
|
260
|
-
* @internal
|
|
261
|
-
*/
|
|
262
|
-
placementChanged() {
|
|
263
|
-
if (!this.isOpen)
|
|
264
|
-
return;
|
|
265
|
-
this.cleanupPositioning();
|
|
266
|
-
this.positionDropdown();
|
|
267
|
-
}
|
|
268
|
-
/** Recalcula a superfície aberta quando a política de largura muda. */
|
|
269
|
-
matchTriggerWidthChanged() {
|
|
270
|
-
if (!this.isOpen)
|
|
271
|
-
return;
|
|
272
|
-
this.cleanupPositioning();
|
|
273
|
-
this.positionDropdown();
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Fecha o dropdown se for desabilitado enquanto estiver aberto.
|
|
277
|
-
*/
|
|
278
|
-
disabledChanged(newValue) {
|
|
279
|
-
if (newValue && this.isOpen) {
|
|
280
|
-
this.hide();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
connectedCallback() {
|
|
284
|
-
this.clickHandler = this.onClickOutside.bind(this);
|
|
285
|
-
this.dropdownOpenHandler = this.onDropdownDidOpen.bind(this);
|
|
286
|
-
if (this.isOpen)
|
|
287
|
-
this.attachOpenListeners();
|
|
288
|
-
}
|
|
289
|
-
disconnectedCallback() {
|
|
290
|
-
this.detachClickListener();
|
|
291
|
-
this.detachOpenListeners();
|
|
292
|
-
if (this.targetElement !== null && this.targetElement !== undefined) {
|
|
293
|
-
this.targetElement.removeEventListener('keydown', this.targetKeydownHandler);
|
|
294
|
-
}
|
|
295
|
-
this.cleanupPositioning();
|
|
296
|
-
this.clearDropdownItemListeners();
|
|
297
|
-
}
|
|
298
|
-
componentDidLoad() {
|
|
299
|
-
this.triggerElement = this.el.shadowRoot.querySelector('#trigger');
|
|
300
|
-
this.targetElement = this.el.shadowRoot.querySelector('#target');
|
|
301
|
-
this.syncTriggerAccessibility();
|
|
302
|
-
this.syncTriggerAccessibilityAfterHydration();
|
|
303
|
-
this.setBehavior();
|
|
304
|
-
this.updateTargetZIndex();
|
|
305
|
-
if (this.isOpen) {
|
|
306
|
-
this.attachClickListener();
|
|
307
|
-
this.positionDropdown();
|
|
308
|
-
this.initializeDropdownItems();
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
attachClickListener() {
|
|
312
|
-
if (this.clickListenerAttached)
|
|
313
|
-
return;
|
|
314
|
-
document.addEventListener('click', this.clickHandler);
|
|
315
|
-
this.clickListenerAttached = true;
|
|
316
|
-
}
|
|
317
|
-
detachClickListener() {
|
|
318
|
-
if (!this.clickListenerAttached)
|
|
319
|
-
return;
|
|
320
|
-
document.removeEventListener('click', this.clickHandler);
|
|
321
|
-
this.clickListenerAttached = false;
|
|
322
|
-
}
|
|
323
|
-
attachOpenListeners() {
|
|
324
|
-
if (!this.isOpen)
|
|
325
|
-
return;
|
|
326
|
-
document.addEventListener('brDidOpen', this.dropdownOpenHandler);
|
|
327
|
-
this.cleanupBlockingSurfaceDismissal ?? (this.cleanupBlockingSurfaceDismissal = listenForExternalBlockingSurface(this.el, () => void this.hide()));
|
|
328
|
-
}
|
|
329
|
-
detachOpenListeners() {
|
|
330
|
-
document.removeEventListener('brDidOpen', this.dropdownOpenHandler);
|
|
331
|
-
this.cleanupBlockingSurfaceDismissal?.();
|
|
332
|
-
this.cleanupBlockingSurfaceDismissal = undefined;
|
|
333
|
-
}
|
|
334
|
-
componentDidRender() {
|
|
335
|
-
this.syncTriggerAccessibility();
|
|
336
|
-
if (this.isOpen && this.pendingOpenInit) {
|
|
337
|
-
this.pendingOpenInit = false;
|
|
338
|
-
this.positionDropdown();
|
|
339
|
-
this.initializeDropdownItems();
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Esconde o dropdown.
|
|
344
|
-
* Define a propriedade `isOpen` como falsa e retorna o novo estado.
|
|
345
|
-
* Este método pode ser chamado externamente.
|
|
346
|
-
* @deprecated Use `close`.
|
|
347
|
-
*/
|
|
348
|
-
async hide() {
|
|
349
|
-
this.isOpen = false;
|
|
350
|
-
return { isOpen: this.isOpen };
|
|
351
|
-
}
|
|
352
|
-
/** Fecha o dropdown e mantém o formato de retorno legado. */
|
|
353
|
-
async close() {
|
|
354
|
-
return await this.hide();
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Abre o dropdown.
|
|
358
|
-
* Define a propriedade `isOpen` como verdadeira e retorna o novo estado.
|
|
359
|
-
* Este método pode ser chamado externamente.
|
|
360
|
-
*/
|
|
361
|
-
async open() {
|
|
362
|
-
this.isOpen = true;
|
|
363
|
-
return { isOpen: this.isOpen };
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Define o foco no elemento interno do componente.
|
|
367
|
-
* Este método pode ser chamado externamente para garantir que o foco seja aplicado ao elemento correto.
|
|
368
|
-
*/
|
|
369
|
-
async setFocus() {
|
|
370
|
-
if (this.focusableElement !== null && this.focusableElement !== undefined) {
|
|
371
|
-
this.focusableElement.focus();
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
this.focusOnTriggerElement();
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Limpa o posicionamento do Floating UI
|
|
379
|
-
*/
|
|
380
|
-
cleanupPositioning() {
|
|
381
|
-
this.floatingManager?.stop();
|
|
382
|
-
this.hideTargetUntilPositioned();
|
|
383
|
-
}
|
|
384
|
-
hideTargetUntilPositioned() {
|
|
385
|
-
if (!this.targetElement)
|
|
386
|
-
return;
|
|
387
|
-
this.targetElement.removeAttribute('data-positioned');
|
|
388
|
-
this.targetElement.style.visibility = 'hidden';
|
|
389
|
-
this.targetElement.style.pointerEvents = 'none';
|
|
390
|
-
}
|
|
391
|
-
revealTargetAfterPositioning() {
|
|
392
|
-
if (!this.targetElement)
|
|
393
|
-
return;
|
|
394
|
-
this.targetElement.setAttribute('data-positioned', 'true');
|
|
395
|
-
this.targetElement.style.visibility = 'visible';
|
|
396
|
-
this.targetElement.style.pointerEvents = '';
|
|
397
|
-
}
|
|
398
|
-
clearDropdownItemListeners() {
|
|
399
|
-
this.dropdownItems.forEach((item) => {
|
|
400
|
-
item.removeEventListener('keydown', this.handleItemKeydown);
|
|
401
|
-
});
|
|
402
|
-
this.dropdownLinks.forEach((link) => {
|
|
403
|
-
link.removeEventListener('keydown', this.handleLinkKeydown);
|
|
404
|
-
});
|
|
405
|
-
this.dropdownItems = [];
|
|
406
|
-
this.dropdownLinks = [];
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Foca em um elemento específico com suporte a componentes personalizados
|
|
410
|
-
* @param targetElement Elemento a receber o foco
|
|
411
|
-
*/
|
|
412
|
-
/**
|
|
413
|
-
* Links e demais itens focáveis do target na ordem do documento. O Tab percorre
|
|
414
|
-
* esta sequência única para que listas mistas (links e botões) sejam alcançáveis.
|
|
415
|
-
*/
|
|
416
|
-
getTabCycle() {
|
|
417
|
-
return [...new Set([...this.dropdownLinks, ...this.dropdownItems])].sort((a, b) => a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
|
|
418
|
-
}
|
|
419
|
-
/** Move o foco para o próximo (ou anterior, com Shift) elemento do ciclo de Tab. */
|
|
420
|
-
cycleTabFocus(current, backwards) {
|
|
421
|
-
const cycle = this.getTabCycle();
|
|
422
|
-
const index = cycle.indexOf(current);
|
|
423
|
-
if (index === -1 || cycle.length === 0)
|
|
424
|
-
return;
|
|
425
|
-
const nextIndex = backwards ? (index - 1 + cycle.length) % cycle.length : (index + 1) % cycle.length;
|
|
426
|
-
this.focusOnElement(cycle[nextIndex]);
|
|
427
|
-
}
|
|
428
|
-
focusOnElement(targetElement, scrollIntoView = true) {
|
|
429
|
-
if (targetElement && targetElement !== this.el) {
|
|
430
|
-
if ('setFocus' in targetElement) {
|
|
431
|
-
targetElement.setFocus();
|
|
432
|
-
}
|
|
433
|
-
else {
|
|
434
|
-
targetElement.focus({ preventScroll: true });
|
|
435
|
-
}
|
|
436
|
-
if (scrollIntoView) {
|
|
437
|
-
targetElement.scrollIntoView({ behavior: getScrollBehavior(), block: 'nearest', inline: 'nearest' });
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Foca no elemento interativo dentro do slot trigger
|
|
443
|
-
* Esta função procura pelo elemento dentro do slot trigger e aplica o foco nele
|
|
444
|
-
*/
|
|
445
|
-
focusOnTriggerElement() {
|
|
446
|
-
const triggerSlot = this.el.shadowRoot.querySelector('slot[name="trigger"]');
|
|
447
|
-
if (triggerSlot !== null) {
|
|
448
|
-
const slotElements = triggerSlot.assignedElements();
|
|
449
|
-
if (slotElements.length > 0) {
|
|
450
|
-
const firstElement = slotElements[0];
|
|
451
|
-
if ('setFocus' in firstElement) {
|
|
452
|
-
firstElement.setFocus();
|
|
453
|
-
}
|
|
454
|
-
else {
|
|
455
|
-
firstElement.focus();
|
|
456
|
-
}
|
|
457
|
-
firstElement.scrollIntoView({ behavior: getScrollBehavior(), block: 'nearest', inline: 'nearest' });
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
this.focusTrigger();
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
else {
|
|
464
|
-
this.focusTrigger();
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Auxiliar para focar no elemento trigger
|
|
469
|
-
*/
|
|
470
|
-
focusTrigger() {
|
|
471
|
-
if (typeof this.triggerElement !== 'undefined') {
|
|
472
|
-
this.triggerElement.focus();
|
|
473
|
-
this.triggerElement.scrollIntoView({ behavior: getScrollBehavior(), block: 'nearest', inline: 'nearest' });
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
syncTriggerAccessibility() {
|
|
477
|
-
const assignedTrigger = this.el.querySelector('[slot="trigger"]');
|
|
478
|
-
if (!assignedTrigger)
|
|
479
|
-
return;
|
|
480
|
-
if (assignedTrigger.localName === 'br-button') {
|
|
481
|
-
const buttonTrigger = assignedTrigger;
|
|
482
|
-
buttonTrigger.ariaControls = 'target';
|
|
483
|
-
buttonTrigger.ariaExpanded = String(this.isOpen);
|
|
484
|
-
buttonTrigger.ariaHaspopup = 'true';
|
|
485
|
-
if (this.ariaLabel)
|
|
486
|
-
buttonTrigger.ariaLabel = this.ariaLabel;
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
const interactiveSelector = 'button, a[href], input, select, textarea, summary, [role="button"]';
|
|
490
|
-
const semanticTrigger = assignedTrigger.shadowRoot?.querySelector(interactiveSelector) ?? assignedTrigger;
|
|
491
|
-
if (this.semanticTriggerElement && this.semanticTriggerElement !== semanticTrigger) {
|
|
492
|
-
this.semanticTriggerElement.removeAttribute('aria-controls');
|
|
493
|
-
this.semanticTriggerElement.removeAttribute('aria-expanded');
|
|
494
|
-
this.semanticTriggerElement.removeAttribute('aria-haspopup');
|
|
495
|
-
this.semanticTriggerElement.removeAttribute('aria-disabled');
|
|
496
|
-
}
|
|
497
|
-
this.semanticTriggerElement = semanticTrigger;
|
|
498
|
-
if (!semanticTrigger.matches(interactiveSelector)) {
|
|
499
|
-
semanticTrigger.setAttribute('role', 'button');
|
|
500
|
-
semanticTrigger.tabIndex = this.disabled ? -1 : 0;
|
|
501
|
-
}
|
|
502
|
-
semanticTrigger.setAttribute('aria-controls', 'target');
|
|
503
|
-
semanticTrigger.setAttribute('aria-expanded', String(this.isOpen));
|
|
504
|
-
semanticTrigger.setAttribute('aria-haspopup', 'true');
|
|
505
|
-
if (this.ariaLabel)
|
|
506
|
-
semanticTrigger.setAttribute('aria-label', this.ariaLabel);
|
|
507
|
-
if (this.disabled)
|
|
508
|
-
semanticTrigger.setAttribute('aria-disabled', 'true');
|
|
509
|
-
else
|
|
510
|
-
semanticTrigger.removeAttribute('aria-disabled');
|
|
511
|
-
}
|
|
512
|
-
syncTriggerAccessibilityAfterHydration() {
|
|
513
|
-
const assignedTrigger = this.el.querySelector('[slot="trigger"]');
|
|
514
|
-
if (!assignedTrigger?.localName.includes('-'))
|
|
515
|
-
return;
|
|
516
|
-
void customElements.whenDefined(assignedTrigger.localName).then(() => this.syncTriggerAccessibility());
|
|
517
|
-
}
|
|
518
|
-
getCssClassMap() {
|
|
519
|
-
return {
|
|
520
|
-
'br-dropdown': true,
|
|
521
|
-
disabled: this.disabled,
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Lida com o comportamento no trigger
|
|
526
|
-
*/
|
|
527
|
-
handleTriggerBehavior(event) {
|
|
528
|
-
if (this.disabled)
|
|
529
|
-
return;
|
|
530
|
-
event.preventDefault();
|
|
531
|
-
this.toggle(event);
|
|
532
|
-
if (this.isOpen) {
|
|
533
|
-
setTimeout(() => {
|
|
534
|
-
this.initializeDropdownItems();
|
|
535
|
-
}, 0);
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Inicializa os itens do dropdown com comportamentos de navegação com teclado,
|
|
540
|
-
* separando links e demais itens (setas navegam entre itens; Tab percorre ambos na ordem do documento)
|
|
541
|
-
*/
|
|
542
|
-
initializeDropdownItems() {
|
|
543
|
-
if (this.targetElement === null)
|
|
544
|
-
return;
|
|
545
|
-
this.clearDropdownItemListeners();
|
|
546
|
-
this.targetElement.setAttribute('tabindex', '-1');
|
|
547
|
-
this.targetElement.focus({ preventScroll: true });
|
|
548
|
-
const targetSlot = this.el.shadowRoot.querySelector('slot[name="target"]');
|
|
549
|
-
if (isNil(targetSlot))
|
|
550
|
-
return;
|
|
551
|
-
const assignedElements = targetSlot.assignedElements();
|
|
552
|
-
if (assignedElements.length === 0)
|
|
553
|
-
return;
|
|
554
|
-
const nonLinkSelector = 'button, br-button, input, br-input, br-item:not([href]), textarea, br-textarea, select, br-select, details, [tabindex]:not([tabindex="-1"]):not(a[href])';
|
|
555
|
-
const linkSelector = 'a[href], br-item[href]';
|
|
556
|
-
assignedElements.forEach((element) => {
|
|
557
|
-
if (element instanceof HTMLElement) {
|
|
558
|
-
if (element.matches(linkSelector)) {
|
|
559
|
-
this.dropdownLinks.push(element);
|
|
560
|
-
}
|
|
561
|
-
else if (element.matches(nonLinkSelector)) {
|
|
562
|
-
this.dropdownItems.push(element);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
const linkChildren = Array.from(element.querySelectorAll(linkSelector)).filter((child) => findComposedOwner(child, 'br-dropdown') === this.el);
|
|
566
|
-
this.dropdownLinks = this.dropdownLinks.concat(linkChildren);
|
|
567
|
-
const nonLinkChildren = Array.from(element.querySelectorAll(nonLinkSelector)).filter((child) => findComposedOwner(child, 'br-dropdown') === this.el);
|
|
568
|
-
this.dropdownItems = this.dropdownItems.concat(nonLinkChildren);
|
|
569
|
-
});
|
|
570
|
-
this.dropdownItems.forEach((item) => {
|
|
571
|
-
item.addEventListener('keydown', this.handleItemKeydown);
|
|
572
|
-
});
|
|
573
|
-
this.dropdownLinks.forEach((link) => {
|
|
574
|
-
link.addEventListener('keydown', this.handleLinkKeydown);
|
|
575
|
-
});
|
|
576
|
-
const [firstFocusable] = this.getTabCycle();
|
|
577
|
-
if (firstFocusable) {
|
|
578
|
-
this.focusOnElement(firstFocusable, false);
|
|
579
|
-
this.focusableElement = firstFocusable;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* Método que lida com cliques fora do dropdown.
|
|
584
|
-
*
|
|
585
|
-
* @param {MouseEvent} event - O evento de clique que ocorreu.
|
|
586
|
-
*/
|
|
587
|
-
onClickOutside(event) {
|
|
588
|
-
if (!this.isOpen)
|
|
589
|
-
return;
|
|
590
|
-
const path = event.composedPath();
|
|
591
|
-
if (this.triggerElement &&
|
|
592
|
-
this.targetElement &&
|
|
593
|
-
!path.includes(this.triggerElement) &&
|
|
594
|
-
!path.includes(this.targetElement)) {
|
|
595
|
-
this.hide();
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Método que lida com o evento brDidOpen de outros dropdowns
|
|
600
|
-
* Fecha este dropdown se não for o emissor do evento e preventAutoDismiss=false
|
|
601
|
-
*/
|
|
602
|
-
onDropdownDidOpen(event) {
|
|
603
|
-
if (this.preventAutoDismiss) {
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
const customEvent = event;
|
|
607
|
-
const eventTarget = event.target;
|
|
608
|
-
const isDropdownEvent = eventTarget?.tagName.toLowerCase() === 'br-dropdown';
|
|
609
|
-
if (isDropdownEvent && this.isOpen && customEvent.detail.id !== this.customId) {
|
|
610
|
-
this.hide();
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Posiciona o dropdown usando Floating UI
|
|
615
|
-
*/
|
|
616
|
-
positionDropdown() {
|
|
617
|
-
if (this.triggerElement == null || this.targetElement == null)
|
|
618
|
-
return;
|
|
619
|
-
const targetElement = this.targetElement;
|
|
620
|
-
this.hideTargetUntilPositioned();
|
|
621
|
-
this.floatingManager?.stop();
|
|
622
|
-
this.floatingManager = new FloatingUIManager({
|
|
623
|
-
triggerElement: this.triggerElement,
|
|
624
|
-
contentElement: targetElement,
|
|
625
|
-
placement: this.effectivePlacement,
|
|
626
|
-
offset: 4,
|
|
627
|
-
matchReferenceWidth: this.matchTriggerWidth,
|
|
628
|
-
onUpdate: () => {
|
|
629
|
-
if (this.isOpen && this.targetElement === targetElement) {
|
|
630
|
-
this.revealTargetAfterPositioning();
|
|
631
|
-
}
|
|
632
|
-
},
|
|
633
|
-
});
|
|
634
|
-
this.floatingManager.start();
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* Configura os comportamentos de interação do dropdown
|
|
638
|
-
*/
|
|
639
|
-
setBehavior() {
|
|
640
|
-
if (this.triggerElement === null)
|
|
641
|
-
return;
|
|
642
|
-
if (this.targetElement !== null) {
|
|
643
|
-
this.targetElement.addEventListener('keydown', this.targetKeydownHandler);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Atualiza o z-index do target conforme a propriedade targetZIndex
|
|
648
|
-
*/
|
|
649
|
-
updateTargetZIndex() {
|
|
650
|
-
if (this.targetElement === null) {
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
if (this.targetZIndex !== null && this.targetZIndex !== undefined) {
|
|
654
|
-
this.targetElement.style.zIndex = this.targetZIndex;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
render() {
|
|
658
|
-
return (h(Host, { key: '306aeab7e1c86dec82b657dc8c83819410e155ac', "is-open": this.isOpen, placement: this.effectivePlacement, "prevent-auto-dismiss": this.preventAutoDismiss, disabled: this.disabled, "arrow-position": this.effectiveArrowPosition }, h("div", { key: 'ee8143f80653848dd7d906ac2ddc9f68fa22c12d', class: this.getCssClassMap(), id: this.customId }, h("div", { key: '2810078788ecbfbe797bad9f46799072fc0ff105', id: "trigger", part: "trigger", role: "group", onClick: this.disabled ? null : this.toggle, onKeyDown: (e) => (this.disabled ? null : this.triggerKeydownHandler(e)) }, this.showArrow && this.effectiveArrowPosition === 'left' ? (h("br-icon", { iconName: this.isOpen ? 'fa6-solid:caret-up' : 'fa6-solid:caret-down', "aria-hidden": "true", part: "trigger-arrow", width: "16", height: "16" })) : null, h("slot", { key: 'c2873fc62e4e2407dbbbc4b347d9aafea80458cf', name: "trigger", onSlotchange: this.handleTriggerSlotChange }), this.showArrow && this.effectiveArrowPosition === 'right' ? (h("br-icon", { iconName: this.isOpen ? 'fa6-solid:caret-up' : 'fa6-solid:caret-down', "aria-hidden": "true", part: "trigger-arrow", width: "16", height: "16" })) : null), h("div", { key: '61d81296b1254a25d435b5a3bbb9c8d1fd79ed6f', id: "target", part: "target", "aria-hidden": this.isOpen ? 'false' : 'true' }, h("slot", { key: 'fa0cf2c941124bb3697315c60d88fbc53ded4b30', name: "target" })))));
|
|
659
|
-
}
|
|
660
|
-
get el() { return getElement(this); }
|
|
661
|
-
static get watchers() { return {
|
|
662
|
-
"isOpen": [{
|
|
663
|
-
"isOpenChanged": 0
|
|
664
|
-
}],
|
|
665
|
-
"targetZIndex": [{
|
|
666
|
-
"targetZIndexChanged": 0
|
|
667
|
-
}],
|
|
668
|
-
"placement": [{
|
|
669
|
-
"placementChanged": 0
|
|
670
|
-
}],
|
|
671
|
-
"matchTriggerWidth": [{
|
|
672
|
-
"matchTriggerWidthChanged": 0
|
|
673
|
-
}],
|
|
674
|
-
"disabled": [{
|
|
675
|
-
"disabledChanged": 0
|
|
676
|
-
}]
|
|
677
|
-
}; }
|
|
678
|
-
};
|
|
679
|
-
Dropdown.style = dropdownCss();
|
|
680
|
-
|
|
681
|
-
const selectCss = () => `*,*::before,*::after{box-sizing:border-box}:host{line-height:var(--font-line-height-medium);-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}main{display:block}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace;font-size:1em}a{background-color:rgba(0,0,0,0)}b,strong{font-weight:bolder}small{font-size:80%}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:var(--font-line-height-medium);margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{appearance:none}::-webkit-file-upload-button{appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.d-none{display:none !important}@media (min-width: 576px){.d-sm-block{display:block !important}.d-sm-flex{display:flex !important}}[data-toggle=dropdown]+*{position:absolute}.dropdown{position:relative}.dropdown [data-toggle=dropdown]+*{box-shadow:var(--surface-shadow-sm);left:0;position:absolute;top:100%}.dropdown>.br-notification{left:auto;right:0}.dropdown .br-item{--color:var(--color-light);--color-rgb:var(--color-light-rgb);--text-color:var(--color-light);--interactive:var(--interactive-light);--interactive-rgb:var(--color-rgb);--visited:var(--visited-light);--hover:var(--hover-light);--pressed:var(--pressed-light);--focus-color:var(--focus-color-light);--focus:var(--focus-color-light);--item-padding-y:var(--spacing-scale-2x);background-color:var(--background-light);color:var(--color)}.dropdown .br-item:not(:last-child){border-bottom:1px solid var(--border-color)}.dropdown .br-item.selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}.justify-content-start{justify-content:flex-start !important}.justify-content-end{justify-content:flex-end !important}.justify-content-center{justify-content:center !important}.align-items-center{align-items:center !important}.col,[class*=col-]{padding-left:calc(var(--grid-gutter)*.5);padding-right:calc(var(--grid-gutter)*.5);width:100%}.col{flex:1 0 0%;min-width:8.3333333333%}.col-auto{flex:0 0 auto;width:auto}.col-2{flex-basis:16.6666666667%;max-width:16.6666666667%}.container,.container-fluid,.container-lg{--grid-margin:var(--grid-portrait-margin);--grid-maxwidth:var(--grid-portrait-maxwidth);margin-left:auto;margin-right:auto;max-width:var(--grid-maxwidth);padding-left:var(--grid-margin);padding-right:var(--grid-margin);width:100%}.row{--grid-gutter:var(--grid-portrait-gutter);display:flex;flex-wrap:wrap;margin-left:calc(var(--grid-gutter)*-0.5);margin-right:calc(var(--grid-gutter)*-0.5)}@media (min-width: 576px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-sm) - var(--grid-tablet-margin))}.col-sm-4{flex-basis:33.3333333333%;max-width:33.3333333333%}}@media (min-width: 992px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-md) - var(--grid-tablet-margin))}}@media (min-width: 1280px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-desktop-margin)}.row{--grid-gutter:var(--grid-desktop-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-lg) - var(--grid-desktop-margin))}.col-lg-3{flex-basis:25%;max-width:25%}}@media (min-width: 1600px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tv-margin)}.row{--grid-gutter:var(--grid-tv-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-xl) - var(--grid-tv-margin))}}.ease{animation-timing-function:cubic-bezier(0.25, 0.1, 0.25, 1)}.ease-out{animation-timing-function:cubic-bezier(0, 0, 0.58, 1)}.ease-in-out{animation-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}.fast{animation-duration:var(--duration-fast)}.slow{animation-duration:var(--duration-slow)}.mt-1{margin-top:var(--spacing-scale-half) !important}.mr-1{margin-right:var(--spacing-scale-half) !important}.mb-1{margin-bottom:var(--spacing-scale-half) !important}.ml-1{margin-left:var(--spacing-scale-half) !important}.mx-3{margin-left:var(--spacing-scale-2x) !important;margin-right:var(--spacing-scale-2x) !important}.mb-4{margin-bottom:var(--spacing-scale-3x) !important}.ml-auto{margin-left:auto !important}.pt-half{padding-top:var(--spacing-scale-half) !important}@media (min-width: 576px){.ml-sm-0{margin-left:var(--spacing-scale-default) !important}}.highlight{background:var(--status-highlight-background) linear-gradient(var(--status-highlight-overlay), var(--status-highlight-overlay));color:var(--status-highlight-text);padding:0 var(--spacing-scale-half)}[disabled],.disabled{cursor:not-allowed;opacity:var(--disabled)}[disabled] *,.disabled *{pointer-events:none}fieldset[disabled]{opacity:1}.text-center{text-align:center !important}.text-right{text-align:right !important}.text-nowrap{white-space:nowrap !important}.text-uppercase{text-transform:uppercase !important}.text-bold{font-weight:700 !important}.text-base{font-size:var(--font-size-scale-base) !important}.text-down-01{font-size:var(--font-size-scale-down-01) !important}@media (min-width: 576px){.text-sm-center{text-align:center !important}.text-sm-left{text-align:left !important}.text-sm-right{text-align:right !important}}p{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-2x);margin-top:0}p a{text-decoration:underline}@media (min-width: 576px){p{font-size:var(--font-size-scale-up-01)}}a{--focus-offset:var(--spacing-scale-half)}a:focus{outline:none}a.focus-visible,a:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}a:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}a:not(:disabled):active{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--pressed)), rgba(var(--interactive-rgb), var(--pressed)))}a{color:var(--interactive);text-decoration:none}.main-content a{text-decoration:underline}button{cursor:pointer}img{max-width:100%;vertical-align:middle}h2,.h2{color:var(--color);font-size:var(--font-size-scale-up-03);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2xh);margin-top:var(--spacing-scale-3xh);padding-bottom:var(--spacing-scale-2xh)}@media (min-width: 576px){.h2,h2{font-size:var(--font-size-scale-up-05);font-weight:var(--font-weight-regular)}}ul,ol{margin-bottom:var(--spacing-scale-2x);margin-top:0;padding:0 0 0 var(--spacing-scale-5x)}table{--table-background:var(--background);--table-color:var(--color);--table-border-color:var(--gray-20);--table-border-style:solid;--table-border-width:1px;--table-hover:var(--color-rgb);--table-padding:var(--spacing-scale-3x);--table-font-weight:var(--font-weight-medium);--table-th-background:var(--background-alternative);--table-th-font-weight:var(--font-weight-semi-bold);--table-row-size:var(--spacing-scale-2x);border-collapse:collapse;width:100%}tr.selected,tr.is-selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}label,.label{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half)}fieldset,.fieldset{border:var(--surface-width-none);margin-bottom:var(--spacing-scale-5x);margin-top:0;padding:0}legend,.legend{color:var(--color);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2x);margin-top:var(--spacing-scale-2x)}::placeholder,.placeholder{color:var(--color-light);font-size:var(--font-size-scale-base);font-style:italic;font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half);margin-top:var(--spacing-scale-half);opacity:1}input,textarea,.input{color:var(--color-light);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-half)}pre,.pre{background:var(--gray-5);margin:var(--spacing-scale-2x) 0 var(--spacing-scale-4x);padding:var(--spacing-scale-2x)}*[data-toggle=collapse]:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}*[data-toggle=collapse]:focus{outline:none}*[data-toggle=collapse].focus-visible,*[data-toggle=collapse]:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}@media (prefers-reduced-motion: reduce){:host,:host::before,:host::after,:host *,:host *::before,:host *::after{animation:none !important;scroll-behavior:auto !important;transition:none !important}}:host-context([data-wbc-reduced-motion=true])::before,:host-context([data-wbc-reduced-motion=true])::after,:host-context([data-wbc-reduced-motion=true]) *,:host-context([data-wbc-reduced-motion=true]) *::before,:host-context([data-wbc-reduced-motion=true]) *::after{animation:none !important;scroll-behavior:auto !important;transition:none !important}.br-select{--select-divider:1px solid var(--color-secondary-04);--select-shadow:var(--surface-shadow-md)}.br-select .br-input input{padding-right:29px;text-overflow:ellipsis}.br-select .br-input input::after{bottom:0;padding:0 5px;position:absolute;right:0}.br-select{max-width:400px;min-width:100px;position:relative}.br-select .br-list{background:var(--bg-color);box-shadow:var(--select-shadow);display:none;margin-top:-2px;max-height:404px;overflow:auto;position:absolute;resize:none;width:100%;z-index:1}.br-select .br-list::-webkit-scrollbar{height:var(--spacing-scale-base);width:var(--spacing-scale-base)}.br-select .br-list::-webkit-scrollbar-track{background:var(--gray-10)}.br-select .br-list::-webkit-scrollbar-thumb{background:var(--gray-30)}.br-select .br-list:hover::-webkit-scrollbar-thumb{background:var(--gray-40)}.br-select .br-list:focus,.br-select .br-list:active{color:var(--color-secondary-09);outline:none}.br-select .br-list:hover::-webkit-scrollbar-thumb{background:var(--color-secondary-07)}.br-select .br-list[expanded]{display:block}.br-select .br-item{--color:var(--color-light);--color-rgb:var(--color-light-rgb);--text-color:var(--color-light);--interactive:var(--interactive-light);--interactive-rgb:var(--interactive-light-rgb);--visited:var(--visited-light);--hover:var(--hover-light);--pressed:var(--pressed-light);--focus-color:var(--focus-color-light);--focus:var(--focus-color-light);--item-padding-y:var(--spacing-scale-2x)}.br-select .br-item .content{padding:0}.br-select .br-item .br-checkbox,.br-select .br-item .br-radio{--item-padding-x:var(--spacing-scale-2x);--item-padding-y:var(--spacing-scale-2x)}.br-select .br-item .br-checkbox input:hover:not(:disabled)+label::before,.br-select .br-item .br-radio input:hover:not(:disabled)+label::before{background-image:none}.br-select .br-item .br-checkbox input+label,.br-select .br-item .br-radio input+label{padding-left:calc(var(--checkbox-padding) + var(--checkbox-size) + var(--item-padding-x))}.br-select .br-item .br-radio input+label{color:var(--text-color);display:block;height:auto;min-height:0;padding:var(--item-padding)}.br-select .br-item .br-radio input+label::before,.br-select .br-item .br-radio input+label::after{content:none}.br-select .br-item:not(:last-child){border-bottom:var(--select-divider)}.br-select .br-item:not([disabled]){--focus-offset:calc(var(--spacing-scale-half) * -1)}.br-select .br-item:not([disabled]):focus{outline:none}.br-select .br-item:not([disabled]).focus-visible,.br-select .br-item:not([disabled]):focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}.br-select .br-item:not([disabled]):not(:disabled):hover{background-image:linear-gradient(rgba(var(--color-rgb), var(--hover)), rgba(var(--color-rgb), var(--hover)))}.br-select .br-item.selected,.br-select .br-item[selected]{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}.br-select .br-item.selected:focus,.br-select .br-item[selected]:focus{outline:none}.br-select .br-item.selected.focus-visible,.br-select .br-item.selected:focus-visible,.br-select .br-item[selected].focus-visible,.br-select .br-item[selected]:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}.br-select .br-item.selected:not(:disabled):hover,.br-select .br-item[selected]:not(:disabled):hover{background-image:linear-gradient(rgba(var(--color-rgb), var(--hover)), rgba(var(--color-rgb), var(--hover)))}.br-select .br-item.disabled{line-height:calc(var(--font-line-height-high)*2);padding-left:calc(var(--item-padding) + var(--spacing-scale-base))}.br-select.inverted .br-input,.br-select.inverted .br-input label,.br-select.dark-mode .br-input,.br-select.dark-mode .br-input label{--color:var(--color-dark);--focus-color:var(--focus-color-dark)}:host{box-sizing:border-box;display:block;max-width:100%;width:100%}.br-select{box-sizing:border-box;min-width:0;position:relative;width:100%;max-width:100%}:host([multiple]) .br-select{min-width:0}`;
|
|
682
|
-
|
|
683
|
-
const SELECT_SEARCH_MODES = ['local', 'remote'];
|
|
684
|
-
const SELECT_AUTOCOMPLETE_VALUES = ['on', 'off'];
|
|
685
|
-
const Select = class {
|
|
686
|
-
constructor(hostRef) {
|
|
687
|
-
registerInstance(this, hostRef);
|
|
688
|
-
this.brSelectStateChange = createEvent(this, "brSelectStateChange", 7);
|
|
689
|
-
this.valueChange = createEvent(this, "valueChange", 7);
|
|
690
|
-
this.optionHover = createEvent(this, "optionHover", 7);
|
|
691
|
-
this.brSelectSearch = createEvent(this, "brSelectSearch", 6);
|
|
692
|
-
this.opened = createEvent(this, "opened", 7);
|
|
693
|
-
this.closed = createEvent(this, "closed", 7);
|
|
694
|
-
this.brSelectValidationChange = createEvent(this, "brSelectValidationChange", 7);
|
|
695
|
-
if (hostRef.$hostElement$["s-ei"]) {
|
|
696
|
-
this.elementInternals = hostRef.$hostElement$["s-ei"];
|
|
697
|
-
}
|
|
698
|
-
else {
|
|
699
|
-
this.elementInternals = hostRef.$hostElement$.attachInternals();
|
|
700
|
-
hostRef.$hostElement$["s-ei"] = this.elementInternals;
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* Remove a borda do input quando o componente não está em foco.
|
|
704
|
-
*
|
|
705
|
-
* @default false
|
|
706
|
-
*/
|
|
707
|
-
this.borderless = false;
|
|
708
|
-
/**
|
|
709
|
-
* Desativa toda a interação do select.
|
|
710
|
-
*
|
|
711
|
-
* @default false
|
|
712
|
-
*/
|
|
713
|
-
this.disabled = false;
|
|
714
|
-
/**
|
|
715
|
-
* Define a densidade visual compartilhada pelo campo e pela lista de opções.
|
|
716
|
-
* Aceita `small`, `medium` ou `large`. Valores inválidos usam `medium`.
|
|
717
|
-
* A opção sintética de selecionar todos permanece com densidade `small`.
|
|
718
|
-
*
|
|
719
|
-
* @default 'medium'
|
|
720
|
-
*/
|
|
721
|
-
this.density = 'medium';
|
|
722
|
-
/**
|
|
723
|
-
* Exibe label e campo na mesma linha.
|
|
724
|
-
*
|
|
725
|
-
* @default false
|
|
726
|
-
* @deprecated Use `inline`.
|
|
727
|
-
*/
|
|
728
|
-
this.isInline = false;
|
|
729
|
-
/**
|
|
730
|
-
* Habilita o modo de seleção múltipla.
|
|
731
|
-
*
|
|
732
|
-
* @default false
|
|
733
|
-
* @deprecated Use `multiple`.
|
|
734
|
-
*/
|
|
735
|
-
this.isMultiple = false;
|
|
736
|
-
/**
|
|
737
|
-
* Mantém a lista aberta depois de uma seleção.
|
|
738
|
-
*
|
|
739
|
-
* @default false
|
|
740
|
-
* @deprecated O comportamento atual usa o fechamento padrão do select; mantenha esta prop
|
|
741
|
-
* apenas para compatibilidade com integrações legadas.
|
|
742
|
-
*/
|
|
743
|
-
this.keepOpenOnSelect = false;
|
|
744
|
-
/**
|
|
745
|
-
* Define quantas linhas visuais ficam visíveis na janela da lista.
|
|
746
|
-
* Cabeçalhos de grupo também ocupam uma linha quando existem.
|
|
747
|
-
* Deve ser um inteiro positivo; valores inválidos usam 6.
|
|
748
|
-
*
|
|
749
|
-
* @default 6
|
|
750
|
-
*/
|
|
751
|
-
this.visibleItems = 6;
|
|
752
|
-
/**
|
|
753
|
-
* Informa a altura base de cada opção ou cabeçalho para o cálculo de virtual scroll.
|
|
754
|
-
* Deve ser um número finito positivo; valores inválidos usam 40.
|
|
755
|
-
*
|
|
756
|
-
* @default 40
|
|
757
|
-
*/
|
|
758
|
-
this.itemHeight = 40;
|
|
759
|
-
/**
|
|
760
|
-
* Controla a largura do campo de entrada.
|
|
761
|
-
*
|
|
762
|
-
* @type {string}
|
|
763
|
-
* @example '20rem'
|
|
764
|
-
*/
|
|
765
|
-
this.inputWidth = undefined;
|
|
766
|
-
/**
|
|
767
|
-
* Define quantas opções extras são renderizadas antes e depois da área visível no virtual scroll.
|
|
768
|
-
* Deve ser um inteiro não negativo; valores inválidos usam 1.
|
|
769
|
-
*
|
|
770
|
-
* @default 1
|
|
771
|
-
*/
|
|
772
|
-
this.overscan = 1;
|
|
773
|
-
/**
|
|
774
|
-
* Oculta os divisores entre opções consecutivas, sem alterar a altura das linhas.
|
|
775
|
-
* @default false
|
|
776
|
-
*/
|
|
777
|
-
this.hideDividers = false;
|
|
778
|
-
/**
|
|
779
|
-
* Controla o estado aberto/fechado da lista.
|
|
780
|
-
*
|
|
781
|
-
* @default false
|
|
782
|
-
* @deprecated Use `open`.
|
|
783
|
-
*/
|
|
784
|
-
this.isOpen = false;
|
|
785
|
-
/**
|
|
786
|
-
* Valor público do select baseado nas opções atualmente selecionadas.
|
|
787
|
-
*
|
|
788
|
-
* @type {string | string[] | undefined}
|
|
789
|
-
* @remarks Em modo múltiplo, o valor público é um array de strings.
|
|
790
|
-
* @example
|
|
791
|
-
* ```js
|
|
792
|
-
* const select = document.querySelector('br-select');
|
|
793
|
-
* select.multiple = true;
|
|
794
|
-
* select.value = ['df', 'sp'];
|
|
795
|
-
* ```
|
|
796
|
-
*/
|
|
797
|
-
this.value = '';
|
|
798
|
-
/**
|
|
799
|
-
* Texto exibido quando não há seleção.
|
|
800
|
-
*
|
|
801
|
-
* @type {string | undefined}
|
|
802
|
-
*/
|
|
803
|
-
this.placeholder = '';
|
|
804
|
-
/**
|
|
805
|
-
* Indica que o preenchimento do select é obrigatório.
|
|
806
|
-
*
|
|
807
|
-
* @default false
|
|
808
|
-
*/
|
|
809
|
-
this.required = false;
|
|
810
|
-
/**
|
|
811
|
-
* Rótulo apresentado para a opção de selecionar todos no modo múltiplo.
|
|
812
|
-
*
|
|
813
|
-
* @default 'Selecionar todos'
|
|
814
|
-
*/
|
|
815
|
-
this.selectAllLabel = Select.SELECT_ALL_LABEL;
|
|
816
|
-
/**
|
|
817
|
-
* Habilita a filtragem textual das opções por rótulo ou valor.
|
|
818
|
-
*
|
|
819
|
-
* @default true
|
|
820
|
-
*/
|
|
821
|
-
this.filterable = true;
|
|
822
|
-
/**
|
|
823
|
-
* Define se as opções são filtradas localmente ou fornecidas por uma busca remota.
|
|
824
|
-
* Em `remote`, o componente emite `brSelectSearch`; a aplicação deve buscar,
|
|
825
|
-
* validar e aplicar as opções por `setOptions()`.
|
|
826
|
-
* @default 'local'
|
|
827
|
-
*/
|
|
828
|
-
this.searchMode = 'local';
|
|
829
|
-
/**
|
|
830
|
-
* Indica que uma busca remota de opções está pendente.
|
|
831
|
-
* Enquanto ativo, novas opções não podem ser selecionadas; a aplicação
|
|
832
|
-
* continua responsável por debounce, cancelamento, erros e autenticação.
|
|
833
|
-
* @default false
|
|
834
|
-
*/
|
|
835
|
-
this.loading = false;
|
|
836
|
-
/**
|
|
837
|
-
* Exibe o ícone de busca no campo de entrada.
|
|
838
|
-
*
|
|
839
|
-
* @default false
|
|
840
|
-
*/
|
|
841
|
-
this.showSearchIcon = false;
|
|
842
|
-
/**
|
|
843
|
-
* Rótulo apresentado quando todas as opções já estão selecionadas no modo múltiplo.
|
|
844
|
-
*
|
|
845
|
-
* @default 'Desselecionar todos'
|
|
846
|
-
*/
|
|
847
|
-
this.unselectAllLabel = Select.DESELECT_ALL_LABEL;
|
|
848
|
-
/**
|
|
849
|
-
* Fornece opções como array ou JSON, além das opções projetadas por slot.
|
|
850
|
-
* Use property binding para arrays em JavaScript e frameworks; no atributo
|
|
851
|
-
* HTML, informe uma string JSON válida. Na inicialização, opções no slot têm
|
|
852
|
-
* precedência quando existem. Depois de uma alteração nesta prop ou de uma
|
|
853
|
-
* chamada a `setOptions()`, a coleção imperativa passa a ser a fonte de dados.
|
|
854
|
-
* Não use em código novo. Declare `br-select-option` no slot padrão ou, para
|
|
855
|
-
* respostas dinâmicas/remotas, atualize a coleção com `setOptions()`.
|
|
856
|
-
*
|
|
857
|
-
* @example
|
|
858
|
-
* ```html
|
|
859
|
-
* <!-- Compatibilidade legada; prefira elementos br-select-option. -->
|
|
860
|
-
* <br-select options='[{"label":"Distrito Federal","value":"df"}]'></br-select>
|
|
861
|
-
* ```
|
|
862
|
-
* @deprecated Use `br-select-option` no slot padrão ou `setOptions()` para respostas dinâmicas/remotas.
|
|
863
|
-
*/
|
|
864
|
-
this.options = [];
|
|
865
|
-
/** Identificador público do controle. */
|
|
866
|
-
this.customId = generateUniqueId('br-select');
|
|
867
|
-
/** Quantidade mínima de opções selecionadas no modo múltiplo. Deve ser um inteiro não negativo; valores inválidos usam 0. */
|
|
868
|
-
this.minSelections = 0;
|
|
869
|
-
/** Quantidade máxima de opções selecionadas no modo múltiplo. Deve ser um inteiro não negativo; valores inválidos usam 0. */
|
|
870
|
-
this.maxSelections = 0;
|
|
871
|
-
this.shouldRestoreSelectedOptionOnOpen = false;
|
|
872
|
-
this.isSelectInputPointerDown = false;
|
|
873
|
-
this.skipSelectInputClickToggle = false;
|
|
874
|
-
this.pendingOptions = null;
|
|
875
|
-
this.slotElement = null;
|
|
876
|
-
this.handleSlotChange = () => this.slotReconciler.schedule();
|
|
877
|
-
this.slotReconciler = createMicrotaskReconciler(() => this.syncOptionsFromSlot());
|
|
878
|
-
this.lastEmittedStateKey = '';
|
|
879
|
-
this.isStateChangeReady = false;
|
|
880
|
-
this.isValueChangeReady = false;
|
|
881
|
-
this.listboxId = `${this.customId}-listbox`;
|
|
882
|
-
this.checkingValidity = false;
|
|
883
|
-
this.showValidationErrors = false;
|
|
884
|
-
this.validationErrorMessage = '';
|
|
885
|
-
this.activeOptionIndex = -1;
|
|
886
|
-
/**
|
|
887
|
-
* Oculta o indicador visual da opção ativa após interação por ponteiro, como `:focus-visible`.
|
|
888
|
-
* O índice ativo e o `aria-activedescendant` são preservados; o teclado volta a exibi-lo.
|
|
889
|
-
*/
|
|
890
|
-
this.isActiveIndicatorHidden = false;
|
|
891
|
-
this.searchTerm = '';
|
|
892
|
-
this.formDisabled = false;
|
|
893
|
-
this.isValidating = false;
|
|
894
|
-
this.validatorMessage = null;
|
|
895
|
-
this.hasFeedbackSlot = false;
|
|
896
|
-
this.hasValidationLoadingSlot = false;
|
|
897
|
-
this.selectedValuesState = [];
|
|
898
|
-
this.customValidationMessage = '';
|
|
899
|
-
this.validationRunId = 0;
|
|
900
|
-
this.lastAnnouncedOpen = false;
|
|
901
|
-
this.isApplyingExternalValue = false;
|
|
902
|
-
this.suppressValueChange = false;
|
|
903
|
-
this.hasImperativeOptions = false;
|
|
904
|
-
this.remoteSelectedOptions = new Map();
|
|
905
|
-
this.selectionInitialized = false;
|
|
906
|
-
this.typeAhead = '';
|
|
907
|
-
this.lastTypeAheadTime = 0;
|
|
908
|
-
this.selectedValues = [];
|
|
909
|
-
/**
|
|
910
|
-
* Sincroniza as opções declaradas no slot com a lista interna renderizada.
|
|
911
|
-
*
|
|
912
|
-
* @remarks
|
|
913
|
-
* Esse passo mantém alinhados o estado visual da lista e o texto exibido no input
|
|
914
|
-
* quando as opções são adicionadas, removidas ou alteradas dinamicamente.
|
|
915
|
-
*/
|
|
916
|
-
this.syncOptionsFromSlot = (updateDisplayValue = true) => {
|
|
917
|
-
if (this.hasImperativeOptions)
|
|
918
|
-
return;
|
|
919
|
-
const nodes = this.slotElement?.assignedNodes({ flatten: true }) ?? Array.from(this.el.childNodes);
|
|
920
|
-
const options = nodes.map((n) => this.nodeToOption(n)).filter((o) => Boolean(o));
|
|
921
|
-
// Envia opções para o br-select-list
|
|
922
|
-
if (this.selectListElement)
|
|
923
|
-
this.selectListElement.options = this.getListOptions(options);
|
|
924
|
-
if (updateDisplayValue)
|
|
925
|
-
this.syncDisplayValue(options);
|
|
926
|
-
};
|
|
927
|
-
}
|
|
928
|
-
formDisabledCallback(disabled) {
|
|
929
|
-
this.formDisabled = disabled;
|
|
930
|
-
}
|
|
931
|
-
formResetCallback() {
|
|
932
|
-
this.showValidationErrors = false;
|
|
933
|
-
this.validationErrorMessage = '';
|
|
934
|
-
this.validationRunId++;
|
|
935
|
-
this.validatorMessage = null;
|
|
936
|
-
this.customValidationMessage = '';
|
|
937
|
-
this.applySelectedValue(this.initialValue);
|
|
938
|
-
}
|
|
939
|
-
formStateRestoreCallback(state) {
|
|
940
|
-
if (typeof state !== 'string' || state === '')
|
|
941
|
-
return;
|
|
942
|
-
try {
|
|
943
|
-
this.applySelectedValue(JSON.parse(state));
|
|
944
|
-
}
|
|
945
|
-
catch {
|
|
946
|
-
this.applySelectedValue(state);
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
get effectiveVisibleItems() {
|
|
950
|
-
return resolveIntegerPropValue(this.el, 'visibleItems', this.visibleItems, 1, Number.MAX_SAFE_INTEGER, 6);
|
|
951
|
-
}
|
|
952
|
-
get effectiveDensity() {
|
|
953
|
-
return resolveDensity(this.el, this.density);
|
|
954
|
-
}
|
|
955
|
-
get effectiveItemHeight() {
|
|
956
|
-
return resolveNumberPropValue(this.el, 'itemHeight', this.itemHeight, 1, Number.MAX_SAFE_INTEGER, 40);
|
|
957
|
-
}
|
|
958
|
-
get effectiveOverscan() {
|
|
959
|
-
return resolveIntegerPropValue(this.el, 'overscan', this.overscan, 0, Number.MAX_SAFE_INTEGER, 1);
|
|
960
|
-
}
|
|
961
|
-
get effectiveSearchMode() {
|
|
962
|
-
return resolveAllowedPropValue(this.el, 'searchMode', this.searchMode, SELECT_SEARCH_MODES, 'local');
|
|
963
|
-
}
|
|
964
|
-
get effectiveMinSelections() {
|
|
965
|
-
return resolveIntegerPropValue(this.el, 'minSelections', this.minSelections, 0, Number.MAX_SAFE_INTEGER, 0);
|
|
966
|
-
}
|
|
967
|
-
get effectiveAutocomplete() {
|
|
968
|
-
return resolveAllowedPropValue(this.el, 'autocomplete', this.autocomplete, SELECT_AUTOCOMPLETE_VALUES, undefined, { allowUndefined: true });
|
|
969
|
-
}
|
|
970
|
-
get effectiveMaxSelections() {
|
|
971
|
-
return resolveIntegerPropValue(this.el, 'maxSelections', this.maxSelections, 0, Number.MAX_SAFE_INTEGER, 0);
|
|
972
|
-
}
|
|
973
|
-
componentWillLoad() {
|
|
974
|
-
this.hasFeedbackSlot = hasNamedLightDomSlot(this.el, 'feedback');
|
|
975
|
-
this.hasValidationLoadingSlot = hasNamedLightDomSlot(this.el, 'validation-loading');
|
|
976
|
-
this.setSelectionMode(this.effectiveMultiple);
|
|
977
|
-
const initialOptions = this.getHostOptions();
|
|
978
|
-
const propOptions = this.getOptionsProp();
|
|
979
|
-
const sourceOptions = initialOptions.length === 0 && propOptions.length > 0 ? propOptions : initialOptions;
|
|
980
|
-
this.setSelectedValues(this.valueFromPublicValue(this.value) ??
|
|
981
|
-
sourceOptions.filter((option) => option.selected).map((option) => option.value));
|
|
982
|
-
this.selectionInitialized = true;
|
|
983
|
-
if (initialOptions.length === 0 && propOptions.length > 0) {
|
|
984
|
-
this.pendingOptions = propOptions;
|
|
985
|
-
this.syncDisplayValue(propOptions);
|
|
986
|
-
}
|
|
987
|
-
else {
|
|
988
|
-
this.syncDisplayValue(initialOptions);
|
|
989
|
-
}
|
|
990
|
-
this.initialValue = Array.isArray(this.value) ? [...this.value] : this.value;
|
|
991
|
-
this.syncFormState();
|
|
992
|
-
}
|
|
993
|
-
componentDidLoad() {
|
|
994
|
-
this.lastEmittedStateKey = this.getStateChangeKey();
|
|
995
|
-
this.isStateChangeReady = true;
|
|
996
|
-
this.setSelectionMode(this.effectiveMultiple);
|
|
997
|
-
// Inicializa sincronização de opções a partir do slot
|
|
998
|
-
this.slotElement = this.el.shadowRoot?.querySelector('slot:not([name])');
|
|
999
|
-
if (this.slotElement) {
|
|
1000
|
-
this.syncOptionsFromSlot(false);
|
|
1001
|
-
this.slotElement.addEventListener('slotchange', this.handleSlotChange);
|
|
1002
|
-
}
|
|
1003
|
-
if (this.pendingOptions && this.selectListElement) {
|
|
1004
|
-
this.selectListElement.options = this.getListOptions(this.pendingOptions);
|
|
1005
|
-
this.pendingOptions = null;
|
|
1006
|
-
}
|
|
1007
|
-
this.isValueChangeReady = true;
|
|
1008
|
-
this.lastAnnouncedOpen = this.effectiveOpen;
|
|
1009
|
-
if (this.effectiveOpen)
|
|
1010
|
-
this.attachBlockingSurfaceListener();
|
|
1011
|
-
this.updateValidity();
|
|
1012
|
-
}
|
|
1013
|
-
componentDidRender() {
|
|
1014
|
-
this.syncNativeSelectSelection();
|
|
1015
|
-
this.updateValidity();
|
|
1016
|
-
}
|
|
1017
|
-
disconnectedCallback() {
|
|
1018
|
-
this.slotReconciler.cancel();
|
|
1019
|
-
if (this.slotElement) {
|
|
1020
|
-
this.slotElement.removeEventListener('slotchange', this.handleSlotChange);
|
|
1021
|
-
this.slotElement = null;
|
|
1022
|
-
}
|
|
1023
|
-
this.detachBlockingSurfaceListener();
|
|
1024
|
-
}
|
|
1025
|
-
get effectiveMultiple() {
|
|
1026
|
-
return this.multiple ?? this.isMultiple;
|
|
1027
|
-
}
|
|
1028
|
-
get effectiveInline() {
|
|
1029
|
-
return this.inline ?? this.isInline;
|
|
1030
|
-
}
|
|
1031
|
-
get effectiveOpen() {
|
|
1032
|
-
return this.open ?? this.isOpen;
|
|
1033
|
-
}
|
|
1034
|
-
valueFromPublicValue(value) {
|
|
1035
|
-
if (this.effectiveMultiple)
|
|
1036
|
-
return Array.isArray(value) ? [...new Set(value.filter(Boolean))] : null;
|
|
1037
|
-
return typeof value === 'string' && value ? [value] : null;
|
|
1038
|
-
}
|
|
1039
|
-
setSelectedValues(values) {
|
|
1040
|
-
const next = [...new Set(values.filter(Boolean))];
|
|
1041
|
-
if (!this.effectiveMultiple && next.length > 1)
|
|
1042
|
-
next.splice(1);
|
|
1043
|
-
if (this.selectedValues.length === next.length &&
|
|
1044
|
-
this.selectedValues.every((value, index) => value === next[index]))
|
|
1045
|
-
return;
|
|
1046
|
-
this.selectedValues = next;
|
|
1047
|
-
this.selectedValuesState = next;
|
|
1048
|
-
}
|
|
1049
|
-
get canonicalSelectedValues() {
|
|
1050
|
-
return this.selectedValues;
|
|
1051
|
-
}
|
|
1052
|
-
applyCanonicalSelection(options, values = this.canonicalSelectedValues) {
|
|
1053
|
-
if (!this.selectionInitialized)
|
|
1054
|
-
return options.map((option) => ({ ...option }));
|
|
1055
|
-
const selected = new Set(values);
|
|
1056
|
-
return options.map((option) => ({ ...option, selected: selected.has(option.value) }));
|
|
1057
|
-
}
|
|
1058
|
-
getListOptions(options) {
|
|
1059
|
-
const normalized = this.applyCanonicalSelection(options).filter((option) => !this.isSelectAllOption(option));
|
|
1060
|
-
if (!this.effectiveMultiple)
|
|
1061
|
-
return normalized;
|
|
1062
|
-
const selectable = normalized.filter((option) => !this.isSelectAllOption(option));
|
|
1063
|
-
const allSelected = selectable.length > 0 && selectable.every((option) => Boolean(option.selected));
|
|
1064
|
-
const anySelected = selectable.some((option) => Boolean(option.selected));
|
|
1065
|
-
return [
|
|
1066
|
-
{
|
|
1067
|
-
value: SELECT_ALL_OPTION_VALUE,
|
|
1068
|
-
label: allSelected ? this.unselectAllLabel : this.selectAllLabel,
|
|
1069
|
-
selected: allSelected,
|
|
1070
|
-
indeterminate: anySelected && !allSelected,
|
|
1071
|
-
},
|
|
1072
|
-
...selectable,
|
|
1073
|
-
];
|
|
1074
|
-
}
|
|
1075
|
-
isDisabled() {
|
|
1076
|
-
return isFormControlDisabled(this.disabled, this.formDisabled);
|
|
1077
|
-
}
|
|
1078
|
-
handleDisabledChange(isDisabled) {
|
|
1079
|
-
if (isDisabled && this.effectiveOpen) {
|
|
1080
|
-
this.close();
|
|
1081
|
-
return;
|
|
1082
|
-
}
|
|
1083
|
-
this.emitStateChange();
|
|
1084
|
-
}
|
|
1085
|
-
handleIsOpenChange(isOpen) {
|
|
1086
|
-
if (this.open === undefined)
|
|
1087
|
-
this.syncOpenState(isOpen);
|
|
1088
|
-
}
|
|
1089
|
-
handleFilterableChange(filterable) {
|
|
1090
|
-
if (!filterable) {
|
|
1091
|
-
this.clearSearch();
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
handleLoadingChange(loading) {
|
|
1095
|
-
if (this.selectListElement)
|
|
1096
|
-
this.selectListElement.loading = loading;
|
|
1097
|
-
}
|
|
1098
|
-
handleIsMultipleChange(isMultiple) {
|
|
1099
|
-
if (this.multiple === undefined)
|
|
1100
|
-
this.setSelectionMode(isMultiple);
|
|
1101
|
-
this.syncDisplayValue();
|
|
1102
|
-
}
|
|
1103
|
-
handleMultipleChange(multiple) {
|
|
1104
|
-
if (multiple !== undefined)
|
|
1105
|
-
this.setSelectionMode(multiple);
|
|
1106
|
-
this.syncDisplayValue();
|
|
1107
|
-
}
|
|
1108
|
-
handleOpenChange(open) {
|
|
1109
|
-
if (open !== undefined)
|
|
1110
|
-
this.syncOpenState(open);
|
|
1111
|
-
}
|
|
1112
|
-
handleExternalValueChange(value) {
|
|
1113
|
-
if (this.isApplyingExternalValue)
|
|
1114
|
-
return;
|
|
1115
|
-
this.applySelectedValue(value);
|
|
1116
|
-
}
|
|
1117
|
-
handleOptionsChange() {
|
|
1118
|
-
const options = this.getOptionsProp();
|
|
1119
|
-
void this.setOptions(options);
|
|
1120
|
-
}
|
|
1121
|
-
syncOpenState(isOpen) {
|
|
1122
|
-
if (this.lastAnnouncedOpen !== isOpen) {
|
|
1123
|
-
(isOpen ? this.opened : this.closed).emit();
|
|
1124
|
-
this.lastAnnouncedOpen = isOpen;
|
|
1125
|
-
}
|
|
1126
|
-
if (isOpen) {
|
|
1127
|
-
this.attachBlockingSurfaceListener();
|
|
1128
|
-
this.selectInputElement?.flipUp();
|
|
1129
|
-
void this.openListAndRestorePointerFocus();
|
|
1130
|
-
}
|
|
1131
|
-
else {
|
|
1132
|
-
this.detachBlockingSurfaceListener();
|
|
1133
|
-
this.selectInputElement?.flipDown();
|
|
1134
|
-
void this.selectListElement?.close();
|
|
1135
|
-
}
|
|
1136
|
-
this.emitStateChange();
|
|
1137
|
-
}
|
|
1138
|
-
attachBlockingSurfaceListener() {
|
|
1139
|
-
this.cleanupBlockingSurfaceDismissal ?? (this.cleanupBlockingSurfaceDismissal = listenForExternalBlockingSurface(this.el, () => void this.close()));
|
|
1140
|
-
}
|
|
1141
|
-
detachBlockingSurfaceListener() {
|
|
1142
|
-
this.cleanupBlockingSurfaceDismissal?.();
|
|
1143
|
-
this.cleanupBlockingSurfaceDismissal = undefined;
|
|
1144
|
-
}
|
|
1145
|
-
handleSelectFocusOut(event) {
|
|
1146
|
-
if (!this.getEventPath(event).includes(this.selectInputElement))
|
|
1147
|
-
return;
|
|
1148
|
-
// Aguarda o foco atravessar os Shadow Roots antes de decidir se saiu do select.
|
|
1149
|
-
queueMicrotask(() => {
|
|
1150
|
-
if (!this.el.isConnected || this.el.matches(':focus-within') || this.isDisabled())
|
|
1151
|
-
return;
|
|
1152
|
-
void this.validate();
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
handleSelectInvalid(event) {
|
|
1156
|
-
if (event.target !== this.el || this.checkingValidity)
|
|
1157
|
-
return;
|
|
1158
|
-
this.showValidationErrors = true;
|
|
1159
|
-
void this.syncComboboxAccessibility();
|
|
1160
|
-
}
|
|
1161
|
-
handleSelectInputFocus() {
|
|
1162
|
-
if (this.effectiveOpen)
|
|
1163
|
-
return;
|
|
1164
|
-
this.activeOptionIndex = -1;
|
|
1165
|
-
this.skipSelectInputClickToggle = this.isSelectInputPointerDown;
|
|
1166
|
-
void this.show();
|
|
1167
|
-
}
|
|
1168
|
-
handleSelectPointerDown(event) {
|
|
1169
|
-
this.isActiveIndicatorHidden = true;
|
|
1170
|
-
this.skipSelectInputClickToggle = false;
|
|
1171
|
-
this.isSelectInputPointerDown = this.getEventPath(event).includes(this.selectInputElement);
|
|
1172
|
-
}
|
|
1173
|
-
handleSelectInputValueChange(event) {
|
|
1174
|
-
if (!this.filterable || this.isDisabled())
|
|
1175
|
-
return;
|
|
1176
|
-
const nextSearchTerm = event.detail ?? '';
|
|
1177
|
-
this.searchTerm = nextSearchTerm;
|
|
1178
|
-
this.activeOptionIndex = -1;
|
|
1179
|
-
this.brSelectSearch.emit({ query: nextSearchTerm });
|
|
1180
|
-
/*
|
|
1181
|
-
* A chamada imperativa garante que a transição para string vazia também
|
|
1182
|
-
* alcance a lista interna. Isso evita depender apenas da remoção/atualização
|
|
1183
|
-
* do atributo `search-term` no custom element.
|
|
1184
|
-
*/
|
|
1185
|
-
void this.getSelectListController()?.setSearchTerm?.(nextSearchTerm);
|
|
1186
|
-
if (!this.effectiveOpen) {
|
|
1187
|
-
void this.show();
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
handleSelectInputActionClick() {
|
|
1191
|
-
// O botão de ação fica dentro do campo: o foco do mesmo clique já abriu a lista.
|
|
1192
|
-
if (this.consumeFocusOpenClick())
|
|
1193
|
-
return;
|
|
1194
|
-
this.toggleOpenFromPointer();
|
|
1195
|
-
}
|
|
1196
|
-
handleSelectInputClick() {
|
|
1197
|
-
if (this.consumeFocusOpenClick())
|
|
1198
|
-
return;
|
|
1199
|
-
if (this.filterable) {
|
|
1200
|
-
if (!this.effectiveOpen)
|
|
1201
|
-
void this.show();
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
this.shouldRestoreSelectedOptionOnOpen = true;
|
|
1205
|
-
void this.toggleOpenFromPointer();
|
|
1206
|
-
}
|
|
1207
|
-
handleSelectOptionStateChange(event, restoreFocus = true) {
|
|
1208
|
-
event.stopPropagation();
|
|
1209
|
-
const detail = event.detail;
|
|
1210
|
-
if (detail.disabled)
|
|
1211
|
-
return;
|
|
1212
|
-
// Use a lista interna para preservar rótulos e opções remotas enquanto as
|
|
1213
|
-
// props projetadas aguardam a próxima renderização.
|
|
1214
|
-
const listOptions = this.getSelectListController()?.options;
|
|
1215
|
-
const sourceOptions = Array.isArray(listOptions) && listOptions.length > 0
|
|
1216
|
-
? listOptions.map((option) => ({ ...option }))
|
|
1217
|
-
: this.getCurrentOptions();
|
|
1218
|
-
// No modo simples, o evento é a decisão final da interação. A lista
|
|
1219
|
-
// virtualizada e as opções projetadas podem ainda conter o snapshot da
|
|
1220
|
-
// interação anterior durante cliques consecutivos; derivar a coleção a
|
|
1221
|
-
// partir do valor do evento evita que esse snapshot reapareça no valor
|
|
1222
|
-
// público ou no formulário.
|
|
1223
|
-
const selectableValues = sourceOptions
|
|
1224
|
-
.filter((option) => !this.isSelectAllOption(option) && !option.disabled)
|
|
1225
|
-
.map((option) => option.value);
|
|
1226
|
-
const transition = this.isSelectAllOption(detail)
|
|
1227
|
-
? transitionAllSelection(this.selectedValues, Boolean(detail.selected), selectableValues)
|
|
1228
|
-
: transitionSelection({
|
|
1229
|
-
currentValues: this.selectedValues,
|
|
1230
|
-
multiple: this.effectiveMultiple,
|
|
1231
|
-
value: detail.value,
|
|
1232
|
-
selected: Boolean(detail.selected),
|
|
1233
|
-
});
|
|
1234
|
-
this.setSelectedValues(transition.values);
|
|
1235
|
-
const options = this.applyCanonicalSelection(sourceOptions, transition.values);
|
|
1236
|
-
if (this.selectListElement)
|
|
1237
|
-
this.selectListElement.options = this.getListOptions(options);
|
|
1238
|
-
this.reflectRenderedListSelection(transition.values, options);
|
|
1239
|
-
this.syncSlottedOptionSelection(transition.values);
|
|
1240
|
-
this.rememberRemoteSelections(options);
|
|
1241
|
-
this.syncDisplayValue(options);
|
|
1242
|
-
this.syncActiveOptionIndex(event.detail);
|
|
1243
|
-
this.emitStateChange(detail);
|
|
1244
|
-
this.updateValidity();
|
|
1245
|
-
if (!this.effectiveMultiple && restoreFocus) {
|
|
1246
|
-
void this.selectInputElement?.setFocus?.();
|
|
1247
|
-
void this.close();
|
|
1248
|
-
}
|
|
1249
|
-
if (!transition.changed)
|
|
1250
|
-
return;
|
|
1251
|
-
dispatchNativeFormEvent(this.el, 'input');
|
|
1252
|
-
dispatchNativeFormEvent(this.el, 'change');
|
|
1253
|
-
}
|
|
1254
|
-
/**
|
|
1255
|
-
* Recalcula a coleção quando uma opção projetada muda por atribuição direta
|
|
1256
|
-
* de `selected`, `disabled`, `label`, `group` ou `value`. A lista virtualizada em
|
|
1257
|
-
* Shadow DOM não é uma fonte independente; ela recebe o snapshot pelo seu
|
|
1258
|
-
* contrato público `options`.
|
|
1259
|
-
*/
|
|
1260
|
-
handleSelectOptionPropsChange(event) {
|
|
1261
|
-
const path = event.composedPath();
|
|
1262
|
-
if (path.some((node) => node.tagName?.toLowerCase() === 'br-select-list'))
|
|
1263
|
-
return;
|
|
1264
|
-
const target = path.find((node) => node.tagName?.toLowerCase() === 'br-select-option');
|
|
1265
|
-
if (!(target instanceof HTMLElement) || findComposedOwner(target, 'br-select') !== this.el)
|
|
1266
|
-
return;
|
|
1267
|
-
if (this.hasImperativeOptions)
|
|
1268
|
-
return;
|
|
1269
|
-
this.slotReconciler.schedule();
|
|
1270
|
-
}
|
|
1271
|
-
handleSelectOptionHover(event) {
|
|
1272
|
-
this.optionHover.emit(event.detail);
|
|
1273
|
-
}
|
|
1274
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: centraliza a navegação por teclado do componente.
|
|
1275
|
-
async handleKeyDown(event) {
|
|
1276
|
-
if (this.isDisabled() || event.isComposing)
|
|
1277
|
-
return;
|
|
1278
|
-
const path = this.getEventPath(event);
|
|
1279
|
-
const isFromInput = path.includes(this.selectInputElement);
|
|
1280
|
-
const isFromList = path.includes(this.selectListElement);
|
|
1281
|
-
if (!isFromInput && !isFromList)
|
|
1282
|
-
return;
|
|
1283
|
-
this.isActiveIndicatorHidden = false;
|
|
1284
|
-
if (event.altKey && event.key === 'ArrowDown') {
|
|
1285
|
-
if (!this.effectiveOpen) {
|
|
1286
|
-
event.preventDefault();
|
|
1287
|
-
await this.show();
|
|
1288
|
-
}
|
|
1289
|
-
return;
|
|
1290
|
-
}
|
|
1291
|
-
if (event.altKey && event.key === 'ArrowUp') {
|
|
1292
|
-
if (this.effectiveOpen) {
|
|
1293
|
-
event.preventDefault();
|
|
1294
|
-
await this.close();
|
|
1295
|
-
this.activeOptionIndex = -1;
|
|
1296
|
-
}
|
|
1297
|
-
return;
|
|
1298
|
-
}
|
|
1299
|
-
if (event.altKey || event.ctrlKey || event.metaKey)
|
|
1300
|
-
return;
|
|
1301
|
-
switch (event.key) {
|
|
1302
|
-
case 'ArrowDown':
|
|
1303
|
-
event.preventDefault();
|
|
1304
|
-
await this.openAndFocusBoundary(isFromInput, 1);
|
|
1305
|
-
return;
|
|
1306
|
-
case 'ArrowUp':
|
|
1307
|
-
event.preventDefault();
|
|
1308
|
-
await this.openAndFocusBoundary(isFromInput, -1);
|
|
1309
|
-
return;
|
|
1310
|
-
case 'Home':
|
|
1311
|
-
if (isFromInput && this.filterable)
|
|
1312
|
-
return;
|
|
1313
|
-
event.preventDefault();
|
|
1314
|
-
if (!this.effectiveOpen)
|
|
1315
|
-
await this.show();
|
|
1316
|
-
await this.focusOptionByIndex(this.getNavigableOptions().findIndex((option) => !option.disabled));
|
|
1317
|
-
return;
|
|
1318
|
-
case 'End':
|
|
1319
|
-
if (isFromInput && this.filterable)
|
|
1320
|
-
return;
|
|
1321
|
-
event.preventDefault();
|
|
1322
|
-
if (!this.effectiveOpen)
|
|
1323
|
-
await this.show();
|
|
1324
|
-
await this.focusOptionByIndex(this.getNavigableOptions()
|
|
1325
|
-
.map((option) => !option.disabled)
|
|
1326
|
-
.lastIndexOf(true), true);
|
|
1327
|
-
return;
|
|
1328
|
-
case 'Enter':
|
|
1329
|
-
case ' ':
|
|
1330
|
-
if (isFromInput && this.filterable && event.key === ' ') {
|
|
1331
|
-
return;
|
|
1332
|
-
}
|
|
1333
|
-
// No campo editável fechado, Enter mantém a ação nativa do formulário.
|
|
1334
|
-
if (isFromInput && this.filterable && event.key === 'Enter' && !this.effectiveOpen)
|
|
1335
|
-
return;
|
|
1336
|
-
event.preventDefault();
|
|
1337
|
-
if (!this.effectiveOpen) {
|
|
1338
|
-
await this.show();
|
|
1339
|
-
return;
|
|
1340
|
-
}
|
|
1341
|
-
if (this.activeOptionIndex < 0) {
|
|
1342
|
-
await this.close();
|
|
1343
|
-
this.activeOptionIndex = -1;
|
|
1344
|
-
return;
|
|
1345
|
-
}
|
|
1346
|
-
await this.selectFocusedOption();
|
|
1347
|
-
return;
|
|
1348
|
-
case 'Escape':
|
|
1349
|
-
if (!this.effectiveOpen)
|
|
1350
|
-
return;
|
|
1351
|
-
event.preventDefault();
|
|
1352
|
-
await this.close();
|
|
1353
|
-
this.activeOptionIndex = -1;
|
|
1354
|
-
await this.selectInputElement?.setFocus?.();
|
|
1355
|
-
return;
|
|
1356
|
-
case 'Tab':
|
|
1357
|
-
if (!this.effectiveOpen)
|
|
1358
|
-
return;
|
|
1359
|
-
await this.close();
|
|
1360
|
-
this.activeOptionIndex = -1;
|
|
1361
|
-
return;
|
|
1362
|
-
default:
|
|
1363
|
-
if (!this.filterable && event.key.length === 1 && event.key !== ' ') {
|
|
1364
|
-
event.preventDefault();
|
|
1365
|
-
await this.focusOptionByTypedCharacters(event.key);
|
|
1366
|
-
}
|
|
1367
|
-
return;
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
handleWindowClick(ev) {
|
|
1371
|
-
this.handleOutsideClick(ev);
|
|
1372
|
-
}
|
|
1373
|
-
/**
|
|
1374
|
-
* Habilita o select para interação do usuário.
|
|
1375
|
-
*
|
|
1376
|
-
* @returns Uma promise concluída após a atualização do estado.
|
|
1377
|
-
*/
|
|
1378
|
-
async enable() {
|
|
1379
|
-
this.disabled = false;
|
|
1380
|
-
}
|
|
1381
|
-
/**
|
|
1382
|
-
* Desabilita o select e impede novas interações.
|
|
1383
|
-
*
|
|
1384
|
-
* @returns Uma promise concluída após a atualização do estado.
|
|
1385
|
-
*/
|
|
1386
|
-
async disable() {
|
|
1387
|
-
this.disabled = true;
|
|
1388
|
-
}
|
|
1389
|
-
/**
|
|
1390
|
-
* Abre a lista de opções quando o componente está habilitado.
|
|
1391
|
-
*
|
|
1392
|
-
* @returns Uma promise concluída após a atualização do estado.
|
|
1393
|
-
*/
|
|
1394
|
-
async show() {
|
|
1395
|
-
if (this.isDisabled())
|
|
1396
|
-
return;
|
|
1397
|
-
if (this.open !== undefined)
|
|
1398
|
-
this.open = true;
|
|
1399
|
-
else
|
|
1400
|
-
this.isOpen = true;
|
|
1401
|
-
}
|
|
1402
|
-
/**
|
|
1403
|
-
* Fecha a lista de opções quando o componente está habilitado.
|
|
1404
|
-
*
|
|
1405
|
-
* @returns Uma promise concluída após a atualização do estado.
|
|
1406
|
-
*/
|
|
1407
|
-
async close() {
|
|
1408
|
-
if (this.isDisabled())
|
|
1409
|
-
return;
|
|
1410
|
-
if (this.open !== undefined)
|
|
1411
|
-
this.open = false;
|
|
1412
|
-
else
|
|
1413
|
-
this.isOpen = false;
|
|
1414
|
-
this.typeAhead = '';
|
|
1415
|
-
this.clearSearch();
|
|
1416
|
-
}
|
|
1417
|
-
/**
|
|
1418
|
-
* Alterna entre os estados aberto e fechado do select.
|
|
1419
|
-
*
|
|
1420
|
-
* @returns {Promise<void>} Uma promise concluída após a atualização do estado.
|
|
1421
|
-
*/
|
|
1422
|
-
async toggleOpen() {
|
|
1423
|
-
if (this.isDisabled())
|
|
1424
|
-
return;
|
|
1425
|
-
if (this.open !== undefined)
|
|
1426
|
-
this.open = !this.open;
|
|
1427
|
-
else
|
|
1428
|
-
this.isOpen = !this.isOpen;
|
|
1429
|
-
}
|
|
1430
|
-
/**
|
|
1431
|
-
* Limpa a seleção atual.
|
|
1432
|
-
*
|
|
1433
|
-
* @deprecated Use `setValue('')` ou a API de formulário.
|
|
1434
|
-
*/
|
|
1435
|
-
async clear() {
|
|
1436
|
-
await this.setValue(this.effectiveMultiple ? [] : '');
|
|
1437
|
-
}
|
|
1438
|
-
/**
|
|
1439
|
-
* Retorna o valor público atual.
|
|
1440
|
-
*
|
|
1441
|
-
* @deprecated Leia a propriedade `value` diretamente.
|
|
1442
|
-
*/
|
|
1443
|
-
async getValue() {
|
|
1444
|
-
return this.value ?? (this.effectiveMultiple ? [] : '');
|
|
1445
|
-
}
|
|
1446
|
-
/**
|
|
1447
|
-
* Define o valor público do select.
|
|
1448
|
-
*
|
|
1449
|
-
* @deprecated Atribua a propriedade `value` diretamente.
|
|
1450
|
-
*/
|
|
1451
|
-
async setValue(value) {
|
|
1452
|
-
this.applySelectedValue(value);
|
|
1453
|
-
}
|
|
1454
|
-
/**
|
|
1455
|
-
* Move o foco para o campo interno.
|
|
1456
|
-
*
|
|
1457
|
-
* @deprecated Use o foco nativo do componente quando possível.
|
|
1458
|
-
*/
|
|
1459
|
-
async setFocus() {
|
|
1460
|
-
await this.selectInputElement?.setFocus?.();
|
|
1461
|
-
}
|
|
1462
|
-
async checkValidity() {
|
|
1463
|
-
this.checkingValidity = true;
|
|
1464
|
-
try {
|
|
1465
|
-
return this.elementInternals?.checkValidity?.() ?? true;
|
|
1466
|
-
}
|
|
1467
|
-
finally {
|
|
1468
|
-
this.checkingValidity = false;
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
async reportValidity() {
|
|
1472
|
-
this.showValidationErrors = true;
|
|
1473
|
-
this.updateValidity();
|
|
1474
|
-
await this.syncComboboxAccessibility();
|
|
1475
|
-
return this.elementInternals?.reportValidity?.() ?? true;
|
|
1476
|
-
}
|
|
1477
|
-
async setCustomValidity(message) {
|
|
1478
|
-
this.customValidationMessage = message;
|
|
1479
|
-
this.updateValidity();
|
|
1480
|
-
}
|
|
1481
|
-
async getValidationState() {
|
|
1482
|
-
return getFormValidationState(this.elementInternals);
|
|
1483
|
-
}
|
|
1484
|
-
async validate() {
|
|
1485
|
-
this.showValidationErrors = true;
|
|
1486
|
-
this.updateValidity();
|
|
1487
|
-
await this.syncComboboxAccessibility();
|
|
1488
|
-
const validator = this.resolveValidator();
|
|
1489
|
-
if (!validator || this.isDisabled())
|
|
1490
|
-
return this.checkValidity();
|
|
1491
|
-
const runId = ++this.validationRunId;
|
|
1492
|
-
this.isValidating = true;
|
|
1493
|
-
this.validatorMessage = null;
|
|
1494
|
-
this.updateValidity();
|
|
1495
|
-
this.brSelectValidationChange.emit({ validating: true, valid: null, message: null });
|
|
1496
|
-
let message = null;
|
|
1497
|
-
try {
|
|
1498
|
-
const currentValue = this.effectiveMultiple
|
|
1499
|
-
? [...(Array.isArray(this.value) ? this.value : [])]
|
|
1500
|
-
: String(this.value ?? '');
|
|
1501
|
-
message = (await validator(currentValue)) || null;
|
|
1502
|
-
}
|
|
1503
|
-
catch {
|
|
1504
|
-
message = 'Não foi possível validar a seleção.';
|
|
1505
|
-
}
|
|
1506
|
-
if (runId !== this.validationRunId)
|
|
1507
|
-
return false;
|
|
1508
|
-
this.validatorMessage = message;
|
|
1509
|
-
this.isValidating = false;
|
|
1510
|
-
this.updateValidity();
|
|
1511
|
-
const valid = message === null && (await this.checkValidity());
|
|
1512
|
-
this.brSelectValidationChange.emit({ validating: false, valid, message });
|
|
1513
|
-
return valid;
|
|
1514
|
-
}
|
|
1515
|
-
/**
|
|
1516
|
-
* Substitui a coleção atual de opções por uma nova lista.
|
|
1517
|
-
*
|
|
1518
|
-
* @param options Opções que devem ser exibidas pela lista interna.
|
|
1519
|
-
* Em `search-mode="remote"`, a seleção atual é preservada mesmo quando não
|
|
1520
|
-
* aparece na resposta recebida.
|
|
1521
|
-
* @returns Uma promise concluída após a sincronização das opções.
|
|
1522
|
-
*/
|
|
1523
|
-
async setOptions(options) {
|
|
1524
|
-
this.hasImperativeOptions = true;
|
|
1525
|
-
const nextOptions = this.effectiveSearchMode === 'remote' ? this.applyRemoteSelection(options) : options;
|
|
1526
|
-
this.suppressValueChange = true;
|
|
1527
|
-
try {
|
|
1528
|
-
if (this.selectListElement) {
|
|
1529
|
-
this.selectListElement.options = this.getListOptions(nextOptions);
|
|
1530
|
-
}
|
|
1531
|
-
else {
|
|
1532
|
-
this.pendingOptions = nextOptions;
|
|
1533
|
-
}
|
|
1534
|
-
this.syncDisplayValue(nextOptions);
|
|
1535
|
-
}
|
|
1536
|
-
finally {
|
|
1537
|
-
this.suppressValueChange = false;
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
/**
|
|
1541
|
-
* Adiciona ou atualiza uma única opção na coleção interna.
|
|
1542
|
-
*
|
|
1543
|
-
* @param option Opção que deve ser inserida ou atualizada.
|
|
1544
|
-
* @returns Uma promise concluída após a sincronização da opção.
|
|
1545
|
-
*/
|
|
1546
|
-
async setOption(option) {
|
|
1547
|
-
this.hasImperativeOptions = true;
|
|
1548
|
-
const currentOptions = this.getCurrentOptions();
|
|
1549
|
-
const index = currentOptions.findIndex((currentOption) => currentOption.value === option.value);
|
|
1550
|
-
const nextOptions = [...currentOptions];
|
|
1551
|
-
if (index === -1)
|
|
1552
|
-
nextOptions.push(option);
|
|
1553
|
-
else
|
|
1554
|
-
nextOptions[index] = option;
|
|
1555
|
-
if (this.selectListElement) {
|
|
1556
|
-
this.selectListElement.options = this.getListOptions(nextOptions);
|
|
1557
|
-
}
|
|
1558
|
-
else {
|
|
1559
|
-
this.pendingOptions = nextOptions;
|
|
1560
|
-
}
|
|
1561
|
-
this.syncDisplayValue(nextOptions);
|
|
1562
|
-
}
|
|
1563
|
-
getHostOptions() {
|
|
1564
|
-
return Array.from(this.el.childNodes)
|
|
1565
|
-
.map((node) => this.nodeToOption(node))
|
|
1566
|
-
.filter((option) => Boolean(option));
|
|
1567
|
-
}
|
|
1568
|
-
nodeToOption(node) {
|
|
1569
|
-
if (node.nodeType === Node.ELEMENT_NODE)
|
|
1570
|
-
return this.elementToOption(node);
|
|
1571
|
-
if (node.nodeType === Node.TEXT_NODE)
|
|
1572
|
-
return this.textNodeToOption(node);
|
|
1573
|
-
return null;
|
|
1574
|
-
}
|
|
1575
|
-
elementToOption(el) {
|
|
1576
|
-
if (el.tagName.toLowerCase() === 'br-select-option')
|
|
1577
|
-
return this.optionElementToData(el);
|
|
1578
|
-
const text = (el.textContent || '').trim();
|
|
1579
|
-
return text ? { value: text, label: text } : null;
|
|
1580
|
-
}
|
|
1581
|
-
textNodeToOption(textNode) {
|
|
1582
|
-
const text = (textNode.textContent || '').trim();
|
|
1583
|
-
return text ? { value: text, label: text } : null;
|
|
1584
|
-
}
|
|
1585
|
-
optionElementToData(el) {
|
|
1586
|
-
const rawValue = el.getAttribute('value') ?? el.value ?? '';
|
|
1587
|
-
const rawLabel = el.getAttribute('label') ?? el.label ?? '';
|
|
1588
|
-
let value = String(rawValue || '').trim();
|
|
1589
|
-
let label = String(rawLabel || '').trim();
|
|
1590
|
-
const group = this.getOptionElementGroup(el);
|
|
1591
|
-
const inner = this.extractInnerTextFromOption(el);
|
|
1592
|
-
const content = (el.innerHTML || '').trim();
|
|
1593
|
-
const selected = el.hasAttribute('selected') || Boolean(el.selected);
|
|
1594
|
-
const disabled = el.hasAttribute('disabled') || Boolean(el.disabled);
|
|
1595
|
-
if (!value && inner)
|
|
1596
|
-
value = inner.trim();
|
|
1597
|
-
if (!label)
|
|
1598
|
-
label = inner?.trim() || value;
|
|
1599
|
-
return {
|
|
1600
|
-
value: value || '',
|
|
1601
|
-
label: label || undefined,
|
|
1602
|
-
group,
|
|
1603
|
-
selected,
|
|
1604
|
-
disabled,
|
|
1605
|
-
content: content || undefined,
|
|
1606
|
-
};
|
|
1607
|
-
}
|
|
1608
|
-
getOptionElementGroup(el) {
|
|
1609
|
-
return String(el.getAttribute('group') ?? el.group ?? '').trim() || undefined;
|
|
1610
|
-
}
|
|
1611
|
-
extractInnerTextFromOption(el) {
|
|
1612
|
-
const fallback = (el.textContent || '').trim();
|
|
1613
|
-
return fallback || null;
|
|
1614
|
-
}
|
|
1615
|
-
getOptionLabel(option) {
|
|
1616
|
-
return (option.label ?? option.value).trim();
|
|
1617
|
-
}
|
|
1618
|
-
getDisplayValue(options = this.getCurrentOptions()) {
|
|
1619
|
-
const selectedOptions = options.filter((option) => {
|
|
1620
|
-
if (!option.selected)
|
|
1621
|
-
return false;
|
|
1622
|
-
const optionLabel = this.getOptionLabel(option);
|
|
1623
|
-
return !this.isSelectAllLabel(optionLabel);
|
|
1624
|
-
});
|
|
1625
|
-
if (selectedOptions.length === 0)
|
|
1626
|
-
return '';
|
|
1627
|
-
if (!this.effectiveMultiple) {
|
|
1628
|
-
return this.getOptionLabel(selectedOptions[0]);
|
|
1629
|
-
}
|
|
1630
|
-
const [firstSelected, ...otherSelected] = selectedOptions;
|
|
1631
|
-
const firstLabel = this.getOptionLabel(firstSelected);
|
|
1632
|
-
if (otherSelected.length === 0)
|
|
1633
|
-
return firstLabel;
|
|
1634
|
-
return `${firstLabel} + (${otherSelected.length})`;
|
|
1635
|
-
}
|
|
1636
|
-
syncDisplayValue(options) {
|
|
1637
|
-
const resolvedOptions = this.getFormOptions(options ?? this.getCurrentOptions());
|
|
1638
|
-
this.displayValue = this.getDisplayValue(resolvedOptions);
|
|
1639
|
-
this.syncValue(resolvedOptions);
|
|
1640
|
-
}
|
|
1641
|
-
syncValue(options) {
|
|
1642
|
-
this.setSelectedValues(options
|
|
1643
|
-
.filter((option) => option.selected && !this.isSelectAllLabel(this.getOptionLabel(option)))
|
|
1644
|
-
.map((option) => option.value));
|
|
1645
|
-
const nextValue = this.getSerializedValue(options);
|
|
1646
|
-
this.syncFormState(options);
|
|
1647
|
-
if (this.value === nextValue)
|
|
1648
|
-
return;
|
|
1649
|
-
this.isApplyingExternalValue = true;
|
|
1650
|
-
this.value = nextValue;
|
|
1651
|
-
this.isApplyingExternalValue = false;
|
|
1652
|
-
if (!this.isValueChangeReady || this.suppressValueChange)
|
|
1653
|
-
return;
|
|
1654
|
-
this.valueChange.emit(Array.isArray(nextValue) ? nextValue.join(',') : nextValue);
|
|
1655
|
-
}
|
|
1656
|
-
getSerializedValue(options) {
|
|
1657
|
-
const selectedValues = options
|
|
1658
|
-
.filter((option) => {
|
|
1659
|
-
if (!option.selected)
|
|
1660
|
-
return false;
|
|
1661
|
-
const optionLabel = this.getOptionLabel(option);
|
|
1662
|
-
return !this.isSelectAllLabel(optionLabel);
|
|
1663
|
-
})
|
|
1664
|
-
.map((option) => option.value);
|
|
1665
|
-
if (this.effectiveMultiple)
|
|
1666
|
-
return selectedValues;
|
|
1667
|
-
if (selectedValues.length === 0)
|
|
1668
|
-
return '';
|
|
1669
|
-
return selectedValues[0];
|
|
1670
|
-
}
|
|
1671
|
-
getOptionsProp() {
|
|
1672
|
-
let parsed = this.options;
|
|
1673
|
-
if (!Array.isArray(this.options)) {
|
|
1674
|
-
try {
|
|
1675
|
-
parsed = JSON.parse(this.options || '[]');
|
|
1676
|
-
}
|
|
1677
|
-
catch {
|
|
1678
|
-
reportInvalidPropValue(this.el, 'options', this.options, 'Informe um array de opções ou uma string JSON válida.', 'Aplicando fallback [].');
|
|
1679
|
-
return [];
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
if (!Array.isArray(parsed)) {
|
|
1683
|
-
reportInvalidPropValue(this.el, 'options', this.options, 'Informe um array de opções ou uma string JSON válida.', 'Aplicando fallback [].');
|
|
1684
|
-
return [];
|
|
1685
|
-
}
|
|
1686
|
-
const validOptions = parsed.filter((option) => {
|
|
1687
|
-
return typeof option === 'object' && option !== null && typeof option.value === 'string';
|
|
1688
|
-
});
|
|
1689
|
-
const hasInvalidLabels = parsed.some((option) => {
|
|
1690
|
-
if (typeof option !== 'object' || option === null)
|
|
1691
|
-
return false;
|
|
1692
|
-
const label = option.label;
|
|
1693
|
-
return label !== undefined && typeof label !== 'string';
|
|
1694
|
-
});
|
|
1695
|
-
const hasInvalidGroups = parsed.some((option) => {
|
|
1696
|
-
if (typeof option !== 'object' || option === null)
|
|
1697
|
-
return false;
|
|
1698
|
-
const group = option.group;
|
|
1699
|
-
return group !== undefined && typeof group !== 'string';
|
|
1700
|
-
});
|
|
1701
|
-
const normalizedOptions = validOptions.map((option) => ({
|
|
1702
|
-
...option,
|
|
1703
|
-
group: typeof option.group === 'string' ? option.group.trim() || undefined : undefined,
|
|
1704
|
-
label: typeof option.label === 'string' ? option.label : undefined,
|
|
1705
|
-
}));
|
|
1706
|
-
if (validOptions.length !== parsed.length || hasInvalidLabels || hasInvalidGroups) {
|
|
1707
|
-
reportInvalidPropValue(this.el, 'options', this.options, 'Cada opção deve ter `value` string e pode ter `label` e `group` como strings.', 'Ignorando opções inválidas e removendo rótulos ou grupos com tipo incompatível.');
|
|
1708
|
-
}
|
|
1709
|
-
return normalizedOptions;
|
|
1710
|
-
}
|
|
1711
|
-
applySelectedValue(value) {
|
|
1712
|
-
const currentOptions = this.getCurrentOptions();
|
|
1713
|
-
const requestedValues = this.valueFromPublicValue(value) ?? [];
|
|
1714
|
-
this.setSelectedValues(requestedValues);
|
|
1715
|
-
const options = currentOptions.map((option) => ({
|
|
1716
|
-
...option,
|
|
1717
|
-
selected: requestedValues.includes(option.value),
|
|
1718
|
-
}));
|
|
1719
|
-
this.isApplyingExternalValue = true;
|
|
1720
|
-
if (this.selectListElement)
|
|
1721
|
-
this.selectListElement.options = this.getListOptions(options);
|
|
1722
|
-
else
|
|
1723
|
-
this.pendingOptions = options;
|
|
1724
|
-
this.reflectRenderedListSelection(requestedValues, options);
|
|
1725
|
-
this.value = value;
|
|
1726
|
-
this.isApplyingExternalValue = false;
|
|
1727
|
-
this.remoteSelectedOptions.clear();
|
|
1728
|
-
this.rememberRemoteSelections(options);
|
|
1729
|
-
if (this.effectiveSearchMode === 'remote') {
|
|
1730
|
-
const selectedValues = new Set(Array.isArray(value) ? value : [value ?? '']);
|
|
1731
|
-
selectedValues.forEach((selectedValue) => {
|
|
1732
|
-
if (selectedValue && !currentOptions.some((option) => option.value === selectedValue)) {
|
|
1733
|
-
this.remoteSelectedOptions.set(selectedValue, {
|
|
1734
|
-
value: selectedValue,
|
|
1735
|
-
label: selectedValue,
|
|
1736
|
-
selected: true,
|
|
1737
|
-
});
|
|
1738
|
-
}
|
|
1739
|
-
});
|
|
1740
|
-
this.syncDisplayValue(this.getCurrentOptions());
|
|
1741
|
-
return;
|
|
1742
|
-
}
|
|
1743
|
-
this.syncDisplayValue(options);
|
|
1744
|
-
}
|
|
1745
|
-
applyRemoteSelection(options) {
|
|
1746
|
-
this.rememberRemoteSelections(this.getCurrentOptions());
|
|
1747
|
-
const selectedValues = new Set(this.selectedValues);
|
|
1748
|
-
const nextOptions = options.map((option) => ({
|
|
1749
|
-
...option,
|
|
1750
|
-
selected: selectedValues.has(option.value) || Boolean(option.selected),
|
|
1751
|
-
}));
|
|
1752
|
-
this.rememberRemoteSelections(nextOptions);
|
|
1753
|
-
return nextOptions;
|
|
1754
|
-
}
|
|
1755
|
-
rememberRemoteSelections(options) {
|
|
1756
|
-
if (this.effectiveSearchMode !== 'remote')
|
|
1757
|
-
return;
|
|
1758
|
-
const visibleValues = new Set(options.map((option) => option.value));
|
|
1759
|
-
options.forEach((option) => {
|
|
1760
|
-
if (option.selected)
|
|
1761
|
-
this.remoteSelectedOptions.set(option.value, { ...option, selected: true });
|
|
1762
|
-
else if (visibleValues.has(option.value))
|
|
1763
|
-
this.remoteSelectedOptions.delete(option.value);
|
|
1764
|
-
});
|
|
1765
|
-
}
|
|
1766
|
-
getFormOptions(options) {
|
|
1767
|
-
if (this.effectiveSearchMode !== 'remote')
|
|
1768
|
-
return options;
|
|
1769
|
-
const result = options.map((option) => ({ ...option }));
|
|
1770
|
-
const existingValues = new Set(result.map((option) => option.value));
|
|
1771
|
-
this.remoteSelectedOptions.forEach((option, value) => {
|
|
1772
|
-
if (!existingValues.has(value))
|
|
1773
|
-
result.push({ ...option, selected: true });
|
|
1774
|
-
});
|
|
1775
|
-
return result;
|
|
1776
|
-
}
|
|
1777
|
-
syncFormState(options = this.getCurrentOptions()) {
|
|
1778
|
-
const selected = this.getFormOptions(options).filter((option) => option.selected && !this.isSelectAllLabel(this.getOptionLabel(option)));
|
|
1779
|
-
const selectedValues = selected.map((option) => option.value);
|
|
1780
|
-
const formValue = this.effectiveMultiple ? JSON.stringify(selectedValues) : (selectedValues[0] ?? null);
|
|
1781
|
-
safeSetFormValue(this.elementInternals, formValue);
|
|
1782
|
-
this.syncNativeSelectSelection(selectedValues);
|
|
1783
|
-
this.updateValidity(selectedValues.length);
|
|
1784
|
-
}
|
|
1785
|
-
syncNativeSelectSelection(values = this.getSelectedValues()) {
|
|
1786
|
-
const nativeSelect = this.getNativeSelect();
|
|
1787
|
-
if (!nativeSelect)
|
|
1788
|
-
return;
|
|
1789
|
-
const selectedValues = new Set(values);
|
|
1790
|
-
Array.from(nativeSelect.options).forEach((option) => {
|
|
1791
|
-
option.selected = option.value === '' ? selectedValues.size === 0 : selectedValues.has(option.value);
|
|
1792
|
-
});
|
|
1793
|
-
}
|
|
1794
|
-
getSelectedValues() {
|
|
1795
|
-
return [...this.selectedValues];
|
|
1796
|
-
}
|
|
1797
|
-
updateValidity(selectedCount = this.getSelectedValues().length) {
|
|
1798
|
-
const nativeSelect = this.getNativeSelect();
|
|
1799
|
-
if (!nativeSelect)
|
|
1800
|
-
return;
|
|
1801
|
-
const selectionMessage = this.effectiveMultiple && this.effectiveMinSelections > 0 && selectedCount < this.effectiveMinSelections
|
|
1802
|
-
? `Selecione pelo menos ${this.effectiveMinSelections} opções.`
|
|
1803
|
-
: this.effectiveMultiple && this.effectiveMaxSelections > 0 && selectedCount > this.effectiveMaxSelections
|
|
1804
|
-
? `Selecione no máximo ${this.effectiveMaxSelections} opções.`
|
|
1805
|
-
: '';
|
|
1806
|
-
nativeSelect.setCustomValidity(this.customValidationMessage || this.validatorMessage || selectionMessage);
|
|
1807
|
-
syncNativeFormValidity(this.elementInternals, nativeSelect);
|
|
1808
|
-
void this.syncComboboxAccessibility();
|
|
1809
|
-
}
|
|
1810
|
-
getNativeSelect() {
|
|
1811
|
-
return (this.el.shadowRoot?.querySelector('select[part="hidden-select"]') ??
|
|
1812
|
-
this.nativeSelect);
|
|
1813
|
-
}
|
|
1814
|
-
resolveValidator() {
|
|
1815
|
-
return resolveFormValidator(this.validator);
|
|
1816
|
-
}
|
|
1817
|
-
getRenderedDisplayValue() {
|
|
1818
|
-
return this.displayValue ?? this.getDisplayValue();
|
|
1819
|
-
}
|
|
1820
|
-
/**
|
|
1821
|
-
* Retorna o id da opção atualmente ativa para consumo do `aria-activedescendant`.
|
|
1822
|
-
*
|
|
1823
|
-
* @returns O id da opção ativa ou `undefined` quando a lista está fechada.
|
|
1824
|
-
*/
|
|
1825
|
-
async syncComboboxAccessibility() {
|
|
1826
|
-
const nativeSelect = this.getNativeSelect();
|
|
1827
|
-
const invalid = this.showValidationErrors && Boolean(nativeSelect && !nativeSelect.validity.valid);
|
|
1828
|
-
const errorMessage = !invalid
|
|
1829
|
-
? ''
|
|
1830
|
-
: nativeSelect?.validity.customError
|
|
1831
|
-
? nativeSelect.validationMessage
|
|
1832
|
-
: nativeSelect?.validity.valueMissing
|
|
1833
|
-
? 'Este campo é obrigatório.'
|
|
1834
|
-
: nativeSelect?.validationMessage || '';
|
|
1835
|
-
this.validationErrorMessage = errorMessage;
|
|
1836
|
-
await this.selectInputElement?.syncCombobox?.({
|
|
1837
|
-
options: this.getNavigableOptions(),
|
|
1838
|
-
activeIndex: this.effectiveOpen ? this.activeOptionIndex : -1,
|
|
1839
|
-
expanded: this.effectiveOpen,
|
|
1840
|
-
multiple: this.effectiveMultiple,
|
|
1841
|
-
label: this.getAccessibleLabel(),
|
|
1842
|
-
loading: this.loading,
|
|
1843
|
-
required: this.required,
|
|
1844
|
-
invalid,
|
|
1845
|
-
errorMessage,
|
|
1846
|
-
});
|
|
1847
|
-
}
|
|
1848
|
-
/**
|
|
1849
|
-
* Indica se o clique atual foi o mesmo que deu foco ao campo e abriu a lista,
|
|
1850
|
-
* limpando o estado do ponteiro. Esse clique não deve alternar a lista de novo.
|
|
1851
|
-
*/
|
|
1852
|
-
consumeFocusOpenClick() {
|
|
1853
|
-
const skip = this.skipSelectInputClickToggle;
|
|
1854
|
-
this.skipSelectInputClickToggle = false;
|
|
1855
|
-
this.isSelectInputPointerDown = false;
|
|
1856
|
-
return skip;
|
|
1857
|
-
}
|
|
1858
|
-
toggleOpenFromPointer() {
|
|
1859
|
-
if (!this.effectiveOpen) {
|
|
1860
|
-
this.shouldRestoreSelectedOptionOnOpen = true;
|
|
1861
|
-
}
|
|
1862
|
-
void this.toggleOpen();
|
|
1863
|
-
}
|
|
1864
|
-
async openListAndRestorePointerFocus() {
|
|
1865
|
-
await this.selectListElement?.open();
|
|
1866
|
-
if (!this.shouldRestoreSelectedOptionOnOpen)
|
|
1867
|
-
return;
|
|
1868
|
-
this.shouldRestoreSelectedOptionOnOpen = false;
|
|
1869
|
-
await this.scrollFirstSelectedOptionToTop();
|
|
1870
|
-
}
|
|
1871
|
-
async scrollFirstSelectedOptionToTop() {
|
|
1872
|
-
const options = this.getNavigableOptions();
|
|
1873
|
-
const firstSelectedIndex = options.findIndex((option) => !this.isSelectAllLabel(this.getOptionLabel(option)) && Boolean(option.selected));
|
|
1874
|
-
if (firstSelectedIndex < 0)
|
|
1875
|
-
return;
|
|
1876
|
-
const didScroll = await this.getSelectListController()?.scrollFirstSelectedOptionToTop?.();
|
|
1877
|
-
if (didScroll) {
|
|
1878
|
-
this.activeOptionIndex = firstSelectedIndex;
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
async openAndFocusBoundary(fromInput, direction) {
|
|
1882
|
-
if (!this.effectiveOpen) {
|
|
1883
|
-
await this.show();
|
|
1884
|
-
await this.selectListElement?.open?.();
|
|
1885
|
-
await this.focusInitialOption(direction);
|
|
1886
|
-
return;
|
|
1887
|
-
}
|
|
1888
|
-
if (fromInput && this.activeOptionIndex < 0) {
|
|
1889
|
-
await this.focusInitialOption(direction);
|
|
1890
|
-
return;
|
|
1891
|
-
}
|
|
1892
|
-
await this.moveActiveOption(direction);
|
|
1893
|
-
}
|
|
1894
|
-
async focusOptionByTypedCharacters(character) {
|
|
1895
|
-
const now = Date.now();
|
|
1896
|
-
this.typeAhead = now - this.lastTypeAheadTime < 700 ? this.typeAhead + character : character;
|
|
1897
|
-
this.lastTypeAheadTime = now;
|
|
1898
|
-
const options = this.getNavigableOptions();
|
|
1899
|
-
if (!options.length)
|
|
1900
|
-
return;
|
|
1901
|
-
const normalize = (value) => value
|
|
1902
|
-
.normalize('NFD')
|
|
1903
|
-
.replace(/[\u0300-\u036f]/g, '')
|
|
1904
|
-
.toLocaleLowerCase('pt-BR');
|
|
1905
|
-
const search = (query) => {
|
|
1906
|
-
for (let offset = 1; offset <= options.length; offset++) {
|
|
1907
|
-
const index = (this.activeOptionIndex + offset + options.length) % options.length;
|
|
1908
|
-
const option = options[index];
|
|
1909
|
-
if (!option.disabled && normalize(this.getOptionLabel(option)).startsWith(normalize(query)))
|
|
1910
|
-
return index;
|
|
1911
|
-
}
|
|
1912
|
-
return -1;
|
|
1913
|
-
};
|
|
1914
|
-
let index = search(this.typeAhead);
|
|
1915
|
-
if (index < 0 && /^(.)(\1)+$/u.test(this.typeAhead))
|
|
1916
|
-
index = search(character);
|
|
1917
|
-
if (index < 0)
|
|
1918
|
-
return;
|
|
1919
|
-
if (!this.effectiveOpen)
|
|
1920
|
-
await this.show();
|
|
1921
|
-
await this.focusOptionByIndex(index);
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
* Define qual opção deve receber foco ao abrir ou iniciar a navegação pelo teclado.
|
|
1925
|
-
*
|
|
1926
|
-
* @param direction Direção inicial da navegação. `1` avança e `-1` recua.
|
|
1927
|
-
*/
|
|
1928
|
-
async focusInitialOption(direction) {
|
|
1929
|
-
const options = this.getNavigableOptions();
|
|
1930
|
-
if (options.length === 0)
|
|
1931
|
-
return;
|
|
1932
|
-
const selectedIndex = options.findIndex((option) => !option.disabled && !this.isSelectAllOption(option) && Boolean(option.selected));
|
|
1933
|
-
if (selectedIndex >= 0) {
|
|
1934
|
-
let nextIndex = selectedIndex + direction;
|
|
1935
|
-
while (nextIndex >= 0 && nextIndex < options.length && options[nextIndex].disabled)
|
|
1936
|
-
nextIndex += direction;
|
|
1937
|
-
await this.focusOptionByIndex(nextIndex >= 0 && nextIndex < options.length ? nextIndex : selectedIndex, true);
|
|
1938
|
-
return;
|
|
1939
|
-
}
|
|
1940
|
-
const fallbackIndex = direction > 0
|
|
1941
|
-
? options.findIndex((option) => !option.disabled)
|
|
1942
|
-
: options.map((option) => !option.disabled).lastIndexOf(true);
|
|
1943
|
-
const initialIndex = selectedIndex >= 0 ? selectedIndex : fallbackIndex;
|
|
1944
|
-
await this.focusOptionByIndex(initialIndex);
|
|
1945
|
-
}
|
|
1946
|
-
async moveActiveOption(step) {
|
|
1947
|
-
const options = this.getNavigableOptions();
|
|
1948
|
-
if (options.length === 0)
|
|
1949
|
-
return;
|
|
1950
|
-
const baseIndex = this.getCurrentActiveIndex();
|
|
1951
|
-
let nextIndex = baseIndex + step;
|
|
1952
|
-
while (nextIndex >= 0 && nextIndex < options.length && options[nextIndex].disabled)
|
|
1953
|
-
nextIndex += step;
|
|
1954
|
-
if (nextIndex >= 0 && nextIndex < options.length)
|
|
1955
|
-
await this.focusOptionByIndex(nextIndex);
|
|
1956
|
-
}
|
|
1957
|
-
/**
|
|
1958
|
-
* Resolve o índice ativo atual a partir do estado local ou da opção já selecionada.
|
|
1959
|
-
*
|
|
1960
|
-
* @returns O índice que deve servir como base para a próxima navegação por teclado.
|
|
1961
|
-
*/
|
|
1962
|
-
getCurrentActiveIndex() {
|
|
1963
|
-
if (this.activeOptionIndex >= 0)
|
|
1964
|
-
return this.activeOptionIndex;
|
|
1965
|
-
const options = this.getNavigableOptions();
|
|
1966
|
-
const selectedIndex = options.findIndex((option) => !option.disabled && !this.isSelectAllOption(option) && Boolean(option.selected));
|
|
1967
|
-
return selectedIndex >= 0 ? selectedIndex : 0;
|
|
1968
|
-
}
|
|
1969
|
-
/**
|
|
1970
|
-
* Encaminha o foco lógico para uma opção específica da lista interna.
|
|
1971
|
-
*
|
|
1972
|
-
* @param index Índice da opção que deve receber foco.
|
|
1973
|
-
* @param scrollToTop Posiciona a opção no topo da viewport quando verdadeiro.
|
|
1974
|
-
*/
|
|
1975
|
-
async focusOptionByIndex(index, scrollToTop = false) {
|
|
1976
|
-
if (!this.getNavigableOptions()[index] || this.getNavigableOptions()[index].disabled)
|
|
1977
|
-
return;
|
|
1978
|
-
this.activeOptionIndex = index;
|
|
1979
|
-
const listController = this.getSelectListController();
|
|
1980
|
-
if (scrollToTop)
|
|
1981
|
-
await listController?.scrollOptionToTop?.(index);
|
|
1982
|
-
else
|
|
1983
|
-
await listController?.revealOption?.(index);
|
|
1984
|
-
}
|
|
1985
|
-
/**
|
|
1986
|
-
* Seleciona a opção atualmente ativa sem duplicar a lógica de seleção da lista.
|
|
1987
|
-
*
|
|
1988
|
-
* @remarks
|
|
1989
|
-
* Em modo simples, confirma a opção ativa; no múltiplo, alterna sua seleção.
|
|
1990
|
-
*/
|
|
1991
|
-
async selectFocusedOption(restoreFocus = true) {
|
|
1992
|
-
const options = this.getNavigableOptions();
|
|
1993
|
-
if (options.length === 0)
|
|
1994
|
-
return;
|
|
1995
|
-
const index = this.activeOptionIndex;
|
|
1996
|
-
const option = options[index];
|
|
1997
|
-
if (!option || option.disabled)
|
|
1998
|
-
return;
|
|
1999
|
-
this.handleSelectOptionStateChange(new CustomEvent('brSelectOptionStateChange', {
|
|
2000
|
-
detail: { ...option, selected: this.effectiveMultiple ? !option.selected : true },
|
|
2001
|
-
}), restoreFocus);
|
|
2002
|
-
if (!this.effectiveMultiple && restoreFocus) {
|
|
2003
|
-
await this.close();
|
|
2004
|
-
await this.selectInputElement?.setFocus();
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
syncActiveOptionIndex(detail) {
|
|
2008
|
-
const options = this.getNavigableOptions();
|
|
2009
|
-
const optionIndex = options.findIndex((option) => option.value === detail.value);
|
|
2010
|
-
if (optionIndex >= 0) {
|
|
2011
|
-
this.activeOptionIndex = optionIndex;
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
/**
|
|
2015
|
-
* Reflete no slot a seleção que foi consolidada pela lista interna.
|
|
2016
|
-
*
|
|
2017
|
-
* @param detail Estado emitido pela opção que disparou a mudança.
|
|
2018
|
-
* @remarks
|
|
2019
|
-
* Essa sincronização mantém as props/atributos das opções declaradas pelo consumidor em
|
|
2020
|
-
* conformidade com o estado calculado internamente, inclusive no caso do "selecionar todos".
|
|
2021
|
-
*/
|
|
2022
|
-
syncSlottedOptionSelection(values = this.selectedValues) {
|
|
2023
|
-
const slottedOptions = Array.from(this.el.children).filter((el) => el.tagName.toLowerCase() === 'br-select-option');
|
|
2024
|
-
if (slottedOptions.length === 0)
|
|
2025
|
-
return;
|
|
2026
|
-
const selectedValues = new Set(values);
|
|
2027
|
-
slottedOptions.forEach((option) => {
|
|
2028
|
-
const resolved = this.optionElementToData(option).value;
|
|
2029
|
-
option.selected = selectedValues.has(resolved);
|
|
2030
|
-
option.indeterminate = false;
|
|
2031
|
-
if (option.selected)
|
|
2032
|
-
option.setAttribute('selected', '');
|
|
2033
|
-
else
|
|
2034
|
-
option.removeAttribute('selected');
|
|
2035
|
-
});
|
|
2036
|
-
if (!this.effectiveMultiple)
|
|
2037
|
-
return;
|
|
2038
|
-
const selectableOptions = slottedOptions.filter((option) => {
|
|
2039
|
-
const optionLabel = (option.label ?? option.value ?? '').trim();
|
|
2040
|
-
return !this.isSelectAllLabel(optionLabel);
|
|
2041
|
-
});
|
|
2042
|
-
const allSelected = selectableOptions.length > 0 && selectableOptions.every((option) => Boolean(option.selected));
|
|
2043
|
-
const anySelected = selectableOptions.some((option) => Boolean(option.selected));
|
|
2044
|
-
slottedOptions.forEach((option) => {
|
|
2045
|
-
const optionLabel = (option.label ?? option.value ?? '').trim();
|
|
2046
|
-
if (!this.isSelectAllLabel(optionLabel))
|
|
2047
|
-
return;
|
|
2048
|
-
option.indeterminate = anySelected && !allSelected;
|
|
2049
|
-
option.selected = allSelected;
|
|
2050
|
-
this.normalizeSelectAllState(option);
|
|
2051
|
-
if (option.selected)
|
|
2052
|
-
option.setAttribute('selected', '');
|
|
2053
|
-
else
|
|
2054
|
-
option.removeAttribute('selected');
|
|
2055
|
-
});
|
|
2056
|
-
}
|
|
2057
|
-
reflectRenderedListSelection(values, sourceOptions) {
|
|
2058
|
-
if (!this.selectListElement)
|
|
2059
|
-
return;
|
|
2060
|
-
const options = sourceOptions ?? this.getCurrentOptions();
|
|
2061
|
-
// `select-list` expõe uma coleção controlada; o pai não precisa conhecer
|
|
2062
|
-
// os nós internos (nem atravessar `shadowRoot`) para refletir a seleção.
|
|
2063
|
-
this.selectListElement.options = this.getListOptions(options.map((option) => ({ ...option, selected: values.includes(option.value) })));
|
|
2064
|
-
}
|
|
2065
|
-
isSelectAllLabel(label) {
|
|
2066
|
-
return label === this.selectAllLabel || label === this.unselectAllLabel;
|
|
2067
|
-
}
|
|
2068
|
-
isSelectAllOption(option) {
|
|
2069
|
-
return option.value === SELECT_ALL_OPTION_VALUE || this.isSelectAllLabel(this.getOptionLabel(option));
|
|
2070
|
-
}
|
|
2071
|
-
getSelectAllLabel(selected, indeterminate) {
|
|
2072
|
-
return selected && !indeterminate ? this.unselectAllLabel : this.selectAllLabel;
|
|
2073
|
-
}
|
|
2074
|
-
normalizeSelectAllState(option) {
|
|
2075
|
-
const selected = Boolean(option.selected) && !option.indeterminate;
|
|
2076
|
-
const indeterminate = Boolean(option.indeterminate);
|
|
2077
|
-
option.selected = selected;
|
|
2078
|
-
option.indeterminate = indeterminate;
|
|
2079
|
-
option.label = this.getSelectAllLabel(selected, indeterminate);
|
|
2080
|
-
}
|
|
2081
|
-
handleOutsideClick(ev) {
|
|
2082
|
-
if (!this.effectiveOpen)
|
|
2083
|
-
return;
|
|
2084
|
-
const clickPath = this.getEventPath(ev);
|
|
2085
|
-
const isClickInsideSelect = clickPath.includes(this.el);
|
|
2086
|
-
if (isClickInsideSelect)
|
|
2087
|
-
return;
|
|
2088
|
-
this.close();
|
|
2089
|
-
}
|
|
2090
|
-
emitStateChange(option) {
|
|
2091
|
-
const payload = this.getStateChangeDetail(option);
|
|
2092
|
-
const nextStateKey = JSON.stringify(payload);
|
|
2093
|
-
if (!this.isStateChangeReady) {
|
|
2094
|
-
this.lastEmittedStateKey = nextStateKey;
|
|
2095
|
-
return;
|
|
2096
|
-
}
|
|
2097
|
-
if (this.lastEmittedStateKey === nextStateKey)
|
|
2098
|
-
return;
|
|
2099
|
-
this.lastEmittedStateKey = nextStateKey;
|
|
2100
|
-
this.brSelectStateChange.emit(payload);
|
|
2101
|
-
}
|
|
2102
|
-
getStateChangeDetail(optionChange) {
|
|
2103
|
-
const payload = {
|
|
2104
|
-
isOpen: this.effectiveOpen,
|
|
2105
|
-
};
|
|
2106
|
-
const currentOptions = this.getFormOptions(this.getCurrentOptions());
|
|
2107
|
-
if (this.effectiveMultiple) {
|
|
2108
|
-
payload.options = currentOptions
|
|
2109
|
-
.filter((option) => !this.isSelectAllLabel((option.label ?? option.value).trim()))
|
|
2110
|
-
.map((option) => this.normalizeOptionForOutput(option));
|
|
2111
|
-
return payload;
|
|
2112
|
-
}
|
|
2113
|
-
const selectedOption = currentOptions.find((option) => Boolean(option.selected));
|
|
2114
|
-
if (selectedOption) {
|
|
2115
|
-
payload.option = this.normalizeOptionForOutput(selectedOption);
|
|
2116
|
-
return payload;
|
|
2117
|
-
}
|
|
2118
|
-
if (optionChange?.value) {
|
|
2119
|
-
const { disabled: _disabled, ...normalizedOption } = optionChange;
|
|
2120
|
-
payload.option = {
|
|
2121
|
-
...normalizedOption,
|
|
2122
|
-
label: optionChange.label ?? optionChange.value,
|
|
2123
|
-
};
|
|
2124
|
-
}
|
|
2125
|
-
return payload;
|
|
2126
|
-
}
|
|
2127
|
-
normalizeOptionForOutput(option) {
|
|
2128
|
-
const optionLabel = (option.label ?? option.value).trim();
|
|
2129
|
-
const isSelectAll = this.isSelectAllLabel(optionLabel);
|
|
2130
|
-
const { disabled: _disabled, ...optionWithoutDisabled } = option;
|
|
2131
|
-
if (isSelectAll) {
|
|
2132
|
-
return optionWithoutDisabled;
|
|
2133
|
-
}
|
|
2134
|
-
const { indeterminate, ...normalized } = optionWithoutDisabled;
|
|
2135
|
-
return normalized;
|
|
2136
|
-
}
|
|
2137
|
-
getStateChangeKey() {
|
|
2138
|
-
return JSON.stringify(this.getStateChangeDetail());
|
|
2139
|
-
}
|
|
2140
|
-
/**
|
|
2141
|
-
* Obtém o snapshot atual das opções respeitando a fonte mais atual disponível.
|
|
2142
|
-
*
|
|
2143
|
-
* @returns A coleção de opções normalizadas para leitura do estado público.
|
|
2144
|
-
* @remarks
|
|
2145
|
-
* A precedência é: lista interna, opções pendentes, conteúdo do slot e, por último,
|
|
2146
|
-
* os filhos atuais do host.
|
|
2147
|
-
*/
|
|
2148
|
-
getCurrentOptions() {
|
|
2149
|
-
// As opções projetadas são a fonte canônica quando não há coleção
|
|
2150
|
-
// imperativa: a lista virtualizada pode manter um snapshot enquanto o
|
|
2151
|
-
// consumidor altera `selected` diretamente no slot.
|
|
2152
|
-
if (!this.hasImperativeOptions && this.slotElement) {
|
|
2153
|
-
const nodes = this.slotElement.assignedNodes({ flatten: true }) ?? [];
|
|
2154
|
-
const slotOptions = nodes
|
|
2155
|
-
.map((node) => this.nodeToOption(node))
|
|
2156
|
-
.filter((option) => Boolean(option));
|
|
2157
|
-
if (slotOptions.length > 0) {
|
|
2158
|
-
const normalizedSlotOptions = this.applyCanonicalSelection(slotOptions);
|
|
2159
|
-
return this.getListOptions(normalizedSlotOptions);
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
const listOptions = this.getSelectListController()?.options;
|
|
2163
|
-
if (Array.isArray(listOptions) && listOptions.length > 0) {
|
|
2164
|
-
const normalizedListOptions = listOptions.map((option) => ({ ...option }));
|
|
2165
|
-
const hasRealOptions = normalizedListOptions.some((option) => !this.isSelectAllLabel(this.getOptionLabel(option)));
|
|
2166
|
-
if (hasRealOptions) {
|
|
2167
|
-
return this.getListOptions(normalizedListOptions);
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
if (this.pendingOptions) {
|
|
2171
|
-
return this.getListOptions(this.pendingOptions);
|
|
2172
|
-
}
|
|
2173
|
-
const hostOptions = this.applyCanonicalSelection(this.getHostOptions());
|
|
2174
|
-
return this.getListOptions(hostOptions);
|
|
2175
|
-
}
|
|
2176
|
-
getNavigableOptions() {
|
|
2177
|
-
const currentOptions = this.getCurrentOptions();
|
|
2178
|
-
const hostOptions = this.hasImperativeOptions ? [] : this.getHostOptions();
|
|
2179
|
-
const hostDisabledState = new Map(hostOptions.map((option) => [option.value, Boolean(option.disabled)]));
|
|
2180
|
-
const options = currentOptions.map((option) => hostDisabledState.has(option.value) ? { ...option, disabled: hostDisabledState.get(option.value) } : option);
|
|
2181
|
-
return filterSelectOptions(options, this.filterable && this.effectiveSearchMode === 'local' ? this.searchTerm : '', this.selectAllLabel, this.unselectAllLabel);
|
|
2182
|
-
}
|
|
2183
|
-
clearSearch() {
|
|
2184
|
-
if (!this.searchTerm)
|
|
2185
|
-
return;
|
|
2186
|
-
this.searchTerm = '';
|
|
2187
|
-
this.activeOptionIndex = -1;
|
|
2188
|
-
void this.getSelectListController()?.setSearchTerm?.('');
|
|
2189
|
-
}
|
|
2190
|
-
getEventPath(ev) {
|
|
2191
|
-
return ev.composedPath ? ev.composedPath() : (ev.path ?? []);
|
|
2192
|
-
}
|
|
2193
|
-
getSelectListController() {
|
|
2194
|
-
return this.selectListElement;
|
|
2195
|
-
}
|
|
2196
|
-
getCssClassMap() {
|
|
2197
|
-
return {
|
|
2198
|
-
'br-select': true,
|
|
2199
|
-
};
|
|
2200
|
-
}
|
|
2201
|
-
getAccessibleLabel() {
|
|
2202
|
-
return this.label?.trim() || this.placeholder?.trim() || 'Selecao';
|
|
2203
|
-
}
|
|
2204
|
-
setSelectionMode(isMultiple) {
|
|
2205
|
-
this.selectListElement?.setMultiple(isMultiple);
|
|
2206
|
-
}
|
|
2207
|
-
renderSelectInput() {
|
|
2208
|
-
return (h("br-select-input", { part: "input", exportparts: "container:input-container, input:input-field, label:input-label, group:input-group, icon:input-icon, action:input-action, action-button:input-action-button", ref: (el) => (this.selectInputElement = el), "aria-disabled": String(this.isDisabled()), "aria-label": this.getAccessibleLabel(), borderless: this.borderless, density: this.effectiveDensity, "is-inline": this.effectiveInline, "is-open": this.effectiveOpen, label: this.label, name: this.name, placeholder: this.placeholder, required: this.required, disabled: this.isDisabled(), filterable: this.filterable, showSearchIcon: this.showSearchIcon, autocomplete: this.effectiveAutocomplete, "input-width": this.inputWidth, value: this.filterable && this.effectiveOpen ? this.searchTerm : this.getRenderedDisplayValue() }));
|
|
2209
|
-
}
|
|
2210
|
-
renderSelectList() {
|
|
2211
|
-
return (h("br-select-list", { part: "list", "aria-hidden": "true", onMouseDown: (event) => {
|
|
2212
|
-
event.preventDefault();
|
|
2213
|
-
void this.selectInputElement?.setFocus();
|
|
2214
|
-
}, options: this.getListOptions(this.getCurrentOptions()), exportparts: "list, option, checkbox, select-all, empty-option, option-checkbox, option-radio, option-group", "active-option-index": this.isActiveIndicatorHidden ? -1 : this.activeOptionIndex, "aria-label": this.getAccessibleLabel(), "aria-multiselectable": this.effectiveMultiple ? 'true' : 'false', density: this.effectiveDensity, id: this.listboxId, "visible-items": this.effectiveVisibleItems, "item-height": this.effectiveItemHeight, overscan: this.effectiveOverscan, hideDividers: this.hideDividers, "search-term": this.filterable && this.effectiveSearchMode === 'local' ? this.searchTerm : '', role: "listbox", "select-all-label": this.selectAllLabel, "unselect-all-label": this.unselectAllLabel, ref: (el) => {
|
|
2215
|
-
this.selectListElement = el;
|
|
2216
|
-
this.selectListElement.loading = this.loading;
|
|
2217
|
-
this.setSelectionMode(this.effectiveMultiple);
|
|
2218
|
-
void this.getSelectListController()?.setSearchTerm?.(this.filterable && this.effectiveSearchMode === 'local' ? this.searchTerm : '');
|
|
2219
|
-
} }, h("slot", null), h("slot", { name: "loading", slot: "loading" })));
|
|
2220
|
-
}
|
|
2221
|
-
renderHiddenSelect() {
|
|
2222
|
-
const options = this.getFormOptions(this.getCurrentOptions()).filter((option) => !this.isSelectAllLabel(this.getOptionLabel(option)));
|
|
2223
|
-
const hasSelection = options.some((option) => option.selected);
|
|
2224
|
-
return (h("select", { ref: (el) => (this.nativeSelect = el), part: "hidden-select", name: this.name, autocomplete: this.effectiveAutocomplete, multiple: this.effectiveMultiple, required: this.required, disabled: this.isDisabled(), tabIndex: -1, "aria-hidden": "true", style: {
|
|
2225
|
-
position: 'absolute',
|
|
2226
|
-
width: '1px',
|
|
2227
|
-
height: '1px',
|
|
2228
|
-
padding: '0',
|
|
2229
|
-
margin: '-1px',
|
|
2230
|
-
overflow: 'hidden',
|
|
2231
|
-
clip: 'rect(0, 0, 0, 0)',
|
|
2232
|
-
whiteSpace: 'nowrap',
|
|
2233
|
-
border: '0',
|
|
2234
|
-
}, onChange: (event) => event.preventDefault() }, h("option", { value: "", selected: !hasSelection }), this.getNativeOptionGroups(options).map((optionGroup, groupIndex) => {
|
|
2235
|
-
const nativeOptions = optionGroup.options.map((option) => this.renderNativeOption(option));
|
|
2236
|
-
if (!optionGroup.group)
|
|
2237
|
-
return nativeOptions;
|
|
2238
|
-
return (h("optgroup", { key: `${optionGroup.group}:${groupIndex}`, label: optionGroup.group }, nativeOptions));
|
|
2239
|
-
})));
|
|
2240
|
-
}
|
|
2241
|
-
getNativeOptionGroups(options) {
|
|
2242
|
-
return options.reduce((groups, option) => {
|
|
2243
|
-
const group = option.group?.trim() || undefined;
|
|
2244
|
-
const currentGroup = groups.at(-1);
|
|
2245
|
-
if (!currentGroup || currentGroup.group !== group) {
|
|
2246
|
-
groups.push({ group, options: [option] });
|
|
2247
|
-
}
|
|
2248
|
-
else {
|
|
2249
|
-
currentGroup.options.push(option);
|
|
2250
|
-
}
|
|
2251
|
-
return groups;
|
|
2252
|
-
}, []);
|
|
2253
|
-
}
|
|
2254
|
-
renderNativeOption(option) {
|
|
2255
|
-
return (h("option", { key: option.value, value: option.value, selected: option.selected, disabled: option.disabled }));
|
|
2256
|
-
}
|
|
2257
|
-
render() {
|
|
2258
|
-
return (h(Host, { key: '4ed2f91b85ca8a208a3a090d65391b91d8dcd27b', "aria-busy": this.isValidating || this.loading ? 'true' : null }, h("div", { key: 'cef813f9d0a45140eb99bc63343991b4012c7599', class: this.getCssClassMap(), part: "container" }, this.renderSelectInput(), this.renderSelectList(), h("div", { key: '9b80f32b29b8496d35d6f77c320d777cf855ac03', part: "feedback", hidden: !this.hasFeedbackSlot && !this.validationErrorMessage }, h("slot", { key: 'd998e50ccc9ac15515ec9c58c31c444212a6a555', name: "feedback", onSlotchange: (event) => (this.hasFeedbackSlot = hasAssignedSlotContent(event.currentTarget)) }, this.validationErrorMessage ? (h("br-message", { "is-feedback": true, state: "danger", message: this.validationErrorMessage })) : null)), h("div", { key: '2bf9e897eb977caa4349242960580fd3ec9dd1bc', part: "validation-loading", hidden: !this.hasValidationLoadingSlot || !this.isValidating }, h("slot", { key: 'e0579acbfb5a288ecce89b85f8f6899640dee957', name: "validation-loading" })), this.renderHiddenSelect())));
|
|
2259
|
-
}
|
|
2260
|
-
static get formAssociated() { return true; }
|
|
2261
|
-
get el() { return getElement(this); }
|
|
2262
|
-
static get watchers() { return {
|
|
2263
|
-
"disabled": [{
|
|
2264
|
-
"handleDisabledChange": 0
|
|
2265
|
-
}],
|
|
2266
|
-
"isOpen": [{
|
|
2267
|
-
"handleIsOpenChange": 0
|
|
2268
|
-
}],
|
|
2269
|
-
"filterable": [{
|
|
2270
|
-
"handleFilterableChange": 0
|
|
2271
|
-
}],
|
|
2272
|
-
"loading": [{
|
|
2273
|
-
"handleLoadingChange": 0
|
|
2274
|
-
}],
|
|
2275
|
-
"isMultiple": [{
|
|
2276
|
-
"handleIsMultipleChange": 0
|
|
2277
|
-
}],
|
|
2278
|
-
"multiple": [{
|
|
2279
|
-
"handleMultipleChange": 0
|
|
2280
|
-
}],
|
|
2281
|
-
"open": [{
|
|
2282
|
-
"handleOpenChange": 0
|
|
2283
|
-
}],
|
|
2284
|
-
"value": [{
|
|
2285
|
-
"handleExternalValueChange": 0
|
|
2286
|
-
}],
|
|
2287
|
-
"options": [{
|
|
2288
|
-
"handleOptionsChange": 0
|
|
2289
|
-
}]
|
|
2290
|
-
}; }
|
|
2291
|
-
};
|
|
2292
|
-
Select.SELECT_ALL_LABEL = 'Selecionar todos';
|
|
2293
|
-
Select.DESELECT_ALL_LABEL = 'Desselecionar todos';
|
|
2294
|
-
Select.style = selectCss();
|
|
2295
|
-
|
|
2296
|
-
export { Dropdown as br_dropdown, Select as br_select };
|