@onehat/ui 0.2.18 → 0.2.20

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.18",
3
+ "version": "0.2.20",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -12,11 +12,6 @@ import {
12
12
  TIME,
13
13
  DATETIME,
14
14
  } from '../../../Constants/Date.js';
15
- // import DateTimePickerModal from 'react-native-modal-datetime-picker'; // https://github.com/mmazzarolo/react-native-modal-datetime-picker
16
- // import DateTimePicker from '@react-native-community/datetimepicker'; // https://github.com/react-native-datetimepicker/datetimepicker
17
- import Datetime from 'react-datetime'; // https://www.npmjs.com/package/react-datetime
18
- import 'react-datetime/css/react-datetime.css';
19
- import './datetime.css';
20
15
  import {
21
16
  UI_MODE_WEB,
22
17
  } from '../../../Constants/UiModes.js';
@@ -28,8 +23,10 @@ import IconButton from '../../Buttons/IconButton.js';
28
23
  import withValue from '../../Hoc/withValue.js';
29
24
  import emptyFn from '../../../Functions/emptyFn.js';
30
25
  import Calendar from '../../Icons/Calendar.js';
26
+ import getComponentFromType from '../../../Functions/getComponentFromType';
31
27
  import _ from 'lodash';
32
28
 
29
+
33
30
  export function DateElement(props) {
34
31
  const {
35
32
  placeholderText,
@@ -41,6 +38,7 @@ export function DateElement(props) {
41
38
  tooltipPlacement = 'bottom',
42
39
  } = props,
43
40
  styles = UiGlobals.styles,
41
+ Datetime = getComponentFromType('Draggable'),
44
42
  inputRef = useRef(),
45
43
  triggerRef = useRef(),
46
44
  pickerRef = useRef(),
@@ -226,8 +224,6 @@ export function DateElement(props) {
226
224
  pickerValue = pickerValue.toDate();
227
225
  }
228
226
 
229
- const DT = Datetime.default || Datetime; // this shouldn't be necessary, but I couldn't get it to work unless doing this! Something is screwey with the ES6 import of Datetime.
230
-
231
227
  // Web version
232
228
  return <Tooltip label={tooltip} placement={tooltipPlacement}>
233
229
  <Row flex={1} h="100%" alignItems="center" onLayout={() => setIsRendered(true)}>
@@ -322,7 +318,7 @@ export function DateElement(props) {
322
318
  ref={pickerRef}
323
319
  p={0}
324
320
  >
325
- <DT
321
+ <Datetime
326
322
  open={true}
327
323
  input={false}
328
324
  closeOnClickOutside={false}
@@ -12,9 +12,7 @@ import useBlocking from '../../Hooks/useBlocking.js';
12
12
  import {
13
13
  v4 as uuid,
14
14
  } from 'uuid';
15
-
16
- // eslint-disable-next-line
17
- const Draggable = await import('../../PlatformImports/' + CURRENT_MODE + '/Draggable.js');
15
+ import getComponentFromType from '../../Functions/getComponentFromType';
18
16
 
19
17
 
20
18
 
@@ -42,6 +40,7 @@ export default function withDraggable(WrappedComponent) {
42
40
  // for local use
43
41
  mode = HORIZONTAL, // HORIZONTAL, VERTICAL
44
42
  } = props,
43
+ Draggable = getComponentFromType('Draggable'),
45
44
  [isDragging, setIsDraggingRaw] = useState(false),
46
45
  [node, setNode] = useState(false),
47
46
  [bounds, setBounds] = useState(null),
@@ -10,7 +10,7 @@ import Blank from './Blank.js';
10
10
  import BooleanCombo from './Form/Field/Combo/BooleanCombo.js';
11
11
  // import CartButtonWithBadge from '../Components/Buttons/CartButtonWithBadge.js';
12
12
  import CheckboxGroup from './Form/Field/CheckboxGroup/CheckboxGroup.js';
13
- import CKEditor from './Form/Field/CKEditor/CKEditor.js';
13
+ // import CKEditor from './Form/Field/CKEditor/CKEditor.js'; // web only
14
14
  import Color from './Form/Field/Color.js';
15
15
  import Combo from './Form/Field/Combo/Combo.js';
16
16
  // import ComboEditor from '../Components/Form/Field/Combo/ComboEditor.js';
@@ -56,7 +56,7 @@ const components = {
56
56
  BooleanCombo,
57
57
  // CartButtonWithBadge,
58
58
  CheckboxGroup,
59
- CKEditor,
59
+ // CKEditor,
60
60
  Color,
61
61
  Column,
62
62
  Combo,
@@ -1,5 +1,6 @@
1
1
  import UiGlobals from '../UiGlobals.js';
2
+ import _ from 'lodash';
2
3
 
3
4
  export default function registerComponents(newComponents) {
4
5
  _.merge(UiGlobals.components, newComponents);
5
- }
6
+ }
@@ -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
+ }
@@ -0,0 +1,13 @@
1
+ import UiGlobals from '../UiGlobals.js';
2
+ import CKEditor from '../Components/Form/Field/CKEditor/CKEditor.js';
3
+ import Datetime from '../PlatformImports/Web/Datetime';
4
+ import Draggable from '../PlatformImports/Web/Draggable';
5
+ import _ from 'lodash';
6
+
7
+ export function registerWebComponents() {
8
+ _.merge(UiGlobals.components, {
9
+ CKEditor,
10
+ Datetime,
11
+ Draggable,
12
+ });
13
+ }
@@ -0,0 +1,4 @@
1
+ // import DateTimePickerModal from 'react-native-modal-datetime-picker'; // https://github.com/mmazzarolo/react-native-modal-datetime-picker
2
+ import Datetime from '@react-native-community/datetimepicker'; // https://github.com/react-native-datetimepicker/datetimepicker
3
+
4
+ export default Datetime.default || Datetime;
@@ -0,0 +1,5 @@
1
+ import Datetime from 'react-datetime'; // https://www.npmjs.com/package/react-datetime
2
+ import 'react-datetime/css/react-datetime.css';
3
+ import './datetime.css';
4
+
5
+ export default Datetime.default || Datetime;