@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,339 @@
|
|
|
1
|
+
# Breadcrumb UI
|
|
2
|
+
|
|
3
|
+
## Contents List
|
|
4
|
+
|
|
5
|
+
1. [Quick Start](#QuickStart)
|
|
6
|
+
2. [Reference](#Reference)
|
|
7
|
+
3. [Example](#Example)
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
13
|
+
|
|
14
|
+
const components = () => {
|
|
15
|
+
return (
|
|
16
|
+
<Breadcrumb.List>
|
|
17
|
+
<Breadcrumb.Item>A</Breadcrumb.Item>
|
|
18
|
+
<Breadcrumb.Separator />
|
|
19
|
+
<Breadcrumb.Item>B</Breadcrumb.Item>
|
|
20
|
+
<Breadcrumb.Separator />
|
|
21
|
+
<Breadcrumb.Item>C</Breadcrumb.Item>
|
|
22
|
+
</Breadcrumb.List>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Reference
|
|
28
|
+
|
|
29
|
+
### List
|
|
30
|
+
|
|
31
|
+
`Breadcrumb.List`는 Breadcrumb ui를 효과적으로 보여주기 위해 스타일링이 적용된 `component`입니다.
|
|
32
|
+
|
|
33
|
+
스타일을 제외한 기능은 없기에 `일반 태그`나 `component`로 대체가 가능합니다.
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Required | Default Value |
|
|
36
|
+
| :--------------------------- | :----------------: | :------: | :-----------: |
|
|
37
|
+
| [separator](#List-separator) | React.ReactElement | - | - |
|
|
38
|
+
| [className](#List-className) | String | - | - |
|
|
39
|
+
| [children](#List-children) | React.ReactNode | - | - |
|
|
40
|
+
|
|
41
|
+
#### List-separator
|
|
42
|
+
|
|
43
|
+
`Breadcrumb.List`에 `separator`를 전달하기 위한 `props`입니다.
|
|
44
|
+
|
|
45
|
+
`separator`로 적용하고자 하는 `component`를 `props`로 전달해주면 `Breadcrumb.List`내부 요소들의 사이에 `separator`가 적용됩니다.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
49
|
+
|
|
50
|
+
const components = () => {
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Breadcrumb.List separator={<Breadcrumb.Separator />}>
|
|
54
|
+
<!-- ... -->
|
|
55
|
+
</Breadcrumb.List>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### List-className
|
|
61
|
+
|
|
62
|
+
`Breadcrumb.List`에 `className` class를 전달하기 위한 `props`입니다.
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
66
|
+
|
|
67
|
+
const components = () => {
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Breadcrumb.List className="BreadcrumbList">
|
|
71
|
+
<!-- ... -->
|
|
72
|
+
</Breadcrumb.List>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### List-children
|
|
78
|
+
|
|
79
|
+
`Breadcrumb.List`에 `children`을 전달하기 위한 `props`입니다.
|
|
80
|
+
|
|
81
|
+
`children`으로는 `Breadcrumb.Item` `Breadcrumb.Seperate` `Breadcrumb.Ellipsis`가 들어갑니다.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
85
|
+
|
|
86
|
+
const components = () => {
|
|
87
|
+
return (
|
|
88
|
+
<Breadcrumb.List className="BreadcrumbList">
|
|
89
|
+
<Breadcrumb.Item>A</Breadcrumb.Item>
|
|
90
|
+
<Breadcrumb.Separator />
|
|
91
|
+
<Breadcrumb.Item>B</Breadcrumb.Item>
|
|
92
|
+
<Breadcrumb.Separator />
|
|
93
|
+
<Breadcrumb.Item>C</Breadcrumb.Item>
|
|
94
|
+
</Breadcrumb.List>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Link
|
|
100
|
+
|
|
101
|
+
`Breadcrumb.Link`은 Breadcrumb의 `경로 Text`를 보여주기 위해 스타일링이 적용된 `component`입니다.
|
|
102
|
+
|
|
103
|
+
| Prop | Type | Required | Default Value |
|
|
104
|
+
| :--------------------------- | :----------------------------------------------: | :------: | :-----------: |
|
|
105
|
+
| [href](#href) | String | - | - |
|
|
106
|
+
| [focused](#focused) | Boolean | - | false |
|
|
107
|
+
| [as](#as) | (props: [AsProps](#AsProps))=>React.ReactNode | - | - |
|
|
108
|
+
| [onClick](#onClick) | (e: React.MouseEvent<HTMLAnchorElement>) => void | - | - |
|
|
109
|
+
| [className](#Link-className) | String | - | - |
|
|
110
|
+
| [children](#Link-children) | React.ReactNode | - | - |
|
|
111
|
+
|
|
112
|
+
#### href
|
|
113
|
+
|
|
114
|
+
`Breadcrumb.Link`에 `href`를 전달함과 동시에 기능을 활성화하기 위해 사용됩니다.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
118
|
+
|
|
119
|
+
const components = () => {
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<Breadcrumb.List className="BreadcrumbList">
|
|
123
|
+
<Breadcrumb.Link href="/users/dropdown">Dropdown</Breadcrumb.Link>
|
|
124
|
+
<!-- ... -->
|
|
125
|
+
</Breadcrumb.List>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### focused
|
|
131
|
+
|
|
132
|
+
`Breadcrumb.Link`에 `focused`을 전달하기 위한 `props`입니다.
|
|
133
|
+
|
|
134
|
+
`focused`가 활성화되면 `link`기능이 무효화되고 폰트 색상이 변경됩니다.
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
138
|
+
|
|
139
|
+
const components = () => {
|
|
140
|
+
const [open, setOpen] = React.useState<boolean>(false);
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<Breadcrumb.List className="BreadcrumbList">
|
|
144
|
+
<!-- ... -->
|
|
145
|
+
<Breadcrumb.Link focused>A</Breadcrumb.Link>
|
|
146
|
+
</Breadcrumb.List>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`🔔Tip: <Breadcrumb.List> 내에서 가장 마지막의 <Breadcrumb.Link>에 사용하는걸 권장합니다.`
|
|
152
|
+
|
|
153
|
+
#### as
|
|
154
|
+
|
|
155
|
+
`Breadcrumb.Link`에 ui와 기능을 변경을 위해 제공되는 `props`입니다.
|
|
156
|
+
|
|
157
|
+
`as`는 `props`로 받는 파라미터의 타입은 아래와 같습니다.
|
|
158
|
+
|
|
159
|
+
##### AsProps
|
|
160
|
+
|
|
161
|
+
| Prop | Type | Required | Default Value |
|
|
162
|
+
| :--------------------------- | :----------------------------------------------: | :------: | :-----------: |
|
|
163
|
+
| [href](#href) | String | - | - |
|
|
164
|
+
| [focused](#focused) | Boolean | - | false |
|
|
165
|
+
| [onClick](#onClick) | (e: React.MouseEvent<HTMLAnchorElement>) => void | - | - |
|
|
166
|
+
| [className](#Link-className) | String | - | - |
|
|
167
|
+
|
|
168
|
+
전달받은 `props`를 통해 `<Breadcrumb.Link>`기본 `props`들을 커스텀하고자 하는 `Element`에 부여할 수 있습니다.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
172
|
+
import Link from 'next/link';
|
|
173
|
+
|
|
174
|
+
const components = () => {
|
|
175
|
+
const [open, setOpen] = React.useState<boolean>(false);
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<Breadcrumb.List className="BreadcrumbList">
|
|
179
|
+
<!-- ... -->
|
|
180
|
+
<Breadcrumb.Link as={(props) =>
|
|
181
|
+
<Link {...props}>go home</Link>}
|
|
182
|
+
/>
|
|
183
|
+
</Breadcrumb.List>
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### onClick
|
|
189
|
+
|
|
190
|
+
`Breadcrumb.Link`에 `onClick`이벤트를 전달하기 위한 `props`입니다.
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
194
|
+
|
|
195
|
+
const components = () => {
|
|
196
|
+
const [open, setOpen] = React.useState<boolean>(false);
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<Breadcrumb.List className="BreadcrumbList">
|
|
200
|
+
<!-- ... -->
|
|
201
|
+
<Breadcrumb.Link onClick={() =>
|
|
202
|
+
alert("click!!")
|
|
203
|
+
}>
|
|
204
|
+
A
|
|
205
|
+
</Breadcrumb.Link>
|
|
206
|
+
</Breadcrumb.List>
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`🔔Tip: <Breadcrumb.List> 내에서 가장 마지막의 <Breadcrumb.Link>에 사용하는걸 권장합니다.`
|
|
212
|
+
|
|
213
|
+
#### Link-className
|
|
214
|
+
|
|
215
|
+
`Breadcrumb.Link`에 `className` class를 전달하기 위한 `props`입니다.
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
219
|
+
|
|
220
|
+
const components = () => {
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<Breadcrumb.List>
|
|
224
|
+
<Breadcrumb.Link className="BreadcrumbItem">A</Breadcrumb.Link>
|
|
225
|
+
<!-- ... -->
|
|
226
|
+
</Breadcrumb.List>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### Link-children
|
|
232
|
+
|
|
233
|
+
`Breadcrumb.Link`에 `children`을 전달하기 위한 `props`입니다.
|
|
234
|
+
|
|
235
|
+
보여주고자 하는 아이템의 `Text`를 전달하면 `Link`의 기본 ui를 사용할 수 있습니다.
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
239
|
+
|
|
240
|
+
const components = () => {
|
|
241
|
+
return (
|
|
242
|
+
<Breadcrumb.List>
|
|
243
|
+
<Breadcrumb.Link>A</Breadcrumb.Link>
|
|
244
|
+
<!-- ... -->
|
|
245
|
+
</Breadcrumb.List>
|
|
246
|
+
);
|
|
247
|
+
};
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Separator
|
|
251
|
+
|
|
252
|
+
`Breadcrumb.Separator`은 Breadcrumb의 `Item`사이에 상하관계를 보여주기 위해 존재합니다.
|
|
253
|
+
|
|
254
|
+
| Prop | Type | Required | Default Value |
|
|
255
|
+
| :-------------------------------- | :----: | :------: | :-----------: |
|
|
256
|
+
| [className](#Separator-className) | String | - | - |
|
|
257
|
+
|
|
258
|
+
#### Separator-className
|
|
259
|
+
|
|
260
|
+
`Breadcrumb.Separator`에 `className` class를 전달하기 위한 `props`입니다.
|
|
261
|
+
|
|
262
|
+
```ts
|
|
263
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
264
|
+
|
|
265
|
+
const components = () => {
|
|
266
|
+
|
|
267
|
+
return (
|
|
268
|
+
<Breadcrumb.List>
|
|
269
|
+
<Breadcrumb.Item>A</Breadcrumb.Item>
|
|
270
|
+
<Breadcrumb.Seperator className="BreadcrumbSeperator">
|
|
271
|
+
<Breadcrumb.Item>A</Breadcrumb.Item>
|
|
272
|
+
<!-- ... -->
|
|
273
|
+
</Breadcrumb.List>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Ellipsis
|
|
279
|
+
|
|
280
|
+
`Breadcrumb.Ellipsis`은 Breadcrumb의 목록이 길어졌을때 표시하기 위한 축소 아이콘입니다.
|
|
281
|
+
|
|
282
|
+
| Prop | Type | Required | Default Value |
|
|
283
|
+
| :------------------------------- | :----: | :------: | :-----------: |
|
|
284
|
+
| [className](#Ellipsis-className) | String | - | - |
|
|
285
|
+
|
|
286
|
+
#### Ellipsis-className
|
|
287
|
+
|
|
288
|
+
`Breadcrumb.Ellipsis`에 `className` class를 전달하기 위한 `props`입니다.
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
292
|
+
|
|
293
|
+
const components = () => {
|
|
294
|
+
|
|
295
|
+
return (
|
|
296
|
+
<Breadcrumb.List>
|
|
297
|
+
<!-- ... -->
|
|
298
|
+
<Breadcrumb.Seperator>
|
|
299
|
+
<Breadcrumb.Ellipsis className="BreadcrumbEllipsis">
|
|
300
|
+
<Breadcrumb.Seperator>
|
|
301
|
+
<!-- ... -->
|
|
302
|
+
</Breadcrumb.List>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
#### Ellipsis-dropdown
|
|
308
|
+
|
|
309
|
+
`Breadcrumb.Ellipsis`에 `dropdown`을 적용한 예시입니다.
|
|
310
|
+
|
|
311
|
+
```ts
|
|
312
|
+
import { Breadcrumb } from "@weing-dev/ui-kit-primitive";
|
|
313
|
+
|
|
314
|
+
const components = () => {
|
|
315
|
+
return (
|
|
316
|
+
<Dropdown.Root value={dOpen} onChange={handleChangeValue}>
|
|
317
|
+
<Dropdown.Trigger
|
|
318
|
+
as={<Breadcrumb.Ellipsis />}
|
|
319
|
+
className={cx("Trigger")}
|
|
320
|
+
/>
|
|
321
|
+
<Dropdown.Menu className={cx("Menu")}>
|
|
322
|
+
{options.map((option, idx) => {
|
|
323
|
+
return (
|
|
324
|
+
<a key={idx} href={option.value}>
|
|
325
|
+
<Dropdown.Item value={option.value} className={cx("Item")}>
|
|
326
|
+
{option.label}
|
|
327
|
+
</Dropdown.Item>
|
|
328
|
+
</a>
|
|
329
|
+
);
|
|
330
|
+
})}
|
|
331
|
+
</Dropdown.Menu>
|
|
332
|
+
</Dropdown.Root>
|
|
333
|
+
);
|
|
334
|
+
};
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## Example
|
|
338
|
+
|
|
339
|
+
프로젝트를 실행하고 해당 [Link](http://localhost:3000/users/breadcrumb)에서 확인할 수 있습니다.
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SimenticColor, Transparent } from "../../styles/baseColor";
|
|
3
|
+
import { colorThemes as colorSet } from "../../styles/color2";
|
|
4
|
+
|
|
5
|
+
// 훅 함수 유지
|
|
6
|
+
const useButtonColors = (shapeType: "square" | "round" = "square") => {
|
|
7
|
+
// 객체에서 shapeType에 따라 적절한 색상 설정 반환
|
|
8
|
+
|
|
9
|
+
const buttonColorsConfig = React.useMemo(() => {
|
|
10
|
+
return {
|
|
11
|
+
square: {
|
|
12
|
+
primary: {
|
|
13
|
+
contained: {
|
|
14
|
+
backgroundColor: colorSet.primary.pMain,
|
|
15
|
+
color: colorSet.primary.pContrastText,
|
|
16
|
+
borderColor: "transparent",
|
|
17
|
+
hover: {
|
|
18
|
+
backgroundColor: colorSet.primary.pDark,
|
|
19
|
+
color: colorSet.primary.pContrastText,
|
|
20
|
+
borderColor: "transparent",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
outlined: {
|
|
24
|
+
backgroundColor: "transparent",
|
|
25
|
+
color: colorSet.primary.pMain,
|
|
26
|
+
borderColor: colorSet.primary.p48,
|
|
27
|
+
hover: {
|
|
28
|
+
backgroundColor: colorSet.primary.p8,
|
|
29
|
+
color: colorSet.primary.pMain,
|
|
30
|
+
borderColor: colorSet.primary.pMain,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
soft: {
|
|
34
|
+
backgroundColor: colorSet.primary.p8,
|
|
35
|
+
color: `var(--swapDarkLightPrimary, ${colorSet.light.swapDarkLightPrimary})`,
|
|
36
|
+
borderColor: "transparent",
|
|
37
|
+
hover: {
|
|
38
|
+
backgroundColor: colorSet.primary.p16,
|
|
39
|
+
color: `var(--swapDarkLightPrimary, ${colorSet.light.swapDarkLightPrimary})`,
|
|
40
|
+
borderColor: "transparent",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
text: {
|
|
44
|
+
backgroundColor: "transparent",
|
|
45
|
+
color: colorSet.primary.pMain,
|
|
46
|
+
borderColor: "transparent",
|
|
47
|
+
hover: {
|
|
48
|
+
backgroundColor: colorSet.primary.p8,
|
|
49
|
+
color: `var(--swapDarkLightDeepGreen, ${colorSet.light.swapDarkLightDeepGreen})`,
|
|
50
|
+
borderColor: "transparent",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
inherit: {
|
|
55
|
+
contained: {
|
|
56
|
+
backgroundColor: `var(--inheritBgcolor, ${colorSet.light.inheritBgcolor})`,
|
|
57
|
+
color: `var(--textContrast, ${colorSet.light.textContrast})`,
|
|
58
|
+
borderColor: "transparent",
|
|
59
|
+
hover: {
|
|
60
|
+
backgroundColor: `var(--inheritHover, ${colorSet.light.inheritHover})`,
|
|
61
|
+
color: `var(--textContrast, ${colorSet.light.textContrast})`,
|
|
62
|
+
borderColor: "transparent",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
outlined: {
|
|
66
|
+
backgroundColor: "transparent",
|
|
67
|
+
color: `var(--textSecondary, ${colorSet.light.textSecondary})`,
|
|
68
|
+
borderColor: Transparent.grey32,
|
|
69
|
+
hover: {
|
|
70
|
+
backgroundColor: `var(--actionHover, ${colorSet.light.actionHover})`,
|
|
71
|
+
color: `var(--textSecondary, ${colorSet.light.textSecondary})`,
|
|
72
|
+
borderColor: `var(--textSecondary, ${colorSet.light.textSecondary})`,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
soft: {
|
|
76
|
+
backgroundColor: Transparent.grey8,
|
|
77
|
+
color: `var(--textPrimary, ${colorSet.light.textPrimary})`,
|
|
78
|
+
borderColor: "transparent",
|
|
79
|
+
hover: {
|
|
80
|
+
backgroundColor: Transparent.grey24,
|
|
81
|
+
color: `var(--textPrimary, ${colorSet.light.textPrimary})`,
|
|
82
|
+
borderColor: "transparent",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
text: {
|
|
86
|
+
backgroundColor: "transparent",
|
|
87
|
+
color: `var(--textSecondary, ${colorSet.light.textSecondary})`,
|
|
88
|
+
borderColor: "transparent",
|
|
89
|
+
hover: {
|
|
90
|
+
backgroundColor: `var(--actionHover, ${colorSet.light.actionHover})`,
|
|
91
|
+
color: `var(--textPrimary, ${colorSet.light.textPrimary})`,
|
|
92
|
+
borderColor: "transparent",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
red: {
|
|
97
|
+
contained: {
|
|
98
|
+
backgroundColor: SimenticColor.red.Main,
|
|
99
|
+
color: colorSet.primary.pContrastText,
|
|
100
|
+
borderColor: "transparent",
|
|
101
|
+
hover: {
|
|
102
|
+
backgroundColor: SimenticColor.red.Dark,
|
|
103
|
+
color: `var(--textContrast, ${colorSet.light.textContrast})`,
|
|
104
|
+
borderColor: "transparent",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
outlined: {
|
|
108
|
+
backgroundColor: "transparent",
|
|
109
|
+
color: SimenticColor.red.Main,
|
|
110
|
+
borderColor: Transparent.red48,
|
|
111
|
+
hover: {
|
|
112
|
+
backgroundColor: Transparent.red8,
|
|
113
|
+
color: SimenticColor.red.Main,
|
|
114
|
+
borderColor: SimenticColor.red.Main,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
soft: {
|
|
118
|
+
backgroundColor: Transparent.red8,
|
|
119
|
+
color: `var(--swapDarkLightRed, ${colorSet.light.swapDarkLightRed})`,
|
|
120
|
+
borderColor: "transparent",
|
|
121
|
+
hover: {
|
|
122
|
+
backgroundColor: Transparent.red16,
|
|
123
|
+
color: `var(--swapDarkLightRed, ${colorSet.light.swapDarkLightRed})`,
|
|
124
|
+
borderColor: "transparent",
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
text: {
|
|
128
|
+
backgroundColor: "transparent",
|
|
129
|
+
color: SimenticColor.red.Main,
|
|
130
|
+
borderColor: "transparent",
|
|
131
|
+
hover: {
|
|
132
|
+
backgroundColor: Transparent.red8,
|
|
133
|
+
color: SimenticColor.red.Dark,
|
|
134
|
+
borderColor: "transparent",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
disabled: {
|
|
139
|
+
contained: {
|
|
140
|
+
backgroundColor: `var(--actionDisabledBackground, ${colorSet.light.actionDisabledBackground})`,
|
|
141
|
+
color: `var(--textDisabled, ${colorSet.light.textDisabled})`,
|
|
142
|
+
borderColor: "transparent",
|
|
143
|
+
},
|
|
144
|
+
outlined: {
|
|
145
|
+
backgroundColor: "transparent",
|
|
146
|
+
color: `var(--textDisabled, ${colorSet.light.textDisabled})`,
|
|
147
|
+
borderColor: `var(--actionDisabled, ${colorSet.light.actionDisabled})`,
|
|
148
|
+
},
|
|
149
|
+
soft: {
|
|
150
|
+
backgroundColor: `var(--actionDisabledBackground, ${colorSet.light.actionDisabledBackground})`,
|
|
151
|
+
color: `var(--textDisabled, ${colorSet.light.textDisabled})`,
|
|
152
|
+
borderColor: "transparent",
|
|
153
|
+
},
|
|
154
|
+
text: {
|
|
155
|
+
backgroundColor: "transparent",
|
|
156
|
+
color: `var(--textDisabled, ${colorSet.light.textDisabled})`,
|
|
157
|
+
borderColor: "transparent",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
round: {
|
|
162
|
+
primary: {
|
|
163
|
+
contained: {
|
|
164
|
+
backgroundColor: colorSet.primary.pMain,
|
|
165
|
+
color: colorSet.primary.pContrastText,
|
|
166
|
+
borderColor: "transparent",
|
|
167
|
+
hover: {
|
|
168
|
+
backgroundColor: colorSet.primary.pDark,
|
|
169
|
+
color: colorSet.primary.pContrastText,
|
|
170
|
+
borderColor: "transparent",
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
outlined: {
|
|
174
|
+
backgroundColor: "transparent",
|
|
175
|
+
color: colorSet.primary.pMain,
|
|
176
|
+
borderColor: colorSet.primary.p48,
|
|
177
|
+
hover: {
|
|
178
|
+
backgroundColor: colorSet.primary.p8,
|
|
179
|
+
color: colorSet.primary.pMain,
|
|
180
|
+
borderColor: colorSet.primary.p48,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
soft: {
|
|
184
|
+
backgroundColor: colorSet.primary.p8,
|
|
185
|
+
color: `var(--swapDarkLightPrimary, ${colorSet.light.swapDarkLightPrimary})`,
|
|
186
|
+
borderColor: "transparent",
|
|
187
|
+
hover: {
|
|
188
|
+
backgroundColor: colorSet.primary.p16,
|
|
189
|
+
color: `var(--swapDarkLightPrimary, ${colorSet.light.swapDarkLightPrimary})`,
|
|
190
|
+
borderColor: "transparent",
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
text: {
|
|
194
|
+
backgroundColor: "transparent",
|
|
195
|
+
color: colorSet.primary.pMain,
|
|
196
|
+
borderColor: "transparent",
|
|
197
|
+
hover: {
|
|
198
|
+
backgroundColor: colorSet.primary.p8,
|
|
199
|
+
color: `var(--swapDarkLightDeepGreen, ${colorSet.light.swapDarkLightDeepGreen})`,
|
|
200
|
+
borderColor: "transparent",
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
inherit: {
|
|
205
|
+
contained: {
|
|
206
|
+
backgroundColor: `var(--inheritBgcolor, ${colorSet.light.inheritBgcolor})`,
|
|
207
|
+
color: `var(--textContrast, ${colorSet.light.textContrast})`,
|
|
208
|
+
borderColor: "transparent",
|
|
209
|
+
hover: {
|
|
210
|
+
backgroundColor: `var(--inheritHover, ${colorSet.light.inheritHover})`,
|
|
211
|
+
color: `var(--textContrast, ${colorSet.light.textContrast})`,
|
|
212
|
+
borderColor: "transparent",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
outlined: {
|
|
216
|
+
backgroundColor: "transparent",
|
|
217
|
+
color: `var(--textSecondary, ${colorSet.light.textSecondary})`,
|
|
218
|
+
borderColor: Transparent.grey32,
|
|
219
|
+
hover: {
|
|
220
|
+
backgroundColor: `var(--actionHover, ${colorSet.light.actionHover})`,
|
|
221
|
+
color: `var(--textSecondary, ${colorSet.light.textSecondary})`,
|
|
222
|
+
borderColor: Transparent.grey32,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
soft: {
|
|
226
|
+
backgroundColor: Transparent.grey8,
|
|
227
|
+
color: `var(--textPrimary, ${colorSet.light.textPrimary})`,
|
|
228
|
+
borderColor: "transparent",
|
|
229
|
+
hover: {
|
|
230
|
+
backgroundColor: Transparent.grey24,
|
|
231
|
+
color: `var(--textPrimary, ${colorSet.light.textPrimary})`,
|
|
232
|
+
borderColor: "transparent",
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
text: {
|
|
236
|
+
backgroundColor: "transparent",
|
|
237
|
+
color: `var(--textSecondary, ${colorSet.light.textSecondary})`,
|
|
238
|
+
borderColor: "transparent",
|
|
239
|
+
hover: {
|
|
240
|
+
backgroundColor: `var(--actionHover, ${colorSet.light.actionHover})`,
|
|
241
|
+
color: `var(--textPrimary, ${colorSet.light.textPrimary})`,
|
|
242
|
+
borderColor: "transparent",
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
red: {
|
|
247
|
+
contained: {
|
|
248
|
+
backgroundColor: SimenticColor.red.Main,
|
|
249
|
+
color: colorSet.primary.pContrastText,
|
|
250
|
+
borderColor: "transparent",
|
|
251
|
+
hover: {
|
|
252
|
+
backgroundColor: SimenticColor.red.Dark,
|
|
253
|
+
color: `var(--textContrast, ${colorSet.light.textContrast})`,
|
|
254
|
+
borderColor: "transparent",
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
outlined: {
|
|
258
|
+
backgroundColor: "transparent",
|
|
259
|
+
color: SimenticColor.red.Main,
|
|
260
|
+
borderColor: Transparent.red48,
|
|
261
|
+
hover: {
|
|
262
|
+
backgroundColor: Transparent.red8,
|
|
263
|
+
color: SimenticColor.red.Main,
|
|
264
|
+
borderColor: Transparent.red48,
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
soft: {
|
|
268
|
+
backgroundColor: Transparent.red8,
|
|
269
|
+
color: `var(--swapDarkLightRed, ${colorSet.light.swapDarkLightRed})`,
|
|
270
|
+
borderColor: "transparent",
|
|
271
|
+
hover: {
|
|
272
|
+
backgroundColor: Transparent.red16,
|
|
273
|
+
color: `var(--swapDarkLightRed, ${colorSet.light.swapDarkLightRed})`,
|
|
274
|
+
borderColor: "transparent",
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
text: {
|
|
278
|
+
backgroundColor: "transparent",
|
|
279
|
+
color: SimenticColor.red.Main,
|
|
280
|
+
borderColor: "transparent",
|
|
281
|
+
hover: {
|
|
282
|
+
backgroundColor: Transparent.red8,
|
|
283
|
+
color: SimenticColor.red.Dark,
|
|
284
|
+
borderColor: "transparent",
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
disabled: {
|
|
289
|
+
contained: {
|
|
290
|
+
backgroundColor: `var(--actionDisabledBackground, ${colorSet.light.actionDisabledBackground})`,
|
|
291
|
+
color: `var(--textDisabled, ${colorSet.light.textDisabled})`,
|
|
292
|
+
borderColor: "transparent",
|
|
293
|
+
},
|
|
294
|
+
outlined: {
|
|
295
|
+
backgroundColor: "transparent",
|
|
296
|
+
color: `var(--textDisabled, ${colorSet.light.textDisabled})`,
|
|
297
|
+
borderColor: `var(--actionDisabled, ${colorSet.light.actionDisabled})`,
|
|
298
|
+
},
|
|
299
|
+
soft: {
|
|
300
|
+
backgroundColor: `var(--actionDisabledBackground, ${colorSet.light.actionDisabledBackground})`,
|
|
301
|
+
color: `var(--textDisabled, ${colorSet.light.textDisabled})`,
|
|
302
|
+
borderColor: "transparent",
|
|
303
|
+
},
|
|
304
|
+
text: {
|
|
305
|
+
backgroundColor: "transparent",
|
|
306
|
+
color: `var(--textDisabled, ${colorSet.light.textDisabled})`,
|
|
307
|
+
borderColor: "transparent",
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
}, []);
|
|
313
|
+
|
|
314
|
+
return {
|
|
315
|
+
primary: buttonColorsConfig[shapeType].primary,
|
|
316
|
+
inherit: buttonColorsConfig[shapeType].inherit,
|
|
317
|
+
disabled: buttonColorsConfig[shapeType].disabled,
|
|
318
|
+
red: buttonColorsConfig[shapeType].red,
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export default useButtonColors;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Variant = "outlined" | "contained" | "soft" | "text";
|
|
3
|
+
|
|
4
|
+
type ButtonContextType = {
|
|
5
|
+
// colorScheme: ColorScheme;
|
|
6
|
+
/** Color Type */
|
|
7
|
+
shapeType: "square" | "round";
|
|
8
|
+
colorType: "primary" | "inherit" | "red";
|
|
9
|
+
variant: Variant;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
spinner?: React.ReactNode;
|
|
12
|
+
loadingText: string;
|
|
13
|
+
size?: "small" | "medium" | "large";
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
isFitted?: boolean;
|
|
16
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const initialState: ButtonContextType = {
|
|
20
|
+
// colorScheme: "gray",
|
|
21
|
+
shapeType: "square",
|
|
22
|
+
colorType: "primary",
|
|
23
|
+
variant: "contained",
|
|
24
|
+
isLoading: false,
|
|
25
|
+
loadingText: "Loading...",
|
|
26
|
+
disabled: false,
|
|
27
|
+
size: "medium",
|
|
28
|
+
isFitted: false,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const ButtonContext =
|
|
32
|
+
React.createContext<ButtonContextType>(initialState);
|
|
33
|
+
|
|
34
|
+
export type ButtonProviderProps = React.PropsWithChildren<
|
|
35
|
+
Partial<ButtonContextType>
|
|
36
|
+
> & {
|
|
37
|
+
className?: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const ButtonProvider = (props: ButtonProviderProps) => {
|
|
41
|
+
const { children, ...rest } = props;
|
|
42
|
+
return (
|
|
43
|
+
<ButtonContext.Provider value={{ ...initialState, ...rest }}>
|
|
44
|
+
{children}
|
|
45
|
+
</ButtonContext.Provider>
|
|
46
|
+
);
|
|
47
|
+
};
|