react-miui 0.11.0 → 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 (130) hide show
  1. package/CHANGELOG.md +12 -2
  2. package/assets/dots.svg +1 -0
  3. package/assets/sources/dots.fla +0 -0
  4. package/dist/components/icons/Dots.d.ts +7 -0
  5. package/dist/components/icons/Dots.d.ts.map +1 -0
  6. package/dist/components/icons/Dots.js +13 -0
  7. package/dist/components/icons/Dots.js.map +1 -0
  8. package/dist/components/icons/Icon.d.ts +2 -1
  9. package/dist/components/icons/Icon.d.ts.map +1 -1
  10. package/dist/components/icons/Icon.js +3 -0
  11. package/dist/components/icons/Icon.js.map +1 -1
  12. package/dist/components/layout/header/Header.d.ts +1 -1
  13. package/dist/components/layout/header/Header.d.ts.map +1 -1
  14. package/dist/components/layout/header/Header.js +1 -0
  15. package/dist/components/layout/header/Header.js.map +1 -1
  16. package/dist/components/layout/header/Header.module.scss +6 -0
  17. package/dist/components/layout/header/HeaderIconAction.module.scss +2 -1
  18. package/dist/components/layout/header/StickyHeader.d.ts +4 -1
  19. package/dist/components/layout/header/StickyHeader.d.ts.map +1 -1
  20. package/dist/components/layout/header/StickyHeader.js +1 -1
  21. package/dist/components/layout/header/StickyHeader.js.map +1 -1
  22. package/dist/components/ui/drawer/Drawer.d.ts +22 -0
  23. package/dist/components/ui/drawer/Drawer.d.ts.map +1 -0
  24. package/dist/components/ui/drawer/Drawer.js +84 -0
  25. package/dist/components/ui/drawer/Drawer.js.map +1 -0
  26. package/dist/components/ui/drawer/Drawer.module.scss +15 -0
  27. package/dist/components/ui/pop/Pop.d.ts +1 -0
  28. package/dist/components/ui/pop/Pop.d.ts.map +1 -1
  29. package/dist/components/ui/pop/Pop.js +5 -2
  30. package/dist/components/ui/pop/Pop.js.map +1 -1
  31. package/dist/components/ui/stats/Stats.d.ts +12 -0
  32. package/dist/components/ui/stats/Stats.d.ts.map +1 -0
  33. package/dist/components/ui/stats/Stats.js +24 -0
  34. package/dist/components/ui/stats/Stats.js.map +1 -0
  35. package/dist/components/ui/stats/Stats.module.scss +48 -0
  36. package/dist/components/{ui/pop → utils}/HandleEsc.d.ts +0 -0
  37. package/dist/components/utils/HandleEsc.d.ts.map +1 -0
  38. package/dist/components/{ui/pop → utils}/HandleEsc.js +0 -0
  39. package/dist/components/utils/HandleEsc.js.map +1 -0
  40. package/dist/global.scss +3 -0
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +1 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/scrollbars.scss +22 -0
  46. package/docs/assets/js/search.js +1 -1
  47. package/docs/assets/js/search.json +1 -1
  48. package/docs/classes/Drawer.html +1085 -0
  49. package/docs/classes/Pop.html +15 -12
  50. package/docs/classes/ToasterProvider.html +11 -8
  51. package/docs/enums/ICON.html +28 -11
  52. package/docs/index.html +7 -4
  53. package/docs/modules/Item.html +3 -3
  54. package/docs/modules/List.html +3 -3
  55. package/docs/modules/Modal.html +3 -3
  56. package/docs/modules/ModalButtons.html +3 -3
  57. package/docs/modules/Section.html +3 -3
  58. package/docs/modules/StickyHeader.html +6 -11
  59. package/docs/modules.html +32 -28
  60. package/docs/pages/Tutorials/Test.html +3 -3
  61. package/esm/components/icons/Dots.d.ts +7 -0
  62. package/esm/components/icons/Dots.d.ts.map +1 -0
  63. package/esm/components/icons/Dots.js +7 -0
  64. package/esm/components/icons/Dots.js.map +1 -0
  65. package/esm/components/icons/Icon.d.ts +2 -1
  66. package/esm/components/icons/Icon.d.ts.map +1 -1
  67. package/esm/components/icons/Icon.js +3 -0
  68. package/esm/components/icons/Icon.js.map +1 -1
  69. package/esm/components/layout/header/Header.d.ts +1 -1
  70. package/esm/components/layout/header/Header.d.ts.map +1 -1
  71. package/esm/components/layout/header/Header.js +1 -0
  72. package/esm/components/layout/header/Header.js.map +1 -1
  73. package/esm/components/layout/header/Header.module.scss +6 -0
  74. package/esm/components/layout/header/HeaderIconAction.module.scss +2 -1
  75. package/esm/components/layout/header/StickyHeader.d.ts +4 -1
  76. package/esm/components/layout/header/StickyHeader.d.ts.map +1 -1
  77. package/esm/components/layout/header/StickyHeader.js +1 -1
  78. package/esm/components/layout/header/StickyHeader.js.map +1 -1
  79. package/esm/components/ui/drawer/Drawer.d.ts +22 -0
  80. package/esm/components/ui/drawer/Drawer.d.ts.map +1 -0
  81. package/esm/components/ui/drawer/Drawer.js +59 -0
  82. package/esm/components/ui/drawer/Drawer.js.map +1 -0
  83. package/esm/components/ui/drawer/Drawer.module.scss +15 -0
  84. package/esm/components/ui/pop/Pop.d.ts +1 -0
  85. package/esm/components/ui/pop/Pop.d.ts.map +1 -1
  86. package/esm/components/ui/pop/Pop.js +5 -2
  87. package/esm/components/ui/pop/Pop.js.map +1 -1
  88. package/esm/components/ui/stats/Stats.d.ts +12 -0
  89. package/esm/components/ui/stats/Stats.d.ts.map +1 -0
  90. package/esm/components/ui/stats/Stats.js +18 -0
  91. package/esm/components/ui/stats/Stats.js.map +1 -0
  92. package/esm/components/ui/stats/Stats.module.scss +48 -0
  93. package/esm/components/{ui/pop → utils}/HandleEsc.d.ts +0 -0
  94. package/esm/components/utils/HandleEsc.d.ts.map +1 -0
  95. package/esm/components/{ui/pop → utils}/HandleEsc.js +0 -0
  96. package/esm/components/utils/HandleEsc.js.map +1 -0
  97. package/esm/global.scss +3 -0
  98. package/esm/index.d.ts +1 -0
  99. package/esm/index.d.ts.map +1 -1
  100. package/esm/index.js +1 -0
  101. package/esm/index.js.map +1 -1
  102. package/esm/scrollbars.scss +22 -0
  103. package/package.json +3 -2
  104. package/src/components/icons/Dots.tsx +21 -0
  105. package/src/components/icons/Icon.tsx +3 -0
  106. package/src/components/layout/header/Header.module.scss +6 -0
  107. package/src/components/layout/header/Header.tsx +2 -1
  108. package/src/components/layout/header/HeaderIconAction.module.scss +2 -1
  109. package/src/components/layout/header/StickyHeader.tsx +12 -2
  110. package/src/components/ui/drawer/Drawer.module.scss +15 -0
  111. package/src/components/ui/drawer/Drawer.tsx +88 -0
  112. package/src/components/ui/pop/Pop.tsx +6 -2
  113. package/src/components/ui/stats/Stats.module.scss +48 -0
  114. package/src/components/ui/stats/Stats.tsx +42 -0
  115. package/src/components/{ui/pop → utils}/HandleEsc.tsx +0 -0
  116. package/src/demo/Menu.tsx +2 -1
  117. package/src/demo/components/layout/header/StickyHeader.module.scss +14 -0
  118. package/src/demo/components/layout/header/StickyHeader.tsx +28 -2
  119. package/src/demo/components/ui/drawer/Drawer.tsx +28 -0
  120. package/src/demo/components/ui/stats/Stats.module.scss +29 -0
  121. package/src/demo/components/ui/stats/Stats.tsx +61 -0
  122. package/src/demo/componentsMap.ts +21 -0
  123. package/src/global.scss +3 -0
  124. package/src/index.ts +1 -0
  125. package/src/pages/_app.tsx +1 -0
  126. package/src/scrollbars.scss +22 -0
  127. package/dist/components/ui/pop/HandleEsc.d.ts.map +0 -1
  128. package/dist/components/ui/pop/HandleEsc.js.map +0 -1
  129. package/esm/components/ui/pop/HandleEsc.d.ts.map +0 -1
  130. package/esm/components/ui/pop/HandleEsc.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
 
3
- import { Header, StickyHeader } from "../../../../index.js";
3
+ import { Header, HeaderIconAction, ICON, StickyHeader } from "../../../../index.js";
4
+ import styles from "./StickyHeader.module.scss";
4
5
 
5
6
  const LongContent: React.FC = () => {
6
7
  // eslint-disable-next-line @typescript-eslint/no-magic-numbers,react/no-array-index-key
@@ -79,7 +80,32 @@ const StickyHeaderLeftCenterDemo = () => {
79
80
  );
80
81
  };
81
82
 
83
+ const handleNoop = () => null;
84
+
85
+ const StickyColoredBg = () => {
86
+ return (
87
+ <StickyHeader position={"top"}>
88
+ <Header
89
+ center={true}
90
+ variant={"colored"}
91
+ before={<HeaderIconAction icon={ICON.back} onClick={handleNoop} />}
92
+ after={"Text"}
93
+ className={styles.header}
94
+ >
95
+ Some text
96
+ </Header>
97
+ <StickyHeader.Content className={"miui-scrollbars"}>
98
+ <div className={styles.coloredBox}>
99
+ To achieve this effect set <kbd>variant=colored</kbd> & apply these with className:<br />
100
+ <pre>--custom-header-color: green;<br />--custom-text-color: white;</pre>
101
+ </div>
102
+ <LongContent />
103
+ </StickyHeader.Content>
104
+ </StickyHeader>
105
+ );
106
+ };
107
+
82
108
  export {
83
109
  StickyHeaderDemo, StickyHeaderBottomDemo, StickyHeaderTopBottomDemo, StickyHeaderLeftDemo, StickyHeaderRightDemo,
84
- StickyHeaderLeftCenterDemo,
110
+ StickyHeaderLeftCenterDemo, StickyColoredBg,
85
111
  };
@@ -0,0 +1,28 @@
1
+ import React, { useCallback, useState } from "react";
2
+ import { Drawer } from "../../../../components/ui/drawer/Drawer";
3
+
4
+ interface Props {}
5
+
6
+ const DrawerDemo: React.FC<Props> = (props) => {
7
+ // eslint-disable-next-line @typescript-eslint/no-shadow
8
+ const [open, setOpen] = useState(false);
9
+
10
+ const handleToggleOpen = useCallback(() => {
11
+ setOpen(p => !p);
12
+ }, []);
13
+
14
+ const handleClose = useCallback(() => {
15
+ setOpen(false);
16
+ }, []);
17
+
18
+ return (
19
+ <>
20
+ <Drawer isOpen={open} onClose={handleClose}>
21
+ Drawer content
22
+ </Drawer>
23
+ <button onClick={handleToggleOpen}>open drawer</button>
24
+ </>
25
+ );
26
+ };
27
+
28
+ export { DrawerDemo };
@@ -0,0 +1,29 @@
1
+ .coloredBox {
2
+ height: 300px;
3
+ background: var(--green1-darker);
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: flex-end;
7
+ color: white;
8
+ flex-direction: column;
9
+ }
10
+
11
+ .header {
12
+ --custom-header-color: var(--green1-darker);
13
+ --custom-text-color: white;
14
+ }
15
+
16
+ .header2 {
17
+ --custom-header-color: var(--active-bg);
18
+ --custom-text-color: white;
19
+ }
20
+
21
+ .coloredBox2 {
22
+ height: 300px;
23
+ background: var(--active-bg);
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: flex-end;
27
+ color: white;
28
+ flex-direction: column;
29
+ }
@@ -0,0 +1,61 @@
1
+ import React from "react";
2
+ import { Stats } from "../../../../components/ui/stats/Stats";
3
+ import { Header } from "../../../../components/layout/header/Header";
4
+ import { StickyHeader } from "../../../../components/layout/header/StickyHeader";
5
+
6
+ import styles from "./Stats.module.scss";
7
+
8
+ interface Props {}
9
+
10
+ const stats = [
11
+ {
12
+ label: "Temperature",
13
+ value: "32°C",
14
+ },
15
+ {
16
+ label: "Used",
17
+ value: "320.3 mAh",
18
+ },
19
+ {
20
+ label: "Used for",
21
+ value: "14h 32m",
22
+ },
23
+ ];
24
+
25
+ const StatsDemo: React.FC<Props> = (props) => {
26
+ return (
27
+ <StickyHeader position={"top"}>
28
+ <Header
29
+ center={true}
30
+ variant={"colored"}
31
+ className={styles.header}
32
+ >
33
+ Battery
34
+ </Header>
35
+ <StickyHeader.Content className={"miui-scrollbars"}>
36
+ <div className={styles.coloredBox}>
37
+ <Stats stats={stats} />
38
+ </div>
39
+ </StickyHeader.Content>
40
+ </StickyHeader>
41
+ );
42
+ };
43
+
44
+ const StatsDarkDemo = () => (
45
+ <StickyHeader position={"top"}>
46
+ <Header
47
+ center={true}
48
+ variant={"colored"}
49
+ className={styles.header2}
50
+ >
51
+ Battery
52
+ </Header>
53
+ <StickyHeader.Content className={"miui-scrollbars"}>
54
+ <div className={styles.coloredBox2}>
55
+ <Stats stats={stats} variant={"dark"} />
56
+ </div>
57
+ </StickyHeader.Content>
58
+ </StickyHeader>
59
+ );
60
+
61
+ export { StatsDemo, StatsDarkDemo };
@@ -8,6 +8,7 @@ import {
8
8
  HeaderWithButtonsOnSideDemo, ToolbarVariantDemo,
9
9
  } from "./components/layout/header/Header";
10
10
  import {
11
+ StickyColoredBg,
11
12
  StickyHeaderBottomDemo,
12
13
  StickyHeaderDemo, StickyHeaderLeftCenterDemo, StickyHeaderLeftDemo, StickyHeaderRightDemo,
13
14
  StickyHeaderTopBottomDemo,
@@ -42,6 +43,8 @@ import { TabsDemo } from "./components/ui/tabs/Tabs";
42
43
  import { ChoiceDemo } from "./components/form/Choice";
43
44
  import { MessageDemo } from "./components/ui/message/Message";
44
45
  import { PopDemo } from "./components/ui/pop/Pop";
46
+ import { DrawerDemo } from "./components/ui/drawer/Drawer";
47
+ import { StatsDarkDemo, StatsDemo } from "./components/ui/stats/Stats";
45
48
 
46
49
  interface TheMap {
47
50
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
@@ -135,6 +138,10 @@ const componentsMap: TheMap = {
135
138
  name: "On left centered",
136
139
  Component: StickyHeaderLeftCenterDemo,
137
140
  },
141
+ StickyColoredBg: {
142
+ name: "With colored background",
143
+ Component: StickyColoredBg,
144
+ },
138
145
  },
139
146
  },
140
147
  },
@@ -207,6 +214,16 @@ const componentsMap: TheMap = {
207
214
  name: "Direction pad",
208
215
  Component: DirectionPadDemo,
209
216
  },
217
+ Stats: {
218
+ name: "Stats",
219
+ Component: StatsDemo,
220
+ children: {
221
+ DarkOnLight: {
222
+ name: "Dark on light",
223
+ Component: StatsDarkDemo,
224
+ },
225
+ },
226
+ },
210
227
  Icons: {
211
228
  name: "Icons",
212
229
  Component: IconsDemo,
@@ -219,6 +236,10 @@ const componentsMap: TheMap = {
219
236
  name: "Message",
220
237
  Component: MessageDemo,
221
238
  },
239
+ Drawer: {
240
+ name: "Drawer",
241
+ Component: DrawerDemo,
242
+ },
222
243
  Modal: {
223
244
  name: "Modal",
224
245
  Component: ModalDemo,
package/src/global.scss CHANGED
@@ -68,6 +68,9 @@
68
68
  --grey1: #737373;
69
69
 
70
70
  --focus-color: #dcaf00;
71
+
72
+ --scrollbars-thumb: var(--grey1);
73
+ --scrollbars-bg: transparent;
71
74
  }
72
75
 
73
76
  *:focus {
package/src/index.ts CHANGED
@@ -20,6 +20,7 @@ export * from "./components/ui/action/Action.js";
20
20
  export * from "./components/ui/action/EqualActions.js";
21
21
  export * from "./components/ui/button/Button.js";
22
22
  export * from "./components/ui/directionPad/Pad.js";
23
+ export * from "./components/ui/drawer/Drawer.js";
23
24
  export * from "./components/ui/message/Message.js";
24
25
  export * from "./components/ui/modal/Modal.js";
25
26
  export * from "./components/ui/modal/ModalButtons.js";
@@ -4,6 +4,7 @@ import type { AppProps } from "next/app";
4
4
 
5
5
  import "../global.scss";
6
6
  import "../demo-global.scss";
7
+ import "../scrollbars.scss";
7
8
 
8
9
  const MyApp = ({ Component, pageProps }: AppProps) => (
9
10
  <>
@@ -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
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"HandleEsc.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/pop/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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"HandleEsc.js","sourceRoot":"","sources":["../../../../src/components/ui/pop/HandleEsc.tsx"],"names":[],"mappings":";;;AACA,yCAAwC;AACxC,iCAAkC;AAMlC,MAAM,SAAS,GAAoB,CAAC,KAAK,EAAE,EAAE;IACzC,MAAM,CAAC,OAAO,CAAC,GAAG,uBAAW,CAAC,QAAQ,CAAC,CAAC;IAExC,iBAAS,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;AAEO,8BAAS"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"HandleEsc.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/pop/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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"HandleEsc.js","sourceRoot":"","sources":["../../../../src/components/ui/pop/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"}