sellmate-design-system-react 9.0.0-beta.42 → 9.0.0-beta.43

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.
@@ -13,7 +13,7 @@
13
13
  | `message?` | `SGuideMessage` | `''` | 팝업 메시지 (배열이면 리스트, 중첩 배열이면 depth 표현) |
14
14
  | `url?` | `string` | `''` | notion 타입 클릭 시 이동 URL |
15
15
  | `popupTitle?` | `string` | `''` | 팝업 제목 (없으면 type 기본값) |
16
- | `popupWidth?` | `number` | | 팝업 너비 (px, 기본 426). 창보다 넓게 줘도폭까지만 벌어진다. |
16
+ | `popupWidth?` | `number \| 'auto'` | `'auto'` | 팝업 너비. 기본 `'auto'` 는 내용 폭에 맞춘다 — 가장 긴 줄이 곧 팝업 폭이다. 숫자(px)를 주면 폭으로 고정한다. 어느 쪽이든 좌우에 여백을 남기는 선까지만 벌어진다. |
17
17
  | `className?` | `string` | — | |
18
18
  | `style?` | `CSSProperties` | — | |
19
19
 
@@ -13,8 +13,11 @@ export interface SGuideProps {
13
13
  url?: string;
14
14
  /** 팝업 제목 (없으면 type 기본값) */
15
15
  popupTitle?: string;
16
- /** 팝업 너비 (px, 기본 426). 창보다 넓게 줘도 창 폭까지만 벌어진다. */
17
- popupWidth?: number;
16
+ /**
17
+ * 팝업 너비. 기본 `'auto'` 는 내용 폭에 맞춘다 — 가장 긴 줄이 곧 팝업 폭이다.
18
+ * 숫자(px)를 주면 그 폭으로 고정한다. 어느 쪽이든 창 좌우에 여백을 남기는 선까지만 벌어진다.
19
+ */
20
+ popupWidth?: number | 'auto';
18
21
  className?: string;
19
22
  style?: CSSProperties;
20
23
  }
package/dist/index.cjs CHANGED
@@ -7879,6 +7879,8 @@ var SPopup = /* @__PURE__ */ react.forwardRef(function SPopup2({
7879
7879
  });
7880
7880
  var DEFAULT_LABEL = { tip: "\uD65C\uC6A9 TIP", notion: "\uC0AC\uC6A9\uBC95 \uC548\uB0B4" };
7881
7881
  var ICON = { tip: "helpOutline", notion: "notion" };
7882
+ var VIEWPORT_GUTTER = 24;
7883
+ var CLOSE_INSET = 12;
7882
7884
  function flattenMessages(message, depth = 0) {
7883
7885
  if (Array.isArray(message)) return message.flatMap((m) => flattenMessages(m, depth + 1));
7884
7886
  return message !== "" ? [{ text: message, depth }] : [];
@@ -7889,13 +7891,14 @@ function SGuide({
7889
7891
  message = "",
7890
7892
  url = "",
7891
7893
  popupTitle = "",
7892
- popupWidth,
7894
+ popupWidth = "auto",
7893
7895
  className,
7894
7896
  style
7895
7897
  }) {
7896
7898
  const [open, setOpen] = react.useState(false);
7897
7899
  const portalContainer = usePortalContainer();
7898
7900
  const isNotion = type === "notion";
7901
+ const isAutoWidth = popupWidth === "auto";
7899
7902
  const defaultLabel = DEFAULT_LABEL[type];
7900
7903
  const iconName = ICON[type];
7901
7904
  const messages = flattenMessages(message);
@@ -7935,30 +7938,45 @@ function SGuide({
7935
7938
  side: "bottom",
7936
7939
  align: "start",
7937
7940
  sideOffset: 4,
7941
+ collisionPadding: VIEWPORT_GUTTER,
7938
7942
  className: cn(
7939
7943
  "relative z-50 rounded-[var(--cmp-guide-contents-radius)] bg-[var(--color-white)]",
7940
- // popupWidth(기본 426px)가 창보다 넓으면 창 폭에 맞춘다 — max-width 가 width 를 이긴다.
7941
- "max-w-[var(--radix-popover-content-available-width)]",
7942
7944
  FLOATING_SLIDE_ANIM
7943
7945
  ),
7944
7946
  style: {
7945
- width: popupWidth != null ? popupWidth : 426,
7947
+ width: isAutoWidth ? "max-content" : popupWidth,
7948
+ // 유일한 폭 상한. auto 든 고정 폭이든 창 좌우 여백을 먹고 들어가지 않는다.
7949
+ // 트리거 위치가 아니라 창 기준이라, 오른쪽 끝 트리거에서도 폭이 깎이지 않는다
7950
+ // (넘치면 Radix 가 왼쪽으로 민다). 100vw 는 세로 스크롤바를 포함하지만
7951
+ // 여백이 그보다 넉넉해 화면 밖으로 나가지 않는다.
7952
+ maxWidth: `calc(100vw - ${VIEWPORT_GUTTER * 2}px)`,
7946
7953
  padding: "var(--cmp-guide-contents-paddingY) var(--cmp-guide-contents-paddingX)",
7947
7954
  boxShadow: "4px 4px 24px 4px rgba(0,0,0,0.1)"
7948
7955
  },
7949
7956
  children: [
7950
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-[12px] top-[12px]", children: /* @__PURE__ */ jsxRuntime.jsx(SGhostButton, { icon: "close", size: "sm", ariaLabel: "close", onClick: () => setOpen(false) }) }),
7951
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-[var(--cmp-guide-contents-title-gap)]", children: [
7952
- /* @__PURE__ */ jsxRuntime.jsx(
7953
- SIcon,
7954
- {
7955
- name: iconName,
7956
- size: 24,
7957
- color: isNotion ? "var(--sys-color-fg-primary)" : "var(--cmp-guide-contents-icon)"
7958
- }
7959
- ),
7960
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "m-0 text-[16px] font-bold leading-[26px] text-[color:var(--cmp-guide-contents-typography-color)]", children: popupTitle || defaultLabel })
7961
- ] }),
7957
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute", style: { top: CLOSE_INSET, right: CLOSE_INSET }, children: /* @__PURE__ */ jsxRuntime.jsx(SGhostButton, { icon: "close", size: "sm", ariaLabel: "close", onClick: () => setOpen(false) }) }),
7958
+ /* @__PURE__ */ jsxRuntime.jsxs(
7959
+ "div",
7960
+ {
7961
+ className: "flex items-center gap-[var(--cmp-guide-contents-title-gap)]",
7962
+ style: {
7963
+ // 닫기 버튼은 absolute 라 폭 계산에 안 들어간다. 폭이 내용에 붙는 auto 에서 제목이
7964
+ // 버튼 밑으로 들어가지 않도록, 버튼이 콘텐츠 영역을 침범하는 만큼을 미리 비운다.
7965
+ paddingRight: `max(0px, calc(var(--cmp-ghostButton-sm-size) + ${CLOSE_INSET}px + var(--cmp-guide-contents-title-gap) - var(--cmp-guide-contents-paddingX)))`
7966
+ },
7967
+ children: [
7968
+ /* @__PURE__ */ jsxRuntime.jsx(
7969
+ SIcon,
7970
+ {
7971
+ name: iconName,
7972
+ size: 24,
7973
+ color: isNotion ? "var(--sys-color-fg-primary)" : "var(--cmp-guide-contents-icon)"
7974
+ }
7975
+ ),
7976
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "m-0 break-keep text-[16px] font-bold leading-[26px] text-[color:var(--cmp-guide-contents-typography-color)]", children: popupTitle || defaultLabel })
7977
+ ]
7978
+ }
7979
+ ),
7962
7980
  /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "m-0 mt-[var(--cmp-guide-contents-gap)] flex w-full list-none flex-col gap-[var(--cmp-guide-contents-body-gap)] p-0 text-[12px] leading-[20px] text-[color:var(--cmp-guide-contents-typography-color)]", children: messages.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx(
7963
7981
  "li",
7964
7982
  {
@@ -7969,7 +7987,7 @@ function SGuide({
7969
7987
  children: /* @__PURE__ */ jsxRuntime.jsx(
7970
7988
  "p",
7971
7989
  {
7972
- className: "m-0 w-full min-w-0 break-words",
7990
+ className: "m-0 w-full min-w-0 break-keep break-words text-pretty",
7973
7991
  dangerouslySetInnerHTML: { __html: sanitizeInlineHtml(m.text) }
7974
7992
  }
7975
7993
  )