react-miui 0.9.0 → 0.9.4
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 +25 -0
- package/dist/components/form/Checkbox.d.ts +3 -1
- package/dist/components/form/Checkbox.d.ts.map +1 -1
- package/dist/components/form/Checkbox.js +14 -4
- package/dist/components/form/Checkbox.js.map +1 -1
- package/dist/components/form/Checkbox.module.scss +54 -30
- package/dist/components/form/Input.d.ts.map +1 -1
- package/dist/components/form/Input.js +2 -0
- package/dist/components/form/Input.js.map +1 -1
- package/dist/components/form/Input.module.scss +21 -0
- package/dist/components/layout/list/Header.d.ts +1 -0
- package/dist/components/layout/list/Header.d.ts.map +1 -1
- package/dist/components/layout/list/Header.js +2 -2
- package/dist/components/layout/list/Header.js.map +1 -1
- package/dist/components/layout/list/Label.d.ts +1 -0
- package/dist/components/layout/list/Label.d.ts.map +1 -1
- package/dist/components/layout/list/Label.js +2 -1
- package/dist/components/layout/list/Label.js.map +1 -1
- package/dist/components/layout/list/List.d.ts.map +1 -1
- package/dist/components/layout/list/List.js +4 -3
- package/dist/components/layout/list/List.js.map +1 -1
- package/dist/components/layout/list/Value.d.ts +4 -1
- package/dist/components/layout/list/Value.d.ts.map +1 -1
- package/dist/components/layout/list/Value.js +2 -1
- package/dist/components/layout/list/Value.js.map +1 -1
- package/dist/global.scss +7 -3
- package/docs/classes/ToasterProvider.html +8 -8
- package/docs/enums/ICON.html +8 -8
- package/docs/index.html +4 -4
- package/docs/modules/Item.html +4 -4
- 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 +27 -27
- package/docs/pages/Tutorials/Test.html +3 -3
- package/esm/components/form/Checkbox.d.ts +3 -1
- package/esm/components/form/Checkbox.d.ts.map +1 -1
- package/esm/components/form/Checkbox.js +14 -4
- package/esm/components/form/Checkbox.js.map +1 -1
- package/esm/components/form/Checkbox.module.scss +54 -30
- package/esm/components/form/Input.d.ts.map +1 -1
- package/esm/components/form/Input.js +2 -0
- package/esm/components/form/Input.js.map +1 -1
- package/esm/components/form/Input.module.scss +21 -0
- package/esm/components/layout/list/Header.d.ts +1 -0
- package/esm/components/layout/list/Header.d.ts.map +1 -1
- package/esm/components/layout/list/Header.js +2 -2
- package/esm/components/layout/list/Header.js.map +1 -1
- package/esm/components/layout/list/Label.d.ts +1 -0
- package/esm/components/layout/list/Label.d.ts.map +1 -1
- package/esm/components/layout/list/Label.js +2 -1
- package/esm/components/layout/list/Label.js.map +1 -1
- package/esm/components/layout/list/List.d.ts.map +1 -1
- package/esm/components/layout/list/List.js +4 -3
- package/esm/components/layout/list/List.js.map +1 -1
- package/esm/components/layout/list/Value.d.ts +4 -1
- package/esm/components/layout/list/Value.d.ts.map +1 -1
- package/esm/components/layout/list/Value.js +2 -1
- package/esm/components/layout/list/Value.js.map +1 -1
- package/esm/global.scss +7 -3
- package/package.json +7 -7
- package/src/components/form/Checkbox.module.scss +54 -30
- package/src/components/form/Checkbox.tsx +26 -5
- package/src/components/form/Input.module.scss +21 -0
- package/src/components/form/Input.tsx +2 -0
- package/src/components/layout/list/Header.tsx +3 -2
- package/src/components/layout/list/Label.tsx +3 -1
- package/src/components/layout/list/List.tsx +5 -6
- package/src/components/layout/list/Value.tsx +7 -2
- package/src/demo/components/form/Checkbox.tsx +19 -1
- package/src/demo/components/form/Input.tsx +4 -0
- package/src/global.scss +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/list/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/list/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,KAAK;IACX,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAS1B,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
2
3
|
import styles from "./Label.module.scss";
|
|
3
4
|
const Label = (props) => {
|
|
4
5
|
const sub = props.sub ? React.createElement("div", { className: styles.sub }, props.sub) : null;
|
|
5
|
-
return (React.createElement("div", { className: styles.root },
|
|
6
|
+
return (React.createElement("div", { className: classnames(styles.root, props.className) },
|
|
6
7
|
React.createElement("div", null, props.children),
|
|
7
8
|
sub));
|
|
8
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../src/components/layout/list/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../src/components/layout/list/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAOzC,MAAM,KAAK,GAAoB,CAAC,KAAK,EAAE,EAAE;IACrC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,GAAG,IAAG,KAAK,CAAC,GAAG,CAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAE7E,OAAO,CACH,6BAAK,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;QACpD,iCAAM,KAAK,CAAC,QAAQ,CAAO;QAC1B,GAAG,CACF,CACT,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/list/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAKrC,aAAK,OAAO,GAAG,OAAO,CAAC;AAEvB,UAAU,KAAK;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;CACjC;AAED,UAAU,aAAa;IACnB,MAAM,EAAE,OAAO,MAAM,CAAC;CACzB;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/list/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAKrC,aAAK,OAAO,GAAG,OAAO,CAAC;AAEvB,UAAU,KAAK;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;CACjC;AAED,UAAU,aAAa;IACnB,MAAM,EAAE,OAAO,MAAM,CAAC;CACzB;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,aAoB7B,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -14,9 +14,10 @@ const List = (props) => {
|
|
|
14
14
|
}
|
|
15
15
|
return child;
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const cls = classnames(props.className, styles.list, {
|
|
18
|
+
[styles.inset]: v.includes("inset"),
|
|
19
|
+
});
|
|
20
|
+
return (React.createElement("ul", { className: cls }, chld));
|
|
20
21
|
};
|
|
21
22
|
List.Header = Header;
|
|
22
23
|
export { List };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../../src/components/layout/list/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAaxC,MAAM,IAAI,GAAoC,CAAC,KAAK,EAAE,EAAE;IACpD,MAAM,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEtC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;QACtD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE;YACzG,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE;gBAE7B,OAAO,EAAE,KAAK,CAAC,OAAO;aACzB,CAAC,CAAC;SACN;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../../src/components/layout/list/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAaxC,MAAM,IAAI,GAAoC,CAAC,KAAK,EAAE,EAAE;IACpD,MAAM,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEtC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;QACtD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE;YACzG,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE;gBAE7B,OAAO,EAAE,KAAK,CAAC,OAAO;aACzB,CAAC,CAAC;SACN;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE;QACjD,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;KACtC,CAAC,CAAC;IAEH,OAAO,CACH,4BAAI,SAAS,EAAE,GAAG,IAAG,IAAI,CAAM,CAClC,CAAC;AACN,CAAC,CAAC;AAEF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AAErB,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/list/Value.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/list/Value.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,KAAK;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAI1B,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
2
3
|
import styles from "./Value.module.scss";
|
|
3
4
|
const Value = (props) => {
|
|
4
|
-
return (React.createElement("div", { className: styles.value }, props.children));
|
|
5
|
+
return (React.createElement("div", { className: classnames(styles.value, props.className) }, props.children));
|
|
5
6
|
};
|
|
6
7
|
export { Value };
|
|
7
8
|
//# sourceMappingURL=Value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Value.js","sourceRoot":"","sources":["../../../../src/components/layout/list/Value.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Value.js","sourceRoot":"","sources":["../../../../src/components/layout/list/Value.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAMzC,MAAM,KAAK,GAAoB,CAAC,KAAK,EAAE,EAAE;IACrC,OAAO,CACH,6BAAK,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,IAAG,KAAK,CAAC,QAAQ,CAAO,CACpF,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/esm/global.scss
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
--background: white;
|
|
9
9
|
|
|
10
|
-
--main-color: #008ad2;
|
|
10
|
+
--main-color: #008ad2;
|
|
11
11
|
--main-color-alt: #006AA9;
|
|
12
12
|
|
|
13
|
-
--active-bg: #
|
|
14
|
-
--inactive-bg: #d3d3d3;
|
|
13
|
+
--active-bg: #e7e7e7;
|
|
14
|
+
--inactive-bg: #d3d3d3;
|
|
15
|
+
--inactive-dark-bg: #999;
|
|
15
16
|
|
|
16
17
|
--toggle-handle-bg: #e0e0e0;
|
|
17
18
|
--toggle-handle-border: #cdcdcd;
|
|
@@ -32,6 +33,9 @@
|
|
|
32
33
|
--modal-button-bg: #f8f8f8;
|
|
33
34
|
--modal-button-border: #c2c2c2;
|
|
34
35
|
|
|
36
|
+
--input-disabled-bg: #f3f3f3;
|
|
37
|
+
--input-disabled-text: #959595;
|
|
38
|
+
|
|
35
39
|
--choice-bg: #ffffff;
|
|
36
40
|
--choice-text: #999999;
|
|
37
41
|
--choice-active-bg: #f3f3f3;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-miui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
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 lint && yarn test && yarn docs",
|
|
16
|
+
"prepublishOnly": "yarn audit && 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
|
},
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"eslint-plugin-react": "^7.24.0",
|
|
49
49
|
"fast-glob": "^3.2.7",
|
|
50
50
|
"fs-extra": "^9.0.1",
|
|
51
|
-
"husky": "^
|
|
52
|
-
"jest": "^27.
|
|
51
|
+
"husky": "^7.0.4",
|
|
52
|
+
"jest": "^27.5.1",
|
|
53
53
|
"must": "^0.13.4",
|
|
54
|
-
"next": "^11.1.
|
|
54
|
+
"next": "^11.1.4",
|
|
55
55
|
"react": "^17.0.2",
|
|
56
56
|
"react-dom": "^17.0.2",
|
|
57
57
|
"react-use": "^17.2.4",
|
|
58
58
|
"sass": "^1.35.2",
|
|
59
59
|
"ts-node": "^9.0.0",
|
|
60
|
-
"typedoc": "^0.21.
|
|
60
|
+
"typedoc": "^0.21.10",
|
|
61
61
|
"typedoc-plugin-pages-fork-fork": "^0.0.3",
|
|
62
62
|
"typescript": "^4.2.4"
|
|
63
63
|
},
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"libraryTemplate": {
|
|
74
|
-
"version": "3.4.
|
|
74
|
+
"version": "3.4.1",
|
|
75
75
|
"language": "typescript",
|
|
76
76
|
"fixDefaultForCommonJS": true,
|
|
77
77
|
"jsx": true
|
|
@@ -6,42 +6,66 @@
|
|
|
6
6
|
margin: 0;
|
|
7
7
|
vertical-align: middle;
|
|
8
8
|
|
|
9
|
-
+ span {
|
|
10
|
-
border-radius: 100px;
|
|
11
|
-
background: var(--inactive-bg);
|
|
12
|
-
width: 18px;
|
|
13
|
-
height: 18px;
|
|
14
|
-
display: inline-flex;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
align-items: center;
|
|
17
|
-
vertical-align: middle;
|
|
18
|
-
|
|
19
|
-
svg {
|
|
20
|
-
width: 9px;
|
|
21
|
-
height: 9px;
|
|
22
|
-
fill: white;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
+ span {
|
|
26
|
-
vertical-align: middle;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
9
|
&:focus-visible {
|
|
31
|
-
+
|
|
10
|
+
+ .checkmark {
|
|
32
11
|
box-shadow: 0 0 5px black;
|
|
33
12
|
}
|
|
34
13
|
}
|
|
35
14
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
color: var(--main-color);
|
|
39
|
-
background: currentColor;
|
|
40
|
-
}
|
|
15
|
+
+ .checkmark + .label:not(:empty) {
|
|
16
|
+
margin-left: 0.75em;
|
|
41
17
|
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
42
20
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
21
|
+
.checkmark {
|
|
22
|
+
border-radius: 100px;
|
|
23
|
+
background: none;
|
|
24
|
+
border: 1px solid var(--inactive-bg);
|
|
25
|
+
width: 18px;
|
|
26
|
+
height: 18px;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
vertical-align: middle;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
|
|
33
|
+
svg {
|
|
34
|
+
display: none;
|
|
35
|
+
width: 9px;
|
|
36
|
+
height: 9px;
|
|
37
|
+
fill: white;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
+ .label {
|
|
41
|
+
vertical-align: middle;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.checkmarkChecked {
|
|
46
|
+
border-width: 0;
|
|
47
|
+
color: var(--main-color);
|
|
48
|
+
background: currentColor;
|
|
49
|
+
|
|
50
|
+
svg {
|
|
51
|
+
display: inline-block;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.checkmarkDisabled {
|
|
55
|
+
background: var(--inactive-dark-bg);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.checkmarkDisabled {
|
|
60
|
+
background: var(--active-bg);
|
|
61
|
+
|
|
62
|
+
+ .label {
|
|
63
|
+
color: var(--input-disabled-text);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.checkmarkReadOnly {
|
|
68
|
+
+ .label {
|
|
69
|
+
color: var(--input-disabled-text);
|
|
46
70
|
}
|
|
47
71
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
2
3
|
|
|
3
4
|
import styles from "./Checkbox.module.scss";
|
|
4
5
|
import { Checkmark } from "../icons/Checkmark.js";
|
|
@@ -6,19 +7,39 @@ import { Checkmark } from "../icons/Checkmark.js";
|
|
|
6
7
|
interface Props {
|
|
7
8
|
color?: string;
|
|
8
9
|
name: string;
|
|
9
|
-
onChange: () => void;
|
|
10
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
11
|
checked: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
readOnly?: boolean;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
const Checkbox: React.FC<Props> = (props) => {
|
|
14
17
|
const style: React.CSSProperties = {};
|
|
15
18
|
props.color && (style.color = props.color);
|
|
16
19
|
|
|
20
|
+
const cls = classnames(styles.checkbox, {
|
|
21
|
+
[styles.disabled]: props.disabled,
|
|
22
|
+
[styles.readOnly]: props.readOnly,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const checkmarkCls = classnames(styles.checkmark, {
|
|
26
|
+
[styles.checkmarkDisabled]: props.disabled,
|
|
27
|
+
[styles.checkmarkChecked]: props.checked,
|
|
28
|
+
[styles.checkmarkReadOnly]: props.readOnly,
|
|
29
|
+
});
|
|
30
|
+
|
|
17
31
|
return (
|
|
18
|
-
<label className={
|
|
19
|
-
<input
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
<label className={cls}>
|
|
33
|
+
<input
|
|
34
|
+
type={"checkbox"}
|
|
35
|
+
name={props.name}
|
|
36
|
+
onChange={props.onChange}
|
|
37
|
+
checked={props.checked}
|
|
38
|
+
disabled={props.disabled}
|
|
39
|
+
readOnly={props.readOnly}
|
|
40
|
+
/>
|
|
41
|
+
<span style={style} className={checkmarkCls}><Checkmark /></span>
|
|
42
|
+
<span className={styles.label}>{props.children}</span>
|
|
22
43
|
</label>
|
|
23
44
|
);
|
|
24
45
|
};
|
|
@@ -24,6 +24,27 @@
|
|
|
24
24
|
padding: 0 calc(36px / var(--ratio-dimensions));
|
|
25
25
|
border: calc(1px / var(--ratio-border)) solid var(--border);
|
|
26
26
|
align-items: center;
|
|
27
|
+
|
|
28
|
+
.input {
|
|
29
|
+
flex: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.disabled {
|
|
33
|
+
background: var(--input-disabled-bg);
|
|
34
|
+
color: var(--input-disabled-text);
|
|
35
|
+
|
|
36
|
+
.input {
|
|
37
|
+
color: var(--input-disabled-text);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.readOnly {
|
|
42
|
+
color: var(--input-disabled-text);
|
|
43
|
+
|
|
44
|
+
.input {
|
|
45
|
+
color: var(--input-disabled-text);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
27
48
|
}
|
|
28
49
|
|
|
29
50
|
.textarea {
|
|
@@ -29,6 +29,8 @@ const Input: React.FC<Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix"
|
|
|
29
29
|
|
|
30
30
|
const wrapperCls = classnames(styles.wrapper, {
|
|
31
31
|
[styles.wrapperFocused]: focused,
|
|
32
|
+
[styles.disabled]: props.disabled,
|
|
33
|
+
[styles.readOnly]: props.readOnly,
|
|
32
34
|
}, className);
|
|
33
35
|
|
|
34
36
|
const prefixElem = prefix ? <div className={styles.prefix}>{prefix}</div> : null;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
|
|
4
|
+
import { makeVariants } from "../../../utils/makeVariants";
|
|
4
5
|
import styles from "./Item.module.scss";
|
|
5
6
|
import headerStyles from "./Header.module.scss";
|
|
6
|
-
import { makeVariants } from "../../../utils/makeVariants";
|
|
7
7
|
|
|
8
8
|
type Variant = "inset";
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
|
+
className?: string;
|
|
11
12
|
variant?: Variant | Variant[];
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
const Header: React.FC<Props> = (props) => {
|
|
15
16
|
const v = makeVariants(props.variant);
|
|
16
17
|
|
|
17
|
-
const cls = classnames(styles.item, headerStyles.header, {
|
|
18
|
+
const cls = classnames(props.className, styles.item, headerStyles.header, {
|
|
18
19
|
[styles.inset]: v.includes("inset"),
|
|
19
20
|
});
|
|
20
21
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
2
3
|
import type { ReactNode } from "react";
|
|
3
4
|
|
|
4
5
|
import styles from "./Label.module.scss";
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
sub?: ReactNode;
|
|
9
|
+
className?: string;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
const Label: React.FC<Props> = (props) => {
|
|
11
13
|
const sub = props.sub ? <div className={styles.sub}>{props.sub}</div> : null;
|
|
12
14
|
|
|
13
15
|
return (
|
|
14
|
-
<div className={styles.root}>
|
|
16
|
+
<div className={classnames(styles.root, props.className)}>
|
|
15
17
|
<div>{props.children}</div>
|
|
16
18
|
{sub}
|
|
17
19
|
</div>
|
|
@@ -30,13 +30,12 @@ const List: React.FC<Props> & SubComponents = (props) => {
|
|
|
30
30
|
return child;
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
+
const cls = classnames(props.className, styles.list, {
|
|
34
|
+
[styles.inset]: v.includes("inset"),
|
|
35
|
+
});
|
|
36
|
+
|
|
33
37
|
return (
|
|
34
|
-
<ul
|
|
35
|
-
className={classnames(styles.list, {
|
|
36
|
-
[styles.inset]: v.includes("inset"),
|
|
37
|
-
})}
|
|
38
|
-
>{chld}
|
|
39
|
-
</ul>
|
|
38
|
+
<ul className={cls}>{chld}</ul>
|
|
40
39
|
);
|
|
41
40
|
};
|
|
42
41
|
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
2
3
|
|
|
3
4
|
import styles from "./Value.module.scss";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Value: React.FC<Props> = (props) => {
|
|
6
11
|
return (
|
|
7
|
-
<div className={styles.value}>{props.children}</div>
|
|
12
|
+
<div className={classnames(styles.value, props.className)}>{props.children}</div>
|
|
8
13
|
);
|
|
9
14
|
};
|
|
10
15
|
|
|
@@ -2,13 +2,31 @@ import React, { useCallback, useState } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { Checkbox } from "../../../index.js";
|
|
4
4
|
|
|
5
|
+
const handleChangeNoop = () => undefined;
|
|
6
|
+
|
|
5
7
|
const CheckboxDemo: React.FC = (props) => {
|
|
6
8
|
const [v, setV] = useState(false);
|
|
7
9
|
|
|
8
10
|
const handleToggle = useCallback(() => { setV((prevV) => !prevV); }, []);
|
|
9
11
|
|
|
10
12
|
return (
|
|
11
|
-
|
|
13
|
+
<>
|
|
14
|
+
<Checkbox name={"a"} onChange={handleToggle} checked={!v}>I want something something</Checkbox>
|
|
15
|
+
<hr />
|
|
16
|
+
<Checkbox name={"a"} onChange={handleChangeNoop} checked={true} disabled={true}>
|
|
17
|
+
Something else - disabled
|
|
18
|
+
</Checkbox>
|
|
19
|
+
<Checkbox name={"a"} onChange={handleChangeNoop} checked={false} disabled={true}>
|
|
20
|
+
Something else - disabled
|
|
21
|
+
</Checkbox>
|
|
22
|
+
<hr />
|
|
23
|
+
<Checkbox name={"a"} onChange={handleChangeNoop} checked={true} readOnly={true}>
|
|
24
|
+
Last option - readonly
|
|
25
|
+
</Checkbox>
|
|
26
|
+
<Checkbox name={"a"} onChange={handleChangeNoop} checked={false} readOnly={true}>
|
|
27
|
+
Last option - readonly
|
|
28
|
+
</Checkbox>
|
|
29
|
+
</>
|
|
12
30
|
);
|
|
13
31
|
};
|
|
14
32
|
|
|
@@ -6,6 +6,10 @@ const InputDemo: React.FC = () => {
|
|
|
6
6
|
return (
|
|
7
7
|
<>
|
|
8
8
|
<Input placeholder={"Capacity"} prefix={<Icon name={ICON.battery} />} suffix={"kWh"} />
|
|
9
|
+
<Input value={"William J. Welter"} />
|
|
10
|
+
<Input prefix={"Text prefix"} value={"Polly W. Wilson"} />
|
|
11
|
+
<Input prefix={"Disabled"} value={"Clayton J. Foster"} disabled={true} />
|
|
12
|
+
<Input prefix={"Read only"} value={"Norma J. Gomez"} readOnly={true} />
|
|
9
13
|
</>
|
|
10
14
|
);
|
|
11
15
|
};
|
package/src/global.scss
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
--background: white;
|
|
9
9
|
|
|
10
|
-
--main-color: #008ad2;
|
|
10
|
+
--main-color: #008ad2;
|
|
11
11
|
--main-color-alt: #006AA9;
|
|
12
12
|
|
|
13
|
-
--active-bg: #
|
|
14
|
-
--inactive-bg: #d3d3d3;
|
|
13
|
+
--active-bg: #e7e7e7;
|
|
14
|
+
--inactive-bg: #d3d3d3;
|
|
15
|
+
--inactive-dark-bg: #999;
|
|
15
16
|
|
|
16
17
|
--toggle-handle-bg: #e0e0e0;
|
|
17
18
|
--toggle-handle-border: #cdcdcd;
|
|
@@ -32,6 +33,9 @@
|
|
|
32
33
|
--modal-button-bg: #f8f8f8;
|
|
33
34
|
--modal-button-border: #c2c2c2;
|
|
34
35
|
|
|
36
|
+
--input-disabled-bg: #f3f3f3;
|
|
37
|
+
--input-disabled-text: #959595;
|
|
38
|
+
|
|
35
39
|
--choice-bg: #ffffff;
|
|
36
40
|
--choice-text: #999999;
|
|
37
41
|
--choice-active-bg: #f3f3f3;
|