@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
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";var t=4096,n=[.92,.8,.65,.5],r=.8,i=8;function a(e){if(e==null||e===``||e===`free`)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)&&t>0?t:null}function o(e,t,n){if(!n)return{x:0,y:0,w:e,h:t};let r=e,i=r/n;return i>t&&(i=t,r=i*n),{x:(e-r)/2,y:(t-i)/2,w:r,h:i}}function s(e,t,n){return{...e,x:Math.min(Math.max(e.x,0),Math.max(t-e.w,0)),y:Math.min(Math.max(e.y,0),Math.max(n-e.h,0))}}function c(e,t,n,r,i){return s({...e,x:e.x+t,y:e.y+n},r,i)}function l(e,t){return Math.min(32,e,t)}function u(e,t){return t.w/e.w}function d(e,t){return Math.max(4,u(e,t))}function f(e,t,n,r,i){let a=Math.min(Math.max(n,1),d(e,t)),o=e.h/e.w,c=Math.min(r,i/o),u=Math.min(Math.max(l(r,i),l(r,i)/o),c),f=Math.min(Math.max(t.w/a,u),c),p=f*o,m=e.x+e.w/2,h=e.y+e.h/2;return s({x:m-f/2,y:h-p/2,w:f,h:p},r,i)}var p=[`nw`,`ne`,`sw`,`se`];function m(e,t,n,r,i,a){let o=l(i,a),s=t.endsWith(`w`),c=t.startsWith(`n`),u=s?e.x+e.w:e.x,d=c?e.y+e.h:e.y,f=Math.min(Math.max(n,0),i),p=Math.min(Math.max(r,0),a);return f=s?Math.min(f,u-o):Math.max(f,u+o),p=c?Math.min(p,d-o):Math.max(p,d+o),{x:Math.min(f,u),y:Math.min(p,d),w:Math.abs(f-u),h:Math.abs(p-d)}}function h(e,n=t){let r=Math.min(1,n/Math.max(e.w,e.h));return{width:Math.max(1,Math.round(e.w*r)),height:Math.max(1,Math.round(e.h*r))}}function g(e,t){let n=t/Math.max(e.w,e.h);return{width:Math.max(1,Math.round(e.w*n)),height:Math.max(1,Math.round(e.h*n))}}function _(e,t,n){return n%180==0?{w:e,h:t}:{w:t,h:e}}function v(e,t,n){return s({x:n-(e.y+e.h),y:e.x,w:e.h,h:e.w},n,t)}function y(e){return String(e||``).split(/[\s,]+/).map(Number).filter(e=>Number.isInteger(e)&&e>0)}var b=[`image/png`,`image/jpeg`,`image/webp`],x={"image/png":`.png`,"image/jpeg":`.jpg`,"image/webp":`.webp`};function S(e){let t=String(e||``).toLowerCase();return b.includes(t)?t:`image/png`}function C(e,t){let n=String(e||`image`),r=x[t];if(r===void 0)throw Error(`No file extension for ${t}`);return(t===`image/jpeg`?/\.jpe?g$/i.test(n):n.toLowerCase().endsWith(r))?n:`${n.replace(/\.[^./\\]+$/,``)||`image`}${r}`}async function w(e,{width:t,height:a,type:o,maxBytes:s}){let c=o,l=t,u=a,d=null;for(let t=0;t<=i;t++){let i=c===`image/png`?[void 0]:t===0?n:[n[1]];for(let t of i){if(d=await e(l,u,c,t),!d||(d.type&&d.type!==c&&(c=d.type),!(s>0)||d.size<=s))return d;if(c===`image/png`)break}l=Math.max(1,Math.round(l*r)),u=Math.max(1,Math.round(u*r))}return d}var T=.05,E=.2,D={w:320,h:240},O={nw:`top left`,ne:`top right`,sw:`bottom left`,se:`bottom right`},k=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 12h14"/></svg>`,A=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 12h14M12 5v14"/></svg>`,j=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,M=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>`,N=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y);function P(e){let[t,n]=[...e.values()];if(!t||!n)throw Error(`two pointers missing`);return[t,n]}function F(e,t){if(e===null)throw Error(`${t} missing`);return e}function I(e,t,n){let r=e.querySelector(t);if(!(r instanceof n))throw Error(`${t} missing`);return r}function L(e){if(e===null)throw Error(`event target missing`);if(!(e instanceof Element))return null;let t=e.closest(`.wui-crop-handle`);return t instanceof HTMLElement?t:null}var R=class extends e{_rect;_base;_natural;_source;_rotation;_drag;_pointers;_pinch;_previewPending;_resizeObserver;_rendered;_stageEl;_imgEl;_frameEl;_sliderEl;_toolsEl;_previewBoxEl;_liveEl;static get observedAttributes(){return[`src`,`aspect`,`round`,`rotatable`,`previews`]}constructor(){super(),this._rect=null,this._base=null,this._natural=null,this._source=null,this._rotation=0,this._drag=null,this._pointers=/* @__PURE__ */ new Map,this._pinch=null,this._previewPending=!1,this._resizeObserver=null,this._stageEl=null,this._imgEl=null,this._frameEl=null,this._sliderEl=null,this._toolsEl=null,this._previewBoxEl=null,this._liveEl=null}get _stage(){return F(this._stageEl,`stage`)}get _img(){return F(this._imgEl,`image`)}get _frame(){return F(this._frameEl,`frame`)}get _slider(){return F(this._sliderEl,`zoom slider`)}get _tools(){return F(this._toolsEl,`tools`)}get _previewBox(){return F(this._previewBoxEl,`previews`)}get _live(){return F(this._liveEl,`live region`)}get src(){return this.getAttribute(`src`)||``}set src(e){e==null||e===``?this.removeAttribute(`src`):this.setAttribute(`src`,String(e))}get aspect(){return a(this.getAttribute(`aspect`))}set aspect(e){e==null||e===``?this.removeAttribute(`aspect`):this.setAttribute(`aspect`,String(e))}get round(){return this.hasAttribute(`round`)}set round(e){this.toggleAttribute(`round`,!!e)}get rotatable(){return this.hasAttribute(`rotatable`)}set rotatable(e){this.toggleAttribute(`rotatable`,!!e)}get previews(){return this.getAttribute(`previews`)||``}set previews(e){e==null||e===``?this.removeAttribute(`previews`):this.setAttribute(`previews`,Array.isArray(e)?e.join(` `):String(e))}get rect(){return this._rect?{...this._rect}:null}get rotation(){return this._rotation}set rotation(e){if(!this._rect)return;let t=(Math.round(Number(e)/90)*90%360+360)%360;if(!Number.isNaN(t))for(;this._rotation!==t;)this.rotate()}get zoom(){return this._rect?u(this._rect,F(this._base,`base frame`)):1}set zoom(e){if(!this._rect)return;let t=F(this._natural,`natural size`);this._rect=f(this._rect,F(this._base,`base frame`),Number(e)||1,t.w,t.h),this._paint(),this._announce()}connectedCallback(){this._rendered?this._observe():this.render()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null}attributeChangedCallback(e){this._rendered&&(e===`src`?this._loadImage():e===`aspect`?(this._rebuildHandles(),this._resetRect()):e===`rotatable`?this._tools.hidden=!this.rotatable:e===`previews`?this._renderPreviews():this._applyRound())}render(){this.innerHTML=`<div>
|
|
2
|
-
<div class="wui-crop-stage" tabindex="0" role="group" aria-label="Crop area. Drag the frame or use the arrow keys to move it, and plus or minus to zoom.">
|
|
3
|
-
<img class="wui-crop-img" alt="" draggable="false">
|
|
4
|
-
<div class="wui-crop-frame"></div>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="wui-crop-controls">
|
|
7
|
-
<button type="button" class="wui-crop-zoombtn" data-zoom="out" aria-label="Zoom out">${k}</button>
|
|
8
|
-
<input type="range" class="form-range wui-crop-zoom" min="1" max="4" step="0.01" value="1" aria-label="Zoom">
|
|
9
|
-
<button type="button" class="wui-crop-zoombtn" data-zoom="in" aria-label="Zoom in">${A}</button>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="wui-crop-tools" hidden>
|
|
12
|
-
<button type="button" class="wui-crop-toolbtn" data-crop-action="rotate" aria-label="Rotate 90 degrees clockwise">${j}<span>Rotate</span></button>
|
|
13
|
-
<button type="button" class="wui-crop-toolbtn" data-crop-action="reset" aria-label="Reset the crop">${M}<span>Reset</span></button>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="wui-crop-previews" aria-hidden="true" hidden></div>
|
|
16
|
-
<div class="visually-hidden" data-wui-crop-live aria-live="polite"></div>
|
|
17
|
-
</div>`,this._stageEl=I(this,`.wui-crop-stage`,HTMLElement),this._imgEl=I(this,`.wui-crop-img`,HTMLImageElement),this._frameEl=I(this,`.wui-crop-frame`,HTMLElement),this._sliderEl=I(this,`.wui-crop-zoom`,HTMLInputElement),this._toolsEl=I(this,`.wui-crop-tools`,HTMLElement),this._previewBoxEl=I(this,`.wui-crop-previews`,HTMLElement),this._liveEl=I(this,`[data-wui-crop-live]`,HTMLElement),this._rendered=!0,this._tools.hidden=!this.rotatable,this._applyRound(),this._rebuildHandles(),this._renderPreviews(),this._wire(),this._observe(),this._loadImage()}_applyRound(){this._frame.classList.toggle(`wui-crop-frame--round`,this.round),this._previewBox.classList.toggle(`wui-crop-previews--round`,this.round)}_rebuildHandles(){for(let e of this._frame.querySelectorAll(`.wui-crop-handle`))e.remove();if(!this.aspect)for(let e of p){let t=document.createElement(`button`);t.type=`button`,t.className=`wui-crop-handle wui-crop-handle--${e}`,t.dataset.handle=e,t.setAttribute(`aria-label`,`Resize ${O[e]} corner`),this._frame.appendChild(t)}}_renderPreviews(){let e=y(this.previews);this._previewBox.replaceChildren(),this._previewBox.hidden=e.length===0;for(let t of e){let e=document.createElement(`canvas`);e.className=`wui-crop-preview`,e.dataset.size=String(t),e.style.width=`${t}px`,e.style.height=`${t}px`,this._previewBox.appendChild(e)}this._schedulePreviews()}_loadImage(){this._rect=null,this._natural=null,this._source=null,this._rotation=0,this._drag=null,this._pinch=null,this._pointers.clear();let e=this.src;this._img.hidden=!e,this._frame.hidden=!0,e&&(this._img.onload=()=>{this._source={w:this._img.naturalWidth,h:this._img.naturalHeight},this._natural={...this._source},this._resetRect(),this.dispatchEvent(new Event(`load`))},this._img.onerror=()=>{this._frame.hidden=!0,this.dispatchEvent(new Event(`error`))},this._img.src=e)}_resetRect(){this._natural&&(this._base=o(this._natural.w,this._natural.h,this.aspect),this._rect={...this._base},this._frame.hidden=!1,this._paint())}_observe(){typeof ResizeObserver>`u`||this._resizeObserver||(this._resizeObserver=new ResizeObserver(()=>this._paint()),this._resizeObserver.observe(this._stage))}_view(){let e=F(this._natural,`natural size`),t=this._stage.clientWidth||D.w,n=this._stage.clientHeight||D.h,r=Math.min(t/e.w,n/e.h),i=e.w*r,a=e.h*r;return{scale:r,left:(t-i)/2,top:(n-a)/2,iw:i,ih:a}}_paint(){if(!this._rect)return;let e=this._view(),t=this._rotation%180!=0,n=t?e.ih:e.iw,r=t?e.iw:e.ih;Object.assign(this._img.style,{left:`${e.left+(e.iw-n)/2}px`,top:`${e.top+(e.ih-r)/2}px`,width:`${n}px`,height:`${r}px`,transform:this._rotation?`rotate(${this._rotation}deg)`:``});let i=this._rect;Object.assign(this._frame.style,{left:`${e.left+i.x*e.scale}px`,top:`${e.top+i.y*e.scale}px`,width:`${i.w*e.scale}px`,height:`${i.h*e.scale}px`});let a=F(this._base,`base frame`),o=u(i,a),s=d(i,a);this._slider.max=String(s),this._slider.value=String(Math.min(Math.max(o,1),s)),this._slider.setAttribute(`aria-valuetext`,`${Math.round(o*100)}%`),this._schedulePreviews()}_schedulePreviews(){if(!this._rect||this._previewBox.hidden||this._previewPending)return;this._previewPending=!0;let e=()=>{this._previewPending=!1,this._drawPreviews()};typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}_drawPreviews(){if(!this._rect)return;let e=F(this._natural,`natural size`),t=s(this._rect,e.w,e.h),n=typeof window<`u`&&window.devicePixelRatio||1;for(let e of this._previewBox.children){if(!(e instanceof HTMLCanvasElement))throw Error(`Preview box holds a non-canvas child`);let r=e,i=Number(r.dataset.size),a=Math.max(1,Math.round(i*t.h/t.w));r.style.width=`${i}px`,r.style.height=`${a}px`,r.width=Math.round(i*n),r.height=Math.round(a*n);let o=r.getContext(`2d`);o&&this._drawCrop(o,t,r.width,r.height)}}_drawCrop(e,t,n,r){if(!this._rotation){e.drawImage(this._img,t.x,t.y,t.w,t.h,0,0,n,r);return}let i=F(this._source,`source size`),a=F(this._natural,`natural size`);e.save(),e.scale(n/t.w,r/t.h),e.translate(-t.x,-t.y),e.translate(a.w/2,a.h/2),e.rotate(this._rotation*Math.PI/180),e.drawImage(this._img,-i.w/2,-i.h/2,i.w,i.h),e.restore()}_announce(){this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:this.rect}))}_say(){let e=F(this._rect,`frame`),t=this._rotation?`, turned ${this._rotation} degrees`:``,n=`Frame ${Math.round(e.w)} by ${Math.round(e.h)} pixels, ${Math.round(e.x)} from the left, ${Math.round(e.y)} from the top, zoom ${Math.round(u(e,F(this._base,`base frame`))*100)}%${t}.`;this._live.textContent=n===this._live.textContent?`${n} `:n}rotate(){if(!this._rect)return;let e=F(this._natural,`natural size`),t=v(this._rect,e.w,e.h);this._rotation=(this._rotation+90)%360;let n=F(this._source,`source size`);this._natural=_(n.w,n.h,this._rotation),this._base=o(this._natural.w,this._natural.h,this.aspect);let r=this.aspect;this._rect=r&&r!==1?{...this._base}:t,this._paint(),this._announce()}reset(){this._source&&(this._rotation=0,this._natural={...this._source},this._resetRect(),this._announce())}_wire(){let e=this._stage;e.addEventListener(`pointerdown`,t=>{if(!this._rect||t.button>0)return;if(this._pointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),e.setPointerCapture?.(t.pointerId),this._pointers.size===2){let[e,n]=P(this._pointers);this._drag=null,this._pinch={distance:N(e,n)||1,zoom:this.zoom,done:!1},t.preventDefault();return}if(this._pinch)return;let n=L(t.target);this._drag={id:t.pointerId,corner:n?n.dataset.handle:null,x:t.clientX,y:t.clientY,start:{...this._rect}},n||e.focus(),t.preventDefault()}),e.addEventListener(`pointermove`,t=>{if(this._pointers.has(t.pointerId)&&this._pointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),this._pinch){if(this._pinch.done||this._pointers.size<2||!this._pointers.has(t.pointerId))return;let[e,n]=P(this._pointers),r=this._pinch.zoom*N(e,n)/this._pinch.distance,i=F(this._natural,`natural size`);this._rect=f(F(this._rect,`frame`),F(this._base,`base frame`),r,i.w,i.h),this._paint();return}let n=this._drag;if(!n||n.id!==t.pointerId)return;let r=this._view(),{w:i,h:a}=F(this._natural,`natural size`);if(n.corner){let o=e.getBoundingClientRect(),s=(t.clientX-o.left-e.clientLeft-r.left)/r.scale,c=(t.clientY-o.top-e.clientTop-r.top)/r.scale;this._rect=m(F(this._rect,`frame`),n.corner,s,c,i,a)}else this._rect=c(n.start,(t.clientX-n.x)/r.scale,(t.clientY-n.y)/r.scale,i,a);this._paint()});let t=t=>{if(this._pointers.delete(t.pointerId)&&e.releasePointerCapture?.(t.pointerId),this._pinch){!this._pinch.done&&this._pointers.size<2&&(this._pinch.done=!0,this._announce()),this._pointers.size===0&&(this._pinch=null);return}let n=this._drag;n&&n.id===t.pointerId&&(this._drag=null,this._announce())};e.addEventListener(`pointerup`,t),e.addEventListener(`pointercancel`,t),e.addEventListener(`keydown`,e=>this._onKey(e)),e.addEventListener(`wheel`,e=>{this._rect&&this.contains(document.activeElement)&&(e.preventDefault(),this.zoom*=e.deltaY<0?1.1:1/1.1)},{passive:!1});for(let e of[`input`,`change`])this._slider.addEventListener(e,e=>e.stopPropagation());this._slider.addEventListener(`input`,()=>{this.zoom=Number(this._slider.value)});for(let e of this.querySelectorAll(`.wui-crop-zoombtn`)){if(!(e instanceof HTMLButtonElement))throw Error(`zoom button missing`);e.addEventListener(`click`,()=>{this.zoom*=e.dataset.zoom===`in`?1.25:.8})}I(this,`[data-crop-action="rotate"]`,HTMLButtonElement).addEventListener(`click`,()=>this.rotate()),I(this,`[data-crop-action="reset"]`,HTMLButtonElement).addEventListener(`click`,()=>this.reset())}_onKey(e){if(!this._rect||e.altKey||e.ctrlKey||e.metaKey)return;let{w:t,h:n}=F(this._natural,`natural size`);if(e.key===`+`||e.key===`=`)this.zoom*=1.25,this._say();else if(e.key===`-`||e.key===`_`)this.zoom*=.8,this._say();else if((e.key===`r`||e.key===`R`)&&this.rotatable)this.rotate(),this._say();else if(e.key.startsWith(`Arrow`)){let r=e.shiftKey?E:T,i=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0,a=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0,o=L(e.target)?.dataset.handle;if(o){let e=this._rect,s=(o.endsWith(`w`)?e.x:e.x+e.w)+i*r*e.w,c=(o.startsWith(`n`)?e.y:e.y+e.h)+a*r*e.h;this._rect=m(e,o,s,c,t,n)}else this._rect=c(this._rect,i*r*this._rect.w,a*r*this._rect.h,t,n);this._paint(),this._announce(),this._say()}else return;e.preventDefault()}async toBlob({type:e,maxBytes:t=0,size:n=0}={}){if(!this._rect)return null;let r=S(e),i=F(this._natural,`natural size`),a=s(this._rect,i.w,i.h),{width:o,height:c}=n>0?g(a,n):h(a);return w((e,t,n,r)=>new Promise(i=>{let o=document.createElement(`canvas`);o.width=e,o.height=t;let s=o.getContext(`2d`);s?(n===`image/jpeg`&&(s.fillStyle=`#fff`,s.fillRect(0,0,e,t)),this._drawCrop(s,a,e,t),o.toBlob(i,n,r)):i(null)}),{width:o,height:c,type:r,maxBytes:t})}async toFile({name:e,type:t,maxBytes:n=0,size:r=0}={}){let i=await this.toBlob({type:t,maxBytes:n,size:r});return i?new File([i],C(e,i.type),{type:i.type}):null}};export{R as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./calendarMath-D6UUgYTD.js";import{t}from"./elementBase-Cxeyx0tU.js";import"./formatters-ljfITOZ3.js";import{t as n}from"./imeSafeEnter-DPs9qL3S.js";import{a as r,i,n as a,o,r as s,t as c}from"./inlineEditText-_GFrdJ6F.js";import{l}from"./wuiHttp-DGbD7Fra.js";var u=e=>i.some(t=>t===e),d=e=>c.some(t=>t===e),f=`[data-wui-display]`,p=`[data-wui-value]`,m=`[data-wui-editor]`,h=`[data-wui-control]`,g=`[data-wui-error]`,_=`[data-wui-live]`,v=`[aria-expanded="true"]`,y=/* @__PURE__ */ new Set([`select`,`date`]),b=e=>{let t=(typeof e==`object`||typeof e==`function`)&&e!==null&&`message`in e?e.message:void 0;return typeof t==`string`&&t?t:s.failed.server},x=e=>e instanceof HTMLElement&&typeof(`value`in e?e.value:void 0)==`string`,S=(e,t)=>{let n=e?.querySelector(t)??null;return n instanceof HTMLElement?n:null},C=class extends t{_wired;_editing;_busy;_draft;_pressed;_popupOpen;_savedTimer;static get observedAttributes(){return[`disabled`]}constructor(){super(),this._wired=!1,this._editing=!1,this._busy=!1,this._draft=null,this._pressed=!1,this._popupOpen=!1,this._savedTimer=null,this._onClick=this._onClick.bind(this),this._onKeyCapture=this._onKeyCapture.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onChange=this._onChange.bind(this)}connectedCallback(){this._wired||(this._wired=!0,this._grouping(),this.addEventListener(`click`,this._onClick),this.addEventListener(`auxclick`,this._onClick),this.addEventListener(`keydown`,this._onKeyCapture,!0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`change`,this._onChange))}disconnectedCallback(){clearTimeout(this._savedTimer??void 0),this._savedTimer=null,this._releasePress()}attributeChangedCallback(e){e===`disabled`&&this.hasAttribute(`disabled`)&&this.cancel()}edit(){if(this._editing||this._busy||this.hasAttribute(`disabled`))return;let e=S(this,f),t=S(this,m),n=this._control();e&&t&&n&&(this._editing=!0,this._setState(null),n.value=this._draft??this._value(),t.hidden=!1,this.setAttribute(`data-wui-editing`,``),this._focusControl(n),e.hidden=!0)}cancel(){this._editing&&(this._draft=null,this._setError(null),this.getAttribute(`data-wui-state`)===`error`&&this._setState(null),this._close())}_onClick(e){e.stopPropagation();let t=e.target instanceof Node?e.target:null;e.type===`click`&&!this._editing&&this.querySelector(f)?.contains(t)&&this.edit()}_onKeyCapture(){this._popupOpen=!!(this._editing&&this.querySelector(m)?.querySelector(v))}_onKeyDown(e){if(!this._editing){(n(e)||e.key===` `)&&e.stopPropagation();return}if(e.stopPropagation(),this._popupOpen)return;if(e.key===`Escape`){e.preventDefault(),this.cancel();return}let t=this._type();e.key!==`Enter`||y.has(t)||(t!==`textarea`||e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._commit(this._control()?.value??``))}_onFocusOut(e){if(!this._editing||this._pressed)return;let t=e.relatedTarget instanceof Node?e.relatedTarget:null;t&&this.contains(t)||document.hasFocus()&&this._commit(this._control()?.value??``)}_onPointerDown(){this._editing&&(this._pressed=!0,document.addEventListener(`pointerup`,this._onPointerUp,!0),document.addEventListener(`pointercancel`,this._onPointerUp,!0))}_onPointerUp(){this._releasePress(),setTimeout(()=>{this._pressed=!1,this._editing&&!this.contains(document.activeElement)&&document.hasFocus()&&this._commit(this._control()?.value??``)},0)}_releasePress(){document.removeEventListener(`pointerup`,this._onPointerUp,!0),document.removeEventListener(`pointercancel`,this._onPointerUp,!0)}_onChange(e){if(!this._editing||!y.has(this._type()))return;let t=this._control();t&&e.target===t&&queueMicrotask(()=>this._commit(t.value))}async _commit(e){if(!this._editing||this._busy)return;let t=this._value();if(e===t){this.cancel();return}let n=typeof this.validate==`function`?this.validate(e):null;if(n){this._setError(n),this._announce(n);return}let r=this.hasAttribute(`controlled`);this._draft=null,this._setError(null),this._busy=!0,this._setState(`saving`),this.setAttribute(`aria-busy`,`true`);let i=r?null:this._readShown();r||this._showValue(e),this._close();let o=await this._persist(e,r);this._busy=!1,this.removeAttribute(`aria-busy`);let c=this.getAttribute(`label`)||``;o.ok?(this.setAttribute(`value`,e),!r&&o.text&&this._showText(o.text,!1),this._setState(`saved`),this._savedTimer=setTimeout(()=>this._setState(null),a),this._announce(s.saved(c)),this._fire(`wui:inline-edit:saved`,{value:e,previous:t})):(i&&this._restoreShown(i),o.kind===`session`||o.kind===`aborted`?this._setState(null):(this._draft=e,this._setState(`error`),this._setError(o.message),this._announce(s.notSaved(c,o.message)),this._fire(`wui:inline-edit:failed`,{value:e,previous:t,kind:o.kind,message:o.message})))}async _persist(e,t){if(t){if(typeof this.save!=`function`)return{ok:!0};try{return await this.save(e),{ok:!0}}catch(e){return{ok:!1,kind:`server`,message:b(e)}}}let n=this.getAttribute(`action`);if(!n)return{ok:!0};let r=new URLSearchParams({[this.getAttribute(`name`)||`value`]:e}),i=await l(n,{method:`POST`,body:r});if(i.ok)return{ok:!0,text:i.html.trim()};let a=s.failed;return{ok:!1,kind:i.kind,message:i.message||a[i.kind]||s.failed.server}}_close(){let e=S(this,f),t=S(this,m),n=this.contains(document.activeElement);this._editing=!1,this.removeAttribute(`data-wui-editing`),t&&(t.hidden=!0),e&&(e.hidden=!1),S(t,v)?.click(),n&&e?.focus()}_focusControl(e){if(!y.has(this._type())){e.focus(),e.select?.();return}let t=S(e,`button`);t&&(t.focus(),t.getAttribute(`aria-expanded`)!==`true`&&t.click())}_showValue(t){if(t===``){this._showText(this.getAttribute(`placeholder`)||`-`,!0);return}let n=this._type(),i=t;if(n===`date`)i=e(t)||t;else if(n===`select`){let e=[...this._control()?.querySelectorAll(`[data-value]`)??[]].find(e=>e.getAttribute(`data-value`)===t);e&&(i=(e.textContent??``).trim())}else n===`number`&&this._grouping()===`indian`&&(i=r(t));this._showText(i,!1)}_readShown(){let e=this.querySelector(p);return e?{html:e.innerHTML,empty:e.hasAttribute(`data-wui-empty`)}:null}_restoreShown(e){let t=this.querySelector(p);t&&(t.innerHTML=e.html,t.toggleAttribute(`data-wui-empty`,e.empty))}_showText(e,t){let n=this.querySelector(p);n&&(n.textContent=e,n.toggleAttribute(`data-wui-empty`,t))}_setError(e){let t=S(this,g),n=this._control();t&&(t.textContent=e||``,t.hidden=!e),e?n?.setAttribute(`aria-invalid`,`true`):n?.removeAttribute(`aria-invalid`)}_setState(e){clearTimeout(this._savedTimer??void 0),this._savedTimer=null,e?this.setAttribute(`data-wui-state`,e):this.removeAttribute(`data-wui-state`)}_announce(e){let t=this.querySelector(_);t&&e&&(t.textContent=``,t.textContent=e)}_fire(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))}_control(){let e=this.querySelector(h);return x(e)?e:null}_value(){return this.getAttribute(`value`)??``}_type(){let e=this.getAttribute(`type`);return u(e)?e:`text`}_grouping(){let e=this.getAttribute(`grouping`)??`none`;if(!d(e))throw Error(o(e));return e}};export{C as t};
|
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./devWarn-DXdRWZs3.js";import{t as n}from"./elementBase-Cxeyx0tU.js";var r={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-soft":`#E0E7FF`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-border-strong":`#C4CADA`,"--color-surface":`#FFFFFF`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-modal":`1505`},i=e=>`var(${e}, ${r[e]})`,a=`
|
|
2
|
-
:host {
|
|
3
|
-
all: initial;
|
|
4
|
-
display: contents;
|
|
5
|
-
font-family: inherit;
|
|
6
|
-
font-size: 16px;
|
|
7
|
-
line-height: 1.5;
|
|
8
|
-
color: ${i(`--color-text`)};
|
|
9
|
-
}
|
|
10
|
-
*, *::before, *::after {
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
[hidden] {
|
|
14
|
-
display: none !important;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
dialog {
|
|
18
|
-
z-index: ${i(`--wui-z-modal`)};
|
|
19
|
-
width: 100%;
|
|
20
|
-
max-width: none;
|
|
21
|
-
height: 100%;
|
|
22
|
-
max-height: none;
|
|
23
|
-
margin: 0;
|
|
24
|
-
padding: 0;
|
|
25
|
-
border: 0;
|
|
26
|
-
background: transparent;
|
|
27
|
-
color: inherit;
|
|
28
|
-
}
|
|
29
|
-
dialog[open] {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
justify-content: center;
|
|
33
|
-
}
|
|
34
|
-
:host([preview]) dialog {
|
|
35
|
-
position: static;
|
|
36
|
-
height: auto;
|
|
37
|
-
}
|
|
38
|
-
dialog::backdrop {
|
|
39
|
-
background: rgba(0, 0, 0, 0.7);
|
|
40
|
-
backdrop-filter: blur(5px);
|
|
41
|
-
}
|
|
42
|
-
dialog[open]::backdrop {
|
|
43
|
-
animation: wlp-fade 0.3s ease-out;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.wlp-card {
|
|
47
|
-
position: relative;
|
|
48
|
-
width: 90%;
|
|
49
|
-
max-width: 440px;
|
|
50
|
-
max-height: calc(100dvh - 32px);
|
|
51
|
-
overflow-y: auto;
|
|
52
|
-
padding: 24px;
|
|
53
|
-
background: ${i(`--color-surface`)};
|
|
54
|
-
color: ${i(`--color-text`)};
|
|
55
|
-
border: 1px solid ${i(`--color-border`)};
|
|
56
|
-
border-radius: ${i(`--wui-radius-lg`)};
|
|
57
|
-
box-shadow: ${i(`--wui-shadow-modal`)};
|
|
58
|
-
text-align: start;
|
|
59
|
-
}
|
|
60
|
-
dialog[open] .wlp-card {
|
|
61
|
-
animation: wlp-card-in 0.2s ease-out;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.wlp-close {
|
|
65
|
-
position: absolute;
|
|
66
|
-
top: 12px;
|
|
67
|
-
inset-inline-end: 12px;
|
|
68
|
-
width: 32px;
|
|
69
|
-
height: 32px;
|
|
70
|
-
padding: 0;
|
|
71
|
-
border: 0;
|
|
72
|
-
border-radius: 50%;
|
|
73
|
-
background: transparent;
|
|
74
|
-
color: ${i(`--color-text-muted`)};
|
|
75
|
-
font: inherit;
|
|
76
|
-
font-size: 22px;
|
|
77
|
-
line-height: 1;
|
|
78
|
-
cursor: pointer;
|
|
79
|
-
}
|
|
80
|
-
.wlp-close:focus-visible,
|
|
81
|
-
.wlp-button:focus-visible,
|
|
82
|
-
.wlp-input:focus-visible,
|
|
83
|
-
.wlp-secondary:focus-visible {
|
|
84
|
-
outline: 2px solid ${i(`--color-primary`)};
|
|
85
|
-
outline-offset: 2px;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.wlp-heading {
|
|
89
|
-
margin: 0 32px 8px 0;
|
|
90
|
-
font-size: 20px;
|
|
91
|
-
font-weight: 600;
|
|
92
|
-
line-height: 1.3;
|
|
93
|
-
color: ${i(`--color-text`)};
|
|
94
|
-
}
|
|
95
|
-
.wlp-description {
|
|
96
|
-
margin: 0 0 16px;
|
|
97
|
-
font-size: 14px;
|
|
98
|
-
color: ${i(`--color-text-muted`)};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.wlp-form {
|
|
102
|
-
display: grid;
|
|
103
|
-
gap: 14px;
|
|
104
|
-
margin: 0;
|
|
105
|
-
}
|
|
106
|
-
.wlp-field {
|
|
107
|
-
display: grid;
|
|
108
|
-
gap: 4px;
|
|
109
|
-
}
|
|
110
|
-
.wlp-label {
|
|
111
|
-
font-size: 14px;
|
|
112
|
-
font-weight: 500;
|
|
113
|
-
color: ${i(`--color-text`)};
|
|
114
|
-
}
|
|
115
|
-
.wlp-req {
|
|
116
|
-
margin-inline-start: 2px;
|
|
117
|
-
color: ${i(`--color-primary`)};
|
|
118
|
-
}
|
|
119
|
-
.wlp-input {
|
|
120
|
-
width: 100%;
|
|
121
|
-
padding: 9px 12px;
|
|
122
|
-
border: 1px solid ${i(`--color-border`)};
|
|
123
|
-
border-radius: 8px;
|
|
124
|
-
background: ${i(`--color-surface`)};
|
|
125
|
-
color: ${i(`--color-text`)};
|
|
126
|
-
font: inherit;
|
|
127
|
-
font-size: 15px;
|
|
128
|
-
}
|
|
129
|
-
textarea.wlp-input {
|
|
130
|
-
resize: vertical;
|
|
131
|
-
min-height: 96px;
|
|
132
|
-
}
|
|
133
|
-
.wlp-input[aria-invalid="true"] {
|
|
134
|
-
border-color: var(--color-danger, #B42318);
|
|
135
|
-
}
|
|
136
|
-
.wlp-error {
|
|
137
|
-
margin: 0;
|
|
138
|
-
font-size: 13px;
|
|
139
|
-
color: var(--color-danger, #B42318);
|
|
140
|
-
}
|
|
141
|
-
.wlp-form-error {
|
|
142
|
-
margin: 0;
|
|
143
|
-
font-size: 14px;
|
|
144
|
-
color: var(--color-danger, #B42318);
|
|
145
|
-
}
|
|
146
|
-
/* The consent field uses the theme's checkbox markup; its look is restated here because the
|
|
147
|
-
theme's rules cannot reach the shadow root. */
|
|
148
|
-
.form-check {
|
|
149
|
-
display: grid;
|
|
150
|
-
grid-template-columns: auto 1fr;
|
|
151
|
-
align-items: center;
|
|
152
|
-
column-gap: 12px;
|
|
153
|
-
font-size: 14px;
|
|
154
|
-
line-height: 1.4;
|
|
155
|
-
color: ${i(`--color-text`)};
|
|
156
|
-
}
|
|
157
|
-
.form-check-input {
|
|
158
|
-
flex: none;
|
|
159
|
-
width: 20px;
|
|
160
|
-
height: 20px;
|
|
161
|
-
margin: 0;
|
|
162
|
-
appearance: none;
|
|
163
|
-
-webkit-appearance: none;
|
|
164
|
-
border: 1.6px solid ${i(`--color-border-strong`)};
|
|
165
|
-
border-radius: ${i(`--wui-radius-sm`)};
|
|
166
|
-
corner-shape: squircle;
|
|
167
|
-
background-color: ${i(`--color-surface`)};
|
|
168
|
-
background-repeat: no-repeat;
|
|
169
|
-
background-position: center;
|
|
170
|
-
background-size: 15px 15px;
|
|
171
|
-
cursor: pointer;
|
|
172
|
-
transition:
|
|
173
|
-
border-color 0.15s ease,
|
|
174
|
-
background-color 0.15s ease,
|
|
175
|
-
box-shadow 0.15s ease;
|
|
176
|
-
}
|
|
177
|
-
.form-check-input:hover:not(:checked) {
|
|
178
|
-
border-color: ${i(`--color-primary`)};
|
|
179
|
-
box-shadow: 0 0 0 2px ${i(`--color-primary-soft`)};
|
|
180
|
-
}
|
|
181
|
-
.form-check-input:checked {
|
|
182
|
-
border-color: ${i(`--color-primary`)};
|
|
183
|
-
background-color: ${i(`--color-primary`)};
|
|
184
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E");
|
|
185
|
-
}
|
|
186
|
-
.form-check-input:focus-visible {
|
|
187
|
-
outline: 2px solid ${i(`--color-primary`)};
|
|
188
|
-
outline-offset: 2px;
|
|
189
|
-
box-shadow: none;
|
|
190
|
-
}
|
|
191
|
-
.form-check-input[aria-invalid="true"] {
|
|
192
|
-
border-color: var(--color-danger, #B42318);
|
|
193
|
-
}
|
|
194
|
-
.form-check-label {
|
|
195
|
-
min-width: 0;
|
|
196
|
-
cursor: pointer;
|
|
197
|
-
}
|
|
198
|
-
.wlp-field-consent .wlp-error {
|
|
199
|
-
margin-inline-start: 32px;
|
|
200
|
-
}
|
|
201
|
-
.wlp-consent-link {
|
|
202
|
-
grid-column: 2;
|
|
203
|
-
justify-self: start;
|
|
204
|
-
color: ${i(`--color-primary-text`)};
|
|
205
|
-
font-weight: 500;
|
|
206
|
-
text-decoration: underline;
|
|
207
|
-
text-underline-offset: 3px;
|
|
208
|
-
}
|
|
209
|
-
.wlp-consent-link:focus-visible {
|
|
210
|
-
outline: 2px solid ${i(`--color-primary`)};
|
|
211
|
-
outline-offset: 2px;
|
|
212
|
-
border-radius: 4px;
|
|
213
|
-
}
|
|
214
|
-
.wlp-visually-hidden {
|
|
215
|
-
position: absolute;
|
|
216
|
-
width: 1px;
|
|
217
|
-
height: 1px;
|
|
218
|
-
margin: -1px;
|
|
219
|
-
padding: 0;
|
|
220
|
-
overflow: hidden;
|
|
221
|
-
clip: rect(0, 0, 0, 0);
|
|
222
|
-
white-space: nowrap;
|
|
223
|
-
border: 0;
|
|
224
|
-
}
|
|
225
|
-
.wlp-honeypot {
|
|
226
|
-
position: absolute !important;
|
|
227
|
-
left: -9999px !important;
|
|
228
|
-
width: 1px;
|
|
229
|
-
height: 1px;
|
|
230
|
-
opacity: 0;
|
|
231
|
-
pointer-events: none;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.wlp-actions {
|
|
235
|
-
display: flex;
|
|
236
|
-
justify-content: flex-end;
|
|
237
|
-
align-items: center;
|
|
238
|
-
gap: 8px;
|
|
239
|
-
margin-top: 4px;
|
|
240
|
-
}
|
|
241
|
-
.wlp-button {
|
|
242
|
-
display: inline-flex;
|
|
243
|
-
align-items: center;
|
|
244
|
-
justify-content: center;
|
|
245
|
-
min-height: 36px;
|
|
246
|
-
padding: 8px 16px;
|
|
247
|
-
border: 1px solid ${i(`--color-primary`)};
|
|
248
|
-
border-radius: 8px;
|
|
249
|
-
background: ${i(`--color-primary`)};
|
|
250
|
-
color: ${i(`--color-on-primary`)};
|
|
251
|
-
font: inherit;
|
|
252
|
-
font-size: 15px;
|
|
253
|
-
font-weight: 500;
|
|
254
|
-
cursor: pointer;
|
|
255
|
-
}
|
|
256
|
-
.wlp-button:hover {
|
|
257
|
-
background: ${i(`--color-primary-hover`)};
|
|
258
|
-
border-color: ${i(`--color-primary-hover`)};
|
|
259
|
-
}
|
|
260
|
-
.wlp-button:disabled {
|
|
261
|
-
opacity: 0.6;
|
|
262
|
-
cursor: default;
|
|
263
|
-
}
|
|
264
|
-
.wlp-notice {
|
|
265
|
-
margin: 4px 0 0;
|
|
266
|
-
font-size: 12px;
|
|
267
|
-
line-height: 1.4;
|
|
268
|
-
color: ${i(`--color-text-muted`)};
|
|
269
|
-
}
|
|
270
|
-
.wlp-notice a {
|
|
271
|
-
color: inherit;
|
|
272
|
-
text-decoration: underline;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.wlp-secondary-row {
|
|
276
|
-
display: flex;
|
|
277
|
-
align-items: center;
|
|
278
|
-
gap: 10px;
|
|
279
|
-
margin-top: 14px;
|
|
280
|
-
font-size: 14px;
|
|
281
|
-
color: ${i(`--color-text-muted`)};
|
|
282
|
-
}
|
|
283
|
-
.wlp-secondary-row::before,
|
|
284
|
-
.wlp-secondary-row::after {
|
|
285
|
-
content: "";
|
|
286
|
-
flex: 1;
|
|
287
|
-
height: 1px;
|
|
288
|
-
background: ${i(`--color-border`)};
|
|
289
|
-
}
|
|
290
|
-
.wlp-secondary {
|
|
291
|
-
display: block;
|
|
292
|
-
margin-top: 10px;
|
|
293
|
-
text-align: center;
|
|
294
|
-
color: ${i(`--color-primary`)};
|
|
295
|
-
font-weight: 500;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.wlp-success-title {
|
|
299
|
-
margin: 0 32px 8px 0;
|
|
300
|
-
font-size: 20px;
|
|
301
|
-
font-weight: 600;
|
|
302
|
-
color: ${i(`--color-text`)};
|
|
303
|
-
}
|
|
304
|
-
.wlp-success-text {
|
|
305
|
-
margin: 0 0 16px;
|
|
306
|
-
color: ${i(`--color-text-muted`)};
|
|
307
|
-
}
|
|
308
|
-
.wlp-success-view .wlp-button {
|
|
309
|
-
width: 100%;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
@keyframes wlp-fade {
|
|
313
|
-
from { opacity: 0; }
|
|
314
|
-
to { opacity: 1; }
|
|
315
|
-
}
|
|
316
|
-
@keyframes wlp-card-in {
|
|
317
|
-
from { opacity: 0; transform: scale(0.96); }
|
|
318
|
-
to { opacity: 1; transform: scale(1); }
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
@media (max-width: 575.98px) {
|
|
322
|
-
.wlp-card {
|
|
323
|
-
width: calc(100% - 32px);
|
|
324
|
-
max-width: none;
|
|
325
|
-
padding: 20px 16px;
|
|
326
|
-
}
|
|
327
|
-
.wlp-input {
|
|
328
|
-
font-size: 16px;
|
|
329
|
-
}
|
|
330
|
-
.wlp-button,
|
|
331
|
-
.wlp-close {
|
|
332
|
-
min-height: 44px;
|
|
333
|
-
}
|
|
334
|
-
.wlp-close {
|
|
335
|
-
min-width: 44px;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
@media (prefers-reduced-motion: reduce) {
|
|
340
|
-
dialog[open]::backdrop,
|
|
341
|
-
dialog[open] .wlp-card {
|
|
342
|
-
animation: none;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
`,o=[`name`,`email`,`phone`,`company`,`message`,`consent`],s=[`name`,`email`],c={name:`Name`,email:`Email`,phone:`Phone number`,company:`Company`,message:`Message`,consent:`I agree to be contacted about my enquiry`,consentLink:`Privacy policy`},l={name:100,email:320,phone:40,company:150,message:1e3},u={name:`name`,email:`email`,phone:`tel`,company:`organization`},d=`input:not([type=hidden]), textarea, select, button, a[href]`,f=[`exit`,`delay`,`scroll`,`pages`],p=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,m=864e5,h=`comment_subject`,g=`__RequestVerificationToken`,_=`__FormStamp`,v=`__CaptchaToken`,y=`Something went wrong. Please try again or contact us directly.`,b=`Tick the box to continue`,x=/* @__PURE__ */ `action.public-form.heading.description.fields.required.field-prefix.field-names.labels.max-lengths.submit-label.success-title.success-text.error-text.close-label.secondary-label.secondary-href.secondary-divider.consent-href.triggers.delay-seconds.scroll-percent.pages-viewed.storage-key.dismiss-days.submitted-days.success-close-seconds.preview`.split(`.`),S=/* @__PURE__ */ new Set;function C(t,n){S.has(t)||(S.add(t),e(n))}var w=0;function T(e){return(e??``).split(/\s+/).map(e=>e.trim()).filter(Boolean)}function E(e){let t={};for(let n of(e??``).split(`;`)){let e=n.indexOf(`=`);if(e<0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function D(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var O=null;function k(e){O||(O=new CSSStyleSheet,O.replaceSync(a)),e.adoptedStyleSheets=[O]}function A(e,t){return e instanceof Error&&e.message?e.message:t}function j(e){return o.some(t=>t===e)}function M(e){return f.some(t=>t===e)}function N(e,t,n){if(e instanceof t)return e;throw Error(`${n} missing`)}var P=class extends n{_uid;_rendered;_open;_opened;_posting;_stale;_armed;_session;_returnTo;_prevOverflow;_delayTimer;_closeTimer;_modal;_onMouseLeave;_onVisibility;_onScroll;static get observedAttributes(){return x}constructor(){super(),w+=1,this._uid=`wlp-${w}`,this._rendered=!1,this._open=!1,this._opened=!1,this._posting=!1,this._stale=!1,this._armed=!1,this._session=null,this._returnTo=null,this._prevOverflow=``,this._delayTimer=null,this._closeTimer=null,this._onMouseLeave=e=>{!this._fine()||e.clientY>0||!this._engaged()||this.open(`exit`)},this._onVisibility=()=>{document.visibilityState===`hidden`&&!this._fine()&&this._engaged()&&this.open(`exit`)},this._onScroll=()=>this._trackScroll()}get isOpen(){return this._open}set isOpen(e){e?this.open(`manual`):this.close(`dismiss`)}connectedCallback(){this._rendered||this._render(),this._arm(),this.preview&&!this._open&&this.open(`manual`)}disconnectedCallback(){this._disarm(),this._open&&this._release()}attributeChangedCallback(){this._rendered&&(this._open?this._stale=!0:this._render())}open(e=`manual`){if(!this._open&&!(e!==`manual`&&(this._opened||this._blocked()||document.querySelector(`dialog[open], .modal.show`)))){if(this._rendered||this._render(),this._opened=!0,this._open=!0,clearTimeout(this._delayTimer??void 0),this._showForm(),this._modal=!this.preview,this._modal){let e=document.activeElement;this._returnTo=e instanceof HTMLElement||e instanceof SVGElement?e:null,this._prevOverflow=document.documentElement.style.overflow,document.documentElement.style.overflow=`hidden`;let t=this._dialog();t.showModal();let n=t.querySelector(`[data-wlp-field] [data-wlp-input]`);n instanceof HTMLElement&&n.focus()}else this._dialog().setAttribute(`open`,``);this._remember(`shown`),this._emit(`wui-lead-popup-shown`,{trigger:e})}}close(e=`dismiss`){if(!this._open)return;clearTimeout(this._closeTimer??void 0),this._release();let t=this._returnTo;this._returnTo=null,t?.isConnected&&typeof t.focus==`function`&&t.focus(),this._stale&&this._render(),this._emit(`wui-lead-popup-closed`,{reason:e})}_release(){this._open=!1,this._dialog().close(),this._modal&&(document.documentElement.style.overflow=this._prevOverflow)}_root(){return this.shadowRoot??this.attachShadow({mode:`open`})}_dialog(){return N(this._root().querySelector(`dialog`),HTMLDialogElement,`dialog`)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}_text(e,t=``){return this.getAttribute(e)||t}_number(e,t){let n=this.getAttribute(e);if(n===null||n.trim()===``)return t;let r=Number(n);return Number.isFinite(r)&&r>=0?r:t}get preview(){return this.hasAttribute(`preview`)}set preview(e){this.toggleAttribute(`preview`,e===!0||e===``||e===`true`)}_fieldKeys(){let e=T(this.getAttribute(`fields`)).filter(e=>j(e)?!0:(C(`field:${e}`,`[@webority/ui-elements] <wui-lead-popup> has no field "${e}". It is ignored.`),!1));return e.length?e:s}_requiredKeys(){let e=this._fieldKeys();return T(this.getAttribute(`required`)).filter(t=>j(t)&&e.includes(t))}_label(e){return E(this.getAttribute(`labels`))[e]||c[e]}_postedName(e){return this._text(`field-prefix`)+(E(this.getAttribute(`field-names`))[e]||e)}_maxLength(e){let t=Number(E(this.getAttribute(`max-lengths`))[e]);return Number.isInteger(t)&&t>0?t:l[e]}_triggers(){if(this.preview)return[];let e=(this.getAttribute(`triggers`)??``).split(/\s+/).filter(M);return e.length?this.getAttribute(`storage-key`)?e:(C(`storage-key`,`[@webority/ui-elements] <wui-lead-popup> has triggers but no storage-key. The triggers are off.`),[]):[]}_render(){let e=this._root();k(e);let t=this._uid,n=this._fieldKeys(),r=new Set(this._requiredKeys()),i=this._text(`heading`),a=this._text(`description`),o=this._text(`secondary-label`),s=this._text(`secondary-href`),c=n.map(e=>this._fieldMarkup(e,r.has(e))).join(``),l=document.createElement(`template`);l.innerHTML=`
|
|
346
|
-
<dialog class="wlp-dialog" aria-labelledby="${t}-h"${a?` aria-describedby="${t}-d"`:``}>
|
|
347
|
-
<div class="wlp-card">
|
|
348
|
-
<button type="button" class="wlp-close" aria-label="${D(this._text(`close-label`,`Close`))}" data-wlp-close>×</button>
|
|
349
|
-
<div class="wlp-form-view">
|
|
350
|
-
<h2 class="wlp-heading" id="${t}-h">${D(i)}</h2>
|
|
351
|
-
${a?`<p class="wlp-description" id="${t}-d">${D(a)}</p>`:``}
|
|
352
|
-
<form class="wlp-form" novalidate data-wlp-form>
|
|
353
|
-
${c}
|
|
354
|
-
<p class="wlp-form-error" role="alert" hidden data-wlp-form-error></p>
|
|
355
|
-
<div class="wlp-actions">
|
|
356
|
-
<button type="submit" class="wlp-button" data-wlp-submit>${D(this._text(`submit-label`,`Send`))}</button>
|
|
357
|
-
</div>
|
|
358
|
-
<input type="text" name="${h}" class="wlp-honeypot" tabindex="-1" autocomplete="off" aria-hidden="true" data-wlp-honeypot>
|
|
359
|
-
<p class="wlp-notice" data-recaptcha-notice>This site is protected by reCAPTCHA and the Google <a href="https://policies.google.com/privacy" target="_blank" rel="noopener">Privacy Policy</a> and <a href="https://policies.google.com/terms" target="_blank" rel="noopener">Terms of Service</a> apply.</p>
|
|
360
|
-
</form>
|
|
361
|
-
${o&&s?`<div class="wlp-secondary-row"><span>${D(this._text(`secondary-divider`,`or`))}</span></div><a class="wlp-secondary" href="${D(s)}" data-wlp-secondary>${D(o)}</a>`:``}
|
|
362
|
-
</div>
|
|
363
|
-
<div class="wlp-success-view" hidden>
|
|
364
|
-
<h2 class="wlp-success-title" role="status" tabindex="-1" data-wlp-success-title>${D(this._text(`success-title`,`Thank you`))}</h2>
|
|
365
|
-
${this._text(`success-text`)?`<p class="wlp-success-text">${D(this._text(`success-text`))}</p>`:``}
|
|
366
|
-
<button type="button" class="wlp-button" data-wlp-done>${D(this._text(`close-label`,`Close`))}</button>
|
|
367
|
-
</div>
|
|
368
|
-
</div>
|
|
369
|
-
</dialog>`,e.replaceChildren(l.content),this._rendered=!0,this._stale=!1,this._wire()}_fieldMarkup(e,t){let n=`${this._uid}-f-${e}`,r=`${this._uid}-e-${e}`,i=this._label(e),a=D(this._postedName(e)),o=t?`<span class="wlp-req" aria-hidden="true">*</span><span class="wlp-visually-hidden">required</span>`:``,s=t?` aria-required="true"`:``;if(e===`consent`){let t=this._text(`consent-href`),c=t?`<a class="wlp-consent-link" href="${D(t)}">${D(this._label(`consentLink`))}</a>`:``;return`
|
|
370
|
-
<div class="wlp-field wlp-field-consent" data-wlp-field="${e}">
|
|
371
|
-
<div class="form-check">
|
|
372
|
-
<input class="form-check-input" type="checkbox" id="${n}" data-wlp-input="${e}" name="${a}"${s}>
|
|
373
|
-
<label class="form-check-label" for="${n}">${D(i)}${o}</label>
|
|
374
|
-
${c}
|
|
375
|
-
</div>
|
|
376
|
-
<p class="wlp-error" id="${r}" hidden></p>
|
|
377
|
-
</div>`}let c=`id="${n}" data-wlp-input="${e}" name="${a}" maxlength="${this._maxLength(e)}"${s}`,l=e===`message`?`<textarea class="wlp-input" rows="4" ${c}></textarea>`:`<input class="wlp-input" type="${e===`email`?`email`:e===`phone`?`tel`:`text`}" ${c}${u[e]?` autocomplete="${u[e]}"`:``}>`;return`
|
|
378
|
-
<div class="wlp-field" data-wlp-field="${e}">
|
|
379
|
-
<label class="wlp-label" for="${n}">${D(i)}${o}</label>
|
|
380
|
-
${l}
|
|
381
|
-
<p class="wlp-error" id="${r}" hidden></p>
|
|
382
|
-
</div>`}_wire(){let e=this._dialog();e.addEventListener(`cancel`,e=>{e.preventDefault(),this.close(`escape`)}),e.addEventListener(`click`,t=>{t.target===e&&this.close(`backdrop`)}),e.addEventListener(`keydown`,t=>{if(t.key!==`Tab`||!this._modal)return;let n=Array.from(e.querySelectorAll(d)).filter(e=>e instanceof HTMLElement&&!(`disabled`in e&&e.disabled===!0)&&e.getClientRects().length>0);if(!n.length)return;let r=this._root().activeElement,i=r instanceof HTMLElement?n.indexOf(r):-1;t.preventDefault();let a=n[i===-1?t.shiftKey?n.length-1:0:(i+(t.shiftKey?-1:1)+n.length)%n.length];if(!a)throw Error(`tab stop missing`);a.focus()});for(let t of e.querySelectorAll(`[data-wlp-close]`))t.addEventListener(`click`,()=>this.close(`dismiss`));e.querySelector(`[data-wlp-done]`)?.addEventListener(`click`,()=>this.close(`submitted`)),e.querySelector(`[data-wlp-secondary]`)?.addEventListener(`click`,()=>this.close(`secondary`)),N(e.querySelector(`[data-wlp-form]`),HTMLFormElement,`form`).addEventListener(`submit`,e=>this._onSubmit(e))}_showForm(){let e=this._root();N(e.querySelector(`.wlp-form-view`),HTMLElement,`form view`).hidden=!1,N(e.querySelector(`.wlp-success-view`),HTMLElement,`success view`).hidden=!0}_showSuccess(){let e=this._root();N(e.querySelector(`.wlp-form-view`),HTMLElement,`form view`).hidden=!0;let t=N(e.querySelector(`.wlp-success-view`),HTMLElement,`success view`);t.hidden=!1,N(e.querySelector(`[data-wlp-success-title]`),HTMLElement,`success title`).focus()}_setFieldError(e,t){let n=this._root(),r=N(n.querySelector(`[data-wlp-input="${e}"]`),HTMLElement,`${e} field`),i=N(n.querySelector(`#${this._uid}-e-${e}`),HTMLElement,`${e} error`);return i.textContent=t,i.hidden=!t,t?(r.setAttribute(`aria-invalid`,`true`),r.setAttribute(`aria-describedby`,i.id)):(r.removeAttribute(`aria-invalid`),r.removeAttribute(`aria-describedby`)),r}_validate(){let e=new Set(this._requiredKeys()),t=null,n={};for(let r of this._fieldKeys()){let i=this._root().querySelector(`[data-wlp-input="${r}"]`);if(!(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement))throw Error(`${r} field missing`);let a=r===`consent`&&i instanceof HTMLInputElement?i.checked:i.value.trim();n[r]=a;let o=``;!a&&e.has(r)?o=r===`consent`?b:`Enter your ${this._label(r).toLowerCase()}`:r===`email`&&a&&!p.test(String(a))&&(o=`Enter a valid email address`);let s=this._setFieldError(r,o);o&&!t&&(t=s)}return t?(t.focus(),null):n}_setBusy(e){this._posting=e;let t=N(this._root().querySelector(`[data-wlp-form]`),HTMLElement,`form`);e?t.setAttribute(`aria-busy`,`true`):t.removeAttribute(`aria-busy`),N(this._root().querySelector(`[data-wlp-submit]`),HTMLButtonElement,`submit button`).disabled=e}_fail(e,t){this._setBusy(!1);let n=N(this._root().querySelector(`[data-wlp-form-error]`),HTMLElement,`form error`);n.textContent=t,n.hidden=!t,this._emit(`wui-lead-popup-error`,{message:t,reason:e})}async _onSubmit(e){if(e.preventDefault(),this._posting)return;N(this._root().querySelector(`[data-wlp-form-error]`),HTMLElement,`form error`).hidden=!0;let t=this._validate();t&&!this.preview&&await this._post(t)}async _post(e){let n=globalThis.WeborityPublicForms;if(!n){C(`gate`,`[@webority/ui-elements] <wui-lead-popup> needs window.WeborityPublicForms. Load Webority.Security.Razor's public-form.js.`),this._fail(`gate`,this._text(`error-text`,y));return}let r=this._text(`error-text`,y),i=this._text(`public-form`);this._setBusy(!0);let a,o;try{a=await n.session(),o=await n.mintToken(i)}catch(e){this._fail(`gate`,A(e,r));return}let s=this._root(),c=new FormData;for(let t of this._fieldKeys())c.append(this._postedName(t),String(e[t]));c.set(g,a.token),c.set(_,a.formStamp),c.set(v,o),c.set(h,N(s.querySelector(`[data-wlp-honeypot]`),HTMLInputElement,`honeypot`).value),this._emit(`wui-lead-popup-before-submit`,{formData:c});let l;try{l=await fetch(this._text(`action`),{method:`POST`,body:c,credentials:`same-origin`,headers:{"X-Requested-With":`XMLHttpRequest`}})}catch{this._fail(`network`,r);return}let u;try{u=await this._readJson(l)}catch(e){t(`<wui-lead-popup> could not read the response body`,e),this._fail(`server`,r);return}if(l.ok)this._succeed(e,u);else{let e=typeof u==`object`&&u&&`detail`in u&&typeof u.detail==`string`?u.detail.trim():``;this._fail(`server`,e||r)}}async _readJson(e){return e.json()}_succeed(e,t){this._setBusy(!1),this._remember(`submitted`),this._emit(`wui-lead-popup-submitted`,{values:e,response:t}),this._showSuccess();let n=this._number(`success-close-seconds`,5);n>0&&(this._closeTimer=setTimeout(()=>this.close(`submitted`),n*1e3))}_arm(){if(this._armed)return;this._armed=!0;let e=this._triggers();if(!e.length)return;this._session=this._loadSession();let t=location.pathname+location.search;if(this._session.pages.includes(t)||this._session.pages.push(t),this._saveSession(),e.includes(`exit`)&&(document.documentElement.addEventListener(`mouseleave`,this._onMouseLeave),document.addEventListener(`visibilitychange`,this._onVisibility)),e.includes(`delay`)){let e=Math.max(0,this._number(`delay-seconds`,30)*1e3-(Date.now()-this._session.start));this._delayTimer=setTimeout(()=>this.open(`delay`),e)}e.includes(`scroll`)&&(window.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._trackScroll()),e.includes(`pages`)&&this._session.pages.length>this._number(`pages-viewed`,2)&&this.open(`pages`)}_disarm(){this._armed=!1,clearTimeout(this._delayTimer??void 0),clearTimeout(this._closeTimer??void 0),document.documentElement.removeEventListener(`mouseleave`,this._onMouseLeave),document.removeEventListener(`visibilitychange`,this._onVisibility),window.removeEventListener(`scroll`,this._onScroll)}_trackScroll(){let e=document.documentElement.scrollHeight;if(this._session&&e>0){let t=(window.scrollY+window.innerHeight)/e*100;t>this._session.maxScroll&&(this._session.maxScroll=t,this._saveSession()),this._session.maxScroll>this._number(`scroll-percent`,50)&&this.open(`scroll`)}}_fine(){return typeof matchMedia!=`function`||matchMedia(`(pointer: fine)`).matches}_engaged(){let e=this._session;return e?Date.now()-e.start>this._number(`delay-seconds`,30)*1e3||e.maxScroll>this._number(`scroll-percent`,50)||e.pages.length>this._number(`pages-viewed`,2):!1}_sessionKey(){return`wui-lead-popup:${this.getAttribute(`storage-key`)}`}_loadSession(){let e={start:Date.now(),maxScroll:0,pages:[]};try{let e=sessionStorage.getItem(this._sessionKey());if(e){let t=JSON.parse(e);if(Number.isFinite(t.start)&&Number.isFinite(t.maxScroll)&&Array.isArray(t.pages))return t}}catch{return e}return e}_saveSession(){try{sessionStorage.setItem(this._sessionKey(),JSON.stringify(this._session))}catch(e){if(!(e instanceof DOMException))throw e}}_readMemory(){let e=this.getAttribute(`storage-key`);if(!e)return null;try{let t=JSON.parse(localStorage.getItem(e)??`null`);if((t?.state===`shown`||t?.state===`submitted`)&&Number.isFinite(Date.parse(t.at)))return t}catch{return null}return null}_blocked(){let e=this._readMemory();if(!e)return!1;let t=e.state===`shown`?this._number(`dismiss-days`,30):this._number(`submitted-days`,365);return Date.now()-Date.parse(e.at)<t*m}_remember(e){let t=this.getAttribute(`storage-key`);if(t&&!this.preview)try{localStorage.setItem(t,JSON.stringify({state:e,at:(/* @__PURE__ */ new Date()).toISOString()}))}catch(e){if(!(e instanceof DOMException))throw e}}};export{P as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";import{f as t}from"./formatters-ljfITOZ3.js";import{t as n}from"./iconGlyphs.g-DPqoOoXy.js";import{u as r}from"./nativeOverlay-BbkCnzFj.js";var i=`a.wui-lightbox-item`,a=1,o=4,s=.5,c=2,l=50,u=6,d=300,f=300;function p(e){return Number.isFinite(e)?Math.min(o,Math.max(a,e)):a}function m(e,t,n,r){let i=(e,n)=>Math.max(0,(e*t-n)/2),a=i(r.width,n.width),o=i(r.height,n.height);return{x:Math.min(a,Math.max(-a,e.x)),y:Math.min(o,Math.max(-o,e.y))}}function h(e,t){return Math.abs(e)<l||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function g(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}function _(e,t,n={}){let r=document.createElement(e);r.className=t;for(let[e,t]of Object.entries(n))r.setAttribute(e,t);return r}function v(e,t,r){let i=_(`button`,`u-action wui-lightbox-btn ${r}`,{type:`button`,"aria-label":t,title:t});return i.style.setProperty(`--wui-action-size`,`40px`),i.innerHTML=n(e,{size:20}),i}var y=class extends e{_ui;_index;_zoom;_pan;_pointers;_gesture;_lastTap;_returnTo;_release;_onClick;static get observedAttributes(){return[`open-index`]}constructor(){super(),this._ui=null,this._index=0,this._zoom=a,this._pan={x:0,y:0},this._pointers=/* @__PURE__ */ new Map,this._gesture=null,this._lastTap=-1/0,this._returnTo=null,this._release=null,this._onClick=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=e.target,n=t instanceof Element?t.closest(i):null;if(!(n instanceof HTMLAnchorElement)||!this.contains(n))return;let r=this._links().indexOf(n);r<0||(e.preventDefault(),this.open(r))}}get _view(){if(!this._ui)throw Error(`<wui-lightbox> viewer is not open.`);return this._ui}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get label(){return this.getAttribute(`label`)||`Image viewer`}set label(e){this.setAttribute(`label`,String(e??``))}get layout(){return this.getAttribute(`layout`)===`single`?`single`:`gallery`}set layout(e){if(e===`single`)this.setAttribute(`layout`,`single`);else if(e===`gallery`||e===``)this.removeAttribute(`layout`);else throw Error(`<wui-lightbox> layout must be "gallery" or "single", received "${e}".`)}get isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick),this._syncOpenIndex()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}attributeChangedCallback(){this.isConnected&&this._syncOpenIndex()}_syncOpenIndex(){let e=this.getAttribute(`open-index`);e===null?this.close():this.open(Number(e))}_links(){return[...this.querySelectorAll(i)].filter(e=>e instanceof HTMLAnchorElement)}_items(){return this._links().map(e=>{let t=e.getAttribute(`href`)??``;return{link:e,src:t,alt:e.querySelector(`img`)?.getAttribute(`alt`)??``,caption:e.dataset.caption??``,name:e.dataset.name||g(t)}})}open(e=0){let t=this._items();if(!t.length)return!1;if(!this._ui){let t=document.activeElement;this._returnTo=t instanceof HTMLElement||t instanceof SVGElement?t:null,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))}return this._show(e,t),!0}close(){if(!this._ui)return;let e=this._index,t=this._links()[e]??this._returnTo;this._teardown(),t?.isConnected&&t.focus(),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-lightbox:close`,{bubbles:!0,detail:{index:e}}))}_teardown(){this._ui&&(this._release?.(),this._release=null,this._ui.root.open&&this._ui.root.close(),this._ui.root.remove(),this._ui=null,this._pointers.clear(),this._gesture=null)}_build(){let e=_(`dialog`,`wui-lightbox-overlay`,{role:`dialog`,"aria-label":this.label,tabindex:`-1`}),t=_(`div`,`wui-lightbox-bar`),i=_(`span`,`wui-lightbox-count`,{"aria-live":`polite`}),a=_(`div`,`wui-lightbox-tools`),o=v(`zoom-out`,`Zoom out`,`wui-lightbox-zoom-out`),c=v(`zoom-in`,`Zoom in`,`wui-lightbox-zoom-in`),l=_(`a`,`u-action wui-lightbox-btn wui-lightbox-download`,{"aria-label":`Download`,title:`Download`});l.style.setProperty(`--wui-action-size`,`40px`),l.innerHTML=n(`download`,{size:20}),l.hidden=!this.download;let u=v(`x`,`Close`,`wui-lightbox-close`);a.append(o,c,l,u),t.append(i,a);let d=_(`div`,`wui-lightbox-stage`),f=v(`chevron-left`,`Previous image`,`wui-lightbox-nav wui-lightbox-prev`),p=v(`chevron-right`,`Next image`,`wui-lightbox-nav wui-lightbox-next`),m=_(`img`,`wui-lightbox-image`,{decoding:`async`,draggable:`false`,alt:``}),h=_(`p`,`wui-lightbox-status`,{role:`status`});d.append(m,h,f,p);let g=_(`p`,`wui-lightbox-caption`);e.append(t,d,g);let y={root:e,count:i,zoomOut:o,zoomIn:c,download:l,close:u,stage:d,prev:f,next:p,image:m,status:h,caption:g};this._ui=y,u.addEventListener(`click`,()=>this.close()),f.addEventListener(`click`,()=>this.step(-1)),p.addEventListener(`click`,()=>this.step(1)),o.addEventListener(`click`,()=>this._setZoom(this._zoom-s)),c.addEventListener(`click`,()=>this._setZoom(this._zoom+s)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),d.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),d.addEventListener(`pointermove`,e=>this._onPointerMove(e)),d.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),d.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),d.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),m.addEventListener(`load`,()=>{this._ui===y&&(h.textContent=``,d.removeAttribute(`aria-busy`),m.hidden=!1,this._applyTransform())}),m.addEventListener(`error`,()=>{this._ui===y&&(d.removeAttribute(`aria-busy`),m.hidden=!0,h.textContent=`This image can't be shown.`)}),this.append(e),this._release=r(e,{escape:!0,backdrop:!1,focus:`panel`,onRequestClose:()=>this.close()})}step(e){if(!this._ui||!e)return;let t=this._items();t.length<2||this._show((this._index+e+t.length)%t.length,t)}_show(e,n){let r=this._view,i=Math.min(n.length-1,Math.max(0,Math.trunc(Number(e))||0)),o=n[i];if(!o)throw Error(`<wui-lightbox> image missing.`);let s=i!==this._index||!r.image.getAttribute(`src`);if(this._index=i,this._zoom=a,this._pan={x:0,y:0},r.count.textContent=`${t(i+1,{decimals:0})} of ${t(n.length,{decimals:0})}`,r.caption.textContent=o.caption,r.caption.hidden=!o.caption,r.download.href=o.src,r.download.setAttribute(`download`,o.name),r.prev.hidden=r.next.hidden=n.length<2,r.stage.setAttribute(`aria-busy`,`true`),r.status.textContent=``,r.image.hidden=!1,r.image.alt=o.alt||o.caption,r.image.src=o.src,this._applyTransform(),this._syncZoomButtons(),n.length>1){let e=n[(i+1)%n.length],t=n[(i-1+n.length)%n.length];if(!e||!t)throw Error(`<wui-lightbox> neighbour image missing.`);for(let n of[e,t])new Image().src=n.src}s&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:i}}))}_syncZoomButtons(){let e=this._view;e.zoomOut.disabled=this._zoom<=a,e.zoomIn.disabled=this._zoom>=o;let t=document.activeElement;(t===e.zoomOut||t===e.zoomIn)&&t instanceof HTMLButtonElement&&t.disabled&&e.close.focus()}_setZoom(e){this._ui&&(this._zoom=p(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._view;return m(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._view;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>a)}_onKeyDown(e){if(e.key===`ArrowLeft`||e.key===`ArrowRight`)e.preventDefault(),this.step(e.key===`ArrowRight`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=this._items();this._show(e.key===`Home`?0:t.length-1,t)}else e.key===`+`||e.key===`=`?(e.preventDefault(),this._setZoom(this._zoom+s)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-s)):e.key===`0`&&(e.preventDefault(),this._setZoom(a))}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){let t=e.target;if(t instanceof Element&&t.closest(`.wui-lightbox-nav`))return;let n=this._view;if(n.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let e=[...this._pointers.values()],t=e[0],n=e[1];if(!t||!n)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._gesture={kind:`pinch`,distance:Math.hypot(t.x-n.x,t.y-n.y)||1,zoom:this._zoom}}else this._pointers.size===1&&(this._gesture={kind:`drag`,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,pan:{...this._pan},onImage:e.target===n.image,moved:!1})}_onPointerMove(e){let t=this._gesture;if(t&&this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.kind===`pinch`&&this._pointers.size===2){let e=[...this._pointers.values()],n=e[0],r=e[1];if(!n||!r)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._setZoom(t.zoom*Math.hypot(n.x-r.x,n.y-r.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>u&&(t.moved=!0),this._zoom>a&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._view.stage.classList.add(`is-dragging`),this._applyTransform())}}}_onPointerEnd(e,t){let n=this._gesture;if(this._pointers.delete(e.pointerId),this._ui?.stage.classList.remove(`is-dragging`),!n)return;if(n.kind===`pinch`){this._pointers.size<2&&(this._gesture=null);return}if(this._gesture=null,!t)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved?this._zoom===a&&this.step(h(r,i)):e.timeStamp-n.startTime>d||(n.onImage?e.timeStamp-this._lastTap<f?(this._lastTap=-1/0,this._setZoom(this._zoom>a?a:c)):this._lastTap=e.timeStamp:this.close())}};export{y as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";import{n as t,r as n,t as r}from"./fieldState-D-zQcXUS.js";import{f as i}from"./formatters-ljfITOZ3.js";import{t as a}from"./imeSafeEnter-DPs9qL3S.js";import{n as o}from"./listboxKeyNav-CF7tMDGG.js";import{i as s,n as c,r as l,t as u}from"./mentionText-BJsw_opZ.js";import{a as d,l as f,s as p}from"./nativeOverlay-BbkCnzFj.js";import{l as m}from"./wuiHttp-DGbD7Fra.js";var h=8,g=40,_=Object.freeze({listName:`People`,searching:`Searching…`,noMatch:`No one matches`,searchFailed:`Couldn't load people. Keep typing to try again.`,found:e=>`${e===1?`1 person`:`${i(e,{decimals:0})} people`}. Up and down to choose, Enter to mention.`,mentioned:e=>`Mentioned ${e}.`}),v=`[data-wui-control]`,y=`[data-wui-field]`,b=`[data-wui-menu]`,x=`[data-wui-live]`,S=0,C=e=>!!(e&&u.test(String(e.value??``))&&c(e.label)!==``);function w(e,t){let n=e.getAttribute(`size`);t.classList.toggle(`input-sm`,n===`sm`),t.classList.toggle(`input-lg`,n===`lg`)}function T(e,n){n.readOnly=t(e)||e.hasAttribute(`loading`)}function E(e){let t=e.ownerDocument;e.id||=`wui-mention-${++S}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control textarea wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),T(e,n),w(e,n),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,e.getAttribute(`people-label`)??_.listName),o.setAttribute(`data-wui-menu`,``),o.setAttribute(`popover`,`manual`),e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var D=class extends e{_wired;_pendingValue;_text;_mentions;_peopleProp;_declared;_loading;_searchFailed;_query;_results;_active;_timer;_searchSeq;_lastSearch;_abort;_onMenuDown;static get observedAttributes(){return[`disabled`,`readonly`,`loading`,`size`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._searchFailed=!1,this._query=null,this._results=[],this._active=-1,this._timer=void 0,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this)}connectedCallback(){for(let e of[`people`,`loading`,`searchFailed`,`value`])if(Object.hasOwn(this,e)){let t=Reflect.get(this,e);Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}if(this._wired)return;this._wired=!0,this.querySelector(v)||E(this);let e=this._requireControl(),t=this.querySelector(y)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,this._syncState(),e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._requireMenu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target instanceof Element?e.target.closest(`.wui-mention-option`):null;t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):e===`readonly`?(T(this,r),n!==null&&this._close(),this._syncState()):e===`loading`?(T(this,r),this._syncState(),this._query!==null&&this._renderMenu()):e===`size`?w(this,r):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return s(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);this._wired?t!==this.value&&this._load(t):this._pendingValue=t}get mentions(){let e=/* @__PURE__ */ new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(C):[],this._searchFailed=!1,(this._isOpen()||this._query!==null)&&this._refresh()}get searchFailed(){return this._searchFailed}set searchFailed(e){this._searchFailed=!!e,this._query!==null&&this._renderMenu()}get loading(){return this._loading||this.hasAttribute(`loading`)}set loading(e){this._loading=!!e,this.toggleAttribute(`loading`,this._loading),this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(v)}_menu(){return this.querySelector(b)}_requireControl(){let e=this._control();if(!e)throw Error(`<wui-mention-input> has no text box.`);return e}_requireMenu(){let e=this._menu();if(!e)throw Error(`<wui-mention-input> has no people list.`);return e}_load(e){let{text:t,mentions:n}=l(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(y);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._requireControl(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e instanceof KeyboardEvent&&e.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();t?this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh()):this._close()}_queryAtCaret(){let e=this._control();if(!e||r(this)||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,i=n.lastIndexOf(`@`,t-1);if(i<0||i>0&&!/[\s([{"'“‘]/.test(n.charAt(i-1)))return null;let a=n.slice(i+1,t);return a.length>40||/[\n@]/.test(a)||/^\s/.test(a)||/\s{2}/.test(a)||this._mentions.some(e=>i>=e.start&&i<e.end)?null:{start:i,end:t,text:a}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>c(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);n?this._fetchPeople(n,e,t):this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}))},this._debounce())}async _fetchPeople(e,t,n){this._abort?.abort();let r=new AbortController;this._abort=r,this.loading=!0;let i=`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,a=await m(i,{signal:r.signal});if(n!==this._searchSeq)return;if(this._abort=null,!a.ok){this._peopleProp=[],this._searchFailed=!0,this.loading=!1,this._refresh();return}this._searchFailed=!1;let o=this.ownerDocument.createElement(`template`);o.innerHTML=a.html,this._peopleProp=[...o.content.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(C),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return e!==null&&p(e)}_renderMenu(){let e=this._menu(),t=this._control();if(!e||!t||!this._query)return;this._syncState();let n=this.ownerDocument;if(e.replaceChildren(),this._results.forEach((t,r)=>{let i=n.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${e.id}-${r}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(r),t.src){let e=n.createElement(`img`);e.className=`wui-mention-option-photo`,e.src=t.src,e.alt=``,i.appendChild(e)}let a=n.createElement(`span`);a.className=`wui-mention-option-text`;let o=n.createElement(`span`);if(o.className=`wui-mention-option-label`,o.textContent=c(t.label),a.appendChild(o),t.description){let e=n.createElement(`span`);e.className=`wui-mention-option-description`,e.textContent=String(t.description),a.appendChild(e)}i.appendChild(a),e.appendChild(i)}),!this._results.length){let t=n.createElement(`div`);t.className=`wui-mention-empty`,t.textContent=this.loading?_.searching:this._searchFailed?_.searchFailed:`${_.noMatch} “${this._query.text}”`,e.appendChild(t)}f(t,e,{mode:`manual`}),this._setActive(this._results.length?0:-1),this.loading||this._announce(this._results.length?_.found(this._results.length):this._searchFailed?_.searchFailed:`${_.noMatch}.`)}_syncState(){let e=this._control();e&&n(this,e)}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();if(e){let t=p(e);d(e),t&&e.replaceChildren()}this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`)}_setActive(e,{reveal:t=!0}={}){let n=this._requireMenu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]??null:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);o(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._requireControl().setAttribute(`aria-activedescendant`,i.id)):this._requireControl().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if((a(e)||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}a(e)&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}))):e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._requireControl();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target instanceof Element?e.target.closest(`.wui-mention-option`):null;t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=c(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),a=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,a,{id:String(e.value),label:t}),this._announce(_.mentioned(t))}_replace(e,t,n,r){let i=this._requireControl(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(x);t&&(t.textContent=``,t.textContent=e)}};export{D as i,h as n,_ as r,g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./dom-Do1pAA12.js";import{t}from"./elementBase-Cxeyx0tU.js";import{a as n,l as r,m as i,s as a}from"./nativeOverlay-BbkCnzFj.js";import{c as o,i as s,n as c,s as l}from"./notificationDays-BIWczft0.js";import{l as u}from"./wuiHttp-DGbD7Fra.js";var d=`.wui-notification-center-trigger`,f=`.wui-notification-center-panel`,p=`.wui-notification-center-count`,m=`.wui-notification-center-live`,h=`.wui-notification-center-markall`,g=`.wui-notification-center-item`,_=`wui-notification-center-item-read`,v=`.wui-notification-center-unread-label`,y=`.app-tabs`,b=`.wui-notification-center-tabs [role='tablist']`,x=`.wui-notification-center-tabs [role='tab']`,S=`.wui-notification-center-empty`,C=`(max-width: 767.98px)`,w={ArrowDown:1,ArrowUp:-1,Home:`first`,End:`last`},T=e=>!!e,E=e=>Object.hasOwn(c.failed,e),D=(e,t)=>{let n=e.querySelector(t);return n instanceof HTMLElement?n:null},O=(e,t)=>[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement),k=class extends t{constructor(){super(),this._unread=0,this._busy=!1,this._sheet=!1,this._awaitChildren=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onToggle=e=>{e.type===`toggle`&&`newState`in e&&e.newState===`closed`&&this._closedByBrowser()},this._onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&!this.contains(t)&&this.close()}}static get observedAttributes(){return[`open`]}connectedCallback(){this._unread=this._initialUnread(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`toggle`,this._onToggle,!0),this.isOpen&&(D(this,f)===null||D(this,d)===null)?(this._awaitChildren=new MutationObserver(()=>this._finishAwaitedOpen()),this._awaitChildren.observe(this,{childList:!0})):(this._syncOpen(),this.isOpen&&this._showPanel())}disconnectedCallback(){this._disarmAwait(),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`toggle`,this._onToggle,!0);let e=D(this,f);e&&n(e)}attributeChangedCallback(e,t,n){e===`open`&&t!==n&&(this._awaitChildren?n===null&&this._disarmAwait():this.isConnected&&(n===null?this._hidePanel():this._showPanel()))}_finishAwaitedOpen(){D(this,f)!==null&&D(this,d)!==null&&(this._disarmAwait(),this._syncOpen(),this._showPanel())}_disarmAwait(){this._awaitChildren?.disconnect(),this._awaitChildren=null}_showPanel(){let t=e(D(this,f),`<wui-notification-center> needs its panel to open.`),n=e(D(this,d),`<wui-notification-center> needs its trigger to open.`);a(t)||(this._sheet=window.matchMedia(C).matches,this._sheet?i(t,!0):r(n,t,{mode:`auto`,onClosed:()=>this._closedByBrowser()}),a(t)&&this._layoutTabs())}_hidePanel(){let e=D(this,f);e&&a(e)&&(this._sheet?i(e,!1):n(e))}_closedByBrowser(){if(!this.isConnected||!this.hasAttribute(`open`))return;let e=D(this,f);this.close({restoreFocus:e?.contains(this.ownerDocument.activeElement)??!1})}get isOpen(){return this.hasAttribute(`open`)}open(){this.isOpen||(e(D(this,f),`<wui-notification-center> needs its panel to open.`),e(D(this,d),`<wui-notification-center> needs its trigger to open.`),this.setAttribute(`open`,``),this._syncOpen(),D(this,f)?.focus(),this._announceToggle())}close({restoreFocus:e=!1}={}){this.isOpen&&(this.removeAttribute(`open`),this._syncOpen(),e&&D(this,d)?.focus(),this._announceToggle())}toggle(){this.isOpen?this.close():this.open()}_announceToggle(){this.dispatchEvent(new CustomEvent(`wui:notification-center:toggle`,{bubbles:!0,detail:{open:this.isOpen}}))}_syncOpen(){this.querySelector(d)?.setAttribute(`aria-expanded`,this.isOpen?`true`:`false`)}_initialUnread(){let e=Number.parseInt(this.getAttribute(`unread`)??``,10);return Number.isInteger(e)&&e>=0?e:this.querySelectorAll(`${g}:not(.${_}):not([data-archived="true"])`).length}_click(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(x);if(n instanceof HTMLElement&&this.contains(n)){if(this.hasAttribute(`controlled`))return;this._pickTab(n);return}let r=t.closest(`${d}, ${h}, ${g}`);r instanceof HTMLElement&&this.contains(r)&&(r.matches(d)?this.toggle():this.hasAttribute(`controlled`)||(r.matches(h)?this._markAll():this._markItem(r)))}_key(e){if(!this.isOpen)return;let t=e.target;if(!(t instanceof Element))throw Error(`Keyboard event target is not an element.`);if(!this.querySelector(f)?.contains(t)||t.closest(y))return;let n=w[e.key];if(n===void 0)return;let r=O(this,g).filter(e=>!e.closest(`[hidden]`));if(r.length===0)return;let i=t.closest(g),a=i instanceof HTMLElement?r.indexOf(i):-1,o;o=n===`first`?0:n===`last`?r.length-1:a===-1?n===1?0:r.length-1:Math.min(r.length-1,Math.max(0,a+n)),e.preventDefault(),r[o]?.focus()}_markItem(e){e.classList.contains(_)||(this._applyRead(e),e.dataset.archived!==`true`&&(this._unread=Math.max(0,this._unread-1)),this._render(),this._say(o(this._unread)),this._emitRead([e.dataset.id].filter(T),!1))}async _markAll(){if(this._busy)return;let e=O(this,`${g}:not(.${_})`);if(e.length===0&&this._unread===0)return;let t=e.map(e=>e.dataset.id).filter(T),n=this.getAttribute(`read-action`);if(n){this._setBusy(!0);let e=new URLSearchParams;for(let n of t)e.append(`ids`,n);let r=await u(n,{method:`POST`,body:e});if(this._setBusy(!1),!r.ok){if(r.kind===`session`||r.kind===`aborted`)return;let e=r.kind,t=r.message||(E(e)?c.failed[e]:c.failed.server);this._say(t),this.dispatchEvent(new CustomEvent(`wui:notification-center:failed`,{bubbles:!0,detail:{kind:e,message:t}}));return}}for(let t of e)this._applyRead(t);this._unread=0,this._render(),this._say(c.allRead),this._emitRead(t,!0)}_pickTab(e){let t=e.closest(b);if(t instanceof HTMLElement){for(let n of O(t,x)){let t=n===e;n.classList.toggle(`active`,t),n.setAttribute(`aria-selected`,t?`true`:`false`),n.setAttribute(`tabindex`,t?`0`:`-1`)}this._layoutTabs(),this._filterItems(e.dataset.key)}}_layoutTabs(){for(let e of O(this,b)){let t=D(e,`.app-tab.active`);t&&(e.style.setProperty(`--wui-tab-x`,`${t.offsetLeft}px`),e.style.setProperty(`--wui-tab-w`,`${t.offsetWidth}px`)),e.setAttribute(`data-wui-tabs`,``)}}_filterItems(e){let t=!1;for(let n of O(this,g)){let r=n.dataset.archived===`true`,i=n.classList.contains(_),a=e===`archived`?r:!r&&(e!==`unread`||!i);a&&(t=!0);let o=n.closest(`li`);o&&(o.hidden=!a)}for(let e of O(this,`.wui-notification-center-list section`))e.hidden=[...e.querySelectorAll(`li`)].every(e=>e.hidden);let n=D(this,S);n&&(n.hidden=t)}_applyRead(e){e.classList.add(_),e.querySelector(v)?.remove()}_setBusy(e){this._busy=e;let t=this.querySelector(h);t instanceof HTMLButtonElement&&(t.disabled=e||this._unread===0,e?t.setAttribute(`aria-busy`,`true`):t.removeAttribute(`aria-busy`))}_render(){let e=D(this,p);e&&(e.textContent=s(this._unread),e.hidden=this._unread===0),this.querySelector(d)?.setAttribute(`aria-label`,l(this.getAttribute(`label`)||c.label,this._unread));let t=this.querySelector(h);t instanceof HTMLButtonElement&&(t.disabled=this._unread===0)}_say(e){let t=this.querySelector(m);t&&(t.textContent=e)}_emitRead(e,t){this.dispatchEvent(new CustomEvent(`wui:notification-center:read`,{bubbles:!0,detail:{ids:e,all:t}}))}};export{k as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./devWarn-DXdRWZs3.js";import{t}from"./elementBase-Cxeyx0tU.js";var n=`li[data-wui-org-node]`,r=`:scope > .wui-org-tree-node`,i=`:scope > .wui-org-tree-node > .wui-org-tree-text > .wui-org-tree-name`,a=`:scope > .wui-org-tree-children`,o=`:scope > .wui-org-tree-node > [data-wui-org-toggle]`,s=`[data-wui-org-toggle]`,c=`a, button, input, select, textarea`,l=`.wui-org-tree-overlay`,u=`[data-wui-org-search]`,d=`[data-wui-org-canvas]`,f=`[data-wui-org-live]`,p=`--wui-org-tree-print-scale`,m=718,h=1e3,g=150,_=`Show {name}'s team`,v=`Hide {name}'s team`,y=`{count} found`,b=`No one found`,x=e=>[...e.querySelectorAll(n)].filter(e=>e instanceof HTMLElement),S=e=>e.querySelector(i)?.textContent?.trim()??``,C=e=>e.getAttribute(`data-wui-org-node`),w=e=>e.getAttribute(`aria-expanded`)===`true`,T=class extends t{static get observedAttributes(){return[`selected`,`selectable`,`expand-label`,`collapse-label`,`search-results-text`,`search-empty-text`]}constructor(){super(),this._query=``,this._snapshot=null,this._observer=null,this._announceTimer=void 0,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>this._handleFocusIn(e),this._onInput=e=>this._handleInput(e),this._onBeforePrint=()=>this._scaleForPrint(),this._onAfterPrint=()=>this.style.removeProperty(p)}connectedCallback(){this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`input`,this._onInput),window.addEventListener(`beforeprint`,this._onBeforePrint),window.addEventListener(`afterprint`,this._onAfterPrint);let t=this.querySelector(d);t?(this._observer=new MutationObserver(()=>{this._query&&this._applySearch(this._query)}),this._observer.observe(t,{childList:!0,subtree:!0})):e(`[@webority/ui-elements] <wui-org-tree> has no [data-wui-org-canvas]; render the tree markup inside it.`)}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`input`,this._onInput),window.removeEventListener(`beforeprint`,this._onBeforePrint),window.removeEventListener(`afterprint`,this._onAfterPrint),this._observer?.disconnect(),this._observer=null,clearTimeout(this._announceTimer)}attributeChangedCallback(e){e===`selected`||e===`selectable`?this._applySelected():(e===`expand-label`||e===`collapse-label`)&&this._syncToggles()}get selected(){return this.getAttribute(`selected`)}set selected(e){e==null?this.removeAttribute(`selected`):this.setAttribute(`selected`,String(e))}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,!!e)}_items(){return x(this)}_hasChildren(e){return!!e.querySelector(a)}_isVisible(e){for(let t=e;t&&t!==this;t=t.parentElement)if(t.hasAttribute(`hidden`))return!1;return!0}_visibleItems(){return this._items().filter(e=>this._isVisible(e))}_parentItem(e){let t=e.parentElement?.closest(n);return t instanceof HTMLElement&&this.contains(t)?t:null}_visibleChildren(e){let t=e.querySelector(a);return t?[...t.children].filter(e=>e.matches(n)&&this._isVisible(e)):[]}_isVisibleItem(e){return e instanceof HTMLElement&&e.matches(n)&&this._isVisible(e)}_siblingItem(e,t){let n=e[t];for(;n&&!this._isVisibleItem(n);)n=n[t];return this._isVisibleItem(n)?n:null}_setRoving(e){for(let t of this._items())t.setAttribute(`tabindex`,t===e?`0`:`-1`)}_focusItem(e){e&&(this._setRoving(e),e.focus())}_toggleLabel(e,t){return(t?this.getAttribute(`collapse-label`)??v:this.getAttribute(`expand-label`)??_).split(`{name}`).join(S(e))}_setExpanded(e,t){let n=e.querySelector(a);n instanceof HTMLElement&&(e.setAttribute(`aria-expanded`,String(t)),n.hidden=!t,e.querySelector(o)?.setAttribute(`aria-label`,this._toggleLabel(e,t)),!t&&n.contains(document.activeElement)&&this._focusItem(e))}_toggle(e){this._setExpanded(e,!w(e))}_syncToggles(){for(let e of this._items())this._hasChildren(e)&&this._setExpanded(e,w(e))}_applySelected(){for(let e of this._items())this.selectable?e.setAttribute(`aria-selected`,String(C(e)===this.selected)):e.removeAttribute(`aria-selected`)}_select(e){this.selectable&&(this.selected=C(e),this.dispatchEvent(new CustomEvent(`wui-org-tree:select`,{detail:{id:this.selected},bubbles:!0,composed:!0})))}_activate(e){this.selectable?this._select(e):this._hasChildren(e)&&this._toggle(e)}_handleFocusIn(e){let t=e.target;if(!(t instanceof Element))return;let r=t.closest(n);r instanceof HTMLElement&&this.contains(r)&&this._setRoving(r)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let i=t.closest(n);i instanceof HTMLElement&&this.contains(i)&&(this._setRoving(i),t.closest(s)?this._hasChildren(i)&&this._toggle(i):i.querySelector(r)?.contains(t)&&(t.closest(c)?.closest(l)||this._select(i)))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=e.target;if(t instanceof HTMLElement&&t.matches(n)&&this.contains(t))switch(e.key){case`ArrowDown`:if(e.preventDefault(),!this._hasChildren(t))return;w(t)||this._setExpanded(t,!0),this._focusItem(this._visibleChildren(t)[0]);return;case`ArrowUp`:e.preventDefault(),this._focusItem(this._parentItem(t));return;case`ArrowRight`:e.preventDefault(),this._focusItem(this._siblingItem(t,`nextElementSibling`));return;case`ArrowLeft`:e.preventDefault(),this._focusItem(this._siblingItem(t,`previousElementSibling`));return;case`Home`:e.preventDefault(),this._focusItem(this._visibleItems()[0]);return;case`End`:e.preventDefault(),this._focusItem(this._visibleItems().at(-1));return;case`+`:case`=`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!0);return;case`-`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!1);return;case`Enter`:case` `:e.preventDefault(),this._activate(t);return}}_handleInput(e){let t=e.target;t instanceof HTMLInputElement&&t.matches(u)&&this._search(t.value.trim().toLocaleLowerCase())}_search(e){clearTimeout(this._announceTimer),e?(this._snapshot||=this._captureExpanded(),this._query=e,this._applySearch(e),this._announceTimer=window.setTimeout(()=>this._announce(this._resultText()),g)):(this._snapshot&&this._restore(this._snapshot),this._snapshot=null,this._query=``,this._announce(``))}_captureExpanded(){return new Map(this._items().filter(e=>this._hasChildren(e)).map(e=>[C(e),w(e)]))}_restore(e){for(let t of this._items()){t.hidden=!1,t.classList.remove(`wui-org-tree-match`);let n=C(t);e.has(n)&&this._setExpanded(t,e.get(n)??!1)}}_applySearch(e){let t=this._items(),n=new Set(t.filter(t=>S(t).toLocaleLowerCase().includes(e))),r=new Set(n);for(let e of n)for(let t=this._parentItem(e);t;t=this._parentItem(t))r.add(t),w(t)||this._setExpanded(t,!0);for(let e of t)e.classList.toggle(`wui-org-tree-match`,n.has(e)),e.hidden=!r.has(e);let i=t.filter(e=>r.has(e)),a=i[0];a&&!i.some(e=>e.getAttribute(`tabindex`)===`0`)&&this._setRoving(a)}_resultText(){let e=this._items().filter(e=>e.classList.contains(`wui-org-tree-match`)).length;return e===0?this.getAttribute(`search-empty-text`)??b:(this.getAttribute(`search-results-text`)??y).split(`{count}`).join(String(e))}_announce(e){let t=this.querySelector(f);t&&(t.textContent=e)}_scaleForPrint(){let e=this.querySelector(d);if(!(e instanceof HTMLElement))return;let t=Math.min(1,m/e.scrollWidth,h/e.scrollHeight);this.style.setProperty(p,String(t))}};export{T as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./anchorOverlay-B8fu8hjz.js";import{t as r}from"./elementBase-Cxeyx0tU.js";var i=`data-wui-overflow-hidden`,a=`[aria-selected="true"], .active`,o=`.chip-body, input, a[href], button:not(.chip-remove)`,s=1,c=`data-wui-overflow-menu`,l=`[aria-haspopup], [data-wui-dropdown-trigger]`,u=0,d=e=>Number.parseFloat(e)||0,f=e=>e.nodeType===1,p=e=>{let t=e.getAttribute(`data-overflow-label`);if(t)return t;let n=[],r=e=>{for(let t of e.childNodes)if(t.nodeType===3){let e=t.textContent?.trim();e&&n.push(e)}else f(t)&&!t.matches(`svg, img, [aria-hidden='true'], [data-wui-dropdown-menu]`)&&r(t)};if(r(e),n.length)return n.join(` `);let i=m(e)??e;return i.getAttribute(`aria-label`)||e.getAttribute(`aria-label`)||i.title||e.title},m=e=>{if(e.matches(`button, a[href], label, input`))return e;let t=e.querySelector(o);return t instanceof HTMLElement?t:null},h=e=>{let t=m(e);return t?.matches(l)?t:null},g=class extends r{constructor(){super(),this._hiddenKey=``,this._ro=null,this._mo=null,this._observedList=null,this._doc=null,this._onDocDown=e=>{!this._menu.hidden&&!e.composedPath().includes(this)&&this._close(!1)}}connectedCallback(){this.classList.add(`wui-overflow`),this._build(),this._doc=this.ownerDocument,this._doc.addEventListener(`pointerdown`,this._onDocDown,!0),typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this.layout()),this._ro.observe(this)),typeof MutationObserver<`u`&&(this._mo=new MutationObserver(()=>this.layout()),this._watch()),this.layout()}disconnectedCallback(){this._ro?.disconnect(),this._mo?.disconnect(),this._ro=null,this._mo=null,this._observedList=null,this._doc?.removeEventListener(`pointerdown`,this._onDocDown,!0),this._doc=null,t(this)}static get observedAttributes(){return[`label`]}attributeChangedCallback(){let e=this._more?.firstChild;e&&(e.textContent=this._label())}_label(){return this.getAttribute(`label`)||`More`}_list(){let e=this.querySelector(`[data-wui-overflow-list]`);return e instanceof HTMLElement?e:null}_items(e){return[...e.children].filter(e=>!e.hasAttribute(`data-wui-overflow-skip`))}_build(){if(this._more)return;let e=`wui-overflow-menu-${++u}`,t=this.ownerDocument.createElement(`button`);t.type=`button`,t.className=`wui-overflow-more`,t.hidden=!0,t.setAttribute(`aria-haspopup`,`menu`),t.setAttribute(`aria-expanded`,`false`),t.setAttribute(`aria-controls`,e),t.append(this._label());let n=this.ownerDocument.createElement(`div`);n.className=`wui-overflow-menu`,n.id=e,n.setAttribute(`role`,`menu`),n.hidden=!0,this.append(t,n),this._more=t,this._menu=n,t.addEventListener(`click`,()=>this._menu.hidden?this._open(!1):this._close(!0)),t.addEventListener(`keydown`,e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),this._open(!0))}),n.addEventListener(`keydown`,e=>this._onMenuKey(e))}_watch(){let e=this._list();this._mo&&e!==this._observedList&&(this._mo.disconnect(),this._observedList=e,e&&this._mo.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`class`,`aria-selected`,`disabled`,`aria-disabled`,`data-overflow-label`]}))}layout(){let e=this._list();if(this._watch(),!e||!this._more)return;let t=this._items(e);for(let e of t)e.removeAttribute(i),e.removeAttribute(c);this._more.hidden=!0;let n=this.clientWidth,r=[];if(t.length&&n<=0&&this.getClientRects().length>0)r=t;else if(n>0&&t.length){let i=getComputedStyle(e),o=d(i.columnGap),c=d(i.paddingLeft)+d(i.paddingRight)+d(i.borderLeftWidth)+d(i.borderRightWidth),l=t.map(e=>e.offsetWidth);if(l.reduce((e,t)=>e+t,0)+o*(t.length-1)>n-c+s){this._more.hidden=!1;let e=n-c-this._more.offsetWidth-d(getComputedStyle(this).columnGap),i=this.hasAttribute(`keep`)?this.getAttribute(`keep`):a,s=/* @__PURE__ */ new Set,u=0,f=0,p=i?t.filter(e=>e.matches(i)):[];for(let n of p){let r=u+(l[t.indexOf(n)]??0)+(f?o:0);r>e||(s.add(n),u=r,f+=1)}for(let n=0;n<t.length;n+=1){let r=t[n];if(!r||s.has(r))continue;let i=u+(l[n]??0)+(f?o:0);if(i>e)break;s.add(r),u=i,f+=1}r=t.filter(e=>!s.has(e))}}for(let e of r)e.setAttribute(i,``),h(e)&&e.setAttribute(c,``);this._more.hidden=r.length===0,r.length?this._menu.hidden||this._fill(r):this._close(!1);let o=r.map(e=>t.indexOf(e)).join(`,`);o!==this._hiddenKey&&(this._hiddenKey=o,this.dispatchEvent(new CustomEvent(`wui-overflow-change`,{bubbles:!0,detail:{hidden:r.length}})))}_hiddenItems(){let e=this._list();return e?this._items(e).filter(e=>e.hasAttribute(i)):[]}_fill(e){this._menu.replaceChildren();for(let t of e){let e=this.ownerDocument.createElement(`button`);e.type=`button`,e.className=`wui-overflow-item`,e.tabIndex=-1;let n=t.querySelector(`input[type=checkbox], input[type=radio]`);n instanceof HTMLInputElement?(e.setAttribute(`role`,n.type===`radio`?`menuitemradio`:`menuitemcheckbox`),e.setAttribute(`aria-checked`,String(n.checked))):e.setAttribute(`role`,`menuitem`);let r=m(t),i=!r||`disabled`in r&&r.disabled||r.getAttribute(`aria-disabled`)===`true`||t.matches(`.disabled, [aria-disabled='true']`);i&&e.setAttribute(`aria-disabled`,`true`),e.textContent=p(t),e.addEventListener(`click`,()=>{i||r&&this._choose(t,r)}),this._menu.append(e)}}_choose(e,t){this._close(!1),t.click(),this.layout();let n=h(e)?.isConnected?e.querySelector(`.dropdown-item:not([aria-disabled='true'])`):null;if(n){n.focus();return}let r=!e.hasAttribute(i)&&e.matches(`button, a[href]`)?e:this._more;r.hidden||r.focus()}_open(t){let r=this._hiddenItems();if(!r.length)return;this._fill(r),this._menu.hidden=!1,this._more.setAttribute(`aria-expanded`,`true`);let i=()=>n(this._more,this._menu);if(i(),e(this,i),t){let e=this._menu.firstElementChild;e instanceof HTMLElement&&e.focus()}}_close(e){this._menu&&!this._menu.hidden&&(this._menu.hidden=!0,this._more.setAttribute(`aria-expanded`,`false`),t(this),e&&this._more.focus())}_onMenuKey(e){let t=[...this._menu.children].filter(e=>e instanceof HTMLElement),n=this.ownerDocument.activeElement,r=n instanceof HTMLElement?t.indexOf(n):-1,i=null;if(e.key===`ArrowDown`)i=t[(r+1)%t.length];else if(e.key===`ArrowUp`)i=t[(r-1+t.length)%t.length];else if(e.key===`Home`)i=t[0];else if(e.key===`End`)i=t[t.length-1];else if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close(!0);return}else if(e.key===`Tab`){this._close(!1);return}else return;e.preventDefault(),i?.focus()}};export{g as t};
|