@butternutbox/pawprint-native 0.19.2 → 0.20.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 +8 -8
- package/CHANGELOG.md +8 -0
- package/dist/index.cjs +26 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +26 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.stories.tsx +31 -0
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.test.tsx +54 -0
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.tsx +34 -1
package/dist/index.d.cts
CHANGED
|
@@ -2319,6 +2319,13 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2319
2319
|
quantity?: number;
|
|
2320
2320
|
onQuantityChange?: (quantity: number) => void;
|
|
2321
2321
|
showQuantityPicker?: boolean;
|
|
2322
|
+
/**
|
|
2323
|
+
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2324
|
+
* current `quantity`) instead of the quantity picker. Defaults to `false`.
|
|
2325
|
+
* The badge and the quantity picker are mutually exclusive — only one shows
|
|
2326
|
+
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2327
|
+
*/
|
|
2328
|
+
quantityBadge?: boolean;
|
|
2322
2329
|
disableQuantityButtons?: boolean;
|
|
2323
2330
|
hideQuantityButtons?: boolean;
|
|
2324
2331
|
incrementDisabled?: boolean;
|
|
@@ -2354,6 +2361,9 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2354
2361
|
* @param quantity - *(optional)* Current quantity value
|
|
2355
2362
|
* @param onQuantityChange - *(optional)* Callback when quantity changes
|
|
2356
2363
|
* @param showQuantityPicker - *(optional)* Show/hide quantity picker
|
|
2364
|
+
* @param quantityBadge - *(optional)* Show a quantity badge over the image instead
|
|
2365
|
+
* of the picker (renders the current `quantity`). Mutually exclusive with the
|
|
2366
|
+
* quantity picker; defaults to `false`. Used on OOB recipe and Extras cards.
|
|
2357
2367
|
* @param image - *(optional)* Image URL string or React element
|
|
2358
2368
|
* @param banner - *(optional)* Banner content string or React element to show below card
|
|
2359
2369
|
* @param showBanner - *(optional)* Show/hide banner
|
|
@@ -2367,6 +2377,13 @@ declare const ProductDisplayCard: React.ForwardRefExoticComponent<ViewProps & {
|
|
|
2367
2377
|
quantity?: number;
|
|
2368
2378
|
onQuantityChange?: (quantity: number) => void;
|
|
2369
2379
|
showQuantityPicker?: boolean;
|
|
2380
|
+
/**
|
|
2381
|
+
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2382
|
+
* current `quantity`) instead of the quantity picker. Defaults to `false`.
|
|
2383
|
+
* The badge and the quantity picker are mutually exclusive — only one shows
|
|
2384
|
+
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2385
|
+
*/
|
|
2386
|
+
quantityBadge?: boolean;
|
|
2370
2387
|
disableQuantityButtons?: boolean;
|
|
2371
2388
|
hideQuantityButtons?: boolean;
|
|
2372
2389
|
incrementDisabled?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -2319,6 +2319,13 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2319
2319
|
quantity?: number;
|
|
2320
2320
|
onQuantityChange?: (quantity: number) => void;
|
|
2321
2321
|
showQuantityPicker?: boolean;
|
|
2322
|
+
/**
|
|
2323
|
+
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2324
|
+
* current `quantity`) instead of the quantity picker. Defaults to `false`.
|
|
2325
|
+
* The badge and the quantity picker are mutually exclusive — only one shows
|
|
2326
|
+
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2327
|
+
*/
|
|
2328
|
+
quantityBadge?: boolean;
|
|
2322
2329
|
disableQuantityButtons?: boolean;
|
|
2323
2330
|
hideQuantityButtons?: boolean;
|
|
2324
2331
|
incrementDisabled?: boolean;
|
|
@@ -2354,6 +2361,9 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2354
2361
|
* @param quantity - *(optional)* Current quantity value
|
|
2355
2362
|
* @param onQuantityChange - *(optional)* Callback when quantity changes
|
|
2356
2363
|
* @param showQuantityPicker - *(optional)* Show/hide quantity picker
|
|
2364
|
+
* @param quantityBadge - *(optional)* Show a quantity badge over the image instead
|
|
2365
|
+
* of the picker (renders the current `quantity`). Mutually exclusive with the
|
|
2366
|
+
* quantity picker; defaults to `false`. Used on OOB recipe and Extras cards.
|
|
2357
2367
|
* @param image - *(optional)* Image URL string or React element
|
|
2358
2368
|
* @param banner - *(optional)* Banner content string or React element to show below card
|
|
2359
2369
|
* @param showBanner - *(optional)* Show/hide banner
|
|
@@ -2367,6 +2377,13 @@ declare const ProductDisplayCard: React.ForwardRefExoticComponent<ViewProps & {
|
|
|
2367
2377
|
quantity?: number;
|
|
2368
2378
|
onQuantityChange?: (quantity: number) => void;
|
|
2369
2379
|
showQuantityPicker?: boolean;
|
|
2380
|
+
/**
|
|
2381
|
+
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2382
|
+
* current `quantity`) instead of the quantity picker. Defaults to `false`.
|
|
2383
|
+
* The badge and the quantity picker are mutually exclusive — only one shows
|
|
2384
|
+
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2385
|
+
*/
|
|
2386
|
+
quantityBadge?: boolean;
|
|
2370
2387
|
disableQuantityButtons?: boolean;
|
|
2371
2388
|
hideQuantityButtons?: boolean;
|
|
2372
2389
|
incrementDisabled?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -11999,6 +11999,17 @@ var StyledImage3 = styled51(View)(({ theme: theme2, imageBackgroundColor, thumbn
|
|
|
11999
11999
|
minHeight: thumbnailWidth,
|
|
12000
12000
|
position: "relative"
|
|
12001
12001
|
}));
|
|
12002
|
+
var StyledBadgeOverlay = styled51(View)(({ theme: theme2 }) => {
|
|
12003
|
+
const offset = parseTokenValue9(
|
|
12004
|
+
theme2.tokens.semantics.dimensions.spacing["2xs"]
|
|
12005
|
+
);
|
|
12006
|
+
return {
|
|
12007
|
+
position: "absolute",
|
|
12008
|
+
top: offset,
|
|
12009
|
+
right: offset,
|
|
12010
|
+
zIndex: 2
|
|
12011
|
+
};
|
|
12012
|
+
});
|
|
12002
12013
|
var StyledContentArea = styled51(View)(({ theme: theme2 }) => {
|
|
12003
12014
|
const { spacing } = theme2.tokens.semantics.dimensions;
|
|
12004
12015
|
const paddingValue = parseTokenValue9(spacing.md);
|
|
@@ -12075,6 +12086,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12075
12086
|
quantity = 1,
|
|
12076
12087
|
onQuantityChange,
|
|
12077
12088
|
showQuantityPicker = false,
|
|
12089
|
+
quantityBadge = false,
|
|
12078
12090
|
disableQuantityButtons = false,
|
|
12079
12091
|
hideQuantityButtons = false,
|
|
12080
12092
|
incrementDisabled = false,
|
|
@@ -12095,6 +12107,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12095
12107
|
"quantity",
|
|
12096
12108
|
"onQuantityChange",
|
|
12097
12109
|
"showQuantityPicker",
|
|
12110
|
+
"quantityBadge",
|
|
12098
12111
|
"disableQuantityButtons",
|
|
12099
12112
|
"hideQuantityButtons",
|
|
12100
12113
|
"incrementDisabled",
|
|
@@ -12121,19 +12134,22 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12121
12134
|
showBanner: showBanner && !!banner
|
|
12122
12135
|
}, rest), {
|
|
12123
12136
|
children: [
|
|
12124
|
-
image && /* @__PURE__ */ jsx(Pressable, { disabled: !onImagePress, onPress: onImagePress, children: /* @__PURE__ */
|
|
12137
|
+
image && /* @__PURE__ */ jsx(Pressable, { disabled: !onImagePress, onPress: onImagePress, children: /* @__PURE__ */ jsxs(
|
|
12125
12138
|
StyledImage3,
|
|
12126
12139
|
{
|
|
12127
12140
|
imageBackgroundColor,
|
|
12128
12141
|
thumbnailWidth,
|
|
12129
|
-
children:
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12142
|
+
children: [
|
|
12143
|
+
typeof image === "string" ? /* @__PURE__ */ jsx(
|
|
12144
|
+
Image,
|
|
12145
|
+
{
|
|
12146
|
+
source: { uri: image },
|
|
12147
|
+
resizeMode: "cover",
|
|
12148
|
+
style: { flex: 1, width: "100%" }
|
|
12149
|
+
}
|
|
12150
|
+
) : image,
|
|
12151
|
+
quantityBadge && /* @__PURE__ */ jsx(StyledBadgeOverlay, { pointerEvents: "none", children: /* @__PURE__ */ jsx(Badge, { variant: "primary", size: "large", children: String(quantity) }) })
|
|
12152
|
+
]
|
|
12137
12153
|
}
|
|
12138
12154
|
) }),
|
|
12139
12155
|
/* @__PURE__ */ jsxs(StyledContentArea, { children: [
|
|
@@ -12141,7 +12157,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12141
12157
|
/* @__PURE__ */ jsx(Typography, { variant: "heading", size: "2xs", color: "primary", children: title }),
|
|
12142
12158
|
showSubtext && subtext && /* @__PURE__ */ jsx(Typography, { variant: "body", size: "sm", color: "secondary", children: subtext })
|
|
12143
12159
|
] }),
|
|
12144
|
-
showQuantityPicker && /* @__PURE__ */ jsx(View, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(
|
|
12160
|
+
showQuantityPicker && !quantityBadge && /* @__PURE__ */ jsx(View, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(
|
|
12145
12161
|
NumberField,
|
|
12146
12162
|
{
|
|
12147
12163
|
size: "sm",
|