@farmzone/fz-react-ui 1.2.5 → 1.2.6
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.cjs +224 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +225 -138
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tw.css +1 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import react__default, { ReactNode, ComponentProps, CSSProperties, ButtonHTMLAttributes, Ref, InputHTMLAttributes, TextareaHTMLAttributes, HTMLAttributes, RefObject, SVGProps } from 'react';
|
|
2
|
+
import react__default, { ReactNode, ComponentProps, CSSProperties, ButtonHTMLAttributes, Ref, InputHTMLAttributes, TextareaHTMLAttributes, HTMLAttributes, RefObject, ReactElement, SVGProps } from 'react';
|
|
3
3
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
4
4
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
5
5
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -349,6 +349,11 @@ interface PaginationProps {
|
|
|
349
349
|
totalPages: number;
|
|
350
350
|
onPageChange?: (page: number) => void;
|
|
351
351
|
showTotalCount?: boolean;
|
|
352
|
+
/**
|
|
353
|
+
* '첫 페이지' · '마지막 페이지' 버튼은 전체 페이지 수가 이 값 이상일 때만 둔다. 생략하면 항상 둔다.
|
|
354
|
+
* 예: 6 → 페이지가 5개를 넘을 때만.
|
|
355
|
+
*/
|
|
356
|
+
edgeButtonsMinPages?: number;
|
|
352
357
|
}
|
|
353
358
|
declare function Pagination(props: PaginationProps): react.JSX.Element;
|
|
354
359
|
|
|
@@ -1272,7 +1277,10 @@ interface MenuChild {
|
|
|
1272
1277
|
children?: Array<MenuGrandchild>;
|
|
1273
1278
|
}
|
|
1274
1279
|
interface MenuItem {
|
|
1275
|
-
|
|
1280
|
+
/** 드래그 순서 변경 · 렌더 key용 식별자. 생략하면 label을 쓴다(같은 이름이 둘이면 넣을 것). */
|
|
1281
|
+
id?: string;
|
|
1282
|
+
/** Lucide 아이콘 컴포넌트, 또는 그대로 그릴 요소(프로젝트 색 아이콘 등 — 16px 정도로). */
|
|
1283
|
+
icon: LucideIcon | ReactElement;
|
|
1276
1284
|
label: string;
|
|
1277
1285
|
path?: string;
|
|
1278
1286
|
/** 라벨 오른쪽에 붙는 작은 표시(건수 등). */
|
|
@@ -1282,6 +1290,11 @@ interface MenuItem {
|
|
|
1282
1290
|
interface MenuSection {
|
|
1283
1291
|
title?: string;
|
|
1284
1292
|
items: Array<MenuItem>;
|
|
1293
|
+
/**
|
|
1294
|
+
* 주면 이 섹션의 1depth 항목을 드래그해서 순서를 바꿀 수 있다. 놓으면 바뀐 순서의 items를 넘긴다 —
|
|
1295
|
+
* 저장과 다음 렌더의 items 반영은 호출부 몫이다.
|
|
1296
|
+
*/
|
|
1297
|
+
onReorder?: (items: Array<MenuItem>) => void;
|
|
1285
1298
|
}
|
|
1286
1299
|
type SidebarVariant = "light" | "dark" | "system-dark" | "system-light" | "inkstone";
|
|
1287
1300
|
interface SidebarHeaderRenderProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import react__default, { ReactNode, ComponentProps, CSSProperties, ButtonHTMLAttributes, Ref, InputHTMLAttributes, TextareaHTMLAttributes, HTMLAttributes, RefObject, SVGProps } from 'react';
|
|
2
|
+
import react__default, { ReactNode, ComponentProps, CSSProperties, ButtonHTMLAttributes, Ref, InputHTMLAttributes, TextareaHTMLAttributes, HTMLAttributes, RefObject, ReactElement, SVGProps } from 'react';
|
|
3
3
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
4
4
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
5
5
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -349,6 +349,11 @@ interface PaginationProps {
|
|
|
349
349
|
totalPages: number;
|
|
350
350
|
onPageChange?: (page: number) => void;
|
|
351
351
|
showTotalCount?: boolean;
|
|
352
|
+
/**
|
|
353
|
+
* '첫 페이지' · '마지막 페이지' 버튼은 전체 페이지 수가 이 값 이상일 때만 둔다. 생략하면 항상 둔다.
|
|
354
|
+
* 예: 6 → 페이지가 5개를 넘을 때만.
|
|
355
|
+
*/
|
|
356
|
+
edgeButtonsMinPages?: number;
|
|
352
357
|
}
|
|
353
358
|
declare function Pagination(props: PaginationProps): react.JSX.Element;
|
|
354
359
|
|
|
@@ -1272,7 +1277,10 @@ interface MenuChild {
|
|
|
1272
1277
|
children?: Array<MenuGrandchild>;
|
|
1273
1278
|
}
|
|
1274
1279
|
interface MenuItem {
|
|
1275
|
-
|
|
1280
|
+
/** 드래그 순서 변경 · 렌더 key용 식별자. 생략하면 label을 쓴다(같은 이름이 둘이면 넣을 것). */
|
|
1281
|
+
id?: string;
|
|
1282
|
+
/** Lucide 아이콘 컴포넌트, 또는 그대로 그릴 요소(프로젝트 색 아이콘 등 — 16px 정도로). */
|
|
1283
|
+
icon: LucideIcon | ReactElement;
|
|
1276
1284
|
label: string;
|
|
1277
1285
|
path?: string;
|
|
1278
1286
|
/** 라벨 오른쪽에 붙는 작은 표시(건수 등). */
|
|
@@ -1282,6 +1290,11 @@ interface MenuItem {
|
|
|
1282
1290
|
interface MenuSection {
|
|
1283
1291
|
title?: string;
|
|
1284
1292
|
items: Array<MenuItem>;
|
|
1293
|
+
/**
|
|
1294
|
+
* 주면 이 섹션의 1depth 항목을 드래그해서 순서를 바꿀 수 있다. 놓으면 바뀐 순서의 items를 넘긴다 —
|
|
1295
|
+
* 저장과 다음 렌더의 items 반영은 호출부 몫이다.
|
|
1296
|
+
*/
|
|
1297
|
+
onReorder?: (items: Array<MenuItem>) => void;
|
|
1285
1298
|
}
|
|
1286
1299
|
type SidebarVariant = "light" | "dark" | "system-dark" | "system-light" | "inkstone";
|
|
1287
1300
|
interface SidebarHeaderRenderProps {
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import * as React6 from 'react';
|
|
6
|
-
import React6__default, { forwardRef, useState, useRef, useEffect, useImperativeHandle, useCallback, memo, createContext, useContext, useMemo, useId, useLayoutEffect, useDeferredValue, Fragment as Fragment$1 } from 'react';
|
|
6
|
+
import React6__default, { forwardRef, useState, useRef, useEffect, useImperativeHandle, useCallback, memo, createContext, useContext, useMemo, useId, useLayoutEffect, useDeferredValue, isValidElement, Fragment as Fragment$1 } from 'react';
|
|
7
7
|
import { Slot } from '@radix-ui/react-slot';
|
|
8
8
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
9
9
|
import { ChevronLeft, ChevronRight, FileText, ZoomIn, ZoomOut, RotateCcw, RotateCw, Download, X, Heading1, Heading2, Heading3, Heading4, Bold, Italic, Strikethrough, Code, Baseline, AlignLeft, AlignCenter, AlignRight, List, ListOrdered, Quote, FileCode, Image, Table as Table$1, Plus, Minus, Trash2, Upload, Check, CircleX, EyeOff, Eye, ChevronDown, Calendar, CircleIcon, ChevronUp, ChevronsLeft, ChevronsRight, Search, TriangleAlert, Info, Pencil, BadgePlus, FileSearch2, FileUp, PanelRightClose, PanelLeftClose, ChevronFirst, ChevronLast, MoreHorizontal } from 'lucide-react';
|
|
@@ -344,9 +344,9 @@ function Button(props) {
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
// src/components/Checkbox/config/default.ts
|
|
347
|
-
var DEFAULT_CHECKED_CLASS = "border-0 bg-
|
|
348
|
-
var DEFAULT_UNCHECKED_CLASS = "border-neutral-300 bg-white hover:border-
|
|
349
|
-
var DEFAULT_DISABLED_CHECKED_CLASS = "border-0 bg-
|
|
347
|
+
var DEFAULT_CHECKED_CLASS = "border-0 bg-checkbox";
|
|
348
|
+
var DEFAULT_UNCHECKED_CLASS = "border-neutral-300 bg-white hover:border-checkbox active:border-checkbox focus-visible:border-checkbox";
|
|
349
|
+
var DEFAULT_DISABLED_CHECKED_CLASS = "border-0 bg-checkbox/40";
|
|
350
350
|
var DEFAULT_DISABLED_UNCHECKED_CLASS = "border-neutral-300 bg-black/10";
|
|
351
351
|
var DEFAULT_ICON_CLASS = "text-white";
|
|
352
352
|
function Checkbox(props) {
|
|
@@ -1516,8 +1516,9 @@ function getVisiblePageRange(currentPage, totalPages) {
|
|
|
1516
1516
|
return { start, end };
|
|
1517
1517
|
}
|
|
1518
1518
|
function Pagination(props) {
|
|
1519
|
-
const { page = 0, totalPages: rawTotalPages = 0, onPageChange } = props;
|
|
1519
|
+
const { page = 0, totalPages: rawTotalPages = 0, onPageChange, edgeButtonsMinPages } = props;
|
|
1520
1520
|
const totalPages = Math.max(1, rawTotalPages);
|
|
1521
|
+
const showEdgeButtons = edgeButtonsMinPages === void 0 || totalPages >= edgeButtonsMinPages;
|
|
1521
1522
|
const [displayPage, setDisplayPage] = useState(page);
|
|
1522
1523
|
useEffect(() => {
|
|
1523
1524
|
setDisplayPage(page);
|
|
@@ -1575,7 +1576,7 @@ function Pagination(props) {
|
|
|
1575
1576
|
}
|
|
1576
1577
|
);
|
|
1577
1578
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-1.5", children: [
|
|
1578
|
-
renderNavButton(
|
|
1579
|
+
showEdgeButtons && renderNavButton(
|
|
1579
1580
|
() => handlePageChange(0),
|
|
1580
1581
|
isFirstDisabled,
|
|
1581
1582
|
"\uCCAB \uD398\uC774\uC9C0",
|
|
@@ -1594,7 +1595,7 @@ function Pagination(props) {
|
|
|
1594
1595
|
"\uB2E4\uC74C \uD398\uC774\uC9C0",
|
|
1595
1596
|
/* @__PURE__ */ jsx(ChevronRight, { className: "w-4.5 h-4.5 text-[#000000]" })
|
|
1596
1597
|
),
|
|
1597
|
-
renderNavButton(
|
|
1598
|
+
showEdgeButtons && renderNavButton(
|
|
1598
1599
|
() => handlePageChange(totalPages - 1),
|
|
1599
1600
|
isLastDisabled,
|
|
1600
1601
|
"\uB9C8\uC9C0\uB9C9 \uD398\uC774\uC9C0",
|
|
@@ -8605,6 +8606,7 @@ function MultiTabBar(props) {
|
|
|
8605
8606
|
const [groupDropTargetKey, setGroupDropTargetKey] = useState(null);
|
|
8606
8607
|
const [groupDropSide, setGroupDropSide] = useState("before");
|
|
8607
8608
|
const [dragPos, setDragPos] = useState(null);
|
|
8609
|
+
const [grab, setGrab] = useState(null);
|
|
8608
8610
|
const dropTargetIdRef = useRef(null);
|
|
8609
8611
|
const dropSideRef = useRef("before");
|
|
8610
8612
|
const groupDropTargetKeyRef = useRef(null);
|
|
@@ -8824,6 +8826,7 @@ function MultiTabBar(props) {
|
|
|
8824
8826
|
setDraggingGroupKey(null);
|
|
8825
8827
|
setGroupDropTargetKey(null);
|
|
8826
8828
|
setDragPos(null);
|
|
8829
|
+
setGrab(null);
|
|
8827
8830
|
requestAnimationFrame(() => {
|
|
8828
8831
|
suppressClickRef.current = false;
|
|
8829
8832
|
});
|
|
@@ -8835,11 +8838,17 @@ function MultiTabBar(props) {
|
|
|
8835
8838
|
window.removeEventListener("pointerup", onPointerUp);
|
|
8836
8839
|
};
|
|
8837
8840
|
}, [reorderEnabled]);
|
|
8841
|
+
const recordGrab = (e) => {
|
|
8842
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
8843
|
+
setGrab({ offsetX: e.clientX - rect.left, offsetY: e.clientY - rect.top, width: rect.width });
|
|
8844
|
+
};
|
|
8838
8845
|
const handlePointerDown = (e, tabId) => {
|
|
8839
8846
|
pointerStateRef.current = { kind: "tab", id: tabId, startX: e.clientX, startY: e.clientY, dragging: false };
|
|
8847
|
+
recordGrab(e);
|
|
8840
8848
|
};
|
|
8841
8849
|
const handleGroupPointerDown = (e, groupKey) => {
|
|
8842
8850
|
pointerStateRef.current = { kind: "group", id: groupKey, startX: e.clientX, startY: e.clientY, dragging: false };
|
|
8851
|
+
recordGrab(e);
|
|
8843
8852
|
};
|
|
8844
8853
|
const showPlus = !!onTabAdd;
|
|
8845
8854
|
const canClose = tabs.length > 1;
|
|
@@ -8848,12 +8857,32 @@ function MultiTabBar(props) {
|
|
|
8848
8857
|
const draggingColor = draggingCluster?.group ? groupColors.get(draggingCluster.group.key)?.border : primaryColor;
|
|
8849
8858
|
const draggingGroupCluster = draggingGroupKey ? clusters?.find((c) => c.group?.key === draggingGroupKey) : void 0;
|
|
8850
8859
|
const draggingGroupColor = draggingGroupKey ? groupColors.get(draggingGroupKey) : void 0;
|
|
8851
|
-
const
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8860
|
+
const ghostContent = draggingGroupKey && draggingGroupCluster?.group ? /* @__PURE__ */ jsx(
|
|
8861
|
+
"div",
|
|
8862
|
+
{
|
|
8863
|
+
className: `flex h-6.5 items-center gap-1 rounded-lg px-2.5 text-sm font-semibold whitespace-nowrap text-white`,
|
|
8864
|
+
style: { backgroundColor: (draggingGroupColor ?? TAB_PALETTE[0]).base },
|
|
8865
|
+
children: draggingGroupCluster.group.label
|
|
8866
|
+
}
|
|
8867
|
+
) : draggingTab ? /* @__PURE__ */ jsx(
|
|
8868
|
+
MultiTabPill,
|
|
8869
|
+
{
|
|
8870
|
+
tab: draggingTab,
|
|
8871
|
+
isActive: draggingTab.id === activeTabId,
|
|
8872
|
+
showClose: canClose,
|
|
8873
|
+
accentColor: draggingCluster?.group ? draggingColor : primaryColor,
|
|
8874
|
+
style: s,
|
|
8875
|
+
onClick: () => {
|
|
8876
|
+
},
|
|
8877
|
+
onClose: () => {
|
|
8878
|
+
},
|
|
8879
|
+
registerRef: () => {
|
|
8880
|
+
},
|
|
8881
|
+
icon: getTabIcon?.(draggingTab),
|
|
8882
|
+
menuItems: getTabMenuItems?.(draggingTab),
|
|
8883
|
+
groupColor: draggingCluster?.group ? draggingColor : void 0
|
|
8884
|
+
}
|
|
8885
|
+
) : null;
|
|
8857
8886
|
if (tabs.length === 0) return null;
|
|
8858
8887
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8859
8888
|
/* @__PURE__ */ jsx("div", { className: `flex-shrink-0 w-full overflow-hidden ${s.container}`, children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-stretch", children: [
|
|
@@ -9035,20 +9064,14 @@ function MultiTabBar(props) {
|
|
|
9035
9064
|
}
|
|
9036
9065
|
)
|
|
9037
9066
|
] }) }),
|
|
9038
|
-
dragPos &&
|
|
9067
|
+
dragPos && grab && ghostContent ? createPortal(
|
|
9039
9068
|
/* @__PURE__ */ jsx(
|
|
9040
9069
|
"div",
|
|
9041
9070
|
{
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
backgroundColor: ghost.bg,
|
|
9047
|
-
borderColor: ghost.border,
|
|
9048
|
-
color: ghost.color,
|
|
9049
|
-
transform: "rotate(-2deg)"
|
|
9050
|
-
},
|
|
9051
|
-
children: ghost.label
|
|
9071
|
+
"aria-hidden": true,
|
|
9072
|
+
className: "pointer-events-none fixed z-50 flex cursor-grabbing shadow-lg",
|
|
9073
|
+
style: { left: dragPos.x - grab.offsetX, top: dragPos.y - grab.offsetY, width: grab.width },
|
|
9074
|
+
children: ghostContent
|
|
9052
9075
|
}
|
|
9053
9076
|
),
|
|
9054
9077
|
document.body
|
|
@@ -10074,6 +10097,12 @@ var ACCENT_APPLIERS = {
|
|
|
10074
10097
|
grandchildActive: textStyle
|
|
10075
10098
|
}
|
|
10076
10099
|
};
|
|
10100
|
+
function MenuIcon(props) {
|
|
10101
|
+
const { icon, className } = props;
|
|
10102
|
+
if (isValidElement(icon)) return /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center", children: icon });
|
|
10103
|
+
const Icon2 = icon;
|
|
10104
|
+
return /* @__PURE__ */ jsx(Icon2, { className });
|
|
10105
|
+
}
|
|
10077
10106
|
function Sidebar(props) {
|
|
10078
10107
|
const navigate = useNavigate();
|
|
10079
10108
|
const {
|
|
@@ -10093,6 +10122,8 @@ function Sidebar(props) {
|
|
|
10093
10122
|
const [overflowVisible, setOverflowVisible] = useState(true);
|
|
10094
10123
|
const [expandedItems, setExpandedItems] = useState(/* @__PURE__ */ new Set());
|
|
10095
10124
|
const [expandedSubItems, setExpandedSubItems] = useState(/* @__PURE__ */ new Set());
|
|
10125
|
+
const [dragging, setDragging] = useState(null);
|
|
10126
|
+
const [dropTarget, setDropTarget] = useState(null);
|
|
10096
10127
|
const toggleCollapse = () => setIsCollapsed((prev) => !prev);
|
|
10097
10128
|
const isHeaderRenderProp = typeof header === "function";
|
|
10098
10129
|
const headerContent = isHeaderRenderProp ? header({ isCollapsed, toggleCollapse }) : header;
|
|
@@ -10151,6 +10182,26 @@ function Sidebar(props) {
|
|
|
10151
10182
|
return next;
|
|
10152
10183
|
});
|
|
10153
10184
|
};
|
|
10185
|
+
const resetDrag = () => {
|
|
10186
|
+
setDragging(null);
|
|
10187
|
+
setDropTarget(null);
|
|
10188
|
+
};
|
|
10189
|
+
const dropItem = (section, sectionIndex) => {
|
|
10190
|
+
const from = dragging;
|
|
10191
|
+
const target = dropTarget;
|
|
10192
|
+
resetDrag();
|
|
10193
|
+
if (!section.onReorder || !from || !target || from.section !== sectionIndex || target.section !== sectionIndex) {
|
|
10194
|
+
return;
|
|
10195
|
+
}
|
|
10196
|
+
const insertAt = target.side === "after" ? target.index + 1 : target.index;
|
|
10197
|
+
if (insertAt === from.index || insertAt === from.index + 1) return;
|
|
10198
|
+
const next = [...section.items];
|
|
10199
|
+
const [moved] = next.splice(from.index, 1);
|
|
10200
|
+
if (!moved) return;
|
|
10201
|
+
next.splice(insertAt > from.index ? insertAt - 1 : insertAt, 0, moved);
|
|
10202
|
+
section.onReorder(next);
|
|
10203
|
+
};
|
|
10204
|
+
const dropLineColor = variant === "inkstone" ? "var(--fz-ink)" : primaryColor ?? "#3b82f6";
|
|
10154
10205
|
const handleItemClick = (path) => {
|
|
10155
10206
|
if (path.includes("https")) {
|
|
10156
10207
|
window.open(path, "_blank", "noopener,noreferrer");
|
|
@@ -10193,140 +10244,176 @@ function Sidebar(props) {
|
|
|
10193
10244
|
className: `${variant === "inkstone" ? "space-y-4 px-2" : "space-y-6"} ${variant === "system-dark" || variant === "system-light" ? "px-1" : ""}`,
|
|
10194
10245
|
children: menuSections.map((section, sectionIndex) => /* @__PURE__ */ jsxs("div", { children: [
|
|
10195
10246
|
section.title && /* @__PURE__ */ jsx("div", { className: s.sectionTitle, children: section.title }),
|
|
10196
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: section.items.map((item) => {
|
|
10247
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: section.items.map((item, itemIndex) => {
|
|
10197
10248
|
const isActive = !item.children && pathname === item.path;
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10249
|
+
const sortable = section.onReorder !== void 0;
|
|
10250
|
+
const isDraggingThis = dragging?.section === sectionIndex && dragging.index === itemIndex;
|
|
10251
|
+
const dropSide = dropTarget?.section === sectionIndex && dropTarget.index === itemIndex ? dropTarget.side : null;
|
|
10252
|
+
return /* @__PURE__ */ jsxs(
|
|
10253
|
+
"div",
|
|
10254
|
+
{
|
|
10255
|
+
className: sortable ? `relative ${isDraggingThis ? "opacity-40" : ""}` : void 0,
|
|
10256
|
+
draggable: sortable || void 0,
|
|
10257
|
+
onDragStart: sortable ? (event) => {
|
|
10258
|
+
event.dataTransfer.effectAllowed = "move";
|
|
10259
|
+
setDragging({ section: sectionIndex, index: itemIndex });
|
|
10260
|
+
} : void 0,
|
|
10261
|
+
onDragOver: sortable ? (event) => {
|
|
10262
|
+
if (dragging?.section !== sectionIndex) return;
|
|
10263
|
+
event.preventDefault();
|
|
10264
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
10265
|
+
const side = event.clientY - rect.top < rect.height / 2 ? "before" : "after";
|
|
10266
|
+
if (dropSide !== side) {
|
|
10267
|
+
setDropTarget({ section: sectionIndex, index: itemIndex, side });
|
|
10268
|
+
}
|
|
10269
|
+
} : void 0,
|
|
10270
|
+
onDrop: sortable ? (event) => {
|
|
10271
|
+
event.preventDefault();
|
|
10272
|
+
dropItem(section, sectionIndex);
|
|
10273
|
+
} : void 0,
|
|
10274
|
+
onDragEnd: sortable ? resetDrag : void 0,
|
|
10275
|
+
children: [
|
|
10276
|
+
dropSide && /* @__PURE__ */ jsx(
|
|
10277
|
+
"div",
|
|
10278
|
+
{
|
|
10279
|
+
className: `pointer-events-none absolute right-0 left-0 z-10 h-0.5 ${dropSide === "before" ? "-top-px" : "-bottom-px"}`,
|
|
10280
|
+
style: { backgroundColor: dropLineColor }
|
|
10207
10281
|
}
|
|
10208
|
-
|
|
10209
|
-
|
|
10282
|
+
),
|
|
10283
|
+
/* @__PURE__ */ jsxs(
|
|
10284
|
+
"button",
|
|
10285
|
+
{
|
|
10286
|
+
onClick: () => {
|
|
10287
|
+
if (item.children) {
|
|
10288
|
+
toggleExpand(item.label);
|
|
10289
|
+
} else if (item.path) {
|
|
10290
|
+
handleItemClick(item.path);
|
|
10291
|
+
}
|
|
10292
|
+
},
|
|
10293
|
+
className: `
|
|
10210
10294
|
w-full text-left flex items-center gap-2 px-3 ${s.itemPy} ${s.rounded} ${s.itemTextSize} ${s.itemFont} transition-colors cursor-pointer
|
|
10211
10295
|
${isActive ? s.itemActive : s.itemInactive}
|
|
10212
10296
|
`,
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
{
|
|
10224
|
-
className: `w-4 h-4 transition-transform ${expandedItems.has(item.label) ? "rotate-90" : ""}`,
|
|
10225
|
-
fill: "none",
|
|
10226
|
-
stroke: "currentColor",
|
|
10227
|
-
viewBox: "0 0 24 24",
|
|
10228
|
-
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
|
|
10229
|
-
}
|
|
10230
|
-
),
|
|
10231
|
-
item.path?.includes("https") && /* @__PURE__ */ jsx(
|
|
10232
|
-
"svg",
|
|
10233
|
-
{
|
|
10234
|
-
className: "w-4 h-4 flex-shrink-0 opacity-50",
|
|
10235
|
-
fill: "none",
|
|
10236
|
-
stroke: "currentColor",
|
|
10237
|
-
viewBox: "0 0 24 24",
|
|
10238
|
-
children: /* @__PURE__ */ jsx(
|
|
10239
|
-
"path",
|
|
10297
|
+
style: {
|
|
10298
|
+
...isActive ? s.activeItemStyle : {},
|
|
10299
|
+
...isActive && primaryColor ? applier.itemActive(primaryColor) : {}
|
|
10300
|
+
},
|
|
10301
|
+
children: [
|
|
10302
|
+
/* @__PURE__ */ jsx(MenuIcon, { icon: item.icon, className: s.iconClass }),
|
|
10303
|
+
/* @__PURE__ */ jsx("span", { className: `flex-1 ${variant === "inkstone" ? "min-w-0 truncate text-left" : ""}`, children: item.label }),
|
|
10304
|
+
item.badge !== void 0 && item.badge !== null && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs font-medium opacity-60", children: item.badge }),
|
|
10305
|
+
item.children && /* @__PURE__ */ jsx(
|
|
10306
|
+
"svg",
|
|
10240
10307
|
{
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10308
|
+
className: `w-4 h-4 transition-transform ${expandedItems.has(item.label) ? "rotate-90" : ""}`,
|
|
10309
|
+
fill: "none",
|
|
10310
|
+
stroke: "currentColor",
|
|
10311
|
+
viewBox: "0 0 24 24",
|
|
10312
|
+
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
|
|
10313
|
+
}
|
|
10314
|
+
),
|
|
10315
|
+
item.path?.includes("https") && /* @__PURE__ */ jsx(
|
|
10316
|
+
"svg",
|
|
10317
|
+
{
|
|
10318
|
+
className: "w-4 h-4 flex-shrink-0 opacity-50",
|
|
10319
|
+
fill: "none",
|
|
10320
|
+
stroke: "currentColor",
|
|
10321
|
+
viewBox: "0 0 24 24",
|
|
10322
|
+
children: /* @__PURE__ */ jsx(
|
|
10323
|
+
"path",
|
|
10324
|
+
{
|
|
10325
|
+
strokeLinecap: "round",
|
|
10326
|
+
strokeLinejoin: "round",
|
|
10327
|
+
strokeWidth: 2,
|
|
10328
|
+
d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
10329
|
+
}
|
|
10330
|
+
)
|
|
10245
10331
|
}
|
|
10246
10332
|
)
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
onClick: () => toggleSubExpand(subKey),
|
|
10262
|
-
className: `
|
|
10333
|
+
]
|
|
10334
|
+
}
|
|
10335
|
+
),
|
|
10336
|
+
item.children && expandedItems.has(item.label) && /* @__PURE__ */ jsx("div", { className: `ml-5 mt-0.5 space-y-0.5 border-l ${s.childGroupBorder}`, children: item.children.map((child, childIndex) => {
|
|
10337
|
+
if (child.children && child.children.length > 0) {
|
|
10338
|
+
const subKey = `${item.label}::${child.label}`;
|
|
10339
|
+
const isSubExpanded = expandedSubItems.has(subKey);
|
|
10340
|
+
const isSubActive = child.children.some((gc) => gc.path === pathname);
|
|
10341
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
10342
|
+
/* @__PURE__ */ jsxs(
|
|
10343
|
+
"button",
|
|
10344
|
+
{
|
|
10345
|
+
onClick: () => toggleSubExpand(subKey),
|
|
10346
|
+
className: `
|
|
10263
10347
|
w-full text-left flex items-center justify-between pl-4 pr-3 ${s.childPy} ${s.rounded} ${s.itemTextSize} transition-colors cursor-pointer
|
|
10264
10348
|
${isSubActive ? s.subItemActive : s.subItemInactive}
|
|
10265
10349
|
`,
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
{
|
|
10272
|
-
className: `w-3 h-3 transition-transform ${isSubExpanded ? "rotate-90" : ""}`,
|
|
10273
|
-
fill: "none",
|
|
10274
|
-
stroke: "currentColor",
|
|
10275
|
-
viewBox: "0 0 24 24",
|
|
10276
|
-
children: /* @__PURE__ */ jsx(
|
|
10277
|
-
"path",
|
|
10350
|
+
style: isSubActive && primaryColor ? applier.subItemActive(primaryColor) : void 0,
|
|
10351
|
+
children: [
|
|
10352
|
+
/* @__PURE__ */ jsx("span", { children: child.label }),
|
|
10353
|
+
/* @__PURE__ */ jsx(
|
|
10354
|
+
"svg",
|
|
10278
10355
|
{
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10356
|
+
className: `w-3 h-3 transition-transform ${isSubExpanded ? "rotate-90" : ""}`,
|
|
10357
|
+
fill: "none",
|
|
10358
|
+
stroke: "currentColor",
|
|
10359
|
+
viewBox: "0 0 24 24",
|
|
10360
|
+
children: /* @__PURE__ */ jsx(
|
|
10361
|
+
"path",
|
|
10362
|
+
{
|
|
10363
|
+
strokeLinecap: "round",
|
|
10364
|
+
strokeLinejoin: "round",
|
|
10365
|
+
strokeWidth: 2,
|
|
10366
|
+
d: "M9 5l7 7-7 7"
|
|
10367
|
+
}
|
|
10368
|
+
)
|
|
10283
10369
|
}
|
|
10284
10370
|
)
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
onClick: () => handleItemClick(grandchild.path),
|
|
10296
|
-
className: `
|
|
10371
|
+
]
|
|
10372
|
+
}
|
|
10373
|
+
),
|
|
10374
|
+
isSubExpanded && /* @__PURE__ */ jsx("div", { className: "ml-3 mt-0.5 space-y-0.5 pl-2", children: child.children.map((grandchild) => {
|
|
10375
|
+
const isGrandchildActive = pathname === grandchild.path;
|
|
10376
|
+
return /* @__PURE__ */ jsx(
|
|
10377
|
+
"button",
|
|
10378
|
+
{
|
|
10379
|
+
onClick: () => handleItemClick(grandchild.path),
|
|
10380
|
+
className: `
|
|
10297
10381
|
w-full text-left px-3 ${s.grandchildPy} ${s.rounded} ${s.grandchildTextSize} transition-colors cursor-pointer
|
|
10298
10382
|
${isGrandchildActive ? s.grandchildActive : s.grandchildInactive}
|
|
10299
10383
|
`,
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10384
|
+
style: {
|
|
10385
|
+
...isGrandchildActive ? s.activeGrandchildStyle : {},
|
|
10386
|
+
...isGrandchildActive && primaryColor ? applier.grandchildActive(primaryColor) : {}
|
|
10387
|
+
},
|
|
10388
|
+
children: grandchild.label
|
|
10389
|
+
},
|
|
10390
|
+
grandchild.path
|
|
10391
|
+
);
|
|
10392
|
+
}) })
|
|
10393
|
+
] }, child.label);
|
|
10394
|
+
}
|
|
10395
|
+
const isChildActive = pathname === child.path;
|
|
10396
|
+
return /* @__PURE__ */ jsx(
|
|
10397
|
+
"button",
|
|
10398
|
+
{
|
|
10399
|
+
onClick: () => handleItemClick(child.path ?? ""),
|
|
10400
|
+
className: `
|
|
10317
10401
|
w-full text-left pl-4 pr-3 ${s.childPy} ${s.rounded} ${s.itemTextSize} transition-colors cursor-pointer
|
|
10318
10402
|
${isChildActive ? s.childActive : s.childInactive}
|
|
10319
10403
|
`,
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10404
|
+
style: {
|
|
10405
|
+
...isChildActive ? s.activeChildStyle : {},
|
|
10406
|
+
...isChildActive && primaryColor ? applier.childActive(primaryColor) : {}
|
|
10407
|
+
},
|
|
10408
|
+
children: child.label
|
|
10409
|
+
},
|
|
10410
|
+
childIndex
|
|
10411
|
+
);
|
|
10412
|
+
}) })
|
|
10413
|
+
]
|
|
10414
|
+
},
|
|
10415
|
+
item.id ?? item.label
|
|
10416
|
+
);
|
|
10330
10417
|
}) })
|
|
10331
10418
|
] }, section.title ?? sectionIndex))
|
|
10332
10419
|
}
|