ywana-core8 0.0.942 → 0.0.943

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.942",
3
+ "version": "0.0.943",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
package/src/html/tab.js CHANGED
@@ -10,7 +10,8 @@ export const Tabs = (props) => {
10
10
 
11
11
  const { children, selected, onChange, fillLeft=false, fillRight=true } = props
12
12
 
13
- const tabs = React.Children.map(children, (child, index) => {
13
+ const notNullChildren = React.Children.toArray(children).filter(child => child !== null)
14
+ const tabs = notNullChildren.map((child, index) => {
14
15
 
15
16
  function select(id) {
16
17
  if (onChange) onChange(id || index)
@@ -61,9 +62,9 @@ export const Tab = (props) => {
61
62
 
62
63
  const { selected = 0 } = props
63
64
 
64
- const child = React.Children
65
- .toArray(props.children)
66
- .filter((child, index) => index === selected )[0]
65
+ const notNullChildren = React.Children.toArray(props.children).filter(child => child !== null)
66
+
67
+ const child = notNullChildren.filter((child, index) => index === selected )[0]
67
68
 
68
69
  return (
69
70
  <Fragment>
@@ -1,16 +1,25 @@
1
1
  import React, { useState } from 'react'
2
- import { Icon } from '.'
2
+ import { Icon, Stack } from '.'
3
3
  import { Tabs, Tab } from './tab'
4
4
 
5
5
  const TabTest = (prop) => {
6
6
 
7
+ const [selected, setSelected] = useState(0)
8
+
7
9
  return (
8
10
  <>
9
- <Tabs>
11
+ <Tabs selected={selected} onChange={(id) => setSelected(id) }>
12
+ {null}
10
13
  <Tab label="tab1" action={<Icon icon="close" size="small" />} />
11
14
  <Tab label="tab2" action={<Icon icon="close" size="small" />} />
12
15
  <Tab label="tab3" action={<Icon icon="close" size="small" />} />
13
16
  </Tabs>
17
+ <Stack selected={selected}>
18
+ <div>Content 1</div>
19
+ {null}
20
+ <div>Content 2</div>
21
+ <div>Content 3</div>
22
+ </Stack>
14
23
  </>
15
24
  )
16
25
  }
@@ -41,6 +41,10 @@ export const Planner2 = ({ from, to, lanes = [], events = [], cellWidth = 10, ro
41
41
  if (onSelectCell) onSelectCell(cell)
42
42
  }
43
43
 
44
+ function drop() {
45
+ //TODO
46
+ }
47
+
44
48
  const uniqueMonths = Array.from(
45
49
  new Set(days.map(({ month }) => month))
46
50
  );
@@ -108,7 +112,12 @@ export const Planner2 = ({ from, to, lanes = [], events = [], cellWidth = 10, ro
108
112
  });
109
113
  const weekendClass = isWeekend ? 'weekend' : '';
110
114
  return (
111
- <div className={`content-cell ${weekendClass}`} style={{ minWidth: dayWidth, maxWidth: dayWidth }} key={`content${index}_${year}-${month}-${day}`} onClick={() => selectCell({ lane: lane.id, date: dayDate })}>
115
+ <div
116
+ key={`content${index}_${year}-${month}-${day}`}
117
+ className={`content-cell ${weekendClass}`} style={{ minWidth: dayWidth, maxWidth: dayWidth }}
118
+ onClick={() => selectCell({ lane: lane.id, date: dayDate })}
119
+ onDrop={drop}
120
+ >
112
121
  {dayEvents.map((event, index) => <EventRenderer key={`${event.id}-${index}`} event={event} />)}
113
122
  </div>
114
123
  )