@pop-ui/core 0.0.10 → 0.0.12
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/README.md +184 -0
- package/dist/assets/PretendardVariable.woff2 +0 -0
- package/dist/assets/core-O7aPPk54.css +1 -0
- package/dist/core.js +490 -463
- package/dist/core.umd.cjs +1 -1
- package/package.json +138 -65
- package/dist/components/Alert/Alert.stories.js +0 -18
- package/dist/components/Alert/index.js +0 -38
- package/dist/components/Button/Button.stories.js +0 -42
- package/dist/components/Button/index.js +0 -33
- package/dist/components/Checkbox/Checkbox.stories.js +0 -14
- package/dist/components/Checkbox/index.js +0 -27
- package/dist/components/DatePicker/DatePicker.stories.js +0 -27
- package/dist/components/DatePicker/index.js +0 -29
- package/dist/components/Dropdown/Dropdown.stories.js +0 -16
- package/dist/components/Dropdown/index.js +0 -50
- package/dist/components/ImageUploader/ImageUploader.stories.js +0 -9
- package/dist/components/ImageUploader/index.js +0 -37
- package/dist/components/Modal/Modal.stories.js +0 -13
- package/dist/components/Modal/index.js +0 -25
- package/dist/components/Pagination/Pagination.stories.js +0 -14
- package/dist/components/Pagination/index.js +0 -56
- package/dist/components/Radio/Radio.stories.js +0 -14
- package/dist/components/Radio/index.js +0 -19
- package/dist/components/SearchBar/SearchBar.stories.js +0 -16
- package/dist/components/SearchBar/index.js +0 -46
- package/dist/components/SegmentButton/SegmentButton.stories.js +0 -14
- package/dist/components/SegmentButton/index.js +0 -24
- package/dist/components/Tab/Tab.stories.js +0 -28
- package/dist/components/Tab/index.js +0 -18
- package/dist/components/Table/Table.stories.js +0 -127
- package/dist/components/Table/index.js +0 -129
- package/dist/components/TextField/TextField.stories.js +0 -36
- package/dist/components/TextField/index.js +0 -60
- package/dist/components/TimePicker/TimePicker.stories.js +0 -13
- package/dist/components/TimePicker/index.js +0 -30
- package/dist/components/Toggle/Toggle.stories.js +0 -15
- package/dist/components/Toggle/index.js +0 -41
- package/dist/components/Tooltip/Tooltip.stories.js +0 -24
- package/dist/components/Tooltip/index.js +0 -13
- package/dist/components/index.js +0 -17
- package/dist/components/shared/styles.js +0 -219
- package/dist/core.css +0 -1
- package/dist/helpers/checkMessage/checkMessage.test.js +0 -9
- package/dist/helpers/checkMessage/index.js +0 -8
- package/dist/index.js +0 -1
- package/dist/types/components/Alert/Alert.stories.d.ts +0 -3
- package/dist/types/components/Alert/index.d.ts +0 -17
- package/dist/types/components/Button/Button.stories.d.ts +0 -7
- package/dist/types/components/Button/index.d.ts +0 -14
- package/dist/types/components/Checkbox/Checkbox.stories.d.ts +0 -3
- package/dist/types/components/Checkbox/index.d.ts +0 -11
- package/dist/types/components/DatePicker/DatePicker.stories.d.ts +0 -5
- package/dist/types/components/DatePicker/index.d.ts +0 -16
- package/dist/types/components/Dropdown/Dropdown.stories.d.ts +0 -3
- package/dist/types/components/Dropdown/index.d.ts +0 -23
- package/dist/types/components/ImageUploader/ImageUploader.stories.d.ts +0 -3
- package/dist/types/components/ImageUploader/index.d.ts +0 -22
- package/dist/types/components/Modal/Modal.stories.d.ts +0 -3
- package/dist/types/components/Modal/index.d.ts +0 -13
- package/dist/types/components/Pagination/Pagination.stories.d.ts +0 -3
- package/dist/types/components/Pagination/index.d.ts +0 -18
- package/dist/types/components/Radio/Radio.stories.d.ts +0 -3
- package/dist/types/components/Radio/index.d.ts +0 -11
- package/dist/types/components/SearchBar/SearchBar.stories.d.ts +0 -3
- package/dist/types/components/SearchBar/index.d.ts +0 -27
- package/dist/types/components/SegmentButton/SegmentButton.stories.d.ts +0 -3
- package/dist/types/components/SegmentButton/index.d.ts +0 -13
- package/dist/types/components/Tab/Tab.stories.d.ts +0 -3
- package/dist/types/components/Tab/index.d.ts +0 -24
- package/dist/types/components/Table/Table.stories.d.ts +0 -5
- package/dist/types/components/Table/index.d.ts +0 -41
- package/dist/types/components/TextField/TextField.stories.d.ts +0 -5
- package/dist/types/components/TextField/index.d.ts +0 -35
- package/dist/types/components/TimePicker/TimePicker.stories.d.ts +0 -3
- package/dist/types/components/TimePicker/index.d.ts +0 -11
- package/dist/types/components/Toggle/Toggle.stories.d.ts +0 -3
- package/dist/types/components/Toggle/index.d.ts +0 -17
- package/dist/types/components/Tooltip/Tooltip.stories.d.ts +0 -3
- package/dist/types/components/Tooltip/index.d.ts +0 -13
- package/dist/types/components/index.d.ts +0 -17
- package/dist/types/components/shared/styles.d.ts +0 -86
- package/dist/types/helpers/checkMessage/checkMessage.test.d.ts +0 -1
- package/dist/types/helpers/checkMessage/index.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Input, Select, Tooltip } from "@mantine/core";
|
|
3
|
-
import ic_tooltip from "../../assets/icons/ic_tooltip.svg";
|
|
4
|
-
import ic_chevron_up from "../../assets/icons/ic_chevron_up.svg";
|
|
5
|
-
import ic_chevron_down from "../../assets/icons/ic_chevron_down.svg";
|
|
6
|
-
import styles from "./styles.module.scss";
|
|
7
|
-
import { useState } from "react";
|
|
8
|
-
/**
|
|
9
|
-
* ----- dropdown props -----
|
|
10
|
-
** label: string, 라벨
|
|
11
|
-
** labelPosition: 'top' | 'left', 라벨위치
|
|
12
|
-
** size: 'sm' | 'md' | 'lg'
|
|
13
|
-
** tooltip: string, 툴팁
|
|
14
|
-
** tooltipPosition: 'top' | 'bottom' | 'left' | 'right', 툴팁 위치
|
|
15
|
-
** description: string, 상세 설명
|
|
16
|
-
** errorMsg: string, 에러 메시지
|
|
17
|
-
** 기타 props는 mantine select props 사용: https://v6.mantine.dev/core/select/?t=props
|
|
18
|
-
*/
|
|
19
|
-
export const Dropdown = ({ label, labelPosition = "top", size = "md", required, tooltip, tooltipPosition = "top", errorMsg, description, ...props }) => {
|
|
20
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
21
|
-
let labelStyle = styles.md_label;
|
|
22
|
-
let selectStyle = styles.md_textfield;
|
|
23
|
-
let tooltipStyle = styles.md_tooltip;
|
|
24
|
-
let chevronSize = 18;
|
|
25
|
-
if (size === "sm") {
|
|
26
|
-
labelStyle = styles.sm_label;
|
|
27
|
-
selectStyle = styles.sm_textfield;
|
|
28
|
-
tooltipStyle = styles.sm_tooltip;
|
|
29
|
-
chevronSize = 14;
|
|
30
|
-
}
|
|
31
|
-
else if (size === "lg") {
|
|
32
|
-
labelStyle = styles.lg_label;
|
|
33
|
-
selectStyle = styles.lg_textfield;
|
|
34
|
-
tooltipStyle = styles.lg_tooltip;
|
|
35
|
-
chevronSize = 24;
|
|
36
|
-
}
|
|
37
|
-
return (_jsxs("div", { className: labelPosition === "top"
|
|
38
|
-
? styles.top_label_textfield
|
|
39
|
-
: styles.left_label_textfield, children: [_jsxs("div", { children: [label && (_jsx(Input.Label, { required: required, className: labelStyle, children: label })), tooltip && (_jsx(Tooltip, { label: tooltip, position: tooltipPosition, children: _jsx("img", { className: tooltipStyle, src: ic_tooltip, alt: "tooltip_icon" }) }))] }), _jsxs("div", { children: [_jsx(Select, { ...props, size: size, error: errorMsg, className: selectStyle, rightSection: isOpen ? (_jsx("img", { width: chevronSize, src: ic_chevron_up })) : (_jsx("img", { width: chevronSize, src: ic_chevron_down })), onDropdownOpen: () => setIsOpen(true), onDropdownClose: () => setIsOpen(false), styles: () => ({
|
|
40
|
-
item: {
|
|
41
|
-
"&[data-selected]": {
|
|
42
|
-
"&, &:hover": {
|
|
43
|
-
backgroundColor: "#e7e7e7",
|
|
44
|
-
color: "#000000",
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
}) }), description && (_jsx(Input.Description, { className: styles.input_description, children: description })), errorMsg && (_jsx(Input.Error, { className: styles.input_error_msg, children: errorMsg }))] })] }));
|
|
49
|
-
};
|
|
50
|
-
export default Dropdown;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ImageUploader } from ".";
|
|
3
|
-
export default {
|
|
4
|
-
title: "Core/ImageUploader",
|
|
5
|
-
component: ImageUploader,
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => (_jsx(ImageUploader, { ...args }));
|
|
8
|
-
export const defaultImageUploader = Template.bind({});
|
|
9
|
-
defaultImageUploader.args = {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useState } from "react";
|
|
3
|
-
import { Dropzone, IMAGE_MIME_TYPE, } from "@mantine/dropzone";
|
|
4
|
-
import styles from "./styles.module.scss";
|
|
5
|
-
import ic_image_colored from "../../assets/icons/ic_image_colored.svg";
|
|
6
|
-
import ic_cancel_circle from "../../assets/icons/ic_cancel_circle.svg";
|
|
7
|
-
/**
|
|
8
|
-
* ----- image uploader props -----
|
|
9
|
-
** width: number
|
|
10
|
-
** height: number
|
|
11
|
-
** defaultMsg: ReactNode, placeholder 대체
|
|
12
|
-
** file: string | FileWithPath
|
|
13
|
-
** showClearButton: boolean, 업로드 파일 clear 버튼 노출 여부
|
|
14
|
-
** onClear: () => void, 업로드 파일 clear시 실행될 함수
|
|
15
|
-
** 기타 props는 mantine dropzone props 사용: https://v6.mantine.dev/others/dropzone/?t=props
|
|
16
|
-
*/
|
|
17
|
-
export const ImageUploader = ({ width, height, defaultMsg = "이미지 업로드", file, onDrop, showClearButton, onClear, ...props }) => {
|
|
18
|
-
const [fileData, setFileData] = useState(file);
|
|
19
|
-
const handleFileDataClear = useCallback(() => {
|
|
20
|
-
setFileData(undefined);
|
|
21
|
-
if (onClear) {
|
|
22
|
-
onClear();
|
|
23
|
-
}
|
|
24
|
-
}, [onClear]);
|
|
25
|
-
return (_jsxs("div", { className: styles.image_uploader_wrapper, children: [showClearButton && fileData ? (_jsx("div", { className: styles.file_clear_button, onClick: handleFileDataClear, children: _jsx("img", { src: ic_cancel_circle, alt: "clear_file_data" }) })) : null, _jsx(Dropzone, { ...props, maxFiles: 1, className: styles.image_uploader, accept: IMAGE_MIME_TYPE, onDrop: (e) => {
|
|
26
|
-
setFileData(e[0]);
|
|
27
|
-
if (onDrop) {
|
|
28
|
-
onDrop(e);
|
|
29
|
-
}
|
|
30
|
-
}, style: {
|
|
31
|
-
width,
|
|
32
|
-
height,
|
|
33
|
-
}, children: _jsx(_Fragment, { children: fileData ? (_jsx("img", { className: styles.preview, src: typeof fileData === "string"
|
|
34
|
-
? fileData
|
|
35
|
-
: URL.createObjectURL(fileData), alt: `파일명: ${typeof fileData === "string" ? fileData : fileData.name}`, title: `파일명: ${typeof fileData === "string" ? fileData : fileData.name}` })) : (_jsxs("div", { children: [_jsx("img", { src: ic_image_colored, alt: "ic_image_colored" }), _jsx("span", { children: defaultMsg })] })) }) })] }));
|
|
36
|
-
};
|
|
37
|
-
export default ImageUploader;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Modal } from ".";
|
|
3
|
-
export default {
|
|
4
|
-
title: "Core/Modal",
|
|
5
|
-
component: Modal,
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => _jsx(Modal, { ...args });
|
|
8
|
-
export const defaultModal = Template.bind({});
|
|
9
|
-
defaultModal.args = {
|
|
10
|
-
children: "test",
|
|
11
|
-
opened: true,
|
|
12
|
-
centered: false,
|
|
13
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Modal as MantineModal, } from "@mantine/core";
|
|
3
|
-
/**
|
|
4
|
-
* ----- modal props -----
|
|
5
|
-
** size: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
6
|
-
** width: number
|
|
7
|
-
** 기타 props는 mantine modal props 사용: https://v6.mantine.dev/core/modal/?t=props
|
|
8
|
-
*/
|
|
9
|
-
export const Modal = ({ size = "md", width, withCloseButton = false, ...props }) => {
|
|
10
|
-
let sizeNumber = 768;
|
|
11
|
-
if (size === "xs") {
|
|
12
|
-
sizeNumber = 360;
|
|
13
|
-
}
|
|
14
|
-
else if (size === "sm") {
|
|
15
|
-
sizeNumber = 544;
|
|
16
|
-
}
|
|
17
|
-
else if (size === "lg") {
|
|
18
|
-
sizeNumber = 1000;
|
|
19
|
-
}
|
|
20
|
-
else if (size === "xl") {
|
|
21
|
-
sizeNumber = 1200;
|
|
22
|
-
}
|
|
23
|
-
return (_jsx(MantineModal, { size: width || sizeNumber, withCloseButton: withCloseButton, ...props }));
|
|
24
|
-
};
|
|
25
|
-
export default Modal;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Pagination } from ".";
|
|
3
|
-
export default {
|
|
4
|
-
title: "Core/Pagination",
|
|
5
|
-
component: Pagination,
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => _jsx(Pagination, { ...args });
|
|
8
|
-
export const defaultPagination = Template.bind({});
|
|
9
|
-
defaultPagination.args = {
|
|
10
|
-
currentPageIdx: 0,
|
|
11
|
-
rowsPerPage: 10,
|
|
12
|
-
totalLength: 50,
|
|
13
|
-
paginationSize: 5,
|
|
14
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState } from "react";
|
|
3
|
-
import chevron_left from "../../assets/icons/ic_chevron_left.svg";
|
|
4
|
-
import chevron_right from "../../assets/icons/ic_chevron_right.svg";
|
|
5
|
-
import style from "./style.module.scss";
|
|
6
|
-
/**
|
|
7
|
-
* ----- pagination props -----
|
|
8
|
-
** currentPageIdx: 0부터 시작, 현재 page index
|
|
9
|
-
** rowsPerPage: 한 페이지에 보이는 아이템 개수
|
|
10
|
-
** totalLength: 페이지네이션 사용할 data의 총 개수
|
|
11
|
-
** paginationSize: 페이지네이션 숫자 노출 수 default: 5 (1~5)
|
|
12
|
-
** onPageChange: (page: number) => void
|
|
13
|
-
*/
|
|
14
|
-
export const Pagination = ({ currentPageIdx, rowsPerPage, totalLength, paginationSize, onPageChange, ...props }) => {
|
|
15
|
-
const [currentIdx, setCurrentIdx] = useState(currentPageIdx);
|
|
16
|
-
const [maxPageRows, setMaxPageRows] = useState(50);
|
|
17
|
-
const [totalrows, setTotalRows] = useState(1);
|
|
18
|
-
const [paginationLength, setPaginationLength] = useState(5);
|
|
19
|
-
useMemo(() => {
|
|
20
|
-
setCurrentIdx(currentPageIdx);
|
|
21
|
-
setMaxPageRows(rowsPerPage || 50);
|
|
22
|
-
setTotalRows(totalLength || 1);
|
|
23
|
-
setPaginationLength(paginationSize || 5);
|
|
24
|
-
}, [currentPageIdx, rowsPerPage, totalLength, paginationSize]);
|
|
25
|
-
const onClickPrev = () => {
|
|
26
|
-
if (onPageChange) {
|
|
27
|
-
onPageChange(currentIdx - ((currentIdx % paginationLength) + 1));
|
|
28
|
-
}
|
|
29
|
-
setCurrentIdx((prev) => prev - ((prev % paginationLength) + 1));
|
|
30
|
-
};
|
|
31
|
-
const onClickNext = () => {
|
|
32
|
-
if (onPageChange) {
|
|
33
|
-
onPageChange(currentIdx + paginationLength - (currentIdx % paginationLength));
|
|
34
|
-
}
|
|
35
|
-
setCurrentIdx((prev) => prev + paginationLength - (prev % paginationLength));
|
|
36
|
-
};
|
|
37
|
-
return (_jsxs("div", { ...props, className: style.pagination, children: [currentIdx >= paginationLength ? (_jsx("button", { className: style.arrow, onClick: onClickPrev, children: _jsx("img", { src: chevron_left, alt: "prev" }) })) : null, new Array(paginationLength).fill(0).map((_v, index) => {
|
|
38
|
-
const indexNumber = Math.floor(currentIdx / paginationLength) * paginationLength +
|
|
39
|
-
index +
|
|
40
|
-
1;
|
|
41
|
-
if (indexNumber > Math.ceil(totalrows / maxPageRows)) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
return (_jsx("button", { className: currentIdx === indexNumber - 1
|
|
45
|
-
? style.page_index_active
|
|
46
|
-
: style.page_index, onClick: () => {
|
|
47
|
-
setCurrentIdx(indexNumber - 1);
|
|
48
|
-
if (onPageChange) {
|
|
49
|
-
onPageChange(indexNumber - 1);
|
|
50
|
-
}
|
|
51
|
-
}, children: indexNumber }, `pagination_${index}`));
|
|
52
|
-
}), Math.floor(currentIdx / paginationLength) * paginationLength +
|
|
53
|
-
paginationLength <
|
|
54
|
-
Math.ceil(totalrows / maxPageRows) ? (_jsx("button", { className: style.arrow, onClick: onClickNext, children: _jsx("img", { src: chevron_right, alt: "next" }) })) : null] }));
|
|
55
|
-
};
|
|
56
|
-
export default Pagination;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Radio } from ".";
|
|
3
|
-
export default {
|
|
4
|
-
title: "Core/Radio",
|
|
5
|
-
component: Radio,
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => _jsx(Radio, { ...args });
|
|
8
|
-
export const defaultRadio = Template.bind({});
|
|
9
|
-
defaultRadio.args = {
|
|
10
|
-
label: "radio label",
|
|
11
|
-
description: "description text",
|
|
12
|
-
size: "md",
|
|
13
|
-
disabled: false,
|
|
14
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Radio as MantineRadio, } from "@mantine/core";
|
|
3
|
-
import styles from "./styles.module.scss";
|
|
4
|
-
/**
|
|
5
|
-
* ----- radio props -----
|
|
6
|
-
** size: 'sm' | 'md' | 'lg'
|
|
7
|
-
** 기타 props는 mantine radio props 사용: https://v6.mantine.dev/core/radio/?t=props
|
|
8
|
-
*/
|
|
9
|
-
export const Radio = ({ size = "md", ...props }) => {
|
|
10
|
-
let sizeStyle = styles.md_radio;
|
|
11
|
-
if (size === "sm") {
|
|
12
|
-
sizeStyle = styles.sm_radio;
|
|
13
|
-
}
|
|
14
|
-
else if (size === "lg") {
|
|
15
|
-
sizeStyle = styles.lg_radio;
|
|
16
|
-
}
|
|
17
|
-
return _jsx(MantineRadio, { className: sizeStyle, size: size, ...props });
|
|
18
|
-
};
|
|
19
|
-
export default Radio;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { SearchBar } from ".";
|
|
3
|
-
export default {
|
|
4
|
-
title: "Core/SearchBar",
|
|
5
|
-
component: SearchBar,
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => _jsx(SearchBar, { ...args });
|
|
8
|
-
export const defaultSearchBar = Template.bind({});
|
|
9
|
-
defaultSearchBar.args = {
|
|
10
|
-
label: "label text",
|
|
11
|
-
labelPosition: "top",
|
|
12
|
-
size: "md",
|
|
13
|
-
required: false,
|
|
14
|
-
disabled: false,
|
|
15
|
-
data: ["select 1", "select 2", "select 3"],
|
|
16
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Autocomplete, Input, Tooltip } from "@mantine/core";
|
|
3
|
-
import ic_tooltip from "../../assets/icons/ic_tooltip.svg";
|
|
4
|
-
import ic_input_clear from "../../assets/icons/ic_input_clear.svg";
|
|
5
|
-
import ic_search from "../../assets/icons/ic_search.svg";
|
|
6
|
-
import styles from "./styles.module.scss";
|
|
7
|
-
import { useCallback, useState } from "react";
|
|
8
|
-
/**
|
|
9
|
-
* ----- search bar props -----
|
|
10
|
-
** label?: string, 라벨
|
|
11
|
-
** labelPosition?: "top" | "left", 라벨 위치
|
|
12
|
-
** size?: "sm" | "md" | "lg"
|
|
13
|
-
** tooltip?: string, 툴팁
|
|
14
|
-
** tooltipPosition?: "top" | "bottom" | "left" | "right", 툴팁 위치
|
|
15
|
-
** description?: string, 상세 텍스트
|
|
16
|
-
** errorMsg?: string, 에러 메시지
|
|
17
|
-
** onChange?: (event: any) => void
|
|
18
|
-
** onClear?: () => void, clear button 노출시 필요
|
|
19
|
-
** 기타 props는 mantine autocomplete props 사용: https://v6.mantine.dev/core/autocomplete/?t=props
|
|
20
|
-
*/
|
|
21
|
-
export const SearchBar = ({ label, labelPosition = "top", size = "md", required, tooltip, tooltipPosition = "top", errorMsg, description, onChange, onClear, ...props }) => {
|
|
22
|
-
const [textCount, setTextCount] = useState(0);
|
|
23
|
-
let labelStyle = styles.md_label;
|
|
24
|
-
let searchBarStyle = styles.md_textfield;
|
|
25
|
-
let tooltipStyle = styles.md_tooltip;
|
|
26
|
-
if (size === "sm") {
|
|
27
|
-
labelStyle = styles.sm_label;
|
|
28
|
-
searchBarStyle = styles.sm_textfield;
|
|
29
|
-
tooltipStyle = styles.sm_tooltip;
|
|
30
|
-
}
|
|
31
|
-
else if (size === "lg") {
|
|
32
|
-
labelStyle = styles.lg_label;
|
|
33
|
-
searchBarStyle = styles.lg_textfield;
|
|
34
|
-
tooltipStyle = styles.lg_tooltip;
|
|
35
|
-
}
|
|
36
|
-
const onChangeHandler = useCallback((value) => {
|
|
37
|
-
if (onChange) {
|
|
38
|
-
setTextCount(value?.length);
|
|
39
|
-
onChange(value);
|
|
40
|
-
}
|
|
41
|
-
}, [onChange]);
|
|
42
|
-
return (_jsxs("div", { className: labelPosition === "top"
|
|
43
|
-
? styles.top_label_textfield
|
|
44
|
-
: styles.left_label_textfield, children: [_jsxs("div", { children: [label && (_jsx(Input.Label, { required: required, className: labelStyle, children: label })), tooltip && (_jsx(Tooltip, { label: tooltip, position: tooltipPosition, children: _jsx("img", { className: tooltipStyle, src: ic_tooltip, alt: "tooltip_icon" }) }))] }), _jsxs("div", { children: [_jsx("div", { className: styles.textfield_wrapper, children: _jsx(Autocomplete, { ...props, size: size, error: errorMsg, className: searchBarStyle, onChange: onChangeHandler, icon: _jsx("img", { src: ic_search }), iconWidth: 48, rightSection: onClear && textCount > 0 ? (_jsx("div", { className: styles.clear_button, onClick: onClear, children: _jsx("img", { src: ic_input_clear }) })) : undefined }) }), description && (_jsx(Input.Description, { className: styles.input_description, children: description })), errorMsg && (_jsx(Input.Error, { className: styles.input_error_msg, children: errorMsg }))] })] }));
|
|
45
|
-
};
|
|
46
|
-
export default SearchBar;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { SegmentButton } from ".";
|
|
3
|
-
export default {
|
|
4
|
-
title: "Core/SegmentButton",
|
|
5
|
-
component: SegmentButton,
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => (_jsx(SegmentButton, { ...args }));
|
|
8
|
-
export const defaultSegmentButton = Template.bind({});
|
|
9
|
-
defaultSegmentButton.args = {
|
|
10
|
-
data: ["data1", "data2", "data3"],
|
|
11
|
-
size: "md",
|
|
12
|
-
radius: 6,
|
|
13
|
-
disabled: false,
|
|
14
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { SegmentedControl } from "@mantine/core";
|
|
3
|
-
import styles from "./styles.module.scss";
|
|
4
|
-
/**
|
|
5
|
-
* ----- segment button props -----
|
|
6
|
-
** size: 'sm' | 'md' | 'lg'
|
|
7
|
-
** radius: number | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
8
|
-
** 기타 props는 mantine segmented control props 사용: https://v6.mantine.dev/core/segmented-control/?t=props
|
|
9
|
-
*/
|
|
10
|
-
export const SegmentButton = ({ size = "md", radius = 6, ...props }) => {
|
|
11
|
-
let sizeStyle = styles.md_segment_button;
|
|
12
|
-
if (size === "sm") {
|
|
13
|
-
sizeStyle = styles.sm_segment_button;
|
|
14
|
-
}
|
|
15
|
-
else if (size === "lg") {
|
|
16
|
-
sizeStyle = styles.lg_segment_button;
|
|
17
|
-
}
|
|
18
|
-
return (_jsx(SegmentedControl, { className: sizeStyle, size: size, radius: radius, styles: {
|
|
19
|
-
control: {
|
|
20
|
-
borderWidth: "0 !important",
|
|
21
|
-
},
|
|
22
|
-
}, ...props }));
|
|
23
|
-
};
|
|
24
|
-
export default SegmentButton;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Tab } from ".";
|
|
3
|
-
export default {
|
|
4
|
-
title: "Core/Tab",
|
|
5
|
-
component: Tab,
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => _jsx(Tab, { ...args });
|
|
8
|
-
export const defaultTab = Template.bind({});
|
|
9
|
-
defaultTab.args = {
|
|
10
|
-
tabList: [
|
|
11
|
-
{
|
|
12
|
-
title: "tab title 1",
|
|
13
|
-
value: "default tab 1",
|
|
14
|
-
body: _jsx(_Fragment, { children: "default tab body 1" }),
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
title: "tab title 2",
|
|
18
|
-
value: "default tab 2",
|
|
19
|
-
body: _jsx(_Fragment, { children: "default tab body 2" }),
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
title: "tab title 3",
|
|
23
|
-
value: "default tab 3",
|
|
24
|
-
body: _jsx(_Fragment, { children: "default tab body 3" }),
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
defaultValue: "default tab 1",
|
|
28
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Tabs } from "@mantine/core";
|
|
3
|
-
import styles from "./styles.module.scss";
|
|
4
|
-
/**
|
|
5
|
-
* ----- tab props -----
|
|
6
|
-
** tabList: {
|
|
7
|
-
title: string;
|
|
8
|
-
value: string;
|
|
9
|
-
body: ReactNode;
|
|
10
|
-
icon?: ReactNode;
|
|
11
|
-
}[];
|
|
12
|
-
** containerPaddingTop?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
13
|
-
** 기타 props는 mantine tabs props 사용: https://v6.mantine.dev/core/tabs/?t=props
|
|
14
|
-
*/
|
|
15
|
-
export const Tab = ({ tabList = [], containerPaddingTop, ...props }) => {
|
|
16
|
-
return (_jsxs(Tabs, { ...props, children: [_jsx(Tabs.List, { className: styles.tab_title_list, children: tabList?.map((tab, index) => (_jsxs(Tabs.Tab, { value: tab.value, icon: tab.icon, children: [tab.title, _jsx("div", { className: styles.border_bottom })] }, `tab_${index}`))) }), tabList?.map((tab, index) => (_jsx(Tabs.Panel, { value: tab.value, pt: containerPaddingTop, children: tab.body }, `tab_panel_${index}`)))] }));
|
|
17
|
-
};
|
|
18
|
-
export default Tab;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Table } from ".";
|
|
3
|
-
export default {
|
|
4
|
-
title: "Core/Table",
|
|
5
|
-
component: Table,
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => _jsx(Table, { ...args });
|
|
8
|
-
export const defaultTable = Template.bind({});
|
|
9
|
-
defaultTable.args = {
|
|
10
|
-
headerList: ["전기", "불", "물", "풀"],
|
|
11
|
-
striped: true,
|
|
12
|
-
draggable: false,
|
|
13
|
-
tableData: [
|
|
14
|
-
{
|
|
15
|
-
electric: { cell: "피츄", sortTarget: "피츄" },
|
|
16
|
-
fire: { cell: "파이리", sortTarget: "파이리" },
|
|
17
|
-
water: { cell: "꼬부기", sortTarget: "꼬부기" },
|
|
18
|
-
leaf: { cell: "이상해씨", sortTarget: "이상해씨" },
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
electric: { cell: "피카츄", sortTarget: "피카츄" },
|
|
22
|
-
fire: { cell: "리자드", sortTarget: "리자드" },
|
|
23
|
-
water: { cell: "어니부기", sortTarget: "어니부기" },
|
|
24
|
-
leaf: { cell: "이상해풀", sortTarget: "이상해풀" },
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
electric: { cell: "라이츄", sortTarget: "라이츄" },
|
|
28
|
-
fire: { cell: "리자몽", sortTarget: "리자몽" },
|
|
29
|
-
water: { cell: "거북왕", sortTarget: "거북왕" },
|
|
30
|
-
leaf: { cell: "이상해꽃", sortTarget: "이상해꽃" },
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
electric: { cell: "찌리리공", sortTarget: "찌리리공" },
|
|
34
|
-
fire: { cell: "식스테일", sortTarget: "식스테일" },
|
|
35
|
-
water: { cell: "갸라도스", sortTarget: "갸라도스" },
|
|
36
|
-
leaf: { cell: "뚜벅초", sortTarget: "뚜벅초" },
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
};
|
|
40
|
-
export const sortableTable = Template.bind({});
|
|
41
|
-
sortableTable.args = {
|
|
42
|
-
headerList: ["전기", "불", "물", "풀", "순번", "선택(정렬테스트용)"],
|
|
43
|
-
striped: true,
|
|
44
|
-
sortable: true,
|
|
45
|
-
tableData: [
|
|
46
|
-
{
|
|
47
|
-
electric: { cell: "피츄", sortTarget: "피츄" },
|
|
48
|
-
fire: { cell: "파이리", sortTarget: "파이리" },
|
|
49
|
-
water: { cell: "꼬부기", sortTarget: "꼬부기" },
|
|
50
|
-
leaf: { cell: "이상해씨", sortTarget: "이상해씨" },
|
|
51
|
-
num: { cell: 1, sortTarget: 1 },
|
|
52
|
-
select: {
|
|
53
|
-
cell: _jsx("input", { type: "checkbox", readOnly: true, checked: true }),
|
|
54
|
-
sortTarget: true,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
electric: { cell: "피카츄", sortTarget: "피카츄" },
|
|
59
|
-
fire: { cell: "리자드", sortTarget: "리자드" },
|
|
60
|
-
water: { cell: "어니부기", sortTarget: "어니부기" },
|
|
61
|
-
leaf: { cell: "이상해풀", sortTarget: "이상해풀" },
|
|
62
|
-
num: { cell: 2, sortTarget: 2 },
|
|
63
|
-
select: {
|
|
64
|
-
cell: _jsx("input", { type: "checkbox", readOnly: true, checked: false }),
|
|
65
|
-
sortTarget: false,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
electric: { cell: "라이츄", sortTarget: "라이츄" },
|
|
70
|
-
fire: { cell: "리자몽", sortTarget: "리자몽" },
|
|
71
|
-
water: { cell: "거북왕", sortTarget: "거북왕" },
|
|
72
|
-
leaf: { cell: "이상해꽃", sortTarget: "이상해꽃" },
|
|
73
|
-
num: { cell: 3, sortTarget: 3 },
|
|
74
|
-
select: {
|
|
75
|
-
cell: _jsx("input", { type: "checkbox", readOnly: true, checked: true }),
|
|
76
|
-
sortTarget: true,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
electric: { cell: "찌리리공", sortTarget: "찌리리공" },
|
|
81
|
-
fire: { cell: "식스테일", sortTarget: "식스테일" },
|
|
82
|
-
water: { cell: "갸라도스", sortTarget: "갸라도스" },
|
|
83
|
-
leaf: { cell: "뚜벅초", sortTarget: "뚜벅초" },
|
|
84
|
-
num: { cell: 4, sortTarget: 4 },
|
|
85
|
-
select: {
|
|
86
|
-
cell: _jsx("input", { type: "checkbox", readOnly: true, checked: false }),
|
|
87
|
-
sortTarget: false,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
};
|
|
92
|
-
export const draggableTable = Template.bind({});
|
|
93
|
-
draggableTable.args = {
|
|
94
|
-
headerList: ["전기", "불", "물", "풀"],
|
|
95
|
-
striped: true,
|
|
96
|
-
sortable: false,
|
|
97
|
-
draggable: true,
|
|
98
|
-
onDragEnd: (rows) => {
|
|
99
|
-
console.log(rows);
|
|
100
|
-
},
|
|
101
|
-
tableData: [
|
|
102
|
-
{
|
|
103
|
-
electric: { cell: "피츄", sortTarget: "피츄", dndId: 0 },
|
|
104
|
-
fire: { cell: "파이리", sortTarget: "파이리" },
|
|
105
|
-
water: { cell: "꼬부기", sortTarget: "꼬부기" },
|
|
106
|
-
leaf: { cell: "이상해씨", sortTarget: "이상해씨" },
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
electric: { cell: "피카츄", sortTarget: "피카츄", dndId: 1 },
|
|
110
|
-
fire: { cell: "리자드", sortTarget: "리자드" },
|
|
111
|
-
water: { cell: "어니부기", sortTarget: "어니부기" },
|
|
112
|
-
leaf: { cell: "이상해풀", sortTarget: "이상해풀" },
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
electric: { cell: "라이츄", sortTarget: "라이츄", dndId: 2 },
|
|
116
|
-
fire: { cell: "리자몽", sortTarget: "리자몽" },
|
|
117
|
-
water: { cell: "거북왕", sortTarget: "거북왕" },
|
|
118
|
-
leaf: { cell: "이상해꽃", sortTarget: "이상해꽃" },
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
electric: { cell: "찌리리공", sortTarget: "찌리리공", dndId: 3 },
|
|
122
|
-
fire: { cell: "식스테일", sortTarget: "식스테일" },
|
|
123
|
-
water: { cell: "갸라도스", sortTarget: "갸라도스" },
|
|
124
|
-
leaf: { cell: "뚜벅초", sortTarget: "뚜벅초" },
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
};
|