@vkzstudio/muza-ui 1.5.2 → 1.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/dist/components/ArticleCard/ArticleCard.d.ts.map +1 -1
- package/dist/components/ArticleCard/ArticleCard.js +161 -170
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +42 -40
- package/dist/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.d.ts +99 -2
- package/dist/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.js +208 -151
- package/dist/components/Carousel/Carousel.stories.d.ts +2 -0
- package/dist/components/Carousel/Carousel.stories.d.ts.map +1 -1
- package/dist/components/Carousel/index.js +3 -2
- package/dist/components/CarouselSection/CarouselSection.examples.d.ts +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +22 -3
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +131 -105
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +3 -2
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/components/MarketNav/MarketNav.examples.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +28 -29
- package/dist/components/OfferCard/OfferCard.d.ts +45 -17
- package/dist/components/OfferCard/OfferCard.d.ts.map +1 -1
- package/dist/components/OfferCard/OfferCard.js +180 -266
- package/dist/components/OfferCard/OfferCard.stories.d.ts +5 -2
- package/dist/components/OfferCard/OfferCard.stories.d.ts.map +1 -1
- package/dist/components/PartnerCard/PartnerCard.d.ts +90 -26
- package/dist/components/PartnerCard/PartnerCard.d.ts.map +1 -1
- package/dist/components/PartnerCard/PartnerCard.js +323 -264
- package/dist/components/PartnerCard/PartnerCard.stories.d.ts +6 -0
- package/dist/components/PartnerCard/PartnerCard.stories.d.ts.map +1 -1
- package/dist/components/PriceTag/PriceTag.d.ts +37 -0
- package/dist/components/PriceTag/PriceTag.d.ts.map +1 -0
- package/dist/components/PriceTag/PriceTag.js +43 -0
- package/dist/components/PriceTag/PriceTag.stories.d.ts +8 -0
- package/dist/components/PriceTag/PriceTag.stories.d.ts.map +1 -0
- package/dist/components/PriceTag/index.d.ts +2 -0
- package/dist/components/PriceTag/index.d.ts.map +1 -0
- package/dist/components/PriceTag/index.js +5 -0
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +74 -100
- package/dist/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/components/Select/SelectTrigger.d.ts +54 -0
- package/dist/components/Select/SelectTrigger.d.ts.map +1 -0
- package/dist/components/Select/SelectTrigger.js +57 -0
- package/dist/components/Select/SelectTrigger.stories.d.ts +11 -0
- package/dist/components/Select/SelectTrigger.stories.d.ts.map +1 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +6 -2
- package/dist/components/Select/utils.d.ts +10 -1
- package/dist/components/Select/utils.d.ts.map +1 -1
- package/dist/components/Select/utils.js +3 -5
- package/dist/components/Tooltip/Tooltip.d.ts +18 -7
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +116 -68
- package/dist/components/Tooltip/Tooltip.stories.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/components/UniversalFooter/UniversalFooter.js +1 -1
- package/dist/components/VoucherCard/VoucherCard.d.ts +24 -1
- package/dist/components/VoucherCard/VoucherCard.d.ts.map +1 -1
- package/dist/components/VoucherCard/VoucherCard.js +68 -76
- package/dist/components/VoucherCard/VoucherCard.stories.d.ts +1 -0
- package/dist/components/VoucherCard/VoucherCard.stories.d.ts.map +1 -1
- package/dist/components/WebCheckoutNav/WebCheckoutNav.examples.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/internal/CardCompactShell.d.ts +80 -0
- package/dist/components/internal/CardCompactShell.d.ts.map +1 -0
- package/dist/components/internal/CardCompactShell.js +148 -0
- package/dist/components/internal/CardImageSlot.d.ts +56 -0
- package/dist/components/internal/CardImageSlot.d.ts.map +1 -0
- package/dist/components/internal/CardImageSlot.js +85 -0
- package/dist/index.js +356 -348
- package/dist/muza-ui.css +1 -1
- package/dist/styles/token-sizes.css +16 -4
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +6 -3
- package/dist/utils/disabledLinkProps.d.ts +8 -1
- package/dist/utils/disabledLinkProps.d.ts.map +1 -1
- package/dist/utils/disabledLinkProps.js +0 -1
- package/llms-full.md +133 -2
- package/llms.txt +2 -0
- package/package.json +3 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Layout + stroke classes for a compact grid card. Shared verbatim by
|
|
4
|
+
* `OfferCard` and `PartnerCard` so the two never drift apart — the homepage
|
|
5
|
+
* grid mixes offers and partners in a single row, where any divergence in
|
|
6
|
+
* radius, border or hover ramp would read as a bug.
|
|
7
|
+
*
|
|
8
|
+
* Tokens stay under the `comp-offer-card-compact-*` namespace: there is one
|
|
9
|
+
* compact shell in the design system, and `OfferCard` is where it was first
|
|
10
|
+
* specified. Both cards resolve to the same Figma variables this way.
|
|
11
|
+
*/
|
|
12
|
+
export declare const cardCompactContainerClass = "flex-col overflow-hidden rounded-comp-offer-card-compact-radius border-comp-offer-card-stroke-default has-[a:focus-visible]:border-comp-offer-card-stroke-focused has-[a:hover]:border-comp-offer-card-stroke-hover data-[disabled=true]:border-comp-offer-card-stroke-disabled";
|
|
13
|
+
/**
|
|
14
|
+
* Fill ramps for the compact shell, keyed by the `isTinted` boolean. The
|
|
15
|
+
* untinted card is transparent; the tinted one sits on
|
|
16
|
+
* `--color-surface-base-secondary` so promoted entries stand out in a grid.
|
|
17
|
+
*/
|
|
18
|
+
export declare const cardCompactFillClass: {
|
|
19
|
+
readonly default: "bg-comp-offer-card-fill-def-default has-[a:focus-visible]:bg-comp-offer-card-fill-def-focused has-[a:hover]:bg-comp-offer-card-fill-def-hover data-[disabled=true]:bg-comp-offer-card-fill-def-disabled";
|
|
20
|
+
readonly tinted: "bg-comp-offer-card-fill-promo-default has-[a:focus-visible]:bg-comp-offer-card-fill-promo-focused has-[a:hover]:bg-comp-offer-card-fill-promo-hover data-[disabled=true]:bg-comp-offer-card-fill-promo-disabled";
|
|
21
|
+
};
|
|
22
|
+
export interface CardCompactShellProps {
|
|
23
|
+
/** Image source — a URL string or a custom React node. Omit for placeholder mode. */
|
|
24
|
+
image?: string | React.ReactNode;
|
|
25
|
+
/** Alt text for the built-in `<img>`. Ignored in placeholder mode. */
|
|
26
|
+
imageAlt: string;
|
|
27
|
+
/** Icon rendered centred in the placeholder when `image` is absent. */
|
|
28
|
+
placeholderIcon?: React.ReactNode;
|
|
29
|
+
/** Any CSS color string driving the placeholder tint and icon color. */
|
|
30
|
+
placeholderColor?: string;
|
|
31
|
+
/** Owning component name, used to prefix development warnings. */
|
|
32
|
+
componentName: string;
|
|
33
|
+
/** Label for the chip pinned to the top-left of the image. Omit to hide it. */
|
|
34
|
+
category?: string;
|
|
35
|
+
/** Favorite toggle pinned to the top-right of the image. */
|
|
36
|
+
heartButton?: React.ReactNode;
|
|
37
|
+
/** Partner / merchant logo badge anchored bottom-left, half-overlapping the text. */
|
|
38
|
+
logo?: string | React.ReactNode;
|
|
39
|
+
/** Alt text for the built-in logo `<img>`. Ignored when `logo` is a React node. */
|
|
40
|
+
logoAlt: string;
|
|
41
|
+
/** Whether the owning card is disabled — drops the category chip's tint. */
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/** Text-column content: the title link, and whatever rows sit under it. */
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Image block + text column of a compact grid card, shared by `OfferCard` and
|
|
48
|
+
* `PartnerCard`.
|
|
49
|
+
*
|
|
50
|
+
* Renders the 288:162 image area (photo or placeholder), the glass category
|
|
51
|
+
* chip and heart pinned over it, the optional circular logo badge, and the
|
|
52
|
+
* padded text column below. Only the text column's contents differ between
|
|
53
|
+
* the two cards — everything above the fold is identical by construction.
|
|
54
|
+
*
|
|
55
|
+
* Internal helper. Not part of the public API.
|
|
56
|
+
*/
|
|
57
|
+
declare const CardCompactShell: {
|
|
58
|
+
({ image, imageAlt, placeholderIcon, placeholderColor, componentName, category, heartButton, logo, logoAlt, disabled, children, }: CardCompactShellProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
displayName: string;
|
|
60
|
+
};
|
|
61
|
+
export interface CardCompactSkeletonProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
62
|
+
/** Skeleton color, forwarded to every inner `Skeleton` block. */
|
|
63
|
+
color?: 'default' | 'light';
|
|
64
|
+
/** Mirrors the card's `isTinted` so the skeleton reserves the same fill. */
|
|
65
|
+
isTinted?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Loading placeholder for the compact shell, shared by `OfferCard.Skeleton`
|
|
69
|
+
* and `PartnerCard.Skeleton` for the same reason the shell itself is shared —
|
|
70
|
+
* mixed grids would otherwise show two different loading footprints side by
|
|
71
|
+
* side.
|
|
72
|
+
*
|
|
73
|
+
* Internal helper. Not part of the public API.
|
|
74
|
+
*/
|
|
75
|
+
declare const CardCompactSkeleton: {
|
|
76
|
+
({ color, isTinted, className, ...props }: CardCompactSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
displayName: string;
|
|
78
|
+
};
|
|
79
|
+
export { CardCompactShell, CardCompactSkeleton };
|
|
80
|
+
//# sourceMappingURL=CardCompactShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardCompactShell.d.ts","sourceRoot":"","sources":["../../../src/components/internal/CardCompactShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,oRAC6O,CAAA;AAEnR;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;CAKvB,CAAA;AAMV,MAAM,WAAW,qBAAqB;IACpC,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;IAChC,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAA;IAChB,uEAAuE;IACvE,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACjC,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kEAAkE;IAClE,aAAa,EAAE,MAAM,CAAA;IACrB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,qFAAqF;IACrF,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;IAC/B,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAA;IACf,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2EAA2E;IAC3E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,gBAAgB;uIAYnB,qBAAqB;;CAkEvB,CAAA;AAGD,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC9D,iEAAiE;IACjE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAA;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,mBAAmB;+CAKtB,wBAAwB;;CAuC1B,CAAA;AAGD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { jsxs as a, Fragment as v, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cn as m } from "../../utils/cn.js";
|
|
4
|
+
import { Flex as i } from "../Flex/Flex.js";
|
|
5
|
+
import { Skeleton as r } from "../Skeleton/Skeleton.js";
|
|
6
|
+
import { Tag as x } from "../Tag/Tag.js";
|
|
7
|
+
import { CardImageSlot as N, hasImageContent as w } from "./CardImageSlot.js";
|
|
8
|
+
const q = "flex-col overflow-hidden rounded-comp-offer-card-compact-radius border-comp-offer-card-stroke-default has-[a:focus-visible]:border-comp-offer-card-stroke-focused has-[a:hover]:border-comp-offer-card-stroke-hover data-[disabled=true]:border-comp-offer-card-stroke-disabled", A = {
|
|
9
|
+
default: "bg-comp-offer-card-fill-def-default has-[a:focus-visible]:bg-comp-offer-card-fill-def-focused has-[a:hover]:bg-comp-offer-card-fill-def-hover data-[disabled=true]:bg-comp-offer-card-fill-def-disabled",
|
|
10
|
+
tinted: "bg-comp-offer-card-fill-promo-default has-[a:focus-visible]:bg-comp-offer-card-fill-promo-focused has-[a:hover]:bg-comp-offer-card-fill-promo-hover data-[disabled=true]:bg-comp-offer-card-fill-promo-disabled"
|
|
11
|
+
}, p = "px-comp-offer-card-compact-p pt-comp-offer-card-compact-p-top pb-comp-offer-card-compact-p", C = ({
|
|
12
|
+
image: o,
|
|
13
|
+
imageAlt: l,
|
|
14
|
+
placeholderIcon: f,
|
|
15
|
+
placeholderColor: c,
|
|
16
|
+
componentName: n,
|
|
17
|
+
category: t,
|
|
18
|
+
heartButton: u,
|
|
19
|
+
logo: d,
|
|
20
|
+
logoAlt: b,
|
|
21
|
+
disabled: h,
|
|
22
|
+
children: g
|
|
23
|
+
}) => {
|
|
24
|
+
const s = w(o);
|
|
25
|
+
return /* @__PURE__ */ a(v, { children: [
|
|
26
|
+
/* @__PURE__ */ a("div", { className: "relative w-full shrink-0", children: [
|
|
27
|
+
/* @__PURE__ */ a(
|
|
28
|
+
N,
|
|
29
|
+
{
|
|
30
|
+
image: o,
|
|
31
|
+
alt: l,
|
|
32
|
+
placeholderIcon: f,
|
|
33
|
+
placeholderColor: c,
|
|
34
|
+
componentName: n,
|
|
35
|
+
wrapperClassName: "relative aspect-[288/162] w-full overflow-hidden",
|
|
36
|
+
children: [
|
|
37
|
+
s && /* @__PURE__ */ e(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
className: "absolute inset-0 bg-gradient-to-t from-black/0 from-50% to-black/70"
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ a("div", { className: "absolute top-comp-offer-card-compact-p-img right-comp-offer-card-compact-p-img left-comp-offer-card-compact-p-img flex items-start justify-between gap-sm", children: [
|
|
45
|
+
t ? /* @__PURE__ */ e(
|
|
46
|
+
x,
|
|
47
|
+
{
|
|
48
|
+
variant: s ? "invert" : void 0,
|
|
49
|
+
color: s || h ? void 0 : c,
|
|
50
|
+
className: "min-w-[50px] shrink overflow-hidden",
|
|
51
|
+
children: t
|
|
52
|
+
}
|
|
53
|
+
) : /* @__PURE__ */ e("span", {}),
|
|
54
|
+
u
|
|
55
|
+
] })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
d && /* @__PURE__ */ e(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: m(
|
|
63
|
+
"pointer-events-none absolute bottom-comp-offer-card-compact-logo-y left-comp-offer-card-compact-logo-x z-10 size-comp-offer-card-compact-logo-size overflow-hidden rounded-full border-2 border-stroke-base-secondary bg-comp-offer-card-fill-def-default",
|
|
64
|
+
"[&>img]:size-full [&>img]:object-cover",
|
|
65
|
+
"group-data-[disabled=true]:grayscale"
|
|
66
|
+
),
|
|
67
|
+
children: typeof d == "string" ? /* @__PURE__ */ e("img", { src: d, alt: b }) : d
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ e(
|
|
72
|
+
i,
|
|
73
|
+
{
|
|
74
|
+
direction: "column",
|
|
75
|
+
flex: 1,
|
|
76
|
+
gap: "2xs",
|
|
77
|
+
className: p,
|
|
78
|
+
children: g
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] });
|
|
82
|
+
};
|
|
83
|
+
C.displayName = "CardCompactShell";
|
|
84
|
+
const k = ({
|
|
85
|
+
color: o = "default",
|
|
86
|
+
isTinted: l = !1,
|
|
87
|
+
className: f,
|
|
88
|
+
...c
|
|
89
|
+
}) => /* @__PURE__ */ a(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
className: m(
|
|
93
|
+
"inline-flex flex-col overflow-hidden rounded-comp-offer-card-compact-radius border border-solid border-comp-offer-card-stroke-default",
|
|
94
|
+
l ? "bg-comp-offer-card-fill-promo-default" : "bg-comp-offer-card-fill-def-default",
|
|
95
|
+
f
|
|
96
|
+
),
|
|
97
|
+
...c,
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ a("div", { className: "relative aspect-[288/162] w-full shrink-0 overflow-hidden", children: [
|
|
100
|
+
/* @__PURE__ */ e(
|
|
101
|
+
r,
|
|
102
|
+
{
|
|
103
|
+
color: o,
|
|
104
|
+
className: "absolute inset-0 size-full rounded-none"
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ a("div", { className: "absolute top-comp-offer-card-compact-p-img right-comp-offer-card-compact-p-img left-comp-offer-card-compact-p-img flex items-center justify-between", children: [
|
|
108
|
+
/* @__PURE__ */ e(
|
|
109
|
+
r,
|
|
110
|
+
{
|
|
111
|
+
color: o,
|
|
112
|
+
className: "h-comp-tag-h-def w-16 rounded-full"
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ e(
|
|
116
|
+
r,
|
|
117
|
+
{
|
|
118
|
+
color: o,
|
|
119
|
+
className: "size-comp-button-h-xs rounded-full"
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ a(
|
|
125
|
+
i,
|
|
126
|
+
{
|
|
127
|
+
direction: "column",
|
|
128
|
+
flex: 1,
|
|
129
|
+
gap: "2xs",
|
|
130
|
+
className: p,
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ e(r, { color: o, className: "h-5 w-full" }),
|
|
133
|
+
/* @__PURE__ */ e(r, { color: o, className: "h-5 w-3/4" }),
|
|
134
|
+
/* @__PURE__ */ e(r, { color: o, className: "mt-2xs h-4 w-32" }),
|
|
135
|
+
/* @__PURE__ */ e(r, { color: o, className: "mt-2xs h-4 w-24" })
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
k.displayName = "CardCompactSkeleton";
|
|
143
|
+
export {
|
|
144
|
+
C as CardCompactShell,
|
|
145
|
+
k as CardCompactSkeleton,
|
|
146
|
+
q as cardCompactContainerClass,
|
|
147
|
+
A as cardCompactFillClass
|
|
148
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Whether an `image` prop carries something renderable. Cards use this to
|
|
4
|
+
* decide whether their image-overlay chrome (gradients, glass chips, inverted
|
|
5
|
+
* icon buttons) should render in photo mode or placeholder mode.
|
|
6
|
+
*/
|
|
7
|
+
export declare const hasImageContent: (image?: string | React.ReactNode) => boolean;
|
|
8
|
+
export interface CardImageSlotProps {
|
|
9
|
+
/** Image source — a URL string (rendered as a plain `<img>`) or a custom React node. */
|
|
10
|
+
image?: string | React.ReactNode;
|
|
11
|
+
/** Alt text for the built-in `<img>`. Ignored in placeholder mode. */
|
|
12
|
+
alt: string;
|
|
13
|
+
/** Classes applied to the wrapper `<div>` — sizing, rounded corners, overflow. */
|
|
14
|
+
wrapperClassName: string;
|
|
15
|
+
/** Extra classes merged into the inner image layer (hover/focus zoom tweaks). */
|
|
16
|
+
innerClassName?: string;
|
|
17
|
+
/** Icon rendered centred in the placeholder when `image` is absent. */
|
|
18
|
+
placeholderIcon?: React.ReactNode;
|
|
19
|
+
/** Any CSS color string driving the placeholder tint and icon color. */
|
|
20
|
+
placeholderColor?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Classes applied to the placeholder layer — used to size the icon. Defaults to
|
|
23
|
+
* the large market-category icon token.
|
|
24
|
+
*/
|
|
25
|
+
placeholderIconClassName?: string;
|
|
26
|
+
/** Owning component name, used to prefix development warnings. */
|
|
27
|
+
componentName: string;
|
|
28
|
+
/** Overlays rendered on top of the image (gradient, tag chips). */
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Renders a card image inside a wrapper that handles sizing and rounded
|
|
33
|
+
* corners. When `image` is a string we render a plain `<img>`; when it's a
|
|
34
|
+
* React node (e.g. Next.js `<Image>`) we render it as-is. The image sits in
|
|
35
|
+
* its own absolutely-positioned inner layer that carries the hover zoom and
|
|
36
|
+
* the disabled dim (opacity + grayscale), so the dim reaches any image node —
|
|
37
|
+
* including a `<picture>` or nested-`<img>` custom node — without fading the
|
|
38
|
+
* overlaid gradient/tag chips rendered as `children`. A direct `<img>` is
|
|
39
|
+
* auto-stretched to fill the layer, so consumers don't need sizing classes.
|
|
40
|
+
*
|
|
41
|
+
* When `image` is absent the same layer renders a decorative placeholder
|
|
42
|
+
* instead: a flat tint derived from `placeholderColor` at 20% alpha with
|
|
43
|
+
* `placeholderIcon` centred in the full color. Without a `placeholderColor`
|
|
44
|
+
* it falls back to the brand-tertiary tint with a tertiary icon. It carries
|
|
45
|
+
* the same hover zoom as the image path, so the icon grows on hover exactly
|
|
46
|
+
* like a photo would; disabled swaps both tint and icon for the neutral
|
|
47
|
+
* disabled surface instead of dimming the colored one.
|
|
48
|
+
*
|
|
49
|
+
* Internal helper shared by the card components. Not part of the public API.
|
|
50
|
+
*/
|
|
51
|
+
declare const CardImageSlot: {
|
|
52
|
+
({ image, alt, wrapperClassName, innerClassName, placeholderIcon, placeholderColor, placeholderIconClassName, componentName, children, }: CardImageSlotProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
displayName: string;
|
|
54
|
+
};
|
|
55
|
+
export { CardImageSlot };
|
|
56
|
+
//# sourceMappingURL=CardImageSlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardImageSlot.d.ts","sourceRoot":"","sources":["../../../src/components/internal/CardImageSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAoB9B;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,GAAG,KAAK,CAAC,SAAS,KAAG,OACjB,CAAA;AAElD,MAAM,WAAW,kBAAkB;IACjC,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;IAChC,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAA;IACX,kFAAkF;IAClF,gBAAgB,EAAE,MAAM,CAAA;IACxB,iFAAiF;IACjF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,uEAAuE;IACvE,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACjC,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,kEAAkE;IAClE,aAAa,EAAE,MAAM,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,aAAa;8IAUhB,kBAAkB;;CA2EpB,CAAA;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import b from "color";
|
|
4
|
+
import { cn as u } from "../../utils/cn.js";
|
|
5
|
+
const m = (r) => {
|
|
6
|
+
try {
|
|
7
|
+
return b(r);
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}, g = /* @__PURE__ */ new Set(), p = (r, o) => {
|
|
12
|
+
process.env.NODE_ENV === "production" || g.has(r) || (g.add(r), console.warn(o));
|
|
13
|
+
}, h = (r) => r != null && r !== !1 && r !== "", v = ({
|
|
14
|
+
image: r,
|
|
15
|
+
alt: o,
|
|
16
|
+
wrapperClassName: i,
|
|
17
|
+
innerClassName: d,
|
|
18
|
+
placeholderIcon: l,
|
|
19
|
+
placeholderColor: e,
|
|
20
|
+
placeholderIconClassName: f = "[&>svg]:size-comp-market-category-ico-ico-size-lg",
|
|
21
|
+
componentName: t,
|
|
22
|
+
children: n
|
|
23
|
+
}) => {
|
|
24
|
+
if (h(r))
|
|
25
|
+
return /* @__PURE__ */ c("div", { className: i, children: [
|
|
26
|
+
/* @__PURE__ */ s(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: u(
|
|
30
|
+
"absolute inset-0 overflow-hidden",
|
|
31
|
+
"[&>img]:size-full [&>img]:object-cover",
|
|
32
|
+
"transition-transform duration-300 ease-out group-hover:scale-110",
|
|
33
|
+
"group-data-[disabled=true]:opacity-50",
|
|
34
|
+
"group-data-[disabled=true]:grayscale",
|
|
35
|
+
"group-data-[disabled=true]:group-hover:scale-100",
|
|
36
|
+
d
|
|
37
|
+
),
|
|
38
|
+
children: typeof r == "string" ? /* @__PURE__ */ s("img", { src: r, alt: o }) : r
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
n
|
|
42
|
+
] });
|
|
43
|
+
l || p(
|
|
44
|
+
`${t}:no-placeholder-icon`,
|
|
45
|
+
`[${t}] \`image\` was omitted without a \`placeholderIcon\` — rendering an empty image slot.`
|
|
46
|
+
);
|
|
47
|
+
const a = e ? m(e) : null;
|
|
48
|
+
return e && !a && p(
|
|
49
|
+
`${t}:invalid-color:${e}`,
|
|
50
|
+
`[${t}] Invalid \`placeholderColor\` "${e}". Falling back to neutral styling.`
|
|
51
|
+
), /* @__PURE__ */ c("div", { className: i, children: [
|
|
52
|
+
/* @__PURE__ */ s(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
className: u(
|
|
57
|
+
"absolute inset-0 flex items-center justify-center overflow-hidden",
|
|
58
|
+
a ? "bg-(--card-image-slot-placeholder-bg) text-(--card-image-slot-placeholder-fg)" : "bg-surface-brand-brand-tertiary text-icon-dark-tertiary",
|
|
59
|
+
// Disabled swaps the tint outright rather than dimming it — the
|
|
60
|
+
// design system gives the placeholder its own disabled ramp. Both
|
|
61
|
+
// layers use the same translucent token, so the icon reads as a
|
|
62
|
+
// slightly darker grey where it stacks over the fill.
|
|
63
|
+
"group-data-[disabled=true]:bg-surface-dark-secondary-disabled group-data-[disabled=true]:text-surface-dark-secondary-disabled",
|
|
64
|
+
// Same zoom the image path uses — the flat tint already covers the
|
|
65
|
+
// slot, so what visibly grows is the icon.
|
|
66
|
+
"transition-transform duration-300 ease-out group-hover:scale-110",
|
|
67
|
+
"group-data-[disabled=true]:group-hover:scale-100",
|
|
68
|
+
d,
|
|
69
|
+
f
|
|
70
|
+
),
|
|
71
|
+
style: a ? {
|
|
72
|
+
"--card-image-slot-placeholder-bg": a.alpha(0.2).toString(),
|
|
73
|
+
"--card-image-slot-placeholder-fg": a.toString()
|
|
74
|
+
} : void 0,
|
|
75
|
+
children: l
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
n
|
|
79
|
+
] });
|
|
80
|
+
};
|
|
81
|
+
v.displayName = "CardImageSlot";
|
|
82
|
+
export {
|
|
83
|
+
v as CardImageSlot,
|
|
84
|
+
h as hasImageContent
|
|
85
|
+
};
|