@butternutbox/pawprint-native 0.19.1 → 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 +7 -7
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs +33 -11
- 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 +33 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/NativeSelectPicker/NativeSelectPicker.tsx +9 -2
- 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
|
@@ -9319,6 +9319,7 @@ var NativeSelectPicker = React66.forwardRef(
|
|
|
9319
9319
|
var _a2;
|
|
9320
9320
|
const [isOpen, setIsOpen] = useState(false);
|
|
9321
9321
|
const { iconAnimationStyles } = useIconAnimation();
|
|
9322
|
+
const { height: windowHeight } = useWindowDimensions();
|
|
9322
9323
|
const hasPlaceholder = placeholder && Object.keys(placeholder).length > 0 && placeholder.label !== void 0;
|
|
9323
9324
|
const allItems = useMemo(() => {
|
|
9324
9325
|
var _a3;
|
|
@@ -9433,7 +9434,12 @@ var NativeSelectPicker = React66.forwardRef(
|
|
|
9433
9434
|
);
|
|
9434
9435
|
},
|
|
9435
9436
|
style: {
|
|
9436
|
-
|
|
9437
|
+
// Fill the bottom-sheet dialog (sized 40-80% of the
|
|
9438
|
+
// screen) rather than a tiny fixed cap, so all options
|
|
9439
|
+
// are reachable/scrollable on Android like the iOS
|
|
9440
|
+
// ActionSheet. Previously capped at spacing["8xl"],
|
|
9441
|
+
// which showed only ~1 row.
|
|
9442
|
+
maxHeight: windowHeight * 0.7
|
|
9437
9443
|
}
|
|
9438
9444
|
}
|
|
9439
9445
|
)
|
|
@@ -11993,6 +11999,17 @@ var StyledImage3 = styled51(View)(({ theme: theme2, imageBackgroundColor, thumbn
|
|
|
11993
11999
|
minHeight: thumbnailWidth,
|
|
11994
12000
|
position: "relative"
|
|
11995
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
|
+
});
|
|
11996
12013
|
var StyledContentArea = styled51(View)(({ theme: theme2 }) => {
|
|
11997
12014
|
const { spacing } = theme2.tokens.semantics.dimensions;
|
|
11998
12015
|
const paddingValue = parseTokenValue9(spacing.md);
|
|
@@ -12069,6 +12086,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12069
12086
|
quantity = 1,
|
|
12070
12087
|
onQuantityChange,
|
|
12071
12088
|
showQuantityPicker = false,
|
|
12089
|
+
quantityBadge = false,
|
|
12072
12090
|
disableQuantityButtons = false,
|
|
12073
12091
|
hideQuantityButtons = false,
|
|
12074
12092
|
incrementDisabled = false,
|
|
@@ -12089,6 +12107,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12089
12107
|
"quantity",
|
|
12090
12108
|
"onQuantityChange",
|
|
12091
12109
|
"showQuantityPicker",
|
|
12110
|
+
"quantityBadge",
|
|
12092
12111
|
"disableQuantityButtons",
|
|
12093
12112
|
"hideQuantityButtons",
|
|
12094
12113
|
"incrementDisabled",
|
|
@@ -12115,19 +12134,22 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12115
12134
|
showBanner: showBanner && !!banner
|
|
12116
12135
|
}, rest), {
|
|
12117
12136
|
children: [
|
|
12118
|
-
image && /* @__PURE__ */ jsx(Pressable, { disabled: !onImagePress, onPress: onImagePress, children: /* @__PURE__ */
|
|
12137
|
+
image && /* @__PURE__ */ jsx(Pressable, { disabled: !onImagePress, onPress: onImagePress, children: /* @__PURE__ */ jsxs(
|
|
12119
12138
|
StyledImage3,
|
|
12120
12139
|
{
|
|
12121
12140
|
imageBackgroundColor,
|
|
12122
12141
|
thumbnailWidth,
|
|
12123
|
-
children:
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
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
|
+
]
|
|
12131
12153
|
}
|
|
12132
12154
|
) }),
|
|
12133
12155
|
/* @__PURE__ */ jsxs(StyledContentArea, { children: [
|
|
@@ -12135,7 +12157,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12135
12157
|
/* @__PURE__ */ jsx(Typography, { variant: "heading", size: "2xs", color: "primary", children: title }),
|
|
12136
12158
|
showSubtext && subtext && /* @__PURE__ */ jsx(Typography, { variant: "body", size: "sm", color: "secondary", children: subtext })
|
|
12137
12159
|
] }),
|
|
12138
|
-
showQuantityPicker && /* @__PURE__ */ jsx(View, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(
|
|
12160
|
+
showQuantityPicker && !quantityBadge && /* @__PURE__ */ jsx(View, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(
|
|
12139
12161
|
NumberField,
|
|
12140
12162
|
{
|
|
12141
12163
|
size: "sm",
|