@betterinternship/components 3.3.7 → 3.3.8
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.
|
@@ -32,8 +32,11 @@ function Banner({ icon: Icon, media, visual, visualClassName, title, description
|
|
|
32
32
|
const leadingVisual = visual ?? media;
|
|
33
33
|
const hasIconSlot = Boolean(leadingVisual || Icon);
|
|
34
34
|
return (jsxs("div", { "data-slot": "banner", className: cn("group/banner flex flex-col rounded-control-lg border", compact
|
|
35
|
-
? "items-start gap-3 p-3 sm:flex-row sm:items-
|
|
36
|
-
: "gap-4 px-4 py-4 sm:flex-row sm:items-stretch sm:gap-3 sm:px-5", styles.container, className), ...props, children: [jsxs("div", { className: cn("flex min-w-0 flex-1 items-start gap-3 sm:items-stretch sm:gap-3",
|
|
35
|
+
? "items-start gap-3 p-3 sm:flex-row sm:items-center sm:gap-2"
|
|
36
|
+
: "gap-4 px-4 py-4 sm:flex-row sm:items-stretch sm:gap-3 sm:px-5", styles.container, className), ...props, children: [jsxs("div", { className: cn("flex min-w-0 flex-1 items-start gap-3 sm:items-stretch sm:gap-3",
|
|
37
|
+
// Compact: the icon tile and the text centre on each other, so a
|
|
38
|
+
// one-line message sits level with the icon.
|
|
39
|
+
compact && "items-center gap-2 sm:items-center sm:gap-2"), children: [hasIconSlot && (jsx("span", { className: cn("flex shrink-0 items-center justify-center rounded-control-lg", compact ? "size-8" : "size-10 sm:self-center", styles.icon, visualClassName), children: leadingVisual ??
|
|
37
40
|
(IconComponent ? (jsx(IconComponent, { className: compact ? "size-4" : "size-5", "aria-hidden": "true" })) : isValidElement(Icon) ? Icon : Icon) })), jsxs("div", { className: cn("min-w-0 flex-1", description ? "space-y-0.5" : "flex flex-col justify-center"), children: [jsx("p", { className: cn("text-sm font-medium", variant === 'banner' ? 'text-secondary-foreground' : 'text-foreground'), children: title }), description && (jsx("div", { className: cn("text-sm", variant === 'banner' ? 'text-secondary-foreground' : 'text-muted-foreground'), children: description }))] })] }), action && (jsx("div", { className: cn("w-full shrink-0 sm:w-auto sm:self-center", actionClassName), children: action }))] }));
|
|
38
41
|
}
|
|
39
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.js","sources":["../../src/components/banner.tsx"],"sourcesContent":["import { isValidElement, type ComponentProps, type ReactNode } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { cn } from \"@/utils\";\n\ntype BannerVariant = \"neutral\" | \"primary\" | \"warning\" | \"destructive\" | \"banner\";\n\nconst variantClasses: Record<\n BannerVariant,\n { container: string; icon: string }\n> = {\n banner: {\n container: 'border-secondary-border bg-secondary text-secondary-foreground',\n icon: 'bg-secondary text-secondary-foreground',\n },\n neutral: {\n container: 'border-landing-control bg-background text-landing-nav',\n icon: 'bg-v2-surface-subtle text-landing-nav',\n },\n primary: {\n container:\n \"border-primary/25 bg-primary/[0.035] transition-colors duration-state ease-out-strong hover:bg-primary/[0.06] motion-reduce:transition-none\",\n icon: \"bg-primary/5 text-primary\",\n },\n warning: {\n container:\n \"border-warning/30 bg-warning/10 transition-colors duration-state ease-out-strong hover:bg-warning/15 motion-reduce:transition-none\",\n icon: \"bg-warning/10 text-warning\",\n },\n destructive: {\n container:\n \"border-destructive/30 bg-destructive/5 transition-colors duration-state ease-out-strong hover:bg-destructive/10 motion-reduce:transition-none\",\n icon: \"bg-destructive/10 text-destructive\",\n },\n};\n\nfunction Banner({\n icon: Icon,\n media,\n visual,\n visualClassName,\n title,\n description,\n action,\n actionClassName,\n variant = \"primary\",\n compact = false,\n className,\n ...props\n}: Omit<ComponentProps<\"div\">, \"title\"> & {\n /** Accepts a Lucide icon component or any custom React node. */\n icon?: LucideIcon | ReactNode;\n media?: ReactNode;\n visual?: ReactNode;\n visualClassName?: string;\n /** Any node, e.g. an icon inline with the text (not the HTML title attribute). */\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n actionClassName?: string;\n variant?: BannerVariant;\n compact?: boolean;\n}) {\n const styles = variantClasses[variant];\n // The icon is optional: without one (or a custom media node) the slot is\n // dropped entirely rather than leaving an empty tinted square.\n const IconComponent = typeof Icon === 'function' || (Icon && typeof Icon === 'object' && !isValidElement(Icon)) ? Icon as LucideIcon : undefined;\n const leadingVisual = visual ?? media;\n const hasIconSlot = Boolean(leadingVisual || Icon);\n\n return (\n <div\n data-slot=\"banner\"\n className={cn(\n \"group/banner flex flex-col rounded-control-lg border\",\n compact\n ? \"items-start gap-3 p-3 sm:flex-row sm:items-
|
|
1
|
+
{"version":3,"file":"banner.js","sources":["../../src/components/banner.tsx"],"sourcesContent":["import { isValidElement, type ComponentProps, type ReactNode } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { cn } from \"@/utils\";\n\ntype BannerVariant = \"neutral\" | \"primary\" | \"warning\" | \"destructive\" | \"banner\";\n\nconst variantClasses: Record<\n BannerVariant,\n { container: string; icon: string }\n> = {\n banner: {\n container: 'border-secondary-border bg-secondary text-secondary-foreground',\n icon: 'bg-secondary text-secondary-foreground',\n },\n neutral: {\n container: 'border-landing-control bg-background text-landing-nav',\n icon: 'bg-v2-surface-subtle text-landing-nav',\n },\n primary: {\n container:\n \"border-primary/25 bg-primary/[0.035] transition-colors duration-state ease-out-strong hover:bg-primary/[0.06] motion-reduce:transition-none\",\n icon: \"bg-primary/5 text-primary\",\n },\n warning: {\n container:\n \"border-warning/30 bg-warning/10 transition-colors duration-state ease-out-strong hover:bg-warning/15 motion-reduce:transition-none\",\n icon: \"bg-warning/10 text-warning\",\n },\n destructive: {\n container:\n \"border-destructive/30 bg-destructive/5 transition-colors duration-state ease-out-strong hover:bg-destructive/10 motion-reduce:transition-none\",\n icon: \"bg-destructive/10 text-destructive\",\n },\n};\n\nfunction Banner({\n icon: Icon,\n media,\n visual,\n visualClassName,\n title,\n description,\n action,\n actionClassName,\n variant = \"primary\",\n compact = false,\n className,\n ...props\n}: Omit<ComponentProps<\"div\">, \"title\"> & {\n /** Accepts a Lucide icon component or any custom React node. */\n icon?: LucideIcon | ReactNode;\n media?: ReactNode;\n visual?: ReactNode;\n visualClassName?: string;\n /** Any node, e.g. an icon inline with the text (not the HTML title attribute). */\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n actionClassName?: string;\n variant?: BannerVariant;\n compact?: boolean;\n}) {\n const styles = variantClasses[variant];\n // The icon is optional: without one (or a custom media node) the slot is\n // dropped entirely rather than leaving an empty tinted square.\n const IconComponent = typeof Icon === 'function' || (Icon && typeof Icon === 'object' && !isValidElement(Icon)) ? Icon as LucideIcon : undefined;\n const leadingVisual = visual ?? media;\n const hasIconSlot = Boolean(leadingVisual || Icon);\n\n return (\n <div\n data-slot=\"banner\"\n className={cn(\n \"group/banner flex flex-col rounded-control-lg border\",\n compact\n ? \"items-start gap-3 p-3 sm:flex-row sm:items-center sm:gap-2\"\n : \"gap-4 px-4 py-4 sm:flex-row sm:items-stretch sm:gap-3 sm:px-5\",\n styles.container,\n className,\n )}\n {...props}\n >\n <div\n className={cn(\n \"flex min-w-0 flex-1 items-start gap-3 sm:items-stretch sm:gap-3\",\n // Compact: the icon tile and the text centre on each other, so a\n // one-line message sits level with the icon.\n compact && \"items-center gap-2 sm:items-center sm:gap-2\",\n )}\n >\n {hasIconSlot && (\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-control-lg\",\n compact ? \"size-8\" : \"size-10 sm:self-center\",\n styles.icon,\n visualClassName,\n )}\n >\n {leadingVisual ??\n (IconComponent ? (\n <IconComponent\n className={compact ? \"size-4\" : \"size-5\"}\n aria-hidden=\"true\"\n />\n ) : isValidElement(Icon) ? Icon : (Icon as ReactNode))}\n </span>\n )}\n <div\n className={cn(\n \"min-w-0 flex-1\",\n description ? \"space-y-0.5\" : \"flex flex-col justify-center\",\n )}\n >\n <p className={cn(\"text-sm font-medium\", variant === 'banner' ? 'text-secondary-foreground' : 'text-foreground')}>{title}</p>\n {description && (\n <div className={cn(\"text-sm\", variant === 'banner' ? 'text-secondary-foreground' : 'text-muted-foreground')}>{description}</div>\n )}\n </div>\n </div>\n {action && (\n <div\n className={cn(\n \"w-full shrink-0 sm:w-auto sm:self-center\",\n actionClassName,\n )}\n >\n {action}\n </div>\n )}\n </div>\n );\n}\n\nexport { Banner, type BannerVariant };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAMA,MAAM,cAAc,GAGhB;AACF,IAAA,MAAM,EAAE;AACN,QAAA,SAAS,EAAE,gEAAgE;AAC3E,QAAA,IAAI,EAAE,wCAAwC;AAC/C,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EAAE,uDAAuD;AAClE,QAAA,IAAI,EAAE,uCAAuC;AAC9C,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EACL,6IAA6I;AACjJ,QAAA,IAAI,EAAE,2BAA2B;AAClC,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EACL,oIAAoI;AACxI,QAAA,IAAI,EAAE,4BAA4B;AACnC,KAAA;AACD,IAAA,WAAW,EAAE;AACX,QAAA,SAAS,EACL,+IAA+I;AACnJ,QAAA,IAAI,EAAE,oCAAoC;AAC3C,KAAA;CACF;AAED,SAAS,MAAM,CAAC,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EACL,MAAM,EACN,eAAe,EACf,KAAK,EACL,WAAW,EACX,MAAM,EACN,eAAe,EACf,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,KAAK,EACf,SAAS,EACT,GAAG,KAAK,EAcT,EAAA;AACC,IAAA,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;;;AAGtC,IAAA,MAAM,aAAa,GAAG,OAAO,IAAI,KAAK,UAAU,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,IAAkB,GAAG,SAAS;AAChJ,IAAA,MAAM,aAAa,GAAG,MAAM,IAAI,KAAK;IACrC,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa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