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/Forms2.js
DELETED
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Combobox = exports.ColorPicker = exports.DEFAULT_PALETTE = exports.ButtonGroup = exports.InputOTP = exports.ToggleGroup = exports.Toggle = exports.Stepper = void 0;
|
|
4
|
-
exports.hexToRgb = hexToRgb;
|
|
5
|
-
exports.hueGradientColors = hueGradientColors;
|
|
6
|
-
exports.rgbToHex = rgbToHex;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const Glass_1 = require("./Glass");
|
|
10
|
-
const tokens_1 = require("./internal/tokens");
|
|
11
|
-
const primitives_1 = require("./internal/primitives");
|
|
12
|
-
const motion_1 = require("./internal/motion");
|
|
13
|
-
/**
|
|
14
|
-
* Minus / value / plus.
|
|
15
|
-
*
|
|
16
|
-
* The same interaction contract Slider established: `adjustable` with
|
|
17
|
-
* increment and decrement accessibility actions, and clamping at min and max
|
|
18
|
-
* rather than wrapping or drifting past the range.
|
|
19
|
-
*/
|
|
20
|
-
exports.Stepper = (0, react_1.forwardRef)(function Stepper({ value: valueProp, defaultValue = 0, onValueChange, min = 0, max = 100, step = 1, disabled = false, accessibilityLabel, formatValue, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
21
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
22
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
23
|
-
const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
|
|
24
|
-
const [internal, setInternal] = (0, react_1.useState)(defaultValue);
|
|
25
|
-
const value = valueProp !== undefined ? valueProp : internal;
|
|
26
|
-
const apply = (next) => {
|
|
27
|
-
const clamped = Math.min(Math.max(next, min), max);
|
|
28
|
-
if (clamped === value)
|
|
29
|
-
return;
|
|
30
|
-
if (valueProp === undefined)
|
|
31
|
-
setInternal(clamped);
|
|
32
|
-
onValueChange?.(clamped);
|
|
33
|
-
};
|
|
34
|
-
const atMin = value <= min;
|
|
35
|
-
const atMax = value >= max;
|
|
36
|
-
const stepButton = (label, sign, action, blocked) => ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { disabled: disabled || blocked }, disabled: disabled || blocked, onPress: action, style: { width: 36, height: 36, alignItems: "center", justifyContent: "center", opacity: disabled || blocked ? 0.38 : 1 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 20, fontWeight: "500", color: theme.foreground, lineHeight: 22 }, children: sign }) }));
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)(Glass_1.Glass, { ref: ref, effect: "regular", isDark: isDark, testID: testID, accessibilityRole: "adjustable", accessibilityLabel: accessibilityLabel, accessibilityValue: { min, max, now: value }, accessibilityActions: [{ name: "increment" }, { name: "decrement" }], onAccessibilityAction: (event) => {
|
|
38
|
-
const delta = event?.nativeEvent?.actionName === "increment" ? step : -step;
|
|
39
|
-
apply(value + delta);
|
|
40
|
-
}, style: {
|
|
41
|
-
flexDirection: "row",
|
|
42
|
-
alignItems: "center",
|
|
43
|
-
alignSelf: "flex-start",
|
|
44
|
-
borderRadius: tokens_1.radii.pill,
|
|
45
|
-
paddingHorizontal: 2,
|
|
46
|
-
opacity: disabled ? 0.38 : 1,
|
|
47
|
-
...style,
|
|
48
|
-
}, ...props, children: [stepButton(`Decrease ${accessibilityLabel}`, "\u2212", () => apply(value - step), atMin), (0, jsx_runtime_1.jsx)(View, { style: { minWidth: 44, alignItems: "center", justifyContent: "center" }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 16, fontWeight: "600", color: theme.foreground }, numberOfLines: 1, children: formatValue ? formatValue(value) : String(value) }) }), stepButton(`Increase ${accessibilityLabel}`, "+", () => apply(value + step), atMax)] }));
|
|
49
|
-
});
|
|
50
|
-
const toggleSizes = { sm: 30, md: 36, lg: 44 };
|
|
51
|
-
/**
|
|
52
|
-
* A button that stays pressed.
|
|
53
|
-
*
|
|
54
|
-
* Distinct from Switch: this is a button with an on-state (bold, favourite,
|
|
55
|
-
* pinned), not a setting. It reports `selected`, which is what web's Toggle
|
|
56
|
-
* announces.
|
|
57
|
-
*/
|
|
58
|
-
exports.Toggle = (0, react_1.forwardRef)(function Toggle({ pressed: pressedProp, defaultPressed = false, onPressedChange, selected, icon, children, variant = "glass", size = "md", disabled = false, accessibilityLabel, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
59
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
60
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
61
|
-
const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
|
|
62
|
-
// `selected` is accepted as an alias so the controlled prop matches web.
|
|
63
|
-
const controlled = pressedProp !== undefined ? pressedProp : selected;
|
|
64
|
-
const [internal, setInternal] = (0, react_1.useState)(defaultPressed);
|
|
65
|
-
const isPressed = controlled !== undefined ? controlled : internal;
|
|
66
|
-
const dimension = toggleSizes[size];
|
|
67
|
-
const handlePress = () => {
|
|
68
|
-
const next = !isPressed;
|
|
69
|
-
if (controlled === undefined)
|
|
70
|
-
setInternal(next);
|
|
71
|
-
onPressedChange?.(next);
|
|
72
|
-
};
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(Pressable, { ref: ref, testID: testID, accessibilityRole: "button", accessibilityLabel: accessibilityLabel ?? (typeof children === "string" ? children : undefined), accessibilityState: { selected: isPressed, disabled }, disabled: disabled, onPress: handlePress, style: ({ pressed }) => ({ alignSelf: "flex-start", opacity: disabled ? 0.38 : pressed ? 0.8 : 1 }), ...props, children: (0, jsx_runtime_1.jsxs)(Glass_1.Glass, { effect: variant === "ghost" ? "none" : "regular", interactive: !disabled && variant !== "ghost", isDark: isDark, tintColor: isPressed && variant !== "ghost" ? theme.glassActive : undefined, style: {
|
|
74
|
-
height: dimension,
|
|
75
|
-
borderRadius: tokens_1.radii.pill,
|
|
76
|
-
paddingHorizontal: icon && !children ? 0 : 12,
|
|
77
|
-
width: icon && !children ? dimension : undefined,
|
|
78
|
-
flexDirection: "row",
|
|
79
|
-
alignItems: "center",
|
|
80
|
-
justifyContent: "center",
|
|
81
|
-
gap: 6,
|
|
82
|
-
backgroundColor: variant === "ghost" ? "transparent" : undefined,
|
|
83
|
-
...style,
|
|
84
|
-
}, children: [icon ? (0, jsx_runtime_1.jsx)(View, { children: icon }) : null, typeof children === "string" ? ((0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: {
|
|
85
|
-
fontSize: size === "sm" ? 12 : size === "lg" ? 15 : 13,
|
|
86
|
-
fontWeight: isPressed ? "600" : "500",
|
|
87
|
-
color: isPressed ? theme.foreground : theme.muted,
|
|
88
|
-
}, children: children })) : (children)] }) }));
|
|
89
|
-
});
|
|
90
|
-
/**
|
|
91
|
-
* A row of toggles acting as one choice.
|
|
92
|
-
*
|
|
93
|
-
* Built from the same pieces as SegmentedControl — one glass container, toggles
|
|
94
|
-
* inside it, `glassActive` marking the active ones — but each item carries the
|
|
95
|
-
* button styling of Toggle.
|
|
96
|
-
*/
|
|
97
|
-
exports.ToggleGroup = (0, react_1.forwardRef)(function ToggleGroup({ items, multiple = false, value: valueProp, defaultValue, onValueChange, size = "md", disabled = false, accessibilityLabel = "Toggle group", style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
98
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
99
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
100
|
-
const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
|
|
101
|
-
const initial = defaultValue ?? (multiple ? [] : "");
|
|
102
|
-
const [internal, setInternal] = (0, react_1.useState)(initial);
|
|
103
|
-
const selection = valueProp !== undefined ? valueProp : internal;
|
|
104
|
-
const isOn = (value) => Array.isArray(selection) ? selection.includes(value) : selection === value;
|
|
105
|
-
const toggle = (value) => {
|
|
106
|
-
let next;
|
|
107
|
-
if (multiple) {
|
|
108
|
-
const current = Array.isArray(selection) ? selection : [];
|
|
109
|
-
next = current.includes(value) ? current.filter((v) => v !== value) : [...current, value];
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
// Single mode: the same item pressed again clears it, as Toggle does.
|
|
113
|
-
next = selection === value ? "" : value;
|
|
114
|
-
}
|
|
115
|
-
if (valueProp === undefined)
|
|
116
|
-
setInternal(next);
|
|
117
|
-
onValueChange?.(next);
|
|
118
|
-
};
|
|
119
|
-
const height = size === "sm" ? 30 : size === "lg" ? 42 : 36;
|
|
120
|
-
return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { ref: ref, effect: "regular", isDark: isDark, testID: testID, accessibilityRole: "radiogroup", accessibilityLabel: accessibilityLabel, style: {
|
|
121
|
-
flexDirection: "row",
|
|
122
|
-
alignItems: "center",
|
|
123
|
-
alignSelf: "flex-start",
|
|
124
|
-
padding: 3,
|
|
125
|
-
gap: 3,
|
|
126
|
-
borderRadius: tokens_1.radii.pill,
|
|
127
|
-
...style,
|
|
128
|
-
}, ...props, children: items.map((item) => {
|
|
129
|
-
const on = isOn(item.value);
|
|
130
|
-
return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: item.label, accessibilityState: { selected: on, disabled }, disabled: disabled, onPress: () => toggle(item.value), style: { opacity: disabled ? 0.38 : 1 }, children: (0, jsx_runtime_1.jsxs)(View, { style: {
|
|
131
|
-
height: height - 6,
|
|
132
|
-
paddingHorizontal: 14,
|
|
133
|
-
borderRadius: tokens_1.radii.pill,
|
|
134
|
-
flexDirection: "row",
|
|
135
|
-
alignItems: "center",
|
|
136
|
-
justifyContent: "center",
|
|
137
|
-
gap: 6,
|
|
138
|
-
backgroundColor: on ? theme.glassActive : "transparent",
|
|
139
|
-
borderWidth: on ? 0.5 : 0,
|
|
140
|
-
borderColor: theme.edge,
|
|
141
|
-
}, children: [item.icon ? (0, jsx_runtime_1.jsx)(View, { children: item.icon }) : null, (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: { fontSize: 13, fontWeight: on ? "600" : "500", color: on ? theme.foreground : theme.muted }, children: item.label })] }) }, item.value));
|
|
142
|
-
}) }));
|
|
143
|
-
});
|
|
144
|
-
/**
|
|
145
|
-
* A verification-code row.
|
|
146
|
-
*
|
|
147
|
-
* One real text field drives the boxes. Keeping a single field — rather than N
|
|
148
|
-
* inputs — is what makes paste and autofill fill every box in one go, and it is
|
|
149
|
-
* what keeps the caret and keyboard behaviour sane across platforms.
|
|
150
|
-
*/
|
|
151
|
-
exports.InputOTP = (0, react_1.forwardRef)(function InputOTP({ value: valueProp, defaultValue = "", onChange, onComplete, length = 6, disabled = false, accessibilityLabel = "Verification code", style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
152
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
153
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
154
|
-
const { View, Text: RNText, TextInput } = (0, primitives_1.primitives)();
|
|
155
|
-
const [internal, setInternal] = (0, react_1.useState)(defaultValue);
|
|
156
|
-
const value = valueProp !== undefined ? valueProp : internal;
|
|
157
|
-
// The code is digits only, and never longer than the boxes available.
|
|
158
|
-
const normalise = (raw) => raw.replace(/[^0-9]/g, "").slice(0, length);
|
|
159
|
-
const handleChange = (raw) => {
|
|
160
|
-
const next = normalise(raw);
|
|
161
|
-
if (valueProp === undefined)
|
|
162
|
-
setInternal(next);
|
|
163
|
-
onChange?.(next);
|
|
164
|
-
if (next.length === length)
|
|
165
|
-
onComplete?.(next);
|
|
166
|
-
};
|
|
167
|
-
const focusedIndex = Math.min(value.length, length - 1);
|
|
168
|
-
return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, style: [{ flexDirection: "row", alignItems: "center", gap: 8, alignSelf: "flex-start" }, style], ...props, children: [Array.from({ length }, (_, index) => {
|
|
169
|
-
const char = value[index] ?? "";
|
|
170
|
-
const isActive = index === focusedIndex && !disabled;
|
|
171
|
-
return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { effect: "regular", isDark: isDark, tintColor: isActive ? theme.glassActive : undefined, style: {
|
|
172
|
-
width: 44,
|
|
173
|
-
height: 52,
|
|
174
|
-
borderRadius: tokens_1.radii.md,
|
|
175
|
-
alignItems: "center",
|
|
176
|
-
justifyContent: "center",
|
|
177
|
-
borderColor: isActive ? theme.fill : theme.edge,
|
|
178
|
-
opacity: disabled ? 0.38 : 1,
|
|
179
|
-
}, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 22, fontWeight: "600", color: theme.foreground }, children: char }) }, index));
|
|
180
|
-
}), (0, jsx_runtime_1.jsx)(TextInput, { accessibilityRole: "text", accessibilityLabel: accessibilityLabel, accessibilityValue: { text: value }, value: value, onChangeText: handleChange, editable: !disabled, keyboardType: "number-pad", maxLength: length, textContentType: "oneTimeCode", autoComplete: "one-time-code", style: {
|
|
181
|
-
position: "absolute",
|
|
182
|
-
left: 0,
|
|
183
|
-
right: 0,
|
|
184
|
-
top: 0,
|
|
185
|
-
bottom: 0,
|
|
186
|
-
// Invisible but present: the boxes are the visible representation.
|
|
187
|
-
opacity: 0.02,
|
|
188
|
-
color: "transparent",
|
|
189
|
-
} })] }));
|
|
190
|
-
});
|
|
191
|
-
/**
|
|
192
|
-
* A connected row of buttons.
|
|
193
|
-
*
|
|
194
|
-
* Stateless by design: it reports presses and holds no selection, which is what
|
|
195
|
-
* separates it from SegmentedControl (a stateful choice) and ToggleGroup.
|
|
196
|
-
*/
|
|
197
|
-
exports.ButtonGroup = (0, react_1.forwardRef)(function ButtonGroup({ items, size = "md", variant = "attached", onItemPress, accessibilityLabel, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
198
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
199
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
200
|
-
const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
|
|
201
|
-
const height = size === "sm" ? 32 : size === "lg" ? 46 : 40;
|
|
202
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "group", accessibilityLabel: accessibilityLabel, style: {
|
|
203
|
-
flexDirection: "row",
|
|
204
|
-
alignSelf: "flex-start",
|
|
205
|
-
gap: variant === "segmented" ? 6 : 0,
|
|
206
|
-
...style,
|
|
207
|
-
}, ...props, children: items.map((item, index) => {
|
|
208
|
-
const first = index === 0;
|
|
209
|
-
const last = index === items.length - 1;
|
|
210
|
-
// Attached buttons share edges: only the outer corners are rounded,
|
|
211
|
-
// and the inner edges stay square so the group reads as one control.
|
|
212
|
-
const pill = variant === "segmented" ? tokens_1.radii.pill : 0;
|
|
213
|
-
return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: item.label, accessibilityState: { disabled: item.disabled }, disabled: item.disabled, onPress: () => {
|
|
214
|
-
item.onPress();
|
|
215
|
-
onItemPress?.(item, index);
|
|
216
|
-
}, style: ({ pressed }) => ({
|
|
217
|
-
opacity: item.disabled ? 0.38 : pressed ? 0.85 : 1,
|
|
218
|
-
}), children: (0, jsx_runtime_1.jsx)(Glass_1.Glass, { effect: "regular", interactive: !item.disabled, isDark: isDark, style: {
|
|
219
|
-
height,
|
|
220
|
-
paddingHorizontal: 18,
|
|
221
|
-
justifyContent: "center",
|
|
222
|
-
alignItems: "center",
|
|
223
|
-
borderRadius: variant === "segmented" ? pill : undefined,
|
|
224
|
-
borderTopLeftRadius: variant === "segmented" ? pill : first ? tokens_1.radii.md : 0,
|
|
225
|
-
borderBottomLeftRadius: variant === "segmented" ? pill : first ? tokens_1.radii.md : 0,
|
|
226
|
-
borderTopRightRadius: variant === "segmented" ? pill : last ? tokens_1.radii.md : 0,
|
|
227
|
-
borderBottomRightRadius: variant === "segmented" ? pill : last ? tokens_1.radii.md : 0,
|
|
228
|
-
}, children: (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: { fontSize: size === "sm" ? 13 : 14, fontWeight: "500", color: theme.foreground }, children: item.label }) }) }, `${item.label}-${index}`));
|
|
229
|
-
}) }));
|
|
230
|
-
});
|
|
231
|
-
/**
|
|
232
|
-
* A colour picker built from Glacia's own parts — no native widget.
|
|
233
|
-
*
|
|
234
|
-
* The palette is a grid of swatches from the caller's colours; the custom row
|
|
235
|
-
* is a hue track drawn as an SVG gradient (the resolver's shapes, so it works
|
|
236
|
-
* wherever the charts work) driven by the same Slider mechanics as the rest of
|
|
237
|
-
* the library: a drag along the track picks a hue, and a second track saturates
|
|
238
|
-
* it. The value is a hex string.
|
|
239
|
-
*
|
|
240
|
-
* The default palette is a small set of iOS-conventional colours, in case a
|
|
241
|
-
* caller wants a picker with no colour knowledge of its own.
|
|
242
|
-
*/
|
|
243
|
-
exports.DEFAULT_PALETTE = tokens_1.palette.default;
|
|
244
|
-
/** Parses a hex colour into its red, green and blue channels. */
|
|
245
|
-
function hexToRgb(hex) {
|
|
246
|
-
const match = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
|
|
247
|
-
if (!match)
|
|
248
|
-
return null;
|
|
249
|
-
const raw = match[1];
|
|
250
|
-
return {
|
|
251
|
-
r: parseInt(raw.slice(0, 2), 16),
|
|
252
|
-
g: parseInt(raw.slice(2, 4), 16),
|
|
253
|
-
b: parseInt(raw.slice(4, 6), 16),
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
/** Builds a hue gradient's colours, sweeping red → orange → … → red. */
|
|
257
|
-
function hueGradientColors() {
|
|
258
|
-
const stops = 12;
|
|
259
|
-
return Array.from({ length: stops }, (_u, i) => {
|
|
260
|
-
const angle = (i / stops) * 360;
|
|
261
|
-
const c = hslToRgb(angle, 1, 0.5);
|
|
262
|
-
return `#${c.r.toString(16).padStart(2, "0")}${c.g.toString(16).padStart(2, "0")}${c.b.toString(16).padStart(2, "0")}`;
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
/** Converts an HSL triple (h 0–360, s/l 0–1) to an RGB hex string. */
|
|
266
|
-
function hslToRgb(h, s, l) {
|
|
267
|
-
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
268
|
-
const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
|
|
269
|
-
const m = l - c / 2;
|
|
270
|
-
let r = 0, g = 0, b = 0;
|
|
271
|
-
if (h < 60) {
|
|
272
|
-
r = c;
|
|
273
|
-
g = x;
|
|
274
|
-
}
|
|
275
|
-
else if (h < 120) {
|
|
276
|
-
r = x;
|
|
277
|
-
g = c;
|
|
278
|
-
}
|
|
279
|
-
else if (h < 180) {
|
|
280
|
-
g = c;
|
|
281
|
-
b = x;
|
|
282
|
-
}
|
|
283
|
-
else if (h < 240) {
|
|
284
|
-
g = x;
|
|
285
|
-
b = c;
|
|
286
|
-
}
|
|
287
|
-
else if (h < 300) {
|
|
288
|
-
r = x;
|
|
289
|
-
b = c;
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
r = c;
|
|
293
|
-
b = x;
|
|
294
|
-
}
|
|
295
|
-
return {
|
|
296
|
-
r: Math.round((r + m) * 255),
|
|
297
|
-
g: Math.round((g + m) * 255),
|
|
298
|
-
b: Math.round((b + m) * 255),
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
/** Converts an RGB triple to a hex string. */
|
|
302
|
-
function rgbToHex(r, g, b) {
|
|
303
|
-
const clamp = (n) => Math.max(0, Math.min(255, Math.round(n)));
|
|
304
|
-
return `#${clamp(r).toString(16).padStart(2, "0")}${clamp(g).toString(16).padStart(2, "0")}${clamp(b).toString(16).padStart(2, "0")}`;
|
|
305
|
-
}
|
|
306
|
-
exports.ColorPicker = (0, react_1.forwardRef)(function ColorPicker({ colors: palette, value, defaultValue, onChange, size = "md", columns = 6, allowCustom = true, disabled = false, accessibilityLabel = "Color", style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
307
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
308
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
309
|
-
const { View, Pressable, Text: RNText, PanResponder, Svg, Rect, Defs, LinearGradient, Stop } = (0, primitives_1.primitives)();
|
|
310
|
-
const swatches = palette && palette.length > 0 ? palette : exports.DEFAULT_PALETTE;
|
|
311
|
-
const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue ?? swatches[0] ?? tokens_1.palette.fallback);
|
|
312
|
-
const activeColor = value !== undefined ? value : internalValue;
|
|
313
|
-
const setColor = (next) => {
|
|
314
|
-
if (disabled)
|
|
315
|
-
return;
|
|
316
|
-
if (value === undefined)
|
|
317
|
-
setInternalValue(next);
|
|
318
|
-
onChange?.(next);
|
|
319
|
-
};
|
|
320
|
-
// The custom row's two tracks: hue on the top, saturation on the bottom.
|
|
321
|
-
// Both are driven by PanResponder like the library's Slider — a press or a
|
|
322
|
-
// drag along a track reports the colour at that position.
|
|
323
|
-
const trackRef = (0, react_1.useRef)(0);
|
|
324
|
-
const swatchSize = tokens_1.controlSizes.swatch[size];
|
|
325
|
-
const hueColor = (h) => {
|
|
326
|
-
const c = hslToRgb(h, 1, 0.5);
|
|
327
|
-
return rgbToHex(c.r, c.g, c.b);
|
|
328
|
-
};
|
|
329
|
-
const colorAtFraction = (fraction, hue) => {
|
|
330
|
-
const sat = Math.max(0, Math.min(1, fraction));
|
|
331
|
-
const c = hslToRgb(hue, sat, 0.5);
|
|
332
|
-
return rgbToHex(c.r, c.g, c.b);
|
|
333
|
-
};
|
|
334
|
-
const hue = hexToRgb(activeColor) ? hueOf(activeColor) : 0;
|
|
335
|
-
const hueResponder = makeTrackResponder((fraction) => {
|
|
336
|
-
setColor(hueColor(fraction * 360));
|
|
337
|
-
}, PanResponder, trackRef);
|
|
338
|
-
const satResponder = makeTrackResponder((fraction) => {
|
|
339
|
-
setColor(colorAtFraction(fraction, hue));
|
|
340
|
-
}, PanResponder, trackRef);
|
|
341
|
-
const hueGradient = hueGradientColors();
|
|
342
|
-
return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, accessibilityRole: "adjustable", accessibilityLabel: accessibilityLabel, accessibilityValue: { text: activeColor }, style: { gap: 12, opacity: disabled ? 0.38 : 1, ...style }, ...props, children: [(0, jsx_runtime_1.jsx)(View, { style: { flexDirection: "row", flexWrap: "wrap", gap: 8 }, children: swatches.map((swatch, index) => {
|
|
343
|
-
const selected = swatch.toLowerCase() === activeColor.toLowerCase();
|
|
344
|
-
return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${swatch} color`, accessibilityState: { selected }, disabled: disabled, onPress: () => setColor(swatch), style: {
|
|
345
|
-
width: swatchSize,
|
|
346
|
-
height: swatchSize,
|
|
347
|
-
borderRadius: swatchSize / 2,
|
|
348
|
-
backgroundColor: swatch,
|
|
349
|
-
borderWidth: selected ? 2 : 0.5,
|
|
350
|
-
borderColor: selected ? theme.fill : theme.separator,
|
|
351
|
-
} }, `${swatch}-${index}`));
|
|
352
|
-
}) }), allowCustom ? ((0, jsx_runtime_1.jsxs)(View, { style: { gap: 8 }, children: [(0, jsx_runtime_1.jsx)(View, { style: { height: tokens_1.controlSizes.picker.track, borderRadius: tokens_1.radii.md, overflow: "hidden" }, ...(hueResponder ? hueResponder.panHandlers : {}), children: (0, jsx_runtime_1.jsxs)(Svg, { width: "100%", height: "100%", children: [(0, jsx_runtime_1.jsx)(Defs, { children: (0, jsx_runtime_1.jsx)(LinearGradient, { id: "hueGradient", x1: "0", y1: "0", x2: "1", y2: "0", children: hueGradient.map((color, i) => ((0, jsx_runtime_1.jsx)(Stop, { offset: i / (hueGradient.length - 1), stopColor: color }, i))) }) }), (0, jsx_runtime_1.jsx)(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: "url(#hueGradient)" })] }) }), (0, jsx_runtime_1.jsx)(View, { style: { height: tokens_1.controlSizes.picker.track, borderRadius: tokens_1.radii.md, overflow: "hidden" }, ...(satResponder ? satResponder.panHandlers : {}), children: (0, jsx_runtime_1.jsxs)(Svg, { width: "100%", height: "100%", children: [(0, jsx_runtime_1.jsx)(Defs, { children: (0, jsx_runtime_1.jsxs)(LinearGradient, { id: "satGradient", x1: "0", y1: "0", x2: "1", y2: "0", children: [(0, jsx_runtime_1.jsx)(Stop, { offset: "0", stopColor: theme.neutralTop }), (0, jsx_runtime_1.jsx)(Stop, { offset: "1", stopColor: hueColor(hue) })] }) }), (0, jsx_runtime_1.jsx)(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: "url(#satGradient)" })] }) }), (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 12, color: theme.muted }, children: activeColor })] })) : null] }));
|
|
353
|
-
});
|
|
354
|
-
/** The hue (0–360) of a hex colour. */
|
|
355
|
-
function hueOf(hex) {
|
|
356
|
-
const rgb = hexToRgb(hex);
|
|
357
|
-
if (!rgb)
|
|
358
|
-
return 0;
|
|
359
|
-
const { r, g, b } = rgb;
|
|
360
|
-
const max = Math.max(r, g, b) / 255;
|
|
361
|
-
const min = Math.min(r, g, b) / 255;
|
|
362
|
-
const delta = max - min;
|
|
363
|
-
if (delta === 0)
|
|
364
|
-
return 0;
|
|
365
|
-
let h = 0;
|
|
366
|
-
if (max === r / 255)
|
|
367
|
-
h = ((g / 255 - b / 255) / delta) % 6;
|
|
368
|
-
else if (max === g / 255)
|
|
369
|
-
h = (b / 255 - r / 255) / delta + 2;
|
|
370
|
-
else
|
|
371
|
-
h = (r / 255 - g / 255) / delta + 4;
|
|
372
|
-
const degrees = h * 60;
|
|
373
|
-
return degrees < 0 ? degrees + 360 : degrees;
|
|
374
|
-
}
|
|
375
|
-
/** Builds a PanResponder that reports the fraction (0–1) across a track. */
|
|
376
|
-
function makeTrackResponder(onFraction, PanResponder, trackRef) {
|
|
377
|
-
if (!PanResponder?.create)
|
|
378
|
-
return null;
|
|
379
|
-
return PanResponder.create({
|
|
380
|
-
onStartShouldSetPanResponder: () => true,
|
|
381
|
-
onMoveShouldSetPanResponder: () => true,
|
|
382
|
-
onPanResponderGrant: (event) => {
|
|
383
|
-
const fraction = fractionAt(event, 100);
|
|
384
|
-
if (fraction !== null)
|
|
385
|
-
onFraction(fraction);
|
|
386
|
-
},
|
|
387
|
-
onPanResponderMove: (event) => {
|
|
388
|
-
const fraction = fractionAt(event, 100);
|
|
389
|
-
if (fraction !== null)
|
|
390
|
-
onFraction(fraction);
|
|
391
|
-
},
|
|
392
|
-
onPanResponderTerminationRequest: () => false,
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
/** The fraction of the track under a touch, from the touch's X. */
|
|
396
|
-
function fractionAt(event, fallbackWidth) {
|
|
397
|
-
const x = event?.nativeEvent?.locationX;
|
|
398
|
-
const width = event?.nativeEvent?.layoutMeasurement?.width ?? fallbackWidth;
|
|
399
|
-
if (typeof x !== "number" || typeof width !== "number" || width <= 0)
|
|
400
|
-
return null;
|
|
401
|
-
return Math.max(0, Math.min(1, x / width));
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* A type-to-search select.
|
|
405
|
-
*
|
|
406
|
-
* The Input patterns (real TextInput, themed placeholder, `value`/`defaultValue`)
|
|
407
|
-
* open a Menu-style glass dropdown whose list filters as the user types — every
|
|
408
|
-
* keystroke re-filters the options, so the visible set genuinely shrinks, never
|
|
409
|
-
* a list that stays put and pretends to search.
|
|
410
|
-
*
|
|
411
|
-
* The filter is a case-insensitive substring match on label and description. An
|
|
412
|
-
* empty result shows an explicit empty row, so the user sees a search that found
|
|
413
|
-
* nothing rather than a list that silently went blank. The dropdown stays open
|
|
414
|
-
* until an option is picked or the field loses focus.
|
|
415
|
-
*/
|
|
416
|
-
exports.Combobox = (0, react_1.forwardRef)(function Combobox({ options, value, defaultValue, onChange, label, placeholder = "Search…", disabled = false, onEmpty, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
417
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
418
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
419
|
-
const { View, TextInput, Text: RNText, Pressable } = (0, primitives_1.primitives)();
|
|
420
|
-
const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue ?? "");
|
|
421
|
-
const [query, setQuery] = (0, react_1.useState)("");
|
|
422
|
-
const selected = value !== undefined ? value : internalValue;
|
|
423
|
-
const selectedLabel = (options ?? []).find((option) => option.value === selected)?.label ?? "";
|
|
424
|
-
const setValue = (next) => {
|
|
425
|
-
if (disabled)
|
|
426
|
-
return;
|
|
427
|
-
if (value === undefined)
|
|
428
|
-
setInternalValue(next);
|
|
429
|
-
onChange?.(next);
|
|
430
|
-
};
|
|
431
|
-
// Filter as the user types.
|
|
432
|
-
// An option list that has not loaded yet is empty, not a crash: a combobox
|
|
433
|
-
// is frequently rendered before its options arrive.
|
|
434
|
-
const available = options ?? [];
|
|
435
|
-
const needle = query.trim().toLowerCase();
|
|
436
|
-
const matches = needle.length === 0
|
|
437
|
-
? available
|
|
438
|
-
: available.filter((option) => option.label.toLowerCase().includes(needle) ||
|
|
439
|
-
(option.description ?? "").toLowerCase().includes(needle));
|
|
440
|
-
return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, style: { ...style }, children: [(0, jsx_runtime_1.jsx)(TextInput, { value: query, onChangeText: (text) => setQuery(text), placeholder: placeholder, accessibilityLabel: label ?? placeholder, accessibilityState: { disabled }, editable: !disabled, style: {
|
|
441
|
-
borderRadius: tokens_1.radii.md,
|
|
442
|
-
paddingHorizontal: 12,
|
|
443
|
-
paddingVertical: 8,
|
|
444
|
-
fontSize: 16,
|
|
445
|
-
color: theme.foreground,
|
|
446
|
-
backgroundColor: disabled ? theme.muted : theme.fieldWash,
|
|
447
|
-
} }), query.length > 0 ? ((0, jsx_runtime_1.jsx)(View, { style: { marginTop: 6, borderRadius: tokens_1.radii.md, overflow: "hidden", backgroundColor: disabled ? theme.muted : theme.glass }, children: matches.length === 0 ? ((0, jsx_runtime_1.jsx)(View, { style: { paddingHorizontal: 12, paddingVertical: 10 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 14, color: theme.muted }, children: "No matches" }) })) : (matches.map((option, index) => {
|
|
448
|
-
const isSelected = option.value === selected;
|
|
449
|
-
return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: option.label, accessibilityState: { selected: isSelected }, onPress: () => {
|
|
450
|
-
setValue(option.value);
|
|
451
|
-
setQuery("");
|
|
452
|
-
}, style: { flexDirection: "row", alignItems: "center", paddingHorizontal: 12, paddingVertical: 10, backgroundColor: isSelected ? theme.glassActive : "transparent" }, children: (0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 15, color: theme.foreground }, children: option.label }), option.description ? ((0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 12, color: theme.muted }, numberOfLines: 1, children: option.description })) : null] }) }, `${option.value}-${index}`));
|
|
453
|
-
})) })) : null] }));
|
|
454
|
-
});
|
package/lib/module/Message.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Message = exports.MessageAttachment = exports.MessageBubble = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const Display_1 = require("./Display");
|
|
7
|
-
const tokens_1 = require("./internal/tokens");
|
|
8
|
-
const primitives_1 = require("./internal/primitives");
|
|
9
|
-
const motion_1 = require("./internal/motion");
|
|
10
|
-
/**
|
|
11
|
-
* One message's bubble.
|
|
12
|
-
*
|
|
13
|
-
* Both directions are flat tints, not glass: a chat transcript is a long
|
|
14
|
-
* scrolling list, and glass under every line would stack translucent surfaces
|
|
15
|
-
* over each other and over the conversation behind them. The glass in a chat
|
|
16
|
-
* belongs to the composer, which floats over the transcript — so
|
|
17
|
-
* `NativeAIInput` is glass and the bubbles are not.
|
|
18
|
-
*
|
|
19
|
-
* Incoming messages take the theme's wash; outgoing take `glassActive`, the
|
|
20
|
-
* same tint the library uses for any selected surface, so a transcript reads
|
|
21
|
-
* consistently with the rest of Glacia.
|
|
22
|
-
*/
|
|
23
|
-
exports.MessageBubble = (0, react_1.forwardRef)(function MessageBubble({ outgoing = false, children, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
24
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
25
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
26
|
-
const { View } = (0, primitives_1.primitives)();
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, style: {
|
|
28
|
-
alignSelf: outgoing ? "flex-end" : "flex-start",
|
|
29
|
-
maxWidth: "82%",
|
|
30
|
-
paddingHorizontal: 12,
|
|
31
|
-
paddingVertical: 8,
|
|
32
|
-
borderRadius: tokens_1.radii.lg,
|
|
33
|
-
backgroundColor: outgoing ? theme.glassActive : theme.wash,
|
|
34
|
-
...style,
|
|
35
|
-
}, ...props, children: children }));
|
|
36
|
-
});
|
|
37
|
-
/**
|
|
38
|
-
* A file chip for a message.
|
|
39
|
-
*
|
|
40
|
-
* A flat, bordered chip rather than a glass one, for the same reason the
|
|
41
|
-
* bubbles are flat: it sits inside a bubble or beside one, and glass inside
|
|
42
|
-
* glass is never allowed. The size is a caller-formatted string — byte
|
|
43
|
-
* formatting belongs to the app's locale, not to a component library.
|
|
44
|
-
*/
|
|
45
|
-
exports.MessageAttachment = (0, react_1.forwardRef)(function MessageAttachment({ name, size, icon, onPress, disabled = false, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
46
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
47
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
48
|
-
const { View, Text, Pressable } = (0, primitives_1.primitives)();
|
|
49
|
-
const body = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon ? (0, jsx_runtime_1.jsx)(View, { style: { marginRight: 8 }, children: icon }) : null, (0, jsx_runtime_1.jsxs)(View, { style: { flexShrink: 1 }, children: [(0, jsx_runtime_1.jsx)(Text, { numberOfLines: 1, style: { fontSize: 14, color: theme.foreground }, children: name }), size ? ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted }, children: size })) : null] })] }));
|
|
50
|
-
const chipStyle = {
|
|
51
|
-
flexDirection: "row",
|
|
52
|
-
alignItems: "center",
|
|
53
|
-
paddingHorizontal: 10,
|
|
54
|
-
paddingVertical: 7,
|
|
55
|
-
borderRadius: tokens_1.radii.md,
|
|
56
|
-
backgroundColor: theme.wash,
|
|
57
|
-
borderWidth: 0.5,
|
|
58
|
-
borderColor: theme.separator,
|
|
59
|
-
opacity: disabled ? 0.38 : 1,
|
|
60
|
-
...style,
|
|
61
|
-
};
|
|
62
|
-
if (!onPress) {
|
|
63
|
-
return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "text", accessibilityLabel: size ? `${name}, ${size}` : name, style: chipStyle, ...props, children: body }));
|
|
64
|
-
}
|
|
65
|
-
return ((0, jsx_runtime_1.jsx)(Pressable, { ref: ref, testID: testID, accessibilityRole: "button", accessibilityLabel: size ? `${name}, ${size}` : name, accessibilityState: { disabled }, disabled: disabled, onPress: onPress, style: chipStyle, ...props, children: body }));
|
|
66
|
-
});
|
|
67
|
-
/**
|
|
68
|
-
* A whole message: who sent it, when, and what they said.
|
|
69
|
-
*
|
|
70
|
-
* The row every chat screen builds by hand — an avatar, a name and time line,
|
|
71
|
-
* and the content under it. Grouping it means the alignment, spacing and
|
|
72
|
-
* accessibility grouping are decided once: the row is announced as a single
|
|
73
|
-
* message (name, time, content) rather than as three unrelated pieces of text.
|
|
74
|
-
*/
|
|
75
|
-
exports.Message = (0, react_1.forwardRef)(function Message({ name, time, avatar = false, outgoing = false, children, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
76
|
-
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
77
|
-
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
78
|
-
const { View, Text } = (0, primitives_1.primitives)();
|
|
79
|
-
const meta = [name, time].filter(Boolean).join(", ");
|
|
80
|
-
return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, accessibilityRole: "text", accessibilityLabel: meta || undefined, style: {
|
|
81
|
-
flexDirection: outgoing ? "row-reverse" : "row",
|
|
82
|
-
alignItems: "flex-end",
|
|
83
|
-
gap: 8,
|
|
84
|
-
paddingHorizontal: 4,
|
|
85
|
-
paddingVertical: 4,
|
|
86
|
-
...style,
|
|
87
|
-
}, ...props, children: [avatar ? ((0, jsx_runtime_1.jsx)(Display_1.Avatar, { name: name ?? "", size: "sm", isDark: isDark })) : null, (0, jsx_runtime_1.jsxs)(View, { style: { flexShrink: 1, alignItems: outgoing ? "flex-end" : "flex-start", gap: 2 }, children: [name || time ? ((0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", alignItems: "center", gap: 6 }, children: [name ? ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, fontWeight: "600", color: theme.foreground }, children: name })) : null, time ? (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted }, children: time }) : null] })) : null, children] })] }));
|
|
88
|
-
});
|