@govbr-ds/webcomponents 2.1.0 → 2.1.2
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 +0 -11
- package/cem/custom-elements.json +272 -71
- package/dist/cjs/app-globals-DcqHuMBv.js +9 -0
- package/dist/cjs/br-avatar.cjs.entry.js +248 -0
- package/dist/cjs/br-breadcrumb-item.cjs.entry.js +45 -0
- package/dist/cjs/br-breadcrumb.cjs.entry.js +443 -0
- package/dist/cjs/br-button_2.cjs.entry.js +280 -0
- package/dist/cjs/br-card.cjs.entry.js +111 -0
- package/dist/cjs/br-carousel-page.cjs.entry.js +80 -0
- package/dist/cjs/br-carousel.cjs.entry.js +565 -0
- package/dist/cjs/br-checkbox-group.cjs.entry.js +118 -0
- package/dist/cjs/br-checkbox.cjs.entry.js +288 -0
- package/dist/cjs/br-checkgroup.cjs.entry.js +20 -0
- package/dist/cjs/br-collapse_2.cjs.entry.js +683 -0
- package/dist/cjs/br-cookiebar-cookie.cjs.entry.js +83 -0
- package/dist/cjs/br-cookiebar-group.cjs.entry.js +309 -0
- package/dist/cjs/br-cookiebar-header.cjs.entry.js +39 -0
- package/dist/cjs/br-cookiebar-link.cjs.entry.js +55 -0
- package/dist/cjs/br-cookiebar-note-group.cjs.entry.js +70 -0
- package/dist/cjs/br-cookiebar-note.cjs.entry.js +25 -0
- package/dist/cjs/br-cookiebar.cjs.entry.js +758 -0
- package/dist/cjs/br-crumb.cjs.entry.js +51 -0
- package/dist/cjs/br-date-picker_3.cjs.entry.js +2447 -0
- package/dist/cjs/br-datetime-picker.cjs.entry.js +1886 -0
- package/dist/cjs/br-divider.cjs.entry.js +225 -0
- package/dist/cjs/br-dropdown_2.cjs.entry.js +2000 -0
- package/dist/cjs/br-footer-category.cjs.entry.js +102 -0
- package/dist/cjs/br-footer-item.cjs.entry.js +52 -0
- package/dist/cjs/br-footer-legal.cjs.entry.js +41 -0
- package/dist/cjs/br-footer-logo.cjs.entry.js +104 -0
- package/dist/cjs/br-footer-social.cjs.entry.js +71 -0
- package/dist/cjs/br-footer.cjs.entry.js +92 -0
- package/dist/cjs/br-header-function.cjs.entry.js +142 -0
- package/dist/cjs/br-header-link.cjs.entry.js +60 -0
- package/dist/cjs/br-header-list.cjs.entry.js +279 -0
- package/dist/cjs/br-header-logo.cjs.entry.js +178 -0
- package/dist/cjs/br-header.cjs.entry.js +642 -0
- package/dist/cjs/br-icon.cjs.entry.js +485 -0
- package/dist/cjs/br-input.cjs.entry.js +599 -0
- package/dist/cjs/br-item.cjs.entry.js +367 -0
- package/dist/cjs/br-link.cjs.entry.js +133 -0
- package/dist/cjs/br-loading.cjs.entry.js +505 -0
- package/dist/cjs/br-magic-button.cjs.entry.js +93 -0
- package/dist/cjs/br-menu-group.cjs.entry.js +23 -0
- package/dist/cjs/br-menu-header.cjs.entry.js +47 -0
- package/dist/cjs/br-menu-info.cjs.entry.js +38 -0
- package/dist/cjs/br-menu-item.cjs.entry.js +79 -0
- package/dist/cjs/br-menu-link.cjs.entry.js +56 -0
- package/dist/cjs/br-menu-list.cjs.entry.js +149 -0
- package/dist/cjs/br-menu-logo.cjs.entry.js +75 -0
- package/dist/cjs/br-menu-social.cjs.entry.js +65 -0
- package/dist/cjs/br-menu.cjs.entry.js +993 -0
- package/dist/cjs/br-modal.cjs.entry.js +496 -0
- package/dist/cjs/br-notification-body.cjs.entry.js +71 -0
- package/dist/cjs/br-notification-header.cjs.entry.js +48 -0
- package/dist/cjs/br-notification-item.cjs.entry.js +110 -0
- package/dist/cjs/br-notification.cjs.entry.js +334 -0
- package/dist/cjs/br-pagination.cjs.entry.js +884 -0
- package/dist/cjs/br-radio-group.cjs.entry.js +428 -0
- package/dist/cjs/br-radio.cjs.entry.js +357 -0
- package/dist/cjs/br-scrim.cjs.entry.js +1336 -0
- package/dist/cjs/br-select-input_3.cjs.entry.js +988 -0
- package/dist/cjs/br-sign-in.cjs.entry.js +126 -0
- package/dist/cjs/br-skip-link-item.cjs.entry.js +20 -0
- package/dist/cjs/br-skip-link.cjs.entry.js +362 -0
- package/dist/cjs/br-skiplink-item.cjs.entry.js +192 -0
- package/dist/cjs/br-slider.cjs.entry.js +687 -0
- package/dist/cjs/br-step_2.cjs.entry.js +628 -0
- package/dist/cjs/br-switch.cjs.entry.js +245 -0
- package/dist/cjs/br-tab-item.cjs.entry.js +185 -0
- package/dist/cjs/br-tab.cjs.entry.js +397 -0
- package/dist/cjs/br-table-body.cjs.entry.js +37 -0
- package/dist/cjs/br-table-cell.cjs.entry.js +184 -0
- package/dist/cjs/br-table-header-cell.cjs.entry.js +173 -0
- package/dist/cjs/br-table-header.cjs.entry.js +37 -0
- package/dist/cjs/br-table-row.cjs.entry.js +81 -0
- package/dist/cjs/br-table.cjs.entry.js +680 -0
- package/dist/cjs/br-tag.cjs.entry.js +493 -0
- package/dist/cjs/br-textarea.cjs.entry.js +306 -0
- package/dist/cjs/br-tooltip.cjs.entry.js +627 -0
- package/dist/cjs/br-upload.cjs.entry.js +581 -0
- package/dist/cjs/br-wizard-panel.cjs.entry.js +54 -0
- package/dist/cjs/br-wizard.cjs.entry.js +708 -0
- package/dist/cjs/breakpoint-observer-P8veqXg7.js +144 -0
- package/dist/cjs/clamp-Co_hWptd.js +25 -0
- package/dist/cjs/cookiebar.utils-CB1gQwZ4.js +18 -0
- package/dist/cjs/datetime-picker-constants-B5pWeOn1.js +3827 -0
- package/dist/cjs/event-CmVdNHxl.js +56 -0
- package/dist/cjs/floating-surface-dismiss-ccdiD0KF.js +63 -0
- package/dist/cjs/floating-ui-MBI1osio.js +136 -0
- package/dist/cjs/floating-ui.dom-BUSTaaxR.js +1715 -0
- package/dist/cjs/focus-DuywwJPR.js +30 -0
- package/dist/cjs/getNextElement-R9l3JtM9.js +31 -0
- package/dist/cjs/iconify-icon-DfODV9bf.js +2307 -0
- package/dist/cjs/id-CjRFMzf6.js +20 -0
- package/dist/cjs/index-C92n55ch.js +678 -0
- package/dist/cjs/index-CRdcutym.js +3287 -0
- package/dist/cjs/index.cjs.js +12 -0
- package/dist/cjs/isNil-DO5zWc3l.js +19 -0
- package/dist/cjs/isValid-Fu3kaWNn.js +3694 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/native-dialog--Ewqm4w0.js +49 -0
- package/dist/cjs/navigation-AbzwcRCU.js +25 -0
- package/dist/cjs/parts-D5K3ae2C.js +19 -0
- package/dist/cjs/props-CScmBvKd.js +24 -0
- package/dist/cjs/raf-batcher-yc87a4dS.js +55 -0
- package/dist/cjs/slot-DAllytTj.js +48 -0
- package/dist/cjs/swipe-BU8_XE9f.js +345 -0
- package/dist/cjs/table-constants-BOPSay0B.js +183 -0
- package/dist/cjs/validator-CTCajtT9.js +123 -0
- package/dist/cjs/webcomponents.cjs.js +50 -0
- package/dist/collection/assets/icon-search.svg +6 -0
- package/dist/collection/assets/logo-negative.svg +1 -0
- package/dist/collection/assets/logo-positive.svg +1 -0
- package/dist/collection/assets/wc.svg +1 -0
- package/dist/collection/collection-manifest.json +113 -0
- package/dist/collection/components/avatar/avatar.css +1 -0
- package/dist/collection/components/avatar/avatar.js +589 -0
- package/dist/collection/components/avatar/avatar.types.js +1 -0
- package/dist/collection/components/breadcrumb/breadcrumb-item/breadcrumb-item.js +166 -0
- package/dist/collection/components/breadcrumb/breadcrumb.css +1 -0
- package/dist/collection/components/breadcrumb/breadcrumb.js +619 -0
- package/dist/collection/components/breadcrumb/breadcrumb.types.js +1 -0
- package/dist/collection/components/breadcrumb/crumb/crumb.js +175 -0
- package/dist/collection/components/button/button.css +1 -0
- package/dist/collection/components/button/button.js +546 -0
- package/dist/collection/components/button/button.types.js +1 -0
- package/dist/collection/components/card/card.css +1 -0
- package/dist/collection/components/card/card.js +225 -0
- package/dist/collection/components/carousel/carousel-page/carousel-page.css +1 -0
- package/dist/collection/components/carousel/carousel-page/carousel-page.js +195 -0
- package/dist/collection/components/carousel/carousel.css +1 -0
- package/dist/collection/components/carousel/carousel.js +1217 -0
- package/dist/collection/components/carousel/carousel.types.js +1 -0
- package/dist/collection/components/checkbox/checkbox.css +1 -0
- package/dist/collection/components/checkbox/checkbox.js +823 -0
- package/dist/collection/components/checkbox/checkbox.types.js +1 -0
- package/dist/collection/components/checkbox-group/checkbox-group.css +1 -0
- package/dist/collection/components/checkbox-group/checkbox-group.js +268 -0
- package/dist/collection/components/checkgroup/checkgroup.js +166 -0
- package/dist/collection/components/collapse/collapse.css +1 -0
- package/dist/collection/components/collapse/collapse.js +642 -0
- package/dist/collection/components/collapse/collapse.types.js +1 -0
- package/dist/collection/components/cookiebar/cookiebar-cookie/cookiebar-cookie.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-cookie/cookiebar-cookie.js +529 -0
- package/dist/collection/components/cookiebar/cookiebar-group/cookiebar-group.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-group/cookiebar-group.js +628 -0
- package/dist/collection/components/cookiebar/cookiebar-header/cookiebar-header.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-header/cookiebar-header.js +165 -0
- package/dist/collection/components/cookiebar/cookiebar-link/cookiebar-link.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-link/cookiebar-link.js +201 -0
- package/dist/collection/components/cookiebar/cookiebar-note/cookiebar-note.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-note/cookiebar-note.js +100 -0
- package/dist/collection/components/cookiebar/cookiebar-note-group/cookiebar-note-group.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-note-group/cookiebar-note-group.js +172 -0
- package/dist/collection/components/cookiebar/cookiebar.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar.js +1419 -0
- package/dist/collection/components/cookiebar/cookiebar.types.js +1 -0
- package/dist/collection/components/cookiebar/cookiebar.utils.js +14 -0
- package/dist/collection/components/datetime-picker/date-picker/date-picker-locale.js +94 -0
- package/dist/collection/components/datetime-picker/date-picker/date-picker-props-validation.js +57 -0
- package/dist/collection/components/datetime-picker/date-picker/date-picker.css +1 -0
- package/dist/collection/components/datetime-picker/date-picker/date-picker.js +913 -0
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input-props-validation.js +65 -0
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.css +1 -0
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.js +826 -0
- package/dist/collection/components/datetime-picker/datetime-picker-constants.js +36 -0
- package/dist/collection/components/datetime-picker/datetime-picker-form-associated.js +112 -0
- package/dist/collection/components/datetime-picker/datetime-picker-props-validation.js +202 -0
- package/dist/collection/components/datetime-picker/datetime-picker.css +1 -0
- package/dist/collection/components/datetime-picker/datetime-picker.js +1924 -0
- package/dist/collection/components/datetime-picker/datetime-picker.types.js +1 -0
- package/dist/collection/components/datetime-picker/datetime-picker.utils.js +250 -0
- package/dist/collection/components/datetime-picker/time-picker/time-picker-constants.js +13 -0
- package/dist/collection/components/datetime-picker/time-picker/time-picker.css +1 -0
- package/dist/collection/components/datetime-picker/time-picker/time-picker.js +456 -0
- package/dist/collection/components/divider/divider.css +1 -0
- package/dist/collection/components/divider/divider.js +537 -0
- package/dist/collection/components/divider/divider.types.js +1 -0
- package/dist/collection/components/dropdown/dropdown.css +1 -0
- package/dist/collection/components/dropdown/dropdown.js +939 -0
- package/dist/collection/components/dropdown/dropdown.types.js +1 -0
- package/dist/collection/components/footer/footer-category/footer-category.css +1 -0
- package/dist/collection/components/footer/footer-category/footer-category.js +160 -0
- package/dist/collection/components/footer/footer-item/footer-item.css +1 -0
- package/dist/collection/components/footer/footer-item/footer-item.js +154 -0
- package/dist/collection/components/footer/footer-legal/footer-legal.css +1 -0
- package/dist/collection/components/footer/footer-legal/footer-legal.js +75 -0
- package/dist/collection/components/footer/footer-logo/footer-logo.css +1 -0
- package/dist/collection/components/footer/footer-logo/footer-logo.js +342 -0
- package/dist/collection/components/footer/footer-logo/footer-logo.types.js +1 -0
- package/dist/collection/components/footer/footer-social/footer-social.css +1 -0
- package/dist/collection/components/footer/footer-social/footer-social.js +239 -0
- package/dist/collection/components/footer/footer.css +1 -0
- package/dist/collection/components/footer/footer.js +245 -0
- package/dist/collection/components/footer/footer.types.js +1 -0
- package/dist/collection/components/global.types.js +1 -0
- package/dist/collection/components/header/header-function/header-function.css +1 -0
- package/dist/collection/components/header/header-function/header-function.js +311 -0
- package/dist/collection/components/header/header-link/header-link.css +1 -0
- package/dist/collection/components/header/header-link/header-link.js +189 -0
- package/dist/collection/components/header/header-list/header-list.css +1 -0
- package/dist/collection/components/header/header-list/header-list.js +452 -0
- package/dist/collection/components/header/header-logo/header-logo.css +1 -0
- package/dist/collection/components/header/header-logo/header-logo.js +421 -0
- package/dist/collection/components/header/header.css +1 -0
- package/dist/collection/components/header/header.js +1131 -0
- package/dist/collection/components/header/header.types.js +1 -0
- package/dist/collection/components/icon/default-icons-cache.js +233 -0
- package/dist/collection/components/icon/icon.css +1 -0
- package/dist/collection/components/icon/icon.js +598 -0
- package/dist/collection/components/icon/icon.types.js +1 -0
- package/dist/collection/components/icon/icon.utils.js +33 -0
- package/dist/collection/components/input/input.css +1 -0
- package/dist/collection/components/input/input.js +1642 -0
- package/dist/collection/components/input/input.types.js +1 -0
- package/dist/collection/components/item/item.css +1 -0
- package/dist/collection/components/item/item.js +917 -0
- package/dist/collection/components/item/item.types.js +1 -0
- package/dist/collection/components/link/link.css +1 -0
- package/dist/collection/components/link/link.js +699 -0
- package/dist/collection/components/list/list.css +1 -0
- package/dist/collection/components/list/list.js +728 -0
- package/dist/collection/components/loading/loading.css +1 -0
- package/dist/collection/components/loading/loading.js +1169 -0
- package/dist/collection/components/loading/loading.types.js +1 -0
- package/dist/collection/components/magic-button/magic-button.css +1 -0
- package/dist/collection/components/magic-button/magic-button.js +238 -0
- package/dist/collection/components/menu/menu-group/menu-group.css +1 -0
- package/dist/collection/components/menu/menu-group/menu-group.js +77 -0
- package/dist/collection/components/menu/menu-header/menu-header.css +1 -0
- package/dist/collection/components/menu/menu-header/menu-header.js +161 -0
- package/dist/collection/components/menu/menu-info/menu-info.css +1 -0
- package/dist/collection/components/menu/menu-info/menu-info.js +94 -0
- package/dist/collection/components/menu/menu-item/menu-item.css +1 -0
- package/dist/collection/components/menu/menu-item/menu-item.js +306 -0
- package/dist/collection/components/menu/menu-item/menu-item.types.js +1 -0
- package/dist/collection/components/menu/menu-link/menu-link.css +1 -0
- package/dist/collection/components/menu/menu-link/menu-link.js +260 -0
- package/dist/collection/components/menu/menu-list/menu-list.css +1 -0
- package/dist/collection/components/menu/menu-list/menu-list.js +311 -0
- package/dist/collection/components/menu/menu-logo/menu-logo.css +1 -0
- package/dist/collection/components/menu/menu-logo/menu-logo.js +230 -0
- package/dist/collection/components/menu/menu-social/menu-social.css +1 -0
- package/dist/collection/components/menu/menu-social/menu-social.js +263 -0
- package/dist/collection/components/menu/menu.css +1 -0
- package/dist/collection/components/menu/menu.js +1372 -0
- package/dist/collection/components/menu/menu.types.js +1 -0
- package/dist/collection/components/menu/menu.utils.js +279 -0
- package/dist/collection/components/message/message.css +1 -0
- package/dist/collection/components/message/message.js +508 -0
- package/dist/collection/components/modal/modal.css +1 -0
- package/dist/collection/components/modal/modal.js +842 -0
- package/dist/collection/components/modal/modal.types.js +1 -0
- package/dist/collection/components/notification/notification-body/notification-body.css +1 -0
- package/dist/collection/components/notification/notification-body/notification-body.js +153 -0
- package/dist/collection/components/notification/notification-header/notification-header.css +1 -0
- package/dist/collection/components/notification/notification-header/notification-header.js +181 -0
- package/dist/collection/components/notification/notification-item/notification-item.css +1 -0
- package/dist/collection/components/notification/notification-item/notification-item.js +351 -0
- package/dist/collection/components/notification/notification-item/notification-item.types.js +1 -0
- package/dist/collection/components/notification/notification.css +1 -0
- package/dist/collection/components/notification/notification.js +838 -0
- package/dist/collection/components/notification/notification.types.js +1 -0
- package/dist/collection/components/pagination/pagination.css +1 -0
- package/dist/collection/components/pagination/pagination.js +1470 -0
- package/dist/collection/components/pagination/pagination.types.js +1 -0
- package/dist/collection/components/radio/radio.css +1 -0
- package/dist/collection/components/radio/radio.js +847 -0
- package/dist/collection/components/radio/radio.types.js +1 -0
- package/dist/collection/components/radio-group/radio-group.css +1 -0
- package/dist/collection/components/radio-group/radio-group.js +862 -0
- package/dist/collection/components/radio-group/radio-group.types.js +1 -0
- package/dist/collection/components/scrim/scrim.css +1 -0
- package/dist/collection/components/scrim/scrim.js +1825 -0
- package/dist/collection/components/scrim/scrim.types.js +1 -0
- package/dist/collection/components/scrim/scrim.utils.js +132 -0
- package/dist/collection/components/select/select-input/select-input.css +1 -0
- package/dist/collection/components/select/select-input/select-input.js +586 -0
- package/dist/collection/components/select/select-list/select-list.css +1 -0
- package/dist/collection/components/select/select-list/select-list.js +1159 -0
- package/dist/collection/components/select/select-option/select-option.css +1 -0
- package/dist/collection/components/select/select-option/select-option.js +564 -0
- package/dist/collection/components/select/select.constants.js +6 -0
- package/dist/collection/components/select/select.css +1 -0
- package/dist/collection/components/select/select.js +2692 -0
- package/dist/collection/components/select/select.types.js +1 -0
- package/dist/collection/components/select/select.utils.js +34 -0
- package/dist/collection/components/sign-in/sign-in.css +1 -0
- package/dist/collection/components/sign-in/sign-in.js +401 -0
- package/dist/collection/components/sign-in/sign-in.types.js +1 -0
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item-alias.js +103 -0
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item.css +1 -0
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item.js +450 -0
- package/dist/collection/components/skip-link/skip-link.css +1 -0
- package/dist/collection/components/skip-link/skip-link.js +699 -0
- package/dist/collection/components/skip-link/skip-link.types.js +1 -0
- package/dist/collection/components/slider/slider.css +1 -0
- package/dist/collection/components/slider/slider.js +1324 -0
- package/dist/collection/components/slider/slider.types.js +1 -0
- package/dist/collection/components/step/step-item/step-item.css +1 -0
- package/dist/collection/components/step/step-item/step-item.js +604 -0
- package/dist/collection/components/step/step-item/step-item.types.js +1 -0
- package/dist/collection/components/step/step.css +1 -0
- package/dist/collection/components/step/step.js +896 -0
- package/dist/collection/components/step/step.types.js +1 -0
- package/dist/collection/components/switch/switch.css +1 -0
- package/dist/collection/components/switch/switch.js +715 -0
- package/dist/collection/components/switch/switch.types.js +1 -0
- package/dist/collection/components/tab/tab-item/tab-item.css +1 -0
- package/dist/collection/components/tab/tab-item/tab-item.js +425 -0
- package/dist/collection/components/tab/tab.css +1 -0
- package/dist/collection/components/tab/tab.js +724 -0
- package/dist/collection/components/tab/tab.types.js +1 -0
- package/dist/collection/components/table/table-body/table-body.css +1 -0
- package/dist/collection/components/table/table-body/table-body.js +51 -0
- package/dist/collection/components/table/table-cell/table-cell.css +1 -0
- package/dist/collection/components/table/table-cell/table-cell.js +373 -0
- package/dist/collection/components/table/table-constants.js +171 -0
- package/dist/collection/components/table/table-header/table-header.css +1 -0
- package/dist/collection/components/table/table-header/table-header.js +51 -0
- package/dist/collection/components/table/table-header-cell/table-header-cell.css +1 -0
- package/dist/collection/components/table/table-header-cell/table-header-cell.js +402 -0
- package/dist/collection/components/table/table-row/table-row.css +1 -0
- package/dist/collection/components/table/table-row/table-row.js +261 -0
- package/dist/collection/components/table/table-tokens.js +50 -0
- package/dist/collection/components/table/table-types.js +1 -0
- package/dist/collection/components/table/table-utils.js +44 -0
- package/dist/collection/components/table/table.css +1 -0
- package/dist/collection/components/table/table.js +1030 -0
- package/dist/collection/components/tag/tag.css +1 -0
- package/dist/collection/components/tag/tag.js +1152 -0
- package/dist/collection/components/tag/tag.types.js +1 -0
- package/dist/collection/components/textarea/textarea.css +1 -0
- package/dist/collection/components/textarea/textarea.js +985 -0
- package/dist/collection/components/textarea/textarea.types.js +1 -0
- package/dist/collection/components/tooltip/tooltip.css +1 -0
- package/dist/collection/components/tooltip/tooltip.js +1024 -0
- package/dist/collection/components/tooltip/tooltip.types.js +1 -0
- package/dist/collection/components/upload/upload.css +1 -0
- package/dist/collection/components/upload/upload.js +1314 -0
- package/dist/collection/components/upload/upload.types.js +1 -0
- package/dist/collection/components/wizard/wizard-panel/wizard-panel.css +1 -0
- package/dist/collection/components/wizard/wizard-panel/wizard-panel.js +167 -0
- package/dist/collection/components/wizard/wizard.css +1 -0
- package/dist/collection/components/wizard/wizard.js +1228 -0
- package/dist/collection/index.js +14 -0
- package/dist/collection/pages/components/cookiebar/index.js +26 -0
- package/dist/collection/pages/components/link/index.js +29 -0
- package/dist/collection/pages/components/pagination/index.js +12 -0
- package/dist/collection/pages/components/slider/index.js +18 -0
- package/dist/collection/pages/scripts/code-editor.js +101 -0
- package/dist/collection/pages/scripts/component-controls.js +600 -0
- package/dist/collection/pages/scripts/dev-event-console.js +47 -0
- package/dist/collection/pages/scripts/menu.js +192 -0
- package/dist/collection/pages/scripts/pageLoader.js +1422 -0
- package/dist/collection/shared/utils/assetsPath.js +75 -0
- package/dist/collection/shared/utils/breakpoint-observer.js +139 -0
- package/dist/collection/shared/utils/clamp.js +21 -0
- package/dist/collection/shared/utils/css-variables.js +12 -0
- package/dist/collection/shared/utils/cssVariables.js +37 -0
- package/dist/collection/shared/utils/date.js +405 -0
- package/dist/collection/shared/utils/debounce.js +39 -0
- package/dist/collection/shared/utils/event.js +55 -0
- package/dist/collection/shared/utils/floating-surface-dismiss.js +59 -0
- package/dist/collection/shared/utils/floating-ui.js +131 -0
- package/dist/collection/shared/utils/focus.js +24 -0
- package/dist/collection/shared/utils/form.js +82 -0
- package/dist/collection/shared/utils/format-bytes.js +20 -0
- package/dist/collection/shared/utils/getNextElement.js +30 -0
- package/dist/collection/shared/utils/getRandom.js +27 -0
- package/dist/collection/shared/utils/helpers.js +31 -0
- package/dist/collection/shared/utils/id.js +16 -0
- package/dist/collection/shared/utils/index.js +60 -0
- package/dist/collection/shared/utils/interfaces.js +1 -0
- package/dist/collection/shared/utils/isClient.js +14 -0
- package/dist/collection/shared/utils/isDefined.js +19 -0
- package/dist/collection/shared/utils/isEmpty.js +30 -0
- package/dist/collection/shared/utils/isHTMLElement.js +16 -0
- package/dist/collection/shared/utils/isNil.js +15 -0
- package/dist/collection/shared/utils/isString.js +20 -0
- package/dist/collection/shared/utils/native-dialog.js +44 -0
- package/dist/collection/shared/utils/navigation.js +21 -0
- package/dist/collection/shared/utils/parts.js +15 -0
- package/dist/collection/shared/utils/prop-warning.js +7 -0
- package/dist/collection/shared/utils/props.js +37 -0
- package/dist/collection/shared/utils/raf-batcher.js +51 -0
- package/dist/collection/shared/utils/scrollLock.js +141 -0
- package/dist/collection/shared/utils/setRafTimeout.js +38 -0
- package/dist/collection/shared/utils/slot.js +113 -0
- package/dist/collection/shared/utils/ssr-date.js +33 -0
- package/dist/collection/shared/utils/stringToArray.js +29 -0
- package/dist/collection/shared/utils/swipe.js +342 -0
- package/dist/collection/shared/utils/transition.js +127 -0
- package/dist/collection/shared/utils/types.js +1 -0
- package/dist/collection/shared/utils/validator.js +51 -0
- package/dist/collection/value-accessors/angular-value-accessor-config.js +41 -0
- package/dist/collection/value-accessors/index.js +6 -0
- package/dist/collection/value-accessors/vue-model-config.js +43 -0
- package/dist/components/br-avatar.d.ts +11 -0
- package/dist/components/br-avatar.js +5 -0
- package/dist/components/br-breadcrumb-item.d.ts +11 -0
- package/dist/components/br-breadcrumb-item.js +5 -0
- package/dist/components/br-breadcrumb.d.ts +11 -0
- package/dist/components/br-breadcrumb.js +5 -0
- package/dist/components/br-button.d.ts +11 -0
- package/dist/components/br-button.js +5 -0
- package/dist/components/br-card.d.ts +11 -0
- package/dist/components/br-card.js +5 -0
- package/dist/components/br-carousel-page.d.ts +11 -0
- package/dist/components/br-carousel-page.js +5 -0
- package/dist/components/br-carousel.d.ts +11 -0
- package/dist/components/br-carousel.js +5 -0
- package/dist/components/br-checkbox-group.d.ts +11 -0
- package/dist/components/br-checkbox-group.js +5 -0
- package/dist/components/br-checkbox.d.ts +11 -0
- package/dist/components/br-checkbox.js +5 -0
- package/dist/components/br-checkgroup.d.ts +11 -0
- package/dist/components/br-checkgroup.js +5 -0
- package/dist/components/br-collapse.d.ts +11 -0
- package/dist/components/br-collapse.js +5 -0
- package/dist/components/br-cookiebar-cookie.d.ts +11 -0
- package/dist/components/br-cookiebar-cookie.js +5 -0
- package/dist/components/br-cookiebar-group.d.ts +11 -0
- package/dist/components/br-cookiebar-group.js +5 -0
- package/dist/components/br-cookiebar-header.d.ts +11 -0
- package/dist/components/br-cookiebar-header.js +5 -0
- package/dist/components/br-cookiebar-link.d.ts +11 -0
- package/dist/components/br-cookiebar-link.js +5 -0
- package/dist/components/br-cookiebar-note-group.d.ts +11 -0
- package/dist/components/br-cookiebar-note-group.js +5 -0
- package/dist/components/br-cookiebar-note.d.ts +11 -0
- package/dist/components/br-cookiebar-note.js +5 -0
- package/dist/components/br-cookiebar.d.ts +11 -0
- package/dist/components/br-cookiebar.js +5 -0
- package/dist/components/br-crumb.d.ts +11 -0
- package/dist/components/br-crumb.js +5 -0
- package/dist/components/br-date-picker.d.ts +11 -0
- package/dist/components/br-date-picker.js +5 -0
- package/dist/components/br-datetime-input.d.ts +11 -0
- package/dist/components/br-datetime-input.js +5 -0
- package/dist/components/br-datetime-picker.d.ts +11 -0
- package/dist/components/br-datetime-picker.js +5 -0
- package/dist/components/br-divider.d.ts +11 -0
- package/dist/components/br-divider.js +5 -0
- package/dist/components/br-dropdown.d.ts +11 -0
- package/dist/components/br-dropdown.js +5 -0
- package/dist/components/br-footer-category.d.ts +11 -0
- package/dist/components/br-footer-category.js +5 -0
- package/dist/components/br-footer-item.d.ts +11 -0
- package/dist/components/br-footer-item.js +5 -0
- package/dist/components/br-footer-legal.d.ts +11 -0
- package/dist/components/br-footer-legal.js +5 -0
- package/dist/components/br-footer-logo.d.ts +11 -0
- package/dist/components/br-footer-logo.js +5 -0
- package/dist/components/br-footer-social.d.ts +11 -0
- package/dist/components/br-footer-social.js +5 -0
- package/dist/components/br-footer.d.ts +11 -0
- package/dist/components/br-footer.js +5 -0
- package/dist/components/br-header-function.d.ts +11 -0
- package/dist/components/br-header-function.js +5 -0
- package/dist/components/br-header-link.d.ts +11 -0
- package/dist/components/br-header-link.js +5 -0
- package/dist/components/br-header-list.d.ts +11 -0
- package/dist/components/br-header-list.js +5 -0
- package/dist/components/br-header-logo.d.ts +11 -0
- package/dist/components/br-header-logo.js +5 -0
- package/dist/components/br-header.d.ts +11 -0
- package/dist/components/br-header.js +5 -0
- package/dist/components/br-icon.d.ts +11 -0
- package/dist/components/br-icon.js +5 -0
- package/dist/components/br-input.d.ts +11 -0
- package/dist/components/br-input.js +5 -0
- package/dist/components/br-item.d.ts +11 -0
- package/dist/components/br-item.js +5 -0
- package/dist/components/br-link.d.ts +11 -0
- package/dist/components/br-link.js +5 -0
- package/dist/components/br-list.d.ts +11 -0
- package/dist/components/br-list.js +5 -0
- package/dist/components/br-loading.d.ts +11 -0
- package/dist/components/br-loading.js +5 -0
- package/dist/components/br-magic-button.d.ts +11 -0
- package/dist/components/br-magic-button.js +5 -0
- package/dist/components/br-menu-group.d.ts +11 -0
- package/dist/components/br-menu-group.js +5 -0
- package/dist/components/br-menu-header.d.ts +11 -0
- package/dist/components/br-menu-header.js +5 -0
- package/dist/components/br-menu-info.d.ts +11 -0
- package/dist/components/br-menu-info.js +5 -0
- package/dist/components/br-menu-item.d.ts +11 -0
- package/dist/components/br-menu-item.js +5 -0
- package/dist/components/br-menu-link.d.ts +11 -0
- package/dist/components/br-menu-link.js +5 -0
- package/dist/components/br-menu-list.d.ts +11 -0
- package/dist/components/br-menu-list.js +5 -0
- package/dist/components/br-menu-logo.d.ts +11 -0
- package/dist/components/br-menu-logo.js +5 -0
- package/dist/components/br-menu-social.d.ts +11 -0
- package/dist/components/br-menu-social.js +5 -0
- package/dist/components/br-menu.d.ts +11 -0
- package/dist/components/br-menu.js +5 -0
- package/dist/components/br-message.d.ts +11 -0
- package/dist/components/br-message.js +5 -0
- package/dist/components/br-modal.d.ts +11 -0
- package/dist/components/br-modal.js +5 -0
- package/dist/components/br-notification-body.d.ts +11 -0
- package/dist/components/br-notification-body.js +5 -0
- package/dist/components/br-notification-header.d.ts +11 -0
- package/dist/components/br-notification-header.js +5 -0
- package/dist/components/br-notification-item.d.ts +11 -0
- package/dist/components/br-notification-item.js +5 -0
- package/dist/components/br-notification.d.ts +11 -0
- package/dist/components/br-notification.js +5 -0
- package/dist/components/br-pagination.d.ts +11 -0
- package/dist/components/br-pagination.js +5 -0
- package/dist/components/br-radio-group.d.ts +11 -0
- package/dist/components/br-radio-group.js +5 -0
- package/dist/components/br-radio.d.ts +11 -0
- package/dist/components/br-radio.js +5 -0
- package/dist/components/br-scrim.d.ts +11 -0
- package/dist/components/br-scrim.js +5 -0
- package/dist/components/br-select-input.d.ts +11 -0
- package/dist/components/br-select-input.js +5 -0
- package/dist/components/br-select-list.d.ts +11 -0
- package/dist/components/br-select-list.js +5 -0
- package/dist/components/br-select-option.d.ts +11 -0
- package/dist/components/br-select-option.js +5 -0
- package/dist/components/br-select.d.ts +11 -0
- package/dist/components/br-select.js +5 -0
- package/dist/components/br-sign-in.d.ts +11 -0
- package/dist/components/br-sign-in.js +5 -0
- package/dist/components/br-skip-link-item.d.ts +11 -0
- package/dist/components/br-skip-link-item.js +5 -0
- package/dist/components/br-skip-link.d.ts +11 -0
- package/dist/components/br-skip-link.js +5 -0
- package/dist/components/br-skiplink-item.d.ts +11 -0
- package/dist/components/br-skiplink-item.js +5 -0
- package/dist/components/br-slider.d.ts +11 -0
- package/dist/components/br-slider.js +5 -0
- package/dist/components/br-step-item.d.ts +11 -0
- package/dist/components/br-step-item.js +5 -0
- package/dist/components/br-step.d.ts +11 -0
- package/dist/components/br-step.js +5 -0
- package/dist/components/br-switch.d.ts +11 -0
- package/dist/components/br-switch.js +5 -0
- package/dist/components/br-tab-item.d.ts +11 -0
- package/dist/components/br-tab-item.js +5 -0
- package/dist/components/br-tab.d.ts +11 -0
- package/dist/components/br-tab.js +5 -0
- package/dist/components/br-table-body.d.ts +11 -0
- package/dist/components/br-table-body.js +5 -0
- package/dist/components/br-table-cell.d.ts +11 -0
- package/dist/components/br-table-cell.js +5 -0
- package/dist/components/br-table-header-cell.d.ts +11 -0
- package/dist/components/br-table-header-cell.js +5 -0
- package/dist/components/br-table-header.d.ts +11 -0
- package/dist/components/br-table-header.js +5 -0
- package/dist/components/br-table-row.d.ts +11 -0
- package/dist/components/br-table-row.js +5 -0
- package/dist/components/br-table.d.ts +11 -0
- package/dist/components/br-table.js +5 -0
- package/dist/components/br-tag.d.ts +11 -0
- package/dist/components/br-tag.js +5 -0
- package/dist/components/br-textarea.d.ts +11 -0
- package/dist/components/br-textarea.js +5 -0
- package/dist/components/br-time-picker.d.ts +11 -0
- package/dist/components/br-time-picker.js +5 -0
- package/dist/components/br-tooltip.d.ts +11 -0
- package/dist/components/br-tooltip.js +5 -0
- package/dist/components/br-upload.d.ts +11 -0
- package/dist/components/br-upload.js +5 -0
- package/dist/components/br-wizard-panel.d.ts +11 -0
- package/dist/components/br-wizard-panel.js +5 -0
- package/dist/components/br-wizard.d.ts +11 -0
- package/dist/components/br-wizard.js +5 -0
- package/dist/components/index.d.ts +213 -0
- package/dist/components/index.js +5 -0
- package/dist/components/p-34Jfn-U-.js +5 -0
- package/dist/components/p-5z6jgH1D.js +5 -0
- package/dist/components/p-6OdfnwnK.js +5 -0
- package/dist/components/p-9S9bgUT0.js +5 -0
- package/dist/components/p-B-qLmYZC.js +5 -0
- package/dist/components/p-B55qsau4.js +5 -0
- package/dist/components/p-B7Amgxkp.js +5 -0
- package/dist/components/p-BC7f6MK8.js +5 -0
- package/dist/components/p-BKuMQJrQ.js +5 -0
- package/dist/components/p-BPJpHGOW.js +5 -0
- package/dist/components/p-BWXfdbQH.js +5 -0
- package/dist/components/p-Bb-nLtTG.js +5 -0
- package/dist/components/p-BeE7R9nu.js +5 -0
- package/dist/components/p-BkS6ujyf.js +5 -0
- package/dist/components/p-Bo0QYHJO.js +5 -0
- package/dist/components/p-C1yRmdso.js +5 -0
- package/dist/components/p-C2i2c_io.js +5 -0
- package/dist/components/p-C7v0lVlX.js +5 -0
- package/dist/components/p-CMBsvswx.js +5 -0
- package/dist/components/p-CRrimdz6.js +5 -0
- package/dist/components/p-CWORw84-.js +5 -0
- package/dist/components/p-CXMwM9m4.js +5 -0
- package/dist/components/p-CdDwqbBv.js +5 -0
- package/dist/components/p-CvUMXJCl.js +5 -0
- package/dist/components/p-D3usVJE2.js +16 -0
- package/dist/components/p-D6zroLx5.js +5 -0
- package/dist/components/p-DA5GS53D.js +5 -0
- package/dist/components/p-DBP6K_aq.js +5 -0
- package/dist/components/p-DBmwzG9E.js +5 -0
- package/dist/components/p-DCrVo-8T.js +5 -0
- package/dist/components/p-DFUKDNck.js +5 -0
- package/dist/components/p-DHicj0By.js +5 -0
- package/dist/components/p-DIK54tTj.js +5 -0
- package/dist/components/p-DQRSHR-D.js +5 -0
- package/dist/components/p-DRVMm1Py.js +5 -0
- package/dist/components/p-DWPmUV72.js +5 -0
- package/dist/components/p-DXjQyH6s.js +5 -0
- package/dist/components/p-DYA74R1r.js +5 -0
- package/dist/components/p-DmCxdB9P.js +5 -0
- package/dist/components/p-Dmfk7eEe.js +5 -0
- package/dist/components/p-Dp0xy_3n.js +5 -0
- package/dist/components/p-DxZJrIyL.js +5 -0
- package/dist/components/p-JAkkThgf.js +5 -0
- package/dist/components/p-Ud-WB0hx.js +5 -0
- package/dist/components/p-bhULC15U.js +5 -0
- package/dist/components/p-cF3ia5e9.js +5 -0
- package/dist/components/p-fpMNttbg.js +5 -0
- package/dist/components/p-gvnfuTjd.js +5 -0
- package/dist/components/p-qYONSNcf.js +5 -0
- package/dist/components/p-qhhHGJY1.js +5 -0
- package/dist/components/p-ttI0nvv_.js +5 -0
- package/dist/components/p-ukNmfGNP.js +5 -0
- package/dist/components/p-xa8e1kSW.js +5 -0
- package/dist/esm/app-globals-DVjNHTTs.js +7 -0
- package/dist/esm/br-avatar.entry.js +246 -0
- package/dist/esm/br-breadcrumb-item.entry.js +43 -0
- package/dist/esm/br-breadcrumb.entry.js +441 -0
- package/dist/esm/br-button_2.entry.js +277 -0
- package/dist/esm/br-card.entry.js +109 -0
- package/dist/esm/br-carousel-page.entry.js +78 -0
- package/dist/esm/br-carousel.entry.js +563 -0
- package/dist/esm/br-checkbox-group.entry.js +116 -0
- package/dist/esm/br-checkbox.entry.js +286 -0
- package/dist/esm/br-checkgroup.entry.js +18 -0
- package/dist/esm/br-collapse_2.entry.js +680 -0
- package/dist/esm/br-cookiebar-cookie.entry.js +81 -0
- package/dist/esm/br-cookiebar-group.entry.js +307 -0
- package/dist/esm/br-cookiebar-header.entry.js +37 -0
- package/dist/esm/br-cookiebar-link.entry.js +53 -0
- package/dist/esm/br-cookiebar-note-group.entry.js +68 -0
- package/dist/esm/br-cookiebar-note.entry.js +23 -0
- package/dist/esm/br-cookiebar.entry.js +756 -0
- package/dist/esm/br-crumb.entry.js +49 -0
- package/dist/esm/br-date-picker_3.entry.js +2443 -0
- package/dist/esm/br-datetime-picker.entry.js +1884 -0
- package/dist/esm/br-divider.entry.js +223 -0
- package/dist/esm/br-dropdown_2.entry.js +1997 -0
- package/dist/esm/br-footer-category.entry.js +100 -0
- package/dist/esm/br-footer-item.entry.js +50 -0
- package/dist/esm/br-footer-legal.entry.js +39 -0
- package/dist/esm/br-footer-logo.entry.js +102 -0
- package/dist/esm/br-footer-social.entry.js +69 -0
- package/dist/esm/br-footer.entry.js +90 -0
- package/dist/esm/br-header-function.entry.js +140 -0
- package/dist/esm/br-header-link.entry.js +58 -0
- package/dist/esm/br-header-list.entry.js +277 -0
- package/dist/esm/br-header-logo.entry.js +176 -0
- package/dist/esm/br-header.entry.js +640 -0
- package/dist/esm/br-icon.entry.js +483 -0
- package/dist/esm/br-input.entry.js +597 -0
- package/dist/esm/br-item.entry.js +365 -0
- package/dist/esm/br-link.entry.js +131 -0
- package/dist/esm/br-loading.entry.js +503 -0
- package/dist/esm/br-magic-button.entry.js +91 -0
- package/dist/esm/br-menu-group.entry.js +21 -0
- package/dist/esm/br-menu-header.entry.js +45 -0
- package/dist/esm/br-menu-info.entry.js +36 -0
- package/dist/esm/br-menu-item.entry.js +77 -0
- package/dist/esm/br-menu-link.entry.js +54 -0
- package/dist/esm/br-menu-list.entry.js +147 -0
- package/dist/esm/br-menu-logo.entry.js +73 -0
- package/dist/esm/br-menu-social.entry.js +63 -0
- package/dist/esm/br-menu.entry.js +991 -0
- package/dist/esm/br-modal.entry.js +494 -0
- package/dist/esm/br-notification-body.entry.js +69 -0
- package/dist/esm/br-notification-header.entry.js +46 -0
- package/dist/esm/br-notification-item.entry.js +108 -0
- package/dist/esm/br-notification.entry.js +332 -0
- package/dist/esm/br-pagination.entry.js +882 -0
- package/dist/esm/br-radio-group.entry.js +426 -0
- package/dist/esm/br-radio.entry.js +355 -0
- package/dist/esm/br-scrim.entry.js +1334 -0
- package/dist/esm/br-select-input_3.entry.js +984 -0
- package/dist/esm/br-sign-in.entry.js +124 -0
- package/dist/esm/br-skip-link-item.entry.js +18 -0
- package/dist/esm/br-skip-link.entry.js +360 -0
- package/dist/esm/br-skiplink-item.entry.js +190 -0
- package/dist/esm/br-slider.entry.js +685 -0
- package/dist/esm/br-step_2.entry.js +625 -0
- package/dist/esm/br-switch.entry.js +243 -0
- package/dist/esm/br-tab-item.entry.js +183 -0
- package/dist/esm/br-tab.entry.js +395 -0
- package/dist/esm/br-table-body.entry.js +35 -0
- package/dist/esm/br-table-cell.entry.js +182 -0
- package/dist/esm/br-table-header-cell.entry.js +171 -0
- package/dist/esm/br-table-header.entry.js +35 -0
- package/dist/esm/br-table-row.entry.js +79 -0
- package/dist/esm/br-table.entry.js +678 -0
- package/dist/esm/br-tag.entry.js +491 -0
- package/dist/esm/br-textarea.entry.js +304 -0
- package/dist/esm/br-tooltip.entry.js +625 -0
- package/dist/esm/br-upload.entry.js +579 -0
- package/dist/esm/br-wizard-panel.entry.js +52 -0
- package/dist/esm/br-wizard.entry.js +706 -0
- package/dist/esm/breakpoint-observer-DBmwzG9E.js +141 -0
- package/dist/esm/clamp-gvnfuTjd.js +23 -0
- package/dist/esm/cookiebar.utils-DYA74R1r.js +16 -0
- package/dist/esm/datetime-picker-constants-Bfm58jO6.js +3798 -0
- package/dist/esm/event-DFN_so7I.js +48 -0
- package/dist/esm/floating-surface-dismiss-BWXfdbQH.js +61 -0
- package/dist/esm/floating-ui-BavFwMnx.js +134 -0
- package/dist/esm/floating-ui.dom-DIK54tTj.js +1707 -0
- package/dist/esm/focus-DxZJrIyL.js +26 -0
- package/dist/esm/getNextElement-9S9bgUT0.js +28 -0
- package/dist/esm/iconify-icon-D3usVJE2.js +2303 -0
- package/dist/esm/id-BkS6ujyf.js +18 -0
- package/dist/esm/index-Bo-2igoO.js +671 -0
- package/dist/esm/index-C2RBydfd.js +3258 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/isNil-B-qLmYZC.js +17 -0
- package/dist/esm/isValid-DIUZX1qS.js +3684 -0
- package/dist/esm/loader.js +15 -0
- package/dist/esm/native-dialog-B55qsau4.js +46 -0
- package/dist/esm/navigation-bhULC15U.js +23 -0
- package/dist/esm/parts-Bb5vVlCC.js +17 -0
- package/dist/esm/props-DRVMm1Py.js +22 -0
- package/dist/esm/raf-batcher-cF3ia5e9.js +53 -0
- package/dist/esm/slot-BIG-yees.js +44 -0
- package/dist/esm/swipe-Dmfk7eEe.js +343 -0
- package/dist/esm/table-constants-CXMwM9m4.js +170 -0
- package/dist/esm/validator-D3tVP32U.js +113 -0
- package/dist/esm/webcomponents.js +46 -0
- package/dist/hydrate/index.d.ts +287 -0
- package/dist/hydrate/index.js +67516 -0
- package/dist/hydrate/index.mjs +67506 -0
- package/dist/hydrate/package.json +12 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +5 -0
- package/dist/loader/index.cjs.js +5 -0
- package/dist/loader/index.d.ts +24 -0
- package/dist/loader/index.es2017.js +5 -0
- package/dist/loader/index.js +6 -0
- package/dist/types/components/item/item.d.ts +1 -0
- package/dist/types/components/select/select-list/select-list.d.ts +1 -0
- package/dist/types/components/select/select-option/select-option.d.ts +1 -0
- package/dist/types/components/select/select.d.ts +14 -0
- package/dist/types/components/select/select.types.d.ts +2 -0
- package/dist/types/components/select/select.utils.d.ts +13 -0
- package/dist/webcomponents/index.esm.js +5 -0
- package/dist/webcomponents/p-0196804a.entry.js +5 -0
- package/dist/webcomponents/p-0410186a.entry.js +5 -0
- package/dist/webcomponents/p-0415ef22.entry.js +5 -0
- package/dist/webcomponents/p-0777c7b1.entry.js +5 -0
- package/dist/webcomponents/p-0caa4d12.entry.js +5 -0
- package/dist/webcomponents/p-0d4f718d.entry.js +5 -0
- package/dist/webcomponents/p-0e84c9e8.entry.js +5 -0
- package/dist/webcomponents/p-12286e73.entry.js +5 -0
- package/dist/webcomponents/p-147ac8d3.entry.js +5 -0
- package/dist/webcomponents/p-1580beee.entry.js +5 -0
- package/dist/webcomponents/p-18ee6175.entry.js +5 -0
- package/dist/webcomponents/p-1bca4499.entry.js +5 -0
- package/dist/webcomponents/p-1c303a4e.entry.js +5 -0
- package/dist/webcomponents/p-1d6b0b6f.entry.js +5 -0
- package/dist/webcomponents/p-1d8cb8fd.entry.js +5 -0
- package/dist/webcomponents/p-224daaac.entry.js +5 -0
- package/dist/webcomponents/p-28426d2a.entry.js +5 -0
- package/dist/webcomponents/p-2abd2da0.entry.js +5 -0
- package/dist/webcomponents/p-2fdc51ae.entry.js +5 -0
- package/dist/webcomponents/p-30c428b6.entry.js +5 -0
- package/dist/webcomponents/p-36bbea4e.entry.js +5 -0
- package/dist/webcomponents/p-3907ebfa.entry.js +5 -0
- package/dist/webcomponents/p-39a16f9d.entry.js +5 -0
- package/dist/webcomponents/p-3ebbd2f5.entry.js +5 -0
- package/dist/webcomponents/p-3ef7eac8.entry.js +5 -0
- package/dist/webcomponents/p-45356e9a.entry.js +5 -0
- package/dist/webcomponents/p-46513db4.entry.js +5 -0
- package/dist/webcomponents/p-4c13221a.entry.js +5 -0
- package/dist/webcomponents/p-51ce2c31.entry.js +5 -0
- package/dist/webcomponents/p-52df61cb.entry.js +5 -0
- package/dist/webcomponents/p-569134cf.entry.js +5 -0
- package/dist/webcomponents/p-5ce7db4a.entry.js +5 -0
- package/dist/webcomponents/p-5f373708.entry.js +5 -0
- package/dist/webcomponents/p-5f6afb79.entry.js +5 -0
- package/dist/webcomponents/p-5fc7ba4c.entry.js +5 -0
- package/dist/webcomponents/p-66006312.entry.js +5 -0
- package/dist/webcomponents/p-66b13fd9.entry.js +5 -0
- package/dist/webcomponents/p-6OdfnwnK.js +5 -0
- package/dist/webcomponents/p-750799b7.entry.js +5 -0
- package/dist/webcomponents/p-756ff2ad.entry.js +5 -0
- package/dist/webcomponents/p-765bfe27.entry.js +5 -0
- package/dist/webcomponents/p-7ab96c11.entry.js +5 -0
- package/dist/webcomponents/p-7c2ff8b4.entry.js +5 -0
- package/dist/webcomponents/p-7f7506f0.entry.js +5 -0
- package/dist/webcomponents/p-7fb03a49.entry.js +5 -0
- package/dist/webcomponents/p-82200563.entry.js +5 -0
- package/dist/webcomponents/p-83ff4579.entry.js +5 -0
- package/dist/webcomponents/p-85f8063b.entry.js +5 -0
- package/dist/webcomponents/p-8b558233.entry.js +5 -0
- package/dist/webcomponents/p-8e6c2767.entry.js +5 -0
- package/dist/webcomponents/p-8e819355.entry.js +5 -0
- package/dist/webcomponents/p-92a9b9c4.entry.js +5 -0
- package/dist/webcomponents/p-966ad32f.entry.js +5 -0
- package/dist/webcomponents/p-9679d230.entry.js +5 -0
- package/dist/webcomponents/p-96dd663b.entry.js +5 -0
- package/dist/webcomponents/p-98843fa3.entry.js +5 -0
- package/dist/webcomponents/p-9S9bgUT0.js +5 -0
- package/dist/webcomponents/p-9a375eff.entry.js +5 -0
- package/dist/webcomponents/p-9b358cff.entry.js +5 -0
- package/dist/webcomponents/p-9f7558c7.entry.js +5 -0
- package/dist/webcomponents/p-B-qLmYZC.js +5 -0
- package/dist/webcomponents/p-B55qsau4.js +5 -0
- package/dist/webcomponents/p-BIG-yees.js +5 -0
- package/dist/webcomponents/p-BWXfdbQH.js +5 -0
- package/dist/webcomponents/p-Bb5vVlCC.js +5 -0
- package/dist/webcomponents/p-Bfm58jO6.js +5 -0
- package/dist/webcomponents/p-BhMVJQ4-.js +5 -0
- package/dist/webcomponents/p-BkS6ujyf.js +5 -0
- package/dist/webcomponents/p-C2RBydfd.js +6 -0
- package/dist/webcomponents/p-CO5cOQQU.js +5 -0
- package/dist/webcomponents/p-CXMwM9m4.js +5 -0
- package/dist/webcomponents/p-D3tVP32U.js +5 -0
- package/dist/webcomponents/p-D3usVJE2.js +16 -0
- package/dist/webcomponents/p-DBmwzG9E.js +5 -0
- package/dist/webcomponents/p-DFN_so7I.js +5 -0
- package/dist/webcomponents/p-DIK54tTj.js +5 -0
- package/dist/webcomponents/p-DRVMm1Py.js +5 -0
- package/dist/webcomponents/p-DVjNHTTs.js +5 -0
- package/dist/webcomponents/p-DYA74R1r.js +5 -0
- package/dist/webcomponents/p-Dmfk7eEe.js +5 -0
- package/dist/webcomponents/p-DxZJrIyL.js +5 -0
- package/dist/webcomponents/p-a382e115.entry.js +5 -0
- package/dist/webcomponents/p-a4ae72e3.entry.js +5 -0
- package/dist/webcomponents/p-a994c190.entry.js +5 -0
- package/dist/webcomponents/p-a9ff7c25.entry.js +5 -0
- package/dist/webcomponents/p-bhULC15U.js +5 -0
- package/dist/webcomponents/p-c0b0f531.entry.js +5 -0
- package/dist/webcomponents/p-c211af17.entry.js +5 -0
- package/dist/webcomponents/p-c492d926.entry.js +5 -0
- package/dist/webcomponents/p-c4cfe599.entry.js +5 -0
- package/dist/webcomponents/p-c846e784.entry.js +5 -0
- package/dist/webcomponents/p-c949d993.entry.js +5 -0
- package/dist/webcomponents/p-cF3ia5e9.js +5 -0
- package/dist/webcomponents/p-d1e899cd.entry.js +5 -0
- package/dist/webcomponents/p-d38d82cc.entry.js +5 -0
- package/dist/webcomponents/p-e0ce536a.entry.js +5 -0
- package/dist/webcomponents/p-e1331288.entry.js +5 -0
- package/dist/webcomponents/p-e360a463.entry.js +5 -0
- package/dist/webcomponents/p-f078f972.entry.js +5 -0
- package/dist/webcomponents/p-f26038e2.entry.js +5 -0
- package/dist/webcomponents/p-f303f6b3.entry.js +5 -0
- package/dist/webcomponents/p-f6318e94.entry.js +5 -0
- package/dist/webcomponents/p-f85ee01c.entry.js +5 -0
- package/dist/webcomponents/p-fcd4ae48.entry.js +5 -0
- package/dist/webcomponents/p-ffe0241e.entry.js +5 -0
- package/dist/webcomponents/p-gvnfuTjd.js +5 -0
- package/dist/webcomponents/webcomponents.esm.js +5 -0
- package/package.json +3 -7
- package/cem/.gitkeep +0 -0
|
@@ -0,0 +1,2443 @@
|
|
|
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-C2RBydfd.js';
|
|
6
|
+
import { r as resolveDateFnsLocale, s as startOfWeekExports, a as addDaysExports, g as getWeekdayLabels, b as getMonthLabels } from './index-Bo-2igoO.js';
|
|
7
|
+
import { b as requireToDate, a as requireConstructFrom, e as requireDefaultOptions, g as requireNormalizeDates, d as DATETIME_PICKER_LOCALE, N as NAVIGATION_ACTION, f as formatExports, h as requireAddLeadingZeros, D as DATETIME_PICKER_MODE, c as requireConstants } from './datetime-picker-constants-Bfm58jO6.js';
|
|
8
|
+
import { w as warnInvalidPropValue, s as setExports, p as parseExports, t as toDateExports, a as resolveSsrLocalDate, b as isSameDayExports, e as eachDayOfIntervalExports, i as isValidExports } from './isValid-DIUZX1qS.js';
|
|
9
|
+
import { d as dispatchNativeFormEvent } from './event-DFN_so7I.js';
|
|
10
|
+
|
|
11
|
+
var addMonths = {};
|
|
12
|
+
|
|
13
|
+
var hasRequiredAddMonths;
|
|
14
|
+
|
|
15
|
+
function requireAddMonths () {
|
|
16
|
+
if (hasRequiredAddMonths) return addMonths;
|
|
17
|
+
hasRequiredAddMonths = 1;
|
|
18
|
+
addMonths.addMonths = addMonths$1;
|
|
19
|
+
var _index = /*@__PURE__*/ requireConstructFrom();
|
|
20
|
+
var _index2 = /*@__PURE__*/ requireToDate();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The {@link addMonths} function options.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @name addMonths
|
|
28
|
+
* @category Month Helpers
|
|
29
|
+
* @summary Add the specified number of months to the given date.
|
|
30
|
+
*
|
|
31
|
+
* @description
|
|
32
|
+
* Add the specified number of months to the given date.
|
|
33
|
+
*
|
|
34
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
35
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
36
|
+
*
|
|
37
|
+
* @param date - The date to be changed
|
|
38
|
+
* @param amount - The amount of months to be added.
|
|
39
|
+
* @param options - The options object
|
|
40
|
+
*
|
|
41
|
+
* @returns The new date with the months added
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Add 5 months to 1 September 2014:
|
|
45
|
+
* const result = addMonths(new Date(2014, 8, 1), 5)
|
|
46
|
+
* //=> Sun Feb 01 2015 00:00:00
|
|
47
|
+
*
|
|
48
|
+
* // Add one month to 30 January 2023:
|
|
49
|
+
* const result = addMonths(new Date(2023, 0, 30), 1)
|
|
50
|
+
* //=> Tue Feb 28 2023 00:00:00
|
|
51
|
+
*/
|
|
52
|
+
function addMonths$1(date, amount, options) {
|
|
53
|
+
const _date = (0, _index2.toDate)(date, options?.in);
|
|
54
|
+
if (isNaN(amount)) return (0, _index.constructFrom)(options?.in || date, NaN);
|
|
55
|
+
if (!amount) {
|
|
56
|
+
// If 0 months, no-op to avoid changing times in the hour before end of DST
|
|
57
|
+
return _date;
|
|
58
|
+
}
|
|
59
|
+
const dayOfMonth = _date.getDate();
|
|
60
|
+
|
|
61
|
+
// The JS Date object supports date math by accepting out-of-bounds values for
|
|
62
|
+
// month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
|
|
63
|
+
// new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
|
|
64
|
+
// want except that dates will wrap around the end of a month, meaning that
|
|
65
|
+
// new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
|
|
66
|
+
// we'll default to the end of the desired month by adding 1 to the desired
|
|
67
|
+
// month and using a date of 0 to back up one day to the end of the desired
|
|
68
|
+
// month.
|
|
69
|
+
const endOfDesiredMonth = (0, _index.constructFrom)(
|
|
70
|
+
options?.in || date,
|
|
71
|
+
_date.getTime(),
|
|
72
|
+
);
|
|
73
|
+
endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
|
|
74
|
+
const daysInMonth = endOfDesiredMonth.getDate();
|
|
75
|
+
if (dayOfMonth >= daysInMonth) {
|
|
76
|
+
// If we're already at the end of the month, then this is the correct date
|
|
77
|
+
// and we're done.
|
|
78
|
+
return endOfDesiredMonth;
|
|
79
|
+
} else {
|
|
80
|
+
// Otherwise, we now know that setting the original day-of-month value won't
|
|
81
|
+
// cause an overflow, so set the desired day-of-month. Note that we can't
|
|
82
|
+
// just set the date of `endOfDesiredMonth` because that object may have had
|
|
83
|
+
// its time changed in the unusual case where where a DST transition was on
|
|
84
|
+
// the last day of the month and its local time was in the hour skipped or
|
|
85
|
+
// repeated next to a DST transition. So we use `date` instead which is
|
|
86
|
+
// guaranteed to still have the original time.
|
|
87
|
+
_date.setFullYear(
|
|
88
|
+
endOfDesiredMonth.getFullYear(),
|
|
89
|
+
endOfDesiredMonth.getMonth(),
|
|
90
|
+
dayOfMonth,
|
|
91
|
+
);
|
|
92
|
+
return _date;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return addMonths;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var addMonthsExports = /*@__PURE__*/ requireAddMonths();
|
|
99
|
+
|
|
100
|
+
var compareAsc = {};
|
|
101
|
+
|
|
102
|
+
var hasRequiredCompareAsc;
|
|
103
|
+
|
|
104
|
+
function requireCompareAsc () {
|
|
105
|
+
if (hasRequiredCompareAsc) return compareAsc;
|
|
106
|
+
hasRequiredCompareAsc = 1;
|
|
107
|
+
compareAsc.compareAsc = compareAsc$1;
|
|
108
|
+
var _index = /*@__PURE__*/ requireToDate();
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @name compareAsc
|
|
112
|
+
* @category Common Helpers
|
|
113
|
+
* @summary Compare the two dates and return -1, 0 or 1.
|
|
114
|
+
*
|
|
115
|
+
* @description
|
|
116
|
+
* Compare the two dates and return 1 if the first date is after the second,
|
|
117
|
+
* -1 if the first date is before the second or 0 if dates are equal.
|
|
118
|
+
*
|
|
119
|
+
* @param dateLeft - The first date to compare
|
|
120
|
+
* @param dateRight - The second date to compare
|
|
121
|
+
*
|
|
122
|
+
* @returns The result of the comparison
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* // Compare 11 February 1987 and 10 July 1989:
|
|
126
|
+
* const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
|
|
127
|
+
* //=> -1
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* // Sort the array of dates:
|
|
131
|
+
* const result = [
|
|
132
|
+
* new Date(1995, 6, 2),
|
|
133
|
+
* new Date(1987, 1, 11),
|
|
134
|
+
* new Date(1989, 6, 10)
|
|
135
|
+
* ].sort(compareAsc)
|
|
136
|
+
* //=> [
|
|
137
|
+
* // Wed Feb 11 1987 00:00:00,
|
|
138
|
+
* // Mon Jul 10 1989 00:00:00,
|
|
139
|
+
* // Sun Jul 02 1995 00:00:00
|
|
140
|
+
* // ]
|
|
141
|
+
*/
|
|
142
|
+
function compareAsc$1(dateLeft, dateRight) {
|
|
143
|
+
const diff = +(0, _index.toDate)(dateLeft) - +(0, _index.toDate)(dateRight);
|
|
144
|
+
|
|
145
|
+
if (diff < 0) return -1;
|
|
146
|
+
else if (diff > 0) return 1;
|
|
147
|
+
|
|
148
|
+
// Return 0 if diff is 0; return NaN if diff is NaN
|
|
149
|
+
return diff;
|
|
150
|
+
}
|
|
151
|
+
return compareAsc;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
var compareAscExports = /*@__PURE__*/ requireCompareAsc();
|
|
155
|
+
|
|
156
|
+
var endOfMonth = {};
|
|
157
|
+
|
|
158
|
+
var hasRequiredEndOfMonth;
|
|
159
|
+
|
|
160
|
+
function requireEndOfMonth () {
|
|
161
|
+
if (hasRequiredEndOfMonth) return endOfMonth;
|
|
162
|
+
hasRequiredEndOfMonth = 1;
|
|
163
|
+
endOfMonth.endOfMonth = endOfMonth$1;
|
|
164
|
+
var _index = /*@__PURE__*/ requireToDate();
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The {@link endOfMonth} function options.
|
|
168
|
+
*/
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @name endOfMonth
|
|
172
|
+
* @category Month Helpers
|
|
173
|
+
* @summary Return the end of a month for the given date.
|
|
174
|
+
*
|
|
175
|
+
* @description
|
|
176
|
+
* Return the end of a month for the given date.
|
|
177
|
+
* The result will be in the local timezone.
|
|
178
|
+
*
|
|
179
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
180
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
181
|
+
*
|
|
182
|
+
* @param date - The original date
|
|
183
|
+
* @param options - An object with options
|
|
184
|
+
*
|
|
185
|
+
* @returns The end of a month
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* // The end of a month for 2 September 2014 11:55:00:
|
|
189
|
+
* const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
|
|
190
|
+
* //=> Tue Sep 30 2014 23:59:59.999
|
|
191
|
+
*/
|
|
192
|
+
function endOfMonth$1(date, options) {
|
|
193
|
+
const _date = (0, _index.toDate)(date, options?.in);
|
|
194
|
+
const month = _date.getMonth();
|
|
195
|
+
_date.setFullYear(_date.getFullYear(), month + 1, 0);
|
|
196
|
+
_date.setHours(23, 59, 59, 999);
|
|
197
|
+
return _date;
|
|
198
|
+
}
|
|
199
|
+
return endOfMonth;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
var endOfMonthExports = /*@__PURE__*/ requireEndOfMonth();
|
|
203
|
+
|
|
204
|
+
var endOfWeek = {};
|
|
205
|
+
|
|
206
|
+
var hasRequiredEndOfWeek;
|
|
207
|
+
|
|
208
|
+
function requireEndOfWeek () {
|
|
209
|
+
if (hasRequiredEndOfWeek) return endOfWeek;
|
|
210
|
+
hasRequiredEndOfWeek = 1;
|
|
211
|
+
endOfWeek.endOfWeek = endOfWeek$1;
|
|
212
|
+
var _index = /*@__PURE__*/ requireDefaultOptions();
|
|
213
|
+
var _index2 = /*@__PURE__*/ requireToDate();
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The {@link endOfWeek} function options.
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @name endOfWeek
|
|
221
|
+
* @category Week Helpers
|
|
222
|
+
* @summary Return the end of a week for the given date.
|
|
223
|
+
*
|
|
224
|
+
* @description
|
|
225
|
+
* Return the end of a week for the given date.
|
|
226
|
+
* The result will be in the local timezone.
|
|
227
|
+
*
|
|
228
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
229
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
230
|
+
*
|
|
231
|
+
* @param date - The original date
|
|
232
|
+
* @param options - An object with options
|
|
233
|
+
*
|
|
234
|
+
* @returns The end of a week
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* // The end of a week for 2 September 2014 11:55:00:
|
|
238
|
+
* const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
239
|
+
* //=> Sat Sep 06 2014 23:59:59.999
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
|
|
243
|
+
* const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
|
244
|
+
* //=> Sun Sep 07 2014 23:59:59.999
|
|
245
|
+
*/
|
|
246
|
+
function endOfWeek$1(date, options) {
|
|
247
|
+
const defaultOptions = (0, _index.getDefaultOptions)();
|
|
248
|
+
const weekStartsOn =
|
|
249
|
+
options?.weekStartsOn ??
|
|
250
|
+
options?.locale?.options?.weekStartsOn ??
|
|
251
|
+
defaultOptions.weekStartsOn ??
|
|
252
|
+
defaultOptions.locale?.options?.weekStartsOn ??
|
|
253
|
+
0;
|
|
254
|
+
|
|
255
|
+
const _date = (0, _index2.toDate)(date, options?.in);
|
|
256
|
+
const day = _date.getDay();
|
|
257
|
+
const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
|
|
258
|
+
|
|
259
|
+
_date.setDate(_date.getDate() + diff);
|
|
260
|
+
_date.setHours(23, 59, 59, 999);
|
|
261
|
+
return _date;
|
|
262
|
+
}
|
|
263
|
+
return endOfWeek;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
var endOfWeekExports = /*@__PURE__*/ requireEndOfWeek();
|
|
267
|
+
|
|
268
|
+
var isAfter = {};
|
|
269
|
+
|
|
270
|
+
var hasRequiredIsAfter;
|
|
271
|
+
|
|
272
|
+
function requireIsAfter () {
|
|
273
|
+
if (hasRequiredIsAfter) return isAfter;
|
|
274
|
+
hasRequiredIsAfter = 1;
|
|
275
|
+
isAfter.isAfter = isAfter$1;
|
|
276
|
+
var _index = /*@__PURE__*/ requireToDate();
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @name isAfter
|
|
280
|
+
* @category Common Helpers
|
|
281
|
+
* @summary Is the first date after the second one?
|
|
282
|
+
*
|
|
283
|
+
* @description
|
|
284
|
+
* Is the first date after the second one?
|
|
285
|
+
*
|
|
286
|
+
* @param date - The date that should be after the other one to return true
|
|
287
|
+
* @param dateToCompare - The date to compare with
|
|
288
|
+
*
|
|
289
|
+
* @returns The first date is after the second date
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* // Is 10 July 1989 after 11 February 1987?
|
|
293
|
+
* const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
|
294
|
+
* //=> true
|
|
295
|
+
*/
|
|
296
|
+
function isAfter$1(date, dateToCompare) {
|
|
297
|
+
return +(0, _index.toDate)(date) > +(0, _index.toDate)(dateToCompare);
|
|
298
|
+
}
|
|
299
|
+
return isAfter;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
var isAfterExports = /*@__PURE__*/ requireIsAfter();
|
|
303
|
+
|
|
304
|
+
var isBefore = {};
|
|
305
|
+
|
|
306
|
+
var hasRequiredIsBefore;
|
|
307
|
+
|
|
308
|
+
function requireIsBefore () {
|
|
309
|
+
if (hasRequiredIsBefore) return isBefore;
|
|
310
|
+
hasRequiredIsBefore = 1;
|
|
311
|
+
isBefore.isBefore = isBefore$1;
|
|
312
|
+
var _index = /*@__PURE__*/ requireToDate();
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* @name isBefore
|
|
316
|
+
* @category Common Helpers
|
|
317
|
+
* @summary Is the first date before the second one?
|
|
318
|
+
*
|
|
319
|
+
* @description
|
|
320
|
+
* Is the first date before the second one?
|
|
321
|
+
*
|
|
322
|
+
* @param date - The date that should be before the other one to return true
|
|
323
|
+
* @param dateToCompare - The date to compare with
|
|
324
|
+
*
|
|
325
|
+
* @returns The first date is before the second date
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* // Is 10 July 1989 before 11 February 1987?
|
|
329
|
+
* const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
|
330
|
+
* //=> false
|
|
331
|
+
*/
|
|
332
|
+
function isBefore$1(date, dateToCompare) {
|
|
333
|
+
return +(0, _index.toDate)(date) < +(0, _index.toDate)(dateToCompare);
|
|
334
|
+
}
|
|
335
|
+
return isBefore;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
var isBeforeExports = /*@__PURE__*/ requireIsBefore();
|
|
339
|
+
|
|
340
|
+
var isSameMonth = {};
|
|
341
|
+
|
|
342
|
+
var hasRequiredIsSameMonth;
|
|
343
|
+
|
|
344
|
+
function requireIsSameMonth () {
|
|
345
|
+
if (hasRequiredIsSameMonth) return isSameMonth;
|
|
346
|
+
hasRequiredIsSameMonth = 1;
|
|
347
|
+
isSameMonth.isSameMonth = isSameMonth$1;
|
|
348
|
+
var _index = /*@__PURE__*/ requireNormalizeDates();
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* The {@link isSameMonth} function options.
|
|
352
|
+
*/
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @name isSameMonth
|
|
356
|
+
* @category Month Helpers
|
|
357
|
+
* @summary Are the given dates in the same month (and year)?
|
|
358
|
+
*
|
|
359
|
+
* @description
|
|
360
|
+
* Are the given dates in the same month (and year)?
|
|
361
|
+
*
|
|
362
|
+
* @param laterDate - The first date to check
|
|
363
|
+
* @param earlierDate - The second date to check
|
|
364
|
+
* @param options - An object with options
|
|
365
|
+
*
|
|
366
|
+
* @returns The dates are in the same month (and year)
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* // Are 2 September 2014 and 25 September 2014 in the same month?
|
|
370
|
+
* const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))
|
|
371
|
+
* //=> true
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* // Are 2 September 2014 and 25 September 2015 in the same month?
|
|
375
|
+
* const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))
|
|
376
|
+
* //=> false
|
|
377
|
+
*/
|
|
378
|
+
function isSameMonth$1(laterDate, earlierDate, options) {
|
|
379
|
+
const [laterDate_, earlierDate_] = (0, _index.normalizeDates)(
|
|
380
|
+
options?.in,
|
|
381
|
+
laterDate,
|
|
382
|
+
earlierDate,
|
|
383
|
+
);
|
|
384
|
+
return (
|
|
385
|
+
laterDate_.getFullYear() === earlierDate_.getFullYear() &&
|
|
386
|
+
laterDate_.getMonth() === earlierDate_.getMonth()
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
return isSameMonth;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
var isSameMonthExports = /*@__PURE__*/ requireIsSameMonth();
|
|
393
|
+
|
|
394
|
+
var startOfMonth = {};
|
|
395
|
+
|
|
396
|
+
var hasRequiredStartOfMonth;
|
|
397
|
+
|
|
398
|
+
function requireStartOfMonth () {
|
|
399
|
+
if (hasRequiredStartOfMonth) return startOfMonth;
|
|
400
|
+
hasRequiredStartOfMonth = 1;
|
|
401
|
+
startOfMonth.startOfMonth = startOfMonth$1;
|
|
402
|
+
var _index = /*@__PURE__*/ requireToDate();
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* The {@link startOfMonth} function options.
|
|
406
|
+
*/
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* @name startOfMonth
|
|
410
|
+
* @category Month Helpers
|
|
411
|
+
* @summary Return the start of a month for the given date.
|
|
412
|
+
*
|
|
413
|
+
* @description
|
|
414
|
+
* Return the start of a month for the given date. The result will be in the local timezone.
|
|
415
|
+
*
|
|
416
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments.
|
|
417
|
+
* Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
418
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed,
|
|
419
|
+
* or inferred from the arguments.
|
|
420
|
+
*
|
|
421
|
+
* @param date - The original date
|
|
422
|
+
* @param options - An object with options
|
|
423
|
+
*
|
|
424
|
+
* @returns The start of a month
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* // The start of a month for 2 September 2014 11:55:00:
|
|
428
|
+
* const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
|
|
429
|
+
* //=> Mon Sep 01 2014 00:00:00
|
|
430
|
+
*/
|
|
431
|
+
function startOfMonth$1(date, options) {
|
|
432
|
+
const _date = (0, _index.toDate)(date, options?.in);
|
|
433
|
+
_date.setDate(1);
|
|
434
|
+
_date.setHours(0, 0, 0, 0);
|
|
435
|
+
return _date;
|
|
436
|
+
}
|
|
437
|
+
return startOfMonth;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
var startOfMonthExports = /*@__PURE__*/ requireStartOfMonth();
|
|
441
|
+
|
|
442
|
+
var subMonths = {};
|
|
443
|
+
|
|
444
|
+
var hasRequiredSubMonths;
|
|
445
|
+
|
|
446
|
+
function requireSubMonths () {
|
|
447
|
+
if (hasRequiredSubMonths) return subMonths;
|
|
448
|
+
hasRequiredSubMonths = 1;
|
|
449
|
+
subMonths.subMonths = subMonths$1;
|
|
450
|
+
var _index = /*@__PURE__*/ requireAddMonths();
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* The subMonths function options.
|
|
454
|
+
*/
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* @name subMonths
|
|
458
|
+
* @category Month Helpers
|
|
459
|
+
* @summary Subtract the specified number of months from the given date.
|
|
460
|
+
*
|
|
461
|
+
* @description
|
|
462
|
+
* Subtract the specified number of months from the given date.
|
|
463
|
+
*
|
|
464
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
465
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
466
|
+
*
|
|
467
|
+
* @param date - The date to be changed
|
|
468
|
+
* @param amount - The amount of months to be subtracted.
|
|
469
|
+
* @param options - An object with options
|
|
470
|
+
*
|
|
471
|
+
* @returns The new date with the months subtracted
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* // Subtract 5 months from 1 February 2015:
|
|
475
|
+
* const result = subMonths(new Date(2015, 1, 1), 5)
|
|
476
|
+
* //=> Mon Sep 01 2014 00:00:00
|
|
477
|
+
*/
|
|
478
|
+
function subMonths$1(date, amount, options) {
|
|
479
|
+
return (0, _index.addMonths)(date, -amount, options);
|
|
480
|
+
}
|
|
481
|
+
return subMonths;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
var subMonthsExports = /*@__PURE__*/ requireSubMonths();
|
|
485
|
+
|
|
486
|
+
const VALID_WEEK_START_DAYS = [0, 1, 2, 3, 4, 5, 6];
|
|
487
|
+
/**
|
|
488
|
+
* Verifica se o valor informado representa um índice válido de início da semana.
|
|
489
|
+
*
|
|
490
|
+
* @param value - Valor bruto recebido via prop.
|
|
491
|
+
* @returns `true` quando o valor está entre `0` e `6`.
|
|
492
|
+
*/
|
|
493
|
+
function isValidWeekStartsOn(value) {
|
|
494
|
+
return VALID_WEEK_START_DAYS.includes(value);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Normaliza o índice de início da semana e aplica `0` quando o valor é inválido.
|
|
498
|
+
*
|
|
499
|
+
* @param value - Valor bruto recebido via prop.
|
|
500
|
+
* @returns Índice normalizado para o primeiro dia da semana.
|
|
501
|
+
*/
|
|
502
|
+
function normalizeWeekStartsOn(value) {
|
|
503
|
+
if (isValidWeekStartsOn(value))
|
|
504
|
+
return value;
|
|
505
|
+
warnInvalidPropValue('br-date-picker', 'weekStartsOn', String(value), '0');
|
|
506
|
+
return 0;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Valida se o código de locale pode ser resolvido pelo date-fns.
|
|
510
|
+
* Retorna true se a resolução for bem-sucedida (inclui fallback).
|
|
511
|
+
*
|
|
512
|
+
* @param value - Código de locale informado pelo consumidor.
|
|
513
|
+
* @returns `true` quando o locale pode ser resolvido com sucesso.
|
|
514
|
+
*/
|
|
515
|
+
function isValidLocaleCode(value) {
|
|
516
|
+
try {
|
|
517
|
+
resolveDateFnsLocale(value);
|
|
518
|
+
return true;
|
|
519
|
+
}
|
|
520
|
+
catch {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Normaliza o locale informado e aplica o default do componente quando necessário.
|
|
526
|
+
*
|
|
527
|
+
* @param value - Código de locale informado pelo consumidor.
|
|
528
|
+
* @returns Locale válido para o date picker.
|
|
529
|
+
*/
|
|
530
|
+
function normalizeLocale(value) {
|
|
531
|
+
if (isValidLocaleCode(value))
|
|
532
|
+
return value;
|
|
533
|
+
warnInvalidPropValue('br-date-picker', 'locale', value, DATETIME_PICKER_LOCALE.DEFAULT);
|
|
534
|
+
return DATETIME_PICKER_LOCALE.DEFAULT;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
const datePickerCss = () => `*,*::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}a{background-color:rgba(0,0,0,0)}b,strong{font-weight:bolder}code{font-family:monospace;font-size:1em}small{font-size:80%}img{border-style:none}button,input,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))}}@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))}}@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-in-out{animation-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}.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}.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)}.help{font-size:var(--font-size-scale-base)}code,.code{background:var(--gray-5);border-radius:4px;color:var(--gray-80);display:inline-block;font-family:monospace;font-size:var(--font-size-scale-base);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);padding:var(--spacing-scale-half)}*[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)}:host{display:block;width:100%;max-width:304px;height:auto;box-sizing:border-box}.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--spacing-scale-base);width:100%;box-sizing:border-box}select{appearance:none;border:none;background:rgba(0,0,0,0);padding-right:20px;font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-semi-bold);color:var(--blue-warm-vivid-70);outline:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path fill='%231351b4' d='M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L224 285.229l154.706-154.705c9.373-9.373 24.569-9.373 33.941 0l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.373-24.569 9.373-33.942 0z'/></svg>");background-repeat:no-repeat;background-position:right .35rem center;background-size:10px}select option{color:var(--color)}select:focus{outline:none}select:focus-visible{outline:var(--focus) var(--focus-style) var(--focus-width);outline-offset:var(--focus-offset)}select:hover{cursor:pointer}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;white-space:nowrap;border:0}input[type=number]{width:70px;padding:4px;font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-semi-bold);background-color:var(--gray-0);color:var(--gray-80);text-align:center;border-color:var(--border-color-alternative);border-radius:var(--surface-rounder-sm);border-style:var(--border-style);border-width:var(--border-width)}input[type=number]:hover{background:linear-gradient(rgb(var(--color-rgb), var(--hover)), rgb(var(--color-rgb), var(--hover)))}.weekdays{margin-bottom:var(--spacing-scale-half)}.weekdays,.monthdays{display:grid;grid-template-columns:repeat(7, 1fr);place-items:center center;text-align:center;gap:var(--spacing-scale-half) var(--spacing-scale-half);width:100%;box-sizing:border-box}.weekday{display:flex;align-items:center;justify-content:center;font-weight:var(--font-weight-medium);color:var(--gray-70);width:var(--spacing-scale-4x)}.week{display:contents}.day{display:flex;align-items:center;justify-content:center;justify-self:center;padding:var(--spacing-scale-half);font-weight:var(--font-weight-semi-bold);color:var(--blue-warm-vivid-70);border-radius:50%;width:var(--spacing-scale-4x);height:var(--spacing-scale-4x)}.day:hover{background:var(--hover-effect);cursor:pointer}.day:focus-visible{outline:var(--focus) var(--focus-style) var(--focus-width);outline-offset:var(--focus-offset)}.day.selected{background:var(--blue-warm-vivid-70);color:var(--color-secondary-01);font-weight:var(--font-weight-bold)}.day.in-range{background:var(--blue-warm-vivid-10);color:var(--blue-warm-vivid-70);border-radius:0;place-self:stretch stretch;width:100%;height:100%;overflow:hidden}.day.range-start{background:var(--blue-warm-vivid-70);color:var(--color-secondary-01);font-weight:var(--font-weight-bold);width:100%;height:100%;border-radius:var(--surface-rounder-pill) 0 0 var(--surface-rounder-pill);place-self:stretch stretch;overflow:hidden}.day.range-end{background:var(--blue-warm-vivid-70);color:var(--color-secondary-01);font-weight:var(--font-weight-bold);width:100%;height:100%;border-radius:0 var(--surface-rounder-pill) var(--surface-rounder-pill) 0;place-self:stretch stretch;overflow:hidden}.day.range-start.range-end{border-radius:var(--surface-rounder-pill);height:100%;overflow:hidden}.day.disabled{opacity:.45;cursor:not-allowed;pointer-events:none}.outside-month{font-weight:var(--font-weight-regular);color:var(--gray-70)}.today{background:var(--orange-vivid-5);color:var(--gray-80)}`;
|
|
538
|
+
|
|
539
|
+
const DatePicker = class {
|
|
540
|
+
constructor(hostRef) {
|
|
541
|
+
registerInstance(this, hostRef);
|
|
542
|
+
this.dateStateChange = createEvent(this, "dateStateChange", 7);
|
|
543
|
+
/** Data com foco atual na navegação por teclado do calendário. */
|
|
544
|
+
this.focusedDate = new Date();
|
|
545
|
+
/** Define o índice do dia em que a semana começa na interface do calendário. */
|
|
546
|
+
this.weekStartsOn = 0;
|
|
547
|
+
/** Data usada como base visual para o mês atualmente exibido. */
|
|
548
|
+
this.referenceDate = new Date();
|
|
549
|
+
/** Data atualmente selecionada pelo usuário, ou `null` quando não há seleção. */
|
|
550
|
+
this.value = null;
|
|
551
|
+
/** Define se a seleção ocorre por data única ou por intervalo. */
|
|
552
|
+
this.selectionMode = 'single';
|
|
553
|
+
/** Data inicial selecionada quando o calendário opera no modo de intervalo. */
|
|
554
|
+
this.rangeStart = null;
|
|
555
|
+
/** Data final selecionada quando o calendário opera no modo de intervalo. */
|
|
556
|
+
this.rangeEnd = null;
|
|
557
|
+
/** Desabilita a interação do calendário quando ativo. */
|
|
558
|
+
this.disabled = false;
|
|
559
|
+
/** Lista de datas indisponíveis para seleção no calendário. */
|
|
560
|
+
this.disabledDates = [];
|
|
561
|
+
/** Locale usado para gerar nomes de meses e dias da semana. */
|
|
562
|
+
this.locale = DATETIME_PICKER_LOCALE.DEFAULT;
|
|
563
|
+
/**
|
|
564
|
+
* Define se o calendário deve manter um número fixo de linhas (6 semanas = 42 dias)
|
|
565
|
+
* ou variar conforme o mês.
|
|
566
|
+
*
|
|
567
|
+
* Quando `true`, o calendário sempre exibe 6 semanas completas.
|
|
568
|
+
* Quando `false`, o calendário adapta-se ao mês, exibindo apenas as semanas necessárias.
|
|
569
|
+
*
|
|
570
|
+
* @default false
|
|
571
|
+
*/
|
|
572
|
+
this.fixedRowCount = false;
|
|
573
|
+
/** Sinaliza ao componentDidRender que deve mover o foco para a célula atual. */
|
|
574
|
+
this.shouldFocusDate = false;
|
|
575
|
+
/** Mantém handlers estáveis por data para evitar recriação a cada renderização. */
|
|
576
|
+
this.dayClickHandlers = new WeakMap();
|
|
577
|
+
/**
|
|
578
|
+
* Atualiza o mês exibido a partir da seleção do usuário.
|
|
579
|
+
*
|
|
580
|
+
* @param event - Mudança do `<select>` de mês.
|
|
581
|
+
*/
|
|
582
|
+
this.handleMonthChange = (event) => {
|
|
583
|
+
if (this.disabled) {
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
const select = event.currentTarget;
|
|
587
|
+
const monthIndex = Number(select.value);
|
|
588
|
+
if (Number.isNaN(monthIndex) || monthIndex < 0 || monthIndex > 11) {
|
|
589
|
+
console.warn(`Índice de mês inválido selecionado: ${select.value}`);
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
const date = setExports.set(this.baseDate, { month: monthIndex, date: 1 });
|
|
593
|
+
this.emitDateStateChange(date);
|
|
594
|
+
};
|
|
595
|
+
/**
|
|
596
|
+
* Executa a ação de navegação associada ao botão clicado.
|
|
597
|
+
*
|
|
598
|
+
* @param event - Clique no botão de navegação.
|
|
599
|
+
*/
|
|
600
|
+
this.handleNavigationClick = (event) => {
|
|
601
|
+
const action = event.currentTarget.dataset.action;
|
|
602
|
+
if (action === undefined) {
|
|
603
|
+
console.warn('Botão de navegação clicado sem data-action definido');
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
switch (action) {
|
|
607
|
+
case NAVIGATION_ACTION.PREVIOUS_MONTH:
|
|
608
|
+
this.decreaseMonth();
|
|
609
|
+
break;
|
|
610
|
+
case NAVIGATION_ACTION.NEXT_MONTH:
|
|
611
|
+
this.increaseMonth();
|
|
612
|
+
break;
|
|
613
|
+
default:
|
|
614
|
+
console.warn(`Ação de navegação desconhecida: ${action}`);
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
/**
|
|
618
|
+
* Atualiza o ano exibido a partir do valor digitado.
|
|
619
|
+
*
|
|
620
|
+
* @param event - Mudança do campo de ano.
|
|
621
|
+
*/
|
|
622
|
+
this.handleYearChange = (event) => {
|
|
623
|
+
if (this.disabled) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
const input = event.currentTarget;
|
|
627
|
+
const year = Number(input.value);
|
|
628
|
+
if (Number.isNaN(year) || year < 1 || year > 9999) {
|
|
629
|
+
console.warn(`Ano inválido digitado: ${input.value}`);
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
const date = setExports.set(this.baseDate, { year, month: this.baseDate.getMonth(), date: 1 });
|
|
633
|
+
const range = this.selectionMode === 'range' && this.rangeStart !== null && this.rangeEnd !== null
|
|
634
|
+
? { start: this.rangeStart, end: this.rangeEnd }
|
|
635
|
+
: undefined;
|
|
636
|
+
this.emitDateStateChange(date, this.value, range);
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* Gerencia a navegação por teclado dentro da grade de dias.
|
|
640
|
+
*
|
|
641
|
+
* Teclas suportadas:
|
|
642
|
+
* - `ArrowLeft` / `ArrowRight`: avança ou recua um dia.
|
|
643
|
+
* - `ArrowUp` / `ArrowDown`: avança ou recua sete dias (linha inteira).
|
|
644
|
+
* - `PageUp` / `PageDown`: navega entre meses.
|
|
645
|
+
* - `Home` / `End`: primeiro ou último dia da semana atual.
|
|
646
|
+
* - `Enter` / `Space`: seleciona o dia com foco.
|
|
647
|
+
*
|
|
648
|
+
* @param event - Evento de teclado disparado na grade.
|
|
649
|
+
*/
|
|
650
|
+
this.handleGridKeydown = (event) => {
|
|
651
|
+
const HANDLED_KEYS = [
|
|
652
|
+
'ArrowLeft',
|
|
653
|
+
'ArrowRight',
|
|
654
|
+
'ArrowUp',
|
|
655
|
+
'ArrowDown',
|
|
656
|
+
'PageUp',
|
|
657
|
+
'PageDown',
|
|
658
|
+
'Home',
|
|
659
|
+
'End',
|
|
660
|
+
'Enter',
|
|
661
|
+
' ',
|
|
662
|
+
];
|
|
663
|
+
if (!HANDLED_KEYS.includes(event.key))
|
|
664
|
+
return;
|
|
665
|
+
const target = event.target;
|
|
666
|
+
const dateKey = target.dataset?.date;
|
|
667
|
+
if (dateKey === undefined)
|
|
668
|
+
return;
|
|
669
|
+
event.preventDefault();
|
|
670
|
+
const current = parseExports.parse(dateKey, 'yyyy-MM-dd', new Date());
|
|
671
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
672
|
+
if (!this.isDateDisabled(current)) {
|
|
673
|
+
this.handleDayClick(current);
|
|
674
|
+
}
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
let next;
|
|
678
|
+
switch (event.key) {
|
|
679
|
+
case 'ArrowLeft':
|
|
680
|
+
next = addDaysExports.addDays(current, -1);
|
|
681
|
+
break;
|
|
682
|
+
case 'ArrowRight':
|
|
683
|
+
next = addDaysExports.addDays(current, 1);
|
|
684
|
+
break;
|
|
685
|
+
case 'ArrowUp':
|
|
686
|
+
next = addDaysExports.addDays(current, -7);
|
|
687
|
+
break;
|
|
688
|
+
case 'ArrowDown':
|
|
689
|
+
next = addDaysExports.addDays(current, 7);
|
|
690
|
+
break;
|
|
691
|
+
case 'PageUp':
|
|
692
|
+
next = addMonthsExports.addMonths(current, -1);
|
|
693
|
+
break;
|
|
694
|
+
case 'PageDown':
|
|
695
|
+
next = addMonthsExports.addMonths(current, 1);
|
|
696
|
+
break;
|
|
697
|
+
case 'Home':
|
|
698
|
+
next = startOfWeekExports.startOfWeek(current, { weekStartsOn: this.weekStartsOn });
|
|
699
|
+
break;
|
|
700
|
+
case 'End':
|
|
701
|
+
next = endOfWeekExports.endOfWeek(current, { weekStartsOn: this.weekStartsOn });
|
|
702
|
+
break;
|
|
703
|
+
default:
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
this.moveFocusTo(next);
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
handleRangeValueChange(newValue) {
|
|
710
|
+
if (!newValue)
|
|
711
|
+
return;
|
|
712
|
+
this.rangeStart = newValue.start;
|
|
713
|
+
this.rangeEnd = newValue.end;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Sincroniza `focusedDate` quando o valor selecionado muda externamente.
|
|
717
|
+
*
|
|
718
|
+
* @param newValue - Novo valor recebido via prop.
|
|
719
|
+
*/
|
|
720
|
+
handleValueChange(newValue) {
|
|
721
|
+
if (newValue !== null) {
|
|
722
|
+
this.focusedDate = toDateExports.toDate(newValue);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Revalida a configuração quando o início da semana muda.
|
|
727
|
+
*
|
|
728
|
+
* @param newValue - Novo valor recebido via prop.
|
|
729
|
+
*/
|
|
730
|
+
handleWeekStartsOnChange(newValue) {
|
|
731
|
+
this.ensureValidWeekStartsOn(newValue);
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Revalida o locale quando a prop muda.
|
|
735
|
+
*
|
|
736
|
+
* @param newValue - Novo valor recebido via prop.
|
|
737
|
+
*/
|
|
738
|
+
handleLocaleChange(newValue) {
|
|
739
|
+
this.ensureValidLocale(newValue);
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Normaliza os valores públicos antes da primeira renderização.
|
|
743
|
+
*/
|
|
744
|
+
componentWillLoad() {
|
|
745
|
+
this.referenceDate = resolveSsrLocalDate(this.el, this.referenceDate);
|
|
746
|
+
this.ensureValidWeekStartsOn();
|
|
747
|
+
this.ensureValidLocale();
|
|
748
|
+
this.focusedDate = toDateExports.toDate(this.value ?? this.referenceDate);
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Move o foco para a célula correspondente ao `focusedDate` após re-renderização.
|
|
752
|
+
*/
|
|
753
|
+
componentDidRender() {
|
|
754
|
+
if (!this.shouldFocusDate)
|
|
755
|
+
return;
|
|
756
|
+
this.shouldFocusDate = false;
|
|
757
|
+
const normalizedDate = this.getNormalizedFocusedDate();
|
|
758
|
+
const dateKey = formatExports.format(normalizedDate, 'yyyy-MM-dd');
|
|
759
|
+
const cell = this.el.shadowRoot?.querySelector(`[data-date="${dateKey}"]`);
|
|
760
|
+
cell?.focus();
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Garante que o valor de `weekStartsOn` esteja dentro do domínio suportado.
|
|
764
|
+
*
|
|
765
|
+
* @param value - Valor bruto informado pelo consumidor.
|
|
766
|
+
*/
|
|
767
|
+
ensureValidWeekStartsOn(value = this.weekStartsOn) {
|
|
768
|
+
const normalizedWeekStartsOn = normalizeWeekStartsOn(value);
|
|
769
|
+
if (normalizedWeekStartsOn !== value) {
|
|
770
|
+
this.weekStartsOn = normalizedWeekStartsOn;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Garante que o locale informado seja suportado.
|
|
775
|
+
*
|
|
776
|
+
* @param value - Valor bruto informado pelo consumidor.
|
|
777
|
+
*/
|
|
778
|
+
ensureValidLocale(value = this.locale) {
|
|
779
|
+
const normalizedLocale = normalizeLocale(value);
|
|
780
|
+
if (normalizedLocale !== value) {
|
|
781
|
+
this.locale = normalizedLocale;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Emite o estado consolidado do componente para manter a navegação sincronizada.
|
|
786
|
+
*
|
|
787
|
+
* @param nextReferenceDate - Nova data de referência após a interação.
|
|
788
|
+
* @param nextValue - Valor selecionado final; por padrão, mantém a seleção atual.
|
|
789
|
+
*/
|
|
790
|
+
emitDateStateChange(nextReferenceDate, nextValue = this.value, nextRange = undefined) {
|
|
791
|
+
// Garantir segundos zerados (componente não manipula segundos)
|
|
792
|
+
const normalizedReference = setExports.set(nextReferenceDate, { seconds: 0, milliseconds: 0 });
|
|
793
|
+
const normalizedValue = nextValue === null ? null : setExports.set(nextValue, { seconds: 0, milliseconds: 0 });
|
|
794
|
+
const valueChanged = this.value?.getTime() !== normalizedValue?.getTime();
|
|
795
|
+
this.value = normalizedValue;
|
|
796
|
+
this.dateStateChange.emit({
|
|
797
|
+
referenceDate: normalizedReference,
|
|
798
|
+
value: normalizedValue,
|
|
799
|
+
range: nextRange,
|
|
800
|
+
});
|
|
801
|
+
if (nextRange)
|
|
802
|
+
this.rangeValue = nextRange;
|
|
803
|
+
if (valueChanged || nextRange !== undefined) {
|
|
804
|
+
dispatchNativeFormEvent(this.el, 'input');
|
|
805
|
+
dispatchNativeFormEvent(this.el, 'change');
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Resolve o ícone usado em cada ação de navegação.
|
|
810
|
+
*
|
|
811
|
+
* @param action - Ação de navegação representada pelo botão.
|
|
812
|
+
* @returns Nome do ícone ou um fallback quando a ação não é reconhecida.
|
|
813
|
+
*/
|
|
814
|
+
getIconForAction(action) {
|
|
815
|
+
switch (action) {
|
|
816
|
+
case NAVIGATION_ACTION.PREVIOUS_MONTH:
|
|
817
|
+
return 'fa6-solid:chevron-left';
|
|
818
|
+
case NAVIGATION_ACTION.NEXT_MONTH:
|
|
819
|
+
return 'fa6-solid:chevron-right';
|
|
820
|
+
default:
|
|
821
|
+
return 'fa6-solid:question';
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Aplica a data clicada preservando hora e minuto da referência atual.
|
|
826
|
+
*
|
|
827
|
+
* @param date - Dia selecionado no calendário.
|
|
828
|
+
*/
|
|
829
|
+
handleDayClick(date) {
|
|
830
|
+
if (this.disabled || this.isDateDisabled(date)) {
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
const newDate = setExports.set(date, {
|
|
834
|
+
hours: this.referenceDate.getHours(),
|
|
835
|
+
minutes: this.referenceDate.getMinutes(),
|
|
836
|
+
seconds: 0,
|
|
837
|
+
milliseconds: 0,
|
|
838
|
+
});
|
|
839
|
+
if (this.selectionMode === 'range') {
|
|
840
|
+
this.handleRangeDayClick(newDate);
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
this.emitDateStateChange(newDate, newDate);
|
|
844
|
+
}
|
|
845
|
+
/** Atualiza o intervalo selecionado com base no clique atual. */
|
|
846
|
+
handleRangeDayClick(clickedDate) {
|
|
847
|
+
const start = this.rangeStart;
|
|
848
|
+
const end = this.rangeEnd;
|
|
849
|
+
if (start === null || end !== null) {
|
|
850
|
+
this.emitDateStateChange(clickedDate, clickedDate, {
|
|
851
|
+
start: clickedDate,
|
|
852
|
+
end: null,
|
|
853
|
+
});
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
const [normalizedStart, normalizedEnd] = this.normalizeRangeBounds(start, clickedDate);
|
|
857
|
+
this.emitDateStateChange(clickedDate, normalizedEnd, {
|
|
858
|
+
start: normalizedStart,
|
|
859
|
+
end: normalizedEnd,
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
/** Decrementa o mês mantendo o primeiro dia do mês exibido e preservando a seleção de range. */
|
|
863
|
+
decreaseMonth() {
|
|
864
|
+
if (this.disabled) {
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
const date = setExports.set(subMonthsExports.subMonths(this.baseDate, 1), { date: 1 });
|
|
868
|
+
const range = this.selectionMode === 'range' && this.rangeStart !== null && this.rangeEnd !== null
|
|
869
|
+
? { start: this.rangeStart, end: this.rangeEnd }
|
|
870
|
+
: undefined;
|
|
871
|
+
this.emitDateStateChange(date, this.value, range);
|
|
872
|
+
}
|
|
873
|
+
/** Incrementa o mês mantendo o primeiro dia do mês exibido e preservando a seleção de range. */
|
|
874
|
+
increaseMonth() {
|
|
875
|
+
if (this.disabled) {
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const date = setExports.set(addMonthsExports.addMonths(this.baseDate, 1), { date: 1 });
|
|
879
|
+
const range = this.selectionMode === 'range' && this.rangeStart !== null && this.rangeEnd !== null
|
|
880
|
+
? { start: this.rangeStart, end: this.rangeEnd }
|
|
881
|
+
: undefined;
|
|
882
|
+
this.emitDateStateChange(date, this.value, range);
|
|
883
|
+
}
|
|
884
|
+
/** Indica se um dia está indisponível para seleção. */
|
|
885
|
+
isDateDisabled(date) {
|
|
886
|
+
return this.disabledDates.some((disabledDate) => isSameDayExports.isSameDay(disabledDate, date));
|
|
887
|
+
}
|
|
888
|
+
/** Data base usada para todos os cálculos de calendário. */
|
|
889
|
+
get baseDate() {
|
|
890
|
+
return this.referenceDate;
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Recupera um handler estável para a célula do dia informado.
|
|
894
|
+
*
|
|
895
|
+
* @param date - Dia representado pela célula.
|
|
896
|
+
* @returns Função de clique reutilizável.
|
|
897
|
+
*/
|
|
898
|
+
getDayClickHandler(date) {
|
|
899
|
+
let handler = this.dayClickHandlers.get(date);
|
|
900
|
+
if (handler === undefined) {
|
|
901
|
+
handler = () => this.handleDayClick(date);
|
|
902
|
+
this.dayClickHandlers.set(date, handler);
|
|
903
|
+
}
|
|
904
|
+
return handler;
|
|
905
|
+
}
|
|
906
|
+
/** Formata o dia exibido com zero à esquerda. */
|
|
907
|
+
getDayWithLeadingZero(date) {
|
|
908
|
+
return formatExports.format(date, 'dd');
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Constrói o rótulo acessível completo da célula de dia.
|
|
912
|
+
*
|
|
913
|
+
* @param date - Dia representado pela célula.
|
|
914
|
+
* @returns Texto anunciado pelo leitor de tela, incluindo estado de seleção.
|
|
915
|
+
*/
|
|
916
|
+
getDayCellAriaLabel(date) {
|
|
917
|
+
const fullDate = formatExports.format(date, "d 'de' MMMM 'de' yyyy", { locale: this.dateFnsLocale });
|
|
918
|
+
const isSelected = this.selectionMode === 'single' && this.value !== null && isSameDayExports.isSameDay(date, this.value);
|
|
919
|
+
const isRangeStart = this.selectionMode === 'range' && this.rangeStart !== null && isSameDayExports.isSameDay(date, this.rangeStart);
|
|
920
|
+
const isRangeEnd = this.selectionMode === 'range' && this.rangeEnd !== null && isSameDayExports.isSameDay(date, this.rangeEnd);
|
|
921
|
+
const isBetween = this.selectionMode === 'range' &&
|
|
922
|
+
this.rangeStart !== null &&
|
|
923
|
+
this.rangeEnd !== null &&
|
|
924
|
+
this.isDateBetweenRange(date, this.rangeStart, this.rangeEnd);
|
|
925
|
+
if (isSelected)
|
|
926
|
+
return `${fullDate}, selecionado`;
|
|
927
|
+
if (isRangeStart)
|
|
928
|
+
return `${fullDate}, início do intervalo`;
|
|
929
|
+
if (isRangeEnd)
|
|
930
|
+
return `${fullDate}, fim do intervalo`;
|
|
931
|
+
if (isBetween)
|
|
932
|
+
return `${fullDate}, no intervalo selecionado`;
|
|
933
|
+
return fullDate;
|
|
934
|
+
}
|
|
935
|
+
/** Locale do date-fns derivado da prop pública do componente. */
|
|
936
|
+
get dateFnsLocale() {
|
|
937
|
+
return resolveDateFnsLocale(this.locale);
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Calcula as classes CSS da célula do dia com base em seleção, mês e data atual.
|
|
941
|
+
*
|
|
942
|
+
* @param date - Dia da grade do calendário.
|
|
943
|
+
*/
|
|
944
|
+
getDayCssClasses(date) {
|
|
945
|
+
const selected = this.value;
|
|
946
|
+
const rangeStart = this.rangeStart;
|
|
947
|
+
const rangeEnd = this.rangeEnd;
|
|
948
|
+
const hasRange = rangeStart !== null && rangeEnd !== null;
|
|
949
|
+
const isRangeStart = rangeStart !== null && isSameDayExports.isSameDay(date, rangeStart);
|
|
950
|
+
const isRangeEnd = rangeEnd !== null && isSameDayExports.isSameDay(date, rangeEnd);
|
|
951
|
+
const isBetweenRange = hasRange && this.isDateBetweenRange(date, rangeStart, rangeEnd);
|
|
952
|
+
return {
|
|
953
|
+
day: true,
|
|
954
|
+
'outside-month': !isSameMonthExports.isSameMonth(date, this.baseDate),
|
|
955
|
+
today: isSameDayExports.isSameDay(date, toDateExports.toDate(new Date())),
|
|
956
|
+
selected: this.selectionMode === 'single' && selected !== null && isSameDayExports.isSameDay(date, selected),
|
|
957
|
+
'range-start': this.selectionMode === 'range' && isRangeStart,
|
|
958
|
+
'range-end': this.selectionMode === 'range' && isRangeEnd,
|
|
959
|
+
'in-range': this.selectionMode === 'range' && isBetweenRange,
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
/** Normaliza os limites do intervalo para garantir ordem cronológica. */
|
|
963
|
+
normalizeRangeBounds(start, end) {
|
|
964
|
+
return compareAscExports.compareAsc(start, end) <= 0 ? [start, end] : [end, start];
|
|
965
|
+
}
|
|
966
|
+
/** Verifica se uma data está estritamente entre início e fim do intervalo. */
|
|
967
|
+
isDateBetweenRange(date, start, end) {
|
|
968
|
+
return isAfterExports.isAfter(date, start) && isBeforeExports.isBefore(date, end);
|
|
969
|
+
}
|
|
970
|
+
/** Gera a sequência completa de dias visíveis na grade do mês. */
|
|
971
|
+
getMonthViewDates() {
|
|
972
|
+
const start = startOfWeekExports.startOfWeek(startOfMonthExports.startOfMonth(this.baseDate), { weekStartsOn: this.weekStartsOn });
|
|
973
|
+
let end = endOfWeekExports.endOfWeek(endOfMonthExports.endOfMonth(this.baseDate), { weekStartsOn: this.weekStartsOn });
|
|
974
|
+
// Se fixedRowCount está ativo, garante sempre 6 semanas (42 dias)
|
|
975
|
+
if (this.fixedRowCount) {
|
|
976
|
+
// Calcula o número de semanas que seriam normalmente geradas
|
|
977
|
+
const normalizedDates = eachDayOfIntervalExports.eachDayOfInterval({ start, end });
|
|
978
|
+
const currentWeekCount = Math.ceil(normalizedDates.length / 7);
|
|
979
|
+
const targetWeekCount = 6;
|
|
980
|
+
// Se não houver 6 semanas, estende o final para alcançar 42 dias
|
|
981
|
+
if (currentWeekCount < targetWeekCount) {
|
|
982
|
+
const daysToAdd = (targetWeekCount - currentWeekCount) * 7;
|
|
983
|
+
end = addDaysExports.addDays(end, daysToAdd);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
return eachDayOfIntervalExports.eachDayOfInterval({ start, end });
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Retorna o `focusedDate` normalizado para estar sempre dentro da grade visível.
|
|
990
|
+
*
|
|
991
|
+
* Se `focusedDate` não estiver visível no mês atual, retorna o primeiro dia
|
|
992
|
+
* da grade do mês para garantir que sempre haja um elemento com `tabIndex={0}`.
|
|
993
|
+
*
|
|
994
|
+
* @returns Data focada normalizada ou primeiro dia da grade.
|
|
995
|
+
*/
|
|
996
|
+
getNormalizedFocusedDate() {
|
|
997
|
+
const visibleDates = this.getMonthViewDates();
|
|
998
|
+
const isInCurrentMonth = visibleDates.some((d) => isSameDayExports.isSameDay(d, this.focusedDate));
|
|
999
|
+
if (isInCurrentMonth) {
|
|
1000
|
+
return this.focusedDate;
|
|
1001
|
+
}
|
|
1002
|
+
return visibleDates[0] ?? this.focusedDate;
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Constrói o rótulo acessível dos botões de navegação do mês.
|
|
1006
|
+
*
|
|
1007
|
+
* @param action - Ação associada ao botão.
|
|
1008
|
+
* @returns Texto acessível exibido para leitores de tela.
|
|
1009
|
+
*/
|
|
1010
|
+
getNavigationAriaLabel(action) {
|
|
1011
|
+
switch (action) {
|
|
1012
|
+
case NAVIGATION_ACTION.PREVIOUS_MONTH:
|
|
1013
|
+
return `Ir para o mês anterior, ${formatExports.format(addMonthsExports.addMonths(this.referenceDate, -1), 'MMMM', { locale: this.dateFnsLocale })}`;
|
|
1014
|
+
case NAVIGATION_ACTION.NEXT_MONTH:
|
|
1015
|
+
return `Ir para o próximo mês, ${formatExports.format(addMonthsExports.addMonths(this.referenceDate, 1), 'MMMM', { locale: this.dateFnsLocale })}`;
|
|
1016
|
+
default:
|
|
1017
|
+
return 'Navegar';
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
/** Retorna os rótulos das semanas conforme locale e início da semana. */
|
|
1021
|
+
getWeekdayLabels() {
|
|
1022
|
+
return getWeekdayLabels(this.locale, this.weekStartsOn);
|
|
1023
|
+
}
|
|
1024
|
+
/** Retorna os rótulos dos meses no locale atual. */
|
|
1025
|
+
getMonthLabels() {
|
|
1026
|
+
return getMonthLabels(this.locale);
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Renderiza um botão consistente de navegação do calendário.
|
|
1030
|
+
*
|
|
1031
|
+
* @param action - Ação executada pelo botão.
|
|
1032
|
+
*/
|
|
1033
|
+
renderNavigationButton(action) {
|
|
1034
|
+
return (h("br-button", { emphasis: "tertiary", density: "small", shape: "circle", disabled: this.disabled, "data-action": action, "aria-label": this.getNavigationAriaLabel(action), onClick: this.handleNavigationClick }, h("br-icon", { iconName: this.getIconForAction(action), width: "20", height: "20", "aria-hidden": "true" })));
|
|
1035
|
+
}
|
|
1036
|
+
/** Renderiza o cabeçalho do calendário com navegação, mês e ano. */
|
|
1037
|
+
renderCalendarHeader() {
|
|
1038
|
+
return (h("div", { class: "header", part: "header" }, this.renderNavigationButton(NAVIGATION_ACTION.PREVIOUS_MONTH), this.renderMonthSelection(), this.renderYearSelection(), this.renderNavigationButton(NAVIGATION_ACTION.NEXT_MONTH)));
|
|
1039
|
+
}
|
|
1040
|
+
/** Renderiza a seleção de mês com label acessível. */
|
|
1041
|
+
renderMonthSelection() {
|
|
1042
|
+
return (h("label", { class: "month-selection" }, h("span", { class: "visually-hidden" }, "Selecionar m\u00EAs"), h("select", { onChange: this.handleMonthChange, "aria-label": "Selecionar m\u00EAs", disabled: this.disabled, part: "month-select" }, this.getMonthLabels().map(this.renderMonthOption, this))));
|
|
1043
|
+
}
|
|
1044
|
+
/** Renderiza o campo de ano com label acessível. */
|
|
1045
|
+
renderYearSelection() {
|
|
1046
|
+
return (h("label", { class: "year-selection" }, h("span", { class: "visually-hidden" }, "Selecionar ano"), h("input", { type: "number", value: this.referenceDate.getFullYear(), onChange: this.handleYearChange, "aria-label": "Selecionar ano", disabled: this.disabled, part: "year-input" })));
|
|
1047
|
+
}
|
|
1048
|
+
/** Renderiza uma opção do seletor de meses. */
|
|
1049
|
+
renderMonthOption(month, index) {
|
|
1050
|
+
return (h("option", { key: `month-${index}`, value: index, selected: index === this.referenceDate.getMonth() }, month));
|
|
1051
|
+
}
|
|
1052
|
+
/** Renderiza a estrutura principal do calendário. */
|
|
1053
|
+
renderCalendar() {
|
|
1054
|
+
const monthLabel = formatExports.format(this.baseDate, "MMMM 'de' yyyy", { locale: this.dateFnsLocale });
|
|
1055
|
+
return (h("div", { class: "calendar", role: "grid", "aria-label": `Calendário de ${monthLabel}`, part: "calendar" }, this.renderWeekdays(), this.renderMonthGrid()));
|
|
1056
|
+
}
|
|
1057
|
+
/** Renderiza a linha de rótulos dos dias da semana. */
|
|
1058
|
+
renderWeekdays() {
|
|
1059
|
+
const labels = this.getWeekdayLabels();
|
|
1060
|
+
return (h("div", { class: "weekdays", role: "row", tabIndex: -1, part: "weekdays" }, labels.map((label, index) => (h("div", { key: `weekday-${index}`, class: "weekday", role: "columnheader", tabIndex: -1, "aria-label": label, part: "weekday" }, label)))));
|
|
1061
|
+
}
|
|
1062
|
+
/** Renderiza a grade com os dias do mês atual. */
|
|
1063
|
+
renderMonthGrid() {
|
|
1064
|
+
const dates = this.getMonthViewDates();
|
|
1065
|
+
const weeks = Array.from({ length: Math.ceil(dates.length / 7) }, (_, index) => dates.slice(index * 7, index * 7 + 7));
|
|
1066
|
+
return (h("div", { class: "monthdays", role: "rowgroup", onKeyDown: this.handleGridKeydown, part: "grid" }, weeks.map((week) => (h("div", { key: `week-${formatExports.format(week[0], 'yyyy-MM-dd')}`, class: "week", role: "row", tabIndex: -1 }, week.map(this.renderDayCell, this))))));
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Move o foco de teclado para a data informada, navegando de mês quando necessário.
|
|
1070
|
+
*
|
|
1071
|
+
* @param date - Data de destino do foco.
|
|
1072
|
+
*/
|
|
1073
|
+
moveFocusTo(date) {
|
|
1074
|
+
this.focusedDate = date;
|
|
1075
|
+
this.shouldFocusDate = true;
|
|
1076
|
+
if (!isSameMonthExports.isSameMonth(date, this.baseDate)) {
|
|
1077
|
+
this.emitDateStateChange(date, this.value);
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
/** Renderiza uma célula de dia com estado visual apropriado. */
|
|
1081
|
+
renderDayCell(date) {
|
|
1082
|
+
const disabled = this.disabled || this.isDateDisabled(date);
|
|
1083
|
+
const isSelected = this.selectionMode === 'single' && this.value !== null && isSameDayExports.isSameDay(date, this.value);
|
|
1084
|
+
const isRangeStart = this.selectionMode === 'range' && this.rangeStart !== null && isSameDayExports.isSameDay(date, this.rangeStart);
|
|
1085
|
+
const isRangeEnd = this.selectionMode === 'range' && this.rangeEnd !== null && isSameDayExports.isSameDay(date, this.rangeEnd);
|
|
1086
|
+
const isActiveDay = isSelected || isRangeStart || isRangeEnd;
|
|
1087
|
+
const isFocused = isSameDayExports.isSameDay(date, this.getNormalizedFocusedDate());
|
|
1088
|
+
return (h("div", { key: formatExports.format(date, 'yyyy-MM-dd'), role: "gridcell", tabIndex: this.disabled ? undefined : isFocused ? 0 : -1, "data-date": formatExports.format(date, 'yyyy-MM-dd'), class: { ...this.getDayCssClasses(date), disabled }, onClick: disabled ? undefined : this.getDayClickHandler(date), onKeyDown: disabled ? undefined : this.handleGridKeydown, "aria-label": this.getDayCellAriaLabel(date), "aria-selected": isActiveDay ? 'true' : 'false', "aria-disabled": disabled ? 'true' : null, part: "day" }, this.getDayWithLeadingZero(date)));
|
|
1089
|
+
}
|
|
1090
|
+
render() {
|
|
1091
|
+
return (h(Host, { key: 'b2bba9b38a0b935e0599348dbb8492a7bb3fa7ac' }, h("div", { key: '101d12846aa77d98e3a926bd43a1cdbc779de202', class: "br-date-picker", part: "container" }, this.renderCalendarHeader(), this.renderCalendar())));
|
|
1092
|
+
}
|
|
1093
|
+
get el() { return getElement(this); }
|
|
1094
|
+
static get watchers() { return {
|
|
1095
|
+
"rangeValue": [{
|
|
1096
|
+
"handleRangeValueChange": 0
|
|
1097
|
+
}],
|
|
1098
|
+
"value": [{
|
|
1099
|
+
"handleValueChange": 0
|
|
1100
|
+
}],
|
|
1101
|
+
"weekStartsOn": [{
|
|
1102
|
+
"handleWeekStartsOnChange": 0
|
|
1103
|
+
}],
|
|
1104
|
+
"locale": [{
|
|
1105
|
+
"handleLocaleChange": 0
|
|
1106
|
+
}]
|
|
1107
|
+
}; }
|
|
1108
|
+
};
|
|
1109
|
+
DatePicker.style = datePickerCss();
|
|
1110
|
+
|
|
1111
|
+
var getHours = {};
|
|
1112
|
+
|
|
1113
|
+
var hasRequiredGetHours;
|
|
1114
|
+
|
|
1115
|
+
function requireGetHours () {
|
|
1116
|
+
if (hasRequiredGetHours) return getHours;
|
|
1117
|
+
hasRequiredGetHours = 1;
|
|
1118
|
+
getHours.getHours = getHours$1;
|
|
1119
|
+
var _index = /*@__PURE__*/ requireToDate();
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* The {@link getHours} function options.
|
|
1123
|
+
*/
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* @name getHours
|
|
1127
|
+
* @category Hour Helpers
|
|
1128
|
+
* @summary Get the hours of the given date.
|
|
1129
|
+
*
|
|
1130
|
+
* @description
|
|
1131
|
+
* Get the hours of the given date.
|
|
1132
|
+
*
|
|
1133
|
+
* @param date - The given date
|
|
1134
|
+
* @param options - An object with options
|
|
1135
|
+
*
|
|
1136
|
+
* @returns The hours
|
|
1137
|
+
*
|
|
1138
|
+
* @example
|
|
1139
|
+
* // Get the hours of 29 February 2012 11:45:00:
|
|
1140
|
+
* const result = getHours(new Date(2012, 1, 29, 11, 45))
|
|
1141
|
+
* //=> 11
|
|
1142
|
+
*/
|
|
1143
|
+
function getHours$1(date, options) {
|
|
1144
|
+
return (0, _index.toDate)(date, options?.in).getHours();
|
|
1145
|
+
}
|
|
1146
|
+
return getHours;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
var getHoursExports = /*@__PURE__*/ requireGetHours();
|
|
1150
|
+
|
|
1151
|
+
var getMinutes = {};
|
|
1152
|
+
|
|
1153
|
+
var hasRequiredGetMinutes;
|
|
1154
|
+
|
|
1155
|
+
function requireGetMinutes () {
|
|
1156
|
+
if (hasRequiredGetMinutes) return getMinutes;
|
|
1157
|
+
hasRequiredGetMinutes = 1;
|
|
1158
|
+
getMinutes.getMinutes = getMinutes$1;
|
|
1159
|
+
var _index = /*@__PURE__*/ requireToDate();
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* The {@link getMinutes} function options.
|
|
1163
|
+
*/
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* @name getMinutes
|
|
1167
|
+
* @category Minute Helpers
|
|
1168
|
+
* @summary Get the minutes of the given date.
|
|
1169
|
+
*
|
|
1170
|
+
* @description
|
|
1171
|
+
* Get the minutes of the given date.
|
|
1172
|
+
*
|
|
1173
|
+
* @param date - The given date
|
|
1174
|
+
* @param options - The options
|
|
1175
|
+
*
|
|
1176
|
+
* @returns The minutes
|
|
1177
|
+
*
|
|
1178
|
+
* @example
|
|
1179
|
+
* // Get the minutes of 29 February 2012 11:45:05:
|
|
1180
|
+
* const result = getMinutes(new Date(2012, 1, 29, 11, 45, 5))
|
|
1181
|
+
* //=> 45
|
|
1182
|
+
*/
|
|
1183
|
+
function getMinutes$1(date, options) {
|
|
1184
|
+
return (0, _index.toDate)(date, options?.in).getMinutes();
|
|
1185
|
+
}
|
|
1186
|
+
return getMinutes;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
var getMinutesExports = /*@__PURE__*/ requireGetMinutes();
|
|
1190
|
+
|
|
1191
|
+
var formatISO = {};
|
|
1192
|
+
|
|
1193
|
+
var hasRequiredFormatISO;
|
|
1194
|
+
|
|
1195
|
+
function requireFormatISO () {
|
|
1196
|
+
if (hasRequiredFormatISO) return formatISO;
|
|
1197
|
+
hasRequiredFormatISO = 1;
|
|
1198
|
+
formatISO.formatISO = formatISO$1;
|
|
1199
|
+
var _index = /*@__PURE__*/ requireAddLeadingZeros();
|
|
1200
|
+
var _index2 = /*@__PURE__*/ requireToDate();
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* The {@link formatISO} function options.
|
|
1204
|
+
*/
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* @name formatISO
|
|
1208
|
+
* @category Common Helpers
|
|
1209
|
+
* @summary Format the date according to the ISO 8601 standard (https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm).
|
|
1210
|
+
*
|
|
1211
|
+
* @description
|
|
1212
|
+
* Return the formatted date string in ISO 8601 format. Options may be passed to control the parts and notations of the date.
|
|
1213
|
+
*
|
|
1214
|
+
* @param date - The original date
|
|
1215
|
+
* @param options - An object with options.
|
|
1216
|
+
*
|
|
1217
|
+
* @returns The formatted date string (in local time zone)
|
|
1218
|
+
*
|
|
1219
|
+
* @throws `date` must not be Invalid Date
|
|
1220
|
+
*
|
|
1221
|
+
* @example
|
|
1222
|
+
* // Represent 18 September 2019 in ISO 8601 format (local time zone is UTC):
|
|
1223
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52))
|
|
1224
|
+
* //=> '2019-09-18T19:00:52Z'
|
|
1225
|
+
*
|
|
1226
|
+
* @example
|
|
1227
|
+
* // Represent 18 September 2019 in ISO 8601, short format (local time zone is UTC):
|
|
1228
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })
|
|
1229
|
+
* //=> '20190918T190052'
|
|
1230
|
+
*
|
|
1231
|
+
* @example
|
|
1232
|
+
* // Represent 18 September 2019 in ISO 8601 format, date only:
|
|
1233
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })
|
|
1234
|
+
* //=> '2019-09-18'
|
|
1235
|
+
*
|
|
1236
|
+
* @example
|
|
1237
|
+
* // Represent 18 September 2019 in ISO 8601 format, time only (local time zone is UTC):
|
|
1238
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })
|
|
1239
|
+
* //=> '19:00:52Z'
|
|
1240
|
+
*/
|
|
1241
|
+
function formatISO$1(date, options) {
|
|
1242
|
+
const date_ = (0, _index2.toDate)(date, options?.in);
|
|
1243
|
+
|
|
1244
|
+
if (isNaN(+date_)) {
|
|
1245
|
+
throw new RangeError("Invalid time value");
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
const format = options?.format ?? "extended";
|
|
1249
|
+
const representation = options?.representation ?? "complete";
|
|
1250
|
+
|
|
1251
|
+
let result = "";
|
|
1252
|
+
let tzOffset = "";
|
|
1253
|
+
|
|
1254
|
+
const dateDelimiter = format === "extended" ? "-" : "";
|
|
1255
|
+
const timeDelimiter = format === "extended" ? ":" : "";
|
|
1256
|
+
|
|
1257
|
+
// Representation is either 'date' or 'complete'
|
|
1258
|
+
if (representation !== "time") {
|
|
1259
|
+
const day = (0, _index.addLeadingZeros)(date_.getDate(), 2);
|
|
1260
|
+
const month = (0, _index.addLeadingZeros)(date_.getMonth() + 1, 2);
|
|
1261
|
+
const year = (0, _index.addLeadingZeros)(date_.getFullYear(), 4);
|
|
1262
|
+
|
|
1263
|
+
// yyyyMMdd or yyyy-MM-dd.
|
|
1264
|
+
result = `${year}${dateDelimiter}${month}${dateDelimiter}${day}`;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
// Representation is either 'time' or 'complete'
|
|
1268
|
+
if (representation !== "date") {
|
|
1269
|
+
// Add the timezone.
|
|
1270
|
+
const offset = date_.getTimezoneOffset();
|
|
1271
|
+
|
|
1272
|
+
if (offset !== 0) {
|
|
1273
|
+
const absoluteOffset = Math.abs(offset);
|
|
1274
|
+
const hourOffset = (0, _index.addLeadingZeros)(
|
|
1275
|
+
Math.trunc(absoluteOffset / 60),
|
|
1276
|
+
2,
|
|
1277
|
+
);
|
|
1278
|
+
const minuteOffset = (0, _index.addLeadingZeros)(absoluteOffset % 60, 2);
|
|
1279
|
+
// If less than 0, the sign is +, because it is ahead of time.
|
|
1280
|
+
const sign = offset < 0 ? "+" : "-";
|
|
1281
|
+
|
|
1282
|
+
tzOffset = `${sign}${hourOffset}:${minuteOffset}`;
|
|
1283
|
+
} else {
|
|
1284
|
+
tzOffset = "Z";
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
const hour = (0, _index.addLeadingZeros)(date_.getHours(), 2);
|
|
1288
|
+
const minute = (0, _index.addLeadingZeros)(date_.getMinutes(), 2);
|
|
1289
|
+
const second = (0, _index.addLeadingZeros)(date_.getSeconds(), 2);
|
|
1290
|
+
|
|
1291
|
+
// If there's also date, separate it with time with 'T'
|
|
1292
|
+
const separator = result === "" ? "" : "T";
|
|
1293
|
+
|
|
1294
|
+
// Creates a time string consisting of hour, minute, and second, separated by delimiters, if defined.
|
|
1295
|
+
const time = [hour, minute, second].join(timeDelimiter);
|
|
1296
|
+
|
|
1297
|
+
// HHmmss or HH:mm:ss.
|
|
1298
|
+
result = `${result}${separator}${time}${tzOffset}`;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
return result;
|
|
1302
|
+
}
|
|
1303
|
+
return formatISO;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
var formatISOExports = /*@__PURE__*/ requireFormatISO();
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* Valida se o modo informado pertence ao conjunto suportado pelo datetime-input.
|
|
1310
|
+
*
|
|
1311
|
+
* @param value - Valor recebido via prop/atributo.
|
|
1312
|
+
* @returns `true` quando o modo é válido.
|
|
1313
|
+
*/
|
|
1314
|
+
function isValidDatetimeInputMode(value) {
|
|
1315
|
+
return Object.values(DATETIME_PICKER_MODE).includes(value);
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Normaliza o modo do datetime-input para um valor suportado.
|
|
1319
|
+
*
|
|
1320
|
+
* @param value - Valor bruto informado via prop.
|
|
1321
|
+
* @returns Modo válido, aplicando o padrão quando necessário.
|
|
1322
|
+
*/
|
|
1323
|
+
function normalizeDatetimeInputMode(value) {
|
|
1324
|
+
if (isValidDatetimeInputMode(value))
|
|
1325
|
+
return value;
|
|
1326
|
+
warnInvalidPropValue('br-datetime-input', 'mode', value, DATETIME_PICKER_MODE.DEFAULT);
|
|
1327
|
+
return DATETIME_PICKER_MODE.DEFAULT;
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Verifica se o valor informado é uma instância de Date válida.
|
|
1331
|
+
*
|
|
1332
|
+
* @param value - Valor recebido via prop.
|
|
1333
|
+
* @returns `true` quando é Date válido.
|
|
1334
|
+
*/
|
|
1335
|
+
function isValidDateInstance(value) {
|
|
1336
|
+
return value instanceof Date && !Number.isNaN(value.getTime());
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Normaliza a data de referência para evitar valores inválidos.
|
|
1340
|
+
*
|
|
1341
|
+
* @param value - Valor recebido via prop.
|
|
1342
|
+
* @returns Date válido para uso interno.
|
|
1343
|
+
*/
|
|
1344
|
+
function normalizeDatetimeInputReferenceDate(value) {
|
|
1345
|
+
if (isValidDateInstance(value))
|
|
1346
|
+
return value;
|
|
1347
|
+
const fallback = toDateExports.toDate(new Date());
|
|
1348
|
+
warnInvalidPropValue('br-datetime-input', 'referenceDate', value, formatISOExports.formatISO(fallback));
|
|
1349
|
+
return fallback;
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Normaliza o valor selecionado do input (Date válido ou null).
|
|
1353
|
+
*
|
|
1354
|
+
* @param value - Valor recebido via prop.
|
|
1355
|
+
* @returns Date válido ou null quando o valor é inválido.
|
|
1356
|
+
*/
|
|
1357
|
+
function normalizeDatetimeInputValue(value) {
|
|
1358
|
+
if (value === null)
|
|
1359
|
+
return null;
|
|
1360
|
+
if (isValidDateInstance(value))
|
|
1361
|
+
return value;
|
|
1362
|
+
warnInvalidPropValue('br-datetime-input', 'value', value, 'null');
|
|
1363
|
+
return null;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
const datetimeInputCss = () => `*,*::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}a{background-color:rgba(0,0,0,0)}b,strong{font-weight:bolder}code{font-family:monospace;font-size:1em}small{font-size:80%}img{border-style:none}button,input,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))}}@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))}}@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-in-out{animation-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}.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}.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)}.help{font-size:var(--font-size-scale-base)}code,.code{background:var(--gray-5);border-radius:4px;color:var(--gray-80);display:inline-block;font-family:monospace;font-size:var(--font-size-scale-base);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);padding:var(--spacing-scale-half)}*[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)}:host{display:block;width:100%}br-input[disabled]{opacity:1}`;
|
|
1367
|
+
|
|
1368
|
+
const DatetimeInput = class {
|
|
1369
|
+
constructor(hostRef) {
|
|
1370
|
+
registerInstance(this, hostRef);
|
|
1371
|
+
this.dateStateChange = createEvent(this, "dateStateChange", 7);
|
|
1372
|
+
this.togglePicker = createEvent(this, "togglePicker", 7);
|
|
1373
|
+
/** Valor textual exibido no campo e usado durante a edição manual. */
|
|
1374
|
+
this.inputValue = '';
|
|
1375
|
+
/**
|
|
1376
|
+
* Define o placeholder do campo de entrada.
|
|
1377
|
+
*
|
|
1378
|
+
* @default ''
|
|
1379
|
+
*/
|
|
1380
|
+
this.placeholder = '';
|
|
1381
|
+
/**
|
|
1382
|
+
* Define o modo de entrada: `date`, `time` ou `datetime`.
|
|
1383
|
+
*
|
|
1384
|
+
* @default 'datetime'
|
|
1385
|
+
*/
|
|
1386
|
+
this.mode = 'datetime';
|
|
1387
|
+
/**
|
|
1388
|
+
* Data de referência que orienta a navegação visual do calendário.
|
|
1389
|
+
*
|
|
1390
|
+
* @default new Date()
|
|
1391
|
+
*/
|
|
1392
|
+
this.referenceDate = new Date();
|
|
1393
|
+
/**
|
|
1394
|
+
* Valor selecionado pelo usuário, ou `null` quando nada foi escolhido.
|
|
1395
|
+
*
|
|
1396
|
+
* @default null
|
|
1397
|
+
*/
|
|
1398
|
+
this.value = null;
|
|
1399
|
+
/**
|
|
1400
|
+
* Desabilita digitação e abertura do picker quando ativo.
|
|
1401
|
+
*
|
|
1402
|
+
* @default false
|
|
1403
|
+
*/
|
|
1404
|
+
this.disabled = false;
|
|
1405
|
+
/**
|
|
1406
|
+
* Define se a seleção ocorre por data única ou por intervalo.
|
|
1407
|
+
*
|
|
1408
|
+
* @default 'single'
|
|
1409
|
+
*/
|
|
1410
|
+
this.selectionMode = 'single';
|
|
1411
|
+
/**
|
|
1412
|
+
* Data inicial do intervalo quando em modo range.
|
|
1413
|
+
*
|
|
1414
|
+
* @default null
|
|
1415
|
+
*/
|
|
1416
|
+
this.rangeStart = null;
|
|
1417
|
+
/**
|
|
1418
|
+
* Data final do intervalo quando em modo range.
|
|
1419
|
+
*
|
|
1420
|
+
* @default null
|
|
1421
|
+
*/
|
|
1422
|
+
this.rangeEnd = null;
|
|
1423
|
+
this.handleActionButtonClick = (event) => {
|
|
1424
|
+
if (this.disabled)
|
|
1425
|
+
return;
|
|
1426
|
+
event.stopPropagation();
|
|
1427
|
+
this.togglePicker.emit();
|
|
1428
|
+
};
|
|
1429
|
+
/**
|
|
1430
|
+
* Confirma o conteúdo digitado ao perder foco.
|
|
1431
|
+
*/
|
|
1432
|
+
this.handleInputBlur = () => {
|
|
1433
|
+
if (this.disabled) {
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
this.commitInputValue();
|
|
1437
|
+
};
|
|
1438
|
+
/**
|
|
1439
|
+
* Atualiza o estado local com o valor digitado no campo.
|
|
1440
|
+
*
|
|
1441
|
+
* @param event - Evento de input disparado pelo campo textual.
|
|
1442
|
+
*/
|
|
1443
|
+
this.handleInputChange = (event) => {
|
|
1444
|
+
if (this.disabled) {
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
const input = event.target;
|
|
1448
|
+
this.inputValue = input.value;
|
|
1449
|
+
};
|
|
1450
|
+
/**
|
|
1451
|
+
* Permite confirmar a digitação pressionando Enter.
|
|
1452
|
+
*
|
|
1453
|
+
* @param event - Evento de teclado do campo de entrada.
|
|
1454
|
+
*/
|
|
1455
|
+
this.handleInputKeydown = (event) => {
|
|
1456
|
+
if (this.disabled) {
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
// Alt+ArrowDown ou F4 abre/fecha o picker (padrão ARIA combobox)
|
|
1460
|
+
if ((event.key === 'ArrowDown' && event.altKey) || event.key === 'F4') {
|
|
1461
|
+
event.preventDefault();
|
|
1462
|
+
this.togglePicker.emit();
|
|
1463
|
+
return;
|
|
1464
|
+
}
|
|
1465
|
+
if (event.key === 'Enter') {
|
|
1466
|
+
this.commitInputValue();
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
/**
|
|
1470
|
+
* Evita propagação do clique e solicita a abertura/fechamento do picker.
|
|
1471
|
+
*
|
|
1472
|
+
* @param event - Evento de clique no ícone de ação.
|
|
1473
|
+
*/
|
|
1474
|
+
this.handleToggleDropdown = (event) => {
|
|
1475
|
+
if (this.disabled) {
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
event.stopPropagation();
|
|
1479
|
+
this.togglePicker.emit();
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
handleRangeValueChange(newValue) {
|
|
1483
|
+
if (!newValue)
|
|
1484
|
+
return;
|
|
1485
|
+
this.rangeStart = newValue.start;
|
|
1486
|
+
this.rangeEnd = newValue.end;
|
|
1487
|
+
this.syncInputValueFromProps();
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Revalida e reflete no input mudanças externas em `value`.
|
|
1491
|
+
*
|
|
1492
|
+
* @param newValue - Novo valor recebido via prop.
|
|
1493
|
+
*/
|
|
1494
|
+
handleValueChange(newValue) {
|
|
1495
|
+
this.ensureValidValue(newValue);
|
|
1496
|
+
this.syncInputValueFromProps();
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Garante modo suportado e ajusta máscara/valor textual exibido.
|
|
1500
|
+
*
|
|
1501
|
+
* @param newValue - Novo modo recebido via prop.
|
|
1502
|
+
*/
|
|
1503
|
+
handleModeChange(newValue) {
|
|
1504
|
+
this.ensureValidMode(newValue);
|
|
1505
|
+
this.syncInputValueFromProps();
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* Valida a data de referência e sincroniza o campo quando não há seleção.
|
|
1509
|
+
*
|
|
1510
|
+
* @param newValue - Nova data de referência recebida.
|
|
1511
|
+
*/
|
|
1512
|
+
handleReferenceDateChange(newValue) {
|
|
1513
|
+
this.ensureValidReferenceDate(newValue);
|
|
1514
|
+
if (this.value === null) {
|
|
1515
|
+
this.syncInputValueFromProps();
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Sincroniza o input quando o início do range muda.
|
|
1520
|
+
*
|
|
1521
|
+
* @param newValue - Nova data inicial do range.
|
|
1522
|
+
*/
|
|
1523
|
+
handleRangeStartChange() {
|
|
1524
|
+
if (this.selectionMode === 'range') {
|
|
1525
|
+
this.syncInputValueFromProps();
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Sincroniza o input quando o fim do range muda.
|
|
1530
|
+
*
|
|
1531
|
+
* @param newValue - Nova data final do range.
|
|
1532
|
+
*/
|
|
1533
|
+
handleRangeEndChange() {
|
|
1534
|
+
if (this.selectionMode === 'range') {
|
|
1535
|
+
this.syncInputValueFromProps();
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* Valida props iniciais e sincroniza o texto exibido no input.
|
|
1540
|
+
*/
|
|
1541
|
+
componentWillLoad() {
|
|
1542
|
+
this.referenceDate = resolveSsrLocalDate(this.el, this.referenceDate);
|
|
1543
|
+
this.ensureValidMode();
|
|
1544
|
+
this.ensureValidReferenceDate();
|
|
1545
|
+
this.ensureValidValue();
|
|
1546
|
+
this.syncInputValueFromProps();
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Registra o listener de teclado no botão de ação após o DOM estar disponível.
|
|
1550
|
+
*
|
|
1551
|
+
* O br-button que envolve o slot "action" é focável. Quando Space/Enter é pressionado,
|
|
1552
|
+
* o browser dispara um click sintético. Adicionamos um listener imperativo para
|
|
1553
|
+
* garantir que o clique no botão de ação acione o toggle.
|
|
1554
|
+
*/
|
|
1555
|
+
componentDidLoad() {
|
|
1556
|
+
// Tenta encontrar o br-button dentro do br-input que envolve o slot action
|
|
1557
|
+
const brInput = this.el.shadowRoot?.querySelector('br-input');
|
|
1558
|
+
if (!brInput?.shadowRoot)
|
|
1559
|
+
return;
|
|
1560
|
+
const actionButton = brInput.shadowRoot.querySelector('br-button.button-transform');
|
|
1561
|
+
if (!actionButton)
|
|
1562
|
+
return;
|
|
1563
|
+
this.actionButton = actionButton;
|
|
1564
|
+
// Listener para clique no botão de ação (funciona para mouse e Space/Enter via button nativo)
|
|
1565
|
+
actionButton.addEventListener('click', this.handleActionButtonClick);
|
|
1566
|
+
}
|
|
1567
|
+
disconnectedCallback() {
|
|
1568
|
+
this.actionButton?.removeEventListener('click', this.handleActionButtonClick);
|
|
1569
|
+
this.actionButton = undefined;
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Retorna o rótulo acessível do botão de alternância do picker.
|
|
1573
|
+
*
|
|
1574
|
+
* @returns Texto anunciado pelo leitor de tela para o ícone de ação.
|
|
1575
|
+
*/
|
|
1576
|
+
getToggleAriaLabel() {
|
|
1577
|
+
switch (this.mode) {
|
|
1578
|
+
case 'date':
|
|
1579
|
+
return 'Abrir calendário';
|
|
1580
|
+
case 'time':
|
|
1581
|
+
return 'Abrir seletor de hora';
|
|
1582
|
+
default:
|
|
1583
|
+
return 'Abrir seletor de data e hora';
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Normaliza o modo de operação para um valor suportado.
|
|
1588
|
+
*
|
|
1589
|
+
* @param value - Modo informado externamente.
|
|
1590
|
+
*/
|
|
1591
|
+
ensureValidMode(value = this.mode) {
|
|
1592
|
+
const normalizedMode = normalizeDatetimeInputMode(value);
|
|
1593
|
+
if (normalizedMode !== value) {
|
|
1594
|
+
this.mode = normalizedMode;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* Garante que a data de referência seja uma instância válida de `Date`.
|
|
1599
|
+
*
|
|
1600
|
+
* @param value - Data de referência recebida via prop.
|
|
1601
|
+
*/
|
|
1602
|
+
ensureValidReferenceDate(value = this.referenceDate) {
|
|
1603
|
+
const normalizedReferenceDate = normalizeDatetimeInputReferenceDate(value);
|
|
1604
|
+
if (!(value instanceof Date) || Number.isNaN(value.getTime())) {
|
|
1605
|
+
this.referenceDate = normalizedReferenceDate;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Normaliza o valor selecionado para `Date` válido ou `null`.
|
|
1610
|
+
*
|
|
1611
|
+
* @param value - Valor recebido via prop.
|
|
1612
|
+
*/
|
|
1613
|
+
ensureValidValue(value = this.value) {
|
|
1614
|
+
const normalizedValue = normalizeDatetimeInputValue(value);
|
|
1615
|
+
if (value !== normalizedValue) {
|
|
1616
|
+
this.value = normalizedValue;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Consolida o texto digitado, tenta analisar e emite o novo estado selecionado.
|
|
1621
|
+
*/
|
|
1622
|
+
commitInputValue() {
|
|
1623
|
+
const inputText = this.inputValue.trim();
|
|
1624
|
+
if (inputText === '') {
|
|
1625
|
+
this.value = null;
|
|
1626
|
+
this.dateStateChange.emit({
|
|
1627
|
+
referenceDate: this.referenceDate,
|
|
1628
|
+
value: null,
|
|
1629
|
+
});
|
|
1630
|
+
this.emitNativeValueChange();
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
if (this.selectionMode === 'range' && this.mode === 'date') {
|
|
1634
|
+
const parsedRange = this.parseRangeInput(inputText);
|
|
1635
|
+
if (parsedRange === null)
|
|
1636
|
+
return;
|
|
1637
|
+
const normalizedRange = this.normalizeRangeBounds(parsedRange.start, parsedRange.end);
|
|
1638
|
+
this.rangeValue = normalizedRange;
|
|
1639
|
+
this.inputValue = `${this.formatDateByMode(normalizedRange.start)} - ${this.formatDateByMode(normalizedRange.end)}`;
|
|
1640
|
+
this.value = normalizedRange.end;
|
|
1641
|
+
this.dateStateChange.emit({
|
|
1642
|
+
referenceDate: normalizedRange.end,
|
|
1643
|
+
value: normalizedRange.end,
|
|
1644
|
+
range: normalizedRange,
|
|
1645
|
+
});
|
|
1646
|
+
this.emitNativeValueChange();
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
const parsed = this.parseInputValue(inputText);
|
|
1650
|
+
if (parsed === null)
|
|
1651
|
+
return;
|
|
1652
|
+
const newDate = new Date(parsed);
|
|
1653
|
+
newDate.setSeconds(0, 0);
|
|
1654
|
+
this.inputValue = this.formatDateByMode(newDate);
|
|
1655
|
+
this.value = newDate;
|
|
1656
|
+
this.dateStateChange.emit({
|
|
1657
|
+
referenceDate: newDate,
|
|
1658
|
+
value: newDate,
|
|
1659
|
+
});
|
|
1660
|
+
this.emitNativeValueChange();
|
|
1661
|
+
}
|
|
1662
|
+
emitNativeValueChange() {
|
|
1663
|
+
dispatchNativeFormEvent(this.el, 'input');
|
|
1664
|
+
dispatchNativeFormEvent(this.el, 'change');
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Analisa o intervalo no formato `dd/MM/yyyy - dd/MM/yyyy`.
|
|
1668
|
+
*
|
|
1669
|
+
* @param value - Texto de intervalo informado no input.
|
|
1670
|
+
* @returns Intervalo analisado ou `null` quando inválido.
|
|
1671
|
+
*/
|
|
1672
|
+
parseRangeInput(value) {
|
|
1673
|
+
const rangeMatch = value.match(/^(.*?)\s*-\s*(.*?)$/);
|
|
1674
|
+
if (rangeMatch === null) {
|
|
1675
|
+
return null;
|
|
1676
|
+
}
|
|
1677
|
+
const startText = rangeMatch[1]?.trim() ?? '';
|
|
1678
|
+
const endText = rangeMatch[2]?.trim() ?? '';
|
|
1679
|
+
if (startText === '' || endText === '') {
|
|
1680
|
+
return null;
|
|
1681
|
+
}
|
|
1682
|
+
const base = this.referenceDate ?? toDateExports.toDate(new Date());
|
|
1683
|
+
const parsedStart = this.parseDateInput(startText, base);
|
|
1684
|
+
const parsedEnd = this.parseDateInput(endText, base);
|
|
1685
|
+
if (parsedStart === null || parsedEnd === null) {
|
|
1686
|
+
return null;
|
|
1687
|
+
}
|
|
1688
|
+
return { start: parsedStart, end: parsedEnd };
|
|
1689
|
+
}
|
|
1690
|
+
/** Normaliza os limites do intervalo para garantir ordem cronológica. */
|
|
1691
|
+
normalizeRangeBounds(start, end) {
|
|
1692
|
+
return compareAscExports.compareAsc(start, end) <= 0 ? { start, end } : { start: end, end: start };
|
|
1693
|
+
}
|
|
1694
|
+
/**
|
|
1695
|
+
* Sincroniza o texto do campo com as props atuais de valor e modo.
|
|
1696
|
+
*/
|
|
1697
|
+
syncInputValueFromProps() {
|
|
1698
|
+
if (this.selectionMode === 'range') {
|
|
1699
|
+
if (this.rangeStart === null || this.rangeEnd === null) {
|
|
1700
|
+
this.inputValue = '';
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1703
|
+
const startFormatted = this.formatDateByMode(this.rangeStart);
|
|
1704
|
+
const endFormatted = this.formatDateByMode(this.rangeEnd);
|
|
1705
|
+
this.inputValue = `${startFormatted} - ${endFormatted}`;
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
if (this.value === null) {
|
|
1709
|
+
this.inputValue = '';
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
this.inputValue = this.formatDateByMode(this.value);
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* Formata uma data de acordo com o modo atual do componente.
|
|
1716
|
+
*
|
|
1717
|
+
* @param date - Data a ser formatada para exibição no input.
|
|
1718
|
+
* @returns Representação textual da data/hora no padrão esperado.
|
|
1719
|
+
*/
|
|
1720
|
+
formatDateByMode(date) {
|
|
1721
|
+
switch (this.mode) {
|
|
1722
|
+
case 'date':
|
|
1723
|
+
return formatExports.format(date, 'dd/MM/yyyy');
|
|
1724
|
+
case 'time':
|
|
1725
|
+
return formatExports.format(date, 'HH:mm');
|
|
1726
|
+
default:
|
|
1727
|
+
return formatExports.format(date, 'dd/MM/yyyy HH:mm');
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* Retorna as classes CSS base aplicadas ao host visual do componente.
|
|
1732
|
+
*/
|
|
1733
|
+
getCssClassMap() {
|
|
1734
|
+
return {
|
|
1735
|
+
'br-datetime-input': true,
|
|
1736
|
+
};
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Seleciona o ícone do campo conforme o modo de entrada ativo.
|
|
1740
|
+
*
|
|
1741
|
+
* @returns Nome do ícone usado na ação lateral do input.
|
|
1742
|
+
*/
|
|
1743
|
+
getInputIcon() {
|
|
1744
|
+
switch (this.mode) {
|
|
1745
|
+
case 'time':
|
|
1746
|
+
return 'fa7-solid:clock';
|
|
1747
|
+
default:
|
|
1748
|
+
return 'fa6-solid:calendar-days';
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Converte o texto digitado em `Date` com base no modo configurado.
|
|
1753
|
+
*
|
|
1754
|
+
* @param value - Texto informado pelo usuário no input.
|
|
1755
|
+
* @returns Data convertida em objeto `Date` ou `null` quando inválida.
|
|
1756
|
+
*/
|
|
1757
|
+
parseInputValue(value) {
|
|
1758
|
+
const base = this.value ?? this.referenceDate ?? toDateExports.toDate(new Date());
|
|
1759
|
+
switch (this.mode) {
|
|
1760
|
+
case 'date':
|
|
1761
|
+
return this.parseDateInput(value, base);
|
|
1762
|
+
case 'time':
|
|
1763
|
+
return this.parseTimeInput(value, base);
|
|
1764
|
+
case 'datetime':
|
|
1765
|
+
return this.parseDateTimeInput(value, base);
|
|
1766
|
+
default:
|
|
1767
|
+
return null;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
/**
|
|
1771
|
+
* Faz parse de uma data no formato `dd/MM/yyyy`, preservando hora e minuto base.
|
|
1772
|
+
*
|
|
1773
|
+
* @param value - Texto de data digitado pelo usuário.
|
|
1774
|
+
* @param base - Data base usada para completar informações de tempo.
|
|
1775
|
+
* @returns Data válida normalizada ou `null` quando o parse falhar.
|
|
1776
|
+
*/
|
|
1777
|
+
parseDateInput(value, base) {
|
|
1778
|
+
const parsedDate = parseExports.parse(value, 'dd/MM/yyyy', base);
|
|
1779
|
+
if (!isValidExports.isValid(parsedDate))
|
|
1780
|
+
return null;
|
|
1781
|
+
return setExports.set(parsedDate, {
|
|
1782
|
+
hours: getHoursExports.getHours(base),
|
|
1783
|
+
minutes: getMinutesExports.getMinutes(base),
|
|
1784
|
+
seconds: 0,
|
|
1785
|
+
milliseconds: 0,
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Faz parse de hora no formato `HH:mm`, preservando o dia da data base.
|
|
1790
|
+
*
|
|
1791
|
+
* @param value - Texto de hora digitado pelo usuário.
|
|
1792
|
+
* @param base - Data base usada para manter dia, mês e ano.
|
|
1793
|
+
* @returns Data válida com hora ajustada ou `null` quando inválida.
|
|
1794
|
+
*/
|
|
1795
|
+
parseTimeInput(value, base) {
|
|
1796
|
+
const parsedTime = parseExports.parse(value, 'HH:mm', base);
|
|
1797
|
+
if (!isValidExports.isValid(parsedTime))
|
|
1798
|
+
return null;
|
|
1799
|
+
return setExports.set(base, {
|
|
1800
|
+
hours: getHoursExports.getHours(parsedTime),
|
|
1801
|
+
minutes: getMinutesExports.getMinutes(parsedTime),
|
|
1802
|
+
seconds: 0,
|
|
1803
|
+
milliseconds: 0,
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Faz parse de data e hora completas, com fallback para entradas parciais.
|
|
1808
|
+
*
|
|
1809
|
+
* @param value - Texto digitado no input.
|
|
1810
|
+
* @param base - Data base usada como contexto para completar o parse.
|
|
1811
|
+
* @returns Data válida a partir da entrada ou `null` quando não reconhecida.
|
|
1812
|
+
*/
|
|
1813
|
+
parseDateTimeInput(value, base) {
|
|
1814
|
+
// data + hora
|
|
1815
|
+
const full = parseExports.parse(value, 'dd/MM/yyyy HH:mm', base);
|
|
1816
|
+
if (isValidExports.isValid(full))
|
|
1817
|
+
return full;
|
|
1818
|
+
// so data -> hora atual
|
|
1819
|
+
const date = this.parseDateInput(value, base);
|
|
1820
|
+
if (date !== null) {
|
|
1821
|
+
return setExports.set(date, {
|
|
1822
|
+
hours: getHoursExports.getHours(base),
|
|
1823
|
+
minutes: getMinutesExports.getMinutes(base),
|
|
1824
|
+
seconds: 0,
|
|
1825
|
+
milliseconds: 0,
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
// so hora -> data atual
|
|
1829
|
+
return this.parseTimeInput(value, base);
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Renderiza o campo textual e o ícone de ação do datetime input.
|
|
1833
|
+
*/
|
|
1834
|
+
renderInputField() {
|
|
1835
|
+
return (h("br-input", { type: "text", value: this.inputValue, placeholder: this.placeholder, disabled: this.disabled, actionLabel: this.getToggleAriaLabel(), onInput: this.handleInputChange, onBlur: this.handleInputBlur, 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" })));
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Retorna o rótulo acessível do campo de entrada de acordo com o modo ativo.
|
|
1839
|
+
*
|
|
1840
|
+
* @returns Texto anunciado pelo leitor de tela para identificar o campo.
|
|
1841
|
+
*/
|
|
1842
|
+
getInputAriaLabel() {
|
|
1843
|
+
switch (this.mode) {
|
|
1844
|
+
case 'date':
|
|
1845
|
+
return 'Campo de data';
|
|
1846
|
+
case 'time':
|
|
1847
|
+
return 'Campo de horário';
|
|
1848
|
+
default:
|
|
1849
|
+
return 'Campo de data e hora';
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Renderização principal do componente.
|
|
1854
|
+
*/
|
|
1855
|
+
render() {
|
|
1856
|
+
return (h(Host, { key: '47e77b0412286cf4f8fb35f9a1038a2e68f87266' }, h("div", { key: '86b4dda4364fe1cbe111007a2b4f61435abc5cf4', class: this.getCssClassMap(), part: "container" }, this.renderInputField())));
|
|
1857
|
+
}
|
|
1858
|
+
static get delegatesFocus() { return true; }
|
|
1859
|
+
get el() { return getElement(this); }
|
|
1860
|
+
static get watchers() { return {
|
|
1861
|
+
"rangeValue": [{
|
|
1862
|
+
"handleRangeValueChange": 0
|
|
1863
|
+
}],
|
|
1864
|
+
"value": [{
|
|
1865
|
+
"handleValueChange": 0
|
|
1866
|
+
}],
|
|
1867
|
+
"mode": [{
|
|
1868
|
+
"handleModeChange": 0
|
|
1869
|
+
}],
|
|
1870
|
+
"referenceDate": [{
|
|
1871
|
+
"handleReferenceDateChange": 0
|
|
1872
|
+
}],
|
|
1873
|
+
"rangeStart": [{
|
|
1874
|
+
"handleRangeStartChange": 0
|
|
1875
|
+
}],
|
|
1876
|
+
"rangeEnd": [{
|
|
1877
|
+
"handleRangeEndChange": 0
|
|
1878
|
+
}]
|
|
1879
|
+
}; }
|
|
1880
|
+
};
|
|
1881
|
+
DatetimeInput.style = datetimeInputCss();
|
|
1882
|
+
|
|
1883
|
+
var addHours = {};
|
|
1884
|
+
|
|
1885
|
+
var addMilliseconds = {};
|
|
1886
|
+
|
|
1887
|
+
var hasRequiredAddMilliseconds;
|
|
1888
|
+
|
|
1889
|
+
function requireAddMilliseconds () {
|
|
1890
|
+
if (hasRequiredAddMilliseconds) return addMilliseconds;
|
|
1891
|
+
hasRequiredAddMilliseconds = 1;
|
|
1892
|
+
addMilliseconds.addMilliseconds = addMilliseconds$1;
|
|
1893
|
+
var _index = /*@__PURE__*/ requireConstructFrom();
|
|
1894
|
+
var _index2 = /*@__PURE__*/ requireToDate();
|
|
1895
|
+
|
|
1896
|
+
/**
|
|
1897
|
+
* The {@link addMilliseconds} function options.
|
|
1898
|
+
*/
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* @name addMilliseconds
|
|
1902
|
+
* @category Millisecond Helpers
|
|
1903
|
+
* @summary Add the specified number of milliseconds to the given date.
|
|
1904
|
+
*
|
|
1905
|
+
* @description
|
|
1906
|
+
* Add the specified number of milliseconds to the given date.
|
|
1907
|
+
*
|
|
1908
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
1909
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
1910
|
+
*
|
|
1911
|
+
* @param date - The date to be changed
|
|
1912
|
+
* @param amount - The amount of milliseconds to be added.
|
|
1913
|
+
* @param options - The options object
|
|
1914
|
+
*
|
|
1915
|
+
* @returns The new date with the milliseconds added
|
|
1916
|
+
*
|
|
1917
|
+
* @example
|
|
1918
|
+
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
|
|
1919
|
+
* const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
1920
|
+
* //=> Thu Jul 10 2014 12:45:30.750
|
|
1921
|
+
*/
|
|
1922
|
+
function addMilliseconds$1(date, amount, options) {
|
|
1923
|
+
return (0, _index.constructFrom)(
|
|
1924
|
+
options?.in || date,
|
|
1925
|
+
+(0, _index2.toDate)(date) + amount,
|
|
1926
|
+
);
|
|
1927
|
+
}
|
|
1928
|
+
return addMilliseconds;
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
var hasRequiredAddHours;
|
|
1932
|
+
|
|
1933
|
+
function requireAddHours () {
|
|
1934
|
+
if (hasRequiredAddHours) return addHours;
|
|
1935
|
+
hasRequiredAddHours = 1;
|
|
1936
|
+
addHours.addHours = addHours$1;
|
|
1937
|
+
var _index = /*@__PURE__*/ requireAddMilliseconds();
|
|
1938
|
+
var _index2 = /*@__PURE__*/ requireConstants();
|
|
1939
|
+
|
|
1940
|
+
/**
|
|
1941
|
+
* The {@link addHours} function options.
|
|
1942
|
+
*/
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* @name addHours
|
|
1946
|
+
* @category Hour Helpers
|
|
1947
|
+
* @summary Add the specified number of hours to the given date.
|
|
1948
|
+
*
|
|
1949
|
+
* @description
|
|
1950
|
+
* Add the specified number of hours to the given date.
|
|
1951
|
+
*
|
|
1952
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
1953
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
1954
|
+
*
|
|
1955
|
+
* @param date - The date to be changed
|
|
1956
|
+
* @param amount - The amount of hours to be added
|
|
1957
|
+
* @param options - An object with options
|
|
1958
|
+
*
|
|
1959
|
+
* @returns The new date with the hours added
|
|
1960
|
+
*
|
|
1961
|
+
* @example
|
|
1962
|
+
* // Add 2 hours to 10 July 2014 23:00:00:
|
|
1963
|
+
* const result = addHours(new Date(2014, 6, 10, 23, 0), 2)
|
|
1964
|
+
* //=> Fri Jul 11 2014 01:00:00
|
|
1965
|
+
*/
|
|
1966
|
+
function addHours$1(date, amount, options) {
|
|
1967
|
+
return (0, _index.addMilliseconds)(
|
|
1968
|
+
date,
|
|
1969
|
+
amount * _index2.millisecondsInHour,
|
|
1970
|
+
options,
|
|
1971
|
+
);
|
|
1972
|
+
}
|
|
1973
|
+
return addHours;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
var addHoursExports = /*@__PURE__*/ requireAddHours();
|
|
1977
|
+
|
|
1978
|
+
var addMinutes = {};
|
|
1979
|
+
|
|
1980
|
+
var hasRequiredAddMinutes;
|
|
1981
|
+
|
|
1982
|
+
function requireAddMinutes () {
|
|
1983
|
+
if (hasRequiredAddMinutes) return addMinutes;
|
|
1984
|
+
hasRequiredAddMinutes = 1;
|
|
1985
|
+
addMinutes.addMinutes = addMinutes$1;
|
|
1986
|
+
var _index = /*@__PURE__*/ requireConstants();
|
|
1987
|
+
var _index2 = /*@__PURE__*/ requireToDate();
|
|
1988
|
+
|
|
1989
|
+
/**
|
|
1990
|
+
* The {@link addMinutes} function options.
|
|
1991
|
+
*/
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* @name addMinutes
|
|
1995
|
+
* @category Minute Helpers
|
|
1996
|
+
* @summary Add the specified number of minutes to the given date.
|
|
1997
|
+
*
|
|
1998
|
+
* @description
|
|
1999
|
+
* Add the specified number of minutes to the given date.
|
|
2000
|
+
*
|
|
2001
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
2002
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
2003
|
+
*
|
|
2004
|
+
* @param date - The date to be changed
|
|
2005
|
+
* @param amount - The amount of minutes to be added.
|
|
2006
|
+
* @param options - An object with options
|
|
2007
|
+
*
|
|
2008
|
+
* @returns The new date with the minutes added
|
|
2009
|
+
*
|
|
2010
|
+
* @example
|
|
2011
|
+
* // Add 30 minutes to 10 July 2014 12:00:00:
|
|
2012
|
+
* const result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)
|
|
2013
|
+
* //=> Thu Jul 10 2014 12:30:00
|
|
2014
|
+
*/
|
|
2015
|
+
function addMinutes$1(date, amount, options) {
|
|
2016
|
+
const _date = (0, _index2.toDate)(date, options?.in);
|
|
2017
|
+
_date.setTime(_date.getTime() + amount * _index.millisecondsInMinute);
|
|
2018
|
+
return _date;
|
|
2019
|
+
}
|
|
2020
|
+
return addMinutes;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
var addMinutesExports = /*@__PURE__*/ requireAddMinutes();
|
|
2024
|
+
|
|
2025
|
+
var subHours = {};
|
|
2026
|
+
|
|
2027
|
+
var hasRequiredSubHours;
|
|
2028
|
+
|
|
2029
|
+
function requireSubHours () {
|
|
2030
|
+
if (hasRequiredSubHours) return subHours;
|
|
2031
|
+
hasRequiredSubHours = 1;
|
|
2032
|
+
subHours.subHours = subHours$1;
|
|
2033
|
+
var _index = /*@__PURE__*/ requireAddHours();
|
|
2034
|
+
|
|
2035
|
+
/**
|
|
2036
|
+
* The {@link subHours} function options.
|
|
2037
|
+
*/
|
|
2038
|
+
|
|
2039
|
+
/**
|
|
2040
|
+
* @name subHours
|
|
2041
|
+
* @category Hour Helpers
|
|
2042
|
+
* @summary Subtract the specified number of hours from the given date.
|
|
2043
|
+
*
|
|
2044
|
+
* @description
|
|
2045
|
+
* Subtract the specified number of hours from the given date.
|
|
2046
|
+
*
|
|
2047
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
2048
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
2049
|
+
*
|
|
2050
|
+
* @param date - The date to be changed
|
|
2051
|
+
* @param amount - The amount of hours to be subtracted.
|
|
2052
|
+
* @param options - The options
|
|
2053
|
+
*
|
|
2054
|
+
* @returns The new date with the hours subtracted
|
|
2055
|
+
*
|
|
2056
|
+
* @example
|
|
2057
|
+
* // Subtract 2 hours from 11 July 2014 01:00:00:
|
|
2058
|
+
* const result = subHours(new Date(2014, 6, 11, 1, 0), 2)
|
|
2059
|
+
* //=> Thu Jul 10 2014 23:00:00
|
|
2060
|
+
*/
|
|
2061
|
+
function subHours$1(date, amount, options) {
|
|
2062
|
+
return (0, _index.addHours)(date, -amount, options);
|
|
2063
|
+
}
|
|
2064
|
+
return subHours;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
var subHoursExports = /*@__PURE__*/ requireSubHours();
|
|
2068
|
+
|
|
2069
|
+
var subMinutes = {};
|
|
2070
|
+
|
|
2071
|
+
var hasRequiredSubMinutes;
|
|
2072
|
+
|
|
2073
|
+
function requireSubMinutes () {
|
|
2074
|
+
if (hasRequiredSubMinutes) return subMinutes;
|
|
2075
|
+
hasRequiredSubMinutes = 1;
|
|
2076
|
+
subMinutes.subMinutes = subMinutes$1;
|
|
2077
|
+
var _index = /*@__PURE__*/ requireAddMinutes();
|
|
2078
|
+
|
|
2079
|
+
/**
|
|
2080
|
+
* The {@link subMinutes} function options.
|
|
2081
|
+
*/
|
|
2082
|
+
|
|
2083
|
+
/**
|
|
2084
|
+
* @name subMinutes
|
|
2085
|
+
* @category Minute Helpers
|
|
2086
|
+
* @summary Subtract the specified number of minutes from the given date.
|
|
2087
|
+
*
|
|
2088
|
+
* @description
|
|
2089
|
+
* Subtract the specified number of minutes from the given date.
|
|
2090
|
+
*
|
|
2091
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
2092
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
2093
|
+
*
|
|
2094
|
+
* @param date - The date to be changed
|
|
2095
|
+
* @param amount - The amount of minutes to be subtracted.
|
|
2096
|
+
* @param options - An object with options
|
|
2097
|
+
*
|
|
2098
|
+
* @returns The new date with the minutes subtracted
|
|
2099
|
+
*
|
|
2100
|
+
* @example
|
|
2101
|
+
* // Subtract 30 minutes from 10 July 2014 12:00:00:
|
|
2102
|
+
* const result = subMinutes(new Date(2014, 6, 10, 12, 0), 30)
|
|
2103
|
+
* //=> Thu Jul 10 2014 11:30:00
|
|
2104
|
+
*/
|
|
2105
|
+
function subMinutes$1(date, amount, options) {
|
|
2106
|
+
return (0, _index.addMinutes)(date, -amount, options);
|
|
2107
|
+
}
|
|
2108
|
+
return subMinutes;
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
var subMinutesExports = /*@__PURE__*/ requireSubMinutes();
|
|
2112
|
+
|
|
2113
|
+
/**
|
|
2114
|
+
* Conjunto de campos suportados pelo time picker.
|
|
2115
|
+
*
|
|
2116
|
+
* Esses valores são usados como contrato entre a renderização do campo e a lógica de commit.
|
|
2117
|
+
*/
|
|
2118
|
+
const INPUT_TIME_TYPE = {
|
|
2119
|
+
HOUR: 'hour',
|
|
2120
|
+
MINUTE: 'minute',
|
|
2121
|
+
};
|
|
2122
|
+
|
|
2123
|
+
const timePickerCss = () => `*,*::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}a{background-color:rgba(0,0,0,0)}b,strong{font-weight:bolder}code{font-family:monospace;font-size:1em}small{font-size:80%}img{border-style:none}button,input,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))}}@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))}}@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-in-out{animation-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}.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}.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)}.help{font-size:var(--font-size-scale-base)}code,.code{background:var(--gray-5);border-radius:4px;color:var(--gray-80);display:inline-block;font-family:monospace;font-size:var(--font-size-scale-base);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);padding:var(--spacing-scale-half)}*[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)}:host{display:block;width:100%;max-width:144px;height:116px;margin-inline:auto;box-sizing:border-box}.br-time-picker{display:flex;justify-content:center;align-items:center;width:100%;height:100%;box-sizing:border-box}.timer{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:var(--spacing-scale-sm);width:100%;box-sizing:border-box}.time-field{display:flex;flex-direction:column;align-items:center;justify-content:flex-end}.time-field label{font-size:var(--font-size-scale-down-01);color:var(--gray-70);margin-bottom:4px}.time-field input{width:var(--spacing-scale-6x);height:var(--spacing-scale-6x);padding:4px;font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-semi-bold);text-align:center;border-color:var(--border-color-alternative);border-radius:var(--surface-rounder-sm);border-style:var(--border-style);border-width:var(--border-width)}.time-field input:hover{background:linear-gradient(rgb(var(--color-rgb), var(--hover)), rgb(var(--color-rgb), var(--hover)))}.time-separator{display:inline-block;font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-semi-bold);color:var(--gray-70);align-self:center;line-height:1;padding:0 var(--spacing-scale-base)}`;
|
|
2124
|
+
|
|
2125
|
+
const TimePicker = class {
|
|
2126
|
+
constructor(hostRef) {
|
|
2127
|
+
registerInstance(this, hostRef);
|
|
2128
|
+
this.dateStateChange = createEvent(this, "dateStateChange", 7);
|
|
2129
|
+
/** Mantém o rascunho digitado por campo para evitar aplicar valor parcial prematuramente. */
|
|
2130
|
+
this.timeDraft = {};
|
|
2131
|
+
/** Data de referência usada para exibir e ajustar hora e minuto. */
|
|
2132
|
+
this.referenceDate = new Date();
|
|
2133
|
+
/** Valor atualmente selecionado pelo usuário, ou `null` quando vazio. */
|
|
2134
|
+
this.value = null;
|
|
2135
|
+
/** Desabilita todos os controles de navegação e edição de hora/minuto. */
|
|
2136
|
+
this.disabled = false;
|
|
2137
|
+
/** Cacheia handlers por tipo de campo para preservar a mesma referência entre renderizações. */
|
|
2138
|
+
this.timeInputChangeHandlers = new Map();
|
|
2139
|
+
/** Cacheia handlers de commit por tipo de campo. */
|
|
2140
|
+
this.timeInputCommitHandlers = new Map();
|
|
2141
|
+
/** Cacheia handlers de teclado por tipo de campo. */
|
|
2142
|
+
this.timeInputKeydownHandlers = new Map();
|
|
2143
|
+
/**
|
|
2144
|
+
* Executa a navegação associada ao botão clicado.
|
|
2145
|
+
*
|
|
2146
|
+
* @param event - Clique disparado pelo botão de navegação.
|
|
2147
|
+
*/
|
|
2148
|
+
this.handleNavigationClick = (event) => {
|
|
2149
|
+
if (this.disabled) {
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
const actionFromPath = event
|
|
2153
|
+
.composedPath()
|
|
2154
|
+
.find((target) => target instanceof HTMLElement && target.dataset.action !== undefined);
|
|
2155
|
+
const action = (actionFromPath?.dataset.action ?? event.currentTarget.dataset.action);
|
|
2156
|
+
if (action === undefined)
|
|
2157
|
+
return;
|
|
2158
|
+
switch (action) {
|
|
2159
|
+
case NAVIGATION_ACTION.PREVIOUS_HOUR:
|
|
2160
|
+
this.decreaseHour();
|
|
2161
|
+
break;
|
|
2162
|
+
case NAVIGATION_ACTION.PREVIOUS_MINUTE:
|
|
2163
|
+
this.decreaseMinute();
|
|
2164
|
+
break;
|
|
2165
|
+
case NAVIGATION_ACTION.NEXT_HOUR:
|
|
2166
|
+
this.increaseHour();
|
|
2167
|
+
break;
|
|
2168
|
+
case NAVIGATION_ACTION.NEXT_MINUTE:
|
|
2169
|
+
this.increaseMinute();
|
|
2170
|
+
break;
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
/**
|
|
2174
|
+
* Atualiza o rascunho do campo removendo qualquer caractere não numérico.
|
|
2175
|
+
*
|
|
2176
|
+
* @param event - Evento de input do campo de hora ou minuto.
|
|
2177
|
+
* @param type - Campo que está sendo editado.
|
|
2178
|
+
*/
|
|
2179
|
+
this.handleTimeInputChange = (event, type) => {
|
|
2180
|
+
if (this.disabled) {
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
const input = event.target;
|
|
2184
|
+
const value = input.value.replace(/\D/g, '');
|
|
2185
|
+
this.timeDraft = { ...this.timeDraft, [type]: value };
|
|
2186
|
+
};
|
|
2187
|
+
}
|
|
2188
|
+
componentWillLoad() {
|
|
2189
|
+
this.referenceDate = resolveSsrLocalDate(this.el, this.referenceDate);
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* Emite o estado consolidado para manter hora, minuto e data sincronizados.
|
|
2193
|
+
*
|
|
2194
|
+
* @param nextReferenceDate - Nova data de referência após a interação.
|
|
2195
|
+
* @param nextValue - Valor final selecionado; quando omitido, assume a data de referência.
|
|
2196
|
+
*/
|
|
2197
|
+
emitDateStateChange(nextReferenceDate, nextValue = toDateExports.toDate(new Date(nextReferenceDate))) {
|
|
2198
|
+
// Ao emitir, garantir segundos zerados (componente não controla segundos)
|
|
2199
|
+
const normalizedReference = setExports.set(nextReferenceDate, { seconds: 0, milliseconds: 0 });
|
|
2200
|
+
const normalizedValue = nextValue === null ? null : setExports.set(nextValue, { seconds: 0, milliseconds: 0 });
|
|
2201
|
+
this.value = normalizedValue;
|
|
2202
|
+
this.dateStateChange.emit({
|
|
2203
|
+
referenceDate: normalizedReference,
|
|
2204
|
+
value: normalizedValue,
|
|
2205
|
+
});
|
|
2206
|
+
dispatchNativeFormEvent(this.el, 'input');
|
|
2207
|
+
dispatchNativeFormEvent(this.el, 'change');
|
|
2208
|
+
}
|
|
2209
|
+
/**
|
|
2210
|
+
* Resolve o ícone associado à ação de navegação.
|
|
2211
|
+
*
|
|
2212
|
+
* @param action - Ação representada pelo botão.
|
|
2213
|
+
* @returns O nome do ícone ou uma string vazia quando a ação não é reconhecida.
|
|
2214
|
+
*/
|
|
2215
|
+
getIconForAction(action) {
|
|
2216
|
+
switch (action) {
|
|
2217
|
+
case NAVIGATION_ACTION.PREVIOUS_HOUR:
|
|
2218
|
+
case NAVIGATION_ACTION.PREVIOUS_MINUTE:
|
|
2219
|
+
return 'fa6-solid:chevron-down';
|
|
2220
|
+
case NAVIGATION_ACTION.NEXT_HOUR:
|
|
2221
|
+
case NAVIGATION_ACTION.NEXT_MINUTE:
|
|
2222
|
+
return 'fa6-solid:chevron-up';
|
|
2223
|
+
default:
|
|
2224
|
+
return '';
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
/**
|
|
2228
|
+
* Aplica o valor digitado ao estado do componente quando o campo é concluído.
|
|
2229
|
+
*
|
|
2230
|
+
* @param type - Campo que será aplicado.
|
|
2231
|
+
*/
|
|
2232
|
+
handleTimeInputCommit(type) {
|
|
2233
|
+
if (this.disabled) {
|
|
2234
|
+
return;
|
|
2235
|
+
}
|
|
2236
|
+
const draft = this.timeDraft[type];
|
|
2237
|
+
if (draft == null || draft === '')
|
|
2238
|
+
return;
|
|
2239
|
+
const numeric = Number(draft);
|
|
2240
|
+
if (Number.isNaN(numeric))
|
|
2241
|
+
return;
|
|
2242
|
+
let date = toDateExports.toDate(new Date(this.referenceDate));
|
|
2243
|
+
if (type === INPUT_TIME_TYPE.HOUR) {
|
|
2244
|
+
if (numeric < 0 || numeric > 23)
|
|
2245
|
+
return;
|
|
2246
|
+
date = setExports.set(date, { hours: numeric });
|
|
2247
|
+
}
|
|
2248
|
+
if (type === INPUT_TIME_TYPE.MINUTE) {
|
|
2249
|
+
if (numeric < 0 || numeric > 59)
|
|
2250
|
+
return;
|
|
2251
|
+
date = setExports.set(date, { minutes: numeric });
|
|
2252
|
+
}
|
|
2253
|
+
this.emitDateStateChange(date);
|
|
2254
|
+
const { [type]: _discarded, ...remainingDraft } = this.timeDraft;
|
|
2255
|
+
this.timeDraft = remainingDraft;
|
|
2256
|
+
}
|
|
2257
|
+
/**
|
|
2258
|
+
* Constrói o rótulo acessível das ações de navegação com base no valor atual.
|
|
2259
|
+
*
|
|
2260
|
+
* @param action - Ação que o botão executa.
|
|
2261
|
+
* @returns Texto acessível do botão.
|
|
2262
|
+
*/
|
|
2263
|
+
getNavigationAriaLabel(action) {
|
|
2264
|
+
switch (action) {
|
|
2265
|
+
case NAVIGATION_ACTION.PREVIOUS_HOUR:
|
|
2266
|
+
return `Ir para a hora anterior, ${getHoursExports.getHours(subHoursExports.subHours(this.referenceDate, 1))}`;
|
|
2267
|
+
case NAVIGATION_ACTION.PREVIOUS_MINUTE:
|
|
2268
|
+
return `Ir para o minuto anterior, ${getMinutesExports.getMinutes(subMinutesExports.subMinutes(this.referenceDate, 1))}`;
|
|
2269
|
+
case NAVIGATION_ACTION.NEXT_HOUR:
|
|
2270
|
+
return `Ir para a próxima hora, ${getHoursExports.getHours(addHoursExports.addHours(this.referenceDate, 1))}`;
|
|
2271
|
+
case NAVIGATION_ACTION.NEXT_MINUTE:
|
|
2272
|
+
return `Ir para o próximo minuto, ${getMinutesExports.getMinutes(addMinutesExports.addMinutes(this.referenceDate, 1))}`;
|
|
2273
|
+
default:
|
|
2274
|
+
return '';
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
/**
|
|
2278
|
+
* Retorna o rótulo acessível do campo exibido.
|
|
2279
|
+
*
|
|
2280
|
+
* @param type - Tipo do campo, hora ou minuto.
|
|
2281
|
+
* @returns O texto exibido ao leitor de tela.
|
|
2282
|
+
*/
|
|
2283
|
+
getTimeFieldAriaLabel(type) {
|
|
2284
|
+
switch (type) {
|
|
2285
|
+
case INPUT_TIME_TYPE.HOUR:
|
|
2286
|
+
return 'Hora';
|
|
2287
|
+
case INPUT_TIME_TYPE.MINUTE:
|
|
2288
|
+
return 'Minuto';
|
|
2289
|
+
default:
|
|
2290
|
+
return '';
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
/**
|
|
2294
|
+
* Resolve o valor, a ação anterior e a próxima ação para o campo solicitado.
|
|
2295
|
+
*
|
|
2296
|
+
* @param type - Tipo do campo a ser renderizado.
|
|
2297
|
+
* @returns Configuração de navegação e valor do campo.
|
|
2298
|
+
*/
|
|
2299
|
+
getTimeFieldConfig(type) {
|
|
2300
|
+
switch (type) {
|
|
2301
|
+
case INPUT_TIME_TYPE.HOUR:
|
|
2302
|
+
return {
|
|
2303
|
+
value: getHoursExports.getHours(this.referenceDate),
|
|
2304
|
+
nextAction: NAVIGATION_ACTION.NEXT_HOUR,
|
|
2305
|
+
prevAction: NAVIGATION_ACTION.PREVIOUS_HOUR,
|
|
2306
|
+
};
|
|
2307
|
+
case INPUT_TIME_TYPE.MINUTE:
|
|
2308
|
+
return {
|
|
2309
|
+
value: getMinutesExports.getMinutes(this.referenceDate),
|
|
2310
|
+
nextAction: NAVIGATION_ACTION.NEXT_MINUTE,
|
|
2311
|
+
prevAction: NAVIGATION_ACTION.PREVIOUS_MINUTE,
|
|
2312
|
+
};
|
|
2313
|
+
default:
|
|
2314
|
+
return {
|
|
2315
|
+
value: 0,
|
|
2316
|
+
nextAction: NAVIGATION_ACTION.NEXT_HOUR,
|
|
2317
|
+
prevAction: NAVIGATION_ACTION.PREVIOUS_HOUR,
|
|
2318
|
+
};
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Formata o valor exibido no campo como dois dígitos.
|
|
2323
|
+
*
|
|
2324
|
+
* @param type - Tipo do campo a ser lido.
|
|
2325
|
+
* @returns Hora ou minuto formatado.
|
|
2326
|
+
*/
|
|
2327
|
+
getTimeFieldValue(type) {
|
|
2328
|
+
switch (type) {
|
|
2329
|
+
case INPUT_TIME_TYPE.HOUR:
|
|
2330
|
+
return getHoursExports.getHours(this.referenceDate).toString().padStart(2, '0');
|
|
2331
|
+
case INPUT_TIME_TYPE.MINUTE:
|
|
2332
|
+
return getMinutesExports.getMinutes(this.referenceDate).toString().padStart(2, '0');
|
|
2333
|
+
default:
|
|
2334
|
+
return '00';
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
/**
|
|
2338
|
+
* Recupera um handler estável para o evento de input de um campo específico.
|
|
2339
|
+
*
|
|
2340
|
+
* @param type - Tipo do campo.
|
|
2341
|
+
* @returns Função reutilizável para o evento de input.
|
|
2342
|
+
*/
|
|
2343
|
+
getTimeInputChangeHandler(type) {
|
|
2344
|
+
let handler = this.timeInputChangeHandlers.get(type);
|
|
2345
|
+
if (handler === undefined) {
|
|
2346
|
+
handler = (event) => this.handleTimeInputChange(event, type);
|
|
2347
|
+
this.timeInputChangeHandlers.set(type, handler);
|
|
2348
|
+
}
|
|
2349
|
+
return handler;
|
|
2350
|
+
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Recupera um handler estável para o commit de um campo específico.
|
|
2353
|
+
*
|
|
2354
|
+
* @param type - Tipo do campo.
|
|
2355
|
+
* @returns Função reutilizável para blur ou confirmação.
|
|
2356
|
+
*/
|
|
2357
|
+
getTimeInputCommitHandler(type) {
|
|
2358
|
+
let handler = this.timeInputCommitHandlers.get(type);
|
|
2359
|
+
if (handler === undefined) {
|
|
2360
|
+
handler = () => this.handleTimeInputCommit(type);
|
|
2361
|
+
this.timeInputCommitHandlers.set(type, handler);
|
|
2362
|
+
}
|
|
2363
|
+
return handler;
|
|
2364
|
+
}
|
|
2365
|
+
/**
|
|
2366
|
+
* Recupera um handler estável para confirmar o valor com a tecla Enter.
|
|
2367
|
+
*
|
|
2368
|
+
* @param type - Tipo do campo.
|
|
2369
|
+
* @returns Função reutilizável para eventos de teclado.
|
|
2370
|
+
*/
|
|
2371
|
+
getTimeInputKeydownHandler(type) {
|
|
2372
|
+
let handler = this.timeInputKeydownHandlers.get(type);
|
|
2373
|
+
if (handler === undefined) {
|
|
2374
|
+
handler = (event) => {
|
|
2375
|
+
if (event.key === 'Enter') {
|
|
2376
|
+
this.handleTimeInputCommit(type);
|
|
2377
|
+
return;
|
|
2378
|
+
}
|
|
2379
|
+
this.adjustTimeInputWithKeyboard(event, type);
|
|
2380
|
+
};
|
|
2381
|
+
this.timeInputKeydownHandlers.set(type, handler);
|
|
2382
|
+
}
|
|
2383
|
+
return handler;
|
|
2384
|
+
}
|
|
2385
|
+
adjustTimeInputWithKeyboard(event, type) {
|
|
2386
|
+
if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown')
|
|
2387
|
+
return;
|
|
2388
|
+
event.preventDefault();
|
|
2389
|
+
if (event.key === 'ArrowUp') {
|
|
2390
|
+
type === INPUT_TIME_TYPE.HOUR ? this.increaseHour() : this.increaseMinute();
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
type === INPUT_TIME_TYPE.HOUR ? this.decreaseHour() : this.decreaseMinute();
|
|
2394
|
+
}
|
|
2395
|
+
/** Incrementa a hora mantendo os demais componentes da data intactos. */
|
|
2396
|
+
increaseHour() {
|
|
2397
|
+
const date = addHoursExports.addHours(this.referenceDate, 1);
|
|
2398
|
+
this.emitDateStateChange(date);
|
|
2399
|
+
}
|
|
2400
|
+
/** Incrementa o minuto mantendo os demais componentes da data intactos. */
|
|
2401
|
+
increaseMinute() {
|
|
2402
|
+
const date = addMinutesExports.addMinutes(this.referenceDate, 1);
|
|
2403
|
+
this.emitDateStateChange(date);
|
|
2404
|
+
}
|
|
2405
|
+
/** Decrementa a hora mantendo os demais componentes da data intactos. */
|
|
2406
|
+
decreaseHour() {
|
|
2407
|
+
const date = subHoursExports.subHours(this.referenceDate, 1);
|
|
2408
|
+
this.emitDateStateChange(date);
|
|
2409
|
+
}
|
|
2410
|
+
/** Decrementa o minuto mantendo os demais componentes da data intactos. */
|
|
2411
|
+
decreaseMinute() {
|
|
2412
|
+
const date = subMinutesExports.subMinutes(this.referenceDate, 1);
|
|
2413
|
+
this.emitDateStateChange(date);
|
|
2414
|
+
}
|
|
2415
|
+
/**
|
|
2416
|
+
* Renderiza um botão de navegação consistente para hora ou minuto.
|
|
2417
|
+
*
|
|
2418
|
+
* @param action - Ação que o botão executará.
|
|
2419
|
+
*/
|
|
2420
|
+
renderNavigationButton(action) {
|
|
2421
|
+
return (h("br-button", { type: "button", emphasis: "tertiary", density: "small", shape: "circle", disabled: this.disabled, "data-action": action, "aria-label": this.getNavigationAriaLabel(action), onClick: this.handleNavigationClick }, h("br-icon", { iconName: this.getIconForAction(action), width: "20", height: "20", "aria-hidden": "true" })));
|
|
2422
|
+
}
|
|
2423
|
+
/** Renderiza o bloco completo de hora e minuto. */
|
|
2424
|
+
renderTimePicker() {
|
|
2425
|
+
return (h("div", { class: "timer", role: "group", "aria-label": "Seletor de hora e minuto", part: "timer" }, this.renderTimeField(INPUT_TIME_TYPE.HOUR), h("span", { class: "time-separator", "aria-hidden": "true", part: "separator" }, ":"), this.renderTimeField(INPUT_TIME_TYPE.MINUTE)));
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
* Renderiza um campo de edição com navegação lateral.
|
|
2429
|
+
*
|
|
2430
|
+
* @param type - Tipo do campo a ser exibido.
|
|
2431
|
+
*/
|
|
2432
|
+
renderTimeField(type) {
|
|
2433
|
+
const { nextAction, prevAction } = this.getTimeFieldConfig(type);
|
|
2434
|
+
return (h("div", { class: "time-field", part: "field" }, this.renderNavigationButton(nextAction), h("input", { type: "text", inputmode: "numeric", maxLength: 2, value: this.timeDraft[type] ?? this.getTimeFieldValue(type), "aria-label": this.getTimeFieldAriaLabel(type), onInput: this.getTimeInputChangeHandler(type), onBlur: this.getTimeInputCommitHandler(type), onKeyDown: this.getTimeInputKeydownHandler(type), disabled: this.disabled, part: "input" }), this.renderNavigationButton(prevAction)));
|
|
2435
|
+
}
|
|
2436
|
+
render() {
|
|
2437
|
+
return (h(Host, { key: '59ed47bc0825e6dc4c9568aefd5effe81d151525' }, h("div", { key: 'c8acccd2dfe328626346731c7c3f02984db60f4f', class: "br-time-picker", part: "container" }, this.renderTimePicker())));
|
|
2438
|
+
}
|
|
2439
|
+
get el() { return getElement(this); }
|
|
2440
|
+
};
|
|
2441
|
+
TimePicker.style = timePickerCss();
|
|
2442
|
+
|
|
2443
|
+
export { DatePicker as br_date_picker, DatetimeInput as br_datetime_input, TimePicker as br_time_picker };
|