sellmate-design-system-react 9.0.0-beta.13 → 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/components/SCard/SCard.d.ts +1 -1
- package/dist/components/SGnb/gnb.config.d.ts +5 -0
- package/dist/index.cjs +45 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -9
- package/dist/index.js.map +1 -1
- package/dist/styles.css +21 -0
- package/package.json +1 -1
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(
|
|
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
|
}
|
|
@@ -8301,6 +8305,29 @@ function findGnbAncestors(items, value) {
|
|
|
8301
8305
|
};
|
|
8302
8306
|
return walk(items, []) ?? [];
|
|
8303
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
|
+
}
|
|
8304
8331
|
var LABEL_TIP_HIDE_DELAY_MS = 100;
|
|
8305
8332
|
var DEPTH_PADDING_LEFT = (M, depth) => depth === 1 ? M.depth1PaddingLeft : depth === 2 ? M.depth2PaddingLeft : M.depth3PaddingLeft;
|
|
8306
8333
|
var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
|
|
@@ -8341,8 +8368,12 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
|
|
|
8341
8368
|
const H = GNB_HEADER[header];
|
|
8342
8369
|
const M = GNB_MENU[type];
|
|
8343
8370
|
const C = GNB_COLORS[color];
|
|
8371
|
+
const branchWithDescendants = (key) => [
|
|
8372
|
+
key,
|
|
8373
|
+
...findGnbDescendantBranchValues(items, key)
|
|
8374
|
+
];
|
|
8344
8375
|
const [expandedKeys, setExpandedKeys] = useState(
|
|
8345
|
-
() => new Set(findGnbAncestors(items, value))
|
|
8376
|
+
() => new Set(findGnbAncestors(items, value).flatMap(branchWithDescendants))
|
|
8346
8377
|
);
|
|
8347
8378
|
const [hoveredKey, setHoveredKey] = useState(null);
|
|
8348
8379
|
const [labelTip, setLabelTip] = useState(null);
|
|
@@ -8389,12 +8420,15 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
|
|
|
8389
8420
|
() => findGnbRailValue(items, value) ?? items[0]?.value
|
|
8390
8421
|
);
|
|
8391
8422
|
useEffect(() => {
|
|
8392
|
-
const
|
|
8393
|
-
|
|
8423
|
+
const keys = findGnbAncestors(items, value).flatMap((ancestor) => [
|
|
8424
|
+
ancestor,
|
|
8425
|
+
...findGnbDescendantBranchValues(items, ancestor)
|
|
8426
|
+
]);
|
|
8427
|
+
if (keys.length === 0) return;
|
|
8394
8428
|
setExpandedKeys((prev) => {
|
|
8395
|
-
if (
|
|
8429
|
+
if (keys.every((key) => prev.has(key))) return prev;
|
|
8396
8430
|
const next = new Set(prev);
|
|
8397
|
-
|
|
8431
|
+
keys.forEach((key) => next.add(key));
|
|
8398
8432
|
return next;
|
|
8399
8433
|
});
|
|
8400
8434
|
}, [items, value]);
|
|
@@ -8411,10 +8445,12 @@ var SGnb = /* @__PURE__ */ forwardRef(function SGnb2({
|
|
|
8411
8445
|
setExpandedKeys((prev) => {
|
|
8412
8446
|
const next = new Set(prev);
|
|
8413
8447
|
if (next.has(key)) {
|
|
8414
|
-
next.delete(
|
|
8448
|
+
branchWithDescendants(key).forEach((descendant) => next.delete(descendant));
|
|
8415
8449
|
} else {
|
|
8416
|
-
findGnbSiblingValues(items, key).forEach(
|
|
8417
|
-
|
|
8450
|
+
findGnbSiblingValues(items, key).forEach(
|
|
8451
|
+
(sibling) => branchWithDescendants(sibling).forEach((descendant) => next.delete(descendant))
|
|
8452
|
+
);
|
|
8453
|
+
branchWithDescendants(key).forEach((descendant) => next.add(descendant));
|
|
8418
8454
|
}
|
|
8419
8455
|
return next;
|
|
8420
8456
|
});
|