ywana-core8 0.0.364 → 0.0.367

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.364",
3
+ "version": "0.0.367",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -25,6 +25,11 @@
25
25
  background-color: var(--paper-color);
26
26
  }
27
27
 
28
+ .textfield > input:read-only {
29
+ background-color: var(--paper-color);
30
+ border-bottom: 1px solid var(--divider-color) !important;
31
+ }
32
+
28
33
  .textfield > input:focus {
29
34
  outline: none;
30
35
  border-color: var(--primary-color, blue);
@@ -38,6 +38,16 @@ export const TextField = (props) => {
38
38
  }
39
39
  }
40
40
 
41
+ function focusOut() {
42
+ if (site && site.changeFocus) {
43
+ site.changeFocus({
44
+ lose: () => {
45
+ // DO NOTHING
46
+ }
47
+ })
48
+ }
49
+ }
50
+
41
51
  function clear() {
42
52
  if (onChange) onChange(id, "")
43
53
  }
@@ -49,8 +59,8 @@ export const TextField = (props) => {
49
59
 
50
60
  return (
51
61
  <div className={`${style}`} onClick={onClick}>
52
- <input id={id} type={type} placeholder={placeholder} value={value} required onChange={change} onKeyDown={onKeyPress} onFocus={focus} readOnly={readOnly} />
53
- {!readOnly && canClear && value && value.length > 0 ? <Icon icon="close" clickable size="small" action={clear} /> : null }
62
+ <input id={id} type={type} placeholder={placeholder} value={value} required onChange={change} onKeyDown={onKeyPress} onFocus={focus} onBlur={focusOut} readOnly={readOnly} />
63
+ {canClear && value && value.length > 0 ? <Icon icon="close" clickable size="small" action={clear} /> : null }
54
64
  <span className="bar"></span>
55
65
  {label ? <label>{labelTxt}</label> : null}
56
66
  </div>
@@ -169,7 +179,7 @@ export const DropDown = (props) => {
169
179
 
170
180
  return (
171
181
  <div className="dropdown">
172
- <TextField {...props} onClick={toggle} value={label} onChange={change} />
182
+ <TextField {...props} onClick={toggle} value={label} onChange={change} readOnly={!predictive}/>
173
183
  {!readOnly ? <Icon icon="expand_more" clickable size="small" action={toggle} /> : null }
174
184
  {renderOptions()}
175
185
  </div>
@@ -12,6 +12,7 @@ const TextFieldTest = (prop) => {
12
12
  }
13
13
 
14
14
  const options = [
15
+ { label: "", value: "" },
15
16
  { label: "One", value: "1" },
16
17
  { label: "Two", value: "2" },
17
18
  { label: "Three", value: "3" },
@@ -21,7 +22,9 @@ const TextFieldTest = (prop) => {
21
22
 
22
23
  return (
23
24
  <>
24
- <DropDown id="gender1" label="Dropdown" value={form.gender1} onChange={change} options={options} predictive={true}/>
25
+ <TextField id="name" label="Name" value={form.name} onChange={change} />
26
+ <DropDown id="gender1" label="Dropdown 1" value={form.gender1} onChange={change} options={options} predictive={false}/>
27
+ <DropDown id="gender2" label="Dropdown 2" value={form.gender2} onChange={change} options={options} predictive={true}/>
25
28
  <TextArea id="text1" label="Text 1" value={form.text1} onChange={change} />
26
29
  <TextField id="date1" type="DATE" label="Date" value={form.date1} onChange={change} />
27
30
  </>
@@ -4,16 +4,15 @@ import { Site } from './site'
4
4
  import { Page } from './page'
5
5
  import './site.css'
6
6
  import './page.css'
7
- import { TablePage } from '../domain/TablePage'
8
7
  import { Dialog } from './dialog'
9
- import { Button } from '../html'
8
+ import { Button, DropDown, TextField, TextArea } from '../html'
10
9
 
11
10
  const SiteTest = (prop) => {
12
11
 
13
12
  const footer = <div>FOOTER</div>
14
13
 
15
14
  return (
16
- <Site icon="star" title="Site Test" init={"PAGE2"} footer={footer}>
15
+ <Site icon="star" title="Site Test" init={"PAGE1"} footer={footer}>
17
16
  <Page id="PAGE1" section="SECTION1" icon="description" title="Page 1" layout="workspace">
18
17
  <Page1 />
19
18
  </Page>
@@ -27,14 +26,34 @@ const SiteTest = (prop) => {
27
26
  const Page1 = (props) => {
28
27
 
29
28
  const site = useContext(SiteContext)
29
+ const [form, setForm] = useState({})
30
+
30
31
  useEffect(() => {
31
32
  site.notify({ title: "Notification 1", body: "Lorem ipsum dolor sit amet" })
32
33
  }, [])
33
34
 
35
+ function change(id, value) {
36
+ const next = Object.assign({}, form, { [id]: value })
37
+ setForm(next)
38
+ }
39
+
40
+ const options = [
41
+ { label: "One", value: "1" },
42
+ { label: "Two", value: "2" },
43
+ { label: "Three", value: "3" },
44
+ { label: "Four", value: "4" },
45
+ { label: "Five", value: "5" },
46
+ ]
47
+
34
48
  return (
35
49
  <Fragment>
36
50
  <header>Page 1</header>
37
51
  <main>
52
+ <TextField id="name" label="Name" value={form.name} onChange={change} />
53
+ <DropDown id="gender1" label="Dropdown 1" value={form.gender1} onChange={change} options={options} predictive={true} />
54
+ <DropDown id="gender2" label="Dropdown 2" value={form.gender1} onChange={change} options={options} predictive={true} />
55
+ <TextArea id="text1" label="Text 1" value={form.text1} onChange={change} />
56
+ <TextField id="date1" type="DATE" label="Date" value={form.date1} onChange={change} />
38
57
  </main>
39
58
  <footer>f1</footer>
40
59
  </Fragment>