jfs-components 0.1.8 → 0.1.12
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/CHANGELOG.md +16 -0
- package/lib/commonjs/components/Accordion/Accordion.js +2 -1
- package/lib/commonjs/components/AccordionCheckbox/AccordionCheckbox.js +4 -3
- package/lib/commonjs/components/AccountCard/AccountCard.js +4 -3
- package/lib/commonjs/components/AllocationComparisonChart/AllocationComparisonChart.js +9 -6
- package/lib/commonjs/components/AreaLineChart/AreaLineChart.js +11 -7
- package/lib/commonjs/components/Badge/Badge.js +47 -8
- package/lib/commonjs/components/BrandChip/BrandChip.js +3 -3
- package/lib/commonjs/components/Button/Button.js +2 -1
- package/lib/commonjs/components/CardAdvisory/CardAdvisory.js +2 -1
- package/lib/commonjs/components/CardBankAccount/CardBankAccount.js +3 -2
- package/lib/commonjs/components/CardCTA/CardCTA.js +197 -27
- package/lib/commonjs/components/CardInsight/CardInsight.js +5 -1
- package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +7 -3
- package/lib/commonjs/components/CircularProgressBarDoted/CircularProgressBarDoted.js +3 -2
- package/lib/commonjs/components/CircularRating/CircularRating.js +2 -1
- package/lib/commonjs/components/ClusterBubble/ClusterBubble.js +3 -2
- package/lib/commonjs/components/CompareTable/CompareTable.js +72 -43
- package/lib/commonjs/components/CoverageBarComparison/CoverageBarComparison.js +3 -2
- package/lib/commonjs/components/DonutChart/DonutChart.js +4 -3
- package/lib/commonjs/components/Dropdown/Dropdown.js +3 -2
- package/lib/commonjs/components/DropdownInput/DropdownInput.js +3 -2
- package/lib/commonjs/components/ExpandableCheckbox/ExpandableCheckbox.js +2 -1
- package/lib/commonjs/components/FormField/FormField.js +42 -2
- package/lib/commonjs/components/Gauge/Gauge.js +1 -1
- package/lib/commonjs/components/HoldingsCard/HoldingsCard.js +3 -2
- package/lib/commonjs/components/InstitutionBadge/InstitutionBadge.js +2 -1
- package/lib/commonjs/components/ListGroup/ListGroup.js +2 -1
- package/lib/commonjs/components/ListItem/ListItem.js +3 -2
- package/lib/commonjs/components/MediaCard/MediaCard.js +4 -2
- package/lib/commonjs/components/MetricLegendItem/MetricLegendItem.js +3 -2
- package/lib/commonjs/components/MonthlyStatusGrid/MonthlyStatusGrid.js +6 -3
- package/lib/commonjs/components/PoweredByLabel/PoweredByLabel.js +3 -2
- package/lib/commonjs/components/ProductMerchandisingCard/ProductMerchandisingCard.js +107 -33
- package/lib/commonjs/components/ProductOverview/ProductOverview.js +4 -3
- package/lib/commonjs/components/ProgressBadge/ProgressBadge.js +2 -2
- package/lib/commonjs/components/ProjectionMarker/ProjectionMarker.js +3 -2
- package/lib/commonjs/components/Section/Section.js +3 -2
- package/lib/commonjs/components/Slider/Slider.js +3 -2
- package/lib/commonjs/components/Stack/Stack.js +86 -0
- package/lib/commonjs/components/SuggestiveSearch/SuggestiveSearch.js +10 -1
- package/lib/commonjs/components/SummaryTile/SummaryTile.js +3 -2
- package/lib/commonjs/components/Table/Table.js +324 -0
- package/lib/commonjs/components/Text/Text.js +2 -1
- package/lib/commonjs/components/TextInput/TextInput.js +9 -1
- package/lib/commonjs/components/TextSegment/TextSegment.js +2 -1
- package/lib/commonjs/components/ThreadHero/ThreadHero.js +4 -5
- package/lib/commonjs/components/Title/Title.js +2 -1
- package/lib/commonjs/components/Toast/Toast.js +3 -2
- package/lib/commonjs/components/TransactionBubble/TransactionBubble.js +2 -1
- package/lib/commonjs/components/TransactionStatus/TransactionStatus.js +3 -2
- package/lib/commonjs/components/UpiHandle/UpiHandle.js +2 -2
- package/lib/commonjs/components/index.js +44 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/design-tokens/figma-modes.generated.js +1 -0
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.js +11 -3
- package/lib/commonjs/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.web.js +8 -4
- package/lib/commonjs/utils/react-utils.js +56 -0
- package/lib/commonjs/utils/web-platform-utils.js +59 -0
- package/lib/module/components/Accordion/Accordion.js +3 -2
- package/lib/module/components/AccordionCheckbox/AccordionCheckbox.js +5 -4
- package/lib/module/components/AccountCard/AccountCard.js +5 -4
- package/lib/module/components/AllocationComparisonChart/AllocationComparisonChart.js +10 -7
- package/lib/module/components/AreaLineChart/AreaLineChart.js +12 -8
- package/lib/module/components/Badge/Badge.js +49 -10
- package/lib/module/components/BrandChip/BrandChip.js +4 -4
- package/lib/module/components/Button/Button.js +3 -2
- package/lib/module/components/CardAdvisory/CardAdvisory.js +3 -2
- package/lib/module/components/CardBankAccount/CardBankAccount.js +4 -3
- package/lib/module/components/CardCTA/CardCTA.js +198 -28
- package/lib/module/components/CardInsight/CardInsight.js +5 -1
- package/lib/module/components/CircularProgressBar/CircularProgressBar.js +8 -4
- package/lib/module/components/CircularProgressBarDoted/CircularProgressBarDoted.js +4 -3
- package/lib/module/components/CircularRating/CircularRating.js +3 -2
- package/lib/module/components/ClusterBubble/ClusterBubble.js +4 -3
- package/lib/module/components/CompareTable/CompareTable.js +73 -44
- package/lib/module/components/CoverageBarComparison/CoverageBarComparison.js +4 -3
- package/lib/module/components/DonutChart/DonutChart.js +5 -4
- package/lib/module/components/Dropdown/Dropdown.js +4 -3
- package/lib/module/components/DropdownInput/DropdownInput.js +4 -3
- package/lib/module/components/ExpandableCheckbox/ExpandableCheckbox.js +2 -1
- package/lib/module/components/FormField/FormField.js +45 -5
- package/lib/module/components/Gauge/Gauge.js +1 -1
- package/lib/module/components/HoldingsCard/HoldingsCard.js +4 -3
- package/lib/module/components/InstitutionBadge/InstitutionBadge.js +3 -2
- package/lib/module/components/ListGroup/ListGroup.js +3 -2
- package/lib/module/components/ListItem/ListItem.js +4 -3
- package/lib/module/components/MediaCard/MediaCard.js +4 -2
- package/lib/module/components/MetricLegendItem/MetricLegendItem.js +4 -3
- package/lib/module/components/MonthlyStatusGrid/MonthlyStatusGrid.js +7 -4
- package/lib/module/components/PoweredByLabel/PoweredByLabel.js +4 -3
- package/lib/module/components/ProductMerchandisingCard/ProductMerchandisingCard.js +109 -35
- package/lib/module/components/ProductOverview/ProductOverview.js +5 -4
- package/lib/module/components/ProgressBadge/ProgressBadge.js +3 -3
- package/lib/module/components/ProjectionMarker/ProjectionMarker.js +4 -3
- package/lib/module/components/Section/Section.js +4 -3
- package/lib/module/components/Slider/Slider.js +4 -3
- package/lib/module/components/Stack/Stack.js +81 -0
- package/lib/module/components/SuggestiveSearch/SuggestiveSearch.js +10 -1
- package/lib/module/components/SummaryTile/SummaryTile.js +4 -3
- package/lib/module/components/Table/Table.js +315 -0
- package/lib/module/components/Text/Text.js +3 -2
- package/lib/module/components/TextInput/TextInput.js +9 -1
- package/lib/module/components/TextSegment/TextSegment.js +3 -2
- package/lib/module/components/ThreadHero/ThreadHero.js +5 -6
- package/lib/module/components/Title/Title.js +3 -2
- package/lib/module/components/Toast/Toast.js +4 -3
- package/lib/module/components/TransactionBubble/TransactionBubble.js +3 -2
- package/lib/module/components/TransactionStatus/TransactionStatus.js +4 -3
- package/lib/module/components/UpiHandle/UpiHandle.js +3 -3
- package/lib/module/components/index.js +2 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/design-tokens/figma-modes.generated.js +1 -0
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.js +11 -3
- package/lib/module/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.web.js +8 -4
- package/lib/module/utils/react-utils.js +54 -0
- package/lib/module/utils/web-platform-utils.js +58 -0
- package/lib/typescript/src/components/Accordion/Accordion.d.ts +7 -1
- package/lib/typescript/src/components/AccordionCheckbox/AccordionCheckbox.d.ts +7 -1
- package/lib/typescript/src/components/AccountCard/AccountCard.d.ts +7 -1
- package/lib/typescript/src/components/AllocationComparisonChart/AllocationComparisonChart.d.ts +7 -1
- package/lib/typescript/src/components/AreaLineChart/AreaLineChart.d.ts +8 -1
- package/lib/typescript/src/components/Badge/Badge.d.ts +32 -2
- package/lib/typescript/src/components/BrandChip/BrandChip.d.ts +7 -1
- package/lib/typescript/src/components/Button/Button.d.ts +7 -1
- package/lib/typescript/src/components/CardAdvisory/CardAdvisory.d.ts +7 -1
- package/lib/typescript/src/components/CardBankAccount/CardBankAccount.d.ts +7 -1
- package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +27 -5
- package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +7 -1
- package/lib/typescript/src/components/CircularProgressBarDoted/CircularProgressBarDoted.d.ts +7 -1
- package/lib/typescript/src/components/CircularRating/CircularRating.d.ts +7 -1
- package/lib/typescript/src/components/ClusterBubble/ClusterBubble.d.ts +7 -1
- package/lib/typescript/src/components/CompareTable/CompareTable.d.ts +7 -1
- package/lib/typescript/src/components/CoverageBarComparison/CoverageBarComparison.d.ts +7 -1
- package/lib/typescript/src/components/DonutChart/DonutChart.d.ts +7 -1
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +7 -1
- package/lib/typescript/src/components/DropdownInput/DropdownInput.d.ts +6 -0
- package/lib/typescript/src/components/ExpandableCheckbox/ExpandableCheckbox.d.ts +7 -1
- package/lib/typescript/src/components/HoldingsCard/HoldingsCard.d.ts +7 -1
- package/lib/typescript/src/components/InstitutionBadge/InstitutionBadge.d.ts +7 -1
- package/lib/typescript/src/components/ListGroup/ListGroup.d.ts +7 -1
- package/lib/typescript/src/components/ListItem/ListItem.d.ts +7 -1
- package/lib/typescript/src/components/MetricLegendItem/MetricLegendItem.d.ts +7 -1
- package/lib/typescript/src/components/MonthlyStatusGrid/MonthlyStatusGrid.d.ts +14 -2
- package/lib/typescript/src/components/PoweredByLabel/PoweredByLabel.d.ts +7 -1
- package/lib/typescript/src/components/ProductMerchandisingCard/ProductMerchandisingCard.d.ts +7 -1
- package/lib/typescript/src/components/ProductOverview/ProductOverview.d.ts +7 -1
- package/lib/typescript/src/components/ProgressBadge/ProgressBadge.d.ts +7 -1
- package/lib/typescript/src/components/ProjectionMarker/ProjectionMarker.d.ts +7 -1
- package/lib/typescript/src/components/Section/Section.d.ts +7 -1
- package/lib/typescript/src/components/Slider/Slider.d.ts +6 -0
- package/lib/typescript/src/components/Stack/Stack.d.ts +81 -0
- package/lib/typescript/src/components/SummaryTile/SummaryTile.d.ts +7 -1
- package/lib/typescript/src/components/Table/Table.d.ts +139 -0
- package/lib/typescript/src/components/Text/Text.d.ts +7 -1
- package/lib/typescript/src/components/TextSegment/TextSegment.d.ts +7 -1
- package/lib/typescript/src/components/ThreadHero/ThreadHero.d.ts +7 -1
- package/lib/typescript/src/components/Title/Title.d.ts +7 -1
- package/lib/typescript/src/components/Toast/Toast.d.ts +7 -1
- package/lib/typescript/src/components/TransactionBubble/TransactionBubble.d.ts +7 -1
- package/lib/typescript/src/components/TransactionStatus/TransactionStatus.d.ts +7 -1
- package/lib/typescript/src/components/UpiHandle/UpiHandle.d.ts +7 -1
- package/lib/typescript/src/components/index.d.ts +4 -2
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/lib/typescript/src/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.d.ts +31 -3
- package/lib/typescript/src/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.web.d.ts +18 -2
- package/lib/typescript/src/utils/react-utils.d.ts +37 -0
- package/lib/typescript/src/utils/web-platform-utils.d.ts +36 -0
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.tsx +9 -2
- package/src/components/AccordionCheckbox/AccordionCheckbox.tsx +10 -3
- package/src/components/AccountCard/AccountCard.tsx +10 -3
- package/src/components/AllocationComparisonChart/AllocationComparisonChart.tsx +14 -4
- package/src/components/AreaLineChart/AreaLineChart.tsx +15 -5
- package/src/components/Badge/Badge.tsx +78 -8
- package/src/components/BrandChip/BrandChip.tsx +9 -3
- package/src/components/Button/Button.tsx +9 -2
- package/src/components/CardAdvisory/CardAdvisory.tsx +9 -2
- package/src/components/CardBankAccount/CardBankAccount.tsx +9 -2
- package/src/components/CardCTA/CardCTA.tsx +214 -41
- package/src/components/CardInsight/CardInsight.tsx +7 -1
- package/src/components/CircularProgressBar/CircularProgressBar.tsx +14 -4
- package/src/components/CircularProgressBarDoted/CircularProgressBarDoted.tsx +10 -3
- package/src/components/CircularRating/CircularRating.tsx +9 -2
- package/src/components/ClusterBubble/ClusterBubble.tsx +9 -2
- package/src/components/CompareTable/CompareTable.tsx +98 -50
- package/src/components/CoverageBarComparison/CoverageBarComparison.tsx +9 -2
- package/src/components/DonutChart/DonutChart.tsx +10 -3
- package/src/components/Dropdown/Dropdown.tsx +9 -2
- package/src/components/DropdownInput/DropdownInput.tsx +9 -2
- package/src/components/ExpandableCheckbox/ExpandableCheckbox.tsx +8 -1
- package/src/components/FormField/FormField.tsx +49 -4
- package/src/components/Gauge/Gauge.tsx +1 -1
- package/src/components/HoldingsCard/HoldingsCard.tsx +9 -2
- package/src/components/InstitutionBadge/InstitutionBadge.tsx +9 -2
- package/src/components/ListGroup/ListGroup.tsx +9 -2
- package/src/components/ListItem/ListItem.tsx +10 -3
- package/src/components/MediaCard/MediaCard.tsx +2 -2
- package/src/components/MetricLegendItem/MetricLegendItem.tsx +9 -2
- package/src/components/MonthlyStatusGrid/MonthlyStatusGrid.tsx +17 -2
- package/src/components/PoweredByLabel/PoweredByLabel.tsx +9 -2
- package/src/components/ProductMerchandisingCard/ProductMerchandisingCard.tsx +104 -37
- package/src/components/ProductOverview/ProductOverview.tsx +10 -3
- package/src/components/ProgressBadge/ProgressBadge.tsx +9 -3
- package/src/components/ProjectionMarker/ProjectionMarker.tsx +9 -2
- package/src/components/Section/Section.tsx +10 -3
- package/src/components/Slider/Slider.tsx +9 -2
- package/src/components/Stack/Stack.tsx +131 -0
- package/src/components/SuggestiveSearch/SuggestiveSearch.tsx +10 -1
- package/src/components/SummaryTile/SummaryTile.tsx +9 -2
- package/src/components/Table/Table.tsx +449 -0
- package/src/components/Text/Text.tsx +9 -2
- package/src/components/TextInput/TextInput.tsx +7 -1
- package/src/components/TextSegment/TextSegment.tsx +9 -2
- package/src/components/ThreadHero/ThreadHero.tsx +10 -3
- package/src/components/Title/Title.tsx +9 -2
- package/src/components/Toast/Toast.tsx +9 -2
- package/src/components/TransactionBubble/TransactionBubble.tsx +9 -2
- package/src/components/TransactionStatus/TransactionStatus.tsx +9 -2
- package/src/components/UpiHandle/UpiHandle.tsx +9 -3
- package/src/components/index.ts +23 -2
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/design-tokens/figma-modes.generated.ts +1 -0
- package/src/icons/registry.ts +1 -1
- package/src/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.tsx +32 -3
- package/src/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.web.tsx +25 -4
- package/src/utils/react-utils.ts +61 -0
- package/src/utils/web-platform-utils.ts +68 -0
- package/lib/commonjs/components/MediaCard/GlassFill.js +0 -62
- package/lib/commonjs/components/MediaCard/GlassFill.web.js +0 -48
- package/lib/module/components/MediaCard/GlassFill.js +0 -57
- package/lib/module/components/MediaCard/GlassFill.web.js +0 -43
- package/lib/typescript/src/components/MediaCard/GlassFill.d.ts +0 -47
- package/lib/typescript/src/components/MediaCard/GlassFill.web.d.ts +0 -20
- package/src/components/MediaCard/GlassFill.tsx +0 -89
- package/src/components/MediaCard/GlassFill.web.tsx +0 -53
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, StyleSheet, Platform, type ViewStyle, type StyleProp } from 'react-native'
|
|
3
|
-
import { BlurView } from '@react-native-community/blur'
|
|
4
|
-
|
|
5
|
-
export type GlassTint = 'dark' | 'light'
|
|
6
|
-
|
|
7
|
-
export interface GlassFillProps {
|
|
8
|
-
/**
|
|
9
|
-
* Visual tint of the glass surface. Maps to `BlurView`'s `blurType`
|
|
10
|
-
* (`'dark'` | `'light'`). The library also drives the appropriate
|
|
11
|
-
* `reducedTransparencyFallbackColor` from this so iOS gracefully degrades
|
|
12
|
-
* when "Reduce Transparency" is enabled in system accessibility settings.
|
|
13
|
-
*/
|
|
14
|
-
tint?: GlassTint
|
|
15
|
-
/**
|
|
16
|
-
* Blur strength as a 0–100 "intensity" value (kept compatible with the
|
|
17
|
-
* previous `expo-blur` API so consumers don't need to relearn the scale).
|
|
18
|
-
* Internally mapped to `@react-native-community/blur`'s `blurAmount`,
|
|
19
|
-
* which is roughly 0–32 on iOS / Android.
|
|
20
|
-
*/
|
|
21
|
-
intensity?: number
|
|
22
|
-
/**
|
|
23
|
-
* Token-derived color tint laid OVER the live blur (Figma `blur/minimal/background`).
|
|
24
|
-
* Painted as a translucent overlay so the glass keeps the design system
|
|
25
|
-
* color signature even when the platform blur quality varies.
|
|
26
|
-
*/
|
|
27
|
-
overlayColor?: string
|
|
28
|
-
/** Container style overrides. Defaults to `StyleSheet.absoluteFill`. */
|
|
29
|
-
style?: StyleProp<ViewStyle>
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const DEFAULT_FALLBACK_DARK = '#1414174a'
|
|
33
|
-
const DEFAULT_FALLBACK_LIGHT = '#ffffff66'
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Glass / frosted surface for native (iOS + Android).
|
|
37
|
-
*
|
|
38
|
-
* Why this lives in its own platform-split file:
|
|
39
|
-
* - `@react-native-community/blur` is a native-only module. Importing it on
|
|
40
|
-
* web throws because the JS shim references native components that aren't
|
|
41
|
-
* registered there. By using Metro's platform-extension resolution
|
|
42
|
-
* (`GlassFill.tsx` for native, `GlassFill.web.tsx` for web), we keep the
|
|
43
|
-
* web bundle free of any native-only imports.
|
|
44
|
-
* - Centralizes the `intensity` (0–100) -> `blurAmount` (0–32) mapping so
|
|
45
|
-
* callers can keep the Figma token semantics they already know.
|
|
46
|
-
*
|
|
47
|
-
* On iOS this is a real `UIVisualEffectView` (true OS-level live blur).
|
|
48
|
-
* On Android this uses the community blur view (RealtimeBlurView). On devices
|
|
49
|
-
* where realtime blur is unavailable, `reducedTransparencyFallbackColor` (and
|
|
50
|
-
* the explicit `overlayColor`) ensure the surface still renders as a
|
|
51
|
-
* translucent tinted scrim instead of disappearing.
|
|
52
|
-
*/
|
|
53
|
-
function GlassFill({
|
|
54
|
-
tint = 'dark',
|
|
55
|
-
intensity = 50,
|
|
56
|
-
overlayColor,
|
|
57
|
-
style,
|
|
58
|
-
}: GlassFillProps) {
|
|
59
|
-
const blurType: 'light' | 'dark' = tint === 'light' ? 'light' : 'dark'
|
|
60
|
-
const blurAmount = Math.max(0, Math.min(32, Math.round(intensity * 0.32)))
|
|
61
|
-
const fallbackColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK)
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<View style={[StyleSheet.absoluteFill, style]} pointerEvents="none">
|
|
65
|
-
<BlurView
|
|
66
|
-
style={StyleSheet.absoluteFill}
|
|
67
|
-
blurType={blurType}
|
|
68
|
-
blurAmount={blurAmount}
|
|
69
|
-
reducedTransparencyFallbackColor={fallbackColor}
|
|
70
|
-
/>
|
|
71
|
-
{overlayColor != null ? (
|
|
72
|
-
<View style={[StyleSheet.absoluteFill, { backgroundColor: overlayColor }]} />
|
|
73
|
-
) : null}
|
|
74
|
-
{Platform.OS === 'android' ? (
|
|
75
|
-
<View
|
|
76
|
-
style={[
|
|
77
|
-
StyleSheet.absoluteFill,
|
|
78
|
-
{
|
|
79
|
-
backgroundColor: 'rgba(255,255,255,0.03)',
|
|
80
|
-
opacity: 0.6,
|
|
81
|
-
},
|
|
82
|
-
]}
|
|
83
|
-
/>
|
|
84
|
-
) : null}
|
|
85
|
-
</View>
|
|
86
|
-
)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export default GlassFill
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, StyleSheet, type ViewStyle, type StyleProp } from 'react-native'
|
|
3
|
-
|
|
4
|
-
export type GlassTint = 'dark' | 'light'
|
|
5
|
-
|
|
6
|
-
export interface GlassFillProps {
|
|
7
|
-
tint?: GlassTint
|
|
8
|
-
intensity?: number
|
|
9
|
-
overlayColor?: string
|
|
10
|
-
style?: StyleProp<ViewStyle>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const DEFAULT_FALLBACK_DARK = '#1414174a'
|
|
14
|
-
const DEFAULT_FALLBACK_LIGHT = '#ffffff66'
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Web counterpart of `GlassFill`.
|
|
18
|
-
*
|
|
19
|
-
* `@react-native-community/blur` does not ship a web implementation, so for
|
|
20
|
-
* the web bundle we render a translucent `View` with `backdrop-filter: blur()`
|
|
21
|
-
* — which is exactly how 0.0.67 and earlier shipped the glass effect on web.
|
|
22
|
-
* Native bundles pick up `GlassFill.tsx` instead via Metro's platform
|
|
23
|
-
* resolver; the web bundle picks up this file.
|
|
24
|
-
*/
|
|
25
|
-
function GlassFill({
|
|
26
|
-
tint = 'dark',
|
|
27
|
-
intensity = 50,
|
|
28
|
-
overlayColor,
|
|
29
|
-
style,
|
|
30
|
-
}: GlassFillProps) {
|
|
31
|
-
// Approximate mapping: intensity 0-100 -> ~0-30px CSS blur. Keeps parity
|
|
32
|
-
// with the native blur strength so the component looks roughly the same
|
|
33
|
-
// across platforms.
|
|
34
|
-
const blurPx = Math.max(0, Math.min(30, Math.round(intensity * 0.3)))
|
|
35
|
-
const tintColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK)
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<View
|
|
39
|
-
style={[
|
|
40
|
-
StyleSheet.absoluteFill,
|
|
41
|
-
{ backgroundColor: tintColor },
|
|
42
|
-
// backdrop-filter is a web-only CSS property; ignored by RN
|
|
43
|
-
// on native (we never bundle this file there anyway).
|
|
44
|
-
// @ts-ignore web-only style
|
|
45
|
-
{ backdropFilter: `blur(${blurPx}px)`, WebkitBackdropFilter: `blur(${blurPx}px)` },
|
|
46
|
-
style,
|
|
47
|
-
]}
|
|
48
|
-
pointerEvents="none"
|
|
49
|
-
/>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export default GlassFill
|