@ugurdemirel/landcraft 0.1.16 → 0.1.18
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 +2 -3
- package/dist/cjs/components/Badge.cjs +1 -1
- package/dist/cjs/components/Badge.cjs.map +1 -1
- package/dist/cjs/components/Button.cjs +1 -1
- package/dist/cjs/components/Button.cjs.map +1 -1
- package/dist/cjs/components/CTA/variants/Inverse.cjs +1 -2
- package/dist/cjs/components/CTA/variants/Inverse.cjs.map +1 -1
- package/dist/cjs/components/CTA/variants/Panel.cjs +1 -2
- package/dist/cjs/components/CTA/variants/Panel.cjs.map +1 -1
- package/dist/cjs/components/Features/FeatureCard.cjs +1 -1
- package/dist/cjs/components/Features/FeatureCard.cjs.map +1 -1
- package/dist/cjs/components/Hero/variants/Statement.cjs +1 -2
- package/dist/cjs/components/Hero/variants/Statement.cjs.map +1 -1
- package/dist/cjs/components/MegaMenu/MegaMenu.cjs +1 -1
- package/dist/cjs/components/MegaMenu/MegaMenu.cjs.map +1 -1
- package/dist/cjs/components/Navbar/Navbar.cjs +1 -1
- package/dist/cjs/components/Navbar/Navbar.cjs.map +1 -1
- package/dist/cjs/components/Pricing/parts.cjs +1 -2
- package/dist/cjs/components/Pricing/parts.cjs.map +1 -1
- package/dist/cjs/components/Pricing/variants/Bento.cjs +1 -1
- package/dist/cjs/components/Pricing/variants/Bento.cjs.map +1 -1
- package/dist/cjs/components/Pricing/variants/Cards.cjs +1 -1
- package/dist/cjs/components/Pricing/variants/Cards.cjs.map +1 -1
- package/dist/cjs/components/Testimonials/TestimonialCard.cjs +1 -1
- package/dist/cjs/components/Testimonials/TestimonialCard.cjs.map +1 -1
- package/dist/cjs/components/Testimonials/variants/Carousel.cjs +1 -1
- package/dist/cjs/components/Testimonials/variants/Carousel.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/es/components/Badge.js +21 -17
- package/dist/es/components/Badge.js.map +1 -1
- package/dist/es/components/Button.js +29 -29
- package/dist/es/components/Button.js.map +1 -1
- package/dist/es/components/CTA/variants/Inverse.js +37 -42
- package/dist/es/components/CTA/variants/Inverse.js.map +1 -1
- package/dist/es/components/CTA/variants/Panel.js +51 -56
- package/dist/es/components/CTA/variants/Panel.js.map +1 -1
- package/dist/es/components/Features/FeatureCard.js +13 -14
- package/dist/es/components/Features/FeatureCard.js.map +1 -1
- package/dist/es/components/Hero/variants/Statement.js +37 -42
- package/dist/es/components/Hero/variants/Statement.js.map +1 -1
- package/dist/es/components/MegaMenu/MegaMenu.js +93 -88
- package/dist/es/components/MegaMenu/MegaMenu.js.map +1 -1
- package/dist/es/components/Navbar/Navbar.js +30 -26
- package/dist/es/components/Navbar/Navbar.js.map +1 -1
- package/dist/es/components/Pricing/parts.js +33 -34
- package/dist/es/components/Pricing/parts.js.map +1 -1
- package/dist/es/components/Pricing/variants/Bento.js +16 -17
- package/dist/es/components/Pricing/variants/Bento.js.map +1 -1
- package/dist/es/components/Pricing/variants/Cards.js +10 -11
- package/dist/es/components/Pricing/variants/Cards.js.map +1 -1
- package/dist/es/components/Testimonials/TestimonialCard.js +10 -11
- package/dist/es/components/Testimonials/TestimonialCard.js.map +1 -1
- package/dist/es/components/Testimonials/variants/Carousel.js +10 -11
- package/dist/es/components/Testimonials/variants/Carousel.js.map +1 -1
- package/dist/es/index.js +89 -93
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +8 -33
- package/dist/styles.css +0 -3
- package/package.json +1 -1
- package/dist/cjs/utils/contrast.cjs +0 -2
- package/dist/cjs/utils/contrast.cjs.map +0 -1
- package/dist/cjs/utils/useTokenForeground.cjs +0 -3
- package/dist/cjs/utils/useTokenForeground.cjs.map +0 -1
- package/dist/es/utils/contrast.js +0 -48
- package/dist/es/utils/contrast.js.map +0 -1
- package/dist/es/utils/useTokenForeground.js +0 -28
- package/dist/es/utils/useTokenForeground.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestimonialCard.js","sources":["../../../../src/components/Testimonials/TestimonialCard.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport {
|
|
1
|
+
{"version":3,"file":"TestimonialCard.js","sources":["../../../../src/components/Testimonials/TestimonialCard.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Quote, Star } from \"../../icons\";\nimport { initials } from \"./parts\";\nimport type { TestimonialCardProps } from \"./types\";\n\nexport const TestimonialCard = forwardRef<HTMLElement, TestimonialCardProps>(\n function TestimonialCard({ className, testimonial, ...props }, ref) {\n const { quote, author, role, company, avatar, accent, rating } = testimonial;\n const badgeStyle = accent\n ? { backgroundColor: accent, color: `contrast-color(${accent})` }\n : undefined;\n\n return (\n <figure\n ref={ref}\n className={cn(\n \"mb-4 flex flex-col break-inside-avoid rounded-2xl border border-border bg-surface p-7\",\n className,\n )}\n {...props}\n >\n <div className=\"mb-5 flex items-center justify-between\">\n <Quote className={cn(\"h-6 w-6\", accent ? undefined : \"text-primary/30\")} style={accent ? { color: accent } : undefined} />\n {rating ? (\n <span className=\"flex items-center gap-0.5 text-amber-500\" aria-label={`${rating} / 5`}>\n {Array.from({ length: 5 }).map((_, i) => (\n <Star key={i} className=\"h-3.5 w-3.5\" />\n ))}\n </span>\n ) : null}\n </div>\n <blockquote className=\"flex-1 text-[15px] leading-7 text-foreground/85\">{quote}</blockquote>\n <figcaption className=\"mt-6 flex items-center gap-3\">\n {avatar ? (\n avatar\n ) : (\n <span\n style={badgeStyle}\n className={cn(\n \"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-xs font-bold\",\n !accent && \"bg-primary-soft text-primary\",\n )}\n >\n {initials(author)}\n </span>\n )}\n <div>\n <div className=\"text-sm font-semibold text-foreground\">{author}</div>\n {(role || company) && (\n <div className=\"text-xs text-muted-foreground\">\n {[role, company].filter(Boolean).join(\" · \")}\n </div>\n )}\n </div>\n </figcaption>\n </figure>\n );\n },\n);"],"names":["TestimonialCard","forwardRef","className","testimonial","props","ref","quote","author","role","company","avatar","accent","rating","badgeStyle","jsxs","cn","jsx","Quote","_","i","Star"],"mappings":";;;;;AAMO,MAAMA,IAAkBC;AAAA,EAC7B,SAAyB,EAAE,WAAAC,GAAW,aAAAC,GAAa,GAAGC,EAAA,GAASC,GAAK;AAClE,UAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,GAAS,QAAAC,GAAQ,QAAAC,GAAQ,QAAAC,MAAWT,GAC3DU,IAAaF,IACf,EAAE,iBAAiBA,GAAQ,OAAO,kBAAkBA,CAAM,IAAA,IAC1D;AAEJ,WACE,gBAAAG;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAT;AAAA,QACA,WAAWU;AAAA,UACT;AAAA,UACAb;AAAA,QAAA;AAAA,QAED,GAAGE;AAAA,QAEJ,UAAA;AAAA,UAAA,gBAAAU,EAAC,OAAA,EAAI,WAAU,0CACb,UAAA;AAAA,YAAA,gBAAAE,EAACC,GAAA,EAAM,WAAWF,EAAG,WAAWJ,IAAS,SAAY,iBAAiB,GAAG,OAAOA,IAAS,EAAE,OAAOA,EAAA,IAAW,QAAW;AAAA,YACvHC,IACC,gBAAAI,EAAC,QAAA,EAAK,WAAU,4CAA2C,cAAY,GAAGJ,CAAM,QAC7E,UAAA,MAAM,KAAK,EAAE,QAAQ,EAAA,CAAG,EAAE,IAAI,CAACM,GAAGC,MACjC,gBAAAH,EAACI,GAAA,EAAa,WAAU,cAAA,GAAbD,CAA2B,CACvC,EAAA,CACH,IACE;AAAA,UAAA,GACN;AAAA,UACA,gBAAAH,EAAC,cAAA,EAAW,WAAU,mDAAmD,UAAAV,GAAM;AAAA,UAC/E,gBAAAQ,EAAC,cAAA,EAAW,WAAU,gCACnB,UAAA;AAAA,YAAAJ,KAGC,gBAAAM;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,OAAOH;AAAA,gBACP,WAAWE;AAAA,kBACT;AAAA,kBACA,CAACJ,KAAU;AAAA,gBAAA;AAAA,gBAGZ,YAASJ,CAAM;AAAA,cAAA;AAAA,YAAA;AAAA,8BAGnB,OAAA,EACC,UAAA;AAAA,cAAA,gBAAAS,EAAC,OAAA,EAAI,WAAU,yCAAyC,UAAAT,GAAO;AAAA,eAC7DC,KAAQC,MACR,gBAAAO,EAAC,OAAA,EAAI,WAAU,iCACZ,UAAA,CAACR,GAAMC,CAAO,EAAE,OAAO,OAAO,EAAE,KAAK,KAAK,EAAA,CAC7C;AAAA,YAAA,EAAA,CAEJ;AAAA,UAAA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as b, useState as g } from "react";
|
|
4
4
|
import { cn as i } from "../../../utils/cn.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const y = b(
|
|
5
|
+
import { Quote as x, ChevronLeft as h, ChevronRight as p } from "../../../icons.js";
|
|
6
|
+
import { initials as v } from "../parts.js";
|
|
7
|
+
const N = b(
|
|
9
8
|
({ className: d, items: o, ...u }, f) => {
|
|
10
|
-
const [a, l] = g(0), e = o[a % o.length], m = e.accent ? { backgroundColor: e.accent, color:
|
|
9
|
+
const [a, l] = g(0), e = o[a % o.length], m = e.accent ? { backgroundColor: e.accent, color: `contrast-color(${e.accent})` } : void 0, s = (c) => l((t) => (t + c + o.length) % o.length);
|
|
11
10
|
return /* @__PURE__ */ n("div", { className: i("mx-auto w-full max-w-3xl", d), ref: f, ...u, children: [
|
|
12
11
|
/* @__PURE__ */ n("figure", { className: "relative rounded-2xl border border-border bg-surface p-10 text-center sm:p-14", children: [
|
|
13
12
|
/* @__PURE__ */ r(
|
|
14
|
-
|
|
13
|
+
x,
|
|
15
14
|
{
|
|
16
15
|
className: i("mx-auto mb-6 h-8 w-8", e.accent ? void 0 : "text-primary/25"),
|
|
17
16
|
style: e.accent ? { color: e.accent } : void 0,
|
|
@@ -28,7 +27,7 @@ const y = b(
|
|
|
28
27
|
"inline-flex h-11 w-11 items-center justify-center rounded-full text-xs font-bold",
|
|
29
28
|
!e.accent && "bg-foreground text-background"
|
|
30
29
|
),
|
|
31
|
-
children:
|
|
30
|
+
children: v(e.author)
|
|
32
31
|
}
|
|
33
32
|
),
|
|
34
33
|
/* @__PURE__ */ n("div", { className: "text-left", children: [
|
|
@@ -45,7 +44,7 @@ const y = b(
|
|
|
45
44
|
"aria-label": "Previous testimonial",
|
|
46
45
|
onClick: () => s(-1),
|
|
47
46
|
className: "inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
48
|
-
children: /* @__PURE__ */ r(
|
|
47
|
+
children: /* @__PURE__ */ r(h, { className: "h-4 w-4" })
|
|
49
48
|
}
|
|
50
49
|
),
|
|
51
50
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: o.map((c, t) => /* @__PURE__ */ r(
|
|
@@ -69,15 +68,15 @@ const y = b(
|
|
|
69
68
|
"aria-label": "Next testimonial",
|
|
70
69
|
onClick: () => s(1),
|
|
71
70
|
className: "inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
72
|
-
children: /* @__PURE__ */ r(
|
|
71
|
+
children: /* @__PURE__ */ r(p, { className: "h-4 w-4" })
|
|
73
72
|
}
|
|
74
73
|
)
|
|
75
74
|
] })
|
|
76
75
|
] });
|
|
77
76
|
}
|
|
78
77
|
);
|
|
79
|
-
|
|
78
|
+
N.displayName = "TestimonialsCarousel";
|
|
80
79
|
export {
|
|
81
|
-
|
|
80
|
+
N as TestimonialsCarousel
|
|
82
81
|
};
|
|
83
82
|
//# sourceMappingURL=Carousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.js","sources":["../../../../../src/components/Testimonials/variants/Carousel.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, useState, type HTMLAttributes } from \"react\";\nimport { cn } from \"../../../utils/cn\";\nimport {
|
|
1
|
+
{"version":3,"file":"Carousel.js","sources":["../../../../../src/components/Testimonials/variants/Carousel.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, useState, type HTMLAttributes } from \"react\";\nimport { cn } from \"../../../utils/cn\";\nimport { ChevronLeft, ChevronRight, Quote } from \"../../../icons\";\nimport { initials } from \"../parts\";\nimport type { Testimonial } from \"../types\";\n\ninterface CarouselProps extends HTMLAttributes<HTMLDivElement> {\n items: Testimonial[];\n}\n\nexport const TestimonialsCarousel = forwardRef<HTMLDivElement, CarouselProps>(\n ({ className, items, ...props }, ref) => {\n const [index, setIndex] = useState(0);\n const item = items[index % items.length];\n const badgeStyle = item.accent\n ? { backgroundColor: item.accent, color: `contrast-color(${item.accent})` }\n : undefined;\n\n const go = (dir: 1 | -1) => setIndex((i) => (i + dir + items.length) % items.length);\n\n return (\n <div className={cn(\"mx-auto w-full max-w-3xl\", className)} ref={ref} {...props}>\n <figure className=\"relative rounded-2xl border border-border bg-surface p-10 text-center sm:p-14\">\n <Quote\n className={cn(\"mx-auto mb-6 h-8 w-8\", item.accent ? undefined : \"text-primary/25\")}\n style={item.accent ? { color: item.accent } : undefined}\n aria-hidden\n />\n <blockquote className=\"font-display text-balance text-xl font-medium leading-relaxed tracking-tight text-foreground sm:text-2xl\">\n {item.quote}\n </blockquote>\n <figcaption className=\"mt-8 flex items-center justify-center gap-3\">\n {item.avatar ? (\n item.avatar\n ) : (\n <span\n style={badgeStyle}\n className={cn(\n \"inline-flex h-11 w-11 items-center justify-center rounded-full text-xs font-bold\",\n !item.accent && \"bg-foreground text-background\",\n )}\n >\n {initials(item.author)}\n </span>\n )}\n <div className=\"text-left\">\n <div className=\"text-sm font-semibold text-foreground\">{item.author}</div>\n <div className=\"text-xs text-muted-foreground\">\n {[item.role, item.company].filter(Boolean).join(\" · \")}\n </div>\n </div>\n </figcaption>\n </figure>\n\n <div className=\"mt-6 flex items-center justify-center gap-4\">\n <button\n type=\"button\"\n aria-label=\"Previous testimonial\"\n onClick={() => go(-1)}\n className=\"inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </button>\n <div className=\"flex items-center gap-1.5\">\n {items.map((_, i) => (\n <button\n key={i}\n type=\"button\"\n aria-label={`Testimonial ${i + 1}`}\n aria-current={i === index}\n onClick={() => setIndex(i)}\n className={cn(\n \"h-1.5 cursor-pointer rounded-full transition-all duration-200\",\n i === index ? \"w-6 bg-foreground\" : \"w-1.5 bg-foreground/25 hover:bg-foreground/50\",\n )}\n />\n ))}\n </div>\n <button\n type=\"button\"\n aria-label=\"Next testimonial\"\n onClick={() => go(1)}\n className=\"inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-border bg-surface text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <ChevronRight className=\"h-4 w-4\" />\n </button>\n </div>\n </div>\n );\n },\n);\nTestimonialsCarousel.displayName = \"TestimonialsCarousel\";"],"names":["TestimonialsCarousel","forwardRef","className","items","props","ref","index","setIndex","useState","item","badgeStyle","go","dir","i","jsxs","cn","jsx","Quote","initials","ChevronLeft","_","ChevronRight"],"mappings":";;;;;AAWO,MAAMA,IAAuBC;AAAA,EAClC,CAAC,EAAE,WAAAC,GAAW,OAAAC,GAAO,GAAGC,EAAA,GAASC,MAAQ;AACvC,UAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAS,CAAC,GAC9BC,IAAON,EAA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AA,MAEA,gBAAAK,EAAC,OAAA,EAAI,WAAU,+CACb,UAAA;AAAA,QAAA,gBAAAE;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,SAAS,MAAML,EAAG,EAAE;AAAA,YACpB,WAAU;AAAA,YAEV,UAAA,gBAAAK,EAACG,GAAA,EAAY,WAAU,UAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEnC,gBAAAH,EAAC,SAAI,WAAU,6BACZ,YAAM,IAAI,CAACI,GAAGP,MACb,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,MAAK;AAAA,YACL,cAAY,eAAeH,IAAI,CAAC;AAAA,YAChC,gBAAcA,MAAMP;AAAA,YACpB,SAAS,MAAMC,EAASM,CAAC;AAAA,YACzB,WAAWE;AAAA,cACT;AAAA,cACAF,MAAMP,IAAQ,sBAAsB;AAAA,YAAA;AAAA,UACtC;AAAA,UARKO;AAAA,QAAA,CAUR,GACH;AAAA,QACA,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,SAAS,MAAML,EAAG,CAAC;AAAA,YACnB,WAAU;AAAA,YAEV,UAAA,gBAAAK,EAACK,GAAA,EAAa,WAAU,UAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACpC,EAAA,CACF;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AACArB,EAAqB,cAAc;"}
|
package/dist/es/index.js
CHANGED
|
@@ -1,110 +1,106 @@
|
|
|
1
1
|
import { Button as e } from "./components/Button.js";
|
|
2
2
|
import { Slot as a } from "./components/Slot.js";
|
|
3
3
|
import { Badge as m } from "./components/Badge.js";
|
|
4
|
-
import { Card as f, CardContent as n, CardDescription as i, CardFooter as
|
|
5
|
-
import { Section as
|
|
4
|
+
import { Card as f, CardContent as n, CardDescription as i, CardFooter as l, CardHeader as C, CardTitle as d } from "./components/Card.js";
|
|
5
|
+
import { Section as s, SectionHeader as S } from "./components/Section.js";
|
|
6
6
|
import { Modal as h } from "./components/Modal.js";
|
|
7
7
|
import { Prose as w, ProseLead as k } from "./components/Prose.js";
|
|
8
|
-
import { Container as
|
|
9
|
-
import { cn as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { TestimonialCard as _o } from "./components/Testimonials/TestimonialCard.js";
|
|
32
|
-
import { Testimonials as or } from "./components/Testimonials/Testimonials.js";
|
|
8
|
+
import { Container as F, Stack as L } from "./components/Container.js";
|
|
9
|
+
import { cn as P } from "./utils/cn.js";
|
|
10
|
+
import { iso2ToFlagEmoji as D } from "./utils/iso2Flag.js";
|
|
11
|
+
import { ArrowDown as v, ArrowRight as R, ArrowUp as b, ArrowUpRight as G, BarChart as H, Box as U, Check as y, ChevronDown as E, ChevronLeft as N, ChevronRight as Q, Clock as j, Code as X, Cpu as Z, Database as q, DollarSign as z, ExternalLink as I, Gauge as J, Globe as K, Layers as O, Lock as V, Mail as W, Menu as Y, Palette as _, Play as $, Plus as oo, Quote as ro, Rocket as eo, Send as to, ShieldCheck as ao, Sliders as po, Smartphone as mo, Star as xo, Terminal as fo, Users as no, X as io, Zap as lo } from "./icons.js";
|
|
12
|
+
import { AccordionShowcase as co } from "./components/AccordionShowcase/AccordionShowcase.js";
|
|
13
|
+
import { BlogCard as So } from "./components/Blog/BlogCard.js";
|
|
14
|
+
import { BlogSection as ho } from "./components/Blog/BlogSection.js";
|
|
15
|
+
import { CTA as wo } from "./components/CTA/CTA.js";
|
|
16
|
+
import { FAQ as Ao } from "./components/FAQ/FAQ.js";
|
|
17
|
+
import { FeatureCard as Lo } from "./components/Features/FeatureCard.js";
|
|
18
|
+
import { FeatureGrid as Po } from "./components/Features/FeatureGrid.js";
|
|
19
|
+
import { FeatureShowcase as Do } from "./components/FeatureShowcase/FeatureShowcase.js";
|
|
20
|
+
import { Footer as vo } from "./components/Footer/Footer.js";
|
|
21
|
+
import { Hero as bo } from "./components/Hero/Hero.js";
|
|
22
|
+
import { LanguageSwitcher as Ho } from "./components/LanguageSwitcher/LanguageSwitcher.js";
|
|
23
|
+
import { LogoCloud as yo } from "./components/LogoCloud/LogoCloud.js";
|
|
24
|
+
import { MegaMenu as No } from "./components/MegaMenu/MegaMenu.js";
|
|
25
|
+
import { Navbar as jo } from "./components/Navbar/Navbar.js";
|
|
26
|
+
import { Newsletter as Zo } from "./components/Newsletter/Newsletter.js";
|
|
27
|
+
import { Pricing as zo } from "./components/Pricing/Pricing.js";
|
|
28
|
+
import { Stats as Jo } from "./components/Stats/Stats.js";
|
|
29
|
+
import { TestimonialCard as Oo } from "./components/Testimonials/TestimonialCard.js";
|
|
30
|
+
import { Testimonials as Wo } from "./components/Testimonials/Testimonials.js";
|
|
33
31
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
co as AccordionShowcase,
|
|
33
|
+
v as ArrowDown,
|
|
34
|
+
R as ArrowRight,
|
|
35
|
+
b as ArrowUp,
|
|
36
|
+
G as ArrowUpRight,
|
|
39
37
|
m as Badge,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
H as BarChart,
|
|
39
|
+
So as BlogCard,
|
|
40
|
+
ho as BlogSection,
|
|
41
|
+
U as Box,
|
|
44
42
|
e as Button,
|
|
45
|
-
|
|
43
|
+
wo as CTA,
|
|
46
44
|
f as Card,
|
|
47
45
|
n as CardContent,
|
|
48
46
|
i as CardDescription,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
47
|
+
l as CardFooter,
|
|
48
|
+
C as CardHeader,
|
|
49
|
+
d as CardTitle,
|
|
50
|
+
y as Check,
|
|
51
|
+
E as ChevronDown,
|
|
52
|
+
N as ChevronLeft,
|
|
53
|
+
Q as ChevronRight,
|
|
54
|
+
j as Clock,
|
|
55
|
+
X as Code,
|
|
56
|
+
F as Container,
|
|
57
|
+
Z as Cpu,
|
|
58
|
+
q as Database,
|
|
59
|
+
z as DollarSign,
|
|
60
|
+
I as ExternalLink,
|
|
61
|
+
Ao as FAQ,
|
|
62
|
+
Lo as FeatureCard,
|
|
63
|
+
Po as FeatureGrid,
|
|
64
|
+
Do as FeatureShowcase,
|
|
65
|
+
vo as Footer,
|
|
66
|
+
J as Gauge,
|
|
67
|
+
K as Globe,
|
|
68
|
+
bo as Hero,
|
|
69
|
+
Ho as LanguageSwitcher,
|
|
70
|
+
O as Layers,
|
|
71
|
+
V as Lock,
|
|
72
|
+
yo as LogoCloud,
|
|
73
|
+
W as Mail,
|
|
74
|
+
No as MegaMenu,
|
|
75
|
+
Y as Menu,
|
|
78
76
|
h as Modal,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
jo as Navbar,
|
|
78
|
+
Zo as Newsletter,
|
|
79
|
+
_ as Palette,
|
|
80
|
+
$ as Play,
|
|
81
|
+
oo as Plus,
|
|
82
|
+
zo as Pricing,
|
|
85
83
|
w as Prose,
|
|
86
84
|
k as ProseLead,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
ro as Quote,
|
|
86
|
+
eo as Rocket,
|
|
87
|
+
s as Section,
|
|
88
|
+
S as SectionHeader,
|
|
89
|
+
to as Send,
|
|
90
|
+
ao as ShieldCheck,
|
|
91
|
+
po as Sliders,
|
|
94
92
|
a as Slot,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
D as
|
|
107
|
-
b as iso2ToFlagEmoji,
|
|
108
|
-
v as useTokenForeground
|
|
93
|
+
mo as Smartphone,
|
|
94
|
+
L as Stack,
|
|
95
|
+
xo as Star,
|
|
96
|
+
Jo as Stats,
|
|
97
|
+
fo as Terminal,
|
|
98
|
+
Oo as TestimonialCard,
|
|
99
|
+
Wo as Testimonials,
|
|
100
|
+
no as Users,
|
|
101
|
+
io as X,
|
|
102
|
+
lo as Zap,
|
|
103
|
+
P as cn,
|
|
104
|
+
D as iso2ToFlagEmoji
|
|
109
105
|
};
|
|
110
106
|
//# sourceMappingURL=index.js.map
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -160,23 +160,6 @@ export declare function cn(...inputs: ClassValue[]): string;
|
|
|
160
160
|
|
|
161
161
|
export declare const Code: (props: IconProps) => JSX_2.Element;
|
|
162
162
|
|
|
163
|
-
/**
|
|
164
|
-
* Contrast utilities.
|
|
165
|
-
*
|
|
166
|
-
* The library ships paired semantic tokens (e.g. --color-primary /
|
|
167
|
-
* --color-on-primary) so explicit pairings stay safe. For the few places where
|
|
168
|
-
* a *dynamic* color paints a background (a `customColor` prop, a token-based
|
|
169
|
-
* highlight card...) we pick the text color that yields the **best WCAG
|
|
170
|
-
* contrast ratio** at runtime.
|
|
171
|
-
*
|
|
172
|
-
* Inputs may be hex colors, bare RGB channels ("21 128 61"), rgb() functions
|
|
173
|
-
* (`rgb(21 128 61 / 0.95)`) or CSS variable references
|
|
174
|
-
* (`rgb(var(--color-primary) / 0.85)`). Variable references are resolved
|
|
175
|
-
* against the live stylesheet before computing luminance, so a re-themed
|
|
176
|
-
* palette never produces a low-contrast combination.
|
|
177
|
-
*/
|
|
178
|
-
export declare type ColorInput = string;
|
|
179
|
-
|
|
180
163
|
/**
|
|
181
164
|
* Shared layout wrapper — the single source of the container + gutter rules
|
|
182
165
|
* used across Section, Footer, CTA, templates…
|
|
@@ -341,15 +324,6 @@ export declare interface FooterProps extends Omit<HTMLAttributes<HTMLElement>, "
|
|
|
341
324
|
|
|
342
325
|
export declare const Gauge: (props: IconProps) => JSX_2.Element;
|
|
343
326
|
|
|
344
|
-
/**
|
|
345
|
-
* Returns the more readable of the two candidate text colors for a given
|
|
346
|
-
* background. Both candidates are evaluated with the WCAG contrast formula and
|
|
347
|
-
* the winning (highest ratio) color is returned — not a fixed luminance
|
|
348
|
-
* breakpoint — so mid-luminance backgrounds (amber, pastels, light violet…)
|
|
349
|
-
* always fall on the correct side.
|
|
350
|
-
*/
|
|
351
|
-
export declare function getContrastText(bg: ColorInput, light?: string, dark?: string): string;
|
|
352
|
-
|
|
353
327
|
export declare const Globe: (props: IconProps) => JSX_2.Element;
|
|
354
328
|
|
|
355
329
|
export declare const Hero: ForwardRefExoticComponent<HeroProps & RefAttributes<HTMLElement>>;
|
|
@@ -460,6 +434,8 @@ export declare interface MegaMenuFeatured {
|
|
|
460
434
|
cta?: string;
|
|
461
435
|
/** Background color for the card; glyph text color is computed for contrast. */
|
|
462
436
|
accent?: string;
|
|
437
|
+
/** When true, the card opens in a new tab (`target="_blank"` with `rel="noopener noreferrer"`). */
|
|
438
|
+
external?: boolean;
|
|
463
439
|
}
|
|
464
440
|
|
|
465
441
|
export declare interface MegaMenuItem {
|
|
@@ -471,12 +447,16 @@ export declare interface MegaMenuItem {
|
|
|
471
447
|
featured?: MegaMenuFeatured;
|
|
472
448
|
/** Small pill rendered next to the trigger label. */
|
|
473
449
|
badge?: string;
|
|
450
|
+
/** When true, a plain link item opens in a new tab (`target="_blank"` with `rel="noopener noreferrer"`). */
|
|
451
|
+
external?: boolean;
|
|
474
452
|
}
|
|
475
453
|
|
|
476
454
|
export declare interface MegaMenuLink {
|
|
477
455
|
label: string;
|
|
478
456
|
href: string;
|
|
479
457
|
description?: string;
|
|
458
|
+
/** When true, the link opens in a new tab (`target="_blank"` with `rel="noopener noreferrer"`). */
|
|
459
|
+
external?: boolean;
|
|
480
460
|
}
|
|
481
461
|
|
|
482
462
|
export declare interface MegaMenuProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
@@ -559,6 +539,8 @@ declare type NavbarVariant = "classic" | "floating" | "inverse";
|
|
|
559
539
|
export declare interface NavLink {
|
|
560
540
|
label: string;
|
|
561
541
|
href: string;
|
|
542
|
+
/** When true, the link opens in a new tab (`target="_blank"` with `rel="noopener noreferrer"`). */
|
|
543
|
+
external?: boolean;
|
|
562
544
|
}
|
|
563
545
|
|
|
564
546
|
export declare const Newsletter: {
|
|
@@ -745,13 +727,6 @@ export declare interface TestimonialsProps extends HTMLAttributes<HTMLDivElement
|
|
|
745
727
|
|
|
746
728
|
export declare const Users: (props: IconProps) => JSX_2.Element;
|
|
747
729
|
|
|
748
|
-
/**
|
|
749
|
-
* Reads a `--color-*` token from the live stylesheet and returns a text color
|
|
750
|
-
* that is always readable against it. Recomputes whenever the palette changes
|
|
751
|
-
* at runtime (e.g. the Storybook theme switcher or an app-level theme swap).
|
|
752
|
-
*/
|
|
753
|
-
export declare function useTokenForeground(variable: string, fallback?: string): string;
|
|
754
|
-
|
|
755
730
|
export declare const X: (props: IconProps) => JSX_2.Element;
|
|
756
731
|
|
|
757
732
|
export declare const Zap: (props: IconProps) => JSX_2.Element;
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(n){return typeof window>"u"?"":window.getComputedStyle(document.documentElement).getPropertyValue(n).trim()}function d(n){let t=n;const r=t.match(/var\(--[\w-]+/g)??[];for(const e of r){const o=e.replace(/^var\(/,""),a=m(o);a&&(t=t.split(e).join(a))}return t}function p(n){var s;let t=n.trim();if(/^#([0-9a-f]{3}){1,2}$/i.test(t))return t.length===4&&(t="#"+t.slice(1).split("").map(c=>c+c).join("")),{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16)};const o=((s=d(t).replace(/[()/;,]/g," ").match(/-?\d+(\.\d+)?/g))==null?void 0:s.map(Number))??[];if(o.length<3)return null;const[a,u,f]=o;return{r:Math.max(0,Math.min(255,Math.round(a))),g:Math.max(0,Math.min(255,Math.round(u))),b:Math.max(0,Math.min(255,Math.round(f)))}}function i(n){const t=p(n);if(!t)return 0;const r=[t.r,t.g,t.b].map(e=>e/255).map(e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return .2126*r[0]+.7152*r[1]+.0722*r[2]}function l(n,t){const[r,e]=n>t?[n,t]:[t,n];return(r+.05)/(e+.05)}function g(n,t="#ffffff",r="#0f172a"){const e=i(n),o=i(t),a=i(r);return l(e,o)>=l(e,a)?t:r}exports.getContrastText=g;
|
|
2
|
-
//# sourceMappingURL=contrast.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contrast.cjs","sources":["../../../src/utils/contrast.ts"],"sourcesContent":["/**\n * Contrast utilities.\n *\n * The library ships paired semantic tokens (e.g. --color-primary /\n * --color-on-primary) so explicit pairings stay safe. For the few places where\n * a *dynamic* color paints a background (a `customColor` prop, a token-based\n * highlight card...) we pick the text color that yields the **best WCAG\n * contrast ratio** at runtime.\n *\n * Inputs may be hex colors, bare RGB channels (\"21 128 61\"), rgb() functions\n * (`rgb(21 128 61 / 0.95)`) or CSS variable references\n * (`rgb(var(--color-primary) / 0.85)`). Variable references are resolved\n * against the live stylesheet before computing luminance, so a re-themed\n * palette never produces a low-contrast combination.\n */\n\nexport type ColorInput = string;\n\nfunction readVariable(name: string): string {\n if (typeof window === \"undefined\") return \"\";\n return window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(name)\n .trim();\n}\n\n/** Resolve `var(--x)` references against the live stylesheet. */\nfunction resolveVars(input: string): string {\n let str = input;\n const refs = str.match(/var\\(--[\\w-]+/g) ?? [];\n for (const ref of refs) {\n const name = ref.replace(/^var\\(/, \"\");\n const resolved = readVariable(name);\n if (resolved) str = str.split(ref).join(resolved);\n }\n return str;\n}\n\ninterface RGB {\n r: number;\n g: number;\n b: number;\n}\n\nfunction channels(color: ColorInput): RGB | null {\n let str = color.trim();\n\n if (/^#([0-9a-f]{3}){1,2}$/i.test(str)) {\n if (str.length === 4) {\n str =\n \"#\" +\n str\n .slice(1)\n .split(\"\")\n .map((c) => c + c)\n .join(\"\");\n }\n return {\n r: parseInt(str.slice(1, 3), 16),\n g: parseInt(str.slice(3, 5), 16),\n b: parseInt(str.slice(5, 7), 16),\n };\n }\n\n const resolved = resolveVars(str);\n\n // Normalize rgb()/rgba() separators (\"r g b / a\", \"r, g, b\") and bare channels.\n const normalized = resolved.replace(/[()/;,]/g, \" \");\n const parts = normalized.match(/-?\\d+(\\.\\d+)?/g)?.map(Number) ?? [];\n if (parts.length < 3) return null;\n // Alpha (4th component) is ignored: these colors paint opaque surfaces and\n // mixing against an unknown backdrop can't be modelled reliably.\n const [r, g, b] = parts;\n return {\n r: Math.max(0, Math.min(255, Math.round(r))),\n g: Math.max(0, Math.min(255, Math.round(g))),\n b: Math.max(0, Math.min(255, Math.round(b))),\n };\n}\n\nfunction relativeLuminance(color: ColorInput): number {\n const c = channels(color);\n if (!c) return 0;\n const lin = [c.r, c.g, c.b]\n .map((v) => v / 255)\n .map((v) => (v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4)));\n return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2];\n}\n\nfunction contrastRatio(lumA: number, lumB: number): number {\n const [hi, lo] = lumA > lumB ? [lumA, lumB] : [lumB, lumA];\n return (hi + 0.05) / (lo + 0.05);\n}\n\n/**\n * Returns the more readable of the two candidate text colors for a given\n * background. Both candidates are evaluated with the WCAG contrast formula and\n * the winning (highest ratio) color is returned — not a fixed luminance\n * breakpoint — so mid-luminance backgrounds (amber, pastels, light violet…)\n * always fall on the correct side.\n */\nexport function getContrastText(bg: ColorInput, light = \"#ffffff\", dark = \"#0f172a\"): string {\n const lumBg = relativeLuminance(bg);\n const lumLight = relativeLuminance(light);\n const lumDark = relativeLuminance(dark);\n return contrastRatio(lumBg, lumLight) >= contrastRatio(lumBg, lumDark) ? light : dark;\n}"],"names":["readVariable","name","resolveVars","input","str","refs","ref","resolved","channels","color","parts","_a","r","g","b","relativeLuminance","c","lin","v","contrastRatio","lumA","lumB","hi","lo","getContrastText","bg","light","dark","lumBg","lumLight","lumDark"],"mappings":"gFAkBA,SAASA,EAAaC,EAAsB,CAC1C,OAAI,OAAO,OAAW,IAAoB,GACnC,OACJ,iBAAiB,SAAS,eAAe,EACzC,iBAAiBA,CAAI,EACrB,KAAA,CACL,CAGA,SAASC,EAAYC,EAAuB,CAC1C,IAAIC,EAAMD,EACV,MAAME,EAAOD,EAAI,MAAM,gBAAgB,GAAK,CAAA,EAC5C,UAAWE,KAAOD,EAAM,CACtB,MAAMJ,EAAOK,EAAI,QAAQ,SAAU,EAAE,EAC/BC,EAAWP,EAAaC,CAAI,EAC9BM,IAAUH,EAAMA,EAAI,MA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AAI,MAASA,EAAI,CAAC,EAAI,MAASA,EAAI,CAAC,CAC3D,CAEA,SAASE,EAAcC,EAAcC,EAAsB,CACzD,KAAM,CAACC,EAAIC,CAAE,EAAIH,EAAOC,EAAO,CAACD,EAAMC,CAAI,EAAI,CAACA,EAAMD,CAAI,EACzD,OAAQE,EAAK,MAASC,EAAK,IAC7B,CASO,SAASC,EAAgBC,EAAgBC,EAAQ,UAAWC,EAAO,UAAmB,CAC3F,MAAMC,EAAQb,EAAkBU,CAAE,EAC5BI,EAAWd,EAAkBW,CAAK,EAClCI,EAAUf,EAAkBY,CAAI,EACtC,OAAOR,EAAcS,EAAOC,CAAQ,GAAKV,EAAcS,EAAOE,CAAO,EAAIJ,EAAQC,CACnF"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),s=require("./contrast.cjs");function c(e){return typeof window>"u"?"":window.getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function f(e,n="#ffffff"){const[d,i]=u.useState(()=>{const t=c(e);return t?s.getContrastText(t):n});return u.useEffect(()=>{const t=()=>{const o=c(e);i(o?s.getContrastText(o):n)};t();const r=new MutationObserver(t);return r.observe(document.documentElement,{attributes:!0,attributeFilter:["style","class"]}),()=>r.disconnect()},[e,n]),d}exports.useTokenForeground=f;
|
|
3
|
-
//# sourceMappingURL=useTokenForeground.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTokenForeground.cjs","sources":["../../../src/utils/useTokenForeground.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { getContrastText } from \"./contrast\";\n\nfunction readChannel(variable: string): string {\n if (typeof window === \"undefined\") return \"\";\n return window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(variable)\n .trim();\n}\n\n/**\n * Reads a `--color-*` token from the live stylesheet and returns a text color\n * that is always readable against it. Recomputes whenever the palette changes\n * at runtime (e.g. the Storybook theme switcher or an app-level theme swap).\n */\nexport function useTokenForeground(variable: string, fallback = \"#ffffff\"): string {\n const [text, setText] = useState<string>(() => {\n const value = readChannel(variable);\n return value ? getContrastText(value) : fallback;\n });\n\n useEffect(() => {\n const update = () => {\n const value = readChannel(variable);\n setText(value ? getContrastText(value) : fallback);\n };\n update();\n const observer = new MutationObserver(update);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"style\", \"class\"],\n });\n return () => observer.disconnect();\n }, [variable, fallback]);\n\n return text;\n}"],"names":["readChannel","variable","useTokenForeground","fallback","text","setText","useState","value","getContrastText","useEffect","update","observer"],"mappings":"qIAIA,SAASA,EAAYC,EAA0B,CAC7C,OAAI,OAAO,OAAW,IAAoB,GACnC,OACJ,iBAAiB,SAAS,eAAe,EACzC,iBAAiBA,CAAQ,EACzB,KAAA,CACL,CAOO,SAASC,EAAmBD,EAAkBE,EAAW,UAAmB,CACjF,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAiB,IAAM,CAC7C,MAAMC,EAAQP,EAAYC,CAAQ,EAClC,OAAOM,EAAQC,EAAAA,gBAAgBD,CAAK,EAAIJ,CAC1C,CAAC,EAEDM,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAS,IAAM,CACnB,MAAMH,EAAQP,EAAYC,CAAQ,EAClCI,EAAQE,EAAQC,EAAAA,gBAAgBD,CAAK,EAAIJ,CAAQ,CACnD,EACAO,EAAA,EACA,MAAMC,EAAW,IAAI,iBAAiBD,CAAM,EAC5C,OAAAC,EAAS,QAAQ,SAAS,gBAAiB,CACzC,WAAY,GACZ,gBAAiB,CAAC,QAAS,OAAO,CAAA,CACnC,EACM,IAAMA,EAAS,WAAA,CACxB,EAAG,CAACV,EAAUE,CAAQ,CAAC,EAEhBC,CACT"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
function m(e) {
|
|
2
|
-
return typeof window > "u" ? "" : window.getComputedStyle(document.documentElement).getPropertyValue(e).trim();
|
|
3
|
-
}
|
|
4
|
-
function d(e) {
|
|
5
|
-
let t = e;
|
|
6
|
-
const r = t.match(/var\(--[\w-]+/g) ?? [];
|
|
7
|
-
for (const n of r) {
|
|
8
|
-
const o = n.replace(/^var\(/, ""), a = m(o);
|
|
9
|
-
a && (t = t.split(n).join(a));
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
}
|
|
13
|
-
function p(e) {
|
|
14
|
-
var s;
|
|
15
|
-
let t = e.trim();
|
|
16
|
-
if (/^#([0-9a-f]{3}){1,2}$/i.test(t))
|
|
17
|
-
return t.length === 4 && (t = "#" + t.slice(1).split("").map((c) => c + c).join("")), {
|
|
18
|
-
r: parseInt(t.slice(1, 3), 16),
|
|
19
|
-
g: parseInt(t.slice(3, 5), 16),
|
|
20
|
-
b: parseInt(t.slice(5, 7), 16)
|
|
21
|
-
};
|
|
22
|
-
const o = ((s = d(t).replace(/[()/;,]/g, " ").match(/-?\d+(\.\d+)?/g)) == null ? void 0 : s.map(Number)) ?? [];
|
|
23
|
-
if (o.length < 3) return null;
|
|
24
|
-
const [a, l, u] = o;
|
|
25
|
-
return {
|
|
26
|
-
r: Math.max(0, Math.min(255, Math.round(a))),
|
|
27
|
-
g: Math.max(0, Math.min(255, Math.round(l))),
|
|
28
|
-
b: Math.max(0, Math.min(255, Math.round(u)))
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function i(e) {
|
|
32
|
-
const t = p(e);
|
|
33
|
-
if (!t) return 0;
|
|
34
|
-
const r = [t.r, t.g, t.b].map((n) => n / 255).map((n) => n <= 0.03928 ? n / 12.92 : Math.pow((n + 0.055) / 1.055, 2.4));
|
|
35
|
-
return 0.2126 * r[0] + 0.7152 * r[1] + 0.0722 * r[2];
|
|
36
|
-
}
|
|
37
|
-
function f(e, t) {
|
|
38
|
-
const [r, n] = e > t ? [e, t] : [t, e];
|
|
39
|
-
return (r + 0.05) / (n + 0.05);
|
|
40
|
-
}
|
|
41
|
-
function h(e, t = "#ffffff", r = "#0f172a") {
|
|
42
|
-
const n = i(e), o = i(t), a = i(r);
|
|
43
|
-
return f(n, o) >= f(n, a) ? t : r;
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
h as getContrastText
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=contrast.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contrast.js","sources":["../../../src/utils/contrast.ts"],"sourcesContent":["/**\n * Contrast utilities.\n *\n * The library ships paired semantic tokens (e.g. --color-primary /\n * --color-on-primary) so explicit pairings stay safe. For the few places where\n * a *dynamic* color paints a background (a `customColor` prop, a token-based\n * highlight card...) we pick the text color that yields the **best WCAG\n * contrast ratio** at runtime.\n *\n * Inputs may be hex colors, bare RGB channels (\"21 128 61\"), rgb() functions\n * (`rgb(21 128 61 / 0.95)`) or CSS variable references\n * (`rgb(var(--color-primary) / 0.85)`). Variable references are resolved\n * against the live stylesheet before computing luminance, so a re-themed\n * palette never produces a low-contrast combination.\n */\n\nexport type ColorInput = string;\n\nfunction readVariable(name: string): string {\n if (typeof window === \"undefined\") return \"\";\n return window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(name)\n .trim();\n}\n\n/** Resolve `var(--x)` references against the live stylesheet. */\nfunction resolveVars(input: string): string {\n let str = input;\n const refs = str.match(/var\\(--[\\w-]+/g) ?? [];\n for (const ref of refs) {\n const name = ref.replace(/^var\\(/, \"\");\n const resolved = readVariable(name);\n if (resolved) str = str.split(ref).join(resolved);\n }\n return str;\n}\n\ninterface RGB {\n r: number;\n g: number;\n b: number;\n}\n\nfunction channels(color: ColorInput): RGB | null {\n let str = color.trim();\n\n if (/^#([0-9a-f]{3}){1,2}$/i.test(str)) {\n if (str.length === 4) {\n str =\n \"#\" +\n str\n .slice(1)\n .split(\"\")\n .map((c) => c + c)\n .join(\"\");\n }\n return {\n r: parseInt(str.slice(1, 3), 16),\n g: parseInt(str.slice(3, 5), 16),\n b: parseInt(str.slice(5, 7), 16),\n };\n }\n\n const resolved = resolveVars(str);\n\n // Normalize rgb()/rgba() separators (\"r g b / a\", \"r, g, b\") and bare channels.\n const normalized = resolved.replace(/[()/;,]/g, \" \");\n const parts = normalized.match(/-?\\d+(\\.\\d+)?/g)?.map(Number) ?? [];\n if (parts.length < 3) return null;\n // Alpha (4th component) is ignored: these colors paint opaque surfaces and\n // mixing against an unknown backdrop can't be modelled reliably.\n const [r, g, b] = parts;\n return {\n r: Math.max(0, Math.min(255, Math.round(r))),\n g: Math.max(0, Math.min(255, Math.round(g))),\n b: Math.max(0, Math.min(255, Math.round(b))),\n };\n}\n\nfunction relativeLuminance(color: ColorInput): number {\n const c = channels(color);\n if (!c) return 0;\n const lin = [c.r, c.g, c.b]\n .map((v) => v / 255)\n .map((v) => (v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4)));\n return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2];\n}\n\nfunction contrastRatio(lumA: number, lumB: number): number {\n const [hi, lo] = lumA > lumB ? [lumA, lumB] : [lumB, lumA];\n return (hi + 0.05) / (lo + 0.05);\n}\n\n/**\n * Returns the more readable of the two candidate text colors for a given\n * background. Both candidates are evaluated with the WCAG contrast formula and\n * the winning (highest ratio) color is returned — not a fixed luminance\n * breakpoint — so mid-luminance backgrounds (amber, pastels, light violet…)\n * always fall on the correct side.\n */\nexport function getContrastText(bg: ColorInput, light = \"#ffffff\", dark = \"#0f172a\"): string {\n const lumBg = relativeLuminance(bg);\n const lumLight = relativeLuminance(light);\n const lumDark = relativeLuminance(dark);\n return contrastRatio(lumBg, lumLight) >= contrastRatio(lumBg, lumDark) ? light : dark;\n}"],"names":["readVariable","name","resolveVars","input","str","refs","ref","resolved","channels","color","_a","parts","r","g","b","relativeLuminance","c","lin","v","contrastRatio","lumA","lumB","hi","lo","getContrastText","bg","light","dark","lumBg","lumLight","lumDark"],"mappings":"AAkBA,SAASA,EAAaC,GAAsB;AAC1C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AAAA,IAC3C,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,MAAMC,CAAC,CAAC,CAAC;AAAA,EAAA;AAE/C;AAEA,SAASC,EAAkBN,GAA2B;AACpD,QAAMO,IAAIR,EAASC,CAAK;AACxB,MAAI,CAACO,EAAG,QAAO;AACf,QAAMC,IAAM,CAACD,EAAE,GAAGA,EAAE,GAAGA,EAAE,CAAC,EACvB,IAAI,CAACE,MAAMA,IAAI,GAAG,EAClB,IAAI,CAACA,MAAOA,KAAK,UAAUA,IAAI,QAAQ,KAAK,KAAKA,IAAI,SAAS,OAAO,GAAG,CAAE;AAC7E,SAAO,SAASD,EAAI,CAAC,IAAI,SAASA,EAAI,CAAC,IAAI,SAASA,EAAI,CAAC;AAC3D;AAEA,SAASE,EAAcC,GAAcC,GAAsB;AACzD,QAAM,CAACC,GAAIC,CAAE,IAAIH,IAAOC,IAAO,CAACD,GAAMC,CAAI,IAAI,CAACA,GAAMD,CAAI;AACzD,UAAQE,IAAK,SAASC,IAAK;AAC7B;AASO,SAASC,EAAgBC,GAAgBC,IAAQ,WAAWC,IAAO,WAAmB;AAC3F,QAAMC,IAAQb,EAAkBU,CAAE,GAC5BI,IAAWd,EAAkBW,CAAK,GAClCI,IAAUf,EAAkBY,CAAI;AACtC,SAAOR,EAAcS,GAAOC,CAAQ,KAAKV,EAAcS,GAAOE,CAAO,IAAIJ,IAAQC;AACnF;"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState as f, useEffect as i } from "react";
|
|
3
|
-
import { getContrastText as u } from "./contrast.js";
|
|
4
|
-
function s(t) {
|
|
5
|
-
return typeof window > "u" ? "" : window.getComputedStyle(document.documentElement).getPropertyValue(t).trim();
|
|
6
|
-
}
|
|
7
|
-
function w(t, n = "#ffffff") {
|
|
8
|
-
const [c, d] = f(() => {
|
|
9
|
-
const e = s(t);
|
|
10
|
-
return e ? u(e) : n;
|
|
11
|
-
});
|
|
12
|
-
return i(() => {
|
|
13
|
-
const e = () => {
|
|
14
|
-
const r = s(t);
|
|
15
|
-
d(r ? u(r) : n);
|
|
16
|
-
};
|
|
17
|
-
e();
|
|
18
|
-
const o = new MutationObserver(e);
|
|
19
|
-
return o.observe(document.documentElement, {
|
|
20
|
-
attributes: !0,
|
|
21
|
-
attributeFilter: ["style", "class"]
|
|
22
|
-
}), () => o.disconnect();
|
|
23
|
-
}, [t, n]), c;
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
w as useTokenForeground
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=useTokenForeground.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTokenForeground.js","sources":["../../../src/utils/useTokenForeground.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { getContrastText } from \"./contrast\";\n\nfunction readChannel(variable: string): string {\n if (typeof window === \"undefined\") return \"\";\n return window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(variable)\n .trim();\n}\n\n/**\n * Reads a `--color-*` token from the live stylesheet and returns a text color\n * that is always readable against it. Recomputes whenever the palette changes\n * at runtime (e.g. the Storybook theme switcher or an app-level theme swap).\n */\nexport function useTokenForeground(variable: string, fallback = \"#ffffff\"): string {\n const [text, setText] = useState<string>(() => {\n const value = readChannel(variable);\n return value ? getContrastText(value) : fallback;\n });\n\n useEffect(() => {\n const update = () => {\n const value = readChannel(variable);\n setText(value ? getContrastText(value) : fallback);\n };\n update();\n const observer = new MutationObserver(update);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"style\", \"class\"],\n });\n return () => observer.disconnect();\n }, [variable, fallback]);\n\n return text;\n}"],"names":["readChannel","variable","useTokenForeground","fallback","text","setText","useState","value","getContrastText","useEffect","update","observer"],"mappings":";;AAIA,SAASA,EAAYC,GAA0B;AAC7C,SAAI,OAAO,SAAW,MAAoB,KACnC,OACJ,iBAAiB,SAAS,eAAe,EACzC,iBAAiBA,CAAQ,EACzB,KAAA;AACL;AAOO,SAASC,EAAmBD,GAAkBE,IAAW,WAAmB;AACjF,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAiB,MAAM;AAC7C,UAAMC,IAAQP,EAAYC,CAAQ;AAClC,WAAOM,IAAQC,EAAgBD,CAAK,IAAIJ;AAAA,EAC1C,CAAC;AAED,SAAAM,EAAU,MAAM;AACd,UAAMC,IAAS,MAAM;AACnB,YAAMH,IAAQP,EAAYC,CAAQ;AAClC,MAAAI,EAAQE,IAAQC,EAAgBD,CAAK,IAAIJ,CAAQ;AAAA,IACnD;AACA,IAAAO,EAAA;AACA,UAAMC,IAAW,IAAI,iBAAiBD,CAAM;AAC5C,WAAAC,EAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAAC,SAAS,OAAO;AAAA,IAAA,CACnC,GACM,MAAMA,EAAS,WAAA;AAAA,EACxB,GAAG,CAACV,GAAUE,CAAQ,CAAC,GAEhBC;AACT;"}
|