react-miui 0.23.7 → 0.25.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 (341) hide show
  1. package/.storybook/preview.tsx +3 -1
  2. package/CHANGELOG.md +24 -0
  3. package/b.mjs +2 -0
  4. package/dist/components/form/Checkbox.d.ts +4 -7
  5. package/dist/components/form/Checkbox.d.ts.map +1 -1
  6. package/dist/components/form/Checkbox.js +53 -20
  7. package/dist/components/form/Checkbox.js.map +1 -1
  8. package/dist/components/form/Checkbox.stories.d.ts +9 -0
  9. package/dist/components/form/Checkbox.stories.d.ts.map +1 -0
  10. package/dist/components/form/Checkbox.stories.js +102 -0
  11. package/dist/components/form/Checkbox.stories.js.map +1 -0
  12. package/dist/components/form/Checkbox.styled.d.ts +248 -0
  13. package/dist/components/form/Checkbox.styled.d.ts.map +1 -0
  14. package/dist/components/form/Checkbox.styled.js +70 -0
  15. package/dist/components/form/Checkbox.styled.js.map +1 -0
  16. package/dist/components/form/Select.styled.d.ts +2 -0
  17. package/dist/components/form/Select.styled.d.ts.map +1 -1
  18. package/dist/components/form/input/Input.styled.d.ts +8 -0
  19. package/dist/components/form/input/Input.styled.d.ts.map +1 -1
  20. package/dist/components/form/textarea/TextArea.styled.d.ts +2 -0
  21. package/dist/components/form/textarea/TextArea.styled.d.ts.map +1 -1
  22. package/dist/components/layout/header/Header.styled.d.ts +8 -0
  23. package/dist/components/layout/header/Header.styled.d.ts.map +1 -1
  24. package/dist/components/layout/header/HeaderIconAction.styled.d.ts +6 -0
  25. package/dist/components/layout/header/HeaderIconAction.styled.d.ts.map +1 -1
  26. package/dist/components/layout/header/StickyHeader.styled.d.ts +4 -0
  27. package/dist/components/layout/header/StickyHeader.styled.d.ts.map +1 -1
  28. package/dist/components/layout/list/Header.d.ts +4 -0
  29. package/dist/components/layout/list/Header.d.ts.map +1 -1
  30. package/dist/components/layout/list/Item.d.ts +2 -0
  31. package/dist/components/layout/list/Item.d.ts.map +1 -1
  32. package/dist/components/layout/list/Label.d.ts +2 -0
  33. package/dist/components/layout/list/Label.d.ts.map +1 -1
  34. package/dist/components/layout/list/List.d.ts +2 -0
  35. package/dist/components/layout/list/List.d.ts.map +1 -1
  36. package/dist/components/layout/list/Value.d.ts +2 -0
  37. package/dist/components/layout/list/Value.d.ts.map +1 -1
  38. package/dist/components/layout/section/Section.d.ts +2 -0
  39. package/dist/components/layout/section/Section.d.ts.map +1 -1
  40. package/dist/components/layout/section/SectionContainer.d.ts +2 -0
  41. package/dist/components/layout/section/SectionContainer.d.ts.map +1 -1
  42. package/dist/components/layout/table/Table.d.ts +1 -7
  43. package/dist/components/layout/table/Table.d.ts.map +1 -1
  44. package/dist/components/layout/table/Table.js +2 -30
  45. package/dist/components/layout/table/Table.js.map +1 -1
  46. package/dist/components/layout/table/Table.stories.d.ts +8 -0
  47. package/dist/components/layout/table/Table.stories.d.ts.map +1 -0
  48. package/dist/components/layout/table/Table.stories.js +55 -0
  49. package/dist/components/layout/table/Table.stories.js.map +1 -0
  50. package/dist/components/layout/table/Table.styled.d.ts +88 -0
  51. package/dist/components/layout/table/Table.styled.d.ts.map +1 -0
  52. package/dist/components/layout/table/Table.styled.js +39 -0
  53. package/dist/components/layout/table/Table.styled.js.map +1 -0
  54. package/dist/components/native/index.d.ts +2 -0
  55. package/dist/components/native/index.d.ts.map +1 -1
  56. package/dist/components/ui/action/Action.styled.d.ts +6 -0
  57. package/dist/components/ui/action/Action.styled.d.ts.map +1 -1
  58. package/dist/components/ui/button/Button.styled.d.ts +2 -0
  59. package/dist/components/ui/button/Button.styled.d.ts.map +1 -1
  60. package/dist/components/ui/message/Message.d.ts +2 -0
  61. package/dist/components/ui/message/Message.d.ts.map +1 -1
  62. package/dist/components/ui/message/Message.styled.d.ts +2 -0
  63. package/dist/components/ui/message/Message.styled.d.ts.map +1 -1
  64. package/dist/components/ui/modal/Modal.styled.d.ts +8 -0
  65. package/dist/components/ui/modal/Modal.styled.d.ts.map +1 -1
  66. package/dist/components/ui/modal/ModalButtons.styled.d.ts +4 -0
  67. package/dist/components/ui/modal/ModalButtons.styled.d.ts.map +1 -1
  68. package/dist/components/ui/pop/Pop.d.ts.map +1 -1
  69. package/dist/components/ui/pop/Pop.js +3 -8
  70. package/dist/components/ui/pop/Pop.js.map +1 -1
  71. package/dist/components/ui/pop/Pop.stories.d.ts +8 -0
  72. package/dist/components/ui/pop/Pop.stories.d.ts.map +1 -0
  73. package/dist/components/ui/pop/Pop.stories.js +91 -0
  74. package/dist/components/ui/pop/Pop.stories.js.map +1 -0
  75. package/dist/components/ui/pop/Pop.styled.d.ts +494 -0
  76. package/dist/components/ui/pop/Pop.styled.d.ts.map +1 -0
  77. package/dist/components/ui/pop/Pop.styled.js +61 -0
  78. package/dist/components/ui/pop/Pop.styled.js.map +1 -0
  79. package/dist/components/ui/pop/PopOption.d.ts.map +1 -1
  80. package/dist/components/ui/pop/PopOption.js +5 -6
  81. package/dist/components/ui/pop/PopOption.js.map +1 -1
  82. package/dist/components/ui/progress/Progress.d.ts +13 -0
  83. package/dist/components/ui/progress/Progress.d.ts.map +1 -0
  84. package/dist/components/ui/progress/Progress.js +43 -0
  85. package/dist/components/ui/progress/Progress.js.map +1 -0
  86. package/dist/components/ui/progress/Progress.stories.d.ts +9 -0
  87. package/dist/components/ui/progress/Progress.stories.d.ts.map +1 -0
  88. package/dist/components/ui/progress/Progress.stories.js +36 -0
  89. package/dist/components/ui/progress/Progress.stories.js.map +1 -0
  90. package/dist/components/ui/progress/Progress.styled.d.ts +252 -0
  91. package/dist/components/ui/progress/Progress.styled.d.ts.map +1 -0
  92. package/dist/components/ui/progress/Progress.styled.js +49 -0
  93. package/dist/components/ui/progress/Progress.styled.js.map +1 -0
  94. package/dist/components/ui/toaster/Notification.d.ts.map +1 -1
  95. package/dist/components/ui/toaster/Notification.js +2 -8
  96. package/dist/components/ui/toaster/Notification.js.map +1 -1
  97. package/dist/components/ui/toaster/Toaster.d.ts +1 -1
  98. package/dist/components/ui/toaster/Toaster.d.ts.map +1 -1
  99. package/dist/components/ui/toaster/Toaster.js +2 -2
  100. package/dist/components/ui/toaster/Toaster.js.map +1 -1
  101. package/dist/components/ui/toaster/Toaster.stories.d.ts +7 -0
  102. package/dist/components/ui/toaster/Toaster.stories.d.ts.map +1 -0
  103. package/dist/components/ui/toaster/Toaster.stories.js +45 -0
  104. package/dist/components/ui/toaster/Toaster.stories.js.map +1 -0
  105. package/dist/components/ui/toaster/Toaster.styled.d.ts +86 -0
  106. package/dist/components/ui/toaster/Toaster.styled.d.ts.map +1 -0
  107. package/dist/components/ui/toaster/Toaster.styled.js +39 -0
  108. package/dist/components/ui/toaster/Toaster.styled.js.map +1 -0
  109. package/dist/index.d.ts +2 -1
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +3 -4
  112. package/dist/index.js.map +1 -1
  113. package/dist/theme.d.ts +20 -0
  114. package/dist/theme.d.ts.map +1 -1
  115. package/dist/theme.js +3 -1
  116. package/dist/theme.js.map +1 -1
  117. package/docs/assets/search.js +1 -1
  118. package/docs/classes/Drawer.html +14 -14
  119. package/docs/classes/Pop.html +18 -14
  120. package/docs/classes/ToasterProvider.html +14 -12
  121. package/docs/enums/ICON.html +14 -14
  122. package/docs/functions/Action.html +19 -5
  123. package/docs/functions/Button.html +23 -9
  124. package/docs/functions/Card.html +19 -5
  125. package/docs/functions/Checkbox.html +21 -5
  126. package/docs/functions/Choice.html +20 -6
  127. package/docs/functions/CoveringLoader.html +19 -5
  128. package/docs/functions/DirectionPad.html +19 -5
  129. package/docs/functions/EqualActions.html +19 -5
  130. package/docs/functions/FullLoader.html +19 -5
  131. package/docs/functions/HandleEsc.html +19 -5
  132. package/docs/functions/Header.html +19 -5
  133. package/docs/functions/HeaderIconAction.html +19 -5
  134. package/docs/functions/Icon-1.html +19 -5
  135. package/docs/functions/If.html +19 -5
  136. package/docs/functions/Input.html +20 -6
  137. package/docs/functions/KeyValue.html +19 -5
  138. package/docs/functions/Label.html +19 -5
  139. package/docs/functions/List-1.html +19 -5
  140. package/docs/functions/Loader.html +19 -5
  141. package/docs/functions/Loading.html +19 -5
  142. package/docs/functions/Message.html +19 -5
  143. package/docs/functions/Modal-1.html +19 -5
  144. package/docs/functions/ModalButtons.html +19 -5
  145. package/docs/functions/PopLoader.html +19 -5
  146. package/docs/functions/PopOption.html +19 -5
  147. package/docs/functions/Progress.html +128 -0
  148. package/docs/functions/SearchContainer.html +19 -5
  149. package/docs/functions/Section.html +23 -9
  150. package/docs/functions/Select.html +19 -5
  151. package/docs/functions/Selector.html +20 -6
  152. package/docs/functions/Spacer.html +19 -5
  153. package/docs/functions/Stats.html +19 -5
  154. package/docs/functions/StickyHeader.html +19 -5
  155. package/docs/functions/Table.html +53 -10
  156. package/docs/functions/TextArea.html +19 -5
  157. package/docs/functions/Toggle.html +19 -5
  158. package/docs/functions/borderPxToRem.html +123 -0
  159. package/docs/functions/createTheme.html +132 -0
  160. package/docs/functions/css.html +130 -0
  161. package/docs/functions/dimensionsPxToRem.html +123 -0
  162. package/docs/functions/fontPxToRem.html +123 -0
  163. package/docs/functions/getCssText.html +19 -5
  164. package/docs/functions/globalCss.html +134 -0
  165. package/docs/functions/keyframes.html +134 -0
  166. package/docs/functions/pxToRem.html +123 -0
  167. package/docs/functions/styled.html +19 -5
  168. package/docs/functions/useToaster.html +20 -6
  169. package/docs/index.html +19 -5
  170. package/docs/interfaces/ActionProps.html +13 -13
  171. package/docs/interfaces/ChoiceProps.html +11 -11
  172. package/docs/interfaces/IconProps.html +7 -7
  173. package/docs/interfaces/InputCustomProps.html +10 -10
  174. package/docs/interfaces/StickyHeaderProps.html +9 -9
  175. package/docs/modules/List.html +7 -7
  176. package/docs/modules/Modal.html +6 -6
  177. package/docs/modules.html +33 -5
  178. package/docs/pages/tutorials/Test.html +19 -5
  179. package/docs/types/InputProps.html +20 -6
  180. package/docs/types/OverwriteProps.html +129 -0
  181. package/docs/types/ThemeCSS.html +21 -7
  182. package/docs/variables/BackgroundClassName.html +114 -0
  183. package/docs/variables/List.Header.html +5 -5
  184. package/docs/variables/List.Item.html +5 -5
  185. package/docs/variables/Modal.RemovePadding.html +5 -5
  186. package/docs/variables/ValueClassName.html +114 -0
  187. package/docs/variables/config.html +128 -0
  188. package/docs/variables/cssReset.html +20 -6
  189. package/docs/variables/miuiScrollbars.html +20 -6
  190. package/docs/variables/theme.html +114 -0
  191. package/esm/components/form/Checkbox.d.ts +4 -7
  192. package/esm/components/form/Checkbox.d.ts.map +1 -1
  193. package/esm/components/form/Checkbox.js +19 -18
  194. package/esm/components/form/Checkbox.js.map +1 -1
  195. package/esm/components/form/Checkbox.stories.d.ts +9 -0
  196. package/esm/components/form/Checkbox.stories.d.ts.map +1 -0
  197. package/esm/components/form/Checkbox.stories.js +75 -0
  198. package/esm/components/form/Checkbox.stories.js.map +1 -0
  199. package/esm/components/form/Checkbox.styled.d.ts +248 -0
  200. package/esm/components/form/Checkbox.styled.d.ts.map +1 -0
  201. package/esm/components/form/Checkbox.styled.js +65 -0
  202. package/esm/components/form/Checkbox.styled.js.map +1 -0
  203. package/esm/components/form/Select.styled.d.ts +2 -0
  204. package/esm/components/form/Select.styled.d.ts.map +1 -1
  205. package/esm/components/form/input/Input.styled.d.ts +8 -0
  206. package/esm/components/form/input/Input.styled.d.ts.map +1 -1
  207. package/esm/components/form/textarea/TextArea.styled.d.ts +2 -0
  208. package/esm/components/form/textarea/TextArea.styled.d.ts.map +1 -1
  209. package/esm/components/layout/header/Header.styled.d.ts +8 -0
  210. package/esm/components/layout/header/Header.styled.d.ts.map +1 -1
  211. package/esm/components/layout/header/HeaderIconAction.styled.d.ts +6 -0
  212. package/esm/components/layout/header/HeaderIconAction.styled.d.ts.map +1 -1
  213. package/esm/components/layout/header/StickyHeader.styled.d.ts +4 -0
  214. package/esm/components/layout/header/StickyHeader.styled.d.ts.map +1 -1
  215. package/esm/components/layout/list/Header.d.ts +4 -0
  216. package/esm/components/layout/list/Header.d.ts.map +1 -1
  217. package/esm/components/layout/list/Item.d.ts +2 -0
  218. package/esm/components/layout/list/Item.d.ts.map +1 -1
  219. package/esm/components/layout/list/Label.d.ts +2 -0
  220. package/esm/components/layout/list/Label.d.ts.map +1 -1
  221. package/esm/components/layout/list/List.d.ts +2 -0
  222. package/esm/components/layout/list/List.d.ts.map +1 -1
  223. package/esm/components/layout/list/Value.d.ts +2 -0
  224. package/esm/components/layout/list/Value.d.ts.map +1 -1
  225. package/esm/components/layout/section/Section.d.ts +2 -0
  226. package/esm/components/layout/section/Section.d.ts.map +1 -1
  227. package/esm/components/layout/section/SectionContainer.d.ts +2 -0
  228. package/esm/components/layout/section/SectionContainer.d.ts.map +1 -1
  229. package/esm/components/layout/table/Table.d.ts +1 -7
  230. package/esm/components/layout/table/Table.d.ts.map +1 -1
  231. package/esm/components/layout/table/Table.js +1 -15
  232. package/esm/components/layout/table/Table.js.map +1 -1
  233. package/esm/components/layout/table/Table.stories.d.ts +8 -0
  234. package/esm/components/layout/table/Table.stories.d.ts.map +1 -0
  235. package/esm/components/layout/table/Table.stories.js +49 -0
  236. package/esm/components/layout/table/Table.stories.js.map +1 -0
  237. package/esm/components/layout/table/Table.styled.d.ts +88 -0
  238. package/esm/components/layout/table/Table.styled.d.ts.map +1 -0
  239. package/esm/components/layout/table/Table.styled.js +36 -0
  240. package/esm/components/layout/table/Table.styled.js.map +1 -0
  241. package/esm/components/native/index.d.ts +2 -0
  242. package/esm/components/native/index.d.ts.map +1 -1
  243. package/esm/components/ui/action/Action.styled.d.ts +6 -0
  244. package/esm/components/ui/action/Action.styled.d.ts.map +1 -1
  245. package/esm/components/ui/button/Button.styled.d.ts +2 -0
  246. package/esm/components/ui/button/Button.styled.d.ts.map +1 -1
  247. package/esm/components/ui/message/Message.d.ts +2 -0
  248. package/esm/components/ui/message/Message.d.ts.map +1 -1
  249. package/esm/components/ui/message/Message.styled.d.ts +2 -0
  250. package/esm/components/ui/message/Message.styled.d.ts.map +1 -1
  251. package/esm/components/ui/modal/Modal.styled.d.ts +8 -0
  252. package/esm/components/ui/modal/Modal.styled.d.ts.map +1 -1
  253. package/esm/components/ui/modal/ModalButtons.styled.d.ts +4 -0
  254. package/esm/components/ui/modal/ModalButtons.styled.d.ts.map +1 -1
  255. package/esm/components/ui/pop/Pop.d.ts.map +1 -1
  256. package/esm/components/ui/pop/Pop.js +3 -5
  257. package/esm/components/ui/pop/Pop.js.map +1 -1
  258. package/esm/components/ui/pop/Pop.stories.d.ts +8 -0
  259. package/esm/components/ui/pop/Pop.stories.d.ts.map +1 -0
  260. package/esm/components/ui/pop/Pop.stories.js +65 -0
  261. package/esm/components/ui/pop/Pop.stories.js.map +1 -0
  262. package/esm/components/ui/pop/Pop.styled.d.ts +494 -0
  263. package/esm/components/ui/pop/Pop.styled.d.ts.map +1 -0
  264. package/esm/components/ui/pop/Pop.styled.js +53 -0
  265. package/esm/components/ui/pop/Pop.styled.js.map +1 -0
  266. package/esm/components/ui/pop/PopOption.d.ts.map +1 -1
  267. package/esm/components/ui/pop/PopOption.js +5 -6
  268. package/esm/components/ui/pop/PopOption.js.map +1 -1
  269. package/esm/components/ui/progress/Progress.d.ts +13 -0
  270. package/esm/components/ui/progress/Progress.d.ts.map +1 -0
  271. package/esm/components/ui/progress/Progress.js +24 -0
  272. package/esm/components/ui/progress/Progress.js.map +1 -0
  273. package/esm/components/ui/progress/Progress.stories.d.ts +9 -0
  274. package/esm/components/ui/progress/Progress.stories.d.ts.map +1 -0
  275. package/esm/components/ui/progress/Progress.stories.js +29 -0
  276. package/esm/components/ui/progress/Progress.stories.js.map +1 -0
  277. package/esm/components/ui/progress/Progress.styled.d.ts +252 -0
  278. package/esm/components/ui/progress/Progress.styled.d.ts.map +1 -0
  279. package/esm/components/ui/progress/Progress.styled.js +44 -0
  280. package/esm/components/ui/progress/Progress.styled.js.map +1 -0
  281. package/esm/components/ui/toaster/Notification.d.ts.map +1 -1
  282. package/esm/components/ui/toaster/Notification.js +2 -5
  283. package/esm/components/ui/toaster/Notification.js.map +1 -1
  284. package/esm/components/ui/toaster/Toaster.d.ts +1 -1
  285. package/esm/components/ui/toaster/Toaster.d.ts.map +1 -1
  286. package/esm/components/ui/toaster/Toaster.js +2 -2
  287. package/esm/components/ui/toaster/Toaster.js.map +1 -1
  288. package/esm/components/ui/toaster/Toaster.stories.d.ts +7 -0
  289. package/esm/components/ui/toaster/Toaster.stories.d.ts.map +1 -0
  290. package/esm/components/ui/toaster/Toaster.stories.js +39 -0
  291. package/esm/components/ui/toaster/Toaster.stories.js.map +1 -0
  292. package/esm/components/ui/toaster/Toaster.styled.d.ts +86 -0
  293. package/esm/components/ui/toaster/Toaster.styled.d.ts.map +1 -0
  294. package/esm/components/ui/toaster/Toaster.styled.js +36 -0
  295. package/esm/components/ui/toaster/Toaster.styled.js.map +1 -0
  296. package/esm/index.d.ts +2 -1
  297. package/esm/index.d.ts.map +1 -1
  298. package/esm/index.js +2 -1
  299. package/esm/index.js.map +1 -1
  300. package/esm/theme.d.ts +20 -0
  301. package/esm/theme.d.ts.map +1 -1
  302. package/esm/theme.js +3 -1
  303. package/esm/theme.js.map +1 -1
  304. package/package.json +10 -9
  305. package/pnpm-lock.yaml +2066 -2494
  306. package/src/components/form/Checkbox.stories.tsx +91 -0
  307. package/src/components/form/Checkbox.styled.ts +79 -0
  308. package/src/components/form/Checkbox.tsx +40 -33
  309. package/src/{demo/components/layout/table/TableDemo.tsx → components/layout/table/Table.stories.tsx} +30 -14
  310. package/src/components/layout/table/Table.styled.ts +40 -0
  311. package/src/components/layout/table/Table.tsx +1 -29
  312. package/src/components/ui/pop/Pop.stories.tsx +102 -0
  313. package/src/components/ui/pop/Pop.styled.ts +68 -0
  314. package/src/components/ui/pop/Pop.tsx +12 -10
  315. package/src/components/ui/pop/PopOption.tsx +6 -8
  316. package/src/components/ui/progress/Progress.stories.tsx +46 -0
  317. package/src/components/ui/progress/Progress.styled.ts +56 -0
  318. package/src/components/ui/progress/Progress.tsx +68 -0
  319. package/src/components/ui/toaster/Notification.tsx +4 -8
  320. package/src/components/ui/toaster/Toaster.stories.tsx +63 -0
  321. package/src/components/ui/toaster/Toaster.styled.ts +42 -0
  322. package/src/components/ui/toaster/Toaster.tsx +3 -3
  323. package/src/demo/componentsMap.ts +0 -21
  324. package/src/index.ts +2 -1
  325. package/src/theme.ts +3 -1
  326. package/dist/components/form/Checkbox.module.scss +0 -71
  327. package/dist/components/layout/table/Table.module.scss +0 -30
  328. package/dist/components/ui/pop/Pop.module.scss +0 -60
  329. package/dist/components/ui/toaster/Toaster.module.scss +0 -32
  330. package/esm/components/form/Checkbox.module.scss +0 -71
  331. package/esm/components/layout/table/Table.module.scss +0 -30
  332. package/esm/components/ui/pop/Pop.module.scss +0 -60
  333. package/esm/components/ui/toaster/Toaster.module.scss +0 -32
  334. package/src/components/form/Checkbox.module.scss +0 -71
  335. package/src/components/layout/table/Table.module.scss +0 -30
  336. package/src/components/ui/pop/Pop.module.scss +0 -60
  337. package/src/components/ui/toaster/Toaster.module.scss +0 -32
  338. package/src/demo/components/form/Checkbox.tsx +0 -33
  339. package/src/demo/components/layout/table/TableDemo.module.scss +0 -1
  340. package/src/demo/components/ui/pop/Pop.tsx +0 -77
  341. package/src/demo/components/ui/toaster/Toaster.tsx +0 -27
@@ -0,0 +1,91 @@
1
+ import React, { useCallback, useState } from "react";
2
+
3
+ import { omit } from "@ezez/utils";
4
+
5
+ import type { StoryObj, Meta } from "@storybook/react";
6
+
7
+ import { Div } from "../native";
8
+ import { styled } from "../../theme";
9
+
10
+ import { Checkbox } from "./Checkbox";
11
+
12
+ const meta: Meta = {
13
+ title: "Components/Form/Checkbox",
14
+ component: Checkbox,
15
+ tags: ["autodocs", "form"],
16
+ argTypes: {
17
+ color: {
18
+ control: {
19
+ type: "color",
20
+ },
21
+ },
22
+ defaultChecked: {
23
+ control: {
24
+ type: "boolean",
25
+ },
26
+ },
27
+ checked: {
28
+ control: {
29
+ type: "boolean",
30
+ },
31
+ },
32
+ disabled: {
33
+ control: {
34
+ type: "boolean",
35
+ },
36
+ },
37
+ readOnly: {
38
+ control: {
39
+ type: "boolean",
40
+ },
41
+ },
42
+ onChange: {
43
+ action: "onChange",
44
+ },
45
+ },
46
+ args: {
47
+ children: "Check me",
48
+ },
49
+ };
50
+
51
+ type Story = StoryObj<typeof Checkbox>;
52
+
53
+ const Primary: Story = {};
54
+
55
+ const Green = styled(Checkbox, {
56
+ "--color": "$colors$green1",
57
+ });
58
+
59
+ const AllAtOnce: Story = {
60
+ render: (args) => {
61
+ const [v, setV] = useState(false);
62
+ const handleToggle = useCallback(() => { setV((prevV) => !prevV); }, []);
63
+
64
+ return (
65
+ <>
66
+ <Div>Red (deprecated prop):</Div>
67
+ <Checkbox {...args} color={"red"} />
68
+ <Div>Blue (css):</Div>
69
+ <Checkbox {...args} css={{ "--color": "$blue5" }} />
70
+ <Div>Green (composed):</Div>
71
+ <Green {...omit(args, ["ref"])} />
72
+ <Div>Always controlled: (checked: {String(v)})</Div>
73
+ <Checkbox {...args} checked={v} onChange={handleToggle} />
74
+ <Div>Always disabled:</Div>
75
+ <Checkbox {...args} disabled={true} />
76
+ <Div>Always read-only:</Div>
77
+ <Checkbox {...args} readOnly={true} />
78
+ </>
79
+ );
80
+ },
81
+ args: {
82
+ defaultChecked: true,
83
+ },
84
+ };
85
+
86
+ export {
87
+ Primary,
88
+ AllAtOnce,
89
+ };
90
+
91
+ export default meta;
@@ -0,0 +1,79 @@
1
+ import { styled } from "../../theme";
2
+
3
+ const TextLabel = styled("span");
4
+
5
+ const CheckmarkWrapper = styled("div", {
6
+ "borderRadius": "100px",
7
+ "background": "none",
8
+ "border": "1px solid $inactiveBg",
9
+ "width": "18px",
10
+ "height": "18px",
11
+ "display": "inline-flex",
12
+ "justifyContent": "center",
13
+ "alignItems": "center",
14
+ "verticalAlign": "middle",
15
+ "boxSizing": "border-box",
16
+
17
+ "& svg": {
18
+ display: "none",
19
+ width: "9px",
20
+ height: "9px",
21
+ fill: "white",
22
+ },
23
+
24
+ [`+ ${TextLabel.toString()}`]: {
25
+ verticalAlign: "middle",
26
+ },
27
+
28
+ ":checked + &": {
29
+ "borderWidth": 0,
30
+ "color": "var(--color)",
31
+ "background": "currentColor",
32
+ "& svg": {
33
+ display: "inline-block",
34
+ },
35
+ },
36
+
37
+ ":checked:disabled": {
38
+ background: "$inactiveDarkBg",
39
+ },
40
+
41
+ ":disabled + &": {
42
+ background: "$activeBg",
43
+ [`+ ${TextLabel.toString()}`]: {
44
+ color: "$inputDisabledText",
45
+ },
46
+ },
47
+
48
+ ":readonly + &": {
49
+ [`+ ${TextLabel.toString()}`]: {
50
+ color: "$inputDisabledText",
51
+ },
52
+ },
53
+ });
54
+
55
+ const LabelWrapper = styled("label", {
56
+ "--color": "$colors$mainColor",
57
+
58
+ "& input": {
59
+ "width": 0,
60
+ "height": 0,
61
+ "transform": "scale(0)",
62
+ "margin": 0,
63
+ "verticalAlign": "middle",
64
+ "&:focus-visible": {
65
+ [`+ ${CheckmarkWrapper.toString()}`]: {
66
+ boxShadow: "0 0 5px black",
67
+ },
68
+ },
69
+ [`+ ${CheckmarkWrapper.toString()} + ${TextLabel.toString()}:not(:empty)`]: {
70
+ marginLeft: "0.75em",
71
+ },
72
+ },
73
+ });
74
+
75
+ export {
76
+ LabelWrapper,
77
+ CheckmarkWrapper,
78
+ TextLabel,
79
+ };
@@ -1,50 +1,57 @@
1
- import React from "react";
1
+ import React, { useCallback } from "react";
2
2
 
3
- import classnames from "classnames";
3
+ import type { ThemeCSS } from "../../theme";
4
4
 
5
5
  import { Checkmark } from "../icons/Checkmark";
6
6
 
7
- import styles from "./Checkbox.module.scss";
7
+ import { CheckmarkWrapper, LabelWrapper, TextLabel } from "./Checkbox.styled";
8
8
 
9
- interface Props {
9
+ type WrapperProps = React.ComponentProps<typeof LabelWrapper>;
10
+ type InputProps = React.ComponentProps<"input">;
11
+
12
+ interface Props extends Pick<WrapperProps, "css" | "className">, Omit<InputProps, "className"> {
13
+ /**
14
+ * @deprecated use --color css variable instead
15
+ */
10
16
  color?: string;
11
- name?: string;
12
- onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
13
- checked?: boolean;
14
- disabled?: boolean;
15
- readOnly?: boolean;
16
- className?: string;
17
17
  children: React.ReactNode;
18
18
  }
19
19
 
20
- const Checkbox: React.FC<Props> = (props) => {
21
- const style: React.CSSProperties = {};
22
- props.color && (style.color = props.color);
23
-
24
- const cls = classnames(props.className, styles.checkbox, {
25
- [styles.disabled as string]: props.disabled,
26
- [styles.readOnly as string]: props.readOnly,
27
- });
28
-
29
- const checkmarkCls = classnames(styles.checkmark, {
30
- [styles.checkmarkDisabled as string]: props.disabled,
31
- [styles.checkmarkChecked as string]: props.checked,
32
- [styles.checkmarkReadOnly as string]: props.readOnly,
33
- });
20
+ /**
21
+ * Checkbox component
22
+ */
23
+ const Checkbox: React.FC<Props> = ({
24
+ // eslint-disable-next-line @typescript-eslint/no-shadow
25
+ color, name, onChange, children, css, className, ...inputProps
26
+ }) => {
27
+ const style: ThemeCSS = {};
28
+ color && (style["--color"] = color);
29
+
30
+ const wrapperProps: { css?: NonNullable<typeof css>; className?: typeof className } = { className };
31
+ if (css) {
32
+ wrapperProps.css = css;
33
+ }
34
+
35
+ const handleChange: React.ChangeEventHandler<HTMLInputElement> = useCallback((e) => {
36
+ if (inputProps.readOnly) {
37
+ // eslint-disable-next-line no-param-reassign
38
+ e.currentTarget.checked = !e.currentTarget.checked;
39
+ return;
40
+ }
41
+ onChange?.(e);
42
+ }, [inputProps.readOnly, onChange]);
34
43
 
35
44
  return (
36
- <label className={cls}>
45
+ <LabelWrapper {...wrapperProps}>
37
46
  <input
38
47
  type={"checkbox"}
39
- name={props.name}
40
- onChange={props.onChange}
41
- checked={props.checked}
42
- disabled={props.disabled}
43
- readOnly={props.readOnly}
48
+ name={name}
49
+ onChange={handleChange}
50
+ {...inputProps}
44
51
  />
45
- <span style={style} className={checkmarkCls}><Checkmark /></span>
46
- <span className={styles.label}>{props.children}</span>
47
- </label>
52
+ <CheckmarkWrapper css={style}><Checkmark /></CheckmarkWrapper>
53
+ <TextLabel>{children}</TextLabel>
54
+ </LabelWrapper>
48
55
  );
49
56
  };
50
57
 
@@ -1,14 +1,27 @@
1
1
  import React from "react";
2
2
 
3
- import { Table } from "../../../../index";
3
+ import type { StoryObj, Meta } from "@storybook/react";
4
4
 
5
- import styles from "./TableDemo.module.scss";
5
+ import { Table } from "./Table";
6
6
 
7
- interface Props {}
7
+ const meta: Meta = {
8
+ title: "Components/Layout/Table/Table",
9
+ component: Table,
10
+ tags: ["autodocs", "layout"],
8
11
 
9
- const TableDemo: React.FC<Props> = (props) => {
10
- return (
11
- <Table variant={"striped"}>
12
+ argTypes: {},
13
+ args: {
14
+ striped: true,
15
+ wide: true,
16
+ centered: true,
17
+ },
18
+ };
19
+
20
+ type Story = StoryObj<typeof Table>;
21
+
22
+ const Primary: Story = {
23
+ render: args => (
24
+ <Table {...args}>
12
25
  <thead>
13
26
  <tr>
14
27
  <th>Name</th>
@@ -20,36 +33,39 @@ const TableDemo: React.FC<Props> = (props) => {
20
33
  <tr>
21
34
  <td>Stefan</td>
22
35
  <td>41</td>
23
- <td className={styles.actions}>edit</td>
36
+ <td>edit</td>
24
37
  </tr>
25
38
  <tr>
26
39
  <td>Juliette</td>
27
40
  <td>23</td>
28
- <td className={styles.actions}>edit</td>
41
+ <td>edit</td>
29
42
  </tr>
30
43
  <tr>
31
44
  <td>Amy</td>
32
45
  <td>55</td>
33
- <td className={styles.actions}>edit</td>
46
+ <td>edit</td>
34
47
  </tr>
35
48
  <tr>
36
49
  <td>Stefan</td>
37
50
  <td>41</td>
38
- <td className={styles.actions}>edit</td>
51
+ <td>edit</td>
39
52
  </tr>
40
53
  <tr>
41
54
  <td>Juliette</td>
42
55
  <td>23</td>
43
- <td className={styles.actions}>edit</td>
56
+ <td>edit</td>
44
57
  </tr>
45
58
  <tr>
46
59
  <td>Amy</td>
47
60
  <td>55</td>
48
- <td className={styles.actions}>edit</td>
61
+ <td>edit</td>
49
62
  </tr>
50
63
  </tbody>
51
64
  </Table>
52
- );
65
+ ),
53
66
  };
54
67
 
55
- export { TableDemo };
68
+ export default meta;
69
+ export {
70
+ Primary,
71
+ };
@@ -0,0 +1,40 @@
1
+ import { styled } from "../../../theme";
2
+
3
+ const StyledTable = styled("table", {
4
+ "borderSpacing": "10px",
5
+ "borderCollapse": "collapse",
6
+
7
+ "> * > tr > *": {
8
+ textAlign: "left",
9
+ padding: "0.75em 0.5em",
10
+ borderBottom: "1px solid $border",
11
+ },
12
+
13
+ "> thead > tr:last-child > *": {
14
+ borderBottom: "2px solid $border",
15
+ boxShadow: "0 4px 10px -10px rgba(0, 0, 0, 0.6)",
16
+ },
17
+
18
+ "variants": {
19
+ striped: {
20
+ true: {
21
+ "> tbody > tr:nth-child(even) > *": {
22
+ background: "$tableStripedBg",
23
+ },
24
+ },
25
+ },
26
+ centered: {
27
+ true: {
28
+ marginLeft: "auto",
29
+ marginRight: "auto",
30
+ },
31
+ },
32
+ wide: {
33
+ true: {
34
+ width: "100%",
35
+ },
36
+ },
37
+ },
38
+ });
39
+
40
+ export { StyledTable };
@@ -1,29 +1 @@
1
- import React from "react";
2
-
3
- import classnames from "classnames";
4
-
5
- import { makeVariants } from "../../../utils/index";
6
-
7
- import styles from "./Table.module.scss";
8
-
9
- type Variant = "striped" | "raw" | "wide" | "centered";
10
-
11
- interface Props {
12
- variant?: Variant | Variant[];
13
- }
14
-
15
- const Table: React.FC<React.TableHTMLAttributes<HTMLTableElement> & Props> = (
16
- { className, children, variant, ...props },
17
- ) => {
18
- const v = makeVariants(variant);
19
-
20
- const cls = classnames(className, {
21
- [styles.table as string]: !v.includes("raw"),
22
- [styles.striped as string]: v.includes("striped"),
23
- [styles.wide as string]: v.includes("wide"),
24
- [styles.centered as string]: v.includes("centered"),
25
- });
26
- return <table className={cls} {...props}>{children}</table>;
27
- };
28
-
29
- export { Table };
1
+ export { StyledTable as Table } from "./Table.styled";
@@ -0,0 +1,102 @@
1
+ import React, { useCallback, useState } from "react";
2
+
3
+ import { SunOne } from "@icon-park/react";
4
+
5
+ import type { Meta, StoryObj } from "@storybook/react";
6
+
7
+ import { HeaderIconAction } from "../../layout/header/HeaderIconAction";
8
+ import { Icon, ICON } from "../../icons/Icon";
9
+ import { StickyHeader } from "../../layout/header/StickyHeader";
10
+ import { Header } from "../../layout/header/Header";
11
+ import { Section } from "../../layout/section/Section";
12
+
13
+ import { Pop } from "./Pop";
14
+
15
+ const meta: Meta = {
16
+ title: "Components/UI/Pop",
17
+ component: Pop,
18
+ tags: ["autodocs", "layout"],
19
+ args: {
20
+ value: 25,
21
+ valueFrom: 15,
22
+ scaleFrom: 10,
23
+ scaleTo: 30,
24
+ },
25
+ };
26
+
27
+ type Story = StoryObj<typeof Pop>;
28
+
29
+ const handleClick = () => {
30
+ console.info("Clicked an option");
31
+ };
32
+
33
+ const Primary: Story = {
34
+ // eslint-disable-next-line max-lines-per-function
35
+ render: (args) => {
36
+ // eslint-disable-next-line @typescript-eslint/no-shadow
37
+ const [open, setOpen] = useState(false);
38
+ const [leftOpen, setLeftOpen] = useState(false);
39
+
40
+ const handleToggle = useCallback(() => {
41
+ setOpen(p => !p);
42
+ }, []);
43
+
44
+ const handleLeftToggle = useCallback(() => {
45
+ setLeftOpen(p => !p);
46
+ }, []);
47
+
48
+ const handleClose = useCallback(() => {
49
+ setOpen(false);
50
+ }, []);
51
+
52
+ const handleLeftClose = useCallback(() => {
53
+ setLeftOpen(false);
54
+ }, []);
55
+
56
+ const after = (
57
+ <>
58
+ <HeaderIconAction icon={ICON.config} onClick={handleToggle} />
59
+ <Pop anchor={"prev"} open={open} onClose={handleClose}>
60
+ <Pop.Option icon={<Icon name={ICON.heart} />} onClick={handleClick}>Add new list</Pop.Option>
61
+ <Pop.Option icon={<Icon name={ICON.trash} />} onClick={handleClick}>Remove empty lists</Pop.Option>
62
+ <Pop.Option onClick={handleClick}>Configure</Pop.Option>
63
+ </Pop>
64
+ </>
65
+ );
66
+
67
+ const left = (
68
+ <>
69
+ <HeaderIconAction icon={ICON.checkmark} onClick={handleLeftToggle} />
70
+ <Pop anchor={"prev"} open={leftOpen} onClose={handleLeftClose}>
71
+ <Pop.Option icon={<Icon name={ICON.heart} />} onClick={handleClick}>Add new list</Pop.Option>
72
+ <Pop.Option icon={<Icon name={ICON.trash} />} onClick={handleClick}>Remove empty lists</Pop.Option>
73
+ <Pop.Option icon={<SunOne />} onClick={handleClick}>Configure</Pop.Option>
74
+ <Pop.Option icon={<Icon name={ICON.heart} />} onClick={handleClick}>Add new list</Pop.Option>
75
+ <Pop.Option icon={<Icon name={ICON.trash} />} onClick={handleClick}>Remove empty lists</Pop.Option>
76
+ <Pop.Option onClick={handleClick}>Configure</Pop.Option>
77
+ <Pop.Option icon={<Icon name={ICON.heart} />} onClick={handleClick}>Add new list</Pop.Option>
78
+ <Pop.Option icon={<Icon name={ICON.trash} />} onClick={handleClick}>Remove empty lists</Pop.Option>
79
+ <Pop.Option icon={<>text</>} onClick={handleClick}>Configure</Pop.Option>
80
+ </Pop>
81
+ </>
82
+ );
83
+
84
+ return (
85
+ <StickyHeader>
86
+ <Header before={left} after={after}>
87
+ Some place
88
+ </Header>
89
+ <StickyHeader.Content>
90
+ <Section horizontal={true} vertical={true} css={{ minHeight: 600 }}>
91
+ Click on the left or right icon to open the menu
92
+ </Section>
93
+ </StickyHeader.Content>
94
+ </StickyHeader>
95
+ );
96
+ },
97
+ };
98
+
99
+ export default meta;
100
+ export {
101
+ Primary,
102
+ };
@@ -0,0 +1,68 @@
1
+ import { dimensionsPxToRem, fontPxToRem, styled } from "../../../theme";
2
+
3
+ const Overlay = styled("div", {
4
+ position: "fixed",
5
+ background: "#0000004c",
6
+ inset: 0,
7
+ zIndex: 4,
8
+ });
9
+
10
+ const List = styled("ul", {
11
+ zIndex: 5,
12
+ position: "absolute",
13
+ background: "white",
14
+ margin: 0,
15
+ padding: 0,
16
+ listStyleType: "none",
17
+ });
18
+
19
+ const ListItem = styled("li", {
20
+ "margin": 0,
21
+ "padding": 0,
22
+ "listStyleType": "none",
23
+
24
+ "& + &": {
25
+ borderTop: "1px solid var(--border)",
26
+ },
27
+ });
28
+
29
+ const Button = styled("button", {
30
+ "border": "none",
31
+ "background": "white",
32
+ "height": dimensionsPxToRem(116),
33
+ "padding": `0 ${dimensionsPxToRem(42)}`,
34
+ "boxSizing": "border-box",
35
+ "width": "100%",
36
+ "minWidth": dimensionsPxToRem(460),
37
+ "textAlign": "left",
38
+ "color": "$popText",
39
+ "fontSize": fontPxToRem(26),
40
+ "fontWeight": "revert",
41
+ "display": "flex",
42
+ "alignItems": "center",
43
+
44
+ "&:hover": {
45
+ background: "$activeBg",
46
+ },
47
+ });
48
+
49
+ const Icon = styled("div", {
50
+ fill: "currentColor",
51
+ marginRight: dimensionsPxToRem(42),
52
+ });
53
+
54
+ const FakeIcon = styled("span", {
55
+ display: "inline-block",
56
+ width: 16,
57
+ height: 16,
58
+ marginRight: dimensionsPxToRem(42),
59
+ });
60
+
61
+ export {
62
+ Overlay,
63
+ List,
64
+ ListItem,
65
+ Button,
66
+ Icon,
67
+ FakeIcon,
68
+ };
@@ -1,13 +1,12 @@
1
1
  import React, { Component, createRef } from "react";
2
2
 
3
- import classnames from "classnames";
3
+ import type { ThemeCSS } from "../../../theme";
4
4
 
5
5
  import { HandleEsc } from "../../utils/HandleEsc";
6
6
 
7
7
  import { OnButtonClick } from "./OnButtonClick";
8
8
  import { PopOption } from "./PopOption";
9
-
10
- import styles from "./Pop.module.scss";
9
+ import { List, Overlay } from "./Pop.styled";
11
10
 
12
11
  interface Props {
13
12
  open: boolean;
@@ -51,6 +50,11 @@ const getElementLocation = (element: HTMLElement, outerElement = html): [State["
51
50
  return [verticalLocation, horizontalLocation];
52
51
  };
53
52
 
53
+ /**
54
+ * Popup menu component.
55
+ *
56
+ * It has a bug that miscalculates the position inside Storybook.
57
+ */
54
58
  class Pop extends Component<Props, State> {
55
59
  public constructor(props: Props) {
56
60
  super(props);
@@ -125,7 +129,7 @@ class Pop extends Component<Props, State> {
125
129
  };
126
130
 
127
131
  public override render() {
128
- const style: React.CSSProperties = {};
132
+ const style: ThemeCSS = {};
129
133
 
130
134
  if (this.state.vertical === "top") {
131
135
  style.top = this.state.y;
@@ -148,17 +152,15 @@ class Pop extends Component<Props, State> {
148
152
  const closeOnEsc = this.props.closeOnEsc ?? true;
149
153
  const esc = closeOnEsc && <HandleEsc onPress={this.handleEsc} />;
150
154
 
151
- const cls = classnames(this.props.className, styles.overlay);
152
-
153
155
  return (
154
- <div className={cls} ref={this.rootRef} onClick={this.handleOverlayClick}>
156
+ <Overlay className={this.props.className} ref={this.rootRef} onClick={this.handleOverlayClick}>
155
157
  {esc}
156
158
  <OnButtonClick onClick={this.handleEsc}>
157
- <ul className={styles.pop} style={style}>
159
+ <List css={style}>
158
160
  {this.props.children}
159
- </ul>
161
+ </List>
160
162
  </OnButtonClick>
161
- </div>
163
+ </Overlay>
162
164
  );
163
165
  }
164
166
  }
@@ -1,8 +1,6 @@
1
1
  import React from "react";
2
2
 
3
- import classnames from "classnames";
4
-
5
- import styles from "./Pop.module.scss";
3
+ import { Button, FakeIcon, Icon, ListItem } from "./Pop.styled";
6
4
 
7
5
  interface Props {
8
6
  icon?: React.ReactElement;
@@ -14,13 +12,13 @@ interface Props {
14
12
 
15
13
  const PopOption: React.FC<Props> = (props) => {
16
14
  const ic = props.icon
17
- ? <div className={styles.icon}>{props.icon}</div>
18
- : ((props.forceEmptyIcon ?? true) ? <span className={styles.fakeIcon} /> : null);
15
+ ? <Icon>{props.icon}</Icon>
16
+ : ((props.forceEmptyIcon ?? true) ? <FakeIcon /> : null);
19
17
 
20
18
  return (
21
- <li className={classnames(props.className, styles.li)}>
22
- <button onClick={props.onClick} className={styles.button}>{ic}{props.children}</button>
23
- </li>
19
+ <ListItem className={props.className}>
20
+ <Button onClick={props.onClick}>{ic}{props.children}</Button>
21
+ </ListItem>
24
22
  );
25
23
  };
26
24