react-miui 0.5.1 → 0.8.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 (272) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/assets/sources/battery.fla +0 -0
  3. package/assets/sources/search.fla +0 -0
  4. package/dist/components/form/Input.d.ts +9 -0
  5. package/dist/components/form/Input.d.ts.map +1 -0
  6. package/dist/components/form/Input.js +62 -0
  7. package/dist/components/form/Input.js.map +1 -0
  8. package/dist/components/form/Input.module.scss +48 -0
  9. package/dist/components/form/Label.d.ts +8 -0
  10. package/dist/components/form/Label.d.ts.map +1 -0
  11. package/dist/components/form/Label.js +22 -0
  12. package/dist/components/form/Label.js.map +1 -0
  13. package/dist/components/form/Label.module.scss +15 -0
  14. package/dist/components/form/TextArea.d.ts +7 -0
  15. package/dist/components/form/TextArea.d.ts.map +1 -0
  16. package/dist/components/form/TextArea.js +57 -0
  17. package/dist/components/form/TextArea.js.map +1 -0
  18. package/dist/components/form/Toggle.d.ts +1 -1
  19. package/dist/components/form/Toggle.d.ts.map +1 -1
  20. package/dist/components/form/Toggle.js.map +1 -1
  21. package/dist/components/icons/Back.d.ts +1 -1
  22. package/dist/components/icons/Back.d.ts.map +1 -1
  23. package/dist/components/icons/Back.js.map +1 -1
  24. package/dist/components/icons/Battery.d.ts +7 -0
  25. package/dist/components/icons/Battery.d.ts.map +1 -0
  26. package/dist/components/icons/Battery.js +14 -0
  27. package/dist/components/icons/Battery.js.map +1 -0
  28. package/dist/components/icons/Forward.d.ts +1 -1
  29. package/dist/components/icons/Forward.d.ts.map +1 -1
  30. package/dist/components/icons/Forward.js.map +1 -1
  31. package/dist/components/icons/Icon.d.ts +3 -1
  32. package/dist/components/icons/Icon.d.ts.map +1 -1
  33. package/dist/components/icons/Icon.js +6 -0
  34. package/dist/components/icons/Icon.js.map +1 -1
  35. package/dist/components/icons/Search.d.ts +7 -0
  36. package/dist/components/icons/Search.d.ts.map +1 -0
  37. package/dist/components/icons/Search.js +13 -0
  38. package/dist/components/icons/Search.js.map +1 -0
  39. package/dist/components/layout/header/HeaderIconAction.d.ts +1 -1
  40. package/dist/components/layout/header/HeaderIconAction.d.ts.map +1 -1
  41. package/dist/components/layout/header/HeaderIconAction.js.map +1 -1
  42. package/dist/components/layout/list/Header.d.ts +5 -1
  43. package/dist/components/layout/list/Header.d.ts.map +1 -1
  44. package/dist/components/layout/list/Header.js +6 -1
  45. package/dist/components/layout/list/Header.js.map +1 -1
  46. package/dist/components/layout/list/Item.d.ts +3 -0
  47. package/dist/components/layout/list/Item.d.ts.map +1 -1
  48. package/dist/components/layout/list/Item.js +20 -6
  49. package/dist/components/layout/list/Item.js.map +1 -1
  50. package/dist/components/layout/list/Item.module.scss +16 -1
  51. package/dist/components/layout/list/List.d.ts +6 -1
  52. package/dist/components/layout/list/List.d.ts.map +1 -1
  53. package/dist/components/layout/list/List.js +15 -1
  54. package/dist/components/layout/list/List.js.map +1 -1
  55. package/dist/components/layout/list/List.module.scss +4 -0
  56. package/dist/components/layout/section/SearchContainer.d.ts +4 -0
  57. package/dist/components/layout/section/SearchContainer.d.ts.map +1 -0
  58. package/dist/components/layout/section/SearchContainer.js +13 -0
  59. package/dist/components/layout/section/SearchContainer.js.map +1 -0
  60. package/dist/components/layout/section/SearchContainer.module.scss +3 -0
  61. package/dist/components/layout/section/Section.module.scss +7 -0
  62. package/dist/components/ui/action/Action.d.ts +1 -1
  63. package/dist/components/ui/action/Action.d.ts.map +1 -1
  64. package/dist/components/ui/action/Action.js.map +1 -1
  65. package/dist/components/ui/button/Button.d.ts +1 -2
  66. package/dist/components/ui/button/Button.d.ts.map +1 -1
  67. package/dist/components/ui/button/Button.js +16 -4
  68. package/dist/components/ui/button/Button.js.map +1 -1
  69. package/dist/components/ui/modal/Modal.d.ts +18 -0
  70. package/dist/components/ui/modal/Modal.d.ts.map +1 -0
  71. package/dist/components/ui/modal/Modal.js +108 -0
  72. package/dist/components/ui/modal/Modal.js.map +1 -0
  73. package/dist/components/ui/modal/Modal.module.scss +92 -0
  74. package/dist/components/ui/modal/ModalButton.d.ts +8 -0
  75. package/dist/components/ui/modal/ModalButton.d.ts.map +1 -0
  76. package/dist/components/ui/modal/ModalButton.js +31 -0
  77. package/dist/components/ui/modal/ModalButton.js.map +1 -0
  78. package/dist/components/ui/modal/ModalButtons.d.ts +10 -0
  79. package/dist/components/ui/modal/ModalButtons.d.ts.map +1 -0
  80. package/dist/components/ui/modal/ModalButtons.js +15 -0
  81. package/dist/components/ui/modal/ModalButtons.js.map +1 -0
  82. package/dist/components/ui/modal/ModalButtons.module.scss +32 -0
  83. package/dist/components/ui/modal/ModalNoMargin.d.ts +6 -0
  84. package/dist/components/ui/modal/ModalNoMargin.d.ts.map +1 -0
  85. package/dist/components/ui/modal/ModalNoMargin.js +22 -0
  86. package/dist/components/ui/modal/ModalNoMargin.js.map +1 -0
  87. package/dist/components/ui/toaster/Notification.d.ts +9 -0
  88. package/dist/components/ui/toaster/Notification.d.ts.map +1 -0
  89. package/dist/components/ui/toaster/Notification.js +39 -0
  90. package/dist/components/ui/toaster/Notification.js.map +1 -0
  91. package/dist/components/ui/toaster/Toaster.d.ts +18 -0
  92. package/dist/components/ui/toaster/Toaster.d.ts.map +1 -0
  93. package/dist/components/ui/toaster/Toaster.js +79 -0
  94. package/dist/components/ui/toaster/Toaster.js.map +1 -0
  95. package/dist/components/ui/toaster/Toaster.module.scss +32 -0
  96. package/dist/components/ui/toaster/types.d.ts +7 -0
  97. package/dist/components/ui/toaster/types.d.ts.map +1 -0
  98. package/dist/components/ui/toaster/types.js +3 -0
  99. package/dist/components/ui/toaster/types.js.map +1 -0
  100. package/dist/global.scss +4 -0
  101. package/dist/index.d.ts +7 -0
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +7 -0
  104. package/dist/index.js.map +1 -1
  105. package/dist/types.d.ts +1 -1
  106. package/dist/types.d.ts.map +1 -1
  107. package/docs/assets/js/search.js +1 -1
  108. package/docs/assets/js/search.json +1 -1
  109. package/docs/classes/ToasterProvider.html +1090 -0
  110. package/docs/enums/ICON.html +65 -6
  111. package/docs/index.html +41 -4
  112. package/docs/modules/Item.html +16 -3
  113. package/docs/modules/List.html +17 -4
  114. package/docs/modules/Modal.html +160 -0
  115. package/docs/modules/ModalButtons.html +160 -0
  116. package/docs/modules/Section.html +16 -3
  117. package/docs/modules/StickyHeader.html +17 -4
  118. package/docs/modules.html +160 -23
  119. package/docs/pages/Tutorials/Test.html +16 -3
  120. package/esm/components/form/Input.d.ts +9 -0
  121. package/esm/components/form/Input.d.ts.map +1 -0
  122. package/esm/components/form/Input.js +25 -0
  123. package/esm/components/form/Input.js.map +1 -0
  124. package/esm/components/form/Input.module.scss +48 -0
  125. package/esm/components/form/Label.d.ts +8 -0
  126. package/esm/components/form/Label.d.ts.map +1 -0
  127. package/esm/components/form/Label.js +16 -0
  128. package/esm/components/form/Label.js.map +1 -0
  129. package/esm/components/form/Label.module.scss +15 -0
  130. package/esm/components/form/TextArea.d.ts +7 -0
  131. package/esm/components/form/TextArea.d.ts.map +1 -0
  132. package/esm/components/form/TextArea.js +20 -0
  133. package/esm/components/form/TextArea.js.map +1 -0
  134. package/esm/components/form/Toggle.d.ts +1 -1
  135. package/esm/components/form/Toggle.d.ts.map +1 -1
  136. package/esm/components/form/Toggle.js.map +1 -1
  137. package/esm/components/icons/Back.d.ts +1 -1
  138. package/esm/components/icons/Back.d.ts.map +1 -1
  139. package/esm/components/icons/Back.js.map +1 -1
  140. package/esm/components/icons/Battery.d.ts +7 -0
  141. package/esm/components/icons/Battery.d.ts.map +1 -0
  142. package/esm/components/icons/Battery.js +8 -0
  143. package/esm/components/icons/Battery.js.map +1 -0
  144. package/esm/components/icons/Forward.d.ts +1 -1
  145. package/esm/components/icons/Forward.d.ts.map +1 -1
  146. package/esm/components/icons/Forward.js.map +1 -1
  147. package/esm/components/icons/Icon.d.ts +3 -1
  148. package/esm/components/icons/Icon.d.ts.map +1 -1
  149. package/esm/components/icons/Icon.js +6 -0
  150. package/esm/components/icons/Icon.js.map +1 -1
  151. package/esm/components/icons/Search.d.ts +7 -0
  152. package/esm/components/icons/Search.d.ts.map +1 -0
  153. package/esm/components/icons/Search.js +7 -0
  154. package/esm/components/icons/Search.js.map +1 -0
  155. package/esm/components/layout/header/HeaderIconAction.d.ts +1 -1
  156. package/esm/components/layout/header/HeaderIconAction.d.ts.map +1 -1
  157. package/esm/components/layout/header/HeaderIconAction.js.map +1 -1
  158. package/esm/components/layout/list/Header.d.ts +5 -1
  159. package/esm/components/layout/list/Header.d.ts.map +1 -1
  160. package/esm/components/layout/list/Header.js +6 -1
  161. package/esm/components/layout/list/Header.js.map +1 -1
  162. package/esm/components/layout/list/Item.d.ts +3 -0
  163. package/esm/components/layout/list/Item.d.ts.map +1 -1
  164. package/esm/components/layout/list/Item.js +20 -6
  165. package/esm/components/layout/list/Item.js.map +1 -1
  166. package/esm/components/layout/list/Item.module.scss +16 -1
  167. package/esm/components/layout/list/List.d.ts +6 -1
  168. package/esm/components/layout/list/List.d.ts.map +1 -1
  169. package/esm/components/layout/list/List.js +15 -1
  170. package/esm/components/layout/list/List.js.map +1 -1
  171. package/esm/components/layout/list/List.module.scss +4 -0
  172. package/esm/components/layout/section/SearchContainer.d.ts +4 -0
  173. package/esm/components/layout/section/SearchContainer.d.ts.map +1 -0
  174. package/esm/components/layout/section/SearchContainer.js +7 -0
  175. package/esm/components/layout/section/SearchContainer.js.map +1 -0
  176. package/esm/components/layout/section/SearchContainer.module.scss +3 -0
  177. package/esm/components/layout/section/Section.module.scss +7 -0
  178. package/esm/components/ui/action/Action.d.ts +1 -1
  179. package/esm/components/ui/action/Action.d.ts.map +1 -1
  180. package/esm/components/ui/action/Action.js.map +1 -1
  181. package/esm/components/ui/button/Button.d.ts +1 -2
  182. package/esm/components/ui/button/Button.d.ts.map +1 -1
  183. package/esm/components/ui/button/Button.js +4 -4
  184. package/esm/components/ui/button/Button.js.map +1 -1
  185. package/esm/components/ui/modal/Modal.d.ts +18 -0
  186. package/esm/components/ui/modal/Modal.d.ts.map +1 -0
  187. package/esm/components/ui/modal/Modal.js +83 -0
  188. package/esm/components/ui/modal/Modal.js.map +1 -0
  189. package/esm/components/ui/modal/Modal.module.scss +92 -0
  190. package/esm/components/ui/modal/ModalButton.d.ts +8 -0
  191. package/esm/components/ui/modal/ModalButton.d.ts.map +1 -0
  192. package/esm/components/ui/modal/ModalButton.js +13 -0
  193. package/esm/components/ui/modal/ModalButton.js.map +1 -0
  194. package/esm/components/ui/modal/ModalButtons.d.ts +10 -0
  195. package/esm/components/ui/modal/ModalButtons.d.ts.map +1 -0
  196. package/esm/components/ui/modal/ModalButtons.js +9 -0
  197. package/esm/components/ui/modal/ModalButtons.js.map +1 -0
  198. package/esm/components/ui/modal/ModalButtons.module.scss +32 -0
  199. package/esm/components/ui/modal/ModalNoMargin.d.ts +6 -0
  200. package/esm/components/ui/modal/ModalNoMargin.d.ts.map +1 -0
  201. package/esm/components/ui/modal/ModalNoMargin.js +16 -0
  202. package/esm/components/ui/modal/ModalNoMargin.js.map +1 -0
  203. package/esm/components/ui/toaster/Notification.d.ts +9 -0
  204. package/esm/components/ui/toaster/Notification.d.ts.map +1 -0
  205. package/esm/components/ui/toaster/Notification.js +14 -0
  206. package/esm/components/ui/toaster/Notification.js.map +1 -0
  207. package/esm/components/ui/toaster/Toaster.d.ts +18 -0
  208. package/esm/components/ui/toaster/Toaster.d.ts.map +1 -0
  209. package/esm/components/ui/toaster/Toaster.js +74 -0
  210. package/esm/components/ui/toaster/Toaster.js.map +1 -0
  211. package/esm/components/ui/toaster/Toaster.module.scss +32 -0
  212. package/esm/components/ui/toaster/types.d.ts +7 -0
  213. package/esm/components/ui/toaster/types.d.ts.map +1 -0
  214. package/esm/components/ui/toaster/types.js +2 -0
  215. package/esm/components/ui/toaster/types.js.map +1 -0
  216. package/esm/global.scss +4 -0
  217. package/esm/index.d.ts +7 -0
  218. package/esm/index.d.ts.map +1 -1
  219. package/esm/index.js +7 -0
  220. package/esm/index.js.map +1 -1
  221. package/esm/types.d.ts +1 -1
  222. package/esm/types.d.ts.map +1 -1
  223. package/package.json +2 -2
  224. package/src/components/form/Input.module.scss +48 -0
  225. package/src/components/form/Input.tsx +48 -0
  226. package/src/components/form/Label.module.scss +15 -0
  227. package/src/components/form/Label.tsx +29 -0
  228. package/src/components/form/TextArea.tsx +38 -0
  229. package/src/components/form/Toggle.tsx +1 -1
  230. package/src/components/icons/Back.tsx +1 -1
  231. package/src/components/icons/Battery.tsx +34 -0
  232. package/src/components/icons/Forward.tsx +1 -1
  233. package/src/components/icons/Icon.tsx +6 -0
  234. package/src/components/icons/Search.tsx +29 -0
  235. package/src/components/layout/header/HeaderIconAction.tsx +1 -1
  236. package/src/components/layout/list/Header.tsx +15 -2
  237. package/src/components/layout/list/Item.module.scss +16 -1
  238. package/src/components/layout/list/Item.tsx +28 -7
  239. package/src/components/layout/list/List.module.scss +4 -0
  240. package/src/components/layout/list/List.tsx +29 -2
  241. package/src/components/layout/section/SearchContainer.module.scss +3 -0
  242. package/src/components/layout/section/SearchContainer.tsx +11 -0
  243. package/src/components/layout/section/Section.module.scss +7 -0
  244. package/src/components/ui/action/Action.tsx +1 -1
  245. package/src/components/ui/button/Button.tsx +11 -5
  246. package/src/components/ui/modal/Modal.module.scss +92 -0
  247. package/src/components/ui/modal/Modal.tsx +136 -0
  248. package/src/components/ui/modal/ModalButton.tsx +25 -0
  249. package/src/components/ui/modal/ModalButtons.module.scss +32 -0
  250. package/src/components/ui/modal/ModalButtons.tsx +17 -0
  251. package/src/components/ui/modal/ModalNoMargin.tsx +22 -0
  252. package/src/components/ui/toaster/Notification.tsx +31 -0
  253. package/src/components/ui/toaster/Toaster.module.scss +32 -0
  254. package/src/components/ui/toaster/Toaster.tsx +101 -0
  255. package/src/components/ui/toaster/types.ts +9 -0
  256. package/src/demo/Demo.tsx +7 -4
  257. package/src/demo/Menu.module.scss +1 -0
  258. package/src/demo/components/form/Form.tsx +35 -0
  259. package/src/demo/components/form/Input.tsx +13 -0
  260. package/src/demo/components/form/Label.tsx +14 -0
  261. package/src/demo/components/form/Search.tsx +36 -0
  262. package/src/demo/components/form/TextArea.tsx +12 -0
  263. package/src/demo/components/form/Toggle.tsx +1 -1
  264. package/src/demo/components/layout/list/Inset.tsx +24 -0
  265. package/src/demo/components/layout/list/Selection.tsx +17 -0
  266. package/src/demo/components/ui/button/ButtonDemo.tsx +9 -5
  267. package/src/demo/components/ui/modal/Modal.tsx +110 -0
  268. package/src/demo/components/ui/toaster/Toaster.tsx +28 -0
  269. package/src/demo/componentsMap.ts +64 -11
  270. package/src/global.scss +4 -0
  271. package/src/index.ts +7 -0
  272. package/src/types.ts +1 -1
@@ -0,0 +1,48 @@
1
+ .input {
2
+ box-sizing: border-box;
3
+ height: calc(103px / var(--ratio-dimensions));
4
+ font-size: calc(34 / var(--ratio-font));
5
+ color: var(--text);
6
+ border: none;
7
+ display: block;
8
+ width: 100%;
9
+ background: none;
10
+ font-family: inherit;
11
+ padding: 1.2em 0;
12
+
13
+ &::placeholder {
14
+ color: var(--sub);
15
+ }
16
+ }
17
+
18
+ .wrapper {
19
+ background: white;
20
+ display: inline-flex;
21
+ width: 100%;
22
+ box-sizing: border-box;
23
+ border-radius: 2px;
24
+ padding: 0 calc(36px / var(--ratio-dimensions));
25
+ border: calc(1px / var(--ratio-border)) solid var(--border);
26
+ align-items: center;
27
+ }
28
+
29
+ .textarea {
30
+ padding: 1.2em calc(36px / var(--ratio-dimensions));
31
+ height: unset;
32
+ resize: vertical;
33
+ min-height: calc(103px * 3 / var(--ratio-dimensions))
34
+ }
35
+
36
+ .prefix {
37
+ margin-right: calc(36px / var(--ratio-dimensions));
38
+ display: flex;
39
+ }
40
+
41
+ .suffix {
42
+ margin-left: calc(36px / var(--ratio-dimensions));
43
+ display: flex;
44
+ }
45
+
46
+ .wrapperFocused {
47
+ border-color: var(--focus-color);
48
+ }
@@ -0,0 +1,48 @@
1
+ import React, { useCallback, useState } from "react";
2
+ import classnames from "classnames";
3
+
4
+ import styles from "./Input.module.scss";
5
+
6
+ interface Props {
7
+ children?: never;
8
+ prefix?: React.ReactNode;
9
+ suffix?: React.ReactNode;
10
+ }
11
+
12
+ const Input: React.FC<Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix"> & Props> = ({
13
+ className, children,
14
+ prefix, suffix,
15
+ onFocus, onBlur,
16
+ ...props
17
+ }) => {
18
+ const [focused, setFocused] = useState(false);
19
+
20
+ const handleFocus = useCallback((e: React.FocusEvent<HTMLInputElement>) => {
21
+ setFocused(true);
22
+ onFocus?.(e);
23
+ }, [onFocus]);
24
+
25
+ const handleBlur = useCallback((e: React.FocusEvent<HTMLInputElement>) => {
26
+ setFocused(false);
27
+ onBlur?.(e);
28
+ }, [onBlur]);
29
+
30
+ const wrapperCls = classnames(styles.wrapper, {
31
+ [styles.wrapperFocused]: focused,
32
+ }, className);
33
+
34
+ const prefixElem = prefix ? <div className={styles.prefix}>{prefix}</div> : null;
35
+ const suffixElem = suffix ? <div className={styles.suffix}>{suffix}</div> : null;
36
+
37
+ return (
38
+ <div className={wrapperCls}>
39
+ {prefixElem}
40
+ <input {...props} onFocus={handleFocus} onBlur={handleBlur} className={styles.input} />
41
+ {suffixElem}
42
+ </div>
43
+ );
44
+ };
45
+
46
+ export {
47
+ Input,
48
+ };
@@ -0,0 +1,15 @@
1
+ .label + .label {
2
+ margin-top: 23px;
3
+ display: block;
4
+ }
5
+
6
+ .text {
7
+ font-size: calc(28px / var(--ratio-font));
8
+ margin-bottom: calc(24px / var(--ratio-dimensions));
9
+ color: var(--sub);
10
+ }
11
+
12
+ .textBig {
13
+ font-size: calc(34px / var(--ratio-font));
14
+
15
+ }
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+
3
+ import styles from "./Label.module.scss";
4
+ import { makeVariants } from "../../utils/makeVariants";
5
+ import classnames from "classnames";
6
+
7
+ interface Props {
8
+ label?: React.ReactNode;
9
+ variant?: "big";
10
+ }
11
+
12
+ const Label: React.FC<Props> = (props) => {
13
+ const v = makeVariants(props.variant);
14
+
15
+ const labelCls = classnames(styles.text, {
16
+ [styles.textBig]: v.includes("big"),
17
+ });
18
+
19
+ const label = props.label ? <div className={labelCls}>{props.label}</div> : null;
20
+
21
+ return (
22
+ <label className={styles.label}>
23
+ {label}
24
+ {props.children}
25
+ </label>
26
+ );
27
+ };
28
+
29
+ export { Label };
@@ -0,0 +1,38 @@
1
+ import React, { useCallback, useState } from "react";
2
+ import classnames from "classnames";
3
+
4
+ import styles from "./Input.module.scss";
5
+
6
+ interface Props {
7
+ children?: never;
8
+ }
9
+
10
+ const TextArea: React.FC<React.TextareaHTMLAttributes<HTMLTextAreaElement> & Props> = ({
11
+ className, children,
12
+ onFocus, onBlur,
13
+ ...props
14
+ }) => {
15
+ const [focused, setFocused] = useState(false);
16
+
17
+ const handleFocus = useCallback((e: React.FocusEvent<HTMLTextAreaElement>) => {
18
+ setFocused(true);
19
+ onFocus?.(e);
20
+ }, [onFocus]);
21
+
22
+ const handleBlur = useCallback((e: React.FocusEvent<HTMLTextAreaElement>) => {
23
+ setFocused(false);
24
+ onBlur?.(e);
25
+ }, [onBlur]);
26
+
27
+ const cls = classnames(styles.wrapper, {
28
+ [styles.wrapperFocused]: focused,
29
+ }, styles.input, styles.textarea, className);
30
+
31
+ return (
32
+ <textarea {...props} onFocus={handleFocus} onBlur={handleBlur} className={cls} />
33
+ );
34
+ };
35
+
36
+ export {
37
+ TextArea,
38
+ };
@@ -8,7 +8,7 @@ interface Props {
8
8
  state: boolean | null;
9
9
  }
10
10
 
11
- const Toggle: React.VFC<Props> = (props) => {
11
+ const Toggle: React.FC<Props> = (props) => {
12
12
  const handleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {
13
13
  if (props.state == null) {
14
14
  return;
@@ -4,7 +4,7 @@ interface Props {
4
4
  className?: string;
5
5
  }
6
6
 
7
- const Back: React.VFC<Props> = (props) => {
7
+ const Back: React.FC<Props> = (props) => {
8
8
  return (
9
9
  <svg
10
10
  width={"9"}
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+
3
+ interface Props {
4
+ className?: string;
5
+ }
6
+
7
+ const Battery: React.FC<Props> = (props) => {
8
+ return (
9
+ <svg
10
+ width={"13"}
11
+ height={"17"}
12
+ xmlns={"http://www.w3.org/2000/svg"}
13
+ className={props.className}
14
+ >
15
+ <path
16
+ fill={"none"}
17
+ stroke={"#000"}
18
+ strokeLinecap={"round"}
19
+ strokeLinejoin={"round"}
20
+ d={"M12.5 2.55q0-.6-.5-.55H9.25q-.65 0-.6-.7v-.2Q8.7.5 8.2.5H4.75q-.4 0-.4.4v.4q.05.75-.75.7H1.1q-.6-.05-.6.55V16q0 .5.6.5h11q.4 0 .4-.45V2.55"}
21
+ />
22
+ <path
23
+ fill={"none"}
24
+ stroke={"#000"}
25
+ strokeLinecap={"round"}
26
+ strokeLinejoin={"round"}
27
+ d={"M8.9 8.6h-2V5.8l-3 4 1.95.05v2.75l3.05-4"}
28
+ />
29
+ </svg>
30
+
31
+ );
32
+ };
33
+
34
+ export { Battery };
@@ -4,7 +4,7 @@ interface Props {
4
4
  className?: string;
5
5
  }
6
6
 
7
- const Forward: React.VFC<Props> = (props) => {
7
+ const Forward: React.FC<Props> = (props) => {
8
8
  return (
9
9
  <svg
10
10
  width={"9"}
@@ -4,11 +4,15 @@ import type { AnyComponent } from "../../types";
4
4
  import { Checkmark } from "./Checkmark.js";
5
5
  import { Back } from "./Back.js";
6
6
  import { Forward } from "./Forward.js";
7
+ import { Search } from "./Search.js";
8
+ import { Battery } from "./Battery.js";
7
9
 
8
10
  enum ICON {
9
11
  checkmark = "checkmark",
10
12
  back = "back",
11
13
  forward = "forward",
14
+ search = "search",
15
+ battery = "battery",
12
16
  }
13
17
 
14
18
  interface Props {
@@ -20,6 +24,8 @@ const iconsMap = new Map<ICON, AnyComponent>([
20
24
  [ICON.checkmark, Checkmark],
21
25
  [ICON.back, Back],
22
26
  [ICON.forward, Forward],
27
+ [ICON.search, Search],
28
+ [ICON.battery, Battery],
23
29
  ]);
24
30
 
25
31
  const Icon: React.FC<Props> = ({ name: iconName, ...props }) => {
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+
3
+ interface Props {
4
+ className?: string;
5
+ }
6
+
7
+ const Search: React.FC<Props> = (props) => {
8
+ return (
9
+ <svg
10
+ baseProfile={"basic"}
11
+ width={"16"}
12
+ height={"16"}
13
+ xmlns={"http://www.w3.org/2000/svg"}
14
+ className={props.className}
15
+ >
16
+ <path
17
+ fill={"none"}
18
+ stroke={"currentColor"}
19
+ strokeWidth={"2"}
20
+ strokeLinecap={"round"}
21
+ strokeLinejoin={"round"}
22
+ d={"M11.95 6.6q0 2.1-1.5 3.6m0-7.2q1.5 1.55 1.5 3.6M6.9 1.5q2.05 0 3.55 1.5m-7.2 0q1.5-1.5 3.65-1.5M1.75 6.6q0-2.05 1.5-3.6m0 7.2q-1.5-1.5-1.5-3.6m5.15 5.1q-2.15 0-3.65-1.5m6.95.2q-1.4 1.3-3.3 1.3m3.3-1.3l4.1 4.1m-3.85-4.3q-.1.1-.25.2"}
23
+ />
24
+ </svg>
25
+
26
+ );
27
+ };
28
+
29
+ export { Search };
@@ -19,7 +19,7 @@ interface Props {
19
19
  // if className ever goes here make sure that `a` gets classnames merged
20
20
  }
21
21
 
22
- const HeaderIconAction: React.VFC<Props> = (props) => {
22
+ const HeaderIconAction: React.FC<Props> = (props) => {
23
23
  const { icon, label, href, to, Link, ...restProps } = props;
24
24
 
25
25
  let content: ReactNode = icon;
@@ -3,11 +3,24 @@ import classnames from "classnames";
3
3
 
4
4
  import styles from "./Item.module.scss";
5
5
  import headerStyles from "./Header.module.scss";
6
+ import { makeVariants } from "../../../utils/makeVariants";
7
+
8
+ type Variant = "inset";
9
+
10
+ interface Props {
11
+ variant?: Variant | Variant[];
12
+ }
13
+
14
+ const Header: React.FC<Props> = (props) => {
15
+ const v = makeVariants(props.variant);
16
+
17
+ const cls = classnames(styles.item, headerStyles.header, {
18
+ [styles.inset]: v.includes("inset"),
19
+ });
6
20
 
7
- const Header: React.FC = (props) => {
8
21
  // @TODO way to use h1, h2, h3 instead of div
9
22
  return (
10
- <li className={classnames(styles.item, headerStyles.header)}>
23
+ <li className={cls}>
11
24
  <div>{props.children}</div>
12
25
  </li>
13
26
  );
@@ -4,7 +4,7 @@
4
4
  padding: 0;
5
5
  font-size: calc(34px / var(--ratio-font));
6
6
 
7
- &:not(:first-child) > * {
7
+ &:not(:first-child) {
8
8
  border-top: 0.37px solid var(--header-border);
9
9
  }
10
10
 
@@ -29,3 +29,18 @@
29
29
  min-height: calc(174px / var(--ratio-dimensions));
30
30
  align-items: center;
31
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
+ }
@@ -4,11 +4,15 @@ import classnames from "classnames";
4
4
  import styles from "./Item.module.scss";
5
5
  import { Value } from "./Value.js";
6
6
  import { Label } from "./Label.js";
7
+ import { makeVariants } from "../../../utils/makeVariants";
8
+ import { ICON, Icon } from "../../icons/Icon";
7
9
 
8
10
  interface LinkProps {
9
11
  href: string;
10
12
  }
11
13
 
14
+ type Variant = "inset";
15
+
12
16
  interface Props {
13
17
  href?: string;
14
18
  to?: string;
@@ -16,6 +20,8 @@ interface Props {
16
20
  className?: string;
17
21
  Link?: React.ComponentClass<LinkProps> | React.FC<LinkProps>;
18
22
  ratio?: string; // @TODO number/number/number/.. type?
23
+ variant?: Variant | Variant[];
24
+ selected?: boolean | undefined;
19
25
  }
20
26
 
21
27
  interface SubComponents {
@@ -23,11 +29,26 @@ interface SubComponents {
23
29
  Value: typeof Value;
24
30
  }
25
31
 
26
- // eslint-disable-next-line max-statements
32
+ const icon = <Icon className={styles.icon} name={ICON.forward} />;
33
+ const noIcon = <span className={styles.icon} />;
34
+
35
+ // eslint-disable-next-line max-statements,max-lines-per-function
27
36
  const Item: React.FC<Props> & SubComponents = (props) => {
28
- const { className, children, href, to, onClick, Link, ratio, ...restProps } = props;
37
+ const { className, children, href, to, onClick, Link, ratio, variant, selected, ...restProps } = props;
38
+ const v = makeVariants(variant);
29
39
  const cls = classnames(styles.item, className);
30
40
 
41
+ const innerCls = classnames(styles.content, {
42
+ [styles.inset]: v.includes("inset"),
43
+ [styles.selected]: selected,
44
+ });
45
+
46
+ const pre = typeof selected === "boolean"
47
+ ? (
48
+ selected ? icon : noIcon
49
+ )
50
+ : null;
51
+
31
52
  const liProps = {
32
53
  className: cls,
33
54
  };
@@ -42,7 +63,7 @@ const Item: React.FC<Props> & SubComponents = (props) => {
42
63
  if (index in r) {
43
64
  flex = r[index];
44
65
  }
45
- return <div style={{ flex }}>{child}</div>;
66
+ return <div style={{ flex }}>{pre}{child}</div>;
46
67
  });
47
68
 
48
69
  if (to) {
@@ -50,25 +71,25 @@ const Item: React.FC<Props> & SubComponents = (props) => {
50
71
  throw new TypeError("`to` prop given without `Link` component");
51
72
  }
52
73
 
53
- return <li {...liProps}><Link href={to} {...restProps}><a className={styles.content}>{ren}</a></Link></li>;
74
+ return <li {...liProps}><Link href={to} {...restProps}><a className={innerCls}>{ren}</a></Link></li>;
54
75
  }
55
76
  if (href) {
56
77
  const aProps: typeof restProps & { onClick?: Props["onClick"]} = { ...restProps };
57
78
  if (onClick) {
58
79
  aProps.onClick = onClick;
59
80
  }
60
- return <li {...liProps}><a href={href} {...aProps} className={styles.content}>{ren}</a></li>;
81
+ return <li {...liProps}><a href={href} {...aProps} className={innerCls}>{ren}</a></li>;
61
82
  }
62
83
  if (onClick) {
63
84
  return (
64
85
  <li {...liProps}>
65
- <button className={classnames(styles.button, styles.content)} onClick={props.onClick}{...restProps}>
86
+ <button className={classnames(styles.button, innerCls)} onClick={props.onClick} {...restProps}>
66
87
  {ren}
67
88
  </button>
68
89
  </li>
69
90
  );
70
91
  }
71
- return <li {...liProps}><div {...restProps} className={styles.content}>{ren}</div></li>;
92
+ return <li {...liProps}><div {...restProps} className={innerCls}>{ren}</div></li>;
72
93
  };
73
94
 
74
95
  Item.Label = Label;
@@ -2,3 +2,7 @@
2
2
  margin: 0 23px;
3
3
  padding: 0;
4
4
  }
5
+
6
+ .inset {
7
+ margin: 0;
8
+ }
@@ -1,15 +1,42 @@
1
1
  import React from "react";
2
+ import classnames from "classnames";
2
3
 
3
4
  import { Header } from "./Header.js";
5
+ import { makeVariants } from "../../../utils/makeVariants";
6
+ import { Item } from "./Item";
4
7
  import styles from "./List.module.scss";
5
8
 
9
+ type Variant = "inset";
10
+
11
+ interface Props {
12
+ className?: string;
13
+ variant?: Variant | Variant[];
14
+ }
15
+
6
16
  interface SubComponents {
7
17
  Header: typeof Header;
8
18
  }
9
19
 
10
- const List: React.FC & SubComponents = (props) => {
20
+ const List: React.FC<Props> & SubComponents = (props) => {
21
+ const v = makeVariants(props.variant);
22
+
23
+ const chld = React.Children.map(props.children, (child) => {
24
+ if (child && typeof child === "object" && "type" in child && (child.type === Item || child.type === Header)) {
25
+ return React.cloneElement(child, {
26
+ // @TODO this will override but should merge?
27
+ variant: props.variant,
28
+ });
29
+ }
30
+ return child;
31
+ });
32
+
11
33
  return (
12
- <ul className={styles.list}>{props.children}</ul>
34
+ <ul
35
+ className={classnames(styles.list, {
36
+ [styles.inset]: v.includes("inset"),
37
+ })}
38
+ >{chld}
39
+ </ul>
13
40
  );
14
41
  };
15
42
 
@@ -0,0 +1,3 @@
1
+ .section {
2
+ margin: 12px;
3
+ }
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+
3
+ import styles from "./SearchContainer.module.scss";
4
+
5
+ const SearchContainer: React.FC = (props) => {
6
+ return (
7
+ <section className={styles.section}>{props.children}</section>
8
+ );
9
+ };
10
+
11
+ export { SearchContainer };
@@ -15,3 +15,10 @@
15
15
  margin-left: 23px;
16
16
  margin-right: 23px;
17
17
  }
18
+
19
+ .section > .section.vertical {
20
+ padding-top: 23px;
21
+ padding-bottom: 23px;
22
+ margin-top: 0;
23
+ margin-bottom: 0;
24
+ }
@@ -19,7 +19,7 @@ interface Props {
19
19
  // if className ever goes here make sure that `a` gets classnames merged
20
20
  }
21
21
 
22
- const Action: React.VFC<Props> = (props) => {
22
+ const Action: React.FC<Props> = (props) => {
23
23
  const { icon, label, href, to, Link, ...restProps } = props;
24
24
 
25
25
  let iconElem: ReactNode = icon;
@@ -5,20 +5,26 @@ import styles from "./Button.module.scss";
5
5
  import { makeVariants } from "../../../utils/makeVariants.js";
6
6
 
7
7
  interface Props {
8
- disabled?: boolean;
9
8
  variant?: "inline" | "outline";
10
9
  }
11
10
 
12
- const Button: React.FC<Props> = (props) => {
13
- const variants = makeVariants(props.variant);
11
+ const Button: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & Props> = ({
12
+ className, children, variant, ...props
13
+ }) => {
14
+ const variants = makeVariants(variant);
14
15
 
15
16
  const cls = classnames(styles.btn, {
16
17
  [styles["btn--inline"]]: variants.includes("inline"),
17
18
  [styles["btn--outline"]]: variants.includes("outline"),
18
- });
19
+ }, className);
19
20
 
20
21
  return (
21
- <button className={cls} disabled={props.disabled}>{props.children}</button>
22
+ <button
23
+ {...props}
24
+ className={cls}
25
+ disabled={props.disabled}
26
+ >{children}
27
+ </button>
22
28
  );
23
29
  };
24
30
 
@@ -0,0 +1,92 @@
1
+ @keyframes overlay {
2
+ from {
3
+ background: #00000000;
4
+ }
5
+
6
+ to {
7
+ background: #0000004c;
8
+ }
9
+ }
10
+
11
+ .overlay {
12
+ position: fixed;
13
+ z-index: 4;
14
+ top: 0;
15
+ bottom: 0;
16
+ left: 0;
17
+ right: 0;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ animation: overlay 300ms;
22
+ animation-fill-mode: forwards;
23
+ }
24
+
25
+ .overlayOnBottom {
26
+ align-items: flex-end;
27
+ padding-bottom: calc(24px / var(--ratio-dimensions));
28
+ }
29
+
30
+ @keyframes container {
31
+ from {
32
+ transform: translateY(30px);
33
+ opacity: 0;
34
+ }
35
+
36
+ to {
37
+ transform: translateY(0);
38
+ opacity: 1;
39
+ }
40
+ }
41
+
42
+ .container {
43
+ background: var(--modal-bg);
44
+ border-radius: calc(12px / var(--ratio-dimensions));
45
+ max-width: 333px;
46
+ width: calc(100% - 30px);
47
+ padding: 20px;
48
+ position: relative;
49
+ box-sizing: border-box;
50
+ animation: container 300ms;
51
+ animation-fill-mode: forwards;
52
+ }
53
+
54
+ .full {
55
+ width: calc(100vw - 30px);
56
+ max-width: 1000px;
57
+ }
58
+
59
+ .isClosing {
60
+ // keep this after .overlay .container to prevent overwriting
61
+ animation-direction: reverse;
62
+ }
63
+
64
+ .close {
65
+ position: absolute;
66
+ top: 20px;
67
+ right: 20px;
68
+ background: none;
69
+ border: none;
70
+ padding: 0;
71
+ margin: 0;
72
+
73
+ + .title {
74
+ margin-right: 40px;
75
+ margin-top: -4px;
76
+ }
77
+ }
78
+
79
+ .title {
80
+ font-size: calc(40px / var(--ratio-font));
81
+ text-align: center;
82
+ color: black;
83
+ margin: calc(90px / var(--ratio-dimensions)) 0;
84
+ }
85
+
86
+ .negateMargin {
87
+ margin: 0 -20px -20px;
88
+ }
89
+
90
+ .removeMargin {
91
+ margin: 0;
92
+ }