@kapiuara/ui 0.0.0-stage → 0.1.1
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 +16 -0
- package/README.md +764 -2
- package/dist/components/data/KapiPagination.d.ts +36 -0
- package/dist/components/data/KapiPagination.js +102 -0
- package/dist/components/data/KapiTable.d.ts +245 -0
- package/dist/components/data/KapiTable.js +748 -0
- package/dist/components/data/KapiTableFilter.d.ts +48 -0
- package/dist/components/data/KapiTableFilter.js +81 -0
- package/dist/components/data/index.d.ts +10 -0
- package/dist/components/data/tableLogic.d.ts +197 -0
- package/dist/components/data/tableLogic.js +145 -0
- package/dist/components/data/tableResizeLogic.d.ts +28 -0
- package/dist/components/data/tableResizeLogic.js +20 -0
- package/dist/components/display/KapiAnnotation.d.ts +32 -0
- package/dist/components/display/KapiAnnotation.js +130 -0
- package/dist/components/display/KapiAvatar.d.ts +27 -0
- package/dist/components/display/KapiAvatar.js +43 -0
- package/dist/components/display/KapiAvatarGroup.d.ts +19 -0
- package/dist/components/display/KapiAvatarGroup.js +38 -0
- package/dist/components/display/KapiBadge.d.ts +21 -0
- package/dist/components/display/KapiBadge.js +28 -0
- package/dist/components/display/KapiComment.d.ts +27 -0
- package/dist/components/display/KapiComment.js +66 -0
- package/dist/components/display/KapiCommentComposer.d.ts +49 -0
- package/dist/components/display/KapiCommentComposer.js +76 -0
- package/dist/components/display/KapiDescriptionList.d.ts +19 -0
- package/dist/components/display/KapiDescriptionList.js +35 -0
- package/dist/components/display/KapiFileItem.d.ts +39 -0
- package/dist/components/display/KapiFileItem.js +74 -0
- package/dist/components/display/KapiFileViewer.d.ts +51 -0
- package/dist/components/display/KapiFileViewer.js +107 -0
- package/dist/components/display/KapiIconTile.d.ts +16 -0
- package/dist/components/display/KapiIconTile.js +29 -0
- package/dist/components/display/KapiStat.d.ts +24 -0
- package/dist/components/display/KapiStat.js +41 -0
- package/dist/components/display/KapiTag.d.ts +27 -0
- package/dist/components/display/KapiTag.js +44 -0
- package/dist/components/display/KapiTimeline.d.ts +15 -0
- package/dist/components/display/KapiTimeline.js +30 -0
- package/dist/components/display/annotationLogic.d.ts +26 -0
- package/dist/components/display/annotationLogic.js +17 -0
- package/dist/components/display/avatarGroupLogic.d.ts +14 -0
- package/dist/components/display/avatarGroupLogic.js +13 -0
- package/dist/components/display/avatarLogic.d.ts +5 -0
- package/dist/components/display/avatarLogic.js +9 -0
- package/dist/components/display/commentLogic.d.ts +18 -0
- package/dist/components/display/commentLogic.js +7 -0
- package/dist/components/display/fileItemLogic.d.ts +9 -0
- package/dist/components/display/fileItemLogic.js +12 -0
- package/dist/components/display/iconTileLogic.d.ts +13 -0
- package/dist/components/display/iconTileLogic.js +13 -0
- package/dist/components/display/index.d.ts +40 -0
- package/dist/components/display/statLogic.d.ts +10 -0
- package/dist/components/display/statLogic.js +10 -0
- package/dist/components/display/tagLogic.d.ts +11 -0
- package/dist/components/display/tagLogic.js +10 -0
- package/dist/components/display/timelineLogic.d.ts +5 -0
- package/dist/components/display/timelineLogic.js +4 -0
- package/dist/components/feedback/KapiAlert.d.ts +28 -0
- package/dist/components/feedback/KapiAlert.js +53 -0
- package/dist/components/feedback/KapiBulkBar.d.ts +30 -0
- package/dist/components/feedback/KapiBulkBar.js +34 -0
- package/dist/components/feedback/KapiCountdown.d.ts +26 -0
- package/dist/components/feedback/KapiCountdown.js +43 -0
- package/dist/components/feedback/KapiEmpty.d.ts +14 -0
- package/dist/components/feedback/KapiEmpty.js +31 -0
- package/dist/components/feedback/KapiFab.d.ts +34 -0
- package/dist/components/feedback/KapiFab.js +116 -0
- package/dist/components/feedback/KapiOfflineBanner.d.ts +25 -0
- package/dist/components/feedback/KapiOfflineBanner.js +40 -0
- package/dist/components/feedback/KapiProgress.d.ts +24 -0
- package/dist/components/feedback/KapiProgress.js +94 -0
- package/dist/components/feedback/KapiSkeleton.d.ts +12 -0
- package/dist/components/feedback/KapiSkeleton.js +16 -0
- package/dist/components/feedback/KapiToastContainer.d.ts +16 -0
- package/dist/components/feedback/KapiToastContainer.js +81 -0
- package/dist/components/feedback/KapiTour.d.ts +40 -0
- package/dist/components/feedback/KapiTour.js +157 -0
- package/dist/components/feedback/KapiUnsavedBar.d.ts +35 -0
- package/dist/components/feedback/KapiUnsavedBar.js +47 -0
- package/dist/components/feedback/bulkBarLogic.d.ts +2 -0
- package/dist/components/feedback/bulkBarLogic.js +7 -0
- package/dist/components/feedback/countdownLogic.d.ts +74 -0
- package/dist/components/feedback/countdownLogic.js +70 -0
- package/dist/components/feedback/fabLogic.d.ts +17 -0
- package/dist/components/feedback/fabLogic.js +10 -0
- package/dist/components/feedback/index.d.ts +33 -0
- package/dist/components/feedback/offlineBannerLogic.d.ts +10 -0
- package/dist/components/feedback/offlineBannerLogic.js +8 -0
- package/dist/components/feedback/progressLogic.d.ts +17 -0
- package/dist/components/feedback/progressLogic.js +16 -0
- package/dist/components/feedback/toastStore.d.ts +62 -0
- package/dist/components/feedback/toastStore.js +38 -0
- package/dist/components/feedback/tourLogic.d.ts +64 -0
- package/dist/components/feedback/tourLogic.js +31 -0
- package/dist/components/feedback/unsavedBarLogic.d.ts +2 -0
- package/dist/components/feedback/unsavedBarLogic.js +8 -0
- package/dist/components/inputs/KapiAutocomplete.d.ts +81 -0
- package/dist/components/inputs/KapiAutocomplete.js +205 -0
- package/dist/components/inputs/KapiButton.d.ts +23 -0
- package/dist/components/inputs/KapiButton.js +25 -0
- package/dist/components/inputs/KapiCalendar.d.ts +35 -0
- package/dist/components/inputs/KapiCalendar.js +60 -0
- package/dist/components/inputs/KapiCalendarGrid.d.ts +29 -0
- package/dist/components/inputs/KapiCalendarGrid.js +65 -0
- package/dist/components/inputs/KapiCheckCard.d.ts +28 -0
- package/dist/components/inputs/KapiCheckCard.js +41 -0
- package/dist/components/inputs/KapiCheckbox.d.ts +7 -0
- package/dist/components/inputs/KapiCheckbox.js +5 -0
- package/dist/components/inputs/KapiDatePicker.d.ts +46 -0
- package/dist/components/inputs/KapiDatePicker.js +189 -0
- package/dist/components/inputs/KapiDateRangePicker.d.ts +49 -0
- package/dist/components/inputs/KapiDateRangePicker.js +179 -0
- package/dist/components/inputs/KapiFacetedSearch.d.ts +45 -0
- package/dist/components/inputs/KapiFacetedSearch.js +188 -0
- package/dist/components/inputs/KapiField.d.ts +33 -0
- package/dist/components/inputs/KapiField.js +60 -0
- package/dist/components/inputs/KapiFileUpload.d.ts +58 -0
- package/dist/components/inputs/KapiFileUpload.js +134 -0
- package/dist/components/inputs/KapiIconButton.d.ts +13 -0
- package/dist/components/inputs/KapiIconButton.js +16 -0
- package/dist/components/inputs/KapiInput.d.ts +92 -0
- package/dist/components/inputs/KapiInput.js +123 -0
- package/dist/components/inputs/KapiInputGroup.d.ts +37 -0
- package/dist/components/inputs/KapiInputGroup.js +29 -0
- package/dist/components/inputs/KapiMaskedInput.d.ts +52 -0
- package/dist/components/inputs/KapiMaskedInput.js +78 -0
- package/dist/components/inputs/KapiNumberStepper.d.ts +44 -0
- package/dist/components/inputs/KapiNumberStepper.js +100 -0
- package/dist/components/inputs/KapiRadio.d.ts +7 -0
- package/dist/components/inputs/KapiRadio.js +5 -0
- package/dist/components/inputs/KapiRating.d.ts +55 -0
- package/dist/components/inputs/KapiRating.js +99 -0
- package/dist/components/inputs/KapiSegmented.d.ts +41 -0
- package/dist/components/inputs/KapiSegmented.js +83 -0
- package/dist/components/inputs/KapiSelect.d.ts +109 -0
- package/dist/components/inputs/KapiSelect.js +443 -0
- package/dist/components/inputs/KapiSlider.d.ts +42 -0
- package/dist/components/inputs/KapiSlider.js +70 -0
- package/dist/components/inputs/KapiSwitch.d.ts +13 -0
- package/dist/components/inputs/KapiSwitch.js +28 -0
- package/dist/components/inputs/KapiTagInput.d.ts +79 -0
- package/dist/components/inputs/KapiTagInput.js +115 -0
- package/dist/components/inputs/KapiTextarea.d.ts +32 -0
- package/dist/components/inputs/KapiTextarea.js +67 -0
- package/dist/components/inputs/asyncSelectLogic.d.ts +42 -0
- package/dist/components/inputs/asyncSelectLogic.js +46 -0
- package/dist/components/inputs/autocompleteLogic.d.ts +73 -0
- package/dist/components/inputs/autocompleteLogic.js +67 -0
- package/dist/components/inputs/checkControl.d.ts +20 -0
- package/dist/components/inputs/checkControl.js +31 -0
- package/dist/components/inputs/datePickerLogic.d.ts +92 -0
- package/dist/components/inputs/datePickerLogic.js +174 -0
- package/dist/components/inputs/dateRangeLogic.d.ts +31 -0
- package/dist/components/inputs/dateRangeLogic.js +44 -0
- package/dist/components/inputs/facetedSearchLogic.d.ts +69 -0
- package/dist/components/inputs/facetedSearchLogic.js +39 -0
- package/dist/components/inputs/fieldLogic.d.ts +67 -0
- package/dist/components/inputs/fieldLogic.js +35 -0
- package/dist/components/inputs/fileUploadLogic.d.ts +13 -0
- package/dist/components/inputs/fileUploadLogic.js +9 -0
- package/dist/components/inputs/index.d.ts +55 -0
- package/dist/components/inputs/inputGroupLogic.d.ts +22 -0
- package/dist/components/inputs/inputGroupLogic.js +9 -0
- package/dist/components/inputs/inputLogic.d.ts +25 -0
- package/dist/components/inputs/inputLogic.js +10 -0
- package/dist/components/inputs/maskLogic.d.ts +34 -0
- package/dist/components/inputs/maskLogic.js +57 -0
- package/dist/components/inputs/numberStepLogic.d.ts +14 -0
- package/dist/components/inputs/numberStepLogic.js +21 -0
- package/dist/components/inputs/ratingLogic.d.ts +9 -0
- package/dist/components/inputs/ratingLogic.js +22 -0
- package/dist/components/inputs/segmentedLogic.d.ts +6 -0
- package/dist/components/inputs/segmentedLogic.js +14 -0
- package/dist/components/inputs/selectLogic.d.ts +89 -0
- package/dist/components/inputs/selectLogic.js +82 -0
- package/dist/components/inputs/sliderLogic.d.ts +9 -0
- package/dist/components/inputs/sliderLogic.js +17 -0
- package/dist/components/inputs/tagInputLogic.d.ts +40 -0
- package/dist/components/inputs/tagInputLogic.js +40 -0
- package/dist/components/inputs/textareaLogic.d.ts +17 -0
- package/dist/components/inputs/textareaLogic.js +13 -0
- package/dist/components/inputs/useCalendarFocus.d.ts +13 -0
- package/dist/components/inputs/useCalendarFocus.js +25 -0
- package/dist/components/inputs/useDatePopSide.d.ts +15 -0
- package/dist/components/inputs/useDatePopSide.js +20 -0
- package/dist/components/labelsLogic.d.ts +6 -0
- package/dist/components/labelsLogic.js +11 -0
- package/dist/components/layout/KapiAccessCard.d.ts +40 -0
- package/dist/components/layout/KapiAccessCard.js +66 -0
- package/dist/components/layout/KapiAccountMenu.d.ts +61 -0
- package/dist/components/layout/KapiAccountMenu.js +212 -0
- package/dist/components/layout/KapiCard.d.ts +43 -0
- package/dist/components/layout/KapiCard.js +53 -0
- package/dist/components/layout/KapiCluster.d.ts +15 -0
- package/dist/components/layout/KapiCluster.js +21 -0
- package/dist/components/layout/KapiContextSlot.d.ts +45 -0
- package/dist/components/layout/KapiContextSlot.js +92 -0
- package/dist/components/layout/KapiDivider.d.ts +16 -0
- package/dist/components/layout/KapiDivider.js +41 -0
- package/dist/components/layout/KapiGrid.d.ts +19 -0
- package/dist/components/layout/KapiGrid.js +25 -0
- package/dist/components/layout/KapiNotificationBell.d.ts +75 -0
- package/dist/components/layout/KapiNotificationBell.js +196 -0
- package/dist/components/layout/KapiPageHeader.d.ts +28 -0
- package/dist/components/layout/KapiPageHeader.js +47 -0
- package/dist/components/layout/KapiPanelParts.d.ts +35 -0
- package/dist/components/layout/KapiPanelParts.js +63 -0
- package/dist/components/layout/KapiRail.d.ts +40 -0
- package/dist/components/layout/KapiRail.js +102 -0
- package/dist/components/layout/KapiScrollArea.d.ts +40 -0
- package/dist/components/layout/KapiScrollArea.js +49 -0
- package/dist/components/layout/KapiShell.d.ts +40 -0
- package/dist/components/layout/KapiShell.js +48 -0
- package/dist/components/layout/KapiStack.d.ts +11 -0
- package/dist/components/layout/KapiStack.js +19 -0
- package/dist/components/layout/accessCardLogic.d.ts +18 -0
- package/dist/components/layout/accessCardLogic.js +11 -0
- package/dist/components/layout/cardLogic.d.ts +9 -0
- package/dist/components/layout/cardLogic.js +11 -0
- package/dist/components/layout/index.d.ts +33 -0
- package/dist/components/layout/layoutPrimitives.d.ts +51 -0
- package/dist/components/layout/layoutPrimitives.js +58 -0
- package/dist/components/layout/notificationBellLogic.d.ts +20 -0
- package/dist/components/layout/notificationBellLogic.js +14 -0
- package/dist/components/layout/railLogic.d.ts +52 -0
- package/dist/components/layout/railLogic.js +16 -0
- package/dist/components/locale/KapiLocaleProvider.d.ts +29 -0
- package/dist/components/locale/KapiLocaleProvider.js +27 -0
- package/dist/components/locale/index.d.ts +5 -0
- package/dist/components/locale/labelRegistry.d.ts +110 -0
- package/dist/components/locale/linkLabels.d.ts +6 -0
- package/dist/components/locale/linkLabels.js +4 -0
- package/dist/components/navigation/CtxSlidingList.d.ts +11 -0
- package/dist/components/navigation/CtxSlidingList.js +24 -0
- package/dist/components/navigation/KapiAccordion.d.ts +24 -0
- package/dist/components/navigation/KapiAccordion.js +68 -0
- package/dist/components/navigation/KapiBreadcrumb.d.ts +23 -0
- package/dist/components/navigation/KapiBreadcrumb.js +32 -0
- package/dist/components/navigation/KapiCollapsiblePanel.d.ts +63 -0
- package/dist/components/navigation/KapiCollapsiblePanel.js +83 -0
- package/dist/components/navigation/KapiContextPanel.d.ts +117 -0
- package/dist/components/navigation/KapiContextPanel.js +265 -0
- package/dist/components/navigation/KapiFilterChips.d.ts +30 -0
- package/dist/components/navigation/KapiFilterChips.js +40 -0
- package/dist/components/navigation/KapiNavBadge.d.ts +26 -0
- package/dist/components/navigation/KapiNavBadge.js +33 -0
- package/dist/components/navigation/KapiPanelGroup.d.ts +69 -0
- package/dist/components/navigation/KapiPanelGroup.js +149 -0
- package/dist/components/navigation/KapiSteps.d.ts +43 -0
- package/dist/components/navigation/KapiSteps.js +63 -0
- package/dist/components/navigation/KapiTabs.d.ts +56 -0
- package/dist/components/navigation/KapiTabs.js +81 -0
- package/dist/components/navigation/KapiTree.d.ts +56 -0
- package/dist/components/navigation/KapiTree.js +157 -0
- package/dist/components/navigation/KapiWizard.d.ts +49 -0
- package/dist/components/navigation/KapiWizard.js +104 -0
- package/dist/components/navigation/MiniNavItem.d.ts +35 -0
- package/dist/components/navigation/MiniNavItem.js +57 -0
- package/dist/components/navigation/accordionLogic.d.ts +4 -0
- package/dist/components/navigation/accordionLogic.js +4 -0
- package/dist/components/navigation/activeItemLogic.d.ts +7 -0
- package/dist/components/navigation/activeItemLogic.js +4 -0
- package/dist/components/navigation/breadcrumbLogic.d.ts +8 -0
- package/dist/components/navigation/breadcrumbLogic.js +4 -0
- package/dist/components/navigation/contextPanelLogic.d.ts +27 -0
- package/dist/components/navigation/contextPanelLogic.js +11 -0
- package/dist/components/navigation/filterChipsLogic.d.ts +23 -0
- package/dist/components/navigation/filterChipsLogic.js +20 -0
- package/dist/components/navigation/index.d.ts +39 -0
- package/dist/components/navigation/navBadgeLogic.d.ts +26 -0
- package/dist/components/navigation/navBadgeLogic.js +16 -0
- package/dist/components/navigation/panelGroupLogic.d.ts +15 -0
- package/dist/components/navigation/panelGroupLogic.js +13 -0
- package/dist/components/navigation/panelMini.d.ts +13 -0
- package/dist/components/navigation/panelMini.js +9 -0
- package/dist/components/navigation/panelMiniLogic.d.ts +19 -0
- package/dist/components/navigation/panelMiniLogic.js +6 -0
- package/dist/components/navigation/stepsLogic.d.ts +25 -0
- package/dist/components/navigation/stepsLogic.js +10 -0
- package/dist/components/navigation/tabsLogic.d.ts +12 -0
- package/dist/components/navigation/tabsLogic.js +14 -0
- package/dist/components/navigation/treeLogic.d.ts +80 -0
- package/dist/components/navigation/treeLogic.js +91 -0
- package/dist/components/navigation/wizardLogic.d.ts +11 -0
- package/dist/components/navigation/wizardLogic.js +7 -0
- package/dist/components/overlays/KapiCanvasForm.d.ts +42 -0
- package/dist/components/overlays/KapiCanvasForm.js +60 -0
- package/dist/components/overlays/KapiCommandPalette.d.ts +58 -0
- package/dist/components/overlays/KapiCommandPalette.js +152 -0
- package/dist/components/overlays/KapiConfirm.d.ts +48 -0
- package/dist/components/overlays/KapiConfirm.js +94 -0
- package/dist/components/overlays/KapiContextMenu.d.ts +51 -0
- package/dist/components/overlays/KapiContextMenu.js +90 -0
- package/dist/components/overlays/KapiDialogHost.d.ts +23 -0
- package/dist/components/overlays/KapiDialogHost.js +129 -0
- package/dist/components/overlays/KapiDropdown.d.ts +30 -0
- package/dist/components/overlays/KapiDropdown.js +84 -0
- package/dist/components/overlays/KapiLoading.d.ts +14 -0
- package/dist/components/overlays/KapiLoading.js +43 -0
- package/dist/components/overlays/KapiMenuButton.d.ts +25 -0
- package/dist/components/overlays/KapiMenuButton.js +109 -0
- package/dist/components/overlays/KapiModal.d.ts +61 -0
- package/dist/components/overlays/KapiModal.js +106 -0
- package/dist/components/overlays/KapiOffcanvas.d.ts +96 -0
- package/dist/components/overlays/KapiOffcanvas.js +209 -0
- package/dist/components/overlays/KapiOffcanvasStack.d.ts +58 -0
- package/dist/components/overlays/KapiOffcanvasStack.js +84 -0
- package/dist/components/overlays/KapiPhotoView.d.ts +60 -0
- package/dist/components/overlays/KapiPhotoView.js +122 -0
- package/dist/components/overlays/KapiPopover.d.ts +46 -0
- package/dist/components/overlays/KapiPopover.js +68 -0
- package/dist/components/overlays/KapiShapeSheet.d.ts +34 -0
- package/dist/components/overlays/KapiShapeSheet.js +82 -0
- package/dist/components/overlays/KapiSplitModal.d.ts +41 -0
- package/dist/components/overlays/KapiSplitModal.js +125 -0
- package/dist/components/overlays/KapiTooltip.d.ts +38 -0
- package/dist/components/overlays/KapiTooltip.js +105 -0
- package/dist/components/overlays/canvasFormLogic.d.ts +18 -0
- package/dist/components/overlays/canvasFormLogic.js +16 -0
- package/dist/components/overlays/commandPaletteLogic.d.ts +29 -0
- package/dist/components/overlays/commandPaletteLogic.js +19 -0
- package/dist/components/overlays/dialogStore.d.ts +114 -0
- package/dist/components/overlays/dialogStore.js +76 -0
- package/dist/components/overlays/dialogUtils.d.ts +72 -0
- package/dist/components/overlays/dialogUtils.js +62 -0
- package/dist/components/overlays/exitPresenceLogic.d.ts +14 -0
- package/dist/components/overlays/exitPresenceLogic.js +5 -0
- package/dist/components/overlays/index.d.ts +38 -0
- package/dist/components/overlays/menuButtonLogic.d.ts +58 -0
- package/dist/components/overlays/menuButtonLogic.js +9 -0
- package/dist/components/overlays/menuKeyboardLogic.d.ts +25 -0
- package/dist/components/overlays/menuKeyboardLogic.js +30 -0
- package/dist/components/overlays/offcanvasCompanion.d.ts +16 -0
- package/dist/components/overlays/offcanvasCompanion.js +6 -0
- package/dist/components/overlays/offcanvasResize.d.ts +22 -0
- package/dist/components/overlays/offcanvasResize.js +10 -0
- package/dist/components/overlays/offcanvasSide.d.ts +30 -0
- package/dist/components/overlays/offcanvasSide.js +29 -0
- package/dist/components/overlays/offcanvasStack.d.ts +76 -0
- package/dist/components/overlays/offcanvasStack.js +72 -0
- package/dist/components/overlays/overlayPortal.d.ts +9 -0
- package/dist/components/overlays/overlayPortal.js +6 -0
- package/dist/components/overlays/popoverLogic.d.ts +94 -0
- package/dist/components/overlays/popoverLogic.js +47 -0
- package/dist/components/overlays/splitModalLayout.d.ts +8 -0
- package/dist/components/overlays/splitModalLayout.js +5 -0
- package/dist/components/overlays/useExitPresence.d.ts +14 -0
- package/dist/components/overlays/useExitPresence.js +34 -0
- package/dist/components/overlays/useNativeDialog.d.ts +30 -0
- package/dist/components/overlays/useNativeDialog.js +56 -0
- package/dist/components/rootProps.d.ts +17 -0
- package/dist/components/rootProps.js +4 -0
- package/dist/hooks/breakpointOpenLogic.d.ts +7 -0
- package/dist/hooks/breakpointOpenLogic.js +4 -0
- package/dist/hooks/dateFormat.d.ts +12 -0
- package/dist/hooks/dateFormat.js +15 -0
- package/dist/hooks/downloadLogic.d.ts +31 -0
- package/dist/hooks/downloadLogic.js +85 -0
- package/dist/hooks/focusLogic.d.ts +18 -0
- package/dist/hooks/focusLogic.js +17 -0
- package/dist/hooks/growOriginLogic.d.ts +22 -0
- package/dist/hooks/growOriginLogic.js +10 -0
- package/dist/hooks/hotkeyLogic.d.ts +22 -0
- package/dist/hooks/hotkeyLogic.js +32 -0
- package/dist/hooks/index.d.ts +49 -0
- package/dist/hooks/kapiRoot.d.ts +16 -0
- package/dist/hooks/kapiRoot.js +9 -0
- package/dist/hooks/onlineStatusLogic.d.ts +31 -0
- package/dist/hooks/onlineStatusLogic.js +28 -0
- package/dist/hooks/persistentStateLogic.d.ts +12 -0
- package/dist/hooks/persistentStateLogic.js +17 -0
- package/dist/hooks/rafThrottle.d.ts +33 -0
- package/dist/hooks/rafThrottle.js +33 -0
- package/dist/hooks/recentLogic.d.ts +9 -0
- package/dist/hooks/recentLogic.js +10 -0
- package/dist/hooks/reducedMotion.d.ts +13 -0
- package/dist/hooks/reducedMotion.js +5 -0
- package/dist/hooks/rightClick.d.ts +37 -0
- package/dist/hooks/rightClick.js +30 -0
- package/dist/hooks/scrollCollapseLogic.d.ts +12 -0
- package/dist/hooks/scrollCollapseLogic.js +4 -0
- package/dist/hooks/scrollEdgesLogic.d.ts +49 -0
- package/dist/hooks/scrollEdgesLogic.js +19 -0
- package/dist/hooks/slidingIndicatorLogic.d.ts +25 -0
- package/dist/hooks/slidingIndicatorLogic.js +15 -0
- package/dist/hooks/storageLogic.d.ts +15 -0
- package/dist/hooks/storageLogic.js +24 -0
- package/dist/hooks/unsavedGuardLogic.d.ts +17 -0
- package/dist/hooks/unsavedGuardLogic.js +17 -0
- package/dist/hooks/useDragScroll.d.ts +12 -0
- package/dist/hooks/useDragScroll.js +32 -0
- package/dist/hooks/useGlobalRightClick.d.ts +14 -0
- package/dist/hooks/useGlobalRightClick.js +35 -0
- package/dist/hooks/useGrowOrigin.d.ts +13 -0
- package/dist/hooks/useGrowOrigin.js +16 -0
- package/dist/hooks/useHotkey.d.ts +15 -0
- package/dist/hooks/useHotkey.js +31 -0
- package/dist/hooks/useKapiTheme.d.ts +69 -0
- package/dist/hooks/useKapiTheme.js +88 -0
- package/dist/hooks/useMediaQuery.d.ts +6 -0
- package/dist/hooks/useMediaQuery.js +13 -0
- package/dist/hooks/useObjectUrl.d.ts +6 -0
- package/dist/hooks/useObjectUrl.js +19 -0
- package/dist/hooks/useOnlineStatus.d.ts +7 -0
- package/dist/hooks/useOnlineStatus.js +7 -0
- package/dist/hooks/usePersistentState.d.ts +19 -0
- package/dist/hooks/usePersistentState.js +37 -0
- package/dist/hooks/usePlacement.d.ts +36 -0
- package/dist/hooks/usePlacement.js +84 -0
- package/dist/hooks/useRecent.d.ts +17 -0
- package/dist/hooks/useRecent.js +16 -0
- package/dist/hooks/useScrollCollapse.d.ts +10 -0
- package/dist/hooks/useScrollCollapse.js +27 -0
- package/dist/hooks/useScrollEdges.d.ts +32 -0
- package/dist/hooks/useScrollEdges.js +91 -0
- package/dist/hooks/useSlidingIndicator.d.ts +23 -0
- package/dist/hooks/useSlidingIndicator.js +51 -0
- package/dist/hooks/useUnsavedGuard.d.ts +70 -0
- package/dist/hooks/useUnsavedGuard.js +47 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +162 -0
- package/dist/kapi.css +2 -0
- package/dist/kapi.layered.css +4 -0
- package/package.json +87 -4
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { KapiButton as e } from "../inputs/KapiButton.js";
|
|
3
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
4
|
+
import { getPortalRoot as n, useNativeDialog as r } from "./useNativeDialog.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { KapiModal as i } from "./KapiModal.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { DEFAULT_CONFIRM_LABELS as a, KapiConfirm as o } from "./KapiConfirm.js";
|
|
9
|
+
import { confirmErrorMessage as s, dialogStore as c } from "./dialogStore.js";
|
|
10
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
11
|
+
import { useId as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
|
|
12
|
+
import { AlertTriangle as g, CheckCircle2 as _, Info as v, XCircle as y } from "lucide-react";
|
|
13
|
+
import { createPortal as b } from "react-dom";
|
|
14
|
+
//#region src/components/overlays/KapiDialogHost.tsx
|
|
15
|
+
var x = {
|
|
16
|
+
accept: "Aceptar",
|
|
17
|
+
loading: "Cargando…"
|
|
18
|
+
}, S = {
|
|
19
|
+
success: _,
|
|
20
|
+
error: y,
|
|
21
|
+
info: v,
|
|
22
|
+
warning: g
|
|
23
|
+
}, C = ({ options: t, acceptLabel: n, onClose: r }) => {
|
|
24
|
+
let a = f(), o = t.variant && t.variant in S ? t.variant : "info", s = S[o];
|
|
25
|
+
return /* @__PURE__ */ d(i, {
|
|
26
|
+
size: "sm",
|
|
27
|
+
hideHeader: !0,
|
|
28
|
+
"aria-labelledby": a,
|
|
29
|
+
open: !0,
|
|
30
|
+
onClose: r,
|
|
31
|
+
footer: /* @__PURE__ */ u(e, {
|
|
32
|
+
"data-autofocus": !0,
|
|
33
|
+
variant: "primary",
|
|
34
|
+
onClick: r,
|
|
35
|
+
children: t.acceptLabel ?? n
|
|
36
|
+
}),
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ u("div", {
|
|
39
|
+
className: `kapi-confirm__icon kapi-confirm__icon--${o}`,
|
|
40
|
+
children: /* @__PURE__ */ u(s, {
|
|
41
|
+
size: 28,
|
|
42
|
+
strokeWidth: 2
|
|
43
|
+
})
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ u("div", {
|
|
46
|
+
id: a,
|
|
47
|
+
className: "kapi-confirm__title",
|
|
48
|
+
children: t.title
|
|
49
|
+
}),
|
|
50
|
+
t.message && /* @__PURE__ */ u("div", {
|
|
51
|
+
className: "kapi-confirm__msg",
|
|
52
|
+
children: t.message
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
}, w = ({ options: e, onSettle: n }) => {
|
|
57
|
+
let r = t("confirm", a), [i, c] = m({
|
|
58
|
+
busy: !1,
|
|
59
|
+
error: null
|
|
60
|
+
}), l = p(!1);
|
|
61
|
+
return /* @__PURE__ */ u(o, {
|
|
62
|
+
open: !0,
|
|
63
|
+
title: e.title,
|
|
64
|
+
message: e.message,
|
|
65
|
+
variant: e.variant,
|
|
66
|
+
confirmLabel: e.confirmLabel,
|
|
67
|
+
cancelLabel: e.cancelLabel,
|
|
68
|
+
loading: i.busy,
|
|
69
|
+
error: i.error ?? void 0,
|
|
70
|
+
onConfirm: () => {
|
|
71
|
+
let t = e.onConfirm;
|
|
72
|
+
if (!t) return n(!0);
|
|
73
|
+
l.current || (l.current = !0, c({
|
|
74
|
+
busy: !0,
|
|
75
|
+
error: null
|
|
76
|
+
}), new Promise((e) => e(t())).then(() => {
|
|
77
|
+
l.current = !1, n(!0);
|
|
78
|
+
}, (e) => {
|
|
79
|
+
l.current = !1, c({
|
|
80
|
+
busy: !1,
|
|
81
|
+
error: s(e) ?? r.error
|
|
82
|
+
});
|
|
83
|
+
}));
|
|
84
|
+
},
|
|
85
|
+
onClose: () => n(!1)
|
|
86
|
+
});
|
|
87
|
+
}, T = ({ message: e, root: t }) => {
|
|
88
|
+
let n = f(), { ref: i, dialogProps: a } = r();
|
|
89
|
+
return b(/* @__PURE__ */ u("dialog", {
|
|
90
|
+
ref: i,
|
|
91
|
+
className: "kapi-loading-overlay kapi-loading-dialog",
|
|
92
|
+
"aria-modal": "true",
|
|
93
|
+
"aria-busy": "true",
|
|
94
|
+
"aria-labelledby": n,
|
|
95
|
+
tabIndex: -1,
|
|
96
|
+
...a,
|
|
97
|
+
children: /* @__PURE__ */ d("div", {
|
|
98
|
+
className: "kapi-loading",
|
|
99
|
+
children: [/* @__PURE__ */ u("span", {
|
|
100
|
+
className: "kapi-spinner",
|
|
101
|
+
"aria-hidden": "true"
|
|
102
|
+
}), /* @__PURE__ */ u("span", {
|
|
103
|
+
id: n,
|
|
104
|
+
className: "kapi-loading__msg",
|
|
105
|
+
role: "status",
|
|
106
|
+
children: e
|
|
107
|
+
})]
|
|
108
|
+
})
|
|
109
|
+
}), t);
|
|
110
|
+
}, E = ({ labels: e, store: r = c }) => {
|
|
111
|
+
let i = t("dialog", x, e), { dialog: a, loading: o } = h(r.subscribe, r.getSnapshot, r.getSnapshot), s = o && !a ? n() : null;
|
|
112
|
+
return /* @__PURE__ */ d(l, { children: [
|
|
113
|
+
a?.kind === "confirm" && /* @__PURE__ */ u(w, {
|
|
114
|
+
options: a.options,
|
|
115
|
+
onSettle: (e) => r.settle(a.id, e)
|
|
116
|
+
}, a.id),
|
|
117
|
+
a?.kind === "alert" && /* @__PURE__ */ u(C, {
|
|
118
|
+
options: a.options,
|
|
119
|
+
acceptLabel: i.accept,
|
|
120
|
+
onClose: () => r.settle(a.id, !1)
|
|
121
|
+
}, a.id),
|
|
122
|
+
!a && o && s && /* @__PURE__ */ u(T, {
|
|
123
|
+
message: o.message ?? i.loading,
|
|
124
|
+
root: s
|
|
125
|
+
})
|
|
126
|
+
] });
|
|
127
|
+
};
|
|
128
|
+
//#endregion
|
|
129
|
+
export { x as DEFAULT_DIALOG_LABELS, E as KapiDialogHost };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import "./overlays.css";
|
|
3
|
+
export type KapiDropdownOption = string | number;
|
|
4
|
+
export type KapiDropdownDrop = "down" | "up";
|
|
5
|
+
/** Atributos nativos (`id`, `style`, `data-*`…) van al contenedor `.kapi-dropdown` (chip + menú). */
|
|
6
|
+
export type KapiDropdownProps<T extends KapiDropdownOption = KapiDropdownOption> = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onChange" | "defaultValue"> & {
|
|
7
|
+
/** Opción seleccionada (se muestra en el chip). */
|
|
8
|
+
value: T;
|
|
9
|
+
/** Opciones primitivas; también son la etiqueta visible. */
|
|
10
|
+
options: T[];
|
|
11
|
+
/** Se llama con la opción elegida. */
|
|
12
|
+
onChange: (value: T) => void;
|
|
13
|
+
/** Ícono (lucide-react) a la izquierda del chip. */
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
/** Prefijo del chip ("Estado: Activo"). */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** `up` abre hacia arriba (para footers). */
|
|
18
|
+
drop?: KapiDropdownDrop;
|
|
19
|
+
/** Ancho mínimo del menú en px. */
|
|
20
|
+
minWidth?: number;
|
|
21
|
+
};
|
|
22
|
+
/** Clases del menú según hacia dónde abre. Pura y exportada para testear. */
|
|
23
|
+
export declare const dropdownMenuClass: (drop?: KapiDropdownDrop) => string;
|
|
24
|
+
/** Clases de una opción del menú. */
|
|
25
|
+
export declare const dropdownItemClass: (selected: boolean) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Select liviano (menú simple con la cara del rediseño), ideal para filtros compactos tipo chip.
|
|
28
|
+
* Para selects ricos (búsqueda/multi) usa KapiSelect.
|
|
29
|
+
*/
|
|
30
|
+
export declare const KapiDropdown: <T extends KapiDropdownOption = KapiDropdownOption>({ value, options, onChange, icon, label, drop, minWidth, className, ...rest }: KapiDropdownProps<T>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { focusedMenuIndex as t, initialMenuFocus as n, menuKeyIntent as r, nextEnabledIndex as i } from "./menuKeyboardLogic.js";
|
|
5
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
import { useEffect as c, useId as l, useRef as u, useState as d } from "react";
|
|
7
|
+
import { Check as f, ChevronDown as p } from "lucide-react";
|
|
8
|
+
//#region src/components/overlays/KapiDropdown.tsx
|
|
9
|
+
var m = (e = "down") => `kapi-menu kapi-dropdown__menu kapi-dropdown__menu--${e}`, h = (e) => `kapi-menu__item${e ? " kapi-menu__item--on" : ""}`, g = ({ value: g, options: _, onChange: v, icon: y, label: b, drop: x = "down", minWidth: S = 170, className: C, ...w }) => {
|
|
10
|
+
let [T, E] = d(!1), D = l(), O = `${D}-trigger`, k = `${D}-menu`, A = u(null), j = u(null), M = _.map((e, t) => t), N = (e) => {
|
|
11
|
+
j.current?.querySelector(`[data-menu-index="${e}"]`)?.focus();
|
|
12
|
+
}, P = (e) => {
|
|
13
|
+
E(!1), e && A.current?.focus();
|
|
14
|
+
};
|
|
15
|
+
c(() => {
|
|
16
|
+
T && N(n(M, _.indexOf(g)));
|
|
17
|
+
}, [T]);
|
|
18
|
+
let F = (e) => {
|
|
19
|
+
let n = r(e.key);
|
|
20
|
+
n.kind === "move" ? (e.preventDefault(), N(i(t(document.activeElement), n.dir, M))) : n.kind === "close" && (n.returnFocus && (e.preventDefault(), e.stopPropagation()), P(n.returnFocus));
|
|
21
|
+
}, I = (e) => {
|
|
22
|
+
e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), E(!0)) : e.key === "Escape" && T && (e.stopPropagation(), P(!0));
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ s("div", {
|
|
25
|
+
...w,
|
|
26
|
+
className: e("kapi-dropdown", C),
|
|
27
|
+
children: [/* @__PURE__ */ s("button", {
|
|
28
|
+
ref: A,
|
|
29
|
+
id: O,
|
|
30
|
+
type: "button",
|
|
31
|
+
className: "kapi-filterchip",
|
|
32
|
+
onClick: () => E((e) => !e),
|
|
33
|
+
onKeyDown: I,
|
|
34
|
+
"aria-haspopup": "listbox",
|
|
35
|
+
"aria-expanded": T,
|
|
36
|
+
"aria-controls": T ? k : void 0,
|
|
37
|
+
children: [
|
|
38
|
+
y,
|
|
39
|
+
b && /* @__PURE__ */ s("span", {
|
|
40
|
+
className: "kapi-dropdown__label",
|
|
41
|
+
children: [b, ":"]
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ o("span", {
|
|
44
|
+
className: "kapi-strong kapi-dropdown__value",
|
|
45
|
+
children: g
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ o(p, {
|
|
48
|
+
size: 14,
|
|
49
|
+
strokeWidth: 2.2,
|
|
50
|
+
color: "var(--kapi-muted-2)"
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
}), T && /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("div", {
|
|
54
|
+
className: "kapi-dropdown__backdrop",
|
|
55
|
+
onClick: () => E(!1)
|
|
56
|
+
}), /* @__PURE__ */ o("div", {
|
|
57
|
+
className: m(x),
|
|
58
|
+
style: { minWidth: S },
|
|
59
|
+
role: "listbox",
|
|
60
|
+
id: k,
|
|
61
|
+
"aria-labelledby": O,
|
|
62
|
+
ref: j,
|
|
63
|
+
onKeyDown: F,
|
|
64
|
+
children: _.map((e, t) => /* @__PURE__ */ s("button", {
|
|
65
|
+
type: "button",
|
|
66
|
+
role: "option",
|
|
67
|
+
"aria-selected": e === g,
|
|
68
|
+
tabIndex: -1,
|
|
69
|
+
"data-menu-index": t,
|
|
70
|
+
className: h(e === g),
|
|
71
|
+
onClick: () => {
|
|
72
|
+
v(e), P(!0);
|
|
73
|
+
},
|
|
74
|
+
children: [e, e === g && /* @__PURE__ */ o(f, {
|
|
75
|
+
size: 14,
|
|
76
|
+
strokeWidth: 2.6,
|
|
77
|
+
color: "var(--kapi-primary)"
|
|
78
|
+
})]
|
|
79
|
+
}, e))
|
|
80
|
+
})] })]
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
//#endregion
|
|
84
|
+
export { g as KapiDropdown, h as dropdownItemClass, m as dropdownMenuClass };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./KapiModal.css";
|
|
2
|
+
import { type KapiRootProps } from "../rootProps";
|
|
3
|
+
/** `className`/`style`/`id` van a la tarjeta del spinner (la capa del `<dialog>` cubre la pantalla). */
|
|
4
|
+
export type KapiLoadingProps = KapiRootProps & {
|
|
5
|
+
/** Muestra u oculta la capa de carga (controlado). */
|
|
6
|
+
open: boolean;
|
|
7
|
+
/** Texto bajo el spinner; también nombra al diálogo. */
|
|
8
|
+
message?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Overlay bloqueante con spinner + mensaje. Controlado por `open`.
|
|
12
|
+
* Sobre `<dialog>` modal: bloquea clicks, teclado (focus trap) y scroll del body.
|
|
13
|
+
*/
|
|
14
|
+
export declare const KapiLoading: ({ open, message, ...surface }: KapiLoadingProps) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
3
|
+
import { getPortalRoot as t, useNativeDialog as n } from "./useNativeDialog.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
import { useId as a } from "react";
|
|
7
|
+
import { createPortal as o } from "react-dom";
|
|
8
|
+
//#region src/components/overlays/KapiLoading.tsx
|
|
9
|
+
var s = ({ message: t, root: s, className: c, style: l, id: u }) => {
|
|
10
|
+
let d = a(), { ref: f, dialogProps: p } = n();
|
|
11
|
+
return o(/* @__PURE__ */ r("dialog", {
|
|
12
|
+
ref: f,
|
|
13
|
+
className: "kapi-loading-overlay kapi-loading-dialog",
|
|
14
|
+
role: "alertdialog",
|
|
15
|
+
"aria-modal": "true",
|
|
16
|
+
"aria-busy": "true",
|
|
17
|
+
"aria-labelledby": d,
|
|
18
|
+
tabIndex: -1,
|
|
19
|
+
...p,
|
|
20
|
+
children: /* @__PURE__ */ i("div", {
|
|
21
|
+
id: u,
|
|
22
|
+
className: e("kapi-loading", c),
|
|
23
|
+
style: l,
|
|
24
|
+
children: [/* @__PURE__ */ r("span", {
|
|
25
|
+
className: "kapi-spinner",
|
|
26
|
+
"aria-hidden": "true"
|
|
27
|
+
}), /* @__PURE__ */ r("span", {
|
|
28
|
+
id: d,
|
|
29
|
+
className: "kapi-loading__msg",
|
|
30
|
+
children: t
|
|
31
|
+
})]
|
|
32
|
+
})
|
|
33
|
+
}), s);
|
|
34
|
+
}, c = ({ open: e, message: n = "Cargando…", ...i }) => {
|
|
35
|
+
let a = e ? t() : null;
|
|
36
|
+
return a ? /* @__PURE__ */ r(s, {
|
|
37
|
+
...i,
|
|
38
|
+
message: n,
|
|
39
|
+
root: a
|
|
40
|
+
}) : null;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { c as KapiLoading };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type KapiButtonVariant } from "../inputs/KapiButton";
|
|
3
|
+
import { type KapiMenuItem } from "./KapiContextMenu";
|
|
4
|
+
import "./overlays.css";
|
|
5
|
+
import { type KapiRootProps } from "../rootProps";
|
|
6
|
+
/** `className`/`style`/`id` go to the wrapper `<span>` around the trigger (the menu is portaled). */
|
|
7
|
+
export type KapiMenuButtonProps = KapiRootProps & {
|
|
8
|
+
/** Texto del botón disparador. */
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
/** Ítems del menú que se abre al hacer click, en orden. */
|
|
11
|
+
items: KapiMenuItem[];
|
|
12
|
+
/** Icon (lucide-react) shown before the label. */
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
/** Variante visual del botón disparador (la de `KapiButton`). */
|
|
15
|
+
variant?: KapiButtonVariant;
|
|
16
|
+
/** Nombre accesible del botón disparador (p. ej. si `label` es solo un ícono). */
|
|
17
|
+
"aria-label"?: string;
|
|
18
|
+
/** `up` prefers opening upwards; it still flips when it does not fit. */
|
|
19
|
+
drop?: "down" | "up";
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Button that opens an action menu anchored to its left or right edge (whichever has room). The menu is portaled to `.kapi`
|
|
23
|
+
* (escapes overflow), positioned `fixed` and flips up/down when it does not fit.
|
|
24
|
+
*/
|
|
25
|
+
export declare const KapiMenuButton: ({ label, items, icon, variant, "aria-label": ariaLabel, drop, className, style: wrapStyle, id }: KapiMenuButtonProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { KapiButton as e } from "../inputs/KapiButton.js";
|
|
3
|
+
import { resolveKapiRoot as t } from "../../hooks/kapiRoot.js";
|
|
4
|
+
import { usePlacement as n } from "../../hooks/usePlacement.js";
|
|
5
|
+
import { joinClasses as r } from "../rootProps.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { ACTION_MENU_PLACEMENT as i, nextMenuIndex as a } from "./menuButtonLogic.js";
|
|
8
|
+
import { menuItemClass as o } from "./KapiContextMenu.js";
|
|
9
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
|
+
import { useCallback as l, useEffect as u, useId as d, useLayoutEffect as f, useRef as p, useState as m } from "react";
|
|
11
|
+
import { ChevronDown as h } from "lucide-react";
|
|
12
|
+
import { createPortal as g } from "react-dom";
|
|
13
|
+
//#region src/components/overlays/KapiMenuButton.tsx
|
|
14
|
+
var _ = 6, v = ({ label: v, items: y, icon: b, variant: x = "default", "aria-label": S, drop: C = "down", className: w, style: T, id: E }) => {
|
|
15
|
+
let D = d(), [O, k] = m(!1), A = p(null), j = p(null), M = p(null), N = l((e) => {
|
|
16
|
+
k(!1), e && j.current?.focus();
|
|
17
|
+
}, []), P = (e) => {
|
|
18
|
+
M.current?.querySelector(`[data-menu-index="${e}"]`)?.focus();
|
|
19
|
+
}, { placement: F, style: I, update: L } = n({
|
|
20
|
+
open: O,
|
|
21
|
+
anchor: j,
|
|
22
|
+
floatingRef: M,
|
|
23
|
+
...i,
|
|
24
|
+
side: C === "up" ? "top" : "bottom",
|
|
25
|
+
offset: _,
|
|
26
|
+
hideUntilPlaced: !1
|
|
27
|
+
});
|
|
28
|
+
f(() => {
|
|
29
|
+
O && L();
|
|
30
|
+
}, [
|
|
31
|
+
O,
|
|
32
|
+
y.length,
|
|
33
|
+
L
|
|
34
|
+
]), u(() => {
|
|
35
|
+
if (!O) return;
|
|
36
|
+
let e = (e) => {
|
|
37
|
+
let t = e.target;
|
|
38
|
+
t && (A.current?.contains(t) || M.current?.contains(t)) || k(!1);
|
|
39
|
+
};
|
|
40
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
41
|
+
}, [O]), u(() => {
|
|
42
|
+
O && P(a(-1, "first", y));
|
|
43
|
+
}, [O]);
|
|
44
|
+
let R = (e) => {
|
|
45
|
+
let t = {
|
|
46
|
+
ArrowDown: "next",
|
|
47
|
+
ArrowUp: "prev",
|
|
48
|
+
Home: "first",
|
|
49
|
+
End: "last"
|
|
50
|
+
}[e.key];
|
|
51
|
+
if (t) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
let n = document.activeElement?.getAttribute("data-menu-index");
|
|
54
|
+
P(a(n == null ? -1 : Number(n), t, y));
|
|
55
|
+
} else e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), N(!0)) : e.key === "Tab" && N(!1);
|
|
56
|
+
}, z = (e) => {
|
|
57
|
+
e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), k(!0)) : e.key === "Escape" && O && (e.stopPropagation(), N(!0));
|
|
58
|
+
}, B = O ? t(A.current) : null;
|
|
59
|
+
return /* @__PURE__ */ c("span", {
|
|
60
|
+
ref: A,
|
|
61
|
+
id: E,
|
|
62
|
+
className: r("kapi-menubtn", w),
|
|
63
|
+
style: T,
|
|
64
|
+
children: [/* @__PURE__ */ c(e, {
|
|
65
|
+
ref: j,
|
|
66
|
+
variant: x,
|
|
67
|
+
icon: b,
|
|
68
|
+
"aria-label": S,
|
|
69
|
+
"aria-haspopup": "menu",
|
|
70
|
+
"aria-expanded": O,
|
|
71
|
+
"aria-controls": O ? D : void 0,
|
|
72
|
+
onClick: () => k((e) => !e),
|
|
73
|
+
onKeyDown: z,
|
|
74
|
+
children: [v, /* @__PURE__ */ s(h, {
|
|
75
|
+
size: 15,
|
|
76
|
+
strokeWidth: 2.2,
|
|
77
|
+
"aria-hidden": "true"
|
|
78
|
+
})]
|
|
79
|
+
}), B && g(/* @__PURE__ */ s("div", {
|
|
80
|
+
ref: M,
|
|
81
|
+
id: D,
|
|
82
|
+
role: "menu",
|
|
83
|
+
className: `kapi-ctxmenu kapi-menubtn__menu kapi-menubtn__menu--${F?.side === "top" ? "top" : "bottom"} kapi-menubtn__menu--${F?.align === "end" ? "right" : "left"}`,
|
|
84
|
+
style: I,
|
|
85
|
+
onKeyDown: R,
|
|
86
|
+
children: y.map((e, t) => e.sep ? /* @__PURE__ */ s("div", {
|
|
87
|
+
role: "separator",
|
|
88
|
+
className: "kapi-ctxmenu__sep"
|
|
89
|
+
}, `s${t}`) : "header" in e ? /* @__PURE__ */ s("div", {
|
|
90
|
+
role: "presentation",
|
|
91
|
+
className: "kapi-ctxmenu__header",
|
|
92
|
+
children: e.header
|
|
93
|
+
}, `h${t}`) : /* @__PURE__ */ c("button", {
|
|
94
|
+
type: "button",
|
|
95
|
+
role: "menuitem",
|
|
96
|
+
tabIndex: -1,
|
|
97
|
+
"data-menu-index": t,
|
|
98
|
+
"aria-disabled": e.disabled ? "true" : void 0,
|
|
99
|
+
className: o(e),
|
|
100
|
+
onClick: () => {
|
|
101
|
+
e.disabled || (N(!0), e.onClick?.());
|
|
102
|
+
},
|
|
103
|
+
children: [e.icon, e.label]
|
|
104
|
+
}, `${e.label}-${t}`))
|
|
105
|
+
}), B)]
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
//#endregion
|
|
109
|
+
export { v as KapiMenuButton };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import { type GrowOrigin } from "../../hooks/growOriginLogic";
|
|
3
|
+
import { type KapiModalSize } from "./dialogUtils";
|
|
4
|
+
import "./KapiModal.css";
|
|
5
|
+
import type { KapiLabelsOverride } from "../labelsLogic";
|
|
6
|
+
export type { KapiModalSize } from "./dialogUtils";
|
|
7
|
+
export type KapiModalLabels = {
|
|
8
|
+
close: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const DEFAULT_MODAL_LABELS: KapiModalLabels;
|
|
11
|
+
export type KapiModalProps = {
|
|
12
|
+
/** Muestra u oculta el modal (controlado). Con `false` anima la salida y se desmonta. */
|
|
13
|
+
open: boolean;
|
|
14
|
+
/** Título del header (también nombra al diálogo para lectores de pantalla). */
|
|
15
|
+
title?: ReactNode | undefined;
|
|
16
|
+
/** Texto secundario bajo el título. */
|
|
17
|
+
subtitle?: ReactNode | undefined;
|
|
18
|
+
/** Pedido de cierre (X, click en el fondo, Escape). El padre pone `open={false}`. */
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
/** Contenido del cuerpo (con scroll propio). */
|
|
21
|
+
children?: ReactNode | undefined;
|
|
22
|
+
/** Zona fija inferior (botones). */
|
|
23
|
+
footer?: ReactNode | undefined;
|
|
24
|
+
/** Ancho: sm 460 · md 760 (default) · lg 980 · full pantalla completa. */
|
|
25
|
+
size?: KapiModalSize | undefined;
|
|
26
|
+
/** Sin header: queda sólo la X flotante (usado por KapiConfirm). */
|
|
27
|
+
hideHeader?: boolean | undefined;
|
|
28
|
+
/** Clase de la tarjeta del modal. */
|
|
29
|
+
className?: string | undefined;
|
|
30
|
+
/** Estilo de la tarjeta del modal. */
|
|
31
|
+
style?: CSSProperties | undefined;
|
|
32
|
+
/** id de la tarjeta del modal. */
|
|
33
|
+
id?: string | undefined;
|
|
34
|
+
/** Click en el fondo cierra. Default true. */
|
|
35
|
+
closeOnBackdrop?: boolean | undefined;
|
|
36
|
+
/** Escape cierra. Default true. */
|
|
37
|
+
closeOnEscape?: boolean | undefined;
|
|
38
|
+
/** Nombre accesible de la X. Gana sobre `labels.close` ("Cerrar"). */
|
|
39
|
+
closeLabel?: string | undefined;
|
|
40
|
+
/** Textos fijos (clave `modal`). */
|
|
41
|
+
labels?: KapiLabelsOverride<KapiModalLabels> | undefined;
|
|
42
|
+
/** Nombre accesible del diálogo; gana sobre el título (default: el header, o `title` string sin header). */
|
|
43
|
+
"aria-label"?: string | undefined;
|
|
44
|
+
/** id de un elemento que nombra al diálogo; gana sobre `aria-label` y el título. */
|
|
45
|
+
"aria-labelledby"?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Centro (coordenadas de viewport) del botón que abrió el modal, p. ej. de `useGrowOrigin()`.
|
|
48
|
+
* Con valor, la tarjeta crece desde ahí; sin valor (o con reduced-motion) no cambia nada.
|
|
49
|
+
*/
|
|
50
|
+
growFrom?: GrowOrigin | null | undefined;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Modal genérico sobre `<dialog>` nativo (`showModal()`): focus trap,
|
|
54
|
+
* Escape, `inert` del fondo y restauración de foco gratis, más bloqueo de scroll
|
|
55
|
+
* del body. Controlado con `open` + `onClose`, dentro de `.kapi`; cada apertura
|
|
56
|
+
* monta el diálogo de cero (foco inicial, estado interno).
|
|
57
|
+
* Al cerrar anima la salida (la duración sale del CSS, `useExitPresence`) y luego se desmonta; sin
|
|
58
|
+
* movimiento (reduced-motion) se desmonta de inmediato.
|
|
59
|
+
* Zonas: head fijo · body con scroll · footer fijo.
|
|
60
|
+
*/
|
|
61
|
+
export declare const KapiModal: ({ open, ...props }: KapiModalProps) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
3
|
+
import { prefersReducedMotion as t } from "../../hooks/reducedMotion.js";
|
|
4
|
+
import { dialogNameProps as n, modalClasses as r } from "./dialogUtils.js";
|
|
5
|
+
import { useExitPresence as i } from "./useExitPresence.js";
|
|
6
|
+
import { originWithinCard as a } from "../../hooks/growOriginLogic.js";
|
|
7
|
+
import { getPortalRoot as o, useBackdropClose as s, useNativeDialog as c } from "./useNativeDialog.js";
|
|
8
|
+
/* empty css */
|
|
9
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
|
+
import { useId as d, useLayoutEffect as f, useRef as p, useState as m } from "react";
|
|
11
|
+
import { X as h } from "lucide-react";
|
|
12
|
+
import { createPortal as g } from "react-dom";
|
|
13
|
+
//#region src/components/overlays/KapiModal.tsx
|
|
14
|
+
var _ = { close: "Cerrar" }, v = ({ open: e, ...t }) => {
|
|
15
|
+
let n = p(null), { present: r, closing: a } = i(e, n);
|
|
16
|
+
return r ? /* @__PURE__ */ l(b, {
|
|
17
|
+
...t,
|
|
18
|
+
dialogRef: n,
|
|
19
|
+
closing: a
|
|
20
|
+
}) : null;
|
|
21
|
+
}, y = () => {}, b = ({ title: i, subtitle: v, onClose: b, children: x, footer: S, size: C = "md", hideHeader: w = !1, className: T = "", style: E, id: D, closeOnBackdrop: O = !0, closeOnEscape: k = !0, closeLabel: A, labels: j, "aria-label": M, "aria-labelledby": N, growFrom: P, dialogRef: F, closing: I }) => {
|
|
22
|
+
let L = I ? y : b, R = d(), z = e("modal", _, j), B = A ?? z.close, V = p(null), [H, U] = m(null), { ref: W, dialogProps: G } = c({ onRequestClose: k ? L : void 0 }), K = s(O ? L : void 0);
|
|
23
|
+
f(() => {
|
|
24
|
+
let e = V.current;
|
|
25
|
+
if (!P || !e || t(e)) {
|
|
26
|
+
U(null);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let n = e.getBoundingClientRect(), r = e.offsetWidth, i = e.offsetHeight, o = n.left + n.width / 2, s = n.top + n.height / 2;
|
|
30
|
+
U(a(P, {
|
|
31
|
+
left: o - r / 2,
|
|
32
|
+
top: s - i / 2,
|
|
33
|
+
width: r,
|
|
34
|
+
height: i
|
|
35
|
+
}));
|
|
36
|
+
}, [P]);
|
|
37
|
+
let q = o();
|
|
38
|
+
return q ? g(/* @__PURE__ */ l("dialog", {
|
|
39
|
+
ref: (e) => {
|
|
40
|
+
W.current = e, F.current = e;
|
|
41
|
+
},
|
|
42
|
+
className: "kapi-modal-overlay kapi-modal-dialog",
|
|
43
|
+
"data-closing": I || void 0,
|
|
44
|
+
"aria-modal": "true",
|
|
45
|
+
...n({
|
|
46
|
+
titleId: R,
|
|
47
|
+
title: i,
|
|
48
|
+
hideHeader: w,
|
|
49
|
+
"aria-label": M,
|
|
50
|
+
"aria-labelledby": N
|
|
51
|
+
}),
|
|
52
|
+
...G,
|
|
53
|
+
...K,
|
|
54
|
+
children: /* @__PURE__ */ u("div", {
|
|
55
|
+
ref: V,
|
|
56
|
+
id: D,
|
|
57
|
+
className: `${r(C, T)}${H ? " kapi-modal--grow" : ""}`,
|
|
58
|
+
style: H ? {
|
|
59
|
+
...E,
|
|
60
|
+
"--kapi-grow-x": `${H.x}px`,
|
|
61
|
+
"--kapi-grow-y": `${H.y}px`
|
|
62
|
+
} : E,
|
|
63
|
+
children: [
|
|
64
|
+
w ? /* @__PURE__ */ l("button", {
|
|
65
|
+
type: "button",
|
|
66
|
+
className: "kapi-modal__x kapi-modal__x--float",
|
|
67
|
+
onClick: L,
|
|
68
|
+
"aria-label": B,
|
|
69
|
+
children: /* @__PURE__ */ l(h, {
|
|
70
|
+
size: 17,
|
|
71
|
+
strokeWidth: 2.2
|
|
72
|
+
})
|
|
73
|
+
}) : /* @__PURE__ */ u("div", {
|
|
74
|
+
className: "kapi-modal__head",
|
|
75
|
+
children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("div", {
|
|
76
|
+
id: R,
|
|
77
|
+
className: "kapi-modal__title",
|
|
78
|
+
children: i
|
|
79
|
+
}), v && /* @__PURE__ */ l("div", {
|
|
80
|
+
className: "kapi-modal__sub",
|
|
81
|
+
children: v
|
|
82
|
+
})] }), /* @__PURE__ */ l("button", {
|
|
83
|
+
type: "button",
|
|
84
|
+
className: "kapi-modal__x",
|
|
85
|
+
onClick: L,
|
|
86
|
+
"aria-label": B,
|
|
87
|
+
children: /* @__PURE__ */ l(h, {
|
|
88
|
+
size: 17,
|
|
89
|
+
strokeWidth: 2.2
|
|
90
|
+
})
|
|
91
|
+
})]
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ l("div", {
|
|
94
|
+
className: "kapi-modal__body",
|
|
95
|
+
children: x
|
|
96
|
+
}),
|
|
97
|
+
S && /* @__PURE__ */ l("div", {
|
|
98
|
+
className: "kapi-modal__foot",
|
|
99
|
+
children: S
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
})
|
|
103
|
+
}), q) : null;
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
export { _ as DEFAULT_MODAL_LABELS, v as KapiModal };
|