@humain/ui 2.1.62 → 2.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/organisms/ai/AIToolCall/AIToolCall.d.ts +9 -3
- package/dist/components/organisms/ai/AIToolRun/index.d.ts +1 -1
- package/dist/components/organisms/ai/AIToolRun/validation.d.ts +24 -3
- package/dist/components/organisms/ai/_shared/format-ai-duration.d.ts +1 -0
- package/dist/components/organisms/ai/_shared/workflow-step-renderer.d.ts +1 -0
- package/dist/index.js +52 -52
- package/dist/index151.js +1 -1
- package/dist/index174.js +10 -333
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +310 -137
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +148 -174
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +186 -78
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +74 -124
- package/dist/index178.js.map +1 -1
- package/dist/index179.js +133 -1
- package/dist/index179.js.map +1 -0
- package/dist/index180.js +2 -201
- package/dist/index181.js +201 -0
- package/dist/{index180.js.map → index181.js.map} +1 -1
- package/dist/index183.js +130 -166
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +195 -983
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +1069 -369
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +395 -197
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +198 -243
- package/dist/index187.js.map +1 -1
- package/dist/index188.js +263 -3
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +3 -209
- package/dist/index189.js.map +1 -1
- package/dist/index190.js +190 -777
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +771 -252
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +250 -65
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +72 -523
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +537 -144
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +139 -720
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +707 -167
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +175 -151
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +152 -487
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +472 -225
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +236 -260
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +265 -215
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +207 -307
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +302 -135
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +140 -271
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +263 -253
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +244 -137
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +100 -238
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +278 -74
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +56 -97
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +142 -47
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +38 -84
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +72 -252
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +274 -26
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +29 -94
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +98 -25
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +20 -565
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +564 -17
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +20 -23
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +20 -95
- package/dist/index219.js.map +1 -1
- package/dist/index220.js +92 -88
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +97 -29
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +24 -470
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +446 -196
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +199 -729
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +750 -61
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +58 -181
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +175 -259
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +246 -172
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +195 -32
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +12 -40
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +23 -26
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +45 -22
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +27 -48
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +52 -26
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +40 -225
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +217 -39
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +50 -0
- package/dist/index237.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/wc/AIToolCall.js +218 -0
- package/dist/wc/AIToolCall.js.map +1 -0
- package/dist/wc/hf-ai-tool-call.js +34 -219
- package/dist/wc/hf-ai-tool-call.js.map +1 -1
- package/dist/wc/hf-ai-tool-run.js +673 -576
- package/dist/wc/hf-ai-tool-run.js.map +1 -1
- package/dist/wc/workflow-step-renderer.js +94 -86
- package/dist/wc/workflow-step-renderer.js.map +1 -1
- package/dist/wc-react/AIToolCall.js +218 -0
- package/dist/wc-react/AIToolCall.js.map +1 -0
- package/dist/wc-react/hf-ai-tool-call.js +32 -217
- package/dist/wc-react/hf-ai-tool-call.js.map +1 -1
- package/dist/wc-react/hf-ai-tool-run.js +698 -601
- package/dist/wc-react/hf-ai-tool-run.js.map +1 -1
- package/dist/wc-react/workflow-step-renderer.js +76 -68
- package/dist/wc-react/workflow-step-renderer.js.map +1 -1
- package/package.json +1 -1
- package/skills/humain-ui/SKILL.md +1 -1
- package/skills/humain-ui-wc/SKILL.md +1 -1
- package/skills/humain-ui-wc.skill +0 -0
- package/skills/humain-ui.skill +0 -0
- package/dist/index182.js +0 -143
- package/dist/index182.js.map +0 -1
- package/dist/wc/wrench.js +0 -10
- package/dist/wc/wrench.js.map +0 -1
- package/dist/wc-react/wrench.js +0 -10
- package/dist/wc-react/wrench.js.map +0 -1
package/dist/index223.js
CHANGED
|
@@ -1,229 +1,479 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "./index2.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "./index49.js";
|
|
4
|
+
import { AppShell as AppShell$1 } from "./index214.js";
|
|
5
|
+
import { Sheet as SheetNamespace, SheetContent } from "./index215.js";
|
|
6
|
+
import { useIsMobile } from "./index216.js";
|
|
7
|
+
import { SidebarContext } from "./index217.js";
|
|
8
|
+
import { AppShellProvider, PanelIndexContext, PanelLayoutContext } from "./index218.js";
|
|
9
|
+
import { AppShellContent } from "./index219.js";
|
|
10
|
+
import { AppShellMobileTabBar } from "./index220.js";
|
|
11
|
+
import { AppShellPanel } from "./index221.js";
|
|
12
|
+
import { getExpandedPanelFromLayout, layoutMapToTuple, normalizePanelSizes, toResizableMinSize, toResizablePercentageSize } from "./index222.js";
|
|
8
13
|
import * as React from "react";
|
|
9
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
//#region src/components/templates/
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var MENU_TYPE = "AppShellCard.Menu";
|
|
15
|
-
var TITLE_TYPE = "AppShellCard.Title";
|
|
16
|
-
function getAppShellCardType(child) {
|
|
17
|
-
if (!child.type || typeof child.type === "string") return;
|
|
18
|
-
return child.type.__appShellCardType;
|
|
15
|
+
//#region src/components/templates/AppShell/AppShell.tsx
|
|
16
|
+
var DEFAULT_APP_SHELL_BACKGROUND = "var(--app-background)";
|
|
17
|
+
function isAppShellPanelComponent(type) {
|
|
18
|
+
return typeof type === "function" && type.__appShellType === "AppShell.Panel";
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
return component;
|
|
20
|
+
function isAppShellPanelElement(child) {
|
|
21
|
+
return React.isValidElement(child) && isAppShellPanelComponent(child.type);
|
|
23
22
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
if (Array.isArray(node)) return node.map(getNodeText).join("");
|
|
27
|
-
if (React.isValidElement(node)) return getNodeText(node.props.children);
|
|
28
|
-
return "";
|
|
23
|
+
function getAppShellPanelIdentity(panel, ariaBaseId, index) {
|
|
24
|
+
return panel.key ?? panel.props.label ?? `${ariaBaseId}-panel-${index}`;
|
|
29
25
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
26
|
+
function AppShellPanelWithLayout({ panel, visible, index, overrides = {}, isMobile, activePanel, hasExpanded, hasTabBar, ariaBaseId, rootExpansionActive, firstExpandedIndex, onExpandedPanelChange }) {
|
|
27
|
+
if (isMobile && index !== activePanel) return null;
|
|
28
|
+
const layoutInfo = {
|
|
29
|
+
visible: isMobile ? true : visible,
|
|
30
|
+
collapseMode: hasExpanded ? "animated" : "removed",
|
|
31
|
+
isMobile,
|
|
32
|
+
tabId: hasTabBar ? `${ariaBaseId}-tab-${index}` : void 0,
|
|
33
|
+
panelId: hasTabBar ? `${ariaBaseId}-tabpanel-${index}` : void 0,
|
|
34
|
+
expanded: rootExpansionActive ? hasExpanded && index === firstExpandedIndex : void 0,
|
|
35
|
+
onExpandedChange: rootExpansionActive ? (nextExpanded) => onExpandedPanelChange(nextExpanded ? index : null) : void 0,
|
|
36
|
+
...overrides
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsx(PanelIndexContext.Provider, {
|
|
39
|
+
value: index,
|
|
40
|
+
children: /* @__PURE__ */ jsx(PanelLayoutContext.Provider, {
|
|
41
|
+
value: layoutInfo,
|
|
42
|
+
children: panel
|
|
43
|
+
})
|
|
39
44
|
});
|
|
40
|
-
return titleText;
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
function AppShellRoot({ background = DEFAULT_APP_SHELL_BACKGROUND, height = "100dvh", padding = 16, mobilePadding, gap = 12, connected = false, skipToId, activePanel: activePanelProp, onActivePanelChange, defaultActivePanel = 0, expandedPanel: expandedPanelProp, defaultExpandedPanel, onExpandedPanelChange, resizablePanels, defaultPanelSizes, panelSizes, onPanelSizesChange, expandThreshold = 85, className, children, ...props }) {
|
|
47
|
+
const isMobile = useIsMobile();
|
|
48
|
+
const ariaBaseId = React.useId();
|
|
49
|
+
const [internalActivePanel, setInternalActivePanel] = React.useState(defaultActivePanel);
|
|
50
|
+
const [internalExpandedPanel, setInternalExpandedPanel] = React.useState(defaultExpandedPanel ?? null);
|
|
51
|
+
const [internalPanelSizes, setInternalPanelSizes] = React.useState(() => normalizePanelSizes(defaultPanelSizes));
|
|
52
|
+
const [isResizingPanels, setIsResizingPanels] = React.useState(false);
|
|
53
|
+
const [isRestoringResizablePanels, setIsRestoringResizablePanels] = React.useState(false);
|
|
54
|
+
const [internalMobileSidebarOpen, setInternalMobileSidebarOpen] = React.useState(false);
|
|
55
|
+
const resizableGroupRef = React.useRef(null);
|
|
56
|
+
const rootRef = React.useRef(null);
|
|
57
|
+
const allowResizeReleaseExpansionRef = React.useRef(false);
|
|
58
|
+
const suppressControlledLayoutChangeRef = React.useRef(false);
|
|
59
|
+
const previousResizableExpandedRef = React.useRef(false);
|
|
60
|
+
const activePanel = activePanelProp ?? internalActivePanel;
|
|
61
|
+
const handleActivePanelChange = React.useCallback((index) => {
|
|
62
|
+
if (activePanelProp === void 0) setInternalActivePanel((prev) => prev === index ? prev : index);
|
|
63
|
+
onActivePanelChange?.(index);
|
|
64
|
+
}, [activePanelProp, onActivePanelChange]);
|
|
65
|
+
const rootExpansionRequested = expandedPanelProp !== void 0 || defaultExpandedPanel !== void 0 || onExpandedPanelChange !== void 0;
|
|
66
|
+
const resolvedExpandedPanel = expandedPanelProp !== void 0 ? expandedPanelProp : internalExpandedPanel;
|
|
67
|
+
const handleExpandedPanelChange = React.useCallback((panelIndex) => {
|
|
68
|
+
if (expandedPanelProp === void 0) setInternalExpandedPanel(panelIndex);
|
|
69
|
+
onExpandedPanelChange?.(panelIndex);
|
|
70
|
+
}, [expandedPanelProp, onExpandedPanelChange]);
|
|
71
|
+
const { panels, panelInfos, sidebarChild, otherChildren } = React.useMemo(() => {
|
|
72
|
+
const p = [];
|
|
73
|
+
const infos = [];
|
|
74
|
+
let sidebar = null;
|
|
75
|
+
const other = [];
|
|
76
|
+
React.Children.forEach(children, (child) => {
|
|
77
|
+
if (isAppShellPanelElement(child)) {
|
|
78
|
+
infos.push({
|
|
79
|
+
key: child.key ?? child.props.label,
|
|
80
|
+
label: child.props.label
|
|
81
|
+
});
|
|
82
|
+
p.push(child);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!React.isValidElement(child)) return;
|
|
86
|
+
if (child.type === AppShellSidebar) sidebar = child;
|
|
87
|
+
else other.push(child);
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
panels: p,
|
|
91
|
+
panelInfos: infos,
|
|
92
|
+
sidebarChild: sidebar,
|
|
93
|
+
otherChildren: other
|
|
94
|
+
};
|
|
95
|
+
}, [children]);
|
|
96
|
+
const shouldUseResizablePanels = resizablePanels ?? true;
|
|
97
|
+
const firstPanelExpandedIndex = panels.findIndex((p) => p.props.expanded);
|
|
98
|
+
const hasPanelExpansionProps = panels.some((panel) => panel.props.expanded !== void 0 || panel.props.onExpandedChange !== void 0);
|
|
99
|
+
const canUseResizablePanelPair = shouldUseResizablePanels && !connected && !isMobile && panels.length === 2 && (resizablePanels !== void 0 || !hasPanelExpansionProps);
|
|
100
|
+
const rootExpansionActive = rootExpansionRequested || canUseResizablePanelPair;
|
|
101
|
+
const validRootExpandedPanel = typeof resolvedExpandedPanel === "number" && Number.isInteger(resolvedExpandedPanel) && resolvedExpandedPanel >= 0 && resolvedExpandedPanel < panels.length ? resolvedExpandedPanel : null;
|
|
102
|
+
let firstExpandedIndex = firstPanelExpandedIndex;
|
|
103
|
+
if (rootExpansionActive) firstExpandedIndex = validRootExpandedPanel;
|
|
104
|
+
const hasExpanded = firstExpandedIndex !== -1 && firstExpandedIndex !== null;
|
|
105
|
+
const visibleCount = hasExpanded ? 1 : Math.min(panels.length, 2);
|
|
106
|
+
const canRenderResizablePanels = canUseResizablePanelPair;
|
|
107
|
+
const resolvedPanelSizes = React.useMemo(() => normalizePanelSizes(panelSizes ?? internalPanelSizes), [panelSizes, internalPanelSizes]);
|
|
108
|
+
const resizablePanelSizes = React.useMemo(() => {
|
|
109
|
+
if (hasExpanded && firstExpandedIndex === 0) return [100, 0];
|
|
110
|
+
if (hasExpanded && firstExpandedIndex === 1) return [0, 100];
|
|
111
|
+
return resolvedPanelSizes;
|
|
112
|
+
}, [
|
|
113
|
+
firstExpandedIndex,
|
|
114
|
+
hasExpanded,
|
|
115
|
+
resolvedPanelSizes
|
|
116
|
+
]);
|
|
117
|
+
const shouldBypassResizableMinSize = hasExpanded || isRestoringResizablePanels || !hasExpanded && previousResizableExpandedRef.current;
|
|
118
|
+
if (process.env.NODE_ENV !== "production") {
|
|
119
|
+
const expandedPanelPropCount = panels.filter((p) => p.props.expanded).length;
|
|
120
|
+
if (rootExpansionActive && expandedPanelPropCount > 0) console.warn("AppShell.Root: root-owned expansion props should not be mixed with AppShell.Panel expanded. Root expansion will be used.");
|
|
121
|
+
if (!rootExpansionActive && expandedPanelPropCount > 1) console.warn("AppShell.Root: multiple panels have expanded={true}. Only the first expanded panel will be shown.");
|
|
122
|
+
if (rootExpansionActive && resolvedExpandedPanel !== null && resolvedExpandedPanel !== void 0 && validRootExpandedPanel === null) console.warn(`AppShell.Root: expandedPanel index ${resolvedExpandedPanel} is out of range. No panel will be expanded.`);
|
|
123
|
+
if (resizablePanels === true && connected) console.warn("AppShell.Root: resizablePanels is not supported with connected. Rendering non-resizable panels.");
|
|
124
|
+
if (resizablePanels === true && !connected && panels.length !== 2) console.warn(`AppShell.Root: resizablePanels requires exactly 2 Panel children, got ${panels.length}. Rendering non-resizable panels.`);
|
|
125
|
+
if (panels.length > 2 && !hasExpanded) console.warn(`AppShell.Root: max 2 Panel children allowed, got ${panels.length}. Only the first 2 will be visible.`);
|
|
126
|
+
}
|
|
127
|
+
const handleLayoutChange = React.useCallback((layout) => {
|
|
128
|
+
if (hasExpanded || suppressControlledLayoutChangeRef.current) return;
|
|
129
|
+
if (panelSizes === void 0) setInternalPanelSizes(layoutMapToTuple(layout));
|
|
130
|
+
}, [hasExpanded, panelSizes]);
|
|
131
|
+
const handleLayoutChanged = React.useCallback((layout) => {
|
|
132
|
+
if (hasExpanded || !allowResizeReleaseExpansionRef.current || suppressControlledLayoutChangeRef.current) return;
|
|
133
|
+
const nextSizes = layoutMapToTuple(layout);
|
|
134
|
+
if (panelSizes === void 0) setInternalPanelSizes(nextSizes);
|
|
135
|
+
onPanelSizesChange?.(nextSizes);
|
|
136
|
+
const expandedIndex = getExpandedPanelFromLayout(layout, expandThreshold);
|
|
137
|
+
if (expandedIndex !== null) handleExpandedPanelChange(expandedIndex);
|
|
138
|
+
}, [
|
|
139
|
+
expandThreshold,
|
|
140
|
+
handleExpandedPanelChange,
|
|
141
|
+
hasExpanded,
|
|
142
|
+
onPanelSizesChange,
|
|
143
|
+
panelSizes
|
|
144
|
+
]);
|
|
61
145
|
React.useEffect(() => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
146
|
+
if (!canRenderResizablePanels) {
|
|
147
|
+
suppressControlledLayoutChangeRef.current = false;
|
|
148
|
+
previousResizableExpandedRef.current = false;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const ownerWindow = rootRef.current?.ownerDocument.defaultView;
|
|
152
|
+
if (!ownerWindow) return;
|
|
153
|
+
const wasExpanded = previousResizableExpandedRef.current;
|
|
154
|
+
previousResizableExpandedRef.current = hasExpanded;
|
|
155
|
+
if (!(hasExpanded || wasExpanded || panelSizes !== void 0)) {
|
|
156
|
+
suppressControlledLayoutChangeRef.current = false;
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
let restoreFrame;
|
|
160
|
+
const [first, second] = resizablePanelSizes;
|
|
161
|
+
if (wasExpanded && !hasExpanded) restoreFrame = ownerWindow.requestAnimationFrame(() => {
|
|
162
|
+
setIsRestoringResizablePanels(true);
|
|
163
|
+
});
|
|
164
|
+
suppressControlledLayoutChangeRef.current = true;
|
|
165
|
+
const nextLayout = {
|
|
166
|
+
panel0: first,
|
|
167
|
+
panel1: second
|
|
70
168
|
};
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
169
|
+
resizableGroupRef.current?.setLayout(nextLayout);
|
|
170
|
+
const frame = ownerWindow.requestAnimationFrame(() => {
|
|
171
|
+
resizableGroupRef.current?.setLayout(nextLayout);
|
|
172
|
+
});
|
|
173
|
+
const timeout = ownerWindow.setTimeout(() => {
|
|
174
|
+
suppressControlledLayoutChangeRef.current = false;
|
|
175
|
+
}, 350);
|
|
76
176
|
return () => {
|
|
77
|
-
|
|
78
|
-
|
|
177
|
+
if (restoreFrame !== void 0) ownerWindow.cancelAnimationFrame(restoreFrame);
|
|
178
|
+
ownerWindow.cancelAnimationFrame(frame);
|
|
179
|
+
ownerWindow.clearTimeout(timeout);
|
|
180
|
+
suppressControlledLayoutChangeRef.current = false;
|
|
79
181
|
};
|
|
80
|
-
}, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (!React.isValidElement(child)) {
|
|
101
|
-
toolbarChildren.push(child);
|
|
102
|
-
continue;
|
|
182
|
+
}, [
|
|
183
|
+
canRenderResizablePanels,
|
|
184
|
+
hasExpanded,
|
|
185
|
+
panelSizes,
|
|
186
|
+
resizablePanelSizes
|
|
187
|
+
]);
|
|
188
|
+
React.useEffect(() => {
|
|
189
|
+
if (!isRestoringResizablePanels) return;
|
|
190
|
+
const ownerWindow = rootRef.current?.ownerDocument.defaultView;
|
|
191
|
+
if (!ownerWindow) return;
|
|
192
|
+
const timeout = ownerWindow.setTimeout(() => {
|
|
193
|
+
setIsRestoringResizablePanels(false);
|
|
194
|
+
}, 350);
|
|
195
|
+
return () => ownerWindow.clearTimeout(timeout);
|
|
196
|
+
}, [isRestoringResizablePanels]);
|
|
197
|
+
React.useEffect(() => {
|
|
198
|
+
if (!canRenderResizablePanels) {
|
|
199
|
+
allowResizeReleaseExpansionRef.current = false;
|
|
200
|
+
suppressControlledLayoutChangeRef.current = false;
|
|
201
|
+
return;
|
|
103
202
|
}
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
203
|
+
const ownerWindow = rootRef.current?.ownerDocument.defaultView;
|
|
204
|
+
if (!ownerWindow) return;
|
|
205
|
+
const frame = ownerWindow.requestAnimationFrame(() => {
|
|
206
|
+
allowResizeReleaseExpansionRef.current = true;
|
|
207
|
+
});
|
|
208
|
+
return () => {
|
|
209
|
+
ownerWindow.cancelAnimationFrame(frame);
|
|
210
|
+
allowResizeReleaseExpansionRef.current = false;
|
|
211
|
+
};
|
|
212
|
+
}, [canRenderResizablePanels]);
|
|
213
|
+
React.useEffect(() => {
|
|
214
|
+
if (!isResizingPanels) return;
|
|
215
|
+
const ownerWindow = rootRef.current?.ownerDocument.defaultView;
|
|
216
|
+
if (!ownerWindow) return;
|
|
217
|
+
const stopResizing = () => setIsResizingPanels(false);
|
|
218
|
+
ownerWindow.addEventListener("pointerup", stopResizing);
|
|
219
|
+
ownerWindow.addEventListener("pointercancel", stopResizing);
|
|
220
|
+
return () => {
|
|
221
|
+
ownerWindow.removeEventListener("pointerup", stopResizing);
|
|
222
|
+
ownerWindow.removeEventListener("pointercancel", stopResizing);
|
|
223
|
+
};
|
|
224
|
+
}, [isResizingPanels]);
|
|
225
|
+
const handleResizablePointerDownCapture = React.useCallback((event) => {
|
|
226
|
+
const target = event.target;
|
|
227
|
+
if (!(target instanceof Element)) return;
|
|
228
|
+
if (target.closest("[data-slot=\"resizable-handle\"]")) setIsResizingPanels(true);
|
|
229
|
+
}, []);
|
|
230
|
+
const visiblePanels = React.useMemo(() => hasExpanded ? panels.map((panel, i) => ({
|
|
231
|
+
panel,
|
|
232
|
+
visible: i === firstExpandedIndex,
|
|
233
|
+
index: i
|
|
234
|
+
})) : panels.map((panel, i) => ({
|
|
235
|
+
panel,
|
|
236
|
+
visible: i < 2,
|
|
237
|
+
index: i
|
|
238
|
+
})), [
|
|
239
|
+
panels,
|
|
240
|
+
hasExpanded,
|
|
241
|
+
firstExpandedIndex
|
|
242
|
+
]);
|
|
243
|
+
const hasTabBar = isMobile && panels.length > 1;
|
|
244
|
+
const getPanelPosition = React.useCallback((index) => {
|
|
245
|
+
if (visibleCount === 1) return "only";
|
|
246
|
+
if (hasExpanded) return index === firstExpandedIndex ? "only" : "last";
|
|
247
|
+
return index === 0 ? "first" : "last";
|
|
248
|
+
}, [
|
|
249
|
+
visibleCount,
|
|
250
|
+
hasExpanded,
|
|
251
|
+
firstExpandedIndex
|
|
252
|
+
]);
|
|
253
|
+
const contextValue = React.useMemo(() => ({
|
|
254
|
+
connected,
|
|
255
|
+
panelCount: visibleCount,
|
|
256
|
+
getPanelPosition
|
|
257
|
+
}), [
|
|
258
|
+
connected,
|
|
259
|
+
visibleCount,
|
|
260
|
+
getPanelPosition
|
|
261
|
+
]);
|
|
262
|
+
const sidebarContext = React.useContext(SidebarContext);
|
|
263
|
+
const mobileSidebarOpen = sidebarContext?.openMobile ?? internalMobileSidebarOpen;
|
|
264
|
+
const setMobileSidebarOpen = sidebarContext?.setOpenMobile ?? setInternalMobileSidebarOpen;
|
|
265
|
+
const handleSidebarOpen = React.useCallback(() => {
|
|
266
|
+
setMobileSidebarOpen(true);
|
|
267
|
+
}, [setMobileSidebarOpen]);
|
|
268
|
+
const handleSheetOpenChange = React.useCallback((open) => {
|
|
269
|
+
setMobileSidebarOpen(open);
|
|
270
|
+
}, [setMobileSidebarOpen]);
|
|
271
|
+
const skipLink = skipToId ? /* @__PURE__ */ jsx("a", {
|
|
272
|
+
href: `#${skipToId}`,
|
|
273
|
+
className: "sr-only focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-50 focus:rounded-md focus:bg-background focus:px-4 focus:py-2 focus:text-sm focus:font-medium focus:text-foreground focus:shadow-sm focus:ring-2 focus:ring-ring",
|
|
274
|
+
children: "Skip to content"
|
|
275
|
+
}) : null;
|
|
276
|
+
const renderedPanels = React.useMemo(() => visiblePanels.map(({ panel, visible, index }) => /* @__PURE__ */ jsx(AppShellPanelWithLayout, {
|
|
277
|
+
panel,
|
|
278
|
+
visible,
|
|
279
|
+
index,
|
|
280
|
+
isMobile,
|
|
281
|
+
activePanel,
|
|
282
|
+
hasExpanded,
|
|
283
|
+
hasTabBar,
|
|
284
|
+
ariaBaseId,
|
|
285
|
+
rootExpansionActive,
|
|
286
|
+
firstExpandedIndex,
|
|
287
|
+
onExpandedPanelChange: handleExpandedPanelChange
|
|
288
|
+
}, getAppShellPanelIdentity(panel, ariaBaseId, index))), [
|
|
289
|
+
visiblePanels,
|
|
290
|
+
ariaBaseId,
|
|
291
|
+
isMobile,
|
|
292
|
+
activePanel,
|
|
293
|
+
hasExpanded,
|
|
294
|
+
hasTabBar,
|
|
295
|
+
rootExpansionActive,
|
|
296
|
+
firstExpandedIndex,
|
|
297
|
+
handleExpandedPanelChange
|
|
298
|
+
]);
|
|
299
|
+
const renderedResizablePanels = canRenderResizablePanels ? /* @__PURE__ */ jsxs(ResizablePanelGroup, {
|
|
300
|
+
orientation: "horizontal",
|
|
301
|
+
disabled: hasExpanded,
|
|
302
|
+
groupRef: resizableGroupRef,
|
|
303
|
+
onLayoutChange: handleLayoutChange,
|
|
304
|
+
onLayoutChanged: handleLayoutChanged,
|
|
305
|
+
onPointerDownCapture: handleResizablePointerDownCapture,
|
|
306
|
+
className: cn("min-h-0 min-w-0 flex-1", !isResizingPanels && "[&>[data-slot=resizable-panel]]:transition-[flex-grow] [&>[data-slot=resizable-panel]]:duration-300 [&>[data-slot=resizable-panel]]:ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:[&>[data-slot=resizable-panel]]:transition-none"),
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsx(ResizablePanel, {
|
|
309
|
+
id: "panel0",
|
|
310
|
+
defaultSize: toResizablePercentageSize(resizablePanelSizes[0]),
|
|
311
|
+
minSize: shouldBypassResizableMinSize ? 0 : toResizableMinSize(panels[0].props.minWidth),
|
|
312
|
+
children: /* @__PURE__ */ jsx(AppShellPanelWithLayout, {
|
|
313
|
+
panel: panels[0],
|
|
314
|
+
visible: !hasExpanded || firstExpandedIndex === 0,
|
|
315
|
+
index: 0,
|
|
316
|
+
overrides: { sizeManagedByRoot: true },
|
|
317
|
+
isMobile,
|
|
318
|
+
activePanel,
|
|
319
|
+
hasExpanded,
|
|
320
|
+
hasTabBar,
|
|
321
|
+
ariaBaseId,
|
|
322
|
+
rootExpansionActive,
|
|
323
|
+
firstExpandedIndex,
|
|
324
|
+
onExpandedPanelChange: handleExpandedPanelChange
|
|
149
325
|
})
|
|
326
|
+
}),
|
|
327
|
+
/* @__PURE__ */ jsx(ResizableHandle, {
|
|
328
|
+
disabled: hasExpanded,
|
|
329
|
+
className: cn("z-10 min-w-2 shrink-0 cursor-col-resize w-[var(--app-shell-gap,0px)] bg-transparent after:w-2 hover:bg-transparent", "transition-[width,min-width,opacity,background-color] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none", hasExpanded && "min-w-0 w-0 opacity-0 after:w-0 pointer-events-none")
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ jsx(ResizablePanel, {
|
|
332
|
+
id: "panel1",
|
|
333
|
+
defaultSize: toResizablePercentageSize(resizablePanelSizes[1]),
|
|
334
|
+
minSize: shouldBypassResizableMinSize ? 0 : toResizableMinSize(panels[1].props.minWidth),
|
|
335
|
+
children: /* @__PURE__ */ jsx(AppShellPanelWithLayout, {
|
|
336
|
+
panel: panels[1],
|
|
337
|
+
visible: !hasExpanded || firstExpandedIndex === 1,
|
|
338
|
+
index: 1,
|
|
339
|
+
overrides: { sizeManagedByRoot: true },
|
|
340
|
+
isMobile,
|
|
341
|
+
activePanel,
|
|
342
|
+
hasExpanded,
|
|
343
|
+
hasTabBar,
|
|
344
|
+
ariaBaseId,
|
|
345
|
+
rootExpansionActive,
|
|
346
|
+
firstExpandedIndex,
|
|
347
|
+
onExpandedPanelChange: handleExpandedPanelChange
|
|
348
|
+
})
|
|
349
|
+
})
|
|
350
|
+
]
|
|
351
|
+
}) : null;
|
|
352
|
+
const activeLabel = hasTabBar && panelInfos[activePanel] ? panelInfos[activePanel].label || `Panel ${activePanel + 1}` : null;
|
|
353
|
+
if (isMobile) return /* @__PURE__ */ jsx(AppShellProvider, {
|
|
354
|
+
value: contextValue,
|
|
355
|
+
children: /* @__PURE__ */ jsxs(AppShell$1, {
|
|
356
|
+
ref: rootRef,
|
|
357
|
+
background,
|
|
358
|
+
height,
|
|
359
|
+
padding,
|
|
360
|
+
mobilePadding,
|
|
361
|
+
gap: 0,
|
|
362
|
+
connected,
|
|
363
|
+
className,
|
|
364
|
+
...props,
|
|
365
|
+
children: [
|
|
366
|
+
skipLink,
|
|
367
|
+
sidebarChild && /* @__PURE__ */ jsx(SheetNamespace, {
|
|
368
|
+
open: mobileSidebarOpen,
|
|
369
|
+
onOpenChange: handleSheetOpenChange,
|
|
370
|
+
children: /* @__PURE__ */ jsx(SheetContent, {
|
|
371
|
+
side: "left",
|
|
372
|
+
showCloseButton: false,
|
|
373
|
+
className: "w-[280px] p-0",
|
|
374
|
+
"aria-label": "Sidebar navigation",
|
|
375
|
+
children: sidebarChild
|
|
376
|
+
})
|
|
377
|
+
}),
|
|
378
|
+
/* @__PURE__ */ jsxs("div", {
|
|
379
|
+
className: "flex h-full min-w-0 flex-1 flex-col overflow-clip",
|
|
380
|
+
children: [/* @__PURE__ */ jsx(AppShellMobileTabBar, {
|
|
381
|
+
panels: panelInfos,
|
|
382
|
+
activeIndex: activePanel,
|
|
383
|
+
onActiveChange: handleActivePanelChange,
|
|
384
|
+
onSidebarOpen: sidebarChild ? handleSidebarOpen : void 0,
|
|
385
|
+
baseId: ariaBaseId
|
|
386
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
387
|
+
className: "flex min-h-0 flex-1",
|
|
388
|
+
children: renderedPanels
|
|
389
|
+
})]
|
|
390
|
+
}),
|
|
391
|
+
activeLabel && /* @__PURE__ */ jsxs("div", {
|
|
392
|
+
className: "sr-only",
|
|
393
|
+
role: "status",
|
|
394
|
+
"aria-live": "polite",
|
|
395
|
+
children: [activeLabel, " panel active"]
|
|
396
|
+
}),
|
|
397
|
+
otherChildren
|
|
150
398
|
]
|
|
151
|
-
})
|
|
152
|
-
ref: bodyRef,
|
|
153
|
-
"data-slot": "app-shell-card-body",
|
|
154
|
-
"aria-label": resolvedBodyAriaLabel || "Card content",
|
|
155
|
-
tabIndex: 0,
|
|
156
|
-
className: cn("delight-scroll-shadow flex-1 min-h-0 overflow-auto focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring rounded-b-[inherit]", appShellCardBodyPaddingClasses[bodyPadding], bodyClassName),
|
|
157
|
-
children: bodyChildren
|
|
158
|
-
})]
|
|
399
|
+
})
|
|
159
400
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
401
|
+
return /* @__PURE__ */ jsx(AppShellProvider, {
|
|
402
|
+
value: contextValue,
|
|
403
|
+
children: /* @__PURE__ */ jsxs(AppShell$1, {
|
|
404
|
+
ref: rootRef,
|
|
405
|
+
background,
|
|
406
|
+
height,
|
|
407
|
+
padding,
|
|
408
|
+
mobilePadding,
|
|
409
|
+
gap: connected || hasExpanded ? 0 : gap,
|
|
410
|
+
connected,
|
|
411
|
+
className,
|
|
412
|
+
...props,
|
|
413
|
+
children: [
|
|
414
|
+
skipLink,
|
|
415
|
+
sidebarChild,
|
|
416
|
+
renderedResizablePanels ?? renderedPanels,
|
|
417
|
+
otherChildren
|
|
418
|
+
]
|
|
419
|
+
})
|
|
170
420
|
});
|
|
171
421
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
422
|
+
AppShellRoot.displayName = "AppShell";
|
|
423
|
+
/**
|
|
424
|
+
* Layout slot for the sidebar region. Renders a div — the actual aside
|
|
425
|
+
* landmark is provided by AppSidebar/Sidebar primitive inside it.
|
|
426
|
+
*
|
|
427
|
+
* **Auto-detection (default):** When no `width` prop is provided, the sidebar
|
|
428
|
+
* observes the child SidebarProvider's `data-state` attribute via CSS `:has()`
|
|
429
|
+
* and transitions between `collapsedWidth` and `expandedWidth` automatically.
|
|
430
|
+
*
|
|
431
|
+
* **Manual mode:** Pass an explicit `width` to control sizing yourself.
|
|
432
|
+
*/
|
|
433
|
+
function AppShellSidebar({ width, expandedWidth = "280px", collapsedWidth = "64px", className, style, children, ...props }) {
|
|
434
|
+
const autoMode = !width;
|
|
175
435
|
return /* @__PURE__ */ jsx("div", {
|
|
176
|
-
"data-slot": "app-shell-
|
|
177
|
-
|
|
436
|
+
"data-slot": "app-shell-sidebar",
|
|
437
|
+
style: {
|
|
438
|
+
...autoMode ? {
|
|
439
|
+
"--app-shell-sidebar-collapsed": collapsedWidth,
|
|
440
|
+
"--app-shell-sidebar-expanded": expandedWidth
|
|
441
|
+
} : { "--app-shell-sidebar-width": width },
|
|
442
|
+
...style
|
|
443
|
+
},
|
|
444
|
+
className: cn("flex h-full shrink-0 flex-col overflow-clip", "transition-[width] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)]", "motion-reduce:transition-none", autoMode ? ["w-[var(--app-shell-sidebar-collapsed,64px)]", "[&:has([data-state=expanded])]:w-[var(--app-shell-sidebar-expanded,280px)]"] : "w-[var(--app-shell-sidebar-width,64px)]", className),
|
|
178
445
|
...props,
|
|
179
446
|
children
|
|
180
447
|
});
|
|
181
448
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
function AppShellCardTitle({ className, children, ...props }) {
|
|
185
|
-
return /* @__PURE__ */ jsx("h3", {
|
|
186
|
-
"data-slot": "app-shell-card-title",
|
|
187
|
-
className: cn("text-lg font-semibold leading-7 text-foreground", className),
|
|
188
|
-
...props,
|
|
189
|
-
children
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
AppShellCardTitle.displayName = "AppShellCard.Title";
|
|
193
|
-
assignAppShellCardType(AppShellCardTitle, TITLE_TYPE);
|
|
194
|
-
function AppShellCardSubtitle({ className, children, ...props }) {
|
|
195
|
-
return /* @__PURE__ */ jsx("p", {
|
|
196
|
-
"data-slot": "app-shell-card-subtitle",
|
|
197
|
-
className: cn("text-sm leading-5 text-secondary-foreground", className),
|
|
198
|
-
...props,
|
|
199
|
-
children
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
AppShellCardSubtitle.displayName = "AppShellCard.Subtitle";
|
|
203
|
-
function AppShellCardActions({ className, children, ...props }) {
|
|
449
|
+
AppShellSidebar.displayName = "AppShell.Sidebar";
|
|
450
|
+
function AppShellHeader({ className, children, ...props }) {
|
|
204
451
|
return /* @__PURE__ */ jsx("div", {
|
|
205
|
-
"data-slot": "app-shell-
|
|
206
|
-
className: cn("
|
|
452
|
+
"data-slot": "app-shell-header",
|
|
453
|
+
className: cn("shrink-0", className),
|
|
207
454
|
...props,
|
|
208
455
|
children
|
|
209
456
|
});
|
|
210
457
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
var
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
458
|
+
AppShellHeader.displayName = "AppShell.Header";
|
|
459
|
+
var appShellBackgrounds = {
|
|
460
|
+
transparent: "transparent",
|
|
461
|
+
appBg: DEFAULT_APP_SHELL_BACKGROUND,
|
|
462
|
+
neutral: "var(--muted)",
|
|
463
|
+
brandSubtle: "linear-gradient(135deg, var(--air-50) 0%, var(--air-100) 100%)",
|
|
464
|
+
brand: "linear-gradient(135deg, var(--air-400) 0%, var(--primary) 100%)",
|
|
465
|
+
brandDeep: "linear-gradient(135deg, var(--primary) 0%, var(--air-900) 100%)",
|
|
466
|
+
desertMidnight: "linear-gradient(135deg, var(--slate-500) 0%, var(--slate-700) 100%)",
|
|
467
|
+
aqua: "linear-gradient(135deg, var(--air-400) 0%, var(--air-600) 100%)"
|
|
468
|
+
};
|
|
469
|
+
var AppShell = Object.assign(AppShellRoot, {
|
|
470
|
+
Root: AppShellRoot,
|
|
471
|
+
Sidebar: AppShellSidebar,
|
|
472
|
+
Header: AppShellHeader,
|
|
473
|
+
Panel: AppShellPanel,
|
|
474
|
+
Content: AppShellContent
|
|
225
475
|
});
|
|
226
476
|
//#endregion
|
|
227
|
-
export {
|
|
477
|
+
export { AppShell, AppShellContent, AppShellHeader, AppShellPanel, AppShellRoot, AppShellSidebar, appShellBackgrounds };
|
|
228
478
|
|
|
229
479
|
//# sourceMappingURL=index223.js.map
|