@lotte-innovate/ui-component-test 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (280) hide show
  1. package/README.md +163 -163
  2. package/dist/Typography/Header/index.d.ts +13 -0
  3. package/dist/Typography/Header/index.jsx +58 -0
  4. package/dist/Typography/Text/index.d.ts +16 -0
  5. package/dist/Typography/Text/index.jsx +47 -0
  6. package/dist/Typography/index.d.ts +2 -0
  7. package/dist/Typography/index.js +2 -0
  8. package/dist/app/layout.d.ts +7 -0
  9. package/dist/app/layout.jsx +13 -0
  10. package/dist/app/page.d.ts +2 -0
  11. package/dist/app/page.jsx +42 -0
  12. package/dist/app/template/badgeTemplate.d.ts +12 -0
  13. package/dist/app/template/badgeTemplate.jsx +82 -0
  14. package/dist/app/template/buttonTemplate.d.ts +12 -0
  15. package/dist/app/template/buttonTemplate.jsx +82 -0
  16. package/dist/app/template/colorPicker.d.ts +7 -0
  17. package/dist/app/template/colorPicker.jsx +19 -0
  18. package/dist/app/template/textTemplate.d.ts +11 -0
  19. package/dist/app/template/textTemplate.jsx +72 -0
  20. package/dist/app/template/theme.d.ts +12 -0
  21. package/dist/app/template/theme.jsx +44 -0
  22. package/dist/color/alpha.d.ts +784 -0
  23. package/dist/color/alpha.js +784 -0
  24. package/dist/color/constants.d.ts +20 -0
  25. package/dist/color/constants.js +200 -0
  26. package/dist/color/dark.d.ts +392 -0
  27. package/dist/color/dark.js +392 -0
  28. package/dist/color/krdsColors.d.ts +309 -0
  29. package/dist/color/krdsColors.js +309 -0
  30. package/dist/color/light.d.ts +392 -0
  31. package/dist/color/light.js +393 -0
  32. package/dist/components/Accordion/index.jsx +13 -13
  33. package/dist/components/AlertDialog/AlertDialogAction.jsx +2 -2
  34. package/dist/components/AlertDialog/AlertDialogCancel.jsx +2 -2
  35. package/dist/components/AlertDialog/AlertDialogContent.jsx +5 -5
  36. package/dist/components/AlertDialog/AlertDialogDescription.jsx +2 -2
  37. package/dist/components/AlertDialog/AlertDialogTitle.jsx +2 -2
  38. package/dist/components/AlertDialog/AlertDialogTrigger.jsx +2 -2
  39. package/dist/components/AspectRatio/index.jsx +2 -2
  40. package/dist/components/Avatar/index.jsx +5 -5
  41. package/dist/components/Badge/index.jsx +2 -2
  42. package/dist/components/BubbleChart/index.d.ts +1 -1
  43. package/dist/components/Button/index.jsx +2 -2
  44. package/dist/components/Callout/CalloutIcon.jsx +6 -6
  45. package/dist/components/Callout/CalloutText.jsx +2 -2
  46. package/dist/components/Callout/index.jsx +4 -4
  47. package/dist/components/Card/index.jsx +2 -2
  48. package/dist/components/Checkbox/index.jsx +9 -9
  49. package/dist/components/CheckboxCard/index.jsx +3 -3
  50. package/dist/components/CheckboxGroup/CheckboxGroupItem.jsx +4 -4
  51. package/dist/components/CheckboxGroup/index.jsx +4 -4
  52. package/dist/components/ContextMenu/ContextMenuCheckboxItem.jsx +5 -5
  53. package/dist/components/ContextMenu/ContextMenuContent.jsx +4 -4
  54. package/dist/components/ContextMenu/ContextMenuGroup.jsx +2 -2
  55. package/dist/components/ContextMenu/ContextMenuItem.jsx +3 -3
  56. package/dist/components/ContextMenu/ContextMenuItemIndicator.jsx +2 -2
  57. package/dist/components/ContextMenu/ContextMenuLabel.jsx +2 -2
  58. package/dist/components/ContextMenu/ContextMenuRadioGroup.jsx +4 -4
  59. package/dist/components/ContextMenu/ContextMenuRadioItem.jsx +5 -5
  60. package/dist/components/ContextMenu/ContextMenuSeparator.jsx +2 -2
  61. package/dist/components/ContextMenu/ContextMenuSubContent.jsx +4 -4
  62. package/dist/components/ContextMenu/ContextMenuSubTrigger.jsx +7 -7
  63. package/dist/components/ContextMenu/ContextMenuTrigger.jsx +2 -2
  64. package/dist/components/ContextMenu/index.jsx +2 -2
  65. package/dist/components/DataList/DataListItem.jsx +2 -2
  66. package/dist/components/DataList/DataListLabel.jsx +2 -2
  67. package/dist/components/DataList/DataListValue.jsx +2 -2
  68. package/dist/components/DataList/index.jsx +4 -4
  69. package/dist/components/Dialog/DialogAction.jsx +2 -2
  70. package/dist/components/Dialog/DialogCancel.jsx +2 -2
  71. package/dist/components/Dialog/DialogContent.jsx +2 -2
  72. package/dist/components/Dialog/DialogDescription.jsx +2 -2
  73. package/dist/components/Dialog/DialogSlot.jsx +2 -2
  74. package/dist/components/Dialog/DialogTitle.jsx +2 -2
  75. package/dist/components/Dialog/DialogTrigger.jsx +2 -2
  76. package/dist/components/Dialog/index.jsx +2 -2
  77. package/dist/components/DropdownMenu/DropdonMenuRadioGroup.jsx +4 -4
  78. package/dist/components/DropdownMenu/DropdonMenuSubContent.jsx +4 -4
  79. package/dist/components/DropdownMenu/DropdownMenuCheckboxItem.jsx +5 -5
  80. package/dist/components/DropdownMenu/DropdownMenuContent.jsx +4 -4
  81. package/dist/components/DropdownMenu/DropdownMenuItem.jsx +3 -3
  82. package/dist/components/DropdownMenu/DropdownMenuItemIndicator.jsx +2 -2
  83. package/dist/components/DropdownMenu/DropdownMenuLable.jsx +2 -2
  84. package/dist/components/DropdownMenu/DropdownMenuRadioItem.jsx +5 -5
  85. package/dist/components/DropdownMenu/DropdownMenuSubTrigger.jsx +5 -5
  86. package/dist/components/DropdownMenu/DropdownMenuTrigger.jsx +2 -2
  87. package/dist/components/HoverCard/HoverCardContent.jsx +2 -2
  88. package/dist/components/HoverCard/HoverCardTrigger.jsx +2 -2
  89. package/dist/components/HoverCard/index.jsx +2 -2
  90. package/dist/components/IconButton/index.jsx +2 -2
  91. package/dist/components/Input/Input.stories.jsx +6 -6
  92. package/dist/components/Inset/index.jsx +4 -4
  93. package/dist/components/Label/index.jsx +2 -2
  94. package/dist/components/Menubar/MenubarCheckboxItem.jsx +5 -5
  95. package/dist/components/Menubar/MenubarContent.jsx +4 -4
  96. package/dist/components/Menubar/MenubarItem.jsx +3 -3
  97. package/dist/components/Menubar/MenubarItemIndicator.jsx +2 -2
  98. package/dist/components/Menubar/MenubarRadioGroup.jsx +4 -4
  99. package/dist/components/Menubar/MenubarRadioItem.jsx +5 -5
  100. package/dist/components/Menubar/MenubarSeparator.jsx +2 -2
  101. package/dist/components/Menubar/MenubarSubContent.jsx +2 -2
  102. package/dist/components/Menubar/MenubarSubTrigger.jsx +5 -5
  103. package/dist/components/Menubar/MenubarTrigger.jsx +2 -2
  104. package/dist/components/Menubar/index.jsx +4 -4
  105. package/dist/components/NavigationMenu/NavigationMenuContent.jsx +2 -2
  106. package/dist/components/NavigationMenu/NavigationMenuIndicator.jsx +3 -3
  107. package/dist/components/NavigationMenu/NavigationMenuItem.jsx +2 -2
  108. package/dist/components/NavigationMenu/NavigationMenuLink.jsx +2 -2
  109. package/dist/components/NavigationMenu/NavigationMenuList.jsx +3 -3
  110. package/dist/components/NavigationMenu/NavigationMenuTrigger.jsx +3 -3
  111. package/dist/components/NavigationMenu/NavigationMenuViewport.jsx +2 -2
  112. package/dist/components/NavigationMenu/index.jsx +4 -4
  113. package/dist/components/Popover/PopoverClose.jsx +2 -2
  114. package/dist/components/Popover/PopoverContent.jsx +2 -2
  115. package/dist/components/Popover/PopoverTrigger.jsx +2 -2
  116. package/dist/components/Popover/index.jsx +2 -2
  117. package/dist/components/Progress/index.d.ts +3 -3
  118. package/dist/components/Progress/index.jsx +2 -2
  119. package/dist/components/RadarChart/index.d.ts +1 -1
  120. package/dist/components/Radio/index.d.ts +1 -1
  121. package/dist/components/Radio/index.jsx +7 -7
  122. package/dist/components/RadioCards/RadioCardsItem.jsx +2 -2
  123. package/dist/components/RadioCards/index.d.ts +1 -1
  124. package/dist/components/RadioCards/index.jsx +4 -4
  125. package/dist/components/RadioGroup/RadioGroupItem.jsx +2 -2
  126. package/dist/components/RadioGroup/index.d.ts +1 -1
  127. package/dist/components/RadioGroup/index.jsx +4 -4
  128. package/dist/components/ScrollArea/index.jsx +4 -4
  129. package/dist/components/SegmentedControl/SegmentedControlItem.jsx +2 -2
  130. package/dist/components/SegmentedControl/index.d.ts +1 -1
  131. package/dist/components/SegmentedControl/index.jsx +4 -4
  132. package/dist/components/Select/index.d.ts +1 -1
  133. package/dist/components/Select/index.jsx +16 -16
  134. package/dist/components/Separator/index.d.ts +1 -1
  135. package/dist/components/Separator/index.jsx +4 -4
  136. package/dist/components/Skeleton/index.d.ts +1 -1
  137. package/dist/components/Skeleton/index.jsx +4 -4
  138. package/dist/components/Slider/index.d.ts +1 -1
  139. package/dist/components/Slider/index.jsx +2 -2
  140. package/dist/components/Spinner/index.d.ts +1 -1
  141. package/dist/components/Spinner/index.jsx +4 -4
  142. package/dist/components/TabNav/index.jsx +6 -6
  143. package/dist/components/Table/index.d.ts +2 -2
  144. package/dist/components/Table/index.jsx +16 -16
  145. package/dist/components/Tabs/index.d.ts +1 -1
  146. package/dist/components/Tabs/index.jsx +10 -10
  147. package/dist/components/TextArea/index.d.ts +3 -3
  148. package/dist/components/TextArea/index.jsx +2 -2
  149. package/dist/components/TextField/index.d.ts +1 -1
  150. package/dist/components/TextField/index.jsx +6 -6
  151. package/dist/components/Toast/ToastActionButton.d.ts +3 -3
  152. package/dist/components/Toast/ToastActionButton.jsx +2 -2
  153. package/dist/components/Toast/ToastDescription.d.ts +1 -1
  154. package/dist/components/Toast/ToastDescription.jsx +4 -4
  155. package/dist/components/Toast/ToastTitle.d.ts +1 -1
  156. package/dist/components/Toast/ToastTitle.jsx +2 -2
  157. package/dist/components/Toast/index.d.ts +3 -3
  158. package/dist/components/Toast/index.jsx +7 -7
  159. package/dist/components/Toggle/ToggleWithText.jsx +3 -3
  160. package/dist/components/Toggle/index.d.ts +3 -3
  161. package/dist/components/Toggle/index.jsx +2 -2
  162. package/dist/components/ToggleGroup/index.d.ts +1 -1
  163. package/dist/components/ToggleGroup/index.jsx +4 -4
  164. package/dist/components/ToggleGroup/toggleGroupItem.jsx +2 -2
  165. package/dist/components/ToggleSwitch/index.d.ts +3 -3
  166. package/dist/components/ToggleSwitch/index.jsx +5 -5
  167. package/dist/components/Tooltip/index.d.ts +1 -1
  168. package/dist/components/Tooltip/index.jsx +10 -10
  169. package/dist/components/index.d.ts +48 -0
  170. package/dist/components/index.js +48 -52
  171. package/dist/constants.d.ts +185 -0
  172. package/dist/constants.js +569 -0
  173. package/dist/index.d.ts +5 -0
  174. package/dist/index.js +5 -51
  175. package/dist/stories/Welcome.d.ts +3 -0
  176. package/dist/stories/Welcome.jsx +48 -0
  177. package/dist/stories/accordion/Accordion.stories.d.ts +71 -0
  178. package/dist/stories/accordion/Accordion.stories.jsx +79 -0
  179. package/dist/stories/alert-dialog/AlertDialog.stories.d.ts +107 -0
  180. package/dist/stories/alert-dialog/AlertDialog.stories.jsx +73 -0
  181. package/dist/stories/aspect-ratio/AspectRatio.stories.d.ts +68 -0
  182. package/dist/stories/aspect-ratio/AspectRatio.stories.jsx +106 -0
  183. package/dist/stories/avatar/Avatar.stories.d.ts +127 -0
  184. package/dist/stories/avatar/Avatar.stories.jsx +105 -0
  185. package/dist/stories/badge/Badge.stories.d.ts +133 -0
  186. package/dist/stories/badge/Badge.stories.jsx +130 -0
  187. package/dist/stories/bubble-chart/BubbleChart.stories.d.ts +103 -0
  188. package/dist/stories/bubble-chart/BubbleChart.stories.jsx +176 -0
  189. package/dist/stories/button/Button.stories.d.ts +148 -0
  190. package/dist/stories/button/Button.stories.jsx +98 -0
  191. package/dist/stories/button/IconButton.stories.d.ts +125 -0
  192. package/dist/stories/button/IconButton.stories.jsx +93 -0
  193. package/dist/stories/callout/Callout.stories.d.ts +129 -0
  194. package/dist/stories/callout/Callout.stories.jsx +205 -0
  195. package/dist/stories/card/Card.stories.d.ts +100 -0
  196. package/dist/stories/card/Card.stories.jsx +134 -0
  197. package/dist/stories/checkbox/Checkbox.stories.d.ts +147 -0
  198. package/dist/stories/checkbox/Checkbox.stories.jsx +166 -0
  199. package/dist/stories/checkbox/CheckboxCard.stories.d.ts +129 -0
  200. package/dist/stories/checkbox/CheckboxCard.stories.jsx +125 -0
  201. package/dist/stories/checkbox/CheckboxGroup.stories.d.ts +91 -0
  202. package/dist/stories/checkbox/CheckboxGroup.stories.jsx +144 -0
  203. package/dist/stories/context-menu/ContextMenu.stories.d.ts +113 -0
  204. package/dist/stories/context-menu/ContextMenu.stories.jsx +155 -0
  205. package/dist/stories/data-list/DataList.stories.d.ts +97 -0
  206. package/dist/stories/data-list/DataList.stories.jsx +185 -0
  207. package/dist/stories/dialog/Dialog.stories.d.ts +88 -0
  208. package/dist/stories/dialog/Dialog.stories.jsx +82 -0
  209. package/dist/stories/doughnut-chart/DoughnutChart.stories.d.ts +181 -0
  210. package/dist/stories/doughnut-chart/DoughnutChart.stories.jsx +236 -0
  211. package/dist/stories/dropdown-menu/DropdownMenu.stories.d.ts +112 -0
  212. package/dist/stories/dropdown-menu/DropdownMenu.stories.jsx +170 -0
  213. package/dist/stories/header/Header.stories.d.ts +112 -0
  214. package/dist/stories/header/Header.stories.jsx +116 -0
  215. package/dist/stories/hover-card/HoverCard.stories.d.ts +107 -0
  216. package/dist/stories/hover-card/HoverCard.stories.jsx +98 -0
  217. package/dist/stories/inset/Inset.stories.d.ts +58 -0
  218. package/dist/stories/inset/Inset.stories.jsx +79 -0
  219. package/dist/stories/label/Label.stories.d.ts +94 -0
  220. package/dist/stories/label/Label.stories.jsx +112 -0
  221. package/dist/stories/menubar/Menubar.stories.d.ts +119 -0
  222. package/dist/stories/menubar/Menubar.stories.jsx +135 -0
  223. package/dist/stories/navigation-menu/NavigationMenu.stories.d.ts +385 -0
  224. package/dist/stories/navigation-menu/NavigationMenu.stories.jsx +144 -0
  225. package/dist/stories/pie-chart/PieChart.stories.d.ts +186 -0
  226. package/dist/stories/pie-chart/PieChart.stories.jsx +300 -0
  227. package/dist/stories/popover/Popover.stories.d.ts +78 -0
  228. package/dist/stories/popover/Popover.stories.jsx +107 -0
  229. package/dist/stories/progress/Progress.stories.d.ts +113 -0
  230. package/dist/stories/progress/Progress.stories.jsx +82 -0
  231. package/dist/stories/radar-chart/RadarChart.stories.d.ts +111 -0
  232. package/dist/stories/radar-chart/RadarChart.stories.jsx +200 -0
  233. package/dist/stories/radio/Radio.stories.d.ts +108 -0
  234. package/dist/stories/radio/Radio.stories.jsx +94 -0
  235. package/dist/stories/radio/RadioCards.stories.d.ts +127 -0
  236. package/dist/stories/radio/RadioCards.stories.jsx +153 -0
  237. package/dist/stories/radio/RadioGroup.stories.d.ts +111 -0
  238. package/dist/stories/radio/RadioGroup.stories.jsx +142 -0
  239. package/dist/stories/scroll-area/ScrollArea.stories.d.ts +59 -0
  240. package/dist/stories/scroll-area/ScrollArea.stories.jsx +123 -0
  241. package/dist/stories/segmented-control/SegmentedControl.stories.d.ts +97 -0
  242. package/dist/stories/segmented-control/SegmentedControl.stories.jsx +101 -0
  243. package/dist/stories/select/Select.stories.d.ts +116 -0
  244. package/dist/stories/select/Select.stories.jsx +149 -0
  245. package/dist/stories/separator/Separator.stories.d.ts +93 -0
  246. package/dist/stories/separator/Separator.stories.jsx +106 -0
  247. package/dist/stories/skeleton/Skeleton.stories.d.ts +88 -0
  248. package/dist/stories/skeleton/Skeleton.stories.jsx +119 -0
  249. package/dist/stories/slider/Slider.stories.d.ts +114 -0
  250. package/dist/stories/slider/Slider.stories.jsx +94 -0
  251. package/dist/stories/spinner/Spinner.stories.d.ts +83 -0
  252. package/dist/stories/spinner/Spinner.stories.jsx +112 -0
  253. package/dist/stories/switch/Switch.stories.d.ts +146 -0
  254. package/dist/stories/switch/Switch.stories.jsx +119 -0
  255. package/dist/stories/tab-nav/TabNav.stories.d.ts +55 -0
  256. package/dist/stories/tab-nav/TabNav.stories.jsx +68 -0
  257. package/dist/stories/table/Table.stories.d.ts +87 -0
  258. package/dist/stories/table/Table.stories.jsx +106 -0
  259. package/dist/stories/tabs/Tabs.stories.d.ts +55 -0
  260. package/dist/stories/tabs/Tabs.stories.jsx +76 -0
  261. package/dist/stories/text/Text.stories.d.ts +74 -0
  262. package/dist/stories/text/Text.stories.jsx +91 -0
  263. package/dist/stories/textArea/TextArea.stories.d.ts +117 -0
  264. package/dist/stories/textArea/TextArea.stories.jsx +112 -0
  265. package/dist/stories/textfield/TextField.stories.d.ts +116 -0
  266. package/dist/stories/textfield/TextField.stories.jsx +120 -0
  267. package/dist/stories/toast/Toast.stories.d.ts +138 -0
  268. package/dist/stories/toast/Toast.stories.jsx +122 -0
  269. package/dist/stories/toggle/Toggle.stories.d.ts +115 -0
  270. package/dist/stories/toggle/Toggle.stories.jsx +106 -0
  271. package/dist/stories/toggle/ToggleGroup.stories.d.ts +103 -0
  272. package/dist/stories/toggle/ToggleGroup.stories.jsx +127 -0
  273. package/dist/stories/tooltip/Tooltip.stories.d.ts +93 -0
  274. package/dist/stories/tooltip/Tooltip.stories.jsx +91 -0
  275. package/dist/tsconfig.tsbuildinfo +1 -0
  276. package/dist/types.d.ts +11 -0
  277. package/dist/types.js +1 -0
  278. package/dist/utils/utils.d.ts +3 -0
  279. package/dist/utils/utils.js +27 -0
  280. package/package.json +118 -119
package/README.md CHANGED
@@ -1,163 +1,163 @@
1
- # radix-ui 라이브러리 활용 Storybook UI Component 만들기
2
-
3
- <br />
4
-
5
- ## 사전 설치 라이브러리
6
-
7
- - radix-ui
8
- - 주요 컴포넌트 사용 시 활용할 Headless UI 라이브러리
9
-
10
- ```shell
11
- npm install @radix-ui/react-popover@latest -E
12
- ```
13
-
14
- - storybook
15
- - 컴포넌트 관리를 위해 사용
16
-
17
- ```shell
18
- npx sb init
19
- npx storybook@latest add @storybook/addon-styling-webpack
20
- ```
21
-
22
- - clsx
23
- - 조건부 className 작성을 위해 사용
24
-
25
- ```shell
26
- npm i clsx
27
- ```
28
-
29
- - tailwind-merge
30
- - 스타일 충돌 없이 자바스크립트에서 tailwind CSS 클래스를 효율적으로 병합하는 기능을 가진 라이브러리
31
-
32
- ```shell
33
- npm i tailwind-merge
34
- ```
35
-
36
- - class-variance-authority (CVA)
37
- - 일관성 있는 UI를 정의하고 사용할 수 있도록 도와주는 툴로써 shadcn/ui 컴포넌트의 핵심 도구
38
-
39
- ```shell
40
- npm i class-variance-authority
41
- ```
42
-
43
- <br />
44
-
45
- ## 실행
46
-
47
- - 스토리북 실행
48
-
49
- ```shell
50
- npm run storybook
51
- ```
52
-
53
- > 접속주소(포트 6006 사용 시): `http://localhost:6006`
54
-
55
- - 웹페이지 실행
56
-
57
- ```shell
58
- npm run dev
59
- ```
60
-
61
- > 접속주소(포트 3000 사용 시): `http://localhost:3000`
62
-
63
- ## package publish
64
-
65
- - 타입스크립트 컴파일
66
-
67
- ```shell
68
- npm run publish:npm
69
- ```
70
-
71
- - npm package 배포 시
72
-
73
- - npm 로그인
74
-
75
- ```shell
76
- npm login
77
- ```
78
-
79
- - package.json 버전 수정 후 컴파일 진행
80
-
81
- ```shell
82
- npm run publish:npm
83
- ```
84
-
85
- - 패키지 배포
86
-
87
- ```shell
88
- npm publish
89
- ```
90
-
91
- - npm scope 배포
92
- - npm 로그인 후, 조직 생성 시 @계정명 으로 scope 생성
93
- scope로 생성된 패키지는 npm publish 시, 아래 옵션 추가
94
-
95
- ```shell
96
- npm publish --access=public
97
- ```
98
-
99
-
100
- - npm package 미배포시
101
-
102
- - package.json 버전 수정 후 컴파일 진행
103
-
104
- ```shell
105
- npm run publish:npm
106
- ```
107
-
108
- - dist/ 파일 및 설정파일 추출 후 전달
109
-
110
- ## 사용자 이용 방법
111
-
112
- ### npm 배포 시
113
-
114
- - npm package 설치
115
-
116
- ```sh
117
- npm install <package_name>
118
- ```
119
-
120
- ### npm 미배포시
121
-
122
- - 전달 받은 package 모듈 파일을 node_modules/ 폴더에 추가
123
-
124
- ### tailwind 설정 방법
125
-
126
- - tailwind config 파일 설정
127
-
128
- ```js
129
- // tailwind.config.ts
130
- import type { Config } from 'tailwindcss';
131
- // UI 라이브러리 tailwind config 파일 호출
132
- // >>>>>>>> 추가
133
- const packageTailwindConfig = require('ui-component-test/tailwind.config.js');
134
- // >>>>>>>>
135
-
136
- const config: Config = {
137
- content: [
138
- './src/pages/**/*.{js,ts,jsx,tsx,mdx,zip}',
139
- './src/components/**/*.{js,ts,jsx,tsx,mdx,zip}',
140
- './src/app/**/*.{js,ts,jsx,tsx,mdx,zip}',
141
- // 해당 프로젝트 css 표준 컴포넌트에 적용 가능
142
- // >>>>>>>> 추가
143
- './node_modules/ui-component-test/**/*.{js,ts,jsx,tsx,mdx,zip}',
144
- // >>>>>>>>
145
- ],
146
- theme: {
147
- extend: {
148
- backgroundImage: {
149
- 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
150
- 'gradient-conic': 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
151
- },
152
- colors: {},
153
- // UI 라이브러리 tailwind config 파일 적용
154
- // >>>>>>>> 추가
155
- ...packageTailwindConfig?.theme?.extend,
156
- // >>>>>>>>
157
- },
158
- },
159
- plugins: [],
160
- };
161
- export default config;
162
-
163
- ```
1
+ # radix-ui 라이브러리 활용 Storybook UI Component 만들기
2
+
3
+ <br />
4
+
5
+ ## 사전 설치 라이브러리
6
+
7
+ - radix-ui
8
+ - 주요 컴포넌트 사용 시 활용할 Headless UI 라이브러리
9
+
10
+ ```shell
11
+ npm install @radix-ui/react-popover@latest -E
12
+ ```
13
+
14
+ - storybook
15
+ - 컴포넌트 관리를 위해 사용
16
+
17
+ ```shell
18
+ npx sb init
19
+ npx storybook@latest add @storybook/addon-styling-webpack
20
+ ```
21
+
22
+ - clsx
23
+ - 조건부 className 작성을 위해 사용
24
+
25
+ ```shell
26
+ npm i clsx
27
+ ```
28
+
29
+ - tailwind-merge
30
+ - 스타일 충돌 없이 자바스크립트에서 tailwind CSS 클래스를 효율적으로 병합하는 기능을 가진 라이브러리
31
+
32
+ ```shell
33
+ npm i tailwind-merge
34
+ ```
35
+
36
+ - class-variance-authority (CVA)
37
+ - 일관성 있는 UI를 정의하고 사용할 수 있도록 도와주는 툴로써 shadcn/ui 컴포넌트의 핵심 도구
38
+
39
+ ```shell
40
+ npm i class-variance-authority
41
+ ```
42
+
43
+ <br />
44
+
45
+ ## 실행
46
+
47
+ - 스토리북 실행
48
+
49
+ ```shell
50
+ npm run storybook
51
+ ```
52
+
53
+ > 접속주소(포트 6006 사용 시): `http://localhost:6006`
54
+
55
+ - 웹페이지 실행
56
+
57
+ ```shell
58
+ npm run dev
59
+ ```
60
+
61
+ > 접속주소(포트 3000 사용 시): `http://localhost:3000`
62
+
63
+ ## package publish
64
+
65
+ - 타입스크립트 컴파일
66
+
67
+ ```shell
68
+ npm run publish:npm
69
+ ```
70
+
71
+ - npm package 배포 시
72
+
73
+ - npm 로그인
74
+
75
+ ```shell
76
+ npm login
77
+ ```
78
+
79
+ - package.json 버전 수정 후 컴파일 진행
80
+
81
+ ```shell
82
+ npm run publish:npm
83
+ ```
84
+
85
+ - 패키지 배포
86
+
87
+ ```shell
88
+ npm publish
89
+ ```
90
+
91
+ - npm scope 배포
92
+ - npm 로그인 후, 조직 생성 시 @계정명 으로 scope 생성
93
+ scope로 생성된 패키지는 npm publish 시, 아래 옵션 추가
94
+
95
+ ```shell
96
+ npm publish --access=public
97
+ ```
98
+
99
+
100
+ - npm package 미배포시
101
+
102
+ - package.json 버전 수정 후 컴파일 진행
103
+
104
+ ```shell
105
+ npm run publish:npm
106
+ ```
107
+
108
+ - dist/ 파일 및 설정파일 추출 후 전달
109
+
110
+ ## 사용자 이용 방법
111
+
112
+ ### npm 배포 시
113
+
114
+ - npm package 설치
115
+
116
+ ```sh
117
+ npm install <package_name>
118
+ ```
119
+
120
+ ### npm 미배포시
121
+
122
+ - 전달 받은 package 모듈 파일을 node_modules/ 폴더에 추가
123
+
124
+ ### tailwind 설정 방법
125
+
126
+ - tailwind config 파일 설정
127
+
128
+ ```js
129
+ // tailwind.config.ts
130
+ import type { Config } from 'tailwindcss';
131
+ // UI 라이브러리 tailwind config 파일 호출
132
+ // >>>>>>>> 추가
133
+ const packageTailwindConfig = require('ui-component-test/tailwind.config.js');
134
+ // >>>>>>>>
135
+
136
+ const config: Config = {
137
+ content: [
138
+ './src/pages/**/*.{js,ts,jsx,tsx,mdx,zip}',
139
+ './src/components/**/*.{js,ts,jsx,tsx,mdx,zip}',
140
+ './src/app/**/*.{js,ts,jsx,tsx,mdx,zip}',
141
+ // 해당 프로젝트 css 표준 컴포넌트에 적용 가능
142
+ // >>>>>>>> 추가
143
+ './node_modules/ui-component-test/**/*.{js,ts,jsx,tsx,mdx,zip}',
144
+ // >>>>>>>>
145
+ ],
146
+ theme: {
147
+ extend: {
148
+ backgroundImage: {
149
+ 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
150
+ 'gradient-conic': 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
151
+ },
152
+ colors: {},
153
+ // UI 라이브러리 tailwind config 파일 적용
154
+ // >>>>>>>> 추가
155
+ ...packageTailwindConfig?.theme?.extend,
156
+ // >>>>>>>>
157
+ },
158
+ },
159
+ plugins: [],
160
+ };
161
+ export default config;
162
+
163
+ ```
@@ -0,0 +1,13 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import React from 'react';
3
+ import { IColor } from '../../types';
4
+ export interface HeaderProps extends VariantProps<typeof headerVariants> {
5
+ color?: IColor;
6
+ }
7
+ declare let headerVariants: (props?: ({
8
+ weight?: "regular" | "medium" | "semibold" | "bold" | null | undefined;
9
+ headers?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null | undefined;
10
+ color?: string | null | undefined;
11
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
12
+ export declare const Header: React.ForwardRefExoticComponent<Omit<import("@radix-ui/themes").HeadingProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & HeaderProps & React.RefAttributes<HTMLHeadingElement>>;
13
+ export default Header;
@@ -0,0 +1,58 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { cn } from '../../utils/utils';
24
+ import { cva } from 'class-variance-authority';
25
+ import { textColorStyle, weightVariants } from '../../constants';
26
+ import { Heading as HeadingTheme, Theme } from '@radix-ui/themes';
27
+ import React from 'react';
28
+ var weights = __assign({}, weightVariants);
29
+ var headers = {
30
+ h1: 'h1',
31
+ h2: 'h2',
32
+ h3: 'h3',
33
+ h4: 'h4',
34
+ h5: 'h5',
35
+ h6: 'h6',
36
+ };
37
+ var headerVariants = cva('', {
38
+ variants: {
39
+ weight: weights,
40
+ headers: headers,
41
+ color: textColorStyle(),
42
+ },
43
+ defaultVariants: {
44
+ color: 'black',
45
+ },
46
+ });
47
+ export var Header = React.forwardRef(function (_a, ref) {
48
+ var className = _a.className, children = _a.children, size = _a.size, weight = _a.weight, color = _a.color, headers = _a.headers, align = _a.align, rootProps = __rest(_a, ["className", "children", "size", "weight", "color", "headers", "align"]);
49
+ if (!headers)
50
+ headers = 'h1';
51
+ return (<Theme>
52
+ <HeadingTheme ref={ref} as={headers} size={size} align={align} className={cn('leading-normal', headerVariants({ weight: weight, color: color }), className)} {...rootProps}>
53
+ {children}
54
+ </HeadingTheme>
55
+ </Theme>);
56
+ });
57
+ Header.displayName = 'Header';
58
+ export default Header;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import { IColor } from '../../types';
4
+ import { ITypoSize } from '../../types';
5
+ export interface TextProps extends VariantProps<typeof textVariants> {
6
+ color?: IColor;
7
+ size?: ITypoSize;
8
+ as?: 'span' | 'div' | 'label' | 'p';
9
+ align?: 'left' | 'center' | 'right';
10
+ }
11
+ declare const textVariants: (props?: ({
12
+ weight?: "regular" | "medium" | "semibold" | "bold" | "light" | null | undefined;
13
+ color?: string | null | undefined;
14
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
15
+ export declare const Text: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & TextProps & React.RefAttributes<HTMLSpanElement>>;
16
+ export default Text;
@@ -0,0 +1,47 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React, { forwardRef } from 'react';
24
+ import { cva } from 'class-variance-authority';
25
+ import { Text as TextTheme, Theme } from '@radix-ui/themes';
26
+ import { textColorStyle, weightVariants } from '../../constants';
27
+ import { cn } from '../../utils/utils';
28
+ var textVariants = cva('text', {
29
+ variants: {
30
+ weight: __assign({ light: 'font-light' }, weightVariants),
31
+ color: textColorStyle(),
32
+ },
33
+ defaultVariants: {
34
+ weight: 'medium',
35
+ color: 'black',
36
+ },
37
+ });
38
+ export var Text = forwardRef(function (_a, ref) {
39
+ var className = _a.className, children = _a.children, as = _a.as, align = _a.align, weight = _a.weight, color = _a.color, size = _a.size, props = __rest(_a, ["className", "children", "as", "align", "weight", "color", "size"]);
40
+ return (<Theme>
41
+ <TextTheme as={as} ref={ref} size={size} align={align} className={cn(textVariants({ weight: weight, color: color }), className)} {...props}>
42
+ {children}
43
+ </TextTheme>
44
+ </Theme>);
45
+ });
46
+ Text.displayName = 'Text';
47
+ export default Text;
@@ -0,0 +1,2 @@
1
+ export { default as Header } from './Header';
2
+ export { default as Text } from './Text';
@@ -0,0 +1,2 @@
1
+ export { default as Header } from '../Typography/Header';
2
+ export { default as Text } from '../Typography/Text';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import type { Metadata } from 'next';
3
+ import './globals.css';
4
+ export declare const metadata: Metadata;
5
+ export default function RootLayout({ children, }: Readonly<{
6
+ children: React.ReactNode;
7
+ }>): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { Inter } from 'next/font/google';
2
+ import './globals.css';
3
+ var inter = Inter({ subsets: ['latin'] });
4
+ export var metadata = {
5
+ title: 'Create Next App',
6
+ description: 'Generated by create next app',
7
+ };
8
+ export default function RootLayout(_a) {
9
+ var children = _a.children;
10
+ return (<html lang="en">
11
+ <body className={inter.className}>{children}</body>
12
+ </html>);
13
+ }
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function Home(): false | React.JSX.Element;
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ import React, { useEffect, useState } from 'react';
3
+ import Theme from './template/theme';
4
+ import BadgeTemplate from './template/badgeTemplate';
5
+ import ButtonTemplate from './template/buttonTemplate';
6
+ import TextTemplate from './template/textTemplate';
7
+ import Button from 'components/Button';
8
+ import { Toast, ToastActionButton, ToastDescription } from 'components/Toast';
9
+ export default function Home() {
10
+ var _a = useState('full'), radiusTheme = _a[0], setRadiusTheme = _a[1];
11
+ var _b = useState('95%'), scalingTheme = _b[0], setScalingTheme = _b[1];
12
+ var _c = useState('semibold'), fontWeightTheme = _c[0], setFontWeightTheme = _c[1];
13
+ var _d = useState('blue'), colorTheme = _d[0], setColorTheme = _d[1];
14
+ var _e = useState('blue'), fontColorTheme = _e[0], setFontColorTheme = _e[1];
15
+ var _f = useState('light'), mode = _f[0], setMode = _f[1];
16
+ var _g = useState(false), mounted = _g[0], setMounted = _g[1];
17
+ var _h = useState(false), open = _h[0], setOpen = _h[1];
18
+ useEffect(function () {
19
+ setMounted(true);
20
+ }, []);
21
+ return (mounted && (<div className={"flex flex-col w-full h-auto min-h-screen ".concat(mode == 'light' ? 'bg-white text-black' : 'bg-black text-white', " p-3")}>
22
+ <div onClick={function () {
23
+ setMode(mode === 'light' ? 'dark' : 'light');
24
+ }}>
25
+ {mode === 'light' ? 'light' : 'dark'}
26
+ </div>
27
+ <Button onClick={function () { return setOpen(true); }} className="w-[200px]" scaling={'95%'}>
28
+ toast
29
+ </Button>
30
+ <Toast openToast={open} setOpenToast={setOpen}>
31
+ <ToastDescription>There was a problem with your request.</ToastDescription>
32
+ <ToastActionButton altText="액션버튼">버튼</ToastActionButton>
33
+ </Toast>
34
+ <Theme setRadiusTheme={setRadiusTheme} setScalingTheme={setScalingTheme} setFontWeightTheme={setFontWeightTheme} setColorTheme={setColorTheme} setFontColorTheme={setFontColorTheme} mode={mode}/>
35
+
36
+ <BadgeTemplate radiusTheme={radiusTheme} scalingTheme={scalingTheme} fontWeightTheme={fontWeightTheme} colorTheme={colorTheme} mode={mode}/>
37
+
38
+ <ButtonTemplate radiusTheme={radiusTheme} scalingTheme={scalingTheme} fontWeightTheme={fontWeightTheme} colorTheme={colorTheme} mode={mode}/>
39
+
40
+ <TextTemplate scalingTheme={scalingTheme} fontWeightTheme={fontWeightTheme} colorTheme={fontColorTheme} mode={mode}/>
41
+ </div>));
42
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import 'react-tabs/style/react-tabs.css';
3
+ import { ITheme, IColor, IRadius, IScaling, IWeight } from 'types';
4
+ type IBadgeTemplate = {
5
+ radiusTheme: IRadius;
6
+ scalingTheme: IScaling;
7
+ fontWeightTheme: IWeight;
8
+ colorTheme: IColor;
9
+ mode: ITheme;
10
+ };
11
+ declare const BadgeTemplate: ({ radiusTheme, scalingTheme, fontWeightTheme, colorTheme, mode, }: IBadgeTemplate) => React.JSX.Element;
12
+ export default BadgeTemplate;
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+ import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
3
+ import 'react-tabs/style/react-tabs.css';
4
+ import { radiusOptions, scalingOptions } from '../../constants';
5
+ import Badge from 'components/Badge';
6
+ import { colorOptions } from 'color/constants';
7
+ var BadgeTemplate = function (_a) {
8
+ var radiusTheme = _a.radiusTheme, scalingTheme = _a.scalingTheme, fontWeightTheme = _a.fontWeightTheme, colorTheme = _a.colorTheme, mode = _a.mode;
9
+ return (<div className="m-3">
10
+ <div className=" font-extrabold">Badge</div>
11
+ <div className="">
12
+ <div className="border p-2 space-x-2">
13
+ <Tabs className="">
14
+ <TabList>
15
+ <Tab>Theme colors</Tab>
16
+ <Tab>All colors</Tab>
17
+ <Tab>All sizes</Tab>
18
+ </TabList>
19
+ <TabPanel>
20
+ <p className="">Main Color 적용 뱃지</p>
21
+ <Badge radius={radiusTheme} scaling={scalingTheme} color={colorTheme}>
22
+ Badge
23
+ </Badge>
24
+ <Badge radius={radiusTheme} scaling={scalingTheme} color={colorTheme}>
25
+ outline
26
+ </Badge>
27
+ </TabPanel>
28
+ <TabPanel>
29
+ <table>
30
+ <tr>
31
+ <th></th>
32
+ <th>default</th>
33
+ <th>outline</th>
34
+ </tr>
35
+ {colorOptions === null || colorOptions === void 0 ? void 0 : colorOptions.map(function (color) { return (<tr key={color}>
36
+ <th>{color}</th>
37
+ <td>
38
+ <Badge radius={radiusTheme} scaling={scalingTheme} color={color}>
39
+ Badge
40
+ </Badge>
41
+ </td>
42
+ <td>
43
+ <Badge radius={radiusTheme} scaling={scalingTheme} color={color}>
44
+ outline
45
+ </Badge>
46
+ </td>
47
+ </tr>); })}
48
+ </table>
49
+ </TabPanel>
50
+ <TabPanel>
51
+ <table>
52
+ <tr>
53
+ <th></th>
54
+ {radiusOptions.map(function (radius) { return (<th key={radius}>{radius}</th>); })}
55
+ </tr>
56
+ {scalingOptions.map(function (scale) { return (<tr key={scale}>
57
+ <th>{scale}</th>
58
+ {radiusOptions.map(function (radius) { return (<td key={radius}>
59
+ <Badge scaling={scale} radius={radius} color={colorTheme}>
60
+ Badge
61
+ </Badge>
62
+ </td>); })}
63
+ </tr>); })}
64
+ </table>
65
+
66
+ <table>
67
+ {scalingOptions.map(function (scale) { return (<tr key={scale}>
68
+ <th>{scale}</th>
69
+ {radiusOptions.map(function (radius) { return (<td key={radius}>
70
+ <Badge scaling={scale} radius={radius} color={colorTheme}>
71
+ outline
72
+ </Badge>
73
+ </td>); })}
74
+ </tr>); })}
75
+ </table>
76
+ </TabPanel>
77
+ </Tabs>
78
+ </div>
79
+ </div>
80
+ </div>);
81
+ };
82
+ export default BadgeTemplate;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { ITheme, IColor, IRadius, IScaling, IWeight } from 'types';
3
+ import 'react-tabs/style/react-tabs.css';
4
+ type IButtonTemplate = {
5
+ radiusTheme: IRadius;
6
+ scalingTheme: IScaling;
7
+ fontWeightTheme: IWeight;
8
+ colorTheme: IColor;
9
+ mode: ITheme;
10
+ };
11
+ declare const ButtonTemplate: ({ radiusTheme, scalingTheme, fontWeightTheme, colorTheme, mode, }: IButtonTemplate) => React.JSX.Element;
12
+ export default ButtonTemplate;