@onehat/ui 0.2.9 → 0.2.10
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 +1 -1
- package/src/Components/Form/Field/Color.js +3 -3
- package/src/Components/Form/Field/Combo/Combo.js +3 -3
- package/src/Components/Form/Field/Date.js +3 -3
- package/src/Components/Form/Field/DisplayField.js +3 -2
- package/src/Components/Form/Field/File.js +3 -3
- package/src/Components/Form/Field/Input.js +2 -1
- package/src/Components/Form/Field/Number.js +2 -1
- package/src/Components/Form/Field/Text.js +2 -1
- package/src/Components/Form/Field/TextArea.js +2 -1
- package/src/Components/Form/Field/Toggle.js +2 -1
- package/src/Components/Form/FieldSet.js +2 -1
- package/src/Components/Grid/Grid.js +2 -1
- package/src/Components/Grid/GridHeaderRow.js +3 -3
- package/src/Components/Grid/GridRow.js +2 -1
- package/src/Components/Hoc/withDraggable.js +2 -2
- package/src/Components/Hoc/withInlineEditor.js +3 -3
- package/src/Components/Panel/Footer.js +2 -1
- package/src/Components/Panel/Header.js +4 -4
- package/src/Components/Panel/Panel.js +2 -2
- package/src/Components/Panel/TabPanel.js +2 -1
- package/src/Constants/Styles.js +3 -5
- package/src/Functions/registerStyles.js +6 -0
- package/src/OneHatUi.js +2 -0
- package/src/UiGlobals.js +16 -1
- package/src/Functions/setUiMode.js +0 -5
- package/src/UiConfig.js +0 -19
package/package.json
CHANGED
|
@@ -10,9 +10,8 @@ import { SketchPicker } from 'react-color';
|
|
|
10
10
|
import {
|
|
11
11
|
UI_MODE_WEB,
|
|
12
12
|
} from '../../../Constants/UiModes.js';
|
|
13
|
-
import
|
|
13
|
+
import UiGlobals from '../../../UiGlobals.js';
|
|
14
14
|
import Input from '../Field/Input.js';
|
|
15
|
-
import styles from '../../../Constants/Styles.js';
|
|
16
15
|
import withValue from '../../Hoc/withValue.js';
|
|
17
16
|
import emptyFn from '../../../Functions/emptyFn.js';
|
|
18
17
|
import _ from 'lodash';
|
|
@@ -24,6 +23,7 @@ export function ColorElement(props) {
|
|
|
24
23
|
tooltip = 'Choose a color.',
|
|
25
24
|
tooltipPlacement = 'bottom',
|
|
26
25
|
} = props,
|
|
26
|
+
styles = UiGlobals.styles,
|
|
27
27
|
inputRef = useRef(),
|
|
28
28
|
triggerRef = useRef(),
|
|
29
29
|
pickerRef = useRef(),
|
|
@@ -38,7 +38,7 @@ export function ColorElement(props) {
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (UiGlobals.mode === UI_MODE_WEB && triggerRef.current?.getBoundingClientRect) {
|
|
42
42
|
// For web, ensure it's in the proper place
|
|
43
43
|
const
|
|
44
44
|
triggerRect = triggerRef.current.getBoundingClientRect(),
|
|
@@ -10,9 +10,8 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
UI_MODE_WEB,
|
|
12
12
|
} from '../../../../Constants/UiModes.js';
|
|
13
|
-
import
|
|
13
|
+
import UiGlobals from '../../../../UiGlobals.js';
|
|
14
14
|
import Input from '../Input.js';
|
|
15
|
-
import styles from '../../../../Constants/Styles.js';
|
|
16
15
|
import withData from '../../../Hoc/withData.js';
|
|
17
16
|
import withEvents from '../../../Hoc/withEvents.js';
|
|
18
17
|
import withSelection from '../../../Hoc/withSelection.js';
|
|
@@ -62,6 +61,7 @@ export function Combo(props) {
|
|
|
62
61
|
|
|
63
62
|
tooltipPlacement = 'bottom',
|
|
64
63
|
} = props,
|
|
64
|
+
styles = UiGlobals.styles,
|
|
65
65
|
inputRef = useRef(),
|
|
66
66
|
triggerRef = useRef(),
|
|
67
67
|
menuRef = useRef(),
|
|
@@ -79,7 +79,7 @@ export function Combo(props) {
|
|
|
79
79
|
if (isMenuShown) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
if (
|
|
82
|
+
if (UiGlobals.mode === UI_MODE_WEB && inputRef.current.getBoundingClientRect) {
|
|
83
83
|
// For web, ensure it's in the proper place
|
|
84
84
|
const
|
|
85
85
|
rect = inputRef.current.getBoundingClientRect(),
|
|
@@ -20,7 +20,7 @@ import './datetime.css';
|
|
|
20
20
|
import {
|
|
21
21
|
UI_MODE_WEB,
|
|
22
22
|
} from '../../../Constants/UiModes.js';
|
|
23
|
-
import
|
|
23
|
+
import UiGlobals from '../../../UiGlobals.js';
|
|
24
24
|
import Formatters from '@onehat/data/src/Util/Formatters.js';
|
|
25
25
|
import Parsers from '@onehat/data/src/Util/Parsers.js';
|
|
26
26
|
import Input from '../Field/Input.js';
|
|
@@ -28,7 +28,6 @@ import IconButton from '../../Buttons/IconButton.js';
|
|
|
28
28
|
import withValue from '../../Hoc/withValue.js';
|
|
29
29
|
import emptyFn from '../../../Functions/emptyFn.js';
|
|
30
30
|
import Calendar from '../../Icons/Calendar.js';
|
|
31
|
-
import styles from '../../../Constants/Styles.js';
|
|
32
31
|
import _ from 'lodash';
|
|
33
32
|
|
|
34
33
|
export function DateElement(props) {
|
|
@@ -41,6 +40,7 @@ export function DateElement(props) {
|
|
|
41
40
|
tooltip = 'Choose a date.',
|
|
42
41
|
tooltipPlacement = 'bottom',
|
|
43
42
|
} = props,
|
|
43
|
+
styles = UiGlobals.styles,
|
|
44
44
|
inputRef = useRef(),
|
|
45
45
|
triggerRef = useRef(),
|
|
46
46
|
pickerRef = useRef(),
|
|
@@ -54,7 +54,7 @@ export function DateElement(props) {
|
|
|
54
54
|
if (isPickerShown) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
if (
|
|
57
|
+
if (UiGlobals.mode === UI_MODE_WEB && triggerRef.current?.getBoundingClientRect) {
|
|
58
58
|
// For web, ensure it's in the proper place
|
|
59
59
|
const
|
|
60
60
|
triggerRect = triggerRef.current.getBoundingClientRect(),
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
Text,
|
|
4
4
|
} from 'native-base';
|
|
5
|
-
import
|
|
5
|
+
import UiGlobals from '../../../UiGlobals.js';
|
|
6
6
|
import withTooltip from '../../Hoc/withTooltip.js';
|
|
7
7
|
import withValue from '../../Hoc/withValue.js';
|
|
8
8
|
|
|
@@ -11,7 +11,8 @@ const
|
|
|
11
11
|
const {
|
|
12
12
|
value,
|
|
13
13
|
text = value,
|
|
14
|
-
} = props
|
|
14
|
+
} = props,
|
|
15
|
+
styles = UiGlobals.styles;
|
|
15
16
|
return <Text
|
|
16
17
|
ref={props.outerRef}
|
|
17
18
|
onChangeText={props.setValue}
|
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
UI_MODE_WEB,
|
|
11
11
|
UI_MODE_REACT_NATIVE,
|
|
12
12
|
} from '../../../Constants/UiModes.js';
|
|
13
|
-
import
|
|
14
|
-
import styles from '../../../Constants/Styles.js';
|
|
13
|
+
import UiGlobals from '../../../UiGlobals.js';
|
|
15
14
|
import {
|
|
16
15
|
FILE_MODE_IMAGE,
|
|
17
16
|
FILE_MODE_FILE,
|
|
@@ -50,6 +49,7 @@ function FileElement(props) {
|
|
|
50
49
|
tooltip = 'Choose or drag a file on top of this control.',
|
|
51
50
|
tooltipPlacement = 'bottom',
|
|
52
51
|
} = props,
|
|
52
|
+
styles = UiGlobals.styles,
|
|
53
53
|
dragRef = useRef(),
|
|
54
54
|
fileInputRef = useRef(),
|
|
55
55
|
[isDropping, setIsDropping] = useState(false),
|
|
@@ -157,7 +157,7 @@ function FileElement(props) {
|
|
|
157
157
|
setLocalFilename(localFilename);
|
|
158
158
|
}, []);
|
|
159
159
|
|
|
160
|
-
if (
|
|
160
|
+
if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
|
|
161
161
|
throw new Error('Not yet implemented for RN.');
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
AUTO_SUBMIT_DELAY,
|
|
8
8
|
} from '../../../Constants/Input.js';
|
|
9
|
-
import
|
|
9
|
+
import UiGlobals from '../../../UiGlobals.js';
|
|
10
10
|
import withValue from '../../Hoc/withValue.js';
|
|
11
11
|
import _ from 'lodash';
|
|
12
12
|
|
|
@@ -22,6 +22,7 @@ function InputElement(props) {
|
|
|
22
22
|
tooltip = null,
|
|
23
23
|
tooltipPlacement = 'bottom',
|
|
24
24
|
} = props,
|
|
25
|
+
styles = UiGlobals.styles,
|
|
25
26
|
debouncedSetValueRef = useRef(),
|
|
26
27
|
[localValue, setLocalValue] = useState(value),
|
|
27
28
|
onKeyPressLocal = (e) => {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
AUTO_SUBMIT_DELAY,
|
|
10
10
|
} from '../../../Constants/Input.js';
|
|
11
|
-
import
|
|
11
|
+
import UiGlobals from '../../../UiGlobals.js';
|
|
12
12
|
import IconButton from '../../Buttons/IconButton.js';
|
|
13
13
|
import withTooltip from '../../Hoc/withTooltip.js';
|
|
14
14
|
import withValue from '../../Hoc/withValue.js';
|
|
@@ -26,6 +26,7 @@ function NumberElement(props) {
|
|
|
26
26
|
maxValue,
|
|
27
27
|
tooltip = null,
|
|
28
28
|
} = props,
|
|
29
|
+
styles = UiGlobals.styles,
|
|
29
30
|
debouncedSetValueRef = useRef(),
|
|
30
31
|
[localValue, setLocalValue] = useState(value),
|
|
31
32
|
onInputKeyPress = (e) => {
|
|
@@ -2,12 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
Text,
|
|
4
4
|
} from 'native-base';
|
|
5
|
-
import
|
|
5
|
+
import UiGlobals from '../../../UiGlobals.js';
|
|
6
6
|
import withTooltip from '../../Hoc/withTooltip.js';
|
|
7
7
|
import withValue from '../../Hoc/withValue.js';
|
|
8
8
|
|
|
9
9
|
const
|
|
10
10
|
TextElement = (props) => {
|
|
11
|
+
const styles = UiGlobals.styles;
|
|
11
12
|
return <Text
|
|
12
13
|
ref={props.outerRef}
|
|
13
14
|
numberOfLines={1}
|
|
@@ -2,12 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
TextArea,
|
|
4
4
|
} from 'native-base';
|
|
5
|
-
import
|
|
5
|
+
import UiGlobals from '../../../UiGlobals.js';
|
|
6
6
|
import withTooltip from '../../Hoc/withTooltip.js';
|
|
7
7
|
import withValue from '../../Hoc/withValue.js';
|
|
8
8
|
|
|
9
9
|
const
|
|
10
10
|
TextAreaElement = (props) => {
|
|
11
|
+
const styles = UiGlobals.styles;
|
|
11
12
|
return <TextArea
|
|
12
13
|
ref={props.outerRef}
|
|
13
14
|
onChangeText={props.setValue}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
Switch,
|
|
4
4
|
} from 'native-base';
|
|
5
|
-
import
|
|
5
|
+
import UiGlobals from '../../../UiGlobals.js';
|
|
6
6
|
import withTooltip from '../../Hoc/withTooltip.js';
|
|
7
7
|
import withValue from '../../Hoc/withValue.js';
|
|
8
8
|
|
|
@@ -12,6 +12,7 @@ const
|
|
|
12
12
|
value,
|
|
13
13
|
setValue,
|
|
14
14
|
} = props,
|
|
15
|
+
styles = UiGlobals.styles,
|
|
15
16
|
onToggle = () => {
|
|
16
17
|
setValue(!value);
|
|
17
18
|
};
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
Row,
|
|
6
6
|
Text,
|
|
7
7
|
} from 'native-base';
|
|
8
|
-
import
|
|
8
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
9
9
|
import IconButton from '../Buttons/IconButton.js';
|
|
10
10
|
import CaretUp from '../Icons/CaretUp.js';
|
|
11
11
|
import CaretDown from '../Icons/CaretDown.js';
|
|
@@ -19,6 +19,7 @@ export default function FieldSet(props) {
|
|
|
19
19
|
hasErrors,
|
|
20
20
|
...propsToPass
|
|
21
21
|
} = props,
|
|
22
|
+
styles = UiGlobals.styles,
|
|
22
23
|
[localIsCollapsed, setLocalIsCollapsed] = useState(isCollapsed),
|
|
23
24
|
onToggleCollapse = () => {
|
|
24
25
|
setLocalIsCollapsed(!localIsCollapsed);
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
SELECTION_MODE_SINGLE,
|
|
12
12
|
SELECTION_MODE_MULTI,
|
|
13
13
|
} from '../../Constants/Selection.js';
|
|
14
|
-
import styles from '../../Constants/Styles.js';
|
|
15
14
|
import {
|
|
16
15
|
v4 as uuid,
|
|
17
16
|
} from 'uuid';
|
|
@@ -22,6 +21,7 @@ import {
|
|
|
22
21
|
DROP_POSITION_BEFORE,
|
|
23
22
|
DROP_POSITION_AFTER,
|
|
24
23
|
} from '../../Constants/Grid.js';
|
|
24
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
25
25
|
import useForceUpdate from '../../Hooks/useForceUpdate.js';
|
|
26
26
|
import withContextMenu from '../Hoc/withContextMenu.js';
|
|
27
27
|
import withAlert from '../Hoc/withAlert.js';
|
|
@@ -139,6 +139,7 @@ export function Grid(props) {
|
|
|
139
139
|
onEditorRowClick,
|
|
140
140
|
|
|
141
141
|
} = props,
|
|
142
|
+
styles = UiGlobals.styles,
|
|
142
143
|
forceUpdate = useForceUpdate(),
|
|
143
144
|
gridRef = useRef(),
|
|
144
145
|
[isReady, setIsReady] = useState(false),
|
|
@@ -15,8 +15,7 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
UI_MODE_WEB,
|
|
17
17
|
} from '../../Constants/UiModes.js';
|
|
18
|
-
import
|
|
19
|
-
import styles from '../../Constants/Styles.js';
|
|
18
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
20
19
|
import useBlocking from '../../Hooks/useBlocking.js';
|
|
21
20
|
import AngleRight from '../Icons/AngleRight.js';
|
|
22
21
|
import HeaderReorderHandle from './HeaderReorderHandle.js';
|
|
@@ -42,6 +41,7 @@ export default function GridHeaderRow(props) {
|
|
|
42
41
|
gridRef,
|
|
43
42
|
isHovered,
|
|
44
43
|
} = props,
|
|
44
|
+
styles = UiGlobals.styles,
|
|
45
45
|
sortFn = Repository && Repository.getSortFn(),
|
|
46
46
|
sortField = Repository && Repository.getSortField(),
|
|
47
47
|
{ isBlocked } = useBlocking(),
|
|
@@ -269,7 +269,7 @@ export default function GridHeaderRow(props) {
|
|
|
269
269
|
}
|
|
270
270
|
}, [columnsConfig]);
|
|
271
271
|
|
|
272
|
-
if (
|
|
272
|
+
if (UiGlobals.mode !== UI_MODE_WEB) {
|
|
273
273
|
canColumnsReorder = false;
|
|
274
274
|
canColumnsResize = false;
|
|
275
275
|
}
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
VERTICAL,
|
|
9
9
|
} from '../../Constants/Directions.js';
|
|
10
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
10
11
|
import withDraggable from '../Hoc/withDraggable.js';
|
|
11
|
-
import styles from '../../Constants/Styles.js';
|
|
12
12
|
import AngleRight from '../Icons/AngleRight.js';
|
|
13
13
|
import _ from 'lodash';
|
|
14
14
|
|
|
@@ -24,6 +24,7 @@ export default function GridRow(props) {
|
|
|
24
24
|
bg,
|
|
25
25
|
item,
|
|
26
26
|
} = props,
|
|
27
|
+
styles = UiGlobals.styles,
|
|
27
28
|
isPhantom = item.isPhantom,
|
|
28
29
|
hash = item.hash || item;
|
|
29
30
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
UI_MODE_WEB,
|
|
8
8
|
UI_MODE_REACT_NATIVE,
|
|
9
9
|
} from '../../Constants/UiModes.js';
|
|
10
|
-
import
|
|
10
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
11
11
|
import Draggable from 'react-draggable'; // https://github.com/react-grid-layout/react-draggable
|
|
12
12
|
import useBlocking from '../../Hooks/useBlocking.js';
|
|
13
13
|
import {
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
export default function withDraggable(WrappedComponent) {
|
|
22
22
|
return (props) => {
|
|
23
23
|
|
|
24
|
-
if (
|
|
24
|
+
if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
|
|
25
25
|
throw new Error('Not yet implemented for RN.');
|
|
26
26
|
}
|
|
27
27
|
const {
|
|
@@ -12,14 +12,13 @@ import {
|
|
|
12
12
|
UI_MODE_WEB,
|
|
13
13
|
UI_MODE_REACT_NATIVE,
|
|
14
14
|
} from '../../Constants/UiModes.js';
|
|
15
|
-
import
|
|
15
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
16
16
|
import Form from '../Form/Form.js';
|
|
17
17
|
import withEditor from './withEditor.js';
|
|
18
|
-
import styles from '../../Constants/Styles.js';
|
|
19
18
|
import _ from 'lodash';
|
|
20
19
|
|
|
21
20
|
export default function withInlineEditor(WrappedComponent) {
|
|
22
|
-
if (
|
|
21
|
+
if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
|
|
23
22
|
throw new Error('Not yet implemented for RN.');
|
|
24
23
|
}
|
|
25
24
|
return withEditor((props) => {
|
|
@@ -39,6 +38,7 @@ export default function withInlineEditor(WrappedComponent) {
|
|
|
39
38
|
// withData
|
|
40
39
|
Repository,
|
|
41
40
|
} = props,
|
|
41
|
+
styles = UiGlobals.styles,
|
|
42
42
|
inlineEditorRef = useRef(),
|
|
43
43
|
[localColumnsConfig, setLocalColumnsConfig] = useState([]),
|
|
44
44
|
[currentRow, setCurrentRow] = useState(),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Row,
|
|
3
3
|
} from 'native-base';
|
|
4
|
-
import
|
|
4
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
5
5
|
|
|
6
6
|
export default function Footer(props) {
|
|
7
|
+
const styles = UiGlobals.styles;
|
|
7
8
|
return <Row
|
|
8
9
|
alignItems="center"
|
|
9
10
|
justifyContent="center"
|
|
@@ -13,17 +13,16 @@ import {
|
|
|
13
13
|
UI_MODE_WEB,
|
|
14
14
|
UI_MODE_REACT_NATIVE,
|
|
15
15
|
} from '../../Constants/UiModes.js';
|
|
16
|
-
import
|
|
16
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
17
17
|
import Minus from '../Icons/Minus.js';
|
|
18
18
|
import Plus from '../Icons/Plus.js';
|
|
19
19
|
import Xmark from '../Icons/Xmark.js';
|
|
20
|
-
import styles from '../../Constants/Styles.js';
|
|
21
20
|
import emptyFn from '../../Functions/emptyFn.js';
|
|
22
21
|
import IconButton from '../Buttons/IconButton.js';
|
|
23
22
|
|
|
24
23
|
export default function Header(props) {
|
|
25
24
|
|
|
26
|
-
if (
|
|
25
|
+
if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
|
|
27
26
|
throw new Error('Not yet implemented for RN.');
|
|
28
27
|
}
|
|
29
28
|
|
|
@@ -36,7 +35,8 @@ export default function Header(props) {
|
|
|
36
35
|
collapseDirection = VERTICAL,
|
|
37
36
|
isCollapsed = false,
|
|
38
37
|
onToggleCollapse = emptyFn,
|
|
39
|
-
} = props
|
|
38
|
+
} = props,
|
|
39
|
+
styles = UiGlobals.styles;
|
|
40
40
|
|
|
41
41
|
let closeBtn = null,
|
|
42
42
|
collapseBtn = null;
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
UI_MODE_WEB,
|
|
14
14
|
UI_MODE_REACT_NATIVE,
|
|
15
15
|
} from '../../Constants/UiModes.js';
|
|
16
|
-
import
|
|
16
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
17
17
|
import Header from './Header.js';
|
|
18
18
|
import withCollapsible from '../Hoc/withCollapsible.js';
|
|
19
19
|
import emptyFn from '../../Functions/emptyFn.js';
|
|
@@ -25,7 +25,7 @@ import _ from 'lodash';
|
|
|
25
25
|
|
|
26
26
|
function Panel(props) {
|
|
27
27
|
|
|
28
|
-
if (
|
|
28
|
+
if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
|
|
29
29
|
throw new Error('Not yet implemented for RN.');
|
|
30
30
|
}
|
|
31
31
|
const {
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
HORIZONTAL,
|
|
12
12
|
VERTICAL,
|
|
13
13
|
} from '../../Constants/Directions.js';
|
|
14
|
+
import UiGlobals from '../../UiGlobals.js';
|
|
14
15
|
import IconButton from '../Buttons/IconButton.js';
|
|
15
16
|
import Minimize from '../Icons/Minimize.js';
|
|
16
17
|
import Maximize from '../Icons/Maximize.js';
|
|
17
|
-
import styles from '../../Constants/Styles.js';
|
|
18
18
|
import Panel from './Panel.js';
|
|
19
19
|
import _ from 'lodash';
|
|
20
20
|
|
|
@@ -32,6 +32,7 @@ export default function TabPanel(props) {
|
|
|
32
32
|
onChangeIsCollapsed,
|
|
33
33
|
...propsToPass
|
|
34
34
|
} = props,
|
|
35
|
+
styles = UiGlobals.styles,
|
|
35
36
|
[currentTab, setCurrentTabRaw] = useState(initialTab),
|
|
36
37
|
[isCollapsed, setIsCollapsedRaw] = useState(startsCollapsed),
|
|
37
38
|
setIsCollapsed = (isCollapsed) => {
|
package/src/Constants/Styles.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// These are the default styles of the @onehat/ui components.
|
|
2
|
+
// App can override these with Functions/registerStyles()
|
|
4
3
|
const
|
|
5
4
|
DEFAULT_FONTSIZE = 15,
|
|
6
5
|
WHITE = '#fff',
|
|
@@ -82,5 +81,4 @@ const defaults = {
|
|
|
82
81
|
TEXT_FONTSIZE: DEFAULT_FONTSIZE,
|
|
83
82
|
};
|
|
84
83
|
|
|
85
|
-
export default defaults;
|
|
86
|
-
|
|
84
|
+
export default defaults;
|
package/src/OneHatUi.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import EventEmitter from '@onehat/events';
|
|
4
4
|
import Components from './Components/index.js';
|
|
5
|
+
import Styles from './Constants/Styles.js';
|
|
5
6
|
import UiGlobals from './UiGlobals.js';
|
|
6
7
|
import _ from 'lodash';
|
|
7
8
|
|
|
@@ -14,6 +15,7 @@ export class OneHatUi extends EventEmitter {
|
|
|
14
15
|
super(...arguments);
|
|
15
16
|
|
|
16
17
|
UiGlobals.components = Components;
|
|
18
|
+
UiGlobals.styles = Styles;
|
|
17
19
|
|
|
18
20
|
this.registerEvents([
|
|
19
21
|
'error',
|
package/src/UiGlobals.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { isBrowser, isNode, isWebWorker, isJsDom, isDeno } from "browser-or-node";
|
|
2
|
+
import {
|
|
3
|
+
UI_MODE_WEB,
|
|
4
|
+
UI_MODE_REACT_NATIVE,
|
|
5
|
+
} from './Constants/UiModes.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const Globals = {
|
|
9
|
+
mode: null,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
if (isBrowser || isWebWorker) {
|
|
13
|
+
Globals.mode = UI_MODE_WEB;
|
|
14
|
+
} else if (isNode) {
|
|
15
|
+
Globals.mode = UI_MODE_REACT_NATIVE;
|
|
16
|
+
}
|
|
2
17
|
|
|
3
18
|
export default Globals;
|
package/src/UiConfig.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { isBrowser, isNode, isWebWorker, isJsDom, isDeno } from "browser-or-node";
|
|
2
|
-
import {
|
|
3
|
-
UI_MODE_WEB,
|
|
4
|
-
UI_MODE_REACT_NATIVE,
|
|
5
|
-
} from './Constants/UiModes.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const UiConfig = {
|
|
9
|
-
mode: null,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
if (isBrowser || isWebWorker) {
|
|
13
|
-
UiConfig.mode = UI_MODE_WEB;
|
|
14
|
-
} else
|
|
15
|
-
if (isNode) {
|
|
16
|
-
UiConfig.mode = UI_MODE_REACT_NATIVE;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default UiConfig;
|