ywana-core8 0.0.181 → 0.0.185

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.181",
3
+ "version": "0.0.185",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -0,0 +1,37 @@
1
+ const reactpreview = require("@reactpreview/config");
2
+
3
+ module.exports = reactpreview.config({
4
+ /**
5
+ * Configure custom aliases (auto-detected if you use TypeScript).
6
+ */
7
+ alias: {
8
+ foo: "src/foo"
9
+ },
10
+
11
+ /**
12
+ * Configure a public assets directory.
13
+ */
14
+ publicDir: "public",
15
+
16
+ /**
17
+ * Set up a custom component to wrap around previewed components.
18
+ *
19
+ * Useful to set up context providers and CSS dependencies.
20
+ */
21
+ wrapper: {
22
+ path: "src/ReactPreviewWrapper.js",
23
+ componentName: "Wrapper"
24
+ },
25
+
26
+ /**
27
+ * Customise the exported React component name for SVG files.
28
+ */
29
+ svgr: {
30
+ componentName: "default"
31
+ },
32
+
33
+ /**
34
+ * Specify a custom Vite configuration.
35
+ */
36
+ vite: vite.UserConfig;
37
+ });
@@ -239,7 +239,7 @@ const EntityEditor = ({ field, value = {}, onChange }) => {
239
239
  * String Editor
240
240
  */
241
241
  export const StringEditor = ({ field, value = '', onChange, content, outlined }) => {
242
- const { id, format, label, options, editable = true, predictive = false } = field
242
+ const { id, format, label, options, editable = true, predictive = false, Editor } = field
243
243
 
244
244
  function change(id, value) {
245
245
  if (onChange) onChange(id, value)
@@ -252,6 +252,9 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
252
252
 
253
253
  return (
254
254
  <div className='field-editor string-editor'>
255
+
256
+ { format === FORMATS.HTML ? <Editor value={value}/> : null}
257
+
255
258
  {
256
259
  format === FORMATS.DATE ? <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} /> :
257
260
  options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={predictive} /> :
@@ -17,6 +17,7 @@ export const FORMATS = {
17
17
  NONE: '',
18
18
  DATE: 'date',
19
19
  EMAIL: 'email',
20
+ HTML: 'HTML'
20
21
  }
21
22
 
22
23
  /**
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
- import './button.css'
3
2
  import { Icon } from './icon'
3
+ import './button.css'
4
4
 
5
5
  /**
6
6
  * HTML Button
@@ -0,0 +1,38 @@
1
+ import React from 'react'
2
+ import './button.css'
3
+ import { Icon } from './icon'
4
+
5
+
6
+ interface Button2Props {
7
+ label: String
8
+ icon: String
9
+ action: () => {},
10
+ disabled: Boolean,
11
+ outlined: Boolean,
12
+ raised: Boolean
13
+ }
14
+
15
+ /**
16
+ * HTML Button
17
+ */
18
+ export const Button2 = (props: Button2Props) => {
19
+
20
+ const { label,icon, action, disabled, outlined, raised} = props
21
+
22
+ function click(event) {
23
+ if (!disabled) {
24
+ event.stopPropagation();
25
+ event.preventDefault();
26
+ if (action) action()
27
+ }
28
+ }
29
+
30
+ let style = raised ? 'raised' : outlined ? 'outlined' : 'normal'
31
+ if (disabled) style = `${style} disabled`
32
+ return (
33
+ <button className={`btn ${style}`} onClick={click}>
34
+ { icon ? <Icon icon={icon} size="small" clickable action={click} /> : null }
35
+ <span>{ label }</span>
36
+ </button>
37
+ )
38
+ }
package/src/test.js ADDED
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="x">
3
+ XXX
4
+ </div>
5
+ </template>