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,305 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useEffect, useRef, type ReactNode } from 'react';
|
|
4
|
-
import { useTheme } from '../themes';
|
|
5
|
-
import { tkx, cx } from '../engine/tkx';
|
|
6
|
-
import { sanitizeString } from '../engine/security';
|
|
7
|
-
import { useReducedMotion } from '../hooks';
|
|
8
|
-
|
|
9
|
-
// ── Types ─────────────────────────────────────────────────────────────────────
|
|
10
|
-
|
|
11
|
-
export type TimelineVariant = 'default' | 'compact' | 'alternating';
|
|
12
|
-
export type TimelineItemStatus = 'completed' | 'active' | 'pending' | 'error';
|
|
13
|
-
|
|
14
|
-
export interface TimelineItem {
|
|
15
|
-
id: string;
|
|
16
|
-
title: ReactNode;
|
|
17
|
-
description?: ReactNode;
|
|
18
|
-
timestamp?: string;
|
|
19
|
-
status?: TimelineItemStatus;
|
|
20
|
-
icon?: ReactNode;
|
|
21
|
-
badge?: ReactNode;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface TkxTimelineProps {
|
|
25
|
-
items: TimelineItem[];
|
|
26
|
-
variant?: TimelineVariant;
|
|
27
|
-
orientation?: 'vertical' | 'horizontal';
|
|
28
|
-
connectorStyle?: 'solid' | 'dashed' | 'dotted';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// ── Animation injection ───────────────────────────────────────────────────────
|
|
32
|
-
|
|
33
|
-
let _timelineStyleInjected = false;
|
|
34
|
-
function injectTimelineStyles() {
|
|
35
|
-
if (_timelineStyleInjected || typeof document === 'undefined') return;
|
|
36
|
-
_timelineStyleInjected = true;
|
|
37
|
-
const style = document.createElement('style');
|
|
38
|
-
style.textContent = `
|
|
39
|
-
@keyframes tkx-pulse-dot { 0%,100% { box-shadow:0 0 0 0 currentColor; opacity:1; } 70% { box-shadow:0 0 0 8px transparent; opacity:0.7; } }
|
|
40
|
-
@keyframes tkx-draw-line { from { transform:scaleY(0); transform-origin:top center; } to { transform:scaleY(1); } }
|
|
41
|
-
@keyframes tkx-draw-line-h { from { transform:scaleX(0); transform-origin:left center; } to { transform:scaleX(1); } }
|
|
42
|
-
.tkx-pulse-dot { animation: tkx-pulse-dot 1.5s ease-in-out infinite; }
|
|
43
|
-
.tkx-draw-v { animation: tkx-draw-line 0.6s ease forwards; }
|
|
44
|
-
.tkx-draw-h { animation: tkx-draw-line-h 0.6s ease forwards; }
|
|
45
|
-
`;
|
|
46
|
-
document.head.appendChild(style);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// ── Status color helper ───────────────────────────────────────────────────────
|
|
50
|
-
|
|
51
|
-
function useStatusColor(status: TimelineItemStatus = 'pending') {
|
|
52
|
-
const theme = useTheme();
|
|
53
|
-
const map: Record<TimelineItemStatus, string> = {
|
|
54
|
-
completed: theme.success,
|
|
55
|
-
active: theme.primary,
|
|
56
|
-
pending: theme.border,
|
|
57
|
-
error: theme.danger,
|
|
58
|
-
};
|
|
59
|
-
return map[status];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ── Dot component ─────────────────────────────────────────────────────────────
|
|
63
|
-
|
|
64
|
-
function TimelineDot({
|
|
65
|
-
status = 'pending',
|
|
66
|
-
icon,
|
|
67
|
-
size = 28,
|
|
68
|
-
}: {
|
|
69
|
-
status?: TimelineItemStatus;
|
|
70
|
-
icon?: ReactNode;
|
|
71
|
-
size?: number;
|
|
72
|
-
}) {
|
|
73
|
-
const theme = useTheme();
|
|
74
|
-
const reducedMotion = useReducedMotion();
|
|
75
|
-
const color = useStatusColor(status);
|
|
76
|
-
const isActive = status === 'active';
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<div
|
|
80
|
-
className={cx(
|
|
81
|
-
tkx('relative flex items-center justify-center rounded-full shrink-0 z-10'),
|
|
82
|
-
isActive && !reducedMotion ? 'tkx-pulse-dot' : '',
|
|
83
|
-
)}
|
|
84
|
-
style={{
|
|
85
|
-
width: size,
|
|
86
|
-
height: size,
|
|
87
|
-
backgroundColor: status === 'pending' ? theme.surface : color,
|
|
88
|
-
border: `2px solid ${color}`,
|
|
89
|
-
color: status === 'pending' ? color : theme.bg,
|
|
90
|
-
}}
|
|
91
|
-
aria-hidden="true"
|
|
92
|
-
>
|
|
93
|
-
{icon ? (
|
|
94
|
-
<span style={{ fontSize: size * 0.45, lineHeight: 1 }}>{icon}</span>
|
|
95
|
-
) : (
|
|
96
|
-
<span
|
|
97
|
-
style={{
|
|
98
|
-
width: size * 0.35,
|
|
99
|
-
height: size * 0.35,
|
|
100
|
-
borderRadius: '50%',
|
|
101
|
-
backgroundColor: status === 'pending' ? color : theme.bg,
|
|
102
|
-
display: 'block',
|
|
103
|
-
}}
|
|
104
|
-
/>
|
|
105
|
-
)}
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// ── Connector segment ─────────────────────────────────────────────────────────
|
|
111
|
-
|
|
112
|
-
function VerticalConnector({
|
|
113
|
-
style: lineStyle,
|
|
114
|
-
color,
|
|
115
|
-
animate,
|
|
116
|
-
}: {
|
|
117
|
-
style: 'solid' | 'dashed' | 'dotted';
|
|
118
|
-
color: string;
|
|
119
|
-
animate: boolean;
|
|
120
|
-
}) {
|
|
121
|
-
const theme = useTheme();
|
|
122
|
-
return (
|
|
123
|
-
<div
|
|
124
|
-
className={cx(tkx('w-0.5 flex-1 min-h-[24px]'), animate ? 'tkx-draw-v' : '')}
|
|
125
|
-
style={{
|
|
126
|
-
borderLeft: `2px ${lineStyle} ${color}`,
|
|
127
|
-
backgroundColor: 'transparent',
|
|
128
|
-
alignSelf: 'stretch',
|
|
129
|
-
borderColor: color,
|
|
130
|
-
marginLeft: 1,
|
|
131
|
-
}}
|
|
132
|
-
aria-hidden="true"
|
|
133
|
-
/>
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function HorizontalConnector({
|
|
138
|
-
style: lineStyle,
|
|
139
|
-
color,
|
|
140
|
-
animate,
|
|
141
|
-
}: {
|
|
142
|
-
style: 'solid' | 'dashed' | 'dotted';
|
|
143
|
-
color: string;
|
|
144
|
-
animate: boolean;
|
|
145
|
-
}) {
|
|
146
|
-
return (
|
|
147
|
-
<div
|
|
148
|
-
className={cx(tkx('h-0.5 flex-1 min-w-[24px]'), animate ? 'tkx-draw-h' : '')}
|
|
149
|
-
style={{
|
|
150
|
-
borderTop: `2px ${lineStyle} ${color}`,
|
|
151
|
-
borderColor: color,
|
|
152
|
-
}}
|
|
153
|
-
aria-hidden="true"
|
|
154
|
-
/>
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// ── Item content block ────────────────────────────────────────────────────────
|
|
159
|
-
|
|
160
|
-
function ItemContent({
|
|
161
|
-
item,
|
|
162
|
-
compact,
|
|
163
|
-
}: {
|
|
164
|
-
item: TimelineItem;
|
|
165
|
-
compact: boolean;
|
|
166
|
-
}) {
|
|
167
|
-
const theme = useTheme();
|
|
168
|
-
const safeTimestamp = item.timestamp ? sanitizeString(item.timestamp) : null;
|
|
169
|
-
|
|
170
|
-
return (
|
|
171
|
-
<div className={tkx('flex flex-col gap-0.5', compact ? 'pb-3' : 'pb-5')}>
|
|
172
|
-
<div className={tkx('flex items-center gap-2 flex-wrap')}>
|
|
173
|
-
<span
|
|
174
|
-
className={tkx('text-sm font-semibold leading-snug')}
|
|
175
|
-
style={{ color: theme.text }}
|
|
176
|
-
>
|
|
177
|
-
{typeof item.title === 'string' ? sanitizeString(item.title) : item.title}
|
|
178
|
-
</span>
|
|
179
|
-
{item.badge && (
|
|
180
|
-
<span>{item.badge}</span>
|
|
181
|
-
)}
|
|
182
|
-
{safeTimestamp && (
|
|
183
|
-
<span className={tkx('text-[11px] ml-auto')} style={{ color: theme.textMuted }}>
|
|
184
|
-
{safeTimestamp}
|
|
185
|
-
</span>
|
|
186
|
-
)}
|
|
187
|
-
</div>
|
|
188
|
-
{item.description && !compact && (
|
|
189
|
-
<div className={tkx('text-xs leading-relaxed mt-0.5')} style={{ color: theme.textMuted }}>
|
|
190
|
-
{typeof item.description === 'string' ? sanitizeString(item.description) : item.description}
|
|
191
|
-
</div>
|
|
192
|
-
)}
|
|
193
|
-
</div>
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// ── Main TkxTimeline ──────────────────────────────────────────────────────────
|
|
198
|
-
|
|
199
|
-
export function TkxTimeline({
|
|
200
|
-
items,
|
|
201
|
-
variant = 'default',
|
|
202
|
-
orientation = 'vertical',
|
|
203
|
-
connectorStyle = 'solid',
|
|
204
|
-
}: TkxTimelineProps) {
|
|
205
|
-
const theme = useTheme();
|
|
206
|
-
const reducedMotion = useReducedMotion();
|
|
207
|
-
const mounted = useRef(false);
|
|
208
|
-
|
|
209
|
-
useEffect(() => {
|
|
210
|
-
injectTimelineStyles();
|
|
211
|
-
mounted.current = true;
|
|
212
|
-
}, []);
|
|
213
|
-
|
|
214
|
-
const animate = !reducedMotion;
|
|
215
|
-
const isCompact = variant === 'compact';
|
|
216
|
-
const isAlternating = variant === 'alternating' && orientation === 'vertical';
|
|
217
|
-
const isHorizontal = orientation === 'horizontal';
|
|
218
|
-
|
|
219
|
-
if (isHorizontal) {
|
|
220
|
-
return (
|
|
221
|
-
<div role="list" aria-label="Timeline" className={tkx('flex items-start w-full overflow-x-auto')}>
|
|
222
|
-
{items.map((item, idx) => {
|
|
223
|
-
const status = item.status ?? 'pending';
|
|
224
|
-
const connColor = status === 'completed' ? theme.success : theme.border;
|
|
225
|
-
const isLast = idx === items.length - 1;
|
|
226
|
-
|
|
227
|
-
return (
|
|
228
|
-
<div key={item.id} role="listitem" className={tkx('flex items-start flex-1 min-w-0')}>
|
|
229
|
-
<div className={tkx('flex flex-col items-center flex-1 min-w-0')}>
|
|
230
|
-
<div className={tkx('flex items-center w-full')}>
|
|
231
|
-
{idx > 0 && (
|
|
232
|
-
<HorizontalConnector style={connectorStyle} color={connColor} animate={animate} />
|
|
233
|
-
)}
|
|
234
|
-
<TimelineDot status={status} icon={item.icon} size={24} />
|
|
235
|
-
{!isLast && (
|
|
236
|
-
<HorizontalConnector style={connectorStyle} color={connColor} animate={animate} />
|
|
237
|
-
)}
|
|
238
|
-
</div>
|
|
239
|
-
<div className={tkx('mt-2 px-1 text-center min-w-0 w-full')}>
|
|
240
|
-
<div className={tkx('text-xs font-semibold truncate')} style={{ color: theme.text }}>
|
|
241
|
-
{typeof item.title === 'string' ? sanitizeString(item.title) : item.title}
|
|
242
|
-
</div>
|
|
243
|
-
{item.timestamp && (
|
|
244
|
-
<div className={tkx('text-[10px] mt-0.5')} style={{ color: theme.textMuted }}>
|
|
245
|
-
{sanitizeString(item.timestamp)}
|
|
246
|
-
</div>
|
|
247
|
-
)}
|
|
248
|
-
</div>
|
|
249
|
-
</div>
|
|
250
|
-
</div>
|
|
251
|
-
);
|
|
252
|
-
})}
|
|
253
|
-
</div>
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// Vertical layouts
|
|
258
|
-
return (
|
|
259
|
-
<div role="list" aria-label="Timeline" className={tkx('flex flex-col')}>
|
|
260
|
-
{items.map((item, idx) => {
|
|
261
|
-
const status = item.status ?? 'pending';
|
|
262
|
-
const isLast = idx === items.length - 1;
|
|
263
|
-
const connColor = status === 'completed' ? theme.success : theme.border;
|
|
264
|
-
const isRight = isAlternating && idx % 2 === 0;
|
|
265
|
-
|
|
266
|
-
if (isAlternating) {
|
|
267
|
-
return (
|
|
268
|
-
<div key={item.id} role="listitem" className={tkx('flex items-stretch gap-0')}>
|
|
269
|
-
{/* Left content (even indexes) */}
|
|
270
|
-
<div className={tkx('flex-1 flex flex-col items-end pr-4', !isRight ? 'invisible' : '')}>
|
|
271
|
-
{isRight && <ItemContent item={item} compact={isCompact} />}
|
|
272
|
-
</div>
|
|
273
|
-
{/* Center axis */}
|
|
274
|
-
<div className={tkx('flex flex-col items-center')}>
|
|
275
|
-
<TimelineDot status={status} icon={item.icon} size={28} />
|
|
276
|
-
{!isLast && (
|
|
277
|
-
<VerticalConnector style={connectorStyle} color={connColor} animate={animate} />
|
|
278
|
-
)}
|
|
279
|
-
</div>
|
|
280
|
-
{/* Right content (odd indexes) */}
|
|
281
|
-
<div className={tkx('flex-1 flex flex-col items-start pl-4', isRight ? 'invisible' : '')}>
|
|
282
|
-
{!isRight && <ItemContent item={item} compact={isCompact} />}
|
|
283
|
-
</div>
|
|
284
|
-
</div>
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// Default / compact — left-side connector
|
|
289
|
-
return (
|
|
290
|
-
<div key={item.id} role="listitem" className={tkx('flex gap-3 items-stretch')}>
|
|
291
|
-
<div className={tkx('flex flex-col items-center')}>
|
|
292
|
-
<TimelineDot status={status} icon={item.icon} size={isCompact ? 22 : 28} />
|
|
293
|
-
{!isLast && (
|
|
294
|
-
<VerticalConnector style={connectorStyle} color={connColor} animate={animate} />
|
|
295
|
-
)}
|
|
296
|
-
</div>
|
|
297
|
-
<div className={tkx('flex-1 min-w-0 pt-0.5')}>
|
|
298
|
-
<ItemContent item={item} compact={isCompact} />
|
|
299
|
-
</div>
|
|
300
|
-
</div>
|
|
301
|
-
);
|
|
302
|
-
})}
|
|
303
|
-
</div>
|
|
304
|
-
);
|
|
305
|
-
}
|
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
useState,
|
|
5
|
-
useEffect,
|
|
6
|
-
useCallback,
|
|
7
|
-
useRef,
|
|
8
|
-
useId,
|
|
9
|
-
type ReactNode,
|
|
10
|
-
} from 'react';
|
|
11
|
-
import { createPortal } from 'react-dom';
|
|
12
|
-
import { useTheme } from '../themes';
|
|
13
|
-
import { sanitizeString } from '../engine/security';
|
|
14
|
-
import { useReducedMotion } from '../hooks';
|
|
15
|
-
import { tkx } from '../engine/tkx';
|
|
16
|
-
|
|
17
|
-
// ── Types ─────────────────────────────────────────────────────────────────────
|
|
18
|
-
|
|
19
|
-
export type ToastVariant = 'default' | 'success' | 'danger' | 'warning' | 'info';
|
|
20
|
-
export type ToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
|
|
21
|
-
|
|
22
|
-
export interface ToastItem {
|
|
23
|
-
id: string;
|
|
24
|
-
title?: string;
|
|
25
|
-
description?: string;
|
|
26
|
-
variant?: ToastVariant;
|
|
27
|
-
duration?: number;
|
|
28
|
-
action?: { label: string; onClick: () => void };
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface TkxToastProps {
|
|
32
|
-
position?: ToastPosition;
|
|
33
|
-
children?: React.ReactNode;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// ── Module-level store ────────────────────────────────────────────────────────
|
|
37
|
-
|
|
38
|
-
type Listener = (toasts: ToastItem[]) => void;
|
|
39
|
-
|
|
40
|
-
const MAX_VISIBLE = 5;
|
|
41
|
-
let queue: ToastItem[] = [];
|
|
42
|
-
let visible: ToastItem[] = [];
|
|
43
|
-
const listeners = new Set<Listener>();
|
|
44
|
-
const timers = new Map<string, ReturnType<typeof setTimeout>>();
|
|
45
|
-
|
|
46
|
-
function notify() {
|
|
47
|
-
const snapshot = [...visible];
|
|
48
|
-
listeners.forEach((fn) => fn(snapshot));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function scheduleRemove(id: string, duration: number) {
|
|
52
|
-
if (duration === 0) return;
|
|
53
|
-
timers.set(id, setTimeout(() => removeToast(id), duration));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function removeToast(id: string) {
|
|
57
|
-
clearTimeout(timers.get(id));
|
|
58
|
-
timers.delete(id);
|
|
59
|
-
const wasVisible = visible.some((t) => t.id === id);
|
|
60
|
-
visible = visible.filter((t) => t.id !== id);
|
|
61
|
-
queue = queue.filter((t) => t.id !== id);
|
|
62
|
-
if (wasVisible && queue.length > 0 && visible.length < MAX_VISIBLE) {
|
|
63
|
-
const next = queue.shift()!;
|
|
64
|
-
visible = [...visible, next];
|
|
65
|
-
scheduleRemove(next.id, next.duration ?? 4000);
|
|
66
|
-
}
|
|
67
|
-
notify();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function addToast(item: Omit<ToastItem, 'id'>): string {
|
|
71
|
-
const id = `tkx-toast-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
72
|
-
const toast: ToastItem = { ...item, id, duration: item.duration ?? 4000 };
|
|
73
|
-
if (visible.length < MAX_VISIBLE) {
|
|
74
|
-
visible = [...visible, toast];
|
|
75
|
-
scheduleRemove(id, toast.duration!);
|
|
76
|
-
} else {
|
|
77
|
-
queue = [...queue, toast];
|
|
78
|
-
}
|
|
79
|
-
notify();
|
|
80
|
-
return id;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function dismissAll() {
|
|
84
|
-
timers.forEach((t) => clearTimeout(t));
|
|
85
|
-
timers.clear();
|
|
86
|
-
visible = [];
|
|
87
|
-
queue = [];
|
|
88
|
-
notify();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// ── Hook ──────────────────────────────────────────────────────────────────────
|
|
92
|
-
|
|
93
|
-
export function useToast() {
|
|
94
|
-
const toast = useCallback((item: Omit<ToastItem, 'id'>) => addToast(item), []);
|
|
95
|
-
const dismiss = useCallback((id: string) => removeToast(id), []);
|
|
96
|
-
const dismissAllToasts = useCallback(() => dismissAll(), []);
|
|
97
|
-
return { toast, dismiss, dismissAll: dismissAllToasts };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ── Variant config ────────────────────────────────────────────────────────────
|
|
101
|
-
|
|
102
|
-
const VARIANT_ICONS: Record<ToastVariant, ReactNode> = {
|
|
103
|
-
default: (
|
|
104
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
105
|
-
<path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" />
|
|
106
|
-
</svg>
|
|
107
|
-
),
|
|
108
|
-
success: (
|
|
109
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
110
|
-
<path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z" />
|
|
111
|
-
</svg>
|
|
112
|
-
),
|
|
113
|
-
danger: (
|
|
114
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
115
|
-
<path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" />
|
|
116
|
-
</svg>
|
|
117
|
-
),
|
|
118
|
-
warning: (
|
|
119
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
120
|
-
<path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" />
|
|
121
|
-
</svg>
|
|
122
|
-
),
|
|
123
|
-
info: (
|
|
124
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
125
|
-
<path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" />
|
|
126
|
-
</svg>
|
|
127
|
-
),
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
// ── Position styles ───────────────────────────────────────────────────────────
|
|
131
|
-
|
|
132
|
-
const POSITION_STYLES: Record<ToastPosition, React.CSSProperties> = {
|
|
133
|
-
'top-right': { top: 16, right: 16, alignItems: 'flex-end' },
|
|
134
|
-
'top-left': { top: 16, left: 16, alignItems: 'flex-start' },
|
|
135
|
-
'top-center': { top: 16, left: '50%', transform: 'translateX(-50%)', alignItems: 'center' },
|
|
136
|
-
'bottom-right': { bottom: 16, right: 16, alignItems: 'flex-end' },
|
|
137
|
-
'bottom-left': { bottom: 16, left: 16, alignItems: 'flex-start' },
|
|
138
|
-
'bottom-center':{ bottom: 16, left: '50%', transform: 'translateX(-50%)', alignItems: 'center' },
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
function slideInStyle(position: ToastPosition, reduced: boolean): React.CSSProperties {
|
|
142
|
-
if (reduced) return {};
|
|
143
|
-
const isTop = position.startsWith('top');
|
|
144
|
-
return {
|
|
145
|
-
animation: `tkx-toast-slide-${isTop ? 'down' : 'up'} 220ms cubic-bezier(0.16,1,0.3,1) both`,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// ── Single toast card ─────────────────────────────────────────────────────────
|
|
150
|
-
|
|
151
|
-
interface ToastCardProps {
|
|
152
|
-
toast: ToastItem;
|
|
153
|
-
position: ToastPosition;
|
|
154
|
-
onDismiss: (id: string) => void;
|
|
155
|
-
reduced: boolean;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function ToastCard({ toast, position, onDismiss, reduced }: ToastCardProps) {
|
|
159
|
-
const theme = useTheme();
|
|
160
|
-
const labelId = useId();
|
|
161
|
-
|
|
162
|
-
const variantColorMap: Record<ToastVariant, string> = {
|
|
163
|
-
default: theme.textMuted,
|
|
164
|
-
success: theme.success,
|
|
165
|
-
danger: theme.danger,
|
|
166
|
-
warning: theme.warning,
|
|
167
|
-
info: theme.info,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const variant = toast.variant ?? 'default';
|
|
171
|
-
const accentColor = variantColorMap[variant];
|
|
172
|
-
const isDanger = variant === 'danger';
|
|
173
|
-
const safeTitle = toast.title ? sanitizeString(toast.title) : undefined;
|
|
174
|
-
const safeDesc = toast.description ? sanitizeString(toast.description) : undefined;
|
|
175
|
-
|
|
176
|
-
return (
|
|
177
|
-
<div
|
|
178
|
-
role={isDanger ? 'alert' : 'status'}
|
|
179
|
-
aria-live={isDanger ? 'assertive' : 'polite'}
|
|
180
|
-
aria-atomic="true"
|
|
181
|
-
aria-labelledby={safeTitle ? labelId : undefined}
|
|
182
|
-
className={tkx('flex items-start gap-3 px-4 py-3 rounded-lg shadow-lg font-sans min-w-[280px] max-w-[380px]')}
|
|
183
|
-
style={{
|
|
184
|
-
backgroundColor: theme.surface,
|
|
185
|
-
border: `1px solid ${accentColor}55`,
|
|
186
|
-
boxShadow: `0 8px 24px ${theme.bg}cc`,
|
|
187
|
-
color: theme.text,
|
|
188
|
-
...slideInStyle(position, reduced),
|
|
189
|
-
}}
|
|
190
|
-
>
|
|
191
|
-
<span className={tkx('shrink-0 mt-[2px]')} style={{ color: accentColor }}>
|
|
192
|
-
{VARIANT_ICONS[variant]}
|
|
193
|
-
</span>
|
|
194
|
-
|
|
195
|
-
<div className={tkx('flex-1 min-w-0')}>
|
|
196
|
-
{safeTitle && (
|
|
197
|
-
<p id={labelId} className={tkx('m-0 font-semibold text-sm leading-snug')}>
|
|
198
|
-
{safeTitle}
|
|
199
|
-
</p>
|
|
200
|
-
)}
|
|
201
|
-
{safeDesc && (
|
|
202
|
-
<p className={tkx('m-0 text-xs mt-[2px] leading-relaxed')} style={{ color: theme.textMuted }}>
|
|
203
|
-
{safeDesc}
|
|
204
|
-
</p>
|
|
205
|
-
)}
|
|
206
|
-
{toast.action && (
|
|
207
|
-
<button
|
|
208
|
-
onClick={() => { toast.action!.onClick(); onDismiss(toast.id); }}
|
|
209
|
-
className={tkx('border-none bg-transparent cursor-pointer p-0 mt-2 text-xs font-semibold focus-visible:focus-ring')}
|
|
210
|
-
style={{ color: accentColor }}
|
|
211
|
-
>
|
|
212
|
-
{sanitizeString(toast.action.label)}
|
|
213
|
-
</button>
|
|
214
|
-
)}
|
|
215
|
-
</div>
|
|
216
|
-
|
|
217
|
-
<button
|
|
218
|
-
aria-label="Dismiss notification"
|
|
219
|
-
onClick={() => onDismiss(toast.id)}
|
|
220
|
-
className={tkx('bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring')}
|
|
221
|
-
style={{ color: theme.textMuted }}
|
|
222
|
-
>
|
|
223
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2.5} aria-hidden="true">
|
|
224
|
-
<line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
|
|
225
|
-
</svg>
|
|
226
|
-
</button>
|
|
227
|
-
</div>
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// ── Provider ──────────────────────────────────────────────────────────────────
|
|
232
|
-
|
|
233
|
-
export function TkxToastProvider({ position = 'top-right', children }: TkxToastProps) {
|
|
234
|
-
const [toasts, setToasts] = useState<ToastItem[]>([...visible]);
|
|
235
|
-
const reduced = useReducedMotion();
|
|
236
|
-
|
|
237
|
-
useEffect(() => {
|
|
238
|
-
setToasts([...visible]);
|
|
239
|
-
const handler: Listener = (next) => setToasts([...next]);
|
|
240
|
-
listeners.add(handler);
|
|
241
|
-
return () => { listeners.delete(handler); };
|
|
242
|
-
}, []);
|
|
243
|
-
|
|
244
|
-
const isBottom = position.startsWith('bottom');
|
|
245
|
-
const posStyle = POSITION_STYLES[position];
|
|
246
|
-
|
|
247
|
-
// Inject keyframes once
|
|
248
|
-
const injectedRef = useRef(false);
|
|
249
|
-
useEffect(() => {
|
|
250
|
-
if (injectedRef.current || typeof document === 'undefined') return;
|
|
251
|
-
injectedRef.current = true;
|
|
252
|
-
if (!document.getElementById('tkx-toast-kf')) {
|
|
253
|
-
const style = document.createElement('style');
|
|
254
|
-
style.id = 'tkx-toast-kf';
|
|
255
|
-
style.textContent = `
|
|
256
|
-
@keyframes tkx-toast-slide-down {
|
|
257
|
-
from { opacity: 0; transform: translateY(-16px); }
|
|
258
|
-
to { opacity: 1; transform: translateY(0); }
|
|
259
|
-
}
|
|
260
|
-
@keyframes tkx-toast-slide-up {
|
|
261
|
-
from { opacity: 0; transform: translateY(16px); }
|
|
262
|
-
to { opacity: 1; transform: translateY(0); }
|
|
263
|
-
}
|
|
264
|
-
`;
|
|
265
|
-
document.head.appendChild(style);
|
|
266
|
-
}
|
|
267
|
-
}, []);
|
|
268
|
-
|
|
269
|
-
if (typeof document === 'undefined') return <>{children}</>;
|
|
270
|
-
|
|
271
|
-
const ordered = isBottom ? [...toasts].reverse() : toasts;
|
|
272
|
-
|
|
273
|
-
return <>{children}{createPortal(
|
|
274
|
-
<div
|
|
275
|
-
aria-label="Notifications"
|
|
276
|
-
className={tkx('fixed z-[9999] flex flex-col gap-2 pointer-events-none')}
|
|
277
|
-
style={posStyle}
|
|
278
|
-
>
|
|
279
|
-
{ordered.map((t) => (
|
|
280
|
-
<div key={t.id} className={tkx('pointer-events-auto')}>
|
|
281
|
-
<ToastCard toast={t} position={position} onDismiss={removeToast} reduced={reduced} />
|
|
282
|
-
</div>
|
|
283
|
-
))}
|
|
284
|
-
</div>,
|
|
285
|
-
document.body,
|
|
286
|
-
)}</>;
|
|
287
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { forwardRef, useId, type ButtonHTMLAttributes } from 'react';
|
|
4
|
-
import { useTheme } from '../themes';
|
|
5
|
-
import { useReducedMotion } from '../hooks';
|
|
6
|
-
import { validateProps } from '../engine/security';
|
|
7
|
-
import { tkx, cx } from '../engine/tkx';
|
|
8
|
-
|
|
9
|
-
export type ToggleSize = 'sm' | 'md' | 'lg';
|
|
10
|
-
|
|
11
|
-
export interface TkxToggleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
|
|
12
|
-
checked: boolean;
|
|
13
|
-
onChange: (checked: boolean) => void;
|
|
14
|
-
label: string;
|
|
15
|
-
size?: ToggleSize;
|
|
16
|
-
hideLabel?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const SIZES: Record<ToggleSize, { tw: number; th: number; td: number; gap: number }> = {
|
|
20
|
-
sm: { tw: 28, th: 16, td: 10, gap: 3 },
|
|
21
|
-
md: { tw: 40, th: 22, td: 14, gap: 4 },
|
|
22
|
-
lg: { tw: 52, th: 28, td: 18, gap: 5 },
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const TkxToggle = forwardRef<HTMLButtonElement, TkxToggleProps>(
|
|
26
|
-
({ checked, onChange, label, size = 'md', hideLabel, disabled, className, style, ...rest }, ref) => {
|
|
27
|
-
const theme = useTheme();
|
|
28
|
-
const reducedMotion = useReducedMotion();
|
|
29
|
-
const id = useId();
|
|
30
|
-
|
|
31
|
-
validateProps(
|
|
32
|
-
{ label, checked },
|
|
33
|
-
{ label: { type: 'string', required: true }, checked: { type: 'boolean', required: true } },
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const { tw, th, td, gap } = SIZES[size];
|
|
37
|
-
const thumbOffset = checked ? tw - td - gap : gap;
|
|
38
|
-
const trackBg = checked ? theme.primary : theme.border;
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div
|
|
42
|
-
className={cx(tkx('inline-flex items-center gap-2', disabled ? 'opacity-50' : ''), className)}
|
|
43
|
-
style={style}
|
|
44
|
-
>
|
|
45
|
-
{!hideLabel && (
|
|
46
|
-
<label
|
|
47
|
-
htmlFor={id}
|
|
48
|
-
className={tkx('text-sm font-sans', disabled ? 'cursor-not-allowed' : 'cursor-pointer', 'select-none')}
|
|
49
|
-
style={{ color: theme.text }}
|
|
50
|
-
>
|
|
51
|
-
{label}
|
|
52
|
-
</label>
|
|
53
|
-
)}
|
|
54
|
-
<button
|
|
55
|
-
ref={ref}
|
|
56
|
-
id={id}
|
|
57
|
-
role="switch"
|
|
58
|
-
aria-checked={checked}
|
|
59
|
-
aria-label={hideLabel ? label : undefined}
|
|
60
|
-
disabled={disabled}
|
|
61
|
-
onClick={() => !disabled && onChange(!checked)}
|
|
62
|
-
onKeyDown={(e) => {
|
|
63
|
-
if ((e.key === 'Enter' || e.key === ' ') && !disabled) {
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
onChange(!checked);
|
|
66
|
-
}
|
|
67
|
-
}}
|
|
68
|
-
className={cx(
|
|
69
|
-
tkx('relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring',
|
|
70
|
-
disabled ? 'cursor-not-allowed' : 'cursor-pointer',
|
|
71
|
-
!reducedMotion && 'transition-colors duration-200',
|
|
72
|
-
),
|
|
73
|
-
)}
|
|
74
|
-
style={{ width: tw, height: th, borderRadius: th, backgroundColor: trackBg }}
|
|
75
|
-
{...rest}
|
|
76
|
-
>
|
|
77
|
-
<span
|
|
78
|
-
aria-hidden="true"
|
|
79
|
-
className={tkx('absolute rounded-full')}
|
|
80
|
-
style={{
|
|
81
|
-
top: '50%', left: thumbOffset,
|
|
82
|
-
width: td, height: td,
|
|
83
|
-
transform: 'translateY(-50%)',
|
|
84
|
-
backgroundColor: '#ffffff',
|
|
85
|
-
boxShadow: '0 1px 3px rgba(0,0,0,0.3)',
|
|
86
|
-
transition: reducedMotion ? 'none' : 'left 200ms ease',
|
|
87
|
-
}}
|
|
88
|
-
/>
|
|
89
|
-
</button>
|
|
90
|
-
</div>
|
|
91
|
-
);
|
|
92
|
-
},
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
TkxToggle.displayName = 'TkxToggle';
|