sellmate-design-system-react 9.0.0-beta.32 → 9.0.0-beta.33

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.js CHANGED
@@ -9242,9 +9242,9 @@ var GNB_RAIL = {
9242
9242
  var GNB_RAIL_WIDTH = 68;
9243
9243
  var GNB_FOLD_MS = 200;
9244
9244
  var GNB_EXPAND_MS = 200;
9245
- var GNB_MENU_WIDTH = 240;
9245
+ var GNB_MENU_WIDTH = 214;
9246
9246
  var GNB_MENU_MIN_WIDTH = 200;
9247
- var GNB_MENU_MAX_WIDTH = 300;
9247
+ var GNB_MENU_MAX_WIDTH = 240;
9248
9248
  var GNB_MENU_RESIZE_KEY_STEP = { normal: 10, large: 50 };
9249
9249
  var clampGnbMenuWidth = (width) => Math.min(GNB_MENU_MAX_WIDTH, Math.max(GNB_MENU_MIN_WIDTH, Math.round(width)));
9250
9250
  var GNB_FULL_LOGO_WIDTH = 140;
@@ -9802,8 +9802,15 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
9802
9802
  "topContent"
9803
9803
  ) : null;
9804
9804
  const systemMenuContext = useMemo(
9805
- () => ({ color, folded: false, placement: "panel", active: !railFolded }),
9806
- [color, railFolded]
9805
+ // 기본 폭보다 줄여 놓은 메뉴 컬럼이면 판에 알린다 — 알림 개수가 점 배지로 줄어든다.
9806
+ () => ({
9807
+ color,
9808
+ folded: false,
9809
+ placement: "panel",
9810
+ active: !railFolded,
9811
+ narrow: menuWidth < GNB_MENU_WIDTH
9812
+ }),
9813
+ [color, railFolded, menuWidth]
9807
9814
  );
9808
9815
  const systemFoldedContext = useMemo(
9809
9816
  () => ({ color, folded: true, placement: "panel", active: true }),
@@ -10070,7 +10077,7 @@ var GNB_SYSTEM_SETTING_LABEL = "\uC124\uC815";
10070
10077
  function TokenIcon3({ name, size }) {
10071
10078
  return /* @__PURE__ */ jsx(SIcon, { name, size: "100%", style: { width: size, height: size } });
10072
10079
  }
10073
- function SystemButton({
10080
+ var SystemButton = /* @__PURE__ */ forwardRef(function SystemButton2({
10074
10081
  color,
10075
10082
  icon,
10076
10083
  label,
@@ -10082,21 +10089,22 @@ function SystemButton({
10082
10089
  dot,
10083
10090
  accentColor,
10084
10091
  stretch,
10085
- buttonRef,
10086
10092
  hasPopup,
10087
10093
  expanded,
10088
- onClick
10089
- }) {
10094
+ onClick,
10095
+ onMouseLeave
10096
+ }, ref) {
10090
10097
  const c = SYSTEM_ACTION_BUTTON_COLOR_CONFIG[color];
10091
10098
  return /* @__PURE__ */ jsxs(
10092
10099
  "button",
10093
10100
  {
10094
- ref: buttonRef,
10101
+ ref,
10095
10102
  type: "button",
10096
10103
  "aria-label": label ? void 0 : ariaLabel,
10097
10104
  "aria-haspopup": hasPopup ? "dialog" : void 0,
10098
10105
  "aria-expanded": hasPopup ? expanded : void 0,
10099
10106
  onClick,
10107
+ onMouseLeave,
10100
10108
  className: cn(
10101
10109
  "group box-border flex cursor-pointer items-center border-none bg-(--gsb-bg) text-(--gsb-text) transition-colors hover:bg-(--gsb-bg-hover)",
10102
10110
  stretch ? "min-w-0 flex-1" : "shrink-0",
@@ -10147,7 +10155,7 @@ function SystemButton({
10147
10155
  ]
10148
10156
  }
10149
10157
  );
10150
- }
10158
+ });
10151
10159
  var SGnbSystem = /* @__PURE__ */ forwardRef(function SGnbSystem2({
10152
10160
  color: colorProp,
10153
10161
  folded: foldedProp,
@@ -10166,6 +10174,7 @@ var SGnbSystem = /* @__PURE__ */ forwardRef(function SGnbSystem2({
10166
10174
  const isTop = placement === "top";
10167
10175
  const folded = !isTop && (foldedProp ?? gnb2?.folded ?? false);
10168
10176
  const active = gnb2?.active ?? true;
10177
+ const narrow = !isTop && !folded && (gnb2?.narrow ?? false);
10169
10178
  const c = GNB_SYSTEM_COLOR_CONFIG[color];
10170
10179
  const t = GNB_SYSTEM_TOP_COLOR_CONFIG[color];
10171
10180
  const itemColor = isTop ? t.item : color;
@@ -10184,13 +10193,39 @@ var SGnbSystem = /* @__PURE__ */ forwardRef(function SGnbSystem2({
10184
10193
  setAccountOpen(next);
10185
10194
  account?.onOpenChange?.(next);
10186
10195
  };
10196
+ const alertButtonRef = useRef(null);
10197
+ const [alertListOpen, setAlertListOpen] = useState(false);
10198
+ const hasAlertList = alert2?.listBox != null;
10199
+ const commitAlertListOpen = (next) => {
10200
+ setAlertListOpen(next);
10201
+ alert2?.onOpenChange?.(next);
10202
+ };
10187
10203
  useEffect(() => {
10188
10204
  if (active || !accountOpen) return;
10189
10205
  setAccountOpen(false);
10190
10206
  account?.onOpenChange?.(false);
10191
10207
  }, [active, accountOpen, account]);
10208
+ useEffect(() => {
10209
+ if (active || !alertListOpen) return;
10210
+ setAlertListOpen(false);
10211
+ alert2?.onOpenChange?.(false);
10212
+ }, [active, alertListOpen, alert2]);
10192
10213
  const alertCount = alert2?.count ?? 0;
10193
10214
  const notified = alertCount > 0;
10215
+ const alertTooltip = (alert2?.tooltip ?? []).filter((line) => line.trim() !== "");
10216
+ const hasAlertTooltip = alertTooltip.length > 0;
10217
+ const [alertTooltipDismissed, setAlertTooltipDismissed] = useState(false);
10218
+ const hadAlertTooltip = useRef(hasAlertTooltip);
10219
+ if (hadAlertTooltip.current !== hasAlertTooltip) {
10220
+ hadAlertTooltip.current = hasAlertTooltip;
10221
+ if (hasAlertTooltip && alertTooltipDismissed) setAlertTooltipDismissed(false);
10222
+ }
10223
+ const alertTooltipOpen = hasAlertTooltip && active && !alertTooltipDismissed;
10224
+ const dismissAlertTooltip = () => {
10225
+ if (!alertTooltipOpen) return;
10226
+ setAlertTooltipDismissed(true);
10227
+ alert2?.onTooltipDismiss?.();
10228
+ };
10194
10229
  const alertLabel = alert2?.label ?? GNB_SYSTEM_ALERT_LABEL;
10195
10230
  const settingLabel = setting?.label ?? GNB_SYSTEM_SETTING_LABEL;
10196
10231
  const alertButton = alert2 && /* @__PURE__ */ jsx(
@@ -10203,13 +10238,51 @@ var SGnbSystem = /* @__PURE__ */ forwardRef(function SGnbSystem2({
10203
10238
  paddingX: GNB_SYSTEM_LAYOUT.alertPaddingX,
10204
10239
  iconColor: notified ? alertIconColor : void 0,
10205
10240
  hoverBg: notified ? alertHoverBg : void 0,
10206
- count: folded ? void 0 : alertCount,
10207
- dot: folded && notified,
10241
+ count: folded || narrow ? void 0 : alertCount,
10242
+ dot: (folded || narrow) && notified,
10208
10243
  accentColor: alertCountColor,
10209
10244
  stretch: !folded && !isTop,
10210
- onClick: alert2.onClick
10245
+ ref: alertButtonRef,
10246
+ hasPopup: hasAlertList,
10247
+ expanded: alertListOpen,
10248
+ onClick: () => {
10249
+ dismissAlertTooltip();
10250
+ alert2.onClick?.();
10251
+ if (hasAlertList) commitAlertListOpen(!alertListOpen);
10252
+ },
10253
+ onMouseLeave: hasAlertTooltip ? dismissAlertTooltip : void 0
10211
10254
  }
10212
10255
  );
10256
+ const alertListBox = alert2 && hasAlertList && /* @__PURE__ */ jsx(
10257
+ SPortal,
10258
+ {
10259
+ open: alertListOpen && active,
10260
+ onClose: () => commitAlertListOpen(false),
10261
+ anchorRef: alertButtonRef,
10262
+ placement: isTop ? "bottom" : "right",
10263
+ align: "end",
10264
+ offset: 8,
10265
+ viewportPadding: 8,
10266
+ ariaLabel: alert2.label ?? GNB_SYSTEM_ALERT_LABEL,
10267
+ onOpenAutoFocus: (event) => event.preventDefault(),
10268
+ className: "rounded-(--radius-8)",
10269
+ children: alert2.listBox
10270
+ }
10271
+ );
10272
+ const alertNode = alertButton && /* @__PURE__ */ jsxs(Fragment, { children: [
10273
+ hasAlertTooltip ? /* @__PURE__ */ jsx(
10274
+ STooltip2,
10275
+ {
10276
+ trigger: "none",
10277
+ open: alertTooltipOpen,
10278
+ message: alertTooltip,
10279
+ tooltipType: color === "light" ? "default" : "accent",
10280
+ placement: isTop ? "bottom" : "right",
10281
+ children: alertButton
10282
+ }
10283
+ ) : alertButton,
10284
+ alertListBox
10285
+ ] });
10213
10286
  const settingButton = setting && /* @__PURE__ */ jsx(
10214
10287
  SystemButton,
10215
10288
  {
@@ -10265,7 +10338,7 @@ var SGnbSystem = /* @__PURE__ */ forwardRef(function SGnbSystem2({
10265
10338
  )
10266
10339
  })
10267
10340
  );
10268
- if (alertButton) segments.push({ key: "alert", node: alertButton });
10341
+ if (alertNode) segments.push({ key: "alert", node: alertNode });
10269
10342
  if (settingButton) segments.push({ key: "setting", node: settingButton });
10270
10343
  if (domainTag || accountButton) {
10271
10344
  segments.push({
@@ -10323,7 +10396,7 @@ var SGnbSystem = /* @__PURE__ */ forwardRef(function SGnbSystem2({
10323
10396
  "data-folded": "",
10324
10397
  ...rest,
10325
10398
  children: [
10326
- alertButton,
10399
+ alertNode,
10327
10400
  account && /* @__PURE__ */ jsx(
10328
10401
  SystemButton,
10329
10402
  {
@@ -10331,7 +10404,7 @@ var SGnbSystem = /* @__PURE__ */ forwardRef(function SGnbSystem2({
10331
10404
  icon: "user",
10332
10405
  ariaLabel: account.label ?? "account",
10333
10406
  paddingX: GNB_SYSTEM_LAYOUT.alertPaddingX,
10334
- buttonRef: foldedAccountRef,
10407
+ ref: foldedAccountRef,
10335
10408
  hasPopup: true,
10336
10409
  expanded: accountOpen,
10337
10410
  onClick: () => {
@@ -10377,7 +10450,7 @@ var SGnbSystem = /* @__PURE__ */ forwardRef(function SGnbSystem2({
10377
10450
  domainTag,
10378
10451
  hasUserBlock && /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
10379
10452
  (alert2 || setting) && /* @__PURE__ */ jsxs("div", { className: "flex items-center", style: { gap: GNB_SYSTEM_LAYOUT.gap }, children: [
10380
- alertButton,
10453
+ alertNode,
10381
10454
  alert2 && setting && /* @__PURE__ */ jsx(
10382
10455
  "span",
10383
10456
  {