@inf-monkeys-tech/monkeys-design 0.4.31 → 0.4.32
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 +6 -0
- package/dist/components/workbench/index.d.mts +561 -0
- package/dist/components/workbench/index.d.ts +561 -0
- package/dist/components/workbench/index.js +5513 -0
- package/dist/components/workbench/index.js.map +1 -0
- package/dist/components/workbench/index.mjs +5502 -0
- package/dist/components/workbench/index.mjs.map +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2823 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2815 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useState, useEffect, useId, useMemo, createContext, useCallback, Fragment as Fragment$1,
|
|
1
|
+
import React, { forwardRef, useRef, useState, useEffect, useId, useMemo, createContext, useCallback, useLayoutEffect, Children, isValidElement, Fragment as Fragment$1, useContext } from 'react';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as ContextMenu from '@radix-ui/react-context-menu';
|
|
4
4
|
import * as DropdownMenu3 from '@radix-ui/react-dropdown-menu';
|
|
@@ -4521,7 +4521,7 @@ var require_lodash = __commonJS({
|
|
|
4521
4521
|
function valuesIn(object) {
|
|
4522
4522
|
return object == null ? [] : baseValues(object, keysIn(object));
|
|
4523
4523
|
}
|
|
4524
|
-
function
|
|
4524
|
+
function clamp4(number, lower, upper) {
|
|
4525
4525
|
if (upper === undefined2) {
|
|
4526
4526
|
upper = lower;
|
|
4527
4527
|
lower = undefined2;
|
|
@@ -5198,7 +5198,7 @@ var require_lodash = __commonJS({
|
|
|
5198
5198
|
lodash.camelCase = camelCase;
|
|
5199
5199
|
lodash.capitalize = capitalize;
|
|
5200
5200
|
lodash.ceil = ceil;
|
|
5201
|
-
lodash.clamp =
|
|
5201
|
+
lodash.clamp = clamp4;
|
|
5202
5202
|
lodash.clone = clone;
|
|
5203
5203
|
lodash.cloneDeep = cloneDeep;
|
|
5204
5204
|
lodash.cloneDeepWith = cloneDeepWith;
|
|
@@ -19969,6 +19969,2817 @@ function AppLayout({ header, sidebar, children, flush = false, className }) {
|
|
|
19969
19969
|
] })
|
|
19970
19970
|
] });
|
|
19971
19971
|
}
|
|
19972
|
+
function ClampIcon({ expanded }) {
|
|
19973
|
+
return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: "h-4 w-4", fill: "none", children: [
|
|
19974
|
+
/* @__PURE__ */ jsx(
|
|
19975
|
+
"path",
|
|
19976
|
+
{
|
|
19977
|
+
d: "M4 4.5h12M4 15.5h12M7.5 7.5 5 10l2.5 2.5M12.5 7.5 15 10l-2.5 2.5",
|
|
19978
|
+
stroke: "currentColor",
|
|
19979
|
+
strokeWidth: "1.6",
|
|
19980
|
+
strokeLinecap: "round",
|
|
19981
|
+
strokeLinejoin: "round",
|
|
19982
|
+
className: expanded ? "" : "hidden"
|
|
19983
|
+
}
|
|
19984
|
+
),
|
|
19985
|
+
/* @__PURE__ */ jsx(
|
|
19986
|
+
"path",
|
|
19987
|
+
{
|
|
19988
|
+
d: "M4 4.5h12M4 15.5h12M5 7.5 7.5 10 5 12.5M15 7.5 12.5 10l2.5 2.5",
|
|
19989
|
+
stroke: "currentColor",
|
|
19990
|
+
strokeWidth: "1.6",
|
|
19991
|
+
strokeLinecap: "round",
|
|
19992
|
+
strokeLinejoin: "round",
|
|
19993
|
+
className: expanded ? "hidden" : ""
|
|
19994
|
+
}
|
|
19995
|
+
)
|
|
19996
|
+
] });
|
|
19997
|
+
}
|
|
19998
|
+
function ResizeGripIcon() {
|
|
19999
|
+
return /* @__PURE__ */ jsx(
|
|
20000
|
+
"span",
|
|
20001
|
+
{
|
|
20002
|
+
"aria-hidden": "true",
|
|
20003
|
+
className: "pointer-events-none absolute right-1/2 top-3 bottom-3 w-px translate-x-1/2 rounded-full bg-border/65 opacity-0 transition-opacity group-hover/resize:opacity-100"
|
|
20004
|
+
}
|
|
20005
|
+
);
|
|
20006
|
+
}
|
|
20007
|
+
function getItemTitle(item) {
|
|
20008
|
+
if (item.title) return item.title;
|
|
20009
|
+
return typeof item.label === "string" ? item.label : void 0;
|
|
20010
|
+
}
|
|
20011
|
+
function clampWidth2(width, minWidth, maxWidth) {
|
|
20012
|
+
return Math.min(Math.max(width, minWidth), maxWidth);
|
|
20013
|
+
}
|
|
20014
|
+
function assignRef(ref, node) {
|
|
20015
|
+
if (typeof ref === "function") {
|
|
20016
|
+
ref(node);
|
|
20017
|
+
} else if (ref) {
|
|
20018
|
+
ref.current = node;
|
|
20019
|
+
}
|
|
20020
|
+
}
|
|
20021
|
+
function readStoredLayout(storageKey, options) {
|
|
20022
|
+
const fallback = {
|
|
20023
|
+
collapsed: options.defaultCollapsed,
|
|
20024
|
+
width: clampWidth2(options.defaultWidth, options.minWidth, options.maxWidth)
|
|
20025
|
+
};
|
|
20026
|
+
if (typeof window === "undefined" || !storageKey) return fallback;
|
|
20027
|
+
try {
|
|
20028
|
+
const rawValue = window.localStorage.getItem(storageKey);
|
|
20029
|
+
if (!rawValue) return fallback;
|
|
20030
|
+
const parsedValue = JSON.parse(rawValue);
|
|
20031
|
+
return {
|
|
20032
|
+
collapsed: typeof parsedValue.collapsed === "boolean" ? parsedValue.collapsed : fallback.collapsed,
|
|
20033
|
+
width: typeof parsedValue.width === "number" && Number.isFinite(parsedValue.width) ? clampWidth2(parsedValue.width, options.minWidth, options.maxWidth) : fallback.width
|
|
20034
|
+
};
|
|
20035
|
+
} catch {
|
|
20036
|
+
return fallback;
|
|
20037
|
+
}
|
|
20038
|
+
}
|
|
20039
|
+
var WorkbenchResizableSidebar = forwardRef(
|
|
20040
|
+
function WorkbenchResizableSidebar2({
|
|
20041
|
+
title,
|
|
20042
|
+
items,
|
|
20043
|
+
activeItemId,
|
|
20044
|
+
itemAs,
|
|
20045
|
+
collapsed,
|
|
20046
|
+
defaultCollapsed = false,
|
|
20047
|
+
onCollapsedChange,
|
|
20048
|
+
width,
|
|
20049
|
+
onWidthChange,
|
|
20050
|
+
defaultWidth = 220,
|
|
20051
|
+
minWidth = 180,
|
|
20052
|
+
maxWidth = 420,
|
|
20053
|
+
collapsedWidth = 60,
|
|
20054
|
+
collapseThreshold = 140,
|
|
20055
|
+
storageKey,
|
|
20056
|
+
resizable = true,
|
|
20057
|
+
collapsible = true,
|
|
20058
|
+
collapseLabel = "Collapse sidebar",
|
|
20059
|
+
expandLabel = "Expand sidebar",
|
|
20060
|
+
resizeLabel = "Resize sidebar",
|
|
20061
|
+
desktopClassName = "hidden md:flex",
|
|
20062
|
+
mobileClassName = "flex md:hidden",
|
|
20063
|
+
className,
|
|
20064
|
+
classNames,
|
|
20065
|
+
style
|
|
20066
|
+
}, ref) {
|
|
20067
|
+
const initialLayoutRef = useRef(null);
|
|
20068
|
+
if (!initialLayoutRef.current) {
|
|
20069
|
+
initialLayoutRef.current = readStoredLayout(storageKey, {
|
|
20070
|
+
defaultCollapsed,
|
|
20071
|
+
defaultWidth,
|
|
20072
|
+
minWidth,
|
|
20073
|
+
maxWidth
|
|
20074
|
+
});
|
|
20075
|
+
}
|
|
20076
|
+
const sidebarRef = useRef(null);
|
|
20077
|
+
const [internalCollapsed, setInternalCollapsed] = useState(initialLayoutRef.current.collapsed);
|
|
20078
|
+
const [internalWidth, setInternalWidth] = useState(initialLayoutRef.current.width);
|
|
20079
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
20080
|
+
const resolvedCollapsed = collapsed ?? internalCollapsed;
|
|
20081
|
+
const resolvedWidth = width ?? internalWidth;
|
|
20082
|
+
const isCollapsedControlled = collapsed !== void 0;
|
|
20083
|
+
const isWidthControlled = width !== void 0;
|
|
20084
|
+
const setSidebarRef = (node) => {
|
|
20085
|
+
sidebarRef.current = node;
|
|
20086
|
+
assignRef(ref, node);
|
|
20087
|
+
};
|
|
20088
|
+
const updateCollapsed = (nextCollapsed) => {
|
|
20089
|
+
if (!collapsible && nextCollapsed) return;
|
|
20090
|
+
if (!isCollapsedControlled) {
|
|
20091
|
+
setInternalCollapsed(nextCollapsed);
|
|
20092
|
+
}
|
|
20093
|
+
onCollapsedChange?.(nextCollapsed);
|
|
20094
|
+
};
|
|
20095
|
+
const updateWidth = (nextWidth) => {
|
|
20096
|
+
const clampedWidth = clampWidth2(nextWidth, minWidth, maxWidth);
|
|
20097
|
+
if (!isWidthControlled) {
|
|
20098
|
+
setInternalWidth(clampedWidth);
|
|
20099
|
+
}
|
|
20100
|
+
onWidthChange?.(clampedWidth);
|
|
20101
|
+
};
|
|
20102
|
+
const startResize = (event) => {
|
|
20103
|
+
if (!resizable) return;
|
|
20104
|
+
event.preventDefault();
|
|
20105
|
+
setIsResizing(true);
|
|
20106
|
+
};
|
|
20107
|
+
const handleResizeKeyDown = (event) => {
|
|
20108
|
+
if (!resizable) return;
|
|
20109
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
20110
|
+
event.preventDefault();
|
|
20111
|
+
if (event.key === "ArrowLeft") {
|
|
20112
|
+
const nextWidth = resolvedWidth - 24;
|
|
20113
|
+
if (nextWidth < collapseThreshold && collapsible) {
|
|
20114
|
+
updateCollapsed(true);
|
|
20115
|
+
return;
|
|
20116
|
+
}
|
|
20117
|
+
updateWidth(nextWidth);
|
|
20118
|
+
} else {
|
|
20119
|
+
if (resolvedCollapsed) {
|
|
20120
|
+
updateCollapsed(false);
|
|
20121
|
+
updateWidth(Math.max(resolvedWidth, minWidth));
|
|
20122
|
+
return;
|
|
20123
|
+
}
|
|
20124
|
+
updateWidth(resolvedWidth + 24);
|
|
20125
|
+
}
|
|
20126
|
+
};
|
|
20127
|
+
useEffect(() => {
|
|
20128
|
+
if (typeof window === "undefined" || !storageKey) return;
|
|
20129
|
+
window.localStorage.setItem(storageKey, JSON.stringify({
|
|
20130
|
+
collapsed: resolvedCollapsed,
|
|
20131
|
+
width: clampWidth2(resolvedWidth, minWidth, maxWidth)
|
|
20132
|
+
}));
|
|
20133
|
+
}, [maxWidth, minWidth, resolvedCollapsed, resolvedWidth, storageKey]);
|
|
20134
|
+
useEffect(() => {
|
|
20135
|
+
if (!isResizing) return void 0;
|
|
20136
|
+
const handlePointerMove = (event) => {
|
|
20137
|
+
const sidebarNode = sidebarRef.current;
|
|
20138
|
+
if (!sidebarNode) return;
|
|
20139
|
+
const nextWidth = event.clientX - sidebarNode.getBoundingClientRect().left;
|
|
20140
|
+
if (nextWidth < collapseThreshold && collapsible) {
|
|
20141
|
+
updateCollapsed(true);
|
|
20142
|
+
return;
|
|
20143
|
+
}
|
|
20144
|
+
updateCollapsed(false);
|
|
20145
|
+
updateWidth(nextWidth);
|
|
20146
|
+
};
|
|
20147
|
+
const handlePointerUp = () => setIsResizing(false);
|
|
20148
|
+
window.addEventListener("pointermove", handlePointerMove);
|
|
20149
|
+
window.addEventListener("pointerup", handlePointerUp);
|
|
20150
|
+
document.body.style.cursor = "col-resize";
|
|
20151
|
+
document.body.style.userSelect = "none";
|
|
20152
|
+
return () => {
|
|
20153
|
+
window.removeEventListener("pointermove", handlePointerMove);
|
|
20154
|
+
window.removeEventListener("pointerup", handlePointerUp);
|
|
20155
|
+
document.body.style.cursor = "";
|
|
20156
|
+
document.body.style.userSelect = "";
|
|
20157
|
+
};
|
|
20158
|
+
}, [collapseThreshold, collapsible, isResizing, maxWidth, minWidth, resolvedWidth, resolvedCollapsed]);
|
|
20159
|
+
const renderItem = (item, mobile = false) => {
|
|
20160
|
+
const active = item.active ?? item.id === activeItemId;
|
|
20161
|
+
const ItemComponent = itemAs ?? (item.href ? "a" : "button");
|
|
20162
|
+
const itemTitle = getItemTitle(item);
|
|
20163
|
+
const itemProps = {
|
|
20164
|
+
...item.to ? { to: item.to } : {},
|
|
20165
|
+
...item.href ? { href: item.href } : {},
|
|
20166
|
+
...ItemComponent === "button" ? { type: "button" } : {},
|
|
20167
|
+
title: itemTitle,
|
|
20168
|
+
"aria-current": active ? "page" : void 0,
|
|
20169
|
+
"aria-disabled": item.disabled || void 0,
|
|
20170
|
+
tabIndex: item.disabled ? -1 : void 0,
|
|
20171
|
+
onClick: (event) => {
|
|
20172
|
+
if (item.disabled) {
|
|
20173
|
+
event.preventDefault();
|
|
20174
|
+
return;
|
|
20175
|
+
}
|
|
20176
|
+
item.onClick?.(event);
|
|
20177
|
+
}
|
|
20178
|
+
};
|
|
20179
|
+
return /* @__PURE__ */ jsxs(
|
|
20180
|
+
ItemComponent,
|
|
20181
|
+
{
|
|
20182
|
+
...itemProps,
|
|
20183
|
+
"data-active": active ? "true" : "false",
|
|
20184
|
+
className: cn(
|
|
20185
|
+
mobile ? "inline-flex h-9 shrink-0 items-center gap-2 rounded-lg border px-3 text-xs font-medium transition-colors" : "relative flex h-9 w-full items-center justify-between gap-2 overflow-hidden rounded-md border px-2 text-left text-[12px] shadow-none transition-colors",
|
|
20186
|
+
mobile ? active ? "border-primary/40 bg-primary/12 text-foreground" : "border-border/60 bg-card/60 text-muted-foreground hover:bg-card/80 hover:text-foreground" : active ? "border-primary/40 bg-primary/12 text-foreground shadow-sm" : "border-border/60 bg-card/60 text-foreground hover:border-primary/20 hover:bg-card/80",
|
|
20187
|
+
!mobile && resolvedCollapsed && "justify-center px-0",
|
|
20188
|
+
item.disabled && "pointer-events-none opacity-50",
|
|
20189
|
+
mobile ? classNames?.mobileItem : classNames?.item,
|
|
20190
|
+
item.className
|
|
20191
|
+
),
|
|
20192
|
+
children: [
|
|
20193
|
+
/* @__PURE__ */ jsx("span", { className: cn("inline-flex h-4 w-4 shrink-0 items-center justify-center [&_svg]:h-3.5 [&_svg]:w-3.5", classNames?.itemIcon), children: item.icon }),
|
|
20194
|
+
mobile || !resolvedCollapsed ? /* @__PURE__ */ jsx("span", { className: cn("min-w-0 flex-1 truncate", classNames?.itemLabel), children: item.label }) : null,
|
|
20195
|
+
!mobile && !resolvedCollapsed && item.endContent ? /* @__PURE__ */ jsx("span", { className: "shrink-0", children: item.endContent }) : null
|
|
20196
|
+
]
|
|
20197
|
+
},
|
|
20198
|
+
item.id
|
|
20199
|
+
);
|
|
20200
|
+
};
|
|
20201
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20202
|
+
/* @__PURE__ */ jsxs(
|
|
20203
|
+
"aside",
|
|
20204
|
+
{
|
|
20205
|
+
ref: setSidebarRef,
|
|
20206
|
+
"data-workbench-resizable-sidebar": true,
|
|
20207
|
+
"data-collapsed": resolvedCollapsed ? "true" : "false",
|
|
20208
|
+
className: cn(
|
|
20209
|
+
"relative z-20 h-full min-h-0 flex-shrink-0 flex-col rounded-xl border border-border/70 bg-card p-3 text-card-foreground shadow-sm",
|
|
20210
|
+
"transition-[width,opacity] duration-300",
|
|
20211
|
+
resolvedCollapsed && "items-center",
|
|
20212
|
+
desktopClassName,
|
|
20213
|
+
classNames?.root,
|
|
20214
|
+
className
|
|
20215
|
+
),
|
|
20216
|
+
style: {
|
|
20217
|
+
width: resolvedCollapsed ? collapsedWidth : resolvedWidth,
|
|
20218
|
+
transition: isResizing ? "none" : void 0,
|
|
20219
|
+
...style
|
|
20220
|
+
},
|
|
20221
|
+
children: [
|
|
20222
|
+
resizable ? /* @__PURE__ */ jsx(
|
|
20223
|
+
"button",
|
|
20224
|
+
{
|
|
20225
|
+
type: "button",
|
|
20226
|
+
"aria-label": resizeLabel,
|
|
20227
|
+
title: resizeLabel,
|
|
20228
|
+
className: cn("group/resize absolute -right-1.5 bottom-0 top-0 z-50 w-3 cursor-col-resize bg-transparent outline-none focus-visible:ring-2 focus-visible:ring-primary/30", classNames?.resizeHandle),
|
|
20229
|
+
onPointerDown: startResize,
|
|
20230
|
+
onKeyDown: handleResizeKeyDown,
|
|
20231
|
+
children: /* @__PURE__ */ jsx(ResizeGripIcon, {})
|
|
20232
|
+
}
|
|
20233
|
+
) : null,
|
|
20234
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-full w-full min-w-0 flex-col overflow-visible", children: [
|
|
20235
|
+
/* @__PURE__ */ jsxs("div", { className: cn("mb-3 flex min-w-0 items-center gap-2", resolvedCollapsed ? "justify-center px-0" : "justify-between px-2", classNames?.header), children: [
|
|
20236
|
+
!resolvedCollapsed && title ? /* @__PURE__ */ jsx("div", { className: cn("min-w-0 truncate text-[11px] font-medium uppercase text-muted-foreground", classNames?.title), children: title }) : null,
|
|
20237
|
+
collapsible ? /* @__PURE__ */ jsx(
|
|
20238
|
+
"button",
|
|
20239
|
+
{
|
|
20240
|
+
type: "button",
|
|
20241
|
+
className: cn("inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30", classNames?.collapseButton),
|
|
20242
|
+
"aria-label": resolvedCollapsed ? expandLabel : collapseLabel,
|
|
20243
|
+
title: resolvedCollapsed ? expandLabel : collapseLabel,
|
|
20244
|
+
onClick: () => updateCollapsed(!resolvedCollapsed),
|
|
20245
|
+
children: /* @__PURE__ */ jsx(ClampIcon, { expanded: !resolvedCollapsed })
|
|
20246
|
+
}
|
|
20247
|
+
) : null
|
|
20248
|
+
] }),
|
|
20249
|
+
/* @__PURE__ */ jsx("div", { className: cn("min-h-0 flex-1 space-y-2 overflow-y-auto", resolvedCollapsed && "flex w-full flex-col items-center", classNames?.list), children: items.map((item) => renderItem(item)) })
|
|
20250
|
+
] })
|
|
20251
|
+
]
|
|
20252
|
+
}
|
|
20253
|
+
),
|
|
20254
|
+
/* @__PURE__ */ jsx("nav", { className: cn("gap-2 overflow-x-auto pb-1", mobileClassName, classNames?.mobileNav), "aria-label": typeof title === "string" ? title : void 0, children: items.map((item) => renderItem(item, true)) })
|
|
20255
|
+
] });
|
|
20256
|
+
}
|
|
20257
|
+
);
|
|
20258
|
+
function shouldRenderBodyWrapper(props) {
|
|
20259
|
+
return Boolean(
|
|
20260
|
+
props.header || props.footer || props.bodyAs || props.bodyClassName || props.bodyProps || props.classNames?.body
|
|
20261
|
+
);
|
|
20262
|
+
}
|
|
20263
|
+
var WorkbenchContentPane = forwardRef(
|
|
20264
|
+
function WorkbenchContentPane2({
|
|
20265
|
+
as: Component = "section",
|
|
20266
|
+
bodyAs: BodyComponent = "div",
|
|
20267
|
+
header,
|
|
20268
|
+
footer,
|
|
20269
|
+
children,
|
|
20270
|
+
className,
|
|
20271
|
+
headerClassName,
|
|
20272
|
+
bodyClassName,
|
|
20273
|
+
footerClassName,
|
|
20274
|
+
bodyProps,
|
|
20275
|
+
classNames,
|
|
20276
|
+
style,
|
|
20277
|
+
...props
|
|
20278
|
+
}, ref) {
|
|
20279
|
+
const renderBodyWrapper = shouldRenderBodyWrapper({
|
|
20280
|
+
header,
|
|
20281
|
+
footer,
|
|
20282
|
+
bodyAs: BodyComponent === "div" ? void 0 : BodyComponent,
|
|
20283
|
+
bodyClassName,
|
|
20284
|
+
bodyProps,
|
|
20285
|
+
classNames
|
|
20286
|
+
});
|
|
20287
|
+
const { className: bodyPropsClassName, ...restBodyProps } = bodyProps ?? {};
|
|
20288
|
+
return /* @__PURE__ */ jsxs(
|
|
20289
|
+
Component,
|
|
20290
|
+
{
|
|
20291
|
+
ref,
|
|
20292
|
+
"data-workbench-content-pane": true,
|
|
20293
|
+
className: cn(
|
|
20294
|
+
"workbench-surface-subtle flex h-full min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border/50 transition-all duration-300 dark:border-border/40",
|
|
20295
|
+
classNames?.root,
|
|
20296
|
+
className
|
|
20297
|
+
),
|
|
20298
|
+
style,
|
|
20299
|
+
...props,
|
|
20300
|
+
children: [
|
|
20301
|
+
header ? /* @__PURE__ */ jsx("div", { className: cn("shrink-0 border-b border-border/40 px-4 py-3 dark:border-border/30", classNames?.header, headerClassName), children: header }) : null,
|
|
20302
|
+
renderBodyWrapper ? /* @__PURE__ */ jsx(
|
|
20303
|
+
BodyComponent,
|
|
20304
|
+
{
|
|
20305
|
+
className: cn("min-h-0 flex-1 overflow-hidden", classNames?.body, bodyClassName, bodyPropsClassName),
|
|
20306
|
+
...restBodyProps,
|
|
20307
|
+
children
|
|
20308
|
+
}
|
|
20309
|
+
) : children,
|
|
20310
|
+
footer ? /* @__PURE__ */ jsx("div", { className: cn("shrink-0 border-t border-border/40 px-4 py-3 dark:border-border/30", classNames?.footer, footerClassName), children: footer }) : null
|
|
20311
|
+
]
|
|
20312
|
+
}
|
|
20313
|
+
);
|
|
20314
|
+
}
|
|
20315
|
+
);
|
|
20316
|
+
var defaultLabels = {
|
|
20317
|
+
settingsButton: "Gallery settings",
|
|
20318
|
+
title: "Gallery settings",
|
|
20319
|
+
visibleColumns: "Visible fields",
|
|
20320
|
+
coverField: "Cover field",
|
|
20321
|
+
autoDetect: "Auto",
|
|
20322
|
+
cardDensity: "Card density",
|
|
20323
|
+
cardColumns: "Cards per row",
|
|
20324
|
+
detailColumns: "Detail columns",
|
|
20325
|
+
fieldVisibility: "Field visibility",
|
|
20326
|
+
fieldLimit: "Field limit",
|
|
20327
|
+
fieldLimitHint: "Uses current field order",
|
|
20328
|
+
layout: "Gallery layout",
|
|
20329
|
+
compact: "Compact",
|
|
20330
|
+
comfortable: "Standard",
|
|
20331
|
+
detailed: "Detailed",
|
|
20332
|
+
autoColumns: "Auto",
|
|
20333
|
+
columns: (count) => `${count}`,
|
|
20334
|
+
bentoColumns: (count) => `${count}`,
|
|
20335
|
+
topLimit: "First fields",
|
|
20336
|
+
allFields: "All fields",
|
|
20337
|
+
adaptiveGrid: "Grid",
|
|
20338
|
+
masonry: "Masonry"
|
|
20339
|
+
};
|
|
20340
|
+
function normalizeColumnKey(column) {
|
|
20341
|
+
return String(column?.key || "");
|
|
20342
|
+
}
|
|
20343
|
+
function getDefaultColumnLabel(column) {
|
|
20344
|
+
return column.label ?? column.key;
|
|
20345
|
+
}
|
|
20346
|
+
function getDefaultVisibleColumnKeys(columns) {
|
|
20347
|
+
return columns.filter((column) => normalizeColumnKey(column) && column.hidden !== true).map((column) => normalizeColumnKey(column));
|
|
20348
|
+
}
|
|
20349
|
+
function getResolvedVisibleColumnKeys({
|
|
20350
|
+
columns,
|
|
20351
|
+
visibleColumnKeys,
|
|
20352
|
+
allowEmptyVisibleColumns
|
|
20353
|
+
}) {
|
|
20354
|
+
const validKeys = new Set(columns.map(normalizeColumnKey).filter(Boolean));
|
|
20355
|
+
const controlledKeys = Array.isArray(visibleColumnKeys) ? visibleColumnKeys.filter((key) => validKeys.has(String(key))) : null;
|
|
20356
|
+
if (controlledKeys && (controlledKeys.length || allowEmptyVisibleColumns)) {
|
|
20357
|
+
return controlledKeys;
|
|
20358
|
+
}
|
|
20359
|
+
return getDefaultVisibleColumnKeys(columns);
|
|
20360
|
+
}
|
|
20361
|
+
function getDefaultDensityOptions(labels) {
|
|
20362
|
+
return [
|
|
20363
|
+
{ value: "compact", label: labels.compact },
|
|
20364
|
+
{ value: "comfortable", label: labels.comfortable },
|
|
20365
|
+
{ value: "detailed", label: labels.detailed }
|
|
20366
|
+
];
|
|
20367
|
+
}
|
|
20368
|
+
function getDefaultGridColumnOptions(labels) {
|
|
20369
|
+
return [
|
|
20370
|
+
{ value: "auto", label: labels.autoColumns },
|
|
20371
|
+
{ value: 1, label: labels.columns(1) },
|
|
20372
|
+
{ value: 2, label: labels.columns(2) },
|
|
20373
|
+
{ value: 3, label: labels.columns(3) },
|
|
20374
|
+
{ value: 4, label: labels.columns(4) }
|
|
20375
|
+
];
|
|
20376
|
+
}
|
|
20377
|
+
function getDefaultBentoColumnOptions(labels) {
|
|
20378
|
+
return [
|
|
20379
|
+
{ value: 1, label: labels.bentoColumns(1) },
|
|
20380
|
+
{ value: 2, label: labels.bentoColumns(2) },
|
|
20381
|
+
{ value: 3, label: labels.bentoColumns(3) }
|
|
20382
|
+
];
|
|
20383
|
+
}
|
|
20384
|
+
function getDefaultDetailVisibilityOptions(labels) {
|
|
20385
|
+
return [
|
|
20386
|
+
{ value: "limit", label: labels.topLimit },
|
|
20387
|
+
{ value: "all", label: labels.allFields }
|
|
20388
|
+
];
|
|
20389
|
+
}
|
|
20390
|
+
function getDefaultLayoutOptions(labels) {
|
|
20391
|
+
return [
|
|
20392
|
+
{ value: "fixed", label: labels.adaptiveGrid },
|
|
20393
|
+
{ value: "masonry", label: labels.masonry }
|
|
20394
|
+
];
|
|
20395
|
+
}
|
|
20396
|
+
function normalizeOptionValue(value) {
|
|
20397
|
+
return String(value);
|
|
20398
|
+
}
|
|
20399
|
+
function getOptionValue(options, rawValue, fallbackValue) {
|
|
20400
|
+
const valueText = String(rawValue ?? fallbackValue);
|
|
20401
|
+
return options.some((option) => String(option.value) === valueText) ? valueText : String(fallbackValue);
|
|
20402
|
+
}
|
|
20403
|
+
function parseNumberOption(value) {
|
|
20404
|
+
const parsed = Number.parseInt(value, 10);
|
|
20405
|
+
return Number.isFinite(parsed) ? parsed : 1;
|
|
20406
|
+
}
|
|
20407
|
+
var compactSegmentedClassNames = {
|
|
20408
|
+
root: "flex w-full flex-wrap",
|
|
20409
|
+
item: "min-w-[58px] flex-1 px-2 text-[11px]",
|
|
20410
|
+
label: "text-[11px]"
|
|
20411
|
+
};
|
|
20412
|
+
function WorkbenchGallerySettingsPanel({
|
|
20413
|
+
columns = [],
|
|
20414
|
+
galleryFieldOptions,
|
|
20415
|
+
value,
|
|
20416
|
+
onValueChange,
|
|
20417
|
+
labels,
|
|
20418
|
+
densityOptions,
|
|
20419
|
+
gridColumnOptions,
|
|
20420
|
+
bentoColumnOptions,
|
|
20421
|
+
detailVisibilityOptions,
|
|
20422
|
+
layoutOptions,
|
|
20423
|
+
getColumnLabel = getDefaultColumnLabel,
|
|
20424
|
+
getColumnDescription,
|
|
20425
|
+
showColumnVisibility = true,
|
|
20426
|
+
showGalleryControls = true,
|
|
20427
|
+
showLayoutControl = true,
|
|
20428
|
+
showGridColumns = true,
|
|
20429
|
+
showDetailColumns = true,
|
|
20430
|
+
allowEmptyVisibleColumns = false,
|
|
20431
|
+
className,
|
|
20432
|
+
classNames
|
|
20433
|
+
}) {
|
|
20434
|
+
const resolvedLabels = { ...defaultLabels, ...labels };
|
|
20435
|
+
const resolvedValue = value || {};
|
|
20436
|
+
const resolvedColumns = columns.filter((column) => normalizeColumnKey(column));
|
|
20437
|
+
const resolvedVisibleColumnKeys = getResolvedVisibleColumnKeys({
|
|
20438
|
+
columns: resolvedColumns,
|
|
20439
|
+
visibleColumnKeys: resolvedValue.visibleColumnKeys,
|
|
20440
|
+
allowEmptyVisibleColumns
|
|
20441
|
+
});
|
|
20442
|
+
const visibleColumnKeySet = new Set(resolvedVisibleColumnKeys);
|
|
20443
|
+
const resolvedGalleryFieldOptions = (galleryFieldOptions || resolvedColumns).filter((column) => normalizeColumnKey(column));
|
|
20444
|
+
const resolvedDensityOptions = densityOptions || getDefaultDensityOptions(resolvedLabels);
|
|
20445
|
+
const resolvedGridColumnOptions = gridColumnOptions || getDefaultGridColumnOptions(resolvedLabels);
|
|
20446
|
+
const resolvedBentoColumnOptions = bentoColumnOptions || getDefaultBentoColumnOptions(resolvedLabels);
|
|
20447
|
+
const resolvedDetailVisibilityOptions = detailVisibilityOptions || getDefaultDetailVisibilityOptions(resolvedLabels);
|
|
20448
|
+
const resolvedLayoutOptions = layoutOptions || getDefaultLayoutOptions(resolvedLabels);
|
|
20449
|
+
const canUpdate = typeof onValueChange === "function";
|
|
20450
|
+
const updateValue = (patch) => {
|
|
20451
|
+
onValueChange?.({ ...resolvedValue, ...patch }, patch);
|
|
20452
|
+
};
|
|
20453
|
+
const toggleColumn = (columnKey) => {
|
|
20454
|
+
if (!canUpdate) return;
|
|
20455
|
+
const nextVisibleSet = new Set(resolvedVisibleColumnKeys);
|
|
20456
|
+
if (nextVisibleSet.has(columnKey)) {
|
|
20457
|
+
nextVisibleSet.delete(columnKey);
|
|
20458
|
+
} else {
|
|
20459
|
+
nextVisibleSet.add(columnKey);
|
|
20460
|
+
}
|
|
20461
|
+
let nextVisibleColumnKeys = resolvedColumns.map(normalizeColumnKey).filter((key) => nextVisibleSet.has(key));
|
|
20462
|
+
if (!nextVisibleColumnKeys.length && !allowEmptyVisibleColumns) {
|
|
20463
|
+
nextVisibleColumnKeys = [columnKey];
|
|
20464
|
+
}
|
|
20465
|
+
updateValue({ visibleColumnKeys: nextVisibleColumnKeys });
|
|
20466
|
+
};
|
|
20467
|
+
const shouldRenderColumnVisibility = showColumnVisibility && resolvedColumns.length > 0;
|
|
20468
|
+
const shouldRenderGalleryControls = showGalleryControls;
|
|
20469
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3 text-foreground", classNames?.root, className), children: [
|
|
20470
|
+
shouldRenderColumnVisibility ? /* @__PURE__ */ jsxs("section", { className: cn("space-y-2", classNames?.section), children: [
|
|
20471
|
+
/* @__PURE__ */ jsx("div", { className: cn("text-[10px] font-medium uppercase tracking-wide text-muted-foreground", classNames?.sectionHeader), children: resolvedLabels.visibleColumns }),
|
|
20472
|
+
/* @__PURE__ */ jsx("div", { className: cn("max-h-[220px] space-y-1 overflow-y-auto pr-1", classNames?.columnList), children: resolvedColumns.map((column) => {
|
|
20473
|
+
const columnKey = normalizeColumnKey(column);
|
|
20474
|
+
return /* @__PURE__ */ jsx(
|
|
20475
|
+
BaseCheckbox,
|
|
20476
|
+
{
|
|
20477
|
+
checked: visibleColumnKeySet.has(columnKey),
|
|
20478
|
+
disabled: !canUpdate,
|
|
20479
|
+
label: getColumnLabel(column),
|
|
20480
|
+
description: getColumnDescription?.(column),
|
|
20481
|
+
onChange: () => toggleColumn(columnKey),
|
|
20482
|
+
className: cn("flex w-full rounded-lg px-2 py-1.5 hover:bg-muted/50", classNames?.columnItem)
|
|
20483
|
+
},
|
|
20484
|
+
`workbench-gallery-column-${columnKey}`
|
|
20485
|
+
);
|
|
20486
|
+
}) })
|
|
20487
|
+
] }) : null,
|
|
20488
|
+
shouldRenderGalleryControls ? /* @__PURE__ */ jsxs("section", { className: cn("space-y-3 border-t border-border/60 pt-3", classNames?.section), children: [
|
|
20489
|
+
/* @__PURE__ */ jsx(
|
|
20490
|
+
BaseField,
|
|
20491
|
+
{
|
|
20492
|
+
label: resolvedLabels.coverField,
|
|
20493
|
+
classNames: {
|
|
20494
|
+
label: "text-[10px] uppercase tracking-wide text-muted-foreground"
|
|
20495
|
+
},
|
|
20496
|
+
children: /* @__PURE__ */ jsx(
|
|
20497
|
+
BaseSelect,
|
|
20498
|
+
{
|
|
20499
|
+
value: String(resolvedValue.galleryFieldKey || "auto"),
|
|
20500
|
+
options: [
|
|
20501
|
+
{ value: "auto", label: resolvedLabels.autoDetect },
|
|
20502
|
+
...resolvedGalleryFieldOptions.map((column) => ({
|
|
20503
|
+
value: normalizeColumnKey(column),
|
|
20504
|
+
label: getColumnLabel(column)
|
|
20505
|
+
}))
|
|
20506
|
+
],
|
|
20507
|
+
disabled: !canUpdate,
|
|
20508
|
+
onChange: (event) => updateValue({ galleryFieldKey: event.currentTarget.value || "auto" }),
|
|
20509
|
+
className: classNames?.control
|
|
20510
|
+
}
|
|
20511
|
+
)
|
|
20512
|
+
}
|
|
20513
|
+
),
|
|
20514
|
+
/* @__PURE__ */ jsx(
|
|
20515
|
+
BaseField,
|
|
20516
|
+
{
|
|
20517
|
+
label: resolvedLabels.cardDensity,
|
|
20518
|
+
classNames: {
|
|
20519
|
+
label: "text-[10px] uppercase tracking-wide text-muted-foreground"
|
|
20520
|
+
},
|
|
20521
|
+
children: /* @__PURE__ */ jsx(
|
|
20522
|
+
BaseSegmentedControl,
|
|
20523
|
+
{
|
|
20524
|
+
value: getOptionValue(resolvedDensityOptions, resolvedValue.galleryDensity, "comfortable"),
|
|
20525
|
+
options: resolvedDensityOptions.map((option) => ({
|
|
20526
|
+
value: normalizeOptionValue(option.value),
|
|
20527
|
+
label: option.label,
|
|
20528
|
+
disabled: option.disabled
|
|
20529
|
+
})),
|
|
20530
|
+
onValueChange: (nextValue) => updateValue({ galleryDensity: nextValue }),
|
|
20531
|
+
className: cn("w-full", classNames?.control),
|
|
20532
|
+
classNames: compactSegmentedClassNames
|
|
20533
|
+
}
|
|
20534
|
+
)
|
|
20535
|
+
}
|
|
20536
|
+
),
|
|
20537
|
+
showGridColumns ? /* @__PURE__ */ jsx(
|
|
20538
|
+
BaseField,
|
|
20539
|
+
{
|
|
20540
|
+
label: resolvedLabels.cardColumns,
|
|
20541
|
+
classNames: {
|
|
20542
|
+
label: "text-[10px] uppercase tracking-wide text-muted-foreground"
|
|
20543
|
+
},
|
|
20544
|
+
children: /* @__PURE__ */ jsx(
|
|
20545
|
+
BaseSegmentedControl,
|
|
20546
|
+
{
|
|
20547
|
+
value: getOptionValue(resolvedGridColumnOptions, resolvedValue.galleryGridColumns, "auto"),
|
|
20548
|
+
options: resolvedGridColumnOptions.map((option) => ({
|
|
20549
|
+
value: normalizeOptionValue(option.value),
|
|
20550
|
+
label: option.label,
|
|
20551
|
+
disabled: option.disabled
|
|
20552
|
+
})),
|
|
20553
|
+
onValueChange: (nextValue) => updateValue({
|
|
20554
|
+
galleryGridColumns: nextValue === "auto" ? "auto" : parseNumberOption(nextValue)
|
|
20555
|
+
}),
|
|
20556
|
+
className: cn("w-full", classNames?.control),
|
|
20557
|
+
classNames: compactSegmentedClassNames
|
|
20558
|
+
}
|
|
20559
|
+
)
|
|
20560
|
+
}
|
|
20561
|
+
) : null,
|
|
20562
|
+
showDetailColumns ? /* @__PURE__ */ jsx(
|
|
20563
|
+
BaseField,
|
|
20564
|
+
{
|
|
20565
|
+
label: resolvedLabels.detailColumns,
|
|
20566
|
+
classNames: {
|
|
20567
|
+
label: "text-[10px] uppercase tracking-wide text-muted-foreground"
|
|
20568
|
+
},
|
|
20569
|
+
children: /* @__PURE__ */ jsx(
|
|
20570
|
+
BaseSegmentedControl,
|
|
20571
|
+
{
|
|
20572
|
+
value: getOptionValue(resolvedBentoColumnOptions, resolvedValue.galleryBentoColumns, 2),
|
|
20573
|
+
options: resolvedBentoColumnOptions.map((option) => ({
|
|
20574
|
+
value: normalizeOptionValue(option.value),
|
|
20575
|
+
label: option.label,
|
|
20576
|
+
disabled: option.disabled
|
|
20577
|
+
})),
|
|
20578
|
+
onValueChange: (nextValue) => updateValue({ galleryBentoColumns: parseNumberOption(nextValue) }),
|
|
20579
|
+
className: cn("w-full", classNames?.control),
|
|
20580
|
+
classNames: compactSegmentedClassNames
|
|
20581
|
+
}
|
|
20582
|
+
)
|
|
20583
|
+
}
|
|
20584
|
+
) : null,
|
|
20585
|
+
/* @__PURE__ */ jsx(
|
|
20586
|
+
BaseField,
|
|
20587
|
+
{
|
|
20588
|
+
label: resolvedLabels.fieldVisibility,
|
|
20589
|
+
classNames: {
|
|
20590
|
+
label: "text-[10px] uppercase tracking-wide text-muted-foreground"
|
|
20591
|
+
},
|
|
20592
|
+
children: /* @__PURE__ */ jsx(
|
|
20593
|
+
BaseSegmentedControl,
|
|
20594
|
+
{
|
|
20595
|
+
value: getOptionValue(resolvedDetailVisibilityOptions, resolvedValue.galleryDetailVisibility, "limit"),
|
|
20596
|
+
options: resolvedDetailVisibilityOptions.map((option) => ({
|
|
20597
|
+
value: normalizeOptionValue(option.value),
|
|
20598
|
+
label: option.label,
|
|
20599
|
+
disabled: option.disabled
|
|
20600
|
+
})),
|
|
20601
|
+
onValueChange: (nextValue) => updateValue({ galleryDetailVisibility: nextValue }),
|
|
20602
|
+
className: cn("w-full", classNames?.control),
|
|
20603
|
+
classNames: compactSegmentedClassNames
|
|
20604
|
+
}
|
|
20605
|
+
)
|
|
20606
|
+
}
|
|
20607
|
+
),
|
|
20608
|
+
resolvedValue.galleryDetailVisibility !== "all" ? /* @__PURE__ */ jsx(
|
|
20609
|
+
BaseField,
|
|
20610
|
+
{
|
|
20611
|
+
label: resolvedLabels.fieldLimit,
|
|
20612
|
+
description: resolvedLabels.fieldLimitHint,
|
|
20613
|
+
classNames: {
|
|
20614
|
+
label: "text-[10px] uppercase tracking-wide text-muted-foreground",
|
|
20615
|
+
description: "text-[10px]"
|
|
20616
|
+
},
|
|
20617
|
+
children: /* @__PURE__ */ jsx(
|
|
20618
|
+
BaseInput,
|
|
20619
|
+
{
|
|
20620
|
+
type: "number",
|
|
20621
|
+
min: 1,
|
|
20622
|
+
step: 1,
|
|
20623
|
+
value: String(resolvedValue.galleryDetailLimit || 4),
|
|
20624
|
+
disabled: !canUpdate,
|
|
20625
|
+
onChange: (event) => updateValue({ galleryDetailLimit: event.currentTarget.value }),
|
|
20626
|
+
className: classNames?.control
|
|
20627
|
+
}
|
|
20628
|
+
)
|
|
20629
|
+
}
|
|
20630
|
+
) : null,
|
|
20631
|
+
showLayoutControl ? /* @__PURE__ */ jsx(
|
|
20632
|
+
BaseField,
|
|
20633
|
+
{
|
|
20634
|
+
label: resolvedLabels.layout,
|
|
20635
|
+
classNames: {
|
|
20636
|
+
label: "text-[10px] uppercase tracking-wide text-muted-foreground"
|
|
20637
|
+
},
|
|
20638
|
+
children: /* @__PURE__ */ jsx(
|
|
20639
|
+
BaseSegmentedControl,
|
|
20640
|
+
{
|
|
20641
|
+
value: getOptionValue(resolvedLayoutOptions, resolvedValue.galleryLayout, "fixed"),
|
|
20642
|
+
options: resolvedLayoutOptions.map((option) => ({
|
|
20643
|
+
value: normalizeOptionValue(option.value),
|
|
20644
|
+
label: option.label,
|
|
20645
|
+
disabled: option.disabled
|
|
20646
|
+
})),
|
|
20647
|
+
onValueChange: (nextValue) => updateValue({ galleryLayout: nextValue }),
|
|
20648
|
+
className: cn("w-full", classNames?.control),
|
|
20649
|
+
classNames: compactSegmentedClassNames
|
|
20650
|
+
}
|
|
20651
|
+
)
|
|
20652
|
+
}
|
|
20653
|
+
) : null
|
|
20654
|
+
] }) : null
|
|
20655
|
+
] });
|
|
20656
|
+
}
|
|
20657
|
+
function WorkbenchGallerySettingsButton({
|
|
20658
|
+
open,
|
|
20659
|
+
defaultOpen = false,
|
|
20660
|
+
onOpenChange,
|
|
20661
|
+
triggerIcon,
|
|
20662
|
+
triggerLabel,
|
|
20663
|
+
triggerTitle,
|
|
20664
|
+
align = "end",
|
|
20665
|
+
popoverWidth = 320,
|
|
20666
|
+
panelHeader,
|
|
20667
|
+
panelBefore,
|
|
20668
|
+
panelAfter,
|
|
20669
|
+
panelClassName,
|
|
20670
|
+
buttonClassName,
|
|
20671
|
+
popoverClassName,
|
|
20672
|
+
buttonClassNames,
|
|
20673
|
+
labels,
|
|
20674
|
+
className,
|
|
20675
|
+
classNames,
|
|
20676
|
+
...panelProps
|
|
20677
|
+
}) {
|
|
20678
|
+
const resolvedLabels = { ...defaultLabels, ...labels };
|
|
20679
|
+
const rootRef = useRef(null);
|
|
20680
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
20681
|
+
const [popoverStyle, setPopoverStyle] = useState({});
|
|
20682
|
+
const isControlled = open !== void 0;
|
|
20683
|
+
const isOpen = isControlled ? Boolean(open) : uncontrolledOpen;
|
|
20684
|
+
const setOpen = (nextOpen) => {
|
|
20685
|
+
if (!isControlled) {
|
|
20686
|
+
setUncontrolledOpen(nextOpen);
|
|
20687
|
+
}
|
|
20688
|
+
onOpenChange?.(nextOpen);
|
|
20689
|
+
};
|
|
20690
|
+
useLayoutEffect(() => {
|
|
20691
|
+
if (!isOpen) return void 0;
|
|
20692
|
+
const updatePopoverPosition = () => {
|
|
20693
|
+
const triggerRect = rootRef.current?.getBoundingClientRect();
|
|
20694
|
+
if (!triggerRect || typeof window === "undefined") return;
|
|
20695
|
+
const viewportPadding = 12;
|
|
20696
|
+
const availableWidth = Math.max(window.innerWidth - viewportPadding * 2, 0);
|
|
20697
|
+
const resolvedWidth = Math.min(popoverWidth, availableWidth || popoverWidth);
|
|
20698
|
+
const preferredLeft = align === "start" ? triggerRect.left : triggerRect.right - resolvedWidth;
|
|
20699
|
+
const left = Math.min(
|
|
20700
|
+
Math.max(preferredLeft, viewportPadding),
|
|
20701
|
+
Math.max(window.innerWidth - resolvedWidth - viewportPadding, viewportPadding)
|
|
20702
|
+
);
|
|
20703
|
+
const top = Math.min(
|
|
20704
|
+
triggerRect.bottom + 8,
|
|
20705
|
+
Math.max(window.innerHeight - 80, viewportPadding)
|
|
20706
|
+
);
|
|
20707
|
+
setPopoverStyle({
|
|
20708
|
+
left,
|
|
20709
|
+
top,
|
|
20710
|
+
width: resolvedWidth,
|
|
20711
|
+
maxHeight: `calc(100vh - ${Math.round(top + viewportPadding)}px)`
|
|
20712
|
+
});
|
|
20713
|
+
};
|
|
20714
|
+
const handlePointerDown = (event) => {
|
|
20715
|
+
if (!rootRef.current?.contains(event.target)) {
|
|
20716
|
+
setOpen(false);
|
|
20717
|
+
}
|
|
20718
|
+
};
|
|
20719
|
+
const handleKeyDown = (event) => {
|
|
20720
|
+
if (event.key === "Escape") setOpen(false);
|
|
20721
|
+
};
|
|
20722
|
+
updatePopoverPosition();
|
|
20723
|
+
window.addEventListener("resize", updatePopoverPosition);
|
|
20724
|
+
window.addEventListener("scroll", updatePopoverPosition, true);
|
|
20725
|
+
window.addEventListener("pointerdown", handlePointerDown);
|
|
20726
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
20727
|
+
return () => {
|
|
20728
|
+
window.removeEventListener("resize", updatePopoverPosition);
|
|
20729
|
+
window.removeEventListener("scroll", updatePopoverPosition, true);
|
|
20730
|
+
window.removeEventListener("pointerdown", handlePointerDown);
|
|
20731
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
20732
|
+
};
|
|
20733
|
+
}, [align, isOpen, popoverWidth]);
|
|
20734
|
+
const resolvedTriggerLabel = triggerLabel ?? resolvedLabels.settingsButton;
|
|
20735
|
+
const resolvedPanelHeader = panelHeader ?? resolvedLabels.title;
|
|
20736
|
+
return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative inline-flex", buttonClassNames?.root, className), children: [
|
|
20737
|
+
/* @__PURE__ */ jsx(
|
|
20738
|
+
BaseButton,
|
|
20739
|
+
{
|
|
20740
|
+
icon: triggerIcon,
|
|
20741
|
+
label: resolvedTriggerLabel,
|
|
20742
|
+
title: triggerTitle || (typeof resolvedTriggerLabel === "string" ? resolvedTriggerLabel : void 0),
|
|
20743
|
+
iconOnly: Boolean(triggerIcon),
|
|
20744
|
+
active: isOpen,
|
|
20745
|
+
tone: "muted",
|
|
20746
|
+
"aria-haspopup": "dialog",
|
|
20747
|
+
"aria-expanded": isOpen,
|
|
20748
|
+
className: cn(buttonClassNames?.trigger, buttonClassName),
|
|
20749
|
+
onClick: () => setOpen(!isOpen)
|
|
20750
|
+
}
|
|
20751
|
+
),
|
|
20752
|
+
isOpen ? /* @__PURE__ */ jsxs(
|
|
20753
|
+
"div",
|
|
20754
|
+
{
|
|
20755
|
+
role: "dialog",
|
|
20756
|
+
"aria-label": typeof resolvedPanelHeader === "string" ? resolvedPanelHeader : void 0,
|
|
20757
|
+
className: cn(
|
|
20758
|
+
"fixed z-50 overflow-y-auto rounded-xl border border-border bg-card p-3 text-foreground shadow-lg",
|
|
20759
|
+
align === "start" ? "origin-top-left" : "origin-top-right",
|
|
20760
|
+
buttonClassNames?.popover,
|
|
20761
|
+
popoverClassName
|
|
20762
|
+
),
|
|
20763
|
+
style: popoverStyle,
|
|
20764
|
+
children: [
|
|
20765
|
+
resolvedPanelHeader ? /* @__PURE__ */ jsx("div", { className: cn("mb-3 text-[11px] font-medium text-foreground", buttonClassNames?.header), children: resolvedPanelHeader }) : null,
|
|
20766
|
+
panelBefore,
|
|
20767
|
+
/* @__PURE__ */ jsx(
|
|
20768
|
+
WorkbenchGallerySettingsPanel,
|
|
20769
|
+
{
|
|
20770
|
+
...panelProps,
|
|
20771
|
+
labels: resolvedLabels,
|
|
20772
|
+
className: cn(buttonClassNames?.panel, panelClassName),
|
|
20773
|
+
classNames
|
|
20774
|
+
}
|
|
20775
|
+
),
|
|
20776
|
+
panelAfter
|
|
20777
|
+
]
|
|
20778
|
+
}
|
|
20779
|
+
) : null
|
|
20780
|
+
] });
|
|
20781
|
+
}
|
|
20782
|
+
function TableViewIcon() {
|
|
20783
|
+
return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
20784
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
|
|
20785
|
+
/* @__PURE__ */ jsx("path", { d: "M3 10h18M9 4v16" })
|
|
20786
|
+
] });
|
|
20787
|
+
}
|
|
20788
|
+
function GalleryViewIcon() {
|
|
20789
|
+
return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
20790
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1.5" }),
|
|
20791
|
+
/* @__PURE__ */ jsx("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1.5" }),
|
|
20792
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1.5" }),
|
|
20793
|
+
/* @__PURE__ */ jsx("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1.5" })
|
|
20794
|
+
] });
|
|
20795
|
+
}
|
|
20796
|
+
function SettingsIcon() {
|
|
20797
|
+
return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
20798
|
+
/* @__PURE__ */ jsx("path", { d: "M20 7h-9M7 7H4M14 17H4M20 17h-3" }),
|
|
20799
|
+
/* @__PURE__ */ jsx("circle", { cx: "9", cy: "7", r: "2" }),
|
|
20800
|
+
/* @__PURE__ */ jsx("circle", { cx: "16", cy: "17", r: "2" })
|
|
20801
|
+
] });
|
|
20802
|
+
}
|
|
20803
|
+
function ChevronDownIcon3({ open }) {
|
|
20804
|
+
return /* @__PURE__ */ jsx(
|
|
20805
|
+
"svg",
|
|
20806
|
+
{
|
|
20807
|
+
"aria-hidden": "true",
|
|
20808
|
+
viewBox: "0 0 24 24",
|
|
20809
|
+
className: cn("h-3 w-3 opacity-55 transition-transform", open && "rotate-180"),
|
|
20810
|
+
fill: "none",
|
|
20811
|
+
stroke: "currentColor",
|
|
20812
|
+
strokeWidth: "2",
|
|
20813
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
20814
|
+
}
|
|
20815
|
+
);
|
|
20816
|
+
}
|
|
20817
|
+
var defaultViewModeOptions = [
|
|
20818
|
+
{ value: "list", label: "Table view", icon: /* @__PURE__ */ jsx(TableViewIcon, {}) },
|
|
20819
|
+
{ value: "gallery", label: "Gallery view", icon: /* @__PURE__ */ jsx(GalleryViewIcon, {}) }
|
|
20820
|
+
];
|
|
20821
|
+
function getViewModeOptionIcon(option) {
|
|
20822
|
+
if (option.icon !== void 0) return option.icon;
|
|
20823
|
+
if (option.value === "list" || option.value === "table") return /* @__PURE__ */ jsx(TableViewIcon, {});
|
|
20824
|
+
if (option.value === "gallery") return /* @__PURE__ */ jsx(GalleryViewIcon, {});
|
|
20825
|
+
return null;
|
|
20826
|
+
}
|
|
20827
|
+
function getSettingsTriggerLabel(settings) {
|
|
20828
|
+
return settings.triggerLabel ?? settings.labels?.settingsButton ?? "Settings";
|
|
20829
|
+
}
|
|
20830
|
+
function WorkbenchContentToolbarViewModeControl({
|
|
20831
|
+
value,
|
|
20832
|
+
options,
|
|
20833
|
+
onValueChange,
|
|
20834
|
+
classNames
|
|
20835
|
+
}) {
|
|
20836
|
+
const rootRef = useRef(null);
|
|
20837
|
+
const [open, setOpen] = useState(false);
|
|
20838
|
+
const activeOption = options.find((option) => option.value === value) || options.find((option) => !option.disabled) || options[0];
|
|
20839
|
+
const activeIcon = activeOption ? getViewModeOptionIcon(activeOption) : null;
|
|
20840
|
+
useEffect(() => {
|
|
20841
|
+
if (!open) return void 0;
|
|
20842
|
+
const handlePointerDown = (event) => {
|
|
20843
|
+
if (!rootRef.current?.contains(event.target)) {
|
|
20844
|
+
setOpen(false);
|
|
20845
|
+
}
|
|
20846
|
+
};
|
|
20847
|
+
const handleKeyDown = (event) => {
|
|
20848
|
+
if (event.key === "Escape") setOpen(false);
|
|
20849
|
+
};
|
|
20850
|
+
window.addEventListener("pointerdown", handlePointerDown);
|
|
20851
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
20852
|
+
return () => {
|
|
20853
|
+
window.removeEventListener("pointerdown", handlePointerDown);
|
|
20854
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
20855
|
+
};
|
|
20856
|
+
}, [open]);
|
|
20857
|
+
if (!activeOption) return null;
|
|
20858
|
+
return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative inline-flex", classNames?.viewModeRoot), children: [
|
|
20859
|
+
/* @__PURE__ */ jsxs(
|
|
20860
|
+
"button",
|
|
20861
|
+
{
|
|
20862
|
+
type: "button",
|
|
20863
|
+
"aria-haspopup": "listbox",
|
|
20864
|
+
"aria-expanded": open,
|
|
20865
|
+
className: cn(
|
|
20866
|
+
"inline-flex h-7 min-w-0 items-center justify-center gap-1.5 rounded-md border border-border/70 bg-card px-2 text-xs font-medium text-foreground shadow-none transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25",
|
|
20867
|
+
classNames?.viewModeTrigger
|
|
20868
|
+
),
|
|
20869
|
+
onClick: () => setOpen((current) => !current),
|
|
20870
|
+
children: [
|
|
20871
|
+
activeIcon ? /* @__PURE__ */ jsx("span", { className: "inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center text-muted-foreground", children: activeIcon }) : null,
|
|
20872
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: activeOption.label }),
|
|
20873
|
+
/* @__PURE__ */ jsx(ChevronDownIcon3, { open })
|
|
20874
|
+
]
|
|
20875
|
+
}
|
|
20876
|
+
),
|
|
20877
|
+
open ? /* @__PURE__ */ jsx(
|
|
20878
|
+
"div",
|
|
20879
|
+
{
|
|
20880
|
+
role: "listbox",
|
|
20881
|
+
className: cn(
|
|
20882
|
+
"absolute left-0 top-full z-50 mt-2 min-w-[160px] overflow-hidden rounded-xl border border-border/60 bg-card/95 p-1.5 text-xs text-foreground shadow-lg backdrop-blur-xl",
|
|
20883
|
+
classNames?.viewModeMenu
|
|
20884
|
+
),
|
|
20885
|
+
children: options.map((option) => {
|
|
20886
|
+
const selected = option.value === activeOption.value;
|
|
20887
|
+
const optionIcon = getViewModeOptionIcon(option);
|
|
20888
|
+
return /* @__PURE__ */ jsxs(
|
|
20889
|
+
"button",
|
|
20890
|
+
{
|
|
20891
|
+
type: "button",
|
|
20892
|
+
role: "option",
|
|
20893
|
+
"aria-selected": selected,
|
|
20894
|
+
disabled: option.disabled,
|
|
20895
|
+
className: cn(
|
|
20896
|
+
"flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/55 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
20897
|
+
selected && "bg-muted/60 text-foreground",
|
|
20898
|
+
classNames?.viewModeItem
|
|
20899
|
+
),
|
|
20900
|
+
onClick: () => {
|
|
20901
|
+
if (option.disabled) return;
|
|
20902
|
+
onValueChange?.(option.value, option);
|
|
20903
|
+
setOpen(false);
|
|
20904
|
+
},
|
|
20905
|
+
children: [
|
|
20906
|
+
optionIcon ? /* @__PURE__ */ jsx("span", { className: "inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center", children: optionIcon }) : null,
|
|
20907
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: option.label })
|
|
20908
|
+
]
|
|
20909
|
+
},
|
|
20910
|
+
option.value
|
|
20911
|
+
);
|
|
20912
|
+
})
|
|
20913
|
+
}
|
|
20914
|
+
) : null
|
|
20915
|
+
] });
|
|
20916
|
+
}
|
|
20917
|
+
var WorkbenchContentToolbar = forwardRef(
|
|
20918
|
+
function WorkbenchContentToolbar2({
|
|
20919
|
+
as: Component = "div",
|
|
20920
|
+
children,
|
|
20921
|
+
end,
|
|
20922
|
+
viewMode,
|
|
20923
|
+
viewModeOptions,
|
|
20924
|
+
onViewModeChange,
|
|
20925
|
+
gallerySettings,
|
|
20926
|
+
gallerySettingsPlacement = "start",
|
|
20927
|
+
className,
|
|
20928
|
+
startClassName,
|
|
20929
|
+
endClassName,
|
|
20930
|
+
classNames,
|
|
20931
|
+
...props
|
|
20932
|
+
}, ref) {
|
|
20933
|
+
const resolvedViewModeOptions = viewModeOptions || (viewMode ? defaultViewModeOptions : []);
|
|
20934
|
+
const resolvedGallerySettings = gallerySettings && typeof gallerySettings === "object" ? gallerySettings : null;
|
|
20935
|
+
const shouldRenderViewMode = Boolean(resolvedViewModeOptions.length);
|
|
20936
|
+
const shouldRenderSettings = Boolean(resolvedGallerySettings);
|
|
20937
|
+
const shouldRenderSettingsInStart = shouldRenderSettings && gallerySettingsPlacement !== "end";
|
|
20938
|
+
const shouldRenderSettingsInEnd = shouldRenderSettings && gallerySettingsPlacement === "end";
|
|
20939
|
+
const shouldRenderStart = shouldRenderViewMode || shouldRenderSettingsInStart || Boolean(children);
|
|
20940
|
+
const shouldRenderEnd = Boolean(end) || shouldRenderSettingsInEnd;
|
|
20941
|
+
return /* @__PURE__ */ jsxs(
|
|
20942
|
+
Component,
|
|
20943
|
+
{
|
|
20944
|
+
ref,
|
|
20945
|
+
"data-workbench-content-toolbar": true,
|
|
20946
|
+
className: cn(
|
|
20947
|
+
"flex min-h-[46px] shrink-0 flex-col gap-2 border-b border-border/60 px-4 py-2 md:flex-row md:items-center md:justify-between",
|
|
20948
|
+
classNames?.root,
|
|
20949
|
+
className
|
|
20950
|
+
),
|
|
20951
|
+
...props,
|
|
20952
|
+
children: [
|
|
20953
|
+
shouldRenderStart ? /* @__PURE__ */ jsxs("div", { className: cn("flex flex-wrap items-center gap-2", classNames?.start, startClassName), children: [
|
|
20954
|
+
shouldRenderViewMode ? /* @__PURE__ */ jsx(
|
|
20955
|
+
WorkbenchContentToolbarViewModeControl,
|
|
20956
|
+
{
|
|
20957
|
+
value: viewMode,
|
|
20958
|
+
options: resolvedViewModeOptions,
|
|
20959
|
+
onValueChange: onViewModeChange,
|
|
20960
|
+
classNames
|
|
20961
|
+
}
|
|
20962
|
+
) : null,
|
|
20963
|
+
shouldRenderSettingsInStart && resolvedGallerySettings ? /* @__PURE__ */ jsx(
|
|
20964
|
+
WorkbenchGallerySettingsButton,
|
|
20965
|
+
{
|
|
20966
|
+
align: "end",
|
|
20967
|
+
triggerIcon: /* @__PURE__ */ jsx(SettingsIcon, {}),
|
|
20968
|
+
triggerLabel: getSettingsTriggerLabel(resolvedGallerySettings),
|
|
20969
|
+
...resolvedGallerySettings,
|
|
20970
|
+
buttonClassName: cn(
|
|
20971
|
+
"!h-7 !w-7 !min-h-0 !rounded-md !p-0 text-xs",
|
|
20972
|
+
classNames?.settings,
|
|
20973
|
+
resolvedGallerySettings.buttonClassName
|
|
20974
|
+
)
|
|
20975
|
+
}
|
|
20976
|
+
) : null,
|
|
20977
|
+
children
|
|
20978
|
+
] }) : null,
|
|
20979
|
+
shouldRenderEnd ? /* @__PURE__ */ jsxs("div", { className: cn("flex shrink-0 items-center gap-2", classNames?.end, endClassName), children: [
|
|
20980
|
+
end,
|
|
20981
|
+
shouldRenderSettingsInEnd && resolvedGallerySettings ? /* @__PURE__ */ jsx(
|
|
20982
|
+
WorkbenchGallerySettingsButton,
|
|
20983
|
+
{
|
|
20984
|
+
align: "end",
|
|
20985
|
+
triggerIcon: /* @__PURE__ */ jsx(SettingsIcon, {}),
|
|
20986
|
+
triggerLabel: getSettingsTriggerLabel(resolvedGallerySettings),
|
|
20987
|
+
...resolvedGallerySettings,
|
|
20988
|
+
buttonClassName: cn(
|
|
20989
|
+
"!h-7 !w-7 !min-h-0 !rounded-md !p-0 text-xs",
|
|
20990
|
+
classNames?.settings,
|
|
20991
|
+
resolvedGallerySettings.buttonClassName
|
|
20992
|
+
)
|
|
20993
|
+
}
|
|
20994
|
+
) : null
|
|
20995
|
+
] }) : null
|
|
20996
|
+
]
|
|
20997
|
+
}
|
|
20998
|
+
);
|
|
20999
|
+
}
|
|
21000
|
+
);
|
|
21001
|
+
function shouldRenderBodyWrapper2(props) {
|
|
21002
|
+
return Boolean(
|
|
21003
|
+
props.header || props.footer || props.bodyAs || props.bodyClassName || props.bodyProps || props.classNames?.body
|
|
21004
|
+
);
|
|
21005
|
+
}
|
|
21006
|
+
function hasRenderableChildren(children) {
|
|
21007
|
+
if (children === null || children === void 0 || typeof children === "boolean") return false;
|
|
21008
|
+
if (typeof children === "string") return children.trim().length > 0;
|
|
21009
|
+
if (Array.isArray(children)) return children.some(hasRenderableChildren);
|
|
21010
|
+
const childList = Children.toArray(children);
|
|
21011
|
+
if (!childList.length) return false;
|
|
21012
|
+
return childList.some((child) => typeof child === "string" ? child.trim().length > 0 : true);
|
|
21013
|
+
}
|
|
21014
|
+
function resolveWidthStyle(open, width) {
|
|
21015
|
+
if (width === void 0) return {};
|
|
21016
|
+
if (open === void 0) return { width };
|
|
21017
|
+
return {
|
|
21018
|
+
width: open ? width : 0,
|
|
21019
|
+
opacity: open ? 1 : 0
|
|
21020
|
+
};
|
|
21021
|
+
}
|
|
21022
|
+
function getFallbackFieldLabel(field) {
|
|
21023
|
+
return field.label ?? field.key;
|
|
21024
|
+
}
|
|
21025
|
+
function getObjectDisplayValue(value) {
|
|
21026
|
+
const displayKeys = ["text", "label", "title", "display", "value", "recordId"];
|
|
21027
|
+
for (const key of displayKeys) {
|
|
21028
|
+
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
21029
|
+
const displayValue = value[key];
|
|
21030
|
+
if (displayValue !== null && displayValue !== void 0 && displayValue !== "") {
|
|
21031
|
+
return displayValue;
|
|
21032
|
+
}
|
|
21033
|
+
}
|
|
21034
|
+
return void 0;
|
|
21035
|
+
}
|
|
21036
|
+
function isEmptyDetailValue(value) {
|
|
21037
|
+
return value === null || value === void 0 || value === "";
|
|
21038
|
+
}
|
|
21039
|
+
function isPlainDisplayValue(value) {
|
|
21040
|
+
return ["string", "number", "boolean"].includes(typeof value);
|
|
21041
|
+
}
|
|
21042
|
+
function getMediaDisplayData(value) {
|
|
21043
|
+
if (!value) return null;
|
|
21044
|
+
if (typeof value === "string") {
|
|
21045
|
+
const isDataImage = value.startsWith("data:image/");
|
|
21046
|
+
const isImageUrl = /\.(avif|gif|jpe?g|png|svg|webp)(\?.*)?$/i.test(value);
|
|
21047
|
+
return isDataImage || isImageUrl ? { src: value } : null;
|
|
21048
|
+
}
|
|
21049
|
+
if (typeof value !== "object" || isValidElement(value)) return null;
|
|
21050
|
+
const media = value;
|
|
21051
|
+
const src = media.src || media.url || media.thumbnail || media.preview || media.image;
|
|
21052
|
+
return src ? {
|
|
21053
|
+
src: String(src),
|
|
21054
|
+
alt: media.alt || media.label || media.title || "",
|
|
21055
|
+
caption: media.caption || media.description || media.label || media.title
|
|
21056
|
+
} : null;
|
|
21057
|
+
}
|
|
21058
|
+
function shouldRenderAsMedia(field, value) {
|
|
21059
|
+
const renderType = String(field?.renderType || "").toLowerCase();
|
|
21060
|
+
return ["image", "media", "preview", "thumbnail"].includes(renderType) || Boolean(getMediaDisplayData(value));
|
|
21061
|
+
}
|
|
21062
|
+
function renderMaybeFieldIcon(icon, className) {
|
|
21063
|
+
if (!icon) {
|
|
21064
|
+
return /* @__PURE__ */ jsxs("span", { className: cn("relative inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center", className), children: [
|
|
21065
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 rounded-full border border-primary/25 bg-primary/10" }),
|
|
21066
|
+
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-primary" })
|
|
21067
|
+
] });
|
|
21068
|
+
}
|
|
21069
|
+
if (typeof icon === "string" || typeof icon === "number") {
|
|
21070
|
+
return /* @__PURE__ */ jsx("span", { className: cn("inline-flex h-3.5 min-w-3.5 shrink-0 items-center justify-center rounded-sm text-[10px] font-semibold text-primary", className), children: icon });
|
|
21071
|
+
}
|
|
21072
|
+
if (typeof icon === "boolean") return null;
|
|
21073
|
+
if (isValidElement(icon)) return icon;
|
|
21074
|
+
const IconComponent = icon;
|
|
21075
|
+
return /* @__PURE__ */ jsx(IconComponent, { className: cn("h-3.5 w-3.5 shrink-0 text-primary", className) });
|
|
21076
|
+
}
|
|
21077
|
+
function renderDetailFieldLabel(label, field, classNames) {
|
|
21078
|
+
return /* @__PURE__ */ jsxs("span", { className: cn("inline-flex min-w-0 items-center gap-1.5 text-[11px] font-semibold text-foreground", classNames?.fieldLabel), children: [
|
|
21079
|
+
renderMaybeFieldIcon(field.labelIcon || field.icon, classNames?.fieldLabelIcon),
|
|
21080
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: label })
|
|
21081
|
+
] });
|
|
21082
|
+
}
|
|
21083
|
+
function WorkbenchDetailSidebarMediaValue({
|
|
21084
|
+
media,
|
|
21085
|
+
classNames
|
|
21086
|
+
}) {
|
|
21087
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("grid gap-2", classNames?.mediaValue), children: [
|
|
21088
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-md border border-border/55 bg-muted/20 dark:border-border/45 dark:bg-muted/10", children: /* @__PURE__ */ jsx(
|
|
21089
|
+
"img",
|
|
21090
|
+
{
|
|
21091
|
+
src: media.src,
|
|
21092
|
+
alt: String(media.alt || ""),
|
|
21093
|
+
className: cn("block aspect-[16/9] w-full object-cover", classNames?.mediaImage)
|
|
21094
|
+
}
|
|
21095
|
+
) }),
|
|
21096
|
+
media.caption ? /* @__PURE__ */ jsx("div", { className: cn("truncate text-[11px] leading-4 text-muted-foreground", classNames?.mediaCaption), children: media.caption }) : null
|
|
21097
|
+
] });
|
|
21098
|
+
}
|
|
21099
|
+
function getDefaultDetailDisplayValue(value, emptyValue, field, classNames) {
|
|
21100
|
+
if (isEmptyDetailValue(value)) return emptyValue;
|
|
21101
|
+
if (isValidElement(value)) return value;
|
|
21102
|
+
if (shouldRenderAsMedia(field, value)) {
|
|
21103
|
+
const media = getMediaDisplayData(value);
|
|
21104
|
+
if (media) return /* @__PURE__ */ jsx(WorkbenchDetailSidebarMediaValue, { media, classNames });
|
|
21105
|
+
}
|
|
21106
|
+
if (Array.isArray(value)) {
|
|
21107
|
+
const parts = value.map((item) => getDefaultDetailDisplayValue(item, "", void 0, classNames)).filter((item) => !isEmptyDetailValue(item));
|
|
21108
|
+
if (!parts.length) return emptyValue;
|
|
21109
|
+
if (parts.every(isPlainDisplayValue)) return parts.map(String).join(" \xB7 ");
|
|
21110
|
+
return /* @__PURE__ */ jsx("span", { className: "inline-flex flex-wrap items-center gap-1", children: parts.map((part, index) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1", children: [
|
|
21111
|
+
index > 0 ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\xB7" }) : null,
|
|
21112
|
+
isPlainDisplayValue(part) ? String(part) : part
|
|
21113
|
+
] }, index)) });
|
|
21114
|
+
}
|
|
21115
|
+
if (typeof value === "object") {
|
|
21116
|
+
const displayValue = getObjectDisplayValue(value);
|
|
21117
|
+
return displayValue === void 0 ? emptyValue : getDefaultDetailDisplayValue(displayValue, emptyValue, field, classNames);
|
|
21118
|
+
}
|
|
21119
|
+
return String(value);
|
|
21120
|
+
}
|
|
21121
|
+
function getDefaultFieldValue(field, record) {
|
|
21122
|
+
if (Object.prototype.hasOwnProperty.call(field, "value")) {
|
|
21123
|
+
return typeof field.value === "function" ? field.value(record, field) : field.value;
|
|
21124
|
+
}
|
|
21125
|
+
return record ? record?.[field.key] : void 0;
|
|
21126
|
+
}
|
|
21127
|
+
function shouldHideField(field, record) {
|
|
21128
|
+
return typeof field.hidden === "function" ? field.hidden(field, record) : Boolean(field.hidden);
|
|
21129
|
+
}
|
|
21130
|
+
function shouldHideSection(section, record) {
|
|
21131
|
+
return typeof section.hidden === "function" ? section.hidden(section, record) : Boolean(section.hidden);
|
|
21132
|
+
}
|
|
21133
|
+
function WorkbenchDetailSidebarAutoContent({
|
|
21134
|
+
record,
|
|
21135
|
+
fields,
|
|
21136
|
+
sections,
|
|
21137
|
+
fieldColumns = 1,
|
|
21138
|
+
emptyValue = "\u2014",
|
|
21139
|
+
emptyState,
|
|
21140
|
+
getFieldValue,
|
|
21141
|
+
renderFieldValue,
|
|
21142
|
+
formatFieldValue,
|
|
21143
|
+
formatFieldLabel,
|
|
21144
|
+
classNames
|
|
21145
|
+
}) {
|
|
21146
|
+
const resolvedSections = sections?.length ? sections : fields?.length ? [{ fields, columns: fieldColumns }] : [];
|
|
21147
|
+
const visibleSections = resolvedSections.filter((section) => !shouldHideSection(section, record));
|
|
21148
|
+
if (!visibleSections.length) {
|
|
21149
|
+
return emptyState ? /* @__PURE__ */ jsx("div", { className: cn("rounded-lg border border-dashed border-border/60 px-3 py-6 text-center text-xs text-muted-foreground", classNames?.emptyState), children: emptyState }) : null;
|
|
21150
|
+
}
|
|
21151
|
+
return /* @__PURE__ */ jsx("div", { className: cn("space-y-3", classNames?.autoBody), children: visibleSections.map((section, sectionIndex) => {
|
|
21152
|
+
const visibleFields = (section.fields || []).filter((field) => !shouldHideField(field, record));
|
|
21153
|
+
const sectionKey = section.id || `section-${sectionIndex}`;
|
|
21154
|
+
if (!visibleFields.length && !section.emptyState) return null;
|
|
21155
|
+
const items = visibleFields.map((field, fieldIndex) => {
|
|
21156
|
+
const context = {
|
|
21157
|
+
field,
|
|
21158
|
+
fieldIndex,
|
|
21159
|
+
section,
|
|
21160
|
+
sectionIndex,
|
|
21161
|
+
record
|
|
21162
|
+
};
|
|
21163
|
+
const rawValue = getFieldValue ? getFieldValue(field, record, context) : getDefaultFieldValue(field, record);
|
|
21164
|
+
const value = renderFieldValue ? renderFieldValue(field, record, context) : formatFieldValue ? formatFieldValue(rawValue, context) : getDefaultDetailDisplayValue(rawValue, field.emptyValue ?? emptyValue, field, classNames);
|
|
21165
|
+
const fieldLabel = formatFieldLabel ? formatFieldLabel(getFallbackFieldLabel(field), context) : getFallbackFieldLabel(field);
|
|
21166
|
+
return {
|
|
21167
|
+
term: renderDetailFieldLabel(fieldLabel, field, classNames),
|
|
21168
|
+
value
|
|
21169
|
+
};
|
|
21170
|
+
});
|
|
21171
|
+
return /* @__PURE__ */ jsxs("section", { className: cn("min-w-0 space-y-3", classNames?.section), children: [
|
|
21172
|
+
section.title || section.description ? /* @__PURE__ */ jsxs("div", { className: cn("min-w-0 space-y-1.5", classNames?.sectionHeader), children: [
|
|
21173
|
+
section.title ? /* @__PURE__ */ jsx("div", { className: cn("inline-flex max-w-full items-center gap-2 rounded-md border border-primary/20 bg-primary/5 px-2.5 py-1.5 text-xs font-medium text-primary dark:border-primary/25 dark:bg-primary/10", classNames?.sectionTitle), children: section.title }) : null,
|
|
21174
|
+
section.description ? /* @__PURE__ */ jsx("div", { className: cn("text-[11px] leading-5 text-muted-foreground", classNames?.sectionDescription), children: section.description }) : null
|
|
21175
|
+
] }) : null,
|
|
21176
|
+
items.length ? /* @__PURE__ */ jsx(
|
|
21177
|
+
BaseDescriptionList,
|
|
21178
|
+
{
|
|
21179
|
+
items,
|
|
21180
|
+
columns: section.columns || fieldColumns,
|
|
21181
|
+
className: cn("gap-3", classNames?.descriptionList),
|
|
21182
|
+
classNames: {
|
|
21183
|
+
item: cn("!border-0 !bg-transparent !p-0 !shadow-none !gap-1.5", classNames?.descriptionListItem),
|
|
21184
|
+
term: cn("!normal-case !tracking-normal !text-foreground", classNames?.descriptionListTerm),
|
|
21185
|
+
value: cn(
|
|
21186
|
+
"min-h-10 rounded-md border border-border/55 bg-muted/25 px-3 py-2 text-xs leading-5 text-foreground shadow-[inset_0_1px_0_hsl(var(--background)/0.8)] dark:border-border/45 dark:bg-white/[0.035]",
|
|
21187
|
+
classNames?.fieldValue,
|
|
21188
|
+
classNames?.descriptionListValue
|
|
21189
|
+
)
|
|
21190
|
+
}
|
|
21191
|
+
}
|
|
21192
|
+
) : /* @__PURE__ */ jsx("div", { className: cn("py-3 text-center text-xs text-muted-foreground", classNames?.emptyState), children: section.emptyState })
|
|
21193
|
+
] }, sectionKey);
|
|
21194
|
+
}) });
|
|
21195
|
+
}
|
|
21196
|
+
var WorkbenchDetailSidebar = forwardRef(
|
|
21197
|
+
function WorkbenchDetailSidebar2({
|
|
21198
|
+
as: Component = "aside",
|
|
21199
|
+
bodyAs: BodyComponent = "div",
|
|
21200
|
+
open,
|
|
21201
|
+
width,
|
|
21202
|
+
header,
|
|
21203
|
+
footer,
|
|
21204
|
+
resizeHandle,
|
|
21205
|
+
children,
|
|
21206
|
+
record,
|
|
21207
|
+
fields,
|
|
21208
|
+
sections,
|
|
21209
|
+
fieldColumns,
|
|
21210
|
+
emptyValue,
|
|
21211
|
+
emptyState,
|
|
21212
|
+
getFieldValue,
|
|
21213
|
+
renderFieldValue,
|
|
21214
|
+
formatFieldValue,
|
|
21215
|
+
formatFieldLabel,
|
|
21216
|
+
className,
|
|
21217
|
+
headerClassName,
|
|
21218
|
+
bodyClassName,
|
|
21219
|
+
footerClassName,
|
|
21220
|
+
resizeHandleClassName,
|
|
21221
|
+
bodyProps,
|
|
21222
|
+
classNames,
|
|
21223
|
+
style,
|
|
21224
|
+
...props
|
|
21225
|
+
}, ref) {
|
|
21226
|
+
const autoContent = hasRenderableChildren(children) ? children : /* @__PURE__ */ jsx(
|
|
21227
|
+
WorkbenchDetailSidebarAutoContent,
|
|
21228
|
+
{
|
|
21229
|
+
record,
|
|
21230
|
+
fields,
|
|
21231
|
+
sections,
|
|
21232
|
+
fieldColumns,
|
|
21233
|
+
emptyValue,
|
|
21234
|
+
emptyState,
|
|
21235
|
+
getFieldValue,
|
|
21236
|
+
renderFieldValue,
|
|
21237
|
+
formatFieldValue,
|
|
21238
|
+
formatFieldLabel,
|
|
21239
|
+
classNames
|
|
21240
|
+
}
|
|
21241
|
+
);
|
|
21242
|
+
const renderBodyWrapper = shouldRenderBodyWrapper2({
|
|
21243
|
+
header,
|
|
21244
|
+
footer,
|
|
21245
|
+
bodyAs: BodyComponent === "div" ? void 0 : BodyComponent,
|
|
21246
|
+
bodyClassName,
|
|
21247
|
+
bodyProps,
|
|
21248
|
+
classNames
|
|
21249
|
+
});
|
|
21250
|
+
const { className: bodyPropsClassName, ...restBodyProps } = bodyProps ?? {};
|
|
21251
|
+
return /* @__PURE__ */ jsxs(
|
|
21252
|
+
Component,
|
|
21253
|
+
{
|
|
21254
|
+
ref,
|
|
21255
|
+
"data-workbench-detail-sidebar": true,
|
|
21256
|
+
"data-open": open === void 0 ? void 0 : open ? "true" : "false",
|
|
21257
|
+
className: cn(
|
|
21258
|
+
"workbench-surface-subtle relative flex flex-shrink-0 flex-col self-stretch overflow-hidden rounded-lg border border-border/50 transition-all duration-300 dark:border-border/40",
|
|
21259
|
+
open === false && "pointer-events-none",
|
|
21260
|
+
classNames?.root,
|
|
21261
|
+
className
|
|
21262
|
+
),
|
|
21263
|
+
style: {
|
|
21264
|
+
...resolveWidthStyle(open, width),
|
|
21265
|
+
...style
|
|
21266
|
+
},
|
|
21267
|
+
...props,
|
|
21268
|
+
children: [
|
|
21269
|
+
resizeHandle ? /* @__PURE__ */ jsx("div", { className: cn(classNames?.resizeHandle, resizeHandleClassName), children: resizeHandle }) : null,
|
|
21270
|
+
header ? /* @__PURE__ */ jsx("div", { className: cn("shrink-0 border-b border-border/40 px-4 py-3 dark:border-border/30", classNames?.header, headerClassName), children: header }) : null,
|
|
21271
|
+
renderBodyWrapper ? /* @__PURE__ */ jsx(
|
|
21272
|
+
BodyComponent,
|
|
21273
|
+
{
|
|
21274
|
+
className: cn("min-h-0 flex-1 overflow-y-auto", classNames?.body, bodyClassName, bodyPropsClassName),
|
|
21275
|
+
...restBodyProps,
|
|
21276
|
+
children: autoContent
|
|
21277
|
+
}
|
|
21278
|
+
) : autoContent,
|
|
21279
|
+
footer ? /* @__PURE__ */ jsx("div", { className: cn("shrink-0 border-t border-border/40 px-4 py-3 dark:border-border/30", classNames?.footer, footerClassName), children: footer }) : null
|
|
21280
|
+
]
|
|
21281
|
+
}
|
|
21282
|
+
);
|
|
21283
|
+
}
|
|
21284
|
+
);
|
|
21285
|
+
function isWorkbenchIconComponent(icon) {
|
|
21286
|
+
if (typeof icon === "function") return true;
|
|
21287
|
+
return typeof icon === "object" && icon !== null && !isValidElement(icon) && "$$typeof" in icon;
|
|
21288
|
+
}
|
|
21289
|
+
function renderWorkbenchIcon(icon, className) {
|
|
21290
|
+
if (!icon) return null;
|
|
21291
|
+
if (isValidElement(icon)) return icon;
|
|
21292
|
+
if (isWorkbenchIconComponent(icon)) {
|
|
21293
|
+
const Icon = icon;
|
|
21294
|
+
return /* @__PURE__ */ jsx(Icon, { className });
|
|
21295
|
+
}
|
|
21296
|
+
return icon;
|
|
21297
|
+
}
|
|
21298
|
+
function getWorkbenchIconComponent(icon) {
|
|
21299
|
+
if (!icon || !isWorkbenchIconComponent(icon)) return null;
|
|
21300
|
+
return icon;
|
|
21301
|
+
}
|
|
21302
|
+
function toCssSize2(value) {
|
|
21303
|
+
if (value === void 0) return void 0;
|
|
21304
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
21305
|
+
}
|
|
21306
|
+
function defaultFormatLabel(value) {
|
|
21307
|
+
if (value === void 0 || value === null || value === false) return null;
|
|
21308
|
+
return value;
|
|
21309
|
+
}
|
|
21310
|
+
function toTitle(value) {
|
|
21311
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
21312
|
+
return void 0;
|
|
21313
|
+
}
|
|
21314
|
+
function defaultGetRowKey(row, rowIndex) {
|
|
21315
|
+
return row?.id ?? row?.key ?? row?.linkKey ?? rowIndex;
|
|
21316
|
+
}
|
|
21317
|
+
function defaultGetRowSelectionKey(row) {
|
|
21318
|
+
return row?.linkKey ?? row?.id ?? row?.key;
|
|
21319
|
+
}
|
|
21320
|
+
function getOrderedColumns(columns, columnOrder) {
|
|
21321
|
+
if (!columnOrder?.length) return columns;
|
|
21322
|
+
const columnMap = new Map(columns.map((column) => [column.key, column]));
|
|
21323
|
+
const orderedColumns = columnOrder.map((columnKey) => columnMap.get(columnKey)).filter(Boolean);
|
|
21324
|
+
const orderedKeySet = new Set(orderedColumns.map((column) => column.key));
|
|
21325
|
+
const remainingColumns = columns.filter((column) => !orderedKeySet.has(column.key));
|
|
21326
|
+
return [...orderedColumns, ...remainingColumns];
|
|
21327
|
+
}
|
|
21328
|
+
function normalizeColumnOrder(columnKeys, columnOrder) {
|
|
21329
|
+
const validColumnKeys = new Set(columnKeys);
|
|
21330
|
+
const orderedKeys = (columnOrder || []).filter((columnKey) => validColumnKeys.has(columnKey));
|
|
21331
|
+
const orderedKeySet = new Set(orderedKeys);
|
|
21332
|
+
const remainingKeys = columnKeys.filter((columnKey) => !orderedKeySet.has(columnKey));
|
|
21333
|
+
return [...orderedKeys, ...remainingKeys];
|
|
21334
|
+
}
|
|
21335
|
+
function WorkbenchTableHeaderHelper({
|
|
21336
|
+
helperText,
|
|
21337
|
+
className
|
|
21338
|
+
}) {
|
|
21339
|
+
if (!hasRenderableNode(helperText)) return null;
|
|
21340
|
+
return /* @__PURE__ */ jsxs("span", { className: cn("group relative inline-flex items-center", className), children: [
|
|
21341
|
+
/* @__PURE__ */ jsx(
|
|
21342
|
+
"button",
|
|
21343
|
+
{
|
|
21344
|
+
type: "button",
|
|
21345
|
+
title: toTitle(helperText),
|
|
21346
|
+
"aria-label": toTitle(helperText) || "Field help",
|
|
21347
|
+
className: "inline-flex h-4 w-4 items-center justify-center rounded-full border border-border/60 bg-background text-[10px] font-semibold normal-case tracking-normal text-muted-foreground shadow-sm transition-colors hover:border-primary/40 hover:text-primary focus-visible:border-primary/40 focus-visible:text-primary focus-visible:outline-none",
|
|
21348
|
+
onClick: (event) => event.stopPropagation(),
|
|
21349
|
+
children: "?"
|
|
21350
|
+
}
|
|
21351
|
+
),
|
|
21352
|
+
/* @__PURE__ */ jsx(
|
|
21353
|
+
"span",
|
|
21354
|
+
{
|
|
21355
|
+
role: "tooltip",
|
|
21356
|
+
className: "pointer-events-none absolute left-1/2 top-full z-40 mt-2 hidden w-72 -translate-x-1/2 whitespace-pre-line rounded-lg border border-border/60 bg-card px-3 py-2 text-[11px] font-normal normal-case leading-5 tracking-normal text-foreground shadow-sm backdrop-blur-sm group-hover:block group-focus-within:block",
|
|
21357
|
+
children: helperText
|
|
21358
|
+
}
|
|
21359
|
+
)
|
|
21360
|
+
] });
|
|
21361
|
+
}
|
|
21362
|
+
function WorkbenchTableView({
|
|
21363
|
+
rows = [],
|
|
21364
|
+
columns = [],
|
|
21365
|
+
onRowClick,
|
|
21366
|
+
selectedRowKey,
|
|
21367
|
+
selectedLinkKey,
|
|
21368
|
+
activePrimaryColumn,
|
|
21369
|
+
activeTablePrimaryColumn,
|
|
21370
|
+
renderedRowCount,
|
|
21371
|
+
totalRowCount,
|
|
21372
|
+
tableMinWidth,
|
|
21373
|
+
minWidth,
|
|
21374
|
+
bodyMaxHeight = "min(58vh, 38rem)",
|
|
21375
|
+
stickyFirstColumn = true,
|
|
21376
|
+
appearance,
|
|
21377
|
+
columnOrder,
|
|
21378
|
+
columnSizes,
|
|
21379
|
+
columnDragEnabled,
|
|
21380
|
+
columnResizeEnabled,
|
|
21381
|
+
className,
|
|
21382
|
+
tableClassName,
|
|
21383
|
+
rowClassName,
|
|
21384
|
+
classNames,
|
|
21385
|
+
style,
|
|
21386
|
+
renderCell,
|
|
21387
|
+
renderFieldValue,
|
|
21388
|
+
renderColumnHeader,
|
|
21389
|
+
onColumnOrderChange,
|
|
21390
|
+
onColumnSizeChange,
|
|
21391
|
+
onSort,
|
|
21392
|
+
formatLabel = defaultFormatLabel,
|
|
21393
|
+
getColumnDataType,
|
|
21394
|
+
getColumnIcon,
|
|
21395
|
+
getColumnTypeIcon,
|
|
21396
|
+
getRowKey = defaultGetRowKey,
|
|
21397
|
+
getRowSelectionKey = defaultGetRowSelectionKey,
|
|
21398
|
+
isActionColumn,
|
|
21399
|
+
isActionField,
|
|
21400
|
+
isRowDisabled,
|
|
21401
|
+
isWorkbenchPlaceholderRow,
|
|
21402
|
+
emptyState = "-",
|
|
21403
|
+
hiddenRowsMessage
|
|
21404
|
+
}) {
|
|
21405
|
+
const columnKeySignature = columns.map((column) => column.key).join("");
|
|
21406
|
+
const defaultColumnOrder = useMemo(() => columnKeySignature ? columnKeySignature.split("") : [], [columnKeySignature]);
|
|
21407
|
+
const [internalColumnOrder, setInternalColumnOrder] = useState(defaultColumnOrder);
|
|
21408
|
+
const [internalColumnSizes, setInternalColumnSizes] = useState({});
|
|
21409
|
+
useEffect(() => {
|
|
21410
|
+
setInternalColumnOrder((current) => normalizeColumnOrder(defaultColumnOrder, current));
|
|
21411
|
+
}, [defaultColumnOrder]);
|
|
21412
|
+
const resolvedColumnOrder = columnOrder ? normalizeColumnOrder(defaultColumnOrder, columnOrder) : internalColumnOrder;
|
|
21413
|
+
const resolvedColumnSizes = columnSizes ?? internalColumnSizes;
|
|
21414
|
+
const handleColumnOrderChange = useCallback((nextOrder, detail) => {
|
|
21415
|
+
const normalizedOrder = normalizeColumnOrder(defaultColumnOrder, nextOrder);
|
|
21416
|
+
if (!columnOrder) {
|
|
21417
|
+
setInternalColumnOrder(normalizedOrder);
|
|
21418
|
+
}
|
|
21419
|
+
onColumnOrderChange?.(normalizedOrder, detail);
|
|
21420
|
+
}, [columnOrder, defaultColumnOrder, onColumnOrderChange]);
|
|
21421
|
+
const handleColumnSizeChange = useCallback((columnId, width, detail) => {
|
|
21422
|
+
if (!columnSizes) {
|
|
21423
|
+
setInternalColumnSizes((current) => ({
|
|
21424
|
+
...current,
|
|
21425
|
+
[columnId]: width
|
|
21426
|
+
}));
|
|
21427
|
+
}
|
|
21428
|
+
onColumnSizeChange?.(columnId, width, detail);
|
|
21429
|
+
}, [columnSizes, onColumnSizeChange]);
|
|
21430
|
+
const resolvedSelectedKey = selectedRowKey ?? selectedLinkKey;
|
|
21431
|
+
const resolvedActivePrimaryColumn = activePrimaryColumn ?? activeTablePrimaryColumn;
|
|
21432
|
+
const orderedColumns = getOrderedColumns(columns, resolvedColumnOrder);
|
|
21433
|
+
const hiddenRowCount = Math.max(0, Number(totalRowCount || rows.length) - Number(renderedRowCount || rows.length));
|
|
21434
|
+
const resolvedMinWidth = tableMinWidth ?? minWidth ?? Math.max(760, Math.min(orderedColumns.length * 112, 1440));
|
|
21435
|
+
const renderValue = renderCell ?? renderFieldValue ?? ((column, row) => row?.[column.key]);
|
|
21436
|
+
const isAction = isActionColumn ?? isActionField ?? (() => false);
|
|
21437
|
+
const isDisabled = isRowDisabled ?? isWorkbenchPlaceholderRow ?? (() => false);
|
|
21438
|
+
const resolveColumnIcon = getColumnIcon ?? getColumnTypeIcon;
|
|
21439
|
+
const footer = hiddenRowCount > 0 && hiddenRowsMessage ? typeof hiddenRowsMessage === "function" ? hiddenRowsMessage(hiddenRowCount, renderedRowCount || rows.length, totalRowCount || rows.length) : hiddenRowsMessage : null;
|
|
21440
|
+
return /* @__PURE__ */ jsxs(
|
|
21441
|
+
BaseTableContainer,
|
|
21442
|
+
{
|
|
21443
|
+
appearance,
|
|
21444
|
+
className: cn("w-full overflow-hidden rounded-lg border border-border/40 bg-muted/15 dark:border-border/35 dark:bg-muted/10", classNames?.root, className),
|
|
21445
|
+
style,
|
|
21446
|
+
children: [
|
|
21447
|
+
/* @__PURE__ */ jsx(
|
|
21448
|
+
"div",
|
|
21449
|
+
{
|
|
21450
|
+
className: cn("w-full overflow-auto", classNames?.scrollArea),
|
|
21451
|
+
style: { maxHeight: toCssSize2(bodyMaxHeight) },
|
|
21452
|
+
children: /* @__PURE__ */ jsxs(
|
|
21453
|
+
BaseTable,
|
|
21454
|
+
{
|
|
21455
|
+
appearance,
|
|
21456
|
+
columnOrder: resolvedColumnOrder,
|
|
21457
|
+
columnSizes: resolvedColumnSizes,
|
|
21458
|
+
columnDragEnabled,
|
|
21459
|
+
columnResizeEnabled,
|
|
21460
|
+
onColumnOrderChange: handleColumnOrderChange,
|
|
21461
|
+
onColumnSizeChange: handleColumnSizeChange,
|
|
21462
|
+
className: cn("w-full table-auto text-left text-xs", classNames?.table, tableClassName),
|
|
21463
|
+
style: { minWidth: resolvedMinWidth },
|
|
21464
|
+
children: [
|
|
21465
|
+
/* @__PURE__ */ jsx(BaseTableHeader, { appearance, className: cn("text-[10px] font-mono uppercase tracking-wide text-muted-foreground", classNames?.header), children: /* @__PURE__ */ jsx(BaseTableRow, { className: cn("hover:bg-transparent", classNames?.headerRow), children: orderedColumns.map((column, columnIndex) => {
|
|
21466
|
+
const columnType = column.renderType || column.type || getColumnDataType?.(column.key, rows, column);
|
|
21467
|
+
const columnIcon = renderWorkbenchIcon(
|
|
21468
|
+
resolveColumnIcon?.(columnType, column),
|
|
21469
|
+
"h-3.5 w-3.5 shrink-0 text-primary"
|
|
21470
|
+
);
|
|
21471
|
+
const previousColumn = orderedColumns[columnIndex - 1];
|
|
21472
|
+
const followsRecordIcon = previousColumn?.renderType === "icon" && column.key === resolvedActivePrimaryColumn?.key;
|
|
21473
|
+
const headerContent = renderColumnHeader ? renderColumnHeader(column, { column, columnIndex, columns: orderedColumns, rows, columnType }) : formatLabel(column.label, { column });
|
|
21474
|
+
const headerTrailing = !renderColumnHeader && (hasRenderableNode(column.trailing) || hasRenderableNode(column.helperText)) ? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
21475
|
+
hasRenderableNode(column.trailing) ? formatLabel(column.trailing, { column }) : null,
|
|
21476
|
+
/* @__PURE__ */ jsx(WorkbenchTableHeaderHelper, { helperText: formatLabel(column.helperText, { column }), className: classNames?.helper })
|
|
21477
|
+
] }) : void 0;
|
|
21478
|
+
const sortable = Boolean(column.sortable);
|
|
21479
|
+
const handleSort = sortable && onSort ? () => onSort(column.key, column) : void 0;
|
|
21480
|
+
return /* @__PURE__ */ jsx(
|
|
21481
|
+
BaseTableHead,
|
|
21482
|
+
{
|
|
21483
|
+
appearance,
|
|
21484
|
+
columnId: column.key,
|
|
21485
|
+
align: column.align,
|
|
21486
|
+
icon: renderColumnHeader ? void 0 : columnIcon,
|
|
21487
|
+
label: headerContent,
|
|
21488
|
+
description: renderColumnHeader ? void 0 : formatLabel(column.description, { column }),
|
|
21489
|
+
meta: renderColumnHeader ? void 0 : formatLabel(column.meta, { column }),
|
|
21490
|
+
actions: renderColumnHeader ? void 0 : column.actions,
|
|
21491
|
+
trailing: headerTrailing,
|
|
21492
|
+
sortable,
|
|
21493
|
+
sortDirection: column.sortDirection,
|
|
21494
|
+
sortLabel: column.sortLabel,
|
|
21495
|
+
onSort: handleSort,
|
|
21496
|
+
draggable: column.draggable,
|
|
21497
|
+
dragLabel: column.dragLabel,
|
|
21498
|
+
resizable: column.resizable,
|
|
21499
|
+
resizeLabel: column.resizeLabel,
|
|
21500
|
+
width: column.width,
|
|
21501
|
+
minWidth: typeof column.minWidth === "number" ? column.minWidth : void 0,
|
|
21502
|
+
maxWidth: typeof column.maxWidth === "number" ? column.maxWidth : void 0,
|
|
21503
|
+
className: cn(
|
|
21504
|
+
"sticky top-0 z-20 h-auto whitespace-nowrap bg-card/95 px-4 py-3 font-medium backdrop-blur-sm supports-[backdrop-filter]:bg-card/90",
|
|
21505
|
+
stickyFirstColumn && columnIndex === 0 && "left-0 z-30 shadow-[1px_0_0_0_hsl(var(--border)/0.35)]",
|
|
21506
|
+
column.compactHeaderClassName,
|
|
21507
|
+
column.headerClassName,
|
|
21508
|
+
column.renderType === "icon" && "pl-3 pr-1",
|
|
21509
|
+
followsRecordIcon && "pl-2",
|
|
21510
|
+
classNames?.headerCell
|
|
21511
|
+
),
|
|
21512
|
+
style: {
|
|
21513
|
+
minWidth: typeof column.minWidth === "string" ? column.minWidth : void 0,
|
|
21514
|
+
maxWidth: typeof column.maxWidth === "string" ? column.maxWidth : void 0
|
|
21515
|
+
}
|
|
21516
|
+
},
|
|
21517
|
+
column.key
|
|
21518
|
+
);
|
|
21519
|
+
}) }) }),
|
|
21520
|
+
/* @__PURE__ */ jsx(BaseTableBody, { appearance, className: cn("divide-y divide-border/35 dark:divide-border/30", classNames?.body), children: rows.length ? rows.map((row, rowIndex) => {
|
|
21521
|
+
const key = getRowKey(row, rowIndex);
|
|
21522
|
+
const disabled = isDisabled(row, rowIndex);
|
|
21523
|
+
const selectionKey = getRowSelectionKey(row, rowIndex);
|
|
21524
|
+
const selected = Boolean(resolvedSelectedKey && String(selectionKey) === String(resolvedSelectedKey));
|
|
21525
|
+
const resolvedRowClassName = typeof rowClassName === "function" ? rowClassName(row, rowIndex) : rowClassName;
|
|
21526
|
+
return /* @__PURE__ */ jsx(
|
|
21527
|
+
BaseTableRow,
|
|
21528
|
+
{
|
|
21529
|
+
appearance,
|
|
21530
|
+
interactive: Boolean(onRowClick) && !disabled,
|
|
21531
|
+
selected,
|
|
21532
|
+
disabled,
|
|
21533
|
+
onClick: () => {
|
|
21534
|
+
if (!disabled) {
|
|
21535
|
+
onRowClick?.(row, rowIndex);
|
|
21536
|
+
}
|
|
21537
|
+
},
|
|
21538
|
+
className: cn(
|
|
21539
|
+
onRowClick && !disabled ? "cursor-pointer" : "cursor-default",
|
|
21540
|
+
selected ? "bg-primary/10 hover:bg-primary/15" : disabled ? "" : "hover:bg-muted/25 dark:hover:bg-muted/15",
|
|
21541
|
+
classNames?.row,
|
|
21542
|
+
resolvedRowClassName
|
|
21543
|
+
),
|
|
21544
|
+
children: orderedColumns.map((column, columnIndex) => {
|
|
21545
|
+
const shouldWrap = isAction(column) || column.wrap === true;
|
|
21546
|
+
const previousColumn = orderedColumns[columnIndex - 1];
|
|
21547
|
+
const followsRecordIcon = previousColumn?.renderType === "icon" && column.key === resolvedActivePrimaryColumn?.key;
|
|
21548
|
+
return /* @__PURE__ */ jsx(
|
|
21549
|
+
BaseTableCell,
|
|
21550
|
+
{
|
|
21551
|
+
appearance,
|
|
21552
|
+
align: column.align,
|
|
21553
|
+
className: cn(
|
|
21554
|
+
shouldWrap ? "align-top whitespace-normal" : "whitespace-nowrap",
|
|
21555
|
+
"px-4 py-3 text-muted-foreground",
|
|
21556
|
+
stickyFirstColumn && columnIndex === 0 && "sticky left-0 z-10 bg-card/95 text-foreground shadow-[1px_0_0_0_hsl(var(--border)/0.3)]",
|
|
21557
|
+
column.compactCellClassName,
|
|
21558
|
+
column.cellClassName,
|
|
21559
|
+
column.renderType === "icon" && "pl-3 pr-1",
|
|
21560
|
+
followsRecordIcon && "pl-2",
|
|
21561
|
+
classNames?.cell
|
|
21562
|
+
),
|
|
21563
|
+
children: renderValue(column, row, {
|
|
21564
|
+
row,
|
|
21565
|
+
rowIndex,
|
|
21566
|
+
column,
|
|
21567
|
+
columnIndex,
|
|
21568
|
+
compact: true,
|
|
21569
|
+
surface: "list"
|
|
21570
|
+
})
|
|
21571
|
+
},
|
|
21572
|
+
`${key}-${column.key}`
|
|
21573
|
+
);
|
|
21574
|
+
})
|
|
21575
|
+
},
|
|
21576
|
+
key
|
|
21577
|
+
);
|
|
21578
|
+
}) : /* @__PURE__ */ jsx(
|
|
21579
|
+
BaseTableEmpty,
|
|
21580
|
+
{
|
|
21581
|
+
appearance,
|
|
21582
|
+
colSpan: Math.max(orderedColumns.length, 1),
|
|
21583
|
+
classNames: { cell: "px-4 py-10 text-center text-sm text-muted-foreground" },
|
|
21584
|
+
children: emptyState
|
|
21585
|
+
}
|
|
21586
|
+
) })
|
|
21587
|
+
]
|
|
21588
|
+
}
|
|
21589
|
+
)
|
|
21590
|
+
}
|
|
21591
|
+
),
|
|
21592
|
+
footer ? /* @__PURE__ */ jsx("div", { className: cn("border-t border-border/40 px-4 py-2 text-[11px] text-muted-foreground dark:border-border/30", classNames?.footer), children: footer }) : null
|
|
21593
|
+
]
|
|
21594
|
+
}
|
|
21595
|
+
);
|
|
21596
|
+
}
|
|
21597
|
+
var imageExtPattern = /\.(png|jpe?g|webp|gif|svg|bmp|avif)$/i;
|
|
21598
|
+
var audioExtPattern = /\.(wav|mp3|ogg|m4a|flac|aac)$/i;
|
|
21599
|
+
var isLikelyUrl = (value) => /^https?:\/\//i.test(String(value || ""));
|
|
21600
|
+
var getColumnRenderKind = (column) => String(column?.renderType || column?.type || "").toLowerCase();
|
|
21601
|
+
var isImageLikeValue = (value) => String(value || "").startsWith("data:image/") || imageExtPattern.test(String(value || ""));
|
|
21602
|
+
var isAudioLikeValue = (value) => String(value || "").startsWith("data:audio/") || audioExtPattern.test(String(value || ""));
|
|
21603
|
+
var escapeSvgText = (value) => String(value || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
21604
|
+
var getDefaultGalleryFieldValue = (column, row) => {
|
|
21605
|
+
if (!column) return null;
|
|
21606
|
+
return row?.[column.key] ?? null;
|
|
21607
|
+
};
|
|
21608
|
+
var getDefaultGalleryDisplayText = (value) => {
|
|
21609
|
+
if (value === null || value === void 0 || value === "") return "\u2014";
|
|
21610
|
+
if (Array.isArray(value)) {
|
|
21611
|
+
const parts = value.map((item) => {
|
|
21612
|
+
if (typeof item === "string") return item;
|
|
21613
|
+
if (!item || typeof item !== "object") return "";
|
|
21614
|
+
const objectItem = item;
|
|
21615
|
+
return objectItem.text || objectItem.label || objectItem.title || objectItem.display || objectItem.value || objectItem.recordId || "";
|
|
21616
|
+
}).filter(Boolean);
|
|
21617
|
+
return parts.join(" \xB7 ") || "\u2014";
|
|
21618
|
+
}
|
|
21619
|
+
if (typeof value === "object") {
|
|
21620
|
+
const objectValue = value;
|
|
21621
|
+
return String(objectValue.text || objectValue.label || objectValue.title || objectValue.display || objectValue.value || "\u2014");
|
|
21622
|
+
}
|
|
21623
|
+
return String(value);
|
|
21624
|
+
};
|
|
21625
|
+
var isDefaultGalleryImageField = (column = { key: "" }, value) => getColumnRenderKind(column) === "image" || isImageLikeValue(value);
|
|
21626
|
+
var isDefaultGalleryAudioField = (column = { key: "" }, value) => getColumnRenderKind(column) === "audio" || isAudioLikeValue(value);
|
|
21627
|
+
var getDefaultGalleryImagePreviewSrc = (value, rowId, columnLabel) => {
|
|
21628
|
+
if (isLikelyUrl(value) || String(value || "").startsWith("data:image/")) return String(value);
|
|
21629
|
+
const title = escapeSvgText(value || columnLabel || rowId || "");
|
|
21630
|
+
const titleText = title ? `<text x='68' y='450' fill='white' font-family='Inter, Arial' font-size='52' font-weight='700'>${title}</text>` : "";
|
|
21631
|
+
const svg = `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 960 540'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0%' stop-color='#0f172a'/><stop offset='55%' stop-color='#1d4ed8'/><stop offset='100%' stop-color='#14b8a6'/></linearGradient></defs><rect width='960' height='540' fill='url(#g)'/><g opacity='0.28'><circle cx='780' cy='130' r='150' fill='#67e8f9'/><circle cx='180' cy='430' r='170' fill='#a78bfa'/></g>${titleText}</svg>`;
|
|
21632
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
|
21633
|
+
};
|
|
21634
|
+
var isDefaultGalleryMediaColumn = (column, row, {
|
|
21635
|
+
getFieldValue = getDefaultGalleryFieldValue,
|
|
21636
|
+
shouldEnhanceMultimodal = true,
|
|
21637
|
+
isImageField = isDefaultGalleryImageField,
|
|
21638
|
+
isAudioField = isDefaultGalleryAudioField
|
|
21639
|
+
} = {}) => {
|
|
21640
|
+
if (!column || !shouldEnhanceMultimodal) return false;
|
|
21641
|
+
const value = getFieldValue(column, row);
|
|
21642
|
+
return isImageField(column, value) || isAudioField(column, value);
|
|
21643
|
+
};
|
|
21644
|
+
var isDefaultGalleryTitleCandidate = (column, row, { isMediaColumn = () => false } = {}) => {
|
|
21645
|
+
if (!column || column.renderType === "icon") return false;
|
|
21646
|
+
return !isMediaColumn(column, row);
|
|
21647
|
+
};
|
|
21648
|
+
var isDefaultGallerySummaryCandidate = (column, row, { isMediaColumn = () => false } = {}) => {
|
|
21649
|
+
if (!column || column.renderType === "icon") return false;
|
|
21650
|
+
return !isMediaColumn(column, row);
|
|
21651
|
+
};
|
|
21652
|
+
var renderDefaultGalleryFieldValue = (column, row, {
|
|
21653
|
+
compact = false,
|
|
21654
|
+
getFieldValue = getDefaultGalleryFieldValue,
|
|
21655
|
+
getDisplayText = getDefaultGalleryDisplayText
|
|
21656
|
+
} = {}) => {
|
|
21657
|
+
const value = getFieldValue(column, row);
|
|
21658
|
+
return /* @__PURE__ */ jsx("span", { className: cn("leading-relaxed", compact && column?.wrap === true && "line-clamp-2 block"), children: getDisplayText(value) });
|
|
21659
|
+
};
|
|
21660
|
+
var getDefaultGalleryDetailLimit = (density) => {
|
|
21661
|
+
if (density === "compact") return 2;
|
|
21662
|
+
if (density === "detailed") return 6;
|
|
21663
|
+
return 4;
|
|
21664
|
+
};
|
|
21665
|
+
var getNormalizedGalleryBentoColumns = (columns, density) => {
|
|
21666
|
+
if (columns === 1 || columns === 2 || columns === 3) return Number(columns);
|
|
21667
|
+
return density === "detailed" ? 1 : 2;
|
|
21668
|
+
};
|
|
21669
|
+
var getNormalizedGalleryDetailLimit = ({
|
|
21670
|
+
density,
|
|
21671
|
+
visibility,
|
|
21672
|
+
limit
|
|
21673
|
+
}) => {
|
|
21674
|
+
if (visibility === "all") return Number.POSITIVE_INFINITY;
|
|
21675
|
+
const parsedLimit = Number.parseInt(String(limit), 10);
|
|
21676
|
+
if (Number.isFinite(parsedLimit) && parsedLimit > 0) return parsedLimit;
|
|
21677
|
+
return getDefaultGalleryDetailLimit(density);
|
|
21678
|
+
};
|
|
21679
|
+
var getGalleryCardPaddingClassName = (density) => {
|
|
21680
|
+
if (density === "compact") return "p-3";
|
|
21681
|
+
if (density === "detailed") return "p-4";
|
|
21682
|
+
return "p-3.5";
|
|
21683
|
+
};
|
|
21684
|
+
var getGalleryPreviewClassName = (density, isMasonry) => {
|
|
21685
|
+
if (isMasonry) return "h-auto w-full object-cover";
|
|
21686
|
+
if (density === "compact") return "h-32 w-full object-cover";
|
|
21687
|
+
if (density === "detailed") return "h-48 w-full object-cover";
|
|
21688
|
+
return "h-40 w-full object-cover";
|
|
21689
|
+
};
|
|
21690
|
+
var getGalleryDetailGridClassName = (columns) => {
|
|
21691
|
+
if (columns === 1) return "grid-cols-1";
|
|
21692
|
+
if (columns === 3) return "grid-cols-1 sm:grid-cols-2 2xl:grid-cols-3";
|
|
21693
|
+
return "grid-cols-1 sm:grid-cols-2";
|
|
21694
|
+
};
|
|
21695
|
+
function getIconComponent(icon) {
|
|
21696
|
+
return getWorkbenchIconComponent(icon);
|
|
21697
|
+
}
|
|
21698
|
+
function defaultFormatLabel2(value) {
|
|
21699
|
+
return value;
|
|
21700
|
+
}
|
|
21701
|
+
function getLabelText(value) {
|
|
21702
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
21703
|
+
return "";
|
|
21704
|
+
}
|
|
21705
|
+
function WorkbenchGalleryCard({
|
|
21706
|
+
row,
|
|
21707
|
+
columns,
|
|
21708
|
+
onClick = () => {
|
|
21709
|
+
},
|
|
21710
|
+
isSelected = false,
|
|
21711
|
+
isMasonry = false,
|
|
21712
|
+
galleryFieldKey = "auto",
|
|
21713
|
+
galleryDensity = "comfortable",
|
|
21714
|
+
galleryBentoColumns,
|
|
21715
|
+
galleryDetailVisibility = "limit",
|
|
21716
|
+
galleryDetailLimit,
|
|
21717
|
+
shouldEnhanceMultimodal = true,
|
|
21718
|
+
getFieldValue,
|
|
21719
|
+
isMediaColumn,
|
|
21720
|
+
isTitleCandidate,
|
|
21721
|
+
isSummaryCandidate,
|
|
21722
|
+
getDisplayText,
|
|
21723
|
+
renderFieldValue,
|
|
21724
|
+
getImagePreviewSrc,
|
|
21725
|
+
isImageField,
|
|
21726
|
+
isAudioField,
|
|
21727
|
+
AudioPlayerComponent,
|
|
21728
|
+
cardVariant = "default",
|
|
21729
|
+
renderPreview,
|
|
21730
|
+
renderMeta,
|
|
21731
|
+
renderLeadingVisual,
|
|
21732
|
+
resolveRecordVisual,
|
|
21733
|
+
hiddenDetailFieldKeys = [],
|
|
21734
|
+
labels,
|
|
21735
|
+
formatLabel = defaultFormatLabel2,
|
|
21736
|
+
className
|
|
21737
|
+
}) {
|
|
21738
|
+
const resolvedGetFieldValue = getFieldValue || getDefaultGalleryFieldValue;
|
|
21739
|
+
const resolvedGetDisplayText = getDisplayText || getDefaultGalleryDisplayText;
|
|
21740
|
+
const resolvedIsImageField = isImageField || isDefaultGalleryImageField;
|
|
21741
|
+
const resolvedIsAudioField = isAudioField || isDefaultGalleryAudioField;
|
|
21742
|
+
const resolvedGetImagePreviewSrc = getImagePreviewSrc || getDefaultGalleryImagePreviewSrc;
|
|
21743
|
+
const resolvedIsMediaColumn = isMediaColumn || ((column, candidateRow) => isDefaultGalleryMediaColumn(column, candidateRow, {
|
|
21744
|
+
getFieldValue: resolvedGetFieldValue,
|
|
21745
|
+
shouldEnhanceMultimodal,
|
|
21746
|
+
isImageField: resolvedIsImageField,
|
|
21747
|
+
isAudioField: resolvedIsAudioField
|
|
21748
|
+
}));
|
|
21749
|
+
const resolvedIsTitleCandidate = isTitleCandidate || ((column, candidateRow) => isDefaultGalleryTitleCandidate(column, candidateRow, { isMediaColumn: resolvedIsMediaColumn }));
|
|
21750
|
+
const resolvedIsSummaryCandidate = isSummaryCandidate || ((column, candidateRow) => isDefaultGallerySummaryCandidate(column, candidateRow, { isMediaColumn: resolvedIsMediaColumn }));
|
|
21751
|
+
const resolvedRenderFieldValue = renderFieldValue || ((column, candidateRow, { compact } = {}) => renderDefaultGalleryFieldValue(column, candidateRow, {
|
|
21752
|
+
compact,
|
|
21753
|
+
getFieldValue: resolvedGetFieldValue,
|
|
21754
|
+
getDisplayText: resolvedGetDisplayText
|
|
21755
|
+
}));
|
|
21756
|
+
const isPreviewOnly = cardVariant === "preview-only";
|
|
21757
|
+
const isImageOnly = cardVariant === "image-only";
|
|
21758
|
+
const isChromaticBento = cardVariant === "chromatic-bento";
|
|
21759
|
+
const selectedGalleryColumn = galleryFieldKey !== "auto" ? columns.find((column) => column.key === galleryFieldKey && resolvedIsMediaColumn(column, row)) : null;
|
|
21760
|
+
const mediaColumn = selectedGalleryColumn || (shouldEnhanceMultimodal ? columns.find((column) => resolvedIsMediaColumn(column, row)) : null);
|
|
21761
|
+
const iconColumn = columns.find((column) => column.renderType === "icon");
|
|
21762
|
+
const iconVisual = iconColumn && resolveRecordVisual ? resolveRecordVisual(row[iconColumn.key], row, iconColumn) : null;
|
|
21763
|
+
const IconComponent = getIconComponent(iconVisual?.Icon || iconVisual?.icon);
|
|
21764
|
+
const mediaValue = mediaColumn ? resolvedGetFieldValue(mediaColumn, row) : null;
|
|
21765
|
+
const isImageMedia = mediaColumn ? resolvedIsImageField(mediaColumn, mediaValue) : false;
|
|
21766
|
+
const isAudioMedia = mediaColumn ? resolvedIsAudioField(mediaColumn, mediaValue) : false;
|
|
21767
|
+
const contentColumns = columns.filter((column) => column.key !== mediaColumn?.key && column.renderType !== "icon");
|
|
21768
|
+
const titleCandidates = contentColumns.filter((column) => {
|
|
21769
|
+
if (!column || resolvedIsMediaColumn(column, row) || !resolvedIsTitleCandidate(column, row)) return false;
|
|
21770
|
+
const value = resolvedGetFieldValue(column, row);
|
|
21771
|
+
return !(value === null || value === void 0 || value === "");
|
|
21772
|
+
});
|
|
21773
|
+
const titleColumn = titleCandidates[0] || null;
|
|
21774
|
+
const titleText = titleColumn ? resolvedGetDisplayText(resolvedGetFieldValue(titleColumn, row)) : resolvedGetDisplayText(row.linkKey || row.id);
|
|
21775
|
+
const summaryColumn = contentColumns.find((column) => {
|
|
21776
|
+
if (!column || column.key === titleColumn?.key || resolvedIsMediaColumn(column, row) || !resolvedIsSummaryCandidate(column, row)) return false;
|
|
21777
|
+
const summaryText2 = String(resolvedGetDisplayText(resolvedGetFieldValue(column, row)));
|
|
21778
|
+
return summaryText2 !== "\u2014" && summaryText2.length > 12;
|
|
21779
|
+
}) || contentColumns.find((column) => {
|
|
21780
|
+
if (!column || column.key === titleColumn?.key || resolvedIsMediaColumn(column, row) || !resolvedIsSummaryCandidate(column, row)) return false;
|
|
21781
|
+
const fallbackText = String(resolvedGetDisplayText(resolvedGetFieldValue(column, row)));
|
|
21782
|
+
return fallbackText !== "\u2014";
|
|
21783
|
+
}) || null;
|
|
21784
|
+
const summaryText = summaryColumn ? resolvedGetDisplayText(resolvedGetFieldValue(summaryColumn, row)) : "";
|
|
21785
|
+
const hiddenDetailKeySet = new Set(hiddenDetailFieldKeys);
|
|
21786
|
+
const detailColumns = contentColumns.filter((column) => column.key !== titleColumn?.key && column.key !== summaryColumn?.key && !hiddenDetailKeySet.has(column.key));
|
|
21787
|
+
const resolvedDetailLimit = getNormalizedGalleryDetailLimit({
|
|
21788
|
+
density: galleryDensity,
|
|
21789
|
+
visibility: galleryDetailVisibility,
|
|
21790
|
+
limit: galleryDetailLimit
|
|
21791
|
+
});
|
|
21792
|
+
const visibleDetailColumns = Number.isFinite(resolvedDetailLimit) ? detailColumns.slice(0, resolvedDetailLimit) : detailColumns;
|
|
21793
|
+
const isDetailedCard = galleryDensity === "detailed";
|
|
21794
|
+
const resolvedBentoColumns = getNormalizedGalleryBentoColumns(galleryBentoColumns, galleryDensity);
|
|
21795
|
+
const cardPaddingClassName = getGalleryCardPaddingClassName(galleryDensity);
|
|
21796
|
+
const detailGridClassName = getGalleryDetailGridClassName(resolvedBentoColumns);
|
|
21797
|
+
const previewClassName = isImageOnly ? "block h-auto w-full transition-transform duration-500 group-hover:scale-[1.02]" : getGalleryPreviewClassName(galleryDensity, isMasonry);
|
|
21798
|
+
const customPreview = typeof renderPreview === "function" ? renderPreview({
|
|
21799
|
+
row,
|
|
21800
|
+
mediaColumn,
|
|
21801
|
+
mediaValue,
|
|
21802
|
+
isImageMedia,
|
|
21803
|
+
isAudioMedia,
|
|
21804
|
+
iconVisual,
|
|
21805
|
+
IconComponent,
|
|
21806
|
+
previewClassName
|
|
21807
|
+
}) : null;
|
|
21808
|
+
const metaContent = typeof renderMeta === "function" ? renderMeta({
|
|
21809
|
+
row,
|
|
21810
|
+
contentColumns,
|
|
21811
|
+
detailColumns,
|
|
21812
|
+
titleColumn,
|
|
21813
|
+
summaryColumn,
|
|
21814
|
+
getDisplayText: resolvedGetDisplayText,
|
|
21815
|
+
getFieldValue: resolvedGetFieldValue
|
|
21816
|
+
}) : null;
|
|
21817
|
+
const customLeadingVisual = typeof renderLeadingVisual === "function" ? renderLeadingVisual({
|
|
21818
|
+
row,
|
|
21819
|
+
contentColumns,
|
|
21820
|
+
detailColumns,
|
|
21821
|
+
titleColumn,
|
|
21822
|
+
summaryColumn,
|
|
21823
|
+
iconVisual,
|
|
21824
|
+
getDisplayText: resolvedGetDisplayText,
|
|
21825
|
+
getFieldValue: resolvedGetFieldValue
|
|
21826
|
+
}) : null;
|
|
21827
|
+
const defaultLeadingVisual = !customLeadingVisual && iconVisual ? /* @__PURE__ */ jsx("div", { className: cn("flex h-9 w-9 items-center justify-center rounded-lg border", iconVisual.chipClassName || "border-primary/20 bg-primary/10 text-primary"), children: renderWorkbenchIcon(iconVisual.Icon || iconVisual.icon, cn("h-4 w-4", iconVisual.iconClassName || "text-primary")) }) : null;
|
|
21828
|
+
const leadingVisual = customLeadingVisual || defaultLeadingVisual;
|
|
21829
|
+
const defaultMetaClassName = isChromaticBento ? "shrink-0 rounded-full border border-border/40 bg-muted/25 px-2.5 py-1 text-[10px] text-muted-foreground transition-all duration-300 group-hover:border-primary/30 group-hover:bg-primary/10 group-hover:text-primary dark:border-border/35 dark:bg-muted/15" : "shrink-0 rounded-md border border-border/40 bg-muted/25 px-2 py-1 text-[10px] text-muted-foreground dark:border-border/35 dark:bg-muted/15";
|
|
21830
|
+
const detailCellClassName = isChromaticBento ? "rounded-xl border border-border/35 bg-muted/20 px-3 py-2.5 transition-all duration-300 group-hover:border-primary/25 group-hover:bg-primary/5 dark:border-border/30 dark:bg-muted/10" : "rounded-lg border border-border/35 bg-muted/20 px-2.5 py-2 dark:border-border/30 dark:bg-muted/10";
|
|
21831
|
+
const detailLabelClassName = isChromaticBento ? "text-[10px] uppercase tracking-[0.14em] text-muted-foreground transition-colors duration-300 group-hover:text-foreground" : "text-[10px] uppercase tracking-[0.12em] text-muted-foreground";
|
|
21832
|
+
const detailValueClassName = isChromaticBento ? "mt-1.5 text-[11px] text-muted-foreground transition-colors duration-300 group-hover:text-foreground [&_*]:max-w-full [&_pre]:text-[11px] [&_pre]:leading-relaxed" : "mt-1.5 text-[11px] text-foreground [&_*]:max-w-full [&_pre]:text-[11px] [&_pre]:leading-relaxed";
|
|
21833
|
+
const fieldCountLabel = labels?.fieldCount?.(contentColumns.length);
|
|
21834
|
+
const coverOnlyHint = labels?.coverOnlyHint;
|
|
21835
|
+
return /* @__PURE__ */ jsxs(
|
|
21836
|
+
"button",
|
|
21837
|
+
{
|
|
21838
|
+
type: "button",
|
|
21839
|
+
onClick,
|
|
21840
|
+
"aria-label": getLabelText(titleText),
|
|
21841
|
+
className: cn(
|
|
21842
|
+
"group relative w-full text-left transition-all duration-300",
|
|
21843
|
+
isImageOnly ? "overflow-hidden rounded-xl bg-transparent p-0 shadow-none" : isPreviewOnly ? "overflow-hidden rounded-3xl bg-transparent p-0" : cn("overflow-hidden rounded-xl border", isChromaticBento && "rounded-3xl shadow-none"),
|
|
21844
|
+
!isPreviewOnly && !isImageOnly && cardPaddingClassName,
|
|
21845
|
+
!isPreviewOnly && !isImageOnly && (isSelected ? isChromaticBento ? "border-primary/35 bg-background/85 ring-1 ring-primary/20" : "border-primary/40 bg-primary/10 ring-1 ring-primary/30" : isChromaticBento ? "workbench-surface-card hover:-translate-y-1 hover:border-primary/20" : "workbench-surface-card hover:border-primary/30"),
|
|
21846
|
+
isPreviewOnly && isSelected && "ring-1 ring-primary/30",
|
|
21847
|
+
isImageOnly && (isSelected ? "ring-1 ring-primary/30" : "hover:-translate-y-0.5"),
|
|
21848
|
+
isMasonry ? "block h-full w-full min-w-0" : "h-full min-w-0",
|
|
21849
|
+
className
|
|
21850
|
+
),
|
|
21851
|
+
children: [
|
|
21852
|
+
isChromaticBento ? /* @__PURE__ */ jsx(
|
|
21853
|
+
"div",
|
|
21854
|
+
{
|
|
21855
|
+
"aria-hidden": "true",
|
|
21856
|
+
className: cn(
|
|
21857
|
+
"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_top_right,rgba(34,211,238,0.18),transparent_40%),radial-gradient(circle_at_bottom_left,rgba(16,185,129,0.12),transparent_45%)] opacity-0 transition-opacity duration-300",
|
|
21858
|
+
isSelected ? "opacity-100" : "group-hover:opacity-100"
|
|
21859
|
+
)
|
|
21860
|
+
}
|
|
21861
|
+
) : null,
|
|
21862
|
+
/* @__PURE__ */ jsxs("div", { className: "relative z-[1]", children: [
|
|
21863
|
+
customPreview ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21864
|
+
isImageMedia && mediaColumn ? /* @__PURE__ */ jsx("div", { className: cn(
|
|
21865
|
+
"overflow-hidden bg-card/50",
|
|
21866
|
+
isImageOnly ? "rounded-xl bg-transparent" : isPreviewOnly ? "rounded-3xl" : "mb-3 rounded-lg border border-border/70"
|
|
21867
|
+
), children: /* @__PURE__ */ jsx(
|
|
21868
|
+
"img",
|
|
21869
|
+
{
|
|
21870
|
+
src: resolvedGetImagePreviewSrc(mediaValue, row.id, mediaColumn.label),
|
|
21871
|
+
alt: String(mediaValue || mediaColumn.label || ""),
|
|
21872
|
+
className: previewClassName,
|
|
21873
|
+
loading: "lazy",
|
|
21874
|
+
referrerPolicy: "no-referrer",
|
|
21875
|
+
onError: (event) => {
|
|
21876
|
+
event.currentTarget.onerror = null;
|
|
21877
|
+
event.currentTarget.src = resolvedGetImagePreviewSrc("", row.id, mediaColumn.label);
|
|
21878
|
+
}
|
|
21879
|
+
}
|
|
21880
|
+
) }) : null,
|
|
21881
|
+
!isImageMedia && iconVisual && isPreviewOnly ? /* @__PURE__ */ jsx("div", { className: cn(
|
|
21882
|
+
"flex items-center justify-center",
|
|
21883
|
+
isPreviewOnly ? cn("rounded-3xl border py-10", iconVisual.chipClassName || "border-primary/20 bg-primary/5") : "mb-3 h-24 rounded-lg border border-border/60 bg-primary/5"
|
|
21884
|
+
), children: renderWorkbenchIcon(iconVisual.Icon || iconVisual.icon, cn("h-10 w-10", iconVisual.iconClassName || "text-primary")) }) : null,
|
|
21885
|
+
isAudioMedia && AudioPlayerComponent ? /* @__PURE__ */ jsx("div", { className: cn(!isPreviewOnly && "mb-3"), children: /* @__PURE__ */ jsx(AudioPlayerComponent, { filename: String(mediaValue) }) }) : null
|
|
21886
|
+
] }),
|
|
21887
|
+
!isPreviewOnly && !isImageOnly ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21888
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
21889
|
+
leadingVisual ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: leadingVisual }) : null,
|
|
21890
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-start justify-between gap-3", children: [
|
|
21891
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
21892
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
21893
|
+
"flex items-center gap-2 text-sm font-semibold",
|
|
21894
|
+
isChromaticBento ? "text-muted-foreground transition-colors duration-300 group-hover:text-foreground" : "text-foreground"
|
|
21895
|
+
), children: /* @__PURE__ */ jsx("span", { className: "truncate", children: titleText }) }),
|
|
21896
|
+
summaryText && summaryText !== titleText ? /* @__PURE__ */ jsx("div", { className: cn(
|
|
21897
|
+
"mt-1 text-[11px] leading-5 text-muted-foreground",
|
|
21898
|
+
isDetailedCard ? "line-clamp-4" : "line-clamp-2",
|
|
21899
|
+
isChromaticBento && "transition-colors duration-300 group-hover:text-foreground"
|
|
21900
|
+
), children: summaryText }) : null
|
|
21901
|
+
] }),
|
|
21902
|
+
metaContent ?? (hasRenderableNode(fieldCountLabel) ? /* @__PURE__ */ jsx("span", { className: defaultMetaClassName, children: fieldCountLabel }) : null)
|
|
21903
|
+
] })
|
|
21904
|
+
] }),
|
|
21905
|
+
visibleDetailColumns.length > 0 ? /* @__PURE__ */ jsx("div", { className: cn("mt-3 grid grid-flow-row gap-2", detailGridClassName), children: visibleDetailColumns.map((column) => /* @__PURE__ */ jsxs("div", { className: detailCellClassName, children: [
|
|
21906
|
+
column.label ? /* @__PURE__ */ jsx("div", { className: detailLabelClassName, children: formatLabel(column.label, { column }) }) : null,
|
|
21907
|
+
/* @__PURE__ */ jsx("div", { className: cn(detailValueClassName, !column.label && "mt-0"), children: resolvedRenderFieldValue(column, row, { compact: galleryDensity !== "detailed", surface: "gallery" }) })
|
|
21908
|
+
] }, `${row.id || row.linkKey}-${column.key}`)) }) : null,
|
|
21909
|
+
!summaryText && visibleDetailColumns.length === 0 && hasRenderableNode(coverOnlyHint) ? /* @__PURE__ */ jsx("div", { className: cn(
|
|
21910
|
+
"mt-3 text-[11px] text-muted-foreground",
|
|
21911
|
+
isChromaticBento && "transition-colors duration-300 group-hover:text-foreground"
|
|
21912
|
+
), children: coverOnlyHint }) : null
|
|
21913
|
+
] }) : null
|
|
21914
|
+
] })
|
|
21915
|
+
]
|
|
21916
|
+
}
|
|
21917
|
+
);
|
|
21918
|
+
}
|
|
21919
|
+
var DEFAULT_MASONRY_GAP_PX = 12;
|
|
21920
|
+
var DEFAULT_MASONRY_ROW_HEIGHT_PX = 8;
|
|
21921
|
+
var DEFAULT_MASONRY_COLUMN_WIDTH_PX = 280;
|
|
21922
|
+
var DEFAULT_MASONRY_ITEM_HEIGHT_PX = 240;
|
|
21923
|
+
function clamp3(value, min5, max5) {
|
|
21924
|
+
return Math.min(Math.max(value, min5), max5);
|
|
21925
|
+
}
|
|
21926
|
+
function getRootFontSize(node) {
|
|
21927
|
+
if (typeof window === "undefined") return 16;
|
|
21928
|
+
const target = node || document.documentElement;
|
|
21929
|
+
const parsed = Number.parseFloat(window.getComputedStyle(target).fontSize);
|
|
21930
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 16;
|
|
21931
|
+
}
|
|
21932
|
+
function resolveLengthToPixels(value, fallback, node) {
|
|
21933
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
|
|
21934
|
+
if (typeof value !== "string") return fallback;
|
|
21935
|
+
const normalized = value.trim().toLowerCase();
|
|
21936
|
+
if (!normalized) return fallback;
|
|
21937
|
+
if (/^\d+(\.\d+)?$/.test(normalized)) {
|
|
21938
|
+
const parsed = Number.parseFloat(normalized);
|
|
21939
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
21940
|
+
}
|
|
21941
|
+
if (normalized.endsWith("px")) {
|
|
21942
|
+
const parsed = Number.parseFloat(normalized);
|
|
21943
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
21944
|
+
}
|
|
21945
|
+
if (normalized.endsWith("rem")) {
|
|
21946
|
+
const parsed = Number.parseFloat(normalized);
|
|
21947
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return fallback;
|
|
21948
|
+
return parsed * getRootFontSize(node);
|
|
21949
|
+
}
|
|
21950
|
+
return fallback;
|
|
21951
|
+
}
|
|
21952
|
+
function areMeasurementMapsEqual(prev, next) {
|
|
21953
|
+
const prevKeys = Object.keys(prev);
|
|
21954
|
+
const nextKeys = Object.keys(next);
|
|
21955
|
+
if (prevKeys.length !== nextKeys.length) return false;
|
|
21956
|
+
for (const key of nextKeys) {
|
|
21957
|
+
if (prev[key] !== next[key]) return false;
|
|
21958
|
+
}
|
|
21959
|
+
return true;
|
|
21960
|
+
}
|
|
21961
|
+
function getMasonryColumnCount({
|
|
21962
|
+
containerWidth,
|
|
21963
|
+
itemCount,
|
|
21964
|
+
targetColumnWidth,
|
|
21965
|
+
gap
|
|
21966
|
+
}) {
|
|
21967
|
+
if (!containerWidth) return 1;
|
|
21968
|
+
const safeItemCount = Math.max(itemCount, 1);
|
|
21969
|
+
const maxCandidate = Math.max(
|
|
21970
|
+
1,
|
|
21971
|
+
Math.min(
|
|
21972
|
+
safeItemCount,
|
|
21973
|
+
Math.ceil((containerWidth + gap) / (Math.max(targetColumnWidth * 0.58, 1) + gap))
|
|
21974
|
+
)
|
|
21975
|
+
);
|
|
21976
|
+
let bestCount = 1;
|
|
21977
|
+
let bestScore = Number.POSITIVE_INFINITY;
|
|
21978
|
+
for (let candidateCount = 1; candidateCount <= maxCandidate; candidateCount += 1) {
|
|
21979
|
+
const actualColumnWidth = (containerWidth - gap * Math.max(candidateCount - 1, 0)) / candidateCount;
|
|
21980
|
+
if (!Number.isFinite(actualColumnWidth) || actualColumnWidth <= 0) continue;
|
|
21981
|
+
const underflowPenalty = Math.max(0, targetColumnWidth * 0.78 - actualColumnWidth);
|
|
21982
|
+
const overflowPenalty = Math.max(0, actualColumnWidth - targetColumnWidth * 1.35);
|
|
21983
|
+
const candidateScore = Math.abs(actualColumnWidth - targetColumnWidth) + underflowPenalty * 3 + overflowPenalty * 2;
|
|
21984
|
+
if (candidateScore < bestScore) {
|
|
21985
|
+
bestScore = candidateScore;
|
|
21986
|
+
bestCount = candidateCount;
|
|
21987
|
+
}
|
|
21988
|
+
}
|
|
21989
|
+
return bestCount;
|
|
21990
|
+
}
|
|
21991
|
+
function getItemColumnSpan({
|
|
21992
|
+
size,
|
|
21993
|
+
columnWidth,
|
|
21994
|
+
columnCount,
|
|
21995
|
+
gap
|
|
21996
|
+
}) {
|
|
21997
|
+
if (Number.isFinite(size?.columnSpan) && Number(size?.columnSpan) > 0) {
|
|
21998
|
+
return clamp3(Math.round(Number(size?.columnSpan)), 1, columnCount);
|
|
21999
|
+
}
|
|
22000
|
+
const itemWidth = resolveLengthToPixels(size?.width, columnWidth, null);
|
|
22001
|
+
return clamp3(Math.ceil((itemWidth + gap) / (columnWidth + gap)), 1, columnCount);
|
|
22002
|
+
}
|
|
22003
|
+
function getItemRowSpan({
|
|
22004
|
+
size,
|
|
22005
|
+
measuredHeight,
|
|
22006
|
+
rowHeight,
|
|
22007
|
+
gap
|
|
22008
|
+
}) {
|
|
22009
|
+
if (Number.isFinite(size?.rowSpan) && Number(size?.rowSpan) > 0) {
|
|
22010
|
+
return Math.max(1, Math.round(Number(size?.rowSpan)));
|
|
22011
|
+
}
|
|
22012
|
+
const itemHeight = Number.isFinite(measuredHeight) && Number(measuredHeight) > 0 ? Number(measuredHeight) : resolveLengthToPixels(size?.height, DEFAULT_MASONRY_ITEM_HEIGHT_PX, null);
|
|
22013
|
+
return Math.max(1, Math.ceil((itemHeight + gap) / (rowHeight + gap)));
|
|
22014
|
+
}
|
|
22015
|
+
function getResolvedItemHeight({
|
|
22016
|
+
size,
|
|
22017
|
+
measuredHeight
|
|
22018
|
+
}) {
|
|
22019
|
+
return Number.isFinite(measuredHeight) && Number(measuredHeight) > 0 ? Number(measuredHeight) : resolveLengthToPixels(size?.height, DEFAULT_MASONRY_ITEM_HEIGHT_PX, null);
|
|
22020
|
+
}
|
|
22021
|
+
function WorkbenchMasonryLayout({
|
|
22022
|
+
items = [],
|
|
22023
|
+
renderItem,
|
|
22024
|
+
getItemKey = (item, index) => item?.id ?? item?.key ?? index,
|
|
22025
|
+
getItemSize,
|
|
22026
|
+
columnWidth = DEFAULT_MASONRY_COLUMN_WIDTH_PX,
|
|
22027
|
+
gap = DEFAULT_MASONRY_GAP_PX,
|
|
22028
|
+
rowHeight = DEFAULT_MASONRY_ROW_HEIGHT_PX,
|
|
22029
|
+
placementStrategy = "shelf",
|
|
22030
|
+
className
|
|
22031
|
+
}) {
|
|
22032
|
+
const containerRef = useRef(null);
|
|
22033
|
+
const itemNodesRef = useRef(/* @__PURE__ */ new Map());
|
|
22034
|
+
const itemObserverRef = useRef(null);
|
|
22035
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
22036
|
+
const [measuredHeights, setMeasuredHeights] = useState({});
|
|
22037
|
+
const itemKeys = useMemo(
|
|
22038
|
+
() => items.map((item, index) => String(getItemKey(item, index))),
|
|
22039
|
+
[getItemKey, items]
|
|
22040
|
+
);
|
|
22041
|
+
const itemKeysSignature = itemKeys.join("|");
|
|
22042
|
+
useEffect(() => {
|
|
22043
|
+
const node = containerRef.current;
|
|
22044
|
+
if (!node) return void 0;
|
|
22045
|
+
const updateWidth = () => {
|
|
22046
|
+
const nextWidth = Math.round(node.getBoundingClientRect().width);
|
|
22047
|
+
setContainerWidth((prevWidth) => prevWidth === nextWidth ? prevWidth : nextWidth);
|
|
22048
|
+
};
|
|
22049
|
+
updateWidth();
|
|
22050
|
+
if (typeof ResizeObserver === "function") {
|
|
22051
|
+
const observer = new ResizeObserver(() => updateWidth());
|
|
22052
|
+
observer.observe(node);
|
|
22053
|
+
return () => observer.disconnect();
|
|
22054
|
+
}
|
|
22055
|
+
window.addEventListener("resize", updateWidth);
|
|
22056
|
+
return () => window.removeEventListener("resize", updateWidth);
|
|
22057
|
+
}, []);
|
|
22058
|
+
useEffect(() => {
|
|
22059
|
+
setMeasuredHeights((prev) => {
|
|
22060
|
+
const next = Object.fromEntries(
|
|
22061
|
+
Object.entries(prev).filter(([key]) => itemKeys.includes(key))
|
|
22062
|
+
);
|
|
22063
|
+
return areMeasurementMapsEqual(prev, next) ? prev : next;
|
|
22064
|
+
});
|
|
22065
|
+
}, [itemKeys, itemKeysSignature]);
|
|
22066
|
+
const resolvedTargetColumnWidth = resolveLengthToPixels(
|
|
22067
|
+
columnWidth,
|
|
22068
|
+
DEFAULT_MASONRY_COLUMN_WIDTH_PX,
|
|
22069
|
+
containerRef.current
|
|
22070
|
+
);
|
|
22071
|
+
const isDensePlacement = placementStrategy === "dense";
|
|
22072
|
+
const columnCount = getMasonryColumnCount({
|
|
22073
|
+
containerWidth,
|
|
22074
|
+
itemCount: items.length,
|
|
22075
|
+
targetColumnWidth: resolvedTargetColumnWidth,
|
|
22076
|
+
gap
|
|
22077
|
+
});
|
|
22078
|
+
const resolvedColumnWidth = containerWidth > 0 ? (containerWidth - gap * Math.max(columnCount - 1, 0)) / columnCount : resolvedTargetColumnWidth;
|
|
22079
|
+
const layoutItems = useMemo(() => items.map((item, index) => {
|
|
22080
|
+
const key = itemKeys[index];
|
|
22081
|
+
const size = typeof getItemSize === "function" ? getItemSize(item, {
|
|
22082
|
+
columnCount,
|
|
22083
|
+
columnWidth: resolvedColumnWidth,
|
|
22084
|
+
containerWidth,
|
|
22085
|
+
gap,
|
|
22086
|
+
placementStrategy,
|
|
22087
|
+
rowHeight
|
|
22088
|
+
}) || {} : {};
|
|
22089
|
+
return {
|
|
22090
|
+
key,
|
|
22091
|
+
item,
|
|
22092
|
+
size,
|
|
22093
|
+
columnSpan: getItemColumnSpan({
|
|
22094
|
+
size,
|
|
22095
|
+
columnWidth: resolvedColumnWidth,
|
|
22096
|
+
columnCount,
|
|
22097
|
+
gap
|
|
22098
|
+
}),
|
|
22099
|
+
rowSpan: getItemRowSpan({
|
|
22100
|
+
size,
|
|
22101
|
+
measuredHeight: measuredHeights[key],
|
|
22102
|
+
rowHeight,
|
|
22103
|
+
gap
|
|
22104
|
+
})
|
|
22105
|
+
};
|
|
22106
|
+
}), [
|
|
22107
|
+
columnCount,
|
|
22108
|
+
containerWidth,
|
|
22109
|
+
gap,
|
|
22110
|
+
getItemSize,
|
|
22111
|
+
itemKeys,
|
|
22112
|
+
items,
|
|
22113
|
+
measuredHeights,
|
|
22114
|
+
placementStrategy,
|
|
22115
|
+
resolvedColumnWidth,
|
|
22116
|
+
rowHeight
|
|
22117
|
+
]);
|
|
22118
|
+
useLayoutEffect(() => {
|
|
22119
|
+
const nextMeasurements = {};
|
|
22120
|
+
itemNodesRef.current.forEach((node, key) => {
|
|
22121
|
+
const nextHeight = Math.ceil(node.getBoundingClientRect().height);
|
|
22122
|
+
if (Number.isFinite(nextHeight) && nextHeight > 0) {
|
|
22123
|
+
nextMeasurements[key] = nextHeight;
|
|
22124
|
+
}
|
|
22125
|
+
});
|
|
22126
|
+
setMeasuredHeights((prev) => {
|
|
22127
|
+
if (!Object.keys(nextMeasurements).length) return prev;
|
|
22128
|
+
const merged = { ...prev, ...nextMeasurements };
|
|
22129
|
+
return areMeasurementMapsEqual(prev, merged) ? prev : merged;
|
|
22130
|
+
});
|
|
22131
|
+
}, [columnCount, isDensePlacement, itemKeysSignature, resolvedColumnWidth]);
|
|
22132
|
+
useEffect(() => {
|
|
22133
|
+
if (typeof ResizeObserver !== "function") return void 0;
|
|
22134
|
+
const observer = new ResizeObserver((entries) => {
|
|
22135
|
+
setMeasuredHeights((prev) => {
|
|
22136
|
+
const next = { ...prev };
|
|
22137
|
+
let didChange = false;
|
|
22138
|
+
for (const entry of entries) {
|
|
22139
|
+
const key = entry.target.dataset.masonryKey;
|
|
22140
|
+
if (!key) continue;
|
|
22141
|
+
const nextHeight = Math.ceil(entry.contentRect.height);
|
|
22142
|
+
if (!Number.isFinite(nextHeight) || nextHeight <= 0 || next[key] === nextHeight) continue;
|
|
22143
|
+
next[key] = nextHeight;
|
|
22144
|
+
didChange = true;
|
|
22145
|
+
}
|
|
22146
|
+
return didChange ? next : prev;
|
|
22147
|
+
});
|
|
22148
|
+
});
|
|
22149
|
+
itemObserverRef.current = observer;
|
|
22150
|
+
itemNodesRef.current.forEach((node) => observer.observe(node));
|
|
22151
|
+
return () => {
|
|
22152
|
+
observer.disconnect();
|
|
22153
|
+
itemObserverRef.current = null;
|
|
22154
|
+
};
|
|
22155
|
+
}, [isDensePlacement, itemKeysSignature]);
|
|
22156
|
+
const registerItemNode = (key, node) => {
|
|
22157
|
+
const currentNodes = itemNodesRef.current;
|
|
22158
|
+
const previousNode = currentNodes.get(key);
|
|
22159
|
+
if (previousNode && previousNode !== node && itemObserverRef.current) {
|
|
22160
|
+
itemObserverRef.current.unobserve(previousNode);
|
|
22161
|
+
}
|
|
22162
|
+
if (!node) {
|
|
22163
|
+
currentNodes.delete(key);
|
|
22164
|
+
return;
|
|
22165
|
+
}
|
|
22166
|
+
node.dataset.masonryKey = key;
|
|
22167
|
+
currentNodes.set(key, node);
|
|
22168
|
+
if (itemObserverRef.current) {
|
|
22169
|
+
itemObserverRef.current.observe(node);
|
|
22170
|
+
}
|
|
22171
|
+
};
|
|
22172
|
+
if (!isDensePlacement) {
|
|
22173
|
+
const orderedLayout = (() => {
|
|
22174
|
+
const columnBottoms = Array.from({ length: columnCount }, () => 0);
|
|
22175
|
+
let nextColumnIndex = 0;
|
|
22176
|
+
let maxBottom = 0;
|
|
22177
|
+
const positionedItems = layoutItems.map(({ key, item, columnSpan, rowSpan, size }) => {
|
|
22178
|
+
const resolvedSpan = clamp3(columnSpan, 1, columnCount);
|
|
22179
|
+
let startColumn = nextColumnIndex;
|
|
22180
|
+
if (startColumn + resolvedSpan > columnCount) {
|
|
22181
|
+
startColumn = 0;
|
|
22182
|
+
}
|
|
22183
|
+
startColumn = Math.min(startColumn, columnCount - resolvedSpan);
|
|
22184
|
+
const itemWidth = resolvedColumnWidth * resolvedSpan + gap * Math.max(resolvedSpan - 1, 0);
|
|
22185
|
+
const itemHeight = getResolvedItemHeight({
|
|
22186
|
+
size,
|
|
22187
|
+
measuredHeight: measuredHeights[key]
|
|
22188
|
+
});
|
|
22189
|
+
const top = Math.max(...columnBottoms.slice(startColumn, startColumn + resolvedSpan));
|
|
22190
|
+
const left = startColumn * (resolvedColumnWidth + gap);
|
|
22191
|
+
const bottom = top + itemHeight;
|
|
22192
|
+
for (let columnIndex = startColumn; columnIndex < startColumn + resolvedSpan; columnIndex += 1) {
|
|
22193
|
+
columnBottoms[columnIndex] = bottom + gap;
|
|
22194
|
+
}
|
|
22195
|
+
maxBottom = Math.max(maxBottom, bottom);
|
|
22196
|
+
nextColumnIndex = startColumn + resolvedSpan;
|
|
22197
|
+
if (nextColumnIndex >= columnCount) {
|
|
22198
|
+
nextColumnIndex = 0;
|
|
22199
|
+
}
|
|
22200
|
+
return {
|
|
22201
|
+
key,
|
|
22202
|
+
item,
|
|
22203
|
+
columnSpan: resolvedSpan,
|
|
22204
|
+
itemHeight,
|
|
22205
|
+
itemWidth,
|
|
22206
|
+
left,
|
|
22207
|
+
rowSpan,
|
|
22208
|
+
size,
|
|
22209
|
+
top
|
|
22210
|
+
};
|
|
22211
|
+
});
|
|
22212
|
+
return {
|
|
22213
|
+
containerHeight: Math.max(0, maxBottom),
|
|
22214
|
+
positionedItems
|
|
22215
|
+
};
|
|
22216
|
+
})();
|
|
22217
|
+
return /* @__PURE__ */ jsx(
|
|
22218
|
+
"div",
|
|
22219
|
+
{
|
|
22220
|
+
ref: containerRef,
|
|
22221
|
+
className: cn("relative w-full", className),
|
|
22222
|
+
style: { height: `${orderedLayout.containerHeight}px` },
|
|
22223
|
+
children: orderedLayout.positionedItems.map(({ key, item, columnSpan, rowSpan, size, itemWidth, left, top }) => {
|
|
22224
|
+
const unresolvedSingleColumnWidth = containerWidth <= 0 && columnCount === 1;
|
|
22225
|
+
const itemWidthValue = unresolvedSingleColumnWidth ? "100%" : `${itemWidth}px`;
|
|
22226
|
+
return /* @__PURE__ */ jsx(
|
|
22227
|
+
"div",
|
|
22228
|
+
{
|
|
22229
|
+
className: "absolute min-w-0",
|
|
22230
|
+
style: {
|
|
22231
|
+
left: unresolvedSingleColumnWidth ? 0 : `${left}px`,
|
|
22232
|
+
top: `${top}px`,
|
|
22233
|
+
width: itemWidthValue,
|
|
22234
|
+
maxWidth: itemWidthValue
|
|
22235
|
+
},
|
|
22236
|
+
children: /* @__PURE__ */ jsx("div", { ref: (node) => registerItemNode(key, node), className: "min-w-0", children: renderItem(item, {
|
|
22237
|
+
columnCount,
|
|
22238
|
+
columnSpan,
|
|
22239
|
+
columnWidth: resolvedColumnWidth,
|
|
22240
|
+
containerWidth,
|
|
22241
|
+
gap,
|
|
22242
|
+
itemWidth,
|
|
22243
|
+
placementStrategy,
|
|
22244
|
+
rowSpan,
|
|
22245
|
+
rowHeight,
|
|
22246
|
+
size
|
|
22247
|
+
}) })
|
|
22248
|
+
},
|
|
22249
|
+
key
|
|
22250
|
+
);
|
|
22251
|
+
})
|
|
22252
|
+
}
|
|
22253
|
+
);
|
|
22254
|
+
}
|
|
22255
|
+
return /* @__PURE__ */ jsx(
|
|
22256
|
+
"div",
|
|
22257
|
+
{
|
|
22258
|
+
ref: containerRef,
|
|
22259
|
+
className: cn("grid w-full items-start", className),
|
|
22260
|
+
style: {
|
|
22261
|
+
gap: `${gap}px`,
|
|
22262
|
+
gridAutoFlow: "row dense",
|
|
22263
|
+
gridAutoRows: `${rowHeight}px`,
|
|
22264
|
+
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`
|
|
22265
|
+
},
|
|
22266
|
+
children: layoutItems.map(({ key, item, columnSpan, rowSpan, size }) => /* @__PURE__ */ jsx(
|
|
22267
|
+
"div",
|
|
22268
|
+
{
|
|
22269
|
+
className: "min-w-0",
|
|
22270
|
+
style: {
|
|
22271
|
+
gridColumn: `span ${columnSpan}`,
|
|
22272
|
+
gridRow: `span ${rowSpan}`
|
|
22273
|
+
},
|
|
22274
|
+
children: /* @__PURE__ */ jsx("div", { ref: (node) => registerItemNode(key, node), className: "h-full", children: renderItem(item, {
|
|
22275
|
+
columnCount,
|
|
22276
|
+
columnSpan,
|
|
22277
|
+
columnWidth: resolvedColumnWidth,
|
|
22278
|
+
containerWidth,
|
|
22279
|
+
gap,
|
|
22280
|
+
placementStrategy,
|
|
22281
|
+
rowSpan,
|
|
22282
|
+
rowHeight,
|
|
22283
|
+
size
|
|
22284
|
+
}) })
|
|
22285
|
+
},
|
|
22286
|
+
key
|
|
22287
|
+
))
|
|
22288
|
+
}
|
|
22289
|
+
);
|
|
22290
|
+
}
|
|
22291
|
+
var GALLERY_GRID_GAP_PX = 12;
|
|
22292
|
+
function getNormalizedGalleryGridCardWidth(cardWidth) {
|
|
22293
|
+
if (typeof cardWidth === "number" && Number.isFinite(cardWidth) && cardWidth > 0) {
|
|
22294
|
+
return `${cardWidth}px`;
|
|
22295
|
+
}
|
|
22296
|
+
if (typeof cardWidth === "string" && cardWidth.trim()) {
|
|
22297
|
+
return cardWidth.trim();
|
|
22298
|
+
}
|
|
22299
|
+
return void 0;
|
|
22300
|
+
}
|
|
22301
|
+
function getDefaultGalleryDetailLimit2(density) {
|
|
22302
|
+
if (density === "compact") return 2;
|
|
22303
|
+
if (density === "detailed") return 6;
|
|
22304
|
+
return 4;
|
|
22305
|
+
}
|
|
22306
|
+
function getNormalizedGalleryBentoColumns2(columns, density) {
|
|
22307
|
+
if (columns === 1 || columns === 2 || columns === 3) return Number(columns);
|
|
22308
|
+
return density === "detailed" ? 1 : 2;
|
|
22309
|
+
}
|
|
22310
|
+
function getNormalizedGalleryDetailLimit2({
|
|
22311
|
+
density,
|
|
22312
|
+
visibility,
|
|
22313
|
+
limit
|
|
22314
|
+
}) {
|
|
22315
|
+
if (visibility === "all") return Number.POSITIVE_INFINITY;
|
|
22316
|
+
const parsedLimit = Number.parseInt(String(limit), 10);
|
|
22317
|
+
if (Number.isFinite(parsedLimit) && parsedLimit > 0) return parsedLimit;
|
|
22318
|
+
return getDefaultGalleryDetailLimit2(density);
|
|
22319
|
+
}
|
|
22320
|
+
function getGalleryCardWidthMetrics(density) {
|
|
22321
|
+
if (density === "compact") return { min: 220, ideal: 244, max: 268 };
|
|
22322
|
+
if (density === "detailed") return { min: 320, ideal: 372, max: 420 };
|
|
22323
|
+
return { min: 260, ideal: 304, max: 348 };
|
|
22324
|
+
}
|
|
22325
|
+
function getGalleryCardWidthForColumnCount({
|
|
22326
|
+
containerWidth,
|
|
22327
|
+
columnCount,
|
|
22328
|
+
gap
|
|
22329
|
+
}) {
|
|
22330
|
+
if (!containerWidth || !columnCount) return 0;
|
|
22331
|
+
return (containerWidth - gap * Math.max(columnCount - 1, 0)) / columnCount;
|
|
22332
|
+
}
|
|
22333
|
+
function getNormalizedGalleryGridColumns(columns) {
|
|
22334
|
+
if (columns === void 0 || columns === null || columns === "" || columns === "auto") {
|
|
22335
|
+
return void 0;
|
|
22336
|
+
}
|
|
22337
|
+
const parsedColumns = Number.parseInt(String(columns), 10);
|
|
22338
|
+
if (!Number.isFinite(parsedColumns) || parsedColumns <= 0) return void 0;
|
|
22339
|
+
return Math.max(1, Math.min(parsedColumns, 8));
|
|
22340
|
+
}
|
|
22341
|
+
function getGalleryGridColumnCount({
|
|
22342
|
+
containerWidth,
|
|
22343
|
+
rowCount,
|
|
22344
|
+
minCardWidth,
|
|
22345
|
+
idealCardWidth,
|
|
22346
|
+
maxCardWidth,
|
|
22347
|
+
gap
|
|
22348
|
+
}) {
|
|
22349
|
+
if (!containerWidth) return 1;
|
|
22350
|
+
const safeRowCount = Math.max(rowCount, 1);
|
|
22351
|
+
const lowerBound = Math.max(1, Math.ceil((containerWidth + gap) / (maxCardWidth + gap)));
|
|
22352
|
+
const upperBound = Math.max(1, Math.floor((containerWidth + gap) / (minCardWidth + gap)));
|
|
22353
|
+
const idealCount = Math.max(1, Math.round((containerWidth + gap) / (idealCardWidth + gap)));
|
|
22354
|
+
const phantomPenalty = Math.round((idealCardWidth - minCardWidth) / 2) + gap;
|
|
22355
|
+
const maxCandidate = Math.max(1, lowerBound, upperBound + 1, idealCount + 1);
|
|
22356
|
+
let bestCount = 1;
|
|
22357
|
+
let bestScore = Number.POSITIVE_INFINITY;
|
|
22358
|
+
for (let candidateCount = 1; candidateCount <= maxCandidate; candidateCount += 1) {
|
|
22359
|
+
const cardWidth = getGalleryCardWidthForColumnCount({ containerWidth, columnCount: candidateCount, gap });
|
|
22360
|
+
const overflowPenalty = Math.max(0, cardWidth - maxCardWidth);
|
|
22361
|
+
const underflowPenalty = Math.max(0, minCardWidth - cardWidth);
|
|
22362
|
+
const idealPenalty = Math.abs(cardWidth - idealCardWidth);
|
|
22363
|
+
const phantomColumns = Math.max(0, candidateCount - safeRowCount);
|
|
22364
|
+
const candidateScore = overflowPenalty * 3 + underflowPenalty * 2 + idealPenalty + phantomColumns * phantomPenalty;
|
|
22365
|
+
if (candidateScore < bestScore) {
|
|
22366
|
+
bestScore = candidateScore;
|
|
22367
|
+
bestCount = candidateCount;
|
|
22368
|
+
}
|
|
22369
|
+
}
|
|
22370
|
+
return bestCount;
|
|
22371
|
+
}
|
|
22372
|
+
function getGalleryGridLayoutStyle({
|
|
22373
|
+
isRailLayout,
|
|
22374
|
+
railCardWidth,
|
|
22375
|
+
fixedCardWidth,
|
|
22376
|
+
fixedColumnCount,
|
|
22377
|
+
containerWidth,
|
|
22378
|
+
rowCount,
|
|
22379
|
+
minCardWidth,
|
|
22380
|
+
idealCardWidth,
|
|
22381
|
+
maxCardWidth
|
|
22382
|
+
}) {
|
|
22383
|
+
if (isRailLayout) {
|
|
22384
|
+
return { gridAutoColumns: `${railCardWidth}px` };
|
|
22385
|
+
}
|
|
22386
|
+
if (fixedColumnCount) {
|
|
22387
|
+
const responsiveColumnCount = containerWidth ? Math.max(1, Math.min(
|
|
22388
|
+
fixedColumnCount,
|
|
22389
|
+
Math.floor((containerWidth + GALLERY_GRID_GAP_PX) / (minCardWidth + GALLERY_GRID_GAP_PX)) || 1
|
|
22390
|
+
)) : fixedColumnCount;
|
|
22391
|
+
return {
|
|
22392
|
+
gridTemplateColumns: `repeat(${responsiveColumnCount}, minmax(0, 1fr))`,
|
|
22393
|
+
justifyContent: "start",
|
|
22394
|
+
alignContent: "start"
|
|
22395
|
+
};
|
|
22396
|
+
}
|
|
22397
|
+
if (fixedCardWidth) {
|
|
22398
|
+
return {
|
|
22399
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(min(100%, ${fixedCardWidth}), ${fixedCardWidth}))`,
|
|
22400
|
+
justifyContent: "start",
|
|
22401
|
+
alignContent: "start"
|
|
22402
|
+
};
|
|
22403
|
+
}
|
|
22404
|
+
if (!containerWidth) {
|
|
22405
|
+
return {
|
|
22406
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(min(100%, ${minCardWidth}px), min(100%, ${maxCardWidth}px)))`,
|
|
22407
|
+
justifyContent: "start",
|
|
22408
|
+
alignContent: "start"
|
|
22409
|
+
};
|
|
22410
|
+
}
|
|
22411
|
+
const columnCount = getGalleryGridColumnCount({
|
|
22412
|
+
containerWidth,
|
|
22413
|
+
rowCount,
|
|
22414
|
+
minCardWidth,
|
|
22415
|
+
idealCardWidth,
|
|
22416
|
+
maxCardWidth,
|
|
22417
|
+
gap: GALLERY_GRID_GAP_PX
|
|
22418
|
+
});
|
|
22419
|
+
return {
|
|
22420
|
+
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
|
|
22421
|
+
justifyContent: "start",
|
|
22422
|
+
alignContent: "start"
|
|
22423
|
+
};
|
|
22424
|
+
}
|
|
22425
|
+
function getGalleryTextLength(value) {
|
|
22426
|
+
if (value === null || value === void 0) return 0;
|
|
22427
|
+
const text = String(value).trim();
|
|
22428
|
+
return text && text !== "\u2014" ? text.length : 0;
|
|
22429
|
+
}
|
|
22430
|
+
function getGalleryFieldText({
|
|
22431
|
+
column,
|
|
22432
|
+
row,
|
|
22433
|
+
getFieldValue,
|
|
22434
|
+
getDisplayText
|
|
22435
|
+
}) {
|
|
22436
|
+
if (!column) return "";
|
|
22437
|
+
const rawValue = getFieldValue(column, row);
|
|
22438
|
+
if (rawValue === null || rawValue === void 0 || rawValue === "") return "";
|
|
22439
|
+
const textValue = getDisplayText(rawValue);
|
|
22440
|
+
return textValue === "\u2014" ? "" : String(textValue);
|
|
22441
|
+
}
|
|
22442
|
+
function estimateLineCount({
|
|
22443
|
+
text,
|
|
22444
|
+
charsPerLine,
|
|
22445
|
+
maxLines
|
|
22446
|
+
}) {
|
|
22447
|
+
const textLength = getGalleryTextLength(text);
|
|
22448
|
+
if (!textLength) return 0;
|
|
22449
|
+
return Math.max(1, Math.min(maxLines, Math.ceil(textLength / charsPerLine)));
|
|
22450
|
+
}
|
|
22451
|
+
function estimateGalleryDetailCellHeight({
|
|
22452
|
+
text,
|
|
22453
|
+
density,
|
|
22454
|
+
bentoColumns
|
|
22455
|
+
}) {
|
|
22456
|
+
const baseHeight = density === "detailed" ? 54 : density === "compact" ? 44 : 48;
|
|
22457
|
+
const charsPerLine = bentoColumns === 1 ? density === "detailed" ? 32 : 26 : density === "detailed" ? 18 : 15;
|
|
22458
|
+
const maxLines = density === "detailed" ? 3 : 2;
|
|
22459
|
+
const lineCount = estimateLineCount({ text, charsPerLine, maxLines });
|
|
22460
|
+
if (!lineCount) return baseHeight;
|
|
22461
|
+
return baseHeight + Math.max(0, lineCount - 1) * 16;
|
|
22462
|
+
}
|
|
22463
|
+
function estimateGalleryDetailGridHeight({
|
|
22464
|
+
columns,
|
|
22465
|
+
density,
|
|
22466
|
+
bentoColumns
|
|
22467
|
+
}) {
|
|
22468
|
+
if (!columns.length) return 0;
|
|
22469
|
+
const cellHeights = columns.map((column) => estimateGalleryDetailCellHeight({
|
|
22470
|
+
text: column.text,
|
|
22471
|
+
density,
|
|
22472
|
+
bentoColumns
|
|
22473
|
+
}));
|
|
22474
|
+
if (bentoColumns === 1) {
|
|
22475
|
+
return 12 + cellHeights.reduce((sum, height) => sum + height, 0) + Math.max(0, columns.length - 1) * 8;
|
|
22476
|
+
}
|
|
22477
|
+
let totalHeight = 12;
|
|
22478
|
+
for (let index = 0; index < cellHeights.length; index += bentoColumns) {
|
|
22479
|
+
const rowHeights = cellHeights.slice(index, index + bentoColumns);
|
|
22480
|
+
totalHeight += Math.max(...rowHeights);
|
|
22481
|
+
if (index + bentoColumns < cellHeights.length) totalHeight += 8;
|
|
22482
|
+
}
|
|
22483
|
+
return totalHeight;
|
|
22484
|
+
}
|
|
22485
|
+
function getDefaultGalleryMasonryItemSize({
|
|
22486
|
+
row,
|
|
22487
|
+
columns,
|
|
22488
|
+
galleryFieldKey,
|
|
22489
|
+
galleryDensity,
|
|
22490
|
+
galleryBentoColumns,
|
|
22491
|
+
galleryDetailVisibility,
|
|
22492
|
+
galleryDetailLimit,
|
|
22493
|
+
getFieldValue,
|
|
22494
|
+
isMediaColumn,
|
|
22495
|
+
isTitleCandidate,
|
|
22496
|
+
isSummaryCandidate,
|
|
22497
|
+
getDisplayText,
|
|
22498
|
+
isImageField,
|
|
22499
|
+
isAudioField,
|
|
22500
|
+
cardVariant,
|
|
22501
|
+
renderPreview,
|
|
22502
|
+
renderLeadingVisual,
|
|
22503
|
+
hiddenDetailFieldKeys,
|
|
22504
|
+
layout,
|
|
22505
|
+
resolveRecordVisual
|
|
22506
|
+
}) {
|
|
22507
|
+
const iconColumn = columns.find((column) => column.renderType === "icon");
|
|
22508
|
+
const iconVisual = iconColumn && resolveRecordVisual ? resolveRecordVisual(row?.[iconColumn.key], row, iconColumn) : null;
|
|
22509
|
+
const selectedGalleryColumn = galleryFieldKey !== "auto" ? columns.find((column) => column.key === galleryFieldKey && isMediaColumn(column, row)) : null;
|
|
22510
|
+
const mediaColumn = selectedGalleryColumn || columns.find((column) => isMediaColumn(column, row)) || null;
|
|
22511
|
+
const mediaValue = mediaColumn ? getFieldValue(mediaColumn, row) : null;
|
|
22512
|
+
const isImageMedia = mediaColumn ? isImageField(mediaColumn, mediaValue) : false;
|
|
22513
|
+
const isAudioMedia = mediaColumn ? isAudioField(mediaColumn, mediaValue) : false;
|
|
22514
|
+
const hasDefaultLeadingVisual = Boolean(iconVisual);
|
|
22515
|
+
const hasLeadingVisual = Boolean(renderLeadingVisual) || hasDefaultLeadingVisual;
|
|
22516
|
+
const contentColumns = columns.filter((column) => column.key !== mediaColumn?.key && column.renderType !== "icon");
|
|
22517
|
+
const titleCandidates = contentColumns.filter((column) => {
|
|
22518
|
+
if (!column || isMediaColumn(column, row) || !isTitleCandidate(column, row)) return false;
|
|
22519
|
+
const value = getFieldValue(column, row);
|
|
22520
|
+
return !(value === null || value === void 0 || value === "");
|
|
22521
|
+
});
|
|
22522
|
+
const titleColumn = titleCandidates[0] || null;
|
|
22523
|
+
const titleText = titleColumn ? getGalleryFieldText({ column: titleColumn, row, getFieldValue, getDisplayText }) : String(getDisplayText(row?.linkKey || row?.id || ""));
|
|
22524
|
+
const summaryColumn = contentColumns.find((column) => {
|
|
22525
|
+
if (!column || column.key === titleColumn?.key || isMediaColumn(column, row) || !isSummaryCandidate(column, row)) return false;
|
|
22526
|
+
const summaryText2 = getGalleryFieldText({ column, row, getFieldValue, getDisplayText });
|
|
22527
|
+
return summaryText2.length > 12;
|
|
22528
|
+
}) || contentColumns.find((column) => {
|
|
22529
|
+
if (!column || column.key === titleColumn?.key || isMediaColumn(column, row) || !isSummaryCandidate(column, row)) return false;
|
|
22530
|
+
return getGalleryTextLength(getGalleryFieldText({ column, row, getFieldValue, getDisplayText })) > 0;
|
|
22531
|
+
}) || null;
|
|
22532
|
+
const summaryText = summaryColumn ? getGalleryFieldText({ column: summaryColumn, row, getFieldValue, getDisplayText }) : "";
|
|
22533
|
+
const hiddenDetailKeySet = new Set(hiddenDetailFieldKeys);
|
|
22534
|
+
const detailColumns = contentColumns.filter((column) => column.key !== titleColumn?.key && column.key !== summaryColumn?.key && !hiddenDetailKeySet.has(column.key)).map((column) => ({
|
|
22535
|
+
column,
|
|
22536
|
+
text: getGalleryFieldText({ column, row, getFieldValue, getDisplayText })
|
|
22537
|
+
}));
|
|
22538
|
+
const resolvedDetailLimit = getNormalizedGalleryDetailLimit2({
|
|
22539
|
+
density: galleryDensity,
|
|
22540
|
+
visibility: galleryDetailVisibility,
|
|
22541
|
+
limit: galleryDetailLimit
|
|
22542
|
+
});
|
|
22543
|
+
const visibleDetailColumns = Number.isFinite(resolvedDetailLimit) ? detailColumns.slice(0, resolvedDetailLimit) : detailColumns;
|
|
22544
|
+
const hiddenDetailCount = Math.max(detailColumns.length - visibleDetailColumns.length, 0);
|
|
22545
|
+
const resolvedBentoColumns = getNormalizedGalleryBentoColumns2(galleryBentoColumns, galleryDensity);
|
|
22546
|
+
const resolvedColumnWidth = layout?.columnWidth || getGalleryCardWidthMetrics(galleryDensity).ideal;
|
|
22547
|
+
if (cardVariant === "image-only") {
|
|
22548
|
+
return {
|
|
22549
|
+
width: resolvedColumnWidth,
|
|
22550
|
+
height: Math.round(resolvedColumnWidth * 1.25)
|
|
22551
|
+
};
|
|
22552
|
+
}
|
|
22553
|
+
if (cardVariant === "preview-only") {
|
|
22554
|
+
return {
|
|
22555
|
+
width: resolvedColumnWidth,
|
|
22556
|
+
height: Math.round(resolvedColumnWidth * 0.82)
|
|
22557
|
+
};
|
|
22558
|
+
}
|
|
22559
|
+
let estimatedHeight = galleryDensity === "detailed" ? 84 : galleryDensity === "compact" ? 64 : 72;
|
|
22560
|
+
if (typeof renderPreview === "function") {
|
|
22561
|
+
estimatedHeight += galleryDensity === "detailed" ? 188 : galleryDensity === "compact" ? 140 : 164;
|
|
22562
|
+
} else if (isImageMedia) {
|
|
22563
|
+
estimatedHeight += Math.round(resolvedColumnWidth * (galleryDensity === "detailed" ? 0.72 : 0.62)) + 12;
|
|
22564
|
+
} else if (isAudioMedia) {
|
|
22565
|
+
estimatedHeight += 92;
|
|
22566
|
+
}
|
|
22567
|
+
const titleLines = estimateLineCount({
|
|
22568
|
+
text: titleText,
|
|
22569
|
+
charsPerLine: galleryDensity === "detailed" ? 26 : 24,
|
|
22570
|
+
maxLines: 2
|
|
22571
|
+
}) || 1;
|
|
22572
|
+
const summaryLines = estimateLineCount({
|
|
22573
|
+
text: summaryText,
|
|
22574
|
+
charsPerLine: hasLeadingVisual ? 22 : galleryDensity === "detailed" ? 30 : 26,
|
|
22575
|
+
maxLines: galleryDensity === "detailed" ? 4 : 2
|
|
22576
|
+
});
|
|
22577
|
+
const textHeaderHeight = 26 + titleLines * 18 + (summaryLines > 0 ? summaryLines * 16 + 4 : 0);
|
|
22578
|
+
estimatedHeight += Math.max(hasLeadingVisual ? 56 : 0, textHeaderHeight);
|
|
22579
|
+
estimatedHeight += estimateGalleryDetailGridHeight({
|
|
22580
|
+
columns: visibleDetailColumns,
|
|
22581
|
+
density: galleryDensity,
|
|
22582
|
+
bentoColumns: resolvedBentoColumns
|
|
22583
|
+
});
|
|
22584
|
+
if (hiddenDetailCount > 0) estimatedHeight += 18;
|
|
22585
|
+
if (!summaryText && visibleDetailColumns.length === 0) estimatedHeight += 24;
|
|
22586
|
+
return {
|
|
22587
|
+
width: resolvedColumnWidth,
|
|
22588
|
+
height: estimatedHeight
|
|
22589
|
+
};
|
|
22590
|
+
}
|
|
22591
|
+
function WorkbenchGalleryView({
|
|
22592
|
+
rows = [],
|
|
22593
|
+
columns = [],
|
|
22594
|
+
onRowClick = () => {
|
|
22595
|
+
},
|
|
22596
|
+
selectedLinkKey,
|
|
22597
|
+
selectedRowKey,
|
|
22598
|
+
className,
|
|
22599
|
+
isMasonry = false,
|
|
22600
|
+
galleryLayoutMode = "auto",
|
|
22601
|
+
galleryRailCardWidth,
|
|
22602
|
+
galleryGridColumns,
|
|
22603
|
+
galleryGridCardWidth,
|
|
22604
|
+
galleryMasonryColumnWidth,
|
|
22605
|
+
masonryPlacementStrategy = "shelf",
|
|
22606
|
+
galleryFieldKey = "auto",
|
|
22607
|
+
galleryDensity = "comfortable",
|
|
22608
|
+
galleryBentoColumns = 2,
|
|
22609
|
+
galleryDetailVisibility = "limit",
|
|
22610
|
+
galleryDetailLimit,
|
|
22611
|
+
shouldEnhanceMultimodal = true,
|
|
22612
|
+
getFieldValue,
|
|
22613
|
+
isMediaColumn,
|
|
22614
|
+
isTitleCandidate,
|
|
22615
|
+
isSummaryCandidate,
|
|
22616
|
+
getDisplayText,
|
|
22617
|
+
renderFieldValue,
|
|
22618
|
+
getImagePreviewSrc,
|
|
22619
|
+
isImageField,
|
|
22620
|
+
isAudioField,
|
|
22621
|
+
AudioPlayerComponent,
|
|
22622
|
+
cardVariant = "default",
|
|
22623
|
+
renderPreview,
|
|
22624
|
+
renderMeta,
|
|
22625
|
+
renderLeadingVisual,
|
|
22626
|
+
resolveRecordVisual,
|
|
22627
|
+
hiddenDetailFieldKeys = [],
|
|
22628
|
+
labels,
|
|
22629
|
+
formatLabel,
|
|
22630
|
+
getMasonryItemSize
|
|
22631
|
+
}) {
|
|
22632
|
+
const containerRef = useRef(null);
|
|
22633
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
22634
|
+
const { min: resolvedMinCardWidth, ideal: resolvedIdealCardWidth, max: resolvedMaxCardWidth } = getGalleryCardWidthMetrics(galleryDensity);
|
|
22635
|
+
const resolvedRailCardWidth = galleryRailCardWidth || resolvedMinCardWidth;
|
|
22636
|
+
const resolvedGridColumnCount = getNormalizedGalleryGridColumns(galleryGridColumns);
|
|
22637
|
+
const resolvedGridCardWidth = getNormalizedGalleryGridCardWidth(galleryGridCardWidth);
|
|
22638
|
+
const resolvedMasonryColumnWidth = galleryMasonryColumnWidth || resolvedMinCardWidth;
|
|
22639
|
+
const isRailLayout = galleryLayoutMode === "rail";
|
|
22640
|
+
const resolvedGetFieldValue = getFieldValue || getDefaultGalleryFieldValue;
|
|
22641
|
+
const resolvedGetDisplayText = getDisplayText || getDefaultGalleryDisplayText;
|
|
22642
|
+
const resolvedIsImageField = isImageField || isDefaultGalleryImageField;
|
|
22643
|
+
const resolvedIsAudioField = isAudioField || isDefaultGalleryAudioField;
|
|
22644
|
+
const resolvedIsMediaColumn = isMediaColumn || ((column, row) => isDefaultGalleryMediaColumn(column, row, {
|
|
22645
|
+
getFieldValue: resolvedGetFieldValue,
|
|
22646
|
+
shouldEnhanceMultimodal,
|
|
22647
|
+
isImageField: resolvedIsImageField,
|
|
22648
|
+
isAudioField: resolvedIsAudioField
|
|
22649
|
+
}));
|
|
22650
|
+
const resolvedIsTitleCandidate = isTitleCandidate || ((column, row) => isDefaultGalleryTitleCandidate(column, row, { isMediaColumn: resolvedIsMediaColumn }));
|
|
22651
|
+
const resolvedIsSummaryCandidate = isSummaryCandidate || ((column, row) => isDefaultGallerySummaryCandidate(column, row, { isMediaColumn: resolvedIsMediaColumn }));
|
|
22652
|
+
const resolvedRenderFieldValue = renderFieldValue || ((column, row, { compact } = {}) => /* @__PURE__ */ jsx("span", { children: resolvedGetDisplayText(resolvedGetFieldValue(column, row)) }));
|
|
22653
|
+
useEffect(() => {
|
|
22654
|
+
if (isMasonry || isRailLayout || resolvedGridCardWidth) return void 0;
|
|
22655
|
+
const node = containerRef.current;
|
|
22656
|
+
if (!node) return void 0;
|
|
22657
|
+
const updateWidth = () => {
|
|
22658
|
+
const nextWidth = Math.round(node.getBoundingClientRect().width);
|
|
22659
|
+
setContainerWidth((prevWidth) => prevWidth === nextWidth ? prevWidth : nextWidth);
|
|
22660
|
+
};
|
|
22661
|
+
updateWidth();
|
|
22662
|
+
if (typeof ResizeObserver === "function") {
|
|
22663
|
+
const observer = new ResizeObserver(() => updateWidth());
|
|
22664
|
+
observer.observe(node);
|
|
22665
|
+
return () => observer.disconnect();
|
|
22666
|
+
}
|
|
22667
|
+
window.addEventListener("resize", updateWidth);
|
|
22668
|
+
return () => window.removeEventListener("resize", updateWidth);
|
|
22669
|
+
}, [isMasonry, isRailLayout, resolvedGridCardWidth]);
|
|
22670
|
+
const layoutStyle = useMemo(() => getGalleryGridLayoutStyle({
|
|
22671
|
+
isRailLayout,
|
|
22672
|
+
railCardWidth: resolvedRailCardWidth,
|
|
22673
|
+
fixedCardWidth: resolvedGridCardWidth,
|
|
22674
|
+
fixedColumnCount: resolvedGridColumnCount,
|
|
22675
|
+
containerWidth,
|
|
22676
|
+
rowCount: rows.length,
|
|
22677
|
+
minCardWidth: resolvedMinCardWidth,
|
|
22678
|
+
idealCardWidth: resolvedIdealCardWidth,
|
|
22679
|
+
maxCardWidth: resolvedMaxCardWidth
|
|
22680
|
+
}), [
|
|
22681
|
+
containerWidth,
|
|
22682
|
+
isRailLayout,
|
|
22683
|
+
resolvedGridCardWidth,
|
|
22684
|
+
resolvedGridColumnCount,
|
|
22685
|
+
resolvedIdealCardWidth,
|
|
22686
|
+
resolvedMaxCardWidth,
|
|
22687
|
+
resolvedMinCardWidth,
|
|
22688
|
+
resolvedRailCardWidth,
|
|
22689
|
+
rows.length
|
|
22690
|
+
]);
|
|
22691
|
+
const renderGalleryCard = (row, rowIndex) => /* @__PURE__ */ jsx(
|
|
22692
|
+
WorkbenchGalleryCard,
|
|
22693
|
+
{
|
|
22694
|
+
row,
|
|
22695
|
+
columns,
|
|
22696
|
+
onClick: () => onRowClick(row, rowIndex),
|
|
22697
|
+
isSelected: String(row?.linkKey || row?.id || "") === String(selectedRowKey || selectedLinkKey || ""),
|
|
22698
|
+
isMasonry,
|
|
22699
|
+
galleryFieldKey,
|
|
22700
|
+
galleryDensity,
|
|
22701
|
+
galleryBentoColumns,
|
|
22702
|
+
galleryDetailVisibility,
|
|
22703
|
+
galleryDetailLimit,
|
|
22704
|
+
shouldEnhanceMultimodal,
|
|
22705
|
+
getFieldValue: resolvedGetFieldValue,
|
|
22706
|
+
isMediaColumn: resolvedIsMediaColumn,
|
|
22707
|
+
isTitleCandidate: resolvedIsTitleCandidate,
|
|
22708
|
+
isSummaryCandidate: resolvedIsSummaryCandidate,
|
|
22709
|
+
getDisplayText: resolvedGetDisplayText,
|
|
22710
|
+
renderFieldValue: resolvedRenderFieldValue,
|
|
22711
|
+
getImagePreviewSrc,
|
|
22712
|
+
isImageField: resolvedIsImageField,
|
|
22713
|
+
isAudioField: resolvedIsAudioField,
|
|
22714
|
+
AudioPlayerComponent,
|
|
22715
|
+
cardVariant,
|
|
22716
|
+
renderPreview,
|
|
22717
|
+
renderMeta,
|
|
22718
|
+
renderLeadingVisual,
|
|
22719
|
+
resolveRecordVisual,
|
|
22720
|
+
hiddenDetailFieldKeys,
|
|
22721
|
+
labels,
|
|
22722
|
+
formatLabel
|
|
22723
|
+
},
|
|
22724
|
+
row?.id || row?.linkKey || rowIndex
|
|
22725
|
+
);
|
|
22726
|
+
if (isMasonry) {
|
|
22727
|
+
return /* @__PURE__ */ jsx(
|
|
22728
|
+
WorkbenchMasonryLayout,
|
|
22729
|
+
{
|
|
22730
|
+
items: rows,
|
|
22731
|
+
className,
|
|
22732
|
+
gap: GALLERY_GRID_GAP_PX,
|
|
22733
|
+
columnWidth: resolvedMasonryColumnWidth,
|
|
22734
|
+
placementStrategy: masonryPlacementStrategy,
|
|
22735
|
+
getItemKey: (row, rowIndex) => row?.id || row?.linkKey || rowIndex,
|
|
22736
|
+
getItemSize: (row, layout) => {
|
|
22737
|
+
const defaultSize = getDefaultGalleryMasonryItemSize({
|
|
22738
|
+
row,
|
|
22739
|
+
columns,
|
|
22740
|
+
galleryFieldKey,
|
|
22741
|
+
galleryDensity,
|
|
22742
|
+
galleryBentoColumns,
|
|
22743
|
+
galleryDetailVisibility,
|
|
22744
|
+
galleryDetailLimit,
|
|
22745
|
+
getFieldValue: resolvedGetFieldValue,
|
|
22746
|
+
isMediaColumn: resolvedIsMediaColumn,
|
|
22747
|
+
isTitleCandidate: resolvedIsTitleCandidate,
|
|
22748
|
+
isSummaryCandidate: resolvedIsSummaryCandidate,
|
|
22749
|
+
getDisplayText: resolvedGetDisplayText,
|
|
22750
|
+
isImageField: resolvedIsImageField,
|
|
22751
|
+
isAudioField: resolvedIsAudioField,
|
|
22752
|
+
cardVariant,
|
|
22753
|
+
renderPreview,
|
|
22754
|
+
renderLeadingVisual,
|
|
22755
|
+
hiddenDetailFieldKeys,
|
|
22756
|
+
layout,
|
|
22757
|
+
resolveRecordVisual
|
|
22758
|
+
});
|
|
22759
|
+
if (typeof getMasonryItemSize !== "function") return defaultSize;
|
|
22760
|
+
const customSize = getMasonryItemSize(row, { ...layout, defaultSize }) || {};
|
|
22761
|
+
return {
|
|
22762
|
+
...defaultSize,
|
|
22763
|
+
...customSize
|
|
22764
|
+
};
|
|
22765
|
+
},
|
|
22766
|
+
renderItem: (row) => renderGalleryCard(row, rows.indexOf(row))
|
|
22767
|
+
}
|
|
22768
|
+
);
|
|
22769
|
+
}
|
|
22770
|
+
return /* @__PURE__ */ jsx(
|
|
22771
|
+
"div",
|
|
22772
|
+
{
|
|
22773
|
+
ref: containerRef,
|
|
22774
|
+
className: cn(
|
|
22775
|
+
isRailLayout ? "grid grid-flow-col items-center gap-3" : "grid items-start gap-3",
|
|
22776
|
+
className
|
|
22777
|
+
),
|
|
22778
|
+
style: layoutStyle,
|
|
22779
|
+
children: rows.map((row, rowIndex) => renderGalleryCard(row, rowIndex))
|
|
22780
|
+
}
|
|
22781
|
+
);
|
|
22782
|
+
}
|
|
19972
22783
|
function cn4(...inputs) {
|
|
19973
22784
|
return inputs.filter(Boolean).join(" ");
|
|
19974
22785
|
}
|
|
@@ -20262,6 +23073,6 @@ lodash/lodash.js:
|
|
|
20262
23073
|
*)
|
|
20263
23074
|
*/
|
|
20264
23075
|
|
|
20265
|
-
export { ARTIST_CONFIG, ARTIST_DEFAULT_QUICK_ACTIONS, AppHeader, AppLayout, AppSidebar, ArtistLandingPage, AuthDivider, BSD_CONFIG, BSD_DEFAULT_FEATURE_CARDS, BaseAccordion, BaseAvatar, BaseBadge, BaseBreadcrumb, BaseButton, BaseCheckbox, BaseContextMenu, BaseContextMenuCheckboxItem, BaseContextMenuContent, BaseContextMenuItem, BaseContextMenuLabel, BaseContextMenuRadioGroup, BaseContextMenuRadioItem, BaseContextMenuSeparator, BaseContextMenuSub, BaseContextMenuSubContent, BaseContextMenuSubTrigger, BaseContextMenuTrigger, BaseDescriptionList, BaseDialog, BaseDivider, BaseDropdownMenu, BaseEmptyState, BaseField, BaseInput, BaseLoadingState, BaseNotice, BasePagination, BasePanel, BaseProgress, BaseRadioGroup, BaseSectionHeader, BaseSegmentedControl, BaseSelect, BaseSkeleton, BaseSwitch, BaseTable, BaseTableBody, BaseTableCaption, BaseTableCell, BaseTableContainer, BaseTableEmpty, BaseTableFooter, BaseTableFooterBar, BaseTableHead, BaseTableHeader, BaseTableLoading, BaseTableRow, BaseTabs, BaseTextarea, BaseToolbar, BaseTooltip, BsdLandingPage, BsdToolboxPanel, CONCEPT_CONFIG, CONCEPT_DEFAULT_QUICK_ACTIONS, ConceptDesignLandingPage, DarkModeSelector, DarkModeSubMenu, DataExplorerActionBar, DataExplorerButton, DataExplorerCheckbox, DataExplorerCollectionFooter, DataExplorerDetailField, DataExplorerDetailSection, DataExplorerDetailShell, DataExplorerDisplayActionMenu, DataExplorerDisplayCard, DataExplorerDisplayCollectionView, DataExplorerDisplayListItem, DataExplorerDisplayMedia, DataExplorerImagePreview, DataExplorerPage, DataExplorerRecordCard, DataExplorerSelect, DataExplorerToolbarActions, DataExplorerToolbarShell, DataExplorerTree, DataExplorerTreeShell, DataExplorerView, DataExplorerViewCollection, DataExplorerViewItem, DataExplorerViewItemShell, DataExplorerViewShell, DataExplorerViewTree, DefaultLandingPage, DynamicComponent, EmailAuth, I18nSelector, LoginLayout, NavButton, OAuthButton, OIDCButton, PendingApproval, applyMonkeysTheme, calculateHue, calculateLightness, calculateSaturation, clearRegistry, cn3 as cn, createSolidColorScale, genTailwindTheme, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, getDataExplorerActionToneClassName, getDataExplorerMenuItemToneClassName, getRegisteredComponents, getRegisteredThemes, getThemeConfig, hasCustomComponent, markDarkColor, registerComponent, registerTheme, resolveBaseAppearance, resolveComponent, resolveDataExplorerAppearance, resolveMonkeysTheme, setNeocardTheme, setTailwindTheme, useDarkMode };
|
|
23076
|
+
export { ARTIST_CONFIG, ARTIST_DEFAULT_QUICK_ACTIONS, AppHeader, AppLayout, AppSidebar, ArtistLandingPage, AuthDivider, BSD_CONFIG, BSD_DEFAULT_FEATURE_CARDS, BaseAccordion, BaseAvatar, BaseBadge, BaseBreadcrumb, BaseButton, BaseCheckbox, BaseContextMenu, BaseContextMenuCheckboxItem, BaseContextMenuContent, BaseContextMenuItem, BaseContextMenuLabel, BaseContextMenuRadioGroup, BaseContextMenuRadioItem, BaseContextMenuSeparator, BaseContextMenuSub, BaseContextMenuSubContent, BaseContextMenuSubTrigger, BaseContextMenuTrigger, BaseDescriptionList, BaseDialog, BaseDivider, BaseDropdownMenu, BaseEmptyState, BaseField, BaseInput, BaseLoadingState, BaseNotice, BasePagination, BasePanel, BaseProgress, BaseRadioGroup, BaseSectionHeader, BaseSegmentedControl, BaseSelect, BaseSkeleton, BaseSwitch, BaseTable, BaseTableBody, BaseTableCaption, BaseTableCell, BaseTableContainer, BaseTableEmpty, BaseTableFooter, BaseTableFooterBar, BaseTableHead, BaseTableHeader, BaseTableLoading, BaseTableRow, BaseTabs, BaseTextarea, BaseToolbar, BaseTooltip, BsdLandingPage, BsdToolboxPanel, CONCEPT_CONFIG, CONCEPT_DEFAULT_QUICK_ACTIONS, ConceptDesignLandingPage, DarkModeSelector, DarkModeSubMenu, DataExplorerActionBar, DataExplorerButton, DataExplorerCheckbox, DataExplorerCollectionFooter, DataExplorerDetailField, DataExplorerDetailSection, DataExplorerDetailShell, DataExplorerDisplayActionMenu, DataExplorerDisplayCard, DataExplorerDisplayCollectionView, DataExplorerDisplayListItem, DataExplorerDisplayMedia, DataExplorerImagePreview, DataExplorerPage, DataExplorerRecordCard, DataExplorerSelect, DataExplorerToolbarActions, DataExplorerToolbarShell, DataExplorerTree, DataExplorerTreeShell, DataExplorerView, DataExplorerViewCollection, DataExplorerViewItem, DataExplorerViewItemShell, DataExplorerViewShell, DataExplorerViewTree, DefaultLandingPage, DynamicComponent, EmailAuth, I18nSelector, LoginLayout, NavButton, OAuthButton, OIDCButton, PendingApproval, WorkbenchContentPane, WorkbenchContentToolbar, WorkbenchDetailSidebar, WorkbenchGalleryCard, WorkbenchGallerySettingsButton, WorkbenchGallerySettingsPanel, WorkbenchGalleryView, WorkbenchMasonryLayout, WorkbenchResizableSidebar, WorkbenchTableView, applyMonkeysTheme, calculateHue, calculateLightness, calculateSaturation, clearRegistry, cn3 as cn, createSolidColorScale, genTailwindTheme, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, getDataExplorerActionToneClassName, getDataExplorerMenuItemToneClassName, getRegisteredComponents, getRegisteredThemes, getThemeConfig, hasCustomComponent, markDarkColor, registerComponent, registerTheme, resolveBaseAppearance, resolveComponent, resolveDataExplorerAppearance, resolveMonkeysTheme, setNeocardTheme, setTailwindTheme, useDarkMode };
|
|
20266
23077
|
//# sourceMappingURL=index.mjs.map
|
|
20267
23078
|
//# sourceMappingURL=index.mjs.map
|