ywana-core8 0.0.239 → 0.0.243
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 +351 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +376 -3
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +350 -10
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +353 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/index.js +1 -1
- package/src/html/property.css +21 -3
- package/src/html/property.js +19 -3
- package/src/html/property.test.js +11 -0
- package/src/html/textarea.css +158 -0
- package/src/html/textfield.js +55 -1
- package/src/html/textfield.test.js +5 -5
- package/src/site/page.css +1 -0
- package/src/site/site.css +1 -0
- package/src/widgets/index.js +2 -1
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'
|
package/src/html/property.css
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
.property {
|
2
2
|
flex:1;
|
3
|
+
max-height: 3rem;
|
3
4
|
display: flex;
|
5
|
+
flex-direction: row;
|
4
6
|
}
|
5
7
|
|
6
8
|
.property-name {
|
@@ -8,8 +10,9 @@
|
|
8
10
|
overflow: hidden;
|
9
11
|
text-overflow: ellipsis;
|
10
12
|
white-space: nowrap;
|
11
|
-
|
12
|
-
|
13
|
+
display: flex;
|
14
|
+
align-items: center;
|
15
|
+
padding: .5rem;
|
13
16
|
}
|
14
17
|
|
15
18
|
.property-value {
|
@@ -17,5 +20,20 @@
|
|
17
20
|
overflow: hidden;
|
18
21
|
text-overflow: ellipsis;
|
19
22
|
white-space: nowrap;
|
20
|
-
|
23
|
+
display: flex;
|
24
|
+
align-items: center;
|
25
|
+
position: relative;
|
26
|
+
}
|
27
|
+
|
28
|
+
.property-value>input {
|
29
|
+
width: 100%;
|
30
|
+
height: 100%;
|
31
|
+
border: solid 0px;
|
32
|
+
background-color: rgba(240,240,240,.5);
|
33
|
+
padding: .5rem;
|
34
|
+
}
|
35
|
+
|
36
|
+
.property-value>.icon {
|
37
|
+
position: absolute;
|
38
|
+
right: .5rem;
|
21
39
|
}
|
package/src/html/property.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react'
|
2
|
+
import { Icon } from './icon'
|
2
3
|
import './property.css'
|
3
4
|
|
4
5
|
/**
|
@@ -6,12 +7,27 @@ import './property.css'
|
|
6
7
|
*/
|
7
8
|
export const Property = (props) => {
|
8
9
|
|
9
|
-
const { label, name, value} = props
|
10
|
+
const { id, className, label, name, initial, value, editable = false, onChange } = props
|
11
|
+
|
12
|
+
function change(event) {
|
13
|
+
if (onChange) {
|
14
|
+
const value = event.target.value
|
15
|
+
onChange(id, value)
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
function clear() {
|
20
|
+
if (onChange) onChange("")
|
21
|
+
}
|
10
22
|
|
11
23
|
return (
|
12
|
-
<div className=
|
24
|
+
<div className={`property property-${id} ${className}`}>
|
13
25
|
<div className="property-name">{name || label}</div>
|
14
|
-
<div className=
|
26
|
+
{ initial ? <div className='property-value'>{initial}</div> : null}
|
27
|
+
<div className="property-value">
|
28
|
+
{editable ? <input type="text" value={value} onChange={change}/> : value}
|
29
|
+
{editable && value.length > 0 ? <Icon icon="close" size="small" clickable action={clear} /> : null }
|
30
|
+
</div>
|
15
31
|
</div>
|
16
32
|
)
|
17
33
|
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Property } from './property'
|
3
|
+
|
4
|
+
const PropertyTest = (prop) => {
|
5
|
+
return (
|
6
|
+
<>
|
7
|
+
<Property label="Name" initial="John" value="Johnny" editable={true}/>
|
8
|
+
<Property label="Address" initial="Porto Colon" value="Conchali 40" editable={true}/>
|
9
|
+
</>
|
10
|
+
)
|
11
|
+
}
|
@@ -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
|
@@ -28,7 +29,7 @@ export const TextField = (props) => {
|
|
28
29
|
}
|
29
30
|
|
30
31
|
function focus() {
|
31
|
-
if (site) {
|
32
|
+
if (site && site.changeFocus) {
|
32
33
|
site.changeFocus({
|
33
34
|
lose: () => {
|
34
35
|
// DO NOTHING
|
@@ -56,6 +57,59 @@ 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
|
+
console.log(value)
|
81
|
+
if (onChange) onChange(id, value)
|
82
|
+
}
|
83
|
+
|
84
|
+
function focus() {
|
85
|
+
if (site && site.changeFocus) {
|
86
|
+
site.changeFocus({
|
87
|
+
lose: () => {
|
88
|
+
// DO NOTHING
|
89
|
+
}
|
90
|
+
})
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
function clear() {
|
95
|
+
if (onChange) onChange(id, "")
|
96
|
+
}
|
97
|
+
|
98
|
+
const labelStyle = label ? "" : "no-label"
|
99
|
+
const style = `textarea ${labelStyle} textarea-${type}`
|
100
|
+
const labelTxt = <Text>{label}</Text>
|
101
|
+
|
102
|
+
return (
|
103
|
+
<div className={`${style}`} onClick={onClick}>
|
104
|
+
<textarea id={id} placeholder={placeholder} value={value} required onChange={change} onKeyDown={onKeyPress} onFocus={focus} readOnly={readOnly} />
|
105
|
+
{!readOnly && canClear && value && value.length > 0 ? <Icon icon="close" clickable size="small" action={clear} /> : null }
|
106
|
+
<span className="bar"></span>
|
107
|
+
{label ? <label>{labelTxt}</label> : null}
|
108
|
+
</div>
|
109
|
+
)
|
110
|
+
}
|
111
|
+
|
112
|
+
|
59
113
|
/**
|
60
114
|
* Dropdown
|
61
115
|
*/
|
@@ -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={form.text1} 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
|
}
|
package/src/site/page.css
CHANGED
package/src/site/site.css
CHANGED
package/src/widgets/index.js
CHANGED