@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
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { LumenStyleSheet } from '../../../styles';
|
|
3
5
|
import * as Icons from '../../Symbols';
|
|
4
6
|
import { Search } from '../Search/Search';
|
|
5
|
-
import {
|
|
7
|
+
import { Box, Text, Pressable } from '../Utility';
|
|
8
|
+
import type { IconSize } from './types';
|
|
6
9
|
|
|
7
10
|
const meta: Meta = {
|
|
8
11
|
title: 'Symbols/Interface Icons',
|
|
@@ -18,22 +21,20 @@ const iconNames = Object.keys(Icons) as IconName[];
|
|
|
18
21
|
type IconStoryProps = {
|
|
19
22
|
size: IconSize;
|
|
20
23
|
name: IconName;
|
|
21
|
-
|
|
24
|
+
color?: string;
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
type IconCardProps = {
|
|
25
28
|
name: string;
|
|
26
29
|
size?: IconSize;
|
|
27
|
-
|
|
30
|
+
color?: string;
|
|
28
31
|
};
|
|
29
32
|
|
|
30
|
-
const IconCard = ({
|
|
31
|
-
|
|
32
|
-
size = 24,
|
|
33
|
-
className = 'text-base',
|
|
34
|
-
}: IconCardProps) => {
|
|
33
|
+
const IconCard = ({ name, size = 24, color }: IconCardProps) => {
|
|
34
|
+
const { theme } = LumenStyleSheet.useTheme();
|
|
35
35
|
const [copied, setCopied] = useState(false);
|
|
36
36
|
const IconComponent = Icons[name as keyof typeof Icons];
|
|
37
|
+
const iconColor = color ?? theme.colors.text.base;
|
|
37
38
|
|
|
38
39
|
const handleClick = async () => {
|
|
39
40
|
try {
|
|
@@ -46,19 +47,46 @@ const IconCard = ({
|
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
|
-
<
|
|
50
|
+
<Pressable
|
|
50
51
|
key={name}
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
onPress={handleClick}
|
|
53
|
+
lx={{
|
|
54
|
+
position: 'relative',
|
|
55
|
+
flexDirection: 'column',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
gap: 's8',
|
|
58
|
+
borderRadius: 'sm',
|
|
59
|
+
padding: 's16',
|
|
60
|
+
width: 's144',
|
|
61
|
+
}}
|
|
62
|
+
style={({ pressed }) => ({
|
|
63
|
+
backgroundColor: pressed ? theme.colors.bg.mutedPressed : 'transparent',
|
|
64
|
+
})}
|
|
53
65
|
>
|
|
54
|
-
<IconComponent size={size}
|
|
55
|
-
<
|
|
66
|
+
<IconComponent size={size} style={{ color: iconColor }} />
|
|
67
|
+
<Text typography='body4' lx={{ color: 'muted' }}>
|
|
68
|
+
{name}
|
|
69
|
+
</Text>
|
|
56
70
|
{copied && (
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
<View
|
|
72
|
+
style={{
|
|
73
|
+
position: 'absolute',
|
|
74
|
+
top: 0,
|
|
75
|
+
left: 0,
|
|
76
|
+
right: 0,
|
|
77
|
+
bottom: 0,
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
justifyContent: 'center',
|
|
80
|
+
borderRadius: theme.borderRadius.sm,
|
|
81
|
+
backgroundColor: theme.colors.bg.muted,
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Text typography='body4' lx={{ color: 'onAccent' }}>
|
|
85
|
+
Copied!
|
|
86
|
+
</Text>
|
|
87
|
+
</View>
|
|
60
88
|
)}
|
|
61
|
-
</
|
|
89
|
+
</Pressable>
|
|
62
90
|
);
|
|
63
91
|
};
|
|
64
92
|
|
|
@@ -66,7 +94,6 @@ export const Icon: StoryObj<IconStoryProps> = {
|
|
|
66
94
|
args: {
|
|
67
95
|
size: 24,
|
|
68
96
|
name: 'Home',
|
|
69
|
-
className: 'text-base',
|
|
70
97
|
},
|
|
71
98
|
argTypes: {
|
|
72
99
|
size: {
|
|
@@ -79,27 +106,30 @@ export const Icon: StoryObj<IconStoryProps> = {
|
|
|
79
106
|
options: iconNames,
|
|
80
107
|
description: 'The name of the icon to display',
|
|
81
108
|
},
|
|
82
|
-
|
|
83
|
-
control: '
|
|
84
|
-
description: '
|
|
109
|
+
color: {
|
|
110
|
+
control: 'color',
|
|
111
|
+
description: 'The color of the icon',
|
|
85
112
|
},
|
|
86
113
|
},
|
|
87
114
|
render: (args) => {
|
|
115
|
+
const { theme } = LumenStyleSheet.useTheme();
|
|
88
116
|
const IconComponent = Icons[args.name];
|
|
117
|
+
const iconColor = args.color ?? theme.colors.text.base;
|
|
118
|
+
|
|
89
119
|
return (
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
<IconComponent size={args.size}
|
|
93
|
-
<
|
|
94
|
-
</
|
|
95
|
-
</
|
|
120
|
+
<Box lx={{ padding: 's8' }}>
|
|
121
|
+
<Box lx={{ flexDirection: 'column', alignItems: 'center', gap: 's4' }}>
|
|
122
|
+
<IconComponent size={args.size} style={{ color: iconColor }} />
|
|
123
|
+
<Text lx={{ color: 'base' }}>{args.name}</Text>
|
|
124
|
+
</Box>
|
|
125
|
+
</Box>
|
|
96
126
|
);
|
|
97
127
|
},
|
|
98
128
|
parameters: {
|
|
99
129
|
docs: {
|
|
100
130
|
source: {
|
|
101
131
|
code: `
|
|
102
|
-
<Information size={24}
|
|
132
|
+
<Information size={24} style={{ color: theme.colors.text.base }} />
|
|
103
133
|
`,
|
|
104
134
|
},
|
|
105
135
|
},
|
|
@@ -107,29 +137,47 @@ export const Icon: StoryObj<IconStoryProps> = {
|
|
|
107
137
|
};
|
|
108
138
|
|
|
109
139
|
export const IconSizes: StoryObj = {
|
|
110
|
-
render: () =>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
140
|
+
render: () => {
|
|
141
|
+
const { theme } = LumenStyleSheet.useTheme();
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<Box lx={{ flexDirection: 'column', gap: 's16' }}>
|
|
145
|
+
{sizes.map((size) => (
|
|
146
|
+
<Box key={size} lx={{ flexDirection: 'column' }}>
|
|
147
|
+
<Text typography='heading3' lx={{ marginBottom: 's16' }}>
|
|
148
|
+
Size {size}px
|
|
149
|
+
</Text>
|
|
150
|
+
<Box
|
|
151
|
+
lx={{
|
|
152
|
+
flexDirection: 'row',
|
|
153
|
+
flexWrap: 'wrap',
|
|
154
|
+
gap: 's16',
|
|
155
|
+
borderRadius: 'sm',
|
|
156
|
+
padding: 's16',
|
|
157
|
+
}}
|
|
158
|
+
style={{
|
|
159
|
+
borderWidth: 1,
|
|
160
|
+
borderColor: theme.colors.border.mutedSubtle,
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
{[
|
|
164
|
+
'Home',
|
|
165
|
+
'Settings',
|
|
166
|
+
'Heart',
|
|
167
|
+
'Star',
|
|
168
|
+
'ArrowDown',
|
|
169
|
+
'ArrowLeft',
|
|
170
|
+
'ArrowRight',
|
|
171
|
+
'ArrowUp',
|
|
172
|
+
].map((iconName) => (
|
|
173
|
+
<IconCard key={iconName} name={iconName} size={size} />
|
|
174
|
+
))}
|
|
175
|
+
</Box>
|
|
176
|
+
</Box>
|
|
177
|
+
))}
|
|
178
|
+
</Box>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
133
181
|
};
|
|
134
182
|
|
|
135
183
|
export const Gallery: StoryObj = {
|
|
@@ -137,6 +185,7 @@ export const Gallery: StoryObj = {
|
|
|
137
185
|
layout: 'fullscreen',
|
|
138
186
|
},
|
|
139
187
|
render: () => {
|
|
188
|
+
const { theme } = LumenStyleSheet.useTheme();
|
|
140
189
|
const [searchTerm, setSearchTerm] = useState('');
|
|
141
190
|
|
|
142
191
|
// Filter icons based on search term
|
|
@@ -145,48 +194,69 @@ export const Gallery: StoryObj = {
|
|
|
145
194
|
);
|
|
146
195
|
|
|
147
196
|
return (
|
|
148
|
-
<
|
|
197
|
+
<Box
|
|
198
|
+
lx={{
|
|
199
|
+
width: 'full',
|
|
200
|
+
flexDirection: 'column',
|
|
201
|
+
alignItems: 'stretch',
|
|
202
|
+
padding: 's8',
|
|
203
|
+
}}
|
|
204
|
+
>
|
|
149
205
|
{/* Search bar */}
|
|
150
|
-
<
|
|
151
|
-
<
|
|
206
|
+
<Box lx={{ marginBottom: 's32' }}>
|
|
207
|
+
<Box lx={{ marginBottom: 's8', maxWidth: 's320' }}>
|
|
152
208
|
<Search
|
|
153
209
|
placeholder='Search icons...'
|
|
154
210
|
value={searchTerm}
|
|
155
211
|
onChangeText={setSearchTerm}
|
|
156
212
|
/>
|
|
157
|
-
</
|
|
213
|
+
</Box>
|
|
158
214
|
|
|
159
215
|
{/* Results count */}
|
|
160
|
-
<
|
|
161
|
-
<
|
|
216
|
+
<Box lx={{ marginBottom: 's4' }}>
|
|
217
|
+
<Text typography='body3' lx={{ marginLeft: 's8', color: 'muted' }}>
|
|
162
218
|
{filteredIcons.length} of {Object.keys(Icons).length} icons
|
|
163
219
|
{searchTerm && ` matching "${searchTerm}"`}
|
|
164
|
-
</
|
|
165
|
-
</
|
|
166
|
-
</
|
|
220
|
+
</Text>
|
|
221
|
+
</Box>
|
|
222
|
+
</Box>
|
|
167
223
|
|
|
168
|
-
{/* Icon grid */}
|
|
169
|
-
<
|
|
224
|
+
{/* Icon grid - using flexWrap for RN compatibility */}
|
|
225
|
+
<Box lx={{ flexDirection: 'row', flexWrap: 'wrap', gap: 's8' }}>
|
|
170
226
|
{filteredIcons.map(([name]) => (
|
|
171
227
|
<IconCard key={name} name={name} />
|
|
172
228
|
))}
|
|
173
|
-
</
|
|
229
|
+
</Box>
|
|
174
230
|
|
|
175
231
|
{/* No results message */}
|
|
176
232
|
{filteredIcons.length === 0 && searchTerm && (
|
|
177
|
-
<
|
|
178
|
-
|
|
233
|
+
<Box
|
|
234
|
+
lx={{
|
|
235
|
+
flexDirection: 'column',
|
|
236
|
+
alignItems: 'center',
|
|
237
|
+
justifyContent: 'center',
|
|
238
|
+
paddingVertical: 's16',
|
|
239
|
+
}}
|
|
240
|
+
>
|
|
241
|
+
<Text typography='body2' lx={{ color: 'muted' }}>
|
|
179
242
|
No icons found matching "{searchTerm}"
|
|
180
|
-
</
|
|
181
|
-
<
|
|
182
|
-
|
|
183
|
-
|
|
243
|
+
</Text>
|
|
244
|
+
<Pressable
|
|
245
|
+
onPress={() => setSearchTerm('')}
|
|
246
|
+
style={({ pressed }) => ({
|
|
247
|
+
marginTop: 16,
|
|
248
|
+
color: pressed
|
|
249
|
+
? theme.colors.text.interactivePressed
|
|
250
|
+
: theme.colors.text.interactive,
|
|
251
|
+
})}
|
|
184
252
|
>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
253
|
+
<Text typography='body2' lx={{ color: 'interactive' }}>
|
|
254
|
+
Clear search
|
|
255
|
+
</Text>
|
|
256
|
+
</Pressable>
|
|
257
|
+
</Box>
|
|
188
258
|
)}
|
|
189
|
-
</
|
|
259
|
+
</Box>
|
|
190
260
|
);
|
|
191
261
|
},
|
|
192
262
|
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { describe, it, expect } from '@jest/globals';
|
|
2
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
|
+
import { render, screen } from '@testing-library/react-native';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Path } from 'react-native-svg';
|
|
6
|
+
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
7
|
+
import { Icon } from './Icon';
|
|
8
|
+
import type { IconSize } from './types';
|
|
9
|
+
|
|
10
|
+
const { icon: iconTokens } = ledgerLiveThemes.dark;
|
|
11
|
+
|
|
12
|
+
const renderWithProvider = (component: React.ReactElement) => {
|
|
13
|
+
return render(
|
|
14
|
+
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
15
|
+
{component}
|
|
16
|
+
</ThemeProvider>,
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe('Icon', () => {
|
|
21
|
+
it('should render children with default props', () => {
|
|
22
|
+
renderWithProvider(
|
|
23
|
+
<Icon viewBox='0 0 24 24' testID='icon'>
|
|
24
|
+
<Path d='M12 2L2 7l10 5 10-5-10-5z' testID='path' />
|
|
25
|
+
</Icon>,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const svg = screen.getByTestId('icon');
|
|
29
|
+
expect(screen.getByTestId('path')).toBeTruthy();
|
|
30
|
+
expect(svg.props.fill).toBe('none');
|
|
31
|
+
expect(svg.props.pointerEvents).toBe('none');
|
|
32
|
+
expect(svg.props.width).toBe(iconTokens.width.s24);
|
|
33
|
+
expect(svg.props.height).toBe(iconTokens.height.s24);
|
|
34
|
+
expect(svg.props.strokeWidth).toBe(iconTokens.borderWidth.s24);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it.each([12, 16, 20, 24, 40, 48, 56] as IconSize[])(
|
|
38
|
+
'should apply correct dimensions for size %i',
|
|
39
|
+
(size) => {
|
|
40
|
+
renderWithProvider(
|
|
41
|
+
<Icon viewBox='0 0 24 24' size={size} testID='icon'>
|
|
42
|
+
<Path d='M12 2L2 7l10 5 10-5-10-5z' />
|
|
43
|
+
</Icon>,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const sizeKey = `s${size}` as `s${typeof size}`;
|
|
47
|
+
const svg = screen.getByTestId('icon');
|
|
48
|
+
|
|
49
|
+
expect(svg.props.width).toBe(iconTokens.width[sizeKey]);
|
|
50
|
+
expect(svg.props.height).toBe(iconTokens.height[sizeKey]);
|
|
51
|
+
expect(svg.props.strokeWidth).toBe(iconTokens.borderWidth[sizeKey]);
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
it('should apply color from style prop', () => {
|
|
56
|
+
renderWithProvider(
|
|
57
|
+
<Icon viewBox='0 0 24 24' testID='icon' style={{ color: '#ff0000' }}>
|
|
58
|
+
<Path d='M12 2L2 7l10 5 10-5-10-5z' />
|
|
59
|
+
</Icon>,
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
expect(screen.getByTestId('icon').props.color).toBe('#ff0000');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should forward ref and spread additional props', () => {
|
|
66
|
+
const ref = { current: null };
|
|
67
|
+
renderWithProvider(
|
|
68
|
+
<Icon
|
|
69
|
+
viewBox='0 0 24 24'
|
|
70
|
+
ref={ref}
|
|
71
|
+
testID='icon'
|
|
72
|
+
accessibilityLabel='Test icon'
|
|
73
|
+
fill='currentColor'
|
|
74
|
+
>
|
|
75
|
+
<Path d='M12 2L2 7l10 5 10-5-10-5z' />
|
|
76
|
+
</Icon>,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const svg = screen.getByTestId('icon');
|
|
80
|
+
expect(ref.current).not.toBeNull();
|
|
81
|
+
expect(svg.props.accessibilityLabel).toBe('Test icon');
|
|
82
|
+
expect(svg.props.fill).toBe('currentColor');
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -1,40 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { forwardRef } from 'react';
|
|
1
|
+
import { forwardRef, useMemo } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
4
3
|
import { Svg } from 'react-native-svg';
|
|
5
|
-
import {
|
|
6
|
-
import { IconProps } from './
|
|
4
|
+
import { LumenStyleSheet } from '../../../styles';
|
|
5
|
+
import { IconProps, IconSize } from './types';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const iconSizeMap = {
|
|
8
|
+
12: 's12',
|
|
9
|
+
16: 's16',
|
|
10
|
+
20: 's20',
|
|
11
|
+
24: 's24',
|
|
12
|
+
40: 's40',
|
|
13
|
+
48: 's48',
|
|
14
|
+
56: 's56',
|
|
15
|
+
} as const;
|
|
11
16
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
defaultVariants: {
|
|
25
|
-
size: 24,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
17
|
+
const useStyles = (size: IconSize) => {
|
|
18
|
+
const { theme } = LumenStyleSheet.useTheme();
|
|
19
|
+
return useMemo(
|
|
20
|
+
() => ({
|
|
21
|
+
width: theme.icon.width[iconSizeMap[size]],
|
|
22
|
+
height: theme.icon.height[iconSizeMap[size]],
|
|
23
|
+
strokeWidth: theme.icon.borderWidth[iconSizeMap[size]],
|
|
24
|
+
}),
|
|
25
|
+
[size, theme],
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
28
|
|
|
29
29
|
export const Icon = forwardRef<Svg, IconProps>(
|
|
30
|
-
({ size = 24,
|
|
30
|
+
({ size = 24, style, children, viewBox, ...props }, ref) => {
|
|
31
|
+
const styles = useStyles(size);
|
|
32
|
+
const flatStyle = StyleSheet.flatten(style);
|
|
33
|
+
|
|
31
34
|
return (
|
|
32
35
|
<Svg
|
|
33
36
|
ref={ref}
|
|
34
|
-
width={
|
|
35
|
-
height={
|
|
36
|
-
|
|
37
|
+
width={styles.width}
|
|
38
|
+
height={styles.height}
|
|
39
|
+
strokeWidth={styles.strokeWidth}
|
|
37
40
|
viewBox={viewBox}
|
|
41
|
+
color={flatStyle?.color ?? 'currentColor'}
|
|
38
42
|
fill='none'
|
|
39
43
|
pointerEvents='none'
|
|
40
44
|
{...props}
|
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import { Svg, SvgProps } from 'react-native-svg';
|
|
3
3
|
import { toPascalCase } from '../../utils';
|
|
4
4
|
import { Icon } from './Icon';
|
|
5
|
-
import { IconProps } from './
|
|
5
|
+
import { IconProps } from './types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Create an Icon component for React Native
|
|
@@ -15,10 +15,9 @@ const createIcon = (
|
|
|
15
15
|
iconJsx: React.ReactElement<SvgProps>,
|
|
16
16
|
) => {
|
|
17
17
|
const Component = forwardRef<Svg, Omit<IconProps, 'children'>>(
|
|
18
|
-
({
|
|
18
|
+
({ ...props }, ref) =>
|
|
19
19
|
React.createElement(Icon, {
|
|
20
20
|
ref,
|
|
21
|
-
className,
|
|
22
21
|
viewBox: iconJsx.props.viewBox,
|
|
23
22
|
...props,
|
|
24
23
|
children: iconJsx.props.children,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Icon';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './types';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
1
2
|
import { SvgProps } from 'react-native-svg';
|
|
2
3
|
|
|
3
4
|
export type IconSize = 12 | 16 | 20 | 24 | 40 | 48 | 56;
|
|
@@ -8,11 +9,11 @@ export type IconProps = {
|
|
|
8
9
|
*/
|
|
9
10
|
size?: IconSize;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Style object to apply to the icon (supports color via color property).
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
style?: StyleProp<ViewStyle & { color?: string }>;
|
|
14
15
|
/**
|
|
15
16
|
* The children of the icon.
|
|
16
17
|
*/
|
|
17
18
|
children: React.ReactNode;
|
|
18
|
-
} & SvgProps
|
|
19
|
+
} & Omit<SvgProps, 'style'>;
|
|
@@ -4,6 +4,7 @@ import { IconButton } from './IconButton';
|
|
|
4
4
|
import { CustomTabs, Tab } from '../../../../.storybook/components';
|
|
5
5
|
import { DoVsDontRow, DoBlockItem, DontBlockItem } from '../../../../.storybook/components/DoVsDont';
|
|
6
6
|
import CommonRulesDoAndDont from '../../../../.storybook/docs/CommonRulesDoAndDont.mdx';
|
|
7
|
+
import { Box } from '../Utility';
|
|
7
8
|
|
|
8
9
|
<Meta title='Action/IconButton' of={IconButtonStories} />
|
|
9
10
|
|
|
@@ -40,10 +41,12 @@ IconButton supports the same appearances as the standard Button:
|
|
|
40
41
|
|
|
41
42
|
IconButtons come in four different sizes:
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
44
|
+
|
|
45
|
+
- `xs` (**32px**)
|
|
46
|
+
- `sm` (**40px**)
|
|
47
|
+
- `md` (**48px**, default)
|
|
48
|
+
- `lg` (**56px**)
|
|
49
|
+
|
|
47
50
|
|
|
48
51
|
<Canvas of={IconButtonStories.SizesShowcase} />
|
|
49
52
|
|
|
@@ -78,10 +81,10 @@ function MyComponent() {
|
|
|
78
81
|
|
|
79
82
|
### Custom Styling
|
|
80
83
|
|
|
81
|
-
While the component comes with predefined styles, you can extend them using
|
|
84
|
+
While the component comes with predefined styles, you can extend them using the `lx` prop for token-based styling:
|
|
82
85
|
|
|
83
86
|
```tsx
|
|
84
|
-
<IconButton accessibilityLabel='Close' icon={Close}
|
|
87
|
+
<IconButton accessibilityLabel='Close' icon={Close} lx={{ marginTop: 's4' }} />
|
|
85
88
|
```
|
|
86
89
|
|
|
87
90
|
### Full Width
|
|
@@ -134,7 +137,7 @@ The Button component is built on React Native's `Pressable` and accepts all its
|
|
|
134
137
|
|
|
135
138
|
## Do's and Don'ts
|
|
136
139
|
|
|
137
|
-
<
|
|
140
|
+
<Box lx={{ flexDirection: 'column', gap: 's24' }}>
|
|
138
141
|
<DoVsDontRow>
|
|
139
142
|
<DoBlockItem
|
|
140
143
|
title='Use icon prop for consistent sizing'
|
|
@@ -151,14 +154,14 @@ import { Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
|
151
154
|
</DoBlockItem>
|
|
152
155
|
<DontBlockItem
|
|
153
156
|
title="Don't modify icon size directly"
|
|
154
|
-
description='Avoid passing icon size prop or overriding dimensions through
|
|
157
|
+
description='Avoid passing icon size prop or overriding dimensions through lx'
|
|
155
158
|
>
|
|
156
159
|
|
|
157
160
|
{/* prettier-ignore */}
|
|
158
161
|
```tsx
|
|
159
162
|
import { Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
160
163
|
|
|
161
|
-
<IconButton accessibilityLabel='Settings' icon={Settings}
|
|
164
|
+
<IconButton accessibilityLabel='Settings' icon={Settings} lx={{ width: 's32', height: 's32' }} />
|
|
162
165
|
```
|
|
163
166
|
|
|
164
167
|
</DontBlockItem>
|
|
@@ -196,7 +199,7 @@ import { Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
|
196
199
|
</DoVsDontRow>
|
|
197
200
|
|
|
198
201
|
<CommonRulesDoAndDont />
|
|
199
|
-
</
|
|
202
|
+
</Box>
|
|
200
203
|
|
|
201
204
|
</Tab>
|
|
202
205
|
</CustomTabs>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
2
|
import { Close, Heart, Plus, Settings, Share } from '../../Symbols';
|
|
3
|
+
import { Box } from '../Utility';
|
|
3
4
|
import { IconButton } from './IconButton';
|
|
4
5
|
|
|
5
6
|
const iconMap = {
|
|
@@ -13,9 +14,6 @@ const iconMap = {
|
|
|
13
14
|
const meta: Meta<typeof IconButton> = {
|
|
14
15
|
title: 'Action/IconButton',
|
|
15
16
|
component: IconButton,
|
|
16
|
-
parameters: {
|
|
17
|
-
layout: 'centered',
|
|
18
|
-
},
|
|
19
17
|
argTypes: {
|
|
20
18
|
icon: {
|
|
21
19
|
options: Object.keys(iconMap),
|
|
@@ -23,11 +21,11 @@ const meta: Meta<typeof IconButton> = {
|
|
|
23
21
|
control: {
|
|
24
22
|
type: 'select',
|
|
25
23
|
labels: {
|
|
26
|
-
Heart: '
|
|
27
|
-
Plus: '
|
|
28
|
-
Settings: '
|
|
29
|
-
Share: '
|
|
30
|
-
Close: '
|
|
24
|
+
Heart: 'Heart',
|
|
25
|
+
Plus: 'Plus',
|
|
26
|
+
Settings: 'Settings',
|
|
27
|
+
Share: 'Share',
|
|
28
|
+
Close: 'Close',
|
|
31
29
|
},
|
|
32
30
|
},
|
|
33
31
|
},
|
|
@@ -70,7 +68,7 @@ export const Base: Story = {
|
|
|
70
68
|
|
|
71
69
|
export const AppearanceShowcase: Story = {
|
|
72
70
|
render: () => (
|
|
73
|
-
<
|
|
71
|
+
<Box lx={{ flexDirection: 'row', gap: 's8' }}>
|
|
74
72
|
<IconButton accessibilityLabel='Add' icon={Plus} appearance='accent' />
|
|
75
73
|
<IconButton accessibilityLabel='Add' icon={Plus} appearance='base' />
|
|
76
74
|
<IconButton accessibilityLabel='Add' icon={Plus} appearance='gray' />
|
|
@@ -85,13 +83,13 @@ export const AppearanceShowcase: Story = {
|
|
|
85
83
|
appearance='no-background'
|
|
86
84
|
/>
|
|
87
85
|
<IconButton accessibilityLabel='Add' icon={Plus} appearance='red' />
|
|
88
|
-
</
|
|
86
|
+
</Box>
|
|
89
87
|
),
|
|
90
88
|
};
|
|
91
89
|
|
|
92
90
|
export const SizesShowcase: Story = {
|
|
93
91
|
render: () => (
|
|
94
|
-
<
|
|
92
|
+
<Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's8' }}>
|
|
95
93
|
<IconButton
|
|
96
94
|
accessibilityLabel='Add to favorites'
|
|
97
95
|
icon={Heart}
|
|
@@ -112,7 +110,7 @@ export const SizesShowcase: Story = {
|
|
|
112
110
|
icon={Heart}
|
|
113
111
|
size='lg'
|
|
114
112
|
/>
|
|
115
|
-
</
|
|
113
|
+
</Box>
|
|
116
114
|
),
|
|
117
115
|
};
|
|
118
116
|
|
|
@@ -121,7 +119,7 @@ export const StatesShowcase: Story = {
|
|
|
121
119
|
appearance: 'base',
|
|
122
120
|
},
|
|
123
121
|
render: ({ appearance }) => (
|
|
124
|
-
<
|
|
122
|
+
<Box lx={{ flexDirection: 'row', alignItems: 'flex-start', gap: 's8' }}>
|
|
125
123
|
<IconButton
|
|
126
124
|
accessibilityLabel='Settings'
|
|
127
125
|
appearance={appearance}
|
|
@@ -134,6 +132,6 @@ export const StatesShowcase: Story = {
|
|
|
134
132
|
icon={Settings}
|
|
135
133
|
loading
|
|
136
134
|
/>
|
|
137
|
-
</
|
|
135
|
+
</Box>
|
|
138
136
|
),
|
|
139
137
|
};
|