react-miui 0.7.0 → 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 (146) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/components/layout/list/Header.d.ts +5 -1
  3. package/dist/components/layout/list/Header.d.ts.map +1 -1
  4. package/dist/components/layout/list/Header.js +6 -1
  5. package/dist/components/layout/list/Header.js.map +1 -1
  6. package/dist/components/layout/list/Item.d.ts +3 -0
  7. package/dist/components/layout/list/Item.d.ts.map +1 -1
  8. package/dist/components/layout/list/Item.js +20 -6
  9. package/dist/components/layout/list/Item.js.map +1 -1
  10. package/dist/components/layout/list/Item.module.scss +16 -1
  11. package/dist/components/layout/list/List.d.ts +6 -1
  12. package/dist/components/layout/list/List.d.ts.map +1 -1
  13. package/dist/components/layout/list/List.js +15 -1
  14. package/dist/components/layout/list/List.js.map +1 -1
  15. package/dist/components/layout/list/List.module.scss +4 -0
  16. package/dist/components/ui/button/Button.d.ts.map +1 -1
  17. package/dist/components/ui/button/Button.js +2 -2
  18. package/dist/components/ui/button/Button.js.map +1 -1
  19. package/dist/components/ui/modal/Modal.d.ts +18 -0
  20. package/dist/components/ui/modal/Modal.d.ts.map +1 -0
  21. package/dist/components/ui/modal/Modal.js +108 -0
  22. package/dist/components/ui/modal/Modal.js.map +1 -0
  23. package/dist/components/ui/modal/Modal.module.scss +92 -0
  24. package/dist/components/ui/modal/ModalButton.d.ts +8 -0
  25. package/dist/components/ui/modal/ModalButton.d.ts.map +1 -0
  26. package/dist/components/ui/modal/ModalButton.js +31 -0
  27. package/dist/components/ui/modal/ModalButton.js.map +1 -0
  28. package/dist/components/ui/modal/ModalButtons.d.ts +10 -0
  29. package/dist/components/ui/modal/ModalButtons.d.ts.map +1 -0
  30. package/dist/components/ui/modal/ModalButtons.js +15 -0
  31. package/dist/components/ui/modal/ModalButtons.js.map +1 -0
  32. package/dist/components/ui/modal/ModalButtons.module.scss +32 -0
  33. package/dist/components/ui/modal/ModalNoMargin.d.ts +6 -0
  34. package/dist/components/ui/modal/ModalNoMargin.d.ts.map +1 -0
  35. package/dist/components/ui/modal/ModalNoMargin.js +22 -0
  36. package/dist/components/ui/modal/ModalNoMargin.js.map +1 -0
  37. package/dist/components/ui/toaster/Notification.d.ts +9 -0
  38. package/dist/components/ui/toaster/Notification.d.ts.map +1 -0
  39. package/dist/components/ui/toaster/Notification.js +39 -0
  40. package/dist/components/ui/toaster/Notification.js.map +1 -0
  41. package/dist/components/ui/toaster/Toaster.d.ts +18 -0
  42. package/dist/components/ui/toaster/Toaster.d.ts.map +1 -0
  43. package/dist/components/ui/toaster/Toaster.js +79 -0
  44. package/dist/components/ui/toaster/Toaster.js.map +1 -0
  45. package/dist/components/ui/toaster/Toaster.module.scss +32 -0
  46. package/dist/components/ui/toaster/types.d.ts +7 -0
  47. package/dist/components/ui/toaster/types.d.ts.map +1 -0
  48. package/dist/components/ui/toaster/types.js +3 -0
  49. package/dist/components/ui/toaster/types.js.map +1 -0
  50. package/dist/global.scss +3 -0
  51. package/dist/index.d.ts +3 -0
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +3 -0
  54. package/dist/index.js.map +1 -1
  55. package/docs/assets/js/search.js +1 -1
  56. package/docs/assets/js/search.json +1 -1
  57. package/docs/classes/ToasterProvider.html +1090 -0
  58. package/docs/enums/ICON.html +27 -8
  59. package/docs/index.html +29 -4
  60. package/docs/modules/Item.html +16 -3
  61. package/docs/modules/List.html +17 -4
  62. package/docs/modules/Modal.html +160 -0
  63. package/docs/modules/ModalButtons.html +160 -0
  64. package/docs/modules/Section.html +16 -3
  65. package/docs/modules/StickyHeader.html +17 -4
  66. package/docs/modules.html +104 -23
  67. package/docs/pages/Tutorials/Test.html +16 -3
  68. package/esm/components/layout/list/Header.d.ts +5 -1
  69. package/esm/components/layout/list/Header.d.ts.map +1 -1
  70. package/esm/components/layout/list/Header.js +6 -1
  71. package/esm/components/layout/list/Header.js.map +1 -1
  72. package/esm/components/layout/list/Item.d.ts +3 -0
  73. package/esm/components/layout/list/Item.d.ts.map +1 -1
  74. package/esm/components/layout/list/Item.js +20 -6
  75. package/esm/components/layout/list/Item.js.map +1 -1
  76. package/esm/components/layout/list/Item.module.scss +16 -1
  77. package/esm/components/layout/list/List.d.ts +6 -1
  78. package/esm/components/layout/list/List.d.ts.map +1 -1
  79. package/esm/components/layout/list/List.js +15 -1
  80. package/esm/components/layout/list/List.js.map +1 -1
  81. package/esm/components/layout/list/List.module.scss +4 -0
  82. package/esm/components/ui/button/Button.d.ts.map +1 -1
  83. package/esm/components/ui/button/Button.js +2 -2
  84. package/esm/components/ui/button/Button.js.map +1 -1
  85. package/esm/components/ui/modal/Modal.d.ts +18 -0
  86. package/esm/components/ui/modal/Modal.d.ts.map +1 -0
  87. package/esm/components/ui/modal/Modal.js +83 -0
  88. package/esm/components/ui/modal/Modal.js.map +1 -0
  89. package/esm/components/ui/modal/Modal.module.scss +92 -0
  90. package/esm/components/ui/modal/ModalButton.d.ts +8 -0
  91. package/esm/components/ui/modal/ModalButton.d.ts.map +1 -0
  92. package/esm/components/ui/modal/ModalButton.js +13 -0
  93. package/esm/components/ui/modal/ModalButton.js.map +1 -0
  94. package/esm/components/ui/modal/ModalButtons.d.ts +10 -0
  95. package/esm/components/ui/modal/ModalButtons.d.ts.map +1 -0
  96. package/esm/components/ui/modal/ModalButtons.js +9 -0
  97. package/esm/components/ui/modal/ModalButtons.js.map +1 -0
  98. package/esm/components/ui/modal/ModalButtons.module.scss +32 -0
  99. package/esm/components/ui/modal/ModalNoMargin.d.ts +6 -0
  100. package/esm/components/ui/modal/ModalNoMargin.d.ts.map +1 -0
  101. package/esm/components/ui/modal/ModalNoMargin.js +16 -0
  102. package/esm/components/ui/modal/ModalNoMargin.js.map +1 -0
  103. package/esm/components/ui/toaster/Notification.d.ts +9 -0
  104. package/esm/components/ui/toaster/Notification.d.ts.map +1 -0
  105. package/esm/components/ui/toaster/Notification.js +14 -0
  106. package/esm/components/ui/toaster/Notification.js.map +1 -0
  107. package/esm/components/ui/toaster/Toaster.d.ts +18 -0
  108. package/esm/components/ui/toaster/Toaster.d.ts.map +1 -0
  109. package/esm/components/ui/toaster/Toaster.js +74 -0
  110. package/esm/components/ui/toaster/Toaster.js.map +1 -0
  111. package/esm/components/ui/toaster/Toaster.module.scss +32 -0
  112. package/esm/components/ui/toaster/types.d.ts +7 -0
  113. package/esm/components/ui/toaster/types.d.ts.map +1 -0
  114. package/esm/components/ui/toaster/types.js +2 -0
  115. package/esm/components/ui/toaster/types.js.map +1 -0
  116. package/esm/global.scss +3 -0
  117. package/esm/index.d.ts +3 -0
  118. package/esm/index.d.ts.map +1 -1
  119. package/esm/index.js +3 -0
  120. package/esm/index.js.map +1 -1
  121. package/package.json +2 -2
  122. package/src/components/layout/list/Header.tsx +15 -2
  123. package/src/components/layout/list/Item.module.scss +16 -1
  124. package/src/components/layout/list/Item.tsx +28 -7
  125. package/src/components/layout/list/List.module.scss +4 -0
  126. package/src/components/layout/list/List.tsx +29 -2
  127. package/src/components/ui/button/Button.tsx +4 -2
  128. package/src/components/ui/modal/Modal.module.scss +92 -0
  129. package/src/components/ui/modal/Modal.tsx +136 -0
  130. package/src/components/ui/modal/ModalButton.tsx +25 -0
  131. package/src/components/ui/modal/ModalButtons.module.scss +32 -0
  132. package/src/components/ui/modal/ModalButtons.tsx +17 -0
  133. package/src/components/ui/modal/ModalNoMargin.tsx +22 -0
  134. package/src/components/ui/toaster/Notification.tsx +31 -0
  135. package/src/components/ui/toaster/Toaster.module.scss +32 -0
  136. package/src/components/ui/toaster/Toaster.tsx +101 -0
  137. package/src/components/ui/toaster/types.ts +9 -0
  138. package/src/demo/Demo.tsx +7 -4
  139. package/src/demo/Menu.module.scss +1 -0
  140. package/src/demo/components/layout/list/Inset.tsx +24 -0
  141. package/src/demo/components/layout/list/Selection.tsx +17 -0
  142. package/src/demo/components/ui/modal/Modal.tsx +110 -0
  143. package/src/demo/components/ui/toaster/Toaster.tsx +28 -0
  144. package/src/demo/componentsMap.ts +31 -0
  145. package/src/global.scss +3 -0
  146. package/src/index.ts +3 -0
@@ -0,0 +1,32 @@
1
+ .container {
2
+ display: flex;
3
+ margin-top: calc(100px / var(--ratio-dimensions));
4
+ margin-left: -20px;
5
+ margin-right: -20px;
6
+ margin-bottom: -20px;
7
+ }
8
+
9
+ .button {
10
+ border: none;
11
+ border-top: 1px solid var(--modal-button-border);
12
+ background: var(--modal-button-bg);
13
+ flex: 1;
14
+ height: calc(156px / var(--ratio-dimensions));
15
+ font-weight: 500;
16
+
17
+ &:not(:first-child) {
18
+ border-left: 1px solid var(--modal-button-border);
19
+ }
20
+
21
+ &:first-child {
22
+ border-bottom-left-radius: calc(12px / var(--ratio-dimensions));
23
+ }
24
+
25
+ &:last-child {
26
+ border-bottom-right-radius: calc(12px / var(--ratio-dimensions));
27
+ }
28
+ }
29
+
30
+ .buttonMain {
31
+ color: var(--main-color);
32
+ }
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { ModalButton } from "./ModalButton";
3
+
4
+ import styles from "./ModalButtons.module.scss";
5
+
6
+ interface Props {}
7
+
8
+ interface SubComponents {
9
+ Button: typeof ModalButton;
10
+ }
11
+
12
+ const ModalButtons: React.FC<Props> & SubComponents = (props) => {
13
+ return <div className={styles.container}>{props.children}</div>;
14
+ };
15
+ ModalButtons.Button = ModalButton;
16
+
17
+ export { ModalButtons };
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+
3
+ import styles from "./Modal.module.scss";
4
+ import { List } from "../../layout/list/List";
5
+
6
+ interface Props {}
7
+
8
+ const ModalNegateMargin: React.FC<Props> = (props) => {
9
+ const chld = React.Children.map(props.children, (child, index) => {
10
+ if (child && typeof child === "object" && "type" in child && child.type === List) {
11
+ return React.cloneElement(child, {
12
+ // @TODO this will overwrite className
13
+ className: styles.removeMargin,
14
+ });
15
+ }
16
+
17
+ return child;
18
+ });
19
+ return <div className={styles.negateMargin}>{chld}</div>;
20
+ };
21
+
22
+ export { ModalNegateMargin };
@@ -0,0 +1,31 @@
1
+ import React, { useCallback } from "react";
2
+ import classnames from "classnames";
3
+
4
+ import type { Toast } from "./types";
5
+ import styles from "./Toaster.module.scss";
6
+
7
+ interface Props {
8
+ toast: Toast;
9
+ onRemove: (id: Toast["id"]) => void;
10
+ }
11
+
12
+ // eslint-disable-next-line @typescript-eslint/no-shadow
13
+ const Notification: React.FC<Props> = (props) => {
14
+ const handleRemove = useCallback(() => {
15
+ props.onRemove(props.toast.id);
16
+ }, [props.toast.id]);
17
+
18
+ return (
19
+ <div
20
+ className={classnames(styles.toast, {
21
+ [styles.hide]: props.toast.hide,
22
+ })}
23
+ key={props.toast.id}
24
+ onTransitionEnd={handleRemove}
25
+ >
26
+ <span>{props.toast.text}</span>
27
+ </div>
28
+ );
29
+ };
30
+
31
+ export { Notification };
@@ -0,0 +1,32 @@
1
+ @keyframes show {
2
+ from {
3
+ transform: translateY(calc(100% + calc(190px / var(--ratio-dimensions))))
4
+ }
5
+ }
6
+
7
+ .toast {
8
+ position: fixed;
9
+ bottom: 0;
10
+ left: 40px;
11
+ right: 40px;
12
+ display: flex;
13
+ justify-content: center;
14
+ z-index: 1;
15
+
16
+ span {
17
+ background: rgba(56, 50, 46, 0.85);
18
+ color: #F9F6F2;
19
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.37);
20
+ border-radius: 12px; // around 22 @TODO use calc here
21
+ display: inline-block;
22
+ padding: 1em 1em;
23
+ animation: show 500ms 1;
24
+ animation-fill-mode: forwards;
25
+ margin-bottom: calc(190px / var(--ratio-dimensions));
26
+ }
27
+ }
28
+
29
+ .hide {
30
+ transition: opacity 300ms;
31
+ opacity: 0;
32
+ }
@@ -0,0 +1,101 @@
1
+ import React, { createContext, useContext } from "react";
2
+
3
+ import type { Toast } from "./types";
4
+ // eslint-disable-next-line @typescript-eslint/no-shadow
5
+ import { Notification } from "./Notification";
6
+
7
+ type ToasterFn = (text: string) => void;
8
+
9
+ const ToasterContext = createContext<ToasterFn>(() => {
10
+ throw new Error("Toaster Provider missing in the tree");
11
+ });
12
+
13
+ const prefix = `${Date.now()}_`;
14
+ let counter = 0;
15
+
16
+ interface Props {}
17
+ interface State {
18
+ list: Toast[];
19
+ }
20
+
21
+ const DEFAULT_TIMEOUT = 5000;
22
+
23
+ class ToasterProvider extends React.Component<Props, State> {
24
+ public constructor(props: Props, context: unknown) {
25
+ super(props, context);
26
+
27
+ this.state = {
28
+ list: [],
29
+ };
30
+ }
31
+
32
+ private readonly _add = (text: string) => {
33
+ this._removeAllToasts();
34
+
35
+ const id = prefix + String(counter++);
36
+ const hide = false;
37
+
38
+ this.setState(prev => ({
39
+ ...prev,
40
+ list: [...prev.list, {
41
+ id,
42
+ text,
43
+ hide,
44
+ }],
45
+ }));
46
+
47
+ setTimeout(() => {
48
+ this.setState(prev => ({
49
+ ...prev,
50
+ list: prev.list.map(p => {
51
+ if (p.id !== id) {
52
+ return p;
53
+ }
54
+ return {
55
+ ...p,
56
+ hide: true,
57
+ };
58
+ }),
59
+ }));
60
+ }, DEFAULT_TIMEOUT);
61
+ };
62
+
63
+ private readonly _handleRemove = (id: Toast["id"]) => {
64
+ this.setState(prev => ({
65
+ ...prev,
66
+ list: prev.list.filter(p => p.id !== id),
67
+ }));
68
+ };
69
+
70
+ private readonly _removeAllToasts = () => {
71
+ this.setState(prev => ({
72
+ ...prev,
73
+ list: prev.list.map(p => {
74
+ if (p.hide) {
75
+ return p;
76
+ }
77
+ return {
78
+ ...p,
79
+ hide: true,
80
+ };
81
+ }),
82
+ }));
83
+ };
84
+
85
+ public render() {
86
+ const notifications = this.state.list.map((t) => {
87
+ return <Notification onRemove={this._handleRemove} key={t.id} toast={t} />;
88
+ });
89
+
90
+ return (
91
+ <ToasterContext.Provider value={this._add}>
92
+ {notifications}
93
+ {this.props.children}
94
+ </ToasterContext.Provider>
95
+ );
96
+ }
97
+ }
98
+
99
+ const useToaster = () => useContext(ToasterContext);
100
+
101
+ export { ToasterProvider, useToaster };
@@ -0,0 +1,9 @@
1
+ interface Toast {
2
+ id: string;
3
+ text: string;
4
+ hide: boolean;
5
+ }
6
+
7
+ export type {
8
+ Toast,
9
+ };
package/src/demo/Demo.tsx CHANGED
@@ -4,13 +4,16 @@ import styles from "./Demo.module.scss";
4
4
  import { Menu } from "./Menu";
5
5
  import { Main } from "./Main";
6
6
  import { componentsMap } from "./componentsMap";
7
+ import { ToasterProvider } from "../components/ui/toaster/Toaster";
7
8
 
8
9
  const Demo: React.FC = (props) => {
9
10
  return (
10
- <div className={styles.container}>
11
- <Menu list={componentsMap} />
12
- <Main />
13
- </div>
11
+ <ToasterProvider>
12
+ <div className={styles.container}>
13
+ <Menu list={componentsMap} />
14
+ <Main />
15
+ </div>
16
+ </ToasterProvider>
14
17
  );
15
18
  };
16
19
 
@@ -2,6 +2,7 @@
2
2
  margin: 0;
3
3
  padding: 0;
4
4
  border-right: 1px solid black;
5
+ overflow: auto;
5
6
 
6
7
  ul {
7
8
  margin: 0 0 0 15px;
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { List } from "../../../../components/layout/list/List";
3
+ import { Item } from "../../../../components/layout/list/Item";
4
+ import { Header } from "../../../../components/layout/list/Header";
5
+
6
+ const ListInsetDemo = () => {
7
+ return (
8
+ <List variant={"inset"}>
9
+ <Header>Section name</Header>
10
+ <Item>Item</Item>
11
+ <Item>Another item</Item>
12
+ <Item>One more</Item>
13
+ <Header>Status section</Header>
14
+ <Item>Item</Item>
15
+ <Item>One more</Item>
16
+ <Header>Selection</Header>
17
+ <Item>Item</Item>
18
+ <Item>Another item</Item>
19
+ <Item>One more</Item>
20
+ </List>
21
+ );
22
+ };
23
+
24
+ export { ListInsetDemo };
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { List } from "../../../../components/layout/list/List";
3
+ import { Item } from "../../../../components/layout/list/Item";
4
+ import { Header } from "../../../../components/layout/list/Header";
5
+
6
+ const ListSelectionDemo = () => {
7
+ return (
8
+ <List>
9
+ <Header>Select your favourite meal</Header>
10
+ <Item selected={false}>Stick</Item>
11
+ <Item selected={true}>Stone</Item>
12
+ <Item selected={false}>Bone</Item>
13
+ </List>
14
+ );
15
+ };
16
+
17
+ export { ListSelectionDemo };
@@ -0,0 +1,110 @@
1
+ import React, { useCallback, useState } from "react";
2
+ import { Modal } from "../../../../components/ui/modal/Modal";
3
+ import { Button } from "../../../../components/ui/button/Button";
4
+ import { Input } from "../../../../components/form/Input";
5
+ import { Checkbox } from "../../../../components/form/Checkbox";
6
+ import { Label } from "../../../../components/form/Label";
7
+ import { ModalButtons } from "../../../../components/ui/modal/ModalButtons";
8
+ import { List } from "../../../../components/layout/list/List";
9
+ import { Item } from "../../../../components/layout/list/Item";
10
+
11
+ interface Props {}
12
+
13
+ const handleNoop = () => undefined;
14
+
15
+ const ModalDemo: React.FC<Props> = (props) => {
16
+ // eslint-disable-next-line @typescript-eslint/no-shadow
17
+ const [open, setIsOpen] = useState(false);
18
+
19
+ const handleClose = useCallback(() => {
20
+ setIsOpen(false);
21
+ }, []);
22
+
23
+ const handleOpen = useCallback(() => {
24
+ setIsOpen(true);
25
+ }, []);
26
+
27
+ return (
28
+ <div>
29
+ <Button onClick={handleOpen}>Open modal</Button>
30
+ <Modal onClose={handleClose} isOpen={open} title={"95.5 MHz"} variant={["bottom", "full"]}>
31
+ <Label>
32
+ <Input placeholder={"New station"} />
33
+ </Label>
34
+ <Label>
35
+ <Checkbox name={""} onChange={handleNoop} checked={true}>
36
+ Remember me
37
+ </Checkbox>
38
+ </Label>
39
+ <ModalButtons>
40
+ <ModalButtons.Button onClick={handleClose}>
41
+ Cancel
42
+ </ModalButtons.Button>
43
+ <ModalButtons.Button variant={"main"} onClick={handleClose}>
44
+ Ok
45
+ </ModalButtons.Button>
46
+ </ModalButtons>
47
+ </Modal>
48
+ </div>
49
+ );
50
+ };
51
+
52
+ const ModalCenteredDemo: React.FC<Props> = (props) => {
53
+ // eslint-disable-next-line @typescript-eslint/no-shadow
54
+ const [open, setIsOpen] = useState(false);
55
+
56
+ const handleClose = useCallback(() => {
57
+ setIsOpen(false);
58
+ }, []);
59
+
60
+ const handleOpen = useCallback(() => {
61
+ setIsOpen(true);
62
+ }, []);
63
+
64
+ return (
65
+ <div>
66
+ <Button onClick={handleOpen}>Open modal</Button>
67
+ <Modal onClose={handleClose} isOpen={open} title={"Format C:?"}>
68
+ <ModalButtons>
69
+ <ModalButtons.Button onClick={handleClose}>
70
+ Nope
71
+ </ModalButtons.Button>
72
+ <ModalButtons.Button variant={"main"} onClick={handleClose}>
73
+ Yes, please
74
+ </ModalButtons.Button>
75
+ </ModalButtons>
76
+ </Modal>
77
+ </div>
78
+ );
79
+ };
80
+
81
+ const ModalOptionsDemo: React.FC<Props> = (props) => {
82
+ // eslint-disable-next-line @typescript-eslint/no-shadow
83
+ const [open, setIsOpen] = useState(false);
84
+
85
+ const handleClose = useCallback(() => {
86
+ setIsOpen(false);
87
+ }, []);
88
+
89
+ const handleOpen = useCallback(() => {
90
+ setIsOpen(true);
91
+ }, []);
92
+
93
+ return (
94
+ <div>
95
+ <Button onClick={handleOpen}>Open modal</Button>
96
+ <Modal onClose={handleClose} isOpen={open} title={"Format C:?"}>
97
+ <Modal.NegateMargin>
98
+ <List variant={"inset"}>
99
+ <Item selected={false} onClick={handleClose}>First item</Item>
100
+ <Item selected={true} onClick={handleClose}>Second item</Item>
101
+ <Item selected={false} onClick={handleClose}>Third item</Item>
102
+ <Item selected={false} onClick={handleClose}>Last option</Item>
103
+ </List>
104
+ </Modal.NegateMargin>
105
+ </Modal>
106
+ </div>
107
+ );
108
+ };
109
+
110
+ export { ModalDemo, ModalCenteredDemo, ModalOptionsDemo };
@@ -0,0 +1,28 @@
1
+ import React, { useCallback, useState } from "react";
2
+ import { useToaster } from "../../../../components/ui/toaster/Toaster";
3
+ import { Button } from "../../../../components/ui/button/Button";
4
+ import { Input } from "../../../../components/form/Input";
5
+
6
+ interface Props {}
7
+
8
+ const ToasterDemo: React.FC<Props> = (props) => {
9
+ const toast = useToaster();
10
+ const [text, setText] = useState("");
11
+
12
+ const handleToast = useCallback(() => {
13
+ toast(text || "Lorem ipsum dolor sit amet");
14
+ }, [text]);
15
+
16
+ const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
17
+ setText(e.target.value);
18
+ }, []);
19
+
20
+ return (
21
+ <div>
22
+ <Input onChange={handleChange} value={text} placeholder={"Fill in text to display"} />
23
+ <Button onClick={handleToast}>Show toast</Button>
24
+ </div>
25
+ );
26
+ };
27
+
28
+ export { ToasterDemo };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-lines */
1
2
  import type { AnyComponent } from "../types";
2
3
  import { CheckboxDemo } from "./components/form/Checkbox";
3
4
  import {
@@ -33,6 +34,10 @@ import { InputDemo } from "./components/form/Input";
33
34
  import { FormDemo } from "./components/form/Form";
34
35
  import { SearchDemo } from "./components/form/Search";
35
36
  import { LabelDemo } from "./components/form/Label";
37
+ import { ToasterDemo } from "./components/ui/toaster/Toaster";
38
+ import { ModalCenteredDemo, ModalDemo, ModalOptionsDemo } from "./components/ui/modal/Modal";
39
+ import { ListInsetDemo } from "./components/layout/list/Inset";
40
+ import { ListSelectionDemo } from "./components/layout/list/Selection";
36
41
 
37
42
  interface TheMap {
38
43
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
@@ -160,6 +165,14 @@ const componentsMap: TheMap = {
160
165
  name: "Header",
161
166
  Component: ListHeaderDemo,
162
167
  },
168
+ Inset: {
169
+ name: "Inset",
170
+ Component: ListInsetDemo,
171
+ },
172
+ Selection: {
173
+ name: "Selection",
174
+ Component: ListSelectionDemo,
175
+ },
163
176
  Label: {
164
177
  name: "Label",
165
178
  Component: ItemLabelDemo,
@@ -186,6 +199,24 @@ const componentsMap: TheMap = {
186
199
  name: "Icons",
187
200
  Component: IconsDemo,
188
201
  },
202
+ Toaster: {
203
+ name: "Toaster",
204
+ Component: ToasterDemo,
205
+ },
206
+ Modal: {
207
+ name: "Modal",
208
+ Component: ModalDemo,
209
+ children: {
210
+ Centered: {
211
+ name: "Centered & smaller",
212
+ Component: ModalCenteredDemo,
213
+ },
214
+ WithOptions: {
215
+ name: "With options to pick",
216
+ Component: ModalOptionsDemo,
217
+ },
218
+ },
219
+ },
189
220
  };
190
221
 
191
222
  export {
package/src/global.scss CHANGED
@@ -28,6 +28,9 @@
28
28
 
29
29
  --toolbar-border: #ababab;
30
30
  --toolbar-bg: #f8f8f8;
31
+ --modal-bg: #f7f7f7;
32
+ --modal-button-bg: #f8f8f8;
33
+ --modal-button-border: #c2c2c2;
31
34
 
32
35
  // Shades: https://maketintsandshades.com/#038bf4,ff7200,7357e8,3ec234,3ec234,ff388f,ea2700
33
36
  --blue1: #038bf4;
package/src/index.ts CHANGED
@@ -19,3 +19,6 @@ export * from "./components/ui/action/Action.js";
19
19
  export * from "./components/ui/action/EqualActions.js";
20
20
  export * from "./components/ui/button/Button.js";
21
21
  export * from "./components/ui/directionPad/Pad.js";
22
+ export * from "./components/ui/modal/Modal.js";
23
+ export * from "./components/ui/modal/ModalButtons.js";
24
+ export * from "./components/ui/toaster/Toaster.js";