sellmate-design-system-react 9.0.0-beta.12 → 9.0.0-beta.14

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
@@ -3345,7 +3345,11 @@ var SCard = /* @__PURE__ */ forwardRef(function SCard2({ bordered = false, class
3345
3345
  "div",
3346
3346
  {
3347
3347
  ref,
3348
- className: cn("h-fit rounded-[8px] bg-white", bordered && "border border-grey-30", className),
3348
+ className: cn(
3349
+ "h-fit overflow-hidden rounded-[8px] bg-white",
3350
+ bordered && "border border-grey-30",
3351
+ className
3352
+ ),
3349
3353
  ...rest,
3350
3354
  children
3351
3355
  }
@@ -3626,7 +3630,49 @@ var SDraggableItemImpl = /* @__PURE__ */ forwardRef(function SDraggableItem({
3626
3630
  ] });
3627
3631
  });
3628
3632
  var SDraggableItem2 = /* @__PURE__ */ withDisplayName(SDraggableItemImpl, "SDraggableItem");
3633
+ var SDivider = /* @__PURE__ */ forwardRef(function SDivider2({ vertical = false, className, style, ...rest }, ref) {
3634
+ return /* @__PURE__ */ jsx(
3635
+ "hr",
3636
+ {
3637
+ ref,
3638
+ "aria-orientation": vertical ? "vertical" : "horizontal",
3639
+ className: cn(
3640
+ "shrink-0 border-0",
3641
+ vertical ? "inline-block h-auto w-px self-stretch" : "block h-px w-full",
3642
+ className
3643
+ ),
3644
+ style: { backgroundColor: "var(--sys-color-divider-default, #E1E1E1)", ...style },
3645
+ ...rest
3646
+ }
3647
+ );
3648
+ });
3649
+ var dividerStyle = { backgroundColor: "var(--cmp-listItem-border-default)" };
3650
+ function hasBorderedChild(children) {
3651
+ let bordered = false;
3652
+ Children.forEach(children, (child) => {
3653
+ if (!isValidElement(child)) return;
3654
+ if (child.props.bordered === true) {
3655
+ bordered = true;
3656
+ return;
3657
+ }
3658
+ Children.forEach(child.props.children, (wrapped) => {
3659
+ if (isValidElement(wrapped) && wrapped.props.bordered === true) {
3660
+ bordered = true;
3661
+ }
3662
+ });
3663
+ });
3664
+ return bordered;
3665
+ }
3666
+ function withDividers(children) {
3667
+ return Children.toArray(children).flatMap(
3668
+ (child, index) => index === 0 ? [child] : [
3669
+ /* @__PURE__ */ jsx(SDivider, { "aria-hidden": "true", style: dividerStyle }, `s-list-divider-${index}`),
3670
+ child
3671
+ ]
3672
+ );
3673
+ }
3629
3674
  var SListImpl = /* @__PURE__ */ forwardRef(function SList({ className, children, useGap = false, usePadding = false, ...rest }, ref) {
3675
+ const showDivider = !useGap && !hasBorderedChild(children);
3630
3676
  return /* @__PURE__ */ jsx(
3631
3677
  "div",
3632
3678
  {
@@ -3634,11 +3680,10 @@ var SListImpl = /* @__PURE__ */ forwardRef(function SList({ className, children,
3634
3680
  className: cn(
3635
3681
  useGap && "flex flex-col gap-(--cmp-list-group-gap)",
3636
3682
  usePadding && "p-(--cmp-list-group-padding)",
3637
- "[&>*]:border-b [&>*]:border-(--cmp-listItem-border-default)",
3638
3683
  className
3639
3684
  ),
3640
3685
  ...rest,
3641
- children
3686
+ children: showDivider ? withDividers(children) : children
3642
3687
  }
3643
3688
  );
3644
3689
  });
@@ -5353,22 +5398,6 @@ var SSectionHeaderCardRootImpl = /* @__PURE__ */ forwardRef(
5353
5398
  }
5354
5399
  );
5355
5400
  var SSectionHeaderCard2 = /* @__PURE__ */ withDisplayName(SSectionHeaderCardRootImpl, "SSectionHeaderCard");
5356
- var SDivider = /* @__PURE__ */ forwardRef(function SDivider2({ vertical = false, className, style, ...rest }, ref) {
5357
- return /* @__PURE__ */ jsx(
5358
- "hr",
5359
- {
5360
- ref,
5361
- "aria-orientation": vertical ? "vertical" : "horizontal",
5362
- className: cn(
5363
- "shrink-0 border-0",
5364
- vertical ? "inline-block h-auto w-px self-stretch" : "block h-px w-full",
5365
- className
5366
- ),
5367
- style: { backgroundColor: "var(--sys-color-divider-default, #E1E1E1)", ...style },
5368
- ...rest
5369
- }
5370
- );
5371
- });
5372
5401
 
5373
5402
  // src/lib/scrollbar.ts
5374
5403
  var FIREFOX_SCROLLBAR_CLASS = "supports-[not_selector(::-webkit-scrollbar)]:[scrollbar-width:thin] supports-[not_selector(::-webkit-scrollbar)]:[scrollbar-color:var(--color-grey-45)_transparent]";
@@ -5451,7 +5480,7 @@ var SSplitterRoot = /* @__PURE__ */ forwardRef(function SSplitter({
5451
5480
  vertical = false,
5452
5481
  disabled = false,
5453
5482
  dividerClassName,
5454
- dividerStyle,
5483
+ dividerStyle: dividerStyle2,
5455
5484
  className,
5456
5485
  style,
5457
5486
  children,
@@ -5576,7 +5605,7 @@ var SSplitterRoot = /* @__PURE__ */ forwardRef(function SSplitter({
5576
5605
  ),
5577
5606
  style: {
5578
5607
  ...vertical ? { bottom: HIT_END, height: HIT } : { right: HIT_END, width: HIT },
5579
- ...dividerStyle
5608
+ ...dividerStyle2
5580
5609
  },
5581
5610
  children: /* @__PURE__ */ jsx(
5582
5611
  "span",
@@ -8276,6 +8305,29 @@ function findGnbAncestors(items, value) {
8276
8305
  };
8277
8306
  return walk(items, []) ?? [];
8278
8307
  }
8308
+ function findGnbDescendantBranchValues(items, value) {
8309
+ const find = (list) => {
8310
+ for (const item of list) {
8311
+ if (item.value === value) return item;
8312
+ if (item.children) {
8313
+ const found = find(item.children);
8314
+ if (found) return found;
8315
+ }
8316
+ }
8317
+ return void 0;
8318
+ };
8319
+ const collect = (list, acc) => {
8320
+ for (const item of list) {
8321
+ if (item.children && item.children.length > 0) {
8322
+ acc.push(item.value);
8323
+ collect(item.children, acc);
8324
+ }
8325
+ }
8326
+ return acc;
8327
+ };
8328
+ const target = find(items);
8329
+ return target?.children ? collect(target.children, []) : [];
8330
+ }
8279
8331
  var LABEL_TIP_HIDE_DELAY_MS = 100;
8280
8332
  var DEPTH_PADDING_LEFT = (M, depth) => depth === 1 ? M.depth1PaddingLeft : depth === 2 ? M.depth2PaddingLeft : M.depth3PaddingLeft;
8281
8333
  var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
@@ -8316,8 +8368,12 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
8316
8368
  const H = GNB_HEADER[header];
8317
8369
  const M = GNB_MENU[type];
8318
8370
  const C = GNB_COLORS[color];
8371
+ const branchWithDescendants = (key) => [
8372
+ key,
8373
+ ...findGnbDescendantBranchValues(items, key)
8374
+ ];
8319
8375
  const [expandedKeys, setExpandedKeys] = useState(
8320
- () => new Set(findGnbAncestors(items, value))
8376
+ () => new Set(findGnbAncestors(items, value).flatMap(branchWithDescendants))
8321
8377
  );
8322
8378
  const [hoveredKey, setHoveredKey] = useState(null);
8323
8379
  const [labelTip, setLabelTip] = useState(null);
@@ -8364,12 +8420,15 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
8364
8420
  () => findGnbRailValue(items, value) ?? items[0]?.value
8365
8421
  );
8366
8422
  useEffect(() => {
8367
- const ancestors = findGnbAncestors(items, value);
8368
- if (ancestors.length === 0) return;
8423
+ const keys = findGnbAncestors(items, value).flatMap((ancestor) => [
8424
+ ancestor,
8425
+ ...findGnbDescendantBranchValues(items, ancestor)
8426
+ ]);
8427
+ if (keys.length === 0) return;
8369
8428
  setExpandedKeys((prev) => {
8370
- if (ancestors.every((a) => prev.has(a))) return prev;
8429
+ if (keys.every((key) => prev.has(key))) return prev;
8371
8430
  const next = new Set(prev);
8372
- ancestors.forEach((a) => next.add(a));
8431
+ keys.forEach((key) => next.add(key));
8373
8432
  return next;
8374
8433
  });
8375
8434
  }, [items, value]);
@@ -8386,10 +8445,12 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
8386
8445
  setExpandedKeys((prev) => {
8387
8446
  const next = new Set(prev);
8388
8447
  if (next.has(key)) {
8389
- next.delete(key);
8448
+ branchWithDescendants(key).forEach((descendant) => next.delete(descendant));
8390
8449
  } else {
8391
- findGnbSiblingValues(items, key).forEach((sibling) => next.delete(sibling));
8392
- next.add(key);
8450
+ findGnbSiblingValues(items, key).forEach(
8451
+ (sibling) => branchWithDescendants(sibling).forEach((descendant) => next.delete(descendant))
8452
+ );
8453
+ branchWithDescendants(key).forEach((descendant) => next.add(descendant));
8393
8454
  }
8394
8455
  return next;
8395
8456
  });