ywana-core8 0.0.239 → 0.0.240
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 +75 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +169 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +75 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +75 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/index.js +1 -1
- package/src/html/textarea.css +158 -0
- package/src/html/textfield.js +53 -0
- package/src/html/textfield.test.js +5 -5
package/package.json
CHANGED
package/src/html/index.js
CHANGED
@@ -13,7 +13,7 @@ export { Section } from './section'
|
|
13
13
|
export { Tabs, Tab, Stack } from './tab'
|
14
14
|
export { DataTable } from './table'
|
15
15
|
export { Text } from './text'
|
16
|
-
export { TextField, DropDown } from './textfield'
|
16
|
+
export { TextField, DropDown, TextArea } from './textfield'
|
17
17
|
export { TokenField } from './tokenfield'
|
18
18
|
export { Tree, TreeNode, TreeItem } from './tree'
|
19
19
|
export { Switch } from './switch'
|
@@ -0,0 +1,158 @@
|
|
1
|
+
.textarea {
|
2
|
+
flex: 1;
|
3
|
+
position: relative;
|
4
|
+
padding-top: 1.5rem;
|
5
|
+
overflow: hidden;
|
6
|
+
display: flex;
|
7
|
+
min-height: 3.5;
|
8
|
+
}
|
9
|
+
|
10
|
+
.textarea.no-label {
|
11
|
+
padding-top: .5rem;
|
12
|
+
padding-bottom: .5rem;
|
13
|
+
}
|
14
|
+
|
15
|
+
.textarea > textarea {
|
16
|
+
flex: 1;
|
17
|
+
padding: 10px 10px 10px .5rem;
|
18
|
+
display: block;
|
19
|
+
border: none;
|
20
|
+
border-bottom: 1px solid var(--divider-color);
|
21
|
+
overflow: hidden;
|
22
|
+
font-size: 1rem;
|
23
|
+
color: var(--text-color);
|
24
|
+
background-color: var(--paper-color);
|
25
|
+
}
|
26
|
+
|
27
|
+
.textarea > textarea:focus {
|
28
|
+
outline: none;
|
29
|
+
}
|
30
|
+
|
31
|
+
.textarea>.icon {
|
32
|
+
position: absolute;
|
33
|
+
top: 1.5rem;
|
34
|
+
right: .2rem;
|
35
|
+
color: rgba(150,150,150,1);
|
36
|
+
}
|
37
|
+
|
38
|
+
.textarea-date>.icon,
|
39
|
+
.textarea-DATE>.icon {
|
40
|
+
right: 2.5rem;
|
41
|
+
}
|
42
|
+
|
43
|
+
.textarea > label {
|
44
|
+
color: var(--primary-color);
|
45
|
+
font-size: .9rem;
|
46
|
+
font-weight: normal;
|
47
|
+
position: absolute;
|
48
|
+
pointer-events: none;
|
49
|
+
left: .4rem;
|
50
|
+
top: 2rem;
|
51
|
+
transition: 0.2s ease all;
|
52
|
+
-moz-transition: 0.2s ease all;
|
53
|
+
-webkit-transition: 0.2s ease all;
|
54
|
+
}
|
55
|
+
|
56
|
+
textarea:read-only {
|
57
|
+
background-color: rgba(200,200,200,.1);
|
58
|
+
border: 0px !important;
|
59
|
+
}
|
60
|
+
|
61
|
+
.textarea textarea[type="date"] ~ label {
|
62
|
+
top: .3rem;
|
63
|
+
font-size: .8rem;
|
64
|
+
color: var(--primary-color);
|
65
|
+
}
|
66
|
+
|
67
|
+
/* active state */
|
68
|
+
textarea:read-only ~ label,
|
69
|
+
.textarea > textarea:focus ~ label,
|
70
|
+
.textarea > textarea:valid ~ label {
|
71
|
+
top: .3rem;
|
72
|
+
font-size: .8rem;
|
73
|
+
color: var(--primary-color);
|
74
|
+
}
|
75
|
+
|
76
|
+
.textarea > .bar {
|
77
|
+
position: relative;
|
78
|
+
display: block;
|
79
|
+
}
|
80
|
+
|
81
|
+
.textarea > .bar:before,
|
82
|
+
.textarea > .bar:after {
|
83
|
+
content: "";
|
84
|
+
height: 2px;
|
85
|
+
width: 0;
|
86
|
+
bottom: 1px;
|
87
|
+
position: absolute;
|
88
|
+
background: #5264ae;
|
89
|
+
transition: 0.2s ease all;
|
90
|
+
-moz-transition: 0.2s ease all;
|
91
|
+
-webkit-transition: 0.2s ease all;
|
92
|
+
}
|
93
|
+
|
94
|
+
.textarea > .bar:before {
|
95
|
+
left: 50%;
|
96
|
+
}
|
97
|
+
|
98
|
+
.textarea > .bar:after {
|
99
|
+
right: 50%;
|
100
|
+
}
|
101
|
+
|
102
|
+
/* active state */
|
103
|
+
.textarea > textarea:focus ~ .bar:before,
|
104
|
+
.textarea > textarea:focus ~ .bar:after {
|
105
|
+
width: 50%;
|
106
|
+
}
|
107
|
+
|
108
|
+
.dropdown {
|
109
|
+
position: relative;
|
110
|
+
}
|
111
|
+
|
112
|
+
.dropdown>.icon {
|
113
|
+
position: absolute;
|
114
|
+
top: 1.7rem;
|
115
|
+
right: .2rem;
|
116
|
+
}
|
117
|
+
|
118
|
+
.dropdown>.textarea>.icon,
|
119
|
+
.dropdown>.textarea-outlined>.icon {
|
120
|
+
position: absolute;
|
121
|
+
top: 1.7rem;
|
122
|
+
right: 2rem;
|
123
|
+
color: rgba(150,150,150,1);
|
124
|
+
}
|
125
|
+
|
126
|
+
.dropdown>menu {
|
127
|
+
z-index: 11;
|
128
|
+
position: absolute;
|
129
|
+
top: 3.8rem;
|
130
|
+
left: 0px;
|
131
|
+
right: 0px;
|
132
|
+
margin: 0;
|
133
|
+
border: solid 1px var(--divider-color);
|
134
|
+
color: var(--text-color);
|
135
|
+
background-color: var(--paper-color);
|
136
|
+
padding: 0;
|
137
|
+
max-height: 20rem;
|
138
|
+
overflow: auto;
|
139
|
+
}
|
140
|
+
|
141
|
+
.dropdown>menu ul {
|
142
|
+
list-style: none;
|
143
|
+
margin: 0;
|
144
|
+
padding: .5rem 0;
|
145
|
+
cursor: pointer;
|
146
|
+
}
|
147
|
+
|
148
|
+
.dropdown>menu li {
|
149
|
+
min-height: 2rem;
|
150
|
+
padding: 0 .5rem;
|
151
|
+
display: flex;
|
152
|
+
align-items: center;
|
153
|
+
font-size: .9rem;
|
154
|
+
}
|
155
|
+
|
156
|
+
.dropdown>menu li:hover {
|
157
|
+
background-color: var(--primary-color-lighter);
|
158
|
+
}
|
package/src/html/textfield.js
CHANGED
@@ -4,6 +4,7 @@ import { Icon } from './icon'
|
|
4
4
|
import { Text } from './text'
|
5
5
|
import './textfield-outlined.css'
|
6
6
|
import './textfield.css'
|
7
|
+
import './textarea.css'
|
7
8
|
|
8
9
|
/**
|
9
10
|
* Text Field
|
@@ -56,6 +57,58 @@ export const TextField = (props) => {
|
|
56
57
|
)
|
57
58
|
}
|
58
59
|
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Text Area
|
63
|
+
*/
|
64
|
+
export const TextArea = (props) => {
|
65
|
+
|
66
|
+
const site = useContext(SiteContext)
|
67
|
+
const { id, type = 'text', label, placeholder, value, outlined, readOnly = false, canClear = true, onChange, onEnter, onClick } = props
|
68
|
+
|
69
|
+
function onKeyPress(event) {
|
70
|
+
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
|
71
|
+
if (key == 13) {
|
72
|
+
if (onEnter) onEnter()
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
function change(event) {
|
77
|
+
event.stopPropagation()
|
78
|
+
event.preventDefault()
|
79
|
+
const value = event.target.value
|
80
|
+
if (onChange) onChange(id, value)
|
81
|
+
}
|
82
|
+
|
83
|
+
function focus() {
|
84
|
+
if (site) {
|
85
|
+
site.changeFocus({
|
86
|
+
lose: () => {
|
87
|
+
// DO NOTHING
|
88
|
+
}
|
89
|
+
})
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
function clear() {
|
94
|
+
if (onChange) onChange(id, "")
|
95
|
+
}
|
96
|
+
|
97
|
+
const labelStyle = label ? "" : "no-label"
|
98
|
+
const style = `textarea ${labelStyle} textarea-${type}`
|
99
|
+
const labelTxt = <Text>{label}</Text>
|
100
|
+
|
101
|
+
return (
|
102
|
+
<div className={`${style}`} onClick={onClick}>
|
103
|
+
<textarea id={id} placeholder={placeholder} value={value} required onChange={change} onKeyDown={onKeyPress} onFocus={focus} readOnly={readOnly} />
|
104
|
+
{!readOnly && canClear && value && value.length > 0 ? <Icon icon="close" clickable size="small" action={clear} /> : null }
|
105
|
+
<span className="bar"></span>
|
106
|
+
{label ? <label>{labelTxt}</label> : null}
|
107
|
+
</div>
|
108
|
+
)
|
109
|
+
}
|
110
|
+
|
111
|
+
|
59
112
|
/**
|
60
113
|
* Dropdown
|
61
114
|
*/
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
|
-
import { DropDown, TextField } from '.'
|
2
|
+
import { DropDown, TextField, TextArea } from '.'
|
3
3
|
import { Wrapper } from '../../__reactpreview__/Wrapper'
|
4
4
|
|
5
|
-
const
|
5
|
+
const TextFieldTest = (prop) => {
|
6
6
|
|
7
7
|
const [form, setForm] = useState({})
|
8
8
|
|
@@ -13,9 +13,9 @@ const KanbanTest = (prop) => {
|
|
13
13
|
|
14
14
|
return (
|
15
15
|
<>
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
<TextArea id="text1" label="Text 1" value="Lorem ipsum dolor sit amet..." onChange={change}/>
|
17
|
+
<TextField id="date1" type="DATE" label="Date" value={form.date1} onChange={change}/>
|
18
|
+
<DropDown id="gender1" label="Gender" value={form.gender1} onChange={change} options={[ {label: "Male", value: "M"}, { label: "Female", value: "F" }]} />
|
19
19
|
</>
|
20
20
|
)
|
21
21
|
}
|