@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,67 +1,33 @@
|
|
|
1
|
-
import React, { forwardRef, memo
|
|
2
|
-
import
|
|
1
|
+
import React, { forwardRef, memo } from 'react';
|
|
2
|
+
import { StyleSheet, View, type ViewProps } from 'react-native';
|
|
3
3
|
import { useTheme } from '../Provider/useTheme';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '../resolveStyle/resolveStyle';
|
|
8
|
-
import type { LumenViewProps } from '../types';
|
|
4
|
+
import { resolveViewStyle } from '../resolveStyle/resolveStyle';
|
|
5
|
+
import type { LumenViewStyleLX } from '../types';
|
|
6
|
+
import { areLxPropsEqual } from './areLxPropsEqual';
|
|
9
7
|
|
|
10
8
|
type ViewRef = React.ElementRef<typeof View>;
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
React.PropsWithoutRef<LumenViewProps> & React.RefAttributes<ViewRef>
|
|
14
|
-
>
|
|
15
|
-
>;
|
|
9
|
+
export type StyledViewProps = LumenViewStyleLX & ViewProps;
|
|
10
|
+
|
|
16
11
|
/**
|
|
17
12
|
* Factory function to create a styled View component.
|
|
18
13
|
*
|
|
19
|
-
* Creates a component that accepts token-constrained style props directly,
|
|
20
|
-
* resolving them to actual values at runtime using the current theme.
|
|
21
|
-
*
|
|
22
|
-
* @param Component - The base View-like component to wrap
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
14
|
* ```tsx
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* // Create a basic Box
|
|
30
|
-
* const Box = createStyledView(View);
|
|
31
|
-
*
|
|
32
|
-
* // Usage - token props are resolved to actual values
|
|
33
|
-
* <Box width='s400' marginTop='s4' gap='s12' alignItems='center' />
|
|
34
|
-
* <Box padding='s16' backgroundColor='surface' borderRadius='md'>
|
|
35
|
-
* Content
|
|
36
|
-
* </Box>
|
|
37
|
-
*
|
|
38
|
-
* // style prop for escape hatch
|
|
39
|
-
* <Box marginTop='s4' style={{ width: 127 }} />
|
|
15
|
+
* // Create a basic View
|
|
16
|
+
* const StyledView = createStyledView(View);
|
|
40
17
|
* ```
|
|
41
18
|
*/
|
|
42
|
-
export const createStyledView = (
|
|
43
|
-
Component: React.ComponentType<LumenViewProps>,
|
|
44
|
-
): ReturnComponentType => {
|
|
19
|
+
export const createStyledView = (Component: typeof View) => {
|
|
45
20
|
const StyledComponent = memo(
|
|
46
|
-
forwardRef<ViewRef,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const { style: propsStyle, ...componentProps } = rest;
|
|
53
|
-
const style = propsStyle
|
|
54
|
-
? ([resolvedStyle, propsStyle] as ViewStyle[])
|
|
55
|
-
: resolvedStyle;
|
|
21
|
+
forwardRef<ViewRef, StyledViewProps>(
|
|
22
|
+
({ lx = {}, style, ...props }, ref) => {
|
|
23
|
+
const { theme } = useTheme();
|
|
24
|
+
const resolvedStyle = resolveViewStyle(theme, lx);
|
|
25
|
+
const finalStyle = StyleSheet.flatten([resolvedStyle, style]);
|
|
56
26
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})}
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
}),
|
|
27
|
+
return <Component ref={ref} {...props} style={finalStyle} />;
|
|
28
|
+
},
|
|
29
|
+
),
|
|
30
|
+
areLxPropsEqual,
|
|
65
31
|
);
|
|
66
32
|
|
|
67
33
|
// Set display name for debugging
|
package/src/styles/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { LumenStyleSheetProvider } from './Provider/LumenStyleSheetProvider';
|
|
2
2
|
export { LumenStyleSheet } from './LumenStyleSheet';
|
|
3
3
|
export * from './types';
|
|
4
|
-
export * from './factories
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './utils/styleVarianceAuthority';
|
|
4
|
+
export * from './factories';
|
|
5
|
+
export * from './utils';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LumenTextStyle, LumenViewStyle } from '../types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for each style prop
|
|
5
5
|
* - path: Theme path for token lookup (array of keys)
|
|
6
|
-
* - spread: true for props that spread into multiple style properties (
|
|
6
|
+
* - spread: true for props that spread into multiple style properties (typography)
|
|
7
7
|
* - No path = passthrough prop (value passed as-is)
|
|
8
8
|
*/
|
|
9
9
|
export type PropConfig = {
|
|
@@ -14,7 +14,7 @@ export type PropConfig = {
|
|
|
14
14
|
/**
|
|
15
15
|
* View style props configuration
|
|
16
16
|
*/
|
|
17
|
-
export const VIEW_PROP_CONFIG: Record<keyof
|
|
17
|
+
export const VIEW_PROP_CONFIG: Record<keyof LumenViewStyle, PropConfig> = {
|
|
18
18
|
// Spacing props
|
|
19
19
|
padding: { path: ['spacings'] },
|
|
20
20
|
paddingTop: { path: ['spacings'] },
|
|
@@ -37,6 +37,13 @@ export const VIEW_PROP_CONFIG: Record<keyof LumenViewStyleProps, PropConfig> = {
|
|
|
37
37
|
gap: { path: ['spacings'] },
|
|
38
38
|
rowGap: { path: ['spacings'] },
|
|
39
39
|
columnGap: { path: ['spacings'] },
|
|
40
|
+
position: {},
|
|
41
|
+
top: { path: ['spacings'] },
|
|
42
|
+
bottom: { path: ['spacings'] },
|
|
43
|
+
left: { path: ['spacings'] },
|
|
44
|
+
right: { path: ['spacings'] },
|
|
45
|
+
start: { path: ['spacings'] },
|
|
46
|
+
end: { path: ['spacings'] },
|
|
40
47
|
|
|
41
48
|
// Size props
|
|
42
49
|
width: { path: ['sizes'] },
|
|
@@ -88,13 +95,7 @@ export const VIEW_PROP_CONFIG: Record<keyof LumenViewStyleProps, PropConfig> = {
|
|
|
88
95
|
flexGrow: {},
|
|
89
96
|
flexShrink: {},
|
|
90
97
|
flexBasis: {},
|
|
91
|
-
|
|
92
|
-
top: {},
|
|
93
|
-
bottom: {},
|
|
94
|
-
left: {},
|
|
95
|
-
right: {},
|
|
96
|
-
start: {},
|
|
97
|
-
end: {},
|
|
98
|
+
|
|
98
99
|
zIndex: {},
|
|
99
100
|
overflow: {},
|
|
100
101
|
display: {},
|
|
@@ -105,12 +106,12 @@ export const VIEW_PROP_CONFIG: Record<keyof LumenViewStyleProps, PropConfig> = {
|
|
|
105
106
|
} as const;
|
|
106
107
|
|
|
107
108
|
/**
|
|
108
|
-
* Text style props configuration (extends view props + color +
|
|
109
|
+
* Text style props configuration (extends view props + color + typography)
|
|
109
110
|
*/
|
|
110
|
-
export const TEXT_PROP_CONFIG: Record<keyof
|
|
111
|
+
export const TEXT_PROP_CONFIG: Record<keyof LumenTextStyle, PropConfig> = {
|
|
111
112
|
...VIEW_PROP_CONFIG,
|
|
112
113
|
color: { path: ['colors', 'text'] },
|
|
113
|
-
|
|
114
|
+
typography: { path: ['typographies'], spread: true },
|
|
114
115
|
textAlign: {},
|
|
115
116
|
textTransform: {},
|
|
116
117
|
textDecorationLine: {},
|
|
@@ -121,11 +122,11 @@ export const TEXT_PROP_CONFIG: Record<keyof LumenTextStyleProps, PropConfig> = {
|
|
|
121
122
|
*/
|
|
122
123
|
export const LUMEN_VIEW_STYLE_PROPS = new Set(
|
|
123
124
|
Object.keys(VIEW_PROP_CONFIG),
|
|
124
|
-
) as Set<keyof
|
|
125
|
+
) as Set<keyof LumenViewStyle>;
|
|
125
126
|
|
|
126
127
|
/**
|
|
127
128
|
* Set for O(1) text prop lookup
|
|
128
129
|
*/
|
|
129
130
|
export const LUMEN_TEXT_STYLE_PROPS = new Set(
|
|
130
131
|
Object.keys(TEXT_PROP_CONFIG),
|
|
131
|
-
) as Set<keyof
|
|
132
|
+
) as Set<keyof LumenTextStyle>;
|
|
@@ -2,12 +2,7 @@ import { describe, expect, it } from '@jest/globals';
|
|
|
2
2
|
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
3
|
import type { BoxShadowValue } from 'react-native';
|
|
4
4
|
import { createStylesheetTheme } from '../Provider/createStylesheetTheme';
|
|
5
|
-
import {
|
|
6
|
-
resolveViewStyle,
|
|
7
|
-
resolveTextStyle,
|
|
8
|
-
extractLumenViewStyleProps,
|
|
9
|
-
extractLumenTextStyleProps,
|
|
10
|
-
} from './resolveStyle';
|
|
5
|
+
import { resolveViewStyle, resolveTextStyle } from './resolveStyle';
|
|
11
6
|
|
|
12
7
|
/**
|
|
13
8
|
* Use actual theme from design-core for type-safe testing
|
|
@@ -306,17 +301,17 @@ describe('resolve-style', () => {
|
|
|
306
301
|
it('should pass through position props unchanged', () => {
|
|
307
302
|
const result = resolveViewStyle(mockTheme, {
|
|
308
303
|
position: 'absolute',
|
|
309
|
-
top:
|
|
310
|
-
bottom:
|
|
311
|
-
left:
|
|
312
|
-
right:
|
|
304
|
+
top: 's10',
|
|
305
|
+
bottom: 's20',
|
|
306
|
+
left: 's32',
|
|
307
|
+
right: 's40',
|
|
313
308
|
zIndex: 100,
|
|
314
309
|
});
|
|
315
310
|
|
|
316
311
|
expect(result.position).toBe('absolute');
|
|
317
312
|
expect(result.top).toBe(10);
|
|
318
313
|
expect(result.bottom).toBe(20);
|
|
319
|
-
expect(result.left).toBe(
|
|
314
|
+
expect(result.left).toBe(32);
|
|
320
315
|
expect(result.right).toBe(40);
|
|
321
316
|
expect(result.zIndex).toBe(100);
|
|
322
317
|
});
|
|
@@ -324,8 +319,8 @@ describe('resolve-style', () => {
|
|
|
324
319
|
it('should pass through RTL position props unchanged', () => {
|
|
325
320
|
const result = resolveViewStyle(mockTheme, {
|
|
326
321
|
position: 'absolute',
|
|
327
|
-
start:
|
|
328
|
-
end:
|
|
322
|
+
start: 's10',
|
|
323
|
+
end: 's20',
|
|
329
324
|
});
|
|
330
325
|
|
|
331
326
|
expect(result.position).toBe('absolute');
|
|
@@ -440,8 +435,8 @@ describe('resolve-style', () => {
|
|
|
440
435
|
expect(result.color).toBe(mockTheme.colors.text.muted);
|
|
441
436
|
});
|
|
442
437
|
|
|
443
|
-
it('should resolve typography
|
|
444
|
-
const result = resolveTextStyle(mockTheme, {
|
|
438
|
+
it('should resolve typography typography', () => {
|
|
439
|
+
const result = resolveTextStyle(mockTheme, { typography: 'body1' });
|
|
445
440
|
|
|
446
441
|
expect(result.fontSize).toBe(mockTheme.typographies.body1.fontSize);
|
|
447
442
|
expect(result.fontWeight).toBe(mockTheme.typographies.body1.fontWeight);
|
|
@@ -456,7 +451,7 @@ describe('resolve-style', () => {
|
|
|
456
451
|
color: 'active',
|
|
457
452
|
marginTop: 's8',
|
|
458
453
|
padding: 's4',
|
|
459
|
-
|
|
454
|
+
typography: 'heading1',
|
|
460
455
|
});
|
|
461
456
|
|
|
462
457
|
expect(result.color).toBe(mockTheme.colors.text.active);
|
|
@@ -471,7 +466,7 @@ describe('resolve-style', () => {
|
|
|
471
466
|
);
|
|
472
467
|
});
|
|
473
468
|
|
|
474
|
-
it('should handle text without
|
|
469
|
+
it('should handle text without typography', () => {
|
|
475
470
|
const result = resolveTextStyle(mockTheme, {
|
|
476
471
|
color: 'base',
|
|
477
472
|
padding: 's8',
|
|
@@ -509,7 +504,7 @@ describe('resolve-style', () => {
|
|
|
509
504
|
it('should combine all text style props', () => {
|
|
510
505
|
const result = resolveTextStyle(mockTheme, {
|
|
511
506
|
color: 'active',
|
|
512
|
-
|
|
507
|
+
typography: 'body1',
|
|
513
508
|
textAlign: 'center',
|
|
514
509
|
textTransform: 'uppercase',
|
|
515
510
|
textDecorationLine: 'underline',
|
|
@@ -522,127 +517,4 @@ describe('resolve-style', () => {
|
|
|
522
517
|
expect(result.textDecorationLine).toBe('underline');
|
|
523
518
|
});
|
|
524
519
|
});
|
|
525
|
-
|
|
526
|
-
describe('extractLumenViewStyleProps', () => {
|
|
527
|
-
it('should extract spacing props from mixed props', () => {
|
|
528
|
-
const props = {
|
|
529
|
-
padding: 's16',
|
|
530
|
-
marginTop: 's8',
|
|
531
|
-
customProp: 'test-value',
|
|
532
|
-
callback: () => 'result',
|
|
533
|
-
} as const;
|
|
534
|
-
|
|
535
|
-
const { lumenStyle, rest } = extractLumenViewStyleProps(props);
|
|
536
|
-
|
|
537
|
-
expect(lumenStyle.padding).toBe('s16');
|
|
538
|
-
expect(lumenStyle.marginTop).toBe('s8');
|
|
539
|
-
expect(rest).toEqual({
|
|
540
|
-
customProp: 'test-value',
|
|
541
|
-
callback: expect.any(Function),
|
|
542
|
-
});
|
|
543
|
-
});
|
|
544
|
-
|
|
545
|
-
it('should extract all style props', () => {
|
|
546
|
-
const props = {
|
|
547
|
-
padding: 's16',
|
|
548
|
-
width: 's192',
|
|
549
|
-
backgroundColor: 'surface',
|
|
550
|
-
borderColor: 'muted',
|
|
551
|
-
borderRadius: 'md',
|
|
552
|
-
boxShadow: 'sm',
|
|
553
|
-
flex: 1,
|
|
554
|
-
flexDirection: 'row',
|
|
555
|
-
customProp: 'test',
|
|
556
|
-
} as const;
|
|
557
|
-
|
|
558
|
-
const { lumenStyle, rest } = extractLumenViewStyleProps(props);
|
|
559
|
-
|
|
560
|
-
expect(lumenStyle).toEqual({
|
|
561
|
-
padding: 's16',
|
|
562
|
-
width: 's192',
|
|
563
|
-
backgroundColor: 'surface',
|
|
564
|
-
borderColor: 'muted',
|
|
565
|
-
borderRadius: 'md',
|
|
566
|
-
boxShadow: 'sm',
|
|
567
|
-
flex: 1,
|
|
568
|
-
flexDirection: 'row',
|
|
569
|
-
});
|
|
570
|
-
expect(rest).toEqual({ customProp: 'test' });
|
|
571
|
-
});
|
|
572
|
-
|
|
573
|
-
it('should handle empty props', () => {
|
|
574
|
-
const { lumenStyle, rest } = extractLumenViewStyleProps({});
|
|
575
|
-
|
|
576
|
-
expect(lumenStyle).toEqual({});
|
|
577
|
-
expect(rest).toEqual({});
|
|
578
|
-
});
|
|
579
|
-
|
|
580
|
-
it('should handle props with no style props', () => {
|
|
581
|
-
const props = {
|
|
582
|
-
customProp: 'test',
|
|
583
|
-
anotherProp: true,
|
|
584
|
-
padding: undefined,
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
const { lumenStyle, rest } = extractLumenViewStyleProps(props);
|
|
588
|
-
|
|
589
|
-
expect(lumenStyle).toEqual({ padding: undefined });
|
|
590
|
-
expect(rest).toEqual({
|
|
591
|
-
customProp: 'test',
|
|
592
|
-
anotherProp: true,
|
|
593
|
-
});
|
|
594
|
-
});
|
|
595
|
-
});
|
|
596
|
-
|
|
597
|
-
describe('extractLumenTextStyleProps', () => {
|
|
598
|
-
it('should extract color prop in addition to view style props', () => {
|
|
599
|
-
const props = {
|
|
600
|
-
color: 'muted',
|
|
601
|
-
padding: 's8',
|
|
602
|
-
customProp: 'test-text',
|
|
603
|
-
} as const;
|
|
604
|
-
|
|
605
|
-
const { lumenStyle, rest } = extractLumenTextStyleProps(props);
|
|
606
|
-
|
|
607
|
-
expect(lumenStyle.color).toBe('muted');
|
|
608
|
-
expect(lumenStyle.padding).toBe('s8');
|
|
609
|
-
expect(rest).toEqual({ customProp: 'test-text' });
|
|
610
|
-
});
|
|
611
|
-
|
|
612
|
-
it('should extract typo prop', () => {
|
|
613
|
-
const props = {
|
|
614
|
-
typo: 'body1',
|
|
615
|
-
color: 'muted',
|
|
616
|
-
customProp: 'test',
|
|
617
|
-
} as const;
|
|
618
|
-
|
|
619
|
-
const { lumenStyle, rest } = extractLumenTextStyleProps(props);
|
|
620
|
-
|
|
621
|
-
expect(lumenStyle.typo).toBe('body1');
|
|
622
|
-
expect(lumenStyle.color).toBe('muted');
|
|
623
|
-
expect(rest).toEqual({ customProp: 'test' });
|
|
624
|
-
});
|
|
625
|
-
|
|
626
|
-
it('should extract all text style props', () => {
|
|
627
|
-
const props = {
|
|
628
|
-
typo: 'heading1',
|
|
629
|
-
color: 'active',
|
|
630
|
-
padding: 's16',
|
|
631
|
-
marginTop: 's8',
|
|
632
|
-
backgroundColor: 'surface',
|
|
633
|
-
customProp: 2,
|
|
634
|
-
} as const;
|
|
635
|
-
|
|
636
|
-
const { lumenStyle, rest } = extractLumenTextStyleProps(props);
|
|
637
|
-
|
|
638
|
-
expect(lumenStyle).toEqual({
|
|
639
|
-
typo: 'heading1',
|
|
640
|
-
color: 'active',
|
|
641
|
-
padding: 's16',
|
|
642
|
-
marginTop: 's8',
|
|
643
|
-
backgroundColor: 'surface',
|
|
644
|
-
});
|
|
645
|
-
expect(rest).toEqual({ customProp: 2 });
|
|
646
|
-
});
|
|
647
|
-
});
|
|
648
520
|
});
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { getObjectPath } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
-
import type { ViewStyle, TextStyle
|
|
2
|
+
import type { ViewStyle, TextStyle } from 'react-native';
|
|
3
3
|
import type {
|
|
4
4
|
LumenStyleSheetTheme,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
LumenTextStyle,
|
|
6
|
+
LumenViewStyle,
|
|
7
7
|
} from '../types';
|
|
8
|
-
import {
|
|
9
|
-
VIEW_PROP_CONFIG,
|
|
10
|
-
TEXT_PROP_CONFIG,
|
|
11
|
-
LUMEN_VIEW_STYLE_PROPS,
|
|
12
|
-
LUMEN_TEXT_STYLE_PROPS,
|
|
13
|
-
} from './resolveConfig';
|
|
8
|
+
import { VIEW_PROP_CONFIG, TEXT_PROP_CONFIG } from './resolveConfig';
|
|
14
9
|
|
|
15
10
|
/**
|
|
16
11
|
* Unified style resolver
|
|
@@ -18,7 +13,7 @@ import {
|
|
|
18
13
|
*/
|
|
19
14
|
const resolveStyle = <T extends ViewStyle | TextStyle>(
|
|
20
15
|
theme: LumenStyleSheetTheme,
|
|
21
|
-
lumenStyle:
|
|
16
|
+
lumenStyle: LumenViewStyle | LumenTextStyle,
|
|
22
17
|
config: typeof VIEW_PROP_CONFIG | typeof TEXT_PROP_CONFIG,
|
|
23
18
|
): T => {
|
|
24
19
|
const resolved: Record<string, unknown> = {};
|
|
@@ -39,7 +34,7 @@ const resolveStyle = <T extends ViewStyle | TextStyle>(
|
|
|
39
34
|
value as string,
|
|
40
35
|
]);
|
|
41
36
|
|
|
42
|
-
// Spread props (like
|
|
37
|
+
// Spread props (like typography) merge into resolved styles
|
|
43
38
|
if (propConfig.spread && resolvedValue) {
|
|
44
39
|
Object.assign(resolved, resolvedValue);
|
|
45
40
|
} else {
|
|
@@ -51,62 +46,17 @@ const resolveStyle = <T extends ViewStyle | TextStyle>(
|
|
|
51
46
|
};
|
|
52
47
|
|
|
53
48
|
/**
|
|
54
|
-
*
|
|
49
|
+
* Transform lx props to StyleSheet style object for View
|
|
55
50
|
*/
|
|
56
51
|
export const resolveViewStyle = (
|
|
57
52
|
theme: LumenStyleSheetTheme,
|
|
58
|
-
lumenStyle:
|
|
53
|
+
lumenStyle: LumenViewStyle,
|
|
59
54
|
): ViewStyle => resolveStyle<ViewStyle>(theme, lumenStyle, VIEW_PROP_CONFIG);
|
|
60
55
|
|
|
61
56
|
/**
|
|
62
|
-
*
|
|
57
|
+
* Transform lx props to StyleSheet style object for Text
|
|
63
58
|
*/
|
|
64
59
|
export const resolveTextStyle = (
|
|
65
60
|
theme: LumenStyleSheetTheme,
|
|
66
|
-
lumenStyle:
|
|
61
|
+
lumenStyle: LumenTextStyle,
|
|
67
62
|
): TextStyle => resolveStyle<TextStyle>(theme, lumenStyle, TEXT_PROP_CONFIG);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Unified style props extractor
|
|
71
|
-
* Loops only through input props with O(1) Set lookup
|
|
72
|
-
*/
|
|
73
|
-
const extractStyleProps = <
|
|
74
|
-
StyleProps,
|
|
75
|
-
RestProps,
|
|
76
|
-
ReturnType = {
|
|
77
|
-
lumenStyle: StyleProps;
|
|
78
|
-
rest: RestProps;
|
|
79
|
-
},
|
|
80
|
-
>(
|
|
81
|
-
props: Record<string, unknown>,
|
|
82
|
-
stylePropsSet: Set<string>,
|
|
83
|
-
): ReturnType => {
|
|
84
|
-
const lumenStyle: Record<string, unknown> = {};
|
|
85
|
-
const rest: Record<string, unknown> = {};
|
|
86
|
-
|
|
87
|
-
for (const key of Object.keys(props)) {
|
|
88
|
-
if (stylePropsSet.has(key)) {
|
|
89
|
-
lumenStyle[key] = props[key];
|
|
90
|
-
} else {
|
|
91
|
-
rest[key] = props[key];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return { lumenStyle, rest } as ReturnType;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Extract styled view props from component props
|
|
100
|
-
*/
|
|
101
|
-
export const extractLumenViewStyleProps = (
|
|
102
|
-
props: LumenViewStyleProps,
|
|
103
|
-
): { lumenStyle: LumenViewStyleProps; rest: ViewProps } =>
|
|
104
|
-
extractStyleProps(props as Record<string, unknown>, LUMEN_VIEW_STYLE_PROPS);
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Extract styled text props from component props
|
|
108
|
-
*/
|
|
109
|
-
export const extractLumenTextStyleProps = (
|
|
110
|
-
props: LumenTextStyleProps,
|
|
111
|
-
): { lumenStyle: LumenTextStyleProps; rest: TextProps } =>
|
|
112
|
-
extractStyleProps(props as Record<string, unknown>, LUMEN_TEXT_STYLE_PROPS);
|