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,297 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
useState,
|
|
5
|
-
useRef,
|
|
6
|
-
useEffect,
|
|
7
|
-
useCallback,
|
|
8
|
-
useId,
|
|
9
|
-
type ReactNode,
|
|
10
|
-
type CSSProperties,
|
|
11
|
-
} from 'react';
|
|
12
|
-
import { createPortal } from 'react-dom';
|
|
13
|
-
import { useTheme } from '../themes';
|
|
14
|
-
import { useReducedMotion, useEscapeKey, useClickOutside } from '../hooks';
|
|
15
|
-
import { tkx } from '../engine/tkx';
|
|
16
|
-
|
|
17
|
-
// ── Types ─────────────────────────────────────────────────────────────────────
|
|
18
|
-
|
|
19
|
-
export type PopoverPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
20
|
-
|
|
21
|
-
export interface TkxPopoverProps {
|
|
22
|
-
trigger: ReactNode;
|
|
23
|
-
content: ReactNode;
|
|
24
|
-
placement?: PopoverPlacement;
|
|
25
|
-
isOpen?: boolean;
|
|
26
|
-
onOpenChange?: (open: boolean) => void;
|
|
27
|
-
closeOnClickOutside?: boolean;
|
|
28
|
-
className?: string;
|
|
29
|
-
style?: CSSProperties;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// ── Arrow dimensions ────────────────────────────────────────────────────────
|
|
33
|
-
|
|
34
|
-
const ARROW_SIZE = 8;
|
|
35
|
-
const GAP = 8;
|
|
36
|
-
|
|
37
|
-
// ── Position calculator ─────────────────────────────────────────────────────
|
|
38
|
-
|
|
39
|
-
interface PopoverPosition {
|
|
40
|
-
top: number;
|
|
41
|
-
left: number;
|
|
42
|
-
arrowStyle: CSSProperties;
|
|
43
|
-
resolvedPlacement: PopoverPlacement;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function calcPosition(
|
|
47
|
-
triggerRect: DOMRect,
|
|
48
|
-
popoverEl: HTMLElement,
|
|
49
|
-
placement: PopoverPlacement,
|
|
50
|
-
): PopoverPosition {
|
|
51
|
-
const popRect = popoverEl.getBoundingClientRect();
|
|
52
|
-
const scrollX = window.scrollX;
|
|
53
|
-
const scrollY = window.scrollY;
|
|
54
|
-
|
|
55
|
-
const viewW = window.innerWidth;
|
|
56
|
-
const viewH = window.innerHeight;
|
|
57
|
-
|
|
58
|
-
let top = 0;
|
|
59
|
-
let left = 0;
|
|
60
|
-
let resolved = placement;
|
|
61
|
-
|
|
62
|
-
// Attempt requested placement, flip if insufficient space
|
|
63
|
-
const fits = {
|
|
64
|
-
top: triggerRect.top - popRect.height - GAP - ARROW_SIZE > 0,
|
|
65
|
-
bottom: triggerRect.bottom + popRect.height + GAP + ARROW_SIZE < viewH,
|
|
66
|
-
left: triggerRect.left - popRect.width - GAP - ARROW_SIZE > 0,
|
|
67
|
-
right: triggerRect.right + popRect.width + GAP + ARROW_SIZE < viewW,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
if (!fits[placement]) {
|
|
71
|
-
const flip: Record<PopoverPlacement, PopoverPlacement> = {
|
|
72
|
-
top: 'bottom',
|
|
73
|
-
bottom: 'top',
|
|
74
|
-
left: 'right',
|
|
75
|
-
right: 'left',
|
|
76
|
-
};
|
|
77
|
-
if (fits[flip[placement]]) resolved = flip[placement];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
switch (resolved) {
|
|
81
|
-
case 'top':
|
|
82
|
-
top = triggerRect.top + scrollY - popRect.height - GAP - ARROW_SIZE;
|
|
83
|
-
left = triggerRect.left + scrollX + triggerRect.width / 2 - popRect.width / 2;
|
|
84
|
-
break;
|
|
85
|
-
case 'bottom':
|
|
86
|
-
top = triggerRect.bottom + scrollY + GAP + ARROW_SIZE;
|
|
87
|
-
left = triggerRect.left + scrollX + triggerRect.width / 2 - popRect.width / 2;
|
|
88
|
-
break;
|
|
89
|
-
case 'left':
|
|
90
|
-
top = triggerRect.top + scrollY + triggerRect.height / 2 - popRect.height / 2;
|
|
91
|
-
left = triggerRect.left + scrollX - popRect.width - GAP - ARROW_SIZE;
|
|
92
|
-
break;
|
|
93
|
-
case 'right':
|
|
94
|
-
top = triggerRect.top + scrollY + triggerRect.height / 2 - popRect.height / 2;
|
|
95
|
-
left = triggerRect.right + scrollX + GAP + ARROW_SIZE;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Clamp to viewport
|
|
100
|
-
left = Math.max(8, Math.min(left, viewW + scrollX - popRect.width - 8));
|
|
101
|
-
top = Math.max(8, Math.min(top, viewH + scrollY - popRect.height - 8));
|
|
102
|
-
|
|
103
|
-
// Arrow style
|
|
104
|
-
const arrowStyle: CSSProperties = {
|
|
105
|
-
position: 'absolute',
|
|
106
|
-
width: 0,
|
|
107
|
-
height: 0,
|
|
108
|
-
borderStyle: 'solid',
|
|
109
|
-
borderWidth: ARROW_SIZE,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
switch (resolved) {
|
|
113
|
-
case 'top':
|
|
114
|
-
Object.assign(arrowStyle, {
|
|
115
|
-
bottom: -ARROW_SIZE * 2,
|
|
116
|
-
left: '50%',
|
|
117
|
-
transform: 'translateX(-50%)',
|
|
118
|
-
borderColor: 'var(--tkx-popover-bg) transparent transparent transparent',
|
|
119
|
-
});
|
|
120
|
-
break;
|
|
121
|
-
case 'bottom':
|
|
122
|
-
Object.assign(arrowStyle, {
|
|
123
|
-
top: -ARROW_SIZE * 2,
|
|
124
|
-
left: '50%',
|
|
125
|
-
transform: 'translateX(-50%)',
|
|
126
|
-
borderColor: 'transparent transparent var(--tkx-popover-bg) transparent',
|
|
127
|
-
});
|
|
128
|
-
break;
|
|
129
|
-
case 'left':
|
|
130
|
-
Object.assign(arrowStyle, {
|
|
131
|
-
right: -ARROW_SIZE * 2,
|
|
132
|
-
top: '50%',
|
|
133
|
-
transform: 'translateY(-50%)',
|
|
134
|
-
borderColor: 'transparent transparent transparent var(--tkx-popover-bg)',
|
|
135
|
-
});
|
|
136
|
-
break;
|
|
137
|
-
case 'right':
|
|
138
|
-
Object.assign(arrowStyle, {
|
|
139
|
-
left: -ARROW_SIZE * 2,
|
|
140
|
-
top: '50%',
|
|
141
|
-
transform: 'translateY(-50%)',
|
|
142
|
-
borderColor: 'transparent var(--tkx-popover-bg) transparent transparent',
|
|
143
|
-
});
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return { top, left, arrowStyle, resolvedPlacement: resolved };
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// ── Component ───────────────────────────────────────────────────────────────
|
|
151
|
-
|
|
152
|
-
export function TkxPopover({
|
|
153
|
-
trigger,
|
|
154
|
-
content,
|
|
155
|
-
placement = 'bottom',
|
|
156
|
-
isOpen: controlledOpen,
|
|
157
|
-
onOpenChange,
|
|
158
|
-
closeOnClickOutside = true,
|
|
159
|
-
className,
|
|
160
|
-
style,
|
|
161
|
-
}: TkxPopoverProps) {
|
|
162
|
-
const theme = useTheme();
|
|
163
|
-
const reducedMotion = useReducedMotion();
|
|
164
|
-
const popoverId = useId();
|
|
165
|
-
|
|
166
|
-
const isControlled = controlledOpen !== undefined;
|
|
167
|
-
const [internalOpen, setInternalOpen] = useState(false);
|
|
168
|
-
const open = isControlled ? controlledOpen : internalOpen;
|
|
169
|
-
|
|
170
|
-
const triggerRef = useRef<HTMLDivElement>(null);
|
|
171
|
-
const popoverRef = useRef<HTMLDivElement>(null);
|
|
172
|
-
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
173
|
-
|
|
174
|
-
const [position, setPosition] = useState<PopoverPosition | null>(null);
|
|
175
|
-
|
|
176
|
-
const setOpen = useCallback(
|
|
177
|
-
(value: boolean) => {
|
|
178
|
-
if (!isControlled) setInternalOpen(value);
|
|
179
|
-
onOpenChange?.(value);
|
|
180
|
-
},
|
|
181
|
-
[isControlled, onOpenChange],
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
const close = useCallback(() => setOpen(false), [setOpen]);
|
|
185
|
-
const toggle = useCallback(() => setOpen(!open), [setOpen, open]);
|
|
186
|
-
|
|
187
|
-
useEscapeKey(close, open);
|
|
188
|
-
|
|
189
|
-
// Click outside
|
|
190
|
-
useEffect(() => {
|
|
191
|
-
if (!open || !closeOnClickOutside) return;
|
|
192
|
-
const handler = (e: PointerEvent) => {
|
|
193
|
-
const target = e.target as Node;
|
|
194
|
-
if (triggerRef.current?.contains(target)) return;
|
|
195
|
-
if (popoverRef.current?.contains(target)) return;
|
|
196
|
-
close();
|
|
197
|
-
};
|
|
198
|
-
document.addEventListener('pointerdown', handler);
|
|
199
|
-
return () => document.removeEventListener('pointerdown', handler);
|
|
200
|
-
}, [open, closeOnClickOutside, close]);
|
|
201
|
-
|
|
202
|
-
// Calculate position
|
|
203
|
-
useEffect(() => {
|
|
204
|
-
if (!open || !triggerRef.current) return;
|
|
205
|
-
|
|
206
|
-
const updatePosition = () => {
|
|
207
|
-
if (!triggerRef.current || !popoverRef.current) return;
|
|
208
|
-
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
209
|
-
setPosition(calcPosition(triggerRect, popoverRef.current, placement));
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
// Initial calc after portal mount
|
|
213
|
-
requestAnimationFrame(updatePosition);
|
|
214
|
-
|
|
215
|
-
window.addEventListener('scroll', updatePosition, true);
|
|
216
|
-
window.addEventListener('resize', updatePosition);
|
|
217
|
-
|
|
218
|
-
return () => {
|
|
219
|
-
window.removeEventListener('scroll', updatePosition, true);
|
|
220
|
-
window.removeEventListener('resize', updatePosition);
|
|
221
|
-
};
|
|
222
|
-
}, [open, placement]);
|
|
223
|
-
|
|
224
|
-
const animationStyle: CSSProperties = reducedMotion
|
|
225
|
-
? { opacity: 1 }
|
|
226
|
-
: {
|
|
227
|
-
animation: 'tkxPopoverFadeIn 150ms ease forwards',
|
|
228
|
-
opacity: 0,
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
const portalContent = open && typeof document !== 'undefined' ? (
|
|
232
|
-
createPortal(
|
|
233
|
-
<div
|
|
234
|
-
ref={popoverRef}
|
|
235
|
-
id={popoverId}
|
|
236
|
-
role="dialog"
|
|
237
|
-
aria-modal="false"
|
|
238
|
-
className={tkx(
|
|
239
|
-
'absolute z-[9100] rounded-lg font-sans',
|
|
240
|
-
className ?? '',
|
|
241
|
-
)}
|
|
242
|
-
style={{
|
|
243
|
-
'--tkx-popover-bg': theme.surface,
|
|
244
|
-
top: position?.top ?? -9999,
|
|
245
|
-
left: position?.left ?? -9999,
|
|
246
|
-
backgroundColor: theme.surface,
|
|
247
|
-
border: `1px solid ${theme.border}`,
|
|
248
|
-
boxShadow: `0 8px 24px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)`,
|
|
249
|
-
minWidth: 200,
|
|
250
|
-
maxWidth: 420,
|
|
251
|
-
padding: '12px 16px',
|
|
252
|
-
color: theme.text,
|
|
253
|
-
...animationStyle,
|
|
254
|
-
...style,
|
|
255
|
-
} as CSSProperties}
|
|
256
|
-
>
|
|
257
|
-
{/* Arrow */}
|
|
258
|
-
{position && <span style={position.arrowStyle} aria-hidden="true" />}
|
|
259
|
-
{content}
|
|
260
|
-
</div>,
|
|
261
|
-
document.body,
|
|
262
|
-
)
|
|
263
|
-
) : null;
|
|
264
|
-
|
|
265
|
-
return (
|
|
266
|
-
<>
|
|
267
|
-
<div
|
|
268
|
-
ref={triggerRef}
|
|
269
|
-
className={tkx('inline-flex')}
|
|
270
|
-
onClick={toggle}
|
|
271
|
-
onKeyDown={(e) => {
|
|
272
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
273
|
-
e.preventDefault();
|
|
274
|
-
toggle();
|
|
275
|
-
}
|
|
276
|
-
}}
|
|
277
|
-
aria-expanded={open}
|
|
278
|
-
aria-haspopup="dialog"
|
|
279
|
-
aria-controls={open ? popoverId : undefined}
|
|
280
|
-
>
|
|
281
|
-
{trigger}
|
|
282
|
-
</div>
|
|
283
|
-
{portalContent}
|
|
284
|
-
{/* Inject animation keyframes */}
|
|
285
|
-
{open && !reducedMotion && (
|
|
286
|
-
<style>{`
|
|
287
|
-
@keyframes tkxPopoverFadeIn {
|
|
288
|
-
from { opacity: 0; transform: translateY(4px); }
|
|
289
|
-
to { opacity: 1; transform: translateY(0); }
|
|
290
|
-
}
|
|
291
|
-
`}</style>
|
|
292
|
-
)}
|
|
293
|
-
</>
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
export default TkxPopover;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { forwardRef, type HTMLAttributes } 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 ProgressVariant = 'linear' | 'circular';
|
|
10
|
-
export type ProgressSize = 'sm' | 'md' | 'lg';
|
|
11
|
-
|
|
12
|
-
export interface TkxProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
|
-
value?: number;
|
|
14
|
-
variant?: ProgressVariant;
|
|
15
|
-
size?: ProgressSize;
|
|
16
|
-
label?: string;
|
|
17
|
-
showValue?: boolean;
|
|
18
|
-
color?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const LINEAR_H: Record<ProgressSize, string> = { sm: '4px', md: '8px', lg: '12px' };
|
|
22
|
-
const CIRCLE_PX: Record<ProgressSize, number> = { sm: 32, md: 48, lg: 64 };
|
|
23
|
-
|
|
24
|
-
export const TkxProgress = forwardRef<HTMLDivElement, TkxProgressProps>(
|
|
25
|
-
({ value, variant = 'linear', size = 'md', label, showValue, color, className, style, ...rest }, ref) => {
|
|
26
|
-
const theme = useTheme();
|
|
27
|
-
const reducedMotion = useReducedMotion();
|
|
28
|
-
const fillColor = color ?? theme.primary;
|
|
29
|
-
const isIndeterminate = value === undefined;
|
|
30
|
-
const clamped = value !== undefined ? Math.min(100, Math.max(0, value)) : 0;
|
|
31
|
-
|
|
32
|
-
if (value !== undefined) {
|
|
33
|
-
const { errors } = validateProps({ value }, { value: { type: 'number', min: 0, max: 100 } });
|
|
34
|
-
if (errors.length > 0) {
|
|
35
|
-
// eslint-disable-next-line no-console
|
|
36
|
-
console.warn('[TkxProgress]', errors.join(', '));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (variant === 'circular') {
|
|
41
|
-
const px = CIRCLE_PX[size];
|
|
42
|
-
const strokeW = size === 'sm' ? 3 : size === 'md' ? 4 : 5;
|
|
43
|
-
const r = (px - strokeW * 2) / 2;
|
|
44
|
-
const circ = 2 * Math.PI * r;
|
|
45
|
-
const offset = isIndeterminate ? 0 : circ - (clamped / 100) * circ;
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<div
|
|
49
|
-
ref={ref}
|
|
50
|
-
role="progressbar"
|
|
51
|
-
aria-valuemin={0}
|
|
52
|
-
aria-valuemax={100}
|
|
53
|
-
aria-valuenow={isIndeterminate ? undefined : clamped}
|
|
54
|
-
aria-label={label ?? (isIndeterminate ? 'Loading' : `${clamped}%`)}
|
|
55
|
-
className={cx(tkx('inline-flex flex-col items-center gap-1'), className)}
|
|
56
|
-
style={style}
|
|
57
|
-
>
|
|
58
|
-
<svg width={px} height={px} viewBox={`0 0 ${px} ${px}`} aria-hidden="true">
|
|
59
|
-
<circle cx={px / 2} cy={px / 2} r={r} fill="none" stroke={theme.border} strokeWidth={strokeW} />
|
|
60
|
-
<circle
|
|
61
|
-
cx={px / 2} cy={px / 2} r={r} fill="none"
|
|
62
|
-
stroke={fillColor} strokeWidth={strokeW} strokeLinecap="round"
|
|
63
|
-
strokeDasharray={circ} strokeDashoffset={offset}
|
|
64
|
-
transform={`rotate(-90 ${px / 2} ${px / 2})`}
|
|
65
|
-
style={{
|
|
66
|
-
transition: reducedMotion ? 'none' : 'stroke-dashoffset 300ms ease',
|
|
67
|
-
animation: isIndeterminate && !reducedMotion ? 'tkx-spin 1s linear infinite' : undefined,
|
|
68
|
-
}}
|
|
69
|
-
/>
|
|
70
|
-
</svg>
|
|
71
|
-
{showValue && !isIndeterminate && (
|
|
72
|
-
<span className={tkx('text-xs')} style={{ color: theme.textMuted }}>{clamped}%</span>
|
|
73
|
-
)}
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const h = LINEAR_H[size];
|
|
79
|
-
return (
|
|
80
|
-
<div
|
|
81
|
-
ref={ref}
|
|
82
|
-
role="progressbar"
|
|
83
|
-
aria-valuemin={0}
|
|
84
|
-
aria-valuemax={100}
|
|
85
|
-
aria-valuenow={isIndeterminate ? undefined : clamped}
|
|
86
|
-
aria-label={label ?? (isIndeterminate ? 'Loading' : `${clamped}%`)}
|
|
87
|
-
className={cx(tkx('flex flex-col gap-1 w-full'), className)}
|
|
88
|
-
style={style}
|
|
89
|
-
>
|
|
90
|
-
{label && (
|
|
91
|
-
<div className={tkx('flex justify-between text-sm')} style={{ color: theme.text }}>
|
|
92
|
-
<span>{label}</span>
|
|
93
|
-
{showValue && !isIndeterminate && <span>{clamped}%</span>}
|
|
94
|
-
</div>
|
|
95
|
-
)}
|
|
96
|
-
<div
|
|
97
|
-
className={tkx('w-full overflow-hidden')}
|
|
98
|
-
style={{ height: h, borderRadius: h, backgroundColor: theme.border }}
|
|
99
|
-
>
|
|
100
|
-
<div
|
|
101
|
-
style={{
|
|
102
|
-
height: '100%', borderRadius: h, backgroundColor: fillColor,
|
|
103
|
-
width: isIndeterminate ? '40%' : `${clamped}%`,
|
|
104
|
-
transition: reducedMotion ? 'none' : 'width 300ms ease',
|
|
105
|
-
animation: isIndeterminate && !reducedMotion ? 'tkx-shimmer 1.5s ease-in-out infinite' : undefined,
|
|
106
|
-
}}
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
},
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
TkxProgress.displayName = 'TkxProgress';
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useRef, useEffect, useMemo } from 'react';
|
|
4
|
-
import { useTheme } from '../themes';
|
|
5
|
-
import { sanitizeString } from '../engine/security';
|
|
6
|
-
import { useReducedMotion } from '../hooks';
|
|
7
|
-
import { tkx } from '../engine/tkx';
|
|
8
|
-
|
|
9
|
-
// ── Types ────────────────────────────────────────────────────────────────────
|
|
10
|
-
|
|
11
|
-
export interface TkxQRCodeProps {
|
|
12
|
-
value: string;
|
|
13
|
-
size?: number;
|
|
14
|
-
color?: string;
|
|
15
|
-
bgColor?: string;
|
|
16
|
-
errorLevel?: 'L' | 'M' | 'Q' | 'H';
|
|
17
|
-
icon?: string;
|
|
18
|
-
bordered?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// ── Hash Utility ─────────────────────────────────────────────────────────────
|
|
22
|
-
|
|
23
|
-
function simpleHash(str: string): number {
|
|
24
|
-
let hash = 5381;
|
|
25
|
-
for (let i = 0; i < str.length; i++) {
|
|
26
|
-
hash = ((hash << 5) + hash + str.charCodeAt(i)) | 0;
|
|
27
|
-
}
|
|
28
|
-
return Math.abs(hash);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Deterministic PRNG from seed
|
|
32
|
-
function seededRandom(seed: number): () => number {
|
|
33
|
-
let s = seed;
|
|
34
|
-
return () => {
|
|
35
|
-
s = (s * 1664525 + 1013904223) | 0;
|
|
36
|
-
return ((s >>> 0) / 0xffffffff);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// ── Grid Generator ───────────────────────────────────────────────────────────
|
|
41
|
-
|
|
42
|
-
const ERROR_DENSITY: Record<string, number> = { L: 0.38, M: 0.42, Q: 0.48, H: 0.55 };
|
|
43
|
-
|
|
44
|
-
function generateGrid(value: string, gridSize: number, errorLevel: string): boolean[][] {
|
|
45
|
-
const hash = simpleHash(value);
|
|
46
|
-
const rand = seededRandom(hash);
|
|
47
|
-
const density = ERROR_DENSITY[errorLevel] ?? 0.42;
|
|
48
|
-
const grid: boolean[][] = Array.from({ length: gridSize }, () =>
|
|
49
|
-
Array.from({ length: gridSize }, () => false),
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
// Finder patterns (top-left, top-right, bottom-left)
|
|
53
|
-
const drawFinder = (startR: number, startC: number) => {
|
|
54
|
-
for (let r = 0; r < 7; r++) {
|
|
55
|
-
for (let c = 0; c < 7; c++) {
|
|
56
|
-
const isEdge = r === 0 || r === 6 || c === 0 || c === 6;
|
|
57
|
-
const isInner = r >= 2 && r <= 4 && c >= 2 && c <= 4;
|
|
58
|
-
grid[startR + r][startC + c] = isEdge || isInner;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
drawFinder(0, 0);
|
|
64
|
-
drawFinder(0, gridSize - 7);
|
|
65
|
-
drawFinder(gridSize - 7, 0);
|
|
66
|
-
|
|
67
|
-
// Timing patterns
|
|
68
|
-
for (let i = 7; i < gridSize - 7; i++) {
|
|
69
|
-
grid[6][i] = i % 2 === 0;
|
|
70
|
-
grid[i][6] = i % 2 === 0;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Data area: fill with deterministic pseudo-random pattern
|
|
74
|
-
for (let r = 0; r < gridSize; r++) {
|
|
75
|
-
for (let c = 0; c < gridSize; c++) {
|
|
76
|
-
const inFinder =
|
|
77
|
-
(r < 8 && c < 8) ||
|
|
78
|
-
(r < 8 && c >= gridSize - 8) ||
|
|
79
|
-
(r >= gridSize - 8 && c < 8);
|
|
80
|
-
const isTiming = r === 6 || c === 6;
|
|
81
|
-
if (inFinder || isTiming) continue;
|
|
82
|
-
grid[r][c] = rand() < density;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return grid;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// ── Component ────────────────────────────────────────────────────────────────
|
|
90
|
-
|
|
91
|
-
export function TkxQRCode({
|
|
92
|
-
value,
|
|
93
|
-
size = 160,
|
|
94
|
-
color,
|
|
95
|
-
bgColor,
|
|
96
|
-
errorLevel = 'M',
|
|
97
|
-
icon,
|
|
98
|
-
bordered = true,
|
|
99
|
-
}: TkxQRCodeProps) {
|
|
100
|
-
const theme = useTheme();
|
|
101
|
-
const reducedMotion = useReducedMotion();
|
|
102
|
-
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
103
|
-
const safeValue = sanitizeString(value);
|
|
104
|
-
const fg = color ?? theme.text;
|
|
105
|
-
const bg = bgColor ?? theme.surface;
|
|
106
|
-
|
|
107
|
-
const gridSize = 25;
|
|
108
|
-
const grid = useMemo(
|
|
109
|
-
() => generateGrid(safeValue, gridSize, errorLevel),
|
|
110
|
-
[safeValue, errorLevel],
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
const canvas = canvasRef.current;
|
|
115
|
-
if (!canvas) return;
|
|
116
|
-
const ctx = canvas.getContext('2d');
|
|
117
|
-
if (!ctx) return;
|
|
118
|
-
|
|
119
|
-
const dpr = window.devicePixelRatio || 1;
|
|
120
|
-
canvas.width = size * dpr;
|
|
121
|
-
canvas.height = size * dpr;
|
|
122
|
-
ctx.scale(dpr, dpr);
|
|
123
|
-
|
|
124
|
-
const cellSize = size / gridSize;
|
|
125
|
-
|
|
126
|
-
// Background
|
|
127
|
-
ctx.fillStyle = bg;
|
|
128
|
-
ctx.fillRect(0, 0, size, size);
|
|
129
|
-
|
|
130
|
-
// Cells
|
|
131
|
-
ctx.fillStyle = fg;
|
|
132
|
-
for (let r = 0; r < gridSize; r++) {
|
|
133
|
-
for (let c = 0; c < gridSize; c++) {
|
|
134
|
-
if (grid[r][c]) {
|
|
135
|
-
ctx.fillRect(c * cellSize, r * cellSize, cellSize, cellSize);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Center icon area (clear a zone for icon)
|
|
141
|
-
if (icon) {
|
|
142
|
-
const iconSize = size * 0.22;
|
|
143
|
-
const offset = (size - iconSize) / 2;
|
|
144
|
-
ctx.fillStyle = bg;
|
|
145
|
-
ctx.fillRect(offset - 2, offset - 2, iconSize + 4, iconSize + 4);
|
|
146
|
-
|
|
147
|
-
const img = new Image();
|
|
148
|
-
img.crossOrigin = 'anonymous';
|
|
149
|
-
img.onload = () => {
|
|
150
|
-
ctx.drawImage(img, offset, offset, iconSize, iconSize);
|
|
151
|
-
};
|
|
152
|
-
img.src = sanitizeString(icon);
|
|
153
|
-
}
|
|
154
|
-
}, [grid, size, fg, bg, icon]);
|
|
155
|
-
|
|
156
|
-
return (
|
|
157
|
-
<div
|
|
158
|
-
role="img"
|
|
159
|
-
aria-label={`QR code for: ${safeValue}`}
|
|
160
|
-
className={tkx('inline-block rounded-lg')}
|
|
161
|
-
style={{
|
|
162
|
-
padding: bordered ? 12 : 0,
|
|
163
|
-
backgroundColor: bordered ? bg : 'transparent',
|
|
164
|
-
border: bordered ? `1px solid ${theme.border}` : 'none',
|
|
165
|
-
lineHeight: 0,
|
|
166
|
-
animation: reducedMotion ? 'none' : 'tkxFadeIn 0.2s ease',
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
<canvas
|
|
170
|
-
ref={canvasRef}
|
|
171
|
-
aria-hidden="true"
|
|
172
|
-
style={{ width: size, height: size, display: 'block' }}
|
|
173
|
-
/>
|
|
174
|
-
</div>
|
|
175
|
-
);
|
|
176
|
-
}
|