@loword/loword-design-system 0.0.7 → 0.0.9
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/Icon/LucideIcon.d.ts +2 -1
- package/dist/components/Icon/LucideIcon.d.ts.map +1 -1
- package/dist/components/Icon/LucideIcon.js +2 -2
- package/dist/components/LDAutoComplete/AutoCompleteBase.js +1 -1
- package/dist/components/LDBreadCrumb/LDBreadCrumb.js +7 -7
- package/dist/components/LDButton/LDButton.d.ts +1 -0
- package/dist/components/LDButton/LDButton.d.ts.map +1 -1
- package/dist/components/LDButton/LDButton.js +3 -3
- package/dist/components/LDCarousel/CarouselBase.d.ts +6 -2
- package/dist/components/LDCarousel/CarouselBase.d.ts.map +1 -1
- package/dist/components/LDCarousel/CarouselBase.js +11 -5
- package/dist/components/LDCarousel/LDCarousel.d.ts +9 -2
- package/dist/components/LDCarousel/LDCarousel.d.ts.map +1 -1
- package/dist/components/LDCarousel/LDCarousel.js +3 -2
- package/dist/components/LDCheckbox/FormCheckbox.js +2 -2
- package/dist/components/LDCheckbox/FormCheckboxGroup.js +2 -2
- package/dist/components/LDCheckbox/LDCheckbox.d.ts.map +1 -1
- package/dist/components/LDCheckbox/LDCheckbox.js +7 -1
- package/dist/components/LDDatePicker/FormDatePicker.js +2 -2
- package/dist/components/LDDatePicker/LDDatePicker.d.ts.map +1 -1
- package/dist/components/LDDatePicker/LDDatePicker.js +1 -3
- package/dist/components/LDDateRangePicker/FormDateRangePicker.js +2 -2
- package/dist/components/LDDateRangePicker/LDDateRangePicker.js +8 -8
- package/dist/components/LDFileUpload/FileUploadBase.d.ts +6 -3
- package/dist/components/LDFileUpload/FileUploadBase.d.ts.map +1 -1
- package/dist/components/LDFileUpload/FileUploadBase.js +28 -11
- package/dist/components/LDFileUpload/LDFileUpload.d.ts +2 -0
- package/dist/components/LDFileUpload/LDFileUpload.d.ts.map +1 -1
- package/dist/components/LDFileUpload/LDFileUpload.js +1 -1
- package/dist/components/LDFileUpload/LDFileUploadList.d.ts +2 -0
- package/dist/components/LDFileUpload/LDFileUploadList.d.ts.map +1 -1
- package/dist/components/LDFileUpload/LDFileUploadList.js +1 -1
- package/dist/components/LDFileUpload/LDImageUpload.d.ts +2 -0
- package/dist/components/LDFileUpload/LDImageUpload.d.ts.map +1 -1
- package/dist/components/LDFileUpload/LDImageUpload.js +1 -1
- package/dist/components/LDFileUpload/LDImageUploadList.d.ts +2 -0
- package/dist/components/LDFileUpload/LDImageUploadList.d.ts.map +1 -1
- package/dist/components/LDFileUpload/LDImageUploadList.js +1 -1
- package/dist/components/LDForm/LDForm.d.ts +21 -0
- package/dist/components/LDForm/LDForm.d.ts.map +1 -0
- package/dist/components/{Form/Form.js → LDForm/LDForm.js} +3 -3
- package/dist/components/LDForm/LDFormErrorMessage.d.ts +9 -0
- package/dist/components/LDForm/LDFormErrorMessage.d.ts.map +1 -0
- package/dist/components/LDForm/LDFormErrorMessage.js +17 -0
- package/dist/components/{Form/FormField.d.ts → LDForm/LDFormField.d.ts} +6 -6
- package/dist/components/LDForm/LDFormField.d.ts.map +1 -0
- package/dist/components/{Form/FormField.js → LDForm/LDFormField.js} +2 -2
- package/dist/components/LDInput/LDFormInput.d.ts +15 -0
- package/dist/components/LDInput/LDFormInput.d.ts.map +1 -0
- package/dist/components/LDInput/{FormInput.js → LDFormInput.js} +12 -7
- package/dist/components/LDInput/LDInput.d.ts.map +1 -1
- package/dist/components/LDInput/LDInput.js +21 -13
- package/dist/components/LDPagination/PaginationBase.d.ts.map +1 -1
- package/dist/components/LDPagination/PaginationBase.js +7 -7
- package/dist/components/LDPopover/LDPopover.js +3 -3
- package/dist/components/LDPopover/PopoverBase.js +1 -1
- package/dist/components/LDRadio/FormRadioGroup.js +2 -2
- package/dist/components/LDRadio/LDRadio.d.ts.map +1 -1
- package/dist/components/LDRadio/LDRadio.js +3 -5
- package/dist/components/LDRadio/RadioBase.d.ts.map +1 -1
- package/dist/components/LDRadio/RadioBase.js +1 -3
- package/dist/components/LDSelect/FormMultiSelect.js +2 -2
- package/dist/components/LDSelect/FormSelect.js +2 -2
- package/dist/components/LDSelect/LDMultiSelect.js +3 -3
- package/dist/components/LDSelect/LDSelect.js +1 -1
- package/dist/components/LDTable/LDCollapsibleTanstackTable.d.ts +26 -0
- package/dist/components/LDTable/LDCollapsibleTanstackTable.d.ts.map +1 -0
- package/dist/components/LDTable/LDCollapsibleTanstackTable.js +38 -0
- package/dist/components/LDTable/LDTable.d.ts +5 -1
- package/dist/components/LDTable/LDTable.d.ts.map +1 -1
- package/dist/components/LDTable/LDTable.js +13 -17
- package/dist/components/LDTable/LDTanstackTable.d.ts +15 -13
- package/dist/components/LDTable/LDTanstackTable.d.ts.map +1 -1
- package/dist/components/LDTable/LDTanstackTable.js +21 -23
- package/dist/components/LDTable/TableField.d.ts +17 -5
- package/dist/components/LDTable/TableField.d.ts.map +1 -1
- package/dist/components/LDTable/TableField.js +16 -6
- package/dist/components/LDTeamHistory/LDTeamHistory.d.ts +12 -0
- package/dist/components/LDTeamHistory/LDTeamHistory.d.ts.map +1 -0
- package/dist/components/LDTeamHistory/LDTeamHistory.js +14 -0
- package/dist/components/{LDAnchor/AnchorBase.d.ts → LDTeamHistory/TeamHistoryBase.d.ts} +12 -6
- package/dist/components/LDTeamHistory/TeamHistoryBase.d.ts.map +1 -0
- package/dist/components/LDTeamHistory/TeamHistoryBase.js +108 -0
- package/dist/components/LDTextarea/FormTextarea.d.ts +14 -0
- package/dist/components/LDTextarea/FormTextarea.d.ts.map +1 -0
- package/dist/components/LDTextarea/FormTextarea.js +10 -0
- package/dist/components/LDTextarea/LDTextarea.d.ts +26 -0
- package/dist/components/LDTextarea/LDTextarea.d.ts.map +1 -0
- package/dist/components/LDTextarea/LDTextarea.js +163 -0
- package/dist/components/LDTimePicker/FormTimePicker.js +2 -2
- package/dist/components/LDTimePicker/LDTimePicker.js +4 -4
- package/dist/components/LDToggleButton/FormToggleButton.js +2 -2
- package/dist/components/LDTooltip/TooltipBase.js +1 -1
- package/dist/index.css +914 -684
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/utils/renderIcon.d.ts +1 -1
- package/package.json +23 -21
- package/src/styles/carousel.css +54 -7
- package/src/styles/components/auto-complete.css +66 -64
- package/src/styles/components/badge.css +29 -27
- package/src/styles/components/bread-crumb.css +49 -17
- package/src/styles/components/button.css +146 -144
- package/src/styles/components/icon.css +25 -23
- package/src/styles/components/index.css +1 -0
- package/src/styles/components/input.css +43 -41
- package/src/styles/components/modal.css +14 -12
- package/src/styles/components/shared.css +2 -2
- package/src/styles/components/spinner.css +25 -23
- package/src/styles/components/team-history.css +10 -0
- package/src/styles/focus.css +1 -1
- package/src/styles/slider.css +58 -54
- package/dist/components/Form/Form.d.ts +0 -21
- package/dist/components/Form/Form.d.ts.map +0 -1
- package/dist/components/Form/FormErrorMessage.d.ts +0 -9
- package/dist/components/Form/FormErrorMessage.d.ts.map +0 -1
- package/dist/components/Form/FormErrorMessage.js +0 -6
- package/dist/components/Form/FormField.d.ts.map +0 -1
- package/dist/components/LDAnchor/AnchorBase.d.ts.map +0 -1
- package/dist/components/LDAnchor/AnchorBase.js +0 -69
- package/dist/components/LDAnchor/LDAnchor.d.ts +0 -10
- package/dist/components/LDAnchor/LDAnchor.d.ts.map +0 -1
- package/dist/components/LDAnchor/LDAnchor.js +0 -14
- package/dist/components/LDInput/FormInput.d.ts +0 -15
- package/dist/components/LDInput/FormInput.d.ts.map +0 -1
|
@@ -16,7 +16,7 @@ export const useFileUploadContext = () => {
|
|
|
16
16
|
}
|
|
17
17
|
return fileUploadContext;
|
|
18
18
|
};
|
|
19
|
-
const Root = ({ recommendedSize, maxSize, allowedExtensions, maxFileCount, fileList, setFileList, onChangeFile, onDeleteFile, className, children, }) => {
|
|
19
|
+
const Root = ({ recommendedSize, maxSize, allowedExtensions, maxFileCount, fileList, setFileList, onChangeFile, onDeleteFile, disabled, readOnly, className, children, }) => {
|
|
20
20
|
return (_jsx(FileUploadContext.Provider, { value: {
|
|
21
21
|
recommendedSize,
|
|
22
22
|
maxSize,
|
|
@@ -26,10 +26,15 @@ const Root = ({ recommendedSize, maxSize, allowedExtensions, maxFileCount, fileL
|
|
|
26
26
|
setFileList,
|
|
27
27
|
onChangeFile,
|
|
28
28
|
onDeleteFile,
|
|
29
|
+
disabled,
|
|
30
|
+
readOnly,
|
|
29
31
|
}, children: _jsx("div", { className: cn('w-full', className), children: children }) }));
|
|
30
32
|
};
|
|
31
33
|
const Input = ({ type = 'default', label = '파일 선택', ...props }) => {
|
|
32
|
-
const { allowedExtensions, maxSize, fileList, setFileList, maxFileCount, onChangeFile, } = useFileUploadContext();
|
|
34
|
+
const { allowedExtensions, maxSize, fileList, setFileList, maxFileCount, onChangeFile, disabled, readOnly, } = useFileUploadContext();
|
|
35
|
+
// readOnly는 보기 전용 — 추가 입력 자체를 렌더하지 않는다.
|
|
36
|
+
if (readOnly)
|
|
37
|
+
return null;
|
|
33
38
|
const getFileError = async (file) => {
|
|
34
39
|
if (!validAllowedExtesions(file, allowedExtensions)) {
|
|
35
40
|
const allowed = allowedExtensions
|
|
@@ -79,15 +84,19 @@ const Input = ({ type = 'default', label = '파일 선택', ...props }) => {
|
|
|
79
84
|
setFileList(newList);
|
|
80
85
|
await onChangeFile(newList);
|
|
81
86
|
};
|
|
82
|
-
const fileInput = (_jsx("input", { type: "file", multiple: maxFileCount > 1, onClick: (e) => (e.currentTarget.value = ''), onChange: (e) => handleFile(e), className: "sr-only" }));
|
|
87
|
+
const fileInput = (_jsx("input", { type: "file", multiple: maxFileCount > 1, onClick: (e) => (e.currentTarget.value = ''), onChange: (e) => handleFile(e), disabled: disabled, className: "sr-only" }));
|
|
83
88
|
if (type === 'image') {
|
|
84
|
-
return (_jsxs("label", { className: cn('border-3 border-dotted rounded-xl border-neutral100 bg-neutral50 text-neutral500', 'size-21 flex justify-center items-center ld-transition',
|
|
89
|
+
return (_jsxs("label", { className: cn('border-3 border-dotted rounded-xl border-neutral100 bg-neutral50 text-neutral500', 'size-21 flex justify-center items-center ld-transition', disabled
|
|
90
|
+
? 'opacity-50 cursor-not-allowed'
|
|
91
|
+
: 'hover:bg-neutral-100 hover:border-neutral200 hover:cursor-pointer hover:text-neutral600', props.className), children: [renderIcon('images', 'size-6'), fileInput] }));
|
|
85
92
|
}
|
|
86
|
-
return (_jsxs(LDButton, { as: "label", ...props, children: [label, fileInput] }));
|
|
93
|
+
return (_jsxs(LDButton, { as: "label", ...props, disabled: disabled, children: [label, fileInput] }));
|
|
87
94
|
};
|
|
88
95
|
const CardList = (props) => {
|
|
89
|
-
const { fileList, setFileList, allowedExtensions, maxSize, onChangeFile, onDeleteFile, } = useFileUploadContext();
|
|
96
|
+
const { fileList, setFileList, allowedExtensions, maxSize, onChangeFile, onDeleteFile, disabled, readOnly, } = useFileUploadContext();
|
|
90
97
|
const [hoveredList, setHoveredList] = useState(new Array(fileList.length).fill(false));
|
|
98
|
+
// 교체/삭제 차단은 disabled·readOnly 공통. 흐림(opacity)·not-allowed 커서는 disabled에만.
|
|
99
|
+
const locked = disabled || readOnly;
|
|
91
100
|
const handleFile = async (e, idx) => {
|
|
92
101
|
const files = e.target.files;
|
|
93
102
|
if (!files)
|
|
@@ -141,7 +150,11 @@ const CardList = (props) => {
|
|
|
141
150
|
}
|
|
142
151
|
};
|
|
143
152
|
if (props.type === 'image') {
|
|
144
|
-
const cards = fileList.map((file, idx) => (_jsxs("label", { className:
|
|
153
|
+
const cards = fileList.map((file, idx) => (_jsxs("label", { className: cn('relative block size-21 overflow-hidden rounded-[21px]', disabled
|
|
154
|
+
? 'cursor-not-allowed'
|
|
155
|
+
: readOnly
|
|
156
|
+
? 'cursor-default'
|
|
157
|
+
: 'hover:cursor-pointer'), onMouseOver: () => {
|
|
145
158
|
setHoveredList((prev) => {
|
|
146
159
|
const next = [...prev];
|
|
147
160
|
next[idx] = true;
|
|
@@ -153,20 +166,24 @@ const CardList = (props) => {
|
|
|
153
166
|
next[idx] = false;
|
|
154
167
|
return next;
|
|
155
168
|
});
|
|
156
|
-
}, children: [_jsx("img", { src: file?.src, alt: file?.fileName, className: "size-full object-cover" }), _jsx("input", { type: "file", onClick: (e) => (e.currentTarget.value = ''), onChange: (e) => handleFile(e, idx), className: "sr-only" }), _jsx(LDButton, { onClick: async (e) => {
|
|
169
|
+
}, children: [_jsx("img", { src: file?.src, alt: file?.fileName, className: "size-full object-cover" }), _jsx("input", { type: "file", onClick: (e) => (e.currentTarget.value = ''), onChange: (e) => handleFile(e, idx), disabled: locked, className: "sr-only" }), _jsx(LDButton, { onClick: async (e) => {
|
|
157
170
|
e.preventDefault();
|
|
158
171
|
e.stopPropagation();
|
|
159
172
|
await handleDeleteFile(idx);
|
|
160
|
-
}, variant: "ghost", leftIcon: "trash2", color: "neutral", className: cn('text-neutral700 absolute top-2 right-2 rounded-sm bg-neutral-100 px-0 flex justify-center items-center min-w-0 h-5 w-5 ld-transition', hoveredList[idx] ? 'opacity-100' : 'opacity-0') })] }, `${file.fileName}_${idx}`)));
|
|
173
|
+
}, disabled: locked, variant: "ghost", leftIcon: "trash2", color: "neutral", className: cn('text-neutral700 absolute top-2 right-2 rounded-sm bg-neutral-100 px-0 flex justify-center items-center min-w-0 h-5 w-5 ld-transition', hoveredList[idx] && !locked ? 'opacity-100' : 'opacity-0') })] }, `${file.fileName}_${idx}`)));
|
|
161
174
|
if (fileList.length <= 1) {
|
|
162
175
|
return (_jsx("div", { className: cn('flex flex-row gap-sm', props.className), children: cards }));
|
|
163
176
|
}
|
|
164
177
|
return (_jsx(LDCarousel, { className: props.className, slideSize: "auto", gap: 8, showArrows: false, showDots: false, slides: cards }));
|
|
165
178
|
}
|
|
166
|
-
return (_jsx("div", { className: "flex flex-col gap-sm w-full", children: fileList.map((file, idx) => (_jsxs("label", { className:
|
|
179
|
+
return (_jsx("div", { className: "flex flex-col gap-sm w-full", children: fileList.map((file, idx) => (_jsxs("label", { className: cn('w-full flex flex-row justify-between items-center px-4 py-3 bg-neutral50 rounded-lg', disabled
|
|
180
|
+
? 'cursor-not-allowed'
|
|
181
|
+
: readOnly
|
|
182
|
+
? 'cursor-default'
|
|
183
|
+
: 'hover:cursor-pointer'), children: [_jsxs("div", { className: "flex flex-row items-center gap-sm", children: [_jsx("div", { className: "size-15 overflow-hidden rounded-lg", children: _jsx("div", { className: "flex size-full items-center justify-center text-neutral500 bg-white", children: isImage(file.fileName) ? (_jsx("img", { src: file?.src, alt: file?.fileName, className: "size-full object-cover" })) : (renderIcon(getFileIcon(file.fileName), 'size-8')) }) }), _jsx("div", { className: "text-neutral700 display16", children: file.fileName })] }), _jsx("input", { type: "file", onClick: (e) => (e.currentTarget.value = ''), onChange: (e) => handleFile(e, idx), disabled: locked, className: "sr-only" }), _jsx(LDButton, { onClick: async (e) => {
|
|
167
184
|
e.stopPropagation();
|
|
168
185
|
await handleDeleteFile(idx);
|
|
169
|
-
}, variant: "ghost", leftIcon: "trash2", size: "large", color: "neutral", className:
|
|
186
|
+
}, disabled: locked, variant: "ghost", leftIcon: "trash2", size: "large", color: "neutral", className: cn('text-neutral500 rounded-sm bg-white px-0 flex justify-center items-center min-w-0 h-10 w-10 ld-transition', locked && 'opacity-0 pointer-events-none') })] }, `${file.fileName}_${idx}`))) }));
|
|
170
187
|
};
|
|
171
188
|
const Description = ({ className }) => {
|
|
172
189
|
const { recommendedSize, maxSize, allowedExtensions, maxFileCount } = useFileUploadContext();
|
|
@@ -10,6 +10,8 @@ interface ILDFileUploadProps {
|
|
|
10
10
|
onChangeFile: (files: IFile[]) => void | Promise<void>;
|
|
11
11
|
onDeleteFile: (file: IFile) => Promise<boolean>;
|
|
12
12
|
isExistDescription?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
readOnly?: boolean;
|
|
13
15
|
}
|
|
14
16
|
declare const LDFileUpload: (props: ILDFileUploadProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
export default LDFileUpload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDFileUpload.d.ts","sourceRoot":"","sources":["../../../src/components/LDFileUpload/LDFileUpload.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,UAAU,kBAAkB;IAC1B,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LDFileUpload.d.ts","sourceRoot":"","sources":["../../../src/components/LDFileUpload/LDFileUpload.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,UAAU,kBAAkB;IAC1B,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,YAAY,GAAI,OAAO,kBAAkB,4CAyB9C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -3,6 +3,6 @@ import FileUploadBase from '../../components/LDFileUpload/FileUploadBase.js';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
const LDFileUpload = (props) => {
|
|
5
5
|
const [fileList, setFileList] = useState([]);
|
|
6
|
-
return (_jsxs(FileUploadBase.Root, { fileList: fileList, setFileList: setFileList, maxSize: props.maxSize, allowedExtensions: props.allowedExtensions, recommendedSize: props.recommendedSize ?? { width: 1200, height: 800 }, maxFileCount: 1, onChangeFile: props.onChangeFile, onDeleteFile: props.onDeleteFile, className: "flex flex-col gap-sm ld-transition", children: [fileList[0]?.src ? (_jsx(FileUploadBase.CardList, {})) : (_jsx(FileUploadBase.Input, { className: "w-fit" })), props.isExistDescription && _jsx(FileUploadBase.Description, {})] }));
|
|
6
|
+
return (_jsxs(FileUploadBase.Root, { fileList: fileList, setFileList: setFileList, maxSize: props.maxSize, allowedExtensions: props.allowedExtensions, recommendedSize: props.recommendedSize ?? { width: 1200, height: 800 }, maxFileCount: 1, onChangeFile: props.onChangeFile, onDeleteFile: props.onDeleteFile, className: "flex flex-col gap-sm ld-transition", disabled: props.disabled, readOnly: props.readOnly, children: [fileList[0]?.src ? (_jsx(FileUploadBase.CardList, {})) : (_jsx(FileUploadBase.Input, { className: "w-fit" })), props.isExistDescription && _jsx(FileUploadBase.Description, {})] }));
|
|
7
7
|
};
|
|
8
8
|
export default LDFileUpload;
|
|
@@ -11,6 +11,8 @@ interface ILDFileUploadListProps {
|
|
|
11
11
|
onChangeFile: (files: IFile[]) => void | Promise<void>;
|
|
12
12
|
onDeleteFile: (file: IFile) => Promise<boolean>;
|
|
13
13
|
isExistDescription?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
readOnly?: boolean;
|
|
14
16
|
}
|
|
15
17
|
declare const LDFileUploadList: (props: ILDFileUploadListProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export default LDFileUploadList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDFileUploadList.d.ts","sourceRoot":"","sources":["../../../src/components/LDFileUpload/LDFileUploadList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,UAAU,sBAAsB;IAC9B,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LDFileUploadList.d.ts","sourceRoot":"","sources":["../../../src/components/LDFileUpload/LDFileUploadList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,UAAU,sBAAsB;IAC9B,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,GAAI,OAAO,sBAAsB,4CA0BtD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -3,6 +3,6 @@ import FileUploadBase from '../../components/LDFileUpload/FileUploadBase.js';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
const LDFileUploadList = (props) => {
|
|
5
5
|
const [fileList, setFileList] = useState([]);
|
|
6
|
-
return (_jsxs(FileUploadBase.Root, { fileList: fileList, setFileList: setFileList, maxSize: props.maxSize, allowedExtensions: props.allowedExtensions, recommendedSize: props.recommendedSize ?? { width: 1200, height: 800 }, maxFileCount: props.maxFileCount, onChangeFile: props.onChangeFile, onDeleteFile: props.onDeleteFile, className: "flex flex-col gap-sm ld-transition", children: [fileList.length < props.maxFileCount && (_jsx(FileUploadBase.Input, { className: "w-fit" })), props.isExistDescription && _jsx(FileUploadBase.Description, {}), _jsx("div", { className: "flex flex-row gap-sm", children: fileList.length > 0 && _jsx(FileUploadBase.CardList, {}) })] }));
|
|
6
|
+
return (_jsxs(FileUploadBase.Root, { fileList: fileList, setFileList: setFileList, maxSize: props.maxSize, allowedExtensions: props.allowedExtensions, recommendedSize: props.recommendedSize ?? { width: 1200, height: 800 }, maxFileCount: props.maxFileCount, onChangeFile: props.onChangeFile, onDeleteFile: props.onDeleteFile, className: "flex flex-col gap-sm ld-transition", disabled: props.disabled, readOnly: props.readOnly, children: [fileList.length < props.maxFileCount && !props.disabled && (_jsx(FileUploadBase.Input, { className: "w-fit" })), props.isExistDescription && _jsx(FileUploadBase.Description, {}), _jsx("div", { className: "flex flex-row gap-sm", children: fileList.length > 0 && _jsx(FileUploadBase.CardList, {}) })] }));
|
|
7
7
|
};
|
|
8
8
|
export default LDFileUploadList;
|
|
@@ -10,6 +10,8 @@ interface ILDImageUploadProps {
|
|
|
10
10
|
onChangeFile: (files: IFile[]) => void | Promise<void>;
|
|
11
11
|
onDeleteFile: (file: IFile) => Promise<boolean>;
|
|
12
12
|
isExistDescription?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
readOnly?: boolean;
|
|
13
15
|
}
|
|
14
16
|
declare const LDImageUpload: (props: ILDImageUploadProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
export default LDImageUpload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDImageUpload.d.ts","sourceRoot":"","sources":["../../../src/components/LDFileUpload/LDImageUpload.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,UAAU,mBAAmB;IAC3B,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LDImageUpload.d.ts","sourceRoot":"","sources":["../../../src/components/LDFileUpload/LDImageUpload.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,UAAU,mBAAmB;IAC3B,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,aAAa,GAAI,OAAO,mBAAmB,4CAyBhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -3,6 +3,6 @@ import FileUploadBase from '../../components/LDFileUpload/FileUploadBase.js';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
const LDImageUpload = (props) => {
|
|
5
5
|
const [fileList, setFileList] = useState([]);
|
|
6
|
-
return (_jsxs(FileUploadBase.Root, { fileList: fileList, setFileList: setFileList, maxSize: props.maxSize, allowedExtensions: props.allowedExtensions, recommendedSize: props.recommendedSize ?? { width: 1200, height: 800 }, maxFileCount: 1, onChangeFile: props.onChangeFile, onDeleteFile: props.onDeleteFile, className: "flex flex-col gap-sm ld-transition", children: [fileList[0]?.src ? (_jsx(FileUploadBase.CardList, { type: "image" })) : (_jsx(FileUploadBase.Input, { type: "image" })), props.isExistDescription && _jsx(FileUploadBase.Description, {})] }));
|
|
6
|
+
return (_jsxs(FileUploadBase.Root, { fileList: fileList, setFileList: setFileList, maxSize: props.maxSize, allowedExtensions: props.allowedExtensions, recommendedSize: props.recommendedSize ?? { width: 1200, height: 800 }, maxFileCount: 1, onChangeFile: props.onChangeFile, onDeleteFile: props.onDeleteFile, className: "flex flex-col gap-sm ld-transition", disabled: props.disabled, readOnly: props.readOnly, children: [fileList[0]?.src ? (_jsx(FileUploadBase.CardList, { type: "image" })) : (_jsx(FileUploadBase.Input, { type: "image" })), props.isExistDescription && _jsx(FileUploadBase.Description, {})] }));
|
|
7
7
|
};
|
|
8
8
|
export default LDImageUpload;
|
|
@@ -11,6 +11,8 @@ interface ILDImageUploadListProps {
|
|
|
11
11
|
onChangeFile: (files: IFile[]) => void | Promise<void>;
|
|
12
12
|
onDeleteFile: (file: IFile) => Promise<boolean>;
|
|
13
13
|
isExistDescription?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
readOnly?: boolean;
|
|
14
16
|
}
|
|
15
17
|
declare const LDImageUploadList: (props: ILDImageUploadListProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export default LDImageUploadList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDImageUploadList.d.ts","sourceRoot":"","sources":["../../../src/components/LDFileUpload/LDImageUploadList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,UAAU,uBAAuB;IAC/B,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LDImageUploadList.d.ts","sourceRoot":"","sources":["../../../src/components/LDFileUpload/LDImageUploadList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,UAAU,uBAAuB;IAC/B,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,iBAAiB,GAAI,OAAO,uBAAuB,4CA0BxD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -3,6 +3,6 @@ import FileUploadBase from '../../components/LDFileUpload/FileUploadBase.js';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
const LDImageUploadList = (props) => {
|
|
5
5
|
const [fileList, setFileList] = useState([]);
|
|
6
|
-
return (_jsxs(FileUploadBase.Root, { fileList: fileList, setFileList: setFileList, maxSize: props.maxSize, allowedExtensions: props.allowedExtensions, recommendedSize: props.recommendedSize ?? { width: 1200, height: 800 }, maxFileCount: props.maxFileCount, onChangeFile: props.onChangeFile, onDeleteFile: props.onDeleteFile, className: "flex flex-col gap-sm ld-transition", children: [_jsxs("div", { className: "flex flex-row gap-sm", children: [fileList.length > 0 && _jsx(FileUploadBase.CardList, { type: "image" }), fileList.length < props.maxFileCount && (_jsx(FileUploadBase.Input, { type: "image" }))] }), props.isExistDescription && _jsx(FileUploadBase.Description, {})] }));
|
|
6
|
+
return (_jsxs(FileUploadBase.Root, { fileList: fileList, setFileList: setFileList, maxSize: props.maxSize, allowedExtensions: props.allowedExtensions, recommendedSize: props.recommendedSize ?? { width: 1200, height: 800 }, maxFileCount: props.maxFileCount, onChangeFile: props.onChangeFile, onDeleteFile: props.onDeleteFile, className: "flex flex-col gap-sm ld-transition", disabled: props.disabled, readOnly: props.readOnly, children: [_jsxs("div", { className: "flex flex-row gap-sm", children: [fileList.length > 0 && _jsx(FileUploadBase.CardList, { type: "image" }), fileList.length < props.maxFileCount && !props.disabled && (_jsx(FileUploadBase.Input, { type: "image" }))] }), props.isExistDescription && _jsx(FileUploadBase.Description, {})] }));
|
|
7
7
|
};
|
|
8
8
|
export default LDImageUploadList;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type FieldValues, type SubmitHandler, type SubmitErrorHandler, type UseFormReturn } from 'react-hook-form';
|
|
3
|
+
interface LDFormCommonProps<T extends FieldValues> {
|
|
4
|
+
methods: UseFormReturn<T>;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
onError?: SubmitErrorHandler<T>;
|
|
9
|
+
}
|
|
10
|
+
interface LDFormProps<T extends FieldValues> extends LDFormCommonProps<T> {
|
|
11
|
+
onSubmit: SubmitHandler<T>;
|
|
12
|
+
}
|
|
13
|
+
interface LDNativeFormProps<T extends FieldValues> extends LDFormCommonProps<T> {
|
|
14
|
+
action?: string;
|
|
15
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
16
|
+
onSubmit: (data: T) => Promise<void> | void;
|
|
17
|
+
}
|
|
18
|
+
declare const LDForm: <T extends FieldValues>({ methods, onSubmit, onError, className, children, id, }: LDFormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const LDNativeForm: <T extends FieldValues>({ methods, method, action, onSubmit, className, children, id, }: LDNativeFormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export { LDForm, LDNativeForm };
|
|
21
|
+
//# sourceMappingURL=LDForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDForm.d.ts","sourceRoot":"","sources":["../../../src/components/LDForm/LDForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB,CAAC,CAAC,SAAS,WAAW;IAC/C,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CACjC;AAED,UAAU,WAAW,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IACvE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CAC5B;AAED,UAAU,iBAAiB,CACzB,CAAC,SAAS,WAAW,CACrB,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrD,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED,QAAA,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,EAAE,0DAOpC,WAAW,CAAC,CAAC,CAAC,4CAYhB,CAAC;AAEF,QAAA,MAAM,YAAY,GAAI,CAAC,SAAS,WAAW,EAAE,iEAQ1C,iBAAiB,CAAC,CAAC,CAAC,4CAwBtB,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { FormProvider, } from 'react-hook-form';
|
|
4
|
-
const
|
|
4
|
+
const LDForm = ({ methods, onSubmit, onError, className, children, id, }) => {
|
|
5
5
|
return (_jsx(FormProvider, { ...methods, children: _jsx("form", { onSubmit: methods.handleSubmit(onSubmit, onError), className: className, id: id, children: children }) }));
|
|
6
6
|
};
|
|
7
|
-
const
|
|
7
|
+
const LDNativeForm = ({ methods, method, action, onSubmit, className, children, id, }) => {
|
|
8
8
|
return (_jsx(FormProvider, { ...methods, children: _jsx("form", { method: method, action: action, onSubmit: async (e) => {
|
|
9
9
|
const isValid = await methods.trigger();
|
|
10
10
|
if (!isValid) {
|
|
@@ -15,4 +15,4 @@ const NativeForm = ({ methods, method, action, onSubmit, className, children, id
|
|
|
15
15
|
await onSubmit(data);
|
|
16
16
|
}, className: className, id: id, children: children }) }));
|
|
17
17
|
};
|
|
18
|
-
export {
|
|
18
|
+
export { LDForm, LDNativeForm };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface LDFormErrorMessageProps {
|
|
2
|
+
id?: string;
|
|
3
|
+
error: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const LDFormErrorMessage: ({ id, error, disabled, className, }: LDFormErrorMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default LDFormErrorMessage;
|
|
9
|
+
//# sourceMappingURL=LDFormErrorMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDFormErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/components/LDForm/LDFormErrorMessage.tsx"],"names":[],"mappings":"AAKA,UAAU,uBAAuB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,kBAAkB,GAAI,qCAKzB,uBAAuB,4CAyBzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import cn from '../../utils/cn.js';
|
|
5
|
+
const LDFormErrorMessage = ({ id, error, disabled = false, className, }) => {
|
|
6
|
+
const visible = Boolean(error) && !disabled;
|
|
7
|
+
const [displayError, setDisplayError] = useState(error);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (visible)
|
|
10
|
+
setDisplayError(error);
|
|
11
|
+
}, [visible, error]);
|
|
12
|
+
return (_jsx("div", { id: id, role: "alert", onAnimationEnd: () => {
|
|
13
|
+
if (!visible)
|
|
14
|
+
setDisplayError('');
|
|
15
|
+
}, className: cn('text-danger600 display12 bold absolute bottom-1 right-2', visible ? 'animate-fade-in' : 'animate-fade-out', className), children: displayError && `*${displayError}` }, visible ? displayError : 'hidden'));
|
|
16
|
+
};
|
|
17
|
+
export default LDFormErrorMessage;
|
|
@@ -12,7 +12,7 @@ interface FieldState {
|
|
|
12
12
|
* 지원하기 위해 기본값이 any인 제네릭으로 선언됨.
|
|
13
13
|
* 사용처에서 `<FormField<string>>` 와 같이 구체화할 수 있음.
|
|
14
14
|
*/
|
|
15
|
-
interface
|
|
15
|
+
interface LDFormFieldRenderProps<TValue = any> {
|
|
16
16
|
field: {
|
|
17
17
|
name: string;
|
|
18
18
|
value: TValue;
|
|
@@ -38,7 +38,7 @@ interface FormFieldRenderProps<TValue = any> {
|
|
|
38
38
|
defaultValue?: TValue;
|
|
39
39
|
}) => void;
|
|
40
40
|
}
|
|
41
|
-
interface
|
|
41
|
+
interface LDFormFieldProps<TValue = any> {
|
|
42
42
|
name: string;
|
|
43
43
|
options?: RegisterOptions;
|
|
44
44
|
customErrorMessage?: string;
|
|
@@ -48,8 +48,8 @@ interface FormFieldProps<TValue = any> {
|
|
|
48
48
|
* (HTMLInputElement, HTMLButtonElement 등 요소 타입이 사용처마다 다름)
|
|
49
49
|
*/
|
|
50
50
|
ref?: Ref<any>;
|
|
51
|
-
children: (props:
|
|
51
|
+
children: (props: LDFormFieldRenderProps<TValue>) => ReactNode;
|
|
52
52
|
}
|
|
53
|
-
declare const
|
|
54
|
-
export default
|
|
55
|
-
//# sourceMappingURL=
|
|
53
|
+
declare const LDFormField: <TValue = any>({ name, options, customErrorMessage, disabled, ref, children, }: LDFormFieldProps<TValue>) => ReactNode;
|
|
54
|
+
export default LDFormField;
|
|
55
|
+
//# sourceMappingURL=LDFormField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDFormField.d.ts","sourceRoot":"","sources":["../../../src/components/LDForm/LDFormField.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AAEzB,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,UAAU,sBAAsB,CAAC,MAAM,GAAG,GAAG;IAC3C,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd;;;WAGG;QACH,GAAG,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;QAC5B;;;WAGG;QACH,QAAQ,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;QACpC,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,+BAA+B;QAC/B,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;QAC5C,iDAAiD;QACjD,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC3D;AAED,UAAU,gBAAgB,CAAC,MAAM,GAAG,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,sBAAsB,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;CAChE;AAED,QAAA,MAAM,WAAW,GAAI,MAAM,GAAG,GAAG,EAAG,iEAOjC,gBAAgB,CAAC,MAAM,CAAC,cAyC1B,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useController, useFormContext, } from 'react-hook-form';
|
|
3
|
-
const
|
|
3
|
+
const LDFormField = ({ name, options, customErrorMessage = '', disabled, ref, children, }) => {
|
|
4
4
|
const { resetField } = useFormContext();
|
|
5
5
|
const { field: controllerField, fieldState } = useController({
|
|
6
6
|
name,
|
|
@@ -40,4 +40,4 @@ const FormField = ({ name, options, customErrorMessage = '', disabled, ref, chil
|
|
|
40
40
|
resetField: (opts) => resetField(name, opts),
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
|
-
export default
|
|
43
|
+
export default LDFormField;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
import { type RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import { type LDInputProps } from './LDInput.js';
|
|
4
|
+
interface LDFormInputProps extends Omit<LDInputProps, 'name' | 'onChange' | 'value' | 'onBlur'> {
|
|
5
|
+
name: string;
|
|
6
|
+
options?: RegisterOptions;
|
|
7
|
+
ref?: Ref<HTMLInputElement>;
|
|
8
|
+
customErrorMessage?: string;
|
|
9
|
+
isHiddenErrorMessage?: boolean;
|
|
10
|
+
errorClassName?: string;
|
|
11
|
+
showEditIcon?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const LDFormInput: ({ name, options, variant, color, size, block, disabled, ref, customErrorMessage, isHiddenErrorMessage, errorClassName, showEditIcon, rightAddon, ...props }: LDFormInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default LDFormInput;
|
|
15
|
+
//# sourceMappingURL=LDFormInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDFormInput.d.ts","sourceRoot":"","sources":["../../../src/components/LDInput/LDFormInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAgB,EAAE,KAAK,YAAY,EAAa,MAAM,WAAW,CAAC;AAMlE,UAAU,gBAAiB,SAAQ,IAAI,CACrC,YAAY,EACZ,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CACzC;IACC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,QAAA,MAAM,WAAW,GAAI,6JAelB,gBAAgB,4CAqFlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -2,18 +2,23 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import LDInput, { iconSizes } from './LDInput.js';
|
|
4
4
|
import LucideIcon from '../Icon/LucideIcon.js';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import LDFormField from '../LDForm/LDFormField.js';
|
|
6
|
+
import LDFormErrorMessage from '../LDForm/LDFormErrorMessage.js';
|
|
7
7
|
import cn from '../../utils/cn.js';
|
|
8
|
-
const
|
|
8
|
+
const LDFormInput = ({ name, options, variant = 'filled', color = 'neutral', size = 'small', block = false, disabled = false, ref, customErrorMessage = '', isHiddenErrorMessage = false, errorClassName, showEditIcon = false, rightAddon, ...props }) => {
|
|
9
9
|
const iconSize = iconSizes[size ?? 'sm'];
|
|
10
|
-
return (_jsx(
|
|
10
|
+
return (_jsx(LDFormField, { name: name, options: options, customErrorMessage: customErrorMessage, disabled: disabled, ref: ref, children: ({ field, fieldState, resetField }) => {
|
|
11
11
|
const editIconAddon = showEditIcon && !disabled ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "group-focus-within:hidden", children: _jsx(LucideIcon, { name: "pencil", size: iconSize }) }), _jsx("button", { type: "button", "aria-label": "\uC785\uB825 \uB0B4\uC6A9 \uCD08\uAE30\uD654", onMouseDown: (e) => {
|
|
12
12
|
e.preventDefault();
|
|
13
13
|
resetField({ defaultValue: '' });
|
|
14
|
-
}, className:
|
|
14
|
+
}, className: cn('hidden group-focus-within:block text-neutral500 cursor-pointer ld-transition', {
|
|
15
|
+
['hover:text-neutral600']: color === 'neutral',
|
|
16
|
+
['hover:text-lb500']: color === 'point',
|
|
17
|
+
['hover:text-danger600']: color === 'danger',
|
|
18
|
+
}), children: _jsx(LucideIcon, { name: "x", size: iconSize }) })] })) : null;
|
|
15
19
|
const combinedAddon = editIconAddon || rightAddon ? (_jsxs(_Fragment, { children: [editIconAddon, rightAddon] })) : undefined;
|
|
16
|
-
return (_jsxs("div", { className: cn('relative border-2 border-transparent', block ? 'w-full' : 'w-auto'), children: [_jsx(LDInput, { ...props, ...field, value: field.value ?? '', variant: variant, color: fieldState.hasError ? 'danger' : 'neutral', size: size, block: block, rightAddon: combinedAddon, "aria-invalid": fieldState.hasError, "aria-describedby": fieldState.hasError ? fieldState.errorId : undefined }), !isHiddenErrorMessage && (_jsx(
|
|
20
|
+
return (_jsxs("div", { className: cn('relative border-2 border-transparent', block ? 'w-full' : 'w-auto'), children: [_jsx(LDInput, { ...props, ...field, value: field.value ?? '', variant: variant, color: fieldState.hasError ? 'danger' : 'neutral', size: size, block: block, rightAddon: combinedAddon, "aria-invalid": fieldState.hasError, "aria-describedby": fieldState.hasError ? fieldState.errorId : undefined }), !isHiddenErrorMessage && (_jsx(LDFormErrorMessage, { id: fieldState.errorId, error: fieldState.error, disabled: disabled, className: cn((showEditIcon || rightAddon || props.showPasswordToggle) &&
|
|
21
|
+
'right-8', errorClassName) }))] }));
|
|
17
22
|
} }));
|
|
18
23
|
};
|
|
19
|
-
export default
|
|
24
|
+
export default LDFormInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDInput.d.ts","sourceRoot":"","sources":["../../../src/components/LDInput/LDInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAMf,KAAK,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AACnD,KAAK,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AACjD,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,KAAK,GACL,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"LDInput.d.ts","sourceRoot":"","sources":["../../../src/components/LDInput/LDInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAMf,KAAK,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AACnD,KAAK,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AACjD,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,KAAK,GACL,QAAQ,CAAC;AA0Cb,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAOtD,CAAC;AAWF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAO/C,CAAC;AAGF,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,OAAO,GAAG,MAAM,CACjB;IACC,mBAAmB;IACnB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,YAAY;IACZ,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2BAA2B;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,uBAAuB;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qBAAqB;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uBAAuB;IACvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,mBAAmB;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED,QAAA,MAAM,OAAO,GAAI,kHAad,YAAY,4CA0Ed,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -6,19 +6,19 @@ import cn from '../../utils/cn.js';
|
|
|
6
6
|
// ── 스타일 매핑 ──
|
|
7
7
|
const variantColorClasses = {
|
|
8
8
|
filled: {
|
|
9
|
-
neutral: 'bg-
|
|
10
|
-
point: 'bg-
|
|
11
|
-
danger: 'bg-tintRed text-neutral900 outline-2 outline-
|
|
9
|
+
neutral: 'bg-neutral50 text-neutral900 border-none outline-2 outline-transparent [outline-style:solid] focus:bg-tintBlue focus:outline-lb500',
|
|
10
|
+
point: 'bg-tintBlue text-neutral900 border-none outline-2 outline-transparent [outline-style:solid] focus:outline-lb500',
|
|
11
|
+
danger: 'bg-tintRed text-neutral900 border-none outline-2 outline-danger600 [outline-style:solid] focus:outline-danger600',
|
|
12
12
|
},
|
|
13
13
|
outline: {
|
|
14
|
-
neutral: 'bg-transparent text-neutral900 border-2 border-
|
|
15
|
-
point: 'bg-transparent text-neutral900 border-2 border-
|
|
16
|
-
danger: 'bg-transparent text-neutral900 border-2 border-
|
|
14
|
+
neutral: 'bg-transparent text-neutral900 border-2 border-neutral100 outline-none',
|
|
15
|
+
point: 'bg-transparent text-neutral900 border-2 border-lb500 outline-none',
|
|
16
|
+
danger: 'bg-transparent text-neutral900 border-2 border-danger600 outline-none',
|
|
17
17
|
},
|
|
18
18
|
ghost: {
|
|
19
|
-
neutral: 'bg-transparent text-neutral900 outline-2 outline-transparent
|
|
20
|
-
point: 'bg-transparent text-neutral900 outline-2 outline-transparent
|
|
21
|
-
danger: 'bg-transparent text-
|
|
19
|
+
neutral: 'bg-transparent text-neutral900 border-none outline-2 outline-transparent [outline-style:solid] focus:bg-neutral50 focus:outline-lb500',
|
|
20
|
+
point: 'bg-transparent text-neutral900 border-none outline-2 outline-transparent [outline-style:solid] focus:bg-tintBlue focus:outline-lb500',
|
|
21
|
+
danger: 'bg-transparent text-danger600 border-none outline-2 outline-transparent [outline-style:solid] focus:bg-tintRed focus:outline-danger600',
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
24
|
const disabledVariantClasses = {
|
|
@@ -26,6 +26,12 @@ const disabledVariantClasses = {
|
|
|
26
26
|
outline: 'bg-transparent text-mono400 border-2 border-mono200',
|
|
27
27
|
ghost: 'bg-transparent text-mono400',
|
|
28
28
|
};
|
|
29
|
+
// addon 아이콘 버튼 hover 색 — color 프리셋에 맞춰 강조(LDFormInput reset 아이콘과 동일 컨셉)
|
|
30
|
+
const addonHoverColorClasses = {
|
|
31
|
+
neutral: 'hover:text-neutral600',
|
|
32
|
+
point: 'hover:text-lb500',
|
|
33
|
+
danger: 'hover:text-danger600',
|
|
34
|
+
};
|
|
29
35
|
export const inputSizeClasses = {
|
|
30
36
|
xSmall: 'input-2xs',
|
|
31
37
|
small: 'input-xs',
|
|
@@ -58,14 +64,16 @@ const LDInput = ({ variant, color = 'neutral', size, showPasswordToggle = false,
|
|
|
58
64
|
: 'password'
|
|
59
65
|
: type;
|
|
60
66
|
const iconSize = iconSizes[size ?? 'medium'];
|
|
61
|
-
const passwordToggleAddon = showPasswordToggle ? (_jsx("button", { type: "button", "aria-label": passwordVisible ? '비밀번호 숨기기' : '비밀번호 표시', "aria-pressed": passwordVisible, onClick: () => setPasswordVisible(!passwordVisible), disabled: disabled, className: cn('text-
|
|
67
|
+
const passwordToggleAddon = showPasswordToggle ? (_jsx("button", { type: "button", "aria-label": passwordVisible ? '비밀번호 숨기기' : '비밀번호 표시', "aria-pressed": passwordVisible, onClick: () => setPasswordVisible(!passwordVisible), disabled: disabled, className: cn('text-neutral500 ld-transition', disabled
|
|
68
|
+
? 'cursor-not-allowed'
|
|
69
|
+
: cn('cursor-pointer', addonHoverColorClasses[color])), children: _jsx(LucideIcon, { name: passwordVisible ? 'eye' : 'eyeOff', size: iconSize }) })) : null;
|
|
62
70
|
const resolvedRightAddon = rightAddon ?? passwordToggleAddon;
|
|
63
71
|
const { width, height, minWidth, maxWidth, minHeight, maxHeight, ...fieldStyle } = style ?? {};
|
|
64
72
|
const rootStyle = { width, height, minWidth, maxWidth, minHeight, maxHeight };
|
|
65
|
-
const fieldClassName = cn('w-full bold placeholder-mono400 ld-transition
|
|
73
|
+
const fieldClassName = cn('w-full bold placeholder-mono400 ld-transition', variant &&
|
|
66
74
|
(disabled
|
|
67
75
|
? disabledVariantClasses[variant]
|
|
68
|
-
: variantColorClasses[variant][color]), size && !height && inputSizeClasses[size], height && 'h-full', disabled && 'cursor-not-allowed', 'read-only:cursor-not-allowed', resolvedRightAddon && size && addonRightPaddingClasses[size], className);
|
|
69
|
-
return (_jsxs(InputBase.Root, { block: block, style: rootStyle, children: [_jsx(InputBase.Field, { ref: ref, type: resolvedType, disabled: disabled, className: fieldClassName, style: fieldStyle, ...props }), resolvedRightAddon && (_jsx(InputBase.Addon, { position: "right", className: "right-2.5 text-
|
|
76
|
+
: variantColorClasses[variant][color]), size && !height && inputSizeClasses[size], (size === 'xSmall' || size === 'small') && 'rounded-[6px]', height && 'h-full', disabled && 'cursor-not-allowed', 'read-only:cursor-not-allowed', resolvedRightAddon && size && addonRightPaddingClasses[size], className);
|
|
77
|
+
return (_jsxs(InputBase.Root, { block: block, style: rootStyle, children: [_jsx(InputBase.Field, { ref: ref, type: resolvedType, disabled: disabled, className: fieldClassName, style: fieldStyle, ...props }), resolvedRightAddon && (_jsx(InputBase.Addon, { position: "right", className: "right-2.5 text-neutral500", children: resolvedRightAddon }))] }));
|
|
70
78
|
};
|
|
71
79
|
export default LDInput;
|
|
@@ -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;AA0BvD,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,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6BD,UAAU,SAAS;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6BD,UAAU,SAAS;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0BD,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
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;AA0BvD,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,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6BD,UAAU,SAAS;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6BD,UAAU,SAAS;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0BD,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAwBD,QAAA,MAAM,cAAc;qEAhJjB,aAAa;8CAYiC,SAAS;0BAgB7B,SAAS;0BA+BT,SAAS;yCAgCU,SAAS;mDA+BH,SAAS;CA6B9D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -15,23 +15,23 @@ const Root = ({ className, children, ...props }) => (_jsx("nav", { role: "naviga
|
|
|
15
15
|
const Prev = ({ className }) => {
|
|
16
16
|
const { currentPage, onPageChange } = usePaginationContext();
|
|
17
17
|
const canPrevious = currentPage > 1;
|
|
18
|
-
return (_jsx(LDButton, { variant: "outline", color: "neutral", size: "
|
|
19
|
-
? 'bg-neutral100
|
|
20
|
-
: 'bg-neutral50
|
|
18
|
+
return (_jsx(LDButton, { variant: "outline", color: "neutral", size: "2xsmall", shape: "capsule", leftIcon: "chevronLeft", compact: true, disabled: !canPrevious, onClick: () => onPageChange(currentPage - 1), "aria-label": "\uC774\uC804 \uD398\uC774\uC9C0", className: cn(canPrevious
|
|
19
|
+
? 'bg-neutral100 text-neutral400'
|
|
20
|
+
: 'bg-neutral50 text-neutral200', canPrevious && 'hover:bg-neutral200', className) }));
|
|
21
21
|
};
|
|
22
22
|
const Next = ({ className }) => {
|
|
23
23
|
const { currentPage, totalPages, onPageChange } = usePaginationContext();
|
|
24
24
|
const canNext = currentPage < totalPages;
|
|
25
|
-
return (_jsx(LDButton, { variant: "outline", color: "neutral", size: "
|
|
26
|
-
? 'bg-neutral100
|
|
27
|
-
: 'bg-neutral50
|
|
25
|
+
return (_jsx(LDButton, { variant: "outline", color: "neutral", size: "2xsmall", shape: "capsule", leftIcon: "chevronRight", disabled: !canNext, compact: true, onClick: () => onPageChange(currentPage + 1), "aria-label": "\uB2E4\uC74C \uD398\uC774\uC9C0", className: cn(canNext
|
|
26
|
+
? 'bg-neutral100 text-neutral400'
|
|
27
|
+
: 'bg-neutral50 text-neutral200', canNext && 'hover:bg-neutral200', className) }));
|
|
28
28
|
};
|
|
29
29
|
const List = ({ numbersToShow = 5, className }) => {
|
|
30
30
|
const { currentPage, totalPages, onPageChange } = usePaginationContext();
|
|
31
31
|
const pages = calculatePaginationOptions(currentPage, totalPages, numbersToShow);
|
|
32
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
33
|
};
|
|
34
|
-
const Item = ({ page, isActive, onClick, className }) => (_jsx(LDButton, { variant: "ghost", color: isActive ? 'point' : 'neutral', size: "
|
|
34
|
+
const Item = ({ page, isActive, onClick, className }) => (_jsx(LDButton, { variant: "ghost", shape: "capsule", color: isActive ? 'point' : 'neutral', size: "xsmall", compact: true, onClick: onClick, "aria-label": `${page} 페이지`, "aria-current": isActive ? 'page' : undefined, className: cn('outline-none p-3.5 regular', !isActive && 'text-neutral400', className), children: page }));
|
|
35
35
|
// ── Export ──
|
|
36
36
|
const PaginationBase = {
|
|
37
37
|
Provider,
|
|
@@ -7,7 +7,7 @@ import cn from '../../utils/cn.js';
|
|
|
7
7
|
const itemColorClasses = {
|
|
8
8
|
blue: 'hover:bg-tintBlue text-lb500',
|
|
9
9
|
red: 'hover:bg-tintRed text-danger600',
|
|
10
|
-
gray: 'hover:bg-
|
|
10
|
+
gray: 'hover:bg-mono100 text-neutral500',
|
|
11
11
|
};
|
|
12
12
|
const iconSizes = {
|
|
13
13
|
sm: 12,
|
|
@@ -16,11 +16,11 @@ const iconSizes = {
|
|
|
16
16
|
};
|
|
17
17
|
const LDPopover = ({ items, content, children, open, onOpenChange, iconSize = 'sm', isHorizontal = false, align = 'end', offset, contentWidth, triggerClassName, popoverClassName, style, }) => {
|
|
18
18
|
const isAsChild = isValidElement(children);
|
|
19
|
-
return (_jsxs(PopoverBase.Root, { open: open, onOpenChange: onOpenChange, children: [_jsx(PopoverBase.Trigger, { asChild: isAsChild, style: style, className: cn('flex items-center justify-center cursor-pointer ld-transition rounded-[5px] outline-none', !isAsChild && 'px-2 py-1 min-h-6 hover:bg-
|
|
19
|
+
return (_jsxs(PopoverBase.Root, { open: open, onOpenChange: onOpenChange, children: [_jsx(PopoverBase.Trigger, { asChild: isAsChild, style: style, className: cn('flex items-center justify-center cursor-pointer ld-transition rounded-[5px] outline-none', !isAsChild && 'px-2 py-1 min-h-6 hover:bg-mono100', triggerClassName), children: isAsChild ? (children) : (_jsx(LucideIcon, { name: isHorizontal ? 'ellipsis' : 'ellipsisVertical', size: iconSizes[iconSize], className: "text-neutral500" })) }), _jsx(PopoverBase.Content, { align: align, sideOffset: offset, style: {
|
|
20
20
|
width: contentWidth === 'trigger'
|
|
21
21
|
? 'var(--radix-popover-trigger-width)'
|
|
22
22
|
: contentWidth,
|
|
23
|
-
}, className: cn('min-w-[160px] rounded-[5px] bg-white border border-
|
|
23
|
+
}, className: cn('min-w-[160px] rounded-[5px] bg-white border border-mono100 p-xs flex flex-col gap-xs z-50 shadow-lg', popoverClassName), children: content
|
|
24
24
|
? content
|
|
25
25
|
: items?.map((item, index) => (_jsx("button", { type: "button", className: cn('w-full flex items-center cursor-pointer justify-start px-2 py-1.5 rounded-[5px] ld-transition display12 text-left', itemColorClasses[item.color ?? 'gray']), onClick: (e) => {
|
|
26
26
|
e.stopPropagation();
|
|
@@ -8,7 +8,7 @@ const Trigger = ({ disabled, className, style, children, onClick, asChild, }) =>
|
|
|
8
8
|
return (_jsx(RadixPopover.Trigger, { asChild: asChild, disabled: disabled, className: cn('inline-flex items-center', className), style: style, onClick: onClick, children: children }));
|
|
9
9
|
};
|
|
10
10
|
const Content = ({ align = 'start', sideOffset = 4, className, children, style, onOpenAutoFocus, }) => {
|
|
11
|
-
return (_jsx(RadixPopover.Portal, { children: _jsx(RadixPopover.Content, { align: align, sideOffset: sideOffset, onOpenAutoFocus: onOpenAutoFocus, className: cn('z-50 outline-hidden', 'animate-
|
|
11
|
+
return (_jsx(RadixPopover.Portal, { children: _jsx(RadixPopover.Content, { align: align, sideOffset: sideOffset, onOpenAutoFocus: onOpenAutoFocus, className: cn('z-50 outline-hidden', 'animate-fade-in data-[state=closed]:animate-fade-out', className), style: style, children: children }) }));
|
|
12
12
|
};
|
|
13
13
|
export const PopoverBase = {
|
|
14
14
|
Root,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import LDRadioGroup from './LDRadioGroup.js';
|
|
4
|
-
import FormField from '../
|
|
5
|
-
import FormErrorMessage from '../
|
|
4
|
+
import FormField from '../LDForm/LDFormField.js';
|
|
5
|
+
import FormErrorMessage from '../LDForm/LDFormErrorMessage.js';
|
|
6
6
|
const FormRadioGroup = ({ name, options, customErrorMessage = '', isHiddenErrorMessage = true, errorClassName, disabled = false, ...props }) => {
|
|
7
7
|
return (_jsx(FormField, { name: name, options: options, customErrorMessage: customErrorMessage, disabled: disabled, children: ({ field, fieldState }) => (_jsxs("div", { className: "relative", children: [_jsx(LDRadioGroup, { ...props, name: name, value: field.value ?? '', onChange: field.onChange, disabled: disabled, "aria-invalid": field['aria-invalid'], "aria-describedby": field['aria-describedby'] }), !isHiddenErrorMessage && (_jsx(FormErrorMessage, { error: fieldState.error, disabled: disabled, className: errorClassName }))] })) }));
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDRadio.d.ts","sourceRoot":"","sources":["../../../src/components/LDRadio/LDRadio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAK3D,KAAK,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AAC7B,KAAK,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAkBpC,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CACzC;IACC,uBAAuB;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB;IAClB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,cAAc;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,yCAAyC;IACzC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,aAAa;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;
|
|
1
|
+
{"version":3,"file":"LDRadio.d.ts","sourceRoot":"","sources":["../../../src/components/LDRadio/LDRadio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAK3D,KAAK,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AAC7B,KAAK,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAkBpC,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CACzC;IACC,uBAAuB;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB;IAClB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,cAAc;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,yCAAyC;IACzC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,aAAa;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAmFD,QAAA,MAAM,OAAO,GAAI,4GAYd,YAAY,4CA0Cd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|