@aivex/ui 1.2.0-dev.54 → 1.2.0-dev.55

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.
@@ -1,55 +1,92 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../utils.js";
3
- import { CloseIcon as t } from "../Icon/index.js";
4
- import { overlayVariants as n } from "../Overlay/Overlay.js";
5
- import { useModalAutoFocus as r } from "../../utils/useModalAutoFocus.js";
6
- import { drawerVariants as i } from "../Drawer/Drawer.js";
7
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
8
- import * as s from "@radix-ui/react-dialog";
3
+ import { sheetActionsClassName as t, sheetBodyClassName as n, sheetHeaderClassName as r, sheetTitleClassName as i } from "../../utils/sheet.js";
4
+ import { cva as a } from "class-variance-authority";
5
+ import { createContext as o, useContext as s, useId as c } from "react";
6
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
7
  //#region src/components/Panel/Panel.tsx
10
- var c = {
11
- md: "aivex:w-[384px]",
12
- lg: "aivex:w-[450px]"
13
- };
14
- function l({ open: l, onOpenChange: u, title: d, children: f, headerAction: p, side: m = "right", size: h = "md", ref: g }) {
15
- let _ = r();
16
- return /* @__PURE__ */ a(s.Root, {
17
- open: l,
18
- onOpenChange: u,
19
- children: /* @__PURE__ */ o(s.Portal, { children: [/* @__PURE__ */ a(s.Overlay, { className: e("aivex:panel-overlay", n({ variant: "dim" })) }), /* @__PURE__ */ o(s.Content, {
20
- ref: g,
21
- "data-side": m,
22
- "aria-describedby": void 0,
23
- className: e(i({ side: m }), "aivex:max-w-[calc(100vw-32px)]", c[h]),
24
- ..._,
25
- onKeyDown: (e) => {
26
- e.stopPropagation();
8
+ var d = o(void 0), f = a("aivex:flex aivex:h-full aivex:min-h-0 aivex:shrink-0 aivex:flex-col aivex:border-border-subtle aivex:bg-bg-primary", {
9
+ variants: { side: {
10
+ left: "aivex:border-r",
11
+ right: "aivex:border-l"
12
+ } },
13
+ defaultVariants: { side: "right" }
14
+ });
15
+ function p({ children: t, side: n = "right", width: r = 420, "aria-label": i, className: a, style: o, ref: s }) {
16
+ let u = c();
17
+ return /* @__PURE__ */ l(d.Provider, {
18
+ value: u,
19
+ children: /* @__PURE__ */ l("aside", {
20
+ ref: s,
21
+ "aria-label": i,
22
+ "aria-labelledby": i ? void 0 : u,
23
+ "data-side": n,
24
+ className: e(f({ side: n }), a),
25
+ style: {
26
+ width: r,
27
+ ...o
27
28
  },
28
- children: [/* @__PURE__ */ o("div", {
29
- className: "aivex:flex aivex:h-12 aivex:w-full aivex:shrink-0 aivex:items-center aivex:justify-between aivex:gap-lg aivex:border-b aivex:border-border-subtle aivex:px-xl aivex:py-lg",
30
- children: [/* @__PURE__ */ a(s.Title, {
31
- className: "aivex:m-0 aivex:min-w-0 aivex:flex-1 aivex:truncate aivex:text-label-xl aivex:text-text-primary",
32
- children: d
33
- }), /* @__PURE__ */ o("div", {
34
- className: "aivex:flex aivex:shrink-0 aivex:items-center aivex:gap-md",
35
- children: [p, /* @__PURE__ */ a(s.Close, {
36
- asChild: !0,
37
- children: /* @__PURE__ */ a("button", {
38
- type: "button",
39
- className: e("aivex:flex aivex:h-6 aivex:w-6 aivex:shrink-0 aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:rounded-sm", "aivex:text-icon-secondary aivex:transition-colors", "aivex:hover:bg-bg-tertiary aivex:hover:text-icon-primary", "aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand"),
40
- "aria-label": "Close panel",
41
- children: /* @__PURE__ */ a(t, { size: 20 })
42
- })
43
- })]
44
- })]
45
- }), /* @__PURE__ */ a("div", {
46
- className: "aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col",
47
- children: f
48
- })]
49
- })] })
29
+ children: t
30
+ })
50
31
  });
51
32
  }
33
+ function m({ children: n, description: a, action: o, className: c }) {
34
+ let f = s(d);
35
+ return /* @__PURE__ */ u("div", {
36
+ className: e(r, c),
37
+ children: [/* @__PURE__ */ u("div", {
38
+ className: "aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:gap-2xs",
39
+ children: [/* @__PURE__ */ l("h2", {
40
+ id: f,
41
+ className: i,
42
+ children: n
43
+ }), a ? /* @__PURE__ */ l("p", {
44
+ className: "aivex:m-0 aivex:text-body-sm-regular aivex:text-text-secondary",
45
+ children: a
46
+ }) : null]
47
+ }), o ? /* @__PURE__ */ l("div", {
48
+ className: t,
49
+ children: o
50
+ }) : null]
51
+ });
52
+ }
53
+ function h({ children: t, title: n, action: r, fill: i = !1, className: a }) {
54
+ return /* @__PURE__ */ u("section", {
55
+ className: e("aivex:flex aivex:flex-col aivex:gap-md aivex:px-xl aivex:py-lg", "aivex:[&+section]:border-t aivex:[&+section]:border-border-subtle", i ? "aivex:min-h-0 aivex:flex-1" : "aivex:shrink-0", a),
56
+ children: [n || r ? /* @__PURE__ */ u("div", {
57
+ className: "aivex:flex aivex:min-h-8 aivex:shrink-0 aivex:items-center aivex:justify-between aivex:gap-md",
58
+ children: [/* @__PURE__ */ l("h3", {
59
+ className: "aivex:m-0 aivex:min-w-0 aivex:truncate aivex:text-body-md-medium aivex:text-text-primary",
60
+ children: n
61
+ }), r ? /* @__PURE__ */ l("div", {
62
+ className: "aivex:flex aivex:shrink-0 aivex:items-center aivex:gap-xs",
63
+ children: r
64
+ }) : null]
65
+ }) : null, i ? /* @__PURE__ */ l("div", {
66
+ className: "aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col aivex:overflow-y-auto",
67
+ children: t
68
+ }) : t]
69
+ });
70
+ }
71
+ function g({ children: t, padded: r = !0, className: i }) {
72
+ return /* @__PURE__ */ l("div", {
73
+ className: e(n, r && "aivex:p-xl", i),
74
+ children: t
75
+ });
76
+ }
77
+ function _({ children: t, className: n }) {
78
+ return /* @__PURE__ */ l("div", {
79
+ className: e("aivex:mt-auto aivex:flex aivex:shrink-0 aivex:flex-col aivex:gap-md aivex:border-t aivex:border-border-subtle aivex:px-xl aivex:py-lg", n),
80
+ children: t
81
+ });
82
+ }
83
+ var v = Object.assign(p, {
84
+ Header: m,
85
+ Section: h,
86
+ Body: g,
87
+ Footer: _
88
+ });
52
89
  //#endregion
53
- export { l as Panel };
90
+ export { v as Panel };
54
91
 
55
92
  //# sourceMappingURL=Panel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.js","names":[],"sources":["../../../src/components/Panel/Panel.tsx"],"sourcesContent":["import * as RadixDialog from \"@radix-ui/react-dialog\";\nimport type { ReactNode, Ref } from \"react\";\nimport { drawerVariants } from \"@/components/Drawer/Drawer\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport { overlayVariants } from \"@/components/Overlay/Overlay\";\nimport { cn } from \"@/utils/cn\";\nimport { useModalAutoFocus } from \"@/utils/useModalAutoFocus\";\n\nexport interface PanelProps {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n title: ReactNode;\n children: ReactNode;\n headerAction?: ReactNode;\n side?: \"left\" | \"right\";\n size?: \"md\" | \"lg\";\n ref?: Ref<HTMLDivElement>;\n}\n\nconst panelSizeClasses = {\n md: \"aivex:w-[384px]\",\n lg: \"aivex:w-[450px]\",\n} as const;\n\nfunction Panel({\n open,\n onOpenChange,\n title,\n children,\n headerAction,\n side = \"right\",\n size = \"md\",\n ref,\n}: PanelProps) {\n const autoFocus = useModalAutoFocus();\n return (\n <RadixDialog.Root open={open} onOpenChange={onOpenChange}>\n <RadixDialog.Portal>\n <RadixDialog.Overlay\n className={cn(\"aivex:panel-overlay\", overlayVariants({ variant: \"dim\" }))}\n />\n <RadixDialog.Content\n ref={ref}\n data-side={side}\n // 패널은 설명을 두지 않는다 — 명시해야 Radix가 개발 모드 경고를 내지 않는다.\n aria-describedby={undefined}\n className={cn(\n drawerVariants({ side }),\n \"aivex:max-w-[calc(100vw-32px)]\",\n panelSizeClasses[size],\n )}\n {...autoFocus}\n onKeyDown={(event) => {\n event.stopPropagation();\n }}\n >\n <div className=\"aivex:flex aivex:h-12 aivex:w-full aivex:shrink-0 aivex:items-center aivex:justify-between aivex:gap-lg aivex:border-b aivex:border-border-subtle aivex:px-xl aivex:py-lg\">\n <RadixDialog.Title className=\"aivex:m-0 aivex:min-w-0 aivex:flex-1 aivex:truncate aivex:text-label-xl aivex:text-text-primary\">\n {title}\n </RadixDialog.Title>\n <div className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:gap-md\">\n {headerAction}\n <RadixDialog.Close asChild>\n <button\n type=\"button\"\n className={cn(\n \"aivex:flex aivex:h-6 aivex:w-6 aivex:shrink-0 aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:rounded-sm\",\n \"aivex:text-icon-secondary aivex:transition-colors\",\n \"aivex:hover:bg-bg-tertiary aivex:hover:text-icon-primary\",\n \"aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand\",\n )}\n aria-label=\"Close panel\"\n >\n <CloseIcon size={20} />\n </button>\n </RadixDialog.Close>\n </div>\n </div>\n <div className=\"aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col\">{children}</div>\n </RadixDialog.Content>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n );\n}\n\nexport { Panel };\n"],"mappings":";;;;;;;;;AAmBA,IAAM,IAAmB;CACvB,IAAI;CACJ,IAAI;CACL;AAED,SAAS,EAAM,EACb,SACA,iBACA,UACA,aACA,iBACA,UAAO,SACP,UAAO,MACP,UACa;CACb,IAAM,IAAY,GAAmB;AACrC,QACE,kBAAC,EAAY,MAAb;EAAwB;EAAoB;YAC1C,kBAAC,EAAY,QAAb,EAAA,UAAA,CACE,kBAAC,EAAY,SAAb,EACE,WAAW,EAAG,uBAAuB,EAAgB,EAAE,SAAS,OAAO,CAAC,CAAC,EACzE,CAAA,EACF,kBAAC,EAAY,SAAb;GACO;GACL,aAAW;GAEX,oBAAkB,KAAA;GAClB,WAAW,EACT,EAAe,EAAE,SAAM,CAAC,EACxB,kCACA,EAAiB,GAClB;GACD,GAAI;GACJ,YAAY,MAAU;AACpB,MAAM,iBAAiB;;aAZ3B,CAeE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,EAAY,OAAb;KAAmB,WAAU;eAC1B;KACiB,CAAA,EACpB,kBAAC,OAAD;KAAK,WAAU;eAAf,CACG,GACD,kBAAC,EAAY,OAAb;MAAmB,SAAA;gBACjB,kBAAC,UAAD;OACE,MAAK;OACL,WAAW,EACT,+HACA,qDACA,4DACA,oGACD;OACD,cAAW;iBAEX,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;OAChB,CAAA;MACS,CAAA,CAChB;OACF;OACN,kBAAC,OAAD;IAAK,WAAU;IAAwD;IAAe,CAAA,CAClE;KACH,EAAA,CAAA;EACJ,CAAA"}
1
+ {"version":3,"file":"Panel.js","names":[],"sources":["../../../src/components/Panel/Panel.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport {\n type CSSProperties,\n createContext,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport {\n SHEET_DEFAULT_WIDTH,\n sheetActionsClassName,\n sheetBodyClassName,\n sheetBodyPaddingClassName,\n sheetHeaderClassName,\n sheetTitleClassName,\n} from \"@/utils/sheet\";\n\nconst PanelTitleIdContext = createContext<string | undefined>(undefined);\n\n/**\n * 화면 레이아웃 안에 자리를 차지하는 사이드 패널의 표면 — 편집기 속성 패널,\n * 이미지 상세 옆 라벨 목록처럼 본문 옆에 붙어 함께 보이는 영역. Figma Panel처럼\n * 그림자 없이 본문 쪽 모서리의 구분선으로 나뉜다.\n */\nconst panelVariants = cva(\n \"aivex:flex aivex:h-full aivex:min-h-0 aivex:shrink-0 aivex:flex-col aivex:border-border-subtle aivex:bg-bg-primary\",\n {\n variants: {\n side: {\n left: \"aivex:border-r\",\n right: \"aivex:border-l\",\n },\n },\n defaultVariants: {\n side: \"right\",\n },\n },\n);\n\n/**\n * 레이아웃용 사이드 패널. 화면 위에 덮이는 시트가 필요하면 Drawer를 쓴다.\n *\n * ```tsx\n * <div className=\"flex h-full\">\n * <main className=\"min-w-0 flex-1\">…</main>\n * <Panel side=\"right\" width={300}>\n * <Panel.Header action={…}>라벨</Panel.Header>\n * <Panel.Section title=\"클래스\">…</Panel.Section>\n * <Panel.Section title=\"라벨 목록\" fill>…</Panel.Section>\n * <Panel.Footer>…</Panel.Footer>\n * </Panel>\n * </div>\n * ```\n */\nexport interface PanelProps {\n children: ReactNode;\n /** 패널이 본문의 어느 쪽에 붙는지 — 구분선이 반대쪽 모서리에 생긴다. */\n side?: \"left\" | \"right\";\n /** 폭. 숫자는 px, 문자열은 CSS 길이. 기본 420px(Figma). style.width가 있으면 그쪽이 이긴다. */\n width?: number | string;\n /**\n * 접근성 이름. 생략하면 Panel.Header의 제목을 쓴다. 둘 다 없으면 이름 없는\n * complementary 영역이 된다.\n */\n \"aria-label\"?: string;\n className?: string;\n style?: CSSProperties;\n ref?: Ref<HTMLElement>;\n}\n\nfunction PanelRoot({\n children,\n side = \"right\",\n width = SHEET_DEFAULT_WIDTH,\n \"aria-label\": ariaLabel,\n className,\n style,\n ref,\n}: PanelProps) {\n const titleId = useId();\n return (\n <PanelTitleIdContext.Provider value={titleId}>\n <aside\n ref={ref}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabel ? undefined : titleId}\n data-side={side}\n className={cn(panelVariants({ side }), className)}\n style={{ width, ...style }}\n >\n {children}\n </aside>\n </PanelTitleIdContext.Provider>\n );\n}\n\nexport interface PanelHeaderProps {\n /** 제목 — 패널의 접근성 이름도 된다. */\n children: ReactNode;\n /** 제목 아래 보조 설명. */\n description?: ReactNode;\n /** 오른쪽 끝의 보조 동작(설정·닫기·접기 버튼 등). */\n action?: ReactNode;\n className?: string;\n}\n\n/** 표준 헤더 — 제목·설명·보조 동작. Drawer.Header와 같은 높이(50px)·간격·구분선(Figma Header). */\nfunction PanelHeader({ children, description, action, className }: PanelHeaderProps) {\n const titleId = useContext(PanelTitleIdContext);\n return (\n <div className={cn(sheetHeaderClassName, className)}>\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:gap-2xs\">\n <h2 id={titleId} className={sheetTitleClassName}>\n {children}\n </h2>\n {description ? (\n <p className=\"aivex:m-0 aivex:text-body-sm-regular aivex:text-text-secondary\">\n {description}\n </p>\n ) : null}\n </div>\n {action ? <div className={sheetActionsClassName}>{action}</div> : null}\n </div>\n );\n}\n\nexport interface PanelSectionProps {\n children?: ReactNode;\n /** 섹션 제목. 생략하면 제목 줄 없이 내용만 둔다. */\n title?: ReactNode;\n /** 제목 줄 오른쪽 보조 동작(메뉴 버튼 등). */\n action?: ReactNode;\n /**\n * 남은 높이를 채우고 내용이 넘치면 섹션 안에서 세로 스크롤한다 — 라벨 목록처럼\n * 길어지는 섹션에 쓴다. 기본은 내용 높이만큼 차지한다.\n */\n fill?: boolean;\n className?: string;\n}\n\n/** 제목이 붙은 묶음. 섹션이 이어지면 사이에 구분선이 생긴다. */\nfunction PanelSection({ children, title, action, fill = false, className }: PanelSectionProps) {\n return (\n <section\n className={cn(\n \"aivex:flex aivex:flex-col aivex:gap-md aivex:px-xl aivex:py-lg\",\n \"aivex:[&+section]:border-t aivex:[&+section]:border-border-subtle\",\n fill ? \"aivex:min-h-0 aivex:flex-1\" : \"aivex:shrink-0\",\n className,\n )}\n >\n {title || action ? (\n <div className=\"aivex:flex aivex:min-h-8 aivex:shrink-0 aivex:items-center aivex:justify-between aivex:gap-md\">\n <h3 className=\"aivex:m-0 aivex:min-w-0 aivex:truncate aivex:text-body-md-medium aivex:text-text-primary\">\n {title}\n </h3>\n {action ? (\n <div className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:gap-xs\">\n {action}\n </div>\n ) : null}\n </div>\n ) : null}\n {fill ? (\n <div className=\"aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col aivex:overflow-y-auto\">\n {children}\n </div>\n ) : (\n children\n )}\n </section>\n );\n}\n\nexport interface PanelBodyProps {\n children: ReactNode;\n /**\n * 사방 16px 여백(Figma Body). 기본 true. 목록·표처럼 가장자리까지 붙는 내용은\n * false로 끈다.\n */\n padded?: boolean;\n className?: string;\n}\n\n/** 헤더·푸터 사이 남은 높이를 채우는 본문 — 넘치면 이 안에서 세로 스크롤한다. */\nfunction PanelBody({ children, padded = true, className }: PanelBodyProps) {\n return (\n <div className={cn(sheetBodyClassName, padded && sheetBodyPaddingClassName, className)}>\n {children}\n </div>\n );\n}\n\nexport interface PanelFooterProps {\n children: ReactNode;\n className?: string;\n}\n\n/** 아래에 고정되는 영역(신뢰도 조절, 적용 버튼 등). 위에 구분선이 생긴다. */\nfunction PanelFooter({ children, className }: PanelFooterProps) {\n return (\n <div\n className={cn(\n \"aivex:mt-auto aivex:flex aivex:shrink-0 aivex:flex-col aivex:gap-md aivex:border-t aivex:border-border-subtle aivex:px-xl aivex:py-lg\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nconst Panel = Object.assign(PanelRoot, {\n Header: PanelHeader,\n Section: PanelSection,\n Body: PanelBody,\n Footer: PanelFooter,\n});\n\nexport { Panel };\n"],"mappings":";;;;;;;AAmBA,IAAM,IAAsB,EAAkC,KAAA,EAAU,EAOlE,IAAgB,EACpB,sHACA;CACE,UAAU,EACR,MAAM;EACJ,MAAM;EACN,OAAO;EACR,EACF;CACD,iBAAiB,EACf,MAAM,SACP;CACF,CACF;AAiCD,SAAS,EAAU,EACjB,aACA,UAAO,SACP,WAAA,KACA,cAAc,GACd,cACA,UACA,UACa;CACb,IAAM,IAAU,GAAO;AACvB,QACE,kBAAC,EAAoB,UAArB;EAA8B,OAAO;YACnC,kBAAC,SAAD;GACO;GACL,cAAY;GACZ,mBAAiB,IAAY,KAAA,IAAY;GACzC,aAAW;GACX,WAAW,EAAG,EAAc,EAAE,SAAM,CAAC,EAAE,EAAU;GACjD,OAAO;IAAE;IAAO,GAAG;IAAO;GAEzB;GACK,CAAA;EACqB,CAAA;;AAenC,SAAS,EAAY,EAAE,aAAU,gBAAa,WAAQ,gBAA+B;CACnF,IAAM,IAAU,EAAW,EAAoB;AAC/C,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,GAAsB,EAAU;YAAnD,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,MAAD;IAAI,IAAI;IAAS,WAAW;IACzB;IACE,CAAA,EACJ,IACC,kBAAC,KAAD;IAAG,WAAU;cACV;IACC,CAAA,GACF,KACA;MACL,IAAS,kBAAC,OAAD;GAAK,WAAW;aAAwB;GAAa,CAAA,GAAG,KAC9D;;;AAmBV,SAAS,EAAa,EAAE,aAAU,UAAO,WAAQ,UAAO,IAAO,gBAAgC;AAC7F,QACE,kBAAC,WAAD;EACE,WAAW,EACT,kEACA,qEACA,IAAO,+BAA+B,kBACtC,EACD;YANH,CAQG,KAAS,IACR,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,MAAD;IAAI,WAAU;cACX;IACE,CAAA,EACJ,IACC,kBAAC,OAAD;IAAK,WAAU;cACZ;IACG,CAAA,GACJ,KACA;OACJ,MACH,IACC,kBAAC,OAAD;GAAK,WAAU;GACZ;GACG,CAAA,GAEN,EAEM;;;AAed,SAAS,EAAU,EAAE,aAAU,YAAS,IAAM,gBAA6B;AACzE,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,GAAoB,KAAA,cAAqC,EAAU;EACnF;EACG,CAAA;;AAUV,SAAS,EAAY,EAAE,aAAU,gBAA+B;AAC9D,QACE,kBAAC,OAAD;EACE,WAAW,EACT,yIACA,EACD;EAEA;EACG,CAAA;;AAIV,IAAM,IAAQ,OAAO,OAAO,GAAW;CACrC,QAAQ;CACR,SAAS;CACT,MAAM;CACN,QAAQ;CACT,CAAC"}
@@ -1,2 +1,2 @@
1
- export type { PanelProps } from "./Panel";
1
+ export type { PanelBodyProps, PanelFooterProps, PanelHeaderProps, PanelProps, PanelSectionProps, } from "./Panel";
2
2
  export { Panel } from "./Panel";