react-miui 0.9.5 → 0.12.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 (236) hide show
  1. package/CHANGELOG.md +29 -2
  2. package/assets/checkmark.svg +1 -4
  3. package/assets/config.svg +1 -0
  4. package/assets/dots.svg +1 -0
  5. package/assets/heart.svg +1 -0
  6. package/assets/sources/checkmark.fla +0 -0
  7. package/assets/sources/config.fla +0 -0
  8. package/assets/sources/dots.fla +0 -0
  9. package/assets/sources/heart.fla +0 -0
  10. package/assets/sources/trash.fla +0 -0
  11. package/assets/trash.svg +1 -0
  12. package/dist/components/icons/Back.js +1 -1
  13. package/dist/components/icons/Back.js.map +1 -1
  14. package/dist/components/icons/Battery.d.ts.map +1 -1
  15. package/dist/components/icons/Battery.js +1 -1
  16. package/dist/components/icons/Battery.js.map +1 -1
  17. package/dist/components/icons/Checkmark.d.ts.map +1 -1
  18. package/dist/components/icons/Checkmark.js +2 -2
  19. package/dist/components/icons/Checkmark.js.map +1 -1
  20. package/dist/components/icons/Config.d.ts +7 -0
  21. package/dist/components/icons/Config.d.ts.map +1 -0
  22. package/dist/components/icons/Config.js +13 -0
  23. package/dist/components/icons/Config.js.map +1 -0
  24. package/dist/components/icons/Dots.d.ts +7 -0
  25. package/dist/components/icons/Dots.d.ts.map +1 -0
  26. package/dist/components/icons/Dots.js +13 -0
  27. package/dist/components/icons/Dots.js.map +1 -0
  28. package/dist/components/icons/Forward.js +1 -1
  29. package/dist/components/icons/Forward.js.map +1 -1
  30. package/dist/components/icons/Heart.d.ts +7 -0
  31. package/dist/components/icons/Heart.d.ts.map +1 -0
  32. package/dist/components/icons/Heart.js +13 -0
  33. package/dist/components/icons/Heart.js.map +1 -0
  34. package/dist/components/icons/Icon.d.ts +5 -1
  35. package/dist/components/icons/Icon.d.ts.map +1 -1
  36. package/dist/components/icons/Icon.js +12 -0
  37. package/dist/components/icons/Icon.js.map +1 -1
  38. package/dist/components/icons/Search.js +1 -1
  39. package/dist/components/icons/Search.js.map +1 -1
  40. package/dist/components/icons/Trash.d.ts +7 -0
  41. package/dist/components/icons/Trash.d.ts.map +1 -0
  42. package/dist/components/icons/Trash.js +13 -0
  43. package/dist/components/icons/Trash.js.map +1 -0
  44. package/dist/components/layout/header/Header.d.ts +1 -1
  45. package/dist/components/layout/header/Header.d.ts.map +1 -1
  46. package/dist/components/layout/header/Header.js +1 -0
  47. package/dist/components/layout/header/Header.js.map +1 -1
  48. package/dist/components/layout/header/Header.module.scss +6 -0
  49. package/dist/components/layout/header/HeaderIconAction.module.scss +2 -1
  50. package/dist/components/layout/header/StickyHeader.d.ts +4 -1
  51. package/dist/components/layout/header/StickyHeader.d.ts.map +1 -1
  52. package/dist/components/layout/header/StickyHeader.js +1 -1
  53. package/dist/components/layout/header/StickyHeader.js.map +1 -1
  54. package/dist/components/ui/drawer/Drawer.d.ts +22 -0
  55. package/dist/components/ui/drawer/Drawer.d.ts.map +1 -0
  56. package/dist/components/ui/drawer/Drawer.js +84 -0
  57. package/dist/components/ui/drawer/Drawer.js.map +1 -0
  58. package/dist/components/ui/drawer/Drawer.module.scss +15 -0
  59. package/dist/components/ui/message/Message.d.ts +8 -0
  60. package/dist/components/ui/message/Message.d.ts.map +1 -0
  61. package/dist/components/ui/message/Message.js +20 -0
  62. package/dist/components/ui/message/Message.js.map +1 -0
  63. package/dist/components/ui/message/Message.module.scss +31 -0
  64. package/dist/components/ui/pop/OnButtonClick.d.ts +7 -0
  65. package/dist/components/ui/pop/OnButtonClick.d.ts.map +1 -0
  66. package/dist/components/ui/pop/OnButtonClick.js +44 -0
  67. package/dist/components/ui/pop/OnButtonClick.js.map +1 -0
  68. package/dist/components/ui/pop/Pop.d.ts +27 -0
  69. package/dist/components/ui/pop/Pop.d.ts.map +1 -0
  70. package/dist/components/ui/pop/Pop.js +133 -0
  71. package/dist/components/ui/pop/Pop.js.map +1 -0
  72. package/dist/components/ui/pop/Pop.module.scss +58 -0
  73. package/dist/components/ui/pop/PopOption.d.ts +10 -0
  74. package/dist/components/ui/pop/PopOption.d.ts.map +1 -0
  75. package/dist/components/ui/pop/PopOption.js +21 -0
  76. package/dist/components/ui/pop/PopOption.js.map +1 -0
  77. package/dist/components/ui/stats/Stats.d.ts +12 -0
  78. package/dist/components/ui/stats/Stats.d.ts.map +1 -0
  79. package/dist/components/ui/stats/Stats.js +24 -0
  80. package/dist/components/ui/stats/Stats.js.map +1 -0
  81. package/dist/components/ui/stats/Stats.module.scss +48 -0
  82. package/dist/components/utils/HandleEsc.d.ts +7 -0
  83. package/dist/components/utils/HandleEsc.d.ts.map +1 -0
  84. package/dist/components/utils/HandleEsc.js +16 -0
  85. package/dist/components/utils/HandleEsc.js.map +1 -0
  86. package/dist/global.scss +13 -0
  87. package/dist/index.d.ts +3 -0
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +3 -0
  90. package/dist/index.js.map +1 -1
  91. package/dist/scrollbars.scss +22 -0
  92. package/dist/utils/useKeyPress.d.ts +3 -0
  93. package/dist/utils/useKeyPress.d.ts.map +1 -0
  94. package/dist/utils/useKeyPress.js +28 -0
  95. package/dist/utils/useKeyPress.js.map +1 -0
  96. package/docs/assets/js/search.js +1 -1
  97. package/docs/assets/js/search.json +1 -1
  98. package/docs/classes/Drawer.html +1085 -0
  99. package/docs/classes/Pop.html +1137 -0
  100. package/docs/classes/ToasterProvider.html +21 -8
  101. package/docs/enums/ICON.html +77 -8
  102. package/docs/index.html +17 -4
  103. package/docs/modules/Item.html +7 -3
  104. package/docs/modules/List.html +7 -3
  105. package/docs/modules/Modal.html +7 -3
  106. package/docs/modules/ModalButtons.html +7 -3
  107. package/docs/modules/Section.html +7 -3
  108. package/docs/modules/StickyHeader.html +10 -11
  109. package/docs/modules.html +53 -27
  110. package/docs/pages/Tutorials/Test.html +7 -3
  111. package/esm/components/icons/Back.js +1 -1
  112. package/esm/components/icons/Back.js.map +1 -1
  113. package/esm/components/icons/Battery.d.ts.map +1 -1
  114. package/esm/components/icons/Battery.js +1 -1
  115. package/esm/components/icons/Battery.js.map +1 -1
  116. package/esm/components/icons/Checkmark.d.ts.map +1 -1
  117. package/esm/components/icons/Checkmark.js +2 -2
  118. package/esm/components/icons/Checkmark.js.map +1 -1
  119. package/esm/components/icons/Config.d.ts +7 -0
  120. package/esm/components/icons/Config.d.ts.map +1 -0
  121. package/esm/components/icons/Config.js +7 -0
  122. package/esm/components/icons/Config.js.map +1 -0
  123. package/esm/components/icons/Dots.d.ts +7 -0
  124. package/esm/components/icons/Dots.d.ts.map +1 -0
  125. package/esm/components/icons/Dots.js +7 -0
  126. package/esm/components/icons/Dots.js.map +1 -0
  127. package/esm/components/icons/Forward.js +1 -1
  128. package/esm/components/icons/Forward.js.map +1 -1
  129. package/esm/components/icons/Heart.d.ts +7 -0
  130. package/esm/components/icons/Heart.d.ts.map +1 -0
  131. package/esm/components/icons/Heart.js +7 -0
  132. package/esm/components/icons/Heart.js.map +1 -0
  133. package/esm/components/icons/Icon.d.ts +5 -1
  134. package/esm/components/icons/Icon.d.ts.map +1 -1
  135. package/esm/components/icons/Icon.js +12 -0
  136. package/esm/components/icons/Icon.js.map +1 -1
  137. package/esm/components/icons/Search.js +1 -1
  138. package/esm/components/icons/Search.js.map +1 -1
  139. package/esm/components/icons/Trash.d.ts +7 -0
  140. package/esm/components/icons/Trash.d.ts.map +1 -0
  141. package/esm/components/icons/Trash.js +7 -0
  142. package/esm/components/icons/Trash.js.map +1 -0
  143. package/esm/components/layout/header/Header.d.ts +1 -1
  144. package/esm/components/layout/header/Header.d.ts.map +1 -1
  145. package/esm/components/layout/header/Header.js +1 -0
  146. package/esm/components/layout/header/Header.js.map +1 -1
  147. package/esm/components/layout/header/Header.module.scss +6 -0
  148. package/esm/components/layout/header/HeaderIconAction.module.scss +2 -1
  149. package/esm/components/layout/header/StickyHeader.d.ts +4 -1
  150. package/esm/components/layout/header/StickyHeader.d.ts.map +1 -1
  151. package/esm/components/layout/header/StickyHeader.js +1 -1
  152. package/esm/components/layout/header/StickyHeader.js.map +1 -1
  153. package/esm/components/ui/drawer/Drawer.d.ts +22 -0
  154. package/esm/components/ui/drawer/Drawer.d.ts.map +1 -0
  155. package/esm/components/ui/drawer/Drawer.js +59 -0
  156. package/esm/components/ui/drawer/Drawer.js.map +1 -0
  157. package/esm/components/ui/drawer/Drawer.module.scss +15 -0
  158. package/esm/components/ui/message/Message.d.ts +8 -0
  159. package/esm/components/ui/message/Message.d.ts.map +1 -0
  160. package/esm/components/ui/message/Message.js +14 -0
  161. package/esm/components/ui/message/Message.js.map +1 -0
  162. package/esm/components/ui/message/Message.module.scss +31 -0
  163. package/esm/components/ui/pop/OnButtonClick.d.ts +7 -0
  164. package/esm/components/ui/pop/OnButtonClick.d.ts.map +1 -0
  165. package/esm/components/ui/pop/OnButtonClick.js +22 -0
  166. package/esm/components/ui/pop/OnButtonClick.js.map +1 -0
  167. package/esm/components/ui/pop/Pop.d.ts +27 -0
  168. package/esm/components/ui/pop/Pop.d.ts.map +1 -0
  169. package/esm/components/ui/pop/Pop.js +108 -0
  170. package/esm/components/ui/pop/Pop.js.map +1 -0
  171. package/esm/components/ui/pop/Pop.module.scss +58 -0
  172. package/esm/components/ui/pop/PopOption.d.ts +10 -0
  173. package/esm/components/ui/pop/PopOption.d.ts.map +1 -0
  174. package/esm/components/ui/pop/PopOption.js +15 -0
  175. package/esm/components/ui/pop/PopOption.js.map +1 -0
  176. package/esm/components/ui/stats/Stats.d.ts +12 -0
  177. package/esm/components/ui/stats/Stats.d.ts.map +1 -0
  178. package/esm/components/ui/stats/Stats.js +18 -0
  179. package/esm/components/ui/stats/Stats.js.map +1 -0
  180. package/esm/components/ui/stats/Stats.module.scss +48 -0
  181. package/esm/components/utils/HandleEsc.d.ts +7 -0
  182. package/esm/components/utils/HandleEsc.d.ts.map +1 -0
  183. package/esm/components/utils/HandleEsc.js +13 -0
  184. package/esm/components/utils/HandleEsc.js.map +1 -0
  185. package/esm/global.scss +13 -0
  186. package/esm/index.d.ts +3 -0
  187. package/esm/index.d.ts.map +1 -1
  188. package/esm/index.js +3 -0
  189. package/esm/index.js.map +1 -1
  190. package/esm/scrollbars.scss +22 -0
  191. package/esm/utils/useKeyPress.d.ts +3 -0
  192. package/esm/utils/useKeyPress.d.ts.map +1 -0
  193. package/esm/utils/useKeyPress.js +25 -0
  194. package/esm/utils/useKeyPress.js.map +1 -0
  195. package/next-env.d.ts +0 -1
  196. package/package.json +4 -3
  197. package/src/components/icons/Back.tsx +1 -1
  198. package/src/components/icons/Battery.tsx +3 -2
  199. package/src/components/icons/Checkmark.tsx +3 -6
  200. package/src/components/icons/Config.tsx +21 -0
  201. package/src/components/icons/Dots.tsx +21 -0
  202. package/src/components/icons/Forward.tsx +1 -1
  203. package/src/components/icons/Heart.tsx +21 -0
  204. package/src/components/icons/Icon.tsx +12 -0
  205. package/src/components/icons/Search.tsx +1 -1
  206. package/src/components/icons/Trash.tsx +21 -0
  207. package/src/components/layout/header/Header.module.scss +6 -0
  208. package/src/components/layout/header/Header.tsx +2 -1
  209. package/src/components/layout/header/HeaderIconAction.module.scss +2 -1
  210. package/src/components/layout/header/StickyHeader.tsx +12 -2
  211. package/src/components/ui/drawer/Drawer.module.scss +15 -0
  212. package/src/components/ui/drawer/Drawer.tsx +88 -0
  213. package/src/components/ui/message/Message.module.scss +31 -0
  214. package/src/components/ui/message/Message.tsx +21 -0
  215. package/src/components/ui/pop/OnButtonClick.tsx +31 -0
  216. package/src/components/ui/pop/Pop.module.scss +58 -0
  217. package/src/components/ui/pop/Pop.tsx +157 -0
  218. package/src/components/ui/pop/PopOption.tsx +24 -0
  219. package/src/components/ui/stats/Stats.module.scss +48 -0
  220. package/src/components/ui/stats/Stats.tsx +42 -0
  221. package/src/components/utils/HandleEsc.tsx +21 -0
  222. package/src/demo/Menu.tsx +2 -1
  223. package/src/demo/components/layout/header/StickyHeader.module.scss +14 -0
  224. package/src/demo/components/layout/header/StickyHeader.tsx +28 -2
  225. package/src/demo/components/ui/drawer/Drawer.tsx +28 -0
  226. package/src/demo/components/ui/message/Message.tsx +27 -0
  227. package/src/demo/components/ui/pop/Pop.tsx +80 -0
  228. package/src/demo/components/ui/stats/Stats.module.scss +29 -0
  229. package/src/demo/components/ui/stats/Stats.tsx +61 -0
  230. package/src/demo/componentsMap.ts +31 -0
  231. package/src/global.scss +13 -0
  232. package/src/index.ts +3 -0
  233. package/src/pages/_app.tsx +1 -0
  234. package/src/scrollbars.scss +22 -0
  235. package/src/utils/useKeyPress.ts +32 -0
  236. package/ATTRIBUTION.md +0 -10
@@ -0,0 +1,48 @@
1
+ .stats {
2
+ --stats-border: 1px solid rgba(255, 255, 255, .15);
3
+ --stats-bg: rgba(255, 255, 255, .05);
4
+ --stats-value-color: rgba(255, 255, 255, .9);
5
+ --stats-label-color: rgba(255, 255, 255, .61);
6
+
7
+ display: flex;
8
+ width: 100%;
9
+ padding: calc(60px / var(--ratio-dimensions)) 0;
10
+ margin: 0;
11
+ border-top: var(--stats-border);
12
+ background: var(--stats-bg);
13
+ background-clip: padding-box;
14
+ list-style-type: none;
15
+ }
16
+
17
+ .stats-dark {
18
+ --stats-border: 1px solid rgba(0, 0, 0, .15);
19
+ --stats-bg: rgba(0, 0, 0, .05);
20
+ --stats-value-color: rgba(0, 0, 0, .9);
21
+ --stats-label-color: rgba(0, 0, 0, .61);
22
+ }
23
+
24
+ .item {
25
+ flex: 1;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ flex-direction: column;
30
+ text-align: center;
31
+ gap: calc(20px / var(--ratio-dimensions));
32
+ }
33
+
34
+ .separator {
35
+ border-left: var(--stats-border);
36
+ }
37
+
38
+ .label {
39
+ display: block;
40
+ color: var(--stats-label-color);
41
+ font-size: calc(22px / var(--ratio-font));
42
+ }
43
+
44
+ .value {
45
+ display: block;
46
+ color: var(--stats-value-color);
47
+ font-size: calc(30px / var(--ratio-font));
48
+ }
@@ -0,0 +1,7 @@
1
+ import type React from "react";
2
+ interface Props {
3
+ onPress: () => void;
4
+ }
5
+ declare const HandleEsc: React.FC<Props>;
6
+ export { HandleEsc };
7
+ //# sourceMappingURL=HandleEsc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HandleEsc.d.ts","sourceRoot":"","sources":["../../../src/components/utils/HandleEsc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,UAAU,KAAK;IACX,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAU9B,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { useKeyPress } from "react-use";
2
+ import { useEffect } from "react";
3
+ const HandleEsc = (props) => {
4
+ const [pressed] = useKeyPress("Escape");
5
+ useEffect(() => {
6
+ if (pressed) {
7
+ props.onPress();
8
+ }
9
+ }, [pressed]);
10
+ return null;
11
+ };
12
+ export { HandleEsc };
13
+ //# sourceMappingURL=HandleEsc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HandleEsc.js","sourceRoot":"","sources":["../../../src/components/utils/HandleEsc.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMlC,MAAM,SAAS,GAAoB,CAAC,KAAK,EAAE,EAAE;IACzC,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAExC,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,OAAO,EAAE;YACT,KAAK,CAAC,OAAO,EAAE,CAAC;SACnB;IACL,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
package/esm/global.scss CHANGED
@@ -27,6 +27,8 @@
27
27
  --text: #323232;
28
28
  --sub: #959595;
29
29
 
30
+ --pop-text: #666;
31
+
30
32
  --toolbar-border: #ababab;
31
33
  --toolbar-bg: #f8f8f8;
32
34
  --modal-bg: #f7f7f7;
@@ -47,6 +49,8 @@
47
49
 
48
50
  // Shades: https://maketintsandshades.com/#038bf4,ff7200,7357e8,3ec234,3ec234,ff388f,ea2700
49
51
  --blue1: #038bf4;
52
+ --blue2: #b7d6f5;
53
+ --blue3: #dbe6ff;
50
54
  --orange1: #ff7200;
51
55
  --orange1-darker: #cc5b00;
52
56
  --purple1: #7357e8;
@@ -54,10 +58,19 @@
54
58
  --green1-darker: #38af2f;
55
59
  --pink1: #ff388f;
56
60
  --red1: #ea2700;
61
+ --yellow1: #ffde9d;
62
+ --yellow2: #e4a429;
63
+ --yellow3: #fff5db;
64
+ --pinky1: #f5c0b7;
65
+ --pinky2: #e07b67;
66
+ --pinky3: #ffe1db;
57
67
 
58
68
  --grey1: #737373;
59
69
 
60
70
  --focus-color: #dcaf00;
71
+
72
+ --scrollbars-thumb: var(--grey1);
73
+ --scrollbars-bg: transparent;
61
74
  }
62
75
 
63
76
  *:focus {
package/esm/index.d.ts CHANGED
@@ -17,8 +17,11 @@ export * from "./components/ui/action/Action.js";
17
17
  export * from "./components/ui/action/EqualActions.js";
18
18
  export * from "./components/ui/button/Button.js";
19
19
  export * from "./components/ui/directionPad/Pad.js";
20
+ export * from "./components/ui/drawer/Drawer.js";
21
+ export * from "./components/ui/message/Message.js";
20
22
  export * from "./components/ui/modal/Modal.js";
21
23
  export * from "./components/ui/modal/ModalButtons.js";
24
+ export * from "./components/ui/pop/Pop.js";
22
25
  export * from "./components/ui/tabs/Selector.js";
23
26
  export * from "./components/ui/toaster/Toaster.js";
24
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AAEvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AAEvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
package/esm/index.js CHANGED
@@ -17,8 +17,11 @@ export * from "./components/ui/action/Action.js";
17
17
  export * from "./components/ui/action/EqualActions.js";
18
18
  export * from "./components/ui/button/Button.js";
19
19
  export * from "./components/ui/directionPad/Pad.js";
20
+ export * from "./components/ui/drawer/Drawer.js";
21
+ export * from "./components/ui/message/Message.js";
20
22
  export * from "./components/ui/modal/Modal.js";
21
23
  export * from "./components/ui/modal/ModalButtons.js";
24
+ export * from "./components/ui/pop/Pop.js";
22
25
  export * from "./components/ui/tabs/Selector.js";
23
26
  export * from "./components/ui/toaster/Toaster.js";
24
27
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AAEvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AAEvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
@@ -0,0 +1,22 @@
1
+ .miui-scrollbars {
2
+ overflow-y: auto;
3
+ scrollbar-color: var(--scrollbars-thumb) var(--scrollbars-bg);
4
+ scrollbar-width: thin !important;
5
+
6
+ &::-webkit-scrollbar {
7
+ width: 6px;
8
+ background-color: transparent;
9
+ }
10
+
11
+ &::-webkit-scrollbar-thumb:vertical {
12
+ background: var(--scrollbars-thumb);
13
+ background-clip: padding-box;
14
+ border: 2px solid var(--scrollbars-bg);
15
+ min-height: 10px;
16
+ }
17
+
18
+ &::-webkit-scrollbar-thumb:vertical:active {
19
+ background: var(--scrollbars-thumb);
20
+ border: 2px solid var(--scrollbars-bg);
21
+ }
22
+ }
@@ -0,0 +1,3 @@
1
+ declare const useKeyPress: (targetKey: string) => boolean;
2
+ export { useKeyPress, };
3
+ //# sourceMappingURL=useKeyPress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeyPress.d.ts","sourceRoot":"","sources":["../../src/utils/useKeyPress.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,WAAW,cAAe,MAAM,YAyBrC,CAAC;AAEF,OAAO,EACH,WAAW,GACd,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { useEffect, useState } from "react";
2
+ const useKeyPress = (targetKey) => {
3
+ const [keyPressed, setKeyPressed] = useState(false);
4
+ useEffect(() => {
5
+ const handleKeyDown = ({ key }) => {
6
+ if (key === targetKey) {
7
+ setKeyPressed(true);
8
+ }
9
+ };
10
+ const handleKeyUp = ({ key }) => {
11
+ if (key === targetKey) {
12
+ setKeyPressed(false);
13
+ }
14
+ };
15
+ window.addEventListener("keydown", handleKeyDown);
16
+ window.addEventListener("keyup", handleKeyUp);
17
+ return () => {
18
+ window.removeEventListener("keydown", handleKeyDown);
19
+ window.removeEventListener("keyup", handleKeyUp);
20
+ };
21
+ }, [targetKey]);
22
+ return keyPressed;
23
+ };
24
+ export { useKeyPress, };
25
+ //# sourceMappingURL=useKeyPress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeyPress.js","sourceRoot":"","sources":["../../src/utils/useKeyPress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAE,EAAE;IACtC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,aAAa,GAAG,CAAC,EAAE,GAAG,EAAiB,EAAQ,EAAE;YACnD,IAAI,GAAG,KAAK,SAAS,EAAE;gBACnB,aAAa,CAAC,IAAI,CAAC,CAAC;aACvB;QACL,CAAC,CAAC;QAEF,MAAM,WAAW,GAAG,CAAC,EAAE,GAAG,EAAiB,EAAQ,EAAE;YACjD,IAAI,GAAG,KAAK,SAAS,EAAE;gBACnB,aAAa,CAAC,KAAK,CAAC,CAAC;aACxB;QACL,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAClD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE;YACR,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;YACrD,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACrD,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AAEF,OAAO,EACH,WAAW,GACd,CAAC"}
package/next-env.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  /// <reference types="next" />
2
- /// <reference types="next/types/global" />
3
2
  /// <reference types="next/image-types/global" />
4
3
 
5
4
  // NOTE: This file should not be edited
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-miui",
3
- "version": "0.9.5",
3
+ "version": "0.12.0",
4
4
  "author": "Jacek Nowacki",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -28,7 +28,8 @@
28
28
  "types": "./esm/index.d.ts",
29
29
  "module": "./esm/index.js",
30
30
  "dependencies": {
31
- "classnames": "^2.3.1"
31
+ "classnames": "^2.3.1",
32
+ "oop-timers": "^4.0.1"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@babel/core": "^7.12.10",
@@ -51,7 +52,7 @@
51
52
  "husky": "^7.0.4",
52
53
  "jest": "^27.5.1",
53
54
  "must": "^0.13.4",
54
- "next": "^11.1.4",
55
+ "next": "^12.1.0",
55
56
  "react": "^17.0.2",
56
57
  "react-dom": "^17.0.2",
57
58
  "react-use": "^17.2.4",
@@ -7,7 +7,7 @@ interface Props {
7
7
  const Back: React.FC<Props> = (props) => {
8
8
  return (
9
9
  <svg
10
- width={"9"}
10
+ width={"16"}
11
11
  height={"16"}
12
12
  viewBox={"0 0 9 16"}
13
13
  xmlns={"http://www.w3.org/2000/svg"}
@@ -7,8 +7,9 @@ interface Props {
7
7
  const Battery: React.FC<Props> = (props) => {
8
8
  return (
9
9
  <svg
10
- width={"13"}
11
- height={"17"}
10
+ width={"16"}
11
+ height={"16"}
12
+ viewBox={"0 0 13 17"}
12
13
  xmlns={"http://www.w3.org/2000/svg"}
13
14
  className={props.className}
14
15
  >
@@ -7,17 +7,14 @@ interface Props {
7
7
  const Checkmark: React.FC<Props> = (props) => {
8
8
  return (
9
9
  <svg
10
- xmlns={"http://www.w3.org/2000/svg"}
11
10
  width={"16"}
12
11
  height={"16"}
13
- viewBox={"0 0 45.701 45.7"}
12
+ viewBox={"0 0 26 18"}
13
+ xmlns={"http://www.w3.org/2000/svg"}
14
14
  className={props.className}
15
15
  >
16
- <path
17
- d={"M20.687 38.332a5.308 5.308 0 01-7.505 0L1.554 26.704A5.306 5.306 0 119.059 19.2l6.928 6.927a1.344 1.344 0 001.896 0L36.642 7.368a5.308 5.308 0 017.505 7.504l-23.46 23.46z"}
18
- />
16
+ <path d={"M26 1.6q0-.7-.4-1.15Q25.15 0 24.55 0q-.65 0-1.1.45L9.5 14.35l-6.95-7Q2.1 6.9 1.5 6.9q-.65 0-1.05.45Q0 7.8 0 8.4q0 .7.45 1.15l8 8.05q.45.4 1.05.4.6 0 1.05-.4l15-14.95Q26 2.2 26 1.6"} />
19
17
  </svg>
20
-
21
18
  );
22
19
  };
23
20
 
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+
3
+ interface Props {
4
+ className?: string;
5
+ }
6
+
7
+ const Config: React.FC<Props> = (props) => {
8
+ return (
9
+ <svg
10
+ width={"16"}
11
+ height={"16"}
12
+ viewBox={"0 0 90 90"}
13
+ xmlns={"http://www.w3.org/2000/svg"}
14
+ className={props.className}
15
+ >
16
+ <path d={"M87.55 26.85 85.2 21.5l-5.25.6q-2.4.3-3.7.25-1.3-.05-2.35-.65-1-.6-2.5-1.95-1.55-1.3-2.25-2.3-.75-1-.95-2.5-.25-1.45-.25-4.25l-.1-6.15L56.65 0l-4.1 4.5q-1.7 1.8-2.85 2.75-1.25.95-2.35 1.3-1.15.3-2.7.3-1.5 0-2.6-.3-1.2-.35-2.35-1.25-1.2-.9-2.85-2.65L32.75.4 28 2.25q-2.05.8-3.65 1.65-1.6.75-2 1.15-.4.45-.6 2.15-.25 1.75-.1 4 .1 2.1-.05 3.45-.15 1.35-.65 2.4-.45 1-1.45 2.1-1 1.25-1.95 1.8-.9.6-2.4.8-1.45.2-4.15.25l-6.1.1L.1 33 4 36.9q1.55 1.6 2.8 3.4 1.2 1.8 1.5 2.9.5 2.7-.95 5.55Q6 51.55 3.1 53.8L0 56.35 4.9 67.7h4.85q6.5 0 9.4 3 2.95 2.95 2.5 9.1-.25 2.25.1 3.55.3 1.2 1.75 2.1 1.45.85 4.6 2l4.85 1.95 3.5-3.7q8.75-9.1 17.2.7l3 3.6 11.4-4.85-.3-4.2q-.45-6.55 2.7-9.85 3.15-3.35 9.9-3.2l5.35.2 4.1-11.4-3.7-3q-3.25-2.7-4.2-6.2-.95-3.5.35-6.85 1.3-3.25 4.85-5.35 1.2-.65 2-1.35.85-.65.9-.95-.05-.35-.75-2.1-.6-1.7-1.7-4.05m-28.25.8q2 1.5 3.5 3.55 1.45 2.05 2.75 4.9 1.95 4.4 1.9 8.95-.1 4.5-2.2 9.05-2 4.35-5 7.15-2.9 2.75-7.1 4.45-8.65 3.25-17.25-.8-2.9-1.3-4.9-2.8-2.05-1.55-3.5-3.6-1.45-2-2.75-4.9-1.9-4.2-1.9-8.75 0-4.5 1.9-8.75 1.3-2.85 2.75-4.9 1.45-2.05 3.5-3.55 2-1.55 4.9-2.85 4.65-2.3 9.25-2.3t9.25 2.3q2.9 1.3 4.9 2.85"} />
17
+ </svg>
18
+ );
19
+ };
20
+
21
+ export { Config };
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+
3
+ interface Props {
4
+ className?: string;
5
+ }
6
+
7
+ const Dots: React.FC<Props> = (props) => {
8
+ return (
9
+ <svg
10
+ width={"16"}
11
+ height={"16"}
12
+ viewBox={"0 0 16 72"}
13
+ xmlns={"http://www.w3.org/2000/svg"}
14
+ className={props.className}
15
+ >
16
+ <path d={"M13.65 13.65Q16 11.3 16 8q0-3.3-2.35-5.65Q11.3 0 8 0 4.7 0 2.35 2.35 0 4.7 0 8q0 3.3 2.35 5.65Q4.7 16 8 16q3.3 0 5.65-2.35M8 44q3.3 0 5.65-2.35Q16 39.3 16 36q0-3.3-2.35-5.65Q11.3 28 8 28q-3.3 0-5.65 2.35Q0 32.7 0 36q0 3.3 2.35 5.65Q4.7 44 8 44M8 72q3.3 0 5.65-2.35Q16 67.3 16 64q0-3.3-2.35-5.65Q11.3 56 8 56q-3.3 0-5.65 2.35Q0 60.7 0 64q0 3.3 2.35 5.65Q4.7 72 8 72"} />
17
+ </svg>
18
+ );
19
+ };
20
+
21
+ export { Dots };
@@ -7,7 +7,7 @@ interface Props {
7
7
  const Forward: React.FC<Props> = (props) => {
8
8
  return (
9
9
  <svg
10
- width={"9"}
10
+ width={"16"}
11
11
  height={"16"}
12
12
  viewBox={"0 0 9 16"}
13
13
  xmlns={"http://www.w3.org/2000/svg"}
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+
3
+ interface Props {
4
+ className?: string;
5
+ }
6
+
7
+ const Heart: React.FC<Props> = (props) => {
8
+ return (
9
+ <svg
10
+ width={"16"}
11
+ height={"16"}
12
+ viewBox={"0 0 55 46"}
13
+ xmlns={"http://www.w3.org/2000/svg"}
14
+ className={props.className}
15
+ >
16
+ <path d={"M54 8.5q-1.1-2.35-2.15-3.35Q50.9 4.2 49.4 3 47.75 1.65 44.9.75h-.05q-2.7-.85-5.55-.7-.05 0-.1.05-2.9.35-5.3 1.7-.8.35-1.9 1.15l.05-.05q-1.15.7-2.1 1.55-.75.55-1.55 1-.45.2-.9.15-.15-.05-.25-.05-.35-.05-.75-.35-.1-.05-.15-.1-.7-.4-1.35-.95l-.05-.05q-.85-.75-1.75-1.25-2.15-1.6-4.65-2.25Q15.9-.1 13.2.05q-.05 0-.15.05Q9.9.6 7 2.4h-.05q-2.7 1.75-4.5 4.45v.05Q.7 9.6.15 12.85q-.05.05-.05.1-.4 3.3 1.1 6.75v.1q1.25 2.45 3.2 4.6 1.6 2.05 3.55 4l3.8 3.8q0 .05.05.05 1.9 1.8 3.7 3.65v.05q3.9 3.75 6.05 5.8l.05.05q2.25 2.25 3.1 2.75l-.05-.05 1 .75q.85.75 2.05.75.3 0 .55-.1 1-.4 2-1.3.75-.75 2.1-1.85h.05q1.35-1.25 3-2.75h.05q1.6-1.55 3.35-3.2 1.75-1.65 3.7-3.7v.05l4.1-4 .05-.05q2.15-2.2 4-4.55v-.05q1.9-2.55 3.1-5.1h-.05q1.3-2.7 1.3-5.65 0-3-1-5.25m-4.25-1.25q.75.8 1.5 2.5t.75 4q0 2.25-1 4.35v.05q-1.05 2.25-2.7 4.55h-.05Q46.5 24.9 44.5 27l-4.1 4q-1.95 1.9-3.65 3.6-1.75 1.6-3.35 3.2-.05 0-.05.05-1.6 1.45-2.9 2.6-1.45 1.2-2.25 1.95-.35.3-.7.55-.5-.45-1.25-.95-.7-.45-2.6-2.35-2.15-2.1-6.05-5.9-1.8-1.8-3.75-3.7v.05l-3.8-3.8h.05q-1.85-1.9-3.4-3.85-.05-.1-.1-.1-1.65-1.8-2.7-3.9-1.1-2.6-.8-5.1.4-2.65 1.85-4.8 1.5-2.2 3.65-3.65 2.3-1.4 4.8-1.85 2.2-.15 4.35.45h.05q2 .55 3.7 1.8l.1.1q.7.45 1.45 1.05.85.65 1.65 1.15 1.25.95 2.4.95 1.4.25 2.75-.5l-.05.05q1.05-.6 2.1-1.35 0-.05.05-.05.75-.7 1.7-1.25 0-.05.05-.05.85-.6 1.45-.85.05-.05.15-.1 1.95-1.1 4.3-1.4h-.1q2.25-.15 4.45.55 2.3.75 3.6 1.75 1.35 1.05 2.2 1.9"} />
17
+ </svg>
18
+ );
19
+ };
20
+
21
+ export { Heart };
@@ -6,6 +6,10 @@ import { Back } from "./Back.js";
6
6
  import { Forward } from "./Forward.js";
7
7
  import { Search } from "./Search.js";
8
8
  import { Battery } from "./Battery.js";
9
+ import { Heart } from "./Heart.js";
10
+ import { Trash } from "./Trash.js";
11
+ import { Config } from "./Config.js";
12
+ import { Dots } from "./Dots.js";
9
13
 
10
14
  enum ICON {
11
15
  checkmark = "checkmark",
@@ -13,6 +17,10 @@ enum ICON {
13
17
  forward = "forward",
14
18
  search = "search",
15
19
  battery = "battery",
20
+ heart = "heart",
21
+ trash = "trash",
22
+ config = "config",
23
+ dots = "dots",
16
24
  }
17
25
 
18
26
  interface Props {
@@ -26,6 +34,10 @@ const iconsMap = new Map<ICON, AnyComponent>([
26
34
  [ICON.forward, Forward],
27
35
  [ICON.search, Search],
28
36
  [ICON.battery, Battery],
37
+ [ICON.heart, Heart],
38
+ [ICON.trash, Trash],
39
+ [ICON.config, Config],
40
+ [ICON.dots, Dots],
29
41
  ]);
30
42
 
31
43
  const Icon: React.FC<Props> = ({ name: iconName, ...props }) => {
@@ -7,9 +7,9 @@ interface Props {
7
7
  const Search: React.FC<Props> = (props) => {
8
8
  return (
9
9
  <svg
10
- baseProfile={"basic"}
11
10
  width={"16"}
12
11
  height={"16"}
12
+ viewBox={"0 0 16 16"}
13
13
  xmlns={"http://www.w3.org/2000/svg"}
14
14
  className={props.className}
15
15
  >
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+
3
+ interface Props {
4
+ className?: string;
5
+ }
6
+
7
+ const Trash: React.FC<Props> = (props) => {
8
+ return (
9
+ <svg
10
+ width={"16"}
11
+ height={"16"}
12
+ viewBox={"0 0 41 37"}
13
+ xmlns={"http://www.w3.org/2000/svg"}
14
+ className={props.className}
15
+ >
16
+ <path d={"M35.7 9.25h3.95q1.4-.4 1.35-1.6-.1-1.2-1.35-1.45H25.6V1.25Q25.6 0 24.4 0h-8.7q-1.1-.05-1.2 1.25V6.2H1.35Q-.1 6.6 0 7.75.1 9 1.35 9.25H5.4v26.5q.15 1.2 1.25 1.25H34.5q1.1-.1 1.2-1.25V9.25M22.6 6.2h-5.05V3.1h5.05v3.1M8.45 33.9V9.25H32.7V33.9H8.45"} />
17
+ </svg>
18
+ );
19
+ };
20
+
21
+ export { Trash };
@@ -15,6 +15,12 @@
15
15
  --background-color: var(--toolbar-bg);
16
16
  }
17
17
 
18
+ .header--colored {
19
+ --border-color: var(--custom-header-color);
20
+ --background-color: var(--custom-header-color);
21
+ color: var(--custom-text-color);
22
+ }
23
+
18
24
  .header--top, .header--bottom {
19
25
  padding: 0 16.666px;
20
26
  min-height: 44px;
@@ -8,7 +8,7 @@ import { EqualActions } from "../../ui/action/EqualActions.js";
8
8
 
9
9
  interface Props {
10
10
  center?: boolean;
11
- variant?: "toolbar";
11
+ variant?: "toolbar" | "colored";
12
12
  /**
13
13
  * This indicates just how the borders are drawn and how content is aligned, not the actual position on the screen.
14
14
  * To set up position on the screen you need to properly style parent element.
@@ -34,6 +34,7 @@ const Header: React.FC<Props> = (props) => {
34
34
  const cls = classnames(styles.header, {
35
35
  [styles["header--center"]]: center,
36
36
  [styles["header--toolbar"]]: variant === "toolbar",
37
+ [styles["header--colored"]]: variant === "colored",
37
38
  }, styles[`header--${position}`], props.className);
38
39
 
39
40
  let contents = children;
@@ -4,7 +4,7 @@
4
4
  border-radius: 666px;
5
5
  display: inline-block;
6
6
  border: calc(2px / var(--ratio-border)) solid transparent;
7
- color: var(--header-text);
7
+ color: currentColor;
8
8
 
9
9
  &:hover {
10
10
  background: #00000022;
@@ -19,4 +19,5 @@
19
19
  width: 16px;
20
20
  height: 16px;
21
21
  display: block;
22
+ fill: currentColor;
22
23
  }
@@ -7,7 +7,12 @@ import styles from "./StickyHeader.module.scss";
7
7
  const err = new TypeError("StickyHeader needs two children - Header and StickyHeader.Content");
8
8
 
9
9
  interface Content {
10
- Content: React.FC;
10
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
11
+ Content: React.FC<ContentProps>;
12
+ }
13
+
14
+ interface ContentProps {
15
+ className?: string;
11
16
  }
12
17
 
13
18
  interface Props {
@@ -35,7 +40,12 @@ const StickyHeader: React.FC<Props> & Content = (props) => {
35
40
  content = content as never;
36
41
 
37
42
  const cls = classnames(styles.stickyHeader, styles[`stickyHeader--${position}`]);
38
- const contentCls = classnames(styles.stickyHeader__content, styles[`stickyHeader__content--${position}`]);
43
+
44
+ const contentCls = classnames(
45
+ styles.stickyHeader__content,
46
+ styles[`stickyHeader__content--${position}`],
47
+ (content as { props: ContentProps }).props.className,
48
+ );
39
49
 
40
50
  return (
41
51
  <div className={cls}>
@@ -0,0 +1,15 @@
1
+ .drawer {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ background: white;
8
+ z-index: 1;
9
+
10
+ transition: transform 300ms;
11
+ }
12
+
13
+ .content {
14
+ height: 100%;
15
+ }
@@ -0,0 +1,88 @@
1
+ import React, { Component } from "react";
2
+ import { Timeout } from "oop-timers";
3
+
4
+ import styles from "./Drawer.module.scss";
5
+ import { HandleEsc } from "../../utils/HandleEsc";
6
+
7
+ const RENDER_TIMEOUT = 500;
8
+
9
+ interface Props {
10
+ isOpen: boolean;
11
+ closeOnEsc?: boolean;
12
+ onClose: () => void;
13
+ }
14
+
15
+ interface State {
16
+ shouldRenderWhenClosed: boolean;
17
+ }
18
+
19
+ class Drawer extends Component<Props, State> {
20
+ public constructor(props: Props) {
21
+ super(props);
22
+
23
+ this.state = {
24
+ shouldRenderWhenClosed: false,
25
+ };
26
+ }
27
+
28
+ public componentDidMount() {
29
+ this.timeout = new Timeout(() => {
30
+ // eslint-disable-next-line react/no-did-mount-set-state
31
+ this.setState({ shouldRenderWhenClosed: false });
32
+ }, RENDER_TIMEOUT);
33
+ }
34
+
35
+ public componentDidUpdate(prevProps: Props) {
36
+ if (!prevProps.isOpen && this.props.isOpen) {
37
+ this.onOpen();
38
+ }
39
+
40
+ if (prevProps.isOpen && !this.props.isOpen) {
41
+ this.onClose();
42
+ }
43
+ }
44
+
45
+ public componentWillUnmount() {
46
+ this.timeout?.stop();
47
+ this.timeout = null;
48
+ }
49
+
50
+ private timeout: Timeout | null = null;
51
+
52
+ private onOpen() {
53
+ this.timeout?.stop();
54
+ this.setState({ shouldRenderWhenClosed: true });
55
+ }
56
+
57
+ private onClose() {
58
+ this.timeout?.start();
59
+ }
60
+
61
+ private readonly handleEsc = () => {
62
+ this.props.onClose();
63
+ };
64
+
65
+ public render() {
66
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
67
+ const y = this.props.isOpen ? 0 : 100;
68
+ const style = {
69
+ transform: `translateY(${y}%)`,
70
+ };
71
+
72
+ const shouldRender = this.props.isOpen || this.state.shouldRenderWhenClosed;
73
+
74
+ const closeOnEsc = this.props.closeOnEsc ?? true;
75
+ const esc = closeOnEsc && <HandleEsc onPress={this.handleEsc} />;
76
+
77
+ return (
78
+ <div className={styles.drawer} style={style}>
79
+ {esc}
80
+ <div className={styles.content}>
81
+ {shouldRender && this.props.children}
82
+ </div>
83
+ </div>
84
+ );
85
+ }
86
+ }
87
+
88
+ export { Drawer };
@@ -0,0 +1,31 @@
1
+ .container {
2
+ border-top: 1px solid var(--border);
3
+ border-bottom: 1px solid var(--border);
4
+ padding: calc(47px / var(--ratio-dimensions)) calc(83px / var(--ratio-dimensions));
5
+ font-weight: 500;
6
+ line-height: 1.25;
7
+ }
8
+
9
+ .box {
10
+ border-left: 1px solid var(--border);
11
+ border-right: 1px solid var(--border);
12
+ margin: 12px;
13
+ }
14
+
15
+ .warning {
16
+ background-color: var(--yellow3);
17
+ border-color: var(--yellow1);
18
+ color: var(--yellow2);
19
+ }
20
+
21
+ .error {
22
+ background-color: var(--pinky3);
23
+ border-color: var(--pinky1);
24
+ color: var(--pinky2);
25
+ }
26
+
27
+ .info {
28
+ background-color: var(--blue3);
29
+ border-color: var(--blue2);
30
+ color: var(--blue1);
31
+ }