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,324 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TableBody = TableBody;
|
|
7
|
+
exports.TableCell = TableCell;
|
|
8
|
+
exports.TableHeader = TableHeader;
|
|
9
|
+
exports.TableHeaderCell = TableHeaderCell;
|
|
10
|
+
exports.TableRow = TableRow;
|
|
11
|
+
exports.default = void 0;
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _reactNative = require("react-native");
|
|
14
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
15
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
/* -------------------------------------------------------------------------------------------------
|
|
19
|
+
* Shared types & token resolution
|
|
20
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
21
|
+
|
|
22
|
+
/** Resolved styling for a header cell and a body cell, derived from design tokens. */
|
|
23
|
+
|
|
24
|
+
const toWeight = w => typeof w === 'number' ? `${w}` : w;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Resolve every token the table family needs in one place. Sub-components call
|
|
28
|
+
* this with their cascaded `modes` so they render correctly both inside a
|
|
29
|
+
* `Table` and when used standalone. Fallbacks mirror the Figma node values
|
|
30
|
+
* (`tableCell/*`, `tableHeader/*`) so the component is faithful even before the
|
|
31
|
+
* tokens are published to the local store.
|
|
32
|
+
*/
|
|
33
|
+
function resolveTableTokens(modes) {
|
|
34
|
+
const headerFontFamily = (0, _figmaVariablesResolver.getVariableByName)('tableHeader/label/fontfamily', modes) ?? 'JioType Var';
|
|
35
|
+
const headerFontSize = (0, _figmaVariablesResolver.getVariableByName)('tableHeader/label/fontsize', modes) ?? 14;
|
|
36
|
+
const headerFontWeight = (0, _figmaVariablesResolver.getVariableByName)('tableHeader/label/fontweight', modes) ?? 600;
|
|
37
|
+
const cellFontFamily = (0, _figmaVariablesResolver.getVariableByName)('tableCell/label/fontfamily', modes) ?? 'JioType Var';
|
|
38
|
+
const cellFontSize = (0, _figmaVariablesResolver.getVariableByName)('tableCell/label/fontsize', modes) ?? 14;
|
|
39
|
+
const cellFontWeight = (0, _figmaVariablesResolver.getVariableByName)('tableCell/label/fontweight', modes) ?? 400;
|
|
40
|
+
return {
|
|
41
|
+
headerBg: (0, _figmaVariablesResolver.getVariableByName)('tableHeader/background/color', modes) ?? '#f5f5f5',
|
|
42
|
+
headerPaddingH: (0, _figmaVariablesResolver.getVariableByName)('tableHeader/padding/horizontal', modes) ?? 12,
|
|
43
|
+
headerPaddingV: (0, _figmaVariablesResolver.getVariableByName)('tableHeader/padding/vertical', modes) ?? 12,
|
|
44
|
+
headerText: {
|
|
45
|
+
color: (0, _figmaVariablesResolver.getVariableByName)('tableHeader/label/color', modes) ?? '#000000',
|
|
46
|
+
fontFamily: headerFontFamily,
|
|
47
|
+
fontSize: headerFontSize,
|
|
48
|
+
fontWeight: toWeight(headerFontWeight),
|
|
49
|
+
lineHeight: 20
|
|
50
|
+
},
|
|
51
|
+
cellBg: (0, _figmaVariablesResolver.getVariableByName)('tableCell/background/color', modes) ?? '#ffffff',
|
|
52
|
+
cellPaddingH: (0, _figmaVariablesResolver.getVariableByName)('tableCell/padding/horizontal', modes) ?? 12,
|
|
53
|
+
cellPaddingV: (0, _figmaVariablesResolver.getVariableByName)('tableCell/padding/vertical', modes) ?? 12,
|
|
54
|
+
cellText: {
|
|
55
|
+
color: (0, _figmaVariablesResolver.getVariableByName)('tableCell/label/color', modes) ?? '#000000',
|
|
56
|
+
fontFamily: cellFontFamily,
|
|
57
|
+
fontSize: cellFontSize,
|
|
58
|
+
fontWeight: toWeight(cellFontWeight),
|
|
59
|
+
lineHeight: 20
|
|
60
|
+
},
|
|
61
|
+
borderColor: (0, _figmaVariablesResolver.getVariableByName)('tableCell/border/color', modes) ?? '#eeeeee',
|
|
62
|
+
borderSize: (0, _figmaVariablesResolver.getVariableByName)('tableCell/border/size', modes) ?? 1
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const alignToJustify = align => align === 'center' ? 'center' : align === 'right' ? 'flex-end' : 'flex-start';
|
|
66
|
+
|
|
67
|
+
/** Renders text children through the resolved label style; passes elements through untouched. */
|
|
68
|
+
function renderCellContent(children, textStyle, align, modes) {
|
|
69
|
+
if (children == null || children === false) return null;
|
|
70
|
+
if (typeof children === 'string' || typeof children === 'number') {
|
|
71
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
72
|
+
style: [textStyle, {
|
|
73
|
+
textAlign: align
|
|
74
|
+
}],
|
|
75
|
+
children: children
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return (0, _reactUtils.cloneChildrenWithModes)(children, modes);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* -------------------------------------------------------------------------------------------------
|
|
82
|
+
* Table.Cell — body cell (Figma `table-cell`, node 603:23)
|
|
83
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* A single body cell. White background with a bottom + right divider, matching
|
|
87
|
+
* the Figma `table-cell` sub-component. String/number children are rendered
|
|
88
|
+
* with the token label style; any element is rendered as-is.
|
|
89
|
+
*/
|
|
90
|
+
function TableCell({
|
|
91
|
+
children,
|
|
92
|
+
align = 'left',
|
|
93
|
+
width,
|
|
94
|
+
flex = 1,
|
|
95
|
+
isLastColumn = false,
|
|
96
|
+
isLastRow = false,
|
|
97
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
98
|
+
style
|
|
99
|
+
}) {
|
|
100
|
+
const t = resolveTableTokens(modes);
|
|
101
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
102
|
+
style: [{
|
|
103
|
+
backgroundColor: t.cellBg,
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
justifyContent: alignToJustify(align),
|
|
107
|
+
paddingHorizontal: t.cellPaddingH,
|
|
108
|
+
paddingVertical: t.cellPaddingV,
|
|
109
|
+
borderColor: t.borderColor,
|
|
110
|
+
borderBottomWidth: isLastRow ? 0 : t.borderSize,
|
|
111
|
+
borderRightWidth: isLastColumn ? 0 : t.borderSize,
|
|
112
|
+
...(width != null ? {
|
|
113
|
+
width
|
|
114
|
+
} : {
|
|
115
|
+
flex,
|
|
116
|
+
minWidth: 0
|
|
117
|
+
})
|
|
118
|
+
}, style],
|
|
119
|
+
children: renderCellContent(children, t.cellText, align, modes)
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* -------------------------------------------------------------------------------------------------
|
|
124
|
+
* Table.HeaderCell — header cell (Figma `table header wrap`, node 603:21)
|
|
125
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* A single header cell. Muted background with the bold token label style,
|
|
129
|
+
* matching the Figma `table header wrap` sub-component. Header cells carry no
|
|
130
|
+
* dividers; the header row draws a single bottom divider beneath them.
|
|
131
|
+
*/
|
|
132
|
+
function TableHeaderCell({
|
|
133
|
+
children,
|
|
134
|
+
align = 'left',
|
|
135
|
+
width,
|
|
136
|
+
flex = 1,
|
|
137
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
138
|
+
style
|
|
139
|
+
}) {
|
|
140
|
+
const t = resolveTableTokens(modes);
|
|
141
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
142
|
+
style: [{
|
|
143
|
+
backgroundColor: t.headerBg,
|
|
144
|
+
flexDirection: 'row',
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
justifyContent: alignToJustify(align),
|
|
147
|
+
paddingHorizontal: t.headerPaddingH,
|
|
148
|
+
paddingVertical: t.headerPaddingV,
|
|
149
|
+
...(width != null ? {
|
|
150
|
+
width
|
|
151
|
+
} : {
|
|
152
|
+
flex,
|
|
153
|
+
minWidth: 0
|
|
154
|
+
})
|
|
155
|
+
}, style],
|
|
156
|
+
children: renderCellContent(children, t.headerText, align, modes)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* -------------------------------------------------------------------------------------------------
|
|
161
|
+
* Table.Header — row of header cells with a bottom divider
|
|
162
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
163
|
+
|
|
164
|
+
function TableHeader({
|
|
165
|
+
children,
|
|
166
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
167
|
+
style
|
|
168
|
+
}) {
|
|
169
|
+
const t = resolveTableTokens(modes);
|
|
170
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
171
|
+
style: [{
|
|
172
|
+
flexDirection: 'row',
|
|
173
|
+
width: '100%',
|
|
174
|
+
borderBottomWidth: t.borderSize,
|
|
175
|
+
borderBottomColor: t.borderColor
|
|
176
|
+
}, style],
|
|
177
|
+
children: (0, _reactUtils.cloneChildrenWithModes)(children, modes)
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* -------------------------------------------------------------------------------------------------
|
|
182
|
+
* Table.Row — row of body cells
|
|
183
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
184
|
+
|
|
185
|
+
function TableRow({
|
|
186
|
+
children,
|
|
187
|
+
onPress,
|
|
188
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
189
|
+
style
|
|
190
|
+
}) {
|
|
191
|
+
const rowStyle = {
|
|
192
|
+
flexDirection: 'row',
|
|
193
|
+
width: '100%'
|
|
194
|
+
};
|
|
195
|
+
const content = (0, _reactUtils.cloneChildrenWithModes)(children, modes);
|
|
196
|
+
if (onPress) {
|
|
197
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
198
|
+
onPress: onPress,
|
|
199
|
+
accessibilityRole: "button",
|
|
200
|
+
style: ({
|
|
201
|
+
pressed
|
|
202
|
+
}) => [rowStyle, pressed ? {
|
|
203
|
+
opacity: 0.6
|
|
204
|
+
} : null, style],
|
|
205
|
+
children: content
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
209
|
+
style: [rowStyle, style],
|
|
210
|
+
children: content
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* -------------------------------------------------------------------------------------------------
|
|
215
|
+
* Table.Body — column container for rows
|
|
216
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
217
|
+
|
|
218
|
+
function TableBody({
|
|
219
|
+
children,
|
|
220
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
221
|
+
style
|
|
222
|
+
}) {
|
|
223
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
224
|
+
style: [{
|
|
225
|
+
width: '100%'
|
|
226
|
+
}, style],
|
|
227
|
+
children: (0, _reactUtils.cloneChildrenWithModes)(children, modes)
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* -------------------------------------------------------------------------------------------------
|
|
232
|
+
* Table — root (Figma `Table`, node 5732:3710)
|
|
233
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Column definition for the data-driven `Table` API. `T` is the shape of one
|
|
237
|
+
* row record.
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Table renders structured rows and columns. It supports two complementary
|
|
242
|
+
* usage styles that share the same token-driven styling:
|
|
243
|
+
*
|
|
244
|
+
* 1. **Data-driven** (recommended): pass `columns` + `data`. The header and body
|
|
245
|
+
* are built for you, columns stay aligned, and per-column `align`/`width`/
|
|
246
|
+
* `flex`/`render` give full control.
|
|
247
|
+
*
|
|
248
|
+
* 2. **Composition**: pass `Table.Header` / `Table.Body` / `Table.Row` /
|
|
249
|
+
* `Table.Cell` / `Table.HeaderCell` as children for bespoke layouts. These
|
|
250
|
+
* sub-components are also exported standalone.
|
|
251
|
+
*
|
|
252
|
+
* Implementation of Figma node `5732:3710` (`Table`) with sub-components
|
|
253
|
+
* `603:23` (`table-cell`) and `603:21` (`table header wrap`).
|
|
254
|
+
*
|
|
255
|
+
* @component
|
|
256
|
+
*/
|
|
257
|
+
function Table({
|
|
258
|
+
columns,
|
|
259
|
+
data,
|
|
260
|
+
children,
|
|
261
|
+
showHeader = true,
|
|
262
|
+
getRowKey,
|
|
263
|
+
onRowPress,
|
|
264
|
+
scrollable = false,
|
|
265
|
+
accessibilityLabel,
|
|
266
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
267
|
+
style
|
|
268
|
+
}) {
|
|
269
|
+
const isComposition = children != null;
|
|
270
|
+
const body = isComposition ? (0, _reactUtils.cloneChildrenWithModes)(children, modes) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
271
|
+
children: [showHeader && columns && columns.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(TableHeader, {
|
|
272
|
+
modes: modes,
|
|
273
|
+
children: columns.map(col => /*#__PURE__*/(0, _jsxRuntime.jsx)(TableHeaderCell, {
|
|
274
|
+
align: col.headerAlign ?? col.align ?? 'left',
|
|
275
|
+
width: col.width,
|
|
276
|
+
flex: col.flex ?? 1,
|
|
277
|
+
modes: modes,
|
|
278
|
+
children: col.header ?? col.key
|
|
279
|
+
}, col.key))
|
|
280
|
+
}), columns && data && data.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(TableBody, {
|
|
281
|
+
modes: modes,
|
|
282
|
+
children: data.map((row, rowIndex) => {
|
|
283
|
+
const isLastRow = rowIndex === data.length - 1;
|
|
284
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TableRow, {
|
|
285
|
+
onPress: onRowPress ? () => onRowPress(row, rowIndex) : undefined,
|
|
286
|
+
modes: modes,
|
|
287
|
+
children: columns.map((col, colIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(TableCell, {
|
|
288
|
+
align: col.align ?? 'left',
|
|
289
|
+
width: col.width,
|
|
290
|
+
flex: col.flex ?? 1,
|
|
291
|
+
isLastColumn: colIndex === columns.length - 1,
|
|
292
|
+
isLastRow: isLastRow,
|
|
293
|
+
modes: modes,
|
|
294
|
+
children: col.render ? col.render(row, rowIndex) : row[col.key]
|
|
295
|
+
}, col.key))
|
|
296
|
+
}, getRowKey?.(row, rowIndex) ?? rowIndex);
|
|
297
|
+
})
|
|
298
|
+
})]
|
|
299
|
+
});
|
|
300
|
+
const container = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
301
|
+
accessibilityRole: _reactNative.Platform.OS === 'web' ? 'table' : undefined,
|
|
302
|
+
accessibilityLabel: accessibilityLabel,
|
|
303
|
+
style: [{
|
|
304
|
+
overflow: 'hidden'
|
|
305
|
+
}, !scrollable && {
|
|
306
|
+
width: '100%'
|
|
307
|
+
}, style],
|
|
308
|
+
children: body
|
|
309
|
+
});
|
|
310
|
+
if (scrollable) {
|
|
311
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
312
|
+
horizontal: true,
|
|
313
|
+
showsHorizontalScrollIndicator: false,
|
|
314
|
+
children: container
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
return container;
|
|
318
|
+
}
|
|
319
|
+
Table.Header = TableHeader;
|
|
320
|
+
Table.HeaderCell = TableHeaderCell;
|
|
321
|
+
Table.Body = TableBody;
|
|
322
|
+
Table.Row = TableRow;
|
|
323
|
+
Table.Cell = TableCell;
|
|
324
|
+
var _default = exports.default = Table;
|
|
@@ -23,6 +23,7 @@ function Text({
|
|
|
23
23
|
modes = _reactUtils.EMPTY_MODES,
|
|
24
24
|
style,
|
|
25
25
|
numberOfLines,
|
|
26
|
+
disableTruncation,
|
|
26
27
|
loading,
|
|
27
28
|
skeletonWidth,
|
|
28
29
|
skeletonLines
|
|
@@ -75,7 +76,7 @@ function Text({
|
|
|
75
76
|
const content = children !== undefined && children !== null && children !== false ? children : text !== undefined ? text : 'Korem ipsum ';
|
|
76
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
77
78
|
style: [textStyle, style],
|
|
78
|
-
|
|
79
|
+
...(0, _reactUtils.resolveTruncation)(disableTruncation, numberOfLines),
|
|
79
80
|
children: content
|
|
80
81
|
});
|
|
81
82
|
}
|
|
@@ -101,7 +101,7 @@ function makePlaceholderColor(color, opacity = 0.5) {
|
|
|
101
101
|
// Fallback: return original color
|
|
102
102
|
return color;
|
|
103
103
|
}
|
|
104
|
-
function TextInput({
|
|
104
|
+
const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)(function TextInput({
|
|
105
105
|
placeholder = '',
|
|
106
106
|
value = '',
|
|
107
107
|
onChangeText,
|
|
@@ -116,7 +116,7 @@ function TextInput({
|
|
|
116
116
|
accessibilityLabel,
|
|
117
117
|
accessibilityHint,
|
|
118
118
|
...rest
|
|
119
|
-
}) {
|
|
119
|
+
}, ref) {
|
|
120
120
|
// Track focus state to hide placeholder when focused
|
|
121
121
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
122
122
|
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
@@ -172,7 +172,15 @@ function TextInput({
|
|
|
172
172
|
flex: 1,
|
|
173
173
|
color: textColor,
|
|
174
174
|
fontSize,
|
|
175
|
-
lineHeight
|
|
175
|
+
// iOS-only quirk: a single-line RNTextInput with an explicit `lineHeight`
|
|
176
|
+
// larger than `fontSize` puts all the extra space ABOVE the glyphs, so the
|
|
177
|
+
// text/placeholder sits below center (iOS native font-metrics bug — see
|
|
178
|
+
// facebook/react-native#39145 / #28012). The container centers via
|
|
179
|
+
// `alignItems: 'center'` + `minHeight`, so omit lineHeight on iOS
|
|
180
|
+
// (UITextField centers natively) and keep it on Android/Web where it's fine.
|
|
181
|
+
...(_reactNative.Platform.OS === 'ios' ? null : {
|
|
182
|
+
lineHeight
|
|
183
|
+
}),
|
|
176
184
|
fontFamily,
|
|
177
185
|
fontWeight,
|
|
178
186
|
padding: 0,
|
|
@@ -231,7 +239,7 @@ function TextInput({
|
|
|
231
239
|
importantForAccessibility: "no",
|
|
232
240
|
children: processedLeading
|
|
233
241
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
234
|
-
ref: inputRef,
|
|
242
|
+
ref: (0, _reactUtils.mergeRefs)(inputRef, ref),
|
|
235
243
|
accessibilityLabel: undefined,
|
|
236
244
|
accessibilityHint: accessibilityHint,
|
|
237
245
|
placeholder: displayPlaceholder,
|
|
@@ -264,7 +272,7 @@ function TextInput({
|
|
|
264
272
|
style: containerStyleArray,
|
|
265
273
|
children: inner
|
|
266
274
|
});
|
|
267
|
-
}
|
|
275
|
+
});
|
|
268
276
|
|
|
269
277
|
/**
|
|
270
278
|
* TextInput.Search component that mirrors the Figma "textInput.search" component.
|
|
@@ -286,7 +294,7 @@ function TextInput({
|
|
|
286
294
|
* @param {Object} [props.rest] - Additional props passed to the underlying TextInput
|
|
287
295
|
*/
|
|
288
296
|
|
|
289
|
-
function TextInputSearch({
|
|
297
|
+
const TextInputSearch = /*#__PURE__*/(0, _react.forwardRef)(function TextInputSearch({
|
|
290
298
|
placeholder = 'Search',
|
|
291
299
|
value = '',
|
|
292
300
|
onChangeText,
|
|
@@ -299,7 +307,7 @@ function TextInputSearch({
|
|
|
299
307
|
onFocus,
|
|
300
308
|
onBlur,
|
|
301
309
|
...rest
|
|
302
|
-
}) {
|
|
310
|
+
}, ref) {
|
|
303
311
|
// Resolve icon tokens for default search icon
|
|
304
312
|
const iconColor = (0, _figmaVariablesResolver.getVariableByName)('textInput/icon/color', modes) || '#24262b';
|
|
305
313
|
const iconSize = (0, _figmaVariablesResolver.getVariableByName)('textInput/icon/size', modes) || 18;
|
|
@@ -336,10 +344,15 @@ function TextInputSearch({
|
|
|
336
344
|
textInputProps.accessibilityHint = accessibilityHint;
|
|
337
345
|
}
|
|
338
346
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextInput, {
|
|
347
|
+
ref: ref,
|
|
339
348
|
...textInputProps
|
|
340
349
|
});
|
|
341
|
-
}
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
// Attach Search as a property of TextInput using namespace pattern. The base
|
|
353
|
+
// component is created via forwardRef, so we compose the static onto a typed
|
|
354
|
+
// alias to keep `TextInput.Search` strongly typed.
|
|
342
355
|
|
|
343
|
-
|
|
356
|
+
const TextInput = TextInputBase;
|
|
344
357
|
TextInput.Search = TextInputSearch;
|
|
345
358
|
var _default = exports.default = TextInput;
|
|
@@ -0,0 +1,119 @@
|
|
|
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 _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
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); }
|
|
13
|
+
/**
|
|
14
|
+
* A single coloured run inside a {@link TextSegment}. Each run can carry its own
|
|
15
|
+
* `modes`, so individual fragments of the same paragraph can resolve different
|
|
16
|
+
* design tokens (most commonly a different `text/foreground` colour) while still
|
|
17
|
+
* flowing — and wrapping — inline as one continuous line of text.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const TEXT_ALIGN_MAP = {
|
|
21
|
+
Left: 'left',
|
|
22
|
+
Center: 'center'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the `text/*` design tokens for a given modes object into an RN
|
|
27
|
+
* `TextStyle`. Shared by the outer paragraph and every inline run so a run that
|
|
28
|
+
* only overrides colour still inherits the family/size/weight/spacing.
|
|
29
|
+
*/
|
|
30
|
+
function resolveTextStyle(modes) {
|
|
31
|
+
return {
|
|
32
|
+
color: (0, _figmaVariablesResolver.getVariableByName)('text/foreground', modes) ?? '#000000',
|
|
33
|
+
fontFamily: (0, _figmaVariablesResolver.getVariableByName)('text/fontFamily', modes) ?? 'JioType',
|
|
34
|
+
fontSize: (0, _figmaVariablesResolver.getVariableByName)('text/fontSize', modes) ?? 14,
|
|
35
|
+
fontWeight: String((0, _figmaVariablesResolver.getVariableByName)('text/fontWeight', modes) ?? '500'),
|
|
36
|
+
lineHeight: (0, _figmaVariablesResolver.getVariableByName)('text/lineHeight', modes) ?? 20,
|
|
37
|
+
letterSpacing: (0, _figmaVariablesResolver.getVariableByName)('text/letterSpacing', modes) ?? -0.5
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* TextSegment — composes several differently-styled text runs into a single
|
|
43
|
+
* paragraph that wraps as one continuous line.
|
|
44
|
+
*
|
|
45
|
+
* On the web you would reach for `<span>`s inside a `<p>`; the React Native
|
|
46
|
+
* equivalent is nesting `<Text>` inside a parent `<Text>`. That nesting is the
|
|
47
|
+
* whole trick: sibling `<View>`s would lay out as flex blocks and break onto
|
|
48
|
+
* rigid rows, but nested `<Text>` nodes flow inline and wrap naturally at word
|
|
49
|
+
* boundaries — exactly like a real paragraph — while each nested run keeps its
|
|
50
|
+
* own colour/weight resolved from its own `modes`.
|
|
51
|
+
*
|
|
52
|
+
* Two equivalent ways to author content:
|
|
53
|
+
* - **`segments` prop** — declarative array of `{ text, modes }` runs.
|
|
54
|
+
* - **`children`** — pass library `Text` elements (or strings); the parent
|
|
55
|
+
* `modes` cascade down and each child may override its own.
|
|
56
|
+
*
|
|
57
|
+
* @example Data-driven
|
|
58
|
+
* ```tsx
|
|
59
|
+
* <TextSegment
|
|
60
|
+
* segments={[
|
|
61
|
+
* { text: 'Upsell message ' },
|
|
62
|
+
* { text: 'JioFinance+', modes: { 'Text Appearance': 'Primary' } },
|
|
63
|
+
* ]}
|
|
64
|
+
* />
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example Compositional
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <TextSegment numberOfLines={2}>
|
|
70
|
+
* <Text>Pay with </Text>
|
|
71
|
+
* <Text modes={{ 'Text Appearance': 'Primary' }}>JioFinance+</Text>
|
|
72
|
+
* <Text> and earn rewards on every transaction.</Text>
|
|
73
|
+
* </TextSegment>
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
function TextSegment({
|
|
77
|
+
segments,
|
|
78
|
+
children,
|
|
79
|
+
textAlign = 'Left',
|
|
80
|
+
numberOfLines,
|
|
81
|
+
disableTruncation,
|
|
82
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
83
|
+
style
|
|
84
|
+
}) {
|
|
85
|
+
const baseStyle = (0, _react.useMemo)(() => ({
|
|
86
|
+
...resolveTextStyle(modes),
|
|
87
|
+
textAlign: TEXT_ALIGN_MAP[textAlign]
|
|
88
|
+
}), [modes, textAlign]);
|
|
89
|
+
|
|
90
|
+
// children win over `segments` so the compositional API can always override.
|
|
91
|
+
const hasChildren = children !== undefined && children !== null && children !== false;
|
|
92
|
+
const renderedSegments = (0, _react.useMemo)(() => {
|
|
93
|
+
if (hasChildren || !segments?.length) return null;
|
|
94
|
+
return segments.map((run, index) => {
|
|
95
|
+
// Parent modes first, then the run's own modes override them — mirrors the
|
|
96
|
+
// merge order used by `cloneChildrenWithModes` for the children API.
|
|
97
|
+
const runModes = run.modes ? {
|
|
98
|
+
...modes,
|
|
99
|
+
...run.modes
|
|
100
|
+
} : modes;
|
|
101
|
+
const runStyle = run.modes ? resolveTextStyle(runModes) : undefined;
|
|
102
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
103
|
+
style: [runStyle, run.style],
|
|
104
|
+
children: run.text
|
|
105
|
+
}, index);
|
|
106
|
+
});
|
|
107
|
+
}, [segments, hasChildren, modes]);
|
|
108
|
+
|
|
109
|
+
// The cascade: every child (and its descendants) receives the parent modes so
|
|
110
|
+
// nested library `Text` runs resolve their tokens against the same baseline,
|
|
111
|
+
// while still honouring any per-child `modes` override.
|
|
112
|
+
const content = hasChildren ? (0, _reactUtils.cloneChildrenWithModes)(children, modes) : renderedSegments;
|
|
113
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
114
|
+
style: [baseStyle, style],
|
|
115
|
+
...(0, _reactUtils.resolveTruncation)(disableTruncation, numberOfLines),
|
|
116
|
+
children: content
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(TextSegment);
|
|
@@ -19,7 +19,8 @@ function ThreadHero({
|
|
|
19
19
|
caption,
|
|
20
20
|
renderAvatar,
|
|
21
21
|
modes = _reactUtils.EMPTY_MODES,
|
|
22
|
-
style
|
|
22
|
+
style,
|
|
23
|
+
disableTruncation
|
|
23
24
|
}) {
|
|
24
25
|
// Container Gaps
|
|
25
26
|
const containerGap = Number((0, _figmaVariablesResolver.getVariableByName)('threadHero/gap', modes)) || 8;
|
|
@@ -100,14 +101,12 @@ function ThreadHero({
|
|
|
100
101
|
children: title
|
|
101
102
|
}) : null, subtitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
102
103
|
style: subtitleStyle,
|
|
103
|
-
|
|
104
|
-
ellipsizeMode: "tail",
|
|
104
|
+
...(0, _reactUtils.resolveTruncation)(disableTruncation, 1, 'tail'),
|
|
105
105
|
children: subtitle
|
|
106
106
|
}) : null]
|
|
107
107
|
}), caption ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
108
108
|
style: captionStyle,
|
|
109
|
-
|
|
110
|
-
ellipsizeMode: "tail",
|
|
109
|
+
...(0, _reactUtils.resolveTruncation)(disableTruncation, 1, 'tail'),
|
|
111
110
|
children: caption
|
|
112
111
|
}) : null]
|
|
113
112
|
});
|
|
@@ -24,6 +24,7 @@ function Title({
|
|
|
24
24
|
textStyle,
|
|
25
25
|
subtitleStyle,
|
|
26
26
|
numberOfLines,
|
|
27
|
+
disableTruncation,
|
|
27
28
|
accessibilityLabel,
|
|
28
29
|
accessibilityHint,
|
|
29
30
|
...rest
|
|
@@ -93,7 +94,7 @@ function Title({
|
|
|
93
94
|
...rest,
|
|
94
95
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
95
96
|
style: [titleTextStyle, textStyle],
|
|
96
|
-
|
|
97
|
+
...(0, _reactUtils.resolveTruncation)(disableTruncation, numberOfLines !== undefined ? numberOfLines : 1),
|
|
97
98
|
accessibilityElementsHidden: true,
|
|
98
99
|
importantForAccessibility: "no",
|
|
99
100
|
children: title
|
|
@@ -20,7 +20,8 @@ function Toast({
|
|
|
20
20
|
onClose,
|
|
21
21
|
modes = _reactUtils.EMPTY_MODES,
|
|
22
22
|
placement = 'bottom',
|
|
23
|
-
style
|
|
23
|
+
style,
|
|
24
|
+
disableTruncation
|
|
24
25
|
}) {
|
|
25
26
|
const timerRef = (0, _react.useRef)(null);
|
|
26
27
|
(0, _react.useEffect)(() => {
|
|
@@ -78,7 +79,7 @@ function Toast({
|
|
|
78
79
|
accessibilityLiveRegion: "assertive",
|
|
79
80
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
80
81
|
style: textStyle,
|
|
81
|
-
|
|
82
|
+
...(0, _reactUtils.resolveTruncation)(disableTruncation, 2),
|
|
82
83
|
children: title
|
|
83
84
|
})
|
|
84
85
|
});
|
|
@@ -45,6 +45,7 @@ function TransactionBubble({
|
|
|
45
45
|
accessibilityLabel,
|
|
46
46
|
accessibilityHint,
|
|
47
47
|
webAccessibilityProps,
|
|
48
|
+
disableTruncation,
|
|
48
49
|
...rest
|
|
49
50
|
}) {
|
|
50
51
|
const resolvedModes = {
|
|
@@ -114,7 +115,7 @@ function TransactionBubble({
|
|
|
114
115
|
},
|
|
115
116
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
116
117
|
style: descriptionStyle,
|
|
117
|
-
|
|
118
|
+
...(0, _reactUtils.resolveTruncation)(disableTruncation, 1),
|
|
118
119
|
children: description
|
|
119
120
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoneyValue.default, {
|
|
120
121
|
value: value,
|
|
@@ -42,7 +42,8 @@ function TransactionStatus({
|
|
|
42
42
|
status = 'Expired',
|
|
43
43
|
date = '20 Mar 2025',
|
|
44
44
|
modes = _reactUtils.EMPTY_MODES,
|
|
45
|
-
style
|
|
45
|
+
style,
|
|
46
|
+
disableTruncation
|
|
46
47
|
}) {
|
|
47
48
|
const gap = Number((0, _figmaVariablesResolver.getVariableByName)('transactionBubble/statusWrap/gap', modes)) || 4;
|
|
48
49
|
// Using 'transactionStatus' tokens for text
|
|
@@ -75,7 +76,7 @@ function TransactionStatus({
|
|
|
75
76
|
modes: modes
|
|
76
77
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
77
78
|
style: textStyle,
|
|
78
|
-
|
|
79
|
+
...(0, _reactUtils.resolveTruncation)(disableTruncation, 1),
|
|
79
80
|
children: [status, " \xB7 ", date]
|
|
80
81
|
})]
|
|
81
82
|
});
|
|
@@ -113,6 +113,7 @@ function UpiHandle({
|
|
|
113
113
|
onPress,
|
|
114
114
|
onClick,
|
|
115
115
|
disabled,
|
|
116
|
+
disableTruncation,
|
|
116
117
|
// accessibilityLabel is accepted on the type for API back-compat; the
|
|
117
118
|
// wrapper renders `accessibilityLabel={undefined}` because the inner Text
|
|
118
119
|
// already carries the label.
|
|
@@ -175,8 +176,7 @@ function UpiHandle({
|
|
|
175
176
|
})
|
|
176
177
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
177
178
|
style: tokens.labelStyle,
|
|
178
|
-
|
|
179
|
-
ellipsizeMode: "tail",
|
|
179
|
+
...(0, _reactUtils.resolveTruncation)(disableTruncation, 1, 'tail'),
|
|
180
180
|
accessibilityElementsHidden: true,
|
|
181
181
|
importantForAccessibility: "no",
|
|
182
182
|
children: label
|