@butternutbox/pawprint-native 0.23.1 → 0.23.3
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 +6 -6
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs +26 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/Button/Button.tsx +20 -23
- package/src/components/atoms/Tag/Tag.tsx +14 -6
- package/src/components/atoms/Typography/Typography.tsx +6 -0
- package/src/components/molecules/TabNavigation/TabNavigation.tsx +6 -2
package/package.json
CHANGED
|
@@ -83,14 +83,6 @@ const StyledButton = styled(Pressable)<{
|
|
|
83
83
|
})
|
|
84
84
|
)
|
|
85
85
|
|
|
86
|
-
const StyledTextWrapper = styled(View)<{
|
|
87
|
-
textOpacity: number
|
|
88
|
-
fullWidth?: boolean
|
|
89
|
-
}>(({ textOpacity, fullWidth }) => ({
|
|
90
|
-
opacity: textOpacity,
|
|
91
|
-
...(fullWidth ? { flex: 1 } : {})
|
|
92
|
-
}))
|
|
93
|
-
|
|
94
86
|
const StyledSpinnerWrapper = styled(View)({
|
|
95
87
|
position: "absolute",
|
|
96
88
|
alignItems: "center",
|
|
@@ -229,21 +221,26 @@ const Button = React.forwardRef<View, ButtonProps>(
|
|
|
229
221
|
{...rest}
|
|
230
222
|
>
|
|
231
223
|
{startIcon && <IconWrapper>{startIcon}</IconWrapper>}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
224
|
+
{/* `Typography` is a DIRECT child of the button row (no wrapping View)
|
|
225
|
+
so its `<Text>` participates in flex shrink and wraps long /
|
|
226
|
+
translated labels to multiple lines under the button's `minHeight`.
|
|
227
|
+
A `<Text>` nested inside an intermediate flex `<View>` does not
|
|
228
|
+
re-wrap once the wrapper resolves its width. Loading hides the label
|
|
229
|
+
via a transparent colour (keeping its footprint) while the spinner
|
|
230
|
+
overlays it. */}
|
|
231
|
+
<Typography
|
|
232
|
+
token={{
|
|
233
|
+
fontFamily: typography.fontFamily,
|
|
234
|
+
fontWeight: typography.fontWeight,
|
|
235
|
+
fontSize: typography.fontSize,
|
|
236
|
+
lineHeight: typography.lineHeight,
|
|
237
|
+
letterSpacing: typography.letterSpacing
|
|
238
|
+
}}
|
|
239
|
+
color={(loading ? "transparent" : variantStyles.textColor) as never}
|
|
240
|
+
align="center"
|
|
241
|
+
>
|
|
242
|
+
{children}
|
|
243
|
+
</Typography>
|
|
247
244
|
{endIcon && <IconWrapper>{endIcon}</IconWrapper>}
|
|
248
245
|
{loading && (
|
|
249
246
|
<StyledSpinnerWrapper>
|
|
@@ -66,6 +66,12 @@ const StyledTag = styled(View)<{
|
|
|
66
66
|
}
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
+
// Lets the label shrink so a long tag wraps within its container instead of
|
|
70
|
+
// growing past it (e.g. long translated copy overflowing a card's padding).
|
|
71
|
+
const StyledLabel = styled(View)({
|
|
72
|
+
flexShrink: 1
|
|
73
|
+
})
|
|
74
|
+
|
|
69
75
|
/**
|
|
70
76
|
* Tag component for labelling and categorising content.
|
|
71
77
|
*
|
|
@@ -118,12 +124,14 @@ export const Tag = React.forwardRef<View, TagProps>(
|
|
|
118
124
|
colour={iconColourMap[variant]}
|
|
119
125
|
/>
|
|
120
126
|
)}
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
<StyledLabel>
|
|
128
|
+
<Typography
|
|
129
|
+
token={typography[size].default}
|
|
130
|
+
color={textColorMap[variant]}
|
|
131
|
+
>
|
|
132
|
+
{children}
|
|
133
|
+
</Typography>
|
|
134
|
+
</StyledLabel>
|
|
127
135
|
</StyledTag>
|
|
128
136
|
)
|
|
129
137
|
}
|
|
@@ -217,6 +217,12 @@ export const Typography = React.forwardRef<Text, TypographyProps>(
|
|
|
217
217
|
} = props
|
|
218
218
|
|
|
219
219
|
const style: TextStyle = {
|
|
220
|
+
// Token-mode text is component-owned and lives inside flex rows
|
|
221
|
+
// (buttons, tabs, tags). `flexShrink` lets it wrap to multiple lines
|
|
222
|
+
// when the row is narrower than the text, instead of laying out on one
|
|
223
|
+
// line and overflowing/clipping — a `<Text>` nested in a flex `<View>`
|
|
224
|
+
// won't re-wrap on its own after the parent's width is resolved.
|
|
225
|
+
flexShrink: 1,
|
|
220
226
|
...nativeTokenToStyle(token),
|
|
221
227
|
...(color ? { color } : {}),
|
|
222
228
|
...getCommonStyles(align, textTransform, textDecoration)
|
|
@@ -114,7 +114,11 @@ const StyledTab = styled(Pressable)<{
|
|
|
114
114
|
alignItems: "center",
|
|
115
115
|
justifyContent: "center",
|
|
116
116
|
gap: tabGap,
|
|
117
|
-
height
|
|
117
|
+
// `minHeight` (not a fixed `height`) so a tab whose label wraps to more
|
|
118
|
+
// than one line — e.g. long translated copy in `fixed` layout — grows to
|
|
119
|
+
// fit instead of clipping/overflowing. The list's `alignItems: "stretch"`
|
|
120
|
+
// then matches every tab to the tallest, keeping labels vertically aligned.
|
|
121
|
+
minHeight: tabHeight,
|
|
118
122
|
minWidth: tabMinWidth,
|
|
119
123
|
paddingTop: tabPaddingTop,
|
|
120
124
|
paddingBottom: tabPaddingBottom,
|
|
@@ -223,7 +227,7 @@ const TabNavigationTab = React.forwardRef<View, TabNavigationTabProps>(
|
|
|
223
227
|
{icon && (
|
|
224
228
|
<Icon icon={icon} customColour={textColour as string} aria-hidden />
|
|
225
229
|
)}
|
|
226
|
-
<Typography token={token} color={textColour}>
|
|
230
|
+
<Typography token={token} color={textColour} align="center">
|
|
227
231
|
{children}
|
|
228
232
|
</Typography>
|
|
229
233
|
</StyledTab>
|