@fanvue/ui 3.17.0 → 3.19.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/README.md +1 -1
- package/dist/cjs/components/Badge/Badge.cjs +13 -11
- package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
- package/dist/cjs/components/Banner/Banner.cjs +1 -1
- package/dist/cjs/components/Banner/Banner.cjs.map +1 -1
- package/dist/cjs/components/Chip/Chip.cjs +21 -1
- package/dist/cjs/components/Chip/Chip.cjs.map +1 -1
- package/dist/cjs/components/Count/Count.cjs +36 -7
- package/dist/cjs/components/Count/Count.cjs.map +1 -1
- package/dist/cjs/components/Icons/ReceiveMoneyIcon.cjs +79 -0
- package/dist/cjs/components/Icons/ReceiveMoneyIcon.cjs.map +1 -0
- package/dist/cjs/components/PhoneField/PhoneField.cjs +198 -0
- package/dist/cjs/components/PhoneField/PhoneField.cjs.map +1 -0
- package/dist/cjs/components/RatingSummary/RatingSummary.cjs +30 -23
- package/dist/cjs/components/RatingSummary/RatingSummary.cjs.map +1 -1
- package/dist/cjs/components/TextArea/TextArea.cjs +2 -2
- package/dist/cjs/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/cjs/components/TextField/TextField.cjs +13 -6
- package/dist/cjs/components/TextField/TextField.cjs.map +1 -1
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/Badge/Badge.mjs +13 -11
- package/dist/components/Badge/Badge.mjs.map +1 -1
- package/dist/components/Banner/Banner.mjs +1 -1
- package/dist/components/Banner/Banner.mjs.map +1 -1
- package/dist/components/Chip/Chip.mjs +21 -1
- package/dist/components/Chip/Chip.mjs.map +1 -1
- package/dist/components/Count/Count.mjs +36 -7
- package/dist/components/Count/Count.mjs.map +1 -1
- package/dist/components/Icons/ReceiveMoneyIcon.mjs +62 -0
- package/dist/components/Icons/ReceiveMoneyIcon.mjs.map +1 -0
- package/dist/components/PhoneField/PhoneField.mjs +181 -0
- package/dist/components/PhoneField/PhoneField.mjs.map +1 -0
- package/dist/components/RatingSummary/RatingSummary.mjs +30 -23
- package/dist/components/RatingSummary/RatingSummary.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.mjs +2 -2
- package/dist/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/components/TextField/TextField.mjs +13 -6
- package/dist/components/TextField/TextField.mjs.map +1 -1
- package/dist/index.d.ts +109 -7
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -5,19 +5,20 @@ import * as React from "react";
|
|
|
5
5
|
import { cn } from "../../utils/cn.mjs";
|
|
6
6
|
const badgeVariants = {
|
|
7
7
|
variant: {
|
|
8
|
-
default: "bg-
|
|
8
|
+
default: "bg-buttons-secondary-default text-content-primary",
|
|
9
9
|
dark: "bg-neutral-alphas-600 text-content-always-white",
|
|
10
|
-
success: "bg-
|
|
11
|
-
warning: "bg-
|
|
12
|
-
error: "bg-
|
|
13
|
-
special: "bg-
|
|
14
|
-
info: "bg-
|
|
10
|
+
success: "bg-buttons-secondary-default text-content-primary",
|
|
11
|
+
warning: "bg-buttons-secondary-default text-content-primary",
|
|
12
|
+
error: "bg-buttons-secondary-default text-content-primary",
|
|
13
|
+
special: "bg-buttons-secondary-default text-content-primary",
|
|
14
|
+
info: "bg-buttons-secondary-default text-content-primary",
|
|
15
15
|
successColour: "bg-success-surface text-content-primary",
|
|
16
16
|
warningColour: "bg-warning-surface text-content-primary",
|
|
17
17
|
errorColour: "bg-error-surface text-content-primary",
|
|
18
18
|
infoColour: "bg-info-surface text-content-primary",
|
|
19
19
|
aiGenerated: "bg-buttons-always-white-default text-content-always-black",
|
|
20
20
|
negative: "bg-buttons-secondary-negative-default text-content-primary-inverted",
|
|
21
|
+
alwaysWhite: "bg-buttons-secondary-negative-default text-content-always-white",
|
|
21
22
|
online: "bg-background-primary text-brand-primary-default",
|
|
22
23
|
brand: "bg-brand-primary-default text-content-always-black",
|
|
23
24
|
pink: "bg-brand-secondary-default text-content-always-black",
|
|
@@ -25,7 +26,7 @@ const badgeVariants = {
|
|
|
25
26
|
pinkLight: "bg-brand-secondary-muted text-content-primary"
|
|
26
27
|
},
|
|
27
28
|
dotColor: {
|
|
28
|
-
default: "bg-
|
|
29
|
+
default: "bg-icons-primary",
|
|
29
30
|
dark: "bg-content-always-white",
|
|
30
31
|
success: "bg-success-content",
|
|
31
32
|
warning: "bg-warning-content",
|
|
@@ -38,6 +39,7 @@ const badgeVariants = {
|
|
|
38
39
|
infoColour: "bg-info-content",
|
|
39
40
|
aiGenerated: "bg-content-always-black",
|
|
40
41
|
negative: "bg-icons-primary-inverted",
|
|
42
|
+
alwaysWhite: "bg-brand-primary-default",
|
|
41
43
|
online: "bg-brand-primary-default",
|
|
42
44
|
brand: "bg-content-always-black",
|
|
43
45
|
pink: "bg-content-always-black",
|
|
@@ -65,7 +67,7 @@ const Badge = React.forwardRef(
|
|
|
65
67
|
"data-testid": "badge",
|
|
66
68
|
className: cn(
|
|
67
69
|
// Base styles
|
|
68
|
-
"typography-
|
|
70
|
+
"typography-badge-badgecaps inline-flex h-5 min-w-0 items-center gap-1 rounded-full px-2",
|
|
69
71
|
// Variant styles
|
|
70
72
|
badgeVariants.variant[variant],
|
|
71
73
|
// Interactive
|
|
@@ -79,7 +81,7 @@ const Badge = React.forwardRef(
|
|
|
79
81
|
leftIcon && /* @__PURE__ */ jsx(
|
|
80
82
|
"span",
|
|
81
83
|
{
|
|
82
|
-
className: "flex shrink-0 items-center justify-center [&>svg]:size-
|
|
84
|
+
className: "flex shrink-0 items-center justify-center [&>svg]:size-2.5",
|
|
83
85
|
"aria-hidden": "true",
|
|
84
86
|
children: leftIcon
|
|
85
87
|
}
|
|
@@ -91,11 +93,11 @@ const Badge = React.forwardRef(
|
|
|
91
93
|
"aria-hidden": "true"
|
|
92
94
|
}
|
|
93
95
|
),
|
|
94
|
-
asChild ? /* @__PURE__ */ jsx(Slottable, { children }) : /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children }),
|
|
96
|
+
asChild ? /* @__PURE__ */ jsx(Slottable, { children }) : /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate [text-box:trim-both_cap_alphabetic]", children }),
|
|
95
97
|
rightIcon && /* @__PURE__ */ jsx(
|
|
96
98
|
"span",
|
|
97
99
|
{
|
|
98
|
-
className: "flex shrink-0 items-center justify-center [&>svg]:size-
|
|
100
|
+
className: "flex shrink-0 items-center justify-center [&>svg]:size-2.5",
|
|
99
101
|
"aria-hidden": "true",
|
|
100
102
|
children: rightIcon
|
|
101
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.mjs","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { Slot, Slottable } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"
|
|
1
|
+
{"version":3,"file":"Badge.mjs","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { Slot, Slottable } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn.ts\";\n\nconst badgeVariants = {\n variant: {\n default: \"bg-buttons-secondary-default text-content-primary\",\n dark: \"bg-neutral-alphas-600 text-content-always-white\",\n success: \"bg-buttons-secondary-default text-content-primary\",\n warning: \"bg-buttons-secondary-default text-content-primary\",\n error: \"bg-buttons-secondary-default text-content-primary\",\n special: \"bg-buttons-secondary-default text-content-primary\",\n info: \"bg-buttons-secondary-default text-content-primary\",\n successColour: \"bg-success-surface text-content-primary\",\n warningColour: \"bg-warning-surface text-content-primary\",\n errorColour: \"bg-error-surface text-content-primary\",\n infoColour: \"bg-info-surface text-content-primary\",\n aiGenerated: \"bg-buttons-always-white-default text-content-always-black\",\n negative: \"bg-buttons-secondary-negative-default text-content-primary-inverted\",\n alwaysWhite: \"bg-buttons-secondary-negative-default text-content-always-white\",\n online: \"bg-background-primary text-brand-primary-default\",\n brand: \"bg-brand-primary-default text-content-always-black\",\n pink: \"bg-brand-secondary-default text-content-always-black\",\n brandLight: \"bg-brand-primary-muted text-content-primary\",\n pinkLight: \"bg-brand-secondary-muted text-content-primary\",\n },\n dotColor: {\n default: \"bg-icons-primary\",\n dark: \"bg-content-always-white\",\n success: \"bg-success-content\",\n warning: \"bg-warning-content\",\n error: \"bg-error-content\",\n special: \"bg-special-default\",\n info: \"bg-info-content\",\n successColour: \"bg-success-content\",\n warningColour: \"bg-warning-content\",\n errorColour: \"bg-error-content\",\n infoColour: \"bg-info-content\",\n aiGenerated: \"bg-content-always-black\",\n negative: \"bg-icons-primary-inverted\",\n alwaysWhite: \"bg-brand-primary-default\",\n online: \"bg-brand-primary-default\",\n brand: \"bg-content-always-black\",\n pink: \"bg-content-always-black\",\n brandLight: \"bg-content-always-black\",\n pinkLight: \"bg-content-always-black\",\n },\n} as const;\n\n/** Visual style variant of the badge. */\nexport type BadgeVariant =\n | \"default\"\n | \"dark\"\n | \"success\"\n | \"warning\"\n | \"error\"\n | \"special\"\n | \"info\"\n | \"successColour\"\n | \"warningColour\"\n | \"errorColour\"\n | \"infoColour\"\n | \"aiGenerated\"\n | \"negative\"\n | \"alwaysWhite\"\n | \"online\"\n | \"brand\"\n | \"pink\"\n | \"brandLight\"\n | \"pinkLight\";\n\nexport interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Visual style variant of the badge. @default \"default\" */\n variant?: BadgeVariant;\n /** Whether to show a coloured status dot at the leading edge. @default true */\n leftDot?: boolean;\n /** Icon element displayed before the label. */\n leftIcon?: React.ReactNode;\n /** Icon element displayed after the label. */\n rightIcon?: React.ReactNode;\n /** Merge props onto a child element instead of rendering a `<span>`. @default false */\n asChild?: boolean;\n}\n\n/**\n * A small inline label for status, category, or metadata information.\n *\n * @example\n * ```tsx\n * <Badge variant=\"success\">Active</Badge>\n * ```\n */\nexport const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(\n (\n {\n className,\n variant = \"default\",\n leftDot = true,\n leftIcon,\n rightIcon,\n asChild = false,\n onClick,\n children,\n ...props\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : \"span\";\n\n return (\n <Comp\n ref={ref}\n data-testid=\"badge\"\n className={cn(\n // Base styles\n \"typography-badge-badgecaps inline-flex h-5 min-w-0 items-center gap-1 rounded-full px-2\",\n // Variant styles\n badgeVariants.variant[variant],\n // Interactive\n onClick && \"cursor-pointer\",\n // Manual CSS overrides\n className,\n )}\n onClick={onClick}\n {...props}\n >\n {leftIcon && (\n <span\n className=\"flex shrink-0 items-center justify-center [&>svg]:size-2.5\"\n aria-hidden=\"true\"\n >\n {leftIcon}\n </span>\n )}\n {leftDot && (\n <span\n className={cn(\"size-1 shrink-0 rounded-full\", badgeVariants.dotColor[variant])}\n aria-hidden=\"true\"\n />\n )}\n {asChild ? (\n <Slottable>{children}</Slottable>\n ) : (\n <span className=\"min-w-0 truncate [text-box:trim-both_cap_alphabetic]\">{children}</span>\n )}\n {rightIcon && (\n <span\n className=\"flex shrink-0 items-center justify-center [&>svg]:size-2.5\"\n aria-hidden=\"true\"\n >\n {rightIcon}\n </span>\n )}\n </Comp>\n );\n },\n);\n\nBadge.displayName = \"Badge\";\n"],"names":[],"mappings":";;;;;AAIA,MAAM,gBAAgB;AAAA,EACpB,SAAS;AAAA,IACP,SAAS;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MAAM;AAAA,IACN,eAAe;AAAA,IACf,eAAe;AAAA,IACf,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,UAAU;AAAA,IACV,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,WAAW;AAAA,EAAA;AAAA,EAEb,UAAU;AAAA,IACR,SAAS;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,IACP,SAAS;A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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.mjs","sources":["../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Badge, type BadgeVariant } from \"../Badge/Badge\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { CrossIcon } from \"../Icons/CrossIcon\";\n\n/**\n * Matches the Fanvue Library Banner Figma component property `Type`\n * (`Default`, `Subtle`, `whatsNew`, `appStore1`, `appStore2`, `appStore3`).\n */\nexport type BannerVariant =\n | \"Default\"\n | \"Subtle\"\n | \"whatsNew\"\n | \"appStore1\"\n | \"appStore2\"\n | \"appStore3\";\n\n/** Layout (`Vertical` / `Horizontal` / `HorizontalSmall` in Figma). Ignored for `Subtle` and app store types. */\nexport type BannerLayout = \"vertical\" | \"horizontal\" | \"compact\";\n\ntype AppStoreVariant = \"appStore1\" | \"appStore2\" | \"appStore3\";\n\nconst APP_STORE_VARIANTS: readonly AppStoreVariant[] = [\"appStore1\", \"appStore2\", \"appStore3\"];\n\nfunction isAppStoreVariant(variant: BannerVariant): variant is AppStoreVariant {\n return (APP_STORE_VARIANTS as readonly string[]).includes(variant);\n}\n\nconst GUIDE_BADGE_VARIANT: Record<AppStoreVariant, BadgeVariant> = {\n appStore1: \"dark\",\n appStore2: \"default\",\n appStore3: \"default\",\n};\n\nconst BANNER_SHADOW = \"shadow-sm\";\n\nconst guideGradient: Record<AppStoreVariant, React.CSSProperties> = {\n appStore1: {\n backgroundImage:\n \"linear-gradient(125.54deg, var(--color-brand-primary-muted) 0%, var(--color-neutral-alphas-50) 100%)\",\n },\n appStore2: {\n backgroundImage:\n \"linear-gradient(125.54deg, var(--color-brand-secondary-muted) 0%, var(--color-brand-secondary-muted) 100%)\",\n },\n appStore3: {\n backgroundImage:\n \"linear-gradient(125.54deg, var(--color-brand-secondary-muted) 0%, color-mix(in srgb, var(--color-info-surface) 80%, transparent) 100%)\",\n },\n};\n\nexport interface BannerProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** Figma `Type` — selects structure, surfaces, and app store gradient. */\n variant: BannerVariant;\n /**\n * Figma `Orientation`. Ignored when `variant` is `Subtle` (horizontal) or an app store type (vertical).\n * @default `\"vertical\"` for `Default`, `\"horizontal\"` for `whatsNew`\n */\n layout?: BannerLayout;\n /** Leading visual (image, illustration, or composite). */\n media?: React.ReactNode;\n /** Small uppercase label (e.g. HOW TO). */\n eyebrow?: React.ReactNode;\n /** Top badge row (e.g. NEW pill) — mainly for `Subtle`. */\n leadBadge?: React.ReactNode;\n /** Main heading. */\n title?: React.ReactNode;\n /** Primary body copy. */\n description?: React.ReactNode;\n /** Extra line under description (`Subtle`). */\n secondaryLine?: React.ReactNode;\n /** Left-stacked pill action (`Subtle`). */\n stackedAction?: React.ReactNode;\n /** Row under stacked action (`Subtle`). */\n statusRow?: React.ReactNode;\n /** Primary button (e.g. Learn more). */\n primaryAction?: React.ReactNode;\n /** Text-style CTA (`whatsNew` / app store). */\n textAction?: React.ReactNode;\n /** When set, shows a dismiss control (`Default` only). */\n onDismiss?: () => void;\n /** Accessible label for dismiss. @default \"Dismiss banner\" */\n dismissLabel?: string;\n}\n\nfunction BannerDismiss({\n onDismiss,\n dismissLabel,\n}: {\n onDismiss: () => void;\n dismissLabel: string;\n}) {\n return (\n <IconButton\n variant=\"contrast\"\n size=\"24\"\n icon={<CrossIcon />}\n onClick={onDismiss}\n aria-label={dismissLabel}\n className=\"hover:bg-white/10 active:bg-white/15\"\n />\n );\n}\n\nfunction resolveLayout(variant: BannerVariant, layoutProp: BannerLayout | undefined): BannerLayout {\n if (variant === \"Subtle\") {\n return \"horizontal\";\n }\n if (isAppStoreVariant(variant)) {\n return \"vertical\";\n }\n if (variant === \"whatsNew\") {\n return layoutProp ?? \"horizontal\";\n }\n return layoutProp ?? \"vertical\";\n}\n\nfunction bannerRootClass(variant: BannerVariant, layout: BannerLayout, className?: string): string {\n return cn(\n \"flex rounded-md\",\n BANNER_SHADOW,\n variant === \"Default\" && \"gap-3 bg-surface-primary-inverted p-4 text-content-primary-inverted\",\n variant === \"Subtle\" &&\n \"w-full max-w-[600px] items-start gap-3 border border-border-primary bg-surface-secondary p-4 text-content-primary\",\n variant === \"whatsNew\" &&\n layout === \"horizontal\" &&\n \"w-full max-w-[446px] items-center gap-4 bg-surface-purple-muted p-4 text-content-primary\",\n variant === \"whatsNew\" &&\n layout === \"vertical\" &&\n \"w-full max-w-[220px] flex-col items-stretch gap-4 border border-border-primary bg-surface-secondary p-4 text-content-primary\",\n variant === \"whatsNew\" &&\n layout === \"compact\" &&\n \"w-full max-w-[446px] items-start gap-4 bg-surface-purple-muted p-4 text-content-primary\",\n isAppStoreVariant(variant) && \"w-full max-w-[280px] flex-col gap-4 p-6\",\n layout === \"vertical\" && variant === \"Default\" && \"max-w-[360px]\",\n layout === \"horizontal\" && variant === \"Default\" && \"w-full max-w-[600px] items-start\",\n className,\n );\n}\n\ntype BannerSectionProps = React.ComponentPropsWithoutRef<\"section\"> & {\n labelledBy?: string;\n};\n\nconst BannerSection = React.forwardRef<HTMLElement, BannerSectionProps>(\n ({ className, labelledBy, children, ...rest }, ref) => (\n <section\n ref={ref}\n aria-labelledby={labelledBy}\n data-testid=\"banner\"\n className={className}\n {...rest}\n >\n {children}\n </section>\n ),\n);\nBannerSection.displayName = \"BannerSection\";\n\ntype GuideBodyProps = Pick<BannerProps, \"eyebrow\" | \"title\" | \"description\" | \"textAction\"> & {\n appStoreVariant: AppStoreVariant;\n labelledBy?: string;\n};\n\nfunction BannerGuideBody({\n appStoreVariant,\n eyebrow,\n title,\n description,\n textAction,\n labelledBy,\n}: GuideBodyProps) {\n return (\n <>\n {eyebrow !== undefined && eyebrow !== null && eyebrow !== false && (\n <Badge\n variant={GUIDE_BADGE_VARIANT[appStoreVariant]}\n leftDot={false}\n className=\"typography-badge-badgecaps self-start\"\n >\n {eyebrow}\n </Badge>\n )}\n {title !== undefined && title !== null && title !== false && (\n <p id={labelledBy} className=\"typography-body-default-16px-semibold text-content-primary\">\n {title}\n </p>\n )}\n {description !== undefined && description !== null && description !== false && (\n <p className=\"typography-body-small-14px-regular text-content-secondary\">{description}</p>\n )}\n {textAction}\n </>\n );\n}\n\ntype FeatureBodyProps = Pick<BannerProps, \"title\" | \"description\" | \"textAction\" | \"media\"> & {\n layout: BannerLayout;\n labelledBy?: string;\n};\n\nfunction BannerFeatureBody({\n layout,\n media,\n title,\n description,\n textAction,\n labelledBy,\n}: FeatureBodyProps) {\n const titleClass =\n layout === \"vertical\"\n ? \"typography-body-default-16px-semibold text-content-primary\"\n : \"typography-body-default-16px-semibold text-[18px] leading-6 text-content-primary\";\n const mediaWrap =\n layout === \"compact\"\n ? \"size-20 shrink-0 overflow-hidden rounded-sm\"\n : \"size-[132px] shrink-0 overflow-hidden rounded-sm\";\n\n return (\n <>\n {media !== undefined && media !== null && (\n <div className={cn(mediaWrap, layout === \"vertical\" && \"w-full [&>*]:mx-auto\")}>\n {media}\n </div>\n )}\n <div\n className={cn(\n \"flex min-w-0 flex-col gap-2\",\n layout === \"horizontal\" || layout === \"compact\" ? \"flex-1 justify-end\" : \"w-full\",\n )}\n >\n {title !== undefined && title !== null && title !== false && (\n <div id={labelledBy} className={titleClass}>\n {title}\n </div>\n )}\n {description !== undefined && description !== null && description !== false && (\n <p className=\"typography-body-small-14px-regular text-content-secondary\">{description}</p>\n )}\n {textAction}\n </div>\n </>\n );\n}\n\ntype SubtleBodyProps = Pick<\n BannerProps,\n | \"media\"\n | \"leadBadge\"\n | \"title\"\n | \"description\"\n | \"secondaryLine\"\n | \"stackedAction\"\n | \"statusRow\"\n | \"primaryAction\"\n> & { labelledBy?: string };\n\nfunction BannerSubtleBody({\n media,\n leadBadge,\n title,\n description,\n secondaryLine,\n stackedAction,\n statusRow,\n primaryAction,\n labelledBy,\n}: SubtleBodyProps) {\n const mediaSizeDefault = \"size-12 shrink-0 overflow-hidden rounded-xl\";\n return (\n <>\n {media !== undefined && media !== null && <div className={mediaSizeDefault}>{media}</div>}\n <div className=\"flex min-w-0 flex-1 items-end gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-4\">\n {leadBadge !== undefined && leadBadge !== null && (\n <div className=\"flex flex-wrap items-center gap-2\">{leadBadge}</div>\n )}\n <div className=\"flex flex-col gap-1\">\n {title !== undefined && title !== null && title !== false && (\n <div id={labelledBy} className=\"typography-header-heading-xs text-content-primary\">\n {title}\n </div>\n )}\n <div className=\"flex flex-col gap-2\">\n {description !== undefined && description !== null && description !== false && (\n <p className=\"typography-body-small-14px-regular text-content-primary\">\n {description}\n </p>\n )}\n {secondaryLine !== undefined && secondaryLine !== null && secondaryLine !== false && (\n <p className=\"typography-description-12px-regular text-content-primary\">\n {secondaryLine}\n </p>\n )}\n </div>\n </div>\n {stackedAction !== undefined && stackedAction !== null && (\n <div className=\"flex flex-col items-end self-start\">{stackedAction}</div>\n )}\n {statusRow !== undefined && statusRow !== null && (\n <div className=\"flex flex-wrap items-center gap-2\">{statusRow}</div>\n )}\n </div>\n {primaryAction !== undefined && primaryAction !== null && (\n <div className=\"shrink-0 self-center\">{primaryAction}</div>\n )}\n </div>\n </>\n );\n}\n\ntype InverseBodyProps = Pick<\n BannerProps,\n \"media\" | \"eyebrow\" | \"title\" | \"description\" | \"primaryAction\"\n> & {\n layout: BannerLayout;\n labelledBy?: string;\n dismissSlot: React.ReactNode;\n};\n\nfunction BannerInverseBody({\n layout,\n media,\n eyebrow,\n title,\n description,\n primaryAction,\n labelledBy,\n dismissSlot,\n}: InverseBodyProps) {\n const mediaSizeDefault = \"size-12 shrink-0 overflow-hidden rounded-xl\";\n const titleClassInverse = \"typography-header-heading-xs text-content-primary-inverted\";\n const textColumn = (\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n {eyebrow !== undefined && eyebrow !== null && eyebrow !== false && (\n <p className=\"typography-description-12px-semibold text-content-primary-inverted\">\n {eyebrow}\n </p>\n )}\n {title !== undefined && title !== null && title !== false && (\n <div id={labelledBy} className={titleClassInverse}>\n {title}\n </div>\n )}\n {description !== undefined && description !== null && description !== false && (\n <p className=\"typography-body-small-14px-regular text-content-primary-inverted\">\n {description}\n </p>\n )}\n </div>\n );\n\n return (\n <>\n {media !== undefined && media !== null && <div className={mediaSizeDefault}>{media}</div>}\n {layout === \"horizontal\" ? (\n <div className=\"flex min-w-0 flex-1 items-end gap-3\">\n {textColumn}\n {primaryAction !== undefined && primaryAction !== null && (\n <div className=\"shrink-0\">{primaryAction}</div>\n )}\n </div>\n ) : (\n <div className=\"flex min-w-0 flex-1 flex-col gap-3\">\n {textColumn}\n {primaryAction !== undefined && primaryAction !== null && <div>{primaryAction}</div>}\n </div>\n )}\n {dismissSlot}\n </>\n );\n}\n\nexport const Banner = React.forwardRef<HTMLElement, BannerProps>(\n (\n {\n className,\n variant,\n layout: layoutProp,\n media,\n eyebrow,\n leadBadge,\n title,\n description,\n secondaryLine,\n stackedAction,\n statusRow,\n primaryAction,\n textAction,\n onDismiss,\n dismissLabel = \"Dismiss banner\",\n ...props\n },\n ref,\n ) => {\n const layout = resolveLayout(variant, layoutProp);\n const showDismiss = onDismiss !== undefined && variant === \"Default\";\n const titleId = React.useId();\n const regionLabelledBy =\n title !== undefined && title !== null && title !== false ? titleId : undefined;\n\n const rootClass = bannerRootClass(variant, layout, className);\n\n if (isAppStoreVariant(variant)) {\n return (\n <BannerSection\n ref={ref}\n labelledBy={regionLabelledBy}\n style={guideGradient[variant]}\n className={rootClass}\n {...props}\n >\n <BannerGuideBody\n appStoreVariant={variant}\n eyebrow={eyebrow}\n title={title}\n description={description}\n textAction={textAction}\n labelledBy={regionLabelledBy}\n />\n </BannerSection>\n );\n }\n\n if (variant === \"whatsNew\") {\n return (\n <BannerSection ref={ref} labelledBy={regionLabelledBy} className={rootClass} {...props}>\n <BannerFeatureBody\n layout={layout}\n media={media}\n title={title}\n description={description}\n textAction={textAction}\n labelledBy={regionLabelledBy}\n />\n </BannerSection>\n );\n }\n\n if (variant === \"Subtle\") {\n return (\n <BannerSection ref={ref} labelledBy={regionLabelledBy} className={rootClass} {...props}>\n <BannerSubtleBody\n media={media}\n leadBadge={leadBadge}\n title={title}\n description={description}\n secondaryLine={secondaryLine}\n stackedAction={stackedAction}\n statusRow={statusRow}\n primaryAction={primaryAction}\n labelledBy={regionLabelledBy}\n />\n </BannerSection>\n );\n }\n\n const dismissSlot =\n showDismiss && onDismiss !== undefined ? (\n <BannerDismiss onDismiss={onDismiss} dismissLabel={dismissLabel} />\n ) : null;\n\n return (\n <BannerSection ref={ref} labelledBy={regionLabelledBy} className={rootClass} {...props}>\n <div className=\"flex w-full items-start gap-3\">\n <BannerInverseBody\n layout={layout}\n media={media}\n eyebrow={eyebrow}\n title={title}\n description={description}\n primaryAction={primaryAction}\n labelledBy={regionLabelledBy}\n dismissSlot={dismissSlot}\n />\n </div>\n </BannerSection>\n );\n },\n);\n\nBanner.displayName = \"Banner\";\n"],"names":[],"mappings":";;;;;;;AAuBA,MAAM,qBAAiD,CAAC,aAAa,aAAa,WAAW;AAE7F,SAAS,kBAAkB,SAAoD;AAC7E,SAAQ,mBAAyC,SAAS,OAAO;AACnE;AAEA,MAAM,sBAA6D;AAAA,EACjE,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AACb;AAEA,MAAM,gBAAgB;AAEtB,MAAM,gBAA8D;AAAA,EAClE,WAAW;AAAA,IACT,iBACE;AAAA,EAAA;AAAA,EAEJ,WAAW;AAAA,IACT,iBACE;AAAA,EAAA;AAAA,EAEJ,WAAW;AAAA,IACT,iBACE;AAAA,EAAA;AAEN;AAoCA,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AACF,GAGG;AACD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,0BAAO,WAAA,EAAU;AAAA,MACjB,SAAS;AAAA,MACT,cAAY;AAAA,MACZ,WAAU;AAAA,IAAA;AAAA,EAAA;AAGhB;AAEA,SAAS,cAAc,SAA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esContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Badge, type BadgeVariant } from \"../Badge/Badge\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { CrossIcon } from \"../Icons/CrossIcon\";\n\n/**\n * Matches the Fanvue Library Banner Figma component property `Type`\n * (`Default`, `Subtle`, `whatsNew`, `appStore1`, `appStore2`, `appStore3`).\n */\nexport type BannerVariant =\n | \"Default\"\n | \"Subtle\"\n | \"whatsNew\"\n | \"appStore1\"\n | \"appStore2\"\n | \"appStore3\";\n\n/** Layout (`Vertical` / `Horizontal` / `HorizontalSmall` in Figma). Ignored for `Subtle` and app store types. */\nexport type BannerLayout = \"vertical\" | \"horizontal\" | \"compact\";\n\ntype AppStoreVariant = \"appStore1\" | \"appStore2\" | \"appStore3\";\n\nconst APP_STORE_VARIANTS: readonly AppStoreVariant[] = [\"appStore1\", \"appStore2\", \"appStore3\"];\n\nfunction isAppStoreVariant(variant: BannerVariant): variant is AppStoreVariant {\n return (APP_STORE_VARIANTS as readonly string[]).includes(variant);\n}\n\nconst GUIDE_BADGE_VARIANT: Record<AppStoreVariant, BadgeVariant> = {\n appStore1: \"dark\",\n appStore2: \"default\",\n appStore3: \"default\",\n};\n\nconst BANNER_SHADOW = \"shadow-sm\";\n\nconst guideGradient: Record<AppStoreVariant, React.CSSProperties> = {\n appStore1: {\n backgroundImage:\n \"linear-gradient(125.54deg, var(--color-brand-primary-muted) 0%, var(--color-neutral-alphas-50) 100%)\",\n },\n appStore2: {\n backgroundImage:\n \"linear-gradient(125.54deg, var(--color-brand-secondary-muted) 0%, var(--color-brand-secondary-muted) 100%)\",\n },\n appStore3: {\n backgroundImage:\n \"linear-gradient(125.54deg, var(--color-brand-secondary-muted) 0%, color-mix(in srgb, var(--color-info-surface) 80%, transparent) 100%)\",\n },\n};\n\nexport interface BannerProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** Figma `Type` — selects structure, surfaces, and app store gradient. */\n variant: BannerVariant;\n /**\n * Figma `Orientation`. Ignored when `variant` is `Subtle` (horizontal) or an app store type (vertical).\n * @default `\"vertical\"` for `Default`, `\"horizontal\"` for `whatsNew`\n */\n layout?: BannerLayout;\n /** Leading visual (image, illustration, or composite). */\n media?: React.ReactNode;\n /** Small uppercase label (e.g. HOW TO). */\n eyebrow?: React.ReactNode;\n /** Top badge row (e.g. NEW pill) — mainly for `Subtle`. */\n leadBadge?: React.ReactNode;\n /** Main heading. */\n title?: React.ReactNode;\n /** Primary body copy. */\n description?: React.ReactNode;\n /** Extra line under description (`Subtle`). */\n secondaryLine?: React.ReactNode;\n /** Left-stacked pill action (`Subtle`). */\n stackedAction?: React.ReactNode;\n /** Row under stacked action (`Subtle`). */\n statusRow?: React.ReactNode;\n /** Primary button (e.g. Learn more). */\n primaryAction?: React.ReactNode;\n /** Text-style CTA (`whatsNew` / app store). */\n textAction?: React.ReactNode;\n /** When set, shows a dismiss control (`Default` only). */\n onDismiss?: () => void;\n /** Accessible label for dismiss. @default \"Dismiss banner\" */\n dismissLabel?: string;\n}\n\nfunction BannerDismiss({\n onDismiss,\n dismissLabel,\n}: {\n onDismiss: () => void;\n dismissLabel: string;\n}) {\n return (\n <IconButton\n variant=\"contrast\"\n size=\"24\"\n icon={<CrossIcon />}\n onClick={onDismiss}\n aria-label={dismissLabel}\n className=\"hover:bg-white/10 active:bg-white/15\"\n />\n );\n}\n\nfunction resolveLayout(variant: BannerVariant, layoutProp: BannerLayout | undefined): BannerLayout {\n if (variant === \"Subtle\") {\n return \"horizontal\";\n }\n if (isAppStoreVariant(variant)) {\n return \"vertical\";\n }\n if (variant === \"whatsNew\") {\n return layoutProp ?? \"horizontal\";\n }\n return layoutProp ?? \"vertical\";\n}\n\nfunction bannerRootClass(variant: BannerVariant, layout: BannerLayout, className?: string): string {\n return cn(\n \"flex rounded-md\",\n BANNER_SHADOW,\n variant === \"Default\" && \"gap-3 bg-surface-primary-inverted p-4 text-content-primary-inverted\",\n variant === \"Subtle\" &&\n \"w-full max-w-[600px] items-start gap-3 border border-border-primary bg-surface-secondary p-4 text-content-primary\",\n variant === \"whatsNew\" &&\n layout === \"horizontal\" &&\n \"w-full max-w-[446px] items-center gap-4 bg-surface-purple-muted p-4 text-content-primary\",\n variant === \"whatsNew\" &&\n layout === \"vertical\" &&\n \"w-full max-w-[220px] flex-col items-stretch gap-4 border border-border-primary bg-surface-secondary p-4 text-content-primary\",\n variant === \"whatsNew\" &&\n layout === \"compact\" &&\n \"w-full max-w-[446px] items-start gap-4 bg-surface-purple-muted p-4 text-content-primary\",\n isAppStoreVariant(variant) && \"w-full max-w-[280px] flex-col gap-4 p-6\",\n layout === \"vertical\" && variant === \"Default\" && \"max-w-[360px]\",\n layout === \"horizontal\" && variant === \"Default\" && \"w-full max-w-[600px] items-start\",\n className,\n );\n}\n\ntype BannerSectionProps = React.ComponentPropsWithoutRef<\"section\"> & {\n labelledBy?: string;\n};\n\nconst BannerSection = React.forwardRef<HTMLElement, BannerSectionProps>(\n ({ className, labelledBy, children, ...rest }, ref) => (\n <section\n ref={ref}\n aria-labelledby={labelledBy}\n data-testid=\"banner\"\n className={className}\n {...rest}\n >\n {children}\n </section>\n ),\n);\nBannerSection.displayName = \"BannerSection\";\n\ntype GuideBodyProps = Pick<BannerProps, \"eyebrow\" | \"title\" | \"description\" | \"textAction\"> & {\n appStoreVariant: AppStoreVariant;\n labelledBy?: string;\n};\n\nfunction BannerGuideBody({\n appStoreVariant,\n eyebrow,\n title,\n description,\n textAction,\n labelledBy,\n}: GuideBodyProps) {\n return (\n <>\n {eyebrow !== undefined && eyebrow !== null && eyebrow !== false && (\n <Badge\n variant={GUIDE_BADGE_VARIANT[appStoreVariant]}\n leftDot={false}\n className=\"self-start\"\n >\n {eyebrow}\n </Badge>\n )}\n {title !== undefined && title !== null && title !== false && (\n <p id={labelledBy} className=\"typography-body-default-16px-semibold text-content-primary\">\n {title}\n </p>\n )}\n {description !== undefined && description !== null && description !== false && (\n <p className=\"typography-body-small-14px-regular text-content-secondary\">{description}</p>\n )}\n {textAction}\n </>\n );\n}\n\ntype FeatureBodyProps = Pick<BannerProps, \"title\" | \"description\" | \"textAction\" | \"media\"> & {\n layout: BannerLayout;\n labelledBy?: string;\n};\n\nfunction BannerFeatureBody({\n layout,\n media,\n title,\n description,\n textAction,\n labelledBy,\n}: FeatureBodyProps) {\n const titleClass =\n layout === \"vertical\"\n ? \"typography-body-default-16px-semibold text-content-primary\"\n : \"typography-body-default-16px-semibold text-[18px] leading-6 text-content-primary\";\n const mediaWrap =\n layout === \"compact\"\n ? \"size-20 shrink-0 overflow-hidden rounded-sm\"\n : \"size-[132px] shrink-0 overflow-hidden rounded-sm\";\n\n return (\n <>\n {media !== undefined && media !== null && (\n <div className={cn(mediaWrap, layout === \"vertical\" && \"w-full [&>*]:mx-auto\")}>\n {media}\n </div>\n )}\n <div\n className={cn(\n \"flex min-w-0 flex-col gap-2\",\n layout === \"horizontal\" || layout === \"compact\" ? \"flex-1 justify-end\" : \"w-full\",\n )}\n >\n {title !== undefined && title !== null && title !== false && (\n <div id={labelledBy} className={titleClass}>\n {title}\n </div>\n )}\n {description !== undefined && description !== null && description !== false && (\n <p className=\"typography-body-small-14px-regular text-content-secondary\">{description}</p>\n )}\n {textAction}\n </div>\n </>\n );\n}\n\ntype SubtleBodyProps = Pick<\n BannerProps,\n | \"media\"\n | \"leadBadge\"\n | \"title\"\n | \"description\"\n | \"secondaryLine\"\n | \"stackedAction\"\n | \"statusRow\"\n | \"primaryAction\"\n> & { labelledBy?: string };\n\nfunction BannerSubtleBody({\n media,\n leadBadge,\n title,\n description,\n secondaryLine,\n stackedAction,\n statusRow,\n primaryAction,\n labelledBy,\n}: SubtleBodyProps) {\n const mediaSizeDefault = \"size-12 shrink-0 overflow-hidden rounded-xl\";\n return (\n <>\n {media !== undefined && media !== null && <div className={mediaSizeDefault}>{media}</div>}\n <div className=\"flex min-w-0 flex-1 items-end gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-4\">\n {leadBadge !== undefined && leadBadge !== null && (\n <div className=\"flex flex-wrap items-center gap-2\">{leadBadge}</div>\n )}\n <div className=\"flex flex-col gap-1\">\n {title !== undefined && title !== null && title !== false && (\n <div id={labelledBy} className=\"typography-header-heading-xs text-content-primary\">\n {title}\n </div>\n )}\n <div className=\"flex flex-col gap-2\">\n {description !== undefined && description !== null && description !== false && (\n <p className=\"typography-body-small-14px-regular text-content-primary\">\n {description}\n </p>\n )}\n {secondaryLine !== undefined && secondaryLine !== null && secondaryLine !== false && (\n <p className=\"typography-description-12px-regular text-content-primary\">\n {secondaryLine}\n </p>\n )}\n </div>\n </div>\n {stackedAction !== undefined && stackedAction !== null && (\n <div className=\"flex flex-col items-end self-start\">{stackedAction}</div>\n )}\n {statusRow !== undefined && statusRow !== null && (\n <div className=\"flex flex-wrap items-center gap-2\">{statusRow}</div>\n )}\n </div>\n {primaryAction !== undefined && primaryAction !== null && (\n <div className=\"shrink-0 self-center\">{primaryAction}</div>\n )}\n </div>\n </>\n );\n}\n\ntype InverseBodyProps = Pick<\n BannerProps,\n \"media\" | \"eyebrow\" | \"title\" | \"description\" | \"primaryAction\"\n> & {\n layout: BannerLayout;\n labelledBy?: string;\n dismissSlot: React.ReactNode;\n};\n\nfunction BannerInverseBody({\n layout,\n media,\n eyebrow,\n title,\n description,\n primaryAction,\n labelledBy,\n dismissSlot,\n}: InverseBodyProps) {\n const mediaSizeDefault = \"size-12 shrink-0 overflow-hidden rounded-xl\";\n const titleClassInverse = \"typography-header-heading-xs text-content-primary-inverted\";\n const textColumn = (\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n {eyebrow !== undefined && eyebrow !== null && eyebrow !== false && (\n <p className=\"typography-description-12px-semibold text-content-primary-inverted\">\n {eyebrow}\n </p>\n )}\n {title !== undefined && title !== null && title !== false && (\n <div id={labelledBy} className={titleClassInverse}>\n {title}\n </div>\n )}\n {description !== undefined && description !== null && description !== false && (\n <p className=\"typography-body-small-14px-regular text-content-primary-inverted\">\n {description}\n </p>\n )}\n </div>\n );\n\n return (\n <>\n {media !== undefined && media !== null && <div className={mediaSizeDefault}>{media}</div>}\n {layout === \"horizontal\" ? (\n <div className=\"flex min-w-0 flex-1 items-end gap-3\">\n {textColumn}\n {primaryAction !== undefined && primaryAction !== null && (\n <div className=\"shrink-0\">{primaryAction}</div>\n )}\n </div>\n ) : (\n <div className=\"flex min-w-0 flex-1 flex-col gap-3\">\n {textColumn}\n {primaryAction !== undefined && primaryAction !== null && <div>{primaryAction}</div>}\n </div>\n )}\n {dismissSlot}\n </>\n );\n}\n\nexport const Banner = React.forwardRef<HTMLElement, BannerProps>(\n (\n {\n className,\n variant,\n layout: layoutProp,\n media,\n eyebrow,\n leadBadge,\n title,\n description,\n secondaryLine,\n stackedAction,\n statusRow,\n primaryAction,\n textAction,\n onDismiss,\n dismissLabel = \"Dismiss banner\",\n ...props\n },\n ref,\n ) => {\n const layout = resolveLayout(variant, layoutProp);\n const showDismiss = onDismiss !== undefined && variant === \"Default\";\n const titleId = React.useId();\n const regionLabelledBy =\n title !== undefined && title !== null && title !== false ? titleId : undefined;\n\n const rootClass = bannerRootClass(variant, layout, className);\n\n if (isAppStoreVariant(variant)) {\n return (\n <BannerSection\n ref={ref}\n labelledBy={regionLabelledBy}\n style={guideGradient[variant]}\n className={rootClass}\n {...props}\n >\n <BannerGuideBody\n appStoreVariant={variant}\n eyebrow={eyebrow}\n title={title}\n description={description}\n textAction={textAction}\n labelledBy={regionLabelledBy}\n />\n </BannerSection>\n );\n }\n\n if (variant === \"whatsNew\") {\n return (\n <BannerSection ref={ref} labelledBy={regionLabelledBy} className={rootClass} {...props}>\n <BannerFeatureBody\n layout={layout}\n media={media}\n title={title}\n description={description}\n textAction={textAction}\n labelledBy={regionLabelledBy}\n />\n </BannerSection>\n );\n }\n\n if (variant === \"Subtle\") {\n return (\n <BannerSection ref={ref} labelledBy={regionLabelledBy} className={rootClass} {...props}>\n <BannerSubtleBody\n media={media}\n leadBadge={leadBadge}\n title={title}\n description={description}\n secondaryLine={secondaryLine}\n stackedAction={stackedAction}\n statusRow={statusRow}\n primaryAction={primaryAction}\n labelledBy={regionLabelledBy}\n />\n </BannerSection>\n );\n }\n\n const dismissSlot =\n showDismiss && onDismiss !== undefined ? (\n <BannerDismiss onDismiss={onDismiss} dismissLabel={dismissLabel} />\n ) : null;\n\n return (\n <BannerSection ref={ref} labelledBy={regionLabelledBy} className={rootClass} {...props}>\n <div className=\"flex w-full items-start gap-3\">\n <BannerInverseBody\n layout={layout}\n media={media}\n eyebrow={eyebrow}\n title={title}\n description={description}\n primaryAction={primaryAction}\n labelledBy={regionLabelledBy}\n dismissSlot={dismissSlot}\n />\n </div>\n </BannerSection>\n );\n },\n);\n\nBanner.displayName = \"Banner\";\n"],"names":[],"mappings":";;;;;;;AAuBA,MAAM,qBAAiD,CAAC,aAAa,aAAa,WAAW;AAE7F,SAAS,kBAAkB,SAAoD;AAC7E,SAAQ,mBAAyC,SAAS,OAAO;AACnE;AAEA,MAAM,sBAA6D;AAAA,EACjE,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AACb;AAEA,MAAM,gBAAgB;AAEtB,MAAM,gBAA8D;AAAA,EAClE,WAAW;AAAA,IACT,iBACE;AAAA,EAAA;AAAA,EAEJ,WAAW;AAAA,IACT,iBACE;AAAA,EAAA;AAAA,EAEJ,WAAW;AAAA,IACT,iBACE;AAAA,EAAA;AAEN;AAoCA,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AACF,GAGG;AACD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,0BAAO,WAAA,EAAU;AAAA,MACjB,SAAS;AAAA,MACT,cAAY;AAAA,MACZ,WAAU;AAAA,IAAA;AAAA,EAAA;AAGhB;AAEA,SAAS,cAAc,SAAwB,YAAoD;AACjG,MAAI,YAAY,UAAU;AACxB,WAAO;AAAA,EACT;AACA,MAAI,kBAAkB,OAAO,GAAG;AAC9B,WAAO;AAA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;AAAA,YAAA;AAAA,cACC,iBAAiB;AAAA,cACjB;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA,YAAY;AAAA,YAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAGN;AAEA,QAAI,YAAY,YAAY;AAC1B,aACE,oBAAC,iBAAc,KAAU,YAAY,kBAAkB,WAAW,WAAY,GAAG,OAC/E,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,YAAY;AAAA,QAAA;AAAA,MAAA,GAEhB;AAAA,IAEJ;AAEA,QAAI,YAAY,UAAU;AACxB,aACE,oBAAC,iBAAc,KAAU,YAAY,kBAAkB,WAAW,WAAY,GAAG,OAC/E,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,YAAY;AAAA,QAAA;AAAA,MAAA,GAEhB;AAAA,IAEJ;AAEA,UAAM,cACJ,eAAe,cAAc,6BAC1B,eAAA,EAAc,WAAsB,cAA4B,IAC/D;AAEN,WACE,oBAAC,eAAA,EAAc,KAAU,YAAY,kBAAkB,WAAW,WAAY,GAAG,OAC/E,UAAA,oBAAC,OAAA,EAAI,WAAU,iCACb,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,MAAA;AAAA,IAAA,GAEJ,EAAA,CACF;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;"}
|
|
@@ -3,6 +3,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import { Slot, Slottable } from "@radix-ui/react-slot";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
import { Count } from "../Count/Count.mjs";
|
|
6
7
|
const Chip = React.forwardRef(
|
|
7
8
|
({
|
|
8
9
|
className,
|
|
@@ -15,6 +16,9 @@ const Chip = React.forwardRef(
|
|
|
15
16
|
leftIcon,
|
|
16
17
|
rightIcon,
|
|
17
18
|
notificationLabel,
|
|
19
|
+
notificationCount,
|
|
20
|
+
notificationMax,
|
|
21
|
+
notificationVariant = "brand",
|
|
18
22
|
onClick,
|
|
19
23
|
asChild = false,
|
|
20
24
|
children,
|
|
@@ -110,7 +114,23 @@ const Chip = React.forwardRef(
|
|
|
110
114
|
}
|
|
111
115
|
)
|
|
112
116
|
] }),
|
|
113
|
-
notificationLabel && /* @__PURE__ */ jsx(
|
|
117
|
+
(notificationCount != null || notificationLabel) && /* @__PURE__ */ jsx(
|
|
118
|
+
Count,
|
|
119
|
+
{
|
|
120
|
+
variant: notificationVariant,
|
|
121
|
+
size: "32",
|
|
122
|
+
className: cn(
|
|
123
|
+
// V2 Notification Count: 20px high/min-width, caption 12,
|
|
124
|
+
// 4px horizontal and 2px vertical padding, rounded-md.
|
|
125
|
+
"absolute top-[-4px] rounded-md px-1 py-0.5",
|
|
126
|
+
// Anchor the leading edge so wider values grow away from the label.
|
|
127
|
+
size === "40" ? "left-[calc(100%_-_16px)]" : "left-[calc(100%_-_11px)]"
|
|
128
|
+
),
|
|
129
|
+
value: notificationCount ?? 0,
|
|
130
|
+
max: notificationMax,
|
|
131
|
+
children: notificationCount == null ? notificationLabel : void 0
|
|
132
|
+
}
|
|
133
|
+
)
|
|
114
134
|
] })
|
|
115
135
|
}
|
|
116
136
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.mjs","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import { Slot, Slottable } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Visual variant of the chip. */\nexport type ChipVariant = \"rounded\" | \"square\" | \"dark\";\n/** Height of the chip in pixels. */\nexport type ChipSize = \"32\" | \"40\";\n\nexport interface ChipProps extends React.HTMLAttributes<HTMLElement> {\n /** Visual variant of the chip. @default \"rounded\" */\n variant?: ChipVariant;\n /** Height of the chip in pixels. @default \"32\" */\n size?: ChipSize;\n /** Whether the chip is in a selected (pressed) state. @default false */\n selected?: boolean;\n /** Whether the chip is disabled. @default false */\n disabled?: boolean;\n /** Whether to show a coloured status dot at the leading edge. @default false */\n leftDot?: boolean;\n /**\n * Whether the chip uses a dashed border for add/create affordances.\n * When `selected`, it becomes a subtle filled state with a solid border.\n * Has no effect when `variant=\"dark\"`.\n * @default false\n */\n dotted?: boolean;\n /** Icon element displayed before the label. */\n leftIcon?: React.ReactNode;\n /** Icon element displayed after the label. */\n rightIcon?: React.ReactNode;\n /** Notification badge content (e.g. `\"99+\"`). Passed as a string for i18n support. */\n notificationLabel?: string;\n /** Click handler — when provided, the chip renders as a `<button>` for accessibility. */\n onClick?: React.MouseEventHandler<HTMLElement>;\n /** Merge props onto a child element instead of rendering a wrapper. @default false */\n asChild?: boolean;\n}\n\n/**\n * A compact element for filters, tags, or toggleable actions. When an `onClick`\n * handler is provided, the chip renders as an interactive `<button>` with\n * `aria-pressed` support.\n *\n * @example\n * ```tsx\n * <Chip selected onClick={toggle}>Music</Chip>\n * ```\n */\nexport const Chip = React.forwardRef<HTMLButtonElement, ChipProps>(\n (\n {\n className,\n variant = \"rounded\",\n size = \"32\",\n selected = false,\n disabled = false,\n leftDot = false,\n dotted = false,\n leftIcon,\n rightIcon,\n notificationLabel,\n onClick,\n asChild = false,\n children,\n ...props\n },\n ref,\n // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Variant-heavy UI component\n ) => {\n const isInteractive = !!onClick && !asChild;\n const Comp = asChild ? Slot : isInteractive ? \"button\" : \"span\";\n const isDark = variant === \"dark\";\n\n // The dashed border is drawn as an SVG so the dash length matches the design\n // spec (8/8 for the 40px square, 6/6 otherwise). CSS `border-dashed` only\n // renders browser-default dash lengths, which are too short. The stroke colour\n // is driven by `currentColor`, and `group-hover`/`group-active` react to the\n // chip's interactive states. Rendered only in the default (non-`asChild`) path.\n const showDottedBorder = !isDark && dotted && !selected && !asChild;\n const dottedBorder = showDottedBorder ? (\n <svg\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 size-full overflow-visible\",\n disabled ? \"text-buttons-chip-disabled\" : \"text-buttons-chip-dotted-default\",\n isInteractive &&\n !disabled &&\n \"group-hover:text-buttons-chip-dotted-hover-stroke group-active:text-buttons-chip-dotted-hover-stroke\",\n )}\n >\n <rect\n x=\"0.5\"\n y=\"0.5\"\n rx={variant === \"square\" ? 7.5 : size === \"40\" ? 19.5 : 15.5}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1\"\n strokeDasharray={variant === \"square\" && size === \"40\" ? \"8 8\" : \"6 6\"}\n style={{ width: \"calc(100% - 1px)\", height: \"calc(100% - 1px)\" }}\n />\n </svg>\n ) : null;\n\n return (\n <Comp\n ref={ref}\n data-testid=\"chip\"\n className={cn(\n \"relative inline-flex min-w-0 items-center justify-center whitespace-nowrap motion-safe:transition-colors motion-safe:duration-150\",\n // Shape\n variant === \"square\" ? \"rounded-xs\" : \"rounded-full\",\n // Size (32px uses 12px text, 40px uses 14px text per the design spec)\n size === \"32\" && \"typography-description-12px-semibold h-8 py-1\",\n size === \"40\" && \"typography-body-small-14px-semibold h-10 py-2.5\",\n // Variant colors\n isDark && \"bg-neutral-alphas-600 text-content-always-white\",\n !isDark && selected && !dotted && \"bg-buttons-chip-active text-content-primary-inverted\",\n // Active + dotted is a subtle filled state with a solid (non-dashed) border.\n !isDark &&\n selected &&\n dotted &&\n \"border border-border-primary border-solid bg-inputs-inputs-primary text-content-primary\",\n !isDark && !selected && !dotted && \"bg-buttons-chip-default text-content-primary\",\n // Dotted (non-selected): the dashed border is drawn via SVG (`dottedBorder`).\n // `group` lets that SVG react to hover/active. `asChild` keeps a CSS dashed\n // border fallback since the SVG is only rendered in the default path.\n !isDark && !selected && dotted && \"bg-transparent text-content-primary\",\n !isDark && !selected && dotted && !asChild && \"group\",\n asChild &&\n !isDark &&\n !selected &&\n dotted &&\n (disabled\n ? \"border border-buttons-chip-disabled border-dashed\"\n : \"border border-buttons-chip-dotted-default border-dashed\"),\n // Interactive\n isInteractive && !disabled && \"cursor-pointer\",\n isInteractive &&\n !disabled &&\n !isDark &&\n !selected &&\n !dotted &&\n \"hover:bg-buttons-chip-hover\",\n isInteractive &&\n !disabled &&\n !isDark &&\n !selected &&\n dotted &&\n \"hover:bg-neutral-alphas-50 active:bg-neutral-alphas-50\",\n // Focus\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n // Disabled\n disabled && isDark && \"pointer-events-none opacity-50\",\n disabled && !isDark && \"pointer-events-none text-content-disabled\",\n // Solid (non-dotted) disabled chips get a muted fill; dotted ones stay\n // transparent with their dashed border (drawn via SVG).\n disabled && !isDark && !dotted && \"bg-buttons-chip-disabled\",\n className,\n )}\n {...(isInteractive && {\n type: \"button\" as const,\n disabled,\n \"aria-pressed\": selected,\n onClick,\n })}\n {...(!isInteractive && disabled && { \"aria-disabled\": true })}\n {...(selected && { \"data-selected\": \"\" })}\n {...props}\n >\n {asChild ? (\n <Slottable>{children}</Slottable>\n ) : (\n <>\n {dottedBorder}\n <span className=\"flex min-w-0 items-center gap-0.5 overflow-hidden px-3\">\n {leftDot && (\n <span className=\"size-2 shrink-0 rounded-full bg-current\" aria-hidden=\"true\" />\n )}\n {leftIcon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {leftIcon}\n </span>\n )}\n <span className=\"min-w-0 truncate\">{children}</span>\n {rightIcon && (\n <span\n className=\"flex size-5 shrink-0 items-center justify-center\"\n aria-hidden=\"true\"\n >\n {rightIcon}\n </span>\n )}\n </span>\n {notificationLabel && (\n <span className=\"typography-description-12px-semibold absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-content-primary px-1 text-content-primary-inverted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,gBACC,WAAU;AAAA,gBACV,eAAY;AAAA,gBAEX,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,GAEJ;AAAA,UACC,qBACC,oBAAC,QAAA,EAAK,WAAU,iLACb,UAAA,kBAAA,CACH;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,KAAK,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Chip.mjs","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import { Slot, Slottable } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Count, type CountVariant } from \"../Count/Count\";\n\n/** Visual variant of the chip. */\nexport type ChipVariant = \"rounded\" | \"square\" | \"dark\";\n/** Height of the chip in pixels. */\nexport type ChipSize = \"32\" | \"40\";\n\nexport interface ChipProps extends React.HTMLAttributes<HTMLElement> {\n /** Visual variant of the chip. @default \"rounded\" */\n variant?: ChipVariant;\n /** Height of the chip in pixels. @default \"32\" */\n size?: ChipSize;\n /** Whether the chip is in a selected (pressed) state. @default false */\n selected?: boolean;\n /** Whether the chip is disabled. @default false */\n disabled?: boolean;\n /** Whether to show a coloured status dot at the leading edge. @default false */\n leftDot?: boolean;\n /**\n * Whether the chip uses a dashed border for add/create affordances.\n * When `selected`, it becomes a subtle filled state with a solid border.\n * Has no effect when `variant=\"dark\"`.\n * @default false\n */\n dotted?: boolean;\n /** Icon element displayed before the label. */\n leftIcon?: React.ReactNode;\n /** Icon element displayed after the label. */\n rightIcon?: React.ReactNode;\n /** Notification badge content (e.g. `\"99+\"`). Passed as a string for i18n support. */\n notificationLabel?: string;\n /** Numeric value for the notification badge. Uses the `Count` component for overflow formatting. Takes precedence over `notificationLabel` when both are provided. */\n notificationCount?: number;\n /** Maximum value before the badge shows overflow (e.g. `\"9+\"`). Only applies when `notificationCount` is set. @default 99 */\n notificationMax?: number;\n /** Colour variant of the notification badge. @default \"brand\" */\n notificationVariant?: CountVariant;\n /** Click handler — when provided, the chip renders as a `<button>` for accessibility. */\n onClick?: React.MouseEventHandler<HTMLElement>;\n /** Merge props onto a child element instead of rendering a wrapper. @default false */\n asChild?: boolean;\n}\n\n/**\n * A compact element for filters, tags, or toggleable actions. When an `onClick`\n * handler is provided, the chip renders as an interactive `<button>` with\n * `aria-pressed` support.\n *\n * @example\n * ```tsx\n * <Chip selected onClick={toggle}>Music</Chip>\n * ```\n */\nexport const Chip = React.forwardRef<HTMLButtonElement, ChipProps>(\n (\n {\n className,\n variant = \"rounded\",\n size = \"32\",\n selected = false,\n disabled = false,\n leftDot = false,\n dotted = false,\n leftIcon,\n rightIcon,\n notificationLabel,\n notificationCount,\n notificationMax,\n notificationVariant = \"brand\",\n onClick,\n asChild = false,\n children,\n ...props\n },\n ref,\n // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Variant-heavy UI component\n ) => {\n const isInteractive = !!onClick && !asChild;\n const Comp = asChild ? Slot : isInteractive ? \"button\" : \"span\";\n const isDark = variant === \"dark\";\n\n // The dashed border is drawn as an SVG so the dash length matches the design\n // spec (8/8 for the 40px square, 6/6 otherwise). CSS `border-dashed` only\n // renders browser-default dash lengths, which are too short. The stroke colour\n // is driven by `currentColor`, and `group-hover`/`group-active` react to the\n // chip's interactive states. Rendered only in the default (non-`asChild`) path.\n const showDottedBorder = !isDark && dotted && !selected && !asChild;\n const dottedBorder = showDottedBorder ? (\n <svg\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 size-full overflow-visible\",\n disabled ? \"text-buttons-chip-disabled\" : \"text-buttons-chip-dotted-default\",\n isInteractive &&\n !disabled &&\n \"group-hover:text-buttons-chip-dotted-hover-stroke group-active:text-buttons-chip-dotted-hover-stroke\",\n )}\n >\n <rect\n x=\"0.5\"\n y=\"0.5\"\n rx={variant === \"square\" ? 7.5 : size === \"40\" ? 19.5 : 15.5}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1\"\n strokeDasharray={variant === \"square\" && size === \"40\" ? \"8 8\" : \"6 6\"}\n style={{ width: \"calc(100% - 1px)\", height: \"calc(100% - 1px)\" }}\n />\n </svg>\n ) : null;\n\n return (\n <Comp\n ref={ref}\n data-testid=\"chip\"\n className={cn(\n \"relative inline-flex min-w-0 items-center justify-center whitespace-nowrap motion-safe:transition-colors motion-safe:duration-150\",\n // Shape\n variant === \"square\" ? \"rounded-xs\" : \"rounded-full\",\n // Size (32px uses 12px text, 40px uses 14px text per the design spec)\n size === \"32\" && \"typography-description-12px-semibold h-8 py-1\",\n size === \"40\" && \"typography-body-small-14px-semibold h-10 py-2.5\",\n // Variant colors\n isDark && \"bg-neutral-alphas-600 text-content-always-white\",\n !isDark && selected && !dotted && \"bg-buttons-chip-active text-content-primary-inverted\",\n // Active + dotted is a subtle filled state with a solid (non-dashed) border.\n !isDark &&\n selected &&\n dotted &&\n \"border border-border-primary border-solid bg-inputs-inputs-primary text-content-primary\",\n !isDark && !selected && !dotted && \"bg-buttons-chip-default text-content-primary\",\n // Dotted (non-selected): the dashed border is drawn via SVG (`dottedBorder`).\n // `group` lets that SVG react to hover/active. `asChild` keeps a CSS dashed\n // border fallback since the SVG is only rendered in the default path.\n !isDark && !selected && dotted && \"bg-transparent text-content-primary\",\n !isDark && !selected && dotted && !asChild && \"group\",\n asChild &&\n !isDark &&\n !selected &&\n dotted &&\n (disabled\n ? \"border border-buttons-chip-disabled border-dashed\"\n : \"border border-buttons-chip-dotted-default border-dashed\"),\n // Interactive\n isInteractive && !disabled && \"cursor-pointer\",\n isInteractive &&\n !disabled &&\n !isDark &&\n !selected &&\n !dotted &&\n \"hover:bg-buttons-chip-hover\",\n isInteractive &&\n !disabled &&\n !isDark &&\n !selected &&\n dotted &&\n \"hover:bg-neutral-alphas-50 active:bg-neutral-alphas-50\",\n // Focus\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n // Disabled\n disabled && isDark && \"pointer-events-none opacity-50\",\n disabled && !isDark && \"pointer-events-none text-content-disabled\",\n // Solid (non-dotted) disabled chips get a muted fill; dotted ones stay\n // transparent with their dashed border (drawn via SVG).\n disabled && !isDark && !dotted && \"bg-buttons-chip-disabled\",\n className,\n )}\n {...(isInteractive && {\n type: \"button\" as const,\n disabled,\n \"aria-pressed\": selected,\n onClick,\n })}\n {...(!isInteractive && disabled && { \"aria-disabled\": true })}\n {...(selected && { \"data-selected\": \"\" })}\n {...props}\n >\n {asChild ? (\n <Slottable>{children}</Slottable>\n ) : (\n <>\n {dottedBorder}\n <span className=\"flex min-w-0 items-center gap-0.5 overflow-hidden px-3\">\n {leftDot && (\n <span className=\"size-2 shrink-0 rounded-full bg-current\" aria-hidden=\"true\" />\n )}\n {leftIcon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {leftIcon}\n </span>\n )}\n <span className=\"min-w-0 truncate\">{children}</span>\n {rightIcon && (\n <span\n className=\"flex size-5 shrink-0 items-center justify-center\"\n aria-hidden=\"true\"\n >\n {rightIcon}\n </span>\n )}\n </span>\n {(notificationCount != null || notificationLabel) && (\n <Count\n variant={notificationVariant}\n size=\"32\"\n className={cn(\n // V2 Notification Count: 20px high/min-width, caption 12,\n // 4px horizontal and 2px vertical padding, rounded-md.\n \"absolute top-[-4px] rounded-md px-1 py-0.5\",\n // Anchor the leading edge so wider values grow away from the label.\n size === \"40\" ? \"left-[calc(100%_-_16px)]\" : \"left-[calc(100%_-_11px)]\",\n )}\n value={notificationCount ?? 0}\n max={notificationMax}\n >\n {notificationCount == null ? notificationLabel : undefined}\n </Count>\n )}\n </>\n )}\n </Comp>\n );\n },\n);\n\nChip.displayName = \"Chip\";\n"],"names":[],"mappings":";;;;;;AAwDO,MAAM,OAAO,MAAM;AAAA,EACxB,CACE;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV,OAAO;AAAA,IACP,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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AO,6BAA6B;AAAA,cAAA;AAAA,cAE/C,OAAO,qBAAqB;AAAA,cAC5B,KAAK;AAAA,cAEJ,UAAA,qBAAqB,OAAO,oBAAoB;AAAA,YAAA;AAAA,UAAA;AAAA,QACnD,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,KAAK,cAAc;"}
|
|
@@ -6,12 +6,33 @@ import { cn } from "../../utils/cn.mjs";
|
|
|
6
6
|
function getDisplayValue(value, max) {
|
|
7
7
|
return value > max ? `${max}+` : value.toString();
|
|
8
8
|
}
|
|
9
|
+
function variantClasses(variant) {
|
|
10
|
+
switch (variant) {
|
|
11
|
+
case "default":
|
|
12
|
+
return "bg-content-primary text-content-primary-inverted";
|
|
13
|
+
case "contrast":
|
|
14
|
+
return "bg-content-always-white text-content-always-black";
|
|
15
|
+
case "brand":
|
|
16
|
+
return "bg-brand-primary-default text-content-always-black";
|
|
17
|
+
case "alert":
|
|
18
|
+
return "bg-error-content text-content-always-white";
|
|
19
|
+
case "pink":
|
|
20
|
+
return "bg-brand-secondary-default text-content-always-black";
|
|
21
|
+
case "info":
|
|
22
|
+
return "bg-info-content text-content-always-white";
|
|
23
|
+
case "success":
|
|
24
|
+
return "bg-success-content text-content-always-white";
|
|
25
|
+
case "warning":
|
|
26
|
+
return "bg-warning-content text-content-always-black";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
9
29
|
const Count = React.forwardRef(
|
|
10
30
|
({
|
|
11
31
|
className,
|
|
12
32
|
variant = "default",
|
|
13
33
|
value = 0,
|
|
14
34
|
max = 99,
|
|
35
|
+
showAmount = true,
|
|
15
36
|
size = "32",
|
|
16
37
|
asChild = false,
|
|
17
38
|
children,
|
|
@@ -21,22 +42,30 @@ const Count = React.forwardRef(
|
|
|
21
42
|
return null;
|
|
22
43
|
}
|
|
23
44
|
const Comp = asChild ? Slot : "span";
|
|
45
|
+
const colors = variantClasses(variant);
|
|
46
|
+
if (!showAmount) {
|
|
47
|
+
return /* @__PURE__ */ jsx(
|
|
48
|
+
Comp,
|
|
49
|
+
{
|
|
50
|
+
ref,
|
|
51
|
+
"data-testid": "count",
|
|
52
|
+
className: cn("inline-flex size-2 shrink-0 rounded-full", colors, className),
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
24
57
|
return /* @__PURE__ */ jsx(
|
|
25
58
|
Comp,
|
|
26
59
|
{
|
|
27
60
|
ref,
|
|
61
|
+
"data-testid": "count",
|
|
28
62
|
className: cn(
|
|
29
63
|
"typography-description-12px-semibold inline-flex shrink-0 items-center justify-center rounded-full tabular-nums leading-none",
|
|
30
64
|
size === "16" && "h-3 min-w-3 px-0.5 text-[8px]",
|
|
65
|
+
// Kept at 16px so nav / IconButton badges don't grow; Chip nests this size.
|
|
31
66
|
size === "24" && "h-4 min-w-4 px-1 text-[10px]",
|
|
32
67
|
size === "32" && "h-5 min-w-5 px-1.5 text-[12px]",
|
|
33
|
-
|
|
34
|
-
variant === "alert" && "bg-error-content text-content-always-white",
|
|
35
|
-
variant === "brand" && "bg-brand-primary-default text-content-always-black",
|
|
36
|
-
variant === "pink" && "bg-brand-secondary-default text-content-always-black",
|
|
37
|
-
variant === "info" && "bg-info-content text-content-always-white",
|
|
38
|
-
variant === "success" && "bg-success-content text-content-always-white",
|
|
39
|
-
variant === "warning" && "bg-warning-content text-content-always-black",
|
|
68
|
+
colors,
|
|
40
69
|
className
|
|
41
70
|
),
|
|
42
71
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Count.mjs","sources":["../../../src/components/Count/Count.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n
|
|
1
|
+
{"version":3,"file":"Count.mjs","sources":["../../../src/components/Count/Count.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/**\n * Colour variant for the count badge.\n *\n * V2 Notification Count (Fanvue Library) types: `default`, `brand`, `contrast`.\n * Remaining values are retained extensions for existing consumers.\n */\nexport type CountVariant =\n | \"default\"\n | \"contrast\"\n | \"brand\"\n | \"alert\"\n | \"pink\"\n | \"info\"\n | \"success\"\n | \"warning\";\n\n/** Size of the count badge, aligned with button and icon-button sizes. */\nexport type CountSize = \"16\" | \"24\" | \"32\";\n\nfunction getDisplayValue(value: number, max: number): string {\n return value > max ? `${max}+` : value.toString();\n}\n\nfunction variantClasses(variant: CountVariant): string {\n switch (variant) {\n case \"default\":\n return \"bg-content-primary text-content-primary-inverted\";\n case \"contrast\":\n // V2: on dark or coloured hosts (filled buttons, images)\n return \"bg-content-always-white text-content-always-black\";\n case \"brand\":\n return \"bg-brand-primary-default text-content-always-black\";\n case \"alert\":\n return \"bg-error-content text-content-always-white\";\n case \"pink\":\n return \"bg-brand-secondary-default text-content-always-black\";\n case \"info\":\n return \"bg-info-content text-content-always-white\";\n case \"success\":\n return \"bg-success-content text-content-always-white\";\n case \"warning\":\n return \"bg-warning-content text-content-always-black\";\n }\n}\n\nexport interface CountProps extends React.HTMLAttributes<HTMLSpanElement> {\n /**\n * Colour variant of the count badge.\n * Figma V2 types: `default` | `brand` | `contrast`. @default \"default\"\n */\n variant?: CountVariant;\n /** Numeric value to display. Renders nothing when `0` and no `children` are provided. @default 0 */\n value?: number;\n /** Maximum value before showing overflow (e.g. `\"99+\"`). @default 99 */\n max?: number;\n /**\n * When `false`, renders an 8px unread dot instead of a numeric amount\n * (Figma Show Amount=False). @default true\n */\n showAmount?: boolean;\n /** Size of the count badge. @default \"32\" */\n size?: CountSize;\n /** Merge props onto a child element instead of rendering a `<span>`. @default false */\n asChild?: boolean;\n}\n\n/**\n * V2 Notification Count — a small badge for unread activity on nav items,\n * icons, buttons, or chips. Truncates values above `max` (e.g. `\"99+\"`).\n * Renders nothing when the value is `0` and no children are provided.\n *\n * @example\n * ```tsx\n * <Count value={5} variant=\"brand\" />\n * <Count value={1} variant=\"brand\" showAmount={false} />\n * ```\n */\nexport const Count = React.forwardRef<HTMLSpanElement, CountProps>(\n (\n {\n className,\n variant = \"default\",\n value = 0,\n max = 99,\n showAmount = true,\n size = \"32\",\n asChild = false,\n children,\n ...props\n },\n ref,\n ) => {\n if (value === 0 && !children) {\n return null;\n }\n\n const Comp = asChild ? Slot : \"span\";\n const colors = variantClasses(variant);\n\n if (!showAmount) {\n return (\n <Comp\n ref={ref}\n data-testid=\"count\"\n className={cn(\"inline-flex size-2 shrink-0 rounded-full\", colors, className)}\n {...props}\n />\n );\n }\n\n return (\n <Comp\n ref={ref}\n data-testid=\"count\"\n className={cn(\n \"typography-description-12px-semibold inline-flex shrink-0 items-center justify-center rounded-full tabular-nums leading-none\",\n size === \"16\" && \"h-3 min-w-3 px-0.5 text-[8px]\",\n // Kept at 16px so nav / IconButton badges don't grow; Chip nests this size.\n size === \"24\" && \"h-4 min-w-4 px-1 text-[10px]\",\n size === \"32\" && \"h-5 min-w-5 px-1.5 text-[12px]\",\n colors,\n className,\n )}\n {...props}\n >\n {children ?? getDisplayValue(value, max)}\n </Comp>\n );\n },\n);\n\nCount.displayName = \"Count\";\n"],"names":[],"mappings":";;;;;AAuBA,SAAS,gBAAgB,OAAe,KAAqB;AAC3D,SAAO,QAAQ,MAAM,GAAG,GAAG,MAAM,MAAM,SAAA;AACzC;AAEA,SAAS,eAAe,SAA+B;AACrD,UAAQ,SAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAEH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,EAAA;AAEb;AAkCO,MAAM,QAAQ,MAAM;AAAA,EACzB,CACE;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,UAAU,KAAK,CAAC,UAAU;AAC5B,aAAO;AAAA,IACT;AAEA,UAAM,OAAO,UAAU,OAAO;AAC9B,UAAM,SAAS,eAAe,OAAO;AAErC,QAAI,CAAC,YAAY;AACf,aACE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA,eAAY;AAAA,UACZ,WAAW,GAAG,4CAA4C,QAAQ,SAAS;AAAA,UAC1E,GAAG;AAAA,QAAA;AAAA,MAAA;AAAA,IAGV;AAEA,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA,SAAS,QAAQ;AAAA;AAAA,UAEjB,SAAS,QAAQ;AAAA,UACjB,SAAS,QAAQ;AAAA,UACjB;AAAA,UACA;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEH,UAAA,YAAY,gBAAgB,OAAO,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAG7C;AACF;AAEA,MAAM,cAAc;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { BaseIcon } from "./BaseIcon.mjs";
|
|
5
|
+
const VARIANTS = {
|
|
6
|
+
16: {
|
|
7
|
+
outlined: [
|
|
8
|
+
{
|
|
9
|
+
d: "M11.713 2.573a.504.504 0 0 1-.5-.5V1.34c0-.273.227-.5.5-.5s.5.227.5.5v.733c0 .274-.227.5-.5.5m0 5.127a.504.504 0 0 1-.5-.5v-.733c0-.274.227-.5.5-.5s.5.226.5.5V7.2c0 .273-.227.5-.5.5"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
d: "M12.153 6.973h-.806c-.554 0-1.06-.3-1.34-.773a.501.501 0 1 1 .866-.507c.1.167.28.273.48.28h.8a.532.532 0 0 0 .134-1.047l-1.374-.346a1.535 1.535 0 0 1-1.146-1.674 1.526 1.526 0 0 1 1.513-1.34h.807c.553 0 1.06.3 1.333.774a.501.501 0 1 1-.867.506.56.56 0 0 0-.473-.273h-.8a.532.532 0 0 0-.133 1.047l1.373.346a1.526 1.526 0 0 1-.367 3.007m-8.48 8.187H2.227a1.22 1.22 0 0 1-1.22-1.22V9.613c0-.673.546-1.22 1.22-1.22h1.44c.673 0 1.22.547 1.22 1.22v4.327a1.22 1.22 0 0 1-1.22 1.22zM2.227 9.393c-.12 0-.22.1-.22.22v4.327c0 .12.1.22.22.22h1.44c.12 0 .22-.1.22-.22V9.613c0-.12-.1-.22-.22-.22z"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
d: "M8.527 15.087a3.4 3.4 0 0 1-.82-.1l-1.914-.48a2.4 2.4 0 0 0-.58-.074h-.82a.504.504 0 0 1-.5-.5c0-.273.227-.5.5-.5h.82c.274 0 .554.034.82.1l1.914.48c.34.087.7.094 1.046.027l2.114-.42c.46-.093.886-.32 1.22-.653l1.493-1.494a.58.58 0 0 0 .173-.42.59.59 0 0 0-.947-.473l-1.74 1.307a1.93 1.93 0 0 1-1.166.386H8.727a.504.504 0 0 1-.5-.5c0-.273.226-.5.5-.5h1.413c.2 0 .4-.066.567-.186l1.74-1.307a1.6 1.6 0 0 1 2.08.147c.3.3.466.7.466 1.126a1.6 1.6 0 0 1-.466 1.127l-1.494 1.493a3.4 3.4 0 0 1-1.726.927l-2.114.42q-.33.069-.66.067z"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
d: "M9.793 12.28H8.72a.504.504 0 0 1-.5-.5c0-.273.227-.5.5-.5h1.073c.16 0 .307-.06.42-.173a.6.6 0 0 0 .174-.42v-.22a.59.59 0 0 0-.447-.573L8.287 9.48a2.92 2.92 0 0 0-2.3.4l-1.314.874a.496.496 0 0 1-.693-.14.496.496 0 0 1 .14-.694l1.313-.873c.907-.6 2.047-.8 3.1-.54l1.654.413a1.59 1.59 0 0 1 1.206 1.547v.22c0 .427-.166.827-.466 1.127s-.7.466-1.127.466z"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
24: {
|
|
23
|
+
outlined: [
|
|
24
|
+
{
|
|
25
|
+
d: "M17.57 3.86c-.41 0-.75-.34-.75-.75v-1.1c0-.41.34-.75.75-.75s.75.34.75.75v1.1c0 .41-.34.75-.75.75m0 7.69c-.41 0-.75-.34-.75-.75V9.7c0-.41.34-.75.75-.75s.75.34.75.75v1.1c0 .41-.34.75-.75.75"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
d: "M18.23 10.46h-1.21c-.83 0-1.59-.45-2.01-1.16a.752.752 0 1 1 1.3-.76c.15.25.42.41.72.42h1.2a.798.798 0 0 0 .2-1.57l-2.06-.52a2.3 2.3 0 0 1-1.72-2.51 2.29 2.29 0 0 1 2.27-2.01h1.21c.83 0 1.59.45 2 1.16a.752.752 0 1 1-1.3.76.84.84 0 0 0-.71-.41h-1.2a.798.798 0 0 0-.2 1.57l2.06.52c1.12.28 1.86 1.36 1.72 2.5a2.29 2.29 0 0 1-2.27 2.01M5.51 22.74H3.34a1.83 1.83 0 0 1-1.83-1.83v-6.49c0-1.01.82-1.83 1.83-1.83H5.5c1.01 0 1.83.82 1.83 1.83v6.49c0 1.01-.82 1.83-1.83 1.83zm-2.17-8.65c-.18 0-.33.15-.33.33v6.49c0 .18.15.33.33.33H5.5c.18 0 .33-.15.33-.33v-6.49c0-.18-.15-.33-.33-.33z"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
d: "M12.79 22.63q-.63 0-1.23-.15l-2.87-.72c-.28-.07-.58-.11-.87-.11H6.59c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h1.23c.41 0 .83.05 1.23.15l2.87.72c.51.13 1.05.14 1.57.04l3.17-.63c.69-.14 1.33-.48 1.83-.98l2.24-2.24c.17-.17.26-.39.26-.63s-.09-.46-.26-.63a.884.884 0 0 0-1.16-.08l-2.61 1.96c-.5.38-1.12.58-1.75.58h-2.12c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h2.12c.3 0 .6-.1.85-.28l2.61-1.96c.94-.71 2.29-.61 3.12.22.45.45.7 1.05.7 1.69a2.4 2.4 0 0 1-.7 1.69l-2.24 2.24a5.1 5.1 0 0 1-2.59 1.39l-3.17.63c-.33.07-.66.1-.99.1z"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
d: "M14.69 18.42h-1.61c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h1.61c.24 0 .46-.09.63-.26s.26-.39.26-.63v-.33c0-.41-.28-.76-.67-.86l-2.48-.62a4.38 4.38 0 0 0-3.45.6l-1.97 1.31c-.35.23-.81.14-1.04-.21a.745.745 0 0 1 .21-1.04l1.97-1.31a5.92 5.92 0 0 1 4.65-.81l2.48.62c1.07.27 1.81 1.22 1.81 2.32v.33c0 .64-.25 1.24-.7 1.69s-1.05.7-1.69.7z"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
32: {
|
|
39
|
+
outlined: [
|
|
40
|
+
{
|
|
41
|
+
d: "M23.426 5.146c-.547 0-1-.453-1-1V2.68c0-.547.453-1 1-1s1 .453 1 1v1.466c0 .547-.454 1-1 1m0 10.254c-.547 0-1-.453-1-1v-1.466c0-.547.453-1 1-1s1 .453 1 1V14.4c0 .547-.454 1-1 1"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
d: "M24.307 13.946h-1.613c-1.107 0-2.12-.6-2.68-1.547-.28-.48-.12-1.093.36-1.373s1.093-.12 1.373.36c.2.333.56.547.96.56h1.6a1.064 1.064 0 0 0 .267-2.093l-2.747-.694a3.07 3.07 0 0 1-2.293-3.346 3.05 3.05 0 0 1 3.026-2.68h1.614c1.106 0 2.12.6 2.666 1.546a1.003 1.003 0 1 1-1.733 1.014c-.2-.334-.56-.547-.947-.547h-1.6a1.065 1.065 0 0 0-.266 2.093l2.746.694a3.064 3.064 0 0 1 2.294 3.333 3.05 3.05 0 0 1-3.027 2.68M7.347 30.32H4.453a2.44 2.44 0 0 1-2.44-2.44v-8.653a2.44 2.44 0 0 1 2.44-2.44h2.88a2.44 2.44 0 0 1 2.44 2.44v8.653a2.44 2.44 0 0 1-2.44 2.44zM4.453 18.787c-.24 0-.44.2-.44.44v8.653c0 .24.2.44.44.44h2.88c.24 0 .44-.2.44-.44v-8.653c0-.24-.2-.44-.44-.44z"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
d: "M17.053 30.173q-.84 0-1.64-.2l-3.826-.96a5 5 0 0 0-1.16-.147h-1.64c-.547 0-1-.453-1-1s.453-1 1-1h1.64a6.8 6.8 0 0 1 1.64.2l3.826.96c.68.174 1.4.187 2.094.054l4.226-.84a4.8 4.8 0 0 0 2.44-1.307l2.987-2.987c.227-.226.347-.52.347-.84s-.12-.613-.347-.84a1.18 1.18 0 0 0-1.547-.106l-3.48 2.613a3.86 3.86 0 0 1-2.333.773h-2.827c-.546 0-1-.453-1-1s.454-1 1-1h2.827c.4 0 .8-.133 1.133-.373l3.48-2.613c1.254-.947 3.054-.814 4.16.293.6.6.934 1.4.934 2.253s-.347 1.667-.934 2.254l-2.986 2.986a6.8 6.8 0 0 1-3.454 1.854l-4.226.84c-.44.093-.88.133-1.32.133z"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
d: "M19.587 24.56H17.44c-.547 0-1-.453-1-1s.453-1 1-1h2.147c.32 0 .613-.12.84-.346a1.17 1.17 0 0 0 .346-.84v-.44c0-.547-.373-1.014-.893-1.147l-3.307-.827a5.84 5.84 0 0 0-4.6.8l-2.626 1.747a.993.993 0 0 1-1.387-.28.993.993 0 0 1 .28-1.387l2.627-1.746a7.9 7.9 0 0 1 6.2-1.08l3.306.826a3.18 3.18 0 0 1 2.414 3.094v.44c0 .853-.334 1.653-.934 2.253s-1.4.933-2.253.933z"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const ReceiveMoneyIcon = React.forwardRef(
|
|
56
|
+
(props, ref) => /* @__PURE__ */ jsx(BaseIcon, { ref, variants: VARIANTS, ...props })
|
|
57
|
+
);
|
|
58
|
+
ReceiveMoneyIcon.displayName = "ReceiveMoneyIcon";
|
|
59
|
+
export {
|
|
60
|
+
ReceiveMoneyIcon
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=ReceiveMoneyIcon.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReceiveMoneyIcon.mjs","sources":["../../../src/components/Icons/ReceiveMoneyIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { BaseIcon } from \"./BaseIcon\";\nimport type { BaseIconProps, IconVariants } from \"./types\";\n\nconst VARIANTS: IconVariants = {\n 16: {\n outlined: [\n {\n d: \"M11.713 2.573a.504.504 0 0 1-.5-.5V1.34c0-.273.227-.5.5-.5s.5.227.5.5v.733c0 .274-.227.5-.5.5m0 5.127a.504.504 0 0 1-.5-.5v-.733c0-.274.227-.5.5-.5s.5.226.5.5V7.2c0 .273-.227.5-.5.5\",\n },\n {\n d: \"M12.153 6.973h-.806c-.554 0-1.06-.3-1.34-.773a.501.501 0 1 1 .866-.507c.1.167.28.273.48.28h.8a.532.532 0 0 0 .134-1.047l-1.374-.346a1.535 1.535 0 0 1-1.146-1.674 1.526 1.526 0 0 1 1.513-1.34h.807c.553 0 1.06.3 1.333.774a.501.501 0 1 1-.867.506.56.56 0 0 0-.473-.273h-.8a.532.532 0 0 0-.133 1.047l1.373.346a1.526 1.526 0 0 1-.367 3.007m-8.48 8.187H2.227a1.22 1.22 0 0 1-1.22-1.22V9.613c0-.673.546-1.22 1.22-1.22h1.44c.673 0 1.22.547 1.22 1.22v4.327a1.22 1.22 0 0 1-1.22 1.22zM2.227 9.393c-.12 0-.22.1-.22.22v4.327c0 .12.1.22.22.22h1.44c.12 0 .22-.1.22-.22V9.613c0-.12-.1-.22-.22-.22z\",\n },\n {\n d: \"M8.527 15.087a3.4 3.4 0 0 1-.82-.1l-1.914-.48a2.4 2.4 0 0 0-.58-.074h-.82a.504.504 0 0 1-.5-.5c0-.273.227-.5.5-.5h.82c.274 0 .554.034.82.1l1.914.48c.34.087.7.094 1.046.027l2.114-.42c.46-.093.886-.32 1.22-.653l1.493-1.494a.58.58 0 0 0 .173-.42.59.59 0 0 0-.947-.473l-1.74 1.307a1.93 1.93 0 0 1-1.166.386H8.727a.504.504 0 0 1-.5-.5c0-.273.226-.5.5-.5h1.413c.2 0 .4-.066.567-.186l1.74-1.307a1.6 1.6 0 0 1 2.08.147c.3.3.466.7.466 1.126a1.6 1.6 0 0 1-.466 1.127l-1.494 1.493a3.4 3.4 0 0 1-1.726.927l-2.114.42q-.33.069-.66.067z\",\n },\n {\n d: \"M9.793 12.28H8.72a.504.504 0 0 1-.5-.5c0-.273.227-.5.5-.5h1.073c.16 0 .307-.06.42-.173a.6.6 0 0 0 .174-.42v-.22a.59.59 0 0 0-.447-.573L8.287 9.48a2.92 2.92 0 0 0-2.3.4l-1.314.874a.496.496 0 0 1-.693-.14.496.496 0 0 1 .14-.694l1.313-.873c.907-.6 2.047-.8 3.1-.54l1.654.413a1.59 1.59 0 0 1 1.206 1.547v.22c0 .427-.166.827-.466 1.127s-.7.466-1.127.466z\",\n },\n ],\n },\n 24: {\n outlined: [\n {\n d: \"M17.57 3.86c-.41 0-.75-.34-.75-.75v-1.1c0-.41.34-.75.75-.75s.75.34.75.75v1.1c0 .41-.34.75-.75.75m0 7.69c-.41 0-.75-.34-.75-.75V9.7c0-.41.34-.75.75-.75s.75.34.75.75v1.1c0 .41-.34.75-.75.75\",\n },\n {\n d: \"M18.23 10.46h-1.21c-.83 0-1.59-.45-2.01-1.16a.752.752 0 1 1 1.3-.76c.15.25.42.41.72.42h1.2a.798.798 0 0 0 .2-1.57l-2.06-.52a2.3 2.3 0 0 1-1.72-2.51 2.29 2.29 0 0 1 2.27-2.01h1.21c.83 0 1.59.45 2 1.16a.752.752 0 1 1-1.3.76.84.84 0 0 0-.71-.41h-1.2a.798.798 0 0 0-.2 1.57l2.06.52c1.12.28 1.86 1.36 1.72 2.5a2.29 2.29 0 0 1-2.27 2.01M5.51 22.74H3.34a1.83 1.83 0 0 1-1.83-1.83v-6.49c0-1.01.82-1.83 1.83-1.83H5.5c1.01 0 1.83.82 1.83 1.83v6.49c0 1.01-.82 1.83-1.83 1.83zm-2.17-8.65c-.18 0-.33.15-.33.33v6.49c0 .18.15.33.33.33H5.5c.18 0 .33-.15.33-.33v-6.49c0-.18-.15-.33-.33-.33z\",\n },\n {\n d: \"M12.79 22.63q-.63 0-1.23-.15l-2.87-.72c-.28-.07-.58-.11-.87-.11H6.59c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h1.23c.41 0 .83.05 1.23.15l2.87.72c.51.13 1.05.14 1.57.04l3.17-.63c.69-.14 1.33-.48 1.83-.98l2.24-2.24c.17-.17.26-.39.26-.63s-.09-.46-.26-.63a.884.884 0 0 0-1.16-.08l-2.61 1.96c-.5.38-1.12.58-1.75.58h-2.12c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h2.12c.3 0 .6-.1.85-.28l2.61-1.96c.94-.71 2.29-.61 3.12.22.45.45.7 1.05.7 1.69a2.4 2.4 0 0 1-.7 1.69l-2.24 2.24a5.1 5.1 0 0 1-2.59 1.39l-3.17.63c-.33.07-.66.1-.99.1z\",\n },\n {\n d: \"M14.69 18.42h-1.61c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h1.61c.24 0 .46-.09.63-.26s.26-.39.26-.63v-.33c0-.41-.28-.76-.67-.86l-2.48-.62a4.38 4.38 0 0 0-3.45.6l-1.97 1.31c-.35.23-.81.14-1.04-.21a.745.745 0 0 1 .21-1.04l1.97-1.31a5.92 5.92 0 0 1 4.65-.81l2.48.62c1.07.27 1.81 1.22 1.81 2.32v.33c0 .64-.25 1.24-.7 1.69s-1.05.7-1.69.7z\",\n },\n ],\n },\n 32: {\n outlined: [\n {\n d: \"M23.426 5.146c-.547 0-1-.453-1-1V2.68c0-.547.453-1 1-1s1 .453 1 1v1.466c0 .547-.454 1-1 1m0 10.254c-.547 0-1-.453-1-1v-1.466c0-.547.453-1 1-1s1 .453 1 1V14.4c0 .547-.454 1-1 1\",\n },\n {\n d: \"M24.307 13.946h-1.613c-1.107 0-2.12-.6-2.68-1.547-.28-.48-.12-1.093.36-1.373s1.093-.12 1.373.36c.2.333.56.547.96.56h1.6a1.064 1.064 0 0 0 .267-2.093l-2.747-.694a3.07 3.07 0 0 1-2.293-3.346 3.05 3.05 0 0 1 3.026-2.68h1.614c1.106 0 2.12.6 2.666 1.546a1.003 1.003 0 1 1-1.733 1.014c-.2-.334-.56-.547-.947-.547h-1.6a1.065 1.065 0 0 0-.266 2.093l2.746.694a3.064 3.064 0 0 1 2.294 3.333 3.05 3.05 0 0 1-3.027 2.68M7.347 30.32H4.453a2.44 2.44 0 0 1-2.44-2.44v-8.653a2.44 2.44 0 0 1 2.44-2.44h2.88a2.44 2.44 0 0 1 2.44 2.44v8.653a2.44 2.44 0 0 1-2.44 2.44zM4.453 18.787c-.24 0-.44.2-.44.44v8.653c0 .24.2.44.44.44h2.88c.24 0 .44-.2.44-.44v-8.653c0-.24-.2-.44-.44-.44z\",\n },\n {\n d: \"M17.053 30.173q-.84 0-1.64-.2l-3.826-.96a5 5 0 0 0-1.16-.147h-1.64c-.547 0-1-.453-1-1s.453-1 1-1h1.64a6.8 6.8 0 0 1 1.64.2l3.826.96c.68.174 1.4.187 2.094.054l4.226-.84a4.8 4.8 0 0 0 2.44-1.307l2.987-2.987c.227-.226.347-.52.347-.84s-.12-.613-.347-.84a1.18 1.18 0 0 0-1.547-.106l-3.48 2.613a3.86 3.86 0 0 1-2.333.773h-2.827c-.546 0-1-.453-1-1s.454-1 1-1h2.827c.4 0 .8-.133 1.133-.373l3.48-2.613c1.254-.947 3.054-.814 4.16.293.6.6.934 1.4.934 2.253s-.347 1.667-.934 2.254l-2.986 2.986a6.8 6.8 0 0 1-3.454 1.854l-4.226.84c-.44.093-.88.133-1.32.133z\",\n },\n {\n d: \"M19.587 24.56H17.44c-.547 0-1-.453-1-1s.453-1 1-1h2.147c.32 0 .613-.12.84-.346a1.17 1.17 0 0 0 .346-.84v-.44c0-.547-.373-1.014-.893-1.147l-3.307-.827a5.84 5.84 0 0 0-4.6.8l-2.626 1.747a.993.993 0 0 1-1.387-.28.993.993 0 0 1 .28-1.387l2.627-1.746a7.9 7.9 0 0 1 6.2-1.08l3.306.826a3.18 3.18 0 0 1 2.414 3.094v.44c0 .853-.334 1.653-.934 2.253s-1.4.933-2.253.933z\",\n },\n ],\n },\n};\n\n/** Props for {@link ReceiveMoneyIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type ReceiveMoneyIconProps = BaseIconProps;\n\n/**\n * Receive Money icon. Renders at sizes 16, 24, or 32 px.\n *\n * @example\n * ```tsx\n * <ReceiveMoneyIcon size={24} />\n * ```\n */\nexport const ReceiveMoneyIcon = React.forwardRef<SVGSVGElement, ReceiveMoneyIconProps>(\n (props, ref) => <BaseIcon ref={ref} variants={VARIANTS} {...props} />,\n);\n\nReceiveMoneyIcon.displayName = \"ReceiveMoneyIcon\";\n"],"names":[],"mappings":";;;;AAIA,MAAM,WAAyB;AAAA,EAC7B,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAEJ;AAaO,MAAM,mBAAmB,MAAM;AAAA,EACpC,CAAC,OAAO,QAAQ,oBAAC,YAAS,KAAU,UAAU,UAAW,GAAG,MAAA,CAAO;AACrE;AAEA,iBAAiB,cAAc;"}
|