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,278 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useState, useRef, useEffect, useCallback } 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 CascaderOption {
|
|
13
|
-
value: string;
|
|
14
|
-
label: string;
|
|
15
|
-
children?: CascaderOption[];
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface TkxCascaderProps {
|
|
20
|
-
options: CascaderOption[];
|
|
21
|
-
value?: string[];
|
|
22
|
-
onChange?: (value: string[], selectedOptions: CascaderOption[]) => void;
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
label?: string;
|
|
25
|
-
multiple?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
29
|
-
|
|
30
|
-
function getColumns(
|
|
31
|
-
options: CascaderOption[],
|
|
32
|
-
selected: string[],
|
|
33
|
-
): CascaderOption[][] {
|
|
34
|
-
const columns: CascaderOption[][] = [options];
|
|
35
|
-
let current = options;
|
|
36
|
-
for (const val of selected) {
|
|
37
|
-
const found = current.find((o) => o.value === val);
|
|
38
|
-
if (found?.children?.length) {
|
|
39
|
-
columns.push(found.children);
|
|
40
|
-
current = found.children;
|
|
41
|
-
} else {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return columns;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function getSelectedOptions(
|
|
49
|
-
options: CascaderOption[],
|
|
50
|
-
values: string[],
|
|
51
|
-
): CascaderOption[] {
|
|
52
|
-
const result: CascaderOption[] = [];
|
|
53
|
-
let current = options;
|
|
54
|
-
for (const val of values) {
|
|
55
|
-
const found = current.find((o) => o.value === val);
|
|
56
|
-
if (found) {
|
|
57
|
-
result.push(found);
|
|
58
|
-
current = found.children ?? [];
|
|
59
|
-
} else break;
|
|
60
|
-
}
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function getLabelPath(options: CascaderOption[], values: string[]): string {
|
|
65
|
-
return getSelectedOptions(options, values)
|
|
66
|
-
.map((o) => sanitizeString(o.label))
|
|
67
|
-
.join(' / ');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// ── Component ────────────────────────────────────────────────────────────────
|
|
71
|
-
|
|
72
|
-
export function TkxCascader({
|
|
73
|
-
options,
|
|
74
|
-
value = [],
|
|
75
|
-
onChange,
|
|
76
|
-
placeholder = 'Select...',
|
|
77
|
-
label,
|
|
78
|
-
multiple = false,
|
|
79
|
-
}: TkxCascaderProps) {
|
|
80
|
-
const theme = useTheme();
|
|
81
|
-
const reducedMotion = useReducedMotion();
|
|
82
|
-
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
83
|
-
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
84
|
-
const [open, setOpen] = useState(false);
|
|
85
|
-
const [hoverPath, setHoverPath] = useState<string[]>(value);
|
|
86
|
-
const [dropdownPos, setDropdownPos] = useState({ top: 0, left: 0, width: 0 });
|
|
87
|
-
|
|
88
|
-
const safeLabel = label ? sanitizeString(label) : undefined;
|
|
89
|
-
const safePlaceholder = sanitizeString(placeholder);
|
|
90
|
-
const displayText = value.length > 0 ? getLabelPath(options, value) : '';
|
|
91
|
-
|
|
92
|
-
// Position dropdown
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
if (!open || !triggerRef.current) return;
|
|
95
|
-
const rect = triggerRef.current.getBoundingClientRect();
|
|
96
|
-
setDropdownPos({
|
|
97
|
-
top: rect.bottom + 4 + window.scrollY,
|
|
98
|
-
left: rect.left + window.scrollX,
|
|
99
|
-
width: Math.max(rect.width, 200),
|
|
100
|
-
});
|
|
101
|
-
}, [open]);
|
|
102
|
-
|
|
103
|
-
// Close on outside click
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
if (!open) return;
|
|
106
|
-
const handler = (e: MouseEvent) => {
|
|
107
|
-
if (
|
|
108
|
-
!triggerRef.current?.contains(e.target as Node) &&
|
|
109
|
-
!dropdownRef.current?.contains(e.target as Node)
|
|
110
|
-
) {
|
|
111
|
-
setOpen(false);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
document.addEventListener('mousedown', handler);
|
|
115
|
-
return () => document.removeEventListener('mousedown', handler);
|
|
116
|
-
}, [open]);
|
|
117
|
-
|
|
118
|
-
const handleSelect = useCallback(
|
|
119
|
-
(colIdx: number, opt: CascaderOption) => {
|
|
120
|
-
if (opt.disabled) return;
|
|
121
|
-
const newPath = [...hoverPath.slice(0, colIdx), opt.value];
|
|
122
|
-
setHoverPath(newPath);
|
|
123
|
-
|
|
124
|
-
// If leaf node (no children), commit selection
|
|
125
|
-
if (!opt.children?.length) {
|
|
126
|
-
const selected = getSelectedOptions(options, newPath);
|
|
127
|
-
onChange?.(newPath, selected);
|
|
128
|
-
if (!multiple) setOpen(false);
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
[hoverPath, options, onChange, multiple],
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const handleKeyDown = useCallback(
|
|
135
|
-
(e: React.KeyboardEvent) => {
|
|
136
|
-
if (e.key === 'Escape') {
|
|
137
|
-
setOpen(false);
|
|
138
|
-
triggerRef.current?.focus();
|
|
139
|
-
} else if (e.key === 'Enter' || e.key === ' ') {
|
|
140
|
-
if (!open) {
|
|
141
|
-
e.preventDefault();
|
|
142
|
-
setOpen(true);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
[open],
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
const columns = getColumns(options, hoverPath);
|
|
150
|
-
|
|
151
|
-
const dropdown = open
|
|
152
|
-
? createPortal(
|
|
153
|
-
<div
|
|
154
|
-
ref={dropdownRef}
|
|
155
|
-
role="tree"
|
|
156
|
-
aria-label={safeLabel ?? 'Cascader options'}
|
|
157
|
-
className={tkx('flex rounded-lg border overflow-hidden')}
|
|
158
|
-
style={{
|
|
159
|
-
position: 'absolute',
|
|
160
|
-
zIndex: 9999,
|
|
161
|
-
top: dropdownPos.top,
|
|
162
|
-
left: dropdownPos.left,
|
|
163
|
-
backgroundColor: theme.surface,
|
|
164
|
-
borderColor: theme.border,
|
|
165
|
-
boxShadow: `0 4px 16px ${theme.bg}80`,
|
|
166
|
-
animation: reducedMotion ? 'none' : 'tkxFadeIn 0.15s ease',
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
{columns.map((col, colIdx) => (
|
|
170
|
-
<ul
|
|
171
|
-
key={colIdx}
|
|
172
|
-
role="group"
|
|
173
|
-
className={tkx('m-0 p-0 overflow-auto')}
|
|
174
|
-
style={{
|
|
175
|
-
listStyle: 'none',
|
|
176
|
-
minWidth: 160,
|
|
177
|
-
maxHeight: 260,
|
|
178
|
-
borderRight: colIdx < columns.length - 1 ? `1px solid ${theme.border}` : 'none',
|
|
179
|
-
}}
|
|
180
|
-
>
|
|
181
|
-
{col.map((opt) => {
|
|
182
|
-
const isSelected = hoverPath[colIdx] === opt.value;
|
|
183
|
-
const safeOptLabel = sanitizeString(opt.label);
|
|
184
|
-
return (
|
|
185
|
-
<li
|
|
186
|
-
key={opt.value}
|
|
187
|
-
role="treeitem"
|
|
188
|
-
aria-selected={isSelected}
|
|
189
|
-
aria-disabled={opt.disabled || undefined}
|
|
190
|
-
aria-expanded={opt.children?.length ? isSelected : undefined}
|
|
191
|
-
className={tkx('flex items-center justify-between px-3 py-2 cursor-pointer text-sm')}
|
|
192
|
-
style={{
|
|
193
|
-
backgroundColor: isSelected ? theme.surfaceAlt : 'transparent',
|
|
194
|
-
color: opt.disabled ? theme.textMuted : theme.text,
|
|
195
|
-
opacity: opt.disabled ? 0.5 : 1,
|
|
196
|
-
cursor: opt.disabled ? 'not-allowed' : 'pointer',
|
|
197
|
-
}}
|
|
198
|
-
onClick={() => handleSelect(colIdx, opt)}
|
|
199
|
-
onMouseEnter={() => {
|
|
200
|
-
if (!opt.disabled) {
|
|
201
|
-
setHoverPath((prev) => [...prev.slice(0, colIdx), opt.value]);
|
|
202
|
-
}
|
|
203
|
-
}}
|
|
204
|
-
>
|
|
205
|
-
<span>{safeOptLabel}</span>
|
|
206
|
-
{opt.children && opt.children.length > 0 && (
|
|
207
|
-
<svg
|
|
208
|
-
width="12"
|
|
209
|
-
height="12"
|
|
210
|
-
viewBox="0 0 24 24"
|
|
211
|
-
fill="currentColor"
|
|
212
|
-
aria-hidden="true"
|
|
213
|
-
style={{ color: theme.textMuted, flexShrink: 0 }}
|
|
214
|
-
>
|
|
215
|
-
<path d="M10 6l6 6-6 6V6z" />
|
|
216
|
-
</svg>
|
|
217
|
-
)}
|
|
218
|
-
</li>
|
|
219
|
-
);
|
|
220
|
-
})}
|
|
221
|
-
</ul>
|
|
222
|
-
))}
|
|
223
|
-
</div>,
|
|
224
|
-
document.body,
|
|
225
|
-
)
|
|
226
|
-
: null;
|
|
227
|
-
|
|
228
|
-
return (
|
|
229
|
-
<div className={tkx('relative font-sans')} onKeyDown={handleKeyDown}>
|
|
230
|
-
{safeLabel && (
|
|
231
|
-
<label
|
|
232
|
-
className={tkx('block text-sm font-medium mb-1')}
|
|
233
|
-
style={{ color: theme.text }}
|
|
234
|
-
>
|
|
235
|
-
{safeLabel}
|
|
236
|
-
</label>
|
|
237
|
-
)}
|
|
238
|
-
|
|
239
|
-
<button
|
|
240
|
-
ref={triggerRef}
|
|
241
|
-
type="button"
|
|
242
|
-
role="combobox"
|
|
243
|
-
aria-expanded={open}
|
|
244
|
-
aria-haspopup="tree"
|
|
245
|
-
aria-label={safeLabel ?? 'Cascader'}
|
|
246
|
-
className={tkx('w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer')}
|
|
247
|
-
style={{
|
|
248
|
-
backgroundColor: theme.surface,
|
|
249
|
-
borderColor: open ? theme.primary : theme.border,
|
|
250
|
-
color: displayText ? theme.text : theme.textMuted,
|
|
251
|
-
outline: 'none',
|
|
252
|
-
minHeight: 38,
|
|
253
|
-
textAlign: 'left',
|
|
254
|
-
}}
|
|
255
|
-
onClick={() => setOpen((v) => !v)}
|
|
256
|
-
>
|
|
257
|
-
<span className={tkx('truncate')}>{displayText || safePlaceholder}</span>
|
|
258
|
-
<svg
|
|
259
|
-
width="16"
|
|
260
|
-
height="16"
|
|
261
|
-
viewBox="0 0 24 24"
|
|
262
|
-
fill="currentColor"
|
|
263
|
-
aria-hidden="true"
|
|
264
|
-
style={{
|
|
265
|
-
color: theme.textMuted,
|
|
266
|
-
transform: open ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
267
|
-
transition: reducedMotion ? 'none' : 'transform 0.2s ease',
|
|
268
|
-
flexShrink: 0,
|
|
269
|
-
}}
|
|
270
|
-
>
|
|
271
|
-
<path d="M7 10l5 5 5-5H7z" />
|
|
272
|
-
</svg>
|
|
273
|
-
</button>
|
|
274
|
-
|
|
275
|
-
{dropdown}
|
|
276
|
-
</div>
|
|
277
|
-
);
|
|
278
|
-
}
|
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
useState,
|
|
5
|
-
useRef,
|
|
6
|
-
useEffect,
|
|
7
|
-
useCallback,
|
|
8
|
-
type ReactNode,
|
|
9
|
-
type KeyboardEvent,
|
|
10
|
-
type ChangeEvent,
|
|
11
|
-
} from 'react';
|
|
12
|
-
import { useTheme } from '../themes';
|
|
13
|
-
import { tkx, cx } from '../engine/tkx';
|
|
14
|
-
import { sanitizeString } from '../engine/security';
|
|
15
|
-
import { useReducedMotion } from '../hooks';
|
|
16
|
-
|
|
17
|
-
// ── Types ─────────────────────────────────────────────────────────────────────
|
|
18
|
-
|
|
19
|
-
export type MessageRole = 'user' | 'assistant' | 'system';
|
|
20
|
-
|
|
21
|
-
export interface ChatMessage {
|
|
22
|
-
id: string;
|
|
23
|
-
role: MessageRole;
|
|
24
|
-
content: string;
|
|
25
|
-
timestamp?: Date;
|
|
26
|
-
isStreaming?: boolean;
|
|
27
|
-
error?: boolean;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface TkxChatProps {
|
|
31
|
-
messages: ChatMessage[];
|
|
32
|
-
onSend?: (message: string) => void;
|
|
33
|
-
isLoading?: boolean;
|
|
34
|
-
placeholder?: string;
|
|
35
|
-
maxLength?: number;
|
|
36
|
-
showTimestamps?: boolean;
|
|
37
|
-
avatarUser?: ReactNode;
|
|
38
|
-
avatarAssistant?: ReactNode;
|
|
39
|
-
height?: string | number;
|
|
40
|
-
inputPosition?: 'bottom' | 'floating';
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface TkxChatBubbleProps {
|
|
44
|
-
message: ChatMessage;
|
|
45
|
-
showTimestamp?: boolean;
|
|
46
|
-
avatarUser?: ReactNode;
|
|
47
|
-
avatarAssistant?: ReactNode;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// ── Animations (injected once) ────────────────────────────────────────────────
|
|
51
|
-
|
|
52
|
-
let _styleInjected = false;
|
|
53
|
-
function injectChatStyles() {
|
|
54
|
-
if (_styleInjected || typeof document === 'undefined') return;
|
|
55
|
-
_styleInjected = true;
|
|
56
|
-
const style = document.createElement('style');
|
|
57
|
-
style.textContent = `
|
|
58
|
-
@keyframes tkx-blink { 0%,100% { opacity:1 } 50% { opacity:0 } }
|
|
59
|
-
@keyframes tkx-bounce { 0%,100% { transform:translateY(0) } 50% { transform:translateY(-5px) } }
|
|
60
|
-
.tkx-cursor::after { content:'▋'; display:inline-block; animation:tkx-blink 1s step-start infinite; margin-left:1px; }
|
|
61
|
-
.tkx-dot1 { animation:tkx-bounce 1s ease-in-out infinite; }
|
|
62
|
-
.tkx-dot2 { animation:tkx-bounce 1s ease-in-out 0.2s infinite; }
|
|
63
|
-
.tkx-dot3 { animation:tkx-bounce 1s ease-in-out 0.4s infinite; }
|
|
64
|
-
`;
|
|
65
|
-
document.head.appendChild(style);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// ── Default Avatars ───────────────────────────────────────────────────────────
|
|
69
|
-
|
|
70
|
-
function DefaultUserAvatar() {
|
|
71
|
-
return (
|
|
72
|
-
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" aria-hidden="true">
|
|
73
|
-
<circle cx="14" cy="14" r="14" fill="currentColor" fillOpacity="0.15" />
|
|
74
|
-
<circle cx="14" cy="11" r="4" fill="currentColor" />
|
|
75
|
-
<path d="M6 24c0-4.418 3.582-8 8-8s8 3.582 8 8" fill="currentColor" />
|
|
76
|
-
</svg>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function DefaultAssistantAvatar() {
|
|
81
|
-
return (
|
|
82
|
-
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" aria-hidden="true">
|
|
83
|
-
<circle cx="14" cy="14" r="14" fill="currentColor" fillOpacity="0.15" />
|
|
84
|
-
<path d="M14 5l2.2 6.5H23l-5.6 4 2.2 6.5L14 18l-5.6 4 2.2-6.5L5 11.5h6.8z" fill="currentColor" />
|
|
85
|
-
</svg>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// ── TkxThinkingIndicator ──────────────────────────────────────────────────────
|
|
90
|
-
|
|
91
|
-
export function TkxThinkingIndicator() {
|
|
92
|
-
const theme = useTheme();
|
|
93
|
-
return (
|
|
94
|
-
<div
|
|
95
|
-
className={tkx('flex items-center gap-1.5 px-4 py-3 rounded-2xl w-fit')}
|
|
96
|
-
style={{ backgroundColor: theme.surface, border: `1px solid ${theme.border}` }}
|
|
97
|
-
aria-label="Assistant is thinking"
|
|
98
|
-
>
|
|
99
|
-
<span
|
|
100
|
-
className="tkx-dot1 inline-block w-2 h-2 rounded-full"
|
|
101
|
-
style={{ backgroundColor: theme.textMuted }}
|
|
102
|
-
/>
|
|
103
|
-
<span
|
|
104
|
-
className="tkx-dot2 inline-block w-2 h-2 rounded-full"
|
|
105
|
-
style={{ backgroundColor: theme.textMuted }}
|
|
106
|
-
/>
|
|
107
|
-
<span
|
|
108
|
-
className="tkx-dot3 inline-block w-2 h-2 rounded-full"
|
|
109
|
-
style={{ backgroundColor: theme.textMuted }}
|
|
110
|
-
/>
|
|
111
|
-
</div>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// ── TkxChatBubble ─────────────────────────────────────────────────────────────
|
|
116
|
-
|
|
117
|
-
export function TkxChatBubble({ message, showTimestamp, avatarUser, avatarAssistant }: TkxChatBubbleProps) {
|
|
118
|
-
const theme = useTheme();
|
|
119
|
-
const reducedMotion = useReducedMotion();
|
|
120
|
-
const { role, content, timestamp, isStreaming, error } = message;
|
|
121
|
-
|
|
122
|
-
const safeContent = sanitizeString(content);
|
|
123
|
-
|
|
124
|
-
const formattedTime = timestamp
|
|
125
|
-
? new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: '2-digit', hour12: true }).format(timestamp)
|
|
126
|
-
: null;
|
|
127
|
-
|
|
128
|
-
if (role === 'system') {
|
|
129
|
-
return (
|
|
130
|
-
<div role="listitem" className={tkx('flex justify-center my-2')}>
|
|
131
|
-
<p
|
|
132
|
-
className={tkx('text-xs italic px-3 py-1 rounded-full')}
|
|
133
|
-
style={{ color: theme.textMuted, backgroundColor: theme.surfaceAlt }}
|
|
134
|
-
>
|
|
135
|
-
{safeContent}
|
|
136
|
-
</p>
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const isUser = role === 'user';
|
|
142
|
-
const avatar = isUser ? (avatarUser ?? <DefaultUserAvatar />) : (avatarAssistant ?? <DefaultAssistantAvatar />);
|
|
143
|
-
|
|
144
|
-
const bubbleStyle: React.CSSProperties = isUser
|
|
145
|
-
? { backgroundColor: theme.primary, color: theme.bg }
|
|
146
|
-
: {
|
|
147
|
-
backgroundColor: theme.surface,
|
|
148
|
-
color: theme.text,
|
|
149
|
-
border: `1px solid ${error ? theme.danger : theme.border}`,
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
if (error) {
|
|
153
|
-
bubbleStyle.borderColor = theme.danger;
|
|
154
|
-
bubbleStyle.borderWidth = '2px';
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return (
|
|
158
|
-
<div
|
|
159
|
-
role="listitem"
|
|
160
|
-
className={tkx('flex gap-2 mb-4', isUser ? 'flex-row-reverse' : 'flex-row')}
|
|
161
|
-
>
|
|
162
|
-
<div
|
|
163
|
-
className={tkx('shrink-0 w-8 h-8 rounded-full flex items-center justify-center overflow-hidden')}
|
|
164
|
-
style={{ color: isUser ? theme.primary : theme.secondary }}
|
|
165
|
-
>
|
|
166
|
-
{avatar}
|
|
167
|
-
</div>
|
|
168
|
-
<div className={tkx('flex flex-col gap-1 max-w-[75%]', isUser ? 'items-end' : 'items-start')}>
|
|
169
|
-
<div
|
|
170
|
-
className={cx(
|
|
171
|
-
tkx('px-4 py-2.5 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap'),
|
|
172
|
-
isStreaming && !reducedMotion ? 'tkx-cursor' : '',
|
|
173
|
-
)}
|
|
174
|
-
style={bubbleStyle}
|
|
175
|
-
>
|
|
176
|
-
{safeContent}
|
|
177
|
-
{error && (
|
|
178
|
-
<span aria-label="Error" style={{ marginLeft: 6, color: theme.danger }}>⚠</span>
|
|
179
|
-
)}
|
|
180
|
-
</div>
|
|
181
|
-
{showTimestamp && formattedTime && (
|
|
182
|
-
<span className={tkx('text-[10px]')} style={{ color: theme.textMuted }}>
|
|
183
|
-
{formattedTime}
|
|
184
|
-
</span>
|
|
185
|
-
)}
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// ── TkxChat ───────────────────────────────────────────────────────────────────
|
|
192
|
-
|
|
193
|
-
export function TkxChat({
|
|
194
|
-
messages,
|
|
195
|
-
onSend,
|
|
196
|
-
isLoading = false,
|
|
197
|
-
placeholder = 'Type a message…',
|
|
198
|
-
maxLength,
|
|
199
|
-
showTimestamps = false,
|
|
200
|
-
avatarUser,
|
|
201
|
-
avatarAssistant,
|
|
202
|
-
height = 480,
|
|
203
|
-
inputPosition = 'bottom',
|
|
204
|
-
}: TkxChatProps) {
|
|
205
|
-
const theme = useTheme();
|
|
206
|
-
const reducedMotion = useReducedMotion();
|
|
207
|
-
const [draft, setDraft] = useState('');
|
|
208
|
-
const listRef = useRef<HTMLDivElement>(null);
|
|
209
|
-
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
|
210
|
-
|
|
211
|
-
useEffect(() => { injectChatStyles(); }, []);
|
|
212
|
-
|
|
213
|
-
useEffect(() => {
|
|
214
|
-
const el = listRef.current;
|
|
215
|
-
if (!el) return;
|
|
216
|
-
el.scrollTo({ top: el.scrollHeight, behavior: reducedMotion ? 'auto' : 'smooth' });
|
|
217
|
-
}, [messages, isLoading, reducedMotion]);
|
|
218
|
-
|
|
219
|
-
const handleSend = useCallback(() => {
|
|
220
|
-
const trimmed = draft.trim();
|
|
221
|
-
if (!trimmed || !onSend) return;
|
|
222
|
-
onSend(trimmed);
|
|
223
|
-
setDraft('');
|
|
224
|
-
if (textareaRef.current) {
|
|
225
|
-
textareaRef.current.style.height = 'auto';
|
|
226
|
-
}
|
|
227
|
-
}, [draft, onSend]);
|
|
228
|
-
|
|
229
|
-
const handleKeyDown = useCallback((e: KeyboardEvent<HTMLTextAreaElement>) => {
|
|
230
|
-
if (e.key === 'Enter' && !e.shiftKey) {
|
|
231
|
-
e.preventDefault();
|
|
232
|
-
handleSend();
|
|
233
|
-
}
|
|
234
|
-
}, [handleSend]);
|
|
235
|
-
|
|
236
|
-
const handleChange = useCallback((e: ChangeEvent<HTMLTextAreaElement>) => {
|
|
237
|
-
const val = maxLength ? e.target.value.slice(0, maxLength) : e.target.value;
|
|
238
|
-
setDraft(val);
|
|
239
|
-
const ta = textareaRef.current;
|
|
240
|
-
if (ta) {
|
|
241
|
-
ta.style.height = 'auto';
|
|
242
|
-
const lineH = 24;
|
|
243
|
-
const maxH = lineH * 4 + 24;
|
|
244
|
-
ta.style.height = `${Math.min(ta.scrollHeight, maxH)}px`;
|
|
245
|
-
}
|
|
246
|
-
}, [maxLength]);
|
|
247
|
-
|
|
248
|
-
const canSend = draft.trim().length > 0 && !isLoading;
|
|
249
|
-
const heightVal = typeof height === 'number' ? `${height}px` : height;
|
|
250
|
-
|
|
251
|
-
const isFloating = inputPosition === 'floating';
|
|
252
|
-
|
|
253
|
-
const inputArea = (
|
|
254
|
-
<div
|
|
255
|
-
className={tkx('flex flex-col gap-1 p-3')}
|
|
256
|
-
style={
|
|
257
|
-
isFloating
|
|
258
|
-
? {
|
|
259
|
-
position: 'absolute',
|
|
260
|
-
bottom: 12,
|
|
261
|
-
left: 12,
|
|
262
|
-
right: 12,
|
|
263
|
-
borderRadius: 16,
|
|
264
|
-
backgroundColor: theme.surface,
|
|
265
|
-
border: `1px solid ${theme.border}`,
|
|
266
|
-
boxShadow: '0 4px 24px rgba(0,0,0,0.18)',
|
|
267
|
-
}
|
|
268
|
-
: {
|
|
269
|
-
borderTop: `1px solid ${theme.border}`,
|
|
270
|
-
backgroundColor: theme.surface,
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
>
|
|
274
|
-
<div className={tkx('flex items-end gap-2')}>
|
|
275
|
-
<textarea
|
|
276
|
-
ref={textareaRef}
|
|
277
|
-
rows={1}
|
|
278
|
-
value={draft}
|
|
279
|
-
onChange={handleChange}
|
|
280
|
-
onKeyDown={handleKeyDown}
|
|
281
|
-
placeholder={sanitizeString(placeholder)}
|
|
282
|
-
aria-label="Message input"
|
|
283
|
-
aria-multiline="true"
|
|
284
|
-
disabled={isLoading}
|
|
285
|
-
className={tkx('flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1')}
|
|
286
|
-
style={{
|
|
287
|
-
color: theme.text,
|
|
288
|
-
caretColor: theme.primary,
|
|
289
|
-
minHeight: 32,
|
|
290
|
-
maxHeight: 120,
|
|
291
|
-
}}
|
|
292
|
-
/>
|
|
293
|
-
<button
|
|
294
|
-
onClick={handleSend}
|
|
295
|
-
disabled={!canSend}
|
|
296
|
-
aria-label="Send message"
|
|
297
|
-
className={tkx(
|
|
298
|
-
'shrink-0 w-9 h-9 rounded-xl flex items-center justify-center',
|
|
299
|
-
!reducedMotion && 'transition-opacity duration-150',
|
|
300
|
-
!canSend ? 'opacity-40 cursor-not-allowed' : 'cursor-pointer opacity-100',
|
|
301
|
-
)}
|
|
302
|
-
style={{ backgroundColor: theme.primary, color: theme.bg }}
|
|
303
|
-
>
|
|
304
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
305
|
-
<path d="M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z" fill="currentColor" />
|
|
306
|
-
</svg>
|
|
307
|
-
</button>
|
|
308
|
-
</div>
|
|
309
|
-
{maxLength && (
|
|
310
|
-
<div className={tkx('text-right text-[10px]')} style={{ color: theme.textMuted }}>
|
|
311
|
-
{draft.length}/{maxLength}
|
|
312
|
-
</div>
|
|
313
|
-
)}
|
|
314
|
-
</div>
|
|
315
|
-
);
|
|
316
|
-
|
|
317
|
-
return (
|
|
318
|
-
<div
|
|
319
|
-
className={tkx('flex flex-col overflow-hidden rounded-2xl')}
|
|
320
|
-
style={{
|
|
321
|
-
height: heightVal,
|
|
322
|
-
backgroundColor: theme.bg,
|
|
323
|
-
border: `1px solid ${theme.border}`,
|
|
324
|
-
position: 'relative',
|
|
325
|
-
}}
|
|
326
|
-
>
|
|
327
|
-
<div
|
|
328
|
-
ref={listRef}
|
|
329
|
-
role="log"
|
|
330
|
-
aria-live="polite"
|
|
331
|
-
aria-label="Chat messages"
|
|
332
|
-
className={tkx('flex-1 overflow-y-auto p-4')}
|
|
333
|
-
style={{ paddingBottom: isFloating ? 80 : undefined }}
|
|
334
|
-
>
|
|
335
|
-
<div role="list">
|
|
336
|
-
{messages.map((msg) => (
|
|
337
|
-
<TkxChatBubble
|
|
338
|
-
key={msg.id}
|
|
339
|
-
message={msg}
|
|
340
|
-
showTimestamp={showTimestamps}
|
|
341
|
-
avatarUser={avatarUser}
|
|
342
|
-
avatarAssistant={avatarAssistant}
|
|
343
|
-
/>
|
|
344
|
-
))}
|
|
345
|
-
{isLoading && (
|
|
346
|
-
<div role="listitem" className={tkx('flex gap-2 mb-4')}>
|
|
347
|
-
<div className={tkx('w-8 h-8 shrink-0')} />
|
|
348
|
-
<TkxThinkingIndicator />
|
|
349
|
-
</div>
|
|
350
|
-
)}
|
|
351
|
-
</div>
|
|
352
|
-
</div>
|
|
353
|
-
{inputArea}
|
|
354
|
-
</div>
|
|
355
|
-
);
|
|
356
|
-
}
|