@weing-dev/ui-kit-primitive 0.0.0
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 +50 -0
- package/eslint.config.js +29 -0
- package/index.html +13 -0
- package/package.json +75 -0
- package/public/static/icon/Add.svg +1 -0
- package/public/static/icon/ApprovalInactive.svg +1 -0
- package/public/static/icon/ArrowRight.svg +5 -0
- package/public/static/icon/Cancle Filled.svg +1 -0
- package/public/static/icon/Cancle.svg +1 -0
- package/public/static/icon/Cart Filled.svg +1 -0
- package/public/static/icon/Cart.svg +1 -0
- package/public/static/icon/Check.svg +1 -0
- package/public/static/icon/CheckBoxRound.svg +3 -0
- package/public/static/icon/Company.svg +1 -0
- package/public/static/icon/DragHandle.svg +1 -0
- package/public/static/icon/Eco.svg +1 -0
- package/public/static/icon/EditSquare.svg +1 -0
- package/public/static/icon/Error Filled.svg +1 -0
- package/public/static/icon/Error.svg +1 -0
- package/public/static/icon/File Upload.svg +1 -0
- package/public/static/icon/FilecheckInactive.svg +1 -0
- package/public/static/icon/Go Before.svg +1 -0
- package/public/static/icon/Go Next.svg +1 -0
- package/public/static/icon/Hamburger Menu.svg +1 -0
- package/public/static/icon/ImagecheckPlay.svg +4 -0
- package/public/static/icon/Kakao Talk.svg +1 -0
- package/public/static/icon/Minus.svg +1 -0
- package/public/static/icon/Naver Blog.svg +1 -0
- package/public/static/icon/Naver.svg +1 -0
- package/public/static/icon/OrderApprove.svg +1 -0
- package/public/static/icon/OrderInactive.svg +1 -0
- package/public/static/icon/OrderPlay.svg +1 -0
- package/public/static/icon/PayApprove.svg +1 -0
- package/public/static/icon/PayInactive.svg +1 -0
- package/public/static/icon/PrintInactive.svg +1 -0
- package/public/static/icon/PrintPlay.svg +1 -0
- package/public/static/icon/Search.svg +1 -0
- package/public/static/icon/ShippingDone.svg +1 -0
- package/public/static/icon/Support Agent.svg +1 -0
- package/public/static/icon/Task.svg +1 -0
- package/public/static/icon/User.svg +1 -0
- package/public/static/icon/Warning Filled.svg +1 -0
- package/public/static/icon/Warning.svg +1 -0
- package/public/static/icon/add_a_photo.svg +3 -0
- package/public/static/icon/attach_file.svg +1 -0
- package/public/static/icon/check_circle.svg +1 -0
- package/public/static/icon/close.svg +1 -0
- package/public/static/icon/download.svg +1 -0
- package/public/static/icon/expand all.svg +1 -0
- package/public/static/icon/expand_less.svg +1 -0
- package/public/static/icon/expand_more.svg +1 -0
- package/public/static/icon/factory.svg +1 -0
- package/public/static/icon/inventory.svg +1 -0
- package/public/static/icon/listAll.svg +1 -0
- package/public/static/icon/local_shipping.svg +1 -0
- package/public/static/icon/logout.svg +1 -0
- package/public/static/icon/menu.svg +1 -0
- package/public/static/icon/mode_edit.svg +4 -0
- package/public/static/icon/more.svg +1 -0
- package/public/static/icon/outward.svg +1 -0
- package/public/static/icon/personcard.svg +1 -0
- package/public/static/icon/product.svg +1 -0
- package/public/static/icon/settings.svg +1 -0
- package/public/static/icon/swap_vert.svg +3 -0
- package/public/static/icon/upload.svg +1 -0
- package/public/static/icon/warning_amber.svg +3 -0
- package/public/static/image/Thumbnail.png +0 -0
- package/public/vite.svg +1 -0
- package/public/weing_logo_final.png +0 -0
- package/scripts/icons/setIcon.cjs +151 -0
- package/scripts/icons/svg-template.cjs +18 -0
- package/scripts/icons/svgo-config.json +9 -0
- package/scripts/icons/svgr-config.json +16 -0
- package/src/@types/color.d.ts +51 -0
- package/src/@types/common.d.ts +6 -0
- package/src/@types/extends/react.extends.d.ts +7 -0
- package/src/@types/quill-image-resize-module-react/index.d.ts +1 -0
- package/src/App.css +0 -0
- package/src/App.tsx +84 -0
- package/src/assets/react.svg +1 -0
- package/src/components/Accordion/Accordion.context.tsx +62 -0
- package/src/components/Accordion/Accordion.module.scss +163 -0
- package/src/components/Accordion/Accordion.tsx +242 -0
- package/src/components/Accordion/README.md +408 -0
- package/src/components/Accordion/images/as_trigger.gif +0 -0
- package/src/components/Accordion/images/closed.png +0 -0
- package/src/components/Accordion/images/open.png +0 -0
- package/src/components/Accordion/images/thumbnail1.png +0 -0
- package/src/components/Accordion/images/thumbnail2.png +0 -0
- package/src/components/Accordion/images/thumbnail3.png +0 -0
- package/src/components/Avatar/Avatar.module.scss +47 -0
- package/src/components/Avatar/Avatar.tsx +230 -0
- package/src/components/Avatar/README.md +333 -0
- package/src/components/Badge/Badge.module.scss +49 -0
- package/src/components/Badge/Badge.tsx +87 -0
- package/src/components/Badge/README.md +223 -0
- package/src/components/BarCode/BarCode.module.scss +0 -0
- package/src/components/BarCode/BarCode.tsx +153 -0
- package/src/components/Breadcrumb/Breadcrumb.module.scss +36 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +114 -0
- package/src/components/Breadcrumb/README.md +339 -0
- package/src/components/Button/Button.colors.tsx +322 -0
- package/src/components/Button/Button.context.tsx +47 -0
- package/src/components/Button/Button.module.scss +156 -0
- package/src/components/Button/Button.tsx +190 -0
- package/src/components/Button/Button.type.ts +11 -0
- package/src/components/Calendar/Calendar.context.tsx +138 -0
- package/src/components/Calendar/Calendar.module.scss +116 -0
- package/src/components/Calendar/Calendar.tsx +440 -0
- package/src/components/Calendar/dayjs.util.ts +312 -0
- package/src/components/Cascader/Cacader.data.ts +1185 -0
- package/src/components/Cascader/Cascader.context.tsx +61 -0
- package/src/components/Cascader/Cascader.hook.ts +502 -0
- package/src/components/Cascader/Cascader.module.scss +143 -0
- package/src/components/Cascader/Cascader.tsx +281 -0
- package/src/components/Cascader/README.md +735 -0
- package/src/components/Chart/Chart.module.scss +0 -0
- package/src/components/Chart/Chart.tsx +230 -0
- package/src/components/Chart/README.md +85 -0
- package/src/components/Chart/images/barChart.png +0 -0
- package/src/components/Chips/Chips.colors.tsx +185 -0
- package/src/components/Chips/Chips.module.scss +49 -0
- package/src/components/Chips/Chips.tsx +78 -0
- package/src/components/Comment/Comment.module.scss +14 -0
- package/src/components/Comment/Comment.tsx +105 -0
- package/src/components/Dialog/Dialog.module.scss +0 -0
- package/src/components/Dialog/Dialog.tsx +12 -0
- package/src/components/Divider/Divider.module.scss +12 -0
- package/src/components/Divider/Divider.tsx +33 -0
- package/src/components/Editor/Editor.context.tsx +12 -0
- package/src/components/Editor/Editor.module.scss +40 -0
- package/src/components/Editor/Editor.tsx +174 -0
- package/src/components/Form/CheckBox/CheckBox.context.tsx +56 -0
- package/src/components/Form/CheckBox/CheckBox.module.scss +81 -0
- package/src/components/Form/CheckBox/CheckBox.tsx +196 -0
- package/src/components/Form/CheckBox/Checkbox.colors.tsx +42 -0
- package/src/components/Form/Dropdown/Dropdown.colors.tsx +125 -0
- package/src/components/Form/Dropdown/Dropdown.context.tsx +62 -0
- package/src/components/Form/Dropdown/Dropdown.module.scss +133 -0
- package/src/components/Form/Dropdown/Dropdown.tsx +404 -0
- package/src/components/Form/OTPInput/OTPInput.context.tsx +104 -0
- package/src/components/Form/OTPInput/OTPInput.module.scss +22 -0
- package/src/components/Form/OTPInput/OTPInput.tsx +67 -0
- package/src/components/Form/Radio/Radio.colors.tsx +42 -0
- package/src/components/Form/Radio/Radio.context.tsx +40 -0
- package/src/components/Form/Radio/Radio.module.scss +61 -0
- package/src/components/Form/Radio/Radio.tsx +174 -0
- package/src/components/Form/Switch/Switch.colors.tsx +42 -0
- package/src/components/Form/Switch/Switch.context.tsx +50 -0
- package/src/components/Form/Switch/Switch.module.scss +53 -0
- package/src/components/Form/Switch/Switch.tsx +151 -0
- package/src/components/Form/TextArea/TextArea.colors.tsx +76 -0
- package/src/components/Form/TextArea/TextArea.context.tsx +97 -0
- package/src/components/Form/TextArea/TextArea.module.scss +138 -0
- package/src/components/Form/TextArea/TextArea.tsx +246 -0
- package/src/components/Form/TextInput/TextInput.colors.tsx +76 -0
- package/src/components/Form/TextInput/TextInput.context.tsx +106 -0
- package/src/components/Form/TextInput/TextInput.module.scss +160 -0
- package/src/components/Form/TextInput/TextInput.tsx +225 -0
- package/src/components/GlobalStyle/GlobalStyle.tsx +20 -0
- package/src/components/HelperText/HelperText.module.scss +28 -0
- package/src/components/HelperText/HelperText.tsx +130 -0
- package/src/components/Icon/Icon.tsx +29 -0
- package/src/components/Icons/Add.tsx +20 -0
- package/src/components/Icons/AddAPhoto.tsx +21 -0
- package/src/components/Icons/ApprovalInactive.tsx +26 -0
- package/src/components/Icons/ArrowRight.tsx +24 -0
- package/src/components/Icons/AttachFile.tsx +20 -0
- package/src/components/Icons/Cancle.tsx +20 -0
- package/src/components/Icons/CancleFilled.tsx +20 -0
- package/src/components/Icons/Cart.tsx +20 -0
- package/src/components/Icons/CartFilled.tsx +20 -0
- package/src/components/Icons/Check.tsx +20 -0
- package/src/components/Icons/CheckBoxRound.tsx +21 -0
- package/src/components/Icons/CheckCircle.tsx +35 -0
- package/src/components/Icons/Close.tsx +20 -0
- package/src/components/Icons/Company.tsx +20 -0
- package/src/components/Icons/Download.tsx +20 -0
- package/src/components/Icons/DragHandle.tsx +20 -0
- package/src/components/Icons/Eco.tsx +20 -0
- package/src/components/Icons/EditSquare.tsx +20 -0
- package/src/components/Icons/Error.tsx +20 -0
- package/src/components/Icons/ErrorFilled.tsx +20 -0
- package/src/components/Icons/ExpandAll.tsx +20 -0
- package/src/components/Icons/ExpandLess.tsx +20 -0
- package/src/components/Icons/ExpandMore.tsx +20 -0
- package/src/components/Icons/Factory.tsx +20 -0
- package/src/components/Icons/FileUpload.tsx +20 -0
- package/src/components/Icons/FilecheckInactive.tsx +22 -0
- package/src/components/Icons/GoBefore.tsx +20 -0
- package/src/components/Icons/GoNext.tsx +20 -0
- package/src/components/Icons/HamburgerMenu.tsx +20 -0
- package/src/components/Icons/ImagecheckPlay.tsx +27 -0
- package/src/components/Icons/Inventory.tsx +20 -0
- package/src/components/Icons/KakaoTalk.tsx +22 -0
- package/src/components/Icons/ListAll.tsx +20 -0
- package/src/components/Icons/LocalShipping.tsx +20 -0
- package/src/components/Icons/Logout.tsx +20 -0
- package/src/components/Icons/Menu.tsx +20 -0
- package/src/components/Icons/Minus.tsx +18 -0
- package/src/components/Icons/ModeEdit.tsx +25 -0
- package/src/components/Icons/More.tsx +20 -0
- package/src/components/Icons/Naver.tsx +20 -0
- package/src/components/Icons/NaverBlog.tsx +22 -0
- package/src/components/Icons/OrderApprove.tsx +20 -0
- package/src/components/Icons/OrderInactive.tsx +20 -0
- package/src/components/Icons/OrderPlay.tsx +20 -0
- package/src/components/Icons/Outward.tsx +20 -0
- package/src/components/Icons/PayApprove.tsx +24 -0
- package/src/components/Icons/PayInactive.tsx +24 -0
- package/src/components/Icons/Personcard.tsx +20 -0
- package/src/components/Icons/PrintInactive.tsx +24 -0
- package/src/components/Icons/PrintPlay.tsx +24 -0
- package/src/components/Icons/Product.tsx +20 -0
- package/src/components/Icons/Search.tsx +20 -0
- package/src/components/Icons/Settings.tsx +20 -0
- package/src/components/Icons/ShippingDone.tsx +20 -0
- package/src/components/Icons/SupportAgent.tsx +20 -0
- package/src/components/Icons/SwapVert.tsx +21 -0
- package/src/components/Icons/Task.tsx +20 -0
- package/src/components/Icons/Upload.tsx +20 -0
- package/src/components/Icons/User.tsx +20 -0
- package/src/components/Icons/Warning.tsx +20 -0
- package/src/components/Icons/WarningAmber.tsx +21 -0
- package/src/components/Icons/WarningFilled.tsx +20 -0
- package/src/components/Icons/index.ts +62 -0
- package/src/components/LNB/LNB.context.tsx +32 -0
- package/src/components/LNB/LNB.module.scss +99 -0
- package/src/components/LNB/LNB.tsx +190 -0
- package/src/components/LNB/README.md +411 -0
- package/src/components/LNB/makeNavigation.ts +51 -0
- package/src/components/LNB/navigation.d.ts +15 -0
- package/src/components/LNB/navigation.json +211 -0
- package/src/components/Label/Label.colors.tsx +241 -0
- package/src/components/Label/Label.module.scss +31 -0
- package/src/components/Label/Label.tsx +54 -0
- package/src/components/LazyImage/LazyImage.module.scss +6 -0
- package/src/components/LazyImage/LazyImage.tsx +107 -0
- package/src/components/List/List.module.scss +81 -0
- package/src/components/List/List.tsx +91 -0
- package/src/components/List/README.md +87 -0
- package/src/components/MobilePicker/MobilePicker.context.tsx +22 -0
- package/src/components/MobilePicker/MobilePicker.module.scss +57 -0
- package/src/components/MobilePicker/MobilePicker.tsx +336 -0
- package/src/components/MobilePicker/README.md +159 -0
- package/src/components/Modal/Modal.tsx +77 -0
- package/src/components/Modal/README.md +130 -0
- package/src/components/Pagination/Pagination.colors.tsx +85 -0
- package/src/components/Pagination/Pagination.context.tsx +28 -0
- package/src/components/Pagination/Pagination.module.scss +60 -0
- package/src/components/Pagination/Pagination.tsx +234 -0
- package/src/components/Popup/Popup.context.tsx +15 -0
- package/src/components/Popup/Popup.module.scss +53 -0
- package/src/components/Popup/Popup.tsx +116 -0
- package/src/components/Popup/README.md +170 -0
- package/src/components/QRCode/QRCode.module.scss +2 -0
- package/src/components/QRCode/QRCode.tsx +61 -0
- package/src/components/ScrollCalendar/ScrollCalendar.context.tsx +26 -0
- package/src/components/ScrollCalendar/ScrollCalendar.module.scss +42 -0
- package/src/components/ScrollCalendar/ScrollCalendar.tsx +448 -0
- package/src/components/ScrollSpy/README.md +62 -0
- package/src/components/ScrollSpy/ScrollSpy.tsx +130 -0
- package/src/components/Sheet/README.md +92 -0
- package/src/components/Sheet/Sheet.context.tsx +23 -0
- package/src/components/Sheet/Sheet.module.scss +68 -0
- package/src/components/Sheet/Sheet.tsx +146 -0
- package/src/components/Slider/README.md +639 -0
- package/src/components/Slider/Slider.backup.tsx +477 -0
- package/src/components/Slider/Slider.context.tsx +67 -0
- package/src/components/Slider/Slider.module.scss +123 -0
- package/src/components/Slider/Slider.tsx +467 -0
- package/src/components/Stepper/README.md +320 -0
- package/src/components/Stepper/Stepper.context.tsx +49 -0
- package/src/components/Stepper/Stepper.module.scss +163 -0
- package/src/components/Stepper/Stepper.tsx +219 -0
- package/src/components/Tab/Tab.colors.tsx +54 -0
- package/src/components/Tab/Tab.context.tsx +64 -0
- package/src/components/Tab/Tab.module.scss +239 -0
- package/src/components/Tab/Tab.tsx +123 -0
- package/src/components/Tab/cx.ts +6 -0
- package/src/components/Table/README.md +162 -0
- package/src/components/Table/Table.context.tsx +23 -0
- package/src/components/Table/Table.hook.ts +51 -0
- package/src/components/Table/Table.module.scss +83 -0
- package/src/components/Table/Table.tsx +147 -0
- package/src/components/Thumbnail/README.md +302 -0
- package/src/components/Thumbnail/Thumbnail.context.tsx +42 -0
- package/src/components/Thumbnail/Thumbnail.module.scss +149 -0
- package/src/components/Thumbnail/Thumbnail.tsx +391 -0
- package/src/components/TimeInput/README.md +118 -0
- package/src/components/TimeInput/TimeInput.colors.tsx +76 -0
- package/src/components/TimeInput/TimeInput.context.tsx +58 -0
- package/src/components/TimeInput/TimeInput.module.scss +211 -0
- package/src/components/TimeInput/TimeInput.tsx +411 -0
- package/src/components/WeeklyCalendar/WeeklyCalendar.context.tsx +88 -0
- package/src/components/WeeklyCalendar/WeeklyCalendar.module.scss +225 -0
- package/src/components/WeeklyCalendar/WeeklyCalendar.tsx +772 -0
- package/src/components/WeeklyCalendar/dayjs.util.ts +336 -0
- package/src/components/WeeklyCalendar/weeklyCalendar.util.ts +583 -0
- package/src/components/WisywygEditor/Quill/Editor.tsx +148 -0
- package/src/constant/locale.constant.ts +6 -0
- package/src/globals.scss +80 -0
- package/src/hooks/useColorScheme.tsx +48 -0
- package/src/hooks/useElementRect.tsx +128 -0
- package/src/hooks/useIntersectionObserver.tsx +33 -0
- package/src/index.css +17 -0
- package/src/index.ts +187 -0
- package/src/main.tsx +10 -0
- package/src/styles/_fontSize.mixin.scss +57 -0
- package/src/styles/_fontWeight.mixin.scss +15 -0
- package/src/styles/_lineHeight.mixin.scss +57 -0
- package/src/styles/_scrollbar.mixin.scss +49 -0
- package/src/styles/baseColor.ts +297 -0
- package/src/styles/color.ts +272 -0
- package/src/styles/color2.ts +200 -0
- package/src/styles/scrollbar.README.md +72 -0
- package/src/styles/typography.scss +170 -0
- package/src/utils/aws.util.ts +180 -0
- package/src/utils/common.utill.ts +45 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.app.json +24 -0
- package/tsconfig.json +29 -0
- package/tsconfig.node.json +10 -0
- package/tsconfig.node.tsbuildinfo +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.d.ts +2 -0
- package/vite.config.js +47 -0
- package/vite.config.ts +50 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactQuill, { Quill } from "react-quill-new";
|
|
3
|
+
import "react-quill-new/dist/quill.snow.css";
|
|
4
|
+
import ImageResize from "quill-image-resize-module-react";
|
|
5
|
+
import { v1 as uuid } from "uuid";
|
|
6
|
+
import { AWSUtil } from "@/utils/aws.util";
|
|
7
|
+
|
|
8
|
+
Quill.register("modules/imageResize", ImageResize);
|
|
9
|
+
|
|
10
|
+
type QuillEditorProps = {
|
|
11
|
+
onChange?: (content: string) => void;
|
|
12
|
+
value?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
awsConfig?: {
|
|
15
|
+
region: string;
|
|
16
|
+
accessKeyId: string;
|
|
17
|
+
secretAccessKey: string;
|
|
18
|
+
bucketName: string;
|
|
19
|
+
secretId?: string;
|
|
20
|
+
filePrefix?: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const quillFormats = [
|
|
25
|
+
"font",
|
|
26
|
+
"size",
|
|
27
|
+
"bold",
|
|
28
|
+
"italic",
|
|
29
|
+
"underline",
|
|
30
|
+
"strike",
|
|
31
|
+
"color",
|
|
32
|
+
"background",
|
|
33
|
+
"script",
|
|
34
|
+
"header",
|
|
35
|
+
"blockquote",
|
|
36
|
+
"code-block",
|
|
37
|
+
"indent",
|
|
38
|
+
"list",
|
|
39
|
+
"direction",
|
|
40
|
+
"align",
|
|
41
|
+
"link",
|
|
42
|
+
"image",
|
|
43
|
+
"video",
|
|
44
|
+
"formula",
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const QuillEditor = (props: QuillEditorProps) => {
|
|
48
|
+
const { onChange, value, name } = props;
|
|
49
|
+
|
|
50
|
+
const handleEditorChange = React.useCallback(
|
|
51
|
+
(content: string) => {
|
|
52
|
+
onChange?.(content);
|
|
53
|
+
},
|
|
54
|
+
[onChange]
|
|
55
|
+
);
|
|
56
|
+
const _editor = React.useRef<ReactQuill>(null);
|
|
57
|
+
|
|
58
|
+
const isConfig = !!props.awsConfig;
|
|
59
|
+
|
|
60
|
+
const uploadUtil = React.useMemo(() => {
|
|
61
|
+
return new AWSUtil({
|
|
62
|
+
region: import.meta.env.NEXT_PUBLIC_AWS_REGION_NAME || "",
|
|
63
|
+
accessKeyId: import.meta.env.NEXT_PUBLIC_AWS_ACCESS_KEY_ID || "",
|
|
64
|
+
secretAccessKey: import.meta.env.NEXT_PUBLIC_AWS_SECRET_ACCESS_KEY || "",
|
|
65
|
+
bucketName: import.meta.env.NEXT_PUBLIC_AWS_BUCKET_NAME || "",
|
|
66
|
+
secretId: import.meta.env.NEXT_PUBLIC_AWS_SECRET_ID,
|
|
67
|
+
});
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
const imageHandler = () => {
|
|
71
|
+
const input = document.createElement("input");
|
|
72
|
+
|
|
73
|
+
input.setAttribute("type", "file");
|
|
74
|
+
input.setAttribute("accept", "image/*");
|
|
75
|
+
input.click();
|
|
76
|
+
|
|
77
|
+
input.onchange = async () => {
|
|
78
|
+
for (const file of Array.from(input?.files || [])) {
|
|
79
|
+
const fileItem: FileItem = {
|
|
80
|
+
uri: URL.createObjectURL(file),
|
|
81
|
+
name: file.name,
|
|
82
|
+
file,
|
|
83
|
+
id: uuid(),
|
|
84
|
+
} as const;
|
|
85
|
+
|
|
86
|
+
if (/^image\//.test(file.type)) {
|
|
87
|
+
const editor = _editor.current?.getEditor();
|
|
88
|
+
const selection = editor?.getSelection();
|
|
89
|
+
const cursorPosition = selection?.index ?? 0;
|
|
90
|
+
|
|
91
|
+
const fileURL = await uploadUtil.handleUpload(fileItem, "editor");
|
|
92
|
+
|
|
93
|
+
const reader = new FileReader();
|
|
94
|
+
reader.readAsDataURL(file);
|
|
95
|
+
|
|
96
|
+
reader.onload = () => {
|
|
97
|
+
editor?.insertEmbed(
|
|
98
|
+
cursorPosition,
|
|
99
|
+
"image",
|
|
100
|
+
isConfig ? fileURL : (reader.result as string)
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
} else {
|
|
104
|
+
alert("You could only upload images.");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const modules = React.useMemo(() => {
|
|
111
|
+
return {
|
|
112
|
+
toolbar: {
|
|
113
|
+
container: [
|
|
114
|
+
[{ header: [1, 2, 3, false] }],
|
|
115
|
+
["bold", "italic", "underline", "strike", "blockquote"],
|
|
116
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
117
|
+
["link", "image", "video"],
|
|
118
|
+
[{ align: [false, "center", "right", "justify"] }],
|
|
119
|
+
[{ color: [] }],
|
|
120
|
+
["code-block"],
|
|
121
|
+
["clean"],
|
|
122
|
+
],
|
|
123
|
+
handlers: {
|
|
124
|
+
image: imageHandler,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
imageResize: {
|
|
128
|
+
parchment: Quill.import("parchment"),
|
|
129
|
+
modules: ["Resize", "DisplaySize", "Toolbar"],
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}, []);
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<ReactQuill
|
|
136
|
+
theme={"snow"}
|
|
137
|
+
style={{ height: 350, margin: 4 }}
|
|
138
|
+
onChange={handleEditorChange}
|
|
139
|
+
value={value}
|
|
140
|
+
ref={_editor}
|
|
141
|
+
formats={quillFormats}
|
|
142
|
+
modules={modules}
|
|
143
|
+
id={name}
|
|
144
|
+
/>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export default QuillEditor;
|
package/src/globals.scss
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
@layer Global {
|
|
2
|
+
html,
|
|
3
|
+
body {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
body {
|
|
9
|
+
background-color: var(--backgroundDefault, #fff);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
* {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
padding: 0;
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
button,
|
|
19
|
+
[role="button"] {
|
|
20
|
+
outline: none;
|
|
21
|
+
border: none;
|
|
22
|
+
background: none;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ul,
|
|
27
|
+
li {
|
|
28
|
+
list-style: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
a {
|
|
32
|
+
color: inherit;
|
|
33
|
+
text-decoration: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input {
|
|
37
|
+
outline: none;
|
|
38
|
+
background-color: transparent;
|
|
39
|
+
border: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
input::-ms-clear,
|
|
43
|
+
input::-ms-reveal {
|
|
44
|
+
opacity: 0;
|
|
45
|
+
}
|
|
46
|
+
/* chrome */
|
|
47
|
+
input::-webkit-search-decoration,
|
|
48
|
+
input::-webkit-search-cancel-button,
|
|
49
|
+
input::-webkit-search-results-button,
|
|
50
|
+
input::-webkit-search-results-decoration {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.button-desc {
|
|
55
|
+
text-indent: -9999px;
|
|
56
|
+
font-size: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Chrome, Safari, Edge, Opera */
|
|
60
|
+
input::-webkit-outer-spin-button,
|
|
61
|
+
input::-webkit-inner-spin-button {
|
|
62
|
+
-webkit-appearance: none;
|
|
63
|
+
margin: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Firefox */
|
|
67
|
+
input[type="number"] {
|
|
68
|
+
-moz-appearance: textfield;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
em {
|
|
72
|
+
font-style: normal;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// @media (prefers-color-scheme: dark) {
|
|
76
|
+
// html {
|
|
77
|
+
// color-scheme: dark;
|
|
78
|
+
// }
|
|
79
|
+
// }
|
|
80
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { variableLight } from "../styles/color";
|
|
4
|
+
|
|
5
|
+
const grayScaleColorGroupNames = [
|
|
6
|
+
"gray",
|
|
7
|
+
"steelBlue",
|
|
8
|
+
"beige",
|
|
9
|
+
"royalOrange",
|
|
10
|
+
"lubyRed",
|
|
11
|
+
"cyan",
|
|
12
|
+
"mint",
|
|
13
|
+
"mustardYellow",
|
|
14
|
+
"red",
|
|
15
|
+
"green",
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
type ColorScheme = (typeof grayScaleColorGroupNames)[number];
|
|
19
|
+
|
|
20
|
+
export default function useColorScheme(colorScheme?: string) {
|
|
21
|
+
const scheme = colorScheme as ColorScheme;
|
|
22
|
+
|
|
23
|
+
const palleteSet = React.useMemo(() => {
|
|
24
|
+
const colorSet = variableLight[scheme];
|
|
25
|
+
|
|
26
|
+
switch (scheme) {
|
|
27
|
+
case "gray":
|
|
28
|
+
case "lubyRed":
|
|
29
|
+
case "beige":
|
|
30
|
+
case "steelBlue":
|
|
31
|
+
case "royalOrange":
|
|
32
|
+
case "cyan":
|
|
33
|
+
case "mint":
|
|
34
|
+
case "mustardYellow":
|
|
35
|
+
case "red":
|
|
36
|
+
case "green":
|
|
37
|
+
return {
|
|
38
|
+
backgroundColor: colorSet[`${scheme}50` as keyof typeof colorSet],
|
|
39
|
+
tintColor: "#fff",
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
default:
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
}, [scheme]);
|
|
46
|
+
|
|
47
|
+
return palleteSet;
|
|
48
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
interface ElementPosition {
|
|
4
|
+
// 절대 위치 (viewport 기준)
|
|
5
|
+
absolute: {
|
|
6
|
+
top: number;
|
|
7
|
+
left: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
right: number;
|
|
10
|
+
};
|
|
11
|
+
// 상대 위치 (부모 요소 기준)
|
|
12
|
+
relative: {
|
|
13
|
+
top: number;
|
|
14
|
+
left: number;
|
|
15
|
+
bottom: number;
|
|
16
|
+
right: number;
|
|
17
|
+
};
|
|
18
|
+
// 요소의 크기
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function useElementRect(elementRef: React.RefObject<HTMLElement | null>) {
|
|
24
|
+
const [position, setPosition] = React.useState<ElementPosition>({
|
|
25
|
+
absolute: { top: 0, left: 0, bottom: 0, right: 0 },
|
|
26
|
+
relative: { top: 0, left: 0, bottom: 0, right: 0 },
|
|
27
|
+
width: 0,
|
|
28
|
+
height: 0,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const observerRef = React.useRef<ResizeObserver>(null);
|
|
32
|
+
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
const element = elementRef.current;
|
|
35
|
+
if (!element) return;
|
|
36
|
+
|
|
37
|
+
// 부모 요소 찾기 함수 추가
|
|
38
|
+
const getScrollableParent = (node: HTMLElement): HTMLElement | null => {
|
|
39
|
+
const regex = /(auto|scroll)/;
|
|
40
|
+
const style = (el: Element) => window.getComputedStyle(el);
|
|
41
|
+
|
|
42
|
+
const isScrollable = (el: Element) =>
|
|
43
|
+
regex.test(
|
|
44
|
+
style(el).overflow + style(el).overflowY + style(el).overflowX
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
let parent = node.parentElement;
|
|
48
|
+
while (parent) {
|
|
49
|
+
if (isScrollable(parent)) return parent;
|
|
50
|
+
parent = parent.parentElement;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const updatePosition = () => {
|
|
56
|
+
// 절대 위치 계산 (viewport 기준)
|
|
57
|
+
const absoluteRect = element.getBoundingClientRect();
|
|
58
|
+
|
|
59
|
+
// 상대 위치 계산 (부모 요소 기준)
|
|
60
|
+
const parentElement = element.offsetParent || element.parentElement;
|
|
61
|
+
const parentRect = parentElement?.getBoundingClientRect() || {
|
|
62
|
+
top: 0,
|
|
63
|
+
left: 0,
|
|
64
|
+
bottom: 0,
|
|
65
|
+
right: 0,
|
|
66
|
+
width: 0,
|
|
67
|
+
height: 0,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// 스크롤 위치 고려
|
|
71
|
+
const scrollableParent = getScrollableParent(element);
|
|
72
|
+
const parentScrollTop = scrollableParent?.scrollTop || 0;
|
|
73
|
+
const parentScrollLeft = scrollableParent?.scrollLeft || 0;
|
|
74
|
+
|
|
75
|
+
setPosition({
|
|
76
|
+
absolute: {
|
|
77
|
+
top: absoluteRect.top + window.scrollY,
|
|
78
|
+
left: absoluteRect.left + window.scrollX,
|
|
79
|
+
bottom: absoluteRect.bottom + window.scrollY,
|
|
80
|
+
right: absoluteRect.right + window.scrollX,
|
|
81
|
+
},
|
|
82
|
+
relative: {
|
|
83
|
+
top: element.offsetTop - parentScrollTop,
|
|
84
|
+
left: element.offsetLeft - parentScrollLeft,
|
|
85
|
+
bottom:
|
|
86
|
+
parentRect.height -
|
|
87
|
+
(element.offsetTop + element.offsetHeight - parentScrollTop),
|
|
88
|
+
right:
|
|
89
|
+
parentRect.width -
|
|
90
|
+
(element.offsetLeft + element.offsetWidth - parentScrollLeft),
|
|
91
|
+
},
|
|
92
|
+
width: absoluteRect.width,
|
|
93
|
+
height: absoluteRect.height,
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
observerRef.current = new ResizeObserver(updatePosition);
|
|
98
|
+
observerRef.current.observe(element);
|
|
99
|
+
|
|
100
|
+
// 스크롤 가능한 부모 요소 찾기
|
|
101
|
+
const scrollableParent = getScrollableParent(element);
|
|
102
|
+
|
|
103
|
+
// 스크롤이나 리사이즈 시에도 위치 업데이트
|
|
104
|
+
window.addEventListener("scroll", updatePosition);
|
|
105
|
+
window.addEventListener("resize", updatePosition);
|
|
106
|
+
if (scrollableParent) {
|
|
107
|
+
scrollableParent.addEventListener("scroll", updatePosition);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 초기 위치 설정
|
|
111
|
+
updatePosition();
|
|
112
|
+
|
|
113
|
+
return () => {
|
|
114
|
+
if (observerRef.current) {
|
|
115
|
+
observerRef.current.disconnect();
|
|
116
|
+
}
|
|
117
|
+
window.removeEventListener("scroll", updatePosition);
|
|
118
|
+
window.removeEventListener("resize", updatePosition);
|
|
119
|
+
if (scrollableParent) {
|
|
120
|
+
scrollableParent.removeEventListener("scroll", updatePosition);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}, [elementRef]);
|
|
124
|
+
|
|
125
|
+
return position;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export default useElementRect;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { RefObject } from "react";
|
|
2
|
+
|
|
3
|
+
type Elem = Element | null;
|
|
4
|
+
|
|
5
|
+
export default function useIntersectionObserver(
|
|
6
|
+
elemRef: RefObject<Elem | Elem[]>,
|
|
7
|
+
options: IntersectionObserverInit = { threshold: 0 }
|
|
8
|
+
) {
|
|
9
|
+
const observerRef = React.useRef<IntersectionObserver>(null);
|
|
10
|
+
const [entries, setEntries] = React.useState<IntersectionObserverEntry[]>([]);
|
|
11
|
+
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
const node = elemRef.current;
|
|
14
|
+
if (!node) return;
|
|
15
|
+
|
|
16
|
+
observerRef.current = new IntersectionObserver(setEntries, options);
|
|
17
|
+
|
|
18
|
+
if (Array.isArray(node)) {
|
|
19
|
+
node.forEach((n) => n && observerRef.current?.observe(n));
|
|
20
|
+
} else {
|
|
21
|
+
observerRef.current.observe(node);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return () => {
|
|
25
|
+
observerRef.current?.disconnect();
|
|
26
|
+
};
|
|
27
|
+
}, [elemRef, options]);
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
entries,
|
|
31
|
+
observerRef,
|
|
32
|
+
};
|
|
33
|
+
}
|
package/src/index.css
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import "@/globals.scss";
|
|
2
|
+
|
|
3
|
+
/** Button */
|
|
4
|
+
import Button from "./components/Button/Button";
|
|
5
|
+
|
|
6
|
+
/** Comment */
|
|
7
|
+
import Comment from "./components/Comment/Comment";
|
|
8
|
+
|
|
9
|
+
/** Icon */
|
|
10
|
+
import { Icon } from "./components/Icon/Icon";
|
|
11
|
+
|
|
12
|
+
/** HelperText */
|
|
13
|
+
import HelperText from "./components/HelperText/HelperText";
|
|
14
|
+
|
|
15
|
+
/** Divider */
|
|
16
|
+
import Divider from "./components/Divider/Divider";
|
|
17
|
+
|
|
18
|
+
/** Accordion */
|
|
19
|
+
import Accordion from "./components/Accordion/Accordion";
|
|
20
|
+
|
|
21
|
+
/** Breadcrumb */
|
|
22
|
+
import Breadcrumb from "./components/Breadcrumb/Breadcrumb";
|
|
23
|
+
|
|
24
|
+
/** Slider */
|
|
25
|
+
import Slider from "./components/Slider/Slider";
|
|
26
|
+
|
|
27
|
+
/** Stepper */
|
|
28
|
+
import Stepper, { StepperProviderProps } from "./components/Stepper/Stepper";
|
|
29
|
+
|
|
30
|
+
/** Badge */
|
|
31
|
+
import Badge, {
|
|
32
|
+
BadgeRootProps,
|
|
33
|
+
BadgeRenderProps,
|
|
34
|
+
} from "./components/Badge/Badge";
|
|
35
|
+
|
|
36
|
+
/** Avatar */
|
|
37
|
+
import Avatar from "./components/Avatar/Avatar";
|
|
38
|
+
|
|
39
|
+
/** ScrollSpy */
|
|
40
|
+
import ScrollSpy from "./components/ScrollSpy/ScrollSpy";
|
|
41
|
+
|
|
42
|
+
/** Cascader */
|
|
43
|
+
import Cascader from "./components/Cascader/Cascader";
|
|
44
|
+
|
|
45
|
+
/** CheckBox */
|
|
46
|
+
import CheckBox from "./components/Form/CheckBox/CheckBox";
|
|
47
|
+
|
|
48
|
+
/** Tab */
|
|
49
|
+
import Tab from "./components/Tab/Tab";
|
|
50
|
+
|
|
51
|
+
/** Dropdown */
|
|
52
|
+
import Dropdown from "./components/Form/Dropdown/Dropdown";
|
|
53
|
+
|
|
54
|
+
/** OTPInput */
|
|
55
|
+
import OTPInput from "./components/Form/OTPInput/OTPInput";
|
|
56
|
+
|
|
57
|
+
/** Switch */
|
|
58
|
+
import Switch from "./components/Form/Switch/Switch";
|
|
59
|
+
|
|
60
|
+
/** Radio */
|
|
61
|
+
import Radio from "./components/Form/Radio/Radio";
|
|
62
|
+
|
|
63
|
+
/** TextInput */
|
|
64
|
+
import TextInput from "./components/Form/TextInput/TextInput";
|
|
65
|
+
|
|
66
|
+
/** TextArea */
|
|
67
|
+
import TextArea from "./components/Form/TextArea/TextArea";
|
|
68
|
+
|
|
69
|
+
/** LazyImage */
|
|
70
|
+
import LazyImage from "./components/LazyImage/LazyImage";
|
|
71
|
+
|
|
72
|
+
/** Calendar */
|
|
73
|
+
import Calendar from "./components/Calendar/Calendar";
|
|
74
|
+
|
|
75
|
+
/** Chart */
|
|
76
|
+
import Chart from "./components/Chart/Chart";
|
|
77
|
+
|
|
78
|
+
/** Quill Editor */
|
|
79
|
+
import QuillEditor from "./components/WisywygEditor/Quill/Editor";
|
|
80
|
+
|
|
81
|
+
/** Table */
|
|
82
|
+
import Table, { TableRootProps } from "./components/Table/Table";
|
|
83
|
+
|
|
84
|
+
/** Weekly Calendar */
|
|
85
|
+
import WeeklyCalendar from "./components/WeeklyCalendar/WeeklyCalendar";
|
|
86
|
+
|
|
87
|
+
/** MobilePicker */
|
|
88
|
+
import MobilePicker from "./components/MobilePicker/MobilePicker";
|
|
89
|
+
/** LNB */
|
|
90
|
+
import LNB, { Navigation } from "./components/LNB/LNB";
|
|
91
|
+
import { makeNavigation } from "./components/LNB/makeNavigation";
|
|
92
|
+
|
|
93
|
+
/** Pagination */
|
|
94
|
+
import Pagination from "./components/Pagination/Pagination";
|
|
95
|
+
|
|
96
|
+
/** BarCode */
|
|
97
|
+
import BarCode, { BarcodeActions } from "./components/BarCode/BarCode";
|
|
98
|
+
|
|
99
|
+
/** QRCode */
|
|
100
|
+
import QRCode, { QRCodeRef } from "./components/QRCode/QRCode";
|
|
101
|
+
|
|
102
|
+
/** Chips */
|
|
103
|
+
import Chips from "./components/Chips/Chips";
|
|
104
|
+
|
|
105
|
+
/** Label */
|
|
106
|
+
import Label from "./components/Label/Label";
|
|
107
|
+
|
|
108
|
+
/** ScrollCalendar */
|
|
109
|
+
import ScrollCalendar from "./components/ScrollCalendar/ScrollCalendar";
|
|
110
|
+
|
|
111
|
+
/** Sheet */
|
|
112
|
+
import Sheet, { SheetRootProps } from "./components/Sheet/Sheet";
|
|
113
|
+
|
|
114
|
+
/** Modal */
|
|
115
|
+
import Modal from "./components/Modal/Modal";
|
|
116
|
+
|
|
117
|
+
/** Popup */
|
|
118
|
+
import Popup, { PopupRootProps } from "./components/Popup/Popup";
|
|
119
|
+
|
|
120
|
+
/** TimeInput */
|
|
121
|
+
import TimeInput from "./components/TimeInput/TimeInput";
|
|
122
|
+
|
|
123
|
+
/** List */
|
|
124
|
+
import List from "./components/List/List";
|
|
125
|
+
|
|
126
|
+
/** Thumbnail */
|
|
127
|
+
import Thumbnail, {
|
|
128
|
+
ThumbnailRootProps,
|
|
129
|
+
} from "./components/Thumbnail/Thumbnail";
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
Button,
|
|
134
|
+
HelperText,
|
|
135
|
+
Icon,
|
|
136
|
+
Divider,
|
|
137
|
+
CheckBox,
|
|
138
|
+
Comment,
|
|
139
|
+
Tab,
|
|
140
|
+
Dropdown,
|
|
141
|
+
OTPInput,
|
|
142
|
+
Switch,
|
|
143
|
+
Radio,
|
|
144
|
+
TextInput,
|
|
145
|
+
TextArea,
|
|
146
|
+
LazyImage,
|
|
147
|
+
Calendar,
|
|
148
|
+
Chart,
|
|
149
|
+
Accordion,
|
|
150
|
+
Breadcrumb,
|
|
151
|
+
Slider,
|
|
152
|
+
Stepper,
|
|
153
|
+
Badge,
|
|
154
|
+
Avatar,
|
|
155
|
+
ScrollSpy,
|
|
156
|
+
QuillEditor,
|
|
157
|
+
Cascader,
|
|
158
|
+
Table,
|
|
159
|
+
WeeklyCalendar,
|
|
160
|
+
MobilePicker,
|
|
161
|
+
LNB,
|
|
162
|
+
makeNavigation,
|
|
163
|
+
Pagination,
|
|
164
|
+
BarCode,
|
|
165
|
+
QRCode,
|
|
166
|
+
Chips,
|
|
167
|
+
Label,
|
|
168
|
+
ScrollCalendar,
|
|
169
|
+
Sheet,
|
|
170
|
+
Modal,
|
|
171
|
+
Popup,
|
|
172
|
+
TimeInput,
|
|
173
|
+
List,
|
|
174
|
+
Thumbnail,
|
|
175
|
+
};
|
|
176
|
+
export type {
|
|
177
|
+
TableRootProps,
|
|
178
|
+
Navigation,
|
|
179
|
+
BadgeRootProps,
|
|
180
|
+
BadgeRenderProps,
|
|
181
|
+
QRCodeRef,
|
|
182
|
+
BarcodeActions,
|
|
183
|
+
StepperProviderProps,
|
|
184
|
+
SheetRootProps,
|
|
185
|
+
PopupRootProps,
|
|
186
|
+
ThumbnailRootProps,
|
|
187
|
+
};
|
package/src/main.tsx
ADDED