@onehat/ui 0.2.6 → 0.2.8

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": "@onehat/ui",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -25,12 +25,12 @@
25
25
  "ckeditor5-custom-build": "file:ckeditor5",
26
26
  "js-cookie": "^3.0.1",
27
27
  "native-base": "^3.4.25",
28
+ "react-datetime": "^3.2.0",
28
29
  "react-hook-form": "^7.43.1"
29
30
  },
30
31
  "peerDependencies": {
31
32
  "react": "*",
32
33
  "react-color": "^2.19.3",
33
- "react-datetime": "^3.2.0",
34
34
  "react-draggable": "^4.4.5",
35
35
  "react-dom": "*",
36
36
  "react-native": "*"
@@ -1,4 +1,4 @@
1
- import { useEffect, useState, } from 'react';
1
+ import { useEffect, useState, isValidElement, } from 'react';
2
2
  import {
3
3
  Box,
4
4
  Button,
@@ -251,7 +251,7 @@ function Form(props) {
251
251
  type = t;
252
252
  editorTypeProps = p;
253
253
  }
254
- if (type.match(/Combo$/) && Repository?.isRemote && !Repository?.isLoaded) {
254
+ if (type?.match && type.match(/Combo$/) && Repository?.isRemote && !Repository?.isLoaded) {
255
255
  editorTypeProps.autoLoad = true;
256
256
  }
257
257
  const Element = getComponentFromType(type);
@@ -340,6 +340,9 @@ function Form(props) {
340
340
  isDirty,
341
341
  error,
342
342
  } = fieldState;
343
+ if (isValidElement(Element)) {
344
+ throw new Error('Should not yet be valid React element. Did you use <Element> instead of () => <Element> when defining it?')
345
+ }
343
346
  let element = <Element
344
347
  name={name}
345
348
  value={value}