jfs-components 0.1.8 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/lib/commonjs/components/Accordion/Accordion.js +2 -1
- package/lib/commonjs/components/AccordionCheckbox/AccordionCheckbox.js +4 -3
- package/lib/commonjs/components/AccountCard/AccountCard.js +4 -3
- package/lib/commonjs/components/AllocationComparisonChart/AllocationComparisonChart.js +9 -6
- package/lib/commonjs/components/AreaLineChart/AreaLineChart.js +11 -7
- package/lib/commonjs/components/Badge/Badge.js +47 -8
- package/lib/commonjs/components/BrandChip/BrandChip.js +3 -3
- package/lib/commonjs/components/Button/Button.js +2 -1
- package/lib/commonjs/components/CardAdvisory/CardAdvisory.js +2 -1
- package/lib/commonjs/components/CardBankAccount/CardBankAccount.js +3 -2
- package/lib/commonjs/components/CardCTA/CardCTA.js +197 -27
- package/lib/commonjs/components/CardInsight/CardInsight.js +5 -1
- package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +7 -3
- package/lib/commonjs/components/CircularProgressBarDoted/CircularProgressBarDoted.js +3 -2
- package/lib/commonjs/components/CircularRating/CircularRating.js +2 -1
- package/lib/commonjs/components/ClusterBubble/ClusterBubble.js +3 -2
- package/lib/commonjs/components/CompareTable/CompareTable.js +72 -43
- package/lib/commonjs/components/CoverageBarComparison/CoverageBarComparison.js +3 -2
- package/lib/commonjs/components/DonutChart/DonutChart.js +4 -3
- package/lib/commonjs/components/Dropdown/Dropdown.js +3 -2
- package/lib/commonjs/components/DropdownInput/DropdownInput.js +3 -2
- package/lib/commonjs/components/ExpandableCheckbox/ExpandableCheckbox.js +2 -1
- package/lib/commonjs/components/FormField/FormField.js +42 -2
- package/lib/commonjs/components/Gauge/Gauge.js +1 -1
- package/lib/commonjs/components/HoldingsCard/HoldingsCard.js +3 -2
- package/lib/commonjs/components/InstitutionBadge/InstitutionBadge.js +2 -1
- package/lib/commonjs/components/ListGroup/ListGroup.js +2 -1
- package/lib/commonjs/components/ListItem/ListItem.js +3 -2
- package/lib/commonjs/components/MediaCard/MediaCard.js +4 -2
- package/lib/commonjs/components/MetricLegendItem/MetricLegendItem.js +3 -2
- package/lib/commonjs/components/MonthlyStatusGrid/MonthlyStatusGrid.js +6 -3
- package/lib/commonjs/components/PoweredByLabel/PoweredByLabel.js +3 -2
- package/lib/commonjs/components/ProductMerchandisingCard/ProductMerchandisingCard.js +107 -33
- package/lib/commonjs/components/ProductOverview/ProductOverview.js +4 -3
- package/lib/commonjs/components/ProgressBadge/ProgressBadge.js +2 -2
- package/lib/commonjs/components/ProjectionMarker/ProjectionMarker.js +3 -2
- package/lib/commonjs/components/Section/Section.js +3 -2
- package/lib/commonjs/components/Slider/Slider.js +3 -2
- package/lib/commonjs/components/Stack/Stack.js +86 -0
- package/lib/commonjs/components/SuggestiveSearch/SuggestiveSearch.js +10 -1
- package/lib/commonjs/components/SummaryTile/SummaryTile.js +3 -2
- package/lib/commonjs/components/Table/Table.js +324 -0
- package/lib/commonjs/components/Text/Text.js +2 -1
- package/lib/commonjs/components/TextInput/TextInput.js +9 -1
- package/lib/commonjs/components/TextSegment/TextSegment.js +2 -1
- package/lib/commonjs/components/ThreadHero/ThreadHero.js +4 -5
- package/lib/commonjs/components/Title/Title.js +2 -1
- package/lib/commonjs/components/Toast/Toast.js +3 -2
- package/lib/commonjs/components/TransactionBubble/TransactionBubble.js +2 -1
- package/lib/commonjs/components/TransactionStatus/TransactionStatus.js +3 -2
- package/lib/commonjs/components/UpiHandle/UpiHandle.js +2 -2
- package/lib/commonjs/components/index.js +44 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/design-tokens/figma-modes.generated.js +1 -0
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.js +11 -3
- package/lib/commonjs/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.web.js +8 -4
- package/lib/commonjs/utils/react-utils.js +56 -0
- package/lib/commonjs/utils/web-platform-utils.js +59 -0
- package/lib/module/components/Accordion/Accordion.js +3 -2
- package/lib/module/components/AccordionCheckbox/AccordionCheckbox.js +5 -4
- package/lib/module/components/AccountCard/AccountCard.js +5 -4
- package/lib/module/components/AllocationComparisonChart/AllocationComparisonChart.js +10 -7
- package/lib/module/components/AreaLineChart/AreaLineChart.js +12 -8
- package/lib/module/components/Badge/Badge.js +49 -10
- package/lib/module/components/BrandChip/BrandChip.js +4 -4
- package/lib/module/components/Button/Button.js +3 -2
- package/lib/module/components/CardAdvisory/CardAdvisory.js +3 -2
- package/lib/module/components/CardBankAccount/CardBankAccount.js +4 -3
- package/lib/module/components/CardCTA/CardCTA.js +198 -28
- package/lib/module/components/CardInsight/CardInsight.js +5 -1
- package/lib/module/components/CircularProgressBar/CircularProgressBar.js +8 -4
- package/lib/module/components/CircularProgressBarDoted/CircularProgressBarDoted.js +4 -3
- package/lib/module/components/CircularRating/CircularRating.js +3 -2
- package/lib/module/components/ClusterBubble/ClusterBubble.js +4 -3
- package/lib/module/components/CompareTable/CompareTable.js +73 -44
- package/lib/module/components/CoverageBarComparison/CoverageBarComparison.js +4 -3
- package/lib/module/components/DonutChart/DonutChart.js +5 -4
- package/lib/module/components/Dropdown/Dropdown.js +4 -3
- package/lib/module/components/DropdownInput/DropdownInput.js +4 -3
- package/lib/module/components/ExpandableCheckbox/ExpandableCheckbox.js +2 -1
- package/lib/module/components/FormField/FormField.js +45 -5
- package/lib/module/components/Gauge/Gauge.js +1 -1
- package/lib/module/components/HoldingsCard/HoldingsCard.js +4 -3
- package/lib/module/components/InstitutionBadge/InstitutionBadge.js +3 -2
- package/lib/module/components/ListGroup/ListGroup.js +3 -2
- package/lib/module/components/ListItem/ListItem.js +4 -3
- package/lib/module/components/MediaCard/MediaCard.js +4 -2
- package/lib/module/components/MetricLegendItem/MetricLegendItem.js +4 -3
- package/lib/module/components/MonthlyStatusGrid/MonthlyStatusGrid.js +7 -4
- package/lib/module/components/PoweredByLabel/PoweredByLabel.js +4 -3
- package/lib/module/components/ProductMerchandisingCard/ProductMerchandisingCard.js +109 -35
- package/lib/module/components/ProductOverview/ProductOverview.js +5 -4
- package/lib/module/components/ProgressBadge/ProgressBadge.js +3 -3
- package/lib/module/components/ProjectionMarker/ProjectionMarker.js +4 -3
- package/lib/module/components/Section/Section.js +4 -3
- package/lib/module/components/Slider/Slider.js +4 -3
- package/lib/module/components/Stack/Stack.js +81 -0
- package/lib/module/components/SuggestiveSearch/SuggestiveSearch.js +10 -1
- package/lib/module/components/SummaryTile/SummaryTile.js +4 -3
- package/lib/module/components/Table/Table.js +315 -0
- package/lib/module/components/Text/Text.js +3 -2
- package/lib/module/components/TextInput/TextInput.js +9 -1
- package/lib/module/components/TextSegment/TextSegment.js +3 -2
- package/lib/module/components/ThreadHero/ThreadHero.js +5 -6
- package/lib/module/components/Title/Title.js +3 -2
- package/lib/module/components/Toast/Toast.js +4 -3
- package/lib/module/components/TransactionBubble/TransactionBubble.js +3 -2
- package/lib/module/components/TransactionStatus/TransactionStatus.js +4 -3
- package/lib/module/components/UpiHandle/UpiHandle.js +3 -3
- package/lib/module/components/index.js +2 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/design-tokens/figma-modes.generated.js +1 -0
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.js +11 -3
- package/lib/module/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.web.js +8 -4
- package/lib/module/utils/react-utils.js +54 -0
- package/lib/module/utils/web-platform-utils.js +58 -0
- package/lib/typescript/src/components/Accordion/Accordion.d.ts +7 -1
- package/lib/typescript/src/components/AccordionCheckbox/AccordionCheckbox.d.ts +7 -1
- package/lib/typescript/src/components/AccountCard/AccountCard.d.ts +7 -1
- package/lib/typescript/src/components/AllocationComparisonChart/AllocationComparisonChart.d.ts +7 -1
- package/lib/typescript/src/components/AreaLineChart/AreaLineChart.d.ts +8 -1
- package/lib/typescript/src/components/Badge/Badge.d.ts +32 -2
- package/lib/typescript/src/components/BrandChip/BrandChip.d.ts +7 -1
- package/lib/typescript/src/components/Button/Button.d.ts +7 -1
- package/lib/typescript/src/components/CardAdvisory/CardAdvisory.d.ts +7 -1
- package/lib/typescript/src/components/CardBankAccount/CardBankAccount.d.ts +7 -1
- package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +27 -5
- package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +7 -1
- package/lib/typescript/src/components/CircularProgressBarDoted/CircularProgressBarDoted.d.ts +7 -1
- package/lib/typescript/src/components/CircularRating/CircularRating.d.ts +7 -1
- package/lib/typescript/src/components/ClusterBubble/ClusterBubble.d.ts +7 -1
- package/lib/typescript/src/components/CompareTable/CompareTable.d.ts +7 -1
- package/lib/typescript/src/components/CoverageBarComparison/CoverageBarComparison.d.ts +7 -1
- package/lib/typescript/src/components/DonutChart/DonutChart.d.ts +7 -1
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +7 -1
- package/lib/typescript/src/components/DropdownInput/DropdownInput.d.ts +6 -0
- package/lib/typescript/src/components/ExpandableCheckbox/ExpandableCheckbox.d.ts +7 -1
- package/lib/typescript/src/components/HoldingsCard/HoldingsCard.d.ts +7 -1
- package/lib/typescript/src/components/InstitutionBadge/InstitutionBadge.d.ts +7 -1
- package/lib/typescript/src/components/ListGroup/ListGroup.d.ts +7 -1
- package/lib/typescript/src/components/ListItem/ListItem.d.ts +7 -1
- package/lib/typescript/src/components/MetricLegendItem/MetricLegendItem.d.ts +7 -1
- package/lib/typescript/src/components/MonthlyStatusGrid/MonthlyStatusGrid.d.ts +14 -2
- package/lib/typescript/src/components/PoweredByLabel/PoweredByLabel.d.ts +7 -1
- package/lib/typescript/src/components/ProductMerchandisingCard/ProductMerchandisingCard.d.ts +7 -1
- package/lib/typescript/src/components/ProductOverview/ProductOverview.d.ts +7 -1
- package/lib/typescript/src/components/ProgressBadge/ProgressBadge.d.ts +7 -1
- package/lib/typescript/src/components/ProjectionMarker/ProjectionMarker.d.ts +7 -1
- package/lib/typescript/src/components/Section/Section.d.ts +7 -1
- package/lib/typescript/src/components/Slider/Slider.d.ts +6 -0
- package/lib/typescript/src/components/Stack/Stack.d.ts +81 -0
- package/lib/typescript/src/components/SummaryTile/SummaryTile.d.ts +7 -1
- package/lib/typescript/src/components/Table/Table.d.ts +139 -0
- package/lib/typescript/src/components/Text/Text.d.ts +7 -1
- package/lib/typescript/src/components/TextSegment/TextSegment.d.ts +7 -1
- package/lib/typescript/src/components/ThreadHero/ThreadHero.d.ts +7 -1
- package/lib/typescript/src/components/Title/Title.d.ts +7 -1
- package/lib/typescript/src/components/Toast/Toast.d.ts +7 -1
- package/lib/typescript/src/components/TransactionBubble/TransactionBubble.d.ts +7 -1
- package/lib/typescript/src/components/TransactionStatus/TransactionStatus.d.ts +7 -1
- package/lib/typescript/src/components/UpiHandle/UpiHandle.d.ts +7 -1
- package/lib/typescript/src/components/index.d.ts +4 -2
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/lib/typescript/src/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.d.ts +31 -3
- package/lib/typescript/src/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.web.d.ts +18 -2
- package/lib/typescript/src/utils/react-utils.d.ts +37 -0
- package/lib/typescript/src/utils/web-platform-utils.d.ts +36 -0
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.tsx +9 -2
- package/src/components/AccordionCheckbox/AccordionCheckbox.tsx +10 -3
- package/src/components/AccountCard/AccountCard.tsx +10 -3
- package/src/components/AllocationComparisonChart/AllocationComparisonChart.tsx +14 -4
- package/src/components/AreaLineChart/AreaLineChart.tsx +15 -5
- package/src/components/Badge/Badge.tsx +78 -8
- package/src/components/BrandChip/BrandChip.tsx +9 -3
- package/src/components/Button/Button.tsx +9 -2
- package/src/components/CardAdvisory/CardAdvisory.tsx +9 -2
- package/src/components/CardBankAccount/CardBankAccount.tsx +9 -2
- package/src/components/CardCTA/CardCTA.tsx +214 -41
- package/src/components/CardInsight/CardInsight.tsx +7 -1
- package/src/components/CircularProgressBar/CircularProgressBar.tsx +14 -4
- package/src/components/CircularProgressBarDoted/CircularProgressBarDoted.tsx +10 -3
- package/src/components/CircularRating/CircularRating.tsx +9 -2
- package/src/components/ClusterBubble/ClusterBubble.tsx +9 -2
- package/src/components/CompareTable/CompareTable.tsx +98 -50
- package/src/components/CoverageBarComparison/CoverageBarComparison.tsx +9 -2
- package/src/components/DonutChart/DonutChart.tsx +10 -3
- package/src/components/Dropdown/Dropdown.tsx +9 -2
- package/src/components/DropdownInput/DropdownInput.tsx +9 -2
- package/src/components/ExpandableCheckbox/ExpandableCheckbox.tsx +8 -1
- package/src/components/FormField/FormField.tsx +49 -4
- package/src/components/Gauge/Gauge.tsx +1 -1
- package/src/components/HoldingsCard/HoldingsCard.tsx +9 -2
- package/src/components/InstitutionBadge/InstitutionBadge.tsx +9 -2
- package/src/components/ListGroup/ListGroup.tsx +9 -2
- package/src/components/ListItem/ListItem.tsx +10 -3
- package/src/components/MediaCard/MediaCard.tsx +2 -2
- package/src/components/MetricLegendItem/MetricLegendItem.tsx +9 -2
- package/src/components/MonthlyStatusGrid/MonthlyStatusGrid.tsx +17 -2
- package/src/components/PoweredByLabel/PoweredByLabel.tsx +9 -2
- package/src/components/ProductMerchandisingCard/ProductMerchandisingCard.tsx +104 -37
- package/src/components/ProductOverview/ProductOverview.tsx +10 -3
- package/src/components/ProgressBadge/ProgressBadge.tsx +9 -3
- package/src/components/ProjectionMarker/ProjectionMarker.tsx +9 -2
- package/src/components/Section/Section.tsx +10 -3
- package/src/components/Slider/Slider.tsx +9 -2
- package/src/components/Stack/Stack.tsx +131 -0
- package/src/components/SuggestiveSearch/SuggestiveSearch.tsx +10 -1
- package/src/components/SummaryTile/SummaryTile.tsx +9 -2
- package/src/components/Table/Table.tsx +449 -0
- package/src/components/Text/Text.tsx +9 -2
- package/src/components/TextInput/TextInput.tsx +7 -1
- package/src/components/TextSegment/TextSegment.tsx +9 -2
- package/src/components/ThreadHero/ThreadHero.tsx +10 -3
- package/src/components/Title/Title.tsx +9 -2
- package/src/components/Toast/Toast.tsx +9 -2
- package/src/components/TransactionBubble/TransactionBubble.tsx +9 -2
- package/src/components/TransactionStatus/TransactionStatus.tsx +9 -2
- package/src/components/UpiHandle/UpiHandle.tsx +9 -3
- package/src/components/index.ts +23 -2
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/design-tokens/figma-modes.generated.ts +1 -0
- package/src/icons/registry.ts +1 -1
- package/src/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.tsx +32 -3
- package/src/{components/ProductMerchandisingCard → utils/GlassFill}/GlassFill.web.tsx +25 -4
- package/src/utils/react-utils.ts +61 -0
- package/src/utils/web-platform-utils.ts +68 -0
- package/lib/commonjs/components/MediaCard/GlassFill.js +0 -62
- package/lib/commonjs/components/MediaCard/GlassFill.web.js +0 -48
- package/lib/module/components/MediaCard/GlassFill.js +0 -57
- package/lib/module/components/MediaCard/GlassFill.web.js +0 -43
- package/lib/typescript/src/components/MediaCard/GlassFill.d.ts +0 -47
- package/lib/typescript/src/components/MediaCard/GlassFill.web.d.ts +0 -20
- package/src/components/MediaCard/GlassFill.tsx +0 -89
- package/src/components/MediaCard/GlassFill.web.tsx +0 -53
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import Svg, { Circle, Line, Path } from 'react-native-svg'
|
|
24
24
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
25
25
|
import { useTokens } from '../../design-tokens/JFSThemeProvider'
|
|
26
|
-
import { EMPTY_MODES } from '../../utils/react-utils'
|
|
26
|
+
import { EMPTY_MODES, resolveTruncation } from '../../utils/react-utils'
|
|
27
27
|
import MetricLegendItem from '../MetricLegendItem/MetricLegendItem'
|
|
28
28
|
import type { Modes } from '../../design-tokens'
|
|
29
29
|
import {
|
|
@@ -149,6 +149,12 @@ export type AreaLineChartProps = {
|
|
|
149
149
|
children?: React.ReactNode
|
|
150
150
|
/** Accessibility label for the whole chart. */
|
|
151
151
|
accessibilityLabel?: string
|
|
152
|
+
/**
|
|
153
|
+
* When `true`, disables text truncation: the trailing ellipsis (`…`) is never
|
|
154
|
+
* shown and any `numberOfLines` clamp is ignored, so the text wraps to as many
|
|
155
|
+
* lines as it needs even when horizontal space is tight.
|
|
156
|
+
*/
|
|
157
|
+
disableTruncation?: boolean
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
// --- Internal resolved types ----------------------------------------------
|
|
@@ -184,6 +190,7 @@ type ChartContextValue = {
|
|
|
184
190
|
formatY: (value: number) => React.ReactNode
|
|
185
191
|
showDots: boolean
|
|
186
192
|
modes: Modes
|
|
193
|
+
disableTruncation?: boolean
|
|
187
194
|
}
|
|
188
195
|
|
|
189
196
|
const ChartContext = createContext<ChartContextValue | null>(null)
|
|
@@ -307,6 +314,7 @@ function AreaLineChart({
|
|
|
307
314
|
style,
|
|
308
315
|
children,
|
|
309
316
|
accessibilityLabel,
|
|
317
|
+
disableTruncation,
|
|
310
318
|
}: AreaLineChartProps) {
|
|
311
319
|
const { modes: globalModes } = useTokens()
|
|
312
320
|
const modes = useMemo(() => ({ ...globalModes, ...propModes }), [globalModes, propModes])
|
|
@@ -440,6 +448,7 @@ function AreaLineChart({
|
|
|
440
448
|
formatY,
|
|
441
449
|
showDots,
|
|
442
450
|
modes,
|
|
451
|
+
disableTruncation,
|
|
443
452
|
}),
|
|
444
453
|
[
|
|
445
454
|
plotWidth,
|
|
@@ -459,6 +468,7 @@ function AreaLineChart({
|
|
|
459
468
|
formatY,
|
|
460
469
|
showDots,
|
|
461
470
|
modes,
|
|
471
|
+
disableTruncation,
|
|
462
472
|
]
|
|
463
473
|
)
|
|
464
474
|
|
|
@@ -650,7 +660,7 @@ function ChartYAxis({
|
|
|
650
660
|
showAxisLine = false,
|
|
651
661
|
formatLabel,
|
|
652
662
|
}: ChartYAxisProps) {
|
|
653
|
-
const { height, inset, yScale, yTicks, formatY, modes } = useChart()
|
|
663
|
+
const { height, inset, yScale, yTicks, formatY, modes, disableTruncation } = useChart()
|
|
654
664
|
const typo = useAxisTypography(modes)
|
|
655
665
|
const format = formatLabel ?? formatY
|
|
656
666
|
|
|
@@ -673,7 +683,7 @@ function ChartYAxis({
|
|
|
673
683
|
}}
|
|
674
684
|
>
|
|
675
685
|
{showLabels ? (
|
|
676
|
-
<Text style={typo.style}
|
|
686
|
+
<Text style={typo.style} {...resolveTruncation(disableTruncation, 1)}>
|
|
677
687
|
{format(t)}
|
|
678
688
|
</Text>
|
|
679
689
|
) : null}
|
|
@@ -736,7 +746,7 @@ function ChartXAxis({
|
|
|
736
746
|
selectable = true,
|
|
737
747
|
formatLabel,
|
|
738
748
|
}: ChartXAxisProps) {
|
|
739
|
-
const { width, inset, xScale, indexXs, count, xLabels, formatX, modes, activeIndex, setActiveIndex } =
|
|
749
|
+
const { width, inset, xScale, indexXs, count, xLabels, formatX, modes, activeIndex, setActiveIndex, disableTruncation } =
|
|
740
750
|
useChart()
|
|
741
751
|
const typo = useAxisTypography(modes)
|
|
742
752
|
const format = formatLabel ?? formatX
|
|
@@ -787,7 +797,7 @@ function ChartXAxis({
|
|
|
787
797
|
typo.style,
|
|
788
798
|
isActive ? { color: activeColor, fontWeight: '700' } : null,
|
|
789
799
|
]}
|
|
790
|
-
|
|
800
|
+
{...resolveTruncation(disableTruncation, 1)}
|
|
791
801
|
>
|
|
792
802
|
{format(label, i)}
|
|
793
803
|
</Text>
|
|
@@ -7,14 +7,24 @@ import {
|
|
|
7
7
|
type TextStyle,
|
|
8
8
|
} from 'react-native'
|
|
9
9
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
10
|
-
import { EMPTY_MODES } from '../../utils/react-utils'
|
|
10
|
+
import { EMPTY_MODES, resolveTruncation } from '../../utils/react-utils'
|
|
11
11
|
import Skeleton from '../../skeleton/Skeleton'
|
|
12
12
|
import { useSkeleton } from '../../skeleton/SkeletonGroup'
|
|
13
13
|
import type { Modes } from '../../design-tokens'
|
|
14
|
+
import GlassFill from '../../utils/GlassFill/GlassFill'
|
|
14
15
|
|
|
15
|
-
type
|
|
16
|
+
export type BadgeType = 'default' | 'glass'
|
|
17
|
+
|
|
18
|
+
export type BadgeProps = {
|
|
16
19
|
/** Visible label text shown inside the badge */
|
|
17
20
|
label?: string
|
|
21
|
+
/**
|
|
22
|
+
* Visual style (matches the Figma `type` property). `'default'` is a solid
|
|
23
|
+
* token-colored pill; `'glass'` is a frosted, translucent pill backed by a
|
|
24
|
+
* real background blur (`GlassFill`) — the same glass surface used at the
|
|
25
|
+
* bottom of media/merchandising cards.
|
|
26
|
+
*/
|
|
27
|
+
type?: BadgeType
|
|
18
28
|
/** Modes used to resolve design tokens (e.g. Appearance, Size) */
|
|
19
29
|
modes?: Modes
|
|
20
30
|
/** Optional press handler to make the badge interactive */
|
|
@@ -22,29 +32,66 @@ type BadgeProps = {
|
|
|
22
32
|
accessibilityLabel?: string
|
|
23
33
|
style?: ViewStyle
|
|
24
34
|
labelStyle?: TextStyle
|
|
35
|
+
/**
|
|
36
|
+
* Optional leading node (icon/image) rendered before the label, inside the
|
|
37
|
+
* badge surface. When present, the badge lays its contents out in a row.
|
|
38
|
+
*/
|
|
39
|
+
leading?: React.ReactNode
|
|
40
|
+
/**
|
|
41
|
+
* Glass-only override for the translucent overlay color painted over the live
|
|
42
|
+
* blur. Defaults to the `badge/glass/color/background` token. Ignored for the
|
|
43
|
+
* `'default'` type.
|
|
44
|
+
*/
|
|
45
|
+
glassOverlayColor?: string
|
|
46
|
+
/**
|
|
47
|
+
* Glass-only override for the blur intensity on the 0–100 scale. Defaults to
|
|
48
|
+
* the `blur/minimal` token. Ignored for the `'default'` type.
|
|
49
|
+
*/
|
|
50
|
+
glassIntensity?: number
|
|
25
51
|
/**
|
|
26
52
|
* Explicit per-instance loading override. When `true`, renders a
|
|
27
53
|
* badge-shaped skeleton placeholder instead of the badge. Defaults to
|
|
28
54
|
* inheriting from the surrounding `<SkeletonGroup>`.
|
|
29
55
|
*/
|
|
30
56
|
loading?: boolean
|
|
57
|
+
/**
|
|
58
|
+
* When `true`, disables text truncation: the trailing ellipsis (`…`) is never
|
|
59
|
+
* shown and any `numberOfLines` clamp is ignored, so the text wraps to as many
|
|
60
|
+
* lines as it needs even when horizontal space is tight.
|
|
61
|
+
*/
|
|
62
|
+
disableTruncation?: boolean
|
|
31
63
|
} & Omit<React.ComponentProps<typeof View>, 'style' | 'accessibilityLabel' | 'accessibilityRole'>
|
|
32
64
|
|
|
33
65
|
function Badge({
|
|
34
66
|
label = 'Label',
|
|
67
|
+
type = 'default',
|
|
35
68
|
modes = EMPTY_MODES,
|
|
36
69
|
onPress,
|
|
37
70
|
accessibilityLabel,
|
|
38
71
|
style,
|
|
39
72
|
labelStyle,
|
|
40
73
|
loading,
|
|
74
|
+
disableTruncation,
|
|
75
|
+
leading,
|
|
76
|
+
glassOverlayColor,
|
|
77
|
+
glassIntensity,
|
|
41
78
|
...rest
|
|
42
79
|
}: BadgeProps) {
|
|
43
|
-
|
|
80
|
+
const isGlass = type === 'glass'
|
|
81
|
+
const hasLeading = leading != null
|
|
82
|
+
|
|
83
|
+
// Resolve token values (fall back to sensible defaults). The glass type
|
|
84
|
+
// swaps the solid fill for a translucent overlay + white label, matching the
|
|
85
|
+
// Figma `badge/glass/*` tokens.
|
|
44
86
|
const backgroundColor =
|
|
45
87
|
(getVariableByName('badge/color/background', modes) as string) || '#d8effe'
|
|
46
|
-
const
|
|
47
|
-
(getVariableByName('badge/color/
|
|
88
|
+
const glassBackground =
|
|
89
|
+
(getVariableByName('badge/glass/color/background', modes) as string) || '#ffffff26'
|
|
90
|
+
const glassLabelColor =
|
|
91
|
+
(getVariableByName('badge/glass/color/label', modes) as string) || '#ffffff'
|
|
92
|
+
const labelColor = isGlass
|
|
93
|
+
? glassLabelColor
|
|
94
|
+
: (getVariableByName('badge/color/label', modes) as string) || '#000000'
|
|
48
95
|
const fontSize =
|
|
49
96
|
Number(getVariableByName('badge/label/fontSize', modes) as unknown) || 12
|
|
50
97
|
const fontFamily =
|
|
@@ -60,6 +107,12 @@ function Badge({
|
|
|
60
107
|
const lineHeight =
|
|
61
108
|
Number(getVariableByName('badge/label/lineHeight', modes) as unknown) ||
|
|
62
109
|
Math.round(fontSize * 1.2)
|
|
110
|
+
// Figma `blur/minimal` (px radius) -> GlassFill's 0–100 intensity scale, the
|
|
111
|
+
// same 1:1 mapping the merchandising card footer uses.
|
|
112
|
+
const blurIntensity = Math.max(
|
|
113
|
+
0,
|
|
114
|
+
Math.min(100, Math.round(Number(getVariableByName('blur/minimal', modes) as unknown) || 29)),
|
|
115
|
+
)
|
|
63
116
|
|
|
64
117
|
// Skeleton short-circuit. Size derived from the same tokens the loaded
|
|
65
118
|
// badge would use so the placeholder occupies the same box.
|
|
@@ -82,13 +135,20 @@ function Badge({
|
|
|
82
135
|
const Container: any = onPress ? Pressable : View
|
|
83
136
|
|
|
84
137
|
const containerStyle: ViewStyle = {
|
|
85
|
-
|
|
138
|
+
// Glass keeps the container transparent so the GlassFill blur shows through;
|
|
139
|
+
// `overflow: 'hidden'` clips the native blur view to the rounded pill (the
|
|
140
|
+
// blur view does not honor borderRadius itself).
|
|
141
|
+
backgroundColor: isGlass ? 'transparent' : backgroundColor,
|
|
86
142
|
paddingHorizontal,
|
|
87
143
|
paddingVertical,
|
|
88
144
|
borderRadius,
|
|
89
145
|
alignSelf: 'flex-start',
|
|
90
146
|
alignItems: 'center',
|
|
91
147
|
justifyContent: 'center',
|
|
148
|
+
// A leading node sits in-line before the label, so switch to a row with a
|
|
149
|
+
// small gap. Consumer `style` (spread last) can still override either.
|
|
150
|
+
...(hasLeading ? { flexDirection: 'row' as const, gap: 4 } : null),
|
|
151
|
+
...(isGlass ? { overflow: 'hidden' as const } : null),
|
|
92
152
|
...((style as any) || {}),
|
|
93
153
|
}
|
|
94
154
|
|
|
@@ -112,10 +172,18 @@ function Badge({
|
|
|
112
172
|
onPress={onPress}
|
|
113
173
|
{...rest}
|
|
114
174
|
>
|
|
175
|
+
{isGlass ? (
|
|
176
|
+
<GlassFill
|
|
177
|
+
tint="light"
|
|
178
|
+
intensity={glassIntensity ?? blurIntensity}
|
|
179
|
+
overlayColor={glassOverlayColor ?? glassBackground}
|
|
180
|
+
androidTintWash={false}
|
|
181
|
+
/>
|
|
182
|
+
) : null}
|
|
183
|
+
{hasLeading ? <View style={LEADING_WRAP}>{leading}</View> : null}
|
|
115
184
|
<Text
|
|
116
185
|
style={textStyle}
|
|
117
|
-
|
|
118
|
-
ellipsizeMode="tail"
|
|
186
|
+
{...resolveTruncation(disableTruncation, 1, 'tail')}
|
|
119
187
|
accessibilityElementsHidden={false}
|
|
120
188
|
>
|
|
121
189
|
{label}
|
|
@@ -124,6 +192,8 @@ function Badge({
|
|
|
124
192
|
)
|
|
125
193
|
}
|
|
126
194
|
|
|
195
|
+
const LEADING_WRAP: ViewStyle = { justifyContent: 'center', alignItems: 'center' }
|
|
196
|
+
|
|
127
197
|
export default Badge
|
|
128
198
|
|
|
129
199
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from 'react-native'
|
|
11
11
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
12
12
|
import { useTokens } from '../../design-tokens/JFSThemeProvider'
|
|
13
|
-
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils'
|
|
13
|
+
import { EMPTY_MODES, cloneChildrenWithModes, resolveTruncation } from '../../utils/react-utils'
|
|
14
14
|
import Avatar from '../Avatar/Avatar'
|
|
15
15
|
import type { Modes } from '../../design-tokens'
|
|
16
16
|
|
|
@@ -38,6 +38,12 @@ export type BrandChipProps = {
|
|
|
38
38
|
labelStyle?: StyleProp<TextStyle>
|
|
39
39
|
/** Accessibility label. Defaults to `label`. */
|
|
40
40
|
accessibilityLabel?: string
|
|
41
|
+
/**
|
|
42
|
+
* When `true`, disables text truncation: the trailing ellipsis (`…`) is never
|
|
43
|
+
* shown and any `numberOfLines` clamp is ignored, so the text wraps to as many
|
|
44
|
+
* lines as it needs even when horizontal space is tight.
|
|
45
|
+
*/
|
|
46
|
+
disableTruncation?: boolean
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
interface BrandChipTokens {
|
|
@@ -164,6 +170,7 @@ function BrandChip({
|
|
|
164
170
|
style,
|
|
165
171
|
labelStyle,
|
|
166
172
|
accessibilityLabel,
|
|
173
|
+
disableTruncation,
|
|
167
174
|
}: BrandChipProps) {
|
|
168
175
|
const { modes: globalModes } = useTokens()
|
|
169
176
|
const modes = useMemo(
|
|
@@ -202,8 +209,7 @@ function BrandChip({
|
|
|
202
209
|
{avatarNode}
|
|
203
210
|
<Text
|
|
204
211
|
style={[tokens.labelStyle, labelStyle]}
|
|
205
|
-
|
|
206
|
-
ellipsizeMode="tail"
|
|
212
|
+
{...resolveTruncation(disableTruncation, 1, 'tail')}
|
|
207
213
|
>
|
|
208
214
|
{label}
|
|
209
215
|
</Text>
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from 'react-native'
|
|
13
13
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
14
14
|
import { usePressableWebSupport, type SafePressableProps, type WebAccessibilityProps } from '../../utils/web-platform-utils'
|
|
15
|
-
import { EMPTY_MODES } from '../../utils/react-utils'
|
|
15
|
+
import { EMPTY_MODES, resolveTruncation } from '../../utils/react-utils'
|
|
16
16
|
import Icon from '../../icons/Icon'
|
|
17
17
|
import Skeleton from '../../skeleton/Skeleton'
|
|
18
18
|
import { useSkeleton } from '../../skeleton/SkeletonGroup'
|
|
@@ -64,6 +64,12 @@ export type ButtonProps = SafePressableProps & {
|
|
|
64
64
|
* the group.
|
|
65
65
|
*/
|
|
66
66
|
loading?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* When `true`, disables text truncation: the trailing ellipsis (`…`) is never
|
|
69
|
+
* shown and any `numberOfLines` clamp is ignored, so the text wraps to as many
|
|
70
|
+
* lines as it needs even when horizontal space is tight.
|
|
71
|
+
*/
|
|
72
|
+
disableTruncation?: boolean;
|
|
67
73
|
};
|
|
68
74
|
|
|
69
75
|
// ---------------------------------------------------------------------------
|
|
@@ -235,6 +241,7 @@ function ButtonImpl({
|
|
|
235
241
|
accessibilityState,
|
|
236
242
|
webAccessibilityProps,
|
|
237
243
|
loading,
|
|
244
|
+
disableTruncation,
|
|
238
245
|
...rest
|
|
239
246
|
}: ButtonProps) {
|
|
240
247
|
// Hover state is web-only in practice; the setter is gated so native taps
|
|
@@ -294,7 +301,7 @@ function ButtonImpl({
|
|
|
294
301
|
content = (
|
|
295
302
|
<Text
|
|
296
303
|
style={activeLabelStyle}
|
|
297
|
-
|
|
304
|
+
{...resolveTruncation(disableTruncation, 1)}
|
|
298
305
|
>
|
|
299
306
|
{label}
|
|
300
307
|
</Text>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
10
10
|
import { useTokens } from '../../design-tokens/JFSThemeProvider'
|
|
11
11
|
import Icon from '../../icons/Icon'
|
|
12
|
-
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils'
|
|
12
|
+
import { EMPTY_MODES, cloneChildrenWithModes, resolveTruncation } from '../../utils/react-utils'
|
|
13
13
|
import CircularProgressBar from '../CircularProgressBar/CircularProgressBar'
|
|
14
14
|
import Nudge from '../Nudge/Nudge'
|
|
15
15
|
import type { Modes } from '../../design-tokens'
|
|
@@ -57,6 +57,12 @@ export type CardAdvisoryProps = CardAdvisoryBaseProps & {
|
|
|
57
57
|
nudgeStyle?: StyleProp<ViewStyle>
|
|
58
58
|
/** Accessibility label for the full card. */
|
|
59
59
|
accessibilityLabel?: string
|
|
60
|
+
/**
|
|
61
|
+
* When `true`, disables text truncation: the trailing ellipsis (`…`) is never
|
|
62
|
+
* shown and any `numberOfLines` clamp is ignored, so the text wraps to as many
|
|
63
|
+
* lines as it needs even when horizontal space is tight.
|
|
64
|
+
*/
|
|
65
|
+
disableTruncation?: boolean
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
interface CardAdvisoryTokens {
|
|
@@ -195,6 +201,7 @@ function CardAdvisory({
|
|
|
195
201
|
progressStyle,
|
|
196
202
|
nudgeStyle,
|
|
197
203
|
accessibilityLabel,
|
|
204
|
+
disableTruncation,
|
|
198
205
|
...rest
|
|
199
206
|
}: CardAdvisoryProps) {
|
|
200
207
|
const { modes: globalModes } = useTokens()
|
|
@@ -236,7 +243,7 @@ function CardAdvisory({
|
|
|
236
243
|
<View style={[tokens.mainContentStyle, mainContentStyle]}>
|
|
237
244
|
<View style={tokens.contentStyle}>
|
|
238
245
|
<View style={tokens.headerStyle}>
|
|
239
|
-
<Text
|
|
246
|
+
<Text {...resolveTruncation(disableTruncation, 1)} style={[tokens.titleStyle, titleStyle]}>
|
|
240
247
|
{title}
|
|
241
248
|
</Text>
|
|
242
249
|
{processedTitleEndSlot || (showInfoIcon ? (
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type TextStyle,
|
|
8
8
|
} from 'react-native'
|
|
9
9
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
10
|
-
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils'
|
|
10
|
+
import { EMPTY_MODES, cloneChildrenWithModes, resolveTruncation } from '../../utils/react-utils'
|
|
11
11
|
import Badge from '../Badge/Badge'
|
|
12
12
|
import Button from '../Button/Button'
|
|
13
13
|
import InstitutionBadge from '../InstitutionBadge/InstitutionBadge'
|
|
@@ -80,6 +80,12 @@ export type CardBankAccountProps = {
|
|
|
80
80
|
style?: StyleProp<ViewStyle>
|
|
81
81
|
/** Accessibility label for the card region. */
|
|
82
82
|
accessibilityLabel?: string
|
|
83
|
+
/**
|
|
84
|
+
* When `true`, disables text truncation: the trailing ellipsis (`…`) is never
|
|
85
|
+
* shown and any `numberOfLines` clamp is ignored, so the text wraps to as many
|
|
86
|
+
* lines as it needs even when horizontal space is tight.
|
|
87
|
+
*/
|
|
88
|
+
disableTruncation?: boolean
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
const DEFAULT_ITEMS: CardBankAccountItem[] = [
|
|
@@ -138,6 +144,7 @@ function CardBankAccount({
|
|
|
138
144
|
modes: propModes = EMPTY_MODES,
|
|
139
145
|
style,
|
|
140
146
|
accessibilityLabel,
|
|
147
|
+
disableTruncation,
|
|
141
148
|
}: CardBankAccountProps) {
|
|
142
149
|
// Merge caller modes on top of `DEFAULT_MODES` so every default key
|
|
143
150
|
// (e.g. `Button / Size`, `AppearanceBrand`, `Emphasis`) can be overridden
|
|
@@ -268,7 +275,7 @@ function CardBankAccount({
|
|
|
268
275
|
<Text style={labelStyle}>{item.label}</Text>
|
|
269
276
|
</View>
|
|
270
277
|
{typeof item.value === 'string' || typeof item.value === 'number' ? (
|
|
271
|
-
<Text style={valueTextStyle}
|
|
278
|
+
<Text style={valueTextStyle} {...resolveTruncation(disableTruncation, 1)}>
|
|
272
279
|
{item.value}
|
|
273
280
|
</Text>
|
|
274
281
|
) : (
|