react-miui 0.4.3 → 0.6.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 (184) hide show
  1. package/CHANGELOG.md +22 -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 +39 -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/Toggle.d.ts +1 -1
  15. package/dist/components/form/Toggle.d.ts.map +1 -1
  16. package/dist/components/form/Toggle.js.map +1 -1
  17. package/dist/components/icons/Back.d.ts +1 -1
  18. package/dist/components/icons/Back.d.ts.map +1 -1
  19. package/dist/components/icons/Back.js.map +1 -1
  20. package/dist/components/icons/Battery.d.ts +7 -0
  21. package/dist/components/icons/Battery.d.ts.map +1 -0
  22. package/dist/components/icons/Battery.js +14 -0
  23. package/dist/components/icons/Battery.js.map +1 -0
  24. package/dist/components/icons/Forward.d.ts +1 -1
  25. package/dist/components/icons/Forward.d.ts.map +1 -1
  26. package/dist/components/icons/Forward.js.map +1 -1
  27. package/dist/components/icons/Icon.d.ts +3 -1
  28. package/dist/components/icons/Icon.d.ts.map +1 -1
  29. package/dist/components/icons/Icon.js +6 -0
  30. package/dist/components/icons/Icon.js.map +1 -1
  31. package/dist/components/icons/Search.d.ts +7 -0
  32. package/dist/components/icons/Search.d.ts.map +1 -0
  33. package/dist/components/icons/Search.js +13 -0
  34. package/dist/components/icons/Search.js.map +1 -0
  35. package/dist/components/layout/card/Card.d.ts +8 -0
  36. package/dist/components/layout/card/Card.d.ts.map +1 -0
  37. package/dist/components/layout/card/Card.js +19 -0
  38. package/dist/components/layout/card/Card.js.map +1 -0
  39. package/dist/components/layout/card/Card.module.scss +15 -0
  40. package/dist/components/layout/header/HeaderIconAction.d.ts +1 -1
  41. package/dist/components/layout/header/HeaderIconAction.d.ts.map +1 -1
  42. package/dist/components/layout/header/HeaderIconAction.js.map +1 -1
  43. package/dist/components/layout/section/SearchContainer.d.ts +4 -0
  44. package/dist/components/layout/section/SearchContainer.d.ts.map +1 -0
  45. package/dist/components/layout/section/SearchContainer.js +13 -0
  46. package/dist/components/layout/section/SearchContainer.js.map +1 -0
  47. package/dist/components/layout/section/SearchContainer.module.scss +3 -0
  48. package/dist/components/layout/section/Section.d.ts +12 -0
  49. package/dist/components/layout/section/Section.d.ts.map +1 -0
  50. package/dist/components/layout/section/Section.js +22 -0
  51. package/dist/components/layout/section/Section.js.map +1 -0
  52. package/dist/components/layout/section/Section.module.scss +24 -0
  53. package/dist/components/layout/section/SectionContainer.d.ts +4 -0
  54. package/dist/components/layout/section/SectionContainer.d.ts.map +1 -0
  55. package/dist/components/layout/section/SectionContainer.js +13 -0
  56. package/dist/components/layout/section/SectionContainer.js.map +1 -0
  57. package/dist/components/layout/section/SectionContainer.module.scss +4 -0
  58. package/dist/components/ui/action/Action.d.ts +1 -1
  59. package/dist/components/ui/action/Action.d.ts.map +1 -1
  60. package/dist/components/ui/action/Action.js.map +1 -1
  61. package/dist/components/ui/button/Button.d.ts +1 -2
  62. package/dist/components/ui/button/Button.d.ts.map +1 -1
  63. package/dist/components/ui/button/Button.js +15 -3
  64. package/dist/components/ui/button/Button.js.map +1 -1
  65. package/dist/global.scss +3 -0
  66. package/dist/index.d.ts +5 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +5 -0
  69. package/dist/index.js.map +1 -1
  70. package/dist/types.d.ts +1 -1
  71. package/dist/types.d.ts.map +1 -1
  72. package/docs/assets/js/search.js +1 -1
  73. package/docs/assets/js/search.json +1 -1
  74. package/docs/enums/ICON.html +49 -6
  75. package/docs/index.html +22 -4
  76. package/docs/modules/Item.html +6 -3
  77. package/docs/modules/List.html +6 -3
  78. package/docs/modules/Section.html +147 -0
  79. package/docs/modules/StickyHeader.html +7 -4
  80. package/docs/modules.html +94 -20
  81. package/docs/pages/Tutorials/Test.html +6 -3
  82. package/esm/components/form/Input.d.ts +9 -0
  83. package/esm/components/form/Input.d.ts.map +1 -0
  84. package/esm/components/form/Input.js +25 -0
  85. package/esm/components/form/Input.js.map +1 -0
  86. package/esm/components/form/Input.module.scss +39 -0
  87. package/esm/components/form/Label.d.ts +8 -0
  88. package/esm/components/form/Label.d.ts.map +1 -0
  89. package/esm/components/form/Label.js +16 -0
  90. package/esm/components/form/Label.js.map +1 -0
  91. package/esm/components/form/Label.module.scss +15 -0
  92. package/esm/components/form/Toggle.d.ts +1 -1
  93. package/esm/components/form/Toggle.d.ts.map +1 -1
  94. package/esm/components/form/Toggle.js.map +1 -1
  95. package/esm/components/icons/Back.d.ts +1 -1
  96. package/esm/components/icons/Back.d.ts.map +1 -1
  97. package/esm/components/icons/Back.js.map +1 -1
  98. package/esm/components/icons/Battery.d.ts +7 -0
  99. package/esm/components/icons/Battery.d.ts.map +1 -0
  100. package/esm/components/icons/Battery.js +8 -0
  101. package/esm/components/icons/Battery.js.map +1 -0
  102. package/esm/components/icons/Forward.d.ts +1 -1
  103. package/esm/components/icons/Forward.d.ts.map +1 -1
  104. package/esm/components/icons/Forward.js.map +1 -1
  105. package/esm/components/icons/Icon.d.ts +3 -1
  106. package/esm/components/icons/Icon.d.ts.map +1 -1
  107. package/esm/components/icons/Icon.js +6 -0
  108. package/esm/components/icons/Icon.js.map +1 -1
  109. package/esm/components/icons/Search.d.ts +7 -0
  110. package/esm/components/icons/Search.d.ts.map +1 -0
  111. package/esm/components/icons/Search.js +7 -0
  112. package/esm/components/icons/Search.js.map +1 -0
  113. package/esm/components/layout/card/Card.d.ts +8 -0
  114. package/esm/components/layout/card/Card.d.ts.map +1 -0
  115. package/esm/components/layout/card/Card.js +13 -0
  116. package/esm/components/layout/card/Card.js.map +1 -0
  117. package/esm/components/layout/card/Card.module.scss +15 -0
  118. package/esm/components/layout/header/HeaderIconAction.d.ts +1 -1
  119. package/esm/components/layout/header/HeaderIconAction.d.ts.map +1 -1
  120. package/esm/components/layout/header/HeaderIconAction.js.map +1 -1
  121. package/esm/components/layout/section/SearchContainer.d.ts +4 -0
  122. package/esm/components/layout/section/SearchContainer.d.ts.map +1 -0
  123. package/esm/components/layout/section/SearchContainer.js +7 -0
  124. package/esm/components/layout/section/SearchContainer.js.map +1 -0
  125. package/esm/components/layout/section/SearchContainer.module.scss +3 -0
  126. package/esm/components/layout/section/Section.d.ts +12 -0
  127. package/esm/components/layout/section/Section.d.ts.map +1 -0
  128. package/esm/components/layout/section/Section.js +16 -0
  129. package/esm/components/layout/section/Section.js.map +1 -0
  130. package/esm/components/layout/section/Section.module.scss +24 -0
  131. package/esm/components/layout/section/SectionContainer.d.ts +4 -0
  132. package/esm/components/layout/section/SectionContainer.d.ts.map +1 -0
  133. package/esm/components/layout/section/SectionContainer.js +7 -0
  134. package/esm/components/layout/section/SectionContainer.js.map +1 -0
  135. package/esm/components/layout/section/SectionContainer.module.scss +4 -0
  136. package/esm/components/ui/action/Action.d.ts +1 -1
  137. package/esm/components/ui/action/Action.d.ts.map +1 -1
  138. package/esm/components/ui/action/Action.js.map +1 -1
  139. package/esm/components/ui/button/Button.d.ts +1 -2
  140. package/esm/components/ui/button/Button.d.ts.map +1 -1
  141. package/esm/components/ui/button/Button.js +3 -3
  142. package/esm/components/ui/button/Button.js.map +1 -1
  143. package/esm/global.scss +3 -0
  144. package/esm/index.d.ts +5 -0
  145. package/esm/index.d.ts.map +1 -1
  146. package/esm/index.js +5 -0
  147. package/esm/index.js.map +1 -1
  148. package/esm/types.d.ts +1 -1
  149. package/esm/types.d.ts.map +1 -1
  150. package/package.json +2 -2
  151. package/src/components/form/Input.module.scss +39 -0
  152. package/src/components/form/Input.tsx +48 -0
  153. package/src/components/form/Label.module.scss +15 -0
  154. package/src/components/form/Label.tsx +29 -0
  155. package/src/components/form/Toggle.tsx +1 -1
  156. package/src/components/icons/Back.tsx +1 -1
  157. package/src/components/icons/Battery.tsx +34 -0
  158. package/src/components/icons/Forward.tsx +1 -1
  159. package/src/components/icons/Icon.tsx +6 -0
  160. package/src/components/icons/Search.tsx +29 -0
  161. package/src/components/layout/card/Card.module.scss +15 -0
  162. package/src/components/layout/card/Card.tsx +26 -0
  163. package/src/components/layout/header/HeaderIconAction.tsx +1 -1
  164. package/src/components/layout/section/SearchContainer.module.scss +3 -0
  165. package/src/components/layout/section/SearchContainer.tsx +11 -0
  166. package/src/components/layout/section/Section.module.scss +24 -0
  167. package/src/components/layout/section/Section.tsx +34 -0
  168. package/src/components/layout/section/SectionContainer.module.scss +4 -0
  169. package/src/components/layout/section/SectionContainer.tsx +11 -0
  170. package/src/components/ui/action/Action.tsx +1 -1
  171. package/src/components/ui/button/Button.tsx +8 -4
  172. package/src/demo/Main.module.scss +2 -0
  173. package/src/demo/components/form/Form.tsx +31 -0
  174. package/src/demo/components/form/Input.tsx +13 -0
  175. package/src/demo/components/form/Label.tsx +14 -0
  176. package/src/demo/components/form/Search.tsx +36 -0
  177. package/src/demo/components/form/Toggle.tsx +1 -1
  178. package/src/demo/components/layout/card/Card.tsx +21 -0
  179. package/src/demo/components/layout/section/Section.tsx +34 -0
  180. package/src/demo/components/ui/button/ButtonDemo.tsx +9 -5
  181. package/src/demo/componentsMap.ts +43 -11
  182. package/src/global.scss +3 -0
  183. package/src/index.ts +5 -0
  184. package/src/types.ts +1 -1
@@ -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 };
@@ -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 };
@@ -0,0 +1,15 @@
1
+ .card {
2
+ background: var(--background);
3
+ border-radius: 5px;
4
+ display: flex;
5
+ flex-direction: column;
6
+
7
+ + .card {
8
+ margin-top: 23px;
9
+ }
10
+ }
11
+
12
+ .margin {
13
+ margin-left: 23px;
14
+ margin-right: 23px;
15
+ }
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import classnames from "classnames";
3
+
4
+ import { makeVariants } from "../../../utils/makeVariants.js";
5
+ import styles from "./Card.module.scss";
6
+
7
+ type Variants = "margin";
8
+
9
+ interface Props {
10
+ variant?: Variants;
11
+ }
12
+
13
+ const Card: React.FC<Props> = (props) => {
14
+ const v = makeVariants(props.variant);
15
+ const cls = classnames(styles.card, {
16
+ [styles.margin]: v.includes("margin"),
17
+ });
18
+
19
+ // @TODO auto wrap some children in Section
20
+
21
+ return (
22
+ <div className={cls}>{props.children}</div>
23
+ );
24
+ };
25
+
26
+ export { Card };
@@ -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;
@@ -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 };
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import classnames from "classnames";
3
+
4
+ import { SectionContainer } from "./SectionContainer.js";
5
+ import { makeVariants } from "../../../utils/makeVariants.js";
6
+ import styles from "./Section.module.scss";
7
+
8
+ interface SubComponents {
9
+ Container: typeof SectionContainer;
10
+ }
11
+
12
+ type Variant = "horizontal" | "vertical";
13
+
14
+ interface Props {
15
+ variant?: Variant | Variant[];
16
+ }
17
+
18
+ const Section: React.FC<Props> & SubComponents = (props) => {
19
+ const v = makeVariants(props.variant);
20
+
21
+ const cls = classnames(styles.section, {
22
+ [styles.vertical]: v.includes("vertical"),
23
+ [styles.horizontal]: v.includes("horizontal"),
24
+ });
25
+ return (
26
+ <section className={cls}>
27
+ {props.children}
28
+ </section>
29
+ );
30
+ };
31
+
32
+ Section.Container = SectionContainer;
33
+
34
+ export { Section };
@@ -0,0 +1,4 @@
1
+ .container {
2
+ background: var(--toolbar-bg);
3
+ flex: 1;
4
+ }
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+
3
+ import styles from "./SectionContainer.module.scss";
4
+
5
+ const SectionContainer: React.FC = (props) => {
6
+ return (
7
+ <div className={styles.container}>{props.children}</div>
8
+ );
9
+ };
10
+
11
+ export { SectionContainer };
@@ -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,24 @@ 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) => {
11
+ const Button: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & Props> = ({ className, children, ...props }) => {
13
12
  const variants = makeVariants(props.variant);
14
13
 
15
14
  const cls = classnames(styles.btn, {
16
15
  [styles["btn--inline"]]: variants.includes("inline"),
17
16
  [styles["btn--outline"]]: variants.includes("outline"),
18
- });
17
+ }, className);
19
18
 
20
19
  return (
21
- <button className={cls} disabled={props.disabled}>{props.children}</button>
20
+ <button
21
+ {...props}
22
+ className={cls}
23
+ disabled={props.disabled}
24
+ >{children}
25
+ </button>
22
26
  );
23
27
  };
24
28
 
@@ -9,6 +9,8 @@
9
9
  padding: 20px;
10
10
  flex: 1;
11
11
  overflow: auto;
12
+ display: flex;
13
+ flex-direction: column;
12
14
 
13
15
  &--transparent {
14
16
  background-position: 0px 0px, 10px 10px;
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { Section } from "../../../components/layout/section/Section";
3
+ import { SectionContainer } from "../../../components/layout/section/SectionContainer";
4
+ import { Input } from "../../../components/form/Input";
5
+ import { Label } from "../../../components/form/Label";
6
+ import { Button } from "../../../components/ui/button/Button";
7
+
8
+ // @TODO add checkbox
9
+ // @TODO add toggle
10
+ // @TODO some kind of `form` wrapper which also takes cares of margins?
11
+ const FormDemo = () => {
12
+ return (
13
+ <SectionContainer>
14
+ <Section>
15
+ <Section variant={["vertical", "horizontal"]}>
16
+ <Label label={"First name"}>
17
+ <Input placeholder={""} />
18
+ </Label>
19
+ <Label label={"E-mail"}>
20
+ <Input placeholder={"Don't forget the @"} suffix={".com"} />
21
+ </Label>
22
+ <Label>
23
+ <Button>Submit</Button>
24
+ </Label>
25
+ </Section>
26
+ </Section>
27
+ </SectionContainer>
28
+ );
29
+ };
30
+
31
+ export { FormDemo };
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { Input } from "../../../components/form/Input";
3
+ import { ICON, Icon } from "../../../components/icons/Icon";
4
+
5
+ const InputDemo: React.FC = () => {
6
+ return (
7
+ <>
8
+ <Input placeholder={"Capacity"} prefix={<Icon name={ICON.battery} />} suffix={"kWh"} />
9
+ </>
10
+ );
11
+ };
12
+
13
+ export { InputDemo };
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { Label } from "../../../components/form/Label";
3
+ import { Input } from "../../../components/form/Input";
4
+ import { ICON, Icon } from "../../../components/icons/Icon";
5
+
6
+ const LabelDemo = () => {
7
+ return (
8
+ <Label label={"Capacity"}>
9
+ <Input placeholder={"ie: 500"} prefix={<Icon name={ICON.battery} />} suffix={"kWh"} />
10
+ </Label>
11
+ );
12
+ };
13
+
14
+ export { LabelDemo };
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { SearchContainer } from "../../../components/layout/section/SearchContainer";
3
+ import { Input } from "../../../components/form/Input";
4
+ import { ICON, Icon } from "../../../components/icons/Icon";
5
+ import { Section } from "../../../components/layout/section/Section";
6
+ import { SectionContainer } from "../../../components/layout/section/SectionContainer";
7
+ import { List } from "../../../components/layout/list/List";
8
+ import { Item } from "../../../components/layout/list/Item";
9
+
10
+ const SearchDemo = () => {
11
+ return (
12
+ <SectionContainer>
13
+ <SearchContainer>
14
+ <Input placeholder={"Search..."} prefix={<Icon name={ICON.search} />} />
15
+ </SearchContainer>
16
+ <Section>
17
+ <List>
18
+ <List.Header>Messages</List.Header>
19
+ <Item>Lorem</Item>
20
+ <Item>Ipsum</Item>
21
+ <Item>Dolor</Item>
22
+ </List>
23
+ </Section>
24
+ <Section>
25
+ <List>
26
+ <List.Header>Contacts</List.Header>
27
+ <Item>Lorem</Item>
28
+ <Item>Ipsum</Item>
29
+ <Item>Dolor</Item>
30
+ </List>
31
+ </Section>
32
+ </SectionContainer>
33
+ );
34
+ };
35
+
36
+ export { SearchDemo };
@@ -5,7 +5,7 @@ import { Item } from "../../../components/layout/list/Item";
5
5
 
6
6
  const handleNoop = () => undefined;
7
7
 
8
- const ToggleDemo: React.VFC = () => {
8
+ const ToggleDemo: React.FC = () => {
9
9
  const [state, ss] = useState<boolean | null>(null);
10
10
 
11
11
  useEffect(() => {
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { Card } from "../../../../components/layout/card/Card";
3
+ import { Section } from "../../../../components/layout/section/Section";
4
+
5
+ const CardDemo = () => {
6
+ return (
7
+ <Section.Container>
8
+ <Card>
9
+ <Section variant={["vertical", "horizontal"]}>Content</Section>
10
+ </Card>
11
+ <Card>
12
+ <Section variant={["vertical", "horizontal"]}>Content</Section>
13
+ </Card>
14
+ <Card variant={"margin"}>
15
+ <Section variant={["vertical", "horizontal"]}>Content</Section>
16
+ </Card>
17
+ </Section.Container>
18
+ );
19
+ };
20
+
21
+ export { CardDemo };
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import { Section } from "../../../../components/layout/section/Section.js";
3
+ import { List } from "../../../../components/layout/list/List";
4
+ import { Item } from "../../../../components/layout/list/Item";
5
+
6
+ const SectionDemo = () => {
7
+ return (
8
+ <Section.Container>
9
+ <Section>
10
+ <List>
11
+ <List.Header>Section name</List.Header>
12
+ <Item>Item</Item>
13
+ <Item>Item</Item>
14
+ </List>
15
+ </Section>
16
+ <Section>
17
+ <List>
18
+ <List.Header>Section name</List.Header>
19
+ <Item>Item</Item>
20
+ <Item>Item</Item>
21
+ </List>
22
+ </Section>
23
+ <Section>
24
+ <List>
25
+ <List.Header>Section name</List.Header>
26
+ <Item>Item</Item>
27
+ <Item>Item</Item>
28
+ </List>
29
+ </Section>
30
+ </Section.Container>
31
+ );
32
+ };
33
+
34
+ export { SectionDemo };
@@ -1,16 +1,20 @@
1
- import React from "react";
1
+ import React, { useCallback } from "react";
2
2
  import { Button } from "../../../../index.js";
3
3
 
4
4
  const ButtonDemo = () => {
5
+ const handleClick = useCallback(() => {
6
+ alert("Clicked");
7
+ }, []);
8
+
5
9
  return (
6
10
  <div>
7
- <Button>Basic button</Button>
11
+ <Button onClick={handleClick}>Basic button</Button>
8
12
  <br />
9
- <Button disabled={true}>Disabled button</Button>
13
+ <Button disabled={true} onClick={handleClick}>Disabled button</Button>
10
14
  <br />
11
- <Button variant={"inline"}>Inline button</Button>
15
+ <Button variant={"inline"} onClick={handleClick}>Inline button</Button>
12
16
  <br />
13
- <Button variant={"outline"}>Outline button</Button>
17
+ <Button variant={"outline"} onClick={handleClick}>Outline button</Button>
14
18
  </div>
15
19
  );
16
20
  };