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
|
@@ -3,5 +3,5 @@ export interface SCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
3
3
|
/** 테두리 표시 여부 */
|
|
4
4
|
bordered?: boolean;
|
|
5
5
|
}
|
|
6
|
-
/** SCard — sd-card 포팅. 라운드 8px, 흰 배경, 옵션 테두리. */
|
|
6
|
+
/** SCard — sd-card 포팅. 라운드 8px, 흰 배경, 옵션 테두리. 콘텐츠는 라운드 경계에서 잘린다. */
|
|
7
7
|
export declare const SCard: import("react").ForwardRefExoticComponent<SCardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -162,3 +162,8 @@ export declare function findGnbRailValue(items: SGnbMenuItem[], value: string):
|
|
|
162
162
|
export declare function findGnbSiblingValues(items: SGnbMenuItem[], value: string): string[];
|
|
163
163
|
/** value 로 선택된 아이템의 조상 value 목록(자기 자신 제외)을 반환 → 자동 펼침용 */
|
|
164
164
|
export declare function findGnbAncestors(items: SGnbMenuItem[], value: string): string[];
|
|
165
|
+
/**
|
|
166
|
+
* value 를 가진 아이템 아래의 **하위 가지**(children 을 가진 자손) value 목록을 반환.
|
|
167
|
+
* 부모를 펼칠 때 그 아래 가지도 전부 함께 펼치는 용도 — 리프는 펼침 대상이 아니라 제외한다.
|
|
168
|
+
*/
|
|
169
|
+
export declare function findGnbDescendantBranchValues(items: SGnbMenuItem[], value: string): string[];
|
package/dist/index.cjs
CHANGED
|
@@ -3373,7 +3373,11 @@ var SCard = /* @__PURE__ */ react.forwardRef(function SCard2({ bordered = false,
|
|
|
3373
3373
|
"div",
|
|
3374
3374
|
{
|
|
3375
3375
|
ref,
|
|
3376
|
-
className: cn(
|
|
3376
|
+
className: cn(
|
|
3377
|
+
"h-fit overflow-hidden rounded-[8px] bg-white",
|
|
3378
|
+
bordered && "border border-grey-30",
|
|
3379
|
+
className
|
|
3380
|
+
),
|
|
3377
3381
|
...rest,
|
|
3378
3382
|
children
|
|
3379
3383
|
}
|
|
@@ -8329,6 +8333,29 @@ function findGnbAncestors(items, value) {
|
|
|
8329
8333
|
};
|
|
8330
8334
|
return walk(items, []) ?? [];
|
|
8331
8335
|
}
|
|
8336
|
+
function findGnbDescendantBranchValues(items, value) {
|
|
8337
|
+
const find = (list) => {
|
|
8338
|
+
for (const item of list) {
|
|
8339
|
+
if (item.value === value) return item;
|
|
8340
|
+
if (item.children) {
|
|
8341
|
+
const found = find(item.children);
|
|
8342
|
+
if (found) return found;
|
|
8343
|
+
}
|
|
8344
|
+
}
|
|
8345
|
+
return void 0;
|
|
8346
|
+
};
|
|
8347
|
+
const collect = (list, acc) => {
|
|
8348
|
+
for (const item of list) {
|
|
8349
|
+
if (item.children && item.children.length > 0) {
|
|
8350
|
+
acc.push(item.value);
|
|
8351
|
+
collect(item.children, acc);
|
|
8352
|
+
}
|
|
8353
|
+
}
|
|
8354
|
+
return acc;
|
|
8355
|
+
};
|
|
8356
|
+
const target = find(items);
|
|
8357
|
+
return target?.children ? collect(target.children, []) : [];
|
|
8358
|
+
}
|
|
8332
8359
|
var LABEL_TIP_HIDE_DELAY_MS = 100;
|
|
8333
8360
|
var DEPTH_PADDING_LEFT = (M, depth) => depth === 1 ? M.depth1PaddingLeft : depth === 2 ? M.depth2PaddingLeft : M.depth3PaddingLeft;
|
|
8334
8361
|
var SGnb = /* @__PURE__ */ react.forwardRef(function SGnb2({
|
|
@@ -8369,8 +8396,12 @@ var SGnb = /* @__PURE__ */ react.forwardRef(function SGnb2({
|
|
|
8369
8396
|
const H = GNB_HEADER[header];
|
|
8370
8397
|
const M = GNB_MENU[type];
|
|
8371
8398
|
const C = GNB_COLORS[color];
|
|
8399
|
+
const branchWithDescendants = (key) => [
|
|
8400
|
+
key,
|
|
8401
|
+
...findGnbDescendantBranchValues(items, key)
|
|
8402
|
+
];
|
|
8372
8403
|
const [expandedKeys, setExpandedKeys] = react.useState(
|
|
8373
|
-
() => new Set(findGnbAncestors(items, value))
|
|
8404
|
+
() => new Set(findGnbAncestors(items, value).flatMap(branchWithDescendants))
|
|
8374
8405
|
);
|
|
8375
8406
|
const [hoveredKey, setHoveredKey] = react.useState(null);
|
|
8376
8407
|
const [labelTip, setLabelTip] = react.useState(null);
|
|
@@ -8417,12 +8448,15 @@ var SGnb = /* @__PURE__ */ react.forwardRef(function SGnb2({
|
|
|
8417
8448
|
() => findGnbRailValue(items, value) ?? items[0]?.value
|
|
8418
8449
|
);
|
|
8419
8450
|
react.useEffect(() => {
|
|
8420
|
-
const
|
|
8421
|
-
|
|
8451
|
+
const keys = findGnbAncestors(items, value).flatMap((ancestor) => [
|
|
8452
|
+
ancestor,
|
|
8453
|
+
...findGnbDescendantBranchValues(items, ancestor)
|
|
8454
|
+
]);
|
|
8455
|
+
if (keys.length === 0) return;
|
|
8422
8456
|
setExpandedKeys((prev) => {
|
|
8423
|
-
if (
|
|
8457
|
+
if (keys.every((key) => prev.has(key))) return prev;
|
|
8424
8458
|
const next = new Set(prev);
|
|
8425
|
-
|
|
8459
|
+
keys.forEach((key) => next.add(key));
|
|
8426
8460
|
return next;
|
|
8427
8461
|
});
|
|
8428
8462
|
}, [items, value]);
|
|
@@ -8439,10 +8473,12 @@ var SGnb = /* @__PURE__ */ react.forwardRef(function SGnb2({
|
|
|
8439
8473
|
setExpandedKeys((prev) => {
|
|
8440
8474
|
const next = new Set(prev);
|
|
8441
8475
|
if (next.has(key)) {
|
|
8442
|
-
next.delete(
|
|
8476
|
+
branchWithDescendants(key).forEach((descendant) => next.delete(descendant));
|
|
8443
8477
|
} else {
|
|
8444
|
-
findGnbSiblingValues(items, key).forEach(
|
|
8445
|
-
|
|
8478
|
+
findGnbSiblingValues(items, key).forEach(
|
|
8479
|
+
(sibling) => branchWithDescendants(sibling).forEach((descendant) => next.delete(descendant))
|
|
8480
|
+
);
|
|
8481
|
+
branchWithDescendants(key).forEach((descendant) => next.add(descendant));
|
|
8446
8482
|
}
|
|
8447
8483
|
return next;
|
|
8448
8484
|
});
|