@loword/loword-design-system 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +9 -0
- package/package.json +6 -3
- package/src/styles/carousel.css +9 -0
- package/src/styles/color.css +185 -0
- package/src/styles/components/badge.css +41 -0
- package/src/styles/components/bread-crumb.css +23 -0
- package/src/styles/components/button.css +183 -0
- package/src/styles/components/editor.css +147 -0
- package/src/styles/components/icon.css +29 -0
- package/src/styles/components/index.css +9 -0
- package/src/styles/components/input.css +52 -0
- package/src/styles/components/modal.css +25 -0
- package/src/styles/components/shared.css +52 -0
- package/src/styles/components/spinner.css +38 -0
- package/src/styles/focus.css +12 -0
- package/src/styles/gradient.css +41 -0
- package/src/styles/layout.css +19 -0
- package/src/styles/motion.css +235 -0
- package/src/styles/radius.css +8 -0
- package/src/styles/responsive.css +42 -0
- package/src/styles/scrollbar.css +59 -0
- package/src/styles/slider.css +65 -0
- package/src/styles/spacing.css +592 -0
- package/src/styles/text-utils.css +7 -0
- package/src/styles/typography.css +171 -0
- package/src/theme.css +19 -0
- 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,197 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
|
-
import { ko } from 'react-day-picker/locale';
|
|
6
|
-
import PopoverBase from '../Popover/PopoverBase.js';
|
|
7
|
-
import Calendar from '../Calendar/Calendar.js';
|
|
8
|
-
import LucideIcon from '../Icon/LucideIcon.js';
|
|
9
|
-
import cn from '../../utils/cn.js';
|
|
10
|
-
const dateFormats = {
|
|
11
|
-
daily: 'YYYY-MM-DD',
|
|
12
|
-
monthly: 'YYYY-MM',
|
|
13
|
-
yearly: 'YYYY',
|
|
14
|
-
};
|
|
15
|
-
const placeholders = {
|
|
16
|
-
daily: 'YYYY-MM-DD ~ YYYY-MM-DD',
|
|
17
|
-
monthly: 'YYYY-MM ~ YYYY-MM',
|
|
18
|
-
yearly: 'YYYY ~ YYYY',
|
|
19
|
-
};
|
|
20
|
-
const DateRangePicker = ({ value, onChange, disabled = false, block = false, color = 'neutral', isDisableAfterNow = false, isAutoClose = false, viewMode = 'daily', defaultValue, initialValue, trailingIcon = (_jsx(LucideIcon, { name: "calendar", size: 15, className: "text-mono40" })), onRangeComplete, onResetComplete, className, style, triggerClassName, }) => {
|
|
21
|
-
const [open, setOpen] = useState(false);
|
|
22
|
-
const [internal, setInternal] = useState(defaultValue);
|
|
23
|
-
const isControlled = value !== undefined;
|
|
24
|
-
const resolved = isControlled ? value : internal;
|
|
25
|
-
const fmt = dateFormats[viewMode];
|
|
26
|
-
const renderDateRange = () => {
|
|
27
|
-
if (!resolved?.from) {
|
|
28
|
-
return _jsx("span", { className: "text-mono40", children: placeholders[viewMode] });
|
|
29
|
-
}
|
|
30
|
-
if (!resolved.to) {
|
|
31
|
-
return (_jsxs("span", { className: "text-mono40", children: [dayjs(resolved.from).format(fmt), " ~", ' ', placeholders[viewMode].split(' ~ ')[1]] }));
|
|
32
|
-
}
|
|
33
|
-
return (_jsxs(_Fragment, { children: [dayjs(resolved.from).format(fmt), " ~ ", dayjs(resolved.to).format(fmt)] }));
|
|
34
|
-
};
|
|
35
|
-
const handleReset = (e) => {
|
|
36
|
-
e.stopPropagation();
|
|
37
|
-
const resetValue = initialValue
|
|
38
|
-
? {
|
|
39
|
-
from: dayjs(initialValue.from).toDate(),
|
|
40
|
-
to: dayjs(initialValue.to).toDate(),
|
|
41
|
-
}
|
|
42
|
-
: undefined;
|
|
43
|
-
if (!isControlled)
|
|
44
|
-
setInternal(resetValue);
|
|
45
|
-
onChange?.(resetValue);
|
|
46
|
-
onResetComplete?.();
|
|
47
|
-
};
|
|
48
|
-
const isResetAvailable = initialValue?.from
|
|
49
|
-
? dayjs(resolved?.from).format(fmt) !== initialValue.from ||
|
|
50
|
-
dayjs(resolved?.to).format(fmt) !== initialValue.to
|
|
51
|
-
: !!resolved?.from;
|
|
52
|
-
const handleRangeSelect = (range) => {
|
|
53
|
-
if (!range)
|
|
54
|
-
return;
|
|
55
|
-
if (!isControlled)
|
|
56
|
-
setInternal(range);
|
|
57
|
-
onChange?.(range);
|
|
58
|
-
if (range.from && range.to) {
|
|
59
|
-
onRangeComplete?.(range);
|
|
60
|
-
if (isAutoClose)
|
|
61
|
-
setOpen(false);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const handleDailySelect = (selected) => {
|
|
65
|
-
if (!selected)
|
|
66
|
-
return;
|
|
67
|
-
const current = resolved;
|
|
68
|
-
// from만 있는 상태에서 두 번째 클릭
|
|
69
|
-
if (current?.from && !current?.to && selected?.from && selected?.to) {
|
|
70
|
-
handleRangeSelect(selected);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// 완전한 범위가 이미 있는 상태에서 클릭
|
|
74
|
-
if (current?.from && current?.to) {
|
|
75
|
-
if (selected?.from &&
|
|
76
|
-
selected?.to &&
|
|
77
|
-
selected.from.getTime() === selected.to.getTime()) {
|
|
78
|
-
if (!isControlled)
|
|
79
|
-
setInternal({ from: selected.from, to: undefined });
|
|
80
|
-
onChange?.({ from: selected.from, to: undefined });
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (selected?.from && selected?.to) {
|
|
84
|
-
const clickedDate = selected.from.getTime() !== current.from.getTime() &&
|
|
85
|
-
selected.from.getTime() !== current.to.getTime()
|
|
86
|
-
? selected.from
|
|
87
|
-
: selected.to.getTime() !== current.from.getTime() &&
|
|
88
|
-
selected.to.getTime() !== current.to.getTime()
|
|
89
|
-
? selected.to
|
|
90
|
-
: selected.from;
|
|
91
|
-
if (!isControlled)
|
|
92
|
-
setInternal({ from: clickedDate, to: undefined });
|
|
93
|
-
onChange?.({ from: clickedDate, to: undefined });
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// 기본 동작
|
|
98
|
-
if (selected?.from &&
|
|
99
|
-
selected?.to &&
|
|
100
|
-
selected.from.getTime() === selected.to.getTime()) {
|
|
101
|
-
if (!isControlled)
|
|
102
|
-
setInternal({ from: selected.from, to: undefined });
|
|
103
|
-
onChange?.({ from: selected.from, to: undefined });
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
if (!isControlled)
|
|
107
|
-
setInternal(selected);
|
|
108
|
-
onChange?.(selected);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
return (_jsx("div", { className: cn(block ? 'w-full' : 'w-auto', className), children: _jsxs(PopoverBase.Root, { open: open, onOpenChange: setOpen, children: [_jsxs(PopoverBase.Trigger, { disabled: disabled, style: style, className: cn('border border-neutral10 h-[38px] w-full display14 px-4 rounded-[5px]', 'flex flex-row items-center justify-between gap-4', 'whitespace-nowrap outline-2 outline-transparent ld-transition', disabled && 'cursor-not-allowed opacity-50', color === 'danger'
|
|
112
|
-
? 'bg-tintRed outline-red500'
|
|
113
|
-
: 'focus:bg-tintBlue focus:outline-lb500', triggerClassName), children: [renderDateRange(), _jsxs("div", { className: "shrink-0 flex gap-1.5", children: [trailingIcon, isResetAvailable && (_jsx("span", { role: "button", tabIndex: 0, className: "text-mono40 cursor-pointer", onClick: handleReset, onKeyDown: (e) => {
|
|
114
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
115
|
-
e.preventDefault();
|
|
116
|
-
handleReset(e);
|
|
117
|
-
}
|
|
118
|
-
}, children: _jsx(LucideIcon, { name: "rotateCw", size: 14 }) }))] })] }), _jsxs(PopoverBase.Content, { className: "rounded-md border border-neutral-200 bg-white shadow-md p-0", children: [viewMode === 'daily' && (_jsx(Calendar, { captionLayout: "dropdown", mode: "range", locale: ko, selected: resolved, onSelect: handleDailySelect, disabled: isDisableAfterNow ? (date) => date > new Date() : false, numberOfMonths: 2 })), viewMode === 'monthly' && (_jsx(MonthRangePicker, { value: resolved, onChange: handleRangeSelect, isDisableAfterNow: isDisableAfterNow })), viewMode === 'yearly' && (_jsx(YearRangePicker, { value: resolved, onChange: handleRangeSelect, isDisableAfterNow: isDisableAfterNow }))] })] }) }));
|
|
119
|
-
};
|
|
120
|
-
// ── MonthRangePicker ──
|
|
121
|
-
const MonthRangePicker = ({ value, onChange, isDisableAfterNow, }) => {
|
|
122
|
-
const [currentYear, setCurrentYear] = useState(value?.from ? value.from.getFullYear() : new Date().getFullYear());
|
|
123
|
-
const now = new Date();
|
|
124
|
-
const handleMonthClick = (month) => {
|
|
125
|
-
const clickedDate = new Date(currentYear, month, 1);
|
|
126
|
-
if (!value?.from || (value.from && value.to)) {
|
|
127
|
-
onChange({ from: clickedDate, to: undefined });
|
|
128
|
-
}
|
|
129
|
-
else if (clickedDate < value.from) {
|
|
130
|
-
onChange({ from: clickedDate, to: undefined });
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
onChange({
|
|
134
|
-
from: value.from,
|
|
135
|
-
to: dayjs(clickedDate).endOf('month').toDate(),
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
const isSelected = (month) => {
|
|
140
|
-
if (!value?.from)
|
|
141
|
-
return false;
|
|
142
|
-
const date = new Date(currentYear, month, 1);
|
|
143
|
-
if (value.to) {
|
|
144
|
-
return (date >= dayjs(value.from).startOf('month').toDate() && date <= value.to);
|
|
145
|
-
}
|
|
146
|
-
return (date.getFullYear() === value.from.getFullYear() &&
|
|
147
|
-
date.getMonth() === value.from.getMonth());
|
|
148
|
-
};
|
|
149
|
-
const isDisabled = (month) => {
|
|
150
|
-
if (!isDisableAfterNow)
|
|
151
|
-
return false;
|
|
152
|
-
return new Date(currentYear, month, 1) > dayjs(now).endOf('month').toDate();
|
|
153
|
-
};
|
|
154
|
-
return (_jsxs("div", { className: "p-3 w-[280px]", children: [_jsxs("div", { className: "flex items-center justify-between mb-4 px-2", children: [_jsx("button", { type: "button", className: "inline-flex items-center justify-center size-8 rounded-md hover:bg-neutral-100 cursor-pointer", onClick: () => setCurrentYear((prev) => prev - 1), children: _jsx(LucideIcon, { name: "chevronLeft", size: 16 }) }), _jsxs("span", { className: "display14 bold", children: [currentYear, "\uB144"] }), _jsx("button", { type: "button", className: "inline-flex items-center justify-center size-8 rounded-md hover:bg-neutral-100 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", onClick: () => setCurrentYear((prev) => prev + 1), disabled: isDisableAfterNow && currentYear >= now.getFullYear(), children: _jsx(LucideIcon, { name: "chevronRight", size: 16 }) })] }), _jsx("div", { className: "grid grid-cols-3 gap-2", children: Array.from({ length: 12 }, (_, m) => (_jsxs("button", { type: "button", onClick: () => handleMonthClick(m), disabled: isDisabled(m), className: cn('h-10 rounded-md display12 ld-transition cursor-pointer', isSelected(m)
|
|
155
|
-
? 'bg-lb500 text-white bold'
|
|
156
|
-
: 'hover:bg-neutral10 text-mono60', isDisabled(m) && 'opacity-30 cursor-not-allowed'), children: [m + 1, "\uC6D4"] }, m))) })] }));
|
|
157
|
-
};
|
|
158
|
-
// ── YearRangePicker ──
|
|
159
|
-
const YearRangePicker = ({ value, onChange, isDisableAfterNow, }) => {
|
|
160
|
-
const [startYearPage, setStartYearPage] = useState(Math.floor((value?.from ? value.from.getFullYear() : new Date().getFullYear()) / 12) * 12);
|
|
161
|
-
const years = Array.from({ length: 12 }, (_, i) => startYearPage + i);
|
|
162
|
-
const now = new Date();
|
|
163
|
-
const handleYearClick = (year) => {
|
|
164
|
-
const clickedDate = new Date(year, 0, 1);
|
|
165
|
-
if (!value?.from || (value.from && value.to)) {
|
|
166
|
-
onChange({ from: clickedDate, to: undefined });
|
|
167
|
-
}
|
|
168
|
-
else if (clickedDate < value.from) {
|
|
169
|
-
onChange({ from: clickedDate, to: undefined });
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
onChange({
|
|
173
|
-
from: value.from,
|
|
174
|
-
to: dayjs(clickedDate).endOf('year').toDate(),
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
const isSelected = (year) => {
|
|
179
|
-
if (!value?.from)
|
|
180
|
-
return false;
|
|
181
|
-
const date = new Date(year, 0, 1);
|
|
182
|
-
if (value.to) {
|
|
183
|
-
return (date >= dayjs(value.from).startOf('year').toDate() && date <= value.to);
|
|
184
|
-
}
|
|
185
|
-
return date.getFullYear() === value.from.getFullYear();
|
|
186
|
-
};
|
|
187
|
-
const isDisabled = (year) => {
|
|
188
|
-
if (!isDisableAfterNow)
|
|
189
|
-
return false;
|
|
190
|
-
return year > now.getFullYear();
|
|
191
|
-
};
|
|
192
|
-
return (_jsxs("div", { className: "p-3 w-[280px]", children: [_jsxs("div", { className: "flex items-center justify-between mb-4 px-2", children: [_jsx("button", { type: "button", className: "inline-flex items-center justify-center size-8 rounded-md hover:bg-neutral-100 cursor-pointer", onClick: () => setStartYearPage((prev) => prev - 12), children: _jsx(LucideIcon, { name: "chevronLeft", size: 16 }) }), _jsxs("span", { className: "display14 bold", children: [years[0], " - ", years[years.length - 1]] }), _jsx("button", { type: "button", className: "inline-flex items-center justify-center size-8 rounded-md hover:bg-neutral-100 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", onClick: () => setStartYearPage((prev) => prev + 12), disabled: isDisableAfterNow &&
|
|
193
|
-
(years[years.length - 1] ?? 0) >= now.getFullYear(), children: _jsx(LucideIcon, { name: "chevronRight", size: 16 }) })] }), _jsx("div", { className: "grid grid-cols-3 gap-2", children: years.map((y) => (_jsxs("button", { type: "button", onClick: () => handleYearClick(y), disabled: isDisabled(y), className: cn('h-10 rounded-md display12 ld-transition cursor-pointer', isSelected(y)
|
|
194
|
-
? 'bg-lb500 text-white bold'
|
|
195
|
-
: 'hover:bg-neutral10 text-mono60', isDisabled(y) && 'opacity-30 cursor-not-allowed'), children: [y, "\uB144"] }, y))) })] }));
|
|
196
|
-
};
|
|
197
|
-
export default DateRangePicker;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type RegisterOptions } from 'react-hook-form';
|
|
2
|
-
import { type DateRangePickerProps } from './DateRangePicker.js';
|
|
3
|
-
interface FormDateRangePickerProps extends Omit<DateRangePickerProps, 'value' | 'onChange'> {
|
|
4
|
-
name: string;
|
|
5
|
-
options?: RegisterOptions;
|
|
6
|
-
customErrorMessage?: string;
|
|
7
|
-
isHiddenErrorMessage?: boolean;
|
|
8
|
-
errorClassName?: string;
|
|
9
|
-
}
|
|
10
|
-
declare const FormDateRangePicker: ({ name, options, customErrorMessage, isHiddenErrorMessage, errorClassName, disabled, block, ...props }: FormDateRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default FormDateRangePicker;
|
|
12
|
-
//# sourceMappingURL=FormDateRangePicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormDateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DateRangePicker/FormDateRangePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAwB,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAK/E,UAAU,wBAAyB,SAAQ,IAAI,CAC7C,oBAAoB,EACpB,OAAO,GAAG,UAAU,CACrB;IACC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,QAAA,MAAM,mBAAmB,GAAI,wGAS1B,wBAAwB,4CAkC1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import DateRangePicker from './DateRangePicker.js';
|
|
4
|
-
import FormField from '../Form/FormField.js';
|
|
5
|
-
import FormErrorMessage from '../Form/FormErrorMessage.js';
|
|
6
|
-
import cn from '../../utils/cn.js';
|
|
7
|
-
const FormDateRangePicker = ({ name, options, customErrorMessage = '', isHiddenErrorMessage = true, errorClassName, disabled = false, block = false, ...props }) => {
|
|
8
|
-
return (_jsx(FormField, { name: name, options: options, customErrorMessage: customErrorMessage, disabled: disabled, children: ({ field, fieldState }) => (_jsxs("div", { className: cn('relative border-2 border-transparent', block ? 'w-full' : 'w-auto'), children: [_jsx(DateRangePicker, { ...props, block: block, value: field.value ?? undefined, onChange: field.onChange, disabled: disabled, color: fieldState.hasError ? 'danger' : 'neutral' }), !isHiddenErrorMessage && (_jsx(FormErrorMessage, { error: fieldState.error, disabled: disabled, className: errorClassName }))] })) }));
|
|
9
|
-
};
|
|
10
|
-
export default FormDateRangePicker;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type DividerBaseRootProps } from './DividerBase.js';
|
|
2
|
-
export type TOrientation = 'horizontal' | 'vertical';
|
|
3
|
-
export interface DividerProps extends Omit<DividerBaseRootProps, 'children'> {
|
|
4
|
-
orientation?: TOrientation;
|
|
5
|
-
decorative?: boolean;
|
|
6
|
-
}
|
|
7
|
-
declare const Divider: ({ orientation, decorative, className, ...props }: DividerProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export default Divider;
|
|
9
|
-
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../src/components/Divider/Divider.tsx"],"names":[],"mappings":"AACA,OAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,UAAU,CAAC;AAErD,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC1E,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,QAAA,MAAM,OAAO,GAAI,kDAKd,YAAY,4CASd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import cn from '../../utils/cn.js';
|
|
3
|
-
import DividerBase from './DividerBase.js';
|
|
4
|
-
const orientationClasses = {
|
|
5
|
-
horizontal: 'w-full h-px',
|
|
6
|
-
vertical: 'h-full w-px',
|
|
7
|
-
};
|
|
8
|
-
const Divider = ({ orientation = 'horizontal', decorative = true, className, ...props }) => {
|
|
9
|
-
return (_jsx(DividerBase.Root, { role: decorative ? 'undefined' : 'separator', "aria-orientation": decorative ? undefined : orientation, className: cn(orientationClasses[orientation], className), ...props }));
|
|
10
|
-
};
|
|
11
|
-
export default Divider;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type HTMLAttributes, type Ref } from 'react';
|
|
2
|
-
export interface DividerBaseRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
ref?: Ref<HTMLDivElement>;
|
|
4
|
-
}
|
|
5
|
-
export declare const DividerBase: {
|
|
6
|
-
Root: ({ ref, className, ...props }: DividerBaseRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
};
|
|
8
|
-
export default DividerBase;
|
|
9
|
-
//# sourceMappingURL=DividerBase.d.ts.map
|
|
@@ -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;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0BAA0B;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yBAAyB;IACzB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,cAAc;IACd,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,kDAAkD;IAClD,UAAU,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACjC,mBAAmB;IACnB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,mBAAmB;IACnB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACjE,gBAAgB;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa;IACb,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,eAAe;IACf,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,wBAAwB;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,oCAAoC;IACpC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAUD,QAAA,MAAM,MAAM,GAAI,+LAiBb,WAAW,4CAmFb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
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,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAEhD,UAAU,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA4BD,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAWD,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAaD,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAgBD,UAAU,WAAW;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAcD,UAAU,UAAU;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAWD,UAAU,UAAU;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAOD,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,eAAO,MAAM,UAAU;uHArHpB,SAAS;gDAuBuC,YAAY;6BAa/B,YAAY;8CAiBK,YAAY;4BAkB9B,WAAW;8CAkBO,UAAU;qCAcnB,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"}
|