sellmate-design-system-react 4.3.1 → 5.0.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 (37) hide show
  1. package/AGENTS.md +18 -0
  2. package/README.md +2 -2
  3. package/dist/components/SActionModal/README.md +6 -4
  4. package/dist/components/SActionModal/SActionModal.d.ts +3 -12
  5. package/dist/components/SActionModal/index.d.ts +1 -1
  6. package/dist/components/SButton/README.md +2 -6
  7. package/dist/components/SConfirmModal/README.md +1 -1
  8. package/dist/components/SConfirmModal/SConfirmModal.d.ts +1 -1
  9. package/dist/components/SDrawer/README.md +8 -5
  10. package/dist/components/SDrawer/SDrawer.d.ts +14 -11
  11. package/dist/components/SFooter/README.md +40 -0
  12. package/dist/components/SFooter/SFooter.d.ts +36 -0
  13. package/dist/components/SFooter/index.d.ts +1 -0
  14. package/dist/components/SGhostButton/README.md +2 -2
  15. package/dist/components/SGnb/README.md +0 -5
  16. package/dist/components/SGnb/SGnb.d.ts +6 -2
  17. package/dist/components/SGnb/gnb.config.d.ts +2 -0
  18. package/dist/components/SLayout/README.md +1 -6
  19. package/dist/components/SLayout/SLayout.d.ts +39 -17
  20. package/dist/components/SLoadingModal/README.md +1 -1
  21. package/dist/components/SLoadingModal/SLoadingModal.d.ts +1 -1
  22. package/dist/components/SModalContainer/README.md +1 -1
  23. package/dist/components/SModalContainer/SModalContainer.d.ts +6 -2
  24. package/dist/components/SOverlayHeader/README.md +45 -0
  25. package/dist/components/SOverlayHeader/SOverlayHeader.d.ts +28 -0
  26. package/dist/components/SOverlayHeader/index.d.ts +1 -0
  27. package/dist/components/SPage/SPage.d.ts +2 -2
  28. package/dist/components/SPopup/README.md +2 -2
  29. package/dist/index.cjs +405 -251
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.js +405 -251
  32. package/dist/index.js.map +1 -1
  33. package/dist/lib/isomorphic-layout-effect.d.ts +8 -0
  34. package/dist/llms-full.txt +109 -23
  35. package/dist/llms.txt +18 -0
  36. package/dist/styles.css +27 -17
  37. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5987,6 +5987,53 @@ function SPortal({
5987
5987
  }
5988
5988
  );
5989
5989
  }
5990
+ function SFooter({
5991
+ bg = "white",
5992
+ left,
5993
+ button,
5994
+ children,
5995
+ className,
5996
+ leftClassName,
5997
+ style
5998
+ }) {
5999
+ const isGrey = bg === "grey";
6000
+ const hasSlot = left != null || children != null;
6001
+ const hasButton = button != null;
6002
+ return /* @__PURE__ */ jsxs(
6003
+ "footer",
6004
+ {
6005
+ className: cn(
6006
+ "relative flex w-full flex-shrink-0 items-center justify-end gap-[var(--cmp-overlay-footer-gap)] overflow-hidden px-[var(--cmp-overlay-footer-paddingX)] py-[var(--cmp-overlay-footer-paddingY)] shadow-[var(--shadow-spread-md)]",
6007
+ isGrey ? "bg-[var(--cmp-overlay-footer-bg-neutral)]" : "bg-[var(--cmp-overlay-footer-bg-default)]",
6008
+ className
6009
+ ),
6010
+ style,
6011
+ children: [
6012
+ hasSlot && /* @__PURE__ */ jsxs(
6013
+ "div",
6014
+ {
6015
+ className: cn("flex min-w-px flex-[1_0_0] items-center justify-between", leftClassName),
6016
+ children: [
6017
+ left,
6018
+ children
6019
+ ]
6020
+ }
6021
+ ),
6022
+ hasButton && /* @__PURE__ */ jsx(
6023
+ SButton,
6024
+ {
6025
+ color: button.color ?? "primary",
6026
+ outline: button.outline,
6027
+ size: button.size ?? "md",
6028
+ disabled: button.disabled,
6029
+ onClick: () => button.onClick?.(),
6030
+ label: button.label ?? "\uD655\uC778"
6031
+ }
6032
+ )
6033
+ ]
6034
+ }
6035
+ );
6036
+ }
5990
6037
  var SPopup = /* @__PURE__ */ forwardRef(function SPopup2({
5991
6038
  popupTitle = "",
5992
6039
  type = "default",
@@ -6035,29 +6082,7 @@ var SPopup = /* @__PURE__ */ forwardRef(function SPopup2({
6035
6082
  children
6036
6083
  }
6037
6084
  ),
6038
- useFooter && /* @__PURE__ */ jsxs(
6039
- "footer",
6040
- {
6041
- className: "relative z-[1] flex h-[52px] w-full flex-shrink-0 items-center gap-[var(--cmp-overlay-footer-gap)] px-[var(--cmp-overlay-footer-paddingX)] py-[var(--cmp-overlay-footer-paddingY)]",
6042
- style: {
6043
- background: "var(--cmp-overlay-footer-bg-default)",
6044
- boxShadow: "var(--shadow-spread-md)"
6045
- },
6046
- children: [
6047
- /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center", children: footerLeft }),
6048
- /* @__PURE__ */ jsx(
6049
- SButton,
6050
- {
6051
- color: submitButton?.color ?? "primary",
6052
- outline: submitButton?.outline,
6053
- size: submitButton?.size ?? "md",
6054
- onClick: onSubmit,
6055
- label: submitButton?.label ?? "\uD655\uC778"
6056
- }
6057
- )
6058
- ]
6059
- }
6060
- )
6085
+ useFooter && /* @__PURE__ */ jsx(SFooter, { left: footerLeft, button: { ...submitButton, onClick: onSubmit } })
6061
6086
  ]
6062
6087
  }
6063
6088
  );
@@ -6212,7 +6237,7 @@ function SModalContainer({
6212
6237
  ariaTitle = "\uBAA8\uB2EC",
6213
6238
  showClose = false,
6214
6239
  onClose,
6215
- persistent = false,
6240
+ persistent = true,
6216
6241
  width,
6217
6242
  height,
6218
6243
  children,
@@ -6440,7 +6465,7 @@ function SConfirmModal({
6440
6465
  )) })
6441
6466
  ] })
6442
6467
  ] }),
6443
- /* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 gap-[8px]", children: [
6468
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 gap-[var(--cmp-modal-confirm-button-gap)]", children: [
6444
6469
  subButtonLabel && /* @__PURE__ */ jsx(
6445
6470
  SButton,
6446
6471
  {
@@ -6471,6 +6496,64 @@ function SConfirmModal({
6471
6496
  }
6472
6497
  );
6473
6498
  }
6499
+ function SOverlayHeader({
6500
+ title,
6501
+ description,
6502
+ showClose = false,
6503
+ onClose,
6504
+ reserveCloseSpace = false,
6505
+ className,
6506
+ titleClassName,
6507
+ descriptionClassName,
6508
+ style
6509
+ }) {
6510
+ const hasDescription = description != null && description !== "";
6511
+ return /* @__PURE__ */ jsxs(
6512
+ "header",
6513
+ {
6514
+ className: cn(
6515
+ "relative flex w-full flex-shrink-0 items-center",
6516
+ "gap-[var(--cmp-overlay-header-gap)] bg-[var(--cmp-overlay-header-bg)] py-[var(--cmp-overlay-header-paddingY)] pl-[var(--cmp-overlay-header-paddingX)]",
6517
+ showClose || reserveCloseSpace ? "pr-[calc(var(--cmp-overlay-header-paddingX)+20px)]" : "pr-[var(--cmp-overlay-header-paddingX)]",
6518
+ className
6519
+ ),
6520
+ style,
6521
+ children: [
6522
+ /* @__PURE__ */ jsx(
6523
+ "h2",
6524
+ {
6525
+ className: cn(
6526
+ "m-0 overflow-hidden text-ellipsis whitespace-nowrap",
6527
+ "text-[16px] font-bold leading-[26px]",
6528
+ titleClassName
6529
+ ),
6530
+ style: { color: "var(--cmp-overlay-header-title-color)" },
6531
+ children: title
6532
+ }
6533
+ ),
6534
+ hasDescription && /* @__PURE__ */ jsx(
6535
+ "div",
6536
+ {
6537
+ className: cn(
6538
+ "flex min-w-0 flex-1 items-center gap-sd-2 text-[12px] font-normal leading-[20px] text-[color:var(--color-grey-65)]",
6539
+ descriptionClassName
6540
+ ),
6541
+ children: description
6542
+ }
6543
+ ),
6544
+ showClose && /* @__PURE__ */ jsx(
6545
+ SGhostButton,
6546
+ {
6547
+ icon: "close",
6548
+ ariaLabel: "\uB2EB\uAE30",
6549
+ onClick: () => onClose?.(),
6550
+ className: "absolute right-[12px] top-[12px]"
6551
+ }
6552
+ )
6553
+ ]
6554
+ }
6555
+ );
6556
+ }
6474
6557
  function SActionModal({
6475
6558
  open,
6476
6559
  onOpenChange,
@@ -6497,35 +6580,9 @@ function SActionModal({
6497
6580
  height,
6498
6581
  className: "w-fit min-w-[min(480px,calc(100dvw-48px))] min-h-[min(320px,calc(100dvh-48px))]",
6499
6582
  children: /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-auto flex-col", children: [
6500
- /* @__PURE__ */ jsxs("header", { className: "flex flex-shrink-0 items-center gap-[var(--cmp-overlay-header-gap)] py-[var(--cmp-overlay-header-paddingY)] pl-[var(--cmp-overlay-header-paddingX)] pr-[calc(var(--cmp-overlay-header-paddingX)+20px)]", children: [
6501
- /* @__PURE__ */ jsx("h2", { className: "whitespace-nowrap text-[16px] font-bold leading-[26px] text-[color:var(--cmp-overlay-header-title-color)]", children: modalTitle }),
6502
- description != null && description !== "" && /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center gap-sd-2 text-[12px] font-normal leading-[20px] text-[color:var(--color-grey-65)]", children: description })
6503
- ] }),
6583
+ /* @__PURE__ */ jsx(SOverlayHeader, { title: modalTitle, description, reserveCloseSpace: true }),
6504
6584
  /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-auto px-[var(--cmp-modal-action-body-paddingX)] pb-[var(--cmp-modal-action-body-paddingBottom)]", children }),
6505
- (button || footerLeft) && /* @__PURE__ */ jsxs(
6506
- "footer",
6507
- {
6508
- className: "flex flex-shrink-0 items-center justify-end gap-[var(--cmp-modal-action-footer-gap)] border-t border-solid px-[var(--cmp-modal-action-footer-paddingX)] py-[var(--cmp-modal-action-footer-paddingY)]",
6509
- style: {
6510
- background: "var(--cmp-modal-action-footer-bg)",
6511
- borderTopColor: "var(--cmp-modal-action-footer-border)"
6512
- },
6513
- children: [
6514
- /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center gap-sd-2", children: footerLeft }),
6515
- button && /* @__PURE__ */ jsx(
6516
- SButton,
6517
- {
6518
- color: button.color ?? "primary",
6519
- outline: button.outline,
6520
- size: button.size ?? "md",
6521
- disabled: button.disabled,
6522
- onClick: () => button.onClick?.(),
6523
- label: button.label ?? "\uD655\uC778"
6524
- }
6525
- )
6526
- ]
6527
- }
6528
- )
6585
+ (button || footerLeft) && /* @__PURE__ */ jsx(SFooter, { bg: "grey", left: footerLeft, button })
6529
6586
  ] })
6530
6587
  }
6531
6588
  );
@@ -6594,13 +6651,43 @@ function SLoadingModal({
6594
6651
  );
6595
6652
  }
6596
6653
  var CLOSE_ANIMATION_DURATION2 = 300;
6654
+ function toPx(value, percentBase) {
6655
+ if (typeof value === "number") return value;
6656
+ if (typeof value !== "string") return void 0;
6657
+ const normalized = value.trim();
6658
+ if (normalized.endsWith("px")) {
6659
+ const numeric = Number(normalized.slice(0, -2));
6660
+ return Number.isFinite(numeric) ? numeric : void 0;
6661
+ }
6662
+ if (normalized.endsWith("%")) {
6663
+ const numeric = Number(normalized.slice(0, -1));
6664
+ return Number.isFinite(numeric) ? percentBase * numeric / 100 : void 0;
6665
+ }
6666
+ if (normalized.endsWith("vw")) {
6667
+ const numeric = Number(normalized.slice(0, -2));
6668
+ return Number.isFinite(numeric) ? window.innerWidth * numeric / 100 : void 0;
6669
+ }
6670
+ if (normalized.endsWith("vh")) {
6671
+ const numeric = Number(normalized.slice(0, -2));
6672
+ return Number.isFinite(numeric) ? window.innerHeight * numeric / 100 : void 0;
6673
+ }
6674
+ return void 0;
6675
+ }
6676
+ function clamp3(value, min, max) {
6677
+ const minValue = min ?? Number.NEGATIVE_INFINITY;
6678
+ const maxValue = max ?? Number.POSITIVE_INFINITY;
6679
+ return Math.min(Math.max(value, minValue), maxValue);
6680
+ }
6597
6681
  function SDrawer({
6598
6682
  open,
6599
6683
  onOpenChange,
6600
6684
  onClose,
6601
- persistent = false,
6685
+ persistent = true,
6602
6686
  title = "",
6603
6687
  width = 572,
6688
+ resizable = false,
6689
+ minWidth,
6690
+ maxWidth,
6604
6691
  footerLeft,
6605
6692
  button,
6606
6693
  children,
@@ -6614,7 +6701,13 @@ function SDrawer({
6614
6701
  const backdropPointerDownRef = useRef(false);
6615
6702
  const contentRef = useRef(null);
6616
6703
  const stackRegistrationRef = useRef(null);
6704
+ const resizeCleanupRef = useRef(null);
6705
+ const resizeStateRef = useRef(null);
6617
6706
  const [layerIndex, setLayerIndex] = useState(null);
6707
+ const [currentWidth, setCurrentWidth] = useState(width);
6708
+ useEffect(() => {
6709
+ setCurrentWidth(width);
6710
+ }, [width]);
6618
6711
  useEffect(() => {
6619
6712
  if (open) {
6620
6713
  setRendered(true);
@@ -6624,6 +6717,9 @@ function SDrawer({
6624
6717
  const timer = window.setTimeout(() => setRendered(false), CLOSE_ANIMATION_DURATION2);
6625
6718
  return () => window.clearTimeout(timer);
6626
6719
  }, [open, rendered]);
6720
+ useEffect(() => {
6721
+ return () => resizeCleanupRef.current?.();
6722
+ }, []);
6627
6723
  useEffect(() => {
6628
6724
  if (!open) {
6629
6725
  setEntered(false);
@@ -6665,6 +6761,40 @@ function SDrawer({
6665
6761
  }
6666
6762
  onOpenChange?.(false);
6667
6763
  };
6764
+ const handleResizeStart = (event) => {
6765
+ event.preventDefault();
6766
+ event.stopPropagation();
6767
+ const panel = contentRef.current?.querySelector("[data-s-drawer-panel]");
6768
+ if (!panel) return;
6769
+ resizeStateRef.current = {
6770
+ startX: event.clientX,
6771
+ startWidth: panel.getBoundingClientRect().width,
6772
+ minWidth: toPx(minWidth, window.innerWidth),
6773
+ maxWidth: toPx(maxWidth, window.innerWidth)
6774
+ };
6775
+ const onMove = (moveEvent) => {
6776
+ const resizeState = resizeStateRef.current;
6777
+ if (!resizeState) return;
6778
+ const nextWidth = resizeState.startWidth + resizeState.startX - moveEvent.clientX;
6779
+ setCurrentWidth(clamp3(nextWidth, resizeState.minWidth, resizeState.maxWidth));
6780
+ };
6781
+ resizeCleanupRef.current?.();
6782
+ const previousCursor = document.body.style.cursor;
6783
+ const previousUserSelect = document.body.style.userSelect;
6784
+ const cleanupResize = () => {
6785
+ resizeStateRef.current = null;
6786
+ document.body.style.cursor = previousCursor;
6787
+ document.body.style.userSelect = previousUserSelect;
6788
+ document.removeEventListener("mousemove", onMove);
6789
+ document.removeEventListener("mouseup", cleanupResize);
6790
+ resizeCleanupRef.current = null;
6791
+ };
6792
+ resizeCleanupRef.current = cleanupResize;
6793
+ document.body.style.cursor = "col-resize";
6794
+ document.body.style.userSelect = "none";
6795
+ document.addEventListener("mousemove", onMove);
6796
+ document.addEventListener("mouseup", cleanupResize);
6797
+ };
6668
6798
  const modalHost = getModalHost();
6669
6799
  return /* @__PURE__ */ jsx(RDialog.Root, { open, onOpenChange, children: /* @__PURE__ */ jsx(RDialog.Portal, { container: modalHost, forceMount: rendered ? true : void 0, children: /* @__PURE__ */ jsxs("div", { className: "pointer-events-none absolute inset-0", style: { zIndex: layerIndex ?? 0 }, children: [
6670
6800
  /* @__PURE__ */ jsx(
@@ -6694,7 +6824,7 @@ function SDrawer({
6694
6824
  {
6695
6825
  forceMount: rendered ? true : void 0,
6696
6826
  ref: contentRef,
6697
- className: "pointer-events-auto absolute inset-y-0 right-0 w-fit max-w-full outline-none",
6827
+ className: "pointer-events-none absolute inset-y-0 right-0 flex w-fit max-w-full justify-end outline-none",
6698
6828
  onOpenAutoFocus: (event) => {
6699
6829
  event.preventDefault();
6700
6830
  contentRef.current?.focus({ preventScroll: true });
@@ -6712,42 +6842,35 @@ function SDrawer({
6712
6842
  shaking && "animate-drawer-shake",
6713
6843
  className
6714
6844
  ),
6845
+ "data-s-drawer-panel": true,
6715
6846
  "data-state": open && entered ? "open" : "closed",
6716
- style: { width, ...style },
6847
+ style: { width: currentWidth, minWidth, maxWidth, ...style },
6717
6848
  onAnimationEnd: (event) => {
6718
6849
  if (event.animationName === "drawer-shake") setShaking(false);
6719
6850
  },
6720
6851
  children: [
6721
- /* @__PURE__ */ jsxs("header", { className: "relative flex flex-shrink-0 items-center gap-[var(--cmp-overlay-header-gap)] bg-[var(--cmp-overlay-header-bg)] px-[var(--cmp-overlay-header-paddingX)] py-[var(--cmp-overlay-header-paddingY)]", children: [
6722
- /* @__PURE__ */ jsx("h2", { className: "m-0 whitespace-nowrap text-[16px] font-bold leading-[26px] text-[color:var(--cmp-overlay-header-title-color)]", children: title }),
6723
- /* @__PURE__ */ jsx(
6724
- SGhostButton,
6725
- {
6726
- icon: "close",
6727
- ariaLabel: "\uB2EB\uAE30",
6728
- onClick: () => {
6729
- onClose?.();
6730
- onOpenChange?.(false);
6731
- },
6732
- className: "absolute right-[12px] top-[12px]"
6852
+ resizable && /* @__PURE__ */ jsx(
6853
+ "button",
6854
+ {
6855
+ type: "button",
6856
+ "aria-label": "Drawer \uB108\uBE44 \uC870\uC808",
6857
+ className: "absolute inset-y-0 left-0 z-[1] w-[8px] -translate-x-1/2 cursor-col-resize touch-none border-0 bg-transparent p-0",
6858
+ onMouseDown: handleResizeStart
6859
+ }
6860
+ ),
6861
+ /* @__PURE__ */ jsx(
6862
+ SOverlayHeader,
6863
+ {
6864
+ title,
6865
+ showClose: true,
6866
+ onClose: () => {
6867
+ onClose?.();
6868
+ onOpenChange?.(false);
6733
6869
  }
6734
- )
6735
- ] }),
6870
+ }
6871
+ ),
6736
6872
  /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-auto border-t border-solid border-[color:var(--cmp-drawer-body-border)]", children: /* @__PURE__ */ jsx(InsideModalProvider, { value: true, children: /* @__PURE__ */ jsx(PortalContainerProvider, { value: portalContainer, children }) }) }),
6737
- (button || footerLeft) && /* @__PURE__ */ jsxs("footer", { className: "flex flex-shrink-0 items-center justify-end gap-[var(--cmp-overlay-footer-gap)] bg-[var(--cmp-overlay-footer-bg-default)] px-[var(--cmp-overlay-footer-paddingX)] py-[var(--cmp-overlay-footer-paddingY)] shadow-[var(--shadow-overlay)]", children: [
6738
- /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center justify-between", children: footerLeft }),
6739
- button && /* @__PURE__ */ jsx(
6740
- SButton,
6741
- {
6742
- color: button.color ?? "primary",
6743
- outline: button.outline,
6744
- size: button.size ?? "md",
6745
- disabled: button.disabled,
6746
- onClick: () => button.onClick?.(),
6747
- label: button.label ?? "\uD655\uC778"
6748
- }
6749
- )
6750
- ] })
6873
+ (button || footerLeft) && /* @__PURE__ */ jsx(SFooter, { left: footerLeft, leftClassName: "justify-between", button })
6751
6874
  ]
6752
6875
  }
6753
6876
  ),
@@ -7002,6 +7125,80 @@ var SModal = {
7002
7125
  return mount((refImpl) => /* @__PURE__ */ jsx(CreateMount, { options, refImpl }));
7003
7126
  }
7004
7127
  };
7128
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
7129
+ var isSameNav = (a, b) => a === b || !!a && !!b && a.columnWidth === b.columnWidth && a.topHeight === b.topHeight && a.foldMs === b.foldMs && a.requireFullHeader === b.requireFullHeader;
7130
+ var SLayoutContext = /* @__PURE__ */ createContext(null);
7131
+ function useSLayout() {
7132
+ const ctx = useContext(SLayoutContext);
7133
+ if (!ctx) throw new Error("useSLayout \uC740 <SLayout> \uC548\uC5D0\uC11C\uB9CC \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.");
7134
+ return ctx;
7135
+ }
7136
+ var SLayout = /* @__PURE__ */ forwardRef(function SLayout2({
7137
+ type = "box",
7138
+ header = "fix",
7139
+ useRail = false,
7140
+ folded,
7141
+ defaultFolded = false,
7142
+ onFoldedChange,
7143
+ className,
7144
+ style,
7145
+ children,
7146
+ ...rest
7147
+ }, ref) {
7148
+ const [uncontrolledFolded, setUncontrolledFolded] = useState(defaultFolded);
7149
+ const isControlled = folded !== void 0;
7150
+ const currentFolded = isControlled ? folded : uncontrolledFolded;
7151
+ const setFolded = useCallback(
7152
+ (next) => {
7153
+ if (!isControlled) setUncontrolledFolded(next);
7154
+ onFoldedChange?.(next);
7155
+ },
7156
+ [isControlled, onFoldedChange]
7157
+ );
7158
+ const [nav, setNav] = useState(null);
7159
+ const registerNav = useCallback(
7160
+ (next) => setNav((prev) => isSameNav(prev, next) ? prev : next),
7161
+ []
7162
+ );
7163
+ const effectiveHeader = header === "full" || nav?.requireFullHeader ? "full" : "fix";
7164
+ const ctx = useMemo(
7165
+ () => ({
7166
+ type,
7167
+ header: effectiveHeader,
7168
+ useRail,
7169
+ folded: currentFolded,
7170
+ setFolded,
7171
+ registerNav
7172
+ }),
7173
+ [type, effectiveHeader, useRail, currentFolded, setFolded, registerNav]
7174
+ );
7175
+ const isFullHeader = effectiveHeader === "full";
7176
+ const frameStyle = isFullHeader ? {
7177
+ // 자식이 좌표가 아니라 이름으로 자리를 잡게 한다 — 열·행이 늘어도 자식을 고칠 일이 없다.
7178
+ gridTemplateAreas: '"header header" "nav page"',
7179
+ gridTemplateColumns: `${currentFolded ? 0 : nav?.columnWidth ?? 0}px 1fr`,
7180
+ gridTemplateRows: `${nav?.topHeight ?? "0px"} 1fr`,
7181
+ // 메뉴가 미끄러지는 동안 페이지 열도 같은 길이로 따라와야 한 덩어리로 읽힌다.
7182
+ // (fix 는 SGnb 가 제 폭을 직접 전환하므로 프레임이 손댈 게 없다)
7183
+ transition: `grid-template-columns ${nav?.foldMs ?? 0}ms ease-out`
7184
+ } : void 0;
7185
+ return /* @__PURE__ */ jsx(SLayoutContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
7186
+ "div",
7187
+ {
7188
+ ref,
7189
+ "data-type": type,
7190
+ "data-header": effectiveHeader,
7191
+ className: cn(
7192
+ "box-border h-full overflow-hidden",
7193
+ isFullHeader ? "grid" : "flex flex-row",
7194
+ className
7195
+ ),
7196
+ style: { ...frameStyle, ...style },
7197
+ ...rest,
7198
+ children
7199
+ }
7200
+ ) });
7201
+ });
7005
7202
 
7006
7203
  // src/components/SGnb/gnb.config.ts
7007
7204
  var gnb = (p) => `var(--cmp-gnb-${p})`;
@@ -7134,6 +7331,21 @@ function findGnbRailValue(items, value) {
7134
7331
  if (items.some((item) => item.value === value)) return value;
7135
7332
  return findGnbAncestors(items, value)[0];
7136
7333
  }
7334
+ function findGnbSiblingValues(items, value) {
7335
+ const walk = (list) => {
7336
+ if (list.some((item) => item.value === value)) {
7337
+ return list.filter((item) => item.value !== value).map((item) => item.value);
7338
+ }
7339
+ for (const item of list) {
7340
+ if (item.children) {
7341
+ const found = walk(item.children);
7342
+ if (found) return found;
7343
+ }
7344
+ }
7345
+ return null;
7346
+ };
7347
+ return walk(items) ?? [];
7348
+ }
7137
7349
  function findGnbAncestors(items, value) {
7138
7350
  const walk = (list, trail) => {
7139
7351
  for (const item of list) {
@@ -7147,79 +7359,6 @@ function findGnbAncestors(items, value) {
7147
7359
  };
7148
7360
  return walk(items, []) ?? [];
7149
7361
  }
7150
- var SLayoutContext = /* @__PURE__ */ createContext(null);
7151
- function useSLayout() {
7152
- const ctx = useContext(SLayoutContext);
7153
- if (!ctx) throw new Error("useSLayout \uC740 <SLayout> \uC548\uC5D0\uC11C\uB9CC \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.");
7154
- return ctx;
7155
- }
7156
- var SLayout = /* @__PURE__ */ forwardRef(function SLayout2({
7157
- type = "box",
7158
- header = "fix",
7159
- useRail = false,
7160
- folded,
7161
- defaultFolded = false,
7162
- onFoldedChange,
7163
- className,
7164
- style,
7165
- children,
7166
- ...rest
7167
- }, ref) {
7168
- const [uncontrolledFolded, setUncontrolledFolded] = useState(defaultFolded);
7169
- const isControlled = folded !== void 0;
7170
- const currentFolded = isControlled ? folded : uncontrolledFolded;
7171
- const setFolded = useCallback(
7172
- (next) => {
7173
- if (!isControlled) setUncontrolledFolded(next);
7174
- onFoldedChange?.(next);
7175
- },
7176
- [isControlled, onFoldedChange]
7177
- );
7178
- const [gnbState, setGnbState] = useState({ forceFull: false, menuVisible: true });
7179
- const reportGnbState = useCallback(
7180
- (next) => setGnbState(
7181
- (prev) => prev.forceFull === next.forceFull && prev.menuVisible === next.menuVisible ? prev : next
7182
- ),
7183
- []
7184
- );
7185
- const effectiveHeader = header === "full" || gnbState.forceFull ? "full" : "fix";
7186
- const ctx = useMemo(
7187
- () => ({
7188
- type,
7189
- header: effectiveHeader,
7190
- useRail,
7191
- folded: currentFolded,
7192
- setFolded,
7193
- reportGnbState
7194
- }),
7195
- [type, effectiveHeader, useRail, currentFolded, setFolded, reportGnbState]
7196
- );
7197
- const isFullHeader = effectiveHeader === "full";
7198
- const gnbColumnWidth = (useRail ? GNB_RAIL_WIDTH : 0) + (gnbState.menuVisible ? GNB_MENU_WIDTH : 0);
7199
- const frameStyle = isFullHeader ? {
7200
- gridTemplateColumns: `${currentFolded ? 0 : gnbColumnWidth}px 1fr`,
7201
- gridTemplateRows: `${GNB_HEADER[effectiveHeader].topHeight} 1fr`,
7202
- // 메뉴가 미끄러지는 동안 페이지 열도 같은 길이로 따라와야 한 덩어리로 읽힌다.
7203
- // (fix 는 SGnb 가 제 폭을 직접 전환하므로 프레임이 손댈 게 없다)
7204
- transition: `grid-template-columns ${GNB_FOLD_MS}ms ease-out`
7205
- } : void 0;
7206
- return /* @__PURE__ */ jsx(SLayoutContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
7207
- "div",
7208
- {
7209
- ref,
7210
- "data-type": type,
7211
- "data-header": effectiveHeader,
7212
- className: cn(
7213
- "box-border h-full overflow-hidden",
7214
- isFullHeader ? "grid" : "flex flex-row",
7215
- className
7216
- ),
7217
- style: { ...frameStyle, ...style },
7218
- ...rest,
7219
- children
7220
- }
7221
- ) });
7222
- });
7223
7362
  var DEPTH_PADDING_LEFT = (M, depth) => depth === 1 ? M.depth1PaddingLeft : depth === 2 ? M.depth2PaddingLeft : M.depth3PaddingLeft;
7224
7363
  var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
7225
7364
  type: typeProp,
@@ -7281,8 +7420,12 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
7281
7420
  const toggleExpand = (key) => {
7282
7421
  setExpandedKeys((prev) => {
7283
7422
  const next = new Set(prev);
7284
- if (next.has(key)) next.delete(key);
7285
- else next.add(key);
7423
+ if (next.has(key)) {
7424
+ next.delete(key);
7425
+ } else {
7426
+ findGnbSiblingValues(items, key).forEach((sibling) => next.delete(sibling));
7427
+ next.add(key);
7428
+ }
7286
7429
  return next;
7287
7430
  });
7288
7431
  };
@@ -7453,16 +7596,30 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
7453
7596
  const menuItems = useRail ? items.find((item) => item.value === activeRail)?.children ?? [] : items;
7454
7597
  const showMenu = !useRail || menuItems.length > 0;
7455
7598
  const bodyWidth = (useRail ? GNB_RAIL_WIDTH : 0) + (showMenu ? GNB_MENU_WIDTH : 0);
7456
- useEffect(() => {
7457
- layout?.reportGnbState({ forceFull: railHasLeaf, menuVisible: showMenu });
7458
- }, [layout, railHasLeaf, showMenu]);
7599
+ const registerNav = layout?.registerNav;
7600
+ useIsomorphicLayoutEffect(() => {
7601
+ if (!registerNav) return;
7602
+ registerNav({
7603
+ columnWidth: bodyWidth,
7604
+ topHeight: H.topHeight,
7605
+ foldMs: GNB_FOLD_MS,
7606
+ requireFullHeader: railHasLeaf
7607
+ });
7608
+ return () => registerNav(null);
7609
+ }, [registerNav, bodyWidth, H.topHeight, railHasLeaf]);
7459
7610
  const railFolded = folded && header === "fix";
7460
- const rootWidth = header === "full" ? "100%" : folded ? GNB_COMMON.foldWidth : bodyWidth;
7611
+ const isFull = header === "full";
7612
+ const isFullFrame = isFull && !!layout;
7461
7613
  const rightBorder = color === "light" ? `1px solid ${C.topBorder}` : void 0;
7462
- const rootStyle = {
7463
- width: rootWidth,
7614
+ const rootStyle = isFullFrame ? { display: "contents", ...style } : isFull ? (
7615
+ // 단독 full — 상단바가 전폭이어야 하므로 루트도 전폭이고, 배경·선은 상단바·메뉴가 각자 그린다.
7616
+ { width: "100%", ...style }
7617
+ ) : {
7618
+ // fix 를 닫으면 48px 레일로 좁혀진다.
7619
+ width: folded ? GNB_COMMON.foldWidth : bodyWidth,
7464
7620
  transition: `width ${GNB_FOLD_MS}ms ease-out`,
7465
- ...header === "full" ? { gridArea: "1 / 1 / -1 / -1", pointerEvents: "none" } : { backgroundColor: C.panelBg, borderRight: rightBorder },
7621
+ backgroundColor: C.panelBg,
7622
+ borderRight: rightBorder,
7466
7623
  ...style
7467
7624
  };
7468
7625
  const hideAfterSlide = (hidden) => `visibility 0s linear ${hidden ? `${GNB_FOLD_MS}ms` : "0s"}`;
@@ -7535,7 +7692,11 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
7535
7692
  "div",
7536
7693
  {
7537
7694
  ref,
7538
- className: cn("box-border flex h-full shrink-0 flex-col overflow-hidden", className),
7695
+ className: cn(
7696
+ "box-border",
7697
+ !isFullFrame && "flex h-full shrink-0 flex-col overflow-hidden",
7698
+ className
7699
+ ),
7539
7700
  style: rootStyle,
7540
7701
  "data-type": type,
7541
7702
  "data-header": header,
@@ -7547,6 +7708,7 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
7547
7708
  {
7548
7709
  className: "relative box-border flex shrink-0 items-center overflow-hidden",
7549
7710
  style: {
7711
+ ...isFullFrame ? { gridArea: "header" } : null,
7550
7712
  height: H.topHeight,
7551
7713
  // 간격은 컨테이너 gap 대신 각 요소 margin 으로 준다 — 순서가 header 마다 달라
7552
7714
  // 이웃 쌍마다 값이 다르기 때문(위 launcherButton/logoBox 주석).
@@ -7554,7 +7716,6 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
7554
7716
  padding: `0 ${railFolded ? GNB_RAIL.padding : H.topPaddingX}`,
7555
7717
  borderBottom: `1px solid ${C.topBorder}`,
7556
7718
  backgroundColor: C.panelBg,
7557
- pointerEvents: "auto",
7558
7719
  transition: `padding ${GNB_FOLD_MS}ms ease-out`,
7559
7720
  // 아이콘 버튼은 자체 ghostButton 토큰을 쓰므로, 이 색은 logo 슬롯 상속용
7560
7721
  color: C.itemColorDefault
@@ -7571,94 +7732,87 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
7571
7732
  ] })
7572
7733
  }
7573
7734
  ),
7574
- /* @__PURE__ */ jsxs(
7735
+ /* @__PURE__ */ jsx(
7575
7736
  "div",
7576
7737
  {
7577
- className: "flex flex-row",
7578
- style: {
7579
- width: bodyWidth,
7580
- alignSelf: "flex-start",
7581
- flexGrow: 1,
7582
- flexShrink: 1,
7583
- flexBasis: "auto",
7584
- minHeight: 0,
7585
- transform: folded ? "translateX(-100%)" : "none",
7586
- visibility: folded ? "hidden" : "visible",
7587
- transition: `transform ${GNB_FOLD_MS}ms ease-out, ${hideAfterSlide(folded)}`
7588
- },
7589
- children: [
7590
- useRail && // 레일 컬럼 — 스크롤되는 아이템 목록(nav)과 하단 고정 footer 를 한 컬럼에 담는다.
7591
- // footer 는 내비게이션이 아니므로 nav(landmark) 밖에 두고, 컬럼 폭·구분선·배경은 이 래퍼가
7592
- // 전체 높이에 걸쳐 책임진다(그래야 footer 자리까지 배경·오른쪽 선이 이어진다).
7593
- /* @__PURE__ */ jsxs(
7594
- "div",
7595
- {
7596
- className: "flex shrink-0 flex-col overflow-hidden",
7597
- style: {
7598
- width: GNB_RAIL_WIDTH,
7599
- borderRight: `1px solid ${C.topBorder}`,
7600
- backgroundColor: C.panelBg,
7601
- pointerEvents: "auto"
7602
- },
7603
- children: [
7604
- /* @__PURE__ */ jsx(
7605
- "nav",
7606
- {
7607
- "aria-label": `${ariaLabel} rail`,
7608
- className: cn(
7609
- "flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto",
7610
- SCROLLBAR_HIDDEN_CLASS
7738
+ className: cn("overflow-hidden", !isFullFrame && "min-h-0 flex-1"),
7739
+ style: isFullFrame ? { gridArea: "nav" } : void 0,
7740
+ children: /* @__PURE__ */ jsxs(
7741
+ "div",
7742
+ {
7743
+ className: "flex h-full flex-row",
7744
+ style: {
7745
+ width: bodyWidth,
7746
+ transform: folded ? "translateX(-100%)" : "none",
7747
+ visibility: folded ? "hidden" : "visible",
7748
+ transition: `transform ${GNB_FOLD_MS}ms ease-out, ${hideAfterSlide(folded)}`
7749
+ },
7750
+ children: [
7751
+ useRail && // 레일 컬럼 — 스크롤되는 아이템 목록(nav)과 하단 고정 footer 를 한 컬럼에 담는다.
7752
+ // footer 는 내비게이션이 아니므로 nav(landmark) 밖에 두고, 컬럼 폭·구분선·배경은 이 래퍼가
7753
+ // 전체 높이에 걸쳐 책임진다(그래야 footer 자리까지 배경·오른쪽 선이 이어진다).
7754
+ /* @__PURE__ */ jsxs(
7755
+ "div",
7756
+ {
7757
+ className: "flex shrink-0 flex-col overflow-hidden",
7758
+ style: {
7759
+ width: GNB_RAIL_WIDTH,
7760
+ borderRight: `1px solid ${C.topBorder}`,
7761
+ backgroundColor: C.panelBg
7762
+ },
7763
+ children: [
7764
+ /* @__PURE__ */ jsx(
7765
+ "nav",
7766
+ {
7767
+ "aria-label": `${ariaLabel} rail`,
7768
+ className: cn(
7769
+ "flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto",
7770
+ SCROLLBAR_HIDDEN_CLASS
7771
+ ),
7772
+ style: { padding: GNB_RAIL.padding },
7773
+ children: /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col p-0", style: { gap: GNB_RAIL.gap }, children: railItems.map(renderRailItem) })
7774
+ }
7611
7775
  ),
7612
- style: { padding: GNB_RAIL.padding },
7613
- children: /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col p-0", style: { gap: GNB_RAIL.gap }, children: railItems.map(renderRailItem) })
7614
- }
7615
- ),
7616
- railFooter && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: railFooter })
7617
- ]
7618
- }
7619
- ),
7620
- showMenu && /* @__PURE__ */ jsxs(
7621
- "div",
7622
- {
7623
- className: "flex shrink-0 flex-col overflow-hidden",
7624
- style: {
7625
- width: GNB_MENU_WIDTH,
7626
- backgroundColor: C.panelBg,
7627
- // full 상단바가 전폭이라 루트가 오른쪽 선을 못 그린다 → 메뉴 오른쪽(페이지 경계)이 대신 그린다.
7628
- borderRight: header === "full" ? rightBorder : void 0,
7629
- pointerEvents: "auto"
7630
- },
7631
- children: [
7632
- /* @__PURE__ */ jsx(
7633
- "nav",
7634
- {
7635
- "aria-label": ariaLabel,
7636
- className: cn(
7637
- "flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto",
7638
- SCROLLBAR_HIDDEN_CLASS
7776
+ railFooter && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: railFooter })
7777
+ ]
7778
+ }
7779
+ ),
7780
+ showMenu && /* @__PURE__ */ jsxs(
7781
+ "div",
7782
+ {
7783
+ className: "flex shrink-0 flex-col overflow-hidden",
7784
+ style: {
7785
+ width: GNB_MENU_WIDTH,
7786
+ backgroundColor: C.panelBg,
7787
+ // full 루트가 오른쪽 선을 못 그리므로(전폭이거나 아예 없다) 메뉴 오른쪽(페이지 경계)이 대신 그린다.
7788
+ borderRight: isFull ? rightBorder : void 0
7789
+ },
7790
+ children: [
7791
+ /* @__PURE__ */ jsx(
7792
+ "nav",
7793
+ {
7794
+ "aria-label": ariaLabel,
7795
+ className: cn(
7796
+ "flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto",
7797
+ SCROLLBAR_HIDDEN_CLASS
7798
+ ),
7799
+ style: {
7800
+ paddingTop: M.bodyPaddingY,
7801
+ paddingBottom: M.bodyPaddingY
7802
+ },
7803
+ children: /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col p-0", children: menuItems.map((item) => renderItem(item, 1)) })
7804
+ }
7639
7805
  ),
7640
- style: {
7641
- paddingTop: M.bodyPaddingY,
7642
- paddingBottom: M.bodyPaddingY
7643
- },
7644
- children: /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col p-0", children: menuItems.map((item) => renderItem(item, 1)) })
7645
- }
7646
- ),
7647
- menuFooter && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: menuFooter })
7648
- ]
7649
- }
7650
- )
7651
- ]
7806
+ menuFooter && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: menuFooter })
7807
+ ]
7808
+ }
7809
+ )
7810
+ ]
7811
+ }
7812
+ )
7652
7813
  }
7653
7814
  ),
7654
- railFolded && foldedFooter && /* @__PURE__ */ jsx(
7655
- "div",
7656
- {
7657
- className: "flex shrink-0 items-center justify-center mb-[24px]",
7658
- style: { pointerEvents: "auto" },
7659
- children: foldedFooter
7660
- }
7661
- )
7815
+ railFolded && foldedFooter && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center justify-center mb-[24px]", children: foldedFooter })
7662
7816
  ]
7663
7817
  }
7664
7818
  );
@@ -7670,7 +7824,7 @@ var BACKGROUND_CLASS = {
7670
7824
  };
7671
7825
  var SPage = /* @__PURE__ */ forwardRef(function SPage2({ background = "frame", className, style, children, ...rest }, ref) {
7672
7826
  const layout = useContext(SLayoutContext);
7673
- const gridStyle = layout?.header === "full" ? { gridColumn: 2, gridRow: 2 } : void 0;
7827
+ const gridStyle = layout?.header === "full" ? { gridArea: "page" } : void 0;
7674
7828
  return /* @__PURE__ */ jsx(
7675
7829
  "main",
7676
7830
  {