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
|
@@ -8,7 +8,7 @@ import NavArrow from '../NavArrow/NavArrow';
|
|
|
8
8
|
import IconCapsule from '../IconCapsule/IconCapsule';
|
|
9
9
|
import ListItem from '../ListItem/ListItem';
|
|
10
10
|
import { usePressableWebSupport } from '../../utils/web-platform-utils';
|
|
11
|
-
import { EMPTY_MODES, cloneChildrenWithModes, flattenChildren } from '../../utils/react-utils';
|
|
11
|
+
import { EMPTY_MODES, cloneChildrenWithModes, flattenChildren, resolveTruncation } from '../../utils/react-utils';
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
// Match Button: delay the press visual on iOS so a scroll-cancelled touch
|
|
14
14
|
// never applies the "pressed" style. See Button.tsx for the rationale.
|
|
@@ -374,6 +374,7 @@ function Section({
|
|
|
374
374
|
accessibilityLabel: _accessibilityLabel,
|
|
375
375
|
accessibilityHint,
|
|
376
376
|
webAccessibilityProps,
|
|
377
|
+
disableTruncation,
|
|
377
378
|
...rest
|
|
378
379
|
}) {
|
|
379
380
|
// Focus and hover are still mirrored in React because they are visible,
|
|
@@ -409,7 +410,7 @@ function Section({
|
|
|
409
410
|
style: headerWrapStyle,
|
|
410
411
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
411
412
|
style: tokens.titleStyle,
|
|
412
|
-
|
|
413
|
+
...resolveTruncation(disableTruncation, 1),
|
|
413
414
|
accessibilityElementsHidden: true,
|
|
414
415
|
importantForAccessibility: "no",
|
|
415
416
|
children: title
|
|
@@ -419,7 +420,7 @@ function Section({
|
|
|
419
420
|
})]
|
|
420
421
|
}), showSupportText && /*#__PURE__*/_jsx(Text, {
|
|
421
422
|
style: tokens.supportTextStyle,
|
|
422
|
-
|
|
423
|
+
...resolveTruncation(disableTruncation, 2),
|
|
423
424
|
accessibilityElementsHidden: true,
|
|
424
425
|
importantForAccessibility: "no",
|
|
425
426
|
children: supportText
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { View, Text, PanResponder, Platform } from 'react-native';
|
|
5
|
+
import Svg, { Path } from 'react-native-svg';
|
|
6
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
7
|
+
import { EMPTY_MODES, resolveTruncation } from '../../utils/react-utils';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Imperative handle exposed via `ref`. The primary way to read a slider's value
|
|
11
|
+
* is still the controlled `value` + `onChange` pair (each `<Slider />` reports
|
|
12
|
+
* its own value, so multiple sliders are disambiguated by their own handlers).
|
|
13
|
+
* The ref is a convenience for reading the latest value on demand (e.g. on a
|
|
14
|
+
* button press) or imperatively nudging an uncontrolled slider.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const slider = useRef<SliderHandle>(null)
|
|
18
|
+
* slider.current?.setValue(50)
|
|
19
|
+
* const v = slider.current?.getValue()
|
|
20
|
+
*/
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
const clamp = (n, min, max) => Math.min(Math.max(n, min), max);
|
|
23
|
+
const asNum = (raw, fallback) => {
|
|
24
|
+
const n = typeof raw === 'number' ? raw : parseFloat(raw);
|
|
25
|
+
return Number.isFinite(n) ? n : fallback;
|
|
26
|
+
};
|
|
27
|
+
const asStr = (raw, fallback) => raw != null ? String(raw) : fallback;
|
|
28
|
+
|
|
29
|
+
// The unfilled track is rendered at a lighter emphasis in the design.
|
|
30
|
+
const TRACK_EMPHASIS = {
|
|
31
|
+
Emphasis: 'Low'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Slider — Figma node 5373:446 ("Slider").
|
|
36
|
+
*
|
|
37
|
+
* A horizontal, single-thumb slider driven entirely by design tokens. It maps a
|
|
38
|
+
* numeric range (`minValue`–`maxValue`) onto a track with a filled indicator, a
|
|
39
|
+
* draggable handle, a value bubble pinned above the handle, and optional min/max
|
|
40
|
+
* labels beneath the track. Built on `PanResponder` so the one code path works
|
|
41
|
+
* on iOS, Android and the web.
|
|
42
|
+
*
|
|
43
|
+
* The design only labels the range bounds, but a slider's purpose is to bind a
|
|
44
|
+
* value — so the live value is surfaced through the bubble (formatted via
|
|
45
|
+
* `formatOptions` / `formatValue`) and reported through `onChange` /
|
|
46
|
+
* `onChangeEnd`. Supports controlled and uncontrolled usage, web keyboard
|
|
47
|
+
* control, and an imperative {@link SliderHandle} `ref` for on-demand reads.
|
|
48
|
+
*/
|
|
49
|
+
const Slider = /*#__PURE__*/forwardRef(function Slider({
|
|
50
|
+
value: controlledValue,
|
|
51
|
+
defaultValue,
|
|
52
|
+
onChange,
|
|
53
|
+
onChangeEnd,
|
|
54
|
+
minValue = 0,
|
|
55
|
+
maxValue = 100,
|
|
56
|
+
step = 1,
|
|
57
|
+
isDisabled = false,
|
|
58
|
+
formatOptions,
|
|
59
|
+
locale,
|
|
60
|
+
formatValue,
|
|
61
|
+
renderTooltip,
|
|
62
|
+
alwaysShowTooltip = true,
|
|
63
|
+
showLabels = true,
|
|
64
|
+
minLabel,
|
|
65
|
+
maxLabel,
|
|
66
|
+
width = '100%',
|
|
67
|
+
modes = EMPTY_MODES,
|
|
68
|
+
style,
|
|
69
|
+
accessibilityLabel,
|
|
70
|
+
disableTruncation
|
|
71
|
+
}, ref) {
|
|
72
|
+
const tokens = useMemo(() => resolveTokens(modes), [modes]);
|
|
73
|
+
const isControlled = controlledValue !== undefined;
|
|
74
|
+
const [internalValue, setInternalValue] = useState(() => clamp(defaultValue ?? minValue, minValue, maxValue));
|
|
75
|
+
const rawValue = isControlled ? controlledValue : internalValue;
|
|
76
|
+
const currentValue = clamp(rawValue, minValue, maxValue);
|
|
77
|
+
const [trackWidth, setTrackWidth] = useState(0);
|
|
78
|
+
const [tooltipWidth, setTooltipWidth] = useState(0);
|
|
79
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
80
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
81
|
+
const quantize = useCallback(v => {
|
|
82
|
+
if (!step || step <= 0) return clamp(v, minValue, maxValue);
|
|
83
|
+
const stepped = Math.round((v - minValue) / step) * step + minValue;
|
|
84
|
+
// Round away float dust introduced by the division (e.g. 0.30000000000004).
|
|
85
|
+
const decimals = (String(step).split('.')[1] || '').length;
|
|
86
|
+
const fixed = decimals > 0 ? Number(stepped.toFixed(decimals)) : stepped;
|
|
87
|
+
return clamp(fixed, minValue, maxValue);
|
|
88
|
+
}, [minValue, maxValue, step]);
|
|
89
|
+
|
|
90
|
+
// Keep the latest interactive config in a ref so the PanResponder (created
|
|
91
|
+
// once) always reads fresh values without being recreated mid-gesture.
|
|
92
|
+
const interaction = useRef({
|
|
93
|
+
trackWidth,
|
|
94
|
+
minValue,
|
|
95
|
+
maxValue,
|
|
96
|
+
isDisabled,
|
|
97
|
+
isControlled,
|
|
98
|
+
quantize,
|
|
99
|
+
onChange,
|
|
100
|
+
onChangeEnd
|
|
101
|
+
});
|
|
102
|
+
interaction.current = {
|
|
103
|
+
trackWidth,
|
|
104
|
+
minValue,
|
|
105
|
+
maxValue,
|
|
106
|
+
isDisabled,
|
|
107
|
+
isControlled,
|
|
108
|
+
quantize,
|
|
109
|
+
onChange,
|
|
110
|
+
onChangeEnd
|
|
111
|
+
};
|
|
112
|
+
const lastValueRef = useRef(currentValue);
|
|
113
|
+
lastValueRef.current = currentValue;
|
|
114
|
+
const commit = useCallback((next, isFinal) => {
|
|
115
|
+
const {
|
|
116
|
+
isControlled: ctrl,
|
|
117
|
+
onChange: change,
|
|
118
|
+
onChangeEnd: changeEnd
|
|
119
|
+
} = interaction.current;
|
|
120
|
+
const changed = next !== lastValueRef.current;
|
|
121
|
+
lastValueRef.current = next;
|
|
122
|
+
if (changed) {
|
|
123
|
+
if (!ctrl) setInternalValue(next);
|
|
124
|
+
change?.(next);
|
|
125
|
+
}
|
|
126
|
+
if (isFinal) changeEnd?.(next);
|
|
127
|
+
}, []);
|
|
128
|
+
const valueFromX = useCallback(x => {
|
|
129
|
+
const {
|
|
130
|
+
trackWidth: w,
|
|
131
|
+
minValue: min,
|
|
132
|
+
maxValue: max,
|
|
133
|
+
quantize: q
|
|
134
|
+
} = interaction.current;
|
|
135
|
+
if (w <= 0) return lastValueRef.current;
|
|
136
|
+
const ratio = clamp(x / w, 0, 1);
|
|
137
|
+
return q(min + ratio * (max - min));
|
|
138
|
+
}, []);
|
|
139
|
+
const panResponder = useRef(PanResponder.create({
|
|
140
|
+
onStartShouldSetPanResponder: () => !interaction.current.isDisabled,
|
|
141
|
+
onMoveShouldSetPanResponder: () => !interaction.current.isDisabled,
|
|
142
|
+
onPanResponderGrant: e => {
|
|
143
|
+
if (interaction.current.isDisabled) return;
|
|
144
|
+
setIsDragging(true);
|
|
145
|
+
commit(valueFromX(e.nativeEvent.locationX), false);
|
|
146
|
+
},
|
|
147
|
+
onPanResponderMove: e => {
|
|
148
|
+
if (interaction.current.isDisabled) return;
|
|
149
|
+
commit(valueFromX(e.nativeEvent.locationX), false);
|
|
150
|
+
},
|
|
151
|
+
onPanResponderRelease: e => {
|
|
152
|
+
setIsDragging(false);
|
|
153
|
+
if (interaction.current.isDisabled) return;
|
|
154
|
+
commit(valueFromX(e.nativeEvent.locationX), true);
|
|
155
|
+
},
|
|
156
|
+
onPanResponderTerminate: () => {
|
|
157
|
+
setIsDragging(false);
|
|
158
|
+
if (interaction.current.isDisabled) return;
|
|
159
|
+
commit(lastValueRef.current, true);
|
|
160
|
+
}
|
|
161
|
+
})).current;
|
|
162
|
+
|
|
163
|
+
// Keyboard support (web). Arrow/Page keys nudge, Home/End jump to bounds.
|
|
164
|
+
const handleKeyDown = useCallback(e => {
|
|
165
|
+
if (isDisabled) return;
|
|
166
|
+
const big = Math.max(step, (maxValue - minValue) / 10);
|
|
167
|
+
let next = null;
|
|
168
|
+
switch (e.key) {
|
|
169
|
+
case 'ArrowRight':
|
|
170
|
+
case 'ArrowUp':
|
|
171
|
+
next = quantize(currentValue + step);
|
|
172
|
+
break;
|
|
173
|
+
case 'ArrowLeft':
|
|
174
|
+
case 'ArrowDown':
|
|
175
|
+
next = quantize(currentValue - step);
|
|
176
|
+
break;
|
|
177
|
+
case 'PageUp':
|
|
178
|
+
next = quantize(currentValue + big);
|
|
179
|
+
break;
|
|
180
|
+
case 'PageDown':
|
|
181
|
+
next = quantize(currentValue - big);
|
|
182
|
+
break;
|
|
183
|
+
case 'Home':
|
|
184
|
+
next = minValue;
|
|
185
|
+
break;
|
|
186
|
+
case 'End':
|
|
187
|
+
next = maxValue;
|
|
188
|
+
break;
|
|
189
|
+
default:
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
e.preventDefault?.();
|
|
193
|
+
commit(next, true);
|
|
194
|
+
}, [isDisabled, step, minValue, maxValue, currentValue, quantize, commit]);
|
|
195
|
+
const handleAccessibilityAction = useCallback(event => {
|
|
196
|
+
if (isDisabled) return;
|
|
197
|
+
const name = event.nativeEvent.actionName;
|
|
198
|
+
if (name === 'increment') commit(quantize(currentValue + step), true);else if (name === 'decrement') commit(quantize(currentValue - step), true);
|
|
199
|
+
}, [isDisabled, step, currentValue, quantize, commit]);
|
|
200
|
+
useImperativeHandle(ref, () => ({
|
|
201
|
+
getValue: () => lastValueRef.current,
|
|
202
|
+
setValue: v => commit(quantize(v), true),
|
|
203
|
+
increment: by => commit(quantize(lastValueRef.current + (by ?? step)), true),
|
|
204
|
+
decrement: by => commit(quantize(lastValueRef.current - (by ?? step)), true)
|
|
205
|
+
}), [quantize, commit, step]);
|
|
206
|
+
const defaultFormat = useCallback(v => {
|
|
207
|
+
try {
|
|
208
|
+
return new Intl.NumberFormat(locale, formatOptions).format(v);
|
|
209
|
+
} catch {
|
|
210
|
+
return String(v);
|
|
211
|
+
}
|
|
212
|
+
}, [locale, formatOptions]);
|
|
213
|
+
const format = formatValue ?? defaultFormat;
|
|
214
|
+
const ratio = maxValue > minValue ? (currentValue - minValue) / (maxValue - minValue) : 0;
|
|
215
|
+
const percent = clamp(ratio, 0, 1) * 100;
|
|
216
|
+
const handleSize = tokens.handleSize;
|
|
217
|
+
// The bubble floats (absolutely positioned, no reserved layout space). When
|
|
218
|
+
// `alwaysShowTooltip` is false it only appears while interacting: dragging on
|
|
219
|
+
// any platform, or hovering on web. Lifting the finger clears `isDragging`,
|
|
220
|
+
// so the bubble disappears immediately on touch release.
|
|
221
|
+
const showTooltip = alwaysShowTooltip || isDragging || isHovered;
|
|
222
|
+
const onTrackLayout = useCallback(e => {
|
|
223
|
+
setTrackWidth(e.nativeEvent.layout.width);
|
|
224
|
+
}, []);
|
|
225
|
+
const onTooltipLayout = useCallback(e => {
|
|
226
|
+
setTooltipWidth(e.nativeEvent.layout.width);
|
|
227
|
+
}, []);
|
|
228
|
+
const valueText = format(currentValue);
|
|
229
|
+
const tooltipNode = showTooltip ? /*#__PURE__*/_jsxs(View, {
|
|
230
|
+
onLayout: onTooltipLayout,
|
|
231
|
+
style: [styles.tooltip, {
|
|
232
|
+
backgroundColor: tokens.tooltipBackground,
|
|
233
|
+
paddingHorizontal: tokens.tooltipPaddingH,
|
|
234
|
+
paddingVertical: tokens.tooltipPaddingV,
|
|
235
|
+
borderRadius: tokens.tooltipRadius,
|
|
236
|
+
maxWidth: tokens.tooltipMaxWidth,
|
|
237
|
+
bottom: handleSize + tokens.tooltipWrapGap,
|
|
238
|
+
// Pinned to the value point on the full-width track area (not
|
|
239
|
+
// the tiny handle-width thumb). An absolute child with only
|
|
240
|
+
// `left` set is clamped by Yoga to `parentWidth - left`, so
|
|
241
|
+
// parenting it to the 20px thumb collapsed the text to ~0px
|
|
242
|
+
// and rendered an empty bubble on device. Centre via translate.
|
|
243
|
+
left: `${percent}%`,
|
|
244
|
+
transform: [{
|
|
245
|
+
translateX: -tooltipWidth / 2
|
|
246
|
+
}]
|
|
247
|
+
}],
|
|
248
|
+
pointerEvents: "none",
|
|
249
|
+
children: [renderTooltip ? renderTooltip(currentValue) : /*#__PURE__*/_jsx(Text, {
|
|
250
|
+
style: tokens.tooltipLabel,
|
|
251
|
+
...resolveTruncation(disableTruncation, 1),
|
|
252
|
+
children: valueText
|
|
253
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
254
|
+
style: [styles.tip, {
|
|
255
|
+
bottom: -tokens.tipHeight
|
|
256
|
+
}],
|
|
257
|
+
pointerEvents: "none",
|
|
258
|
+
children: /*#__PURE__*/_jsx(Svg, {
|
|
259
|
+
width: tokens.tipWidth,
|
|
260
|
+
height: tokens.tipHeight,
|
|
261
|
+
viewBox: `0 0 ${tokens.tipWidth} ${tokens.tipHeight}`,
|
|
262
|
+
children: /*#__PURE__*/_jsx(Path, {
|
|
263
|
+
d: `M0 0 L${tokens.tipWidth / 2} ${tokens.tipHeight} L${tokens.tipWidth} 0 Z`,
|
|
264
|
+
fill: tokens.tooltipBackground
|
|
265
|
+
})
|
|
266
|
+
})
|
|
267
|
+
})]
|
|
268
|
+
}) : null;
|
|
269
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
270
|
+
style: [{
|
|
271
|
+
width,
|
|
272
|
+
gap: tokens.gap,
|
|
273
|
+
paddingTop: tokens.paddingTop,
|
|
274
|
+
paddingBottom: tokens.paddingBottom,
|
|
275
|
+
paddingLeft: tokens.paddingLeft,
|
|
276
|
+
paddingRight: tokens.paddingRight,
|
|
277
|
+
opacity: isDisabled ? 0.5 : 1
|
|
278
|
+
}, style],
|
|
279
|
+
accessibilityLabel: accessibilityLabel,
|
|
280
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
281
|
+
...panResponder.panHandlers,
|
|
282
|
+
onLayout: onTrackLayout,
|
|
283
|
+
style: [styles.trackArea, {
|
|
284
|
+
height: handleSize
|
|
285
|
+
}],
|
|
286
|
+
accessible: true,
|
|
287
|
+
accessibilityRole: "adjustable",
|
|
288
|
+
accessibilityLabel: accessibilityLabel,
|
|
289
|
+
accessibilityValue: {
|
|
290
|
+
min: minValue,
|
|
291
|
+
max: maxValue,
|
|
292
|
+
now: currentValue,
|
|
293
|
+
text: valueText
|
|
294
|
+
},
|
|
295
|
+
accessibilityState: {
|
|
296
|
+
disabled: isDisabled
|
|
297
|
+
},
|
|
298
|
+
accessibilityActions: [{
|
|
299
|
+
name: 'increment'
|
|
300
|
+
}, {
|
|
301
|
+
name: 'decrement'
|
|
302
|
+
}],
|
|
303
|
+
onAccessibilityAction: handleAccessibilityAction,
|
|
304
|
+
focusable: !isDisabled,
|
|
305
|
+
...(Platform.OS === 'web' ? {
|
|
306
|
+
onKeyDown: handleKeyDown,
|
|
307
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
308
|
+
onMouseEnter: () => !isDisabled && setIsHovered(true),
|
|
309
|
+
onMouseLeave: () => setIsHovered(false)
|
|
310
|
+
} : {}),
|
|
311
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
312
|
+
style: {
|
|
313
|
+
height: tokens.trackHeight,
|
|
314
|
+
borderRadius: tokens.trackRadius,
|
|
315
|
+
backgroundColor: tokens.trackBackground
|
|
316
|
+
}
|
|
317
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
318
|
+
pointerEvents: "none",
|
|
319
|
+
style: {
|
|
320
|
+
position: 'absolute',
|
|
321
|
+
left: 0,
|
|
322
|
+
top: (handleSize - tokens.indicatorHeight) / 2,
|
|
323
|
+
height: tokens.indicatorHeight,
|
|
324
|
+
width: `${percent}%`,
|
|
325
|
+
borderRadius: tokens.indicatorRadius,
|
|
326
|
+
backgroundColor: tokens.indicatorBackground
|
|
327
|
+
}
|
|
328
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
329
|
+
pointerEvents: "none",
|
|
330
|
+
style: {
|
|
331
|
+
position: 'absolute',
|
|
332
|
+
top: 0,
|
|
333
|
+
left: `${percent}%`,
|
|
334
|
+
width: handleSize,
|
|
335
|
+
height: handleSize,
|
|
336
|
+
transform: [{
|
|
337
|
+
translateX: -handleSize / 2
|
|
338
|
+
}]
|
|
339
|
+
},
|
|
340
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
341
|
+
style: {
|
|
342
|
+
width: handleSize,
|
|
343
|
+
height: handleSize,
|
|
344
|
+
borderRadius: tokens.handleRadius,
|
|
345
|
+
backgroundColor: tokens.handleBackground
|
|
346
|
+
}
|
|
347
|
+
})
|
|
348
|
+
}), tooltipNode]
|
|
349
|
+
}), showLabels ? /*#__PURE__*/_jsxs(View, {
|
|
350
|
+
style: styles.labelWrap,
|
|
351
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
352
|
+
style: tokens.label,
|
|
353
|
+
children: minLabel ?? format(minValue)
|
|
354
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
355
|
+
style: tokens.label,
|
|
356
|
+
children: maxLabel ?? format(maxValue)
|
|
357
|
+
})]
|
|
358
|
+
}) : null]
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
function resolveTokens(modes) {
|
|
362
|
+
// NOTE: token names are passed as string literals DIRECTLY to
|
|
363
|
+
// getVariableByName so the `extract-component-tokens` script can statically
|
|
364
|
+
// collect them for the generated docs. Do not refactor into a helper that
|
|
365
|
+
// receives the name as a variable.
|
|
366
|
+
const gap = asNum(getVariableByName('slider/gap', modes), 16);
|
|
367
|
+
const paddingTop = asNum(getVariableByName('slider/padding/top', modes), 8);
|
|
368
|
+
const paddingBottom = asNum(getVariableByName('slider/padding/bottom', modes), 0);
|
|
369
|
+
const paddingLeft = asNum(getVariableByName('slider/padding/left', modes), 0);
|
|
370
|
+
const paddingRight = asNum(getVariableByName('slider/padding/right', modes), 0);
|
|
371
|
+
const trackHeight = asNum(getVariableByName('slider/track/height', modes), 4);
|
|
372
|
+
const trackRadius = asNum(getVariableByName('slider/track/radius', modes), 999);
|
|
373
|
+
// The unfilled track uses a lighter emphasis in the design; consumer modes
|
|
374
|
+
// still win over the baked-in `Emphasis: Low`.
|
|
375
|
+
const trackBackground = asStr(getVariableByName('slider/track/background', {
|
|
376
|
+
...TRACK_EMPHASIS,
|
|
377
|
+
...modes
|
|
378
|
+
}), '#fde8c9');
|
|
379
|
+
const indicatorHeight = asNum(getVariableByName('slider/indicator/height', modes), 4);
|
|
380
|
+
const indicatorRadius = asNum(getVariableByName('slider/indicator/radius', modes), 999);
|
|
381
|
+
const indicatorBackground = asStr(getVariableByName('slider/indicator/background', modes), '#f7ab21');
|
|
382
|
+
const handleSize = asNum(getVariableByName('slider/handle/size', modes), 20);
|
|
383
|
+
const handleRadius = asNum(getVariableByName('slider/handle/radius', modes), 999999);
|
|
384
|
+
const handleBackground = asStr(getVariableByName('slider/handle/background', modes), '#f7ab21');
|
|
385
|
+
const tooltipWrapGap = asNum(getVariableByName('slider/tooltipWrap/gap', modes), 12);
|
|
386
|
+
const tooltipBackground = asStr(getVariableByName('tooltip/background', modes), '#0f0d0a');
|
|
387
|
+
const tooltipPaddingH = asNum(getVariableByName('tooltip/padding/horizontal', modes), 12);
|
|
388
|
+
const tooltipPaddingV = asNum(getVariableByName('tooltip/padding/vertical', modes), 8);
|
|
389
|
+
const tooltipRadius = asNum(getVariableByName('radius', modes), 8);
|
|
390
|
+
const tooltipMaxWidth = asNum(getVariableByName('maxWidth', modes), 280);
|
|
391
|
+
const tipWidth = asNum(getVariableByName('tooltip/tipItem/width', modes), 16);
|
|
392
|
+
const tipHeight = asNum(getVariableByName('tooltip/tipItem/height', modes), 8);
|
|
393
|
+
const tooltipLabelColor = asStr(getVariableByName('tooltip/label/color', modes), '#ffffff');
|
|
394
|
+
const tooltipLabelSize = asNum(getVariableByName('tooltip/label/fontSize', modes), 14);
|
|
395
|
+
const tooltipLabelFamily = asStr(getVariableByName('tooltip/lable/fontFamily', modes), 'JioType Var');
|
|
396
|
+
const tooltipLabelLineHeight = asNum(getVariableByName('tooltip/label/lineHeight', modes), 18);
|
|
397
|
+
const tooltipLabelWeight = asStr(getVariableByName('tooltip/label/fontWeight', modes), '500');
|
|
398
|
+
const labelColor = asStr(getVariableByName('text/foreground', modes), '#000000');
|
|
399
|
+
const labelSize = asNum(getVariableByName('text/fontSize', modes), 14);
|
|
400
|
+
const labelFamily = asStr(getVariableByName('text/fontFamily', modes), 'JioType Var');
|
|
401
|
+
const labelLineHeight = asNum(getVariableByName('text/lineHeight', modes), 20);
|
|
402
|
+
const labelWeight = asStr(getVariableByName('text/fontWeight', modes), '500');
|
|
403
|
+
const labelLetterSpacing = asNum(getVariableByName('text/letterSpacing', modes), -0.5);
|
|
404
|
+
return {
|
|
405
|
+
gap,
|
|
406
|
+
paddingTop,
|
|
407
|
+
paddingBottom,
|
|
408
|
+
paddingLeft,
|
|
409
|
+
paddingRight,
|
|
410
|
+
trackHeight,
|
|
411
|
+
trackRadius,
|
|
412
|
+
trackBackground,
|
|
413
|
+
indicatorHeight,
|
|
414
|
+
indicatorRadius,
|
|
415
|
+
indicatorBackground,
|
|
416
|
+
handleSize,
|
|
417
|
+
handleRadius,
|
|
418
|
+
handleBackground,
|
|
419
|
+
tooltipWrapGap,
|
|
420
|
+
tooltipBackground,
|
|
421
|
+
tooltipPaddingH,
|
|
422
|
+
tooltipPaddingV,
|
|
423
|
+
tooltipRadius,
|
|
424
|
+
tooltipMaxWidth,
|
|
425
|
+
tooltipLineHeight: tooltipLabelLineHeight,
|
|
426
|
+
tipWidth,
|
|
427
|
+
tipHeight,
|
|
428
|
+
tooltipLabel: {
|
|
429
|
+
color: tooltipLabelColor,
|
|
430
|
+
fontSize: tooltipLabelSize,
|
|
431
|
+
fontFamily: tooltipLabelFamily,
|
|
432
|
+
lineHeight: tooltipLabelLineHeight,
|
|
433
|
+
fontWeight: tooltipLabelWeight,
|
|
434
|
+
includeFontPadding: false
|
|
435
|
+
},
|
|
436
|
+
label: {
|
|
437
|
+
color: labelColor,
|
|
438
|
+
fontSize: labelSize,
|
|
439
|
+
fontFamily: labelFamily,
|
|
440
|
+
lineHeight: labelLineHeight,
|
|
441
|
+
fontWeight: labelWeight,
|
|
442
|
+
letterSpacing: labelLetterSpacing,
|
|
443
|
+
includeFontPadding: false
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
const styles = {
|
|
448
|
+
trackArea: {
|
|
449
|
+
width: '100%',
|
|
450
|
+
justifyContent: 'center',
|
|
451
|
+
position: 'relative'
|
|
452
|
+
},
|
|
453
|
+
labelWrap: {
|
|
454
|
+
flexDirection: 'row',
|
|
455
|
+
justifyContent: 'space-between',
|
|
456
|
+
alignItems: 'flex-start',
|
|
457
|
+
width: '100%'
|
|
458
|
+
},
|
|
459
|
+
tooltip: {
|
|
460
|
+
position: 'absolute',
|
|
461
|
+
alignItems: 'center',
|
|
462
|
+
justifyContent: 'center'
|
|
463
|
+
},
|
|
464
|
+
tip: {
|
|
465
|
+
position: 'absolute',
|
|
466
|
+
alignSelf: 'center'
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
export default Slider;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { useTokens } from '../../design-tokens/JFSThemeProvider';
|
|
7
|
+
import { cloneChildrenWithModes, EMPTY_MODES, injectChildStyle } from '../../utils/react-utils';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* Stack — a token-driven layout container for grouped content.
|
|
11
|
+
*
|
|
12
|
+
* Use `Stack` instead of a raw `View` when you need a vertical or horizontal
|
|
13
|
+
* stack with design-token gap spacing and automatic `modes` propagation to
|
|
14
|
+
* children. Typical usage is nesting a column of actions inside a
|
|
15
|
+
* direction-locked parent such as `ActionFooter`:
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <ActionFooter modes={modes}>
|
|
20
|
+
* <Stack layoutDirection="vertical" modes={modes}>
|
|
21
|
+
* <Button label="Continue" modes={primaryModes} />
|
|
22
|
+
* <Disclaimer disclaimer="Terms apply." modes={modes} />
|
|
23
|
+
* </Stack>
|
|
24
|
+
* </ActionFooter>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Previously named `Slot`. The `Slot` export is preserved as a deprecated alias
|
|
29
|
+
* for backward compatibility.
|
|
30
|
+
*/
|
|
31
|
+
function Stack({
|
|
32
|
+
children,
|
|
33
|
+
layoutDirection = 'vertical',
|
|
34
|
+
alignCrossAxis,
|
|
35
|
+
justifyMainAxis,
|
|
36
|
+
equalHeight = false,
|
|
37
|
+
fillWidth = false,
|
|
38
|
+
modes: propModes = EMPTY_MODES,
|
|
39
|
+
style,
|
|
40
|
+
...rest
|
|
41
|
+
}) {
|
|
42
|
+
const {
|
|
43
|
+
modes: globalModes
|
|
44
|
+
} = useTokens();
|
|
45
|
+
const modes = useMemo(() => ({
|
|
46
|
+
...globalModes,
|
|
47
|
+
...propModes
|
|
48
|
+
}), [globalModes, propModes]);
|
|
49
|
+
const {
|
|
50
|
+
containerStyle,
|
|
51
|
+
processedChildren
|
|
52
|
+
} = useMemo(() => {
|
|
53
|
+
const gap = getVariableByName('slot/gap', modes) ?? 8;
|
|
54
|
+
const isHorizontal = layoutDirection === 'horizontal';
|
|
55
|
+
|
|
56
|
+
// Cross-axis stretch maps to "equal height" for a row and "fill width" for a
|
|
57
|
+
// column. Honour whichever flag matches the active direction.
|
|
58
|
+
const stretchCrossAxis = isHorizontal ? equalHeight : fillWidth;
|
|
59
|
+
const container = {
|
|
60
|
+
flexDirection: isHorizontal ? 'row' : 'column',
|
|
61
|
+
alignItems: stretchCrossAxis ? 'stretch' : alignCrossAxis ?? (isHorizontal ? 'flex-start' : 'stretch'),
|
|
62
|
+
justifyContent: justifyMainAxis ?? (isHorizontal ? 'center' : undefined),
|
|
63
|
+
alignSelf: 'stretch',
|
|
64
|
+
gap
|
|
65
|
+
};
|
|
66
|
+
const moded = children ? cloneChildrenWithModes(children, modes) : null;
|
|
67
|
+
const processed = stretchCrossAxis && moded ? injectChildStyle(moded, {
|
|
68
|
+
alignSelf: 'stretch'
|
|
69
|
+
}) : moded;
|
|
70
|
+
return {
|
|
71
|
+
containerStyle: container,
|
|
72
|
+
processedChildren: processed
|
|
73
|
+
};
|
|
74
|
+
}, [children, modes, layoutDirection, alignCrossAxis, justifyMainAxis, equalHeight, fillWidth]);
|
|
75
|
+
return /*#__PURE__*/_jsx(View, {
|
|
76
|
+
style: [containerStyle, style],
|
|
77
|
+
...rest,
|
|
78
|
+
children: processedChildren
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export default /*#__PURE__*/React.memo(Stack);
|
|
@@ -306,7 +306,16 @@ function SuggestiveSearch({
|
|
|
306
306
|
color: tokens.inputTextColor,
|
|
307
307
|
fontFamily: tokens.inputFontFamily,
|
|
308
308
|
fontSize: tokens.inputFontSize,
|
|
309
|
-
|
|
309
|
+
// iOS-only quirk: a single-line RNTextInput with `lineHeight` (45) far
|
|
310
|
+
// larger than `fontSize` (16) sinks the text to the bottom of the box
|
|
311
|
+
// instead of centering — iOS puts all the extra space ABOVE the glyphs.
|
|
312
|
+
// The row already owns the 45px height via `minHeight` + centering, so
|
|
313
|
+
// omit lineHeight on iOS (UITextField centers natively) and keep the
|
|
314
|
+
// token value on Android/Web where it renders correctly. Same fix as
|
|
315
|
+
// FormField — see facebook/react-native#39145 / #28012.
|
|
316
|
+
...(Platform.OS === 'ios' ? null : {
|
|
317
|
+
lineHeight: tokens.inputLineHeight
|
|
318
|
+
}),
|
|
310
319
|
fontWeight: tokens.inputFontWeight,
|
|
311
320
|
padding: 0,
|
|
312
321
|
margin: 0,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { View, Text, Pressable } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
-
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
|
|
6
|
+
import { EMPTY_MODES, cloneChildrenWithModes, resolveTruncation } from '../../utils/react-utils';
|
|
7
7
|
import Button from '../Button/Button';
|
|
8
8
|
import NavArrow from '../NavArrow/NavArrow';
|
|
9
9
|
import StrengthIndicator from '../StrengthIndicator/StrengthIndicator';
|
|
@@ -29,7 +29,8 @@ function SummaryTile({
|
|
|
29
29
|
style,
|
|
30
30
|
titleStyle,
|
|
31
31
|
descriptionStyle,
|
|
32
|
-
accessibilityLabel
|
|
32
|
+
accessibilityLabel,
|
|
33
|
+
disableTruncation
|
|
33
34
|
}) {
|
|
34
35
|
const containerGap = getVariableByName('summaryTile/gap', modes) ?? 8;
|
|
35
36
|
const containerPadding = getVariableByName('summaryTile/padding', modes) ?? 0;
|
|
@@ -95,7 +96,7 @@ function SummaryTile({
|
|
|
95
96
|
},
|
|
96
97
|
children: [title ? /*#__PURE__*/_jsx(Text, {
|
|
97
98
|
style: [titleTextStyle, titleStyle],
|
|
98
|
-
|
|
99
|
+
...resolveTruncation(disableTruncation, 1),
|
|
99
100
|
children: title
|
|
100
101
|
}) : null, showIndicator ? /*#__PURE__*/_jsx(StrengthIndicator, {
|
|
101
102
|
confidence: confidence,
|