@opensite/ui 0.0.7 → 0.0.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.
- package/README.md +46 -0
- package/dist/components.cjs +430 -26
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +3 -1
- package/dist/components.d.ts +3 -1
- package/dist/components.js +425 -23
- package/dist/components.js.map +1 -1
- package/dist/dynamic-icon.cjs +90 -19
- package/dist/dynamic-icon.cjs.map +1 -1
- package/dist/dynamic-icon.d.cts +12 -6
- package/dist/dynamic-icon.d.ts +12 -6
- package/dist/dynamic-icon.js +90 -19
- package/dist/dynamic-icon.js.map +1 -1
- package/dist/feature-showcase.cjs +123 -66
- package/dist/feature-showcase.cjs.map +1 -1
- package/dist/feature-showcase.js +119 -62
- package/dist/feature-showcase.js.map +1 -1
- package/dist/hooks.cjs +207 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +2 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.js +185 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.cjs +432 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +426 -23
- package/dist/index.js.map +1 -1
- package/dist/media-hover-ctas.cjs +75 -0
- package/dist/media-hover-ctas.cjs.map +1 -0
- package/dist/media-hover-ctas.d.cts +83 -0
- package/dist/media-hover-ctas.d.ts +83 -0
- package/dist/media-hover-ctas.js +73 -0
- package/dist/media-hover-ctas.js.map +1 -0
- package/dist/pressable.cjs +333 -0
- package/dist/pressable.cjs.map +1 -0
- package/dist/pressable.d.cts +133 -0
- package/dist/pressable.d.ts +133 -0
- package/dist/pressable.js +311 -0
- package/dist/pressable.js.map +1 -0
- package/dist/registry.cjs +240 -66
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +237 -63
- package/dist/registry.js.map +1 -1
- package/dist/types.d.cts +58 -1
- package/dist/types.d.ts +58 -1
- package/dist/use-navigation.cjs +206 -0
- package/dist/use-navigation.cjs.map +1 -0
- package/dist/use-navigation.d.cts +49 -0
- package/dist/use-navigation.d.ts +49 -0
- package/dist/use-navigation.js +184 -0
- package/dist/use-navigation.js.map +1 -0
- package/package.json +22 -1
package/README.md
CHANGED
|
@@ -256,6 +256,52 @@ import { AlternatingBlocks } from "@opensite/ui/blocks/about/alternating-blocks"
|
|
|
256
256
|
|
|
257
257
|
**Note:** Blocks are now organized by category. Import path includes category: `@opensite/ui/blocks/[category]/[block-name]`
|
|
258
258
|
|
|
259
|
+
#### MediaHoverCtas
|
|
260
|
+
|
|
261
|
+
Two-column CTA grid that reveals background imagery or color on hover. Located in the `cta` category.
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
import { MediaHoverCtas } from "@opensite/ui/blocks/cta/media-hover-ctas";
|
|
265
|
+
|
|
266
|
+
<MediaHoverCtas
|
|
267
|
+
items={[
|
|
268
|
+
{
|
|
269
|
+
content: (
|
|
270
|
+
<div>
|
|
271
|
+
<h3 className="mb-3 text-xl font-semibold">Our Mission</h3>
|
|
272
|
+
<p className="text-muted-foreground">Deliver remarkable experiences.</p>
|
|
273
|
+
</div>
|
|
274
|
+
),
|
|
275
|
+
onHoverImgSrc: "/images/mission.jpg",
|
|
276
|
+
altText: "Our Mission"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
content: (
|
|
280
|
+
<div>
|
|
281
|
+
<h3 className="mb-3 text-xl font-semibold">Our Vision</h3>
|
|
282
|
+
<p className="text-muted-foreground">Build the future of our industry.</p>
|
|
283
|
+
</div>
|
|
284
|
+
),
|
|
285
|
+
initialBackgroundColor: "var(--brand-100)",
|
|
286
|
+
onHoverBackgroundColor: "var(--brand-900)"
|
|
287
|
+
}
|
|
288
|
+
]}
|
|
289
|
+
/>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Props:**
|
|
293
|
+
- `items?: MediaHoverCtaItem[]` - Array of CTA items (default: [])
|
|
294
|
+
- `content?: ReactNode` - Content to render inside the card
|
|
295
|
+
- `onHoverImgSrc?: string` - Image URL to reveal on hover
|
|
296
|
+
- `imgHoverClassName?: string` - Additional classes for hover image
|
|
297
|
+
- `altText?: string` - Alt text for hover image (leave empty for decorative)
|
|
298
|
+
- `cardHref?: string` - Optional href to make the card a link
|
|
299
|
+
- `initialBackgroundColor?: string` - CSS color value or variable for base background
|
|
300
|
+
- `onHoverBackgroundColor?: string` - CSS color value or variable for hover background (ignored when hover image is used)
|
|
301
|
+
- `sectionClassName?: string` - Additional classes for section wrapper
|
|
302
|
+
- `gridClassName?: string` - Additional classes for grid container
|
|
303
|
+
- `optixFlowConfig?: { apiKey: string; compression?: number }` - Optional Optix Flow config for `@page-speed/img`
|
|
304
|
+
|
|
259
305
|
### Block Registry
|
|
260
306
|
|
|
261
307
|
Semantic registry for AI-driven component selection. Maps semantic concepts to available UI blocks.
|
package/dist/components.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React4 = require('react');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
5
|
var tailwindMerge = require('tailwind-merge');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -9,6 +9,7 @@ var hooks = require('@opensite/hooks');
|
|
|
9
9
|
var reactSlot = require('@radix-ui/react-slot');
|
|
10
10
|
var classVarianceAuthority = require('class-variance-authority');
|
|
11
11
|
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
12
|
+
var img = require('@page-speed/img');
|
|
12
13
|
|
|
13
14
|
function _interopNamespace(e) {
|
|
14
15
|
if (e && e.__esModule) return e;
|
|
@@ -28,7 +29,7 @@ function _interopNamespace(e) {
|
|
|
28
29
|
return Object.freeze(n);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
var
|
|
32
|
+
var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
|
|
32
33
|
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
33
34
|
|
|
34
35
|
// components/ui/container.tsx
|
|
@@ -44,7 +45,7 @@ var maxWidthStyles = {
|
|
|
44
45
|
"4xl": "max-w-[1536px]",
|
|
45
46
|
full: "max-w-full"
|
|
46
47
|
};
|
|
47
|
-
var Container =
|
|
48
|
+
var Container = React4__namespace.default.forwardRef(
|
|
48
49
|
({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
|
|
49
50
|
const Component = as;
|
|
50
51
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -78,7 +79,7 @@ var spacingStyles = {
|
|
|
78
79
|
lg: "py-20 md:py-32",
|
|
79
80
|
xl: "py-24 md:py-40"
|
|
80
81
|
};
|
|
81
|
-
var Section =
|
|
82
|
+
var Section = React4__namespace.default.forwardRef(
|
|
82
83
|
({
|
|
83
84
|
id,
|
|
84
85
|
title,
|
|
@@ -138,15 +139,15 @@ function AnimatedDialog({
|
|
|
138
139
|
className,
|
|
139
140
|
contentClassName
|
|
140
141
|
}) {
|
|
141
|
-
const titleId =
|
|
142
|
-
const descriptionId =
|
|
143
|
-
const containerRef =
|
|
142
|
+
const titleId = React4.useId();
|
|
143
|
+
const descriptionId = React4.useId();
|
|
144
|
+
const containerRef = React4.useRef(null);
|
|
144
145
|
hooks.useOnClickOutside(containerRef, () => {
|
|
145
146
|
if (open) {
|
|
146
147
|
onOpenChange(false);
|
|
147
148
|
}
|
|
148
149
|
});
|
|
149
|
-
|
|
150
|
+
React4.useEffect(() => {
|
|
150
151
|
if (!open) {
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
@@ -519,6 +520,7 @@ function PopoverContent({
|
|
|
519
520
|
}
|
|
520
521
|
) });
|
|
521
522
|
}
|
|
523
|
+
var svgCache = /* @__PURE__ */ new Map();
|
|
522
524
|
function DynamicIcon({
|
|
523
525
|
name,
|
|
524
526
|
size = 28,
|
|
@@ -526,32 +528,372 @@ function DynamicIcon({
|
|
|
526
528
|
className,
|
|
527
529
|
alt
|
|
528
530
|
}) {
|
|
529
|
-
const
|
|
531
|
+
const [svgContent, setSvgContent] = React4__namespace.useState(null);
|
|
532
|
+
const [isLoading, setIsLoading] = React4__namespace.useState(true);
|
|
533
|
+
const [error, setError] = React4__namespace.useState(null);
|
|
534
|
+
const { url, iconName } = React4__namespace.useMemo(() => {
|
|
530
535
|
const separator = name.includes("/") ? "/" : ":";
|
|
531
|
-
const [prefix,
|
|
532
|
-
const
|
|
533
|
-
const baseUrl = `https://icons.opensite.ai/api/icon/${prefix}/${iconName}?format=svg&width=${size}&height=${size}&`;
|
|
536
|
+
const [prefix, iconName2] = name.split(separator);
|
|
537
|
+
const baseUrl = `https://icons.opensite.ai/api/icon/${prefix}/${iconName2}?format=svg&width=${size}&height=${size}`;
|
|
534
538
|
return {
|
|
535
|
-
url:
|
|
536
|
-
iconName
|
|
539
|
+
url: baseUrl,
|
|
540
|
+
iconName: iconName2
|
|
537
541
|
};
|
|
538
|
-
}, [name, size
|
|
542
|
+
}, [name, size]);
|
|
543
|
+
React4__namespace.useEffect(() => {
|
|
544
|
+
let isMounted = true;
|
|
545
|
+
const fetchSvg = async () => {
|
|
546
|
+
const cached = svgCache.get(url);
|
|
547
|
+
if (cached) {
|
|
548
|
+
if (isMounted) {
|
|
549
|
+
setSvgContent(cached);
|
|
550
|
+
setIsLoading(false);
|
|
551
|
+
}
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
try {
|
|
555
|
+
setIsLoading(true);
|
|
556
|
+
setError(null);
|
|
557
|
+
const response = await fetch(url);
|
|
558
|
+
if (!response.ok) {
|
|
559
|
+
throw new Error(`Failed to fetch icon: ${response.status}`);
|
|
560
|
+
}
|
|
561
|
+
let svg = await response.text();
|
|
562
|
+
svg = processSvgForCurrentColor(svg);
|
|
563
|
+
svgCache.set(url, svg);
|
|
564
|
+
if (isMounted) {
|
|
565
|
+
setSvgContent(svg);
|
|
566
|
+
setIsLoading(false);
|
|
567
|
+
}
|
|
568
|
+
} catch (err) {
|
|
569
|
+
if (isMounted) {
|
|
570
|
+
setError(err instanceof Error ? err.message : "Failed to load icon");
|
|
571
|
+
setIsLoading(false);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
fetchSvg();
|
|
576
|
+
return () => {
|
|
577
|
+
isMounted = false;
|
|
578
|
+
};
|
|
579
|
+
}, [url]);
|
|
580
|
+
if (isLoading) {
|
|
581
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
582
|
+
"span",
|
|
583
|
+
{
|
|
584
|
+
className: cn("inline-block", className),
|
|
585
|
+
style: { width: size, height: size },
|
|
586
|
+
"aria-hidden": "true"
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
if (error || !svgContent) {
|
|
591
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
592
|
+
"span",
|
|
593
|
+
{
|
|
594
|
+
className: cn("inline-block", className),
|
|
595
|
+
style: { width: size, height: size },
|
|
596
|
+
role: "img",
|
|
597
|
+
"aria-label": alt || iconName
|
|
598
|
+
}
|
|
599
|
+
);
|
|
600
|
+
}
|
|
539
601
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
540
|
-
"
|
|
602
|
+
"span",
|
|
541
603
|
{
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
604
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
605
|
+
style: {
|
|
606
|
+
width: size,
|
|
607
|
+
height: size,
|
|
608
|
+
color: color || "inherit"
|
|
609
|
+
},
|
|
610
|
+
role: "img",
|
|
611
|
+
"aria-label": alt || iconName,
|
|
612
|
+
dangerouslySetInnerHTML: { __html: svgContent }
|
|
548
613
|
}
|
|
549
614
|
);
|
|
550
615
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
616
|
+
function processSvgForCurrentColor(svg) {
|
|
617
|
+
let processed = svg;
|
|
618
|
+
processed = processed.replace(
|
|
619
|
+
/stroke=["'](#000000|#000|black)["']/gi,
|
|
620
|
+
'stroke="currentColor"'
|
|
621
|
+
);
|
|
622
|
+
processed = processed.replace(
|
|
623
|
+
/fill=["'](#000000|#000|black)["']/gi,
|
|
624
|
+
'fill="currentColor"'
|
|
625
|
+
);
|
|
626
|
+
return processed;
|
|
627
|
+
}
|
|
628
|
+
function normalizePhoneNumber(input) {
|
|
629
|
+
const trimmed = input.trim();
|
|
630
|
+
if (trimmed.toLowerCase().startsWith("tel:")) {
|
|
631
|
+
return trimmed;
|
|
632
|
+
}
|
|
633
|
+
const match = trimmed.match(/^[\s\+\-\(\)]*(\d[\d\s\-\(\)\.]*\d)[\s\-]*(x|ext\.?|extension)?[\s\-]*(\d+)?$/i);
|
|
634
|
+
if (match) {
|
|
635
|
+
const mainNumber = match[1].replace(/[\s\-\(\)\.]/g, "");
|
|
636
|
+
const extension = match[3];
|
|
637
|
+
const normalized = mainNumber.length >= 10 && !trimmed.startsWith("+") ? `+${mainNumber}` : mainNumber;
|
|
638
|
+
const withExtension = extension ? `${normalized};ext=${extension}` : normalized;
|
|
639
|
+
return `tel:${withExtension}`;
|
|
640
|
+
}
|
|
641
|
+
const cleaned = trimmed.replace(/[\s\-\(\)\.]/g, "");
|
|
642
|
+
return `tel:${cleaned}`;
|
|
643
|
+
}
|
|
644
|
+
function normalizeEmail(input) {
|
|
645
|
+
const trimmed = input.trim();
|
|
646
|
+
if (trimmed.toLowerCase().startsWith("mailto:")) {
|
|
647
|
+
return trimmed;
|
|
648
|
+
}
|
|
649
|
+
return `mailto:${trimmed}`;
|
|
650
|
+
}
|
|
651
|
+
function isEmail(input) {
|
|
652
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
653
|
+
return emailRegex.test(input.trim());
|
|
654
|
+
}
|
|
655
|
+
function isPhoneNumber(input) {
|
|
656
|
+
const trimmed = input.trim();
|
|
657
|
+
if (trimmed.toLowerCase().startsWith("tel:")) {
|
|
658
|
+
return true;
|
|
659
|
+
}
|
|
660
|
+
const phoneRegex = /^[\s\+\-\(\)]*\d[\d\s\-\(\)\.]*\d[\s\-]*(x|ext\.?|extension)?[\s\-]*\d*$/i;
|
|
661
|
+
return phoneRegex.test(trimmed);
|
|
662
|
+
}
|
|
663
|
+
function isInternalUrl(href) {
|
|
664
|
+
if (typeof window === "undefined") {
|
|
665
|
+
return href.startsWith("/") && !href.startsWith("//");
|
|
666
|
+
}
|
|
667
|
+
const trimmed = href.trim();
|
|
668
|
+
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
669
|
+
return true;
|
|
670
|
+
}
|
|
671
|
+
try {
|
|
672
|
+
const url = new URL(trimmed, window.location.href);
|
|
673
|
+
const currentOrigin = window.location.origin;
|
|
674
|
+
const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
|
|
675
|
+
return normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin);
|
|
676
|
+
} catch {
|
|
677
|
+
return false;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
function toRelativePath(href) {
|
|
681
|
+
if (typeof window === "undefined") {
|
|
682
|
+
return href;
|
|
683
|
+
}
|
|
684
|
+
const trimmed = href.trim();
|
|
685
|
+
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
686
|
+
return trimmed;
|
|
687
|
+
}
|
|
688
|
+
try {
|
|
689
|
+
const url = new URL(trimmed, window.location.href);
|
|
690
|
+
const currentOrigin = window.location.origin;
|
|
691
|
+
const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
|
|
692
|
+
if (normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin)) {
|
|
693
|
+
return url.pathname + url.search + url.hash;
|
|
694
|
+
}
|
|
695
|
+
} catch {
|
|
696
|
+
}
|
|
697
|
+
return trimmed;
|
|
698
|
+
}
|
|
699
|
+
function useNavigation({
|
|
700
|
+
href,
|
|
701
|
+
onClick
|
|
702
|
+
} = {}) {
|
|
703
|
+
const linkType = React4__namespace.useMemo(() => {
|
|
704
|
+
if (!href || href.trim() === "") {
|
|
705
|
+
return onClick ? "none" : "none";
|
|
706
|
+
}
|
|
707
|
+
const trimmed = href.trim();
|
|
708
|
+
if (trimmed.toLowerCase().startsWith("mailto:") || isEmail(trimmed)) {
|
|
709
|
+
return "mailto";
|
|
710
|
+
}
|
|
711
|
+
if (trimmed.toLowerCase().startsWith("tel:") || isPhoneNumber(trimmed)) {
|
|
712
|
+
return "tel";
|
|
713
|
+
}
|
|
714
|
+
if (isInternalUrl(trimmed)) {
|
|
715
|
+
return "internal";
|
|
716
|
+
}
|
|
717
|
+
try {
|
|
718
|
+
new URL(trimmed, typeof window !== "undefined" ? window.location.href : "http://localhost");
|
|
719
|
+
return "external";
|
|
720
|
+
} catch {
|
|
721
|
+
return "internal";
|
|
722
|
+
}
|
|
723
|
+
}, [href, onClick]);
|
|
724
|
+
const normalizedHref = React4__namespace.useMemo(() => {
|
|
725
|
+
if (!href || href.trim() === "") {
|
|
726
|
+
return void 0;
|
|
727
|
+
}
|
|
728
|
+
const trimmed = href.trim();
|
|
729
|
+
switch (linkType) {
|
|
730
|
+
case "tel":
|
|
731
|
+
return normalizePhoneNumber(trimmed);
|
|
732
|
+
case "mailto":
|
|
733
|
+
return normalizeEmail(trimmed);
|
|
734
|
+
case "internal":
|
|
735
|
+
return toRelativePath(trimmed);
|
|
736
|
+
case "external":
|
|
737
|
+
return trimmed;
|
|
738
|
+
default:
|
|
739
|
+
return trimmed;
|
|
740
|
+
}
|
|
741
|
+
}, [href, linkType]);
|
|
742
|
+
const target = React4__namespace.useMemo(() => {
|
|
743
|
+
switch (linkType) {
|
|
744
|
+
case "external":
|
|
745
|
+
return "_blank";
|
|
746
|
+
case "internal":
|
|
747
|
+
return "_self";
|
|
748
|
+
case "mailto":
|
|
749
|
+
case "tel":
|
|
750
|
+
return void 0;
|
|
751
|
+
default:
|
|
752
|
+
return void 0;
|
|
753
|
+
}
|
|
754
|
+
}, [linkType]);
|
|
755
|
+
const rel = React4__namespace.useMemo(() => {
|
|
756
|
+
if (linkType === "external") {
|
|
757
|
+
return "noopener noreferrer";
|
|
758
|
+
}
|
|
759
|
+
return void 0;
|
|
760
|
+
}, [linkType]);
|
|
761
|
+
const isExternal = linkType === "external";
|
|
762
|
+
const isInternal = linkType === "internal";
|
|
763
|
+
const shouldUseRouter = isInternal && typeof normalizedHref === "string" && normalizedHref.startsWith("/");
|
|
764
|
+
const handleClick = React4__namespace.useCallback(
|
|
765
|
+
(event) => {
|
|
766
|
+
if (onClick) {
|
|
767
|
+
try {
|
|
768
|
+
onClick(event);
|
|
769
|
+
} catch (error) {
|
|
770
|
+
console.error("Error in user onClick handler:", error);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
if (event.defaultPrevented) {
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
if (shouldUseRouter && normalizedHref && event.button === 0 && // left-click only
|
|
777
|
+
!event.metaKey && !event.altKey && !event.ctrlKey && !event.shiftKey) {
|
|
778
|
+
if (typeof window !== "undefined") {
|
|
779
|
+
const handler = window.__opensiteNavigationHandler;
|
|
780
|
+
if (typeof handler === "function") {
|
|
781
|
+
try {
|
|
782
|
+
const handled = handler(normalizedHref, event.nativeEvent || event);
|
|
783
|
+
if (handled !== false) {
|
|
784
|
+
event.preventDefault();
|
|
785
|
+
}
|
|
786
|
+
} catch (error) {
|
|
787
|
+
console.error("Error in navigation handler:", error);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
[onClick, shouldUseRouter, normalizedHref]
|
|
794
|
+
);
|
|
795
|
+
return {
|
|
796
|
+
linkType,
|
|
797
|
+
normalizedHref,
|
|
798
|
+
target,
|
|
799
|
+
rel,
|
|
800
|
+
isExternal,
|
|
801
|
+
isInternal,
|
|
802
|
+
shouldUseRouter,
|
|
803
|
+
handleClick
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
var Pressable = React4__namespace.forwardRef(
|
|
807
|
+
({
|
|
808
|
+
children,
|
|
809
|
+
className,
|
|
810
|
+
href,
|
|
811
|
+
onClick,
|
|
812
|
+
variant,
|
|
813
|
+
size,
|
|
814
|
+
asButton = false,
|
|
815
|
+
fallbackComponentType = "span",
|
|
816
|
+
componentType,
|
|
817
|
+
"aria-label": ariaLabel,
|
|
818
|
+
"aria-describedby": ariaDescribedby,
|
|
819
|
+
id,
|
|
820
|
+
...props
|
|
821
|
+
}, ref) => {
|
|
822
|
+
const navigation = useNavigation({ href, onClick });
|
|
823
|
+
const {
|
|
824
|
+
normalizedHref,
|
|
825
|
+
target,
|
|
826
|
+
rel,
|
|
827
|
+
linkType,
|
|
828
|
+
isInternal,
|
|
829
|
+
handleClick
|
|
830
|
+
} = navigation;
|
|
831
|
+
const shouldRenderLink = normalizedHref && linkType !== "none";
|
|
832
|
+
const shouldRenderButton = !shouldRenderLink && onClick;
|
|
833
|
+
const effectiveComponentType = componentType || (shouldRenderLink ? "a" : shouldRenderButton ? "button" : fallbackComponentType);
|
|
834
|
+
const finalComponentType = isInternal && shouldRenderLink ? "a" : effectiveComponentType;
|
|
835
|
+
const shouldApplyButtonStyles = asButton || variant || size;
|
|
836
|
+
const combinedClassName = cn(
|
|
837
|
+
shouldApplyButtonStyles && buttonVariants({ variant, size }),
|
|
838
|
+
className
|
|
839
|
+
);
|
|
840
|
+
const commonProps = {
|
|
841
|
+
className: combinedClassName,
|
|
842
|
+
onClick: handleClick,
|
|
843
|
+
"aria-label": ariaLabel,
|
|
844
|
+
"aria-describedby": ariaDescribedby,
|
|
845
|
+
id,
|
|
846
|
+
...Object.fromEntries(
|
|
847
|
+
Object.entries(props).filter(([key]) => key.startsWith("data-"))
|
|
848
|
+
)
|
|
849
|
+
};
|
|
850
|
+
if (finalComponentType === "a" && shouldRenderLink) {
|
|
851
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
852
|
+
"a",
|
|
853
|
+
{
|
|
854
|
+
ref,
|
|
855
|
+
href: normalizedHref,
|
|
856
|
+
target,
|
|
857
|
+
rel,
|
|
858
|
+
...commonProps,
|
|
859
|
+
...props,
|
|
860
|
+
children
|
|
861
|
+
}
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
if (finalComponentType === "button") {
|
|
865
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
866
|
+
"button",
|
|
867
|
+
{
|
|
868
|
+
ref,
|
|
869
|
+
type: props.type || "button",
|
|
870
|
+
...commonProps,
|
|
871
|
+
...props,
|
|
872
|
+
children
|
|
873
|
+
}
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
if (finalComponentType === "div") {
|
|
877
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
878
|
+
"div",
|
|
879
|
+
{
|
|
880
|
+
ref,
|
|
881
|
+
...commonProps,
|
|
882
|
+
children
|
|
883
|
+
}
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
887
|
+
"span",
|
|
888
|
+
{
|
|
889
|
+
ref,
|
|
890
|
+
...commonProps,
|
|
891
|
+
children
|
|
892
|
+
}
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
);
|
|
896
|
+
Pressable.displayName = "Pressable";
|
|
555
897
|
function AlternatingBlocks({
|
|
556
898
|
sections,
|
|
557
899
|
title,
|
|
@@ -592,6 +934,66 @@ function AlternatingBlocks({
|
|
|
592
934
|
}
|
|
593
935
|
);
|
|
594
936
|
}
|
|
937
|
+
function MediaHoverCtas(props) {
|
|
938
|
+
const { sectionClassName, gridClassName, items, optixFlowConfig } = props;
|
|
939
|
+
const resolvedItems = items ?? [];
|
|
940
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("py-32", sectionClassName), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
941
|
+
"div",
|
|
942
|
+
{
|
|
943
|
+
className: cn(
|
|
944
|
+
"grid min-h-100 grid-cols-1 gap-1 lg:grid-cols-2",
|
|
945
|
+
gridClassName
|
|
946
|
+
),
|
|
947
|
+
children: resolvedItems.map((item, index) => {
|
|
948
|
+
const CardComponent = item.cardHref ? "a" : "div";
|
|
949
|
+
const hasHoverImage = Boolean(item.onHoverImgSrc);
|
|
950
|
+
const applyHoverBackground = Boolean(
|
|
951
|
+
item.onHoverBackgroundColor && !hasHoverImage
|
|
952
|
+
);
|
|
953
|
+
const cardStyle = item.initialBackgroundColor || applyHoverBackground ? {
|
|
954
|
+
...item.initialBackgroundColor ? { "--media-hover-cta-bg": item.initialBackgroundColor } : {},
|
|
955
|
+
...applyHoverBackground ? {
|
|
956
|
+
"--media-hover-cta-hover-bg": item.onHoverBackgroundColor
|
|
957
|
+
} : {}
|
|
958
|
+
} : void 0;
|
|
959
|
+
const baseBackgroundClassName = item.initialBackgroundColor ? "bg-[var(--media-hover-cta-bg)]" : "bg-muted-foreground/10";
|
|
960
|
+
const hoverBackgroundClassName = applyHoverBackground ? "group-hover:bg-[var(--media-hover-cta-hover-bg)]" : "";
|
|
961
|
+
const hoverImageAltText = item.altText ?? "";
|
|
962
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
963
|
+
CardComponent,
|
|
964
|
+
{
|
|
965
|
+
...item.cardHref ? { href: item.cardHref } : {},
|
|
966
|
+
className: cn(
|
|
967
|
+
"group relative flex min-h-100 cursor-pointer items-center overflow-hidden justify-start p-10 transition-colors duration-500",
|
|
968
|
+
index % 2 === 0 ? "md:justify-center" : "md:justify-start md:pl-24",
|
|
969
|
+
baseBackgroundClassName,
|
|
970
|
+
hoverBackgroundClassName
|
|
971
|
+
),
|
|
972
|
+
style: cardStyle,
|
|
973
|
+
children: [
|
|
974
|
+
item.onHoverImgSrc ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
975
|
+
img.Img,
|
|
976
|
+
{
|
|
977
|
+
src: item.onHoverImgSrc,
|
|
978
|
+
alt: hoverImageAltText,
|
|
979
|
+
"aria-hidden": item.altText ? void 0 : true,
|
|
980
|
+
className: cn(
|
|
981
|
+
"absolute top-0 left-0 z-[-1] h-full w-full object-cover opacity-0 transition-opacity duration-500 group-hover:opacity-100",
|
|
982
|
+
item.imgHoverClassName
|
|
983
|
+
),
|
|
984
|
+
loading: "lazy",
|
|
985
|
+
optixFlowConfig
|
|
986
|
+
}
|
|
987
|
+
) : null,
|
|
988
|
+
item.content
|
|
989
|
+
]
|
|
990
|
+
},
|
|
991
|
+
index
|
|
992
|
+
);
|
|
993
|
+
})
|
|
994
|
+
}
|
|
995
|
+
) });
|
|
996
|
+
}
|
|
595
997
|
|
|
596
998
|
exports.AlternatingBlocks = AlternatingBlocks;
|
|
597
999
|
exports.AnimatedDialog = AnimatedDialog;
|
|
@@ -605,10 +1007,12 @@ exports.CardHeader = CardHeader;
|
|
|
605
1007
|
exports.CardTitle = CardTitle;
|
|
606
1008
|
exports.Container = Container;
|
|
607
1009
|
exports.DynamicIcon = DynamicIcon;
|
|
1010
|
+
exports.MediaHoverCtas = MediaHoverCtas;
|
|
608
1011
|
exports.PageHeroBanner = PageHeroBanner;
|
|
609
1012
|
exports.Popover = Popover;
|
|
610
1013
|
exports.PopoverContent = PopoverContent;
|
|
611
1014
|
exports.PopoverTrigger = PopoverTrigger;
|
|
1015
|
+
exports.Pressable = Pressable;
|
|
612
1016
|
exports.Section = Section;
|
|
613
1017
|
//# sourceMappingURL=components.cjs.map
|
|
614
1018
|
//# sourceMappingURL=components.cjs.map
|