@butternutbox/pawprint-native 0.15.2 → 0.16.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@butternutbox/pawprint-native",
3
- "version": "0.15.2",
3
+ "version": "0.16.1",
4
4
  "type": "module",
5
5
  "description": "ButternutBox Pawprint Design System - React Native Components",
6
6
  "main": "./dist/index.cjs",
@@ -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
- }>(({ illustrationHeight }) => ({
27
- alignItems: "center",
28
- justifyContent: "center",
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 { IllustrationProps, PawprintIllustration, IllustrationSize }
121
+ export type {
122
+ IllustrationProps,
123
+ PawprintIllustration,
124
+ IllustrationSize,
125
+ FlexboxProps
126
+ }
@@ -284,14 +284,22 @@ export const NumberFieldInput = React.forwardRef<
284
284
  style={{
285
285
  position: "absolute",
286
286
  bottom: 4,
287
- width: fieldMinWidth,
287
+ // Span the full field (not the min-width) so the help text
288
+ // centres and never wraps into the value when the field is
289
+ // wider than its min-width (e.g. fullWidth) or the copy is long.
290
+ left: 0,
291
+ right: 0,
288
292
  display: "flex",
289
293
  justifyContent: "center",
290
294
  alignItems: "center"
291
295
  }}
292
296
  >
293
297
  <Typography
294
- token={inputTokens.description.text.default}
298
+ token={
299
+ isLarge
300
+ ? tokens.typography.large.secondaryContent
301
+ : tokens.typography.small.smallLabel
302
+ }
295
303
  color={inputTokens.colour.description.default}
296
304
  >
297
305
  {inlineHelpText}