@webority/ui-elements 0.164.0 → 0.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/WuiCarousel-CRx2-eKV.js +1 -0
- package/dist/WuiCodeBlock-DTckR_z3.js +1 -0
- package/dist/WuiCommandPalette-CSzl5yGf.js +2 -0
- package/dist/WuiCommentThread-AYovTYSA.js +1 -0
- package/dist/WuiConsentBanner-CWvXnwBH.js +1 -0
- package/dist/WuiContextMenu-CyejQsef.js +1 -0
- package/dist/WuiDataTable-BniN81KC.js +1 -0
- package/dist/WuiDatePicker-q0s8tL_E.js +31 -0
- package/dist/WuiDateRange-p2r5A9CY.js +25 -0
- package/dist/WuiDrawer-CQ7nRHUD.js +1 -0
- package/dist/WuiDropdown-BQC04Q48.js +1 -0
- package/dist/WuiEntryGrid-DPAYNu1v.js +3 -0
- package/dist/{WuiHoverCard-FL38ANLM.js → WuiHoverCard-DRZh88zM.js} +1 -1
- package/dist/WuiImageCrop-BTY59Qsm.js +17 -0
- package/dist/WuiInlineEdit-CEjs5Ruk.js +1 -0
- package/dist/WuiLeadPopup-L9UCTVA5.js +382 -0
- package/dist/WuiLightbox-DDQAOabU.js +1 -0
- package/dist/WuiMentionInput-CkhrCz_2.js +1 -0
- package/dist/{WuiModal-DvSt_466.js → WuiModal-BRILsSMq.js} +1 -1
- package/dist/{WuiNavigationMenu-Dlo-n-cL.js → WuiNavigationMenu-BCnqv7e-.js} +1 -1
- package/dist/WuiNotificationCenter-BCXT3Y7m.js +1 -0
- package/dist/WuiOrgTree-5v0vqPVk.js +1 -0
- package/dist/WuiOverflow-DtetLQHW.js +1 -0
- package/dist/WuiPhone-B6jgFRSi.js +16 -0
- package/dist/WuiPopover-BzVxNSs1.js +1 -0
- package/dist/WuiRecordPager-Dye7AfCS.js +1 -0
- package/dist/{WuiRelativeTime-CmlKD-97.js → WuiRelativeTime-DTGKGHbK.js} +1 -1
- package/dist/WuiSavedViews-BsAyuOzX.js +1 -0
- package/dist/WuiSelect-CMHoPHlx.js +9 -0
- package/dist/WuiShortcuts-DSjwaZx7.js +1 -0
- package/dist/WuiShowMore-CGhWrlmK.js +1 -0
- package/dist/WuiSlider-J9YPWu9e.js +51 -0
- package/dist/WuiSortable-BfOm57Mj.js +1 -0
- package/dist/WuiTimePicker-C5XouoR7.js +9 -0
- package/dist/WuiTour-BDOGWyNA.js +1 -0
- package/dist/WuiTree-CeYbyaCx.js +1 -0
- package/dist/{WuiWhatsNew-B2mM4MHE.js → WuiWhatsNew-DOo54GiH.js} +1 -1
- package/dist/WuiWizardStep-Ce6O_8oc.js +1 -0
- package/dist/calendarMath-CFjBxJYM.js +1 -0
- package/dist/carousel.g-Bw_pFDzc.js +1 -0
- package/dist/chips-CemguTKJ.js +2 -0
- package/dist/codeBlock.g-BCF2IlK-.js +1 -0
- package/dist/commandPalette.g-DFWnCufa.js +1 -0
- package/dist/commentText-NWsssKvj.js +1 -0
- package/dist/consentBanner.g-CZAb1BLJ.js +1 -0
- package/dist/country-B7jmc--B.js +1 -0
- package/dist/customRule-BXJdj57A.js +1 -0
- package/dist/customRule.g-Cfkl3_ZC.js +1 -0
- package/dist/dataTable-CKz4Oncc.js +1 -0
- package/dist/dataTable.g-BVxhub_d.js +1 -0
- package/dist/datePicker.g-CT9FBY21.js +1 -0
- package/dist/dateRangePicker.g-Pnc37vgX.js +1 -0
- package/dist/digitGrouping-CCPI3HK3.js +1 -0
- package/dist/drawer.g-B-zYKBfQ.js +1 -0
- package/dist/drawerDiscard-BjykHS_G.js +1 -0
- package/dist/elements/carousel.js +1 -1
- package/dist/elements/code-block.js +1 -1
- package/dist/elements/command-palette.js +1 -1
- package/dist/elements/comment-thread.js +1 -1
- package/dist/elements/consent-banner.js +1 -1
- package/dist/elements/context-menu.js +1 -1
- package/dist/elements/data-table.js +1 -1
- package/dist/elements/date-range.js +1 -1
- package/dist/elements/datepicker.js +1 -1
- package/dist/elements/drawer.js +1 -1
- package/dist/elements/dropdown.js +1 -1
- package/dist/elements/entry-grid.js +1 -0
- package/dist/elements/filter-popover.js +1 -1
- package/dist/elements/hover-card.js +1 -1
- package/dist/elements/image-crop.js +1 -1
- package/dist/elements/inline-edit.js +1 -1
- package/dist/elements/kanban.js +1 -1
- package/dist/elements/lead-popup.js +1 -1
- package/dist/elements/lightbox.js +1 -1
- package/dist/elements/mention-input.js +1 -1
- package/dist/elements/modal.js +1 -1
- package/dist/elements/navigation-menu.js +1 -1
- package/dist/elements/notification-center.js +1 -1
- package/dist/elements/org-tree.js +1 -1
- package/dist/elements/overflow.js +1 -1
- package/dist/elements/phone.js +1 -1
- package/dist/elements/popover.js +1 -1
- package/dist/elements/record-pager.js +1 -1
- package/dist/elements/relative-time.js +1 -1
- package/dist/elements/saved-views.js +1 -1
- package/dist/elements/select.js +1 -1
- package/dist/elements/shortcuts.js +1 -1
- package/dist/elements/show-more.js +1 -1
- package/dist/elements/slider.js +1 -1
- package/dist/elements/sortable.js +1 -1
- package/dist/elements/timepicker.js +1 -1
- package/dist/elements/tour.js +1 -1
- package/dist/elements/tree.js +1 -1
- package/dist/elements/whats-new.js +1 -1
- package/dist/elements/wizard.js +1 -1
- package/dist/fileViewer.g-B5XQ5WKr.js +1 -0
- package/dist/fileViewerImage-B0Q9zdgW.js +3 -0
- package/dist/fileViewerMedia-D3fdG-Ti.js +1 -0
- package/dist/fileViewerPdf-DeRWa1JE.js +20 -0
- package/dist/{filterPopover-CYzUbKN0.js → filterPopover-DmeVG4_N.js} +1 -1
- package/dist/formatters-Dy4kQQ_h.js +1 -0
- package/dist/formatters.g-BNAu1PMe.js +1 -0
- package/dist/helpers.js +1 -1
- package/dist/httpFailure.g-DBKzEpAf.js +1 -0
- package/dist/iconGlyphs.g-DxSJLQJ8.js +1 -0
- package/dist/imageCrop.g-BnbAeH2Q.js +1 -0
- package/dist/inlineEdit.g-ZxRNYq0t.js +1 -0
- package/dist/inlineEditText-BUO5sZxN.js +1 -0
- package/dist/isDrawn-BbF4phmB.js +1 -0
- package/dist/kanban-CEZmyYFY.js +1 -0
- package/dist/kanban.g-dtKYyIpr.js +1 -0
- package/dist/kanbanModel-Dp5c1rTs.js +1 -0
- package/dist/leadPopup.g-BfMPz9nH.js +1 -0
- package/dist/lightbox.g-DDrycPou.js +1 -0
- package/dist/loader-CQJFj96n.js +1 -0
- package/dist/mentionInput.g-DJo6d2Gm.js +1 -0
- package/dist/menuKeyNav-CstMzU08.js +1 -0
- package/dist/nativeOverlay-C1Rw2gIW.js +1 -0
- package/dist/notificationCentre.g-UsAurkUz.js +1 -0
- package/dist/notificationDays-B7cbYu4q.js +1 -0
- package/dist/{optionLabel-4xjXWy74.js → optionLabel-B2cU4Ax0.js} +1 -1
- package/dist/orgTree.g-CIg75quV.js +1 -0
- package/dist/overflow.g-BfcGEhwR.js +1 -0
- package/dist/passwordRules.g-CMYrohdd.js +1 -0
- package/dist/phone.g-P66U-SK5.js +1 -0
- package/dist/recents-BQ0fD7Y0.js +1 -0
- package/dist/relativeTime-CdFw-ekO.js +1 -0
- package/dist/relativeTime.g-BH90tjJM.js +1 -0
- package/dist/rowDrop.g-DQpB10Ey.js +1 -0
- package/dist/savedViews.g-CzzEliTR.js +1 -0
- package/dist/search-Cj1YQUwK.js +1 -0
- package/dist/search.g-B5d1s59A.js +1 -0
- package/dist/server.js +1 -1
- package/dist/shell.g-C2Ht5xl2.js +1 -0
- package/dist/shortcutKeys-DmPiY4T7.js +1 -0
- package/dist/shortcutKeys.g-C0TeAfYL.js +1 -0
- package/dist/showMore.g-BdQ5MUSd.js +1 -0
- package/dist/slider.g-BPNfxZEV.js +1 -0
- package/dist/sortable.g-BsTKys5-.js +1 -0
- package/dist/tableSelect.g-DKZqXQT_.js +1 -0
- package/dist/text/en.json +1278 -0
- package/dist/text.js +1 -0
- package/dist/textStore-opIEM4lu.js +1 -0
- package/dist/themeTransition-CDB0Mx61.js +1 -0
- package/dist/timePicker.g-DM61i-ZE.js +1 -0
- package/dist/tourAdvance.g-BJqDnqag.js +1 -0
- package/dist/tree.g-RId8xZSk.js +1 -0
- package/dist/ui-calendar.global.js +1 -1
- package/dist/ui-calendar.js +1 -1
- package/dist/ui-chart.global.js +2 -2
- package/dist/ui-chart.js +2 -2
- package/dist/ui-consent-banner.global.js +1 -1
- package/dist/ui-elements/carousel.global.js +1 -1
- package/dist/ui-elements/code-block.global.js +1 -1
- package/dist/ui-elements/command-palette.global.js +2 -2
- package/dist/ui-elements/comment-thread.global.js +1 -1
- package/dist/ui-elements/consent-banner.global.js +1 -1
- package/dist/ui-elements/context-menu.global.js +1 -1
- package/dist/ui-elements/date-range.global.js +12 -12
- package/dist/ui-elements/drawer.global.js +1 -1
- package/dist/ui-elements/dropdown.global.js +1 -1
- package/dist/ui-elements/entry-grid.global.js +3 -0
- package/dist/ui-elements/glyphs.global.js +1 -1
- package/dist/ui-elements/image-crop.global.js +8 -8
- package/dist/ui-elements/inline-edit.global.js +1 -1
- package/dist/ui-elements/kanban.global.js +1 -1
- package/dist/ui-elements/lead-popup.global.js +50 -50
- package/dist/ui-elements/lightbox.global.js +1 -1
- package/dist/ui-elements/markdown.global.js +1 -1
- package/dist/ui-elements/org-tree.global.js +1 -1
- package/dist/ui-elements/phone.global.js +9 -9
- package/dist/ui-elements/popover.global.js +1 -1
- package/dist/ui-elements/saved-views.global.js +1 -1
- package/dist/ui-elements/select-chips.global.js +2 -2
- package/dist/ui-elements/select-recents.global.js +1 -1
- package/dist/ui-elements/select-search.global.js +1 -1
- package/dist/ui-elements/slider.global.js +13 -13
- package/dist/ui-elements/sortable.global.js +1 -1
- package/dist/ui-elements/status-icon.global.js +1 -1
- package/dist/ui-elements/timepicker.global.js +4 -4
- package/dist/ui-elements/tour.global.js +1 -1
- package/dist/ui-elements/tree.global.js +1 -1
- package/dist/ui-elements/wizard.global.js +1 -1
- package/dist/ui-elements.global.js +21 -21
- package/dist/ui-elements.js +1 -1
- package/dist/ui-file-viewer.global.js +11 -11
- package/dist/ui-file-viewer.js +1 -1
- package/dist/ui-lead-popup.global.js +1 -1
- package/dist/ui-rich-text.global.js +8 -8
- package/dist/ui-rich-text.js +8 -8
- package/dist/ui-tour.global.js +1 -1
- package/dist/wizard.g-DOZSBUc5.js +1 -0
- package/package.json +15 -13
- package/types/WuiCarousel.d.ts +0 -8
- package/types/WuiChart.d.ts +1 -1
- package/types/WuiCommentThread.d.ts +1 -1
- package/types/WuiDateRange.d.ts +2 -0
- package/types/WuiDrawer.d.ts +1 -1
- package/types/WuiDropdown.d.ts +8 -1
- package/types/WuiEntryGrid.d.ts +29 -0
- package/types/WuiInlineEdit.d.ts +3 -2
- package/types/WuiMentionInput.d.ts +0 -10
- package/types/WuiPhone.d.ts +2 -0
- package/types/WuiPopover.d.ts +1 -0
- package/types/WuiSlider.d.ts +3 -0
- package/types/WuiTour.d.ts +1 -12
- package/types/avatarPicker.d.ts +0 -13
- package/types/calendarMath.d.ts +0 -2
- package/types/chartAdapter.d.ts +1 -0
- package/types/chartSpec.d.ts +0 -4
- package/types/commentText.d.ts +0 -35
- package/types/dataTable.d.ts +6 -8
- package/types/digitGrouping.d.ts +11 -0
- package/types/elements/comment-thread.d.ts +2 -2
- package/types/elements/data-table.d.ts +1 -1
- package/types/elements/entry-grid.d.ts +2 -0
- package/types/elements/inline-edit.d.ts +2 -2
- package/types/elements/mention-input.d.ts +2 -2
- package/types/formatters.d.ts +15 -3
- package/types/global/core.d.ts +9 -9
- package/types/global/shared.d.ts +10 -0
- package/types/globals.d.ts +6 -5
- package/types/helpers.d.ts +10 -9
- package/types/index.d.ts +2 -3
- package/types/inlineEditText.d.ts +2 -25
- package/types/isDrawn.d.ts +1 -0
- package/types/kanbanModel.d.ts +0 -32
- package/types/nativeOverlay.d.ts +2 -0
- package/types/notificationDays.d.ts +0 -19
- package/types/passwordRules.d.ts +0 -2
- package/types/razor-js/modules/fieldChecks.d.ts +1 -0
- package/types/razor-js/modules/serverRules.d.ts +9 -0
- package/types/razor-js/modules/validation.d.ts +7 -0
- package/types/server/drawerDiscard.d.ts +0 -5
- package/types/server/index.d.ts +3 -3
- package/types/server/remoteModal.d.ts +7 -5
- package/types/server/serverActions.d.ts +0 -9
- package/types/server/serverTable.d.ts +0 -11
- package/types/server/unsavedChanges.d.ts +0 -6
- package/types/shortcutKeys.d.ts +3 -3
- package/types/tableSelect.d.ts +0 -2
- package/types/text/index.d.ts +8 -0
- package/types/text/textStore.d.ts +19 -0
- package/types/text/web/accountSwitcher.g.d.ts +4 -0
- package/types/text/web/alert.g.d.ts +4 -0
- package/types/text/web/asyncBlock.g.d.ts +7 -0
- package/types/text/web/avatar.g.d.ts +4 -0
- package/types/text/web/avatarGroup.g.d.ts +4 -0
- package/types/text/web/banner.g.d.ts +4 -0
- package/types/text/web/breadcrumbs.g.d.ts +4 -0
- package/types/text/web/calendar.g.d.ts +20 -0
- package/types/text/web/card.g.d.ts +4 -0
- package/types/text/web/carousel.g.d.ts +13 -0
- package/types/text/web/catalogue.g.d.ts +266 -0
- package/types/text/web/chart.g.d.ts +102 -0
- package/types/text/web/chartCard.g.d.ts +13 -0
- package/types/text/web/check.g.d.ts +4 -0
- package/types/text/web/checkbox.g.d.ts +4 -0
- package/types/text/web/chip.g.d.ts +5 -0
- package/types/text/web/chipGroup.g.d.ts +4 -0
- package/types/text/web/choiceCard.g.d.ts +4 -0
- package/types/text/web/choiceChip.g.d.ts +4 -0
- package/types/text/web/codeBlock.g.d.ts +6 -0
- package/types/text/web/colourField.g.d.ts +7 -0
- package/types/text/web/columnMenu.g.d.ts +4 -0
- package/types/text/web/commandPalette.g.d.ts +12 -0
- package/types/text/web/commentThread.g.d.ts +35 -0
- package/types/text/web/compareTable.g.d.ts +7 -0
- package/types/text/web/confirmDialog.g.d.ts +10 -0
- package/types/text/web/confirmProvider.g.d.ts +4 -0
- package/types/text/web/consentBanner.g.d.ts +18 -0
- package/types/text/web/contextMenu.g.d.ts +5 -0
- package/types/text/web/copyButton.g.d.ts +5 -0
- package/types/text/web/customRule.g.d.ts +4 -0
- package/types/text/web/dataTable.g.d.ts +31 -0
- package/types/text/web/datePicker.g.d.ts +16 -0
- package/types/text/web/dateRangePicker.g.d.ts +22 -0
- package/types/text/web/drawer.g.d.ts +9 -0
- package/types/text/web/dropZone.g.d.ts +8 -0
- package/types/text/web/dropdown.g.d.ts +7 -0
- package/types/text/web/dueDate.g.d.ts +10 -0
- package/types/text/web/entryGrid.g.d.ts +16 -0
- package/types/text/web/errorBoundary.g.d.ts +4 -0
- package/types/text/web/errorSummary.g.d.ts +5 -0
- package/types/text/web/field.g.d.ts +4 -0
- package/types/text/web/fileAttachment.g.d.ts +18 -0
- package/types/text/web/filePicker.g.d.ts +20 -0
- package/types/text/web/fileValidation.g.d.ts +15 -0
- package/types/text/web/fileViewer.g.d.ts +55 -0
- package/types/text/web/filterBar.g.d.ts +15 -0
- package/types/text/web/floatingDock.g.d.ts +4 -0
- package/types/text/web/formatters.g.d.ts +49 -0
- package/types/text/web/formulaSteps.g.d.ts +9 -0
- package/types/text/web/hoverCard.g.d.ts +4 -0
- package/types/text/web/httpFailure.g.d.ts +4 -0
- package/types/text/web/imageCrop.g.d.ts +18 -0
- package/types/text/web/imagePicker.g.d.ts +22 -0
- package/types/text/web/index.g.d.ts +132 -0
- package/types/text/web/infoTip.g.d.ts +4 -0
- package/types/text/web/inlineEdit.g.d.ts +12 -0
- package/types/text/web/input.g.d.ts +11 -0
- package/types/text/web/inputMask.g.d.ts +12 -0
- package/types/text/web/kanban.g.d.ts +33 -0
- package/types/text/web/kbd.g.d.ts +6 -0
- package/types/text/web/kpiTile.g.d.ts +4 -0
- package/types/text/web/labelHelp.g.d.ts +4 -0
- package/types/text/web/leadPopup.g.d.ts +23 -0
- package/types/text/web/lightbox.g.d.ts +12 -0
- package/types/text/web/mentionInput.g.d.ts +11 -0
- package/types/text/web/modal.g.d.ts +14 -0
- package/types/text/web/modalCardRenderer.g.d.ts +5 -0
- package/types/text/web/modalContent.g.d.ts +4 -0
- package/types/text/web/modalForm.g.d.ts +5 -0
- package/types/text/web/navigationMenu.g.d.ts +4 -0
- package/types/text/web/notificationCentre.g.d.ts +24 -0
- package/types/text/web/numberInput.g.d.ts +7 -0
- package/types/text/web/onboardingChecklist.g.d.ts +10 -0
- package/types/text/web/orgTree.g.d.ts +10 -0
- package/types/text/web/otpInput.g.d.ts +5 -0
- package/types/text/web/overflow.g.d.ts +4 -0
- package/types/text/web/pageHeader.g.d.ts +5 -0
- package/types/text/web/passwordRules.g.d.ts +11 -0
- package/types/text/web/periodPicker.g.d.ts +13 -0
- package/types/text/web/person.g.d.ts +4 -0
- package/types/text/web/phone.g.d.ts +12 -0
- package/types/text/web/phoneNumberInput.g.d.ts +6 -0
- package/types/text/web/pricingCard.g.d.ts +4 -0
- package/types/text/web/qrCode.g.d.ts +4 -0
- package/types/text/web/radio.g.d.ts +4 -0
- package/types/text/web/radioGroup.g.d.ts +5 -0
- package/types/text/web/rating.g.d.ts +8 -0
- package/types/text/web/recordPager.g.d.ts +6 -0
- package/types/text/web/relativeTime.g.d.ts +16 -0
- package/types/text/web/repeater.g.d.ts +5 -0
- package/types/text/web/richText.g.d.ts +25 -0
- package/types/text/web/routeError.g.d.ts +12 -0
- package/types/text/web/rowActions.g.d.ts +4 -0
- package/types/text/web/rowDrop.g.d.ts +5 -0
- package/types/text/web/savedViews.g.d.ts +19 -0
- package/types/text/web/scoreScale.g.d.ts +4 -0
- package/types/text/web/search.g.d.ts +6 -0
- package/types/text/web/sectionLeadCapture.g.d.ts +12 -0
- package/types/text/web/segmented.g.d.ts +4 -0
- package/types/text/web/select.g.d.ts +26 -0
- package/types/text/web/shell.g.d.ts +36 -0
- package/types/text/web/shortcutKeys.g.d.ts +10 -0
- package/types/text/web/showMore.g.d.ts +5 -0
- package/types/text/web/skeletonShapes.g.d.ts +4 -0
- package/types/text/web/slider.g.d.ts +9 -0
- package/types/text/web/sortable.g.d.ts +12 -0
- package/types/text/web/sortableList.g.d.ts +4 -0
- package/types/text/web/sparkline.g.d.ts +7 -0
- package/types/text/web/spinner.g.d.ts +4 -0
- package/types/text/web/splash.g.d.ts +4 -0
- package/types/text/web/splitButton.g.d.ts +4 -0
- package/types/text/web/splitView.g.d.ts +19 -0
- package/types/text/web/stepper.g.d.ts +5 -0
- package/types/text/web/switch.g.d.ts +4 -0
- package/types/text/web/tablePagination.g.d.ts +11 -0
- package/types/text/web/tableRows.g.d.ts +4 -0
- package/types/text/web/tableSelect.g.d.ts +5 -0
- package/types/text/web/tableToolbar.g.d.ts +8 -0
- package/types/text/web/tabs.g.d.ts +6 -0
- package/types/text/web/textarea.g.d.ts +5 -0
- package/types/text/web/themeToggle.g.d.ts +10 -0
- package/types/text/web/timePicker.g.d.ts +15 -0
- package/types/text/web/timeline.g.d.ts +4 -0
- package/types/text/web/toast.g.d.ts +9 -0
- package/types/text/web/tour.g.d.ts +12 -0
- package/types/text/web/tourAdvance.g.d.ts +4 -0
- package/types/text/web/tree.g.d.ts +5 -0
- package/types/text/web/unsavedChanges.g.d.ts +6 -0
- package/types/text/web/updateBar.g.d.ts +6 -0
- package/types/text/web/value.g.d.ts +4 -0
- package/types/text/web/whatsNew.g.d.ts +7 -0
- package/types/text/web/wizard.g.d.ts +16 -0
- package/types/text/web/workspaceSwitcher.g.d.ts +8 -0
- package/dist/WuiCarousel-BdhJLo1m.js +0 -1
- package/dist/WuiCodeBlock-7O514Hqe.js +0 -1
- package/dist/WuiCommandPalette-rVScJ2Hy.js +0 -2
- package/dist/WuiCommentThread-5Uz83s1Y.js +0 -1
- package/dist/WuiConsentBanner-Bm7tT3_5.js +0 -1
- package/dist/WuiContextMenu-_ZeequGf.js +0 -1
- package/dist/WuiDataTable-Bb5hxTfn.js +0 -1
- package/dist/WuiDatePicker-BF_GVNaj.js +0 -31
- package/dist/WuiDateRange-B6xh25qZ.js +0 -25
- package/dist/WuiDrawer-BGuq6FAZ.js +0 -1
- package/dist/WuiDropdown-DVTtANwz.js +0 -1
- package/dist/WuiImageCrop-ChvH8GKb.js +0 -17
- package/dist/WuiInlineEdit-DMK1ESdx.js +0 -1
- package/dist/WuiLeadPopup-BmZG0Fk_.js +0 -382
- package/dist/WuiLightbox-BUD0uefB.js +0 -1
- package/dist/WuiMentionInput-Bo9bhe3U.js +0 -1
- package/dist/WuiNotificationCenter-DP-Sf4FQ.js +0 -1
- package/dist/WuiOrgTree-DzeLFQxy.js +0 -1
- package/dist/WuiOverflow-CV5y5zkM.js +0 -1
- package/dist/WuiPhone-BC0MQ6bf.js +0 -16
- package/dist/WuiPopover-CQJLfgm_.js +0 -1
- package/dist/WuiRecordPager-7HVGoFlP.js +0 -1
- package/dist/WuiResizable-KvfLtbCw.js +0 -1
- package/dist/WuiRollingNumber-sfgNzaP0.js +0 -1
- package/dist/WuiSavedViews-CdjavvPC.js +0 -1
- package/dist/WuiSelect-EquDxkz1.js +0 -9
- package/dist/WuiShortcuts-5PhCS5ri.js +0 -1
- package/dist/WuiShowMore-CvdNQXrA.js +0 -1
- package/dist/WuiSlider-D33Y3_t9.js +0 -51
- package/dist/WuiSortable-CBLMNRuZ.js +0 -1
- package/dist/WuiTimePicker-OAP_QRwV.js +0 -9
- package/dist/WuiTour-Dxyv9uNz.js +0 -1
- package/dist/WuiTree-BPT9EZuw.js +0 -1
- package/dist/WuiWizardStep-Cencr-mT.js +0 -1
- package/dist/calendarMath-D6UUgYTD.js +0 -1
- package/dist/chips-Dcf6_wuZ.js +0 -2
- package/dist/commentText-BnX7rA2-.js +0 -1
- package/dist/country-x5lqC5Xu.js +0 -1
- package/dist/customRule-Chp7YwFb.js +0 -1
- package/dist/dataTable-CcH1lBIM.js +0 -1
- package/dist/drawerDiscard-BtPeayNT.js +0 -1
- package/dist/elements/resizable.js +0 -1
- package/dist/elements/rolling-number.js +0 -1
- package/dist/fileViewerImage-XsUnEv6Z.js +0 -3
- package/dist/fileViewerMedia-DTDM69nT.js +0 -1
- package/dist/fileViewerPdf-vlVCKKyK.js +0 -20
- package/dist/fileViewerUi-CprJdtCB.js +0 -1
- package/dist/formatters-ljfITOZ3.js +0 -1
- package/dist/iconGlyphs.g-DPqoOoXy.js +0 -1
- package/dist/inlineEditText-_GFrdJ6F.js +0 -1
- package/dist/kanban-CDaks135.js +0 -1
- package/dist/kanbanModel-BaT75e-b.js +0 -1
- package/dist/loader-B7twHKUy.js +0 -1
- package/dist/menuKeyNav-COGecOjH.js +0 -1
- package/dist/nativeOverlay-BbkCnzFj.js +0 -1
- package/dist/notificationDays-BIWczft0.js +0 -1
- package/dist/recents-Dcw-b5cB.js +0 -1
- package/dist/relativeTime-BahImc8F.js +0 -1
- package/dist/search-C6r6xpep.js +0 -1
- package/dist/shortcutKeys-COVLox98.js +0 -1
- package/dist/themeTransition-Dt7Br1QT.js +0 -1
- package/dist/ui-elements/modal.global.js +0 -1
- package/dist/ui-elements/resizable.global.js +0 -1
- package/dist/zone-BR02ZkHF.js +0 -1
- package/types/WuiResizable.d.ts +0 -79
- package/types/WuiRollingNumber.d.ts +0 -27
- package/types/elements/resizable.d.ts +0 -2
- package/types/elements/rolling-number.d.ts +0 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TablePaginationText = {
|
|
2
|
+
readonly ariaLabel: string;
|
|
3
|
+
readonly nextLabel: string;
|
|
4
|
+
readonly pageLabel: string;
|
|
5
|
+
readonly pageSizeLabel: string;
|
|
6
|
+
readonly previousLabel: string;
|
|
7
|
+
readonly rangeText: string;
|
|
8
|
+
readonly rowsPerPageLabel: string;
|
|
9
|
+
readonly summaryText: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const TABLE_PAGINATION_TEXT: TablePaginationText;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type TableToolbarText = {
|
|
2
|
+
readonly allSelectedLabel: string;
|
|
3
|
+
readonly clearLabel: string;
|
|
4
|
+
readonly clearSelectionLabel: string;
|
|
5
|
+
readonly selectAllMatchingLabel: string;
|
|
6
|
+
readonly selectedLabel: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const TABLE_TOOLBAR_TEXT: TableToolbarText;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ThemeToggleText = {
|
|
2
|
+
readonly autoLabel: string;
|
|
3
|
+
readonly autoModeLabel: string;
|
|
4
|
+
readonly darkLabel: string;
|
|
5
|
+
readonly darkModeLabel: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly lightLabel: string;
|
|
8
|
+
readonly lightModeLabel: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const THEME_TOGGLE_TEXT: ThemeToggleText;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type TimePickerText = {
|
|
2
|
+
readonly chooseTimeLabel: string;
|
|
3
|
+
readonly helpLabel: string;
|
|
4
|
+
readonly hour: string;
|
|
5
|
+
readonly maxText: string;
|
|
6
|
+
readonly minText: string;
|
|
7
|
+
readonly minute: string;
|
|
8
|
+
readonly optionalLabel: string;
|
|
9
|
+
readonly periodLabel: string;
|
|
10
|
+
readonly placeholder: string;
|
|
11
|
+
readonly rangeText: string;
|
|
12
|
+
readonly refusalText: string;
|
|
13
|
+
readonly stepText: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const TIME_PICKER_TEXT: TimePickerText;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type TourText = {
|
|
2
|
+
readonly backLabel: string;
|
|
3
|
+
readonly doneLabel: string;
|
|
4
|
+
readonly endMessage: string;
|
|
5
|
+
readonly endTitle: string;
|
|
6
|
+
readonly mediaPauseLabel: string;
|
|
7
|
+
readonly mediaPlayLabel: string;
|
|
8
|
+
readonly nextLabel: string;
|
|
9
|
+
readonly progressLabel: string;
|
|
10
|
+
readonly skipLabel: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const TOUR_TEXT: TourText;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type WizardText = {
|
|
2
|
+
readonly activeLabel: string;
|
|
3
|
+
readonly backLabel: string;
|
|
4
|
+
readonly closeLabel: string;
|
|
5
|
+
readonly doneLabel: string;
|
|
6
|
+
readonly errorLabel: string;
|
|
7
|
+
readonly finishLabel: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly nextLabel: string;
|
|
10
|
+
readonly pendingLabel: string;
|
|
11
|
+
readonly skipLabel: string;
|
|
12
|
+
readonly skippedLabel: string;
|
|
13
|
+
readonly stepOfText: string;
|
|
14
|
+
readonly stepText: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const WIZARD_TEXT: WizardText;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type WorkspaceSwitcherText = {
|
|
2
|
+
readonly ariaLabel: string;
|
|
3
|
+
readonly createLabel: string;
|
|
4
|
+
readonly noMatchText: string;
|
|
5
|
+
readonly searchPlaceholder: string;
|
|
6
|
+
readonly triggerLabel: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const WORKSPACE_SWITCHER_TEXT: WorkspaceSwitcherText;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";var t=Object.freeze({slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`,dot:`Go to slide`,pause:`Pause`,play:`Play`}),n=120,r=class extends e{_page;_pages;_perView;_paused;_hover;_focus;_timer;_settleTimer;_status;_ready;_motion;_mutations;_resizer;_doc;_track;_onClick;_onKeyDown;_onScroll;_onEnter;_onLeave;_onFocusIn;_onFocusOut;_onVisibility;_onMotion;_tick;static get observedAttributes(){return[`autoplay`]}constructor(){super(),this._page=0,this._pages=1,this._perView=1,this._paused=!1,this._hover=!1,this._focus=!1,this._timer=null,this._settleTimer=null,this._status=``,this._ready=!1,this._motion=null,this._mutations=null,this._resizer=null,this._doc=null,this._track=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onScroll=()=>{this._settleTimer!==null&&clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>this._settle(),n)},this._onEnter=()=>this._hold({hover:!0}),this._onLeave=()=>this._hold({hover:!1}),this._onFocusIn=()=>this._hold({focus:!0}),this._onFocusOut=e=>this._hold({focus:e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)}),this._onVisibility=()=>this._sync(),this._onMotion=()=>this._sync(),this._tick=()=>{this._timer=null,this._go(this._page+1<this._pages?this._page+1:0)}}connectedCallback(){let e=this.querySelector(`.wui-carousel-track`);if(this._track=e instanceof HTMLElement?e:null,!this._track){this.ownerDocument.readyState===`loading`&&this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.connectedCallback(),{once:!0});return}this._doc=this.ownerDocument;let t=this.getAttribute(`data-wui-style`);if(t){for(let e of t.split(`;`)){let t=e.indexOf(`:`);t>0&&this.style.setProperty(e.slice(0,t).trim(),e.slice(t+1).trim())}this.removeAttribute(`data-wui-style`)}this._motion=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,this._motion?.addEventListener(`change`,this._onMotion),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseenter`,this._onEnter),this.addEventListener(`mouseleave`,this._onLeave),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._track.addEventListener(`keydown`,this._onKeyDown),this._track.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._doc.addEventListener(`visibilitychange`,this._onVisibility),typeof MutationObserver<`u`&&(this._mutations=new MutationObserver(()=>this._refresh()),this._mutations.observe(this._track,{childList:!0})),typeof ResizeObserver<`u`&&(this._resizer=new ResizeObserver(()=>this._refresh()),this._resizer.observe(this._track)),this._ready=!0,this._refresh()}disconnectedCallback(){this._ready=!1,this._timer!==null&&clearTimeout(this._timer),this._settleTimer!==null&&clearTimeout(this._settleTimer),this._timer=null,this._motion?.removeEventListener(`change`,this._onMotion),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseenter`,this._onEnter),this.removeEventListener(`mouseleave`,this._onLeave),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._track?.removeEventListener(`keydown`,this._onKeyDown),this._track?.removeEventListener(`scroll`,this._onScroll),this._doc?.removeEventListener(`visibilitychange`,this._onVisibility),this._mutations?.disconnect(),this._resizer?.disconnect(),this._mutations=this._resizer=this._motion=this._doc=null}attributeChangedCallback(){this._ready&&this._sync()}get paused(){return this._paused}set paused(e){this._paused=!!e,this._ready&&this._sync()}next(){this._page+1<this._pages?this._go(this._page+1):this.hasAttribute(`loop`)&&this._go(0)}prev(){this._page>0?this._go(this._page-1):this.hasAttribute(`loop`)&&this._go(this._pages-1)}goTo(e){this._go(Number(e))}_interval(){let e=Number.parseInt(this.getAttribute(`autoplay`)??``,10);return Math.max(e||0,0)}_slides(){let e=this._track;if(!e)throw Error(`WuiCarousel used before it was connected`);return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`wui-carousel-slide`))}_playing(){return this._interval()>0&&this._pages>1&&!this._paused&&!this._hover&&!this._focus&&!this._motion?.matches&&!this._doc?.hidden}_hold({hover:e=this._hover,focus:t=this._focus}){this._hover=e,this._focus=t,this._sync()}_click(e){let t=(e.target instanceof Element?e.target:null)?.closest(`.wui-carousel-pause, .wui-carousel-prev, .wui-carousel-next, .wui-carousel-dot`),n=t instanceof HTMLElement?t:null;if(!n||!this.contains(n))return;let r=this._track;if(!r)throw Error(`WuiCarousel used before it was connected`);r.contains(n)||(n.classList.contains(`wui-carousel-pause`)?(this._paused=!this._paused,this._hover=!1,this._focus=!1,this._sync()):n.getAttribute(`aria-disabled`)===`true`?e.preventDefault():n.classList.contains(`wui-carousel-prev`)?this.prev():n.classList.contains(`wui-carousel-next`)?this.next():this._go(Number(n.dataset.page)))}_key(e){if(e.target!==this._track||e.altKey||e.ctrlKey||e.metaKey)return;let t={ArrowRight:()=>this.next(),ArrowLeft:()=>this.prev(),Home:()=>this._go(0),End:()=>this._go(this._pages-1)}[e.key];t&&(e.preventDefault(),t())}_perViewNow(){let e=``;if(typeof window<`u`){let t=this._track;if(!t)throw Error(`WuiCarousel used before it was connected`);e=window.getComputedStyle(t).getPropertyValue(`--wui-carousel-view`)}return Math.max(Number.parseInt(e,10)||0,1)}_start(e){return Math.min(e*this._perView,Math.max(0,this._slides().length-this._perView))}_label(){let e=this._slides();return e.forEach((n,r)=>{let i=t.slide(r+1,e.length);n.getAttribute(`aria-label`)!==i&&n.setAttribute(`aria-label`,i)}),e.length}_refresh(){let e=this._label();this._perView=this._perViewNow();let n=Math.max(1,Math.ceil(e/this._perView)),r=this.querySelector(`.wui-carousel-dots`);if(r&&r.children.length!==n){let e=this.getAttribute(`dot-label`)||t.dot;r.replaceChildren(...Array.from({length:n},(t,n)=>{let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=`wui-carousel-dot`,r.dataset.page=String(n),r.setAttribute(`aria-label`,`${e} ${this._start(n)+1}`),r}))}this._pages=n,this._page=Math.min(this._page,n-1),this.toggleAttribute(`data-single`,n<=1),this._render(!1),this._sync()}_settle(){let e=this._track;if(!e)throw Error(`WuiCarousel used before it was connected`);let t=this._slides();if(!t.length)return;let n;if(e.scrollWidth>e.clientWidth&&e.scrollLeft+e.clientWidth>=e.scrollWidth-2)n=this._pages-1;else{let r=0,i=1/0;t.forEach((t,n)=>{let a=Math.abs(t.offsetLeft-e.scrollLeft);a<i&&(i=a,r=n)}),n=Math.min(this._pages-1,Math.round(r/this._perView))}n!==this._page&&(this._page=n,this._render(!0),this._sync())}_go(e){if(!Number.isInteger(e))return;this._page=Math.max(0,Math.min(this._pages-1,e));let t=this._track;if(!t)throw Error(`WuiCarousel used before it was connected`);let n=this._slides()[this._start(this._page)];if(n){let e=this._motion?.matches?`auto`:`smooth`;typeof t.scrollTo==`function`?t.scrollTo({left:n.offsetLeft,behavior:e}):t.scrollLeft=n.offsetLeft}this._render(!0),this._sync()}_render(e){let n=this.hasAttribute(`loop`);for(let e of this.querySelectorAll(`.wui-carousel-dot`))e instanceof HTMLElement&&(Number(e.dataset.page)===this._page?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`));this.querySelector(`.wui-carousel-prev`)?.setAttribute(`aria-disabled`,String(!n&&this._page===0)),this.querySelector(`.wui-carousel-next`)?.setAttribute(`aria-disabled`,String(!n&&this._page===this._pages-1));let r=this._slides().length,i=this._start(this._page)+1,a=Math.min(r,i+this._perView-1),o=t.status(i,a,r);if(o===this._status||(this._status=o,!e))return;let s=this.querySelector(`[data-wui-status]`);s&&!this._playing()&&(s.textContent=o),this.dispatchEvent(new CustomEvent(`wui:carousel:change`,{bubbles:!0,detail:{page:this._page,pages:this._pages}}))}_sync(){this._timer!==null&&clearTimeout(this._timer),this._timer=null;let e=this._interval(),n=this.querySelector(`.wui-carousel-pause`);if(n instanceof HTMLElement){n.hidden=e===0||this._pages<=1||!!this._motion?.matches;let r=this._paused?this.getAttribute(`play-label`)||t.play:this.getAttribute(`pause-label`)||t.pause,i=n.querySelector(`.wui-carousel-pause-text`);i&&i.textContent!==r&&(i.textContent=r),this.toggleAttribute(`data-paused`,this._paused)}this._playing()&&(this._timer=setTimeout(this._tick,e))}};export{r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./buttonClass-GtEi8hAY.js";import{n,t as r}from"./copyText-Q-QZKBmx.js";import{t as i}from"./elementBase-Cxeyx0tU.js";import{t as a}from"./iconGlyphs.g-DPqoOoXy.js";Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`razor`,`css`]);var o=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,razor:`Razor`,css:`CSS`}),s=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),c=`(?![\\s\\S])`,l=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${c})`).source,u=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,s([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],d=[[`comment`,RegExp(`//[^\\n]*|${l}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,s(/* @__PURE__ */ `async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,s([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],f=[[`comment`,RegExp(`//[^\\n]*|${l}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,s(/* @__PURE__ */ `abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,s([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],p=[[`comment`,RegExp(`--[^\\n]*|${l}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,s(/* @__PURE__ */ `add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,s([`true`,`false`])],[`type`,s([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],m=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,s([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,s(/* @__PURE__ */ `awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],h=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],g=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${c})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],_={json:u,js:d,cs:f,sql:p,bash:m,http:h,css:[[`comment`,new RegExp(l)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:g,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},v=e=>Object.hasOwn(_,e),y=/* @__PURE__ */ new Map;function b(e){let t=y.get(e);if(!t){let n=_[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},y.set(e,t)}return t}function x(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function S(e,t,n=[]){let{re:r,types:i}=b(e),a=0;for(let o of t.matchAll(r)){let r=o[0];if(!r)continue;x(n,`plain`,t.slice(a,o.index));let s=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[s]===`tag`?S(`htmlTag`,r,n):x(n,i[s]??`plain`,r),a=o.index+r.length}return x(n,`plain`,t.slice(a)),n}function C(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return S(`http`,e);let n=t[0]??``,r=S(`http`,e.slice(0,t.index+n.length)),i=e.slice(t.index+n.length),a=i.trimStart()[0];return a===`{`||a===`[`?S(`json`,i,r):a===`<`?S(`html`,i,r):(x(r,`plain`,i),r)}function w(e,t){let n=String(e??``);if(!n||n.length>1e5)return n?[[`plain`,n]]:[];if(t===`http`)return C(n);let r=t===`razor`?`html`:t;return!v(r)||r===`htmlTag`?[[`plain`,n]]:S(r,n)}function T(e,t){let n=[],r=[n];for(let[i,a]of w(e,t))a.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&(n=[],r.push(n)),e&&n.push([i,e])});return r.length>1&&n.length===0&&r.pop(),r}function E(e){return Object.hasOwn(o,e)}var D=class extends i{_title;_view;_codeEl;_copyIcon;_copyText;_chrome=null;_copied=!1;_observer=null;_timer=0;_cancelFrame=null;constructor(){super();let e=this.ownerDocument;this._title=e.createElement(`span`),this._title.className=`wui-code-title`,this._view=e.createElement(`div`),this._codeEl=e.createElement(`code`),this._copyIcon=e.createElement(`span`),this._copyIcon.className=`wui-code-copy-icon`,this._copyText=e.createElement(`span`)}static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}connectedCallback(){this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._schedule()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._cancelPending()}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_code(){return(this._source()?.textContent??``).replace(/\r?\n$/,``)}_schedule(){if(this._cancelFrame)return;let e=()=>{this._cancelFrame=null,this._render()};if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(e);this._cancelFrame=()=>cancelAnimationFrame(t)}else{let t=!0;queueMicrotask(()=>{t&&e()}),this._cancelFrame=()=>{t=!1}}}_cancelPending(){this._cancelFrame?.(),this._cancelFrame=null}_render(){if(!this._source())return;this._cancelPending();let e=this.ownerDocument;this._chrome||this._build(e);let t=this.getAttribute(`language`),n=t!==null&&E(t)?t:`text`,r=this.getAttribute(`label`)||``,i=T(this._code(),n);this._title.textContent=r||o[n],this._view.setAttribute(`aria-label`,r||`Code`),this._view.style.setProperty(`--wui-code-digits`,String(String(i.length).length)),this._codeEl.replaceChildren(...i.map(t=>O(e,t))),this._copied||(this._copyText.textContent=this._copyLabel()),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_build(e){let t=e.createElement(`div`);t.className=`wui-code-chrome`,t.append(this._bar(e));let n=this._view;n.className=`wui-code-view`,n.setAttribute(`role`,`region`),n.tabIndex=0;let r=e.createElement(`pre`);r.className=`wui-code-pre`,r.append(this._codeEl),n.append(r),t.append(n),this._chrome=t,this.append(t)}_bar(i){let a=i.createElement(`div`);a.className=`wui-code-bar`;let o=i.createElement(`button`);return o.type=`button`,o.className=`${e(`primary`,`ghost`,`sm`)} wui-code-copy`,o.dataset.wui=t,o.setAttribute(`aria-live`,`polite`),this._setCopied(!1),o.append(this._copyIcon,this._copyText),o.addEventListener(`click`,async()=>{await n(this._code())&&(this._setCopied(!0),clearTimeout(this._timer),this._timer=window.setTimeout(()=>this._setCopied(!1),r))}),a.append(this._title,o),a}_setCopied(e){this._copied=e,this._copyIcon.innerHTML=a(e?`check`:`files`,{size:14}),this._copyText.textContent=this._copyLabel()}_copyLabel(){return this._copied?this.getAttribute(`copied-label`)||`Copied`:this.getAttribute(`copy-label`)||`Copy`}};function O(e,t){let n=e.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of t){if(r===`plain`){n.append(i);continue}let t=e.createElement(`span`);t.className=`wui-code-t-${r}`,t.textContent=i,n.append(t)}return n}export{D as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";import{n as t}from"./optionLabel-4xjXWy74.js";import{t as n}from"./textMatch-wdY7XLIc.js";var r=`[role="option"]`,i=`No results`,a=`All`,o=`Recent`,s=5,c=20,l=`.wui-cmd-back, [data-depth]`,u=`[data-group-tab]`,d=0;function f(e,t){if(!(e instanceof Element))return null;let n=e.closest(t);return n instanceof HTMLElement?n:null}var p=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},m=(e,t,n)=>[...e.querySelectorAll(t)].filter(e=>e instanceof n),h=class extends e{_path;_group;_crumbSig;_modal;_recentsId;_onModalClosed;_activeId;_lastQuery;_lastIds;_userChose;_onKeyDown;_onClick;_onMouseDown;_onMouseMove;_onInput;static get observedAttributes(){return[`filter`,`group-filter`,`highlight`,`empty-text`,`path`,`root-label`,`recents-key`,`recents-limit`,`recents-label`]}constructor(){super(),this._path=[],this._group=null,this._crumbSig=null,this._modal=null,this._recentsId=`wui-cmd-recents-${++d}`,this._onModalClosed=()=>{this._setKeyboard(!1),this._reset(),this.hasAttribute(`path`)&&this._restart()},this._activeId=null,this._lastQuery=null,this._lastIds=null,this._userChose=!1,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>{let t=f(e.target,l);if(t&&this.contains(t)){let e=t.matches(`.wui-cmd-back`)?this._path.length-1:Number(t.dataset.depth);this._goTo(this._path.slice(0,e));return}let n=f(e.target,u);if(n&&this.contains(n)){this._pickGroup(n.dataset.groupTab||null);return}let r=this._optionFrom(e.target);r&&this._select(r)},this._onMouseDown=e=>{let t=f(e.target,l),n=f(e.target,u);(t&&this.contains(t)||n&&this.contains(n)||this._optionFrom(e.target,!0))&&e.preventDefault()},this._onMouseMove=e=>{let t=this._optionFrom(e.target);t&&t.id!==this._activeId&&(this._setKeyboard(!1),this._userChose=!0,this._setActive(t,!1))},this._onInput=e=>{this.hasAttribute(`filter`)&&e.target===this._input()&&(this._group=null,this._applyFilter(),this.refresh())}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousedown`,this._onMouseDown),this.addEventListener(`mousemove`,this._onMouseMove),this.addEventListener(`input`,this._onInput),this._modal=this.closest(`wui-modal`),this._modal?.addEventListener(`wui-modal-closed`,this._onModalClosed),this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){this.isConnected&&(e===`path`&&this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh())}get filter(){return this.hasAttribute(`filter`)}set filter(e){this.toggleAttribute(`filter`,!!e)}get highlight(){return this.getAttribute(`highlight`)!==`false`}set highlight(e){this.setAttribute(`highlight`,e?`true`:`false`)}get emptyText(){return this.getAttribute(`empty-text`)??i}set emptyText(e){this.setAttribute(`empty-text`,String(e??``))}refresh(){this._renderRecents(),this._renderCrumbs(),this._syncTabs();let e=this._input(),t=e?e.value:``,n=t!==this._lastQuery;this._lastQuery=t;let r=this._selectableOptions(),i=r.map(e=>e.id).join(`
|
|
2
|
-
`),a=i!==this._lastIds;this._lastIds=i;let o=!n&&(this._userChose||!a)?r.find(e=>e.id===this._activeId):null;o||(this._userChose=!1,this._setKeyboard(!1)),this._setActive(o??r[0]??null,n)}_input(){let e=this.querySelector(`[role="combobox"]`);return e instanceof HTMLInputElement?e:null}_optionFrom(e,t=!1){let n=f(e,r);return n&&this.contains(n)&&!this._isHidden(n)&&(t||!this._isDisabled(n))?n:null}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_isHidden(e){return e.hidden!==!1||(f(e,`[role="group"]`)?.hidden??!1)!==!1}_selectableOptions(){return m(this,r,HTMLElement).filter(e=>!this._isHidden(e)&&!this._isDisabled(e))}_setActive(e,t){this._activeId=e?e.id:null;for(let t of m(this,r,HTMLElement))t.setAttribute(`aria-selected`,t===e?`true`:`false`);let n=this._input();n&&(e?n.setAttribute(`aria-activedescendant`,e.id):n.removeAttribute(`aria-activedescendant`)),e&&t&&e.scrollIntoView({block:`nearest`})}_move(e){let t=this._selectableOptions();if(!t.length)return;let n=t.findIndex(e=>e.id===this._activeId),r=n<0?e>0?0:t.length-1:(n+e+t.length)%t.length;this._userChose=!0,this._setKeyboard(!0),this._setActive(t[r]??null,!0)}_setKeyboard(e){this.toggleAttribute(`data-keyboard`,e)}_handleKeyDown(e){let t=this._input();if(t&&e.target===t){if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._move(e.key===`ArrowDown`?1:-1);else if(e.key===`Tab`&&this._groupActive()&&this._tabs().length)e.preventDefault(),this._cycleGroup(e.shiftKey?-1:1);else if(e.key===`Backspace`&&!e.isComposing&&this._path.length&&!t.value)e.preventDefault(),this._goTo(this._path.slice(0,-1));else if(e.key===`Enter`&&!e.isComposing){let t=this._selectableOptions().find(e=>e.id===this._activeId);if(!t)return;e.preventDefault(),this._select(t)}}}_select(e){this._remember(e),this.dispatchEvent(new CustomEvent(`wui-command-palette:select`,{bubbles:!0,cancelable:!0,detail:{key:e.dataset.key??null,groupKey:e.dataset.groupKey??null,id:e.id}}))&&(e.dataset.opens?this._open(e.dataset.opens):e.dataset.href&&this._navigate(e.dataset.href))}_open(e){let t=m(this,`.wui-cmd-page`,HTMLElement).find(t=>t.dataset.page===e);this._goTo([...this._path,{key:e,label:t?.dataset.label??e}])}_goTo(e){this._input()?.focus(),this.dispatchEvent(new CustomEvent(`wui-command-palette:navigate`,{bubbles:!0,cancelable:!0,detail:{path:e}}))&&(this._path=e,this._restart())}_tabs(){return m(this,u,HTMLElement)}_groupActive(){return this.hasAttribute(`group-filter`)&&this._path.length===0}_pickGroup(e){this._group=e,this._applyFilter(),this.refresh()}_cycleGroup(e){let t=this._tabs().map(e=>e.dataset.groupTab||null),n=Math.max(0,t.indexOf(this._group));this._pickGroup(t[(n+e+t.length)%t.length]??null)}_syncTabs(){if(!this.hasAttribute(`group-filter`))return;let e=p(this,`.wui-cmd-tabs`,HTMLElement);e&&(e.hidden=!this._groupActive());for(let e of this._tabs())e.setAttribute(`aria-selected`,String((e.dataset.groupTab||null)===this._group))}_restart(){this._group=null;let e=this._input();e&&(e.value=``),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}_reset(){this.hasAttribute(`path`)||(this._path=[],this._restart())}_readPath(){let e=this.getAttribute(`path`);if(e==null)return;let t=JSON.parse(e);this._path=Array.isArray(t)?t.filter(e=>e&&typeof e.key==`string`&&typeof e.label==`string`):[]}_renderCrumbs(){let e=p(this,`.wui-cmd-crumbs`,HTMLElement);if(!e)return;let t=this.getAttribute(`root-label`)??a,n=JSON.stringify([t,this._path]);if(e.hidden=this._path.length===0,n===this._crumbSig)return;this._crumbSig=n;let r=p(e,`.wui-cmd-trail`,HTMLElement);if(!r)return;let i=[t,...this._path.map(e=>e.label)];r.replaceChildren(...i.map((e,t)=>{let n=document.createElement(`li`),r=t===i.length-1,a=document.createElement(r?`span`:`button`);if(a.className=`wui-cmd-crumb`,a.textContent=e,r)a.setAttribute(`aria-current`,`page`);else{if(!(a instanceof HTMLButtonElement))throw Error(`breadcrumb button missing`);a.type=`button`,a.dataset.depth=String(t)}return n.append(a),n}))}_recentsHost(){return p(this,`.wui-cmd-recents`,HTMLElement)}_realOptions(){let e=this._recentsHost();return m(this,r,HTMLElement).filter(t=>!e?.contains(t))}_recentEntries(){let e=this.getAttribute(`recents-key`);if(!e)return[];let t;try{t=JSON.parse(globalThis.localStorage?.getItem(e)??`[]`)}catch{return[]}return Array.isArray(t)?t.filter(e=>e&&typeof e.g==`string`&&typeof e.k==`string`):[]}_recentsLimit(){let e=Number.parseInt(this.getAttribute(`recents-limit`)??``,10);return Number.isFinite(e)&&e>0?Math.min(e,c):s}_remember(e){let t=this.getAttribute(`recents-key`),{groupKey:n,key:r,opens:i}=e.dataset;if(!t||i||n==null||r==null)return;let a=[{g:n,k:r},...this._recentEntries().filter(e=>e.g!==n||e.k!==r)];try{globalThis.localStorage?.setItem(t,JSON.stringify(a.slice(0,this._recentsLimit())))}catch(e){if(!(e instanceof DOMException))throw e}}_renderRecents(){let e=this._recentsHost();if(!e)return;let t=this._input(),n=this._groupActive()?this._group:null,r=this._path.length===0&&!(t?.value??``).trim()?this._recentEntries().filter(e=>!n||e.g===n):[],i=this._realOptions(),a=[];for(let e of r){let t=i.find(t=>t.dataset.groupKey===e.g&&t.dataset.key===e.k);if(t&&!t.dataset.opens&&!this._isDisabled(t)&&a.push(t),a.length>=this._recentsLimit())break}if(!a.length){e.firstChild&&e.replaceChildren();return}let s=`${this._recentsId}-label`,c=document.createElement(`div`);c.className=`wui-cmd-group`,c.setAttribute(`role`,`group`),c.setAttribute(`aria-labelledby`,s);let l=document.createElement(`div`);l.className=`wui-cmd-group-label`,l.setAttribute(`role`,`presentation`),l.id=s,l.textContent=this.getAttribute(`recents-label`)??o,c.append(l);for(let e of a){let t=e.cloneNode(!0);if(!(t instanceof HTMLElement))throw Error(`recent option copy is not an element`);t.id=`${this._recentsId}-${e.id}`,t.hidden=!1,t.removeAttribute(`aria-selected`),c.append(t)}e.replaceChildren(c)}_inScope(e,t){return!t||(f(e,`.wui-cmd-page`)?.dataset.page??null)===(this._path.at(-1)?.key??null)}_navigate(e){window.location.assign(e)}_applyFilter(){let e=this._input(),i=(e?e.value:``).trim(),a=i.toLowerCase(),o=this.highlight,s=m(this,`.wui-cmd-page`,HTMLElement),c=s.length>0,l=this._path.at(-1)?.key??null;for(let e of s)e.hidden=e.dataset.page!==l;let u=this._groupActive()?this._group:null,d=0;for(let e of this._realOptions()){let r=p(e,`.wui-cmd-item-label`,HTMLElement),s=e.dataset.label??r?.textContent??``,l=(e.dataset.keywords??``).split(/\s+/).filter(Boolean),f=!a||s.toLowerCase().includes(a)||l.some(e=>e.toLowerCase().includes(a)),m=this._inScope(e,c)&&(!u||e.dataset.groupKey===u)&&f;e.hidden=!m,m&&d++,r&&(r.innerHTML=n(s,o?i:``).map(e=>e.match?`<mark class="wui-cmd-mark">${t(e.text)}</mark>`:t(e.text)).join(``))}let f=this._recentsHost();for(let e of m(this,`[role="group"]`,HTMLElement))f?.contains(e)||(e.hidden=!m(e,r,HTMLElement).some(e=>!e.hidden));let h=p(this,`[role="listbox"]`,HTMLElement);h&&(h.hidden=d===0);let g=p(this,`.wui-cmd-empty`,HTMLElement);g&&(g.textContent=a&&d===0?this.emptyText:``)}_teardown(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousedown`,this._onMouseDown),this.removeEventListener(`mousemove`,this._onMouseMove),this.removeEventListener(`input`,this._onInput),this._modal?.removeEventListener(`wui-modal-closed`,this._onModalClosed),this._modal=null}};export{h as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./buttonClass-GtEi8hAY.js";import{a as n,i as r,n as i,r as a}from"./commentText-BnX7rA2-.js";import{t as o}from"./elementBase-Cxeyx0tU.js";import{a as s,l as c,s as l}from"./nativeOverlay-BbkCnzFj.js";import{l as u}from"./wuiHttp-DGbD7Fra.js";import{i as d}from"./WuiMentionInput-Bo9bhe3U.js";var f=`[data-wui-items]`,p=`[data-wui-picker]`,m=`[data-wui-composer]`,h=`[data-wui-comment]`,g=`[data-wui-live]`,_=e=>{let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;return typeof t==`string`&&t?t:n},v=e=>e instanceof Element?e:null,y=e=>`disabled`in e&&e.disabled===!0,b=(e,t)=>{if(e==null)throw Error(`${t} missing`);return e},x=(e,t,n)=>{let r=e?.querySelector(t);return r instanceof n?r:null},S=(e,t,n)=>{let r=e?.closest(t);return r instanceof n?r:null},C=(e,t,n)=>e?[...e.querySelectorAll(t)].filter(e=>e instanceof n):[],w=class extends o{_wired;_busy;_peopleProp;_pickerFor;_openers;constructor(){super(),this._wired=!1,this._busy=!1,this._peopleProp=null,this._pickerFor=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onSubmitKey=this._onSubmitKey.bind(this)}connectedCallback(){if(Object.hasOwn(this,`people`)){let e=this.people;Reflect.deleteProperty(this,`people`),this.people=e}if(this._wired)return;this._wired=!0,this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wui:mention-input:submit`,this._onSubmitKey),customElements.upgrade(this);let e=x(this,`${m} wui-mention-input`,d);this._handPeople(e),this._applyComposerPlaceholder(e)}disconnectedCallback(){this._closePicker(!1)}get people(){return this._peopleProp?this._peopleProp:C(this,`:scope > [data-wui-people] > wui-option`,HTMLElement).map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0}))}set people(e){this._peopleProp=Array.isArray(e)?e:[];for(let e of this.querySelectorAll(`wui-mention-input`))e.people=this._peopleProp}_handPeople(e){!e||this.hasAttribute(`remote`)||this.hasAttribute(`source`)||(e.people=this.people)}_applyComposerPlaceholder(e){let t=this.getAttribute(`composer-placeholder`);e&&t!=null&&e.setAttribute(`placeholder`,t)}_reactionChoices(){let e=this.getAttribute(`reaction-choices`),t=e?e.split(/\s+/).filter(Boolean):[];return t.length?t:i}_onClick(e){let t=S(v(e.target),`[data-wui-emoji]`,HTMLElement);if(t&&this.contains(t)&&!y(t)){let e=t.closest(p),n=e?this._pickerFor?.comment:t.closest(h);e&&this._closePicker(!0),n&&this._react(n,t.getAttribute(`data-wui-emoji`));return}let n=S(v(e.target),`[data-wui-action]`,HTMLElement);if(!n||!this.contains(n)||y(n))return;let r=n.closest(h);switch(n.getAttribute(`data-wui-action`)){case`reply`:this._openReply(r,n);break;case`edit`:this._openEditor(r,n);break;case`delete`:this._askDelete(r);break;case`cancel-delete`:this._closeConfirm(r,!0);break;case`confirm-delete`:{let e=b(r,`comment`);this._send(`delete`,{commentId:e.getAttribute(`data-wui-comment`)},{comment:e,scope:e});break}case`react-menu`:this._pickerFor?.button===n?this._closePicker(!0):this._openPicker(r,n);break;case`cancel`:this._closeSlot(S(n,`[data-wui-reply], [data-wui-editor]`,HTMLElement),!0);break;case`post`:case`send`:this._sendFrom(n)}}_onKeyDown(e){let t=x(this,p,HTMLElement),n=v(e.target);if(this._pickerFor&&t?.contains(n)){let r=C(t,`[data-wui-emoji]`,HTMLElement),i=n instanceof HTMLElement?r.indexOf(n):-1;e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closePicker(!0)):e.key===`ArrowRight`||e.key===`ArrowLeft`?(e.preventDefault(),r[(i+(e.key===`ArrowRight`?1:-1)+r.length)%r.length]?.focus()):e.key===`Tab`&&this._closePicker(!1);return}if(e.key!==`Escape`)return;let r=S(n,`[data-wui-reply], [data-wui-editor]`,HTMLElement);if(r&&this.contains(r)){e.preventDefault(),e.stopPropagation(),this._closeSlot(r,!0);return}let i=S(n,`[data-wui-confirm]`,HTMLElement);i&&(e.preventDefault(),e.stopPropagation(),this._closeConfirm(i.closest(h),!0))}_onSubmitKey(e){let t=x(S(v(e.target),`[data-wui-reply], [data-wui-editor], [data-wui-composer]`,HTMLElement),`[data-wui-action="send"], [data-wui-action="post"]`,HTMLElement);t&&!y(t)&&this._sendFrom(t)}_openReply(e,t){if(this.hasAttribute(`no-replies`))return;let n=x(e,`:scope > [data-wui-reply]`,HTMLElement);if(!n)return;if(!n.hidden){n.querySelector(`wui-mention-input`)?.focus();return}let r=e?.querySelector(`.wui-comment-author`)?.textContent?.trim()||``;this._fillSlot(n,{label:a.replyLabel(r),placeholder:a.replyPlaceholder,value:``,send:a.reply,opener:t})}_openEditor(e,t){let n=x(e,`:scope > .wui-comment-row [data-wui-editor]`,HTMLElement);if(!n?.hidden)return;let r=x(b(n.parentElement,`comment row`),`:scope > [data-wui-text]`,HTMLElement);r&&(r.hidden=!0),this._fillSlot(n,{label:a.editLabel,placeholder:``,value:e?.getAttribute(`data-value`)??``,send:a.save,opener:t})}_fillSlot(e,{label:t,placeholder:n,value:r,send:i,opener:o}){let s=this.ownerDocument,c=s.createElement(`wui-mention-input`);c.className=`wui-mention-input`,c.setAttribute(`label`,t),n&&c.setAttribute(`placeholder`,n),c.setAttribute(`rows`,`2`),c.setAttribute(`value`,r);for(let e of[`remote`,`source`,`min-chars`,`debounce`]){let t=this.getAttribute(e);t!=null&&c.setAttribute(e,t)}let l=s.createElement(`div`);l.className=`wui-comment-form-actions`,l.append(this._button(`primary`,`solid`,`sm`,`send`,i),this._button(`primary`,`ghost`,`sm`,`cancel`,a.cancel));let u=s.createElement(`div`);u.className=`wui-comment-error`,u.setAttribute(`data-wui-error`,``),u.hidden=!0,e.replaceChildren(c,l,u),this._handPeople(c),e.hidden=!1,this._openers??=/* @__PURE__ */ new WeakMap,this._openers.set(e,o),c.focus();let d=c.querySelector(`textarea`);d?.setSelectionRange(d.value.length,d.value.length)}_button(n,r,i,a,o){let s=this.ownerDocument.createElement(`button`);return s.type=`button`,s.className=e(n,r,i),s.dataset.wui=t,s.setAttribute(`data-wui-action`,a),s.textContent=o,s}_closeSlot(e,t){if(!e||e.hidden)return;if(e.hidden=!0,e.replaceChildren(),e.hasAttribute(`data-wui-editor`)){let t=x(e.parentElement,`:scope > [data-wui-text]`,HTMLElement);t&&(t.hidden=!1)}let n=this._openers?.get(e);t&&n?.isConnected&&n.focus()}_askDelete(e){let t=x(e,`:scope > .wui-comment-row`,HTMLElement),n=x(t,`[data-wui-confirm]`,HTMLElement),r=x(t,`[data-wui-actions]`,HTMLElement);n&&(n.hidden=!1,r&&(r.hidden=!0),x(n,`[data-wui-action="cancel-delete"]`,HTMLElement)?.focus())}_closeConfirm(e,t){let n=x(e,`:scope > .wui-comment-row`,HTMLElement),r=x(n,`[data-wui-confirm]`,HTMLElement),i=x(n,`[data-wui-actions]`,HTMLElement);r&&(r.hidden=!0),i&&(i.hidden=!1),t&&x(i,`[data-wui-action="delete"]`,HTMLElement)?.focus()}_openPicker(e,t){let n=x(this,p,HTMLElement);n&&e&&!this.hasAttribute(`no-reactions`)&&(this._closePicker(!1),this._pickerFor={comment:e,button:t},t.setAttribute(`aria-expanded`,`true`),c(t,n,{mode:`auto`,onClosed:()=>this._pickerClosed()}),x(n,`[data-wui-emoji]`,HTMLElement)?.focus())}_closePicker(e){let t=this._pickerFor;if(!t)return;let n=x(this,p,HTMLElement);n&&s(n),this._pickerClosed(),e&&t.button.isConnected&&t.button.focus()}_pickerClosed(){let e=x(this,p,HTMLElement),t=this._pickerFor;!t||e&&l(e)||(this._pickerFor=null,t.button.setAttribute(`aria-expanded`,`false`))}_react(e,t){t&&!this.hasAttribute(`no-reactions`)&&this._send(`react`,{commentId:e.getAttribute(`data-wui-comment`),emoji:t},{comment:e,scope:e})}_sendFrom(e){let t=S(e,`[data-wui-reply], [data-wui-editor], [data-wui-composer]`,HTMLElement);if(!t)return;let n=t.querySelector(`wui-mention-input`),r=n?.value??``;if(!r.trim()){this._showError(t,a.emptyBody),n?.focus();return}let i=t.closest(h);t.hasAttribute(`data-wui-composer`)?this._send(`post`,{body:r},{scope:t,form:t}):t.hasAttribute(`data-wui-reply`)?this._send(`reply`,{parentId:b(i,`comment`).getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t}):this._send(`edit`,{commentId:b(i,`comment`).getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t})}async _send(e,t,{comment:n,scope:r,form:i}){if(this._busy)return;this._busy=!0,this.setAttribute(`aria-busy`,`true`);let o=i??x(n,`:scope > .wui-comment-row`,HTMLElement)??this;this._showError(o,null);let s=[...r.querySelectorAll(`button, textarea`)].filter(e=>e instanceof HTMLButtonElement||e instanceof HTMLTextAreaElement).filter(e=>!e.disabled);for(let e of s)e.disabled=!0;let c=await this._persist({intent:e,...t});for(let e of s)e.isConnected&&(e.disabled=!1);this._busy=!1,this.removeAttribute(`aria-busy`);let l=t.commentId??null,u=t.parentId??null;c.ok?(c.html!=null&&this._swapItems(c.html),e===`post`?i?.querySelector(`wui-mention-input`)?.clear():i?.isConnected&&this._closeSlot(i,!1),e===`delete`&&n?.isConnected&&this._closeConfirm(n,!1),this._restoreFocus(e,t,i),a.done[e]&&this._announce(a.done[e]),this.dispatchEvent(new CustomEvent(`wui:comment-thread:done`,{bubbles:!0,detail:{intent:e,commentId:l,parentId:u}}))):c.kind!==`session`&&c.kind!==`aborted`&&(this._showError(o.isConnected?o:this,c.message),this._announce(c.message),this.dispatchEvent(new CustomEvent(`wui:comment-thread:failed`,{bubbles:!0,detail:{intent:e,kind:c.kind,message:c.message}})))}async _persist(e){if(this.hasAttribute(`controlled`)){if(typeof this.submit!=`function`)return{ok:!0,html:null};try{return await this.submit(e),{ok:!0,html:null}}catch(e){return{ok:!1,kind:`server`,message:_(e)}}}let t=this.getAttribute(`action`);if(!t)return{ok:!1,kind:`client`,message:r};let n=new URLSearchParams;for(let[t,r]of Object.entries(e))r!=null&&n.set(t,r);let i=await u(t,{method:`POST`,body:n});return i.ok?{ok:!0,html:i.html}:{ok:!1,kind:i.kind,message:i.message||a.failed[i.kind]||`Something went wrong on our side. Try again in a moment.`}}_swapItems(e){let t=x(this,f,HTMLElement);if(!t||!e.trim())return;let n=this.ownerDocument.createElement(`template`);n.innerHTML=e;let r=x(n.content,f,HTMLElement);t.replaceChildren(...r?r.childNodes:n.content.childNodes)}_restoreFocus(e,t,n){let r=this.ownerDocument,i=r.activeElement;if(i&&i!==r.body&&i.isConnected&&this.contains(i)&&!y(i))return;let a=e=>e?C(this,h,HTMLElement).find(t=>t.getAttribute(`data-wui-comment`)===e):null,o=e=>x(a(e),`:scope > .wui-comment-row`,HTMLElement),s=null;if(e===`post`)s=n?.querySelector(`textarea`);else if(e===`reply`)s=x(o(t.parentId),`[data-wui-action="reply"]`,HTMLElement);else if(e===`edit`)s=x(o(t.commentId),`[data-wui-action="edit"]`,HTMLElement);else if(e===`react`){let e=o(t.commentId);s=C(e,`button[data-wui-emoji]`,HTMLButtonElement).find(e=>e.getAttribute(`data-wui-emoji`)===t.emoji)??x(e,`[data-wui-action="react-menu"]`,HTMLElement)}s??=x(this,`${m} textarea`,HTMLTextAreaElement),s?.focus()}_showError(e,t){let n=x(e,`:scope > [data-wui-error], :scope > .wui-comment-main > [data-wui-error]`,HTMLElement);n&&(n.textContent=t||``,n.hidden=!t)}_announce(e){let t=x(this,`:scope > ${g}`,HTMLElement);t&&e&&(t.textContent=``,t.textContent=e)}};export{w as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./buttonClass-GtEi8hAY.js";import{n}from"./devWarn-DXdRWZs3.js";import{t as r}from"./elementBase-Cxeyx0tU.js";import{t as i}from"./tourOpenMark-nPeAJFSo.js";var a={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-surface":`#FFFFFF`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-fixed":`1030`},o=e=>`var(${e}, ${a[e]})`,s=` :host { all: initial; position: fixed; bottom: 20px; left: 20px; right: auto; z-index: ${o(`--wui-z-fixed`)}; display: block; width: 420px; max-width: calc(100vw - 40px); font-family: inherit; font-size: 16px; line-height: 1.5; color: ${o(`--color-text`)}; } :host([position="bottom-right"]) { right: 20px; left: auto; } :host([position="bar"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } :host([position="bar"]) .wui-consent-banner-panel { padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } :host(:not([open])) { pointer-events: none; } :host([tour-open]) { visibility: hidden; } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .wui-consent-banner-panel { padding: 20px; background: ${o(`--color-surface`)}; border: 1px solid ${o(`--color-border`)}; border-radius: ${o(`--wui-radius-lg`)}; box-shadow: ${o(`--wui-shadow-modal`)}; text-align: start; pointer-events: auto; } .wui-consent-banner-heading { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: ${o(`--color-text`)}; } .wui-consent-banner-description { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: ${o(`--color-text-muted`)}; } .wui-consent-banner-policy { color: ${o(`--color-primary-text`)}; font-weight: 500; } .wui-consent-banner-settings { display: grid; gap: 12px; max-height: 50vh; margin: 0 0 16px; padding: 12px 0; overflow-y: auto; border-top: 1px solid ${o(`--color-border`)}; border-bottom: 1px solid ${o(`--color-border`)}; } .wui-consent-banner-category-description { margin: 2px 0 0; padding-inline-start: 2.5em; font-size: 12px; line-height: 1.4; color: ${o(`--color-text-muted`)}; } .form-check { display: flex; align-items: center; gap: 0.5em; margin: 0; font-size: 14px; } .form-check-input { appearance: none; flex: none; width: 2em; height: 1em; margin: 0; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 2em; background: ${o(`--color-surface`)} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat; cursor: pointer; transition: background-position 0.15s ease-in-out; } .form-check-input:checked { border-color: ${o(`--color-primary`)}; background: ${o(`--color-primary`)} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat; } .form-check-input:disabled { opacity: 0.5; cursor: default; } .form-check-input:focus-visible { outline: 2px solid ${o(`--color-primary`)}; outline-offset: 2px; } .form-check-label { cursor: pointer; } .wui-consent-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; } .btn { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid ${o(`--color-primary`)}; outline-offset: 2px; } .btn-primary { background: ${o(`--color-primary`)}; border-color: ${o(`--color-primary`)}; color: ${o(`--color-on-primary`)}; } .btn-primary:hover { background: ${o(`--color-primary-hover`)}; border-color: ${o(`--color-primary-hover`)}; } .btn-outline-neutral { border-color: ${o(`--color-text-muted`)}; color: ${o(`--color-text-muted`)}; } .btn-outline-neutral:hover { background: ${o(`--color-bg-muted`)}; color: ${o(`--color-text`)}; } .btn-link { font-weight: 400; color: ${o(`--color-primary-text`)}; text-decoration: underline; } .btn-link:hover { color: ${o(`--color-primary-hover`)}; } .wui-consent-banner-settings-toggle { margin-inline-end: auto; padding-inline: 0; } .wui-consent-banner-save { flex: 1 1 100%; } @media (max-width: 575.98px) { :host, :host([position="bottom-right"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } .wui-consent-banner-panel { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } /* Hidden on phones, but it stays the dialog's accessible name. */ .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } .wui-consent-banner-description { margin: 0 0 8px; font-size: 13px; line-height: 1.4; } .wui-consent-banner-actions { gap: 6px; } } @media (min-width: 576px) { :host([position="bar"]) .wui-consent-banner-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; } /* Hidden on the bar, but it stays the dialog's accessible name. */ :host([position="bar"]) .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } :host([position="bar"]) .wui-consent-banner-description { margin: 0; flex: 1 1 320px; } :host([position="bar"]) .wui-consent-banner-actions { flex: none; } :host([position="bar"]) .wui-consent-banner-settings { flex-basis: 100%; margin: 0; } } /* The actions are small buttons, which fall under the 44px touch target on touch screens. This sheet's .btn is inline-block, so it centres the label itself. */ @media (max-width: 575.98px), (pointer: coarse) { .wui-consent-banner-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } `,c=`wui-consent-save`,l=`[data-consent-settings]`,u=`tour-open`,d=`--wui-consent-banner-block`,f=`--wui-consent-banner-inline`,p={heading:`Cookies on this site`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,policyLabel:`Cookie policy`,essentialLabel:`Essential cookies`,essentialDescription:`Required for the site to work and stay secure. Always on.`,analyticsLabel:`Analytics cookies`,analyticsDescription:`Help us understand how visitors use the site.`,functionalLabel:`Functional cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,marketingLabel:`Marketing cookies`,marketingDescription:`Measure how well our campaigns work.`,settingsLabel:`Cookie settings`,rejectLabel:`Reject all`,acceptLabel:`Accept all`,saveLabel:`Save preferences`},m=[`analytics`,`functional`,`marketing`],h={analytics:{label:p.analyticsLabel,description:`analyticsDescription`},functional:{label:p.functionalLabel,description:`functionalDescription`},marketing:{label:p.marketingLabel,description:`marketingDescription`}};function g(e){return m.some(t=>t===e)}var _=/* @__PURE__ */ new Set;function v(e){_.has(e)||(_.add(e),n(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${m.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var y=0,b=null;function x(e){b||(b=new CSSStyleSheet,b.replaceSync(s)),e.adoptedStyleSheets=[b]}var S=class extends r{_uid;_preferences;_settings;_onDocumentClick;_tourWatch;_roomObserver;_onWindowResize;_rendered;static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),y+=1,this._uid=`wui-consent-${y}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(l)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null,this._roomObserver=null,this._onWindowResize=()=>this._reserveRoom()}get position(){let e=this.getAttribute(`position`);return e===`bottom-right`||e===`bar`?e:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get preview(){return this.hasAttribute(`preview`)}set preview(e){this.toggleAttribute(`preview`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||p.heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||p.description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||p.policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||p.analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||p.functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||p.marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...m];let t=e.split(/\s+/).filter(Boolean);for(let e of t)g(e)||v(e);let n=m.filter(e=>t.includes(e));return n.length?n:[...m]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(m.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[i]}),this.preview&&!this.isOpen&&this.open(),this.isOpen&&this._trackRoom()}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect(),this._untrackRoom()}_syncTour(){this.toggleAttribute(u,document.documentElement.hasAttribute(i))}attributeChangedCallback(){this._rendered&&this.render()}render(){let n=this.isOpen,r=this._uid,i=this.policyHref?` <a class="wui-consent-banner-policy" href="${T(this.policyHref)}">${w(this.policyLabel)}</a>`:``,a=this._root();a instanceof ShadowRoot&&x(a),a.innerHTML=` <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${r}-heading" aria-describedby="${r}-description" hidden> <h2 class="wui-consent-banner-heading" id="${r}-heading">${w(this.heading)}</h2> <p class="wui-consent-banner-description" id="${r}-description">${w(this.description)}${i}</p> <div class="wui-consent-banner-settings" hidden> ${C(r,`essential`,p.essentialLabel,p.essentialDescription,!0)} ${this.categories.map(e=>C(r,e,h[e].label,this[h[e].description],!1)).join(` `)} </div> <div class="wui-consent-banner-actions"> <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${p.settingsLabel}</button> <button type="button" class="${e(`neutral`,`outline`,`sm`)} wui-consent-banner-reject" data-wui="${t}">${p.rejectLabel}</button> <button type="button" class="${e(`primary`,`solid`,`sm`)} wui-consent-banner-accept" data-wui="${t}">${p.acceptLabel}</button> <button type="button" class="${e(`primary`,`solid`,`sm`)} wui-consent-banner-save" hidden data-wui="${t}">${p.saveLabel}</button> </div> </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),n&&(this._requirePanel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){if(this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._requirePanel().hidden=!1,this.setAttribute(`open`,``),this._trackRoom(),t){let t=e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`);t instanceof HTMLElement&&t.focus()}}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1),this._untrackRoom()}_trackRoom(){this.isConnected&&!this.preview&&(typeof ResizeObserver<`u`&&(this._roomObserver??=new ResizeObserver(()=>this._reserveRoom()),this._roomObserver.observe(this)),window.addEventListener(`resize`,this._onWindowResize),this._reserveRoom())}_untrackRoom(){this._roomObserver?.disconnect(),window.removeEventListener(`resize`,this._onWindowResize),document.documentElement.style.removeProperty(d),document.documentElement.style.removeProperty(f)}_reserveRoom(){let e=this.getBoundingClientRect(),t=this.position===`bar`?0:this.position===`bottom-right`?window.innerWidth-e.left:e.right,n=document.documentElement.style;n.setProperty(d,`${Math.ceil(window.innerHeight-e.top)}px`),n.setProperty(f,`${Math.ceil(t)}px`)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){let e=this._root().querySelector(`.wui-consent-banner-panel`);return e instanceof HTMLElement?e:null}_requirePanel(){let e=this._panel();if(!e)throw Error(`consent banner panel is missing`);return e}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(c,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return{analytics:e&&t.includes(`analytics`),functional:e&&t.includes(`functional`),marketing:e&&t.includes(`marketing`)}}_switchValues(){let e={analytics:!1,functional:!1,marketing:!1};for(let t of m){let n=this._root().querySelector(`input[data-category="${t}"]`);e[t]=n instanceof HTMLInputElement&&n.checked}return e}_applyPreferences(){for(let e of m){let t=this._root().querySelector(`input[data-category="${e}"]`);t instanceof HTMLInputElement&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!(n instanceof HTMLElement))return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r instanceof HTMLElement&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r instanceof HTMLElement&&(r.hidden=e)}}};function C(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} /> <label class="form-check-label" for="${a}">${w(n)}</label> </div> <p class="wui-consent-banner-category-description">${w(r)}</p> </div>`}var w=e=>String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),T=e=>String(e??``).replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`);export{S as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";import{t}from"./imeSafeEnter-DPs9qL3S.js";import{t as n}from"./menuKeyNav-COGecOjH.js";import{a as r,l as i,s as a}from"./nativeOverlay-BbkCnzFj.js";var o=`[role="menuitem"]`,s=`.wui-context-menu-sub`,c=`input.wui-context-menu-search`,l=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,u=500,d=10,f=400,p=null,m=null,h=0;function g(e,t,n){let r=document.createElement(`span`);return r.setAttribute(`aria-hidden`,`true`),r.style.cssText=n?`position:absolute;left:${e+window.scrollX}px;top:${t+window.scrollY}px;width:0;height:0;`:`position:fixed;left:${e}px;top:${t}px;width:0;height:0;`,document.body.append(r),r}var _=/* @__PURE__ */ new WeakMap;function v(e,t,n){let r=_.get(e);if(r){if(r.region===t||t.contains(r.region))return!1;r.cancel()}return _.set(e,{region:t,cancel:n}),!0}var y=e=>e instanceof Element?e:e instanceof Node?e.parentElement:null,b=e=>`focus`in e,x=e=>[...e.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE||e instanceof Element&&!e.matches(`.wui-context-menu-hint, .wui-context-menu-tick`)).map(e=>e.textContent).join(``),S=(e,t)=>[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement),C=e=>[...e.children].filter(e=>e instanceof HTMLElement),w=(e,t)=>{let n=e.children[t];if(!(n instanceof HTMLElement))throw Error(`a submenu holds its opener and then its panel`);return n},T=e=>w(e,0),E=e=>w(e,1),D=(e,t)=>{let n=e?.closest(t);return n instanceof HTMLElement?n:null},O=class extends e{_region;_origin;_returnFocus;_press;_swallowClick;_unbindKeys;_anchor;_closingByKey;_onContextMenu;_onContextMenuCapture;_onDocKeyDown;_onDocClick;_onPointerDown;_onPressMove;_onPressEnd;_onClickCapture;_onKeyDown;_onClick;_onInput;_onMouseMove;_onDismiss;_onPointerDownCapture;static get observedAttributes(){return[`disabled`,`open`]}constructor(){super(),this._region=null,this._origin=null,this._returnFocus=null,this._press=null,this._swallowClick=!1,this._unbindKeys=null,this._anchor=null,this._closingByKey=!1,this._onContextMenu=e=>this._handleContextMenu(e),this._onContextMenuCapture=e=>{this.isOpen&&!this._inPanel(e.target)&&!this._isKeyEcho()&&this.close()},this._onDocKeyDown=e=>this._handleDocKeyDown(e),this._onDocClick=e=>this._handleDocClick(e),this._onPointerDown=e=>this._handlePointerDown(e),this._onPressMove=e=>{this._press&&Math.hypot(e.clientX-this._press.x,e.clientY-this._press.y)>d&&this._cancelPress()},this._onPressEnd=()=>this._cancelPress(),this._onClickCapture=e=>{if(this._swallowClick&&this._region){if(!(e.target instanceof Node))throw Error(`a click target is always a node`);this._region.contains(e.target)&&(this._swallowClick=!1,e.preventDefault(),e.stopImmediatePropagation())}},this._onKeyDown=e=>{if(this.isOpen&&this._inPanel(e.target)){if(e.key===`Escape`){if(e.stopPropagation(),this.hasAttribute(`open`)&&D(y(e.target),`[role="menu"]`)===this._panel()){e.preventDefault(),this.close(!0);return}this._closingByKey=!0}this._handleMenuKey(e)}},this._onClick=e=>this._handleClick(e),this._onInput=e=>this._handleInput(e),this._onMouseMove=e=>{let t=D(y(e.target),o);t&&this._inPanel(t)&&!this._isDisabled(t)&&t!==document.activeElement&&t.focus({preventScroll:!0})},this._onDismiss=e=>{this.hasAttribute(`open`)||e.type===`scroll`&&this._inPanel(e.target)||this.close()},this._onPointerDownCapture=()=>{this._swallowClick=!1}}connectedCallback(){this._teardown(),document.addEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.addEventListener(`contextmenu`,this._onContextMenu),document.addEventListener(`keydown`,this._onDocKeyDown),document.addEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.addEventListener(`pointerdown`,this._onPointerDown),document.addEventListener(`click`,this._onClickCapture,!0),document.addEventListener(`click`,this._onDocClick),window.addEventListener(`keydown`,this._onKeyDown,!0),this.addEventListener(`click`,this._onClick),this.addEventListener(`input`,this._onInput),this.addEventListener(`mousemove`,this._onMouseMove),this._syncOpen()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){e===`open`?this.isConnected&&this._syncOpen():this.disabled&&this.close()}get target(){return this.getAttribute(`target`)}set target(e){e==null||e===``?this.removeAttribute(`target`):this.setAttribute(`target`,String(e))}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get isOpen(){let e=this._panel();return!!e&&a(e)}open(e,t,{region:r=this,origin:a=r,trigger:o=null,keyboard:s=!1}={}){let c=this._panel();if(!c)return!1;let l=new CustomEvent(`wui-context-menu:beforeopen`,{bubbles:!0,cancelable:!0,detail:{region:r,origin:a,trigger:o}});if(this.dispatchEvent(l),l.defaultPrevented)return!1;if(this._decorate(c),p&&p!==this&&p.close(!0),!this.isOpen){let e=document.activeElement;this._returnFocus=e&&e!==document.body&&!this._inPanel(e)&&b(e)?e:null}this._region=r,this._origin=a,m=null,p=this,this._unbindKeys?.(),this._unbindKeys=n(c,{items:()=>this._menuRows()}),this._anchor?.remove();let u=this.hasAttribute(`open`);return this._anchor=g(e,t,u),i(this._anchor,c,{mode:u?`manual`:`auto`,keepOffscreen:u,clampHeight:!0,onClosed:()=>this._onPanelClosed()}),window.addEventListener(`scroll`,this._onDismiss,!0),window.addEventListener(`resize`,this._onDismiss),window.addEventListener(`blur`,this._onDismiss),((s?this._rowsOf(c)[0]:null)??c).focus({preventScroll:!0}),this.dispatchEvent(new CustomEvent(`wui-context-menu:open`,{bubbles:!0,detail:{region:r,origin:a,x:e,y:t}})),!0}_syncOpen(){if(!this.hasAttribute(`open`)){this.close(this._inPanel(document.activeElement));return}let e=this.target?document.querySelector(this.target):this,t=e&&this._regionRect(e);e&&t&&this.open(t.left,t.top,{region:e,origin:e})}_regionRect(e){if(e!==this)return e.getBoundingClientRect();let t=[...this.children].filter(e=>e!==this._panel()).map(e=>e.getBoundingClientRect());return t.length?{left:Math.min(...t.map(e=>e.left)),top:Math.min(...t.map(e=>e.top))}:null}close(e=!1){let t=this._panel();t&&a(t)&&(e&&(this._closingByKey=!0),r(t))}_finish(e){let t=this._panel();if(t)for(let e of S(t,s))this._setSub(e,!1);p===this&&(p=null),window.removeEventListener(`scroll`,this._onDismiss,!0),window.removeEventListener(`resize`,this._onDismiss),window.removeEventListener(`blur`,this._onDismiss),this._unbindKeys?.(),this._unbindKeys=null,this._anchor?.remove(),this._anchor=null;let n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&n.focus({preventScroll:!0})}_onPanelClosed(){let e=this._panel();if(!e||a(e))return;let t=this._closingByKey;this._closingByKey=!1,this._finish(t)}_menuRows(){let e=y(document.activeElement);if(!e||e.matches(c))return[];let t=D(e,`[role="menu"]`);return t?this._rowsOf(t):[]}_panel(){return C(this).find(e=>e.getAttribute(`role`)===`menu`)??null}_inPanel(e){return e instanceof Node&&!!this._panel()?.contains(e)}_rowsOf(e){return e?S(e,o).filter(t=>t.closest(`[role="menu"]`)===e&&!this._isDisabled(t)&&!t.closest(`[hidden]`)):[]}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_regionFor(e){let t=y(e);if(!t||this.disabled||!this._panel()||this._inPanel(t)||t.closest(l))return null;let n=this.target;return n?t.closest(n):this.contains(t)?this:null}_triggerFor(e){let t=y(e),n=this.getAttribute(`trigger`);if(!t||!n||this._inPanel(t))return null;let r=D(t,n),i=r&&this._regionFor(r);return r&&i?{trigger:r,region:i}:null}_isKeyEcho(){return m?.menu===this&&this.isOpen&&performance.now()-m.at<f}_handleContextMenu(e){if(this._inPanel(e.target)){e.preventDefault();return}if(e.defaultPrevented&&!_.has(e))return;let t=this._regionFor(e.target);t&&(this._isKeyEcho()?e.preventDefault():e.shiftKey||v(e,t,()=>this.close(!0))&&this.open(e.clientX,e.clientY,{region:t,origin:y(e.target)})&&e.preventDefault())}_handleDocKeyDown(e){if(e.defaultPrevented&&!_.has(e))return;if(t(e)){let t=this._triggerFor(e.target);if(!t||!v(e,t.region,()=>this.close(!0)))return;e.preventDefault(),t.trigger.click();return}if(!(e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)||this._inPanel(e.target))return;let n=this._regionFor(e.target);if(!n||!v(e,n,()=>this.close(!0)))return;let r=y(e.target);if(!r)return;let i=r.getBoundingClientRect();this.open(i.left+Math.min(16,i.width/2),i.bottom,{region:n,origin:r,keyboard:!0})&&(e.preventDefault(),m={menu:this,at:performance.now()})}_handleDocClick(e){let t=this._triggerFor(e.target);if(!t||!v(e,t.region,()=>this.close(!0)))return;let n=t.trigger.getBoundingClientRect();this.open(n.left,n.bottom,{region:t.region,origin:t.trigger,trigger:t.trigger,keyboard:e.detail===0})}_handlePointerDown(e){if(e.pointerType!==`touch`)return;let t=this._regionFor(e.target);if(!t||!v(e,t,()=>this._cancelPress()))return;this._cancelPress();let{clientX:n,clientY:r}=e,i=y(e.target);this._press={x:n,y:r,timer:setTimeout(()=>{this._cancelPress(),this.open(n,r,{region:t,origin:i})&&(this._swallowClick=!0)},u)},document.addEventListener(`pointermove`,this._onPressMove,{passive:!0}),document.addEventListener(`pointerup`,this._onPressEnd),document.addEventListener(`pointercancel`,this._onPressEnd),window.addEventListener(`scroll`,this._onPressEnd,!0)}_cancelPress(){this._press&&(clearTimeout(this._press.timer),this._press=null,document.removeEventListener(`pointermove`,this._onPressMove),document.removeEventListener(`pointerup`,this._onPressEnd),document.removeEventListener(`pointercancel`,this._onPressEnd),window.removeEventListener(`scroll`,this._onPressEnd,!0))}_handleMenuKey(e){if(!this.isOpen)return;let n=y(e.target);if(!n)return;if(n.matches(c)){this._handleSearchKey(e,n);return}let r=D(n,`[role="menu"]`);if(!r)return;let i=D(n,o),a=r.matches(`.wui-context-menu-subpanel`)?r.parentElement:null;if(e.key===`Tab`)this.close(!0);else if(e.key===`ArrowRight`){let t=i&&this._subOf(i);if(!t)return;e.preventDefault(),this._openSub(t,!0)}else if(e.key===`ArrowLeft`){if(!a)return;e.preventDefault(),this._closeSubByKey(a)}else(t(e)||e.key===` `)&&(e.preventDefault(),i?.click())}_handleSearchKey(e,t){let n=D(t,s);if(!n)return;let r=this._rowsOf(E(n));e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closeSubByKey(n)):e.key===`ArrowDown`?(e.preventDefault(),r[0]?.focus({preventScroll:!0})):e.key===`ArrowUp`?(e.preventDefault(),r[r.length-1]?.focus({preventScroll:!0})):e.key===`Tab`&&this.close(!0)}_subOf(e){return e.hasAttribute(`aria-haspopup`)&&e.parentElement?.matches(s)?e.parentElement:null}_openSub(e,t){let n=e.parentElement;if(!n)throw Error(`a submenu is always inside its menu panel`);for(let t of C(n))t!==e&&t.matches(s)&&this._closeSub(t);this._setSub(e,!0);let r=E(e).querySelector(`:scope > ${c}`),i=e.hasAttribute(`data-searchable`)&&r instanceof HTMLInputElement?r:null;i?(i.value=``,this._filter(e,``),i.focus({preventScroll:!0})):t&&this._rowsOf(E(e))[0]?.focus({preventScroll:!0})}_closeSub(e){for(let t of S(E(e),s))this._setSub(t,!1);this._setSub(e,!1)}_closeSubByKey(e){this._closeSub(e),T(e).focus({preventScroll:!0})}_setSub(e,t){let n=E(e);t?(i(T(e),n,{mode:`auto`,beside:!0,onClosed:()=>this._onSubClosed(e)}),T(e).setAttribute(`aria-expanded`,String(a(n)))):a(n)?r(n):this._onSubClosed(e)}_onSubClosed(e){let t=E(e);if(a(t))return;let n=T(e);n.setAttribute(`aria-expanded`,`false`),t.removeAttribute(`data-side`);let r=this._closingByKey;this._closingByKey=!1,r&&n.focus({preventScroll:!0})}_filter(e,t){let n=t.trim().toLowerCase();for(let t of C(E(e)))t.tagName===`HR`?t.hidden=n!==``:t.matches(o)?t.hidden=n!==``&&!x(t).toLowerCase().includes(n):t.matches(s)&&(t.hidden=n!==``&&!x(T(t)).toLowerCase().includes(n))}_handleInput(e){let t=y(e.target)?.closest(c);if(!(t instanceof HTMLInputElement))return;let n=D(t,s);n?.hasAttribute(`data-searchable`)&&this._inPanel(n)&&this._filter(n,t.value)}_decorate(e){for(let t of S(e,o)){let e=t.getAttribute(`aria-checked`)===`true`,n=t.querySelector(`:scope > .wui-context-menu-tick`);if(e&&!n){let e=document.createElement(`span`);e.className=`wui-context-menu-tick`,e.setAttribute(`aria-hidden`,`true`),t.prepend(e)}else!e&&n&&n.remove();let r=t.querySelector(`:scope > .wui-context-menu-hint`),i=t.dataset.hint;if(i){let e=r??document.createElement(`span`);r||(e.className=`wui-context-menu-hint`,e.id=`wui-context-menu-hint-${++h}`,t.append(e)),e.textContent=i,t.setAttribute(`aria-describedby`,e.id)}else r&&(r.remove(),t.removeAttribute(`aria-describedby`))}}_handleClick(e){let t=D(y(e.target),o);if(!t||!this._inPanel(t))return;if(this._isDisabled(t)){e.preventDefault(),e.stopPropagation();return}let n=this._subOf(t);n?(e.preventDefault(),this._openSub(n,e.detail===0)):(this.close(!0),this.dispatchEvent(new CustomEvent(`wui-context-menu:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,region:this._region,origin:this._origin}})))}_teardown(){let e=this._panel();if(this._closingByKey=!1,e){for(let t of[...S(e,s)].reverse())r(E(t));r(e)}this._anchor&&this._finish(!1),this._cancelPress(),document.removeEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.removeEventListener(`contextmenu`,this._onContextMenu),document.removeEventListener(`keydown`,this._onDocKeyDown),document.removeEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.removeEventListener(`pointerdown`,this._onPointerDown),document.removeEventListener(`click`,this._onClickCapture,!0),document.removeEventListener(`click`,this._onDocClick),window.removeEventListener(`keydown`,this._onKeyDown,!0),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`input`,this._onInput),this.removeEventListener(`mousemove`,this._onMouseMove)}};export{O as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,M as t,S as n,T as r,_ as i,b as a,c as o,g as s,h as c,i as l,j as u,r as d,t as f}from"./dataTable-CcH1lBIM.js";import{t as p}from"./dom-Do1pAA12.js";import{t as m}from"./elementBase-Cxeyx0tU.js";import{t as h}from"./imeSafeEnter-DPs9qL3S.js";var g=`.wui-col-resize`,_=`.wui-group-row, .wui-virtual-spacer`,v=`.wui-select-cell, .wui-expand-cell`,y=`<svg class="wui-icon" data-icon="chevron-down" data-wui="AppIcon" width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.5" d="M19.92 8.95l-6.52 6.52c-.77.77-2.03.77-2.8 0L4.08 8.95"></path></svg>`;function b(e){if(e==null)throw TypeError(`Missing DOM node`);return e}function x(e,t){if(e instanceof t)return e;throw TypeError(`Missing DOM node`)}var S=e=>{let t=p(e,g);return t instanceof HTMLElement?t:null},C=e=>e.hasAttribute(`data-wui-skeleton`)||!!e.querySelector(`:scope > td > .skeleton`),w=class extends m{_frame;_headDirty;_rowsDirty;_frozenSig;_natural;_widths;_collapsed;_groupOrder;_items;_range;_drag;_userSized;_swallowClick;_mo;_ro;_fonts;_onPointerDown;_onKeyDown;_onClick;_onDblClick;_onScroll;_onFonts;_top=null;_bottom=null;_rowHeight=0;constructor(){super(),this._frame=0,this._headDirty=!0,this._rowsDirty=!0,this._frozenSig=null,this._natural=[],this._widths={},this._collapsed=/* @__PURE__ */ new Set,this._groupOrder=[],this._items=[],this._range=null,this._drag=null,this._userSized=!1,this._swallowClick=!1,this._mo=null,this._ro=null,this._fonts=null,this._onPointerDown=e=>this._startDrag(e),this._onKeyDown=e=>this._key(e),this._onClick=e=>this._click(e),this._onDblClick=e=>{let t=S(e.target);t&&this.contains(t)&&this._reset(t.closest(`th`))},this._onScroll=()=>{this.hasAttribute(`virtual`)&&this._schedule()},this._onFonts=()=>{this._userSized||this._drag||this._frozenSig===null||!this.hasAttribute(`resizable`)||(this._frozenSig=null,this._schedule())}}connectedCallback(){this._widths=r(this.getAttribute(`view-key`)),this.addEventListener(`pointerdown`,this._onPointerDown,!0),this.addEventListener(`keydown`,this._onKeyDown,!0),this.addEventListener(`click`,this._onClick,!0),this.addEventListener(`dblclick`,this._onDblClick),this.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._fonts=this.ownerDocument.fonts??null,this._fonts?.addEventListener(`loadingdone`,this._onFonts),typeof MutationObserver<`u`&&(this._mo=new MutationObserver(e=>this._mutated(e)),this._mo.observe(this,{childList:!0,subtree:!0})),typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._schedule()),this._ro.observe(this)),this._headDirty=!0,this._rowsDirty=!0,this._schedule()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown,!0),this.removeEventListener(`keydown`,this._onKeyDown,!0),this.removeEventListener(`click`,this._onClick,!0),this.removeEventListener(`dblclick`,this._onDblClick),this.removeEventListener(`scroll`,this._onScroll),this._fonts?.removeEventListener(`loadingdone`,this._onFonts),this._fonts=null,this._mo?.disconnect(),this._ro?.disconnect(),this._mo=null,this._ro=null,this._frame&&cancelAnimationFrame(this._frame),this._frame=0,this._drag=null}refresh(){this._headDirty=!0,this._rowsDirty=!0,this._run()}get _table(){let e=this.querySelector(`:scope > table`);return e instanceof HTMLTableElement?e:null}_headCells(e){let t=e.tHead?.rows[0];return t?[...t.cells]:[]}_schedule(){this._frame||=requestAnimationFrame(()=>{this._frame=0,this._run()})}_mutated(e){for(let t of e){let e=t.target instanceof Element?t.target:t.target.parentElement;e&&((e.closest(`thead`)||e===this._table||e===this)&&(this._headDirty=!0),(e.closest(`tbody, tfoot`)||e===this._table||e===this)&&(this._rowsDirty=!0))}this._schedule()}_run(){let e=this._table;if(!e)return;let t=this._headDirty,n=this._rowsDirty;this._headDirty=!1,this._rowsDirty=!1,n&&this.hasAttribute(`group-by`)&&this._group(e),this._pins(e,t||n),this.hasAttribute(`resizable`)&&(t&&this._handles(e),this._layout(e)),this.hasAttribute(`virtual`)&&this._virtual(e,t||n),this._mo?.takeRecords()}_pins(t,r){let i=this._headCells(t),o=i.map(e=>{let t=e.dataset.pin;return t===`start`||t===`end`?t:e.matches(v)?`lead`:null});if(!o.some(e=>e===`start`||e===`end`))return;let s=e(o);s.forEach((e,t)=>{e&&this._ro?.observe(b(i[t]))});let c=e=>b(i[e]).getBoundingClientRect().width,u=0;s.forEach((e,r)=>{e?.side===`start`&&(this._setVar(t,n(`start`,e.ordinal),u),u+=c(r))}),u=0;for(let e=s.length-1;e>=0;e--){let r=s[e];r?.side===`end`&&(this._setVar(t,n(`end`,r.ordinal),u),u+=c(e))}if(r)for(let e of t.rows)e.matches(`${_}, .wui-row-expanded`)||e.cells.length!==i.length||s.forEach((t,n)=>{if(!t)return;let r=b(e.cells[n]);r.classList.contains(`wui-pin-${t.side}`)||r.classList.add(`wui-pin-${t.side}`),t.edge&&!r.classList.contains(`wui-pin-${t.side}-edge`)&&r.classList.add(`wui-pin-${t.side}-edge`);let i=a(t.side,t.ordinal);r.style.getPropertyValue(`--wui-pin-at`)!==i&&r.style.setProperty(l,i)})}_setVar(e,t,n){let r=`${Math.round(n*100)/100}px`;e.style.getPropertyValue(t)!==r&&e.style.setProperty(t,r)}_resizable(e){return e.map((t,n)=>n<e.length-1&&!t.matches(v))}_handles(e){let t=this._headCells(e),n=this._resizable(t);t.forEach((e,t)=>{if(!n[t]||e.querySelector(g))return;let r=e.ownerDocument.createElement(`span`);r.className=`wui-col-resize`,r.setAttribute(`role`,`separator`),r.setAttribute(`aria-orientation`,`vertical`),r.setAttribute(`aria-valuemin`,`48`),r.setAttribute(`aria-valuemax`,String(f)),r.setAttribute(`tabindex`,`0`);let i=(e.textContent??``).trim();r.setAttribute(`aria-label`,d.resize(i)),i&&!e.hasAttribute(`aria-label`)&&e.setAttribute(`aria-label`,i),e.classList.add(`wui-col-resizable`),e.appendChild(r)})}_hasRows(e){for(let t of e.tBodies)for(let e of t.rows)if(!e.matches(_)&&!C(e))return!0;return!1}_signature(e){return e.map(e=>e.dataset.key||(e.textContent??``).trim()).join(``)}_layout(e){let t=this._headCells(e),n=this._signature(t);t.length&&n!==this._frozenSig&&(this._hasRows(e)?this._freeze(e,t,n):this._applyRemembered(t))}_applyRemembered(e){for(let t of e){let e=t.dataset.key&&this._widths[t.dataset.key];e&&(t.style.width=`${e}px`);let n=t.querySelector(g);n&&this._handleValue(n,c(e||t.getBoundingClientRect().width))}}_freeze(e,t,n){e.style.tableLayout=``,e.style.width=``,e.removeAttribute(`data-wui-fixed`);for(let e of t)e.hasAttribute(`data-wui-width`)&&(e.style.width=``,e.removeAttribute(`data-wui-width`));this._natural=t.map(e=>e.getBoundingClientRect().width),t.forEach((e,n)=>{if(n===t.length-1||e.matches(v))return;let r=e.dataset.key&&this._widths[e.dataset.key];this._setWidth(e,r||this._natural[n])}),e.style.tableLayout=`fixed`,e.setAttribute(`data-wui-fixed`,``),this._frozenSig=n,this._fitTable(e,t)}_setWidth(e,t){let n=c(t);e.style.width=`${n}px`,e.setAttribute(`data-wui-width`,``);let r=e.querySelector(g);return r&&this._handleValue(r,n),n}_handleValue(e,t){e.setAttribute(`aria-valuenow`,String(t)),e.setAttribute(`aria-valuetext`,d.width(t))}_fitTable(e,t){let n=t.length-1,r=this._natural[n]||0;for(let e=0;e<n;e++)r+=Number.parseFloat(b(t[e]).style.width)||this._natural[e]||0;e.style.width=`max(100%, ${Math.round(r)}px)`}_ensureFrozen(e){let t=this._headCells(e),n=this._signature(t);return n!==this._frozenSig&&this._freeze(e,t,n),t}_resizeTo(e,t,n){let r=this._table;if(!r)return;let i=this._ensureFrozen(r);this._userSized=!0,this._setWidth(e,t),this._fitTable(r,i),n&&this._remember(e),this._pins(r,!1)}_remember(e){let n=e.dataset.key;n&&(this._widths={...this._widths,[n]:Number.parseFloat(e.style.width)},t(this.getAttribute(`view-key`),this._widths))}_reset(e){let n=this._table;if(!e||!n)return;let r=this._ensureFrozen(n);this._userSized=!0;let i=e.dataset.key;if(i&&i in this._widths){let{[i]:e,...n}=this._widths;this._widths=n,t(this.getAttribute(`view-key`),this._widths)}this._setWidth(e,this._natural[r.indexOf(e)]||0),this._fitTable(n,r),this._pins(n,!1)}_rtl(){return getComputedStyle(this).direction===`rtl`}_startDrag(e){let t=S(e.target);if(!t||!this.contains(t)||e.button!==0)return;e.preventDefault(),e.stopPropagation();let n=t.closest(`th`),r=this._table;if(!n||!r)return;this._ensureFrozen(r);let i={th:n,x:e.clientX,from:n.getBoundingClientRect().width,dir:this._rtl()?-1:1,moved:!1};this._drag=i,t.setPointerCapture?.(e.pointerId),t.classList.add(`is-dragging`);let a=e=>{let t=(e.clientX-i.x)*i.dir;Math.abs(t)>1&&(i.moved=!0),this._resizeTo(n,i.from+t,!1)},o=e=>{t.removeEventListener(`pointermove`,a),t.removeEventListener(`pointerup`,o),t.removeEventListener(`pointercancel`,o),t.classList.remove(`is-dragging`),this._drag=null,e.type===`pointercancel`?this._resizeTo(n,i.from,!1):i.moved&&this._remember(n),this._swallowClick=!0,setTimeout(()=>{this._swallowClick=!1},0)};t.addEventListener(`pointermove`,a),t.addEventListener(`pointerup`,o),t.addEventListener(`pointercancel`,o)}_key(e){let t=S(e.target);if(!t||!this.contains(t))return;let n=t.closest(`th`);if(h(e)||e.key===` `){e.preventDefault(),e.stopPropagation();return}if(e.key===`Home`){e.preventDefault(),e.stopPropagation(),this._reset(n);return}if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault(),e.stopPropagation();let r=this._table;if(!r)return;this._ensureFrozen(r);let i=b(n),a=e.shiftKey?50:10,o=e.key===`ArrowRight`!==this._rtl(),s=Number.parseFloat(i.style.width)||i.getBoundingClientRect().width;this._resizeTo(i,s+(o?a:-a),!0)}_click(e){let t=e.target instanceof Element&&e.target.closest(g)!==null;if(this._swallowClick||t){e.stopPropagation(),(t||this._swallowClick)&&e.preventDefault(),this._swallowClick=!1;return}if(!this.hasAttribute(`group-by`))return;let n=p(e.target,`.wui-group-toggle`)?.closest(`.wui-group-row`);if(!(n instanceof HTMLTableRowElement)||!this.contains(n))return;let r=n.dataset.groupKey;this._collapsed.has(r)?this._collapsed.delete(r):this._collapsed.add(r),this._showGroup(n,!this._collapsed.has(r));let i=this._table;i&&this.hasAttribute(`virtual`)&&(this._virtual(i,!0),this._mo?.takeRecords())}_group(e){let t=this.getAttribute(`group-by`),n=this._headCells(e),r=n.findIndex(e=>e.dataset.key===t);if(r<0)throw Error(`<wui-data-table group-by="${t}"> needs a header cell with data-key="${t}".`);let a=e.tBodies[0];if(!a)return;let o=[...a.rows].filter(e=>!e.matches(_));if(o.some(C))return;let c=this.ownerDocument,l=/* @__PURE__ */ new Map;for(let e of a.querySelectorAll(`:scope > tr.wui-group-row`))e instanceof HTMLTableRowElement&&l.set(e.dataset.groupKey,e);let u=this.closest(`[data-wui-server]`)?[]:this._groupOrder,f=i(o,e=>e.dataset.group??e.cells[r]?.textContent?.trim()??``,u);this._groupOrder=f.map(e=>e.key);let p=c.createDocumentFragment(),m=f.map(e=>{let t=l.get(e.key)??this._groupRow(c,e.key);return l.delete(e.key),x(t.querySelector(`.wui-group-cell`),HTMLTableCellElement).colSpan=n.length,x(t.querySelector(`.wui-group-count`),HTMLElement).textContent=s(e.items.length),x(t.querySelector(`.wui-group-rows`),HTMLElement).textContent=`, ${d.rows(e.items.length)}`,p.append(t,...e.items),[t,e.key]});for(let e of l.values())e.remove();a.insertBefore(p,this._bottom?.parentNode===a?this._bottom:null);for(let[e,t]of m)this._showGroup(e,!this._collapsed.has(t))}_groupRow(e,t){let n=e.createElement(`tr`);n.className=`wui-group-row`,n.dataset.groupKey=t;let r=e.createElement(`th`);r.className=`wui-group-cell`,r.scope=`rowgroup`;let i=e.createElement(`button`);i.type=`button`,i.className=`wui-group-toggle`,i.innerHTML=y;let a=e.createElement(`span`);a.className=`wui-group-label`,a.textContent=t;let o=e.createElement(`span`);o.className=`wui-group-count`,o.setAttribute(`aria-hidden`,`true`);let s=e.createElement(`span`);return s.className=`visually-hidden wui-group-rows`,i.append(a,o,s),r.append(i),n.append(r),n}_showGroup(e,t){if(e){e.querySelector(`.wui-group-toggle`)?.setAttribute(`aria-expanded`,String(t));for(let n=e.nextElementSibling;n&&!n.matches(_);n=n.nextElementSibling)n instanceof HTMLElement&&(n.hidden=!t)}}_spacer(e,t){if(t?.parentNode===e)return t;let n=e.ownerDocument,r=n.createElement(`tr`);return r.className=`wui-virtual-spacer`,r.setAttribute(`aria-hidden`,`true`),r.append(n.createElement(`td`)),r}_virtual(e,t){let n=e.tBodies[0];if(!n)return;if(t){this._top=this._spacer(n,this._top),this._bottom=this._spacer(n,this._bottom),n.firstElementChild!==this._top&&n.insertBefore(this._top,n.firstChild),n.lastElementChild!==this._bottom&&n.append(this._bottom);let t=Math.max(1,this._headCells(e).length);b(this._top.cells[0]).colSpan=t,b(this._bottom.cells[0]).colSpan=t,this._items=[...n.rows].filter(e=>!e.classList.contains(`wui-virtual-spacer`)&&!e.hidden),this._range=null,e.setAttribute(`aria-rowcount`,String(this._items.length+1)),e.tHead?.rows[0]?.setAttribute(`aria-rowindex`,`1`),this._items.forEach((e,t)=>{e.setAttribute(`aria-rowindex`,String(t+2))}),this._rowHeight>0||(this._rowHeight=this._measureRow(e))}let r=e.tHead?.getBoundingClientRect().height||0,i=u({scrollTop:this.scrollTop-r,viewport:this.clientHeight,rowHeight:this._rowHeight,count:this._items.length}),a=this._range;if(a&&a.start===i.start&&a.end===i.end)return;let o=a?Math.min(a.start,i.start):0,s=a?Math.max(a.end,i.end):this._items.length;for(let e=o;e<s;e++){let t=e<i.start||e>=i.end,n=b(this._items[e]);n.classList.contains(`wui-virtual-off`)!==t&&n.classList.toggle(`wui-virtual-off`,t)}this._range=i;let c=b(this._top),l=b(this._bottom);c.hidden=i.before===0,l.hidden=i.after===0,b(c.cells[0]).style.height=`${i.before}px`,b(l.cells[0]).style.height=`${i.after}px`}_measureRow(e){let t=this._items.find(e=>!e.classList.contains(`wui-group-row`)&&!e.classList.contains(`wui-virtual-off`))?.getBoundingClientRect().height??0;return t>0?t:e.classList.contains(`wui-table-compact`)?o.compact:e.classList.contains(`wui-table-cozy`)?o.cozy:o.comfortable}};export{w as t};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./calendarMath-D6UUgYTD.js";import{r as c}from"./dom-Do1pAA12.js";import{t as l}from"./elementBase-Cxeyx0tU.js";import{r as u,t as d}from"./fieldState-D-zQcXUS.js";import{t as f}from"./formMirror-9IpSgeZb.js";import{t as p}from"./iconGlyphs.g-DPqoOoXy.js";import{a as m,l as h,s as g}from"./nativeOverlay-BbkCnzFj.js";import{n as _}from"./optionLabel-4xjXWy74.js";var v=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`placeholder`,`disabled`,`readonly`,`loading`,`first-day`,`disabled-weekdays`,`display-format`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}_internals;_value;_defaultValue;_rendered;_viewY;_viewM;_mode;_focus;_slide;_viewNavigated;_openFn;_closeFn;_onKeyBound;_closingQuietly;get _open(){return c(this._openFn,`open missing`)}get _close(){return c(this._closeFn,`close missing`)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth(),this._mode=`days`,this._focus=null,this._slide=``}connectedCallback(){this._rendered||this.render()}disconnectedCallback(){this._dropPanel()}attributeChangedCallback(e,t,n){if(e===`aria-invalid`)this._syncInvalid();else if(this._rendered){if(e===`value`)this._value=n||``,this._syncFormValue(),this._syncTrigger();else if(e===`display-format`)this._syncTrigger();else if(e===`first-day`){let e=this.querySelector(`.datepicker-pop`);e instanceof HTMLDivElement&&g(e)&&this._renderView()}else this.render()}}_syncInvalid(){let e=this.querySelector(`.datepicker-trigger`);e instanceof HTMLButtonElement&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,f(this,this._value),this._syncTrigger()}_firstDay(){return e(this)}render(){this._dropPanel(),this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value);let e=this.getAttribute(`placeholder`)||`Choose a date`,t=o(this._value);t&&(this._viewY=t.y,this._viewM=t.m);let n=this.getAttribute(`size`),r=n===`sm`?` input-sm`:n===`lg`?` input-lg`:``,a=this.getAttribute(`aria-label`),s=this.getAttribute(`aria-describedby`);this.innerHTML=`
|
|
2
|
-
<div class="datepicker">
|
|
3
|
-
<button type="button" class="input datepicker-trigger${r}${t?` has-value`:``}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${a?` aria-label="${_(a)}"`:``}${s?` aria-describedby="${_(s)}"`:``}>
|
|
4
|
-
<span data-trigger-label class="${t?``:`wui-select-placeholder`}">${_(t?i(this._value,this.getAttribute(`display-format`)):e)}</span>
|
|
5
|
-
${p(`calendar-dots`)}
|
|
6
|
-
</button>
|
|
7
|
-
<div class="datepicker-pop" role="dialog" popover="auto"></div>
|
|
8
|
-
</div>`,this._rendered=!0,u(this,this.querySelector(`.datepicker-trigger`)),f(this,this._value),this._wire()}_syncFormValue(){f(this,this._value)}_syncTrigger(){let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`[data-trigger-label]`);if(!(t instanceof HTMLSpanElement))return;let n=o(this._value);t.textContent=n?i(this._value,this.getAttribute(`display-format`)):this.getAttribute(`placeholder`)||`Choose a date`,t.classList.toggle(`wui-select-placeholder`,!n),e?.classList.toggle(`has-value`,!!n),u(this,e)}_limits(){let e=o(this.getAttribute(`min`)),t=o(this.getAttribute(`max`)),r=e?new Date(e.y,e.m,e.d).getTime():-1/0,i=t?new Date(t.y,t.m,t.d).getTime():1/0,a=/* @__PURE__ */ new Set;for(let e of(this.getAttribute(`disabled-weekdays`)||``).split(`,`)){let t=e.trim();/^[0-6]$/.test(t)&&a.add(Number(t))}return{dayDisabled:(e,t,n)=>{let o=new Date(e,t,n),s=o.getTime();return s<r||s>i||a.has(o.getDay())},monthDisabled:(e,t)=>{let a=new Date(e,t,1).getTime();return new Date(e,t,n(e,t)).getTime()<r||a>i},yearDisabled:e=>{let t=new Date(e,0,1).getTime();return new Date(e,11,31).getTime()<r||t>i}}}_dropPanel(){let e=this.querySelector(`.datepicker-pop`);if(e instanceof HTMLDivElement){this._closingQuietly=!0;try{m(e)}finally{this._closingQuietly=!1}}}_renderView(){let e=this.querySelector(`.datepicker-pop`);e instanceof HTMLDivElement&&(e.innerHTML=this._mode===`months`?this._monthsHtml():this._mode===`years`?this._yearsHtml():this._daysHtml(),this._focusActive())}_daysHtml(){let e=this._firstDay(),i=(new Date(this._viewY,this._viewM,1).getDay()-e+7)%7,c=n(this._viewY,this._viewM),l=o(this._value),u=/* @__PURE__ */ new Date,{dayDisabled:f}=this._limits(),m=this._focus||l||{y:this._viewY,m:this._viewM,d:1},h=(e,n,r,i)=>{let a=t(e,n,r),o=l&&l.y===e&&l.m===n&&l.d===r,s=u.getFullYear()===e&&u.getMonth()===n&&u.getDate()===r,c=m.y===e&&m.m===n&&m.d===r,d=f(e,n,r);return`<button type="button" class="${[`datepicker-day`,i?`is-outside`:``,s?`is-today`:``,o?`is-selected`:``].filter(Boolean).join(` `)}" data-iso="${a}" role="gridcell" tabindex="${c&&!d?`0`:`-1`}"${o?` aria-selected="true"`:``}${d?` disabled aria-disabled="true"`:``}>${r}</button>`},g=``,_=a(this._viewY,this._viewM-1),v=n(_.y,_.m);for(let e=i-1;e>=0;e--)g+=h(_.y,_.m,v-e,!0);for(let e=1;e<=c;e++)g+=h(this._viewY,this._viewM,e,!1);let y=a(this._viewY,this._viewM+1),b=(7-(i+c)%7)%7;for(let e=1;e<=b;e++)g+=h(y.y,y.m,e,!0);let x=f(u.getFullYear(),u.getMonth(),u.getDate()),S=d(this)?``:`<button type="button" class="datepicker-link" data-clear>Clear</button>`,C=r.map((t,n)=>r[(n+e)%7]).map(e=>`<span>${e}</span>`).join(``);return`
|
|
9
|
-
<div class="datepicker-head">
|
|
10
|
-
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${p(`chevron-left`)}</button>
|
|
11
|
-
<button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${s[this._viewM]} ${this._viewY}</button>
|
|
12
|
-
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${p(`chevron-right`)}</button>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="datepicker-weekdays">${C}</div>
|
|
15
|
-
<div class="datepicker-grid${this._slide?` ${this._slide}`:``}" role="grid">${g}</div>
|
|
16
|
-
<div class="datepicker-foot">
|
|
17
|
-
<button type="button" class="datepicker-link" data-today${x?` disabled`:``}>Today</button>
|
|
18
|
-
${S}
|
|
19
|
-
</div>`}_monthsHtml(){let e=o(this._value),t=/* @__PURE__ */ new Date,{monthDisabled:n}=this._limits(),r=``;for(let i=0;i<12;i++){let a=e&&e.y===this._viewY&&e.m===i,o=t.getFullYear()===this._viewY&&t.getMonth()===i,c=n(this._viewY,i),l=[`datepicker-cell`,o?`is-today`:``,a?`is-selected`:``].filter(Boolean).join(` `),u=s[i];if(u===void 0)throw Error(`month name missing`);r+=`<button type="button" class="${l}" data-month="${i}"${c?` disabled`:``}>${u.slice(0,3)}</button>`}return`
|
|
20
|
-
<div class="datepicker-head">
|
|
21
|
-
<button type="button" class="datepicker-nav-btn" data-nav-year="-1" aria-label="Previous year">${p(`chevron-left`)}</button>
|
|
22
|
-
<button type="button" class="datepicker-month" data-view="years" aria-label="Choose year">${this._viewY}</button>
|
|
23
|
-
<button type="button" class="datepicker-nav-btn" data-nav-year="1" aria-label="Next year">${p(`chevron-right`)}</button>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="datepicker-cells">${r}</div>`}_yearsHtml(){let e=o(this._value),t=(/* @__PURE__ */ new Date()).getFullYear(),{yearDisabled:n}=this._limits(),r=this._viewY-(this._viewY%10+10)%10-1,i=``;for(let a=0;a<12;a++){let o=r+a,s=e&&e.y===o,c=t===o,l=n(o),u=[`datepicker-cell`,c?`is-today`:``,s?`is-selected`:``].filter(Boolean).join(` `);i+=`<button type="button" class="${u}" data-year="${o}"${l?` disabled`:``}>${o}</button>`}return`
|
|
26
|
-
<div class="datepicker-head">
|
|
27
|
-
<button type="button" class="datepicker-nav-btn" data-nav-decade="-1" aria-label="Previous decade">${p(`chevron-left`)}</button>
|
|
28
|
-
<span class="datepicker-month">${r+1} to ${r+10}</span>
|
|
29
|
-
<button type="button" class="datepicker-nav-btn" data-nav-decade="1" aria-label="Next decade">${p(`chevron-right`)}</button>
|
|
30
|
-
</div>
|
|
31
|
-
<div class="datepicker-cells">${i}</div>`}_focusActive(){let e=this.querySelector(`.datepicker-pop`);if(!(e instanceof HTMLDivElement))return;let t=e.querySelector(`[tabindex="0"]`)||e.querySelector(`.is-selected`)||e.querySelector(`.datepicker-day:not(:disabled), .datepicker-cell:not(:disabled)`);t instanceof HTMLElement&&e.contains(document.activeElement)&&t.focus()}_setFocus(e,n,r,i){let{y:o,m:s}=a(e,n);this._focus={y:o,m:s,d:r};let c=o!==this._viewY||s!==this._viewM;this._viewY=o,this._viewM=s,this._slide=c&&i||``,this._renderView(),this._slide=``;let l=this.querySelector(`.datepicker-day[data-iso="${t(o,s,r)}"]`);l instanceof HTMLButtonElement&&l.focus()}_seek(e,t,n,r){let{dayDisabled:i}=this._limits(),a=new Date(e,t,n);for(let e=0;e<400;e++,a.setDate(a.getDate()+r))if(!i(a.getFullYear(),a.getMonth(),a.getDate()))return new Date(a);return null}_onKey(e){if(this._mode!==`days`)return;let r=this._focus||o(this._value)||{y:this._viewY,m:this._viewM,d:1},i=(e,t,n,r,i)=>{let a=this._seek(e,t,n,r);a&&this._setFocus(a.getFullYear(),a.getMonth(),a.getDate(),i)},s=(t,n,a=t<0?-1:1)=>{e.preventDefault(),i(r.y,r.m,r.d+t,a,n)};switch(e.key){case`ArrowLeft`:s(-1,`slide-prev`);break;case`ArrowRight`:s(1,`slide-next`);break;case`ArrowUp`:s(-7,`slide-prev`);break;case`ArrowDown`:s(7,`slide-next`);break;case`Home`:s(-((new Date(r.y,r.m,r.d).getDay()-this._firstDay()+7)%7),`slide-prev`,1);break;case`End`:s(6-(new Date(r.y,r.m,r.d).getDay()-this._firstDay()+7)%7,`slide-next`,-1);break;case`PageUp`:{e.preventDefault();let t=a(r.y,r.m-(e.shiftKey?12:1));i(t.y,t.m,Math.min(r.d,n(t.y,t.m)),-1,`slide-prev`);break}case`PageDown`:{e.preventDefault();let t=a(r.y,r.m+(e.shiftKey?12:1));i(t.y,t.m,Math.min(r.d,n(t.y,t.m)),1,`slide-next`);break}case`Enter`:case` `:e.preventDefault(),this._limits().dayDisabled(r.y,r.m,r.d)||(this.value=t(r.y,r.m,r.d),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close());return}}_wire(){let e=this.querySelector(`.datepicker-trigger`),n=this.querySelector(`.datepicker-pop`),r=this.querySelector(`.datepicker`);if(!(e instanceof HTMLButtonElement)||!(n instanceof HTMLDivElement))return;let i=()=>g(n),s=()=>{r?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),this._closingQuietly||e.focus()};this._openFn=()=>{if(d(this))return;let t=/* @__PURE__ */ new Date,a=o(this._value);(a||!this._viewNavigated)&&(this._viewY=t.getFullYear(),this._viewM=t.getMonth()),this._mode=`days`;let c=t.getFullYear()===this._viewY&&t.getMonth()===this._viewM,l=a&&a.y===this._viewY&&a.m===this._viewM;if(this._focus=l?a:{y:this._viewY,m:this._viewM,d:c?t.getDate():1},this._limits().dayDisabled(this._focus.y,this._focus.m,this._focus.d)){let e=this._focus,t=[1,-1].map(t=>this._seek(e.y,e.m,e.d,t)).find(t=>t&&t.getMonth()===e.m);t&&(this._focus={y:t.getFullYear(),m:t.getMonth(),d:t.getDate()})}if(this._renderView(),h(e,n,{mode:`auto`,clampHeight:!0,onClosed:s}),!i())return;r?.classList.add(`open`),e.setAttribute(`aria-expanded`,`true`);let u=n.querySelector(`[tabindex="0"]`);u instanceof HTMLElement&&u.focus()},this._closeFn=()=>{m(n)},e.addEventListener(`click`,()=>i()?this._close():this._open()),n.addEventListener(`click`,e=>{let n=e.target;if(!(n instanceof Element))throw Error(`click target is not an element`);let r=n.closest(`[data-nav]`);if(r instanceof HTMLElement){this._viewNavigated=!0,this._slide=Number(r.dataset.nav)<0?`slide-prev`:`slide-next`;let e=a(this._viewY,this._viewM+Number(r.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._focus={y:e.y,m:e.m,d:1},this._renderView(),this._slide=``;return}let i=n.closest(`[data-nav-year]`);if(i instanceof HTMLElement){this._viewY+=Number(i.dataset.navYear),this._renderView();return}let o=n.closest(`[data-nav-decade]`);if(o instanceof HTMLElement){this._viewY+=Number(o.dataset.navDecade)*10,this._renderView();return}let s=n.closest(`[data-view]`);if(s instanceof HTMLElement){this._mode=s.dataset.view,this._renderView();return}let c=n.closest(`[data-month]`);if(c instanceof HTMLButtonElement&&!c.disabled){this._viewNavigated=!0,this._viewM=Number(c.dataset.month),this._mode=`days`,this._focus={y:this._viewY,m:this._viewM,d:1},this._renderView();return}let l=n.closest(`[data-year]`);if(l instanceof HTMLButtonElement&&!l.disabled){this._viewNavigated=!0,this._viewY=Number(l.dataset.year),this._mode=`months`,this._renderView();return}if(n.closest(`[data-today]`)){let e=/* @__PURE__ */ new Date;if(this._limits().dayDisabled(e.getFullYear(),e.getMonth(),e.getDate()))return;this.value=t(e.getFullYear(),e.getMonth(),e.getDate()),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}if(n.closest(`[data-clear]`)){this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}let u=n.closest(`.datepicker-day[data-iso]`);u instanceof HTMLButtonElement&&!u.disabled&&(this.value=u.dataset.iso,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close())}),this._onKeyBound=e=>{i()&&this._onKey(e)},n.addEventListener(`keydown`,this._onKeyBound),this._syncFormValue()}};export{v as t};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./calendarMath-D6UUgYTD.js";import{n as c}from"./devWarn-DXdRWZs3.js";import{n as l,r as u,t as d}from"./zone-BR02ZkHF.js";import{t as f}from"./elementBase-Cxeyx0tU.js";import{r as p,t as m}from"./fieldState-D-zQcXUS.js";import{t as h}from"./iconGlyphs.g-DPqoOoXy.js";import{a as g,l as _,s as v}from"./nativeOverlay-BbkCnzFj.js";import{n as y}from"./optionLabel-4xjXWy74.js";var b=4,x=[`today`,`yesterday`,`last7Days`,`last30Days`,`thisMonth`,`lastMonth`,`thisFinancialYear`],S={today:`Today`,yesterday:`Yesterday`,last7Days:`Last 7 days`,last30Days:`Last 30 days`,thisMonth:`This month`,lastMonth:`Last month`,thisFinancialYear:`This financial year`},C=e=>String(e).padStart(2,`0`),w=e=>`${e.getUTCFullYear()}-${C(e.getUTCMonth()+1)}-${C(e.getUTCDate())}`;function T(e){return x.includes(e)}function E(e,t=/* @__PURE__ */ new Date,{timeZone:n=d,financialYearStart:r=b}={}){if(!T(e))return null;let i=o(u(n,t));if(!i)throw Error(`today missing`);let{y:a,m:s,d:c}=i,l=(e,t,n)=>w(new Date(Date.UTC(e,t,n))),f=S[e];switch(e){case`today`:return{label:f,start:l(a,s,c),end:l(a,s,c)};case`yesterday`:return{label:f,start:l(a,s,c-1),end:l(a,s,c-1)};case`last7Days`:return{label:f,start:l(a,s,c-6),end:l(a,s,c)};case`last30Days`:return{label:f,start:l(a,s,c-29),end:l(a,s,c)};case`thisMonth`:return{label:f,start:l(a,s,1),end:l(a,s+1,0)};case`lastMonth`:return{label:f,start:l(a,s-1,1),end:l(a,s,0)};case`thisFinancialYear`:{let e=r-1,t=s>=e?a:a-1;return{label:f,start:l(t,e,1),end:l(t+1,e,0)}}default:return null}}function D(e){c(`[@webority/ui-elements] <wui-date-range> presets: ${e}`)}function O(e){return typeof e==`object`&&!!e}function k(e,t=/* @__PURE__ */ new Date,n={}){let r=String(e??``).trim();if(!r)return[];let i;if(r.startsWith(`[`))try{i=JSON.parse(r)}catch{return D(`the attribute is not valid JSON`),[]}else i=r.split(`,`).map(e=>e.trim());let a=[];for(let e of i)if(typeof e==`string`){let r=E(e,t,n);r?a.push(r):D(`"${e}" is not one of ${x.join(`, `)}`)}else O(e)&&typeof e.label==`string`&&e.label&&typeof e.start==`string`&&typeof e.end==`string`&&o(e.start)&&o(e.end)?a.push({label:e.label,start:e.start,end:e.end}):D(`an item needs a label and ISO start and end dates, or a preset name`);return a}function A(e){if(!(e.target instanceof Element))throw Error(`Expected the event target to be an element.`);return e.target}function j(e,t){return[...e.querySelectorAll(t)].map(e=>{if(!(e instanceof HTMLElement))throw Error(`Expected every "${t}" to be an HTML element.`);return e})}var M=class extends f{static formAssociated=!0;_internals;_start;_end;_hover;_viewY;_viewM;static get observedAttributes(){return[`start`,`end`,`min`,`max`,`placeholder`,`disabled`,`readonly`,`loading`,`first-day`,`size`,`aria-label`,`aria-describedby`,`name`,`start-name`,`end-name`,`presets`,`time-zone`,`financial-year-start`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._start=``,this._end=``,this._hover=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth()}connectedCallback(){this._rendered||this.render()}disconnectedCallback(){this._dropPanel()}attributeChangedCallback(e,t,n){e===`aria-invalid`?this._syncInvalid():this._rendered&&(e===`start`||e===`end`?(this._start=this.getAttribute(`start`)||``,this._end=this.getAttribute(`end`)||``,this._syncTrigger(),this._syncMirrors()):this.render())}_syncInvalid(){let e=this.querySelector(`.daterange-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return{start:this._start,end:this._end}}set value(e){this._start=e?.start||``,this._end=e?.end||``,this._syncTrigger(),this._syncMirrors()}_firstDay(){return e(this)}_label(){let e=this.getAttribute(`placeholder`)||`Start to End`;return!this._start&&!this._end?{text:e,empty:!0}:{text:`${i(this._start)||`Start`} to ${i(this._end)||`End`}`,empty:!1}}render(){this._dropPanel(),this._defaultStart===void 0&&(this._defaultStart=this.getAttribute(`start`)||``,this._defaultEnd=this.getAttribute(`end`)||``,this._start=this._defaultStart||this._start,this._end=this._defaultEnd||this._end);let e=o(this._start);e&&(this._viewY=e.y,this._viewM=e.m);let t=this.getAttribute(`size`),n=t===`sm`?` input-sm`:t===`lg`?` input-lg`:``,{text:r,empty:i}=this._label(),a=this.getAttribute(`aria-label`),s=this.getAttribute(`aria-describedby`);this.innerHTML=`
|
|
2
|
-
<div class="daterange">
|
|
3
|
-
<button type="button" class="input daterange-trigger${n}${i?``:` has-value`}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${a?` aria-label="${y(a)}"`:``}${s?` aria-describedby="${y(s)}"`:``}>
|
|
4
|
-
<span data-range-label class="${i?`wui-select-placeholder`:``}">${y(r)}</span>
|
|
5
|
-
${h(`calendar`)}
|
|
6
|
-
</button>
|
|
7
|
-
<div class="daterange-pop" role="dialog" popover="auto"></div>
|
|
8
|
-
</div>`,p(this,this.querySelector(`.daterange-trigger`)),this._rendered=!0,this._syncMirrors(),this._wire()}formResetCallback(){this.value={start:this._defaultStart||``,end:this._defaultEnd||``}}_syncTrigger(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`[data-range-label]`);if(!t)return;let{text:n,empty:r}=this._label();t.textContent=n,t.classList.toggle(`wui-select-placeholder`,r),e?.classList.toggle(`has-value`,!r)}_syncMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirror(`start`,e,this._start),this._mirror(`end`,t,this._end)}_mirror(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-range-mirror="${e}"]`),i;r instanceof HTMLInputElement?i=r:(i=document.createElement(`input`),i.type=`hidden`,i.setAttribute(`data-range-mirror`,e),this.appendChild(i)),i.name=t,i.value=n||``,i.disabled=this.hasAttribute(`disabled`)}_limits(){let e=o(this.getAttribute(`min`)),t=o(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,r=t?new Date(t.y,t.m,t.d).getTime():1/0;return(e,t,i)=>{let a=new Date(e,t,i).getTime();return a<n||a>r}}_monthHtml(e,i){let o=this._firstDay(),c=(new Date(e,i,1).getDay()-o+7)%7,l=n(e,i),u=this._limits(),d=r.map((e,t)=>r[(t+o)%7]).map(e=>`<span>${e}</span>`).join(``),f=(e,n,r,i)=>{let a=t(e,n,r),o=u(e,n,r);return`<button type="button" class="${[`datepicker-day`,i?`is-outside`:``].filter(Boolean).join(` `)}" data-iso="${a}"${o?` disabled`:``}>${r}</button>`},p=``,m=a(e,i-1),h=n(m.y,m.m);for(let e=c-1;e>=0;e--)p+=f(m.y,m.m,h-e,!0);for(let t=1;t<=l;t++)p+=f(e,i,t,!1);let g=a(e,i+1),_=(7-(c+l)%7)%7;for(let e=1;e<=_;e++)p+=f(g.y,g.m,e,!0);return`
|
|
9
|
-
<div class="daterange-cal">
|
|
10
|
-
<div class="datepicker-month-label">${s[i]} ${e}</div>
|
|
11
|
-
<div class="datepicker-weekdays">${d}</div>
|
|
12
|
-
<div class="datepicker-grid" role="grid">${p}</div>
|
|
13
|
-
</div>`}_presetOptions(){let e=this.getAttribute(`time-zone`),t=d;e!==null&&(l(e)?t=e:c(`[@webority/ui-elements] <wui-date-range> time-zone="${e}" is not a time zone this browser knows; India Standard Time is used.`));let n=this.getAttribute(`financial-year-start`),r=4;if(n!==null){let e=Number(n);Number.isInteger(e)&&e>=1&&e<=12?r=e:c(`[@webority/ui-elements] <wui-date-range> financial-year-start="${n}" must be a month number from 1 to 12; April (4) is used.`)}return{timeZone:t,financialYearStart:r}}_presetsHtml(){if(!this._presetList?.length)return``;let e=this._limits(),t=t=>{let n=o(t);if(!n)throw Error(`Expected a preset date, found "${t}".`);return e(n.y,n.m,n.d)};return`<div class="wui-daterange-presets" role="group" aria-label="Quick ranges">${this._presetList.map((e,n)=>`<button type="button" class="wui-daterange-preset" data-preset="${n}"${t(e.start)||t(e.end)?` disabled`:``}>${y(e.label)}</button>`).join(``)}</div>`}_renderView(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=a(this._viewY,this._viewM+1),n=this._presetsHtml(),r=`
|
|
14
|
-
<div class="daterange-head">
|
|
15
|
-
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${h(`chevron-left`)}</button>
|
|
16
|
-
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${h(`chevron-right`)}</button>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="daterange-cals">
|
|
19
|
-
${this._monthHtml(this._viewY,this._viewM)}
|
|
20
|
-
${this._monthHtml(t.y,t.m)}
|
|
21
|
-
</div>
|
|
22
|
-
<div class="datepicker-foot">
|
|
23
|
-
<span class="daterange-hint" data-range-hint></span>
|
|
24
|
-
<button type="button" class="datepicker-link" data-clear>Clear</button>
|
|
25
|
-
</div>`;e.classList.toggle(`wui-daterange-pop--presets`,n!==``),e.innerHTML=n?`${n}<div class="wui-daterange-main">${r}</div>`:r,this._paint()}_paint(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=this._start?new Date(this._start).getTime():null,n=this._end;t&&!this._end&&this._hover&&new Date(this._hover).getTime()>=t&&(n=this._hover);let r=n?new Date(n).getTime():null;for(let n of j(e,`.datepicker-day[data-iso]`)){let e=new Date(n.dataset.iso??``).getTime(),i=t!=null&&e===t,a=r!=null&&e===r,o=t!=null&&r!=null&&e>t&&e<r;n.classList.toggle(`is-range-start`,i),n.classList.toggle(`is-range-end`,a),n.classList.toggle(`in-range`,o)}j(e,`[data-preset]`).forEach(e=>{let t=this._presetList?.[Number(e.dataset.preset)],n=!!t&&t.start===this._start&&t.end===this._end;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-pressed`,String(n))});let a=e.querySelector(`[data-range-hint]`);a&&(a.textContent=this._start?this._end?`${i(this._start)} to ${i(this._end)}`:`Pick an end date`:`Pick a start date`)}_pick(e){!this._start||this._start&&this._end?(this._start=e,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint()):new Date(e).getTime()<new Date(this._start).getTime()?(this._start=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))):(this._end=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close())}_applyPreset({start:e,end:t}){this._start=e,this._end=t,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_dropPanel(){let e=this.querySelector(`.daterange-pop`);e instanceof HTMLDivElement&&g(e)}_wire(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`.daterange-pop`),n=this.querySelector(`.daterange`);if(!(e instanceof HTMLButtonElement)||!(t instanceof HTMLDivElement))return;let r=()=>v(t),i=()=>{this._hover=``,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`)};this._open=()=>{let a=o(this._start);if(a)this._viewY=a.y,this._viewM=a.m;else{let e=/* @__PURE__ */ new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}this._presetList=k(this.getAttribute(`presets`),/* @__PURE__ */ new Date,this._presetOptions()),this._renderView(),_(e,t,{mode:`auto`,clampHeight:!0,onClosed:i}),r()&&(n?.classList.add(`open`),e.setAttribute(`aria-expanded`,`true`))},this._close=()=>{g(t)},e.addEventListener(`click`,()=>{r()?this._close():m(this)||this._open()}),t.addEventListener(`click`,e=>{let t=A(e),n=t.closest(`[data-nav]`);if(n instanceof HTMLElement){let e=a(this._viewY,this._viewM+Number(n.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._renderView();return}if(t.closest(`[data-clear]`)){this._start=``,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._renderView(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}let r=t.closest(`[data-preset]`);if(r instanceof HTMLButtonElement&&!r.disabled){let e=this._presetList?.[Number(r.dataset.preset)];e&&this._applyPreset(e);return}let i=t.closest(`.datepicker-day[data-iso]`);if(i instanceof HTMLButtonElement&&!i.disabled){let e=i.dataset.iso;e!==void 0&&this._pick(e)}}),t.addEventListener(`mouseover`,e=>{let t=A(e).closest(`.datepicker-day[data-iso]`),n=t instanceof HTMLButtonElement?t.dataset.iso:void 0;n!==void 0&&this._start&&!this._end&&(this._hover=n,this._paint())}),this._syncMirrors()}};export{M as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";import{h as t,o as n,p as r,u as i}from"./nativeOverlay-BbkCnzFj.js";var a=[50,90],o=10,s=100;function c(e,t=a){let n=Array.isArray(e)?e:String(e??``).split(`,`),r=[];for(let e of n){if(typeof e==`string`&&e.trim()===``)return t;let n=Number(e);if(!Number.isFinite(n)||n<o||n>s)return t;r.includes(n)||r.push(n)}return r.length?r.sort((e,t)=>e-t):t}function l(e){let{points:t,index:n,visible:r,velocity:i,canDismiss:a}=e,o=a?-1:0;if(Math.abs(i)>=.5)return i>0?Math.max(n-1,o):Math.min(n+1,t.length-1);let s=t[0];if(a&&s!==void 0&&r<s/2)return-1;let c=0;for(let e=1;e<t.length;e++){let n=t[e],i=t[c];if(n===void 0||i===void 0)throw Error(`snap point missing`);Math.abs(n-r)<Math.abs(i-r)&&(c=e)}return c}var u=`(max-width: 767.98px)`,d=4;function f(e,t){let n=e[t];if(n===void 0)throw RangeError(`no snap point at ${t}`);return n}var p=class extends e{_doc;_media;_shown;_trigger;_returnTo;_release;_snap;_drag;_onMedia;_onPointerDown;_onPointerMove;_onPointerUp;_onKeyDown;_onTransitionEnd;_announced;static get observedAttributes(){return[`open`,`snap-points`,`no-sheet`]}constructor(){super(),this._doc=null,this._media=null,this._shown=!1,this._trigger=null,this._returnTo=null,this._release=null,this._snap=0,this._drag=null,this._onMedia=()=>this._syncMode(),this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onKeyDown=e=>this._keyDown(e),this._onTransitionEnd=e=>{e.target===this._panel()&&e.propertyName===`transform`&&this.isOpen&&this._announce()},this._announced=!1}connectedCallback(){this._doc=this.ownerDocument,t(this._doc),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`transitionend`,this._onTransitionEnd),this._media=typeof matchMedia==`function`?matchMedia(u):null,this._media?.addEventListener?.(`change`,this._onMedia),this._syncMode(),this._applyPoints(),this.hasAttribute(`open`)&&this._open()}disconnectedCallback(){this._endDrag(),this._teardown(),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`transitionend`,this._onTransitionEnd),this._media?.removeEventListener?.(`change`,this._onMedia),this._media=null,this._doc=null}attributeChangedCallback(e){this._doc&&(e===`open`?this.hasAttribute(`open`)?this._open():this._close():e===`no-sheet`?this._syncMode():(this._snap=Math.min(this._snap,this._points().length-1),this._applyPoints()))}get isOpen(){return this.hasAttribute(`open`)}show(e){this._trigger=e??null,this.setAttribute(`open`,``)}hide(){this.removeAttribute(`open`)}_points(){return c(this.getAttribute(`snap-points`),a)}_sheet(){return!!this._media?.matches&&!this.hasAttribute(`no-sheet`)}_syncMode(){this.setAttribute(`data-mode`,this._sheet()?`sheet`:`side`)}_applyPoints(){let e=this._points();this._snap=Math.min(Math.max(this._snap,0),e.length-1),this.style.setProperty(`--wui-drawer-max`,String(e[e.length-1])),this.style.setProperty(`--wui-drawer-snap`,String(e[this._snap])),this.setAttribute(`data-snap`,String(this._snap));let t=this.querySelector(`.wui-drawer-handle`);if(!(t instanceof Element))return;let n=e[this._snap];t.setAttribute(`aria-valuemin`,String(e[0])),t.setAttribute(`aria-valuemax`,String(e[e.length-1])),t.setAttribute(`aria-valuenow`,String(n)),t.setAttribute(`aria-valuetext`,`${n}% of the screen`)}_setSnap(e){let t=this._points(),n=Math.min(Math.max(e,0),t.length-1),r=n!==this._snap;this._snap=n,this._applyPoints(),r&&this.dispatchEvent(new CustomEvent(`wui-drawer-snap`,{bubbles:!0,detail:{index:n,percent:t[n]}}))}_open(){if(this._shown)return;let e=this._dialog();this._shown=!0;let t=Number.parseInt(this.getAttribute(`default-snap`)??`0`,10);this._snap=Number.isFinite(t)?t:0,this._syncMode(),this._applyPoints(),this.dispatchEvent(new CustomEvent(`wui-drawer-open`,{bubbles:!0,detail:{trigger:this._trigger}})),this._returnTo=this._trigger,this._trigger=null,this._release=i(e,{escape:this._dismissible(),backdrop:this._dismissible(),focus:this._sheet()?`panel`:`first-control`,onRequestClose:e=>this._requestClose(e)}),this._settle()}_close(){if(!this._shown)return;this._endDrag(),this._shown=!1;let e=this._release;this._release=null;let t=this._dialog();n(t).then(()=>{e?.(),r(this._returnTo,t),this._returnTo=null,this._announce()})}_teardown(){this._shown=!1;let e=this._release;this._release=null,e&&(e(),this._panel()?.close())}_settle(){(this._panel()?.getAnimations?.()??[]).length||this._announce()}_announce(){let e=this.isOpen;e!==this._announced&&(this._announced=e,this.dispatchEvent(new CustomEvent(e?`wui-drawer-opened`:`wui-drawer-closed`,{bubbles:!0})))}_document(){let e=this._doc;if(!e)throw TypeError(`wui-drawer is not connected`);return e}_panel(){let e=this.querySelector(`.wui-drawer-panel`);return e instanceof HTMLDialogElement?e:null}_dialog(){let e=this._panel();if(!e)throw TypeError(`wui-drawer has no dialog panel`);return e}_dismissible(){return!this.hasAttribute(`static`)&&!this.hasAttribute(`no-dismiss`)}_requestClose(e){let t=this.dispatchEvent(new CustomEvent(`wui-drawer-close`,{bubbles:!0,cancelable:!0,detail:{reason:e}}));return t&&this.hide(),t}_keyDown(e){e.target instanceof Element&&e.target.closest(`.wui-drawer-handle`)&&this._sheet()&&this._handleKey(e)}_handleKey(e){let t=this._points().length-1,n={ArrowUp:this._snap+1,ArrowDown:this._snap-1,Home:0,End:t};if(!(e.key in n))return;let r=n[e.key];r!==void 0&&(e.preventDefault(),this._setSnap(r))}_pointerDown(e){if(!this.isOpen||!this._sheet()||(e.button??0)!==0)return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[data-wui-drawer-grip]`);n instanceof HTMLElement&&!t.closest(`button`)&&(this._drag={grip:n,id:e.pointerId,startY:e.clientY,lastY:e.clientY,lastT:e.timeStamp,velocity:0,moved:!1},n.setPointerCapture?.(e.pointerId),n.addEventListener(`pointermove`,this._onPointerMove),n.addEventListener(`pointerup`,this._onPointerUp),n.addEventListener(`pointercancel`,this._onPointerUp))}_viewport(){let e=this._document().defaultView;if(!e)throw TypeError(`wui-drawer has no window`);return e.innerHeight}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let n=e.clientY-t.startY;if(!t.moved&&Math.abs(n)<d)return;t.moved=!0,this.classList.add(`is-dragging`);let r=e.timeStamp-t.lastT;r>0&&(t.velocity=(e.clientY-t.lastY)/r),t.lastY=e.clientY,t.lastT=e.timeStamp;let i=this._points(),a=(f(i,i.length-1)-f(i,this._snap))/100*this._viewport();t.offset=Math.max(n,-a),this.style.setProperty(`--wui-drawer-drag`,`${t.offset}px`)}_pointerUp(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let{moved:n,velocity:r,offset:i=0}=t;if(this._endDrag(),!n)return;let a=this._points(),o=this._viewport(),s=(f(a,this._snap)/100*o-i)/(o/100),c=this._dismissible(),u=l({points:a,index:this._snap,visible:s,velocity:r,canDismiss:c});u>=0?this._setSnap(u):this._requestClose(`drag`)}_endDrag(){let e=this._drag;e&&(this._drag=null,e.grip.releasePointerCapture?.(e.id),e.grip.removeEventListener(`pointermove`,this._onPointerMove),e.grip.removeEventListener(`pointerup`,this._onPointerUp),e.grip.removeEventListener(`pointercancel`,this._onPointerUp),this.classList.remove(`is-dragging`),this.style.removeProperty(`--wui-drawer-drag`))}};export{p as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";import{t}from"./menuKeyNav-COGecOjH.js";import{a as n,l as r,s as i}from"./nativeOverlay-BbkCnzFj.js";var a=`[data-wui-dropdown-trigger]`,o=`[data-wui-dropdown-menu]`,s=`.dropdown-item`,c=`[data-wui-keep-open]`,l=2,u=class extends e{_unbindKeys;_rect;_pendingFocus;_pressOpen;_onClick;_onPointerDown;_onKeyDown;_onScroll;_onResize;_onClosed;static get observedAttributes(){return[`open`,`align`]}constructor(){super(),this._unbindKeys=null,this._rect=null,this._pendingFocus=!1,this._pressOpen=null,this._onClick=e=>this._click(e),this._onPointerDown=e=>{e.target instanceof Element&&e.target.closest(a)&&(this._pressOpen=this.isOpen)},this._onKeyDown=e=>this._key(e),this._onScroll=()=>this._scrolled(),this._onResize=()=>{this._request(!1,`resize`)},this._onClosed=()=>this._dismissed()}connectedCallback(){this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown,{capture:!0}),this.addEventListener(`keydown`,this._onKeyDown),this._trigger()?.setAttribute(`aria-expanded`,String(this.isOpen)),this.isOpen&&this._sync()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown,{capture:!0}),this.removeEventListener(`keydown`,this._onKeyDown),this._stop();let e=this._menu();e&&n(e)}attributeChangedCallback(e){e===`open`&&this.isConnected&&this._sync()}get isOpen(){return this.hasAttribute(`open`)}show(){this.isOpen||this._request(!0,`trigger`)}hide(){this.isOpen&&this._request(!1,`trigger`)}_request(e,t){let n=this.dispatchEvent(new CustomEvent(`wui-dropdown-toggle`,{bubbles:!0,cancelable:!0,detail:{open:e,source:t}}));return n&&this._apply(e),n}_apply(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}_dismissed(){if(!this.isConnected||!this.isOpen)return;let e=this._menu()?.contains(this.ownerDocument.activeElement)??!1;this.dispatchEvent(new CustomEvent(`wui-dropdown-toggle`,{bubbles:!0,detail:{open:!1,source:`dismiss`}})),this.removeAttribute(`open`),e&&this._trigger()?.focus()}_sync(){let{trigger:e,menu:t}=this._markup();this.isOpen?this._open(e,t):this._close(e,t)}_open(e,n){i(n)||(r(this._anchor(e),n,{mode:`auto`,alignEnd:this.getAttribute(`align`)===`end`,onClosed:this._onClosed}),e.setAttribute(`aria-expanded`,`true`),this._rect=this._anchor(e).getBoundingClientRect(),this._unbindKeys=t(n,{items:()=>this._rows(n)}),window.addEventListener(`scroll`,this._onScroll,{capture:!0,passive:!0}),window.addEventListener(`resize`,this._onResize),this._pendingFocus&&(this._pendingFocus=!1,this._rows(n)[0]?.focus()))}_close(e,t){this._pendingFocus=!1,this._stop(),e.setAttribute(`aria-expanded`,`false`),n(t)}_stop(){this._unbindKeys?.(),this._unbindKeys=null,window.removeEventListener(`scroll`,this._onScroll,{capture:!0}),window.removeEventListener(`resize`,this._onResize)}_scrolled(){let{trigger:e}=this._markup(),t=this._anchor(e).getBoundingClientRect(),n=this._rect;(!n||Math.abs(t.top-n.top)>l||Math.abs(t.left-n.left)>l)&&this._request(!1,`scroll`)}_click(e){let t=e.target;if(!(t instanceof Element))return;let n=this._pressOpen;this._pressOpen=null;let r=t.closest(a);if(r&&this.contains(r)){if((n??this.isOpen)&&!this.isOpen)return;this._request(!this.isOpen,`trigger`);return}let i=this._menu(),o=t.closest(s);if(!i||!o||!i.contains(o)||o.getAttribute(`aria-disabled`)===`true`)return;let l=o.closest(c);l&&i.contains(l)||this.isOpen&&this._request(!1,`select`)}_key(e){if(e.key!==`ArrowDown`||this.isOpen)return;let t=e.target;t instanceof Element&&this._trigger()?.contains(t)&&(e.preventDefault(),this._pendingFocus=!0,this._request(!0,`trigger`))}_trigger(){return this.querySelector(a)}_anchor(e){return(e.closest(`[data-wui-overflow-hidden]`)?.closest(`wui-overflow`))?.querySelector(`:scope > .wui-overflow-more`)??e}_menu(){return this.querySelector(o)}_rows(e){return Array.from(e.querySelectorAll(s))}_markup(){let e=this._trigger(),t=this._menu();if(!e||!t)throw RangeError(`<wui-dropdown> needs a [data-wui-dropdown-trigger] control and a [data-wui-dropdown-menu] panel.`);return{trigger:e,menu:t}}};export{u as t};
|