react-miui 0.0.1 → 0.3.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.
- package/CHANGELOG.md +46 -0
- package/README.md +10 -1
- package/assets/back.svg +1 -0
- package/dist/components/form/Checkbox.module.scss +13 -6
- package/dist/components/form/Toggle.d.ts +8 -0
- package/dist/components/form/Toggle.d.ts.map +1 -0
- package/dist/components/form/Toggle.js +40 -0
- package/dist/components/form/Toggle.js.map +1 -0
- package/dist/components/form/Toggle.module.scss +46 -0
- package/dist/components/icons/Back.d.ts +7 -0
- package/dist/components/icons/Back.d.ts.map +1 -0
- package/dist/components/icons/Back.js +13 -0
- package/dist/components/icons/Back.js.map +1 -0
- package/dist/components/icons/Checkmark.d.ts.map +1 -1
- package/dist/components/icons/Checkmark.js.map +1 -1
- package/dist/components/icons/Icon.d.ts +12 -0
- package/dist/components/icons/Icon.d.ts.map +1 -0
- package/dist/components/icons/Icon.js +40 -0
- package/dist/components/icons/Icon.js.map +1 -0
- package/dist/components/layout/header/Header.d.ts +13 -0
- package/dist/components/layout/header/Header.d.ts.map +1 -0
- package/dist/components/layout/header/Header.js +43 -0
- package/dist/components/layout/header/Header.js.map +1 -0
- package/dist/components/layout/header/Header.module.scss +89 -0
- package/dist/components/layout/header/HeaderIconAction.d.ts +17 -0
- package/dist/components/layout/header/HeaderIconAction.d.ts.map +1 -0
- package/dist/components/layout/header/HeaderIconAction.js +40 -0
- package/dist/components/layout/header/HeaderIconAction.js.map +1 -0
- package/dist/components/layout/header/HeaderIconAction.module.scss +22 -0
- package/dist/components/layout/header/StickyHeader.d.ts +10 -0
- package/dist/components/layout/header/StickyHeader.d.ts.map +1 -0
- package/dist/components/layout/header/StickyHeader.js +34 -0
- package/dist/components/layout/header/StickyHeader.js.map +1 -0
- package/dist/components/layout/header/StickyHeader.module.scss +18 -0
- package/dist/components/layout/list/Item.d.ts +14 -0
- package/dist/components/layout/list/Item.d.ts.map +1 -0
- package/dist/components/layout/list/Item.js +50 -0
- package/dist/components/layout/list/Item.js.map +1 -0
- package/dist/components/layout/list/Item.module.scss +23 -0
- package/dist/components/layout/list/List.d.ts +4 -0
- package/dist/components/layout/list/List.d.ts.map +1 -0
- package/dist/components/layout/list/List.js +13 -0
- package/dist/components/layout/list/List.js.map +1 -0
- package/dist/components/layout/list/List.module.scss +4 -0
- package/dist/components/ui/action/Action.d.ts +17 -0
- package/dist/components/ui/action/Action.d.ts.map +1 -0
- package/dist/components/ui/action/Action.js +44 -0
- package/dist/components/ui/action/Action.js.map +1 -0
- package/dist/components/ui/action/Action.module.scss +26 -0
- package/dist/components/ui/action/EqualActions.d.ts +7 -0
- package/dist/components/ui/action/EqualActions.d.ts.map +1 -0
- package/dist/components/ui/action/EqualActions.js +23 -0
- package/dist/components/ui/action/EqualActions.js.map +1 -0
- package/dist/components/ui/action/EqualActions.module.scss +6 -0
- package/dist/components/ui/button/Button.d.ts +8 -0
- package/dist/components/ui/button/Button.d.ts.map +1 -0
- package/dist/components/ui/button/Button.js +20 -0
- package/dist/components/ui/button/Button.js.map +1 -0
- package/dist/components/ui/button/Button.module.scss +25 -0
- package/dist/components/ui/directionPad/Button.d.ts +7 -0
- package/dist/components/ui/directionPad/Button.d.ts.map +1 -0
- package/dist/components/ui/directionPad/Button.js +14 -0
- package/dist/components/ui/directionPad/Button.js.map +1 -0
- package/dist/components/ui/directionPad/Middle.d.ts +8 -0
- package/dist/components/ui/directionPad/Middle.d.ts.map +1 -0
- package/dist/components/ui/directionPad/Middle.js +13 -0
- package/dist/components/ui/directionPad/Middle.js.map +1 -0
- package/dist/components/ui/directionPad/Pad.d.ts +12 -0
- package/dist/components/ui/directionPad/Pad.d.ts.map +1 -0
- package/dist/components/ui/directionPad/Pad.js +23 -0
- package/dist/components/ui/directionPad/Pad.js.map +1 -0
- package/dist/components/ui/directionPad/Pad.module.scss +45 -0
- package/dist/demo/Demo.d.ts.map +1 -1
- package/dist/demo/Demo.js +2 -1
- package/dist/demo/Demo.js.map +1 -1
- package/dist/demo/Main.d.ts.map +1 -1
- package/dist/demo/Main.js +36 -8
- package/dist/demo/Main.js.map +1 -1
- package/dist/demo/Main.module.scss +13 -0
- package/dist/demo/Menu.d.ts +6 -1
- package/dist/demo/Menu.d.ts.map +1 -1
- package/dist/demo/Menu.js +20 -4
- package/dist/demo/Menu.js.map +1 -1
- package/dist/demo/Menu.module.scss +30 -8
- package/dist/demo/components/form/Checkbox.d.ts.map +1 -1
- package/dist/demo/components/form/Checkbox.js +3 -2
- package/dist/demo/components/form/Checkbox.js.map +1 -1
- package/dist/demo/components/form/Toggle.d.ts +4 -0
- package/dist/demo/components/form/Toggle.d.ts.map +1 -0
- package/dist/demo/components/form/Toggle.js +65 -0
- package/dist/demo/components/form/Toggle.js.map +1 -0
- package/dist/demo/components/form/Toggle.module.scss +5 -0
- package/dist/demo/components/layout/header/Header.d.ts +8 -0
- package/dist/demo/components/layout/header/Header.d.ts.map +1 -0
- package/dist/demo/components/layout/header/Header.js +60 -0
- package/dist/demo/components/layout/header/Header.js.map +1 -0
- package/dist/demo/components/layout/header/StickyHeader.d.ts +9 -0
- package/dist/demo/components/layout/header/StickyHeader.d.ts.map +1 -0
- package/dist/demo/components/layout/header/StickyHeader.js +73 -0
- package/dist/demo/components/layout/header/StickyHeader.js.map +1 -0
- package/dist/demo/components/layout/list/List.Item.d.ts +4 -0
- package/dist/demo/components/layout/list/List.Item.d.ts.map +1 -0
- package/dist/demo/components/layout/list/List.Item.js +42 -0
- package/dist/demo/components/layout/list/List.Item.js.map +1 -0
- package/dist/demo/components/layout/list/List.Item.module.scss +3 -0
- package/dist/demo/components/ui/action/Action.d.ts +8 -0
- package/dist/demo/components/ui/action/Action.d.ts.map +1 -0
- package/dist/demo/components/ui/action/Action.js +83 -0
- package/dist/demo/components/ui/action/Action.js.map +1 -0
- package/dist/demo/components/ui/action/ActionDemo.module.scss +3 -0
- package/dist/demo/components/ui/button/ButtonDemo.d.ts +4 -0
- package/dist/demo/components/ui/button/ButtonDemo.d.ts.map +1 -0
- package/dist/demo/components/ui/button/ButtonDemo.js +20 -0
- package/dist/demo/components/ui/button/ButtonDemo.js.map +1 -0
- package/dist/demo/components/ui/directionPad/Pad.d.ts +4 -0
- package/dist/demo/components/ui/directionPad/Pad.d.ts.map +1 -0
- package/dist/demo/components/ui/directionPad/Pad.js +49 -0
- package/dist/demo/components/ui/directionPad/Pad.js.map +1 -0
- package/dist/demo/components/ui/icons/Icons.d.ts +4 -0
- package/dist/demo/components/ui/icons/Icons.d.ts.map +1 -0
- package/dist/demo/components/ui/icons/Icons.js +20 -0
- package/dist/demo/components/ui/icons/Icons.js.map +1 -0
- package/dist/demo/components/ui/icons/Icons.module.scss +4 -0
- package/dist/demo/componentsMap.d.ts +13 -0
- package/dist/demo/componentsMap.d.ts.map +1 -0
- package/dist/demo/componentsMap.js +112 -0
- package/dist/demo/componentsMap.js.map +1 -0
- package/dist/demo/utils/makeVariants.d.ts +3 -0
- package/dist/demo/utils/makeVariants.d.ts.map +1 -0
- package/dist/demo/utils/makeVariants.js +14 -0
- package/dist/demo/utils/makeVariants.js.map +1 -0
- package/dist/global.scss +34 -13
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/pages/_app.d.ts.map +1 -1
- package/dist/pages/_app.js +5 -1
- package/dist/pages/_app.js.map +1 -1
- package/dist/pages/react-miui.d.ts +4 -0
- package/dist/pages/react-miui.d.ts.map +1 -0
- package/dist/pages/react-miui.js +11 -0
- package/dist/pages/react-miui.js.map +1 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/docs/assets/js/search.js +1 -1
- package/docs/assets/js/search.json +1 -1
- package/docs/enums/ICON.html +182 -0
- package/docs/index.html +38 -5
- package/docs/modules/StickyHeader.html +159 -0
- package/docs/modules.html +121 -5
- package/docs/pages/Tutorials/Test.html +6 -3
- package/esm/components/form/Checkbox.module.scss +13 -6
- package/esm/components/form/Toggle.d.ts +8 -0
- package/esm/components/form/Toggle.d.ts.map +1 -0
- package/esm/components/form/Toggle.js +15 -0
- package/esm/components/form/Toggle.js.map +1 -0
- package/esm/components/form/Toggle.module.scss +46 -0
- package/esm/components/icons/Back.d.ts +7 -0
- package/esm/components/icons/Back.d.ts.map +1 -0
- package/esm/components/icons/Back.js +7 -0
- package/esm/components/icons/Back.js.map +1 -0
- package/esm/components/icons/Checkmark.d.ts.map +1 -1
- package/esm/components/icons/Checkmark.js.map +1 -1
- package/esm/components/icons/Icon.d.ts +12 -0
- package/esm/components/icons/Icon.d.ts.map +1 -0
- package/esm/components/icons/Icon.js +21 -0
- package/esm/components/icons/Icon.js.map +1 -0
- package/esm/components/layout/header/Header.d.ts +13 -0
- package/esm/components/layout/header/Header.d.ts.map +1 -0
- package/esm/components/layout/header/Header.js +37 -0
- package/esm/components/layout/header/Header.js.map +1 -0
- package/esm/components/layout/header/Header.module.scss +89 -0
- package/esm/components/layout/header/HeaderIconAction.d.ts +17 -0
- package/esm/components/layout/header/HeaderIconAction.d.ts.map +1 -0
- package/esm/components/layout/header/HeaderIconAction.js +23 -0
- package/esm/components/layout/header/HeaderIconAction.js.map +1 -0
- package/esm/components/layout/header/HeaderIconAction.module.scss +22 -0
- package/esm/components/layout/header/StickyHeader.d.ts +10 -0
- package/esm/components/layout/header/StickyHeader.d.ts.map +1 -0
- package/esm/components/layout/header/StickyHeader.js +28 -0
- package/esm/components/layout/header/StickyHeader.js.map +1 -0
- package/esm/components/layout/header/StickyHeader.module.scss +18 -0
- package/esm/components/layout/list/Item.d.ts +14 -0
- package/esm/components/layout/list/Item.d.ts.map +1 -0
- package/esm/components/layout/list/Item.js +33 -0
- package/esm/components/layout/list/Item.js.map +1 -0
- package/esm/components/layout/list/Item.module.scss +23 -0
- package/esm/components/layout/list/List.d.ts +4 -0
- package/esm/components/layout/list/List.d.ts.map +1 -0
- package/esm/components/layout/list/List.js +7 -0
- package/esm/components/layout/list/List.js.map +1 -0
- package/esm/components/layout/list/List.module.scss +4 -0
- package/esm/components/ui/action/Action.d.ts +17 -0
- package/esm/components/ui/action/Action.d.ts.map +1 -0
- package/esm/components/ui/action/Action.js +27 -0
- package/esm/components/ui/action/Action.js.map +1 -0
- package/esm/components/ui/action/Action.module.scss +26 -0
- package/esm/components/ui/action/EqualActions.d.ts +7 -0
- package/esm/components/ui/action/EqualActions.d.ts.map +1 -0
- package/esm/components/ui/action/EqualActions.js +17 -0
- package/esm/components/ui/action/EqualActions.js.map +1 -0
- package/esm/components/ui/action/EqualActions.module.scss +6 -0
- package/esm/components/ui/button/Button.d.ts +8 -0
- package/esm/components/ui/button/Button.d.ts.map +1 -0
- package/esm/components/ui/button/Button.js +14 -0
- package/esm/components/ui/button/Button.js.map +1 -0
- package/esm/components/ui/button/Button.module.scss +25 -0
- package/esm/components/ui/directionPad/Button.d.ts +7 -0
- package/esm/components/ui/directionPad/Button.d.ts.map +1 -0
- package/esm/components/ui/directionPad/Button.js +8 -0
- package/esm/components/ui/directionPad/Button.js.map +1 -0
- package/esm/components/ui/directionPad/Middle.d.ts +8 -0
- package/esm/components/ui/directionPad/Middle.d.ts.map +1 -0
- package/esm/components/ui/directionPad/Middle.js +7 -0
- package/esm/components/ui/directionPad/Middle.js.map +1 -0
- package/esm/components/ui/directionPad/Pad.d.ts +12 -0
- package/esm/components/ui/directionPad/Pad.d.ts.map +1 -0
- package/esm/components/ui/directionPad/Pad.js +17 -0
- package/esm/components/ui/directionPad/Pad.js.map +1 -0
- package/esm/components/ui/directionPad/Pad.module.scss +45 -0
- package/esm/demo/Demo.d.ts.map +1 -1
- package/esm/demo/Demo.js +2 -1
- package/esm/demo/Demo.js.map +1 -1
- package/esm/demo/Main.d.ts.map +1 -1
- package/esm/demo/Main.js +37 -9
- package/esm/demo/Main.js.map +1 -1
- package/esm/demo/Main.module.scss +13 -0
- package/esm/demo/Menu.d.ts +6 -1
- package/esm/demo/Menu.d.ts.map +1 -1
- package/esm/demo/Menu.js +20 -4
- package/esm/demo/Menu.js.map +1 -1
- package/esm/demo/Menu.module.scss +30 -8
- package/esm/demo/components/form/Checkbox.d.ts.map +1 -1
- package/esm/demo/components/form/Checkbox.js +4 -3
- package/esm/demo/components/form/Checkbox.js.map +1 -1
- package/esm/demo/components/form/Toggle.d.ts +4 -0
- package/esm/demo/components/form/Toggle.d.ts.map +1 -0
- package/esm/demo/components/form/Toggle.js +40 -0
- package/esm/demo/components/form/Toggle.js.map +1 -0
- package/esm/demo/components/form/Toggle.module.scss +5 -0
- package/esm/demo/components/layout/header/Header.d.ts +8 -0
- package/esm/demo/components/layout/header/Header.d.ts.map +1 -0
- package/esm/demo/components/layout/header/Header.js +50 -0
- package/esm/demo/components/layout/header/Header.js.map +1 -0
- package/esm/demo/components/layout/header/StickyHeader.d.ts +9 -0
- package/esm/demo/components/layout/header/StickyHeader.d.ts.map +1 -0
- package/esm/demo/components/layout/header/StickyHeader.js +62 -0
- package/esm/demo/components/layout/header/StickyHeader.js.map +1 -0
- package/esm/demo/components/layout/list/List.Item.d.ts +4 -0
- package/esm/demo/components/layout/list/List.Item.d.ts.map +1 -0
- package/esm/demo/components/layout/list/List.Item.js +17 -0
- package/esm/demo/components/layout/list/List.Item.js.map +1 -0
- package/esm/demo/components/layout/list/List.Item.module.scss +3 -0
- package/esm/demo/components/ui/action/Action.d.ts +8 -0
- package/esm/demo/components/ui/action/Action.d.ts.map +1 -0
- package/esm/demo/components/ui/action/Action.js +73 -0
- package/esm/demo/components/ui/action/Action.js.map +1 -0
- package/esm/demo/components/ui/action/ActionDemo.module.scss +3 -0
- package/esm/demo/components/ui/button/ButtonDemo.d.ts +4 -0
- package/esm/demo/components/ui/button/ButtonDemo.d.ts.map +1 -0
- package/esm/demo/components/ui/button/ButtonDemo.js +14 -0
- package/esm/demo/components/ui/button/ButtonDemo.js.map +1 -0
- package/esm/demo/components/ui/directionPad/Pad.d.ts +4 -0
- package/esm/demo/components/ui/directionPad/Pad.d.ts.map +1 -0
- package/esm/demo/components/ui/directionPad/Pad.js +27 -0
- package/esm/demo/components/ui/directionPad/Pad.js.map +1 -0
- package/esm/demo/components/ui/icons/Icons.d.ts +4 -0
- package/esm/demo/components/ui/icons/Icons.d.ts.map +1 -0
- package/esm/demo/components/ui/icons/Icons.js +14 -0
- package/esm/demo/components/ui/icons/Icons.js.map +1 -0
- package/esm/demo/components/ui/icons/Icons.module.scss +4 -0
- package/esm/demo/componentsMap.d.ts +13 -0
- package/esm/demo/componentsMap.d.ts.map +1 -0
- package/esm/demo/componentsMap.js +109 -0
- package/esm/demo/componentsMap.js.map +1 -0
- package/esm/demo/utils/makeVariants.d.ts +3 -0
- package/esm/demo/utils/makeVariants.d.ts.map +1 -0
- package/esm/demo/utils/makeVariants.js +11 -0
- package/esm/demo/utils/makeVariants.js.map +1 -0
- package/esm/global.scss +34 -13
- package/esm/index.d.ts +8 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +8 -1
- package/esm/index.js.map +1 -1
- package/esm/pages/_app.d.ts.map +1 -1
- package/esm/pages/_app.js +5 -1
- package/esm/pages/_app.js.map +1 -1
- package/esm/pages/react-miui.d.ts +4 -0
- package/esm/pages/react-miui.d.ts.map +1 -0
- package/esm/pages/react-miui.js +6 -0
- package/esm/pages/react-miui.js.map +1 -0
- package/esm/types.d.ts +4 -0
- package/esm/types.d.ts.map +1 -0
- package/esm/types.js +2 -0
- package/esm/types.js.map +1 -0
- package/package.json +9 -7
- package/src/components/form/Checkbox.module.scss +13 -6
- package/src/components/form/Toggle.module.scss +46 -0
- package/src/components/form/Toggle.tsx +33 -0
- package/src/components/icons/Back.tsx +15 -0
- package/src/components/icons/Checkmark.tsx +5 -2
- package/src/components/icons/Icon.tsx +30 -0
- package/src/components/layout/header/Header.module.scss +89 -0
- package/src/components/layout/header/Header.tsx +65 -0
- package/src/components/layout/header/HeaderIconAction.module.scss +22 -0
- package/src/components/layout/header/HeaderIconAction.tsx +49 -0
- package/src/components/layout/header/StickyHeader.module.scss +18 -0
- package/src/components/layout/header/StickyHeader.tsx +54 -0
- package/src/components/layout/list/Item.module.scss +23 -0
- package/src/components/layout/list/Item.tsx +50 -0
- package/src/components/layout/list/List.module.scss +4 -0
- package/src/components/layout/list/List.tsx +11 -0
- package/src/components/ui/action/Action.module.scss +26 -0
- package/src/components/ui/action/Action.tsx +58 -0
- package/src/components/ui/action/EqualActions.module.scss +6 -0
- package/src/components/ui/action/EqualActions.tsx +30 -0
- package/src/components/ui/button/Button.module.scss +25 -0
- package/src/components/ui/button/Button.tsx +25 -0
- package/src/components/ui/directionPad/Button.tsx +15 -0
- package/src/components/ui/directionPad/Middle.tsx +16 -0
- package/src/components/ui/directionPad/Pad.module.scss +45 -0
- package/src/components/ui/directionPad/Pad.tsx +35 -0
- package/src/demo/Demo.tsx +2 -1
- package/src/demo/Main.module.scss +13 -0
- package/src/demo/Main.tsx +53 -10
- package/src/demo/Menu.module.scss +30 -8
- package/src/demo/Menu.tsx +33 -7
- package/src/demo/components/form/Checkbox.tsx +7 -3
- package/src/demo/components/form/Toggle.module.scss +5 -0
- package/src/demo/components/form/Toggle.tsx +59 -0
- package/src/demo/components/layout/header/Header.tsx +119 -0
- package/src/demo/components/layout/header/StickyHeader.tsx +85 -0
- package/src/demo/components/layout/list/List.Item.module.scss +3 -0
- package/src/demo/components/layout/list/List.Item.tsx +23 -0
- package/src/demo/components/ui/action/Action.tsx +112 -0
- package/src/demo/components/ui/action/ActionDemo.module.scss +3 -0
- package/src/demo/components/ui/button/ButtonDemo.tsx +18 -0
- package/src/demo/components/ui/directionPad/Pad.tsx +40 -0
- package/src/demo/components/ui/icons/Icons.module.scss +4 -0
- package/src/demo/components/ui/icons/Icons.tsx +25 -0
- package/src/demo/componentsMap.ts +144 -0
- package/src/demo/utils/makeVariants.ts +13 -0
- package/src/global.scss +34 -13
- package/src/index.ts +11 -1
- package/src/pages/_app.tsx +7 -1
- package/src/pages/react-miui.tsx +12 -0
- package/src/types.ts +7 -0
- package/.postcssrc +0 -9
- package/src/pages/index.html +0 -14
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { Checkbox } from "../../../index.js";
|
|
3
4
|
|
|
4
5
|
const CheckboxDemo: React.FC = (props) => {
|
|
5
6
|
const [v, setV] = useState(false);
|
|
7
|
+
|
|
8
|
+
const handleToggle = useCallback(() => { setV((prevV) => !prevV); }, []);
|
|
9
|
+
|
|
6
10
|
return (
|
|
7
|
-
<Checkbox name={"a"} onChange={
|
|
11
|
+
<Checkbox name={"a"} onChange={handleToggle} checked={v}>I want something something</Checkbox>
|
|
8
12
|
);
|
|
9
13
|
};
|
|
10
14
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { Toggle } from "../../../components/form/Toggle";
|
|
3
|
+
import { List } from "../../../components/layout/list/List";
|
|
4
|
+
import { Item } from "../../../components/layout/list/Item";
|
|
5
|
+
|
|
6
|
+
import styles from "./Toggle.module.scss";
|
|
7
|
+
|
|
8
|
+
const handleNoop = () => undefined;
|
|
9
|
+
|
|
10
|
+
const ToggleDemo: React.VFC = () => {
|
|
11
|
+
const [state, ss] = useState<boolean | null>(null);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
15
|
+
setTimeout(() => { ss(true); }, 1000);
|
|
16
|
+
}, []);
|
|
17
|
+
|
|
18
|
+
const handleToggle = useCallback(() => {
|
|
19
|
+
if (state == null) {
|
|
20
|
+
return; // shouldn't happen, but ...
|
|
21
|
+
}
|
|
22
|
+
ss(null);
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
ss(!state);
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
26
|
+
}, 1000);
|
|
27
|
+
}, [state]);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<List>
|
|
31
|
+
<Item>
|
|
32
|
+
<div className={styles.row}>
|
|
33
|
+
<span>Off</span>
|
|
34
|
+
<Toggle onChange={handleNoop} state={false} />
|
|
35
|
+
</div>
|
|
36
|
+
</Item>
|
|
37
|
+
<Item>
|
|
38
|
+
<div className={styles.row}>
|
|
39
|
+
<span>On</span>
|
|
40
|
+
<Toggle onChange={handleNoop} state={true} />
|
|
41
|
+
</div>
|
|
42
|
+
</Item>
|
|
43
|
+
<Item>
|
|
44
|
+
<div className={styles.row}>
|
|
45
|
+
<span>Undetermined</span>
|
|
46
|
+
<Toggle onChange={handleNoop} state={null} />
|
|
47
|
+
</div>
|
|
48
|
+
</Item>
|
|
49
|
+
<Item>
|
|
50
|
+
<div className={styles.row}>
|
|
51
|
+
<span>Dynamic</span>
|
|
52
|
+
<Toggle onChange={handleToggle} state={state} />
|
|
53
|
+
</div>
|
|
54
|
+
</Item>
|
|
55
|
+
</List>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { ToggleDemo };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
|
|
4
|
+
import { Header, ICON, StickyHeader } from "../../../../index.js";
|
|
5
|
+
import { HeaderIconAction } from "../../../../components/layout/header/HeaderIconAction";
|
|
6
|
+
|
|
7
|
+
const HeaderDemo = () => {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers,react/no-array-index-key
|
|
9
|
+
const longContent = new Array(1000).fill(null).map((_, key) => <div key={key}>content</div>);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<Header>Some place</Header>
|
|
14
|
+
{longContent}
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const CenteredHeaderDemo = () => {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<Header center={true}>Messages</Header>
|
|
23
|
+
<div>
|
|
24
|
+
Header text is centered
|
|
25
|
+
</div>
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const ToolbarVariantDemo = () => {
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Header center={true} variant={"toolbar"}>Toolbar version</Header>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const handleClick = () => { alert(1); };
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line max-lines-per-function
|
|
41
|
+
const HeaderWithButtonsDemo = () => {
|
|
42
|
+
const demo = (
|
|
43
|
+
<>
|
|
44
|
+
<HeaderIconAction icon={ICON.back} onClick={handleClick} />
|
|
45
|
+
<HeaderIconAction icon={ICON.checkmark} onClick={handleClick} />
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
<Header center={true} before={"A text"}>Messages</Header>
|
|
52
|
+
<div>
|
|
53
|
+
Header text is centered
|
|
54
|
+
</div>
|
|
55
|
+
<Header before={"A text"}>Messages</Header>
|
|
56
|
+
<div>
|
|
57
|
+
Header text is start aligned
|
|
58
|
+
</div>
|
|
59
|
+
<Header before={demo}>Messages</Header>
|
|
60
|
+
<div>
|
|
61
|
+
Some button icons are added on the left to left aligned title
|
|
62
|
+
</div>
|
|
63
|
+
<Header before={demo} center={true}>Messages</Header>
|
|
64
|
+
<div>
|
|
65
|
+
Some button icons are added on the left to centered aligned title
|
|
66
|
+
</div>
|
|
67
|
+
<Header
|
|
68
|
+
before={<HeaderIconAction icon={ICON.back} to={"/react-miui"} Link={Link} />}
|
|
69
|
+
center={true}
|
|
70
|
+
>Messages
|
|
71
|
+
</Header>
|
|
72
|
+
<div>
|
|
73
|
+
Some internal link icons are added on the left to centered aligned title
|
|
74
|
+
</div>
|
|
75
|
+
<Header
|
|
76
|
+
before={<HeaderIconAction icon={ICON.back} href={"https://www.npmjs.com/package/react-miui"} />}
|
|
77
|
+
center={true}
|
|
78
|
+
>Messages
|
|
79
|
+
</Header>
|
|
80
|
+
<div>
|
|
81
|
+
Some external link icons are added on the left to centered aligned title
|
|
82
|
+
</div>
|
|
83
|
+
<Header
|
|
84
|
+
before={<HeaderIconAction icon={ICON.back} href={"https://www.npmjs.com/package/react-miui"} />}
|
|
85
|
+
after={<HeaderIconAction icon={ICON.checkmark} href={"https://www.npmjs.com/package/react-miui"} />}
|
|
86
|
+
center={true}
|
|
87
|
+
>Messages
|
|
88
|
+
</Header>
|
|
89
|
+
<div>
|
|
90
|
+
Some external link icons are added on both sides to centered aligned title
|
|
91
|
+
</div>
|
|
92
|
+
</>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const HeaderWithButtonsOnSideDemo = () => {
|
|
97
|
+
const demo = (
|
|
98
|
+
<>
|
|
99
|
+
<HeaderIconAction icon={ICON.back} onClick={handleClick} />
|
|
100
|
+
<HeaderIconAction icon={ICON.checkmark} onClick={handleClick} />
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<StickyHeader position={"left"}>
|
|
106
|
+
<Header
|
|
107
|
+
center={true}
|
|
108
|
+
before={demo}
|
|
109
|
+
after={demo}
|
|
110
|
+
>M
|
|
111
|
+
</Header>
|
|
112
|
+
<StickyHeader.Content>
|
|
113
|
+
Header is on the side
|
|
114
|
+
</StickyHeader.Content>
|
|
115
|
+
</StickyHeader>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export { HeaderDemo, CenteredHeaderDemo, ToolbarVariantDemo, HeaderWithButtonsDemo, HeaderWithButtonsOnSideDemo };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { Header, StickyHeader } from "../../../../index.js";
|
|
4
|
+
|
|
5
|
+
const LongContent: React.FC = () => {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers,react/no-array-index-key
|
|
7
|
+
const longContent = new Array(1000).fill(null).map((_, key) => <div key={key}>content</div>);
|
|
8
|
+
return <>{longContent}</>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const StickyHeaderDemo = () => {
|
|
12
|
+
return (
|
|
13
|
+
<StickyHeader>
|
|
14
|
+
<Header>Some place</Header>
|
|
15
|
+
<StickyHeader.Content>
|
|
16
|
+
<LongContent />
|
|
17
|
+
</StickyHeader.Content>
|
|
18
|
+
</StickyHeader>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const StickyHeaderBottomDemo = () => {
|
|
23
|
+
return (
|
|
24
|
+
<StickyHeader position={"bottom"}>
|
|
25
|
+
<Header>Some place</Header>
|
|
26
|
+
<StickyHeader.Content>
|
|
27
|
+
<LongContent />
|
|
28
|
+
</StickyHeader.Content>
|
|
29
|
+
</StickyHeader>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const StickyHeaderTopBottomDemo = () => {
|
|
34
|
+
return (
|
|
35
|
+
<StickyHeader position={"top"}>
|
|
36
|
+
<Header>Some place</Header>
|
|
37
|
+
<StickyHeader.Content>
|
|
38
|
+
<StickyHeader position={"bottom"}>
|
|
39
|
+
<Header>Some place</Header>
|
|
40
|
+
<StickyHeader.Content>
|
|
41
|
+
<LongContent />
|
|
42
|
+
</StickyHeader.Content>
|
|
43
|
+
</StickyHeader>
|
|
44
|
+
</StickyHeader.Content>
|
|
45
|
+
</StickyHeader>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const StickyHeaderLeftDemo = () => {
|
|
50
|
+
return (
|
|
51
|
+
<StickyHeader position={"left"}>
|
|
52
|
+
<Header>x<br />x<br />x</Header>
|
|
53
|
+
<StickyHeader.Content>
|
|
54
|
+
<LongContent />
|
|
55
|
+
</StickyHeader.Content>
|
|
56
|
+
</StickyHeader>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const StickyHeaderRightDemo = () => {
|
|
61
|
+
return (
|
|
62
|
+
<StickyHeader position={"right"}>
|
|
63
|
+
<Header>x<br />x<br />x</Header>
|
|
64
|
+
<StickyHeader.Content>
|
|
65
|
+
<LongContent />
|
|
66
|
+
</StickyHeader.Content>
|
|
67
|
+
</StickyHeader>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const StickyHeaderLeftCenterDemo = () => {
|
|
72
|
+
return (
|
|
73
|
+
<StickyHeader position={"left"}>
|
|
74
|
+
<Header center={true}>x<br />x<br />x</Header>
|
|
75
|
+
<StickyHeader.Content>
|
|
76
|
+
<LongContent />
|
|
77
|
+
</StickyHeader.Content>
|
|
78
|
+
</StickyHeader>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
StickyHeaderDemo, StickyHeaderBottomDemo, StickyHeaderTopBottomDemo, StickyHeaderLeftDemo, StickyHeaderRightDemo,
|
|
84
|
+
StickyHeaderLeftCenterDemo,
|
|
85
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
|
|
4
|
+
import { Item, List } from "../../../../index.js";
|
|
5
|
+
import styles from "./List.Item.module.scss";
|
|
6
|
+
|
|
7
|
+
const ListItemDemo = () => {
|
|
8
|
+
const handleClick = useCallback(() => { window.alert("Clicked"); }, []);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<List>
|
|
12
|
+
<Item>I am an item</Item>
|
|
13
|
+
<Item>I am an item</Item>
|
|
14
|
+
<Item href={"https://www.npmjs.com/package/react-miui"}>I am clickable item</Item>
|
|
15
|
+
<Item to={"/react-miui"} Link={Link}>I am local link item</Item>
|
|
16
|
+
<Item onClick={handleClick}>Click me to see my action</Item>
|
|
17
|
+
<Item className={styles.custom}>I'm a custom item</Item>
|
|
18
|
+
<Item>I am an item</Item>
|
|
19
|
+
</List>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { ListItemDemo };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { Action } from "../../../../components/ui/action/Action";
|
|
4
|
+
import { ICON } from "../../../../components/icons/Icon";
|
|
5
|
+
import { StickyHeader } from "../../../../components/layout/header/StickyHeader";
|
|
6
|
+
import { Header } from "../../../../components/layout/header/Header";
|
|
7
|
+
|
|
8
|
+
import styles from "./ActionDemo.module.scss";
|
|
9
|
+
import { EqualActions } from "../../../../components/ui/action/EqualActions";
|
|
10
|
+
|
|
11
|
+
const handleClick = () => { alert(1); };
|
|
12
|
+
|
|
13
|
+
const ActionDemo: React.FC = () => {
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<div>
|
|
17
|
+
<Action icon={ICON.checkmark} /> - action without action
|
|
18
|
+
</div>
|
|
19
|
+
<div>
|
|
20
|
+
<Action icon={ICON.checkmark} Link={Link} to={"react-miui"} /> - internal link action
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
<Action icon={ICON.checkmark} href={"https://www.npmjs.com/package/react-miui"} /> - external link action
|
|
24
|
+
</div>
|
|
25
|
+
<div>
|
|
26
|
+
<Action icon={ICON.checkmark} onClick={handleClick} /> - onClick action
|
|
27
|
+
</div>
|
|
28
|
+
<div>
|
|
29
|
+
<Action icon={ICON.checkmark} onClick={handleClick} label={"Pineapple"} /> - onClick action with label
|
|
30
|
+
</div>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const ActionsOnLeft = () => {
|
|
36
|
+
return (
|
|
37
|
+
<StickyHeader position={"left"}>
|
|
38
|
+
<Header center={true} className={styles.header}>
|
|
39
|
+
<Action icon={ICON.checkmark} />
|
|
40
|
+
<Action icon={ICON.checkmark} />
|
|
41
|
+
<Action icon={ICON.checkmark} />
|
|
42
|
+
</Header>
|
|
43
|
+
<StickyHeader.Content>
|
|
44
|
+
content
|
|
45
|
+
</StickyHeader.Content>
|
|
46
|
+
</StickyHeader>
|
|
47
|
+
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const ActionsOnBottom = () => {
|
|
52
|
+
return (
|
|
53
|
+
<StickyHeader position={"bottom"}>
|
|
54
|
+
<Header center={true} className={styles.header}>
|
|
55
|
+
<Action icon={ICON.checkmark} />
|
|
56
|
+
<Action icon={ICON.checkmark} />
|
|
57
|
+
<Action icon={ICON.checkmark} />
|
|
58
|
+
</Header>
|
|
59
|
+
<StickyHeader.Content>
|
|
60
|
+
content
|
|
61
|
+
</StickyHeader.Content>
|
|
62
|
+
</StickyHeader>
|
|
63
|
+
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const ActionLabelsOnBottom = () => {
|
|
68
|
+
return (
|
|
69
|
+
<StickyHeader position={"bottom"}>
|
|
70
|
+
<Header center={true} className={styles.header}>
|
|
71
|
+
<Action icon={ICON.checkmark} label={"Add"} />
|
|
72
|
+
<Action icon={ICON.checkmark} label={"Delete"} />
|
|
73
|
+
<Action icon={ICON.checkmark} label={"Share on Web"} />
|
|
74
|
+
</Header>
|
|
75
|
+
<StickyHeader.Content>
|
|
76
|
+
<StickyHeader position={"top"}>
|
|
77
|
+
<Header center={true} className={styles.header}>
|
|
78
|
+
<Action icon={ICON.checkmark} label={"Add"} />
|
|
79
|
+
<Action icon={ICON.checkmark} label={"Delete"} />
|
|
80
|
+
<Action icon={ICON.checkmark} label={"Share"} />
|
|
81
|
+
</Header>
|
|
82
|
+
<StickyHeader.Content>
|
|
83
|
+
When you put just `Action`s into Header it will be automatically wrapped with EqualActions so if
|
|
84
|
+
labels width are not equal each action will take the same space as the most wide item.
|
|
85
|
+
If you don't like this behavior - wrap your actions into React.Fragment {"<></>"} or pass extra
|
|
86
|
+
{"<span />"}.
|
|
87
|
+
</StickyHeader.Content>
|
|
88
|
+
</StickyHeader>
|
|
89
|
+
</StickyHeader.Content>
|
|
90
|
+
</StickyHeader>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const ActionsDemo = () => {
|
|
95
|
+
return (
|
|
96
|
+
<div>
|
|
97
|
+
To make every action take the same amount of horizontal space you need to wrap every Action with
|
|
98
|
+
EqualActions wrapper. Some components (like Header) will do that automatically for you. If you need to use
|
|
99
|
+
Actions outside of such components - manually wrap them with EqualActions.
|
|
100
|
+
|
|
101
|
+
<div>
|
|
102
|
+
<EqualActions>
|
|
103
|
+
<Action icon={ICON.checkmark} label={"Add"} />
|
|
104
|
+
<Action icon={ICON.checkmark} label={"Delete"} />
|
|
105
|
+
<Action icon={ICON.checkmark} label={"Share on Web"} />
|
|
106
|
+
</EqualActions>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export { ActionDemo, ActionsOnLeft, ActionsOnBottom, ActionLabelsOnBottom, ActionsDemo };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
const ButtonDemo = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div>
|
|
7
|
+
<Button>Basic button</Button>
|
|
8
|
+
<br />
|
|
9
|
+
<Button disabled={true}>Disabled button</Button>
|
|
10
|
+
<br />
|
|
11
|
+
<Button variant={"inline"}>Inline button</Button>
|
|
12
|
+
<br />
|
|
13
|
+
<Button variant={"outline"}>Outline button</Button>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { ButtonDemo };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
|
+
import { DirectionPad } from "../../../..";
|
|
3
|
+
|
|
4
|
+
const DirectionPadDemo: React.FC = (props) => {
|
|
5
|
+
const [lastClick, setLastClick] = useState("<none>");
|
|
6
|
+
|
|
7
|
+
const handleLeftClick = useCallback(() => {
|
|
8
|
+
setLastClick("left");
|
|
9
|
+
}, []);
|
|
10
|
+
const handleRightClick = useCallback(() => {
|
|
11
|
+
setLastClick("right");
|
|
12
|
+
}, []);
|
|
13
|
+
const handleUpClick = useCallback(() => {
|
|
14
|
+
setLastClick("up");
|
|
15
|
+
}, []);
|
|
16
|
+
const handleDownClick = useCallback(() => {
|
|
17
|
+
setLastClick("down");
|
|
18
|
+
}, []);
|
|
19
|
+
const handleMiddleClick = useCallback(() => {
|
|
20
|
+
setLastClick("res");
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<DirectionPad
|
|
26
|
+
onLeftPress={handleLeftClick}
|
|
27
|
+
onRightPress={handleRightClick}
|
|
28
|
+
onUpPress={handleUpClick}
|
|
29
|
+
onDownPress={handleDownClick}
|
|
30
|
+
onMiddlePress={handleMiddleClick}
|
|
31
|
+
middleLabel={"RES"}
|
|
32
|
+
/>
|
|
33
|
+
<div>
|
|
34
|
+
Last clicked button: {lastClick}
|
|
35
|
+
</div>
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { DirectionPadDemo };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Icon, ICON, Item, List } from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
import styles from "./Icons.module.scss";
|
|
5
|
+
|
|
6
|
+
const IconsDemo: React.FC = () => {
|
|
7
|
+
const icons = Object.values(ICON).map((value) => {
|
|
8
|
+
return (
|
|
9
|
+
<Item key={value}>
|
|
10
|
+
<div className={styles.row}>
|
|
11
|
+
{value}
|
|
12
|
+
<Icon name={value} />
|
|
13
|
+
</div>
|
|
14
|
+
</Item>
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<List>
|
|
20
|
+
{icons}
|
|
21
|
+
</List>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { IconsDemo };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { AnyComponent } from "../types";
|
|
2
|
+
import { CheckboxDemo } from "./components/form/Checkbox";
|
|
3
|
+
import {
|
|
4
|
+
CenteredHeaderDemo,
|
|
5
|
+
HeaderDemo,
|
|
6
|
+
HeaderWithButtonsDemo,
|
|
7
|
+
HeaderWithButtonsOnSideDemo, ToolbarVariantDemo,
|
|
8
|
+
} from "./components/layout/header/Header";
|
|
9
|
+
import {
|
|
10
|
+
StickyHeaderBottomDemo,
|
|
11
|
+
StickyHeaderDemo, StickyHeaderLeftCenterDemo, StickyHeaderLeftDemo, StickyHeaderRightDemo,
|
|
12
|
+
StickyHeaderTopBottomDemo,
|
|
13
|
+
} from "./components/layout/header/StickyHeader";
|
|
14
|
+
import { ListItemDemo } from "./components/layout/list/List.Item";
|
|
15
|
+
import { DirectionPadDemo } from "./components/ui/directionPad/Pad";
|
|
16
|
+
import { IconsDemo } from "./components/ui/icons/Icons";
|
|
17
|
+
import { ButtonDemo } from "./components/ui/button/ButtonDemo";
|
|
18
|
+
import {
|
|
19
|
+
ActionDemo,
|
|
20
|
+
ActionLabelsOnBottom,
|
|
21
|
+
ActionsDemo,
|
|
22
|
+
ActionsOnBottom,
|
|
23
|
+
ActionsOnLeft,
|
|
24
|
+
} from "./components/ui/action/Action";
|
|
25
|
+
import { ToggleDemo } from "./components/form/Toggle";
|
|
26
|
+
|
|
27
|
+
interface TheMap {
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
29
|
+
[key: string]: TheMapItem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface TheMapItem {
|
|
33
|
+
name: string;
|
|
34
|
+
Component: AnyComponent;
|
|
35
|
+
children?: TheMap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const componentsMap: TheMap = {
|
|
39
|
+
Button: {
|
|
40
|
+
name: "Button",
|
|
41
|
+
Component: ButtonDemo,
|
|
42
|
+
},
|
|
43
|
+
Checkbox: {
|
|
44
|
+
name: "Checkbox",
|
|
45
|
+
Component: CheckboxDemo,
|
|
46
|
+
},
|
|
47
|
+
Toggle: {
|
|
48
|
+
name: "Toggle",
|
|
49
|
+
Component: ToggleDemo,
|
|
50
|
+
},
|
|
51
|
+
Header: {
|
|
52
|
+
name: "Header",
|
|
53
|
+
Component: HeaderDemo,
|
|
54
|
+
children: {
|
|
55
|
+
Centered: {
|
|
56
|
+
name: "Centered",
|
|
57
|
+
Component: CenteredHeaderDemo,
|
|
58
|
+
},
|
|
59
|
+
Toolbar: {
|
|
60
|
+
name: "Toolbar",
|
|
61
|
+
Component: ToolbarVariantDemo,
|
|
62
|
+
},
|
|
63
|
+
WithButtons: {
|
|
64
|
+
name: "With buttons",
|
|
65
|
+
Component: HeaderWithButtonsDemo,
|
|
66
|
+
children: {
|
|
67
|
+
OnLeft: {
|
|
68
|
+
name: "On the side",
|
|
69
|
+
Component: HeaderWithButtonsOnSideDemo,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
Sticky: {
|
|
74
|
+
name: "Sticky",
|
|
75
|
+
Component: StickyHeaderDemo,
|
|
76
|
+
children: {
|
|
77
|
+
StickyBottom: {
|
|
78
|
+
name: "On bottom",
|
|
79
|
+
Component: StickyHeaderBottomDemo,
|
|
80
|
+
},
|
|
81
|
+
StickyTopBottom: {
|
|
82
|
+
name: "On top & bottom",
|
|
83
|
+
Component: StickyHeaderTopBottomDemo,
|
|
84
|
+
},
|
|
85
|
+
StickyLeft: {
|
|
86
|
+
name: "On left",
|
|
87
|
+
Component: StickyHeaderLeftDemo,
|
|
88
|
+
},
|
|
89
|
+
StickyRight: {
|
|
90
|
+
name: "On right",
|
|
91
|
+
Component: StickyHeaderRightDemo,
|
|
92
|
+
},
|
|
93
|
+
StickyLeftCentered: {
|
|
94
|
+
name: "On left centered",
|
|
95
|
+
Component: StickyHeaderLeftCenterDemo,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
Action: {
|
|
102
|
+
name: "Action",
|
|
103
|
+
Component: ActionDemo,
|
|
104
|
+
children: {
|
|
105
|
+
ActionOnBottom: {
|
|
106
|
+
name: "Actions on header",
|
|
107
|
+
Component: ActionsOnBottom,
|
|
108
|
+
},
|
|
109
|
+
ActionLabelsOnBottom: {
|
|
110
|
+
name: "Actions with labels on header",
|
|
111
|
+
Component: ActionLabelsOnBottom,
|
|
112
|
+
},
|
|
113
|
+
ActionOnLeft: {
|
|
114
|
+
name: "Actions on left header",
|
|
115
|
+
Component: ActionsOnLeft,
|
|
116
|
+
},
|
|
117
|
+
EqualActions: {
|
|
118
|
+
name: "EqualActions (wrapper)",
|
|
119
|
+
Component: ActionsDemo,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
ListItem: {
|
|
124
|
+
name: "List & Item",
|
|
125
|
+
Component: ListItemDemo,
|
|
126
|
+
},
|
|
127
|
+
Pad: {
|
|
128
|
+
name: "Direction pad",
|
|
129
|
+
Component: DirectionPadDemo,
|
|
130
|
+
},
|
|
131
|
+
Icons: {
|
|
132
|
+
name: "Icons",
|
|
133
|
+
Component: IconsDemo,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
componentsMap,
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export type {
|
|
142
|
+
TheMap,
|
|
143
|
+
TheMapItem,
|
|
144
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const makeVariants = <T extends string>(variants: T | T[] | undefined): T[] => {
|
|
2
|
+
if (!variants) {
|
|
3
|
+
return [];
|
|
4
|
+
}
|
|
5
|
+
if (typeof variants === "string") {
|
|
6
|
+
return variants.split(" ").filter(Boolean) as T[];
|
|
7
|
+
}
|
|
8
|
+
return variants;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
makeVariants,
|
|
13
|
+
};
|