@ledgerhq/lumen-ui-rnative 0.0.43 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/Decorator.tsx +78 -13
- package/.storybook/docs/getting-started/ThemeProvider.mdx +1 -1
- package/.storybook/docs/style-system/lx.mdx +144 -0
- package/.storybook/docs/style-system/useCreate.mdx +95 -0
- package/.storybook/docs/style-system/useTheme.mdx +52 -0
- package/.storybook/preview-head.html +2 -2
- package/.storybook/{preview.ts → preview.tsx} +6 -1
- package/dist/package.json +2 -3
- package/dist/src/lib/Components/AddressInput/AddressInput.js +1 -1
- package/dist/src/lib/Components/AddressInput/AddressInput.stories.d.ts +7 -1
- package/dist/src/lib/Components/AddressInput/AddressInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/AddressInput/AddressInput.stories.js +98 -9
- package/dist/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/src/lib/Components/AmountInput/AmountInput.js +3 -3
- package/dist/src/lib/Components/AmountInput/AmountInput.stories.d.ts +10 -1
- package/dist/src/lib/Components/AmountInput/AmountInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/AmountInput/AmountInput.stories.js +162 -9
- package/dist/src/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/src/lib/Components/BaseInput/BaseInput.js +2 -19
- package/dist/src/lib/Components/BottomSheet/BottomSheet.js +1 -1
- package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.js +8 -8
- package/dist/src/lib/Components/Button/BaseButton.d.ts +3 -3
- package/dist/src/lib/Components/Button/BaseButton.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/BaseButton.js +99 -119
- package/dist/src/lib/Components/Button/Button.d.ts +4 -26
- package/dist/src/lib/Components/Button/Button.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/Button.js +2 -2
- package/dist/src/lib/Components/Button/Button.stories.d.ts +1 -1
- package/dist/src/lib/Components/Button/Button.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/Button.stories.js +25 -48
- package/dist/src/lib/Components/Button/index.d.ts +1 -1
- package/dist/src/lib/Components/Button/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/index.js +1 -1
- package/dist/src/lib/Components/Button/{BaseButton.types.d.ts → types.d.ts} +15 -10
- package/dist/src/lib/Components/Button/types.d.ts.map +1 -0
- package/dist/src/lib/Components/CardButton/CardButton.d.ts +4 -3
- package/dist/src/lib/Components/CardButton/CardButton.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/CardButton.js +65 -71
- package/dist/src/lib/Components/CardButton/CardButton.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/CardButton.stories.js +28 -15
- package/dist/src/lib/Components/CardButton/index.d.ts +1 -1
- package/dist/src/lib/Components/CardButton/index.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/index.js +1 -1
- package/dist/src/lib/Components/CardButton/{CardButton.types.d.ts → types.d.ts} +5 -4
- package/dist/src/lib/Components/CardButton/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Icon/Icon.d.ts +6 -3
- package/dist/src/lib/Components/Icon/Icon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/Icon.js +24 -25
- package/dist/src/lib/Components/Icon/Icon.stories.d.ts +2 -2
- package/dist/src/lib/Components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/Icon.stories.js +73 -19
- package/dist/src/lib/Components/Icon/createIcon.d.ts +1 -1
- package/dist/src/lib/Components/Icon/createIcon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/createIcon.js +1 -2
- package/dist/src/lib/Components/Icon/index.d.ts +1 -1
- package/dist/src/lib/Components/Icon/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/index.js +1 -1
- package/dist/src/lib/Components/Icon/{Icon.types.d.ts → types.d.ts} +7 -4
- package/dist/src/lib/Components/Icon/types.d.ts.map +1 -0
- package/dist/src/lib/Components/IconButton/IconButton.d.ts +2 -19
- package/dist/src/lib/Components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/src/lib/Components/IconButton/IconButton.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/IconButton/IconButton.stories.js +9 -11
- package/dist/src/lib/Components/IconButton/index.d.ts +1 -0
- package/dist/src/lib/Components/IconButton/index.d.ts.map +1 -1
- package/dist/src/lib/Components/IconButton/index.js +1 -0
- package/dist/src/lib/Components/IconButton/types.d.ts +12 -0
- package/dist/src/lib/Components/IconButton/types.d.ts.map +1 -0
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts +2 -2
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.js +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.js +34 -34
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.d.ts +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.js +22 -9
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts +3 -7
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/Link.d.ts +7 -77
- package/dist/src/lib/Components/Link/Link.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/Link.js +59 -75
- package/dist/src/lib/Components/Link/Link.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/Link.stories.js +34 -11
- package/dist/src/lib/Components/Link/index.d.ts +1 -0
- package/dist/src/lib/Components/Link/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/index.js +1 -0
- package/dist/src/lib/Components/Link/types.d.ts +43 -0
- package/dist/src/lib/Components/Link/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Link/types.js +1 -0
- package/dist/src/lib/Components/Search/Search.stories.d.ts +6 -1
- package/dist/src/lib/Components/Search/Search.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Search/Search.stories.js +71 -9
- package/dist/src/lib/Components/Select/Select.d.ts.map +1 -1
- package/dist/src/lib/Components/Select/Select.js +1 -17
- package/dist/src/lib/Components/Spinner/Spinner.d.ts +13 -16
- package/dist/src/lib/Components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/Spinner.js +33 -5
- package/dist/src/lib/Components/Spinner/Spinner.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/Spinner.stories.js +1 -1
- package/dist/src/lib/Components/Spinner/index.d.ts +1 -0
- package/dist/src/lib/Components/Spinner/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/index.js +1 -0
- package/dist/src/lib/Components/Spinner/types.d.ts +15 -0
- package/dist/src/lib/Components/Spinner/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Spinner/types.js +1 -0
- package/dist/src/lib/Components/Tag/Tag.d.ts +2 -1
- package/dist/src/lib/Components/Tag/Tag.d.ts.map +1 -1
- package/dist/src/lib/Components/Tag/Tag.js +15 -4
- package/dist/src/lib/Components/Tag/Tag.stories.js +1 -1
- package/dist/src/lib/Components/Tag/Tag.types.d.ts +7 -1
- package/dist/src/lib/Components/Tag/Tag.types.d.ts.map +1 -1
- package/dist/src/lib/Components/TextInput/TextInput.stories.d.ts +8 -1
- package/dist/src/lib/Components/TextInput/TextInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/TextInput/TextInput.stories.js +104 -9
- package/dist/src/lib/Components/Tile/Tile.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/Tile.js +54 -8
- package/dist/src/lib/Components/Tile/types.d.ts +14 -1
- package/dist/src/lib/Components/Tile/types.d.ts.map +1 -1
- package/dist/src/lib/Components/Tooltip/Tooltip.stories.js +2 -2
- package/dist/src/lib/Components/Utility/Box/Box.d.ts +39 -0
- package/dist/src/lib/Components/Utility/Box/Box.d.ts.map +1 -0
- package/dist/src/lib/Components/{Box → Utility/Box}/Box.js +10 -11
- package/dist/src/lib/Components/Utility/Box/Box.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/{Box → Utility/Box}/Box.stories.js +13 -12
- package/dist/src/lib/Components/Utility/Box/index.d.ts +2 -0
- package/dist/src/lib/Components/Utility/Box/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.d.ts +34 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.js +33 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.d.ts +7 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.js +47 -0
- package/dist/src/lib/Components/Utility/Pressable/index.d.ts +3 -0
- package/dist/src/lib/Components/Utility/Pressable/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/index.js +1 -0
- package/dist/src/lib/Components/Utility/Pressable/types.d.ts +3 -0
- package/dist/src/lib/Components/Utility/Pressable/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/types.js +1 -0
- package/dist/src/lib/Components/Utility/Text/Text.d.ts +40 -0
- package/dist/src/lib/Components/Utility/Text/Text.d.ts.map +1 -0
- package/dist/src/lib/Components/{Text → Utility/Text}/Text.js +13 -9
- package/dist/src/lib/Components/Utility/Text/Text.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/{Text → Utility/Text}/Text.stories.js +3 -3
- package/dist/src/lib/Components/Utility/Text/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/index.d.ts +4 -0
- package/dist/src/lib/Components/Utility/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/index.js +3 -0
- package/dist/src/lib/Components/index.d.ts +1 -3
- package/dist/src/lib/Components/index.d.ts.map +1 -1
- package/dist/src/lib/Components/index.js +1 -3
- package/dist/src/lib/utils/components/InjectStylesIntoChildren.d.ts +6 -5
- package/dist/src/lib/utils/components/InjectStylesIntoChildren.d.ts.map +1 -1
- package/dist/src/lib/utils/components/InjectStylesIntoChildren.js +6 -6
- package/dist/src/styles/LumenStyleSheet.d.ts +1 -1
- package/dist/src/styles/LumenStyleSheet.d.ts.map +1 -1
- package/dist/src/styles/Provider/createStylesheetTheme.d.ts +0 -1
- package/dist/src/styles/Provider/createStylesheetTheme.d.ts.map +1 -1
- package/dist/src/styles/Provider/createStylesheetTheme.js +0 -1
- package/dist/src/styles/create/useCreate.d.ts +2 -1
- package/dist/src/styles/create/useCreate.d.ts.map +1 -1
- package/dist/src/styles/create/useCreate.js +5 -5
- package/dist/src/styles/factories/areLxPropsEqual.d.ts +3 -0
- package/dist/src/styles/factories/areLxPropsEqual.d.ts.map +1 -0
- package/dist/src/styles/factories/areLxPropsEqual.js +15 -0
- package/dist/src/styles/factories/createStyledPressable.d.ts +26 -0
- package/dist/src/styles/factories/createStyledPressable.d.ts.map +1 -0
- package/dist/src/styles/factories/createStyledPressable.js +61 -0
- package/dist/src/styles/factories/createStyledText.d.ts +15 -26
- package/dist/src/styles/factories/createStyledText.d.ts.map +1 -1
- package/dist/src/styles/factories/createStyledText.js +13 -29
- package/dist/src/styles/factories/createStyledView.d.ts +7 -27
- package/dist/src/styles/factories/createStyledView.d.ts.map +1 -1
- package/dist/src/styles/factories/createStyledView.js +10 -30
- package/dist/src/styles/factories/index.d.ts +4 -0
- package/dist/src/styles/factories/index.d.ts.map +1 -0
- package/dist/src/styles/factories/index.js +3 -0
- package/dist/src/styles/index.d.ts +2 -3
- package/dist/src/styles/index.d.ts.map +1 -1
- package/dist/src/styles/index.js +2 -3
- package/dist/src/styles/resolveStyle/resolveConfig.d.ts +7 -7
- package/dist/src/styles/resolveStyle/resolveConfig.d.ts.map +1 -1
- package/dist/src/styles/resolveStyle/resolveConfig.js +9 -9
- package/dist/src/styles/resolveStyle/resolveStyle.d.ts +6 -20
- package/dist/src/styles/resolveStyle/resolveStyle.d.ts.map +1 -1
- package/dist/src/styles/resolveStyle/resolveStyle.js +4 -29
- package/dist/src/styles/types/create.types.d.ts +1 -1
- package/dist/src/styles/types/create.types.d.ts.map +1 -1
- package/dist/src/styles/types/styled.types.d.ts +72 -50
- package/dist/src/styles/types/styled.types.d.ts.map +1 -1
- package/dist/src/styles/types/utility.types.d.ts.map +1 -1
- package/dist/src/styles/utils/index.d.ts +2 -0
- package/dist/src/styles/utils/index.d.ts.map +1 -0
- package/dist/src/styles/utils/index.js +1 -0
- package/dist/src/styles/utils/mergeStyles.d.ts +16 -0
- package/dist/src/styles/utils/mergeStyles.d.ts.map +1 -0
- package/dist/src/styles/utils/mergeStyles.js +20 -0
- package/package.json +3 -4
- package/src/lib/Components/AddressInput/AddressInput.mdx +15 -4
- package/src/lib/Components/AddressInput/AddressInput.stories.tsx +133 -17
- package/src/lib/Components/AddressInput/AddressInput.tsx +1 -1
- package/src/lib/Components/AmountInput/AmountInput.mdx +20 -1
- package/src/lib/Components/AmountInput/AmountInput.stories.tsx +180 -17
- package/src/lib/Components/AmountInput/AmountInput.tsx +24 -15
- package/src/lib/Components/Banner/Banner.test.tsx +48 -15
- package/src/lib/Components/BaseInput/BaseInput.tsx +6 -35
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +8 -8
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +1 -1
- package/src/lib/Components/Button/BaseButton.test.tsx +149 -0
- package/src/lib/Components/Button/BaseButton.tsx +193 -148
- package/src/lib/Components/Button/Button.mdx +34 -31
- package/src/lib/Components/Button/Button.stories.tsx +37 -58
- package/src/lib/Components/Button/Button.tsx +4 -11
- package/src/lib/Components/Button/index.ts +1 -1
- package/src/lib/Components/Button/{BaseButton.types.ts → types.ts} +14 -8
- package/src/lib/Components/CardButton/CardButton.mdx +15 -25
- package/src/lib/Components/CardButton/CardButton.stories.tsx +48 -22
- package/src/lib/Components/CardButton/CardButton.test.tsx +141 -0
- package/src/lib/Components/CardButton/CardButton.tsx +142 -108
- package/src/lib/Components/CardButton/index.ts +1 -1
- package/src/lib/Components/CardButton/{CardButton.types.ts → types.ts} +4 -3
- package/src/lib/Components/Checkbox/Checkbox.mdx +1 -1
- package/src/lib/Components/Checkbox/Checkbox.test.tsx +42 -17
- package/src/lib/Components/Icon/Icon.stories.tsx +143 -73
- package/src/lib/Components/Icon/Icon.test.tsx +84 -0
- package/src/lib/Components/Icon/Icon.tsx +32 -28
- package/src/lib/Components/Icon/createIcon.ts +2 -3
- package/src/lib/Components/Icon/index.ts +1 -1
- package/src/lib/Components/Icon/{Icon.types.ts → types.ts} +4 -3
- package/src/lib/Components/IconButton/IconButton.mdx +13 -10
- package/src/lib/Components/IconButton/IconButton.stories.tsx +12 -14
- package/src/lib/Components/IconButton/IconButton.test.tsx +141 -0
- package/src/lib/Components/IconButton/IconButton.tsx +3 -13
- package/src/lib/Components/IconButton/index.ts +1 -0
- package/src/lib/Components/IconButton/types.ts +12 -0
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.tsx +1 -1
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +25 -27
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.tsx +82 -43
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.test.tsx +30 -19
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.tsx +78 -45
- package/src/lib/Components/InteractiveIcon/types.ts +4 -7
- package/src/lib/Components/Link/Link.mdx +8 -18
- package/src/lib/Components/Link/Link.stories.tsx +56 -25
- package/src/lib/Components/Link/Link.test.tsx +141 -51
- package/src/lib/Components/Link/Link.tsx +128 -150
- package/src/lib/Components/Link/index.ts +1 -0
- package/src/lib/Components/Link/types.ts +44 -0
- package/src/lib/Components/Search/Search.mdx +14 -1
- package/src/lib/Components/Search/Search.stories.tsx +94 -15
- package/src/lib/Components/Select/Select.test.tsx +8 -4
- package/src/lib/Components/Select/Select.tsx +4 -31
- package/src/lib/Components/Spinner/Spinner.stories.tsx +1 -5
- package/src/lib/Components/Spinner/Spinner.tsx +60 -34
- package/src/lib/Components/Spinner/index.ts +1 -0
- package/src/lib/Components/Spinner/types.ts +15 -0
- package/src/lib/Components/Switch/Switch.mdx +1 -1
- package/src/lib/Components/Tag/Tag.stories.tsx +2 -2
- package/src/lib/Components/Tag/Tag.tsx +22 -6
- package/src/lib/Components/Tag/Tag.types.ts +7 -8
- package/src/lib/Components/TextInput/TextInput.mdx +24 -4
- package/src/lib/Components/TextInput/TextInput.stories.tsx +131 -15
- package/src/lib/Components/Tile/Tile.test.tsx +100 -63
- package/src/lib/Components/Tile/Tile.tsx +64 -13
- package/src/lib/Components/Tile/types.ts +14 -1
- package/src/lib/Components/Tooltip/Tooltip.stories.tsx +2 -2
- package/src/lib/Components/Tooltip/Tooltip.test.tsx +8 -4
- package/src/lib/Components/{Box → Utility/Box}/Box.mdx +15 -13
- package/src/lib/Components/{Box → Utility/Box}/Box.stories.tsx +13 -11
- package/src/lib/Components/{Box → Utility/Box}/Box.tsx +11 -12
- package/src/lib/Components/Utility/Box/index.ts +1 -0
- package/src/lib/Components/Utility/Pressable/Pressable.mdx +103 -0
- package/src/lib/Components/Utility/Pressable/Pressable.stories.tsx +51 -0
- package/src/lib/Components/Utility/Pressable/Pressable.test.tsx +221 -0
- package/src/lib/Components/Utility/Pressable/Pressable.tsx +34 -0
- package/src/lib/Components/Utility/Pressable/index.ts +2 -0
- package/src/lib/Components/Utility/Pressable/types.ts +3 -0
- package/src/lib/Components/{Text → Utility/Text}/Text.mdx +15 -7
- package/src/lib/Components/{Text → Utility/Text}/Text.stories.tsx +3 -3
- package/src/lib/Components/Utility/Text/Text.tsx +39 -0
- package/src/lib/Components/Utility/index.ts +3 -0
- package/src/lib/Components/index.ts +1 -3
- package/src/lib/utils/components/InjectStylesIntoChildren.tsx +23 -14
- package/src/styles/Provider/createStylesheetTheme.ts +0 -1
- package/src/styles/create/useCreate.ts +8 -4
- package/src/styles/factories/areLxPropsEqual.ts +32 -0
- package/src/styles/factories/createStyledPressable.test.tsx +253 -0
- package/src/styles/factories/createStyledPressable.tsx +97 -0
- package/src/styles/factories/createStyledText.test.tsx +28 -20
- package/src/styles/factories/createStyledText.tsx +29 -49
- package/src/styles/factories/createStyledView.test.tsx +22 -16
- package/src/styles/factories/createStyledView.tsx +19 -53
- package/src/styles/factories/index.ts +3 -0
- package/src/styles/index.ts +2 -3
- package/src/styles/resolveStyle/resolveConfig.ts +16 -15
- package/src/styles/resolveStyle/resolveStyle.test.ts +13 -141
- package/src/styles/resolveStyle/resolveStyle.ts +10 -60
- package/src/styles/types/create.types.ts +1 -1
- package/src/styles/types/styled.types.ts +73 -105
- package/src/styles/types/utility.types.ts +1 -0
- package/src/styles/utils/index.ts +1 -0
- package/src/styles/utils/mergeStyles.test.ts +45 -0
- package/src/styles/utils/mergeStyles.ts +25 -0
- package/.storybook/docs/getting-started/StyleSystem.mdx +0 -133
- package/dist/src/lib/Components/Box/Box.d.ts +0 -592
- package/dist/src/lib/Components/Box/Box.d.ts.map +0 -1
- package/dist/src/lib/Components/Box/Box.stories.d.ts.map +0 -1
- package/dist/src/lib/Components/Box/Box.types.d.ts +0 -3
- package/dist/src/lib/Components/Box/Box.types.d.ts.map +0 -1
- package/dist/src/lib/Components/Box/index.d.ts +0 -3
- package/dist/src/lib/Components/Box/index.d.ts.map +0 -1
- package/dist/src/lib/Components/Button/BaseButton.types.d.ts.map +0 -1
- package/dist/src/lib/Components/CardButton/CardButton.types.d.ts.map +0 -1
- package/dist/src/lib/Components/Icon/Icon.types.d.ts.map +0 -1
- package/dist/src/lib/Components/Text/Text.d.ts +0 -602
- package/dist/src/lib/Components/Text/Text.d.ts.map +0 -1
- package/dist/src/lib/Components/Text/Text.stories.d.ts.map +0 -1
- package/dist/src/lib/Components/Text/index.d.ts.map +0 -1
- package/dist/src/lib/Components/_ToRemove/ToRemove.d.ts +0 -9
- package/dist/src/lib/Components/_ToRemove/ToRemove.d.ts.map +0 -1
- package/dist/src/lib/Components/_ToRemove/ToRemove.js +0 -43
- package/dist/src/styles/utils/styleVarianceAuthority.d.ts +0 -30
- package/dist/src/styles/utils/styleVarianceAuthority.d.ts.map +0 -1
- package/dist/src/styles/utils/styleVarianceAuthority.js +0 -97
- package/src/lib/Components/Box/Box.types.ts +0 -3
- package/src/lib/Components/Box/index.ts +0 -2
- package/src/lib/Components/Text/Text.tsx +0 -35
- package/src/lib/Components/_ToRemove/ToRemove.tsx +0 -65
- package/src/styles/utils/styleVarianceAuthority.test.ts +0 -302
- package/src/styles/utils/styleVarianceAuthority.ts +0 -154
- /package/dist/src/lib/Components/{Box/Box.types.js → Button/types.js} +0 -0
- /package/dist/src/lib/Components/{Button/BaseButton.types.js → CardButton/types.js} +0 -0
- /package/dist/src/lib/Components/{CardButton/CardButton.types.js → Icon/types.js} +0 -0
- /package/dist/src/lib/Components/{Icon/Icon.types.js → IconButton/types.js} +0 -0
- /package/dist/src/lib/Components/{Box → Utility/Box}/Box.stories.d.ts +0 -0
- /package/dist/src/lib/Components/{Box → Utility/Box}/index.js +0 -0
- /package/dist/src/lib/Components/{Text → Utility/Text}/Text.stories.d.ts +0 -0
- /package/dist/src/lib/Components/{Text → Utility/Text}/index.d.ts +0 -0
- /package/dist/src/lib/Components/{Text → Utility/Text}/index.js +0 -0
- /package/src/lib/Components/{Text → Utility/Text}/index.ts +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Search, type SearchProps } from './Search';
|
|
4
5
|
|
|
5
6
|
const meta: Meta<typeof Search> = {
|
|
6
7
|
component: Search,
|
|
@@ -14,25 +15,103 @@ const meta: Meta<typeof Search> = {
|
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
placeholder: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
description: 'Placeholder text when input is empty',
|
|
22
|
+
},
|
|
23
|
+
errorMessage: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Error message to display below input',
|
|
26
|
+
},
|
|
27
|
+
editable: {
|
|
28
|
+
control: 'boolean',
|
|
29
|
+
description: 'Whether the input is editable',
|
|
30
|
+
},
|
|
31
|
+
hideClearButton: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description: 'Hide the clear button',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
17
36
|
};
|
|
18
37
|
|
|
19
38
|
export default meta;
|
|
20
39
|
type Story = StoryObj<typeof Search>;
|
|
21
40
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
const SearchStory = (args: SearchProps & { initialValue?: string }) => {
|
|
42
|
+
const [query, setQuery] = useState(args.initialValue ?? '');
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View className='flex min-h-400 items-center justify-center p-24'>
|
|
46
|
+
<View className='w-full max-w-320'>
|
|
47
|
+
<Search
|
|
48
|
+
{...args}
|
|
49
|
+
value={query}
|
|
50
|
+
onChangeText={setQuery}
|
|
51
|
+
onClear={args.onClear}
|
|
52
|
+
/>
|
|
53
|
+
</View>
|
|
54
|
+
</View>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Base: Story = {
|
|
59
|
+
render: (args) => <SearchStory {...args} />,
|
|
60
|
+
args: {
|
|
61
|
+
placeholder: 'Search products',
|
|
62
|
+
editable: true,
|
|
63
|
+
hideClearButton: false,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const WithContent: Story = {
|
|
68
|
+
render: (args) => <SearchStory {...args} initialValue='Search text' />,
|
|
69
|
+
args: {
|
|
70
|
+
placeholder: 'Search products',
|
|
71
|
+
editable: true,
|
|
72
|
+
hideClearButton: false,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const WithError: Story = {
|
|
77
|
+
render: (args) => <SearchStory {...args} initialValue='Invalid search' />,
|
|
78
|
+
args: {
|
|
79
|
+
placeholder: 'Search products',
|
|
80
|
+
errorMessage: 'Search term is invalid',
|
|
81
|
+
editable: true,
|
|
82
|
+
hideClearButton: false,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const DisabledSearch: Story = {
|
|
87
|
+
render: (args) => <SearchStory {...args} initialValue='Disabled search' />,
|
|
88
|
+
args: {
|
|
89
|
+
placeholder: 'Search products',
|
|
90
|
+
editable: false,
|
|
91
|
+
hideClearButton: false,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const WithHiddenClearButton: Story = {
|
|
96
|
+
render: (args) => <SearchStory {...args} initialValue='Search text' />,
|
|
97
|
+
args: {
|
|
98
|
+
placeholder: 'Search products',
|
|
99
|
+
editable: true,
|
|
100
|
+
hideClearButton: true,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const WithClearCallback: Story = {
|
|
105
|
+
render: (args) => (
|
|
106
|
+
<SearchStory
|
|
107
|
+
{...args}
|
|
108
|
+
initialValue='Click clear to see callback'
|
|
109
|
+
onClear={() => alert('Search cleared!')}
|
|
28
110
|
/>
|
|
29
111
|
),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'⚠️ This component requires testing on a physical device or emulator due to Reanimated compatibility issues with web previews.',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
112
|
+
args: {
|
|
113
|
+
placeholder: 'Search products',
|
|
114
|
+
editable: true,
|
|
115
|
+
hideClearButton: false,
|
|
37
116
|
},
|
|
38
117
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { describe, it, expect, jest } from '@jest/globals';
|
|
2
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
2
3
|
import { render, fireEvent } from '@testing-library/react-native';
|
|
3
4
|
import React from 'react';
|
|
5
|
+
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
4
6
|
import { GlobalSelectBottomSheet } from './GlobalSelectBottomSheet';
|
|
5
7
|
import { GlobalSelectProvider } from './GlobalSelectContext';
|
|
6
8
|
import {
|
|
@@ -13,10 +15,12 @@ import {
|
|
|
13
15
|
} from './Select';
|
|
14
16
|
|
|
15
17
|
const TestWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => (
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
19
|
+
<GlobalSelectProvider>
|
|
20
|
+
{children}
|
|
21
|
+
<GlobalSelectBottomSheet />
|
|
22
|
+
</GlobalSelectProvider>
|
|
23
|
+
</ThemeProvider>
|
|
20
24
|
);
|
|
21
25
|
|
|
22
26
|
describe('Select', () => {
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { cn } from '@ledgerhq/lumen-utils-shared';
|
|
2
2
|
import React, { useState, useEffect, useCallback, useId } from 'react';
|
|
3
3
|
import { View, Text, Pressable } from 'react-native';
|
|
4
|
-
import Animated, {
|
|
5
|
-
useAnimatedStyle,
|
|
6
|
-
useSharedValue,
|
|
7
|
-
withTiming,
|
|
8
|
-
} from 'react-native-reanimated';
|
|
9
4
|
import { ChevronDown } from '../../Symbols';
|
|
10
5
|
import { useControllableState, extractTextFromChildren } from '../../utils';
|
|
11
6
|
import { SlotPressable } from '../Slot';
|
|
@@ -122,8 +117,6 @@ export const Select: React.FC<SelectProps> = ({
|
|
|
122
117
|
};
|
|
123
118
|
Select.displayName = 'Select';
|
|
124
119
|
|
|
125
|
-
const AnimatedLabel = Animated.createAnimatedComponent(Animated.Text);
|
|
126
|
-
|
|
127
120
|
export const SelectTrigger: React.FC<SelectTriggerProps> = ({
|
|
128
121
|
children,
|
|
129
122
|
className,
|
|
@@ -176,26 +169,6 @@ export const SelectTrigger: React.FC<SelectTriggerProps> = ({
|
|
|
176
169
|
const hasValue = value !== undefined && value !== '';
|
|
177
170
|
const isFloatingLabel = hasValue;
|
|
178
171
|
|
|
179
|
-
const labelFontSize = useSharedValue(hasValue ? 10 : 14);
|
|
180
|
-
const labelTop = useSharedValue(hasValue ? 10 : 16);
|
|
181
|
-
|
|
182
|
-
const animatedLabelStyle = useAnimatedStyle(
|
|
183
|
-
() => ({
|
|
184
|
-
fontSize: labelFontSize.value,
|
|
185
|
-
top: labelTop.value,
|
|
186
|
-
}),
|
|
187
|
-
[],
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
useEffect(() => {
|
|
191
|
-
labelFontSize.value = withTiming(isFloatingLabel ? 10 : 14, {
|
|
192
|
-
duration: 200,
|
|
193
|
-
});
|
|
194
|
-
labelTop.value = withTiming(isFloatingLabel ? 10 : 16, {
|
|
195
|
-
duration: 200,
|
|
196
|
-
});
|
|
197
|
-
}, [isFloatingLabel, labelFontSize, labelTop]);
|
|
198
|
-
|
|
199
172
|
const Comp = asChild ? SlotPressable : Pressable;
|
|
200
173
|
|
|
201
174
|
return (
|
|
@@ -206,17 +179,17 @@ export const SelectTrigger: React.FC<SelectTriggerProps> = ({
|
|
|
206
179
|
{...props}
|
|
207
180
|
>
|
|
208
181
|
{finalLabel && (
|
|
209
|
-
<
|
|
182
|
+
<Text
|
|
210
183
|
className={cn(
|
|
211
|
-
'absolute left-16 text-muted w-full',
|
|
184
|
+
'absolute left-16 text-muted w-full transition-all duration-200',
|
|
185
|
+
isFloatingLabel ? 'top-6 body-4' : 'top-14 body-2',
|
|
212
186
|
disabled && 'text-disabled',
|
|
213
187
|
labelClassName,
|
|
214
188
|
)}
|
|
215
|
-
style={animatedLabelStyle}
|
|
216
189
|
numberOfLines={1}
|
|
217
190
|
>
|
|
218
191
|
{finalLabel}
|
|
219
|
-
</
|
|
192
|
+
</Text>
|
|
220
193
|
)}
|
|
221
194
|
<View
|
|
222
195
|
className={cn(
|
|
@@ -22,11 +22,7 @@ export const Base: Story = {
|
|
|
22
22
|
args: {
|
|
23
23
|
size: 40,
|
|
24
24
|
},
|
|
25
|
-
render: (
|
|
26
|
-
<div className='flex items-center justify-center'>
|
|
27
|
-
<Spinner size={size} />
|
|
28
|
-
</div>
|
|
29
|
-
),
|
|
25
|
+
render: (args) => <Spinner {...args} />,
|
|
30
26
|
};
|
|
31
27
|
|
|
32
28
|
export const Sizes: Story = {
|
|
@@ -1,47 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import Svg, { Path, type SvgProps } from 'react-native-svg';
|
|
1
|
+
import { forwardRef, useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated, Easing, View } from 'react-native';
|
|
3
|
+
import Svg, { Path } from 'react-native-svg';
|
|
5
4
|
import { useCommonTranslation } from '../../../i18n';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* The size of the spinner icon in pixels.
|
|
11
|
-
* @default 16
|
|
12
|
-
*/
|
|
13
|
-
size?: IconSize;
|
|
14
|
-
};
|
|
5
|
+
import { LumenStyleSheet } from '../../../styles';
|
|
6
|
+
import { RuntimeConstants } from '../../utils';
|
|
7
|
+
import { Box } from '../Utility';
|
|
8
|
+
import { SpinnerProps } from './types';
|
|
15
9
|
|
|
16
10
|
/**
|
|
17
11
|
* A basic spinner component for loading states.
|
|
18
12
|
*
|
|
19
13
|
* @example
|
|
20
14
|
* <Spinner />
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // With custom color
|
|
18
|
+
* <Spinner color={theme.colors.text.base} />
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // With lx props for layout
|
|
22
|
+
* <Spinner lx={{ marginTop: 's8' }} />
|
|
21
23
|
*/
|
|
22
|
-
export const Spinner = forwardRef<
|
|
23
|
-
({
|
|
24
|
+
export const Spinner = forwardRef<View, SpinnerProps>(
|
|
25
|
+
({ lx, style, size = 16, color, ...props }, ref) => {
|
|
24
26
|
const { t } = useCommonTranslation();
|
|
27
|
+
const { theme } = LumenStyleSheet.useTheme();
|
|
28
|
+
const spinValue = useRef(new Animated.Value(0)).current;
|
|
29
|
+
const strokeColor = color ?? theme.colors.text.base;
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const animation = Animated.loop(
|
|
33
|
+
Animated.timing(spinValue, {
|
|
34
|
+
toValue: 1,
|
|
35
|
+
duration: 1000,
|
|
36
|
+
easing: Easing.linear,
|
|
37
|
+
useNativeDriver: RuntimeConstants.isNative,
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
40
|
+
animation.start();
|
|
41
|
+
|
|
42
|
+
return () => animation.stop();
|
|
43
|
+
}, [spinValue]);
|
|
44
|
+
|
|
45
|
+
const spin = spinValue.interpolate({
|
|
46
|
+
inputRange: [0, 1],
|
|
47
|
+
outputRange: ['0deg', '360deg'],
|
|
48
|
+
});
|
|
49
|
+
|
|
25
50
|
return (
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
</View>
|
|
51
|
+
<Box ref={ref} lx={{ flexShrink: 0, ...lx }} style={style} {...props}>
|
|
52
|
+
<Animated.View style={{ transform: [{ rotate: spin }] }}>
|
|
53
|
+
<Svg
|
|
54
|
+
width={size}
|
|
55
|
+
height={size}
|
|
56
|
+
viewBox='0 0 16 16'
|
|
57
|
+
fill='none'
|
|
58
|
+
accessibilityLabel={t('components.spinner.loadingAriaLabel')}
|
|
59
|
+
>
|
|
60
|
+
<Path
|
|
61
|
+
d='M8 1.5C11.5899 1.5 14.5 4.41015 14.5 8C14.5 11.5899 11.5899 14.5 8 14.5C4.41015 14.5 1.5 11.5899 1.5 8'
|
|
62
|
+
stroke={strokeColor}
|
|
63
|
+
strokeWidth='1.5'
|
|
64
|
+
strokeLinecap='round'
|
|
65
|
+
/>
|
|
66
|
+
</Svg>
|
|
67
|
+
</Animated.View>
|
|
68
|
+
</Box>
|
|
45
69
|
);
|
|
46
70
|
},
|
|
47
71
|
);
|
|
72
|
+
|
|
73
|
+
Spinner.displayName = 'Spinner';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StyledViewProps } from '../../../styles';
|
|
2
|
+
import { IconSize } from '../Icon';
|
|
3
|
+
|
|
4
|
+
export type SpinnerProps = {
|
|
5
|
+
/**
|
|
6
|
+
* The size of the spinner icon in pixels.
|
|
7
|
+
* @default 16
|
|
8
|
+
*/
|
|
9
|
+
size?: IconSize;
|
|
10
|
+
/**
|
|
11
|
+
* The color of the spinner stroke.
|
|
12
|
+
* @default text.base color.
|
|
13
|
+
*/
|
|
14
|
+
color?: string;
|
|
15
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
@@ -151,7 +151,7 @@ Use `defaultChecked` for simple cases:
|
|
|
151
151
|
</div>
|
|
152
152
|
|
|
153
153
|
// ✅ ARIA label for standalone switch
|
|
154
|
-
<Switch
|
|
154
|
+
<Switch accessibilityLabel="Select all items" />
|
|
155
155
|
|
|
156
156
|
// ✅ ARIA described by for complex descriptions
|
|
157
157
|
<div>
|
|
@@ -50,7 +50,7 @@ export const Showcase: Story = {
|
|
|
50
50
|
<Tag appearance='success' label='Success' />
|
|
51
51
|
<Tag appearance='error' label='Error' />
|
|
52
52
|
<Tag appearance='warning' label='Warning' />
|
|
53
|
-
<Tag
|
|
53
|
+
<Tag label='Disabled' disabled />
|
|
54
54
|
</View>
|
|
55
55
|
<View className='flex flex-row gap-4'>
|
|
56
56
|
<Tag appearance='base' label='Base' icon={Check} />
|
|
@@ -59,7 +59,7 @@ export const Showcase: Story = {
|
|
|
59
59
|
<Tag appearance='success' label='Success' icon={Check} />
|
|
60
60
|
<Tag appearance='error' label='Error' icon={Check} />
|
|
61
61
|
<Tag appearance='warning' label='Warning' icon={Check} />
|
|
62
|
-
<Tag
|
|
62
|
+
<Tag label='Disabled' icon={Check} disabled />
|
|
63
63
|
</View>
|
|
64
64
|
</View>
|
|
65
65
|
),
|
|
@@ -17,16 +17,20 @@ const tagVariants = {
|
|
|
17
17
|
success: 'bg-success',
|
|
18
18
|
error: 'bg-error',
|
|
19
19
|
warning: 'bg-warning',
|
|
20
|
-
disabled: 'bg-disabled',
|
|
21
20
|
},
|
|
22
21
|
size: {
|
|
23
22
|
lg: 'h-24 px-8 py-4 body-3',
|
|
24
23
|
sm: 'h-20 px-4 py-2 body-4',
|
|
25
24
|
},
|
|
25
|
+
disabled: {
|
|
26
|
+
true: 'bg-disabled',
|
|
27
|
+
false: '',
|
|
28
|
+
},
|
|
26
29
|
},
|
|
27
30
|
defaultVariants: {
|
|
28
31
|
appearance: 'accent',
|
|
29
32
|
size: 'lg',
|
|
33
|
+
disabled: false,
|
|
30
34
|
},
|
|
31
35
|
},
|
|
32
36
|
),
|
|
@@ -39,14 +43,17 @@ const tagVariants = {
|
|
|
39
43
|
success: 'text-success',
|
|
40
44
|
error: 'text-error',
|
|
41
45
|
warning: 'text-warning',
|
|
42
|
-
|
|
46
|
+
},
|
|
47
|
+
disabled: {
|
|
48
|
+
true: 'text-disabled',
|
|
49
|
+
false: '',
|
|
43
50
|
},
|
|
44
51
|
},
|
|
45
52
|
}),
|
|
46
53
|
};
|
|
47
54
|
|
|
48
55
|
export const Tag = React.forwardRef<View, TagProps>(
|
|
49
|
-
({ className, appearance, size, icon, label, ...props }, ref) => {
|
|
56
|
+
({ className, appearance, size, icon, label, disabled, ...props }, ref) => {
|
|
50
57
|
const iconSizeMap: { [key: string]: IconSize } = {
|
|
51
58
|
lg: 16,
|
|
52
59
|
sm: 12,
|
|
@@ -57,17 +64,26 @@ export const Tag = React.forwardRef<View, TagProps>(
|
|
|
57
64
|
|
|
58
65
|
return (
|
|
59
66
|
<View
|
|
60
|
-
className={cn(
|
|
67
|
+
className={cn(
|
|
68
|
+
className,
|
|
69
|
+
tagVariants.root({ appearance, size, disabled }),
|
|
70
|
+
)}
|
|
61
71
|
ref={ref}
|
|
62
72
|
{...props}
|
|
63
73
|
>
|
|
64
74
|
{IconComponent && (
|
|
65
75
|
<IconComponent
|
|
66
76
|
size={calculatedIconSize}
|
|
67
|
-
className={tagVariants.inner({
|
|
77
|
+
className={tagVariants.inner({
|
|
78
|
+
appearance,
|
|
79
|
+
disabled,
|
|
80
|
+
className: 'shrink-0',
|
|
81
|
+
})}
|
|
68
82
|
/>
|
|
69
83
|
)}
|
|
70
|
-
<Text className={tagVariants.inner({ appearance })}>
|
|
84
|
+
<Text className={tagVariants.inner({ appearance, disabled })}>
|
|
85
|
+
{label}
|
|
86
|
+
</Text>
|
|
71
87
|
</View>
|
|
72
88
|
);
|
|
73
89
|
},
|
|
@@ -6,14 +6,7 @@ export type TagProps = {
|
|
|
6
6
|
/**
|
|
7
7
|
* The appearance of the tag.
|
|
8
8
|
*/
|
|
9
|
-
appearance?:
|
|
10
|
-
| 'base'
|
|
11
|
-
| 'gray'
|
|
12
|
-
| 'accent'
|
|
13
|
-
| 'success'
|
|
14
|
-
| 'error'
|
|
15
|
-
| 'warning'
|
|
16
|
-
| 'disabled';
|
|
9
|
+
appearance?: 'base' | 'gray' | 'accent' | 'success' | 'error' | 'warning';
|
|
17
10
|
/**
|
|
18
11
|
* The icon of the tag.
|
|
19
12
|
*/
|
|
@@ -26,4 +19,10 @@ export type TagProps = {
|
|
|
26
19
|
* The size of the tag.
|
|
27
20
|
*/
|
|
28
21
|
size?: 'sm' | 'lg';
|
|
22
|
+
/**
|
|
23
|
+
* When `true`, prevents the user from interacting with the tag.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
29
28
|
} & ViewProps;
|
|
@@ -19,12 +19,21 @@ It also provides the ability to add custom elements on the right side of the inp
|
|
|
19
19
|
|
|
20
20
|
> View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=6375-6974&m=dev).
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
> ⚠️ **Note on Web Preview:** The Storybook preview below may display visual inconsistencies as certain React Native APIs (such as Reanimated animations) cannot be fully translated to web environments. While the component's functionality should accurately represent the native implementation, it may not render as intended. For the complete native experience, please refer to the component on an actual iOS or Android device.
|
|
23
|
+
|
|
24
|
+
<Canvas of={TextInputStories.Base} />
|
|
25
|
+
<Controls of={TextInputStories.Base} />
|
|
23
26
|
|
|
24
27
|
## Anatomy
|
|
25
28
|
|
|
26
29
|
> **Layout:** The Input component takes the full width of its container by default. You can control the width directly using `className` or by wrapping in a container.
|
|
27
30
|
|
|
31
|
+
### Floating Label
|
|
32
|
+
|
|
33
|
+
The label text automatically floats above the input when content is entered, providing a clean and modern interface.
|
|
34
|
+
|
|
35
|
+
<Canvas of={TextInputStories.WithContent} />
|
|
36
|
+
|
|
28
37
|
### Clear Button
|
|
29
38
|
|
|
30
39
|
A clear button (×) appears **automatically** when input has content.
|
|
@@ -35,14 +44,20 @@ A clear button (×) appears **automatically** when input has content.
|
|
|
35
44
|
|
|
36
45
|
Use `hideClearButton` to prevent the clear button from appearing.
|
|
37
46
|
|
|
47
|
+
<Canvas of={TextInputStories.WithHiddenClearButton} />
|
|
48
|
+
|
|
38
49
|
#### **Extending the Clear Behavior**
|
|
39
50
|
|
|
40
51
|
Use `onClear` to extend the default clear behavior with custom logic.
|
|
41
52
|
|
|
53
|
+
<Canvas of={TextInputStories.WithClearCallback} />
|
|
54
|
+
|
|
42
55
|
### Error State
|
|
43
56
|
|
|
44
57
|
The input supports error handling through `errorMessage` which displays an error message below the input with error styling including a red border and text color.
|
|
45
58
|
|
|
59
|
+
<Canvas of={TextInputStories.WithError} />
|
|
60
|
+
|
|
46
61
|
The error message will be automatically:
|
|
47
62
|
|
|
48
63
|
- Connected to the input
|
|
@@ -54,9 +69,15 @@ The error message will be automatically:
|
|
|
54
69
|
|
|
55
70
|
The input can be disabled using the `editable` prop set to `false`.
|
|
56
71
|
|
|
57
|
-
|
|
72
|
+
<Canvas of={TextInputStories.DisabledTextInput} />
|
|
73
|
+
|
|
74
|
+
### Keyboard Types
|
|
75
|
+
|
|
76
|
+
The component supports various React Native TextInput keyboard types:
|
|
77
|
+
|
|
78
|
+
<Canvas of={TextInputStories.EmailKeyboard} />
|
|
58
79
|
|
|
59
|
-
|
|
80
|
+
<Canvas of={TextInputStories.PhoneKeyboard} />
|
|
60
81
|
|
|
61
82
|
## Controlled vs Uncontrolled
|
|
62
83
|
|
|
@@ -214,7 +235,6 @@ While the component comes with predefined styles, you can extend them using Nati
|
|
|
214
235
|
value={email}
|
|
215
236
|
onChangeText={setEmail}
|
|
216
237
|
className='max-w-md' // Control width
|
|
217
|
-
className='heading-0' // Customize input text style
|
|
218
238
|
/>
|
|
219
239
|
```
|
|
220
240
|
|