tc-dazzle-ui 1.8.0 → 1.10.0
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/GlobalHeader/GlobalHeader.d.ts +3 -0
- package/dist/components/Organisms/PageHeader/PageHeader.d.ts +24 -0
- package/dist/components/Organisms/PageHeader/index.d.ts +2 -0
- package/dist/components/Organisms/Sidebar/Sidebar.d.ts +7 -0
- package/dist/components/Organisms/index.d.ts +2 -0
- package/dist/components/PropsPanel/PropsPanel.d.ts +22 -0
- package/dist/components/PropsPanel/index.d.ts +2 -0
- package/dist/components/Templates/Layout/Layout.d.ts +18 -0
- package/dist/components/Templates/Layout/index.d.ts +2 -0
- package/dist/components/Templates/index.d.ts +2 -0
- package/dist/index.esm.js +155 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +154 -8
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +176 -8
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/browser.d.ts +2 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/styles.css +1 -1
- package/dist/web-components.css +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,9 @@ export interface GlobalHeaderProps {
|
|
|
10
10
|
onTabClick?: (tab: GlobalHeaderTab) => void;
|
|
11
11
|
onMenuClick?: () => void;
|
|
12
12
|
showMenuButton?: boolean;
|
|
13
|
+
showPropertiesButton?: boolean;
|
|
14
|
+
isPropertiesOpen?: boolean;
|
|
15
|
+
onPropertiesClick?: () => void;
|
|
13
16
|
className?: string;
|
|
14
17
|
}
|
|
15
18
|
export declare const GlobalHeader: React.FC<GlobalHeaderProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './PageHeader.css';
|
|
3
|
+
export interface PageHeaderAction {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
variant?: 'primary' | 'secondary' | 'text';
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface PageHeaderBadge {
|
|
11
|
+
label: string;
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface PageHeaderProps {
|
|
16
|
+
title: string;
|
|
17
|
+
backLabel?: string;
|
|
18
|
+
onBackClick?: () => void;
|
|
19
|
+
badge?: PageHeaderBadge;
|
|
20
|
+
actions?: PageHeaderAction[];
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const PageHeader: React.FC<PageHeaderProps>;
|
|
24
|
+
export default PageHeader;
|
|
@@ -17,6 +17,13 @@ export interface SidebarProps {
|
|
|
17
17
|
onSettingsClick?: () => void;
|
|
18
18
|
onExpandAllClick?: () => void;
|
|
19
19
|
onCollapseAllClick?: () => void;
|
|
20
|
+
onCollapse?: () => void;
|
|
21
|
+
onExpand?: () => void;
|
|
22
|
+
onWidthChange?: (width: number) => void;
|
|
23
|
+
defaultWidth?: number;
|
|
24
|
+
minWidth?: number;
|
|
25
|
+
maxWidth?: number;
|
|
26
|
+
collapsible?: boolean;
|
|
20
27
|
className?: string;
|
|
21
28
|
}
|
|
22
29
|
export declare const Sidebar: React.FC<SidebarProps>;
|
|
@@ -4,3 +4,5 @@ export { GlobalHeader } from './GlobalHeader';
|
|
|
4
4
|
export type { GlobalHeaderProps, GlobalHeaderTab } from './GlobalHeader';
|
|
5
5
|
export { Sidebar } from './Sidebar';
|
|
6
6
|
export type { SidebarProps, SidebarSection, SidebarItem } from './Sidebar';
|
|
7
|
+
export { PageHeader } from './PageHeader';
|
|
8
|
+
export type { PageHeaderProps, PageHeaderAction, PageHeaderBadge } from './PageHeader';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './PropsPanel.css';
|
|
3
|
+
export interface PropDefinition {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
default?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
10
|
+
export interface VariantDefinition {
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PropsPanelProps {
|
|
16
|
+
componentName: string;
|
|
17
|
+
props: PropDefinition[];
|
|
18
|
+
variants?: VariantDefinition[];
|
|
19
|
+
codeExample: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const PropsPanel: React.FC<PropsPanelProps>;
|
|
22
|
+
export default PropsPanel;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Layout.css';
|
|
3
|
+
export interface LayoutProps {
|
|
4
|
+
header?: React.ReactNode;
|
|
5
|
+
sidebar?: React.ReactNode;
|
|
6
|
+
main: React.ReactNode;
|
|
7
|
+
footer?: React.ReactNode;
|
|
8
|
+
actions?: React.ReactNode;
|
|
9
|
+
rightPanel?: React.ReactNode;
|
|
10
|
+
showSidebar?: boolean;
|
|
11
|
+
sidebarPosition?: 'left' | 'right';
|
|
12
|
+
sidebarWidth?: number | string;
|
|
13
|
+
rightPanelWidth?: number | string;
|
|
14
|
+
maxContentWidth?: number | string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const Layout: React.FC<LayoutProps>;
|
|
18
|
+
export default Layout;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import o, { forwardRef, useState, useRef, useEffect } from 'react';
|
|
2
|
+
import o, { forwardRef, useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
|
|
5
5
|
// Caret Down Icon SVG
|
|
@@ -348,14 +348,14 @@ const DropdownMenu = ({ items, selectedId, onItemClick, showIcons = true, classN
|
|
|
348
348
|
};
|
|
349
349
|
|
|
350
350
|
// Default Icons based on Figma design
|
|
351
|
-
const BookmarkIcon = () => (jsx("svg", { viewBox: "0 0 18 18", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M14 2H4C2.9 2 2 2.9 2 4V16L9 13L16 16V4C16 2.9 15.1 2 14 2Z" }) }));
|
|
351
|
+
const BookmarkIcon$1 = () => (jsx("svg", { viewBox: "0 0 18 18", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M14 2H4C2.9 2 2 2.9 2 4V16L9 13L16 16V4C16 2.9 15.1 2 14 2Z" }) }));
|
|
352
352
|
const RecentIcon = () => (jsx("svg", { viewBox: "0 0 18 18", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M9 1C4.58 1 1 4.58 1 9C1 13.42 4.58 17 9 17C13.42 17 17 13.42 17 9C17 4.58 13.42 1 9 1ZM9 15C5.69 15 3 12.31 3 9C3 5.69 5.69 3 9 3C12.31 3 15 5.69 15 9C15 12.31 12.31 15 9 15ZM9.5 5H8V10L12.25 12.52L13 11.24L9.5 9.15V5Z" }) }));
|
|
353
353
|
const AllIcon = () => (jsx("svg", { viewBox: "0 0 21 18", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M0 10H4V6H0V10ZM0 16H4V12H0V16ZM0 4H4V0H0V4ZM6 10H21V6H6V10ZM6 16H21V12H6V16ZM6 0V4H21V0H6Z" }) }));
|
|
354
354
|
const ToolsIcon = () => (jsx("svg", { viewBox: "0 0 18 18", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M16.89 5.21L14.12 7.98L10.02 3.88L12.79 1.11C11.15 0.37 9.14 0.69 7.79 2.04C6.32 3.51 6.07 5.75 7.04 7.49L1.04 13.49C0.26 14.27 0.26 15.53 1.04 16.31C1.82 17.09 3.08 17.09 3.86 16.31L9.86 10.31C11.6 11.28 13.84 11.03 15.31 9.56C16.66 8.21 16.98 6.2 16.24 4.56L16.89 5.21Z" }) }));
|
|
355
355
|
const HelpIcon = () => (jsx("svg", { viewBox: "0 0 18 18", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M9 1C4.58 1 1 4.58 1 9C1 13.42 4.58 17 9 17C13.42 17 17 13.42 17 9C17 4.58 13.42 1 9 1ZM10 14H8V12H10V14ZM11.07 8.25L10.17 9.17C9.45 9.9 9 10.5 9 12H7V11.5C7 10.4 7.45 9.4 8.17 8.67L9.41 7.41C9.78 7.05 10 6.55 10 6C10 4.9 9.1 4 8 4C6.9 4 6 4.9 6 6H4C4 3.79 5.79 2 8 2C10.21 2 12 3.79 12 6C12 6.88 11.64 7.68 11.07 8.25Z" }) }));
|
|
356
356
|
const ClientIcon = () => (jsx("svg", { viewBox: "0 0 18 18", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M9 9C11.21 9 13 7.21 13 5C13 2.79 11.21 1 9 1C6.79 1 5 2.79 5 5C5 7.21 6.79 9 9 9ZM9 11C6.33 11 1 12.34 1 15V17H17V15C17 12.34 11.67 11 9 11Z" }) }));
|
|
357
357
|
const defaultIcons = {
|
|
358
|
-
bookmarks: jsx(BookmarkIcon, {}),
|
|
358
|
+
bookmarks: jsx(BookmarkIcon$1, {}),
|
|
359
359
|
recent: jsx(RecentIcon, {}),
|
|
360
360
|
all: jsx(AllIcon, {}),
|
|
361
361
|
tools: jsx(ToolsIcon, {}),
|
|
@@ -388,7 +388,7 @@ const HeaderMenu = ({ items, onItemClick, onDropdownItemClick, className = '', }
|
|
|
388
388
|
return (jsx("div", { ref: menuRef, className: `tc-header-menu ${className}`.trim(), children: items.map((item) => {
|
|
389
389
|
const isOpen = openMenuId === item.id;
|
|
390
390
|
const hasDropdown = item.dropdownItems && item.dropdownItems.length > 0;
|
|
391
|
-
return (jsxs("div", { className: "tc-header-menu__item-wrapper", children: [jsxs("button", { className: `tc-header-menu__item ${isOpen ? 'tc-header-menu__item--active' : ''}`, onClick: () => handleItemClick(item), type: "button", title: item.label, "aria-label": item.label, "aria-expanded": hasDropdown ? isOpen : undefined, "aria-haspopup": hasDropdown ? 'menu' : undefined, children: [jsx("span", { className: "tc-header-menu__icon", children: item.icon || defaultIcons[item.id.toLowerCase()] || jsx(BookmarkIcon, {}) }), jsx("span", { className: "tc-header-menu__label", children: item.label })] }), hasDropdown && isOpen && (jsx("div", { className: "tc-header-menu__dropdown", children: jsx(DropdownMenu, { items: item.dropdownItems, onItemClick: (dropdownItem) => handleDropdownItemClick(item, dropdownItem), showIcons: false }) }))] }, item.id));
|
|
391
|
+
return (jsxs("div", { className: "tc-header-menu__item-wrapper", children: [jsxs("button", { className: `tc-header-menu__item ${isOpen ? 'tc-header-menu__item--active' : ''}`, onClick: () => handleItemClick(item), type: "button", title: item.label, "aria-label": item.label, "aria-expanded": hasDropdown ? isOpen : undefined, "aria-haspopup": hasDropdown ? 'menu' : undefined, children: [jsx("span", { className: "tc-header-menu__icon", children: item.icon || defaultIcons[item.id.toLowerCase()] || jsx(BookmarkIcon$1, {}) }), jsx("span", { className: "tc-header-menu__label", children: item.label })] }), hasDropdown && isOpen && (jsx("div", { className: "tc-header-menu__dropdown", children: jsx(DropdownMenu, { items: item.dropdownItems, onItemClick: (dropdownItem) => handleDropdownItemClick(item, dropdownItem), showIcons: false }) }))] }, item.id));
|
|
392
392
|
}) }));
|
|
393
393
|
};
|
|
394
394
|
|
|
@@ -442,17 +442,20 @@ const MainHeader = ({ searchFilterOptions = defaultFilterOptions, searchPlacehol
|
|
|
442
442
|
return (jsxs("header", { className: `tc-main-header ${className}`.trim(), children: [jsx("div", { className: "tc-main-header__logo", children: jsx(Logo, { size: "medium", onClick: onLogoClick }) }), jsx("div", { className: "tc-main-header__search", children: jsx(Search, { placeholder: searchPlaceholder, filterPlaceholder: searchFilterPlaceholder, filterOptions: searchFilterOptions, onSubmit: onSearch, onInfoClick: onInfoClick }) }), jsx("div", { className: "tc-main-header__menu", children: jsx(HeaderMenu, { items: menuItems, onItemClick: onMenuItemClick, onDropdownItemClick: onDropdownItemClick }) })] }));
|
|
443
443
|
};
|
|
444
444
|
|
|
445
|
-
const GlobalHeader = ({ tabs, activeTabId, onTabClick, onMenuClick, showMenuButton = true, className = '', }) => {
|
|
445
|
+
const GlobalHeader = ({ tabs, activeTabId, onTabClick, onMenuClick, showMenuButton = true, showPropertiesButton = true, isPropertiesOpen = false, onPropertiesClick, className = '', }) => {
|
|
446
446
|
const getHeaderClasses = () => {
|
|
447
447
|
const classes = ['tc-global-header'];
|
|
448
448
|
if (className)
|
|
449
449
|
classes.push(className);
|
|
450
450
|
return classes.join(' ');
|
|
451
451
|
};
|
|
452
|
-
return (jsxs("header", { className: getHeaderClasses(), role: "navigation", children: [showMenuButton && (jsx(IconButton, { icon: jsx(MenuIcon, { size: "medium", color: "#ffffff" }), onClick: onMenuClick, ariaLabel: "Open menu", className: "tc-global-header__menu-button" })), jsx("nav", { className: "tc-global-header__tabs", role: "tablist", children: tabs.map((tab) => (jsx(Tab, { label: tab.label, isActive: activeTabId === tab.id, onClick: () => onTabClick === null || onTabClick === void 0 ? void 0 : onTabClick(tab) }, tab.id))) })] }));
|
|
452
|
+
return (jsxs("header", { className: getHeaderClasses(), role: "navigation", children: [showMenuButton && (jsx(IconButton, { icon: jsx(MenuIcon, { size: "medium", color: "#ffffff" }), onClick: onMenuClick, ariaLabel: "Open menu", className: "tc-global-header__menu-button" })), jsx("nav", { className: "tc-global-header__tabs", role: "tablist", children: tabs.map((tab) => (jsx(Tab, { label: tab.label, isActive: activeTabId === tab.id, onClick: () => onTabClick === null || onTabClick === void 0 ? void 0 : onTabClick(tab) }, tab.id))) }), showPropertiesButton && (jsx("button", { className: `tc-global-header__properties-btn ${isPropertiesOpen ? 'tc-global-header__properties-btn--active' : ''}`, onClick: onPropertiesClick, "aria-label": "Toggle Properties Panel", children: "Properties" }))] }));
|
|
453
453
|
};
|
|
454
454
|
|
|
455
|
-
const
|
|
455
|
+
const MIN_WIDTH = 242;
|
|
456
|
+
const MAX_WIDTH = 1100;
|
|
457
|
+
const DEFAULT_WIDTH = 280;
|
|
458
|
+
const Sidebar = ({ sections, activeItemId, onItemClick, onSettingsClick, onExpandAllClick, onCollapseAllClick, onCollapse, onExpand, onWidthChange, defaultWidth = DEFAULT_WIDTH, minWidth = MIN_WIDTH, maxWidth = MAX_WIDTH, collapsible = true, className = '', }) => {
|
|
456
459
|
const [expandedSections, setExpandedSections] = useState(() => {
|
|
457
460
|
const initialExpanded = new Set();
|
|
458
461
|
sections.forEach((section) => {
|
|
@@ -461,6 +464,62 @@ const Sidebar = ({ sections, activeItemId, onItemClick, onSettingsClick, onExpan
|
|
|
461
464
|
return initialExpanded;
|
|
462
465
|
});
|
|
463
466
|
const [allExpanded, setAllExpanded] = useState(true);
|
|
467
|
+
const [sidebarWidth, setSidebarWidth] = useState(defaultWidth);
|
|
468
|
+
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
469
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
470
|
+
const sidebarRef = useRef(null);
|
|
471
|
+
const startXRef = useRef(0);
|
|
472
|
+
const startWidthRef = useRef(0);
|
|
473
|
+
const handleMouseDown = useCallback((e) => {
|
|
474
|
+
e.preventDefault();
|
|
475
|
+
setIsResizing(true);
|
|
476
|
+
startXRef.current = e.clientX;
|
|
477
|
+
startWidthRef.current = sidebarWidth;
|
|
478
|
+
}, [sidebarWidth]);
|
|
479
|
+
const handleMouseMove = useCallback((e) => {
|
|
480
|
+
if (!isResizing)
|
|
481
|
+
return;
|
|
482
|
+
const delta = e.clientX - startXRef.current;
|
|
483
|
+
let newWidth = startWidthRef.current + delta;
|
|
484
|
+
if (collapsible && newWidth < minWidth) {
|
|
485
|
+
setIsCollapsed(true);
|
|
486
|
+
setSidebarWidth(0);
|
|
487
|
+
onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse();
|
|
488
|
+
onWidthChange === null || onWidthChange === void 0 ? void 0 : onWidthChange(0);
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
if (isCollapsed && newWidth >= minWidth) {
|
|
492
|
+
setIsCollapsed(false);
|
|
493
|
+
onExpand === null || onExpand === void 0 ? void 0 : onExpand();
|
|
494
|
+
}
|
|
495
|
+
newWidth = Math.max(minWidth, Math.min(maxWidth, newWidth));
|
|
496
|
+
setSidebarWidth(newWidth);
|
|
497
|
+
onWidthChange === null || onWidthChange === void 0 ? void 0 : onWidthChange(newWidth);
|
|
498
|
+
}
|
|
499
|
+
}, [isResizing, minWidth, maxWidth, collapsible, isCollapsed, onCollapse, onExpand, onWidthChange]);
|
|
500
|
+
const handleMouseUp = useCallback(() => {
|
|
501
|
+
setIsResizing(false);
|
|
502
|
+
}, []);
|
|
503
|
+
useEffect(() => {
|
|
504
|
+
if (isResizing) {
|
|
505
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
506
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
507
|
+
document.body.style.cursor = 'col-resize';
|
|
508
|
+
document.body.style.userSelect = 'none';
|
|
509
|
+
}
|
|
510
|
+
return () => {
|
|
511
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
512
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
513
|
+
document.body.style.cursor = '';
|
|
514
|
+
document.body.style.userSelect = '';
|
|
515
|
+
};
|
|
516
|
+
}, [isResizing, handleMouseMove, handleMouseUp]);
|
|
517
|
+
const expandSidebar = useCallback(() => {
|
|
518
|
+
setIsCollapsed(false);
|
|
519
|
+
setSidebarWidth(defaultWidth);
|
|
520
|
+
onExpand === null || onExpand === void 0 ? void 0 : onExpand();
|
|
521
|
+
onWidthChange === null || onWidthChange === void 0 ? void 0 : onWidthChange(defaultWidth);
|
|
522
|
+
}, [defaultWidth, onExpand, onWidthChange]);
|
|
464
523
|
const toggleSection = (sectionId) => {
|
|
465
524
|
setExpandedSections((prev) => {
|
|
466
525
|
const newSet = new Set(prev);
|
|
@@ -492,16 +551,102 @@ const Sidebar = ({ sections, activeItemId, onItemClick, onSettingsClick, onExpan
|
|
|
492
551
|
const classes = ['tc-sidebar'];
|
|
493
552
|
if (className)
|
|
494
553
|
classes.push(className);
|
|
554
|
+
if (isCollapsed)
|
|
555
|
+
classes.push('tc-sidebar--collapsed');
|
|
556
|
+
if (isResizing)
|
|
557
|
+
classes.push('tc-sidebar--resizing');
|
|
495
558
|
return classes.join(' ');
|
|
496
559
|
};
|
|
497
|
-
|
|
560
|
+
const sidebarStyle = {
|
|
561
|
+
width: isCollapsed ? 0 : sidebarWidth,
|
|
562
|
+
minWidth: isCollapsed ? 0 : minWidth,
|
|
563
|
+
maxWidth: maxWidth,
|
|
564
|
+
};
|
|
565
|
+
if (isCollapsed) {
|
|
566
|
+
return (jsx("aside", { ref: sidebarRef, className: getSidebarClasses(), style: { width: 0, minWidth: 0 }, children: jsx("div", { className: "tc-sidebar__resize-handle tc-sidebar__resize-handle--collapsed", onClick: expandSidebar, title: "Expand sidebar", children: jsx(ChevronDownIcon, { size: "small" }) }) }));
|
|
567
|
+
}
|
|
568
|
+
return (jsxs("aside", { ref: sidebarRef, className: getSidebarClasses(), style: sidebarStyle, children: [jsxs("div", { className: "tc-sidebar__header", children: [jsx(IconButton, { icon: jsx(SettingsIcon, { size: "medium" }), onClick: onSettingsClick, ariaLabel: "Settings", className: "tc-sidebar__settings-button" }), jsx("button", { type: "button", className: "tc-sidebar__toggle-button", onClick: allExpanded ? handleCollapseAll : handleExpandAll, children: allExpanded ? 'Collapse All' : 'Expand All' })] }), jsx("nav", { className: "tc-sidebar__nav", children: sections.map((section) => {
|
|
498
569
|
const isExpanded = expandedSections.has(section.id);
|
|
499
570
|
const sectionActive = isSectionActive(section);
|
|
500
571
|
return (jsxs("div", { className: "tc-sidebar__section", children: [jsxs("button", { type: "button", className: `tc-sidebar__section-header ${sectionActive ? 'tc-sidebar__section-header--active' : ''}`, onClick: () => toggleSection(section.id), "aria-expanded": isExpanded, children: [jsx("span", { className: "tc-sidebar__section-arrow", children: isExpanded ? (jsx(ChevronDownIcon, { size: "small" })) : (jsx(ChevronUpIcon, { size: "small" })) }), jsx("span", { className: "tc-sidebar__section-title", children: section.title })] }), isExpanded && (jsx("ul", { className: "tc-sidebar__items", children: section.items.map((item) => {
|
|
501
572
|
const itemActive = isItemActive(item.id);
|
|
502
573
|
return (jsx("li", { children: jsx("button", { type: "button", className: `tc-sidebar__item ${itemActive ? 'tc-sidebar__item--active' : ''}`, onClick: () => onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, section), children: item.label }) }, item.id));
|
|
503
574
|
}) }))] }, section.id));
|
|
504
|
-
}) })] }));
|
|
575
|
+
}) }), jsx("div", { className: "tc-sidebar__resize-handle", onMouseDown: handleMouseDown, title: "Drag to resize" })] }));
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
// Edit Icon (square with pen)
|
|
579
|
+
const EditIcon = () => (jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M3 17.25V21H6.75L17.81 9.94L14.06 6.19L3 17.25ZM20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C17.98 2.9 17.35 2.9 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04Z", fill: "currentColor" }) }));
|
|
580
|
+
// Copy Icon
|
|
581
|
+
const CopyIcon = () => (jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z", fill: "currentColor" }) }));
|
|
582
|
+
// Delete Icon (trash)
|
|
583
|
+
const DeleteIcon = () => (jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M6 19C6 20.1 6.9 21 8 21H16C17.1 21 18 20.1 18 19V7H6V19ZM8 9H16V19H8V9ZM15.5 4L14.5 3H9.5L8.5 4H5V6H19V4H15.5Z", fill: "currentColor" }) }));
|
|
584
|
+
// Rotate CCW Icon (Change Phase)
|
|
585
|
+
const RotateCcwIcon = () => (jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M17.65 6.35C16.2 4.9 14.21 4 12 4C7.58 4 4.01 7.58 4.01 12C4.01 16.42 7.58 20 12 20C15.73 20 18.84 17.45 19.73 14H17.65C16.83 16.33 14.61 18 12 18C8.69 18 6 15.31 6 12C6 8.69 8.69 6 12 6C13.66 6 15.14 6.69 16.22 7.78L13 11H20V4L17.65 6.35Z", fill: "currentColor" }) }));
|
|
586
|
+
// More Horizontal Icon (three dots)
|
|
587
|
+
const MoreHorizontalIcon = () => (jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M6 10C4.9 10 4 10.9 4 12C4 13.1 4.9 14 6 14C7.1 14 8 13.1 8 12C8 10.9 7.1 10 6 10ZM18 10C16.9 10 16 10.9 16 12C16 13.1 16.9 14 18 14C19.1 14 20 13.1 20 12C20 10.9 19.1 10 18 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z", fill: "currentColor" }) }));
|
|
588
|
+
// Share Icon (upload/share)
|
|
589
|
+
const ShareIcon = () => (jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M9 16H15V10H19L12 3L5 10H9V16ZM5 18H19V20H5V18Z", fill: "currentColor" }) }));
|
|
590
|
+
// Eye Icon (Printable View)
|
|
591
|
+
const EyeIcon = () => (jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 4.5C7 4.5 2.73 7.61 1 12C2.73 16.39 7 19.5 12 19.5C17 19.5 21.27 16.39 23 12C21.27 7.61 17 4.5 12 4.5ZM12 17C9.24 17 7 14.76 7 12C7 9.24 9.24 7 12 7C14.76 7 17 9.24 17 12C17 14.76 14.76 17 12 17ZM12 9C10.34 9 9 10.34 9 12C9 13.66 10.34 15 12 15C13.66 15 15 13.66 15 12C15 10.34 13.66 9 12 9Z", fill: "currentColor" }) }));
|
|
592
|
+
// Bookmark Icon
|
|
593
|
+
const BookmarkIcon = () => (jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M17 3H7C5.9 3 5.01 3.9 5.01 5L5 21L12 18L19 21V5C19 3.9 18.1 3 17 3ZM17 18L12 15.82L7 18V5H17V18Z", fill: "currentColor" }) }));
|
|
594
|
+
// Default action icons mapping
|
|
595
|
+
({
|
|
596
|
+
edit: jsx(EditIcon, {}),
|
|
597
|
+
copy: jsx(CopyIcon, {}),
|
|
598
|
+
delete: jsx(DeleteIcon, {}),
|
|
599
|
+
'change-phase': jsx(RotateCcwIcon, {}),
|
|
600
|
+
'more-actions': jsx(MoreHorizontalIcon, {}),
|
|
601
|
+
share: jsx(ShareIcon, {}),
|
|
602
|
+
'printable-view': jsx(EyeIcon, {}),
|
|
603
|
+
bookmark: jsx(BookmarkIcon, {}),
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
const Layout = ({ header, sidebar, main, footer, actions, rightPanel, showSidebar = true, sidebarPosition = 'left', sidebarWidth = 280, rightPanelWidth = 320, maxContentWidth = '100%', className = '', }) => {
|
|
607
|
+
const headerRef = useRef(null);
|
|
608
|
+
const [headerHeight, setHeaderHeight] = useState(0);
|
|
609
|
+
useEffect(() => {
|
|
610
|
+
const updateHeaderHeight = () => {
|
|
611
|
+
if (headerRef.current) {
|
|
612
|
+
setHeaderHeight(headerRef.current.offsetHeight);
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
updateHeaderHeight();
|
|
616
|
+
window.addEventListener('resize', updateHeaderHeight);
|
|
617
|
+
return () => window.removeEventListener('resize', updateHeaderHeight);
|
|
618
|
+
}, [header]);
|
|
619
|
+
const getLayoutClasses = () => {
|
|
620
|
+
const classes = ['tc-layout'];
|
|
621
|
+
if (className)
|
|
622
|
+
classes.push(className);
|
|
623
|
+
if (!showSidebar || !sidebar)
|
|
624
|
+
classes.push('tc-layout--no-sidebar');
|
|
625
|
+
if (sidebarPosition === 'right')
|
|
626
|
+
classes.push('tc-layout--sidebar-right');
|
|
627
|
+
return classes.join(' ');
|
|
628
|
+
};
|
|
629
|
+
const sidebarStyle = {
|
|
630
|
+
width: typeof sidebarWidth === 'number' ? `${sidebarWidth}px` : sidebarWidth,
|
|
631
|
+
minWidth: typeof sidebarWidth === 'number' ? `${sidebarWidth}px` : sidebarWidth,
|
|
632
|
+
};
|
|
633
|
+
const rightPanelStyle = {
|
|
634
|
+
width: typeof rightPanelWidth === 'number' ? `${rightPanelWidth}px` : rightPanelWidth,
|
|
635
|
+
minWidth: typeof rightPanelWidth === 'number' ? `${rightPanelWidth}px` : rightPanelWidth,
|
|
636
|
+
height: `calc(100vh - ${headerHeight}px)`,
|
|
637
|
+
position: 'sticky',
|
|
638
|
+
top: `${headerHeight}px`,
|
|
639
|
+
flexShrink: 0,
|
|
640
|
+
overflowY: 'auto',
|
|
641
|
+
};
|
|
642
|
+
const mainContentStyle = {
|
|
643
|
+
maxWidth: typeof maxContentWidth === 'number' ? `${maxContentWidth}px` : maxContentWidth,
|
|
644
|
+
};
|
|
645
|
+
return (jsxs("div", { className: getLayoutClasses(), children: [header && (jsx("header", { ref: headerRef, className: "tc-layout__header", children: header })), jsxs("div", { className: "tc-layout__body", children: [sidebar && showSidebar && (jsx("aside", { className: "tc-layout__sidebar", style: {
|
|
646
|
+
...sidebarStyle,
|
|
647
|
+
height: `calc(100vh - ${headerHeight}px)`,
|
|
648
|
+
top: `${headerHeight}px`
|
|
649
|
+
}, children: jsx("div", { className: "tc-layout__sidebar-content", children: sidebar }) })), jsx("div", { className: "tc-layout__main-wrapper", style: { height: `calc(100vh - ${headerHeight}px)` }, children: jsxs("main", { className: "tc-layout__main", style: mainContentStyle, children: [actions && (jsx("div", { className: "tc-layout__actions", children: actions })), jsx("div", { className: "tc-layout__content", children: main })] }) }), rightPanel && (jsx("aside", { className: "tc-layout__right-panel", style: rightPanelStyle, children: rightPanel }))] }), footer && (jsx("footer", { className: "tc-layout__footer", children: footer }))] }));
|
|
505
650
|
};
|
|
506
651
|
|
|
507
652
|
var x = Object.defineProperty;
|
|
@@ -720,5 +865,5 @@ function registerWebComponents() {
|
|
|
720
865
|
// Auto-register when loaded in browser
|
|
721
866
|
registerWebComponents();
|
|
722
867
|
|
|
723
|
-
export { Button, ButtonGroup, CaretDownIcon, ChevronDownIcon, ChevronUpIcon, DropdownMenu, FilterDropdown, GlobalHeader, GlobalSearch, HeaderMenu, IconButton, InfoIcon, Input, Logo, MainHeader, SearchIcon, Sidebar, TCButton, TCButtonGroup, TCInput, Tab, defaultIcons, registerWebComponents };
|
|
868
|
+
export { Button, ButtonGroup, CaretDownIcon, ChevronDownIcon, ChevronUpIcon, DropdownMenu, FilterDropdown, GlobalHeader, GlobalSearch, HeaderMenu, IconButton, InfoIcon, Input, Layout, Logo, MainHeader, SearchIcon, Sidebar, TCButton, TCButtonGroup, TCInput, Tab, defaultIcons, registerWebComponents };
|
|
724
869
|
//# sourceMappingURL=index.esm.js.map
|