@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.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -13
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.css.map +1 -1
- package/dist/index.esm.js +16 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16 -31
- package/dist/index.js.map +1 -1
- package/dist/index.umd.css +1 -1
- package/dist/index.umd.css.map +1 -1
- package/dist/index.umd.js +16 -31
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -9628,29 +9628,13 @@ const Skeleton = forwardRef(({ variant = 'text', size = 'm', width, height, anim
|
|
|
9628
9628
|
});
|
|
9629
9629
|
Skeleton.displayName = 'Skeleton';
|
|
9630
9630
|
|
|
9631
|
-
const SplitView = ({ direction = 'horizontal', mode = 'ratio', panels, splitterSize = 4, splitterColor, splitterHoverColor, fullWidth = false, fullHeight = false, className,
|
|
9632
|
-
// Legacy props
|
|
9633
|
-
first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) => {
|
|
9634
|
-
// Legacy mode: first/second props를 panels로 변환
|
|
9635
|
-
const effectivePanels = panels || [
|
|
9636
|
-
{
|
|
9637
|
-
content: first,
|
|
9638
|
-
size: mode === 'fixed' ? firstSize : initialSplit,
|
|
9639
|
-
minSize,
|
|
9640
|
-
maxSize,
|
|
9641
|
-
resizable: true,
|
|
9642
|
-
},
|
|
9643
|
-
{
|
|
9644
|
-
content: second,
|
|
9645
|
-
resizable: false, // 마지막 패널은 flex로 채움
|
|
9646
|
-
},
|
|
9647
|
-
];
|
|
9631
|
+
const SplitView = ({ direction = 'horizontal', mode = 'ratio', panels, splitterSize = 4, splitterColor, splitterHoverColor, fullWidth = false, fullHeight = false, className, }) => {
|
|
9648
9632
|
// 각 패널의 현재 크기 상태
|
|
9649
|
-
const [panelSizes, setPanelSizes] = useState(() =>
|
|
9633
|
+
const [panelSizes, setPanelSizes] = useState(() => panels.map((panel, index) => {
|
|
9650
9634
|
if (panel.size !== undefined)
|
|
9651
9635
|
return panel.size;
|
|
9652
9636
|
if (mode === 'ratio')
|
|
9653
|
-
return 1 /
|
|
9637
|
+
return 1 / panels.length;
|
|
9654
9638
|
return 200; // 기본 고정 크기
|
|
9655
9639
|
}));
|
|
9656
9640
|
const [draggingIndex, setDraggingIndex] = useState(null);
|
|
@@ -9667,7 +9651,7 @@ first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) =
|
|
|
9667
9651
|
if (draggingIndex === null || !containerRef.current)
|
|
9668
9652
|
return;
|
|
9669
9653
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
9670
|
-
const panel =
|
|
9654
|
+
const panel = panels[draggingIndex];
|
|
9671
9655
|
let newSize;
|
|
9672
9656
|
if (direction === 'horizontal') {
|
|
9673
9657
|
const containerWidth = containerRect.width;
|
|
@@ -9716,7 +9700,7 @@ first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) =
|
|
|
9716
9700
|
next[draggingIndex] = newSize;
|
|
9717
9701
|
return next;
|
|
9718
9702
|
});
|
|
9719
|
-
}, [draggingIndex, direction, mode, splitterSize, panelSizes,
|
|
9703
|
+
}, [draggingIndex, direction, mode, splitterSize, panelSizes, panels]);
|
|
9720
9704
|
// 드래그 종료
|
|
9721
9705
|
const handleMouseUp = useCallback(() => {
|
|
9722
9706
|
setDraggingIndex(null);
|
|
@@ -9744,12 +9728,18 @@ first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) =
|
|
|
9744
9728
|
'--splitter-color': splitterColor,
|
|
9745
9729
|
'--splitter-hover-color': splitterHoverColor,
|
|
9746
9730
|
};
|
|
9747
|
-
return (jsx("div", { ref: containerRef, className: classes, style: style, children:
|
|
9731
|
+
return (jsx("div", { ref: containerRef, className: classes, style: style, children: panels.map((panel, index) => {
|
|
9748
9732
|
const size = panelSizes[index];
|
|
9749
|
-
const isLast = index ===
|
|
9733
|
+
const isLast = index === panels.length - 1;
|
|
9734
|
+
const isFlexible = panel.flexible !== undefined ? panel.flexible : isLast;
|
|
9750
9735
|
const isResizable = panel.resizable !== false && !isLast;
|
|
9751
9736
|
const panelStyle = {};
|
|
9752
|
-
if (
|
|
9737
|
+
if (isFlexible) {
|
|
9738
|
+
// flexible 패널은 나머지 공간을 자동으로 채움
|
|
9739
|
+
panelStyle.flex = 1;
|
|
9740
|
+
}
|
|
9741
|
+
else {
|
|
9742
|
+
// 고정 크기 또는 비율 패널
|
|
9753
9743
|
if (direction === 'horizontal') {
|
|
9754
9744
|
panelStyle.width = mode === 'fixed' ? `${size}px` : `${size * 100}%`;
|
|
9755
9745
|
panelStyle.flexShrink = 0;
|
|
@@ -9759,13 +9749,8 @@ first, second, initialSplit = 0.5, firstSize = 200, minSize = 100, maxSize, }) =
|
|
|
9759
9749
|
panelStyle.flexShrink = 0;
|
|
9760
9750
|
}
|
|
9761
9751
|
}
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
}
|
|
9765
|
-
return (jsxs(React.Fragment, { children: [jsx("div", { className: clsx('designbase-split-view__panel', panel.className), style: panelStyle, children: panel.content }), !isLast && (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: {
|
|
9766
|
-
cursor: isResizable
|
|
9767
|
-
? direction === 'horizontal' ? 'col-resize' : 'row-resize'
|
|
9768
|
-
: 'default',
|
|
9752
|
+
return (jsxs(React.Fragment, { children: [jsx("div", { className: clsx('designbase-split-view__panel', panel.className), style: panelStyle, children: panel.content }), !isLast && isResizable && (jsx("div", { className: clsx('designbase-split-view__splitter', `designbase-split-view__splitter--direction-${direction}`), onMouseDown: handleMouseDown(index), style: {
|
|
9753
|
+
cursor: direction === 'horizontal' ? 'col-resize' : 'row-resize',
|
|
9769
9754
|
} }))] }, index));
|
|
9770
9755
|
}) }));
|
|
9771
9756
|
};
|