@ledgerhq/lumen-ui-rnative 0.0.44 → 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.js +2 -2
- 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 +2 -2
- 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
package/.storybook/Decorator.tsx
CHANGED
|
@@ -3,12 +3,52 @@ import {
|
|
|
3
3
|
ledgerLiveThemes,
|
|
4
4
|
websitesThemes,
|
|
5
5
|
} from '@ledgerhq/lumen-design-core';
|
|
6
|
+
import {
|
|
7
|
+
DocsContainer,
|
|
8
|
+
DocsContainerProps,
|
|
9
|
+
} from '@storybook/addon-docs/blocks';
|
|
6
10
|
import type { Decorator } from '@storybook/react-native-web-vite';
|
|
11
|
+
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
7
12
|
|
|
8
13
|
import { ColorSchemeName } from 'react-native';
|
|
9
14
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
10
15
|
import { ThemeProvider } from '../src/lib/Components';
|
|
11
16
|
|
|
17
|
+
type BrandThemes = typeof ledgerLiveThemes;
|
|
18
|
+
|
|
19
|
+
const mappingThemes: Record<string, BrandThemes> = {
|
|
20
|
+
'ledger-live': ledgerLiveThemes,
|
|
21
|
+
enterprise: enterpriseThemes as unknown as BrandThemes,
|
|
22
|
+
websites: websitesThemes as unknown as BrandThemes,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getThemeFromGlobals = (
|
|
26
|
+
mode?: ColorSchemeName | string,
|
|
27
|
+
brand?: string,
|
|
28
|
+
): { mode: ColorSchemeName; theme: BrandThemes } => ({
|
|
29
|
+
mode: (mode as ColorSchemeName) ?? 'light',
|
|
30
|
+
theme: mappingThemes[brand ?? 'ledger-live'] ?? mappingThemes['ledger-live'],
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
type StorybookProvidersProps = PropsWithChildren<{
|
|
34
|
+
mode: ColorSchemeName;
|
|
35
|
+
theme: BrandThemes;
|
|
36
|
+
}>;
|
|
37
|
+
|
|
38
|
+
const StorybookProviders: FC<StorybookProvidersProps> = ({
|
|
39
|
+
mode,
|
|
40
|
+
theme,
|
|
41
|
+
children,
|
|
42
|
+
}) => (
|
|
43
|
+
<ThemeProvider colorScheme={mode} themes={theme}>
|
|
44
|
+
<GestureHandlerRootView
|
|
45
|
+
style={{ flex: 1, width: '100%', alignItems: 'flex-start' }}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</GestureHandlerRootView>
|
|
49
|
+
</ThemeProvider>
|
|
50
|
+
);
|
|
51
|
+
|
|
12
52
|
const createThemeDecorator = (
|
|
13
53
|
globalName: string,
|
|
14
54
|
themeClasses: string[],
|
|
@@ -38,21 +78,46 @@ export const withModeDecorator = createThemeDecorator('mode', [
|
|
|
38
78
|
'dark',
|
|
39
79
|
]);
|
|
40
80
|
|
|
41
|
-
const mappingThemes = {
|
|
42
|
-
'ledger-live': ledgerLiveThemes,
|
|
43
|
-
enterprise: enterpriseThemes,
|
|
44
|
-
websites: websitesThemes,
|
|
45
|
-
} as any;
|
|
46
|
-
|
|
47
81
|
export const withProvidersDecorator: Decorator = (Story, context) => {
|
|
48
|
-
const mode
|
|
49
|
-
|
|
82
|
+
const { mode, theme } = getThemeFromGlobals(
|
|
83
|
+
context.globals.mode,
|
|
84
|
+
context.globals.brand,
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<StorybookProviders mode={mode} theme={theme}>
|
|
89
|
+
<Story />
|
|
90
|
+
</StorybookProviders>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
type DocsContainerContext = {
|
|
95
|
+
store: {
|
|
96
|
+
globals: {
|
|
97
|
+
globals: {
|
|
98
|
+
mode?: ColorSchemeName;
|
|
99
|
+
brand?: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const withProvidersDocsContainer = ({
|
|
106
|
+
children,
|
|
107
|
+
context,
|
|
108
|
+
...rest
|
|
109
|
+
}: PropsWithChildren<DocsContainerProps>): ReactNode => {
|
|
110
|
+
const docsContext = context as unknown as DocsContainerContext;
|
|
111
|
+
const { mode, theme } = getThemeFromGlobals(
|
|
112
|
+
docsContext.store?.globals?.globals?.mode,
|
|
113
|
+
docsContext.store?.globals?.globals?.brand,
|
|
114
|
+
);
|
|
50
115
|
|
|
51
116
|
return (
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
</
|
|
56
|
-
</
|
|
117
|
+
<DocsContainer context={context} {...rest}>
|
|
118
|
+
<StorybookProviders mode={mode} theme={theme}>
|
|
119
|
+
{children}
|
|
120
|
+
</StorybookProviders>
|
|
121
|
+
</DocsContainer>
|
|
57
122
|
);
|
|
58
123
|
};
|
|
@@ -47,7 +47,7 @@ If not provided, the theme will follow the device settings.
|
|
|
47
47
|
|
|
48
48
|
## Changing Theme Mode
|
|
49
49
|
|
|
50
|
-
If the ThemeProvider is uncontrolled, you can use the `LumenStyleSheet.useTheme` hook to control theme mode at runtime:
|
|
50
|
+
If the ThemeProvider is uncontrolled, you can use the [`LumenStyleSheet.useTheme`](/?path=/docs/style-system-usetheme--docs) hook to control theme mode at runtime:
|
|
51
51
|
|
|
52
52
|
```tsx
|
|
53
53
|
import { LumenStyleSheet } from '@ledgerhq/lumen-ui-rnative/styles';
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Style System/lx" />
|
|
4
|
+
|
|
5
|
+
# lx Property
|
|
6
|
+
|
|
7
|
+
The `lx` prop is a type-safe styling API that provides autocomplete for design tokens directly on components.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Instead of writing raw style values, `lx` constrains you to design system tokens, ensuring consistency across your app.
|
|
12
|
+
|
|
13
|
+
The `lx` prop is available on utility components that already integrate it:
|
|
14
|
+
- [**Box**](/?path=/docs/utility-box--docs) - Layout container (wraps `View`)
|
|
15
|
+
- [**Text**](/?path=/docs/utility-text--docs) - Typography (wraps `Text`)
|
|
16
|
+
- [**Pressable**](/?path=/docs/utility-pressable--docs) - Interactive container (wraps `Pressable`)
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { Box, Text } from '@ledgerhq/lumen-ui-rnative';
|
|
20
|
+
|
|
21
|
+
<Box lx={{ padding: 's16', backgroundColor: 'accent', borderRadius: 'md' }}>
|
|
22
|
+
<Text typography='body1' lx={{ color: 'onAccent' }}>Hello</Text>
|
|
23
|
+
</Box>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## View Style Tokens
|
|
29
|
+
|
|
30
|
+
These tokens are available on `Box` and `Pressable` (and the `lx` prop of `Text` for layout).
|
|
31
|
+
|
|
32
|
+
### Spacing
|
|
33
|
+
|
|
34
|
+
Used for `padding`, `margin`, `gap`, and positioning (`top`, `left`, etc.):
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
<Box lx={{
|
|
38
|
+
padding: 's16',
|
|
39
|
+
marginTop: 's8',
|
|
40
|
+
gap: 's12',
|
|
41
|
+
paddingHorizontal: 's24',
|
|
42
|
+
}} />
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Sizes
|
|
46
|
+
|
|
47
|
+
Used for `width`, `height`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`:
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Box lx={{ width: 's48', height: 's48', maxWidth: 's320' }} />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Background Colors
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
<Box lx={{ backgroundColor: 'accent' }} />
|
|
57
|
+
<Box lx={{ backgroundColor: 'surface' }} />
|
|
58
|
+
<Box lx={{ backgroundColor: 'muted' }} />
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Border
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<Box lx={{
|
|
65
|
+
borderRadius: 'md',
|
|
66
|
+
borderWidth: 's1',
|
|
67
|
+
borderColor: 'base',
|
|
68
|
+
}} />
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Flex Layout
|
|
72
|
+
|
|
73
|
+
Standard React Native flex properties are passed through:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<Box lx={{
|
|
77
|
+
flex: 1,
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
justifyContent: 'space-between',
|
|
81
|
+
}} />
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Text Style Tokens
|
|
87
|
+
|
|
88
|
+
These tokens are **only available on the `Text` component**, in addition to view tokens.
|
|
89
|
+
|
|
90
|
+
### Text Color
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
<Text lx={{ color: 'base' }} />
|
|
94
|
+
<Text lx={{ color: 'muted' }} />
|
|
95
|
+
<Text lx={{ color: 'interactive' }} />
|
|
96
|
+
<Text lx={{ color: 'onAccent' }} />
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Typography
|
|
100
|
+
|
|
101
|
+
Preset font size, weight, line height, and letter spacing:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<Text typography='heading1' />
|
|
105
|
+
<Text typography='body1' />
|
|
106
|
+
<Text typography='body2SemiBold' />
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Text Decoration
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<Text lx={{ textDecorationLine: 'underline' }} />
|
|
113
|
+
<Text lx={{ textAlign: 'center' }} />
|
|
114
|
+
<Text lx={{ textTransform: 'uppercase' }} />
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Escape Hatch
|
|
120
|
+
|
|
121
|
+
For values not covered by tokens, use the `style` prop:
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
<Box
|
|
125
|
+
lx={{ padding: 's16', borderRadius: 'md' }}
|
|
126
|
+
style={{ width: 127, shadowOpacity: 0.1 }}
|
|
127
|
+
/>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Pressable and Pressed State
|
|
131
|
+
|
|
132
|
+
For `Pressable`, the `lx` prop only accepts static objects. Use the `style` prop for pressed-state styling:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
<Pressable
|
|
136
|
+
lx={{ padding: 's16', backgroundColor: 'accent' }}
|
|
137
|
+
style={({ pressed }) => ({ opacity: pressed ? 0.8 : 1 })}
|
|
138
|
+
>
|
|
139
|
+
<Text>Press me</Text>
|
|
140
|
+
</Pressable>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
See [Pressable documentation](/?path=/docs/utility-pressable--docs) for more details.
|
|
144
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Style System/useCreate" />
|
|
4
|
+
|
|
5
|
+
# useCreate
|
|
6
|
+
|
|
7
|
+
`LumenStyleSheet.useCreate` is a hook for creating memoized, theme-aware stylesheets in React Native.
|
|
8
|
+
|
|
9
|
+
## Basic Usage
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { LumenStyleSheet } from '@ledgerhq/lumen-ui-rnative/styles';
|
|
13
|
+
import { View, Text } from 'react-native';
|
|
14
|
+
|
|
15
|
+
const MyComponent = () => {
|
|
16
|
+
const styles = LumenStyleSheet.useCreate((theme) => ({
|
|
17
|
+
container: {
|
|
18
|
+
backgroundColor: theme.colors.bg.base,
|
|
19
|
+
padding: theme.spacings.s16,
|
|
20
|
+
borderRadius: theme.borderRadius.md,
|
|
21
|
+
},
|
|
22
|
+
text: {
|
|
23
|
+
...theme.typographies.body1,
|
|
24
|
+
color: theme.colors.text.base,
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View style={styles.container}>
|
|
30
|
+
<Text style={styles.text}>Hello World</Text>
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Memoization
|
|
37
|
+
|
|
38
|
+
Styles are memoized based on the dependency array (second argument). Re-renders only create new styles when dependencies change:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
const styles = LumenStyleSheet.useCreate(
|
|
42
|
+
(theme) => ({
|
|
43
|
+
container: {
|
|
44
|
+
backgroundColor: isActive ? theme.colors.bg.accent : theme.colors.bg.base,
|
|
45
|
+
padding: theme.spacings.s16,
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
[isActive] // Only recreate when isActive changes
|
|
49
|
+
);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Pressed State Pattern
|
|
53
|
+
|
|
54
|
+
For Pressable components, pass `pressed` state to `useCreate`:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import { LumenStyleSheet } from '@ledgerhq/lumen-ui-rnative/styles';
|
|
58
|
+
import { Pressable } from '@ledgerhq/lumen-ui-rnative';
|
|
59
|
+
|
|
60
|
+
const InteractiveCard = () => {
|
|
61
|
+
return (
|
|
62
|
+
<Pressable lx={{ borderRadius: 'md' }}>
|
|
63
|
+
{({ pressed }) => <CardContent pressed={pressed} />}
|
|
64
|
+
</Pressable>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const CardContent = ({ pressed }: { pressed: boolean }) => {
|
|
69
|
+
const styles = LumenStyleSheet.useCreate(
|
|
70
|
+
(theme) => ({
|
|
71
|
+
container: {
|
|
72
|
+
backgroundColor: pressed
|
|
73
|
+
? theme.colors.bg.accentPressed
|
|
74
|
+
: theme.colors.bg.accent,
|
|
75
|
+
padding: theme.spacings.s16,
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
[pressed]
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
return <View style={styles.container}>...</View>;
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## When to Use
|
|
86
|
+
|
|
87
|
+
Use `useCreate` when you need:
|
|
88
|
+
|
|
89
|
+
- Complex conditional styling based on props/state
|
|
90
|
+
- Access to raw theme values for calculations
|
|
91
|
+
- Building custom components with multiple style objects
|
|
92
|
+
- Performance-critical components with memoized styles
|
|
93
|
+
|
|
94
|
+
For simpler cases, prefer the [lx prop](/?path=/docs/style-system-lx--docs) directly on components.
|
|
95
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Style System/useTheme" />
|
|
4
|
+
|
|
5
|
+
# useTheme
|
|
6
|
+
|
|
7
|
+
The `useTheme` hook provides access to the current theme and color scheme controls.
|
|
8
|
+
|
|
9
|
+
## Basic Usage
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { LumenStyleSheet } from '@ledgerhq/lumen-ui-rnative/styles';
|
|
13
|
+
|
|
14
|
+
const MyComponent = () => {
|
|
15
|
+
const { theme, colorScheme } = LumenStyleSheet.useTheme();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<View style={{ backgroundColor: theme.colors.bg.base }}>
|
|
19
|
+
<Text style={{ color: theme.colors.text.base }}>
|
|
20
|
+
Current mode: {colorScheme}
|
|
21
|
+
</Text>
|
|
22
|
+
</View>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Theme Toggle Example
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { LumenStyleSheet } from '@ledgerhq/lumen-ui-rnative/styles';
|
|
31
|
+
|
|
32
|
+
const ThemeToggle = () => {
|
|
33
|
+
const { colorScheme, toggleColorScheme } = LumenStyleSheet.useTheme();
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Button onPress={toggleColorScheme}>
|
|
37
|
+
Current: {colorScheme}
|
|
38
|
+
</Button>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## When to Use
|
|
44
|
+
|
|
45
|
+
Use `useTheme` when you need to:
|
|
46
|
+
|
|
47
|
+
- Access raw theme values for calculations
|
|
48
|
+
- Control the color scheme programmatically
|
|
49
|
+
- Access tokens not available through `lx`
|
|
50
|
+
|
|
51
|
+
For most styling needs, prefer [useCreate](/?path=/docs/style-system-usecreate--docs) or the [lx prop](/?path=/docs/style-system-lx--docs).
|
|
52
|
+
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
withBrandDecorator,
|
|
5
5
|
withModeDecorator,
|
|
6
6
|
withProvidersDecorator,
|
|
7
|
+
withProvidersDocsContainer,
|
|
7
8
|
} from './Decorator';
|
|
8
9
|
import './font.css';
|
|
9
10
|
|
|
@@ -50,13 +51,14 @@ const preview: Preview = {
|
|
|
50
51
|
order: [
|
|
51
52
|
'Getting Started',
|
|
52
53
|
['Introduction', 'Quick Start'],
|
|
54
|
+
'Style System',
|
|
55
|
+
['lx', 'useCreate', 'useTheme'],
|
|
53
56
|
'Tailwind',
|
|
54
57
|
['Introduction', 'Setup guide', 'Configuration'],
|
|
55
58
|
'Foundations',
|
|
56
59
|
['Docs', 'Colors', 'Border', 'Spacing', 'Size', 'Height', 'Width'],
|
|
57
60
|
'Symbols',
|
|
58
61
|
'Action',
|
|
59
|
-
['CardButton', 'InteractiveIcon', 'Link', 'Input', 'Search'],
|
|
60
62
|
'Communication',
|
|
61
63
|
'Containment',
|
|
62
64
|
'Selection',
|
|
@@ -65,6 +67,9 @@ const preview: Preview = {
|
|
|
65
67
|
},
|
|
66
68
|
},
|
|
67
69
|
tags: ['autodocs'],
|
|
70
|
+
docs: {
|
|
71
|
+
container: withProvidersDocsContainer,
|
|
72
|
+
},
|
|
68
73
|
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
69
74
|
controls: {
|
|
70
75
|
matchers: {
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-rnative",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
"import": "./src/lib/Symbols/index.ts",
|
|
26
26
|
"default": "./src/lib/Symbols/index.ts"
|
|
27
27
|
},
|
|
28
|
-
"./styles": "./src/styles/index.ts"
|
|
29
|
-
"./ToRemove": "./src/lib/Components/_ToRemove/ToRemove.tsx"
|
|
28
|
+
"./styles": "./src/styles/index.ts"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
32
31
|
"@ledgerhq/lumen-utils-shared": "0.0.11",
|
|
@@ -11,7 +11,7 @@ export const AddressInput = React.forwardRef(({ prefix = 'To:', suffix, onQrCode
|
|
|
11
11
|
// TODO: use theme object here
|
|
12
12
|
style: { fontSize: 16, fontWeight: '500' }, children: prefix }));
|
|
13
13
|
const actualSuffix = suffix ||
|
|
14
|
-
(onQrCodeClick && (_jsx(InteractiveIcon, { iconType: '
|
|
14
|
+
(onQrCodeClick && (_jsx(InteractiveIcon, { iconType: 'stroked', onPress: onQrCodeClick, accessibilityLabel: t('components.addressInput.qrCodeAriaLabel'), children: _jsx(QrCode, { size: 20 }) })));
|
|
15
15
|
return (_jsx(BaseInput, { ref: ref, prefix: actualPrefix, suffix: actualSuffix,
|
|
16
16
|
// TODO: use theme object here
|
|
17
17
|
style: { fontSize: 16, fontWeight: '500' }, ...props }));
|
|
@@ -3,5 +3,11 @@ import { AddressInput } from './AddressInput';
|
|
|
3
3
|
declare const meta: Meta<typeof AddressInput>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof AddressInput>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const Base: Story;
|
|
7
|
+
export declare const WithContent: Story;
|
|
8
|
+
export declare const WithCustomPrefix: Story;
|
|
9
|
+
export declare const WithoutQrCode: Story;
|
|
10
|
+
export declare const WithError: Story;
|
|
11
|
+
export declare const DisabledAddressInput: Story;
|
|
12
|
+
export declare const WithHiddenClearButton: Story;
|
|
7
13
|
//# sourceMappingURL=AddressInput.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressInput.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/AddressInput/AddressInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"AddressInput.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/AddressInput/AddressInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AAEtE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAkCnC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;AAqB3C,eAAO,MAAM,IAAI,EAAE,KAQlB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KASzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAQ9B,CAAC;AAmBF,eAAO,MAAM,aAAa,EAAE,KAQ3B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAUvB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KASlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KASnC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
3
4
|
import { AddressInput } from './AddressInput';
|
|
4
5
|
const meta = {
|
|
5
6
|
component: AddressInput,
|
|
@@ -13,15 +14,103 @@ const meta = {
|
|
|
13
14
|
},
|
|
14
15
|
},
|
|
15
16
|
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
placeholder: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Placeholder text when input is empty',
|
|
21
|
+
},
|
|
22
|
+
prefix: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'Custom prefix text (default: "To:")',
|
|
25
|
+
},
|
|
26
|
+
errorMessage: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
description: 'Error message to display below input',
|
|
29
|
+
},
|
|
30
|
+
editable: {
|
|
31
|
+
control: 'boolean',
|
|
32
|
+
description: 'Whether the input is editable',
|
|
33
|
+
},
|
|
34
|
+
hideClearButton: {
|
|
35
|
+
control: 'boolean',
|
|
36
|
+
description: 'Hide the clear button',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
16
39
|
};
|
|
17
40
|
export default meta;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
41
|
+
const AddressInputStory = (args) => {
|
|
42
|
+
const [address, setAddress] = useState(args.value?.toString() ?? '');
|
|
43
|
+
return (_jsx(View, { className: 'flex min-h-400 items-center justify-center p-24', children: _jsx(View, { className: 'w-full max-w-320', children: _jsx(AddressInput, { ...args, value: address, onChangeText: setAddress, onQrCodeClick: args.onQrCodeClick ?? (() => alert('QR code scanner opened')) }) }) }));
|
|
44
|
+
};
|
|
45
|
+
export const Base = {
|
|
46
|
+
render: (args) => _jsx(AddressInputStory, { ...args }),
|
|
47
|
+
args: {
|
|
48
|
+
placeholder: 'Enter address or ENS',
|
|
49
|
+
prefix: 'To:',
|
|
50
|
+
editable: true,
|
|
51
|
+
hideClearButton: false,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export const WithContent = {
|
|
55
|
+
render: (args) => _jsx(AddressInputStory, { ...args }),
|
|
56
|
+
args: {
|
|
57
|
+
placeholder: 'Enter address or ENS',
|
|
58
|
+
value: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb27',
|
|
59
|
+
prefix: 'To:',
|
|
60
|
+
editable: true,
|
|
61
|
+
hideClearButton: false,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export const WithCustomPrefix = {
|
|
65
|
+
render: (args) => _jsx(AddressInputStory, { ...args }),
|
|
66
|
+
args: {
|
|
67
|
+
placeholder: 'Enter sender address',
|
|
68
|
+
prefix: 'From:',
|
|
69
|
+
editable: true,
|
|
70
|
+
hideClearButton: false,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
const AddressInputWithoutQrStory = (args) => {
|
|
74
|
+
const [address, setAddress] = useState(args.value?.toString() ?? '');
|
|
75
|
+
return (_jsx(View, { className: 'flex min-h-400 items-center justify-center p-24', children: _jsx(View, { className: 'w-full max-w-320', children: _jsx(AddressInput, { ...args, value: address, onChangeText: setAddress, onQrCodeClick: undefined }) }) }));
|
|
76
|
+
};
|
|
77
|
+
export const WithoutQrCode = {
|
|
78
|
+
render: (args) => _jsx(AddressInputWithoutQrStory, { ...args }),
|
|
79
|
+
args: {
|
|
80
|
+
placeholder: 'Enter address or ENS',
|
|
81
|
+
prefix: 'To:',
|
|
82
|
+
editable: true,
|
|
83
|
+
hideClearButton: false,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
export const WithError = {
|
|
87
|
+
render: (args) => _jsx(AddressInputStory, { ...args }),
|
|
88
|
+
args: {
|
|
89
|
+
placeholder: 'Enter address or ENS',
|
|
90
|
+
value: 'invalid-address',
|
|
91
|
+
errorMessage: 'Invalid address format',
|
|
92
|
+
prefix: 'To:',
|
|
93
|
+
editable: true,
|
|
94
|
+
hideClearButton: false,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
export const DisabledAddressInput = {
|
|
98
|
+
render: (args) => _jsx(AddressInputStory, { ...args }),
|
|
99
|
+
args: {
|
|
100
|
+
placeholder: 'Enter address or ENS',
|
|
101
|
+
value: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb27',
|
|
102
|
+
prefix: 'To:',
|
|
103
|
+
editable: false,
|
|
104
|
+
hideClearButton: false,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
export const WithHiddenClearButton = {
|
|
108
|
+
render: (args) => _jsx(AddressInputStory, { ...args }),
|
|
109
|
+
args: {
|
|
110
|
+
placeholder: 'Enter address or ENS',
|
|
111
|
+
value: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb27',
|
|
112
|
+
prefix: 'To:',
|
|
113
|
+
editable: true,
|
|
114
|
+
hideClearButton: true,
|
|
26
115
|
},
|
|
27
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmountInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/AmountInput/AmountInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAa,SAAS,EAAQ,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAU/E,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,cAAc,EACd,OAAO,GAAG,cAAc,CACzB,GAAG;IACF;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAOF;;;;GAIG;AACH,eAAO,MAAM,WAAW;IA5DtB;;;OAGG;WACI,MAAM,GAAG,MAAM;IACtB;;;OAGG;kBACW,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;IACpC;;OAEG;mBACY,MAAM;IACrB;;;OAGG;uBACgB,MAAM,GAAG,OAAO;IACnC;;;OAGG;uBACgB,MAAM;IACzB;;;OAGG;uBACgB,MAAM;IACzB;;;OAGG;oBACa,OAAO;IACvB;;OAEG;gBACS,MAAM;IAClB;;;OAGG;yBACkB,OAAO;IAC5B;;;OAGG;gBACS,OAAO;
|
|
1
|
+
{"version":3,"file":"AmountInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/AmountInput/AmountInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAa,SAAS,EAAQ,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAU/E,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,cAAc,EACd,OAAO,GAAG,cAAc,CACzB,GAAG;IACF;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAOF;;;;GAIG;AACH,eAAO,MAAM,WAAW;IA5DtB;;;OAGG;WACI,MAAM,GAAG,MAAM;IACtB;;;OAGG;kBACW,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;IACpC;;OAEG;mBACY,MAAM;IACrB;;;OAGG;uBACgB,MAAM,GAAG,OAAO;IACnC;;;OAGG;uBACgB,MAAM;IACzB;;;OAGG;uBACgB,MAAM;IACzB;;;OAGG;oBACa,OAAO;IACvB;;OAEG;gBACS,MAAM;IAClB;;;OAGG;yBACkB,OAAO;IAC5B;;;OAGG;gBACS,OAAO;mCAgMpB,CAAC"}
|
|
@@ -22,15 +22,15 @@ export const AmountInput = React.forwardRef(({ className, currencyText, currency
|
|
|
22
22
|
transform: [{ translateX: translateX.value }],
|
|
23
23
|
fontSize: animatedFontSize.value,
|
|
24
24
|
letterSpacing: 0,
|
|
25
|
-
}));
|
|
25
|
+
}), [translateX, animatedFontSize]);
|
|
26
26
|
const animatedCurrencyStyle = useAnimatedStyle(() => ({
|
|
27
27
|
fontSize: animatedFontSize.value,
|
|
28
28
|
letterSpacing: 0,
|
|
29
|
-
}));
|
|
29
|
+
}), [animatedFontSize]);
|
|
30
30
|
const animatedCaretStyle = useAnimatedStyle(() => ({
|
|
31
31
|
opacity: caretOpacity.value,
|
|
32
32
|
height: animatedFontSize.value,
|
|
33
|
-
}));
|
|
33
|
+
}), [caretOpacity, animatedFontSize]);
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
const newSize = getFontSize(inputValue);
|
|
36
36
|
translateX.value = withSequence(withTiming(4, { duration: 0 }), withTiming(0, {
|
|
@@ -3,5 +3,14 @@ import { AmountInput } from './AmountInput';
|
|
|
3
3
|
declare const meta: Meta<typeof AmountInput>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof AmountInput>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const Base: Story;
|
|
7
|
+
export declare const WithValue: Story;
|
|
8
|
+
export declare const CurrencyPositionLeft: Story;
|
|
9
|
+
export declare const CurrencyPositionRight: Story;
|
|
10
|
+
export declare const IntegerOnly: Story;
|
|
11
|
+
export declare const WithThousandsSeparator: Story;
|
|
12
|
+
export declare const WithoutThousandsSeparator: Story;
|
|
13
|
+
export declare const ErrorState: Story;
|
|
14
|
+
export declare const DisabledAmountInput: Story;
|
|
15
|
+
export declare const CustomLengthLimits: Story;
|
|
7
16
|
//# sourceMappingURL=AmountInput.stories.d.ts.map
|