tc-dazzle-ui 1.10.1 → 1.10.3

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.
@@ -17,13 +17,10 @@ export interface SidebarProps {
17
17
  onSettingsClick?: () => void;
18
18
  onExpandAllClick?: () => void;
19
19
  onCollapseAllClick?: () => void;
20
- onCollapse?: () => void;
21
- onExpand?: () => void;
22
20
  onWidthChange?: (width: number) => void;
23
21
  defaultWidth?: number;
24
22
  minWidth?: number;
25
23
  maxWidth?: number;
26
- collapsible?: boolean;
27
24
  className?: string;
28
25
  }
29
26
  export declare const Sidebar: React.FC<SidebarProps>;
package/dist/index.esm.js CHANGED
@@ -442,7 +442,7 @@ 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, showPropertiesButton = true, isPropertiesOpen = false, onPropertiesClick, className = '', }) => {
445
+ const GlobalHeader = ({ tabs, activeTabId, onTabClick, onMenuClick, showMenuButton = true, showPropertiesButton = false, isPropertiesOpen = false, onPropertiesClick, className = '', }) => {
446
446
  const getHeaderClasses = () => {
447
447
  const classes = ['tc-global-header'];
448
448
  if (className)
@@ -455,7 +455,7 @@ const GlobalHeader = ({ tabs, activeTabId, onTabClick, onMenuClick, showMenuButt
455
455
  const MIN_WIDTH = 242;
456
456
  const MAX_WIDTH = 1100;
457
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 = '', }) => {
458
+ const Sidebar = ({ sections, activeItemId, onItemClick, onSettingsClick, onExpandAllClick, onCollapseAllClick, onWidthChange, defaultWidth = DEFAULT_WIDTH, minWidth = MIN_WIDTH, maxWidth = MAX_WIDTH, className = '', }) => {
459
459
  const [expandedSections, setExpandedSections] = useState(() => {
460
460
  const initialExpanded = new Set();
461
461
  sections.forEach((section) => {
@@ -465,7 +465,6 @@ const Sidebar = ({ sections, activeItemId, onItemClick, onSettingsClick, onExpan
465
465
  });
466
466
  const [allExpanded, setAllExpanded] = useState(true);
467
467
  const [sidebarWidth, setSidebarWidth] = useState(defaultWidth);
468
- const [isCollapsed, setIsCollapsed] = useState(false);
469
468
  const [isResizing, setIsResizing] = useState(false);
470
469
  const sidebarRef = useRef(null);
471
470
  const startXRef = useRef(0);
@@ -481,22 +480,11 @@ const Sidebar = ({ sections, activeItemId, onItemClick, onSettingsClick, onExpan
481
480
  return;
482
481
  const delta = e.clientX - startXRef.current;
483
482
  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]);
483
+ // Clamp to min/max without collapsing
484
+ newWidth = Math.max(minWidth, Math.min(maxWidth, newWidth));
485
+ setSidebarWidth(newWidth);
486
+ onWidthChange === null || onWidthChange === void 0 ? void 0 : onWidthChange(newWidth);
487
+ }, [isResizing, minWidth, maxWidth, onWidthChange]);
500
488
  const handleMouseUp = useCallback(() => {
501
489
  setIsResizing(false);
502
490
  }, []);
@@ -514,12 +502,6 @@ const Sidebar = ({ sections, activeItemId, onItemClick, onSettingsClick, onExpan
514
502
  document.body.style.userSelect = '';
515
503
  };
516
504
  }, [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]);
523
505
  const toggleSection = (sectionId) => {
524
506
  setExpandedSections((prev) => {
525
507
  const newSet = new Set(prev);
@@ -551,20 +533,15 @@ const Sidebar = ({ sections, activeItemId, onItemClick, onSettingsClick, onExpan
551
533
  const classes = ['tc-sidebar'];
552
534
  if (className)
553
535
  classes.push(className);
554
- if (isCollapsed)
555
- classes.push('tc-sidebar--collapsed');
556
536
  if (isResizing)
557
537
  classes.push('tc-sidebar--resizing');
558
538
  return classes.join(' ');
559
539
  };
560
540
  const sidebarStyle = {
561
- width: isCollapsed ? 0 : sidebarWidth,
562
- minWidth: isCollapsed ? 0 : minWidth,
541
+ width: sidebarWidth,
542
+ minWidth: minWidth,
563
543
  maxWidth: maxWidth,
564
544
  };
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
545
  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) => {
569
546
  const isExpanded = expandedSections.has(section.id);
570
547
  const sectionActive = isSectionActive(section);