@jbpark/ui-kit 2.4.0 → 2.7.0

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.
Files changed (80) hide show
  1. package/dist/Menu.d.mts +2 -2
  2. package/dist/Menu.d.mts.map +1 -1
  3. package/dist/Menu.mjs +4 -4
  4. package/dist/Menu.mjs.map +1 -1
  5. package/dist/components/atoms/Button/index.mjs +3 -3
  6. package/dist/components/atoms/Button/index.mjs.map +1 -1
  7. package/dist/components/atoms/Checkbox/index.mjs +3 -3
  8. package/dist/components/atoms/Checkbox/index.mjs.map +1 -1
  9. package/dist/components/atoms/Radio/index.mjs +2 -2
  10. package/dist/components/atoms/Switch/index.d.mts.map +1 -1
  11. package/dist/components/atoms/Switch/index.mjs +16 -15
  12. package/dist/components/atoms/Switch/index.mjs.map +1 -1
  13. package/dist/components/molecules/Marquees/Item/index.mjs +2 -2
  14. package/dist/components/molecules/Marquees/Item/index.mjs.map +1 -1
  15. package/dist/components/molecules/Space/index.mjs +2 -2
  16. package/dist/components/molecules/Space/index.mjs.map +1 -1
  17. package/dist/components/molecules/Splitter/index.d.mts +31 -0
  18. package/dist/components/molecules/Splitter/index.d.mts.map +1 -0
  19. package/dist/components/molecules/Splitter/index.mjs +37 -0
  20. package/dist/components/molecules/Splitter/index.mjs.map +1 -0
  21. package/dist/components/molecules/index.d.mts +1 -0
  22. package/dist/components/molecules/index.mjs +1 -0
  23. package/dist/components/organisms/Drawer/index.d.mts +7 -2
  24. package/dist/components/organisms/Drawer/index.d.mts.map +1 -1
  25. package/dist/components/organisms/Drawer/index.mjs +46 -22
  26. package/dist/components/organisms/Drawer/index.mjs.map +1 -1
  27. package/dist/components/organisms/Modal/index.mjs +3 -3
  28. package/dist/components/organisms/Modal/index.mjs.map +1 -1
  29. package/dist/components/organisms/index.d.mts +1 -1
  30. package/dist/components/templates/Layout/Content/index.d.mts +7 -1
  31. package/dist/components/templates/Layout/Content/index.d.mts.map +1 -0
  32. package/dist/components/templates/Layout/Content/index.mjs +2 -2
  33. package/dist/components/templates/Layout/Content/index.mjs.map +1 -1
  34. package/dist/components/templates/Layout/Footer/index.d.mts +7 -1
  35. package/dist/components/templates/Layout/Footer/index.d.mts.map +1 -0
  36. package/dist/components/templates/Layout/Footer/index.mjs +2 -2
  37. package/dist/components/templates/Layout/Footer/index.mjs.map +1 -1
  38. package/dist/components/templates/Layout/Header/index.d.mts +1 -1
  39. package/dist/components/templates/Layout/Header/index.mjs +2 -2
  40. package/dist/components/templates/Layout/Header/index.mjs.map +1 -1
  41. package/dist/components/templates/Layout/Sider/index.d.mts +19 -1
  42. package/dist/components/templates/Layout/Sider/index.d.mts.map +1 -0
  43. package/dist/components/templates/Layout/Sider/index.mjs +32 -5
  44. package/dist/components/templates/Layout/Sider/index.mjs.map +1 -1
  45. package/dist/components/templates/Layout/index.d.mts +18 -8
  46. package/dist/components/templates/Layout/index.d.mts.map +1 -1
  47. package/dist/components/templates/Layout/index.mjs +3 -1
  48. package/dist/components/templates/Layout/index.mjs.map +1 -1
  49. package/dist/core/resizable.d.mts +24 -0
  50. package/dist/core/resizable.d.mts.map +1 -0
  51. package/dist/core/resizable.mjs +52 -0
  52. package/dist/core/resizable.mjs.map +1 -0
  53. package/dist/core.d.mts +2 -1
  54. package/dist/core.mjs +2 -1
  55. package/dist/index.d.mts +7 -2
  56. package/dist/index.mjs +5 -1
  57. package/dist/providers/Config/context.d.mts +8 -0
  58. package/dist/providers/Config/context.d.mts.map +1 -0
  59. package/dist/providers/Config/context.mjs +11 -0
  60. package/dist/providers/Config/context.mjs.map +1 -0
  61. package/dist/providers/Config/index.d.mts +18 -0
  62. package/dist/providers/Config/index.d.mts.map +1 -0
  63. package/dist/providers/Config/index.mjs +67 -0
  64. package/dist/providers/Config/index.mjs.map +1 -0
  65. package/dist/providers/Config/types.d.mts +32 -0
  66. package/dist/providers/Config/types.d.mts.map +1 -0
  67. package/dist/providers/index.d.mts +3 -0
  68. package/dist/providers/index.mjs +4 -0
  69. package/dist/style.css +218 -56
  70. package/dist/utils.d.mts +2 -2
  71. package/dist/utils.d.mts.map +1 -1
  72. package/dist/utils.mjs +4 -4
  73. package/dist/utils.mjs.map +1 -1
  74. package/package.json +15 -11
  75. package/dist/node_modules/gsap/CSSPlugin.mjs +0 -920
  76. package/dist/node_modules/gsap/CSSPlugin.mjs.map +0 -1
  77. package/dist/node_modules/gsap/gsap-core.mjs +0 -2723
  78. package/dist/node_modules/gsap/gsap-core.mjs.map +0 -1
  79. package/dist/node_modules/gsap/index.mjs +0 -9
  80. package/dist/node_modules/gsap/index.mjs.map +0 -1
@@ -3,27 +3,35 @@
3
3
  import { cn, renderConditional } from "../../../utils.mjs";
4
4
  import { drawer_exports } from "../../../core/drawer.mjs";
5
5
  import "../../../core.mjs";
6
+ import Button from "../../atoms/Button/index.mjs";
6
7
  import { X } from "lucide-react";
7
8
  import { useEffect } from "react";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
10
 
10
11
  //#region src/components/organisms/Drawer/index.tsx
11
12
  const { DrawerContent, Drawer: DrawerCore, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle } = drawer_exports;
12
- const Drawer = ({ open, title, footer, closable = true, closeIcon, direction = "bottom", maskClosable = true, handlebar = true, draggable = false, rounded = false, mask = true, className, classNames, style, children, container, onClose, ...props }) => {
13
+ const SIZES = {
14
+ small: "30%",
15
+ medium: "50%",
16
+ large: "75%",
17
+ full: "90%"
18
+ };
19
+ const getSizeStyles = (direction, size) => {
20
+ const value = SIZES[size] || size;
21
+ return direction === "top" || direction === "bottom" ? { height: value } : { width: value };
22
+ };
23
+ const Drawer = ({ open, title, extra, footer, closable = true, closeIcon, direction = "bottom", size = "medium", maskClosable = true, handlebar = true, draggable = false, rounded = false, mask = true, className, classNames, style, children, container, onClose, ...props }) => {
13
24
  useEffect(() => {
14
- if (!open) return;
15
- if (!mask) {
16
- const originalPointerEvents = document.body.style.pointerEvents;
17
- const raf = window.requestAnimationFrame(() => {
18
- document.body.style.pointerEvents = "auto";
19
- });
20
- return () => {
21
- window.cancelAnimationFrame(raf);
22
- document.body.style.pointerEvents = originalPointerEvents;
23
- };
24
- }
25
+ if (!open || mask) return;
26
+ const originalPointerEvents = document.body.style.pointerEvents;
27
+ const raf = window.requestAnimationFrame(() => {
28
+ document.body.style.pointerEvents = "auto";
29
+ });
30
+ return () => {
31
+ window.cancelAnimationFrame(raf);
32
+ document.body.style.pointerEvents = originalPointerEvents;
33
+ };
25
34
  }, [open, mask]);
26
- if (typeof window === "undefined") return null;
27
35
  return /* @__PURE__ */ jsx(DrawerCore, {
28
36
  open,
29
37
  direction,
@@ -38,20 +46,36 @@ const Drawer = ({ open, title, footer, closable = true, closeIcon, direction = "
38
46
  handlebar,
39
47
  mask,
40
48
  classNames: {
41
- mask: cn(classNames?.mask || ""),
42
- handlebar: cn(classNames?.handlebar || "")
49
+ mask: classNames?.mask || "",
50
+ handlebar: classNames?.handlebar || ""
51
+ },
52
+ style: {
53
+ ...getSizeStyles(direction, size),
54
+ ...style
43
55
  },
44
- style,
45
56
  children: [
46
57
  /* @__PURE__ */ jsxs(DrawerHeader, {
47
58
  className: cn(classNames?.header, !title && "p-0"),
48
- children: [/* @__PURE__ */ jsxs(DrawerTitle, {
49
- className: cn("flex justify-between", classNames?.title),
50
- children: [/* @__PURE__ */ jsx("span", { children: title }), renderConditional(closable ? closeIcon || /* @__PURE__ */ jsx(X, {}) : null, (v) => /* @__PURE__ */ jsx("span", {
51
- className: cn("absolute top-3 right-5 cursor-pointer", classNames?.close),
59
+ children: [/* @__PURE__ */ jsxs("div", {
60
+ className: "flex items-start gap-2",
61
+ children: [renderConditional(closable ? closeIcon || /* @__PURE__ */ jsx(X, {}) : null, (v) => /* @__PURE__ */ jsx(Button, {
62
+ type: "text",
63
+ shape: "circle",
64
+ size: "small",
65
+ "aria-label": "닫기",
66
+ icon: v,
52
67
  onClick: onClose,
53
- children: v
54
- }))]
68
+ className: cn(classNames?.close)
69
+ })), /* @__PURE__ */ jsxs("div", {
70
+ className: "flex flex-1 items-start justify-between gap-2",
71
+ children: [/* @__PURE__ */ jsx(DrawerTitle, {
72
+ className: cn(classNames?.title),
73
+ children: title
74
+ }), renderConditional(extra, (v) => /* @__PURE__ */ jsx("div", {
75
+ className: cn("shrink-0", classNames?.extra),
76
+ children: v
77
+ }))]
78
+ })]
55
79
  }), /* @__PURE__ */ jsx(DrawerDescription, { className: "hidden" })]
56
80
  }),
57
81
  /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["drawer"],"sources":["../../../../src/components/organisms/Drawer/index.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\nimport { X } from 'lucide-react';\n\nimport { drawer } from '@repo/ui/core';\nimport { cn, renderConditional } from '@repo/ui/utils';\n\nconst {\n DrawerContent,\n Drawer: DrawerCore,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n} = drawer;\n\ninterface Props {\n open: boolean;\n children?: React.ReactNode;\n title?: React.ReactNode;\n footer?: React.ReactNode;\n closable?: boolean;\n closeIcon?: React.ReactNode;\n direction?: 'top' | 'bottom' | 'left' | 'right';\n maskClosable?: boolean;\n handlebar?: boolean;\n draggable?: boolean;\n rounded?: boolean;\n mask?: boolean;\n className?: string;\n style?: React.CSSProperties;\n classNames?: {\n mask?: string;\n content?: string;\n handlebar?: string;\n header?: string;\n title?: string;\n close?: string;\n body?: string;\n footer?: string;\n };\n container?: HTMLElement;\n onClose: () => void;\n}\n\nconst Drawer = ({\n open,\n title,\n footer,\n closable = true,\n closeIcon,\n direction = 'bottom',\n maskClosable = true,\n handlebar = true,\n draggable = false,\n rounded = false,\n mask = true,\n className,\n classNames,\n style,\n children,\n container,\n onClose,\n ...props\n}: Props) => {\n useEffect(() => {\n if (!open) {\n return;\n }\n\n if (!mask) {\n const originalPointerEvents = document.body.style.pointerEvents;\n\n const raf = window.requestAnimationFrame(() => {\n document.body.style.pointerEvents = 'auto';\n });\n\n return () => {\n window.cancelAnimationFrame(raf);\n document.body.style.pointerEvents = originalPointerEvents;\n };\n }\n }, [open, mask]);\n\n if (typeof window === 'undefined') {\n return null;\n }\n\n return (\n <DrawerCore\n open={open}\n direction={direction}\n handleOnly={!draggable}\n container={container}\n onOpenChange={(open: boolean) => {\n if (!open && maskClosable) {\n onClose();\n }\n }}\n {...props}\n >\n <DrawerContent\n className={cn(\n 'border-none outline-none',\n rounded ? 'rounded-t-[30px]!' : 'rounded-none!',\n classNames?.content,\n className,\n //\n )}\n handlebar={handlebar}\n mask={mask}\n classNames={{\n mask: cn(\n classNames?.mask || '',\n //\n ),\n handlebar: cn(\n classNames?.handlebar || '',\n //\n ),\n }}\n style={style}\n >\n <DrawerHeader\n className={cn(\n classNames?.header,\n !title && 'p-0',\n //\n )}\n >\n <DrawerTitle\n className={cn(\n 'flex justify-between',\n classNames?.title,\n //\n )}\n >\n <span>{title}</span>\n {renderConditional(closable ? closeIcon || <X /> : null, v => (\n <span\n className={cn(\n 'absolute top-3 right-5 cursor-pointer',\n classNames?.close,\n //\n )}\n onClick={onClose}\n >\n {v}\n </span>\n ))}\n </DrawerTitle>\n <DrawerDescription className=\"hidden\" />\n </DrawerHeader>\n <div\n className={cn(\n 'overflow-auto p-5',\n classNames?.body,\n //\n )}\n >\n {children}\n </div>\n {renderConditional(footer, v => (\n <DrawerFooter className={cn(classNames?.footer)}>{v}</DrawerFooter>\n ))}\n </DrawerContent>\n </DrawerCore>\n );\n};\n\nexport default Drawer;\n"],"mappings":";;;;;;;;;;AASA,MAAM,EACJ,eACA,QAAQ,YACR,mBACA,cACA,cACA,gBACEA;AA+BJ,MAAM,UAAU,EACd,MACA,OACA,QACA,WAAW,MACX,WACA,YAAY,UACZ,eAAe,MACf,YAAY,MACZ,YAAY,OACZ,UAAU,OACV,OAAO,MACP,WACA,YACA,OACA,UACA,WACA,SACA,GAAG,YACQ;AACX,iBAAgB;AACd,MAAI,CAAC,KACH;AAGF,MAAI,CAAC,MAAM;GACT,MAAM,wBAAwB,SAAS,KAAK,MAAM;GAElD,MAAM,MAAM,OAAO,4BAA4B;AAC7C,aAAS,KAAK,MAAM,gBAAgB;KACpC;AAEF,gBAAa;AACX,WAAO,qBAAqB,IAAI;AAChC,aAAS,KAAK,MAAM,gBAAgB;;;IAGvC,CAAC,MAAM,KAAK,CAAC;AAEhB,KAAI,OAAO,WAAW,YACpB,QAAO;AAGT,QACE,oBAAC;EACO;EACK;EACX,YAAY,CAAC;EACF;EACX,eAAe,SAAkB;AAC/B,OAAI,CAAC,QAAQ,aACX,UAAS;;EAGb,GAAI;YAEJ,qBAAC;GACC,WAAW,GACT,4BACA,UAAU,sBAAsB,iBAChC,YAAY,SACZ,UAED;GACU;GACL;GACN,YAAY;IACV,MAAM,GACJ,YAAY,QAAQ,GAErB;IACD,WAAW,GACT,YAAY,aAAa,GAE1B;IACF;GACM;;IAEP,qBAAC;KACC,WAAW,GACT,YAAY,QACZ,CAAC,SAAS,MAEX;gBAED,qBAAC;MACC,WAAW,GACT,wBACA,YAAY,MAEb;iBAED,oBAAC,oBAAM,QAAa,EACnB,kBAAkB,WAAW,aAAa,oBAAC,MAAI,GAAG,OAAM,MACvD,oBAAC;OACC,WAAW,GACT,yCACA,YAAY,MAEb;OACD,SAAS;iBAER;QACI,CACP;OACU,EACd,oBAAC,qBAAkB,WAAU,WAAW;MAC3B;IACf,oBAAC;KACC,WAAW,GACT,qBACA,YAAY,KAEb;KAEA;MACG;IACL,kBAAkB,SAAQ,MACzB,oBAAC;KAAa,WAAW,GAAG,YAAY,OAAO;eAAG;MAAiB,CACnE;;IACY;GACL"}
1
+ {"version":3,"file":"index.mjs","names":["drawer"],"sources":["../../../../src/components/organisms/Drawer/index.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\nimport { X } from 'lucide-react';\n\nimport { drawer } from '@repo/ui/core';\nimport { cn, renderConditional } from '@repo/ui/utils';\n\nimport Button from '../../atoms/Button';\n\nconst {\n DrawerContent,\n Drawer: DrawerCore,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n} = drawer;\n\nexport interface Props {\n open: boolean;\n children?: React.ReactNode;\n title?: React.ReactNode;\n extra?: React.ReactNode;\n footer?: React.ReactNode;\n closable?: boolean;\n closeIcon?: React.ReactNode;\n direction?: 'top' | 'bottom' | 'left' | 'right';\n size?: 'small' | 'medium' | 'large' | 'full' | string;\n maskClosable?: boolean;\n handlebar?: boolean;\n draggable?: boolean;\n rounded?: boolean;\n mask?: boolean;\n className?: string;\n style?: React.CSSProperties;\n classNames?: {\n mask?: string;\n content?: string;\n handlebar?: string;\n header?: string;\n title?: string;\n close?: string;\n extra?: string;\n body?: string;\n footer?: string;\n };\n container?: HTMLElement;\n onClose: () => void;\n}\n\nconst SIZES: Record<string, string> = {\n small: '30%',\n medium: '50%',\n large: '75%',\n full: '90%',\n};\n\nconst getSizeStyles = (\n direction: 'top' | 'bottom' | 'left' | 'right',\n size: string,\n): React.CSSProperties => {\n const value = SIZES[size] || size;\n\n return direction === 'top' || direction === 'bottom'\n ? { height: value }\n : { width: value };\n};\n\nconst Drawer = ({\n open,\n title,\n extra,\n footer,\n closable = true,\n closeIcon,\n direction = 'bottom',\n size = 'medium',\n maskClosable = true,\n handlebar = true,\n draggable = false,\n rounded = false,\n mask = true,\n className,\n classNames,\n style,\n children,\n container,\n onClose,\n ...props\n}: Props) => {\n useEffect(() => {\n if (!open || mask) {\n return;\n }\n\n const originalPointerEvents = document.body.style.pointerEvents;\n\n const raf = window.requestAnimationFrame(() => {\n document.body.style.pointerEvents = 'auto';\n });\n\n return () => {\n window.cancelAnimationFrame(raf);\n document.body.style.pointerEvents = originalPointerEvents;\n };\n }, [open, mask]);\n\n return (\n <DrawerCore\n open={open}\n direction={direction}\n handleOnly={!draggable}\n container={container}\n onOpenChange={open => {\n if (!open && maskClosable) {\n onClose();\n }\n }}\n {...props}\n >\n <DrawerContent\n className={cn(\n 'border-none outline-none',\n rounded ? 'rounded-t-[30px]!' : 'rounded-none!',\n classNames?.content,\n className,\n //\n )}\n handlebar={handlebar}\n mask={mask}\n classNames={{\n mask: classNames?.mask || '',\n handlebar: classNames?.handlebar || '',\n }}\n style={{\n ...getSizeStyles(direction, size),\n ...style,\n }}\n >\n <DrawerHeader\n className={cn(\n classNames?.header,\n !title && 'p-0',\n //\n )}\n >\n <div className=\"flex items-start gap-2\">\n {renderConditional(closable ? closeIcon || <X /> : null, v => (\n <Button\n type=\"text\"\n shape=\"circle\"\n size=\"small\"\n aria-label=\"닫기\"\n icon={v}\n onClick={onClose}\n className={cn(classNames?.close)}\n />\n ))}\n <div className=\"flex flex-1 items-start justify-between gap-2\">\n <DrawerTitle className={cn(classNames?.title)}>\n {title}\n </DrawerTitle>\n {renderConditional(extra, v => (\n <div className={cn('shrink-0', classNames?.extra)}>{v}</div>\n ))}\n </div>\n </div>\n <DrawerDescription className=\"hidden\" />\n </DrawerHeader>\n <div\n className={cn(\n 'overflow-auto p-5',\n classNames?.body,\n //\n )}\n >\n {children}\n </div>\n {renderConditional(footer, v => (\n <DrawerFooter className={cn(classNames?.footer)}>{v}</DrawerFooter>\n ))}\n </DrawerContent>\n </DrawerCore>\n );\n};\n\nexport default Drawer;\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,EACJ,eACA,QAAQ,YACR,mBACA,cACA,cACA,gBACEA;AAkCJ,MAAM,QAAgC;CACpC,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;CACP;AAED,MAAM,iBACJ,WACA,SACwB;CACxB,MAAM,QAAQ,MAAM,SAAS;AAE7B,QAAO,cAAc,SAAS,cAAc,WACxC,EAAE,QAAQ,OAAO,GACjB,EAAE,OAAO,OAAO;;AAGtB,MAAM,UAAU,EACd,MACA,OACA,OACA,QACA,WAAW,MACX,WACA,YAAY,UACZ,OAAO,UACP,eAAe,MACf,YAAY,MACZ,YAAY,OACZ,UAAU,OACV,OAAO,MACP,WACA,YACA,OACA,UACA,WACA,SACA,GA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 @@ import Button from "../../atoms/Button/index.mjs";
7
7
  import "../../../index.mjs";
8
8
  import { Check, CircleQuestionMark, Info, OctagonAlert, OctagonX } from "lucide-react";
9
9
  import React, { useEffect, useState } from "react";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { createPortal } from "react-dom";
12
12
  import { createRoot } from "react-dom/client";
13
13
  import { v4 } from "uuid";
@@ -63,7 +63,7 @@ const Modal = ({ open = false, maskClosable = false, closable = false, closeIcon
63
63
  }),
64
64
  footer !== null && /* @__PURE__ */ jsx(DialogFooter, {
65
65
  className: cn("flex-row justify-end gap-x-2", classNames?.footer),
66
- children: footer || /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
66
+ children: footer || /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
67
67
  onClick: onOk,
68
68
  children: okText
69
69
  }), /* @__PURE__ */ jsx(Button, {
@@ -137,7 +137,7 @@ const ModalStackRenderer = () => {
137
137
  updateStack = null;
138
138
  };
139
139
  }, []);
140
- return /* @__PURE__ */ jsx(Fragment, { children: modalStack.map(({ id, ...props }) => /* @__PURE__ */ jsx(StaticModal, {
140
+ return /* @__PURE__ */ jsx(Fragment$1, { children: modalStack.map(({ id, ...props }) => /* @__PURE__ */ jsx(StaticModal, {
141
141
  id,
142
142
  ...props
143
143
  }, id)) });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["dialog","uuid"],"sources":["../../../../src/components/organisms/Modal/index.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { Root, createRoot } from 'react-dom/client';\n\nimport {\n Check,\n CircleQuestionMark,\n Info,\n OctagonAlert,\n OctagonX,\n} from 'lucide-react';\nimport { v4 as uuid } from 'uuid';\n\nimport { Button } from '@repo/ui';\nimport { dialog } from '@repo/ui/core';\nimport { cn } from '@repo/ui/utils';\n\nconst {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} = dialog;\n\ninterface Props {\n open?: boolean;\n maskClosable?: boolean;\n closable?:\n | boolean\n | {\n closeIcon?: React.ReactNode;\n disabled?: boolean;\n };\n closeIcon?: React.ReactNode;\n title?: React.ReactNode;\n content?: React.ReactNode;\n footer?: React.ReactNode;\n className?: string;\n classNames?: {\n mask?: string;\n header?: string;\n body?: string;\n footer?: string;\n };\n style?: React.CSSProperties;\n okText?: string;\n cancelText?: string;\n container?: HTMLElement;\n children?: React.ReactNode;\n onOk?: () => void;\n onCancel?: () => void;\n}\n\ninterface StaticProps extends Props {\n type?: 'info' | 'success' | 'error' | 'warning' | 'confirm';\n id?: string;\n icon?: React.ReactNode;\n container?: HTMLElement;\n}\n\nconst isBrowser =\n typeof window !== 'undefined' && typeof document !== 'undefined';\n\nlet modalRoot: Root | null = null;\nlet modalStack: StaticProps[] = [];\nlet updateStack: (() => void) | null = null;\n\nconst createModalRoot = (container?: HTMLElement) => {\n if (!isBrowser) {\n return null;\n }\n\n const targetContainer = container || document.body;\n let rootEl = targetContainer.querySelector(\n '#modal-root',\n ) as HTMLElement | null;\n\n if (!rootEl) {\n rootEl = document.createElement('div');\n rootEl.setAttribute('id', 'modal-root');\n rootEl.setAttribute('role', 'dialog');\n rootEl.setAttribute('aria-modal', 'true');\n rootEl.style.zIndex = '10000';\n rootEl.style.position = 'absolute';\n targetContainer.appendChild(rootEl);\n }\n\n return rootEl;\n};\n\nconst Modal = ({\n open = false,\n maskClosable = false,\n closable = false,\n closeIcon,\n className,\n classNames,\n style,\n title,\n footer,\n container,\n children,\n okText = 'OK',\n cancelText = 'Cancel',\n onOk,\n onCancel,\n ...props\n}: Props) => {\n if (typeof window === 'undefined') {\n return null;\n }\n\n return (\n <Dialog\n open={open}\n onOpenChange={(open: boolean) => {\n if (!open && maskClosable) {\n onCancel?.();\n }\n }}\n {...props}\n >\n <DialogContent\n className={cn(\n 'rounded-lg p-4 max-sm:max-w-[80%]',\n 'border-none outline-none',\n className,\n )}\n classNames={{\n ...classNames,\n mask: cn('bg-black/60', classNames?.mask),\n }}\n style={style}\n showCloseButton={!!closable}\n closeIcon={closeIcon}\n container={container}\n onCancel={onCancel}\n >\n {/**\n * @todo [Dialog & AlertDialog] fix: can't get id correctly in shadow dom\n * @see https://github.com/radix-ui/primitives/pull/3384\n **/}\n <DialogHeader\n className={cn(\n classNames?.header,\n !title && 'hidden',\n //\n )}\n >\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription className=\"hidden\" />\n </DialogHeader>\n <div className={cn('break-all', classNames?.body)}>{children}</div>\n {footer !== null && (\n <DialogFooter\n className={cn('flex-row justify-end gap-x-2', classNames?.footer)}\n >\n {footer || (\n <>\n <Button onClick={onOk}>{okText}</Button>\n <Button variant=\"outlined\" onClick={onCancel}>\n {cancelText}\n </Button>\n </>\n )}\n </DialogFooter>\n )}\n </DialogContent>\n </Dialog>\n );\n};\n\nconst STATIC_ICONS = {\n info: <Info className=\"text-blue-400\" />,\n success: <Check className=\"text-green-400\" />,\n error: <OctagonX className=\"text-red-400\" />,\n warning: <OctagonAlert className=\"text-yellow-400\" />,\n confirm: <CircleQuestionMark />,\n};\n\nconst StaticModal = ({\n type,\n title,\n content,\n okText = 'OK',\n cancelText = 'Cancel',\n id,\n container,\n icon,\n onOk,\n onCancel,\n ...props\n}: StaticProps) => {\n const [open, setOpen] = useState(true);\n\n const closeModal = (callback?: () => void) => {\n callback?.();\n setOpen(false);\n setTimeout(() => {\n Modal.destroy(id);\n }, 200);\n };\n\n const footer =\n type === 'confirm' ? (\n <div className=\"grid w-full grid-cols-5 gap-x-2\">\n <Button\n variant=\"outlined\"\n className=\"col-span-2\"\n onClick={() => closeModal(onCancel)}\n >\n {cancelText}\n </Button>\n <Button className=\"col-span-3\" onClick={() => closeModal(onOk)}>\n {okText}\n </Button>\n </div>\n ) : (\n <Button\n className={cn(\n 'grow',\n //\n )}\n onClick={() => closeModal(onOk)}\n >\n {okText}\n </Button>\n );\n\n if (!isBrowser) {\n return null;\n }\n\n return createPortal(\n <Modal\n open={open}\n footer={footer}\n className={cn(\n 'z-10000',\n 'box-content w-100',\n 'rounded-3xl p-4',\n 'gap-y-0',\n )}\n classNames={{\n mask: 'z-10000 bg-black/[.6]',\n body: cn(\n 'text-black-70 whitespace-pre-wrap text-center',\n content && 'mt-3',\n ),\n footer: 'mt-9',\n }}\n title={\n <p\n className={cn(\n 'text-center text-lg leading-normal whitespace-pre-wrap',\n 'flex items-center justify-center gap-x-2',\n //\n )}\n >\n {icon || (type && STATIC_ICONS[type])}\n {title}\n </p>\n }\n container={container}\n onCancel={() => closeModal(onOk)}\n {...props}\n >\n {content}\n </Modal>,\n createModalRoot(container)!,\n );\n};\n\nconst ModalStackRenderer = () => {\n const [, forceUpdate] = useState({});\n\n useEffect(() => {\n updateStack = () => forceUpdate({});\n return () => {\n updateStack = null;\n };\n }, []);\n\n return (\n <>\n {modalStack.map(({ id, ...props }) => (\n <StaticModal key={id} id={id} {...props} />\n ))}\n </>\n );\n};\n\nconst modalRoots = new Map<HTMLElement, Root>();\n\nconst renderModal = (props: StaticProps) => {\n if (!isBrowser) {\n return;\n }\n\n const targetContainer = props.container || document.body;\n const rootElement = createModalRoot(targetContainer)!;\n\n if (!modalRoots.has(targetContainer)) {\n const root = createRoot(rootElement);\n modalRoots.set(targetContainer, root);\n root.render(<ModalStackRenderer />);\n }\n\n const id = props.id || uuid();\n modalStack.push({ ...props, id });\n updateStack?.();\n\n return id;\n};\n\nModal.destroy = (id?: string) => {\n modalStack = id ? modalStack.filter(modal => modal.id !== id) : [];\n\n updateStack?.();\n\n if (!modalStack.length && modalRoot) {\n modalRoot.unmount();\n modalRoot = null;\n }\n};\n\nModal.destroyAll = () => {\n Modal.destroy();\n};\n\nModal.info = (props: StaticProps) => renderModal({ type: 'info', ...props });\nModal.success = (props: StaticProps) =>\n renderModal({ type: 'success', ...props });\nModal.error = (props: StaticProps) => renderModal({ type: 'error', ...props });\nModal.warning = (props: StaticProps) =>\n renderModal({ type: 'warning', ...props });\nModal.confirm = (props: StaticProps) =>\n renderModal({ type: 'confirm', ...props });\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAM,EACJ,QACA,eACA,mBACA,cACA,cACA,gBACEA;AAsCJ,MAAM,YACJ,OAAO,WAAW,eAAe,OAAO,aAAa;AAEvD,IAAI,YAAyB;AAC7B,IAAI,aAA4B,EAAE;AAClC,IAAI,cAAmC;AAEvC,MAAM,mBAAmB,cAA4B;AACnD,KAAI,CAAC,UACH,QAAO;CAGT,MAAM,kBAAkB,aAAa,SAAS;CAC9C,IAAI,SAAS,gBAAgB,cAC3B,cACD;AAED,KAAI,CAAC,QAAQ;AACX,WAAS,SAAS,cAAc,MAAM;AACtC,SAAO,aAAa,MAAM,aAAa;AACvC,SAAO,aAAa,QAAQ,SAAS;AACrC,SAAO,aAAa,cAAc,OAAO;AACzC,SAAO,MAAM,SAAS;AACtB,SAAO,MAAM,WAAW;AACxB,kBAAgB,YAAY,OAAO;;AAGrC,QAAO;;AAGT,MAAM,SAAS,EACb,OAAO,OACP,eAAe,OACf,WAAW,OACX,WACA,WACA,YACA,OACA,OACA,QACA,WACA,UACA,SAAS,MACT,aAAa,UACb,MACA,UACA,GAAG,YACQ;AACX,KAAI,OAAO,WAAW,YACpB,QAAO;AAGT,QACE,oBAAC;EACO;EACN,eAAe,SAAkB;AAC/B,OAAI,CAAC,QAAQ,aACX,aAAY;;EAGhB,GAAI;YAEJ,qBAAC;GACC,WAAW,GACT,qCACA,4BACA,UACD;GACD,YAAY;IACV,GAAG;IACH,MAAM,GAAG,eAAe,YAAY,KAAK;IAC1C;GACM;GACP,iBAAiB,CAAC,CAAC;GACR;GACA;GACD;;IAMV,qBAAC;KACC,WAAW,GACT,YAAY,QACZ,CAAC,SAAS,SAEX;gBAED,oBAAC,yBAAa,QAAoB,EAClC,oBAAC,qBAAk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AW,GAAG;CAAO,CAAC;AAC5C,MAAM,WAAW,UACf,YAAY;CAAE,MAAM;CAAW,GAAG;CAAO,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":["dialog","uuid"],"sources":["../../../../src/components/organisms/Modal/index.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { Root, createRoot } from 'react-dom/client';\n\nimport {\n Check,\n CircleQuestionMark,\n Info,\n OctagonAlert,\n OctagonX,\n} from 'lucide-react';\nimport { v4 as uuid } from 'uuid';\n\nimport { Button } from '@repo/ui';\nimport { dialog } from '@repo/ui/core';\nimport { cn } from '@repo/ui/utils';\n\nconst {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} = dialog;\n\ninterface Props {\n open?: boolean;\n maskClosable?: boolean;\n closable?:\n | boolean\n | {\n closeIcon?: React.ReactNode;\n disabled?: boolean;\n };\n closeIcon?: React.ReactNode;\n title?: React.ReactNode;\n content?: React.ReactNode;\n footer?: React.ReactNode;\n className?: string;\n classNames?: {\n mask?: string;\n header?: string;\n body?: string;\n footer?: string;\n };\n style?: React.CSSProperties;\n okText?: string;\n cancelText?: string;\n container?: HTMLElement;\n children?: React.ReactNode;\n onOk?: () => void;\n onCancel?: () => void;\n}\n\ninterface StaticProps extends Props {\n type?: 'info' | 'success' | 'error' | 'warning' | 'confirm';\n id?: string;\n icon?: React.ReactNode;\n container?: HTMLElement;\n}\n\nconst isBrowser =\n typeof window !== 'undefined' && typeof document !== 'undefined';\n\nlet modalRoot: Root | null = null;\nlet modalStack: StaticProps[] = [];\nlet updateStack: (() => void) | null = null;\n\nconst createModalRoot = (container?: HTMLElement) => {\n if (!isBrowser) {\n return null;\n }\n\n const targetContainer = container || document.body;\n let rootEl = targetContainer.querySelector(\n '#modal-root',\n ) as HTMLElement | null;\n\n if (!rootEl) {\n rootEl = document.createElement('div');\n rootEl.setAttribute('id', 'modal-root');\n rootEl.setAttribute('role', 'dialog');\n rootEl.setAttribute('aria-modal', 'true');\n rootEl.style.zIndex = '10000';\n rootEl.style.position = 'absolute';\n targetContainer.appendChild(rootEl);\n }\n\n return rootEl;\n};\n\nconst Modal = ({\n open = false,\n maskClosable = false,\n closable = false,\n closeIcon,\n className,\n classNames,\n style,\n title,\n footer,\n container,\n children,\n okText = 'OK',\n cancelText = 'Cancel',\n onOk,\n onCancel,\n ...props\n}: Props) => {\n if (typeof window === 'undefined') {\n return null;\n }\n\n return (\n <Dialog\n open={open}\n onOpenChange={(open: boolean) => {\n if (!open && maskClosable) {\n onCancel?.();\n }\n }}\n {...props}\n >\n <DialogContent\n className={cn(\n 'rounded-lg p-4 max-sm:max-w-[80%]',\n 'border-none outline-none',\n className,\n )}\n classNames={{\n ...classNames,\n mask: cn('bg-black/60', classNames?.mask),\n }}\n style={style}\n showCloseButton={!!closable}\n closeIcon={closeIcon}\n container={container}\n onCancel={onCancel}\n >\n {/**\n * @todo [Dialog & AlertDialog] fix: can't get id correctly in shadow dom\n * @see https://github.com/radix-ui/primitives/pull/3384\n **/}\n <DialogHeader\n className={cn(\n classNames?.header,\n !title && 'hidden',\n //\n )}\n >\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription className=\"hidden\" />\n </DialogHeader>\n <div className={cn('break-all', classNames?.body)}>{children}</div>\n {footer !== null && (\n <DialogFooter\n className={cn('flex-row justify-end gap-x-2', classNames?.footer)}\n >\n {footer || (\n <>\n <Button onClick={onOk}>{okText}</Button>\n <Button variant=\"outlined\" onClick={onCancel}>\n {cancelText}\n </Button>\n </>\n )}\n </DialogFooter>\n )}\n </DialogContent>\n </Dialog>\n );\n};\n\nconst STATIC_ICONS = {\n info: <Info className=\"text-blue-400\" />,\n success: <Check className=\"text-green-400\" />,\n error: <OctagonX className=\"text-red-400\" />,\n warning: <OctagonAlert className=\"text-yellow-400\" />,\n confirm: <CircleQuestionMark />,\n};\n\nconst StaticModal = ({\n type,\n title,\n content,\n okText = 'OK',\n cancelText = 'Cancel',\n id,\n container,\n icon,\n onOk,\n onCancel,\n ...props\n}: StaticProps) => {\n const [open, setOpen] = useState(true);\n\n const closeModal = (callback?: () => void) => {\n callback?.();\n setOpen(false);\n setTimeout(() => {\n Modal.destroy(id);\n }, 200);\n };\n\n const footer =\n type === 'confirm' ? (\n <div className=\"grid w-full grid-cols-5 gap-x-2\">\n <Button\n variant=\"outlined\"\n className=\"col-span-2\"\n onClick={() => closeModal(onCancel)}\n >\n {cancelText}\n </Button>\n <Button className=\"col-span-3\" onClick={() => closeModal(onOk)}>\n {okText}\n </Button>\n </div>\n ) : (\n <Button\n className={cn(\n 'grow',\n //\n )}\n onClick={() => closeModal(onOk)}\n >\n {okText}\n </Button>\n );\n\n if (!isBrowser) {\n return null;\n }\n\n return createPortal(\n <Modal\n open={open}\n footer={footer}\n className={cn(\n 'z-10000',\n 'box-content w-100',\n 'rounded-3xl p-4',\n 'gap-y-0',\n )}\n classNames={{\n mask: 'z-10000 bg-black/[.6]',\n body: cn(\n 'text-black-70 whitespace-pre-wrap text-center',\n content && 'mt-3',\n ),\n footer: 'mt-9',\n }}\n title={\n <p\n className={cn(\n 'text-center text-lg leading-normal whitespace-pre-wrap',\n 'flex items-center justify-center gap-x-2',\n //\n )}\n >\n {icon || (type && STATIC_ICONS[type])}\n {title}\n </p>\n }\n container={container}\n onCancel={() => closeModal(onOk)}\n {...props}\n >\n {content}\n </Modal>,\n createModalRoot(container)!,\n );\n};\n\nconst ModalStackRenderer = () => {\n const [, forceUpdate] = useState({});\n\n useEffect(() => {\n updateStack = () => forceUpdate({});\n return () => {\n updateStack = null;\n };\n }, []);\n\n return (\n <>\n {modalStack.map(({ id, ...props }) => (\n <StaticModal key={id} id={id} {...props} />\n ))}\n </>\n );\n};\n\nconst modalRoots = new Map<HTMLElement, Root>();\n\nconst renderModal = (props: StaticProps) => {\n if (!isBrowser) {\n return;\n }\n\n const targetContainer = props.container || document.body;\n const rootElement = createModalRoot(targetContainer)!;\n\n if (!modalRoots.has(targetContainer)) {\n const root = createRoot(rootElement);\n modalRoots.set(targetContainer, root);\n root.render(<ModalStackRenderer />);\n }\n\n const id = props.id || uuid();\n modalStack.push({ ...props, id });\n updateStack?.();\n\n return id;\n};\n\nModal.destroy = (id?: string) => {\n modalStack = id ? modalStack.filter(modal => modal.id !== id) : [];\n\n updateStack?.();\n\n if (!modalStack.length && modalRoot) {\n modalRoot.unmount();\n modalRoot = null;\n }\n};\n\nModal.destroyAll = () => {\n Modal.destroy();\n};\n\nModal.info = (props: StaticProps) => renderModal({ type: 'info', ...props });\nModal.success = (props: StaticProps) =>\n renderModal({ type: 'success', ...props });\nModal.error = (props: StaticProps) => renderModal({ type: 'error', ...props });\nModal.warning = (props: StaticProps) =>\n renderModal({ type: 'warning', ...props });\nModal.confirm = (props: StaticProps) =>\n renderModal({ type: 'confirm', ...props });\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAM,EACJ,QACA,eACA,mBACA,cACA,cACA,gBACEA;AAsCJ,MAAM,YACJ,OAAO,WAAW,eAAe,OAAO,aAAa;AAEvD,IAAI,YAAyB;AAC7B,IAAI,aAA4B,EAAE;AAClC,IAAI,cAAmC;AAEvC,MAAM,mBAAmB,cAA4B;AACnD,KAAI,CAAC,UACH,QAAO;CAGT,MAAM,kBAAkB,aAAa,SAAS;CAC9C,IAAI,SAAS,gBAAgB,cAC3B,cACD;AAED,KAAI,CAAC,QAAQ;AACX,WAAS,SAAS,cAAc,MAAM;AACtC,SAAO,aAAa,MAAM,aAAa;AACvC,SAAO,aAAa,QAAQ,SAAS;AACrC,SAAO,aAAa,cAAc,OAAO;AACzC,SAAO,MAAM,SAAS;AACtB,SAAO,MAAM,WAAW;AACxB,kBAAgB,YAAY,OAAO;;AAGrC,QAAO;;AAGT,MAAM,SAAS,EACb,OAAO,OACP,eAAe,OACf,WAAW,OACX,WACA,WACA,YACA,OACA,OACA,QACA,WACA,UACA,SAAS,MACT,aAAa,UACb,MACA,UACA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MAAM,OAAO,GAAG,GAAG,EAAE;AAElE,gBAAe;AAEf,KAAI,CAAC,WAAW,UAAU,WAAW;AACnC,YAAU,SAAS;AACnB,cAAY;;;AAIhB,MAAM,mBAAmB;AACvB,OAAM,SAAS;;AAGjB,MAAM,QAAQ,UAAuB,YAAY;CAAE,MAAM;CAAQ,GAAG;CAAO,CAAC;AAC5E,MAAM,WAAW,UACf,YAAY;CAAE,MAAM;CAAW,GAAG;CAAO,CAAC;AAC5C,MAAM,SAAS,UAAuB,YAAY;CAAE,MAAM;CAAS,GAAG;CAAO,CAAC;AAC9E,MAAM,WAAW,UACf,YAAY;CAAE,MAAM;CAAW,GAAG;CAAO,CAAC;AAC5C,MAAM,WAAW,UACf,YAAY;CAAE,MAAM;CAAW,GAAG;CAAO,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Drawer } from "./Drawer/index.mjs";
1
+ import { Drawer, Props } from "./Drawer/index.mjs";
2
2
  import { List } from "./List/index.mjs";
3
3
  import { Modal } from "./Modal/index.mjs";
4
4
  import { Swiper } from "./Swiper/index.mjs";
@@ -1 +1,7 @@
1
- import "react/jsx-runtime";
1
+ import "react/jsx-runtime";
2
+
3
+ //#region src/components/templates/Layout/Content/index.d.ts
4
+ interface Props extends React.ComponentPropsWithoutRef<'main'> {}
5
+ //#endregion
6
+ export { Props };
7
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../../src/components/templates/Layout/Content/index.tsx"],"mappings":";;;UAEiB,KAAA,SAAc,KAAA,CAAM,wBAAA"}
@@ -3,8 +3,8 @@ import { jsx } from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/templates/Layout/Content/index.tsx
5
5
  const Content = ({ children, className, ...props }) => {
6
- return /* @__PURE__ */ jsx("div", {
7
- className: cn("shrink grow basis-0", className),
6
+ return /* @__PURE__ */ jsx("main", {
7
+ className: cn("min-h-0 min-w-0 shrink grow basis-0", className),
8
8
  ...props,
9
9
  children
10
10
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/templates/Layout/Content/index.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nconst Content = ({\n children,\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'div'>) => {\n return (\n <div className={cn('shrink grow basis-0', className)} {...props}>\n {children}\n </div>\n );\n};\n\nexport default Content;\n"],"mappings":";;;;AAEA,MAAM,WAAW,EACf,UACA,WACA,GAAG,YACwC;AAC3C,QACE,oBAAC;EAAI,WAAW,GAAG,uBAAuB,UAAU;EAAE,GAAI;EACvD;GACG"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/templates/Layout/Content/index.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nexport interface Props extends React.ComponentPropsWithoutRef<'main'> {}\n\nconst Content = ({ children, className, ...props }: Props) => {\n return (\n <main\n className={cn('min-h-0 min-w-0 shrink grow basis-0', className)}\n {...props}\n >\n {children}\n </main>\n );\n};\n\nexport default Content;\n"],"mappings":";;;;AAIA,MAAM,WAAW,EAAE,UAAU,WAAW,GAAG,YAAmB;AAC5D,QACE,oBAAC;EACC,WAAW,GAAG,uCAAuC,UAAU;EAC/D,GAAI;EAEH;GACI"}
@@ -1 +1,7 @@
1
- import "react/jsx-runtime";
1
+ import "react/jsx-runtime";
2
+
3
+ //#region src/components/templates/Layout/Footer/index.d.ts
4
+ interface Props extends React.ComponentPropsWithoutRef<'footer'> {}
5
+ //#endregion
6
+ export { Props };
7
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../../src/components/templates/Layout/Footer/index.tsx"],"mappings":";;;UAEiB,KAAA,SAAc,KAAA,CAAM,wBAAA"}
@@ -3,8 +3,8 @@ import { jsx } from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/templates/Layout/Footer/index.tsx
5
5
  const Footer = ({ children, className, ...props }) => {
6
- return /* @__PURE__ */ jsx("div", {
7
- className: cn(className, "w-full"),
6
+ return /* @__PURE__ */ jsx("footer", {
7
+ className: cn("w-full", className),
8
8
  ...props,
9
9
  children
10
10
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/templates/Layout/Footer/index.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nconst Footer = ({\n children,\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'div'>) => {\n return (\n <div className={cn(className, 'w-full')} {...props}>\n {children}\n </div>\n );\n};\n\nexport default Footer;\n"],"mappings":";;;;AAEA,MAAM,UAAU,EACd,UACA,WACA,GAAG,YACwC;AAC3C,QACE,oBAAC;EAAI,WAAW,GAAG,WAAW,SAAS;EAAE,GAAI;EAC1C;GACG"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/templates/Layout/Footer/index.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nexport interface Props extends React.ComponentPropsWithoutRef<'footer'> {}\n\nconst Footer = ({ children, className, ...props }: Props) => {\n return (\n <footer className={cn('w-full', className)} {...props}>\n {children}\n </footer>\n );\n};\n\nexport default Footer;\n"],"mappings":";;;;AAIA,MAAM,UAAU,EAAE,UAAU,WAAW,GAAG,YAAmB;AAC3D,QACE,oBAAC;EAAO,WAAW,GAAG,UAAU,UAAU;EAAE,GAAI;EAC7C;GACM"}
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
 
3
3
  //#region src/components/templates/Layout/Header/index.d.ts
4
- interface Props extends React.ComponentPropsWithoutRef<'div'> {}
4
+ interface Props extends React.ComponentPropsWithoutRef<'header'> {}
5
5
  //#endregion
6
6
  export { Props };
7
7
  //# sourceMappingURL=index.d.mts.map
@@ -3,8 +3,8 @@ import { jsx } from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/templates/Layout/Header/index.tsx
5
5
  const Header = ({ children, className, ...props }) => {
6
- return /* @__PURE__ */ jsx("div", {
7
- className: cn("sticky top-0 z-50", "flex w-full items-center justify-center px-5", className),
6
+ return /* @__PURE__ */ jsx("header", {
7
+ className: cn("sticky top-0 z-50", "flex h-16 w-full items-center px-5", className),
8
8
  ...props,
9
9
  children
10
10
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/templates/Layout/Header/index.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nexport interface Props extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst Header = ({ children, className, ...props }: Props) => {\n return (\n <div\n className={cn(\n 'sticky top-0 z-50',\n 'flex w-full items-center justify-center px-5',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nexport default Header;\n"],"mappings":";;;;AAIA,MAAM,UAAU,EAAE,UAAU,WAAW,GAAG,YAAmB;AAC3D,QACE,oBAAC;EACC,WAAW,GACT,qBACA,gDACA,UACD;EACD,GAAI;EAEH;GACG"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/templates/Layout/Header/index.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nexport interface Props extends React.ComponentPropsWithoutRef<'header'> {}\n\nconst Header = ({ children, className, ...props }: Props) => {\n return (\n <header\n className={cn(\n 'sticky top-0 z-50',\n 'flex h-16 w-full items-center px-5',\n className,\n //\n )}\n {...props}\n >\n {children}\n </header>\n );\n};\n\nexport default Header;\n"],"mappings":";;;;AAIA,MAAM,UAAU,EAAE,UAAU,WAAW,GAAG,YAAmB;AAC3D,QACE,oBAAC;EACC,WAAW,GACT,qBACA,sCACA,UAED;EACD,GAAI;EAEH;GACM"}
@@ -1 +1,19 @@
1
- import "react/jsx-runtime";
1
+ import "react/jsx-runtime";
2
+
3
+ //#region src/components/templates/Layout/Sider/index.d.ts
4
+ interface Props extends Omit<React.ComponentPropsWithoutRef<'aside'>, 'onCollapse'> {
5
+ width?: number | string;
6
+ collapsedWidth?: number | string;
7
+ collapsible?: boolean;
8
+ defaultCollapsed?: boolean;
9
+ collapsed?: boolean;
10
+ reverseArrow?: boolean;
11
+ trigger?: React.ReactNode;
12
+ classNames?: {
13
+ trigger?: string;
14
+ };
15
+ onCollapse?: (collapsed: boolean) => void;
16
+ }
17
+ //#endregion
18
+ export { Props };
19
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../../src/components/templates/Layout/Sider/index.tsx"],"mappings":";;;UAQiB,KAAA,SAAc,IAAA,CAC7B,KAAA,CAAM,wBAAA;EAGN,KAAA;EACA,cAAA;EACA,WAAA;EACA,gBAAA;EACA,SAAA;EACA,YAAA;EACA,OAAA,GAAU,KAAA,CAAM,SAAA;EAChB,UAAA;IACE,OAAA;EAAA;EAEF,UAAA,IAAc,SAAA;AAAA"}
@@ -1,12 +1,39 @@
1
+ 'use client';
2
+
1
3
  import { cn } from "../../../../utils.mjs";
2
- import { jsx } from "react/jsx-runtime";
4
+ import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
5
+ import { useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
3
7
 
4
8
  //#region src/components/templates/Layout/Sider/index.tsx
5
- const Sider = ({ children, className, ...props }) => {
6
- return /* @__PURE__ */ jsx("div", {
7
- className: cn("z-100", "w-50", className),
9
+ const toCssSize = (value) => typeof value === "number" ? `${value}px` : value;
10
+ const Sider = ({ children, className, classNames, style, width = 200, collapsedWidth = 80, collapsible = false, defaultCollapsed = false, collapsed: _collapsed, reverseArrow = false, trigger, onCollapse: _onCollapse = () => {}, ...props }) => {
11
+ const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState(defaultCollapsed);
12
+ const controlled = _collapsed !== void 0;
13
+ const collapsed = controlled ? _collapsed : uncontrolledCollapsed;
14
+ const onCollapse = () => {
15
+ const next = !collapsed;
16
+ if (!controlled) setUncontrolledCollapsed(next);
17
+ _onCollapse(next);
18
+ };
19
+ const TriggerIcon = collapsed !== reverseArrow ? PanelLeftOpen : PanelLeftClose;
20
+ return /* @__PURE__ */ jsxs("aside", {
21
+ className: cn("z-100 flex h-full shrink-0 flex-col overflow-hidden", "transition-[width] duration-200", className),
22
+ style: {
23
+ width: toCssSize(collapsed ? collapsedWidth : width),
24
+ ...style
25
+ },
8
26
  ...props,
9
- children
27
+ children: [/* @__PURE__ */ jsx("div", {
28
+ className: "min-h-0 flex-1 overflow-auto",
29
+ children
30
+ }), collapsible && /* @__PURE__ */ jsx("button", {
31
+ type: "button",
32
+ "aria-label": collapsed ? "펼치기" : "접기",
33
+ onClick: onCollapse,
34
+ className: cn("flex w-full shrink-0 items-center justify-center py-2", "cursor-pointer transition-colors hover:bg-black/5", classNames?.trigger),
35
+ children: trigger ?? /* @__PURE__ */ jsx(TriggerIcon, { className: "size-4" })
36
+ })]
10
37
  });
11
38
  };
12
39
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/templates/Layout/Sider/index.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nconst Sider = ({\n children,\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'div'>) => {\n return (\n <div\n className={cn(\n 'z-100',\n 'w-50',\n className,\n //\n )}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nexport default Sider;\n"],"mappings":";;;;AAEA,MAAM,SAAS,EACb,UACA,WACA,GAAG,YACwC;AAC3C,QACE,oBAAC;EACC,WAAW,GACT,SACA,QACA,UAED;EACD,GAAI;EAEH;GACG"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/templates/Layout/Sider/index.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { PanelLeftClose, PanelLeftOpen } from 'lucide-react';\n\nimport { cn } from '@repo/ui/utils';\n\nexport interface Props extends Omit<\n React.ComponentPropsWithoutRef<'aside'>,\n 'onCollapse'\n> {\n width?: number | string;\n collapsedWidth?: number | string;\n collapsible?: boolean;\n defaultCollapsed?: boolean;\n collapsed?: boolean;\n reverseArrow?: boolean;\n trigger?: React.ReactNode;\n classNames?: {\n trigger?: string;\n };\n onCollapse?: (collapsed: boolean) => void;\n}\n\nconst toCssSize = (value: number | string) =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst Sider = ({\n children,\n className,\n classNames,\n style,\n width = 200,\n collapsedWidth = 80,\n collapsible = false,\n defaultCollapsed = false,\n collapsed: _collapsed,\n reverseArrow = false,\n trigger,\n onCollapse: _onCollapse = () => {},\n ...props\n}: Props) => {\n const [uncontrolledCollapsed, setUncontrolledCollapsed] =\n useState(defaultCollapsed);\n\n const controlled = _collapsed !== undefined;\n const collapsed = controlled ? _collapsed : uncontrolledCollapsed;\n\n const onCollapse = () => {\n const next = !collapsed;\n\n if (!controlled) {\n setUncontrolledCollapsed(next);\n }\n _onCollapse(next);\n };\n\n const TriggerIcon =\n collapsed !== reverseArrow ? PanelLeftOpen : PanelLeftClose;\n\n return (\n <aside\n className={cn(\n 'z-100 flex h-full shrink-0 flex-col overflow-hidden',\n 'transition-[width] duration-200',\n className,\n //\n )}\n style={{\n width: toCssSize(collapsed ? collapsedWidth : width),\n ...style,\n }}\n {...props}\n >\n <div className=\"min-h-0 flex-1 overflow-auto\">{children}</div>\n {collapsible && (\n <button\n type=\"button\"\n aria-label={collapsed ? '펼치기' : '접기'}\n onClick={onCollapse}\n className={cn(\n 'flex w-full shrink-0 items-center justify-center py-2',\n 'cursor-pointer transition-colors hover:bg-black/5',\n classNames?.trigger,\n //\n )}\n >\n {trigger ?? <TriggerIcon className=\"size-4\" />}\n </button>\n )}\n </aside>\n );\n};\n\nexport default Sider;\n"],"mappings":";;;;;;;;AAyBA,MAAM,aAAa,UACjB,OAAO,UAAU,WAAW,GAAG,MAAM,MAAM;AAE7C,MAAM,SAAS,EACb,UACA,WACA,YACA,OACA,QAAQ,KACR,iBAAiB,IACjB,cAAc,OACd,mBAAmB,OACnB,WAAW,YACX,eAAe,OACf,SACA,YAAY,oBAAoB,IAChC,GAAG,YACQ;CACX,MAAM,CAAC,uBAAuB,4BAC5B,SAAS,iBAAiB;CAE5B,MAAM,aAAa,eAAe;CAClC,MAAM,YAAY,aAAa,aAAa;CAE5C,MAAM,mBAAmB;EACvB,MAAM,OAAO,CAAC;AAEd,MAAI,CAAC,WACH,0BAAyB,KAAK;AAEhC,cAAY,KAAK;;CAGnB,MAAM,cACJ,cAAc,eAAe,gBAAgB;AAE/C,QACE,qBAAC;EACC,WAAW,GACT,uDACA,mCACA,UAED;EACD,OAAO;GACL,OAAO,UAAU,YAAY,iBAAiB,MAAM;GACpD,GAAG;GACJ;EACD,GAAI;aAEJ,oBAAC;GAAI,WAAU;GAAgC;IAAe,EAC7D,eACC,oBAAC;GACC,MAAK;GACL,cAAY,YAAY,QAAQ;GAChC,SAAS;GACT,WAAW,GACT,yDACA,qDACA,YAAY,QAEb;aAEA,WAAW,oBAAC,eAAY,WAAU,WAAW;IACvC;GAEL"}
@@ -1,7 +1,7 @@
1
- import { Props as Props$1 } from "./Header/index.mjs";
2
- import "./Content/index.mjs";
3
- import "./Footer/index.mjs";
4
- import "./Sider/index.mjs";
1
+ import { Props as Props$1 } from "./Content/index.mjs";
2
+ import { Props as Props$2 } from "./Footer/index.mjs";
3
+ import { Props as Props$3 } from "./Header/index.mjs";
4
+ import { Props as Props$4 } from "./Sider/index.mjs";
5
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
6
6
 
7
7
  //#region src/components/templates/Layout/index.d.ts
@@ -16,22 +16,32 @@ declare const Layout: {
16
16
  children,
17
17
  className,
18
18
  ...props
19
- }: React.ComponentPropsWithoutRef<"div">) => react_jsx_runtime0.JSX.Element;
19
+ }: Props$1) => react_jsx_runtime0.JSX.Element;
20
20
  Footer: ({
21
21
  children,
22
22
  className,
23
23
  ...props
24
- }: React.ComponentPropsWithoutRef<"div">) => react_jsx_runtime0.JSX.Element;
24
+ }: Props$2) => react_jsx_runtime0.JSX.Element;
25
25
  Header: ({
26
26
  children,
27
27
  className,
28
28
  ...props
29
- }: Props$1) => react_jsx_runtime0.JSX.Element;
29
+ }: Props$3) => react_jsx_runtime0.JSX.Element;
30
30
  Sider: ({
31
31
  children,
32
32
  className,
33
+ classNames,
34
+ style,
35
+ width,
36
+ collapsedWidth,
37
+ collapsible,
38
+ defaultCollapsed,
39
+ collapsed: _collapsed,
40
+ reverseArrow,
41
+ trigger,
42
+ onCollapse: _onCollapse,
33
43
  ...props
34
- }: React.ComponentPropsWithoutRef<"div">) => react_jsx_runtime0.JSX.Element;
44
+ }: Props$4) => react_jsx_runtime0.JSX.Element;
35
45
  };
36
46
  //#endregion
37
47
  export { Layout };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/components/templates/Layout/index.tsx"],"mappings":";;;;;;;UAOiB,KAAA,SAAc,KAAA,CAAM,wBAAA;AAAA,cAE/B,MAAA;EAAA;;;;KAA6C,KAAA,GAAK,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/components/templates/Layout/index.tsx"],"mappings":";;;;;;;UAciB,KAAA,SAAc,KAAA,CAAM,wBAAA;AAAA,cAO/B,MAAA;EAAA;;;;KAA6C,KAAA,GAAK,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -3,12 +3,14 @@ import Content from "./Content/index.mjs";
3
3
  import Footer from "./Footer/index.mjs";
4
4
  import Header from "./Header/index.mjs";
5
5
  import Sider from "./Sider/index.mjs";
6
+ import { Children, isValidElement } from "react";
6
7
  import { jsx } from "react/jsx-runtime";
7
8
 
8
9
  //#region src/components/templates/Layout/index.tsx
10
+ const hasSiderChild = (children) => Children.toArray(children).some((child) => isValidElement(child) && child.type === Sider);
9
11
  const Layout = ({ children, className, ...props }) => {
10
12
  return /* @__PURE__ */ jsx("div", {
11
- className: cn("flex w-full flex-wrap content-start", className),
13
+ className: cn("flex min-h-0 w-full flex-1", hasSiderChild(children) ? "flex-row" : "flex-col", className),
12
14
  ...props,
13
15
  children
14
16
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/templates/Layout/index.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nimport Content from './Content';\nimport Footer from './Footer';\nimport Header from './Header';\nimport Sider from './Sider';\n\nexport interface Props extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst Layout = ({ children, className, ...props }: Props) => {\n return (\n <div\n className={cn('flex w-full flex-wrap content-start', className)}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nLayout.Content = Content;\nLayout.Footer = Footer;\nLayout.Header = Header;\nLayout.Sider = Sider;\n\nexport { Content, Footer, Header, Sider };\n\nexport default Layout;\n"],"mappings":";;;;;;;;AASA,MAAM,UAAU,EAAE,UAAU,WAAW,GAAG,YAAmB;AAC3D,QACE,oBAAC;EACC,WAAW,GAAG,uCAAuC,UAAU;EAC/D,GAAI;EAEH;GACG;;AAIV,OAAO,UAAU;AACjB,OAAO,SAAS;AAChB,OAAO,SAAS;AAChB,OAAO,QAAQ"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/templates/Layout/index.tsx"],"sourcesContent":["import { Children, isValidElement } from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport Content from './Content';\nimport Footer from './Footer';\nimport Header from './Header';\nimport Sider from './Sider';\n\nexport type { Props as ContentProps } from './Content';\nexport type { Props as FooterProps } from './Footer';\nexport type { Props as HeaderProps } from './Header';\nexport type { Props as SiderProps } from './Sider';\n\nexport interface Props extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst hasSiderChild = (children: React.ReactNode) =>\n Children.toArray(children).some(\n child => isValidElement(child) && child.type === Sider,\n );\n\nconst Layout = ({ children, className, ...props }: Props) => {\n const isRow = hasSiderChild(children);\n\n return (\n <div\n className={cn(\n 'flex min-h-0 w-full flex-1',\n isRow ? 'flex-row' : 'flex-col',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nLayout.Content = Content;\nLayout.Footer = Footer;\nLayout.Header = Header;\nLayout.Sider = Sider;\n\nexport default Layout;\n"],"mappings":";;;;;;;;;AAgBA,MAAM,iBAAiB,aACrB,SAAS,QAAQ,SAAS,CAAC,MACzB,UAAS,eAAe,MAAM,IAAI,MAAM,SAAS,MAClD;AAEH,MAAM,UAAU,EAAE,UAAU,WAAW,GAAG,YAAmB;AAG3D,QACE,oBAAC;EACC,WAAW,GACT,8BALQ,cAAc,SAAS,GAMvB,aAAa,YACrB,UACD;EACD,GAAI;EAEH;GACG;;AAIV,OAAO,UAAU;AACjB,OAAO,SAAS;AAChB,OAAO,SAAS;AAChB,OAAO,QAAQ"}
@@ -0,0 +1,24 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as ResizablePrimitive from "react-resizable-panels";
3
+
4
+ //#region src/core/resizable.d.ts
5
+ declare namespace resizable_d_exports {
6
+ export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
7
+ }
8
+ declare function ResizablePanelGroup({
9
+ className,
10
+ ...props
11
+ }: ResizablePrimitive.GroupProps): react_jsx_runtime0.JSX.Element;
12
+ declare function ResizablePanel({
13
+ ...props
14
+ }: ResizablePrimitive.PanelProps): react_jsx_runtime0.JSX.Element;
15
+ declare function ResizableHandle({
16
+ withHandle,
17
+ className,
18
+ ...props
19
+ }: ResizablePrimitive.SeparatorProps & {
20
+ withHandle?: boolean;
21
+ }): react_jsx_runtime0.JSX.Element;
22
+ //#endregion
23
+ export { ResizablePanel, ResizablePanelGroup, resizable_d_exports };
24
+ //# sourceMappingURL=resizable.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizable.d.mts","names":[],"sources":["../../src/core/resizable.tsx"],"mappings":";;;;;;;iBAQS,mBAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,kBAAA,CAAmB,UAAA,GAAU,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAavB,cAAA,CAAA;EAAA,GAAoB;AAAA,GAAS,kBAAA,CAAmB,UAAA,GAAU,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI1D,eAAA,CAAA;EACP,UAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,kBAAA,CAAmB,cAAA;EACpB,UAAA;AAAA,IACD,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -0,0 +1,52 @@
1
+ 'use client';
2
+
3
+ import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
4
+ import { cn } from "../utils.mjs";
5
+ import { GripVerticalIcon } from "lucide-react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import * as ResizablePrimitive from "react-resizable-panels";
8
+
9
+ //#region src/core/resizable.tsx
10
+ var resizable_exports = /* @__PURE__ */ __exportAll({
11
+ ResizableHandle: () => ResizableHandle,
12
+ ResizablePanel: () => ResizablePanel,
13
+ ResizablePanelGroup: () => ResizablePanelGroup
14
+ });
15
+ function ResizablePanelGroup({ className, ...props }) {
16
+ return /* @__PURE__ */ jsx(ResizablePrimitive.Group, {
17
+ "data-slot": "resizable-panel-group",
18
+ className: cn("flex h-full w-full aria-[orientation=vertical]:flex-col", className),
19
+ ...props
20
+ });
21
+ }
22
+ function ResizablePanel({ ...props }) {
23
+ return /* @__PURE__ */ jsx(ResizablePrimitive.Panel, {
24
+ "data-slot": "resizable-panel",
25
+ ...props
26
+ });
27
+ }
28
+ function ResizableHandle({ withHandle, className, ...props }) {
29
+ return /* @__PURE__ */ jsx(ResizablePrimitive.Separator, {
30
+ "data-slot": "resizable-handle",
31
+ className: cn(`bg-border focus-visible:ring-ring relative flex w-px items-center
32
+ justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1
33
+ after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1
34
+ focus-visible:outline-hidden aria-[orientation=horizontal]:h-px
35
+ aria-[orientation=horizontal]:w-full
36
+ aria-[orientation=horizontal]:after:left-0
37
+ aria-[orientation=horizontal]:after:h-1
38
+ aria-[orientation=horizontal]:after:w-full
39
+ aria-[orientation=horizontal]:after:translate-x-0
40
+ aria-[orientation=horizontal]:after:-translate-y-1/2
41
+ [&[aria-orientation=horizontal]>div]:rotate-90`, className),
42
+ ...props,
43
+ children: withHandle && /* @__PURE__ */ jsx("div", {
44
+ className: "bg-border z-10 flex h-4 w-3 items-center justify-center\n rounded-xs border",
45
+ children: /* @__PURE__ */ jsx(GripVerticalIcon, { className: "size-2.5" })
46
+ })
47
+ });
48
+ }
49
+
50
+ //#endregion
51
+ export { resizable_exports };
52
+ //# sourceMappingURL=resizable.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizable.mjs","names":[],"sources":["../../src/core/resizable.tsx"],"sourcesContent":["'use client';\n\nimport * as ResizablePrimitive from 'react-resizable-panels';\n\nimport { GripVerticalIcon } from 'lucide-react';\n\nimport { cn } from '@repo/ui/utils';\n\nfunction ResizablePanelGroup({\n className,\n ...props\n}: ResizablePrimitive.GroupProps) {\n return (\n <ResizablePrimitive.Group\n data-slot=\"resizable-panel-group\"\n className={cn(\n 'flex h-full w-full aria-[orientation=vertical]:flex-col',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {\n return <ResizablePrimitive.Panel data-slot=\"resizable-panel\" {...props} />;\n}\n\nfunction ResizableHandle({\n withHandle,\n className,\n ...props\n}: ResizablePrimitive.SeparatorProps & {\n withHandle?: boolean;\n}) {\n return (\n <ResizablePrimitive.Separator\n data-slot=\"resizable-handle\"\n className={cn(\n `bg-border focus-visible:ring-ring relative flex w-px items-center\n justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1\n after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1\n focus-visible:outline-hidden aria-[orientation=horizontal]:h-px\n aria-[orientation=horizontal]:w-full\n aria-[orientation=horizontal]:after:left-0\n aria-[orientation=horizontal]:after:h-1\n aria-[orientation=horizontal]:after:w-full\n aria-[orientation=horizontal]:after:translate-x-0\n aria-[orientation=horizontal]:after:-translate-y-1/2\n [&[aria-orientation=horizontal]>div]:rotate-90`,\n className,\n )}\n {...props}\n >\n {withHandle && (\n <div\n className=\"bg-border z-10 flex h-4 w-3 items-center justify-center\n rounded-xs border\"\n >\n <GripVerticalIcon className=\"size-2.5\" />\n </div>\n )}\n </ResizablePrimitive.Separator>\n );\n}\n\nexport { ResizableHandle, ResizablePanel, ResizablePanelGroup };\n"],"mappings":";;;;;;;;;;;;;;AAQA,SAAS,oBAAoB,EAC3B,WACA,GAAG,SAC6B;AAChC,QACE,oBAAC,mBAAmB;EAClB,aAAU;EACV,WAAW,GACT,2DACA,UACD;EACD,GAAI;GACJ;;AAIN,SAAS,eAAe,EAAE,GAAG,SAAwC;AACnE,QAAO,oBAAC,mBAAmB;EAAM,aAAU;EAAkB,GAAI;GAAS;;AAG5E,SAAS,gBAAgB,EACvB,YACA,WACA,GAAG,SAGF;AACD,QACE,oBAAC,mBAAmB;EAClB,aAAU;EACV,WAAW,GACT;;;;;;;;;;yDAWA,UACD;EACD,GAAI;YAEH,cACC,oBAAC;GACC,WAAU;aAGV,oBAAC,oBAAiB,WAAU,aAAa;IACrC;GAEqB"}
package/dist/core.d.mts CHANGED
@@ -9,9 +9,10 @@ import { input_d_exports } from "./core/input.mjs";
9
9
  import { popover_d_exports } from "./core/popover.mjs";
10
10
  import { progress_d_exports } from "./core/progress.mjs";
11
11
  import { radio_group_d_exports } from "./core/radio-group.mjs";
12
+ import { resizable_d_exports } from "./core/resizable.mjs";
12
13
  import { select_d_exports } from "./core/select.mjs";
13
14
  import { separator_d_exports } from "./core/separator.mjs";
14
15
  import { skeleton_d_exports } from "./core/skeleton.mjs";
15
16
  import { switch_d_exports } from "./core/switch.mjs";
16
17
  import { textarea_d_exports } from "./core/textarea.mjs";
17
- export { accordion_d_exports as accordion, button_d_exports as button, checkbox_d_exports as checkbox, dialog_d_exports as dialog, drawer_d_exports as drawer, field_d_exports as field, input_d_exports as input, label_d_exports as label, popover_d_exports as popover, progress_d_exports as progress, radio_group_d_exports as radio, select_d_exports as select, separator_d_exports as separator, skeleton_d_exports as skeleton, switch_d_exports as switchComponent, textarea_d_exports as textarea };
18
+ export { accordion_d_exports as accordion, button_d_exports as button, checkbox_d_exports as checkbox, dialog_d_exports as dialog, drawer_d_exports as drawer, field_d_exports as field, input_d_exports as input, label_d_exports as label, popover_d_exports as popover, progress_d_exports as progress, radio_group_d_exports as radio, resizable_d_exports as resizable, select_d_exports as select, separator_d_exports as separator, skeleton_d_exports as skeleton, switch_d_exports as switchComponent, textarea_d_exports as textarea };
package/dist/core.mjs CHANGED
@@ -10,9 +10,10 @@ import { input_exports } from "./core/input.mjs";
10
10
  import { popover_exports } from "./core/popover.mjs";
11
11
  import { progress_exports } from "./core/progress.mjs";
12
12
  import { radio_group_exports } from "./core/radio-group.mjs";
13
+ import { resizable_exports } from "./core/resizable.mjs";
13
14
  import { select_exports } from "./core/select.mjs";
14
15
  import { skeleton_exports } from "./core/skeleton.mjs";
15
16
  import { switch_exports } from "./core/switch.mjs";
16
17
  import { textarea_exports } from "./core/textarea.mjs";
17
18
 
18
- export { accordion_exports as accordion, button_exports as button, checkbox_exports as checkbox, dialog_exports as dialog, drawer_exports as drawer, field_exports as field, input_exports as input, label_exports as label, popover_exports as popover, progress_exports as progress, radio_group_exports as radio, select_exports as select, separator_exports as separator, skeleton_exports as skeleton, switch_exports as switchComponent, textarea_exports as textarea };
19
+ export { accordion_exports as accordion, button_exports as button, checkbox_exports as checkbox, dialog_exports as dialog, drawer_exports as drawer, field_exports as field, input_exports as input, label_exports as label, popover_exports as popover, progress_exports as progress, radio_group_exports as radio, resizable_exports as resizable, select_exports as select, separator_exports as separator, skeleton_exports as skeleton, switch_exports as switchComponent, textarea_exports as textarea };