@butternutbox/pawprint-native 0.5.1 → 0.7.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 +15 -15
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +606 -299
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -5
- package/dist/index.d.ts +61 -5
- package/dist/index.js +564 -258
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/ButtonDock/ButtonDock.tsx +10 -4
- package/src/components/molecules/NativeSelectPicker/NativeSelectPicker.stories.tsx +98 -0
- package/src/components/molecules/NativeSelectPicker/NativeSelectPicker.styled.ts +127 -0
- package/src/components/molecules/NativeSelectPicker/NativeSelectPicker.tsx +250 -0
- package/src/components/molecules/NativeSelectPicker/index.ts +5 -0
- package/src/components/molecules/Notification/Notification.tsx +36 -10
- package/src/components/molecules/Radio/Radio.stories.tsx +46 -0
- package/src/components/molecules/Radio/Radio.test.tsx +18 -0
- package/src/components/molecules/Radio/Radio.tsx +19 -1
- package/src/components/molecules/index.ts +1 -0
|
@@ -40,6 +40,24 @@ describe("Radio", () => {
|
|
|
40
40
|
})
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
+
describe("when rendering a tag", () => {
|
|
44
|
+
it("renders the tag when provided", () => {
|
|
45
|
+
renderWithTheme(
|
|
46
|
+
<Radio
|
|
47
|
+
value="chicken"
|
|
48
|
+
label="Chicken"
|
|
49
|
+
tag={{ children: "Save up to £12.20 per box" }}
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
52
|
+
expect(screen.getByText("Save up to £12.20 per box")).toBeInTheDocument()
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it("does not render a tag when omitted", () => {
|
|
56
|
+
renderWithTheme(<Radio value="chicken" label="Chicken" />)
|
|
57
|
+
expect(screen.queryByText("Best value")).not.toBeInTheDocument()
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
|
|
43
61
|
describe("when component is interactive", () => {
|
|
44
62
|
it("calls onSelect when pressed", async () => {
|
|
45
63
|
const user = userEvent.setup()
|
|
@@ -4,6 +4,7 @@ import styled from "@emotion/native"
|
|
|
4
4
|
import { useTheme } from "@emotion/react"
|
|
5
5
|
import { Typography } from "../../atoms/Typography"
|
|
6
6
|
import { Illustration, type IllustrationProps } from "../../atoms/Illustration"
|
|
7
|
+
import { Tag, type TagProps } from "../../atoms/Tag"
|
|
7
8
|
|
|
8
9
|
export type RadioOwnProps = {
|
|
9
10
|
value: string
|
|
@@ -11,6 +12,7 @@ export type RadioOwnProps = {
|
|
|
11
12
|
label?: React.ReactNode
|
|
12
13
|
subText?: React.ReactNode
|
|
13
14
|
asset?: IllustrationProps
|
|
15
|
+
tag?: TagProps
|
|
14
16
|
disabled?: boolean
|
|
15
17
|
selected?: boolean
|
|
16
18
|
onSelect?: (value: string) => void
|
|
@@ -102,6 +104,13 @@ const StyledAssetWrapper = styled(View)({
|
|
|
102
104
|
alignSelf: "center"
|
|
103
105
|
})
|
|
104
106
|
|
|
107
|
+
const StyledTagWrapper = styled(View)<{ tagTopPadding: number }>(
|
|
108
|
+
({ tagTopPadding }) => ({
|
|
109
|
+
alignItems: "flex-start",
|
|
110
|
+
paddingTop: tagTopPadding
|
|
111
|
+
})
|
|
112
|
+
)
|
|
113
|
+
|
|
105
114
|
/**
|
|
106
115
|
* Radio button component for single selection within a group.
|
|
107
116
|
*
|
|
@@ -110,6 +119,7 @@ const StyledAssetWrapper = styled(View)({
|
|
|
110
119
|
* @param {React.ReactNode} [label] - Main label text or content.
|
|
111
120
|
* @param {React.ReactNode} [subText] - Optional descriptive subtext.
|
|
112
121
|
* @param {IllustrationProps} [asset] - Optional illustration asset for tile variant.
|
|
122
|
+
* @param {TagProps} [tag] - Optional tag rendered below the label/subtext. Accepts the full Tag API (variant, icon, size). Hidden when omitted.
|
|
113
123
|
* @param {boolean} [disabled=false] - Whether the radio is disabled.
|
|
114
124
|
* @param {boolean} [selected=false] - Whether the radio is currently selected.
|
|
115
125
|
* @param {(value: string) => void} [onSelect] - Callback when radio is selected.
|
|
@@ -124,6 +134,7 @@ export const Radio = React.forwardRef<View, RadioProps>(
|
|
|
124
134
|
label,
|
|
125
135
|
subText,
|
|
126
136
|
asset,
|
|
137
|
+
tag,
|
|
127
138
|
disabled = false,
|
|
128
139
|
value,
|
|
129
140
|
selected = false,
|
|
@@ -215,7 +226,7 @@ export const Radio = React.forwardRef<View, RadioProps>(
|
|
|
215
226
|
)}
|
|
216
227
|
</StyledRadioControl>
|
|
217
228
|
|
|
218
|
-
{(label || subText) && (
|
|
229
|
+
{(label || subText || tag) && (
|
|
219
230
|
<StyledTextContent
|
|
220
231
|
textContentGap={parseTokenValue(spacing.content.gap)}
|
|
221
232
|
>
|
|
@@ -232,6 +243,13 @@ export const Radio = React.forwardRef<View, RadioProps>(
|
|
|
232
243
|
{subText}
|
|
233
244
|
</Typography>
|
|
234
245
|
)}
|
|
246
|
+
{tag && (
|
|
247
|
+
<StyledTagWrapper
|
|
248
|
+
tagTopPadding={parseTokenValue(spacing.content.tag.topPadding)}
|
|
249
|
+
>
|
|
250
|
+
<Tag {...tag} />
|
|
251
|
+
</StyledTagWrapper>
|
|
252
|
+
)}
|
|
235
253
|
</StyledTextContent>
|
|
236
254
|
)}
|
|
237
255
|
|