@butternutbox/pawprint-native 1.0.0 → 1.1.1
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 +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -9
- package/dist/index.d.ts +36 -9
- 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 +58 -3
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.tsx +36 -12
package/dist/index.d.cts
CHANGED
|
@@ -2347,12 +2347,23 @@ 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
|
-
* current `quantity`)
|
|
2352
|
-
*
|
|
2353
|
-
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2354
|
+
* current `quantity`). Defaults to `false`. Independent of the quantity
|
|
2355
|
+
* picker — use `showQuantityPicker` to control that separately.
|
|
2354
2356
|
*/
|
|
2355
2357
|
quantityBadge?: boolean;
|
|
2358
|
+
/**
|
|
2359
|
+
* Render a `Badge` overlaid on the top-right of the image. Accepts any
|
|
2360
|
+
* `BadgeProps` (variant, size, icon, children, etc.) — pass them as an object.
|
|
2361
|
+
* Independent of the quantity picker: both can be shown at the same time.
|
|
2362
|
+
*
|
|
2363
|
+
* @example
|
|
2364
|
+
* thumbnailBadge={{ variant: "primary", size: "large", children: "New" }}
|
|
2365
|
+
*/
|
|
2366
|
+
thumbnailBadge?: BadgeProps;
|
|
2356
2367
|
disableQuantityButtons?: boolean;
|
|
2357
2368
|
hideQuantityButtons?: boolean;
|
|
2358
2369
|
incrementDisabled?: boolean;
|
|
@@ -2389,9 +2400,14 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2389
2400
|
* @param quantity - *(optional)* Current quantity value
|
|
2390
2401
|
* @param onQuantityChange - *(optional)* Callback when quantity changes
|
|
2391
2402
|
* @param showQuantityPicker - *(optional)* Show/hide quantity picker
|
|
2392
|
-
* @param quantityBadge - *(optional)*
|
|
2393
|
-
*
|
|
2394
|
-
*
|
|
2403
|
+
* @param quantityBadge - *(optional)* **@deprecated** — use `thumbnailBadge` instead.
|
|
2404
|
+
* Show a legacy quantity badge over the image (renders the current `quantity`
|
|
2405
|
+
* as a primary/large Badge). Mutually exclusive with the picker; defaults to
|
|
2406
|
+
* `false`. When both `thumbnailBadge` and `quantityBadge` are set, `thumbnailBadge`
|
|
2407
|
+
* wins.
|
|
2408
|
+
* @param thumbnailBadge - *(optional)* Render a `Badge` overlaid on the top-right
|
|
2409
|
+
* of the image. Accepts any `BadgeProps` (`variant`, `size`, `icon`, `children`, …).
|
|
2410
|
+
* Mutually exclusive with the quantity picker.
|
|
2395
2411
|
* @param quantityStep - *(optional)* Increment/decrement amount (default: 1)
|
|
2396
2412
|
* @param image - *(optional)* Image URL string or React element
|
|
2397
2413
|
* @param banner - *(optional)* Banner content string or React element to show below card
|
|
@@ -2407,12 +2423,23 @@ declare const ProductDisplayCard: React.ForwardRefExoticComponent<ViewProps & {
|
|
|
2407
2423
|
onQuantityChange?: (quantity: number) => void;
|
|
2408
2424
|
showQuantityPicker?: boolean;
|
|
2409
2425
|
/**
|
|
2426
|
+
* @deprecated Use `thumbnailBadge` instead. When both are set, `thumbnailBadge`
|
|
2427
|
+
* wins. This prop will be removed in a future major release.
|
|
2428
|
+
*
|
|
2410
2429
|
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2411
|
-
* current `quantity`)
|
|
2412
|
-
*
|
|
2413
|
-
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2430
|
+
* current `quantity`). Defaults to `false`. Independent of the quantity
|
|
2431
|
+
* picker — use `showQuantityPicker` to control that separately.
|
|
2414
2432
|
*/
|
|
2415
2433
|
quantityBadge?: boolean;
|
|
2434
|
+
/**
|
|
2435
|
+
* Render a `Badge` overlaid on the top-right of the image. Accepts any
|
|
2436
|
+
* `BadgeProps` (variant, size, icon, children, etc.) — pass them as an object.
|
|
2437
|
+
* Independent of the quantity picker: both can be shown at the same time.
|
|
2438
|
+
*
|
|
2439
|
+
* @example
|
|
2440
|
+
* thumbnailBadge={{ variant: "primary", size: "large", children: "New" }}
|
|
2441
|
+
*/
|
|
2442
|
+
thumbnailBadge?: BadgeProps;
|
|
2416
2443
|
disableQuantityButtons?: boolean;
|
|
2417
2444
|
hideQuantityButtons?: boolean;
|
|
2418
2445
|
incrementDisabled?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -2347,12 +2347,23 @@ 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
|
-
* current `quantity`)
|
|
2352
|
-
*
|
|
2353
|
-
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2354
|
+
* current `quantity`). Defaults to `false`. Independent of the quantity
|
|
2355
|
+
* picker — use `showQuantityPicker` to control that separately.
|
|
2354
2356
|
*/
|
|
2355
2357
|
quantityBadge?: boolean;
|
|
2358
|
+
/**
|
|
2359
|
+
* Render a `Badge` overlaid on the top-right of the image. Accepts any
|
|
2360
|
+
* `BadgeProps` (variant, size, icon, children, etc.) — pass them as an object.
|
|
2361
|
+
* Independent of the quantity picker: both can be shown at the same time.
|
|
2362
|
+
*
|
|
2363
|
+
* @example
|
|
2364
|
+
* thumbnailBadge={{ variant: "primary", size: "large", children: "New" }}
|
|
2365
|
+
*/
|
|
2366
|
+
thumbnailBadge?: BadgeProps;
|
|
2356
2367
|
disableQuantityButtons?: boolean;
|
|
2357
2368
|
hideQuantityButtons?: boolean;
|
|
2358
2369
|
incrementDisabled?: boolean;
|
|
@@ -2389,9 +2400,14 @@ type ProductDisplayCardProps = ViewProps & {
|
|
|
2389
2400
|
* @param quantity - *(optional)* Current quantity value
|
|
2390
2401
|
* @param onQuantityChange - *(optional)* Callback when quantity changes
|
|
2391
2402
|
* @param showQuantityPicker - *(optional)* Show/hide quantity picker
|
|
2392
|
-
* @param quantityBadge - *(optional)*
|
|
2393
|
-
*
|
|
2394
|
-
*
|
|
2403
|
+
* @param quantityBadge - *(optional)* **@deprecated** — use `thumbnailBadge` instead.
|
|
2404
|
+
* Show a legacy quantity badge over the image (renders the current `quantity`
|
|
2405
|
+
* as a primary/large Badge). Mutually exclusive with the picker; defaults to
|
|
2406
|
+
* `false`. When both `thumbnailBadge` and `quantityBadge` are set, `thumbnailBadge`
|
|
2407
|
+
* wins.
|
|
2408
|
+
* @param thumbnailBadge - *(optional)* Render a `Badge` overlaid on the top-right
|
|
2409
|
+
* of the image. Accepts any `BadgeProps` (`variant`, `size`, `icon`, `children`, …).
|
|
2410
|
+
* Mutually exclusive with the quantity picker.
|
|
2395
2411
|
* @param quantityStep - *(optional)* Increment/decrement amount (default: 1)
|
|
2396
2412
|
* @param image - *(optional)* Image URL string or React element
|
|
2397
2413
|
* @param banner - *(optional)* Banner content string or React element to show below card
|
|
@@ -2407,12 +2423,23 @@ declare const ProductDisplayCard: React.ForwardRefExoticComponent<ViewProps & {
|
|
|
2407
2423
|
onQuantityChange?: (quantity: number) => void;
|
|
2408
2424
|
showQuantityPicker?: boolean;
|
|
2409
2425
|
/**
|
|
2426
|
+
* @deprecated Use `thumbnailBadge` instead. When both are set, `thumbnailBadge`
|
|
2427
|
+
* wins. This prop will be removed in a future major release.
|
|
2428
|
+
*
|
|
2410
2429
|
* Show a quantity badge overlaid on the top-right of the image (rendering the
|
|
2411
|
-
* current `quantity`)
|
|
2412
|
-
*
|
|
2413
|
-
* at a time; when `quantityBadge` is true the picker is never rendered.
|
|
2430
|
+
* current `quantity`). Defaults to `false`. Independent of the quantity
|
|
2431
|
+
* picker — use `showQuantityPicker` to control that separately.
|
|
2414
2432
|
*/
|
|
2415
2433
|
quantityBadge?: boolean;
|
|
2434
|
+
/**
|
|
2435
|
+
* Render a `Badge` overlaid on the top-right of the image. Accepts any
|
|
2436
|
+
* `BadgeProps` (variant, size, icon, children, etc.) — pass them as an object.
|
|
2437
|
+
* Independent of the quantity picker: both can be shown at the same time.
|
|
2438
|
+
*
|
|
2439
|
+
* @example
|
|
2440
|
+
* thumbnailBadge={{ variant: "primary", size: "large", children: "New" }}
|
|
2441
|
+
*/
|
|
2442
|
+
thumbnailBadge?: BadgeProps;
|
|
2416
2443
|
disableQuantityButtons?: boolean;
|
|
2417
2444
|
hideQuantityButtons?: boolean;
|
|
2418
2445
|
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 && /* @__PURE__ */ jsx(View, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(
|
|
12307
12310
|
NumberField,
|
|
12308
12311
|
{
|
|
12309
12312
|
size: "sm",
|