jfs-components 0.1.2 → 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 +45 -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/AmountInput/AmountInput.js +8 -5
- package/lib/commonjs/components/AreaLineChart/AreaLineChart.js +11 -7
- package/lib/commonjs/components/Badge/Badge.js +47 -8
- package/lib/commonjs/components/BenefitCard/BenefitCard.js +231 -0
- 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/CcCard/CcCard.js +470 -0
- package/lib/commonjs/components/Checkbox/Checkbox.js +4 -3
- package/lib/commonjs/components/CheckboxItem/CheckboxItem.js +4 -3
- 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 +401 -0
- package/lib/commonjs/components/ComparisonBar/ComparisonBar.js +266 -0
- 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 +38 -5
- package/lib/commonjs/components/ExpandableCheckbox/ExpandableCheckbox.js +2 -1
- package/lib/commonjs/components/FormField/FormField.js +45 -4
- package/lib/commonjs/components/Gauge/Gauge.js +1 -1
- package/lib/commonjs/components/HoldingsCard/HoldingsCard.js +3 -2
- package/lib/commonjs/components/InputSearch/InputSearch.js +6 -4
- 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/NoteInput/NoteInput.js +6 -5
- package/lib/commonjs/components/PdpCcCard/PdpCcCard.js +273 -0
- package/lib/commonjs/components/PoweredByLabel/PoweredByLabel.js +3 -2
- package/lib/commonjs/components/ProductMerchandisingCard/ProductMerchandisingCard.js +427 -0
- 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 +162 -0
- package/lib/commonjs/components/Radio/Radio.js +5 -5
- package/lib/commonjs/components/Section/Section.js +3 -2
- package/lib/commonjs/components/Slider/Slider.js +474 -0
- 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 +22 -9
- package/lib/commonjs/components/TextSegment/TextSegment.js +119 -0
- 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 +107 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/design-tokens/figma-modes.generated.js +39 -9
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/utils/GlassFill/GlassFill.js +271 -0
- package/lib/commonjs/utils/GlassFill/GlassFill.web.js +120 -0
- package/lib/commonjs/utils/react-utils.js +78 -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/AmountInput/AmountInput.js +6 -4
- package/lib/module/components/AreaLineChart/AreaLineChart.js +12 -8
- package/lib/module/components/Badge/Badge.js +49 -10
- package/lib/module/components/BenefitCard/BenefitCard.js +225 -0
- 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/CcCard/CcCard.js +464 -0
- package/lib/module/components/Checkbox/Checkbox.js +5 -4
- package/lib/module/components/CheckboxItem/CheckboxItem.js +5 -4
- 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 +396 -0
- package/lib/module/components/ComparisonBar/ComparisonBar.js +260 -0
- 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 +40 -7
- package/lib/module/components/ExpandableCheckbox/ExpandableCheckbox.js +2 -1
- package/lib/module/components/FormField/FormField.js +48 -7
- package/lib/module/components/Gauge/Gauge.js +1 -1
- package/lib/module/components/HoldingsCard/HoldingsCard.js +4 -3
- package/lib/module/components/InputSearch/InputSearch.js +6 -4
- 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/NoteInput/NoteInput.js +7 -6
- package/lib/module/components/PdpCcCard/PdpCcCard.js +267 -0
- package/lib/module/components/PoweredByLabel/PoweredByLabel.js +4 -3
- package/lib/module/components/ProductMerchandisingCard/ProductMerchandisingCard.js +421 -0
- 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 +157 -0
- package/lib/module/components/Radio/Radio.js +5 -4
- package/lib/module/components/Section/Section.js +4 -3
- package/lib/module/components/Slider/Slider.js +469 -0
- 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 +24 -11
- package/lib/module/components/TextSegment/TextSegment.js +114 -0
- 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 +11 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/design-tokens/figma-modes.generated.js +39 -9
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/utils/GlassFill/GlassFill.js +265 -0
- package/lib/module/utils/GlassFill/GlassFill.web.js +115 -0
- package/lib/module/utils/react-utils.js +75 -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/AmountInput/AmountInput.d.ts +3 -2
- 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/BenefitCard/BenefitCard.d.ts +93 -0
- 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/CcCard/CcCard.d.ts +137 -0
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +3 -2
- package/lib/typescript/src/components/CheckboxItem/CheckboxItem.d.ts +2 -2
- 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 +94 -0
- package/lib/typescript/src/components/ComparisonBar/ComparisonBar.d.ts +118 -0
- 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 +26 -1
- package/lib/typescript/src/components/ExpandableCheckbox/ExpandableCheckbox.d.ts +7 -1
- package/lib/typescript/src/components/FormField/FormField.d.ts +2 -2
- package/lib/typescript/src/components/HoldingsCard/HoldingsCard.d.ts +7 -1
- package/lib/typescript/src/components/InputSearch/InputSearch.d.ts +23 -2
- 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/NoteInput/NoteInput.d.ts +19 -2
- package/lib/typescript/src/components/PdpCcCard/PdpCcCard.d.ts +84 -0
- package/lib/typescript/src/components/PoweredByLabel/PoweredByLabel.d.ts +7 -1
- package/lib/typescript/src/components/ProductMerchandisingCard/ProductMerchandisingCard.d.ts +87 -0
- 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 +88 -0
- package/lib/typescript/src/components/Radio/Radio.d.ts +3 -2
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +2 -2
- package/lib/typescript/src/components/Section/Section.d.ts +7 -1
- package/lib/typescript/src/components/Slider/Slider.d.ts +105 -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/TextInput/TextInput.d.ts +9 -29
- package/lib/typescript/src/components/TextSegment/TextSegment.d.ts +106 -0
- 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 +14 -3
- package/lib/typescript/src/design-tokens/figma-modes.generated.d.ts +22 -2
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/lib/typescript/src/utils/GlassFill/GlassFill.d.ts +84 -0
- package/lib/typescript/src/utils/GlassFill/GlassFill.web.d.ts +43 -0
- package/lib/typescript/src/utils/react-utils.d.ts +47 -0
- package/lib/typescript/src/utils/web-platform-utils.d.ts +36 -0
- package/package.json +2 -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/AmountInput/AmountInput.tsx +7 -5
- package/src/components/AreaLineChart/AreaLineChart.tsx +15 -5
- package/src/components/Badge/Badge.tsx +78 -8
- package/src/components/BenefitCard/BenefitCard.tsx +309 -0
- 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/CcCard/CcCard.tsx +598 -0
- package/src/components/Checkbox/Checkbox.tsx +5 -4
- package/src/components/CheckboxItem/CheckboxItem.tsx +5 -4
- 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 +525 -0
- package/src/components/ComparisonBar/ComparisonBar.tsx +356 -0
- 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 +64 -5
- package/src/components/ExpandableCheckbox/ExpandableCheckbox.tsx +8 -1
- package/src/components/FormField/FormField.tsx +52 -6
- package/src/components/Gauge/Gauge.tsx +1 -1
- package/src/components/HoldingsCard/HoldingsCard.tsx +9 -2
- package/src/components/InputSearch/InputSearch.tsx +8 -5
- 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/NoteInput/NoteInput.tsx +8 -6
- package/src/components/PdpCcCard/PdpCcCard.tsx +356 -0
- package/src/components/PoweredByLabel/PoweredByLabel.tsx +9 -2
- package/src/components/ProductMerchandisingCard/ProductMerchandisingCard.tsx +490 -0
- package/src/components/ProductOverview/ProductOverview.tsx +10 -3
- package/src/components/ProgressBadge/ProgressBadge.tsx +9 -3
- package/src/components/ProjectionMarker/ProjectionMarker.tsx +284 -0
- package/src/components/Radio/Radio.tsx +5 -4
- package/src/components/Section/Section.tsx +10 -3
- package/src/components/Slider/Slider.tsx +635 -0
- 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 +22 -12
- package/src/components/TextSegment/TextSegment.tsx +173 -0
- 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 +33 -3
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/design-tokens/figma-modes.generated.ts +39 -9
- package/src/icons/registry.ts +1 -1
- package/src/utils/GlassFill/GlassFill.tsx +305 -0
- package/src/utils/GlassFill/GlassFill.web.tsx +148 -0
- package/src/utils/react-utils.ts +84 -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/scripts/extract-component-tokens.d.ts +0 -9
- package/lib/typescript/scripts/generate-component-docs.d.ts +0 -9
- package/lib/typescript/scripts/generate-icon-registry.d.ts +0 -3
- package/lib/typescript/scripts/generate-mode-types.d.ts +0 -2
- package/lib/typescript/scripts/retype-modes.d.cts +0 -2
- 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
package/src/utils/react-utils.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
3
|
import type { Modes } from '../design-tokens'
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -88,6 +89,89 @@ export function cloneChildrenWithModes(
|
|
|
88
89
|
return React.Children.toArray(result);
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Merges a style onto each direct (top-level) child element, with the injected
|
|
94
|
+
* style taking precedence over the child's own style.
|
|
95
|
+
*
|
|
96
|
+
* Used by the Stack family to *enforce* cross-axis stretching from the container
|
|
97
|
+
* itself: a child can set its own `alignSelf` (which, per the flexbox spec,
|
|
98
|
+
* overrides the parent's `alignItems`), so to guarantee equal heights / full
|
|
99
|
+
* width regardless of what individual children declare, we append
|
|
100
|
+
* `{ alignSelf: 'stretch' }` to every direct child.
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* - Only top-level children are touched. Grandchildren are intentionally left
|
|
104
|
+
* alone — we never want to leak layout styles deeper into the tree.
|
|
105
|
+
* - Non-element children (strings, numbers) are passed through untouched.
|
|
106
|
+
* - This relies on the child forwarding `style` to its outer/root view. Built-in
|
|
107
|
+
* RN primitives and components that spread `style` onto their root honour it;
|
|
108
|
+
* a child that fully ignores `style` cannot be forced (this is a hard React
|
|
109
|
+
* Native limitation, not something this helper can work around).
|
|
110
|
+
* - Per Yoga, stretch has no effect on an axis where the child has a *fixed*
|
|
111
|
+
* dimension (e.g. an explicit `height` for a row). Such children opt out by
|
|
112
|
+
* design; this helper does not strip explicit dimensions.
|
|
113
|
+
*/
|
|
114
|
+
export function injectChildStyle(
|
|
115
|
+
children: React.ReactNode,
|
|
116
|
+
style: StyleProp<ViewStyle>
|
|
117
|
+
): React.ReactNode {
|
|
118
|
+
return React.Children.map(children, (child) => {
|
|
119
|
+
if (!React.isValidElement(child)) {
|
|
120
|
+
return child;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const existingStyle = (child.props as { style?: StyleProp<ViewStyle> })?.style;
|
|
124
|
+
|
|
125
|
+
return React.cloneElement(child as React.ReactElement<{ style?: StyleProp<ViewStyle> }>, {
|
|
126
|
+
style: existingStyle != null ? [existingStyle, style] : style,
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Combines several refs (object refs and/or callback refs) into a single
|
|
133
|
+
* callback ref. Useful when a component needs to keep its own internal ref to a
|
|
134
|
+
* node while still honouring a ref forwarded by the consumer.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* const inputRef = useRef<RNTextInput>(null)
|
|
138
|
+
* <RNTextInput ref={mergeRefs(inputRef, forwardedRef)} />
|
|
139
|
+
*/
|
|
140
|
+
export function mergeRefs<T>(
|
|
141
|
+
...refs: Array<React.Ref<T> | undefined | null>
|
|
142
|
+
): React.RefCallback<T> {
|
|
143
|
+
return (value: T | null) => {
|
|
144
|
+
refs.forEach((ref) => {
|
|
145
|
+
if (typeof ref === 'function') {
|
|
146
|
+
ref(value);
|
|
147
|
+
} else if (ref != null) {
|
|
148
|
+
(ref as React.MutableRefObject<T | null>).current = value;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type EllipsizeMode = 'head' | 'middle' | 'tail' | 'clip';
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Resolves the `numberOfLines` / `ellipsizeMode` pair for a `<Text>` based on a
|
|
158
|
+
* `disableTruncation` flag.
|
|
159
|
+
*
|
|
160
|
+
* When `disableTruncation` is `true`, both values are returned as `undefined`
|
|
161
|
+
* so the text wraps to as many lines as it needs and never shows the trailing
|
|
162
|
+
* ellipsis. Otherwise the provided values are passed through unchanged.
|
|
163
|
+
*/
|
|
164
|
+
export function resolveTruncation(
|
|
165
|
+
disableTruncation: boolean | undefined,
|
|
166
|
+
numberOfLines?: number,
|
|
167
|
+
ellipsizeMode?: EllipsizeMode
|
|
168
|
+
): { numberOfLines?: number; ellipsizeMode?: EllipsizeMode } {
|
|
169
|
+
if (disableTruncation) {
|
|
170
|
+
return { numberOfLines: undefined, ellipsizeMode: undefined };
|
|
171
|
+
}
|
|
172
|
+
return { numberOfLines, ellipsizeMode };
|
|
173
|
+
}
|
|
174
|
+
|
|
91
175
|
/**
|
|
92
176
|
* Flattens React children, extracting them from Fragments.
|
|
93
177
|
* Useful for Group components that need to process individual items (e.g., for layout or styling)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
|
2
|
+
import type { RefObject } from 'react'
|
|
1
3
|
import { Platform } from 'react-native'
|
|
2
4
|
import type { PressableProps } from 'react-native'
|
|
3
5
|
|
|
@@ -272,6 +274,72 @@ export function usePressableWebSupport({
|
|
|
272
274
|
}
|
|
273
275
|
}
|
|
274
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Detects pointer presses (mouse / touch) that land OUTSIDE the node held by
|
|
279
|
+
* `containerRef` and invokes `onOutsidePress`.
|
|
280
|
+
*
|
|
281
|
+
* Why this exists:
|
|
282
|
+
* On web, React Native pressables (`Pressable`, `Button`, links, etc.) do not
|
|
283
|
+
* always claim DOM focus the way a native `<button>`/`<input>` does. As a
|
|
284
|
+
* result, tapping an *interactive* element outside a focused `<input>` may
|
|
285
|
+
* never trigger the input's native `blur` event, leaving a field stuck in its
|
|
286
|
+
* "Active" visual state. Listening for document-level pointer-down in the
|
|
287
|
+
* capture phase lets a component force a blur (or close a popover, etc.)
|
|
288
|
+
* regardless of whether the outside target takes focus.
|
|
289
|
+
*
|
|
290
|
+
* Behavior & safety:
|
|
291
|
+
* - **Web only.** On native (or when `document` is unavailable) this is a
|
|
292
|
+
* no-op, so it is safe to call unconditionally.
|
|
293
|
+
* - Listeners are attached only while `enabled` is `true`, and are removed on
|
|
294
|
+
* cleanup / when disabled — there is no standing global listener.
|
|
295
|
+
* - Uses the **capture** phase so it runs before element-level handlers, and
|
|
296
|
+
* listens to both `mousedown` and `touchstart` for parity across devices.
|
|
297
|
+
* - The latest `onOutsidePress` is read through a ref, so passing a fresh
|
|
298
|
+
* inline closure every render does NOT re-subscribe the listener.
|
|
299
|
+
*
|
|
300
|
+
* @param containerRef - Ref to the root host node to treat as "inside".
|
|
301
|
+
* @param onOutsidePress - Called when a pointer press occurs outside the node.
|
|
302
|
+
* @param enabled - When `false`, no listener is attached. Defaults to `true`.
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```tsx
|
|
306
|
+
* const rootRef = useRef<View>(null)
|
|
307
|
+
* const inputRef = useRef<RNTextInput>(null)
|
|
308
|
+
* useWebOutsidePress(rootRef, () => inputRef.current?.blur(), isFocused)
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
export function useWebOutsidePress(
|
|
312
|
+
containerRef: RefObject<any>,
|
|
313
|
+
onOutsidePress: () => void,
|
|
314
|
+
enabled: boolean = true
|
|
315
|
+
): void {
|
|
316
|
+
const callbackRef = useRef(onOutsidePress)
|
|
317
|
+
callbackRef.current = onOutsidePress
|
|
318
|
+
|
|
319
|
+
useEffect(() => {
|
|
320
|
+
if (Platform.OS !== 'web' || typeof document === 'undefined' || !enabled) {
|
|
321
|
+
return
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const handlePointerDown = (event: Event) => {
|
|
325
|
+
const node = containerRef.current as unknown as {
|
|
326
|
+
contains?: (target: EventTarget | null) => boolean
|
|
327
|
+
} | null
|
|
328
|
+
const target = (event as unknown as { target: EventTarget | null }).target
|
|
329
|
+
if (node?.contains && !node.contains(target)) {
|
|
330
|
+
callbackRef.current()
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
document.addEventListener('mousedown', handlePointerDown, true)
|
|
335
|
+
document.addEventListener('touchstart', handlePointerDown, true)
|
|
336
|
+
return () => {
|
|
337
|
+
document.removeEventListener('mousedown', handlePointerDown, true)
|
|
338
|
+
document.removeEventListener('touchstart', handlePointerDown, true)
|
|
339
|
+
}
|
|
340
|
+
}, [containerRef, enabled])
|
|
341
|
+
}
|
|
342
|
+
|
|
275
343
|
/**
|
|
276
344
|
* Type guard to check if running on web platform
|
|
277
345
|
*/
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _blur = require("@react-native-community/blur");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const DEFAULT_FALLBACK_DARK = '#1414174a';
|
|
13
|
-
const DEFAULT_FALLBACK_LIGHT = '#ffffff66';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Glass / frosted surface for native (iOS + Android).
|
|
17
|
-
*
|
|
18
|
-
* Why this lives in its own platform-split file:
|
|
19
|
-
* - `@react-native-community/blur` is a native-only module. Importing it on
|
|
20
|
-
* web throws because the JS shim references native components that aren't
|
|
21
|
-
* registered there. By using Metro's platform-extension resolution
|
|
22
|
-
* (`GlassFill.tsx` for native, `GlassFill.web.tsx` for web), we keep the
|
|
23
|
-
* web bundle free of any native-only imports.
|
|
24
|
-
* - Centralizes the `intensity` (0–100) -> `blurAmount` (0–32) mapping so
|
|
25
|
-
* callers can keep the Figma token semantics they already know.
|
|
26
|
-
*
|
|
27
|
-
* On iOS this is a real `UIVisualEffectView` (true OS-level live blur).
|
|
28
|
-
* On Android this uses the community blur view (RealtimeBlurView). On devices
|
|
29
|
-
* where realtime blur is unavailable, `reducedTransparencyFallbackColor` (and
|
|
30
|
-
* the explicit `overlayColor`) ensure the surface still renders as a
|
|
31
|
-
* translucent tinted scrim instead of disappearing.
|
|
32
|
-
*/
|
|
33
|
-
function GlassFill({
|
|
34
|
-
tint = 'dark',
|
|
35
|
-
intensity = 50,
|
|
36
|
-
overlayColor,
|
|
37
|
-
style
|
|
38
|
-
}) {
|
|
39
|
-
const blurType = tint === 'light' ? 'light' : 'dark';
|
|
40
|
-
const blurAmount = Math.max(0, Math.min(32, Math.round(intensity * 0.32)));
|
|
41
|
-
const fallbackColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK);
|
|
42
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
43
|
-
style: [_reactNative.StyleSheet.absoluteFill, style],
|
|
44
|
-
pointerEvents: "none",
|
|
45
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blur.BlurView, {
|
|
46
|
-
style: _reactNative.StyleSheet.absoluteFill,
|
|
47
|
-
blurType: blurType,
|
|
48
|
-
blurAmount: blurAmount,
|
|
49
|
-
reducedTransparencyFallbackColor: fallbackColor
|
|
50
|
-
}), overlayColor != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
51
|
-
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
52
|
-
backgroundColor: overlayColor
|
|
53
|
-
}]
|
|
54
|
-
}) : null, _reactNative.Platform.OS === 'android' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
55
|
-
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
56
|
-
backgroundColor: 'rgba(255,255,255,0.03)',
|
|
57
|
-
opacity: 0.6
|
|
58
|
-
}]
|
|
59
|
-
}) : null]
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
var _default = exports.default = GlassFill;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const DEFAULT_FALLBACK_DARK = '#1414174a';
|
|
12
|
-
const DEFAULT_FALLBACK_LIGHT = '#ffffff66';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Web counterpart of `GlassFill`.
|
|
16
|
-
*
|
|
17
|
-
* `@react-native-community/blur` does not ship a web implementation, so for
|
|
18
|
-
* the web bundle we render a translucent `View` with `backdrop-filter: blur()`
|
|
19
|
-
* — which is exactly how 0.0.67 and earlier shipped the glass effect on web.
|
|
20
|
-
* Native bundles pick up `GlassFill.tsx` instead via Metro's platform
|
|
21
|
-
* resolver; the web bundle picks up this file.
|
|
22
|
-
*/
|
|
23
|
-
function GlassFill({
|
|
24
|
-
tint = 'dark',
|
|
25
|
-
intensity = 50,
|
|
26
|
-
overlayColor,
|
|
27
|
-
style
|
|
28
|
-
}) {
|
|
29
|
-
// Approximate mapping: intensity 0-100 -> ~0-30px CSS blur. Keeps parity
|
|
30
|
-
// with the native blur strength so the component looks roughly the same
|
|
31
|
-
// across platforms.
|
|
32
|
-
const blurPx = Math.max(0, Math.min(30, Math.round(intensity * 0.3)));
|
|
33
|
-
const tintColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK);
|
|
34
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
35
|
-
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
36
|
-
backgroundColor: tintColor
|
|
37
|
-
},
|
|
38
|
-
// backdrop-filter is a web-only CSS property; ignored by RN
|
|
39
|
-
// on native (we never bundle this file there anyway).
|
|
40
|
-
// @ts-ignore web-only style
|
|
41
|
-
{
|
|
42
|
-
backdropFilter: `blur(${blurPx}px)`,
|
|
43
|
-
WebkitBackdropFilter: `blur(${blurPx}px)`
|
|
44
|
-
}, style],
|
|
45
|
-
pointerEvents: "none"
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
var _default = exports.default = GlassFill;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View, StyleSheet, Platform } from 'react-native';
|
|
5
|
-
import { BlurView } from '@react-native-community/blur';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
const DEFAULT_FALLBACK_DARK = '#1414174a';
|
|
8
|
-
const DEFAULT_FALLBACK_LIGHT = '#ffffff66';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Glass / frosted surface for native (iOS + Android).
|
|
12
|
-
*
|
|
13
|
-
* Why this lives in its own platform-split file:
|
|
14
|
-
* - `@react-native-community/blur` is a native-only module. Importing it on
|
|
15
|
-
* web throws because the JS shim references native components that aren't
|
|
16
|
-
* registered there. By using Metro's platform-extension resolution
|
|
17
|
-
* (`GlassFill.tsx` for native, `GlassFill.web.tsx` for web), we keep the
|
|
18
|
-
* web bundle free of any native-only imports.
|
|
19
|
-
* - Centralizes the `intensity` (0–100) -> `blurAmount` (0–32) mapping so
|
|
20
|
-
* callers can keep the Figma token semantics they already know.
|
|
21
|
-
*
|
|
22
|
-
* On iOS this is a real `UIVisualEffectView` (true OS-level live blur).
|
|
23
|
-
* On Android this uses the community blur view (RealtimeBlurView). On devices
|
|
24
|
-
* where realtime blur is unavailable, `reducedTransparencyFallbackColor` (and
|
|
25
|
-
* the explicit `overlayColor`) ensure the surface still renders as a
|
|
26
|
-
* translucent tinted scrim instead of disappearing.
|
|
27
|
-
*/
|
|
28
|
-
function GlassFill({
|
|
29
|
-
tint = 'dark',
|
|
30
|
-
intensity = 50,
|
|
31
|
-
overlayColor,
|
|
32
|
-
style
|
|
33
|
-
}) {
|
|
34
|
-
const blurType = tint === 'light' ? 'light' : 'dark';
|
|
35
|
-
const blurAmount = Math.max(0, Math.min(32, Math.round(intensity * 0.32)));
|
|
36
|
-
const fallbackColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK);
|
|
37
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
38
|
-
style: [StyleSheet.absoluteFill, style],
|
|
39
|
-
pointerEvents: "none",
|
|
40
|
-
children: [/*#__PURE__*/_jsx(BlurView, {
|
|
41
|
-
style: StyleSheet.absoluteFill,
|
|
42
|
-
blurType: blurType,
|
|
43
|
-
blurAmount: blurAmount,
|
|
44
|
-
reducedTransparencyFallbackColor: fallbackColor
|
|
45
|
-
}), overlayColor != null ? /*#__PURE__*/_jsx(View, {
|
|
46
|
-
style: [StyleSheet.absoluteFill, {
|
|
47
|
-
backgroundColor: overlayColor
|
|
48
|
-
}]
|
|
49
|
-
}) : null, Platform.OS === 'android' ? /*#__PURE__*/_jsx(View, {
|
|
50
|
-
style: [StyleSheet.absoluteFill, {
|
|
51
|
-
backgroundColor: 'rgba(255,255,255,0.03)',
|
|
52
|
-
opacity: 0.6
|
|
53
|
-
}]
|
|
54
|
-
}) : null]
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
export default GlassFill;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View, StyleSheet } from 'react-native';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const DEFAULT_FALLBACK_DARK = '#1414174a';
|
|
7
|
-
const DEFAULT_FALLBACK_LIGHT = '#ffffff66';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Web counterpart of `GlassFill`.
|
|
11
|
-
*
|
|
12
|
-
* `@react-native-community/blur` does not ship a web implementation, so for
|
|
13
|
-
* the web bundle we render a translucent `View` with `backdrop-filter: blur()`
|
|
14
|
-
* — which is exactly how 0.0.67 and earlier shipped the glass effect on web.
|
|
15
|
-
* Native bundles pick up `GlassFill.tsx` instead via Metro's platform
|
|
16
|
-
* resolver; the web bundle picks up this file.
|
|
17
|
-
*/
|
|
18
|
-
function GlassFill({
|
|
19
|
-
tint = 'dark',
|
|
20
|
-
intensity = 50,
|
|
21
|
-
overlayColor,
|
|
22
|
-
style
|
|
23
|
-
}) {
|
|
24
|
-
// Approximate mapping: intensity 0-100 -> ~0-30px CSS blur. Keeps parity
|
|
25
|
-
// with the native blur strength so the component looks roughly the same
|
|
26
|
-
// across platforms.
|
|
27
|
-
const blurPx = Math.max(0, Math.min(30, Math.round(intensity * 0.3)));
|
|
28
|
-
const tintColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK);
|
|
29
|
-
return /*#__PURE__*/_jsx(View, {
|
|
30
|
-
style: [StyleSheet.absoluteFill, {
|
|
31
|
-
backgroundColor: tintColor
|
|
32
|
-
},
|
|
33
|
-
// backdrop-filter is a web-only CSS property; ignored by RN
|
|
34
|
-
// on native (we never bundle this file there anyway).
|
|
35
|
-
// @ts-ignore web-only style
|
|
36
|
-
{
|
|
37
|
-
backdropFilter: `blur(${blurPx}px)`,
|
|
38
|
-
WebkitBackdropFilter: `blur(${blurPx}px)`
|
|
39
|
-
}, style],
|
|
40
|
-
pointerEvents: "none"
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
export default GlassFill;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main extraction function
|
|
3
|
-
*/
|
|
4
|
-
export function extractAllTokens(): {};
|
|
5
|
-
/**
|
|
6
|
-
* Backwards-compatible helper: just the token names for a file.
|
|
7
|
-
*/
|
|
8
|
-
export function extractTokensFromFile(filePath: any): any[];
|
|
9
|
-
//# sourceMappingURL=extract-component-tokens.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main generation function
|
|
3
|
-
*/
|
|
4
|
-
export function generateAllDocs(): void;
|
|
5
|
-
/**
|
|
6
|
-
* Generate MDX documentation for a component
|
|
7
|
-
*/
|
|
8
|
-
export function generateMDX(componentName: any, metadata: any, componentPath: any): string;
|
|
9
|
-
//# sourceMappingURL=generate-component-docs.d.ts.map
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { type ViewStyle, type StyleProp } from 'react-native';
|
|
2
|
-
export type GlassTint = 'dark' | 'light';
|
|
3
|
-
export interface GlassFillProps {
|
|
4
|
-
/**
|
|
5
|
-
* Visual tint of the glass surface. Maps to `BlurView`'s `blurType`
|
|
6
|
-
* (`'dark'` | `'light'`). The library also drives the appropriate
|
|
7
|
-
* `reducedTransparencyFallbackColor` from this so iOS gracefully degrades
|
|
8
|
-
* when "Reduce Transparency" is enabled in system accessibility settings.
|
|
9
|
-
*/
|
|
10
|
-
tint?: GlassTint;
|
|
11
|
-
/**
|
|
12
|
-
* Blur strength as a 0–100 "intensity" value (kept compatible with the
|
|
13
|
-
* previous `expo-blur` API so consumers don't need to relearn the scale).
|
|
14
|
-
* Internally mapped to `@react-native-community/blur`'s `blurAmount`,
|
|
15
|
-
* which is roughly 0–32 on iOS / Android.
|
|
16
|
-
*/
|
|
17
|
-
intensity?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Token-derived color tint laid OVER the live blur (Figma `blur/minimal/background`).
|
|
20
|
-
* Painted as a translucent overlay so the glass keeps the design system
|
|
21
|
-
* color signature even when the platform blur quality varies.
|
|
22
|
-
*/
|
|
23
|
-
overlayColor?: string;
|
|
24
|
-
/** Container style overrides. Defaults to `StyleSheet.absoluteFill`. */
|
|
25
|
-
style?: StyleProp<ViewStyle>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Glass / frosted surface for native (iOS + Android).
|
|
29
|
-
*
|
|
30
|
-
* Why this lives in its own platform-split file:
|
|
31
|
-
* - `@react-native-community/blur` is a native-only module. Importing it on
|
|
32
|
-
* web throws because the JS shim references native components that aren't
|
|
33
|
-
* registered there. By using Metro's platform-extension resolution
|
|
34
|
-
* (`GlassFill.tsx` for native, `GlassFill.web.tsx` for web), we keep the
|
|
35
|
-
* web bundle free of any native-only imports.
|
|
36
|
-
* - Centralizes the `intensity` (0–100) -> `blurAmount` (0–32) mapping so
|
|
37
|
-
* callers can keep the Figma token semantics they already know.
|
|
38
|
-
*
|
|
39
|
-
* On iOS this is a real `UIVisualEffectView` (true OS-level live blur).
|
|
40
|
-
* On Android this uses the community blur view (RealtimeBlurView). On devices
|
|
41
|
-
* where realtime blur is unavailable, `reducedTransparencyFallbackColor` (and
|
|
42
|
-
* the explicit `overlayColor`) ensure the surface still renders as a
|
|
43
|
-
* translucent tinted scrim instead of disappearing.
|
|
44
|
-
*/
|
|
45
|
-
declare function GlassFill({ tint, intensity, overlayColor, style, }: GlassFillProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
-
export default GlassFill;
|
|
47
|
-
//# sourceMappingURL=GlassFill.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type ViewStyle, type StyleProp } from 'react-native';
|
|
2
|
-
export type GlassTint = 'dark' | 'light';
|
|
3
|
-
export interface GlassFillProps {
|
|
4
|
-
tint?: GlassTint;
|
|
5
|
-
intensity?: number;
|
|
6
|
-
overlayColor?: string;
|
|
7
|
-
style?: StyleProp<ViewStyle>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Web counterpart of `GlassFill`.
|
|
11
|
-
*
|
|
12
|
-
* `@react-native-community/blur` does not ship a web implementation, so for
|
|
13
|
-
* the web bundle we render a translucent `View` with `backdrop-filter: blur()`
|
|
14
|
-
* — which is exactly how 0.0.67 and earlier shipped the glass effect on web.
|
|
15
|
-
* Native bundles pick up `GlassFill.tsx` instead via Metro's platform
|
|
16
|
-
* resolver; the web bundle picks up this file.
|
|
17
|
-
*/
|
|
18
|
-
declare function GlassFill({ tint, intensity, overlayColor, style, }: GlassFillProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export default GlassFill;
|
|
20
|
-
//# sourceMappingURL=GlassFill.web.d.ts.map
|
|
@@ -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
|