glacia-native 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +29 -4
- package/README.md +111 -17
- package/lib/module/Accordion.js +58 -0
- package/lib/module/ActionSheet.js +38 -0
- package/lib/module/Alert.js +23 -0
- package/lib/module/AlertDialog.js +47 -0
- package/lib/module/Avatar.js +48 -0
- package/lib/module/Badge.js +36 -0
- package/lib/module/Bars.js +13 -267
- package/lib/module/Button.js +57 -36
- package/lib/module/Card.js +32 -20
- package/lib/module/Checkbox.js +42 -0
- package/lib/module/Chip.js +80 -0
- package/lib/module/Collapsible.js +26 -0
- package/lib/module/ContextMenu.js +33 -0
- package/lib/module/Dialog.js +39 -124
- package/lib/module/DropdownMenu.js +33 -0
- package/lib/module/Field.js +22 -0
- package/lib/module/Glass.js +12 -5
- package/lib/module/Group.js +36 -0
- package/lib/module/IconButton.js +40 -0
- package/lib/module/Input.js +47 -40
- package/lib/module/Label.js +17 -0
- package/lib/module/MorphGroup.js +47 -0
- package/lib/module/Popover.js +29 -0
- package/lib/module/Progress.js +32 -0
- package/lib/module/RadioGroup.js +51 -0
- package/lib/module/Scrim.js +44 -0
- package/lib/module/SegmentedControl.js +74 -58
- package/lib/module/Select.js +51 -0
- package/lib/module/Separator.js +25 -0
- package/lib/module/Sheet.js +51 -0
- package/lib/module/Skeleton.js +48 -0
- package/lib/module/Slider.js +60 -40
- package/lib/module/Stepper.js +167 -0
- package/lib/module/Switch.js +45 -43
- package/lib/module/TabBar.js +62 -50
- package/lib/module/Tabs.js +3 -2
- package/lib/module/Textarea.js +18 -0
- package/lib/module/Toast.js +55 -0
- package/lib/module/Toggle.js +47 -0
- package/lib/module/ToggleGroup.js +56 -0
- package/lib/module/Toolbar.js +37 -0
- package/lib/module/Tooltip.js +31 -0
- package/lib/module/glass-provider.js +28 -0
- package/lib/module/glass-stack.js +61 -0
- package/lib/module/index.js +78 -109
- package/lib/module/internal/GlassBackdrop.js +36 -0
- package/lib/module/internal/GlassView.js +45 -13
- package/lib/module/internal/blur-community.js +20 -0
- package/lib/module/internal/blur-community.web.js +9 -0
- package/lib/module/internal/blur.js +75 -0
- package/lib/module/internal/fallback.js +110 -20
- package/lib/module/internal/glass-routing.js +154 -30
- package/lib/module/internal/glow.js +36 -0
- package/lib/module/internal/initials.js +12 -0
- package/lib/module/internal/lens.js +70 -0
- package/lib/module/internal/material.js +64 -0
- package/lib/module/internal/overlay.js +147 -0
- package/lib/module/internal/primitives.js +17 -0
- package/lib/module/internal/rim.js +35 -0
- package/lib/module/internal/tokens.js +34 -2
- package/lib/typescript/Accordion.d.ts +22 -0
- package/lib/typescript/ActionSheet.d.ts +24 -0
- package/lib/typescript/Alert.d.ts +15 -0
- package/lib/typescript/AlertDialog.d.ts +17 -0
- package/lib/typescript/Avatar.d.ts +22 -0
- package/lib/typescript/Badge.d.ts +12 -0
- package/lib/typescript/Bars.d.ts +3 -188
- package/lib/typescript/Button.d.ts +44 -10
- package/lib/typescript/Card.d.ts +30 -3
- package/lib/typescript/Checkbox.d.ts +14 -0
- package/lib/typescript/Chip.d.ts +19 -0
- package/lib/typescript/Collapsible.d.ts +17 -0
- package/lib/typescript/ContextMenu.d.ts +23 -0
- package/lib/typescript/Dialog.d.ts +8 -68
- package/lib/typescript/DropdownMenu.d.ts +23 -0
- package/lib/typescript/Field.d.ts +19 -0
- package/lib/typescript/Glass.d.ts +11 -2
- package/lib/typescript/Group.d.ts +35 -0
- package/lib/typescript/IconButton.d.ts +21 -0
- package/lib/typescript/Input.d.ts +17 -18
- package/lib/typescript/Label.d.ts +14 -0
- package/lib/typescript/MorphGroup.d.ts +46 -0
- package/lib/typescript/Popover.d.ts +17 -0
- package/lib/typescript/Progress.d.ts +13 -0
- package/lib/typescript/RadioGroup.d.ts +21 -0
- package/lib/typescript/Scrim.d.ts +33 -0
- package/lib/typescript/SegmentedControl.d.ts +24 -13
- package/lib/typescript/Select.d.ts +19 -0
- package/lib/typescript/Separator.d.ts +10 -0
- package/lib/typescript/Sheet.d.ts +45 -0
- package/lib/typescript/Skeleton.d.ts +10 -0
- package/lib/typescript/Slider.d.ts +15 -7
- package/lib/typescript/Stepper.d.ts +49 -0
- package/lib/typescript/Switch.d.ts +19 -12
- package/lib/typescript/TabBar.d.ts +18 -6
- package/lib/typescript/Textarea.d.ts +6 -0
- package/lib/typescript/Toast.d.ts +40 -0
- package/lib/typescript/Toggle.d.ts +21 -0
- package/lib/typescript/ToggleGroup.d.ts +22 -0
- package/lib/typescript/Toolbar.d.ts +35 -0
- package/lib/typescript/Tooltip.d.ts +16 -0
- package/lib/typescript/glass-provider.d.ts +34 -0
- package/lib/typescript/glass-stack.d.ts +54 -0
- package/lib/typescript/index.d.ts +39 -17
- package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
- package/lib/typescript/internal/GlassView.d.ts +31 -2
- package/lib/typescript/internal/blur-community.d.ts +2 -0
- package/lib/typescript/internal/blur-community.web.d.ts +2 -0
- package/lib/typescript/internal/blur.d.ts +24 -0
- package/lib/typescript/internal/fallback.d.ts +27 -2
- package/lib/typescript/internal/glass-routing.d.ts +83 -15
- package/lib/typescript/internal/glow.d.ts +11 -0
- package/lib/typescript/internal/initials.d.ts +2 -0
- package/lib/typescript/internal/lens.d.ts +47 -0
- package/lib/typescript/internal/material.d.ts +27 -0
- package/lib/typescript/internal/overlay.d.ts +74 -0
- package/lib/typescript/internal/primitives.d.ts +13 -0
- package/lib/typescript/internal/rim.d.ts +16 -0
- package/lib/typescript/internal/tokens.d.ts +36 -0
- package/package.json +15 -4
- package/src/Accordion.tsx +165 -0
- package/src/ActionSheet.tsx +149 -0
- package/src/Alert.tsx +85 -0
- package/src/AlertDialog.tsx +124 -0
- package/src/Avatar.tsx +102 -0
- package/src/Badge.tsx +80 -0
- package/src/Bars.tsx +10 -797
- package/src/Button.tsx +196 -60
- package/src/Card.tsx +106 -33
- package/src/Checkbox.tsx +98 -0
- package/src/Chip.tsx +149 -0
- package/src/Collapsible.tsx +66 -0
- package/src/ContextMenu.tsx +103 -0
- package/src/Dialog.tsx +86 -325
- package/src/DropdownMenu.tsx +103 -0
- package/src/Field.tsx +65 -0
- package/src/Glass.tsx +19 -5
- package/src/Group.tsx +98 -0
- package/src/IconButton.tsx +110 -0
- package/src/Input.tsx +143 -87
- package/src/Label.tsx +56 -0
- package/src/MorphGroup.tsx +134 -0
- package/src/Popover.tsx +81 -0
- package/src/Progress.tsx +83 -0
- package/src/RadioGroup.tsx +122 -0
- package/src/Scrim.tsx +94 -0
- package/src/SegmentedControl.tsx +147 -90
- package/src/Select.tsx +136 -0
- package/src/Separator.tsx +52 -0
- package/src/Sheet.tsx +139 -0
- package/src/Skeleton.tsx +77 -0
- package/src/Slider.tsx +100 -54
- package/src/Stepper.tsx +315 -0
- package/src/Switch.tsx +80 -58
- package/src/TabBar.tsx +118 -84
- package/src/Tabs.tsx +5 -0
- package/src/Textarea.tsx +34 -0
- package/src/Toast.tsx +131 -0
- package/src/Toggle.tsx +113 -0
- package/src/ToggleGroup.tsx +129 -0
- package/src/Toolbar.tsx +111 -0
- package/src/Tooltip.tsx +79 -0
- package/src/engine/CHANGELOG.md +430 -0
- package/src/engine/NOTICE +54 -0
- package/src/engine/README.md +975 -0
- package/src/engine/android/build.gradle +18 -0
- package/src/engine/android/src/main/AndroidManifest.xml +2 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
- package/src/engine/index.ts +24 -0
- package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
- package/src/engine/ios/Enums/GlassVariant.swift +86 -0
- package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
- package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
- package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
- package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
- package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
- package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
- package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
- package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
- package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
- package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
- package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
- package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
- package/src/engine/ios/Glass/StripCache.swift +545 -0
- package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
- package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
- package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
- package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
- package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
- package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
- package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
- package/src/engine/package.json +70 -0
- package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
- package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
- package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
- package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
- package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
- package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
- package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
- package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
- package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
- package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
- package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
- package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
- package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
- package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
- package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
- package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
- package/src/engine/src/components/index.ts +16 -0
- package/src/engine/src/constants/index.ts +4 -0
- package/src/engine/src/constants/metal.constants.ts +327 -0
- package/src/engine/src/constants/metrics.constants.ts +325 -0
- package/src/engine/src/constants/springs.constants.ts +107 -0
- package/src/engine/src/constants/styles.constants.ts +12 -0
- package/src/engine/src/context/glass-group.context.ts +65 -0
- package/src/engine/src/context/index.ts +6 -0
- package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
- package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
- package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
- package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
- package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
- package/src/engine/src/core/components/index.ts +4 -0
- package/src/engine/src/core/constants/glass.constants.ts +57 -0
- package/src/engine/src/core/constants/index.ts +20 -0
- package/src/engine/src/core/constants/native.constants.ts +16 -0
- package/src/engine/src/core/context/glass-stack.context.ts +30 -0
- package/src/engine/src/core/context/index.ts +4 -0
- package/src/engine/src/core/enum/index.ts +12 -0
- package/src/engine/src/core/index.ts +1 -0
- package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
- package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
- package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
- package/src/engine/src/core/interfaces/index.ts +31 -0
- package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
- package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
- package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
- package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
- package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
- package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
- package/src/engine/src/core/modules/index.ts +2 -0
- package/src/engine/src/core/root/index.ts +51 -0
- package/src/engine/src/core/types/glass.types.ts +25 -0
- package/src/engine/src/core/types/index.ts +8 -0
- package/src/engine/src/core/utils/debug.utils.ts +17 -0
- package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
- package/src/engine/src/core/utils/hdr.utils.ts +37 -0
- package/src/engine/src/core/utils/index.ts +5 -0
- package/src/engine/src/core/utils/native-view.utils.ts +33 -0
- package/src/engine/src/core/utils/platform.utils.ts +34 -0
- package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
- package/src/engine/src/core/views/index.ts +4 -0
- package/src/engine/src/hooks/index.ts +18 -0
- package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
- package/src/engine/src/hooks/use-damped-drag.ts +332 -0
- package/src/engine/src/hooks/use-echo-filter.ts +55 -0
- package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
- package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
- package/src/engine/src/hooks/use-press-progress.ts +44 -0
- package/src/engine/src/index.ts +120 -0
- package/src/engine/src/interfaces/index.ts +28 -0
- package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
- package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
- package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
- package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
- package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
- package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
- package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
- package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
- package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
- package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
- package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
- package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
- package/src/engine/src/theme/glass-ui-theme.ts +100 -0
- package/src/engine/src/theme/index.ts +2 -0
- package/src/engine/src/utils/button-press.utils.ts +63 -0
- package/src/engine/src/utils/index.ts +3 -0
- package/src/engine/src/utils/metal.utils.ts +164 -0
- package/src/glass-provider.tsx +60 -0
- package/src/glass-stack.tsx +115 -0
- package/src/index.ts +48 -190
- package/src/internal/GlassBackdrop.tsx +60 -0
- package/src/internal/GlassView.tsx +70 -18
- package/src/internal/blur-community.ts +19 -0
- package/src/internal/blur-community.web.ts +7 -0
- package/src/internal/blur.ts +89 -0
- package/src/internal/fallback.tsx +158 -20
- package/src/internal/glass-routing.ts +211 -34
- package/src/internal/glow.tsx +62 -0
- package/src/internal/initials.ts +7 -0
- package/src/internal/lens.tsx +105 -0
- package/src/internal/material.ts +92 -0
- package/src/internal/overlay.tsx +258 -0
- package/src/internal/primitives.ts +26 -0
- package/src/internal/rim.tsx +79 -0
- package/src/internal/tokens.ts +34 -1
- package/lib/module/Carousel.js +0 -103
- package/lib/module/Display.js +0 -317
- package/lib/module/Feedback.js +0 -386
- package/lib/module/Form.js +0 -164
- package/lib/module/Forms2.js +0 -454
- package/lib/module/Message.js +0 -88
- package/lib/module/Overlays.js +0 -328
- package/lib/module/Pickers.js +0 -243
- package/lib/module/Table.js +0 -99
- package/lib/module/ai.js +0 -280
- package/lib/module/charts/AreaChart.js +0 -32
- package/lib/module/charts/BarChart.js +0 -67
- package/lib/module/charts/FunnelChart.js +0 -50
- package/lib/module/charts/HeatmapChart.js +0 -71
- package/lib/module/charts/LineChart.js +0 -81
- package/lib/module/charts/PlotChart.js +0 -52
- package/lib/module/charts/RadarChart.js +0 -78
- package/lib/module/charts/RingChart.js +0 -52
- package/lib/module/charts/ScatterChart.js +0 -95
- package/lib/module/charts/WaterfallChart.js +0 -85
- package/lib/module/charts/advanced.js +0 -313
- package/lib/module/charts/extra.js +0 -108
- package/lib/module/charts/index.js +0 -50
- package/lib/module/charts/scales.js +0 -140
- package/lib/typescript/Carousel.d.ts +0 -47
- package/lib/typescript/Display.d.ts +0 -178
- package/lib/typescript/Feedback.d.ts +0 -196
- package/lib/typescript/Form.d.ts +0 -97
- package/lib/typescript/Forms2.d.ts +0 -209
- package/lib/typescript/Message.d.ts +0 -71
- package/lib/typescript/Overlays.d.ts +0 -146
- package/lib/typescript/Pickers.d.ts +0 -105
- package/lib/typescript/Table.d.ts +0 -64
- package/lib/typescript/ai.d.ts +0 -166
- package/lib/typescript/charts/AreaChart.d.ts +0 -44
- package/lib/typescript/charts/BarChart.d.ts +0 -19
- package/lib/typescript/charts/FunnelChart.d.ts +0 -25
- package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
- package/lib/typescript/charts/LineChart.d.ts +0 -30
- package/lib/typescript/charts/PlotChart.d.ts +0 -31
- package/lib/typescript/charts/RadarChart.d.ts +0 -27
- package/lib/typescript/charts/RingChart.d.ts +0 -28
- package/lib/typescript/charts/ScatterChart.d.ts +0 -34
- package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
- package/lib/typescript/charts/advanced.d.ts +0 -107
- package/lib/typescript/charts/extra.d.ts +0 -63
- package/lib/typescript/charts/index.d.ts +0 -13
- package/lib/typescript/charts/scales.d.ts +0 -35
- package/src/Carousel.tsx +0 -233
- package/src/Display.tsx +0 -778
- package/src/Feedback.tsx +0 -969
- package/src/Form.tsx +0 -425
- package/src/Forms2.tsx +0 -1014
- package/src/Message.tsx +0 -219
- package/src/Overlays.tsx +0 -685
- package/src/Pickers.tsx +0 -590
- package/src/Table.tsx +0 -231
- package/src/ai.tsx +0 -707
- package/src/charts/AreaChart.tsx +0 -73
- package/src/charts/BarChart.tsx +0 -183
- package/src/charts/FunnelChart.tsx +0 -125
- package/src/charts/HeatmapChart.tsx +0 -155
- package/src/charts/LineChart.tsx +0 -247
- package/src/charts/PlotChart.tsx +0 -168
- package/src/charts/RadarChart.tsx +0 -208
- package/src/charts/RingChart.tsx +0 -133
- package/src/charts/ScatterChart.tsx +0 -223
- package/src/charts/WaterfallChart.tsx +0 -201
- package/src/charts/advanced.tsx +0 -676
- package/src/charts/extra.tsx +0 -242
- package/src/charts/index.ts +0 -86
- package/src/charts/scales.ts +0 -163
package/src/Bars.tsx
CHANGED
|
@@ -1,797 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
// SearchBar
|
|
13
|
-
|
|
14
|
-
export interface SearchBarProps {
|
|
15
|
-
/** Controlled text. Omit and the bar keeps its own. */
|
|
16
|
-
value?: string;
|
|
17
|
-
defaultValue?: string;
|
|
18
|
-
onChangeText?: (text: string) => void;
|
|
19
|
-
onSubmit?: (text: string) => void;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
/** Shows a cancel button beside the field while it holds text or focus. */
|
|
22
|
-
showCancel?: boolean;
|
|
23
|
-
onCancel?: () => void;
|
|
24
|
-
accessibilityLabel?: string;
|
|
25
|
-
style?: StyleProp<ViewStyle>;
|
|
26
|
-
isDark?: boolean;
|
|
27
|
-
testID?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* A search field for a bar or a screen header.
|
|
32
|
-
*
|
|
33
|
-
* Distinct from NativeAIInput: that is an AI composer with send semantics, this
|
|
34
|
-
* is ordinary app search — magnifier, themed placeholder, and a clear button
|
|
35
|
-
* once there is something to clear.
|
|
36
|
-
*/
|
|
37
|
-
export const SearchBar = forwardRef<any, SearchBarProps>(function SearchBar(
|
|
38
|
-
{
|
|
39
|
-
value: valueProp,
|
|
40
|
-
defaultValue = "",
|
|
41
|
-
onChangeText,
|
|
42
|
-
onSubmit,
|
|
43
|
-
placeholder = "Search",
|
|
44
|
-
showCancel = false,
|
|
45
|
-
onCancel,
|
|
46
|
-
accessibilityLabel = "Search",
|
|
47
|
-
style,
|
|
48
|
-
isDark: isDarkProp,
|
|
49
|
-
testID,
|
|
50
|
-
...props
|
|
51
|
-
},
|
|
52
|
-
ref,
|
|
53
|
-
) {
|
|
54
|
-
const isDark = useIsDark(isDarkProp);
|
|
55
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
56
|
-
const { View, Text: RNText, TextInput, Pressable } = primitives();
|
|
57
|
-
|
|
58
|
-
const [internal, setInternal] = useState(defaultValue);
|
|
59
|
-
const value = valueProp !== undefined ? valueProp : internal;
|
|
60
|
-
|
|
61
|
-
const handleChange = (next: string) => {
|
|
62
|
-
if (valueProp === undefined) setInternal(next);
|
|
63
|
-
onChangeText?.(next);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const clear = () => handleChange("");
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<View
|
|
70
|
-
ref={ref}
|
|
71
|
-
testID={testID}
|
|
72
|
-
style={[{ flexDirection: "row", alignItems: "center", gap: 8 }, style as ViewStyle]}
|
|
73
|
-
{...props}
|
|
74
|
-
>
|
|
75
|
-
<Glass
|
|
76
|
-
effect="regular"
|
|
77
|
-
isDark={isDark}
|
|
78
|
-
style={{
|
|
79
|
-
flex: 1,
|
|
80
|
-
flexDirection: "row",
|
|
81
|
-
alignItems: "center",
|
|
82
|
-
gap: 8,
|
|
83
|
-
height: 36,
|
|
84
|
-
borderRadius: radii.pill,
|
|
85
|
-
paddingHorizontal: 12,
|
|
86
|
-
}}
|
|
87
|
-
>
|
|
88
|
-
<RNText accessibilityElementsHidden importantForAccessibility="no" style={{ fontSize: 14, color: theme.muted }}>
|
|
89
|
-
{"\u2315"}
|
|
90
|
-
</RNText>
|
|
91
|
-
<View style={{ flex: 1, justifyContent: "center" }}>
|
|
92
|
-
{!value && placeholder ? (
|
|
93
|
-
// Themed placeholder: the OS default colour ignores the theme.
|
|
94
|
-
<RNText
|
|
95
|
-
pointerEvents="none"
|
|
96
|
-
numberOfLines={1}
|
|
97
|
-
style={{ position: "absolute", left: 0, fontSize: 15, color: theme.muted }}
|
|
98
|
-
>
|
|
99
|
-
{placeholder}
|
|
100
|
-
</RNText>
|
|
101
|
-
) : null}
|
|
102
|
-
<TextInput
|
|
103
|
-
accessibilityRole="search"
|
|
104
|
-
accessibilityLabel={accessibilityLabel}
|
|
105
|
-
value={value}
|
|
106
|
-
onChangeText={handleChange}
|
|
107
|
-
onSubmitEditing={() => onSubmit?.(value)}
|
|
108
|
-
returnKeyType="search"
|
|
109
|
-
autoCorrect={false}
|
|
110
|
-
placeholder=""
|
|
111
|
-
style={{
|
|
112
|
-
fontSize: 15,
|
|
113
|
-
paddingVertical: 4,
|
|
114
|
-
color: theme.foreground,
|
|
115
|
-
// Transparent: the themed placeholder above provides the hint.
|
|
116
|
-
backgroundColor: "transparent",
|
|
117
|
-
}}
|
|
118
|
-
/>
|
|
119
|
-
</View>
|
|
120
|
-
{value.length > 0 && (
|
|
121
|
-
<Pressable
|
|
122
|
-
accessibilityRole="button"
|
|
123
|
-
accessibilityLabel="Clear search"
|
|
124
|
-
onPress={clear}
|
|
125
|
-
hitSlop={8}
|
|
126
|
-
>
|
|
127
|
-
<View
|
|
128
|
-
style={{
|
|
129
|
-
width: 16,
|
|
130
|
-
height: 16,
|
|
131
|
-
// A circle from its own size: half the 16pt box.
|
|
132
|
-
borderRadius: 16 / 2,
|
|
133
|
-
backgroundColor: theme.separator,
|
|
134
|
-
alignItems: "center",
|
|
135
|
-
justifyContent: "center",
|
|
136
|
-
}}
|
|
137
|
-
>
|
|
138
|
-
<RNText style={{ fontSize: 10, color: theme.muted }}>{"\u00D7"}</RNText>
|
|
139
|
-
</View>
|
|
140
|
-
</Pressable>
|
|
141
|
-
)}
|
|
142
|
-
</Glass>
|
|
143
|
-
{showCancel && (
|
|
144
|
-
<Pressable
|
|
145
|
-
accessibilityRole="button"
|
|
146
|
-
accessibilityLabel="Cancel"
|
|
147
|
-
onPress={() => {
|
|
148
|
-
clear();
|
|
149
|
-
onCancel?.();
|
|
150
|
-
}}
|
|
151
|
-
>
|
|
152
|
-
<RNText style={{ fontSize: 15, color: theme.fill }}>Cancel</RNText>
|
|
153
|
-
</Pressable>
|
|
154
|
-
)}
|
|
155
|
-
</View>
|
|
156
|
-
);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
// ---------------------------------------------------------------------------
|
|
160
|
-
// Chip
|
|
161
|
-
|
|
162
|
-
export interface ChipProps {
|
|
163
|
-
label: string;
|
|
164
|
-
icon?: ReactNode;
|
|
165
|
-
/** Shows a close affordance; called when it is pressed. */
|
|
166
|
-
onClose?: () => void;
|
|
167
|
-
/** Tapping the chip. Omit to make it a static tag. */
|
|
168
|
-
onPress?: () => void;
|
|
169
|
-
/** Controlled selection. Omit for a plain tag with no selected state. */
|
|
170
|
-
selected?: boolean;
|
|
171
|
-
defaultSelected?: boolean;
|
|
172
|
-
onSelectedChange?: (selected: boolean) => void;
|
|
173
|
-
disabled?: boolean;
|
|
174
|
-
style?: StyleProp<ViewStyle>;
|
|
175
|
-
isDark?: boolean;
|
|
176
|
-
testID?: string;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* A filter or tag pill.
|
|
181
|
-
*
|
|
182
|
-
* Selected state is a glass pill tinted with `glassActive` — the same selected
|
|
183
|
-
* treatment SegmentedControl and TabBar use, rather than a new colour.
|
|
184
|
-
*/
|
|
185
|
-
export const Chip = forwardRef<any, ChipProps>(function Chip(
|
|
186
|
-
{
|
|
187
|
-
label,
|
|
188
|
-
icon,
|
|
189
|
-
onClose,
|
|
190
|
-
onPress,
|
|
191
|
-
selected: selectedProp,
|
|
192
|
-
defaultSelected = false,
|
|
193
|
-
onSelectedChange,
|
|
194
|
-
disabled = false,
|
|
195
|
-
style,
|
|
196
|
-
isDark: isDarkProp,
|
|
197
|
-
testID,
|
|
198
|
-
...props
|
|
199
|
-
},
|
|
200
|
-
ref,
|
|
201
|
-
) {
|
|
202
|
-
const isDark = useIsDark(isDarkProp);
|
|
203
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
204
|
-
const { View, Text: RNText, Pressable } = primitives();
|
|
205
|
-
|
|
206
|
-
const [internalSelected, setInternalSelected] = useState(defaultSelected);
|
|
207
|
-
const selected = selectedProp !== undefined ? selectedProp : internalSelected;
|
|
208
|
-
const selectable = selectedProp !== undefined || onSelectedChange !== undefined || defaultSelected;
|
|
209
|
-
|
|
210
|
-
const handlePress = () => {
|
|
211
|
-
if (disabled) return;
|
|
212
|
-
if (selectable) {
|
|
213
|
-
const next = !selected;
|
|
214
|
-
if (selectedProp === undefined) setInternalSelected(next);
|
|
215
|
-
onSelectedChange?.(next);
|
|
216
|
-
}
|
|
217
|
-
onPress?.();
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
const pill = (
|
|
221
|
-
<Glass
|
|
222
|
-
effect="regular"
|
|
223
|
-
isDark={isDark}
|
|
224
|
-
tintColor={selected ? theme.glassActive : undefined}
|
|
225
|
-
interactive={!disabled}
|
|
226
|
-
style={{
|
|
227
|
-
flexDirection: "row",
|
|
228
|
-
alignItems: "center",
|
|
229
|
-
gap: 6,
|
|
230
|
-
height: 30,
|
|
231
|
-
paddingHorizontal: 12,
|
|
232
|
-
borderRadius: radii.pill,
|
|
233
|
-
opacity: disabled ? 0.38 : 1,
|
|
234
|
-
...(style as ViewStyle),
|
|
235
|
-
}}
|
|
236
|
-
>
|
|
237
|
-
{icon ? <View>{icon}</View> : null}
|
|
238
|
-
<RNText
|
|
239
|
-
numberOfLines={1}
|
|
240
|
-
style={{ fontSize: 13, fontWeight: selected ? "600" : "500", color: selected ? theme.foreground : theme.muted }}
|
|
241
|
-
>
|
|
242
|
-
{label}
|
|
243
|
-
</RNText>
|
|
244
|
-
{onClose && (
|
|
245
|
-
<Pressable
|
|
246
|
-
accessibilityRole="button"
|
|
247
|
-
accessibilityLabel={`Remove ${label}`}
|
|
248
|
-
onPress={onClose}
|
|
249
|
-
hitSlop={8}
|
|
250
|
-
>
|
|
251
|
-
<RNText style={{ fontSize: 11, color: theme.muted }}>{"\u00D7"}</RNText>
|
|
252
|
-
</Pressable>
|
|
253
|
-
)}
|
|
254
|
-
</Glass>
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
if (!onPress && !selectable) {
|
|
258
|
-
return (
|
|
259
|
-
<View ref={ref} testID={testID} accessibilityRole="text" accessibilityLabel={label} {...props}>
|
|
260
|
-
{pill}
|
|
261
|
-
</View>
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return (
|
|
266
|
-
<Pressable
|
|
267
|
-
ref={ref}
|
|
268
|
-
testID={testID}
|
|
269
|
-
accessibilityRole="button"
|
|
270
|
-
accessibilityLabel={label}
|
|
271
|
-
accessibilityState={{ selected: selectable ? selected : undefined, disabled }}
|
|
272
|
-
disabled={disabled}
|
|
273
|
-
onPress={handlePress}
|
|
274
|
-
{...props}
|
|
275
|
-
>
|
|
276
|
-
{pill}
|
|
277
|
-
</Pressable>
|
|
278
|
-
);
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
// ---------------------------------------------------------------------------
|
|
282
|
-
// FAB
|
|
283
|
-
|
|
284
|
-
export interface FABProps {
|
|
285
|
-
onPress: () => void;
|
|
286
|
-
/** Required: an icon-only circle has no text to announce. */
|
|
287
|
-
accessibilityLabel: string;
|
|
288
|
-
/** The icon. When a label string is also supplied, the FAB is extended. */
|
|
289
|
-
icon?: ReactNode;
|
|
290
|
-
/** Turns the circle into an extended pill with visible text. */
|
|
291
|
-
label?: string;
|
|
292
|
-
size?: "md" | "lg";
|
|
293
|
-
disabled?: boolean;
|
|
294
|
-
style?: StyleProp<ViewStyle>;
|
|
295
|
-
isDark?: boolean;
|
|
296
|
-
testID?: string;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
const fabSizes = { md: 56, lg: 64 };
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* The floating action button.
|
|
303
|
-
*
|
|
304
|
-
* The flagship glass circle of the library: a round `Glass` with `interactive`
|
|
305
|
-
* so the material itself responds to touch. The caller positions it; the
|
|
306
|
-
* component does not assume an edge.
|
|
307
|
-
*/
|
|
308
|
-
export const FAB = forwardRef<any, FABProps>(function FAB(
|
|
309
|
-
{
|
|
310
|
-
onPress,
|
|
311
|
-
accessibilityLabel,
|
|
312
|
-
icon,
|
|
313
|
-
label,
|
|
314
|
-
size = "md",
|
|
315
|
-
disabled = false,
|
|
316
|
-
style,
|
|
317
|
-
isDark: isDarkProp,
|
|
318
|
-
testID,
|
|
319
|
-
...props
|
|
320
|
-
},
|
|
321
|
-
ref,
|
|
322
|
-
) {
|
|
323
|
-
const isDark = useIsDark(isDarkProp);
|
|
324
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
325
|
-
const { View, Text: RNText, Pressable } = primitives();
|
|
326
|
-
|
|
327
|
-
const dimension = fabSizes[size];
|
|
328
|
-
const extended = Boolean(label);
|
|
329
|
-
|
|
330
|
-
return (
|
|
331
|
-
<Pressable
|
|
332
|
-
ref={ref}
|
|
333
|
-
testID={testID}
|
|
334
|
-
accessibilityRole="button"
|
|
335
|
-
accessibilityLabel={accessibilityLabel}
|
|
336
|
-
accessibilityState={{ disabled }}
|
|
337
|
-
disabled={disabled}
|
|
338
|
-
onPress={disabled ? undefined : onPress}
|
|
339
|
-
style={({ pressed }: { pressed: boolean }) => ({
|
|
340
|
-
alignSelf: "flex-start",
|
|
341
|
-
opacity: disabled ? 0.38 : pressed ? 0.85 : 1,
|
|
342
|
-
})}
|
|
343
|
-
{...props}
|
|
344
|
-
>
|
|
345
|
-
<Glass
|
|
346
|
-
effect="clear"
|
|
347
|
-
interactive={!disabled}
|
|
348
|
-
isDark={isDark}
|
|
349
|
-
style={{
|
|
350
|
-
height: dimension,
|
|
351
|
-
width: extended ? undefined : dimension,
|
|
352
|
-
minWidth: dimension,
|
|
353
|
-
borderRadius: extended ? dimension / 2 : dimension / 2,
|
|
354
|
-
paddingHorizontal: extended ? 20 : 0,
|
|
355
|
-
flexDirection: "row",
|
|
356
|
-
alignItems: "center",
|
|
357
|
-
justifyContent: "center",
|
|
358
|
-
gap: 8,
|
|
359
|
-
...(style as ViewStyle),
|
|
360
|
-
}}
|
|
361
|
-
>
|
|
362
|
-
{icon ? <View>{icon}</View> : null}
|
|
363
|
-
{label ? (
|
|
364
|
-
<RNText style={{ fontSize: 15, fontWeight: "600", color: theme.foreground }} numberOfLines={1}>
|
|
365
|
-
{label}
|
|
366
|
-
</RNText>
|
|
367
|
-
) : null}
|
|
368
|
-
</Glass>
|
|
369
|
-
</Pressable>
|
|
370
|
-
);
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
// ---------------------------------------------------------------------------
|
|
374
|
-
// IconButton
|
|
375
|
-
|
|
376
|
-
export interface IconButtonProps {
|
|
377
|
-
/** Required: the icon carries no text of its own. */
|
|
378
|
-
accessibilityLabel: string;
|
|
379
|
-
onPress: () => void;
|
|
380
|
-
icon: ReactNode;
|
|
381
|
-
size?: "sm" | "md" | "lg";
|
|
382
|
-
variant?: "glass" | "ghost";
|
|
383
|
-
disabled?: boolean;
|
|
384
|
-
style?: StyleProp<ViewStyle>;
|
|
385
|
-
isDark?: boolean;
|
|
386
|
-
testID?: string;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
const iconButtonSizes = { sm: 28, md: 36, lg: 44 };
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* An icon-only button on glass.
|
|
393
|
-
*
|
|
394
|
-
* Button takes an icon alongside a label; this is the icon-only form, which
|
|
395
|
-
* every kit ships for toolbars and bar actions.
|
|
396
|
-
*/
|
|
397
|
-
export const IconButton = forwardRef<any, IconButtonProps>(function IconButton(
|
|
398
|
-
{
|
|
399
|
-
accessibilityLabel,
|
|
400
|
-
onPress,
|
|
401
|
-
icon,
|
|
402
|
-
size = "md",
|
|
403
|
-
variant = "glass",
|
|
404
|
-
disabled = false,
|
|
405
|
-
style,
|
|
406
|
-
isDark: isDarkProp,
|
|
407
|
-
testID,
|
|
408
|
-
...props
|
|
409
|
-
},
|
|
410
|
-
ref,
|
|
411
|
-
) {
|
|
412
|
-
const isDark = useIsDark(isDarkProp);
|
|
413
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
414
|
-
const { View, Pressable } = primitives();
|
|
415
|
-
const dimension = iconButtonSizes[size];
|
|
416
|
-
|
|
417
|
-
return (
|
|
418
|
-
<Pressable
|
|
419
|
-
ref={ref}
|
|
420
|
-
testID={testID}
|
|
421
|
-
accessibilityRole="button"
|
|
422
|
-
accessibilityLabel={accessibilityLabel}
|
|
423
|
-
accessibilityState={{ disabled }}
|
|
424
|
-
disabled={disabled}
|
|
425
|
-
onPress={disabled ? undefined : onPress}
|
|
426
|
-
style={({ pressed }: { pressed: boolean }) => ({ opacity: disabled ? 0.38 : pressed ? 0.8 : 1 })}
|
|
427
|
-
{...props}
|
|
428
|
-
>
|
|
429
|
-
<Glass
|
|
430
|
-
effect={variant === "ghost" ? "none" : "regular"}
|
|
431
|
-
interactive={!disabled && variant !== "ghost"}
|
|
432
|
-
isDark={isDark}
|
|
433
|
-
style={{
|
|
434
|
-
width: dimension,
|
|
435
|
-
height: dimension,
|
|
436
|
-
borderRadius: dimension / 2,
|
|
437
|
-
alignItems: "center",
|
|
438
|
-
justifyContent: "center",
|
|
439
|
-
backgroundColor: variant === "ghost" ? "transparent" : undefined,
|
|
440
|
-
...(style as ViewStyle),
|
|
441
|
-
}}
|
|
442
|
-
>
|
|
443
|
-
<View style={{ width: dimension * 0.5, height: dimension * 0.5, alignItems: "center", justifyContent: "center" }}>
|
|
444
|
-
{icon}
|
|
445
|
-
</View>
|
|
446
|
-
</Glass>
|
|
447
|
-
</Pressable>
|
|
448
|
-
);
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
// ---------------------------------------------------------------------------
|
|
452
|
-
// AppBar
|
|
453
|
-
|
|
454
|
-
export interface AppBarAction {
|
|
455
|
-
/** Announced to screen readers; the icon is decorative. */
|
|
456
|
-
accessibilityLabel: string;
|
|
457
|
-
icon: ReactNode;
|
|
458
|
-
onPress: () => void;
|
|
459
|
-
disabled?: boolean;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
export interface AppBarProps {
|
|
463
|
-
title: string;
|
|
464
|
-
/** Optional second line under the title. */
|
|
465
|
-
subtitle?: string;
|
|
466
|
-
/** A back or menu action at the leading edge. */
|
|
467
|
-
leading?: AppBarAction;
|
|
468
|
-
/** Actions at the trailing edge. */
|
|
469
|
-
actions?: AppBarAction[];
|
|
470
|
-
/**
|
|
471
|
-
* The caller's safe-area inset above the bar. Glacia takes it as a prop
|
|
472
|
-
* rather than adding a native insets dependency: on a device the app already
|
|
473
|
-
* knows its insets, and passing a number keeps this component dependency-free.
|
|
474
|
-
*/
|
|
475
|
-
topInset?: number;
|
|
476
|
-
/**
|
|
477
|
-
* Whether content has scrolled under the bar.
|
|
478
|
-
*
|
|
479
|
-
* iOS bars sit quiet at the top of a screen and gain a defined edge once
|
|
480
|
-
* content passes beneath them, so the bar reads as a layer over the content
|
|
481
|
-
* rather than as part of it. Wire this to a ScrollView's scroll offset — see
|
|
482
|
-
* the component's documentation for the two-line version.
|
|
483
|
-
*/
|
|
484
|
-
scrolled?: boolean;
|
|
485
|
-
style?: StyleProp<ViewStyle>;
|
|
486
|
-
isDark?: boolean;
|
|
487
|
-
testID?: string;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* The top bar.
|
|
492
|
-
*
|
|
493
|
-
* A glass bar across the top of the screen with a leading action, a title and
|
|
494
|
-
* trailing actions — the counterpart to the existing bottom TabBar.
|
|
495
|
-
*
|
|
496
|
-
* `scrolled` mirrors iOS 26's scroll-edge effect. At the top of the screen the
|
|
497
|
-
* bar is quiet: its bottom edge is invisible and the glass blends into the
|
|
498
|
-
* content above it. Once content has scrolled under it, the edge token becomes
|
|
499
|
-
* visible and the surface reads as a distinct layer — the change iOS makes when
|
|
500
|
-
* a navigation bar starts floating over scrolled content.
|
|
501
|
-
*
|
|
502
|
-
* ```
|
|
503
|
-
* const [scrolled, setScrolled] = useState(false);
|
|
504
|
-
* <ScrollView onScroll={(e) => setScrolled(e.nativeEvent.contentOffset.y > 8)}
|
|
505
|
-
* scrollEventThrottle={16}>{...}</ScrollView>
|
|
506
|
-
* <AppBar title="Inbox" scrolled={scrolled} />
|
|
507
|
-
* ```
|
|
508
|
-
*/
|
|
509
|
-
export const AppBar = forwardRef<any, AppBarProps>(function AppBar(
|
|
510
|
-
{
|
|
511
|
-
title,
|
|
512
|
-
subtitle,
|
|
513
|
-
leading,
|
|
514
|
-
actions,
|
|
515
|
-
topInset = 0,
|
|
516
|
-
scrolled = false,
|
|
517
|
-
style,
|
|
518
|
-
isDark: isDarkProp,
|
|
519
|
-
testID,
|
|
520
|
-
...props
|
|
521
|
-
},
|
|
522
|
-
ref,
|
|
523
|
-
) {
|
|
524
|
-
const isDark = useIsDark(isDarkProp);
|
|
525
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
526
|
-
const { View, Text: RNText, Pressable } = primitives();
|
|
527
|
-
const actionCount = actions?.length ?? 0;
|
|
528
|
-
|
|
529
|
-
const renderAction = (action: AppBarAction, key: string) => (
|
|
530
|
-
<Pressable
|
|
531
|
-
key={key}
|
|
532
|
-
accessibilityRole="button"
|
|
533
|
-
accessibilityLabel={action.accessibilityLabel}
|
|
534
|
-
accessibilityState={{ disabled: action.disabled }}
|
|
535
|
-
disabled={action.disabled}
|
|
536
|
-
onPress={action.disabled ? undefined : action.onPress}
|
|
537
|
-
hitSlop={6}
|
|
538
|
-
style={{ padding: 6, opacity: action.disabled ? 0.38 : 1 }}
|
|
539
|
-
>
|
|
540
|
-
{action.icon}
|
|
541
|
-
</Pressable>
|
|
542
|
-
);
|
|
543
|
-
|
|
544
|
-
return (
|
|
545
|
-
<Glass
|
|
546
|
-
ref={ref}
|
|
547
|
-
effect="regular"
|
|
548
|
-
isDark={isDark}
|
|
549
|
-
testID={testID}
|
|
550
|
-
style={{
|
|
551
|
-
borderRadius: 0,
|
|
552
|
-
borderTopWidth: 0,
|
|
553
|
-
borderLeftWidth: 0,
|
|
554
|
-
borderRightWidth: 0,
|
|
555
|
-
// Quiet at the top of a screen, defined once content is under it: the
|
|
556
|
-
// bottom edge is the difference iOS draws on a scrolled navigation bar.
|
|
557
|
-
...(scrolled ? { borderBottomWidth: 0.5, borderBottomColor: theme.edge } : { borderBottomWidth: 0 }),
|
|
558
|
-
...(style as ViewStyle),
|
|
559
|
-
}}
|
|
560
|
-
{...props}
|
|
561
|
-
>
|
|
562
|
-
<View
|
|
563
|
-
style={{
|
|
564
|
-
paddingTop: topInset,
|
|
565
|
-
paddingHorizontal: 8,
|
|
566
|
-
paddingBottom: 8,
|
|
567
|
-
flexDirection: "row",
|
|
568
|
-
alignItems: "center",
|
|
569
|
-
gap: 4,
|
|
570
|
-
minHeight: 44 + topInset,
|
|
571
|
-
}}
|
|
572
|
-
>
|
|
573
|
-
{leading ? renderAction(leading, "leading") : <View style={{ width: 8 }} />}
|
|
574
|
-
<View style={{ flex: 1, paddingHorizontal: 4 }}>
|
|
575
|
-
<RNText
|
|
576
|
-
accessibilityRole="header"
|
|
577
|
-
numberOfLines={1}
|
|
578
|
-
style={{ fontSize: 17, fontWeight: "600", color: theme.foreground }}
|
|
579
|
-
>
|
|
580
|
-
{title}
|
|
581
|
-
</RNText>
|
|
582
|
-
{subtitle ? (
|
|
583
|
-
<RNText numberOfLines={1} style={{ fontSize: 12, color: theme.muted }}>
|
|
584
|
-
{subtitle}
|
|
585
|
-
</RNText>
|
|
586
|
-
) : null}
|
|
587
|
-
</View>
|
|
588
|
-
{actions && actionCount > 0 ? (
|
|
589
|
-
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
|
590
|
-
{actions.map((action, index) => renderAction(action, `action-${index}`))}
|
|
591
|
-
</View>
|
|
592
|
-
) : null}
|
|
593
|
-
</View>
|
|
594
|
-
</Glass>
|
|
595
|
-
);
|
|
596
|
-
});
|
|
597
|
-
|
|
598
|
-
// ---------------------------------------------------------------------------
|
|
599
|
-
// FABGroup
|
|
600
|
-
|
|
601
|
-
export interface FABGroupAction {
|
|
602
|
-
/** A leading node, typically an SVG icon the caller supplies. */
|
|
603
|
-
icon: ReactNode;
|
|
604
|
-
/** The action's name, shown on its mini button. */
|
|
605
|
-
label: string;
|
|
606
|
-
onPress: () => void;
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
export interface FABGroupProps {
|
|
610
|
-
/** The actions, listed top to bottom as they appear when expanded. */
|
|
611
|
-
actions: FABGroupAction[];
|
|
612
|
-
/** The icon on the main button. Rotates 45° while open. */
|
|
613
|
-
icon: ReactNode;
|
|
614
|
-
/** The icon on the main button while open. Defaults to the closed one. */
|
|
615
|
-
closeIcon?: ReactNode;
|
|
616
|
-
/** Controlled open state. Omit and the group keeps its own. */
|
|
617
|
-
open?: boolean;
|
|
618
|
-
defaultOpen?: boolean;
|
|
619
|
-
onOpenChange?: (open: boolean) => void;
|
|
620
|
-
/** The main button's accessible name. */
|
|
621
|
-
accessibilityLabel?: string;
|
|
622
|
-
size?: "md" | "lg";
|
|
623
|
-
style?: StyleProp<ViewStyle>;
|
|
624
|
-
isDark?: boolean;
|
|
625
|
-
testID?: string;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
// The main button's size, and the mini buttons' — both from the size scale so
|
|
629
|
-
// a mini button is never a hand-tuned multiple of the main one.
|
|
630
|
-
const fabGroupSizes = {
|
|
631
|
-
md: { main: 56, mini: 44 },
|
|
632
|
-
lg: { main: 64, mini: 52 },
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* A main button that expands into a stack of labelled mini buttons.
|
|
637
|
-
*
|
|
638
|
-
* The pattern Paper calls `FAB.Group`: one floating button stands in for a set
|
|
639
|
-
* of actions until it is opened, then the actions appear above it, each on its
|
|
640
|
-
* own glass pill with a label. A scrim behind them takes the next press and
|
|
641
|
-
* closes the group, which is how a floating action set gets out of the way
|
|
642
|
-
* without a dismissal button.
|
|
643
|
-
*
|
|
644
|
-
* The mini buttons rise on the bouncy spring with a small stagger, and the main
|
|
645
|
-
* button's icon rotates 45° — both settle instantly under Reduce Motion.
|
|
646
|
-
*
|
|
647
|
-
* **Merging is an iOS 26+ visual effect.** This component is one glass surface
|
|
648
|
-
* plus one per action; to have them blend into a single connected surface, put
|
|
649
|
-
* the group inside a `GlassContainer` on iOS 26. It works standalone — nothing
|
|
650
|
-
* depends on the container — and that composition is left to the caller rather
|
|
651
|
-
* than forced, because a group outside a container is the correct rendering on
|
|
652
|
-
* every other platform anyway.
|
|
653
|
-
*/
|
|
654
|
-
export const FABGroup = forwardRef<any, FABGroupProps>(function FABGroup(
|
|
655
|
-
{
|
|
656
|
-
actions,
|
|
657
|
-
icon,
|
|
658
|
-
closeIcon,
|
|
659
|
-
open: openProp,
|
|
660
|
-
defaultOpen = false,
|
|
661
|
-
onOpenChange,
|
|
662
|
-
accessibilityLabel = "More actions",
|
|
663
|
-
size = "md",
|
|
664
|
-
style,
|
|
665
|
-
isDark: isDarkProp,
|
|
666
|
-
testID,
|
|
667
|
-
...props
|
|
668
|
-
},
|
|
669
|
-
ref,
|
|
670
|
-
) {
|
|
671
|
-
const isDark = useIsDark(isDarkProp);
|
|
672
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
673
|
-
const { View, Text: RNText, Pressable, Animated } = primitives();
|
|
674
|
-
|
|
675
|
-
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
676
|
-
const open = openProp !== undefined ? openProp : internalOpen;
|
|
677
|
-
|
|
678
|
-
const setOpen = (next: boolean) => {
|
|
679
|
-
if (openProp === undefined) setInternalOpen(next);
|
|
680
|
-
onOpenChange?.(next);
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
// The stack's rise is one value: 0 closed, 1 open. The mini buttons ride it
|
|
684
|
-
// with their own stagger, so they follow the lead rather than all snapping
|
|
685
|
-
// at once.
|
|
686
|
-
const { value: rise, animated } = useSpring(open ? 1 : 0, "bouncy");
|
|
687
|
-
|
|
688
|
-
const { main: dimension, mini } = fabGroupSizes[size];
|
|
689
|
-
const closeFirst = closeIcon ?? icon;
|
|
690
|
-
|
|
691
|
-
const rotate = animated ? rise.interpolate({ inputRange: [0, 1], outputRange: ["0deg", "45deg"] }) : open ? "45deg" : "0deg";
|
|
692
|
-
|
|
693
|
-
return (
|
|
694
|
-
<View ref={ref} testID={testID} style={style} {...props}>
|
|
695
|
-
{open ? (
|
|
696
|
-
<Pressable
|
|
697
|
-
accessibilityRole="button"
|
|
698
|
-
accessibilityLabel="Close actions"
|
|
699
|
-
onPress={() => setOpen(false)}
|
|
700
|
-
style={{ position: "absolute", top: -2000, left: -2000, right: -2000, bottom: -2000, backgroundColor: theme.scrim }}
|
|
701
|
-
/>
|
|
702
|
-
) : null}
|
|
703
|
-
|
|
704
|
-
<View style={{ alignItems: "flex-end", gap: 10 }}>
|
|
705
|
-
{open
|
|
706
|
-
? actions.map((action, index) => {
|
|
707
|
-
// Later actions sit higher, so the first is nearest the button.
|
|
708
|
-
const order = actions.length - 1 - index;
|
|
709
|
-
const translateY = animated
|
|
710
|
-
? rise.interpolate({
|
|
711
|
-
inputRange: [0, 1],
|
|
712
|
-
outputRange: [24 + order * 18, 0],
|
|
713
|
-
})
|
|
714
|
-
: 0;
|
|
715
|
-
const opacity = animated ? rise.interpolate({ inputRange: [0, 0.4, 1], outputRange: [0, 0, 1] }) : 1;
|
|
716
|
-
|
|
717
|
-
const pill = (
|
|
718
|
-
<Pressable
|
|
719
|
-
accessibilityRole="button"
|
|
720
|
-
accessibilityLabel={action.label}
|
|
721
|
-
onPress={() => {
|
|
722
|
-
setOpen(false);
|
|
723
|
-
action.onPress();
|
|
724
|
-
}}
|
|
725
|
-
style={{ flexDirection: "row", alignItems: "center", gap: 8 }}
|
|
726
|
-
>
|
|
727
|
-
<Glass
|
|
728
|
-
effect="regular"
|
|
729
|
-
isDark={isDark}
|
|
730
|
-
style={{ borderRadius: radii.pill, paddingHorizontal: 12, paddingVertical: 7 }}
|
|
731
|
-
>
|
|
732
|
-
<RNText style={{ fontSize: 13, fontWeight: "600", color: theme.foreground }} numberOfLines={1}>
|
|
733
|
-
{action.label}
|
|
734
|
-
</RNText>
|
|
735
|
-
</Glass>
|
|
736
|
-
<Glass
|
|
737
|
-
effect="regular"
|
|
738
|
-
isDark={isDark}
|
|
739
|
-
style={{
|
|
740
|
-
width: mini,
|
|
741
|
-
height: mini,
|
|
742
|
-
borderRadius: mini / 2,
|
|
743
|
-
alignItems: "center",
|
|
744
|
-
justifyContent: "center",
|
|
745
|
-
}}
|
|
746
|
-
>
|
|
747
|
-
{action.icon}
|
|
748
|
-
</Glass>
|
|
749
|
-
</Pressable>
|
|
750
|
-
);
|
|
751
|
-
|
|
752
|
-
if (!animated) {
|
|
753
|
-
return (
|
|
754
|
-
<View key={`${action.label}-${index}`}>{pill}</View>
|
|
755
|
-
);
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
return (
|
|
759
|
-
<Animated.View
|
|
760
|
-
key={`${action.label}-${index}`}
|
|
761
|
-
style={{ transform: [{ translateY }], opacity }}
|
|
762
|
-
>
|
|
763
|
-
{pill}
|
|
764
|
-
</Animated.View>
|
|
765
|
-
);
|
|
766
|
-
})
|
|
767
|
-
: null}
|
|
768
|
-
|
|
769
|
-
<Pressable
|
|
770
|
-
accessibilityRole="button"
|
|
771
|
-
accessibilityLabel={accessibilityLabel}
|
|
772
|
-
accessibilityState={{ expanded: open }}
|
|
773
|
-
onPress={() => setOpen(!open)}
|
|
774
|
-
>
|
|
775
|
-
<Glass
|
|
776
|
-
effect="clear"
|
|
777
|
-
interactive
|
|
778
|
-
isDark={isDark}
|
|
779
|
-
style={{
|
|
780
|
-
width: dimension,
|
|
781
|
-
height: dimension,
|
|
782
|
-
borderRadius: dimension / 2,
|
|
783
|
-
alignItems: "center",
|
|
784
|
-
justifyContent: "center",
|
|
785
|
-
}}
|
|
786
|
-
>
|
|
787
|
-
{animated ? (
|
|
788
|
-
<Animated.View style={{ transform: [{ rotate }] }}>{open ? closeFirst : icon}</Animated.View>
|
|
789
|
-
) : (
|
|
790
|
-
<View>{open ? closeFirst : icon}</View>
|
|
791
|
-
)}
|
|
792
|
-
</Glass>
|
|
793
|
-
</Pressable>
|
|
794
|
-
</View>
|
|
795
|
-
</View>
|
|
796
|
-
);
|
|
797
|
-
});
|
|
1
|
+
// Bars, buttons and navigation: the rebuild's entries only.
|
|
2
|
+
//
|
|
3
|
+
// This file used to carry SearchBar, FAB and FABGroup as well. They were old
|
|
4
|
+
// package components and are out of scope (master prompt §2.3); the ported
|
|
5
|
+
// Toolbar, Chip and IconButton live in their own files and are re-exported
|
|
6
|
+
// here so existing import paths keep working.
|
|
7
|
+
|
|
8
|
+
export { Chip, type ChipProps } from "./Chip";
|
|
9
|
+
export { IconButton, type IconButtonProps } from "./IconButton";
|
|
10
|
+
export { Toolbar, type ToolbarProps } from "./Toolbar";
|