@loword/loword-design-system 0.0.4 → 0.0.5
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/package.json +2 -2
- package/dist/components/Avatar/Avatar.d.ts +0 -11
- package/dist/components/Avatar/Avatar.d.ts.map +0 -1
- package/dist/components/Avatar/Avatar.js +0 -24
- package/dist/components/Avatar/AvatarBase.d.ts +0 -32
- package/dist/components/Avatar/AvatarBase.d.ts.map +0 -1
- package/dist/components/Avatar/AvatarBase.js +0 -49
- package/dist/components/Badge/Badge.d.ts +0 -25
- package/dist/components/Badge/Badge.d.ts.map +0 -1
- package/dist/components/Badge/Badge.js +0 -36
- package/dist/components/Badge/BadgeBase.d.ts +0 -10
- package/dist/components/Badge/BadgeBase.d.ts.map +0 -1
- package/dist/components/Badge/BadgeBase.js +0 -9
- package/dist/components/BreadCrumb/BreadCrumb.d.ts +0 -17
- package/dist/components/BreadCrumb/BreadCrumb.d.ts.map +0 -1
- package/dist/components/BreadCrumb/BreadCrumb.js +0 -37
- package/dist/components/BreadCrumb/BreadCrumbBase.d.ts +0 -9
- package/dist/components/BreadCrumb/BreadCrumbBase.d.ts.map +0 -1
- package/dist/components/BreadCrumb/BreadCrumbBase.js +0 -17
- package/dist/components/Button/Button.d.ts +0 -26
- package/dist/components/Button/Button.d.ts.map +0 -1
- package/dist/components/Button/Button.js +0 -102
- package/dist/components/Button/ButtonBase.d.ts +0 -5
- package/dist/components/Button/ButtonBase.d.ts.map +0 -1
- package/dist/components/Button/ButtonBase.js +0 -10
- package/dist/components/Button/ButtonSpinner.d.ts +0 -8
- package/dist/components/Button/ButtonSpinner.d.ts.map +0 -1
- package/dist/components/Button/ButtonSpinner.js +0 -15
- package/dist/components/Calendar/Calendar.d.ts +0 -16
- package/dist/components/Calendar/Calendar.d.ts.map +0 -1
- package/dist/components/Calendar/Calendar.js +0 -75
- package/dist/components/Callout/Callout.d.ts +0 -10
- package/dist/components/Callout/Callout.d.ts.map +0 -1
- package/dist/components/Callout/Callout.js +0 -6
- package/dist/components/Callout/CalloutBase.d.ts +0 -18
- package/dist/components/Callout/CalloutBase.d.ts.map +0 -1
- package/dist/components/Callout/CalloutBase.js +0 -21
- package/dist/components/Carousel/Carousel.d.ts +0 -50
- package/dist/components/Carousel/Carousel.d.ts.map +0 -1
- package/dist/components/Carousel/Carousel.js +0 -22
- package/dist/components/Carousel/CarouselBase.d.ts +0 -98
- package/dist/components/Carousel/CarouselBase.d.ts.map +0 -1
- package/dist/components/Carousel/CarouselBase.js +0 -144
- package/dist/components/Checkbox/Checkbox.d.ts +0 -27
- package/dist/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/dist/components/Checkbox/Checkbox.js +0 -30
- package/dist/components/Checkbox/CheckboxBase.d.ts +0 -40
- package/dist/components/Checkbox/CheckboxBase.d.ts.map +0 -1
- package/dist/components/Checkbox/CheckboxBase.js +0 -57
- package/dist/components/Checkbox/CheckboxGroup.d.ts +0 -22
- package/dist/components/Checkbox/CheckboxGroup.d.ts.map +0 -1
- package/dist/components/Checkbox/CheckboxGroup.js +0 -13
- package/dist/components/Checkbox/FormCheckbox.d.ts +0 -14
- package/dist/components/Checkbox/FormCheckbox.d.ts.map +0 -1
- package/dist/components/Checkbox/FormCheckbox.js +0 -9
- package/dist/components/Checkbox/FormCheckboxGroup.d.ts +0 -13
- package/dist/components/Checkbox/FormCheckboxGroup.d.ts.map +0 -1
- package/dist/components/Checkbox/FormCheckboxGroup.js +0 -9
- package/dist/components/DataCalendar/DataCalendar.d.ts +0 -12
- package/dist/components/DataCalendar/DataCalendar.d.ts.map +0 -1
- package/dist/components/DataCalendar/DataCalendar.js +0 -13
- package/dist/components/DataCalendar/DataCalendarBase.d.ts +0 -45
- package/dist/components/DataCalendar/DataCalendarBase.d.ts.map +0 -1
- package/dist/components/DataCalendar/DataCalendarBase.js +0 -57
- package/dist/components/DatePicker/DatePicker.d.ts +0 -34
- package/dist/components/DatePicker/DatePicker.d.ts.map +0 -1
- package/dist/components/DatePicker/DatePicker.js +0 -44
- package/dist/components/DatePicker/FormDatePicker.d.ts +0 -12
- package/dist/components/DatePicker/FormDatePicker.d.ts.map +0 -1
- package/dist/components/DatePicker/FormDatePicker.js +0 -12
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +0 -49
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +0 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +0 -197
- package/dist/components/DateRangePicker/FormDateRangePicker.d.ts +0 -12
- package/dist/components/DateRangePicker/FormDateRangePicker.d.ts.map +0 -1
- package/dist/components/DateRangePicker/FormDateRangePicker.js +0 -10
- package/dist/components/Divider/Divider.d.ts +0 -9
- package/dist/components/Divider/Divider.d.ts.map +0 -1
- package/dist/components/Divider/Divider.js +0 -11
- package/dist/components/Divider/DividerBase.d.ts +0 -9
- package/dist/components/Divider/DividerBase.d.ts.map +0 -1
- package/dist/components/Divider/DividerBase.js +0 -9
- package/dist/components/Drawer/Drawer.d.ts +0 -51
- package/dist/components/Drawer/Drawer.d.ts.map +0 -1
- package/dist/components/Drawer/Drawer.js +0 -30
- package/dist/components/Drawer/DrawerBase.d.ts +0 -52
- package/dist/components/Drawer/DrawerBase.d.ts.map +0 -1
- package/dist/components/Drawer/DrawerBase.js +0 -38
- package/dist/components/Editor/Editor.d.ts +0 -12
- package/dist/components/Editor/Editor.d.ts.map +0 -1
- package/dist/components/Editor/Editor.js +0 -162
- package/dist/components/Editor/EditorBase.d.ts +0 -52
- package/dist/components/Editor/EditorBase.d.ts.map +0 -1
- package/dist/components/Editor/EditorBase.js +0 -89
- package/dist/components/Editor/Viewer.d.ts +0 -7
- package/dist/components/Editor/Viewer.d.ts.map +0 -1
- package/dist/components/Editor/Viewer.js +0 -9
- package/dist/components/Editor/extensions.d.ts +0 -6
- package/dist/components/Editor/extensions.d.ts.map +0 -1
- package/dist/components/Editor/extensions.js +0 -38
- package/dist/components/FileUpload/FileUploadBase.d.ts +0 -50
- package/dist/components/FileUpload/FileUploadBase.d.ts.map +0 -1
- package/dist/components/FileUpload/FileUploadBase.js +0 -102
- package/dist/components/Input/FormInput.d.ts +0 -15
- package/dist/components/Input/FormInput.d.ts.map +0 -1
- package/dist/components/Input/FormInput.js +0 -19
- package/dist/components/Input/Input.d.ts +0 -24
- package/dist/components/Input/Input.d.ts.map +0 -1
- package/dist/components/Input/Input.js +0 -71
- package/dist/components/Input/InputBase.d.ts +0 -22
- package/dist/components/Input/InputBase.d.ts.map +0 -1
- package/dist/components/Input/InputBase.js +0 -17
- package/dist/components/LNB/LNBBase.d.ts +0 -82
- package/dist/components/LNB/LNBBase.d.ts.map +0 -1
- package/dist/components/LNB/LNBBase.js +0 -108
- package/dist/components/LoadingDots/LoadingDots.d.ts +0 -8
- package/dist/components/LoadingDots/LoadingDots.d.ts.map +0 -1
- package/dist/components/LoadingDots/LoadingDots.js +0 -29
- package/dist/components/MenuBar/MenuBar.d.ts +0 -21
- package/dist/components/MenuBar/MenuBar.d.ts.map +0 -1
- package/dist/components/MenuBar/MenuBar.js +0 -33
- package/dist/components/MenuBar/MenuBarBase.d.ts +0 -43
- package/dist/components/MenuBar/MenuBarBase.d.ts.map +0 -1
- package/dist/components/MenuBar/MenuBarBase.js +0 -69
- package/dist/components/Modal/Modal.d.ts +0 -51
- package/dist/components/Modal/Modal.d.ts.map +0 -1
- package/dist/components/Modal/Modal.js +0 -72
- package/dist/components/Modal/ModalBase.d.ts +0 -42
- package/dist/components/Modal/ModalBase.d.ts.map +0 -1
- package/dist/components/Modal/ModalBase.js +0 -30
- package/dist/components/Modal/openModal.d.ts +0 -24
- package/dist/components/Modal/openModal.d.ts.map +0 -1
- package/dist/components/Modal/openModal.js +0 -52
- package/dist/components/OTPInput/OTPInput.d.ts +0 -46
- package/dist/components/OTPInput/OTPInput.d.ts.map +0 -1
- package/dist/components/OTPInput/OTPInput.js +0 -87
- package/dist/components/Pagination/Pagination.d.ts +0 -12
- package/dist/components/Pagination/Pagination.d.ts.map +0 -1
- package/dist/components/Pagination/Pagination.js +0 -5
- package/dist/components/Pagination/PaginationBase.d.ts +0 -36
- package/dist/components/Pagination/PaginationBase.d.ts.map +0 -1
- package/dist/components/Pagination/PaginationBase.js +0 -44
- package/dist/components/Pagination/paginationUtils.d.ts +0 -2
- package/dist/components/Pagination/paginationUtils.d.ts.map +0 -1
- package/dist/components/Pagination/paginationUtils.js +0 -18
- package/dist/components/Popover/Popover.d.ts +0 -42
- package/dist/components/Popover/Popover.d.ts.map +0 -1
- package/dist/components/Popover/Popover.js +0 -31
- package/dist/components/Popover/PopoverBase.d.ts +0 -31
- package/dist/components/Popover/PopoverBase.d.ts.map +0 -1
- package/dist/components/Popover/PopoverBase.js +0 -18
- package/dist/components/Radio/FormRadioGroup.d.ts +0 -13
- package/dist/components/Radio/FormRadioGroup.d.ts.map +0 -1
- package/dist/components/Radio/FormRadioGroup.js +0 -9
- package/dist/components/Radio/Radio.d.ts +0 -24
- package/dist/components/Radio/Radio.d.ts.map +0 -1
- package/dist/components/Radio/Radio.js +0 -39
- package/dist/components/Radio/RadioBase.d.ts +0 -38
- package/dist/components/Radio/RadioBase.d.ts.map +0 -1
- package/dist/components/Radio/RadioBase.js +0 -46
- package/dist/components/Radio/RadioGroup.d.ts +0 -22
- package/dist/components/Radio/RadioGroup.d.ts.map +0 -1
- package/dist/components/Radio/RadioGroup.js +0 -7
- package/dist/components/ScrollArea/ScrollArea.d.ts +0 -15
- package/dist/components/ScrollArea/ScrollArea.d.ts.map +0 -1
- package/dist/components/ScrollArea/ScrollArea.js +0 -10
- package/dist/components/Select/FormMultiSelect.d.ts +0 -13
- package/dist/components/Select/FormMultiSelect.d.ts.map +0 -1
- package/dist/components/Select/FormMultiSelect.js +0 -14
- package/dist/components/Select/FormSelect.d.ts +0 -13
- package/dist/components/Select/FormSelect.d.ts.map +0 -1
- package/dist/components/Select/FormSelect.js +0 -10
- package/dist/components/Select/MultiSelect.d.ts +0 -31
- package/dist/components/Select/MultiSelect.d.ts.map +0 -1
- package/dist/components/Select/MultiSelect.js +0 -59
- package/dist/components/Select/Select.d.ts +0 -41
- package/dist/components/Select/Select.d.ts.map +0 -1
- package/dist/components/Select/Select.js +0 -55
- package/dist/components/Select/SelectBase.d.ts +0 -59
- package/dist/components/Select/SelectBase.d.ts.map +0 -1
- package/dist/components/Select/SelectBase.js +0 -211
- package/dist/components/Skeleton/Skeleton.d.ts +0 -10
- package/dist/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/dist/components/Skeleton/Skeleton.js +0 -8
- package/dist/components/Slider/Slider.d.ts +0 -23
- package/dist/components/Slider/Slider.d.ts.map +0 -1
- package/dist/components/Slider/Slider.js +0 -195
- package/dist/components/Spinner/Spinner.d.ts +0 -25
- package/dist/components/Spinner/Spinner.d.ts.map +0 -1
- package/dist/components/Spinner/Spinner.js +0 -20
- package/dist/components/Table/Table.d.ts +0 -34
- package/dist/components/Table/Table.d.ts.map +0 -1
- package/dist/components/Table/Table.js +0 -29
- package/dist/components/Table/TableBase.d.ts +0 -37
- package/dist/components/Table/TableBase.d.ts.map +0 -1
- package/dist/components/Table/TableBase.js +0 -39
- package/dist/components/Table/TableField.d.ts +0 -64
- package/dist/components/Table/TableField.d.ts.map +0 -1
- package/dist/components/Table/TableField.js +0 -87
- package/dist/components/Table/TanstackTable.d.ts +0 -23
- package/dist/components/Table/TanstackTable.d.ts.map +0 -1
- package/dist/components/Table/TanstackTable.js +0 -35
- package/dist/components/TimePicker/FormTimePicker.d.ts +0 -12
- package/dist/components/TimePicker/FormTimePicker.d.ts.map +0 -1
- package/dist/components/TimePicker/FormTimePicker.js +0 -12
- package/dist/components/TimePicker/TimePicker.d.ts +0 -27
- package/dist/components/TimePicker/TimePicker.d.ts.map +0 -1
- package/dist/components/TimePicker/TimePicker.js +0 -120
- package/dist/components/Toast/Toast.d.ts +0 -18
- package/dist/components/Toast/Toast.d.ts.map +0 -1
- package/dist/components/Toast/Toast.js +0 -42
- package/dist/components/Toast/Toaster.d.ts +0 -7
- package/dist/components/Toast/Toaster.d.ts.map +0 -1
- package/dist/components/Toast/Toaster.js +0 -7
- package/dist/components/ToggleButton/FormToggleButton.d.ts +0 -12
- package/dist/components/ToggleButton/FormToggleButton.d.ts.map +0 -1
- package/dist/components/ToggleButton/FormToggleButton.js +0 -9
- package/dist/components/ToggleButton/ToggleButton.d.ts +0 -31
- package/dist/components/ToggleButton/ToggleButton.d.ts.map +0 -1
- package/dist/components/ToggleButton/ToggleButton.js +0 -42
- package/dist/components/ToggleButton/ToggleButtonBase.d.ts +0 -41
- package/dist/components/ToggleButton/ToggleButtonBase.d.ts.map +0 -1
- package/dist/components/ToggleButton/ToggleButtonBase.js +0 -59
- package/dist/components/Tooltip/Tooltip.d.ts +0 -18
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.js +0 -13
- package/dist/components/Tooltip/TooltipBase.d.ts +0 -39
- package/dist/components/Tooltip/TooltipBase.d.ts.map +0 -1
- package/dist/components/Tooltip/TooltipBase.js +0 -46
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DividerBase.d.ts","sourceRoot":"","sources":["../../../src/components/Divider/DividerBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAGtD,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC1E,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAYD,eAAO,MAAM,WAAW;yCAVoB,oBAAoB;CAY/D,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import cn from '../../utils/cn.js';
|
|
3
|
-
const Root = ({ ref, className, ...props }) => {
|
|
4
|
-
return (_jsx("div", { ref: ref, className: cn('shrink-0 bg-neutral100', className), ...props }));
|
|
5
|
-
};
|
|
6
|
-
export const DividerBase = {
|
|
7
|
-
Root,
|
|
8
|
-
};
|
|
9
|
-
export default DividerBase;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
type DrawerDirection = 'bottom' | 'top' | 'left' | 'right';
|
|
3
|
-
export interface DrawerButton<T = unknown> {
|
|
4
|
-
/** 버튼 텍스트 */
|
|
5
|
-
label: string;
|
|
6
|
-
/** 버튼 식별 값 (onButtonClick에 전달) */
|
|
7
|
-
value: T;
|
|
8
|
-
/** 버튼 스타일 유형 */
|
|
9
|
-
variant?: 'solid' | 'outline' | 'ghost';
|
|
10
|
-
/** 버튼 색상 테마 */
|
|
11
|
-
color?: 'neutral' | 'point' | 'danger';
|
|
12
|
-
/** 클릭 핸들러 (false 반환 시 Drawer 닫힘 방지) */
|
|
13
|
-
onClick?: () => void | boolean | Promise<void | boolean>;
|
|
14
|
-
}
|
|
15
|
-
export interface DrawerProps {
|
|
16
|
-
/** Drawer 열림 상태 (제어 컴포넌트) */
|
|
17
|
-
open?: boolean;
|
|
18
|
-
/** 초기 열림 상태 (비제어 컴포넌트) */
|
|
19
|
-
defaultOpen?: boolean;
|
|
20
|
-
/** 열림 상태 변경 시 호출되는 콜백 */
|
|
21
|
-
onOpenChange?: (open: boolean) => void;
|
|
22
|
-
/** 슬라이드 방향 */
|
|
23
|
-
direction?: DrawerDirection;
|
|
24
|
-
/** 높이 스냅 포인트 (bottom/top 전용, 0~1 비율 또는 px 문자열) */
|
|
25
|
-
snapPoints?: (number | string)[];
|
|
26
|
-
/** 현재 활성 스냅 포인트 */
|
|
27
|
-
activeSnapPoint?: number | string | null;
|
|
28
|
-
/** 스냅 포인트 변경 콜백 */
|
|
29
|
-
setActiveSnapPoint?: (snapPoint: number | string | null) => void;
|
|
30
|
-
/** Drawer 제목 */
|
|
31
|
-
title?: string;
|
|
32
|
-
/** Drawer 설명 텍스트 */
|
|
33
|
-
description?: string;
|
|
34
|
-
/** 본문 콘텐츠 */
|
|
35
|
-
children?: ReactNode;
|
|
36
|
-
/** 하단 버튼 목록 */
|
|
37
|
-
buttons?: DrawerButton[];
|
|
38
|
-
/** Drawer를 여는 트리거 요소 */
|
|
39
|
-
trigger?: ReactNode;
|
|
40
|
-
/** 드래그 핸들 표시 여부 (bottom/top 방향에서 기본 true) */
|
|
41
|
-
showHandle?: boolean;
|
|
42
|
-
/** 추가 CSS 클래스 (Drawer 패널에 적용) */
|
|
43
|
-
className?: string;
|
|
44
|
-
/** 인라인 스타일 (Drawer 패널에 적용) */
|
|
45
|
-
style?: React.CSSProperties;
|
|
46
|
-
/** 버튼 클릭 시 해당 버튼의 value를 전달하는 콜백 */
|
|
47
|
-
onButtonClick?: (value: unknown) => void;
|
|
48
|
-
}
|
|
49
|
-
declare const Drawer: ({ open, defaultOpen, onOpenChange, direction, snapPoints, activeSnapPoint, setActiveSnapPoint, title, description, children, buttons, trigger, showHandle, className, style, onButtonClick, }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
-
export default Drawer;
|
|
51
|
-
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,KAAK,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,aAAa;IACb,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,KAAK,EAAE,CAAC,CAAC;IACT,gBAAgB;IAChB,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IACxC,eAAe;IACf,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IACvC,uCAAuC;IACv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
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import DrawerBase from './DrawerBase.js';
|
|
3
|
-
import LucideIcon from '../Icon/LucideIcon.js';
|
|
4
|
-
import Button from '../Button/Button.js';
|
|
5
|
-
import cn from '../../utils/cn.js';
|
|
6
|
-
// ── 방향별 스타일 매핑 ──
|
|
7
|
-
const directionClasses = {
|
|
8
|
-
bottom: 'bottom-0 left-0 right-0 rounded-t-2xl max-h-[95dvh] flex flex-col',
|
|
9
|
-
top: 'top-0 left-0 right-0 rounded-b-2xl max-h-[95dvh] flex flex-col',
|
|
10
|
-
left: 'left-0 top-0 bottom-0 rounded-r-2xl w-[400px] h-full flex flex-col',
|
|
11
|
-
right: 'right-0 top-0 bottom-0 rounded-l-2xl w-[400px] h-full flex flex-col',
|
|
12
|
-
};
|
|
13
|
-
const Drawer = ({ open, defaultOpen, onOpenChange, direction = 'bottom', snapPoints, activeSnapPoint, setActiveSnapPoint, title, description, children, buttons, trigger, showHandle, className, style, onButtonClick, }) => {
|
|
14
|
-
const isVertical = direction === 'bottom' || direction === 'top';
|
|
15
|
-
const shouldShowHandle = showHandle ?? isVertical;
|
|
16
|
-
const handleButtonClick = async (button) => {
|
|
17
|
-
let shouldClose = true;
|
|
18
|
-
if (button.onClick) {
|
|
19
|
-
const res = await button.onClick();
|
|
20
|
-
if (res === false)
|
|
21
|
-
shouldClose = false;
|
|
22
|
-
}
|
|
23
|
-
if (shouldClose) {
|
|
24
|
-
onButtonClick?.(button.value);
|
|
25
|
-
onOpenChange?.(false);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
return (_jsxs(DrawerBase.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, direction: direction, snapPoints: snapPoints, activeSnapPoint: activeSnapPoint, setActiveSnapPoint: setActiveSnapPoint, children: [trigger && _jsx(DrawerBase.Trigger, { asChild: true, children: trigger }), _jsx(DrawerBase.Overlay, {}), _jsxs(DrawerBase.Content, { className: cn('bg-white', directionClasses[direction], className), style: style, children: [shouldShowHandle && _jsx(DrawerBase.Handle, {}), _jsxs("div", { className: "relative flex flex-col flex-1 overflow-hidden p-5 gap-6", children: [_jsx(DrawerBase.Close, { asChild: true, children: _jsx("button", { className: "absolute top-4 right-5 text-neutral500 cursor-pointer outline-hidden", children: _jsx(LucideIcon, { name: "x", size: 16 }) }) }), (title || description) && (_jsxs("div", { className: "flex flex-col gap-2 pt-2", children: [title && (_jsx(DrawerBase.Title, { className: "display20 bold", children: title })), description && (_jsx(DrawerBase.Description, { className: "display14 text-neutral500", children: description }))] })), children && _jsx("div", { className: "flex-1 overflow-auto", children: children }), buttons && buttons.length > 0 && (_jsx("div", { className: "flex gap-2", children: buttons.map((button, index) => (_jsx(Button, { block: true, variant: button.variant, color: button.color, onClick: () => handleButtonClick(button), children: button.label }, index))) }))] })] })] }));
|
|
29
|
-
};
|
|
30
|
-
export default Drawer;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
interface RootProps {
|
|
3
|
-
open?: boolean;
|
|
4
|
-
defaultOpen?: boolean;
|
|
5
|
-
onOpenChange?: (open: boolean) => void;
|
|
6
|
-
direction?: 'bottom' | 'top' | 'left' | 'right';
|
|
7
|
-
snapPoints?: (number | string)[];
|
|
8
|
-
activeSnapPoint?: number | string | null;
|
|
9
|
-
setActiveSnapPoint?: (snapPoint: number | string | null) => void;
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
interface TriggerProps {
|
|
13
|
-
asChild?: boolean;
|
|
14
|
-
className?: string;
|
|
15
|
-
children?: ReactNode;
|
|
16
|
-
}
|
|
17
|
-
interface OverlayProps {
|
|
18
|
-
className?: string;
|
|
19
|
-
}
|
|
20
|
-
interface ContentProps {
|
|
21
|
-
className?: string;
|
|
22
|
-
children?: ReactNode;
|
|
23
|
-
style?: React.CSSProperties;
|
|
24
|
-
}
|
|
25
|
-
interface HandleProps {
|
|
26
|
-
className?: string;
|
|
27
|
-
}
|
|
28
|
-
interface CloseProps {
|
|
29
|
-
asChild?: boolean;
|
|
30
|
-
className?: string;
|
|
31
|
-
children?: ReactNode;
|
|
32
|
-
}
|
|
33
|
-
interface TitleProps {
|
|
34
|
-
className?: string;
|
|
35
|
-
children?: ReactNode;
|
|
36
|
-
}
|
|
37
|
-
interface DescriptionProps {
|
|
38
|
-
className?: string;
|
|
39
|
-
children?: ReactNode;
|
|
40
|
-
}
|
|
41
|
-
export declare const DrawerBase: {
|
|
42
|
-
Root: ({ open, defaultOpen, onOpenChange, direction, snapPoints, activeSnapPoint, setActiveSnapPoint, children, }: RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
Trigger: ({ asChild, className, children }: TriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
-
Overlay: ({ className }: OverlayProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
-
Content: ({ className, children, style }: ContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
-
Handle: ({ className }: HandleProps) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
Close: ({ asChild, className, children }: CloseProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
Title: ({ className, children }: TitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
49
|
-
Description: ({ className, children }: DescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
-
};
|
|
51
|
-
export default DrawerBase;
|
|
52
|
-
//# sourceMappingURL=DrawerBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerBase.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/DrawerBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,UAAU,SAAS;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,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B,UAAU;2CAUJ,gBAAgB;CAa7D,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Drawer } from 'vaul';
|
|
3
|
-
import cn from '../../utils/cn.js';
|
|
4
|
-
const Root = ({ open, defaultOpen, onOpenChange, direction = 'bottom', snapPoints, activeSnapPoint, setActiveSnapPoint, children, }) => {
|
|
5
|
-
return (_jsx(Drawer.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, direction: direction, snapPoints: snapPoints, activeSnapPoint: activeSnapPoint, setActiveSnapPoint: setActiveSnapPoint, children: children }));
|
|
6
|
-
};
|
|
7
|
-
const Trigger = ({ asChild, className, children }) => {
|
|
8
|
-
return (_jsx(Drawer.Trigger, { asChild: asChild, className: className, children: children }));
|
|
9
|
-
};
|
|
10
|
-
const Overlay = ({ className }) => {
|
|
11
|
-
return (_jsx(Drawer.Portal, { children: _jsx(Drawer.Overlay, { className: cn('fixed inset-0 z-50 bg-black/30', className) }) }));
|
|
12
|
-
};
|
|
13
|
-
const Content = ({ className, children, style }) => {
|
|
14
|
-
return (_jsx(Drawer.Portal, { children: _jsx(Drawer.Content, { className: cn('fixed z-50 outline-hidden', className), style: style, children: children }) }));
|
|
15
|
-
};
|
|
16
|
-
const Handle = ({ className }) => {
|
|
17
|
-
return (_jsx(Drawer.Handle, { className: cn('mx-auto mt-3 mb-1 h-1 w-10 rounded-full bg-neutral200', className) }));
|
|
18
|
-
};
|
|
19
|
-
const Close = ({ asChild, className, children }) => {
|
|
20
|
-
return (_jsx(Drawer.Close, { asChild: asChild, className: className, children: children }));
|
|
21
|
-
};
|
|
22
|
-
const Title = ({ className, children }) => {
|
|
23
|
-
return _jsx("h2", { className: className, children: children });
|
|
24
|
-
};
|
|
25
|
-
const Description = ({ className, children }) => {
|
|
26
|
-
return _jsx("p", { className: className, children: children });
|
|
27
|
-
};
|
|
28
|
-
export const DrawerBase = {
|
|
29
|
-
Root,
|
|
30
|
-
Trigger,
|
|
31
|
-
Overlay,
|
|
32
|
-
Content,
|
|
33
|
-
Handle,
|
|
34
|
-
Close,
|
|
35
|
-
Title,
|
|
36
|
-
Description,
|
|
37
|
-
};
|
|
38
|
-
export default DrawerBase;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface EditorProps {
|
|
2
|
-
content: string;
|
|
3
|
-
onChange?: (html: string) => void;
|
|
4
|
-
className?: string;
|
|
5
|
-
handleImageUpload?: (fileData: {
|
|
6
|
-
filebase64: string;
|
|
7
|
-
fileName: string;
|
|
8
|
-
}) => Promise<string | null>;
|
|
9
|
-
}
|
|
10
|
-
declare const Editor: ({ content, onChange, className, handleImageUpload, }: EditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default Editor;
|
|
12
|
-
//# sourceMappingURL=Editor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AA0EA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE;QAC7B,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;KAClB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,MAAM,GAAI,sDAKb,WAAW,4CAWb,CAAC;AAmXF,eAAe,MAAM,CAAC"}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { AlignCenter, AlignJustify, AlignLeft, AlignRight, Bold, ChevronDown, Image as ImageIcon, Italic, Link2, List, ListOrdered, Redo, Strikethrough, Underline, Undo, Unlink, } from 'lucide-react';
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import { useEditorState } from '@tiptap/react';
|
|
6
|
-
import EditorBase, { useEditorContext } from './EditorBase.js';
|
|
7
|
-
import { createEditorExtensions } from './extensions.js';
|
|
8
|
-
import cn from '../../utils/cn.js';
|
|
9
|
-
import Toast from '../Toast/Toast.js';
|
|
10
|
-
import { fileToBase64, getFileSizeUnit, isImage, validAllowedExtesions, validFileSize, validImageSize, } from '../../utils/file.js';
|
|
11
|
-
import { FILE_EXTENSIONS, TOOLBAR_ALLOWED_EXTENSIONS, TOOLBAR_MAX_SIZE, } from '../../constants/file.js';
|
|
12
|
-
const FONT_SIZES = [
|
|
13
|
-
'12px',
|
|
14
|
-
'14px',
|
|
15
|
-
'16px',
|
|
16
|
-
'18px',
|
|
17
|
-
'20px',
|
|
18
|
-
'24px',
|
|
19
|
-
'28px',
|
|
20
|
-
'32px',
|
|
21
|
-
'36px',
|
|
22
|
-
'40px',
|
|
23
|
-
];
|
|
24
|
-
const COLORS = [
|
|
25
|
-
{ label: '검정', value: '#111827' },
|
|
26
|
-
{ label: '빨강', value: '#ef4444' },
|
|
27
|
-
{ label: '파랑', value: '#3b82f6' },
|
|
28
|
-
{ label: '초록', value: '#16a34a' },
|
|
29
|
-
{ label: '주황', value: '#f97316' },
|
|
30
|
-
];
|
|
31
|
-
const HEADINGS = [
|
|
32
|
-
{ label: '본문', level: 0 },
|
|
33
|
-
{ label: '제목 1', level: 1 },
|
|
34
|
-
{ label: '제목 2', level: 2 },
|
|
35
|
-
{ label: '제목 3', level: 3 },
|
|
36
|
-
];
|
|
37
|
-
const iconBtn = 'p-1 rounded-lg cursor-pointer transition hover:bg-mono100 disabled:opacity-30 disabled:cursor-not-allowed';
|
|
38
|
-
const activeBtn = 'bg-mono100';
|
|
39
|
-
const Divider = () => _jsx("div", { className: "w-px h-6 bg-neutral200 mx-1" });
|
|
40
|
-
const Editor = ({ content, onChange, className, handleImageUpload, }) => {
|
|
41
|
-
return (_jsxs(EditorBase.Root, { extensions: createEditorExtensions(), content: content, onChange: onChange, children: [_jsx(EditorToolbar, { handleImageUpload: handleImageUpload }), _jsx(EditorBase.Content, { className: className })] }));
|
|
42
|
-
};
|
|
43
|
-
const EditorToolbar = ({ handleImageUpload, }) => {
|
|
44
|
-
const [linkUrl, setLinkUrl] = useState('');
|
|
45
|
-
const { editor } = useEditorContext();
|
|
46
|
-
const state = useEditorState({
|
|
47
|
-
editor,
|
|
48
|
-
selector: ({ editor }) => {
|
|
49
|
-
if (!editor)
|
|
50
|
-
return null;
|
|
51
|
-
return {
|
|
52
|
-
fontSize: editor.getAttributes('textStyle')?.fontSize || '18px',
|
|
53
|
-
color: editor.getAttributes('textStyle')?.color || '#111827',
|
|
54
|
-
headingLevel: [1, 2, 3].find((l) => editor.isActive('heading', { level: l })),
|
|
55
|
-
isBold: editor.isActive('bold'),
|
|
56
|
-
isItalic: editor.isActive('italic'),
|
|
57
|
-
isUnderline: editor.isActive('underline'),
|
|
58
|
-
isStrike: editor.isActive('strike'),
|
|
59
|
-
align: {
|
|
60
|
-
left: editor.isActive({ textAlign: 'left' }),
|
|
61
|
-
center: editor.isActive({ textAlign: 'center' }),
|
|
62
|
-
right: editor.isActive({ textAlign: 'right' }),
|
|
63
|
-
justify: editor.isActive({ textAlign: 'justify' }),
|
|
64
|
-
},
|
|
65
|
-
isBulletList: editor.isActive('bulletList'),
|
|
66
|
-
isOrderedList: editor.isActive('orderedList'),
|
|
67
|
-
canUndo: editor.can().undo(),
|
|
68
|
-
canRedo: editor.can().redo(),
|
|
69
|
-
isLink: editor.isActive('link'),
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
const handleImageUploadAction = async (files) => {
|
|
74
|
-
if (!files?.[0] || !editor)
|
|
75
|
-
return;
|
|
76
|
-
const file = files[0];
|
|
77
|
-
if (!validAllowedExtesions(file, TOOLBAR_ALLOWED_EXTENSIONS)) {
|
|
78
|
-
const allowedFiles = TOOLBAR_ALLOWED_EXTENSIONS.map((item) => FILE_EXTENSIONS[item].toUpperCase()).join(', ');
|
|
79
|
-
Toast.error(`지원하지 않는 파일 형식입니다. ${allowedFiles} 파일만 업로드 가능합니다.`);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (!validFileSize(file, TOOLBAR_MAX_SIZE)) {
|
|
83
|
-
Toast.error(`파일 크기가 너무 큽니다. ${getFileSizeUnit(TOOLBAR_MAX_SIZE)} 이하 파일을 선택해주세요.`);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (isImage(file.name) && !(await validImageSize(file))) {
|
|
87
|
-
Toast.error('이미지 해상도가 너무 큽니다. 더 작은 이미지를 선택해주세요.');
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
const { fileBase64, fileName } = await fileToBase64(file);
|
|
92
|
-
const res = await handleImageUpload?.({
|
|
93
|
-
filebase64: fileBase64,
|
|
94
|
-
fileName,
|
|
95
|
-
});
|
|
96
|
-
if (!res) {
|
|
97
|
-
Toast.error('이미지 업로드에 실패했습니다.');
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
editor.commands.setImage({ src: res });
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
Toast.error('파일 업로드 중 문제가 발생했습니다. 잠시 후 다시 시도해주세요.');
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
if (!editor || !state)
|
|
107
|
-
return null;
|
|
108
|
-
return (_jsxs(EditorBase.Toolbar, { className: "gap-5 px-4 py-3 rounded-t-md border border-neutral200", children: [_jsx(EditorBase.Toolbar.Dropdown, { className: "bg-white border border-neutral200 rounded-lg shadow-lg min-w-[120px]", trigger: ({ toggle }) => (_jsx(EditorBase.Toolbar.Button, { onClick: toggle, className: cn(iconBtn, 'flex items-center gap-5 px-2'), children: _jsx("span", { className: "whitespace-nowrap min-w-10", children: state.headingLevel ? `제목 ${state.headingLevel}` : '본문' }) })), children: ({ close }) => HEADINGS.map(({ label, level }) => (_jsx("button", { type: "button", onClick: (e) => {
|
|
109
|
-
e.preventDefault();
|
|
110
|
-
if (level === 0)
|
|
111
|
-
editor.chain().focus().setParagraph().run();
|
|
112
|
-
else
|
|
113
|
-
editor.chain().focus().toggleHeading({ level }).run();
|
|
114
|
-
close();
|
|
115
|
-
}, className: "w-full px-3 py-2 cursor-pointer text-left text-sm hover:bg-mono100 first:rounded-t-lg last:rounded-b-lg", children: label }, level))) }), _jsx(Divider, {}), _jsx(EditorBase.Toolbar.Button, { onClick: () => editor.chain().focus().toggleBold().run(), className: cn(iconBtn, state.isBold && activeBtn), children: _jsx(Bold, { className: "w-5 h-5" }) }), _jsx(EditorBase.Toolbar.Button, { onClick: () => editor.chain().focus().toggleItalic().run(), className: cn(iconBtn, state.isItalic && activeBtn), children: _jsx(Italic, { className: "w-5 h-5" }) }), _jsx(EditorBase.Toolbar.Button, { onClick: () => editor.chain().focus().toggleUnderline().run(), className: cn(iconBtn, state.isUnderline && activeBtn), children: _jsx(Underline, { className: "w-5 h-5" }) }), _jsx(EditorBase.Toolbar.Button, { onClick: () => editor.chain().focus().toggleStrike().run(), className: cn(iconBtn, state.isStrike && activeBtn), children: _jsx(Strikethrough, { className: "w-5 h-5" }) }), _jsx(Divider, {}), _jsx(EditorBase.Toolbar.Dropdown, { className: "border border-neutral200 bg-white rounded-lg shadow-lg min-w-[100px]", trigger: ({ toggle }) => (_jsxs(EditorBase.Toolbar.Button, { onClick: toggle, className: cn(iconBtn, 'flex items-center gap-1 px-2'), children: [_jsx("span", { className: "text-sm whitespace-nowrap", children: state.fontSize }), _jsx(ChevronDown, { className: "w-4 h-4" })] })), children: ({ close }) => FONT_SIZES.map((size) => (_jsx("button", { type: "button", onClick: (e) => {
|
|
116
|
-
e.preventDefault();
|
|
117
|
-
editor.chain().focus().setFontSize(size).run();
|
|
118
|
-
close();
|
|
119
|
-
}, className: "w-full px-3 py-2 cursor-pointer text-left text-sm hover:bg-mono100 first:rounded-t-lg last:rounded-b-lg", children: size }, size))) }), _jsx(EditorBase.Toolbar.Dropdown, { className: "bg-white border border-neutral200 rounded-lg shadow-lg min-w-[140px]", trigger: ({ toggle }) => (_jsxs(EditorBase.Toolbar.Button, { onClick: toggle, className: cn(iconBtn, 'flex items-center gap-2 px-2'), children: [_jsx("span", { className: "w-4 h-4 rounded-full", style: { backgroundColor: state.color } }), state.color, _jsx(ChevronDown, { className: "w-4 h-4" })] })), children: ({ close }) => COLORS.map((color) => (_jsxs("button", { type: "button", onClick: (e) => {
|
|
120
|
-
e.preventDefault();
|
|
121
|
-
editor.chain().focus().setColor(color.value).run();
|
|
122
|
-
close();
|
|
123
|
-
}, className: "flex items-center gap-2 w-full px-3 py-2 cursor-pointer text-left text-sm hover:bg-mono100 first:rounded-t-lg last:rounded-b-lg", children: [_jsx("span", { className: "w-4 h-4 rounded-full", style: { backgroundColor: color.value } }), _jsx("span", { children: color.label })] }, color.value))) }), _jsx(Divider, {}), ['left', 'center', 'right', 'justify'].map((align) => {
|
|
124
|
-
const Icon = {
|
|
125
|
-
left: AlignLeft,
|
|
126
|
-
center: AlignCenter,
|
|
127
|
-
right: AlignRight,
|
|
128
|
-
justify: AlignJustify,
|
|
129
|
-
}[align];
|
|
130
|
-
return (_jsx(EditorBase.Toolbar.Button, { onClick: () => editor.chain().focus().setTextAlign(align).run(), className: cn(iconBtn, state.align[align] && activeBtn), children: _jsx(Icon, { className: "w-5 h-5" }) }, align));
|
|
131
|
-
}), _jsx(Divider, {}), _jsx(EditorBase.Toolbar.Button, { onClick: () => editor.chain().focus().toggleBulletList().run(), className: cn(iconBtn, state.isBulletList && activeBtn), children: _jsx(List, { className: "w-5 h-5" }) }), _jsx(EditorBase.Toolbar.Button, { onClick: () => editor.chain().focus().toggleOrderedList().run(), className: cn(iconBtn, state.isOrderedList && activeBtn), children: _jsx(ListOrdered, { className: "w-5 h-5" }) }), _jsx(Divider, {}), _jsx(EditorBase.Toolbar.Button, { disabled: !state.canUndo, onClick: () => editor.chain().focus().undo().run(), className: iconBtn, children: _jsx(Undo, { className: "w-5 h-5" }) }), _jsx(EditorBase.Toolbar.Button, { disabled: !state.canRedo, onClick: () => editor.chain().focus().redo().run(), className: iconBtn, children: _jsx(Redo, { className: "w-5 h-5" }) }), _jsx(Divider, {}), _jsx(EditorBase.Toolbar.Dropdown, { className: "bg-white border border-neutral200 rounded-lg shadow-lg p-3 min-w-[280px]", trigger: ({ toggle }) => (_jsx(EditorBase.Toolbar.Button, { onClick: () => {
|
|
132
|
-
setLinkUrl(editor.getAttributes('link').href || '');
|
|
133
|
-
toggle();
|
|
134
|
-
}, className: cn(iconBtn, state.isLink && activeBtn), children: _jsx(Link2, { className: "w-5 h-5" }) })), children: ({ close }) => {
|
|
135
|
-
const applyLink = () => {
|
|
136
|
-
const chain = editor.chain().focus().extendMarkRange('link');
|
|
137
|
-
if (linkUrl === '') {
|
|
138
|
-
chain.unsetLink().run();
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
const url = /^https?:\/\//.test(linkUrl)
|
|
142
|
-
? linkUrl
|
|
143
|
-
: `https://${linkUrl}`;
|
|
144
|
-
chain.setLink({ href: url }).run();
|
|
145
|
-
}
|
|
146
|
-
setLinkUrl('');
|
|
147
|
-
close();
|
|
148
|
-
};
|
|
149
|
-
return (_jsxs(_Fragment, { children: [_jsx("input", { type: "text", autoFocus: true, placeholder: "URL\uC744 \uC785\uB825\uD558\uC138\uC694", value: linkUrl, onChange: (e) => setLinkUrl(e.target.value), onKeyDown: (e) => e.key === 'Enter' && applyLink(), className: "w-full px-3 py-2 border border-neutral200 rounded-lg text-sm outline-none transition duration-300 focus:border-blue-500" }), _jsxs("div", { className: "flex gap-2 mt-2", children: [_jsx("button", { type: "button", onClick: (e) => {
|
|
150
|
-
e.preventDefault();
|
|
151
|
-
applyLink();
|
|
152
|
-
}, className: "flex-1 px-3 py-1.5 bg-blue-500 text-white rounded-lg text-sm transition duration-300 hover:bg-blue-600", children: "\uC801\uC6A9" }), _jsx("button", { type: "button", onClick: (e) => {
|
|
153
|
-
e.preventDefault();
|
|
154
|
-
setLinkUrl('');
|
|
155
|
-
close();
|
|
156
|
-
}, className: "px-3 py-1.5 border border-neutral200 rounded-lg text-sm transition duration-300 hover:bg-mono100", children: "\uCDE8\uC18C" })] })] }));
|
|
157
|
-
} }), _jsx(EditorBase.Toolbar.Button, { disabled: !state.isLink, onClick: () => editor.chain().focus().unsetLink().run(), className: iconBtn, children: _jsx(Unlink, { className: "w-5 h-5" }) }), _jsx(Divider, {}), _jsxs("label", { className: cn(iconBtn, 'relative'), children: [_jsx(ImageIcon, { className: "w-5 h-5" }), _jsx("input", { type: "file", accept: "image/*", className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer", onChange: (e) => {
|
|
158
|
-
handleImageUploadAction(e.target.files);
|
|
159
|
-
e.target.value = '';
|
|
160
|
-
} })] })] }));
|
|
161
|
-
};
|
|
162
|
-
export default Editor;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import { type Editor, type Extensions } from '@tiptap/react';
|
|
3
|
-
interface EditorContextType {
|
|
4
|
-
editor: Editor | null;
|
|
5
|
-
}
|
|
6
|
-
export declare const useEditorContext: () => EditorContextType;
|
|
7
|
-
interface RootProps {
|
|
8
|
-
extensions: Extensions;
|
|
9
|
-
content?: string;
|
|
10
|
-
onChange?: (html: string) => void;
|
|
11
|
-
className?: string;
|
|
12
|
-
children?: ReactNode;
|
|
13
|
-
}
|
|
14
|
-
interface ContentProps {
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
interface ToolbarProps {
|
|
18
|
-
className?: string;
|
|
19
|
-
children?: ReactNode;
|
|
20
|
-
}
|
|
21
|
-
interface ToolbarButtonProps {
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
onClick?: () => void;
|
|
24
|
-
className?: string;
|
|
25
|
-
children?: ReactNode;
|
|
26
|
-
}
|
|
27
|
-
interface ToolbarDropdownProps {
|
|
28
|
-
trigger: (args: {
|
|
29
|
-
open: boolean;
|
|
30
|
-
toggle: () => void;
|
|
31
|
-
}) => ReactNode;
|
|
32
|
-
className?: string;
|
|
33
|
-
children?: ReactNode | ((args: {
|
|
34
|
-
close: () => void;
|
|
35
|
-
}) => ReactNode);
|
|
36
|
-
}
|
|
37
|
-
interface ViewerProps {
|
|
38
|
-
extensions: Extensions;
|
|
39
|
-
content: string;
|
|
40
|
-
className?: string;
|
|
41
|
-
}
|
|
42
|
-
export declare const EditorBase: {
|
|
43
|
-
Root: ({ extensions, content, onChange, className, children, }: RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
-
Content: ({ className }: ContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
-
Toolbar: (({ className, children }: ToolbarProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
46
|
-
Button: ({ disabled, onClick, className, children, }: ToolbarButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
Dropdown: ({ trigger, className, children, }: ToolbarDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
};
|
|
49
|
-
Viewer: ({ extensions, content, className }: ViewerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
50
|
-
};
|
|
51
|
-
export default EditorBase;
|
|
52
|
-
//# sourceMappingURL=EditorBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorBase.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/EditorBase.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAIvB,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAC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0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useEffect, useRef, useState, } from 'react';
|
|
4
|
-
import { EditorContent, useEditor, } from '@tiptap/react';
|
|
5
|
-
import cn from '../../utils/cn.js';
|
|
6
|
-
const EditorContext = createContext(null);
|
|
7
|
-
export const useEditorContext = () => {
|
|
8
|
-
const editorContext = useContext(EditorContext);
|
|
9
|
-
if (!editorContext) {
|
|
10
|
-
throw new Error('EditorBase 하위 컴포넌트는 Root 내부에서 사용해야 합니다.');
|
|
11
|
-
}
|
|
12
|
-
return editorContext;
|
|
13
|
-
};
|
|
14
|
-
const Root = ({ extensions, content = '', onChange, className, children, }) => {
|
|
15
|
-
const editor = useEditor({
|
|
16
|
-
extensions,
|
|
17
|
-
content,
|
|
18
|
-
onUpdate: ({ editor }) => onChange?.(editor.getHTML()),
|
|
19
|
-
immediatelyRender: false,
|
|
20
|
-
editorProps: {
|
|
21
|
-
attributes: {
|
|
22
|
-
class: cn('prose prose-lg max-w-none px-4 py-3 border-b border-r border-l border-neutral200 rounded-bl-md rounded-br-md outline-none h-[818px] mobile:h-[320px] overflow-y-auto focus:outline-none', className),
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (!editor)
|
|
28
|
-
return;
|
|
29
|
-
if ((content || '') !== editor.getHTML()) {
|
|
30
|
-
editor.commands.setContent(content || '');
|
|
31
|
-
}
|
|
32
|
-
}, [content, editor]);
|
|
33
|
-
return (_jsx(EditorContext.Provider, { value: { editor }, children: _jsx("div", { className: cn('w-full', className), children: editor && children }) }));
|
|
34
|
-
};
|
|
35
|
-
const Content = ({ className }) => {
|
|
36
|
-
const { editor } = useEditorContext();
|
|
37
|
-
return _jsx(EditorContent, { editor: editor, className: className });
|
|
38
|
-
};
|
|
39
|
-
const ToolbarRoot = ({ className, children }) => {
|
|
40
|
-
const { editor } = useEditorContext();
|
|
41
|
-
if (!editor)
|
|
42
|
-
return null;
|
|
43
|
-
return (_jsx("div", { className: cn('flex flex-wrap items-center', className), children: children }));
|
|
44
|
-
};
|
|
45
|
-
const ToolbarButton = ({ disabled, onClick, className, children, }) => {
|
|
46
|
-
return (_jsx("button", { type: "button", disabled: disabled, onClick: (e) => {
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
onClick?.();
|
|
49
|
-
}, className: className, children: children }));
|
|
50
|
-
};
|
|
51
|
-
const ToolbarDropdown = ({ trigger, className, children, }) => {
|
|
52
|
-
const [open, setOpen] = useState(false);
|
|
53
|
-
const ref = useRef(null);
|
|
54
|
-
const toggle = () => setOpen((prev) => !prev);
|
|
55
|
-
const close = () => setOpen(false);
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
const handler = (e) => {
|
|
58
|
-
if (!ref.current?.contains(e.target)) {
|
|
59
|
-
setOpen(false);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
document.addEventListener('mousedown', handler);
|
|
63
|
-
return () => document.removeEventListener('mousedown', handler);
|
|
64
|
-
}, []);
|
|
65
|
-
return (_jsxs("div", { ref: ref, className: "relative", children: [trigger({ open, toggle }), open && (_jsx("div", { className: cn('absolute top-full left-0 mt-1 z-50', className), children: typeof children === 'function' ? children({ close }) : children }))] }));
|
|
66
|
-
};
|
|
67
|
-
const Toolbar = Object.assign(ToolbarRoot, {
|
|
68
|
-
Button: ToolbarButton,
|
|
69
|
-
Dropdown: ToolbarDropdown,
|
|
70
|
-
});
|
|
71
|
-
const Viewer = ({ extensions, content, className }) => {
|
|
72
|
-
const editor = useEditor({
|
|
73
|
-
extensions,
|
|
74
|
-
content: content || '',
|
|
75
|
-
editable: false,
|
|
76
|
-
injectCSS: false,
|
|
77
|
-
immediatelyRender: false,
|
|
78
|
-
});
|
|
79
|
-
if (!editor)
|
|
80
|
-
return null;
|
|
81
|
-
return _jsx(EditorContent, { editor: editor, className: className });
|
|
82
|
-
};
|
|
83
|
-
export const EditorBase = {
|
|
84
|
-
Root,
|
|
85
|
-
Content,
|
|
86
|
-
Toolbar,
|
|
87
|
-
Viewer,
|
|
88
|
-
};
|
|
89
|
-
export default EditorBase;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Viewer.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Viewer.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,GAAI,wBAAwB,WAAW,4CAQlD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import EditorBase from './EditorBase.js';
|
|
4
|
-
import { createEditorExtensions } from './extensions.js';
|
|
5
|
-
import cn from '../../utils/cn.js';
|
|
6
|
-
const Viewer = ({ content, className }) => {
|
|
7
|
-
return (_jsx(EditorBase.Viewer, { extensions: createEditorExtensions({ resizableImage: false }), content: content, className: cn('prose prose-lg max-w-none w-full', className) }));
|
|
8
|
-
};
|
|
9
|
-
export default Viewer;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Extensions } from '@tiptap/react';
|
|
2
|
-
export interface EditorExtensionOptions {
|
|
3
|
-
resizableImage?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare const createEditorExtensions: ({ resizableImage, }?: EditorExtensionOptions) => Extensions;
|
|
6
|
-
//# sourceMappingURL=extensions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/extensions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,sBAAsB,GAAI,sBAEpC,sBAA2B,KAAG,UA+BhC,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import StarterKit from '@tiptap/starter-kit';
|
|
2
|
-
import Underline from '@tiptap/extension-underline';
|
|
3
|
-
import Image from '@tiptap/extension-image';
|
|
4
|
-
import TextAlign from '@tiptap/extension-text-align';
|
|
5
|
-
import { TextStyle, FontSize, Color } from '@tiptap/extension-text-style';
|
|
6
|
-
import Link from '@tiptap/extension-link';
|
|
7
|
-
export const createEditorExtensions = ({ resizableImage = true, } = {}) => [
|
|
8
|
-
StarterKit.configure({
|
|
9
|
-
heading: {
|
|
10
|
-
levels: [1, 2, 3],
|
|
11
|
-
},
|
|
12
|
-
}),
|
|
13
|
-
Underline,
|
|
14
|
-
TextStyle,
|
|
15
|
-
FontSize,
|
|
16
|
-
Color,
|
|
17
|
-
TextAlign.configure({
|
|
18
|
-
types: ['heading', 'paragraph', 'image'],
|
|
19
|
-
alignments: ['left', 'center', 'right', 'justify'],
|
|
20
|
-
}),
|
|
21
|
-
Image.configure({
|
|
22
|
-
inline: false,
|
|
23
|
-
allowBase64: true,
|
|
24
|
-
resize: resizableImage
|
|
25
|
-
? {
|
|
26
|
-
enabled: true,
|
|
27
|
-
alwaysPreserveAspectRatio: true,
|
|
28
|
-
}
|
|
29
|
-
: false,
|
|
30
|
-
}),
|
|
31
|
-
Link.configure({
|
|
32
|
-
openOnClick: false,
|
|
33
|
-
autolink: true,
|
|
34
|
-
HTMLAttributes: {
|
|
35
|
-
class: 'text-blue-500 underline cursor-pointer',
|
|
36
|
-
},
|
|
37
|
-
}),
|
|
38
|
-
];
|