ywana-core8 0.0.736 → 0.0.738
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/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +12 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +4 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +4 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/textfield.css +12 -0
- package/src/html/textfield.js +3 -2
- package/src/html/textfield.test.js +10 -3
package/package.json
CHANGED
package/src/html/textfield.css
CHANGED
@@ -13,6 +13,10 @@
|
|
13
13
|
padding-bottom: .5rem;
|
14
14
|
}
|
15
15
|
|
16
|
+
.textfield.label-left {
|
17
|
+
flex-direction: row-reverse;
|
18
|
+
}
|
19
|
+
|
16
20
|
.textfield > input {
|
17
21
|
flex: 1;
|
18
22
|
padding: 10px 10px 10px .5rem;
|
@@ -60,6 +64,14 @@
|
|
60
64
|
-webkit-transition: 0.2s ease all;
|
61
65
|
}
|
62
66
|
|
67
|
+
.textfield.label-left > label {
|
68
|
+
position: relative;
|
69
|
+
margin-right: .5rem;
|
70
|
+
top: .3rem;
|
71
|
+
font-size: .8rem;
|
72
|
+
color: var(--primary-color);
|
73
|
+
}
|
74
|
+
|
63
75
|
.textfield > label .row .icon,
|
64
76
|
.textfield-outlined > label .row .icon {
|
65
77
|
width: 1.2rem;
|
package/src/html/textfield.js
CHANGED
@@ -12,7 +12,7 @@ import './textarea.css'
|
|
12
12
|
export const TextField = (props) => {
|
13
13
|
|
14
14
|
const site = useContext(SiteContext)
|
15
|
-
const { id, type = 'text', label, placeholder, value, outlined, readOnly = false, canClear = true, onChange, onEnter, onClick, onBlur } = props
|
15
|
+
const { id, type = 'text', label, labelPosition = 'top', placeholder, value, outlined, readOnly = false, canClear = true, onChange, onEnter, onClick, onBlur } = props
|
16
16
|
|
17
17
|
function onKeyPress(event) {
|
18
18
|
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
|
@@ -48,7 +48,8 @@ export const TextField = (props) => {
|
|
48
48
|
|
49
49
|
const borderStyle = outlined ? "textfield-outlined" : "textfield"
|
50
50
|
const labelStyle = label ? "" : "no-label"
|
51
|
-
const
|
51
|
+
const labelPositionStyle = labelPosition == 'left' ? "label-left" : "label-top"
|
52
|
+
const style = `${labelStyle} ${labelPositionStyle} ${borderStyle} textfield-${type}`
|
52
53
|
const labelTxt = <Text>{label}</Text>
|
53
54
|
|
54
55
|
return (
|
@@ -6,7 +6,8 @@ import { DateRange } from './textfield'
|
|
6
6
|
const TextFieldTest = (prop) => {
|
7
7
|
|
8
8
|
const [form, setForm] = useState({
|
9
|
-
gender3: "3"
|
9
|
+
gender3: "3",
|
10
|
+
labelLeft: "xxxxx"
|
10
11
|
})
|
11
12
|
|
12
13
|
function change(id, value) {
|
@@ -31,16 +32,22 @@ const TextFieldTest = (prop) => {
|
|
31
32
|
|
32
33
|
return (
|
33
34
|
<>
|
34
|
-
<
|
35
|
+
<TextField id="labelLeft" labelPosition="left" label="Label Left" value={form.labelLeft} onChange={change}/>
|
36
|
+
<TextField id="name" label="Name" value={form.name} onChange={change}/>
|
37
|
+
<br/>
|
38
|
+
<DropDown id="b1" label="Boolean1" labelPosition="left" onChange={change} options={options2} value={form.b1} />
|
39
|
+
<br/>
|
35
40
|
<DropDown id="gender1" label="Dropdown 1" value={form.gender1} onChange={change} options={options} predictive={false}/>
|
36
41
|
<DropDown id="gender2" label="Dropdown 2" value={form.gender2} onChange={change} options={options} predictive={true}/>
|
37
42
|
<DropDown id="gender3" label="Dropdown 3" value={form.gender3} onChange={change} options={options} predictive={false} editable={true}/>
|
38
43
|
<TokenField id="token1" label="Tokens" onChange={change} />
|
39
44
|
<TokenField id="token2" label="Tokens DropDown" onChange={change} options={options} tokens={form.token2}/>
|
40
|
-
<
|
45
|
+
<br/>
|
46
|
+
<br/>
|
41
47
|
<TextArea id="text1" label="Text 1" value={form.text1} onChange={change} />
|
42
48
|
<TextField id="date1" type="DATE" label="Date" value={form.date1} onChange={change} />
|
43
49
|
<DateRange id="range1" value={form.range1} onChange={change}/>
|
50
|
+
|
44
51
|
</>
|
45
52
|
)
|
46
53
|
}
|