react-miui 0.5.2 → 0.9.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 +31 -0
- package/assets/sources/battery.fla +0 -0
- package/assets/sources/search.fla +0 -0
- package/dist/components/form/Input.d.ts +9 -0
- package/dist/components/form/Input.d.ts.map +1 -0
- package/dist/components/form/Input.js +62 -0
- package/dist/components/form/Input.js.map +1 -0
- package/dist/components/form/Input.module.scss +48 -0
- package/dist/components/form/Label.d.ts +8 -0
- package/dist/components/form/Label.d.ts.map +1 -0
- package/dist/components/form/Label.js +22 -0
- package/dist/components/form/Label.js.map +1 -0
- package/dist/components/form/Label.module.scss +15 -0
- package/dist/components/form/TextArea.d.ts +7 -0
- package/dist/components/form/TextArea.d.ts.map +1 -0
- package/dist/components/form/TextArea.js +57 -0
- package/dist/components/form/TextArea.js.map +1 -0
- package/dist/components/form/Toggle.d.ts +1 -1
- package/dist/components/form/Toggle.d.ts.map +1 -1
- package/dist/components/form/Toggle.js.map +1 -1
- package/dist/components/form/choice/Choice.d.ts +11 -0
- package/dist/components/form/choice/Choice.d.ts.map +1 -0
- package/dist/components/form/choice/Choice.js +19 -0
- package/dist/components/form/choice/Choice.js.map +1 -0
- package/dist/components/form/choice/Choice.module.scss +43 -0
- package/dist/components/form/choice/ChoiceItem.d.ts +11 -0
- package/dist/components/form/choice/ChoiceItem.d.ts.map +1 -0
- package/dist/components/form/choice/ChoiceItem.js +33 -0
- package/dist/components/form/choice/ChoiceItem.js.map +1 -0
- package/dist/components/icons/Back.d.ts +1 -1
- package/dist/components/icons/Back.d.ts.map +1 -1
- package/dist/components/icons/Back.js.map +1 -1
- package/dist/components/icons/Battery.d.ts +7 -0
- package/dist/components/icons/Battery.d.ts.map +1 -0
- package/dist/components/icons/Battery.js +14 -0
- package/dist/components/icons/Battery.js.map +1 -0
- package/dist/components/icons/Forward.d.ts +1 -1
- package/dist/components/icons/Forward.d.ts.map +1 -1
- package/dist/components/icons/Forward.js.map +1 -1
- package/dist/components/icons/Icon.d.ts +3 -1
- package/dist/components/icons/Icon.d.ts.map +1 -1
- package/dist/components/icons/Icon.js +6 -0
- package/dist/components/icons/Icon.js.map +1 -1
- package/dist/components/icons/Search.d.ts +7 -0
- package/dist/components/icons/Search.d.ts.map +1 -0
- package/dist/components/icons/Search.js +13 -0
- package/dist/components/icons/Search.js.map +1 -0
- package/dist/components/layout/header/HeaderIconAction.d.ts +1 -1
- package/dist/components/layout/header/HeaderIconAction.d.ts.map +1 -1
- package/dist/components/layout/header/HeaderIconAction.js.map +1 -1
- package/dist/components/layout/list/Header.d.ts +5 -1
- package/dist/components/layout/list/Header.d.ts.map +1 -1
- package/dist/components/layout/list/Header.js +6 -1
- package/dist/components/layout/list/Header.js.map +1 -1
- package/dist/components/layout/list/Item.d.ts +3 -0
- package/dist/components/layout/list/Item.d.ts.map +1 -1
- package/dist/components/layout/list/Item.js +20 -6
- package/dist/components/layout/list/Item.js.map +1 -1
- package/dist/components/layout/list/Item.module.scss +16 -1
- package/dist/components/layout/list/List.d.ts +6 -1
- package/dist/components/layout/list/List.d.ts.map +1 -1
- package/dist/components/layout/list/List.js +15 -1
- package/dist/components/layout/list/List.js.map +1 -1
- package/dist/components/layout/list/List.module.scss +4 -0
- package/dist/components/layout/section/SearchContainer.d.ts +4 -0
- package/dist/components/layout/section/SearchContainer.d.ts.map +1 -0
- package/dist/components/layout/section/SearchContainer.js +13 -0
- package/dist/components/layout/section/SearchContainer.js.map +1 -0
- package/dist/components/layout/section/SearchContainer.module.scss +3 -0
- package/dist/components/layout/section/Section.module.scss +7 -0
- package/dist/components/ui/action/Action.d.ts +1 -1
- package/dist/components/ui/action/Action.d.ts.map +1 -1
- package/dist/components/ui/action/Action.js.map +1 -1
- package/dist/components/ui/button/Button.d.ts.map +1 -1
- package/dist/components/ui/button/Button.js +2 -2
- package/dist/components/ui/button/Button.js.map +1 -1
- package/dist/components/ui/modal/Modal.d.ts +18 -0
- package/dist/components/ui/modal/Modal.d.ts.map +1 -0
- package/dist/components/ui/modal/Modal.js +108 -0
- package/dist/components/ui/modal/Modal.js.map +1 -0
- package/dist/components/ui/modal/Modal.module.scss +92 -0
- package/dist/components/ui/modal/ModalButton.d.ts +8 -0
- package/dist/components/ui/modal/ModalButton.d.ts.map +1 -0
- package/dist/components/ui/modal/ModalButton.js +31 -0
- package/dist/components/ui/modal/ModalButton.js.map +1 -0
- package/dist/components/ui/modal/ModalButtons.d.ts +10 -0
- package/dist/components/ui/modal/ModalButtons.d.ts.map +1 -0
- package/dist/components/ui/modal/ModalButtons.js +15 -0
- package/dist/components/ui/modal/ModalButtons.js.map +1 -0
- package/dist/components/ui/modal/ModalButtons.module.scss +32 -0
- package/dist/components/ui/modal/ModalNoMargin.d.ts +6 -0
- package/dist/components/ui/modal/ModalNoMargin.d.ts.map +1 -0
- package/dist/components/ui/modal/ModalNoMargin.js +22 -0
- package/dist/components/ui/modal/ModalNoMargin.js.map +1 -0
- package/dist/components/ui/tabs/Item.d.ts +10 -0
- package/dist/components/ui/tabs/Item.d.ts.map +1 -0
- package/dist/components/ui/tabs/Item.js +39 -0
- package/dist/components/ui/tabs/Item.js.map +1 -0
- package/dist/components/ui/tabs/Item.module.scss +11 -0
- package/dist/components/ui/tabs/Selector.d.ts +10 -0
- package/dist/components/ui/tabs/Selector.d.ts.map +1 -0
- package/dist/components/ui/tabs/Selector.js +46 -0
- package/dist/components/ui/tabs/Selector.js.map +1 -0
- package/dist/components/ui/tabs/Selector.module.scss +6 -0
- package/dist/components/ui/toaster/Notification.d.ts +9 -0
- package/dist/components/ui/toaster/Notification.d.ts.map +1 -0
- package/dist/components/ui/toaster/Notification.js +39 -0
- package/dist/components/ui/toaster/Notification.js.map +1 -0
- package/dist/components/ui/toaster/Toaster.d.ts +18 -0
- package/dist/components/ui/toaster/Toaster.d.ts.map +1 -0
- package/dist/components/ui/toaster/Toaster.js +79 -0
- package/dist/components/ui/toaster/Toaster.js.map +1 -0
- package/dist/components/ui/toaster/Toaster.module.scss +32 -0
- package/dist/components/ui/toaster/types.d.ts +7 -0
- package/dist/components/ui/toaster/types.d.ts.map +1 -0
- package/dist/components/ui/toaster/types.js +3 -0
- package/dist/components/ui/toaster/types.js.map +1 -0
- package/dist/global.scss +13 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/types/form.d.ts +7 -0
- package/dist/types/form.d.ts.map +1 -0
- package/dist/types/form.js +3 -0
- package/dist/types/form.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/toObjectValue.d.ts +4 -0
- package/dist/utils/toObjectValue.d.ts.map +1 -0
- package/dist/utils/toObjectValue.js +8 -0
- package/dist/utils/toObjectValue.js.map +1 -0
- package/docs/assets/js/search.js +1 -1
- package/docs/assets/js/search.json +1 -1
- package/docs/classes/ToasterProvider.html +1096 -0
- package/docs/enums/ICON.html +71 -6
- package/docs/index.html +47 -4
- package/docs/modules/Item.html +16 -3
- package/docs/modules/List.html +17 -4
- package/docs/modules/Modal.html +160 -0
- package/docs/modules/ModalButtons.html +160 -0
- package/docs/modules/Section.html +16 -3
- package/docs/modules/StickyHeader.html +17 -4
- package/docs/modules.html +187 -22
- package/docs/pages/Tutorials/Test.html +16 -3
- package/esm/components/form/Input.d.ts +9 -0
- package/esm/components/form/Input.d.ts.map +1 -0
- package/esm/components/form/Input.js +25 -0
- package/esm/components/form/Input.js.map +1 -0
- package/esm/components/form/Input.module.scss +48 -0
- package/esm/components/form/Label.d.ts +8 -0
- package/esm/components/form/Label.d.ts.map +1 -0
- package/esm/components/form/Label.js +16 -0
- package/esm/components/form/Label.js.map +1 -0
- package/esm/components/form/Label.module.scss +15 -0
- package/esm/components/form/TextArea.d.ts +7 -0
- package/esm/components/form/TextArea.d.ts.map +1 -0
- package/esm/components/form/TextArea.js +20 -0
- package/esm/components/form/TextArea.js.map +1 -0
- package/esm/components/form/Toggle.d.ts +1 -1
- package/esm/components/form/Toggle.d.ts.map +1 -1
- package/esm/components/form/Toggle.js.map +1 -1
- package/esm/components/form/choice/Choice.d.ts +11 -0
- package/esm/components/form/choice/Choice.d.ts.map +1 -0
- package/esm/components/form/choice/Choice.js +13 -0
- package/esm/components/form/choice/Choice.js.map +1 -0
- package/esm/components/form/choice/Choice.module.scss +43 -0
- package/esm/components/form/choice/ChoiceItem.d.ts +11 -0
- package/esm/components/form/choice/ChoiceItem.d.ts.map +1 -0
- package/esm/components/form/choice/ChoiceItem.js +11 -0
- package/esm/components/form/choice/ChoiceItem.js.map +1 -0
- package/esm/components/icons/Back.d.ts +1 -1
- package/esm/components/icons/Back.d.ts.map +1 -1
- package/esm/components/icons/Back.js.map +1 -1
- package/esm/components/icons/Battery.d.ts +7 -0
- package/esm/components/icons/Battery.d.ts.map +1 -0
- package/esm/components/icons/Battery.js +8 -0
- package/esm/components/icons/Battery.js.map +1 -0
- package/esm/components/icons/Forward.d.ts +1 -1
- package/esm/components/icons/Forward.d.ts.map +1 -1
- package/esm/components/icons/Forward.js.map +1 -1
- package/esm/components/icons/Icon.d.ts +3 -1
- package/esm/components/icons/Icon.d.ts.map +1 -1
- package/esm/components/icons/Icon.js +6 -0
- package/esm/components/icons/Icon.js.map +1 -1
- package/esm/components/icons/Search.d.ts +7 -0
- package/esm/components/icons/Search.d.ts.map +1 -0
- package/esm/components/icons/Search.js +7 -0
- package/esm/components/icons/Search.js.map +1 -0
- package/esm/components/layout/header/HeaderIconAction.d.ts +1 -1
- package/esm/components/layout/header/HeaderIconAction.d.ts.map +1 -1
- package/esm/components/layout/header/HeaderIconAction.js.map +1 -1
- package/esm/components/layout/list/Header.d.ts +5 -1
- package/esm/components/layout/list/Header.d.ts.map +1 -1
- package/esm/components/layout/list/Header.js +6 -1
- package/esm/components/layout/list/Header.js.map +1 -1
- package/esm/components/layout/list/Item.d.ts +3 -0
- package/esm/components/layout/list/Item.d.ts.map +1 -1
- package/esm/components/layout/list/Item.js +20 -6
- package/esm/components/layout/list/Item.js.map +1 -1
- package/esm/components/layout/list/Item.module.scss +16 -1
- package/esm/components/layout/list/List.d.ts +6 -1
- package/esm/components/layout/list/List.d.ts.map +1 -1
- package/esm/components/layout/list/List.js +15 -1
- package/esm/components/layout/list/List.js.map +1 -1
- package/esm/components/layout/list/List.module.scss +4 -0
- package/esm/components/layout/section/SearchContainer.d.ts +4 -0
- package/esm/components/layout/section/SearchContainer.d.ts.map +1 -0
- package/esm/components/layout/section/SearchContainer.js +7 -0
- package/esm/components/layout/section/SearchContainer.js.map +1 -0
- package/esm/components/layout/section/SearchContainer.module.scss +3 -0
- package/esm/components/layout/section/Section.module.scss +7 -0
- package/esm/components/ui/action/Action.d.ts +1 -1
- package/esm/components/ui/action/Action.d.ts.map +1 -1
- package/esm/components/ui/action/Action.js.map +1 -1
- package/esm/components/ui/button/Button.d.ts.map +1 -1
- package/esm/components/ui/button/Button.js +2 -2
- package/esm/components/ui/button/Button.js.map +1 -1
- package/esm/components/ui/modal/Modal.d.ts +18 -0
- package/esm/components/ui/modal/Modal.d.ts.map +1 -0
- package/esm/components/ui/modal/Modal.js +83 -0
- package/esm/components/ui/modal/Modal.js.map +1 -0
- package/esm/components/ui/modal/Modal.module.scss +92 -0
- package/esm/components/ui/modal/ModalButton.d.ts +8 -0
- package/esm/components/ui/modal/ModalButton.d.ts.map +1 -0
- package/esm/components/ui/modal/ModalButton.js +13 -0
- package/esm/components/ui/modal/ModalButton.js.map +1 -0
- package/esm/components/ui/modal/ModalButtons.d.ts +10 -0
- package/esm/components/ui/modal/ModalButtons.d.ts.map +1 -0
- package/esm/components/ui/modal/ModalButtons.js +9 -0
- package/esm/components/ui/modal/ModalButtons.js.map +1 -0
- package/esm/components/ui/modal/ModalButtons.module.scss +32 -0
- package/esm/components/ui/modal/ModalNoMargin.d.ts +6 -0
- package/esm/components/ui/modal/ModalNoMargin.d.ts.map +1 -0
- package/esm/components/ui/modal/ModalNoMargin.js +16 -0
- package/esm/components/ui/modal/ModalNoMargin.js.map +1 -0
- package/esm/components/ui/tabs/Item.d.ts +10 -0
- package/esm/components/ui/tabs/Item.d.ts.map +1 -0
- package/esm/components/ui/tabs/Item.js +14 -0
- package/esm/components/ui/tabs/Item.js.map +1 -0
- package/esm/components/ui/tabs/Item.module.scss +11 -0
- package/esm/components/ui/tabs/Selector.d.ts +10 -0
- package/esm/components/ui/tabs/Selector.d.ts.map +1 -0
- package/esm/components/ui/tabs/Selector.js +21 -0
- package/esm/components/ui/tabs/Selector.js.map +1 -0
- package/esm/components/ui/tabs/Selector.module.scss +6 -0
- package/esm/components/ui/toaster/Notification.d.ts +9 -0
- package/esm/components/ui/toaster/Notification.d.ts.map +1 -0
- package/esm/components/ui/toaster/Notification.js +14 -0
- package/esm/components/ui/toaster/Notification.js.map +1 -0
- package/esm/components/ui/toaster/Toaster.d.ts +18 -0
- package/esm/components/ui/toaster/Toaster.d.ts.map +1 -0
- package/esm/components/ui/toaster/Toaster.js +74 -0
- package/esm/components/ui/toaster/Toaster.js.map +1 -0
- package/esm/components/ui/toaster/Toaster.module.scss +32 -0
- package/esm/components/ui/toaster/types.d.ts +7 -0
- package/esm/components/ui/toaster/types.d.ts.map +1 -0
- package/esm/components/ui/toaster/types.js +2 -0
- package/esm/components/ui/toaster/types.js.map +1 -0
- package/esm/global.scss +13 -0
- package/esm/index.d.ts +9 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +9 -0
- package/esm/index.js.map +1 -1
- package/esm/types/form.d.ts +7 -0
- package/esm/types/form.d.ts.map +1 -0
- package/esm/types/form.js +2 -0
- package/esm/types/form.js.map +1 -0
- package/esm/types.d.ts +1 -1
- package/esm/types.d.ts.map +1 -1
- package/esm/utils/index.d.ts +3 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +3 -0
- package/esm/utils/index.js.map +1 -0
- package/esm/utils/toObjectValue.d.ts +4 -0
- package/esm/utils/toObjectValue.d.ts.map +1 -0
- package/esm/utils/toObjectValue.js +5 -0
- package/esm/utils/toObjectValue.js.map +1 -0
- package/package.json +2 -2
- package/src/components/form/Input.module.scss +48 -0
- package/src/components/form/Input.tsx +48 -0
- package/src/components/form/Label.module.scss +15 -0
- package/src/components/form/Label.tsx +29 -0
- package/src/components/form/TextArea.tsx +38 -0
- package/src/components/form/Toggle.tsx +1 -1
- package/src/components/form/choice/Choice.module.scss +43 -0
- package/src/components/form/choice/Choice.tsx +32 -0
- package/src/components/form/choice/ChoiceItem.tsx +30 -0
- package/src/components/icons/Back.tsx +1 -1
- package/src/components/icons/Battery.tsx +34 -0
- package/src/components/icons/Forward.tsx +1 -1
- package/src/components/icons/Icon.tsx +6 -0
- package/src/components/icons/Search.tsx +29 -0
- package/src/components/layout/header/HeaderIconAction.tsx +1 -1
- package/src/components/layout/list/Header.tsx +15 -2
- package/src/components/layout/list/Item.module.scss +16 -1
- package/src/components/layout/list/Item.tsx +28 -7
- package/src/components/layout/list/List.module.scss +4 -0
- package/src/components/layout/list/List.tsx +29 -2
- package/src/components/layout/section/SearchContainer.module.scss +3 -0
- package/src/components/layout/section/SearchContainer.tsx +11 -0
- package/src/components/layout/section/Section.module.scss +7 -0
- package/src/components/ui/action/Action.tsx +1 -1
- package/src/components/ui/button/Button.tsx +4 -2
- package/src/components/ui/modal/Modal.module.scss +92 -0
- package/src/components/ui/modal/Modal.tsx +136 -0
- package/src/components/ui/modal/ModalButton.tsx +25 -0
- package/src/components/ui/modal/ModalButtons.module.scss +32 -0
- package/src/components/ui/modal/ModalButtons.tsx +17 -0
- package/src/components/ui/modal/ModalNoMargin.tsx +22 -0
- package/src/components/ui/tabs/Item.module.scss +11 -0
- package/src/components/ui/tabs/Item.tsx +26 -0
- package/src/components/ui/tabs/Selector.module.scss +6 -0
- package/src/components/ui/tabs/Selector.tsx +31 -0
- package/src/components/ui/toaster/Notification.tsx +31 -0
- package/src/components/ui/toaster/Toaster.module.scss +32 -0
- package/src/components/ui/toaster/Toaster.tsx +101 -0
- package/src/components/ui/toaster/types.ts +9 -0
- package/src/demo/Demo.tsx +7 -4
- package/src/demo/Menu.module.scss +1 -0
- package/src/demo/components/form/Choice.tsx +19 -0
- package/src/demo/components/form/Form.tsx +35 -0
- package/src/demo/components/form/Input.tsx +13 -0
- package/src/demo/components/form/Label.tsx +14 -0
- package/src/demo/components/form/Search.tsx +36 -0
- package/src/demo/components/form/TextArea.tsx +12 -0
- package/src/demo/components/form/Toggle.tsx +1 -1
- package/src/demo/components/layout/list/Inset.tsx +24 -0
- package/src/demo/components/layout/list/Selection.tsx +17 -0
- package/src/demo/components/ui/modal/Modal.tsx +110 -0
- package/src/demo/components/ui/tabs/Tabs.tsx +15 -0
- package/src/demo/components/ui/toaster/Toaster.tsx +28 -0
- package/src/demo/componentsMap.ts +74 -11
- package/src/global.scss +13 -0
- package/src/index.ts +9 -0
- package/src/types/form.ts +7 -0
- package/src/types.ts +1 -1
- package/src/utils/index.ts +2 -0
- package/src/utils/toObjectValue.ts +9 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { createContext, useContext } from "react";
|
|
2
|
+
import { Notification } from "./Notification";
|
|
3
|
+
const ToasterContext = createContext(() => {
|
|
4
|
+
throw new Error("Toaster Provider missing in the tree");
|
|
5
|
+
});
|
|
6
|
+
const prefix = `${Date.now()}_`;
|
|
7
|
+
let counter = 0;
|
|
8
|
+
const DEFAULT_TIMEOUT = 5000;
|
|
9
|
+
class ToasterProvider extends React.Component {
|
|
10
|
+
constructor(props, context) {
|
|
11
|
+
super(props, context);
|
|
12
|
+
this._add = (text) => {
|
|
13
|
+
this._removeAllToasts();
|
|
14
|
+
const id = prefix + String(counter++);
|
|
15
|
+
const hide = false;
|
|
16
|
+
this.setState(prev => ({
|
|
17
|
+
...prev,
|
|
18
|
+
list: [...prev.list, {
|
|
19
|
+
id,
|
|
20
|
+
text,
|
|
21
|
+
hide,
|
|
22
|
+
}],
|
|
23
|
+
}));
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
this.setState(prev => ({
|
|
26
|
+
...prev,
|
|
27
|
+
list: prev.list.map(p => {
|
|
28
|
+
if (p.id !== id) {
|
|
29
|
+
return p;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
...p,
|
|
33
|
+
hide: true,
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
}));
|
|
37
|
+
}, DEFAULT_TIMEOUT);
|
|
38
|
+
};
|
|
39
|
+
this._handleRemove = (id) => {
|
|
40
|
+
this.setState(prev => ({
|
|
41
|
+
...prev,
|
|
42
|
+
list: prev.list.filter(p => p.id !== id),
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
this._removeAllToasts = () => {
|
|
46
|
+
this.setState(prev => ({
|
|
47
|
+
...prev,
|
|
48
|
+
list: prev.list.map(p => {
|
|
49
|
+
if (p.hide) {
|
|
50
|
+
return p;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
...p,
|
|
54
|
+
hide: true,
|
|
55
|
+
};
|
|
56
|
+
}),
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
this.state = {
|
|
60
|
+
list: [],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
const notifications = this.state.list.map((t) => {
|
|
65
|
+
return React.createElement(Notification, { onRemove: this._handleRemove, key: t.id, toast: t });
|
|
66
|
+
});
|
|
67
|
+
return (React.createElement(ToasterContext.Provider, { value: this._add },
|
|
68
|
+
notifications,
|
|
69
|
+
this.props.children));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const useToaster = () => useContext(ToasterContext);
|
|
73
|
+
export { ToasterProvider, useToaster };
|
|
74
|
+
//# sourceMappingURL=Toaster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toaster.js","sourceRoot":"","sources":["../../../../src/components/ui/toaster/Toaster.tsx"],"names":[],"mappings":"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"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toaster/types.ts"],"names":[],"mappings":"AAAA,UAAU,KAAK;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,YAAY,EACR,KAAK,GACR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/ui/toaster/types.ts"],"names":[],"mappings":""}
|
package/esm/global.scss
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
:root {
|
|
3
3
|
--ratio-dimensions: 3;
|
|
4
4
|
--ratio-border: 2.666666;
|
|
5
|
+
// font is calculated from top to bottom
|
|
5
6
|
--ratio-font: 1.666666;
|
|
6
7
|
|
|
7
8
|
--background: white;
|
|
@@ -27,6 +28,18 @@
|
|
|
27
28
|
|
|
28
29
|
--toolbar-border: #ababab;
|
|
29
30
|
--toolbar-bg: #f8f8f8;
|
|
31
|
+
--modal-bg: #f7f7f7;
|
|
32
|
+
--modal-button-bg: #f8f8f8;
|
|
33
|
+
--modal-button-border: #c2c2c2;
|
|
34
|
+
|
|
35
|
+
--choice-bg: #ffffff;
|
|
36
|
+
--choice-text: #999999;
|
|
37
|
+
--choice-active-bg: #f3f3f3;
|
|
38
|
+
--choice-active-text: #313131;
|
|
39
|
+
--choice-border: #cfcfcf;
|
|
40
|
+
|
|
41
|
+
--selector-text: #606060;
|
|
42
|
+
--selector-active: var(--main-color);
|
|
30
43
|
|
|
31
44
|
// Shades: https://maketintsandshades.com/#038bf4,ff7200,7357e8,3ec234,3ec234,ff388f,ea2700
|
|
32
45
|
--blue1: #038bf4;
|
package/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export * from "./components/form/choice/Choice.js";
|
|
1
2
|
export * from "./components/form/Checkbox.js";
|
|
3
|
+
export * from "./components/form/Input.js";
|
|
4
|
+
export * from "./components/form/Label.js";
|
|
5
|
+
export * from "./components/form/TextArea.js";
|
|
2
6
|
export * from "./components/form/Toggle.js";
|
|
3
7
|
export * from "./components/icons/Icon.js";
|
|
4
8
|
export * from "./components/layout/card/Card.js";
|
|
@@ -7,9 +11,14 @@ export * from "./components/layout/header/HeaderIconAction.js";
|
|
|
7
11
|
export * from "./components/layout/header/StickyHeader.js";
|
|
8
12
|
export * from "./components/layout/list/List.js";
|
|
9
13
|
export * from "./components/layout/list/Item.js";
|
|
14
|
+
export * from "./components/layout/section/SearchContainer.js";
|
|
10
15
|
export * from "./components/layout/section/Section.js";
|
|
11
16
|
export * from "./components/ui/action/Action.js";
|
|
12
17
|
export * from "./components/ui/action/EqualActions.js";
|
|
13
18
|
export * from "./components/ui/button/Button.js";
|
|
14
19
|
export * from "./components/ui/directionPad/Pad.js";
|
|
20
|
+
export * from "./components/ui/modal/Modal.js";
|
|
21
|
+
export * from "./components/ui/modal/ModalButtons.js";
|
|
22
|
+
export * from "./components/ui/tabs/Selector.js";
|
|
23
|
+
export * from "./components/ui/toaster/Toaster.js";
|
|
15
24
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AAEvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AAEvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export * from "./components/form/choice/Choice.js";
|
|
1
2
|
export * from "./components/form/Checkbox.js";
|
|
3
|
+
export * from "./components/form/Input.js";
|
|
4
|
+
export * from "./components/form/Label.js";
|
|
5
|
+
export * from "./components/form/TextArea.js";
|
|
2
6
|
export * from "./components/form/Toggle.js";
|
|
3
7
|
export * from "./components/icons/Icon.js";
|
|
4
8
|
export * from "./components/layout/card/Card.js";
|
|
@@ -7,9 +11,14 @@ export * from "./components/layout/header/HeaderIconAction.js";
|
|
|
7
11
|
export * from "./components/layout/header/StickyHeader.js";
|
|
8
12
|
export * from "./components/layout/list/List.js";
|
|
9
13
|
export * from "./components/layout/list/Item.js";
|
|
14
|
+
export * from "./components/layout/section/SearchContainer.js";
|
|
10
15
|
export * from "./components/layout/section/Section.js";
|
|
11
16
|
export * from "./components/ui/action/Action.js";
|
|
12
17
|
export * from "./components/ui/action/EqualActions.js";
|
|
13
18
|
export * from "./components/ui/button/Button.js";
|
|
14
19
|
export * from "./components/ui/directionPad/Pad.js";
|
|
20
|
+
export * from "./components/ui/modal/Modal.js";
|
|
21
|
+
export * from "./components/ui/modal/ModalButtons.js";
|
|
22
|
+
export * from "./components/ui/tabs/Selector.js";
|
|
23
|
+
export * from "./components/ui/toaster/Toaster.js";
|
|
15
24
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AAEvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AAEvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/types/form.ts"],"names":[],"mappings":"AAAA,UAAU,WAAW;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACtD,aAAK,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC;AAElC,YAAY,EACR,WAAW,EACX,KAAK,GACR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/types/form.ts"],"names":[],"mappings":""}
|
package/esm/types.d.ts
CHANGED
package/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,aAAK,YAAY,GAAG,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,aAAK,YAAY,GAAG,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,EAAE,CAAC;AAEpD,YAAY,EACR,YAAY,GACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toObjectValue.d.ts","sourceRoot":"","sources":["../../src/utils/toObjectValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAExD,QAAA,MAAM,aAAa,MAAO,KAAK,KAAG,WAEjC,CAAC;AAEF,OAAO,EACH,aAAa,GAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toObjectValue.js","sourceRoot":"","sources":["../../src/utils/toObjectValue.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,CAAC,CAAQ,EAAe,EAAE;IAC5C,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,OAAO,EACH,aAAa,GAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-miui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"author": "Jacek Nowacki",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lint": "eslint src --ext .ts,.tsx,.js,.jsx,.mjs",
|
|
14
14
|
"lint:fix": "yarn lint --fix",
|
|
15
15
|
"prepack": "yarn compile",
|
|
16
|
-
"prepublishOnly": "yarn
|
|
16
|
+
"prepublishOnly": "yarn lint && yarn test && yarn docs",
|
|
17
17
|
"start:dev": "next dev",
|
|
18
18
|
"deploy:dev": "next build && next export && netlify deploy --dir out"
|
|
19
19
|
},
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.input {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
height: calc(103px / var(--ratio-dimensions));
|
|
4
|
+
font-size: calc(34 / var(--ratio-font));
|
|
5
|
+
color: var(--text);
|
|
6
|
+
border: none;
|
|
7
|
+
display: block;
|
|
8
|
+
width: 100%;
|
|
9
|
+
background: none;
|
|
10
|
+
font-family: inherit;
|
|
11
|
+
padding: 1.2em 0;
|
|
12
|
+
|
|
13
|
+
&::placeholder {
|
|
14
|
+
color: var(--sub);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.wrapper {
|
|
19
|
+
background: white;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
width: 100%;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
border-radius: 2px;
|
|
24
|
+
padding: 0 calc(36px / var(--ratio-dimensions));
|
|
25
|
+
border: calc(1px / var(--ratio-border)) solid var(--border);
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.textarea {
|
|
30
|
+
padding: 1.2em calc(36px / var(--ratio-dimensions));
|
|
31
|
+
height: unset;
|
|
32
|
+
resize: vertical;
|
|
33
|
+
min-height: calc(103px * 3 / var(--ratio-dimensions))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.prefix {
|
|
37
|
+
margin-right: calc(36px / var(--ratio-dimensions));
|
|
38
|
+
display: flex;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.suffix {
|
|
42
|
+
margin-left: calc(36px / var(--ratio-dimensions));
|
|
43
|
+
display: flex;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.wrapperFocused {
|
|
47
|
+
border-color: var(--focus-color);
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
|
|
4
|
+
import styles from "./Input.module.scss";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
children?: never;
|
|
8
|
+
prefix?: React.ReactNode;
|
|
9
|
+
suffix?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Input: React.FC<Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix"> & Props> = ({
|
|
13
|
+
className, children,
|
|
14
|
+
prefix, suffix,
|
|
15
|
+
onFocus, onBlur,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const [focused, setFocused] = useState(false);
|
|
19
|
+
|
|
20
|
+
const handleFocus = useCallback((e: React.FocusEvent<HTMLInputElement>) => {
|
|
21
|
+
setFocused(true);
|
|
22
|
+
onFocus?.(e);
|
|
23
|
+
}, [onFocus]);
|
|
24
|
+
|
|
25
|
+
const handleBlur = useCallback((e: React.FocusEvent<HTMLInputElement>) => {
|
|
26
|
+
setFocused(false);
|
|
27
|
+
onBlur?.(e);
|
|
28
|
+
}, [onBlur]);
|
|
29
|
+
|
|
30
|
+
const wrapperCls = classnames(styles.wrapper, {
|
|
31
|
+
[styles.wrapperFocused]: focused,
|
|
32
|
+
}, className);
|
|
33
|
+
|
|
34
|
+
const prefixElem = prefix ? <div className={styles.prefix}>{prefix}</div> : null;
|
|
35
|
+
const suffixElem = suffix ? <div className={styles.suffix}>{suffix}</div> : null;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className={wrapperCls}>
|
|
39
|
+
{prefixElem}
|
|
40
|
+
<input {...props} onFocus={handleFocus} onBlur={handleBlur} className={styles.input} />
|
|
41
|
+
{suffixElem}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
Input,
|
|
48
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.label + .label {
|
|
2
|
+
margin-top: 23px;
|
|
3
|
+
display: block;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.text {
|
|
7
|
+
font-size: calc(28px / var(--ratio-font));
|
|
8
|
+
margin-bottom: calc(24px / var(--ratio-dimensions));
|
|
9
|
+
color: var(--sub);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.textBig {
|
|
13
|
+
font-size: calc(34px / var(--ratio-font));
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import styles from "./Label.module.scss";
|
|
4
|
+
import { makeVariants } from "../../utils/makeVariants";
|
|
5
|
+
import classnames from "classnames";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
variant?: "big";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Label: React.FC<Props> = (props) => {
|
|
13
|
+
const v = makeVariants(props.variant);
|
|
14
|
+
|
|
15
|
+
const labelCls = classnames(styles.text, {
|
|
16
|
+
[styles.textBig]: v.includes("big"),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const label = props.label ? <div className={labelCls}>{props.label}</div> : null;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<label className={styles.label}>
|
|
23
|
+
{label}
|
|
24
|
+
{props.children}
|
|
25
|
+
</label>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { Label };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
|
|
4
|
+
import styles from "./Input.module.scss";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
children?: never;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const TextArea: React.FC<React.TextareaHTMLAttributes<HTMLTextAreaElement> & Props> = ({
|
|
11
|
+
className, children,
|
|
12
|
+
onFocus, onBlur,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const [focused, setFocused] = useState(false);
|
|
16
|
+
|
|
17
|
+
const handleFocus = useCallback((e: React.FocusEvent<HTMLTextAreaElement>) => {
|
|
18
|
+
setFocused(true);
|
|
19
|
+
onFocus?.(e);
|
|
20
|
+
}, [onFocus]);
|
|
21
|
+
|
|
22
|
+
const handleBlur = useCallback((e: React.FocusEvent<HTMLTextAreaElement>) => {
|
|
23
|
+
setFocused(false);
|
|
24
|
+
onBlur?.(e);
|
|
25
|
+
}, [onBlur]);
|
|
26
|
+
|
|
27
|
+
const cls = classnames(styles.wrapper, {
|
|
28
|
+
[styles.wrapperFocused]: focused,
|
|
29
|
+
}, styles.input, styles.textarea, className);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<textarea {...props} onFocus={handleFocus} onBlur={handleBlur} className={cls} />
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
TextArea,
|
|
38
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.choice {
|
|
2
|
+
input {
|
|
3
|
+
width: 0;
|
|
4
|
+
height: 0;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
opacity: 0;
|
|
7
|
+
margin: 0;
|
|
8
|
+
position: absolute;
|
|
9
|
+
|
|
10
|
+
&:checked + span {
|
|
11
|
+
color: var(--choice-active-text);
|
|
12
|
+
background: var(--choice-active-bg);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
span {
|
|
17
|
+
display: flex;
|
|
18
|
+
padding: 0;
|
|
19
|
+
flex: 1;
|
|
20
|
+
height: 100%;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
font-size: calc(24px / var(--ratio-font));
|
|
24
|
+
color: var(--choice-text);
|
|
25
|
+
background: var(--choice-bg);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
display: flex;
|
|
29
|
+
border: 1px solid var(--choice-border); // @TODO width
|
|
30
|
+
position: relative;
|
|
31
|
+
border-radius: 8px;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
|
|
34
|
+
label {
|
|
35
|
+
flex: 1;
|
|
36
|
+
height: calc(89px / var(--ratio-dimensions));
|
|
37
|
+
display: flex;
|
|
38
|
+
|
|
39
|
+
+ label {
|
|
40
|
+
border-left: 1px solid var(--choice-border);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { Value } from "../../../types/form";
|
|
4
|
+
import { toObjectValue } from "../../../utils";
|
|
5
|
+
import { ChoiceItem } from "./ChoiceItem";
|
|
6
|
+
import styles from "./Choice.module.scss";
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
values: Value[];
|
|
10
|
+
value: string;
|
|
11
|
+
name: string;
|
|
12
|
+
onChange: (value: string) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Choice: React.FC<Props> = (props) => {
|
|
16
|
+
const opts = props.values.map(option => {
|
|
17
|
+
const opt = toObjectValue(option);
|
|
18
|
+
return (
|
|
19
|
+
<ChoiceItem
|
|
20
|
+
key={opt.value}
|
|
21
|
+
name={props.name}
|
|
22
|
+
value={opt}
|
|
23
|
+
onChange={props.onChange}
|
|
24
|
+
active={props.value === opt.value}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return <div className={styles.choice}>{opts}</div>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { Choice };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import type { ObjectValue } from "../../../types/form";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
name: string;
|
|
6
|
+
value: ObjectValue;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
active: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ChoiceItem: React.FC<Props> = (props) => {
|
|
12
|
+
const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
|
13
|
+
props.onChange(e.currentTarget.value);
|
|
14
|
+
}, [props.onChange]);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<label key={props.value.value} tabIndex={0}>
|
|
18
|
+
<input
|
|
19
|
+
type={"radio"}
|
|
20
|
+
name={props.name}
|
|
21
|
+
value={props.value.value}
|
|
22
|
+
checked={props.active}
|
|
23
|
+
onChange={handleChange}
|
|
24
|
+
/>
|
|
25
|
+
<span>{props.value.label}</span>
|
|
26
|
+
</label>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { ChoiceItem };
|
|
@@ -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 };
|