react-miui 0.20.1 → 0.22.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.
Files changed (410) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/components/form/Select.d.ts +1 -5
  3. package/dist/components/form/Select.d.ts.map +1 -1
  4. package/dist/components/form/Select.js +2 -23
  5. package/dist/components/form/Select.js.map +1 -1
  6. package/dist/components/form/Select.stories.d.ts +8 -0
  7. package/dist/components/form/Select.stories.d.ts.map +1 -0
  8. package/dist/components/form/Select.stories.js +26 -0
  9. package/dist/components/form/Select.stories.js.map +1 -0
  10. package/dist/components/{layout/list/Value.styled.d.ts → form/Select.styled.d.ts} +20 -12
  11. package/dist/components/form/Select.styled.d.ts.map +1 -0
  12. package/dist/components/form/Select.styled.js +24 -0
  13. package/dist/components/form/Select.styled.js.map +1 -0
  14. package/dist/components/form/input/Input.css.d.ts +16 -16
  15. package/dist/components/form/input/Input.css.d.ts.map +1 -1
  16. package/dist/components/form/input/Input.css.js.map +1 -1
  17. package/dist/components/form/input/Input.styled.d.ts +68 -36
  18. package/dist/components/form/input/Input.styled.d.ts.map +1 -1
  19. package/dist/components/form/textarea/TextArea.styled.d.ts +17 -9
  20. package/dist/components/form/textarea/TextArea.styled.d.ts.map +1 -1
  21. package/dist/components/icons/Icon.js +1 -2
  22. package/dist/components/icons/Icon.js.map +1 -1
  23. package/dist/components/layout/list/Header.d.ts +174 -7
  24. package/dist/components/layout/list/Header.d.ts.map +1 -1
  25. package/dist/components/layout/list/Header.js +36 -11
  26. package/dist/components/layout/list/Header.js.map +1 -1
  27. package/dist/components/layout/list/Header.stories.d.ts +8 -0
  28. package/dist/components/layout/list/Header.stories.d.ts.map +1 -0
  29. package/dist/components/layout/list/Header.stories.js +33 -0
  30. package/dist/components/layout/list/Header.stories.js.map +1 -0
  31. package/dist/components/layout/list/Item.d.ts +88 -7
  32. package/dist/components/layout/list/Item.d.ts.map +1 -1
  33. package/dist/components/layout/list/Item.js +66 -33
  34. package/dist/components/layout/list/Item.js.map +1 -1
  35. package/dist/components/layout/list/Item.stories.d.ts +10 -0
  36. package/dist/components/layout/list/Item.stories.d.ts.map +1 -0
  37. package/dist/components/layout/list/Item.stories.js +65 -0
  38. package/dist/components/layout/list/Item.stories.js.map +1 -0
  39. package/dist/components/layout/list/Label.d.ts +83 -5
  40. package/dist/components/layout/list/Label.d.ts.map +1 -1
  41. package/dist/components/layout/list/Label.js +24 -6
  42. package/dist/components/layout/list/Label.js.map +1 -1
  43. package/dist/components/layout/list/Label.stories.d.ts +8 -0
  44. package/dist/components/layout/list/Label.stories.d.ts.map +1 -0
  45. package/dist/components/layout/list/Label.stories.js +35 -0
  46. package/dist/components/layout/list/Label.stories.js.map +1 -0
  47. package/dist/components/layout/list/List.d.ts +86 -7
  48. package/dist/components/layout/list/List.d.ts.map +1 -1
  49. package/dist/components/layout/list/List.js +15 -9
  50. package/dist/components/layout/list/List.js.map +1 -1
  51. package/dist/components/layout/list/List.stories.d.ts +9 -0
  52. package/dist/components/layout/list/List.stories.d.ts.map +1 -0
  53. package/dist/components/layout/list/List.stories.js +53 -0
  54. package/dist/components/layout/list/List.stories.js.map +1 -0
  55. package/dist/components/layout/list/Value.d.ts +81 -1
  56. package/dist/components/layout/list/Value.d.ts.map +1 -1
  57. package/dist/components/layout/list/Value.js +9 -2
  58. package/dist/components/layout/list/Value.js.map +1 -1
  59. package/dist/components/layout/list/Value.stories.d.ts +8 -0
  60. package/dist/components/layout/list/Value.stories.d.ts.map +1 -0
  61. package/dist/components/layout/list/Value.stories.js +29 -0
  62. package/dist/components/layout/list/Value.stories.js.map +1 -0
  63. package/dist/components/layout/section/Section.d.ts +83 -8
  64. package/dist/components/layout/section/Section.d.ts.map +1 -1
  65. package/dist/components/layout/section/Section.js +17 -15
  66. package/dist/components/layout/section/Section.js.map +1 -1
  67. package/dist/components/layout/section/Section.stories.d.ts +8 -0
  68. package/dist/components/layout/section/Section.stories.d.ts.map +1 -0
  69. package/dist/components/layout/section/Section.stories.js +37 -0
  70. package/dist/components/layout/section/Section.stories.js.map +1 -0
  71. package/dist/components/layout/section/SectionContainer.d.ts +80 -5
  72. package/dist/components/layout/section/SectionContainer.d.ts.map +1 -1
  73. package/dist/components/layout/section/SectionContainer.js +9 -8
  74. package/dist/components/layout/section/SectionContainer.js.map +1 -1
  75. package/dist/components/ui/button/Button.d.ts +1 -7
  76. package/dist/components/ui/button/Button.d.ts.map +1 -1
  77. package/dist/components/ui/button/Button.js +2 -28
  78. package/dist/components/ui/button/Button.js.map +1 -1
  79. package/dist/components/ui/button/Button.stories.d.ts +9 -0
  80. package/dist/components/ui/button/Button.stories.d.ts.map +1 -0
  81. package/dist/components/ui/button/Button.stories.js +62 -0
  82. package/dist/components/ui/button/Button.stories.js.map +1 -0
  83. package/dist/components/ui/button/Button.styled.d.ts +85 -0
  84. package/dist/components/ui/button/Button.styled.d.ts.map +1 -0
  85. package/dist/components/ui/button/Button.styled.js +38 -0
  86. package/dist/components/ui/button/Button.styled.js.map +1 -0
  87. package/dist/components/ui/message/Message.d.ts +17 -9
  88. package/dist/components/ui/message/Message.d.ts.map +1 -1
  89. package/dist/components/ui/message/Message.styled.d.ts +17 -9
  90. package/dist/components/ui/message/Message.styled.d.ts.map +1 -1
  91. package/dist/components/ui/modal/Modal.d.ts +6 -4
  92. package/dist/components/ui/modal/Modal.d.ts.map +1 -1
  93. package/dist/components/ui/modal/Modal.js +30 -21
  94. package/dist/components/ui/modal/Modal.js.map +1 -1
  95. package/dist/components/ui/modal/Modal.stories.d.ts +10 -0
  96. package/dist/components/ui/modal/Modal.stories.d.ts.map +1 -0
  97. package/dist/components/ui/modal/Modal.stories.js +112 -0
  98. package/dist/components/ui/modal/Modal.stories.js.map +1 -0
  99. package/dist/components/ui/modal/Modal.styled.d.ts +329 -0
  100. package/dist/components/ui/modal/Modal.styled.d.ts.map +1 -0
  101. package/dist/components/ui/modal/Modal.styled.js +90 -0
  102. package/dist/components/ui/modal/Modal.styled.js.map +1 -0
  103. package/dist/components/ui/modal/ModalButtons.d.ts +1 -11
  104. package/dist/components/ui/modal/ModalButtons.d.ts.map +1 -1
  105. package/dist/components/ui/modal/ModalButtons.js +2 -12
  106. package/dist/components/ui/modal/ModalButtons.js.map +1 -1
  107. package/dist/components/ui/modal/ModalButtons.stories.d.ts +8 -0
  108. package/dist/components/ui/modal/ModalButtons.stories.d.ts.map +1 -0
  109. package/dist/components/ui/modal/ModalButtons.stories.js +25 -0
  110. package/dist/components/ui/modal/ModalButtons.stories.js.map +1 -0
  111. package/dist/components/ui/modal/ModalButtons.styled.d.ts +166 -0
  112. package/dist/components/ui/modal/ModalButtons.styled.d.ts.map +1 -0
  113. package/dist/components/ui/modal/ModalButtons.styled.js +42 -0
  114. package/dist/components/ui/modal/ModalButtons.styled.js.map +1 -0
  115. package/dist/components/ui/pop/Pop.module.scss +1 -0
  116. package/dist/index.d.ts +0 -1
  117. package/dist/index.d.ts.map +1 -1
  118. package/dist/index.js +0 -1
  119. package/dist/index.js.map +1 -1
  120. package/dist/theme.d.ts +125 -69
  121. package/dist/theme.d.ts.map +1 -1
  122. package/dist/theme.js +2 -0
  123. package/dist/theme.js.map +1 -1
  124. package/docs/assets/search.js +1 -1
  125. package/docs/classes/Drawer.html +14 -17
  126. package/docs/classes/Pop.html +14 -17
  127. package/docs/classes/ToasterProvider.html +10 -13
  128. package/docs/enums/ICON.html +14 -17
  129. package/docs/functions/Action.html +6 -10
  130. package/docs/functions/Button.html +44 -15
  131. package/docs/functions/Card.html +6 -10
  132. package/docs/functions/Checkbox.html +6 -10
  133. package/docs/functions/Choice.html +7 -11
  134. package/docs/functions/CoveringLoader.html +6 -10
  135. package/docs/functions/DirectionPad.html +6 -10
  136. package/docs/functions/EqualActions.html +6 -10
  137. package/docs/functions/FullLoader.html +6 -10
  138. package/docs/functions/HandleEsc.html +6 -10
  139. package/docs/functions/Header.html +6 -10
  140. package/docs/functions/HeaderIconAction.html +6 -10
  141. package/docs/functions/Icon-1.html +6 -10
  142. package/docs/functions/If.html +6 -10
  143. package/docs/functions/Input.html +7 -11
  144. package/docs/functions/KeyValue.html +6 -10
  145. package/docs/functions/Label.html +6 -10
  146. package/docs/functions/List-1.html +18 -12
  147. package/docs/functions/Loader.html +6 -10
  148. package/docs/functions/Loading.html +6 -10
  149. package/docs/functions/Message.html +6 -10
  150. package/docs/functions/Modal-1.html +6 -10
  151. package/docs/functions/ModalButtons.html +135 -0
  152. package/docs/functions/PopLoader.html +6 -10
  153. package/docs/functions/PopOption.html +6 -10
  154. package/docs/functions/SearchContainer.html +6 -10
  155. package/docs/functions/Section.html +145 -0
  156. package/docs/functions/Select.html +40 -15
  157. package/docs/functions/Selector.html +7 -11
  158. package/docs/functions/Spacer.html +6 -10
  159. package/docs/functions/Stats.html +6 -10
  160. package/docs/functions/StickyHeader-1.html +6 -10
  161. package/docs/functions/StickyHeader.Content.html +5 -8
  162. package/docs/functions/Table.html +6 -10
  163. package/docs/functions/TextArea.html +6 -10
  164. package/docs/functions/Toggle.html +6 -10
  165. package/docs/functions/getCssText.html +6 -10
  166. package/docs/functions/styled.html +6 -10
  167. package/docs/functions/useToaster.html +7 -11
  168. package/docs/index.html +6 -10
  169. package/docs/modules/List.html +10 -10
  170. package/docs/modules/Modal.html +8 -11
  171. package/docs/modules/StickyHeader.html +6 -9
  172. package/docs/modules.html +9 -17
  173. package/docs/pages/tutorials/Test.html +6 -10
  174. package/docs/types/ThemeCSS.html +7 -11
  175. package/docs/variables/List.Header.html +8 -10
  176. package/docs/variables/List.Item.html +53 -0
  177. package/docs/variables/{ModalButtons.Button.html → Modal.RemovePadding.html} +11 -14
  178. package/docs/variables/cssReset.html +7 -11
  179. package/docs/variables/miuiScrollbars.html +7 -11
  180. package/esm/components/form/Select.d.ts +1 -5
  181. package/esm/components/form/Select.d.ts.map +1 -1
  182. package/esm/components/form/Select.js +1 -8
  183. package/esm/components/form/Select.js.map +1 -1
  184. package/esm/components/form/Select.stories.d.ts +8 -0
  185. package/esm/components/form/Select.stories.d.ts.map +1 -0
  186. package/esm/components/form/Select.stories.js +20 -0
  187. package/esm/components/form/Select.stories.js.map +1 -0
  188. package/esm/components/{layout/list/Value.styled.d.ts → form/Select.styled.d.ts} +20 -12
  189. package/esm/components/form/Select.styled.d.ts.map +1 -0
  190. package/esm/components/form/Select.styled.js +21 -0
  191. package/esm/components/form/Select.styled.js.map +1 -0
  192. package/esm/components/form/input/Input.css.d.ts +16 -16
  193. package/esm/components/form/input/Input.css.d.ts.map +1 -1
  194. package/esm/components/form/input/Input.css.js.map +1 -1
  195. package/esm/components/form/input/Input.styled.d.ts +68 -36
  196. package/esm/components/form/input/Input.styled.d.ts.map +1 -1
  197. package/esm/components/form/textarea/TextArea.styled.d.ts +17 -9
  198. package/esm/components/form/textarea/TextArea.styled.d.ts.map +1 -1
  199. package/esm/components/layout/list/Header.d.ts +174 -7
  200. package/esm/components/layout/list/Header.d.ts.map +1 -1
  201. package/esm/components/layout/list/Header.js +24 -11
  202. package/esm/components/layout/list/Header.js.map +1 -1
  203. package/esm/components/layout/list/Header.stories.d.ts +8 -0
  204. package/esm/components/layout/list/Header.stories.d.ts.map +1 -0
  205. package/esm/components/layout/list/Header.stories.js +27 -0
  206. package/esm/components/layout/list/Header.stories.js.map +1 -0
  207. package/esm/components/layout/list/Item.d.ts +88 -7
  208. package/esm/components/layout/list/Item.d.ts.map +1 -1
  209. package/esm/components/layout/list/Item.js +64 -33
  210. package/esm/components/layout/list/Item.js.map +1 -1
  211. package/esm/components/layout/list/Item.stories.d.ts +10 -0
  212. package/esm/components/layout/list/Item.stories.d.ts.map +1 -0
  213. package/esm/components/layout/list/Item.stories.js +57 -0
  214. package/esm/components/layout/list/Item.stories.js.map +1 -0
  215. package/esm/components/layout/list/Label.d.ts +83 -5
  216. package/esm/components/layout/list/Label.d.ts.map +1 -1
  217. package/esm/components/layout/list/Label.js +12 -6
  218. package/esm/components/layout/list/Label.js.map +1 -1
  219. package/esm/components/layout/list/Label.stories.d.ts +8 -0
  220. package/esm/components/layout/list/Label.stories.d.ts.map +1 -0
  221. package/esm/components/layout/list/Label.stories.js +29 -0
  222. package/esm/components/layout/list/Label.stories.js.map +1 -0
  223. package/esm/components/layout/list/List.d.ts +86 -7
  224. package/esm/components/layout/list/List.d.ts.map +1 -1
  225. package/esm/components/layout/list/List.js +15 -9
  226. package/esm/components/layout/list/List.js.map +1 -1
  227. package/esm/components/layout/list/List.stories.d.ts +9 -0
  228. package/esm/components/layout/list/List.stories.d.ts.map +1 -0
  229. package/esm/components/layout/list/List.stories.js +46 -0
  230. package/esm/components/layout/list/List.stories.js.map +1 -0
  231. package/esm/components/layout/list/Value.d.ts +81 -1
  232. package/esm/components/layout/list/Value.d.ts.map +1 -1
  233. package/esm/components/layout/list/Value.js +9 -1
  234. package/esm/components/layout/list/Value.js.map +1 -1
  235. package/esm/components/layout/list/Value.stories.d.ts +8 -0
  236. package/esm/components/layout/list/Value.stories.d.ts.map +1 -0
  237. package/esm/components/layout/list/Value.stories.js +23 -0
  238. package/esm/components/layout/list/Value.stories.js.map +1 -0
  239. package/esm/components/layout/section/Section.d.ts +83 -8
  240. package/esm/components/layout/section/Section.d.ts.map +1 -1
  241. package/esm/components/layout/section/Section.js +17 -12
  242. package/esm/components/layout/section/Section.js.map +1 -1
  243. package/esm/components/layout/section/Section.stories.d.ts +8 -0
  244. package/esm/components/layout/section/Section.stories.d.ts.map +1 -0
  245. package/esm/components/layout/section/Section.stories.js +31 -0
  246. package/esm/components/layout/section/Section.stories.js.map +1 -0
  247. package/esm/components/layout/section/SectionContainer.d.ts +80 -5
  248. package/esm/components/layout/section/SectionContainer.d.ts.map +1 -1
  249. package/esm/components/layout/section/SectionContainer.js +9 -5
  250. package/esm/components/layout/section/SectionContainer.js.map +1 -1
  251. package/esm/components/ui/button/Button.d.ts +1 -7
  252. package/esm/components/ui/button/Button.d.ts.map +1 -1
  253. package/esm/components/ui/button/Button.js +1 -13
  254. package/esm/components/ui/button/Button.js.map +1 -1
  255. package/esm/components/ui/button/Button.stories.d.ts +9 -0
  256. package/esm/components/ui/button/Button.stories.d.ts.map +1 -0
  257. package/esm/components/ui/button/Button.stories.js +35 -0
  258. package/esm/components/ui/button/Button.stories.js.map +1 -0
  259. package/esm/components/ui/button/Button.styled.d.ts +85 -0
  260. package/esm/components/ui/button/Button.styled.d.ts.map +1 -0
  261. package/esm/components/ui/button/Button.styled.js +35 -0
  262. package/esm/components/ui/button/Button.styled.js.map +1 -0
  263. package/esm/components/ui/message/Message.d.ts +17 -9
  264. package/esm/components/ui/message/Message.d.ts.map +1 -1
  265. package/esm/components/ui/message/Message.styled.d.ts +17 -9
  266. package/esm/components/ui/message/Message.styled.d.ts.map +1 -1
  267. package/esm/components/ui/modal/Modal.d.ts +6 -4
  268. package/esm/components/ui/modal/Modal.d.ts.map +1 -1
  269. package/esm/components/ui/modal/Modal.js +30 -18
  270. package/esm/components/ui/modal/Modal.js.map +1 -1
  271. package/esm/components/ui/modal/Modal.stories.d.ts +10 -0
  272. package/esm/components/ui/modal/Modal.stories.d.ts.map +1 -0
  273. package/esm/components/ui/modal/Modal.stories.js +84 -0
  274. package/esm/components/ui/modal/Modal.stories.js.map +1 -0
  275. package/esm/components/ui/modal/Modal.styled.d.ts +329 -0
  276. package/esm/components/ui/modal/Modal.styled.d.ts.map +1 -0
  277. package/esm/components/ui/modal/Modal.styled.js +83 -0
  278. package/esm/components/ui/modal/Modal.styled.js.map +1 -0
  279. package/esm/components/ui/modal/ModalButtons.d.ts +1 -11
  280. package/esm/components/ui/modal/ModalButtons.d.ts.map +1 -1
  281. package/esm/components/ui/modal/ModalButtons.js +1 -9
  282. package/esm/components/ui/modal/ModalButtons.js.map +1 -1
  283. package/esm/components/ui/modal/ModalButtons.stories.d.ts +8 -0
  284. package/esm/components/ui/modal/ModalButtons.stories.d.ts.map +1 -0
  285. package/esm/components/ui/modal/ModalButtons.stories.js +19 -0
  286. package/esm/components/ui/modal/ModalButtons.stories.js.map +1 -0
  287. package/esm/components/ui/modal/ModalButtons.styled.d.ts +166 -0
  288. package/esm/components/ui/modal/ModalButtons.styled.d.ts.map +1 -0
  289. package/esm/components/ui/modal/ModalButtons.styled.js +39 -0
  290. package/esm/components/ui/modal/ModalButtons.styled.js.map +1 -0
  291. package/esm/components/ui/pop/Pop.module.scss +1 -0
  292. package/esm/index.d.ts +0 -1
  293. package/esm/index.d.ts.map +1 -1
  294. package/esm/index.js +0 -1
  295. package/esm/index.js.map +1 -1
  296. package/esm/theme.d.ts +125 -69
  297. package/esm/theme.d.ts.map +1 -1
  298. package/esm/theme.js +2 -0
  299. package/esm/theme.js.map +1 -1
  300. package/package.json +8 -7
  301. package/src/components/form/Select.stories.tsx +30 -0
  302. package/src/components/form/Select.styled.ts +25 -0
  303. package/src/components/form/Select.tsx +1 -22
  304. package/src/components/form/input/Input.css.ts +5 -3
  305. package/src/components/layout/list/Header.stories.tsx +40 -0
  306. package/src/components/layout/list/Header.tsx +43 -26
  307. package/src/components/layout/list/Item.stories.tsx +69 -0
  308. package/src/components/layout/list/Item.tsx +118 -46
  309. package/src/components/layout/list/Label.stories.tsx +45 -0
  310. package/src/components/layout/list/Label.tsx +21 -12
  311. package/src/components/layout/list/List.stories.tsx +84 -0
  312. package/src/components/layout/list/List.tsx +34 -23
  313. package/src/components/layout/list/Value.stories.tsx +37 -0
  314. package/src/components/layout/list/Value.tsx +15 -1
  315. package/src/components/layout/section/Section.stories.tsx +54 -0
  316. package/src/components/layout/section/Section.tsx +27 -27
  317. package/src/components/layout/section/SectionContainer.tsx +10 -13
  318. package/src/components/ui/button/Button.stories.tsx +55 -0
  319. package/src/components/ui/button/Button.styled.ts +43 -0
  320. package/src/components/ui/button/Button.tsx +1 -35
  321. package/src/components/ui/modal/Modal.stories.tsx +143 -0
  322. package/src/components/ui/modal/Modal.styled.ts +100 -0
  323. package/src/components/ui/modal/Modal.tsx +49 -26
  324. package/src/components/ui/modal/ModalButtons.stories.tsx +40 -0
  325. package/src/components/ui/modal/ModalButtons.styled.ts +51 -0
  326. package/src/components/ui/modal/ModalButtons.tsx +1 -22
  327. package/src/components/ui/pop/Pop.module.scss +1 -0
  328. package/src/demo/components/form/Choice.tsx +3 -3
  329. package/src/demo/components/form/Form.tsx +1 -1
  330. package/src/demo/components/form/Search.tsx +3 -1
  331. package/src/demo/components/form/Toggle.tsx +3 -1
  332. package/src/demo/components/layout/card/Card.tsx +3 -3
  333. package/src/demo/components/ui/icons/Icons.tsx +3 -1
  334. package/src/demo/components/ui/keyValue/KeyValue.tsx +1 -1
  335. package/src/demo/components/ui/pop/Pop.tsx +1 -1
  336. package/src/demo/componentsMap.ts +0 -77
  337. package/src/index.ts +0 -1
  338. package/src/pages/_app.tsx +2 -0
  339. package/src/theme.ts +5 -3
  340. package/dist/components/form/Select.module.scss +0 -18
  341. package/dist/components/layout/list/Header.module.scss +0 -8
  342. package/dist/components/layout/list/Item.module.scss +0 -46
  343. package/dist/components/layout/list/Label.module.scss +0 -9
  344. package/dist/components/layout/list/List.module.scss +0 -8
  345. package/dist/components/layout/list/Value.styled.d.ts.map +0 -1
  346. package/dist/components/layout/list/Value.styled.js +0 -13
  347. package/dist/components/layout/list/Value.styled.js.map +0 -1
  348. package/dist/components/layout/section/Section.module.scss +0 -24
  349. package/dist/components/layout/section/SectionContainer.module.scss +0 -4
  350. package/dist/components/ui/button/Button.module.scss +0 -25
  351. package/dist/components/ui/modal/Modal.module.scss +0 -92
  352. package/dist/components/ui/modal/ModalButtons.module.scss +0 -32
  353. package/dist/components/ui/modal/ModalNoMargin.d.ts +0 -7
  354. package/dist/components/ui/modal/ModalNoMargin.d.ts.map +0 -1
  355. package/dist/components/ui/modal/ModalNoMargin.js +0 -22
  356. package/dist/components/ui/modal/ModalNoMargin.js.map +0 -1
  357. package/docs/functions/Item-1.html +0 -110
  358. package/docs/functions/ModalButtons-1.html +0 -110
  359. package/docs/functions/Section-1.html +0 -110
  360. package/docs/modules/Item.html +0 -64
  361. package/docs/modules/ModalButtons.html +0 -61
  362. package/docs/modules/Section.html +0 -61
  363. package/docs/variables/Item.Label.html +0 -56
  364. package/docs/variables/Item.Value.html +0 -56
  365. package/docs/variables/Modal.NegateMargin.html +0 -55
  366. package/docs/variables/Section.Container.html +0 -55
  367. package/esm/components/form/Select.module.scss +0 -18
  368. package/esm/components/layout/list/Header.module.scss +0 -8
  369. package/esm/components/layout/list/Item.module.scss +0 -46
  370. package/esm/components/layout/list/Label.module.scss +0 -9
  371. package/esm/components/layout/list/List.module.scss +0 -8
  372. package/esm/components/layout/list/Value.styled.d.ts.map +0 -1
  373. package/esm/components/layout/list/Value.styled.js +0 -10
  374. package/esm/components/layout/list/Value.styled.js.map +0 -1
  375. package/esm/components/layout/section/Section.module.scss +0 -24
  376. package/esm/components/layout/section/SectionContainer.module.scss +0 -4
  377. package/esm/components/ui/button/Button.module.scss +0 -25
  378. package/esm/components/ui/modal/Modal.module.scss +0 -92
  379. package/esm/components/ui/modal/ModalButtons.module.scss +0 -32
  380. package/esm/components/ui/modal/ModalNoMargin.d.ts +0 -7
  381. package/esm/components/ui/modal/ModalNoMargin.d.ts.map +0 -1
  382. package/esm/components/ui/modal/ModalNoMargin.js +0 -16
  383. package/esm/components/ui/modal/ModalNoMargin.js.map +0 -1
  384. package/src/components/form/Select.module.scss +0 -18
  385. package/src/components/layout/list/Header.module.scss +0 -8
  386. package/src/components/layout/list/Item.module.scss +0 -46
  387. package/src/components/layout/list/Label.module.scss +0 -9
  388. package/src/components/layout/list/List.module.scss +0 -8
  389. package/src/components/layout/list/Value.styled.ts +0 -13
  390. package/src/components/layout/section/Section.module.scss +0 -24
  391. package/src/components/layout/section/SectionContainer.module.scss +0 -4
  392. package/src/components/ui/button/Button.module.scss +0 -25
  393. package/src/components/ui/modal/Modal.module.scss +0 -92
  394. package/src/components/ui/modal/ModalButtons.module.scss +0 -32
  395. package/src/components/ui/modal/ModalNoMargin.tsx +0 -25
  396. package/src/demo/components/form/Input.tsx +0 -28
  397. package/src/demo/components/form/Select.tsx +0 -26
  398. package/src/demo/components/layout/list/Header.tsx +0 -23
  399. package/src/demo/components/layout/list/Inset.tsx +0 -23
  400. package/src/demo/components/layout/list/ItemRatio.tsx +0 -20
  401. package/src/demo/components/layout/list/Label.tsx +0 -31
  402. package/src/demo/components/layout/list/List.Item.module.scss +0 -7
  403. package/src/demo/components/layout/list/List.Item.tsx +0 -24
  404. package/src/demo/components/layout/list/Selection.tsx +0 -16
  405. package/src/demo/components/layout/list/Value.module.scss +0 -4
  406. package/src/demo/components/layout/list/Value.tsx +0 -25
  407. package/src/demo/components/layout/section/Section.tsx +0 -33
  408. package/src/demo/components/ui/button/ButtonDemo.tsx +0 -23
  409. package/src/demo/components/ui/message/Message.tsx +0 -27
  410. package/src/demo/components/ui/modal/Modal.tsx +0 -104
package/esm/theme.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjD,MAAM,MAAM,GAAG;IACX,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,QAAQ;CACjB,CAAC;AAGF,MAAM,OAAO,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC;AAChD,MAAM,iBAAiB,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAC1E,MAAM,aAAa,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAClE,MAAM,WAAW,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAE9D,MAAM,EACF,MAAM,EACN,GAAG,EACH,SAAS,EACT,SAAS,EACT,UAAU,EACV,KAA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iBAAiB,EACjB,aAAa,EACb,WAAW,GACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-miui",
3
- "version": "0.20.1",
3
+ "version": "0.22.0",
4
4
  "author": "Jacek Nowacki",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -13,8 +13,9 @@
13
13
  "lint": "eslint src --ext .ts,.tsx,.js,.jsx,.mjs",
14
14
  "lint:fix": "yarn lint --fix",
15
15
  "prepack": "yarn compile",
16
- "prepublishOnly": "yarn audit && yarn lint && yarn test && yarn docs",
16
+ "prepublishOnly": "yarn lint && yarn test && yarn docs",
17
17
  "start:dev": "yarn storybook",
18
+ "start:dev:legacy": "next dev",
18
19
  "deploy:dev": "next build && next export && netlify deploy --dir out",
19
20
  "updates": "npx --yes npm-check-updates --dep prod",
20
21
  "updates:dev": "npx --yes npm-check-updates --dep dev",
@@ -39,9 +40,9 @@
39
40
  "oop-timers": "^5.0.0"
40
41
  },
41
42
  "devDependencies": {
42
- "@babel/core": "^7.21.4",
43
- "@babel/preset-env": "^7.21.4",
44
- "@babel/preset-typescript": "^7.21.4",
43
+ "@babel/core": "^7.22.5",
44
+ "@babel/preset-env": "^7.22.5",
45
+ "@babel/preset-typescript": "^7.22.5",
45
46
  "@dzek69/eslint-config-base": "^2.4.0",
46
47
  "@dzek69/eslint-config-import": "^1.2.0",
47
48
  "@dzek69/eslint-config-import-typescript": "^1.0.0",
@@ -71,7 +72,7 @@
71
72
  "fs-extra": "^11.1.1",
72
73
  "jest": "^29.5.0",
73
74
  "must": "^0.13.4",
74
- "next": "^13.1.6",
75
+ "next": "^13.4.4",
75
76
  "nodemon": "^2.0.22",
76
77
  "prettier": "^2.8.7",
77
78
  "react": "^18.2.0",
@@ -81,7 +82,7 @@
81
82
  "storybook": "^7.0.11",
82
83
  "ts-node": "^10.9.1",
83
84
  "typedoc": "^0.23.28",
84
- "typescript": "^5.0.4"
85
+ "typescript": "^5.1.3"
85
86
  },
86
87
  "peerDependencies": {
87
88
  "react": "^18.2.0",
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+
3
+ import type { StoryObj, Meta } from "@storybook/react";
4
+
5
+ import { Select } from "./Select.js";
6
+
7
+ const meta: Meta = {
8
+ title: "Components/Form/Select",
9
+ component: Select,
10
+ tags: ["autodocs", "form"],
11
+ };
12
+
13
+ type Story = StoryObj<typeof Select>;
14
+
15
+ const Primary: Story = {
16
+ args: {
17
+ children: [
18
+ <option key={"1"} value={"1"}>First</option>,
19
+ <option key={"2"} value={"2"}>Second</option>,
20
+ <option key={"3"} value={"3"}>Third</option>,
21
+ ],
22
+ disabled: false,
23
+ },
24
+ };
25
+
26
+ export {
27
+ Primary,
28
+ };
29
+
30
+ export default meta;
@@ -0,0 +1,25 @@
1
+ import { borderPxToRem, dimensionsPxToRem, pxToRem, styled } from "../../theme.js";
2
+
3
+ const Select = styled("select", {
4
+ "boxSizing": "border-box",
5
+ "height": dimensionsPxToRem(103),
6
+ "color": "$text",
7
+ "display": "flex",
8
+ "alignItems": "center",
9
+ "width": "100%",
10
+ "background": "white",
11
+ "fontFamily": "inherit",
12
+ "borderRadius": pxToRem(2),
13
+ "padding": `0 ${dimensionsPxToRem(36)}`,
14
+ "border": `${borderPxToRem(1)} solid $border`,
15
+ "appearance": "auto",
16
+
17
+ "&:disabled": {
18
+ background: "$inputDisabledBg",
19
+ color: "$inputDisabledText",
20
+ },
21
+ });
22
+
23
+ export {
24
+ Select,
25
+ };
@@ -1,22 +1 @@
1
- import React from "react";
2
-
3
- import classnames from "classnames";
4
-
5
- import styles from "./Select.module.scss";
6
-
7
- interface Props {
8
- }
9
-
10
- const Select: React.FC<React.SelectHTMLAttributes<HTMLSelectElement> & Props> = ({ className, children, ...props }) => {
11
- const wrapperCls = classnames(styles.select, className);
12
-
13
- return (
14
- <select className={wrapperCls} {...props}>
15
- {children}
16
- </select>
17
- );
18
- };
19
-
20
- export {
21
- Select,
22
- };
1
+ export { Select } from "./Select.styled.js";
@@ -1,4 +1,4 @@
1
- import type { ThemeCSS } from "../../../theme";
1
+ // import type { ThemeCSS } from "../../../theme"; TODO restore
2
2
 
3
3
  import { dimensionsPxToRem, fontPxToRem, borderPxToRem } from "../../../theme.js";
4
4
 
@@ -21,7 +21,8 @@ const input = {
21
21
  "&:read-only, &:disabled": {
22
22
  color: "inherit",
23
23
  },
24
- } satisfies ThemeCSS;
24
+ };
25
+ // satisfies ThemeCSS; @TODO restore
25
26
 
26
27
  const wrapper = {
27
28
  background: "white",
@@ -50,7 +51,8 @@ const wrapper = {
50
51
  },
51
52
  },
52
53
  },
53
- } satisfies ThemeCSS;
54
+ };
55
+ // satisfies ThemeCSS; TODO restore
54
56
 
55
57
  export {
56
58
  input,
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+
3
+ import type { StoryObj, Meta } from "@storybook/react";
4
+
5
+ import { Header } from "./Header.js";
6
+ import { List } from "./List.js";
7
+
8
+ const meta: Meta = {
9
+ title: "Components/Layout/List/Header",
10
+ component: Header,
11
+ tags: ["autodocs", "layout"],
12
+ };
13
+
14
+ type Story = StoryObj<typeof Header>;
15
+
16
+ const Primary: Story = {
17
+ args: {
18
+ children: "Section name",
19
+ },
20
+ render: (args) => {
21
+ return (
22
+ <List>
23
+ <Header {...args} />
24
+ <List.Item>Item 1</List.Item>
25
+ <List.Item>Item 2</List.Item>
26
+ <List.Item>Item 3</List.Item>
27
+ <Header {...args} />
28
+ <List.Item>Item 1</List.Item>
29
+ <List.Item>Item 2</List.Item>
30
+ <List.Item>Item 3</List.Item>
31
+ </List>
32
+ );
33
+ },
34
+ };
35
+
36
+ export {
37
+ Primary,
38
+ };
39
+
40
+ export default meta;
@@ -1,32 +1,49 @@
1
1
  import React from "react";
2
2
 
3
- import classnames from "classnames";
4
-
5
- import { makeVariants } from "../../../utils/index.js";
6
-
7
- import styles from "./Item.module.scss";
8
- import headerStyles from "./Header.module.scss";
9
-
10
- type Variant = "inset";
11
-
12
- interface Props {
13
- className?: string;
14
- variant?: Variant | Variant[];
15
- children: React.ReactNode;
16
- }
17
-
18
- const Header: React.FC<Props> = (props) => {
19
- const v = makeVariants(props.variant);
20
-
21
- const cls = classnames(props.className, styles.item, headerStyles.header, {
22
- [styles.inset]: v.includes("inset"),
23
- });
24
-
25
- // @TODO way to use h1, h2, h3 instead of div
3
+ import type { VariantProps } from "@stitches/react";
4
+
5
+ import { dimensionsPxToRem, fontPxToRem, styled } from "../../../theme.js";
6
+
7
+ import { Item, ItemInnerContainerClassName } from "./Item.js";
8
+
9
+ const StyledContent = styled("div", {});
10
+
11
+ const StyledHeader = styled(Item, {
12
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
13
+ paddingTop: dimensionsPxToRem(80),
14
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
15
+ paddingBottom: dimensionsPxToRem(40),
16
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
17
+ fontSize: fontPxToRem(26),
18
+ color: "$sub",
19
+ textTransform: "uppercase",
20
+
21
+ [`& ${ItemInnerContainerClassName}`]: {
22
+ minHeight: 0,
23
+ },
24
+
25
+ variants: {
26
+ inset: {
27
+ true: {
28
+ paddingLeft: 0,
29
+ paddingRight: 0,
30
+ },
31
+ },
32
+ },
33
+ });
34
+
35
+ type StyledHeaderProps = React.ComponentProps<typeof StyledHeader>;
36
+ type Variants = VariantProps<typeof StyledHeader>;
37
+
38
+ /**
39
+ * Use this to render a header within a `List`.
40
+ * Use `as` prop to define which tag to use.
41
+ */
42
+ const Header: React.FC<StyledHeaderProps & Variants & { as?: string }> = ({ as, ...props }) => {
26
43
  return (
27
- <li className={cls}>
28
- <div>{props.children}</div>
29
- </li>
44
+ <StyledHeader {...props}>
45
+ <StyledContent {...(as ? { as } : undefined)}>{props.children}</StyledContent>
46
+ </StyledHeader>
30
47
  );
31
48
  };
32
49
 
@@ -0,0 +1,69 @@
1
+ import React from "react";
2
+
3
+ import type { StoryObj, Meta } from "@storybook/react";
4
+
5
+ import { NextLink } from "../../../demo/NextLink.js";
6
+
7
+ import { Item } from "./Item.js";
8
+ import { List } from "./List.js";
9
+
10
+ const meta: Meta = {
11
+ title: "Components/Layout/List/Item",
12
+ component: Item,
13
+ tags: ["autodocs", "layout"],
14
+ argTypes: {
15
+ inset: {
16
+ type: "boolean",
17
+ },
18
+ Link: {
19
+ controls: "none",
20
+ },
21
+ },
22
+ };
23
+
24
+ type Story = StoryObj<typeof Item>;
25
+
26
+ const Primary: Story = {
27
+ args: {
28
+ children: "I am a list item",
29
+ inset: false,
30
+ Link: NextLink,
31
+ },
32
+ render: (args) => {
33
+ return <List><Item {...args} /></List>;
34
+ },
35
+ };
36
+
37
+ const Alignment: Story = {
38
+ args: {
39
+ children: [
40
+ <div key={"1st"}>first</div>,
41
+ <div key={"2nd"}>2nd</div>,
42
+ <div key={"3rd"}>last</div>,
43
+ ],
44
+ ratio: "1/2/1",
45
+ },
46
+ render: (args) => {
47
+ return <List><Item {...args} /></List>;
48
+ },
49
+ };
50
+
51
+ const OnClick: Story = {
52
+ args: {
53
+ children: "I am a list item, but I will render a button, click me",
54
+ onClick: () => {
55
+ alert("Clicked!");
56
+ },
57
+ },
58
+ render: (args) => {
59
+ return <List><Item {...args} /></List>;
60
+ },
61
+ };
62
+
63
+ export {
64
+ Primary,
65
+ Alignment,
66
+ OnClick,
67
+ };
68
+
69
+ export default meta;
@@ -1,11 +1,8 @@
1
1
  import React from "react";
2
2
 
3
- import classnames from "classnames";
4
-
5
- import { makeVariants } from "../../../utils/index.js";
6
3
  import { ICON, Icon } from "../../icons/Icon.js";
4
+ import { dimensionsPxToRem, fontPxToRem, pxToRem, styled } from "../../../theme.js";
7
5
 
8
- import styles from "./Item.module.scss";
9
6
  import { Value } from "./Value.js";
10
7
  import { Label } from "./Label.js";
11
8
 
@@ -14,18 +11,12 @@ interface LinkProps {
14
11
  children: React.ReactNode;
15
12
  }
16
13
 
17
- type Variant = "inset";
18
-
19
14
  interface Props {
20
15
  href?: string;
21
16
  to?: string;
22
17
  onClick?: () => void;
23
- className?: string;
24
18
  Link?: React.ComponentClass<LinkProps> | React.FC<LinkProps>;
25
19
  ratio?: string; // @TODO number/number/number/.. type?
26
- variant?: Variant | Variant[];
27
- selected?: boolean | undefined;
28
- children: React.ReactNode;
29
20
  }
30
21
 
31
22
  interface SubComponents {
@@ -33,32 +24,101 @@ interface SubComponents {
33
24
  Value: typeof Value;
34
25
  }
35
26
 
36
- const icon = <Icon className={styles.icon} name={ICON.forward} />;
37
- const noIcon = <span className={styles.icon} />;
38
-
39
- // eslint-disable-next-line max-statements,max-lines-per-function
40
- const Item: React.FC<Props> & SubComponents = (props) => {
41
- const { className, children, href, to, onClick, Link, ratio, variant, selected, ...restProps } = props;
42
- const v = makeVariants(variant);
43
- const cls = classnames(styles.item, className);
44
-
45
- const innerCls = classnames(styles.content, {
46
- [styles.inset]: v.includes("inset"),
47
- [styles.selected]: selected,
48
- });
27
+ const iconStyles = {
28
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
29
+ width: pxToRem(7),
30
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
31
+ marginRight: pxToRem(10),
32
+ display: "inline-block",
33
+ }; // TODO satisfies
34
+
35
+ const StyledIcon = styled(Icon, iconStyles);
36
+ const StyledNoIcon = styled("span", iconStyles);
37
+
38
+ const icon = <StyledIcon name={ICON.forward} />;
39
+ const noIcon = <StyledNoIcon />;
40
+
41
+ const StyledInnerContainer = styled("div", {
42
+ display: "flex",
43
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
44
+ minHeight: dimensionsPxToRem(174),
45
+ alignItems: "center",
46
+ gap: "1rem",
47
+
48
+ border: "none",
49
+ background: "none",
50
+ width: "100%",
51
+ textAlign: "left",
52
+ fontFamily: "inherit",
53
+ fontSize: "inherit",
54
+ });
55
+
56
+ const ItemInnerContainerClassName = StyledInnerContainer.toString();
57
+
58
+ const StyledItem = styled("li", {
59
+ "listStyleType": "none",
60
+ "margin": 0,
61
+ "padding": 0,
62
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
63
+ "fontSize": fontPxToRem(34),
64
+
65
+ "&:not(:first-child)": {
66
+ borderTop: "0.37px solid $headerBorder",
67
+ },
68
+
69
+ "> *": {
70
+ display: "block",
71
+ padding: 0,
72
+ textDecoration: "none",
73
+ },
74
+
75
+ "variants": {
76
+ inset: {
77
+ true: {
78
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
79
+ paddingLeft: dimensionsPxToRem(37),
80
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
81
+ paddingRight: dimensionsPxToRem(37),
82
+ },
83
+ },
84
+ selected: {
85
+ true: {
86
+ color: "$mainColor",
87
+ },
88
+ },
89
+ },
90
+ });
91
+
92
+ type StyledItemProps = React.ComponentProps<typeof StyledItem>;
93
+
94
+ /**
95
+ * Represents a single item in a list.
96
+ *
97
+ * It has two subcomponents:
98
+ * - `Label`: for rendering the label with sublabel (usually on the left)
99
+ * - `Value`: for rendering the value (usually on the right)
100
+ *
101
+ * It can be however used with any children, its children are rendered in a flexbox container, `ratio` prop can be used
102
+ * to set the flex ratio of each child.
103
+ *
104
+ * It has two variants:
105
+ * - `inset`: which adds padding to the left and right side of the item - it should be used when the list is inset (it's
106
+ * applied automatically if used within `List` component)
107
+ * - `selected`: which renders an arrow on the left side, useful when creating a radio-like list (please note that not
108
+ * sending `selected` is different from sending `false`)
109
+ *
110
+ * It accepts few more props:
111
+ * - `href`: if given it will render an anchor tag with the given href
112
+ * - `to`: if given it will render an anchor tag wrapped in a link using the given `Link` component
113
+ * - `onClick`: if given it will render a button tag with the given onClick handler (it can be passed with `href` too)
114
+ */
115
+ const Item: React.FC<StyledItemProps & Props> & SubComponents = ({ href, to, onClick, Link, ratio, ...props }) => {
116
+ const r = ratio ? ratio.split("/") : [];
49
117
 
50
- const pre = typeof selected === "boolean"
51
- ? (
52
- selected ? icon : noIcon
53
- )
118
+ const pre = typeof props.selected === "boolean"
119
+ ? (props.selected ? icon : noIcon)
54
120
  : null;
55
121
 
56
- const liProps = {
57
- className: cls,
58
- };
59
-
60
- const r = ratio ? ratio.split("/") : [];
61
-
62
122
  const ren = React.Children.map(props.children, (child, index) => {
63
123
  let flex = undefined;
64
124
  if (!r.length && child && typeof child === "object" && "type" in child && child.type === Value) {
@@ -75,28 +135,40 @@ const Item: React.FC<Props> & SubComponents = (props) => {
75
135
  throw new TypeError("`to` prop given without `Link` component");
76
136
  }
77
137
 
78
- return <li {...liProps}><Link href={to} {...restProps}><a className={innerCls}>{ren}</a></Link></li>;
138
+ return (
139
+ <StyledItem {...props}>
140
+ <Link href={to}><StyledInnerContainer as={"a"} href={to}>{ren}</StyledInnerContainer></Link>
141
+ </StyledItem>
142
+ );
79
143
  }
144
+
80
145
  if (href) {
81
- const aProps: typeof restProps & { onClick?: Props["onClick"] } = { ...restProps };
82
- if (onClick) {
83
- aProps.onClick = onClick;
84
- }
85
- return <li {...liProps}><a href={href} {...aProps} className={innerCls}>{ren}</a></li>;
146
+ return (
147
+ <StyledItem {...props}>
148
+ {/* eslint-disable-next-line react/jsx-handler-names */}
149
+ <StyledInnerContainer as={"a"} href={href} onClick={onClick}>{ren}</StyledInnerContainer>
150
+ </StyledItem>
151
+ );
86
152
  }
153
+
87
154
  if (onClick) {
88
155
  return (
89
- <li {...liProps}>
90
- <button className={classnames(styles.button, innerCls)} onClick={props.onClick} {...restProps}>
91
- {ren}
92
- </button>
93
- </li>
156
+ <StyledItem {...props}>
157
+ {/* eslint-disable-next-line react/jsx-handler-names */}
158
+ <StyledInnerContainer as={"button"} onClick={onClick}>{ren}</StyledInnerContainer>
159
+ </StyledItem>
94
160
  );
95
161
  }
96
- return <li {...liProps}><div {...restProps} className={innerCls}>{ren}</div></li>;
162
+
163
+ return <StyledItem {...props}><StyledInnerContainer>{ren}</StyledInnerContainer></StyledItem>;
97
164
  };
98
165
 
99
166
  Item.Label = Label;
100
167
  Item.Value = Value;
101
168
 
102
- export { Item };
169
+ export { Item, ItemInnerContainerClassName };
170
+
171
+ export type {
172
+ Props as ItemProps,
173
+ SubComponents as ItemSubComponents,
174
+ };
@@ -0,0 +1,45 @@
1
+ import React from "react";
2
+
3
+ import type { StoryObj, Meta } from "@storybook/react";
4
+
5
+ import { Label } from "./Label.js";
6
+ import { List } from "./List.js";
7
+ import { Item } from "./Item.js";
8
+
9
+ const meta: Meta = {
10
+ title: "Components/Layout/List/Label",
11
+ component: Label,
12
+ tags: ["autodocs", "layout"],
13
+ argTypes: {
14
+ sub: {
15
+ type: "string",
16
+ },
17
+ },
18
+ };
19
+
20
+ type Story = StoryObj<typeof Label>;
21
+
22
+ const Primary: Story = {
23
+ args: {
24
+ children: "I am a label",
25
+ sub: "Sub text",
26
+ },
27
+ render: (args) => {
28
+ return (
29
+ <List>
30
+ <Item>
31
+ <Label {...args} />
32
+ </Item>
33
+ <Item>
34
+ I am classic list item
35
+ </Item>
36
+ </List>
37
+ );
38
+ },
39
+ };
40
+
41
+ export {
42
+ Primary,
43
+ };
44
+
45
+ export default meta;
@@ -1,24 +1,33 @@
1
1
  import React from "react";
2
2
  import type { ReactNode } from "react";
3
3
 
4
- import classnames from "classnames";
4
+ import { dimensionsPxToRem, fontPxToRem, styled } from "../../../theme.js";
5
5
 
6
- import styles from "./Label.module.scss";
6
+ const SubLabel = styled("div", {
7
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
8
+ fontSize: fontPxToRem(27),
9
+ color: "$sub",
10
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
11
+ marginTop: fontPxToRem(27 / 3),
12
+ });
7
13
 
8
- interface Props {
9
- sub?: ReactNode;
10
- className?: string;
11
- children: React.ReactNode;
12
- }
14
+ const StyledLabel = styled("div", {
15
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
16
+ padding: `${dimensionsPxToRem(54)} 0`,
17
+ });
13
18
 
14
- const Label: React.FC<Props> = (props) => {
15
- const sub = props.sub ? <div className={styles.sub}>{props.sub}</div> : null;
19
+ type StyledLabelProps = React.ComponentProps<typeof StyledLabel>;
16
20
 
21
+ /**
22
+ * Use this to render a label within `Item`, optionally you can render a sublabel as well (with a tip message for
23
+ * example).
24
+ */
25
+ const Label: React.FC<StyledLabelProps & { sub?: ReactNode }> = ({ sub, ...props }) => {
17
26
  return (
18
- <div className={classnames(styles.root, props.className)}>
27
+ <StyledLabel {...props}>
19
28
  <div>{props.children}</div>
20
- {sub}
21
- </div>
29
+ {sub && <SubLabel>{sub}</SubLabel>}
30
+ </StyledLabel>
22
31
  );
23
32
  };
24
33