@loword/loword-design-system 0.0.2 → 0.0.3
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/components/BreadCrumb/BreadCrumb.d.ts +17 -0
- package/dist/components/BreadCrumb/BreadCrumb.d.ts.map +1 -0
- package/dist/components/BreadCrumb/BreadCrumb.js +37 -0
- package/dist/components/BreadCrumb/BreadCrumbBase.d.ts +9 -0
- package/dist/components/BreadCrumb/BreadCrumbBase.d.ts.map +1 -0
- package/dist/components/BreadCrumb/BreadCrumbBase.js +17 -0
- package/dist/components/Button/ButtonSpinner.d.ts +1 -2
- package/dist/components/Button/ButtonSpinner.d.ts.map +1 -1
- package/dist/components/Button/ButtonSpinner.js +3 -2
- package/dist/components/Callout/Callout.d.ts +10 -0
- package/dist/components/Callout/Callout.d.ts.map +1 -0
- package/dist/components/Callout/Callout.js +6 -0
- package/dist/components/Callout/CalloutBase.d.ts +18 -0
- package/dist/components/Callout/CalloutBase.d.ts.map +1 -0
- package/dist/components/Callout/CalloutBase.js +21 -0
- package/dist/components/Divider/Divider.d.ts +9 -0
- package/dist/components/Divider/Divider.d.ts.map +1 -0
- package/dist/components/Divider/Divider.js +11 -0
- package/dist/components/Divider/DividerBase.d.ts +9 -0
- package/dist/components/Divider/DividerBase.d.ts.map +1 -0
- package/dist/components/Divider/DividerBase.js +9 -0
- package/dist/components/FileUpload/FileUploadBase.d.ts +5 -5
- package/dist/components/FileUpload/FileUploadBase.d.ts.map +1 -1
- package/dist/components/FileUpload/FileUploadBase.js +4 -4
- package/dist/components/Form/FormField.d.ts +2 -2
- package/dist/components/LDAvatar/AvatarBase.d.ts +32 -0
- package/dist/components/LDAvatar/AvatarBase.d.ts.map +1 -0
- package/dist/components/LDAvatar/AvatarBase.js +49 -0
- package/dist/components/LDAvatar/LDAvatar.d.ts +11 -0
- package/dist/components/LDAvatar/LDAvatar.d.ts.map +1 -0
- package/dist/components/LDAvatar/LDAvatar.js +24 -0
- package/dist/components/LDBadge/BadgeBase.d.ts +10 -0
- package/dist/components/LDBadge/BadgeBase.d.ts.map +1 -0
- package/dist/components/LDBadge/BadgeBase.js +9 -0
- package/dist/components/LDBadge/LDBadge.d.ts +25 -0
- package/dist/components/LDBadge/LDBadge.d.ts.map +1 -0
- package/dist/components/LDBadge/LDBadge.js +36 -0
- package/dist/components/LDBreadCrumb/BreadCrumbBase.d.ts +9 -0
- package/dist/components/LDBreadCrumb/BreadCrumbBase.d.ts.map +1 -0
- package/dist/components/LDBreadCrumb/BreadCrumbBase.js +17 -0
- package/dist/components/LDBreadCrumb/LDBreadCrumb.d.ts +17 -0
- package/dist/components/LDBreadCrumb/LDBreadCrumb.d.ts.map +1 -0
- package/dist/components/LDBreadCrumb/LDBreadCrumb.js +37 -0
- package/dist/components/LDButton/ButtonBase.d.ts +5 -0
- package/dist/components/LDButton/ButtonBase.d.ts.map +1 -0
- package/dist/components/LDButton/ButtonBase.js +10 -0
- package/dist/components/LDButton/ButtonSpinner.d.ts +8 -0
- package/dist/components/LDButton/ButtonSpinner.d.ts.map +1 -0
- package/dist/components/LDButton/ButtonSpinner.js +15 -0
- package/dist/components/LDButton/LDButton.d.ts +26 -0
- package/dist/components/LDButton/LDButton.d.ts.map +1 -0
- package/dist/components/LDButton/LDButton.js +102 -0
- package/dist/components/LDCalendar/LDCalendar.d.ts +16 -0
- package/dist/components/LDCalendar/LDCalendar.d.ts.map +1 -0
- package/dist/components/LDCalendar/LDCalendar.js +75 -0
- package/dist/components/LDCallout/CalloutBase.d.ts +18 -0
- package/dist/components/LDCallout/CalloutBase.d.ts.map +1 -0
- package/dist/components/LDCallout/CalloutBase.js +21 -0
- package/dist/components/LDCallout/LDCallout.d.ts +10 -0
- package/dist/components/LDCallout/LDCallout.d.ts.map +1 -0
- package/dist/components/LDCallout/LDCallout.js +6 -0
- package/dist/components/LDCarousel/CarouselBase.d.ts +98 -0
- package/dist/components/LDCarousel/CarouselBase.d.ts.map +1 -0
- package/dist/components/LDCarousel/CarouselBase.js +144 -0
- package/dist/components/LDCarousel/LDCarousel.d.ts +50 -0
- package/dist/components/LDCarousel/LDCarousel.d.ts.map +1 -0
- package/dist/components/LDCarousel/LDCarousel.js +22 -0
- package/dist/components/LDCheckbox/CheckboxBase.d.ts +40 -0
- package/dist/components/LDCheckbox/CheckboxBase.d.ts.map +1 -0
- package/dist/components/LDCheckbox/CheckboxBase.js +57 -0
- package/dist/components/LDCheckbox/FormCheckbox.d.ts +14 -0
- package/dist/components/LDCheckbox/FormCheckbox.d.ts.map +1 -0
- package/dist/components/LDCheckbox/FormCheckbox.js +9 -0
- package/dist/components/LDCheckbox/FormCheckboxGroup.d.ts +13 -0
- package/dist/components/LDCheckbox/FormCheckboxGroup.d.ts.map +1 -0
- package/dist/components/LDCheckbox/FormCheckboxGroup.js +9 -0
- package/dist/components/LDCheckbox/LDCheckbox.d.ts +27 -0
- package/dist/components/LDCheckbox/LDCheckbox.d.ts.map +1 -0
- package/dist/components/LDCheckbox/LDCheckbox.js +30 -0
- package/dist/components/LDCheckbox/LDCheckboxGroup.d.ts +22 -0
- package/dist/components/LDCheckbox/LDCheckboxGroup.d.ts.map +1 -0
- package/dist/components/LDCheckbox/LDCheckboxGroup.js +13 -0
- package/dist/components/LDDataCalendar/DataCalendarBase.d.ts +45 -0
- package/dist/components/LDDataCalendar/DataCalendarBase.d.ts.map +1 -0
- package/dist/components/LDDataCalendar/DataCalendarBase.js +57 -0
- package/dist/components/LDDataCalendar/LDDataCalendar.d.ts +12 -0
- package/dist/components/LDDataCalendar/LDDataCalendar.d.ts.map +1 -0
- package/dist/components/LDDataCalendar/LDDataCalendar.js +13 -0
- package/dist/components/LDDatePicker/FormDatePicker.d.ts +12 -0
- package/dist/components/LDDatePicker/FormDatePicker.d.ts.map +1 -0
- package/dist/components/LDDatePicker/FormDatePicker.js +12 -0
- package/dist/components/LDDatePicker/LDDatePicker.d.ts +34 -0
- package/dist/components/LDDatePicker/LDDatePicker.d.ts.map +1 -0
- package/dist/components/LDDatePicker/LDDatePicker.js +44 -0
- package/dist/components/LDDateRangePicker/FormDateRangePicker.d.ts +12 -0
- package/dist/components/LDDateRangePicker/FormDateRangePicker.d.ts.map +1 -0
- package/dist/components/LDDateRangePicker/FormDateRangePicker.js +10 -0
- package/dist/components/LDDateRangePicker/LDDateRangePicker.d.ts +49 -0
- package/dist/components/LDDateRangePicker/LDDateRangePicker.d.ts.map +1 -0
- package/dist/components/LDDateRangePicker/LDDateRangePicker.js +197 -0
- package/dist/components/LDDivider/DividerBase.d.ts +9 -0
- package/dist/components/LDDivider/DividerBase.d.ts.map +1 -0
- package/dist/components/LDDivider/DividerBase.js +9 -0
- package/dist/components/LDDivider/LDDivider.d.ts +9 -0
- package/dist/components/LDDivider/LDDivider.d.ts.map +1 -0
- package/dist/components/LDDivider/LDDivider.js +11 -0
- package/dist/components/LDDrawer/DrawerBase.d.ts +52 -0
- package/dist/components/LDDrawer/DrawerBase.d.ts.map +1 -0
- package/dist/components/LDDrawer/DrawerBase.js +38 -0
- package/dist/components/LDDrawer/LDDrawer.d.ts +51 -0
- package/dist/components/LDDrawer/LDDrawer.d.ts.map +1 -0
- package/dist/components/LDDrawer/LDDrawer.js +30 -0
- package/dist/components/LDEditor/EditorBase.d.ts +52 -0
- package/dist/components/LDEditor/EditorBase.d.ts.map +1 -0
- package/dist/components/LDEditor/EditorBase.js +89 -0
- package/dist/components/LDEditor/LDEditor.d.ts +12 -0
- package/dist/components/LDEditor/LDEditor.d.ts.map +1 -0
- package/dist/components/LDEditor/LDEditor.js +162 -0
- package/dist/components/LDEditor/LDViewer.d.ts +7 -0
- package/dist/components/LDEditor/LDViewer.d.ts.map +1 -0
- package/dist/components/LDEditor/LDViewer.js +9 -0
- package/dist/components/LDEditor/extensions.d.ts +6 -0
- package/dist/components/LDEditor/extensions.d.ts.map +1 -0
- package/dist/components/LDEditor/extensions.js +38 -0
- package/dist/components/LDInput/FormInput.d.ts +15 -0
- package/dist/components/LDInput/FormInput.d.ts.map +1 -0
- package/dist/components/LDInput/FormInput.js +19 -0
- package/dist/components/LDInput/InputBase.d.ts +22 -0
- package/dist/components/LDInput/InputBase.d.ts.map +1 -0
- package/dist/components/LDInput/InputBase.js +17 -0
- package/dist/components/LDInput/LDInput.d.ts +24 -0
- package/dist/components/LDInput/LDInput.d.ts.map +1 -0
- package/dist/components/LDInput/LDInput.js +71 -0
- package/dist/components/LDLoadingDots/LDLoadingDots.d.ts +8 -0
- package/dist/components/LDLoadingDots/LDLoadingDots.d.ts.map +1 -0
- package/dist/components/LDLoadingDots/LDLoadingDots.js +29 -0
- package/dist/components/LDMenuBar/LDMenuBar.d.ts +21 -0
- package/dist/components/LDMenuBar/LDMenuBar.d.ts.map +1 -0
- package/dist/components/LDMenuBar/LDMenuBar.js +33 -0
- package/dist/components/LDMenuBar/MenuBarBase.d.ts +43 -0
- package/dist/components/LDMenuBar/MenuBarBase.d.ts.map +1 -0
- package/dist/components/LDMenuBar/MenuBarBase.js +69 -0
- package/dist/components/LDModal/LDModal.d.ts +51 -0
- package/dist/components/LDModal/LDModal.d.ts.map +1 -0
- package/dist/components/LDModal/LDModal.js +72 -0
- package/dist/components/LDModal/ModalBase.d.ts +42 -0
- package/dist/components/LDModal/ModalBase.d.ts.map +1 -0
- package/dist/components/LDModal/ModalBase.js +30 -0
- package/dist/components/LDModal/openModal.d.ts +24 -0
- package/dist/components/LDModal/openModal.d.ts.map +1 -0
- package/dist/components/LDModal/openModal.js +52 -0
- package/dist/components/LDOTPInput/LDOTPInput.d.ts +46 -0
- package/dist/components/LDOTPInput/LDOTPInput.d.ts.map +1 -0
- package/dist/components/LDOTPInput/LDOTPInput.js +87 -0
- package/dist/components/LDPagination/LDPagination.d.ts +12 -0
- package/dist/components/LDPagination/LDPagination.d.ts.map +1 -0
- package/dist/components/LDPagination/LDPagination.js +5 -0
- package/dist/components/LDPagination/PaginationBase.d.ts +36 -0
- package/dist/components/LDPagination/PaginationBase.d.ts.map +1 -0
- package/dist/components/LDPagination/PaginationBase.js +44 -0
- package/dist/components/LDPagination/paginationUtils.d.ts +2 -0
- package/dist/components/LDPagination/paginationUtils.d.ts.map +1 -0
- package/dist/components/LDPagination/paginationUtils.js +18 -0
- package/dist/components/LDPopover/LDPopover.d.ts +42 -0
- package/dist/components/LDPopover/LDPopover.d.ts.map +1 -0
- package/dist/components/LDPopover/LDPopover.js +31 -0
- package/dist/components/LDPopover/PopoverBase.d.ts +31 -0
- package/dist/components/LDPopover/PopoverBase.d.ts.map +1 -0
- package/dist/components/LDPopover/PopoverBase.js +18 -0
- package/dist/components/LDRadio/FormRadioGroup.d.ts +13 -0
- package/dist/components/LDRadio/FormRadioGroup.d.ts.map +1 -0
- package/dist/components/LDRadio/FormRadioGroup.js +9 -0
- package/dist/components/LDRadio/LDRadio.d.ts +24 -0
- package/dist/components/LDRadio/LDRadio.d.ts.map +1 -0
- package/dist/components/LDRadio/LDRadio.js +39 -0
- package/dist/components/LDRadio/LDRadioGroup.d.ts +22 -0
- package/dist/components/LDRadio/LDRadioGroup.d.ts.map +1 -0
- package/dist/components/LDRadio/LDRadioGroup.js +7 -0
- package/dist/components/LDRadio/RadioBase.d.ts +38 -0
- package/dist/components/LDRadio/RadioBase.d.ts.map +1 -0
- package/dist/components/LDRadio/RadioBase.js +46 -0
- package/dist/components/LDScrollArea/LDScrollArea.d.ts +15 -0
- package/dist/components/LDScrollArea/LDScrollArea.d.ts.map +1 -0
- package/dist/components/LDScrollArea/LDScrollArea.js +10 -0
- package/dist/components/LDSelect/FormMultiSelect.d.ts +13 -0
- package/dist/components/LDSelect/FormMultiSelect.d.ts.map +1 -0
- package/dist/components/LDSelect/FormMultiSelect.js +14 -0
- package/dist/components/LDSelect/FormSelect.d.ts +13 -0
- package/dist/components/LDSelect/FormSelect.d.ts.map +1 -0
- package/dist/components/LDSelect/FormSelect.js +10 -0
- package/dist/components/LDSelect/LDMultiSelect.d.ts +31 -0
- package/dist/components/LDSelect/LDMultiSelect.d.ts.map +1 -0
- package/dist/components/LDSelect/LDMultiSelect.js +59 -0
- package/dist/components/LDSelect/LDSelect.d.ts +41 -0
- package/dist/components/LDSelect/LDSelect.d.ts.map +1 -0
- package/dist/components/LDSelect/LDSelect.js +55 -0
- package/dist/components/LDSelect/SelectBase.d.ts +59 -0
- package/dist/components/LDSelect/SelectBase.d.ts.map +1 -0
- package/dist/components/LDSelect/SelectBase.js +211 -0
- package/dist/components/LDSkeleton/LDSkeleton.d.ts +10 -0
- package/dist/components/LDSkeleton/LDSkeleton.d.ts.map +1 -0
- package/dist/components/LDSkeleton/LDSkeleton.js +8 -0
- package/dist/components/LDSlider/LDSlider.d.ts +23 -0
- package/dist/components/LDSlider/LDSlider.d.ts.map +1 -0
- package/dist/components/LDSlider/LDSlider.js +195 -0
- package/dist/components/LDSpinner/LDSpinner.d.ts +25 -0
- package/dist/components/LDSpinner/LDSpinner.d.ts.map +1 -0
- package/dist/components/LDSpinner/LDSpinner.js +20 -0
- package/dist/components/LDTable/LDTable.d.ts +34 -0
- package/dist/components/LDTable/LDTable.d.ts.map +1 -0
- package/dist/components/LDTable/LDTable.js +29 -0
- package/dist/components/LDTable/LDTanstackTable.d.ts +23 -0
- package/dist/components/LDTable/LDTanstackTable.d.ts.map +1 -0
- package/dist/components/LDTable/LDTanstackTable.js +35 -0
- package/dist/components/LDTable/TableBase.d.ts +37 -0
- package/dist/components/LDTable/TableBase.d.ts.map +1 -0
- package/dist/components/LDTable/TableBase.js +39 -0
- package/dist/components/LDTable/TableField.d.ts +64 -0
- package/dist/components/LDTable/TableField.d.ts.map +1 -0
- package/dist/components/LDTable/TableField.js +87 -0
- package/dist/components/LDTimePicker/FormTimePicker.d.ts +12 -0
- package/dist/components/LDTimePicker/FormTimePicker.d.ts.map +1 -0
- package/dist/components/LDTimePicker/FormTimePicker.js +12 -0
- package/dist/components/LDTimePicker/LDTimePicker.d.ts +27 -0
- package/dist/components/LDTimePicker/LDTimePicker.d.ts.map +1 -0
- package/dist/components/LDTimePicker/LDTimePicker.js +120 -0
- package/dist/components/LDToggleButton/FormToggleButton.d.ts +12 -0
- package/dist/components/LDToggleButton/FormToggleButton.d.ts.map +1 -0
- package/dist/components/LDToggleButton/FormToggleButton.js +9 -0
- package/dist/components/LDToggleButton/LDToggleButton.d.ts +31 -0
- package/dist/components/LDToggleButton/LDToggleButton.d.ts.map +1 -0
- package/dist/components/LDToggleButton/LDToggleButton.js +42 -0
- package/dist/components/LDToggleButton/ToggleButtonBase.d.ts +41 -0
- package/dist/components/LDToggleButton/ToggleButtonBase.d.ts.map +1 -0
- package/dist/components/LDToggleButton/ToggleButtonBase.js +59 -0
- package/dist/components/LDTooltip/LDTooltip.d.ts +18 -0
- package/dist/components/LDTooltip/LDTooltip.d.ts.map +1 -0
- package/dist/components/LDTooltip/LDTooltip.js +13 -0
- package/dist/components/LDTooltip/TooltipBase.d.ts +39 -0
- package/dist/components/LDTooltip/TooltipBase.d.ts.map +1 -0
- package/dist/components/LDTooltip/TooltipBase.js +46 -0
- package/dist/components/LNB/LNBBase.js +2 -2
- package/dist/components/Spinner/Spinner.d.ts +1 -1
- package/dist/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.js +1 -1
- package/dist/index.css +115 -13
- package/dist/index.d.ts +48 -45
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -75
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
4
|
+
import cn from '../../utils/cn.js';
|
|
5
|
+
import DataCalendarBase from './DataCalendarBase.js';
|
|
6
|
+
const Root = ({ className, ...props }) => (_jsx(DataCalendarBase.Root, { className: cn('w-full select-none', className), ...props }));
|
|
7
|
+
const Title = ({ className, ...props }) => (_jsx(DataCalendarBase.Title, { className: cn('display32 bold flex justify-center', className), ...props }));
|
|
8
|
+
const Prev = ({ className, children, ...props }) => (_jsx(DataCalendarBase.Prev, { className: cn('flex items-center justify-center rounded-full size-[30px] bg-neutral100 hover:bg-mono400 text-neutral500 ld-transition cursor-pointer', className), ...props, children: children ?? _jsx(ChevronLeft, { size: 15 }) }));
|
|
9
|
+
const Next = ({ className, children, ...props }) => (_jsx(DataCalendarBase.Next, { className: cn('flex items-center justify-center rounded-full size-[30px] bg-neutral100 hover:bg-mono400 text-neutral500 ld-transition cursor-pointer', className), ...props, children: children ?? _jsx(ChevronRight, { size: 16 }) }));
|
|
10
|
+
const Grid = ({ className, weekdayClassName, ...props }) => (_jsx(DataCalendarBase.Grid, { className: className, weekdayClassName: cn('display14 text-mono500 py-[10px] ', weekdayClassName), ...props }));
|
|
11
|
+
const Cell = ({ className, dateClassName, ...props }) => (_jsx(DataCalendarBase.Cell, { className: cn('min-h-[100px] py-[10px] flex flex-col gap-[15px] data-outside:*:text-mono400', className), dateClassName: cn('display16 font-normal self-start leading-none data-[outside]:text-mono400 data-[outside]:font-normal data-[weekend]:text-danger600 data-[outside]:data-[weekend]:text-danger200', dateClassName), ...props }));
|
|
12
|
+
const LDDataCalendar = { Root, Title, Prev, Next, Grid, Cell };
|
|
13
|
+
export default LDDataCalendar;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RegisterOptions } from 'react-hook-form';
|
|
2
|
+
import { type LDDatePickerProps } from './LDDatePicker.js';
|
|
3
|
+
interface FormDatePickerProps extends Omit<LDDatePickerProps, 'value' | 'onChange'> {
|
|
4
|
+
name: string;
|
|
5
|
+
options?: RegisterOptions;
|
|
6
|
+
customErrorMessage?: string;
|
|
7
|
+
isHiddenErrorMessage?: boolean;
|
|
8
|
+
errorClassName?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const FormDatePicker: ({ name, options, customErrorMessage, isHiddenErrorMessage, errorClassName, disabled, block, ...props }: FormDatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default FormDatePicker;
|
|
12
|
+
//# sourceMappingURL=FormDatePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/LDDatePicker/FormDatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAqB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAKtE,UAAU,mBAAoB,SAAQ,IAAI,CACxC,iBAAiB,EACjB,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,cAAc,GAAI,wGASrB,mBAAmB,4CAoCrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import LDDatePicker from './LDDatePicker.js';
|
|
4
|
+
import FormField from '../Form/FormField.js';
|
|
5
|
+
import FormErrorMessage from '../Form/FormErrorMessage.js';
|
|
6
|
+
import cn from '../../utils/cn.js';
|
|
7
|
+
const FormDatePicker = ({ name, options, customErrorMessage = '', isHiddenErrorMessage = false, 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(LDDatePicker, { ...props, block: block, value: field.value ?? undefined, onChange: (date) => {
|
|
9
|
+
field.onChange(date);
|
|
10
|
+
}, disabled: disabled, color: fieldState.hasError ? 'danger' : 'neutral' }), !isHiddenErrorMessage && (_jsx(FormErrorMessage, { error: fieldState.error, disabled: disabled, className: errorClassName }))] })) }));
|
|
11
|
+
};
|
|
12
|
+
export default FormDatePicker;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface LDDatePickerProps {
|
|
3
|
+
/** 선택된 날짜 (controlled) */
|
|
4
|
+
value?: Date;
|
|
5
|
+
/** 초기 선택 날짜 (uncontrolled) */
|
|
6
|
+
defaultValue?: Date;
|
|
7
|
+
/** 날짜 변경 시 호출되는 콜백 */
|
|
8
|
+
onChange?: (value: Date | undefined) => void;
|
|
9
|
+
/** 미선택 시 표시할 텍스트 */
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
/** 비활성화 여부 */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** true 시 너비 100% */
|
|
14
|
+
block?: boolean;
|
|
15
|
+
/** 색상 테마 (danger 시 에러 스타일) */
|
|
16
|
+
color?: 'neutral' | 'danger';
|
|
17
|
+
/** 현재 시점 이후 날짜 선택 비활성화 */
|
|
18
|
+
isDisableAfterNow?: boolean;
|
|
19
|
+
/** 최소 선택 가능 날짜 */
|
|
20
|
+
minDate?: Date;
|
|
21
|
+
/** 트리거 우측 아이콘 */
|
|
22
|
+
trailingIcon?: ReactNode;
|
|
23
|
+
/** 날짜 초기화 버튼 표시 여부 */
|
|
24
|
+
showReset?: boolean;
|
|
25
|
+
/** 추가 CSS 클래스 */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** 인라인 스타일 (트리거 버튼에 적용) */
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
/** 트리거 버튼 className */
|
|
30
|
+
triggerClassName?: string;
|
|
31
|
+
}
|
|
32
|
+
declare const LDDatePicker: ({ value, defaultValue, onChange, placeholder, disabled, block, color, isDisableAfterNow, minDate, trailingIcon, showReset, className, style, triggerClassName, }: LDDatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export default LDDatePicker;
|
|
34
|
+
//# sourceMappingURL=LDDatePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDDatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/LDDatePicker/LDDatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AASjD,MAAM,WAAW,iBAAiB;IAChC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,8BAA8B;IAC9B,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAC7C,oBAAoB;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,0BAA0B;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB;IAClB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,iBAAiB;IACjB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,uBAAuB;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,QAAA,MAAM,YAAY,GAAI,kKAiBnB,iBAAiB,4CA4FnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } 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 '../LDPopover/PopoverBase.js';
|
|
7
|
+
import LDCalendar from '../LDCalendar/LDCalendar.js';
|
|
8
|
+
import LucideIcon from '../Icon/LucideIcon.js';
|
|
9
|
+
import cn from '../../utils/cn.js';
|
|
10
|
+
const LDDatePicker = ({ value, defaultValue, onChange, placeholder = 'YYYY-MM-DD', disabled = false, block = false, color = 'neutral', isDisableAfterNow = false, minDate, trailingIcon = (_jsx(LucideIcon, { name: "calendar", size: 15, className: "text-mono400" })), showReset = true, className, style, triggerClassName, }) => {
|
|
11
|
+
const [open, setOpen] = useState(false);
|
|
12
|
+
const [internal, setInternal] = useState(defaultValue);
|
|
13
|
+
const isControlled = value !== undefined;
|
|
14
|
+
const resolved = isControlled ? value : internal;
|
|
15
|
+
const handleSelect = (date) => {
|
|
16
|
+
if (!isControlled)
|
|
17
|
+
setInternal(date);
|
|
18
|
+
onChange?.(date);
|
|
19
|
+
setOpen(false);
|
|
20
|
+
};
|
|
21
|
+
const handleReset = (e) => {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
if (!isControlled)
|
|
24
|
+
setInternal(undefined);
|
|
25
|
+
onChange?.(undefined);
|
|
26
|
+
};
|
|
27
|
+
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-neutral100 h-[38px] w-full display14 px-4 rounded-[5px]', 'flex flex-row items-center justify-between gap-4', 'outline-2 outline-transparent ld-transition', disabled && 'cursor-not-allowed opacity-50', color === 'danger'
|
|
28
|
+
? 'bg-tintRed outline-red500'
|
|
29
|
+
: 'focus:bg-tintBlue focus:outline-lb500', triggerClassName), children: [resolved ? (_jsx("span", { children: dayjs(resolved).format('YYYY-MM-DD') })) : (_jsx("span", { className: "text-mono400", children: placeholder })), _jsxs("div", { className: "flex gap-[6px]", children: [trailingIcon, showReset && resolved && (_jsx("span", { role: "button", tabIndex: 0, className: "text-mono400 cursor-pointer", onClick: handleReset, onKeyDown: (e) => {
|
|
30
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
handleReset(e);
|
|
33
|
+
}
|
|
34
|
+
}, children: _jsx(LucideIcon, { name: "rotateCw", size: 14 }) }))] })] }), _jsx(PopoverBase.Content, { className: "rounded-md border border-neutral-200 bg-white shadow-md p-0 min-w-[280px] w-[var(--radix-popover-trigger-width)]", children: _jsx(LDCalendar, { className: "w-full", captionLayout: "dropdown", mode: "single", locale: ko, selected: resolved, onSelect: handleSelect, disabled: isDisableAfterNow
|
|
35
|
+
? (date) => date > new Date()
|
|
36
|
+
: minDate
|
|
37
|
+
? (date) => {
|
|
38
|
+
const dateOnly = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
39
|
+
const minDateOnly = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
|
|
40
|
+
return dateOnly < minDateOnly;
|
|
41
|
+
}
|
|
42
|
+
: false }) })] }) }));
|
|
43
|
+
};
|
|
44
|
+
export default LDDatePicker;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RegisterOptions } from 'react-hook-form';
|
|
2
|
+
import { type LDDateRangePickerProps } from './LDDateRangePicker.js';
|
|
3
|
+
interface FormDateRangePickerProps extends Omit<LDDateRangePickerProps, '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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/components/LDDateRangePicker/FormDateRangePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAA0B,EACxB,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAK7B,UAAU,wBAAyB,SAAQ,IAAI,CAC7C,sBAAsB,EACtB,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import LDDateRangePicker from './LDDateRangePicker.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(LDDateRangePicker, { ...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;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
type DateRange = {
|
|
3
|
+
from: Date;
|
|
4
|
+
to?: Date;
|
|
5
|
+
};
|
|
6
|
+
type ViewMode = 'daily' | 'monthly' | 'yearly';
|
|
7
|
+
export interface LDDateRangePickerProps {
|
|
8
|
+
/** 선택된 날짜 범위 ({ from, to? }) */
|
|
9
|
+
value?: DateRange;
|
|
10
|
+
/** 날짜 범위 변경 시 호출되는 콜백 */
|
|
11
|
+
onChange?: (value: DateRange | undefined) => void;
|
|
12
|
+
/** 비활성화 여부 */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** true 시 너비 100% */
|
|
15
|
+
block?: boolean;
|
|
16
|
+
/** 색상 테마 (danger 시 에러 스타일) */
|
|
17
|
+
color?: 'neutral' | 'danger';
|
|
18
|
+
/** 현재 시점 이후 날짜 선택 비활성화 */
|
|
19
|
+
isDisableAfterNow?: boolean;
|
|
20
|
+
/** 날짜 범위 완성 시 팝오버 자동 닫힘 */
|
|
21
|
+
isAutoClose?: boolean;
|
|
22
|
+
/** 선택 모드 (daily: 일별, monthly: 월별, yearly: 연별) */
|
|
23
|
+
viewMode?: ViewMode;
|
|
24
|
+
/** 초기 선택 날짜 범위 (uncontrolled) */
|
|
25
|
+
defaultValue?: DateRange;
|
|
26
|
+
/** 초기값 (리셋 시 이 값으로 복원) */
|
|
27
|
+
initialValue?: {
|
|
28
|
+
from: string;
|
|
29
|
+
to: string;
|
|
30
|
+
};
|
|
31
|
+
/** 트리거 우측 아이콘 */
|
|
32
|
+
trailingIcon?: ReactNode;
|
|
33
|
+
/** 날짜 범위 선택 완료 시 호출되는 콜백 */
|
|
34
|
+
onRangeComplete?: (range: {
|
|
35
|
+
from: Date;
|
|
36
|
+
to: Date;
|
|
37
|
+
}) => void;
|
|
38
|
+
/** 날짜 초기화 완료 시 호출되는 콜백 */
|
|
39
|
+
onResetComplete?: () => void;
|
|
40
|
+
/** 추가 CSS 클래스 */
|
|
41
|
+
className?: string;
|
|
42
|
+
/** 인라인 스타일 (트리거 버튼에 적용) */
|
|
43
|
+
style?: React.CSSProperties;
|
|
44
|
+
/** 트리거 버튼 className */
|
|
45
|
+
triggerClassName?: string;
|
|
46
|
+
}
|
|
47
|
+
declare const LDDateRangePicker: ({ value, onChange, disabled, block, color, isDisableAfterNow, isAutoClose, viewMode, defaultValue, initialValue, trailingIcon, onRangeComplete, onResetComplete, className, style, triggerClassName, }: LDDateRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export default LDDateRangePicker;
|
|
49
|
+
//# sourceMappingURL=LDDateRangePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDDateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/components/LDDateRangePicker/LDDateRangePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AASjD,KAAK,SAAS,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAC3C,KAAK,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAe/C,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IAClD,cAAc;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,0BAA0B;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,2BAA2B;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,iCAAiC;IACjC,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,0BAA0B;IAC1B,YAAY,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,iBAAiB;IACjB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,EAAE,EAAE,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D,0BAA0B;IAC1B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,uBAAuB;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,QAAA,MAAM,iBAAiB,GAAI,wMAmBxB,sBAAsB,4CAiLxB,CAAC;AA6LF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,197 @@
|
|
|
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 '../LDPopover/PopoverBase.js';
|
|
7
|
+
import LDCalendar from '../LDCalendar/LDCalendar.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 LDDateRangePicker = ({ 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(LDCalendar, { 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 LDDateRangePicker;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DividerBase.d.ts","sourceRoot":"","sources":["../../../src/components/LDDivider/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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DividerBaseRootProps } from './DividerBase.js';
|
|
2
|
+
export type TOrientation = 'horizontal' | 'vertical';
|
|
3
|
+
export interface LDDividerProps extends Omit<DividerBaseRootProps, 'children'> {
|
|
4
|
+
orientation?: TOrientation;
|
|
5
|
+
decorative?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const LDDivider: ({ orientation, decorative, className, ...props }: LDDividerProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default LDDivider;
|
|
9
|
+
//# sourceMappingURL=LDDivider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDDivider.d.ts","sourceRoot":"","sources":["../../../src/components/LDDivider/LDDivider.tsx"],"names":[],"mappings":"AACA,OAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,UAAU,CAAC;AAErD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC5E,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,QAAA,MAAM,SAAS,GAAI,kDAKhB,cAAc,4CAShB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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 LDDivider = ({ 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 LDDivider;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrawerBase.d.ts","sourceRoot":"","sources":["../../../src/components/LDDrawer/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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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;
|
|
@@ -0,0 +1,51 @@
|
|
|
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 반환 시 LDDrawer 닫힘 방지) */
|
|
13
|
+
onClick?: () => void | boolean | Promise<void | boolean>;
|
|
14
|
+
}
|
|
15
|
+
export interface LDDrawerProps {
|
|
16
|
+
/** LDDrawer 열림 상태 (제어 컴포넌트) */
|
|
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
|
+
/** LDDrawer 제목 */
|
|
31
|
+
title?: string;
|
|
32
|
+
/** LDDrawer 설명 텍스트 */
|
|
33
|
+
description?: string;
|
|
34
|
+
/** 본문 콘텐츠 */
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
/** 하단 버튼 목록 */
|
|
37
|
+
buttons?: DrawerButton[];
|
|
38
|
+
/** LDDrawer를 여는 트리거 요소 */
|
|
39
|
+
trigger?: ReactNode;
|
|
40
|
+
/** 드래그 핸들 표시 여부 (bottom/top 방향에서 기본 true) */
|
|
41
|
+
showHandle?: boolean;
|
|
42
|
+
/** 추가 CSS 클래스 (LDDrawer 패널에 적용) */
|
|
43
|
+
className?: string;
|
|
44
|
+
/** 인라인 스타일 (LDDrawer 패널에 적용) */
|
|
45
|
+
style?: React.CSSProperties;
|
|
46
|
+
/** 버튼 클릭 시 해당 버튼의 value를 전달하는 콜백 */
|
|
47
|
+
onButtonClick?: (value: unknown) => void;
|
|
48
|
+
}
|
|
49
|
+
declare const LDDrawer: ({ open, defaultOpen, onOpenChange, direction, snapPoints, activeSnapPoint, setActiveSnapPoint, title, description, children, buttons, trigger, showHandle, className, style, onButtonClick, }: LDDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export default LDDrawer;
|
|
51
|
+
//# sourceMappingURL=LDDrawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/LDDrawer/LDDrawer.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,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,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,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa;IACb,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,eAAe;IACf,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,oCAAoC;IACpC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAUD,QAAA,MAAM,QAAQ,GAAI,+LAiBf,aAAa,4CAmFf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|