@butternutbox/pawprint-native 0.15.2 → 0.16.0
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +34 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -4
- package/dist/index.d.ts +26 -4
- package/dist/index.js +34 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/Illustration/Illustration.tsx +52 -7
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import { View, ViewProps } from "react-native"
|
|
2
|
+
import { View, ViewProps, FlexStyle } from "react-native"
|
|
3
3
|
import styled from "@emotion/native"
|
|
4
4
|
import { useTheme } from "@emotion/react"
|
|
5
5
|
|
|
@@ -10,11 +10,20 @@ type PawprintIllustration = React.ComponentType<{
|
|
|
10
10
|
height?: number
|
|
11
11
|
}>
|
|
12
12
|
|
|
13
|
+
type FlexboxProps = {
|
|
14
|
+
align?: FlexStyle["alignItems"]
|
|
15
|
+
justify?: FlexStyle["justifyContent"]
|
|
16
|
+
flexDirection?: FlexStyle["flexDirection"]
|
|
17
|
+
flexWrap?: FlexStyle["flexWrap"]
|
|
18
|
+
alignContent?: FlexStyle["alignContent"]
|
|
19
|
+
alignSelf?: FlexStyle["alignSelf"]
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
type IllustrationOwnProps = {
|
|
14
23
|
illustration: PawprintIllustration
|
|
15
24
|
size?: IllustrationSize
|
|
16
25
|
"aria-label"?: string
|
|
17
|
-
}
|
|
26
|
+
} & FlexboxProps
|
|
18
27
|
|
|
19
28
|
type IllustrationProps = IllustrationOwnProps &
|
|
20
29
|
Omit<ViewProps, keyof IllustrationOwnProps>
|
|
@@ -23,15 +32,20 @@ const parseTokenValue = (value: string): number => parseFloat(value)
|
|
|
23
32
|
|
|
24
33
|
const StyledRoot = styled(View)<{
|
|
25
34
|
illustrationHeight: number
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
flexboxProps: FlexboxProps
|
|
36
|
+
}>(({ illustrationHeight, flexboxProps }) => ({
|
|
37
|
+
alignItems: flexboxProps.align ?? "center",
|
|
38
|
+
justifyContent: flexboxProps.justify ?? "center",
|
|
39
|
+
flexDirection: flexboxProps.flexDirection,
|
|
40
|
+
flexWrap: flexboxProps.flexWrap,
|
|
41
|
+
alignContent: flexboxProps.alignContent,
|
|
42
|
+
alignSelf: flexboxProps.alignSelf,
|
|
29
43
|
flexShrink: 0,
|
|
30
44
|
height: illustrationHeight
|
|
31
45
|
}))
|
|
32
46
|
|
|
33
47
|
/**
|
|
34
|
-
* Renders a multi-colour SVG illustration with token-based sizing.
|
|
48
|
+
* Renders a multi-colour SVG illustration with token-based sizing and flexbox alignment.
|
|
35
49
|
*
|
|
36
50
|
* @example
|
|
37
51
|
* ```tsx
|
|
@@ -42,7 +56,17 @@ const StyledRoot = styled(View)<{
|
|
|
42
56
|
* ```
|
|
43
57
|
*
|
|
44
58
|
* @param illustration - **(required)** Illustration component
|
|
59
|
+
<<<<<<< Updated upstream
|
|
45
60
|
* @param size - *(optional)* Size variant: sm (default), lg, xl, xxl, xxxl
|
|
61
|
+
=======
|
|
62
|
+
* @param size - *(optional)* Size variant: sm (default), lg, xl
|
|
63
|
+
* @param align - *(optional)* Flexbox alignItems (default: center)
|
|
64
|
+
* @param justify - *(optional)* Flexbox justifyContent (default: center)
|
|
65
|
+
* @param flexDirection - *(optional)* Flexbox flex direction
|
|
66
|
+
* @param flexWrap - *(optional)* Flexbox wrap
|
|
67
|
+
* @param alignContent - *(optional)* Flexbox alignContent
|
|
68
|
+
* @param alignSelf - *(optional)* Flexbox alignSelf
|
|
69
|
+
>>>>>>> Stashed changes
|
|
46
70
|
* @param aria-label - *(optional)* Accessible label
|
|
47
71
|
*/
|
|
48
72
|
const Illustration = React.forwardRef<View, IllustrationProps>(
|
|
@@ -50,6 +74,12 @@ const Illustration = React.forwardRef<View, IllustrationProps>(
|
|
|
50
74
|
{
|
|
51
75
|
illustration: IllustrationComponent,
|
|
52
76
|
size = "sm",
|
|
77
|
+
align,
|
|
78
|
+
justify,
|
|
79
|
+
flexDirection,
|
|
80
|
+
flexWrap,
|
|
81
|
+
alignContent,
|
|
82
|
+
alignSelf,
|
|
53
83
|
"aria-label": ariaLabel,
|
|
54
84
|
...rest
|
|
55
85
|
},
|
|
@@ -60,10 +90,20 @@ const Illustration = React.forwardRef<View, IllustrationProps>(
|
|
|
60
90
|
theme.tokens.components.illustrations.sizing.illustrations[size]
|
|
61
91
|
)
|
|
62
92
|
|
|
93
|
+
const flexboxProps: FlexboxProps = {
|
|
94
|
+
align,
|
|
95
|
+
justify,
|
|
96
|
+
flexDirection,
|
|
97
|
+
flexWrap,
|
|
98
|
+
alignContent,
|
|
99
|
+
alignSelf
|
|
100
|
+
}
|
|
101
|
+
|
|
63
102
|
return (
|
|
64
103
|
<StyledRoot
|
|
65
104
|
ref={ref}
|
|
66
105
|
illustrationHeight={dimension}
|
|
106
|
+
flexboxProps={flexboxProps}
|
|
67
107
|
accessibilityRole={ariaLabel ? "image" : undefined}
|
|
68
108
|
accessibilityLabel={ariaLabel}
|
|
69
109
|
accessible={!!ariaLabel}
|
|
@@ -78,4 +118,9 @@ const Illustration = React.forwardRef<View, IllustrationProps>(
|
|
|
78
118
|
Illustration.displayName = "Illustration"
|
|
79
119
|
|
|
80
120
|
export { Illustration }
|
|
81
|
-
export type {
|
|
121
|
+
export type {
|
|
122
|
+
IllustrationProps,
|
|
123
|
+
PawprintIllustration,
|
|
124
|
+
IllustrationSize,
|
|
125
|
+
FlexboxProps
|
|
126
|
+
}
|