sellmate-design-system-react 0.5.0 → 0.6.1

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.
Files changed (38) hide show
  1. package/README.md +20 -0
  2. package/dist/components/SDateRangePicker/SDateRangePicker.cjs +180 -37
  3. package/dist/components/SDateRangePicker/SDateRangePicker.cjs.map +1 -1
  4. package/dist/components/SDateRangePicker/SDateRangePicker.d.ts +6 -1
  5. package/dist/components/SDateRangePicker/SDateRangePicker.js +180 -37
  6. package/dist/components/SDateRangePicker/SDateRangePicker.js.map +1 -1
  7. package/dist/components/SGnb/SGnb.cjs +145 -57
  8. package/dist/components/SGnb/SGnb.cjs.map +1 -1
  9. package/dist/components/SGnb/SGnb.d.ts +7 -1
  10. package/dist/components/SGnb/SGnb.js +146 -58
  11. package/dist/components/SGnb/SGnb.js.map +1 -1
  12. package/dist/components/SKeyValueTable/SKeyValueTable.cjs +180 -37
  13. package/dist/components/SKeyValueTable/SKeyValueTable.cjs.map +1 -1
  14. package/dist/components/SKeyValueTable/SKeyValueTable.js +180 -37
  15. package/dist/components/SKeyValueTable/SKeyValueTable.js.map +1 -1
  16. package/dist/components/SLayout/SLayout.cjs +21 -6
  17. package/dist/components/SLayout/SLayout.cjs.map +1 -1
  18. package/dist/components/SLayout/SLayout.d.ts +17 -2
  19. package/dist/components/SLayout/SLayout.js +21 -6
  20. package/dist/components/SLayout/SLayout.js.map +1 -1
  21. package/dist/components/SPage/SPage.cjs +21 -6
  22. package/dist/components/SPage/SPage.cjs.map +1 -1
  23. package/dist/components/SPage/SPage.js +21 -6
  24. package/dist/components/SPage/SPage.js.map +1 -1
  25. package/dist/components/SStepper/SStepper.cjs +3019 -0
  26. package/dist/components/SStepper/SStepper.cjs.map +1 -0
  27. package/dist/components/SStepper/SStepper.d.ts +16 -0
  28. package/dist/components/SStepper/SStepper.js +3017 -0
  29. package/dist/components/SStepper/SStepper.js.map +1 -0
  30. package/dist/components/SStepper/index.d.ts +2 -0
  31. package/dist/components/SStepper/stepper.config.d.ts +42 -0
  32. package/dist/index.cjs +500 -104
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +499 -105
  36. package/dist/index.js.map +1 -1
  37. package/dist/styles.css +61 -0
  38. package/package.json +3 -1
@@ -3255,15 +3255,30 @@ react.forwardRef(function SLayout2({
3255
3255
  },
3256
3256
  [isControlled, onFoldedChange]
3257
3257
  );
3258
+ const [gnbState, setGnbState] = react.useState({ forceFull: false, menuVisible: true });
3259
+ const reportGnbState = react.useCallback(
3260
+ (next) => setGnbState(
3261
+ (prev) => prev.forceFull === next.forceFull && prev.menuVisible === next.menuVisible ? prev : next
3262
+ ),
3263
+ []
3264
+ );
3265
+ const effectiveHeader = header === "full" || gnbState.forceFull ? "full" : "fix";
3258
3266
  const ctx = react.useMemo(
3259
- () => ({ type, header, useRail, folded: currentFolded, setFolded }),
3260
- [type, header, useRail, currentFolded, setFolded]
3261
- );
3262
- const isFullHeader = header === "full";
3263
- const gnbColumnWidth = useRail ? GNB_RAIL_WIDTH + GNB_MENU_WIDTH : GNB_MENU_WIDTH;
3267
+ () => ({
3268
+ type,
3269
+ header: effectiveHeader,
3270
+ useRail,
3271
+ folded: currentFolded,
3272
+ setFolded,
3273
+ reportGnbState
3274
+ }),
3275
+ [type, effectiveHeader, useRail, currentFolded, setFolded, reportGnbState]
3276
+ );
3277
+ const isFullHeader = effectiveHeader === "full";
3278
+ const gnbColumnWidth = (useRail ? GNB_RAIL_WIDTH : 0) + (gnbState.menuVisible ? GNB_MENU_WIDTH : 0);
3264
3279
  const frameStyle = isFullHeader ? {
3265
3280
  gridTemplateColumns: `${currentFolded ? 0 : gnbColumnWidth}px 1fr`,
3266
- gridTemplateRows: `${GNB_HEADER[header].topHeight} 1fr`,
3281
+ gridTemplateRows: `${GNB_HEADER[effectiveHeader].topHeight} 1fr`,
3267
3282
  // 메뉴가 미끄러지는 동안 페이지 열도 같은 길이로 따라와야 한 덩어리로 읽힌다.
3268
3283
  // (fix 는 SGnb 가 제 폭을 직접 전환하므로 프레임이 손댈 게 없다)
3269
3284
  transition: `grid-template-columns ${GNB_FOLD_MS}ms ease-out`
@@ -3273,7 +3288,7 @@ react.forwardRef(function SLayout2({
3273
3288
  {
3274
3289
  ref,
3275
3290
  "data-type": type,
3276
- "data-header": header,
3291
+ "data-header": effectiveHeader,
3277
3292
  className: cn(
3278
3293
  "box-border h-full overflow-hidden",
3279
3294
  isFullHeader ? "grid" : "flex flex-row",
@@ -3306,9 +3321,10 @@ var SGnb = react.forwardRef(function SGnb2({
3306
3321
  }, ref) {
3307
3322
  const layout = react.useContext(SLayoutContext);
3308
3323
  const type = typeProp ?? layout?.type ?? "box";
3309
- const header = headerProp ?? layout?.header ?? "fix";
3310
3324
  const folded = foldedProp ?? layout?.folded ?? false;
3311
3325
  const useRail = useRailProp ?? layout?.useRail ?? false;
3326
+ const railHasLeaf = useRail && items.some((item) => !item.children || item.children.length === 0);
3327
+ const header = railHasLeaf ? "full" : headerProp ?? layout?.header ?? "fix";
3312
3328
  const H = GNB_HEADER[header];
3313
3329
  const M = GNB_MENU[type];
3314
3330
  const C = GNB_COLORS[color];
@@ -3442,9 +3458,24 @@ var SGnb = react.forwardRef(function SGnb2({
3442
3458
  onMouseEnter: () => setHoveredKey(item.value),
3443
3459
  onMouseLeave: () => setHoveredKey((prev) => prev === item.value ? null : prev),
3444
3460
  children: [
3445
- depth === 1 && item.icon && /* @__PURE__ */ jsxRuntime.jsx(SIcon, { name: item.icon, size: M.depth1Icon, color: C.itemIcon, className: "shrink-0" }),
3461
+ depth === 1 && item.icon && /* @__PURE__ */ jsxRuntime.jsx(
3462
+ SIcon,
3463
+ {
3464
+ name: item.icon,
3465
+ size: M.depth1Icon,
3466
+ color: isSelected ? C.itemColorActive : C.itemIcon,
3467
+ className: "shrink-0"
3468
+ }
3469
+ ),
3446
3470
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap flex flex-no-wrap items-center", children: [
3447
- depth > 1 && iconBranch ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[20px] h-[24px] flex items-center justify-center mr-[8px]", children: "-" }) : null,
3471
+ depth > 1 && iconBranch ? /* @__PURE__ */ jsxRuntime.jsx(
3472
+ "div",
3473
+ {
3474
+ className: "w-[20px] flex items-center justify-center mr-[8px]",
3475
+ style: { height: M.itemLineHeight },
3476
+ children: "-"
3477
+ }
3478
+ ) : null,
3448
3479
  item.label
3449
3480
  ] }),
3450
3481
  item.tag !== void 0 && item.tag !== "" && /* @__PURE__ */ jsxRuntime.jsx(
@@ -3496,16 +3527,28 @@ var SGnb = react.forwardRef(function SGnb2({
3496
3527
  };
3497
3528
  const railItems = useRail ? items : [];
3498
3529
  const menuItems = useRail ? items.find((item) => item.value === activeRail)?.children ?? [] : items;
3499
- const bodyWidth = useRail ? GNB_RAIL_WIDTH + GNB_MENU_WIDTH : GNB_MENU_WIDTH;
3530
+ const showMenu = !useRail || menuItems.length > 0;
3531
+ const bodyWidth = (useRail ? GNB_RAIL_WIDTH : 0) + (showMenu ? GNB_MENU_WIDTH : 0);
3532
+ react.useEffect(() => {
3533
+ layout?.reportGnbState({ forceFull: railHasLeaf, menuVisible: showMenu });
3534
+ }, [layout, railHasLeaf, showMenu]);
3500
3535
  const railFolded = folded && header === "fix";
3501
3536
  const rootWidth = header === "full" ? "100%" : folded ? GNB_COMMON.foldWidth : bodyWidth;
3537
+ const rightBorder = color === "light" ? `1px solid ${C.topBorder}` : void 0;
3502
3538
  const rootStyle = {
3503
3539
  width: rootWidth,
3504
3540
  transition: `width ${GNB_FOLD_MS}ms ease-out`,
3505
- ...header === "full" ? { gridArea: "1 / 1 / -1 / -1", pointerEvents: "none" } : { backgroundColor: C.panelBg },
3541
+ ...header === "full" ? { gridArea: "1 / 1 / -1 / -1", pointerEvents: "none" } : { backgroundColor: C.panelBg, borderRight: rightBorder },
3506
3542
  ...style
3507
3543
  };
3508
3544
  const hideAfterSlide = (hidden) => `visibility 0s linear ${hidden ? `${GNB_FOLD_MS}ms` : "0s"}`;
3545
+ const foldInline = !!logo;
3546
+ const sideFoldStyle = {
3547
+ opacity: railFolded ? 0 : 1,
3548
+ position: railFolded ? "absolute" : "static",
3549
+ visibility: railFolded ? "hidden" : "visible",
3550
+ transition: `opacity ${GNB_FOLD_MS}ms ease-out, ${hideAfterSlide(railFolded)}`
3551
+ };
3509
3552
  return /* @__PURE__ */ jsxRuntime.jsxs(
3510
3553
  "div",
3511
3554
  {
@@ -3517,12 +3560,14 @@ var SGnb = react.forwardRef(function SGnb2({
3517
3560
  "data-color": color,
3518
3561
  ...rest,
3519
3562
  children: [
3520
- /* @__PURE__ */ jsxRuntime.jsxs(
3563
+ /* @__PURE__ */ jsxRuntime.jsx(
3521
3564
  "div",
3522
3565
  {
3523
3566
  className: "relative box-border flex shrink-0 items-center overflow-hidden",
3524
3567
  style: {
3525
3568
  height: H.topHeight,
3569
+ // 인라인 간격은 컨테이너 gap 대신 각 요소 margin 으로 준다 — 런처↔폴드(8px)와
3570
+ // 폴드↔로고(top-gap)를 다르게 두기 위함. 접히면 런처·로고가 흐름에서 빠져 margin 도 무의미해진다.
3526
3571
  padding: `0 ${railFolded ? GNB_RAIL.padding : H.topPaddingX}`,
3527
3572
  borderBottom: `1px solid ${C.topBorder}`,
3528
3573
  backgroundColor: C.panelBg,
@@ -3531,49 +3576,90 @@ var SGnb = react.forwardRef(function SGnb2({
3531
3576
  // 아이콘 버튼은 자체 ghostButton 토큰을 쓰므로, 이 색은 logo 슬롯 상속용
3532
3577
  color: C.itemColorDefault
3533
3578
  },
3534
- children: [
3535
- (onLauncherClick || logo) && /* @__PURE__ */ jsxRuntime.jsxs(
3536
- "div",
3537
- {
3538
- className: "absolute inset-y-0 flex items-center",
3539
- style: {
3540
- left: H.topPaddingX,
3541
- gap: H.topGap,
3542
- opacity: railFolded ? 0 : 1,
3543
- transition: `opacity ${GNB_FOLD_MS}ms ease-out, ${hideAfterSlide(railFolded)}, transform ${GNB_FOLD_MS}ms ease-out`,
3544
- // 메뉴와 같은 방향으로 빠지되, 좁은 레일 안에서 꼬리가 비치지 않게 페이드가 거리를 대신한다
3545
- transform: railFolded ? `translateX(-${H.topPaddingX})` : "none",
3546
- visibility: railFolded ? "hidden" : "visible"
3547
- },
3548
- children: [
3549
- onLauncherClick && /* @__PURE__ */ jsxRuntime.jsx(
3550
- SGhostButton,
3551
- {
3552
- icon: "launcher",
3553
- size: "xs",
3554
- intent: color === "dark" ? "inverse" : "default",
3555
- ariaLabel: "app launcher",
3556
- onClick: onLauncherClick,
3557
- className: "shrink-0"
3558
- }
3559
- ),
3560
- logo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center", style: { height: H.logoHeight }, children: logo })
3561
- ]
3562
- }
3563
- ),
3564
- /* @__PURE__ */ jsxRuntime.jsx(
3565
- SGhostButton,
3566
- {
3567
- icon: "sidebar",
3568
- size: "xs",
3569
- intent: color === "dark" ? "inverse" : "default",
3570
- ariaLabel: "toggle navigation",
3571
- ariaPressed: folded,
3572
- onClick: handleFoldToggle,
3573
- className: "ml-auto shrink-0"
3574
- }
3575
- )
3576
- ]
3579
+ children: foldInline ? (
3580
+ // 런처(있을 )·폴드·로고를 흐름에 나란히 둔다 폴드 버튼이 (런처와) 로고 사이에 선다.
3581
+ // 접히면 런처·로고가 페이드하며 흐름에서 빠지고(sideFoldStyle), 폴드 버튼만 남아 레일 가운데에 선다.
3582
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3583
+ onLauncherClick && /* @__PURE__ */ jsxRuntime.jsx(
3584
+ SGhostButton,
3585
+ {
3586
+ icon: "launcher",
3587
+ size: "xs",
3588
+ intent: color === "dark" ? "inverse" : "default",
3589
+ ariaLabel: "app launcher",
3590
+ onClick: onLauncherClick,
3591
+ className: "shrink-0",
3592
+ style: { ...sideFoldStyle, marginRight: "8px" }
3593
+ }
3594
+ ),
3595
+ /* @__PURE__ */ jsxRuntime.jsx(
3596
+ SGhostButton,
3597
+ {
3598
+ icon: "sidebar",
3599
+ size: "xs",
3600
+ intent: color === "dark" ? "inverse" : "default",
3601
+ ariaLabel: "toggle navigation",
3602
+ ariaPressed: folded,
3603
+ onClick: handleFoldToggle,
3604
+ className: "shrink-0"
3605
+ }
3606
+ ),
3607
+ /* @__PURE__ */ jsxRuntime.jsx(
3608
+ "div",
3609
+ {
3610
+ className: "flex shrink-0 items-center",
3611
+ style: { height: H.logoHeight, marginLeft: H.topGap, ...sideFoldStyle },
3612
+ children: logo
3613
+ }
3614
+ )
3615
+ ] })
3616
+ ) : (
3617
+ // 런처·로고는 좌측 그룹(흐름에서 빼 폭 축소 중 폴드 버튼을 밀어내지 않는다),
3618
+ // 폴드 버튼은 우측 끝(ml-auto)이라 폭·패딩이 줄면 저절로 레일 가운데에 선다.
3619
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3620
+ (onLauncherClick || logo) && /* @__PURE__ */ jsxRuntime.jsxs(
3621
+ "div",
3622
+ {
3623
+ className: "absolute inset-y-0 flex items-center",
3624
+ style: {
3625
+ left: H.topPaddingX,
3626
+ gap: H.topGap,
3627
+ opacity: railFolded ? 0 : 1,
3628
+ transition: `opacity ${GNB_FOLD_MS}ms ease-out, ${hideAfterSlide(railFolded)}, transform ${GNB_FOLD_MS}ms ease-out`,
3629
+ // 메뉴와 같은 방향으로 빠지되, 좁은 레일 안에서 꼬리가 비치지 않게 페이드가 거리를 대신한다
3630
+ transform: railFolded ? `translateX(-${H.topPaddingX})` : "none",
3631
+ visibility: railFolded ? "hidden" : "visible"
3632
+ },
3633
+ children: [
3634
+ onLauncherClick && /* @__PURE__ */ jsxRuntime.jsx(
3635
+ SGhostButton,
3636
+ {
3637
+ icon: "launcher",
3638
+ size: "xs",
3639
+ intent: color === "dark" ? "inverse" : "default",
3640
+ ariaLabel: "app launcher",
3641
+ onClick: onLauncherClick,
3642
+ className: "shrink-0"
3643
+ }
3644
+ ),
3645
+ logo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center", style: { height: H.logoHeight }, children: logo })
3646
+ ]
3647
+ }
3648
+ ),
3649
+ /* @__PURE__ */ jsxRuntime.jsx(
3650
+ SGhostButton,
3651
+ {
3652
+ icon: "sidebar",
3653
+ size: "xs",
3654
+ intent: color === "dark" ? "inverse" : "default",
3655
+ ariaLabel: "toggle navigation",
3656
+ ariaPressed: folded,
3657
+ onClick: handleFoldToggle,
3658
+ className: "ml-auto shrink-0"
3659
+ }
3660
+ )
3661
+ ] })
3662
+ )
3577
3663
  }
3578
3664
  ),
3579
3665
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3609,7 +3695,7 @@ var SGnb = react.forwardRef(function SGnb2({
3609
3695
  children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "m-0 flex list-none flex-col p-0", style: { gap: GNB_RAIL.gap }, children: railItems.map(renderRailItem) })
3610
3696
  }
3611
3697
  ),
3612
- /* @__PURE__ */ jsxRuntime.jsx(
3698
+ showMenu && /* @__PURE__ */ jsxRuntime.jsx(
3613
3699
  "nav",
3614
3700
  {
3615
3701
  "aria-label": ariaLabel,
@@ -3619,6 +3705,8 @@ var SGnb = react.forwardRef(function SGnb2({
3619
3705
  paddingTop: M.bodyPaddingY,
3620
3706
  paddingBottom: M.bodyPaddingY,
3621
3707
  backgroundColor: C.panelBg,
3708
+ // full 은 상단바가 전폭이라 루트가 오른쪽 선을 못 그린다 → 메뉴 오른쪽(페이지 경계)이 대신 그린다.
3709
+ borderRight: header === "full" ? rightBorder : void 0,
3622
3710
  pointerEvents: "auto"
3623
3711
  },
3624
3712
  children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "m-0 flex list-none flex-col p-0", children: menuItems.map((item) => renderItem(item, 1)) })