ywana-core8 0.0.349 → 0.0.350

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.349",
3
+ "version": "0.0.350",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -12,6 +12,10 @@
12
12
  z-index: 100;
13
13
  }
14
14
 
15
+ .overlay.prompt {
16
+ z-index: 1000;
17
+ }
18
+
15
19
  .dialog {
16
20
  border-radius: 4px;
17
21
  position: absolute;
@@ -25,6 +29,10 @@
25
29
  justify-content: center;
26
30
  }
27
31
 
32
+ .dialog.prompt {
33
+ z-index: 1010;
34
+ }
35
+
28
36
  .dialog-panel {
29
37
  min-width: 500px;
30
38
  max-width: 90%;
@@ -9,6 +9,7 @@ import './dialog.css'
9
9
  * <Dialog title={title} open={true} onAction={onAction} actions={actions}>
10
10
  */
11
11
  export const Dialog = (props) => {
12
+
12
13
  const site = useContext(SiteContext)
13
14
  const { icon, title = "Dialog", children, onAction, actions, className, eventPropagation = false } = props
14
15
 
@@ -25,7 +26,7 @@ export const Dialog = (props) => {
25
26
 
26
27
  return (
27
28
  <Fragment>
28
- <div className="overlay" />
29
+ <div className={`overlay ${className}`} />
29
30
  <div className={`dialog ${className}`} onClick={close}>
30
31
  <div className="dialog-panel" onClick={prevent}>
31
32
  <header>
package/src/site/site.js CHANGED
@@ -24,6 +24,7 @@ export const SiteProvider = ({ children, siteLang, siteDictionary, showConsole }
24
24
  const [console, setConsole] = useState(false)
25
25
  const [page, setPage] = useState()
26
26
  const [dialog, setDialog] = useState()
27
+ const [promptDialog, setPromptDialog] = useState()
27
28
  const [preview, setPreview] = useState()
28
29
  const [breadcrumb, setBreadcrumb] = useState()
29
30
  const [focused, setFocused] = useState()
@@ -72,6 +73,10 @@ export const SiteProvider = ({ children, siteLang, siteDictionary, showConsole }
72
73
  confirm: (message) => window.confirm(message),
73
74
  prompt: (message) => window.prompt(message),
74
75
 
76
+ promptDialog,
77
+ openPromptDialog: (dialog) => {setPromptDialog(dialog)},
78
+ closePromptDialog: () => { setPromptDialog(null)},
79
+
75
80
  notify: ({ title, body, type = "success" }) => {
76
81
  Store.addNotification({
77
82
  title,
@@ -113,6 +118,7 @@ export const Site = ({ icon, logo, title, toolbar, children, init, min, lang, di
113
118
  <SiteAside />
114
119
  <SiteConsole />
115
120
  <SiteDialog />
121
+ <SitePromptDialog />
116
122
  <SitePreview />
117
123
  <SiteNotifications />
118
124
  </div>
@@ -249,6 +255,15 @@ const SiteDialog = () => {
249
255
  return context.dialog ? context.dialog : ''
250
256
  }
251
257
 
258
+
259
+ /**
260
+ * Site Promtp Dialog
261
+ */
262
+ const SitePromptDialog = () => {
263
+ const context = useContext(SiteContext)
264
+ return context.promptDialog ? context.promptDialog : ''
265
+ }
266
+
252
267
  /**
253
268
  * Site Preview
254
269
  */
@@ -5,6 +5,8 @@ import { Page } from './page'
5
5
  import './site.css'
6
6
  import './page.css'
7
7
  import { TablePage } from '../domain/TablePage'
8
+ import { Dialog } from './dialog'
9
+ import { Button } from '../html'
8
10
 
9
11
  const SiteTest = (prop) => {
10
12
  return (
@@ -37,10 +39,40 @@ const Page1 = (props) => {
37
39
  }
38
40
 
39
41
  const Page2 = (props) => {
42
+
43
+ const site = useContext(SiteContext)
44
+
45
+ function prompt() {
46
+ const actions = (
47
+ <Fragment>
48
+ <Button label="CLOSE" action={() => site.closePromptDialog()} />
49
+ </Fragment>
50
+ )
51
+ site.openPromptDialog(<Dialog className="prompt" actions={actions} >PROMPT</Dialog>)
52
+ }
53
+
54
+ function openDialog() {
55
+
56
+ const actions = (
57
+ <Fragment>
58
+ <Button label="CLOSE" action={() => site.closeDialog()} />
59
+ </Fragment>
60
+ )
61
+ site.openDialog(
62
+ <Dialog actions={actions}>
63
+ <main>
64
+ <Button label="open Custom Prompt" action={prompt} />
65
+ </main>
66
+ </Dialog>
67
+ )
68
+ }
69
+
40
70
  return (
41
71
  <Fragment>
42
72
  <header>Page 2</header>
43
- <main></main>
73
+ <main>
74
+ <Button label="open Dialog" action={openDialog} />
75
+ </main>
44
76
  <footer>f2</footer>
45
77
  </Fragment>
46
78
  )