glacia-native 0.5.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/LICENSE +29 -4
- package/README.md +111 -17
- package/lib/module/Accordion.js +58 -0
- package/lib/module/ActionSheet.js +38 -0
- package/lib/module/Alert.js +23 -0
- package/lib/module/AlertDialog.js +47 -0
- package/lib/module/Avatar.js +48 -0
- package/lib/module/Badge.js +36 -0
- package/lib/module/Bars.js +13 -267
- package/lib/module/Button.js +57 -36
- package/lib/module/Card.js +32 -20
- package/lib/module/Checkbox.js +42 -0
- package/lib/module/Chip.js +80 -0
- package/lib/module/Collapsible.js +26 -0
- package/lib/module/ContextMenu.js +33 -0
- package/lib/module/Dialog.js +39 -124
- package/lib/module/DropdownMenu.js +33 -0
- package/lib/module/Field.js +22 -0
- package/lib/module/Glass.js +12 -5
- package/lib/module/Group.js +36 -0
- package/lib/module/IconButton.js +40 -0
- package/lib/module/Input.js +47 -40
- package/lib/module/Label.js +17 -0
- package/lib/module/MorphGroup.js +47 -0
- package/lib/module/Popover.js +29 -0
- package/lib/module/Progress.js +32 -0
- package/lib/module/RadioGroup.js +51 -0
- package/lib/module/Scrim.js +44 -0
- package/lib/module/SegmentedControl.js +74 -58
- package/lib/module/Select.js +51 -0
- package/lib/module/Separator.js +25 -0
- package/lib/module/Sheet.js +51 -0
- package/lib/module/Skeleton.js +48 -0
- package/lib/module/Slider.js +60 -40
- package/lib/module/Stepper.js +167 -0
- package/lib/module/Switch.js +45 -43
- package/lib/module/TabBar.js +62 -50
- package/lib/module/Tabs.js +3 -2
- package/lib/module/Textarea.js +18 -0
- package/lib/module/Toast.js +55 -0
- package/lib/module/Toggle.js +47 -0
- package/lib/module/ToggleGroup.js +56 -0
- package/lib/module/Toolbar.js +37 -0
- package/lib/module/Tooltip.js +31 -0
- package/lib/module/glass-provider.js +28 -0
- package/lib/module/glass-stack.js +61 -0
- package/lib/module/index.js +78 -109
- package/lib/module/internal/GlassBackdrop.js +36 -0
- package/lib/module/internal/GlassView.js +45 -13
- package/lib/module/internal/blur-community.js +20 -0
- package/lib/module/internal/blur-community.web.js +9 -0
- package/lib/module/internal/blur.js +75 -0
- package/lib/module/internal/fallback.js +110 -20
- package/lib/module/internal/glass-routing.js +154 -30
- package/lib/module/internal/glow.js +36 -0
- package/lib/module/internal/initials.js +12 -0
- package/lib/module/internal/lens.js +70 -0
- package/lib/module/internal/material.js +64 -0
- package/lib/module/internal/overlay.js +147 -0
- package/lib/module/internal/primitives.js +17 -0
- package/lib/module/internal/rim.js +35 -0
- package/lib/module/internal/tokens.js +34 -2
- package/lib/typescript/Accordion.d.ts +22 -0
- package/lib/typescript/ActionSheet.d.ts +24 -0
- package/lib/typescript/Alert.d.ts +15 -0
- package/lib/typescript/AlertDialog.d.ts +17 -0
- package/lib/typescript/Avatar.d.ts +22 -0
- package/lib/typescript/Badge.d.ts +12 -0
- package/lib/typescript/Bars.d.ts +3 -188
- package/lib/typescript/Button.d.ts +44 -10
- package/lib/typescript/Card.d.ts +30 -3
- package/lib/typescript/Checkbox.d.ts +14 -0
- package/lib/typescript/Chip.d.ts +19 -0
- package/lib/typescript/Collapsible.d.ts +17 -0
- package/lib/typescript/ContextMenu.d.ts +23 -0
- package/lib/typescript/Dialog.d.ts +8 -68
- package/lib/typescript/DropdownMenu.d.ts +23 -0
- package/lib/typescript/Field.d.ts +19 -0
- package/lib/typescript/Glass.d.ts +11 -2
- package/lib/typescript/Group.d.ts +35 -0
- package/lib/typescript/IconButton.d.ts +21 -0
- package/lib/typescript/Input.d.ts +17 -18
- package/lib/typescript/Label.d.ts +14 -0
- package/lib/typescript/MorphGroup.d.ts +46 -0
- package/lib/typescript/Popover.d.ts +17 -0
- package/lib/typescript/Progress.d.ts +13 -0
- package/lib/typescript/RadioGroup.d.ts +21 -0
- package/lib/typescript/Scrim.d.ts +33 -0
- package/lib/typescript/SegmentedControl.d.ts +24 -13
- package/lib/typescript/Select.d.ts +19 -0
- package/lib/typescript/Separator.d.ts +10 -0
- package/lib/typescript/Sheet.d.ts +45 -0
- package/lib/typescript/Skeleton.d.ts +10 -0
- package/lib/typescript/Slider.d.ts +15 -7
- package/lib/typescript/Stepper.d.ts +49 -0
- package/lib/typescript/Switch.d.ts +19 -12
- package/lib/typescript/TabBar.d.ts +18 -6
- package/lib/typescript/Textarea.d.ts +6 -0
- package/lib/typescript/Toast.d.ts +40 -0
- package/lib/typescript/Toggle.d.ts +21 -0
- package/lib/typescript/ToggleGroup.d.ts +22 -0
- package/lib/typescript/Toolbar.d.ts +35 -0
- package/lib/typescript/Tooltip.d.ts +16 -0
- package/lib/typescript/glass-provider.d.ts +34 -0
- package/lib/typescript/glass-stack.d.ts +54 -0
- package/lib/typescript/index.d.ts +39 -17
- package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
- package/lib/typescript/internal/GlassView.d.ts +31 -2
- package/lib/typescript/internal/blur-community.d.ts +2 -0
- package/lib/typescript/internal/blur-community.web.d.ts +2 -0
- package/lib/typescript/internal/blur.d.ts +24 -0
- package/lib/typescript/internal/fallback.d.ts +27 -2
- package/lib/typescript/internal/glass-routing.d.ts +83 -15
- package/lib/typescript/internal/glow.d.ts +11 -0
- package/lib/typescript/internal/initials.d.ts +2 -0
- package/lib/typescript/internal/lens.d.ts +47 -0
- package/lib/typescript/internal/material.d.ts +27 -0
- package/lib/typescript/internal/overlay.d.ts +74 -0
- package/lib/typescript/internal/primitives.d.ts +13 -0
- package/lib/typescript/internal/rim.d.ts +16 -0
- package/lib/typescript/internal/tokens.d.ts +36 -0
- package/package.json +15 -4
- package/src/Accordion.tsx +165 -0
- package/src/ActionSheet.tsx +149 -0
- package/src/Alert.tsx +85 -0
- package/src/AlertDialog.tsx +124 -0
- package/src/Avatar.tsx +102 -0
- package/src/Badge.tsx +80 -0
- package/src/Bars.tsx +10 -797
- package/src/Button.tsx +196 -60
- package/src/Card.tsx +106 -33
- package/src/Checkbox.tsx +98 -0
- package/src/Chip.tsx +149 -0
- package/src/Collapsible.tsx +66 -0
- package/src/ContextMenu.tsx +103 -0
- package/src/Dialog.tsx +86 -325
- package/src/DropdownMenu.tsx +103 -0
- package/src/Field.tsx +65 -0
- package/src/Glass.tsx +19 -5
- package/src/Group.tsx +98 -0
- package/src/IconButton.tsx +110 -0
- package/src/Input.tsx +143 -87
- package/src/Label.tsx +56 -0
- package/src/MorphGroup.tsx +134 -0
- package/src/Popover.tsx +81 -0
- package/src/Progress.tsx +83 -0
- package/src/RadioGroup.tsx +122 -0
- package/src/Scrim.tsx +94 -0
- package/src/SegmentedControl.tsx +147 -90
- package/src/Select.tsx +136 -0
- package/src/Separator.tsx +52 -0
- package/src/Sheet.tsx +139 -0
- package/src/Skeleton.tsx +77 -0
- package/src/Slider.tsx +100 -54
- package/src/Stepper.tsx +315 -0
- package/src/Switch.tsx +80 -58
- package/src/TabBar.tsx +118 -84
- package/src/Tabs.tsx +5 -0
- package/src/Textarea.tsx +34 -0
- package/src/Toast.tsx +131 -0
- package/src/Toggle.tsx +113 -0
- package/src/ToggleGroup.tsx +129 -0
- package/src/Toolbar.tsx +111 -0
- package/src/Tooltip.tsx +79 -0
- package/src/engine/CHANGELOG.md +430 -0
- package/src/engine/NOTICE +54 -0
- package/src/engine/README.md +975 -0
- package/src/engine/android/build.gradle +18 -0
- package/src/engine/android/src/main/AndroidManifest.xml +2 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
- package/src/engine/index.ts +24 -0
- package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
- package/src/engine/ios/Enums/GlassVariant.swift +86 -0
- package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
- package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
- package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
- package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
- package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
- package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
- package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
- package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
- package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
- package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
- package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
- package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
- package/src/engine/ios/Glass/StripCache.swift +545 -0
- package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
- package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
- package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
- package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
- package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
- package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
- package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
- package/src/engine/package.json +70 -0
- package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
- package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
- package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
- package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
- package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
- package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
- package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
- package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
- package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
- package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
- package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
- package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
- package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
- package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
- package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
- package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
- package/src/engine/src/components/index.ts +16 -0
- package/src/engine/src/constants/index.ts +4 -0
- package/src/engine/src/constants/metal.constants.ts +327 -0
- package/src/engine/src/constants/metrics.constants.ts +325 -0
- package/src/engine/src/constants/springs.constants.ts +107 -0
- package/src/engine/src/constants/styles.constants.ts +12 -0
- package/src/engine/src/context/glass-group.context.ts +65 -0
- package/src/engine/src/context/index.ts +6 -0
- package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
- package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
- package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
- package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
- package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
- package/src/engine/src/core/components/index.ts +4 -0
- package/src/engine/src/core/constants/glass.constants.ts +57 -0
- package/src/engine/src/core/constants/index.ts +20 -0
- package/src/engine/src/core/constants/native.constants.ts +16 -0
- package/src/engine/src/core/context/glass-stack.context.ts +30 -0
- package/src/engine/src/core/context/index.ts +4 -0
- package/src/engine/src/core/enum/index.ts +12 -0
- package/src/engine/src/core/index.ts +1 -0
- package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
- package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
- package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
- package/src/engine/src/core/interfaces/index.ts +31 -0
- package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
- package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
- package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
- package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
- package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
- package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
- package/src/engine/src/core/modules/index.ts +2 -0
- package/src/engine/src/core/root/index.ts +51 -0
- package/src/engine/src/core/types/glass.types.ts +25 -0
- package/src/engine/src/core/types/index.ts +8 -0
- package/src/engine/src/core/utils/debug.utils.ts +17 -0
- package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
- package/src/engine/src/core/utils/hdr.utils.ts +37 -0
- package/src/engine/src/core/utils/index.ts +5 -0
- package/src/engine/src/core/utils/native-view.utils.ts +33 -0
- package/src/engine/src/core/utils/platform.utils.ts +34 -0
- package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
- package/src/engine/src/core/views/index.ts +4 -0
- package/src/engine/src/hooks/index.ts +18 -0
- package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
- package/src/engine/src/hooks/use-damped-drag.ts +332 -0
- package/src/engine/src/hooks/use-echo-filter.ts +55 -0
- package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
- package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
- package/src/engine/src/hooks/use-press-progress.ts +44 -0
- package/src/engine/src/index.ts +120 -0
- package/src/engine/src/interfaces/index.ts +28 -0
- package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
- package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
- package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
- package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
- package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
- package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
- package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
- package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
- package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
- package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
- package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
- package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
- package/src/engine/src/theme/glass-ui-theme.ts +100 -0
- package/src/engine/src/theme/index.ts +2 -0
- package/src/engine/src/utils/button-press.utils.ts +63 -0
- package/src/engine/src/utils/index.ts +3 -0
- package/src/engine/src/utils/metal.utils.ts +164 -0
- package/src/glass-provider.tsx +60 -0
- package/src/glass-stack.tsx +115 -0
- package/src/index.ts +48 -190
- package/src/internal/GlassBackdrop.tsx +60 -0
- package/src/internal/GlassView.tsx +70 -18
- package/src/internal/blur-community.ts +19 -0
- package/src/internal/blur-community.web.ts +7 -0
- package/src/internal/blur.ts +89 -0
- package/src/internal/fallback.tsx +158 -20
- package/src/internal/glass-routing.ts +211 -34
- package/src/internal/glow.tsx +62 -0
- package/src/internal/initials.ts +7 -0
- package/src/internal/lens.tsx +105 -0
- package/src/internal/material.ts +92 -0
- package/src/internal/overlay.tsx +258 -0
- package/src/internal/primitives.ts +26 -0
- package/src/internal/rim.tsx +79 -0
- package/src/internal/tokens.ts +34 -1
- package/lib/module/Carousel.js +0 -103
- package/lib/module/Display.js +0 -317
- package/lib/module/Feedback.js +0 -386
- package/lib/module/Form.js +0 -164
- package/lib/module/Forms2.js +0 -454
- package/lib/module/Message.js +0 -88
- package/lib/module/Overlays.js +0 -328
- package/lib/module/Pickers.js +0 -243
- package/lib/module/Table.js +0 -99
- package/lib/module/ai.js +0 -280
- package/lib/module/charts/AreaChart.js +0 -32
- package/lib/module/charts/BarChart.js +0 -67
- package/lib/module/charts/FunnelChart.js +0 -50
- package/lib/module/charts/HeatmapChart.js +0 -71
- package/lib/module/charts/LineChart.js +0 -81
- package/lib/module/charts/PlotChart.js +0 -52
- package/lib/module/charts/RadarChart.js +0 -78
- package/lib/module/charts/RingChart.js +0 -52
- package/lib/module/charts/ScatterChart.js +0 -95
- package/lib/module/charts/WaterfallChart.js +0 -85
- package/lib/module/charts/advanced.js +0 -313
- package/lib/module/charts/extra.js +0 -108
- package/lib/module/charts/index.js +0 -50
- package/lib/module/charts/scales.js +0 -140
- package/lib/typescript/Carousel.d.ts +0 -47
- package/lib/typescript/Display.d.ts +0 -178
- package/lib/typescript/Feedback.d.ts +0 -196
- package/lib/typescript/Form.d.ts +0 -97
- package/lib/typescript/Forms2.d.ts +0 -209
- package/lib/typescript/Message.d.ts +0 -71
- package/lib/typescript/Overlays.d.ts +0 -146
- package/lib/typescript/Pickers.d.ts +0 -105
- package/lib/typescript/Table.d.ts +0 -64
- package/lib/typescript/ai.d.ts +0 -166
- package/lib/typescript/charts/AreaChart.d.ts +0 -44
- package/lib/typescript/charts/BarChart.d.ts +0 -19
- package/lib/typescript/charts/FunnelChart.d.ts +0 -25
- package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
- package/lib/typescript/charts/LineChart.d.ts +0 -30
- package/lib/typescript/charts/PlotChart.d.ts +0 -31
- package/lib/typescript/charts/RadarChart.d.ts +0 -27
- package/lib/typescript/charts/RingChart.d.ts +0 -28
- package/lib/typescript/charts/ScatterChart.d.ts +0 -34
- package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
- package/lib/typescript/charts/advanced.d.ts +0 -107
- package/lib/typescript/charts/extra.d.ts +0 -63
- package/lib/typescript/charts/index.d.ts +0 -13
- package/lib/typescript/charts/scales.d.ts +0 -35
- package/src/Carousel.tsx +0 -233
- package/src/Display.tsx +0 -778
- package/src/Feedback.tsx +0 -969
- package/src/Form.tsx +0 -425
- package/src/Forms2.tsx +0 -1014
- package/src/Message.tsx +0 -219
- package/src/Overlays.tsx +0 -685
- package/src/Pickers.tsx +0 -590
- package/src/Table.tsx +0 -231
- package/src/ai.tsx +0 -707
- package/src/charts/AreaChart.tsx +0 -73
- package/src/charts/BarChart.tsx +0 -183
- package/src/charts/FunnelChart.tsx +0 -125
- package/src/charts/HeatmapChart.tsx +0 -155
- package/src/charts/LineChart.tsx +0 -247
- package/src/charts/PlotChart.tsx +0 -168
- package/src/charts/RadarChart.tsx +0 -208
- package/src/charts/RingChart.tsx +0 -133
- package/src/charts/ScatterChart.tsx +0 -223
- package/src/charts/WaterfallChart.tsx +0 -201
- package/src/charts/advanced.tsx +0 -676
- package/src/charts/extra.tsx +0 -242
- package/src/charts/index.ts +0 -86
- package/src/charts/scales.ts +0 -163
package/lib/module/Carousel.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PageControl = exports.Carousel = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const tokens_1 = require("./internal/tokens");
|
|
7
|
-
const primitives_1 = require("./internal/primitives");
|
|
8
|
-
const motion_1 = require("./internal/motion");
|
|
9
|
-
/**
|
|
10
|
-
* A horizontally paging swiper.
|
|
11
|
-
*
|
|
12
|
-
* It rides the resolver's ScrollView with `pagingEnabled`, so the paging feel is
|
|
13
|
-
* the platform's own and the pages are plain content the caller supplies. The
|
|
14
|
-
* active page is derived from the scroll offset, which is also what reports
|
|
15
|
-
* `onIndexChange`.
|
|
16
|
-
*/
|
|
17
|
-
exports.Carousel = (0, react_1.forwardRef)(function Carousel({ slides, index: indexProp, defaultIndex = 0, onIndexChange, gap = 0, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
18
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
19
|
-
const { getScrollView } = (0, primitives_1.primitives)();
|
|
20
|
-
const ScrollView = getScrollView();
|
|
21
|
-
const { View } = (0, primitives_1.primitives)();
|
|
22
|
-
const [internalIndex, setInternalIndex] = (0, react_1.useState)(defaultIndex);
|
|
23
|
-
const index = indexProp !== undefined ? indexProp : internalIndex;
|
|
24
|
-
const viewportWidth = (0, react_1.useRef)(0);
|
|
25
|
-
const scrollRef = (0, react_1.useRef)(null);
|
|
26
|
-
// Derives the page from the offset rather than trusting a counter, so a
|
|
27
|
-
// fast swipe that skips pages still reports the page it landed on.
|
|
28
|
-
const handleScroll = (event) => {
|
|
29
|
-
const { contentOffset, layoutMeasurement } = event?.nativeEvent ?? {};
|
|
30
|
-
const width = layoutMeasurement?.width || viewportWidth.current;
|
|
31
|
-
if (!width || !contentOffset)
|
|
32
|
-
return;
|
|
33
|
-
const next = Math.round(contentOffset.x / width);
|
|
34
|
-
const clamped = Math.min(Math.max(next, 0), Math.max(slides.length - 1, 0));
|
|
35
|
-
if (clamped !== index) {
|
|
36
|
-
if (indexProp === undefined)
|
|
37
|
-
setInternalIndex(clamped);
|
|
38
|
-
onIndexChange?.(clamped);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const pages = slides.map((slide, i) => ((0, jsx_runtime_1.jsx)(View, { style: { width: viewportWidth.current || "100%", paddingRight: gap }, children: slide }, i)));
|
|
42
|
-
// Off-device there is no ScrollView; the pages still render in a row so the
|
|
43
|
-
// component mounts, and the tests drive `handleScroll` through onScroll.
|
|
44
|
-
if (!ScrollView) {
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, style: [{ flexDirection: "row", overflow: "hidden" }, style], ...props, children: pages }));
|
|
46
|
-
}
|
|
47
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, onLayout: (event) => {
|
|
48
|
-
viewportWidth.current = event?.nativeEvent?.layout?.width ?? 0;
|
|
49
|
-
}, style: style, ...props, children: (0, jsx_runtime_1.jsx)(ScrollView, { ref: scrollRef, horizontal: true, pagingEnabled: gap === 0, showsHorizontalScrollIndicator: false, onScroll: handleScroll, scrollEventThrottle: 16, accessibilityRole: "adjustable", accessibilityLabel: "Carousel", accessibilityValue: { min: 0, max: Math.max(slides.length - 1, 0), now: index }, accessibilityActions: [{ name: "increment" }, { name: "decrement" }], onAccessibilityAction: (event) => {
|
|
50
|
-
const step = event?.nativeEvent?.actionName === "increment" ? 1 : -1;
|
|
51
|
-
const next = Math.min(Math.max(index + step, 0), Math.max(slides.length - 1, 0));
|
|
52
|
-
if (next === index)
|
|
53
|
-
return;
|
|
54
|
-
if (indexProp === undefined)
|
|
55
|
-
setInternalIndex(next);
|
|
56
|
-
onIndexChange?.(next);
|
|
57
|
-
}, children: pages }) }));
|
|
58
|
-
});
|
|
59
|
-
const DOT = 7;
|
|
60
|
-
const ACTIVE_DOT = 18;
|
|
61
|
-
/**
|
|
62
|
-
* The page dots.
|
|
63
|
-
*
|
|
64
|
-
* The active dot elongates and the others stay narrow, which is how iOS reads
|
|
65
|
-
* "you are here". The width change runs on the springs token through Animated.
|
|
66
|
-
*/
|
|
67
|
-
exports.PageControl = (0, react_1.forwardRef)(function PageControl({ count, activeIndex: activeProp, defaultActiveIndex = 0, onChange, tint, hidesForSinglePage = false, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
68
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
69
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
70
|
-
const { View, Pressable } = (0, primitives_1.primitives)();
|
|
71
|
-
const [internalIndex, setInternalIndex] = (0, react_1.useState)(defaultActiveIndex);
|
|
72
|
-
const active = activeProp !== undefined ? activeProp : internalIndex;
|
|
73
|
-
if (hidesForSinglePage && count <= 1)
|
|
74
|
-
return null;
|
|
75
|
-
// The accent tints the active dot; the resting dots sit on `glassActive` so
|
|
76
|
-
// selection reads the same way it does in SegmentedControl and TabBar.
|
|
77
|
-
const accent = tint ?? theme.fill;
|
|
78
|
-
const resting = theme.glassActive;
|
|
79
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "tablist", style: [{ flexDirection: "row", alignItems: "center", gap: 6, alignSelf: "center" }, style], ...props, children: Array.from({ length: Math.max(count, 0) }, (_, index) => {
|
|
80
|
-
const isActive = index === active;
|
|
81
|
-
return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "tab", accessibilityLabel: `Page ${index + 1} of ${count}`, accessibilityState: { selected: isActive }, onPress: () => {
|
|
82
|
-
if (activeProp === undefined)
|
|
83
|
-
setInternalIndex(index);
|
|
84
|
-
onChange?.(index);
|
|
85
|
-
}, hitSlop: 8, children: (0, jsx_runtime_1.jsx)(Dot, { active: isActive, accent: accent, muted: resting }) }, index));
|
|
86
|
-
}) }));
|
|
87
|
-
});
|
|
88
|
-
/** One dot, whose width springs between the resting and active lengths. */
|
|
89
|
-
function Dot({ active, accent, muted }) {
|
|
90
|
-
const { Animated, View } = (0, primitives_1.primitives)();
|
|
91
|
-
const { value: progress, animated } = (0, motion_1.useSpring)(active ? 1 : 0, "snappy");
|
|
92
|
-
const width = animated
|
|
93
|
-
? progress.interpolate({ inputRange: [0, 1], outputRange: [DOT, ACTIVE_DOT] })
|
|
94
|
-
: active
|
|
95
|
-
? ACTIVE_DOT
|
|
96
|
-
: DOT;
|
|
97
|
-
const style = {
|
|
98
|
-
height: DOT,
|
|
99
|
-
borderRadius: DOT / 2,
|
|
100
|
-
backgroundColor: active ? accent : muted,
|
|
101
|
-
};
|
|
102
|
-
return animated ? ((0, jsx_runtime_1.jsx)(Animated.View, { style: { ...style, width } })) : ((0, jsx_runtime_1.jsx)(View, { style: { ...style, width: width } }));
|
|
103
|
-
}
|
package/lib/module/Display.js
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NativeImage = exports.Rating = exports.Progress = exports.Spinner = exports.Skeleton = exports.Separator = exports.Badge = exports.Avatar = void 0;
|
|
4
|
-
exports.initialsOf = initialsOf;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const Glass_1 = require("./Glass");
|
|
8
|
-
const tokens_1 = require("./internal/tokens");
|
|
9
|
-
const primitives_1 = require("./internal/primitives");
|
|
10
|
-
const motion_1 = require("./internal/motion");
|
|
11
|
-
const avatarSizes = { sm: 28, md: 40, lg: 64 };
|
|
12
|
-
/** First letters of the first and last word, as an avatar fallback. */
|
|
13
|
-
function initialsOf(name) {
|
|
14
|
-
const words = name.trim().split(/\s+/).filter(Boolean);
|
|
15
|
-
if (words.length === 0)
|
|
16
|
-
return "";
|
|
17
|
-
if (words.length === 1)
|
|
18
|
-
return words[0].slice(0, 2).toUpperCase();
|
|
19
|
-
return (words[0][0] + words[words.length - 1][0]).toUpperCase();
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* A person or entity: their picture, or their initials when there is none.
|
|
23
|
-
*
|
|
24
|
-
* The frame is Glacia's glass so it belongs to the same family as the rest of
|
|
25
|
-
* the library; the initials sit on it in the theme's foreground colour.
|
|
26
|
-
*/
|
|
27
|
-
exports.Avatar = (0, react_1.forwardRef)(function Avatar({ source, name, size = "md", status, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
28
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
29
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
30
|
-
const { View, Text, Image } = (0, primitives_1.primitives)();
|
|
31
|
-
// A broken remote image falls back to initials rather than an empty circle.
|
|
32
|
-
const [failed, setFailed] = (0, react_1.useState)(false);
|
|
33
|
-
const dimension = avatarSizes[size];
|
|
34
|
-
const initials = name ? initialsOf(name) : "";
|
|
35
|
-
const statusColor = status === "online" ? theme.on : status === "busy" ? theme.destructive : theme.muted;
|
|
36
|
-
const dot = Math.max(8, Math.round(dimension * 0.26));
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, accessible: true, accessibilityRole: "image", accessibilityLabel: name ? `Avatar of ${name}` : "Avatar", style: { width: dimension, height: dimension, ...style }, ...props, children: [(0, jsx_runtime_1.jsx)(Glass_1.Glass, { effect: "regular", isDark: isDark, style: {
|
|
38
|
-
width: dimension,
|
|
39
|
-
height: dimension,
|
|
40
|
-
borderRadius: dimension / 2,
|
|
41
|
-
alignItems: "center",
|
|
42
|
-
justifyContent: "center",
|
|
43
|
-
overflow: "hidden",
|
|
44
|
-
}, children: source && !failed ? ((0, jsx_runtime_1.jsx)(Image, { source: source, accessibilityLabel: name ?? "Avatar", onError: () => setFailed(true), style: { width: dimension, height: dimension } })) : ((0, jsx_runtime_1.jsx)(Text, { style: {
|
|
45
|
-
fontSize: Math.round(dimension * 0.38),
|
|
46
|
-
fontWeight: "600",
|
|
47
|
-
color: theme.foreground,
|
|
48
|
-
}, children: initials })) }), status && ((0, jsx_runtime_1.jsx)(View, { style: {
|
|
49
|
-
position: "absolute",
|
|
50
|
-
right: 0,
|
|
51
|
-
bottom: 0,
|
|
52
|
-
width: dot,
|
|
53
|
-
height: dot,
|
|
54
|
-
borderRadius: dot / 2,
|
|
55
|
-
backgroundColor: statusColor,
|
|
56
|
-
borderWidth: 1.5,
|
|
57
|
-
borderColor: theme.glassActive,
|
|
58
|
-
} }))] }));
|
|
59
|
-
});
|
|
60
|
-
/**
|
|
61
|
-
* A small count or dot.
|
|
62
|
-
*
|
|
63
|
-
* Deliberately not glass: a badge is a micro-element, and a translucent 16pt
|
|
64
|
-
* chip loses its contrast against whatever it sits on. It uses the solid theme
|
|
65
|
-
* tint instead, which is what makes it legible in both themes.
|
|
66
|
-
*/
|
|
67
|
-
exports.Badge = (0, react_1.forwardRef)(function Badge({ children, tone = "fill", overlay, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
68
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
69
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
70
|
-
const { View, Text } = (0, primitives_1.primitives)();
|
|
71
|
-
const background = tone === "destructive"
|
|
72
|
-
? theme.destructive
|
|
73
|
-
: tone === "success"
|
|
74
|
-
? theme.on
|
|
75
|
-
: tone === "muted"
|
|
76
|
-
? theme.muted
|
|
77
|
-
: theme.fill;
|
|
78
|
-
const isDot = children == null;
|
|
79
|
-
const height = isDot ? 10 : 18;
|
|
80
|
-
const badge = ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "text", accessibilityLabel: isDot ? undefined : String(children), style: {
|
|
81
|
-
minWidth: height,
|
|
82
|
-
height,
|
|
83
|
-
borderRadius: height / 2,
|
|
84
|
-
paddingHorizontal: isDot ? 0 : 6,
|
|
85
|
-
alignItems: "center",
|
|
86
|
-
justifyContent: "center",
|
|
87
|
-
backgroundColor: background,
|
|
88
|
-
...style,
|
|
89
|
-
}, ...props, children: !isDot && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, fontWeight: "700", color: theme.onTint }, numberOfLines: 1, children: children })) }));
|
|
90
|
-
if (overlay === undefined)
|
|
91
|
-
return badge;
|
|
92
|
-
// Overlaid: the badge floats at the top-right of whatever it decorates, which
|
|
93
|
-
// needs a positioned box around the child rather than a bare fragment.
|
|
94
|
-
return ((0, jsx_runtime_1.jsxs)(View, { style: { alignSelf: "flex-start" }, children: [overlay, (0, jsx_runtime_1.jsx)(View, { style: { position: "absolute", top: -4, right: -4 }, children: badge })] }));
|
|
95
|
-
});
|
|
96
|
-
/**
|
|
97
|
-
* A hairline divider in the theme's separator colour.
|
|
98
|
-
*
|
|
99
|
-
* A plain View rather than a Glass: a 1pt rule is not a surface, and glass on
|
|
100
|
-
* a line has nothing to refract.
|
|
101
|
-
*/
|
|
102
|
-
exports.Separator = (0, react_1.forwardRef)(function Separator({ orientation = "horizontal", inset = 0, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
103
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
104
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
105
|
-
const { View } = (0, primitives_1.primitives)();
|
|
106
|
-
const separatorStyle = orientation === "horizontal"
|
|
107
|
-
? { height: 0.5, alignSelf: "stretch", marginLeft: inset, backgroundColor: theme.separator }
|
|
108
|
-
: { width: 0.5, alignSelf: "stretch", backgroundColor: theme.separator };
|
|
109
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "none", style: { ...separatorStyle, ...style }, ...props }));
|
|
110
|
-
});
|
|
111
|
-
/**
|
|
112
|
-
* A loading placeholder.
|
|
113
|
-
*
|
|
114
|
-
* The pulse is opacity only and slow, on the gentle spring, so it reads as
|
|
115
|
-
* "loading" without motion that could bother someone sensitive to movement.
|
|
116
|
-
* Nothing about it is essential to understanding the screen, so it is hidden
|
|
117
|
-
* from screen readers rather than announced.
|
|
118
|
-
*/
|
|
119
|
-
exports.Skeleton = (0, react_1.forwardRef)(function Skeleton({ shape = "rect", width, height, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
120
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
121
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
122
|
-
const { View, Animated } = (0, primitives_1.primitives)();
|
|
123
|
-
const { value: pulse, animated } = (0, motion_1.useSpring)(1, "gentle");
|
|
124
|
-
const opacity = animated
|
|
125
|
-
? pulse.interpolate({ inputRange: [0, 1], outputRange: [0.35, 1] })
|
|
126
|
-
: 1;
|
|
127
|
-
const resolvedWidth = width ?? (shape === "line" ? "100%" : shape === "circle" ? 40 : 120);
|
|
128
|
-
const resolvedHeight = height ?? (shape === "line" ? 12 : shape === "circle" ? 40 : 80);
|
|
129
|
-
const radius = shape === "circle" ? Math.min(resolvedHeight, 9999) / 2 : shape === "line" ? tokens_1.radii.sm : tokens_1.radii.md;
|
|
130
|
-
const skeletonStyle = {
|
|
131
|
-
width: resolvedWidth,
|
|
132
|
-
height: resolvedHeight,
|
|
133
|
-
borderRadius: radius,
|
|
134
|
-
backgroundColor: theme.skeleton,
|
|
135
|
-
...style,
|
|
136
|
-
};
|
|
137
|
-
const a11y = { accessibilityRole: "none", accessible: false, testID };
|
|
138
|
-
return animated ? ((0, jsx_runtime_1.jsx)(Animated.View, { ref: ref, style: { ...skeletonStyle, opacity }, ...a11y, ...props })) : ((0, jsx_runtime_1.jsx)(View, { ref: ref, style: skeletonStyle, ...a11y, ...props }));
|
|
139
|
-
});
|
|
140
|
-
const spinnerSizes = { sm: 16, md: 22, lg: 32 };
|
|
141
|
-
/**
|
|
142
|
-
* A loading spinner, drawn by Glacia.
|
|
143
|
-
*
|
|
144
|
-
* An SVG arc that rotates on the gentle spring through Animated — not the
|
|
145
|
-
* platform's ActivityIndicator, so it looks the same on every platform and
|
|
146
|
-
* wears the theme's colour instead of inheriting the system tint.
|
|
147
|
-
*/
|
|
148
|
-
exports.Spinner = (0, react_1.forwardRef)(function Spinner({ size = "md", tint, accessibilityLabel = "Loading", style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
149
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
150
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
151
|
-
const { View, Svg, Circle, Animated } = (0, primitives_1.primitives)();
|
|
152
|
-
const dimension = spinnerSizes[size];
|
|
153
|
-
const stroke = Math.max(2, Math.round(dimension / 9));
|
|
154
|
-
const color = tint ?? theme.muted;
|
|
155
|
-
// An arc, not a full ring: a complete circle rotating looks static.
|
|
156
|
-
const circumference = 2 * Math.PI * ((dimension - stroke) / 2);
|
|
157
|
-
const dash = circumference * 0.28;
|
|
158
|
-
// A continuous spin never settles, so it is driven by Animated.timing on a
|
|
159
|
-
// loop rather than the spring hook, which is built for one-off targets.
|
|
160
|
-
const { Animated: AnimatedAPI, isNative } = (0, primitives_1.primitives)();
|
|
161
|
-
const spinning = isNative && Boolean(AnimatedAPI?.timing);
|
|
162
|
-
const rotation = (0, react_1.useRef)(null);
|
|
163
|
-
if (rotation.current === null) {
|
|
164
|
-
rotation.current = spinning ? new AnimatedAPI.Value(0) : null;
|
|
165
|
-
}
|
|
166
|
-
(0, react_1.useEffect)(() => {
|
|
167
|
-
if (!spinning || !rotation.current)
|
|
168
|
-
return;
|
|
169
|
-
rotation.current.setValue(0);
|
|
170
|
-
const loop = AnimatedAPI.loop(AnimatedAPI.timing(rotation.current, {
|
|
171
|
-
toValue: 1,
|
|
172
|
-
duration: 900,
|
|
173
|
-
useNativeDriver: true,
|
|
174
|
-
}));
|
|
175
|
-
loop.start?.();
|
|
176
|
-
return () => loop.stop?.();
|
|
177
|
-
}, [AnimatedAPI, spinning]);
|
|
178
|
-
const spinStyle = spinning
|
|
179
|
-
? {
|
|
180
|
-
transform: [
|
|
181
|
-
{
|
|
182
|
-
rotate: rotation.current.interpolate({
|
|
183
|
-
inputRange: [0, 1],
|
|
184
|
-
outputRange: ["0deg", "360deg"],
|
|
185
|
-
}),
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
}
|
|
189
|
-
: undefined;
|
|
190
|
-
const svg = ((0, jsx_runtime_1.jsxs)(Svg, { width: dimension, height: dimension, viewBox: `0 0 ${dimension} ${dimension}`, children: [(0, jsx_runtime_1.jsx)(Circle, { cx: dimension / 2, cy: dimension / 2, r: (dimension - stroke) / 2, stroke: theme.skeleton, strokeWidth: stroke, fill: "none" }), (0, jsx_runtime_1.jsx)(Circle, { cx: dimension / 2, cy: dimension / 2, r: (dimension - stroke) / 2, stroke: color, strokeWidth: stroke, fill: "none", strokeLinecap: "round", strokeDasharray: `${dash} ${circumference - dash}` })] }));
|
|
191
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "progressbar", accessibilityLabel: accessibilityLabel, style: [{ width: dimension, height: dimension }, style], ...props, children: spinning ? (0, jsx_runtime_1.jsx)(Animated.View, { style: spinStyle, children: svg }) : svg }));
|
|
192
|
-
});
|
|
193
|
-
const RING = 64;
|
|
194
|
-
/**
|
|
195
|
-
* Progress, linear or circular.
|
|
196
|
-
*
|
|
197
|
-
* The track is a glass surface, so it refracts what it sits on exactly like the
|
|
198
|
-
* rest of the library; the fill is the theme accent. Both forms report
|
|
199
|
-
* `progressbar` with a value, which is the contract NativeTask relies on
|
|
200
|
-
* internally — this component generalises it.
|
|
201
|
-
*/
|
|
202
|
-
exports.Progress = (0, react_1.forwardRef)(function Progress({ value, variant = "bar", tint, accessibilityLabel, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
203
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
204
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
205
|
-
const { View, Text, Svg, Circle } = (0, primitives_1.primitives)();
|
|
206
|
-
const clamped = Math.min(Math.max(value, 0), 100);
|
|
207
|
-
const fill = tint ?? theme.fill;
|
|
208
|
-
const a11y = {
|
|
209
|
-
accessibilityRole: "progressbar",
|
|
210
|
-
accessibilityValue: { min: 0, max: 100, now: Math.round(clamped) },
|
|
211
|
-
accessibilityLabel,
|
|
212
|
-
testID,
|
|
213
|
-
};
|
|
214
|
-
if (variant === "ring") {
|
|
215
|
-
const stroke = 6;
|
|
216
|
-
const radius = (RING - stroke) / 2;
|
|
217
|
-
const circumference = 2 * Math.PI * radius;
|
|
218
|
-
return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, style: [{ width: RING, height: RING }, style], ...a11y, ...props, children: [(0, jsx_runtime_1.jsxs)(Svg, { width: RING, height: RING, viewBox: `0 0 ${RING} ${RING}`, children: [(0, jsx_runtime_1.jsx)(Circle, { cx: RING / 2, cy: RING / 2, r: radius, stroke: theme.skeleton, strokeWidth: stroke, fill: "none" }), (0, jsx_runtime_1.jsx)(Circle, { cx: RING / 2, cy: RING / 2, r: radius, stroke: fill, strokeWidth: stroke, fill: "none", strokeLinecap: "round", strokeDasharray: `${(clamped / 100) * circumference} ${circumference}`,
|
|
219
|
-
// Start the arc at twelve o'clock, the way progress dials read.
|
|
220
|
-
transform: `rotate(-90 ${RING / 2} ${RING / 2})` })] }), (0, jsx_runtime_1.jsx)(View, { style: {
|
|
221
|
-
position: "absolute",
|
|
222
|
-
width: RING,
|
|
223
|
-
height: RING,
|
|
224
|
-
alignItems: "center",
|
|
225
|
-
justifyContent: "center",
|
|
226
|
-
}, children: (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 13, fontWeight: "600", color: theme.foreground }, children: `${Math.round(clamped)}%` }) })] }));
|
|
227
|
-
}
|
|
228
|
-
return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { ref: ref, effect: "regular", isDark: isDark, style: {
|
|
229
|
-
height: 8,
|
|
230
|
-
borderRadius: tokens_1.radii.pill,
|
|
231
|
-
overflow: "hidden",
|
|
232
|
-
justifyContent: "center",
|
|
233
|
-
...style,
|
|
234
|
-
}, ...a11y, ...props, children: (0, jsx_runtime_1.jsx)(View, { style: {
|
|
235
|
-
width: `${clamped}%`,
|
|
236
|
-
height: 8,
|
|
237
|
-
borderRadius: tokens_1.radii.pill,
|
|
238
|
-
backgroundColor: fill,
|
|
239
|
-
} }) }));
|
|
240
|
-
});
|
|
241
|
-
// ---------------------------------------------------------------------------
|
|
242
|
-
// Rating
|
|
243
|
-
/** The five-pointed star, as a path in a unit box. */
|
|
244
|
-
const STAR_PATH = "M12 2.4l2.95 5.98 6.6.96-4.78 4.66 1.13 6.57L12 17.46l-5.9 3.11 1.13-6.57L2.45 9.34l6.6-.96z";
|
|
245
|
-
/**
|
|
246
|
-
* A star rating.
|
|
247
|
-
*
|
|
248
|
-
* The stars are drawn as SVG paths from the resolver, so nothing is a
|
|
249
|
-
* platform control. A fractional value fills part of a star: 3.5 draws three
|
|
250
|
-
* full stars and one half, the half produced by clipping the filled star at the
|
|
251
|
-
* fraction's width rather than by rounding — a 4.5-star average must look like
|
|
252
|
-
* a 4.5-star average.
|
|
253
|
-
*
|
|
254
|
-
* Read-only unless `onChange` is given. With it, each star is tappable, the
|
|
255
|
-
* value is exposed as an adjustable control (increment/decrement through
|
|
256
|
-
* accessibility actions), and each star has its own label so a screen reader
|
|
257
|
-
* can name the exact rating it sets.
|
|
258
|
-
*/
|
|
259
|
-
exports.Rating = (0, react_1.forwardRef)(function Rating({ value, max = 5, size = "md", onChange, disabled = false, accessibilityLabel = "Rating", style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
260
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
261
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
262
|
-
const { View, Pressable, Svg, Path, Defs, ClipPath, Rect } = (0, primitives_1.primitives)();
|
|
263
|
-
const starSize = tokens_1.controlSizes.star[size];
|
|
264
|
-
const interactive = Boolean(onChange) && !disabled;
|
|
265
|
-
const clamped = Math.max(0, Math.min(value, max));
|
|
266
|
-
const setValue = (next) => {
|
|
267
|
-
const bounded = Math.max(0, Math.min(next, max));
|
|
268
|
-
onChange?.(bounded);
|
|
269
|
-
};
|
|
270
|
-
const star = (index) => {
|
|
271
|
-
// How much of this star is filled: 1 for a full star, 0 for empty, and the
|
|
272
|
-
// remainder for the one the value lands inside.
|
|
273
|
-
const filled = Math.max(0, Math.min(1, clamped - index));
|
|
274
|
-
const half = filled > 0 && filled < 1;
|
|
275
|
-
const glyph = ((0, jsx_runtime_1.jsxs)(Svg, { width: starSize, height: starSize, viewBox: "0 0 24 24", children: [half ? ((0, jsx_runtime_1.jsx)(Defs, { children: (0, jsx_runtime_1.jsx)(ClipPath, { id: `rating-clip-${index}`, children: (0, jsx_runtime_1.jsx)(Rect, { x: "0", y: "0", width: 24 * filled, height: 24 }) }) })) : null, (0, jsx_runtime_1.jsx)(Path, { d: STAR_PATH, fill: theme.separator }), filled > 0 ? ((0, jsx_runtime_1.jsx)(Path, { d: STAR_PATH, fill: theme.fill, ...(half ? { clipPath: `url(#rating-clip-${index})` } : {}) })) : null] }));
|
|
276
|
-
if (!interactive)
|
|
277
|
-
return (0, jsx_runtime_1.jsx)(View, { children: glyph }, index);
|
|
278
|
-
return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${index + 1} of ${max} stars`, accessibilityState: { selected: clamped === index + 1 }, onPress: () => setValue(index + 1), hitSlop: 4, children: glyph }, index));
|
|
279
|
-
};
|
|
280
|
-
const stars = Array.from({ length: Math.max(1, max) }, (_unused, index) => star(index));
|
|
281
|
-
if (!interactive && !onChange) {
|
|
282
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "text", accessibilityLabel: `${accessibilityLabel}, ${clamped} of ${max}`, style: { flexDirection: "row", alignItems: "center", gap: 2, ...style }, ...props, children: stars }));
|
|
283
|
-
}
|
|
284
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "adjustable", accessibilityLabel: accessibilityLabel, accessibilityState: { disabled }, accessibilityValue: { min: 0, max, now: clamped }, accessibilityActions: [{ name: "increment" }, { name: "decrement" }], onAccessibilityAction: (event) => {
|
|
285
|
-
if (disabled)
|
|
286
|
-
return;
|
|
287
|
-
if (event?.nativeEvent?.actionName === "increment")
|
|
288
|
-
setValue(clamped + 1);
|
|
289
|
-
if (event?.nativeEvent?.actionName === "decrement")
|
|
290
|
-
setValue(clamped - 1);
|
|
291
|
-
}, style: { flexDirection: "row", alignItems: "center", gap: 2, opacity: disabled ? 0.38 : 1, ...style }, ...props, children: stars }));
|
|
292
|
-
});
|
|
293
|
-
/**
|
|
294
|
-
* A plain image, with the loading and error states every app ends up writing.
|
|
295
|
-
*
|
|
296
|
-
* Three states, because an image on a phone is three states: loading (a
|
|
297
|
-
* Skeleton behind it), loaded (a fade in), and failed (the caller's fallback).
|
|
298
|
-
* Aspect ratio comes from `style`, so a caller sets `aspectRatio` and the height
|
|
299
|
-
* follows.
|
|
300
|
-
*
|
|
301
|
-
* This is the plain one; `NativeImageGeneration` is the AI-specific cousin and
|
|
302
|
-
* keeps its own state machine.
|
|
303
|
-
*/
|
|
304
|
-
exports.NativeImage = (0, react_1.forwardRef)(function NativeImage({ source, accessibilityLabel, placeholder, fallback, fadeIn = true, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
305
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
306
|
-
const { View, Image: RNImage, Animated } = (0, primitives_1.primitives)();
|
|
307
|
-
const [failed, setFailed] = (0, react_1.useState)(false);
|
|
308
|
-
const [loaded, setLoaded] = (0, react_1.useState)(false);
|
|
309
|
-
const { value: fade, animated } = (0, motion_1.useSpring)(loaded ? 1 : 0, "gentle");
|
|
310
|
-
const boxStyle = { overflow: "hidden", ...style };
|
|
311
|
-
if (failed && fallback) {
|
|
312
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, style: boxStyle, ...props, children: fallback }));
|
|
313
|
-
}
|
|
314
|
-
const imageStyle = { width: "100%", height: "100%" };
|
|
315
|
-
const opacity = fadeIn && animated ? fade : 1;
|
|
316
|
-
return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, style: boxStyle, ...props, children: [!loaded ? (0, jsx_runtime_1.jsx)(View, { style: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0 }, children: placeholder ?? (0, jsx_runtime_1.jsx)(exports.Skeleton, { shape: "rect", isDark: isDark }) }) : null, (0, jsx_runtime_1.jsx)(RNImage, { accessibilityRole: "image", accessibilityLabel: accessibilityLabel, source: source, onLoad: () => setLoaded(true), onError: () => setFailed(true), style: [imageStyle, animated ? { opacity } : null] })] }));
|
|
317
|
-
});
|