@loword/loword-design-system 0.0.10 → 0.0.13
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/LDAccordion/AccordionBase.d.ts +41 -0
- package/dist/components/LDAccordion/AccordionBase.d.ts.map +1 -0
- package/dist/components/LDAccordion/AccordionBase.js +24 -0
- package/dist/components/LDAccordion/LDAccordion.d.ts +31 -0
- package/dist/components/LDAccordion/LDAccordion.d.ts.map +1 -0
- package/dist/components/LDAccordion/LDAccordion.js +21 -0
- package/dist/components/LDAutoComplete/AutoCompleteBase.js +6 -6
- package/dist/components/LDAvatar/LDAvatar.d.ts +1 -1
- package/dist/components/LDAvatar/LDAvatar.d.ts.map +1 -1
- package/dist/components/LDAvatar/LDAvatar.js +19 -10
- package/dist/components/LDBadge/LDBadge.d.ts +5 -6
- package/dist/components/LDBadge/LDBadge.d.ts.map +1 -1
- package/dist/components/LDBadge/LDBadge.js +2 -2
- package/dist/components/LDBreadCrumb/LDBreadCrumb.d.ts +1 -2
- package/dist/components/LDBreadCrumb/LDBreadCrumb.d.ts.map +1 -1
- package/dist/components/LDButton/LDButton.d.ts +3 -3
- package/dist/components/LDButton/LDButton.d.ts.map +1 -1
- package/dist/components/LDButton/LDButton.js +5 -5
- package/dist/components/LDCalendar/CalendarBase.d.ts +17 -0
- package/dist/components/LDCalendar/CalendarBase.d.ts.map +1 -0
- package/dist/components/LDCalendar/CalendarBase.js +49 -0
- package/dist/components/LDCalendar/LDCalendar.d.ts +8 -14
- package/dist/components/LDCalendar/LDCalendar.d.ts.map +1 -1
- package/dist/components/LDCalendar/LDCalendar.js +51 -39
- package/dist/components/LDCarousel/CarouselBase.d.ts +3 -3
- package/dist/components/LDCarousel/CarouselBase.d.ts.map +1 -1
- package/dist/components/LDCarousel/CarouselBase.js +12 -6
- package/dist/components/LDCarousel/LDCarousel.d.ts +7 -8
- package/dist/components/LDCarousel/LDCarousel.d.ts.map +1 -1
- package/dist/components/LDCarousel/LDCarousel.js +2 -2
- package/dist/components/LDCheckbox/CheckboxBase.d.ts +1 -3
- package/dist/components/LDCheckbox/CheckboxBase.d.ts.map +1 -1
- package/dist/components/LDCheckbox/CheckboxBase.js +4 -4
- package/dist/components/LDCheckbox/LDCheckbox.d.ts +2 -5
- package/dist/components/LDCheckbox/LDCheckbox.d.ts.map +1 -1
- package/dist/components/LDCheckbox/LDCheckbox.js +66 -8
- package/dist/components/LDCheckbox/LDCheckboxGroup.d.ts +3 -3
- package/dist/components/LDCheckbox/LDCheckboxGroup.d.ts.map +1 -1
- package/dist/components/LDCheckbox/LDCheckboxGroup.js +11 -2
- package/dist/components/LDCheckbox/LDFormCheckbox.d.ts +12 -0
- package/dist/components/LDCheckbox/LDFormCheckbox.d.ts.map +1 -0
- package/dist/components/LDCheckbox/LDFormCheckbox.js +8 -0
- package/dist/components/LDCheckbox/LDFormCheckboxGroup.d.ts +11 -0
- package/dist/components/LDCheckbox/LDFormCheckboxGroup.d.ts.map +1 -0
- package/dist/components/LDCheckbox/LDFormCheckboxGroup.js +8 -0
- package/dist/components/LDDataCalendar/DataCalendarBase.d.ts +17 -1
- package/dist/components/LDDataCalendar/DataCalendarBase.d.ts.map +1 -1
- package/dist/components/LDDataCalendar/DataCalendarBase.js +34 -4
- package/dist/components/LDDataCalendar/LDDataCalendar.d.ts +27 -10
- package/dist/components/LDDataCalendar/LDDataCalendar.d.ts.map +1 -1
- package/dist/components/LDDataCalendar/LDDataCalendar.js +8 -8
- package/dist/components/LDDatePicker/LDDatePicker.d.ts +10 -4
- package/dist/components/LDDatePicker/LDDatePicker.d.ts.map +1 -1
- package/dist/components/LDDatePicker/LDDatePicker.js +95 -25
- package/dist/components/LDDatePicker/LDFormDatePicker.d.ts +13 -0
- package/dist/components/LDDatePicker/LDFormDatePicker.d.ts.map +1 -0
- package/dist/components/LDDatePicker/LDFormDatePicker.js +15 -0
- package/dist/components/LDDateRangePicker/LDDateRangePicker.d.ts +13 -6
- package/dist/components/LDDateRangePicker/LDDateRangePicker.d.ts.map +1 -1
- package/dist/components/LDDateRangePicker/LDDateRangePicker.js +143 -93
- package/dist/components/LDDateRangePicker/LDFormDateRangePicker.d.ts +13 -0
- package/dist/components/LDDateRangePicker/LDFormDateRangePicker.d.ts.map +1 -0
- package/dist/components/LDDateRangePicker/LDFormDateRangePicker.js +20 -0
- package/dist/components/LDDrawer/LDDrawer.d.ts +2 -0
- package/dist/components/LDDrawer/LDDrawer.d.ts.map +1 -1
- package/dist/components/LDDrawer/LDDrawer.js +2 -2
- package/dist/components/LDEditor/LDEditor.d.ts.map +1 -1
- package/dist/components/LDEditor/LDEditor.js +94 -54
- package/dist/components/LDEmpty/EmptyBase.d.ts +19 -0
- package/dist/components/LDEmpty/EmptyBase.d.ts.map +1 -0
- package/dist/components/LDEmpty/EmptyBase.js +18 -0
- package/dist/components/LDEmpty/LDEmpty.d.ts +35 -0
- package/dist/components/LDEmpty/LDEmpty.d.ts.map +1 -0
- package/dist/components/LDEmpty/LDEmpty.js +30 -0
- package/dist/components/LDFileUpload/FileUploadBase.d.ts +11 -3
- package/dist/components/LDFileUpload/FileUploadBase.d.ts.map +1 -1
- package/dist/components/LDFileUpload/FileUploadBase.js +21 -21
- package/dist/components/LDFileUpload/LDFileUpload.d.ts +3 -0
- package/dist/components/LDFileUpload/LDFileUpload.d.ts.map +1 -1
- package/dist/components/LDFileUpload/LDFileUpload.js +3 -3
- package/dist/components/LDFileUpload/LDFileUploadList.d.ts +3 -0
- package/dist/components/LDFileUpload/LDFileUploadList.d.ts.map +1 -1
- package/dist/components/LDFileUpload/LDFileUploadList.js +1 -3
- package/dist/components/LDFileUpload/LDImageUpload.d.ts +5 -0
- package/dist/components/LDFileUpload/LDImageUpload.d.ts.map +1 -1
- package/dist/components/LDFileUpload/LDImageUpload.js +5 -3
- package/dist/components/LDFileUpload/LDImageUploadList.d.ts +3 -0
- package/dist/components/LDFileUpload/LDImageUploadList.d.ts.map +1 -1
- package/dist/components/LDFileUpload/LDImageUploadList.js +1 -3
- package/dist/components/LDForm/LDFormErrorMessage.d.ts +3 -1
- package/dist/components/LDForm/LDFormErrorMessage.d.ts.map +1 -1
- package/dist/components/LDForm/LDFormErrorMessage.js +2 -2
- package/dist/components/LDInput/InputBase.d.ts +5 -3
- package/dist/components/LDInput/InputBase.d.ts.map +1 -1
- package/dist/components/LDInput/InputBase.js +4 -4
- package/dist/components/LDInput/LDFormInput.d.ts +1 -1
- package/dist/components/LDInput/LDFormInput.d.ts.map +1 -1
- package/dist/components/LDInput/LDFormInput.js +17 -14
- package/dist/components/LDInput/LDInput.d.ts +10 -3
- package/dist/components/LDInput/LDInput.d.ts.map +1 -1
- package/dist/components/LDInput/LDInput.js +114 -50
- package/dist/components/LDLNB/LDLNB.d.ts +42 -0
- package/dist/components/LDLNB/LDLNB.d.ts.map +1 -0
- package/dist/components/LDLNB/LDLNB.js +34 -0
- package/dist/components/LDLNB/LDLNBBase.d.ts +5 -13
- package/dist/components/LDLNB/LDLNBBase.d.ts.map +1 -1
- package/dist/components/LDLNB/LDLNBBase.js +52 -18
- package/dist/components/LDMenuBar/LDMenuBar.d.ts +33 -19
- package/dist/components/LDMenuBar/LDMenuBar.d.ts.map +1 -1
- package/dist/components/LDMenuBar/LDMenuBar.js +13 -27
- package/dist/components/LDMenuBar/MenuBarBase.d.ts +4 -5
- package/dist/components/LDMenuBar/MenuBarBase.d.ts.map +1 -1
- package/dist/components/LDMenuBar/MenuBarBase.js +12 -14
- package/dist/components/LDModal/LDModal.d.ts +20 -40
- package/dist/components/LDModal/LDModal.d.ts.map +1 -1
- package/dist/components/LDModal/LDModal.js +56 -70
- package/dist/components/LDModal/LDModalView.d.ts +59 -0
- package/dist/components/LDModal/LDModalView.d.ts.map +1 -0
- package/dist/components/LDModal/LDModalView.js +72 -0
- package/dist/components/LDNotification/LDNotification.d.ts +40 -0
- package/dist/components/LDNotification/LDNotification.d.ts.map +1 -0
- package/dist/components/LDNotification/LDNotification.js +76 -0
- package/dist/components/LDNotification/NotificationBase.d.ts +29 -0
- package/dist/components/LDNotification/NotificationBase.d.ts.map +1 -0
- package/dist/components/LDNotification/NotificationBase.js +27 -0
- package/dist/components/LDOTPInput/LDFormOTPInput.d.ts +15 -0
- package/dist/components/LDOTPInput/LDFormOTPInput.d.ts.map +1 -0
- package/dist/components/LDOTPInput/LDFormOTPInput.js +8 -0
- package/dist/components/LDOTPInput/LDOTPInput.d.ts +10 -22
- package/dist/components/LDOTPInput/LDOTPInput.d.ts.map +1 -1
- package/dist/components/LDOTPInput/LDOTPInput.js +44 -72
- package/dist/components/LDOTPInput/OTPInputBase.d.ts +46 -0
- package/dist/components/LDOTPInput/OTPInputBase.d.ts.map +1 -0
- package/dist/components/LDOTPInput/OTPInputBase.js +48 -0
- package/dist/components/LDPagination/LDPagination.d.ts +5 -1
- package/dist/components/LDPagination/LDPagination.d.ts.map +1 -1
- package/dist/components/LDPagination/LDPagination.js +3 -1
- package/dist/components/LDPagination/PaginationBase.d.ts +13 -4
- package/dist/components/LDPagination/PaginationBase.d.ts.map +1 -1
- package/dist/components/LDPagination/PaginationBase.js +8 -7
- package/dist/components/LDPopover/LDPopover.d.ts +1 -1
- package/dist/components/LDPopover/LDPopover.d.ts.map +1 -1
- package/dist/components/LDPopover/LDPopover.js +8 -7
- package/dist/components/LDProgressBar/LDProgressBar.d.ts +16 -0
- package/dist/components/LDProgressBar/LDProgressBar.d.ts.map +1 -0
- package/dist/components/LDProgressBar/LDProgressBar.js +9 -0
- package/dist/components/LDProgressBar/ProgressBarBase.d.ts +11 -0
- package/dist/components/LDProgressBar/ProgressBarBase.d.ts.map +1 -0
- package/dist/components/LDProgressBar/ProgressBarBase.js +10 -0
- package/dist/components/LDRadio/LDFormRadioGroup.d.ts +11 -0
- package/dist/components/LDRadio/LDFormRadioGroup.d.ts.map +1 -0
- package/dist/components/LDRadio/LDFormRadioGroup.js +8 -0
- package/dist/components/LDRadio/LDRadio.d.ts +2 -2
- package/dist/components/LDRadio/LDRadio.d.ts.map +1 -1
- package/dist/components/LDRadio/LDRadio.js +70 -15
- package/dist/components/LDRadio/LDRadioGroup.d.ts +5 -3
- package/dist/components/LDRadio/LDRadioGroup.d.ts.map +1 -1
- package/dist/components/LDRadio/LDRadioGroup.js +11 -2
- package/dist/components/LDRadio/RadioBase.d.ts +2 -3
- package/dist/components/LDRadio/RadioBase.d.ts.map +1 -1
- package/dist/components/LDRadio/RadioBase.js +7 -4
- package/dist/components/LDSectionNav/LDSectionNav.d.ts +11 -0
- package/dist/components/LDSectionNav/LDSectionNav.d.ts.map +1 -0
- package/dist/components/LDSectionNav/LDSectionNav.js +11 -0
- package/dist/components/LDSectionNav/SectionNavBase.d.ts +20 -0
- package/dist/components/LDSectionNav/SectionNavBase.d.ts.map +1 -0
- package/dist/components/LDSectionNav/SectionNavBase.js +53 -0
- package/dist/components/LDSelect/LDFormMultiSelect.d.ts +13 -0
- package/dist/components/LDSelect/LDFormMultiSelect.d.ts.map +1 -0
- package/dist/components/LDSelect/{FormMultiSelect.js → LDFormMultiSelect.js} +2 -2
- package/dist/components/LDSelect/LDFormSelect.d.ts +13 -0
- package/dist/components/LDSelect/LDFormSelect.d.ts.map +1 -0
- package/dist/components/LDSelect/LDFormSelect.js +10 -0
- package/dist/components/LDSelect/LDMultiSelect.d.ts +6 -3
- package/dist/components/LDSelect/LDMultiSelect.d.ts.map +1 -1
- package/dist/components/LDSelect/LDMultiSelect.js +35 -31
- package/dist/components/LDSelect/LDSelect.d.ts +6 -3
- package/dist/components/LDSelect/LDSelect.d.ts.map +1 -1
- package/dist/components/LDSelect/LDSelect.js +37 -30
- package/dist/components/LDSelect/SelectBase.d.ts.map +1 -1
- package/dist/components/LDSelect/SelectBase.js +21 -7
- package/dist/components/LDSpinner/LDSpinner.d.ts +1 -1
- package/dist/components/LDSpinner/LDSpinner.d.ts.map +1 -1
- package/dist/components/LDSpinner/LDSpinner.js +6 -6
- package/dist/components/LDTable/LDCollapsibleTanstackTable.d.ts.map +1 -1
- package/dist/components/LDTable/LDCollapsibleTanstackTable.js +12 -9
- package/dist/components/LDTable/LDTable.d.ts.map +1 -1
- package/dist/components/LDTable/LDTable.js +1 -1
- package/dist/components/LDTable/LDTanstackTable.d.ts.map +1 -1
- package/dist/components/LDTable/LDTanstackTable.js +6 -7
- package/dist/components/LDTable/TableField.d.ts +1 -1
- package/dist/components/LDTable/TableField.d.ts.map +1 -1
- package/dist/components/LDTextarea/LDFormTextarea.d.ts +14 -0
- package/dist/components/LDTextarea/LDFormTextarea.d.ts.map +1 -0
- package/dist/components/LDTextarea/{FormTextarea.js → LDFormTextarea.js} +2 -2
- package/dist/components/LDTextarea/LDTextarea.d.ts +1 -1
- package/dist/components/LDTextarea/LDTextarea.d.ts.map +1 -1
- package/dist/components/LDTextarea/LDTextarea.js +30 -30
- package/dist/components/LDTimePicker/LDFormTimePicker.d.ts +12 -0
- package/dist/components/LDTimePicker/LDFormTimePicker.d.ts.map +1 -0
- package/dist/components/LDTimePicker/{FormTimePicker.js → LDFormTimePicker.js} +3 -3
- package/dist/components/LDTimePicker/LDTimePicker.js +3 -3
- package/dist/components/LDToast/LDToast.js +1 -1
- package/dist/components/LDToast/LDToaster.d.ts +2 -1
- package/dist/components/LDToast/LDToaster.d.ts.map +1 -1
- package/dist/components/LDToast/LDToaster.js +2 -2
- package/dist/components/LDToggleButton/LDFormToggleButton.d.ts +10 -0
- package/dist/components/LDToggleButton/LDFormToggleButton.d.ts.map +1 -0
- package/dist/components/LDToggleButton/LDFormToggleButton.js +8 -0
- package/dist/components/LDTooltip/LDTooltip.js +1 -1
- package/dist/components/LDTooltip/TooltipBase.d.ts +6 -2
- package/dist/components/LDTooltip/TooltipBase.d.ts.map +1 -1
- package/dist/components/LDTooltip/TooltipBase.js +4 -4
- package/dist/index.css +913 -307
- package/dist/index.d.ts +28 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -20
- package/dist/utils/file.d.ts +2 -2
- package/dist/utils/file.d.ts.map +1 -1
- package/dist/utils/file.js +26 -23
- package/dist/utils/renderIcon.d.ts +1 -2
- package/dist/utils/renderIcon.d.ts.map +1 -1
- package/dist/utils/renderIcon.js +5 -4
- package/package.json +14 -2
- package/src/styles/carousel.css +15 -14
- package/src/styles/components/button.css +2 -2
- package/src/styles/components/editor.css +6 -0
- package/src/styles/components/index.css +1 -0
- package/src/styles/components/input.css +16 -2
- package/src/styles/components/select.css +61 -0
- package/src/styles/components/shared.css +6 -6
- package/src/styles/motion.css +115 -0
- package/src/theme.css +3 -0
- package/dist/components/Icon/LucideIcon.d.ts +0 -12
- package/dist/components/Icon/LucideIcon.d.ts.map +0 -1
- package/dist/components/Icon/LucideIcon.js +0 -49
- package/dist/components/LDCheckbox/FormCheckbox.d.ts +0 -14
- package/dist/components/LDCheckbox/FormCheckbox.d.ts.map +0 -1
- package/dist/components/LDCheckbox/FormCheckbox.js +0 -9
- package/dist/components/LDCheckbox/FormCheckboxGroup.d.ts +0 -13
- package/dist/components/LDCheckbox/FormCheckboxGroup.d.ts.map +0 -1
- package/dist/components/LDCheckbox/FormCheckboxGroup.js +0 -9
- package/dist/components/LDDatePicker/FormDatePicker.d.ts +0 -12
- package/dist/components/LDDatePicker/FormDatePicker.d.ts.map +0 -1
- package/dist/components/LDDatePicker/FormDatePicker.js +0 -12
- package/dist/components/LDDateRangePicker/FormDateRangePicker.d.ts +0 -12
- package/dist/components/LDDateRangePicker/FormDateRangePicker.d.ts.map +0 -1
- package/dist/components/LDDateRangePicker/FormDateRangePicker.js +0 -10
- package/dist/components/LDModal/openModal.d.ts +0 -24
- package/dist/components/LDModal/openModal.d.ts.map +0 -1
- package/dist/components/LDModal/openModal.js +0 -52
- package/dist/components/LDRadio/FormRadioGroup.d.ts +0 -13
- package/dist/components/LDRadio/FormRadioGroup.d.ts.map +0 -1
- package/dist/components/LDRadio/FormRadioGroup.js +0 -9
- package/dist/components/LDSelect/FormMultiSelect.d.ts +0 -13
- package/dist/components/LDSelect/FormMultiSelect.d.ts.map +0 -1
- package/dist/components/LDSelect/FormSelect.d.ts +0 -13
- package/dist/components/LDSelect/FormSelect.d.ts.map +0 -1
- package/dist/components/LDSelect/FormSelect.js +0 -10
- package/dist/components/LDTextarea/FormTextarea.d.ts +0 -14
- package/dist/components/LDTextarea/FormTextarea.d.ts.map +0 -1
- package/dist/components/LDTimePicker/FormTimePicker.d.ts +0 -12
- package/dist/components/LDTimePicker/FormTimePicker.d.ts.map +0 -1
- package/dist/components/LDToggleButton/FormToggleButton.d.ts +0 -12
- package/dist/components/LDToggleButton/FormToggleButton.d.ts.map +0 -1
- package/dist/components/LDToggleButton/FormToggleButton.js +0 -9
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState, } from 'react';
|
|
4
|
+
import cn from '../../utils/cn.js';
|
|
5
|
+
import NotificationBase from './NotificationBase.js';
|
|
6
|
+
// dot 자체 지름(px) — count 박스와 무관한, 훨씬 작은 순수 점 표시용 크기
|
|
7
|
+
const DOT_SIZE_PX = {
|
|
8
|
+
small: 4,
|
|
9
|
+
medium: 6,
|
|
10
|
+
large: 8,
|
|
11
|
+
};
|
|
12
|
+
// count 박스 높이(px). Tailwind h-3.5/h-4/h-5과 동일한 값
|
|
13
|
+
const COUNT_HEIGHT_PX = {
|
|
14
|
+
small: 14,
|
|
15
|
+
medium: 16,
|
|
16
|
+
large: 20,
|
|
17
|
+
};
|
|
18
|
+
// 좌우 패딩(px, 한쪽 기준). Tailwind px-3xs/px-2xs와 동일한 값
|
|
19
|
+
const SIZE_PADDING_X_PX = {
|
|
20
|
+
small: 2,
|
|
21
|
+
medium: 4,
|
|
22
|
+
large: 4,
|
|
23
|
+
};
|
|
24
|
+
const SIZE_CLASSES = {
|
|
25
|
+
small: 'px-3xs display10 bold',
|
|
26
|
+
medium: 'px-2xs display10 bold',
|
|
27
|
+
large: 'px-2xs display12 bold',
|
|
28
|
+
};
|
|
29
|
+
// 표시값 얼리기·텍스트 폭 측정 state를 Indicator 전용으로 분리 — 이 값들이 바뀌어도
|
|
30
|
+
// 트리거 wrapper/Root는 리렌더되지 않고 이 컴포넌트만 리렌더된다.
|
|
31
|
+
const IndicatorContent = ({ type, dot, count, overflowCount, showZero, size, offset, isHighlight, indicatorClassName, indicatorHighlightClassName, }) => {
|
|
32
|
+
const isDot = type === 'dot';
|
|
33
|
+
const isShown = isDot ? dot : count > 0 || (count === 0 && showZero);
|
|
34
|
+
const isOverflow = !isDot && count > overflowCount;
|
|
35
|
+
const liveDisplay = isOverflow ? `${overflowCount}+` : count;
|
|
36
|
+
const [frozenDisplay, setFrozenDisplay] = useState(liveDisplay);
|
|
37
|
+
const textRef = useRef(null);
|
|
38
|
+
const [textWidth, setTextWidth] = useState(0);
|
|
39
|
+
// count가 실제로 보이는 중일 때만 표시값을 갱신하고, dot이거나 숨겨지는 중엔 마지막
|
|
40
|
+
// 표시값을 그대로 얼려둔다 — count→dot 전환 시 "99+"가 raw count로 풀리거나,
|
|
41
|
+
// showZero=false에서 count가 0으로 바뀌며 사라질 때 "0"으로 스냅되는 걸 막는다.
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!isDot && isShown) {
|
|
44
|
+
setFrozenDisplay(liveDisplay);
|
|
45
|
+
}
|
|
46
|
+
}, [isDot, isShown, liveDisplay]);
|
|
47
|
+
// count일 때 너비는 실제 텍스트 너비를 측정해 결정한다 — Tailwind 정적 클래스로는
|
|
48
|
+
// count의 실제 내용 너비만큼 부드럽게 트랜지션하기 어렵기 때문
|
|
49
|
+
useLayoutEffect(() => {
|
|
50
|
+
if (isDot)
|
|
51
|
+
return;
|
|
52
|
+
const el = textRef.current;
|
|
53
|
+
if (el)
|
|
54
|
+
setTextWidth(el.scrollWidth);
|
|
55
|
+
}, [frozenDisplay, isDot, size]);
|
|
56
|
+
const heightPx = isDot ? DOT_SIZE_PX[size] : COUNT_HEIGHT_PX[size];
|
|
57
|
+
const widthPx = isDot
|
|
58
|
+
? DOT_SIZE_PX[size]
|
|
59
|
+
: Math.max(COUNT_HEIGHT_PX[size], textWidth + SIZE_PADDING_X_PX[size] * 2);
|
|
60
|
+
const scale = isShown ? 1 : 0;
|
|
61
|
+
const indicatorTransform = [
|
|
62
|
+
offset && `translate(${offset[0]}px, ${offset[1]}px)`,
|
|
63
|
+
`scale(${scale})`,
|
|
64
|
+
]
|
|
65
|
+
.filter(Boolean)
|
|
66
|
+
.join(' ');
|
|
67
|
+
return (_jsx(NotificationBase.Indicator, { count: count, type: type, isShown: isShown, className: cn('absolute top-0 right-0 ld-transition rounded-full bg-danger600 text-white flex items-center justify-center leading-none', SIZE_CLASSES[size], isDot && 'px-0', isShown ? 'opacity-100' : 'opacity-0', indicatorClassName, isHighlight && indicatorHighlightClassName), style: {
|
|
68
|
+
transform: indicatorTransform,
|
|
69
|
+
width: widthPx,
|
|
70
|
+
height: heightPx,
|
|
71
|
+
}, children: _jsx("span", { ref: textRef, className: cn('ld-transition', isDot ? 'scale-0 opacity-0' : 'scale-100 opacity-100'), children: frozenDisplay }) }));
|
|
72
|
+
};
|
|
73
|
+
const LDNotification = ({ children, type = 'count', dot = false, count = 0, overflowCount = 99, showZero = false, offset, size = 'medium', className, indicatorClassName, triggerHighlightClassName, indicatorHighlightClassName, style, }) => {
|
|
74
|
+
return (_jsx(NotificationBase.Root, { className: cn('relative inline-block', className), style: style, count: count, children: (isHighlight) => (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(isHighlight && triggerHighlightClassName), children: children }), _jsx(IndicatorContent, { type: type, dot: dot, count: count, overflowCount: overflowCount, showZero: showZero, size: size, offset: offset, isHighlight: isHighlight, indicatorClassName: indicatorClassName, indicatorHighlightClassName: indicatorHighlightClassName })] })) }));
|
|
75
|
+
};
|
|
76
|
+
export default LDNotification;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CSSProperties, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
interface RootProps {
|
|
3
|
+
/**
|
|
4
|
+
* count가 증가하는 순간 true가 되는 isHighlight 값을 받는 render-prop.
|
|
5
|
+
* 어디에(트리거·인디케이터) 어떤 className을 적용할지는 전부 Custom이 결정한다.
|
|
6
|
+
*/
|
|
7
|
+
children?: (isHighlight: boolean) => ReactNode;
|
|
8
|
+
/** 증가 감지 대상 알림 개수 (기본값 0). 이 값이 이전보다 커지면 isHighlight가 true가 된다 */
|
|
9
|
+
count?: number;
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
export type NotificationType = 'dot' | 'count';
|
|
14
|
+
interface IndicatorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
15
|
+
/** aria-label 문구에 쓰일 알림 개수 (기본값 0) */
|
|
16
|
+
count?: number;
|
|
17
|
+
/** 'dot'이면 aria-label을 "새 알림 있음"으로, 그 외엔 "알림 N개" 문구로 표시 */
|
|
18
|
+
type?: NotificationType;
|
|
19
|
+
/** 배지가 실제로 표시 중인지 여부 — false면 aria-hidden 처리(기본값 true) */
|
|
20
|
+
isShown?: boolean;
|
|
21
|
+
/** 렌더링할 내용(포맷된 count 등). 스타일은 Custom이 결정 */
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export declare const NotificationBase: {
|
|
25
|
+
Root: ({ children, count, className, style }: RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
Indicator: ({ count, type, isShown, children, ...props }: IndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
};
|
|
28
|
+
export default NotificationBase;
|
|
29
|
+
//# sourceMappingURL=NotificationBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationBase.d.ts","sourceRoot":"","sources":["../../../src/components/LDNotification/NotificationBase.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,UAAU,SAAS;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,SAAS,CAAC;IAC/C,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AA+BD,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,OAAO,CAAC;AAE/C,UAAU,cAAe,SAAQ,IAAI,CACnC,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,CACX;IACC,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAsBD,eAAO,MAAM,gBAAgB;kDAjE4B,SAAS;8DAmD/D,cAAc;CAiBhB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState, } from 'react';
|
|
4
|
+
const Root = ({ children, count = 0, className, style }) => {
|
|
5
|
+
const [isHighlight, setIsHighlight] = useState(false);
|
|
6
|
+
const prevCountRef = useRef(count);
|
|
7
|
+
const handleAnimationEnd = () => {
|
|
8
|
+
setIsHighlight(false);
|
|
9
|
+
};
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const prevCount = prevCountRef.current;
|
|
12
|
+
if (count > prevCount) {
|
|
13
|
+
setIsHighlight(true);
|
|
14
|
+
}
|
|
15
|
+
prevCountRef.current = count;
|
|
16
|
+
}, [count]);
|
|
17
|
+
return (_jsx("div", { className: className, style: style, onAnimationEnd: handleAnimationEnd, children: children?.(isHighlight) }));
|
|
18
|
+
};
|
|
19
|
+
const Indicator = ({ count = 0, type = 'count', isShown = true, children, ...props }) => {
|
|
20
|
+
const isDot = type === 'dot';
|
|
21
|
+
return (_jsx("div", { role: "status", "aria-label": isDot ? '새 알림 있음' : `알림 ${count}개`, "aria-hidden": !isShown, ...props, children: children }));
|
|
22
|
+
};
|
|
23
|
+
export const NotificationBase = {
|
|
24
|
+
Root,
|
|
25
|
+
Indicator,
|
|
26
|
+
};
|
|
27
|
+
export default NotificationBase;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
import { type RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import { type LDOTPInputProps } from './LDOTPInput.js';
|
|
4
|
+
interface LDFormOTPInputProps extends Omit<LDOTPInputProps, 'value' | 'onChange' | 'isInvalid'> {
|
|
5
|
+
/** react-hook-form 필드 이름 */
|
|
6
|
+
name: string;
|
|
7
|
+
/** react-hook-form 유효성 규칙 */
|
|
8
|
+
options?: RegisterOptions;
|
|
9
|
+
ref?: Ref<HTMLInputElement>;
|
|
10
|
+
/** 커스텀 에러 메시지 (지정 시 RHF 메시지 대신 사용) */
|
|
11
|
+
customErrorMessage?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const LDFormOTPInput: ({ name, options, variant, size, disabled, ref, customErrorMessage, children, ...props }: LDFormOTPInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default LDFormOTPInput;
|
|
15
|
+
//# sourceMappingURL=LDFormOTPInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDFormOTPInput.d.ts","sourceRoot":"","sources":["../../../src/components/LDOTPInput/LDFormOTPInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAGhE,UAAU,mBAAoB,SAAQ,IAAI,CACxC,eAAe,EACf,OAAO,GAAG,UAAU,GAAG,WAAW,CACnC;IACC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC5B,sCAAsC;IACtC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,QAAA,MAAM,cAAc,GAAI,yFAUrB,mBAAmB,4CAwBrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import LDOTPInput from './LDOTPInput.js';
|
|
4
|
+
import LDFormField from '../LDForm/LDFormField.js';
|
|
5
|
+
const LDFormOTPInput = ({ name, options, variant = 'outline', size = 'medium', disabled = false, ref, customErrorMessage = '', children, ...props }) => {
|
|
6
|
+
return (_jsx(LDFormField, { name: name, options: options, customErrorMessage: customErrorMessage, disabled: disabled, ref: ref, children: ({ field, fieldState }) => (_jsx(LDOTPInput, { ...props, value: field.value ?? '', onChange: field.onChange, isInvalid: fieldState.hasError, variant: variant, size: size, disabled: disabled, children: children })) }));
|
|
7
|
+
};
|
|
8
|
+
export default LDFormOTPInput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type OTPInputSize = '
|
|
3
|
-
export type OTPInputVariant = 'filled' | 'outline'
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type OTPInputSize = '2xsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
3
|
+
export type OTPInputVariant = 'filled' | 'outline';
|
|
4
4
|
export interface LDOTPInputProps {
|
|
5
5
|
maxLength: number;
|
|
6
6
|
value: string;
|
|
@@ -10,34 +10,22 @@ export interface LDOTPInputProps {
|
|
|
10
10
|
isInvalid?: boolean;
|
|
11
11
|
variant?: OTPInputVariant;
|
|
12
12
|
size?: OTPInputSize;
|
|
13
|
+
/** 그룹별 칸 수(예: [3, 3]). 지정 시 구분선으로 나눠 렌더한다. 합은 maxLength와 일치해야 함. */
|
|
14
|
+
groups?: number[];
|
|
13
15
|
className?: string;
|
|
14
|
-
|
|
16
|
+
/** 커스텀 레이아웃. 생략 시 groups/maxLength로 슬롯을 자동 생성한다. */
|
|
17
|
+
children?: ReactNode;
|
|
15
18
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
* 실제 입력을 처리하는 Hidden LDInput과 상태를 관리합니다.
|
|
19
|
-
*/
|
|
20
|
-
declare const LDOTPInput: ({ maxLength, value, onChange, onComplete, disabled, isInvalid, variant, size, className, children, }: LDOTPInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
/**
|
|
22
|
-
* OTPInputGroup
|
|
23
|
-
* 슬롯들을 묶어주는 컨테이너입니다.
|
|
24
|
-
*/
|
|
19
|
+
/** OTP 입력 루트 — Base.Root에 size/variant 스타일 컨텍스트를 덧씌운다. */
|
|
20
|
+
declare const LDOTPInput: ({ variant, size, maxLength, groups, children, ...rest }: LDOTPInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
21
|
declare const OTPInputGroup: ({ className, children, }: {
|
|
26
22
|
className?: string;
|
|
27
|
-
children:
|
|
23
|
+
children: ReactNode;
|
|
28
24
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
/**
|
|
30
|
-
* OTPInputSlot
|
|
31
|
-
* 개별 글자를 보여주는 칸입니다.
|
|
32
|
-
*/
|
|
33
25
|
declare const OTPInputSlot: ({ index, className, }: {
|
|
34
26
|
index: number;
|
|
35
27
|
className?: string;
|
|
36
28
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
-
/**
|
|
38
|
-
* OTPInputSeparator
|
|
39
|
-
* 그룹 사이의 구분선입니다.
|
|
40
|
-
*/
|
|
41
29
|
declare const OTPInputSeparator: ({ className }: {
|
|
42
30
|
className?: string;
|
|
43
31
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDOTPInput.d.ts","sourceRoot":"","sources":["../../../src/components/LDOTPInput/LDOTPInput.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"LDOTPInput.d.ts","sourceRoot":"","sources":["../../../src/components/LDOTPInput/LDOTPInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAuC,MAAM,OAAO,CAAC;AAK5E,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,CAAC;AACb,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAwCD,0DAA0D;AAC1D,QAAA,MAAM,UAAU,GAAI,yDAOjB,eAAe,4CAqCjB,CAAC;AAEF,QAAA,MAAM,aAAa,GAAI,0BAGpB;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAA8E,CAAC;AAEhF,QAAA,MAAM,YAAY,GAAI,uBAGnB;IACD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,4CAuBA,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,eAAe;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,4CAI/D,CAAC;AAGF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;AACtE,eAAe,UAAU,CAAC"}
|
|
@@ -1,87 +1,59 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { Fragment, createContext, useContext } from 'react';
|
|
4
4
|
import cn from '../../utils/cn.js';
|
|
5
|
-
|
|
6
|
-
function useOTPInputContext() {
|
|
7
|
-
const context = useContext(OTPInputContext);
|
|
8
|
-
if (!context) {
|
|
9
|
-
throw new Error('LDOTPInput 하위 컴포넌트는 LDOTPInput 안에서 사용되어야 합니다.');
|
|
10
|
-
}
|
|
11
|
-
return context;
|
|
12
|
-
}
|
|
5
|
+
import OTPInputBase from './OTPInputBase.js';
|
|
13
6
|
const sizeClasses = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
'2xsmall': 'w-4 h-4 display10',
|
|
8
|
+
xsmall: 'w-6 h-6 display12',
|
|
9
|
+
small: 'w-8 h-8 display14',
|
|
10
|
+
medium: 'w-10 h-10 display16',
|
|
11
|
+
large: 'w-16 h-16 display28',
|
|
12
|
+
xlarge: 'w-20 h-20 display40',
|
|
13
|
+
};
|
|
14
|
+
// 박스 크기에 비례한 모서리 반경
|
|
15
|
+
const roundedClasses = {
|
|
16
|
+
'2xsmall': 'rounded-[3px]',
|
|
17
|
+
xsmall: 'rounded-[4px]',
|
|
18
|
+
small: 'rounded-[5px]',
|
|
19
|
+
medium: 'rounded-[6px]',
|
|
20
|
+
large: 'rounded-[8px]',
|
|
21
|
+
xlarge: 'rounded-[12px]',
|
|
19
22
|
};
|
|
20
23
|
const variantClasses = {
|
|
21
|
-
filled: 'bg-
|
|
22
|
-
outline: 'bg-transparent
|
|
23
|
-
ghost: 'bg-transparent border-b-2 border-mono200 rounded-none',
|
|
24
|
+
filled: 'bg-mono50 outline-2 outline-transparent [outline-style:solid] -outline-offset-2 text-lb500',
|
|
25
|
+
outline: 'bg-transparent outline-2 outline-mono200 [outline-style:solid] -outline-offset-2 text-lb500',
|
|
24
26
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, [value, isFocused]);
|
|
42
|
-
const handleInputChange = (e) => {
|
|
43
|
-
const newValue = e.target.value
|
|
44
|
-
.replace(/[^0-9a-zA-Z]/g, '')
|
|
45
|
-
.slice(0, maxLength);
|
|
46
|
-
onChange(newValue);
|
|
47
|
-
if (newValue.length === maxLength && onComplete) {
|
|
48
|
-
onComplete(newValue);
|
|
27
|
+
const OTPStyleContext = createContext({
|
|
28
|
+
size: 'medium',
|
|
29
|
+
variant: 'outline',
|
|
30
|
+
});
|
|
31
|
+
// ── Custom Layer ──
|
|
32
|
+
/** OTP 입력 루트 — Base.Root에 size/variant 스타일 컨텍스트를 덧씌운다. */
|
|
33
|
+
const LDOTPInput = ({ variant = 'outline', size = 'medium', maxLength, groups, children, ...rest }) => {
|
|
34
|
+
// groups 지정 시 구분선으로 나눠 렌더, 아니면 단일 그룹
|
|
35
|
+
const renderSlots = () => {
|
|
36
|
+
if (groups && groups.length > 0) {
|
|
37
|
+
let offset = 0;
|
|
38
|
+
return groups.map((count, gi) => {
|
|
39
|
+
const start = offset;
|
|
40
|
+
offset += count;
|
|
41
|
+
return (_jsxs(Fragment, { children: [gi > 0 && _jsx(OTPInputSeparator, {}), _jsx(OTPInputGroup, { children: Array.from({ length: count }).map((_, i) => (_jsx(OTPInputSlot, { index: start + i }, i))) })] }, gi));
|
|
42
|
+
});
|
|
49
43
|
}
|
|
44
|
+
return (_jsx(OTPInputGroup, { children: Array.from({ length: maxLength }).map((_, i) => (_jsx(OTPInputSlot, { index: i }, i))) }));
|
|
50
45
|
};
|
|
51
|
-
return (_jsx(
|
|
52
|
-
value,
|
|
53
|
-
maxLength,
|
|
54
|
-
focusedIndex,
|
|
55
|
-
isInvalid,
|
|
56
|
-
disabled,
|
|
57
|
-
size,
|
|
58
|
-
variant,
|
|
59
|
-
}, children: _jsxs("div", { className: cn('relative flex items-center gap-2 cursor-text select-none', disabled && 'opacity-50 cursor-not-allowed', className), onClick: () => !disabled && inputRef.current?.focus(), children: [_jsx("input", { ref: inputRef, type: "text", inputMode: "numeric", autoComplete: "one-time-code", value: value, onChange: handleInputChange, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), disabled: disabled, className: "absolute inset-0 opacity-0 cursor-default pointer-events-none" }), children] }) }));
|
|
46
|
+
return (_jsx(OTPStyleContext, { value: { size, variant }, children: _jsx(OTPInputBase.Root, { maxLength: maxLength, ...rest, children: children ?? renderSlots() }) }));
|
|
60
47
|
};
|
|
61
|
-
|
|
62
|
-
* OTPInputGroup
|
|
63
|
-
* 슬롯들을 묶어주는 컨테이너입니다.
|
|
64
|
-
*/
|
|
65
|
-
const OTPInputGroup = ({ className, children, }) => {
|
|
66
|
-
return (_jsx("div", { className: cn('flex items-center gap-2', className), children: children }));
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* OTPInputSlot
|
|
70
|
-
* 개별 글자를 보여주는 칸입니다.
|
|
71
|
-
*/
|
|
48
|
+
const OTPInputGroup = ({ className, children, }) => _jsx(OTPInputBase.Group, { className: className, children: children });
|
|
72
49
|
const OTPInputSlot = ({ index, className, }) => {
|
|
73
|
-
const {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* OTPInputSeparator
|
|
80
|
-
* 그룹 사이의 구분선입니다.
|
|
81
|
-
*/
|
|
82
|
-
const OTPInputSeparator = ({ className }) => {
|
|
83
|
-
return _jsx("div", { className: cn('w-2 h-[2px] bg-mono300 mx-1', className) });
|
|
50
|
+
const { size, variant } = useContext(OTPStyleContext);
|
|
51
|
+
return (_jsx(OTPInputBase.Slot, { index: index, className: ({ isActive, hasValue, isInvalid }) => cn('font-bold ld-transition', sizeClasses[size], roundedClasses[size], variantClasses[variant],
|
|
52
|
+
// 값이 있는 칸 강조 (filled=배경, outline=테두리)
|
|
53
|
+
hasValue && variant === 'filled' && 'bg-tintBlue', hasValue && variant === 'outline' && 'outline-lb500', isActive && 'outline-2 outline-lb500 outline-solid -outline-offset-2', isActive && variant === 'filled' && 'bg-white', isInvalid &&
|
|
54
|
+
'outline-2 outline-danger600 outline-solid -outline-offset-2 text-danger600 bg-tintRed', className) }));
|
|
84
55
|
};
|
|
56
|
+
const OTPInputSeparator = ({ className }) => (_jsx(OTPInputBase.Separator, { className: cn('w-2 h-0.5 bg-mono300 mx-1', className) }));
|
|
85
57
|
// ── Export ──
|
|
86
58
|
export { LDOTPInput, OTPInputGroup, OTPInputSlot, OTPInputSeparator };
|
|
87
59
|
export default LDOTPInput;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
interface OTPInputContextProps {
|
|
3
|
+
value: string;
|
|
4
|
+
maxLength: number;
|
|
5
|
+
focusedIndex: number;
|
|
6
|
+
isInvalid: boolean;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const useOTPInputContext: () => OTPInputContextProps;
|
|
10
|
+
/** Slot 시각 스타일 계산에 필요한 상태 */
|
|
11
|
+
export interface OTPSlotState {
|
|
12
|
+
char?: string;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
hasValue: boolean;
|
|
15
|
+
isInvalid: boolean;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface RootProps {
|
|
19
|
+
maxLength: number;
|
|
20
|
+
value: string;
|
|
21
|
+
onChange: (value: string) => void;
|
|
22
|
+
onComplete?: (value: string) => void;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
isInvalid?: boolean;
|
|
25
|
+
className?: string;
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
interface SlotProps {
|
|
29
|
+
index: number;
|
|
30
|
+
/** 문자열 또는 슬롯 상태를 받아 클래스를 반환하는 함수 */
|
|
31
|
+
className?: string | ((state: OTPSlotState) => string);
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare const OTPInputBase: {
|
|
35
|
+
Root: ({ maxLength, value, onChange, onComplete, disabled, isInvalid, className, children, }: RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
Group: ({ className, children, }: {
|
|
37
|
+
className?: string;
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
Slot: ({ index, className, children }: SlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
Separator: ({ className }: {
|
|
42
|
+
className?: string;
|
|
43
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
export default OTPInputBase;
|
|
46
|
+
//# sourceMappingURL=OTPInputBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OTPInputBase.d.ts","sourceRoot":"","sources":["../../../src/components/LDOTPInput/OTPInputBase.tsx"],"names":[],"mappings":"AAEA,OAAc,EACZ,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAIf,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAID,eAAO,MAAM,kBAAkB,4BAO9B,CAAC;AAEF,6BAA6B;AAC7B,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAGD,UAAU,SAAS;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAyED,UAAU,SAAS;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK,MAAM,CAAC,CAAC;IACvD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA+BD,eAAO,MAAM,YAAY;kGAlGtB,SAAS;sCAsDT;QACD,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,SAAS,CAAC;KACrB;2CAY6C,SAAS;+BAyBrB;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;CAII,CAAC;AAC7D,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState, useContext, createContext, useEffect, } from 'react';
|
|
4
|
+
import cn from '../../utils/cn.js';
|
|
5
|
+
const OTPInputContext = createContext(null);
|
|
6
|
+
export const useOTPInputContext = () => {
|
|
7
|
+
const ctx = useContext(OTPInputContext);
|
|
8
|
+
if (!ctx)
|
|
9
|
+
throw new Error('OTPInputBase 하위 컴포넌트는 Root 내부에서 사용해야 합니다.');
|
|
10
|
+
return ctx;
|
|
11
|
+
};
|
|
12
|
+
const Root = ({ maxLength, value, onChange, onComplete, disabled = false, isInvalid = false, className, children, }) => {
|
|
13
|
+
const inputRef = useRef(null);
|
|
14
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
15
|
+
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setFocusedIndex(isFocused ? value.length : -1);
|
|
18
|
+
}, [value, isFocused]);
|
|
19
|
+
const handleInputChange = (e) => {
|
|
20
|
+
const newValue = e.target.value
|
|
21
|
+
.replace(/[^0-9a-zA-Z]/g, '')
|
|
22
|
+
.slice(0, maxLength);
|
|
23
|
+
onChange(newValue);
|
|
24
|
+
if (newValue.length === maxLength && onComplete) {
|
|
25
|
+
onComplete(newValue);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return (_jsx(OTPInputContext, { value: { value, maxLength, focusedIndex, isInvalid, disabled }, children: _jsxs("div", { className: cn('relative flex items-center gap-2 cursor-text select-none', disabled && 'opacity-50 cursor-not-allowed', className), onClick: () => !disabled && inputRef.current?.focus(), children: [_jsx("input", { ref: inputRef, type: "text", inputMode: "numeric", autoComplete: "one-time-code", value: value, onChange: handleInputChange, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), disabled: disabled, className: "absolute inset-0 opacity-0 cursor-default pointer-events-none" }), children] }) }));
|
|
29
|
+
};
|
|
30
|
+
// ── Group: 슬롯 묶음 컨테이너 ──
|
|
31
|
+
const Group = ({ className, children, }) => (_jsx("div", { className: cn('flex items-center gap-2', className), children: children }));
|
|
32
|
+
const Slot = ({ index, className, children }) => {
|
|
33
|
+
const { value, focusedIndex, isInvalid, disabled } = useOTPInputContext();
|
|
34
|
+
const char = value[index];
|
|
35
|
+
const state = {
|
|
36
|
+
char,
|
|
37
|
+
isActive: focusedIndex === index,
|
|
38
|
+
hasValue: Boolean(char),
|
|
39
|
+
isInvalid,
|
|
40
|
+
disabled,
|
|
41
|
+
};
|
|
42
|
+
const resolved = typeof className === 'function' ? className(state) : className;
|
|
43
|
+
return (_jsxs("div", { className: cn('relative flex items-center justify-center', resolved), children: [children ?? char, state.isActive && !disabled && (_jsx("div", { className: "absolute inset-y-1/4 w-0.5 bg-lb500 animate-pulse" }))] }));
|
|
44
|
+
};
|
|
45
|
+
// ── Separator: 그룹 사이 구분선 ──
|
|
46
|
+
const Separator = ({ className }) => (_jsx("div", { className: className }));
|
|
47
|
+
export const OTPInputBase = { Root, Group, Slot, Separator };
|
|
48
|
+
export default OTPInputBase;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
/** 페이지네이션 크기 프리셋 */
|
|
3
|
+
export type PaginationSize = '2xsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
2
4
|
export interface LDPaginationProps {
|
|
3
5
|
currentPage: number;
|
|
4
6
|
totalPages: number;
|
|
5
7
|
onPageChange: (page: number) => void;
|
|
6
8
|
numbersToShow?: number;
|
|
9
|
+
/** 페이지네이션 크기 프리셋 (기본 small) */
|
|
10
|
+
size?: PaginationSize;
|
|
7
11
|
className?: string;
|
|
8
12
|
style?: React.CSSProperties;
|
|
9
13
|
}
|
|
10
|
-
declare const LDPagination: ({ currentPage, totalPages, onPageChange, numbersToShow, className, style, }: LDPaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const LDPagination: ({ currentPage, totalPages, onPageChange, numbersToShow, size, className, style, }: LDPaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
15
|
export default LDPagination;
|
|
12
16
|
//# sourceMappingURL=LDPagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDPagination.d.ts","sourceRoot":"","sources":["../../../src/components/LDPagination/LDPagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,QAAA,MAAM,YAAY,GAAI,
|
|
1
|
+
{"version":3,"file":"LDPagination.d.ts","sourceRoot":"","sources":["../../../src/components/LDPagination/LDPagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,oBAAoB;AACpB,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,CAAC;AAEb,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,QAAA,MAAM,YAAY,GAAI,mFAQnB,iBAAiB,4CAkBnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import PaginationBase from './PaginationBase.js';
|
|
3
3
|
import cn from '../../utils/cn.js';
|
|
4
|
-
const LDPagination = ({ currentPage, totalPages, onPageChange, numbersToShow = 5,
|
|
4
|
+
const LDPagination = ({ currentPage, totalPages, onPageChange, numbersToShow = 5, size = 'small', className, style, }) => {
|
|
5
|
+
return (_jsx(PaginationBase.Provider, { currentPage: currentPage, totalPages: totalPages, onPageChange: onPageChange, children: _jsxs(PaginationBase.Root, { className: cn('py-5', className), style: style, children: [_jsx(PaginationBase.Prev, { size: size }), _jsx(PaginationBase.List, { numbersToShow: numbersToShow, size: size }), _jsx(PaginationBase.Next, { size: size })] }) }));
|
|
6
|
+
};
|
|
5
7
|
export default LDPagination;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { type ButtonSize } from '../LDButton/LDButton.js';
|
|
2
3
|
interface ProviderProps {
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
currentPage: number;
|
|
@@ -9,28 +10,36 @@ interface RootProps extends HTMLAttributes<HTMLElement> {
|
|
|
9
10
|
children?: ReactNode;
|
|
10
11
|
}
|
|
11
12
|
interface PrevProps {
|
|
13
|
+
/** 이전 버튼 크기 (LDButton size 프리셋) */
|
|
14
|
+
size?: ButtonSize;
|
|
12
15
|
className?: string;
|
|
13
16
|
}
|
|
14
17
|
interface NextProps {
|
|
18
|
+
/** 다음 버튼 크기 (LDButton size 프리셋) */
|
|
19
|
+
size?: ButtonSize;
|
|
15
20
|
className?: string;
|
|
16
21
|
}
|
|
17
22
|
interface ListProps {
|
|
18
23
|
numbersToShow?: number;
|
|
24
|
+
/** 페이지 번호 버튼 크기 (LDButton size 프리셋) */
|
|
25
|
+
size?: ButtonSize;
|
|
19
26
|
className?: string;
|
|
20
27
|
}
|
|
21
28
|
interface ItemProps {
|
|
22
29
|
page: number;
|
|
23
30
|
isActive?: boolean;
|
|
31
|
+
/** 페이지 번호 버튼 크기 (LDButton size 프리셋) */
|
|
32
|
+
size?: ButtonSize;
|
|
24
33
|
onClick?: () => void;
|
|
25
34
|
className?: string;
|
|
26
35
|
}
|
|
27
36
|
declare const PaginationBase: {
|
|
28
37
|
Provider: ({ children, currentPage, totalPages, onPageChange, }: ProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
38
|
Root: ({ className, children, ...props }: RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
Prev: ({ className }: PrevProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
-
Next: ({ className }: NextProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
List: ({ numbersToShow, className }: ListProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
Item: ({ page, isActive, onClick, className }: ItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
Prev: ({ size, className }: PrevProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
Next: ({ size, className }: NextProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
List: ({ numbersToShow, size, className }: ListProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
Item: ({ page, isActive, size, onClick, className, }: ItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
43
|
};
|
|
35
44
|
export default PaginationBase;
|
|
36
45
|
//# sourceMappingURL=PaginationBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationBase.d.ts","sourceRoot":"","sources":["../../../src/components/LDPagination/PaginationBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PaginationBase.d.ts","sourceRoot":"","sources":["../../../src/components/LDPagination/PaginationBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAwBjE,UAAU,aAAa;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAeD,UAAU,SAAU,SAAQ,cAAc,CAAC,WAAW,CAAC;IACrD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAcD,UAAU,SAAS;IACjB,mCAAmC;IACnC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6BD,UAAU,SAAS;IACjB,mCAAmC;IACnC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6BD,UAAU,SAAS;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA2BD,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8BD,QAAA,MAAM,cAAc;qEA/JjB,aAAa;8CAYiC,SAAS;gCAkBX,SAAS;gCAiCT,SAAS;+CAkCS,SAAS;0DAwCvE,SAAS;CA6BX,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext } from 'react';
|
|
3
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
3
4
|
import cn from '../../utils/cn.js';
|
|
4
5
|
import LDButton from '../LDButton/LDButton.js';
|
|
5
6
|
import { calculatePaginationOptions } from './paginationUtils.js';
|
|
@@ -12,26 +13,26 @@ const usePaginationContext = () => {
|
|
|
12
13
|
};
|
|
13
14
|
const Provider = ({ children, currentPage, totalPages, onPageChange, }) => (_jsx(PaginationContext, { value: { currentPage, totalPages, onPageChange }, children: children }));
|
|
14
15
|
const Root = ({ className, children, ...props }) => (_jsx("nav", { role: "navigation", "aria-label": "pagination", className: cn('flex flex-row gap-2.5 items-center', className), ...props, children: children }));
|
|
15
|
-
const Prev = ({ className }) => {
|
|
16
|
+
const Prev = ({ size = '2xsmall', className }) => {
|
|
16
17
|
const { currentPage, onPageChange } = usePaginationContext();
|
|
17
18
|
const canPrevious = currentPage > 1;
|
|
18
|
-
return (_jsx(LDButton, { variant: "outline", color: "neutral", size:
|
|
19
|
+
return (_jsx(LDButton, { variant: "outline", color: "neutral", size: size, shape: "capsule", leftIcon: _jsx(ChevronLeft, {}), compact: true, disabled: !canPrevious, onClick: () => onPageChange(currentPage - 1), "aria-label": "\uC774\uC804 \uD398\uC774\uC9C0", className: cn(canPrevious
|
|
19
20
|
? 'bg-neutral100 text-neutral400'
|
|
20
21
|
: 'bg-neutral50 text-neutral200', canPrevious && 'hover:bg-neutral200', className) }));
|
|
21
22
|
};
|
|
22
|
-
const Next = ({ className }) => {
|
|
23
|
+
const Next = ({ size = '2xsmall', className }) => {
|
|
23
24
|
const { currentPage, totalPages, onPageChange } = usePaginationContext();
|
|
24
25
|
const canNext = currentPage < totalPages;
|
|
25
|
-
return (_jsx(LDButton, { variant: "outline", color: "neutral", size:
|
|
26
|
+
return (_jsx(LDButton, { variant: "outline", color: "neutral", size: size, shape: "capsule", leftIcon: _jsx(ChevronRight, {}), disabled: !canNext, compact: true, onClick: () => onPageChange(currentPage + 1), "aria-label": "\uB2E4\uC74C \uD398\uC774\uC9C0", className: cn(canNext
|
|
26
27
|
? 'bg-neutral100 text-neutral400'
|
|
27
28
|
: 'bg-neutral50 text-neutral200', canNext && 'hover:bg-neutral200', className) }));
|
|
28
29
|
};
|
|
29
|
-
const List = ({ numbersToShow = 5, className }) => {
|
|
30
|
+
const List = ({ numbersToShow = 5, size = 'xsmall', className }) => {
|
|
30
31
|
const { currentPage, totalPages, onPageChange } = usePaginationContext();
|
|
31
32
|
const pages = calculatePaginationOptions(currentPage, totalPages, numbersToShow);
|
|
32
|
-
return (_jsx(_Fragment, { children: pages.map((page, idx) => (_jsx(Item, { page: page, isActive: currentPage === page, onClick: () => onPageChange(page), className: className }, `page_${page}_${idx}`))) }));
|
|
33
|
+
return (_jsx(_Fragment, { children: pages.map((page, idx) => (_jsx(Item, { page: page, isActive: currentPage === page, size: size, onClick: () => onPageChange(page), className: className }, `page_${page}_${idx}`))) }));
|
|
33
34
|
};
|
|
34
|
-
const Item = ({ page, isActive, onClick, className }) => (_jsx(LDButton, { variant: "ghost", shape: "capsule", color: isActive ? 'point' : 'neutral', size:
|
|
35
|
+
const Item = ({ page, isActive, size = 'xsmall', onClick, className, }) => (_jsx(LDButton, { variant: "ghost", shape: "capsule", color: isActive ? 'point' : 'neutral', size: size, compact: true, onClick: onClick, "aria-label": `${page} 페이지`, "aria-current": isActive ? 'page' : undefined, className: cn('outline-none regular', !isActive && 'text-neutral400', className), children: page }));
|
|
35
36
|
// ── Export ──
|
|
36
37
|
const PaginationBase = {
|
|
37
38
|
Provider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDPopover.d.ts","sourceRoot":"","sources":["../../../src/components/LDPopover/LDPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvD,KAAK,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAEzC,KAAK,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"LDPopover.d.ts","sourceRoot":"","sources":["../../../src/components/LDPopover/LDPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvD,KAAK,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAEzC,KAAK,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY;IACZ,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,qBAAqB;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,wCAAwC;IACxC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gCAAgC;IAChC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB;IAChB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3C,uBAAuB;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wBAAwB;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAgBD,QAAA,MAAM,SAAS,GAAI,mJAchB,cAAc,4CA8DhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|