glacia-native 0.5.2 → 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/README.md +84 -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 -268
- package/lib/module/Button.js +57 -39
- package/lib/module/Card.js +31 -19
- 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 -123
- package/lib/module/DropdownMenu.js +33 -0
- package/lib/module/Field.js +22 -0
- package/lib/module/Glass.js +10 -3
- package/lib/module/Group.js +36 -0
- package/lib/module/IconButton.js +40 -0
- package/lib/module/Input.js +43 -38
- 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 +70 -63
- 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 +45 -34
- package/lib/module/Stepper.js +167 -0
- package/lib/module/Switch.js +45 -55
- package/lib/module/TabBar.js +50 -44
- 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 +43 -11
- 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 +6 -9
- package/lib/module/internal/glass-routing.js +154 -30
- package/lib/module/internal/initials.js +12 -0
- package/lib/module/internal/overlay.js +147 -0
- package/lib/module/internal/primitives.js +16 -0
- 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 +38 -17
- package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
- package/lib/typescript/internal/GlassView.d.ts +18 -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/glass-routing.d.ts +83 -15
- package/lib/typescript/internal/initials.d.ts +2 -0
- package/lib/typescript/internal/overlay.d.ts +74 -0
- package/lib/typescript/internal/primitives.d.ts +11 -0
- package/package.json +4 -2
- 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 -807
- package/src/Button.tsx +196 -67
- package/src/Card.tsx +105 -32
- 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 +85 -335
- package/src/DropdownMenu.tsx +103 -0
- package/src/Field.tsx +65 -0
- package/src/Glass.tsx +15 -5
- package/src/Group.tsx +98 -0
- package/src/IconButton.tsx +110 -0
- package/src/Input.tsx +139 -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 +132 -99
- 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 +84 -47
- package/src/Stepper.tsx +315 -0
- package/src/Switch.tsx +81 -73
- package/src/TabBar.tsx +106 -93
- 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 +47 -190
- package/src/internal/GlassBackdrop.tsx +60 -0
- package/src/internal/GlassView.tsx +53 -18
- package/src/internal/blur-community.ts +19 -0
- package/src/internal/blur-community.web.ts +7 -0
- package/src/internal/blur.ts +7 -8
- package/src/internal/glass-routing.ts +211 -34
- package/src/internal/initials.ts +7 -0
- package/src/internal/overlay.tsx +258 -0
- package/src/internal/primitives.ts +23 -0
- package/lib/module/Carousel.js +0 -103
- package/lib/module/Display.js +0 -318
- package/lib/module/Feedback.js +0 -395
- package/lib/module/Form.js +0 -160
- package/lib/module/Forms2.js +0 -471
- package/lib/module/Message.js +0 -84
- package/lib/module/Overlays.js +0 -344
- package/lib/module/Pickers.js +0 -243
- package/lib/module/Table.js +0 -100
- package/lib/module/ai.js +0 -283
- package/lib/module/charts/AreaChart.js +0 -32
- package/lib/module/charts/BarChart.js +0 -75
- 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 -67
- 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 -781
- package/src/Feedback.tsx +0 -992
- package/src/Form.tsx +0 -445
- package/src/Forms2.tsx +0 -1055
- package/src/Message.tsx +0 -218
- package/src/Overlays.tsx +0 -704
- package/src/Pickers.tsx +0 -595
- package/src/Table.tsx +0 -232
- package/src/ai.tsx +0 -715
- package/src/charts/AreaChart.tsx +0 -73
- package/src/charts/BarChart.tsx +0 -221
- 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
|
@@ -1,85 +1,262 @@
|
|
|
1
1
|
// The glass switch — the law of this library.
|
|
2
2
|
//
|
|
3
|
-
// Every glass surface in every Glacia Native component goes through
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
3
|
+
// Every glass surface in every Glacia Native component goes through the package
|
|
4
|
+
// surface, which routes here. The decision now comes from the engine vendored
|
|
5
|
+
// into this package (`src/engine` — a copy of
|
|
6
|
+
// https://github.com/capthndsme/expo-liquid-glass-ui, MIT), not from an external
|
|
7
|
+
// `@callstack/liquid-glass` package: the rebuild patches the engine's iOS capture
|
|
8
|
+
// code, which a dependency could not receive.
|
|
9
9
|
//
|
|
10
|
-
// The decision is split out
|
|
10
|
+
// The decision is split out of the React component so both branches can be
|
|
11
11
|
// exercised in tests: `routerFor` takes the module as an argument, and the
|
|
12
|
-
// default export routes on whatever
|
|
13
|
-
// always the
|
|
12
|
+
// default export routes on whatever the vendored engine reports. On a device
|
|
13
|
+
// the argument is always the vendored engine module, so the routing logic is
|
|
14
|
+
// unchanged; only its source moved.
|
|
14
15
|
|
|
15
16
|
declare const require: any;
|
|
16
17
|
|
|
18
|
+
/**
|
|
19
|
+
* The vendored engine's glass module, as the parts Glacia switches on.
|
|
20
|
+
*
|
|
21
|
+
* Mirrors the engine's public surface: the glass view, the merge container, the
|
|
22
|
+
* backdrop provider, the stacked-glass primitive, and the capability flags the
|
|
23
|
+
* renderer tier machinery fills in.
|
|
24
|
+
*/
|
|
17
25
|
export interface LiquidGlassModule {
|
|
18
26
|
LiquidGlassView?: any;
|
|
19
27
|
/**
|
|
20
28
|
* The container that merges nearby glass elements into one connected
|
|
21
|
-
* surface.
|
|
29
|
+
* surface. The engine names it `LiquidGlassContainer`; the older bridge
|
|
30
|
+
* package called it `LiquidGlassContainerView`. Both accepted.
|
|
22
31
|
*/
|
|
32
|
+
LiquidGlassContainer?: any;
|
|
23
33
|
LiquidGlassContainerView?: any;
|
|
34
|
+
/**
|
|
35
|
+
* Marks the content that should show through the glass (the Android backdrop
|
|
36
|
+
* source). Present on the engine module; unused off the Android tier.
|
|
37
|
+
*/
|
|
38
|
+
LiquidGlassProvider?: any;
|
|
39
|
+
LiquidGlassStack?: any;
|
|
40
|
+
/**
|
|
41
|
+
* The iOS backdrop scope view (Metal tier). Absent on the Android and native builds; a scope
|
|
42
|
+
* there would only add a view.
|
|
43
|
+
*/
|
|
44
|
+
NativeGlassBackdropView?: any;
|
|
45
|
+
/** The engine's mount gate: native (iOS 26+), Metal (iOS 16.4–25), AGSL (Android 13+). */
|
|
46
|
+
supportsGlass?: boolean;
|
|
47
|
+
/** Legacy spelling of the mount gate, from the older bridge package. */
|
|
24
48
|
isLiquidGlassSupported?: boolean;
|
|
49
|
+
/** Whether Apple's real `UIGlassEffect` is available (iOS 26+). */
|
|
50
|
+
supportsNativeGlass?: boolean;
|
|
25
51
|
}
|
|
26
52
|
|
|
27
53
|
/** The routing decision for one glass surface. */
|
|
28
54
|
export interface GlassRouter {
|
|
29
|
-
/** True when
|
|
55
|
+
/** True when a glass renderer can render at all — native, Metal or AGSL. */
|
|
30
56
|
supported: boolean;
|
|
31
|
-
/**
|
|
57
|
+
/** The engine's `LiquidGlassView`, or null when the fallback renders instead. */
|
|
32
58
|
LiquidGlassView: any;
|
|
33
59
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
60
|
+
* The engine's container that merges neighbouring glass, or null when the
|
|
61
|
+
* fallback wrapper renders instead. Exposed under the historical field name so
|
|
62
|
+
* the rest of the package keeps reading one decision.
|
|
36
63
|
*/
|
|
37
64
|
LiquidGlassContainerView: any;
|
|
65
|
+
/** The engine's backdrop provider, or null. */
|
|
66
|
+
LiquidGlassProvider: any;
|
|
67
|
+
/** The engine's stacked-glass primitive, or null. */
|
|
68
|
+
LiquidGlassStack: any;
|
|
69
|
+
/**
|
|
70
|
+
* True when the active tier is Apple's own `UIGlassEffect` (iOS 26+) rather
|
|
71
|
+
* than the engine's Metal or AGSL renderer. Optional so a routing decision
|
|
72
|
+
* that only carries the mount gate — the test double, the fallback wrapper —
|
|
73
|
+
* can still be read as a tier.
|
|
74
|
+
*/
|
|
75
|
+
native?: boolean;
|
|
38
76
|
}
|
|
39
77
|
|
|
40
78
|
/**
|
|
41
79
|
* Reads a liquid-glass module and decides which branch renders.
|
|
42
80
|
*
|
|
43
81
|
* A module only counts as supported when it exports the view *and* reports
|
|
44
|
-
* support; a missing export falls back rather than crashing.
|
|
82
|
+
* support; a missing export falls back rather than crashing. Below every glass
|
|
83
|
+
* tier the answer is `false`, which is what routes the surface to Glacia's
|
|
84
|
+
* fallback floor.
|
|
45
85
|
*/
|
|
46
86
|
export function routerFor(module: LiquidGlassModule | null | undefined): GlassRouter {
|
|
47
87
|
const view = module?.LiquidGlassView ?? null;
|
|
48
|
-
const container = module?.LiquidGlassContainerView ?? null;
|
|
88
|
+
const container = module?.LiquidGlassContainer ?? module?.LiquidGlassContainerView ?? null;
|
|
89
|
+
const provider = module?.LiquidGlassProvider ?? null;
|
|
90
|
+
const stack = module?.LiquidGlassStack ?? null;
|
|
91
|
+
const supported =
|
|
92
|
+
Boolean(module?.LiquidGlassView) &&
|
|
93
|
+
(module?.supportsGlass ?? module?.isLiquidGlassSupported ?? false) === true;
|
|
94
|
+
|
|
49
95
|
return {
|
|
50
|
-
|
|
51
|
-
// glass; the container is only needed by GlassContainer, which falls back
|
|
52
|
-
// when it is missing.
|
|
53
|
-
supported: Boolean(module?.isLiquidGlassSupported) && Boolean(view),
|
|
96
|
+
supported,
|
|
54
97
|
LiquidGlassView: view,
|
|
55
|
-
// The container merges only when the material itself is available; a
|
|
56
|
-
// container without the view would have nothing to merge.
|
|
57
98
|
LiquidGlassContainerView: container,
|
|
99
|
+
LiquidGlassProvider: provider,
|
|
100
|
+
LiquidGlassStack: stack,
|
|
101
|
+
native: module?.supportsNativeGlass === true,
|
|
58
102
|
};
|
|
59
103
|
}
|
|
60
104
|
|
|
61
105
|
/**
|
|
62
|
-
* Loads
|
|
106
|
+
* Loads the vendored glass engine.
|
|
63
107
|
*
|
|
64
108
|
* Resolved through `require` rather than a static import so the package stays
|
|
65
|
-
* importable where the native module is absent (jsdom tests, web preview).
|
|
66
|
-
* `
|
|
67
|
-
*
|
|
68
|
-
*
|
|
109
|
+
* importable where the native module is absent (jsdom tests, web preview). The
|
|
110
|
+
* engine's `supportsGlass` is a constant of the installed build — its iOS build
|
|
111
|
+
* reads the native module and answers true only on iOS 26+, its Android build
|
|
112
|
+
* answers for the AGSL tier — so loading it is how the verdict is learned.
|
|
69
113
|
*/
|
|
70
|
-
|
|
114
|
+
const ENGINE_MODULE_ID = "../engine";
|
|
115
|
+
|
|
116
|
+
function requireEngineModule(): any | null {
|
|
117
|
+
const scope = globalThis as any;
|
|
118
|
+
const req = typeof require === "function" ? require : scope.require;
|
|
119
|
+
if (typeof req !== "function") return null;
|
|
71
120
|
try {
|
|
72
|
-
const module =
|
|
73
|
-
|
|
74
|
-
return module as LiquidGlassModule;
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
121
|
+
const module = req(ENGINE_MODULE_ID);
|
|
122
|
+
return module ?? null;
|
|
77
123
|
} catch {
|
|
124
|
+
// The engine (or its native module) is not resolvable here: unsupported.
|
|
78
125
|
return null;
|
|
79
126
|
}
|
|
80
127
|
}
|
|
81
128
|
|
|
82
|
-
/** The installed
|
|
129
|
+
/** The installed engine's routing decision, computed once per process. */
|
|
83
130
|
export function defaultRouter(): GlassRouter {
|
|
84
131
|
return routerFor(loadLiquidGlass());
|
|
85
132
|
}
|
|
133
|
+
|
|
134
|
+
/** The installed engine's glass module, or null when it cannot be loaded. */
|
|
135
|
+
export function loadLiquidGlass(): LiquidGlassModule | null {
|
|
136
|
+
const module = requireEngineModule();
|
|
137
|
+
if (module && (module.LiquidGlassView || module.supportsGlass !== undefined)) {
|
|
138
|
+
return module as LiquidGlassModule;
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The capability verdicts Glacia switches on.
|
|
145
|
+
*/
|
|
146
|
+
export interface GlassCapabilities {
|
|
147
|
+
/** Whether any glass renderer (Apple's native, the Metal renderer, AGSL) exists. */
|
|
148
|
+
supported: boolean;
|
|
149
|
+
/** Whether Apple's own `UIGlassEffect` exists — iOS 26+ only. */
|
|
150
|
+
native: boolean;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Reads the capability verdicts from an explicit module, or from the engine. */
|
|
154
|
+
export function readCapabilities(module?: LiquidGlassModule | null): GlassCapabilities {
|
|
155
|
+
const resolved = module !== undefined ? module : loadLiquidGlass();
|
|
156
|
+
const supported =
|
|
157
|
+
resolved != null &&
|
|
158
|
+
Boolean(resolved.LiquidGlassView) &&
|
|
159
|
+
(resolved.supportsGlass ?? resolved.isLiquidGlassSupported ?? false) === true;
|
|
160
|
+
const native = resolved?.supportsNativeGlass === true;
|
|
161
|
+
return { supported, native };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Whether any glass renderer is available on this device — the mount gate.
|
|
166
|
+
*
|
|
167
|
+
* Resolves instead of blocking: the caller renders either the glass surface or
|
|
168
|
+
* the fallback floor from this, and the floor is the safe answer, so the check
|
|
169
|
+
* must always be able to finish. When no renderer verdict has arrived the
|
|
170
|
+
* absence *is* the verdict — unsupported — and the fallback floor renders.
|
|
171
|
+
*/
|
|
172
|
+
export function supportsGlass(module?: LiquidGlassModule | null): Promise<boolean> {
|
|
173
|
+
const capabilities = readCapabilities(module);
|
|
174
|
+
return Promise.resolve(capabilities.supported);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Whether Apple's own glass material (`UIGlassEffect`) is available — iOS 26+.
|
|
179
|
+
* The narrower question behind the mount gate; the renderer tier machinery picks
|
|
180
|
+
* Metal or AGSL below that.
|
|
181
|
+
*/
|
|
182
|
+
export function supportsNativeGlass(module?: LiquidGlassModule | null): boolean {
|
|
183
|
+
const resolved = module !== undefined ? module : loadLiquidGlass();
|
|
184
|
+
return resolved?.supportsNativeGlass === true;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The vendored engine's control components, by the Glacia-facing name.
|
|
189
|
+
*
|
|
190
|
+
* Every Wave 1 control is the engine's own component mounted through the same
|
|
191
|
+
* capability verdict the glass surface uses, so an unsupported device (or Expo
|
|
192
|
+
* Go, or Reduce Transparency) takes the Glacia fallback floor instead of the
|
|
193
|
+
* engine's own degrade-to-plain-view.
|
|
194
|
+
*/
|
|
195
|
+
const ENGINE_CONTROLS: Record<string, string> = {
|
|
196
|
+
Button: "LiquidGlassButton",
|
|
197
|
+
IconButton: "LiquidGlassIconButton",
|
|
198
|
+
Chip: "LiquidGlassChip",
|
|
199
|
+
Switch: "LiquidGlassSwitch",
|
|
200
|
+
Slider: "LiquidGlassSlider",
|
|
201
|
+
Stepper: "LiquidGlassStepper",
|
|
202
|
+
SegmentedControl: "LiquidGlassSegmentedControl",
|
|
203
|
+
Input: "LiquidGlassTextInput",
|
|
204
|
+
Card: "LiquidGlassCard",
|
|
205
|
+
Toolbar: "LiquidGlassToolbar",
|
|
206
|
+
Toast: "LiquidGlassToast",
|
|
207
|
+
Sheet: "LiquidGlassSheet",
|
|
208
|
+
TabBar: "LiquidGlassTabBar",
|
|
209
|
+
Group: "LiquidGlassGroup",
|
|
210
|
+
MorphGroup: "LiquidGlassMorphGroup",
|
|
211
|
+
Scrim: "LiquidGlassScrim",
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* The native backdrop scope, when the active tier is the Metal renderer.
|
|
216
|
+
*
|
|
217
|
+
* Only iOS 16.4–25 needs it: iOS 26+ reads the live window through Apple's own glass, and the
|
|
218
|
+
* Android renderer already has a provider contract of its own. Off that tier this is null and
|
|
219
|
+
* callers render a plain wrapper, so a `GlassBackdrop` never changes layout where it does
|
|
220
|
+
* nothing.
|
|
221
|
+
*/
|
|
222
|
+
let cachedBackdropScope: any | null | undefined;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Resolves the scope for the active tier. An explicit module is used by tests, the same way
|
|
226
|
+
* `readCapabilities` takes one: the routing question must be answerable without a device.
|
|
227
|
+
*/
|
|
228
|
+
export function loadBackdropScope(module?: LiquidGlassModule | null): any | null {
|
|
229
|
+
if (module !== undefined) {
|
|
230
|
+
const capabilities = readCapabilities(module);
|
|
231
|
+
return capabilities.supported && !capabilities.native
|
|
232
|
+
? (module as any)?.NativeGlassBackdropView ?? null
|
|
233
|
+
: null;
|
|
234
|
+
}
|
|
235
|
+
if (cachedBackdropScope !== undefined) return cachedBackdropScope;
|
|
236
|
+
const capabilities = readCapabilities();
|
|
237
|
+
const engine = requireEngineModule() as any;
|
|
238
|
+
cachedBackdropScope =
|
|
239
|
+
capabilities.supported && !capabilities.native
|
|
240
|
+
? engine?.NativeGlassBackdropView ?? null
|
|
241
|
+
: null;
|
|
242
|
+
return cachedBackdropScope;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** Clears the memoised backdrop route. Tests call this after flipping the module. */
|
|
246
|
+
export function resetBackdropScope() {
|
|
247
|
+
cachedBackdropScope = undefined;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** The Glacia names of every control the vendored engine carries. */
|
|
251
|
+
export const ENGINE_CONTROL_NAMES: readonly string[] = Object.freeze(
|
|
252
|
+
Object.keys(ENGINE_CONTROLS),
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
/** Loads one of the vendored engine's control components by Glacia-facing name. */
|
|
256
|
+
export function loadEngineControl(key: string): any | null {
|
|
257
|
+
const engine = requireEngineModule() as any;
|
|
258
|
+
const engineName = ENGINE_CONTROLS[key];
|
|
259
|
+
if (!engine || !engineName) return null;
|
|
260
|
+
const control = engine[engineName];
|
|
261
|
+
return control ?? null;
|
|
262
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The initials an avatar shows when there is no picture. Kept in one place. */
|
|
2
|
+
export function initialsOf(name: string): string {
|
|
3
|
+
const words = name.trim().split(/\s+/).filter(Boolean);
|
|
4
|
+
if (words.length === 0) return "";
|
|
5
|
+
if (words.length === 1) return words[0]!.slice(0, 2).toUpperCase();
|
|
6
|
+
return (words[0]![0]! + words[words.length - 1]![0]!).toUpperCase();
|
|
7
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// The invisible behaviour every Wave 2 component shares.
|
|
2
|
+
//
|
|
3
|
+
// These are the donor's contracts, implemented on React Native's own
|
|
4
|
+
// primitives: a component can be controlled or keep its own state, overlays
|
|
5
|
+
// dismiss on Android's back gesture and on an outside press, and every control
|
|
6
|
+
// exposes the accessibility role the donor gives it (checkbox, radio, tab,
|
|
7
|
+
// dialog, menu). Nothing here styles anything — the Apple dress lives in the
|
|
8
|
+
// component files.
|
|
9
|
+
|
|
10
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
11
|
+
import type { ReactNode } from "react";
|
|
12
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
13
|
+
|
|
14
|
+
import { Glass } from "../Glass";
|
|
15
|
+
import { colors, radii } from "./tokens";
|
|
16
|
+
import { primitives } from "./primitives";
|
|
17
|
+
import { useIsDark } from "./motion";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Controlled-or-uncontrolled state. The donor's model: a `value` prop makes the
|
|
21
|
+
* component controlled, `defaultValue` seeds it, and `onChange` is called either
|
|
22
|
+
* way. Kept in one place so every component behaves identically.
|
|
23
|
+
*/
|
|
24
|
+
export function useControllable<T>(
|
|
25
|
+
value: T | undefined,
|
|
26
|
+
defaultValue: T,
|
|
27
|
+
onChange?: (value: T) => void,
|
|
28
|
+
): [T, (next: T) => void] {
|
|
29
|
+
const [internal, setInternal] = useState(defaultValue);
|
|
30
|
+
const current = value !== undefined ? value : internal;
|
|
31
|
+
const set = useCallback(
|
|
32
|
+
(next: T) => {
|
|
33
|
+
if (value === undefined) setInternal(next);
|
|
34
|
+
onChange?.(next);
|
|
35
|
+
},
|
|
36
|
+
[value, onChange],
|
|
37
|
+
);
|
|
38
|
+
return [current, set];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Registers Android's hardware back while an overlay is open, so back closes the
|
|
43
|
+
* layer and not the screen behind it.
|
|
44
|
+
*/
|
|
45
|
+
export function useBackDismiss(open: boolean, dismiss: () => void) {
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!open) return;
|
|
48
|
+
const BackHandler = primitives().getBackHandler();
|
|
49
|
+
if (!BackHandler?.addEventListener) return;
|
|
50
|
+
const sub = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
51
|
+
dismiss();
|
|
52
|
+
return true;
|
|
53
|
+
});
|
|
54
|
+
return () => sub?.remove?.();
|
|
55
|
+
}, [open, dismiss]);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AnchorRect {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Reads a view's rectangle in window coordinates, when the runtime can. */
|
|
66
|
+
export function measureAnchor(node: any): Promise<AnchorRect | null> {
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
if (!node || typeof node.measureInWindow !== "function") {
|
|
69
|
+
resolve(null);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
node.measureInWindow((x: number, y: number, width: number, height: number) => {
|
|
74
|
+
resolve({ x, y, width, height });
|
|
75
|
+
});
|
|
76
|
+
} catch {
|
|
77
|
+
resolve(null);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Places a panel beside its trigger. Flips above when there is no room below,
|
|
84
|
+
* and clamps to the viewport otherwise — the donor's collision handling, kept
|
|
85
|
+
* deliberately small.
|
|
86
|
+
*/
|
|
87
|
+
export function placePanel(
|
|
88
|
+
trigger: AnchorRect,
|
|
89
|
+
panel: { width: number; height: number },
|
|
90
|
+
viewport: { width: number; height: number },
|
|
91
|
+
gap = 6,
|
|
92
|
+
): { left: number; top: number; flipped: boolean } {
|
|
93
|
+
const below = trigger.y + trigger.height + gap;
|
|
94
|
+
const above = trigger.y - panel.height - gap;
|
|
95
|
+
const fitsBelow = below + panel.height <= viewport.height;
|
|
96
|
+
const flipped = !fitsBelow && above >= 0;
|
|
97
|
+
const top = Math.max(8, Math.min(flipped ? above : below, viewport.height - panel.height - 8));
|
|
98
|
+
const left = Math.max(8, Math.min(trigger.x, viewport.width - panel.width - 8));
|
|
99
|
+
return { left, top, flipped };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* A full-screen modal layer with a dimmed backdrop and a glass panel. Used by
|
|
104
|
+
* Dialog, Alert, AlertDialog, Popover, DropdownMenu, ContextMenu, Select and
|
|
105
|
+
* Tooltip, so dismissal, back handling and the surface are one implementation.
|
|
106
|
+
*/
|
|
107
|
+
export function OverlayPanel({
|
|
108
|
+
open,
|
|
109
|
+
onClose,
|
|
110
|
+
dismissOnBackdropPress = true,
|
|
111
|
+
anchor,
|
|
112
|
+
width,
|
|
113
|
+
panelStyle,
|
|
114
|
+
children,
|
|
115
|
+
testID,
|
|
116
|
+
isDark: isDarkProp,
|
|
117
|
+
accessibilityLabel,
|
|
118
|
+
role = "menu",
|
|
119
|
+
}: {
|
|
120
|
+
open: boolean;
|
|
121
|
+
onClose: () => void;
|
|
122
|
+
dismissOnBackdropPress?: boolean;
|
|
123
|
+
anchor?: AnchorRect | null;
|
|
124
|
+
width?: number;
|
|
125
|
+
panelStyle?: StyleProp<ViewStyle>;
|
|
126
|
+
children: ReactNode;
|
|
127
|
+
testID?: string;
|
|
128
|
+
isDark?: boolean;
|
|
129
|
+
accessibilityLabel?: string;
|
|
130
|
+
role?: string;
|
|
131
|
+
}) {
|
|
132
|
+
const isDark = useIsDark(isDarkProp);
|
|
133
|
+
const theme = isDark ? colors.dark : colors.light;
|
|
134
|
+
const { View, Pressable, Modal, useWindowDimensions } = primitives();
|
|
135
|
+
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
|
136
|
+
useBackDismiss(open, onClose);
|
|
137
|
+
|
|
138
|
+
if (!open) return null;
|
|
139
|
+
|
|
140
|
+
const placed = anchor ? placePanel(anchor, { width: width ?? 240, height: 0 }, { width: screenWidth, height: screenHeight }) : null;
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<Modal visible transparent animationType="fade" onRequestClose={onClose}>
|
|
144
|
+
<View style={{ flex: 1, backgroundColor: theme.scrim }}>
|
|
145
|
+
<Pressable
|
|
146
|
+
accessibilityRole="button"
|
|
147
|
+
accessibilityLabel={dismissOnBackdropPress ? "Close" : undefined}
|
|
148
|
+
onPress={dismissOnBackdropPress ? onClose : undefined}
|
|
149
|
+
style={{ position: "absolute", top: 0, left: 0, right: 0, bottom: 0 }}
|
|
150
|
+
/>
|
|
151
|
+
<View
|
|
152
|
+
pointerEvents="box-none"
|
|
153
|
+
style={placed ? { position: "absolute", left: placed.left, top: placed.top } : { flex: 1, alignItems: "center", justifyContent: "center", padding: 24 }}
|
|
154
|
+
>
|
|
155
|
+
<Pressable accessibilityRole="none" onPress={() => {}}>
|
|
156
|
+
<Glass
|
|
157
|
+
effect="regular"
|
|
158
|
+
surface="overlay"
|
|
159
|
+
isDark={isDark}
|
|
160
|
+
testID={testID}
|
|
161
|
+
accessibilityLabel={accessibilityLabel}
|
|
162
|
+
accessibilityRole={role as any}
|
|
163
|
+
style={[
|
|
164
|
+
{
|
|
165
|
+
width: placed ? width ?? 240 : undefined,
|
|
166
|
+
maxWidth: screenWidth - 32,
|
|
167
|
+
borderRadius: radii.lg,
|
|
168
|
+
backgroundColor: theme.surface,
|
|
169
|
+
paddingVertical: 6,
|
|
170
|
+
},
|
|
171
|
+
panelStyle,
|
|
172
|
+
]}
|
|
173
|
+
>
|
|
174
|
+
{children}
|
|
175
|
+
</Glass>
|
|
176
|
+
</Pressable>
|
|
177
|
+
</View>
|
|
178
|
+
</View>
|
|
179
|
+
</Modal>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** One row inside an overlay panel — the donor's menu/option item. */
|
|
184
|
+
export function PanelItem({
|
|
185
|
+
label,
|
|
186
|
+
onPress,
|
|
187
|
+
icon,
|
|
188
|
+
destructive = false,
|
|
189
|
+
selected = false,
|
|
190
|
+
disabled = false,
|
|
191
|
+
role = "button",
|
|
192
|
+
style,
|
|
193
|
+
testID,
|
|
194
|
+
isDark: isDarkProp,
|
|
195
|
+
}: {
|
|
196
|
+
label: string;
|
|
197
|
+
onPress: () => void;
|
|
198
|
+
icon?: ReactNode;
|
|
199
|
+
destructive?: boolean;
|
|
200
|
+
selected?: boolean;
|
|
201
|
+
disabled?: boolean;
|
|
202
|
+
role?: string;
|
|
203
|
+
style?: StyleProp<ViewStyle>;
|
|
204
|
+
testID?: string;
|
|
205
|
+
isDark?: boolean;
|
|
206
|
+
}) {
|
|
207
|
+
const isDark = useIsDark(isDarkProp);
|
|
208
|
+
const theme = isDark ? colors.dark : colors.light;
|
|
209
|
+
const { View, Pressable, Text: RNText } = primitives();
|
|
210
|
+
return (
|
|
211
|
+
<Pressable
|
|
212
|
+
testID={testID}
|
|
213
|
+
accessibilityRole={role as any}
|
|
214
|
+
accessibilityLabel={label}
|
|
215
|
+
accessibilityState={{ disabled, selected }}
|
|
216
|
+
disabled={disabled}
|
|
217
|
+
onPress={onPress}
|
|
218
|
+
style={[
|
|
219
|
+
{
|
|
220
|
+
flexDirection: "row",
|
|
221
|
+
alignItems: "center",
|
|
222
|
+
gap: 10,
|
|
223
|
+
minHeight: 40,
|
|
224
|
+
paddingHorizontal: 14,
|
|
225
|
+
paddingVertical: 8,
|
|
226
|
+
opacity: disabled ? 0.38 : 1,
|
|
227
|
+
},
|
|
228
|
+
style,
|
|
229
|
+
]}
|
|
230
|
+
>
|
|
231
|
+
{icon ? <View>{icon}</View> : null}
|
|
232
|
+
<RNText
|
|
233
|
+
numberOfLines={1}
|
|
234
|
+
style={{
|
|
235
|
+
flex: 1,
|
|
236
|
+
fontSize: 15,
|
|
237
|
+
color: destructive ? theme.destructive : theme.foreground,
|
|
238
|
+
fontWeight: selected ? "600" : "400",
|
|
239
|
+
}}
|
|
240
|
+
>
|
|
241
|
+
{label}
|
|
242
|
+
</RNText>
|
|
243
|
+
{selected ? <RNText style={{ fontSize: 15, color: theme.fill }}>✓</RNText> : null}
|
|
244
|
+
</Pressable>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** A positioned trigger that reports its window rectangle when it is pressed. */
|
|
249
|
+
export function useTriggerAnchor() {
|
|
250
|
+
const ref = useRef<any>(null);
|
|
251
|
+
const [anchor, setAnchor] = useState<AnchorRect | null>(null);
|
|
252
|
+
const capture = useCallback(async () => {
|
|
253
|
+
const rect = await measureAnchor(ref.current);
|
|
254
|
+
if (rect) setAnchor(rect);
|
|
255
|
+
return rect;
|
|
256
|
+
}, []);
|
|
257
|
+
return { ref, anchor, capture };
|
|
258
|
+
}
|
|
@@ -66,6 +66,12 @@ export interface RNPrimitives {
|
|
|
66
66
|
* it can resolve them.
|
|
67
67
|
*/
|
|
68
68
|
useWindowDimensions: () => { width: number; height: number };
|
|
69
|
+
/**
|
|
70
|
+
* React Native's safe-area insets, or a zero reader off-device. Bottom bars
|
|
71
|
+
* (the TabBar) float the glass above the system inset — the Android nav bar or
|
|
72
|
+
* the iOS home indicator — instead of letting it sink under.
|
|
73
|
+
*/
|
|
74
|
+
useSafeAreaInsets: () => { top: number; bottom: number; left: number; right: number };
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
/**
|
|
@@ -167,6 +173,15 @@ function resolve(): RNPrimitives {
|
|
|
167
173
|
slider: "slider",
|
|
168
174
|
adjustable: "slider",
|
|
169
175
|
heading: "heading",
|
|
176
|
+
option: "option",
|
|
177
|
+
listbox: "listbox",
|
|
178
|
+
menu: "menu",
|
|
179
|
+
menuitem: "menuitem",
|
|
180
|
+
dialog: "dialog",
|
|
181
|
+
alertdialog: "alertdialog",
|
|
182
|
+
group: "group",
|
|
183
|
+
toolbar: "toolbar",
|
|
184
|
+
separator: "separator",
|
|
170
185
|
};
|
|
171
186
|
// "none" means presentational: emit no role rather than a misleading one.
|
|
172
187
|
if (accessibilityRole && accessibilityRole !== "none") {
|
|
@@ -331,6 +346,14 @@ function resolve(): RNPrimitives {
|
|
|
331
346
|
const view: any = typeof globalThis !== "undefined" ? (globalThis as any).window : undefined;
|
|
332
347
|
return { width: view?.innerWidth ?? 390, height: view?.innerHeight ?? 800 };
|
|
333
348
|
}),
|
|
349
|
+
useSafeAreaInsets:
|
|
350
|
+
rn?.useSafeAreaInsets ??
|
|
351
|
+
(() => ({
|
|
352
|
+
top: 0,
|
|
353
|
+
bottom: 0,
|
|
354
|
+
left: 0,
|
|
355
|
+
right: 0,
|
|
356
|
+
})),
|
|
334
357
|
};
|
|
335
358
|
}
|
|
336
359
|
|