@butternutbox/pawprint-native 0.15.1 → 0.15.2

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.1",
3
+ "version": "0.15.2",
4
4
  "type": "module",
5
5
  "description": "ButternutBox Pawprint Design System - React Native Components",
6
6
  "main": "./dist/index.cjs",
@@ -143,6 +143,27 @@ export const InContext = () => (
143
143
  </View>
144
144
  )
145
145
 
146
+ export const RichText = () => (
147
+ <View style={styles.column}>
148
+ <Typography variant="heading" size="sm">
149
+ Rich text — emphasise part of the copy
150
+ </Typography>
151
+ <Tooltip
152
+ alignment="left"
153
+ position="bottom"
154
+ text={
155
+ <React.Fragment>
156
+ Your order is below{" "}
157
+ <Typography variant="body" weight="bold" size="md">
158
+ £8.00
159
+ </Typography>{" "}
160
+ minimum. Add more items to remove this fee.
161
+ </React.Fragment>
162
+ }
163
+ />
164
+ </View>
165
+ )
166
+
146
167
  const styles = StyleSheet.create({
147
168
  container: {
148
169
  padding: 24,
@@ -12,7 +12,14 @@ type TooltipAlignment = "left" | "middle" | "right"
12
12
  type TooltipPosition = "top" | "bottom"
13
13
 
14
14
  type TooltipOwnProps = {
15
- text: string
15
+ /**
16
+ * Tooltip body content. Pass a plain string for simple copy, or a
17
+ * `ReactNode` (e.g. a `<Trans>` / nested `<Text>`) when part of the text
18
+ * needs its own styling — bold, colour, underline, etc. A node is rendered
19
+ * inside the tooltip's own `<Typography>`, so it inherits the base font and
20
+ * only the emphasised spans override it.
21
+ */
22
+ text: string | React.ReactNode
16
23
  alignment?: TooltipAlignment
17
24
  position?: TooltipPosition
18
25
  /**
@@ -221,7 +228,7 @@ export const Tooltip = React.forwardRef<View, TooltipProps>(
221
228
  ref={ref}
222
229
  accessible={true}
223
230
  accessibilityRole="none"
224
- accessibilityLabel={text}
231
+ accessibilityLabel={typeof text === "string" ? text : undefined}
225
232
  accessibilityLiveRegion="polite"
226
233
  {...props}
227
234
  >