@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,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { assignRef as e, fieldControlProps as t, focusLeaves as n, joinIds as r } from "./fieldLogic.js";
|
|
3
|
+
import { useKapiField as ee } from "./KapiField.js";
|
|
4
|
+
import { useLabels as i } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { joinClasses as a } from "../rootProps.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { addTags as o, hasSeparator as s, removeTagAt as c, spliceText as te, splitDraft as l, splitTags as u } from "./tagInputLogic.js";
|
|
8
|
+
import { KapiTag as d } from "../display/KapiTag.js";
|
|
9
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
|
+
import { useCallback as m, useId as ne, useRef as h, useState as g } from "react";
|
|
11
|
+
//#region src/components/inputs/KapiTagInput.tsx
|
|
12
|
+
var _ = {
|
|
13
|
+
remove: "Quitar",
|
|
14
|
+
duplicate: "Ya está en la lista:",
|
|
15
|
+
max: "Llegaste al máximo de"
|
|
16
|
+
}, v = ({ size: e = "md", invalid: t, disabled: n, className: r }) => a("kapi-taginput", e !== "md" && `kapi-taginput--${e}`, t && "kapi-taginput--err", n && "kapi-taginput--disabled", r);
|
|
17
|
+
function y({ value: a, defaultValue: y = [], onChange: b, validate: x, maxTags: S, allowDuplicates: C, caseSensitive: w, placeholder: T, disabled: E = !1, size: D = "md", name: O, id: re, invalid: ie, required: k, "aria-label": A, "aria-labelledby": j, "aria-describedby": M, onBlur: N, ref: P, labels: F, className: I, onClick: L, ...R }) {
|
|
18
|
+
let z = i("tagInput", _, F), B = ee(), V = ne(), [H, U] = g(y), [W, G] = g(""), [K, q] = g(null), J = h(null), Y = h(null), X = a ?? H, ae = m((t) => {
|
|
19
|
+
Y.current = t, e(P, t);
|
|
20
|
+
}, [P]), Z = (e) => {
|
|
21
|
+
a === void 0 && U(e), b?.(e);
|
|
22
|
+
}, oe = (e) => e.reason === "invalid" ? e.message : e.reason === "duplicate" ? `${z.duplicate} ${e.tag}` : `${z.max} ${S}`, Q = (e, t = "") => {
|
|
23
|
+
let { values: n, rejected: r } = o(X, e, {
|
|
24
|
+
validate: x,
|
|
25
|
+
maxTags: S,
|
|
26
|
+
allowDuplicates: C,
|
|
27
|
+
caseSensitive: w
|
|
28
|
+
});
|
|
29
|
+
n.length !== X.length && Z(n), q(r[0] ? oe(r[0]) : null), G([...r.map((e) => e.tag), t].filter(Boolean).join(", "));
|
|
30
|
+
}, se = (e) => {
|
|
31
|
+
let t = e.target.value;
|
|
32
|
+
if (q(null), !s(t)) {
|
|
33
|
+
G(t);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let { complete: n, tail: r } = l(t);
|
|
37
|
+
Q(n, r);
|
|
38
|
+
}, ce = (e) => {
|
|
39
|
+
E || (e.key === "Enter" && W.trim() ? (e.preventDefault(), Q(u(W))) : e.key === "Backspace" && W === "" && X.length > 0 && (e.preventDefault(), q(null), Z(c(X, X.length - 1))));
|
|
40
|
+
}, le = (e) => {
|
|
41
|
+
let t = e.clipboardData.getData("text");
|
|
42
|
+
if (!s(t)) return;
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
let n = e.currentTarget, r = te(W, n.selectionStart ?? W.length, n.selectionEnd ?? W.length, t);
|
|
45
|
+
Q(u(r));
|
|
46
|
+
}, ue = (e) => {
|
|
47
|
+
n(e.relatedTarget, J.current) && (W.trim() && Q(u(W)), N?.(e));
|
|
48
|
+
}, de = (e) => {
|
|
49
|
+
L?.(e), !(e.defaultPrevented || E) && (e.target.closest("button, input") || Y.current?.focus());
|
|
50
|
+
}, fe = (e) => {
|
|
51
|
+
q(null), Z(c(X, e)), Y.current?.focus();
|
|
52
|
+
}, $ = K !== null || (ie ?? B?.invalid ?? !1);
|
|
53
|
+
return /* @__PURE__ */ p("div", {
|
|
54
|
+
...R,
|
|
55
|
+
ref: J,
|
|
56
|
+
className: v({
|
|
57
|
+
size: D,
|
|
58
|
+
invalid: $,
|
|
59
|
+
disabled: E,
|
|
60
|
+
className: I
|
|
61
|
+
}),
|
|
62
|
+
onClick: de,
|
|
63
|
+
onBlur: ue,
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ p("div", {
|
|
66
|
+
className: "kapi-taginput__box",
|
|
67
|
+
children: [X.length > 0 && /* @__PURE__ */ f("ul", {
|
|
68
|
+
className: "kapi-taginput__tags",
|
|
69
|
+
children: X.map((e, t) => /* @__PURE__ */ f("li", {
|
|
70
|
+
className: "kapi-taginput__item",
|
|
71
|
+
children: /* @__PURE__ */ f(d, {
|
|
72
|
+
tone: "primary",
|
|
73
|
+
size: D === "sm" ? "sm" : "md",
|
|
74
|
+
onRemove: E ? void 0 : () => fe(t),
|
|
75
|
+
removeLabel: `${z.remove} ${e}`,
|
|
76
|
+
children: e
|
|
77
|
+
})
|
|
78
|
+
}, `${t}-${e}`))
|
|
79
|
+
}), /* @__PURE__ */ f("input", {
|
|
80
|
+
ref: ae,
|
|
81
|
+
type: "text",
|
|
82
|
+
className: "kapi-taginput__input",
|
|
83
|
+
...t(B, {
|
|
84
|
+
id: re,
|
|
85
|
+
describedBy: r(K !== null && V, M),
|
|
86
|
+
invalid: $,
|
|
87
|
+
required: k
|
|
88
|
+
}),
|
|
89
|
+
"aria-label": A,
|
|
90
|
+
"aria-labelledby": j,
|
|
91
|
+
placeholder: X.length ? void 0 : T,
|
|
92
|
+
value: W,
|
|
93
|
+
disabled: E,
|
|
94
|
+
enterKeyHint: "enter",
|
|
95
|
+
onChange: se,
|
|
96
|
+
onKeyDown: ce,
|
|
97
|
+
onPaste: le
|
|
98
|
+
})]
|
|
99
|
+
}),
|
|
100
|
+
K !== null && /* @__PURE__ */ f("span", {
|
|
101
|
+
id: V,
|
|
102
|
+
className: "kapi-taginput__error",
|
|
103
|
+
role: "alert",
|
|
104
|
+
children: K
|
|
105
|
+
}),
|
|
106
|
+
O && X.map((e, t) => /* @__PURE__ */ f("input", {
|
|
107
|
+
type: "hidden",
|
|
108
|
+
name: O,
|
|
109
|
+
value: e
|
|
110
|
+
}, `${t}-${e}`))
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { _ as DEFAULT_TAG_INPUT_LABELS, y as KapiTagInput, v as tagInputClasses };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode, type Ref, type TextareaHTMLAttributes } from "react";
|
|
2
|
+
import "./inputsExtra.css";
|
|
3
|
+
import { type KapiFieldStatus } from "./KapiField";
|
|
4
|
+
export type KapiTextareaFieldProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
5
|
+
/** Validation: green (`ok`) or red (`err`) border. */
|
|
6
|
+
status?: KapiFieldStatus;
|
|
7
|
+
/** Label. With `label` or `help` the control is wrapped in a `KapiField`. */
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
/** Adds the required asterisk to the label. */
|
|
10
|
+
required?: boolean;
|
|
11
|
+
/** Help / error message below the control (takes the color of `status`). */
|
|
12
|
+
help?: ReactNode;
|
|
13
|
+
/** Class of the wrapping `KapiField` (if any). `className` goes to the control. */
|
|
14
|
+
fieldClassName?: string;
|
|
15
|
+
/** Grow with the content instead of showing a scrollbar. */
|
|
16
|
+
autosize?: boolean;
|
|
17
|
+
/** With `autosize`: max visible rows before it scrolls (default: unlimited). */
|
|
18
|
+
maxRows?: number;
|
|
19
|
+
/** Ref to the `<textarea>`. */
|
|
20
|
+
ref?: Ref<HTMLTextAreaElement>;
|
|
21
|
+
};
|
|
22
|
+
/** Control classes. Pure and exported: this is what gets tested (not the markup). */
|
|
23
|
+
export declare const textareaClasses: ({ status, autosize, className }?: {
|
|
24
|
+
status?: KapiFieldStatus | undefined;
|
|
25
|
+
autosize?: boolean | undefined;
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
}) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Multiline text field of the design system (`.kapi-input` + `.kapi-textarea`). Works controlled or not.
|
|
30
|
+
* With `autosize` it grows with its content, optionally up to `maxRows`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const KapiTextarea: ({ status, label, required, help, fieldClassName, autosize, maxRows, className, id, rows, onInput, ref, ...rest }: KapiTextareaFieldProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { fieldControlProps as e, joinIds as t } from "./fieldLogic.js";
|
|
3
|
+
import { KapiField as n, useKapiField as r } from "./KapiField.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { inputClasses as i } from "./KapiInput.js";
|
|
6
|
+
import { autosizeHeight as a, rowsToHeight as o } from "./textareaLogic.js";
|
|
7
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
8
|
+
import { useCallback as c, useId as l, useLayoutEffect as u, useRef as d } from "react";
|
|
9
|
+
//#region src/components/inputs/KapiTextarea.tsx
|
|
10
|
+
var f = ({ status: e, autosize: t = !1, className: n = "" } = {}) => i({
|
|
11
|
+
status: e,
|
|
12
|
+
className: [
|
|
13
|
+
"kapi-textarea",
|
|
14
|
+
t && "kapi-textarea--auto",
|
|
15
|
+
n
|
|
16
|
+
].filter(Boolean).join(" ")
|
|
17
|
+
}), p = ({ status: i, label: p, required: m, help: h, fieldClassName: g, autosize: _, maxRows: v, className: y, id: b, rows: x = 3, onInput: S, ref: C, ...w }) => {
|
|
18
|
+
let T = r(), E = p != null || !!h, D = l(), O = b ?? (E ? D : T?.controlId), k = h ? `${O}-help` : void 0, A = d(null), j = c((e) => {
|
|
19
|
+
A.current = e, typeof C == "function" ? C(e) : C && (C.current = e);
|
|
20
|
+
}, [C]), M = c(() => {
|
|
21
|
+
let e = A.current;
|
|
22
|
+
if (!e || !_) return;
|
|
23
|
+
let t = getComputedStyle(e), n = (e) => parseFloat(e) || 0, r = n(t.lineHeight) || n(t.fontSize) * 1.5, i = n(t.borderTopWidth) + n(t.borderBottomWidth), s = n(t.paddingTop) + n(t.paddingBottom) + i;
|
|
24
|
+
e.style.height = "auto";
|
|
25
|
+
let { height: c, overflowing: l } = a(e.scrollHeight + i, {
|
|
26
|
+
minHeight: o(x, r, s),
|
|
27
|
+
maxHeight: v ? o(v, r, s) : void 0
|
|
28
|
+
});
|
|
29
|
+
e.style.height = `${c}px`, e.style.overflowY = l ? "auto" : "hidden";
|
|
30
|
+
}, [
|
|
31
|
+
_,
|
|
32
|
+
v,
|
|
33
|
+
x
|
|
34
|
+
]);
|
|
35
|
+
u(M);
|
|
36
|
+
let N = (e) => {
|
|
37
|
+
M(), S?.(e);
|
|
38
|
+
}, P = /* @__PURE__ */ s("textarea", {
|
|
39
|
+
...w,
|
|
40
|
+
ref: j,
|
|
41
|
+
...e(E ? null : T, {
|
|
42
|
+
id: O,
|
|
43
|
+
describedBy: t(k, w["aria-describedby"]),
|
|
44
|
+
invalid: i ? i === "err" : void 0
|
|
45
|
+
}),
|
|
46
|
+
rows: x,
|
|
47
|
+
required: m,
|
|
48
|
+
className: f({
|
|
49
|
+
status: i,
|
|
50
|
+
autosize: _,
|
|
51
|
+
className: y
|
|
52
|
+
}),
|
|
53
|
+
onInput: N
|
|
54
|
+
});
|
|
55
|
+
return E ? /* @__PURE__ */ s(n, {
|
|
56
|
+
label: p,
|
|
57
|
+
htmlFor: O,
|
|
58
|
+
required: m,
|
|
59
|
+
help: h,
|
|
60
|
+
helpId: k,
|
|
61
|
+
status: i,
|
|
62
|
+
className: g,
|
|
63
|
+
children: P
|
|
64
|
+
}) : P;
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { p as KapiTextarea, f as textareaClasses };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type KapiSelectEntry, type KapiSelectOption, type KapiSelectValue } from "./selectLogic";
|
|
2
|
+
/** Opciones conocidas por valor: así los seleccionados conservan su label aunque salgan de la lista. */
|
|
3
|
+
export type KapiKnownOptions<T = unknown> = ReadonlyMap<string, KapiSelectOption<T>>;
|
|
4
|
+
/**
|
|
5
|
+
* Suma las opciones de `entries` (aplanando grupos) a la caché; la versión nueva de un valor reemplaza a la
|
|
6
|
+
* anterior. Sin cambios devuelve el mismo `Map` (un `setState` con él no re-renderiza).
|
|
7
|
+
*/
|
|
8
|
+
export declare const mergeKnownOptions: <T>(known: KapiKnownOptions<T>, entries: readonly KapiSelectEntry<T>[]) => KapiKnownOptions<T>;
|
|
9
|
+
/** Opciones seleccionadas resueltas desde la caché, en el orden del valor (los valores desconocidos se omiten). */
|
|
10
|
+
export declare const selectedFromKnown: <T>(known: KapiKnownOptions<T>, value: KapiSelectValue | undefined) => KapiSelectOption<T>[];
|
|
11
|
+
/**
|
|
12
|
+
* Ofrecer "Crear …": la búsqueda (sin espacios de borde) no está vacía y ninguna opción visible tiene
|
|
13
|
+
* exactamente ese label (sin distinguir mayúsculas ni acentos).
|
|
14
|
+
*/
|
|
15
|
+
export declare const showCreateOption: <T>(entries: readonly KapiSelectEntry<T>[], query: string) => boolean;
|
|
16
|
+
/** Valor tras crear una opción: simple → la creada; múltiple → se agrega (nunca se quita si ya estaba). */
|
|
17
|
+
export declare const withCreated: (value: KapiSelectValue | undefined, createdValue: string, multiple: boolean) => KapiSelectValue;
|
|
18
|
+
export type KapiLoadRequest = {
|
|
19
|
+
/** Señal para cancelar el pedido (se aborta al empezar otro, al cerrar o al desmontar). */
|
|
20
|
+
signal: AbortSignal;
|
|
21
|
+
/** Si el pedido sigue siendo el último y no se abortó: solo entonces puede escribir resultados. */
|
|
22
|
+
isCurrent: () => boolean;
|
|
23
|
+
};
|
|
24
|
+
export type KapiLoadSequencer = {
|
|
25
|
+
/** Empieza un pedido: aborta el anterior y lo vuelve viejo. */
|
|
26
|
+
start: () => KapiLoadRequest;
|
|
27
|
+
/** Aborta el pedido en curso sin empezar otro. */
|
|
28
|
+
cancel: () => void;
|
|
29
|
+
};
|
|
30
|
+
/** Secuencia de cargas: un `AbortController` por pedido más el guardia de respuestas fuera de orden. */
|
|
31
|
+
export declare const createLoadSequencer: () => KapiLoadSequencer;
|
|
32
|
+
/** Valor interno de la fila "Crear …" (nunca se emite: elegirla llama a `onCreate`). */
|
|
33
|
+
export declare const CREATE_VALUE = "\0kapisel-create";
|
|
34
|
+
/** Si la opción es la fila "Crear …" agregada por `menuItems`. */
|
|
35
|
+
export declare const isCreateRow: (option: {
|
|
36
|
+
value: string;
|
|
37
|
+
}) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Lista navegable del menú: las opciones aplanadas y, si `canCreate` y `showCreateOption` lo permiten, la fila
|
|
40
|
+
* "Crear …" al final (con índice propio para teclado y `aria-activedescendant`). Única fuente de la regla.
|
|
41
|
+
*/
|
|
42
|
+
export declare const menuItems: <T>(entries: readonly KapiSelectEntry<T>[], query: string, canCreate: boolean, createLabel: string) => KapiSelectOption<T>[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { flattenOptions as e, normalizeText as t, normalizeValue as n, toggleValue as r } from "./selectLogic.js";
|
|
2
|
+
import { createRequestTracker as i } from "./autocompleteLogic.js";
|
|
3
|
+
//#region src/components/inputs/asyncSelectLogic.ts
|
|
4
|
+
var a = (e, t) => e === t || e.label === t.label && e.disabled === t.disabled && e.data === t.data, o = (t, n) => {
|
|
5
|
+
let r = null;
|
|
6
|
+
for (let i of e(n)) {
|
|
7
|
+
let e = (r ?? t).get(i.value);
|
|
8
|
+
e && a(e, i) || (r ??= new Map(t), r.set(i.value, i));
|
|
9
|
+
}
|
|
10
|
+
return r ?? t;
|
|
11
|
+
}, s = (e, t) => {
|
|
12
|
+
let r = [];
|
|
13
|
+
for (let i of n(t, !0)) {
|
|
14
|
+
let t = e.get(i);
|
|
15
|
+
t && r.push(t);
|
|
16
|
+
}
|
|
17
|
+
return r;
|
|
18
|
+
}, c = (n, r) => {
|
|
19
|
+
let i = t(r.trim());
|
|
20
|
+
return i ? !e(n).some((e) => t(e.label.trim()) === i) : !1;
|
|
21
|
+
}, l = (e, t, i) => i && n(e, !0).includes(t) ? n(e, !0) : r(e, t, i), u = () => {
|
|
22
|
+
let e = i(), t = null;
|
|
23
|
+
return {
|
|
24
|
+
start: () => {
|
|
25
|
+
t?.abort();
|
|
26
|
+
let n = new AbortController();
|
|
27
|
+
t = n;
|
|
28
|
+
let r = e.next();
|
|
29
|
+
return {
|
|
30
|
+
signal: n.signal,
|
|
31
|
+
isCurrent: () => e.isCurrent(r) && !n.signal.aborted
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
cancel: () => {
|
|
35
|
+
t?.abort(), t = null, e.cancel();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}, d = "\0kapisel-create", f = (e) => e.value === d, p = (t, n, r, i) => {
|
|
39
|
+
let a = e(t);
|
|
40
|
+
return r && c(t, n) ? [...a, {
|
|
41
|
+
value: d,
|
|
42
|
+
label: i
|
|
43
|
+
}] : a;
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { d as CREATE_VALUE, u as createLoadSequencer, f as isCreateRow, p as menuItems, o as mergeKnownOptions, s as selectedFromKnown, c as showCreateOption, l as withCreated };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Lowercase + strip diacritics so "ingenieria" matches "Ingeniería". */
|
|
2
|
+
export declare const normalizeText: (text: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Sync filter: options whose label contains the query (case/diacritic-insensitive).
|
|
5
|
+
* Prefix matches rank before inner matches; ties keep the original order. `limit <= 0` or
|
|
6
|
+
* `Infinity` means no cap.
|
|
7
|
+
*/
|
|
8
|
+
export declare const filterOptions: <T>(options: readonly T[], query: string, getLabel: (option: T) => string, limit?: number) => T[];
|
|
9
|
+
/** Next/previous active index with wrap. From "none" (-1): down -> first, up -> last. */
|
|
10
|
+
export declare const moveActiveIndex: (current: number, count: number, direction: 1 | -1) => number;
|
|
11
|
+
/** Keep the active index valid when the list changes: -1 when empty, otherwise clamped into range. */
|
|
12
|
+
export declare const clampActiveIndex: (index: number, count: number) => number;
|
|
13
|
+
/** The dropdown opens only while the input is focused, not dismissed, and the query is long enough. */
|
|
14
|
+
export declare const shouldOpen: ({ focused, dismissed, query, minChars }: {
|
|
15
|
+
focused: boolean;
|
|
16
|
+
dismissed: boolean;
|
|
17
|
+
query: string;
|
|
18
|
+
minChars?: number;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
export type HighlightPart = {
|
|
21
|
+
text: string;
|
|
22
|
+
match: boolean;
|
|
23
|
+
};
|
|
24
|
+
/** Split a label around the first occurrence of the query (diacritic-insensitive), keeping original text. */
|
|
25
|
+
export declare const highlightParts: (label: string, query: string) => HighlightPart[];
|
|
26
|
+
/** True when a response belongs to the most recent request (older ones must be dropped). */
|
|
27
|
+
export declare const isLatestRequest: (requestId: number, latestId: number) => boolean;
|
|
28
|
+
export type RequestTracker = {
|
|
29
|
+
/** Start a new request; every earlier id becomes stale. */
|
|
30
|
+
next: () => number;
|
|
31
|
+
/** Invalidate all in-flight requests without starting one (unmount, query cleared). */
|
|
32
|
+
cancel: () => void;
|
|
33
|
+
/** Whether `id` is still the latest request. */
|
|
34
|
+
isCurrent: (id: number) => boolean;
|
|
35
|
+
};
|
|
36
|
+
/** Monotonic request-id tracker: guards against out-of-order async responses. */
|
|
37
|
+
export declare const createRequestTracker: () => RequestTracker;
|
|
38
|
+
export type MenuPosition = {
|
|
39
|
+
top: number;
|
|
40
|
+
left: number;
|
|
41
|
+
width: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Viewport-space (`position: fixed`) box for a portaled menu anchored under an input.
|
|
45
|
+
* `gap` is the vertical space between the input's bottom edge and the menu. Width never goes negative.
|
|
46
|
+
*/
|
|
47
|
+
export declare const menuPositionFrom: (rect: {
|
|
48
|
+
left: number;
|
|
49
|
+
bottom: number;
|
|
50
|
+
width: number;
|
|
51
|
+
}, gap?: number) => MenuPosition;
|
|
52
|
+
/** Engine options for the autocomplete menu: below the input, input width, flips up, no clamping. */
|
|
53
|
+
export declare const AUTOCOMPLETE_MENU_PLACEMENT: {
|
|
54
|
+
readonly side: "bottom";
|
|
55
|
+
readonly align: "start";
|
|
56
|
+
readonly flip: "auto";
|
|
57
|
+
readonly shift: false;
|
|
58
|
+
readonly width: "anchor";
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Menu box under the input that flips above when it does not fit below and there is more room above
|
|
62
|
+
* (unmeasured height 0 never flips). Same engine options the component uses through `usePlacement`.
|
|
63
|
+
*/
|
|
64
|
+
export declare const placeAutocompleteMenu: (rect: {
|
|
65
|
+
top: number;
|
|
66
|
+
bottom: number;
|
|
67
|
+
left: number;
|
|
68
|
+
width: number;
|
|
69
|
+
}, menuHeight: number, viewportHeight: number, gap?: number) => MenuPosition & {
|
|
70
|
+
side: "top" | "bottom";
|
|
71
|
+
};
|
|
72
|
+
/** Text shown as the default label for string-ish options. */
|
|
73
|
+
export declare const defaultGetLabel: (option: unknown) => string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//#region src/components/inputs/autocompleteLogic.ts
|
|
2
|
+
var e = (e) => e.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase(), t = (t, n, r, i = Infinity) => {
|
|
3
|
+
let a = e(n.trim()), o = i > 0 ? i : Infinity;
|
|
4
|
+
if (!a) return t.slice(0, o);
|
|
5
|
+
let s = [], c = [];
|
|
6
|
+
for (let n of t) {
|
|
7
|
+
let t = e(r(n)).indexOf(a);
|
|
8
|
+
t === 0 ? s.push(n) : t > 0 && c.push(n);
|
|
9
|
+
}
|
|
10
|
+
return [...s, ...c].slice(0, o);
|
|
11
|
+
}, n = (e, t, n) => t <= 0 ? -1 : e < 0 || e >= t ? n === 1 ? 0 : t - 1 : (e + n + t) % t, r = (e, t) => t <= 0 || e < 0 ? -1 : Math.min(e, t - 1), i = ({ focused: e, dismissed: t, query: n, minChars: r = 0 }) => e && !t && n.trim().length >= r, a = (t, n) => {
|
|
12
|
+
let r = e(n.trim());
|
|
13
|
+
if (!r || !t) return [{
|
|
14
|
+
text: t,
|
|
15
|
+
match: !1
|
|
16
|
+
}];
|
|
17
|
+
let i = "", a = [];
|
|
18
|
+
for (let n = 0; n < t.length; n++) {
|
|
19
|
+
let r = e(t.charAt(n));
|
|
20
|
+
for (let e = 0; e < r.length; e++) a.push(n);
|
|
21
|
+
i += r;
|
|
22
|
+
}
|
|
23
|
+
let o = i.indexOf(r);
|
|
24
|
+
if (o < 0) return [{
|
|
25
|
+
text: t,
|
|
26
|
+
match: !1
|
|
27
|
+
}];
|
|
28
|
+
let s = a[o] ?? 0, c = (a[o + r.length - 1] ?? t.length - 1) + 1;
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
text: t.slice(0, s),
|
|
32
|
+
match: !1
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
text: t.slice(s, c),
|
|
36
|
+
match: !0
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
text: t.slice(c),
|
|
40
|
+
match: !1
|
|
41
|
+
}
|
|
42
|
+
].filter((e) => e.text !== "");
|
|
43
|
+
}, o = (e, t) => e === t, s = () => {
|
|
44
|
+
let e = 0;
|
|
45
|
+
return {
|
|
46
|
+
next: () => ++e,
|
|
47
|
+
cancel: () => {
|
|
48
|
+
e++;
|
|
49
|
+
},
|
|
50
|
+
isCurrent: (t) => o(t, e)
|
|
51
|
+
};
|
|
52
|
+
}, c = {
|
|
53
|
+
side: "bottom",
|
|
54
|
+
align: "start",
|
|
55
|
+
flip: "auto",
|
|
56
|
+
shift: !1,
|
|
57
|
+
width: "anchor"
|
|
58
|
+
}, l = (e) => {
|
|
59
|
+
if (typeof e == "string") return e;
|
|
60
|
+
if (e && typeof e == "object" && "label" in e) {
|
|
61
|
+
let t = e.label;
|
|
62
|
+
if (typeof t == "string") return t;
|
|
63
|
+
}
|
|
64
|
+
return String(e);
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { c as AUTOCOMPLETE_MENU_PLACEMENT, r as clampActiveIndex, s as createRequestTracker, l as defaultGetLabel, t as filterOptions, a as highlightParts, o as isLatestRequest, n as moveActiveIndex, e as normalizeText, i as shouldOpen };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
export type KapiCheckControlProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "children"> & {
|
|
3
|
+
/** Texto al lado del control. Sin `label`, pasa `aria-label`. */
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
/** Marca el control como inválido (`aria-invalid`). Sin la prop, lo toma del `KapiField` (`status="err"`). */
|
|
6
|
+
invalid?: boolean;
|
|
7
|
+
/** Ref al `<input>`. */
|
|
8
|
+
ref?: Ref<HTMLInputElement>;
|
|
9
|
+
};
|
|
10
|
+
/** Clases del `<label>` `.kapi-check`. Pura y exportada para testear. */
|
|
11
|
+
export declare const checkClasses: (className?: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Base interna de KapiCheckbox y KapiRadio: `<label class="kapi-check"><input/>texto</label>`. `className` va a la etiqueta.
|
|
14
|
+
* Dentro de un `KapiField` toma ayuda (`aria-describedby`), `aria-invalid` y `aria-required`; el checkbox también el id
|
|
15
|
+
* (lo nombra el label del campo). El radio no: los de un grupo comparten el campo y se nombran con su `label`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const createCheckControl: (type: "checkbox" | "radio", displayName: string) => {
|
|
18
|
+
({ label, className, ref, invalid, id, required, "aria-describedby": describedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, ...rest }: KapiCheckControlProps): import("react").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { nativeFieldProps as e } from "./fieldLogic.js";
|
|
3
|
+
import { useKapiField as t } from "./KapiField.js";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/inputs/checkControl.tsx
|
|
6
|
+
var i = (e = "") => ["kapi-check", e].filter(Boolean).join(" "), a = (a, o) => {
|
|
7
|
+
let s = ({ label: o, className: s, ref: c, invalid: l, id: u, required: d, "aria-describedby": f, "aria-invalid": p, "aria-required": m, ...h }) => {
|
|
8
|
+
let g = e(t(), {
|
|
9
|
+
id: u,
|
|
10
|
+
describedBy: f,
|
|
11
|
+
invalid: l,
|
|
12
|
+
required: d,
|
|
13
|
+
ariaInvalid: p,
|
|
14
|
+
ariaRequired: m,
|
|
15
|
+
takeId: a !== "radio"
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ r("label", {
|
|
18
|
+
className: i(s),
|
|
19
|
+
children: [/* @__PURE__ */ n("input", {
|
|
20
|
+
ref: c,
|
|
21
|
+
type: a,
|
|
22
|
+
...h,
|
|
23
|
+
...g,
|
|
24
|
+
required: d
|
|
25
|
+
}), o]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
return s.displayName = o, s;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { i as checkClasses, a as createCheckControl };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export type KapiDatePickerMode = "date" | "time" | "datetime";
|
|
2
|
+
export type CalendarCell = {
|
|
3
|
+
day: number;
|
|
4
|
+
/** `true` si pertenece al mes anterior/siguiente (relleno de la grilla). */
|
|
5
|
+
out: boolean;
|
|
6
|
+
date: Date;
|
|
7
|
+
};
|
|
8
|
+
export declare const MESES: readonly ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
9
|
+
/** Encabezado de la semana: arranca en lunes. */
|
|
10
|
+
export declare const WEEKDAYS: readonly ["L", "M", "X", "J", "V", "S", "D"];
|
|
11
|
+
/** Nombres completos de los días (lunes primero): nombre accesible de encabezados y días. */
|
|
12
|
+
export declare const WEEKDAY_NAMES: readonly ["lunes", "martes", "miércoles", "jueves", "viernes", "sábado", "domingo"];
|
|
13
|
+
/** Textos de los calendarios (`KapiDatePicker`, `KapiDateRangePicker`); se pisan con `labels`. */
|
|
14
|
+
export type KapiCalendarLabels = {
|
|
15
|
+
/** Botón que abre el calendario. */
|
|
16
|
+
openPicker: string;
|
|
17
|
+
prevMonth: string;
|
|
18
|
+
nextMonth: string;
|
|
19
|
+
/** Vaciar el valor. */
|
|
20
|
+
clear: string;
|
|
21
|
+
today: string;
|
|
22
|
+
/** 12 nombres, enero primero. */
|
|
23
|
+
months: ReadonlyArray<string>;
|
|
24
|
+
/** 7 iniciales, lunes primero. */
|
|
25
|
+
weekdays: ReadonlyArray<string>;
|
|
26
|
+
/** 7 nombres completos, lunes primero (nombre accesible de encabezados y días). */
|
|
27
|
+
weekdayNames: ReadonlyArray<string>;
|
|
28
|
+
};
|
|
29
|
+
export declare const DEFAULT_CALENDAR_LABELS: KapiCalendarLabels;
|
|
30
|
+
/** Nombres del calendario que dependen del locale. */
|
|
31
|
+
export type KapiCalendarNames = Pick<KapiCalendarLabels, "months" | "weekdays" | "weekdayNames">;
|
|
32
|
+
/**
|
|
33
|
+
* Meses (largo) y días (inicial y largo, lunes primero) de `Intl.DateTimeFormat` para `locale`.
|
|
34
|
+
* Sin locale, o con uno inválido, devuelve los nombres en castellano (`MESES`, `WEEKDAYS`,
|
|
35
|
+
* `WEEKDAY_NAMES`, que coinciden con `Intl` en `es`). Cacheado por locale: seguro en render.
|
|
36
|
+
*/
|
|
37
|
+
export declare const calendarNames: (locale?: string) => KapiCalendarNames;
|
|
38
|
+
/**
|
|
39
|
+
* `DEFAULT_CALENDAR_LABELS` con los nombres de `calendarNames(locale)`; sin locale, los defaults
|
|
40
|
+
* tal cual. Devuelve el mismo objeto por locale (sirve como `defaults` estable de `useLabels`).
|
|
41
|
+
*/
|
|
42
|
+
export declare const localizedCalendarLabels: (locale?: string) => KapiCalendarLabels;
|
|
43
|
+
/** Título del mes visible: "octubre 2026". */
|
|
44
|
+
export declare const monthTitle: (view: Date, months?: ReadonlyArray<string>) => string;
|
|
45
|
+
export declare const pad: (n: number) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Minutos de la columna de hora, de a `step` (entero entre 1 y 59; otro valor vuelve a 1). Si el minuto
|
|
48
|
+
* elegido no cae en la grilla (p. ej. tipeado), se suma en orden para que siga marcado.
|
|
49
|
+
*/
|
|
50
|
+
export declare const minuteOptions: (step?: number, selected?: number | null) => number[];
|
|
51
|
+
export declare const hasCalendar: (mode: KapiDatePickerMode) => boolean;
|
|
52
|
+
export declare const hasTime: (mode: KapiDatePickerMode) => boolean;
|
|
53
|
+
export declare const sameDay: (a: Date | null | undefined, b: Date | null | undefined) => boolean;
|
|
54
|
+
export declare const sameMonth: (a: Date, b: Date) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Nombre accesible de un día de la grilla: "lunes 19 de octubre de 2026". Sale de los `labels`
|
|
57
|
+
* (meses y días) para que un override de idioma alcance también al lector de pantalla. Con un
|
|
58
|
+
* `locale` no castellano usa `Intl.DateTimeFormat` ("Monday, October 19, 2026") e ignora `labels`.
|
|
59
|
+
*/
|
|
60
|
+
export declare const calendarDayLabel: (date: Date, labels?: Pick<KapiCalendarLabels, "months" | "weekdayNames">, locale?: string) => string;
|
|
61
|
+
/** Parte la grilla (42 celdas) en semanas de 7, para las filas del `role="grid"`. */
|
|
62
|
+
export declare const calendarRows: <T>(cells: readonly T[]) => T[][];
|
|
63
|
+
/**
|
|
64
|
+
* Día a enfocar en la grilla tras una tecla (patrón WAI-ARIA date picker dialog):
|
|
65
|
+
* flechas ±1/±7 días, Home/End inicio (lunes) y fin (domingo) de la semana, PageUp/PageDown ±1 mes
|
|
66
|
+
* y con Shift ±1 año. Devuelve `undefined` si la tecla no navega. El caller cambia de mes si el
|
|
67
|
+
* resultado cae fuera del visible.
|
|
68
|
+
*/
|
|
69
|
+
export declare const moveCalendarFocus: (from: Date, e: {
|
|
70
|
+
key: string;
|
|
71
|
+
shiftKey?: boolean;
|
|
72
|
+
}) => Date | undefined;
|
|
73
|
+
/** Grilla de 6 semanas (42 celdas) del mes, con semana que arranca en lunes. */
|
|
74
|
+
export declare const buildDays: (year: number, month: number) => CalendarCell[];
|
|
75
|
+
/** `dd/mm/aaaa`, `hh:mm` o `dd/mm/aaaa hh:mm` según el modo. Vacío si no hay fecha. */
|
|
76
|
+
export declare const formatValue: (d: Date | null | undefined, mode: KapiDatePickerMode) => string;
|
|
77
|
+
/**
|
|
78
|
+
* Valor para formularios nativos, como lo serializan los inputs nativos: `yyyy-mm-dd` (date),
|
|
79
|
+
* `hh:mm` (time) o `yyyy-mm-ddThh:mm` (datetime-local), en hora local. Vacío si no hay fecha.
|
|
80
|
+
*/
|
|
81
|
+
export declare const formDateValue: (d: Date | null | undefined, mode: KapiDatePickerMode) => string;
|
|
82
|
+
/** Máscara de teclado: se queda con los dígitos y los reparte en `dd/mm/aaaa hh:mm`. */
|
|
83
|
+
export declare const maskInput: (raw: string, mode: KapiDatePickerMode) => string;
|
|
84
|
+
/**
|
|
85
|
+
* Parsea el texto tipeado.
|
|
86
|
+
* - `null`: texto vacío (borrar).
|
|
87
|
+
* - `undefined`: texto inválido (el caller restaura el último valor válido).
|
|
88
|
+
* - `Date`: valor válido. En "time" parte de `current` (o `now`) y pisa sólo la hora.
|
|
89
|
+
* Años de 2 dígitos se interpretan como 20xx. Rechaza fechas que desbordan
|
|
90
|
+
* (31/02) y horas fuera de rango (25:00) en vez de normalizarlas en silencio.
|
|
91
|
+
*/
|
|
92
|
+
export declare const parseText: (str: string, mode: KapiDatePickerMode, current?: Date | null, now?: Date) => Date | null | undefined;
|