tekivex-ui 2.5.15 → 2.6.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/dist/charts.cjs +1 -1
- package/dist/charts.js +22 -553
- package/dist/chunk-B3ph66Zb.js +1 -0
- package/dist/chunk-Bc16rJT-.js +1 -0
- package/dist/chunk-Dike2DLU.js +3 -0
- package/dist/chunk-DjxOP8W4.js +1 -0
- package/dist/chunk-DkoFTL1O.js +1 -0
- package/dist/chunk-DmRB1Blb.js +1 -0
- package/dist/chunk-DnCXUUx5.js +1 -0
- package/dist/chunk-LWkKqC8d.js +1 -0
- package/dist/chunk-PJ50l0JC.js +1 -0
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +1 -442
- package/dist/i18n.cjs +1 -1
- package/dist/i18n.js +1 -733
- package/dist/index.cjs +1 -152
- package/dist/index.d.ts +4 -2
- package/dist/index.js +429 -16786
- package/dist/quantum.cjs +1 -89
- package/dist/quantum.js +74 -2551
- package/dist/realtime.cjs +1 -23
- package/dist/realtime.js +1 -804
- package/dist/src/a11y/index.d.ts +0 -1
- package/dist/src/charts/TkxAreaChart.d.ts +0 -5
- package/dist/src/charts/TkxBarChart.d.ts +0 -3
- package/dist/src/charts/TkxDonutChart.d.ts +0 -5
- package/dist/src/charts/TkxLineChart.d.ts +0 -1
- package/dist/src/charts/TkxPieChart.d.ts +0 -3
- package/dist/src/charts/TkxRadarChart.d.ts +0 -3
- package/dist/src/charts/TkxScatterChart.d.ts +0 -2
- package/dist/src/charts/index.d.ts +0 -1
- package/dist/src/charts/shared.d.ts +0 -3
- package/dist/src/components/TkxAIChatBubble.d.ts +0 -9
- package/dist/src/components/TkxAIConfidenceBar.d.ts +0 -6
- package/dist/src/components/TkxAIThinking.d.ts +0 -6
- package/dist/src/components/TkxAccordion.d.ts +0 -1
- package/dist/src/components/TkxAffix.d.ts +0 -1
- package/dist/src/components/TkxAlert.d.ts +0 -1
- package/dist/src/components/TkxAnchor.d.ts +0 -1
- package/dist/src/components/TkxAppBar.d.ts +0 -1
- package/dist/src/components/TkxAutocomplete.d.ts +0 -1
- package/dist/src/components/TkxAvatar.d.ts +0 -1
- package/dist/src/components/TkxBadge.d.ts +0 -1
- package/dist/src/components/TkxBottomNav.d.ts +0 -1
- package/dist/src/components/TkxBreadcrumb.d.ts +0 -1
- package/dist/src/components/TkxButton.d.ts +0 -1
- package/dist/src/components/TkxCard.d.ts +0 -1
- package/dist/src/components/TkxCarousel.d.ts +0 -1
- package/dist/src/components/TkxCascader.d.ts +0 -1
- package/dist/src/components/TkxChat.d.ts +0 -1
- package/dist/src/components/TkxCheckbox.d.ts +0 -1
- package/dist/src/components/TkxClock.d.ts +0 -1
- package/dist/src/components/TkxColorPicker.d.ts +0 -1
- package/dist/src/components/TkxCommand.d.ts +0 -1
- package/dist/src/components/TkxConfigProvider.d.ts +0 -30
- package/dist/src/components/TkxDataGrid.d.ts +0 -15
- package/dist/src/components/TkxDatePicker.d.ts +0 -1
- package/dist/src/components/TkxDivider.d.ts +0 -1
- package/dist/src/components/TkxDrawer.d.ts +0 -1
- package/dist/src/components/TkxDropdown.d.ts +0 -1
- package/dist/src/components/TkxEmpty.d.ts +0 -1
- package/dist/src/components/TkxFileUpload.d.ts +0 -1
- package/dist/src/components/TkxForm.d.ts +0 -35
- package/dist/src/components/TkxIcon.d.ts +0 -1
- package/dist/src/components/TkxImage.d.ts +0 -1
- package/dist/src/components/TkxInput.d.ts +1 -1
- package/dist/src/components/TkxLayout.d.ts +0 -22
- package/dist/src/components/TkxList.d.ts +0 -1
- package/dist/src/components/TkxLiveFeed.d.ts +0 -1
- package/dist/src/components/TkxLiveLog.d.ts +0 -1
- package/dist/src/components/TkxLiveMetrics.d.ts +0 -1
- package/dist/src/components/TkxLogo.d.ts +0 -1
- package/dist/src/components/TkxMarkdown.d.ts +0 -10
- package/dist/src/components/TkxMasonry.d.ts +0 -1
- package/dist/src/components/TkxMentions.d.ts +0 -1
- package/dist/src/components/TkxMenu.d.ts +0 -1
- package/dist/src/components/TkxModal.d.ts +0 -1
- package/dist/src/components/TkxNumberInput.d.ts +0 -1
- package/dist/src/components/TkxOTP.d.ts +0 -1
- package/dist/src/components/TkxOrgChart.d.ts +32 -0
- package/dist/src/components/TkxPagination.d.ts +0 -1
- package/dist/src/components/TkxPlayground.d.ts +0 -13
- package/dist/src/components/TkxPopover.d.ts +0 -1
- package/dist/src/components/TkxProgress.d.ts +0 -1
- package/dist/src/components/TkxQRCode.d.ts +0 -1
- package/dist/src/components/TkxQuantumForm.d.ts +0 -1
- package/dist/src/components/TkxRadio.d.ts +0 -1
- package/dist/src/components/TkxRating.d.ts +0 -1
- package/dist/src/components/TkxRealTimeChart.d.ts +0 -1
- package/dist/src/components/TkxResult.d.ts +0 -1
- package/dist/src/components/TkxRichTextDisplay.d.ts +0 -1
- package/dist/src/components/TkxSegmented.d.ts +0 -1
- package/dist/src/components/TkxSelect.d.ts +0 -3
- package/dist/src/components/TkxSkeleton.d.ts +0 -1
- package/dist/src/components/TkxSlider.d.ts +0 -1
- package/dist/src/components/TkxSnackbar.d.ts +0 -1
- package/dist/src/components/TkxSpeedDial.d.ts +0 -1
- package/dist/src/components/TkxSpin.d.ts +0 -1
- package/dist/src/components/TkxStatistic.d.ts +0 -1
- package/dist/src/components/TkxStepper.d.ts +0 -1
- package/dist/src/components/TkxTable.d.ts +0 -1
- package/dist/src/components/TkxTabs.d.ts +0 -1
- package/dist/src/components/TkxTag.d.ts +0 -1
- package/dist/src/components/TkxThemeBuilder.d.ts +0 -1
- package/dist/src/components/TkxTimeline.d.ts +0 -1
- package/dist/src/components/TkxToast.d.ts +0 -1
- package/dist/src/components/TkxToggle.d.ts +0 -1
- package/dist/src/components/TkxToolbar.d.ts +0 -1
- package/dist/src/components/TkxTooltip.d.ts +0 -1
- package/dist/src/components/TkxTour.d.ts +0 -1
- package/dist/src/components/TkxTransferList.d.ts +0 -1
- package/dist/src/components/TkxTreeView.d.ts +0 -1
- package/dist/src/components/TkxTypography.d.ts +0 -1
- package/dist/src/components/TkxVideoPlayer.d.ts +0 -1
- package/dist/src/components/TkxWatermark.d.ts +0 -1
- package/dist/src/components/index.d.ts +1 -1
- package/dist/src/engine/css.d.ts +0 -1
- package/dist/src/engine/index.d.ts +0 -1
- package/dist/src/engine/quantum-ai.d.ts +0 -73
- package/dist/src/engine/quantum.d.ts +0 -1
- package/dist/src/engine/security.d.ts +45 -9
- package/dist/src/engine/tkx.d.ts +0 -53
- package/dist/src/engine/wcag.d.ts +0 -1
- package/dist/src/headless/index.d.ts +0 -1
- package/dist/src/headless/useControllable.d.ts +0 -15
- package/dist/src/headless/useDebounce.d.ts +0 -12
- package/dist/src/headless/useDisclosure.d.ts +0 -13
- package/dist/src/headless/useFormState.d.ts +0 -13
- package/dist/src/headless/useInfiniteQuery.d.ts +0 -11
- package/dist/src/headless/useIntersectionObserver.d.ts +0 -10
- package/dist/src/headless/useListSelection.d.ts +0 -9
- package/dist/src/headless/useLocalStorage.d.ts +0 -8
- package/dist/src/headless/useMediaQuery.d.ts +0 -10
- package/dist/src/headless/useRovingTabIndex.d.ts +0 -15
- package/dist/src/headless/useSSE.d.ts +0 -9
- package/dist/src/headless/useThrottle.d.ts +0 -7
- package/dist/src/headless/useWebSocket.d.ts +0 -9
- package/dist/src/hooks/index.d.ts +0 -1
- package/dist/src/i18n/I18nProvider.d.ts +0 -1
- package/dist/src/i18n/index.d.ts +0 -1
- package/dist/src/quantum/index.d.ts +0 -1
- package/dist/src/realtime/index.d.ts +0 -1
- package/dist/src/themes/index.d.ts +0 -1
- package/package.json +5 -3
- package/dist/TkxForm-BaO4wvXt.js +0 -320
- package/dist/TkxForm-M6ttomry.cjs +0 -12
- package/dist/chunk-Bmb41Sf3.cjs +0 -1
- package/dist/hooks-6pRsPOyG.js +0 -58
- package/dist/hooks-mivgRljH.cjs +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/src/a11y/index.d.ts.map +0 -1
- package/dist/src/charts/TkxAreaChart.d.ts.map +0 -1
- package/dist/src/charts/TkxBarChart.d.ts.map +0 -1
- package/dist/src/charts/TkxDonutChart.d.ts.map +0 -1
- package/dist/src/charts/TkxLineChart.d.ts.map +0 -1
- package/dist/src/charts/TkxPieChart.d.ts.map +0 -1
- package/dist/src/charts/TkxRadarChart.d.ts.map +0 -1
- package/dist/src/charts/TkxScatterChart.d.ts.map +0 -1
- package/dist/src/charts/index.d.ts.map +0 -1
- package/dist/src/charts/shared.d.ts.map +0 -1
- package/dist/src/components/TkxAIChatBubble.d.ts.map +0 -1
- package/dist/src/components/TkxAIConfidenceBar.d.ts.map +0 -1
- package/dist/src/components/TkxAIThinking.d.ts.map +0 -1
- package/dist/src/components/TkxAccordion.d.ts.map +0 -1
- package/dist/src/components/TkxAffix.d.ts.map +0 -1
- package/dist/src/components/TkxAlert.d.ts.map +0 -1
- package/dist/src/components/TkxAnchor.d.ts.map +0 -1
- package/dist/src/components/TkxAppBar.d.ts.map +0 -1
- package/dist/src/components/TkxAutocomplete.d.ts.map +0 -1
- package/dist/src/components/TkxAvatar.d.ts.map +0 -1
- package/dist/src/components/TkxBadge.d.ts.map +0 -1
- package/dist/src/components/TkxBottomNav.d.ts.map +0 -1
- package/dist/src/components/TkxBreadcrumb.d.ts.map +0 -1
- package/dist/src/components/TkxButton.d.ts.map +0 -1
- package/dist/src/components/TkxCard.d.ts.map +0 -1
- package/dist/src/components/TkxCarousel.d.ts.map +0 -1
- package/dist/src/components/TkxCascader.d.ts.map +0 -1
- package/dist/src/components/TkxChat.d.ts.map +0 -1
- package/dist/src/components/TkxCheckbox.d.ts.map +0 -1
- package/dist/src/components/TkxClock.d.ts.map +0 -1
- package/dist/src/components/TkxColorPicker.d.ts.map +0 -1
- package/dist/src/components/TkxCommand.d.ts.map +0 -1
- package/dist/src/components/TkxConfigProvider.d.ts.map +0 -1
- package/dist/src/components/TkxDataGrid.d.ts.map +0 -1
- package/dist/src/components/TkxDatePicker.d.ts.map +0 -1
- package/dist/src/components/TkxDivider.d.ts.map +0 -1
- package/dist/src/components/TkxDrawer.d.ts.map +0 -1
- package/dist/src/components/TkxDropdown.d.ts.map +0 -1
- package/dist/src/components/TkxEmpty.d.ts.map +0 -1
- package/dist/src/components/TkxFileUpload.d.ts.map +0 -1
- package/dist/src/components/TkxForm.d.ts.map +0 -1
- package/dist/src/components/TkxIcon.d.ts.map +0 -1
- package/dist/src/components/TkxImage.d.ts.map +0 -1
- package/dist/src/components/TkxInput.d.ts.map +0 -1
- package/dist/src/components/TkxLayout.d.ts.map +0 -1
- package/dist/src/components/TkxList.d.ts.map +0 -1
- package/dist/src/components/TkxLiveFeed.d.ts.map +0 -1
- package/dist/src/components/TkxLiveLog.d.ts.map +0 -1
- package/dist/src/components/TkxLiveMetrics.d.ts.map +0 -1
- package/dist/src/components/TkxLogo.d.ts.map +0 -1
- package/dist/src/components/TkxMarkdown.d.ts.map +0 -1
- package/dist/src/components/TkxMasonry.d.ts.map +0 -1
- package/dist/src/components/TkxMentions.d.ts.map +0 -1
- package/dist/src/components/TkxMenu.d.ts.map +0 -1
- package/dist/src/components/TkxModal.d.ts.map +0 -1
- package/dist/src/components/TkxNumberInput.d.ts.map +0 -1
- package/dist/src/components/TkxOTP.d.ts.map +0 -1
- package/dist/src/components/TkxPagination.d.ts.map +0 -1
- package/dist/src/components/TkxPlayground.d.ts.map +0 -1
- package/dist/src/components/TkxPopover.d.ts.map +0 -1
- package/dist/src/components/TkxProgress.d.ts.map +0 -1
- package/dist/src/components/TkxQRCode.d.ts.map +0 -1
- package/dist/src/components/TkxQuantumForm.d.ts.map +0 -1
- package/dist/src/components/TkxRadio.d.ts.map +0 -1
- package/dist/src/components/TkxRating.d.ts.map +0 -1
- package/dist/src/components/TkxRealTimeChart.d.ts.map +0 -1
- package/dist/src/components/TkxResult.d.ts.map +0 -1
- package/dist/src/components/TkxRichTextDisplay.d.ts.map +0 -1
- package/dist/src/components/TkxSegmented.d.ts.map +0 -1
- package/dist/src/components/TkxSelect.d.ts.map +0 -1
- package/dist/src/components/TkxSkeleton.d.ts.map +0 -1
- package/dist/src/components/TkxSlider.d.ts.map +0 -1
- package/dist/src/components/TkxSnackbar.d.ts.map +0 -1
- package/dist/src/components/TkxSpeedDial.d.ts.map +0 -1
- package/dist/src/components/TkxSpin.d.ts.map +0 -1
- package/dist/src/components/TkxStatistic.d.ts.map +0 -1
- package/dist/src/components/TkxStepper.d.ts.map +0 -1
- package/dist/src/components/TkxTable.d.ts.map +0 -1
- package/dist/src/components/TkxTabs.d.ts.map +0 -1
- package/dist/src/components/TkxTag.d.ts.map +0 -1
- package/dist/src/components/TkxThemeBuilder.d.ts.map +0 -1
- package/dist/src/components/TkxTimeline.d.ts.map +0 -1
- package/dist/src/components/TkxToast.d.ts.map +0 -1
- package/dist/src/components/TkxToggle.d.ts.map +0 -1
- package/dist/src/components/TkxToolbar.d.ts.map +0 -1
- package/dist/src/components/TkxTooltip.d.ts.map +0 -1
- package/dist/src/components/TkxTour.d.ts.map +0 -1
- package/dist/src/components/TkxTransferList.d.ts.map +0 -1
- package/dist/src/components/TkxTreeView.d.ts.map +0 -1
- package/dist/src/components/TkxTypography.d.ts.map +0 -1
- package/dist/src/components/TkxVideoPlayer.d.ts.map +0 -1
- package/dist/src/components/TkxWatermark.d.ts.map +0 -1
- package/dist/src/components/index.d.ts.map +0 -1
- package/dist/src/engine/css.d.ts.map +0 -1
- package/dist/src/engine/index.d.ts.map +0 -1
- package/dist/src/engine/quantum-ai.d.ts.map +0 -1
- package/dist/src/engine/quantum.d.ts.map +0 -1
- package/dist/src/engine/security.d.ts.map +0 -1
- package/dist/src/engine/tkx.d.ts.map +0 -1
- package/dist/src/engine/wcag.d.ts.map +0 -1
- package/dist/src/headless/index.d.ts.map +0 -1
- package/dist/src/headless/useControllable.d.ts.map +0 -1
- package/dist/src/headless/useDebounce.d.ts.map +0 -1
- package/dist/src/headless/useDisclosure.d.ts.map +0 -1
- package/dist/src/headless/useFormState.d.ts.map +0 -1
- package/dist/src/headless/useInfiniteQuery.d.ts.map +0 -1
- package/dist/src/headless/useIntersectionObserver.d.ts.map +0 -1
- package/dist/src/headless/useListSelection.d.ts.map +0 -1
- package/dist/src/headless/useLocalStorage.d.ts.map +0 -1
- package/dist/src/headless/useMediaQuery.d.ts.map +0 -1
- package/dist/src/headless/useRovingTabIndex.d.ts.map +0 -1
- package/dist/src/headless/useSSE.d.ts.map +0 -1
- package/dist/src/headless/useThrottle.d.ts.map +0 -1
- package/dist/src/headless/useWebSocket.d.ts.map +0 -1
- package/dist/src/hooks/index.d.ts.map +0 -1
- package/dist/src/i18n/I18nProvider.d.ts.map +0 -1
- package/dist/src/i18n/index.d.ts.map +0 -1
- package/dist/src/quantum/index.d.ts.map +0 -1
- package/dist/src/realtime/index.d.ts.map +0 -1
- package/dist/src/themes/index.d.ts.map +0 -1
- package/dist/themes-BbJanqiC.js +0 -498
- package/dist/themes-CMq2vWXj.cjs +0 -2
- package/dist/tkx-BoP5V5zy.cjs +0 -4
- package/dist/tkx-mOKMzvUK.js +0 -1174
- package/src/a11y/index.tsx +0 -87
- package/src/charts/TkxAreaChart.tsx +0 -121
- package/src/charts/TkxBarChart.tsx +0 -117
- package/src/charts/TkxDonutChart.tsx +0 -164
- package/src/charts/TkxLineChart.tsx +0 -137
- package/src/charts/TkxPieChart.tsx +0 -103
- package/src/charts/TkxRadarChart.tsx +0 -92
- package/src/charts/TkxScatterChart.tsx +0 -104
- package/src/charts/index.ts +0 -22
- package/src/charts/shared.ts +0 -47
- package/src/components/TkxAIChatBubble.tsx +0 -256
- package/src/components/TkxAIConfidenceBar.tsx +0 -133
- package/src/components/TkxAIThinking.tsx +0 -193
- package/src/components/TkxAccordion.tsx +0 -590
- package/src/components/TkxAffix.tsx +0 -140
- package/src/components/TkxAlert.tsx +0 -94
- package/src/components/TkxAnchor.tsx +0 -195
- package/src/components/TkxAppBar.tsx +0 -262
- package/src/components/TkxAutocomplete.tsx +0 -455
- package/src/components/TkxAvatar.tsx +0 -103
- package/src/components/TkxBadge.tsx +0 -75
- package/src/components/TkxBottomNav.tsx +0 -241
- package/src/components/TkxBreadcrumb.tsx +0 -324
- package/src/components/TkxButton.tsx +0 -155
- package/src/components/TkxCard.tsx +0 -96
- package/src/components/TkxCarousel.tsx +0 -554
- package/src/components/TkxCascader.tsx +0 -278
- package/src/components/TkxChat.tsx +0 -356
- package/src/components/TkxCheckbox.tsx +0 -220
- package/src/components/TkxClock.tsx +0 -603
- package/src/components/TkxColorPicker.tsx +0 -635
- package/src/components/TkxCommand.tsx +0 -646
- package/src/components/TkxConfigProvider.tsx +0 -460
- package/src/components/TkxDataGrid.tsx +0 -941
- package/src/components/TkxDatePicker.tsx +0 -1625
- package/src/components/TkxDivider.tsx +0 -51
- package/src/components/TkxDrawer.tsx +0 -236
- package/src/components/TkxDropdown.tsx +0 -804
- package/src/components/TkxEmpty.tsx +0 -221
- package/src/components/TkxFileUpload.tsx +0 -373
- package/src/components/TkxForm.tsx +0 -683
- package/src/components/TkxIcon.tsx +0 -685
- package/src/components/TkxImage.tsx +0 -279
- package/src/components/TkxInput.tsx +0 -103
- package/src/components/TkxLayout.tsx +0 -649
- package/src/components/TkxList.tsx +0 -244
- package/src/components/TkxLiveFeed.tsx +0 -331
- package/src/components/TkxLiveLog.tsx +0 -472
- package/src/components/TkxLiveMetrics.tsx +0 -315
- package/src/components/TkxLogo.tsx +0 -299
- package/src/components/TkxMarkdown.tsx +0 -855
- package/src/components/TkxMasonry.tsx +0 -178
- package/src/components/TkxMentions.tsx +0 -212
- package/src/components/TkxMenu.tsx +0 -1044
- package/src/components/TkxModal.tsx +0 -122
- package/src/components/TkxNumberInput.tsx +0 -410
- package/src/components/TkxOTP.tsx +0 -297
- package/src/components/TkxPagination.tsx +0 -390
- package/src/components/TkxPlayground.tsx +0 -845
- package/src/components/TkxPopover.tsx +0 -297
- package/src/components/TkxProgress.tsx +0 -114
- package/src/components/TkxQRCode.tsx +0 -176
- package/src/components/TkxQuantumForm.tsx +0 -594
- package/src/components/TkxRadio.tsx +0 -286
- package/src/components/TkxRating.tsx +0 -288
- package/src/components/TkxRealTimeChart.tsx +0 -383
- package/src/components/TkxResult.tsx +0 -130
- package/src/components/TkxRichTextDisplay.tsx +0 -396
- package/src/components/TkxSegmented.tsx +0 -171
- package/src/components/TkxSelect.tsx +0 -1130
- package/src/components/TkxSkeleton.tsx +0 -107
- package/src/components/TkxSlider.tsx +0 -495
- package/src/components/TkxSnackbar.tsx +0 -316
- package/src/components/TkxSpeedDial.tsx +0 -397
- package/src/components/TkxSpin.tsx +0 -263
- package/src/components/TkxStatistic.tsx +0 -263
- package/src/components/TkxStepper.tsx +0 -487
- package/src/components/TkxTable.tsx +0 -424
- package/src/components/TkxTabs.tsx +0 -126
- package/src/components/TkxTag.tsx +0 -321
- package/src/components/TkxThemeBuilder.tsx +0 -687
- package/src/components/TkxTimeline.tsx +0 -305
- package/src/components/TkxToast.tsx +0 -287
- package/src/components/TkxToggle.tsx +0 -95
- package/src/components/TkxToolbar.tsx +0 -262
- package/src/components/TkxTooltip.tsx +0 -85
- package/src/components/TkxTour.tsx +0 -241
- package/src/components/TkxTransferList.tsx +0 -489
- package/src/components/TkxTreeView.tsx +0 -423
- package/src/components/TkxTypography.tsx +0 -267
- package/src/components/TkxVideoPlayer.tsx +0 -1015
- package/src/components/TkxWatermark.tsx +0 -145
- package/src/components/index.ts +0 -80
- package/src/engine/css.ts +0 -126
- package/src/engine/index.ts +0 -12
- package/src/engine/quantum-ai.ts +0 -1045
- package/src/engine/quantum.ts +0 -207
- package/src/engine/security.ts +0 -232
- package/src/engine/tkx.ts +0 -1084
- package/src/engine/wcag.ts +0 -276
- package/src/headless/index.ts +0 -52
- package/src/headless/useControllable.ts +0 -42
- package/src/headless/useDebounce.ts +0 -37
- package/src/headless/useDisclosure.ts +0 -30
- package/src/headless/useFormState.ts +0 -113
- package/src/headless/useInfiniteQuery.ts +0 -155
- package/src/headless/useIntersectionObserver.ts +0 -53
- package/src/headless/useListSelection.ts +0 -103
- package/src/headless/useLocalStorage.ts +0 -48
- package/src/headless/useMediaQuery.ts +0 -39
- package/src/headless/useRovingTabIndex.ts +0 -86
- package/src/headless/useSSE.ts +0 -167
- package/src/headless/useThrottle.ts +0 -48
- package/src/headless/useWebSocket.ts +0 -231
- package/src/hooks/index.ts +0 -122
- package/src/i18n/I18nProvider.tsx +0 -36
- package/src/i18n/index.ts +0 -877
- package/src/quantum/index.ts +0 -39
- package/src/realtime/index.ts +0 -21
- package/src/styles/global.css +0 -167
- package/src/themes/index.ts +0 -294
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
useRef,
|
|
5
|
-
useCallback,
|
|
6
|
-
type ReactNode,
|
|
7
|
-
type CSSProperties,
|
|
8
|
-
type KeyboardEvent,
|
|
9
|
-
} from 'react';
|
|
10
|
-
import { useTheme } from '../themes';
|
|
11
|
-
import { sanitizeString } from '../engine/security';
|
|
12
|
-
import { useReducedMotion } from '../hooks';
|
|
13
|
-
import { tkx } from '../engine/tkx';
|
|
14
|
-
|
|
15
|
-
// ── Types ─────────────────────────────────────────────────────────────────────
|
|
16
|
-
|
|
17
|
-
export interface ToolbarItem {
|
|
18
|
-
id: string;
|
|
19
|
-
icon?: ReactNode;
|
|
20
|
-
label: string;
|
|
21
|
-
onClick?: () => void;
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
active?: boolean;
|
|
24
|
-
type?: 'button' | 'separator' | 'toggle';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface TkxToolbarProps {
|
|
28
|
-
items: ToolbarItem[];
|
|
29
|
-
orientation?: 'horizontal' | 'vertical';
|
|
30
|
-
size?: 'sm' | 'md' | 'lg';
|
|
31
|
-
variant?: 'default' | 'outlined' | 'filled';
|
|
32
|
-
ariaLabel?: string;
|
|
33
|
-
className?: string;
|
|
34
|
-
style?: CSSProperties;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ── Size map ────────────────────────────────────────────────────────────────
|
|
38
|
-
|
|
39
|
-
interface SizeConfig {
|
|
40
|
-
buttonPx: number;
|
|
41
|
-
buttonPy: number;
|
|
42
|
-
fontSize: number;
|
|
43
|
-
iconSize: number;
|
|
44
|
-
gap: number;
|
|
45
|
-
separatorSize: number;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const SIZE_MAP: Record<'sm' | 'md' | 'lg', SizeConfig> = {
|
|
49
|
-
sm: { buttonPx: 6, buttonPy: 4, fontSize: 12, iconSize: 14, gap: 2, separatorSize: 16 },
|
|
50
|
-
md: { buttonPx: 8, buttonPy: 6, fontSize: 13, iconSize: 16, gap: 4, separatorSize: 20 },
|
|
51
|
-
lg: { buttonPx: 12, buttonPy: 8, fontSize: 14, iconSize: 18, gap: 6, separatorSize: 24 },
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// ── Component ───────────────────────────────────────────────────────────────
|
|
55
|
-
|
|
56
|
-
export function TkxToolbar({
|
|
57
|
-
items,
|
|
58
|
-
orientation = 'horizontal',
|
|
59
|
-
size = 'md',
|
|
60
|
-
variant = 'default',
|
|
61
|
-
ariaLabel = 'Toolbar',
|
|
62
|
-
className,
|
|
63
|
-
style,
|
|
64
|
-
}: TkxToolbarProps) {
|
|
65
|
-
const theme = useTheme();
|
|
66
|
-
const reducedMotion = useReducedMotion();
|
|
67
|
-
const sizeConfig = SIZE_MAP[size];
|
|
68
|
-
const isHorizontal = orientation === 'horizontal';
|
|
69
|
-
|
|
70
|
-
const itemRefs = useRef<Map<string, HTMLElement>>(new Map());
|
|
71
|
-
|
|
72
|
-
// Collect focusable (non-separator, non-disabled) item ids
|
|
73
|
-
const focusableIds = items
|
|
74
|
-
.filter((item) => item.type !== 'separator' && !item.disabled)
|
|
75
|
-
.map((item) => item.id);
|
|
76
|
-
|
|
77
|
-
const focusItem = useCallback((id: string) => {
|
|
78
|
-
itemRefs.current.get(id)?.focus();
|
|
79
|
-
}, []);
|
|
80
|
-
|
|
81
|
-
// Roving tabindex keyboard handling
|
|
82
|
-
const handleKeyDown = useCallback(
|
|
83
|
-
(e: KeyboardEvent<HTMLElement>, itemId: string) => {
|
|
84
|
-
const currentIdx = focusableIds.indexOf(itemId);
|
|
85
|
-
if (currentIdx < 0) return;
|
|
86
|
-
|
|
87
|
-
const nextKey = isHorizontal ? 'ArrowRight' : 'ArrowDown';
|
|
88
|
-
const prevKey = isHorizontal ? 'ArrowLeft' : 'ArrowUp';
|
|
89
|
-
|
|
90
|
-
switch (e.key) {
|
|
91
|
-
case nextKey: {
|
|
92
|
-
e.preventDefault();
|
|
93
|
-
const next = currentIdx + 1 < focusableIds.length ? currentIdx + 1 : 0;
|
|
94
|
-
focusItem(focusableIds[next]);
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
case prevKey: {
|
|
98
|
-
e.preventDefault();
|
|
99
|
-
const prev = currentIdx - 1 >= 0 ? currentIdx - 1 : focusableIds.length - 1;
|
|
100
|
-
focusItem(focusableIds[prev]);
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
case 'Home': {
|
|
104
|
-
e.preventDefault();
|
|
105
|
-
focusItem(focusableIds[0]);
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
case 'End': {
|
|
109
|
-
e.preventDefault();
|
|
110
|
-
focusItem(focusableIds[focusableIds.length - 1]);
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
[focusableIds, focusItem, isHorizontal],
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
// Variant styles for the toolbar container
|
|
119
|
-
const containerVariantStyle = (): CSSProperties => {
|
|
120
|
-
switch (variant) {
|
|
121
|
-
case 'outlined':
|
|
122
|
-
return {
|
|
123
|
-
backgroundColor: 'transparent',
|
|
124
|
-
border: `1px solid ${theme.border}`,
|
|
125
|
-
};
|
|
126
|
-
case 'filled':
|
|
127
|
-
return {
|
|
128
|
-
backgroundColor: theme.surfaceAlt,
|
|
129
|
-
border: 'none',
|
|
130
|
-
};
|
|
131
|
-
default:
|
|
132
|
-
return {
|
|
133
|
-
backgroundColor: theme.surface,
|
|
134
|
-
border: `1px solid ${theme.border}`,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const getButtonStyle = (item: ToolbarItem): CSSProperties => {
|
|
140
|
-
const isToggle = item.type === 'toggle';
|
|
141
|
-
const isActive = item.active;
|
|
142
|
-
|
|
143
|
-
const base: CSSProperties = {
|
|
144
|
-
display: 'inline-flex',
|
|
145
|
-
alignItems: 'center',
|
|
146
|
-
justifyContent: 'center',
|
|
147
|
-
gap: 4,
|
|
148
|
-
padding: `${sizeConfig.buttonPy}px ${sizeConfig.buttonPx}px`,
|
|
149
|
-
fontSize: sizeConfig.fontSize,
|
|
150
|
-
borderRadius: 6,
|
|
151
|
-
border: 'none',
|
|
152
|
-
cursor: item.disabled ? 'not-allowed' : 'pointer',
|
|
153
|
-
backgroundColor: isActive ? `${theme.primary}20` : 'transparent',
|
|
154
|
-
color: isActive ? theme.primary : item.disabled ? theme.textMuted : theme.text,
|
|
155
|
-
opacity: item.disabled ? 0.5 : 1,
|
|
156
|
-
outline: 'none',
|
|
157
|
-
transition: reducedMotion ? 'none' : 'all 100ms ease',
|
|
158
|
-
whiteSpace: 'nowrap',
|
|
159
|
-
lineHeight: 1,
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
return base;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return (
|
|
166
|
-
<div
|
|
167
|
-
role="toolbar"
|
|
168
|
-
aria-label={ariaLabel}
|
|
169
|
-
aria-orientation={orientation}
|
|
170
|
-
className={tkx(
|
|
171
|
-
'inline-flex items-center rounded-lg font-sans',
|
|
172
|
-
isHorizontal ? 'flex-row' : 'flex-col',
|
|
173
|
-
className ?? '',
|
|
174
|
-
)}
|
|
175
|
-
style={{
|
|
176
|
-
...containerVariantStyle(),
|
|
177
|
-
padding: sizeConfig.gap,
|
|
178
|
-
gap: sizeConfig.gap,
|
|
179
|
-
...style,
|
|
180
|
-
}}
|
|
181
|
-
>
|
|
182
|
-
{items.map((item, idx) => {
|
|
183
|
-
// Separator
|
|
184
|
-
if (item.type === 'separator') {
|
|
185
|
-
return (
|
|
186
|
-
<div
|
|
187
|
-
key={item.id}
|
|
188
|
-
role="separator"
|
|
189
|
-
aria-orientation={isHorizontal ? 'vertical' : 'horizontal'}
|
|
190
|
-
className={tkx('flex-shrink-0')}
|
|
191
|
-
style={{
|
|
192
|
-
...(isHorizontal
|
|
193
|
-
? { width: 1, height: sizeConfig.separatorSize, marginLeft: 2, marginRight: 2 }
|
|
194
|
-
: { height: 1, width: sizeConfig.separatorSize, marginTop: 2, marginBottom: 2 }),
|
|
195
|
-
backgroundColor: theme.border,
|
|
196
|
-
}}
|
|
197
|
-
/>
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const safeLabel = sanitizeString(item.label);
|
|
202
|
-
const isFocusable = !item.disabled;
|
|
203
|
-
const isFirstFocusable = focusableIds[0] === item.id;
|
|
204
|
-
|
|
205
|
-
return (
|
|
206
|
-
<button
|
|
207
|
-
key={item.id}
|
|
208
|
-
ref={(el) => {
|
|
209
|
-
if (el) itemRefs.current.set(item.id, el);
|
|
210
|
-
else itemRefs.current.delete(item.id);
|
|
211
|
-
}}
|
|
212
|
-
type="button"
|
|
213
|
-
role={item.type === 'toggle' ? undefined : undefined}
|
|
214
|
-
aria-pressed={item.type === 'toggle' ? item.active : undefined}
|
|
215
|
-
aria-label={safeLabel}
|
|
216
|
-
aria-disabled={item.disabled || undefined}
|
|
217
|
-
tabIndex={isFocusable && isFirstFocusable ? 0 : -1}
|
|
218
|
-
disabled={item.disabled}
|
|
219
|
-
onClick={() => {
|
|
220
|
-
if (!item.disabled) item.onClick?.();
|
|
221
|
-
}}
|
|
222
|
-
onKeyDown={(e) => {
|
|
223
|
-
handleKeyDown(e, item.id);
|
|
224
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
225
|
-
e.preventDefault();
|
|
226
|
-
if (!item.disabled) item.onClick?.();
|
|
227
|
-
}
|
|
228
|
-
}}
|
|
229
|
-
className={tkx(
|
|
230
|
-
'focus-visible:ring-2 focus-visible:ring-offset-1',
|
|
231
|
-
)}
|
|
232
|
-
style={getButtonStyle(item)}
|
|
233
|
-
onMouseEnter={(e) => {
|
|
234
|
-
if (!item.disabled && !item.active) {
|
|
235
|
-
(e.currentTarget as HTMLElement).style.backgroundColor = theme.surfaceAlt;
|
|
236
|
-
}
|
|
237
|
-
}}
|
|
238
|
-
onMouseLeave={(e) => {
|
|
239
|
-
if (!item.disabled) {
|
|
240
|
-
(e.currentTarget as HTMLElement).style.backgroundColor = item.active
|
|
241
|
-
? `${theme.primary}20`
|
|
242
|
-
: 'transparent';
|
|
243
|
-
}
|
|
244
|
-
}}
|
|
245
|
-
>
|
|
246
|
-
{item.icon && (
|
|
247
|
-
<span
|
|
248
|
-
aria-hidden="true"
|
|
249
|
-
style={{ width: sizeConfig.iconSize, height: sizeConfig.iconSize, display: 'flex', alignItems: 'center', justifyContent: 'center' }}
|
|
250
|
-
>
|
|
251
|
-
{item.icon}
|
|
252
|
-
</span>
|
|
253
|
-
)}
|
|
254
|
-
{!item.icon && safeLabel}
|
|
255
|
-
</button>
|
|
256
|
-
);
|
|
257
|
-
})}
|
|
258
|
-
</div>
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export default TkxToolbar;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useState, useRef, useId, useEffect, type ReactElement, cloneElement } from 'react';
|
|
4
|
-
import { useTheme } from '../themes';
|
|
5
|
-
import { sanitizeString } from '../engine/security';
|
|
6
|
-
import { useEscapeKey, useClickOutside, useReducedMotion } from '../hooks';
|
|
7
|
-
import { getAccessibleForeground } from '../engine/wcag';
|
|
8
|
-
import { tkx } from '../engine/tkx';
|
|
9
|
-
|
|
10
|
-
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
11
|
-
|
|
12
|
-
export interface TkxTooltipProps {
|
|
13
|
-
content: string;
|
|
14
|
-
children: ReactElement;
|
|
15
|
-
placement?: TooltipPlacement;
|
|
16
|
-
delay?: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const PLACEMENT_STYLE: Record<TooltipPlacement, React.CSSProperties> = {
|
|
20
|
-
top: { bottom: '100%', left: '50%', transform: 'translateX(-50%)', marginBottom: 6 },
|
|
21
|
-
bottom: { top: '100%', left: '50%', transform: 'translateX(-50%)', marginTop: 6 },
|
|
22
|
-
left: { right: '100%', top: '50%', transform: 'translateY(-50%)', marginRight: 6 },
|
|
23
|
-
right: { left: '100%', top: '50%', transform: 'translateY(-50%)', marginLeft: 6 },
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export function TkxTooltip({ content, children, placement = 'top', delay = 300 }: TkxTooltipProps) {
|
|
27
|
-
const theme = useTheme();
|
|
28
|
-
const [visible, setVisible] = useState(false);
|
|
29
|
-
const wrapperRef = useRef<HTMLSpanElement>(null);
|
|
30
|
-
const tooltipId = useId();
|
|
31
|
-
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
32
|
-
const reducedMotion = useReducedMotion();
|
|
33
|
-
const safeContent = sanitizeString(content);
|
|
34
|
-
const textColor = getAccessibleForeground(theme.surfaceAlt, [theme.text, '#ffffff', '#000000']);
|
|
35
|
-
|
|
36
|
-
function show() { timerRef.current = setTimeout(() => setVisible(true), delay); }
|
|
37
|
-
function hide() { if (timerRef.current) clearTimeout(timerRef.current); setVisible(false); }
|
|
38
|
-
|
|
39
|
-
useEscapeKey(hide, visible);
|
|
40
|
-
useClickOutside(wrapperRef, hide);
|
|
41
|
-
|
|
42
|
-
// Clear any pending show-timer on unmount to avoid
|
|
43
|
-
// setState-after-unmount warnings during fast navigation.
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
return () => {
|
|
46
|
-
if (timerRef.current) {
|
|
47
|
-
clearTimeout(timerRef.current);
|
|
48
|
-
timerRef.current = null;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}, []);
|
|
52
|
-
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
-
const child = children as ReactElement<any>;
|
|
55
|
-
const trigger = cloneElement(child, {
|
|
56
|
-
'aria-describedby': visible ? tooltipId : undefined,
|
|
57
|
-
onMouseEnter: (e: React.MouseEvent) => { child.props.onMouseEnter?.(e); show(); },
|
|
58
|
-
onMouseLeave: (e: React.MouseEvent) => { child.props.onMouseLeave?.(e); hide(); },
|
|
59
|
-
onFocus: (e: React.FocusEvent) => { child.props.onFocus?.(e); show(); },
|
|
60
|
-
onBlur: (e: React.FocusEvent) => { child.props.onBlur?.(e); hide(); },
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<span ref={wrapperRef} className={tkx('relative inline-flex')}>
|
|
65
|
-
{trigger}
|
|
66
|
-
{visible && (
|
|
67
|
-
<span
|
|
68
|
-
id={tooltipId}
|
|
69
|
-
role="tooltip"
|
|
70
|
-
className={tkx('absolute z-[9000] text-xs font-sans py-1.5 px-2.5 rounded-md whitespace-nowrap pointer-events-none', !reducedMotion && 'animate-fade-in')}
|
|
71
|
-
style={{
|
|
72
|
-
backgroundColor: theme.surfaceAlt,
|
|
73
|
-
color: textColor,
|
|
74
|
-
border: `1px solid ${theme.border}`,
|
|
75
|
-
boxShadow: `0 4px 12px ${theme.bg}40`,
|
|
76
|
-
maxWidth: 280,
|
|
77
|
-
...PLACEMENT_STYLE[placement],
|
|
78
|
-
}}
|
|
79
|
-
>
|
|
80
|
-
{safeContent}
|
|
81
|
-
</span>
|
|
82
|
-
)}
|
|
83
|
-
</span>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useState, useEffect, useCallback, useRef, type ReactNode } from 'react';
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
5
|
-
import { useTheme } from '../themes';
|
|
6
|
-
import { sanitizeString } from '../engine/security';
|
|
7
|
-
import { useReducedMotion } from '../hooks';
|
|
8
|
-
import { tkx } from '../engine/tkx';
|
|
9
|
-
|
|
10
|
-
// ── Types ────────────────────────────────────────────────────────────────────
|
|
11
|
-
|
|
12
|
-
export interface TourStep {
|
|
13
|
-
target: string;
|
|
14
|
-
title: string;
|
|
15
|
-
description: string;
|
|
16
|
-
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface TkxTourProps {
|
|
20
|
-
steps: TourStep[];
|
|
21
|
-
isOpen?: boolean;
|
|
22
|
-
onClose?: () => void;
|
|
23
|
-
current?: number;
|
|
24
|
-
onChange?: (step: number) => void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
28
|
-
|
|
29
|
-
function getRect(selector: string): DOMRect | null {
|
|
30
|
-
const el = document.querySelector(selector);
|
|
31
|
-
return el ? el.getBoundingClientRect() : null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface PopoverPos {
|
|
35
|
-
top: number;
|
|
36
|
-
left: number;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function computePosition(
|
|
40
|
-
rect: DOMRect,
|
|
41
|
-
placement: string,
|
|
42
|
-
tipW: number,
|
|
43
|
-
tipH: number,
|
|
44
|
-
): PopoverPos {
|
|
45
|
-
const gap = 12;
|
|
46
|
-
switch (placement) {
|
|
47
|
-
case 'top':
|
|
48
|
-
return { top: rect.top - tipH - gap + window.scrollY, left: rect.left + rect.width / 2 - tipW / 2 + window.scrollX };
|
|
49
|
-
case 'bottom':
|
|
50
|
-
return { top: rect.bottom + gap + window.scrollY, left: rect.left + rect.width / 2 - tipW / 2 + window.scrollX };
|
|
51
|
-
case 'left':
|
|
52
|
-
return { top: rect.top + rect.height / 2 - tipH / 2 + window.scrollY, left: rect.left - tipW - gap + window.scrollX };
|
|
53
|
-
case 'right':
|
|
54
|
-
return { top: rect.top + rect.height / 2 - tipH / 2 + window.scrollY, left: rect.right + gap + window.scrollX };
|
|
55
|
-
default:
|
|
56
|
-
return { top: rect.bottom + gap + window.scrollY, left: rect.left + window.scrollX };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// ── Component ────────────────────────────────────────────────────────────────
|
|
61
|
-
|
|
62
|
-
export function TkxTour({
|
|
63
|
-
steps,
|
|
64
|
-
isOpen = false,
|
|
65
|
-
onClose,
|
|
66
|
-
current: controlledCurrent,
|
|
67
|
-
onChange,
|
|
68
|
-
}: TkxTourProps) {
|
|
69
|
-
const theme = useTheme();
|
|
70
|
-
const reducedMotion = useReducedMotion();
|
|
71
|
-
const [internal, setInternal] = useState(0);
|
|
72
|
-
const current = controlledCurrent ?? internal;
|
|
73
|
-
const tipRef = useRef<HTMLDivElement>(null);
|
|
74
|
-
const [pos, setPos] = useState<PopoverPos>({ top: 0, left: 0 });
|
|
75
|
-
const [targetRect, setTargetRect] = useState<DOMRect | null>(null);
|
|
76
|
-
|
|
77
|
-
const step = steps[current];
|
|
78
|
-
|
|
79
|
-
const updatePosition = useCallback(() => {
|
|
80
|
-
if (!step) return;
|
|
81
|
-
const rect = getRect(step.target);
|
|
82
|
-
setTargetRect(rect);
|
|
83
|
-
if (rect && tipRef.current) {
|
|
84
|
-
const tipW = tipRef.current.offsetWidth;
|
|
85
|
-
const tipH = tipRef.current.offsetHeight;
|
|
86
|
-
setPos(computePosition(rect, step.placement ?? 'bottom', tipW, tipH));
|
|
87
|
-
}
|
|
88
|
-
}, [step]);
|
|
89
|
-
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
if (!isOpen) return;
|
|
92
|
-
updatePosition();
|
|
93
|
-
window.addEventListener('resize', updatePosition);
|
|
94
|
-
window.addEventListener('scroll', updatePosition, true);
|
|
95
|
-
return () => {
|
|
96
|
-
window.removeEventListener('resize', updatePosition);
|
|
97
|
-
window.removeEventListener('scroll', updatePosition, true);
|
|
98
|
-
};
|
|
99
|
-
}, [isOpen, current, updatePosition]);
|
|
100
|
-
|
|
101
|
-
// Focus trap: refocus popover on step change
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
if (isOpen) tipRef.current?.focus();
|
|
104
|
-
}, [isOpen, current]);
|
|
105
|
-
|
|
106
|
-
const goTo = useCallback(
|
|
107
|
-
(idx: number) => {
|
|
108
|
-
setInternal(idx);
|
|
109
|
-
onChange?.(idx);
|
|
110
|
-
},
|
|
111
|
-
[onChange],
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
const handleNext = useCallback(() => {
|
|
115
|
-
if (current < steps.length - 1) goTo(current + 1);
|
|
116
|
-
else onClose?.();
|
|
117
|
-
}, [current, steps.length, goTo, onClose]);
|
|
118
|
-
|
|
119
|
-
const handlePrev = useCallback(() => {
|
|
120
|
-
if (current > 0) goTo(current - 1);
|
|
121
|
-
}, [current, goTo]);
|
|
122
|
-
|
|
123
|
-
if (!isOpen || !step) return null;
|
|
124
|
-
|
|
125
|
-
const pad = 6;
|
|
126
|
-
const safeTitle = sanitizeString(step.title);
|
|
127
|
-
const safeDesc = sanitizeString(step.description);
|
|
128
|
-
const TIP_W = 300;
|
|
129
|
-
|
|
130
|
-
const overlay = (
|
|
131
|
-
<div aria-hidden="true">
|
|
132
|
-
{/* Dimming overlay with spotlight cutout via CSS clip-path */}
|
|
133
|
-
<div
|
|
134
|
-
style={{
|
|
135
|
-
position: 'fixed',
|
|
136
|
-
inset: 0,
|
|
137
|
-
zIndex: 9998,
|
|
138
|
-
backgroundColor: 'rgba(0,0,0,0.55)',
|
|
139
|
-
clipPath: targetRect
|
|
140
|
-
? `polygon(0% 0%, 0% 100%, ${targetRect.left - pad}px 100%, ${targetRect.left - pad}px ${targetRect.top - pad}px, ${targetRect.right + pad}px ${targetRect.top - pad}px, ${targetRect.right + pad}px ${targetRect.bottom + pad}px, ${targetRect.left - pad}px ${targetRect.bottom + pad}px, ${targetRect.left - pad}px 100%, 100% 100%, 100% 0%)`
|
|
141
|
-
: undefined,
|
|
142
|
-
transition: reducedMotion ? 'none' : 'clip-path 0.25s ease',
|
|
143
|
-
}}
|
|
144
|
-
onClick={onClose}
|
|
145
|
-
/>
|
|
146
|
-
|
|
147
|
-
{/* Popover */}
|
|
148
|
-
<div
|
|
149
|
-
ref={tipRef}
|
|
150
|
-
role="dialog"
|
|
151
|
-
aria-modal="true"
|
|
152
|
-
aria-label={`Tour step ${current + 1} of ${steps.length}`}
|
|
153
|
-
tabIndex={-1}
|
|
154
|
-
style={{
|
|
155
|
-
position: 'absolute',
|
|
156
|
-
zIndex: 9999,
|
|
157
|
-
top: pos.top,
|
|
158
|
-
left: pos.left,
|
|
159
|
-
width: TIP_W,
|
|
160
|
-
backgroundColor: theme.surface,
|
|
161
|
-
border: `1px solid ${theme.border}`,
|
|
162
|
-
borderRadius: 10,
|
|
163
|
-
padding: 20,
|
|
164
|
-
boxShadow: `0 8px 24px ${theme.bg}80`,
|
|
165
|
-
animation: reducedMotion ? 'none' : 'tkxFadeIn 0.2s ease',
|
|
166
|
-
fontFamily: 'inherit',
|
|
167
|
-
}}
|
|
168
|
-
onKeyDown={(e) => {
|
|
169
|
-
if (e.key === 'Escape') onClose?.();
|
|
170
|
-
}}
|
|
171
|
-
>
|
|
172
|
-
<h3
|
|
173
|
-
className={tkx('m-0 mb-2 text-base font-semibold')}
|
|
174
|
-
style={{ color: theme.text }}
|
|
175
|
-
>
|
|
176
|
-
{safeTitle}
|
|
177
|
-
</h3>
|
|
178
|
-
<p
|
|
179
|
-
className={tkx('m-0 mb-4 text-sm leading-relaxed')}
|
|
180
|
-
style={{ color: theme.textMuted }}
|
|
181
|
-
>
|
|
182
|
-
{safeDesc}
|
|
183
|
-
</p>
|
|
184
|
-
|
|
185
|
-
{/* Step dots */}
|
|
186
|
-
<div className={tkx('flex items-center gap-1 mb-4')} aria-label="Tour progress">
|
|
187
|
-
{steps.map((_, i) => (
|
|
188
|
-
<span
|
|
189
|
-
key={i}
|
|
190
|
-
aria-hidden="true"
|
|
191
|
-
style={{
|
|
192
|
-
width: 8,
|
|
193
|
-
height: 8,
|
|
194
|
-
borderRadius: '50%',
|
|
195
|
-
backgroundColor: i === current ? theme.primary : theme.border,
|
|
196
|
-
transition: reducedMotion ? 'none' : 'background-color 0.2s',
|
|
197
|
-
}}
|
|
198
|
-
/>
|
|
199
|
-
))}
|
|
200
|
-
</div>
|
|
201
|
-
|
|
202
|
-
{/* Navigation */}
|
|
203
|
-
<div className={tkx('flex items-center justify-between gap-2')}>
|
|
204
|
-
<button
|
|
205
|
-
type="button"
|
|
206
|
-
aria-label="Skip tour"
|
|
207
|
-
onClick={onClose}
|
|
208
|
-
className={tkx('border-0 bg-transparent cursor-pointer text-sm px-2 py-1')}
|
|
209
|
-
style={{ color: theme.textMuted }}
|
|
210
|
-
>
|
|
211
|
-
Skip
|
|
212
|
-
</button>
|
|
213
|
-
<div className={tkx('flex gap-2')}>
|
|
214
|
-
{current > 0 && (
|
|
215
|
-
<button
|
|
216
|
-
type="button"
|
|
217
|
-
aria-label="Previous step"
|
|
218
|
-
onClick={handlePrev}
|
|
219
|
-
className={tkx('rounded-md border px-3 py-1 text-sm cursor-pointer bg-transparent')}
|
|
220
|
-
style={{ borderColor: theme.border, color: theme.text }}
|
|
221
|
-
>
|
|
222
|
-
Prev
|
|
223
|
-
</button>
|
|
224
|
-
)}
|
|
225
|
-
<button
|
|
226
|
-
type="button"
|
|
227
|
-
aria-label={current === steps.length - 1 ? 'Finish tour' : 'Next step'}
|
|
228
|
-
onClick={handleNext}
|
|
229
|
-
className={tkx('rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium')}
|
|
230
|
-
style={{ backgroundColor: theme.primary, color: '#fff' }}
|
|
231
|
-
>
|
|
232
|
-
{current === steps.length - 1 ? 'Finish' : 'Next'}
|
|
233
|
-
</button>
|
|
234
|
-
</div>
|
|
235
|
-
</div>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
return createPortal(overlay, document.body);
|
|
241
|
-
}
|