@onehat/ui 0.2.19 → 0.2.21

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.19",
3
+ "version": "0.2.21",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -23,16 +23,9 @@ import IconButton from '../../Buttons/IconButton.js';
23
23
  import withValue from '../../Hoc/withValue.js';
24
24
  import emptyFn from '../../../Functions/emptyFn.js';
25
25
  import Calendar from '../../Icons/Calendar.js';
26
+ import getComponentFromType from '../../../Functions/getComponentFromType.js';
26
27
  import _ from 'lodash';
27
28
 
28
- // eslint-disable-next-line
29
- let Datetime;
30
- if (CURRENT_MODE === UI_MODE_WEB) {
31
- Datetime = await import('../../../PlatformImports/Web/Datetime.js');
32
- } else if (CURRENT_MODE === UI_MODE_REACT_NATIVE) {
33
- Datetime = await import('../../../PlatformImports/ReactNative/Datetime.js');
34
- }
35
-
36
29
 
37
30
  export function DateElement(props) {
38
31
  const {
@@ -45,6 +38,7 @@ export function DateElement(props) {
45
38
  tooltipPlacement = 'bottom',
46
39
  } = props,
47
40
  styles = UiGlobals.styles,
41
+ Datetime = getComponentFromType('Draggable'),
48
42
  inputRef = useRef(),
49
43
  triggerRef = useRef(),
50
44
  pickerRef = useRef(),
@@ -12,15 +12,7 @@ import useBlocking from '../../Hooks/useBlocking.js';
12
12
  import {
13
13
  v4 as uuid,
14
14
  } from 'uuid';
15
-
16
-
17
- // eslint-disable-next-line
18
- let Draggable;
19
- if (CURRENT_MODE === UI_MODE_WEB) {
20
- Draggable = await import('../../PlatformImports/Web/Draggable.js');
21
- } else if (CURRENT_MODE === UI_MODE_REACT_NATIVE) {
22
- Draggable = await import('../../PlatformImports/ReactNative/Draggable.js');
23
- }
15
+ import getComponentFromType from '../../Functions/getComponentFromType.js';
24
16
 
25
17
 
26
18
 
@@ -48,6 +40,7 @@ export default function withDraggable(WrappedComponent) {
48
40
  // for local use
49
41
  mode = HORIZONTAL, // HORIZONTAL, VERTICAL
50
42
  } = props,
43
+ Draggable = getComponentFromType('Draggable'),
51
44
  [isDragging, setIsDraggingRaw] = useState(false),
52
45
  [node, setNode] = useState(false),
53
46
  [bounds, setBounds] = useState(null),
@@ -0,0 +1,11 @@
1
+ import UiGlobals from '../UiGlobals.js';
2
+ import Datetime from '../PlatformImports/ReactNative/Datetime';
3
+ import Draggable from '../PlatformImports/ReactNative/Draggable';
4
+ import _ from 'lodash';
5
+
6
+ export function registerReactNativeComponents() {
7
+ _.merge(UiGlobals.components, {
8
+ Datetime,
9
+ Draggable,
10
+ });
11
+ }
@@ -1,9 +1,13 @@
1
1
  import UiGlobals from '../UiGlobals.js';
2
2
  import CKEditor from '../Components/Form/Field/CKEditor/CKEditor.js';
3
+ import Datetime from '../PlatformImports/Web/Datetime.js';
4
+ import Draggable from '../PlatformImports/Web/Draggable.js';
3
5
  import _ from 'lodash';
4
6
 
5
- export function registerWebComponents() {
7
+ export default function registerWebComponents() {
6
8
  _.merge(UiGlobals.components, {
7
9
  CKEditor,
10
+ Datetime,
11
+ Draggable,
8
12
  });
9
13
  }