@opensite/ui 0.8.7 → 0.8.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.
@@ -33,6 +33,36 @@ var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrim
33
33
  function cn(...inputs) {
34
34
  return tailwindMerge.twMerge(clsx.clsx(inputs));
35
35
  }
36
+ function getNestedCardBg(parentBg, variant = "muted", options) {
37
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
38
+ if (isDark) {
39
+ switch (variant) {
40
+ case "muted":
41
+ return "bg-background";
42
+ case "card":
43
+ return "bg-card";
44
+ case "accent":
45
+ return "bg-accent";
46
+ case "subtle":
47
+ return "bg-background/50";
48
+ }
49
+ } else {
50
+ switch (variant) {
51
+ case "muted":
52
+ return "bg-muted";
53
+ case "card":
54
+ return "bg-card";
55
+ case "accent":
56
+ return "bg-accent";
57
+ case "subtle":
58
+ return "bg-muted/50";
59
+ }
60
+ }
61
+ }
62
+ function getNestedCardTextColor(parentBg, options) {
63
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
64
+ return isDark ? "text-foreground" : "";
65
+ }
36
66
  var svgCache = /* @__PURE__ */ new Map();
37
67
  function DynamicIcon({
38
68
  name,
@@ -1068,7 +1098,9 @@ function FaqSplitHelp({
1068
1098
  "div",
1069
1099
  {
1070
1100
  className: cn(
1071
- "mt-8 md:mt-16 flex flex-col items-center gap-4 rounded-lg bg-muted p-6 text-center md:flex-row md:justify-between md:text-left lg:p-8",
1101
+ "mt-8 md:mt-16 flex flex-col items-center gap-4 rounded-lg p-6 text-center md:flex-row md:justify-between md:text-left lg:p-8",
1102
+ getNestedCardBg(background),
1103
+ getNestedCardTextColor(background),
1072
1104
  helpSectionClassName
1073
1105
  ),
1074
1106
  children: [
@@ -1100,7 +1132,8 @@ function FaqSplitHelp({
1100
1132
  helpHeading,
1101
1133
  helpDescription,
1102
1134
  helpAction,
1103
- helpSectionClassName
1135
+ helpSectionClassName,
1136
+ background
1104
1137
  ]);
1105
1138
  return /* @__PURE__ */ jsxRuntime.jsx(
1106
1139
  Section,
@@ -11,6 +11,36 @@ import { cva } from 'class-variance-authority';
11
11
  function cn(...inputs) {
12
12
  return twMerge(clsx(inputs));
13
13
  }
14
+ function getNestedCardBg(parentBg, variant = "muted", options) {
15
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
16
+ if (isDark) {
17
+ switch (variant) {
18
+ case "muted":
19
+ return "bg-background";
20
+ case "card":
21
+ return "bg-card";
22
+ case "accent":
23
+ return "bg-accent";
24
+ case "subtle":
25
+ return "bg-background/50";
26
+ }
27
+ } else {
28
+ switch (variant) {
29
+ case "muted":
30
+ return "bg-muted";
31
+ case "card":
32
+ return "bg-card";
33
+ case "accent":
34
+ return "bg-accent";
35
+ case "subtle":
36
+ return "bg-muted/50";
37
+ }
38
+ }
39
+ }
40
+ function getNestedCardTextColor(parentBg, options) {
41
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
42
+ return isDark ? "text-foreground" : "";
43
+ }
14
44
  var svgCache = /* @__PURE__ */ new Map();
15
45
  function DynamicIcon({
16
46
  name,
@@ -1046,7 +1076,9 @@ function FaqSplitHelp({
1046
1076
  "div",
1047
1077
  {
1048
1078
  className: cn(
1049
- "mt-8 md:mt-16 flex flex-col items-center gap-4 rounded-lg bg-muted p-6 text-center md:flex-row md:justify-between md:text-left lg:p-8",
1079
+ "mt-8 md:mt-16 flex flex-col items-center gap-4 rounded-lg p-6 text-center md:flex-row md:justify-between md:text-left lg:p-8",
1080
+ getNestedCardBg(background),
1081
+ getNestedCardTextColor(background),
1050
1082
  helpSectionClassName
1051
1083
  ),
1052
1084
  children: [
@@ -1078,7 +1110,8 @@ function FaqSplitHelp({
1078
1110
  helpHeading,
1079
1111
  helpDescription,
1080
1112
  helpAction,
1081
- helpSectionClassName
1113
+ helpSectionClassName,
1114
+ background
1082
1115
  ]);
1083
1116
  return /* @__PURE__ */ jsx(
1084
1117
  Section,
package/dist/index.cjs CHANGED
@@ -43,6 +43,41 @@ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
43
43
  function cn(...inputs) {
44
44
  return tailwindMerge.twMerge(clsx.clsx(inputs));
45
45
  }
46
+ function getNestedCardBg(parentBg, variant = "muted", options) {
47
+ if (options?.override) return options.override;
48
+ if (options?.disableInversion) {
49
+ return `bg-${variant}`;
50
+ }
51
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
52
+ if (isDark) {
53
+ switch (variant) {
54
+ case "muted":
55
+ return "bg-background";
56
+ case "card":
57
+ return "bg-card";
58
+ case "accent":
59
+ return "bg-accent";
60
+ case "subtle":
61
+ return "bg-background/50";
62
+ }
63
+ } else {
64
+ switch (variant) {
65
+ case "muted":
66
+ return "bg-muted";
67
+ case "card":
68
+ return "bg-card";
69
+ case "accent":
70
+ return "bg-accent";
71
+ case "subtle":
72
+ return "bg-muted/50";
73
+ }
74
+ }
75
+ }
76
+ function getNestedCardTextColor(parentBg, options) {
77
+ if (options?.override) return options.override;
78
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
79
+ return isDark ? "text-foreground" : "";
80
+ }
46
81
  var maxWidthStyles = {
47
82
  sm: "max-w-screen-sm",
48
83
  md: "max-w-screen-md",
@@ -4585,4 +4620,6 @@ exports.PopoverTrigger = PopoverTrigger;
4585
4620
  exports.Pressable = Pressable;
4586
4621
  exports.Section = Section;
4587
4622
  exports.cn = cn;
4623
+ exports.getNestedCardBg = getNestedCardBg;
4624
+ exports.getNestedCardTextColor = getNestedCardTextColor;
4588
4625
  exports.useNavigation = useNavigation;
package/dist/index.d.cts CHANGED
@@ -27,7 +27,7 @@ export { FooterNewsletterMinimal } from './footer-newsletter-minimal.cjs';
27
27
  export { FooterCtaSocial } from './footer-cta-social.cjs';
28
28
  export { FooterNavSocial } from './footer-nav-social.cjs';
29
29
  export { LinkType, UseNavigationArgs, UseNavigationReturn, useNavigation } from './use-navigation.cjs';
30
- export { cn } from './utils.cjs';
30
+ export { NestedCardBgOptions, NestedCardVariant, cn, getNestedCardBg, getNestedCardTextColor } from './utils.cjs';
31
31
  export { A as ActionConfig, h as AuthorInfo, c as BlockActionProps, B as BlockBaseProps, f as BlockBlogProps, b as BlockContentProps, d as BlockLogoProps, e as BlogPostItem, g as BreadcrumbItem, D as DetailItem, F as FeatureItem, I as ImageItem, L as LogoItem, N as NavLinkItem, O as OptixFlowConfig, j as OutcomeItem, i as SectionItem, a as SocialLinkItem, S as StatItem, T as TestimonialItem } from './blocks-Cohq4eio.cjs';
32
32
  import 'react';
33
33
  import 'react/jsx-runtime';
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ export { FooterNewsletterMinimal } from './footer-newsletter-minimal.js';
27
27
  export { FooterCtaSocial } from './footer-cta-social.js';
28
28
  export { FooterNavSocial } from './footer-nav-social.js';
29
29
  export { LinkType, UseNavigationArgs, UseNavigationReturn, useNavigation } from './use-navigation.js';
30
- export { cn } from './utils.js';
30
+ export { NestedCardBgOptions, NestedCardVariant, cn, getNestedCardBg, getNestedCardTextColor } from './utils.js';
31
31
  export { A as ActionConfig, h as AuthorInfo, c as BlockActionProps, B as BlockBaseProps, f as BlockBlogProps, b as BlockContentProps, d as BlockLogoProps, e as BlogPostItem, g as BreadcrumbItem, D as DetailItem, F as FeatureItem, I as ImageItem, L as LogoItem, N as NavLinkItem, O as OptixFlowConfig, j as OutcomeItem, i as SectionItem, a as SocialLinkItem, S as StatItem, T as TestimonialItem } from './blocks-k17uluAz.js';
32
32
  import 'react';
33
33
  import 'react/jsx-runtime';
package/dist/index.js CHANGED
@@ -20,6 +20,41 @@ import { serializeForRails, deserializeErrors } from '@page-speed/forms/integrat
20
20
  function cn(...inputs) {
21
21
  return twMerge(clsx(inputs));
22
22
  }
23
+ function getNestedCardBg(parentBg, variant = "muted", options) {
24
+ if (options?.override) return options.override;
25
+ if (options?.disableInversion) {
26
+ return `bg-${variant}`;
27
+ }
28
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
29
+ if (isDark) {
30
+ switch (variant) {
31
+ case "muted":
32
+ return "bg-background";
33
+ case "card":
34
+ return "bg-card";
35
+ case "accent":
36
+ return "bg-accent";
37
+ case "subtle":
38
+ return "bg-background/50";
39
+ }
40
+ } else {
41
+ switch (variant) {
42
+ case "muted":
43
+ return "bg-muted";
44
+ case "card":
45
+ return "bg-card";
46
+ case "accent":
47
+ return "bg-accent";
48
+ case "subtle":
49
+ return "bg-muted/50";
50
+ }
51
+ }
52
+ }
53
+ function getNestedCardTextColor(parentBg, options) {
54
+ if (options?.override) return options.override;
55
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
56
+ return isDark ? "text-foreground" : "";
57
+ }
23
58
  var maxWidthStyles = {
24
59
  sm: "max-w-screen-sm",
25
60
  md: "max-w-screen-md",
@@ -4522,4 +4557,4 @@ function FooterNavSocial({
4522
4557
  );
4523
4558
  }
4524
4559
 
4525
- export { AboutCultureTabs, AboutExpandableValues, AboutMissionPrinciples, AboutSplitHero, AlternatingBlocks, AnimatedDialog, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CarouselPagination, CommunityInitiatives, Container, DynamicIcon, FooterAnimatedSocial, FooterBackgroundCard, FooterBrandDescription, FooterContactCard, FooterCtaBanner, FooterCtaSocial, FooterLinksGrid, FooterNavSocial, FooterNewsletterGrid, FooterNewsletterMinimal, FooterSimpleCentered, FooterSocialApps, FooterSocialNewsletter, ImageSlider, MediaHoverCtas, PageHeroBanner, Popover, PopoverContent, PopoverTrigger, Pressable, Section, cn, useNavigation };
4560
+ export { AboutCultureTabs, AboutExpandableValues, AboutMissionPrinciples, AboutSplitHero, AlternatingBlocks, AnimatedDialog, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CarouselPagination, CommunityInitiatives, Container, DynamicIcon, FooterAnimatedSocial, FooterBackgroundCard, FooterBrandDescription, FooterContactCard, FooterCtaBanner, FooterCtaSocial, FooterLinksGrid, FooterNavSocial, FooterNewsletterGrid, FooterNewsletterMinimal, FooterSimpleCentered, FooterSocialApps, FooterSocialNewsletter, ImageSlider, MediaHoverCtas, PageHeroBanner, Popover, PopoverContent, PopoverTrigger, Pressable, Section, cn, getNestedCardBg, getNestedCardTextColor, useNavigation };
package/dist/registry.cjs CHANGED
@@ -88,6 +88,36 @@ var BRIGHTNESS_CLASS_MAP = {
88
88
  "75": "brightness-75",
89
89
  "100": "brightness-100"
90
90
  };
91
+ function getNestedCardBg(parentBg, variant = "muted", options) {
92
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
93
+ if (isDark) {
94
+ switch (variant) {
95
+ case "muted":
96
+ return "bg-background";
97
+ case "card":
98
+ return "bg-card";
99
+ case "accent":
100
+ return "bg-accent";
101
+ case "subtle":
102
+ return "bg-background/50";
103
+ }
104
+ } else {
105
+ switch (variant) {
106
+ case "muted":
107
+ return "bg-muted";
108
+ case "card":
109
+ return "bg-card";
110
+ case "accent":
111
+ return "bg-accent";
112
+ case "subtle":
113
+ return "bg-muted/50";
114
+ }
115
+ }
116
+ }
117
+ function getNestedCardTextColor(parentBg, options) {
118
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
119
+ return isDark ? "text-foreground" : "";
120
+ }
91
121
  var maxWidthStyles = {
92
122
  sm: "max-w-screen-sm",
93
123
  md: "max-w-screen-md",
@@ -38437,7 +38467,9 @@ function FaqSplitHelp({
38437
38467
  "div",
38438
38468
  {
38439
38469
  className: cn(
38440
- "mt-8 md:mt-16 flex flex-col items-center gap-4 rounded-lg bg-muted p-6 text-center md:flex-row md:justify-between md:text-left lg:p-8",
38470
+ "mt-8 md:mt-16 flex flex-col items-center gap-4 rounded-lg p-6 text-center md:flex-row md:justify-between md:text-left lg:p-8",
38471
+ getNestedCardBg(background),
38472
+ getNestedCardTextColor(background),
38441
38473
  helpSectionClassName
38442
38474
  ),
38443
38475
  children: [
@@ -38469,7 +38501,8 @@ function FaqSplitHelp({
38469
38501
  helpHeading,
38470
38502
  helpDescription,
38471
38503
  helpAction,
38472
- helpSectionClassName
38504
+ helpSectionClassName,
38505
+ background
38473
38506
  ]);
38474
38507
  return /* @__PURE__ */ jsxRuntime.jsx(
38475
38508
  Section,
package/dist/registry.js CHANGED
@@ -48,6 +48,36 @@ var BRIGHTNESS_CLASS_MAP = {
48
48
  "75": "brightness-75",
49
49
  "100": "brightness-100"
50
50
  };
51
+ function getNestedCardBg(parentBg, variant = "muted", options) {
52
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
53
+ if (isDark) {
54
+ switch (variant) {
55
+ case "muted":
56
+ return "bg-background";
57
+ case "card":
58
+ return "bg-card";
59
+ case "accent":
60
+ return "bg-accent";
61
+ case "subtle":
62
+ return "bg-background/50";
63
+ }
64
+ } else {
65
+ switch (variant) {
66
+ case "muted":
67
+ return "bg-muted";
68
+ case "card":
69
+ return "bg-card";
70
+ case "accent":
71
+ return "bg-accent";
72
+ case "subtle":
73
+ return "bg-muted/50";
74
+ }
75
+ }
76
+ }
77
+ function getNestedCardTextColor(parentBg, options) {
78
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
79
+ return isDark ? "text-foreground" : "";
80
+ }
51
81
  var maxWidthStyles = {
52
82
  sm: "max-w-screen-sm",
53
83
  md: "max-w-screen-md",
@@ -38397,7 +38427,9 @@ function FaqSplitHelp({
38397
38427
  "div",
38398
38428
  {
38399
38429
  className: cn(
38400
- "mt-8 md:mt-16 flex flex-col items-center gap-4 rounded-lg bg-muted p-6 text-center md:flex-row md:justify-between md:text-left lg:p-8",
38430
+ "mt-8 md:mt-16 flex flex-col items-center gap-4 rounded-lg p-6 text-center md:flex-row md:justify-between md:text-left lg:p-8",
38431
+ getNestedCardBg(background),
38432
+ getNestedCardTextColor(background),
38401
38433
  helpSectionClassName
38402
38434
  ),
38403
38435
  children: [
@@ -38429,7 +38461,8 @@ function FaqSplitHelp({
38429
38461
  helpHeading,
38430
38462
  helpDescription,
38431
38463
  helpAction,
38432
- helpSectionClassName
38464
+ helpSectionClassName,
38465
+ background
38433
38466
  ]);
38434
38467
  return /* @__PURE__ */ jsx(
38435
38468
  Section,
package/dist/utils.cjs CHANGED
@@ -17,6 +17,43 @@ var BRIGHTNESS_CLASS_MAP = {
17
17
  "75": "brightness-75",
18
18
  "100": "brightness-100"
19
19
  };
20
+ function getNestedCardBg(parentBg, variant = "muted", options) {
21
+ if (options?.override) return options.override;
22
+ if (options?.disableInversion) {
23
+ return `bg-${variant}`;
24
+ }
25
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
26
+ if (isDark) {
27
+ switch (variant) {
28
+ case "muted":
29
+ return "bg-background";
30
+ case "card":
31
+ return "bg-card";
32
+ case "accent":
33
+ return "bg-accent";
34
+ case "subtle":
35
+ return "bg-background/50";
36
+ }
37
+ } else {
38
+ switch (variant) {
39
+ case "muted":
40
+ return "bg-muted";
41
+ case "card":
42
+ return "bg-card";
43
+ case "accent":
44
+ return "bg-accent";
45
+ case "subtle":
46
+ return "bg-muted/50";
47
+ }
48
+ }
49
+ }
50
+ function getNestedCardTextColor(parentBg, options) {
51
+ if (options?.override) return options.override;
52
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
53
+ return isDark ? "text-foreground" : "";
54
+ }
20
55
 
21
56
  exports.BRIGHTNESS_CLASS_MAP = BRIGHTNESS_CLASS_MAP;
22
57
  exports.cn = cn;
58
+ exports.getNestedCardBg = getNestedCardBg;
59
+ exports.getNestedCardTextColor = getNestedCardTextColor;
package/dist/utils.d.cts CHANGED
@@ -1,4 +1,12 @@
1
1
  import { ClassValue } from 'clsx';
2
+ import { f as SectionBackground } from './community-initiatives-Sm_ZSgyv.cjs';
3
+ import 'react';
4
+ import './pattern-background-a7gKHzHy.cjs';
5
+ import 'react/jsx-runtime';
6
+ import './blocks-Cohq4eio.cjs';
7
+ import 'class-variance-authority';
8
+ import './button-variants-lRElsmTc.cjs';
9
+ import 'class-variance-authority/types';
2
10
 
3
11
  declare function cn(...inputs: ClassValue[]): string;
4
12
  /**
@@ -6,5 +14,103 @@ declare function cn(...inputs: ClassValue[]): string;
6
14
  * Values 10-40 use arbitrary values for finer control on bright images
7
15
  */
8
16
  declare const BRIGHTNESS_CLASS_MAP: Record<string, string>;
17
+ /**
18
+ * Variant types for nested card backgrounds
19
+ */
20
+ type NestedCardVariant = "muted" | "card" | "accent" | "subtle";
21
+ /**
22
+ * Options for customizing nested card background behavior
23
+ */
24
+ interface NestedCardBgOptions {
25
+ /**
26
+ * Manual override - bypasses all automatic logic and uses this class directly.
27
+ * Use this for client-specific customizations or edge cases.
28
+ *
29
+ * @example
30
+ * // Client wants white cards regardless of parent background
31
+ * getNestedCardBg(background, 'muted', { override: 'bg-white' })
32
+ */
33
+ override?: string;
34
+ /**
35
+ * Disable smart inversion logic - always use the variant as-is.
36
+ * Use this when you want consistent backgrounds regardless of parent.
37
+ *
38
+ * @example
39
+ * // Always use bg-muted, even on dark backgrounds
40
+ * getNestedCardBg(background, 'muted', { disableInversion: true })
41
+ */
42
+ disableInversion?: boolean;
43
+ }
44
+ /**
45
+ * Get the appropriate background class for nested cards/callouts based on parent Section background.
46
+ *
47
+ * This utility implements **context-aware background inversion** to ensure nested elements
48
+ * maintain proper contrast and visibility across all Section background variants.
49
+ *
50
+ * **How it works:**
51
+ * - On **dark backgrounds** (dark, secondary, primary): Uses lighter backgrounds for contrast
52
+ * - On **light backgrounds** (default, white, gray, muted): Uses darker backgrounds for elevation
53
+ *
54
+ * **Variants:**
55
+ * - `muted`: Standard card background with subtle contrast
56
+ * - `card`: Semantic card background (similar to muted)
57
+ * - `accent`: Accent-colored background for emphasis
58
+ * - `subtle`: Semi-transparent background for layering
59
+ *
60
+ * @param parentBg - The parent Section's background variant
61
+ * @param variant - The type of nested card background to use (default: 'muted')
62
+ * @param options - Optional configuration for overrides or disabling inversion
63
+ * @returns Tailwind background class string
64
+ *
65
+ * @example
66
+ * // Standard usage - auto-inverts based on parent
67
+ * <div className={cn(getNestedCardBg(background), "p-6 rounded-lg")}>
68
+ *
69
+ * @example
70
+ * // Accent variant
71
+ * <div className={cn(getNestedCardBg(background, 'accent'), "p-6 rounded-lg")}>
72
+ *
73
+ * @example
74
+ * // Client override - always white
75
+ * <div className={cn(getNestedCardBg(background, 'muted', { override: 'bg-white' }), "p-6")}>
76
+ *
77
+ * @example
78
+ * // Disable inversion - always use bg-muted
79
+ * <div className={cn(getNestedCardBg(background, 'muted', { disableInversion: true }), "p-6")}>
80
+ */
81
+ declare function getNestedCardBg(parentBg?: SectionBackground, variant?: NestedCardVariant, options?: NestedCardBgOptions): string;
82
+ /**
83
+ * Get the appropriate text color class for nested cards/callouts based on parent Section background.
84
+ *
85
+ * This companion function to `getNestedCardBg` ensures text remains visible when using
86
+ * inverted backgrounds on dark parent Sections.
87
+ *
88
+ * **How it works:**
89
+ * - On **dark backgrounds**: Returns 'text-foreground' to ensure text is visible on the lighter card
90
+ * - On **light backgrounds**: Returns empty string (text inherits from parent)
91
+ *
92
+ * @param parentBg - The parent Section's background variant
93
+ * @param options - Optional configuration for manual override
94
+ * @returns Tailwind text color class string (or empty string)
95
+ *
96
+ * @example
97
+ * // Standard usage with background helper
98
+ * <div className={cn(
99
+ * getNestedCardBg(background),
100
+ * getNestedCardTextColor(background),
101
+ * "p-6 rounded-lg"
102
+ * )}>
103
+ *
104
+ * @example
105
+ * // Custom text color override
106
+ * <div className={cn(
107
+ * getNestedCardBg(background),
108
+ * getNestedCardTextColor(background, { override: 'text-blue-900' }),
109
+ * "p-6"
110
+ * )}>
111
+ */
112
+ declare function getNestedCardTextColor(parentBg?: SectionBackground, options?: {
113
+ override?: string;
114
+ }): string;
9
115
 
10
- export { BRIGHTNESS_CLASS_MAP, cn };
116
+ export { BRIGHTNESS_CLASS_MAP, type NestedCardBgOptions, type NestedCardVariant, cn, getNestedCardBg, getNestedCardTextColor };
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  import { ClassValue } from 'clsx';
2
+ import { f as SectionBackground } from './community-initiatives-BeWIIjA4.js';
3
+ import 'react';
4
+ import './pattern-background-a7gKHzHy.js';
5
+ import 'react/jsx-runtime';
6
+ import './blocks-k17uluAz.js';
7
+ import 'class-variance-authority';
8
+ import './button-variants-lRElsmTc.js';
9
+ import 'class-variance-authority/types';
2
10
 
3
11
  declare function cn(...inputs: ClassValue[]): string;
4
12
  /**
@@ -6,5 +14,103 @@ declare function cn(...inputs: ClassValue[]): string;
6
14
  * Values 10-40 use arbitrary values for finer control on bright images
7
15
  */
8
16
  declare const BRIGHTNESS_CLASS_MAP: Record<string, string>;
17
+ /**
18
+ * Variant types for nested card backgrounds
19
+ */
20
+ type NestedCardVariant = "muted" | "card" | "accent" | "subtle";
21
+ /**
22
+ * Options for customizing nested card background behavior
23
+ */
24
+ interface NestedCardBgOptions {
25
+ /**
26
+ * Manual override - bypasses all automatic logic and uses this class directly.
27
+ * Use this for client-specific customizations or edge cases.
28
+ *
29
+ * @example
30
+ * // Client wants white cards regardless of parent background
31
+ * getNestedCardBg(background, 'muted', { override: 'bg-white' })
32
+ */
33
+ override?: string;
34
+ /**
35
+ * Disable smart inversion logic - always use the variant as-is.
36
+ * Use this when you want consistent backgrounds regardless of parent.
37
+ *
38
+ * @example
39
+ * // Always use bg-muted, even on dark backgrounds
40
+ * getNestedCardBg(background, 'muted', { disableInversion: true })
41
+ */
42
+ disableInversion?: boolean;
43
+ }
44
+ /**
45
+ * Get the appropriate background class for nested cards/callouts based on parent Section background.
46
+ *
47
+ * This utility implements **context-aware background inversion** to ensure nested elements
48
+ * maintain proper contrast and visibility across all Section background variants.
49
+ *
50
+ * **How it works:**
51
+ * - On **dark backgrounds** (dark, secondary, primary): Uses lighter backgrounds for contrast
52
+ * - On **light backgrounds** (default, white, gray, muted): Uses darker backgrounds for elevation
53
+ *
54
+ * **Variants:**
55
+ * - `muted`: Standard card background with subtle contrast
56
+ * - `card`: Semantic card background (similar to muted)
57
+ * - `accent`: Accent-colored background for emphasis
58
+ * - `subtle`: Semi-transparent background for layering
59
+ *
60
+ * @param parentBg - The parent Section's background variant
61
+ * @param variant - The type of nested card background to use (default: 'muted')
62
+ * @param options - Optional configuration for overrides or disabling inversion
63
+ * @returns Tailwind background class string
64
+ *
65
+ * @example
66
+ * // Standard usage - auto-inverts based on parent
67
+ * <div className={cn(getNestedCardBg(background), "p-6 rounded-lg")}>
68
+ *
69
+ * @example
70
+ * // Accent variant
71
+ * <div className={cn(getNestedCardBg(background, 'accent'), "p-6 rounded-lg")}>
72
+ *
73
+ * @example
74
+ * // Client override - always white
75
+ * <div className={cn(getNestedCardBg(background, 'muted', { override: 'bg-white' }), "p-6")}>
76
+ *
77
+ * @example
78
+ * // Disable inversion - always use bg-muted
79
+ * <div className={cn(getNestedCardBg(background, 'muted', { disableInversion: true }), "p-6")}>
80
+ */
81
+ declare function getNestedCardBg(parentBg?: SectionBackground, variant?: NestedCardVariant, options?: NestedCardBgOptions): string;
82
+ /**
83
+ * Get the appropriate text color class for nested cards/callouts based on parent Section background.
84
+ *
85
+ * This companion function to `getNestedCardBg` ensures text remains visible when using
86
+ * inverted backgrounds on dark parent Sections.
87
+ *
88
+ * **How it works:**
89
+ * - On **dark backgrounds**: Returns 'text-foreground' to ensure text is visible on the lighter card
90
+ * - On **light backgrounds**: Returns empty string (text inherits from parent)
91
+ *
92
+ * @param parentBg - The parent Section's background variant
93
+ * @param options - Optional configuration for manual override
94
+ * @returns Tailwind text color class string (or empty string)
95
+ *
96
+ * @example
97
+ * // Standard usage with background helper
98
+ * <div className={cn(
99
+ * getNestedCardBg(background),
100
+ * getNestedCardTextColor(background),
101
+ * "p-6 rounded-lg"
102
+ * )}>
103
+ *
104
+ * @example
105
+ * // Custom text color override
106
+ * <div className={cn(
107
+ * getNestedCardBg(background),
108
+ * getNestedCardTextColor(background, { override: 'text-blue-900' }),
109
+ * "p-6"
110
+ * )}>
111
+ */
112
+ declare function getNestedCardTextColor(parentBg?: SectionBackground, options?: {
113
+ override?: string;
114
+ }): string;
9
115
 
10
- export { BRIGHTNESS_CLASS_MAP, cn };
116
+ export { BRIGHTNESS_CLASS_MAP, type NestedCardBgOptions, type NestedCardVariant, cn, getNestedCardBg, getNestedCardTextColor };
package/dist/utils.js CHANGED
@@ -15,5 +15,40 @@ var BRIGHTNESS_CLASS_MAP = {
15
15
  "75": "brightness-75",
16
16
  "100": "brightness-100"
17
17
  };
18
+ function getNestedCardBg(parentBg, variant = "muted", options) {
19
+ if (options?.override) return options.override;
20
+ if (options?.disableInversion) {
21
+ return `bg-${variant}`;
22
+ }
23
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
24
+ if (isDark) {
25
+ switch (variant) {
26
+ case "muted":
27
+ return "bg-background";
28
+ case "card":
29
+ return "bg-card";
30
+ case "accent":
31
+ return "bg-accent";
32
+ case "subtle":
33
+ return "bg-background/50";
34
+ }
35
+ } else {
36
+ switch (variant) {
37
+ case "muted":
38
+ return "bg-muted";
39
+ case "card":
40
+ return "bg-card";
41
+ case "accent":
42
+ return "bg-accent";
43
+ case "subtle":
44
+ return "bg-muted/50";
45
+ }
46
+ }
47
+ }
48
+ function getNestedCardTextColor(parentBg, options) {
49
+ if (options?.override) return options.override;
50
+ const isDark = parentBg === "dark" || parentBg === "secondary" || parentBg === "primary";
51
+ return isDark ? "text-foreground" : "";
52
+ }
18
53
 
19
- export { BRIGHTNESS_CLASS_MAP, cn };
54
+ export { BRIGHTNESS_CLASS_MAP, cn, getNestedCardBg, getNestedCardTextColor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensite/ui",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "Foundational UI component library for OpenSite Semantic Site Builder with tree-shakable exports and abstract styling",
5
5
  "keywords": [
6
6
  "react",