@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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAA2B,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Text.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Text/Text.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CAY3B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,IAAI,EAAE,KAiBlB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Text/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type Variant = 'primary' | 'secondary' | 'error';
|
|
2
|
-
type ToRemoveProps = {
|
|
3
|
-
variant?: Variant;
|
|
4
|
-
title?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const ToRemove: ({ variant, title, description, }: ToRemoveProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=ToRemove.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToRemove.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/_ToRemove/ToRemove.tsx"],"names":[],"mappings":"AAIA,KAAK,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAyCjD,KAAK,aAAa,GAAG;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,kCAItB,aAAa,4CASf,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Text, View } from 'react-native';
|
|
3
|
-
import { LumenStyleSheet } from '../../../styles/LumenStyleSheet';
|
|
4
|
-
const useToRemoveStyles = (variant) => {
|
|
5
|
-
return LumenStyleSheet.useCreate((theme) => {
|
|
6
|
-
const bgColorMap = {
|
|
7
|
-
primary: theme.colors.bg.accent,
|
|
8
|
-
secondary: theme.colors.bg.surface,
|
|
9
|
-
error: theme.colors.bg.error,
|
|
10
|
-
};
|
|
11
|
-
const textColorMap = {
|
|
12
|
-
primary: theme.colors.text.onAccent,
|
|
13
|
-
secondary: theme.colors.text.base,
|
|
14
|
-
error: theme.colors.text.error,
|
|
15
|
-
};
|
|
16
|
-
return {
|
|
17
|
-
container: {
|
|
18
|
-
backgroundColor: bgColorMap[variant],
|
|
19
|
-
padding: theme.spacings.s16,
|
|
20
|
-
borderRadius: theme.borderRadius.md,
|
|
21
|
-
gap: theme.spacings.s8,
|
|
22
|
-
boxShadow: theme.shadows.xl,
|
|
23
|
-
shadowColor: theme.colors.border.error,
|
|
24
|
-
elevation: 4,
|
|
25
|
-
width: 200,
|
|
26
|
-
minHeight: 80,
|
|
27
|
-
},
|
|
28
|
-
title: {
|
|
29
|
-
color: textColorMap[variant],
|
|
30
|
-
...theme.typographies.body1SemiBold,
|
|
31
|
-
},
|
|
32
|
-
description: {
|
|
33
|
-
color: textColorMap[variant],
|
|
34
|
-
...theme.typographies.body2,
|
|
35
|
-
opacity: 0.8,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
export const ToRemove = ({ variant = 'primary', title = 'Card Title', description = 'Description text', }) => {
|
|
41
|
-
const styles = useToRemoveStyles(variant);
|
|
42
|
-
return (_jsxs(View, { style: styles.container, children: [_jsx(Text, { style: styles.title, children: title }), _jsx(Text, { style: styles.description, children: description })] }));
|
|
43
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
-
type StyleValue = ViewStyle | TextStyle | ImageStyle;
|
|
3
|
-
type VariantsConfig = Record<string, Record<string, StyleValue>>;
|
|
4
|
-
type CompoundVariantConditions<V extends VariantsConfig> = {
|
|
5
|
-
[K in keyof V]?: keyof V[K];
|
|
6
|
-
};
|
|
7
|
-
type AtLeastOneCondition<V extends VariantsConfig> = {
|
|
8
|
-
[K in keyof V]: Required<Pick<CompoundVariantConditions<V>, K>> & Partial<Omit<CompoundVariantConditions<V>, K>>;
|
|
9
|
-
}[keyof V];
|
|
10
|
-
type CompoundVariant<V extends VariantsConfig> = AtLeastOneCondition<V> & {
|
|
11
|
-
style: StyleValue;
|
|
12
|
-
};
|
|
13
|
-
type VariantConfig<V extends VariantsConfig> = {
|
|
14
|
-
base?: StyleValue;
|
|
15
|
-
variants?: V;
|
|
16
|
-
compoundVariants?: CompoundVariant<V>[];
|
|
17
|
-
defaultVariants?: {
|
|
18
|
-
[K in keyof V]?: keyof V[K];
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
type VariantPropsInput<V extends VariantsConfig> = {
|
|
22
|
-
[K in keyof V]?: keyof V[K];
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Extract variant props type from an sva instance
|
|
26
|
-
*/
|
|
27
|
-
export type VariantProps<T> = T extends (props?: infer P) => StyleValue ? P : never;
|
|
28
|
-
export declare const sva: <V extends VariantsConfig>(config: VariantConfig<V>) => (props?: VariantPropsInput<V>) => StyleValue;
|
|
29
|
-
export {};
|
|
30
|
-
//# sourceMappingURL=styleVarianceAuthority.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styleVarianceAuthority.d.ts","sourceRoot":"","sources":["../../../../src/styles/utils/styleVarianceAuthority.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAErE,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAErD,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjE,KAAK,yBAAyB,CAAC,CAAC,SAAS,cAAc,IAAI;KACxD,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CAC5B,CAAC;AAGF,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAAI;KAClD,CAAC,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAC7D,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACjD,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI,mBAAmB,CAAC,CAAC,CAAC,GAAG;IACxE,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,SAAS,cAAc,IAAI;IAC7C,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,gBAAgB,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,eAAe,CAAC,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;KAAE,CAAC;CACnD,CAAC;AAEF,KAAK,iBAAiB,CAAC,CAAC,SAAS,cAAc,IAAI;KAChD,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,UAAU,GACnE,CAAC,GACD,KAAK,CAAC;AAkDV,eAAO,MAAM,GAAG,GAAI,CAAC,SAAS,cAAc,EAAE,QAAQ,aAAa,CAAC,CAAC,CAAC,MAM5D,QAAQ,iBAAiB,CAAC,CAAC,CAAC,KAAG,UA6DxC,CAAC"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Style Variance Authority - like CVA but for React Native styles
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* const buttonStyles = sva({
|
|
6
|
-
* base: { padding: 16, borderRadius: 8 },
|
|
7
|
-
* variants: {
|
|
8
|
-
* size: {
|
|
9
|
-
* sm: { padding: 8 },
|
|
10
|
-
* lg: { padding: 24 },
|
|
11
|
-
* },
|
|
12
|
-
* intent: {
|
|
13
|
-
* primary: { backgroundColor: 'blue' },
|
|
14
|
-
* danger: { backgroundColor: 'red' },
|
|
15
|
-
* },
|
|
16
|
-
* },
|
|
17
|
-
* compoundVariants: [
|
|
18
|
-
* { size: 'lg', intent: 'danger', style: { borderWidth: 2 } },
|
|
19
|
-
* ],
|
|
20
|
-
* defaultVariants: {
|
|
21
|
-
* size: 'sm',
|
|
22
|
-
* intent: 'primary',
|
|
23
|
-
* },
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* const style = buttonStyles({ size: 'lg' });
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* Filters out undefined values from props to prevent them from overriding defaults
|
|
30
|
-
*/
|
|
31
|
-
const filterUndefinedProps = (props) => {
|
|
32
|
-
if (!props)
|
|
33
|
-
return undefined;
|
|
34
|
-
const result = {};
|
|
35
|
-
const keys = Object.keys(props);
|
|
36
|
-
for (let i = 0; i < keys.length; i++) {
|
|
37
|
-
const key = keys[i];
|
|
38
|
-
if (props[key] !== undefined) {
|
|
39
|
-
result[key] = props[key];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return Object.keys(result).length > 0 ? result : undefined;
|
|
43
|
-
};
|
|
44
|
-
export const sva = (config) => {
|
|
45
|
-
const { base, variants, compoundVariants, defaultVariants } = config;
|
|
46
|
-
// Cache variant keys once - they never change
|
|
47
|
-
const variantKeys = variants ? Object.keys(variants) : [];
|
|
48
|
-
return (props) => {
|
|
49
|
-
// Start with base or empty object
|
|
50
|
-
const result = base ? { ...base } : {};
|
|
51
|
-
// No variants defined - return base
|
|
52
|
-
if (!variants) {
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
// Filter out undefined props to prevent them from overriding defaults
|
|
56
|
-
const filteredProps = filterUndefinedProps(props);
|
|
57
|
-
// Merge props with defaults
|
|
58
|
-
const mergedProps = defaultVariants
|
|
59
|
-
? { ...defaultVariants, ...filteredProps }
|
|
60
|
-
: filteredProps;
|
|
61
|
-
// Apply variant styles
|
|
62
|
-
if (mergedProps) {
|
|
63
|
-
for (let i = 0; i < variantKeys.length; i++) {
|
|
64
|
-
const variantKey = variantKeys[i];
|
|
65
|
-
const variantValue = mergedProps[variantKey];
|
|
66
|
-
if (variantValue !== undefined) {
|
|
67
|
-
const variantStyle = variants[variantKey]?.[variantValue];
|
|
68
|
-
if (variantStyle) {
|
|
69
|
-
Object.assign(result, variantStyle);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
// Apply compound variants (early exit if none)
|
|
75
|
-
if (compoundVariants && compoundVariants.length > 0 && mergedProps) {
|
|
76
|
-
for (let i = 0; i < compoundVariants.length; i++) {
|
|
77
|
-
const compound = compoundVariants[i];
|
|
78
|
-
const { style, ...conditions } = compound;
|
|
79
|
-
// Check if all conditions match
|
|
80
|
-
let matches = true;
|
|
81
|
-
const conditionKeys = Object.keys(conditions);
|
|
82
|
-
for (let j = 0; j < conditionKeys.length; j++) {
|
|
83
|
-
const conditionKey = conditionKeys[j];
|
|
84
|
-
if (mergedProps[conditionKey] !==
|
|
85
|
-
conditions[conditionKey]) {
|
|
86
|
-
matches = false;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (matches) {
|
|
91
|
-
Object.assign(result, style);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Text as RNText } from 'react-native';
|
|
2
|
-
import { createStyledText, type LumenTextStyleProps } from '../../../styles';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Text - A typography component with typo support and token-constrained style props.
|
|
6
|
-
*
|
|
7
|
-
* Text is a wrapper around React Native's Text that accepts a `typo` prop for
|
|
8
|
-
* typography presets, plus design token-based style props for colors, spacing, etc.
|
|
9
|
-
*
|
|
10
|
-
* @see {@link https://ldls.vercel.app/?path=/docs/typography-text--docs Storybook}
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* import { Text } from '@ledgerhq/lumen-ui-rnative';
|
|
15
|
-
*
|
|
16
|
-
* // Basic usage with typography typo
|
|
17
|
-
* <Text typo='body1'>Hello World</Text>
|
|
18
|
-
*
|
|
19
|
-
* // With custom color
|
|
20
|
-
* <Text typo='heading2SemiBold' color='muted'>
|
|
21
|
-
* Subtitle
|
|
22
|
-
* </Text>
|
|
23
|
-
*
|
|
24
|
-
* // With spacing
|
|
25
|
-
* <Text typo='body2' marginTop='s8' color='base'>
|
|
26
|
-
* Description text
|
|
27
|
-
* </Text>
|
|
28
|
-
*
|
|
29
|
-
* // style prop for complete override
|
|
30
|
-
* <Text typo='body1' style={{ letterSpacing: 127 }} />
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export const Text = createStyledText(RNText);
|
|
34
|
-
|
|
35
|
-
export type TextProps = LumenTextStyleProps;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Text, View } from 'react-native';
|
|
2
|
-
import { LumenStyleSheet } from '../../../styles/LumenStyleSheet';
|
|
3
|
-
import { LumenStyleSheetTheme } from '../../../styles/types';
|
|
4
|
-
|
|
5
|
-
type Variant = 'primary' | 'secondary' | 'error';
|
|
6
|
-
|
|
7
|
-
const useToRemoveStyles = (variant: Variant) => {
|
|
8
|
-
return LumenStyleSheet.useCreate((theme: LumenStyleSheetTheme) => {
|
|
9
|
-
const bgColorMap: Record<Variant, string> = {
|
|
10
|
-
primary: theme.colors.bg.accent,
|
|
11
|
-
secondary: theme.colors.bg.surface,
|
|
12
|
-
error: theme.colors.bg.error,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const textColorMap: Record<Variant, string> = {
|
|
16
|
-
primary: theme.colors.text.onAccent,
|
|
17
|
-
secondary: theme.colors.text.base,
|
|
18
|
-
error: theme.colors.text.error,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
container: {
|
|
23
|
-
backgroundColor: bgColorMap[variant],
|
|
24
|
-
padding: theme.spacings.s16,
|
|
25
|
-
borderRadius: theme.borderRadius.md,
|
|
26
|
-
gap: theme.spacings.s8,
|
|
27
|
-
boxShadow: theme.shadows.xl,
|
|
28
|
-
shadowColor: theme.colors.border.error,
|
|
29
|
-
elevation: 4,
|
|
30
|
-
width: 200,
|
|
31
|
-
minHeight: 80,
|
|
32
|
-
},
|
|
33
|
-
title: {
|
|
34
|
-
color: textColorMap[variant],
|
|
35
|
-
...theme.typographies.body1SemiBold,
|
|
36
|
-
},
|
|
37
|
-
description: {
|
|
38
|
-
color: textColorMap[variant],
|
|
39
|
-
...theme.typographies.body2,
|
|
40
|
-
opacity: 0.8,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
type ToRemoveProps = {
|
|
47
|
-
variant?: Variant;
|
|
48
|
-
title?: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const ToRemove = ({
|
|
53
|
-
variant = 'primary',
|
|
54
|
-
title = 'Card Title',
|
|
55
|
-
description = 'Description text',
|
|
56
|
-
}: ToRemoveProps) => {
|
|
57
|
-
const styles = useToRemoveStyles(variant);
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<View style={styles.container}>
|
|
61
|
-
<Text style={styles.title}>{title}</Text>
|
|
62
|
-
<Text style={styles.description}>{description}</Text>
|
|
63
|
-
</View>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from '@jest/globals';
|
|
2
|
-
import { sva, VariantProps } from './styleVarianceAuthority';
|
|
3
|
-
|
|
4
|
-
describe('sva', () => {
|
|
5
|
-
describe('base styles', () => {
|
|
6
|
-
it('should return base styles when no variants', () => {
|
|
7
|
-
const styles = sva({
|
|
8
|
-
base: { padding: 16, borderRadius: 8 },
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
expect(styles()).toEqual({ padding: 16, borderRadius: 8 });
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('should return empty object when no config', () => {
|
|
15
|
-
const styles = sva({});
|
|
16
|
-
|
|
17
|
-
expect(styles()).toEqual({});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('variants', () => {
|
|
22
|
-
it('should apply single variant', () => {
|
|
23
|
-
const styles = sva({
|
|
24
|
-
base: { padding: 16 },
|
|
25
|
-
variants: {
|
|
26
|
-
size: {
|
|
27
|
-
sm: { padding: 8 },
|
|
28
|
-
lg: { padding: 24 },
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
expect(styles({ size: 'sm' })).toEqual({ padding: 8 });
|
|
34
|
-
expect(styles({ size: 'lg' })).toEqual({ padding: 24 });
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should apply multiple variants', () => {
|
|
38
|
-
const styles = sva({
|
|
39
|
-
base: { padding: 16 },
|
|
40
|
-
variants: {
|
|
41
|
-
size: {
|
|
42
|
-
sm: { padding: 8 },
|
|
43
|
-
lg: { padding: 24 },
|
|
44
|
-
},
|
|
45
|
-
intent: {
|
|
46
|
-
primary: { backgroundColor: 'blue' },
|
|
47
|
-
danger: { backgroundColor: 'red' },
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
expect(styles({ size: 'lg', intent: 'danger' })).toEqual({
|
|
53
|
-
padding: 24,
|
|
54
|
-
backgroundColor: 'red',
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('should merge base with variants', () => {
|
|
59
|
-
const styles = sva({
|
|
60
|
-
base: { borderRadius: 8, opacity: 1 },
|
|
61
|
-
variants: {
|
|
62
|
-
size: {
|
|
63
|
-
sm: { padding: 8 },
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
expect(styles({ size: 'sm' })).toEqual({
|
|
69
|
-
borderRadius: 8,
|
|
70
|
-
opacity: 1,
|
|
71
|
-
padding: 8,
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
describe('defaultVariants', () => {
|
|
77
|
-
it('should apply default variants when no props provided', () => {
|
|
78
|
-
const styles = sva({
|
|
79
|
-
base: { borderRadius: 8 },
|
|
80
|
-
variants: {
|
|
81
|
-
size: {
|
|
82
|
-
sm: { padding: 8 },
|
|
83
|
-
lg: { padding: 24 },
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
defaultVariants: {
|
|
87
|
-
size: 'sm',
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
expect(styles()).toEqual({ borderRadius: 8, padding: 8 });
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('should override defaults with provided props', () => {
|
|
95
|
-
const styles = sva({
|
|
96
|
-
variants: {
|
|
97
|
-
size: {
|
|
98
|
-
sm: { padding: 8 },
|
|
99
|
-
lg: { padding: 24 },
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
defaultVariants: {
|
|
103
|
-
size: 'sm',
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
expect(styles({ size: 'lg' })).toEqual({ padding: 24 });
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('should not let explicit undefined override defaults', () => {
|
|
111
|
-
const styles = sva({
|
|
112
|
-
variants: {
|
|
113
|
-
size: {
|
|
114
|
-
sm: { padding: 8 },
|
|
115
|
-
lg: { padding: 24 },
|
|
116
|
-
},
|
|
117
|
-
intent: {
|
|
118
|
-
primary: { backgroundColor: 'blue' },
|
|
119
|
-
danger: { backgroundColor: 'red' },
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
defaultVariants: {
|
|
123
|
-
size: 'sm',
|
|
124
|
-
intent: 'primary',
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// Explicit undefined should fall back to defaults
|
|
129
|
-
expect(styles({ size: undefined })).toEqual({
|
|
130
|
-
padding: 8,
|
|
131
|
-
backgroundColor: 'blue',
|
|
132
|
-
});
|
|
133
|
-
expect(styles({ size: undefined, intent: undefined })).toEqual({
|
|
134
|
-
padding: 8,
|
|
135
|
-
backgroundColor: 'blue',
|
|
136
|
-
});
|
|
137
|
-
// Partial override with explicit undefined on other
|
|
138
|
-
expect(styles({ size: 'lg', intent: undefined })).toEqual({
|
|
139
|
-
padding: 24,
|
|
140
|
-
backgroundColor: 'blue',
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
describe('compoundVariants', () => {
|
|
146
|
-
it('should apply compound variant when conditions match', () => {
|
|
147
|
-
const styles = sva({
|
|
148
|
-
base: { padding: 16 },
|
|
149
|
-
variants: {
|
|
150
|
-
size: {
|
|
151
|
-
sm: { padding: 8 },
|
|
152
|
-
lg: { padding: 24 },
|
|
153
|
-
},
|
|
154
|
-
intent: {
|
|
155
|
-
primary: { backgroundColor: 'blue' },
|
|
156
|
-
danger: { backgroundColor: 'red' },
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
compoundVariants: [
|
|
160
|
-
{ size: 'lg', intent: 'danger', style: { borderWidth: 2 } },
|
|
161
|
-
],
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
expect(styles({ size: 'lg', intent: 'danger' })).toEqual({
|
|
165
|
-
padding: 24,
|
|
166
|
-
backgroundColor: 'red',
|
|
167
|
-
borderWidth: 2,
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it('should not apply compound variant when conditions do not match', () => {
|
|
172
|
-
const styles = sva({
|
|
173
|
-
variants: {
|
|
174
|
-
size: {
|
|
175
|
-
sm: { padding: 8 },
|
|
176
|
-
lg: { padding: 24 },
|
|
177
|
-
},
|
|
178
|
-
intent: {
|
|
179
|
-
primary: { backgroundColor: 'blue' },
|
|
180
|
-
danger: { backgroundColor: 'red' },
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
compoundVariants: [
|
|
184
|
-
{ size: 'lg', intent: 'danger', style: { borderWidth: 2 } },
|
|
185
|
-
],
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
expect(styles({ size: 'lg', intent: 'primary' })).toEqual({
|
|
189
|
-
padding: 24,
|
|
190
|
-
backgroundColor: 'blue',
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it('should apply multiple compound variants', () => {
|
|
195
|
-
const styles = sva({
|
|
196
|
-
variants: {
|
|
197
|
-
size: {
|
|
198
|
-
sm: {},
|
|
199
|
-
lg: {},
|
|
200
|
-
},
|
|
201
|
-
intent: {
|
|
202
|
-
primary: {},
|
|
203
|
-
danger: {},
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
compoundVariants: [
|
|
207
|
-
{ size: 'lg', intent: 'danger', style: { borderWidth: 2 } },
|
|
208
|
-
{ size: 'lg', intent: 'primary', style: { borderWidth: 1 } },
|
|
209
|
-
],
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
expect(styles({ size: 'lg', intent: 'danger' })).toEqual({
|
|
213
|
-
borderWidth: 2,
|
|
214
|
-
});
|
|
215
|
-
expect(styles({ size: 'lg', intent: 'primary' })).toEqual({
|
|
216
|
-
borderWidth: 1,
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
it('should apply compound variants with default variants only', () => {
|
|
221
|
-
const styles = sva({
|
|
222
|
-
base: { borderRadius: 8 },
|
|
223
|
-
variants: {
|
|
224
|
-
size: {
|
|
225
|
-
sm: { padding: 8 },
|
|
226
|
-
lg: { padding: 24 },
|
|
227
|
-
},
|
|
228
|
-
intent: {
|
|
229
|
-
primary: { backgroundColor: 'blue' },
|
|
230
|
-
danger: { backgroundColor: 'red' },
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
defaultVariants: {
|
|
234
|
-
size: 'lg',
|
|
235
|
-
intent: 'danger',
|
|
236
|
-
},
|
|
237
|
-
compoundVariants: [
|
|
238
|
-
{ size: 'lg', intent: 'danger', style: { borderWidth: 2 } },
|
|
239
|
-
],
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
// Calling without props should use defaults and trigger compound variant
|
|
243
|
-
expect(styles()).toEqual({
|
|
244
|
-
borderRadius: 8,
|
|
245
|
-
padding: 24,
|
|
246
|
-
backgroundColor: 'red',
|
|
247
|
-
borderWidth: 2,
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it('should apply compound variants when defaults are partially overridden', () => {
|
|
252
|
-
const styles = sva({
|
|
253
|
-
variants: {
|
|
254
|
-
size: {
|
|
255
|
-
sm: { padding: 8 },
|
|
256
|
-
lg: { padding: 24 },
|
|
257
|
-
},
|
|
258
|
-
intent: {
|
|
259
|
-
primary: { backgroundColor: 'blue' },
|
|
260
|
-
danger: { backgroundColor: 'red' },
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
defaultVariants: {
|
|
264
|
-
size: 'sm',
|
|
265
|
-
intent: 'danger',
|
|
266
|
-
},
|
|
267
|
-
compoundVariants: [
|
|
268
|
-
{ size: 'lg', intent: 'danger', style: { borderWidth: 2 } },
|
|
269
|
-
],
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
// Override size to lg, intent stays at default danger -> compound should match
|
|
273
|
-
expect(styles({ size: 'lg' })).toEqual({
|
|
274
|
-
padding: 24,
|
|
275
|
-
backgroundColor: 'red',
|
|
276
|
-
borderWidth: 2,
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
describe('VariantProps type', () => {
|
|
282
|
-
it('should infer variant props type', () => {
|
|
283
|
-
const styles = sva({
|
|
284
|
-
variants: {
|
|
285
|
-
size: {
|
|
286
|
-
sm: { padding: 8 },
|
|
287
|
-
lg: { padding: 24 },
|
|
288
|
-
},
|
|
289
|
-
intent: {
|
|
290
|
-
primary: { backgroundColor: 'blue' },
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
// Type test - this should compile without errors
|
|
296
|
-
type Props = VariantProps<typeof styles>;
|
|
297
|
-
const props: Props = { size: 'sm', intent: 'primary' };
|
|
298
|
-
|
|
299
|
-
expect(styles(props)).toEqual({ padding: 8, backgroundColor: 'blue' });
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
});
|