@nextworks/blocks-core 0.2.0-alpha.0 → 0.2.0-alpha.2

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.
Files changed (37) hide show
  1. package/dist/components/AppProviders.client.d.ts +12 -0
  2. package/dist/components/AppProviders.client.d.ts.map +1 -0
  3. package/dist/components/AppProviders.client.js +12 -0
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -0
  7. package/dist-cjs/components/AppProviders.client.cjs +15 -0
  8. package/dist-cjs/components/AppProviders.server.cjs +10 -0
  9. package/dist-cjs/components/enhanced-theme-provider.cjs +142 -0
  10. package/dist-cjs/components/theme-provider.cjs +9 -0
  11. package/dist-cjs/index.cjs +51 -0
  12. package/dist-cjs/lib/themes.cjs +399 -0
  13. package/dist-cjs/lib/utils.cjs +8 -0
  14. package/dist-cjs/providers/BlocksAppProviders.cjs +14 -0
  15. package/dist-cjs/server/theme-vars.cjs +47 -0
  16. package/dist-cjs/server.cjs +10 -0
  17. package/dist-cjs/ui/alert-dialog.cjs +105 -0
  18. package/dist-cjs/ui/brand-node.cjs +46 -0
  19. package/dist-cjs/ui/button.cjs +108 -0
  20. package/dist-cjs/ui/card.cjs +54 -0
  21. package/dist-cjs/ui/checkbox.cjs +60 -0
  22. package/dist-cjs/ui/cta-button.cjs +53 -0
  23. package/dist-cjs/ui/dropdown-menu.cjs +122 -0
  24. package/dist-cjs/ui/feature-card.cjs +20 -0
  25. package/dist-cjs/ui/input.cjs +60 -0
  26. package/dist-cjs/ui/label.cjs +61 -0
  27. package/dist-cjs/ui/pricing-card.cjs +28 -0
  28. package/dist-cjs/ui/select.cjs +56 -0
  29. package/dist-cjs/ui/skeleton.cjs +20 -0
  30. package/dist-cjs/ui/switch.cjs +60 -0
  31. package/dist-cjs/ui/table.cjs +48 -0
  32. package/dist-cjs/ui/testimonial-card.cjs +39 -0
  33. package/dist-cjs/ui/textarea.cjs +60 -0
  34. package/dist-cjs/ui/theme-selector.cjs +92 -0
  35. package/dist-cjs/ui/theme-toggle.cjs +22 -0
  36. package/dist-cjs/ui/toaster.cjs +9 -0
  37. package/package.json +19 -6
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Skeleton = Skeleton;
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ const utils_1 = require("../lib/utils");
17
+ function Skeleton(_a) {
18
+ var { className } = _a, props = __rest(_a, ["className"]);
19
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, utils_1.cn)("bg-muted animate-pulse rounded-md", className) }, props)));
20
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __rest = (this && this.__rest) || function (s, e) {
36
+ var t = {};
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
+ t[p] = s[p];
39
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
+ t[p[i]] = s[p[i]];
43
+ }
44
+ return t;
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.Switch = void 0;
48
+ const jsx_runtime_1 = require("react/jsx-runtime");
49
+ const React = __importStar(require("react"));
50
+ const utils_1 = require("../lib/utils");
51
+ const Switch = React.forwardRef((_a, ref) => {
52
+ var { className, isLoading, disabled } = _a, props = __rest(_a, ["className", "isLoading", "disabled"]);
53
+ const checked = !!props.checked;
54
+ const isDisabled = !!disabled || !!isLoading;
55
+ return ((0, jsx_runtime_1.jsxs)("label", { className: (0, utils_1.cn)("focus-within:ring-offset-background inline-flex items-center rounded-full focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2", isDisabled ? "cursor-not-allowed opacity-80" : "cursor-pointer", className), children: [(0, jsx_runtime_1.jsx)("input", Object.assign({ type: "checkbox", role: "switch", ref: ref, className: "sr-only", disabled: isDisabled, "aria-busy": isLoading ? "true" : undefined }, props)), (0, jsx_runtime_1.jsxs)("span", { "aria-hidden": true, className: (0, utils_1.cn)("relative inline-flex h-6 w-11 flex-shrink-0 rounded-full transition-colors duration-200", checked ? "bg-[var(--primary)]" : "bg-[var(--primary)]/80"), children: [(0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)(
56
+ // Thumb should adjust for theme to guarantee contrast
57
+ "absolute top-0.5 left-0.5 h-5 w-5 transform rounded-full bg-[var(--switch-thumb)] shadow-md transition-transform duration-200 ease-in-out", checked ? "translate-x-5" : "translate-x-0") }), isLoading && ((0, jsx_runtime_1.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: (0, jsx_runtime_1.jsxs)("svg", { className: "h-4 w-4 animate-spin text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" })] }) }))] })] }));
58
+ });
59
+ exports.Switch = Switch;
60
+ Switch.displayName = "Switch";
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Table = Table;
15
+ exports.TableHeader = TableHeader;
16
+ exports.TableBody = TableBody;
17
+ exports.TableRow = TableRow;
18
+ exports.TableHead = TableHead;
19
+ exports.TableCell = TableCell;
20
+ exports.TableCaption = TableCaption;
21
+ const jsx_runtime_1 = require("react/jsx-runtime");
22
+ const utils_1 = require("../lib/utils");
23
+ function Table(_a) {
24
+ var { className } = _a, props = __rest(_a, ["className"]);
25
+ return ((0, jsx_runtime_1.jsx)("div", { className: "relative w-full overflow-auto", children: (0, jsx_runtime_1.jsx)("table", Object.assign({ className: (0, utils_1.cn)("w-full caption-bottom text-sm",
26
+ // Optional fg override
27
+ "text-[var(--table-fg)]", className) }, props)) }));
28
+ }
29
+ function TableHeader(props) {
30
+ return ((0, jsx_runtime_1.jsx)("thead", Object.assign({ className: (0, utils_1.cn)("[&_tr]:border-b",
31
+ // Variable hooks for border color and head text
32
+ "text-[var(--table-head-fg)] [&_tr]:border-[var(--table-border)]") }, props)));
33
+ }
34
+ function TableBody(props) {
35
+ return ((0, jsx_runtime_1.jsx)("tbody", Object.assign({ className: (0, utils_1.cn)("[&_tr:last-child]:border-0", "[&_tr]:border-[var(--table-border)]") }, props)));
36
+ }
37
+ function TableRow(props) {
38
+ return ((0, jsx_runtime_1.jsx)("tr", Object.assign({ className: (0, utils_1.cn)("hover:bg-muted/50 border-b transition-colors", "border-[var(--table-border)] hover:bg-[var(--table-row-hover-bg)]") }, props)));
39
+ }
40
+ function TableHead(props) {
41
+ return ((0, jsx_runtime_1.jsx)("th", Object.assign({ className: (0, utils_1.cn)("text-muted-foreground h-10 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0", "text-[var(--table-head-fg)]") }, props)));
42
+ }
43
+ function TableCell(props) {
44
+ return ((0, jsx_runtime_1.jsx)("td", Object.assign({ className: (0, utils_1.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0", "text-[var(--table-fg)]") }, props)));
45
+ }
46
+ function TableCaption(props) {
47
+ return ((0, jsx_runtime_1.jsx)("caption", Object.assign({ className: (0, utils_1.cn)("text-muted-foreground mt-4 text-sm", "text-[var(--table-muted-fg)]") }, props)));
48
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TestimonialCard = TestimonialCard;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const utils_1 = require("../lib/utils");
7
+ function getInitials(from) {
8
+ var _a, _b;
9
+ if (!from)
10
+ return undefined;
11
+ const parts = from.trim().split(/\s+/);
12
+ const first = ((_a = parts[0]) === null || _a === void 0 ? void 0 : _a[0]) || "";
13
+ const last = parts.length > 1 ? ((_b = parts[parts.length - 1]) === null || _b === void 0 ? void 0 : _b[0]) || "" : "";
14
+ const res = `${first}${last}`.toUpperCase();
15
+ return res || undefined;
16
+ }
17
+ function TestimonialCard({ id, className,
18
+ // legacy defaults
19
+ testimonialText = "Lorem ipsum dolor sit amet! Consectetur adipiscing elit.", testimonialAuthor = " - Cillum Dolore", testimonialAuthorInitials = "JD",
20
+ // new props (no defaults, we derive below)
21
+ quote, name, role, card = {
22
+ className: "bg-card text-card-foreground p-6 rounded-lg border border-border shadow-md transition-transform duration-200 hover:-translate-y-1 bg-[var(--card-bg)] text-[var(--card-fg)] border-[var(--card-border)] shadow-[var(--card-shadow)]",
23
+ }, content = {
24
+ className: "flex flex-col space-y-4",
25
+ }, text = {
26
+ className: "text-muted-foreground text-base leading-relaxed italic text-[var(--card-fg)]",
27
+ }, author = {
28
+ className: "text-muted-foreground text-sm font-medium text-[var(--card-muted-fg)]",
29
+ }, avatar = {
30
+ className: "w-12 h-12 bg-primary text-primary-foreground rounded-full flex items-center justify-center text-lg font-bold bg-[var(--badge-bg)] text-[var(--badge-fg)] border-[var(--badge-border)]",
31
+ }, avatarText = {
32
+ className: "text-white font-bold",
33
+ }, }) {
34
+ var _a;
35
+ const displayText = quote !== null && quote !== void 0 ? quote : testimonialText;
36
+ const computedAuthor = testimonialAuthor !== null && testimonialAuthor !== void 0 ? testimonialAuthor : (name ? ` - ${name}${role ? `, ${role}` : ""}` : " - Cillum Dolore");
37
+ const initials = (_a = testimonialAuthorInitials !== null && testimonialAuthorInitials !== void 0 ? testimonialAuthorInitials : getInitials(name)) !== null && _a !== void 0 ? _a : "JD";
38
+ return ((0, jsx_runtime_1.jsx)("div", { id: id, className: (0, utils_1.cn)(card.className, className), children: (0, jsx_runtime_1.jsxs)("div", { className: content.className, children: [(0, jsx_runtime_1.jsx)("div", { className: avatar.className, children: (0, jsx_runtime_1.jsx)("span", { className: avatarText.className, children: initials }) }), (0, jsx_runtime_1.jsxs)("p", { className: text.className, children: ["\u201C", displayText, "\u201D"] }), (0, jsx_runtime_1.jsx)("p", { className: author.className, children: computedAuthor })] }) }));
39
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __rest = (this && this.__rest) || function (s, e) {
36
+ var t = {};
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
+ t[p] = s[p];
39
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
+ t[p[i]] = s[p[i]];
43
+ }
44
+ return t;
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.Textarea = void 0;
48
+ const jsx_runtime_1 = require("react/jsx-runtime");
49
+ const React = __importStar(require("react"));
50
+ const utils_1 = require("../lib/utils");
51
+ const Textarea = React.forwardRef((_a, ref) => {
52
+ var { className } = _a, props = __rest(_a, ["className"]);
53
+ return ((0, jsx_runtime_1.jsx)("textarea", Object.assign({ className: (0, utils_1.cn)(
54
+ // Base structural + token fallbacks
55
+ "border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive/30 dark:aria-invalid:focus-visible:ring-destructive/40 flex min-h-[80px] w-full rounded-md border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
56
+ // CSS variable hooks (preset-first). When vars are unset, tokens above apply.
57
+ "border-[var(--input-border)] bg-[var(--input-bg)] text-[var(--input-fg)] placeholder:text-[var(--input-placeholder)] focus-visible:ring-[var(--input-focus-ring)] focus-visible:ring-offset-[var(--input-ring-offset)]", className), ref: ref }, props)));
58
+ });
59
+ exports.Textarea = Textarea;
60
+ Textarea.displayName = "Textarea";
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ "use client";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __rest = (this && this.__rest) || function (s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.ThemeSelector = ThemeSelector;
49
+ const jsx_runtime_1 = require("react/jsx-runtime");
50
+ const React = __importStar(require("react"));
51
+ const lucide_react_1 = require("lucide-react");
52
+ const next_themes_1 = require("next-themes");
53
+ const enhanced_theme_provider_1 = require("../components/enhanced-theme-provider");
54
+ const themes_1 = require("../lib/themes");
55
+ const button_1 = require("../ui/button");
56
+ const dropdown_menu_1 = require("../ui/dropdown-menu");
57
+ function ThemeSelector(_a) {
58
+ var _b, _c, _d;
59
+ var { ariaLabel = "Demo: Color theme", label = "Theme", className } = _a, buttonProps = __rest(_a, ["ariaLabel", "label", "className"]);
60
+ const { theme, setTheme } = (0, next_themes_1.useTheme)();
61
+ const { themeVariant, setThemeVariant, setCustomBrandColors } = (0, enhanced_theme_provider_1.useThemeVariant)();
62
+ const isDark = theme === "dark";
63
+ const [showCustom, setShowCustom] = React.useState(false);
64
+ const [custom, setCustom] = React.useState({});
65
+ function openCustomDialog() {
66
+ setCustom({});
67
+ setShowCustom(true);
68
+ }
69
+ function applyCustom() {
70
+ setCustomBrandColors(custom);
71
+ document.cookie = `theme-variant=custom; Path=/; Max-Age=31536000; SameSite=Lax`;
72
+ document.cookie = `theme-custom=${encodeURIComponent(JSON.stringify(custom))}; Path=/; Max-Age=31536000; SameSite=Lax`;
73
+ setShowCustom(false);
74
+ }
75
+ return ((0, jsx_runtime_1.jsxs)(dropdown_menu_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(button_1.Button, Object.assign({ variant: "outline", size: "sm", className: `gap-2 ${className !== null && className !== void 0 ? className : ""}`, "aria-label": ariaLabel }, buttonProps, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Palette, { className: "h-4 w-4" }), label] })) }), (0, jsx_runtime_1.jsxs)(dropdown_menu_1.DropdownMenuContent, { align: "end", className: "w-64", children: [(0, jsx_runtime_1.jsxs)(dropdown_menu_1.DropdownMenuLabel, { className: "space-y-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { children: "Color theme variants" }), (0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", className: "border-border bg-muted/50 text-muted-foreground rounded-md border px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase", children: "Gallery" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted-foreground text-xs", children: "Affects this preview only ( button is not part of the shared Navbar. )" })] }), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuSeparator, {}), Object.entries(themes_1.themes).map(([key, themeConfig]) => ((0, jsx_runtime_1.jsxs)(dropdown_menu_1.DropdownMenuItem, { onClick: () => {
76
+ setThemeVariant(key);
77
+ document.cookie = `theme-variant=${key}; Path=/; Max-Age=31536000; SameSite=Lax`;
78
+ }, className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-4 w-4 rounded-full border", style: {
79
+ backgroundColor: isDark
80
+ ? themes_1.darkThemes[key].colors.primary
81
+ : themeConfig.colors.primary,
82
+ } }), themeConfig.name] }), themeVariant === key && (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-4 w-4" })] }, key))), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuSeparator, {}), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuLabel, { children: "Custom" }), (0, jsx_runtime_1.jsxs)(dropdown_menu_1.DropdownMenuItem, { onClick: openCustomDialog, className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Wrench, { className: "h-4 w-4" }), "Customize brand colors\u2026"] }), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuSeparator, {}), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuLabel, { children: "Appearance" }), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuItem, { onClick: () => setTheme("light"), children: "Light" }), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuItem, { onClick: () => setTheme("dark"), children: "Dark" }), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuItem, { onClick: () => setTheme("system"), children: "System" })] }), showCustom && ((0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4", children: (0, jsx_runtime_1.jsxs)("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": "customBrandColorsTitle", className: "bg-popover text-popover-foreground w-full max-w-md rounded-md border p-4 shadow-lg", children: [(0, jsx_runtime_1.jsx)("div", { id: "customBrandColorsTitle", className: "mb-3 text-sm font-semibold", children: "Custom brand colors" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("label", { className: "w-28 text-sm", children: "primary" }), (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "oklch(...) or #hex", className: "bg-background flex-1 rounded border p-2 text-sm", value: (_b = custom.primary) !== null && _b !== void 0 ? _b : "", onChange: (e) => setCustom((c) => (Object.assign(Object.assign({}, c), { primary: e.target.value }))) }), (0, jsx_runtime_1.jsx)("input", { type: "color", className: "h-8 w-10 cursor-pointer", value: typeof custom.primary === "string" &&
83
+ custom.primary.startsWith("#")
84
+ ? custom.primary
85
+ : "#000000", onChange: (e) => setCustom((c) => (Object.assign(Object.assign({}, c), { primary: e.target.value }))) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("label", { className: "w-28 text-sm", children: "accent" }), (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "oklch(...) or #hex", className: "bg-background flex-1 rounded border p-2 text-sm", value: (_c = custom.accent) !== null && _c !== void 0 ? _c : "", onChange: (e) => setCustom((c) => (Object.assign(Object.assign({}, c), { accent: e.target.value }))) }), (0, jsx_runtime_1.jsx)("input", { type: "color", className: "h-8 w-10 cursor-pointer", value: typeof custom.accent === "string" &&
86
+ custom.accent.startsWith("#")
87
+ ? custom.accent
88
+ : "#000000", onChange: (e) => setCustom((c) => (Object.assign(Object.assign({}, c), { accent: e.target.value }))) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("label", { className: "w-28 text-sm", children: "ring" }), (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "oklch(...) or #hex", className: "bg-background flex-1 rounded border p-2 text-sm", value: (_d = custom.ring) !== null && _d !== void 0 ? _d : "", onChange: (e) => setCustom((c) => (Object.assign(Object.assign({}, c), { ring: e.target.value }))) }), (0, jsx_runtime_1.jsx)("input", { type: "color", className: "h-8 w-10 cursor-pointer", value: typeof custom.ring === "string" &&
89
+ custom.ring.startsWith("#")
90
+ ? custom.ring
91
+ : "#000000", onChange: (e) => setCustom((c) => (Object.assign(Object.assign({}, c), { ring: e.target.value }))) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-4 flex justify-end gap-2", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", size: "sm", onClick: () => setShowCustom(false), children: "Cancel" }), (0, jsx_runtime_1.jsx)(button_1.Button, { size: "sm", onClick: applyCustom, children: "Apply" })] })] }) }))] }));
92
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ThemeToggle = ThemeToggle;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const lucide_react_1 = require("lucide-react");
7
+ const next_themes_1 = require("next-themes");
8
+ const utils_1 = require("../lib/utils");
9
+ const button_1 = require("../ui/button");
10
+ function ThemeToggle({ buttonProps, ariaLabel = "Toggle theme", moonClassName, sunClassName, }) {
11
+ const { theme, setTheme } = (0, next_themes_1.useTheme)();
12
+ const mergedButtonProps = Object.assign(Object.assign({ variant: "outline", size: "icon" }, buttonProps), { className: (0, utils_1.cn)("relative",
13
+ // Prefer preset variables if provided on Navbar
14
+ "bg-[var(--navbar-toggle-bg)] text-[var(--navbar-accent)] hover:bg-[var(--navbar-hover-bg)] focus-visible:ring-[var(--navbar-ring)]",
15
+ // Ensure border uses preset variable; provide width for unstyled cases
16
+ "border border-[var(--navbar-border)]", buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.className),
17
+ // Inline style ensures our accent wins over token classes even under dark: variants
18
+ style: Object.assign(Object.assign({}, buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.style), { color: "var(--navbar-accent)", backgroundColor: "var(--navbar-toggle-bg)", borderColor: "var(--navbar-border)",
19
+ // Tell Tailwind ring utilities which ring color to use
20
+ "--tw-ring-color": "var(--navbar-ring)" }) });
21
+ return ((0, jsx_runtime_1.jsxs)(button_1.Button, Object.assign({}, mergedButtonProps, { onClick: () => setTheme(theme === "light" ? "dark" : "light"), "aria-label": ariaLabel, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Moon, { className: (0, utils_1.cn)("h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90", moonClassName) }), (0, jsx_runtime_1.jsx)(lucide_react_1.Sun, { className: (0, utils_1.cn)("absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0", sunClassName) }), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: ariaLabel })] })));
22
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = AppToaster;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const sonner_1 = require("sonner");
7
+ function AppToaster() {
8
+ return (0, jsx_runtime_1.jsx)(sonner_1.Toaster, { position: "top-center", richColors: true, closeButton: true });
9
+ }
package/package.json CHANGED
@@ -1,23 +1,29 @@
1
1
  {
2
2
  "name": "@nextworks/blocks-core",
3
- "version": "0.2.0-alpha.0",
3
+ "version": "0.2.0-alpha.2",
4
4
  "private": false,
5
- "main": "dist/index.js",
5
+ "main": "dist-cjs/index.cjs",
6
+ "module": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
7
8
  "files": [
8
9
  "dist",
10
+ "dist-cjs",
9
11
  "package.json",
10
12
  "README.md"
11
13
  ],
12
14
  "repository": "github:jblh/nextworks-cli",
13
- "bugs": "https://github.com/jblh/nextworks-cli/issues",
14
- "homepage": "https://github.com/jblh/nextworks-cli#readme",
15
+ "bugs": "https://github.com/jblh/nextworks-cli/issues",
16
+ "homepage": "https://github.com/jblh/nextworks-cli#readme",
15
17
  "publishConfig": {
16
18
  "access": "public"
17
19
  },
18
20
  "scripts": {
21
+ "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true }); require('fs').rmSync('dist-cjs', { recursive: true, force: true }); require('fs').rmSync('dist-types', { recursive: true, force: true });\"",
22
+ "build:esm": "npx tsc -p tsconfig.build.json",
23
+ "build:cjs": "npx tsc -p tsconfig.cjs.json",
19
24
  "build:types": "npx tsc -p tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap --outDir dist-types",
20
- "build": "npx tsc -p tsconfig.build.json && npm run build:types && node scripts/postbuild.js",
25
+ "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:types",
26
+ "postbuild": "node scripts/postbuild.js",
21
27
  "test:types": "npx tsc -p tsconfig.build.json --noEmit --pretty false"
22
28
  },
23
29
  "dependencies": {
@@ -46,15 +52,22 @@
46
52
  "exports": {
47
53
  ".": {
48
54
  "types": "./dist/index.d.ts",
55
+ "import": "./dist/index.js",
56
+ "require": "./dist-cjs/index.cjs",
49
57
  "default": "./dist/index.js"
50
58
  },
51
59
  "./server": {
52
60
  "types": "./dist/server.d.ts",
61
+ "import": "./dist/server.js",
62
+ "require": "./dist-cjs/server.cjs",
53
63
  "default": "./dist/server.js"
54
64
  },
55
65
  "./lib/themes": {
56
66
  "types": "./dist/lib/themes.d.ts",
67
+ "import": "./dist/lib/themes.js",
68
+ "require": "./dist-cjs/lib/themes.cjs",
57
69
  "default": "./dist/lib/themes.js"
58
- }
70
+ },
71
+ "./package.json": "./package.json"
59
72
  }
60
73
  }