@kapiuara/ui 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1202 -49
- package/dist/components/chat/KapiChatDivider.d.ts +8 -5
- package/dist/components/chat/KapiChatDivider.js +7 -6
- package/dist/components/chat/KapiChatList.d.ts +10 -6
- package/dist/components/chat/KapiChatList.js +12 -11
- package/dist/components/chat/KapiChatThread.d.ts +2 -3
- package/dist/components/chat/KapiChatThread.js +73 -52
- package/dist/components/chat/KapiComposer.d.ts +3 -4
- package/dist/components/chat/KapiComposer.js +2 -1
- package/dist/components/chat/KapiMessageBubble.d.ts +3 -4
- package/dist/components/chat/KapiMessageBubble.js +1 -0
- package/dist/components/chat/KapiTypingIndicator.d.ts +2 -3
- package/dist/components/chat/KapiTypingIndicator.js +1 -0
- package/dist/components/chat/chatLogic.d.ts +6 -0
- package/dist/components/chat/chatLogic.js +2 -2
- package/dist/components/chat/index.d.ts +18 -14
- package/dist/components/data/KapiBarChart.d.ts +13 -14
- package/dist/components/data/KapiBarChart.js +54 -52
- package/dist/components/data/KapiDataTable.d.ts +56 -0
- package/dist/components/data/KapiDataTable.js +143 -0
- package/dist/components/data/KapiEventCalendar.d.ts +9 -4
- package/dist/components/data/KapiEventCalendar.js +100 -96
- package/dist/components/data/KapiHeatmap.d.ts +8 -9
- package/dist/components/data/KapiHeatmap.js +64 -63
- package/dist/components/data/KapiLineChart.d.ts +9 -10
- package/dist/components/data/KapiLineChart.js +59 -56
- package/dist/components/data/KapiPagination.d.ts +6 -4
- package/dist/components/data/KapiPagination.js +2 -1
- package/dist/components/data/KapiPaginationFooter.d.ts +2 -3
- package/dist/components/data/KapiPaginationFooter.js +7 -4
- package/dist/components/data/KapiSparkline.d.ts +8 -9
- package/dist/components/data/KapiSparkline.js +1 -0
- package/dist/components/data/KapiTable.d.ts +7 -360
- package/dist/components/data/KapiTable.js +417 -692
- package/dist/components/data/KapiTableFilter.d.ts +16 -10
- package/dist/components/data/KapiTableFilter.js +50 -48
- package/dist/components/data/KapiTableRow.d.ts +55 -0
- package/dist/components/data/KapiTableRow.js +103 -0
- package/dist/components/data/KapiTableToolbar.d.ts +37 -0
- package/dist/components/data/KapiTableToolbar.js +237 -0
- package/dist/components/data/chartFrame.d.ts +1 -1
- package/dist/components/data/chartFrame.js +54 -55
- package/dist/components/data/datasetSelectionLogic.d.ts +7 -4
- package/dist/components/data/datasetSelectionLogic.js +3 -2
- package/dist/components/data/eventCalendarLogic.d.ts +7 -3
- package/dist/components/data/eventCalendarLogic.js +5 -4
- package/dist/components/data/index.d.ts +108 -30
- package/dist/components/data/rowClickLogic.d.ts +51 -0
- package/dist/components/data/rowClickLogic.js +56 -0
- package/dist/components/data/tableCells.d.ts +38 -0
- package/dist/components/data/tableCells.js +121 -0
- package/dist/components/data/tableHeaderMenu.d.ts +21 -0
- package/dist/components/data/tableHeaderMenu.js +45 -0
- package/dist/components/data/tableLabels.d.ts +76 -0
- package/dist/components/data/tableLabels.js +48 -0
- package/dist/components/data/tableLogic.d.ts +119 -21
- package/dist/components/data/tableLogic.js +121 -84
- package/dist/components/data/tablePaginationLogic.d.ts +15 -0
- package/dist/components/data/tablePaginationLogic.js +15 -0
- package/dist/components/data/tableResizeLogic.d.ts +12 -4
- package/dist/components/data/tableResizeLogic.js +14 -10
- package/dist/components/data/tableTypes.d.ts +509 -0
- package/dist/components/data/useColumnResize.d.ts +28 -0
- package/dist/components/data/useColumnResize.js +116 -0
- package/dist/components/data/useRowKeyWarning.d.ts +10 -0
- package/dist/components/data/useRowKeyWarning.js +29 -0
- package/dist/components/data/useTableEdges.d.ts +15 -0
- package/dist/components/data/useTableEdges.js +26 -0
- package/dist/components/data/useTableSelection.d.ts +51 -0
- package/dist/components/data/useTableSelection.js +80 -0
- package/dist/components/display/KapiAnnotation.d.ts +10 -9
- package/dist/components/display/KapiAnnotation.js +98 -101
- package/dist/components/display/KapiAvatar.d.ts +19 -13
- package/dist/components/display/KapiAvatar.js +26 -24
- package/dist/components/display/KapiAvatarGroup.d.ts +26 -10
- package/dist/components/display/KapiAvatarGroup.js +26 -24
- package/dist/components/display/KapiBadge.d.ts +23 -12
- package/dist/components/display/KapiBadge.js +20 -15
- package/dist/components/display/KapiComment.d.ts +1 -2
- package/dist/components/display/KapiComment.js +3 -2
- package/dist/components/display/KapiCommentComposer.d.ts +2 -3
- package/dist/components/display/KapiCommentComposer.js +3 -2
- package/dist/components/display/KapiDescriptionList.d.ts +6 -5
- package/dist/components/display/KapiDescriptionList.js +1 -0
- package/dist/components/display/KapiFileItem.d.ts +2 -3
- package/dist/components/display/KapiFileItem.js +3 -2
- package/dist/components/display/KapiFileViewer.d.ts +8 -9
- package/dist/components/display/KapiFileViewer.js +1 -0
- package/dist/components/display/KapiIconTile.d.ts +7 -6
- package/dist/components/display/KapiIconTile.js +1 -0
- package/dist/components/display/KapiStat.d.ts +9 -8
- package/dist/components/display/KapiStat.js +1 -0
- package/dist/components/display/KapiTag.d.ts +5 -4
- package/dist/components/display/KapiTag.js +1 -0
- package/dist/components/display/KapiTimeline.d.ts +6 -5
- package/dist/components/display/KapiTimeline.js +1 -0
- package/dist/components/display/KapiTruncate.d.ts +1 -2
- package/dist/components/display/KapiTruncate.js +1 -0
- package/dist/components/display/fileItemLogic.d.ts +1 -1
- package/dist/components/display/iconTileLogic.d.ts +2 -2
- package/dist/components/display/index.d.ts +86 -44
- package/dist/components/display/statLogic.d.ts +1 -1
- package/dist/components/feedback/KapiAlert.d.ts +30 -7
- package/dist/components/feedback/KapiAlert.js +47 -23
- package/dist/components/feedback/KapiBulkBar.d.ts +11 -6
- package/dist/components/feedback/KapiBulkBar.js +6 -3
- package/dist/components/feedback/KapiCountdown.d.ts +15 -12
- package/dist/components/feedback/KapiCountdown.js +17 -16
- package/dist/components/feedback/KapiEmpty.d.ts +3 -2
- package/dist/components/feedback/KapiEmpty.js +1 -0
- package/dist/components/feedback/KapiFab.d.ts +39 -9
- package/dist/components/feedback/KapiFab.js +172 -91
- package/dist/components/feedback/KapiOfflineBanner.d.ts +7 -6
- package/dist/components/feedback/KapiOfflineBanner.js +1 -0
- package/dist/components/feedback/KapiProgress.d.ts +8 -7
- package/dist/components/feedback/KapiProgress.js +1 -0
- package/dist/components/feedback/KapiSkeleton.d.ts +6 -4
- package/dist/components/feedback/KapiToastContainer.d.ts +16 -8
- package/dist/components/feedback/KapiToastContainer.js +118 -63
- package/dist/components/feedback/KapiTour.d.ts +6 -7
- package/dist/components/feedback/KapiTour.js +91 -86
- package/dist/components/feedback/KapiUnsavedBar.d.ts +15 -8
- package/dist/components/feedback/KapiUnsavedBar.js +8 -4
- package/dist/components/feedback/bulkBarLogic.d.ts +6 -1
- package/dist/components/feedback/bulkBarLogic.js +7 -4
- package/dist/components/feedback/countdownLogic.d.ts +19 -11
- package/dist/components/feedback/fabLogic.d.ts +28 -0
- package/dist/components/feedback/fabLogic.js +18 -2
- package/dist/components/feedback/index.d.ts +65 -33
- package/dist/components/feedback/toastLayer.d.ts +18 -0
- package/dist/components/feedback/toastLayer.js +22 -0
- package/dist/components/feedback/toastStore.d.ts +97 -9
- package/dist/components/feedback/toastStore.js +132 -29
- package/dist/components/feedback/tourLogic.d.ts +4 -16
- package/dist/components/feedback/unsavedBarLogic.d.ts +7 -1
- package/dist/components/feedback/unsavedBarLogic.js +9 -5
- package/dist/components/inputs/KapiAutocomplete.d.ts +73 -48
- package/dist/components/inputs/KapiAutocomplete.js +128 -146
- package/dist/components/inputs/KapiButton.d.ts +30 -11
- package/dist/components/inputs/KapiButton.js +34 -27
- package/dist/components/inputs/KapiCalendar.d.ts +14 -8
- package/dist/components/inputs/KapiCalendar.js +36 -34
- package/dist/components/inputs/KapiCalendarGrid.d.ts +11 -6
- package/dist/components/inputs/KapiCalendarGrid.js +44 -38
- package/dist/components/inputs/KapiCheckCard.d.ts +2 -3
- package/dist/components/inputs/KapiCheckCard.js +1 -0
- package/dist/components/inputs/KapiCheckbox.d.ts +1 -1
- package/dist/components/inputs/KapiChecklist.d.ts +77 -0
- package/dist/components/inputs/KapiChecklist.js +175 -0
- package/dist/components/inputs/KapiDatePicker.d.ts +60 -22
- package/dist/components/inputs/KapiDatePicker.js +124 -100
- package/dist/components/inputs/KapiDateRangePicker.d.ts +44 -10
- package/dist/components/inputs/KapiDateRangePicker.js +138 -108
- package/dist/components/inputs/KapiFacetedSearch.d.ts +7 -6
- package/dist/components/inputs/KapiFacetedSearch.js +130 -167
- package/dist/components/inputs/KapiField.d.ts +16 -8
- package/dist/components/inputs/KapiField.js +44 -43
- package/dist/components/inputs/KapiFileUpload.d.ts +15 -16
- package/dist/components/inputs/KapiFileUpload.js +1 -0
- package/dist/components/inputs/KapiIconButton.d.ts +1 -1
- package/dist/components/inputs/KapiInput.d.ts +13 -12
- package/dist/components/inputs/KapiInput.js +70 -70
- package/dist/components/inputs/KapiInputGroup.d.ts +13 -10
- package/dist/components/inputs/KapiInputGroup.js +21 -19
- package/dist/components/inputs/KapiMaskedInput.d.ts +22 -17
- package/dist/components/inputs/KapiMaskedInput.js +71 -55
- package/dist/components/inputs/KapiNumberStepper.d.ts +30 -18
- package/dist/components/inputs/KapiNumberStepper.js +80 -65
- package/dist/components/inputs/KapiRadio.d.ts +1 -1
- package/dist/components/inputs/KapiRating.d.ts +40 -23
- package/dist/components/inputs/KapiRating.js +82 -65
- package/dist/components/inputs/KapiSearchChip.d.ts +9 -8
- package/dist/components/inputs/KapiSearchChip.js +46 -42
- package/dist/components/inputs/KapiSegmented.d.ts +49 -16
- package/dist/components/inputs/KapiSegmented.js +82 -51
- package/dist/components/inputs/KapiSelect.d.ts +120 -39
- package/dist/components/inputs/KapiSelect.js +311 -371
- package/dist/components/inputs/KapiSelectMenu.d.ts +38 -0
- package/dist/components/inputs/KapiSelectMenu.js +173 -0
- package/dist/components/inputs/KapiSlider.d.ts +37 -19
- package/dist/components/inputs/KapiSlider.js +67 -54
- package/dist/components/inputs/KapiSwitch.d.ts +13 -7
- package/dist/components/inputs/KapiSwitch.js +30 -21
- package/dist/components/inputs/KapiTagInput.d.ts +35 -24
- package/dist/components/inputs/KapiTagInput.js +86 -73
- package/dist/components/inputs/KapiTextarea.d.ts +12 -11
- package/dist/components/inputs/KapiTextarea.js +71 -49
- package/dist/components/inputs/asyncSelectLogic.d.ts +8 -4
- package/dist/components/inputs/asyncSelectLogic.js +13 -12
- package/dist/components/inputs/autocompleteLogic.d.ts +2 -29
- package/dist/components/inputs/autocompleteLogic.js +6 -6
- package/dist/components/inputs/checkControl.d.ts +3 -3
- package/dist/components/inputs/checkControl.js +2 -0
- package/dist/components/inputs/checklistLogic.d.ts +33 -0
- package/dist/components/inputs/checklistLogic.js +16 -0
- package/dist/components/inputs/datePickerLogic.d.ts +63 -13
- package/dist/components/inputs/datePickerLogic.js +119 -50
- package/dist/components/inputs/dateRangeLogic.d.ts +8 -3
- package/dist/components/inputs/dateRangeLogic.js +49 -43
- package/dist/components/inputs/facetedSearchLogic.d.ts +1 -3
- package/dist/components/inputs/facetedSearchLogic.js +4 -5
- package/dist/components/inputs/fieldLogic.d.ts +37 -1
- package/dist/components/inputs/fieldLogic.js +36 -19
- package/dist/components/inputs/index.d.ts +118 -57
- package/dist/components/inputs/inputGroupLogic.d.ts +1 -1
- package/dist/components/inputs/inputLogic.d.ts +1 -1
- package/dist/components/inputs/maskLogic.d.ts +3 -2
- package/dist/components/inputs/maskLogic.js +12 -10
- package/dist/components/inputs/misuseWarnings.d.ts +37 -0
- package/dist/components/inputs/misuseWarnings.js +36 -0
- package/dist/components/inputs/numberStepLogic.d.ts +10 -0
- package/dist/components/inputs/numberStepLogic.js +16 -7
- package/dist/components/inputs/ownField.d.ts +37 -0
- package/dist/components/inputs/ownField.js +37 -0
- package/dist/components/inputs/segmentedLogic.d.ts +4 -3
- package/dist/components/inputs/segmentedLogic.js +7 -11
- package/dist/components/inputs/selectKeyLogic.d.ts +45 -0
- package/dist/components/inputs/selectKeyLogic.js +52 -0
- package/dist/components/inputs/selectLogic.d.ts +79 -22
- package/dist/components/inputs/selectLogic.js +87 -51
- package/dist/components/inputs/useCalendarFocus.js +13 -12
- package/dist/components/inputs/useSelectCreate.d.ts +22 -0
- package/dist/components/inputs/useSelectCreate.js +35 -0
- package/dist/components/inputs/useSelectSource.d.ts +39 -0
- package/dist/components/inputs/useSelectSource.js +42 -0
- package/dist/components/layout/KapiAccessCard.d.ts +11 -12
- package/dist/components/layout/KapiAccessCard.js +41 -37
- package/dist/components/layout/KapiAccountMenu.d.ts +23 -8
- package/dist/components/layout/KapiAccountMenu.js +124 -104
- package/dist/components/layout/KapiCard.d.ts +14 -7
- package/dist/components/layout/KapiCard.js +1 -0
- package/dist/components/layout/KapiCluster.d.ts +8 -7
- package/dist/components/layout/KapiCluster.js +1 -0
- package/dist/components/layout/KapiContextSlot.d.ts +10 -11
- package/dist/components/layout/KapiContextSlot.js +97 -92
- package/dist/components/layout/KapiDivider.d.ts +3 -2
- package/dist/components/layout/KapiDivider.js +1 -0
- package/dist/components/layout/KapiGrid.d.ts +8 -7
- package/dist/components/layout/KapiGrid.js +1 -0
- package/dist/components/layout/KapiMasonry.d.ts +1 -2
- package/dist/components/layout/KapiMasonry.js +1 -0
- package/dist/components/layout/KapiNotificationBell.d.ts +14 -15
- package/dist/components/layout/KapiNotificationBell.js +113 -116
- package/dist/components/layout/KapiPageHeader.d.ts +14 -6
- package/dist/components/layout/KapiPageHeader.js +99 -87
- package/dist/components/layout/KapiPanelParts.d.ts +11 -7
- package/dist/components/layout/KapiPanelParts.js +1 -0
- package/dist/components/layout/KapiRail.d.ts +17 -11
- package/dist/components/layout/KapiRail.js +96 -83
- package/dist/components/layout/KapiRailAccount.d.ts +26 -0
- package/dist/components/layout/KapiRailAccount.js +37 -0
- package/dist/components/layout/KapiRoot.d.ts +85 -0
- package/dist/components/layout/KapiRoot.js +58 -0
- package/dist/components/layout/KapiScrollArea.d.ts +2 -3
- package/dist/components/layout/KapiScrollArea.js +1 -0
- package/dist/components/layout/KapiShell.d.ts +15 -10
- package/dist/components/layout/KapiShell.js +51 -46
- package/dist/components/layout/KapiStack.d.ts +6 -5
- package/dist/components/layout/KapiStack.js +1 -0
- package/dist/components/layout/KapiThemeScript.d.ts +23 -0
- package/dist/components/layout/KapiThemeScript.js +13 -0
- package/dist/components/layout/accessCardLogic.d.ts +2 -2
- package/dist/components/layout/index.d.ts +55 -35
- package/dist/components/layout/notificationBellLogic.d.ts +1 -1
- package/dist/components/layout/railContext.d.ts +6 -0
- package/dist/components/layout/railContext.js +6 -0
- package/dist/components/layout/railLogic.d.ts +14 -14
- package/dist/components/layout/useMasonrySpans.js +31 -30
- package/dist/components/layout/useRailOverflow.js +30 -29
- package/dist/components/locale/KapiLocaleProvider.d.ts +33 -4
- package/dist/components/locale/KapiLocaleProvider.js +28 -17
- package/dist/components/locale/index.d.ts +7 -5
- package/dist/components/locale/labelRegistry.d.ts +67 -59
- package/dist/components/locale/localeLogic.d.ts +20 -0
- package/dist/components/locale/localeLogic.js +30 -0
- package/dist/components/navigation/CtxSlidingList.d.ts +5 -3
- package/dist/components/navigation/CtxSlidingList.js +16 -15
- package/dist/components/navigation/KapiAccordion.d.ts +9 -8
- package/dist/components/navigation/KapiAccordion.js +29 -29
- package/dist/components/navigation/KapiBreadcrumb.d.ts +4 -5
- package/dist/components/navigation/KapiBreadcrumb.js +1 -0
- package/dist/components/navigation/KapiCollapsiblePanel.d.ts +22 -16
- package/dist/components/navigation/KapiCollapsiblePanel.js +46 -43
- package/dist/components/navigation/KapiContextPanel.d.ts +31 -32
- package/dist/components/navigation/KapiContextPanel.js +119 -108
- package/dist/components/navigation/KapiFilterChips.d.ts +15 -10
- package/dist/components/navigation/KapiFilterChips.js +27 -22
- package/dist/components/navigation/KapiNavBadge.d.ts +7 -5
- package/dist/components/navigation/KapiNavBadge.js +12 -10
- package/dist/components/navigation/KapiPanelGroup.d.ts +22 -23
- package/dist/components/navigation/KapiPanelGroup.js +62 -60
- package/dist/components/navigation/KapiSteps.d.ts +4 -5
- package/dist/components/navigation/KapiSteps.js +1 -0
- package/dist/components/navigation/KapiTabs.d.ts +34 -16
- package/dist/components/navigation/KapiTabs.js +65 -49
- package/dist/components/navigation/KapiTree.d.ts +58 -18
- package/dist/components/navigation/KapiTree.js +135 -83
- package/dist/components/navigation/KapiWizard.d.ts +21 -11
- package/dist/components/navigation/KapiWizard.js +79 -72
- package/dist/components/navigation/MiniNavItem.d.ts +3 -4
- package/dist/components/navigation/MiniNavItem.js +1 -0
- package/dist/components/navigation/breadcrumbLogic.d.ts +1 -1
- package/dist/components/navigation/contextPanelLogic.d.ts +9 -5
- package/dist/components/navigation/filterChipsLogic.d.ts +13 -7
- package/dist/components/navigation/filterChipsLogic.js +12 -14
- package/dist/components/navigation/index.d.ts +75 -39
- package/dist/components/navigation/panelGroupLogic.d.ts +5 -1
- package/dist/components/navigation/panelMini.d.ts +1 -1
- package/dist/components/navigation/panelMini.js +1 -1
- package/dist/components/navigation/tabsLogic.d.ts +3 -2
- package/dist/components/navigation/tabsLogic.js +8 -12
- package/dist/components/navigation/treeLogic.d.ts +5 -5
- package/dist/components/navigation/treeLogic.js +3 -9
- package/dist/components/overlays/KapiCanvasForm.d.ts +8 -8
- package/dist/components/overlays/KapiCanvasForm.js +1 -1
- package/dist/components/overlays/KapiCommandPalette.d.ts +14 -10
- package/dist/components/overlays/KapiCommandPalette.js +70 -67
- package/dist/components/overlays/KapiConfirm.d.ts +16 -11
- package/dist/components/overlays/KapiConfirm.js +47 -44
- package/dist/components/overlays/KapiContextMenu.d.ts +77 -16
- package/dist/components/overlays/KapiContextMenu.js +55 -70
- package/dist/components/overlays/KapiDialogHost.d.ts +5 -7
- package/dist/components/overlays/KapiDialogHost.js +67 -64
- package/dist/components/overlays/KapiDropdown.d.ts +43 -21
- package/dist/components/overlays/KapiDropdown.js +31 -80
- package/dist/components/overlays/KapiLoading.d.ts +10 -5
- package/dist/components/overlays/KapiLoading.js +28 -25
- package/dist/components/overlays/KapiMenuButton.d.ts +48 -17
- package/dist/components/overlays/KapiMenuButton.js +73 -95
- package/dist/components/overlays/KapiModal.d.ts +16 -8
- package/dist/components/overlays/KapiModal.js +72 -65
- package/dist/components/overlays/KapiOffcanvas.d.ts +23 -13
- package/dist/components/overlays/KapiOffcanvas.js +159 -143
- package/dist/components/overlays/KapiOffcanvasStack.d.ts +4 -4
- package/dist/components/overlays/KapiOffcanvasStack.js +63 -52
- package/dist/components/overlays/KapiPhotoView.d.ts +7 -8
- package/dist/components/overlays/KapiPhotoView.js +67 -64
- package/dist/components/overlays/KapiPopover.d.ts +18 -17
- package/dist/components/overlays/KapiPopover.js +32 -42
- package/dist/components/overlays/KapiShapeSheet.d.ts +18 -12
- package/dist/components/overlays/KapiShapeSheet.js +51 -45
- package/dist/components/overlays/KapiSplitModal.d.ts +12 -11
- package/dist/components/overlays/KapiSplitModal.js +78 -68
- package/dist/components/overlays/KapiTooltip.d.ts +20 -10
- package/dist/components/overlays/KapiTooltip.js +91 -68
- package/dist/components/overlays/commandPaletteLogic.d.ts +2 -4
- package/dist/components/overlays/commandPaletteLogic.js +2 -2
- package/dist/components/overlays/dialogStore.d.ts +41 -20
- package/dist/components/overlays/dialogStore.js +4 -4
- package/dist/components/overlays/dialogUtils.d.ts +22 -0
- package/dist/components/overlays/dialogUtils.js +6 -2
- package/dist/components/overlays/index.d.ts +48 -38
- package/dist/components/overlays/menuButtonLogic.d.ts +33 -31
- package/dist/components/overlays/menuButtonLogic.js +9 -3
- package/dist/components/overlays/menuKeyboardLogic.d.ts +42 -8
- package/dist/components/overlays/menuKeyboardLogic.js +46 -15
- package/dist/components/overlays/menuList.d.ts +91 -0
- package/dist/components/overlays/menuList.js +223 -0
- package/dist/components/overlays/modalStack.d.ts +21 -0
- package/dist/components/overlays/modalStack.js +23 -0
- package/dist/components/overlays/offcanvasCompanion.d.ts +1 -1
- package/dist/components/overlays/offcanvasResize.d.ts +1 -1
- package/dist/components/overlays/offcanvasSide.d.ts +12 -1
- package/dist/components/overlays/offcanvasSide.js +4 -4
- package/dist/components/overlays/popoverLogic.d.ts +12 -12
- package/dist/components/overlays/useExitPresence.js +23 -22
- package/dist/components/overlays/useNativeDialog.d.ts +15 -4
- package/dist/components/overlays/useNativeDialog.js +52 -33
- package/dist/components/rootProps.d.ts +6 -4
- package/dist/components/tone.d.ts +55 -0
- package/dist/components/tone.js +92 -0
- package/dist/css/base.css +1 -0
- package/dist/css/components/chat/chat.css +1 -0
- package/dist/css/components/data/KapiBarChart.css +1 -0
- package/dist/css/components/data/KapiEventCalendar.css +1 -0
- package/dist/css/components/data/KapiHeatmap.css +1 -0
- package/dist/css/components/data/KapiLineChart.css +1 -0
- package/dist/css/components/data/KapiSparkline.css +1 -0
- package/dist/css/components/data/KapiTable.css +1 -0
- package/dist/css/components/data/KapiTableFilter.css +1 -0
- package/dist/css/components/display/KapiAnnotation.css +1 -0
- package/dist/css/components/display/KapiComment.css +1 -0
- package/dist/css/components/display/KapiFileItem.css +1 -0
- package/dist/css/components/display/KapiFileViewer.css +1 -0
- package/dist/css/components/display/KapiTruncate.css +1 -0
- package/dist/css/components/display/display.css +1 -0
- package/dist/css/components/feedback/KapiBulkBar.css +1 -0
- package/dist/css/components/feedback/KapiOfflineBanner.css +1 -0
- package/dist/css/components/feedback/KapiUnsavedBar.css +1 -0
- package/dist/css/components/feedback/feedback.css +1 -0
- package/dist/css/components/inputs/KapiAutocomplete.css +1 -0
- package/dist/css/components/inputs/KapiButton.css +1 -0
- package/dist/css/components/inputs/KapiChecklist.css +1 -0
- package/dist/css/components/inputs/KapiDatePicker.css +1 -0
- package/dist/css/components/inputs/KapiFacetedSearch.css +1 -0
- package/dist/css/components/inputs/KapiFileUpload.css +1 -0
- package/dist/css/components/inputs/KapiInputGroup.css +1 -0
- package/dist/css/components/inputs/KapiSearchChip.css +1 -0
- package/dist/css/components/inputs/KapiSelect.css +1 -0
- package/dist/css/components/inputs/KapiTagInput.css +1 -0
- package/dist/css/components/inputs/checkControl.css +1 -0
- package/dist/css/components/inputs/inputsExtra.css +1 -0
- package/dist/css/components/layout/KapiAccessCard.css +1 -0
- package/dist/css/components/layout/KapiAccountMenu.css +1 -0
- package/dist/css/components/layout/KapiCard.css +1 -0
- package/dist/css/components/layout/KapiDivider.css +1 -0
- package/dist/css/components/layout/KapiMasonry.css +1 -0
- package/dist/css/components/layout/KapiNotificationBell.css +1 -0
- package/dist/css/components/layout/KapiPageHeader.css +1 -0
- package/dist/css/components/layout/KapiPanelParts.css +1 -0
- package/dist/css/components/layout/KapiRail.css +1 -0
- package/dist/css/components/layout/KapiRoot.css +1 -0
- package/dist/css/components/layout/KapiScrollArea.css +1 -0
- package/dist/css/components/layout/layout-primitives.css +1 -0
- package/dist/css/components/navigation/KapiFilterChips.css +1 -0
- package/dist/css/components/navigation/KapiNavBadge.css +1 -0
- package/dist/css/components/navigation/KapiSteps.css +1 -0
- package/dist/css/components/navigation/navigation.css +1 -0
- package/dist/css/components/overlays/KapiCommandPalette.css +1 -0
- package/dist/css/components/overlays/KapiConfirm.css +1 -0
- package/dist/css/components/overlays/KapiModal.css +1 -0
- package/dist/css/components/overlays/KapiOffcanvas.css +1 -0
- package/dist/css/components/overlays/KapiPopover.css +1 -0
- package/dist/css/components/overlays/KapiSplitModal.css +1 -0
- package/dist/css/components/overlays/overlays.css +1 -0
- package/dist/css/none.js +1 -0
- package/dist/hooks/dataColorLogic.d.ts +1 -1
- package/dist/hooks/dateFormat.js +13 -13
- package/dist/hooks/directionLogic.d.ts +32 -0
- package/dist/hooks/directionLogic.js +7 -0
- package/dist/hooks/fieldErrorsLogic.d.ts +35 -0
- package/dist/hooks/fieldErrorsLogic.js +13 -0
- package/dist/hooks/focusLogic.js +8 -7
- package/dist/hooks/hotkeyLogic.d.ts +5 -1
- package/dist/hooks/hotkeyLogic.js +2 -2
- package/dist/hooks/index.d.ts +122 -57
- package/dist/hooks/kapiRoot.d.ts +11 -4
- package/dist/hooks/kapiRoot.js +18 -5
- package/dist/hooks/mergeRefs.d.ts +9 -0
- package/dist/hooks/mergeRefs.js +15 -0
- package/dist/hooks/onlineStatusLogic.d.ts +4 -4
- package/dist/hooks/ownerDocument.d.ts +26 -0
- package/dist/hooks/ownerDocument.js +24 -0
- package/dist/hooks/portalRoot.d.ts +19 -0
- package/dist/hooks/portalRoot.js +10 -0
- package/dist/hooks/rafThrottle.d.ts +12 -4
- package/dist/hooks/rafThrottle.js +43 -10
- package/dist/hooks/rangeSelectLogic.d.ts +47 -0
- package/dist/hooks/rangeSelectLogic.js +29 -0
- package/dist/hooks/recentLogic.d.ts +3 -3
- package/dist/hooks/reducedMotion.js +11 -3
- package/dist/hooks/rightClick.d.ts +5 -1
- package/dist/hooks/rightClick.js +16 -15
- package/dist/hooks/scrollCollapseLogic.d.ts +2 -2
- package/dist/hooks/seriesPaletteLogic.d.ts +1 -1
- package/dist/hooks/shallowStable.d.ts +12 -0
- package/dist/hooks/shallowStable.js +17 -0
- package/dist/hooks/slidingIndicatorLogic.d.ts +4 -0
- package/dist/hooks/themeColorsLogic.d.ts +1 -1
- package/dist/hooks/themeDeriveLogic.d.ts +1 -2
- package/dist/hooks/themeRadiiLogic.d.ts +1 -1
- package/dist/hooks/themeScript.d.ts +10 -0
- package/dist/hooks/themeScript.js +5 -0
- package/dist/hooks/useAsyncLoader.d.ts +51 -0
- package/dist/hooks/useAsyncLoader.js +77 -0
- package/dist/hooks/useAsyncTasks.d.ts +19 -0
- package/dist/hooks/useAsyncTasks.js +37 -0
- package/dist/hooks/useBottomBarInset.d.ts +7 -0
- package/dist/hooks/useBottomBarInset.js +25 -0
- package/dist/hooks/useControllableState.d.ts +25 -0
- package/dist/hooks/useControllableState.js +20 -0
- package/dist/hooks/useDismiss.d.ts +40 -0
- package/dist/hooks/useDismiss.js +42 -0
- package/dist/hooks/useDragScroll.d.ts +10 -0
- package/dist/hooks/useDragScroll.js +36 -25
- package/dist/hooks/useFieldErrors.d.ts +39 -0
- package/dist/hooks/useFieldErrors.js +29 -0
- package/dist/hooks/useFocusReturn.d.ts +25 -0
- package/dist/hooks/useFocusReturn.js +31 -0
- package/dist/hooks/useFormReset.d.ts +22 -0
- package/dist/hooks/useFormReset.js +17 -0
- package/dist/hooks/useGrowOrigin.d.ts +2 -2
- package/dist/hooks/useHotkey.d.ts +3 -3
- package/dist/hooks/useHydrated.d.ts +2 -0
- package/dist/hooks/useHydrated.js +6 -0
- package/dist/hooks/useKapiTheme.d.ts +3 -2
- package/dist/hooks/useKapiTheme.js +111 -68
- package/dist/hooks/useMediaQuery.d.ts +5 -1
- package/dist/hooks/useMediaQuery.js +5 -9
- package/dist/hooks/useOnlineStatus.d.ts +1 -1
- package/dist/hooks/useOutsidePress.d.ts +9 -0
- package/dist/hooks/useOutsidePress.js +11 -0
- package/dist/hooks/usePersistentState.d.ts +2 -2
- package/dist/hooks/usePersistentState.js +21 -21
- package/dist/hooks/usePlacement.d.ts +6 -5
- package/dist/hooks/usePlacement.js +68 -65
- package/dist/hooks/useRangeSelect.d.ts +24 -0
- package/dist/hooks/useRangeSelect.js +26 -0
- package/dist/hooks/useRecent.d.ts +3 -3
- package/dist/hooks/useScrollCollapse.d.ts +1 -1
- package/dist/hooks/useScrollEdges.d.ts +9 -8
- package/dist/hooks/useScrollEdges.js +62 -57
- package/dist/hooks/useSlidingIndicator.d.ts +1 -1
- package/dist/hooks/useSlidingIndicator.js +38 -33
- package/dist/hooks/useSubmitDraft.js +18 -19
- package/dist/hooks/useTypeahead.d.ts +9 -0
- package/dist/hooks/useTypeahead.js +20 -0
- package/dist/hooks/useUnsavedGuard.d.ts +7 -4
- package/dist/hooks/useUnsavedGuard.js +1 -0
- package/dist/hooks/useVirtualList.d.ts +36 -0
- package/dist/hooks/useVirtualList.js +126 -0
- package/dist/hooks/viewportInsetLogic.d.ts +37 -0
- package/dist/hooks/viewportInsetLogic.js +20 -0
- package/dist/hooks/virtualListLogic.d.ts +88 -0
- package/dist/hooks/virtualListLogic.js +80 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.js +196 -179
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +18 -7
|
@@ -1,29 +1,41 @@
|
|
|
1
|
-
import { type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
import "./
|
|
3
|
-
import type
|
|
4
|
-
import {
|
|
5
|
-
import type { KapiLabelsOverride } from "../labelsLogic";
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { KapiFieldStatus } from "./KapiField.js";
|
|
3
|
+
import { type KapiInputSize } from "./KapiInput.js";
|
|
4
|
+
import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
6
5
|
export type KapiNumberStepperProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "defaultValue" | "onChange" | "min" | "max" | "step"> & {
|
|
7
|
-
/**
|
|
8
|
-
|
|
6
|
+
/** Ref al `<input>` numérico (el enfocable del contrato de campo). */
|
|
7
|
+
ref?: Ref<HTMLInputElement> | undefined;
|
|
8
|
+
/** Valor actual; con él, el control es controlado. */
|
|
9
|
+
value?: number | undefined;
|
|
10
|
+
/** Valor inicial sin controlar (sin `value`): el control guarda los cambios. Sin ninguno de los dos arranca en 0 (acotado a `min`/`max`). */
|
|
11
|
+
defaultValue?: number | undefined;
|
|
9
12
|
/** Se llama con el número nuevo, ya acotado a `min`/`max`. */
|
|
10
|
-
onChange
|
|
13
|
+
onChange?: ((value: number) => void) | undefined;
|
|
11
14
|
/** Mínimo permitido; en el tope el botón − se deshabilita. */
|
|
12
|
-
min?: number;
|
|
15
|
+
min?: number | undefined;
|
|
13
16
|
/** Máximo permitido; en el tope el botón + se deshabilita. */
|
|
14
|
-
max?: number;
|
|
17
|
+
max?: number | undefined;
|
|
15
18
|
/** Cuánto suman o restan los botones − y +. */
|
|
16
|
-
step?: number;
|
|
19
|
+
step?: number | undefined;
|
|
17
20
|
/** Tamaño del control: `sm` · `md` · `lg`. */
|
|
18
|
-
size?: KapiInputSize;
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
+
size?: KapiInputSize | undefined;
|
|
22
|
+
/** Marca el campo inválido: borde rojo, `aria-invalid` y la ayuda en color de error. Gana sobre `status`. */
|
|
23
|
+
invalid?: boolean | undefined;
|
|
24
|
+
/** Validación no erróneo (`ok`, `pending`): borde y ayuda. El valor `err` está deprecado: usa `invalid`. */
|
|
25
|
+
status?: KapiFieldStatus | undefined;
|
|
26
|
+
/** Marca el campo obligatorio (`required` en el input y asterisco en la etiqueta). */
|
|
27
|
+
required?: boolean | undefined;
|
|
21
28
|
/** Etiqueta visible; con ella (o `help`) el control se envuelve en un `KapiField`. */
|
|
22
29
|
label?: ReactNode;
|
|
23
30
|
/** Texto de ayuda o error bajo el control. */
|
|
24
31
|
help?: ReactNode;
|
|
25
|
-
/**
|
|
26
|
-
|
|
32
|
+
/** Clase del contenedor del control (`.kapi-stepper`, botones + input). `className` va al `<input>`. */
|
|
33
|
+
fieldClassName?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Clase del contenedor del control.
|
|
36
|
+
* @deprecated Usa `fieldClassName`.
|
|
37
|
+
*/
|
|
38
|
+
wrapperClassName?: string | undefined;
|
|
27
39
|
/** Textos de los botones − y +. */
|
|
28
40
|
labels?: KapiLabelsOverride<KapiNumberStepperLabels> | undefined;
|
|
29
41
|
};
|
|
@@ -33,7 +45,7 @@ export declare const stepperClasses: ({ size, className }?: {
|
|
|
33
45
|
className?: string | undefined;
|
|
34
46
|
}) => string;
|
|
35
47
|
/**
|
|
36
|
-
* Numeric field with − / + buttons. Controlled
|
|
48
|
+
* Numeric field with − / + buttons. Controlled with `value`, or uncontrolled with `defaultValue`. Typing is free while focused and is
|
|
37
49
|
* committed (clamped to bounds) on blur / Enter; the buttons and arrow keys step immediately.
|
|
38
50
|
*/
|
|
39
51
|
export type KapiNumberStepperLabels = {
|
|
@@ -41,4 +53,4 @@ export type KapiNumberStepperLabels = {
|
|
|
41
53
|
increase: string;
|
|
42
54
|
};
|
|
43
55
|
export declare const DEFAULT_NUMBER_STEPPER_LABELS: KapiNumberStepperLabels;
|
|
44
|
-
export declare const KapiNumberStepper: ({ value, onChange, min, max, step, size, status, label, help, wrapperClassName, labels, className, disabled, id, ...rest }: KapiNumberStepperProps) =>
|
|
56
|
+
export declare const KapiNumberStepper: ({ value: valueProp, defaultValue, onChange, min, max, step, size, invalid: invalidProp, status: statusProp, required, label, help, fieldClassName, wrapperClassName, labels, className, disabled, readOnly: readOnlyProp, id, ...rest }: KapiNumberStepperProps) => ReactNode;
|
|
@@ -1,100 +1,115 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import "#kapi-css/components/inputs/inputsExtra.css";
|
|
3
|
+
import { fieldControlProps as e, joinIds as t, resolveFieldClassName as n, resolveReadOnly as ee, resolveValidation as r } from "./fieldLogic.js";
|
|
4
|
+
import { useOwnField as i } from "./ownField.js";
|
|
5
|
+
import { useLabels as a } from "../locale/KapiLocaleProvider.js";
|
|
4
6
|
/* empty css */
|
|
5
|
-
import { inputClasses as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { inputClasses as o } from "./KapiInput.js";
|
|
8
|
+
import { useControllableState as s } from "../../hooks/useControllableState.js";
|
|
9
|
+
import { canDecrement as te, canIncrement as c, clampNumber as l, parseTypedNumber as u, snapToStep as d, stepValue as ne } from "./numberStepLogic.js";
|
|
10
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import { useEffect as m, useState as h } from "react";
|
|
12
|
+
import { Minus as g, Plus as re } from "lucide-react";
|
|
10
13
|
//#region src/components/inputs/KapiNumberStepper.tsx
|
|
11
|
-
var
|
|
14
|
+
var _ = ({ size: e = "md", className: t = "" } = {}) => [
|
|
12
15
|
"kapi-stepper",
|
|
13
16
|
e !== "md" && `kapi-stepper--${e}`,
|
|
14
17
|
t
|
|
15
|
-
].filter(Boolean).join(" "),
|
|
18
|
+
].filter(Boolean).join(" "), v = {
|
|
16
19
|
decrease: "Disminuir",
|
|
17
20
|
increase: "Aumentar"
|
|
18
|
-
},
|
|
19
|
-
let
|
|
20
|
-
min:
|
|
21
|
-
max:
|
|
22
|
-
step:
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
}, y = ({ value: y, defaultValue: b, onChange: x, min: S, max: C, step: w = 1, size: T = "md", invalid: E, status: D, required: O, label: k, help: A, fieldClassName: j, wrapperClassName: M, labels: N, className: P, disabled: F, readOnly: I, id: L, ...R }) => {
|
|
22
|
+
let z = a("numberStepper", v, N), [B, V] = s(y, () => l(b ?? 0, {
|
|
23
|
+
min: S,
|
|
24
|
+
max: C,
|
|
25
|
+
step: w
|
|
26
|
+
}), x), { invalid: H, status: U } = r(E, D), W = i({
|
|
27
|
+
id: L,
|
|
28
|
+
label: k,
|
|
29
|
+
help: A,
|
|
30
|
+
required: O,
|
|
31
|
+
invalid: E,
|
|
32
|
+
status: D,
|
|
33
|
+
readOnly: I
|
|
34
|
+
}), G = W.controlId ?? W.autoId, { helpId: K } = W, q = ee(I, W.field), J = {
|
|
35
|
+
min: S,
|
|
36
|
+
max: C,
|
|
37
|
+
step: w
|
|
38
|
+
}, [Y, X] = h(null);
|
|
39
|
+
m(() => X(null), [B]);
|
|
40
|
+
let Z = (e) => {
|
|
41
|
+
let t = l(e, J);
|
|
42
|
+
t !== B && V(t), X(null);
|
|
43
|
+
}, Q = () => {
|
|
44
|
+
if (Y === null) return;
|
|
45
|
+
let e = u(Y);
|
|
46
|
+
Z(e === null ? B : d(e, J));
|
|
47
|
+
}, $ = (e) => {
|
|
48
|
+
if (q) return;
|
|
49
|
+
let t = Y === null ? null : u(Y), n = t === null ? B : d(t, J);
|
|
50
|
+
Z(ne(n, e, J));
|
|
51
|
+
}, ie = /* @__PURE__ */ p("div", {
|
|
52
|
+
className: _({
|
|
53
|
+
size: T,
|
|
54
|
+
className: n(j, M)
|
|
39
55
|
}),
|
|
40
56
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ f("button", {
|
|
42
58
|
type: "button",
|
|
43
59
|
className: "kapi-stepper__btn",
|
|
44
|
-
"aria-label":
|
|
60
|
+
"aria-label": z.decrease,
|
|
45
61
|
tabIndex: -1,
|
|
46
|
-
disabled:
|
|
47
|
-
onClick: () =>
|
|
48
|
-
children: /* @__PURE__ */
|
|
62
|
+
disabled: F || q || !te(B, J),
|
|
63
|
+
onClick: () => $(-1),
|
|
64
|
+
children: /* @__PURE__ */ f(g, {
|
|
49
65
|
size: 15,
|
|
50
66
|
strokeWidth: 2.4
|
|
51
67
|
})
|
|
52
68
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
...
|
|
55
|
-
|
|
69
|
+
/* @__PURE__ */ f("input", {
|
|
70
|
+
...R,
|
|
71
|
+
...e(W.outer, {
|
|
72
|
+
id: G,
|
|
73
|
+
describedBy: t(K, R["aria-describedby"]),
|
|
74
|
+
invalid: H
|
|
75
|
+
}),
|
|
76
|
+
required: O,
|
|
77
|
+
readOnly: q || void 0,
|
|
56
78
|
type: "text",
|
|
57
|
-
inputMode:
|
|
79
|
+
inputMode: w % 1 == 0 ? "numeric" : "decimal",
|
|
58
80
|
role: "spinbutton",
|
|
59
|
-
"aria-valuenow":
|
|
60
|
-
"aria-valuemin":
|
|
61
|
-
"aria-valuemax":
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
status: S,
|
|
81
|
+
"aria-valuenow": B,
|
|
82
|
+
"aria-valuemin": S,
|
|
83
|
+
"aria-valuemax": C,
|
|
84
|
+
className: o({
|
|
85
|
+
size: T,
|
|
86
|
+
status: U,
|
|
66
87
|
num: !0,
|
|
67
|
-
className: `kapi-stepper__input ${
|
|
88
|
+
className: `kapi-stepper__input ${P ?? ""}`.trim()
|
|
68
89
|
}),
|
|
69
|
-
value:
|
|
70
|
-
disabled:
|
|
71
|
-
onChange: (e) =>
|
|
72
|
-
onBlur:
|
|
90
|
+
value: Y ?? String(B),
|
|
91
|
+
disabled: F,
|
|
92
|
+
onChange: (e) => X(e.target.value),
|
|
93
|
+
onBlur: Q,
|
|
73
94
|
onKeyDown: (e) => {
|
|
74
|
-
e.key === "ArrowUp" ? (e.preventDefault(),
|
|
95
|
+
e.key === "ArrowUp" ? (e.preventDefault(), $(1)) : e.key === "ArrowDown" ? (e.preventDefault(), $(-1)) : e.key === "Enter" && Q();
|
|
75
96
|
}
|
|
76
97
|
}),
|
|
77
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ f("button", {
|
|
78
99
|
type: "button",
|
|
79
100
|
className: "kapi-stepper__btn",
|
|
80
|
-
"aria-label":
|
|
101
|
+
"aria-label": z.increase,
|
|
81
102
|
tabIndex: -1,
|
|
82
|
-
disabled:
|
|
83
|
-
onClick: () =>
|
|
84
|
-
children: /* @__PURE__ */
|
|
103
|
+
disabled: F || q || !c(B, J),
|
|
104
|
+
onClick: () => $(1),
|
|
105
|
+
children: /* @__PURE__ */ f(re, {
|
|
85
106
|
size: 15,
|
|
86
107
|
strokeWidth: 2.4
|
|
87
108
|
})
|
|
88
109
|
})
|
|
89
110
|
]
|
|
90
111
|
});
|
|
91
|
-
return
|
|
92
|
-
label: C,
|
|
93
|
-
htmlFor: N,
|
|
94
|
-
help: w,
|
|
95
|
-
status: S,
|
|
96
|
-
children: B
|
|
97
|
-
});
|
|
112
|
+
return W.wrap(ie);
|
|
98
113
|
};
|
|
99
114
|
//#endregion
|
|
100
|
-
export {
|
|
115
|
+
export { v as DEFAULT_NUMBER_STEPPER_LABELS, y as KapiNumberStepper, _ as stepperClasses };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type KapiCheckControlProps } from "./checkControl";
|
|
1
|
+
import { type KapiCheckControlProps } from "./checkControl.js";
|
|
2
2
|
export type KapiRadioProps = KapiCheckControlProps;
|
|
3
3
|
/** Radio (`.kapi-check`). Agrupá con el mismo `name`. Props nativas al `<input>`; `className` a la etiqueta. */
|
|
4
4
|
export declare const KapiRadio: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type HTMLAttributes, type Ref } from "react";
|
|
2
|
-
import "
|
|
3
|
-
import type { KapiLabelsOverride } from "../labelsLogic";
|
|
1
|
+
import { type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
4
3
|
export type KapiRatingSize = "sm" | "md" | "lg";
|
|
5
4
|
export type KapiRatingLabels = {
|
|
6
5
|
/** Accessible name when there is no `aria-label`. */
|
|
@@ -10,46 +9,64 @@ export type KapiRatingLabels = {
|
|
|
10
9
|
};
|
|
11
10
|
export declare const DEFAULT_RATING_LABELS: KapiRatingLabels;
|
|
12
11
|
/** Native attributes (`id`, `style`, `data-*`…) go to the root (slider or image). */
|
|
13
|
-
export type KapiRatingProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onChange" | "aria-label"> & {
|
|
14
|
-
/** Current rating, 0..max (halves allowed with `allowHalf`). */
|
|
15
|
-
value
|
|
16
|
-
/**
|
|
17
|
-
|
|
12
|
+
export type KapiRatingProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onChange" | "aria-label" | "defaultValue"> & {
|
|
13
|
+
/** Current rating, 0..max (halves allowed with `allowHalf`). With it the rating is controlled. */
|
|
14
|
+
value?: number | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Valor inicial sin controlar (sin `value`): el componente guarda los cambios. Con él la
|
|
17
|
+
* calificación es interactiva aunque no haya `onChange` (útil con `name` en un form nativo).
|
|
18
|
+
*/
|
|
19
|
+
defaultValue?: number | undefined;
|
|
20
|
+
/** Omit (together with `defaultValue`) to render a read-only (non-interactive) rating. */
|
|
21
|
+
onChange?: ((value: number) => void) | undefined;
|
|
18
22
|
/** Cantidad de estrellas (el valor máximo). */
|
|
19
|
-
max?: number;
|
|
23
|
+
max?: number | undefined;
|
|
20
24
|
/** Tamaño de las estrellas. */
|
|
21
|
-
size?: KapiRatingSize;
|
|
25
|
+
size?: KapiRatingSize | undefined;
|
|
22
26
|
/** Deshabilita la interacción (se ve atenuado). */
|
|
23
|
-
disabled?: boolean;
|
|
27
|
+
disabled?: boolean | undefined;
|
|
24
28
|
/** Allow half stars. */
|
|
25
|
-
allowHalf?: boolean;
|
|
29
|
+
allowHalf?: boolean | undefined;
|
|
26
30
|
/** Accessible name; wins over `labels.rating` ("Calificación"). */
|
|
27
|
-
"aria-label"?: string;
|
|
31
|
+
"aria-label"?: string | undefined;
|
|
28
32
|
/** Fixed copy (key `rating`). */
|
|
29
33
|
labels?: KapiLabelsOverride<KapiRatingLabels> | undefined;
|
|
30
34
|
/** Clase de la raíz. */
|
|
31
|
-
className?: string;
|
|
35
|
+
className?: string | undefined;
|
|
32
36
|
/** Name for native forms: renders an `<input type="hidden">` with the value (disabled with the rating). */
|
|
33
|
-
name?: string;
|
|
34
|
-
/** Marks the rating invalid (`aria-invalid`). Without it, taken from the wrapping `KapiField` (`
|
|
35
|
-
invalid?: boolean;
|
|
37
|
+
name?: string | undefined;
|
|
38
|
+
/** Marks the rating invalid (`aria-invalid`). Without it, taken from the wrapping `KapiField` (`invalid`). */
|
|
39
|
+
invalid?: boolean | undefined;
|
|
36
40
|
/** Marks the rating required (`aria-required`). Without it, taken from the wrapping `KapiField`. */
|
|
37
|
-
required?: boolean;
|
|
41
|
+
required?: boolean | undefined;
|
|
42
|
+
/** Etiqueta del campo: con `label` o `help` la calificación se envuelve en un `KapiField`, como `KapiInput`. */
|
|
43
|
+
label?: ReactNode | undefined;
|
|
44
|
+
/** Ayuda / mensaje de error bajo la calificación (la envuelve en un `KapiField`). */
|
|
45
|
+
help?: ReactNode | undefined;
|
|
46
|
+
/** Clase del `KapiField` propio (con `label` o `help`). `className` va a la raíz. */
|
|
47
|
+
fieldClassName?: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Solo lectura: la calificación interactiva se enfoca y anuncia su valor, pero no cambia
|
|
50
|
+
* (`aria-readonly`). Sin la prop, la toma del `KapiField`.
|
|
51
|
+
*/
|
|
52
|
+
readOnly?: boolean | undefined;
|
|
38
53
|
/** Ref to the root (the focusable slider when interactive). */
|
|
39
|
-
ref?: Ref<HTMLDivElement
|
|
54
|
+
ref?: Ref<HTMLDivElement> | undefined;
|
|
40
55
|
};
|
|
41
56
|
/** Wrapper classes. Pure and exported. */
|
|
42
|
-
export declare const ratingClasses: ({ size, interactive, disabled, className }?: {
|
|
57
|
+
export declare const ratingClasses: ({ size, interactive, disabled, readOnly, className }?: {
|
|
43
58
|
size?: KapiRatingSize | undefined;
|
|
44
59
|
interactive?: boolean | undefined;
|
|
45
60
|
disabled?: boolean | undefined;
|
|
61
|
+
readOnly?: boolean | undefined;
|
|
46
62
|
className?: string | undefined;
|
|
47
63
|
}) => string;
|
|
48
64
|
/**
|
|
49
|
-
* Star rating.
|
|
65
|
+
* Star rating. Controlled with `value` or uncontrolled with `defaultValue`. With `onChange` (or
|
|
66
|
+
* uncontrolled with `defaultValue`) it is a keyboard-operable slider
|
|
50
67
|
* (arrows, Home, End; click or hover-preview with the mouse; clicking the current
|
|
51
|
-
* value clears it).
|
|
68
|
+
* value clears it). Otherwise it is a read-only image.
|
|
52
69
|
* Inside a `KapiField` the interactive slider takes the field id, name (`aria-labelledby`), help,
|
|
53
70
|
* `aria-invalid` and `aria-required`.
|
|
54
71
|
*/
|
|
55
|
-
export declare const KapiRating: ({ value, onChange, max, size, disabled, allowHalf, className, labels, "aria-label": ariaLabelProp, name, invalid, required, id, "aria-describedby": describedBy, ref, ...rest }: KapiRatingProps) =>
|
|
72
|
+
export declare const KapiRating: ({ value: valueProp, defaultValue, onChange, max, size, disabled, allowHalf, className, labels, "aria-label": ariaLabelProp, name, invalid, required, label, help, fieldClassName, readOnly: readOnlyProp, id, "aria-describedby": describedBy, ref, ...rest }: KapiRatingProps) => ReactNode;
|
|
@@ -1,99 +1,116 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import "#kapi-css/components/inputs/inputsExtra.css";
|
|
3
|
+
import { fieldControlProps as e, resolveReadOnly as t } from "./fieldLogic.js";
|
|
4
|
+
import { useOwnField as n } from "./ownField.js";
|
|
5
|
+
import { useLabels as r } from "../locale/KapiLocaleProvider.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { useControllableState as i } from "../../hooks/useControllableState.js";
|
|
8
|
+
import { directionOf as ee, logicalKeyOf as te } from "../../hooks/directionLogic.js";
|
|
9
|
+
import { useFormReset as ne } from "../../hooks/useFormReset.js";
|
|
10
|
+
import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
|
|
11
|
+
import { normalizeRating as o, ratingFromKey as s, ratingFromPointer as c, starFills as re } from "./ratingLogic.js";
|
|
12
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
13
|
+
import { useState as ie } from "react";
|
|
14
|
+
import { Star as d } from "lucide-react";
|
|
10
15
|
//#region src/components/inputs/KapiRating.tsx
|
|
11
|
-
var
|
|
16
|
+
var f = {
|
|
12
17
|
rating: "Calificación",
|
|
13
18
|
of: "de"
|
|
14
|
-
},
|
|
19
|
+
}, p = {
|
|
15
20
|
sm: 16,
|
|
16
21
|
md: 22,
|
|
17
22
|
lg: 30
|
|
18
|
-
},
|
|
23
|
+
}, m = ({ size: e = "md", interactive: t = !1, disabled: n = !1, readOnly: r = !1, className: i = "" } = {}) => [
|
|
19
24
|
"kapi-rating",
|
|
20
25
|
e !== "md" && `kapi-rating--${e}`,
|
|
21
26
|
t && "kapi-rating--interactive",
|
|
22
27
|
n && "kapi-rating--disabled",
|
|
23
|
-
r
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
r && "kapi-rating--readonly",
|
|
29
|
+
i
|
|
30
|
+
].filter(Boolean).join(" "), h = ({ value: h, defaultValue: g, onChange: _, max: v = 5, size: y = "md", disabled: b = !1, allowHalf: x = !1, className: ae, labels: S, "aria-label": C, name: w, invalid: T, required: E, label: D, help: O, fieldClassName: k, readOnly: A, id: j, "aria-describedby": M, ref: oe, ...N }) => {
|
|
31
|
+
let P = r("rating", f, S), F = n({
|
|
32
|
+
id: j,
|
|
33
|
+
label: D,
|
|
34
|
+
help: O,
|
|
35
|
+
required: E,
|
|
36
|
+
invalid: T,
|
|
37
|
+
readOnly: A,
|
|
38
|
+
fieldClassName: k
|
|
39
|
+
}), I = F.field, L = t(A, I), [R, z] = ie(null), [B, V, , H] = i(h, g ?? 0, _), U = a(oe, ne(H)), W = (_ !== void 0 || h === void 0 && g !== void 0) && !b, G = W && !L, K = e(W ? I : null, {
|
|
40
|
+
id: j,
|
|
41
|
+
describedBy: M,
|
|
42
|
+
invalid: T,
|
|
43
|
+
required: E,
|
|
30
44
|
labelable: !1,
|
|
31
|
-
ariaLabel:
|
|
32
|
-
}),
|
|
45
|
+
ariaLabel: C
|
|
46
|
+
}), q = C ?? P.rating, J = o(B, v, x), Y = w ? /* @__PURE__ */ l("input", {
|
|
33
47
|
type: "hidden",
|
|
34
|
-
name:
|
|
35
|
-
value:
|
|
36
|
-
disabled:
|
|
37
|
-
}) : null,
|
|
38
|
-
let n = e.currentTarget.getBoundingClientRect(), r =
|
|
39
|
-
return
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
t
|
|
43
|
-
|
|
48
|
+
name: w,
|
|
49
|
+
value: J,
|
|
50
|
+
disabled: b
|
|
51
|
+
}) : null, se = re(G && R !== null ? R : J, v, x), X = p[y], Z = (e, t) => {
|
|
52
|
+
let n = e.currentTarget.getBoundingClientRect(), r = ee(e.currentTarget) === "rtl" ? n.right - e.clientX : e.clientX - n.left, i = n.width > 0 ? r / n.width : 1;
|
|
53
|
+
return c(t, i, x);
|
|
54
|
+
}, ce = (e) => {
|
|
55
|
+
if (!G) return;
|
|
56
|
+
let t = s(te(e), J, v, x);
|
|
57
|
+
t !== null && (e.preventDefault(), t !== J && V(t));
|
|
58
|
+
}, Q = se.map((e, t) => /* @__PURE__ */ u("span", {
|
|
44
59
|
className: "kapi-rating__star",
|
|
45
60
|
"data-fill": e,
|
|
46
|
-
onMouseMove:
|
|
47
|
-
onClick:
|
|
48
|
-
let n =
|
|
49
|
-
|
|
61
|
+
onMouseMove: G ? (e) => z(Z(e, t)) : void 0,
|
|
62
|
+
onClick: G ? (e) => {
|
|
63
|
+
let n = Z(e, t);
|
|
64
|
+
V(n === J ? 0 : n);
|
|
50
65
|
} : void 0,
|
|
51
|
-
children: [/* @__PURE__ */
|
|
52
|
-
size:
|
|
66
|
+
children: [/* @__PURE__ */ l(d, {
|
|
67
|
+
size: X,
|
|
53
68
|
strokeWidth: 2,
|
|
54
69
|
className: "kapi-rating__base",
|
|
55
70
|
"aria-hidden": "true"
|
|
56
|
-
}), e !== "empty" && /* @__PURE__ */
|
|
71
|
+
}), e !== "empty" && /* @__PURE__ */ l("span", {
|
|
57
72
|
className: "kapi-rating__fill",
|
|
58
73
|
style: { width: e === "half" ? "50%" : "100%" },
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
size:
|
|
74
|
+
children: /* @__PURE__ */ l(d, {
|
|
75
|
+
size: X,
|
|
61
76
|
strokeWidth: 2,
|
|
62
77
|
fill: "currentColor",
|
|
63
78
|
"aria-hidden": "true"
|
|
64
79
|
})
|
|
65
80
|
})]
|
|
66
|
-
}, t)),
|
|
67
|
-
size:
|
|
68
|
-
interactive:
|
|
69
|
-
disabled:
|
|
70
|
-
|
|
81
|
+
}, t)), $ = m({
|
|
82
|
+
size: y,
|
|
83
|
+
interactive: W,
|
|
84
|
+
disabled: b,
|
|
85
|
+
readOnly: W && L,
|
|
86
|
+
className: ae
|
|
71
87
|
});
|
|
72
|
-
return
|
|
73
|
-
...
|
|
74
|
-
...
|
|
75
|
-
ref:
|
|
76
|
-
className:
|
|
88
|
+
return W ? F.wrap(/* @__PURE__ */ u("div", {
|
|
89
|
+
...N,
|
|
90
|
+
...K,
|
|
91
|
+
ref: U,
|
|
92
|
+
className: $,
|
|
77
93
|
role: "slider",
|
|
78
94
|
tabIndex: 0,
|
|
79
|
-
"aria-label":
|
|
95
|
+
"aria-label": K["aria-labelledby"] ? void 0 : q,
|
|
80
96
|
"aria-valuemin": 0,
|
|
81
|
-
"aria-valuemax":
|
|
82
|
-
"aria-valuenow":
|
|
83
|
-
"aria-valuetext": `${
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
"aria-valuemax": v,
|
|
98
|
+
"aria-valuenow": J,
|
|
99
|
+
"aria-valuetext": `${J} ${P.of} ${v}`,
|
|
100
|
+
"aria-readonly": L || void 0,
|
|
101
|
+
onKeyDown: ce,
|
|
102
|
+
onMouseLeave: () => z(null),
|
|
103
|
+
children: [Q, Y]
|
|
104
|
+
})) : F.wrap(/* @__PURE__ */ u("div", {
|
|
105
|
+
...N,
|
|
106
|
+
ref: U,
|
|
107
|
+
id: j,
|
|
108
|
+
"aria-describedby": M,
|
|
109
|
+
className: $,
|
|
93
110
|
role: "img",
|
|
94
|
-
"aria-label": `${
|
|
95
|
-
children: [
|
|
96
|
-
});
|
|
111
|
+
"aria-label": `${q}: ${J} ${P.of} ${v}`,
|
|
112
|
+
children: [Q, Y]
|
|
113
|
+
}));
|
|
97
114
|
};
|
|
98
115
|
//#endregion
|
|
99
|
-
export {
|
|
116
|
+
export { f as DEFAULT_RATING_LABELS, h as KapiRating, m as ratingClasses };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ChangeEvent, type CSSProperties, type InputHTMLAttributes, type Ref } from "react";
|
|
2
|
-
import type { KapiLabelsOverride } from "../labelsLogic";
|
|
3
|
-
import "./KapiSearchChip.css";
|
|
2
|
+
import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
4
3
|
export type KapiSearchChipLabels = {
|
|
5
4
|
/** Placeholder por defecto, cuando el consumidor no pasa el suyo. */
|
|
6
5
|
placeholder: string;
|
|
@@ -11,14 +10,16 @@ export type KapiSearchChipLabels = {
|
|
|
11
10
|
};
|
|
12
11
|
export declare const DEFAULT_SEARCH_CHIP_LABELS: KapiSearchChipLabels;
|
|
13
12
|
/**
|
|
14
|
-
* `type`, `value` y `onChange` los
|
|
13
|
+
* `type`, `value`, `defaultValue` y `onChange` los redeclara el componente (controlado o sin controlar).
|
|
15
14
|
* `className` y `style` se redeclaran porque van a la caja, no al `<input>`.
|
|
16
15
|
*/
|
|
17
16
|
export type KapiSearchChipProps = Omit<InputHTMLAttributes<HTMLInputElement>, "aria-label" | "className" | "defaultValue" | "disabled" | "onChange" | "onSubmit" | "placeholder" | "style" | "type" | "value"> & {
|
|
18
|
-
/** Texto del campo
|
|
19
|
-
value
|
|
17
|
+
/** Texto del campo; con él, el campo es controlado. */
|
|
18
|
+
value?: string | undefined;
|
|
19
|
+
/** Valor inicial sin controlar (sin `value`): el campo guarda el texto tipeado. @default "" */
|
|
20
|
+
defaultValue?: string | undefined;
|
|
20
21
|
/** Recibe el evento del `<input>`, como `KapiInput`; el botón de limpiar dispara uno real con `""`. */
|
|
21
|
-
onChange
|
|
22
|
+
onChange?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
22
23
|
/** Pista dentro del campo. De aquí sale el nombre accesible si no se pasa `aria-label`. @default "Buscar…" */
|
|
23
24
|
placeholder?: string | undefined;
|
|
24
25
|
/** Nombre accesible del campo. Sin él se deriva del `placeholder` sin su elipsis. */
|
|
@@ -34,7 +35,7 @@ export type KapiSearchChipProps = Omit<InputHTMLAttributes<HTMLInputElement>, "a
|
|
|
34
35
|
/** Estilos en línea de la caja visible. */
|
|
35
36
|
style?: CSSProperties | undefined;
|
|
36
37
|
/** Ref al `<input>` (React 19 pasa `ref` como prop). */
|
|
37
|
-
ref?: Ref<HTMLInputElement
|
|
38
|
+
ref?: Ref<HTMLInputElement> | undefined;
|
|
38
39
|
};
|
|
39
40
|
/**
|
|
40
41
|
* Campo de búsqueda de una fila de filtros, con la MISMA caja que el chip de `KapiDropdown`.
|
|
@@ -76,4 +77,4 @@ export type KapiSearchChipProps = Omit<InputHTMLAttributes<HTMLInputElement>, "a
|
|
|
76
77
|
* a la caja, que es la superficie visible y la que ocupa el lugar en la fila (es donde el marcado a
|
|
77
78
|
* mano ponía su clase de layout). Mismo criterio que `KapiInput` con adornos.
|
|
78
79
|
*/
|
|
79
|
-
export declare const KapiSearchChip: ({ value, onChange, onSubmit, disabled, placeholder, "aria-label": ariaLabel, labels, className, style, ref, onKeyDown, ...inputRest }: KapiSearchChipProps) => import("react").JSX.Element;
|
|
80
|
+
export declare const KapiSearchChip: ({ value: valueProp, defaultValue, onChange, onSubmit, disabled, placeholder, "aria-label": ariaLabel, labels, className, style, ref, onKeyDown, ...inputRest }: KapiSearchChipProps) => import("react").JSX.Element;
|