glacia-native 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +29 -4
- package/README.md +111 -17
- package/lib/module/Accordion.js +58 -0
- package/lib/module/ActionSheet.js +38 -0
- package/lib/module/Alert.js +23 -0
- package/lib/module/AlertDialog.js +47 -0
- package/lib/module/Avatar.js +48 -0
- package/lib/module/Badge.js +36 -0
- package/lib/module/Bars.js +13 -267
- package/lib/module/Button.js +57 -36
- package/lib/module/Card.js +32 -20
- package/lib/module/Checkbox.js +42 -0
- package/lib/module/Chip.js +80 -0
- package/lib/module/Collapsible.js +26 -0
- package/lib/module/ContextMenu.js +33 -0
- package/lib/module/Dialog.js +39 -124
- package/lib/module/DropdownMenu.js +33 -0
- package/lib/module/Field.js +22 -0
- package/lib/module/Glass.js +12 -5
- package/lib/module/Group.js +36 -0
- package/lib/module/IconButton.js +40 -0
- package/lib/module/Input.js +47 -40
- package/lib/module/Label.js +17 -0
- package/lib/module/MorphGroup.js +47 -0
- package/lib/module/Popover.js +29 -0
- package/lib/module/Progress.js +32 -0
- package/lib/module/RadioGroup.js +51 -0
- package/lib/module/Scrim.js +44 -0
- package/lib/module/SegmentedControl.js +74 -58
- package/lib/module/Select.js +51 -0
- package/lib/module/Separator.js +25 -0
- package/lib/module/Sheet.js +51 -0
- package/lib/module/Skeleton.js +48 -0
- package/lib/module/Slider.js +60 -40
- package/lib/module/Stepper.js +167 -0
- package/lib/module/Switch.js +45 -43
- package/lib/module/TabBar.js +62 -50
- package/lib/module/Tabs.js +3 -2
- package/lib/module/Textarea.js +18 -0
- package/lib/module/Toast.js +55 -0
- package/lib/module/Toggle.js +47 -0
- package/lib/module/ToggleGroup.js +56 -0
- package/lib/module/Toolbar.js +37 -0
- package/lib/module/Tooltip.js +31 -0
- package/lib/module/glass-provider.js +28 -0
- package/lib/module/glass-stack.js +61 -0
- package/lib/module/index.js +78 -109
- package/lib/module/internal/GlassBackdrop.js +36 -0
- package/lib/module/internal/GlassView.js +45 -13
- package/lib/module/internal/blur-community.js +20 -0
- package/lib/module/internal/blur-community.web.js +9 -0
- package/lib/module/internal/blur.js +75 -0
- package/lib/module/internal/fallback.js +110 -20
- package/lib/module/internal/glass-routing.js +154 -30
- package/lib/module/internal/glow.js +36 -0
- package/lib/module/internal/initials.js +12 -0
- package/lib/module/internal/lens.js +70 -0
- package/lib/module/internal/material.js +64 -0
- package/lib/module/internal/overlay.js +147 -0
- package/lib/module/internal/primitives.js +17 -0
- package/lib/module/internal/rim.js +35 -0
- package/lib/module/internal/tokens.js +34 -2
- package/lib/typescript/Accordion.d.ts +22 -0
- package/lib/typescript/ActionSheet.d.ts +24 -0
- package/lib/typescript/Alert.d.ts +15 -0
- package/lib/typescript/AlertDialog.d.ts +17 -0
- package/lib/typescript/Avatar.d.ts +22 -0
- package/lib/typescript/Badge.d.ts +12 -0
- package/lib/typescript/Bars.d.ts +3 -188
- package/lib/typescript/Button.d.ts +44 -10
- package/lib/typescript/Card.d.ts +30 -3
- package/lib/typescript/Checkbox.d.ts +14 -0
- package/lib/typescript/Chip.d.ts +19 -0
- package/lib/typescript/Collapsible.d.ts +17 -0
- package/lib/typescript/ContextMenu.d.ts +23 -0
- package/lib/typescript/Dialog.d.ts +8 -68
- package/lib/typescript/DropdownMenu.d.ts +23 -0
- package/lib/typescript/Field.d.ts +19 -0
- package/lib/typescript/Glass.d.ts +11 -2
- package/lib/typescript/Group.d.ts +35 -0
- package/lib/typescript/IconButton.d.ts +21 -0
- package/lib/typescript/Input.d.ts +17 -18
- package/lib/typescript/Label.d.ts +14 -0
- package/lib/typescript/MorphGroup.d.ts +46 -0
- package/lib/typescript/Popover.d.ts +17 -0
- package/lib/typescript/Progress.d.ts +13 -0
- package/lib/typescript/RadioGroup.d.ts +21 -0
- package/lib/typescript/Scrim.d.ts +33 -0
- package/lib/typescript/SegmentedControl.d.ts +24 -13
- package/lib/typescript/Select.d.ts +19 -0
- package/lib/typescript/Separator.d.ts +10 -0
- package/lib/typescript/Sheet.d.ts +45 -0
- package/lib/typescript/Skeleton.d.ts +10 -0
- package/lib/typescript/Slider.d.ts +15 -7
- package/lib/typescript/Stepper.d.ts +49 -0
- package/lib/typescript/Switch.d.ts +19 -12
- package/lib/typescript/TabBar.d.ts +18 -6
- package/lib/typescript/Textarea.d.ts +6 -0
- package/lib/typescript/Toast.d.ts +40 -0
- package/lib/typescript/Toggle.d.ts +21 -0
- package/lib/typescript/ToggleGroup.d.ts +22 -0
- package/lib/typescript/Toolbar.d.ts +35 -0
- package/lib/typescript/Tooltip.d.ts +16 -0
- package/lib/typescript/glass-provider.d.ts +34 -0
- package/lib/typescript/glass-stack.d.ts +54 -0
- package/lib/typescript/index.d.ts +39 -17
- package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
- package/lib/typescript/internal/GlassView.d.ts +31 -2
- package/lib/typescript/internal/blur-community.d.ts +2 -0
- package/lib/typescript/internal/blur-community.web.d.ts +2 -0
- package/lib/typescript/internal/blur.d.ts +24 -0
- package/lib/typescript/internal/fallback.d.ts +27 -2
- package/lib/typescript/internal/glass-routing.d.ts +83 -15
- package/lib/typescript/internal/glow.d.ts +11 -0
- package/lib/typescript/internal/initials.d.ts +2 -0
- package/lib/typescript/internal/lens.d.ts +47 -0
- package/lib/typescript/internal/material.d.ts +27 -0
- package/lib/typescript/internal/overlay.d.ts +74 -0
- package/lib/typescript/internal/primitives.d.ts +13 -0
- package/lib/typescript/internal/rim.d.ts +16 -0
- package/lib/typescript/internal/tokens.d.ts +36 -0
- package/package.json +15 -4
- package/src/Accordion.tsx +165 -0
- package/src/ActionSheet.tsx +149 -0
- package/src/Alert.tsx +85 -0
- package/src/AlertDialog.tsx +124 -0
- package/src/Avatar.tsx +102 -0
- package/src/Badge.tsx +80 -0
- package/src/Bars.tsx +10 -797
- package/src/Button.tsx +196 -60
- package/src/Card.tsx +106 -33
- package/src/Checkbox.tsx +98 -0
- package/src/Chip.tsx +149 -0
- package/src/Collapsible.tsx +66 -0
- package/src/ContextMenu.tsx +103 -0
- package/src/Dialog.tsx +86 -325
- package/src/DropdownMenu.tsx +103 -0
- package/src/Field.tsx +65 -0
- package/src/Glass.tsx +19 -5
- package/src/Group.tsx +98 -0
- package/src/IconButton.tsx +110 -0
- package/src/Input.tsx +143 -87
- package/src/Label.tsx +56 -0
- package/src/MorphGroup.tsx +134 -0
- package/src/Popover.tsx +81 -0
- package/src/Progress.tsx +83 -0
- package/src/RadioGroup.tsx +122 -0
- package/src/Scrim.tsx +94 -0
- package/src/SegmentedControl.tsx +147 -90
- package/src/Select.tsx +136 -0
- package/src/Separator.tsx +52 -0
- package/src/Sheet.tsx +139 -0
- package/src/Skeleton.tsx +77 -0
- package/src/Slider.tsx +100 -54
- package/src/Stepper.tsx +315 -0
- package/src/Switch.tsx +80 -58
- package/src/TabBar.tsx +118 -84
- package/src/Tabs.tsx +5 -0
- package/src/Textarea.tsx +34 -0
- package/src/Toast.tsx +131 -0
- package/src/Toggle.tsx +113 -0
- package/src/ToggleGroup.tsx +129 -0
- package/src/Toolbar.tsx +111 -0
- package/src/Tooltip.tsx +79 -0
- package/src/engine/CHANGELOG.md +430 -0
- package/src/engine/NOTICE +54 -0
- package/src/engine/README.md +975 -0
- package/src/engine/android/build.gradle +18 -0
- package/src/engine/android/src/main/AndroidManifest.xml +2 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
- package/src/engine/index.ts +24 -0
- package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
- package/src/engine/ios/Enums/GlassVariant.swift +86 -0
- package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
- package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
- package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
- package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
- package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
- package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
- package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
- package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
- package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
- package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
- package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
- package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
- package/src/engine/ios/Glass/StripCache.swift +545 -0
- package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
- package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
- package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
- package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
- package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
- package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
- package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
- package/src/engine/package.json +70 -0
- package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
- package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
- package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
- package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
- package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
- package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
- package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
- package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
- package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
- package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
- package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
- package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
- package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
- package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
- package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
- package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
- package/src/engine/src/components/index.ts +16 -0
- package/src/engine/src/constants/index.ts +4 -0
- package/src/engine/src/constants/metal.constants.ts +327 -0
- package/src/engine/src/constants/metrics.constants.ts +325 -0
- package/src/engine/src/constants/springs.constants.ts +107 -0
- package/src/engine/src/constants/styles.constants.ts +12 -0
- package/src/engine/src/context/glass-group.context.ts +65 -0
- package/src/engine/src/context/index.ts +6 -0
- package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
- package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
- package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
- package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
- package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
- package/src/engine/src/core/components/index.ts +4 -0
- package/src/engine/src/core/constants/glass.constants.ts +57 -0
- package/src/engine/src/core/constants/index.ts +20 -0
- package/src/engine/src/core/constants/native.constants.ts +16 -0
- package/src/engine/src/core/context/glass-stack.context.ts +30 -0
- package/src/engine/src/core/context/index.ts +4 -0
- package/src/engine/src/core/enum/index.ts +12 -0
- package/src/engine/src/core/index.ts +1 -0
- package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
- package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
- package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
- package/src/engine/src/core/interfaces/index.ts +31 -0
- package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
- package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
- package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
- package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
- package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
- package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
- package/src/engine/src/core/modules/index.ts +2 -0
- package/src/engine/src/core/root/index.ts +51 -0
- package/src/engine/src/core/types/glass.types.ts +25 -0
- package/src/engine/src/core/types/index.ts +8 -0
- package/src/engine/src/core/utils/debug.utils.ts +17 -0
- package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
- package/src/engine/src/core/utils/hdr.utils.ts +37 -0
- package/src/engine/src/core/utils/index.ts +5 -0
- package/src/engine/src/core/utils/native-view.utils.ts +33 -0
- package/src/engine/src/core/utils/platform.utils.ts +34 -0
- package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
- package/src/engine/src/core/views/index.ts +4 -0
- package/src/engine/src/hooks/index.ts +18 -0
- package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
- package/src/engine/src/hooks/use-damped-drag.ts +332 -0
- package/src/engine/src/hooks/use-echo-filter.ts +55 -0
- package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
- package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
- package/src/engine/src/hooks/use-press-progress.ts +44 -0
- package/src/engine/src/index.ts +120 -0
- package/src/engine/src/interfaces/index.ts +28 -0
- package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
- package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
- package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
- package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
- package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
- package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
- package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
- package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
- package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
- package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
- package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
- package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
- package/src/engine/src/theme/glass-ui-theme.ts +100 -0
- package/src/engine/src/theme/index.ts +2 -0
- package/src/engine/src/utils/button-press.utils.ts +63 -0
- package/src/engine/src/utils/index.ts +3 -0
- package/src/engine/src/utils/metal.utils.ts +164 -0
- package/src/glass-provider.tsx +60 -0
- package/src/glass-stack.tsx +115 -0
- package/src/index.ts +48 -190
- package/src/internal/GlassBackdrop.tsx +60 -0
- package/src/internal/GlassView.tsx +70 -18
- package/src/internal/blur-community.ts +19 -0
- package/src/internal/blur-community.web.ts +7 -0
- package/src/internal/blur.ts +89 -0
- package/src/internal/fallback.tsx +158 -20
- package/src/internal/glass-routing.ts +211 -34
- package/src/internal/glow.tsx +62 -0
- package/src/internal/initials.ts +7 -0
- package/src/internal/lens.tsx +105 -0
- package/src/internal/material.ts +92 -0
- package/src/internal/overlay.tsx +258 -0
- package/src/internal/primitives.ts +26 -0
- package/src/internal/rim.tsx +79 -0
- package/src/internal/tokens.ts +34 -1
- package/lib/module/Carousel.js +0 -103
- package/lib/module/Display.js +0 -317
- package/lib/module/Feedback.js +0 -386
- package/lib/module/Form.js +0 -164
- package/lib/module/Forms2.js +0 -454
- package/lib/module/Message.js +0 -88
- package/lib/module/Overlays.js +0 -328
- package/lib/module/Pickers.js +0 -243
- package/lib/module/Table.js +0 -99
- package/lib/module/ai.js +0 -280
- package/lib/module/charts/AreaChart.js +0 -32
- package/lib/module/charts/BarChart.js +0 -67
- package/lib/module/charts/FunnelChart.js +0 -50
- package/lib/module/charts/HeatmapChart.js +0 -71
- package/lib/module/charts/LineChart.js +0 -81
- package/lib/module/charts/PlotChart.js +0 -52
- package/lib/module/charts/RadarChart.js +0 -78
- package/lib/module/charts/RingChart.js +0 -52
- package/lib/module/charts/ScatterChart.js +0 -95
- package/lib/module/charts/WaterfallChart.js +0 -85
- package/lib/module/charts/advanced.js +0 -313
- package/lib/module/charts/extra.js +0 -108
- package/lib/module/charts/index.js +0 -50
- package/lib/module/charts/scales.js +0 -140
- package/lib/typescript/Carousel.d.ts +0 -47
- package/lib/typescript/Display.d.ts +0 -178
- package/lib/typescript/Feedback.d.ts +0 -196
- package/lib/typescript/Form.d.ts +0 -97
- package/lib/typescript/Forms2.d.ts +0 -209
- package/lib/typescript/Message.d.ts +0 -71
- package/lib/typescript/Overlays.d.ts +0 -146
- package/lib/typescript/Pickers.d.ts +0 -105
- package/lib/typescript/Table.d.ts +0 -64
- package/lib/typescript/ai.d.ts +0 -166
- package/lib/typescript/charts/AreaChart.d.ts +0 -44
- package/lib/typescript/charts/BarChart.d.ts +0 -19
- package/lib/typescript/charts/FunnelChart.d.ts +0 -25
- package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
- package/lib/typescript/charts/LineChart.d.ts +0 -30
- package/lib/typescript/charts/PlotChart.d.ts +0 -31
- package/lib/typescript/charts/RadarChart.d.ts +0 -27
- package/lib/typescript/charts/RingChart.d.ts +0 -28
- package/lib/typescript/charts/ScatterChart.d.ts +0 -34
- package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
- package/lib/typescript/charts/advanced.d.ts +0 -107
- package/lib/typescript/charts/extra.d.ts +0 -63
- package/lib/typescript/charts/index.d.ts +0 -13
- package/lib/typescript/charts/scales.d.ts +0 -35
- package/src/Carousel.tsx +0 -233
- package/src/Display.tsx +0 -778
- package/src/Feedback.tsx +0 -969
- package/src/Form.tsx +0 -425
- package/src/Forms2.tsx +0 -1014
- package/src/Message.tsx +0 -219
- package/src/Overlays.tsx +0 -685
- package/src/Pickers.tsx +0 -590
- package/src/Table.tsx +0 -231
- package/src/ai.tsx +0 -707
- package/src/charts/AreaChart.tsx +0 -73
- package/src/charts/BarChart.tsx +0 -183
- package/src/charts/FunnelChart.tsx +0 -125
- package/src/charts/HeatmapChart.tsx +0 -155
- package/src/charts/LineChart.tsx +0 -247
- package/src/charts/PlotChart.tsx +0 -168
- package/src/charts/RadarChart.tsx +0 -208
- package/src/charts/RingChart.tsx +0 -133
- package/src/charts/ScatterChart.tsx +0 -223
- package/src/charts/WaterfallChart.tsx +0 -201
- package/src/charts/advanced.tsx +0 -676
- package/src/charts/extra.tsx +0 -242
- package/src/charts/index.ts +0 -86
- package/src/charts/scales.ts +0 -163
package/lib/module/Slider.js
CHANGED
|
@@ -4,13 +4,17 @@ exports.Slider = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const primitives_1 = require("./internal/primitives");
|
|
7
|
+
const glass_routing_1 = require("./internal/glass-routing");
|
|
8
|
+
const GlassView_1 = require("./internal/GlassView");
|
|
7
9
|
const Glass_1 = require("./Glass");
|
|
8
10
|
const tokens_1 = require("./internal/tokens");
|
|
9
11
|
const primitives_2 = require("./internal/primitives");
|
|
10
12
|
const motion_1 = require("./internal/motion");
|
|
11
13
|
const haptics_1 = require("./internal/haptics");
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
+
// The web slider: a 6pt track and a glass-lens thumb rather than a small dot.
|
|
15
|
+
const TRACK_HEIGHT = 6;
|
|
16
|
+
const THUMB_WIDTH = 40;
|
|
17
|
+
const THUMB_HEIGHT = 24;
|
|
14
18
|
const CONTAINER_HEIGHT = 40;
|
|
15
19
|
/** Rounds `value` onto the nearest step from `min`, clamped to the range. */
|
|
16
20
|
function quantize(value, min, max, step) {
|
|
@@ -20,23 +24,25 @@ function quantize(value, min, max, step) {
|
|
|
20
24
|
if (!(step > 0))
|
|
21
25
|
return clamped;
|
|
22
26
|
const stepped = min + Math.round((clamped - min) / step) * step;
|
|
23
|
-
// Round away binary float noise introduced by the division above.
|
|
24
27
|
const decimals = (String(step).split(".")[1] ?? "").length;
|
|
25
28
|
return Number(Math.min(max, Math.max(min, stepped)).toFixed(decimals));
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
|
-
* A continuous value chosen by dragging
|
|
31
|
+
* A continuous value chosen by dragging — ported from the engine's
|
|
32
|
+
* `LiquidGlassSlider`, which keeps the approved drag behaviour while the
|
|
33
|
+
* material changes by platform.
|
|
29
34
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* platform; only the glass material changes.
|
|
35
|
+
* With a glass renderer available the engine's own control mounts, carrying the
|
|
36
|
+
* approved geometry and drag behaviour. Without one — Expo Go, below every tier,
|
|
37
|
+
* or Reduce Transparency — the fallback floor renders the same track and lens
|
|
38
|
+
* thumb with the fallback material, so the control is never invisible.
|
|
35
39
|
*/
|
|
36
|
-
exports.Slider = (0, react_1.forwardRef)(function Slider({ value: valueProp, defaultValue = 50, min = 0, max = 100, step = 1, onValueChange, disabled = false, haptics = true, accessibilityLabel, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
40
|
+
exports.Slider = (0, react_1.forwardRef)(function Slider({ value: valueProp, defaultValue = 50, min = 0, max = 100, step = 1, onValueChange, onSlidingComplete, disabled = false, haptics = true, accessibilityLabel, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
37
41
|
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
38
42
|
const themeColors = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
39
43
|
const { View, Pressable, PanResponder } = (0, primitives_2.primitives)();
|
|
44
|
+
const capabilities = (0, GlassView_1.glassCapabilities)();
|
|
45
|
+
const EngineSlider = (0, glass_routing_1.loadEngineControl)("Slider");
|
|
40
46
|
const [internalValue, setInternalValue] = (0, react_1.useState)(() => quantize(defaultValue, min, max, step));
|
|
41
47
|
const value = valueProp !== undefined ? quantize(valueProp, min, max, step) : internalValue;
|
|
42
48
|
// Two actions can arrive before React re-renders (increment then decrement,
|
|
@@ -44,8 +50,6 @@ exports.Slider = (0, react_1.forwardRef)(function Slider({ value: valueProp, def
|
|
|
44
50
|
// second one starts from it instead of a stale closure.
|
|
45
51
|
const valueRef = (0, react_1.useRef)(value);
|
|
46
52
|
valueRef.current = value;
|
|
47
|
-
// Track width as measured on layout. A drag before layout is a no-op rather
|
|
48
|
-
// than a jump: without a width there is no honest mapping from x to value.
|
|
49
53
|
const widthRef = (0, react_1.useRef)(0);
|
|
50
54
|
/** Converts an x position relative to the track into a stepped value. */
|
|
51
55
|
const valueAtX = (0, react_1.useMemo)(() => (x) => {
|
|
@@ -85,10 +89,15 @@ exports.Slider = (0, react_1.forwardRef)(function Slider({ value: valueProp, def
|
|
|
85
89
|
if (next !== null)
|
|
86
90
|
report(next);
|
|
87
91
|
},
|
|
92
|
+
onPanResponderRelease: (event) => {
|
|
93
|
+
const next = valueAtX(event.nativeEvent.locationX);
|
|
94
|
+
if (next !== null) {
|
|
95
|
+
report(next);
|
|
96
|
+
onSlidingComplete?.(next);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
88
99
|
onPanResponderTerminationRequest: () => false,
|
|
89
100
|
});
|
|
90
|
-
// `report` reads the value from a ref, so the responder does not need to be
|
|
91
|
-
// rebuilt on every value change and never acts on a stale render.
|
|
92
101
|
}, [disabled, valueAtX]);
|
|
93
102
|
/** Steps the value for accessibility actions and hardware keys. */
|
|
94
103
|
const nudge = (direction) => {
|
|
@@ -118,33 +127,44 @@ exports.Slider = (0, react_1.forwardRef)(function Slider({ value: valueProp, def
|
|
|
118
127
|
};
|
|
119
128
|
const thumbStyle = {
|
|
120
129
|
position: "absolute",
|
|
121
|
-
top: (CONTAINER_HEIGHT -
|
|
130
|
+
top: (CONTAINER_HEIGHT - THUMB_HEIGHT) / 2,
|
|
122
131
|
left: `${Math.min(100, Math.max(0, percentage))}%`,
|
|
123
|
-
width:
|
|
124
|
-
height:
|
|
125
|
-
marginLeft: -
|
|
126
|
-
borderRadius:
|
|
127
|
-
backgroundColor:
|
|
132
|
+
width: THUMB_WIDTH,
|
|
133
|
+
height: THUMB_HEIGHT,
|
|
134
|
+
marginLeft: -THUMB_WIDTH / 2,
|
|
135
|
+
borderRadius: THUMB_HEIGHT / 2,
|
|
136
|
+
backgroundColor: themeColors.onTint,
|
|
128
137
|
borderWidth: 0.5,
|
|
129
|
-
borderColor:
|
|
138
|
+
borderColor: themeColors.edge,
|
|
139
|
+
shadowColor: tokens_1.material.shadowColor,
|
|
140
|
+
shadowOpacity: 0.2,
|
|
141
|
+
shadowRadius: 8,
|
|
142
|
+
shadowOffset: { width: 0, height: 3 },
|
|
143
|
+
elevation: 3,
|
|
130
144
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
ref
|
|
149
|
-
|
|
145
|
+
// ------------------------------------------------------------------
|
|
146
|
+
// Fallback floor: the same track and lens thumb, on the fallback material.
|
|
147
|
+
// ------------------------------------------------------------------
|
|
148
|
+
if (!(EngineSlider && capabilities.supported)) {
|
|
149
|
+
const track = ((0, jsx_runtime_1.jsx)(View, { style: trackStyle, children: (0, jsx_runtime_1.jsx)(View, { style: fillStyle }) }));
|
|
150
|
+
const thumb = (0, jsx_runtime_1.jsx)(View, { style: thumbStyle, pointerEvents: "none" });
|
|
151
|
+
return ((0, jsx_runtime_1.jsxs)(Pressable, { testID: testID, accessibilityRole: "adjustable", accessibilityLabel: accessibilityLabel, accessibilityState: { disabled }, accessibilityValue: { min, max, now: value }, accessibilityActions: [{ name: "increment" }, { name: "decrement" }], disabled: disabled, onAccessibilityAction: (event) => {
|
|
152
|
+
if (event?.nativeEvent?.actionName === "increment")
|
|
153
|
+
nudge(1);
|
|
154
|
+
if (event?.nativeEvent?.actionName === "decrement")
|
|
155
|
+
nudge(-1);
|
|
156
|
+
}, onLayout: (event) => {
|
|
157
|
+
const width = event?.nativeEvent?.layout?.width;
|
|
158
|
+
if (typeof width === "number" && width > 0)
|
|
159
|
+
widthRef.current = width;
|
|
160
|
+
}, ref: (node) => {
|
|
161
|
+
(0, primitives_1.measurePreviewWidth)(node, widthRef);
|
|
162
|
+
if (typeof ref === "function")
|
|
163
|
+
ref(node);
|
|
164
|
+
else if (ref)
|
|
165
|
+
ref.current = node;
|
|
166
|
+
}, style: containerStyle, ...(panResponder ? panResponder.panHandlers : {}), ...props, children: [(0, jsx_runtime_1.jsx)(Glass_1.Glass, { effect: "regular", isDark: isDark, style: trackStyle, children: track }), thumb] }));
|
|
167
|
+
}
|
|
168
|
+
const EngineSliderComponent = EngineSlider;
|
|
169
|
+
return ((0, jsx_runtime_1.jsx)(EngineSliderComponent, { value: value, onValueChange: disabled ? undefined : onValueChange ?? report, onSlidingComplete: disabled ? undefined : onSlidingComplete, minimumValue: min, maximumValue: max, step: step, disabled: disabled, accentColor: themeColors.fill, trackColor: "rgba(120, 120, 128, 0.2)", style: style }));
|
|
150
170
|
});
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Stepper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const glass_routing_1 = require("./internal/glass-routing");
|
|
7
|
+
const GlassView_1 = require("./internal/GlassView");
|
|
8
|
+
const Glass_1 = require("./Glass");
|
|
9
|
+
const tokens_1 = require("./internal/tokens");
|
|
10
|
+
const primitives_1 = require("./internal/primitives");
|
|
11
|
+
const motion_1 = require("./internal/motion");
|
|
12
|
+
const a11y_1 = require("./internal/a11y");
|
|
13
|
+
const haptics_1 = require("./internal/haptics");
|
|
14
|
+
// The engine's stepper geometry, kept exactly: a 40dp capsule whose `−`/`+`
|
|
15
|
+
// ends are 44dp cells around a 44dp-minimum readout, with the thumb inset by
|
|
16
|
+
// the segmented control's 3dp.
|
|
17
|
+
const STEPPER_HEIGHT = 40;
|
|
18
|
+
const STEPPER_CELL_WIDTH = 44;
|
|
19
|
+
const STEPPER_VALUE_MIN_WIDTH = 44;
|
|
20
|
+
const STEPPER_INSET = 3;
|
|
21
|
+
const STEPPER_REPEAT_DELAY_MS = 400;
|
|
22
|
+
const STEPPER_REPEAT_INTERVAL_MS = 110;
|
|
23
|
+
const STEPPER_VALUE_POP_SCALE = 1.18;
|
|
24
|
+
/**
|
|
25
|
+
* Minus / value / plus — ported from the engine's `LiquidGlassStepper`, the
|
|
26
|
+
* design Binyam approved on real devices this week (40dp capsule, 44dp cells,
|
|
27
|
+
* press thumb blooming over the held end, the value popping as it changes, and
|
|
28
|
+
* hold-to-repeat).
|
|
29
|
+
*
|
|
30
|
+
* With a glass renderer available the engine's own control mounts, carrying the
|
|
31
|
+
* approved geometry and behaviour. Without one — Expo Go, below every tier, or
|
|
32
|
+
* Reduce Transparency — the fallback floor renders the same capsule, cells and
|
|
33
|
+
* readout on Glacia's solid material, so the control is never invisible.
|
|
34
|
+
*/
|
|
35
|
+
exports.Stepper = (0, react_1.forwardRef)(function Stepper({ value: valueProp, defaultValue = 0, onValueChange, min, max, minimumValue, maximumValue, step = 1, autoRepeat = true, haptics = true, disabled = false, height = STEPPER_HEIGHT, formatValue, accessibilityLabel, tint, thumbTint, providerId, isDark: isDarkProp, style, textStyle, testID, ...props }, ref) {
|
|
36
|
+
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
37
|
+
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
38
|
+
const reducedMotion = (0, a11y_1.useReducedMotion)();
|
|
39
|
+
const { Animated, View, Pressable, Text: RNText, isNative } = (0, primitives_1.primitives)();
|
|
40
|
+
const capabilities = (0, GlassView_1.glassCapabilities)();
|
|
41
|
+
const EngineStepper = (0, glass_routing_1.loadEngineControl)("Stepper");
|
|
42
|
+
const lower = min ?? minimumValue ?? 0;
|
|
43
|
+
const upper = max ?? maximumValue ?? 100;
|
|
44
|
+
const [internalValue, setInternalValue] = (0, react_1.useState)(() => clamp(defaultValue, lower, upper));
|
|
45
|
+
const value = clamp(valueProp !== undefined ? valueProp : internalValue, lower, upper);
|
|
46
|
+
// Two actions can arrive before a re-render (hold-to-repeat, or both ends in
|
|
47
|
+
// one frame). The ref holds the newest value so the next step starts from it.
|
|
48
|
+
const valueRef = (0, react_1.useRef)(value);
|
|
49
|
+
valueRef.current = value;
|
|
50
|
+
const [held, setHeld] = (0, react_1.useState)(0);
|
|
51
|
+
const repeatTimer = (0, react_1.useRef)(null);
|
|
52
|
+
(0, react_1.useEffect)(() => () => stopRepeat(), []);
|
|
53
|
+
// The readout pops on each change, like the engine's: an immediate lift then
|
|
54
|
+
// a spring home. Reduce Motion settles it straight at its resting scale.
|
|
55
|
+
const pop = (0, react_1.useRef)(null);
|
|
56
|
+
const animate = Boolean(isNative && Animated?.Value && Animated?.spring) && !reducedMotion;
|
|
57
|
+
if (pop.current === null) {
|
|
58
|
+
pop.current = animate ? new Animated.Value(1) : { value: 1 };
|
|
59
|
+
}
|
|
60
|
+
const firstValue = (0, react_1.useRef)(true);
|
|
61
|
+
(0, react_1.useEffect)(() => {
|
|
62
|
+
if (firstValue.current) {
|
|
63
|
+
firstValue.current = false;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!animate)
|
|
67
|
+
return;
|
|
68
|
+
pop.current.setValue(STEPPER_VALUE_POP_SCALE);
|
|
69
|
+
const animation = Animated.spring(pop.current, {
|
|
70
|
+
toValue: 1,
|
|
71
|
+
...tokens_1.springs.snappy,
|
|
72
|
+
useNativeDriver: false,
|
|
73
|
+
});
|
|
74
|
+
animation.start();
|
|
75
|
+
return () => animation.stop?.();
|
|
76
|
+
}, [animate, value]);
|
|
77
|
+
const atMin = value <= lower;
|
|
78
|
+
const atMax = value >= upper;
|
|
79
|
+
const apply = (next) => {
|
|
80
|
+
const clamped = clamp(next, lower, upper);
|
|
81
|
+
if (clamped === valueRef.current)
|
|
82
|
+
return;
|
|
83
|
+
if (haptics)
|
|
84
|
+
(0, haptics_1.hapticSelection)();
|
|
85
|
+
valueRef.current = clamped;
|
|
86
|
+
if (valueProp === undefined)
|
|
87
|
+
setInternalValue(clamped);
|
|
88
|
+
onValueChange?.(clamped);
|
|
89
|
+
};
|
|
90
|
+
function stopRepeat() {
|
|
91
|
+
if (repeatTimer.current != null) {
|
|
92
|
+
clearInterval(repeatTimer.current);
|
|
93
|
+
repeatTimer.current = null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const stepBy = (direction) => apply(valueRef.current + direction * step);
|
|
97
|
+
const handlePressIn = (direction) => {
|
|
98
|
+
setHeld(direction);
|
|
99
|
+
};
|
|
100
|
+
const handlePressOut = () => {
|
|
101
|
+
setHeld(0);
|
|
102
|
+
stopRepeat();
|
|
103
|
+
};
|
|
104
|
+
const handleLongPress = (direction) => {
|
|
105
|
+
if (!autoRepeat)
|
|
106
|
+
return;
|
|
107
|
+
stepBy(direction);
|
|
108
|
+
stopRepeat();
|
|
109
|
+
repeatTimer.current = setInterval(() => stepBy(direction), STEPPER_REPEAT_INTERVAL_MS);
|
|
110
|
+
};
|
|
111
|
+
const label = formatValue ? formatValue(value) : String(value);
|
|
112
|
+
const rootStyle = {
|
|
113
|
+
height,
|
|
114
|
+
borderRadius: tokens_1.radii.pill,
|
|
115
|
+
alignSelf: "flex-start",
|
|
116
|
+
flexDirection: "row",
|
|
117
|
+
alignItems: "stretch",
|
|
118
|
+
opacity: disabled ? 0.5 : 1,
|
|
119
|
+
...style,
|
|
120
|
+
};
|
|
121
|
+
const cellStyle = {
|
|
122
|
+
width: STEPPER_CELL_WIDTH,
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
justifyContent: "center",
|
|
125
|
+
};
|
|
126
|
+
// ------------------------------------------------------------------
|
|
127
|
+
// Fallback floor: the same capsule, cells and readout, on Glacia's
|
|
128
|
+
// solid-capable material.
|
|
129
|
+
// ------------------------------------------------------------------
|
|
130
|
+
if (!(EngineStepper && capabilities.supported)) {
|
|
131
|
+
const thumbWidth = STEPPER_CELL_WIDTH - STEPPER_INSET;
|
|
132
|
+
const thumb = held !== 0 ? ((0, jsx_runtime_1.jsx)(View, { pointerEvents: "none", style: {
|
|
133
|
+
position: "absolute",
|
|
134
|
+
top: STEPPER_INSET,
|
|
135
|
+
left: held < 0 ? STEPPER_INSET : undefined,
|
|
136
|
+
right: held > 0 ? STEPPER_INSET : undefined,
|
|
137
|
+
width: thumbWidth,
|
|
138
|
+
height: height - 2 * STEPPER_INSET,
|
|
139
|
+
borderRadius: tokens_1.radii.pill,
|
|
140
|
+
backgroundColor: thumbTint ?? theme.glassActive,
|
|
141
|
+
} })) : null;
|
|
142
|
+
const cell = (label, sign, direction, blocked) => ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { disabled: disabled || blocked }, disabled: disabled || blocked, delayLongPress: STEPPER_REPEAT_DELAY_MS, onPressIn: () => handlePressIn(direction), onPressOut: handlePressOut, onPress: () => stepBy(direction), onLongPress: () => handleLongPress(direction), style: cellStyle, children: (0, jsx_runtime_1.jsx)(RNText, { style: {
|
|
143
|
+
fontSize: 20,
|
|
144
|
+
fontWeight: "500",
|
|
145
|
+
color: theme.foreground,
|
|
146
|
+
opacity: disabled || blocked ? 0.35 : 1,
|
|
147
|
+
}, children: sign }) }));
|
|
148
|
+
return ((0, jsx_runtime_1.jsxs)(Glass_1.Glass, { ref: ref, effect: "regular", surface: "control", tintColor: tint, isDark: isDark, testID: testID, accessibilityRole: "adjustable", accessibilityLabel: accessibilityLabel, accessibilityState: { disabled }, accessibilityValue: { min: lower, max: upper, now: value, text: label }, accessibilityActions: [{ name: "increment" }, { name: "decrement" }], onAccessibilityAction: (event) => {
|
|
149
|
+
const action = event?.nativeEvent?.actionName;
|
|
150
|
+
if (action === "increment")
|
|
151
|
+
apply(valueRef.current + step);
|
|
152
|
+
if (action === "decrement")
|
|
153
|
+
apply(valueRef.current - step);
|
|
154
|
+
}, style: rootStyle, ...props, children: [cell(`Decrease ${accessibilityLabel}`, "\u2212", -1, atMin), (0, jsx_runtime_1.jsx)(View, { style: { minWidth: STEPPER_VALUE_MIN_WIDTH, justifyContent: "center", alignItems: "center" }, children: (0, jsx_runtime_1.jsx)(Animated.View, { style: { transform: [{ scale: pop.current }] }, children: (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: [
|
|
155
|
+
{ fontSize: 16, fontWeight: "600", color: theme.foreground },
|
|
156
|
+
textStyle,
|
|
157
|
+
], children: label }) }) }), cell(`Increase ${accessibilityLabel}`, "+", 1, atMax), thumb] }));
|
|
158
|
+
}
|
|
159
|
+
const EngineStepperComponent = EngineStepper;
|
|
160
|
+
return ((0, jsx_runtime_1.jsx)(EngineStepperComponent, { value: value, onValueChange: disabled ? undefined : (next) => apply(next), minimumValue: lower, maximumValue: upper, step: step, disabled: disabled, autoRepeat: autoRepeat, formatValue: formatValue, height: height, tint: tint, thumbTint: thumbTint, providerId: providerId, style: style, textStyle: textStyle, testID: testID, accessibilityLabel: accessibilityLabel }));
|
|
161
|
+
});
|
|
162
|
+
/** Keeps a value inside the stepper's range. */
|
|
163
|
+
function clamp(value, min, max) {
|
|
164
|
+
if (!Number.isFinite(value))
|
|
165
|
+
return min;
|
|
166
|
+
return Math.min(max, Math.max(min, value));
|
|
167
|
+
}
|
package/lib/module/Switch.js
CHANGED
|
@@ -3,61 +3,63 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Switch = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const glass_routing_1 = require("./internal/glass-routing");
|
|
7
|
+
const GlassView_1 = require("./internal/GlassView");
|
|
7
8
|
const tokens_1 = require("./internal/tokens");
|
|
8
9
|
const primitives_1 = require("./internal/primitives");
|
|
9
|
-
const motion_1 = require("./internal/motion");
|
|
10
10
|
const haptics_1 = require("./internal/haptics");
|
|
11
|
-
const
|
|
12
|
-
const TRACK_HEIGHT = 31;
|
|
13
|
-
const THUMB = 27;
|
|
14
|
-
const TRAVEL = TRACK_WIDTH - THUMB - 4;
|
|
11
|
+
const motion_1 = require("./internal/motion");
|
|
15
12
|
/**
|
|
16
|
-
* An on/off switch
|
|
13
|
+
* An on/off switch — ported from the engine's `LiquidGlassSwitch`, the design
|
|
14
|
+
* Binyam approved on real devices this week (64x28 track, 40x24 lens thumb).
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* With a glass renderer available the engine's own control mounts, carrying the
|
|
17
|
+
* approved geometry and interaction. Without one — Expo Go, below every tier, or
|
|
18
|
+
* Reduce Transparency — the fallback floor renders the same geometry with a solid
|
|
19
|
+
* track and lens thumb, so the control is never invisible.
|
|
22
20
|
*/
|
|
23
|
-
exports.Switch = (0, react_1.forwardRef)(function Switch({
|
|
21
|
+
exports.Switch = (0, react_1.forwardRef)(function Switch({ value: valueProp, defaultValue = false, onValueChange, disabled = false, accentColor, trackColor, accessibilityLabel, haptics = true, isDark: isDarkProp, testID, style, ...props }, ref) {
|
|
24
22
|
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
25
23
|
const themeColors = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
26
|
-
const { View, Pressable
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const
|
|
24
|
+
const { View, Pressable } = (0, primitives_1.primitives)();
|
|
25
|
+
const capabilities = (0, GlassView_1.glassCapabilities)();
|
|
26
|
+
const EngineSwitch = (0, glass_routing_1.loadEngineControl)("Switch");
|
|
27
|
+
const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue);
|
|
28
|
+
const value = valueProp ?? internalValue;
|
|
31
29
|
const toggle = () => {
|
|
32
30
|
if (disabled)
|
|
33
31
|
return;
|
|
34
|
-
const next = !
|
|
32
|
+
const next = !value;
|
|
35
33
|
if (haptics)
|
|
36
34
|
(0, haptics_1.hapticSelection)();
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
const trackStyle = {
|
|
42
|
-
width: TRACK_WIDTH,
|
|
43
|
-
height: TRACK_HEIGHT,
|
|
44
|
-
borderRadius: TRACK_HEIGHT / 2,
|
|
45
|
-
backgroundColor: isChecked ? themeColors.fill : "rgba(120, 120, 128, 0.16)",
|
|
46
|
-
padding: 2,
|
|
47
|
-
justifyContent: "center",
|
|
48
|
-
opacity: disabled ? 0.38 : 1,
|
|
49
|
-
...style,
|
|
50
|
-
};
|
|
51
|
-
const thumbStyle = {
|
|
52
|
-
width: THUMB,
|
|
53
|
-
height: THUMB,
|
|
54
|
-
borderRadius: THUMB / 2,
|
|
55
|
-
backgroundColor: "#FFFFFF",
|
|
56
|
-
// A hairline edge instead of a drop shadow: RN shadows need per-platform
|
|
57
|
-
// props, and the edge reads correctly on a translucent track.
|
|
58
|
-
borderWidth: 0.5,
|
|
59
|
-
borderColor: "rgba(0, 0, 0, 0.12)",
|
|
60
|
-
transform: [{ translateX: animated ? offset : isChecked ? TRAVEL : 0 }],
|
|
35
|
+
if (valueProp === undefined)
|
|
36
|
+
setInternalValue(next);
|
|
37
|
+
onValueChange?.(next);
|
|
61
38
|
};
|
|
62
|
-
|
|
39
|
+
if (EngineSwitch && capabilities.supported) {
|
|
40
|
+
const EngineSwitchComponent = EngineSwitch;
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(EngineSwitchComponent, { value: value, onValueChange: disabled ? undefined : toggle, disabled: disabled, accentColor: accentColor, trackColor: trackColor, style: style }));
|
|
42
|
+
}
|
|
43
|
+
// Fallback floor: solid track + lens thumb, full geometry, full states.
|
|
44
|
+
const trackHeight = 28;
|
|
45
|
+
const thumbHeight = 24;
|
|
46
|
+
const thumbInset = 2;
|
|
47
|
+
const travel = 64 - 40 - thumbInset * 2;
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(Pressable, { ref: ref, testID: testID, accessibilityRole: "switch", accessibilityLabel: accessibilityLabel, accessibilityState: { checked: value, disabled }, disabled: disabled, onPress: disabled ? undefined : toggle, style: { alignSelf: "flex-start" }, ...props, children: (0, jsx_runtime_1.jsx)(View, { style: {
|
|
49
|
+
width: 64,
|
|
50
|
+
height: trackHeight,
|
|
51
|
+
borderRadius: trackHeight / 2,
|
|
52
|
+
backgroundColor: value ? accentColor ?? themeColors.fill : themeColors.fieldWash,
|
|
53
|
+
overflow: "hidden",
|
|
54
|
+
opacity: disabled ? 0.38 : 1,
|
|
55
|
+
}, children: (0, jsx_runtime_1.jsx)(View, { style: {
|
|
56
|
+
position: "absolute",
|
|
57
|
+
left: thumbInset,
|
|
58
|
+
top: (trackHeight - thumbHeight) / 2,
|
|
59
|
+
width: 40,
|
|
60
|
+
height: thumbHeight,
|
|
61
|
+
borderRadius: thumbHeight / 2,
|
|
62
|
+
backgroundColor: themeColors.onTint,
|
|
63
|
+
transform: [{ translateX: value ? travel : 0 }],
|
|
64
|
+
} }) }) }));
|
|
63
65
|
});
|
package/lib/module/TabBar.js
CHANGED
|
@@ -3,33 +3,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TabBar = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const glass_routing_1 = require("./internal/glass-routing");
|
|
7
|
+
const GlassView_1 = require("./internal/GlassView");
|
|
6
8
|
const Glass_1 = require("./Glass");
|
|
7
9
|
const tokens_1 = require("./internal/tokens");
|
|
8
10
|
const primitives_1 = require("./internal/primitives");
|
|
9
11
|
const motion_1 = require("./internal/motion");
|
|
10
12
|
const haptics_1 = require("./internal/haptics");
|
|
11
|
-
const
|
|
13
|
+
const lens_1 = require("./internal/lens");
|
|
14
|
+
// The web bar: a 40pt rail (32pt tabs in a 4pt inset) with a 20pt radius, a
|
|
15
|
+
// glass lens filling the active slot, and 13pt labels at 500/400 weight.
|
|
16
|
+
const BAR_HEIGHT = 40;
|
|
12
17
|
/**
|
|
13
18
|
* The bottom bar of an app: a row of tabs on one glass surface.
|
|
14
19
|
*
|
|
15
20
|
* The platform rule is the point of this component. On iOS 26+ the surface is
|
|
16
|
-
* Apple's real Liquid Glass (`UIGlassEffect` via
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
21
|
+
* Apple's real Liquid Glass (`UIGlassEffect` via the vendored engine) with
|
|
22
|
+
* Glacia's own items inside it; on older iOS and on Android it is Glacia's bar.
|
|
23
|
+
* The items are always our Pressables and Texts — no native tab bar is used on
|
|
24
|
+
* any platform.
|
|
25
|
+
*
|
|
26
|
+
* The port is the engine's `LiquidGlassTabBar` design, and it carries over
|
|
27
|
+
* session 1's safe-area behaviour: the bar floats fully above the system inset
|
|
28
|
+
* (the Android navigation bar or the iOS home indicator) — the safe-area bottom
|
|
29
|
+
* inset is added to the bar's height — so the glass ends above the inset rather
|
|
30
|
+
* than sinking into it and the labels never clip.
|
|
20
31
|
*/
|
|
21
|
-
exports.TabBar = (0, react_1.forwardRef)(function TabBar({ items, activeId: activeProp, defaultActiveId, onTabChange, haptics = true, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
32
|
+
exports.TabBar = (0, react_1.forwardRef)(function TabBar({ items, activeId: activeProp, defaultActiveId, onTabChange, haptics = true, style, isDark: isDarkProp, bottomInset, testID, ...props }, ref) {
|
|
22
33
|
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
23
34
|
const themeColors = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
24
|
-
const { View,
|
|
35
|
+
const { View, Pressable, Text: RNText, Animated } = (0, primitives_1.primitives)();
|
|
36
|
+
const capabilities = (0, GlassView_1.glassCapabilities)();
|
|
37
|
+
const EngineTabBar = (0, glass_routing_1.loadEngineControl)("TabBar");
|
|
25
38
|
const [internalId, setInternalId] = (0, react_1.useState)(defaultActiveId || items[0]?.id || "");
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
// The active wash slides between equally wide items on the springs token.
|
|
29
|
-
const { value: slide, animated } = (0, motion_1.useSpring)(activeIndex, "snappy");
|
|
39
|
+
const [held, setHeld] = (0, react_1.useState)(false);
|
|
40
|
+
const activeId = activeProp ?? internalId;
|
|
30
41
|
const handleSelect = (id) => {
|
|
31
|
-
|
|
32
|
-
if (haptics && id !== activeId)
|
|
42
|
+
if (haptics)
|
|
33
43
|
(0, haptics_1.hapticSelection)();
|
|
34
44
|
if (activeProp === undefined)
|
|
35
45
|
setInternalId(id);
|
|
@@ -39,51 +49,53 @@ exports.TabBar = (0, react_1.forwardRef)(function TabBar({ items, activeId: acti
|
|
|
39
49
|
flexDirection: "row",
|
|
40
50
|
alignItems: "center",
|
|
41
51
|
justifyContent: "space-around",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
// The bar floats fully above the system inset, so it is taller than its
|
|
53
|
+
// design height by the safe-area bottom inset. At zero inset it is exactly
|
|
54
|
+
// the design height.
|
|
55
|
+
height: BAR_HEIGHT + Math.max(bottomInset ?? 0, 0),
|
|
56
|
+
paddingHorizontal: 4,
|
|
57
|
+
borderRadius: tokens_1.radii.lg,
|
|
45
58
|
...style,
|
|
46
59
|
};
|
|
47
60
|
const count = Math.max(items.length, 1);
|
|
48
61
|
const itemWidth = `${100 / count}%`;
|
|
62
|
+
const activeIndex = Math.max(0, items.findIndex((tab) => tab.id === activeId));
|
|
49
63
|
const indicatorStyle = {
|
|
50
64
|
position: "absolute",
|
|
51
|
-
top:
|
|
52
|
-
bottom:
|
|
53
|
-
left:
|
|
65
|
+
top: 4,
|
|
66
|
+
bottom: 4,
|
|
67
|
+
left: 4,
|
|
54
68
|
width: itemWidth,
|
|
55
|
-
borderRadius: tokens_1.radii.
|
|
69
|
+
borderRadius: tokens_1.radii.pill,
|
|
56
70
|
backgroundColor: themeColors.glassActive,
|
|
57
71
|
opacity: 0.75,
|
|
72
|
+
...(0, lens_1.lensShadow)(isDark),
|
|
58
73
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
color: isActive ? themeColors.fill : themeColors.muted,
|
|
87
|
-
}, children: tab.label })] }, tab.id));
|
|
88
|
-
})] }));
|
|
74
|
+
const { value: offset, animated } = (0, motion_1.useSpring)(activeIndex, "snappy");
|
|
75
|
+
// ------------------------------------------------------------------
|
|
76
|
+
// Fallback floor: the same rail and lens pill, on the fallback material.
|
|
77
|
+
// ------------------------------------------------------------------
|
|
78
|
+
if (!(EngineTabBar && capabilities.supported)) {
|
|
79
|
+
return ((0, jsx_runtime_1.jsxs)(Glass_1.Glass, { ref: ref, effect: "regular", surface: "rail", pressed: held, isDark: isDark, style: barStyle, testID: testID, ...props, children: [animated ? ((0, jsx_runtime_1.jsx)(Animated.View, { pointerEvents: "none", style: { ...indicatorStyle, transform: [{ translateX: offset.interpolate({ inputRange: [0, Math.max(count - 1, 1)], outputRange: [0, `${((count - 1) * 100) / count}%`] }) }] }, children: (0, jsx_runtime_1.jsx)(lens_1.LensRim, { radius: tokens_1.radii.pill, isDark: isDark }) })) : ((0, jsx_runtime_1.jsx)(View, { pointerEvents: "none", style: { ...indicatorStyle, left: `${(activeIndex * 100) / count}%` }, children: (0, jsx_runtime_1.jsx)(lens_1.LensRim, { radius: tokens_1.radii.pill, isDark: isDark }) })), items.map((tab) => {
|
|
80
|
+
const isActive = tab.id === activeId;
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "tab", accessibilityLabel: tab.label, accessibilityState: { selected: isActive }, onPress: () => handleSelect(tab.id), onPressIn: () => setHeld(true), onPressOut: () => setHeld(false), style: {
|
|
82
|
+
flex: 1,
|
|
83
|
+
height: "100%",
|
|
84
|
+
flexDirection: "column",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
justifyContent: "center",
|
|
87
|
+
gap: 2,
|
|
88
|
+
paddingHorizontal: 8,
|
|
89
|
+
paddingVertical: 4,
|
|
90
|
+
}, children: [tab.icon ?? null, (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: { fontSize: 13, fontWeight: isActive ? "500" : "400", color: isActive ? themeColors.fill : themeColors.muted }, children: tab.label })] }, tab.id));
|
|
91
|
+
})] }));
|
|
92
|
+
}
|
|
93
|
+
const EngineTabBarComponent = EngineTabBar;
|
|
94
|
+
const tabs = items.map((item) => ({
|
|
95
|
+
key: item.id,
|
|
96
|
+
title: item.label,
|
|
97
|
+
icon: item.icon,
|
|
98
|
+
}));
|
|
99
|
+
const selectedIndex = Math.max(0, items.findIndex((item) => item.id === activeId));
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(EngineTabBarComponent, { tabs: tabs, selectedIndex: selectedIndex, onTabSelected: (index) => handleSelect(items[index]?.id ?? ""), accentColor: themeColors.fill, inactiveColor: themeColors.muted, tint: themeColors.glass, style: style, labelStyle: { fontSize: 13 } }));
|
|
89
101
|
});
|
package/lib/module/Tabs.js
CHANGED
|
@@ -21,6 +21,7 @@ exports.Tabs = (0, react_1.forwardRef)(function Tabs({ items, activeId: activePr
|
|
|
21
21
|
const themeColors = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
22
22
|
const { View, Text, Pressable, Animated } = (0, primitives_1.primitives)();
|
|
23
23
|
const [internalId, setInternalId] = (0, react_1.useState)(defaultActiveId || items[0]?.id || "");
|
|
24
|
+
const [held, setHeld] = (0, react_1.useState)(false);
|
|
24
25
|
const activeId = activeProp !== undefined ? activeProp : internalId;
|
|
25
26
|
const activeIndex = Math.max(0, items.findIndex((tab) => tab.id === activeId));
|
|
26
27
|
const { value: slide, animated } = (0, motion_1.useSpring)(activeIndex, "snappy");
|
|
@@ -43,7 +44,7 @@ exports.Tabs = (0, react_1.forwardRef)(function Tabs({ items, activeId: activePr
|
|
|
43
44
|
borderWidth: 0.5,
|
|
44
45
|
borderColor: themeColors.edge,
|
|
45
46
|
};
|
|
46
|
-
return ((0, jsx_runtime_1.jsxs)(Glass_1.Glass, { ref: ref, effect: "regular", isDark: isDark, style: {
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)(Glass_1.Glass, { ref: ref, effect: "regular", surface: "rail", pressed: held, isDark: isDark, style: {
|
|
47
48
|
flexDirection: "row",
|
|
48
49
|
alignItems: "center",
|
|
49
50
|
alignSelf: "flex-start",
|
|
@@ -63,7 +64,7 @@ exports.Tabs = (0, react_1.forwardRef)(function Tabs({ items, activeId: activePr
|
|
|
63
64
|
],
|
|
64
65
|
} })) : ((0, jsx_runtime_1.jsx)(View, { pointerEvents: "none", style: { ...paneStyle, left: `${(activeIndex * 100) / count}%` } })), items.map((tab) => {
|
|
65
66
|
const isActive = tab.id === activeId;
|
|
66
|
-
return ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "tab", accessibilityLabel: tab.label, accessibilityState: { selected: isActive }, onPress: () => handleSelect(tab.id), style: {
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "tab", accessibilityLabel: tab.label, accessibilityState: { selected: isActive }, onPress: () => handleSelect(tab.id), onPressIn: () => setHeld(true), onPressOut: () => setHeld(false), style: {
|
|
67
68
|
flex: 1,
|
|
68
69
|
height: 36,
|
|
69
70
|
flexDirection: "row",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Textarea = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// Wave 2 — Textarea.
|
|
6
|
+
//
|
|
7
|
+
// The donor's multiline field: the same label/description/error contract as a
|
|
8
|
+
// single-line input, `textAlignVertical: top`, and a height derived from `rows`.
|
|
9
|
+
// It is the family's Input with `multiline`, not a second control.
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const Input_1 = require("./Input");
|
|
12
|
+
exports.Textarea = (0, react_1.forwardRef)(function Textarea({ rows = 4, style, minLines, ...props }, ref) {
|
|
13
|
+
const own = { textAlignVertical: "top", minHeight: 22 * rows + 20 };
|
|
14
|
+
const flat = Array.isArray(style)
|
|
15
|
+
? Object.assign({}, own, ...style.filter(Boolean))
|
|
16
|
+
: Object.assign({}, own, style ?? {});
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(Input_1.Input, { ref: ref, multiline: true, minLines: minLines ?? rows, style: flat, ...{ rows }, ...props }));
|
|
18
|
+
});
|