@kapiuara/ui 0.23.0 → 0.23.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/dist/components/chat/KapiChatDivider.js +1 -2
- package/dist/components/chat/KapiChatList.js +15 -16
- package/dist/components/chat/KapiChatThread.js +21 -22
- package/dist/components/chat/KapiComposer.js +23 -24
- package/dist/components/chat/KapiMessageBubble.js +5 -6
- package/dist/components/chat/KapiTypingIndicator.js +5 -6
- package/dist/components/chat/chatLogic.js +1 -2
- package/dist/components/data/KapiBarChart.js +22 -23
- package/dist/components/data/KapiDataTable.js +92 -93
- package/dist/components/data/KapiEventCalendar.js +96 -97
- package/dist/components/data/KapiHeatmap.js +21 -22
- package/dist/components/data/KapiLineChart.js +23 -24
- package/dist/components/data/KapiPagination.js +1 -2
- package/dist/components/data/KapiPaginationFooter.js +5 -6
- package/dist/components/data/KapiScatterChart.js +18 -19
- package/dist/components/data/KapiSheet.js +2 -3
- package/dist/components/data/KapiSparkline.js +1 -2
- package/dist/components/data/KapiTable.js +107 -108
- package/dist/components/data/KapiTableFilter.js +13 -14
- package/dist/components/data/KapiTableFooter.js +21 -22
- package/dist/components/data/KapiTableRow.js +10 -11
- package/dist/components/data/KapiTableToolbar.js +95 -96
- package/dist/components/data/barChartLogic.js +1 -2
- package/dist/components/data/chartFrame.js +13 -14
- package/dist/components/data/datasetSelectionLogic.js +1 -2
- package/dist/components/data/eventCalendarLogic.js +2 -3
- package/dist/components/data/heatmapLogic.js +1 -2
- package/dist/components/data/lineChartLogic.js +1 -2
- package/dist/components/data/rowClickLogic.js +2 -17
- package/dist/components/data/scatterLogic.js +1 -2
- package/dist/components/data/sparklineLogic.js +1 -2
- package/dist/components/data/tableCells.js +14 -15
- package/dist/components/data/tableHeaderMenu.js +1 -2
- package/dist/components/data/tableLabels.js +1 -2
- package/dist/components/data/tableLogic.js +0 -1
- package/dist/components/data/tablePaginationLogic.js +1 -2
- package/dist/components/data/tableResizeLogic.js +1 -2
- package/dist/components/data/tableSlots.js +1 -2
- package/dist/components/data/tableSpanLogic.js +1 -2
- package/dist/components/data/useColumnResize.js +23 -24
- package/dist/components/data/useRowKeyWarning.js +1 -2
- package/dist/components/data/useTableEdges.js +1 -2
- package/dist/components/data/useTableSelection.js +25 -26
- package/dist/components/display/KapiAnchor.js +7 -8
- package/dist/components/display/KapiAnnotation.js +15 -16
- package/dist/components/display/KapiAvatar.js +6 -7
- package/dist/components/display/KapiAvatarGroup.js +15 -16
- package/dist/components/display/KapiBadge.js +1 -2
- package/dist/components/display/KapiCodeBlock.js +14 -15
- package/dist/components/display/KapiComment.js +10 -11
- package/dist/components/display/KapiCommentComposer.js +13 -14
- package/dist/components/display/KapiDescriptionList.js +1 -2
- package/dist/components/display/KapiDiff.js +23 -24
- package/dist/components/display/KapiFileItem.js +13 -14
- package/dist/components/display/KapiFileViewer.js +17 -18
- package/dist/components/display/KapiHighlight.js +2 -3
- package/dist/components/display/KapiIconTile.js +2 -3
- package/dist/components/display/KapiStat.js +8 -9
- package/dist/components/display/KapiTag.js +6 -7
- package/dist/components/display/KapiText.js +5 -6
- package/dist/components/display/KapiTimeline.js +2 -3
- package/dist/components/display/KapiTitle.js +1 -2
- package/dist/components/display/KapiTruncate.js +5 -6
- package/dist/components/display/annotationLogic.js +1 -2
- package/dist/components/display/avatarGroupLogic.js +1 -2
- package/dist/components/display/avatarGroupSlots.js +1 -2
- package/dist/components/display/avatarLogic.js +1 -2
- package/dist/components/display/codeBlockSlots.js +1 -2
- package/dist/components/display/commentLogic.js +1 -2
- package/dist/components/display/diffLogic.js +1 -2
- package/dist/components/display/diffSlots.js +1 -2
- package/dist/components/display/fileItemLogic.js +1 -2
- package/dist/components/display/highlightLogic.js +1 -2
- package/dist/components/display/highlightSlots.js +1 -2
- package/dist/components/display/iconTileLogic.js +1 -2
- package/dist/components/display/statLogic.js +1 -2
- package/dist/components/display/tagLogic.js +1 -2
- package/dist/components/display/textLogic.js +1 -2
- package/dist/components/display/timelineLogic.js +1 -2
- package/dist/components/display/truncateLogic.js +1 -2
- package/dist/components/feedback/KapiAlert.js +6 -7
- package/dist/components/feedback/KapiBulkBar.js +5 -6
- package/dist/components/feedback/KapiCountdown.js +16 -17
- package/dist/components/feedback/KapiEmpty.js +2 -3
- package/dist/components/feedback/KapiFab.js +96 -97
- package/dist/components/feedback/KapiOfflineBanner.js +4 -5
- package/dist/components/feedback/KapiProgress.js +1 -2
- package/dist/components/feedback/KapiSkeleton.js +1 -2
- package/dist/components/feedback/KapiSpinner.js +5 -6
- package/dist/components/feedback/KapiToastContainer.js +28 -29
- package/dist/components/feedback/KapiTour.js +24 -25
- package/dist/components/feedback/KapiUnsavedBar.js +5 -6
- package/dist/components/feedback/alertSlots.js +1 -2
- package/dist/components/feedback/bulkBarLogic.js +1 -2
- package/dist/components/feedback/countdownLogic.js +1 -2
- package/dist/components/feedback/countdownSlots.js +1 -2
- package/dist/components/feedback/emptySlots.js +1 -2
- package/dist/components/feedback/fabLogic.js +1 -2
- package/dist/components/feedback/offlineBannerLogic.js +1 -2
- package/dist/components/feedback/progressLogic.js +1 -2
- package/dist/components/feedback/toastLayer.js +1 -2
- package/dist/components/feedback/toastStore.js +2 -3
- package/dist/components/feedback/tourLogic.js +1 -2
- package/dist/components/feedback/unsavedBarLogic.js +1 -2
- package/dist/components/inputs/KapiAutocomplete.js +23 -24
- package/dist/components/inputs/KapiButton.js +1 -2
- package/dist/components/inputs/KapiCalendar.js +12 -13
- package/dist/components/inputs/KapiCalendarGrid.js +15 -16
- package/dist/components/inputs/KapiCheckCard.js +4 -5
- package/dist/components/inputs/KapiCheckbox.js +1 -2
- package/dist/components/inputs/KapiChecklist.js +62 -63
- package/dist/components/inputs/KapiCopyButton.js +6 -7
- package/dist/components/inputs/KapiDatePicker.js +33 -34
- package/dist/components/inputs/KapiDateRangePicker.js +145 -146
- package/dist/components/inputs/KapiFacetedSearch.js +55 -56
- package/dist/components/inputs/KapiField.js +5 -6
- package/dist/components/inputs/KapiFileUpload.js +26 -27
- package/dist/components/inputs/KapiIconButton.js +1 -2
- package/dist/components/inputs/KapiInput.js +46 -47
- package/dist/components/inputs/KapiInputGroup.js +1 -2
- package/dist/components/inputs/KapiMaskedInput.js +50 -51
- package/dist/components/inputs/KapiNumberStepper.js +49 -50
- package/dist/components/inputs/KapiPinInput.js +9 -10
- package/dist/components/inputs/KapiPropsForm.js +43 -44
- package/dist/components/inputs/KapiRadio.js +1 -2
- package/dist/components/inputs/KapiRating.js +38 -39
- package/dist/components/inputs/KapiSearchChip.js +10 -11
- package/dist/components/inputs/KapiSegmented.js +65 -66
- package/dist/components/inputs/KapiSelect.js +198 -199
- package/dist/components/inputs/KapiSelectMenu.js +1 -2
- package/dist/components/inputs/KapiSlider.js +11 -12
- package/dist/components/inputs/KapiSwitch.js +6 -7
- package/dist/components/inputs/KapiTagInput.js +32 -33
- package/dist/components/inputs/KapiTextarea.js +22 -23
- package/dist/components/inputs/asyncSelectLogic.js +22 -23
- package/dist/components/inputs/autocompleteLogic.js +1 -2
- package/dist/components/inputs/checkControl.js +4 -5
- package/dist/components/inputs/checklistLogic.js +1 -2
- package/dist/components/inputs/copyLogic.js +1 -2
- package/dist/components/inputs/datePickerLogic.js +1 -2
- package/dist/components/inputs/dateRangeLogic.js +1 -2
- package/dist/components/inputs/facetedSearchLogic.js +1 -2
- package/dist/components/inputs/fieldLogic.js +1 -2
- package/dist/components/inputs/fileUploadLogic.js +1 -2
- package/dist/components/inputs/formBridgeLogic.js +1 -2
- package/dist/components/inputs/inputGroupLogic.js +1 -2
- package/dist/components/inputs/inputLogic.js +1 -2
- package/dist/components/inputs/maskLogic.js +0 -1
- package/dist/components/inputs/misuseWarnings.js +1 -2
- package/dist/components/inputs/numberStepLogic.js +1 -2
- package/dist/components/inputs/ownField.js +9 -10
- package/dist/components/inputs/pinInputLogic.js +1 -2
- package/dist/components/inputs/propsFormLogic.js +1 -2
- package/dist/components/inputs/ratingLogic.js +1 -2
- package/dist/components/inputs/searchChipLogic.js +1 -2
- package/dist/components/inputs/segmentedLogic.js +1 -2
- package/dist/components/inputs/selectKeyLogic.js +1 -2
- package/dist/components/inputs/selectLogic.js +1 -2
- package/dist/components/inputs/selectSlots.js +1 -2
- package/dist/components/inputs/sliderLogic.js +1 -2
- package/dist/components/inputs/tagInputLogic.js +1 -2
- package/dist/components/inputs/textareaLogic.js +1 -2
- package/dist/components/inputs/useCalendarFocus.js +1 -2
- package/dist/components/inputs/useDatePopSide.js +1 -2
- package/dist/components/inputs/useSelectCreate.js +1 -2
- package/dist/components/inputs/useSelectSource.js +11 -12
- package/dist/components/labelsLogic.js +1 -2
- package/dist/components/layout/KapiAccessCard.js +10 -11
- package/dist/components/layout/KapiAccountMenu.js +24 -25
- package/dist/components/layout/KapiBox.js +5 -6
- package/dist/components/layout/KapiCard.js +18 -19
- package/dist/components/layout/KapiCenter.js +1 -2
- package/dist/components/layout/KapiCluster.js +1 -2
- package/dist/components/layout/KapiCol.js +1 -2
- package/dist/components/layout/KapiCollapse.js +1 -2
- package/dist/components/layout/KapiContextSlot.js +98 -99
- package/dist/components/layout/KapiDivider.js +1 -2
- package/dist/components/layout/KapiGrid.js +9 -10
- package/dist/components/layout/KapiMasonry.js +1 -2
- package/dist/components/layout/KapiNotificationBell.js +53 -54
- package/dist/components/layout/KapiPageHeader.js +42 -43
- package/dist/components/layout/KapiPanelParts.js +43 -44
- package/dist/components/layout/KapiRail.js +103 -104
- package/dist/components/layout/KapiRailAccount.js +11 -12
- package/dist/components/layout/KapiRoot.js +33 -34
- package/dist/components/layout/KapiScrollArea.js +7 -8
- package/dist/components/layout/KapiShell.js +8 -9
- package/dist/components/layout/KapiStack.js +1 -2
- package/dist/components/layout/KapiThemeScript.js +1 -2
- package/dist/components/layout/accessCardLogic.js +1 -2
- package/dist/components/layout/cardLogic.js +1 -2
- package/dist/components/layout/cardSlots.js +1 -2
- package/dist/components/layout/gridSpanLogic.js +1 -2
- package/dist/components/layout/layoutPrimitives.js +1 -2
- package/dist/components/layout/masonryLogic.js +1 -2
- package/dist/components/layout/notificationBellLogic.js +1 -2
- package/dist/components/layout/pageHeaderLogic.js +1 -2
- package/dist/components/layout/pageHeaderSlots.js +1 -2
- package/dist/components/layout/railContext.js +1 -2
- package/dist/components/layout/railLogic.js +1 -2
- package/dist/components/layout/railSlots.js +1 -2
- package/dist/components/layout/reopenBus.js +1 -2
- package/dist/components/layout/shellSlots.js +1 -2
- package/dist/components/layout/useGridBreakpoint.js +1 -2
- package/dist/components/layout/useMasonrySpans.js +6 -7
- package/dist/components/layout/useRailOverflow.js +7 -8
- package/dist/components/locale/KapiLocaleProvider.js +1 -2
- package/dist/components/locale/linkLabels.js +1 -2
- package/dist/components/locale/localeLogic.js +1 -2
- package/dist/components/navigation/CtxSlidingList.js +7 -8
- package/dist/components/navigation/KapiAccordion.js +11 -12
- package/dist/components/navigation/KapiBreadcrumb.js +11 -12
- package/dist/components/navigation/KapiCollapsiblePanel.js +13 -14
- package/dist/components/navigation/KapiContextPanel.js +138 -139
- package/dist/components/navigation/KapiFilterChips.js +25 -22
- package/dist/components/navigation/KapiNavBadge.js +6 -7
- package/dist/components/navigation/KapiPanelGroup.js +34 -35
- package/dist/components/navigation/KapiSteps.js +41 -36
- package/dist/components/navigation/KapiTabs.js +40 -41
- package/dist/components/navigation/KapiToc.js +15 -16
- package/dist/components/navigation/KapiTree.js +126 -124
- package/dist/components/navigation/KapiWizard.js +12 -13
- package/dist/components/navigation/MiniNavItem.js +11 -12
- package/dist/components/navigation/accordionLogic.js +1 -2
- package/dist/components/navigation/activeItemLogic.js +1 -2
- package/dist/components/navigation/breadcrumbLogic.js +1 -2
- package/dist/components/navigation/contextPanelLogic.js +1 -2
- package/dist/components/navigation/filterChipsLogic.d.ts +9 -1
- package/dist/components/navigation/filterChipsLogic.js +2 -3
- package/dist/components/navigation/navBadgeLogic.js +1 -2
- package/dist/components/navigation/navLink.js +1 -2
- package/dist/components/navigation/navLinkLogic.js +1 -2
- package/dist/components/navigation/panelGroupLogic.js +1 -2
- package/dist/components/navigation/panelMini.js +0 -1
- package/dist/components/navigation/panelMiniLogic.js +1 -2
- package/dist/components/navigation/stepsLogic.js +1 -2
- package/dist/components/navigation/tabsLogic.js +1 -2
- package/dist/components/navigation/tocLogic.js +1 -2
- package/dist/components/navigation/tocSlots.js +1 -2
- package/dist/components/navigation/treeLogic.js +1 -2
- package/dist/components/navigation/wizardLogic.js +1 -2
- package/dist/components/overlays/KapiCanvasForm.js +5 -6
- package/dist/components/overlays/KapiCommandPalette.js +45 -45
- package/dist/components/overlays/KapiConfirm.js +9 -10
- package/dist/components/overlays/KapiContextMenu.js +16 -17
- package/dist/components/overlays/KapiDialogHost.js +50 -51
- package/dist/components/overlays/KapiDropdown.js +2 -3
- package/dist/components/overlays/KapiImageViewer.js +8 -9
- package/dist/components/overlays/KapiLoading.js +7 -8
- package/dist/components/overlays/KapiMenuButton.js +19 -20
- package/dist/components/overlays/KapiModal.js +58 -59
- package/dist/components/overlays/KapiOffcanvas.js +146 -147
- package/dist/components/overlays/KapiOffcanvasStack.js +18 -19
- package/dist/components/overlays/KapiPhotoView.js +21 -22
- package/dist/components/overlays/KapiPopover.js +12 -13
- package/dist/components/overlays/KapiShapeSheet.js +11 -12
- package/dist/components/overlays/KapiShortcutsHelp.js +18 -19
- package/dist/components/overlays/KapiSplitModal.js +20 -21
- package/dist/components/overlays/KapiTooltip.js +46 -47
- package/dist/components/overlays/KapiViewport.js +17 -18
- package/dist/components/overlays/canvasFormLogic.js +1 -2
- package/dist/components/overlays/commandPaletteLogic.js +1 -2
- package/dist/components/overlays/dialogStore.js +3 -4
- package/dist/components/overlays/dialogUtils.js +1 -2
- package/dist/components/overlays/exitPresenceLogic.js +1 -2
- package/dist/components/overlays/menuButtonLogic.js +1 -2
- package/dist/components/overlays/menuKeyboardLogic.js +1 -2
- package/dist/components/overlays/menuList.js +94 -95
- package/dist/components/overlays/modalSlots.js +1 -2
- package/dist/components/overlays/modalStack.js +1 -2
- package/dist/components/overlays/offcanvasCompanion.js +1 -2
- package/dist/components/overlays/offcanvasResize.js +0 -1
- package/dist/components/overlays/offcanvasSide.js +1 -2
- package/dist/components/overlays/offcanvasStack.js +1 -2
- package/dist/components/overlays/overlayPortal.js +1 -2
- package/dist/components/overlays/popoverLogic.js +1 -2
- package/dist/components/overlays/shortcutsHelpSlots.js +1 -2
- package/dist/components/overlays/splitModalLayout.js +1 -2
- package/dist/components/overlays/useExitPresence.js +11 -12
- package/dist/components/overlays/useNativeDialog.js +21 -22
- package/dist/components/overlays/viewportLogic.js +1 -2
- package/dist/components/renderSlot.js +1 -2
- package/dist/components/rootProps.js +1 -2
- package/dist/components/slotCatalog.js +33 -34
- package/dist/components/slotsLogic.js +1 -2
- package/dist/components/tone.js +1 -2
- package/dist/css/components/overlays/KapiViewport.css +1 -1
- package/dist/hooks/asyncResourceLogic.js +1 -2
- package/dist/hooks/breakpointOpenLogic.js +1 -2
- package/dist/hooks/colorLogic.js +1 -2
- package/dist/hooks/dateFormat.js +1 -2
- package/dist/hooks/densityLogic.js +1 -2
- package/dist/hooks/directionLogic.js +1 -2
- package/dist/hooks/downloadLogic.js +1 -2
- package/dist/hooks/elementSizeLogic.js +1 -2
- package/dist/hooks/fieldErrorsLogic.js +1 -2
- package/dist/hooks/focusLogic.js +2 -11
- package/dist/hooks/growOriginLogic.js +1 -2
- package/dist/hooks/hotkeyLogic.js +1 -2
- package/dist/hooks/hotkeyRegistry.js +1 -2
- package/dist/hooks/kapiRoot.js +2 -3
- package/dist/hooks/mergeRefs.js +1 -2
- package/dist/hooks/numberFormatLogic.js +1 -2
- package/dist/hooks/onlineStatusLogic.js +1 -2
- package/dist/hooks/ownerDocument.js +1 -2
- package/dist/hooks/persistentStateLogic.js +1 -2
- package/dist/hooks/portalRoot.js +1 -2
- package/dist/hooks/rafThrottle.js +1 -2
- package/dist/hooks/rangeSelectLogic.js +1 -2
- package/dist/hooks/recentLogic.js +1 -2
- package/dist/hooks/reducedMotion.js +8 -9
- package/dist/hooks/rightClick.js +10 -11
- package/dist/hooks/scrollCollapseLogic.js +1 -2
- package/dist/hooks/scrollEdgesLogic.js +1 -2
- package/dist/hooks/shallowStable.js +1 -2
- package/dist/hooks/slidingIndicatorLogic.js +1 -2
- package/dist/hooks/storageLogic.js +1 -2
- package/dist/hooks/themeColorsLogic.js +1 -2
- package/dist/hooks/themeContrastLogic.js +1 -2
- package/dist/hooks/themeDeriveLogic.js +0 -1
- package/dist/hooks/themeRadiiLogic.js +1 -2
- package/dist/hooks/themeScript.js +1 -2
- package/dist/hooks/toneFamilyLogic.js +1 -2
- package/dist/hooks/unsavedGuardLogic.js +1 -2
- package/dist/hooks/useAsyncLoader.js +1 -2
- package/dist/hooks/useAsyncResource.js +5 -6
- package/dist/hooks/useAsyncTasks.js +1 -2
- package/dist/hooks/useBottomBarInset.js +9 -10
- package/dist/hooks/useControllableState.js +1 -2
- package/dist/hooks/useDebouncedValue.js +1 -2
- package/dist/hooks/useDisclosure.js +1 -2
- package/dist/hooks/useDismiss.js +10 -11
- package/dist/hooks/useDragScroll.js +12 -13
- package/dist/hooks/useElementSize.js +1 -2
- package/dist/hooks/useFieldErrors.js +1 -2
- package/dist/hooks/useFocusReturn.js +1 -2
- package/dist/hooks/useFormReset.js +1 -2
- package/dist/hooks/useGlobalRightClick.js +1 -2
- package/dist/hooks/useGrowOrigin.js +1 -2
- package/dist/hooks/useHotkey.js +1 -2
- package/dist/hooks/useHydrated.js +1 -2
- package/dist/hooks/useKapiTheme.js +55 -56
- package/dist/hooks/useMediaQuery.js +1 -2
- package/dist/hooks/useObjectUrl.js +1 -2
- package/dist/hooks/useOnlineStatus.js +1 -2
- package/dist/hooks/useOutsidePress.js +1 -2
- package/dist/hooks/usePersistentState.js +9 -10
- package/dist/hooks/usePlacement.js +15 -16
- package/dist/hooks/useRangeSelect.js +2 -3
- package/dist/hooks/useRecent.js +6 -7
- package/dist/hooks/useScrollCollapse.js +1 -2
- package/dist/hooks/useScrollEdges.js +25 -26
- package/dist/hooks/useSlidingIndicator.js +19 -20
- package/dist/hooks/useSubmitDraft.js +1 -2
- package/dist/hooks/useToneFamilies.js +0 -1
- package/dist/hooks/useTypeahead.js +1 -2
- package/dist/hooks/useUnsavedGuard.js +5 -6
- package/dist/hooks/useVirtualList.js +1 -2
- package/dist/hooks/useWheelZoom.js +1 -2
- package/dist/hooks/viewportInsetLogic.js +1 -2
- package/dist/hooks/virtualListLogic.js +0 -1
- package/dist/hooks/wheelZoomLogic.js +1 -2
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/logic.js +45 -45
- package/package.json +16 -16
|
@@ -5,7 +5,7 @@ import { renderSlot as t } from "../renderSlot.js";
|
|
|
5
5
|
import { buttonLookModifier as n, isFamilyTone as r, resolveButtonLook as i } from "../tone.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/components/inputs/KapiButton.tsx
|
|
9
9
|
var c = ({ tone: e, variant: t, size: a = "md", iconOnly: o = !1, bordered: s = !1, loading: c = !1, className: l = "" } = {}) => {
|
|
10
10
|
let u = r(e) ? `family-${i(void 0, t).appearance}` : n(i(e, t));
|
|
11
11
|
return [
|
|
@@ -67,5 +67,4 @@ var c = ({ tone: e, variant: t, size: a = "md", iconOnly: o = !1, bordered: s =
|
|
|
67
67
|
children: w
|
|
68
68
|
}));
|
|
69
69
|
};
|
|
70
|
-
//#endregion
|
|
71
70
|
export { l as KapiButton, c as buttonClasses };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiDatePicker.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useControllableState as e } from "../../hooks/useControllableState.js";
|
|
4
|
+
import { KapiCalendarGrid as t } from "./KapiCalendarGrid.js";
|
|
5
|
+
import { localizedCalendarLabels as n, monthTitle as r, sameDay as i } from "./datePickerLogic.js";
|
|
6
|
+
import { useKapiLocale as a, useLabels as o } from "../locale/KapiLocaleProvider.js";
|
|
7
|
+
import { joinClasses as s } from "../rootProps.js";
|
|
7
8
|
/* empty css */
|
|
8
|
-
import { KapiCalendarGrid as s } from "./KapiCalendarGrid.js";
|
|
9
9
|
import "react";
|
|
10
10
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
11
11
|
import { ChevronLeft as u, ChevronRight as d } from "lucide-react";
|
|
12
|
-
|
|
12
|
+
// src/components/inputs/KapiCalendar.tsx
|
|
13
13
|
var f = ({ value: f, defaultValue: p = null, onChange: m, month: h, defaultMonth: g, onMonthChange: _, labels: v, weekStartsOn: y, className: b, ref: x, ...S }) => {
|
|
14
|
-
let C =
|
|
14
|
+
let C = a(), w = o("calendar", n(C), v), [T, E] = e(f, p, m), [D, O] = e(h, () => g ?? T ?? /* @__PURE__ */ new Date(), _), k = (e) => O(new Date(D.getFullYear(), D.getMonth() + e, 1));
|
|
15
15
|
return /* @__PURE__ */ l("div", {
|
|
16
16
|
...S,
|
|
17
17
|
ref: x,
|
|
18
|
-
className:
|
|
18
|
+
className: s("kapi-cal", "kapi-dp__cal", b),
|
|
19
19
|
children: [/* @__PURE__ */ l("div", {
|
|
20
20
|
className: "kapi-dp__head",
|
|
21
21
|
children: [
|
|
@@ -32,7 +32,7 @@ var f = ({ value: f, defaultValue: p = null, onChange: m, month: h, defaultMonth
|
|
|
32
32
|
}),
|
|
33
33
|
/* @__PURE__ */ c("span", {
|
|
34
34
|
className: "kapi-dp__title",
|
|
35
|
-
children:
|
|
35
|
+
children: r(D, w.months)
|
|
36
36
|
}),
|
|
37
37
|
/* @__PURE__ */ c("button", {
|
|
38
38
|
type: "button",
|
|
@@ -46,17 +46,16 @@ var f = ({ value: f, defaultValue: p = null, onChange: m, month: h, defaultMonth
|
|
|
46
46
|
})
|
|
47
47
|
})
|
|
48
48
|
]
|
|
49
|
-
}), /* @__PURE__ */ c(
|
|
49
|
+
}), /* @__PURE__ */ c(t, {
|
|
50
50
|
view: D,
|
|
51
51
|
onViewChange: O,
|
|
52
52
|
labels: w,
|
|
53
53
|
focusTarget: T,
|
|
54
|
-
isSelected: (e) =>
|
|
55
|
-
dayClassName: (e) =>
|
|
54
|
+
isSelected: (e) => i(e, T),
|
|
55
|
+
dayClassName: (e) => i(e, T) && "kapi-dp__day--sel",
|
|
56
56
|
onPick: E,
|
|
57
57
|
weekStartsOn: y
|
|
58
58
|
})]
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
|
-
//#endregion
|
|
62
61
|
export { f as KapiCalendar };
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiDatePicker.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { buildDays as e, calendarDayLabel as t, calendarRows as n, monthTitle as r, moveCalendarFocus as i, sameDay as a, sameMonth as o, weekdayOrder as s } from "./datePickerLogic.js";
|
|
4
|
+
import { useKapiLocale as c, useKapiWeekStart as l } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { logicalKeyOf as u } from "../../hooks/directionLogic.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { useEffect as d, useRef as f, useState as p } from "react";
|
|
8
8
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/components/inputs/KapiCalendarGrid.tsx
|
|
10
10
|
var g = ({ view: g, onViewChange: _, labels: v, focusTarget: y, focusRequest: b = 0, isSelected: x, dayClassName: S, onPick: C, onDayHover: w, weekStartsOn: T }) => {
|
|
11
|
-
let E =
|
|
11
|
+
let E = l(T), D = c(), O = /* @__PURE__ */ new Date(), k = f(null), [A, j] = p(null), M = f(!1), N = [
|
|
12
12
|
A,
|
|
13
13
|
y,
|
|
14
14
|
O
|
|
15
|
-
].find((e) => !!e &&
|
|
15
|
+
].find((e) => !!e && o(e, g)) ?? new Date(g.getFullYear(), g.getMonth(), 1);
|
|
16
16
|
d(() => {
|
|
17
17
|
b > 0 && (M.current = !0);
|
|
18
18
|
}, [b]), d(() => {
|
|
19
19
|
M.current && (M.current = !1, k.current?.querySelector("[role=\"gridcell\"][tabindex=\"0\"]")?.focus());
|
|
20
20
|
});
|
|
21
21
|
let P = (e) => {
|
|
22
|
-
let t =
|
|
23
|
-
key:
|
|
22
|
+
let t = i(N, {
|
|
23
|
+
key: u(e),
|
|
24
24
|
shiftKey: e.shiftKey
|
|
25
25
|
}, E);
|
|
26
|
-
t && (e.preventDefault(), j(t),
|
|
27
|
-
}, F =
|
|
26
|
+
t && (e.preventDefault(), j(t), o(t, g) || _(new Date(t.getFullYear(), t.getMonth(), 1)), M.current = !0);
|
|
27
|
+
}, F = n(e(g.getFullYear(), g.getMonth(), E)), I = s(v.weekdays, E), L = s(v.weekdayNames, E);
|
|
28
28
|
return /* @__PURE__ */ h("div", {
|
|
29
29
|
ref: k,
|
|
30
30
|
className: "kapi-dp__grid",
|
|
31
31
|
role: "grid",
|
|
32
|
-
"aria-label":
|
|
32
|
+
"aria-label": r(g, v.months),
|
|
33
33
|
onKeyDown: P,
|
|
34
34
|
onMouseLeave: w ? () => w(null) : void 0,
|
|
35
35
|
children: [/* @__PURE__ */ m("div", {
|
|
@@ -47,14 +47,14 @@ var g = ({ view: g, onViewChange: _, labels: v, focusTarget: y, focusRequest: b
|
|
|
47
47
|
children: e.map((e) => /* @__PURE__ */ m("button", {
|
|
48
48
|
type: "button",
|
|
49
49
|
role: "gridcell",
|
|
50
|
-
tabIndex:
|
|
51
|
-
"aria-label":
|
|
50
|
+
tabIndex: a(e.date, N) ? 0 : -1,
|
|
51
|
+
"aria-label": t(e.date, v, D),
|
|
52
52
|
"aria-selected": x(e.date),
|
|
53
|
-
"aria-current":
|
|
53
|
+
"aria-current": a(e.date, O) ? "date" : void 0,
|
|
54
54
|
className: [
|
|
55
55
|
"kapi-dp__day",
|
|
56
56
|
e.out && "kapi-dp__day--out",
|
|
57
|
-
|
|
57
|
+
a(e.date, O) && "kapi-dp__day--today",
|
|
58
58
|
S?.(e.date)
|
|
59
59
|
].filter(Boolean).join(" "),
|
|
60
60
|
onMouseEnter: w ? () => w(e.date) : void 0,
|
|
@@ -67,5 +67,4 @@ var g = ({ view: g, onViewChange: _, labels: v, focusTarget: y, focusRequest: b
|
|
|
67
67
|
}, e[0].date.getTime()))]
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
|
-
//#endregion
|
|
71
70
|
export { g as KapiCalendarGrid };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/inputsExtra.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useKapiField as e } from "./KapiField.js";
|
|
4
|
+
import { nativeFieldProps as t } from "./fieldLogic.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/components/inputs/KapiCheckCard.tsx
|
|
8
8
|
var i = (e, t = "", n = "checkbox") => [
|
|
9
9
|
"kapi-checkcard",
|
|
10
10
|
n === "radio" && "kapi-checkcard--radio",
|
|
11
11
|
e && "kapi-checkcard--on",
|
|
12
12
|
t
|
|
13
13
|
].filter(Boolean).join(" "), a = ({ label: a, description: o, checked: s, type: c = "checkbox", invalid: l, className: u, ref: d, id: f, required: p, "aria-describedby": m, "aria-invalid": h, "aria-required": g, ..._ }) => {
|
|
14
|
-
let v = e(
|
|
14
|
+
let v = t(e(), {
|
|
15
15
|
id: f,
|
|
16
16
|
describedBy: m,
|
|
17
17
|
invalid: l,
|
|
@@ -38,5 +38,4 @@ var i = (e, t = "", n = "checkbox") => [
|
|
|
38
38
|
})] })]
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
//#endregion
|
|
42
41
|
export { a as KapiCheckCard, i as checkCardClasses };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiChecklist.css";
|
|
3
|
-
import {
|
|
3
|
+
import { useRangeSelect as e } from "../../hooks/useRangeSelect.js";
|
|
4
4
|
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { navKeyOf as n, nextEnabledIndex as r } from "../overlays/menuKeyboardLogic.js";
|
|
6
|
+
import { joinClasses as i } from "../rootProps.js";
|
|
7
7
|
import { KapiInput as ee } from "./KapiInput.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { checklistBulkState as re, filterChecklistItems as ie, orderedChecklistValue as ae, setChecklistItems as oe } from "./checklistLogic.js";
|
|
8
|
+
import { useOwnField as te } from "./ownField.js";
|
|
9
|
+
import { fieldControlProps as a, resolveReadOnly as o } from "./fieldLogic.js";
|
|
10
|
+
import { checklistBulkState as ne, filterChecklistItems as re, orderedChecklistValue as s, setChecklistItems as ie } from "./checklistLogic.js";
|
|
12
11
|
/* empty css */
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
12
|
+
import { useControllableState as c } from "../../hooks/useControllableState.js";
|
|
13
|
+
import { useEffect as ae, useId as oe, useMemo as l, useRef as u, useState as se } from "react";
|
|
14
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
15
|
+
import { Check as ce, Search as le } from "lucide-react";
|
|
16
|
+
// src/components/inputs/KapiChecklist.tsx
|
|
17
17
|
var p = {
|
|
18
18
|
search: "Buscar en la lista",
|
|
19
19
|
searchPlaceholder: "Buscar…",
|
|
@@ -21,18 +21,18 @@ var p = {
|
|
|
21
21
|
clearAll: "Desmarcar todo",
|
|
22
22
|
empty: "Sin coincidencias"
|
|
23
23
|
}, m = 7;
|
|
24
|
-
function h({ items: m, value: h, defaultValue: ue, onChange:
|
|
25
|
-
let D = t("checklist", p, he), O =
|
|
26
|
-
help:
|
|
27
|
-
error:
|
|
28
|
-
required:
|
|
29
|
-
invalid:
|
|
30
|
-
readOnly:
|
|
31
|
-
fieldClassName:
|
|
32
|
-
}), k = O.field, A =
|
|
33
|
-
A || ye(
|
|
34
|
-
}, [R, z] =
|
|
35
|
-
|
|
24
|
+
function h({ items: m, value: h, defaultValue: ue, onChange: g, label: _, help: de, error: v, fieldClassName: fe, readOnly: y, invalid: b, required: x, searchable: pe, query: S, defaultQuery: C, onQueryChange: w, selectAll: me = !1, rangeSelect: T = !0, disabled: E = !1, labels: he, className: ge, "aria-label": _e, ...ve }) {
|
|
25
|
+
let D = t("checklist", p, he), O = te({
|
|
26
|
+
help: de,
|
|
27
|
+
error: v,
|
|
28
|
+
required: x,
|
|
29
|
+
invalid: b,
|
|
30
|
+
readOnly: y,
|
|
31
|
+
fieldClassName: fe
|
|
32
|
+
}), k = O.field, A = o(y, k), j = oe(), M = `${j}-label`, N = u(null), P = u(null), [F, ye] = c(h, ue ?? [], g), I = l(() => new Set(F), [F]), L = (e) => {
|
|
33
|
+
A || ye(s(m, e));
|
|
34
|
+
}, [R, z] = c(S, C ?? "", w), B = pe ?? m.length > 7, V = l(() => re(m, R), [m, R]), H = l(() => V.map((e) => e.id), [V]), U = l(() => E ? [] : V.flatMap((e, t) => e.disabled ? [] : [t]), [V, E]), W = (e) => !E && m.some((t) => t.id === e && !t.disabled), G = e(), [K, q] = se(null), J = K === null ? -1 : H.indexOf(K), Y = (e) => `${j}-opt-${m.findIndex((t) => t.id === e)}`;
|
|
35
|
+
ae(() => {
|
|
36
36
|
J < 0 || N.current?.querySelector(`[data-index="${J}"]`)?.scrollIntoView?.({ block: "nearest" });
|
|
37
37
|
}, [J]);
|
|
38
38
|
let X = (e, t) => {
|
|
@@ -43,18 +43,18 @@ function h({ items: m, value: h, defaultValue: ue, onChange: de, label: g, help:
|
|
|
43
43
|
shift: T && t,
|
|
44
44
|
isSelectable: W
|
|
45
45
|
}));
|
|
46
|
-
}, Z =
|
|
47
|
-
E || L(
|
|
46
|
+
}, Z = ne(V, I), Q = (e) => {
|
|
47
|
+
E || L(ie(m, I, H, e));
|
|
48
48
|
}, be = (e) => {
|
|
49
49
|
if (E) return;
|
|
50
|
-
let t =
|
|
50
|
+
let t = n(e.key, "vertical");
|
|
51
51
|
if (t) {
|
|
52
52
|
e.preventDefault();
|
|
53
|
-
let n =
|
|
53
|
+
let n = r(J, t, U);
|
|
54
54
|
if (n < 0) return;
|
|
55
|
-
let
|
|
55
|
+
let i = t === "next" && n < J || t === "prev" && n > J;
|
|
56
56
|
if (e.shiftKey && T && J >= 0) {
|
|
57
|
-
if (
|
|
57
|
+
if (i) return;
|
|
58
58
|
let e = H[n];
|
|
59
59
|
L(G.extend({
|
|
60
60
|
selected: I,
|
|
@@ -68,20 +68,20 @@ function h({ items: m, value: h, defaultValue: ue, onChange: de, label: g, help:
|
|
|
68
68
|
} else e.key === " " || e.key === "Enter" ? (e.preventDefault(), K !== null && J >= 0 && X(K, e.shiftKey)) : (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "a" ? (e.preventDefault(), Q(Z !== "all")) : B && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), z(R + e.key), P.current?.focus());
|
|
69
69
|
}, xe = () => {
|
|
70
70
|
J < 0 && U.length > 0 && q(H[U[0]]), N.current?.focus();
|
|
71
|
-
}, Se =
|
|
72
|
-
invalid:
|
|
73
|
-
required:
|
|
71
|
+
}, Se = _ == null ? { "aria-label": _e } : { "aria-labelledby": M }, $ = a(k, {
|
|
72
|
+
invalid: b,
|
|
73
|
+
required: x
|
|
74
74
|
});
|
|
75
|
-
return O.wrap(/* @__PURE__ */
|
|
75
|
+
return O.wrap(/* @__PURE__ */ f("div", {
|
|
76
76
|
...ve,
|
|
77
|
-
className:
|
|
77
|
+
className: i("kapi-checklist", E && "is-disabled", A && "is-readonly", ge),
|
|
78
78
|
children: [
|
|
79
|
-
|
|
79
|
+
_ != null && /* @__PURE__ */ d("div", {
|
|
80
80
|
id: M,
|
|
81
81
|
className: "kapi-checklist__label",
|
|
82
|
-
children:
|
|
82
|
+
children: _
|
|
83
83
|
}),
|
|
84
|
-
B && /* @__PURE__ */
|
|
84
|
+
B && /* @__PURE__ */ d(ee, {
|
|
85
85
|
ref: P,
|
|
86
86
|
type: "search",
|
|
87
87
|
size: "sm",
|
|
@@ -89,7 +89,7 @@ function h({ items: m, value: h, defaultValue: ue, onChange: de, label: g, help:
|
|
|
89
89
|
"aria-label": D.search,
|
|
90
90
|
placeholder: D.searchPlaceholder,
|
|
91
91
|
spellCheck: !1,
|
|
92
|
-
startIcon: /* @__PURE__ */
|
|
92
|
+
startIcon: /* @__PURE__ */ d(le, {}),
|
|
93
93
|
clearable: !0,
|
|
94
94
|
disabled: E,
|
|
95
95
|
value: R,
|
|
@@ -98,21 +98,21 @@ function h({ items: m, value: h, defaultValue: ue, onChange: de, label: g, help:
|
|
|
98
98
|
(e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), xe());
|
|
99
99
|
}
|
|
100
100
|
}),
|
|
101
|
-
me && /* @__PURE__ */
|
|
101
|
+
me && /* @__PURE__ */ f("div", {
|
|
102
102
|
className: "kapi-checklist__bulk",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
103
|
+
children: [/* @__PURE__ */ d("button", {
|
|
104
104
|
type: "button",
|
|
105
105
|
disabled: E || A || Z === "all",
|
|
106
106
|
onClick: () => Q(!0),
|
|
107
107
|
children: D.selectAll
|
|
108
|
-
}), /* @__PURE__ */
|
|
108
|
+
}), /* @__PURE__ */ d("button", {
|
|
109
109
|
type: "button",
|
|
110
110
|
disabled: E || A || Z === "none",
|
|
111
111
|
onClick: () => Q(!1),
|
|
112
112
|
children: D.clearAll
|
|
113
113
|
})]
|
|
114
114
|
}),
|
|
115
|
-
V.length > 0 ? /* @__PURE__ */
|
|
115
|
+
V.length > 0 ? /* @__PURE__ */ d("div", {
|
|
116
116
|
ref: N,
|
|
117
117
|
role: "listbox",
|
|
118
118
|
"aria-multiselectable": "true",
|
|
@@ -129,42 +129,42 @@ function h({ items: m, value: h, defaultValue: ue, onChange: de, label: g, help:
|
|
|
129
129
|
e.target === e.currentTarget && J < 0 && U.length > 0 && q(H[U[0]]);
|
|
130
130
|
},
|
|
131
131
|
...Se,
|
|
132
|
-
children: V.map((
|
|
133
|
-
let
|
|
134
|
-
return /* @__PURE__ */
|
|
135
|
-
id: Y(
|
|
136
|
-
"data-index":
|
|
132
|
+
children: V.map((e, t) => {
|
|
133
|
+
let n = I.has(e.id), r = E || e.disabled === !0;
|
|
134
|
+
return /* @__PURE__ */ f("div", {
|
|
135
|
+
id: Y(e.id),
|
|
136
|
+
"data-index": t,
|
|
137
137
|
role: "option",
|
|
138
|
-
"aria-selected":
|
|
139
|
-
"aria-disabled":
|
|
140
|
-
"aria-label": typeof
|
|
141
|
-
className:
|
|
138
|
+
"aria-selected": n,
|
|
139
|
+
"aria-disabled": r || void 0,
|
|
140
|
+
"aria-label": typeof e.label == "string" ? void 0 : e.text,
|
|
141
|
+
className: i("kapi-checklist__option", n && "is-on", t === J && "is-active", r && "is-disabled"),
|
|
142
142
|
onMouseDown: (e) => {
|
|
143
143
|
e.shiftKey && e.preventDefault();
|
|
144
144
|
},
|
|
145
|
-
onClick: (
|
|
146
|
-
|
|
145
|
+
onClick: (t) => {
|
|
146
|
+
r || (q(e.id), X(e.id, t.shiftKey));
|
|
147
147
|
},
|
|
148
|
-
children: [/* @__PURE__ */
|
|
148
|
+
children: [/* @__PURE__ */ d("span", {
|
|
149
149
|
className: "kapi-checklist__box",
|
|
150
150
|
"aria-hidden": "true",
|
|
151
|
-
children:
|
|
151
|
+
children: n && /* @__PURE__ */ d(ce, {
|
|
152
152
|
size: 12,
|
|
153
153
|
strokeWidth: 3
|
|
154
154
|
})
|
|
155
|
-
}), /* @__PURE__ */
|
|
155
|
+
}), /* @__PURE__ */ f("span", {
|
|
156
156
|
className: "kapi-checklist__text",
|
|
157
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ d("span", {
|
|
158
158
|
className: "kapi-checklist__name",
|
|
159
|
-
children:
|
|
160
|
-
}),
|
|
159
|
+
children: e.label
|
|
160
|
+
}), e.description != null && /* @__PURE__ */ d("span", {
|
|
161
161
|
className: "kapi-checklist__desc",
|
|
162
|
-
children:
|
|
162
|
+
children: e.description
|
|
163
163
|
})]
|
|
164
164
|
})]
|
|
165
|
-
},
|
|
165
|
+
}, e.id);
|
|
166
166
|
})
|
|
167
|
-
}) : /* @__PURE__ */
|
|
167
|
+
}) : /* @__PURE__ */ d("div", {
|
|
168
168
|
className: "kapi-checklist__empty",
|
|
169
169
|
role: "status",
|
|
170
170
|
children: m.length > 0 ? D.empty : null
|
|
@@ -172,5 +172,4 @@ function h({ items: m, value: h, defaultValue: ue, onChange: de, label: g, help:
|
|
|
172
172
|
]
|
|
173
173
|
}));
|
|
174
174
|
}
|
|
175
|
-
//#endregion
|
|
176
175
|
export { m as CHECKLIST_SEARCH_THRESHOLD, p as DEFAULT_CHECKLIST_LABELS, h as KapiChecklist };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useMergedRefs as e } from "../../hooks/mergeRefs.js";
|
|
3
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
4
|
+
import { KapiButton as n } from "./KapiButton.js";
|
|
5
5
|
import { copyText as r } from "./copyLogic.js";
|
|
6
6
|
import { present as i } from "./inputLogic.js";
|
|
7
7
|
import { useEffect as a, useRef as o, useState as s } from "react";
|
|
8
8
|
import { jsx as c } from "react/jsx-runtime";
|
|
9
9
|
import { Check as l, Copy as u } from "lucide-react";
|
|
10
|
-
|
|
10
|
+
// src/components/inputs/KapiCopyButton.tsx
|
|
11
11
|
var d = {
|
|
12
12
|
copy: "Copiar",
|
|
13
13
|
copied: "Copiado"
|
|
14
14
|
}, f = 2e3;
|
|
15
15
|
function p({ value: p, children: m, onCopy: h, labels: g, ref: _, ...v }) {
|
|
16
|
-
let y =
|
|
16
|
+
let y = t("copyButton", d, g), [b, x] = s(!1), S = o(null), C = o(void 0), w = o(!0), T = e(S, _);
|
|
17
17
|
a(() => (w.current = !0, () => {
|
|
18
18
|
w.current = !1, clearTimeout(C.current);
|
|
19
19
|
}), []);
|
|
@@ -21,7 +21,7 @@ function p({ value: p, children: m, onCopy: h, labels: g, ref: _, ...v }) {
|
|
|
21
21
|
let e = await r(p, S.current);
|
|
22
22
|
w.current && (h?.(e), e && (x(!0), clearTimeout(C.current), C.current = setTimeout(() => x(!1), f)));
|
|
23
23
|
}, D = i(m), O = b ? y.copied : y.copy;
|
|
24
|
-
return /* @__PURE__ */ c(
|
|
24
|
+
return /* @__PURE__ */ c(n, {
|
|
25
25
|
...v,
|
|
26
26
|
ref: T,
|
|
27
27
|
icon: c(b ? l : u, { "aria-hidden": "true" }),
|
|
@@ -31,5 +31,4 @@ function p({ value: p, children: m, onCopy: h, labels: g, ref: _, ...v }) {
|
|
|
31
31
|
children: D ? b ? y.copied : m : void 0
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { f as COPY_FEEDBACK_MS, d as DEFAULT_COPY_BUTTON_LABELS, p as KapiCopyButton };
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiDatePicker.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { useControllableState as
|
|
10
|
-
import {
|
|
11
|
-
import { useFormReset as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
3
|
+
import { chipFieldSize as e, datePatternFor as t, formDateValue as n, formatValue as r, hasCalendar as ee, hasTime as te, localizedCalendarLabels as ne, maskInput as re, minuteOptions as ie, monthTitle as ae, pad as i, parseText as oe, pickerIsChip as se, sameDay as a, validDateOrNull as o } from "./datePickerLogic.js";
|
|
4
|
+
import { useKapiLocale as ce, useLabels as le } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { useOwnField as ue } from "./ownField.js";
|
|
6
|
+
import { joinClasses as de } from "../rootProps.js";
|
|
7
|
+
import { resolveChipLabel as fe } from "./selectLogic.js";
|
|
8
|
+
import { useOutsidePress as pe } from "../../hooks/useOutsidePress.js";
|
|
9
|
+
import { useControllableState as me } from "../../hooks/useControllableState.js";
|
|
10
|
+
import { useMergedRefs as he } from "../../hooks/mergeRefs.js";
|
|
11
|
+
import { useFormReset as ge } from "../../hooks/useFormReset.js";
|
|
12
|
+
import { assignRef as _e, fieldControlProps as ve, focusLeaves as ye, resolveReadOnly as be } from "./fieldLogic.js";
|
|
13
|
+
import { KapiCalendarGrid as xe } from "./KapiCalendarGrid.js";
|
|
14
|
+
import { useCalendarFocus as Se } from "./useCalendarFocus.js";
|
|
15
|
+
import { useDatePopSide as Ce } from "./useDatePopSide.js";
|
|
14
16
|
/* empty css */
|
|
15
|
-
import {
|
|
16
|
-
import { useCalendarFocus as Ce } from "./useCalendarFocus.js";
|
|
17
|
-
import { useDatePopSide as we } from "./useDatePopSide.js";
|
|
17
|
+
import { activeHTMLElementOf as we } from "../../hooks/ownerDocument.js";
|
|
18
18
|
import { useId as Te, useMemo as Ee, useRef as s, useState as c } from "react";
|
|
19
19
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
20
20
|
import { Calendar as De, ChevronLeft as Oe, ChevronRight as ke, Clock as Ae } from "lucide-react";
|
|
21
|
-
|
|
21
|
+
// src/components/inputs/KapiDatePicker.tsx
|
|
22
22
|
var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t, Me = Array.from({ length: 24 }, (e, t) => t), d = ({ mode: d = "date", value: f, defaultValue: Ne, onChange: Pe, placeholder: Fe, variant: Ie, icon: p, chipLabel: m, label: h, help: Le, error: g, fieldClassName: Re, readOnly: _, disabled: v = !1, id: y, name: b, className: ze, style: Be, "aria-label": Ve, labels: x, minuteStep: He = 1, invalid: S, required: C, ref: Ue, onBlur: We, weekStartsOn: Ge }) => {
|
|
23
|
-
let w =
|
|
23
|
+
let w = ce(), T = le("calendar", ne(w), x), E = Ee(() => t(w), [w]), D = ee(d), O = te(d), k = se({
|
|
24
24
|
variant: Ie,
|
|
25
25
|
icon: p,
|
|
26
26
|
chipLabel: m,
|
|
27
27
|
label: h
|
|
28
|
-
}), { chipLabel: A, fieldLabel: Ke } =
|
|
28
|
+
}), { chipLabel: A, fieldLabel: Ke } = fe({
|
|
29
29
|
chip: k,
|
|
30
30
|
chipLabel: m,
|
|
31
31
|
label: h
|
|
32
|
-
}), j =
|
|
32
|
+
}), j = ue({
|
|
33
33
|
id: y,
|
|
34
34
|
label: Ke,
|
|
35
35
|
help: Le,
|
|
@@ -38,13 +38,13 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
38
38
|
invalid: S,
|
|
39
39
|
readOnly: _,
|
|
40
40
|
fieldClassName: Re
|
|
41
|
-
}), M = j.field, N =
|
|
41
|
+
}), M = j.field, N = be(_, M), P = Fe ?? je(d, E.placeholder), qe = Te(), F = y ?? M?.controlId ?? (k ? qe : void 0), I = ve(M, {
|
|
42
42
|
id: F,
|
|
43
43
|
invalid: S,
|
|
44
44
|
required: C
|
|
45
|
-
}), [L, R] = c(!1), Je = f !== void 0, [z, Ye, , Xe] =
|
|
46
|
-
(tt !== Y || rt !== d || at !== E) && (nt(Y), it(d), ot(E), V(r(z, d, E)), z && U(z)),
|
|
47
|
-
let e =
|
|
45
|
+
}), [L, R] = c(!1), Je = f !== void 0, [z, Ye, , Xe] = me(f === void 0 ? void 0 : o(f), o(Ne ?? null), Pe), [B, V] = c(() => r(z, d, E)), [H, U] = c(() => z ?? /* @__PURE__ */ new Date()), W = s(null), Ze = he(W, ge(Xe)), G = s(null), K = s(null), { inputRef: Qe, focusRequest: $e, openFromKeyboard: q, openFromFocus: et, returnFocus: J } = Se(R), Y = z ? z.getTime() : null, [tt, nt] = c(Y), [rt, it] = c(d), [at, ot] = c(E);
|
|
46
|
+
(tt !== Y || rt !== d || at !== E) && (nt(Y), it(d), ot(E), V(r(z, d, E)), z && U(z)), pe(L, [W], () => {
|
|
47
|
+
let e = we(W.current);
|
|
48
48
|
e && K.current?.contains(e) && e.blur(), R(!1);
|
|
49
49
|
});
|
|
50
50
|
let X = (e) => {
|
|
@@ -54,7 +54,7 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
54
54
|
z && X(null);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
let e =
|
|
57
|
+
let e = oe(B, d, z, /* @__PURE__ */ new Date(), E);
|
|
58
58
|
e === void 0 ? V(r(z, d, E)) : (e && z && e.getTime() === z.getTime() ? V(r(e, d, E)) : X(e), e && U(e));
|
|
59
59
|
}, Z = (e) => {
|
|
60
60
|
let t = z ?? /* @__PURE__ */ new Date(), n = new Date(e);
|
|
@@ -62,7 +62,7 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
62
62
|
}, Q = (e, t) => {
|
|
63
63
|
let n = new Date(z ?? /* @__PURE__ */ new Date());
|
|
64
64
|
e != null && n.setHours(e), t != null && n.setMinutes(t), X(n);
|
|
65
|
-
}, $ = (e) => U(new Date(H.getFullYear(), H.getMonth() + e, 1)), ct =
|
|
65
|
+
}, $ = (e) => U(new Date(H.getFullYear(), H.getMonth() + e, 1)), ct = Ce(L && !v && !N, G, K);
|
|
66
66
|
return j.wrap(/* @__PURE__ */ u("div", {
|
|
67
67
|
className: [
|
|
68
68
|
"kapi-dp",
|
|
@@ -73,7 +73,7 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
73
73
|
style: Be,
|
|
74
74
|
ref: Ze,
|
|
75
75
|
onBlur: (e) => {
|
|
76
|
-
|
|
76
|
+
ye(e.relatedTarget, e.currentTarget) && We?.(e);
|
|
77
77
|
},
|
|
78
78
|
children: [
|
|
79
79
|
/* @__PURE__ */ u("div", {
|
|
@@ -88,11 +88,11 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
88
88
|
}),
|
|
89
89
|
/* @__PURE__ */ l("input", {
|
|
90
90
|
ref: (e) => {
|
|
91
|
-
Qe.current = e,
|
|
91
|
+
Qe.current = e, _e(Ue, e);
|
|
92
92
|
},
|
|
93
93
|
...I,
|
|
94
|
-
...k ? { size:
|
|
95
|
-
className:
|
|
94
|
+
...k ? { size: e(P) } : {},
|
|
95
|
+
className: de("kapi-input", "kapi-dp__input", I["aria-invalid"] && "kapi-input--err"),
|
|
96
96
|
value: B,
|
|
97
97
|
placeholder: P,
|
|
98
98
|
disabled: v,
|
|
@@ -100,7 +100,7 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
100
100
|
"aria-label": Ve,
|
|
101
101
|
autoComplete: "off",
|
|
102
102
|
inputMode: "numeric",
|
|
103
|
-
onChange: (e) => V(
|
|
103
|
+
onChange: (e) => V(re(e.target.value, d, E)),
|
|
104
104
|
onFocus: N ? void 0 : et,
|
|
105
105
|
onBlur: st,
|
|
106
106
|
onKeyDown: (e) => {
|
|
@@ -124,7 +124,7 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
124
124
|
b && /* @__PURE__ */ l("input", {
|
|
125
125
|
type: "hidden",
|
|
126
126
|
name: b,
|
|
127
|
-
value:
|
|
127
|
+
value: n(z, d),
|
|
128
128
|
disabled: v
|
|
129
129
|
}),
|
|
130
130
|
L && !v && !N && /* @__PURE__ */ u("div", {
|
|
@@ -152,7 +152,7 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
152
152
|
}),
|
|
153
153
|
/* @__PURE__ */ l("span", {
|
|
154
154
|
className: "kapi-dp__title",
|
|
155
|
-
children:
|
|
155
|
+
children: ae(H, T.months)
|
|
156
156
|
}),
|
|
157
157
|
/* @__PURE__ */ l("button", {
|
|
158
158
|
type: "button",
|
|
@@ -167,7 +167,7 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
167
167
|
})
|
|
168
168
|
]
|
|
169
169
|
}),
|
|
170
|
-
/* @__PURE__ */ l(
|
|
170
|
+
/* @__PURE__ */ l(xe, {
|
|
171
171
|
weekStartsOn: Ge,
|
|
172
172
|
view: H,
|
|
173
173
|
onViewChange: U,
|
|
@@ -212,7 +212,7 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
212
212
|
}, e))
|
|
213
213
|
}), /* @__PURE__ */ l("div", {
|
|
214
214
|
className: "kapi-dp__time-col",
|
|
215
|
-
children:
|
|
215
|
+
children: ie(He, z?.getMinutes()).map((e) => /* @__PURE__ */ l("button", {
|
|
216
216
|
type: "button",
|
|
217
217
|
className: `kapi-dp__time-opt${z?.getMinutes() === e ? " kapi-dp__time-opt--sel" : ""}`,
|
|
218
218
|
onClick: () => Q(null, e),
|
|
@@ -225,5 +225,4 @@ var je = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
225
225
|
]
|
|
226
226
|
}));
|
|
227
227
|
};
|
|
228
|
-
//#endregion
|
|
229
228
|
export { d as KapiDatePicker };
|