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
|
@@ -2,19 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GlassView = exports.isGlassSupported = void 0;
|
|
4
4
|
exports.resetGlassRouter = resetGlassRouter;
|
|
5
|
+
exports.glassDecision = glassDecision;
|
|
6
|
+
exports.glassCapabilities = glassCapabilities;
|
|
5
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
8
|
const react_1 = require("react");
|
|
7
9
|
const fallback_1 = require("./fallback");
|
|
8
10
|
const glass_routing_1 = require("./glass-routing");
|
|
9
11
|
const motion_1 = require("./motion");
|
|
10
12
|
/**
|
|
11
|
-
* The installed
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* import order, which is what makes both branches reachable in tests.
|
|
13
|
+
* The installed engine module's routing decision, memoised on first use, rather
|
|
14
|
+
* than at module load, so the decision is taken when a surface first renders.
|
|
15
|
+
* On a device that is the same answer either way — the engine's capability flag
|
|
16
|
+
* is a constant of the installed build — but it keeps the choice a property of
|
|
17
|
+
* the module rather than of import order, which is what makes both branches
|
|
18
|
+
* reachable in tests.
|
|
18
19
|
*/
|
|
19
20
|
let cachedRouter = null;
|
|
20
21
|
function router() {
|
|
@@ -26,12 +27,32 @@ function router() {
|
|
|
26
27
|
function resetGlassRouter() {
|
|
27
28
|
cachedRouter = null;
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The memoised routing decision — the package's single source of truth for
|
|
32
|
+
* which glass surface a component may mount. Read through the same router the
|
|
33
|
+
* surface itself uses, so a component and its surface can never disagree about
|
|
34
|
+
* the mount tier.
|
|
35
|
+
*/
|
|
36
|
+
function glassDecision() {
|
|
37
|
+
return router();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The capability verdicts the package switches on, read through the same
|
|
41
|
+
* memoised decision as the surface — the one place a component's engine branch
|
|
42
|
+
* and its fallback floor are chosen from.
|
|
43
|
+
*/
|
|
44
|
+
function glassCapabilities() {
|
|
45
|
+
const decision = router();
|
|
46
|
+
return { supported: decision.supported, native: decision.native === true };
|
|
47
|
+
}
|
|
29
48
|
/** Whether this build renders Apple's glass. */
|
|
30
49
|
exports.isGlassSupported = (0, glass_routing_1.defaultRouter)().supported;
|
|
31
50
|
/**
|
|
32
51
|
* Platform Glass View — the single place a glass surface is chosen:
|
|
33
|
-
* - iOS 26+: Real UIGlassEffect via
|
|
34
|
-
* - iOS
|
|
52
|
+
* - iOS 26+: Real `UIGlassEffect` via the vendored engine's native view
|
|
53
|
+
* - iOS 16.4–25: the engine's Metal renderer over a captured backdrop
|
|
54
|
+
* - Android 13+: the engine's AGSL renderer over a recorded backdrop
|
|
55
|
+
* - Everywhere else: Glacia's own glass fallback of identical shape
|
|
35
56
|
*
|
|
36
57
|
* Reduce Transparency is honoured on the fallback branch only: there the
|
|
37
58
|
* translucent tint is replaced by the theme's solid glass colour, with the same
|
|
@@ -44,9 +65,20 @@ exports.isGlassSupported = (0, glass_routing_1.defaultRouter)().supported;
|
|
|
44
65
|
exports.GlassView = (0, react_1.forwardRef)(function GlassView({ effect = "regular", tintColor, interactive = false, surface = "panel", pressed, testID, style, children, isDark: isDarkProp, ...props }, ref) {
|
|
45
66
|
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
46
67
|
const decision = router();
|
|
47
|
-
|
|
68
|
+
// A deliberate "no surface here" (a ghost button) never mounts a material:
|
|
69
|
+
// the engine has no none-variant and the fallback paints nothing, so the
|
|
70
|
+
// content renders bare in both.
|
|
71
|
+
const bare = effect === "none";
|
|
72
|
+
if (!bare && decision.supported && decision.LiquidGlassView) {
|
|
48
73
|
const LiquidGlassView = decision.LiquidGlassView;
|
|
49
|
-
|
|
74
|
+
const variant = effect === "clear" ? "clear" : "regular";
|
|
75
|
+
const glow = pressed === undefined ? props.glow : { progress: pressed ? 1 : 0, lens: true };
|
|
76
|
+
// The engine owns the material; Glacia's own surface parameters stop at
|
|
77
|
+
// the branch. Everything else (accessibility contract, provider pairing,
|
|
78
|
+
// the adaptive sensor, an externally driven press) rides through.
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(LiquidGlassView, { ...props, ref: ref, variant: variant, tint: tintColor, interactive: interactive, glow: glow, style: style, testID: testID, children: children }));
|
|
50
80
|
}
|
|
81
|
+
// Unsupported, or a deliberate "no surface": the fallback floor renders —
|
|
82
|
+
// with the same shape, states and materials as the glass would have.
|
|
51
83
|
return ((0, jsx_runtime_1.jsx)(fallback_1.FallbackGlassView, { ref: ref, effect: effect, tintColor: tintColor, surface: surface, pressed: pressed, testID: testID, isDark: isDark, style: style, ...props, children: children }));
|
|
52
84
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The bare-React-Native blur backend, isolated so platform resolution can
|
|
3
|
+
// choose whether this file exists at all.
|
|
4
|
+
//
|
|
5
|
+
// `@react-native-community/blur` ships BlurView.ios.js / BlurView.android.js
|
|
6
|
+
// with no web build, so a web bundle that statically requires it fails to
|
|
7
|
+
// resolve `./components/BlurView`. Metro uses `blur-community.web.ts` for the
|
|
8
|
+
// web platform instead, and this module is only ever bundled natively.
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.loadCommunityBlurView = loadCommunityBlurView;
|
|
11
|
+
/** The community `BlurView`, or null when the package is not installed. */
|
|
12
|
+
function loadCommunityBlurView() {
|
|
13
|
+
try {
|
|
14
|
+
const community = require("@react-native-community/blur");
|
|
15
|
+
return community?.BlurView ?? null;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Web: the community blur has no web build, so it is never loaded and never
|
|
3
|
+
// resolved by Metro. `expo-blur` covers the web fallback through CSS blur.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.loadCommunityBlurView = loadCommunityBlurView;
|
|
6
|
+
/** Always null on web. */
|
|
7
|
+
function loadCommunityBlurView() {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.resolveBlurView = resolveBlurView;
|
|
18
18
|
exports.resetBlurResolver = resetBlurResolver;
|
|
19
19
|
exports.blurProps = blurProps;
|
|
20
|
+
const blur_community_1 = require("./blur-community");
|
|
20
21
|
let resolved;
|
|
21
22
|
/**
|
|
22
23
|
* The installed blur backend, or null when neither is available.
|
|
@@ -37,16 +38,12 @@ function resolveBlurView() {
|
|
|
37
38
|
catch {
|
|
38
39
|
// Not installed: try the bare-React-Native backend below.
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return resolved;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
// Neither backend is installed; the fallback renders tint, rim and shadow.
|
|
41
|
+
const communityView = (0, blur_community_1.loadCommunityBlurView)();
|
|
42
|
+
if (communityView) {
|
|
43
|
+
resolved = { kind: "community", View: communityView };
|
|
44
|
+
return resolved;
|
|
49
45
|
}
|
|
46
|
+
// Neither backend is installed; the fallback renders tint, rim and shadow.
|
|
50
47
|
resolved = null;
|
|
51
48
|
return resolved;
|
|
52
49
|
}
|
|
@@ -1,63 +1,187 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// The glass switch — the law of this library.
|
|
3
3
|
//
|
|
4
|
-
// Every glass surface in every Glacia Native component goes through
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
4
|
+
// Every glass surface in every Glacia Native component goes through the package
|
|
5
|
+
// surface, which routes here. The decision now comes from the engine vendored
|
|
6
|
+
// into this package (`src/engine` — a copy of
|
|
7
|
+
// https://github.com/capthndsme/expo-liquid-glass-ui, MIT), not from an external
|
|
8
|
+
// `@callstack/liquid-glass` package: the rebuild patches the engine's iOS capture
|
|
9
|
+
// code, which a dependency could not receive.
|
|
10
10
|
//
|
|
11
|
-
// The decision is split out
|
|
11
|
+
// The decision is split out of the React component so both branches can be
|
|
12
12
|
// exercised in tests: `routerFor` takes the module as an argument, and the
|
|
13
|
-
// default export routes on whatever
|
|
14
|
-
// always the
|
|
13
|
+
// default export routes on whatever the vendored engine reports. On a device
|
|
14
|
+
// the argument is always the vendored engine module, so the routing logic is
|
|
15
|
+
// unchanged; only its source moved.
|
|
15
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ENGINE_CONTROL_NAMES = void 0;
|
|
16
18
|
exports.routerFor = routerFor;
|
|
17
|
-
exports.loadLiquidGlass = loadLiquidGlass;
|
|
18
19
|
exports.defaultRouter = defaultRouter;
|
|
20
|
+
exports.loadLiquidGlass = loadLiquidGlass;
|
|
21
|
+
exports.readCapabilities = readCapabilities;
|
|
22
|
+
exports.supportsGlass = supportsGlass;
|
|
23
|
+
exports.supportsNativeGlass = supportsNativeGlass;
|
|
24
|
+
exports.loadBackdropScope = loadBackdropScope;
|
|
25
|
+
exports.resetBackdropScope = resetBackdropScope;
|
|
26
|
+
exports.loadEngineControl = loadEngineControl;
|
|
19
27
|
/**
|
|
20
28
|
* Reads a liquid-glass module and decides which branch renders.
|
|
21
29
|
*
|
|
22
30
|
* A module only counts as supported when it exports the view *and* reports
|
|
23
|
-
* support; a missing export falls back rather than crashing.
|
|
31
|
+
* support; a missing export falls back rather than crashing. Below every glass
|
|
32
|
+
* tier the answer is `false`, which is what routes the surface to Glacia's
|
|
33
|
+
* fallback floor.
|
|
24
34
|
*/
|
|
25
35
|
function routerFor(module) {
|
|
26
36
|
const view = module?.LiquidGlassView ?? null;
|
|
27
|
-
const container = module?.LiquidGlassContainerView ?? null;
|
|
37
|
+
const container = module?.LiquidGlassContainer ?? module?.LiquidGlassContainerView ?? null;
|
|
38
|
+
const provider = module?.LiquidGlassProvider ?? null;
|
|
39
|
+
const stack = module?.LiquidGlassStack ?? null;
|
|
40
|
+
const supported = Boolean(module?.LiquidGlassView) &&
|
|
41
|
+
(module?.supportsGlass ?? module?.isLiquidGlassSupported ?? false) === true;
|
|
28
42
|
return {
|
|
29
|
-
|
|
30
|
-
// glass; the container is only needed by GlassContainer, which falls back
|
|
31
|
-
// when it is missing.
|
|
32
|
-
supported: Boolean(module?.isLiquidGlassSupported) && Boolean(view),
|
|
43
|
+
supported,
|
|
33
44
|
LiquidGlassView: view,
|
|
34
|
-
// The container merges only when the material itself is available; a
|
|
35
|
-
// container without the view would have nothing to merge.
|
|
36
45
|
LiquidGlassContainerView: container,
|
|
46
|
+
LiquidGlassProvider: provider,
|
|
47
|
+
LiquidGlassStack: stack,
|
|
48
|
+
native: module?.supportsNativeGlass === true,
|
|
37
49
|
};
|
|
38
50
|
}
|
|
39
51
|
/**
|
|
40
|
-
* Loads
|
|
52
|
+
* Loads the vendored glass engine.
|
|
41
53
|
*
|
|
42
54
|
* Resolved through `require` rather than a static import so the package stays
|
|
43
|
-
* importable where the native module is absent (jsdom tests, web preview).
|
|
44
|
-
* `
|
|
45
|
-
*
|
|
46
|
-
*
|
|
55
|
+
* importable where the native module is absent (jsdom tests, web preview). The
|
|
56
|
+
* engine's `supportsGlass` is a constant of the installed build — its iOS build
|
|
57
|
+
* reads the native module and answers true only on iOS 26+, its Android build
|
|
58
|
+
* answers for the AGSL tier — so loading it is how the verdict is learned.
|
|
47
59
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
60
|
+
const ENGINE_MODULE_ID = "../engine";
|
|
61
|
+
function requireEngineModule() {
|
|
62
|
+
const scope = globalThis;
|
|
63
|
+
const req = typeof require === "function" ? require : scope.require;
|
|
64
|
+
if (typeof req !== "function")
|
|
54
65
|
return null;
|
|
66
|
+
try {
|
|
67
|
+
const module = req(ENGINE_MODULE_ID);
|
|
68
|
+
return module ?? null;
|
|
55
69
|
}
|
|
56
70
|
catch {
|
|
71
|
+
// The engine (or its native module) is not resolvable here: unsupported.
|
|
57
72
|
return null;
|
|
58
73
|
}
|
|
59
74
|
}
|
|
60
|
-
/** The installed
|
|
75
|
+
/** The installed engine's routing decision, computed once per process. */
|
|
61
76
|
function defaultRouter() {
|
|
62
77
|
return routerFor(loadLiquidGlass());
|
|
63
78
|
}
|
|
79
|
+
/** The installed engine's glass module, or null when it cannot be loaded. */
|
|
80
|
+
function loadLiquidGlass() {
|
|
81
|
+
const module = requireEngineModule();
|
|
82
|
+
if (module && (module.LiquidGlassView || module.supportsGlass !== undefined)) {
|
|
83
|
+
return module;
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
/** Reads the capability verdicts from an explicit module, or from the engine. */
|
|
88
|
+
function readCapabilities(module) {
|
|
89
|
+
const resolved = module !== undefined ? module : loadLiquidGlass();
|
|
90
|
+
const supported = resolved != null &&
|
|
91
|
+
Boolean(resolved.LiquidGlassView) &&
|
|
92
|
+
(resolved.supportsGlass ?? resolved.isLiquidGlassSupported ?? false) === true;
|
|
93
|
+
const native = resolved?.supportsNativeGlass === true;
|
|
94
|
+
return { supported, native };
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Whether any glass renderer is available on this device — the mount gate.
|
|
98
|
+
*
|
|
99
|
+
* Resolves instead of blocking: the caller renders either the glass surface or
|
|
100
|
+
* the fallback floor from this, and the floor is the safe answer, so the check
|
|
101
|
+
* must always be able to finish. When no renderer verdict has arrived the
|
|
102
|
+
* absence *is* the verdict — unsupported — and the fallback floor renders.
|
|
103
|
+
*/
|
|
104
|
+
function supportsGlass(module) {
|
|
105
|
+
const capabilities = readCapabilities(module);
|
|
106
|
+
return Promise.resolve(capabilities.supported);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Whether Apple's own glass material (`UIGlassEffect`) is available — iOS 26+.
|
|
110
|
+
* The narrower question behind the mount gate; the renderer tier machinery picks
|
|
111
|
+
* Metal or AGSL below that.
|
|
112
|
+
*/
|
|
113
|
+
function supportsNativeGlass(module) {
|
|
114
|
+
const resolved = module !== undefined ? module : loadLiquidGlass();
|
|
115
|
+
return resolved?.supportsNativeGlass === true;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The vendored engine's control components, by the Glacia-facing name.
|
|
119
|
+
*
|
|
120
|
+
* Every Wave 1 control is the engine's own component mounted through the same
|
|
121
|
+
* capability verdict the glass surface uses, so an unsupported device (or Expo
|
|
122
|
+
* Go, or Reduce Transparency) takes the Glacia fallback floor instead of the
|
|
123
|
+
* engine's own degrade-to-plain-view.
|
|
124
|
+
*/
|
|
125
|
+
const ENGINE_CONTROLS = {
|
|
126
|
+
Button: "LiquidGlassButton",
|
|
127
|
+
IconButton: "LiquidGlassIconButton",
|
|
128
|
+
Chip: "LiquidGlassChip",
|
|
129
|
+
Switch: "LiquidGlassSwitch",
|
|
130
|
+
Slider: "LiquidGlassSlider",
|
|
131
|
+
Stepper: "LiquidGlassStepper",
|
|
132
|
+
SegmentedControl: "LiquidGlassSegmentedControl",
|
|
133
|
+
Input: "LiquidGlassTextInput",
|
|
134
|
+
Card: "LiquidGlassCard",
|
|
135
|
+
Toolbar: "LiquidGlassToolbar",
|
|
136
|
+
Toast: "LiquidGlassToast",
|
|
137
|
+
Sheet: "LiquidGlassSheet",
|
|
138
|
+
TabBar: "LiquidGlassTabBar",
|
|
139
|
+
Group: "LiquidGlassGroup",
|
|
140
|
+
MorphGroup: "LiquidGlassMorphGroup",
|
|
141
|
+
Scrim: "LiquidGlassScrim",
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* The native backdrop scope, when the active tier is the Metal renderer.
|
|
145
|
+
*
|
|
146
|
+
* Only iOS 16.4–25 needs it: iOS 26+ reads the live window through Apple's own glass, and the
|
|
147
|
+
* Android renderer already has a provider contract of its own. Off that tier this is null and
|
|
148
|
+
* callers render a plain wrapper, so a `GlassBackdrop` never changes layout where it does
|
|
149
|
+
* nothing.
|
|
150
|
+
*/
|
|
151
|
+
let cachedBackdropScope;
|
|
152
|
+
/**
|
|
153
|
+
* Resolves the scope for the active tier. An explicit module is used by tests, the same way
|
|
154
|
+
* `readCapabilities` takes one: the routing question must be answerable without a device.
|
|
155
|
+
*/
|
|
156
|
+
function loadBackdropScope(module) {
|
|
157
|
+
if (module !== undefined) {
|
|
158
|
+
const capabilities = readCapabilities(module);
|
|
159
|
+
return capabilities.supported && !capabilities.native
|
|
160
|
+
? module?.NativeGlassBackdropView ?? null
|
|
161
|
+
: null;
|
|
162
|
+
}
|
|
163
|
+
if (cachedBackdropScope !== undefined)
|
|
164
|
+
return cachedBackdropScope;
|
|
165
|
+
const capabilities = readCapabilities();
|
|
166
|
+
const engine = requireEngineModule();
|
|
167
|
+
cachedBackdropScope =
|
|
168
|
+
capabilities.supported && !capabilities.native
|
|
169
|
+
? engine?.NativeGlassBackdropView ?? null
|
|
170
|
+
: null;
|
|
171
|
+
return cachedBackdropScope;
|
|
172
|
+
}
|
|
173
|
+
/** Clears the memoised backdrop route. Tests call this after flipping the module. */
|
|
174
|
+
function resetBackdropScope() {
|
|
175
|
+
cachedBackdropScope = undefined;
|
|
176
|
+
}
|
|
177
|
+
/** The Glacia names of every control the vendored engine carries. */
|
|
178
|
+
exports.ENGINE_CONTROL_NAMES = Object.freeze(Object.keys(ENGINE_CONTROLS));
|
|
179
|
+
/** Loads one of the vendored engine's control components by Glacia-facing name. */
|
|
180
|
+
function loadEngineControl(key) {
|
|
181
|
+
const engine = requireEngineModule();
|
|
182
|
+
const engineName = ENGINE_CONTROLS[key];
|
|
183
|
+
if (!engine || !engineName)
|
|
184
|
+
return null;
|
|
185
|
+
const control = engine[engineName];
|
|
186
|
+
return control ?? null;
|
|
187
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialsOf = initialsOf;
|
|
4
|
+
/** The initials an avatar shows when there is no picture. Kept in one place. */
|
|
5
|
+
function initialsOf(name) {
|
|
6
|
+
const words = name.trim().split(/\s+/).filter(Boolean);
|
|
7
|
+
if (words.length === 0)
|
|
8
|
+
return "";
|
|
9
|
+
if (words.length === 1)
|
|
10
|
+
return words[0].slice(0, 2).toUpperCase();
|
|
11
|
+
return (words[0][0] + words[words.length - 1][0]).toUpperCase();
|
|
12
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useControllable = useControllable;
|
|
4
|
+
exports.useBackDismiss = useBackDismiss;
|
|
5
|
+
exports.measureAnchor = measureAnchor;
|
|
6
|
+
exports.placePanel = placePanel;
|
|
7
|
+
exports.OverlayPanel = OverlayPanel;
|
|
8
|
+
exports.PanelItem = PanelItem;
|
|
9
|
+
exports.useTriggerAnchor = useTriggerAnchor;
|
|
10
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
|
+
// The invisible behaviour every Wave 2 component shares.
|
|
12
|
+
//
|
|
13
|
+
// These are the donor's contracts, implemented on React Native's own
|
|
14
|
+
// primitives: a component can be controlled or keep its own state, overlays
|
|
15
|
+
// dismiss on Android's back gesture and on an outside press, and every control
|
|
16
|
+
// exposes the accessibility role the donor gives it (checkbox, radio, tab,
|
|
17
|
+
// dialog, menu). Nothing here styles anything — the Apple dress lives in the
|
|
18
|
+
// component files.
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const Glass_1 = require("../Glass");
|
|
21
|
+
const tokens_1 = require("./tokens");
|
|
22
|
+
const primitives_1 = require("./primitives");
|
|
23
|
+
const motion_1 = require("./motion");
|
|
24
|
+
/**
|
|
25
|
+
* Controlled-or-uncontrolled state. The donor's model: a `value` prop makes the
|
|
26
|
+
* component controlled, `defaultValue` seeds it, and `onChange` is called either
|
|
27
|
+
* way. Kept in one place so every component behaves identically.
|
|
28
|
+
*/
|
|
29
|
+
function useControllable(value, defaultValue, onChange) {
|
|
30
|
+
const [internal, setInternal] = (0, react_1.useState)(defaultValue);
|
|
31
|
+
const current = value !== undefined ? value : internal;
|
|
32
|
+
const set = (0, react_1.useCallback)((next) => {
|
|
33
|
+
if (value === undefined)
|
|
34
|
+
setInternal(next);
|
|
35
|
+
onChange?.(next);
|
|
36
|
+
}, [value, onChange]);
|
|
37
|
+
return [current, set];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Registers Android's hardware back while an overlay is open, so back closes the
|
|
41
|
+
* layer and not the screen behind it.
|
|
42
|
+
*/
|
|
43
|
+
function useBackDismiss(open, dismiss) {
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
if (!open)
|
|
46
|
+
return;
|
|
47
|
+
const BackHandler = (0, primitives_1.primitives)().getBackHandler();
|
|
48
|
+
if (!BackHandler?.addEventListener)
|
|
49
|
+
return;
|
|
50
|
+
const sub = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
51
|
+
dismiss();
|
|
52
|
+
return true;
|
|
53
|
+
});
|
|
54
|
+
return () => sub?.remove?.();
|
|
55
|
+
}, [open, dismiss]);
|
|
56
|
+
}
|
|
57
|
+
/** Reads a view's rectangle in window coordinates, when the runtime can. */
|
|
58
|
+
function measureAnchor(node) {
|
|
59
|
+
return new Promise((resolve) => {
|
|
60
|
+
if (!node || typeof node.measureInWindow !== "function") {
|
|
61
|
+
resolve(null);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
node.measureInWindow((x, y, width, height) => {
|
|
66
|
+
resolve({ x, y, width, height });
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
resolve(null);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Places a panel beside its trigger. Flips above when there is no room below,
|
|
76
|
+
* and clamps to the viewport otherwise — the donor's collision handling, kept
|
|
77
|
+
* deliberately small.
|
|
78
|
+
*/
|
|
79
|
+
function placePanel(trigger, panel, viewport, gap = 6) {
|
|
80
|
+
const below = trigger.y + trigger.height + gap;
|
|
81
|
+
const above = trigger.y - panel.height - gap;
|
|
82
|
+
const fitsBelow = below + panel.height <= viewport.height;
|
|
83
|
+
const flipped = !fitsBelow && above >= 0;
|
|
84
|
+
const top = Math.max(8, Math.min(flipped ? above : below, viewport.height - panel.height - 8));
|
|
85
|
+
const left = Math.max(8, Math.min(trigger.x, viewport.width - panel.width - 8));
|
|
86
|
+
return { left, top, flipped };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A full-screen modal layer with a dimmed backdrop and a glass panel. Used by
|
|
90
|
+
* Dialog, Alert, AlertDialog, Popover, DropdownMenu, ContextMenu, Select and
|
|
91
|
+
* Tooltip, so dismissal, back handling and the surface are one implementation.
|
|
92
|
+
*/
|
|
93
|
+
function OverlayPanel({ open, onClose, dismissOnBackdropPress = true, anchor, width, panelStyle, children, testID, isDark: isDarkProp, accessibilityLabel, role = "menu", }) {
|
|
94
|
+
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
95
|
+
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
96
|
+
const { View, Pressable, Modal, useWindowDimensions } = (0, primitives_1.primitives)();
|
|
97
|
+
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
|
98
|
+
useBackDismiss(open, onClose);
|
|
99
|
+
if (!open)
|
|
100
|
+
return null;
|
|
101
|
+
const placed = anchor ? placePanel(anchor, { width: width ?? 240, height: 0 }, { width: screenWidth, height: screenHeight }) : null;
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(Modal, { visible: true, transparent: true, animationType: "fade", onRequestClose: onClose, children: (0, jsx_runtime_1.jsxs)(View, { style: { flex: 1, backgroundColor: theme.scrim }, children: [(0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: dismissOnBackdropPress ? "Close" : undefined, onPress: dismissOnBackdropPress ? onClose : undefined, style: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0 } }), (0, jsx_runtime_1.jsx)(View, { pointerEvents: "box-none", style: placed ? { position: "absolute", left: placed.left, top: placed.top } : { flex: 1, alignItems: "center", justifyContent: "center", padding: 24 }, children: (0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "none", onPress: () => { }, children: (0, jsx_runtime_1.jsx)(Glass_1.Glass, { effect: "regular", surface: "overlay", isDark: isDark, testID: testID, accessibilityLabel: accessibilityLabel, accessibilityRole: role, style: [
|
|
103
|
+
{
|
|
104
|
+
width: placed ? width ?? 240 : undefined,
|
|
105
|
+
maxWidth: screenWidth - 32,
|
|
106
|
+
borderRadius: tokens_1.radii.lg,
|
|
107
|
+
backgroundColor: theme.surface,
|
|
108
|
+
paddingVertical: 6,
|
|
109
|
+
},
|
|
110
|
+
panelStyle,
|
|
111
|
+
], children: children }) }) })] }) }));
|
|
112
|
+
}
|
|
113
|
+
/** One row inside an overlay panel — the donor's menu/option item. */
|
|
114
|
+
function PanelItem({ label, onPress, icon, destructive = false, selected = false, disabled = false, role = "button", style, testID, isDark: isDarkProp, }) {
|
|
115
|
+
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
116
|
+
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
117
|
+
const { View, Pressable, Text: RNText } = (0, primitives_1.primitives)();
|
|
118
|
+
return ((0, jsx_runtime_1.jsxs)(Pressable, { testID: testID, accessibilityRole: role, accessibilityLabel: label, accessibilityState: { disabled, selected }, disabled: disabled, onPress: onPress, style: [
|
|
119
|
+
{
|
|
120
|
+
flexDirection: "row",
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
gap: 10,
|
|
123
|
+
minHeight: 40,
|
|
124
|
+
paddingHorizontal: 14,
|
|
125
|
+
paddingVertical: 8,
|
|
126
|
+
opacity: disabled ? 0.38 : 1,
|
|
127
|
+
},
|
|
128
|
+
style,
|
|
129
|
+
], children: [icon ? (0, jsx_runtime_1.jsx)(View, { children: icon }) : null, (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: {
|
|
130
|
+
flex: 1,
|
|
131
|
+
fontSize: 15,
|
|
132
|
+
color: destructive ? theme.destructive : theme.foreground,
|
|
133
|
+
fontWeight: selected ? "600" : "400",
|
|
134
|
+
}, children: label }), selected ? (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 15, color: theme.fill }, children: "\u2713" }) : null] }));
|
|
135
|
+
}
|
|
136
|
+
/** A positioned trigger that reports its window rectangle when it is pressed. */
|
|
137
|
+
function useTriggerAnchor() {
|
|
138
|
+
const ref = (0, react_1.useRef)(null);
|
|
139
|
+
const [anchor, setAnchor] = (0, react_1.useState)(null);
|
|
140
|
+
const capture = (0, react_1.useCallback)(async () => {
|
|
141
|
+
const rect = await measureAnchor(ref.current);
|
|
142
|
+
if (rect)
|
|
143
|
+
setAnchor(rect);
|
|
144
|
+
return rect;
|
|
145
|
+
}, []);
|
|
146
|
+
return { ref, anchor, capture };
|
|
147
|
+
}
|
|
@@ -77,6 +77,15 @@ function resolve() {
|
|
|
77
77
|
slider: "slider",
|
|
78
78
|
adjustable: "slider",
|
|
79
79
|
heading: "heading",
|
|
80
|
+
option: "option",
|
|
81
|
+
listbox: "listbox",
|
|
82
|
+
menu: "menu",
|
|
83
|
+
menuitem: "menuitem",
|
|
84
|
+
dialog: "dialog",
|
|
85
|
+
alertdialog: "alertdialog",
|
|
86
|
+
group: "group",
|
|
87
|
+
toolbar: "toolbar",
|
|
88
|
+
separator: "separator",
|
|
80
89
|
};
|
|
81
90
|
// "none" means presentational: emit no role rather than a misleading one.
|
|
82
91
|
if (accessibilityRole && accessibilityRole !== "none") {
|
|
@@ -247,6 +256,13 @@ function resolve() {
|
|
|
247
256
|
const view = typeof globalThis !== "undefined" ? globalThis.window : undefined;
|
|
248
257
|
return { width: view?.innerWidth ?? 390, height: view?.innerHeight ?? 800 };
|
|
249
258
|
}),
|
|
259
|
+
useSafeAreaInsets: rn?.useSafeAreaInsets ??
|
|
260
|
+
(() => ({
|
|
261
|
+
top: 0,
|
|
262
|
+
bottom: 0,
|
|
263
|
+
left: 0,
|
|
264
|
+
right: 0,
|
|
265
|
+
})),
|
|
250
266
|
};
|
|
251
267
|
}
|
|
252
268
|
/**
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export interface AccordionSection {
|
|
4
|
+
/** Stable identity for the section. */
|
|
5
|
+
value: string;
|
|
6
|
+
title: string;
|
|
7
|
+
/** Optional second line in the header. */
|
|
8
|
+
description?: string;
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface AccordionProps {
|
|
12
|
+
sections: AccordionSection[];
|
|
13
|
+
/** Allow several sections open at once. */
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
openSections?: string[];
|
|
16
|
+
defaultOpenSections?: string[];
|
|
17
|
+
onOpenSectionsChange?: (open: string[]) => void;
|
|
18
|
+
style?: StyleProp<ViewStyle>;
|
|
19
|
+
isDark?: boolean;
|
|
20
|
+
testID?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function Accordion({ sections, multiple, openSections, defaultOpenSections, onOpenSectionsChange, style, isDark: isDarkProp, testID, }: AccordionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface ActionSheetOption {
|
|
2
|
+
label: string;
|
|
3
|
+
/** Tints the row destructive, for delete actions. */
|
|
4
|
+
destructive?: boolean;
|
|
5
|
+
onPress?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ActionSheetProps {
|
|
8
|
+
open?: boolean;
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
title?: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
options: ActionSheetOption[];
|
|
13
|
+
cancelLabel?: string;
|
|
14
|
+
isDark?: boolean;
|
|
15
|
+
/** Passed through to the sheet so it is testable. */
|
|
16
|
+
testID?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A list of choices attached to the bottom of the screen.
|
|
20
|
+
*
|
|
21
|
+
* Anchored to the bottom because that is where a thumb reaches, and it keeps a
|
|
22
|
+
* separate Cancel row so a mis-tap is always reversible.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ActionSheet({ open: controlledOpen, onOpenChange, title, message, options, cancelLabel, isDark: isDarkProp, testID, }: ActionSheetProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export type AlertTone = "default" | "info" | "success" | "warning" | "destructive";
|
|
4
|
+
export interface AlertProps {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
tone?: AlertTone;
|
|
9
|
+
/** Optional dismiss control. */
|
|
10
|
+
onDismiss?: () => void;
|
|
11
|
+
isDark?: boolean;
|
|
12
|
+
style?: StyleProp<ViewStyle>;
|
|
13
|
+
testID?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function Alert({ title, description, icon, tone, onDismiss, isDark: isDarkProp, style, testID, }: AlertProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface AlertDialogProps {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
onOpenChange?: (open: boolean) => void;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
/** Extra content between the description and the actions. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
confirmLabel?: string;
|
|
10
|
+
cancelLabel?: string;
|
|
11
|
+
destructive?: boolean;
|
|
12
|
+
onConfirm?: () => void;
|
|
13
|
+
onCancel?: () => void;
|
|
14
|
+
isDark?: boolean;
|
|
15
|
+
testID?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function AlertDialog({ open: openProp, onOpenChange, title, description, children, confirmLabel, cancelLabel, destructive, onConfirm, onCancel, isDark: isDarkProp, testID, }: AlertDialogProps): import("react").JSX.Element;
|