react-miui 0.15.4 → 0.15.7
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 +19 -0
- package/dist/components/form/Toggle.d.ts +1 -0
- package/dist/components/form/Toggle.d.ts.map +1 -1
- package/dist/components/form/Toggle.js +3 -0
- package/dist/components/form/Toggle.js.map +1 -1
- package/dist/components/form/choice/Choice.d.ts +1 -1
- package/dist/components/form/choice/Choice.d.ts.map +1 -1
- package/dist/components/form/choice/Choice.js +1 -1
- package/dist/components/form/choice/Choice.js.map +1 -1
- package/dist/components/form/choice/Choice.module.scss +6 -0
- package/dist/components/ui/button/Button.d.ts +2 -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/pop/Pop.module.scss +28 -27
- package/dist/components/ui/pop/PopOption.d.ts.map +1 -1
- package/dist/components/ui/pop/PopOption.js +3 -3
- package/dist/components/ui/pop/PopOption.js.map +1 -1
- package/dist/components/utils/If.d.ts +7 -0
- package/dist/components/utils/If.d.ts.map +1 -0
- package/dist/components/utils/If.js +15 -0
- package/dist/components/utils/If.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/assets/js/search.json +1 -1
- package/docs/classes/Drawer.html +15 -12
- package/docs/classes/Pop.html +15 -12
- package/docs/classes/ToasterProvider.html +11 -8
- package/docs/enums/ICON.html +15 -12
- package/docs/index.html +7 -4
- package/docs/modules/Item.html +3 -3
- package/docs/modules/List.html +3 -3
- package/docs/modules/Modal.html +3 -3
- package/docs/modules/ModalButtons.html +3 -3
- package/docs/modules/Section.html +3 -3
- package/docs/modules/StickyHeader.html +4 -4
- package/docs/modules.html +47 -33
- package/docs/pages/Tutorials/Test.html +3 -3
- package/esm/components/form/Toggle.d.ts +1 -0
- package/esm/components/form/Toggle.d.ts.map +1 -1
- package/esm/components/form/Toggle.js +3 -0
- package/esm/components/form/Toggle.js.map +1 -1
- package/esm/components/form/choice/Choice.d.ts +1 -1
- package/esm/components/form/choice/Choice.d.ts.map +1 -1
- package/esm/components/form/choice/Choice.js +1 -1
- package/esm/components/form/choice/Choice.js.map +1 -1
- package/esm/components/form/choice/Choice.module.scss +6 -0
- package/esm/components/ui/button/Button.d.ts +2 -1
- package/esm/components/ui/button/Button.d.ts.map +1 -1
- package/esm/components/ui/button/Button.js +1 -1
- package/esm/components/ui/button/Button.js.map +1 -1
- package/esm/components/ui/pop/Pop.module.scss +28 -27
- package/esm/components/ui/pop/PopOption.d.ts.map +1 -1
- package/esm/components/ui/pop/PopOption.js +3 -3
- package/esm/components/ui/pop/PopOption.js.map +1 -1
- package/esm/components/utils/If.d.ts +7 -0
- package/esm/components/utils/If.d.ts.map +1 -0
- package/esm/components/utils/If.js +9 -0
- package/esm/components/utils/If.js.map +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/Toggle.tsx +4 -0
- package/src/components/form/choice/Choice.module.scss +6 -0
- package/src/components/form/choice/Choice.tsx +3 -1
- package/src/components/ui/button/Button.tsx +4 -2
- package/src/components/ui/pop/Pop.module.scss +28 -27
- package/src/components/ui/pop/PopOption.tsx +4 -2
- package/src/components/utils/If.tsx +14 -0
- package/src/demo/Main.module.scss +6 -0
- package/src/demo/Main.tsx +6 -15
- package/src/demo/components/form/Choice.tsx +27 -15
- package/src/index.ts +1 -0
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
font-size: calc(24px / var(--ratio-font));
|
|
24
24
|
color: var(--choice-text);
|
|
25
25
|
background: var(--choice-bg);
|
|
26
|
+
white-space: nowrap;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
display: flex;
|
|
@@ -48,3 +49,8 @@
|
|
|
48
49
|
.wide {
|
|
49
50
|
width: 100%;
|
|
50
51
|
}
|
|
52
|
+
|
|
53
|
+
.left {
|
|
54
|
+
margin-left: unset;
|
|
55
|
+
margin-right: unset;
|
|
56
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
declare type Variant = "inline" | "outline";
|
|
2
3
|
interface Props {
|
|
3
|
-
variant?:
|
|
4
|
+
variant?: Variant | Variant[];
|
|
4
5
|
}
|
|
5
6
|
declare const Button: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & Props>;
|
|
6
7
|
export { Button };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,KAAK;IACX,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,aAAK,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpC,UAAU,KAAK;IACX,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;CACjC;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAkB3E,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import styles from "./Button.module.scss";
|
|
4
|
-
import { makeVariants } from "../../../utils/
|
|
4
|
+
import { makeVariants } from "../../../utils/index.js";
|
|
5
5
|
const Button = ({ className, children, variant, ...props }) => {
|
|
6
6
|
const variants = makeVariants(variant);
|
|
7
7
|
const cls = classnames(styles.btn, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../src/components/ui/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../src/components/ui/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAQvD,MAAM,MAAM,GAAoE,CAAC,EAC7E,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EACzC,EAAE,EAAE;IACD,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAEvC,MAAM,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE;QAC/B,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACpD,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC;KACzD,EAAE,SAAS,CAAC,CAAC;IAEd,OAAO,CACH,mCACQ,KAAK,EACT,SAAS,EAAE,GAAG,EACd,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAC1B,QAAQ,CACD,CACZ,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -14,42 +14,43 @@
|
|
|
14
14
|
background: white;
|
|
15
15
|
margin: 0;
|
|
16
16
|
padding: 0;
|
|
17
|
+
list-style-type: none;
|
|
18
|
+
}
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
20
|
+
.li {
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
list-style-type: none;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
+ .li {
|
|
25
26
|
border-top: 1px solid var(--border);
|
|
26
27
|
}
|
|
28
|
+
}
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
svg {
|
|
43
|
-
fill: currentColor;
|
|
44
|
-
margin-right: calc(42px / var(--ratio-dimensions));
|
|
45
|
-
}
|
|
30
|
+
.button {
|
|
31
|
+
border: none;
|
|
32
|
+
background: white;
|
|
33
|
+
height: calc(116px / var(--ratio-dimensions));
|
|
34
|
+
padding: 0 calc(42px / var(--ratio-dimensions));
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
width: 100%;
|
|
37
|
+
min-width: calc(460px / var(--ratio-dimensions));
|
|
38
|
+
text-align: left;
|
|
39
|
+
color: var(--pop-text);
|
|
40
|
+
font-size: calc(26px / var(--ratio-font));
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
44
|
+
&:hover {
|
|
45
|
+
background: var(--active-bg);
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
48
|
|
|
49
|
+
.icon {
|
|
50
|
+
fill: currentColor;
|
|
51
|
+
margin-right: calc(42px / var(--ratio-dimensions));
|
|
52
|
+
}
|
|
53
|
+
|
|
53
54
|
.fakeIcon {
|
|
54
55
|
display: inline-block;
|
|
55
56
|
width: 16px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopOption.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/pop/PopOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAK7C,UAAU,KAAK;IACX,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"PopOption.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/pop/PopOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAK7C,UAAU,KAAK;IACX,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAU9B,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -4,10 +4,10 @@ import styles from "./Pop.module.scss";
|
|
|
4
4
|
const PopOption = (props) => {
|
|
5
5
|
var _a;
|
|
6
6
|
const ic = props.icon
|
|
7
|
-
? React.createElement(Icon, { name: props.icon })
|
|
7
|
+
? React.createElement(Icon, { name: props.icon, className: styles.icon })
|
|
8
8
|
: (((_a = props.forceEmptyIcon) !== null && _a !== void 0 ? _a : true) ? React.createElement("span", { className: styles.fakeIcon }) : null);
|
|
9
|
-
return (React.createElement("li",
|
|
10
|
-
React.createElement("button", { onClick: props.onClick },
|
|
9
|
+
return (React.createElement("li", { className: styles.li },
|
|
10
|
+
React.createElement("button", { onClick: props.onClick, className: styles.button },
|
|
11
11
|
ic,
|
|
12
12
|
props.children)));
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopOption.js","sourceRoot":"","sources":["../../../../src/components/ui/pop/PopOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAQvC,MAAM,SAAS,GAAoB,CAAC,KAAK,EAAE,EAAE;;IACzC,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI;QACjB,CAAC,CAAC,oBAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,GAAI;
|
|
1
|
+
{"version":3,"file":"PopOption.js","sourceRoot":"","sources":["../../../../src/components/ui/pop/PopOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAQvC,MAAM,SAAS,GAAoB,CAAC,KAAK,EAAE,EAAE;;IACzC,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI;QACjB,CAAC,CAAC,oBAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,GAAI;QACpD,CAAC,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,cAAc,mCAAI,IAAI,CAAC,CAAC,CAAC,CAAC,8BAAM,SAAS,EAAE,MAAM,CAAC,QAAQ,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAErF,OAAO,CACH,4BAAI,SAAS,EAAE,MAAM,CAAC,EAAE;QACpB,gCAAQ,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM;YAAG,EAAE;YAAE,KAAK,CAAC,QAAQ,CAAU,CACtF,CACR,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"If.d.ts","sourceRoot":"","sources":["../../../src/components/utils/If.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,KAAK;IACX,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAKvB,CAAC;AAEF,OAAO,EAAE,EAAE,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"If.js","sourceRoot":"","sources":["../../../src/components/utils/If.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,EAAE,GAAoB,CAAC,KAAK,EAAE,EAAE;IAClC,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;QAC1B,OAAO,0CAAG,KAAK,CAAC,QAAQ,CAAI,CAAC;KAChC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,OAAO,EAAE,EAAE,EAAE,CAAC"}
|
package/esm/index.d.ts
CHANGED
|
@@ -28,5 +28,6 @@ export * from "./components/ui/stats/Stats.js";
|
|
|
28
28
|
export * from "./components/ui/tabs/Selector.js";
|
|
29
29
|
export * from "./components/ui/toaster/Toaster.js";
|
|
30
30
|
export * from "./components/utils/HandleEsc.js";
|
|
31
|
+
export * from "./components/utils/If.js";
|
|
31
32
|
export * from "./components/utils/Spacer.js";
|
|
32
33
|
//# 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,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;A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C,CAAC;AACjD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AAEnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAE/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AAEnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -28,5 +28,6 @@ export * from "./components/ui/stats/Stats.js";
|
|
|
28
28
|
export * from "./components/ui/tabs/Selector.js";
|
|
29
29
|
export * from "./components/ui/toaster/Toaster.js";
|
|
30
30
|
export * from "./components/utils/HandleEsc.js";
|
|
31
|
+
export * from "./components/utils/If.js";
|
|
31
32
|
export * from "./components/utils/Spacer.js";
|
|
32
33
|
//# 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,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,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,C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AC;AACtD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAE/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AAEnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import classnames from "classnames";
|
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
onChange: (newValue: boolean) => void;
|
|
9
|
+
undeterminedClickValue?: boolean;
|
|
9
10
|
disabled?: boolean;
|
|
10
11
|
value: boolean | null;
|
|
11
12
|
}
|
|
@@ -13,6 +14,9 @@ interface Props {
|
|
|
13
14
|
const Toggle: React.FC<Props> = (props) => {
|
|
14
15
|
const handleChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {
|
|
15
16
|
if (props.value == null) {
|
|
17
|
+
if ("undeterminedClickValue" in props) {
|
|
18
|
+
props.onChange(props.undeterminedClickValue!);
|
|
19
|
+
}
|
|
16
20
|
return;
|
|
17
21
|
}
|
|
18
22
|
props.onChange(e.target.checked);
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
font-size: calc(24px / var(--ratio-font));
|
|
24
24
|
color: var(--choice-text);
|
|
25
25
|
background: var(--choice-bg);
|
|
26
|
+
white-space: nowrap;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
display: flex;
|
|
@@ -48,3 +49,8 @@
|
|
|
48
49
|
.wide {
|
|
49
50
|
width: 100%;
|
|
50
51
|
}
|
|
52
|
+
|
|
53
|
+
.left {
|
|
54
|
+
margin-left: unset;
|
|
55
|
+
margin-right: unset;
|
|
56
|
+
}
|
|
@@ -6,7 +6,7 @@ import { makeVariants, toObjectValue } from "../../../utils";
|
|
|
6
6
|
import { ChoiceItem } from "./ChoiceItem";
|
|
7
7
|
import styles from "./Choice.module.scss";
|
|
8
8
|
|
|
9
|
-
type Variant = "wide";
|
|
9
|
+
type Variant = "wide" | "left";
|
|
10
10
|
|
|
11
11
|
interface Props<T extends string> {
|
|
12
12
|
values: Value<T>[];
|
|
@@ -17,6 +17,7 @@ interface Props<T extends string> {
|
|
|
17
17
|
variant?: Variant | Variant[];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// @TODO handle disabled / readonly!
|
|
20
21
|
// @TODO auto width mode by default?
|
|
21
22
|
|
|
22
23
|
const Choice = <T extends string>(props: Props<T>): ReturnType<React.FC<Props<T>>> => {
|
|
@@ -38,6 +39,7 @@ const Choice = <T extends string>(props: Props<T>): ReturnType<React.FC<Props<T>
|
|
|
38
39
|
const cls = classnames(
|
|
39
40
|
styles.choice, props.className,
|
|
40
41
|
{ [styles.wide]: v.includes("wide") },
|
|
42
|
+
{ [styles.left]: v.includes("left") },
|
|
41
43
|
);
|
|
42
44
|
|
|
43
45
|
return <div className={cls}>{opts}</div>;
|
|
@@ -2,10 +2,12 @@ import React from "react";
|
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
|
|
4
4
|
import styles from "./Button.module.scss";
|
|
5
|
-
import { makeVariants } from "../../../utils/
|
|
5
|
+
import { makeVariants } from "../../../utils/index.js";
|
|
6
|
+
|
|
7
|
+
type Variant = "inline" | "outline";
|
|
6
8
|
|
|
7
9
|
interface Props {
|
|
8
|
-
variant?:
|
|
10
|
+
variant?: Variant | Variant[];
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
const Button: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & Props> = ({
|
|
@@ -14,42 +14,43 @@
|
|
|
14
14
|
background: white;
|
|
15
15
|
margin: 0;
|
|
16
16
|
padding: 0;
|
|
17
|
+
list-style-type: none;
|
|
18
|
+
}
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
20
|
+
.li {
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
list-style-type: none;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
+ .li {
|
|
25
26
|
border-top: 1px solid var(--border);
|
|
26
27
|
}
|
|
28
|
+
}
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
svg {
|
|
43
|
-
fill: currentColor;
|
|
44
|
-
margin-right: calc(42px / var(--ratio-dimensions));
|
|
45
|
-
}
|
|
30
|
+
.button {
|
|
31
|
+
border: none;
|
|
32
|
+
background: white;
|
|
33
|
+
height: calc(116px / var(--ratio-dimensions));
|
|
34
|
+
padding: 0 calc(42px / var(--ratio-dimensions));
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
width: 100%;
|
|
37
|
+
min-width: calc(460px / var(--ratio-dimensions));
|
|
38
|
+
text-align: left;
|
|
39
|
+
color: var(--pop-text);
|
|
40
|
+
font-size: calc(26px / var(--ratio-font));
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
44
|
+
&:hover {
|
|
45
|
+
background: var(--active-bg);
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
48
|
|
|
49
|
+
.icon {
|
|
50
|
+
fill: currentColor;
|
|
51
|
+
margin-right: calc(42px / var(--ratio-dimensions));
|
|
52
|
+
}
|
|
53
|
+
|
|
53
54
|
.fakeIcon {
|
|
54
55
|
display: inline-block;
|
|
55
56
|
width: 16px;
|
|
@@ -13,11 +13,13 @@ interface Props {
|
|
|
13
13
|
|
|
14
14
|
const PopOption: React.FC<Props> = (props) => {
|
|
15
15
|
const ic = props.icon
|
|
16
|
-
? <Icon name={props.icon} />
|
|
16
|
+
? <Icon name={props.icon} className={styles.icon} />
|
|
17
17
|
: ((props.forceEmptyIcon ?? true) ? <span className={styles.fakeIcon} /> : null);
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<li
|
|
20
|
+
<li className={styles.li}>
|
|
21
|
+
<button onClick={props.onClick} className={styles.button}>{ic}{props.children}</button>
|
|
22
|
+
</li>
|
|
21
23
|
);
|
|
22
24
|
};
|
|
23
25
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
condition?: unknown;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const If: React.FC<Props> = (props) => {
|
|
8
|
+
if (Boolean(props.condition)) { // eslint-disable-line no-extra-boolean-cast
|
|
9
|
+
return <>{props.children}</>;
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { If };
|
|
@@ -5,12 +5,18 @@
|
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
.header {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 20px 20px 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
.component {
|
|
9
14
|
padding: 20px;
|
|
10
15
|
flex: 1;
|
|
11
16
|
overflow: auto;
|
|
12
17
|
display: flex;
|
|
13
18
|
flex-direction: column;
|
|
19
|
+
margin-top: 20px;
|
|
14
20
|
|
|
15
21
|
&--transparent {
|
|
16
22
|
background-position: 0px 0px, 10px 10px;
|
package/src/demo/Main.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
|
|
4
4
|
import type { AnyComponent } from "../types";
|
|
@@ -8,6 +8,7 @@ import styles from "./Main.module.scss";
|
|
|
8
8
|
|
|
9
9
|
import { safeUseHash } from "./utils/safeUseHash";
|
|
10
10
|
import { componentsMap } from "./componentsMap";
|
|
11
|
+
import { Choice } from "../components/form/choice/Choice";
|
|
11
12
|
|
|
12
13
|
type BG = "white" | "transparent" | "mobile";
|
|
13
14
|
|
|
@@ -41,23 +42,15 @@ const getComponentByHash = (hash: string): ComponentInfo | null => {
|
|
|
41
42
|
return null;
|
|
42
43
|
};
|
|
43
44
|
|
|
45
|
+
const values: BG[] = ["white", "transparent", "mobile"];
|
|
46
|
+
|
|
44
47
|
const Main: React.FC = (props) => {
|
|
45
|
-
const [bg,
|
|
48
|
+
const [bg, handleBgChange] = useState<BG>("white");
|
|
46
49
|
|
|
47
50
|
const hash = safeUseHash();
|
|
48
51
|
const hashWithoutHash = hash.substr(1);
|
|
49
52
|
const info = getComponentByHash(hashWithoutHash);
|
|
50
53
|
|
|
51
|
-
const handleTransparentBg = useCallback(() => {
|
|
52
|
-
setBg("transparent");
|
|
53
|
-
}, []);
|
|
54
|
-
const handleWhiteBg = useCallback(() => {
|
|
55
|
-
setBg("white");
|
|
56
|
-
}, []);
|
|
57
|
-
const handleMobileBg = useCallback(() => {
|
|
58
|
-
setBg("mobile");
|
|
59
|
-
}, []);
|
|
60
|
-
|
|
61
54
|
if (!info) {
|
|
62
55
|
return (
|
|
63
56
|
<div className={styles.container}>
|
|
@@ -77,9 +70,7 @@ const Main: React.FC = (props) => {
|
|
|
77
70
|
return (
|
|
78
71
|
<div className={styles.container}>
|
|
79
72
|
<h1 className={styles.header}>{info.name}</h1>
|
|
80
|
-
<
|
|
81
|
-
<button onClick={handleWhiteBg}>White</button>
|
|
82
|
-
<button onClick={handleMobileBg}>Mobile</button>
|
|
73
|
+
<Choice values={values} value={bg} name={"x"} onChange={handleBgChange} />
|
|
83
74
|
|
|
84
75
|
<div className={componentCls}>
|
|
85
76
|
<Component />
|
|
@@ -6,7 +6,7 @@ import styles from "./Choice.module.scss";
|
|
|
6
6
|
|
|
7
7
|
interface Props {}
|
|
8
8
|
|
|
9
|
-
const values: ("Single" | "Multiple")[] = ["Single", "Multiple"];
|
|
9
|
+
const values: ("Single" | "Multiple words")[] = ["Single", "Multiple words"];
|
|
10
10
|
|
|
11
11
|
const ChoiceDemo: React.FC<Props> = () => {
|
|
12
12
|
const [current, handleCurrent] = useState(values[0]);
|
|
@@ -21,11 +21,11 @@ const ChoiceDemo: React.FC<Props> = () => {
|
|
|
21
21
|
const values2 = [
|
|
22
22
|
{
|
|
23
23
|
label: "Option 1",
|
|
24
|
-
value: "
|
|
24
|
+
value: "one",
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
label: "Option 2",
|
|
28
|
-
value: "
|
|
28
|
+
value: "two",
|
|
29
29
|
},
|
|
30
30
|
];
|
|
31
31
|
|
|
@@ -33,18 +33,30 @@ const ChoiceDemo2: React.FC<Props> = () => {
|
|
|
33
33
|
const [current, handleCurrent] = useState(values2[0].value);
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
<>
|
|
37
|
+
<Section variant={["vertical", "horizontal"]}>
|
|
38
|
+
<Choice
|
|
39
|
+
values={values2}
|
|
40
|
+
value={current}
|
|
41
|
+
name={"rnd"}
|
|
42
|
+
onChange={handleCurrent}
|
|
43
|
+
className={styles.darker}
|
|
44
|
+
variant={"wide"}
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
Current: {current}
|
|
48
|
+
</Section>
|
|
49
|
+
<Section variant={["vertical", "horizontal"]}>
|
|
50
|
+
<Choice
|
|
51
|
+
values={values2}
|
|
52
|
+
value={current}
|
|
53
|
+
name={"rn2d"}
|
|
54
|
+
onChange={handleCurrent}
|
|
55
|
+
variant={"left"}
|
|
56
|
+
/>
|
|
57
|
+
</Section>
|
|
58
|
+
|
|
59
|
+
</>
|
|
48
60
|
);
|
|
49
61
|
};
|
|
50
62
|
|
package/src/index.ts
CHANGED