jfs-components 0.1.0 → 0.1.8
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 +37 -0
- package/lib/commonjs/components/AmountInput/AmountInput.js +8 -5
- package/lib/commonjs/components/AreaLineChart/AreaLineChart.js +1 -1
- package/lib/commonjs/components/Balance/Balance.js +17 -12
- package/lib/commonjs/components/BenefitCard/BenefitCard.js +231 -0
- package/lib/commonjs/components/Card/Card.js +2 -1
- package/lib/commonjs/components/CardFeedback/CardFeedback.js +2 -1
- package/lib/commonjs/components/CcCard/CcCard.js +470 -0
- package/lib/commonjs/components/Checkbox/Checkbox.js +6 -4
- package/lib/commonjs/components/CheckboxItem/CheckboxItem.js +4 -3
- package/lib/commonjs/components/CompareTable/CompareTable.js +372 -0
- package/lib/commonjs/components/ComparisonBar/ComparisonBar.js +266 -0
- package/lib/commonjs/components/Drawer/Drawer.js +13 -4
- package/lib/commonjs/components/DropdownInput/DropdownInput.js +36 -4
- package/lib/commonjs/components/FormField/FormField.js +4 -3
- package/lib/commonjs/components/FullscreenModal/FullscreenModal.js +62 -2
- package/lib/commonjs/components/Image/Image.js +11 -5
- package/lib/commonjs/components/InputSearch/InputSearch.js +6 -4
- package/lib/commonjs/components/LottiePlayer/loadNativeLottieView.js +8 -13
- package/lib/commonjs/components/NoteInput/NoteInput.js +6 -5
- package/lib/commonjs/components/Overlay/Overlay.js +92 -0
- package/lib/commonjs/components/PdpCcCard/PdpCcCard.js +273 -0
- package/lib/commonjs/components/PlanComparisonCard/PlanComparisonCard.js +2 -1
- package/lib/commonjs/components/ProductMerchandisingCard/GlassFill.js +263 -0
- package/lib/commonjs/components/ProductMerchandisingCard/GlassFill.web.js +116 -0
- package/lib/commonjs/components/ProductMerchandisingCard/ProductMerchandisingCard.js +353 -0
- package/lib/commonjs/components/ProjectionMarker/ProjectionMarker.js +161 -0
- package/lib/commonjs/components/Radio/Radio.js +5 -5
- package/lib/commonjs/components/Slider/Slider.js +473 -0
- package/lib/commonjs/components/TextInput/TextInput.js +15 -9
- package/lib/commonjs/components/TextSegment/TextSegment.js +118 -0
- package/lib/commonjs/components/docs/modeControls.js +116 -0
- package/lib/commonjs/components/index.js +70 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/design-tokens/JFSThemeProvider.js +1 -1
- package/lib/commonjs/design-tokens/figma-modes.generated.js +420 -0
- package/lib/commonjs/design-tokens/index.js +11 -0
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/utils/react-utils.js +22 -0
- package/lib/module/components/Accordion/Accordion.js +1 -2
- package/lib/module/components/AmountInput/AmountInput.js +6 -4
- package/lib/module/components/AreaLineChart/AreaLineChart.js +1 -1
- package/lib/module/components/Balance/Balance.js +18 -13
- package/lib/module/components/BenefitCard/BenefitCard.js +225 -0
- package/lib/module/components/Card/Card.js +1 -2
- package/lib/module/components/CardFeedback/CardFeedback.js +1 -2
- package/lib/module/components/CcCard/CcCard.js +464 -0
- package/lib/module/components/Checkbox/Checkbox.js +6 -6
- package/lib/module/components/CheckboxItem/CheckboxItem.js +5 -4
- package/lib/module/components/CompareTable/CompareTable.js +367 -0
- package/lib/module/components/ComparisonBar/ComparisonBar.js +260 -0
- package/lib/module/components/Drawer/Drawer.js +12 -4
- package/lib/module/components/DropdownInput/DropdownInput.js +37 -5
- package/lib/module/components/FormField/FormField.js +5 -4
- package/lib/module/components/FullscreenModal/FullscreenModal.js +64 -5
- package/lib/module/components/Image/Image.js +11 -5
- package/lib/module/components/InputSearch/InputSearch.js +6 -4
- package/lib/module/components/InstitutionBadge/InstitutionBadge.js +1 -2
- package/lib/module/components/LottiePlayer/loadNativeLottieView.js +8 -13
- package/lib/module/components/MoneyValue/MoneyValue.js +1 -2
- package/lib/module/components/NoteInput/NoteInput.js +7 -6
- package/lib/module/components/OTP/OTP.js +1 -2
- package/lib/module/components/Overlay/Overlay.js +87 -0
- package/lib/module/components/PdpCcCard/PdpCcCard.js +267 -0
- package/lib/module/components/PlanComparisonCard/PlanComparisonCard.js +1 -2
- package/lib/module/components/PoweredByLabel/PoweredByLabel.js +1 -2
- package/lib/module/components/ProductMerchandisingCard/GlassFill.js +257 -0
- package/lib/module/components/ProductMerchandisingCard/GlassFill.web.js +111 -0
- package/lib/module/components/ProductMerchandisingCard/ProductMerchandisingCard.js +347 -0
- package/lib/module/components/ProjectionMarker/ProjectionMarker.js +156 -0
- package/lib/module/components/Radio/Radio.js +5 -4
- package/lib/module/components/RechargeCard/RechargeCard.js +1 -2
- package/lib/module/components/Section/Section.js +1 -2
- package/lib/module/components/Slider/Slider.js +468 -0
- package/lib/module/components/TextInput/TextInput.js +16 -12
- package/lib/module/components/TextSegment/TextSegment.js +113 -0
- package/lib/module/components/UpiHandle/UpiHandle.js +1 -2
- package/lib/module/components/docs/modeControls.js +111 -0
- package/lib/module/components/index.js +10 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/design-tokens/JFSThemeProvider.js +1 -1
- package/lib/module/design-tokens/figma-modes.generated.js +416 -0
- package/lib/module/design-tokens/index.js +2 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/utils/react-utils.js +21 -1
- package/lib/typescript/src/components/Accordion/Accordion.d.ts +2 -1
- package/lib/typescript/src/components/AccordionCheckbox/AccordionCheckbox.d.ts +2 -1
- package/lib/typescript/src/components/AccountCard/AccountCard.d.ts +2 -1
- package/lib/typescript/src/components/ActionFooter/ActionFooter.d.ts +2 -1
- package/lib/typescript/src/components/ActionTile/ActionTile.d.ts +2 -1
- package/lib/typescript/src/components/AllocationComparisonChart/AllocationComparisonChart.d.ts +2 -1
- package/lib/typescript/src/components/AmountInput/AmountInput.d.ts +5 -3
- package/lib/typescript/src/components/AppBar/AppBar.d.ts +2 -1
- package/lib/typescript/src/components/AreaLineChart/AreaLineChart.d.ts +3 -2
- package/lib/typescript/src/components/Attached/Attached.d.ts +2 -1
- package/lib/typescript/src/components/Avatar/Avatar.d.ts +2 -1
- package/lib/typescript/src/components/AvatarGroup/AvatarGroup.d.ts +2 -1
- package/lib/typescript/src/components/Badge/Badge.d.ts +2 -1
- package/lib/typescript/src/components/Balance/Balance.d.ts +2 -1
- package/lib/typescript/src/components/BenefitCard/BenefitCard.d.ts +93 -0
- package/lib/typescript/src/components/BottomNav/BottomNav.d.ts +2 -1
- package/lib/typescript/src/components/BottomNavItem/BottomNavItem.d.ts +2 -1
- package/lib/typescript/src/components/BrandChip/BrandChip.d.ts +2 -1
- package/lib/typescript/src/components/BubbleChart/BubbleChart.d.ts +2 -1
- package/lib/typescript/src/components/Button/Button.d.ts +2 -1
- package/lib/typescript/src/components/ButtonGroup/ButtonGroup.d.ts +2 -1
- package/lib/typescript/src/components/Card/Card.d.ts +3 -2
- package/lib/typescript/src/components/CardAdvisory/CardAdvisory.d.ts +2 -1
- package/lib/typescript/src/components/CardBankAccount/CardBankAccount.d.ts +2 -1
- package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +2 -1
- package/lib/typescript/src/components/CardFeedback/CardFeedback.d.ts +7 -6
- package/lib/typescript/src/components/CardFinancialCondition/CardFinancialCondition.d.ts +2 -1
- package/lib/typescript/src/components/CardInsight/CardInsight.d.ts +2 -1
- package/lib/typescript/src/components/CardProviderInfo/CardProviderInfo.d.ts +2 -1
- package/lib/typescript/src/components/Carousel/Carousel.d.ts +4 -3
- package/lib/typescript/src/components/CcCard/CcCard.d.ts +137 -0
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +5 -3
- package/lib/typescript/src/components/CheckboxGroup/CheckboxGroup.d.ts +2 -1
- package/lib/typescript/src/components/CheckboxItem/CheckboxItem.d.ts +4 -3
- package/lib/typescript/src/components/ChipGroup/ChipGroup.d.ts +2 -1
- package/lib/typescript/src/components/ChipSelect/ChipSelect.d.ts +2 -1
- package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +2 -1
- package/lib/typescript/src/components/CircularProgressBarDoted/CircularProgressBarDoted.d.ts +2 -1
- package/lib/typescript/src/components/CircularRating/CircularRating.d.ts +2 -1
- package/lib/typescript/src/components/ClusterBubble/ClusterBubble.d.ts +2 -1
- package/lib/typescript/src/components/CompareTable/CompareTable.d.ts +88 -0
- package/lib/typescript/src/components/ComparisonBar/ComparisonBar.d.ts +118 -0
- package/lib/typescript/src/components/CoverageBarComparison/CoverageBarComparison.d.ts +3 -2
- package/lib/typescript/src/components/CoverageRing/CoverageRing.d.ts +2 -1
- package/lib/typescript/src/components/DebitCard/DebitCard.d.ts +2 -1
- package/lib/typescript/src/components/Disclaimer/Disclaimer.d.ts +2 -1
- package/lib/typescript/src/components/Divider/Divider.d.ts +2 -1
- package/lib/typescript/src/components/DonutChart/DonutChart.d.ts +4 -3
- package/lib/typescript/src/components/DonutChartSummary/DonutChartSummary.d.ts +3 -2
- package/lib/typescript/src/components/Drawer/Drawer.d.ts +15 -1
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +3 -2
- package/lib/typescript/src/components/DropdownInput/DropdownInput.d.ts +22 -2
- package/lib/typescript/src/components/EmptyState/EmptyState.d.ts +2 -1
- package/lib/typescript/src/components/ExpandableCheckbox/ExpandableCheckbox.d.ts +2 -1
- package/lib/typescript/src/components/FilterBar/FilterBar.d.ts +3 -2
- package/lib/typescript/src/components/Form/Form.d.ts +2 -1
- package/lib/typescript/src/components/FormField/FormField.d.ts +4 -3
- package/lib/typescript/src/components/FullscreenModal/FullscreenModal.d.ts +2 -1
- package/lib/typescript/src/components/Gauge/Gauge.d.ts +2 -1
- package/lib/typescript/src/components/HStack/HStack.d.ts +2 -1
- package/lib/typescript/src/components/HoldingsCard/HoldingsCard.d.ts +2 -1
- package/lib/typescript/src/components/Icon/Icon.d.ts +2 -1
- package/lib/typescript/src/components/IconButton/IconButton.d.ts +2 -1
- package/lib/typescript/src/components/IconCapsule/IconCapsule.d.ts +2 -1
- package/lib/typescript/src/components/Image/Image.d.ts +17 -1
- package/lib/typescript/src/components/InputSearch/InputSearch.d.ts +25 -3
- package/lib/typescript/src/components/InstitutionBadge/InstitutionBadge.d.ts +2 -1
- package/lib/typescript/src/components/LazyList/LazyList.d.ts +2 -1
- package/lib/typescript/src/components/LinearMeter/LinearMeter.d.ts +3 -2
- package/lib/typescript/src/components/LinearProgress/LinearProgress.d.ts +2 -1
- package/lib/typescript/src/components/ListGroup/ListGroup.d.ts +2 -1
- package/lib/typescript/src/components/ListItem/ListItem.d.ts +2 -1
- package/lib/typescript/src/components/LottieIntroBlock/LottieIntroBlock.d.ts +2 -1
- package/lib/typescript/src/components/LottiePlayer/LottiePlayer.d.ts +2 -1
- package/lib/typescript/src/components/LottiePlayer/LottiePlayer.web.d.ts +2 -1
- package/lib/typescript/src/components/MediaCard/MediaCard.d.ts +6 -5
- package/lib/typescript/src/components/MerchantProfile/MerchantProfile.d.ts +2 -1
- package/lib/typescript/src/components/MessageField/MessageField.d.ts +2 -1
- package/lib/typescript/src/components/MetricLegendItem/MetricLegendItem.d.ts +2 -1
- package/lib/typescript/src/components/MoneyValue/MoneyValue.d.ts +2 -1
- package/lib/typescript/src/components/MonthlyStatusGrid/MonthlyStatusGrid.d.ts +4 -3
- package/lib/typescript/src/components/NavArrow/NavArrow.d.ts +2 -1
- package/lib/typescript/src/components/NoteInput/NoteInput.d.ts +21 -3
- package/lib/typescript/src/components/Nudge/Nudge.d.ts +2 -1
- package/lib/typescript/src/components/Numpad/Numpad.d.ts +2 -1
- package/lib/typescript/src/components/OTP/OTP.d.ts +3 -2
- package/lib/typescript/src/components/Overlay/Overlay.d.ts +52 -0
- package/lib/typescript/src/components/PageHero/PageHero.d.ts +2 -1
- package/lib/typescript/src/components/PaymentFeedback/PaymentFeedback.d.ts +2 -1
- package/lib/typescript/src/components/PdpCcCard/PdpCcCard.d.ts +84 -0
- package/lib/typescript/src/components/PlanComparisonCard/PlanComparisonCard.d.ts +2 -1
- package/lib/typescript/src/components/Popup/Popup.d.ts +2 -1
- package/lib/typescript/src/components/PortfolioHero/PortfolioHero.d.ts +2 -1
- package/lib/typescript/src/components/PoweredByLabel/PoweredByLabel.d.ts +2 -1
- package/lib/typescript/src/components/ProductLabel/ProductLabel.d.ts +2 -1
- package/lib/typescript/src/components/ProductMerchandisingCard/GlassFill.d.ts +56 -0
- package/lib/typescript/src/components/ProductMerchandisingCard/GlassFill.web.d.ts +27 -0
- package/lib/typescript/src/components/ProductMerchandisingCard/ProductMerchandisingCard.d.ts +81 -0
- package/lib/typescript/src/components/ProductOverview/ProductOverview.d.ts +2 -1
- package/lib/typescript/src/components/ProgressBadge/ProgressBadge.d.ts +2 -1
- package/lib/typescript/src/components/ProjectionMarker/ProjectionMarker.d.ts +82 -0
- package/lib/typescript/src/components/Radio/Radio.d.ts +5 -3
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +2 -2
- package/lib/typescript/src/components/RangeTrack/RangeTrack.d.ts +3 -2
- package/lib/typescript/src/components/RechargeCard/RechargeCard.d.ts +2 -1
- package/lib/typescript/src/components/SavingsGoalSummary/SavingsGoalSummary.d.ts +2 -1
- package/lib/typescript/src/components/Screen/Screen.d.ts +2 -1
- package/lib/typescript/src/components/Section/Section.d.ts +3 -2
- package/lib/typescript/src/components/SegmentedControl/SegmentedControl.d.ts +2 -1
- package/lib/typescript/src/components/SegmentedTrack/SegmentedTrack.d.ts +4 -3
- package/lib/typescript/src/components/Slider/Slider.d.ts +99 -0
- package/lib/typescript/src/components/Slot/Slot.d.ts +2 -1
- package/lib/typescript/src/components/Spinner/Spinner.d.ts +2 -1
- package/lib/typescript/src/components/StatGroup/StatGroup.d.ts +2 -1
- package/lib/typescript/src/components/StatItem/StatItem.d.ts +2 -1
- package/lib/typescript/src/components/StatusHero/StatusHero.d.ts +2 -1
- package/lib/typescript/src/components/Stepper/Step.d.ts +2 -1
- package/lib/typescript/src/components/Stepper/StepLabel.d.ts +2 -1
- package/lib/typescript/src/components/Stepper/Stepper.d.ts +2 -1
- package/lib/typescript/src/components/StrengthIndicator/StrengthIndicator.d.ts +2 -1
- package/lib/typescript/src/components/SuggestiveSearch/SuggestiveSearch.d.ts +2 -1
- package/lib/typescript/src/components/SummaryTile/SummaryTile.d.ts +2 -1
- package/lib/typescript/src/components/SupportText/SupportText.d.ts +2 -1
- package/lib/typescript/src/components/SupportText/SupportTextIcon.d.ts +2 -1
- package/lib/typescript/src/components/SwappableAmount/SwappableAmount.d.ts +2 -1
- package/lib/typescript/src/components/Tabs/TabItem.d.ts +2 -1
- package/lib/typescript/src/components/Tabs/Tabs.d.ts +2 -1
- package/lib/typescript/src/components/TestimonialsCard/TestimonialsCard.d.ts +2 -1
- package/lib/typescript/src/components/Text/Text.d.ts +2 -1
- package/lib/typescript/src/components/TextInput/TextInput.d.ts +12 -31
- package/lib/typescript/src/components/TextSegment/TextSegment.d.ts +100 -0
- package/lib/typescript/src/components/ThreadHero/ThreadHero.d.ts +2 -1
- package/lib/typescript/src/components/Title/Title.d.ts +2 -1
- package/lib/typescript/src/components/Toast/Toast.d.ts +2 -1
- package/lib/typescript/src/components/Toast/ToastProvider.d.ts +2 -1
- package/lib/typescript/src/components/Toast/useToast.d.ts +3 -2
- package/lib/typescript/src/components/Toggle/Toggle.d.ts +2 -1
- package/lib/typescript/src/components/Tooltip/Tooltip.d.ts +2 -1
- package/lib/typescript/src/components/TransactionBubble/TransactionBubble.d.ts +2 -1
- package/lib/typescript/src/components/TransactionDetails/TransactionDetails.d.ts +3 -2
- package/lib/typescript/src/components/TransactionStatus/TransactionStatus.d.ts +2 -1
- package/lib/typescript/src/components/UpiHandle/UpiHandle.d.ts +2 -1
- package/lib/typescript/src/components/VStack/VStack.d.ts +2 -1
- package/lib/typescript/src/components/docs/modeControls.d.ts +28 -0
- package/lib/typescript/src/components/index.d.ts +11 -1
- package/lib/typescript/src/design-tokens/JFSThemeProvider.d.ts +4 -3
- package/lib/typescript/src/design-tokens/figma-modes.generated.d.ts +284 -0
- package/lib/typescript/src/design-tokens/index.d.ts +1 -0
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/lib/typescript/src/skeleton/Skeleton.d.ts +2 -1
- package/lib/typescript/src/utils/react-utils.d.ts +12 -1
- package/package.json +4 -2
- package/src/components/Accordion/Accordion.tsx +2 -1
- package/src/components/AccordionCheckbox/AccordionCheckbox.tsx +2 -1
- package/src/components/AccountCard/AccountCard.tsx +2 -1
- package/src/components/ActionFooter/ActionFooter.tsx +2 -1
- package/src/components/ActionTile/ActionTile.tsx +2 -1
- package/src/components/AllocationComparisonChart/AllocationComparisonChart.tsx +2 -1
- package/src/components/AmountInput/AmountInput.tsx +9 -6
- package/src/components/AppBar/AppBar.tsx +2 -1
- package/src/components/AreaLineChart/AreaLineChart.tsx +8 -7
- package/src/components/Attached/Attached.tsx +2 -1
- package/src/components/Avatar/Avatar.tsx +3 -2
- package/src/components/AvatarGroup/AvatarGroup.tsx +2 -1
- package/src/components/Badge/Badge.tsx +2 -1
- package/src/components/Balance/Balance.tsx +18 -12
- package/src/components/BenefitCard/BenefitCard.tsx +309 -0
- package/src/components/BottomNav/BottomNav.tsx +2 -1
- package/src/components/BottomNavItem/BottomNavItem.tsx +3 -2
- package/src/components/BrandChip/BrandChip.tsx +3 -2
- package/src/components/BubbleChart/BubbleChart.tsx +2 -1
- package/src/components/Button/Button.tsx +3 -2
- package/src/components/ButtonGroup/ButtonGroup.tsx +2 -1
- package/src/components/Card/Card.tsx +4 -3
- package/src/components/CardAdvisory/CardAdvisory.tsx +3 -2
- package/src/components/CardBankAccount/CardBankAccount.tsx +2 -1
- package/src/components/CardCTA/CardCTA.tsx +3 -2
- package/src/components/CardFeedback/CardFeedback.tsx +11 -10
- package/src/components/CardFinancialCondition/CardFinancialCondition.tsx +3 -2
- package/src/components/CardInsight/CardInsight.tsx +2 -1
- package/src/components/CardProviderInfo/CardProviderInfo.tsx +2 -1
- package/src/components/Carousel/Carousel.tsx +5 -4
- package/src/components/CcCard/CcCard.tsx +598 -0
- package/src/components/Checkbox/Checkbox.tsx +7 -5
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +2 -1
- package/src/components/CheckboxItem/CheckboxItem.tsx +7 -5
- package/src/components/ChipGroup/ChipGroup.tsx +2 -1
- package/src/components/ChipSelect/ChipSelect.tsx +2 -1
- package/src/components/CircularProgressBar/CircularProgressBar.tsx +2 -1
- package/src/components/CircularProgressBarDoted/CircularProgressBarDoted.tsx +2 -1
- package/src/components/CircularRating/CircularRating.tsx +3 -2
- package/src/components/ClusterBubble/ClusterBubble.tsx +2 -1
- package/src/components/CompareTable/CompareTable.tsx +477 -0
- package/src/components/ComparisonBar/ComparisonBar.tsx +356 -0
- package/src/components/CoverageBarComparison/CoverageBarComparison.tsx +3 -2
- package/src/components/CoverageRing/CoverageRing.tsx +2 -1
- package/src/components/DebitCard/DebitCard.tsx +2 -1
- package/src/components/Disclaimer/Disclaimer.tsx +2 -1
- package/src/components/Divider/Divider.tsx +2 -1
- package/src/components/DonutChart/DonutChart.tsx +6 -5
- package/src/components/DonutChartSummary/DonutChartSummary.tsx +3 -2
- package/src/components/Drawer/Drawer.tsx +21 -1
- package/src/components/Dropdown/Dropdown.tsx +4 -3
- package/src/components/DropdownInput/DropdownInput.tsx +60 -7
- package/src/components/EmptyState/EmptyState.tsx +2 -1
- package/src/components/ExpandableCheckbox/ExpandableCheckbox.tsx +2 -1
- package/src/components/FilterBar/FilterBar.tsx +3 -2
- package/src/components/Form/Form.tsx +2 -1
- package/src/components/FormField/FormField.tsx +8 -6
- package/src/components/FullscreenModal/FullscreenModal.tsx +68 -10
- package/src/components/Gauge/Gauge.tsx +2 -1
- package/src/components/HStack/HStack.tsx +2 -1
- package/src/components/HoldingsCard/HoldingsCard.tsx +2 -1
- package/src/components/Icon/Icon.tsx +3 -2
- package/src/components/IconButton/IconButton.tsx +3 -2
- package/src/components/IconCapsule/IconCapsule.tsx +3 -2
- package/src/components/Image/Image.tsx +29 -5
- package/src/components/InputSearch/InputSearch.tsx +11 -7
- package/src/components/InstitutionBadge/InstitutionBadge.tsx +3 -2
- package/src/components/LazyList/LazyList.tsx +2 -1
- package/src/components/LinearMeter/LinearMeter.tsx +3 -2
- package/src/components/LinearProgress/LinearProgress.tsx +2 -1
- package/src/components/ListGroup/ListGroup.tsx +2 -1
- package/src/components/ListItem/ListItem.tsx +3 -2
- package/src/components/LottieIntroBlock/LottieIntroBlock.tsx +2 -1
- package/src/components/LottiePlayer/LottiePlayer.tsx +3 -2
- package/src/components/LottiePlayer/LottiePlayer.web.tsx +3 -2
- package/src/components/LottiePlayer/loadNativeLottieView.tsx +9 -13
- package/src/components/MediaCard/MediaCard.tsx +7 -6
- package/src/components/MerchantProfile/MerchantProfile.tsx +2 -1
- package/src/components/MessageField/MessageField.tsx +3 -2
- package/src/components/MetricLegendItem/MetricLegendItem.tsx +2 -1
- package/src/components/MoneyValue/MoneyValue.tsx +2 -1
- package/src/components/MonthlyStatusGrid/MonthlyStatusGrid.tsx +5 -4
- package/src/components/NavArrow/NavArrow.tsx +3 -2
- package/src/components/NoteInput/NoteInput.tsx +10 -7
- package/src/components/Nudge/Nudge.tsx +3 -2
- package/src/components/Numpad/Numpad.tsx +2 -1
- package/src/components/OTP/OTP.tsx +3 -2
- package/src/components/Overlay/Overlay.tsx +114 -0
- package/src/components/PageHero/PageHero.tsx +2 -1
- package/src/components/PaymentFeedback/PaymentFeedback.tsx +2 -1
- package/src/components/PdpCcCard/PdpCcCard.tsx +356 -0
- package/src/components/PlanComparisonCard/PlanComparisonCard.tsx +2 -1
- package/src/components/Popup/Popup.tsx +2 -1
- package/src/components/PortfolioHero/PortfolioHero.tsx +2 -1
- package/src/components/PoweredByLabel/PoweredByLabel.tsx +2 -1
- package/src/components/ProductLabel/ProductLabel.tsx +2 -1
- package/src/components/ProductMerchandisingCard/GlassFill.tsx +276 -0
- package/src/components/ProductMerchandisingCard/GlassFill.web.tsx +127 -0
- package/src/components/ProductMerchandisingCard/ProductMerchandisingCard.tsx +423 -0
- package/src/components/ProductOverview/ProductOverview.tsx +2 -1
- package/src/components/ProgressBadge/ProgressBadge.tsx +2 -1
- package/src/components/ProjectionMarker/ProjectionMarker.tsx +277 -0
- package/src/components/Radio/Radio.tsx +7 -5
- package/src/components/RangeTrack/RangeTrack.tsx +3 -2
- package/src/components/RechargeCard/RechargeCard.tsx +2 -1
- package/src/components/SavingsGoalSummary/SavingsGoalSummary.tsx +2 -1
- package/src/components/Screen/Screen.tsx +2 -1
- package/src/components/Section/Section.tsx +6 -5
- package/src/components/SegmentedControl/SegmentedControl.tsx +3 -2
- package/src/components/SegmentedTrack/SegmentedTrack.tsx +5 -4
- package/src/components/Slider/Slider.tsx +628 -0
- package/src/components/Slot/Slot.tsx +2 -1
- package/src/components/Spinner/Spinner.tsx +2 -1
- package/src/components/StatGroup/StatGroup.tsx +3 -2
- package/src/components/StatItem/StatItem.tsx +2 -1
- package/src/components/StatusHero/StatusHero.tsx +2 -1
- package/src/components/Stepper/Step.tsx +2 -1
- package/src/components/Stepper/StepLabel.tsx +2 -1
- package/src/components/Stepper/Stepper.tsx +2 -1
- package/src/components/StrengthIndicator/StrengthIndicator.tsx +2 -1
- package/src/components/SuggestiveSearch/SuggestiveSearch.tsx +4 -3
- package/src/components/SummaryTile/SummaryTile.tsx +2 -1
- package/src/components/SupportText/SupportText.tsx +2 -1
- package/src/components/SupportText/SupportTextIcon.tsx +2 -1
- package/src/components/SwappableAmount/SwappableAmount.tsx +2 -1
- package/src/components/Tabs/TabItem.tsx +2 -1
- package/src/components/Tabs/Tabs.tsx +2 -1
- package/src/components/TestimonialsCard/TestimonialsCard.tsx +2 -1
- package/src/components/Text/Text.tsx +2 -1
- package/src/components/TextInput/TextInput.tsx +18 -13
- package/src/components/TextSegment/TextSegment.tsx +166 -0
- package/src/components/ThreadHero/ThreadHero.tsx +2 -1
- package/src/components/Title/Title.tsx +2 -1
- package/src/components/Toast/Toast.tsx +2 -1
- package/src/components/Toast/ToastProvider.tsx +2 -1
- package/src/components/Toast/useToast.ts +3 -2
- package/src/components/Toggle/Toggle.tsx +2 -1
- package/src/components/Tooltip/Tooltip.tsx +3 -2
- package/src/components/TransactionBubble/TransactionBubble.tsx +2 -1
- package/src/components/TransactionDetails/TransactionDetails.tsx +3 -2
- package/src/components/TransactionStatus/TransactionStatus.tsx +3 -2
- package/src/components/UpiHandle/UpiHandle.tsx +3 -2
- package/src/components/VStack/VStack.tsx +2 -1
- package/src/components/docs/modeControls.tsx +122 -0
- package/src/components/index.ts +11 -1
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/design-tokens/JFSThemeProvider.tsx +4 -3
- package/src/design-tokens/figma-modes.generated.ts +425 -0
- package/src/design-tokens/index.ts +1 -0
- package/src/icons/registry.ts +1 -1
- package/src/skeleton/Skeleton.tsx +2 -1
- package/src/utils/react-utils.ts +26 -2
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react'
|
|
1
|
+
import React, { forwardRef, useCallback, useState } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
11
11
|
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils'
|
|
12
12
|
import Checkbox from '../Checkbox/Checkbox'
|
|
13
|
+
import type { Modes } from '../../design-tokens'
|
|
13
14
|
|
|
14
15
|
export type CheckboxItemProps = {
|
|
15
16
|
/** Whether the checkbox is checked (controlled). */
|
|
@@ -43,7 +44,7 @@ export type CheckboxItemProps = {
|
|
|
43
44
|
/** Width of the end slot container in pixels. Defaults to 80 to match the Figma reference. */
|
|
44
45
|
endSlotWidth?: number
|
|
45
46
|
/** Design token modes for theming (e.g. `{ 'Color Mode': 'Light' }`). */
|
|
46
|
-
modes?:
|
|
47
|
+
modes?: Modes
|
|
47
48
|
/** Override container styles. */
|
|
48
49
|
style?: StyleProp<ViewStyle>
|
|
49
50
|
/** Override the label text styles. */
|
|
@@ -79,7 +80,7 @@ export type CheckboxItemProps = {
|
|
|
79
80
|
* />
|
|
80
81
|
* ```
|
|
81
82
|
*/
|
|
82
|
-
function CheckboxItem({
|
|
83
|
+
const CheckboxItem = forwardRef<View, CheckboxItemProps>(function CheckboxItem({
|
|
83
84
|
checked: controlledChecked,
|
|
84
85
|
defaultChecked = false,
|
|
85
86
|
onValueChange,
|
|
@@ -92,7 +93,7 @@ function CheckboxItem({
|
|
|
92
93
|
style,
|
|
93
94
|
labelStyle,
|
|
94
95
|
accessibilityLabel,
|
|
95
|
-
}: CheckboxItemProps) {
|
|
96
|
+
}: CheckboxItemProps, ref: React.Ref<View>) {
|
|
96
97
|
const isTrailing = control === 'trailing'
|
|
97
98
|
const isControlled = controlledChecked !== undefined
|
|
98
99
|
const [internalChecked, setInternalChecked] = useState(defaultChecked)
|
|
@@ -182,6 +183,7 @@ function CheckboxItem({
|
|
|
182
183
|
|
|
183
184
|
return (
|
|
184
185
|
<Pressable
|
|
186
|
+
ref={ref}
|
|
185
187
|
style={[containerStyle, style]}
|
|
186
188
|
onPress={handleToggle}
|
|
187
189
|
disabled={disabled}
|
|
@@ -204,6 +206,6 @@ function CheckboxItem({
|
|
|
204
206
|
)}
|
|
205
207
|
</Pressable>
|
|
206
208
|
)
|
|
207
|
-
}
|
|
209
|
+
})
|
|
208
210
|
|
|
209
211
|
export default CheckboxItem
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
3
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
4
4
|
import { EMPTY_MODES, flattenChildren } from '../../utils/react-utils';
|
|
5
|
+
import type { Modes } from '../../design-tokens'
|
|
5
6
|
|
|
6
7
|
export type ChipGroupProps = {
|
|
7
8
|
/**
|
|
@@ -13,7 +14,7 @@ export type ChipGroupProps = {
|
|
|
13
14
|
* Mode configuration for design tokens.
|
|
14
15
|
* These modes are passed down to all child components.
|
|
15
16
|
*/
|
|
16
|
-
modes?:
|
|
17
|
+
modes?: Modes;
|
|
17
18
|
/**
|
|
18
19
|
* Additional styles for the container.
|
|
19
20
|
*/
|
|
@@ -3,6 +3,7 @@ import { View, Text, TouchableOpacity, type StyleProp, type ViewStyle, type Text
|
|
|
3
3
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
4
4
|
import { EMPTY_MODES } from '../../utils/react-utils';
|
|
5
5
|
import Icon from '../../icons/Icon';
|
|
6
|
+
import type { Modes } from '../../design-tokens'
|
|
6
7
|
|
|
7
8
|
export type ChipSelectProps = {
|
|
8
9
|
/**
|
|
@@ -23,7 +24,7 @@ export type ChipSelectProps = {
|
|
|
23
24
|
/**
|
|
24
25
|
* Modes for design token resolution.
|
|
25
26
|
*/
|
|
26
|
-
modes?:
|
|
27
|
+
modes?: Modes;
|
|
27
28
|
/**
|
|
28
29
|
* Optional style overrides.
|
|
29
30
|
*/
|
|
@@ -5,6 +5,7 @@ import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
|
5
5
|
import { useTokens } from '../../design-tokens/JFSThemeProvider'
|
|
6
6
|
import { EMPTY_MODES } from '../../utils/react-utils'
|
|
7
7
|
import { IconMinus } from '../../icons/components/IconMinus'
|
|
8
|
+
import type { Modes } from '../../design-tokens'
|
|
8
9
|
|
|
9
10
|
type CircularProgressBarBaseProps = Omit<React.ComponentProps<typeof View>, 'children' | 'style'>
|
|
10
11
|
|
|
@@ -26,7 +27,7 @@ export type CircularProgressBarProps = CircularProgressBarBaseProps & {
|
|
|
26
27
|
*/
|
|
27
28
|
supportText?: string
|
|
28
29
|
/** Design token modes forwarded to token lookups. */
|
|
29
|
-
modes?:
|
|
30
|
+
modes?: Modes
|
|
30
31
|
/** Container style override. */
|
|
31
32
|
style?: StyleProp<ViewStyle>
|
|
32
33
|
/** Track stroke style override. */
|
|
@@ -13,6 +13,7 @@ import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
|
13
13
|
import { useTokens } from '../../design-tokens/JFSThemeProvider'
|
|
14
14
|
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils'
|
|
15
15
|
import { IconChevronright } from '../../icons/components/IconChevronright'
|
|
16
|
+
import type { Modes } from '../../design-tokens'
|
|
16
17
|
|
|
17
18
|
type CircularProgressBarDotedBaseProps = Omit<React.ComponentProps<typeof View>, 'children' | 'style'>
|
|
18
19
|
|
|
@@ -32,7 +33,7 @@ export type CircularProgressBarDotedProps = CircularProgressBarDotedBaseProps &
|
|
|
32
33
|
/** Called when the tier row is pressed. */
|
|
33
34
|
onTierPress?: () => void
|
|
34
35
|
/** Design token modes forwarded to token lookups and slot children. */
|
|
35
|
-
modes?:
|
|
36
|
+
modes?: Modes
|
|
36
37
|
/** Slot rendered in the center of the dotted ring. Receives `modes` recursively. */
|
|
37
38
|
children?: React.ReactNode
|
|
38
39
|
/** Container style override. */
|
|
@@ -12,6 +12,7 @@ import Icon from '../../icons/Icon'
|
|
|
12
12
|
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils'
|
|
13
13
|
import CircularProgressBarDoted from '../CircularProgressBarDoted/CircularProgressBarDoted'
|
|
14
14
|
import Nudge from '../Nudge/Nudge'
|
|
15
|
+
import type { Modes } from '../../design-tokens'
|
|
15
16
|
|
|
16
17
|
type CircularRatingBaseProps = Omit<React.ComponentProps<typeof View>, 'children' | 'style'>
|
|
17
18
|
|
|
@@ -43,7 +44,7 @@ export type CircularRatingProps = CircularRatingBaseProps & {
|
|
|
43
44
|
/** Optional nudge slot. Receives `modes` recursively. */
|
|
44
45
|
nudgeSlot?: React.ReactNode
|
|
45
46
|
/** Design token modes forwarded to token lookups and child components. */
|
|
46
|
-
modes?:
|
|
47
|
+
modes?: Modes
|
|
47
48
|
/** Optional container style overrides. */
|
|
48
49
|
style?: StyleProp<ViewStyle>
|
|
49
50
|
/** Optional rating ring wrapper style overrides. */
|
|
@@ -92,7 +93,7 @@ const toFontWeight = (value: unknown, fallback: TextStyle['fontWeight']) => {
|
|
|
92
93
|
return fallback
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
function resolveCircularRatingTokens(modes:
|
|
96
|
+
function resolveCircularRatingTokens(modes: Modes): CircularRatingTokens {
|
|
96
97
|
const gap = toNumber(getVariableByName('circularRating/gap', modes), 32)
|
|
97
98
|
const padding = toNumber(getVariableByName('circularRating/padding', modes), 10)
|
|
98
99
|
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
13
13
|
import { useTokens } from '../../design-tokens/JFSThemeProvider'
|
|
14
14
|
import { EMPTY_MODES } from '../../utils/react-utils'
|
|
15
|
+
import type { Modes } from '../../design-tokens'
|
|
15
16
|
|
|
16
17
|
/** Where the value/label text sits relative to the circle. */
|
|
17
18
|
export type ClusterBubbleLabelPlacement = 'inside' | 'outside' | 'auto'
|
|
@@ -72,7 +73,7 @@ export type ClusterBubbleProps = {
|
|
|
72
73
|
/** Style override for the outer container. */
|
|
73
74
|
style?: StyleProp<ViewStyle>
|
|
74
75
|
/** Design token modes for theming (e.g. `{ 'Color Mode': 'Light' }`). */
|
|
75
|
-
modes?:
|
|
76
|
+
modes?: Modes
|
|
76
77
|
/** Accessibility label. Defaults to a `value + label` composite. */
|
|
77
78
|
accessibilityLabel?: string
|
|
78
79
|
}
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
Pressable,
|
|
6
|
+
Platform,
|
|
7
|
+
type ImageSourcePropType,
|
|
8
|
+
type StyleProp,
|
|
9
|
+
type ViewStyle,
|
|
10
|
+
type TextStyle,
|
|
11
|
+
} from 'react-native'
|
|
12
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
13
|
+
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils'
|
|
14
|
+
import Accordion from '../Accordion/Accordion'
|
|
15
|
+
import Image from '../Image/Image'
|
|
16
|
+
import IconButton from '../IconButton/IconButton'
|
|
17
|
+
import Icon from '../../icons/Icon'
|
|
18
|
+
import type { Modes } from '../../design-tokens'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Brand link colour used by the selection-card CTA. The Figma node resolves
|
|
22
|
+
* `button/foreground` to this value, but no reproducible token mode currently
|
|
23
|
+
* produces it (the published token store is out of sync), so it is pinned here
|
|
24
|
+
* to stay faithful to the design.
|
|
25
|
+
*/
|
|
26
|
+
const BRAND_LINK_COLOR = '#5d00b5'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Selection-card close control (Figma node 5568:3492). It is an `IconButton`
|
|
30
|
+
* pinned to the card's top-right corner. The Figma node resolves its
|
|
31
|
+
* `iconButton/background` and border to fully transparent (`#ebebed00` /
|
|
32
|
+
* `#ffffff00`) — values no token mode reproduces — so they are overridden here.
|
|
33
|
+
* Size (40px) and icon are left to the `IconButton`'s own token resolution
|
|
34
|
+
* (padding 11 · 2 + icon 18).
|
|
35
|
+
*/
|
|
36
|
+
/** Add-a-card icon button fill + icon (Figma node 5568:3494 direct overrides). */
|
|
37
|
+
const ADD_BUTTON_BG = '#545961'
|
|
38
|
+
const ADD_BUTTON_ICON_COLOR = '#ffffff'
|
|
39
|
+
|
|
40
|
+
const closeButtonStyle: ViewStyle = {
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
top: 1,
|
|
43
|
+
right: 0,
|
|
44
|
+
backgroundColor: 'transparent',
|
|
45
|
+
borderColor: 'transparent',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Keeps every text layer on a single line on web. */
|
|
49
|
+
const NO_WRAP_TEXT: TextStyle = {
|
|
50
|
+
flexShrink: 0,
|
|
51
|
+
...(Platform.OS === 'web' ? { whiteSpace: 'nowrap' as const } : {}),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const toWeight = (w: number | string) =>
|
|
55
|
+
(typeof w === 'number' ? `${w}` : w) as TextStyle['fontWeight']
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A single product/plan column rendered as a selection card at the top of the
|
|
59
|
+
* table. The card order maps 1:1 to each {@link CompareTableRow}'s `values`.
|
|
60
|
+
*/
|
|
61
|
+
export type CompareTableColumn = {
|
|
62
|
+
/** Product / plan name shown under the image. */
|
|
63
|
+
label?: string;
|
|
64
|
+
/** Thumbnail / logo image. Accepts a URL string or an RN image source. */
|
|
65
|
+
imageSource?: ImageSourcePropType | string;
|
|
66
|
+
/** CTA link text (e.g. "View details"). Omit to hide the link. */
|
|
67
|
+
actionLabel?: string;
|
|
68
|
+
/** Handler for the CTA link. Implies the link is shown. */
|
|
69
|
+
onActionPress?: () => void;
|
|
70
|
+
/** When provided, renders a tappable close icon to remove the column. */
|
|
71
|
+
onRemove?: () => void;
|
|
72
|
+
/** Stable key. Falls back to the label / index. */
|
|
73
|
+
key?: React.Key;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Value rendered inside a comparison cell.
|
|
78
|
+
* - `string` / `number` → rendered as value text.
|
|
79
|
+
* - `false` → renders the muted "not available" cross icon.
|
|
80
|
+
* - any React element → rendered as-is (e.g. a `Badge`, `MoneyValue`, icon…).
|
|
81
|
+
* - `null` / `undefined` / `true` → empty cell.
|
|
82
|
+
*/
|
|
83
|
+
export type CompareTableCellValue =
|
|
84
|
+
| string
|
|
85
|
+
| number
|
|
86
|
+
| boolean
|
|
87
|
+
| null
|
|
88
|
+
| undefined
|
|
89
|
+
| React.ReactElement;
|
|
90
|
+
|
|
91
|
+
export type CompareTableRow = {
|
|
92
|
+
/** One value per column, in the same order as `columns`. */
|
|
93
|
+
values: CompareTableCellValue[];
|
|
94
|
+
/** Stable key. Falls back to the index. */
|
|
95
|
+
key?: React.Key;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A collapsible section. Each section renders as an `Accordion` whose body is a
|
|
100
|
+
* comparison table that spans the same columns as the selection cards.
|
|
101
|
+
*/
|
|
102
|
+
export type CompareTableSection = {
|
|
103
|
+
/** Accordion header label, e.g. "Fees & charges". */
|
|
104
|
+
title: string;
|
|
105
|
+
/** Optional full-width header row shown at the top of the table body. */
|
|
106
|
+
header?: string;
|
|
107
|
+
/** Comparison rows; each row's `values` map 1:1 to `columns`. */
|
|
108
|
+
rows: CompareTableRow[];
|
|
109
|
+
/** Initial expanded state. Defaults to `true` for the first section. */
|
|
110
|
+
defaultExpanded?: boolean;
|
|
111
|
+
/** Stable key. Falls back to the title / index. */
|
|
112
|
+
key?: React.Key;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export type CompareTableProps = {
|
|
116
|
+
/**
|
|
117
|
+
* Product / plan columns rendered as selection cards. Their order maps 1:1
|
|
118
|
+
* to each row's `values` array. Supports any number of columns.
|
|
119
|
+
*/
|
|
120
|
+
columns?: CompareTableColumn[];
|
|
121
|
+
/** Collapsible comparison sections. */
|
|
122
|
+
sections?: CompareTableSection[];
|
|
123
|
+
/**
|
|
124
|
+
* When provided, renders an "Add a card" tile after the columns. Hidden once
|
|
125
|
+
* `columns.length` reaches `maxColumns`.
|
|
126
|
+
*/
|
|
127
|
+
onAddColumn?: () => void;
|
|
128
|
+
/** Label for the add-a-card tile. @default 'Add a card' */
|
|
129
|
+
addColumnLabel?: string;
|
|
130
|
+
/** Maximum number of columns before the add tile is hidden. @default 4 */
|
|
131
|
+
maxColumns?: number;
|
|
132
|
+
/** Design token modes for theming (e.g. `{ "Color Mode": "Light" }`). */
|
|
133
|
+
modes?: Modes;
|
|
134
|
+
/** Override the outer container style. */
|
|
135
|
+
style?: StyleProp<ViewStyle>;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const DEFAULT_COLUMNS: CompareTableColumn[] = [
|
|
139
|
+
{ label: 'Plan A', actionLabel: 'View details', onRemove: () => {} },
|
|
140
|
+
{ label: 'Plan B', actionLabel: 'View details', onRemove: () => {} },
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
const DEFAULT_SECTIONS: CompareTableSection[] = [
|
|
144
|
+
{
|
|
145
|
+
title: 'Fees & charges',
|
|
146
|
+
header: 'Annual fees',
|
|
147
|
+
defaultExpanded: true,
|
|
148
|
+
rows: [
|
|
149
|
+
{ values: ['₹0', '₹499'] },
|
|
150
|
+
{ values: ['Free', 'Up to ₹1,300'] },
|
|
151
|
+
{ values: ['1x', '1.25x'] },
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* CompareTable renders a product comparison surface: a row of selection cards
|
|
158
|
+
* (one per column) followed by one or more collapsible sections, each holding a
|
|
159
|
+
* comparison table whose cells line up beneath their column.
|
|
160
|
+
*
|
|
161
|
+
* The selection card is an internal sub-component and is intentionally not
|
|
162
|
+
* exported — it should only be used through `CompareTable`. Implementation of
|
|
163
|
+
* Figma node `5568:3496` (`Compare table`) with sub-component `5568:3487`
|
|
164
|
+
* (`selectioncard`).
|
|
165
|
+
*
|
|
166
|
+
* @component
|
|
167
|
+
*/
|
|
168
|
+
function CompareTable({
|
|
169
|
+
columns = DEFAULT_COLUMNS,
|
|
170
|
+
sections = DEFAULT_SECTIONS,
|
|
171
|
+
onAddColumn,
|
|
172
|
+
addColumnLabel = 'Add a card',
|
|
173
|
+
maxColumns = 4,
|
|
174
|
+
modes = EMPTY_MODES,
|
|
175
|
+
style,
|
|
176
|
+
}: CompareTableProps) {
|
|
177
|
+
// --- selection card tokens ------------------------------------------------
|
|
178
|
+
const cardBg = (getVariableByName('selectionCard/background/color', modes) as string) ?? '#ffffff'
|
|
179
|
+
const cardBorderColor = (getVariableByName('selectionCard/border/color', modes) as string) ?? '#eeeeee'
|
|
180
|
+
const cardBorderSize = (getVariableByName('selectionCard/border/size', modes) as number) ?? 1
|
|
181
|
+
const cardGap = (getVariableByName('selectionCard/gap', modes) as number) ?? 12
|
|
182
|
+
const cardPaddingH = (getVariableByName('selectionCard/padding/horizontal', modes) as number) ?? 20
|
|
183
|
+
const cardPaddingV = (getVariableByName('selectionCard/padding/vertical', modes) as number) ?? 20
|
|
184
|
+
const cardLabelColor = (getVariableByName('selectionCard/label/color', modes) as string) ?? '#000000'
|
|
185
|
+
const cardLabelFontSize = (getVariableByName('selectionCard/label/fontsize', modes) as number) ?? 14
|
|
186
|
+
const cardLabelFontFamily = (getVariableByName('selectionCard/label/fontfamily', modes) as string) ?? 'JioType Var'
|
|
187
|
+
const cardLabelFontWeight = (getVariableByName('selectionCard/label/fontweight', modes) as number | string) ?? 700
|
|
188
|
+
const imageRadius = (getVariableByName('image/radius', modes) as number) ?? 8
|
|
189
|
+
|
|
190
|
+
// --- add-a-card icon button tokens ---------------------------------------
|
|
191
|
+
// padding/size/border come from the shared iconButton tokens; the filled
|
|
192
|
+
// background (#545961) and white icon are the Figma node's direct overrides
|
|
193
|
+
// (no token mode reproduces them), so they are pinned to match the design.
|
|
194
|
+
const addBorderColor = (getVariableByName('iconButton/border/color', modes) as string) ?? 'rgba(255,255,255,0)'
|
|
195
|
+
const addBorderSize = (getVariableByName('iconButton/border/size', modes) as number) ?? 1
|
|
196
|
+
const addPadding = (getVariableByName('iconButton/padding', modes) as number) ?? 11
|
|
197
|
+
const addIconSize = (getVariableByName('iconButton/icon/size', modes) as number) ?? 18
|
|
198
|
+
const addBg = ADD_BUTTON_BG
|
|
199
|
+
const addIconColor = ADD_BUTTON_ICON_COLOR
|
|
200
|
+
|
|
201
|
+
// --- table header tokens --------------------------------------------------
|
|
202
|
+
const headerBg = (getVariableByName('comparetableHeader/background/color', modes) as string) ?? '#f5f5f5'
|
|
203
|
+
const headerLabelColor = (getVariableByName('comparetableHeader/label/color', modes) as string) ?? '#000000'
|
|
204
|
+
const headerFontSize = (getVariableByName('comparetableHeader/label/fontsize', modes) as number) ?? 14
|
|
205
|
+
const headerFontFamily = (getVariableByName('comparetableHeader/label/fontfamily', modes) as string) ?? 'JioType Var'
|
|
206
|
+
const headerFontWeight = (getVariableByName('comparetableHeader/label/fontweight', modes) as number | string) ?? 600
|
|
207
|
+
const headerPaddingH = (getVariableByName('comparetableHeader/padding/horizontal', modes) as number) ?? 12
|
|
208
|
+
const headerPaddingV = (getVariableByName('comparetableHeader/padding/vertical', modes) as number) ?? 12
|
|
209
|
+
|
|
210
|
+
// --- table cell tokens ----------------------------------------------------
|
|
211
|
+
const cellBorderColor = (getVariableByName('compareTableCell/border/color', modes) as string) ?? '#eeeeee'
|
|
212
|
+
const cellBorderSize = (getVariableByName('compareTableCell/border/size', modes) as number) ?? 1
|
|
213
|
+
const cellBg = (getVariableByName('compareTableCell/background/color', modes) as string) ?? '#ffffff'
|
|
214
|
+
const cellLabelColor = (getVariableByName('compareTableCell/label/color', modes) as string) ?? '#000000'
|
|
215
|
+
const cellFontSize = (getVariableByName('compareTableCell/label/fontsize', modes) as number) ?? 14
|
|
216
|
+
const cellFontFamily = (getVariableByName('compareTableCell/label/fontfamily', modes) as string) ?? 'JioType Var'
|
|
217
|
+
const cellFontWeight = (getVariableByName('compareTableCell/label/fontweight', modes) as number | string) ?? 400
|
|
218
|
+
const cellPaddingH = (getVariableByName('compareTableCell/padding/horizontal', modes) as number) ?? 12
|
|
219
|
+
const cellPaddingV = (getVariableByName('compareTableCell/padding/vertical', modes) as number) ?? 12
|
|
220
|
+
|
|
221
|
+
const columnCount = columns.length
|
|
222
|
+
const showAddCard = onAddColumn != null && columnCount < maxColumns
|
|
223
|
+
|
|
224
|
+
const cardLabelStyle: TextStyle = {
|
|
225
|
+
...NO_WRAP_TEXT,
|
|
226
|
+
color: cardLabelColor,
|
|
227
|
+
fontSize: cardLabelFontSize,
|
|
228
|
+
fontFamily: cardLabelFontFamily,
|
|
229
|
+
fontWeight: toWeight(cardLabelFontWeight),
|
|
230
|
+
lineHeight: cardLabelFontSize * 1.1,
|
|
231
|
+
textAlign: 'center',
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const linkStyle: TextStyle = {
|
|
235
|
+
...NO_WRAP_TEXT,
|
|
236
|
+
color: BRAND_LINK_COLOR,
|
|
237
|
+
fontFamily: cardLabelFontFamily,
|
|
238
|
+
fontSize: 14,
|
|
239
|
+
fontWeight: '700',
|
|
240
|
+
lineHeight: 22,
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const headerTextStyle: TextStyle = {
|
|
244
|
+
color: headerLabelColor,
|
|
245
|
+
fontSize: headerFontSize,
|
|
246
|
+
fontFamily: headerFontFamily,
|
|
247
|
+
fontWeight: toWeight(headerFontWeight),
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const cellTextStyle: TextStyle = {
|
|
251
|
+
color: cellLabelColor,
|
|
252
|
+
fontSize: cellFontSize,
|
|
253
|
+
fontFamily: cellFontFamily,
|
|
254
|
+
fontWeight: toWeight(cellFontWeight),
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const cardStyle: ViewStyle = {
|
|
258
|
+
flex: 1,
|
|
259
|
+
minWidth: 0,
|
|
260
|
+
minHeight: 147,
|
|
261
|
+
backgroundColor: cardBg,
|
|
262
|
+
alignItems: 'center',
|
|
263
|
+
justifyContent: 'center',
|
|
264
|
+
gap: cardGap,
|
|
265
|
+
paddingHorizontal: cardPaddingH,
|
|
266
|
+
paddingVertical: cardPaddingV,
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const renderCard = (column: CompareTableColumn, index: number) => {
|
|
270
|
+
const isLast = index === columnCount - 1 && !showAddCard
|
|
271
|
+
return (
|
|
272
|
+
<View
|
|
273
|
+
key={column.key ?? column.label ?? index}
|
|
274
|
+
style={[
|
|
275
|
+
cardStyle,
|
|
276
|
+
{
|
|
277
|
+
borderBottomWidth: cardBorderSize,
|
|
278
|
+
borderBottomColor: cardBorderColor,
|
|
279
|
+
borderRightWidth: isLast ? 0 : cardBorderSize,
|
|
280
|
+
borderRightColor: cardBorderColor,
|
|
281
|
+
},
|
|
282
|
+
]}
|
|
283
|
+
>
|
|
284
|
+
{column.imageSource != null && (
|
|
285
|
+
<Image
|
|
286
|
+
imageSource={column.imageSource}
|
|
287
|
+
width={66}
|
|
288
|
+
height={44}
|
|
289
|
+
borderRadius={imageRadius}
|
|
290
|
+
resizeMode="cover"
|
|
291
|
+
accessibilityLabel={column.label}
|
|
292
|
+
/>
|
|
293
|
+
)}
|
|
294
|
+
{column.label != null && (
|
|
295
|
+
<Text style={cardLabelStyle} numberOfLines={2}>
|
|
296
|
+
{column.label}
|
|
297
|
+
</Text>
|
|
298
|
+
)}
|
|
299
|
+
{column.actionLabel != null && (
|
|
300
|
+
<Pressable
|
|
301
|
+
onPress={column.onActionPress}
|
|
302
|
+
accessibilityRole="button"
|
|
303
|
+
accessibilityLabel={column.actionLabel}
|
|
304
|
+
hitSlop={6}
|
|
305
|
+
>
|
|
306
|
+
<Text style={linkStyle}>{column.actionLabel}</Text>
|
|
307
|
+
</Pressable>
|
|
308
|
+
)}
|
|
309
|
+
{column.onRemove != null && (
|
|
310
|
+
// Figma node 5568:3492 — an Icon Button (not a capsule):
|
|
311
|
+
// padding 11 + icon 18 → 40px circle, transparent background,
|
|
312
|
+
// absolutely pinned to the card's top-right (right:0, top:1).
|
|
313
|
+
<IconButton
|
|
314
|
+
iconName="ic_close"
|
|
315
|
+
onPress={column.onRemove}
|
|
316
|
+
modes={modes}
|
|
317
|
+
accessibilityLabel={`Remove ${column.label ?? 'column'}`}
|
|
318
|
+
style={closeButtonStyle}
|
|
319
|
+
/>
|
|
320
|
+
)}
|
|
321
|
+
</View>
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const renderAddCard = () => (
|
|
326
|
+
<Pressable
|
|
327
|
+
key="__add_card__"
|
|
328
|
+
onPress={onAddColumn}
|
|
329
|
+
accessibilityRole="button"
|
|
330
|
+
accessibilityLabel={addColumnLabel}
|
|
331
|
+
style={[cardStyle, { borderBottomWidth: cardBorderSize, borderBottomColor: cardBorderColor }]}
|
|
332
|
+
>
|
|
333
|
+
<View
|
|
334
|
+
style={{
|
|
335
|
+
width: addPadding * 2 + addIconSize,
|
|
336
|
+
height: addPadding * 2 + addIconSize,
|
|
337
|
+
borderRadius: 9999,
|
|
338
|
+
borderWidth: addBorderSize,
|
|
339
|
+
borderColor: addBorderColor,
|
|
340
|
+
backgroundColor: addBg,
|
|
341
|
+
alignItems: 'center',
|
|
342
|
+
justifyContent: 'center',
|
|
343
|
+
}}
|
|
344
|
+
>
|
|
345
|
+
<Icon
|
|
346
|
+
name="ic_add"
|
|
347
|
+
size={addIconSize}
|
|
348
|
+
color={addIconColor}
|
|
349
|
+
accessibilityElementsHidden
|
|
350
|
+
importantForAccessibility="no"
|
|
351
|
+
/>
|
|
352
|
+
</View>
|
|
353
|
+
<Text style={cardLabelStyle} numberOfLines={1}>
|
|
354
|
+
{addColumnLabel}
|
|
355
|
+
</Text>
|
|
356
|
+
</Pressable>
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
const renderCellContent = (value: CompareTableCellValue, cellKey: React.Key) => {
|
|
360
|
+
if (value === false) {
|
|
361
|
+
return (
|
|
362
|
+
<Icon
|
|
363
|
+
key={cellKey}
|
|
364
|
+
name="ic_close"
|
|
365
|
+
size={cellFontSize + 2}
|
|
366
|
+
color={cellBorderColor}
|
|
367
|
+
/>
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
if (value === null || value === undefined || value === true) {
|
|
371
|
+
return null
|
|
372
|
+
}
|
|
373
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
374
|
+
return (
|
|
375
|
+
<Text key={cellKey} style={cellTextStyle}>
|
|
376
|
+
{value}
|
|
377
|
+
</Text>
|
|
378
|
+
)
|
|
379
|
+
}
|
|
380
|
+
return cloneChildrenWithModes(value, modes)
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const renderTable = (section: CompareTableSection) => (
|
|
384
|
+
<View
|
|
385
|
+
style={{
|
|
386
|
+
width: '100%',
|
|
387
|
+
borderWidth: cellBorderSize,
|
|
388
|
+
borderColor: cellBorderColor,
|
|
389
|
+
overflow: 'hidden',
|
|
390
|
+
}}
|
|
391
|
+
>
|
|
392
|
+
{section.header != null && (
|
|
393
|
+
<View
|
|
394
|
+
style={{
|
|
395
|
+
backgroundColor: headerBg,
|
|
396
|
+
paddingHorizontal: headerPaddingH,
|
|
397
|
+
paddingVertical: headerPaddingV,
|
|
398
|
+
borderBottomWidth: cellBorderSize,
|
|
399
|
+
borderBottomColor: cellBorderColor,
|
|
400
|
+
}}
|
|
401
|
+
>
|
|
402
|
+
<Text style={headerTextStyle}>{section.header}</Text>
|
|
403
|
+
</View>
|
|
404
|
+
)}
|
|
405
|
+
{section.rows.map((row, rowIndex) => {
|
|
406
|
+
const isLastRow = rowIndex === section.rows.length - 1
|
|
407
|
+
return (
|
|
408
|
+
<View
|
|
409
|
+
key={row.key ?? rowIndex}
|
|
410
|
+
style={{ flexDirection: 'row', width: '100%' }}
|
|
411
|
+
>
|
|
412
|
+
{Array.from({ length: columnCount }).map((_, colIndex) => {
|
|
413
|
+
const isLastCol = colIndex === columnCount - 1
|
|
414
|
+
return (
|
|
415
|
+
<View
|
|
416
|
+
key={colIndex}
|
|
417
|
+
style={{
|
|
418
|
+
flex: 1,
|
|
419
|
+
minWidth: 0,
|
|
420
|
+
backgroundColor: cellBg,
|
|
421
|
+
justifyContent: 'center',
|
|
422
|
+
paddingHorizontal: cellPaddingH,
|
|
423
|
+
paddingVertical: cellPaddingV,
|
|
424
|
+
borderRightWidth: isLastCol ? 0 : cellBorderSize,
|
|
425
|
+
borderRightColor: cellBorderColor,
|
|
426
|
+
borderBottomWidth: isLastRow ? 0 : cellBorderSize,
|
|
427
|
+
borderBottomColor: cellBorderColor,
|
|
428
|
+
}}
|
|
429
|
+
>
|
|
430
|
+
{renderCellContent(row.values?.[colIndex], `${rowIndex}-${colIndex}`)}
|
|
431
|
+
</View>
|
|
432
|
+
)
|
|
433
|
+
})}
|
|
434
|
+
</View>
|
|
435
|
+
)
|
|
436
|
+
})}
|
|
437
|
+
</View>
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
return (
|
|
441
|
+
<View
|
|
442
|
+
style={[
|
|
443
|
+
{
|
|
444
|
+
width: '100%',
|
|
445
|
+
backgroundColor: cardBg,
|
|
446
|
+
borderWidth: 1,
|
|
447
|
+
borderColor: '#e8e8e8',
|
|
448
|
+
overflow: 'hidden',
|
|
449
|
+
},
|
|
450
|
+
style,
|
|
451
|
+
]}
|
|
452
|
+
>
|
|
453
|
+
{(columnCount > 0 || showAddCard) && (
|
|
454
|
+
<View style={{ flexDirection: 'row', width: '100%' }}>
|
|
455
|
+
{columns.map(renderCard)}
|
|
456
|
+
{showAddCard && renderAddCard()}
|
|
457
|
+
</View>
|
|
458
|
+
)}
|
|
459
|
+
|
|
460
|
+
<View style={{ width: '100%' }}>
|
|
461
|
+
{sections.map((section, index) => (
|
|
462
|
+
<Accordion
|
|
463
|
+
key={section.key ?? section.title ?? index}
|
|
464
|
+
title={section.title}
|
|
465
|
+
defaultExpanded={section.defaultExpanded ?? index === 0}
|
|
466
|
+
modes={modes}
|
|
467
|
+
style={{ paddingHorizontal: headerPaddingH }}
|
|
468
|
+
>
|
|
469
|
+
{renderTable(section)}
|
|
470
|
+
</Accordion>
|
|
471
|
+
))}
|
|
472
|
+
</View>
|
|
473
|
+
</View>
|
|
474
|
+
)
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export default CompareTable
|