@designbasekorea/ui 0.1.34 → 0.1.36

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.umd.js CHANGED
@@ -5100,6 +5100,76 @@
5100
5100
  };
5101
5101
  Confirm.displayName = 'Confirm';
5102
5102
 
5103
+ const Countdown = ({ endDate, duration, size = 'm', variant = 'default', showDays = true, showHours = true, showMinutes = true, showSeconds = true, showLabels = true, labels = {
5104
+ days: '일',
5105
+ hours: '시간',
5106
+ minutes: '분',
5107
+ seconds: '초',
5108
+ }, onComplete, onTick, className, }) => {
5109
+ // 종료 시간 계산
5110
+ const targetTime = React.useMemo(() => {
5111
+ if (endDate) {
5112
+ return typeof endDate === 'string' ? new Date(endDate).getTime() : endDate.getTime();
5113
+ }
5114
+ if (duration) {
5115
+ return Date.now() + duration * 1000;
5116
+ }
5117
+ return Date.now();
5118
+ }, [endDate, duration]);
5119
+ // 남은 시간 계산 함수
5120
+ const calculateTimeRemaining = () => {
5121
+ const now = Date.now();
5122
+ const total = targetTime - now;
5123
+ if (total <= 0) {
5124
+ return { days: 0, hours: 0, minutes: 0, seconds: 0, total: 0 };
5125
+ }
5126
+ const seconds = Math.floor((total / 1000) % 60);
5127
+ const minutes = Math.floor((total / 1000 / 60) % 60);
5128
+ const hours = Math.floor((total / (1000 * 60 * 60)) % 24);
5129
+ const days = Math.floor(total / (1000 * 60 * 60 * 24));
5130
+ return { days, hours, minutes, seconds, total };
5131
+ };
5132
+ const [timeRemaining, setTimeRemaining] = React.useState(calculateTimeRemaining());
5133
+ React.useEffect(() => {
5134
+ const timer = setInterval(() => {
5135
+ const newTimeRemaining = calculateTimeRemaining();
5136
+ setTimeRemaining(newTimeRemaining);
5137
+ onTick?.(newTimeRemaining);
5138
+ if (newTimeRemaining.total <= 0) {
5139
+ clearInterval(timer);
5140
+ onComplete?.();
5141
+ }
5142
+ }, 1000);
5143
+ return () => clearInterval(timer);
5144
+ }, [targetTime, onComplete, onTick]);
5145
+ const classes = clsx('designbase-countdown', `designbase-countdown--${size}`, `designbase-countdown--${variant}`, {
5146
+ 'designbase-countdown--with-labels': showLabels,
5147
+ 'designbase-countdown--expired': timeRemaining.total <= 0,
5148
+ }, className);
5149
+ // 숫자를 두 자리로 포맷
5150
+ const formatNumber = (num) => {
5151
+ return num.toString().padStart(2, '0');
5152
+ };
5153
+ const renderTimeUnit = (value, label, show) => {
5154
+ if (!show)
5155
+ return null;
5156
+ return (jsxRuntime.jsxs("div", { className: "designbase-countdown__unit", children: [jsxRuntime.jsx("div", { className: "designbase-countdown__value", children: formatNumber(value) }), showLabels && (jsxRuntime.jsx("div", { className: "designbase-countdown__label", children: label }))] }));
5157
+ };
5158
+ const renderSeparator = () => {
5159
+ if (variant === 'minimal')
5160
+ return null;
5161
+ return jsxRuntime.jsx("div", { className: "designbase-countdown__separator", children: ":" });
5162
+ };
5163
+ const units = [
5164
+ { value: timeRemaining.days, label: labels.days || '일', show: showDays },
5165
+ { value: timeRemaining.hours, label: labels.hours || '시간', show: showHours },
5166
+ { value: timeRemaining.minutes, label: labels.minutes || '분', show: showMinutes },
5167
+ { value: timeRemaining.seconds, label: labels.seconds || '초', show: showSeconds },
5168
+ ].filter(unit => unit.show);
5169
+ return (jsxRuntime.jsx("div", { className: classes, children: units.map((unit, index) => (jsxRuntime.jsxs(React.Fragment, { children: [renderTimeUnit(unit.value, unit.label, unit.show), index < units.length - 1 && renderSeparator()] }, unit.label))) }));
5170
+ };
5171
+ Countdown.displayName = 'Countdown';
5172
+
5103
5173
  const Container = ({ size = 'l', maxWidth, variant = 'plain', padding = 'm', margin = 'none', backgroundColor, border = false, rounded = false, shadow = false, className, children, }) => {
5104
5174
  // 크기별 최대 폭 설정 (토큰 기반)
5105
5175
  const getMaxWidth = () => {
@@ -9627,7 +9697,7 @@
9627
9697
  });
9628
9698
  Skeleton.displayName = 'Skeleton';
9629
9699
 
9630
- const SplitView = ({ direction = 'horizontal', mode = 'ratio', panels, splitterSize = 4, splitterColor, splitterHoverColor, fullWidth = false, fullHeight = false, className, }) => {
9700
+ const SplitView = ({ direction = 'horizontal', mode = 'ratio', panels, splitterSize = 4, splitterColor, splitterHoverColor, gap = 0, fullWidth = false, fullHeight = false, className, }) => {
9631
9701
  // 각 패널의 현재 크기 상태
9632
9702
  const [panelSizes, setPanelSizes] = React.useState(() => panels.map((panel, index) => {
9633
9703
  if (panel.size !== undefined)
@@ -9726,6 +9796,7 @@
9726
9796
  '--splitter-size': `${splitterSize}px`,
9727
9797
  '--splitter-color': splitterColor,
9728
9798
  '--splitter-hover-color': splitterHoverColor,
9799
+ gap: gap > 0 ? `${gap}px` : undefined,
9729
9800
  };
9730
9801
  return (jsxRuntime.jsx("div", { ref: containerRef, className: classes, style: style, children: panels.map((panel, index) => {
9731
9802
  const size = panelSizes[index];
@@ -9748,7 +9819,7 @@
9748
9819
  panelStyle.flexShrink = 0;
9749
9820
  }
9750
9821
  }
9751
- 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: {
9822
+ return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx('designbase-split-view__panel', panel.className), style: panelStyle, children: panel.content }), !isLast && isResizable && gap === 0 && (jsxRuntime.jsx("div", { className: clsx('designbase-split-view__splitter', `designbase-split-view__splitter--direction-${direction}`), onMouseDown: handleMouseDown(index), style: {
9752
9823
  cursor: direction === 'horizontal' ? 'col-resize' : 'row-resize',
9753
9824
  } }))] }, index));
9754
9825
  }) }));
@@ -11024,6 +11095,7 @@
11024
11095
  exports.Confirm = Confirm;
11025
11096
  exports.Container = Container;
11026
11097
  exports.ContextMenu = ContextMenu;
11098
+ exports.Countdown = Countdown;
11027
11099
  exports.DatePicker = DatePicker;
11028
11100
  exports.Divider = Divider;
11029
11101
  exports.Drawer = Drawer;