@yakad/ui 1.2.13 → 1.2.15-beta
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/codeField/codeField.d.ts +6 -0
- package/codeField/codeField.js +10 -0
- package/codeField/codeField.js.map +1 -0
- package/codeField/codeField.module.css +23 -0
- package/codeField/codeField.tsx +27 -0
- package/index.tsx +4 -1
- package/inputField/inputField.d.ts +9 -0
- package/inputField/inputField.js +11 -0
- package/inputField/inputField.js.map +1 -0
- package/inputField/inputField.module.css +78 -0
- package/inputField/inputField.tsx +32 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { joinClassNames, joinStyles } from "@yakad/lib";
|
|
3
|
+
import styles from "./codeField.module.css";
|
|
4
|
+
function CodeField(props) {
|
|
5
|
+
const joinedClassNames = joinClassNames(styles.input, props.className);
|
|
6
|
+
const joinedStyles = joinStyles({ width: "calc(1.5ch * " + props.length + ")" }, props.style);
|
|
7
|
+
return (React.createElement("input", { minLength: props.length, maxLength: props.length, className: joinedClassNames, style: joinedStyles }));
|
|
8
|
+
}
|
|
9
|
+
export default CodeField;
|
|
10
|
+
//# sourceMappingURL=codeField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeField.js","sourceRoot":"","sources":["codeField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAM5C,SAAS,SAAS,CAAC,KAAsB;IACrC,MAAM,gBAAgB,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,SAAU,CAAC,CAAC;IAExE,MAAM,YAAY,GAAG,UAAU,CAC3B,EAAE,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,MAAM,GAAG,GAAG,EAAE,EAC/C,KAAK,CAAC,KAAM,CACf,CAAC;IAEF,OAAO,CACH,+BACI,SAAS,EAAE,KAAK,CAAC,MAAM,EACvB,SAAS,EAAE,KAAK,CAAC,MAAM,EACvB,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,YAAY,GACrB,CACL,CAAC;AACN,CAAC;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.input {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
display: block;
|
|
4
|
+
border: none;
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: 0;
|
|
7
|
+
margin-left: 0.5ch;
|
|
8
|
+
background: repeating-linear-gradient(
|
|
9
|
+
90deg,
|
|
10
|
+
#7d7d7d 0,
|
|
11
|
+
#7d7d7d 1ch,
|
|
12
|
+
transparent 0,
|
|
13
|
+
transparent 1.5ch
|
|
14
|
+
)
|
|
15
|
+
0 100%/100% 0.2rem no-repeat;
|
|
16
|
+
color: transparent;
|
|
17
|
+
text-shadow: 0 0 0 var(--onSurfaceColor);
|
|
18
|
+
font: 5ch consolas, monospace;
|
|
19
|
+
letter-spacing: 0.5ch;
|
|
20
|
+
}
|
|
21
|
+
.input:focus {
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { joinClassNames, joinStyles } from "@yakad/lib";
|
|
3
|
+
import styles from "./codeField.module.css";
|
|
4
|
+
|
|
5
|
+
interface CodeFieldsProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
|
+
length?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function CodeField(props: CodeFieldsProps) {
|
|
10
|
+
const joinedClassNames = joinClassNames(styles.input, props.className!);
|
|
11
|
+
|
|
12
|
+
const joinedStyles = joinStyles(
|
|
13
|
+
{ width: "calc(1.5ch * " + props.length + ")" },
|
|
14
|
+
props.style!
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<input
|
|
19
|
+
minLength={props.length}
|
|
20
|
+
maxLength={props.length}
|
|
21
|
+
className={joinedClassNames}
|
|
22
|
+
style={joinedStyles}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default CodeField;
|
package/index.tsx
CHANGED
|
@@ -17,7 +17,8 @@ import Spacer from "./spacer/spacer";
|
|
|
17
17
|
import Stack from "./stack/stack";
|
|
18
18
|
import SvgIcon from "./svgIcon/svgIcon";
|
|
19
19
|
import Loading from "./loading/loading";
|
|
20
|
-
|
|
20
|
+
import CodeField from "./codeField/codeField";
|
|
21
|
+
import InputField from "./inputField/inputField";
|
|
21
22
|
export {
|
|
22
23
|
Button,
|
|
23
24
|
AppBar,
|
|
@@ -38,4 +39,6 @@ export {
|
|
|
38
39
|
Spacer,
|
|
39
40
|
SvgIcon,
|
|
40
41
|
Loading,
|
|
42
|
+
CodeField,
|
|
43
|
+
InputField,
|
|
41
44
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface InputFieldProps extends React.HTMLAttributes<HTMLInputElement> {
|
|
3
|
+
variant?: "standard" | "outlined" | "filled";
|
|
4
|
+
type?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare function InputField(props: InputFieldProps): JSX.Element;
|
|
9
|
+
export default InputField;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { joinClassNames } from "@yakad/lib";
|
|
3
|
+
import styles from "./inputField.module.css";
|
|
4
|
+
function InputField(props) {
|
|
5
|
+
const joinedClassNames = joinClassNames(styles.input, props.variant ? styles[props.variant] : styles.standard, props.className);
|
|
6
|
+
return (React.createElement("label", { className: styles.field },
|
|
7
|
+
React.createElement("input", { disabled: props.disabled, placeholder: "\u00A0", type: props.type, className: joinedClassNames }),
|
|
8
|
+
React.createElement("span", { className: styles.placeholder }, props.placeholder)));
|
|
9
|
+
}
|
|
10
|
+
export default InputField;
|
|
11
|
+
//# sourceMappingURL=inputField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputField.js","sourceRoot":"","sources":["inputField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAS7C,SAAS,UAAU,CAAC,KAAsB;IACtC,MAAM,gBAAgB,GAAG,cAAc,CACnC,MAAM,CAAC,KAAK,EACZ,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EACvD,KAAK,CAAC,SAAU,CACnB,CAAC;IAEF,OAAO,CACH,+BAAO,SAAS,EAAE,MAAM,CAAC,KAAK;QAC1B,+BACI,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,WAAW,EAAC,QAAQ,EACpB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,SAAS,EAAE,gBAAgB,GAC7B;QACF,8BAAM,SAAS,EAAE,MAAM,CAAC,WAAW,IAAG,KAAK,CAAC,WAAW,CAAQ,CAC3D,CACX,CAAC;AACN,CAAC;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
.field {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
.placeholder {
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0rem;
|
|
7
|
+
left: 1.2rem;
|
|
8
|
+
transform: translateY(-50%);
|
|
9
|
+
font-size: 1rem;
|
|
10
|
+
color: var(--onBackgroundColor);
|
|
11
|
+
transition: top 0.3s ease, font-size 0.3s ease, color 0.3s ease;
|
|
12
|
+
}
|
|
13
|
+
.input:placeholder-shown + .placeholder {
|
|
14
|
+
top: 50%;
|
|
15
|
+
font-size: 1.4rem;
|
|
16
|
+
color: #7d7d7d;
|
|
17
|
+
}
|
|
18
|
+
.input:focus + .placeholder {
|
|
19
|
+
top: 0rem;
|
|
20
|
+
font-size: 1rem;
|
|
21
|
+
color: var(--onBackgroundColor);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.input {
|
|
25
|
+
width: 100%;
|
|
26
|
+
padding: 1.2rem;
|
|
27
|
+
border: none;
|
|
28
|
+
outline: none;
|
|
29
|
+
transition: border-color 0.3 ease;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
color: var(--onBackgroundColor);
|
|
32
|
+
-webkit-appearance: none;
|
|
33
|
+
-ms-appearance: none;
|
|
34
|
+
-moz-appearance: none;
|
|
35
|
+
appearance: none;
|
|
36
|
+
}
|
|
37
|
+
.input::after {
|
|
38
|
+
font-size: 1.4rem;
|
|
39
|
+
display: block;
|
|
40
|
+
background-color: red;
|
|
41
|
+
content: "Hello";
|
|
42
|
+
z-index: 10;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.input.standard {
|
|
46
|
+
border-radius: 0.3rem 0.3rem 0 0;
|
|
47
|
+
border-bottom: 0.2rem solid #7d7d7d;
|
|
48
|
+
background-color: #7d7d7d10;
|
|
49
|
+
}
|
|
50
|
+
.input.standard:valid,
|
|
51
|
+
.input.standard:focus {
|
|
52
|
+
border-color: var(--primaryColor);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.input.outlined {
|
|
56
|
+
border-radius: 0.5rem;
|
|
57
|
+
border: 0.2rem solid #ddd;
|
|
58
|
+
background: none;
|
|
59
|
+
}
|
|
60
|
+
.input.outlined + .placeholder {
|
|
61
|
+
padding: 0 0.5rem;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.input.outlined:valid,
|
|
65
|
+
.input.outlined:focus + .placeholder {
|
|
66
|
+
border-color: var(--onBackgroundColor);
|
|
67
|
+
background: var(--surfaceColor);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.input.filled {
|
|
71
|
+
border-radius: 0.5rem;
|
|
72
|
+
background-color: #7d7d7d10;
|
|
73
|
+
box-shadow: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.input:invalid {
|
|
77
|
+
border-color: var(--errorColor);
|
|
78
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { joinClassNames } from "@yakad/lib";
|
|
3
|
+
import styles from "./inputField.module.css";
|
|
4
|
+
|
|
5
|
+
interface InputFieldProps extends React.HTMLAttributes<HTMLInputElement> {
|
|
6
|
+
variant?: "standard" | "outlined" | "filled";
|
|
7
|
+
type?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function InputField(props: InputFieldProps) {
|
|
13
|
+
const joinedClassNames = joinClassNames(
|
|
14
|
+
styles.input,
|
|
15
|
+
props.variant ? styles[props.variant] : styles.standard,
|
|
16
|
+
props.className!
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<label className={styles.field}>
|
|
21
|
+
<input
|
|
22
|
+
disabled={props.disabled}
|
|
23
|
+
placeholder=" "
|
|
24
|
+
type={props.type}
|
|
25
|
+
className={joinedClassNames}
|
|
26
|
+
/>
|
|
27
|
+
<span className={styles.placeholder}>{props.placeholder}</span>
|
|
28
|
+
</label>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default InputField;
|