@designbasekorea/ui 0.1.30 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9630,29 +9630,13 @@ const Skeleton = React.forwardRef(({ variant = 'text', size = 'm', width, height
9630
9630
  });
9631
9631
  Skeleton.displayName = 'Skeleton';
9632
9632
 
9633
- const SplitView = ({ direction = 'horizontal', mode = 'ratio', panels, splitterSize = 4, splitterColor, splitterHoverColor, fullWidth = false, fullHeight = false, className,
9634
- // Legacy props
9635
- first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) => {
9636
- // Legacy mode: first/second props를 panels로 변환
9637
- const effectivePanels = panels || [
9638
- {
9639
- content: first,
9640
- size: mode === 'fixed' ? firstSize : initialSplit,
9641
- minSize,
9642
- maxSize,
9643
- resizable: true,
9644
- },
9645
- {
9646
- content: second,
9647
- resizable: false, // 마지막 패널은 flex로 채움
9648
- },
9649
- ];
9633
+ const SplitView = ({ direction = 'horizontal', mode = 'ratio', panels, splitterSize = 4, splitterColor, splitterHoverColor, fullWidth = false, fullHeight = false, className, }) => {
9650
9634
  // 각 패널의 현재 크기 상태
9651
- const [panelSizes, setPanelSizes] = React.useState(() => effectivePanels.map((panel, index) => {
9635
+ const [panelSizes, setPanelSizes] = React.useState(() => panels.map((panel, index) => {
9652
9636
  if (panel.size !== undefined)
9653
9637
  return panel.size;
9654
9638
  if (mode === 'ratio')
9655
- return 1 / effectivePanels.length;
9639
+ return 1 / panels.length;
9656
9640
  return 200; // 기본 고정 크기
9657
9641
  }));
9658
9642
  const [draggingIndex, setDraggingIndex] = React.useState(null);
@@ -9669,7 +9653,7 @@ first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) =
9669
9653
  if (draggingIndex === null || !containerRef.current)
9670
9654
  return;
9671
9655
  const containerRect = containerRef.current.getBoundingClientRect();
9672
- const panel = effectivePanels[draggingIndex];
9656
+ const panel = panels[draggingIndex];
9673
9657
  let newSize;
9674
9658
  if (direction === 'horizontal') {
9675
9659
  const containerWidth = containerRect.width;
@@ -9718,7 +9702,7 @@ first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) =
9718
9702
  next[draggingIndex] = newSize;
9719
9703
  return next;
9720
9704
  });
9721
- }, [draggingIndex, direction, mode, splitterSize, panelSizes, effectivePanels]);
9705
+ }, [draggingIndex, direction, mode, splitterSize, panelSizes, panels]);
9722
9706
  // 드래그 종료
9723
9707
  const handleMouseUp = React.useCallback(() => {
9724
9708
  setDraggingIndex(null);
@@ -9746,12 +9730,18 @@ first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) =
9746
9730
  '--splitter-color': splitterColor,
9747
9731
  '--splitter-hover-color': splitterHoverColor,
9748
9732
  };
9749
- return (jsxRuntime.jsx("div", { ref: containerRef, className: classes, style: style, children: effectivePanels.map((panel, index) => {
9733
+ return (jsxRuntime.jsx("div", { ref: containerRef, className: classes, style: style, children: panels.map((panel, index) => {
9750
9734
  const size = panelSizes[index];
9751
- const isLast = index === effectivePanels.length - 1;
9735
+ const isLast = index === panels.length - 1;
9736
+ const isFlexible = panel.flexible !== undefined ? panel.flexible : isLast;
9752
9737
  const isResizable = panel.resizable !== false && !isLast;
9753
9738
  const panelStyle = {};
9754
- if (!isLast) {
9739
+ if (isFlexible) {
9740
+ // flexible 패널은 나머지 공간을 자동으로 채움
9741
+ panelStyle.flex = 1;
9742
+ }
9743
+ else {
9744
+ // 고정 크기 또는 비율 패널
9755
9745
  if (direction === 'horizontal') {
9756
9746
  panelStyle.width = mode === 'fixed' ? `${size}px` : `${size * 100}%`;
9757
9747
  panelStyle.flexShrink = 0;
@@ -9761,13 +9751,8 @@ first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) =
9761
9751
  panelStyle.flexShrink = 0;
9762
9752
  }
9763
9753
  }
9764
- else {
9765
- panelStyle.flex = 1;
9766
- }
9767
- return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx('designbase-split-view__panel', panel.className), style: panelStyle, children: panel.content }), !isLast && (jsxRuntime.jsx("div", { className: clsx('designbase-split-view__splitter', `designbase-split-view__splitter--direction-${direction}`, { 'designbase-split-view__splitter--disabled': !isResizable }), onMouseDown: isResizable ? handleMouseDown(index) : undefined, style: {
9768
- cursor: isResizable
9769
- ? direction === 'horizontal' ? 'col-resize' : 'row-resize'
9770
- : 'default',
9754
+ return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx('designbase-split-view__panel', panel.className), style: panelStyle, children: panel.content }), !isLast && isResizable && (jsxRuntime.jsx("div", { className: clsx('designbase-split-view__splitter', `designbase-split-view__splitter--direction-${direction}`), onMouseDown: handleMouseDown(index), style: {
9755
+ cursor: direction === 'horizontal' ? 'col-resize' : 'row-resize',
9771
9756
  } }))] }, index));
9772
9757
  }) }));
9773
9758
  };