@nationaldesignstudio/react 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/index.d.ts +95 -0
- package/dist/accordion/index.js +143 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/background/index.d.ts +149 -0
- package/dist/background/index.js +200 -0
- package/dist/background/index.js.map +1 -0
- package/dist/banner/index.d.ts +101 -0
- package/dist/banner/index.js +81 -0
- package/dist/banner/index.js.map +1 -0
- package/dist/blurred-video-backdrop/index.d.ts +233 -0
- package/dist/blurred-video-backdrop/index.js +266 -0
- package/dist/blurred-video-backdrop/index.js.map +1 -0
- package/dist/button/index.d.ts +180 -0
- package/dist/button/index.js +169 -0
- package/dist/button/index.js.map +1 -0
- package/dist/button-B2g5fH9b.d.ts +152 -0
- package/dist/card/index.d.ts +406 -0
- package/dist/card/index.js +219 -0
- package/dist/card/index.js.map +1 -0
- package/dist/card-grid/index.d.ts +90 -0
- package/dist/card-grid/index.js +74 -0
- package/dist/card-grid/index.js.map +1 -0
- package/dist/component-registry.md +136 -2
- package/dist/dev-toolbar/index.d.ts +8 -0
- package/dist/dev-toolbar/index.js +206 -0
- package/dist/dev-toolbar/index.js.map +1 -0
- package/dist/dialog/index.d.ts +268 -0
- package/dist/dialog/index.js +288 -0
- package/dist/dialog/index.js.map +1 -0
- package/dist/faq-section/index.d.ts +47 -0
- package/dist/faq-section/index.js +152 -0
- package/dist/faq-section/index.js.map +1 -0
- package/dist/grid-overlay/index.d.ts +10 -0
- package/dist/grid-overlay/index.js +38 -0
- package/dist/grid-overlay/index.js.map +1 -0
- package/dist/hero/index.d.ts +462 -0
- package/dist/hero/index.js +494 -0
- package/dist/hero/index.js.map +1 -0
- package/dist/hooks/index.d.ts +150 -0
- package/dist/hooks/index.js +339 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +46 -5339
- package/dist/index.js +157 -4080
- package/dist/index.js.map +1 -1
- package/dist/input/index.d.ts +404 -0
- package/dist/input/index.js +393 -0
- package/dist/input/index.js.map +1 -0
- package/dist/navbar/index.d.ts +68 -0
- package/dist/navbar/index.js +227 -0
- package/dist/navbar/index.js.map +1 -0
- package/dist/ndstudio-footer/index.d.ts +32 -0
- package/dist/ndstudio-footer/index.js +35 -0
- package/dist/ndstudio-footer/index.js.map +1 -0
- package/dist/pager-control/index.d.ts +173 -0
- package/dist/pager-control/index.js +267 -0
- package/dist/pager-control/index.js.map +1 -0
- package/dist/popover/index.d.ts +200 -0
- package/dist/popover/index.js +290 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/prose/index.d.ts +39 -0
- package/dist/prose/index.js +56 -0
- package/dist/prose/index.js.map +1 -0
- package/dist/quote-block/index.d.ts +156 -0
- package/dist/quote-block/index.js +321 -0
- package/dist/quote-block/index.js.map +1 -0
- package/dist/river/index.d.ts +100 -0
- package/dist/river/index.js +107 -0
- package/dist/river/index.js.map +1 -0
- package/dist/select/index.d.ts +188 -0
- package/dist/select/index.js +295 -0
- package/dist/select/index.js.map +1 -0
- package/dist/theme/index.d.ts +149 -0
- package/dist/theme/index.js +211 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme-CzBPUlh_.d.ts +332 -0
- package/dist/tooltip/index.d.ts +166 -0
- package/dist/tooltip/index.js +200 -0
- package/dist/tooltip/index.js.map +1 -0
- package/dist/tout/index.d.ts +157 -0
- package/dist/tout/index.js +315 -0
- package/dist/tout/index.js.map +1 -0
- package/dist/two-column-section/index.d.ts +122 -0
- package/dist/two-column-section/index.js +121 -0
- package/dist/two-column-section/index.js.map +1 -0
- package/dist/us-gov-banner/index.d.ts +141 -0
- package/dist/us-gov-banner/index.js +74 -0
- package/dist/us-gov-banner/index.js.map +1 -0
- package/dist/use-captions-AkKlJhov.d.ts +71 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/video-dialog/index.d.ts +106 -0
- package/dist/video-dialog/index.js +1305 -0
- package/dist/video-dialog/index.js.map +1 -0
- package/dist/video-player/index.d.ts +115 -0
- package/dist/video-player/index.js +879 -0
- package/dist/video-player/index.js.map +1 -0
- package/dist/video-player-qxf-BURH.d.ts +236 -0
- package/dist/video-with-backdrop/index.d.ts +267 -0
- package/dist/video-with-backdrop/index.js +1284 -0
- package/dist/video-with-backdrop/index.js.map +1 -0
- package/package.json +13 -2
- package/src/components/organisms/us-gov-banner/us-gov-banner.tsx +5 -27
- package/src/theme/hooks.ts +2 -0
- package/src/theme/theme-provider.tsx +2 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
import * as tailwind_variants_dist_config_js from 'tailwind-variants/dist/config.js';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
declare const accordionVariants: tailwind_variants.TVReturnType<{
|
|
7
|
+
colorScheme: {
|
|
8
|
+
dark: string;
|
|
9
|
+
light: string;
|
|
10
|
+
};
|
|
11
|
+
}, undefined, "flex flex-col", tailwind_variants_dist_config_js.TVConfig<{
|
|
12
|
+
colorScheme: {
|
|
13
|
+
dark: string;
|
|
14
|
+
light: string;
|
|
15
|
+
};
|
|
16
|
+
}, {
|
|
17
|
+
colorScheme: {
|
|
18
|
+
dark: string;
|
|
19
|
+
light: string;
|
|
20
|
+
};
|
|
21
|
+
}>, {
|
|
22
|
+
colorScheme: {
|
|
23
|
+
dark: string;
|
|
24
|
+
light: string;
|
|
25
|
+
};
|
|
26
|
+
}, undefined, tailwind_variants.TVReturnType<{
|
|
27
|
+
colorScheme: {
|
|
28
|
+
dark: string;
|
|
29
|
+
light: string;
|
|
30
|
+
};
|
|
31
|
+
}, undefined, "flex flex-col", tailwind_variants_dist_config_js.TVConfig<{
|
|
32
|
+
colorScheme: {
|
|
33
|
+
dark: string;
|
|
34
|
+
light: string;
|
|
35
|
+
};
|
|
36
|
+
}, {
|
|
37
|
+
colorScheme: {
|
|
38
|
+
dark: string;
|
|
39
|
+
light: string;
|
|
40
|
+
};
|
|
41
|
+
}>, unknown, unknown, undefined>>;
|
|
42
|
+
interface AccordionProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof accordionVariants> {
|
|
43
|
+
/**
|
|
44
|
+
* Allow multiple items to be expanded at once
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
allowMultiple?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The ID(s) of items that should be expanded by default
|
|
50
|
+
*/
|
|
51
|
+
defaultExpanded?: string | string[];
|
|
52
|
+
children: React.ReactNode;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Accordion component for expandable/collapsible content sections.
|
|
56
|
+
* Built on Base UI's Accordion primitive.
|
|
57
|
+
*
|
|
58
|
+
* Variants:
|
|
59
|
+
* - light: Light theme styling (default)
|
|
60
|
+
* - dark: Dark theme styling
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* <Accordion defaultExpanded="item-1" variant="dark">
|
|
65
|
+
* <AccordionItem id="item-1" title="Question 1">
|
|
66
|
+
* Answer to question 1
|
|
67
|
+
* </AccordionItem>
|
|
68
|
+
* <AccordionItem id="item-2" title="Question 2">
|
|
69
|
+
* Answer to question 2
|
|
70
|
+
* </AccordionItem>
|
|
71
|
+
* </Accordion>
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
|
|
75
|
+
interface AccordionItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
76
|
+
/**
|
|
77
|
+
* Unique identifier for this item
|
|
78
|
+
*/
|
|
79
|
+
id: string;
|
|
80
|
+
/**
|
|
81
|
+
* The question/title displayed in the header
|
|
82
|
+
*/
|
|
83
|
+
title: string;
|
|
84
|
+
/**
|
|
85
|
+
* The answer/content revealed when expanded
|
|
86
|
+
*/
|
|
87
|
+
children: React.ReactNode;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Individual accordion item with collapsible content.
|
|
91
|
+
* Must be used within an Accordion component.
|
|
92
|
+
*/
|
|
93
|
+
declare const AccordionItem: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
94
|
+
|
|
95
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Accordion as Accordion$1 } from '@base-ui-components/react/accordion';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { tv, cnBase } from 'tailwind-variants';
|
|
5
|
+
import { clsx } from 'clsx';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/components/atoms/accordion/accordion.tsx
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return cnBase(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
var accordionVariants = tv({
|
|
13
|
+
base: "flex flex-col",
|
|
14
|
+
variants: {
|
|
15
|
+
colorScheme: {
|
|
16
|
+
dark: "",
|
|
17
|
+
light: ""
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
colorScheme: "light"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var accordionItemVariants = tv({
|
|
25
|
+
base: "border-b overflow-hidden",
|
|
26
|
+
variants: {
|
|
27
|
+
colorScheme: {
|
|
28
|
+
dark: "border-gray-300",
|
|
29
|
+
light: "border-gray-500"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
colorScheme: "light"
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var accordionTriggerVariants = tv({
|
|
37
|
+
base: [
|
|
38
|
+
// Uses primitive spacing tokens
|
|
39
|
+
"flex w-full items-center justify-between py-24 text-left",
|
|
40
|
+
"typography-body-large transition-colors cursor-pointer"
|
|
41
|
+
],
|
|
42
|
+
variants: {
|
|
43
|
+
colorScheme: {
|
|
44
|
+
dark: "text-gray-100 data-[open]:text-white",
|
|
45
|
+
light: "text-gray-800 data-[open]:text-gray-900"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
colorScheme: "light"
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var accordionPanelVariants = tv({
|
|
53
|
+
// Uses primitive spacing tokens
|
|
54
|
+
base: "typography-body-large pb-24",
|
|
55
|
+
variants: {
|
|
56
|
+
colorScheme: {
|
|
57
|
+
dark: "text-gray-100",
|
|
58
|
+
light: "text-gray-800"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
colorScheme: "light"
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var AccordionContext = React.createContext({
|
|
66
|
+
colorScheme: "light"
|
|
67
|
+
});
|
|
68
|
+
var Accordion = React.forwardRef(
|
|
69
|
+
({
|
|
70
|
+
className,
|
|
71
|
+
allowMultiple = false,
|
|
72
|
+
defaultExpanded,
|
|
73
|
+
colorScheme = "light",
|
|
74
|
+
children
|
|
75
|
+
}, ref) => {
|
|
76
|
+
const defaultValue = React.useMemo(() => {
|
|
77
|
+
if (!defaultExpanded) return void 0;
|
|
78
|
+
if (Array.isArray(defaultExpanded)) return defaultExpanded;
|
|
79
|
+
return [defaultExpanded];
|
|
80
|
+
}, [defaultExpanded]);
|
|
81
|
+
return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: { colorScheme }, children: /* @__PURE__ */ jsx(
|
|
82
|
+
Accordion$1.Root,
|
|
83
|
+
{
|
|
84
|
+
ref,
|
|
85
|
+
className: accordionVariants({ colorScheme, class: className }),
|
|
86
|
+
defaultValue,
|
|
87
|
+
multiple: allowMultiple,
|
|
88
|
+
children
|
|
89
|
+
}
|
|
90
|
+
) });
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
Accordion.displayName = "Accordion";
|
|
94
|
+
var AccordionItem = React.forwardRef(
|
|
95
|
+
({ className, id, title, children }, ref) => {
|
|
96
|
+
const { colorScheme } = React.useContext(AccordionContext);
|
|
97
|
+
return /* @__PURE__ */ jsxs(
|
|
98
|
+
Accordion$1.Item,
|
|
99
|
+
{
|
|
100
|
+
ref,
|
|
101
|
+
value: id,
|
|
102
|
+
className: accordionItemVariants({ colorScheme, class: className }),
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx(Accordion$1.Header, { children: /* @__PURE__ */ jsxs(
|
|
105
|
+
Accordion$1.Trigger,
|
|
106
|
+
{
|
|
107
|
+
className: accordionTriggerVariants({ colorScheme }),
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", { children: title }),
|
|
110
|
+
/* @__PURE__ */ jsx(
|
|
111
|
+
"span",
|
|
112
|
+
{
|
|
113
|
+
className: cn(
|
|
114
|
+
"text-base transition-transform duration-200",
|
|
115
|
+
"[[data-open]_&]:rotate-45"
|
|
116
|
+
),
|
|
117
|
+
children: "+"
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
) }),
|
|
123
|
+
/* @__PURE__ */ jsx(
|
|
124
|
+
Accordion$1.Panel,
|
|
125
|
+
{
|
|
126
|
+
className: cn(
|
|
127
|
+
"h-[var(--accordion-panel-height)] overflow-hidden",
|
|
128
|
+
"transition-[height] duration-300 ease-out",
|
|
129
|
+
"[&[data-starting-style]]:h-0 [&[data-ending-style]]:h-0"
|
|
130
|
+
),
|
|
131
|
+
children: /* @__PURE__ */ jsx("div", { className: accordionPanelVariants({ colorScheme }), children })
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
AccordionItem.displayName = "AccordionItem";
|
|
140
|
+
|
|
141
|
+
export { Accordion, AccordionItem };
|
|
142
|
+
//# sourceMappingURL=index.js.map
|
|
143
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/components/atoms/accordion/accordion.tsx"],"names":["twMerge","BaseAccordion"],"mappings":";;;;;;;AAKO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAOA,MAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACIA,IAAM,oBAAoB,EAAA,CAAG;AAAA,EAC5B,IAAA,EAAM,eAAA;AAAA,EACN,QAAA,EAAU;AAAA,IACT,WAAA,EAAa;AAAA,MACZ,IAAA,EAAM,EAAA;AAAA,MACN,KAAA,EAAO;AAAA;AACR,GACD;AAAA,EACA,eAAA,EAAiB;AAAA,IAChB,WAAA,EAAa;AAAA;AAEf,CAAC,CAAA;AAED,IAAM,wBAAwB,EAAA,CAAG;AAAA,EAChC,IAAA,EAAM,0BAAA;AAAA,EACN,QAAA,EAAU;AAAA,IACT,WAAA,EAAa;AAAA,MACZ,IAAA,EAAM,iBAAA;AAAA,MACN,KAAA,EAAO;AAAA;AACR,GACD;AAAA,EACA,eAAA,EAAiB;AAAA,IAChB,WAAA,EAAa;AAAA;AAEf,CAAC,CAAA;AAED,IAAM,2BAA2B,EAAA,CAAG;AAAA,EACnC,IAAA,EAAM;AAAA;AAAA,IAEL,0DAAA;AAAA,IACA;AAAA,GACD;AAAA,EACA,QAAA,EAAU;AAAA,IACT,WAAA,EAAa;AAAA,MACZ,IAAA,EAAM,sCAAA;AAAA,MACN,KAAA,EAAO;AAAA;AACR,GACD;AAAA,EACA,eAAA,EAAiB;AAAA,IAChB,WAAA,EAAa;AAAA;AAEf,CAAC,CAAA;AAED,IAAM,yBAAyB,EAAA,CAAG;AAAA;AAAA,EAEjC,IAAA,EAAM,6BAAA;AAAA,EACN,QA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EAAY,GAAU,KAAA,CAAA,UAAA,CAAW,gBAAgB,CAAA;AAEzD,IAAA,uBACC,IAAA;AAAA,MAACA,WAAA,CAAc,IAAA;AAAA,MAAd;AAAA,QACA,GAAA;AAAA,QACA,KAAA,EAAO,EAAA;AAAA,QACP,WAAW,qBAAA,CAAsB,EAAE,WAAA,EAAa,KAAA,EAAO,WAAW,CAAA;AAAA,QAGlE,QAAA,EAAA;AAAA,0BAAA,GAAA,CAACA,WAAA,CAAc,QAAd,EACA,QAAA,kBAAA,IAAA;AAAA,YAACA,WAAA,CAAc,OAAA;AAAA,YAAd;AAAA,cACA,SAAA,EAAW,wBAAA,CAAyB,EAAE,WAAA,EAAa,CAAA;AAAA,cAEnD,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,UAAM,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,gCACb,GAAA;AAAA,kBAAC,MAAA;AAAA,kBAAA;AAAA,oBACA,SAAA,EAAW,EAAA;AAAA,sBACV,6CAAA;AAAA,sBACA;AAAA,qBACD;AAAA,oBACA,QAAA,EAAA;AAAA;AAAA;AAED;AAAA;AAAA,WACD,EACD,CAAA;AAAA,0BAGA,GAAA;AAAA,YAACA,WAAA,CAAc,KAAA;AAAA,YAAd;AAAA,cACA,SAAA,EAAW,EAAA;AAAA,gBACV,mDAAA;AAAA,gBACA,2CAAA;AAAA,gBACA;AAAA,eACD;AAAA,cAEA,QAAA,kBAAA,GAAA,CAAC,SAAI,SAAA,EAAW,sBAAA,CAAuB,EAAE,WAAA,EAAa,GACpD,QAAA,EACF;AAAA;AAAA;AACD;AAAA;AAAA,KACD;AAAA,EAEF;AACD;AACA,aAAA,CAAc,WAAA,GAAc,eAAA","file":"index.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { cnBase as twMerge } from \"tailwind-variants\";\n\nexport { twMerge };\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport { Accordion as BaseAccordion } from \"@base-ui-components/react/accordion\";\nimport * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\nimport { cn } from \"@/lib/utils\";\n\n// =============================================================================\n// Accordion Variants\n// =============================================================================\n\nconst accordionVariants = tv({\n\tbase: \"flex flex-col\",\n\tvariants: {\n\t\tcolorScheme: {\n\t\t\tdark: \"\",\n\t\t\tlight: \"\",\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tcolorScheme: \"light\",\n\t},\n});\n\nconst accordionItemVariants = tv({\n\tbase: \"border-b overflow-hidden\",\n\tvariants: {\n\t\tcolorScheme: {\n\t\t\tdark: \"border-gray-300\",\n\t\t\tlight: \"border-gray-500\",\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tcolorScheme: \"light\",\n\t},\n});\n\nconst accordionTriggerVariants = tv({\n\tbase: [\n\t\t// Uses primitive spacing tokens\n\t\t\"flex w-full items-center justify-between py-24 text-left\",\n\t\t\"typography-body-large transition-colors cursor-pointer\",\n\t],\n\tvariants: {\n\t\tcolorScheme: {\n\t\t\tdark: \"text-gray-100 data-[open]:text-white\",\n\t\t\tlight: \"text-gray-800 data-[open]:text-gray-900\",\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tcolorScheme: \"light\",\n\t},\n});\n\nconst accordionPanelVariants = tv({\n\t// Uses primitive spacing tokens\n\tbase: \"typography-body-large pb-24\",\n\tvariants: {\n\t\tcolorScheme: {\n\t\t\tdark: \"text-gray-100\",\n\t\t\tlight: \"text-gray-800\",\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tcolorScheme: \"light\",\n\t},\n});\n\n// =============================================================================\n// Accordion Context\n// =============================================================================\n\nconst AccordionContext = React.createContext<{\n\tcolorScheme: \"dark\" | \"light\";\n}>({\n\tcolorScheme: \"light\",\n});\n\n// =============================================================================\n// Accordion\n// =============================================================================\n\nexport interface AccordionProps\n\textends React.HTMLAttributes<HTMLDivElement>,\n\t\tVariantProps<typeof accordionVariants> {\n\t/**\n\t * Allow multiple items to be expanded at once\n\t * @default false\n\t */\n\tallowMultiple?: boolean;\n\t/**\n\t * The ID(s) of items that should be expanded by default\n\t */\n\tdefaultExpanded?: string | string[];\n\tchildren: React.ReactNode;\n}\n\n/**\n * Accordion component for expandable/collapsible content sections.\n * Built on Base UI's Accordion primitive.\n *\n * Variants:\n * - light: Light theme styling (default)\n * - dark: Dark theme styling\n *\n * @example\n * ```tsx\n * <Accordion defaultExpanded=\"item-1\" variant=\"dark\">\n * <AccordionItem id=\"item-1\" title=\"Question 1\">\n * Answer to question 1\n * </AccordionItem>\n * <AccordionItem id=\"item-2\" title=\"Question 2\">\n * Answer to question 2\n * </AccordionItem>\n * </Accordion>\n * ```\n */\nconst Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tallowMultiple = false,\n\t\t\tdefaultExpanded,\n\t\t\tcolorScheme = \"light\",\n\t\t\tchildren,\n\t\t},\n\t\tref,\n\t) => {\n\t\t// Normalize defaultExpanded to array format for Base UI\n\t\tconst defaultValue = React.useMemo((): string[] | undefined => {\n\t\t\tif (!defaultExpanded) return undefined;\n\t\t\tif (Array.isArray(defaultExpanded)) return defaultExpanded;\n\t\t\treturn [defaultExpanded];\n\t\t}, [defaultExpanded]);\n\n\t\treturn (\n\t\t\t<AccordionContext.Provider value={{ colorScheme }}>\n\t\t\t\t<BaseAccordion.Root\n\t\t\t\t\tref={ref}\n\t\t\t\t\tclassName={accordionVariants({ colorScheme, class: className })}\n\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\tmultiple={allowMultiple}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</BaseAccordion.Root>\n\t\t\t</AccordionContext.Provider>\n\t\t);\n\t},\n);\nAccordion.displayName = \"Accordion\";\n\n// =============================================================================\n// AccordionItem\n// =============================================================================\n\nexport interface AccordionItemProps\n\textends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n\t/**\n\t * Unique identifier for this item\n\t */\n\tid: string;\n\t/**\n\t * The question/title displayed in the header\n\t */\n\ttitle: string;\n\t/**\n\t * The answer/content revealed when expanded\n\t */\n\tchildren: React.ReactNode;\n}\n\n/**\n * Individual accordion item with collapsible content.\n * Must be used within an Accordion component.\n */\nconst AccordionItem = React.forwardRef<HTMLDivElement, AccordionItemProps>(\n\t({ className, id, title, children }, ref) => {\n\t\tconst { colorScheme } = React.useContext(AccordionContext);\n\n\t\treturn (\n\t\t\t<BaseAccordion.Item\n\t\t\t\tref={ref}\n\t\t\t\tvalue={id}\n\t\t\t\tclassName={accordionItemVariants({ colorScheme, class: className })}\n\t\t\t>\n\t\t\t\t{/* Header - always visible */}\n\t\t\t\t<BaseAccordion.Header>\n\t\t\t\t\t<BaseAccordion.Trigger\n\t\t\t\t\t\tclassName={accordionTriggerVariants({ colorScheme })}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span>{title}</span>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"text-base transition-transform duration-200\",\n\t\t\t\t\t\t\t\t\"[[data-open]_&]:rotate-45\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t+\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</BaseAccordion.Trigger>\n\t\t\t\t</BaseAccordion.Header>\n\n\t\t\t\t{/* Content - collapsible */}\n\t\t\t\t<BaseAccordion.Panel\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"h-[var(--accordion-panel-height)] overflow-hidden\",\n\t\t\t\t\t\t\"transition-[height] duration-300 ease-out\",\n\t\t\t\t\t\t\"[&[data-starting-style]]:h-0 [&[data-ending-style]]:h-0\",\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<div className={accordionPanelVariants({ colorScheme })}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</BaseAccordion.Panel>\n\t\t\t</BaseAccordion.Item>\n\t\t);\n\t},\n);\nAccordionItem.displayName = \"AccordionItem\";\n\nexport { Accordion, AccordionItem, accordionVariants };\n"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
+
import * as tailwind_variants_dist_config_js from 'tailwind-variants/dist/config.js';
|
|
4
|
+
import { useRender } from '@base-ui-components/react/use-render';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
|
|
7
|
+
declare const backgroundVariants: tailwind_variants.TVReturnType<{} | {} | {}, undefined, "absolute inset-0", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, "absolute inset-0", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
8
|
+
/**
|
|
9
|
+
* Base container for background composition.
|
|
10
|
+
* Use as a wrapper to compose multiple background layers (image, video, overlay, gradient).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Background>
|
|
15
|
+
* <Background.Image src="/hero.jpg" />
|
|
16
|
+
* <Background.Overlay opacity={0.4} />
|
|
17
|
+
* <Background.Gradient direction="to-t" from="black" to="transparent" />
|
|
18
|
+
* </Background>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
interface BackgroundProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
}
|
|
23
|
+
declare const backgroundImageVariants: tailwind_variants.TVReturnType<{} | {} | {}, undefined, "absolute inset-0 size-full object-cover", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, "absolute inset-0 size-full object-cover", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
24
|
+
interface BackgroundImageProps extends useRender.ComponentProps<"img">, Omit<React.ImgHTMLAttributes<HTMLImageElement>, "src" | "render"> {
|
|
25
|
+
/**
|
|
26
|
+
* URL for the background image
|
|
27
|
+
*/
|
|
28
|
+
src: string;
|
|
29
|
+
/**
|
|
30
|
+
* Object position (default: "center")
|
|
31
|
+
*/
|
|
32
|
+
position?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Background image layer using an actual img element with object-cover.
|
|
36
|
+
* Supports native lazy loading, srcset, and better accessibility.
|
|
37
|
+
* Supports render prop for element composition.
|
|
38
|
+
*/
|
|
39
|
+
declare function BackgroundImage(props: BackgroundImageProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
40
|
+
declare namespace BackgroundImage {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
43
|
+
declare const backgroundVideoVariants: tailwind_variants.TVReturnType<{} | {} | {}, undefined, "absolute inset-0 size-full object-cover", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, "absolute inset-0 size-full object-cover", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
44
|
+
interface BackgroundVideoProps extends useRender.ComponentProps<"video">, Omit<React.VideoHTMLAttributes<HTMLVideoElement>, "children" | "render" | "src"> {
|
|
45
|
+
/**
|
|
46
|
+
* URL for the video source
|
|
47
|
+
*/
|
|
48
|
+
src: string;
|
|
49
|
+
/**
|
|
50
|
+
* Video MIME type (default: auto-detected from src)
|
|
51
|
+
*/
|
|
52
|
+
type?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Poster image URL shown before video loads
|
|
55
|
+
*/
|
|
56
|
+
poster?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Background video layer using HTML5 video element.
|
|
60
|
+
* Supports render prop for element composition.
|
|
61
|
+
*/
|
|
62
|
+
declare function BackgroundVideo(props: BackgroundVideoProps): react_jsx_runtime.JSX.Element;
|
|
63
|
+
declare namespace BackgroundVideo {
|
|
64
|
+
var displayName: string;
|
|
65
|
+
}
|
|
66
|
+
declare const backgroundStreamVariants: tailwind_variants.TVReturnType<{} | {} | {}, undefined, "absolute inset-0 size-full border-0 scale-[1.5] object-cover", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, "absolute inset-0 size-full border-0 scale-[1.5] object-cover", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
67
|
+
interface BackgroundStreamProps extends React.IframeHTMLAttributes<HTMLIFrameElement> {
|
|
68
|
+
/**
|
|
69
|
+
* Cloudflare Stream video ID
|
|
70
|
+
*/
|
|
71
|
+
videoId: string;
|
|
72
|
+
/**
|
|
73
|
+
* Poster image URL (Cloudflare Stream thumbnail or custom)
|
|
74
|
+
*/
|
|
75
|
+
poster?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the video should autoplay (default: true)
|
|
78
|
+
*/
|
|
79
|
+
autoplay?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the video should loop (default: true)
|
|
82
|
+
*/
|
|
83
|
+
loop?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Whether the video should be muted (default: true)
|
|
86
|
+
*/
|
|
87
|
+
muted?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Whether to show playback controls (default: false)
|
|
90
|
+
*/
|
|
91
|
+
controls?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Custom Cloudflare customer subdomain (if using custom domains)
|
|
94
|
+
*/
|
|
95
|
+
customerSubdomain?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Background video layer using Cloudflare Stream.
|
|
99
|
+
*/
|
|
100
|
+
declare const BackgroundStream: React.ForwardRefExoticComponent<BackgroundStreamProps & React.RefAttributes<HTMLIFrameElement>>;
|
|
101
|
+
declare const backgroundOverlayVariants: tailwind_variants.TVReturnType<{} | {} | {}, undefined, "absolute inset-0 bg-bg-overlay", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, "absolute inset-0 bg-bg-overlay", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
102
|
+
interface BackgroundOverlayProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
103
|
+
/**
|
|
104
|
+
* Overlay opacity (0-1)
|
|
105
|
+
*/
|
|
106
|
+
opacity?: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Solid color overlay layer. Uses semantic bg-overlay token by default.
|
|
110
|
+
* Override with className for different colors.
|
|
111
|
+
*/
|
|
112
|
+
declare const BackgroundOverlay: React.ForwardRefExoticComponent<BackgroundOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
113
|
+
declare const backgroundGradientVariants: tailwind_variants.TVReturnType<{} | {} | {}, undefined, "absolute inset-0", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, "absolute inset-0", tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
114
|
+
interface BackgroundGradientProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
115
|
+
/**
|
|
116
|
+
* Gradient direction (Tailwind convention: to-t, to-b, to-l, to-r, etc.)
|
|
117
|
+
* Or CSS gradient direction (to top, to bottom, 45deg, etc.)
|
|
118
|
+
*/
|
|
119
|
+
direction?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Starting color (from)
|
|
122
|
+
*/
|
|
123
|
+
from?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Optional middle color (via)
|
|
126
|
+
*/
|
|
127
|
+
via?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Ending color (to)
|
|
130
|
+
*/
|
|
131
|
+
to?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Full custom gradient string (overrides from/via/to)
|
|
134
|
+
*/
|
|
135
|
+
gradient?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Gradient overlay layer. Use for fading backgrounds or creating depth.
|
|
139
|
+
*/
|
|
140
|
+
declare const BackgroundGradient: React.ForwardRefExoticComponent<BackgroundGradientProps & React.RefAttributes<HTMLDivElement>>;
|
|
141
|
+
declare const BackgroundCompound: React.ForwardRefExoticComponent<BackgroundProps & React.RefAttributes<HTMLDivElement>> & {
|
|
142
|
+
Image: typeof BackgroundImage;
|
|
143
|
+
Video: typeof BackgroundVideo;
|
|
144
|
+
Stream: React.ForwardRefExoticComponent<BackgroundStreamProps & React.RefAttributes<HTMLIFrameElement>>;
|
|
145
|
+
Overlay: React.ForwardRefExoticComponent<BackgroundOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
146
|
+
Gradient: React.ForwardRefExoticComponent<BackgroundGradientProps & React.RefAttributes<HTMLDivElement>>;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export { BackgroundCompound as Background, BackgroundGradient, type BackgroundGradientProps, BackgroundImage, type BackgroundImageProps, BackgroundOverlay, type BackgroundOverlayProps, type BackgroundProps, BackgroundStream, type BackgroundStreamProps, BackgroundVideo, type BackgroundVideoProps, backgroundGradientVariants, backgroundImageVariants, backgroundOverlayVariants, backgroundStreamVariants, backgroundVariants, backgroundVideoVariants };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from '@base-ui-components/react/use-render';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { tv } from 'tailwind-variants';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
// src/components/atoms/background/background.tsx
|
|
8
|
+
var backgroundVariants = tv({
|
|
9
|
+
base: "absolute inset-0"
|
|
10
|
+
});
|
|
11
|
+
var Background = React.forwardRef(
|
|
12
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
ref,
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
className: backgroundVariants({ class: className }),
|
|
18
|
+
...props,
|
|
19
|
+
children
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
Background.displayName = "Background";
|
|
24
|
+
var backgroundImageVariants = tv({
|
|
25
|
+
base: "absolute inset-0 size-full object-cover"
|
|
26
|
+
});
|
|
27
|
+
function BackgroundImage(props) {
|
|
28
|
+
const {
|
|
29
|
+
className,
|
|
30
|
+
src,
|
|
31
|
+
position = "center",
|
|
32
|
+
alt = "",
|
|
33
|
+
style,
|
|
34
|
+
render,
|
|
35
|
+
...otherProps
|
|
36
|
+
} = props;
|
|
37
|
+
const imgClassName = backgroundImageVariants({ class: className });
|
|
38
|
+
const imgStyle = { objectPosition: position, ...style };
|
|
39
|
+
return useRender({
|
|
40
|
+
render,
|
|
41
|
+
props: {
|
|
42
|
+
src,
|
|
43
|
+
alt,
|
|
44
|
+
className: imgClassName,
|
|
45
|
+
style: imgStyle,
|
|
46
|
+
...otherProps
|
|
47
|
+
},
|
|
48
|
+
defaultTagName: "img"
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
BackgroundImage.displayName = "Background.Image";
|
|
52
|
+
var backgroundVideoVariants = tv({
|
|
53
|
+
base: "absolute inset-0 size-full object-cover"
|
|
54
|
+
});
|
|
55
|
+
function BackgroundVideo(props) {
|
|
56
|
+
const {
|
|
57
|
+
className,
|
|
58
|
+
src,
|
|
59
|
+
type,
|
|
60
|
+
poster,
|
|
61
|
+
autoPlay = true,
|
|
62
|
+
loop = true,
|
|
63
|
+
muted = true,
|
|
64
|
+
playsInline = true,
|
|
65
|
+
render,
|
|
66
|
+
children,
|
|
67
|
+
...otherProps
|
|
68
|
+
} = props;
|
|
69
|
+
const videoClassName = backgroundVideoVariants({ class: className });
|
|
70
|
+
const rendered = useRender({
|
|
71
|
+
render,
|
|
72
|
+
props: {
|
|
73
|
+
autoPlay,
|
|
74
|
+
loop,
|
|
75
|
+
muted,
|
|
76
|
+
playsInline,
|
|
77
|
+
poster,
|
|
78
|
+
className: videoClassName,
|
|
79
|
+
...otherProps
|
|
80
|
+
},
|
|
81
|
+
defaultTagName: "video"
|
|
82
|
+
});
|
|
83
|
+
if (!render) {
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
"video",
|
|
86
|
+
{
|
|
87
|
+
autoPlay,
|
|
88
|
+
loop,
|
|
89
|
+
muted,
|
|
90
|
+
playsInline,
|
|
91
|
+
poster,
|
|
92
|
+
className: videoClassName,
|
|
93
|
+
...otherProps,
|
|
94
|
+
children: /* @__PURE__ */ jsx("source", { src, type })
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
return rendered;
|
|
99
|
+
}
|
|
100
|
+
BackgroundVideo.displayName = "Background.Video";
|
|
101
|
+
var backgroundStreamVariants = tv({
|
|
102
|
+
base: "absolute inset-0 size-full border-0 scale-[1.5] object-cover"
|
|
103
|
+
});
|
|
104
|
+
var BackgroundStream = React.forwardRef(
|
|
105
|
+
({
|
|
106
|
+
className,
|
|
107
|
+
videoId,
|
|
108
|
+
poster,
|
|
109
|
+
autoplay = true,
|
|
110
|
+
loop = true,
|
|
111
|
+
muted = true,
|
|
112
|
+
controls = false,
|
|
113
|
+
customerSubdomain,
|
|
114
|
+
title = "Background video",
|
|
115
|
+
...props
|
|
116
|
+
}, ref) => {
|
|
117
|
+
const baseUrl = customerSubdomain ? `https://${customerSubdomain}.cloudflarestream.com` : "https://iframe.videodelivery.net";
|
|
118
|
+
const params = new URLSearchParams();
|
|
119
|
+
if (autoplay) params.set("autoplay", "true");
|
|
120
|
+
if (loop) params.set("loop", "true");
|
|
121
|
+
if (muted) params.set("muted", "true");
|
|
122
|
+
if (!controls) params.set("controls", "false");
|
|
123
|
+
if (poster) params.set("poster", poster);
|
|
124
|
+
params.set("preload", "auto");
|
|
125
|
+
const streamUrl = `${baseUrl}/${videoId}?${params.toString()}`;
|
|
126
|
+
return /* @__PURE__ */ jsx(
|
|
127
|
+
"iframe",
|
|
128
|
+
{
|
|
129
|
+
ref,
|
|
130
|
+
src: streamUrl,
|
|
131
|
+
title,
|
|
132
|
+
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
133
|
+
allowFullScreen: true,
|
|
134
|
+
className: backgroundStreamVariants({ class: className }),
|
|
135
|
+
...props
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
BackgroundStream.displayName = "Background.Stream";
|
|
141
|
+
var backgroundOverlayVariants = tv({
|
|
142
|
+
base: "absolute inset-0 bg-bg-overlay"
|
|
143
|
+
});
|
|
144
|
+
var BackgroundOverlay = React.forwardRef(({ className, opacity = 0.4, style, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
ref,
|
|
148
|
+
"aria-hidden": "true",
|
|
149
|
+
className: backgroundOverlayVariants({ class: className }),
|
|
150
|
+
style: {
|
|
151
|
+
opacity,
|
|
152
|
+
...style
|
|
153
|
+
},
|
|
154
|
+
...props
|
|
155
|
+
}
|
|
156
|
+
));
|
|
157
|
+
BackgroundOverlay.displayName = "Background.Overlay";
|
|
158
|
+
var backgroundGradientVariants = tv({
|
|
159
|
+
base: "absolute inset-0"
|
|
160
|
+
});
|
|
161
|
+
var BackgroundGradient = React.forwardRef(
|
|
162
|
+
({
|
|
163
|
+
className,
|
|
164
|
+
direction = "to-b",
|
|
165
|
+
from = "transparent",
|
|
166
|
+
via,
|
|
167
|
+
to = "black",
|
|
168
|
+
gradient,
|
|
169
|
+
style,
|
|
170
|
+
...props
|
|
171
|
+
}, ref) => {
|
|
172
|
+
const cssDirection = direction.startsWith("to-") ? direction.replace("to-", "to ") : direction;
|
|
173
|
+
const gradientValue = gradient || (via ? `linear-gradient(${cssDirection}, ${from}, ${via}, ${to})` : `linear-gradient(${cssDirection}, ${from}, ${to})`);
|
|
174
|
+
return /* @__PURE__ */ jsx(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
ref,
|
|
178
|
+
"aria-hidden": "true",
|
|
179
|
+
className: backgroundGradientVariants({ class: className }),
|
|
180
|
+
style: {
|
|
181
|
+
backgroundImage: gradientValue,
|
|
182
|
+
...style
|
|
183
|
+
},
|
|
184
|
+
...props
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
BackgroundGradient.displayName = "Background.Gradient";
|
|
190
|
+
var BackgroundCompound = Object.assign(Background, {
|
|
191
|
+
Image: BackgroundImage,
|
|
192
|
+
Video: BackgroundVideo,
|
|
193
|
+
Stream: BackgroundStream,
|
|
194
|
+
Overlay: BackgroundOverlay,
|
|
195
|
+
Gradient: BackgroundGradient
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
export { BackgroundCompound as Background, BackgroundGradient, BackgroundImage, BackgroundOverlay, BackgroundStream, BackgroundVideo, backgroundGradientVariants, backgroundImageVariants, backgroundOverlayVariants, backgroundStreamVariants, backgroundVariants, backgroundVideoVariants };
|
|
199
|
+
//# sourceMappingURL=index.js.map
|
|
200
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/atoms/background/background.tsx"],"names":[],"mappings":";;;;;;AAUA,IAAM,qBAAqB,EAAA,CAAG;AAAA,EAC7B,IAAA,EAAM;AACP,CAAC;AAiBD,IAAM,UAAA,GAAmB,KAAA,CAAA,UAAA;AAAA,EACxB,CAAC,EAAE,SAAA,EAAW,UAAU,GAAG,KAAA,IAAS,GAAA,qBACnC,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,aAAA,EAAY,MAAA;AAAA,MACZ,SAAA,EAAW,kBAAA,CAAmB,EAAE,KAAA,EAAO,WAAW,CAAA;AAAA,MACjD,GAAG,KAAA;AAAA,MAEH;AAAA;AAA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AAA,CAAO,UAAA,EAAY;AAAA,EACpD,KAAA,EAAO,eAAA;AAAA,EACP,KAAA,EAAO,eAAA;AAAA,EACP,MAAA,EAAQ,gBAAA;AAAA,EACR,OAAA,EAAS,iBAAA;AAAA,EACT,QAAA,EAAU;AACX,CAAC","file":"index.js","sourcesContent":["\"use client\";\n\nimport { useRender } from \"@base-ui-components/react/use-render\";\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\n// =============================================================================\n// Background Atomic Component\n// =============================================================================\n\nconst backgroundVariants = tv({\n\tbase: \"absolute inset-0\",\n});\n\n/**\n * Base container for background composition.\n * Use as a wrapper to compose multiple background layers (image, video, overlay, gradient).\n *\n * @example\n * ```tsx\n * <Background>\n * <Background.Image src=\"/hero.jpg\" />\n * <Background.Overlay opacity={0.4} />\n * <Background.Gradient direction=\"to-t\" from=\"black\" to=\"transparent\" />\n * </Background>\n * ```\n */\nexport interface BackgroundProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst Background = React.forwardRef<HTMLDivElement, BackgroundProps>(\n\t({ className, children, ...props }, ref) => (\n\t\t<div\n\t\t\tref={ref}\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName={backgroundVariants({ class: className })}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nBackground.displayName = \"Background\";\n\n// =============================================================================\n// Background.Image\n// =============================================================================\n\nconst backgroundImageVariants = tv({\n\tbase: \"absolute inset-0 size-full object-cover\",\n});\n\nexport interface BackgroundImageProps\n\textends useRender.ComponentProps<\"img\">,\n\t\tOmit<React.ImgHTMLAttributes<HTMLImageElement>, \"src\" | \"render\"> {\n\t/**\n\t * URL for the background image\n\t */\n\tsrc: string;\n\t/**\n\t * Object position (default: \"center\")\n\t */\n\tposition?: string;\n}\n\n/**\n * Background image layer using an actual img element with object-cover.\n * Supports native lazy loading, srcset, and better accessibility.\n * Supports render prop for element composition.\n */\nfunction BackgroundImage(props: BackgroundImageProps) {\n\tconst {\n\t\tclassName,\n\t\tsrc,\n\t\tposition = \"center\",\n\t\talt = \"\",\n\t\tstyle,\n\t\trender,\n\t\t...otherProps\n\t} = props;\n\n\tconst imgClassName = backgroundImageVariants({ class: className });\n\tconst imgStyle = { objectPosition: position, ...style };\n\n\treturn useRender({\n\t\trender,\n\t\tprops: {\n\t\t\tsrc,\n\t\t\talt,\n\t\t\tclassName: imgClassName,\n\t\t\tstyle: imgStyle,\n\t\t\t...otherProps,\n\t\t},\n\t\tdefaultTagName: \"img\",\n\t});\n}\nBackgroundImage.displayName = \"Background.Image\";\n\n// =============================================================================\n// Background.Video\n// =============================================================================\n\nconst backgroundVideoVariants = tv({\n\tbase: \"absolute inset-0 size-full object-cover\",\n});\n\nexport interface BackgroundVideoProps\n\textends useRender.ComponentProps<\"video\">,\n\t\tOmit<\n\t\t\tReact.VideoHTMLAttributes<HTMLVideoElement>,\n\t\t\t\"children\" | \"render\" | \"src\"\n\t\t> {\n\t/**\n\t * URL for the video source\n\t */\n\tsrc: string;\n\t/**\n\t * Video MIME type (default: auto-detected from src)\n\t */\n\ttype?: string;\n\t/**\n\t * Poster image URL shown before video loads\n\t */\n\tposter?: string;\n}\n\n/**\n * Background video layer using HTML5 video element.\n * Supports render prop for element composition.\n */\nfunction BackgroundVideo(props: BackgroundVideoProps) {\n\tconst {\n\t\tclassName,\n\t\tsrc,\n\t\ttype,\n\t\tposter,\n\t\tautoPlay = true,\n\t\tloop = true,\n\t\tmuted = true,\n\t\tplaysInline = true,\n\t\trender,\n\t\tchildren,\n\t\t...otherProps\n\t} = props;\n\n\tconst videoClassName = backgroundVideoVariants({ class: className });\n\n\t// useRender must be called unconditionally\n\tconst rendered = useRender({\n\t\trender,\n\t\tprops: {\n\t\t\tautoPlay,\n\t\t\tloop,\n\t\t\tmuted,\n\t\t\tplaysInline,\n\t\t\tposter,\n\t\t\tclassName: videoClassName,\n\t\t\t...otherProps,\n\t\t},\n\t\tdefaultTagName: \"video\",\n\t});\n\n\t// If no render prop, return video with source child\n\tif (!render) {\n\t\treturn (\n\t\t\t<video\n\t\t\t\tautoPlay={autoPlay}\n\t\t\t\tloop={loop}\n\t\t\t\tmuted={muted}\n\t\t\t\tplaysInline={playsInline}\n\t\t\t\tposter={poster}\n\t\t\t\tclassName={videoClassName}\n\t\t\t\t{...otherProps}\n\t\t\t>\n\t\t\t\t<source src={src} type={type} />\n\t\t\t</video>\n\t\t);\n\t}\n\n\treturn rendered;\n}\nBackgroundVideo.displayName = \"Background.Video\";\n\n// =============================================================================\n// Background.Stream\n// =============================================================================\n\nconst backgroundStreamVariants = tv({\n\tbase: \"absolute inset-0 size-full border-0 scale-[1.5] object-cover\",\n});\n\nexport interface BackgroundStreamProps\n\textends React.IframeHTMLAttributes<HTMLIFrameElement> {\n\t/**\n\t * Cloudflare Stream video ID\n\t */\n\tvideoId: string;\n\t/**\n\t * Poster image URL (Cloudflare Stream thumbnail or custom)\n\t */\n\tposter?: string;\n\t/**\n\t * Whether the video should autoplay (default: true)\n\t */\n\tautoplay?: boolean;\n\t/**\n\t * Whether the video should loop (default: true)\n\t */\n\tloop?: boolean;\n\t/**\n\t * Whether the video should be muted (default: true)\n\t */\n\tmuted?: boolean;\n\t/**\n\t * Whether to show playback controls (default: false)\n\t */\n\tcontrols?: boolean;\n\t/**\n\t * Custom Cloudflare customer subdomain (if using custom domains)\n\t */\n\tcustomerSubdomain?: string;\n}\n\n/**\n * Background video layer using Cloudflare Stream.\n */\nconst BackgroundStream = React.forwardRef<\n\tHTMLIFrameElement,\n\tBackgroundStreamProps\n>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tvideoId,\n\t\t\tposter,\n\t\t\tautoplay = true,\n\t\t\tloop = true,\n\t\t\tmuted = true,\n\t\t\tcontrols = false,\n\t\t\tcustomerSubdomain,\n\t\t\ttitle = \"Background video\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst baseUrl = customerSubdomain\n\t\t\t? `https://${customerSubdomain}.cloudflarestream.com`\n\t\t\t: \"https://iframe.videodelivery.net\";\n\n\t\tconst params = new URLSearchParams();\n\t\tif (autoplay) params.set(\"autoplay\", \"true\");\n\t\tif (loop) params.set(\"loop\", \"true\");\n\t\tif (muted) params.set(\"muted\", \"true\");\n\t\tif (!controls) params.set(\"controls\", \"false\");\n\t\tif (poster) params.set(\"poster\", poster);\n\t\tparams.set(\"preload\", \"auto\");\n\n\t\tconst streamUrl = `${baseUrl}/${videoId}?${params.toString()}`;\n\n\t\treturn (\n\t\t\t<iframe\n\t\t\t\tref={ref}\n\t\t\t\tsrc={streamUrl}\n\t\t\t\ttitle={title}\n\t\t\t\tallow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\"\n\t\t\t\tallowFullScreen\n\t\t\t\tclassName={backgroundStreamVariants({ class: className })}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nBackgroundStream.displayName = \"Background.Stream\";\n\n// =============================================================================\n// Background.Overlay\n// =============================================================================\n\nconst backgroundOverlayVariants = tv({\n\tbase: \"absolute inset-0 bg-bg-overlay\",\n});\n\nexport interface BackgroundOverlayProps\n\textends React.HTMLAttributes<HTMLDivElement> {\n\t/**\n\t * Overlay opacity (0-1)\n\t */\n\topacity?: number;\n}\n\n/**\n * Solid color overlay layer. Uses semantic bg-overlay token by default.\n * Override with className for different colors.\n */\nconst BackgroundOverlay = React.forwardRef<\n\tHTMLDivElement,\n\tBackgroundOverlayProps\n>(({ className, opacity = 0.4, style, ...props }, ref) => (\n\t<div\n\t\tref={ref}\n\t\taria-hidden=\"true\"\n\t\tclassName={backgroundOverlayVariants({ class: className })}\n\t\tstyle={{\n\t\t\topacity,\n\t\t\t...style,\n\t\t}}\n\t\t{...props}\n\t/>\n));\nBackgroundOverlay.displayName = \"Background.Overlay\";\n\n// =============================================================================\n// Background.Gradient\n// =============================================================================\n\nconst backgroundGradientVariants = tv({\n\tbase: \"absolute inset-0\",\n});\n\nexport interface BackgroundGradientProps\n\textends React.HTMLAttributes<HTMLDivElement> {\n\t/**\n\t * Gradient direction (Tailwind convention: to-t, to-b, to-l, to-r, etc.)\n\t * Or CSS gradient direction (to top, to bottom, 45deg, etc.)\n\t */\n\tdirection?: string;\n\t/**\n\t * Starting color (from)\n\t */\n\tfrom?: string;\n\t/**\n\t * Optional middle color (via)\n\t */\n\tvia?: string;\n\t/**\n\t * Ending color (to)\n\t */\n\tto?: string;\n\t/**\n\t * Full custom gradient string (overrides from/via/to)\n\t */\n\tgradient?: string;\n}\n\n/**\n * Gradient overlay layer. Use for fading backgrounds or creating depth.\n */\nconst BackgroundGradient = React.forwardRef<\n\tHTMLDivElement,\n\tBackgroundGradientProps\n>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tdirection = \"to-b\",\n\t\t\tfrom = \"transparent\",\n\t\t\tvia,\n\t\t\tto = \"black\",\n\t\t\tgradient,\n\t\t\tstyle,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\t// Convert Tailwind-style direction to CSS\n\t\tconst cssDirection = direction.startsWith(\"to-\")\n\t\t\t? direction.replace(\"to-\", \"to \")\n\t\t\t: direction;\n\n\t\tconst gradientValue =\n\t\t\tgradient ||\n\t\t\t(via\n\t\t\t\t? `linear-gradient(${cssDirection}, ${from}, ${via}, ${to})`\n\t\t\t\t: `linear-gradient(${cssDirection}, ${from}, ${to})`);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName={backgroundGradientVariants({ class: className })}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundImage: gradientValue,\n\t\t\t\t\t...style,\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nBackgroundGradient.displayName = \"Background.Gradient\";\n\n// =============================================================================\n// Compound Export\n// =============================================================================\n\nconst BackgroundCompound = Object.assign(Background, {\n\tImage: BackgroundImage,\n\tVideo: BackgroundVideo,\n\tStream: BackgroundStream,\n\tOverlay: BackgroundOverlay,\n\tGradient: BackgroundGradient,\n});\n\nexport {\n\tBackgroundCompound as Background,\n\tBackgroundImage,\n\tBackgroundVideo,\n\tBackgroundStream,\n\tBackgroundOverlay,\n\tBackgroundGradient,\n\tbackgroundVariants,\n\tbackgroundImageVariants,\n\tbackgroundVideoVariants,\n\tbackgroundStreamVariants,\n\tbackgroundOverlayVariants,\n\tbackgroundGradientVariants,\n};\n"]}
|