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