ywana-core8 0.0.242 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.242",
3
+ "version": "0.0.243",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -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
- padding: .5rem 0 .5rem .5rem;
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
- padding: .5rem .5rem .5rem 0
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
  }
@@ -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="property">
24
+ <div className={`property property-${id} ${className}`}>
13
25
  <div className="property-name">{name || label}</div>
14
- <div className="property-value">{value}</div>
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
+ }