@butternutbox/pawprint-native 1.0.0 → 1.1.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 +10 -0
- package/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.stories.tsx +40 -5
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.test.tsx +55 -0
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.tsx +35 -9
package/dist/index.d.cts
CHANGED
|
@@ -2347,12 +2347,25 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2347
2347
|
onQuantityChange?: (quantity: number) => void;
|
|
2348
2348
|
showQuantityPicker?: boolean;
|
|
2349
2349
|
/**
|
|
2350
|
+
* @deprecated Use `thumbnailBadge` instead. When both are set, `thumbnailBadge`
|
|
2351
|
+
* wins. This prop will be removed in a future major release.
|
|
2352
|
+
*
|
|
2350
2353
|
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2351
2354
|
* current `quantity`) instead of the quantity picker. Defaults to `false`.
|
|
2352
2355
|
* The badge and the quantity picker are mutually exclusive — only one shows
|
|
2353
2356
|
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2354
2357
|
*/
|
|
2355
2358
|
quantityBadge?: boolean;
|
|
2359
|
+
/**
|
|
2360
|
+
* Render a `Badge` overlaid on the top-right of the image. Accepts any
|
|
2361
|
+
* `BadgeProps` (variant, size, icon, children, etc.) — pass them as an object.
|
|
2362
|
+
* Mutually exclusive with the quantity picker: when set, the picker is never
|
|
2363
|
+
* rendered.
|
|
2364
|
+
*
|
|
2365
|
+
* @example
|
|
2366
|
+
* thumbnailBadge={{ variant: "primary", size: "large", children: "New" }}
|
|
2367
|
+
*/
|
|
2368
|
+
thumbnailBadge?: BadgeProps;
|
|
2356
2369
|
disableQuantityButtons?: boolean;
|
|
2357
2370
|
hideQuantityButtons?: boolean;
|
|
2358
2371
|
incrementDisabled?: boolean;
|
|
@@ -2389,9 +2402,14 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2389
2402
|
* @param quantity - *(optional)* Current quantity value
|
|
2390
2403
|
* @param onQuantityChange - *(optional)* Callback when quantity changes
|
|
2391
2404
|
* @param showQuantityPicker - *(optional)* Show/hide quantity picker
|
|
2392
|
-
* @param quantityBadge - *(optional)*
|
|
2393
|
-
*
|
|
2394
|
-
*
|
|
2405
|
+
* @param quantityBadge - *(optional)* **@deprecated** — use `thumbnailBadge` instead.
|
|
2406
|
+
* Show a legacy quantity badge over the image (renders the current `quantity`
|
|
2407
|
+
* as a primary/large Badge). Mutually exclusive with the picker; defaults to
|
|
2408
|
+
* `false`. When both `thumbnailBadge` and `quantityBadge` are set, `thumbnailBadge`
|
|
2409
|
+
* wins.
|
|
2410
|
+
* @param thumbnailBadge - *(optional)* Render a `Badge` overlaid on the top-right
|
|
2411
|
+
* of the image. Accepts any `BadgeProps` (`variant`, `size`, `icon`, `children`, …).
|
|
2412
|
+
* Mutually exclusive with the quantity picker.
|
|
2395
2413
|
* @param quantityStep - *(optional)* Increment/decrement amount (default: 1)
|
|
2396
2414
|
* @param image - *(optional)* Image URL string or React element
|
|
2397
2415
|
* @param banner - *(optional)* Banner content string or React element to show below card
|
|
@@ -2407,12 +2425,25 @@ declare const ProductDisplayCard: React.ForwardRefExoticComponent<ViewProps & {
|
|
|
2407
2425
|
onQuantityChange?: (quantity: number) => void;
|
|
2408
2426
|
showQuantityPicker?: boolean;
|
|
2409
2427
|
/**
|
|
2428
|
+
* @deprecated Use `thumbnailBadge` instead. When both are set, `thumbnailBadge`
|
|
2429
|
+
* wins. This prop will be removed in a future major release.
|
|
2430
|
+
*
|
|
2410
2431
|
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2411
2432
|
* current `quantity`) instead of the quantity picker. Defaults to `false`.
|
|
2412
2433
|
* The badge and the quantity picker are mutually exclusive — only one shows
|
|
2413
2434
|
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2414
2435
|
*/
|
|
2415
2436
|
quantityBadge?: boolean;
|
|
2437
|
+
/**
|
|
2438
|
+
* Render a `Badge` overlaid on the top-right of the image. Accepts any
|
|
2439
|
+
* `BadgeProps` (variant, size, icon, children, etc.) — pass them as an object.
|
|
2440
|
+
* Mutually exclusive with the quantity picker: when set, the picker is never
|
|
2441
|
+
* rendered.
|
|
2442
|
+
*
|
|
2443
|
+
* @example
|
|
2444
|
+
* thumbnailBadge={{ variant: "primary", size: "large", children: "New" }}
|
|
2445
|
+
*/
|
|
2446
|
+
thumbnailBadge?: BadgeProps;
|
|
2416
2447
|
disableQuantityButtons?: boolean;
|
|
2417
2448
|
hideQuantityButtons?: boolean;
|
|
2418
2449
|
incrementDisabled?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -2347,12 +2347,25 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2347
2347
|
onQuantityChange?: (quantity: number) => void;
|
|
2348
2348
|
showQuantityPicker?: boolean;
|
|
2349
2349
|
/**
|
|
2350
|
+
* @deprecated Use `thumbnailBadge` instead. When both are set, `thumbnailBadge`
|
|
2351
|
+
* wins. This prop will be removed in a future major release.
|
|
2352
|
+
*
|
|
2350
2353
|
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2351
2354
|
* current `quantity`) instead of the quantity picker. Defaults to `false`.
|
|
2352
2355
|
* The badge and the quantity picker are mutually exclusive — only one shows
|
|
2353
2356
|
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2354
2357
|
*/
|
|
2355
2358
|
quantityBadge?: boolean;
|
|
2359
|
+
/**
|
|
2360
|
+
* Render a `Badge` overlaid on the top-right of the image. Accepts any
|
|
2361
|
+
* `BadgeProps` (variant, size, icon, children, etc.) — pass them as an object.
|
|
2362
|
+
* Mutually exclusive with the quantity picker: when set, the picker is never
|
|
2363
|
+
* rendered.
|
|
2364
|
+
*
|
|
2365
|
+
* @example
|
|
2366
|
+
* thumbnailBadge={{ variant: "primary", size: "large", children: "New" }}
|
|
2367
|
+
*/
|
|
2368
|
+
thumbnailBadge?: BadgeProps;
|
|
2356
2369
|
disableQuantityButtons?: boolean;
|
|
2357
2370
|
hideQuantityButtons?: boolean;
|
|
2358
2371
|
incrementDisabled?: boolean;
|
|
@@ -2389,9 +2402,14 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2389
2402
|
* @param quantity - *(optional)* Current quantity value
|
|
2390
2403
|
* @param onQuantityChange - *(optional)* Callback when quantity changes
|
|
2391
2404
|
* @param showQuantityPicker - *(optional)* Show/hide quantity picker
|
|
2392
|
-
* @param quantityBadge - *(optional)*
|
|
2393
|
-
*
|
|
2394
|
-
*
|
|
2405
|
+
* @param quantityBadge - *(optional)* **@deprecated** — use `thumbnailBadge` instead.
|
|
2406
|
+
* Show a legacy quantity badge over the image (renders the current `quantity`
|
|
2407
|
+
* as a primary/large Badge). Mutually exclusive with the picker; defaults to
|
|
2408
|
+
* `false`. When both `thumbnailBadge` and `quantityBadge` are set, `thumbnailBadge`
|
|
2409
|
+
* wins.
|
|
2410
|
+
* @param thumbnailBadge - *(optional)* Render a `Badge` overlaid on the top-right
|
|
2411
|
+
* of the image. Accepts any `BadgeProps` (`variant`, `size`, `icon`, `children`, …).
|
|
2412
|
+
* Mutually exclusive with the quantity picker.
|
|
2395
2413
|
* @param quantityStep - *(optional)* Increment/decrement amount (default: 1)
|
|
2396
2414
|
* @param image - *(optional)* Image URL string or React element
|
|
2397
2415
|
* @param banner - *(optional)* Banner content string or React element to show below card
|
|
@@ -2407,12 +2425,25 @@ declare const ProductDisplayCard: React.ForwardRefExoticComponent<ViewProps & {
|
|
|
2407
2425
|
onQuantityChange?: (quantity: number) => void;
|
|
2408
2426
|
showQuantityPicker?: boolean;
|
|
2409
2427
|
/**
|
|
2428
|
+
* @deprecated Use `thumbnailBadge` instead. When both are set, `thumbnailBadge`
|
|
2429
|
+
* wins. This prop will be removed in a future major release.
|
|
2430
|
+
*
|
|
2410
2431
|
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2411
2432
|
* current `quantity`) instead of the quantity picker. Defaults to `false`.
|
|
2412
2433
|
* The badge and the quantity picker are mutually exclusive — only one shows
|
|
2413
2434
|
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2414
2435
|
*/
|
|
2415
2436
|
quantityBadge?: boolean;
|
|
2437
|
+
/**
|
|
2438
|
+
* Render a `Badge` overlaid on the top-right of the image. Accepts any
|
|
2439
|
+
* `BadgeProps` (variant, size, icon, children, etc.) — pass them as an object.
|
|
2440
|
+
* Mutually exclusive with the quantity picker: when set, the picker is never
|
|
2441
|
+
* rendered.
|
|
2442
|
+
*
|
|
2443
|
+
* @example
|
|
2444
|
+
* thumbnailBadge={{ variant: "primary", size: "large", children: "New" }}
|
|
2445
|
+
*/
|
|
2446
|
+
thumbnailBadge?: BadgeProps;
|
|
2416
2447
|
disableQuantityButtons?: boolean;
|
|
2417
2448
|
hideQuantityButtons?: boolean;
|
|
2418
2449
|
incrementDisabled?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -12231,6 +12231,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12231
12231
|
onQuantityChange,
|
|
12232
12232
|
showQuantityPicker = false,
|
|
12233
12233
|
quantityBadge = false,
|
|
12234
|
+
thumbnailBadge,
|
|
12234
12235
|
disableQuantityButtons = false,
|
|
12235
12236
|
hideQuantityButtons = false,
|
|
12236
12237
|
incrementDisabled = false,
|
|
@@ -12253,6 +12254,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12253
12254
|
"onQuantityChange",
|
|
12254
12255
|
"showQuantityPicker",
|
|
12255
12256
|
"quantityBadge",
|
|
12257
|
+
"thumbnailBadge",
|
|
12256
12258
|
"disableQuantityButtons",
|
|
12257
12259
|
"hideQuantityButtons",
|
|
12258
12260
|
"incrementDisabled",
|
|
@@ -12273,6 +12275,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12273
12275
|
onQuantityChange == null ? void 0 : onQuantityChange(newQuantity);
|
|
12274
12276
|
}
|
|
12275
12277
|
};
|
|
12278
|
+
const resolvedBadgeProps = thumbnailBadge != null ? thumbnailBadge : quantityBadge ? { variant: "primary", size: "large", children: String(quantity) } : void 0;
|
|
12276
12279
|
const cardContent = /* @__PURE__ */ jsxs(
|
|
12277
12280
|
StyledCardContainer,
|
|
12278
12281
|
__spreadProps(__spreadValues({
|
|
@@ -12294,7 +12297,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12294
12297
|
style: { flex: 1, width: "100%" }
|
|
12295
12298
|
}
|
|
12296
12299
|
) : image,
|
|
12297
|
-
|
|
12300
|
+
resolvedBadgeProps && /* @__PURE__ */ jsx(StyledBadgeOverlay, { pointerEvents: "none", children: /* @__PURE__ */ jsx(Badge, __spreadValues({}, resolvedBadgeProps)) })
|
|
12298
12301
|
]
|
|
12299
12302
|
}
|
|
12300
12303
|
) }),
|
|
@@ -12303,7 +12306,7 @@ var ProductDisplayCard = React66.forwardRef(
|
|
|
12303
12306
|
/* @__PURE__ */ jsx(Typography, { variant: "heading", size: "2xs", color: "primary", children: title }),
|
|
12304
12307
|
showSubtext && subtext && /* @__PURE__ */ jsx(Typography, { variant: "body", size: "sm", color: "secondary", children: subtext })
|
|
12305
12308
|
] }),
|
|
12306
|
-
showQuantityPicker && !
|
|
12309
|
+
showQuantityPicker && !resolvedBadgeProps && /* @__PURE__ */ jsx(View, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(
|
|
12307
12310
|
NumberField,
|
|
12308
12311
|
{
|
|
12309
12312
|
size: "sm",
|