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,284 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
type StyleProp,
|
|
6
|
+
type ViewStyle,
|
|
7
|
+
type TextStyle,
|
|
8
|
+
} from 'react-native'
|
|
9
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
10
|
+
import { EMPTY_MODES, cloneChildrenWithModes, resolveTruncation } from '../../utils/react-utils'
|
|
11
|
+
import type { Modes } from '../../design-tokens'
|
|
12
|
+
import Divider from '../Divider/Divider'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A value rendered at either end of the marker. A `string`/`number` is rendered
|
|
16
|
+
* with the built-in title typography; any other `ReactNode` (e.g. a
|
|
17
|
+
* `MoneyValue`) is rendered as-is so consumers can fully control presentation.
|
|
18
|
+
*/
|
|
19
|
+
type ProjectionMarkerEndValue = React.ReactNode
|
|
20
|
+
|
|
21
|
+
export type ProjectionMarkerProps = {
|
|
22
|
+
/**
|
|
23
|
+
* Value shown on the leading (left) end of the marker — typically the
|
|
24
|
+
* invested/starting amount. Accepts a string for the default styling or any
|
|
25
|
+
* `ReactNode` (e.g. `MoneyValue`) for custom rendering.
|
|
26
|
+
*/
|
|
27
|
+
startValue?: ProjectionMarkerEndValue
|
|
28
|
+
/**
|
|
29
|
+
* Value shown on the trailing (right) end of the marker — typically the
|
|
30
|
+
* projected/ending amount.
|
|
31
|
+
*/
|
|
32
|
+
endValue?: ProjectionMarkerEndValue
|
|
33
|
+
/**
|
|
34
|
+
* Primary line inside the center badge — typically the duration
|
|
35
|
+
* (e.g. `"1Y 10M"`).
|
|
36
|
+
*/
|
|
37
|
+
duration?: React.ReactNode
|
|
38
|
+
/**
|
|
39
|
+
* Secondary line inside the center badge — typically the rate
|
|
40
|
+
* (e.g. `"@ 8.25 %"`).
|
|
41
|
+
*/
|
|
42
|
+
rate?: React.ReactNode
|
|
43
|
+
/**
|
|
44
|
+
* Whether to render the connector lines between the end values and the
|
|
45
|
+
* center badge. Defaults to `true`.
|
|
46
|
+
*/
|
|
47
|
+
showConnectors?: boolean
|
|
48
|
+
/** Design token modes for theming. */
|
|
49
|
+
modes?: Modes
|
|
50
|
+
/** Override the root container styles. */
|
|
51
|
+
style?: StyleProp<ViewStyle>
|
|
52
|
+
/** Override the leading value text styles (only applies to string values). */
|
|
53
|
+
startValueStyle?: StyleProp<TextStyle>
|
|
54
|
+
/** Override the trailing value text styles (only applies to string values). */
|
|
55
|
+
endValueStyle?: StyleProp<TextStyle>
|
|
56
|
+
/** Override the center badge container styles. */
|
|
57
|
+
badgeStyle?: StyleProp<ViewStyle>
|
|
58
|
+
/** Override the duration text styles. */
|
|
59
|
+
durationStyle?: StyleProp<TextStyle>
|
|
60
|
+
/** Override the rate text styles. */
|
|
61
|
+
rateStyle?: StyleProp<TextStyle>
|
|
62
|
+
/** Accessibility label for the whole marker. */
|
|
63
|
+
accessibilityLabel?: string
|
|
64
|
+
/**
|
|
65
|
+
* When `true`, disables text truncation: the trailing ellipsis (`…`) is never
|
|
66
|
+
* shown and any `numberOfLines` clamp is ignored, so the text wraps to as many
|
|
67
|
+
* lines as it needs even when horizontal space is tight.
|
|
68
|
+
*/
|
|
69
|
+
disableTruncation?: boolean
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const isTextValue = (value: React.ReactNode): value is string | number =>
|
|
73
|
+
typeof value === 'string' || typeof value === 'number'
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* ProjectionMarker renders a start value and an end value connected to a
|
|
77
|
+
* centered badge that summarizes the projection (e.g. a tenure and interest
|
|
78
|
+
* rate). It mirrors the Figma `projectionMarker` component and is commonly used
|
|
79
|
+
* inside "Potential returns" style cards.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <ProjectionMarker
|
|
84
|
+
* startValue="₹1,00,000"
|
|
85
|
+
* endValue="₹1,25,101"
|
|
86
|
+
* duration="1Y 10M"
|
|
87
|
+
* rate="@ 8.25 %"
|
|
88
|
+
* />
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example Custom end values via MoneyValue
|
|
92
|
+
* ```tsx
|
|
93
|
+
* <ProjectionMarker
|
|
94
|
+
* startValue={<MoneyValue value="1,00,000" />}
|
|
95
|
+
* endValue={<MoneyValue value="1,25,101" />}
|
|
96
|
+
* duration="1Y 10M"
|
|
97
|
+
* rate="@ 8.25 %"
|
|
98
|
+
* />
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
function ProjectionMarker({
|
|
102
|
+
startValue = '₹1,00,000',
|
|
103
|
+
endValue = '₹1,25,101',
|
|
104
|
+
duration = '1Y 10M',
|
|
105
|
+
rate = '@ 8.25 %',
|
|
106
|
+
showConnectors = true,
|
|
107
|
+
modes = EMPTY_MODES,
|
|
108
|
+
style,
|
|
109
|
+
startValueStyle,
|
|
110
|
+
endValueStyle,
|
|
111
|
+
badgeStyle,
|
|
112
|
+
durationStyle,
|
|
113
|
+
rateStyle,
|
|
114
|
+
accessibilityLabel,
|
|
115
|
+
disableTruncation,
|
|
116
|
+
}: ProjectionMarkerProps) {
|
|
117
|
+
const titleColor =
|
|
118
|
+
(getVariableByName('projectionMarker/title/color', modes) as string | null) ?? '#000000'
|
|
119
|
+
const titleFontFamily =
|
|
120
|
+
(getVariableByName('projectionMarker/title/fontfamily', modes) as string | null) ??
|
|
121
|
+
'JioType Var'
|
|
122
|
+
const titleFontSize =
|
|
123
|
+
(getVariableByName('projectionMarker/title/fontsize', modes) as number | null) ?? 14
|
|
124
|
+
const titleFontWeight = String(
|
|
125
|
+
getVariableByName('projectionMarker/title/fontweight', modes) ?? 600
|
|
126
|
+
) as TextStyle['fontWeight']
|
|
127
|
+
|
|
128
|
+
const durationColor =
|
|
129
|
+
(getVariableByName('projectionMarker/duration/color', modes) as string | null) ?? '#000000'
|
|
130
|
+
const durationFontFamily =
|
|
131
|
+
(getVariableByName('projectionMarker/duration/fontfamily', modes) as string | null) ??
|
|
132
|
+
'JioType Var'
|
|
133
|
+
const durationFontSize =
|
|
134
|
+
(getVariableByName('projectionMarker/duration/fontsize', modes) as number | null) ?? 12
|
|
135
|
+
const durationFontWeight = String(
|
|
136
|
+
getVariableByName('projectionMarker/duration/fontweight', modes) ?? 500
|
|
137
|
+
) as TextStyle['fontWeight']
|
|
138
|
+
|
|
139
|
+
const rateColor =
|
|
140
|
+
(getVariableByName('projectionMarker/rate/color', modes) as string | null) ?? '#6b6b6b'
|
|
141
|
+
const rateFontFamily =
|
|
142
|
+
(getVariableByName('metricdata/rate/fontfamily', modes) as string | null) ?? 'JioType Var'
|
|
143
|
+
const rateFontSize =
|
|
144
|
+
(getVariableByName('metricdata/rate/fontsize', modes) as number | null) ?? 11
|
|
145
|
+
const rateFontWeight = String(
|
|
146
|
+
getVariableByName('metricdata/rate/fontweight', modes) ?? 400
|
|
147
|
+
) as TextStyle['fontWeight']
|
|
148
|
+
|
|
149
|
+
const badgeBg =
|
|
150
|
+
(getVariableByName('projectionMarker/durationWrap/bg/color', modes) as string | null) ??
|
|
151
|
+
'#f5f5f5'
|
|
152
|
+
const badgeBorderColor =
|
|
153
|
+
(getVariableByName('projectionMarker/durationWrap/border/color', modes) as string | null) ??
|
|
154
|
+
'#ebebed'
|
|
155
|
+
const badgeBorderWidth =
|
|
156
|
+
(getVariableByName('metricdata/durationWrap/stroke', modes) as number | null) ?? 1
|
|
157
|
+
const badgeRadius =
|
|
158
|
+
(getVariableByName('metricdata/durationWrap/radius', modes) as number | null) ?? 8
|
|
159
|
+
const badgePaddingHorizontal =
|
|
160
|
+
(getVariableByName('metricdata/durationWrap/padding/horizontal', modes) as number | null) ?? 16
|
|
161
|
+
const badgePaddingVertical =
|
|
162
|
+
(getVariableByName('metricdata/durationWrap/padding/vertical', modes) as number | null) ?? 8
|
|
163
|
+
|
|
164
|
+
const titleTextStyle: TextStyle = {
|
|
165
|
+
color: titleColor,
|
|
166
|
+
fontFamily: titleFontFamily,
|
|
167
|
+
fontSize: titleFontSize,
|
|
168
|
+
fontWeight: titleFontWeight,
|
|
169
|
+
lineHeight: titleFontSize * 1.3,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const renderEndValue = (
|
|
173
|
+
value: React.ReactNode,
|
|
174
|
+
overrideStyle: StyleProp<TextStyle>
|
|
175
|
+
): React.ReactNode => {
|
|
176
|
+
if (value === null || value === undefined) return null
|
|
177
|
+
if (isTextValue(value)) {
|
|
178
|
+
return (
|
|
179
|
+
<Text style={[titleTextStyle, overrideStyle]} {...resolveTruncation(disableTruncation, 1)}>
|
|
180
|
+
{value}
|
|
181
|
+
</Text>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
return cloneChildrenWithModes(value, modes)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<View
|
|
189
|
+
style={[styles.container, style]}
|
|
190
|
+
accessibilityRole="summary"
|
|
191
|
+
accessibilityLabel={accessibilityLabel}
|
|
192
|
+
>
|
|
193
|
+
{renderEndValue(startValue, startValueStyle)}
|
|
194
|
+
|
|
195
|
+
{showConnectors && (
|
|
196
|
+
<Divider direction="horizontal" modes={modes} style={styles.connector} />
|
|
197
|
+
)}
|
|
198
|
+
|
|
199
|
+
<View
|
|
200
|
+
style={[
|
|
201
|
+
styles.badge,
|
|
202
|
+
{
|
|
203
|
+
backgroundColor: badgeBg,
|
|
204
|
+
borderColor: badgeBorderColor,
|
|
205
|
+
borderWidth: badgeBorderWidth,
|
|
206
|
+
borderRadius: badgeRadius,
|
|
207
|
+
paddingHorizontal: badgePaddingHorizontal,
|
|
208
|
+
paddingVertical: badgePaddingVertical,
|
|
209
|
+
},
|
|
210
|
+
badgeStyle,
|
|
211
|
+
]}
|
|
212
|
+
>
|
|
213
|
+
{duration !== null && duration !== undefined
|
|
214
|
+
? isTextValue(duration)
|
|
215
|
+
? (
|
|
216
|
+
<Text
|
|
217
|
+
style={[
|
|
218
|
+
{
|
|
219
|
+
color: durationColor,
|
|
220
|
+
fontFamily: durationFontFamily,
|
|
221
|
+
fontSize: durationFontSize,
|
|
222
|
+
fontWeight: durationFontWeight,
|
|
223
|
+
lineHeight: durationFontSize * 1.2,
|
|
224
|
+
textAlign: 'center',
|
|
225
|
+
},
|
|
226
|
+
durationStyle,
|
|
227
|
+
]}
|
|
228
|
+
>
|
|
229
|
+
{duration}
|
|
230
|
+
</Text>
|
|
231
|
+
)
|
|
232
|
+
: cloneChildrenWithModes(duration, modes)
|
|
233
|
+
: null}
|
|
234
|
+
{rate !== null && rate !== undefined
|
|
235
|
+
? isTextValue(rate)
|
|
236
|
+
? (
|
|
237
|
+
<Text
|
|
238
|
+
style={[
|
|
239
|
+
{
|
|
240
|
+
color: rateColor,
|
|
241
|
+
fontFamily: rateFontFamily,
|
|
242
|
+
fontSize: rateFontSize,
|
|
243
|
+
fontWeight: rateFontWeight,
|
|
244
|
+
lineHeight: rateFontSize * 1.3,
|
|
245
|
+
textAlign: 'center',
|
|
246
|
+
},
|
|
247
|
+
rateStyle,
|
|
248
|
+
]}
|
|
249
|
+
>
|
|
250
|
+
{rate}
|
|
251
|
+
</Text>
|
|
252
|
+
)
|
|
253
|
+
: cloneChildrenWithModes(rate, modes)
|
|
254
|
+
: null}
|
|
255
|
+
</View>
|
|
256
|
+
|
|
257
|
+
{showConnectors && (
|
|
258
|
+
<Divider direction="horizontal" modes={modes} style={styles.connector} />
|
|
259
|
+
)}
|
|
260
|
+
|
|
261
|
+
{renderEndValue(endValue, endValueStyle)}
|
|
262
|
+
</View>
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const styles = {
|
|
267
|
+
container: {
|
|
268
|
+
flexDirection: 'row',
|
|
269
|
+
alignItems: 'center',
|
|
270
|
+
width: '100%',
|
|
271
|
+
} as ViewStyle,
|
|
272
|
+
connector: {
|
|
273
|
+
flex: 1,
|
|
274
|
+
alignSelf: 'center',
|
|
275
|
+
marginHorizontal: 16,
|
|
276
|
+
} as ViewStyle,
|
|
277
|
+
badge: {
|
|
278
|
+
flexDirection: 'column',
|
|
279
|
+
alignItems: 'center',
|
|
280
|
+
justifyContent: 'center',
|
|
281
|
+
} as ViewStyle,
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export default ProjectionMarker
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { forwardRef, useState } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
Pressable,
|
|
4
4
|
View,
|
|
@@ -47,14 +47,14 @@ export interface RadioProps {
|
|
|
47
47
|
// Radio
|
|
48
48
|
// ---------------------------------------------------------------------------
|
|
49
49
|
|
|
50
|
-
export function Radio({
|
|
50
|
+
export const Radio = forwardRef<View, RadioProps>(function Radio({
|
|
51
51
|
selected = false,
|
|
52
52
|
disabled = false,
|
|
53
53
|
onPress,
|
|
54
54
|
modes = EMPTY_MODES,
|
|
55
55
|
style,
|
|
56
56
|
testID,
|
|
57
|
-
}: RadioProps) {
|
|
57
|
+
}: RadioProps, ref: React.Ref<View>) {
|
|
58
58
|
// ---- Refs & State ----
|
|
59
59
|
const [hovered, setHovered] = useState(false)
|
|
60
60
|
const [focused, setFocused] = useState(false)
|
|
@@ -206,6 +206,7 @@ export function Radio({
|
|
|
206
206
|
|
|
207
207
|
return (
|
|
208
208
|
<Pressable
|
|
209
|
+
ref={ref}
|
|
209
210
|
testID={testID}
|
|
210
211
|
disabled={disabled}
|
|
211
212
|
onPress={onPress}
|
|
@@ -223,6 +224,6 @@ export function Radio({
|
|
|
223
224
|
<View style={selectorStyle} />
|
|
224
225
|
</Pressable>
|
|
225
226
|
)
|
|
226
|
-
}
|
|
227
|
+
})
|
|
227
228
|
|
|
228
229
|
export default Radio
|
|
@@ -14,7 +14,7 @@ import NavArrow from '../NavArrow/NavArrow'
|
|
|
14
14
|
import IconCapsule from '../IconCapsule/IconCapsule'
|
|
15
15
|
import ListItem from '../ListItem/ListItem'
|
|
16
16
|
import { usePressableWebSupport, type WebAccessibilityProps } from '../../utils/web-platform-utils'
|
|
17
|
-
import { EMPTY_MODES, cloneChildrenWithModes, flattenChildren } from '../../utils/react-utils'
|
|
17
|
+
import { EMPTY_MODES, cloneChildrenWithModes, flattenChildren, resolveTruncation } from '../../utils/react-utils'
|
|
18
18
|
import type { Modes } from '../../design-tokens'
|
|
19
19
|
|
|
20
20
|
// Match Button: delay the press visual on iOS so a scroll-cancelled touch
|
|
@@ -366,6 +366,12 @@ type SectionProps = {
|
|
|
366
366
|
* Web-specific accessibility props (only used on web platform)
|
|
367
367
|
*/
|
|
368
368
|
webAccessibilityProps?: WebAccessibilityProps;
|
|
369
|
+
/**
|
|
370
|
+
* When `true`, disables text truncation: the trailing ellipsis (`…`) is never
|
|
371
|
+
* shown and any `numberOfLines` clamp is ignored, so the text wraps to as many
|
|
372
|
+
* lines as it needs even when horizontal space is tight.
|
|
373
|
+
*/
|
|
374
|
+
disableTruncation?: boolean;
|
|
369
375
|
} & React.ComponentProps<typeof View>;
|
|
370
376
|
|
|
371
377
|
/**
|
|
@@ -483,6 +489,7 @@ function Section({
|
|
|
483
489
|
accessibilityLabel: _accessibilityLabel,
|
|
484
490
|
accessibilityHint,
|
|
485
491
|
webAccessibilityProps,
|
|
492
|
+
disableTruncation,
|
|
486
493
|
...rest
|
|
487
494
|
}: SectionProps) {
|
|
488
495
|
// Focus and hover are still mirrored in React because they are visible,
|
|
@@ -527,7 +534,7 @@ function Section({
|
|
|
527
534
|
<View style={headerWrapStyle}>
|
|
528
535
|
<Text
|
|
529
536
|
style={tokens.titleStyle}
|
|
530
|
-
|
|
537
|
+
{...resolveTruncation(disableTruncation, 1)}
|
|
531
538
|
accessibilityElementsHidden={true}
|
|
532
539
|
importantForAccessibility="no"
|
|
533
540
|
>
|
|
@@ -540,7 +547,7 @@ function Section({
|
|
|
540
547
|
{showSupportText && (
|
|
541
548
|
<Text
|
|
542
549
|
style={tokens.supportTextStyle}
|
|
543
|
-
|
|
550
|
+
{...resolveTruncation(disableTruncation, 2)}
|
|
544
551
|
accessibilityElementsHidden={true}
|
|
545
552
|
importantForAccessibility="no"
|
|
546
553
|
>
|