@lunit/design-system 1.0.0-a.1 → 1.0.0-a.2

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.
Files changed (351) hide show
  1. package/dist/cjs/components/Alert/index.js +2 -0
  2. package/dist/cjs/components/Alert/index.js.map +1 -0
  3. package/dist/cjs/components/Button/index.js +2 -0
  4. package/dist/cjs/components/Button/index.js.map +1 -0
  5. package/dist/cjs/components/Checkbox/index.js +2 -0
  6. package/dist/cjs/components/Checkbox/index.js.map +1 -0
  7. package/dist/cjs/components/Chip/index.js +2 -0
  8. package/dist/cjs/components/Chip/index.js.map +1 -0
  9. package/dist/cjs/components/DataTable/index.js +2 -0
  10. package/dist/cjs/components/DataTable/index.js.map +1 -0
  11. package/dist/cjs/components/DatePicker/index.js +2 -0
  12. package/dist/cjs/components/DatePicker/index.js.map +1 -0
  13. package/dist/cjs/components/Dropdown/index.js +2 -0
  14. package/dist/cjs/components/Dropdown/index.js.map +1 -0
  15. package/dist/cjs/components/FormLabel/index.js +2 -0
  16. package/dist/cjs/components/FormLabel/index.js.map +1 -0
  17. package/dist/cjs/components/Modal/index.js +2 -0
  18. package/dist/cjs/components/Modal/index.js.map +1 -0
  19. package/dist/cjs/components/Radio/index.js +2 -0
  20. package/dist/cjs/components/Radio/index.js.map +1 -0
  21. package/dist/cjs/components/RadioGroup/index.js +2 -0
  22. package/dist/cjs/components/RadioGroup/index.js.map +1 -0
  23. package/dist/cjs/components/TextField/index.js +2 -0
  24. package/dist/cjs/components/TextField/index.js.map +1 -0
  25. package/dist/cjs/components/Toggle/index.js +2 -0
  26. package/dist/cjs/components/Toggle/index.js.map +1 -0
  27. package/dist/cjs/components/ToggleButton/index.js +2 -0
  28. package/dist/cjs/components/ToggleButton/index.js.map +1 -0
  29. package/dist/cjs/components/Tooltip/index.js +2 -0
  30. package/dist/cjs/components/Tooltip/index.js.map +1 -0
  31. package/dist/cjs/index.js +2 -0
  32. package/dist/cjs/index.js.map +1 -0
  33. package/dist/components/Alert/Alert.js +7 -0
  34. package/dist/components/Alert/Alert.js.map +1 -0
  35. package/dist/components/Alert/index.js +1 -1
  36. package/dist/components/Alert/index.js.map +1 -1
  37. package/dist/components/Button/Button.js +9 -0
  38. package/dist/components/Button/Button.js.map +1 -0
  39. package/dist/components/Button/Button.styled.js +170 -0
  40. package/dist/components/Button/Button.styled.js.map +1 -0
  41. package/dist/components/Button/Button.types.js +2 -0
  42. package/dist/components/Button/Button.types.js.map +1 -0
  43. package/dist/components/Button/const.js +3 -0
  44. package/dist/components/Button/const.js.map +1 -0
  45. package/dist/components/Button/index.js +1 -1
  46. package/dist/components/Button/index.js.map +1 -1
  47. package/dist/components/Button/utils/getButtonPaddingBySizeAndKind.js +23 -0
  48. package/dist/components/Button/utils/getButtonPaddingBySizeAndKind.js.map +1 -0
  49. package/dist/components/Button/utils/getIconButtonPaddingBySizeAndKind.js +23 -0
  50. package/dist/components/Button/utils/getIconButtonPaddingBySizeAndKind.js.map +1 -0
  51. package/dist/components/Checkbox/Checkbox.js +49 -0
  52. package/dist/components/Checkbox/Checkbox.js.map +1 -0
  53. package/dist/components/Checkbox/index.js +1 -1
  54. package/dist/components/Checkbox/index.js.map +1 -1
  55. package/dist/components/Chip/Chip.js +70 -0
  56. package/dist/components/Chip/Chip.js.map +1 -0
  57. package/dist/components/Chip/Chip.styled.js +143 -0
  58. package/dist/components/Chip/Chip.styled.js.map +1 -0
  59. package/dist/components/Chip/Chip.types.js +2 -0
  60. package/dist/components/Chip/Chip.types.js.map +1 -0
  61. package/dist/components/Chip/consts.js +8 -0
  62. package/dist/components/Chip/consts.js.map +1 -0
  63. package/dist/components/Chip/index.js +1 -1
  64. package/dist/components/Chip/index.js.map +1 -1
  65. package/dist/components/DataTable/DataTable.js +7 -0
  66. package/dist/components/DataTable/DataTable.js.map +1 -0
  67. package/dist/components/DataTable/index.js +1 -1
  68. package/dist/components/DataTable/index.js.map +1 -1
  69. package/dist/components/DatePicker/DatePicker.js +7 -0
  70. package/dist/components/DatePicker/DatePicker.js.map +1 -0
  71. package/dist/components/DatePicker/index.js +1 -1
  72. package/dist/components/DatePicker/index.js.map +1 -1
  73. package/dist/components/Dropdown/Dropdown.js +7 -0
  74. package/dist/components/Dropdown/Dropdown.js.map +1 -0
  75. package/dist/components/Dropdown/index.js +1 -1
  76. package/dist/components/Dropdown/index.js.map +1 -1
  77. package/dist/components/FormLabel/FormLabel.js +7 -0
  78. package/dist/components/FormLabel/FormLabel.js.map +1 -0
  79. package/dist/components/FormLabel/FormLabel.styled.js +8 -0
  80. package/dist/components/FormLabel/FormLabel.styled.js.map +1 -0
  81. package/dist/components/FormLabel/index.js +1 -1
  82. package/dist/components/FormLabel/index.js.map +1 -1
  83. package/dist/components/Modal/Modal.js +7 -0
  84. package/dist/components/Modal/Modal.js.map +1 -0
  85. package/dist/components/Modal/index.js +1 -1
  86. package/dist/components/Modal/index.js.map +1 -1
  87. package/dist/components/Radio/Radio.js +43 -0
  88. package/dist/components/Radio/Radio.js.map +1 -0
  89. package/dist/components/Radio/index.js +1 -1
  90. package/dist/components/Radio/index.js.map +1 -1
  91. package/dist/components/RadioGroup/index.js +2 -1
  92. package/dist/components/RadioGroup/index.js.map +1 -1
  93. package/dist/components/TextField/TextField.js +7 -0
  94. package/dist/components/TextField/TextField.js.map +1 -0
  95. package/dist/components/TextField/index.js +1 -1
  96. package/dist/components/TextField/index.js.map +1 -1
  97. package/dist/components/Toggle/Toggle.js +13 -0
  98. package/dist/components/Toggle/Toggle.js.map +1 -0
  99. package/dist/components/Toggle/Toggle.styled.js +155 -0
  100. package/dist/components/Toggle/Toggle.styled.js.map +1 -0
  101. package/dist/components/Toggle/Toggle.types.js +2 -0
  102. package/dist/components/Toggle/Toggle.types.js.map +1 -0
  103. package/dist/components/Toggle/index.js +1 -1
  104. package/dist/components/Toggle/index.js.map +1 -1
  105. package/dist/components/ToggleButton/ToggleButton.js +12 -0
  106. package/dist/components/ToggleButton/ToggleButton.js.map +1 -0
  107. package/dist/components/ToggleButton/ToggleButton.styled.js +35 -0
  108. package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -0
  109. package/dist/components/ToggleButton/ToggleButton.types.js +2 -0
  110. package/dist/components/ToggleButton/ToggleButton.types.js.map +1 -0
  111. package/dist/components/ToggleButton/index.js +1 -1
  112. package/dist/components/ToggleButton/index.js.map +1 -1
  113. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.js +7 -0
  114. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.js.map +1 -0
  115. package/dist/components/ToggleButtonGroup/index.js +2 -0
  116. package/dist/components/ToggleButtonGroup/index.js.map +1 -0
  117. package/dist/components/Tooltip/Tooltip.js +7 -0
  118. package/dist/components/Tooltip/Tooltip.js.map +1 -0
  119. package/dist/components/Tooltip/index.js +1 -1
  120. package/dist/components/Tooltip/index.js.map +1 -1
  121. package/dist/components/index.js +7 -0
  122. package/dist/components/index.js.map +1 -0
  123. package/dist/foundation/Elevation/index.js +66 -0
  124. package/dist/foundation/Elevation/index.js.map +1 -0
  125. package/dist/foundation/Elevation/utils.js +9 -0
  126. package/dist/foundation/Elevation/utils.js.map +1 -0
  127. package/dist/foundation/Typography/index.js +62 -0
  128. package/dist/foundation/Typography/index.js.map +1 -0
  129. package/dist/foundation/Typography/tokens.js +155 -0
  130. package/dist/foundation/Typography/tokens.js.map +1 -0
  131. package/dist/foundation/colors/base/blue.js +26 -0
  132. package/dist/foundation/colors/base/blue.js.map +1 -0
  133. package/dist/foundation/colors/base/green.js +26 -0
  134. package/dist/foundation/colors/base/green.js.map +1 -0
  135. package/dist/foundation/colors/base/grey.js +36 -0
  136. package/dist/foundation/colors/base/grey.js.map +1 -0
  137. package/dist/foundation/colors/base/index.js +12 -0
  138. package/dist/foundation/colors/base/index.js.map +1 -0
  139. package/dist/foundation/colors/base/lunitGreen.js +26 -0
  140. package/dist/foundation/colors/base/lunitGreen.js.map +1 -0
  141. package/dist/foundation/colors/base/lunitTeal.js +26 -0
  142. package/dist/foundation/colors/base/lunitTeal.js.map +1 -0
  143. package/dist/foundation/colors/base/magenta.js +26 -0
  144. package/dist/foundation/colors/base/magenta.js.map +1 -0
  145. package/dist/foundation/colors/base/opacity.js +7 -0
  146. package/dist/foundation/colors/base/opacity.js.map +1 -0
  147. package/dist/foundation/colors/base/orange.js +26 -0
  148. package/dist/foundation/colors/base/orange.js.map +1 -0
  149. package/dist/foundation/colors/base/purple.js +26 -0
  150. package/dist/foundation/colors/base/purple.js.map +1 -0
  151. package/dist/foundation/colors/base/red.js +26 -0
  152. package/dist/foundation/colors/base/red.js.map +1 -0
  153. package/dist/foundation/colors/base/yellow.js +26 -0
  154. package/dist/foundation/colors/base/yellow.js.map +1 -0
  155. package/dist/foundation/colors/index.js +188 -0
  156. package/dist/foundation/colors/index.js.map +1 -0
  157. package/dist/foundation/colors/token/component.js +449 -0
  158. package/dist/foundation/colors/token/component.js.map +1 -0
  159. package/dist/foundation/colors/token/core.js +199 -0
  160. package/dist/foundation/colors/token/core.js.map +1 -0
  161. package/dist/foundation/colors/token/index.js +3 -0
  162. package/dist/foundation/colors/token/index.js.map +1 -0
  163. package/dist/foundation/colors/token/types.js +2 -0
  164. package/dist/foundation/colors/token/types.js.map +1 -0
  165. package/dist/foundation/colors/types.js +2 -0
  166. package/dist/foundation/colors/types.js.map +1 -0
  167. package/dist/foundation/index.js +13 -0
  168. package/dist/foundation/index.js.map +1 -0
  169. package/dist/foundation/spacing.js +2 -0
  170. package/dist/foundation/spacing.js.map +1 -0
  171. package/dist/index.js +16 -1
  172. package/dist/index.js.map +1 -1
  173. package/dist/theme.js +34 -0
  174. package/dist/theme.js.map +1 -0
  175. package/dist/types/components/Chip/Chip.styled.d.ts +79 -0
  176. package/package.json +19 -10
  177. package/src/components/Alert/Alert.tsx +9 -0
  178. package/src/components/Alert/index.ts +1 -0
  179. package/src/components/Button/Button.styled.ts +220 -0
  180. package/src/components/Button/Button.tsx +54 -0
  181. package/src/components/Button/Button.types.ts +25 -0
  182. package/src/components/Button/const.ts +2 -0
  183. package/src/components/Button/index.ts +1 -0
  184. package/src/components/Button/utils/getButtonPaddingBySizeAndKind.ts +35 -0
  185. package/src/components/Button/utils/getIconButtonPaddingBySizeAndKind.ts +38 -0
  186. package/src/components/Checkbox/Checkbox.tsx +67 -0
  187. package/src/components/Checkbox/index.ts +1 -0
  188. package/src/components/Chip/Chip.styled.ts +162 -0
  189. package/src/components/Chip/Chip.tsx +132 -0
  190. package/src/components/Chip/Chip.types.ts +56 -0
  191. package/src/components/Chip/consts.ts +7 -0
  192. package/src/components/Chip/index.ts +1 -0
  193. package/src/components/DataTable/DataTable.tsx +8 -0
  194. package/src/components/DataTable/index.ts +1 -0
  195. package/src/components/DatePicker/DatePicker.tsx +8 -0
  196. package/src/components/DatePicker/index.ts +1 -0
  197. package/src/components/Dropdown/Dropdown.tsx +11 -0
  198. package/src/components/Dropdown/index.ts +1 -0
  199. package/src/components/FormLabel/FormLabel.styled.ts +8 -0
  200. package/src/components/FormLabel/FormLabel.tsx +9 -0
  201. package/src/components/FormLabel/index.ts +1 -0
  202. package/src/components/Modal/Modal.tsx +8 -0
  203. package/src/components/Modal/index.ts +1 -0
  204. package/src/components/Radio/Radio.tsx +58 -0
  205. package/src/components/Radio/index.ts +1 -0
  206. package/src/components/RadioGroup/index.ts +2 -0
  207. package/src/components/TextField/TextField.tsx +8 -0
  208. package/src/components/TextField/index.ts +1 -0
  209. package/src/components/Toggle/Toggle.styled.ts +162 -0
  210. package/src/components/Toggle/Toggle.tsx +18 -0
  211. package/src/components/Toggle/Toggle.types.ts +14 -0
  212. package/src/components/Toggle/index.ts +1 -0
  213. package/src/components/ToggleButton/ToggleButton.styled.ts +58 -0
  214. package/src/components/ToggleButton/ToggleButton.tsx +89 -0
  215. package/src/components/ToggleButton/ToggleButton.types.ts +28 -0
  216. package/src/components/ToggleButton/index.ts +1 -0
  217. package/src/components/ToggleButtonGroup/ToggleButtonGroup.tsx +13 -0
  218. package/src/components/ToggleButtonGroup/index.tsx +1 -0
  219. package/src/components/Tooltip/Tooltip.tsx +9 -0
  220. package/src/components/Tooltip/index.ts +1 -0
  221. package/src/components/index.ts +9 -0
  222. package/src/foundation/Elevation/index.ts +72 -0
  223. package/src/foundation/Elevation/utils.ts +11 -0
  224. package/src/foundation/Typography/index.ts +96 -0
  225. package/src/foundation/Typography/tokens.ts +162 -0
  226. package/src/foundation/colors/base/blue.ts +27 -0
  227. package/src/foundation/colors/base/green.ts +27 -0
  228. package/src/foundation/colors/base/grey.ts +36 -0
  229. package/src/foundation/colors/base/index.ts +11 -0
  230. package/src/foundation/colors/base/lunitGreen.ts +27 -0
  231. package/src/foundation/colors/base/lunitTeal.ts +27 -0
  232. package/src/foundation/colors/base/magenta.ts +27 -0
  233. package/src/foundation/colors/base/opacity.ts +6 -0
  234. package/src/foundation/colors/base/orange.ts +27 -0
  235. package/src/foundation/colors/base/purple.ts +27 -0
  236. package/src/foundation/colors/base/red.ts +27 -0
  237. package/src/foundation/colors/base/yellow.ts +27 -0
  238. package/src/foundation/colors/index.ts +235 -0
  239. package/src/foundation/colors/token/component.ts +456 -0
  240. package/src/foundation/colors/token/core.ts +204 -0
  241. package/src/foundation/colors/token/index.ts +2 -0
  242. package/src/foundation/colors/token/types.ts +8 -0
  243. package/src/foundation/colors/types.ts +85 -0
  244. package/src/foundation/index.ts +25 -0
  245. package/src/foundation/spacing.ts +3 -0
  246. package/src/index.ts +17 -0
  247. package/src/stories/components/Alert/Alert.stories.tsx +13 -0
  248. package/src/stories/components/Button/BasicButton.stories.tsx +177 -0
  249. package/src/stories/components/Button/IconButton.stories.tsx +128 -0
  250. package/src/stories/components/Button/Kind.stories.tsx +514 -0
  251. package/src/stories/components/Chip/Chip.stories.tsx +196 -0
  252. package/src/stories/components/DataTable/DataTable.stories.tsx +13 -0
  253. package/src/stories/components/DatePicker/DatePicker.stories.tsx +13 -0
  254. package/src/stories/components/Dropdown/Dropdown.stories.tsx +15 -0
  255. package/src/stories/components/Modal/Modal.stories.tsx +13 -0
  256. package/src/stories/components/SelectControl/Checkbox.stories.tsx +248 -0
  257. package/src/stories/components/SelectControl/RadioGroup.stories.tsx +67 -0
  258. package/src/stories/components/SelectControl/RadioStatus.stories.tsx +91 -0
  259. package/src/stories/components/SelectControl/Toggle.stories.tsx +429 -0
  260. package/src/stories/components/TextField/TextField.stories.tsx +13 -0
  261. package/src/stories/components/ToggleButton/Basic.stories.tsx +342 -0
  262. package/src/stories/components/ToggleButton/Group.stories.tsx +221 -0
  263. package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +698 -0
  264. package/src/stories/components/ToggleButton/WithIcon.stories.tsx +293 -0
  265. package/src/stories/components/Tooltip/Tooltip.stories.tsx +13 -0
  266. package/src/stories/foundation/Elevation/Elevation.stories.tsx +264 -0
  267. package/src/stories/foundation/Elevation/styled.ts +12 -0
  268. package/src/stories/foundation/Typography/Typography.stories.mdx +71 -0
  269. package/src/stories/foundation/Typography/Typography.stories.tsx +91 -0
  270. package/src/stories/foundation/Typography/TypographyGroup.tsx +71 -0
  271. package/src/stories/foundation/Typography/const.ts +25 -0
  272. package/src/stories/foundation/colors/Colors.stories.tsx +64 -0
  273. package/src/stories/foundation/colors/Token.inComponent.stories.tsx +167 -0
  274. package/src/stories/foundation/colors/Token.stories.tsx +190 -0
  275. package/src/stories/foundation/colors/styled.ts +39 -0
  276. package/src/theme.ts +41 -0
  277. package/src/types.d.ts +4 -0
  278. package/tsconfig.build.json +2 -0
  279. package/dist/components/Chip/Chip.styled.d.ts +0 -41
  280. package/dist/components/HelloWorld/HelloWorld.d.ts +0 -28
  281. package/webpack.config.js +0 -51
  282. /package/dist/{components → types/components}/Alert/Alert.d.ts +0 -0
  283. /package/dist/{components → types/components}/Alert/index.d.ts +0 -0
  284. /package/dist/{components → types/components}/Button/Button.d.ts +0 -0
  285. /package/dist/{components → types/components}/Button/Button.styled.d.ts +0 -0
  286. /package/dist/{components → types/components}/Button/Button.types.d.ts +0 -0
  287. /package/dist/{components → types/components}/Button/const.d.ts +0 -0
  288. /package/dist/{components → types/components}/Button/index.d.ts +0 -0
  289. /package/dist/{components → types/components}/Button/utils/getButtonPaddingBySizeAndKind.d.ts +0 -0
  290. /package/dist/{components → types/components}/Button/utils/getIconButtonPaddingBySizeAndKind.d.ts +0 -0
  291. /package/dist/{components → types/components}/Checkbox/Checkbox.d.ts +0 -0
  292. /package/dist/{components → types/components}/Checkbox/index.d.ts +0 -0
  293. /package/dist/{components → types/components}/Chip/Chip.d.ts +0 -0
  294. /package/dist/{components → types/components}/Chip/Chip.types.d.ts +0 -0
  295. /package/dist/{components → types/components}/Chip/consts.d.ts +0 -0
  296. /package/dist/{components → types/components}/Chip/index.d.ts +0 -0
  297. /package/dist/{components → types/components}/DataTable/DataTable.d.ts +0 -0
  298. /package/dist/{components → types/components}/DataTable/index.d.ts +0 -0
  299. /package/dist/{components → types/components}/DatePicker/DatePicker.d.ts +0 -0
  300. /package/dist/{components → types/components}/DatePicker/index.d.ts +0 -0
  301. /package/dist/{components → types/components}/Dropdown/Dropdown.d.ts +0 -0
  302. /package/dist/{components → types/components}/Dropdown/index.d.ts +0 -0
  303. /package/dist/{components → types/components}/FormLabel/FormLabel.d.ts +0 -0
  304. /package/dist/{components → types/components}/FormLabel/FormLabel.styled.d.ts +0 -0
  305. /package/dist/{components → types/components}/FormLabel/index.d.ts +0 -0
  306. /package/dist/{components → types/components}/Modal/Modal.d.ts +0 -0
  307. /package/dist/{components → types/components}/Modal/index.d.ts +0 -0
  308. /package/dist/{components → types/components}/Radio/Radio.d.ts +0 -0
  309. /package/dist/{components → types/components}/Radio/index.d.ts +0 -0
  310. /package/dist/{components → types/components}/RadioGroup/index.d.ts +0 -0
  311. /package/dist/{components → types/components}/TextField/TextField.d.ts +0 -0
  312. /package/dist/{components → types/components}/TextField/index.d.ts +0 -0
  313. /package/dist/{components → types/components}/Toggle/Toggle.d.ts +0 -0
  314. /package/dist/{components → types/components}/Toggle/Toggle.styled.d.ts +0 -0
  315. /package/dist/{components → types/components}/Toggle/Toggle.types.d.ts +0 -0
  316. /package/dist/{components → types/components}/Toggle/index.d.ts +0 -0
  317. /package/dist/{components → types/components}/ToggleButton/ToggleButton.d.ts +0 -0
  318. /package/dist/{components → types/components}/ToggleButton/ToggleButton.styled.d.ts +0 -0
  319. /package/dist/{components → types/components}/ToggleButton/ToggleButton.types.d.ts +0 -0
  320. /package/dist/{components → types/components}/ToggleButton/index.d.ts +0 -0
  321. /package/dist/{components → types/components}/ToggleButtonGroup/ToggleButtonGroup.d.ts +0 -0
  322. /package/dist/{components → types/components}/ToggleButtonGroup/index.d.ts +0 -0
  323. /package/dist/{components → types/components}/Tooltip/Tooltip.d.ts +0 -0
  324. /package/dist/{components → types/components}/Tooltip/index.d.ts +0 -0
  325. /package/dist/{components → types/components}/index.d.ts +0 -0
  326. /package/dist/{foundation → types/foundation}/Elevation/index.d.ts +0 -0
  327. /package/dist/{foundation → types/foundation}/Elevation/utils.d.ts +0 -0
  328. /package/dist/{foundation → types/foundation}/Typography/index.d.ts +0 -0
  329. /package/dist/{foundation → types/foundation}/Typography/tokens.d.ts +0 -0
  330. /package/dist/{foundation → types/foundation}/colors/base/blue.d.ts +0 -0
  331. /package/dist/{foundation → types/foundation}/colors/base/green.d.ts +0 -0
  332. /package/dist/{foundation → types/foundation}/colors/base/grey.d.ts +0 -0
  333. /package/dist/{foundation → types/foundation}/colors/base/index.d.ts +0 -0
  334. /package/dist/{foundation → types/foundation}/colors/base/lunitGreen.d.ts +0 -0
  335. /package/dist/{foundation → types/foundation}/colors/base/lunitTeal.d.ts +0 -0
  336. /package/dist/{foundation → types/foundation}/colors/base/magenta.d.ts +0 -0
  337. /package/dist/{foundation → types/foundation}/colors/base/opacity.d.ts +0 -0
  338. /package/dist/{foundation → types/foundation}/colors/base/orange.d.ts +0 -0
  339. /package/dist/{foundation → types/foundation}/colors/base/purple.d.ts +0 -0
  340. /package/dist/{foundation → types/foundation}/colors/base/red.d.ts +0 -0
  341. /package/dist/{foundation → types/foundation}/colors/base/yellow.d.ts +0 -0
  342. /package/dist/{foundation → types/foundation}/colors/index.d.ts +0 -0
  343. /package/dist/{foundation → types/foundation}/colors/token/component.d.ts +0 -0
  344. /package/dist/{foundation → types/foundation}/colors/token/core.d.ts +0 -0
  345. /package/dist/{foundation → types/foundation}/colors/token/index.d.ts +0 -0
  346. /package/dist/{foundation → types/foundation}/colors/token/types.d.ts +0 -0
  347. /package/dist/{foundation → types/foundation}/colors/types.d.ts +0 -0
  348. /package/dist/{foundation → types/foundation}/index.d.ts +0 -0
  349. /package/dist/{foundation → types/foundation}/spacing.d.ts +0 -0
  350. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
  351. /package/dist/{theme.d.ts → types/theme.d.ts} +0 -0
@@ -0,0 +1,79 @@
1
+ /// <reference types="react" />
2
+ import type { Theme } from "@mui/material/styles";
3
+ import type { OutlinedChipProps, BaseContainedChipProps } from "./Chip.types";
4
+ export declare const StyledOutlinedChip: import("@emotion/styled").StyledComponent<{
5
+ avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
6
+ children?: null | undefined;
7
+ classes?: Partial<import("@mui/material").ChipClasses> | undefined;
8
+ clickable?: boolean | undefined;
9
+ color?: "default" | "primary" | "secondary" | "error" | "warning" | "success" | "info" | undefined;
10
+ deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
11
+ disabled?: boolean | undefined;
12
+ icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
13
+ label?: import("react").ReactNode;
14
+ onDelete?: ((event: any) => void) | undefined;
15
+ size?: "small" | "medium" | undefined;
16
+ skipFocusWhenDisabled?: boolean | undefined;
17
+ sx?: import("@mui/material").SxProps<Theme> | undefined;
18
+ tabIndex?: number | undefined;
19
+ variant?: "outlined" | "filled" | undefined;
20
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
21
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
22
+ }, "color" | "label" | "children" | "sx" | "tabIndex" | "disabled" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled" | "variant"> & import("@mui/system").MUIStyledCommonProps<Theme> & OutlinedChipProps, {}, {}>;
23
+ export declare const StyledContainedChipBase: import("@emotion/styled").StyledComponent<{
24
+ avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
25
+ children?: null | undefined;
26
+ classes?: Partial<import("@mui/material").ChipClasses> | undefined;
27
+ clickable?: boolean | undefined;
28
+ color?: "default" | "primary" | "secondary" | "error" | "warning" | "success" | "info" | undefined;
29
+ deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
30
+ disabled?: boolean | undefined;
31
+ icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
32
+ label?: import("react").ReactNode;
33
+ onDelete?: ((event: any) => void) | undefined;
34
+ size?: "small" | "medium" | undefined;
35
+ skipFocusWhenDisabled?: boolean | undefined;
36
+ sx?: import("@mui/material").SxProps<Theme> | undefined;
37
+ tabIndex?: number | undefined;
38
+ variant?: "outlined" | "filled" | undefined;
39
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
40
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
41
+ }, "color" | "label" | "children" | "sx" | "tabIndex" | "disabled" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled" | "variant"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
42
+ export declare const StyledContainedChipEnable: import("@emotion/styled").StyledComponent<{
43
+ avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
44
+ children?: null | undefined;
45
+ classes?: Partial<import("@mui/material").ChipClasses> | undefined;
46
+ clickable?: boolean | undefined;
47
+ color?: "default" | "primary" | "secondary" | "error" | "warning" | "success" | "info" | undefined;
48
+ deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
49
+ disabled?: boolean | undefined;
50
+ icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
51
+ label?: import("react").ReactNode;
52
+ onDelete?: ((event: any) => void) | undefined;
53
+ size?: "small" | "medium" | undefined;
54
+ skipFocusWhenDisabled?: boolean | undefined;
55
+ sx?: import("@mui/material").SxProps<Theme> | undefined;
56
+ tabIndex?: number | undefined;
57
+ variant?: "outlined" | "filled" | undefined;
58
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
59
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
60
+ }, "color" | "label" | "children" | "sx" | "tabIndex" | "disabled" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled" | "variant"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
61
+ export declare const StyledContainedChipDeletable: import("@emotion/styled").StyledComponent<{
62
+ avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
63
+ children?: null | undefined;
64
+ classes?: Partial<import("@mui/material").ChipClasses> | undefined;
65
+ clickable?: boolean | undefined;
66
+ color?: "default" | "primary" | "secondary" | "error" | "warning" | "success" | "info" | undefined;
67
+ deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
68
+ disabled?: boolean | undefined;
69
+ icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
70
+ label?: import("react").ReactNode;
71
+ onDelete?: ((event: any) => void) | undefined;
72
+ size?: "small" | "medium" | undefined;
73
+ skipFocusWhenDisabled?: boolean | undefined;
74
+ sx?: import("@mui/material").SxProps<Theme> | undefined;
75
+ tabIndex?: number | undefined;
76
+ variant?: "outlined" | "filled" | undefined;
77
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
78
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
79
+ }, "color" | "label" | "children" | "sx" | "tabIndex" | "disabled" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled" | "variant"> & import("@mui/system").MUIStyledCommonProps<Theme> & BaseContainedChipProps, {}, {}>;
package/package.json CHANGED
@@ -1,24 +1,30 @@
1
1
  {
2
2
  "name": "@lunit/design-system",
3
- "version": "1.0.0-a.1",
3
+ "version": "1.0.0-a.2",
4
4
  "description": "Lunit Design System",
5
- "main": "dist/index.js",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/index.js",
7
+ "sideEffects": false,
6
8
  "exports": {
7
9
  ".": {
8
- "types": "./dist/index.d.ts",
9
- "default": "./dist/index.js"
10
+ "types": "./dist/types/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/cjs/index.js",
13
+ "default": "./dist/cjs/index.js"
10
14
  },
11
15
  "./*": {
12
- "types": "./dist/components/*/index.d.ts",
13
- "default": "./dist/components/*/index.js"
16
+ "types": "./dist/types/components/*/index.d.ts",
17
+ "import": "./dist/components/*/index.js",
18
+ "require": "./dist/cjs/components/*/index.js",
19
+ "default": "./dist/cjs/components/*/index.js"
14
20
  }
15
21
  },
16
- "types": "dist/index.d.ts",
22
+ "types": "dist/types/index.d.ts",
17
23
  "typesVersions": {
18
24
  "*": {
19
25
  "*": [
20
- "dist/components/*/index.d.ts",
21
- "dist/index.d.ts"
26
+ "dist/types/components/*/index.d.ts",
27
+ "dist/types/index.d.ts"
22
28
  ]
23
29
  }
24
30
  },
@@ -29,7 +35,9 @@
29
35
  "directory": "packages/design-system"
30
36
  },
31
37
  "scripts": {
32
- "build": "webpack",
38
+ "build:prepare": "tsc -p tsconfig.build.json",
39
+ "build:cjs": "webpack -c webpack/cjs.config.js",
40
+ "build": "yarn build:prepare && yarn build:cjs",
33
41
  "storybook": "start-storybook -p 6006",
34
42
  "build-storybook": "build-storybook",
35
43
  "chromatic": "chromatic"
@@ -48,6 +56,7 @@
48
56
  "@emotion/react": "^11.9.0",
49
57
  "@emotion/styled": "^11.8.1",
50
58
  "@mui/material": "^5.11.3",
59
+ "@mui/utils": "^5.11.3",
51
60
  "@mui/x-date-pickers": "^5.0.16",
52
61
  "@storybook/addon-actions": "^6.4.22",
53
62
  "@storybook/addon-essentials": "^6.4.22",
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+
3
+ import { Box } from "@mui/material";
4
+
5
+ const Alert = () => {
6
+ return <Box>Alert</Box>;
7
+ };
8
+
9
+ export default Alert;
@@ -0,0 +1 @@
1
+ export { default } from "./Alert";
@@ -0,0 +1,220 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { Button as MuiButton } from "@mui/material";
3
+
4
+ import { ColorToken } from "@/foundation/colors/types";
5
+ import { PADDING_OF_FOCUS, OUTLINED_BORDER_WIDTH } from "./const";
6
+ import { getButtonPaddingBySizeAndKind } from "./utils/getButtonPaddingBySizeAndKind";
7
+ import { getIconButtonPaddingBySizeAndKind } from "./utils/getIconButtonPaddingBySizeAndKind";
8
+
9
+ import type { ButtonProps } from "./Button.types";
10
+ import type { ToggleButtonProps } from "../ToggleButton/ToggleButton.types";
11
+ import type { Typography } from "@mui/material/styles/createTypography";
12
+
13
+ type KindStyleParams = Pick<ButtonProps, "kind" | "color"> & {
14
+ token: ColorToken;
15
+ };
16
+
17
+ type CustomButtonProps = ButtonProps & { hasIconOnly: boolean };
18
+
19
+ type sizeStyleParams = Pick<
20
+ CustomButtonProps,
21
+ "size" | "hasIconOnly" | "kind"
22
+ > &
23
+ Pick<ToggleButtonProps, "selected"> & { typography: Typography };
24
+
25
+ export const sizeStyle = ({
26
+ size,
27
+ kind,
28
+ hasIconOnly,
29
+ typography,
30
+ selected = false,
31
+ }: sizeStyleParams) => ({
32
+ ...(size === "small" && {
33
+ ...typography.button2,
34
+ padding: `${
35
+ hasIconOnly
36
+ ? getIconButtonPaddingBySizeAndKind({ kind, size, selected })
37
+ : getButtonPaddingBySizeAndKind({ kind, size, selected })
38
+ }`,
39
+ minWidth: "28px",
40
+ minHeight: "28px",
41
+ }),
42
+ ...(size === "medium" && {
43
+ ...typography.button2,
44
+ padding: `${
45
+ hasIconOnly
46
+ ? getIconButtonPaddingBySizeAndKind({ kind, size, selected })
47
+ : getButtonPaddingBySizeAndKind({ kind, size, selected })
48
+ }`,
49
+ minWidth: "36px",
50
+ minHeight: "36px",
51
+ }),
52
+ ...(size === "large" && {
53
+ ...typography.button1,
54
+ padding: `${
55
+ hasIconOnly
56
+ ? getIconButtonPaddingBySizeAndKind({ kind, size, selected })
57
+ : getButtonPaddingBySizeAndKind({ kind, size, selected })
58
+ }`,
59
+ minWidth: "44px",
60
+ minHeight: "44px",
61
+ }),
62
+ });
63
+
64
+ export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
65
+ // kind: container
66
+ ...(kind === "contained" &&
67
+ color === "primary" && {
68
+ color: token.component.btn_contained_primary_text,
69
+ backgroundColor: token.component.btn_contained_primary_bg,
70
+ "&:hover": {
71
+ backgroundColor: token.component.btn_contained_primary_bg,
72
+ },
73
+ "&.Mui-disabled": {
74
+ opacity: 0.38,
75
+ border: "none",
76
+ color: token.component.btn_contained_primary_text,
77
+ },
78
+ }),
79
+ ...(kind === "contained" &&
80
+ color === "secondary" && {
81
+ color: token.component.btn_contained_secondary_text,
82
+ backgroundColor: token.component.btn_contained_secondary_bg,
83
+ "&:hover": {
84
+ backgroundColor: token.component.btn_contained_secondary_bg,
85
+ },
86
+ "&.Mui-disabled": {
87
+ opacity: 0.38,
88
+ border: "none",
89
+ color: token.component.btn_contained_secondary_text,
90
+ },
91
+ }),
92
+ ...(kind === "contained" &&
93
+ color === "error" && {
94
+ color: token.component.btn_contained_error_text,
95
+ backgroundColor: token.component.btn_contained_error_bg,
96
+ "&:hover": {
97
+ backgroundColor: token.component.btn_contained_error_bg,
98
+ },
99
+ "&.Mui-disabled": {
100
+ opacity: 0.38,
101
+ border: "none",
102
+ color: token.component.btn_contained_error_text,
103
+ },
104
+ }),
105
+ // kind: ghost
106
+ ...(kind === "ghost" &&
107
+ color === "primary" && {
108
+ color: token.component.btn_ghost_primary_text,
109
+ border: "none",
110
+ "&:hover": {
111
+ backgroundColor: "rgba(0, 0, 0, 0.06)",
112
+ },
113
+ "&.Mui-disabled": {
114
+ opacity: 0.38,
115
+ border: "none",
116
+ color: token.component.btn_ghost_primary_text,
117
+ },
118
+ }),
119
+ ...(kind === "ghost" &&
120
+ color === "secondary" && {
121
+ color: token.component.btn_ghost_secondary_text,
122
+ border: "none",
123
+ "&:hover": {
124
+ backgroundColor: "rgba(0, 0, 0, 0.06)",
125
+ },
126
+ "&.Mui-disabled": {
127
+ opacity: 0.38,
128
+ border: "none",
129
+ color: token.component.btn_ghost_secondary_text,
130
+ },
131
+ }),
132
+ ...(kind === "ghost" &&
133
+ color === "error" && {
134
+ color: token.component.btn_ghost_error_text,
135
+ "&:hover": {
136
+ backgroundColor: "rgba(0, 0, 0, 0.06)",
137
+ },
138
+ "&.Mui-disabled": {
139
+ opacity: 0.38,
140
+ border: "none",
141
+ color: token.component.btn_ghost_error_text,
142
+ },
143
+ }),
144
+ // kind: outlined
145
+ ...(kind === "outlined" &&
146
+ color === "primary" && {
147
+ color: token.component.btn_outlined_primary_text,
148
+ border: `${OUTLINED_BORDER_WIDTH}px solid ${token.component.btn_outlined_primary_border}`,
149
+ "&:hover": {
150
+ backgroundColor: "rgba(0, 0, 0, 0.06)", // TODO: color util function 추가 후 변경
151
+ },
152
+ "&.Mui-disabled": {
153
+ opacity: 0.38,
154
+ color: token.component.btn_outlined_primary_text,
155
+ },
156
+ }),
157
+ });
158
+
159
+ export const commonStyle = ({ token }: { token: ColorToken }) =>
160
+ ({
161
+ fontWeight: "500",
162
+ borderRadius: "8px",
163
+ textTransform: "initial",
164
+ "&.Mui-focusVisible": {
165
+ "&::after": {
166
+ position: "absolute",
167
+ width: `calc(100% + ${PADDING_OF_FOCUS}px)`,
168
+ height: `calc(100% + ${PADDING_OF_FOCUS}px)`,
169
+ content: '""',
170
+ borderRadius: "11px",
171
+ border: `1px solid ${token.core.focused}`,
172
+ boxSizing: "border-box",
173
+ },
174
+ },
175
+ } as const);
176
+
177
+ export const iconStyle = ({
178
+ size,
179
+ hasIconOnly,
180
+ }: Pick<CustomButtonProps, "size" | "hasIconOnly">) => ({
181
+ "& .MuiButton-startIcon": {
182
+ width: "20px",
183
+ height: "20px",
184
+ margin: 0,
185
+ marginRight: hasIconOnly ? "0px" : size === "large" ? "8px" : "4px",
186
+
187
+ // This style was added for Mui Button Svg Icon handling
188
+ "*:nth-of-type(1)": {
189
+ fontSize: "20px",
190
+ },
191
+ },
192
+ svg: {
193
+ width: "20px",
194
+ height: "20px",
195
+ margin: 0,
196
+ marginRight: hasIconOnly ? "0px" : size === "large" ? "8px" : "4px",
197
+ },
198
+ });
199
+
200
+ export const CustomButton = styled(MuiButton, {
201
+ shouldForwardProp: (prop: string) => {
202
+ return !["kind", "hasIconOnly"].includes(prop);
203
+ },
204
+ })<CustomButtonProps>(
205
+ ({
206
+ theme: {
207
+ typography,
208
+ palette: { token },
209
+ },
210
+ kind,
211
+ size,
212
+ color,
213
+ hasIconOnly,
214
+ }) => ({
215
+ ...commonStyle({ token }),
216
+ ...iconStyle({ size, hasIconOnly }),
217
+ ...sizeStyle({ size, kind, hasIconOnly, typography }),
218
+ ...kindStyle({ kind, color, token }),
219
+ })
220
+ );
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+
3
+ import { CustomButton } from "./Button.styled";
4
+
5
+ import type { ButtonProps } from "./Button.types";
6
+
7
+ const Button = (props: Omit<ButtonProps, "hasIconOnly">) => {
8
+ const {
9
+ kind = "contained",
10
+ size = "small",
11
+ color = "primary",
12
+ icon,
13
+ className,
14
+ children,
15
+ ...buttonProps
16
+ } = props;
17
+ const hasIconOnly = Boolean(icon && !children);
18
+
19
+ return (
20
+ <>
21
+ {kind === "contained" || kind === "ghost" ? (
22
+ <CustomButton
23
+ className={`${kind} ${className ? className : ""}`}
24
+ kind={kind}
25
+ color={color}
26
+ size={size}
27
+ startIcon={icon}
28
+ hasIconOnly={hasIconOnly}
29
+ disableRipple
30
+ disableFocusRipple
31
+ {...buttonProps}
32
+ >
33
+ {!hasIconOnly && <>{children}</>}
34
+ </CustomButton>
35
+ ) : (
36
+ <CustomButton
37
+ className={`outlined ${className ? className : ""}`}
38
+ kind="outlined"
39
+ color="primary"
40
+ size={size}
41
+ startIcon={icon}
42
+ hasIconOnly={hasIconOnly}
43
+ disableRipple
44
+ disableFocusRipple
45
+ {...buttonProps}
46
+ >
47
+ {!hasIconOnly && <>{children}</>}
48
+ </CustomButton>
49
+ )}
50
+ </>
51
+ );
52
+ };
53
+
54
+ export default Button;
@@ -0,0 +1,25 @@
1
+ import type { ButtonProps as MuiButtonProps } from "@mui/material";
2
+
3
+ interface BaseButtonProps extends MuiButtonProps {
4
+ icon?: React.ReactNode;
5
+ }
6
+
7
+ interface ContainedButtonProps extends Omit<BaseButtonProps, "variant"> {
8
+ kind?: "contained";
9
+ color?: "primary" | "secondary" | "error";
10
+ }
11
+
12
+ interface GhostButtonProps extends Omit<BaseButtonProps, "variant"> {
13
+ kind?: "ghost";
14
+ color?: "primary" | "secondary" | "error";
15
+ }
16
+
17
+ interface OutlinedButtonProps extends Omit<BaseButtonProps, "variant"> {
18
+ kind?: "outlined";
19
+ color?: "primary";
20
+ }
21
+
22
+ export type ButtonProps =
23
+ | ContainedButtonProps
24
+ | GhostButtonProps
25
+ | OutlinedButtonProps;
@@ -0,0 +1,2 @@
1
+ export const PADDING_OF_FOCUS = 6; // TODO: focus 시 padding 고정값, size 별 차이 여부 확인 필요
2
+ export const OUTLINED_BORDER_WIDTH = 1;
@@ -0,0 +1 @@
1
+ export { default } from "./Button";
@@ -0,0 +1,35 @@
1
+ import { OUTLINED_BORDER_WIDTH } from "../const";
2
+
3
+ import type { ButtonProps } from "../Button.types";
4
+ import { ToggleButtonProps } from "@/components/ToggleButton/ToggleButton.types";
5
+
6
+ type GetButtonPaddingBySizeAndKindParams = Pick<ButtonProps, "kind" | "size"> &
7
+ Pick<ToggleButtonProps, "selected">;
8
+
9
+ /**
10
+ * When kind is outlined,
11
+ * the padding value must include the border width of outlined.
12
+ * This function takes care of this.
13
+ */
14
+ export const getButtonPaddingBySizeAndKind = ({
15
+ kind,
16
+ size,
17
+ selected = false,
18
+ }: GetButtonPaddingBySizeAndKindParams) => {
19
+ if (size === "small") {
20
+ return kind === "outlined" && !selected
21
+ ? `${4 - OUTLINED_BORDER_WIDTH}px ${8 - OUTLINED_BORDER_WIDTH}px`
22
+ : "4px 8px";
23
+ }
24
+
25
+ if (size === "medium") {
26
+ return kind === "outlined" && !selected
27
+ ? `${8 - OUTLINED_BORDER_WIDTH}px ${12 - OUTLINED_BORDER_WIDTH}px`
28
+ : "8px 12px";
29
+ }
30
+
31
+ // size === "large"
32
+ return kind === "outlined" && !selected
33
+ ? `${10 - OUTLINED_BORDER_WIDTH}px ${12 - OUTLINED_BORDER_WIDTH}px`
34
+ : "10px 12px";
35
+ };
@@ -0,0 +1,38 @@
1
+ import { OUTLINED_BORDER_WIDTH } from "../const";
2
+
3
+ import type { ButtonProps } from "../Button.types";
4
+ import { ToggleButtonProps } from "@/components/ToggleButton/ToggleButton.types";
5
+
6
+ type GetIconButtonPaddingBySizeAndKindProps = Pick<
7
+ ButtonProps,
8
+ "kind" | "size"
9
+ > &
10
+ Pick<ToggleButtonProps, "selected">;
11
+
12
+ /**
13
+ * When kind is outlined,
14
+ * the padding value must include the border width of outlined.
15
+ * This function takes care of this.
16
+ */
17
+ export const getIconButtonPaddingBySizeAndKind = ({
18
+ kind,
19
+ size,
20
+ selected = false,
21
+ }: GetIconButtonPaddingBySizeAndKindProps) => {
22
+ if (size === "small") {
23
+ return kind === "outlined" && !selected
24
+ ? `${4 - OUTLINED_BORDER_WIDTH}px`
25
+ : "4px";
26
+ }
27
+
28
+ if (size === "medium") {
29
+ return kind === "outlined" && !selected
30
+ ? `${8 - OUTLINED_BORDER_WIDTH}px`
31
+ : "8px";
32
+ }
33
+
34
+ // size === "large"
35
+ return kind === "outlined" && !selected
36
+ ? `${12 - OUTLINED_BORDER_WIDTH}px`
37
+ : "12px";
38
+ };
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ import { styled } from "@mui/material/styles";
3
+ import MuiCheckbox from "@mui/material/Checkbox";
4
+ import type { CheckboxProps } from "@mui/material";
5
+
6
+ const CustomCheckbox = styled(MuiCheckbox)(({ theme }) => ({
7
+ width: 20,
8
+ height: 20,
9
+ padding: 1,
10
+ "&.Mui-disabled": {
11
+ opacity: 0.38,
12
+ },
13
+ "&.Mui-focusVisible:after": {
14
+ content: '""',
15
+ position: "absolute",
16
+ width: 24,
17
+ height: 24,
18
+ border: `1px solid ${theme.palette.token.core.focused}`,
19
+ borderRadius: "7px",
20
+ },
21
+ }));
22
+
23
+ const iconSize = {
24
+ width: 18,
25
+ height: 18,
26
+ };
27
+
28
+ const DefaultIcon = styled("span")(({ theme }) => ({
29
+ ...iconSize,
30
+ backgroundColor: theme.palette.token.component.selectcontrol_off,
31
+ maskImage:
32
+ "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath" +
33
+ " fill-rule='evenodd' clip-rule='evenodd' d='M14 1.5H4C2.61929 1.5 1.5 2.61929 1.5 4V14C1.5 15.3807 2.61929 16.5 4 16.5H14C15.3807 " +
34
+ "16.5 16.5 15.3807 16.5 14V4C16.5 2.61929 15.3807 1.5 14 1.5ZM4 0C1.79086 0 0 1.79086 0 4V14C0 16.2091 1.79086 18 4 18H14C16.2091 18 18 16.2091 18 14V4C18 1.79086 16.2091 0 14 0H4Z' /%3E%3C/svg%3E\")",
35
+ }));
36
+
37
+ const CheckedIcon = styled("span")(({ theme }) => ({
38
+ ...iconSize,
39
+ backgroundColor: theme.palette.token.component.selectcontrol_on,
40
+ maskImage:
41
+ "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath" +
42
+ " fill-rule='evenodd' clip-rule='evenodd' d='M4 0C1.79086 0 0 1.79086 0 4V14C0 16.2091 1.79086 18 4 18H14C16.2091 18 18 16.2091 18 14V4C18 1.79086 16.2091 0 14 0H4ZM14.2516 " +
43
+ "7.14413C14.6074 6.72168 14.5533 6.09083 14.1309 5.73508C13.7084 5.37933 13.0776 5.43341 12.7218 5.85586L8.31824 11.0851L5.14993 8.37556C4.7302 8.01661 4.09895 8.06588 3.74 8.48561C3.38105 8.90533 3.43032 9.53658 3.85005 9.89553L7.78416 13.26C7.98672 13.4332 8.25006 13.5184 8.51571 13.4967C8.78135 13.4749 9.02732 13.348 9.19901 13.1441L14.2516 7.14413Z' /%3E%3C/svg%3E\")",
44
+ }));
45
+
46
+ const IndeterminateIcon = styled("span")(({ theme }) => ({
47
+ ...iconSize,
48
+ backgroundColor: theme.palette.token.component.selectcontrol_on,
49
+ maskImage:
50
+ "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath" +
51
+ " fill-rule='evenodd' clip-rule='evenodd' d='M4 0C1.79086 0 0 1.79086 0 4V14C0 16.2091 1.79086 18 4 18H14C16.2091 18 18 16.2091 18 14V4C18 1.79086 16.2091 0 " +
52
+ "14 0H4ZM4 8C3.44772 8 3 8.44771 3 9C3 9.5523 3.44771 10 4 10H14C14.5523 10 15 9.5523 15 9C15 8.44772 14.5523 8 14 8H4Z' /%3E%3C/svg%3E\")",
53
+ }));
54
+
55
+ const Checkbox = (props: CheckboxProps) => {
56
+ return (
57
+ <CustomCheckbox
58
+ disableRipple
59
+ icon={<DefaultIcon />}
60
+ checkedIcon={<CheckedIcon />}
61
+ indeterminateIcon={<IndeterminateIcon />}
62
+ {...props}
63
+ />
64
+ );
65
+ };
66
+
67
+ export default Checkbox;
@@ -0,0 +1 @@
1
+ export { default } from "./Checkbox";