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,140 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type ReactNode, useState, useRef, useEffect, useCallback, 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 TkxAffixProps {
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
offsetTop?: number;
|
|
14
|
-
offsetBottom?: number;
|
|
15
|
-
onChange?: (affixed: boolean) => void;
|
|
16
|
-
target?: () => HTMLElement | Window;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
20
|
-
|
|
21
|
-
function getScrollTarget(target?: () => HTMLElement | Window): HTMLElement | Window {
|
|
22
|
-
if (target) {
|
|
23
|
-
try {
|
|
24
|
-
return target();
|
|
25
|
-
} catch {
|
|
26
|
-
return window;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return window;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function getTargetRect(el: HTMLElement | Window): { top: number; bottom: number } {
|
|
33
|
-
if (el instanceof Window) {
|
|
34
|
-
return { top: 0, bottom: el.innerHeight };
|
|
35
|
-
}
|
|
36
|
-
const rect = el.getBoundingClientRect();
|
|
37
|
-
return { top: rect.top, bottom: rect.bottom };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// ── Component ────────────────────────────────────────────────────────────────
|
|
41
|
-
|
|
42
|
-
export function TkxAffix({
|
|
43
|
-
children,
|
|
44
|
-
offsetTop,
|
|
45
|
-
offsetBottom,
|
|
46
|
-
onChange,
|
|
47
|
-
target,
|
|
48
|
-
}: TkxAffixProps) {
|
|
49
|
-
const theme = useTheme();
|
|
50
|
-
const reducedMotion = useReducedMotion();
|
|
51
|
-
const placeholderRef = useRef<HTMLDivElement>(null);
|
|
52
|
-
const fixedRef = useRef<HTMLDivElement>(null);
|
|
53
|
-
const [affixed, setAffixed] = useState(false);
|
|
54
|
-
const [placeholderSize, setPlaceholderSize] = useState({ width: 0, height: 0 });
|
|
55
|
-
const prevAffixed = useRef(false);
|
|
56
|
-
|
|
57
|
-
// Sanitize any debug info strings for security
|
|
58
|
-
const _labelSafe = useMemo(() => sanitizeString('Sticky content'), []);
|
|
59
|
-
|
|
60
|
-
const checkPosition = useCallback(() => {
|
|
61
|
-
const el = placeholderRef.current;
|
|
62
|
-
if (!el) return;
|
|
63
|
-
|
|
64
|
-
const rect = el.getBoundingClientRect();
|
|
65
|
-
const targetRect = getTargetRect(getScrollTarget(target));
|
|
66
|
-
let shouldAffix = false;
|
|
67
|
-
|
|
68
|
-
if (offsetTop !== undefined) {
|
|
69
|
-
// Affix when element scrolls past the top offset
|
|
70
|
-
shouldAffix = rect.top - targetRect.top <= offsetTop;
|
|
71
|
-
} else if (offsetBottom !== undefined) {
|
|
72
|
-
// Affix when element scrolls past the bottom offset
|
|
73
|
-
shouldAffix = targetRect.bottom - rect.bottom <= offsetBottom;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (shouldAffix !== prevAffixed.current) {
|
|
77
|
-
prevAffixed.current = shouldAffix;
|
|
78
|
-
setAffixed(shouldAffix);
|
|
79
|
-
setPlaceholderSize({
|
|
80
|
-
width: rect.width,
|
|
81
|
-
height: rect.height,
|
|
82
|
-
});
|
|
83
|
-
onChange?.(shouldAffix);
|
|
84
|
-
}
|
|
85
|
-
}, [offsetTop, offsetBottom, onChange, target]);
|
|
86
|
-
|
|
87
|
-
// Attach scroll and resize listeners
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
const scrollTarget = getScrollTarget(target);
|
|
90
|
-
|
|
91
|
-
checkPosition();
|
|
92
|
-
scrollTarget.addEventListener('scroll', checkPosition, { passive: true });
|
|
93
|
-
window.addEventListener('resize', checkPosition);
|
|
94
|
-
|
|
95
|
-
return () => {
|
|
96
|
-
scrollTarget.removeEventListener('scroll', checkPosition);
|
|
97
|
-
window.removeEventListener('resize', checkPosition);
|
|
98
|
-
};
|
|
99
|
-
}, [checkPosition, target]);
|
|
100
|
-
|
|
101
|
-
// Build the fixed positioning styles
|
|
102
|
-
const fixedStyle: React.CSSProperties = affixed
|
|
103
|
-
? {
|
|
104
|
-
position: 'fixed',
|
|
105
|
-
zIndex: 100,
|
|
106
|
-
...(offsetTop !== undefined ? { top: offsetTop } : {}),
|
|
107
|
-
...(offsetBottom !== undefined ? { bottom: offsetBottom } : {}),
|
|
108
|
-
width: placeholderSize.width || undefined,
|
|
109
|
-
transition: reducedMotion ? 'none' : 'box-shadow 0.2s ease',
|
|
110
|
-
boxShadow: `0 2px 8px ${theme.border}`,
|
|
111
|
-
}
|
|
112
|
-
: {};
|
|
113
|
-
|
|
114
|
-
// Placeholder keeps the document flow intact when element is fixed
|
|
115
|
-
const placeholderStyle: React.CSSProperties = affixed
|
|
116
|
-
? {
|
|
117
|
-
height: placeholderSize.height,
|
|
118
|
-
width: placeholderSize.width,
|
|
119
|
-
}
|
|
120
|
-
: {};
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<>
|
|
124
|
-
<div
|
|
125
|
-
ref={placeholderRef}
|
|
126
|
-
aria-hidden={affixed}
|
|
127
|
-
style={placeholderStyle}
|
|
128
|
-
/>
|
|
129
|
-
<div
|
|
130
|
-
ref={fixedRef}
|
|
131
|
-
role="region"
|
|
132
|
-
aria-label={_labelSafe}
|
|
133
|
-
className={tkx(affixed ? 'tkx-affixed' : '')}
|
|
134
|
-
style={fixedStyle}
|
|
135
|
-
>
|
|
136
|
-
{children}
|
|
137
|
-
</div>
|
|
138
|
-
</>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type ReactNode, useEffect } from 'react';
|
|
4
|
-
import { useTheme } from '../themes';
|
|
5
|
-
import { sanitizeString } from '../engine/security';
|
|
6
|
-
import { useAnnounce } from '../hooks';
|
|
7
|
-
import { tkx } from '../engine/tkx';
|
|
8
|
-
|
|
9
|
-
export type AlertVariant = 'info' | 'success' | 'warning' | 'danger';
|
|
10
|
-
|
|
11
|
-
export interface TkxAlertProps {
|
|
12
|
-
variant: AlertVariant;
|
|
13
|
-
title?: string;
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
dismissible?: boolean;
|
|
16
|
-
onDismiss?: () => void;
|
|
17
|
-
icon?: ReactNode;
|
|
18
|
-
style?: React.CSSProperties;
|
|
19
|
-
className?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const ICONS: Record<AlertVariant, ReactNode> = {
|
|
23
|
-
info: (
|
|
24
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
25
|
-
<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" />
|
|
26
|
-
</svg>
|
|
27
|
-
),
|
|
28
|
-
success: (
|
|
29
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
30
|
-
<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" />
|
|
31
|
-
</svg>
|
|
32
|
-
),
|
|
33
|
-
warning: (
|
|
34
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
35
|
-
<path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" />
|
|
36
|
-
</svg>
|
|
37
|
-
),
|
|
38
|
-
danger: (
|
|
39
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
40
|
-
<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" />
|
|
41
|
-
</svg>
|
|
42
|
-
),
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export function TkxAlert({ variant, title, children, dismissible, onDismiss, icon, style, className }: TkxAlertProps) {
|
|
46
|
-
const theme = useTheme();
|
|
47
|
-
const announce = useAnnounce();
|
|
48
|
-
const safeTitle = title ? sanitizeString(title) : undefined;
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (safeTitle) {
|
|
52
|
-
announce(safeTitle, variant === 'danger' || variant === 'warning' ? 'assertive' : 'polite');
|
|
53
|
-
}
|
|
54
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
|
-
}, [safeTitle, variant]);
|
|
56
|
-
|
|
57
|
-
const colorMap: Record<AlertVariant, string> = {
|
|
58
|
-
info: theme.info, success: theme.success, warning: theme.warning, danger: theme.danger,
|
|
59
|
-
};
|
|
60
|
-
const accentColor = colorMap[variant];
|
|
61
|
-
const role = variant === 'danger' || variant === 'warning' ? 'alert' : 'status';
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div
|
|
65
|
-
role={role}
|
|
66
|
-
className={tkx('flex items-start gap-3 px-4 py-3 rounded-lg border animate-fade-in font-sans', className ?? '')}
|
|
67
|
-
style={{ backgroundColor: `${accentColor}18`, borderColor: accentColor, color: theme.text, ...style }}
|
|
68
|
-
>
|
|
69
|
-
<span className={tkx('shrink-0 mt-[1px]')} style={{ color: accentColor }}>
|
|
70
|
-
{icon ?? ICONS[variant]}
|
|
71
|
-
</span>
|
|
72
|
-
|
|
73
|
-
<div className={tkx('flex-1 min-w-0')}>
|
|
74
|
-
{safeTitle && (
|
|
75
|
-
<p className={tkx('m-0 font-semibold text-sm mb-1')}>{safeTitle}</p>
|
|
76
|
-
)}
|
|
77
|
-
<div className={tkx('text-sm leading-relaxed')}>{children}</div>
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
{dismissible && onDismiss && (
|
|
81
|
-
<button
|
|
82
|
-
aria-label="Dismiss alert"
|
|
83
|
-
onClick={onDismiss}
|
|
84
|
-
className={tkx('bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring')}
|
|
85
|
-
style={{ color: theme.textMuted }}
|
|
86
|
-
>
|
|
87
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} aria-hidden="true">
|
|
88
|
-
<line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
|
|
89
|
-
</svg>
|
|
90
|
-
</button>
|
|
91
|
-
)}
|
|
92
|
-
</div>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useState, useEffect, useCallback, useRef } 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 AnchorLink {
|
|
12
|
-
key: string;
|
|
13
|
-
href: string;
|
|
14
|
-
title: string;
|
|
15
|
-
children?: AnchorLink[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface TkxAnchorProps {
|
|
19
|
-
items: AnchorLink[];
|
|
20
|
-
offsetTop?: number;
|
|
21
|
-
getCurrentAnchor?: (activeLink: string) => string;
|
|
22
|
-
onChange?: (currentLink: string) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
26
|
-
|
|
27
|
-
function flattenLinks(items: AnchorLink[]): AnchorLink[] {
|
|
28
|
-
const result: AnchorLink[] = [];
|
|
29
|
-
for (const item of items) {
|
|
30
|
-
result.push(item);
|
|
31
|
-
if (item.children) result.push(...flattenLinks(item.children));
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function getAnchorId(href: string): string {
|
|
37
|
-
return href.startsWith('#') ? href.slice(1) : href;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// ── Link Item ────────────────────────────────────────────────────────────────
|
|
41
|
-
|
|
42
|
-
function AnchorItem({
|
|
43
|
-
item,
|
|
44
|
-
activeKey,
|
|
45
|
-
depth,
|
|
46
|
-
onClick,
|
|
47
|
-
theme,
|
|
48
|
-
reducedMotion,
|
|
49
|
-
}: {
|
|
50
|
-
item: AnchorLink;
|
|
51
|
-
activeKey: string;
|
|
52
|
-
depth: number;
|
|
53
|
-
onClick: (href: string) => void;
|
|
54
|
-
theme: ReturnType<typeof useTheme>;
|
|
55
|
-
reducedMotion: boolean;
|
|
56
|
-
}) {
|
|
57
|
-
const isActive = item.key === activeKey;
|
|
58
|
-
const safeTitle = sanitizeString(item.title);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<li role="none" style={{ listStyle: 'none' }}>
|
|
62
|
-
<a
|
|
63
|
-
role="treeitem"
|
|
64
|
-
aria-current={isActive ? 'location' : undefined}
|
|
65
|
-
href={item.href}
|
|
66
|
-
onClick={(e) => {
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
onClick(item.href);
|
|
69
|
-
}}
|
|
70
|
-
className={tkx('block text-sm py-1 no-underline')}
|
|
71
|
-
style={{
|
|
72
|
-
paddingLeft: 12 + depth * 16,
|
|
73
|
-
color: isActive ? theme.primary : theme.textMuted,
|
|
74
|
-
fontWeight: isActive ? 600 : 400,
|
|
75
|
-
borderLeft: `2px solid ${isActive ? theme.primary : 'transparent'}`,
|
|
76
|
-
transition: reducedMotion ? 'none' : 'color 0.15s ease, border-color 0.15s ease',
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
{safeTitle}
|
|
80
|
-
</a>
|
|
81
|
-
{item.children && item.children.length > 0 && (
|
|
82
|
-
<ul role="group" style={{ margin: 0, padding: 0 }}>
|
|
83
|
-
{item.children.map((child) => (
|
|
84
|
-
<AnchorItem
|
|
85
|
-
key={child.key}
|
|
86
|
-
item={child}
|
|
87
|
-
activeKey={activeKey}
|
|
88
|
-
depth={depth + 1}
|
|
89
|
-
onClick={onClick}
|
|
90
|
-
theme={theme}
|
|
91
|
-
reducedMotion={reducedMotion}
|
|
92
|
-
/>
|
|
93
|
-
))}
|
|
94
|
-
</ul>
|
|
95
|
-
)}
|
|
96
|
-
</li>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ── Component ────────────────────────────────────────────────────────────────
|
|
101
|
-
|
|
102
|
-
export function TkxAnchor({
|
|
103
|
-
items,
|
|
104
|
-
offsetTop = 0,
|
|
105
|
-
getCurrentAnchor,
|
|
106
|
-
onChange,
|
|
107
|
-
}: TkxAnchorProps) {
|
|
108
|
-
const theme = useTheme();
|
|
109
|
-
const reducedMotion = useReducedMotion();
|
|
110
|
-
const [activeKey, setActiveKey] = useState(items[0]?.key ?? '');
|
|
111
|
-
const isScrolling = useRef(false);
|
|
112
|
-
|
|
113
|
-
const flat = flattenLinks(items);
|
|
114
|
-
|
|
115
|
-
const updateActive = useCallback(() => {
|
|
116
|
-
if (isScrolling.current) return;
|
|
117
|
-
|
|
118
|
-
let current = flat[0]?.key ?? '';
|
|
119
|
-
for (const link of flat) {
|
|
120
|
-
const id = getAnchorId(link.href);
|
|
121
|
-
const el = document.getElementById(id);
|
|
122
|
-
if (el) {
|
|
123
|
-
const top = el.getBoundingClientRect().top;
|
|
124
|
-
if (top <= offsetTop + 10) {
|
|
125
|
-
current = link.key;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (getCurrentAnchor) {
|
|
131
|
-
current = getCurrentAnchor(current);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (current !== activeKey) {
|
|
135
|
-
setActiveKey(current);
|
|
136
|
-
onChange?.(current);
|
|
137
|
-
}
|
|
138
|
-
}, [flat, offsetTop, getCurrentAnchor, activeKey, onChange]);
|
|
139
|
-
|
|
140
|
-
useEffect(() => {
|
|
141
|
-
window.addEventListener('scroll', updateActive, { passive: true });
|
|
142
|
-
updateActive();
|
|
143
|
-
return () => window.removeEventListener('scroll', updateActive);
|
|
144
|
-
}, [updateActive]);
|
|
145
|
-
|
|
146
|
-
const handleClick = useCallback(
|
|
147
|
-
(href: string) => {
|
|
148
|
-
const id = getAnchorId(href);
|
|
149
|
-
const el = document.getElementById(id);
|
|
150
|
-
if (!el) return;
|
|
151
|
-
|
|
152
|
-
isScrolling.current = true;
|
|
153
|
-
const top = el.getBoundingClientRect().top + window.scrollY - offsetTop;
|
|
154
|
-
window.scrollTo({ top, behavior: reducedMotion ? 'auto' : 'smooth' });
|
|
155
|
-
|
|
156
|
-
// Find the link by href and set active
|
|
157
|
-
const link = flat.find((l) => l.href === href);
|
|
158
|
-
if (link) {
|
|
159
|
-
setActiveKey(link.key);
|
|
160
|
-
onChange?.(link.key);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
setTimeout(() => {
|
|
164
|
-
isScrolling.current = false;
|
|
165
|
-
}, 800);
|
|
166
|
-
},
|
|
167
|
-
[flat, offsetTop, reducedMotion, onChange],
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
return (
|
|
171
|
-
<nav
|
|
172
|
-
role="tree"
|
|
173
|
-
aria-label="Anchor navigation"
|
|
174
|
-
className={tkx('font-sans')}
|
|
175
|
-
style={{
|
|
176
|
-
borderLeft: `1px solid ${theme.border}`,
|
|
177
|
-
padding: '4px 0',
|
|
178
|
-
}}
|
|
179
|
-
>
|
|
180
|
-
<ul role="group" style={{ margin: 0, padding: 0 }}>
|
|
181
|
-
{items.map((item) => (
|
|
182
|
-
<AnchorItem
|
|
183
|
-
key={item.key}
|
|
184
|
-
item={item}
|
|
185
|
-
activeKey={activeKey}
|
|
186
|
-
depth={0}
|
|
187
|
-
onClick={handleClick}
|
|
188
|
-
theme={theme}
|
|
189
|
-
reducedMotion={reducedMotion}
|
|
190
|
-
/>
|
|
191
|
-
))}
|
|
192
|
-
</ul>
|
|
193
|
-
</nav>
|
|
194
|
-
);
|
|
195
|
-
}
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
useState,
|
|
5
|
-
useEffect,
|
|
6
|
-
useCallback,
|
|
7
|
-
useRef,
|
|
8
|
-
useId,
|
|
9
|
-
type ReactNode,
|
|
10
|
-
type CSSProperties,
|
|
11
|
-
} from 'react';
|
|
12
|
-
import { useTheme } from '../themes';
|
|
13
|
-
import { sanitizeString } from '../engine/security';
|
|
14
|
-
import { useReducedMotion, useEscapeKey } from '../hooks';
|
|
15
|
-
import { tkx } from '../engine/tkx';
|
|
16
|
-
|
|
17
|
-
// ── Types ─────────────────────────────────────────────────────────────────────
|
|
18
|
-
|
|
19
|
-
export interface TkxAppBarProps {
|
|
20
|
-
title?: ReactNode;
|
|
21
|
-
logo?: ReactNode;
|
|
22
|
-
actions?: ReactNode;
|
|
23
|
-
navigation?: ReactNode;
|
|
24
|
-
position?: 'fixed' | 'sticky' | 'static';
|
|
25
|
-
variant?: 'default' | 'transparent' | 'elevated';
|
|
26
|
-
color?: 'primary' | 'surface';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ── Constants ─────────────────────────────────────────────────────────────────
|
|
30
|
-
|
|
31
|
-
const MOBILE_BREAKPOINT = 768;
|
|
32
|
-
const BAR_HEIGHT = 56;
|
|
33
|
-
|
|
34
|
-
// ── Hamburger icon ──────────────────────────────────────────────────────────
|
|
35
|
-
|
|
36
|
-
function HamburgerIcon({ open }: { open: boolean }) {
|
|
37
|
-
return (
|
|
38
|
-
<svg
|
|
39
|
-
width="24"
|
|
40
|
-
height="24"
|
|
41
|
-
viewBox="0 0 24 24"
|
|
42
|
-
fill="none"
|
|
43
|
-
stroke="currentColor"
|
|
44
|
-
strokeWidth={2}
|
|
45
|
-
strokeLinecap="round"
|
|
46
|
-
aria-hidden="true"
|
|
47
|
-
>
|
|
48
|
-
{open ? (
|
|
49
|
-
<>
|
|
50
|
-
<line x1="18" y1="6" x2="6" y2="18" />
|
|
51
|
-
<line x1="6" y1="6" x2="18" y2="18" />
|
|
52
|
-
</>
|
|
53
|
-
) : (
|
|
54
|
-
<>
|
|
55
|
-
<line x1="3" y1="6" x2="21" y2="6" />
|
|
56
|
-
<line x1="3" y1="12" x2="21" y2="12" />
|
|
57
|
-
<line x1="3" y1="18" x2="21" y2="18" />
|
|
58
|
-
</>
|
|
59
|
-
)}
|
|
60
|
-
</svg>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ── Breakpoint hook ─────────────────────────────────────────────────────────
|
|
65
|
-
|
|
66
|
-
function useIsMobile(): boolean {
|
|
67
|
-
const [isMobile, setIsMobile] = useState(() => {
|
|
68
|
-
if (typeof window === 'undefined') return false;
|
|
69
|
-
return window.innerWidth < MOBILE_BREAKPOINT;
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
if (typeof window === 'undefined') return;
|
|
74
|
-
const handler = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
75
|
-
window.addEventListener('resize', handler);
|
|
76
|
-
return () => window.removeEventListener('resize', handler);
|
|
77
|
-
}, []);
|
|
78
|
-
|
|
79
|
-
return isMobile;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// ── Component ─────────────────────────────────────────────────────────────────
|
|
83
|
-
|
|
84
|
-
export function TkxAppBar({
|
|
85
|
-
title,
|
|
86
|
-
logo,
|
|
87
|
-
actions,
|
|
88
|
-
navigation,
|
|
89
|
-
position = 'sticky',
|
|
90
|
-
variant = 'default',
|
|
91
|
-
color = 'surface',
|
|
92
|
-
}: TkxAppBarProps) {
|
|
93
|
-
const theme = useTheme();
|
|
94
|
-
const reduced = useReducedMotion();
|
|
95
|
-
const isMobile = useIsMobile();
|
|
96
|
-
const [menuOpen, setMenuOpen] = useState(false);
|
|
97
|
-
const menuRef = useRef<HTMLDivElement>(null);
|
|
98
|
-
const navId = useId();
|
|
99
|
-
|
|
100
|
-
// Close mobile menu on escape
|
|
101
|
-
useEscapeKey(() => setMenuOpen(false), menuOpen);
|
|
102
|
-
|
|
103
|
-
// Close on resize to desktop
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
if (!isMobile && menuOpen) setMenuOpen(false);
|
|
106
|
-
}, [isMobile, menuOpen]);
|
|
107
|
-
|
|
108
|
-
// Close on outside click
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (!menuOpen) return;
|
|
111
|
-
const handler = (e: PointerEvent) => {
|
|
112
|
-
if (menuRef.current && !menuRef.current.contains(e.target as Node)) {
|
|
113
|
-
setMenuOpen(false);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
document.addEventListener('pointerdown', handler);
|
|
117
|
-
return () => document.removeEventListener('pointerdown', handler);
|
|
118
|
-
}, [menuOpen]);
|
|
119
|
-
|
|
120
|
-
const toggleMenu = useCallback(() => {
|
|
121
|
-
setMenuOpen((prev) => !prev);
|
|
122
|
-
}, []);
|
|
123
|
-
|
|
124
|
-
// ── Color resolution ────────────────────────────────────────────────────
|
|
125
|
-
|
|
126
|
-
const bgColor = color === 'primary' ? theme.primary : theme.surface;
|
|
127
|
-
const textColor = color === 'primary' ? theme.bg : theme.text;
|
|
128
|
-
|
|
129
|
-
// ── Variant styles ──────────────────────────────────────────────────────
|
|
130
|
-
|
|
131
|
-
const variantStyles: Record<string, CSSProperties> = {
|
|
132
|
-
default: {
|
|
133
|
-
backgroundColor: bgColor,
|
|
134
|
-
borderBottom: `1px solid ${theme.border}`,
|
|
135
|
-
},
|
|
136
|
-
transparent: {
|
|
137
|
-
backgroundColor: 'transparent',
|
|
138
|
-
borderBottom: 'none',
|
|
139
|
-
},
|
|
140
|
-
elevated: {
|
|
141
|
-
backgroundColor: bgColor,
|
|
142
|
-
boxShadow: `0 2px 8px ${theme.bg}66`,
|
|
143
|
-
borderBottom: 'none',
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// ── Position styles ─────────────────────────────────────────────────────
|
|
148
|
-
|
|
149
|
-
const positionStyles: Record<string, CSSProperties> = {
|
|
150
|
-
fixed: { position: 'fixed', top: 0, left: 0, right: 0, zIndex: 1100 },
|
|
151
|
-
sticky: { position: 'sticky', top: 0, zIndex: 1100 },
|
|
152
|
-
static: { position: 'static' },
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const safeTitle = typeof title === 'string' ? sanitizeString(title) : title;
|
|
156
|
-
|
|
157
|
-
// ── Transition ──────────────────────────────────────────────────────────
|
|
158
|
-
|
|
159
|
-
const slideTransition = reduced
|
|
160
|
-
? 'none'
|
|
161
|
-
: 'max-height 300ms cubic-bezier(0.4,0,0.2,1), opacity 300ms ease';
|
|
162
|
-
|
|
163
|
-
return (
|
|
164
|
-
<header
|
|
165
|
-
role="banner"
|
|
166
|
-
className={tkx('font-sans w-full')}
|
|
167
|
-
style={{
|
|
168
|
-
...positionStyles[position],
|
|
169
|
-
...variantStyles[variant],
|
|
170
|
-
color: textColor,
|
|
171
|
-
height: BAR_HEIGHT,
|
|
172
|
-
}}
|
|
173
|
-
>
|
|
174
|
-
<div
|
|
175
|
-
ref={menuRef}
|
|
176
|
-
className={tkx('flex items-center h-full px-4')}
|
|
177
|
-
style={{ maxWidth: 1440, margin: '0 auto' }}
|
|
178
|
-
>
|
|
179
|
-
{/* Logo area */}
|
|
180
|
-
{logo && (
|
|
181
|
-
<div
|
|
182
|
-
className={tkx('flex items-center shrink-0 mr-3')}
|
|
183
|
-
aria-hidden="true"
|
|
184
|
-
>
|
|
185
|
-
{logo}
|
|
186
|
-
</div>
|
|
187
|
-
)}
|
|
188
|
-
|
|
189
|
-
{/* Title */}
|
|
190
|
-
{safeTitle && (
|
|
191
|
-
<div
|
|
192
|
-
className={tkx('text-base font-semibold shrink-0 mr-4 leading-snug')}
|
|
193
|
-
style={{ color: textColor }}
|
|
194
|
-
>
|
|
195
|
-
{safeTitle}
|
|
196
|
-
</div>
|
|
197
|
-
)}
|
|
198
|
-
|
|
199
|
-
{/* Desktop navigation */}
|
|
200
|
-
{!isMobile && navigation && (
|
|
201
|
-
<nav
|
|
202
|
-
id={navId}
|
|
203
|
-
aria-label="Main navigation"
|
|
204
|
-
className={tkx('flex items-center flex-1 gap-1')}
|
|
205
|
-
>
|
|
206
|
-
{navigation}
|
|
207
|
-
</nav>
|
|
208
|
-
)}
|
|
209
|
-
|
|
210
|
-
{/* Spacer for mobile */}
|
|
211
|
-
{isMobile && <div className={tkx('flex-1')} />}
|
|
212
|
-
|
|
213
|
-
{/* Desktop actions */}
|
|
214
|
-
{actions && (
|
|
215
|
-
<div className={tkx('flex items-center gap-2 ml-auto shrink-0')}>
|
|
216
|
-
{actions}
|
|
217
|
-
</div>
|
|
218
|
-
)}
|
|
219
|
-
|
|
220
|
-
{/* Mobile hamburger */}
|
|
221
|
-
{isMobile && navigation && (
|
|
222
|
-
<button
|
|
223
|
-
onClick={toggleMenu}
|
|
224
|
-
aria-expanded={menuOpen}
|
|
225
|
-
aria-controls={navId}
|
|
226
|
-
aria-label={menuOpen ? 'Close navigation menu' : 'Open navigation menu'}
|
|
227
|
-
className={tkx(
|
|
228
|
-
'bg-transparent border-none cursor-pointer p-2 ml-2 rounded flex items-center justify-center',
|
|
229
|
-
'focus-visible:focus-ring',
|
|
230
|
-
)}
|
|
231
|
-
style={{ color: textColor }}
|
|
232
|
-
>
|
|
233
|
-
<HamburgerIcon open={menuOpen} />
|
|
234
|
-
</button>
|
|
235
|
-
)}
|
|
236
|
-
</div>
|
|
237
|
-
|
|
238
|
-
{/* Mobile dropdown menu */}
|
|
239
|
-
{isMobile && navigation && (
|
|
240
|
-
<nav
|
|
241
|
-
id={navId}
|
|
242
|
-
aria-label="Main navigation"
|
|
243
|
-
style={{
|
|
244
|
-
maxHeight: menuOpen ? 400 : 0,
|
|
245
|
-
opacity: menuOpen ? 1 : 0,
|
|
246
|
-
overflow: 'hidden',
|
|
247
|
-
transition: slideTransition,
|
|
248
|
-
backgroundColor: theme.surface,
|
|
249
|
-
borderBottom: menuOpen ? `1px solid ${theme.border}` : 'none',
|
|
250
|
-
}}
|
|
251
|
-
>
|
|
252
|
-
<div
|
|
253
|
-
className={tkx('flex flex-col gap-1 px-4 py-3')}
|
|
254
|
-
role="menu"
|
|
255
|
-
>
|
|
256
|
-
{navigation}
|
|
257
|
-
</div>
|
|
258
|
-
</nav>
|
|
259
|
-
)}
|
|
260
|
-
</header>
|
|
261
|
-
);
|
|
262
|
-
}
|