ai-design-system 0.1.3 → 0.1.5
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.
|
@@ -54,8 +54,8 @@ export const AdjustableLayout = React.memo<AdjustableLayoutProps>(
|
|
|
54
54
|
}
|
|
55
55
|
const containerRef = React.useRef<HTMLDivElement>(null)
|
|
56
56
|
const [sizes, setSizes] = React.useState<number[]>(() => {
|
|
57
|
-
// Load from localStorage or use defaults
|
|
58
|
-
if (storageKey) {
|
|
57
|
+
// Load from localStorage or use defaults (only in browser)
|
|
58
|
+
if (storageKey && typeof window !== 'undefined') {
|
|
59
59
|
const saved = localStorage.getItem(storageKey)
|
|
60
60
|
if (saved) {
|
|
61
61
|
try {
|
|
@@ -96,9 +96,9 @@ export const AdjustableLayout = React.memo<AdjustableLayoutProps>(
|
|
|
96
96
|
return () => window.removeEventListener('resize', updateContainerSize)
|
|
97
97
|
}, [orientation])
|
|
98
98
|
|
|
99
|
-
// Save to localStorage when sizes change
|
|
99
|
+
// Save to localStorage when sizes change (only in browser)
|
|
100
100
|
React.useEffect(() => {
|
|
101
|
-
if (storageKey) {
|
|
101
|
+
if (storageKey && typeof window !== 'undefined') {
|
|
102
102
|
localStorage.setItem(storageKey, JSON.stringify(sizes))
|
|
103
103
|
}
|
|
104
104
|
}, [sizes, storageKey])
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
DropdownMenuItem,
|
|
11
11
|
DropdownMenuTrigger,
|
|
12
12
|
} from "@/components/primitives/DropdownMenu";
|
|
13
|
+
import { Icon } from "@/components/primitives/Icon";
|
|
13
14
|
import { cn } from "@/lib/utils";
|
|
14
15
|
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
@@ -23,8 +24,12 @@ export interface WorkflowVersion {
|
|
|
23
24
|
|
|
24
25
|
export interface ToolbarAction {
|
|
25
26
|
id: string;
|
|
26
|
-
/**
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Icon to render inside the button.
|
|
29
|
+
* Pass a string icon name from the icon registry (preferred — no icon package needed in consumer)
|
|
30
|
+
* or a ReactNode for custom icons.
|
|
31
|
+
*/
|
|
32
|
+
icon: string | ReactNode;
|
|
28
33
|
/** Tooltip text */
|
|
29
34
|
title: string;
|
|
30
35
|
onClick?: () => void;
|
|
@@ -76,6 +81,8 @@ export function WorkflowToolbarActions({
|
|
|
76
81
|
>
|
|
77
82
|
{action.loading ? (
|
|
78
83
|
<Loader2 className="size-4 animate-spin" />
|
|
84
|
+
) : typeof action.icon === 'string' ? (
|
|
85
|
+
<Icon name={action.icon} size="sm" />
|
|
79
86
|
) : (
|
|
80
87
|
action.icon
|
|
81
88
|
)}
|
package/dist/index.cjs
CHANGED
|
@@ -2296,6 +2296,11 @@ var defaultIcons = {
|
|
|
2296
2296
|
name: "file-text",
|
|
2297
2297
|
viewBox: "0 0 24 24",
|
|
2298
2298
|
path: "M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8zM14 2v6h6M16 13H8m8 4H8m8-8H8"
|
|
2299
|
+
},
|
|
2300
|
+
"message-square": {
|
|
2301
|
+
name: "message-square",
|
|
2302
|
+
viewBox: "0 0 24 24",
|
|
2303
|
+
path: "M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"
|
|
2299
2304
|
}
|
|
2300
2305
|
};
|
|
2301
2306
|
var IconRegistry = class {
|
|
@@ -6790,7 +6795,7 @@ var AdjustableLayout = React33__namespace.memo(
|
|
|
6790
6795
|
};
|
|
6791
6796
|
const containerRef = React33__namespace.useRef(null);
|
|
6792
6797
|
const [sizes, setSizes] = React33__namespace.useState(() => {
|
|
6793
|
-
if (storageKey) {
|
|
6798
|
+
if (storageKey && typeof window !== "undefined") {
|
|
6794
6799
|
const saved = localStorage.getItem(storageKey);
|
|
6795
6800
|
if (saved) {
|
|
6796
6801
|
try {
|
|
@@ -6825,7 +6830,7 @@ var AdjustableLayout = React33__namespace.memo(
|
|
|
6825
6830
|
return () => window.removeEventListener("resize", updateContainerSize);
|
|
6826
6831
|
}, [orientation]);
|
|
6827
6832
|
React33__namespace.useEffect(() => {
|
|
6828
|
-
if (storageKey) {
|
|
6833
|
+
if (storageKey && typeof window !== "undefined") {
|
|
6829
6834
|
localStorage.setItem(storageKey, JSON.stringify(sizes));
|
|
6830
6835
|
}
|
|
6831
6836
|
}, [sizes, storageKey]);
|
|
@@ -7165,7 +7170,7 @@ function WorkflowToolbarActions({
|
|
|
7165
7170
|
title: action.title,
|
|
7166
7171
|
variant: "secondary",
|
|
7167
7172
|
children: [
|
|
7168
|
-
action.loading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : action.icon,
|
|
7173
|
+
action.loading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : typeof action.icon === "string" ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "sm" }) : action.icon,
|
|
7169
7174
|
action.indicator && !action.loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-1.5 right-1.5 size-2 rounded-full bg-primary" })
|
|
7170
7175
|
]
|
|
7171
7176
|
},
|