@zendir/ui 0.4.1 → 0.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/CHANGELOG.md +34 -0
- package/README.md +640 -631
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/index.js +17 -221
- package/dist/react/3d/CesiumCaptureSource.d.ts +0 -1
- package/dist/react/3d/CesiumCaptureSource.js +364 -283
- package/dist/react/3d/CesiumCaptureSource.js.map +1 -1
- package/dist/react/3d/ZenSpace3D.d.ts +2 -3
- package/dist/react/3d/ZenSpace3D.js +1681 -1237
- package/dist/react/3d/ZenSpace3D.js.map +1 -1
- package/dist/react/3d/ZenSpace3DCesium.d.ts +0 -1
- package/dist/react/3d/ZenSpace3DCesium.js +513 -560
- package/dist/react/3d/ZenSpace3DCesium.js.map +1 -1
- package/dist/react/3d/ZenSpace3DShaders.js +61 -66
- package/dist/react/3d/ZenSpace3DShaders.js.map +1 -1
- package/dist/react/3d/ZenSpace3DTypes.d.ts +19 -20
- package/dist/react/3d/ZenSpace3DUtils.d.ts +0 -1
- package/dist/react/3d/ZenSpace3DUtils.js +37 -24
- package/dist/react/3d/ZenSpace3DUtils.js.map +1 -1
- package/dist/react/3d/capturePngAnalysis.js +42 -36
- package/dist/react/3d/capturePngAnalysis.js.map +1 -1
- package/dist/react/3d/index.d.ts +3 -3
- package/dist/react/3d/index.js +5 -53
- package/dist/react/3d/threeLoader.d.ts +1 -1
- package/dist/react/3d/threeLoader.js +23 -18
- package/dist/react/3d/threeLoader.js.map +1 -1
- package/dist/react/astro/ClassificationBanner.d.ts +2 -3
- package/dist/react/astro/ClassificationBanner.js +95 -79
- package/dist/react/astro/ClassificationBanner.js.map +1 -1
- package/dist/react/astro/GlobalStatusBar.d.ts +0 -1
- package/dist/react/astro/GlobalStatusBar.js +157 -163
- package/dist/react/astro/GlobalStatusBar.js.map +1 -1
- package/dist/react/astro/MissionClock.d.ts +7 -8
- package/dist/react/astro/MissionClock.js +377 -400
- package/dist/react/astro/MissionClock.js.map +1 -1
- package/dist/react/astro/MonitoringIcon.d.ts +1 -2
- package/dist/react/astro/MonitoringIcon.js +422 -358
- package/dist/react/astro/MonitoringIcon.js.map +1 -1
- package/dist/react/astro/Notification.d.ts +1 -2
- package/dist/react/astro/Notification.js +229 -126
- package/dist/react/astro/Notification.js.map +1 -1
- package/dist/react/astro/Progress.d.ts +0 -1
- package/dist/react/astro/Progress.js +199 -141
- package/dist/react/astro/Progress.js.map +1 -1
- package/dist/react/astro/SimulationControls.d.ts +3 -4
- package/dist/react/astro/SimulationControls.js +596 -650
- package/dist/react/astro/SimulationControls.js.map +1 -1
- package/dist/react/astro/StatusIndicator.d.ts +0 -1
- package/dist/react/astro/StatusIndicator.js +236 -170
- package/dist/react/astro/StatusIndicator.js.map +1 -1
- package/dist/react/astro/UnifiedTimeline.d.ts +9 -10
- package/dist/react/astro/UnifiedTimeline.js +2345 -2392
- package/dist/react/astro/UnifiedTimeline.js.map +1 -1
- package/dist/react/astro/index.d.ts +5 -5
- package/dist/react/astro/index.js +1 -25
- package/dist/react/cards/AccessCard.d.ts +0 -1
- package/dist/react/cards/AccessCard.js +471 -405
- package/dist/react/cards/AccessCard.js.map +1 -1
- package/dist/react/cards/OrbitCard.d.ts +0 -1
- package/dist/react/cards/OrbitCard.js +487 -364
- package/dist/react/cards/OrbitCard.js.map +1 -1
- package/dist/react/cards/SpacecraftCard.d.ts +0 -1
- package/dist/react/cards/SpacecraftCard.js +813 -925
- package/dist/react/cards/SpacecraftCard.js.map +1 -1
- package/dist/react/cards/TelemetryCard.d.ts +0 -1
- package/dist/react/cards/TelemetryCard.js +1055 -732
- package/dist/react/cards/TelemetryCard.js.map +1 -1
- package/dist/react/cards/TelemetryStreamCard.d.ts +0 -1
- package/dist/react/cards/TelemetryStreamCard.js +323 -297
- package/dist/react/cards/TelemetryStreamCard.js.map +1 -1
- package/dist/react/cards/index.d.ts +1 -1
- package/dist/react/cards/index.js +1 -8
- package/dist/react/charts/GroundTrackMap.d.ts +6 -7
- package/dist/react/charts/GroundTrackMap.js +1377 -1256
- package/dist/react/charts/GroundTrackMap.js.map +1 -1
- package/dist/react/charts/GroundTrackMapLeaflet.d.ts +1 -2
- package/dist/react/charts/GroundTrackMapLeaflet.js +1065 -987
- package/dist/react/charts/GroundTrackMapLeaflet.js.map +1 -1
- package/dist/react/charts/groundTrackMapLeafletTiles.js +34 -25
- package/dist/react/charts/groundTrackMapLeafletTiles.js.map +1 -1
- package/dist/react/charts/groundTrackMapLeafletUtils.js +70 -61
- package/dist/react/charts/groundTrackMapLeafletUtils.js.map +1 -1
- package/dist/react/charts/index.d.ts +1 -1
- package/dist/react/charts/index.js +7 -100
- package/dist/react/charts/unified/AstroChart.d.ts +1 -2
- package/dist/react/charts/unified/AstroChart.js +1331 -1411
- package/dist/react/charts/unified/AstroChart.js.map +1 -1
- package/dist/react/charts/unified/PowerOverviewChart.d.ts +3 -3
- package/dist/react/charts/unified/PowerOverviewChart.js +495 -478
- package/dist/react/charts/unified/PowerOverviewChart.js.map +1 -1
- package/dist/react/charts/unified/domain.d.ts +12 -13
- package/dist/react/charts/unified/domain.js +3999 -3145
- package/dist/react/charts/unified/domain.js.map +1 -1
- package/dist/react/charts/unified/generators.d.ts +3 -4
- package/dist/react/charts/unified/generators.js +561 -498
- package/dist/react/charts/unified/generators.js.map +1 -1
- package/dist/react/charts/unified/index.d.ts +1 -1
- package/dist/react/charts/unified/presets.d.ts +14 -15
- package/dist/react/charts/unified/presets.js +857 -994
- package/dist/react/charts/unified/presets.js.map +1 -1
- package/dist/react/charts/unified/sync.d.ts +2 -3
- package/dist/react/charts/unified/sync.js +229 -195
- package/dist/react/charts/unified/sync.js.map +1 -1
- package/dist/react/charts/unified/theme.d.ts +11 -12
- package/dist/react/charts/unified/theme.js +606 -642
- package/dist/react/charts/unified/theme.js.map +1 -1
- package/dist/react/charts/unified/types.d.ts +32 -33
- package/dist/react/charts/unified/useChartStream.d.ts +1 -2
- package/dist/react/charts/unified/useChartStream.js +203 -216
- package/dist/react/charts/unified/useChartStream.js.map +1 -1
- package/dist/react/chatgpt/AppCard.d.ts +1 -2
- package/dist/react/chatgpt/index.d.ts +7 -7
- package/dist/react/chatgpt/index.js +160 -139
- package/dist/react/chatgpt/index.js.map +1 -1
- package/dist/react/context/CategoryContext.d.ts +0 -1
- package/dist/react/context/CategoryContext.js +78 -29
- package/dist/react/context/CategoryContext.js.map +1 -1
- package/dist/react/context/DisplaySettingsContext.d.ts +1 -2
- package/dist/react/context/DisplaySettingsContext.js +205 -156
- package/dist/react/context/DisplaySettingsContext.js.map +1 -1
- package/dist/react/context/SpatialSelectionContext.d.ts +0 -1
- package/dist/react/context/SpatialSelectionContext.js +36 -7
- package/dist/react/context/SpatialSelectionContext.js.map +1 -1
- package/dist/react/core/data/DataTable.d.ts +3 -4
- package/dist/react/core/data/DataTable.js +473 -440
- package/dist/react/core/data/DataTable.js.map +1 -1
- package/dist/react/core/data/DataValue.d.ts +4 -5
- package/dist/react/core/data/DataValue.js +605 -538
- package/dist/react/core/data/DataValue.js.map +1 -1
- package/dist/react/core/data/propertyConfig.d.ts +1 -2
- package/dist/react/core/data/propertyConfig.js +446 -382
- package/dist/react/core/data/propertyConfig.js.map +1 -1
- package/dist/react/core/display/AstroIcon.d.ts +4 -5
- package/dist/react/core/display/AstroIcon.js +339 -429
- package/dist/react/core/display/AstroIcon.js.map +1 -1
- package/dist/react/core/display/Badge.d.ts +2 -3
- package/dist/react/core/display/Badge.js +131 -131
- package/dist/react/core/display/Badge.js.map +1 -1
- package/dist/react/core/display/CardHeader.d.ts +0 -1
- package/dist/react/core/display/CardHeader.js +398 -311
- package/dist/react/core/display/CardHeader.js.map +1 -1
- package/dist/react/core/display/Container.d.ts +2 -3
- package/dist/react/core/display/Container.js +640 -668
- package/dist/react/core/display/Container.js.map +1 -1
- package/dist/react/core/display/CopyButton.d.ts +1 -2
- package/dist/react/core/display/CopyButton.js +158 -101
- package/dist/react/core/display/CopyButton.js.map +1 -1
- package/dist/react/core/display/GlassCard.d.ts +3 -4
- package/dist/react/core/display/GlassCard.js +416 -369
- package/dist/react/core/display/GlassCard.js.map +1 -1
- package/dist/react/core/display/HeaderIconWithStatus.d.ts +0 -1
- package/dist/react/core/display/HeaderIconWithStatus.js +152 -152
- package/dist/react/core/display/HeaderIconWithStatus.js.map +1 -1
- package/dist/react/core/display/Icon.d.ts +2 -3
- package/dist/react/core/display/Icon.js +172 -143
- package/dist/react/core/display/Icon.js.map +1 -1
- package/dist/react/core/display/Typography.d.ts +24 -25
- package/dist/react/core/display/Typography.js +360 -178
- package/dist/react/core/display/Typography.js.map +1 -1
- package/dist/react/core/feedback/ConfirmDialog.d.ts +1 -2
- package/dist/react/core/feedback/ConfirmDialog.js +343 -304
- package/dist/react/core/feedback/ConfirmDialog.js.map +1 -1
- package/dist/react/core/feedback/Dialog.d.ts +2 -3
- package/dist/react/core/feedback/Dialog.js +189 -197
- package/dist/react/core/feedback/Dialog.js.map +1 -1
- package/dist/react/core/feedback/Toast.d.ts +2 -3
- package/dist/react/core/feedback/Toast.js +346 -207
- package/dist/react/core/feedback/Toast.js.map +1 -1
- package/dist/react/core/index.d.ts +26 -26
- package/dist/react/core/index.js +7 -119
- package/dist/react/core/inputs/Button.d.ts +2 -3
- package/dist/react/core/inputs/Button.js +281 -304
- package/dist/react/core/inputs/Button.js.map +1 -1
- package/dist/react/core/inputs/Checkbox.d.ts +2 -3
- package/dist/react/core/inputs/Checkbox.js +139 -127
- package/dist/react/core/inputs/Checkbox.js.map +1 -1
- package/dist/react/core/inputs/Input.d.ts +3 -4
- package/dist/react/core/inputs/Input.js +277 -285
- package/dist/react/core/inputs/Input.js.map +1 -1
- package/dist/react/core/inputs/LimitsBar.d.ts +1 -2
- package/dist/react/core/inputs/LimitsBar.js +271 -196
- package/dist/react/core/inputs/LimitsBar.js.map +1 -1
- package/dist/react/core/inputs/NumberInput.d.ts +2 -3
- package/dist/react/core/inputs/NumberInput.js +531 -503
- package/dist/react/core/inputs/NumberInput.js.map +1 -1
- package/dist/react/core/inputs/PinInput.d.ts +2 -3
- package/dist/react/core/inputs/PinInput.js +224 -207
- package/dist/react/core/inputs/PinInput.js.map +1 -1
- package/dist/react/core/inputs/Select.d.ts +1 -2
- package/dist/react/core/inputs/Select.js +298 -299
- package/dist/react/core/inputs/Select.js.map +1 -1
- package/dist/react/core/inputs/Toggle.d.ts +2 -3
- package/dist/react/core/inputs/Toggle.js +142 -148
- package/dist/react/core/inputs/Toggle.js.map +1 -1
- package/dist/react/core/layout/Box.d.ts +3 -4
- package/dist/react/core/layout/Box.js +118 -122
- package/dist/react/core/layout/Box.js.map +1 -1
- package/dist/react/core/layout/Center.d.ts +0 -1
- package/dist/react/core/layout/Center.js +45 -32
- package/dist/react/core/layout/Center.js.map +1 -1
- package/dist/react/core/layout/Divider.d.ts +1 -2
- package/dist/react/core/layout/Divider.js +112 -106
- package/dist/react/core/layout/Divider.js.map +1 -1
- package/dist/react/core/layout/Flex.d.ts +4 -5
- package/dist/react/core/layout/Flex.js +120 -124
- package/dist/react/core/layout/Flex.js.map +1 -1
- package/dist/react/core/layout/Grid.d.ts +5 -6
- package/dist/react/core/layout/Grid.js +131 -138
- package/dist/react/core/layout/Grid.js.map +1 -1
- package/dist/react/core/layout/Spacer.d.ts +0 -1
- package/dist/react/core/layout/Spacer.js +36 -29
- package/dist/react/core/layout/Spacer.js.map +1 -1
- package/dist/react/core/layout/Stack.d.ts +4 -5
- package/dist/react/core/layout/Stack.js +127 -70
- package/dist/react/core/layout/Stack.js.map +1 -1
- package/dist/react/core/layout/responsive.d.ts +1 -2
- package/dist/react/core/layout/responsive.js +25 -19
- package/dist/react/core/layout/responsive.js.map +1 -1
- package/dist/react/core/layout/useBreakpoint.d.ts +1 -1
- package/dist/react/core/layout/useBreakpoint.js +119 -66
- package/dist/react/core/layout/useBreakpoint.js.map +1 -1
- package/dist/react/core/navigation/AppBar.d.ts +1 -2
- package/dist/react/core/navigation/AppBar.js +827 -805
- package/dist/react/core/navigation/AppBar.js.map +1 -1
- package/dist/react/core/navigation/Pagination.d.ts +2 -3
- package/dist/react/core/navigation/Pagination.js +207 -187
- package/dist/react/core/navigation/Pagination.js.map +1 -1
- package/dist/react/core/navigation/SideNav.d.ts +11 -5
- package/dist/react/core/navigation/SideNav.js +857 -602
- package/dist/react/core/navigation/SideNav.js.map +1 -1
- package/dist/react/core/navigation/Tabs.d.ts +0 -1
- package/dist/react/core/navigation/Tabs.js +113 -119
- package/dist/react/core/navigation/Tabs.js.map +1 -1
- package/dist/react/core/overlays/Popover.d.ts +2 -3
- package/dist/react/core/overlays/Popover.js +303 -282
- package/dist/react/core/overlays/Popover.js.map +1 -1
- package/dist/react/core/overlays/SidePanel.d.ts +1 -2
- package/dist/react/core/overlays/SidePanel.js +217 -212
- package/dist/react/core/overlays/SidePanel.js.map +1 -1
- package/dist/react/core/overlays/Tooltip.d.ts +1 -2
- package/dist/react/core/overlays/Tooltip.js +170 -176
- package/dist/react/core/overlays/Tooltip.js.map +1 -1
- package/dist/react/core/widgets/ActivityPlanner.d.ts +0 -1
- package/dist/react/core/widgets/ActivityPlanner.js +855 -517
- package/dist/react/core/widgets/ActivityPlanner.js.map +1 -1
- package/dist/react/core/widgets/Capture.d.ts +2 -3
- package/dist/react/core/widgets/Capture.js +965 -779
- package/dist/react/core/widgets/Capture.js.map +1 -1
- package/dist/react/core/widgets/ChatPanel.d.ts +16 -17
- package/dist/react/core/widgets/ChatPanel.js +1734 -1034
- package/dist/react/core/widgets/ChatPanel.js.map +1 -1
- package/dist/react/core/widgets/ColorPickerPanel.d.ts +0 -1
- package/dist/react/core/widgets/ColorPickerPanel.js +298 -287
- package/dist/react/core/widgets/ColorPickerPanel.js.map +1 -1
- package/dist/react/core/widgets/CommandBuilder.d.ts +2 -3
- package/dist/react/core/widgets/CommandBuilder.js +624 -516
- package/dist/react/core/widgets/CommandBuilder.js.map +1 -1
- package/dist/react/core/widgets/ConnectionForm.d.ts +2 -3
- package/dist/react/core/widgets/ConnectionForm.js +528 -492
- package/dist/react/core/widgets/ConnectionForm.js.map +1 -1
- package/dist/react/core/widgets/FileExplorer.d.ts +3 -4
- package/dist/react/core/widgets/FileExplorer.js +617 -505
- package/dist/react/core/widgets/FileExplorer.js.map +1 -1
- package/dist/react/core/widgets/HexViewer.d.ts +2 -3
- package/dist/react/core/widgets/HexViewer.js +1353 -1091
- package/dist/react/core/widgets/HexViewer.js.map +1 -1
- package/dist/react/core/widgets/ImageFrame.d.ts +1 -2
- package/dist/react/core/widgets/ImageFrame.js +230 -193
- package/dist/react/core/widgets/ImageFrame.js.map +1 -1
- package/dist/react/core/widgets/ImageGallery.d.ts +2 -1
- package/dist/react/core/widgets/ImageGallery.js +380 -314
- package/dist/react/core/widgets/ImageGallery.js.map +1 -1
- package/dist/react/core/widgets/ImagePanel.d.ts +0 -1
- package/dist/react/core/widgets/ImagePanel.js +110 -101
- package/dist/react/core/widgets/ImagePanel.js.map +1 -1
- package/dist/react/core/widgets/LogViewer.d.ts +2 -3
- package/dist/react/core/widgets/LogViewer.js +711 -607
- package/dist/react/core/widgets/LogViewer.js.map +1 -1
- package/dist/react/core/widgets/MessageStream.d.ts +3 -4
- package/dist/react/core/widgets/MessageStream.js +514 -444
- package/dist/react/core/widgets/MessageStream.js.map +1 -1
- package/dist/react/core/widgets/MissionCalendar.d.ts +3 -4
- package/dist/react/core/widgets/MissionCalendar.js +1488 -1020
- package/dist/react/core/widgets/MissionCalendar.js.map +1 -1
- package/dist/react/core/widgets/PacketViewer.d.ts +2 -3
- package/dist/react/core/widgets/PacketViewer.js +550 -421
- package/dist/react/core/widgets/PacketViewer.js.map +1 -1
- package/dist/react/core/widgets/capture-placeholder.png.js +6 -5
- package/dist/react/core/widgets/capture-placeholder.png.js.map +1 -1
- package/dist/react/hooks/index.d.ts +5 -5
- package/dist/react/hooks/useAccessWindows.d.ts +0 -1
- package/dist/react/hooks/useCompactMode.d.ts +1 -1
- package/dist/react/hooks/useCompactMode.js +104 -58
- package/dist/react/hooks/useCompactMode.js.map +1 -1
- package/dist/react/hooks/useGroundTrackHistory.d.ts +0 -1
- package/dist/react/hooks/useSimulationScene.d.ts +1 -2
- package/dist/react/hooks/useSimulationScene.js +481 -374
- package/dist/react/hooks/useSimulationScene.js.map +1 -1
- package/dist/react/index.d.ts +3 -3
- package/dist/react/panels/LayerControlPanel.d.ts +1 -2
- package/dist/react/panels/LayerControlPanel.js +223 -180
- package/dist/react/panels/LayerControlPanel.js.map +1 -1
- package/dist/react/panels/ObjectInventoryPanel.d.ts +2 -3
- package/dist/react/panels/ObjectInventoryPanel.js +315 -250
- package/dist/react/panels/ObjectInventoryPanel.js.map +1 -1
- package/dist/react/panels/index.d.ts +1 -1
- package/dist/react/panels/index.js +1 -6
- package/dist/react/shared/ErrorBoundary.d.ts +1 -2
- package/dist/react/shared/ErrorBoundary.js +170 -139
- package/dist/react/shared/ErrorBoundary.js.map +1 -1
- package/dist/react/shared/Skeleton.d.ts +1 -2
- package/dist/react/shared/Skeleton.js +300 -301
- package/dist/react/shared/Skeleton.js.map +1 -1
- package/dist/react/theme/ThemeProvider.d.ts +2 -321
- package/dist/react/theme/ThemeProvider.js +312 -939
- package/dist/react/theme/ThemeProvider.js.map +1 -1
- package/dist/react/theme/cardAccent.d.ts +1 -2
- package/dist/react/theme/cardAccent.js +196 -126
- package/dist/react/theme/cardAccent.js.map +1 -1
- package/dist/react/theme/config.d.ts +0 -1
- package/dist/react/theme/config.js +47 -25
- package/dist/react/theme/config.js.map +1 -1
- package/dist/react/theme/index.d.ts +2 -2
- package/dist/react/theme/index.js +1 -16
- package/dist/react/theme/types.d.ts +332 -0
- package/dist/react/theme/types.js +39 -0
- package/dist/react/theme/types.js.map +1 -0
- package/dist/react/types.d.ts +8 -8
- package/dist/react/types.js +147 -47
- package/dist/react/types.js.map +1 -1
- package/dist/react/utils/categoryPalette.d.ts +0 -1
- package/dist/react/utils/categoryPalette.js +91 -102
- package/dist/react/utils/categoryPalette.js.map +1 -1
- package/dist/react/utils/index.d.ts +5 -5
- package/dist/react/utils/index.js +457 -371
- package/dist/react/utils/index.js.map +1 -1
- package/dist/react/visualizations/EclipseTimerCard.d.ts +0 -1
- package/dist/react/visualizations/LinkBudgetCard.d.ts +0 -1
- package/dist/react/visualizations/NavBallCard.d.ts +0 -1
- package/dist/react/visualizations/PropulsionCard.d.ts +1 -2
- package/dist/react/visualizations/SensorFootprintCard.d.ts +1 -2
- package/dist/react/visualizations/ThermalHeatmapCard.d.ts +0 -1
- package/dist/react/visualizations/index.d.ts +3 -3
- package/dist/react.d.ts +2 -1
- package/dist/react.js +17 -221
- package/dist/shaders/atmosphere.frag.js +6 -5
- package/dist/shaders/atmosphere.frag.js.map +1 -1
- package/dist/shaders/atmosphere.vert.js +6 -5
- package/dist/shaders/atmosphere.vert.js.map +1 -1
- package/dist/shaders/stars.frag.js +6 -5
- package/dist/shaders/stars.frag.js.map +1 -1
- package/dist/shaders/stars.vert.js +6 -5
- package/dist/shaders/stars.vert.js.map +1 -1
- package/dist/style.css +217 -194
- package/dist/tokens/core.d.ts +159 -0
- package/dist/tokens/core.js +144 -0
- package/dist/tokens/core.js.map +1 -0
- package/dist/tokens/css-vars.d.ts +213 -2
- package/dist/tokens/css-vars.js +590 -227
- package/dist/tokens/css-vars.js.map +1 -1
- package/dist/tokens/index.d.ts +31 -228
- package/dist/tokens/index.js +281 -366
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/palettes/astro.d.ts +129 -0
- package/dist/tokens/palettes/astro.js +112 -0
- package/dist/tokens/palettes/astro.js.map +1 -0
- package/dist/tokens/palettes/index.d.ts +288 -0
- package/dist/tokens/palettes/index.js +35 -0
- package/dist/tokens/palettes/index.js.map +1 -0
- package/dist/tokens/palettes/tailwind.d.ts +324 -0
- package/dist/tokens/palettes/tailwind.js +201 -0
- package/dist/tokens/palettes/tailwind.js.map +1 -0
- package/dist/tokens/palettes/zendir.d.ts +126 -0
- package/dist/tokens/palettes/zendir.js +92 -0
- package/dist/tokens/palettes/zendir.js.map +1 -0
- package/dist/tokens/themes.d.ts +30 -0
- package/dist/tokens/themes.js +704 -0
- package/dist/tokens/themes.js.map +1 -0
- package/dist/tokens/tokens.css +419 -41
- package/dist/types/index.d.ts +2 -2
- package/package.json +310 -313
- package/dist/index.js.map +0 -1
- package/dist/react/3d/index.js.map +0 -1
- package/dist/react/astro/index.js.map +0 -1
- package/dist/react/cards/index.js.map +0 -1
- package/dist/react/charts/index.js.map +0 -1
- package/dist/react/core/index.js.map +0 -1
- package/dist/react/panels/index.js.map +0 -1
- package/dist/react/theme/astro-tokens.d.ts +0 -153
- package/dist/react/theme/index.js.map +0 -1
- package/dist/react.js.map +0 -1
|
@@ -1,507 +1,535 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, forwardRef, useState, useRef, useId, useMemo, useEffect, useCallback } from "react";
|
|
3
1
|
import { useTheme } from "../../theme/ThemeProvider.js";
|
|
4
2
|
import { deriveStatus } from "../data/propertyConfig.js";
|
|
5
3
|
import { StatusIndicator } from "../../astro/StatusIndicator.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
4
|
+
import { forwardRef, memo, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/react/core/inputs/NumberInput.tsx
|
|
7
|
+
/**
|
|
8
|
+
* @zendir/ui - NumberInput Component
|
|
9
|
+
*
|
|
10
|
+
* Numeric input with optional slider, min/max bounds, step, precision,
|
|
11
|
+
* and unit display. Essential for operator dashboards (frequency, power,
|
|
12
|
+
* aperture, field of view, etc.).
|
|
13
|
+
*
|
|
14
|
+
* Astro UX Compliance:
|
|
15
|
+
* - Consistent sizing with Input component (small/medium/large)
|
|
16
|
+
* - Focus ring for accessibility (WCAG 2.1 AA)
|
|
17
|
+
* - Status-based border colors
|
|
18
|
+
* - Tabular numbers for value alignment
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // Each instance can set precision (decimal places); default is 2
|
|
23
|
+
* <NumberInput value={500} onChange={setFreq} min={300} max={900} unit="MHz" label="Frequency" />
|
|
24
|
+
* <NumberInput value={45.2} onChange={setPower} min={0.1} max={100} step={0.1} precision={1} unit="W" slider />
|
|
25
|
+
* <NumberInput value={1024} onChange={setRes} min={128} max={2048} step={128} precision={0} unit="px" label="Resolution" slider />
|
|
26
|
+
* // Status mode with automatic threshold-based coloring:
|
|
27
|
+
* <NumberInput value={temp} onChange={setTemp} min={0} max={100} unit="°C" slider
|
|
28
|
+
* statusMode statusThresholds={{ critical: 90, serious: 75, caution: 50, normal: 20, standby: 0 }} />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
/** Default decimal places when precision is not specified: 0 = integer display. Set precision (e.g. 2) to show decimals. */
|
|
32
|
+
var DEFAULT_DECIMAL_PLACES = 0;
|
|
33
|
+
var NumberInput = memo(forwardRef(function NumberInput({ value, onChange, min, max, step = 1, precision, unit, label, helperText, error, slider = false, size = "medium", disabled = false, fullWidth = false, width, id, className, style, textAlign = "right", labelPlacement = "outlined", required, statusMode = false, status: statusOverride, statusThresholds, onStatusChange }, ref) {
|
|
34
|
+
const { tokens, theme } = useTheme();
|
|
35
|
+
const isTransparentTheme = theme === "transparent" || theme === "transparent-bold" || theme === "transparent-minimal";
|
|
36
|
+
const isOutlined = labelPlacement === "outlined";
|
|
37
|
+
const decimalPlaces = precision ?? DEFAULT_DECIMAL_PLACES;
|
|
38
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
39
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
40
|
+
const [isSliderActive, setIsSliderActive] = useState(false);
|
|
41
|
+
const [localValue, setLocalValue] = useState(() => value.toFixed(decimalPlaces));
|
|
42
|
+
const inputRef = useRef(null);
|
|
43
|
+
const sliderContainerRef = useRef(null);
|
|
44
|
+
const sliderId = useId().replace(/:/g, "");
|
|
45
|
+
const resolvedStatus = useMemo(() => {
|
|
46
|
+
if (!statusMode) return void 0;
|
|
47
|
+
if (statusOverride) return statusOverride;
|
|
48
|
+
return deriveStatus(value, statusThresholds);
|
|
49
|
+
}, [
|
|
50
|
+
statusMode,
|
|
51
|
+
statusOverride,
|
|
52
|
+
statusThresholds,
|
|
53
|
+
value
|
|
54
|
+
]);
|
|
55
|
+
const prevStatusRef = useRef(void 0);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (resolvedStatus !== void 0 && resolvedStatus !== prevStatusRef.current) {
|
|
58
|
+
prevStatusRef.current = resolvedStatus;
|
|
59
|
+
onStatusChange?.(resolvedStatus);
|
|
60
|
+
}
|
|
61
|
+
}, [resolvedStatus, onStatusChange]);
|
|
62
|
+
/** Resolve the active color: status color or accent */
|
|
63
|
+
const activeColor = useMemo(() => {
|
|
64
|
+
if (resolvedStatus && tokens.colors.status[resolvedStatus]) return tokens.colors.status[resolvedStatus];
|
|
65
|
+
return tokens.colors.accent.primary;
|
|
66
|
+
}, [
|
|
67
|
+
resolvedStatus,
|
|
68
|
+
tokens.colors.status,
|
|
69
|
+
tokens.colors.accent.primary
|
|
70
|
+
]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!isFocused) setLocalValue(value.toFixed(decimalPlaces));
|
|
73
|
+
}, [
|
|
74
|
+
value,
|
|
75
|
+
decimalPlaces,
|
|
76
|
+
isFocused
|
|
77
|
+
]);
|
|
78
|
+
const clamp = useCallback((v) => {
|
|
79
|
+
let result = v;
|
|
80
|
+
if (min !== void 0) result = Math.max(min, result);
|
|
81
|
+
if (max !== void 0) result = Math.min(max, result);
|
|
82
|
+
result = Number(result.toFixed(decimalPlaces));
|
|
83
|
+
return result;
|
|
84
|
+
}, [
|
|
85
|
+
min,
|
|
86
|
+
max,
|
|
87
|
+
decimalPlaces
|
|
88
|
+
]);
|
|
89
|
+
const handleInputChange = useCallback((e) => {
|
|
90
|
+
const raw = e.target.value;
|
|
91
|
+
setLocalValue(raw);
|
|
92
|
+
const parsed = parseFloat(raw);
|
|
93
|
+
if (!isNaN(parsed)) onChange(clamp(parsed));
|
|
94
|
+
}, [onChange, clamp]);
|
|
95
|
+
const handleBlur = useCallback(() => {
|
|
96
|
+
setIsFocused(false);
|
|
97
|
+
const parsed = parseFloat(localValue);
|
|
98
|
+
if (isNaN(parsed)) setLocalValue(value.toFixed(decimalPlaces));
|
|
99
|
+
else {
|
|
100
|
+
const clamped = clamp(parsed);
|
|
101
|
+
onChange(clamped);
|
|
102
|
+
setLocalValue(clamped.toFixed(decimalPlaces));
|
|
103
|
+
}
|
|
104
|
+
}, [
|
|
105
|
+
localValue,
|
|
106
|
+
value,
|
|
107
|
+
onChange,
|
|
108
|
+
clamp,
|
|
109
|
+
decimalPlaces
|
|
110
|
+
]);
|
|
111
|
+
const handleSliderChange = useCallback((e) => {
|
|
112
|
+
const parsed = parseFloat(e.target.value);
|
|
113
|
+
const clamped = clamp(parsed);
|
|
114
|
+
onChange(clamped);
|
|
115
|
+
setLocalValue(clamped.toFixed(decimalPlaces));
|
|
116
|
+
}, [
|
|
117
|
+
onChange,
|
|
118
|
+
clamp,
|
|
119
|
+
decimalPlaces
|
|
120
|
+
]);
|
|
121
|
+
const handleKeyDown = useCallback((e) => {
|
|
122
|
+
if (e.key === "ArrowUp") {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
onChange(clamp(value + step));
|
|
125
|
+
} else if (e.key === "ArrowDown") {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
onChange(clamp(value - step));
|
|
128
|
+
}
|
|
129
|
+
}, [
|
|
130
|
+
value,
|
|
131
|
+
step,
|
|
132
|
+
onChange,
|
|
133
|
+
clamp
|
|
134
|
+
]);
|
|
135
|
+
const handleWheel = useCallback((e) => {
|
|
136
|
+
if (disabled || min === void 0 || max === void 0) return;
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
const direction = e.deltaY < 0 ? 1 : -1;
|
|
139
|
+
onChange(clamp(value + step * direction));
|
|
140
|
+
}, [
|
|
141
|
+
value,
|
|
142
|
+
step,
|
|
143
|
+
onChange,
|
|
144
|
+
clamp,
|
|
145
|
+
disabled,
|
|
146
|
+
min,
|
|
147
|
+
max
|
|
148
|
+
]);
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
const sliderContainer = sliderContainerRef.current;
|
|
151
|
+
const inputElement = inputRef.current;
|
|
152
|
+
if (min !== void 0 && max !== void 0) {
|
|
153
|
+
if (slider && sliderContainer) sliderContainer.addEventListener("wheel", handleWheel, { passive: false });
|
|
154
|
+
if (inputElement) inputElement.addEventListener("wheel", handleWheel, { passive: false });
|
|
155
|
+
}
|
|
156
|
+
return () => {
|
|
157
|
+
if (sliderContainer) sliderContainer.removeEventListener("wheel", handleWheel);
|
|
158
|
+
if (inputElement) inputElement.removeEventListener("wheel", handleWheel);
|
|
159
|
+
};
|
|
160
|
+
}, [
|
|
161
|
+
handleWheel,
|
|
162
|
+
slider,
|
|
163
|
+
min,
|
|
164
|
+
max
|
|
165
|
+
]);
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
if (!isSliderActive) return;
|
|
168
|
+
const handleUp = () => setIsSliderActive(false);
|
|
169
|
+
window.addEventListener("mouseup", handleUp);
|
|
170
|
+
window.addEventListener("touchend", handleUp);
|
|
171
|
+
return () => {
|
|
172
|
+
window.removeEventListener("mouseup", handleUp);
|
|
173
|
+
window.removeEventListener("touchend", handleUp);
|
|
174
|
+
};
|
|
175
|
+
}, [isSliderActive]);
|
|
176
|
+
const [isUnitDragging, setIsUnitDragging] = useState(false);
|
|
177
|
+
const dragStartValueRef = useRef(0);
|
|
178
|
+
const dragStartYRef = useRef(0);
|
|
179
|
+
const unitRef = useRef(null);
|
|
180
|
+
const handleUnitMouseDown = useCallback((e) => {
|
|
181
|
+
if (disabled) return;
|
|
182
|
+
e.preventDefault();
|
|
183
|
+
setIsUnitDragging(true);
|
|
184
|
+
dragStartValueRef.current = value;
|
|
185
|
+
dragStartYRef.current = e.clientY;
|
|
186
|
+
if (document.body.requestPointerLock) document.body.requestPointerLock();
|
|
187
|
+
}, [value, disabled]);
|
|
188
|
+
const handleUnitMouseMove = useCallback((e) => {
|
|
189
|
+
if (!isUnitDragging) return;
|
|
190
|
+
const deltaY = document.pointerLockElement ? -e.movementY : dragStartYRef.current - e.clientY;
|
|
191
|
+
if (deltaY === 0) return;
|
|
192
|
+
let speedMultiplier = 1;
|
|
193
|
+
if (e.shiftKey) speedMultiplier = .1;
|
|
194
|
+
else if (e.ctrlKey || e.metaKey) speedMultiplier = 10;
|
|
195
|
+
const change = deltaY * (document.pointerLockElement ? 1 : .5) * (step || 1) * speedMultiplier;
|
|
196
|
+
if (!document.pointerLockElement) {
|
|
197
|
+
dragStartYRef.current = e.clientY;
|
|
198
|
+
dragStartValueRef.current = clamp(value + change);
|
|
199
|
+
onChange(clamp(value + change));
|
|
200
|
+
} else onChange(clamp(value + change));
|
|
201
|
+
}, [
|
|
202
|
+
isUnitDragging,
|
|
203
|
+
value,
|
|
204
|
+
step,
|
|
205
|
+
onChange,
|
|
206
|
+
clamp
|
|
207
|
+
]);
|
|
208
|
+
const handleUnitMouseUp = useCallback(() => {
|
|
209
|
+
if (isUnitDragging) {
|
|
210
|
+
setIsUnitDragging(false);
|
|
211
|
+
if (document.exitPointerLock) document.exitPointerLock();
|
|
212
|
+
}
|
|
213
|
+
}, [isUnitDragging]);
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
if (isUnitDragging) {
|
|
216
|
+
window.addEventListener("mousemove", handleUnitMouseMove);
|
|
217
|
+
window.addEventListener("mouseup", handleUnitMouseUp);
|
|
218
|
+
}
|
|
219
|
+
return () => {
|
|
220
|
+
window.removeEventListener("mousemove", handleUnitMouseMove);
|
|
221
|
+
window.removeEventListener("mouseup", handleUnitMouseUp);
|
|
222
|
+
};
|
|
223
|
+
}, [
|
|
224
|
+
isUnitDragging,
|
|
225
|
+
handleUnitMouseMove,
|
|
226
|
+
handleUnitMouseUp
|
|
227
|
+
]);
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
const unitEl = unitRef.current;
|
|
230
|
+
if (unitEl && !disabled) unitEl.addEventListener("wheel", handleWheel, { passive: false });
|
|
231
|
+
return () => {
|
|
232
|
+
if (unitEl) unitEl.removeEventListener("wheel", handleWheel);
|
|
233
|
+
};
|
|
234
|
+
}, [handleWheel, disabled]);
|
|
235
|
+
const config = {
|
|
236
|
+
small: {
|
|
237
|
+
height: tokens.elementSize.sm,
|
|
238
|
+
fontSize: tokens.typography.fontSize.xs,
|
|
239
|
+
padding: `${tokens.spacing.xs} ${tokens.spacing.sm}`,
|
|
240
|
+
sliderHeight: 3,
|
|
241
|
+
inputPaddingLeft: 8
|
|
242
|
+
},
|
|
243
|
+
medium: {
|
|
244
|
+
height: tokens.elementSize.md,
|
|
245
|
+
fontSize: tokens.typography.fontSize.sm,
|
|
246
|
+
padding: `${tokens.spacing.xs} ${tokens.spacing.smd}`,
|
|
247
|
+
sliderHeight: 4,
|
|
248
|
+
inputPaddingLeft: 12
|
|
249
|
+
},
|
|
250
|
+
large: {
|
|
251
|
+
height: tokens.elementSize.lg,
|
|
252
|
+
fontSize: tokens.typography.fontSize.base,
|
|
253
|
+
padding: `${tokens.spacing.sm} ${tokens.spacing.md}`,
|
|
254
|
+
sliderHeight: 5,
|
|
255
|
+
inputPaddingLeft: 16
|
|
256
|
+
}
|
|
257
|
+
}[size];
|
|
258
|
+
const hasError = !!error;
|
|
259
|
+
const errorMessage = typeof error === "string" ? error : void 0;
|
|
260
|
+
const computedBorder = hasError ? tokens.borders.input.error : isFocused ? tokens.borders.input.focus : isHovered ? tokens.borders.input.hover : tokens.borders.input.default;
|
|
261
|
+
const inputBg = isTransparentTheme ? tokens.colors.interactive.transparentInputBg || "rgba(139, 92, 246, 0.08)" : tokens.colors.background.surface;
|
|
262
|
+
const sliderPercent = min !== void 0 && max !== void 0 ? (value - min) / (max - min) * 100 : 50;
|
|
263
|
+
const inputId = id || (typeof label === "string" ? `zendir-number-${label.replace(/\s+/g, "-").toLowerCase()}` : void 0);
|
|
264
|
+
const thumbWidth = 24;
|
|
265
|
+
const thumbHeight = config.sliderHeight + 8;
|
|
266
|
+
const trackH = config.sliderHeight;
|
|
267
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
268
|
+
className,
|
|
269
|
+
style: {
|
|
270
|
+
display: "inline-flex",
|
|
271
|
+
flexDirection: "column",
|
|
272
|
+
gap: slider ? 0 : tokens.spacing.xs,
|
|
273
|
+
width: fullWidth ? "100%" : typeof width === "number" ? `${width}px` : width,
|
|
274
|
+
fontFamily: tokens.typography.fontFamily.primary,
|
|
275
|
+
...style
|
|
276
|
+
},
|
|
277
|
+
children: [
|
|
278
|
+
label && !isOutlined && /* @__PURE__ */ jsxs("label", {
|
|
279
|
+
htmlFor: inputId,
|
|
280
|
+
style: {
|
|
281
|
+
fontSize: tokens.typography.fontSize.xs,
|
|
282
|
+
fontWeight: tokens.typography.fontWeight.medium,
|
|
283
|
+
color: tokens.colors.text.secondary,
|
|
284
|
+
letterSpacing: tokens.typography.letterSpacing.wide
|
|
285
|
+
},
|
|
286
|
+
children: [label, required && /* @__PURE__ */ jsx("span", {
|
|
287
|
+
style: {
|
|
288
|
+
color: tokens.colors.status.critical,
|
|
289
|
+
marginLeft: "2px"
|
|
290
|
+
},
|
|
291
|
+
children: "*"
|
|
292
|
+
})]
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ jsxs("div", {
|
|
295
|
+
style: {
|
|
296
|
+
position: "relative",
|
|
297
|
+
display: "flex",
|
|
298
|
+
alignItems: "center",
|
|
299
|
+
height: config.height,
|
|
300
|
+
backgroundColor: inputBg,
|
|
301
|
+
border: computedBorder,
|
|
302
|
+
borderRadius: tokens.borderRadius.md,
|
|
303
|
+
transition: tokens.animation.fast,
|
|
304
|
+
opacity: disabled ? .5 : 1,
|
|
305
|
+
overflow: isOutlined ? "visible" : "hidden"
|
|
306
|
+
},
|
|
307
|
+
onMouseEnter: () => !disabled && setIsHovered(true),
|
|
308
|
+
onMouseLeave: () => setIsHovered(false),
|
|
309
|
+
children: [
|
|
310
|
+
label && isOutlined && /* @__PURE__ */ jsxs("label", {
|
|
311
|
+
htmlFor: inputId,
|
|
312
|
+
style: {
|
|
313
|
+
position: "absolute",
|
|
314
|
+
top: 0,
|
|
315
|
+
left: `${config.inputPaddingLeft - 6}px`,
|
|
316
|
+
transform: "translateY(-50%)",
|
|
317
|
+
backgroundColor: isTransparentTheme ? tokens.colors.background.base : tokens.colors.background.surface,
|
|
318
|
+
padding: "0 6px",
|
|
319
|
+
fontSize: {
|
|
320
|
+
small: "0.625rem",
|
|
321
|
+
medium: "0.6875rem",
|
|
322
|
+
large: "0.75rem"
|
|
323
|
+
}[size],
|
|
324
|
+
fontWeight: tokens.typography.fontWeight.medium,
|
|
325
|
+
color: isFocused ? hasError ? tokens.colors.status.critical : tokens.colors.accent.primary : hasError ? tokens.colors.status.critical : tokens.colors.text.secondary,
|
|
326
|
+
letterSpacing: tokens.typography.letterSpacing.wide,
|
|
327
|
+
zIndex: 1,
|
|
328
|
+
pointerEvents: "none",
|
|
329
|
+
transition: tokens.animation.fast,
|
|
330
|
+
lineHeight: 1.2,
|
|
331
|
+
whiteSpace: "nowrap"
|
|
332
|
+
},
|
|
333
|
+
children: [label, required && /* @__PURE__ */ jsx("span", {
|
|
334
|
+
style: {
|
|
335
|
+
color: tokens.colors.status.critical,
|
|
336
|
+
marginLeft: "2px"
|
|
337
|
+
},
|
|
338
|
+
children: "*"
|
|
339
|
+
})]
|
|
340
|
+
}),
|
|
341
|
+
/* @__PURE__ */ jsx("input", {
|
|
342
|
+
ref: ref || inputRef,
|
|
343
|
+
id: inputId,
|
|
344
|
+
type: "text",
|
|
345
|
+
inputMode: "decimal",
|
|
346
|
+
value: localValue,
|
|
347
|
+
onChange: handleInputChange,
|
|
348
|
+
onFocus: () => setIsFocused(true),
|
|
349
|
+
onBlur: handleBlur,
|
|
350
|
+
onKeyDown: handleKeyDown,
|
|
351
|
+
disabled,
|
|
352
|
+
"aria-invalid": hasError,
|
|
353
|
+
"aria-describedby": errorMessage ? `${inputId}-error` : helperText ? `${inputId}-helper` : void 0,
|
|
354
|
+
style: {
|
|
355
|
+
flex: 1,
|
|
356
|
+
height: "100%",
|
|
357
|
+
padding: config.padding,
|
|
358
|
+
fontSize: config.fontSize,
|
|
359
|
+
fontWeight: tokens.typography.fontWeight.medium,
|
|
360
|
+
fontFamily: tokens.typography.fontFamily.mono,
|
|
361
|
+
fontVariantNumeric: "tabular-nums",
|
|
362
|
+
color: tokens.colors.text.primary,
|
|
363
|
+
backgroundColor: "transparent",
|
|
364
|
+
border: "none",
|
|
365
|
+
outline: "none",
|
|
366
|
+
minWidth: 0,
|
|
367
|
+
textAlign
|
|
368
|
+
}
|
|
369
|
+
}),
|
|
370
|
+
unit && /* @__PURE__ */ jsx("span", {
|
|
371
|
+
ref: unitRef,
|
|
372
|
+
onMouseDown: handleUnitMouseDown,
|
|
373
|
+
style: {
|
|
374
|
+
padding: `0 ${tokens.spacing.sm}`,
|
|
375
|
+
fontSize: tokens.typography.fontSize.xs,
|
|
376
|
+
fontWeight: tokens.typography.fontWeight.medium,
|
|
377
|
+
color: isUnitDragging ? activeColor : tokens.colors.text.tertiary,
|
|
378
|
+
fontFamily: tokens.typography.fontFamily.primary,
|
|
379
|
+
flexShrink: 0,
|
|
380
|
+
borderLeft: tokens.borders.separator,
|
|
381
|
+
height: "100%",
|
|
382
|
+
display: "flex",
|
|
383
|
+
alignItems: "center",
|
|
384
|
+
backgroundColor: isTransparentTheme ? `${tokens.colors.accent.primary}0a` : "rgba(0, 0, 0, 0.15)",
|
|
385
|
+
cursor: disabled ? "not-allowed" : "ns-resize",
|
|
386
|
+
userSelect: "none",
|
|
387
|
+
transition: "color 0.2s ease"
|
|
388
|
+
},
|
|
389
|
+
title: disabled ? void 0 : "Drag to adjust value",
|
|
390
|
+
children: unit
|
|
391
|
+
})
|
|
392
|
+
]
|
|
393
|
+
}),
|
|
394
|
+
slider && min !== void 0 && max !== void 0 && (() => {
|
|
395
|
+
const sliderH = thumbHeight;
|
|
396
|
+
const cy = sliderH / 2;
|
|
397
|
+
const pct = sliderPercent / 100;
|
|
398
|
+
const thumbLeftCalc = `calc(${pct} * (100% - ${thumbWidth}px))`;
|
|
399
|
+
const filledWidthCalc = `calc(${pct} * (100% - ${thumbWidth}px) + 1px)`;
|
|
400
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
401
|
+
ref: sliderContainerRef,
|
|
402
|
+
style: {
|
|
403
|
+
position: "relative",
|
|
404
|
+
height: `${sliderH}px`,
|
|
405
|
+
marginTop: `-${sliderH / 1.42}px`
|
|
406
|
+
},
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
409
|
+
position: "absolute",
|
|
410
|
+
top: `${cy}px`,
|
|
411
|
+
left: 0,
|
|
412
|
+
right: 0,
|
|
413
|
+
height: `${trackH}px`,
|
|
414
|
+
transform: "translateY(-50%)",
|
|
415
|
+
borderRadius: `${trackH / 2}px`,
|
|
416
|
+
backgroundColor: `${tokens.colors.border.muted}60`
|
|
417
|
+
} }),
|
|
418
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
419
|
+
position: "absolute",
|
|
420
|
+
top: `${cy}px`,
|
|
421
|
+
left: 0,
|
|
422
|
+
width: filledWidthCalc,
|
|
423
|
+
height: `${trackH}px`,
|
|
424
|
+
transform: "translateY(-50%)",
|
|
425
|
+
borderRadius: `${trackH / 2}px 0 0 ${trackH / 2}px`,
|
|
426
|
+
background: activeColor,
|
|
427
|
+
transition: "background 300ms ease"
|
|
428
|
+
} }),
|
|
429
|
+
/* @__PURE__ */ jsx("input", {
|
|
430
|
+
type: "range",
|
|
431
|
+
className: `zendir-slider-${sliderId}`,
|
|
432
|
+
min,
|
|
433
|
+
max,
|
|
434
|
+
step,
|
|
435
|
+
value,
|
|
436
|
+
onChange: handleSliderChange,
|
|
437
|
+
onMouseDown: () => setIsSliderActive(true),
|
|
438
|
+
onMouseUp: () => setIsSliderActive(false),
|
|
439
|
+
onTouchStart: () => setIsSliderActive(true),
|
|
440
|
+
onTouchEnd: () => setIsSliderActive(false),
|
|
441
|
+
disabled,
|
|
442
|
+
"aria-label": typeof label === "string" ? label : "Value slider",
|
|
443
|
+
style: {
|
|
444
|
+
position: "absolute",
|
|
445
|
+
top: 0,
|
|
446
|
+
left: 0,
|
|
447
|
+
width: "100%",
|
|
448
|
+
height: "100%",
|
|
449
|
+
margin: 0,
|
|
450
|
+
padding: 0,
|
|
451
|
+
opacity: 0,
|
|
452
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
453
|
+
zIndex: 2
|
|
454
|
+
}
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ jsx("div", {
|
|
457
|
+
style: {
|
|
458
|
+
position: "absolute",
|
|
459
|
+
top: `${cy}px`,
|
|
460
|
+
left: thumbLeftCalc,
|
|
461
|
+
width: `${thumbWidth}px`,
|
|
462
|
+
height: `${thumbHeight}px`,
|
|
463
|
+
transform: "translateY(-50%)",
|
|
464
|
+
pointerEvents: "none",
|
|
465
|
+
zIndex: 1
|
|
466
|
+
},
|
|
467
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
468
|
+
width: thumbWidth,
|
|
469
|
+
height: thumbHeight,
|
|
470
|
+
viewBox: `0 0 ${thumbWidth} ${thumbHeight}`,
|
|
471
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
472
|
+
style: {
|
|
473
|
+
display: "block",
|
|
474
|
+
overflow: "visible"
|
|
475
|
+
},
|
|
476
|
+
children: (() => {
|
|
477
|
+
const w = thumbWidth;
|
|
478
|
+
const h = thumbHeight;
|
|
479
|
+
const svgCy = h / 2;
|
|
480
|
+
const trackHalf = trackH / 2;
|
|
481
|
+
const r = 2;
|
|
482
|
+
const ltop = svgCy - trackHalf;
|
|
483
|
+
const lbot = svgCy + trackHalf;
|
|
484
|
+
const rtop = r;
|
|
485
|
+
const rbot = h - r;
|
|
486
|
+
const cp1x = w * .28;
|
|
487
|
+
const cp2x = w * .48;
|
|
488
|
+
return /* @__PURE__ */ jsx("path", {
|
|
489
|
+
d: [
|
|
490
|
+
`M 0 ${ltop}`,
|
|
491
|
+
`C ${cp1x} ${ltop}, ${cp2x} ${rtop}, ${w - r} ${rtop}`,
|
|
492
|
+
`A ${r} ${r} 0 0 1 ${w} 4`,
|
|
493
|
+
`L ${w} ${rbot - r}`,
|
|
494
|
+
`A ${r} ${r} 0 0 1 ${w - r} ${rbot}`,
|
|
495
|
+
`C ${cp2x} ${rbot}, ${cp1x} ${lbot}, 0 ${lbot}`,
|
|
496
|
+
`Z`
|
|
497
|
+
].join(" "),
|
|
498
|
+
fill: activeColor
|
|
499
|
+
});
|
|
500
|
+
})()
|
|
501
|
+
})
|
|
502
|
+
}),
|
|
503
|
+
statusMode && resolvedStatus && /* @__PURE__ */ jsx("div", {
|
|
504
|
+
style: {
|
|
505
|
+
position: "absolute",
|
|
506
|
+
bottom: `-${size === "large" ? 10 : 8}px`,
|
|
507
|
+
left: `calc(${pct} * (100% - ${thumbWidth}px) + ${thumbWidth / 2}px)`,
|
|
508
|
+
transform: "translateX(-50%)",
|
|
509
|
+
zIndex: 1,
|
|
510
|
+
lineHeight: 0
|
|
511
|
+
},
|
|
512
|
+
children: /* @__PURE__ */ jsx(StatusIndicator, {
|
|
513
|
+
status: resolvedStatus,
|
|
514
|
+
small: true
|
|
515
|
+
})
|
|
516
|
+
})
|
|
517
|
+
]
|
|
518
|
+
});
|
|
519
|
+
})(),
|
|
520
|
+
(helperText || errorMessage) && /* @__PURE__ */ jsx("div", {
|
|
521
|
+
id: errorMessage ? `${inputId}-error` : `${inputId}-helper`,
|
|
522
|
+
role: errorMessage ? "alert" : void 0,
|
|
523
|
+
style: {
|
|
524
|
+
fontSize: tokens.typography.fontSize.xs,
|
|
525
|
+
color: hasError ? tokens.colors.status.critical : tokens.colors.text.tertiary
|
|
526
|
+
},
|
|
527
|
+
children: errorMessage || helperText
|
|
528
|
+
})
|
|
529
|
+
]
|
|
530
|
+
});
|
|
503
531
|
}));
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
//# sourceMappingURL=NumberInput.js.map
|
|
532
|
+
//#endregion
|
|
533
|
+
export { NumberInput, NumberInput as default };
|
|
534
|
+
|
|
535
|
+
//# sourceMappingURL=NumberInput.js.map
|