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
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _blur = require("@react-native-community/blur");
|
|
10
|
+
var _maskedView = _interopRequireDefault(require("@react-native-masked-view/masked-view"));
|
|
11
|
+
var _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
const DEFAULT_FALLBACK_DARK = '#1414174a';
|
|
16
|
+
const DEFAULT_FALLBACK_LIGHT = '#ffffff66';
|
|
17
|
+
|
|
18
|
+
// The native view-manager name registered by `@react-native-community/blur`
|
|
19
|
+
// (`AndroidBlurView` on Android, `BlurView` on iOS).
|
|
20
|
+
const NATIVE_BLUR_NAME = _reactNative.Platform.OS === 'android' ? 'AndroidBlurView' : 'BlurView';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Alpha stop on a layer's vertical reveal mask. `offset` is the vertical
|
|
24
|
+
* position (0 = top of the surface, 1 = bottom); `opacity` is the mask alpha
|
|
25
|
+
* there (0 = layer hidden / fully clear, 1 = layer fully applied).
|
|
26
|
+
*
|
|
27
|
+
* Using several stops (rather than a single linear 0 → 1 ramp) lets each layer
|
|
28
|
+
* EASE in, so the blur swells smoothly toward the bottom instead of appearing
|
|
29
|
+
* along a hard horizontal seam. That soft S-curve is what gives the surface its
|
|
30
|
+
* "glass" feel rather than a flat translucent panel.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A single layer of the progressive ramp.
|
|
35
|
+
* - `stops` describe how this layer is revealed from top to bottom.
|
|
36
|
+
* - `amount` is this layer's share (0–1) of the max `blurAmount`.
|
|
37
|
+
*
|
|
38
|
+
* We stack just TWO layers on both platforms: a faint base blur that covers
|
|
39
|
+
* most of the footer and a slightly stronger accent concentrated near the
|
|
40
|
+
* bottom. Keeping the overlap shallow avoids compounding the dark tint of
|
|
41
|
+
* multiple `BlurView`s (which is what made the earlier 3-layer ramp read as a
|
|
42
|
+
* heavy block), while still giving a genuine variable-radius result — the blur
|
|
43
|
+
* radius grows toward the bottom where the two layers overlap.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
// Base reveal: a faint trace of blur begins near the very top and grows
|
|
47
|
+
// steadily downward, so the upper half still carries visible glass rather than
|
|
48
|
+
// snapping clear. Also reused for the no-native-blur fallback scrim.
|
|
49
|
+
const BASE_MASK_STOPS = [{
|
|
50
|
+
offset: 0.0,
|
|
51
|
+
opacity: 0
|
|
52
|
+
}, {
|
|
53
|
+
offset: 0.08,
|
|
54
|
+
opacity: 0.12
|
|
55
|
+
}, {
|
|
56
|
+
offset: 0.35,
|
|
57
|
+
opacity: 0.4
|
|
58
|
+
}, {
|
|
59
|
+
offset: 0.65,
|
|
60
|
+
opacity: 0.8
|
|
61
|
+
}, {
|
|
62
|
+
offset: 1.0,
|
|
63
|
+
opacity: 1
|
|
64
|
+
}];
|
|
65
|
+
const PROGRESSIVE_LAYERS = [{
|
|
66
|
+
amount: 0.65,
|
|
67
|
+
stops: BASE_MASK_STOPS
|
|
68
|
+
},
|
|
69
|
+
// Accent: the strongest blur, gathering over the lower portion for depth.
|
|
70
|
+
{
|
|
71
|
+
amount: 1.0,
|
|
72
|
+
stops: [{
|
|
73
|
+
offset: 0.0,
|
|
74
|
+
opacity: 0
|
|
75
|
+
}, {
|
|
76
|
+
offset: 0.3,
|
|
77
|
+
opacity: 0.15
|
|
78
|
+
}, {
|
|
79
|
+
offset: 0.65,
|
|
80
|
+
opacity: 0.65
|
|
81
|
+
}, {
|
|
82
|
+
offset: 1.0,
|
|
83
|
+
opacity: 1
|
|
84
|
+
}]
|
|
85
|
+
}];
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Probe ONCE whether the native blur view is actually present in this binary.
|
|
89
|
+
*
|
|
90
|
+
* `@react-native-community/blur` is a peer dependency so its JS always imports,
|
|
91
|
+
* but on a build where the native module was never linked (e.g. `pod install`
|
|
92
|
+
* wasn't run on iOS) rendering `<BlurView>` shows React Native's red
|
|
93
|
+
* "Unimplemented component <BlurView>" placeholder. Detecting availability up
|
|
94
|
+
* front lets us fall back to a tinted scrim instead of crashing the surface.
|
|
95
|
+
*
|
|
96
|
+
* - New architecture (bridgeless): `getViewManagerConfig` raises a soft error,
|
|
97
|
+
* so we MUST use `hasViewManagerConfig` -> Fabric component registry.
|
|
98
|
+
* - Old architecture (Paper): `getViewManagerConfig` returns null when the
|
|
99
|
+
* view manager isn't registered.
|
|
100
|
+
*/
|
|
101
|
+
const NATIVE_BLUR_SUPPORTED = (() => {
|
|
102
|
+
try {
|
|
103
|
+
const um = _reactNative.UIManager;
|
|
104
|
+
if (typeof um.hasViewManagerConfig === 'function') {
|
|
105
|
+
return um.hasViewManagerConfig(NATIVE_BLUR_NAME) === true;
|
|
106
|
+
}
|
|
107
|
+
if (typeof um.getViewManagerConfig === 'function') {
|
|
108
|
+
return um.getViewManagerConfig(NATIVE_BLUR_NAME) != null;
|
|
109
|
+
}
|
|
110
|
+
} catch {
|
|
111
|
+
// Any probe failure -> treat blur as unavailable and use the fallback.
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
})();
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Vertical alpha-gradient mask drawn with `react-native-svg`. `MaskedView`
|
|
118
|
+
* reveals its child in proportion to this mask's alpha, so feeding it an eased
|
|
119
|
+
* multi-stop gradient makes the layer's blur swell in smoothly from top to
|
|
120
|
+
* bottom instead of along a hard seam.
|
|
121
|
+
*/
|
|
122
|
+
function GradientMask({
|
|
123
|
+
id,
|
|
124
|
+
stops
|
|
125
|
+
}) {
|
|
126
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeSvg.default, {
|
|
127
|
+
width: "100%",
|
|
128
|
+
height: "100%",
|
|
129
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Defs, {
|
|
130
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.LinearGradient, {
|
|
131
|
+
id: id,
|
|
132
|
+
x1: "0",
|
|
133
|
+
y1: "0",
|
|
134
|
+
x2: "0",
|
|
135
|
+
y2: "1",
|
|
136
|
+
children: stops.map((s, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Stop, {
|
|
137
|
+
offset: s.offset,
|
|
138
|
+
stopColor: "#000000",
|
|
139
|
+
stopOpacity: s.opacity
|
|
140
|
+
}, i))
|
|
141
|
+
})
|
|
142
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Rect, {
|
|
143
|
+
x: "0",
|
|
144
|
+
y: "0",
|
|
145
|
+
width: "100%",
|
|
146
|
+
height: "100%",
|
|
147
|
+
fill: `url(#${id})`
|
|
148
|
+
})]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Shared glass / frosted surface for native (iOS + Android).
|
|
154
|
+
*
|
|
155
|
+
* This is the single source of truth for the glass effect used by `MediaCard`,
|
|
156
|
+
* `ProductMerchandisingCard`, `Badge`, and any future consumer. It supersedes
|
|
157
|
+
* the per-component `GlassFill` copies that previously drifted apart.
|
|
158
|
+
*
|
|
159
|
+
* Why this lives in its own platform-split file:
|
|
160
|
+
* - `@react-native-community/blur` is a native-only module; importing it on
|
|
161
|
+
* web throws because it references native components not registered there.
|
|
162
|
+
* Metro's platform-extension resolution picks `GlassFill.tsx` for native
|
|
163
|
+
* and `GlassFill.web.tsx` for web, keeping the web bundle native-free.
|
|
164
|
+
* - Centralizes the `intensity` (0–100) -> `blurAmount` (0–32) mapping so the
|
|
165
|
+
* Figma `blur/minimal` token semantics survive across platforms.
|
|
166
|
+
*
|
|
167
|
+
* On iOS (with the pod installed) this is a real `UIVisualEffectView` (true
|
|
168
|
+
* OS-level live blur). On Android it uses the community blur view. When the
|
|
169
|
+
* native module isn't linked in the running binary, the component degrades to
|
|
170
|
+
* a translucent tinted scrim (`reducedTransparencyFallbackColor` / fallback
|
|
171
|
+
* color) instead of rendering the "Unimplemented component" placeholder.
|
|
172
|
+
*
|
|
173
|
+
* NOTE: the consumer MUST clip this with `overflow: 'hidden'` on a rounded
|
|
174
|
+
* parent — the native blur view does not honor `borderRadius` itself.
|
|
175
|
+
*/
|
|
176
|
+
function GlassFill({
|
|
177
|
+
tint = 'dark',
|
|
178
|
+
intensity = 50,
|
|
179
|
+
overlayColor,
|
|
180
|
+
progressive = false,
|
|
181
|
+
androidTintWash = true,
|
|
182
|
+
style
|
|
183
|
+
}) {
|
|
184
|
+
const rawId = (0, _react.useId)();
|
|
185
|
+
const maskId = `glass-mask-${rawId.replace(/[^a-zA-Z0-9_-]/g, '')}`;
|
|
186
|
+
const blurType = tint === 'light' ? 'light' : 'dark';
|
|
187
|
+
const uniformBlurAmount = Math.max(0, Math.min(32, Math.round(intensity * 0.32)));
|
|
188
|
+
const fallbackColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK);
|
|
189
|
+
|
|
190
|
+
// ----- Progressive (variable) blur -------------------------------------
|
|
191
|
+
if (progressive) {
|
|
192
|
+
// Peak blur radius (at the bottom). Full strength so the frosted glass
|
|
193
|
+
// is clearly engaged where the layers overlap, while the eased masks
|
|
194
|
+
// keep the top of the surface fully clear.
|
|
195
|
+
const peakBlur = Math.max(1, Math.min(32, Math.round(intensity * 0.32)));
|
|
196
|
+
|
|
197
|
+
// Native blur not linked -> tint eases from transparent (top) to a soft
|
|
198
|
+
// fallback color (bottom) so the surface still reads as gentle glass.
|
|
199
|
+
if (!NATIVE_BLUR_SUPPORTED) {
|
|
200
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
201
|
+
style: [_reactNative.StyleSheet.absoluteFill, style],
|
|
202
|
+
pointerEvents: "none",
|
|
203
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_maskedView.default, {
|
|
204
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
205
|
+
maskElement: /*#__PURE__*/(0, _jsxRuntime.jsx)(GradientMask, {
|
|
206
|
+
id: `${maskId}-fb`,
|
|
207
|
+
stops: BASE_MASK_STOPS
|
|
208
|
+
}),
|
|
209
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
210
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
211
|
+
backgroundColor: fallbackColor
|
|
212
|
+
}]
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
218
|
+
style: [_reactNative.StyleSheet.absoluteFill, style],
|
|
219
|
+
pointerEvents: "none",
|
|
220
|
+
children: PROGRESSIVE_LAYERS.map((layer, i) => {
|
|
221
|
+
const amount = Math.max(1, Math.round(peakBlur * layer.amount));
|
|
222
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_maskedView.default, {
|
|
223
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
224
|
+
maskElement: /*#__PURE__*/(0, _jsxRuntime.jsx)(GradientMask, {
|
|
225
|
+
id: `${maskId}-${i}`,
|
|
226
|
+
stops: layer.stops
|
|
227
|
+
}),
|
|
228
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blur.BlurView, {
|
|
229
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
230
|
+
blurType: blurType,
|
|
231
|
+
blurAmount: amount,
|
|
232
|
+
reducedTransparencyFallbackColor: fallbackColor
|
|
233
|
+
})
|
|
234
|
+
}, i);
|
|
235
|
+
})
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// ----- Uniform blur (default) ------------------------------------------
|
|
240
|
+
// Native blur not linked in this build -> render a translucent tinted scrim
|
|
241
|
+
// so the surface still reads as frosted glass and never shows RN's
|
|
242
|
+
// "Unimplemented component <BlurView>" box.
|
|
243
|
+
if (!NATIVE_BLUR_SUPPORTED) {
|
|
244
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
245
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
246
|
+
backgroundColor: fallbackColor
|
|
247
|
+
}, style],
|
|
248
|
+
pointerEvents: "none"
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
252
|
+
style: [_reactNative.StyleSheet.absoluteFill, style],
|
|
253
|
+
pointerEvents: "none",
|
|
254
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blur.BlurView, {
|
|
255
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
256
|
+
blurType: blurType,
|
|
257
|
+
blurAmount: uniformBlurAmount,
|
|
258
|
+
reducedTransparencyFallbackColor: fallbackColor
|
|
259
|
+
}), overlayColor != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
260
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
261
|
+
backgroundColor: overlayColor
|
|
262
|
+
}]
|
|
263
|
+
}) : null, _reactNative.Platform.OS === 'android' && androidTintWash ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
264
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
265
|
+
backgroundColor: 'rgba(255,255,255,0.03)',
|
|
266
|
+
opacity: 0.6
|
|
267
|
+
}]
|
|
268
|
+
}) : null]
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
var _default = exports.default = GlassFill;
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
const DEFAULT_WEB_BLUR_SCALE = 0.32;
|
|
14
|
+
const DEFAULT_WEB_BLUR_MAX_PX = 32;
|
|
15
|
+
|
|
16
|
+
// Mirror of the native ramp (see GlassFill.tsx). Each layer is a `mask-image`
|
|
17
|
+
// gradient whose alpha stops (0 = top, 1 = bottom) ease the blur in; `amount`
|
|
18
|
+
// is the layer's share of the max blur. Two gently-overlapping layers (faint
|
|
19
|
+
// base + bottom accent) keep the surface subtle and glass-like rather than a
|
|
20
|
+
// heavy frosted block.
|
|
21
|
+
|
|
22
|
+
const PROGRESSIVE_LAYERS = [{
|
|
23
|
+
amount: 0.65,
|
|
24
|
+
stops: [{
|
|
25
|
+
offset: 0.0,
|
|
26
|
+
opacity: 0
|
|
27
|
+
}, {
|
|
28
|
+
offset: 0.08,
|
|
29
|
+
opacity: 0.12
|
|
30
|
+
}, {
|
|
31
|
+
offset: 0.35,
|
|
32
|
+
opacity: 0.4
|
|
33
|
+
}, {
|
|
34
|
+
offset: 0.65,
|
|
35
|
+
opacity: 0.8
|
|
36
|
+
}, {
|
|
37
|
+
offset: 1.0,
|
|
38
|
+
opacity: 1
|
|
39
|
+
}]
|
|
40
|
+
}, {
|
|
41
|
+
amount: 1.0,
|
|
42
|
+
stops: [{
|
|
43
|
+
offset: 0.0,
|
|
44
|
+
opacity: 0
|
|
45
|
+
}, {
|
|
46
|
+
offset: 0.3,
|
|
47
|
+
opacity: 0.15
|
|
48
|
+
}, {
|
|
49
|
+
offset: 0.65,
|
|
50
|
+
opacity: 0.65
|
|
51
|
+
}, {
|
|
52
|
+
offset: 1.0,
|
|
53
|
+
opacity: 1
|
|
54
|
+
}]
|
|
55
|
+
}];
|
|
56
|
+
function toGradient(stops) {
|
|
57
|
+
const parts = stops.map(s => `rgba(0,0,0,${s.opacity}) ${Math.round(s.offset * 100)}%`).join(', ');
|
|
58
|
+
return `linear-gradient(to bottom, ${parts})`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Web counterpart of the shared `GlassFill`.
|
|
63
|
+
*
|
|
64
|
+
* `@react-native-community/blur` ships no web implementation, so on web we
|
|
65
|
+
* render a translucent `View` with `backdrop-filter: blur()`. Native bundles
|
|
66
|
+
* pick up `GlassFill.tsx` instead via Metro's platform resolver; the web
|
|
67
|
+
* bundle picks up this file, so the native-only module is never imported here.
|
|
68
|
+
*/
|
|
69
|
+
function GlassFill({
|
|
70
|
+
tint = 'dark',
|
|
71
|
+
intensity = 50,
|
|
72
|
+
overlayColor,
|
|
73
|
+
progressive = false,
|
|
74
|
+
webBlurScale = DEFAULT_WEB_BLUR_SCALE,
|
|
75
|
+
webBlurMaxPx = DEFAULT_WEB_BLUR_MAX_PX,
|
|
76
|
+
style
|
|
77
|
+
}) {
|
|
78
|
+
// intensity 0-100 -> ~0-maxPx CSS blur, kept in parity with the native scale.
|
|
79
|
+
const blurPx = Math.max(0, Math.min(webBlurMaxPx, Math.round(intensity * webBlurScale)));
|
|
80
|
+
const tintColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK);
|
|
81
|
+
if (progressive) {
|
|
82
|
+
// Full peak blur (parity with native) so the frosted glass is clearly
|
|
83
|
+
// engaged at the bottom; the eased masks keep the top fully clear.
|
|
84
|
+
const peakPx = Math.max(1, Math.min(webBlurMaxPx, Math.round(intensity * webBlurScale)));
|
|
85
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
86
|
+
style: [_reactNative.StyleSheet.absoluteFill, style],
|
|
87
|
+
pointerEvents: "none",
|
|
88
|
+
children: PROGRESSIVE_LAYERS.map((layer, i) => {
|
|
89
|
+
const px = Math.max(1, Math.round(peakPx * layer.amount));
|
|
90
|
+
const gradient = toGradient(layer.stops);
|
|
91
|
+
// web-only CSS (backdrop-filter / mask-image); cast because
|
|
92
|
+
// these keys aren't in RN's ViewStyle.
|
|
93
|
+
const webStyle = {
|
|
94
|
+
backdropFilter: `blur(${px}px)`,
|
|
95
|
+
WebkitBackdropFilter: `blur(${px}px)`,
|
|
96
|
+
maskImage: gradient,
|
|
97
|
+
WebkitMaskImage: gradient
|
|
98
|
+
};
|
|
99
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
100
|
+
style: [_reactNative.StyleSheet.absoluteFill, webStyle],
|
|
101
|
+
pointerEvents: "none"
|
|
102
|
+
}, i);
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
107
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
108
|
+
backgroundColor: tintColor
|
|
109
|
+
},
|
|
110
|
+
// backdrop-filter is web-only CSS; ignored by RN on native
|
|
111
|
+
// (we never bundle this file there anyway).
|
|
112
|
+
// @ts-ignore web-only style
|
|
113
|
+
{
|
|
114
|
+
backdropFilter: `blur(${blurPx}px)`,
|
|
115
|
+
WebkitBackdropFilter: `blur(${blurPx}px)`
|
|
116
|
+
}, style],
|
|
117
|
+
pointerEvents: "none"
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
var _default = exports.default = GlassFill;
|
|
@@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.EMPTY_MODES = void 0;
|
|
7
7
|
exports.cloneChildrenWithModes = cloneChildrenWithModes;
|
|
8
8
|
exports.flattenChildren = flattenChildren;
|
|
9
|
+
exports.injectChildStyle = injectChildStyle;
|
|
10
|
+
exports.mergeRefs = mergeRefs;
|
|
11
|
+
exports.resolveTruncation = resolveTruncation;
|
|
9
12
|
var _react = _interopRequireDefault(require("react"));
|
|
10
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
14
|
/**
|
|
@@ -79,6 +82,81 @@ function cloneChildrenWithModes(children, modes, forcedModes) {
|
|
|
79
82
|
return _react.default.Children.toArray(result);
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Merges a style onto each direct (top-level) child element, with the injected
|
|
87
|
+
* style taking precedence over the child's own style.
|
|
88
|
+
*
|
|
89
|
+
* Used by the Stack family to *enforce* cross-axis stretching from the container
|
|
90
|
+
* itself: a child can set its own `alignSelf` (which, per the flexbox spec,
|
|
91
|
+
* overrides the parent's `alignItems`), so to guarantee equal heights / full
|
|
92
|
+
* width regardless of what individual children declare, we append
|
|
93
|
+
* `{ alignSelf: 'stretch' }` to every direct child.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* - Only top-level children are touched. Grandchildren are intentionally left
|
|
97
|
+
* alone — we never want to leak layout styles deeper into the tree.
|
|
98
|
+
* - Non-element children (strings, numbers) are passed through untouched.
|
|
99
|
+
* - This relies on the child forwarding `style` to its outer/root view. Built-in
|
|
100
|
+
* RN primitives and components that spread `style` onto their root honour it;
|
|
101
|
+
* a child that fully ignores `style` cannot be forced (this is a hard React
|
|
102
|
+
* Native limitation, not something this helper can work around).
|
|
103
|
+
* - Per Yoga, stretch has no effect on an axis where the child has a *fixed*
|
|
104
|
+
* dimension (e.g. an explicit `height` for a row). Such children opt out by
|
|
105
|
+
* design; this helper does not strip explicit dimensions.
|
|
106
|
+
*/
|
|
107
|
+
function injectChildStyle(children, style) {
|
|
108
|
+
return _react.default.Children.map(children, child => {
|
|
109
|
+
if (! /*#__PURE__*/_react.default.isValidElement(child)) {
|
|
110
|
+
return child;
|
|
111
|
+
}
|
|
112
|
+
const existingStyle = child.props?.style;
|
|
113
|
+
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
114
|
+
style: existingStyle != null ? [existingStyle, style] : style
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Combines several refs (object refs and/or callback refs) into a single
|
|
121
|
+
* callback ref. Useful when a component needs to keep its own internal ref to a
|
|
122
|
+
* node while still honouring a ref forwarded by the consumer.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* const inputRef = useRef<RNTextInput>(null)
|
|
126
|
+
* <RNTextInput ref={mergeRefs(inputRef, forwardedRef)} />
|
|
127
|
+
*/
|
|
128
|
+
function mergeRefs(...refs) {
|
|
129
|
+
return value => {
|
|
130
|
+
refs.forEach(ref => {
|
|
131
|
+
if (typeof ref === 'function') {
|
|
132
|
+
ref(value);
|
|
133
|
+
} else if (ref != null) {
|
|
134
|
+
ref.current = value;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Resolves the `numberOfLines` / `ellipsizeMode` pair for a `<Text>` based on a
|
|
141
|
+
* `disableTruncation` flag.
|
|
142
|
+
*
|
|
143
|
+
* When `disableTruncation` is `true`, both values are returned as `undefined`
|
|
144
|
+
* so the text wraps to as many lines as it needs and never shows the trailing
|
|
145
|
+
* ellipsis. Otherwise the provided values are passed through unchanged.
|
|
146
|
+
*/
|
|
147
|
+
function resolveTruncation(disableTruncation, numberOfLines, ellipsizeMode) {
|
|
148
|
+
if (disableTruncation) {
|
|
149
|
+
return {
|
|
150
|
+
numberOfLines: undefined,
|
|
151
|
+
ellipsizeMode: undefined
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
numberOfLines,
|
|
156
|
+
ellipsizeMode
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
82
160
|
/**
|
|
83
161
|
* Flattens React children, extracting them from Fragments.
|
|
84
162
|
* Useful for Group components that need to process individual items (e.g., for layout or styling)
|
|
@@ -10,6 +10,8 @@ exports.getWebAccessibilityProps = getWebAccessibilityProps;
|
|
|
10
10
|
exports.isWeb = exports.isNative = void 0;
|
|
11
11
|
exports.useKeyboardNavigation = useKeyboardNavigation;
|
|
12
12
|
exports.usePressableWebSupport = usePressableWebSupport;
|
|
13
|
+
exports.useWebOutsidePress = useWebOutsidePress;
|
|
14
|
+
var _react = require("react");
|
|
13
15
|
var _reactNative = require("react-native");
|
|
14
16
|
/**
|
|
15
17
|
* Web-specific props that should NOT be passed to React Native's Pressable component.
|
|
@@ -201,6 +203,63 @@ function usePressableWebSupport({
|
|
|
201
203
|
};
|
|
202
204
|
}
|
|
203
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Detects pointer presses (mouse / touch) that land OUTSIDE the node held by
|
|
208
|
+
* `containerRef` and invokes `onOutsidePress`.
|
|
209
|
+
*
|
|
210
|
+
* Why this exists:
|
|
211
|
+
* On web, React Native pressables (`Pressable`, `Button`, links, etc.) do not
|
|
212
|
+
* always claim DOM focus the way a native `<button>`/`<input>` does. As a
|
|
213
|
+
* result, tapping an *interactive* element outside a focused `<input>` may
|
|
214
|
+
* never trigger the input's native `blur` event, leaving a field stuck in its
|
|
215
|
+
* "Active" visual state. Listening for document-level pointer-down in the
|
|
216
|
+
* capture phase lets a component force a blur (or close a popover, etc.)
|
|
217
|
+
* regardless of whether the outside target takes focus.
|
|
218
|
+
*
|
|
219
|
+
* Behavior & safety:
|
|
220
|
+
* - **Web only.** On native (or when `document` is unavailable) this is a
|
|
221
|
+
* no-op, so it is safe to call unconditionally.
|
|
222
|
+
* - Listeners are attached only while `enabled` is `true`, and are removed on
|
|
223
|
+
* cleanup / when disabled — there is no standing global listener.
|
|
224
|
+
* - Uses the **capture** phase so it runs before element-level handlers, and
|
|
225
|
+
* listens to both `mousedown` and `touchstart` for parity across devices.
|
|
226
|
+
* - The latest `onOutsidePress` is read through a ref, so passing a fresh
|
|
227
|
+
* inline closure every render does NOT re-subscribe the listener.
|
|
228
|
+
*
|
|
229
|
+
* @param containerRef - Ref to the root host node to treat as "inside".
|
|
230
|
+
* @param onOutsidePress - Called when a pointer press occurs outside the node.
|
|
231
|
+
* @param enabled - When `false`, no listener is attached. Defaults to `true`.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```tsx
|
|
235
|
+
* const rootRef = useRef<View>(null)
|
|
236
|
+
* const inputRef = useRef<RNTextInput>(null)
|
|
237
|
+
* useWebOutsidePress(rootRef, () => inputRef.current?.blur(), isFocused)
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
function useWebOutsidePress(containerRef, onOutsidePress, enabled = true) {
|
|
241
|
+
const callbackRef = (0, _react.useRef)(onOutsidePress);
|
|
242
|
+
callbackRef.current = onOutsidePress;
|
|
243
|
+
(0, _react.useEffect)(() => {
|
|
244
|
+
if (_reactNative.Platform.OS !== 'web' || typeof document === 'undefined' || !enabled) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const handlePointerDown = event => {
|
|
248
|
+
const node = containerRef.current;
|
|
249
|
+
const target = event.target;
|
|
250
|
+
if (node?.contains && !node.contains(target)) {
|
|
251
|
+
callbackRef.current();
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
document.addEventListener('mousedown', handlePointerDown, true);
|
|
255
|
+
document.addEventListener('touchstart', handlePointerDown, true);
|
|
256
|
+
return () => {
|
|
257
|
+
document.removeEventListener('mousedown', handlePointerDown, true);
|
|
258
|
+
document.removeEventListener('touchstart', handlePointerDown, true);
|
|
259
|
+
};
|
|
260
|
+
}, [containerRef, enabled]);
|
|
261
|
+
}
|
|
262
|
+
|
|
204
263
|
/**
|
|
205
264
|
* Type guard to check if running on web platform
|
|
206
265
|
*/
|
|
@@ -5,7 +5,7 @@ import { View, Text, Pressable, LayoutAnimation, Platform, UIManager } from 'rea
|
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
6
|
import Icon from '../../icons/Icon';
|
|
7
7
|
import { usePressableWebSupport } from '../../utils/web-platform-utils';
|
|
8
|
-
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
|
|
8
|
+
import { EMPTY_MODES, cloneChildrenWithModes, resolveTruncation } from '../../utils/react-utils';
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
// Enable LayoutAnimation on Android
|
|
11
11
|
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
|
|
@@ -61,6 +61,7 @@ function Accordion({
|
|
|
61
61
|
accessibilityHint,
|
|
62
62
|
accessibilityState,
|
|
63
63
|
webAccessibilityProps,
|
|
64
|
+
disableTruncation,
|
|
64
65
|
...rest
|
|
65
66
|
}) {
|
|
66
67
|
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
@@ -160,7 +161,7 @@ function Accordion({
|
|
|
160
161
|
...webProps,
|
|
161
162
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
162
163
|
style: titleStyle,
|
|
163
|
-
|
|
164
|
+
...resolveTruncation(disableTruncation, 1),
|
|
164
165
|
children: title
|
|
165
166
|
}), /*#__PURE__*/_jsx(Icon, {
|
|
166
167
|
name: isExpanded ? 'ic_minus' : 'ic_add',
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useCallback, useState } from 'react';
|
|
4
4
|
import { View, Text, Pressable, LayoutAnimation, Platform, UIManager } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
-
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
|
|
6
|
+
import { EMPTY_MODES, cloneChildrenWithModes, resolveTruncation } from '../../utils/react-utils';
|
|
7
7
|
import Checkbox from '../Checkbox/Checkbox';
|
|
8
8
|
import Divider from '../Divider/Divider';
|
|
9
9
|
import Icon from '../../icons/Icon';
|
|
@@ -58,7 +58,8 @@ function AccordionCheckbox({
|
|
|
58
58
|
children,
|
|
59
59
|
modes = EMPTY_MODES,
|
|
60
60
|
style,
|
|
61
|
-
accessibilityLabel
|
|
61
|
+
accessibilityLabel,
|
|
62
|
+
disableTruncation
|
|
62
63
|
}) {
|
|
63
64
|
const isExpandedControlled = controlledExpanded !== undefined;
|
|
64
65
|
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
@@ -203,12 +204,12 @@ function AccordionCheckbox({
|
|
|
203
204
|
style: textWrapStyle,
|
|
204
205
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
205
206
|
style: titleStyle,
|
|
206
|
-
|
|
207
|
+
...resolveTruncation(disableTruncation, 1),
|
|
207
208
|
selectable: false,
|
|
208
209
|
children: title
|
|
209
210
|
}), subtitle ? /*#__PURE__*/_jsx(Text, {
|
|
210
211
|
style: subtitleStyle,
|
|
211
|
-
|
|
212
|
+
...resolveTruncation(disableTruncation, 1),
|
|
212
213
|
selectable: false,
|
|
213
214
|
children: subtitle
|
|
214
215
|
}) : null]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
4
4
|
import { Image as RNImage, Platform, Pressable, Text, View } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
-
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
|
|
6
|
+
import { EMPTY_MODES, cloneChildrenWithModes, resolveTruncation } from '../../utils/react-utils';
|
|
7
7
|
import Icon from '../../icons/Icon';
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
9
|
const IS_IOS = Platform.OS === 'ios';
|
|
@@ -72,7 +72,8 @@ function AccountCard({
|
|
|
72
72
|
modes = EMPTY_MODES,
|
|
73
73
|
style,
|
|
74
74
|
accessibilityLabel,
|
|
75
|
-
accessibilityHint
|
|
75
|
+
accessibilityHint,
|
|
76
|
+
disableTruncation
|
|
76
77
|
}) {
|
|
77
78
|
const iconModes = useMemo(() => modes === EMPTY_MODES ? ADD_ICON_DEFAULT_MODES : {
|
|
78
79
|
...ADD_ICON_DEFAULT_MODES,
|
|
@@ -205,11 +206,11 @@ function AccountCard({
|
|
|
205
206
|
},
|
|
206
207
|
children: [title != null && title !== '' ? /*#__PURE__*/_jsx(Text, {
|
|
207
208
|
style: titleStyle,
|
|
208
|
-
|
|
209
|
+
...resolveTruncation(disableTruncation, 1),
|
|
209
210
|
children: title
|
|
210
211
|
}) : null, showSubtitle ? /*#__PURE__*/_jsx(Text, {
|
|
211
212
|
style: subtitleStyle,
|
|
212
|
-
|
|
213
|
+
...resolveTruncation(disableTruncation, 1),
|
|
213
214
|
children: subtitle
|
|
214
215
|
}) : null]
|
|
215
216
|
}) : null]
|