@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmountInput.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/AmountInput/AmountInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"AmountInput.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/AmountInput/AmountInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AAEnE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CA+ClC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAc1C,eAAO,MAAM,IAAI,EAAE,KAYlB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAWvB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAWlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAWnC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAWzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAWpC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KAWvC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAWxB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAWjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAahC,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 { AmountInput } from './AmountInput';
|
|
4
5
|
const meta = {
|
|
5
6
|
component: AmountInput,
|
|
@@ -13,15 +14,167 @@ const meta = {
|
|
|
13
14
|
},
|
|
14
15
|
},
|
|
15
16
|
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
currencyText: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Currency text to display (e.g. USD, EUR, $)',
|
|
21
|
+
},
|
|
22
|
+
currencyPosition: {
|
|
23
|
+
control: 'radio',
|
|
24
|
+
options: ['left', 'right'],
|
|
25
|
+
description: 'Position of the currency text',
|
|
26
|
+
},
|
|
27
|
+
allowDecimals: {
|
|
28
|
+
control: 'boolean',
|
|
29
|
+
description: 'Whether to allow decimal values',
|
|
30
|
+
},
|
|
31
|
+
thousandsSeparator: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description: 'Whether to display thousands separator',
|
|
34
|
+
},
|
|
35
|
+
maxIntegerLength: {
|
|
36
|
+
control: 'number',
|
|
37
|
+
description: 'Maximum digits for integer part',
|
|
38
|
+
},
|
|
39
|
+
maxDecimalLength: {
|
|
40
|
+
control: 'number',
|
|
41
|
+
description: 'Maximum digits for decimal part',
|
|
42
|
+
},
|
|
43
|
+
isInvalid: {
|
|
44
|
+
control: 'boolean',
|
|
45
|
+
description: 'Whether the input is in error state',
|
|
46
|
+
},
|
|
47
|
+
editable: {
|
|
48
|
+
control: 'boolean',
|
|
49
|
+
description: 'Whether the input is editable',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
16
52
|
};
|
|
17
53
|
export default meta;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
54
|
+
const AmountInputStory = (args) => {
|
|
55
|
+
const [value, setValue] = useState(args.value?.toString() ?? '');
|
|
56
|
+
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(AmountInput, { ...args, value: value, onChangeText: setValue }) }) }));
|
|
57
|
+
};
|
|
58
|
+
export const Base = {
|
|
59
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
60
|
+
args: {
|
|
61
|
+
currencyText: 'USD',
|
|
62
|
+
currencyPosition: 'left',
|
|
63
|
+
allowDecimals: true,
|
|
64
|
+
thousandsSeparator: true,
|
|
65
|
+
maxIntegerLength: 9,
|
|
66
|
+
maxDecimalLength: 9,
|
|
67
|
+
isInvalid: false,
|
|
68
|
+
editable: true,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
export const WithValue = {
|
|
72
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
73
|
+
args: {
|
|
74
|
+
value: '1234.56',
|
|
75
|
+
currencyText: 'USD',
|
|
76
|
+
currencyPosition: 'left',
|
|
77
|
+
allowDecimals: true,
|
|
78
|
+
thousandsSeparator: true,
|
|
79
|
+
isInvalid: false,
|
|
80
|
+
editable: true,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
export const CurrencyPositionLeft = {
|
|
84
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
85
|
+
args: {
|
|
86
|
+
value: '1000',
|
|
87
|
+
currencyText: '$',
|
|
88
|
+
currencyPosition: 'left',
|
|
89
|
+
allowDecimals: true,
|
|
90
|
+
thousandsSeparator: true,
|
|
91
|
+
isInvalid: false,
|
|
92
|
+
editable: true,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
export const CurrencyPositionRight = {
|
|
96
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
97
|
+
args: {
|
|
98
|
+
value: '1000',
|
|
99
|
+
currencyText: 'ETH',
|
|
100
|
+
currencyPosition: 'right',
|
|
101
|
+
allowDecimals: true,
|
|
102
|
+
thousandsSeparator: true,
|
|
103
|
+
isInvalid: false,
|
|
104
|
+
editable: true,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
export const IntegerOnly = {
|
|
108
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
109
|
+
args: {
|
|
110
|
+
value: '1234',
|
|
111
|
+
currencyText: 'items',
|
|
112
|
+
currencyPosition: 'right',
|
|
113
|
+
allowDecimals: false,
|
|
114
|
+
thousandsSeparator: true,
|
|
115
|
+
isInvalid: false,
|
|
116
|
+
editable: true,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
export const WithThousandsSeparator = {
|
|
120
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
121
|
+
args: {
|
|
122
|
+
value: '1000000',
|
|
123
|
+
currencyText: 'USD',
|
|
124
|
+
currencyPosition: 'left',
|
|
125
|
+
allowDecimals: true,
|
|
126
|
+
thousandsSeparator: true,
|
|
127
|
+
isInvalid: false,
|
|
128
|
+
editable: true,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
export const WithoutThousandsSeparator = {
|
|
132
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
133
|
+
args: {
|
|
134
|
+
value: '1000000',
|
|
135
|
+
currencyText: 'USD',
|
|
136
|
+
currencyPosition: 'left',
|
|
137
|
+
allowDecimals: true,
|
|
138
|
+
thousandsSeparator: false,
|
|
139
|
+
isInvalid: false,
|
|
140
|
+
editable: true,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
export const ErrorState = {
|
|
144
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
145
|
+
args: {
|
|
146
|
+
value: '1234.56',
|
|
147
|
+
currencyText: 'USD',
|
|
148
|
+
currencyPosition: 'left',
|
|
149
|
+
allowDecimals: true,
|
|
150
|
+
thousandsSeparator: true,
|
|
151
|
+
isInvalid: true,
|
|
152
|
+
editable: true,
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
export const DisabledAmountInput = {
|
|
156
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
157
|
+
args: {
|
|
158
|
+
value: '1234.56',
|
|
159
|
+
currencyText: 'USD',
|
|
160
|
+
currencyPosition: 'left',
|
|
161
|
+
allowDecimals: true,
|
|
162
|
+
thousandsSeparator: true,
|
|
163
|
+
isInvalid: false,
|
|
164
|
+
editable: false,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
export const CustomLengthLimits = {
|
|
168
|
+
render: (args) => _jsx(AmountInputStory, { ...args }),
|
|
169
|
+
args: {
|
|
170
|
+
value: '123',
|
|
171
|
+
currencyText: '$',
|
|
172
|
+
currencyPosition: 'left',
|
|
173
|
+
allowDecimals: true,
|
|
174
|
+
thousandsSeparator: true,
|
|
175
|
+
maxIntegerLength: 6,
|
|
176
|
+
maxDecimalLength: 2,
|
|
177
|
+
isInvalid: false,
|
|
178
|
+
editable: true,
|
|
26
179
|
},
|
|
27
180
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/BaseInput/BaseInput.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/BaseInput/BaseInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAKN,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,SAAS,EACT,KAAK,cAAc,EAEpB,MAAM,cAAc,CAAC;AAKtB,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAUF,eAAO,MAAM,SAAS;IAhDpB;;OAEG;YACK,MAAM;IACd;;OAEG;gBACS,MAAM;IAClB;;OAEG;qBACc,MAAM;IACvB;;OAEG;qBACc,MAAM;IACvB;;OAEG;mBACY,MAAM;IACrB;;;OAGG;aACM,KAAK,CAAC,SAAS;IACxB;;;OAGG;aACM,KAAK,CAAC,SAAS;IACxB;;OAEG;cACO,MAAM,IAAI;IACpB;;OAEG;sBACe,OAAO;mCA2I1B,CAAC"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '@ledgerhq/lumen-utils-shared';
|
|
3
|
-
import React, { useCallback,
|
|
3
|
+
import React, { useCallback, useImperativeHandle, useRef, useState, } from 'react';
|
|
4
4
|
import { Pressable, Text, TextInput, View, } from 'react-native';
|
|
5
|
-
import Animated, { useAnimatedStyle, useSharedValue, withTiming, } from 'react-native-reanimated';
|
|
6
5
|
import { useCommonTranslation } from '../../../i18n';
|
|
7
6
|
import { DeleteCircleFill } from '../../Symbols/Icons/DeleteCircleFill';
|
|
8
7
|
import { InteractiveIcon } from '../InteractiveIcon';
|
|
9
8
|
const baseContainerStyles = cn('relative flex-row h-48 w-full items-center gap-8 px-16 rounded-sm bg-muted transition-colors border-2 border-transparent overflow-hidden');
|
|
10
9
|
const baseInputStyles = cn('relative flex-1 pt-16 pb-2 size-full text-base transition-colors bg-muted outline-none');
|
|
11
|
-
const AnimatedLabel = Animated.createAnimatedComponent(Animated.Text);
|
|
12
10
|
export const BaseInput = React.forwardRef(({ label, errorMessage, className, inputClassName, labelClassName, hideClearButton, onChangeText: onChangeTextProp, editable = true, prefix, suffix, ...props }, ref) => {
|
|
13
11
|
const { t } = useCommonTranslation();
|
|
14
12
|
const inputRef = useRef(null);
|
|
@@ -20,23 +18,8 @@ export const BaseInput = React.forwardRef(({ label, errorMessage, className, inp
|
|
|
20
18
|
const hasContent = isControlled
|
|
21
19
|
? !!props.value && props.value.length > 0
|
|
22
20
|
: uncontrolledValue.length > 0;
|
|
23
|
-
// floating label styling
|
|
24
|
-
const labelFontSize = useSharedValue(14);
|
|
25
|
-
const labelTop = useSharedValue(14);
|
|
26
21
|
const isFloatingLabel = isFocused || hasContent;
|
|
27
|
-
const animatedLabelStyle = useAnimatedStyle(() => ({
|
|
28
|
-
fontSize: labelFontSize.value,
|
|
29
|
-
top: labelTop.value,
|
|
30
|
-
}), []);
|
|
31
22
|
const showClearButton = hasContent && editable && !hideClearButton;
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
labelFontSize.value = withTiming(isFloatingLabel ? 10 : 14, {
|
|
34
|
-
duration: 200,
|
|
35
|
-
});
|
|
36
|
-
labelTop.value = withTiming(isFloatingLabel ? 8 : 14, {
|
|
37
|
-
duration: 200,
|
|
38
|
-
});
|
|
39
|
-
}, [isFloatingLabel, labelFontSize, labelTop]);
|
|
40
23
|
const handleChangeText = useCallback((text) => {
|
|
41
24
|
if (!isControlled) {
|
|
42
25
|
setUncontrolledValue(text);
|
|
@@ -55,6 +38,6 @@ export const BaseInput = React.forwardRef(({ label, errorMessage, className, inp
|
|
|
55
38
|
return (_jsxs(View, { className: className, children: [_jsxs(Pressable, { className: cn(baseContainerStyles, errorMessage && 'border-error', isFocused && !errorMessage && editable && 'border-active', !editable && 'bg-disabled text-disabled'), onPress: () => inputRef.current?.focus(), disabled: !editable, children: [prefix, _jsx(TextInput, { ref: inputRef, value: value, className: cn(baseInputStyles, !label && 'py-0', !editable && 'bg-disabled text-disabled', inputClassName),
|
|
56
39
|
// TODO: eventually move to token system
|
|
57
40
|
// `body-1` is inconsistent in RN, e.g., line-height is calculated differently
|
|
58
|
-
style: { fontWeight: '500', lineHeight: 0 }, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), onChangeText: handleChangeText, editable: editable, autoCapitalize: 'none', autoCorrect: false, ...props }), label && (_jsx(
|
|
41
|
+
style: { fontWeight: '500', lineHeight: 0 }, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), onChangeText: handleChangeText, editable: editable, autoCapitalize: 'none', autoCorrect: false, ...props }), label && (_jsx(Text, { className: cn('absolute left-16 text-muted w-full transition-all duration-200', isFloatingLabel ? 'top-6 body-4' : 'top-12 body-2', hasContent && showClearButton && 'w-[92%]', !editable && 'text-disabled', errorMessage && 'text-error', labelClassName), numberOfLines: 1, children: label })), showClearButton && (_jsx(InteractiveIcon, { iconType: 'stroked', onPress: handleClear, accessibilityLabel: t('components.baseInput.clearInputAriaLabel'), children: _jsx(DeleteCircleFill, { size: 20 }) })), !showClearButton && suffix] }), errorMessage && (_jsxs(View, { className: 'mt-8 flex-row items-center gap-2', children: [_jsx(DeleteCircleFill, { size: 16, className: 'text-error shrink-0' }), _jsx(Text, { className: 'text-error body-3', children: errorMessage })] }))] }));
|
|
59
42
|
});
|
|
60
43
|
BaseInput.displayName = 'BaseInput';
|
|
@@ -86,7 +86,7 @@ export const Base = {
|
|
|
86
86
|
},
|
|
87
87
|
render: (args) => {
|
|
88
88
|
const bottomSheetRef = useBottomSheetRef();
|
|
89
|
-
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: '
|
|
89
|
+
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: 'sm', onPress: () => bottomSheetRef.current?.expand(), children: "Toggle open" }), _jsx(BottomSheet, { ...args, ref: bottomSheetRef, children: _jsxs(BottomSheetView, { children: [_jsx(BottomSheetHeader, { title: 'Title', appearance: 'compact', description: 'Description' }), _jsx(View, { className: 'flex flex-col gap-12', children: Array.from({ length: 3 }).map((_, index) => (_jsx(Text, { className: 'text-base', children: "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Vitae excepturi odit, quis tenetur iste perspiciatis mollitia porro velit laborum quasi numquam reiciendis dolor! Et quia voluptates eum, sunt asperiores quod." }, index))) })] }) })] }));
|
|
90
90
|
},
|
|
91
91
|
};
|
|
92
92
|
export const TitleExpanded = {
|
|
@@ -101,7 +101,7 @@ export const TitleExpanded = {
|
|
|
101
101
|
},
|
|
102
102
|
render: (args) => {
|
|
103
103
|
const bottomSheetRef = useBottomSheetRef();
|
|
104
|
-
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: '
|
|
104
|
+
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: 'sm', onPress: () => bottomSheetRef.current?.expand(), children: "Toggle open" }), _jsx(BottomSheet, { ...args, ref: bottomSheetRef, children: _jsxs(BottomSheetView, { children: [_jsx(BottomSheetHeader, { title: 'Expanded title', appearance: 'expanded', description: 'Expanded description.' }), _jsx(View, { className: 'flex flex-col gap-12', children: _jsx(Text, { className: 'text-base body-2', children: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae excepturi odit, quis tenetur iste perspiciatis mollitia porro velit laborum quasi numquam reiciendis dolor! Maecenas sed diam eget risus varius blandit sit amet non magna. Donec ullamcorper nulla non metus auctor fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ullamcorper nulla non metus auctor fringilla." }) })] }) })] }));
|
|
105
105
|
},
|
|
106
106
|
};
|
|
107
107
|
export const DynamicSizingWithoutSnapPoints = {
|
|
@@ -111,7 +111,7 @@ export const DynamicSizingWithoutSnapPoints = {
|
|
|
111
111
|
},
|
|
112
112
|
render: (args) => {
|
|
113
113
|
const bottomSheetRef = useBottomSheetRef();
|
|
114
|
-
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center', children: [_jsx(Button, { size: '
|
|
114
|
+
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center', children: [_jsx(Button, { size: 'sm', onPress: () => bottomSheetRef.current?.expand(), children: "Toggle open" }), _jsx(BottomSheet, { ...args, ref: bottomSheetRef, children: _jsxs(BottomSheetScrollView, { children: [_jsx(BottomSheetHeader, { title: 'Dynamic Sizing', appearance: 'compact', description: 'This bottom sheet adapts to its content height' }), _jsx(View, { className: 'flex flex-col gap-12', children: Array.from({ length: 5 }).map((_, index) => (_jsxs(Text, { className: 'text-base', children: ["Item ", index + 1, ": Lorem ipsum, dolor sit amet consectetur adipisicing elit."] }, index))) })] }) })] }));
|
|
115
115
|
},
|
|
116
116
|
};
|
|
117
117
|
export const DynamicSizingWithSnapPoints = {
|
|
@@ -121,7 +121,7 @@ export const DynamicSizingWithSnapPoints = {
|
|
|
121
121
|
},
|
|
122
122
|
render: (args) => {
|
|
123
123
|
const bottomSheetRef = useBottomSheetRef();
|
|
124
|
-
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center', children: [_jsx(Button, { size: '
|
|
124
|
+
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center', children: [_jsx(Button, { size: 'sm', onPress: () => bottomSheetRef.current?.snapToIndex(1), children: "Toggle open" }), _jsx(BottomSheet, { ...args, ref: bottomSheetRef, children: _jsxs(BottomSheetScrollView, { children: [_jsx(BottomSheetHeader, { title: 'Dynamic Sizing', appearance: 'compact', description: 'This bottom sheet adapts to its content height and has snap points' }), _jsx(View, { className: 'flex flex-col gap-12', children: Array.from({ length: 3 }).map((_, index) => (_jsxs(Text, { className: 'text-base', children: ["Item ", index + 1, ": Lorem ipsum, dolor sit amet consectetur adipisicing elit."] }, index))) })] }) })] }));
|
|
125
125
|
},
|
|
126
126
|
};
|
|
127
127
|
export const PreventClose = {
|
|
@@ -133,7 +133,7 @@ export const PreventClose = {
|
|
|
133
133
|
},
|
|
134
134
|
render: (args) => {
|
|
135
135
|
const bottomSheetRef = useBottomSheetRef();
|
|
136
|
-
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: '
|
|
136
|
+
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: 'sm', onPress: () => bottomSheetRef.current?.expand(), children: "Toggle open" }), _jsx(BottomSheet, { ...args, ref: bottomSheetRef, children: _jsxs(BottomSheetView, { children: [_jsx(BottomSheetHeader, { title: 'Hidden Close Button', appearance: 'compact', description: 'This bottom sheet cannot be closed by dragging or button' }), _jsx(View, { className: 'flex flex-col gap-12', children: Array.from({ length: 3 }).map((_, index) => (_jsxs(Text, { className: 'text-base', children: ["Item ", index + 1, ": This bottom sheet stays open and cannot be dismissed by the user. You would need to programmatically close it using the ref."] }, index))) })] }) })] }));
|
|
137
137
|
},
|
|
138
138
|
};
|
|
139
139
|
export const ScrollView = {
|
|
@@ -142,7 +142,7 @@ export const ScrollView = {
|
|
|
142
142
|
},
|
|
143
143
|
render: (args) => {
|
|
144
144
|
const bottomSheetRef = useBottomSheetRef();
|
|
145
|
-
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center bg-base pt-32', children: [_jsx(Button, { size: '
|
|
145
|
+
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center bg-base pt-32', children: [_jsx(Button, { size: 'sm', onPress: () => bottomSheetRef.current?.expand(), children: "Toggle open" }), _jsx(BottomSheet, { ...args, ref: bottomSheetRef, children: _jsxs(BottomSheetScrollView, { children: [_jsx(BottomSheetHeader, { title: 'Scrollable Content', appearance: 'compact', description: 'This bottom sheet contains a scrollable view' }), _jsx(View, { className: 'flex flex-col gap-12', children: Array.from({ length: 20 }).map((_, index) => (_jsxs(Text, { className: 'text-base', children: ["Item ", index + 1, ": Lorem ipsum, dolor sit amet consectetur adipisicing elit. Vitae excepturi odit, quis tenetur iste perspiciatis mollitia porro velit laborum quasi numquam reiciendis dolor!"] }, index))) })] }) })] }));
|
|
146
146
|
},
|
|
147
147
|
};
|
|
148
148
|
export const VirtualList = {
|
|
@@ -156,7 +156,7 @@ export const VirtualList = {
|
|
|
156
156
|
title: `Item ${i + 1}`,
|
|
157
157
|
description: 'Lorem ipsum dolor sit amet consectetur adipisicing elit.',
|
|
158
158
|
}));
|
|
159
|
-
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: '
|
|
159
|
+
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: 'sm', onPress: () => bottomSheetRef.current?.expand(), children: "Toggle open" }), _jsxs(BottomSheet, { ...args, ref: bottomSheetRef, children: [_jsx(BottomSheetHeader, { spacing: true, title: 'Virtual List', appearance: 'compact', description: 'This bottom sheet contains a virtualized list' }), _jsx(BottomSheetFlatList, { data: data, keyExtractor: (item) => item.id, renderItem: ({ item }) => {
|
|
160
160
|
const typedItem = item;
|
|
161
161
|
return (_jsxs(View, { className: 'flex flex-col gap-4 border-b border-base py-12', children: [_jsx(Text, { className: 'text-base body-2-semi-bold', children: typedItem.title }), _jsx(Text, { className: 'text-muted body-3', children: typedItem.description })] }));
|
|
162
162
|
} })] })] }));
|
|
@@ -179,7 +179,7 @@ export const VirtualizedList = {
|
|
|
179
179
|
title: `Item ${i + 1}`,
|
|
180
180
|
description: 'Lorem ipsum dolor sit amet consectetur adipisicing elit.',
|
|
181
181
|
}));
|
|
182
|
-
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: '
|
|
182
|
+
return (_jsxs(View, { className: 'h-320 w-full items-center justify-center pt-32', children: [_jsx(Button, { size: 'sm', onPress: () => bottomSheetRef.current?.expand(), children: "Toggle open" }), _jsxs(BottomSheet, { ...args, ref: bottomSheetRef, children: [_jsx(BottomSheetHeader, { spacing: true, title: 'Virtualized List', appearance: 'compact', description: 'This bottom sheet uses a VirtualizedList with custom getItem/getItemCount' }), _jsx(BottomSheetVirtualizedList, { data: data, getItem: (items, index) => {
|
|
183
183
|
const typedData = items;
|
|
184
184
|
return typedData[index];
|
|
185
185
|
}, getItemCount: (items) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
2
3
|
import { IconSize } from '../Icon';
|
|
3
4
|
/**
|
|
4
5
|
* Base button component
|
|
@@ -12,10 +13,9 @@ export declare const BaseButton: React.ForwardRefExoticComponent<{
|
|
|
12
13
|
loading?: boolean;
|
|
13
14
|
icon?: React.ComponentType<{
|
|
14
15
|
size?: IconSize;
|
|
15
|
-
|
|
16
|
+
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
16
17
|
}>;
|
|
17
18
|
disabled?: boolean;
|
|
18
|
-
className?: string;
|
|
19
19
|
children?: React.ReactNode;
|
|
20
|
-
} & Omit<import("
|
|
20
|
+
} & Omit<import("../../../styles").StyledPressableProps, "children"> & React.RefAttributes<View>>;
|
|
21
21
|
//# sourceMappingURL=BaseButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseButton.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Button/BaseButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseButton.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Button/BaseButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AACrD,OAAO,EAAQ,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiInC;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;YA9GnB,CAAJ;aACU,CAAC;;;;iGA4JV,CAAC"}
|
|
@@ -1,132 +1,112 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cva } from 'class-variance-authority';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { Text,
|
|
5
|
-
import {
|
|
3
|
+
import { Text, View } from 'react-native';
|
|
4
|
+
import { LumenStyleSheet, mergeStyles } from '../../../styles';
|
|
6
5
|
import { Spinner } from '../Spinner';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
sm: 'px-16 py-10 body-2-semi-bold',
|
|
21
|
-
md: 'px-16 py-12',
|
|
22
|
-
lg: 'p-16',
|
|
23
|
-
},
|
|
24
|
-
isFull: {
|
|
25
|
-
true: 'w-full',
|
|
26
|
-
},
|
|
27
|
-
loading: {
|
|
28
|
-
true: '',
|
|
29
|
-
},
|
|
30
|
-
iconOnly: {
|
|
31
|
-
true: '',
|
|
32
|
-
false: '',
|
|
33
|
-
},
|
|
34
|
-
disabled: {
|
|
35
|
-
true: 'bg-disabled text-disabled active:bg-disabled',
|
|
36
|
-
false: '',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
compoundVariants: [
|
|
40
|
-
{
|
|
41
|
-
size: 'xs',
|
|
42
|
-
iconOnly: true,
|
|
43
|
-
className: 'p-8',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
size: 'sm',
|
|
47
|
-
iconOnly: true,
|
|
48
|
-
className: 'p-12',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
size: 'md',
|
|
52
|
-
iconOnly: true,
|
|
53
|
-
className: 'p-12',
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
size: 'lg',
|
|
57
|
-
iconOnly: true,
|
|
58
|
-
className: 'p-16',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
iconOnly: false,
|
|
62
|
-
className: 'gap-8',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
appearance: 'no-background',
|
|
66
|
-
disabled: true,
|
|
67
|
-
className: 'bg-base-transparent',
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
defaultVariants: {
|
|
71
|
-
appearance: 'base',
|
|
72
|
-
size: 'md',
|
|
73
|
-
isFull: false,
|
|
74
|
-
iconOnly: false,
|
|
75
|
-
disabled: false,
|
|
76
|
-
},
|
|
77
|
-
}),
|
|
78
|
-
label: cva('line-clamp-2 text-left text-inherit body-1-semi-bold', {
|
|
79
|
-
variants: {
|
|
80
|
-
appearance: {
|
|
81
|
-
base: 'text-on-interactive',
|
|
82
|
-
accent: 'text-on-accent',
|
|
83
|
-
red: 'text-error',
|
|
84
|
-
gray: 'text-base',
|
|
85
|
-
'no-background': 'text-base',
|
|
86
|
-
transparent: 'text-base',
|
|
6
|
+
import { Pressable } from '../Utility';
|
|
7
|
+
const iconSizeMap = {
|
|
8
|
+
xs: 16,
|
|
9
|
+
sm: 20,
|
|
10
|
+
md: 24,
|
|
11
|
+
lg: 24,
|
|
12
|
+
};
|
|
13
|
+
const useRootStyles = ({ isFull }) => {
|
|
14
|
+
return LumenStyleSheet.useCreate((t) => {
|
|
15
|
+
return {
|
|
16
|
+
root: {
|
|
17
|
+
width: isFull ? t.sizes.full : 'auto',
|
|
18
|
+
borderRadius: t.borderRadius.full,
|
|
87
19
|
},
|
|
88
|
-
|
|
89
|
-
|
|
20
|
+
};
|
|
21
|
+
}, [isFull]);
|
|
22
|
+
};
|
|
23
|
+
const useStyles = ({ appearance, size, disabled, pressed, iconOnly, isFull, }) => {
|
|
24
|
+
return LumenStyleSheet.useCreate((t) => {
|
|
25
|
+
const bgColors = {
|
|
26
|
+
base: t.colors.bg.interactive,
|
|
27
|
+
gray: t.colors.bg.muted,
|
|
28
|
+
accent: t.colors.bg.accent,
|
|
29
|
+
transparent: t.colors.bg.mutedTransparent,
|
|
30
|
+
'no-background': 'transparent',
|
|
31
|
+
red: t.colors.bg.error,
|
|
32
|
+
};
|
|
33
|
+
const pressedBgColors = {
|
|
34
|
+
base: t.colors.bg.interactivePressed,
|
|
35
|
+
gray: t.colors.bg.mutedPressed,
|
|
36
|
+
accent: t.colors.bg.accentPressed,
|
|
37
|
+
transparent: t.colors.bg.mutedTransparentPressed,
|
|
38
|
+
'no-background': t.colors.bg.baseTransparentPressed,
|
|
39
|
+
red: t.colors.bg.errorPressed,
|
|
40
|
+
};
|
|
41
|
+
const textColors = {
|
|
42
|
+
base: t.colors.text.onInteractive,
|
|
43
|
+
accent: t.colors.text.onAccent,
|
|
44
|
+
red: t.colors.text.error,
|
|
45
|
+
gray: t.colors.text.base,
|
|
46
|
+
'no-background': t.colors.text.base,
|
|
47
|
+
transparent: t.colors.text.base,
|
|
48
|
+
};
|
|
49
|
+
const sizeStyles = {
|
|
50
|
+
xs: { paddingH: t.spacings.s12, paddingV: t.spacings.s8 },
|
|
51
|
+
sm: { paddingH: t.spacings.s16, paddingV: t.spacings.s10 },
|
|
52
|
+
md: { paddingH: t.spacings.s16, paddingV: t.spacings.s12 },
|
|
53
|
+
lg: { paddingH: t.spacings.s16, paddingV: t.spacings.s16 },
|
|
54
|
+
};
|
|
55
|
+
const iconOnlyPadding = {
|
|
56
|
+
xs: t.spacings.s8,
|
|
57
|
+
sm: t.spacings.s10,
|
|
58
|
+
md: t.spacings.s12,
|
|
59
|
+
lg: t.spacings.s16,
|
|
60
|
+
};
|
|
61
|
+
const typography = size === 'xs' || size === 'sm'
|
|
62
|
+
? t.typographies.body2SemiBold
|
|
63
|
+
: t.typographies.body1SemiBold;
|
|
64
|
+
const currentSizeStyle = sizeStyles[size];
|
|
65
|
+
return {
|
|
66
|
+
container: mergeStyles({
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
backgroundColor: bgColors[appearance],
|
|
71
|
+
}, iconOnly
|
|
72
|
+
? { padding: iconOnlyPadding[size] }
|
|
73
|
+
: {
|
|
74
|
+
paddingHorizontal: currentSizeStyle.paddingH,
|
|
75
|
+
paddingVertical: currentSizeStyle.paddingV,
|
|
76
|
+
gap: t.spacings.s8,
|
|
77
|
+
}, isFull && { width: t.sizes.full }, pressed && { backgroundColor: pressedBgColors[appearance] }, disabled && { backgroundColor: t.colors.bg.disabled }, appearance === 'no-background' &&
|
|
78
|
+
disabled && { backgroundColor: 'transparent' }),
|
|
79
|
+
label: mergeStyles(typography, {
|
|
80
|
+
color: disabled ? t.colors.text.disabled : textColors[appearance],
|
|
81
|
+
textAlign: 'left',
|
|
82
|
+
}),
|
|
83
|
+
icon: {
|
|
84
|
+
flexShrink: 0,
|
|
85
|
+
color: disabled ? t.colors.text.disabled : textColors[appearance],
|
|
90
86
|
},
|
|
91
|
-
}
|
|
92
|
-
})
|
|
87
|
+
};
|
|
88
|
+
}, [appearance, size, disabled, pressed, iconOnly, isFull]);
|
|
93
89
|
};
|
|
94
|
-
const iconVariants = cva('shrink-0', {
|
|
95
|
-
variants: {
|
|
96
|
-
appearance: {
|
|
97
|
-
base: 'text-on-interactive',
|
|
98
|
-
accent: 'text-on-accent',
|
|
99
|
-
red: 'text-error',
|
|
100
|
-
gray: 'text-base',
|
|
101
|
-
'no-background': 'text-base',
|
|
102
|
-
transparent: 'text-base',
|
|
103
|
-
},
|
|
104
|
-
disabled: {
|
|
105
|
-
true: 'text-disabled',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
90
|
/**
|
|
110
91
|
* Base button component
|
|
111
92
|
* @default appearance 'base'
|
|
112
93
|
* @default size 'md'
|
|
113
94
|
*/
|
|
114
|
-
export const BaseButton = React.forwardRef(({
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
xs: 16,
|
|
118
|
-
sm: 20,
|
|
119
|
-
md: 24,
|
|
120
|
-
lg: 24,
|
|
121
|
-
};
|
|
122
|
-
const calculatedIconSize = size ? iconSizeMap[size] : 24;
|
|
123
|
-
return (_jsxs(Pressable, { ref: ref, className: cn(className, buttonVariants.root({
|
|
124
|
-
appearance,
|
|
125
|
-
size,
|
|
126
|
-
isFull,
|
|
127
|
-
loading,
|
|
128
|
-
iconOnly,
|
|
129
|
-
disabled,
|
|
130
|
-
})), disabled: disabled ?? false, ...props, children: [loading && (_jsx(Spinner, { size: calculatedIconSize, className: iconVariants({ appearance, disabled }) })), !loading && IconProp && (_jsx(IconProp, { size: calculatedIconSize, className: iconVariants({ appearance, disabled }) })), children && (_jsx(Text, { className: buttonVariants.label({ appearance, disabled }), children: children }))] }));
|
|
95
|
+
export const BaseButton = React.forwardRef(({ lx, style, children, appearance = 'base', size = 'md', isFull = false, loading = false, icon: IconProp, disabled = false, ...props }, ref) => {
|
|
96
|
+
const rootStyles = useRootStyles({ isFull });
|
|
97
|
+
return (_jsx(Pressable, { ref: ref, lx: lx, style: [style, rootStyles.root], disabled: disabled, accessibilityRole: 'button', accessibilityState: { disabled }, ...props, children: ({ pressed }) => (_jsx(BaseButtonContent, { appearance: appearance, size: size, disabled: disabled, pressed: pressed, isFull: isFull, loading: loading, IconProp: IconProp, children: children })) }));
|
|
131
98
|
});
|
|
99
|
+
const BaseButtonContent = ({ appearance, size, disabled, pressed, isFull, loading, IconProp, children, }) => {
|
|
100
|
+
const calculatedIconSize = iconSizeMap[size];
|
|
101
|
+
const iconOnly = Boolean(IconProp && !children);
|
|
102
|
+
const styles = useStyles({
|
|
103
|
+
appearance,
|
|
104
|
+
size,
|
|
105
|
+
disabled,
|
|
106
|
+
pressed,
|
|
107
|
+
iconOnly,
|
|
108
|
+
isFull,
|
|
109
|
+
});
|
|
110
|
+
return (_jsxs(View, { style: styles.container, testID: 'base-button-content', children: [loading && (_jsx(Spinner, { size: calculatedIconSize, color: styles.icon.color })), !loading && IconProp && (_jsx(IconProp, { size: calculatedIconSize, style: styles.icon })), children && (_jsx(Text, { style: styles.label, numberOfLines: 2, children: children }))] }));
|
|
111
|
+
};
|
|
132
112
|
BaseButton.displayName = 'BaseButton';
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BaseButtonProps } from './BaseButton.types';
|
|
3
|
-
export type ButtonProps = {
|
|
4
|
-
/**
|
|
5
|
-
* The content to display inside the button.
|
|
6
|
-
*/
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
} & BaseButtonProps;
|
|
9
2
|
/**
|
|
10
3
|
* A customizable button component that supports various appearances, sizes, full-width mode, loading states, and optional icons.
|
|
11
4
|
*
|
|
@@ -22,27 +15,12 @@ export type ButtonProps = {
|
|
|
22
15
|
* Click Me
|
|
23
16
|
* </Button>
|
|
24
17
|
*
|
|
25
|
-
* // Full-width button with
|
|
26
|
-
* <Button appearance="accent" isFull={true}
|
|
18
|
+
* // Full-width button with lx props
|
|
19
|
+
* <Button appearance="accent" isFull={true} lx={{ marginTop: 's16' }}>
|
|
27
20
|
* Submit
|
|
28
21
|
* </Button>
|
|
29
22
|
*/
|
|
30
23
|
export declare const Button: React.ForwardRefExoticComponent<{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*/
|
|
34
|
-
children: React.ReactNode;
|
|
35
|
-
} & {
|
|
36
|
-
appearance?: "base" | "gray" | "accent" | "transparent" | "no-background" | "red";
|
|
37
|
-
size?: "xs" | "sm" | "md" | "lg";
|
|
38
|
-
isFull?: boolean;
|
|
39
|
-
loading?: boolean;
|
|
40
|
-
icon?: React.ComponentType<{
|
|
41
|
-
size?: import("../Icon").IconSize;
|
|
42
|
-
className?: string;
|
|
43
|
-
}>;
|
|
44
|
-
disabled?: boolean;
|
|
45
|
-
className?: string;
|
|
46
|
-
children?: React.ReactNode;
|
|
47
|
-
} & Omit<import("react-native").PressableProps, "children" | "disabled"> & React.RefAttributes<import("react-native").View>>;
|
|
24
|
+
size?: "sm" | "md" | "lg";
|
|
25
|
+
} & Omit<import("./types").BaseButtonProps, "size"> & React.RefAttributes<import("react-native").View>>;
|
|
48
26
|
//# sourceMappingURL=Button.d.ts.map
|