react-miui 0.20.0 → 0.21.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 (319) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/components/form/input/Input.css.d.ts +47 -0
  3. package/dist/components/form/input/Input.css.d.ts.map +1 -0
  4. package/dist/components/form/input/Input.css.js +52 -0
  5. package/dist/components/form/input/Input.css.js.map +1 -0
  6. package/dist/components/form/input/Input.styled.d.ts +68 -36
  7. package/dist/components/form/input/Input.styled.d.ts.map +1 -1
  8. package/dist/components/form/input/Input.styled.js +3 -48
  9. package/dist/components/form/input/Input.styled.js.map +1 -1
  10. package/dist/components/form/textarea/TextArea.d.ts.map +1 -0
  11. package/dist/components/form/{TextArea.js → textarea/TextArea.js} +3 -10
  12. package/dist/components/form/textarea/TextArea.js.map +1 -0
  13. package/dist/components/form/textarea/TextArea.stories.d.ts +8 -0
  14. package/dist/components/form/textarea/TextArea.stories.d.ts.map +1 -0
  15. package/dist/components/form/textarea/TextArea.stories.js +15 -0
  16. package/dist/components/form/textarea/TextArea.stories.js.map +1 -0
  17. package/dist/components/{layout/list/Value.styled.d.ts → form/textarea/TextArea.styled.d.ts} +24 -12
  18. package/dist/components/form/textarea/TextArea.styled.d.ts.map +1 -0
  19. package/dist/components/form/textarea/TextArea.styled.js +9 -0
  20. package/dist/components/form/textarea/TextArea.styled.js.map +1 -0
  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/message/Message.d.ts +17 -9
  76. package/dist/components/ui/message/Message.d.ts.map +1 -1
  77. package/dist/components/ui/message/Message.styled.d.ts +17 -9
  78. package/dist/components/ui/message/Message.styled.d.ts.map +1 -1
  79. package/dist/index.d.ts +2 -2
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +2 -2
  82. package/dist/index.js.map +1 -1
  83. package/dist/scrollbars.css.d.ts +4 -0
  84. package/dist/scrollbars.css.d.ts.map +1 -0
  85. package/dist/scrollbars.css.js +34 -0
  86. package/dist/scrollbars.css.js.map +1 -0
  87. package/dist/theme.d.ts +125 -69
  88. package/dist/theme.d.ts.map +1 -1
  89. package/dist/theme.js +2 -0
  90. package/dist/theme.js.map +1 -1
  91. package/docs/assets/search.js +1 -1
  92. package/docs/classes/Drawer.html +14 -16
  93. package/docs/classes/Pop.html +14 -16
  94. package/docs/classes/ToasterProvider.html +10 -12
  95. package/docs/enums/ICON.html +14 -16
  96. package/docs/functions/Action.html +6 -8
  97. package/docs/functions/Button.html +6 -8
  98. package/docs/functions/Card.html +6 -8
  99. package/docs/functions/Checkbox.html +6 -8
  100. package/docs/functions/Choice.html +7 -9
  101. package/docs/functions/CoveringLoader.html +6 -8
  102. package/docs/functions/DirectionPad.html +6 -8
  103. package/docs/functions/EqualActions.html +6 -8
  104. package/docs/functions/FullLoader.html +6 -8
  105. package/docs/functions/HandleEsc.html +6 -8
  106. package/docs/functions/Header.html +6 -8
  107. package/docs/functions/HeaderIconAction.html +6 -8
  108. package/docs/functions/Icon-1.html +6 -8
  109. package/docs/functions/If.html +6 -8
  110. package/docs/functions/Input.html +7 -9
  111. package/docs/functions/KeyValue.html +6 -8
  112. package/docs/functions/Label.html +6 -8
  113. package/docs/functions/List-1.html +18 -10
  114. package/docs/functions/Loader.html +6 -8
  115. package/docs/functions/Loading.html +6 -8
  116. package/docs/functions/Message.html +6 -8
  117. package/docs/functions/Modal-1.html +6 -8
  118. package/docs/functions/ModalButtons-1.html +6 -8
  119. package/docs/functions/PopLoader.html +6 -8
  120. package/docs/functions/PopOption.html +6 -8
  121. package/docs/functions/SearchContainer.html +6 -8
  122. package/docs/functions/Section.html +146 -0
  123. package/docs/functions/Select.html +6 -8
  124. package/docs/functions/Selector.html +7 -9
  125. package/docs/functions/Spacer.html +6 -8
  126. package/docs/functions/Stats.html +6 -8
  127. package/docs/functions/StickyHeader-1.html +6 -8
  128. package/docs/functions/StickyHeader.Content.html +5 -7
  129. package/docs/functions/Table.html +6 -8
  130. package/docs/functions/TextArea.html +6 -8
  131. package/docs/functions/Toggle.html +6 -8
  132. package/docs/functions/getCssText.html +6 -8
  133. package/docs/functions/styled.html +6 -8
  134. package/docs/functions/useToaster.html +7 -9
  135. package/docs/index.html +6 -8
  136. package/docs/modules/List.html +10 -9
  137. package/docs/modules/Modal.html +6 -8
  138. package/docs/modules/ModalButtons.html +6 -8
  139. package/docs/modules/StickyHeader.html +6 -8
  140. package/docs/modules.html +9 -13
  141. package/docs/pages/tutorials/Test.html +6 -8
  142. package/docs/types/ThemeCSS.html +7 -9
  143. package/docs/variables/List.Header.html +8 -9
  144. package/docs/variables/List.Item.html +54 -0
  145. package/docs/variables/Modal.NegateMargin.html +5 -7
  146. package/docs/variables/ModalButtons.Button.html +5 -7
  147. package/docs/variables/cssReset.html +7 -9
  148. package/docs/variables/miuiScrollbars.html +96 -0
  149. package/esm/components/form/input/Input.css.d.ts +47 -0
  150. package/esm/components/form/input/Input.css.d.ts.map +1 -0
  151. package/esm/components/form/input/Input.css.js +48 -0
  152. package/esm/components/form/input/Input.css.js.map +1 -0
  153. package/esm/components/form/input/Input.styled.d.ts +68 -36
  154. package/esm/components/form/input/Input.styled.d.ts.map +1 -1
  155. package/esm/components/form/input/Input.styled.js +4 -49
  156. package/esm/components/form/input/Input.styled.js.map +1 -1
  157. package/esm/components/form/textarea/TextArea.d.ts.map +1 -0
  158. package/esm/components/form/textarea/TextArea.js +16 -0
  159. package/esm/components/form/textarea/TextArea.js.map +1 -0
  160. package/esm/components/form/textarea/TextArea.stories.d.ts +8 -0
  161. package/esm/components/form/textarea/TextArea.stories.d.ts.map +1 -0
  162. package/esm/components/form/textarea/TextArea.stories.js +12 -0
  163. package/esm/components/form/textarea/TextArea.stories.js.map +1 -0
  164. package/esm/components/{layout/list/Value.styled.d.ts → form/textarea/TextArea.styled.d.ts} +24 -12
  165. package/esm/components/form/textarea/TextArea.styled.d.ts.map +1 -0
  166. package/esm/components/form/textarea/TextArea.styled.js +14 -0
  167. package/esm/components/form/textarea/TextArea.styled.js.map +1 -0
  168. package/esm/components/layout/list/Header.d.ts +174 -7
  169. package/esm/components/layout/list/Header.d.ts.map +1 -1
  170. package/esm/components/layout/list/Header.js +24 -11
  171. package/esm/components/layout/list/Header.js.map +1 -1
  172. package/esm/components/layout/list/Header.stories.d.ts +8 -0
  173. package/esm/components/layout/list/Header.stories.d.ts.map +1 -0
  174. package/esm/components/layout/list/Header.stories.js +27 -0
  175. package/esm/components/layout/list/Header.stories.js.map +1 -0
  176. package/esm/components/layout/list/Item.d.ts +88 -7
  177. package/esm/components/layout/list/Item.d.ts.map +1 -1
  178. package/esm/components/layout/list/Item.js +64 -33
  179. package/esm/components/layout/list/Item.js.map +1 -1
  180. package/esm/components/layout/list/Item.stories.d.ts +10 -0
  181. package/esm/components/layout/list/Item.stories.d.ts.map +1 -0
  182. package/esm/components/layout/list/Item.stories.js +57 -0
  183. package/esm/components/layout/list/Item.stories.js.map +1 -0
  184. package/esm/components/layout/list/Label.d.ts +83 -5
  185. package/esm/components/layout/list/Label.d.ts.map +1 -1
  186. package/esm/components/layout/list/Label.js +12 -6
  187. package/esm/components/layout/list/Label.js.map +1 -1
  188. package/esm/components/layout/list/Label.stories.d.ts +8 -0
  189. package/esm/components/layout/list/Label.stories.d.ts.map +1 -0
  190. package/esm/components/layout/list/Label.stories.js +29 -0
  191. package/esm/components/layout/list/Label.stories.js.map +1 -0
  192. package/esm/components/layout/list/List.d.ts +86 -7
  193. package/esm/components/layout/list/List.d.ts.map +1 -1
  194. package/esm/components/layout/list/List.js +15 -9
  195. package/esm/components/layout/list/List.js.map +1 -1
  196. package/esm/components/layout/list/List.stories.d.ts +9 -0
  197. package/esm/components/layout/list/List.stories.d.ts.map +1 -0
  198. package/esm/components/layout/list/List.stories.js +46 -0
  199. package/esm/components/layout/list/List.stories.js.map +1 -0
  200. package/esm/components/layout/list/Value.d.ts +81 -1
  201. package/esm/components/layout/list/Value.d.ts.map +1 -1
  202. package/esm/components/layout/list/Value.js +9 -1
  203. package/esm/components/layout/list/Value.js.map +1 -1
  204. package/esm/components/layout/list/Value.stories.d.ts +8 -0
  205. package/esm/components/layout/list/Value.stories.d.ts.map +1 -0
  206. package/esm/components/layout/list/Value.stories.js +23 -0
  207. package/esm/components/layout/list/Value.stories.js.map +1 -0
  208. package/esm/components/layout/section/Section.d.ts +83 -8
  209. package/esm/components/layout/section/Section.d.ts.map +1 -1
  210. package/esm/components/layout/section/Section.js +17 -12
  211. package/esm/components/layout/section/Section.js.map +1 -1
  212. package/esm/components/layout/section/Section.stories.d.ts +8 -0
  213. package/esm/components/layout/section/Section.stories.d.ts.map +1 -0
  214. package/esm/components/layout/section/Section.stories.js +31 -0
  215. package/esm/components/layout/section/Section.stories.js.map +1 -0
  216. package/esm/components/layout/section/SectionContainer.d.ts +80 -5
  217. package/esm/components/layout/section/SectionContainer.d.ts.map +1 -1
  218. package/esm/components/layout/section/SectionContainer.js +9 -5
  219. package/esm/components/layout/section/SectionContainer.js.map +1 -1
  220. package/esm/components/ui/message/Message.d.ts +17 -9
  221. package/esm/components/ui/message/Message.d.ts.map +1 -1
  222. package/esm/components/ui/message/Message.styled.d.ts +17 -9
  223. package/esm/components/ui/message/Message.styled.d.ts.map +1 -1
  224. package/esm/index.d.ts +2 -2
  225. package/esm/index.d.ts.map +1 -1
  226. package/esm/index.js +2 -2
  227. package/esm/index.js.map +1 -1
  228. package/esm/scrollbars.css.d.ts +4 -0
  229. package/esm/scrollbars.css.d.ts.map +1 -0
  230. package/esm/scrollbars.css.js +49 -0
  231. package/esm/scrollbars.css.js.map +1 -0
  232. package/esm/theme.d.ts +125 -69
  233. package/esm/theme.d.ts.map +1 -1
  234. package/esm/theme.js +2 -0
  235. package/esm/theme.js.map +1 -1
  236. package/package.json +7 -6
  237. package/src/components/form/input/Input.css.ts +60 -0
  238. package/src/components/form/input/Input.styled.ts +4 -52
  239. package/src/components/form/textarea/TextArea.stories.tsx +21 -0
  240. package/src/components/form/textarea/TextArea.styled.ts +19 -0
  241. package/src/components/form/{TextArea.tsx → textarea/TextArea.tsx} +10 -9
  242. package/src/components/layout/list/Header.stories.tsx +40 -0
  243. package/src/components/layout/list/Header.tsx +43 -26
  244. package/src/components/layout/list/Item.stories.tsx +69 -0
  245. package/src/components/layout/list/Item.tsx +118 -46
  246. package/src/components/layout/list/Label.stories.tsx +45 -0
  247. package/src/components/layout/list/Label.tsx +21 -12
  248. package/src/components/layout/list/List.stories.tsx +84 -0
  249. package/src/components/layout/list/List.tsx +34 -23
  250. package/src/components/layout/list/Value.stories.tsx +37 -0
  251. package/src/components/layout/list/Value.tsx +15 -1
  252. package/src/components/layout/section/Section.stories.tsx +54 -0
  253. package/src/components/layout/section/Section.tsx +27 -27
  254. package/src/components/layout/section/SectionContainer.tsx +10 -13
  255. package/src/demo/components/form/Choice.tsx +3 -3
  256. package/src/demo/components/form/Form.tsx +1 -1
  257. package/src/demo/components/form/Search.tsx +3 -1
  258. package/src/demo/components/form/Toggle.tsx +3 -1
  259. package/src/demo/components/layout/card/Card.tsx +3 -3
  260. package/src/demo/components/ui/icons/Icons.tsx +3 -1
  261. package/src/demo/components/ui/keyValue/KeyValue.tsx +1 -1
  262. package/src/demo/components/ui/modal/Modal.tsx +4 -2
  263. package/src/demo/components/ui/pop/Pop.tsx +1 -1
  264. package/src/demo/componentsMap.ts +0 -52
  265. package/src/index.ts +3 -2
  266. package/src/pages/_app.tsx +2 -0
  267. package/src/scrollbars.css.ts +56 -0
  268. package/src/theme.ts +5 -3
  269. package/dist/components/form/TextArea.d.ts.map +0 -1
  270. package/dist/components/form/TextArea.js.map +0 -1
  271. package/dist/components/layout/list/Header.module.scss +0 -8
  272. package/dist/components/layout/list/Item.module.scss +0 -46
  273. package/dist/components/layout/list/Label.module.scss +0 -9
  274. package/dist/components/layout/list/List.module.scss +0 -8
  275. package/dist/components/layout/list/Value.styled.d.ts.map +0 -1
  276. package/dist/components/layout/list/Value.styled.js +0 -13
  277. package/dist/components/layout/list/Value.styled.js.map +0 -1
  278. package/dist/components/layout/section/Section.module.scss +0 -24
  279. package/dist/components/layout/section/SectionContainer.module.scss +0 -4
  280. package/docs/functions/Item-1.html +0 -109
  281. package/docs/functions/Section-1.html +0 -109
  282. package/docs/modules/Item.html +0 -64
  283. package/docs/modules/Section.html +0 -61
  284. package/docs/variables/Item.Label.html +0 -56
  285. package/docs/variables/Item.Value.html +0 -56
  286. package/docs/variables/Section.Container.html +0 -55
  287. package/esm/components/form/TextArea.d.ts.map +0 -1
  288. package/esm/components/form/TextArea.js +0 -20
  289. package/esm/components/form/TextArea.js.map +0 -1
  290. package/esm/components/layout/list/Header.module.scss +0 -8
  291. package/esm/components/layout/list/Item.module.scss +0 -46
  292. package/esm/components/layout/list/Label.module.scss +0 -9
  293. package/esm/components/layout/list/List.module.scss +0 -8
  294. package/esm/components/layout/list/Value.styled.d.ts.map +0 -1
  295. package/esm/components/layout/list/Value.styled.js +0 -10
  296. package/esm/components/layout/list/Value.styled.js.map +0 -1
  297. package/esm/components/layout/section/Section.module.scss +0 -24
  298. package/esm/components/layout/section/SectionContainer.module.scss +0 -4
  299. package/src/components/layout/list/Header.module.scss +0 -8
  300. package/src/components/layout/list/Item.module.scss +0 -46
  301. package/src/components/layout/list/Label.module.scss +0 -9
  302. package/src/components/layout/list/List.module.scss +0 -8
  303. package/src/components/layout/list/Value.styled.ts +0 -13
  304. package/src/components/layout/section/Section.module.scss +0 -24
  305. package/src/components/layout/section/SectionContainer.module.scss +0 -4
  306. package/src/demo/components/form/Input.tsx +0 -28
  307. package/src/demo/components/layout/list/Header.tsx +0 -23
  308. package/src/demo/components/layout/list/Inset.tsx +0 -23
  309. package/src/demo/components/layout/list/ItemRatio.tsx +0 -20
  310. package/src/demo/components/layout/list/Label.tsx +0 -31
  311. package/src/demo/components/layout/list/List.Item.module.scss +0 -7
  312. package/src/demo/components/layout/list/List.Item.tsx +0 -24
  313. package/src/demo/components/layout/list/Selection.tsx +0 -16
  314. package/src/demo/components/layout/list/Value.module.scss +0 -4
  315. package/src/demo/components/layout/list/Value.tsx +0 -25
  316. package/src/demo/components/layout/section/Section.tsx +0 -33
  317. package/src/demo/components/ui/message/Message.tsx +0 -27
  318. /package/dist/components/form/{TextArea.d.ts → textarea/TextArea.d.ts} +0 -0
  319. /package/esm/components/form/{TextArea.d.ts → textarea/TextArea.d.ts} +0 -0
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+
3
+ import type { StoryObj, Meta } from "@storybook/react";
4
+
5
+ import { List } from "../list/List.js";
6
+ import { Item } from "../list/Item.js";
7
+
8
+ import { Section } from "./Section.js";
9
+
10
+ const meta: Meta = {
11
+ title: "Components/Layout/Section",
12
+ component: Section,
13
+ tags: ["autodocs", "layout"],
14
+ argTypes: {
15
+ vertical: {
16
+ type: "boolean",
17
+ },
18
+ horizontal: {
19
+ type: "boolean",
20
+ },
21
+ },
22
+ };
23
+
24
+ type Story = StoryObj<typeof Section>;
25
+
26
+ const Primary: Story = {
27
+ args: {},
28
+ render: (args) => (
29
+ <div style={{ border: "1px solid #ddd" }}>
30
+ <Section.Container>
31
+ <Section {...args}>
32
+ This is an example section, arguments in the arguments table are applied only to this
33
+ section. By default sections do not have any padding, so you can place elements that should touch
34
+ the edges. Use `vertical` and `horizontal` arguments to add padding.
35
+ </Section>
36
+ <Section vertical={true} horizontal={true}>
37
+ Some section
38
+ </Section>
39
+ <Section>
40
+ <List>
41
+ <Item>Some item</Item>
42
+ <Item>Some item</Item>
43
+ </List>
44
+ </Section>
45
+ </Section.Container>
46
+ </div>
47
+ ),
48
+ };
49
+
50
+ export {
51
+ Primary,
52
+ };
53
+
54
+ export default meta;
@@ -1,37 +1,37 @@
1
- import React from "react";
2
-
3
- import classnames from "classnames";
4
-
5
- import { makeVariants } from "../../../utils/makeVariants.js";
1
+ import { pxToRem, styled } from "../../../theme.js";
6
2
 
7
3
  import { SectionContainer } from "./SectionContainer.js";
8
- import styles from "./Section.module.scss";
9
4
 
10
5
  interface SubComponents {
11
6
  Container: typeof SectionContainer;
12
7
  }
13
8
 
14
- type Variant = "horizontal" | "vertical";
15
-
16
- interface Props {
17
- variant?: Variant | Variant[];
18
- className?: string;
19
- children: React.ReactNode;
20
- }
21
-
22
- const Section: React.FC<Props> & SubComponents = (props) => {
23
- const v = makeVariants(props.variant);
24
-
25
- const cls = classnames(props.className, styles.section, {
26
- [styles.vertical]: v.includes("vertical"),
27
- [styles.horizontal]: v.includes("horizontal"),
28
- });
29
- return (
30
- <section className={cls}>
31
- {props.children}
32
- </section>
33
- );
34
- };
9
+ const SectionCmp = styled("div", {
10
+ background: "$background",
11
+
12
+ variants: {
13
+ vertical: {
14
+ true: {
15
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
16
+ py: pxToRem(23),
17
+ },
18
+ },
19
+ horizontal: {
20
+ true: {
21
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
22
+ px: pxToRem(23),
23
+ },
24
+ },
25
+ },
26
+ });
27
+
28
+ /**
29
+ * A section is a container that can be used to group related content.
30
+ *
31
+ * You should use it along with the `Section.Container` component. Container stretches to fill the available space and
32
+ * has darker background color, sections are lighter and have a gap between them.
33
+ */
34
+ const Section = SectionCmp as typeof SectionCmp & SubComponents;
35
35
 
36
36
  Section.Container = SectionContainer;
37
37
 
@@ -1,15 +1,12 @@
1
- import React from "react";
2
-
3
- import styles from "./SectionContainer.module.scss";
4
-
5
- interface Props {
6
- children: React.ReactNode;
7
- }
8
-
9
- const SectionContainer: React.FC<Props> = (props) => {
10
- return (
11
- <div className={styles.container}>{props.children}</div>
12
- );
13
- };
1
+ import { styled } from "../../../theme.js";
2
+
3
+ const SectionContainer = styled("div", {
4
+ background: "$toolbarBg",
5
+ flex: 1,
6
+ height: "100%",
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ gap: 23,
10
+ });
14
11
 
15
12
  export { SectionContainer };
@@ -12,7 +12,7 @@ const ChoiceDemo: React.FC<Props> = () => {
12
12
  const [current, handleCurrent] = useState(values[0]);
13
13
 
14
14
  return (
15
- <Section variant={["vertical", "horizontal"]}>
15
+ <Section vertical={true} horizontal={true}>
16
16
  <Choice values={values} value={current} name={"rnd"} onChange={handleCurrent} />
17
17
  </Section>
18
18
  );
@@ -34,7 +34,7 @@ const ChoiceDemo2: React.FC<Props> = () => {
34
34
 
35
35
  return (
36
36
  <>
37
- <Section variant={["vertical", "horizontal"]}>
37
+ <Section vertical={true} horizontal={true}>
38
38
  <Choice
39
39
  values={values2}
40
40
  value={current}
@@ -46,7 +46,7 @@ const ChoiceDemo2: React.FC<Props> = () => {
46
46
 
47
47
  Current: {current}
48
48
  </Section>
49
- <Section variant={["vertical", "horizontal"]}>
49
+ <Section vertical={true} horizontal={true}>
50
50
  <Choice
51
51
  values={values2}
52
52
  value={current}
@@ -9,7 +9,7 @@ const FormDemo = () => {
9
9
  return (
10
10
  <Section.Container>
11
11
  <Section>
12
- <Section variant={["vertical", "horizontal"]}>
12
+ <Section vertical={true} horizontal={true}>
13
13
  <Label label={"First name"}>
14
14
  <Input placeholder={""} />
15
15
  </Label>
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
2
 
3
- import { SearchContainer, Input, ICON, Icon, Section, List, Item } from "../../../index.js";
3
+ import { SearchContainer, Input, ICON, Icon, Section, List } from "../../../index.js";
4
+
5
+ const Item = List.Item;
4
6
 
5
7
  const SearchDemo = () => {
6
8
  return (
@@ -1,6 +1,8 @@
1
1
  import React, { useCallback, useEffect, useState } from "react";
2
2
 
3
- import { Toggle, List, Item, useToaster } from "../../../index.js";
3
+ import { Toggle, List, useToaster } from "../../../index.js";
4
+
5
+ const Item = List.Item;
4
6
 
5
7
  const handleNoop = () => undefined;
6
8
 
@@ -6,13 +6,13 @@ const CardDemo = () => {
6
6
  return (
7
7
  <Section.Container>
8
8
  <Card>
9
- <Section variant={["vertical", "horizontal"]}>Content</Section>
9
+ <Section vertical={true} horizontal={true}>Content</Section>
10
10
  </Card>
11
11
  <Card>
12
- <Section variant={["vertical", "horizontal"]}>Content</Section>
12
+ <Section vertical={true} horizontal={true}>Content</Section>
13
13
  </Card>
14
14
  <Card variant={"margin"}>
15
- <Section variant={["vertical", "horizontal"]}>Content</Section>
15
+ <Section vertical={true} horizontal={true}>Content</Section>
16
16
  </Card>
17
17
  </Section.Container>
18
18
  );
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
2
 
3
- import { Icon, ICON, Item, List } from "../../../../index.js";
3
+ import { Icon, ICON, List } from "../../../../index.js";
4
+
5
+ const Item = List.Item;
4
6
 
5
7
  const IconsDemo: React.FC = () => {
6
8
  const icons = Object.values(ICON).map((value) => {
@@ -40,7 +40,7 @@ const items = [
40
40
 
41
41
  const KeyValueDemo: React.FC<Props> = (props) => {
42
42
  return (
43
- <Section variant={["vertical", "horizontal"]}>
43
+ <Section vertical={true} horizontal={true}>
44
44
  <KeyValue items={items} valueFirst={true} cols={3} />
45
45
  </Section>
46
46
  );
@@ -1,6 +1,8 @@
1
1
  import React, { useCallback, useState } from "react";
2
2
 
3
- import { Modal, Button, Input, Checkbox, Label, ModalButtons, List, Item } from "../../../../index.js";
3
+ import { Modal, Button, Input, Checkbox, Label, ModalButtons, List } from "../../../../index.js";
4
+
5
+ const Item = List.Item;
4
6
 
5
7
  interface Props {}
6
8
 
@@ -89,7 +91,7 @@ const ModalOptionsDemo: React.FC<Props> = (props) => {
89
91
  <Button onClick={handleOpen}>Open modal</Button>
90
92
  <Modal onClose={handleClose} isOpen={open} title={"Format C:?"}>
91
93
  <Modal.NegateMargin>
92
- <List variant={"inset"}>
94
+ <List inset={true}>
93
95
  <Item selected={false} onClick={handleClose}>First item</Item>
94
96
  <Item selected={true} onClick={handleClose}>Second item</Item>
95
97
  <Item selected={false} onClick={handleClose}>Third item</Item>
@@ -66,7 +66,7 @@ const PopDemo: React.FC<Props> = () => {
66
66
  Some place
67
67
  </Header>
68
68
  <StickyHeader.Content>
69
- <Section variant={["vertical", "horizontal"]}>
69
+ <Section horizontal={true} vertical={true}>
70
70
  Click on the left or right icon to open the menu
71
71
  </Section>
72
72
  </StickyHeader.Content>
@@ -14,7 +14,6 @@ import {
14
14
  StickyHeaderDemo, StickyHeaderLeftCenterDemo, StickyHeaderLeftDemo, StickyHeaderRightDemo,
15
15
  StickyHeaderTopBottomDemo,
16
16
  } from "./components/layout/header/StickyHeader.js";
17
- import { ListItemDemo } from "./components/layout/list/List.Item.js";
18
17
  import { DirectionPadDemo } from "./components/ui/directionPad/Pad.js";
19
18
  import { IconsDemo } from "./components/ui/icons/Icons.js";
20
19
  import { ButtonDemo } from "./components/ui/button/ButtonDemo.js";
@@ -26,23 +25,14 @@ import {
26
25
  ActionsOnLeft,
27
26
  } from "./components/ui/action/Action.js";
28
27
  import { ToggleDemo } from "./components/form/Toggle.js";
29
- import { ItemRatioDemo } from "./components/layout/list/ItemRatio.js";
30
- import { ItemLabelDemo } from "./components/layout/list/Label.js";
31
- import { ListHeaderDemo } from "./components/layout/list/Header.js";
32
- import { ValueDemo } from "./components/layout/list/Value.js";
33
- import { SectionDemo } from "./components/layout/section/Section.js";
34
28
  import { CardDemo } from "./components/layout/card/Card.js";
35
- import { InputDemo } from "./components/form/Input.js";
36
29
  import { FormDemo } from "./components/form/Form.js";
37
30
  import { SearchDemo } from "./components/form/Search.js";
38
31
  import { LabelDemo } from "./components/form/Label.js";
39
32
  import { ToasterDemo } from "./components/ui/toaster/Toaster.js";
40
33
  import { ModalCenteredDemo, ModalDemo, ModalOptionsDemo } from "./components/ui/modal/Modal.js";
41
- import { ListInsetDemo } from "./components/layout/list/Inset.js";
42
- import { ListSelectionDemo } from "./components/layout/list/Selection.js";
43
34
  import { TabsDemo } from "./components/ui/tabs/Tabs.js";
44
35
  import { ChoiceDemo, ChoiceDemo2 } from "./components/form/Choice.js";
45
- import { MessageDemo } from "./components/ui/message/Message.js";
46
36
  import { PopDemo } from "./components/ui/pop/Pop.js";
47
37
  import { DrawerDemo } from "./components/ui/drawer/Drawer.js";
48
38
  import { StatsDarkDemo, StatsDemo } from "./components/ui/stats/Stats.js";
@@ -66,10 +56,6 @@ const componentsMap: TheMap = {
66
56
  name: "Form",
67
57
  Component: FormDemo,
68
58
  children: {
69
- Input: {
70
- name: "Input",
71
- Component: InputDemo,
72
- },
73
59
  Select: {
74
60
  name: "Select",
75
61
  Component: SelectDemo,
@@ -186,40 +172,6 @@ const componentsMap: TheMap = {
186
172
  name: "Tabs",
187
173
  Component: TabsDemo,
188
174
  },
189
- ListItem: {
190
- name: "List & Item",
191
- Component: ListItemDemo,
192
- children: {
193
- Ratio: {
194
- name: "Alignment",
195
- Component: ItemRatioDemo,
196
- },
197
- Header: {
198
- name: "Header",
199
- Component: ListHeaderDemo,
200
- },
201
- Inset: {
202
- name: "Inset",
203
- Component: ListInsetDemo,
204
- },
205
- Selection: {
206
- name: "Selection",
207
- Component: ListSelectionDemo,
208
- },
209
- Label: {
210
- name: "Label",
211
- Component: ItemLabelDemo,
212
- },
213
- Value: {
214
- name: "Value",
215
- Component: ValueDemo,
216
- },
217
- },
218
- },
219
- Section: {
220
- name: "Section",
221
- Component: SectionDemo,
222
- },
223
175
  Card: {
224
176
  name: "Card",
225
177
  Component: CardDemo,
@@ -250,10 +202,6 @@ const componentsMap: TheMap = {
250
202
  name: "Toaster",
251
203
  Component: ToasterDemo,
252
204
  },
253
- Message: {
254
- name: "Message",
255
- Component: MessageDemo,
256
- },
257
205
  Drawer: {
258
206
  name: "Drawer",
259
207
  Component: DrawerDemo,
package/src/index.ts CHANGED
@@ -3,7 +3,7 @@ export * from "./components/form/choice/Choice.js";
3
3
  export * from "./components/form/Checkbox.js";
4
4
  export * from "./components/form/Label.js";
5
5
  export * from "./components/form/Select.js";
6
- export * from "./components/form/TextArea.js";
6
+ export * from "./components/form/textarea/TextArea.js";
7
7
  export * from "./components/form/Toggle.js";
8
8
 
9
9
  export * from "./components/form/index.js";
@@ -15,7 +15,6 @@ export * from "./components/layout/header/Header.js";
15
15
  export * from "./components/layout/header/HeaderIconAction.js";
16
16
  export * from "./components/layout/header/StickyHeader.js";
17
17
  export * from "./components/layout/list/List.js";
18
- export * from "./components/layout/list/Item.js";
19
18
  export * from "./components/layout/section/SearchContainer.js";
20
19
  export * from "./components/layout/section/Section.js";
21
20
  export * from "./components/layout/table/Table.js";
@@ -45,6 +44,8 @@ export * from "./components/utils/HandleEsc.js";
45
44
  export * from "./components/utils/If.js";
46
45
  export * from "./components/utils/Spacer.js";
47
46
 
47
+ export * from "./scrollbars.css.js";
48
+
48
49
  export type { ThemeCSS } from "./theme.js";
49
50
 
50
51
  export { getCssText, styled } from "./theme.js";
@@ -7,11 +7,13 @@ import type { AppProps } from "next/app";
7
7
  import "../global.scss";
8
8
  import "../demo-global.scss";
9
9
  import "../scrollbars.scss";
10
+ import { cssReset } from "../theme.css-reset";
10
11
 
11
12
  const MyApp = ({ Component, pageProps }: AppProps) => (
12
13
  <>
13
14
  <Head>
14
15
  <title>MIUI in React</title>
16
+ <style id={"miui-css-reset"} dangerouslySetInnerHTML={{ __html: cssReset }} />
15
17
  </Head>
16
18
  <Component {...pageProps} />
17
19
  </>
@@ -0,0 +1,56 @@
1
+ import type { ThemeCSS } from "./theme";
2
+
3
+ import { pxToRem } from "./theme.js";
4
+
5
+ const thumbStyle = {
6
+ background: "var(--scrollbars-thumb)",
7
+ backgroundClip: "padding-box",
8
+ border: "2px solid var(--scrollbars-bg)",
9
+ borderRadius: "$1",
10
+ };
11
+
12
+ const thumbActive: ThemeCSS = {
13
+ background: "var(--scrollbars-thumb-active)",
14
+ border: "2px solid var(--scrollbars-bg)",
15
+ };
16
+
17
+ // @TODO use colors from theme
18
+ const miuiScrollbars: ThemeCSS = {
19
+ "--scrollbars-thumb": "#737373",
20
+ "--scrollbars-thumb-active": "#737373",
21
+ "--scrollbars-bg": "transparent",
22
+ "scrollbar-color": "var(--scrollbars-thumb) var(--scrollbars-bg)",
23
+ "scrollbar-width": "thin !important",
24
+
25
+ "&::-webkit-scrollbar": {
26
+ height: pxToRem(7),
27
+ width: pxToRem(7),
28
+ backgroundColor: "transparent",
29
+ borderRadius: pxToRem(7),
30
+ },
31
+ "&::-webkit-scrollbar-thumb:vertical": {
32
+ ...thumbStyle,
33
+ "minHeight": pxToRem(10),
34
+ "marginRight": pxToRem(2),
35
+ "&:active": {
36
+ ...thumbActive,
37
+ minHeight: pxToRem(8),
38
+ marginRight: pxToRem(4),
39
+ },
40
+ },
41
+ "&::-webkit-scrollbar-thumb:horizontal": {
42
+ ...thumbStyle,
43
+ "minWidth": pxToRem(10),
44
+ "marginBottom": pxToRem(2),
45
+ "&:active": {
46
+ ...thumbActive,
47
+ minWidth: pxToRem(8),
48
+ marginBottom: pxToRem(4),
49
+ },
50
+ },
51
+ "&::-webkit-scrollbar-corner": {
52
+ backgroundColor: "transparent",
53
+ },
54
+ };
55
+
56
+ export { miuiScrollbars };
package/src/theme.ts CHANGED
@@ -98,9 +98,11 @@ const {
98
98
  },
99
99
  },
100
100
  utils: {
101
- mx: (value: string) => ({ marginLeft: value, marginRight: value }),
102
- my: (value: string) => ({ marginTop: value, marginBottom: value }),
103
- size: (value: string) => ({ width: value, height: value }),
101
+ mx: (value: string | number) => ({ marginLeft: value, marginRight: value }),
102
+ my: (value: string | number) => ({ marginTop: value, marginBottom: value }),
103
+ px: (value: string | number) => ({ paddingLeft: value, paddingRight: value }),
104
+ py: (value: string | number) => ({ paddingTop: value, paddingBottom: value }),
105
+ size: (value: string | number) => ({ width: value, height: value }),
104
106
  },
105
107
  });
106
108
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/form/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAMrD,UAAU,KAAK;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC;CACpB;AAED,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAwBjF,CAAC;AAEF,OAAO,EACH,QAAQ,GACX,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../src/components/form/TextArea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AAErD,4DAAoC;AAEpC,kFAA+C;AAM/C,MAAM,QAAQ,GAAwE,CAAC,EAItF,EAAE,EAAE;QAJkF,EACnF,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,MAAM,OAElB,EADM,KAAK,cAH2E,8CAItF,CADW;IAER,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,CAAC,CAAwC,EAAE,EAAE;QACzE,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,CAAC;IACjB,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,MAAM,UAAU,GAAG,IAAA,mBAAW,EAAC,CAAC,CAAwC,EAAE,EAAE;QACxE,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,CAAC,CAAC,CAAC;IAChB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,GAAG,GAAG,IAAA,oBAAU,EAAC,2BAAM,CAAC,OAAO,EAAE;QACnC,CAAC,2BAAM,CAAC,cAAc,CAAC,EAAE,OAAO;KACnC,EAAE,2BAAM,CAAC,KAAK,EAAE,2BAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAE7C,OAAO,CACH,4DAAc,KAAK,IAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,CACpF,CAAC;AACN,CAAC,CAAC;AAGE,4BAAQ"}
@@ -1,8 +0,0 @@
1
- .header > * {
2
- padding-top: calc(80px / var(--ratio-dimensions));
3
- padding-bottom: calc(40px / var(--ratio-dimensions));
4
-
5
- font-size: calc(26px / var(--ratio-font));
6
- color: var(--sub);
7
- text-transform: uppercase;
8
- }
@@ -1,46 +0,0 @@
1
- .item {
2
- list-style-type: none;
3
- margin: 0;
4
- padding: 0;
5
- font-size: calc(34px / var(--ratio-font));
6
-
7
- &:not(:first-child) {
8
- border-top: 0.37px solid var(--header-border);
9
- }
10
-
11
- > * {
12
- display: block;
13
- padding: 0;
14
- text-decoration: none;
15
- }
16
- }
17
-
18
- .button {
19
- border: none;
20
- background: none;
21
- width: 100%;
22
- text-align: left;
23
- font-family: inherit;
24
- font-size: inherit;
25
- }
26
-
27
- .content {
28
- display: flex;
29
- min-height: calc(174px / var(--ratio-dimensions));
30
- align-items: center;
31
- }
32
-
33
- .inset {
34
- padding-left: calc(37px / var(--ratio-dimensions));
35
- padding-right: calc(37px / var(--ratio-dimensions));
36
- }
37
-
38
- .icon {
39
- width: 7px;
40
- margin-right: 10px;
41
- display: inline-block;
42
- }
43
-
44
- .selected {
45
- color: var(--main-color);
46
- }
@@ -1,9 +0,0 @@
1
- .sub {
2
- font-size: calc(27px / var(--ratio-font));
3
- color: var(--sub);
4
- margin-top: calc(27px / var(--ratio-font) / 3);
5
- }
6
-
7
- .root {
8
- padding: calc(54px / var(--ratio-dimensions)) 0;
9
- }
@@ -1,8 +0,0 @@
1
- .list {
2
- margin: 0 23px;
3
- padding: 0;
4
- }
5
-
6
- .inset {
7
- margin: 0;
8
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Value.styled.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/list/Value.styled.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMf,CAAC;AAEH,OAAO,EACH,WAAW,GACd,CAAC"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StyledValue = void 0;
4
- const theme_js_1 = require("../../../theme.js");
5
- const StyledValue = (0, theme_js_1.styled)("div", {
6
- color: "var(--icon)",
7
- fontSize: "calc(26px / var(--ratio-font))",
8
- display: "flex",
9
- justifyContent: "flex-end",
10
- flex: 1,
11
- });
12
- exports.StyledValue = StyledValue;
13
- //# sourceMappingURL=Value.styled.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Value.styled.js","sourceRoot":"","sources":["../../../../src/components/layout/list/Value.styled.ts"],"names":[],"mappings":";;;AAAA,gDAA2C;AAE3C,MAAM,WAAW,GAAG,IAAA,iBAAM,EAAC,KAAK,EAAE;IAC9B,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,gCAAgC;IAC1C,OAAO,EAAE,MAAM;IACf,cAAc,EAAE,UAAU;IAC1B,IAAI,EAAE,CAAC;CACV,CAAC,CAAC;AAGC,kCAAW"}
@@ -1,24 +0,0 @@
1
- .section {
2
- background: var(--background);
3
- }
4
-
5
- .section + .section {
6
- margin-top: 23px;
7
- }
8
-
9
- .vertical {
10
- margin-top: 23px;
11
- margin-bottom: 23px;
12
- }
13
-
14
- .horizontal {
15
- margin-left: 23px;
16
- margin-right: 23px;
17
- }
18
-
19
- .section > .section.vertical {
20
- padding-top: 23px;
21
- padding-bottom: 23px;
22
- margin-top: 0;
23
- margin-bottom: 0;
24
- }
@@ -1,4 +0,0 @@
1
- .container {
2
- background: var(--toolbar-bg);
3
- flex: 1;
4
- }