@govbr-ds/webcomponents 2.3.0 → 2.4.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/cem/custom-elements.json +1404 -1387
- package/cem/webcomponents.html-custom-data.json +62 -56
- package/dist/cjs/br-avatar.cjs.entry.js +1 -1
- package/dist/cjs/br-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/br-button_2.cjs.entry.js +2 -2
- package/dist/cjs/br-card.cjs.entry.js +1 -1
- package/dist/cjs/br-carousel-page.cjs.entry.js +1 -1
- package/dist/cjs/br-carousel.cjs.entry.js +1 -1
- package/dist/cjs/br-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/br-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/br-collapse_2.cjs.entry.js +2 -2
- package/dist/cjs/br-cookiebar-cookie.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-group.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-header.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-link.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-note-group.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-note.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar.cjs.entry.js +1 -1
- package/dist/cjs/br-date-picker_3.cjs.entry.js +868 -516
- package/dist/cjs/br-datetime-picker.cjs.entry.js +1345 -309
- package/dist/cjs/br-divider.cjs.entry.js +1 -1
- package/dist/cjs/br-dropdown_2.cjs.entry.js +248 -129
- package/dist/cjs/br-footer-category.cjs.entry.js +1 -1
- package/dist/cjs/br-footer-item.cjs.entry.js +1 -1
- package/dist/cjs/br-footer-legal.cjs.entry.js +1 -1
- package/dist/cjs/br-footer-logo.cjs.entry.js +1 -1
- package/dist/cjs/br-footer-social.cjs.entry.js +1 -1
- package/dist/cjs/br-footer.cjs.entry.js +1 -1
- package/dist/cjs/br-header-function.cjs.entry.js +1 -1
- package/dist/cjs/br-header-link.cjs.entry.js +1 -1
- package/dist/cjs/br-header-list.cjs.entry.js +1 -1
- package/dist/cjs/br-header-logo.cjs.entry.js +1 -1
- package/dist/cjs/br-header.cjs.entry.js +1 -1
- package/dist/cjs/br-icon.cjs.entry.js +1 -1
- package/dist/cjs/br-input.cjs.entry.js +9 -3
- package/dist/cjs/br-item.cjs.entry.js +1 -1
- package/dist/cjs/br-link.cjs.entry.js +1 -1
- package/dist/cjs/br-loading.cjs.entry.js +1 -1
- package/dist/cjs/br-magic-button.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-group.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-header.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-info.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-link.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-list.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-logo.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-social.cjs.entry.js +1 -1
- package/dist/cjs/br-menu.cjs.entry.js +1 -1
- package/dist/cjs/br-modal.cjs.entry.js +1 -1
- package/dist/cjs/br-notification-body.cjs.entry.js +1 -1
- package/dist/cjs/br-notification-header.cjs.entry.js +1 -1
- package/dist/cjs/br-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/br-notification.cjs.entry.js +1 -1
- package/dist/cjs/br-pagination.cjs.entry.js +1 -1
- package/dist/cjs/br-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/br-radio.cjs.entry.js +1 -1
- package/dist/cjs/br-scrim.cjs.entry.js +1 -1
- package/dist/cjs/br-select-input_3.cjs.entry.js +282 -98
- package/dist/cjs/br-sign-in.cjs.entry.js +1 -1
- package/dist/cjs/br-skip-link.cjs.entry.js +1 -1
- package/dist/cjs/br-skiplink-item.cjs.entry.js +1 -1
- package/dist/cjs/br-slider.cjs.entry.js +1 -1
- package/dist/cjs/br-step_2.cjs.entry.js +2 -2
- package/dist/cjs/br-switch.cjs.entry.js +1 -1
- package/dist/cjs/br-tab-item.cjs.entry.js +1 -1
- package/dist/cjs/br-tab.cjs.entry.js +1 -1
- package/dist/cjs/br-table-body.cjs.entry.js +1 -1
- package/dist/cjs/br-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/br-table-header-cell.cjs.entry.js +1 -1
- package/dist/cjs/br-table-header.cjs.entry.js +1 -1
- package/dist/cjs/br-table-row.cjs.entry.js +1 -1
- package/dist/cjs/br-table.cjs.entry.js +1 -1
- package/dist/cjs/br-tag.cjs.entry.js +1 -1
- package/dist/cjs/br-textarea.cjs.entry.js +1 -1
- package/dist/cjs/br-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/br-upload.cjs.entry.js +5 -21
- package/dist/cjs/br-wizard-panel.cjs.entry.js +1 -1
- package/dist/cjs/br-wizard.cjs.entry.js +1 -1
- package/dist/cjs/{datetime-picker-constants-B5pWeOn1.js → datetime-picker-constants-CCeI5iW7.js} +20 -5
- package/dist/cjs/format-bytes-Cs8SH2w0.js +24 -0
- package/dist/cjs/index-Bc30P_6z.js +14 -14
- package/dist/cjs/{index-C92n55ch.js → index-C-IpVFDH.js} +13 -13
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{datetime-picker-props-validation-DmNKSXsy.js → isValid-CduHZTFc.js} +1 -483
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/select.utils-C38f5Kea.js +62 -0
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/avatar/avatar.css +1 -1
- package/dist/collection/components/breadcrumb/breadcrumb.css +1 -1
- package/dist/collection/components/button/button.css +1 -1
- package/dist/collection/components/card/card.css +1 -1
- package/dist/collection/components/carousel/carousel-page/carousel-page.css +1 -1
- package/dist/collection/components/carousel/carousel.css +1 -1
- package/dist/collection/components/checkbox/checkbox.css +1 -1
- package/dist/collection/components/checkbox-group/checkbox-group.css +1 -1
- package/dist/collection/components/collapse/collapse.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-cookie/cookiebar-cookie.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-group/cookiebar-group.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-header/cookiebar-header.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-link/cookiebar-link.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-note/cookiebar-note.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-note-group/cookiebar-note-group.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar.css +1 -1
- package/dist/collection/components/datetime-picker/date-picker/date-picker-locale.js +12 -12
- package/dist/collection/components/datetime-picker/date-picker/date-picker-props-validation.js +14 -13
- package/dist/collection/components/datetime-picker/date-picker/date-picker.css +1 -1
- package/dist/collection/components/datetime-picker/date-picker/date-picker.js +384 -280
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input-constants.js +59 -0
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input-props-validation.js +19 -15
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.css +1 -1
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.js +373 -211
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.types.js +1 -0
- package/dist/collection/components/datetime-picker/datetime-picker-constants.js +19 -5
- package/dist/collection/components/datetime-picker/datetime-picker-form-associated.js +92 -11
- package/dist/collection/components/datetime-picker/datetime-picker-props-validation.js +52 -33
- package/dist/collection/components/datetime-picker/datetime-picker.css +1 -1
- package/dist/collection/components/datetime-picker/datetime-picker.js +915 -362
- package/dist/collection/components/datetime-picker/datetime-picker.utils.js +62 -49
- package/dist/collection/components/datetime-picker/time-picker/time-picker-constants.js +3 -2
- package/dist/collection/components/datetime-picker/time-picker/time-picker.css +1 -1
- package/dist/collection/components/datetime-picker/time-picker/time-picker.js +148 -85
- package/dist/collection/components/divider/divider.css +1 -1
- package/dist/collection/components/dropdown/dropdown.css +1 -1
- package/dist/collection/components/footer/footer-category/footer-category.css +1 -1
- package/dist/collection/components/footer/footer-item/footer-item.css +1 -1
- package/dist/collection/components/footer/footer-legal/footer-legal.css +1 -1
- package/dist/collection/components/footer/footer-logo/footer-logo.css +1 -1
- package/dist/collection/components/footer/footer-social/footer-social.css +1 -1
- package/dist/collection/components/footer/footer.css +1 -1
- package/dist/collection/components/header/header-function/header-function.css +1 -1
- package/dist/collection/components/header/header-link/header-link.css +1 -1
- package/dist/collection/components/header/header-list/header-list.css +1 -1
- package/dist/collection/components/header/header-logo/header-logo.css +1 -1
- package/dist/collection/components/header/header.css +1 -1
- package/dist/collection/components/icon/icon.css +1 -1
- package/dist/collection/components/input/input.css +1 -1
- package/dist/collection/components/input/input.js +29 -2
- package/dist/collection/components/item/item.css +1 -1
- package/dist/collection/components/link/link.css +1 -1
- package/dist/collection/components/list/list.css +1 -1
- package/dist/collection/components/loading/loading.css +1 -1
- package/dist/collection/components/magic-button/magic-button.css +1 -1
- package/dist/collection/components/menu/menu-group/menu-group.css +1 -1
- package/dist/collection/components/menu/menu-header/menu-header.css +1 -1
- package/dist/collection/components/menu/menu-info/menu-info.css +1 -1
- package/dist/collection/components/menu/menu-item/menu-item.css +1 -1
- package/dist/collection/components/menu/menu-link/menu-link.css +1 -1
- package/dist/collection/components/menu/menu-list/menu-list.css +1 -1
- package/dist/collection/components/menu/menu-logo/menu-logo.css +1 -1
- package/dist/collection/components/menu/menu-social/menu-social.css +1 -1
- package/dist/collection/components/menu/menu.css +1 -1
- package/dist/collection/components/message/message.css +1 -1
- package/dist/collection/components/modal/modal.css +1 -1
- package/dist/collection/components/notification/notification-body/notification-body.css +1 -1
- package/dist/collection/components/notification/notification-header/notification-header.css +1 -1
- package/dist/collection/components/notification/notification-item/notification-item.css +1 -1
- package/dist/collection/components/notification/notification.css +1 -1
- package/dist/collection/components/pagination/pagination.css +1 -1
- package/dist/collection/components/radio/radio.css +1 -1
- package/dist/collection/components/radio-group/radio-group.css +1 -1
- package/dist/collection/components/scrim/scrim.css +1 -1
- package/dist/collection/components/select/select-input/select-input.css +1 -1
- package/dist/collection/components/select/select-input/select-input.js +123 -17
- package/dist/collection/components/select/select-list/select-list.css +1 -1
- package/dist/collection/components/select/select-list/select-list.js +218 -66
- package/dist/collection/components/select/select-option/select-option.css +1 -1
- package/dist/collection/components/select/select-option/select-option.js +14 -5
- package/dist/collection/components/select/select.css +1 -1
- package/dist/collection/components/select/select.js +303 -94
- package/dist/collection/components/select/select.utils.js +26 -7
- package/dist/collection/components/sign-in/sign-in.css +1 -1
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item.css +1 -1
- package/dist/collection/components/skip-link/skip-link.css +1 -1
- package/dist/collection/components/slider/slider.css +1 -1
- package/dist/collection/components/step/step-item/step-item.css +1 -1
- package/dist/collection/components/step/step.css +1 -1
- package/dist/collection/components/switch/switch.css +1 -1
- package/dist/collection/components/tab/tab-item/tab-item.css +1 -1
- package/dist/collection/components/tab/tab.css +1 -1
- package/dist/collection/components/table/table-body/table-body.css +1 -1
- package/dist/collection/components/table/table-cell/table-cell.css +1 -1
- package/dist/collection/components/table/table-header/table-header.css +1 -1
- package/dist/collection/components/table/table-header-cell/table-header-cell.css +1 -1
- package/dist/collection/components/table/table-row/table-row.css +1 -1
- package/dist/collection/components/table/table.css +1 -1
- package/dist/collection/components/tag/tag.css +1 -1
- package/dist/collection/components/textarea/textarea.css +1 -1
- package/dist/collection/components/tooltip/tooltip.css +1 -1
- package/dist/collection/components/upload/upload.css +1 -1
- package/dist/collection/components/wizard/wizard-panel/wizard-panel.css +1 -1
- package/dist/collection/components/wizard/wizard.css +1 -1
- package/dist/components/br-avatar.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-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-body.js +1 -1
- package/dist/components/br-table-cell.js +1 -1
- 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.js +1 -1
- package/dist/components/p-5h-W9_JR.js +5 -0
- package/dist/components/p-848QkYoM.js +5 -0
- package/dist/components/p-B7bNfmgh.js +5 -0
- package/dist/components/p-BFHvuEnN.js +5 -0
- package/dist/components/p-BH6QYnAr.js +5 -0
- package/dist/{webcomponents/p-5f422a69.entry.js → components/p-BcW8O6h2.js} +1 -1
- package/dist/components/p-BicHMcSS.js +5 -0
- package/dist/components/p-Bs7iRQTG.js +5 -0
- package/dist/components/{p-Nze3Utvd.js → p-Bvrw9yWR.js} +1 -1
- package/dist/components/p-BzQFMh9j.js +5 -0
- package/dist/components/p-CBHd0-fF.js +5 -0
- package/dist/components/p-CCPHCJjw.js +5 -0
- package/dist/components/{p-BcqVlof7.js → p-CbgKdASU.js} +1 -1
- package/dist/components/p-CeNELttN.js +5 -0
- package/dist/components/p-CjtmJTLO.js +5 -0
- package/dist/components/{p-CZZVc2gK.js → p-D-3G3Ioq.js} +1 -1
- package/dist/components/p-DDu3JV_r.js +5 -0
- package/dist/components/p-DFWqyfUe.js +5 -0
- package/dist/components/p-DL6xuxGG.js +5 -0
- package/dist/components/p-DOX9Uwk1.js +5 -0
- package/dist/components/p-DUq7uT2-.js +5 -0
- package/dist/components/p-Devw08cc.js +5 -0
- package/dist/components/p-Di96UxvH.js +5 -0
- package/dist/components/p-Dp3MsSXu.js +5 -0
- package/dist/components/p-DsO4F0Cz.js +5 -0
- package/dist/components/p-DuLHFTpa.js +5 -0
- package/dist/components/p-DusornQ0.js +5 -0
- package/dist/components/p-OQpiDEK9.js +5 -0
- package/dist/components/p-PV731d8s.js +5 -0
- package/dist/components/p-XW6Hp_Jk.js +5 -0
- package/dist/components/p-jOb1hCPi.js +5 -0
- package/dist/components/p-rMnkh3Cy.js +5 -0
- package/dist/components/p-ta-24T1Z.js +5 -0
- package/dist/esm/br-avatar.entry.js +1 -1
- package/dist/esm/br-breadcrumb.entry.js +1 -1
- package/dist/esm/br-button_2.entry.js +2 -2
- package/dist/esm/br-card.entry.js +1 -1
- package/dist/esm/br-carousel-page.entry.js +1 -1
- package/dist/esm/br-carousel.entry.js +2 -2
- package/dist/esm/br-checkbox-group.entry.js +1 -1
- package/dist/esm/br-checkbox.entry.js +2 -2
- package/dist/esm/br-collapse_2.entry.js +3 -3
- package/dist/esm/br-cookiebar-cookie.entry.js +1 -1
- package/dist/esm/br-cookiebar-group.entry.js +1 -1
- package/dist/esm/br-cookiebar-header.entry.js +1 -1
- package/dist/esm/br-cookiebar-link.entry.js +1 -1
- package/dist/esm/br-cookiebar-note-group.entry.js +1 -1
- package/dist/esm/br-cookiebar-note.entry.js +1 -1
- package/dist/esm/br-cookiebar.entry.js +2 -2
- package/dist/esm/br-date-picker_3.entry.js +843 -491
- package/dist/esm/br-datetime-picker.entry.js +1314 -278
- package/dist/esm/br-divider.entry.js +1 -1
- package/dist/esm/br-dropdown_2.entry.js +247 -128
- package/dist/esm/br-footer-category.entry.js +1 -1
- package/dist/esm/br-footer-item.entry.js +1 -1
- package/dist/esm/br-footer-legal.entry.js +1 -1
- package/dist/esm/br-footer-logo.entry.js +1 -1
- package/dist/esm/br-footer-social.entry.js +1 -1
- package/dist/esm/br-footer.entry.js +1 -1
- package/dist/esm/br-header-function.entry.js +1 -1
- package/dist/esm/br-header-link.entry.js +1 -1
- package/dist/esm/br-header-list.entry.js +2 -2
- package/dist/esm/br-header-logo.entry.js +1 -1
- package/dist/esm/br-header.entry.js +1 -1
- package/dist/esm/br-icon.entry.js +1 -1
- package/dist/esm/br-input.entry.js +10 -4
- package/dist/esm/br-item.entry.js +1 -1
- package/dist/esm/br-link.entry.js +1 -1
- package/dist/esm/br-loading.entry.js +1 -1
- package/dist/esm/br-magic-button.entry.js +1 -1
- package/dist/esm/br-menu-group.entry.js +1 -1
- package/dist/esm/br-menu-header.entry.js +1 -1
- package/dist/esm/br-menu-info.entry.js +1 -1
- package/dist/esm/br-menu-item.entry.js +1 -1
- package/dist/esm/br-menu-link.entry.js +1 -1
- package/dist/esm/br-menu-list.entry.js +1 -1
- package/dist/esm/br-menu-logo.entry.js +1 -1
- package/dist/esm/br-menu-social.entry.js +1 -1
- package/dist/esm/br-menu.entry.js +2 -2
- package/dist/esm/br-modal.entry.js +1 -1
- package/dist/esm/br-notification-body.entry.js +1 -1
- package/dist/esm/br-notification-header.entry.js +1 -1
- package/dist/esm/br-notification-item.entry.js +1 -1
- package/dist/esm/br-notification.entry.js +2 -2
- package/dist/esm/br-pagination.entry.js +1 -1
- package/dist/esm/br-radio-group.entry.js +2 -2
- package/dist/esm/br-radio.entry.js +2 -2
- package/dist/esm/br-scrim.entry.js +1 -1
- package/dist/esm/br-select-input_3.entry.js +282 -98
- package/dist/esm/br-sign-in.entry.js +1 -1
- package/dist/esm/br-skip-link.entry.js +1 -1
- package/dist/esm/br-skiplink-item.entry.js +1 -1
- package/dist/esm/br-slider.entry.js +2 -2
- package/dist/esm/br-step_2.entry.js +2 -2
- package/dist/esm/br-switch.entry.js +2 -2
- package/dist/esm/br-tab-item.entry.js +1 -1
- package/dist/esm/br-tab.entry.js +1 -1
- package/dist/esm/br-table-body.entry.js +1 -1
- package/dist/esm/br-table-cell.entry.js +1 -1
- package/dist/esm/br-table-header-cell.entry.js +1 -1
- package/dist/esm/br-table-header.entry.js +1 -1
- package/dist/esm/br-table-row.entry.js +1 -1
- package/dist/esm/br-table.entry.js +1 -1
- package/dist/esm/br-tag.entry.js +2 -2
- package/dist/esm/br-textarea.entry.js +2 -2
- package/dist/esm/br-tooltip.entry.js +2 -2
- package/dist/esm/br-upload.entry.js +3 -19
- package/dist/esm/br-wizard-panel.entry.js +1 -1
- package/dist/esm/br-wizard.entry.js +1 -1
- package/dist/esm/{datetime-picker-constants-BtRPYRvA.js → datetime-picker-constants-DDc4sADe.js} +20 -6
- package/dist/esm/{event-CfuJQ1DY.js → event-6Da1SZ3J.js} +1 -1
- package/dist/esm/format-bytes-B7bNfmgh.js +22 -0
- package/dist/esm/index-ConyRdJe.js +14 -14
- package/dist/esm/{index-BQPOWxe5.js → index-CytVKoHT.js} +13 -13
- package/dist/esm/index.js +2 -2
- package/dist/esm/{datetime-picker-props-validation-BeTcUTnE.js → isValid-Bee0Uvqc.js} +2 -477
- package/dist/esm/loader.js +1 -1
- package/dist/esm/select.utils-BYsh2ZdE.js +57 -0
- package/dist/esm/webcomponents.js +1 -1
- package/dist/hydrate/index.js +2979 -1673
- package/dist/hydrate/index.mjs +2979 -1673
- package/dist/types/components/datetime-picker/date-picker/date-picker-locale.d.ts +9 -9
- package/dist/types/components/datetime-picker/date-picker/date-picker-props-validation.d.ts +14 -13
- package/dist/types/components/datetime-picker/date-picker/date-picker.d.ts +264 -161
- package/dist/types/components/datetime-picker/datetime-input/datetime-input-constants.d.ts +14 -0
- package/dist/types/components/datetime-picker/datetime-input/datetime-input-props-validation.d.ts +19 -15
- package/dist/types/components/datetime-picker/datetime-input/datetime-input.d.ts +229 -98
- package/dist/types/components/datetime-picker/datetime-input/datetime-input.types.d.ts +36 -0
- package/dist/types/components/datetime-picker/datetime-picker-constants.d.ts +19 -5
- package/dist/types/components/datetime-picker/datetime-picker-form-associated.d.ts +32 -5
- package/dist/types/components/datetime-picker/datetime-picker-props-validation.d.ts +22 -24
- package/dist/types/components/datetime-picker/datetime-picker.d.ts +508 -235
- package/dist/types/components/datetime-picker/datetime-picker.types.d.ts +75 -21
- package/dist/types/components/datetime-picker/datetime-picker.utils.d.ts +53 -47
- package/dist/types/components/datetime-picker/time-picker/time-picker-constants.d.ts +3 -2
- package/dist/types/components/datetime-picker/time-picker/time-picker.d.ts +126 -55
- package/dist/types/components/input/input.d.ts +9 -1
- package/dist/types/components/input/input.types.d.ts +4 -0
- package/dist/types/components/select/select-input/select-input.d.ts +9 -2
- package/dist/types/components/select/select-list/select-list.d.ts +14 -2
- package/dist/types/components/select/select-option/select-option.d.ts +1 -0
- package/dist/types/components/select/select.d.ts +47 -7
- package/dist/types/components/select/select.types.d.ts +12 -0
- package/dist/types/components/select/select.utils.d.ts +3 -0
- package/dist/types/components.d.ts +387 -300
- package/dist/webcomponents/index.esm.js +1 -1
- package/dist/webcomponents/p-01801ac1.entry.js +5 -0
- package/dist/webcomponents/p-05b459f2.entry.js +5 -0
- package/dist/webcomponents/p-08ac6f09.entry.js +5 -0
- package/dist/webcomponents/p-09c79c1d.entry.js +5 -0
- package/dist/webcomponents/p-0fc112fc.entry.js +5 -0
- package/dist/webcomponents/p-13babfc4.entry.js +5 -0
- package/dist/webcomponents/p-15022ab7.entry.js +5 -0
- package/dist/webcomponents/p-172d42c2.entry.js +5 -0
- package/dist/webcomponents/p-18cf093a.entry.js +5 -0
- package/dist/webcomponents/p-198aa844.entry.js +5 -0
- package/dist/webcomponents/p-1ba60d13.entry.js +5 -0
- package/dist/webcomponents/p-1bb96641.entry.js +5 -0
- package/dist/webcomponents/{p-82759002.entry.js → p-20477061.entry.js} +1 -1
- package/dist/webcomponents/p-21feda62.entry.js +5 -0
- package/dist/webcomponents/p-23a5cfd7.entry.js +5 -0
- package/dist/webcomponents/{p-0b0cf355.entry.js → p-2c8595d3.entry.js} +1 -1
- package/dist/webcomponents/{p-76d51654.entry.js → p-31a4694a.entry.js} +1 -1
- package/dist/webcomponents/p-32ea6342.entry.js +5 -0
- package/dist/webcomponents/p-3658adcf.entry.js +5 -0
- package/dist/webcomponents/p-37914e63.entry.js +5 -0
- package/dist/webcomponents/p-3b0dd0ff.entry.js +5 -0
- package/dist/webcomponents/p-42b60169.entry.js +5 -0
- package/dist/webcomponents/p-42c9c6c5.entry.js +5 -0
- package/dist/{components/p-DOJ1vYOl.js → webcomponents/p-473561f2.entry.js} +1 -1
- package/dist/webcomponents/p-47c490ef.entry.js +5 -0
- package/dist/webcomponents/p-4b01c60f.entry.js +5 -0
- package/dist/webcomponents/p-5a5ed7d8.entry.js +5 -0
- package/dist/webcomponents/p-609cf652.entry.js +5 -0
- package/dist/webcomponents/p-614683d9.entry.js +5 -0
- package/dist/webcomponents/p-67605757.entry.js +5 -0
- package/dist/webcomponents/p-67774920.entry.js +5 -0
- package/dist/webcomponents/p-67d62559.entry.js +5 -0
- package/dist/webcomponents/{p-4118b878.entry.js → p-695dbeb0.entry.js} +1 -1
- package/dist/webcomponents/{p-CfuJQ1DY.js → p-6Da1SZ3J.js} +1 -1
- package/dist/webcomponents/p-6a293be8.entry.js +5 -0
- package/dist/webcomponents/{p-d5d2205c.entry.js → p-6f1a4fbe.entry.js} +1 -1
- package/dist/webcomponents/p-7352d459.entry.js +5 -0
- package/dist/webcomponents/p-745213f7.entry.js +5 -0
- package/dist/webcomponents/p-794b701b.entry.js +5 -0
- package/dist/webcomponents/p-7ee564a1.entry.js +5 -0
- package/dist/webcomponents/{p-6850e98e.entry.js → p-7fda8b89.entry.js} +1 -1
- package/dist/webcomponents/p-8116ee93.entry.js +5 -0
- package/dist/webcomponents/p-821341dc.entry.js +5 -0
- package/dist/webcomponents/p-8aa6f07c.entry.js +5 -0
- package/dist/webcomponents/p-8ddf3ce3.entry.js +5 -0
- package/dist/webcomponents/p-95f3c44a.entry.js +5 -0
- package/dist/webcomponents/p-96dbb585.entry.js +5 -0
- package/dist/webcomponents/p-9815ab95.entry.js +5 -0
- package/dist/webcomponents/{p-b02a7218.entry.js → p-9e0324a7.entry.js} +1 -1
- package/dist/webcomponents/p-B7bNfmgh.js +5 -0
- package/dist/webcomponents/p-BYsh2ZdE.js +5 -0
- package/dist/webcomponents/p-CJipT0in.js +5 -0
- package/dist/webcomponents/{p-BtRPYRvA.js → p-DDc4sADe.js} +1 -1
- package/dist/webcomponents/p-a038be16.entry.js +5 -0
- package/dist/webcomponents/p-a32d17cb.entry.js +5 -0
- package/dist/webcomponents/p-a46f068e.entry.js +5 -0
- package/dist/webcomponents/p-a89b684d.entry.js +5 -0
- package/dist/webcomponents/{p-0d2ca2f7.entry.js → p-ac68355e.entry.js} +1 -1
- package/dist/webcomponents/{p-61977114.entry.js → p-af888d13.entry.js} +1 -1
- package/dist/webcomponents/p-b0124459.entry.js +5 -0
- package/dist/webcomponents/p-b063c12f.entry.js +5 -0
- package/dist/webcomponents/p-b07bfdc5.entry.js +5 -0
- package/dist/webcomponents/{p-c1dafd8d.entry.js → p-b5d25332.entry.js} +1 -1
- package/dist/webcomponents/p-b609b464.entry.js +5 -0
- package/dist/webcomponents/p-b66ab52d.entry.js +5 -0
- package/dist/webcomponents/p-b8d4ace3.entry.js +5 -0
- package/dist/webcomponents/p-c717c745.entry.js +5 -0
- package/dist/webcomponents/p-d08b6266.entry.js +5 -0
- package/dist/webcomponents/p-d6165aa0.entry.js +5 -0
- package/dist/webcomponents/{p-14ff5865.entry.js → p-dacb7e2c.entry.js} +1 -1
- package/dist/webcomponents/p-db309a11.entry.js +5 -0
- package/dist/webcomponents/{p-19a38e20.entry.js → p-dc23cb2e.entry.js} +1 -1
- package/dist/webcomponents/p-e241caf3.entry.js +5 -0
- package/dist/webcomponents/p-e661c024.entry.js +5 -0
- package/dist/webcomponents/p-e7107869.entry.js +5 -0
- package/dist/webcomponents/p-eb94199d.entry.js +5 -0
- package/dist/webcomponents/{p-e07e309d.entry.js → p-f8993ae4.entry.js} +1 -1
- package/dist/webcomponents/{p-513ee754.entry.js → p-f99d8c9c.entry.js} +1 -1
- package/dist/webcomponents/{p-DV-iW9Aj.js → p-fOJu6uZR.js} +1 -1
- package/dist/webcomponents/{p-b16590fc.entry.js → p-fb76b1e0.entry.js} +1 -1
- package/dist/webcomponents/p-fdcb54a3.entry.js +5 -0
- package/dist/webcomponents/{p-94848046.entry.js → p-fed02286.entry.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +2 -2
- package/dist/components/p-0qmYp77w.js +0 -5
- package/dist/components/p-5c3rNBXh.js +0 -5
- package/dist/components/p-B8oIvH3q.js +0 -5
- package/dist/components/p-BECz8XWJ.js +0 -5
- package/dist/components/p-BM4Ys6hX.js +0 -5
- package/dist/components/p-BXWh9s7p.js +0 -5
- package/dist/components/p-BblZlUp2.js +0 -5
- package/dist/components/p-Bezou5CQ.js +0 -5
- package/dist/components/p-BjeUETWJ.js +0 -5
- package/dist/components/p-Cd6udSDt.js +0 -5
- package/dist/components/p-Ci0_RqAE.js +0 -5
- package/dist/components/p-CuBgClZm.js +0 -5
- package/dist/components/p-D0QYZSoP.js +0 -5
- package/dist/components/p-D4SWpW6-.js +0 -5
- package/dist/components/p-D579DS7x.js +0 -5
- package/dist/components/p-D8K7rhHd.js +0 -5
- package/dist/components/p-D9nXlCuS.js +0 -5
- package/dist/components/p-DKFO6Q_g.js +0 -5
- package/dist/components/p-DNJSSCNi.js +0 -5
- package/dist/components/p-DYI30IZL.js +0 -5
- package/dist/components/p-DcVldfL0.js +0 -5
- package/dist/components/p-DhvmHPp4.js +0 -5
- package/dist/components/p-DwgiHL0b.js +0 -5
- package/dist/components/p-WxDB6Dk4.js +0 -5
- package/dist/components/p-ZLoeVagg.js +0 -5
- package/dist/components/p-gbYJ9sfc.js +0 -5
- package/dist/components/p-uc8ABlC_.js +0 -5
- package/dist/components/p-v60ypfxD.js +0 -5
- package/dist/webcomponents/p-078bd760.entry.js +0 -5
- package/dist/webcomponents/p-07c2cdff.entry.js +0 -5
- package/dist/webcomponents/p-0d79ca44.entry.js +0 -5
- package/dist/webcomponents/p-0fe3c47b.entry.js +0 -5
- package/dist/webcomponents/p-116b53c9.entry.js +0 -5
- package/dist/webcomponents/p-1240dae7.entry.js +0 -5
- package/dist/webcomponents/p-15743a02.entry.js +0 -5
- package/dist/webcomponents/p-16cebf49.entry.js +0 -5
- package/dist/webcomponents/p-1884b9d3.entry.js +0 -5
- package/dist/webcomponents/p-1d36c8fa.entry.js +0 -5
- package/dist/webcomponents/p-1fa4b5b2.entry.js +0 -5
- package/dist/webcomponents/p-212c069b.entry.js +0 -5
- package/dist/webcomponents/p-23f37cd6.entry.js +0 -5
- package/dist/webcomponents/p-24502b63.entry.js +0 -5
- package/dist/webcomponents/p-27fb81f3.entry.js +0 -5
- package/dist/webcomponents/p-28844490.entry.js +0 -5
- package/dist/webcomponents/p-2b41bdcc.entry.js +0 -5
- package/dist/webcomponents/p-2cb1e09b.entry.js +0 -5
- package/dist/webcomponents/p-2fcda70b.entry.js +0 -5
- package/dist/webcomponents/p-3378300c.entry.js +0 -5
- package/dist/webcomponents/p-3ae9cf69.entry.js +0 -5
- package/dist/webcomponents/p-3b79cd49.entry.js +0 -5
- package/dist/webcomponents/p-3c1513ec.entry.js +0 -5
- package/dist/webcomponents/p-4534a3c3.entry.js +0 -5
- package/dist/webcomponents/p-48abf568.entry.js +0 -5
- package/dist/webcomponents/p-4e5ea05c.entry.js +0 -5
- package/dist/webcomponents/p-521a1076.entry.js +0 -5
- package/dist/webcomponents/p-59fc52c0.entry.js +0 -5
- package/dist/webcomponents/p-5a9f4ea2.entry.js +0 -5
- package/dist/webcomponents/p-71853dfc.entry.js +0 -5
- package/dist/webcomponents/p-77e242f3.entry.js +0 -5
- package/dist/webcomponents/p-7b849472.entry.js +0 -5
- package/dist/webcomponents/p-7dbfb875.entry.js +0 -5
- package/dist/webcomponents/p-7fa7f052.entry.js +0 -5
- package/dist/webcomponents/p-81c65747.entry.js +0 -5
- package/dist/webcomponents/p-91a5329f.entry.js +0 -5
- package/dist/webcomponents/p-966773a9.entry.js +0 -5
- package/dist/webcomponents/p-9abb5a53.entry.js +0 -5
- package/dist/webcomponents/p-9bf2e325.entry.js +0 -5
- package/dist/webcomponents/p-9c943b40.entry.js +0 -5
- package/dist/webcomponents/p-9ec3ca00.entry.js +0 -5
- package/dist/webcomponents/p-B0PbhaxL.js +0 -5
- package/dist/webcomponents/p-ad91f149.entry.js +0 -5
- package/dist/webcomponents/p-aeea1f17.entry.js +0 -5
- package/dist/webcomponents/p-c2ca0289.entry.js +0 -5
- package/dist/webcomponents/p-c8af334e.entry.js +0 -5
- package/dist/webcomponents/p-cac49c6a.entry.js +0 -5
- package/dist/webcomponents/p-cb9ebfbe.entry.js +0 -5
- package/dist/webcomponents/p-d11f95a0.entry.js +0 -5
- package/dist/webcomponents/p-dad03b49.entry.js +0 -5
- package/dist/webcomponents/p-db8e6322.entry.js +0 -5
- package/dist/webcomponents/p-dea8015f.entry.js +0 -5
- package/dist/webcomponents/p-e53d874b.entry.js +0 -5
- package/dist/webcomponents/p-e5540387.entry.js +0 -5
- package/dist/webcomponents/p-e94a52ac.entry.js +0 -5
- package/dist/webcomponents/p-e9be4d3f.entry.js +0 -5
- package/dist/webcomponents/p-e9db9381.entry.js +0 -5
- package/dist/webcomponents/p-edca5de1.entry.js +0 -5
- package/dist/webcomponents/p-ee5b9fc9.entry.js +0 -5
- package/dist/webcomponents/p-f4ef8c63.entry.js +0 -5
|
@@ -12,133 +12,153 @@ import { parse } from "date-fns/parse";
|
|
|
12
12
|
import { set } from "date-fns/set";
|
|
13
13
|
import { toDate } from "date-fns/toDate";
|
|
14
14
|
import { dispatchNativeFormEvent } from "../../../shared/utils/event";
|
|
15
|
-
import { reportInvalidPropValue } from "../../../shared/utils/prop-warning";
|
|
16
|
-
import { resolveAllowedPropValue } from "../../../shared/utils/props";
|
|
17
15
|
import { resolveSsrLocalDate } from "../../../shared/utils/ssr-date";
|
|
18
|
-
import {
|
|
16
|
+
import { DATETIME_RANGE_ORDER_MESSAGE } from "../datetime-picker-constants";
|
|
17
|
+
import { INPUT_FORMAT_CONFIG } from "./datetime-input-constants";
|
|
19
18
|
import { normalizeDatetimeInputMode, normalizeDatetimeInputReferenceDate, normalizeDatetimeInputValue, } from "./datetime-input-props-validation";
|
|
20
19
|
/**
|
|
21
|
-
*
|
|
20
|
+
* O `br-datetime-input` é o subcomponente de edição textual do `br-datetime-picker`, com máscara, interpretação de datas e horários e validação local sobre um `br-input` interno.
|
|
22
21
|
*
|
|
23
22
|
* ### Papel na composição
|
|
24
23
|
*
|
|
25
|
-
*
|
|
26
|
-
* - Contém o botão de acionamento para expandir ou recolher o popup do calendário.
|
|
24
|
+
* Exibe e permite editar a seleção única ou os limites de um intervalo nos modos `date`, `time` e `datetime`. Comunica alterações por `dateStateChange`, informa a validação local por `inputValidationChange` e solicita a abertura ou o fechamento do painel por `togglePicker`.
|
|
27
25
|
*
|
|
28
26
|
* ### Regra de uso e relacionamento
|
|
29
27
|
*
|
|
30
|
-
*
|
|
28
|
+
* O `br-datetime-picker` instancia este campo internamente e fornece valores e configurações por propriedades. O pai coordena a seleção com o calendário e os controles de horário; o campo não abre esses seletores por conta própria nem deve ser fornecido em slot.
|
|
31
29
|
*
|
|
32
|
-
*
|
|
30
|
+
* Prefira o `br-datetime-picker` para o controle completo. Use o campo isoladamente apenas em composições personalizadas nas quais a aplicação assuma a sincronização de estado, o tratamento dos eventos e a integração com formulários. Este subcomponente não possui a associação nativa ao formulário do orquestrador.
|
|
33
31
|
*
|
|
34
|
-
*
|
|
35
|
-
* @status stable
|
|
32
|
+
* Consulte também as [diretrizes de design do GovBR](https://www.gov.br/ds/components/datetime?tab=designer).
|
|
36
33
|
*
|
|
37
|
-
* @
|
|
38
|
-
* @part
|
|
39
|
-
* @part
|
|
34
|
+
* @see https://www.gov.br/ds/components/datetime?tab=designer
|
|
35
|
+
* @part container - Container do campo.
|
|
36
|
+
* @part input - Elemento de entrada textual interno.
|
|
37
|
+
* @part icon - Ícone de ação (calendário/relógio).
|
|
40
38
|
*/
|
|
41
39
|
export class DatetimeInput {
|
|
42
40
|
constructor() {
|
|
43
|
-
/** Valor textual exibido no campo e usado durante a edição manual. */
|
|
44
|
-
this.inputValue = '';
|
|
45
41
|
/**
|
|
46
|
-
*
|
|
42
|
+
* Texto de placeholder exibido quando o campo estiver vazio.
|
|
47
43
|
*
|
|
48
44
|
* @default ''
|
|
49
45
|
*/
|
|
50
46
|
this.placeholder = '';
|
|
51
47
|
/**
|
|
52
|
-
*
|
|
48
|
+
* Modo de entrada que controla máscara, parser e formato exibido.
|
|
53
49
|
*
|
|
54
50
|
* @default 'datetime'
|
|
55
51
|
*/
|
|
56
52
|
this.mode = 'datetime';
|
|
57
53
|
/**
|
|
58
|
-
* Data de referência
|
|
59
|
-
* Recebe uma instância de `Date` por property binding.
|
|
54
|
+
* Data de referência usada para navegação e preenchimento de valores parciais.
|
|
60
55
|
*
|
|
61
56
|
* @default new Date()
|
|
62
|
-
* @example
|
|
63
|
-
* ```js
|
|
64
|
-
* const input = document.querySelector('br-datetime-input');
|
|
65
|
-
* input.referenceDate = new Date(2026, 8, 1);
|
|
66
|
-
* ```
|
|
67
57
|
*/
|
|
68
58
|
this.referenceDate = new Date();
|
|
69
59
|
/**
|
|
70
|
-
*
|
|
71
|
-
* de `referenceDate`, que controla apenas a referência visual.
|
|
72
|
-
* Recebe uma instância de `Date` por property binding.
|
|
60
|
+
* Valor atualmente selecionado pelo componente.
|
|
73
61
|
*
|
|
74
62
|
* @default null
|
|
75
|
-
* @example
|
|
76
|
-
* ```js
|
|
77
|
-
* const input = document.querySelector('br-datetime-input');
|
|
78
|
-
* input.value = new Date(2026, 8, 7, 14, 30);
|
|
79
|
-
* ```
|
|
80
63
|
*/
|
|
81
64
|
this.value = null;
|
|
82
65
|
/**
|
|
83
|
-
*
|
|
66
|
+
* Controla os estados de read-only ou bloqueio de formulário.
|
|
84
67
|
*
|
|
85
68
|
* @default false
|
|
86
69
|
*/
|
|
87
70
|
this.disabled = false;
|
|
88
71
|
/**
|
|
89
|
-
* Define
|
|
90
|
-
* Aceita `single` ou `range`; valores inválidos usam `single`.
|
|
72
|
+
* Define o modo de seleção: `single` (valor único) ou `range` (intervalo).
|
|
91
73
|
*
|
|
92
74
|
* @default 'single'
|
|
93
75
|
*/
|
|
94
76
|
this.selectionMode = 'single';
|
|
95
77
|
/**
|
|
96
|
-
*
|
|
78
|
+
* Início do intervalo em `selectionMode === 'range'`.
|
|
97
79
|
*
|
|
98
80
|
* @default null
|
|
99
81
|
*/
|
|
100
82
|
this.rangeStart = null;
|
|
101
83
|
/**
|
|
102
|
-
*
|
|
84
|
+
* Fim do intervalo em `selectionMode === 'range'`.
|
|
103
85
|
*
|
|
104
86
|
* @default null
|
|
105
87
|
*/
|
|
106
88
|
this.rangeEnd = null;
|
|
89
|
+
/**
|
|
90
|
+
* Marcador do último texto confirmado (commit) exibido no input.
|
|
91
|
+
*
|
|
92
|
+
* @internal
|
|
93
|
+
* @type {string | null}
|
|
94
|
+
* @default null
|
|
95
|
+
*/
|
|
96
|
+
this.lastCommittedInputText = null;
|
|
97
|
+
/**
|
|
98
|
+
* Texto atual do campo usado durante a edição manual.
|
|
99
|
+
*
|
|
100
|
+
* @internal Mantido localmente; não faz parte do contrato público do componente.
|
|
101
|
+
* @type {string}
|
|
102
|
+
* @default ''
|
|
103
|
+
*/
|
|
104
|
+
this.inputValue = '';
|
|
105
|
+
/**
|
|
106
|
+
* Handler do clique no botão de ação interno.
|
|
107
|
+
*
|
|
108
|
+
* @param event - Ativação pública da ação do br-input.
|
|
109
|
+
* @returns {void}
|
|
110
|
+
*/
|
|
107
111
|
this.handleActionButtonClick = (event) => {
|
|
108
112
|
if (this.disabled)
|
|
109
113
|
return;
|
|
110
114
|
event.stopPropagation();
|
|
115
|
+
event.detail.originalEvent.stopPropagation();
|
|
111
116
|
this.togglePicker.emit();
|
|
112
117
|
};
|
|
113
118
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
119
|
+
* Blur handler: consome o evento e confirma o conteúdo atual.
|
|
120
|
+
*
|
|
121
|
+
* @param {FocusEvent} event - Evento de blur do input.
|
|
122
|
+
* @returns {void}
|
|
116
123
|
*/
|
|
117
124
|
this.handleInputBlur = (event) => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
event.stopPropagation();
|
|
126
|
+
this.commitCurrentInput();
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Handler para commit disparado pelo `change` do `br-input`.
|
|
130
|
+
*
|
|
131
|
+
* @param {Event} event - Evento de change.
|
|
132
|
+
* @returns {void}
|
|
133
|
+
*/
|
|
134
|
+
this.handleInputCommit = (event) => {
|
|
135
|
+
event.stopPropagation();
|
|
136
|
+
this.commitCurrentInput();
|
|
125
137
|
};
|
|
126
138
|
/**
|
|
127
139
|
* Atualiza o estado local com o valor digitado no campo.
|
|
128
140
|
*
|
|
129
|
-
* @param event - Evento de input
|
|
141
|
+
* @param {Event} event - Evento de input redistribuído pelo `br-input`.
|
|
142
|
+
* @returns {void}
|
|
130
143
|
*/
|
|
131
144
|
this.handleInputChange = (event) => {
|
|
145
|
+
event.stopPropagation();
|
|
132
146
|
if (this.disabled) {
|
|
133
147
|
return;
|
|
134
148
|
}
|
|
135
149
|
const input = event.target;
|
|
136
|
-
this.
|
|
150
|
+
this.lastCommittedInputText = null;
|
|
151
|
+
this.emitInputValidation(null);
|
|
152
|
+
this.setInternalInputValue(input.value ?? '');
|
|
137
153
|
};
|
|
138
154
|
/**
|
|
139
|
-
*
|
|
155
|
+
* Handler de teclado no campo de entrada.
|
|
156
|
+
*
|
|
157
|
+
* Suporta atalhos ARIA (Alt+ArrowDown / F4) para abrir/fechar o picker
|
|
158
|
+
* e Enter para confirmar a edição.
|
|
140
159
|
*
|
|
141
|
-
* @param event - Evento de teclado
|
|
160
|
+
* @param {KeyboardEvent} event - Evento de teclado.
|
|
161
|
+
* @returns {void}
|
|
142
162
|
*/
|
|
143
163
|
this.handleInputKeydown = (event) => {
|
|
144
164
|
if (this.disabled) {
|
|
@@ -150,37 +170,23 @@ export class DatetimeInput {
|
|
|
150
170
|
this.togglePicker.emit();
|
|
151
171
|
return;
|
|
152
172
|
}
|
|
153
|
-
if (event.key === 'Enter') {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
* Evita propagação do clique e solicita a abertura/fechamento do picker.
|
|
159
|
-
*
|
|
160
|
-
* @param event - Evento de clique no ícone de ação.
|
|
161
|
-
*/
|
|
162
|
-
this.handleToggleDropdown = (event) => {
|
|
163
|
-
if (this.disabled) {
|
|
164
|
-
return;
|
|
173
|
+
if (event.key === 'Enter' && event.composedPath().some((target) => target instanceof HTMLInputElement)) {
|
|
174
|
+
// Previne submissão de formulários e garante deduplicação
|
|
175
|
+
// usando a mesma rotina que blur/change usam.
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
this.commitCurrentInput();
|
|
165
178
|
}
|
|
166
|
-
event.stopPropagation();
|
|
167
|
-
this.togglePicker.emit();
|
|
168
179
|
};
|
|
169
180
|
}
|
|
170
|
-
/**
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
181
|
+
/**
|
|
182
|
+
* Watcher: sincroniza `rangeStart`/`rangeEnd` a partir de `rangeValue` controlado.
|
|
183
|
+
*
|
|
184
|
+
* @param {DatetimePickerDateRange | undefined} newValue - Novo intervalo ou `undefined`.
|
|
185
|
+
* @returns {void}
|
|
186
|
+
*/
|
|
177
187
|
handleRangeValueChange(newValue) {
|
|
178
188
|
if (!newValue)
|
|
179
189
|
return;
|
|
180
|
-
if (!isValidDatetimePickerDateRange(newValue)) {
|
|
181
|
-
reportInvalidPropValue(this.el, 'rangeValue', newValue, 'Informe um objeto com `start` e `end` como Date válido ou null.', 'Ignorando o intervalo inválido e mantendo o último intervalo efetivo.');
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
190
|
this.rangeStart = newValue.start;
|
|
185
191
|
this.rangeEnd = newValue.end;
|
|
186
192
|
this.syncInputValueFromProps();
|
|
@@ -190,6 +196,13 @@ export class DatetimeInput {
|
|
|
190
196
|
*
|
|
191
197
|
* @param newValue - Novo valor recebido via prop.
|
|
192
198
|
*/
|
|
199
|
+
/**
|
|
200
|
+
* Watcher: reage a mudanças externas em `value`, normalizando e sincronizando
|
|
201
|
+
* o texto exibido no input.
|
|
202
|
+
*
|
|
203
|
+
* @param {Date | null} newValue - Novo valor recebido via prop.
|
|
204
|
+
* @returns {void}
|
|
205
|
+
*/
|
|
193
206
|
handleValueChange(newValue) {
|
|
194
207
|
this.ensureValidValue(newValue);
|
|
195
208
|
this.syncInputValueFromProps();
|
|
@@ -199,6 +212,12 @@ export class DatetimeInput {
|
|
|
199
212
|
*
|
|
200
213
|
* @param newValue - Novo modo recebido via prop.
|
|
201
214
|
*/
|
|
215
|
+
/**
|
|
216
|
+
* Watcher: aplica normalização do `mode` e atualiza a máscara/valor exibido.
|
|
217
|
+
*
|
|
218
|
+
* @param {string} newValue - Novo modo recebido via prop.
|
|
219
|
+
* @returns {void}
|
|
220
|
+
*/
|
|
202
221
|
handleModeChange(newValue) {
|
|
203
222
|
this.ensureValidMode(newValue);
|
|
204
223
|
this.syncInputValueFromProps();
|
|
@@ -208,6 +227,12 @@ export class DatetimeInput {
|
|
|
208
227
|
*
|
|
209
228
|
* @param newValue - Nova data de referência recebida.
|
|
210
229
|
*/
|
|
230
|
+
/**
|
|
231
|
+
* Watcher: valida `referenceDate` e resina o input quando não há seleção.
|
|
232
|
+
*
|
|
233
|
+
* @param {Date} newValue - Nova data de referência recebida.
|
|
234
|
+
* @returns {void}
|
|
235
|
+
*/
|
|
211
236
|
handleReferenceDateChange(newValue) {
|
|
212
237
|
this.ensureValidReferenceDate(newValue);
|
|
213
238
|
if (this.value === null) {
|
|
@@ -219,8 +244,13 @@ export class DatetimeInput {
|
|
|
219
244
|
*
|
|
220
245
|
* @param newValue - Nova data inicial do range.
|
|
221
246
|
*/
|
|
247
|
+
/**
|
|
248
|
+
* Watcher: atualiza a representação textual quando o início do range muda.
|
|
249
|
+
*
|
|
250
|
+
* @returns {void}
|
|
251
|
+
*/
|
|
222
252
|
handleRangeStartChange() {
|
|
223
|
-
if (this.
|
|
253
|
+
if (this.selectionMode === 'range') {
|
|
224
254
|
this.syncInputValueFromProps();
|
|
225
255
|
}
|
|
226
256
|
}
|
|
@@ -229,8 +259,13 @@ export class DatetimeInput {
|
|
|
229
259
|
*
|
|
230
260
|
* @param newValue - Nova data final do range.
|
|
231
261
|
*/
|
|
262
|
+
/**
|
|
263
|
+
* Watcher: atualiza a representação textual quando o fim do range muda.
|
|
264
|
+
*
|
|
265
|
+
* @returns {void}
|
|
266
|
+
*/
|
|
232
267
|
handleRangeEndChange() {
|
|
233
|
-
if (this.
|
|
268
|
+
if (this.selectionMode === 'range') {
|
|
234
269
|
this.syncInputValueFromProps();
|
|
235
270
|
}
|
|
236
271
|
}
|
|
@@ -245,41 +280,36 @@ export class DatetimeInput {
|
|
|
245
280
|
this.syncInputValueFromProps();
|
|
246
281
|
}
|
|
247
282
|
/**
|
|
248
|
-
*
|
|
283
|
+
* Confirma o conteúdo atual evitando commits duplicados (blur + change).
|
|
249
284
|
*
|
|
250
|
-
*
|
|
251
|
-
* o browser dispara um click sintético. Adicionamos um listener imperativo para
|
|
252
|
-
* garantir que o clique no botão de ação acione o toggle. O blur é observado na raiz
|
|
253
|
-
* interna porque mover o foco do input para essa ação não desfoca o host `br-input`.
|
|
285
|
+
* @returns {void}
|
|
254
286
|
*/
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const brInput = this.el.shadowRoot?.querySelector('br-input');
|
|
258
|
-
if (!brInput)
|
|
287
|
+
commitCurrentInput() {
|
|
288
|
+
if (this.disabled)
|
|
259
289
|
return;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (!this.el.isConnected || !brInput.shadowRoot)
|
|
290
|
+
const currentText = this.inputValue.trim();
|
|
291
|
+
if (this.lastCommittedInputText === currentText)
|
|
263
292
|
return;
|
|
264
|
-
this.
|
|
265
|
-
this.
|
|
266
|
-
|
|
267
|
-
if (!actionButton)
|
|
268
|
-
return;
|
|
269
|
-
this.actionButton = actionButton;
|
|
270
|
-
// Listener para clique no botão de ação (funciona para mouse e Space/Enter via button nativo)
|
|
271
|
-
actionButton.addEventListener('click', this.handleActionButtonClick);
|
|
293
|
+
this.lastCommittedInputText = currentText;
|
|
294
|
+
this.commitInputValue();
|
|
295
|
+
this.lastCommittedInputText = this.inputValue.trim();
|
|
272
296
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Retorna a máscara delegada ao `br-input` de acordo com o modo atual.
|
|
299
|
+
*
|
|
300
|
+
* @returns {string | undefined} - Máscara a ser aplicada, ou `undefined` quando indisponível.
|
|
301
|
+
*/
|
|
302
|
+
getInputMask() {
|
|
303
|
+
if (this.selectionMode === 'range') {
|
|
304
|
+
const boundaryMask = INPUT_FORMAT_CONFIG[this.mode].mask;
|
|
305
|
+
return `${boundaryMask} - ${boundaryMask}`;
|
|
306
|
+
}
|
|
307
|
+
return INPUT_FORMAT_CONFIG[this.mode].mask;
|
|
278
308
|
}
|
|
279
309
|
/**
|
|
280
310
|
* Retorna o rótulo acessível do botão de alternância do picker.
|
|
281
311
|
*
|
|
282
|
-
* @returns Texto anunciado pelo leitor de tela para o ícone de ação.
|
|
312
|
+
* @returns {string} - Texto anunciado pelo leitor de tela para o ícone de ação.
|
|
283
313
|
*/
|
|
284
314
|
getToggleAriaLabel() {
|
|
285
315
|
switch (this.mode) {
|
|
@@ -292,9 +322,10 @@ export class DatetimeInput {
|
|
|
292
322
|
}
|
|
293
323
|
}
|
|
294
324
|
/**
|
|
295
|
-
* Normaliza
|
|
325
|
+
* Normaliza e aplica um modo válido (`date` | `time` | `datetime`).
|
|
296
326
|
*
|
|
297
|
-
* @param value - Modo informado externamente.
|
|
327
|
+
* @param {string} value - Modo informado externamente.
|
|
328
|
+
* @returns {void}
|
|
298
329
|
*/
|
|
299
330
|
ensureValidMode(value = this.mode) {
|
|
300
331
|
const normalizedMode = normalizeDatetimeInputMode(value);
|
|
@@ -303,9 +334,10 @@ export class DatetimeInput {
|
|
|
303
334
|
}
|
|
304
335
|
}
|
|
305
336
|
/**
|
|
306
|
-
* Garante que
|
|
337
|
+
* Garante que `referenceDate` seja uma `Date` válida; caso contrário, normaliza.
|
|
307
338
|
*
|
|
308
|
-
* @param value - Data de referência recebida via prop.
|
|
339
|
+
* @param {Date} value - Data de referência recebida via prop.
|
|
340
|
+
* @returns {void}
|
|
309
341
|
*/
|
|
310
342
|
ensureValidReferenceDate(value = this.referenceDate) {
|
|
311
343
|
const normalizedReferenceDate = normalizeDatetimeInputReferenceDate(value);
|
|
@@ -316,7 +348,8 @@ export class DatetimeInput {
|
|
|
316
348
|
/**
|
|
317
349
|
* Normaliza o valor selecionado para `Date` válido ou `null`.
|
|
318
350
|
*
|
|
319
|
-
* @param value - Valor recebido via prop.
|
|
351
|
+
* @param {Date | null} value - Valor recebido via prop.
|
|
352
|
+
* @returns {void}
|
|
320
353
|
*/
|
|
321
354
|
ensureValidValue(value = this.value) {
|
|
322
355
|
const normalizedValue = normalizeDatetimeInputValue(value);
|
|
@@ -326,47 +359,131 @@ export class DatetimeInput {
|
|
|
326
359
|
}
|
|
327
360
|
/**
|
|
328
361
|
* Consolida o texto digitado, tenta analisar e emite o novo estado selecionado.
|
|
362
|
+
*
|
|
363
|
+
* Trata modos `single` e `range` e valida mensagens de erro apropriadas.
|
|
364
|
+
*
|
|
365
|
+
* @returns {void}
|
|
329
366
|
*/
|
|
330
367
|
commitInputValue() {
|
|
331
368
|
const inputText = this.inputValue.trim();
|
|
332
369
|
if (inputText === '') {
|
|
370
|
+
this.emitInputValidation(true);
|
|
333
371
|
this.value = null;
|
|
334
372
|
this.dateStateChange.emit({
|
|
335
373
|
referenceDate: this.referenceDate,
|
|
336
374
|
value: null,
|
|
375
|
+
origin: this.el.tagName,
|
|
337
376
|
});
|
|
338
377
|
this.emitNativeValueChange();
|
|
339
378
|
return;
|
|
340
379
|
}
|
|
341
|
-
if (this.
|
|
380
|
+
if (this.selectionMode === 'range') {
|
|
342
381
|
const parsedRange = this.parseRangeInput(inputText);
|
|
343
|
-
if (parsedRange === null)
|
|
382
|
+
if (parsedRange === null) {
|
|
383
|
+
this.emitInputValidation(false, this.getRangeValidationMessage(inputText));
|
|
344
384
|
return;
|
|
385
|
+
}
|
|
386
|
+
if (this.mode === 'datetime' && compareAsc(parsedRange.end, parsedRange.start) < 0) {
|
|
387
|
+
this.emitInputValidation(false, DATETIME_RANGE_ORDER_MESSAGE);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
345
390
|
const normalizedRange = this.normalizeRangeBounds(parsedRange.start, parsedRange.end);
|
|
391
|
+
this.emitInputValidation(true);
|
|
346
392
|
this.rangeValue = normalizedRange;
|
|
347
|
-
this.
|
|
393
|
+
this.setInternalInputValue(`${this.formatDateByMode(normalizedRange.start)} - ${this.formatDateByMode(normalizedRange.end)}`);
|
|
348
394
|
this.value = normalizedRange.end;
|
|
349
395
|
this.dateStateChange.emit({
|
|
350
396
|
referenceDate: normalizedRange.end,
|
|
351
397
|
value: normalizedRange.end,
|
|
352
398
|
range: normalizedRange,
|
|
399
|
+
origin: this.el.tagName,
|
|
353
400
|
});
|
|
354
401
|
this.emitNativeValueChange();
|
|
355
402
|
return;
|
|
356
403
|
}
|
|
404
|
+
if (!this.isInputComplete(inputText)) {
|
|
405
|
+
this.emitInputValidation(false, this.getInputValidationMessage(inputText));
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
357
408
|
const parsed = this.parseInputValue(inputText);
|
|
358
|
-
if (parsed === null)
|
|
409
|
+
if (parsed === null) {
|
|
410
|
+
this.emitInputValidation(false, this.getInputValidationMessage(inputText));
|
|
359
411
|
return;
|
|
412
|
+
}
|
|
413
|
+
this.emitInputValidation(true);
|
|
360
414
|
const newDate = new Date(parsed);
|
|
361
415
|
newDate.setSeconds(0, 0);
|
|
362
|
-
this.
|
|
416
|
+
this.setInternalInputValue(this.formatDateByMode(newDate));
|
|
363
417
|
this.value = newDate;
|
|
364
418
|
this.dateStateChange.emit({
|
|
365
419
|
referenceDate: newDate,
|
|
366
420
|
value: newDate,
|
|
421
|
+
origin: this.el.tagName,
|
|
367
422
|
});
|
|
368
423
|
this.emitNativeValueChange();
|
|
369
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Emite o resultado da validação textual sem alterar o valor selecionado.
|
|
427
|
+
*
|
|
428
|
+
* @param {boolean} valid - Indica se a entrada é válida.
|
|
429
|
+
* @param {string} [message] - Mensagem de erro quando inválido.
|
|
430
|
+
* @returns {void}
|
|
431
|
+
*/
|
|
432
|
+
emitInputValidation(valid, message = '') {
|
|
433
|
+
this.inputValidationChange.emit({ valid, message: valid ? '' : message, origin: this.el.tagName });
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Verifica se a entrada possui a quantidade de dígitos esperada para o modo atual.
|
|
437
|
+
*
|
|
438
|
+
* @param {string} value - Texto de entrada a ser verificado.
|
|
439
|
+
* @returns {boolean} - `true` quando completo.
|
|
440
|
+
*/
|
|
441
|
+
isInputComplete(value) {
|
|
442
|
+
const digits = value.replace(/\D/g, '');
|
|
443
|
+
const config = INPUT_FORMAT_CONFIG[this.mode];
|
|
444
|
+
return config.acceptedDigitCounts.includes(digits.length);
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Retorna mensagem de validação contextual para uma entrada incompleta ou inválida.
|
|
448
|
+
*
|
|
449
|
+
* @param {string} value - Texto de entrada a ser avaliado.
|
|
450
|
+
* @returns {string} - Mensagem de validação apropriada.
|
|
451
|
+
*/
|
|
452
|
+
getInputValidationMessage(value) {
|
|
453
|
+
const digits = value.replace(/\D/g, '');
|
|
454
|
+
const config = INPUT_FORMAT_CONFIG[this.mode];
|
|
455
|
+
if (!config)
|
|
456
|
+
return 'Informe um valor válido.';
|
|
457
|
+
const digitCount = digits.length;
|
|
458
|
+
if (this.mode === 'datetime' &&
|
|
459
|
+
config.acceptedDigitCounts.includes(digitCount) &&
|
|
460
|
+
digitCount < config.fullDigitCount) {
|
|
461
|
+
return config.messages.invalid;
|
|
462
|
+
}
|
|
463
|
+
return digitCount < config.fullDigitCount ? config.messages.incomplete : config.messages.invalid;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Mensagem específica para o formato de intervalo do modo atual.
|
|
467
|
+
*
|
|
468
|
+
* @param {string} value - Texto de intervalo informado no input.
|
|
469
|
+
* @returns {string} - Mensagem de validação do intervalo.
|
|
470
|
+
*/
|
|
471
|
+
getRangeValidationMessage(value) {
|
|
472
|
+
const [startRaw = '', endRaw = ''] = value.split(/\s*-\s*/, 2);
|
|
473
|
+
const startDigits = startRaw.replace(/\D/g, '');
|
|
474
|
+
const endDigits = endRaw.replace(/\D/g, '');
|
|
475
|
+
const config = INPUT_FORMAT_CONFIG[this.mode];
|
|
476
|
+
const expectedDigits = config.fullDigitCount;
|
|
477
|
+
if (startDigits.length < expectedDigits || endDigits.length < expectedDigits) {
|
|
478
|
+
return `Complete o intervalo no formato ${config.rangeFormat}.`;
|
|
479
|
+
}
|
|
480
|
+
return config.messages.invalidRange;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Dispara eventos nativos `input` e `change` para compatibilidade com forms.
|
|
484
|
+
*
|
|
485
|
+
* @returns {void}
|
|
486
|
+
*/
|
|
370
487
|
emitNativeValueChange() {
|
|
371
488
|
dispatchNativeFormEvent(this.el, 'input');
|
|
372
489
|
dispatchNativeFormEvent(this.el, 'change');
|
|
@@ -388,55 +505,90 @@ export class DatetimeInput {
|
|
|
388
505
|
return null;
|
|
389
506
|
}
|
|
390
507
|
const base = this.referenceDate ?? toDate(new Date());
|
|
391
|
-
const parsedStart = this.
|
|
392
|
-
const parsedEnd = this.
|
|
508
|
+
const parsedStart = this.parseInputValue(startText, this.rangeStart ?? base);
|
|
509
|
+
const parsedEnd = this.parseInputValue(endText, this.rangeEnd ?? base);
|
|
393
510
|
if (parsedStart === null || parsedEnd === null) {
|
|
394
511
|
return null;
|
|
395
512
|
}
|
|
396
513
|
return { start: parsedStart, end: parsedEnd };
|
|
397
514
|
}
|
|
398
|
-
/**
|
|
515
|
+
/**
|
|
516
|
+
* Normaliza os limites do intervalo para garantir ordem cronológica.
|
|
517
|
+
*
|
|
518
|
+
* - Em `time` e `datetime` mantém os limites informados.
|
|
519
|
+
* - Em `date` reordena caso necessário.
|
|
520
|
+
*
|
|
521
|
+
* @param {Date} start - Data de início.
|
|
522
|
+
* @param {Date} end - Data de término.
|
|
523
|
+
* @returns {{ start: Date; end: Date }} - Limites normalizados.
|
|
524
|
+
*/
|
|
399
525
|
normalizeRangeBounds(start, end) {
|
|
526
|
+
if (this.mode !== 'date')
|
|
527
|
+
return { start, end };
|
|
400
528
|
return compareAsc(start, end) <= 0 ? { start, end } : { start: end, end: start };
|
|
401
529
|
}
|
|
402
530
|
/**
|
|
403
|
-
* Sincroniza o texto do
|
|
531
|
+
* Sincroniza o texto do input com as props `value`/`rangeStart`/`rangeEnd` e `mode`.
|
|
532
|
+
*
|
|
533
|
+
* @returns {void}
|
|
404
534
|
*/
|
|
405
535
|
syncInputValueFromProps() {
|
|
406
|
-
if (this.
|
|
536
|
+
if (this.selectionMode === 'range') {
|
|
407
537
|
if (this.rangeStart === null || this.rangeEnd === null) {
|
|
408
|
-
this.
|
|
538
|
+
this.setInternalInputValue('');
|
|
409
539
|
return;
|
|
410
540
|
}
|
|
411
541
|
const startFormatted = this.formatDateByMode(this.rangeStart);
|
|
412
542
|
const endFormatted = this.formatDateByMode(this.rangeEnd);
|
|
413
|
-
this.
|
|
543
|
+
this.setInternalInputValue(`${startFormatted} - ${endFormatted}`);
|
|
414
544
|
return;
|
|
415
545
|
}
|
|
416
546
|
if (this.value === null) {
|
|
417
|
-
this.
|
|
547
|
+
this.setInternalInputValue('');
|
|
418
548
|
return;
|
|
419
549
|
}
|
|
420
|
-
this.
|
|
550
|
+
this.setInternalInputValue(this.formatDateByMode(this.value));
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Retorna o elemento interno `<br-input>` quando disponível.
|
|
554
|
+
*
|
|
555
|
+
* @internal
|
|
556
|
+
* @returns {HTMLBrInputElement | null} Elemento interno `<br-input>` ou `null` se não estiver disponível.
|
|
557
|
+
*/
|
|
558
|
+
getBrInputElement() {
|
|
559
|
+
return this.el.shadowRoot?.querySelector('br-input');
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Define o valor interno do input imperativamente.
|
|
563
|
+
*
|
|
564
|
+
* @internal Define o valor interno do input sem re-renderizar o host.
|
|
565
|
+
* @param {string} value Valor a ser definido no input interno.
|
|
566
|
+
*/
|
|
567
|
+
setInternalInputValue(value) {
|
|
568
|
+
this.inputValue = value;
|
|
569
|
+
const br = this.getBrInputElement();
|
|
570
|
+
if (br) {
|
|
571
|
+
// atualiza imperativamente o componente filho sem re-renderizar o host
|
|
572
|
+
try {
|
|
573
|
+
br.value = value;
|
|
574
|
+
}
|
|
575
|
+
catch { }
|
|
576
|
+
}
|
|
421
577
|
}
|
|
422
578
|
/**
|
|
423
579
|
* Formata uma data de acordo com o modo atual do componente.
|
|
424
580
|
*
|
|
425
|
-
* @param date - Data a ser formatada para exibição no input.
|
|
426
|
-
* @returns Representação textual da data/hora no padrão esperado.
|
|
581
|
+
* @param {Date} date - Data a ser formatada para exibição no input.
|
|
582
|
+
* @returns {string} - Representação textual da data/hora no padrão esperado.
|
|
427
583
|
*/
|
|
428
584
|
formatDateByMode(date) {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
return format(date, 'dd/MM/yyyy');
|
|
432
|
-
case 'time':
|
|
433
|
-
return format(date, 'HH:mm');
|
|
434
|
-
default:
|
|
435
|
-
return format(date, 'dd/MM/yyyy HH:mm');
|
|
436
|
-
}
|
|
585
|
+
const config = INPUT_FORMAT_CONFIG[this.mode];
|
|
586
|
+
return format(date, config.displayFormat);
|
|
437
587
|
}
|
|
438
588
|
/**
|
|
439
|
-
* Retorna
|
|
589
|
+
* Retorna o mapa de classes CSS aplicado ao host do componente.
|
|
590
|
+
*
|
|
591
|
+
* @returns {CssClassMap}
|
|
440
592
|
*/
|
|
441
593
|
getCssClassMap() {
|
|
442
594
|
return {
|
|
@@ -446,7 +598,7 @@ export class DatetimeInput {
|
|
|
446
598
|
/**
|
|
447
599
|
* Seleciona o ícone do campo conforme o modo de entrada ativo.
|
|
448
600
|
*
|
|
449
|
-
* @returns Nome do ícone usado na ação lateral do input.
|
|
601
|
+
* @returns {string} - Nome do ícone usado na ação lateral do input.
|
|
450
602
|
*/
|
|
451
603
|
getInputIcon() {
|
|
452
604
|
switch (this.mode) {
|
|
@@ -459,11 +611,11 @@ export class DatetimeInput {
|
|
|
459
611
|
/**
|
|
460
612
|
* Converte o texto digitado em `Date` com base no modo configurado.
|
|
461
613
|
*
|
|
462
|
-
* @param value - Texto informado pelo usuário no input.
|
|
463
|
-
* @
|
|
614
|
+
* @param {string} value - Texto informado pelo usuário no input.
|
|
615
|
+
* @param {Date} [base] - Data base usada para completar valores parciais.
|
|
616
|
+
* @returns {Date | null} - Data convertida ou `null` quando inválida.
|
|
464
617
|
*/
|
|
465
|
-
parseInputValue(value) {
|
|
466
|
-
const base = this.value ?? this.referenceDate ?? toDate(new Date());
|
|
618
|
+
parseInputValue(value, base = this.value ?? this.referenceDate ?? toDate(new Date())) {
|
|
467
619
|
switch (this.mode) {
|
|
468
620
|
case 'date':
|
|
469
621
|
return this.parseDateInput(value, base);
|
|
@@ -478,12 +630,14 @@ export class DatetimeInput {
|
|
|
478
630
|
/**
|
|
479
631
|
* Faz parse de uma data no formato `dd/MM/yyyy`, preservando hora e minuto base.
|
|
480
632
|
*
|
|
481
|
-
* @param value - Texto de data digitado pelo usuário.
|
|
482
|
-
* @param base - Data base usada para completar informações de tempo.
|
|
483
|
-
* @returns Data válida normalizada ou `null` quando o parse falhar.
|
|
633
|
+
* @param {string} value - Texto de data digitado pelo usuário.
|
|
634
|
+
* @param {Date} base - Data base usada para completar informações de tempo.
|
|
635
|
+
* @returns {Date | null} - Data válida normalizada ou `null` quando o parse falhar.
|
|
484
636
|
*/
|
|
485
637
|
parseDateInput(value, base) {
|
|
486
|
-
const
|
|
638
|
+
const config = INPUT_FORMAT_CONFIG[this.mode];
|
|
639
|
+
const datePattern = config.parseFormats[0];
|
|
640
|
+
const parsedDate = parse(value, datePattern, base);
|
|
487
641
|
if (!isValid(parsedDate))
|
|
488
642
|
return null;
|
|
489
643
|
return set(parsedDate, {
|
|
@@ -496,12 +650,14 @@ export class DatetimeInput {
|
|
|
496
650
|
/**
|
|
497
651
|
* Faz parse de hora no formato `HH:mm`, preservando o dia da data base.
|
|
498
652
|
*
|
|
499
|
-
* @param value - Texto de hora digitado pelo usuário.
|
|
500
|
-
* @param base - Data base usada para manter dia, mês e ano.
|
|
501
|
-
* @returns Data válida com hora ajustada ou `null` quando inválida.
|
|
653
|
+
* @param {string} value - Texto de hora digitado pelo usuário.
|
|
654
|
+
* @param {Date} base - Data base usada para manter dia, mês e ano.
|
|
655
|
+
* @returns {Date | null} - Data válida com hora ajustada ou `null` quando inválida.
|
|
502
656
|
*/
|
|
503
657
|
parseTimeInput(value, base) {
|
|
504
|
-
const
|
|
658
|
+
const config = INPUT_FORMAT_CONFIG[this.mode];
|
|
659
|
+
const timePattern = config.parseFormats[0];
|
|
660
|
+
const parsedTime = parse(value, timePattern, base);
|
|
505
661
|
if (!isValid(parsedTime))
|
|
506
662
|
return null;
|
|
507
663
|
return set(base, {
|
|
@@ -512,20 +668,23 @@ export class DatetimeInput {
|
|
|
512
668
|
});
|
|
513
669
|
}
|
|
514
670
|
/**
|
|
515
|
-
* Faz parse de data e hora completas,
|
|
671
|
+
* Faz parse de data e hora completas, aceitando somente a data como fallback.
|
|
516
672
|
*
|
|
517
|
-
* @param value - Texto digitado no input.
|
|
518
|
-
* @param base - Data base usada como contexto para completar o parse.
|
|
519
|
-
* @returns Data válida a partir da entrada ou `null` quando não reconhecida.
|
|
673
|
+
* @param {string} value - Texto digitado no input.
|
|
674
|
+
* @param {Date} base - Data base usada como contexto para completar o parse.
|
|
675
|
+
* @returns {Date | null} - Data válida a partir da entrada ou `null` quando não reconhecida.
|
|
520
676
|
*/
|
|
521
677
|
parseDateTimeInput(value, base) {
|
|
678
|
+
const config = INPUT_FORMAT_CONFIG[this.mode];
|
|
679
|
+
const fullPattern = config.parseFormats[0];
|
|
680
|
+
const fallbackDatePattern = config.parseFormats[1];
|
|
522
681
|
// data + hora
|
|
523
|
-
const full = parse(value,
|
|
682
|
+
const full = parse(value, fullPattern, base);
|
|
524
683
|
if (isValid(full))
|
|
525
684
|
return full;
|
|
526
|
-
//
|
|
527
|
-
const date =
|
|
528
|
-
if (date
|
|
685
|
+
// somente data -> preserva a hora da data base
|
|
686
|
+
const date = parse(value, fallbackDatePattern, base);
|
|
687
|
+
if (isValid(date)) {
|
|
529
688
|
return set(date, {
|
|
530
689
|
hours: getHours(base),
|
|
531
690
|
minutes: getMinutes(base),
|
|
@@ -533,14 +692,7 @@ export class DatetimeInput {
|
|
|
533
692
|
milliseconds: 0,
|
|
534
693
|
});
|
|
535
694
|
}
|
|
536
|
-
|
|
537
|
-
return this.parseTimeInput(value, base);
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* Renderiza o campo textual e o ícone de ação do datetime input.
|
|
541
|
-
*/
|
|
542
|
-
renderInputField() {
|
|
543
|
-
return (h("br-input", { type: "text", value: this.inputValue, placeholder: this.placeholder, disabled: this.disabled, actionLabel: this.getToggleAriaLabel(), onInput: this.handleInputChange, onKeyDown: this.handleInputKeydown, "aria-label": this.getInputAriaLabel(), part: "input" }, h("br-icon", { slot: "action", iconName: this.getInputIcon(), width: "16", height: "16", "aria-hidden": "true", onClick: this.handleToggleDropdown, part: "icon" })));
|
|
695
|
+
return null;
|
|
544
696
|
}
|
|
545
697
|
/**
|
|
546
698
|
* Retorna o rótulo acessível do campo de entrada de acordo com o modo ativo.
|
|
@@ -557,11 +709,19 @@ export class DatetimeInput {
|
|
|
557
709
|
return 'Campo de data e hora';
|
|
558
710
|
}
|
|
559
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* Renderiza o campo textual e o ícone de ação do datetime input.
|
|
714
|
+
*
|
|
715
|
+
* @returns {JSX.Element}
|
|
716
|
+
*/
|
|
717
|
+
renderInputField() {
|
|
718
|
+
return (h("br-input", { type: "text", mask: this.getInputMask(), placeholder: this.placeholder, disabled: this.disabled, actionLabel: this.getToggleAriaLabel(), onInput: this.handleInputChange, onChange: this.handleInputCommit, onBlur: this.handleInputBlur, onKeyDown: this.handleInputKeydown, onBrInputActionClick: this.handleActionButtonClick, "aria-label": this.getInputAriaLabel(), part: "input" }, h("br-icon", { slot: "action", iconName: this.getInputIcon(), width: "16", height: "16", "aria-hidden": "true", part: "icon" })));
|
|
719
|
+
}
|
|
560
720
|
/**
|
|
561
721
|
* Renderização principal do componente.
|
|
562
722
|
*/
|
|
563
723
|
render() {
|
|
564
|
-
return (h(Host, { key: '
|
|
724
|
+
return (h(Host, { key: '40033b7b73bd1760cf07c5b4797a86e918fde54b' }, h("div", { key: '31e968efbb7a6f43acb8a67fb225d6e0159af7f9', class: this.getCssClassMap(), part: "container" }, this.renderInputField())));
|
|
565
725
|
}
|
|
566
726
|
static get is() { return "br-datetime-input"; }
|
|
567
727
|
static get encapsulation() { return "shadow"; }
|
|
@@ -593,7 +753,7 @@ export class DatetimeInput {
|
|
|
593
753
|
"name": "default",
|
|
594
754
|
"text": "''"
|
|
595
755
|
}],
|
|
596
|
-
"text": "
|
|
756
|
+
"text": "Texto de placeholder exibido quando o campo estiver vazio."
|
|
597
757
|
},
|
|
598
758
|
"getter": false,
|
|
599
759
|
"setter": false,
|
|
@@ -623,7 +783,7 @@ export class DatetimeInput {
|
|
|
623
783
|
"name": "default",
|
|
624
784
|
"text": "'datetime'"
|
|
625
785
|
}],
|
|
626
|
-
"text": "
|
|
786
|
+
"text": "Modo de entrada que controla m\u00E1scara, parser e formato exibido."
|
|
627
787
|
},
|
|
628
788
|
"getter": false,
|
|
629
789
|
"setter": false,
|
|
@@ -650,11 +810,8 @@ export class DatetimeInput {
|
|
|
650
810
|
"tags": [{
|
|
651
811
|
"name": "default",
|
|
652
812
|
"text": "new Date()"
|
|
653
|
-
}, {
|
|
654
|
-
"name": "example",
|
|
655
|
-
"text": "```js\nconst input = document.querySelector('br-datetime-input');\ninput.referenceDate = new Date(2026, 8, 1);\n```"
|
|
656
813
|
}],
|
|
657
|
-
"text": "Data de refer\u00EAncia
|
|
814
|
+
"text": "Data de refer\u00EAncia usada para navega\u00E7\u00E3o e preenchimento de valores parciais."
|
|
658
815
|
},
|
|
659
816
|
"getter": false,
|
|
660
817
|
"setter": false,
|
|
@@ -679,11 +836,8 @@ export class DatetimeInput {
|
|
|
679
836
|
"tags": [{
|
|
680
837
|
"name": "default",
|
|
681
838
|
"text": "null"
|
|
682
|
-
}, {
|
|
683
|
-
"name": "example",
|
|
684
|
-
"text": "```js\nconst input = document.querySelector('br-datetime-input');\ninput.value = new Date(2026, 8, 7, 14, 30);\n```"
|
|
685
839
|
}],
|
|
686
|
-
"text": "
|
|
840
|
+
"text": "Valor atualmente selecionado pelo componente."
|
|
687
841
|
},
|
|
688
842
|
"getter": false,
|
|
689
843
|
"setter": false,
|
|
@@ -704,7 +858,7 @@ export class DatetimeInput {
|
|
|
704
858
|
"name": "default",
|
|
705
859
|
"text": "false"
|
|
706
860
|
}],
|
|
707
|
-
"text": "
|
|
861
|
+
"text": "Controla os estados de read-only ou bloqueio de formul\u00E1rio."
|
|
708
862
|
},
|
|
709
863
|
"getter": false,
|
|
710
864
|
"setter": false,
|
|
@@ -734,7 +888,7 @@ export class DatetimeInput {
|
|
|
734
888
|
"name": "default",
|
|
735
889
|
"text": "'single'"
|
|
736
890
|
}],
|
|
737
|
-
"text": "Define
|
|
891
|
+
"text": "Define o modo de sele\u00E7\u00E3o: `single` (valor \u00FAnico) ou `range` (intervalo)."
|
|
738
892
|
},
|
|
739
893
|
"getter": false,
|
|
740
894
|
"setter": false,
|
|
@@ -762,7 +916,7 @@ export class DatetimeInput {
|
|
|
762
916
|
"name": "default",
|
|
763
917
|
"text": "null"
|
|
764
918
|
}],
|
|
765
|
-
"text": "
|
|
919
|
+
"text": "In\u00EDcio do intervalo em `selectionMode === 'range'`."
|
|
766
920
|
},
|
|
767
921
|
"getter": false,
|
|
768
922
|
"setter": false,
|
|
@@ -788,7 +942,7 @@ export class DatetimeInput {
|
|
|
788
942
|
"name": "default",
|
|
789
943
|
"text": "null"
|
|
790
944
|
}],
|
|
791
|
-
"text": "
|
|
945
|
+
"text": "Fim do intervalo em `selectionMode === 'range'`."
|
|
792
946
|
},
|
|
793
947
|
"getter": false,
|
|
794
948
|
"setter": false,
|
|
@@ -813,10 +967,10 @@ export class DatetimeInput {
|
|
|
813
967
|
"optional": true,
|
|
814
968
|
"docs": {
|
|
815
969
|
"tags": [{
|
|
816
|
-
"name": "
|
|
817
|
-
"text": "
|
|
970
|
+
"name": "type",
|
|
971
|
+
"text": "{DatetimePickerDateRange | undefined}"
|
|
818
972
|
}],
|
|
819
|
-
"text": "Intervalo controlado no modo `range
|
|
973
|
+
"text": "Intervalo controlado no modo `range` como objeto `{ start, end }`."
|
|
820
974
|
},
|
|
821
975
|
"getter": false,
|
|
822
976
|
"setter": false
|
|
@@ -831,12 +985,21 @@ export class DatetimeInput {
|
|
|
831
985
|
"cancelable": true,
|
|
832
986
|
"composed": true,
|
|
833
987
|
"docs": {
|
|
834
|
-
"tags": [
|
|
835
|
-
|
|
988
|
+
"tags": [{
|
|
989
|
+
"name": "property",
|
|
990
|
+
"text": "{Date} referenceDate - Data de refer\u00EAncia usada na navega\u00E7\u00E3o."
|
|
991
|
+
}, {
|
|
992
|
+
"name": "property",
|
|
993
|
+
"text": "{Date|null} value - Valor selecionado ou `null`."
|
|
994
|
+
}, {
|
|
995
|
+
"name": "property",
|
|
996
|
+
"text": "{DatetimePickerDateRange} [range] - Intervalo quando `selectionMode === 'range'`."
|
|
997
|
+
}],
|
|
998
|
+
"text": "Evento emitido quando o estado de data/hora muda (ap\u00F3s commit ou parsing).\n\nPayload (`detail`):"
|
|
836
999
|
},
|
|
837
1000
|
"complexType": {
|
|
838
1001
|
"original": "DatetimePickerDateState",
|
|
839
|
-
"resolved": "{ referenceDate: Date; value: Date; range?: DatetimePickerDateRange; rangeDates?: DatetimePickerRangeDateState[]; }",
|
|
1002
|
+
"resolved": "{ referenceDate: Date; value: Date; range?: DatetimePickerDateRange; rangeDates?: DatetimePickerRangeDateState[]; origin?: string; }",
|
|
840
1003
|
"references": {
|
|
841
1004
|
"DatetimePickerDateState": {
|
|
842
1005
|
"location": "import",
|
|
@@ -853,43 +1016,42 @@ export class DatetimeInput {
|
|
|
853
1016
|
"cancelable": true,
|
|
854
1017
|
"composed": true,
|
|
855
1018
|
"docs": {
|
|
856
|
-
"tags": [
|
|
857
|
-
|
|
1019
|
+
"tags": [{
|
|
1020
|
+
"name": "event",
|
|
1021
|
+
"text": "togglePicker"
|
|
1022
|
+
}],
|
|
1023
|
+
"text": "Emite uma solicita\u00E7\u00E3o ao componente pai para alternar a abertura do picker.\nEmite sem payload."
|
|
858
1024
|
},
|
|
859
1025
|
"complexType": {
|
|
860
1026
|
"original": "void",
|
|
861
1027
|
"resolved": "void",
|
|
862
1028
|
"references": {}
|
|
863
1029
|
}
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
"
|
|
870
|
-
"signature": "() => Promise<void>",
|
|
871
|
-
"parameters": [],
|
|
872
|
-
"references": {
|
|
873
|
-
"Promise": {
|
|
874
|
-
"location": "global",
|
|
875
|
-
"id": "global::Promise"
|
|
876
|
-
},
|
|
877
|
-
"HTMLElement": {
|
|
878
|
-
"location": "global",
|
|
879
|
-
"id": "global::HTMLElement"
|
|
880
|
-
}
|
|
881
|
-
},
|
|
882
|
-
"return": "Promise<void>"
|
|
883
|
-
},
|
|
1030
|
+
}, {
|
|
1031
|
+
"method": "inputValidationChange",
|
|
1032
|
+
"name": "inputValidationChange",
|
|
1033
|
+
"bubbles": true,
|
|
1034
|
+
"cancelable": true,
|
|
1035
|
+
"composed": true,
|
|
884
1036
|
"docs": {
|
|
885
|
-
"text": "Move o foco para o input interno sem expor a \u00E1rvore privada ao componente pai.",
|
|
886
1037
|
"tags": [{
|
|
887
|
-
"name": "
|
|
888
|
-
"text":
|
|
889
|
-
}
|
|
1038
|
+
"name": "property",
|
|
1039
|
+
"text": "{boolean|null} valid - Indica se o texto \u00E9 considerado v\u00E1lido (`null` enquanto edi\u00E7\u00E3o)."
|
|
1040
|
+
}, {
|
|
1041
|
+
"name": "property",
|
|
1042
|
+
"text": "{string} message - Mensagem de erro explicativa (vazia quando v\u00E1lido)."
|
|
1043
|
+
}, {
|
|
1044
|
+
"name": "property",
|
|
1045
|
+
"text": "{string} [origin] - Identificador expl\u00EDcito da origem do evento"
|
|
1046
|
+
}],
|
|
1047
|
+
"text": "Emite valida\u00E7\u00E3o do texto digitado sem alterar o valor selecionado.\n\nPayload (`detail`):"
|
|
1048
|
+
},
|
|
1049
|
+
"complexType": {
|
|
1050
|
+
"original": "{ valid: boolean | null; message: string; origin?: string }",
|
|
1051
|
+
"resolved": "{ valid: boolean; message: string; origin?: string; }",
|
|
1052
|
+
"references": {}
|
|
890
1053
|
}
|
|
891
|
-
}
|
|
892
|
-
};
|
|
1054
|
+
}];
|
|
893
1055
|
}
|
|
894
1056
|
static get elementRef() { return "el"; }
|
|
895
1057
|
static get watchers() {
|