@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/index220.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index220.js","names":[],"sources":["../src/components/templates/AppShell/
|
|
1
|
+
{"version":3,"file":"index220.js","names":[],"sources":["../src/components/templates/AppShell/AppShellMobileTabBar.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from 'lucide-react';\nimport * as React from 'react';\nimport { cn } from '@/lib/utils';\n\nexport interface MobileTabBarPanel {\n key?: React.Key;\n label?: string;\n}\n\nexport interface AppShellMobileTabBarProps {\n panels: MobileTabBarPanel[];\n activeIndex: number;\n onActiveChange: (index: number) => void;\n onSidebarOpen?: () => void;\n /** Base ID for generating ARIA tab/panel IDs */\n baseId?: string;\n}\n\nfunction getMobileTabKey(\n panel: MobileTabBarPanel,\n fallbackLabel: string,\n): React.Key {\n return panel.key ?? panel.label ?? fallbackLabel;\n}\n\n/**\n * Internal mobile tab bar for switching between panels on small viewports.\n * Implements the ARIA Tabs pattern with roving tabIndex and arrow key navigation.\n * Renders only when there are 2+ panels.\n */\nfunction AppShellMobileTabBar({\n panels,\n activeIndex,\n onActiveChange,\n onSidebarOpen,\n baseId,\n}: AppShellMobileTabBarProps) {\n const tabListRef = React.useRef<HTMLDivElement>(null);\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n let nextIndex: number | null = null;\n\n switch (e.key) {\n case 'ArrowRight':\n nextIndex = (activeIndex + 1) % panels.length;\n break;\n case 'ArrowLeft':\n nextIndex = (activeIndex - 1 + panels.length) % panels.length;\n break;\n case 'Home':\n nextIndex = 0;\n break;\n case 'End':\n nextIndex = panels.length - 1;\n break;\n default:\n return;\n }\n\n e.preventDefault();\n onActiveChange(nextIndex);\n\n // Move focus to the newly active tab\n const tabList = tabListRef.current;\n if (tabList) {\n const buttons =\n tabList.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]');\n buttons[nextIndex]?.focus();\n }\n },\n [activeIndex, panels.length, onActiveChange],\n );\n\n // Sliding pill indicator — measure active tab position\n const [indicator, setIndicator] = React.useState<{\n left: number;\n width: number;\n } | null>(null);\n\n React.useEffect(() => {\n const tabList = tabListRef.current;\n if (!tabList || panels.length <= 1) return;\n const buttons = tabList.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]');\n const activeBtn = buttons[activeIndex];\n if (!activeBtn) return;\n const left = activeBtn.offsetLeft;\n const width = activeBtn.offsetWidth;\n setIndicator((prev) =>\n prev && prev.left === left && prev.width === width\n ? prev\n : { left, width },\n );\n }, [activeIndex, panels.length]);\n\n const sidebarTrigger = onSidebarOpen ? (\n <button\n type=\"button\"\n onClick={onSidebarOpen}\n className={cn(\n 'flex min-h-11 min-w-11 items-center justify-center rounded-lg',\n 'text-secondary-foreground hover:bg-accent',\n 'active:scale-[0.95]',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n 'transition-colors motion-reduce:transition-none',\n )}\n aria-label=\"Open sidebar\"\n >\n <Menu className=\"size-5\" />\n </button>\n ) : null;\n\n if (panels.length <= 1) {\n return sidebarTrigger ? (\n <div\n data-slot=\"app-shell-mobile-tab-bar\"\n className=\"flex h-12 shrink-0 items-center px-3\"\n >\n {sidebarTrigger}\n </div>\n ) : null;\n }\n\n return (\n <div\n data-slot=\"app-shell-mobile-tab-bar\"\n className=\"flex h-12 shrink-0 items-center gap-1 px-3\"\n >\n {sidebarTrigger}\n <div\n ref={tabListRef}\n role=\"tablist\"\n className=\"relative flex gap-1\"\n onKeyDown={handleKeyDown}\n >\n {/* Sliding pill indicator */}\n {indicator && (\n <div\n className={cn(\n 'absolute top-1/2 -translate-y-1/2 h-9 rounded-lg bg-accent',\n 'transition-[left,width] duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]',\n 'motion-reduce:transition-none',\n )}\n style={{ left: indicator.left, width: indicator.width }}\n aria-hidden=\"true\"\n />\n )}\n {panels.map((panel, panelPosition) => {\n const label = panel.label || `Panel ${panelPosition + 1}`;\n const isActive = panelPosition === activeIndex;\n const tabId = baseId ? `${baseId}-tab-${panelPosition}` : undefined;\n const panelId = baseId\n ? `${baseId}-tabpanel-${panelPosition}`\n : undefined;\n return (\n <button\n key={getMobileTabKey(panel, label)}\n id={tabId}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n aria-controls={panelId}\n tabIndex={isActive ? 0 : -1}\n onClick={() => onActiveChange(panelPosition)}\n className={cn(\n 'relative z-10 rounded-lg px-3 min-h-9 text-sm font-medium',\n 'transition-colors duration-150 motion-reduce:transition-none',\n 'active:scale-[0.97]',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n isActive\n ? 'text-foreground'\n : 'text-secondary-foreground hover:text-foreground',\n )}\n >\n {label}\n </button>\n );\n })}\n </div>\n </div>\n );\n}\n\nAppShellMobileTabBar.displayName = 'AppShellMobileTabBar';\n\nexport { AppShellMobileTabBar };\n"],"mappings":";;;;;;AAoBA,SAAS,gBACP,OACA,eACW;CACX,OAAO,MAAM,OAAO,MAAM,SAAS;AACrC;;;;;;AAOA,SAAS,qBAAqB,EAC5B,QACA,aACA,gBACA,eACA,UAC4B;CAC5B,MAAM,aAAa,MAAM,OAAuB,IAAI;CAEpD,MAAM,gBAAgB,MAAM,aACzB,MAA2B;EAC1B,IAAI,YAA2B;EAE/B,QAAQ,EAAE,KAAV;GACE,KAAK;IACH,aAAa,cAAc,KAAK,OAAO;IACvC;GACF,KAAK;IACH,aAAa,cAAc,IAAI,OAAO,UAAU,OAAO;IACvD;GACF,KAAK;IACH,YAAY;IACZ;GACF,KAAK;IACH,YAAY,OAAO,SAAS;IAC5B;GACF,SACE;EACJ;EAEA,EAAE,eAAe;EACjB,eAAe,SAAS;EAGxB,MAAM,UAAU,WAAW;EAC3B,IAAI,SAGF,QADU,iBAAoC,gBAC9C,CAAA,CAAQ,UAAU,EAAE,MAAM;CAE9B,GACA;EAAC;EAAa,OAAO;EAAQ;CAAc,CA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AI;KACzB,eAAe,eAAe,aAAa;KAC3C,WAAW,GACT,6DACA,gEACA,uBACA,2EACA,WACI,oBACA,iDACN;eAEC;IACK,GAnBD,gBAAgB,OAAO,KAAK,CAmB3B;GAEZ,CAAC,CACE;IACF;;AAET;AAEA,qBAAqB,cAAc"}
|
package/dist/index221.js
CHANGED
|
@@ -1,33 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "./index2.js";
|
|
3
|
+
import { PanelExpansionContext, PanelLayoutContext } from "./index218.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/templates/AppShell/AppShellPanel.tsx
|
|
7
|
+
var APPSHELL_PANEL_TYPE = "AppShell.Panel";
|
|
8
|
+
/**
|
|
9
|
+
* Generic content slot for AppShell. Max 2 panels visible at a time.
|
|
10
|
+
*
|
|
11
|
+
* Sizing priority: expanded > width/flex > default (flex: 1)
|
|
12
|
+
*
|
|
13
|
+
* Reads PanelLayoutContext to self-manage visibility and mobile sizing,
|
|
14
|
+
* eliminating the need for cloneElement style injection from Root.
|
|
15
|
+
*/
|
|
16
|
+
function AppShellPanelRoot({ width, flex, minWidth, expanded = false, onExpandedChange, label, className, style, children, ...props }) {
|
|
17
|
+
const layout = React.useContext(PanelLayoutContext);
|
|
18
|
+
const resolvedExpanded = layout.expanded ?? expanded;
|
|
19
|
+
const resolvedOnExpandedChange = layout.onExpandedChange ?? onExpandedChange;
|
|
20
|
+
const expansionValue = React.useMemo(() => ({
|
|
21
|
+
expanded: resolvedExpanded,
|
|
22
|
+
onExpandedChange: resolvedOnExpandedChange
|
|
23
|
+
}), [resolvedExpanded, resolvedOnExpandedChange]);
|
|
24
|
+
const computedStyle = React.useMemo(() => {
|
|
25
|
+
if (!layout.visible && !layout.isMobile) {
|
|
26
|
+
if (layout.collapseMode === "animated") return {
|
|
27
|
+
...style,
|
|
28
|
+
opacity: 0,
|
|
29
|
+
width: "0px",
|
|
30
|
+
maxWidth: "0px",
|
|
31
|
+
minWidth: "0px",
|
|
32
|
+
flex: "0 1 0px",
|
|
33
|
+
overflow: "hidden",
|
|
34
|
+
pointerEvents: "none"
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
...style,
|
|
38
|
+
display: "none",
|
|
39
|
+
opacity: 0,
|
|
40
|
+
width: "0px",
|
|
41
|
+
flex: "0",
|
|
42
|
+
overflow: "hidden",
|
|
43
|
+
pointerEvents: "none"
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (layout.isMobile) return {
|
|
47
|
+
...style,
|
|
48
|
+
flex: "1"
|
|
49
|
+
};
|
|
50
|
+
if (layout.sizeManagedByRoot) return { ...style };
|
|
51
|
+
const sizeStyles = {};
|
|
52
|
+
if (resolvedExpanded) sizeStyles.flex = "1";
|
|
53
|
+
else if (width !== void 0) {
|
|
54
|
+
sizeStyles.width = typeof width === "number" ? `${width}px` : width;
|
|
55
|
+
sizeStyles.maxWidth = "100%";
|
|
56
|
+
} else if (flex !== void 0) sizeStyles.flex = String(flex);
|
|
57
|
+
else sizeStyles.flex = "1";
|
|
58
|
+
if (minWidth !== void 0) sizeStyles.minWidth = typeof minWidth === "number" ? `${minWidth}px` : minWidth;
|
|
59
|
+
return {
|
|
60
|
+
...sizeStyles,
|
|
61
|
+
...style
|
|
62
|
+
};
|
|
63
|
+
}, [
|
|
64
|
+
layout.visible,
|
|
65
|
+
layout.isMobile,
|
|
66
|
+
layout.collapseMode,
|
|
67
|
+
layout.sizeManagedByRoot,
|
|
68
|
+
resolvedExpanded,
|
|
69
|
+
width,
|
|
70
|
+
flex,
|
|
71
|
+
minWidth,
|
|
72
|
+
style
|
|
73
|
+
]);
|
|
74
|
+
const isHidden = !layout.visible && !layout.isMobile;
|
|
75
|
+
return /* @__PURE__ */ jsx(PanelExpansionContext.Provider, {
|
|
76
|
+
value: expansionValue,
|
|
77
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
78
|
+
"data-slot": "app-shell-panel",
|
|
79
|
+
"data-expanded": resolvedExpanded || void 0,
|
|
80
|
+
"aria-hidden": isHidden || void 0,
|
|
81
|
+
inert: isHidden || void 0,
|
|
82
|
+
...layout.panelId ? {
|
|
83
|
+
role: "tabpanel",
|
|
84
|
+
id: layout.panelId,
|
|
85
|
+
"aria-labelledby": layout.tabId
|
|
86
|
+
} : {},
|
|
87
|
+
className: cn("flex h-full min-w-0 flex-col", isHidden && "overflow-clip", width !== void 0 && !resolvedExpanded && !isHidden && !layout.isMobile && !layout.sizeManagedByRoot && "shrink-0", layout.isMobile && "animate-[delight-fade-in_150ms_ease-out_both]", layout.isMobile && "motion-reduce:animate-none", "transition-[flex,width,opacity] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)]", "motion-reduce:transition-none", className),
|
|
88
|
+
style: computedStyle,
|
|
89
|
+
...props,
|
|
90
|
+
children
|
|
91
|
+
})
|
|
92
|
+
});
|
|
29
93
|
}
|
|
94
|
+
var AppShellPanel = Object.assign(AppShellPanelRoot, {
|
|
95
|
+
displayName: "AppShell.Panel",
|
|
96
|
+
__appShellType: APPSHELL_PANEL_TYPE
|
|
97
|
+
});
|
|
30
98
|
//#endregion
|
|
31
|
-
export {
|
|
99
|
+
export { APPSHELL_PANEL_TYPE, AppShellPanel };
|
|
32
100
|
|
|
33
101
|
//# sourceMappingURL=index221.js.map
|
package/dist/index221.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index221.js","names":[],"sources":["../src/components/templates/AppShell/
|
|
1
|
+
{"version":3,"file":"index221.js","names":[],"sources":["../src/components/templates/AppShell/AppShellPanel.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/utils';\nimport { PanelExpansionContext, PanelLayoutContext } from './AppShellContext';\n\nexport const APPSHELL_PANEL_TYPE = 'AppShell.Panel' as const;\n\nexport interface AppShellPanelProps extends React.ComponentProps<'div'> {\n /** Fixed width in pixels (number) or CSS string */\n width?: number | string;\n /** Flex grow value */\n flex?: number | string;\n /** Minimum width in pixels (number) or CSS string */\n minWidth?: number | string;\n /** When true, panel takes all content space (flex: 1), sibling panels hidden */\n expanded?: boolean;\n /** Callback when expanded state should change */\n onExpandedChange?: (expanded: boolean) => void;\n /** Label shown in mobile tab bar */\n label?: string;\n}\n\nexport interface AppShellPanelComponent {\n (props: AppShellPanelProps): React.ReactElement;\n displayName?: string;\n __appShellType: typeof APPSHELL_PANEL_TYPE;\n}\n\n/**\n * Generic content slot for AppShell. Max 2 panels visible at a time.\n *\n * Sizing priority: expanded > width/flex > default (flex: 1)\n *\n * Reads PanelLayoutContext to self-manage visibility and mobile sizing,\n * eliminating the need for cloneElement style injection from Root.\n */\nfunction AppShellPanelRoot({\n width,\n flex,\n minWidth,\n expanded = false,\n onExpandedChange,\n label,\n className,\n style,\n children,\n ...props\n}: AppShellPanelProps): React.ReactElement {\n const layout = React.useContext(PanelLayoutContext);\n const resolvedExpanded = layout.expanded ?? expanded;\n const resolvedOnExpandedChange = layout.onExpandedChange ?? onExpandedChange;\n\n const expansionValue = React.useMemo(\n () => ({\n expanded: resolvedExpanded,\n onExpandedChange: resolvedOnExpandedChange,\n }),\n [resolvedExpanded, resolvedOnExpandedChange],\n );\n\n // Compute inline styles based on layout context + sizing rules\n const computedStyle = React.useMemo((): React.CSSProperties => {\n // Hidden panel (desktop: non-visible overflow or non-expanded sibling)\n if (!layout.visible && !layout.isMobile) {\n if (layout.collapseMode === 'animated') {\n return {\n ...style,\n opacity: 0,\n width: '0px',\n maxWidth: '0px',\n minWidth: '0px',\n flex: '0 1 0px',\n overflow: 'hidden',\n pointerEvents: 'none',\n };\n }\n\n return {\n ...style,\n display: 'none',\n opacity: 0,\n width: '0px',\n flex: '0',\n overflow: 'hidden',\n pointerEvents: 'none',\n };\n }\n\n // Mobile active panel: fill available space\n if (layout.isMobile) {\n return { ...style, flex: '1' };\n }\n\n if (layout.sizeManagedByRoot) {\n return { ...style };\n }\n\n // Desktop visible panel: apply sizing rules\n const sizeStyles: React.CSSProperties = {};\n if (resolvedExpanded) {\n sizeStyles.flex = '1';\n } else if (width !== undefined) {\n sizeStyles.width = typeof width === 'number' ? `${width}px` : width;\n sizeStyles.maxWidth = '100%';\n } else if (flex !== undefined) {\n sizeStyles.flex = String(flex);\n } else {\n sizeStyles.flex = '1';\n }\n\n if (minWidth !== undefined) {\n sizeStyles.minWidth =\n typeof minWidth === 'number' ? `${minWidth}px` : minWidth;\n }\n\n return { ...sizeStyles, ...style };\n }, [\n layout.visible,\n layout.isMobile,\n layout.collapseMode,\n layout.sizeManagedByRoot,\n resolvedExpanded,\n width,\n flex,\n minWidth,\n style,\n ]);\n\n const isHidden = !layout.visible && !layout.isMobile;\n\n return (\n <PanelExpansionContext.Provider value={expansionValue}>\n <div\n data-slot=\"app-shell-panel\"\n data-expanded={resolvedExpanded || undefined}\n aria-hidden={isHidden || undefined}\n inert={isHidden || undefined}\n {...(layout.panelId\n ? {\n role: 'tabpanel' as const,\n id: layout.panelId,\n 'aria-labelledby': layout.tabId,\n }\n : {})}\n className={cn(\n 'flex h-full min-w-0 flex-col',\n isHidden && 'overflow-clip',\n width !== undefined &&\n !resolvedExpanded &&\n !isHidden &&\n !layout.isMobile &&\n !layout.sizeManagedByRoot &&\n 'shrink-0',\n // Mobile panel entrance — subtle fade on tab switch\n layout.isMobile && 'animate-[delight-fade-in_150ms_ease-out_both]',\n layout.isMobile && 'motion-reduce:animate-none',\n // Transitions for show/hide (desktop)\n 'transition-[flex,width,opacity] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)]',\n 'motion-reduce:transition-none',\n className,\n )}\n style={computedStyle}\n {...props}\n >\n {children}\n </div>\n </PanelExpansionContext.Provider>\n );\n}\n\nconst AppShellPanel = Object.assign(AppShellPanelRoot, {\n displayName: 'AppShell.Panel',\n __appShellType: APPSHELL_PANEL_TYPE,\n}) satisfies AppShellPanelComponent;\n\nexport { AppShellPanel };\n"],"mappings":";;;;;;AAMA,IAAa,sBAAsB;;;;;;;;;AA+BnC,SAAS,kBAAkB,EACzB,OACA,MACA,UACA,WAAW,OACX,kBACA,OACA,WACA,OACA,UACA,GAAG,SACsC;CACzC,MAAM,SAAS,MAAM,WAAW,kBAAkB;CAClD,MAAM,mBAAmB,OAAO,YAAY;CAC5C,MAAM,2BAA2B,OAAO,oBAAoB;CAE5D,MAAM,iBAAiB,MAAM,eACpB;EACL,UAAU;EACV,kBAAkB;CACpB,IACA,CAAC,kBAAkB,wBAAwB,CAC7C;CAGA,MAAM,gBAAgB,MAAM,cAAmC;EAE7D,IAAI,CAAC,OAAO,WAAW,CAAC,OAAO,UAAU;GACvC,IAAI,OAAO,iBAAiB,YAC1B,OAAO;IACL,GAAG;IACH,SAAS;IACT,OAAO;IACP,UAAU;IACV,UAAU;IACV,MAAM;IACN,UAAU;IACV,eAAe;GACjB;GAGF,OAAO;IACL,GAAG;IACH,SAAS;IACT,SAAS;IACT,OAAO;IACP,MAAM;IACN,UAAU;IACV,eAAe;GACjB;EACF;EAGA,IAAI,OAAO,UACT,OAAO;GAAE,GAAG;GAAO,MAAM;EAAI;EAG/B,IAAI,OAAO,mBACT,OAAO,EAAE,GAAG,MAAM;EAIpB,MAAM,aAAkC,CAAC;EACzC,IAAI,kBACF,WAAW,OAAO;OACb,IAAI,UAAU,KAAA,GAAW;GAC9B,WAAW,QAAQ,OAAO,UAAU,WAAW,GAAG,MAAM,MAAM;GAC9D,WAAW,W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