@ledgerhq/lumen-ui-rnative 0.0.43 → 0.0.45
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/.storybook/Decorator.tsx +78 -13
- package/.storybook/docs/getting-started/ThemeProvider.mdx +1 -1
- package/.storybook/docs/style-system/lx.mdx +144 -0
- package/.storybook/docs/style-system/useCreate.mdx +95 -0
- package/.storybook/docs/style-system/useTheme.mdx +52 -0
- package/.storybook/preview-head.html +2 -2
- package/.storybook/{preview.ts → preview.tsx} +6 -1
- package/dist/package.json +2 -3
- package/dist/src/lib/Components/AddressInput/AddressInput.js +1 -1
- package/dist/src/lib/Components/AddressInput/AddressInput.stories.d.ts +7 -1
- package/dist/src/lib/Components/AddressInput/AddressInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/AddressInput/AddressInput.stories.js +98 -9
- package/dist/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/src/lib/Components/AmountInput/AmountInput.js +3 -3
- package/dist/src/lib/Components/AmountInput/AmountInput.stories.d.ts +10 -1
- package/dist/src/lib/Components/AmountInput/AmountInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/AmountInput/AmountInput.stories.js +162 -9
- package/dist/src/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/src/lib/Components/BaseInput/BaseInput.js +2 -19
- package/dist/src/lib/Components/BottomSheet/BottomSheet.js +1 -1
- package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.js +8 -8
- package/dist/src/lib/Components/Button/BaseButton.d.ts +3 -3
- package/dist/src/lib/Components/Button/BaseButton.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/BaseButton.js +99 -119
- package/dist/src/lib/Components/Button/Button.d.ts +4 -26
- package/dist/src/lib/Components/Button/Button.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/Button.js +2 -2
- package/dist/src/lib/Components/Button/Button.stories.d.ts +1 -1
- package/dist/src/lib/Components/Button/Button.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/Button.stories.js +25 -48
- package/dist/src/lib/Components/Button/index.d.ts +1 -1
- package/dist/src/lib/Components/Button/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/index.js +1 -1
- package/dist/src/lib/Components/Button/{BaseButton.types.d.ts → types.d.ts} +15 -10
- package/dist/src/lib/Components/Button/types.d.ts.map +1 -0
- package/dist/src/lib/Components/CardButton/CardButton.d.ts +4 -3
- package/dist/src/lib/Components/CardButton/CardButton.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/CardButton.js +65 -71
- package/dist/src/lib/Components/CardButton/CardButton.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/CardButton.stories.js +28 -15
- package/dist/src/lib/Components/CardButton/index.d.ts +1 -1
- package/dist/src/lib/Components/CardButton/index.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/index.js +1 -1
- package/dist/src/lib/Components/CardButton/{CardButton.types.d.ts → types.d.ts} +5 -4
- package/dist/src/lib/Components/CardButton/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Icon/Icon.d.ts +6 -3
- package/dist/src/lib/Components/Icon/Icon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/Icon.js +24 -25
- package/dist/src/lib/Components/Icon/Icon.stories.d.ts +2 -2
- package/dist/src/lib/Components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/Icon.stories.js +73 -19
- package/dist/src/lib/Components/Icon/createIcon.d.ts +1 -1
- package/dist/src/lib/Components/Icon/createIcon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/createIcon.js +1 -2
- package/dist/src/lib/Components/Icon/index.d.ts +1 -1
- package/dist/src/lib/Components/Icon/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/index.js +1 -1
- package/dist/src/lib/Components/Icon/{Icon.types.d.ts → types.d.ts} +7 -4
- package/dist/src/lib/Components/Icon/types.d.ts.map +1 -0
- package/dist/src/lib/Components/IconButton/IconButton.d.ts +2 -19
- package/dist/src/lib/Components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/src/lib/Components/IconButton/IconButton.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/IconButton/IconButton.stories.js +9 -11
- package/dist/src/lib/Components/IconButton/index.d.ts +1 -0
- package/dist/src/lib/Components/IconButton/index.d.ts.map +1 -1
- package/dist/src/lib/Components/IconButton/index.js +1 -0
- package/dist/src/lib/Components/IconButton/types.d.ts +12 -0
- package/dist/src/lib/Components/IconButton/types.d.ts.map +1 -0
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts +2 -2
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.js +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.js +34 -34
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.d.ts +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.js +22 -9
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts +3 -7
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/Link.d.ts +7 -77
- package/dist/src/lib/Components/Link/Link.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/Link.js +59 -75
- package/dist/src/lib/Components/Link/Link.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/Link.stories.js +34 -11
- package/dist/src/lib/Components/Link/index.d.ts +1 -0
- package/dist/src/lib/Components/Link/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/index.js +1 -0
- package/dist/src/lib/Components/Link/types.d.ts +43 -0
- package/dist/src/lib/Components/Link/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Link/types.js +1 -0
- package/dist/src/lib/Components/Search/Search.stories.d.ts +6 -1
- package/dist/src/lib/Components/Search/Search.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Search/Search.stories.js +71 -9
- package/dist/src/lib/Components/Select/Select.d.ts.map +1 -1
- package/dist/src/lib/Components/Select/Select.js +1 -17
- package/dist/src/lib/Components/Spinner/Spinner.d.ts +13 -16
- package/dist/src/lib/Components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/Spinner.js +33 -5
- package/dist/src/lib/Components/Spinner/Spinner.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/Spinner.stories.js +1 -1
- package/dist/src/lib/Components/Spinner/index.d.ts +1 -0
- package/dist/src/lib/Components/Spinner/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/index.js +1 -0
- package/dist/src/lib/Components/Spinner/types.d.ts +15 -0
- package/dist/src/lib/Components/Spinner/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Spinner/types.js +1 -0
- package/dist/src/lib/Components/Tag/Tag.d.ts +2 -1
- package/dist/src/lib/Components/Tag/Tag.d.ts.map +1 -1
- package/dist/src/lib/Components/Tag/Tag.js +15 -4
- package/dist/src/lib/Components/Tag/Tag.stories.js +1 -1
- package/dist/src/lib/Components/Tag/Tag.types.d.ts +7 -1
- package/dist/src/lib/Components/Tag/Tag.types.d.ts.map +1 -1
- package/dist/src/lib/Components/TextInput/TextInput.stories.d.ts +8 -1
- package/dist/src/lib/Components/TextInput/TextInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/TextInput/TextInput.stories.js +104 -9
- package/dist/src/lib/Components/Tile/Tile.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/Tile.js +54 -8
- package/dist/src/lib/Components/Tile/types.d.ts +14 -1
- package/dist/src/lib/Components/Tile/types.d.ts.map +1 -1
- package/dist/src/lib/Components/Tooltip/Tooltip.stories.js +2 -2
- package/dist/src/lib/Components/Utility/Box/Box.d.ts +39 -0
- package/dist/src/lib/Components/Utility/Box/Box.d.ts.map +1 -0
- package/dist/src/lib/Components/{Box → Utility/Box}/Box.js +10 -11
- package/dist/src/lib/Components/Utility/Box/Box.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/{Box → Utility/Box}/Box.stories.js +13 -12
- package/dist/src/lib/Components/Utility/Box/index.d.ts +2 -0
- package/dist/src/lib/Components/Utility/Box/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.d.ts +34 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.js +33 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.d.ts +7 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.js +47 -0
- package/dist/src/lib/Components/Utility/Pressable/index.d.ts +3 -0
- package/dist/src/lib/Components/Utility/Pressable/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/index.js +1 -0
- package/dist/src/lib/Components/Utility/Pressable/types.d.ts +3 -0
- package/dist/src/lib/Components/Utility/Pressable/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/types.js +1 -0
- package/dist/src/lib/Components/Utility/Text/Text.d.ts +40 -0
- package/dist/src/lib/Components/Utility/Text/Text.d.ts.map +1 -0
- package/dist/src/lib/Components/{Text → Utility/Text}/Text.js +13 -9
- package/dist/src/lib/Components/Utility/Text/Text.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/{Text → Utility/Text}/Text.stories.js +3 -3
- package/dist/src/lib/Components/Utility/Text/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/index.d.ts +4 -0
- package/dist/src/lib/Components/Utility/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/index.js +3 -0
- package/dist/src/lib/Components/index.d.ts +1 -3
- package/dist/src/lib/Components/index.d.ts.map +1 -1
- package/dist/src/lib/Components/index.js +1 -3
- package/dist/src/lib/utils/components/InjectStylesIntoChildren.d.ts +6 -5
- package/dist/src/lib/utils/components/InjectStylesIntoChildren.d.ts.map +1 -1
- package/dist/src/lib/utils/components/InjectStylesIntoChildren.js +6 -6
- package/dist/src/styles/LumenStyleSheet.d.ts +1 -1
- package/dist/src/styles/LumenStyleSheet.d.ts.map +1 -1
- package/dist/src/styles/Provider/createStylesheetTheme.d.ts +0 -1
- package/dist/src/styles/Provider/createStylesheetTheme.d.ts.map +1 -1
- package/dist/src/styles/Provider/createStylesheetTheme.js +0 -1
- package/dist/src/styles/create/useCreate.d.ts +2 -1
- package/dist/src/styles/create/useCreate.d.ts.map +1 -1
- package/dist/src/styles/create/useCreate.js +5 -5
- package/dist/src/styles/factories/areLxPropsEqual.d.ts +3 -0
- package/dist/src/styles/factories/areLxPropsEqual.d.ts.map +1 -0
- package/dist/src/styles/factories/areLxPropsEqual.js +15 -0
- package/dist/src/styles/factories/createStyledPressable.d.ts +26 -0
- package/dist/src/styles/factories/createStyledPressable.d.ts.map +1 -0
- package/dist/src/styles/factories/createStyledPressable.js +61 -0
- package/dist/src/styles/factories/createStyledText.d.ts +15 -26
- package/dist/src/styles/factories/createStyledText.d.ts.map +1 -1
- package/dist/src/styles/factories/createStyledText.js +13 -29
- package/dist/src/styles/factories/createStyledView.d.ts +7 -27
- package/dist/src/styles/factories/createStyledView.d.ts.map +1 -1
- package/dist/src/styles/factories/createStyledView.js +10 -30
- package/dist/src/styles/factories/index.d.ts +4 -0
- package/dist/src/styles/factories/index.d.ts.map +1 -0
- package/dist/src/styles/factories/index.js +3 -0
- package/dist/src/styles/index.d.ts +2 -3
- package/dist/src/styles/index.d.ts.map +1 -1
- package/dist/src/styles/index.js +2 -3
- package/dist/src/styles/resolveStyle/resolveConfig.d.ts +7 -7
- package/dist/src/styles/resolveStyle/resolveConfig.d.ts.map +1 -1
- package/dist/src/styles/resolveStyle/resolveConfig.js +9 -9
- package/dist/src/styles/resolveStyle/resolveStyle.d.ts +6 -20
- package/dist/src/styles/resolveStyle/resolveStyle.d.ts.map +1 -1
- package/dist/src/styles/resolveStyle/resolveStyle.js +4 -29
- package/dist/src/styles/types/create.types.d.ts +1 -1
- package/dist/src/styles/types/create.types.d.ts.map +1 -1
- package/dist/src/styles/types/styled.types.d.ts +72 -50
- package/dist/src/styles/types/styled.types.d.ts.map +1 -1
- package/dist/src/styles/types/utility.types.d.ts.map +1 -1
- package/dist/src/styles/utils/index.d.ts +2 -0
- package/dist/src/styles/utils/index.d.ts.map +1 -0
- package/dist/src/styles/utils/index.js +1 -0
- package/dist/src/styles/utils/mergeStyles.d.ts +16 -0
- package/dist/src/styles/utils/mergeStyles.d.ts.map +1 -0
- package/dist/src/styles/utils/mergeStyles.js +20 -0
- package/package.json +3 -4
- package/src/lib/Components/AddressInput/AddressInput.mdx +15 -4
- package/src/lib/Components/AddressInput/AddressInput.stories.tsx +133 -17
- package/src/lib/Components/AddressInput/AddressInput.tsx +1 -1
- package/src/lib/Components/AmountInput/AmountInput.mdx +20 -1
- package/src/lib/Components/AmountInput/AmountInput.stories.tsx +180 -17
- package/src/lib/Components/AmountInput/AmountInput.tsx +24 -15
- package/src/lib/Components/Banner/Banner.test.tsx +48 -15
- package/src/lib/Components/BaseInput/BaseInput.tsx +6 -35
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +8 -8
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +1 -1
- package/src/lib/Components/Button/BaseButton.test.tsx +149 -0
- package/src/lib/Components/Button/BaseButton.tsx +193 -148
- package/src/lib/Components/Button/Button.mdx +34 -31
- package/src/lib/Components/Button/Button.stories.tsx +37 -58
- package/src/lib/Components/Button/Button.tsx +4 -11
- package/src/lib/Components/Button/index.ts +1 -1
- package/src/lib/Components/Button/{BaseButton.types.ts → types.ts} +14 -8
- package/src/lib/Components/CardButton/CardButton.mdx +15 -25
- package/src/lib/Components/CardButton/CardButton.stories.tsx +48 -22
- package/src/lib/Components/CardButton/CardButton.test.tsx +141 -0
- package/src/lib/Components/CardButton/CardButton.tsx +142 -108
- package/src/lib/Components/CardButton/index.ts +1 -1
- package/src/lib/Components/CardButton/{CardButton.types.ts → types.ts} +4 -3
- package/src/lib/Components/Checkbox/Checkbox.mdx +1 -1
- package/src/lib/Components/Checkbox/Checkbox.test.tsx +42 -17
- package/src/lib/Components/Icon/Icon.stories.tsx +143 -73
- package/src/lib/Components/Icon/Icon.test.tsx +84 -0
- package/src/lib/Components/Icon/Icon.tsx +32 -28
- package/src/lib/Components/Icon/createIcon.ts +2 -3
- package/src/lib/Components/Icon/index.ts +1 -1
- package/src/lib/Components/Icon/{Icon.types.ts → types.ts} +4 -3
- package/src/lib/Components/IconButton/IconButton.mdx +13 -10
- package/src/lib/Components/IconButton/IconButton.stories.tsx +12 -14
- package/src/lib/Components/IconButton/IconButton.test.tsx +141 -0
- package/src/lib/Components/IconButton/IconButton.tsx +3 -13
- package/src/lib/Components/IconButton/index.ts +1 -0
- package/src/lib/Components/IconButton/types.ts +12 -0
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.tsx +1 -1
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +25 -27
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.tsx +82 -43
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.test.tsx +30 -19
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.tsx +78 -45
- package/src/lib/Components/InteractiveIcon/types.ts +4 -7
- package/src/lib/Components/Link/Link.mdx +8 -18
- package/src/lib/Components/Link/Link.stories.tsx +56 -25
- package/src/lib/Components/Link/Link.test.tsx +141 -51
- package/src/lib/Components/Link/Link.tsx +128 -150
- package/src/lib/Components/Link/index.ts +1 -0
- package/src/lib/Components/Link/types.ts +44 -0
- package/src/lib/Components/Search/Search.mdx +14 -1
- package/src/lib/Components/Search/Search.stories.tsx +94 -15
- package/src/lib/Components/Select/Select.test.tsx +8 -4
- package/src/lib/Components/Select/Select.tsx +4 -31
- package/src/lib/Components/Spinner/Spinner.stories.tsx +1 -5
- package/src/lib/Components/Spinner/Spinner.tsx +60 -34
- package/src/lib/Components/Spinner/index.ts +1 -0
- package/src/lib/Components/Spinner/types.ts +15 -0
- package/src/lib/Components/Switch/Switch.mdx +1 -1
- package/src/lib/Components/Tag/Tag.stories.tsx +2 -2
- package/src/lib/Components/Tag/Tag.tsx +22 -6
- package/src/lib/Components/Tag/Tag.types.ts +7 -8
- package/src/lib/Components/TextInput/TextInput.mdx +24 -4
- package/src/lib/Components/TextInput/TextInput.stories.tsx +131 -15
- package/src/lib/Components/Tile/Tile.test.tsx +100 -63
- package/src/lib/Components/Tile/Tile.tsx +64 -13
- package/src/lib/Components/Tile/types.ts +14 -1
- package/src/lib/Components/Tooltip/Tooltip.stories.tsx +2 -2
- package/src/lib/Components/Tooltip/Tooltip.test.tsx +8 -4
- package/src/lib/Components/{Box → Utility/Box}/Box.mdx +15 -13
- package/src/lib/Components/{Box → Utility/Box}/Box.stories.tsx +13 -11
- package/src/lib/Components/{Box → Utility/Box}/Box.tsx +11 -12
- package/src/lib/Components/Utility/Box/index.ts +1 -0
- package/src/lib/Components/Utility/Pressable/Pressable.mdx +103 -0
- package/src/lib/Components/Utility/Pressable/Pressable.stories.tsx +51 -0
- package/src/lib/Components/Utility/Pressable/Pressable.test.tsx +221 -0
- package/src/lib/Components/Utility/Pressable/Pressable.tsx +34 -0
- package/src/lib/Components/Utility/Pressable/index.ts +2 -0
- package/src/lib/Components/Utility/Pressable/types.ts +3 -0
- package/src/lib/Components/{Text → Utility/Text}/Text.mdx +15 -7
- package/src/lib/Components/{Text → Utility/Text}/Text.stories.tsx +3 -3
- package/src/lib/Components/Utility/Text/Text.tsx +39 -0
- package/src/lib/Components/Utility/index.ts +3 -0
- package/src/lib/Components/index.ts +1 -3
- package/src/lib/utils/components/InjectStylesIntoChildren.tsx +23 -14
- package/src/styles/Provider/createStylesheetTheme.ts +0 -1
- package/src/styles/create/useCreate.ts +8 -4
- package/src/styles/factories/areLxPropsEqual.ts +32 -0
- package/src/styles/factories/createStyledPressable.test.tsx +253 -0
- package/src/styles/factories/createStyledPressable.tsx +97 -0
- package/src/styles/factories/createStyledText.test.tsx +28 -20
- package/src/styles/factories/createStyledText.tsx +29 -49
- package/src/styles/factories/createStyledView.test.tsx +22 -16
- package/src/styles/factories/createStyledView.tsx +19 -53
- package/src/styles/factories/index.ts +3 -0
- package/src/styles/index.ts +2 -3
- package/src/styles/resolveStyle/resolveConfig.ts +16 -15
- package/src/styles/resolveStyle/resolveStyle.test.ts +13 -141
- package/src/styles/resolveStyle/resolveStyle.ts +10 -60
- package/src/styles/types/create.types.ts +1 -1
- package/src/styles/types/styled.types.ts +73 -105
- package/src/styles/types/utility.types.ts +1 -0
- package/src/styles/utils/index.ts +1 -0
- package/src/styles/utils/mergeStyles.test.ts +45 -0
- package/src/styles/utils/mergeStyles.ts +25 -0
- package/.storybook/docs/getting-started/StyleSystem.mdx +0 -133
- package/dist/src/lib/Components/Box/Box.d.ts +0 -592
- package/dist/src/lib/Components/Box/Box.d.ts.map +0 -1
- package/dist/src/lib/Components/Box/Box.stories.d.ts.map +0 -1
- package/dist/src/lib/Components/Box/Box.types.d.ts +0 -3
- package/dist/src/lib/Components/Box/Box.types.d.ts.map +0 -1
- package/dist/src/lib/Components/Box/index.d.ts +0 -3
- package/dist/src/lib/Components/Box/index.d.ts.map +0 -1
- package/dist/src/lib/Components/Button/BaseButton.types.d.ts.map +0 -1
- package/dist/src/lib/Components/CardButton/CardButton.types.d.ts.map +0 -1
- package/dist/src/lib/Components/Icon/Icon.types.d.ts.map +0 -1
- package/dist/src/lib/Components/Text/Text.d.ts +0 -602
- package/dist/src/lib/Components/Text/Text.d.ts.map +0 -1
- package/dist/src/lib/Components/Text/Text.stories.d.ts.map +0 -1
- package/dist/src/lib/Components/Text/index.d.ts.map +0 -1
- package/dist/src/lib/Components/_ToRemove/ToRemove.d.ts +0 -9
- package/dist/src/lib/Components/_ToRemove/ToRemove.d.ts.map +0 -1
- package/dist/src/lib/Components/_ToRemove/ToRemove.js +0 -43
- package/dist/src/styles/utils/styleVarianceAuthority.d.ts +0 -30
- package/dist/src/styles/utils/styleVarianceAuthority.d.ts.map +0 -1
- package/dist/src/styles/utils/styleVarianceAuthority.js +0 -97
- package/src/lib/Components/Box/Box.types.ts +0 -3
- package/src/lib/Components/Box/index.ts +0 -2
- package/src/lib/Components/Text/Text.tsx +0 -35
- package/src/lib/Components/_ToRemove/ToRemove.tsx +0 -65
- package/src/styles/utils/styleVarianceAuthority.test.ts +0 -302
- package/src/styles/utils/styleVarianceAuthority.ts +0 -154
- /package/dist/src/lib/Components/{Box/Box.types.js → Button/types.js} +0 -0
- /package/dist/src/lib/Components/{Button/BaseButton.types.js → CardButton/types.js} +0 -0
- /package/dist/src/lib/Components/{CardButton/CardButton.types.js → Icon/types.js} +0 -0
- /package/dist/src/lib/Components/{Icon/Icon.types.js → IconButton/types.js} +0 -0
- /package/dist/src/lib/Components/{Box → Utility/Box}/Box.stories.d.ts +0 -0
- /package/dist/src/lib/Components/{Box → Utility/Box}/index.js +0 -0
- /package/dist/src/lib/Components/{Text → Utility/Text}/Text.stories.d.ts +0 -0
- /package/dist/src/lib/Components/{Text → Utility/Text}/index.d.ts +0 -0
- /package/dist/src/lib/Components/{Text → Utility/Text}/index.js +0 -0
- /package/src/lib/Components/{Text → Utility/Text}/index.ts +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { describe, expect, it, jest } from '@jest/globals';
|
|
2
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
|
+
import { fireEvent, render, screen } from '@testing-library/react-native';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { Settings, Plus } from '../../Symbols';
|
|
7
|
+
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
8
|
+
import { CardButton } from './CardButton';
|
|
9
|
+
|
|
10
|
+
const renderWithProvider = (component: React.ReactElement) => {
|
|
11
|
+
return render(
|
|
12
|
+
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
13
|
+
{component}
|
|
14
|
+
</ThemeProvider>,
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe('CardButton Component', () => {
|
|
19
|
+
describe('Rendering', () => {
|
|
20
|
+
it('should render with required props', () => {
|
|
21
|
+
renderWithProvider(
|
|
22
|
+
<CardButton testID='card-button' title='Test Card Button' />,
|
|
23
|
+
);
|
|
24
|
+
expect(screen.getByTestId('card-button')).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should render the title', () => {
|
|
28
|
+
renderWithProvider(<CardButton title='Test Title' />);
|
|
29
|
+
expect(screen.getByText('Test Title')).toBeTruthy();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should render description when provided', () => {
|
|
33
|
+
renderWithProvider(
|
|
34
|
+
<CardButton title='Test Title' description='Test Description' />,
|
|
35
|
+
);
|
|
36
|
+
expect(screen.getByText('Test Description')).toBeTruthy();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should have correct accessibility role', () => {
|
|
40
|
+
renderWithProvider(
|
|
41
|
+
<CardButton testID='card-button' title='Test Card Button' />,
|
|
42
|
+
);
|
|
43
|
+
const button = screen.getByTestId('card-button');
|
|
44
|
+
expect(button.props.accessibilityRole).toBe('button');
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('Appearances', () => {
|
|
49
|
+
it.each(['base', 'outline'] as const)(
|
|
50
|
+
'should render with %s appearance',
|
|
51
|
+
(appearance) => {
|
|
52
|
+
renderWithProvider(
|
|
53
|
+
<CardButton
|
|
54
|
+
testID='card-button'
|
|
55
|
+
title='Test Card Button'
|
|
56
|
+
appearance={appearance}
|
|
57
|
+
/>,
|
|
58
|
+
);
|
|
59
|
+
expect(screen.getByTestId('card-button')).toBeTruthy();
|
|
60
|
+
},
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('Icon', () => {
|
|
65
|
+
it('should render with icon when provided', () => {
|
|
66
|
+
renderWithProvider(
|
|
67
|
+
<CardButton testID='card-button' title='Settings' icon={Settings} />,
|
|
68
|
+
);
|
|
69
|
+
expect(screen.getByTestId('card-button')).toBeTruthy();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should render different icons', () => {
|
|
73
|
+
renderWithProvider(
|
|
74
|
+
<CardButton testID='card-button' title='Add' icon={Plus} />,
|
|
75
|
+
);
|
|
76
|
+
expect(screen.getByTestId('card-button')).toBeTruthy();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe('Chevron', () => {
|
|
81
|
+
it('should render chevron by default', () => {
|
|
82
|
+
renderWithProvider(
|
|
83
|
+
<CardButton testID='card-button' title='Test Card Button' />,
|
|
84
|
+
);
|
|
85
|
+
// The chevron is rendered inside card-button-content
|
|
86
|
+
expect(screen.getByTestId('card-button-content')).toBeTruthy();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should hide chevron when hideChevron is true', () => {
|
|
90
|
+
renderWithProvider(
|
|
91
|
+
<CardButton
|
|
92
|
+
testID='card-button'
|
|
93
|
+
title='Test Card Button'
|
|
94
|
+
hideChevron
|
|
95
|
+
/>,
|
|
96
|
+
);
|
|
97
|
+
expect(screen.getByTestId('card-button')).toBeTruthy();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
describe('States', () => {
|
|
102
|
+
it('should be disabled when disabled prop is true', () => {
|
|
103
|
+
renderWithProvider(
|
|
104
|
+
<CardButton testID='card-button' title='Test Card Button' disabled />,
|
|
105
|
+
);
|
|
106
|
+
const button = screen.getByTestId('card-button');
|
|
107
|
+
expect(button.props.accessibilityState.disabled).toBe(true);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('Interactions', () => {
|
|
112
|
+
it('should call onPress when pressed', () => {
|
|
113
|
+
const handlePress = jest.fn();
|
|
114
|
+
renderWithProvider(
|
|
115
|
+
<CardButton
|
|
116
|
+
testID='card-button'
|
|
117
|
+
title='Test Card Button'
|
|
118
|
+
onPress={handlePress}
|
|
119
|
+
/>,
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
fireEvent.press(screen.getByTestId('card-button'));
|
|
123
|
+
expect(handlePress).toHaveBeenCalledTimes(1);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should not call onPress when disabled', () => {
|
|
127
|
+
const handlePress = jest.fn();
|
|
128
|
+
renderWithProvider(
|
|
129
|
+
<CardButton
|
|
130
|
+
testID='card-button'
|
|
131
|
+
title='Test Card Button'
|
|
132
|
+
onPress={handlePress}
|
|
133
|
+
disabled
|
|
134
|
+
/>,
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
fireEvent.press(screen.getByTestId('card-button'));
|
|
138
|
+
expect(handlePress).not.toHaveBeenCalled();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
});
|
|
@@ -1,78 +1,89 @@
|
|
|
1
|
-
import { cva } from 'class-variance-authority';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { Text,
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
3
|
+
import { LumenStyleSheet, mergeStyles } from '../../../styles';
|
|
4
4
|
import { ChevronRight } from '../../Symbols';
|
|
5
|
-
import {
|
|
5
|
+
import { Pressable } from '../Utility';
|
|
6
6
|
|
|
7
|
-
import { CardButtonProps } from './
|
|
7
|
+
import { CardButtonProps } from './types';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
9
|
+
type Appearance = NonNullable<CardButtonProps['appearance']>;
|
|
10
|
+
|
|
11
|
+
const useStyles = ({
|
|
12
|
+
appearance,
|
|
13
|
+
disabled,
|
|
14
|
+
pressed,
|
|
15
|
+
}: {
|
|
16
|
+
appearance: Appearance;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
pressed: boolean;
|
|
19
|
+
}) => {
|
|
20
|
+
return LumenStyleSheet.useCreate(
|
|
21
|
+
(t) => {
|
|
22
|
+
const bgColors: Record<Appearance, string> = {
|
|
23
|
+
base: t.colors.bg.muted,
|
|
24
|
+
outline: 'transparent',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const pressedBgColors: Record<Appearance, string> = {
|
|
28
|
+
base: t.colors.bg.mutedPressed,
|
|
29
|
+
outline: t.colors.bg.baseTransparentPressed,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
container: mergeStyles(
|
|
34
|
+
{
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
width: t.sizes.full,
|
|
38
|
+
gap: t.spacings.s12,
|
|
39
|
+
padding: t.spacings.s12,
|
|
40
|
+
borderRadius: t.borderRadius.sm,
|
|
41
|
+
backgroundColor: bgColors[appearance],
|
|
42
|
+
},
|
|
43
|
+
appearance === 'outline' && {
|
|
44
|
+
borderStyle: 'dashed',
|
|
45
|
+
borderWidth: t.borderWidth.s1,
|
|
46
|
+
borderColor: t.colors.border.mutedSubtle,
|
|
47
|
+
},
|
|
48
|
+
pressed && {
|
|
49
|
+
backgroundColor: pressedBgColors[appearance],
|
|
50
|
+
},
|
|
51
|
+
pressed &&
|
|
52
|
+
appearance === 'outline' && {
|
|
53
|
+
borderColor: t.colors.border.mutedSubtlePressed,
|
|
54
|
+
},
|
|
55
|
+
disabled && {
|
|
56
|
+
backgroundColor:
|
|
57
|
+
appearance === 'outline' ? 'transparent' : t.colors.bg.disabled,
|
|
58
|
+
},
|
|
59
|
+
disabled &&
|
|
60
|
+
appearance === 'outline' && {
|
|
61
|
+
borderColor: t.colors.border.disabled,
|
|
62
|
+
},
|
|
63
|
+
),
|
|
64
|
+
contentWrapper: {
|
|
65
|
+
flex: 1,
|
|
66
|
+
minWidth: 0,
|
|
67
|
+
flexDirection: 'column',
|
|
68
|
+
gap: t.spacings.s4,
|
|
38
69
|
},
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
70
|
+
title: mergeStyles(t.typographies.body1SemiBold, {
|
|
71
|
+
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
72
|
+
minWidth: 0,
|
|
73
|
+
textAlign: 'left',
|
|
74
|
+
}),
|
|
75
|
+
description: mergeStyles(t.typographies.body2, {
|
|
76
|
+
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
77
|
+
minWidth: 0,
|
|
78
|
+
}),
|
|
79
|
+
icon: {
|
|
80
|
+
flexShrink: 0,
|
|
81
|
+
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
44
82
|
},
|
|
45
|
-
|
|
46
|
-
defaultVariants: {
|
|
47
|
-
appearance: 'base',
|
|
48
|
-
disabled: false,
|
|
49
|
-
},
|
|
83
|
+
};
|
|
50
84
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
variants: {
|
|
54
|
-
disabled: {
|
|
55
|
-
true: 'text-disabled',
|
|
56
|
-
false: 'text-base',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
}),
|
|
60
|
-
description: cva('min-w-0 body-2', {
|
|
61
|
-
variants: {
|
|
62
|
-
disabled: {
|
|
63
|
-
true: 'text-disabled',
|
|
64
|
-
false: 'text-base',
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
}),
|
|
68
|
-
icon: cva('shrink-0', {
|
|
69
|
-
variants: {
|
|
70
|
-
disabled: {
|
|
71
|
-
true: 'text-disabled',
|
|
72
|
-
false: 'text-base',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
}),
|
|
85
|
+
[appearance, disabled, pressed],
|
|
86
|
+
);
|
|
76
87
|
};
|
|
77
88
|
|
|
78
89
|
/**
|
|
@@ -83,7 +94,7 @@ const cardButtonVariants = {
|
|
|
83
94
|
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_action-cardbutton--docs Storybook}
|
|
84
95
|
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_action-cardbutton--docs#dos-and-donts Guidelines}
|
|
85
96
|
*
|
|
86
|
-
* @warning The `
|
|
97
|
+
* @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
|
|
87
98
|
* Do not use it to modify the card button's core appearance (colors, padding, etc). Use the `appearance` prop instead.
|
|
88
99
|
*
|
|
89
100
|
* @example
|
|
@@ -92,6 +103,7 @@ const cardButtonVariants = {
|
|
|
92
103
|
*
|
|
93
104
|
* <CardButton title="Click Me" onPress={() => console.log('Clicked!')} />
|
|
94
105
|
*
|
|
106
|
+
* @example
|
|
95
107
|
* // Card button with icon and description
|
|
96
108
|
* import { CardButton } from '@ledgerhq/lumen-ui-rnative';
|
|
97
109
|
* import { Info } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
@@ -109,8 +121,9 @@ export const CardButton = React.forwardRef<
|
|
|
109
121
|
>(
|
|
110
122
|
(
|
|
111
123
|
{
|
|
112
|
-
|
|
113
|
-
|
|
124
|
+
lx,
|
|
125
|
+
style,
|
|
126
|
+
appearance = 'base',
|
|
114
127
|
icon,
|
|
115
128
|
title,
|
|
116
129
|
description,
|
|
@@ -120,53 +133,74 @@ export const CardButton = React.forwardRef<
|
|
|
120
133
|
},
|
|
121
134
|
ref,
|
|
122
135
|
) => {
|
|
123
|
-
const IconComponent = icon;
|
|
124
|
-
|
|
125
136
|
return (
|
|
126
137
|
<Pressable
|
|
127
138
|
ref={ref}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}),
|
|
134
|
-
)}
|
|
135
|
-
disabled={disabled ?? false}
|
|
139
|
+
lx={lx}
|
|
140
|
+
style={[style, { flex: 1 }]}
|
|
141
|
+
disabled={disabled}
|
|
142
|
+
accessibilityRole='button'
|
|
143
|
+
accessibilityState={{ disabled }}
|
|
136
144
|
{...props}
|
|
137
145
|
>
|
|
138
|
-
{
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
{({ pressed }) => (
|
|
147
|
+
<CardButtonContent
|
|
148
|
+
appearance={appearance}
|
|
149
|
+
disabled={disabled}
|
|
150
|
+
pressed={pressed}
|
|
151
|
+
icon={icon}
|
|
152
|
+
title={title}
|
|
153
|
+
description={description}
|
|
154
|
+
hideChevron={hideChevron}
|
|
142
155
|
/>
|
|
143
156
|
)}
|
|
144
|
-
|
|
157
|
+
</Pressable>
|
|
158
|
+
);
|
|
159
|
+
},
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
type CardButtonContentProps = {
|
|
163
|
+
appearance: Appearance;
|
|
164
|
+
disabled: boolean;
|
|
165
|
+
pressed: boolean;
|
|
166
|
+
icon: CardButtonProps['icon'];
|
|
167
|
+
title: string;
|
|
168
|
+
description?: string;
|
|
169
|
+
hideChevron?: boolean;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const CardButtonContent: React.FC<CardButtonContentProps> = ({
|
|
173
|
+
appearance,
|
|
174
|
+
disabled,
|
|
175
|
+
pressed,
|
|
176
|
+
icon,
|
|
177
|
+
title,
|
|
178
|
+
description,
|
|
179
|
+
hideChevron,
|
|
180
|
+
}) => {
|
|
181
|
+
const IconComponent = icon;
|
|
182
|
+
const styles = useStyles({ appearance, disabled, pressed });
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<View style={styles.container} testID='card-button-content'>
|
|
186
|
+
{IconComponent && <IconComponent size={24} style={styles.icon} />}
|
|
187
|
+
<View style={styles.contentWrapper}>
|
|
188
|
+
<Text style={styles.title} numberOfLines={1} ellipsizeMode='tail'>
|
|
189
|
+
{title}
|
|
190
|
+
</Text>
|
|
191
|
+
{description && (
|
|
145
192
|
<Text
|
|
146
|
-
|
|
147
|
-
numberOfLines={
|
|
193
|
+
style={styles.description}
|
|
194
|
+
numberOfLines={2}
|
|
148
195
|
ellipsizeMode='tail'
|
|
149
196
|
>
|
|
150
|
-
{
|
|
197
|
+
{description}
|
|
151
198
|
</Text>
|
|
152
|
-
{description && (
|
|
153
|
-
<Text
|
|
154
|
-
className={cardButtonVariants.description({ disabled })}
|
|
155
|
-
numberOfLines={2}
|
|
156
|
-
ellipsizeMode='tail'
|
|
157
|
-
>
|
|
158
|
-
{description}
|
|
159
|
-
</Text>
|
|
160
|
-
)}
|
|
161
|
-
</View>
|
|
162
|
-
{!hideChevron && (
|
|
163
|
-
<ChevronRight
|
|
164
|
-
size={24}
|
|
165
|
-
className={cardButtonVariants.icon({ disabled })}
|
|
166
|
-
/>
|
|
167
199
|
)}
|
|
168
|
-
</
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
);
|
|
200
|
+
</View>
|
|
201
|
+
{!hideChevron && <ChevronRight size={24} style={styles.icon} />}
|
|
202
|
+
</View>
|
|
203
|
+
);
|
|
204
|
+
};
|
|
205
|
+
|
|
172
206
|
CardButton.displayName = 'CardButton';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './CardButton';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './types';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { StyledPressableProps } from '../../../styles';
|
|
3
4
|
import { IconSize } from '../Icon';
|
|
4
5
|
|
|
5
6
|
export type CardButtonProps = {
|
|
@@ -14,7 +15,7 @@ export type CardButtonProps = {
|
|
|
14
15
|
/**
|
|
15
16
|
* An optional icon component to render on the left side.
|
|
16
17
|
*/
|
|
17
|
-
icon?: React.ComponentType<{ size?: IconSize;
|
|
18
|
+
icon?: React.ComponentType<{ size?: IconSize; style?: StyleProp<ViewStyle> }>;
|
|
18
19
|
/**
|
|
19
20
|
* The main title of the card button.
|
|
20
21
|
*/
|
|
@@ -27,4 +28,4 @@ export type CardButtonProps = {
|
|
|
27
28
|
* If true, hides the chevron arrow on the right side.
|
|
28
29
|
*/
|
|
29
30
|
hideChevron?: boolean;
|
|
30
|
-
} & Omit<
|
|
31
|
+
} & Omit<StyledPressableProps, 'disabled'>;
|
|
@@ -119,7 +119,7 @@ Use `defaultChecked` for simple cases:
|
|
|
119
119
|
</div>
|
|
120
120
|
|
|
121
121
|
// ✅ ARIA label for standalone checkbox
|
|
122
|
-
<Checkbox
|
|
122
|
+
<Checkbox accessibilityLabel="Select all items" />
|
|
123
123
|
|
|
124
124
|
// ✅ ARIA described by for complex descriptions
|
|
125
125
|
<div>
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { describe, it, expect, jest } from '@jest/globals';
|
|
2
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
2
3
|
import { render, fireEvent, waitFor } from '@testing-library/react-native';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
3
6
|
import { Checkbox } from './Checkbox';
|
|
4
7
|
|
|
8
|
+
const TestWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => (
|
|
9
|
+
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
10
|
+
{children}
|
|
11
|
+
</ThemeProvider>
|
|
12
|
+
);
|
|
13
|
+
|
|
5
14
|
describe('Checkbox', () => {
|
|
6
15
|
it('uncontrolled: toggles on press and reflects checked state', async () => {
|
|
7
16
|
const { getByTestId } = render(
|
|
8
|
-
<
|
|
17
|
+
<TestWrapper>
|
|
18
|
+
<Checkbox defaultChecked={false} testID='checkbox' />
|
|
19
|
+
</TestWrapper>,
|
|
9
20
|
);
|
|
10
21
|
|
|
11
22
|
expect(getByTestId('checkbox').props.accessibilityState?.checked).toBe(
|
|
@@ -24,7 +35,13 @@ describe('Checkbox', () => {
|
|
|
24
35
|
it('controlled: calls onCheckedChange but state is controlled by parent', async () => {
|
|
25
36
|
const onChange = jest.fn();
|
|
26
37
|
const { getByTestId, rerender } = render(
|
|
27
|
-
<
|
|
38
|
+
<TestWrapper>
|
|
39
|
+
<Checkbox
|
|
40
|
+
checked={false}
|
|
41
|
+
onCheckedChange={onChange}
|
|
42
|
+
testID='checkbox'
|
|
43
|
+
/>
|
|
44
|
+
</TestWrapper>,
|
|
28
45
|
);
|
|
29
46
|
|
|
30
47
|
expect(getByTestId('checkbox').props.accessibilityState?.checked).toBe(
|
|
@@ -41,7 +58,9 @@ describe('Checkbox', () => {
|
|
|
41
58
|
);
|
|
42
59
|
|
|
43
60
|
rerender(
|
|
44
|
-
<
|
|
61
|
+
<TestWrapper>
|
|
62
|
+
<Checkbox checked={true} onCheckedChange={onChange} testID='checkbox' />
|
|
63
|
+
</TestWrapper>,
|
|
45
64
|
);
|
|
46
65
|
|
|
47
66
|
await waitFor(() =>
|
|
@@ -54,12 +73,14 @@ describe('Checkbox', () => {
|
|
|
54
73
|
it('label: renders and toggles when pressed', async () => {
|
|
55
74
|
const onChange = jest.fn();
|
|
56
75
|
const { getByText, getByTestId } = render(
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
76
|
+
<TestWrapper>
|
|
77
|
+
<Checkbox
|
|
78
|
+
defaultChecked={false}
|
|
79
|
+
label='Accept'
|
|
80
|
+
onCheckedChange={onChange}
|
|
81
|
+
testID='checkbox'
|
|
82
|
+
/>
|
|
83
|
+
</TestWrapper>,
|
|
63
84
|
);
|
|
64
85
|
|
|
65
86
|
fireEvent.press(getByText('Accept'));
|
|
@@ -75,13 +96,15 @@ describe('Checkbox', () => {
|
|
|
75
96
|
it('disabled: does not toggle on trigger or label press', async () => {
|
|
76
97
|
const onChange = jest.fn();
|
|
77
98
|
const { getByText, getByTestId } = render(
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
99
|
+
<TestWrapper>
|
|
100
|
+
<Checkbox
|
|
101
|
+
disabled
|
|
102
|
+
defaultChecked={false}
|
|
103
|
+
label='Terms'
|
|
104
|
+
onCheckedChange={onChange}
|
|
105
|
+
testID='checkbox'
|
|
106
|
+
/>
|
|
107
|
+
</TestWrapper>,
|
|
85
108
|
);
|
|
86
109
|
|
|
87
110
|
const trigger = getByTestId('checkbox');
|
|
@@ -95,7 +118,9 @@ describe('Checkbox', () => {
|
|
|
95
118
|
|
|
96
119
|
it('passes through nativeID to trigger for a11y mapping', () => {
|
|
97
120
|
const { getByTestId } = render(
|
|
98
|
-
<
|
|
121
|
+
<TestWrapper>
|
|
122
|
+
<Checkbox defaultChecked={false} nativeID='check-1' testID='checkbox' />
|
|
123
|
+
</TestWrapper>,
|
|
99
124
|
);
|
|
100
125
|
|
|
101
126
|
expect(getByTestId('checkbox').props.nativeID).toBe('check-1');
|