@onehat/ui 0.1.2 → 0.2.0
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/ckeditor5/LICENSE.md +49 -0
- package/ckeditor5/README.md +68 -0
- package/ckeditor5/build/ckeditor.js +6 -0
- package/ckeditor5/build/ckeditor.js.map +1 -0
- package/ckeditor5/build/translations/af.js +1 -0
- package/ckeditor5/build/translations/ar.js +1 -0
- package/ckeditor5/build/translations/ast.js +1 -0
- package/ckeditor5/build/translations/az.js +1 -0
- package/ckeditor5/build/translations/bg.js +1 -0
- package/ckeditor5/build/translations/bn.js +1 -0
- package/ckeditor5/build/translations/bs.js +1 -0
- package/ckeditor5/build/translations/ca.js +1 -0
- package/ckeditor5/build/translations/cs.js +1 -0
- package/ckeditor5/build/translations/da.js +1 -0
- package/ckeditor5/build/translations/de-ch.js +1 -0
- package/ckeditor5/build/translations/de.js +1 -0
- package/ckeditor5/build/translations/el.js +1 -0
- package/ckeditor5/build/translations/en-au.js +1 -0
- package/ckeditor5/build/translations/en-gb.js +1 -0
- package/ckeditor5/build/translations/eo.js +1 -0
- package/ckeditor5/build/translations/es-co.js +1 -0
- package/ckeditor5/build/translations/es.js +1 -0
- package/ckeditor5/build/translations/et.js +1 -0
- package/ckeditor5/build/translations/eu.js +1 -0
- package/ckeditor5/build/translations/fa.js +1 -0
- package/ckeditor5/build/translations/fi.js +1 -0
- package/ckeditor5/build/translations/fr.js +1 -0
- package/ckeditor5/build/translations/gl.js +1 -0
- package/ckeditor5/build/translations/gu.js +1 -0
- package/ckeditor5/build/translations/he.js +1 -0
- package/ckeditor5/build/translations/hi.js +1 -0
- package/ckeditor5/build/translations/hr.js +1 -0
- package/ckeditor5/build/translations/hu.js +1 -0
- package/ckeditor5/build/translations/id.js +1 -0
- package/ckeditor5/build/translations/it.js +1 -0
- package/ckeditor5/build/translations/ja.js +1 -0
- package/ckeditor5/build/translations/jv.js +1 -0
- package/ckeditor5/build/translations/kk.js +1 -0
- package/ckeditor5/build/translations/km.js +1 -0
- package/ckeditor5/build/translations/kn.js +1 -0
- package/ckeditor5/build/translations/ko.js +1 -0
- package/ckeditor5/build/translations/ku.js +1 -0
- package/ckeditor5/build/translations/lt.js +1 -0
- package/ckeditor5/build/translations/lv.js +1 -0
- package/ckeditor5/build/translations/ms.js +1 -0
- package/ckeditor5/build/translations/nb.js +1 -0
- package/ckeditor5/build/translations/ne.js +1 -0
- package/ckeditor5/build/translations/nl.js +1 -0
- package/ckeditor5/build/translations/no.js +1 -0
- package/ckeditor5/build/translations/oc.js +1 -0
- package/ckeditor5/build/translations/pl.js +1 -0
- package/ckeditor5/build/translations/pt-br.js +1 -0
- package/ckeditor5/build/translations/pt.js +1 -0
- package/ckeditor5/build/translations/ro.js +1 -0
- package/ckeditor5/build/translations/ru.js +1 -0
- package/ckeditor5/build/translations/si.js +1 -0
- package/ckeditor5/build/translations/sk.js +1 -0
- package/ckeditor5/build/translations/sl.js +1 -0
- package/ckeditor5/build/translations/sq.js +1 -0
- package/ckeditor5/build/translations/sr-latn.js +1 -0
- package/ckeditor5/build/translations/sr.js +1 -0
- package/ckeditor5/build/translations/sv.js +1 -0
- package/ckeditor5/build/translations/th.js +1 -0
- package/ckeditor5/build/translations/tk.js +1 -0
- package/ckeditor5/build/translations/tr.js +1 -0
- package/ckeditor5/build/translations/tt.js +1 -0
- package/ckeditor5/build/translations/ug.js +1 -0
- package/ckeditor5/build/translations/uk.js +1 -0
- package/ckeditor5/build/translations/ur.js +1 -0
- package/ckeditor5/build/translations/uz.js +1 -0
- package/ckeditor5/build/translations/vi.js +1 -0
- package/ckeditor5/build/translations/zh-cn.js +1 -0
- package/ckeditor5/build/translations/zh.js +1 -0
- package/ckeditor5/package.json +46 -0
- package/ckeditor5/sample/index.html +130 -0
- package/ckeditor5/sample/styles.css +496 -0
- package/ckeditor5/src/ckeditor.js +138 -0
- package/ckeditor5/webpack.config.js +96 -0
- package/package.json +19 -23
- package/src/Components/Accordion/Accordion.js +144 -0
- package/src/Components/Blank.js +14 -0
- package/src/Components/Buttons/BackButton.js +16 -0
- package/src/Components/Buttons/CartButtonWithBadge.js +25 -0
- package/src/Components/Buttons/IconButton.js +42 -0
- package/src/Components/Container/Container.js +178 -0
- package/src/Components/Container/Splitter.js +61 -0
- package/src/Components/Filter/DateRange.js +99 -0
- package/src/Components/Filter/NumberRange.js +96 -0
- package/src/Components/Form/Field/CKEditor/CKEditor.js +62 -0
- package/src/Components/Form/Field/CKEditor/styles.css +503 -0
- package/src/Components/Form/Field/CKEditor.js +12 -0
- package/src/Components/Form/Field/CheckboxGroup/ArrayCheckboxGroup.js +13 -0
- package/src/Components/Form/Field/CheckboxGroup/CheckboxGroup.js +61 -0
- package/src/Components/Form/Field/Color.js +226 -0
- package/src/Components/Form/Field/Combo/ArrayCombo.js +15 -0
- package/src/Components/Form/Field/Combo/BooleanCombo.js +23 -0
- package/src/Components/Form/Field/Combo/Combo.js +504 -0
- package/src/Components/Form/Field/Combo/ComboEditor.js +22 -0
- package/src/Components/Form/Field/Combo/IntervalsCombo.js +18 -0
- package/src/Components/Form/Field/Combo/MonthsCombo.js +24 -0
- package/src/Components/Form/Field/Combo/PageSizeCombo.js +38 -0
- package/src/Components/Form/Field/Combo/Tag.js +12 -0
- package/src/Components/Form/Field/Combo/TimezonesCombo.js +432 -0
- package/src/Components/Form/Field/Combo/YearsCombo.js +35 -0
- package/src/Components/Form/Field/Date.js +370 -0
- package/src/Components/Form/Field/DisplayField.js +28 -0
- package/src/Components/Form/Field/Field.js +14 -0
- package/src/Components/Form/Field/File.js +218 -0
- package/src/Components/Form/Field/Input.js +96 -0
- package/src/Components/Form/Field/Number.js +151 -0
- package/src/Components/Form/Field/RadioGroup/ArrayRadioGroup.js +13 -0
- package/src/Components/Form/Field/RadioGroup/RadioGroup.js +62 -0
- package/src/Components/Form/Field/Tag.js +11 -0
- package/src/Components/Form/Field/Text.js +28 -0
- package/src/Components/Form/Field/TextArea.js +26 -0
- package/src/Components/Form/Field/Toggle.js +39 -0
- package/src/Components/Form/Field/datetime.css +5 -0
- package/src/Components/Form/FieldSet.js +64 -0
- package/src/Components/Form/FiltersForm.js +66 -0
- package/src/Components/Form/Form.js +535 -0
- package/src/Components/Form/Label.js +24 -0
- package/src/Components/Grid/Grid.js +877 -0
- package/src/Components/Grid/GridHeaderRow.js +455 -0
- package/src/Components/Grid/GridRow.js +134 -0
- package/src/Components/Grid/HeaderReorderHandle.js +29 -0
- package/src/Components/Grid/HeaderResizeHandle.js +29 -0
- package/src/Components/Grid/NoRecordsFound.js +43 -0
- package/src/Components/Grid/ReactGrid.js +468 -0
- package/src/Components/Grid/SenchaGrid.js +421 -0
- package/src/Components/Grid/reactgrid.css +6 -0
- package/src/Components/Hoc/withAlert.js +176 -0
- package/src/Components/Hoc/withBlank.js +12 -0
- package/src/Components/Hoc/withCollapsible.js +20 -0
- package/src/Components/Hoc/withContextMenu.js +127 -0
- package/src/Components/Hoc/withData.js +85 -0
- package/src/Components/Hoc/withDraggable.js +259 -0
- package/src/Components/Hoc/withEditor.js +160 -0
- package/src/Components/Hoc/withEvents.js +12 -0
- package/src/Components/Hoc/withFilters.js +456 -0
- package/src/Components/Hoc/withInlineEditor.js +119 -0
- package/src/Components/Hoc/withMultiSelection.js +16 -0
- package/src/Components/Hoc/withPresetButtons.js +239 -0
- package/src/Components/Hoc/withSelection.js +332 -0
- package/src/Components/Hoc/withTooltip.js +21 -0
- package/src/Components/Hoc/withValue.js +87 -0
- package/src/Components/Hoc/withWindowedEditor.js +51 -0
- package/src/Components/Icons/AddressBook.js +14 -0
- package/src/Components/Icons/Alt.js +17 -0
- package/src/Components/Icons/AngleLeft.js +18 -0
- package/src/Components/Icons/AngleRight.js +18 -0
- package/src/Components/Icons/AnglesLeft.js +18 -0
- package/src/Components/Icons/AnglesRight.js +18 -0
- package/src/Components/Icons/Asterisk.js +14 -0
- package/src/Components/Icons/Ban.js +18 -0
- package/src/Components/Icons/Bars.js +14 -0
- package/src/Components/Icons/BigCircle.js +17 -0
- package/src/Components/Icons/Book.js +14 -0
- package/src/Components/Icons/BookOpen.js +14 -0
- package/src/Components/Icons/Bug.js +14 -0
- package/src/Components/Icons/Building.js +14 -0
- package/src/Components/Icons/Calendar.js +18 -0
- package/src/Components/Icons/Calendar2.js +18 -0
- package/src/Components/Icons/CalendarDays.js +18 -0
- package/src/Components/Icons/Camera.js +18 -0
- package/src/Components/Icons/CaretDown.js +18 -0
- package/src/Components/Icons/CaretUp.js +18 -0
- package/src/Components/Icons/CartPlus.js +14 -0
- package/src/Components/Icons/CartShopping.js +14 -0
- package/src/Components/Icons/CashRegister.js +14 -0
- package/src/Components/Icons/ChartLine.js +14 -0
- package/src/Components/Icons/Check.js +14 -0
- package/src/Components/Icons/CheckDouble.js +14 -0
- package/src/Components/Icons/ChevronDown.js +14 -0
- package/src/Components/Icons/ChevronLeft.js +14 -0
- package/src/Components/Icons/ChevronRight.js +14 -0
- package/src/Components/Icons/ChevronUp.js +14 -0
- package/src/Components/Icons/CircleArrowRight.js +14 -0
- package/src/Components/Icons/CircleExclamation.js +18 -0
- package/src/Components/Icons/CircleInfo.js +14 -0
- package/src/Components/Icons/CircleQuestion.js +14 -0
- package/src/Components/Icons/CircleXmark.js +14 -0
- package/src/Components/Icons/CircleXmarkRegular.js +14 -0
- package/src/Components/Icons/Clipboard.js +18 -0
- package/src/Components/Icons/Clock.js +14 -0
- package/src/Components/Icons/ClockRegular.js +14 -0
- package/src/Components/Icons/ClockRotateLeft.js +14 -0
- package/src/Components/Icons/Clone.js +14 -0
- package/src/Components/Icons/Comment.js +14 -0
- package/src/Components/Icons/CommentRegular.js +14 -0
- package/src/Components/Icons/Comments.js +14 -0
- package/src/Components/Icons/CommentsRegular.js +14 -0
- package/src/Components/Icons/Copyright.js +14 -0
- package/src/Components/Icons/Duplicate.js +18 -0
- package/src/Components/Icons/Edit.js +18 -0
- package/src/Components/Icons/EllipsisVertical.js +18 -0
- package/src/Components/Icons/Envelope.js +14 -0
- package/src/Components/Icons/EnvelopeRegular.js +14 -0
- package/src/Components/Icons/Exclamation.js +14 -0
- package/src/Components/Icons/Expand.js +14 -0
- package/src/Components/Icons/Eye.js +18 -0
- package/src/Components/Icons/File.js +18 -0
- package/src/Components/Icons/FloppyDiskRegular.js +14 -0
- package/src/Components/Icons/Gear.js +18 -0
- package/src/Components/Icons/Gift.js +14 -0
- package/src/Components/Icons/Grip.js +18 -0
- package/src/Components/Icons/GripLines.js +18 -0
- package/src/Components/Icons/GripLinesVertical.js +18 -0
- package/src/Components/Icons/GripVertical.js +18 -0
- package/src/Components/Icons/Hammer.js +14 -0
- package/src/Components/Icons/Hand.js +14 -0
- package/src/Components/Icons/House.js +14 -0
- package/src/Components/Icons/Info.js +14 -0
- package/src/Components/Icons/ItunesNote.js +14 -0
- package/src/Components/Icons/List.js +14 -0
- package/src/Components/Icons/ListCheck.js +14 -0
- package/src/Components/Icons/LocationDot.js +14 -0
- package/src/Components/Icons/Loop.js +17 -0
- package/src/Components/Icons/Loop1.js +18 -0
- package/src/Components/Icons/LoopAll.js +18 -0
- package/src/Components/Icons/Maximize.js +14 -0
- package/src/Components/Icons/Microphone.js +14 -0
- package/src/Components/Icons/Minimize.js +14 -0
- package/src/Components/Icons/Minus.js +18 -0
- package/src/Components/Icons/MobileScreenButton.js +14 -0
- package/src/Components/Icons/MoneyBill.js +14 -0
- package/src/Components/Icons/MoneyBillWave.js +14 -0
- package/src/Components/Icons/Mouth.js +24 -0
- package/src/Components/Icons/Music.js +14 -0
- package/src/Components/Icons/NoLoop.js +24 -0
- package/src/Components/Icons/NoReorderRows.js +25 -0
- package/src/Components/Icons/ObjectGroupRegular.js +14 -0
- package/src/Components/Icons/Pause.js +14 -0
- package/src/Components/Icons/Pencil.js +18 -0
- package/src/Components/Icons/Phone.js +14 -0
- package/src/Components/Icons/Play.js +14 -0
- package/src/Components/Icons/Plus.js +18 -0
- package/src/Components/Icons/Presentation.js +19 -0
- package/src/Components/Icons/Print.js +18 -0
- package/src/Components/Icons/Question.js +14 -0
- package/src/Components/Icons/Rate-.25x.js +20 -0
- package/src/Components/Icons/Rate-.5x.js +19 -0
- package/src/Components/Icons/Rate-.75x.js +19 -0
- package/src/Components/Icons/Rate-1.25x.js +20 -0
- package/src/Components/Icons/Rate-1.5x.js +19 -0
- package/src/Components/Icons/Rate-1.75x.js +19 -0
- package/src/Components/Icons/Rate-1x.js +19 -0
- package/src/Components/Icons/Rate-2x.js +19 -0
- package/src/Components/Icons/RateIcon-.25x.js +20 -0
- package/src/Components/Icons/RateIcon-.5x.js +19 -0
- package/src/Components/Icons/RateIcon-.75x.js +19 -0
- package/src/Components/Icons/RateIcon-1.25x.js +20 -0
- package/src/Components/Icons/RateIcon-1.5x.js +19 -0
- package/src/Components/Icons/RateIcon-1.75x.js +19 -0
- package/src/Components/Icons/RateIcon-1x.js +19 -0
- package/src/Components/Icons/RateIcon-2x.js +19 -0
- package/src/Components/Icons/RectangleXmark.js +14 -0
- package/src/Components/Icons/RectangleXmarkRegular.js +14 -0
- package/src/Components/Icons/ReorderRows.js +21 -0
- package/src/Components/Icons/RightFromBracket.js +14 -0
- package/src/Components/Icons/RightToBracket.js +14 -0
- package/src/Components/Icons/Rotate.js +18 -0
- package/src/Components/Icons/RotateLeft.js +14 -0
- package/src/Components/Icons/RotateRight.js +18 -0
- package/src/Components/Icons/ScrewdriverWrench.js +14 -0
- package/src/Components/Icons/Scroll.js +14 -0
- package/src/Components/Icons/Share.js +14 -0
- package/src/Components/Icons/Shop.js +14 -0
- package/src/Components/Icons/SortDown.js +18 -0
- package/src/Components/Icons/SortUp.js +18 -0
- package/src/Components/Icons/Square.js +14 -0
- package/src/Components/Icons/SquareCheck.js +14 -0
- package/src/Components/Icons/SquareCheckRegular.js +14 -0
- package/src/Components/Icons/SquareMinus.js +18 -0
- package/src/Components/Icons/SquareRegular.js +14 -0
- package/src/Components/Icons/Store.js +14 -0
- package/src/Components/Icons/ThumbsDown.js +14 -0
- package/src/Components/Icons/ThumbsDownRegular.js +14 -0
- package/src/Components/Icons/ThumbsUp.js +14 -0
- package/src/Components/Icons/ThumbsUpRegular.js +14 -0
- package/src/Components/Icons/Trash.js +18 -0
- package/src/Components/Icons/TrashCan.js +18 -0
- package/src/Components/Icons/TriangleExclamation.js +18 -0
- package/src/Components/Icons/Truck.js +14 -0
- package/src/Components/Icons/TruckFast.js +14 -0
- package/src/Components/Icons/User.js +14 -0
- package/src/Components/Icons/UserGroup.js +14 -0
- package/src/Components/Icons/UserSecret.js +14 -0
- package/src/Components/Icons/X.js +14 -0
- package/src/Components/Icons/Xmark.js +14 -0
- package/src/Components/Mask.js +11 -0
- package/src/Components/Messages/ConfirmationMessage.js +26 -0
- package/src/Components/Messages/ErrorMessage.js +15 -0
- package/src/Components/Messages/Loading.js +16 -0
- package/src/Components/Messages/OkMessage.js +24 -0
- package/src/Components/Messages/WaitMessage.js +18 -0
- package/src/Components/Panel/AccordionGridPanel.js +94 -0
- package/src/Components/Panel/Footer.js +20 -0
- package/src/Components/Panel/FormPanel.js +23 -0
- package/src/Components/Panel/GridPanel.js +45 -0
- package/src/Components/Panel/Header.js +107 -0
- package/src/Components/Panel/Panel.js +152 -0
- package/src/Components/Panel/TabPanel.js +331 -0
- package/src/Components/Panel/UploadDownload.js +10 -0
- package/src/Components/Picker/Picker.js +64 -0
- package/src/Components/ScreenContainer.js +71 -0
- package/src/Components/Screens/DataMgt.js +250 -0
- package/src/Components/Toolbar/FilterToolbar.js +20 -0
- package/src/Components/Toolbar/Pagination.js +146 -0
- package/src/Components/Toolbar/PaginationToolbar.js +22 -0
- package/src/Components/Toolbar/Toolbar.js +18 -0
- package/src/Components/WaitModal.js +31 -0
- package/src/Components/Window/Editor.js +19 -0
- package/src/Constants/Alert.js +3 -0
- package/src/Constants/Date.js +3 -0
- package/src/Constants/Directions.js +8 -0
- package/src/Constants/EditorTypes.js +4 -0
- package/src/Constants/File.js +2 -0
- package/src/Constants/Grid.js +4 -0
- package/src/Constants/Input.js +1 -0
- package/src/Constants/Selection.js +5 -0
- package/src/Constants/Styles.js +86 -0
- package/src/Constants/UiModes.js +2 -0
- package/src/Data/Hoc/withRedux.js +48 -0
- package/src/Data/useOneHatData.js +75 -0
- package/src/Functions/BankersRound.js +11 -0
- package/src/Functions/Timer.js +92 -0
- package/src/Functions/deleteSecure.js +6 -0
- package/src/Functions/emptyFn.js +1 -0
- package/src/Functions/getComponentFromType.js +106 -0
- package/src/Functions/getIsMobile.js +5 -0
- package/src/Functions/getPref.js +7 -0
- package/src/Functions/getSecure.js +21 -0
- package/src/Functions/getTokenHeaders.js +13 -0
- package/src/Functions/inArray.js +5 -0
- package/src/Functions/isJson.js +8 -0
- package/src/Functions/processImage.js +16 -0
- package/src/Functions/setPref.js +14 -0
- package/src/Functions/setProgress.js +49 -0
- package/src/Functions/setSecure.js +35 -0
- package/src/Functions/setUiMode.js +5 -0
- package/src/Functions/sleep.js +3 -0
- package/src/Functions/testProps.js +24 -0
- package/src/Functions/trackEngagementHit.js +11 -0
- package/src/Functions/verifyCompleted.js +18 -0
- package/src/Functions/waitFor.js +16 -0
- package/src/Hooks/useAppState.js +34 -0
- package/src/Hooks/useAsync.js +13 -0
- package/src/Hooks/useBlocking.js +18 -0
- package/src/Hooks/useCameraRoll.js +41 -0
- package/src/Hooks/useForceUpdate.js +14 -0
- package/src/Hooks/useIsMounted.js +14 -0
- package/src/Hooks/useNotifications.js +279 -0
- package/src/Styles/StyleSheets.js +14 -0
- package/src/Styles/ThemeOverrides.js +264 -0
- package/src/UiConfig.js +19 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import React, { useState, } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Column,
|
|
5
|
+
Icon,
|
|
6
|
+
Pressable,
|
|
7
|
+
Row,
|
|
8
|
+
Text,
|
|
9
|
+
} from 'native-base';
|
|
10
|
+
import {
|
|
11
|
+
HORIZONTAL,
|
|
12
|
+
VERTICAL,
|
|
13
|
+
} from '../../Constants/Directions';
|
|
14
|
+
import IconButton from '../Buttons/IconButton';
|
|
15
|
+
import Minimize from '../Icons/Minimize';
|
|
16
|
+
import Maximize from '../Icons/Maximize';
|
|
17
|
+
import styles from '../../Constants/Styles';
|
|
18
|
+
import Panel from './Panel';
|
|
19
|
+
import _ from 'lodash';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export default function TabPanel(props) {
|
|
23
|
+
const {
|
|
24
|
+
tabs = [],
|
|
25
|
+
direction = HORIZONTAL,
|
|
26
|
+
tabWidth = 150, // used on VERTICAL mode only
|
|
27
|
+
tabHeight = '44px', // used on HORIZONTAL mode only
|
|
28
|
+
additionalButtons,
|
|
29
|
+
initialTab = 0,
|
|
30
|
+
startsCollapsed = true,
|
|
31
|
+
onChangeCurrentTab,
|
|
32
|
+
onChangeIsCollapsed,
|
|
33
|
+
...propsToPass
|
|
34
|
+
} = props,
|
|
35
|
+
[currentTab, setCurrentTabRaw] = useState(initialTab),
|
|
36
|
+
[isCollapsed, setIsCollapsedRaw] = useState(startsCollapsed),
|
|
37
|
+
setIsCollapsed = (isCollapsed) => {
|
|
38
|
+
setIsCollapsedRaw(isCollapsed);
|
|
39
|
+
if (onChangeIsCollapsed) {
|
|
40
|
+
onChangeIsCollapsed(isCollapsed);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
setCurrentTab = (ix) => {
|
|
44
|
+
setCurrentTabRaw(ix);
|
|
45
|
+
if (onChangeCurrentTab) {
|
|
46
|
+
onChangeCurrentTab(ix);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
getButtonProps = () => {
|
|
50
|
+
const
|
|
51
|
+
iconProps = {
|
|
52
|
+
size: 'md',
|
|
53
|
+
},
|
|
54
|
+
textProps = {
|
|
55
|
+
ml: '-8px',
|
|
56
|
+
mr: '8px',
|
|
57
|
+
},
|
|
58
|
+
buttonProps = {
|
|
59
|
+
bg: styles.TAB_BG,
|
|
60
|
+
color: styles.TAB_COLOR,
|
|
61
|
+
fontSize: styles.TAB_FONTSIZE,
|
|
62
|
+
textAlign: 'left',
|
|
63
|
+
justifyContent: isCollapsed ? 'center' : 'flex-start',
|
|
64
|
+
};
|
|
65
|
+
switch(direction) {
|
|
66
|
+
case VERTICAL:
|
|
67
|
+
buttonProps.borderLeftRadius = 4;
|
|
68
|
+
buttonProps.borderRightRadius = 0;
|
|
69
|
+
buttonProps.w = '100%';
|
|
70
|
+
buttonProps.mb = 1;
|
|
71
|
+
textProps.w = '100%';
|
|
72
|
+
textProps.py = 0;
|
|
73
|
+
textProps.pl = 3;
|
|
74
|
+
textProps.mb = 1;
|
|
75
|
+
break;
|
|
76
|
+
case HORIZONTAL:
|
|
77
|
+
buttonProps.borderTopRadius = 4;
|
|
78
|
+
buttonProps.borderBottomRadius = 0;
|
|
79
|
+
textProps.borderTopRadius = 4;
|
|
80
|
+
buttonProps.mr = 1;
|
|
81
|
+
buttonProps.py = 1;
|
|
82
|
+
textProps.mr = 1;
|
|
83
|
+
textProps.px = 1;
|
|
84
|
+
textProps.py = 1;
|
|
85
|
+
break;
|
|
86
|
+
default:
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
buttonProps,
|
|
90
|
+
textProps,
|
|
91
|
+
iconProps,
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
renderTabs = () => {
|
|
95
|
+
const
|
|
96
|
+
{
|
|
97
|
+
buttonProps,
|
|
98
|
+
textProps,
|
|
99
|
+
iconProps,
|
|
100
|
+
} = getButtonProps(),
|
|
101
|
+
buttons = [];
|
|
102
|
+
|
|
103
|
+
_.each(tabs, (tab, ix) => {
|
|
104
|
+
if (!tab._icon) {
|
|
105
|
+
throw new Error('tab._icon required!');
|
|
106
|
+
}
|
|
107
|
+
let button;
|
|
108
|
+
const
|
|
109
|
+
isCurrentTab = ix === currentTab,
|
|
110
|
+
thisButtonProps = {};
|
|
111
|
+
if (isCollapsed) {
|
|
112
|
+
button = <IconButton
|
|
113
|
+
key={'tab' + ix}
|
|
114
|
+
onPress={() => setCurrentTab(ix)}
|
|
115
|
+
{...buttonProps}
|
|
116
|
+
// {...thisButtonProps}
|
|
117
|
+
_icon={{
|
|
118
|
+
color: isCurrentTab ? styles.TAB_ACTIVE_ICON_COLOR : styles.TAB_ICON_COLOR,
|
|
119
|
+
...iconProps,
|
|
120
|
+
...tab._icon,
|
|
121
|
+
}}
|
|
122
|
+
_hover={{
|
|
123
|
+
bg: isCurrentTab? styles.TAB_ACTIVE_HOVER_BG : styles.TAB_HOVER_BG,
|
|
124
|
+
}}
|
|
125
|
+
bg={isCurrentTab ? styles.TAB_ACTIVE_BG : styles.TAB_BG}
|
|
126
|
+
tooltip={tab.title}
|
|
127
|
+
/>;
|
|
128
|
+
} else {
|
|
129
|
+
button = <Button
|
|
130
|
+
key={'tab' + ix}
|
|
131
|
+
onPress={() => setCurrentTab(ix)}
|
|
132
|
+
leftIcon={<Icon
|
|
133
|
+
color={isCurrentTab ? styles.TAB_ACTIVE_ICON_COLOR : styles.TAB_ICON_COLOR}
|
|
134
|
+
{...iconProps}
|
|
135
|
+
{...tab._icon}
|
|
136
|
+
/>}
|
|
137
|
+
{...buttonProps}
|
|
138
|
+
{...thisButtonProps}
|
|
139
|
+
_hover={{
|
|
140
|
+
bg: isCurrentTab? styles.TAB_ACTIVE_HOVER_BG : styles.TAB_HOVER_BG,
|
|
141
|
+
}}
|
|
142
|
+
bg={isCurrentTab ? styles.TAB_ACTIVE_BG : styles.TAB_BG}
|
|
143
|
+
>
|
|
144
|
+
<Text
|
|
145
|
+
color={isCurrentTab ? styles.TAB_ACTIVE_COLOR : styles.TAB_COLOR}
|
|
146
|
+
fontSize={styles.TAB_FONTSIZE}
|
|
147
|
+
numberOfLines={1}
|
|
148
|
+
ellipsizeMode="head"
|
|
149
|
+
{...textProps}
|
|
150
|
+
>{tab.title}</Text>
|
|
151
|
+
</Button>;
|
|
152
|
+
}
|
|
153
|
+
buttons.push(button);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
if (additionalButtons) {
|
|
157
|
+
_.each(additionalButtons, (additionalButton, ix) => {
|
|
158
|
+
if (!additionalButton._icon) {
|
|
159
|
+
throw new Error('additionalButton._icon required!');
|
|
160
|
+
}
|
|
161
|
+
let button;
|
|
162
|
+
const thisButtonProps = {};
|
|
163
|
+
if (!ix) {
|
|
164
|
+
// First button should have gap before it
|
|
165
|
+
switch(direction) {
|
|
166
|
+
case VERTICAL:
|
|
167
|
+
thisButtonProps.mt = 6;
|
|
168
|
+
break;
|
|
169
|
+
case HORIZONTAL:
|
|
170
|
+
thisButtonProps.ml = 6;
|
|
171
|
+
break;
|
|
172
|
+
default:
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (isCollapsed) {
|
|
176
|
+
button = <IconButton
|
|
177
|
+
key={'additionalBtn' + ix}
|
|
178
|
+
onPress={additionalButton.onPress}
|
|
179
|
+
{...buttonProps}
|
|
180
|
+
{...thisButtonProps}
|
|
181
|
+
_icon={{
|
|
182
|
+
...additionalButton._icon,
|
|
183
|
+
color: styles.TAB_ICON_COLOR,
|
|
184
|
+
}}
|
|
185
|
+
_hover={{
|
|
186
|
+
bg: styles.TAB_HOVER_BG,
|
|
187
|
+
}}
|
|
188
|
+
bg={styles.TAB_BG}
|
|
189
|
+
tooltip={additionalButton.text}
|
|
190
|
+
/>;
|
|
191
|
+
} else {
|
|
192
|
+
button = <Button
|
|
193
|
+
key={'additionalBtn' + ix}
|
|
194
|
+
onPress={additionalButton.onPress}
|
|
195
|
+
leftIcon={<Icon
|
|
196
|
+
color={styles.TAB_ICON_COLOR}
|
|
197
|
+
{...additionalButton._icon}
|
|
198
|
+
/>}
|
|
199
|
+
_hover={{
|
|
200
|
+
bg: styles.TAB_HOVER_BG,
|
|
201
|
+
}}
|
|
202
|
+
bg={styles.TAB_BG}
|
|
203
|
+
{...buttonProps}
|
|
204
|
+
{...thisButtonProps}
|
|
205
|
+
>
|
|
206
|
+
<Text
|
|
207
|
+
color={styles.TAB_COLOR}
|
|
208
|
+
fontSize={styles.TAB_FONTSIZE}
|
|
209
|
+
numberOfLines={1}
|
|
210
|
+
ellipsizeMode="head"
|
|
211
|
+
{...textProps}
|
|
212
|
+
>{additionalButton.text}</Text>
|
|
213
|
+
</Button>;
|
|
214
|
+
}
|
|
215
|
+
buttons.push(button);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return buttons;
|
|
220
|
+
},
|
|
221
|
+
renderCurrentTabContent = () => {
|
|
222
|
+
if (tabs[currentTab].content) {
|
|
223
|
+
return tabs[currentTab].content;
|
|
224
|
+
}
|
|
225
|
+
return _.map(tabs[currentTab].items, (item, ix) => {
|
|
226
|
+
return React.cloneElement(item, { key: ix });
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
renderToggleButton = () => {
|
|
230
|
+
const
|
|
231
|
+
{
|
|
232
|
+
buttonProps,
|
|
233
|
+
textProps,
|
|
234
|
+
} = getButtonProps();
|
|
235
|
+
|
|
236
|
+
let button;
|
|
237
|
+
if (isCollapsed) {
|
|
238
|
+
button = <IconButton
|
|
239
|
+
key="toggleBtn"
|
|
240
|
+
onPress={onToggleCollapse}
|
|
241
|
+
{...buttonProps}
|
|
242
|
+
_icon={{
|
|
243
|
+
as: Maximize,
|
|
244
|
+
color: styles.TAB_ICON_COLOR,
|
|
245
|
+
}}
|
|
246
|
+
_hover={{
|
|
247
|
+
bg: styles.TAB_HOVER_BG,
|
|
248
|
+
}}
|
|
249
|
+
bg={styles.TAB_BG}
|
|
250
|
+
tooltip={isCollapsed ? 'Expand' : 'Collapse'}
|
|
251
|
+
/>;
|
|
252
|
+
} else {
|
|
253
|
+
button = <Button
|
|
254
|
+
key="toggleBtn"
|
|
255
|
+
onPress={onToggleCollapse}
|
|
256
|
+
leftIcon={<Icon
|
|
257
|
+
as={Minimize}
|
|
258
|
+
color={styles.TAB_ICON_COLOR}
|
|
259
|
+
/>}
|
|
260
|
+
_hover={{
|
|
261
|
+
bg: styles.TAB_HOVER_BG,
|
|
262
|
+
}}
|
|
263
|
+
bg={styles.TAB_BG}
|
|
264
|
+
{...buttonProps}
|
|
265
|
+
// {...thisButtonProps}
|
|
266
|
+
>
|
|
267
|
+
<Text
|
|
268
|
+
color={styles.TAB_COLOR}
|
|
269
|
+
fontSize={styles.TAB_FONTSIZE}
|
|
270
|
+
numberOfLines={1}
|
|
271
|
+
ellipsizeMode="head"
|
|
272
|
+
{...textProps}
|
|
273
|
+
>Collapse</Text>
|
|
274
|
+
</Button>;
|
|
275
|
+
}
|
|
276
|
+
return button;
|
|
277
|
+
},
|
|
278
|
+
onToggleCollapse = () => {
|
|
279
|
+
setIsCollapsed(!isCollapsed);
|
|
280
|
+
};
|
|
281
|
+
if (direction === VERTICAL) {
|
|
282
|
+
return <Panel {...propsToPass}>
|
|
283
|
+
<Row flex={1} w="100%">
|
|
284
|
+
<Column
|
|
285
|
+
alignItems="center"
|
|
286
|
+
justifyContent="flex-start"
|
|
287
|
+
py={2}
|
|
288
|
+
pl={isCollapsed ? 1 : 4}
|
|
289
|
+
bg={styles.TAB_BAR_BG}
|
|
290
|
+
w={isCollapsed ? '50px' : tabWidth}
|
|
291
|
+
>
|
|
292
|
+
{renderTabs()}
|
|
293
|
+
<Column flex={1} w="100%" justifyContent="flex-end">
|
|
294
|
+
{renderToggleButton()}
|
|
295
|
+
</Column>
|
|
296
|
+
</Column>
|
|
297
|
+
<Column
|
|
298
|
+
alignItems="center"
|
|
299
|
+
justifyContent="flex-start"
|
|
300
|
+
flex={1}
|
|
301
|
+
>
|
|
302
|
+
{renderCurrentTabContent()}
|
|
303
|
+
</Column>
|
|
304
|
+
</Row>
|
|
305
|
+
</Panel>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// HORIZONTAL
|
|
309
|
+
return <Panel flex={1} w="100%" {...propsToPass} {...props._panel}>
|
|
310
|
+
<Column flex={1} w="100%">
|
|
311
|
+
<Row
|
|
312
|
+
alignItems="center"
|
|
313
|
+
justifyContent="flex-start"
|
|
314
|
+
p={2}
|
|
315
|
+
pb={0}
|
|
316
|
+
bg={styles.TAB_BAR_BG}
|
|
317
|
+
h={isCollapsed ? '30px' : tabHeight}
|
|
318
|
+
>
|
|
319
|
+
{renderTabs()}
|
|
320
|
+
<Row flex={1} h="100%" justifyContent="flex-end">
|
|
321
|
+
<Row h="100%">
|
|
322
|
+
{renderToggleButton()}
|
|
323
|
+
</Row>
|
|
324
|
+
</Row>
|
|
325
|
+
</Row>
|
|
326
|
+
<Row flex={1}>
|
|
327
|
+
{renderCurrentTabContent()}
|
|
328
|
+
</Row>
|
|
329
|
+
</Column>
|
|
330
|
+
</Panel>;
|
|
331
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon,
|
|
3
|
+
Row,
|
|
4
|
+
Select,
|
|
5
|
+
Tooltip,
|
|
6
|
+
} from 'native-base';
|
|
7
|
+
import CaretDown from '../Icons/CaretDown';
|
|
8
|
+
import testProps from '../../Functions/testProps';
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
|
|
11
|
+
export default function Picker(props) {
|
|
12
|
+
const {
|
|
13
|
+
entities,
|
|
14
|
+
allowNull = true,
|
|
15
|
+
cutoff = 25,
|
|
16
|
+
nullLabel = 'None',
|
|
17
|
+
_select = {},
|
|
18
|
+
placeholder = 'Select',
|
|
19
|
+
tooltip,
|
|
20
|
+
tooltipPlacement = 'bottom',
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
let items = [];
|
|
24
|
+
_.each(entities, (entity) => {
|
|
25
|
+
let label = entity.displayValue;
|
|
26
|
+
if (!label) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (label.length > cutoff) {
|
|
30
|
+
label = label.substring(0, 25) + '...';
|
|
31
|
+
}
|
|
32
|
+
items.push(<Select.Item key={entity.id} label={label} value={entity.id} {...testProps('PickerItem-' + entity.id)} />);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (allowNull) {
|
|
36
|
+
items.unshift(<Select.Item key="null" label={nullLabel} value={null} {...testProps('PickerItem-null')} />);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!items.length) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const selectedValue = _select.selectedValue;
|
|
44
|
+
if (!allowNull && !selectedValue) {
|
|
45
|
+
_select.borderColor = '#f00';
|
|
46
|
+
_select.borderWidth = 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Set an explicit dropdownIcon to add margin to it, so it looks better
|
|
50
|
+
let select = <Select
|
|
51
|
+
placeholder={placeholder}
|
|
52
|
+
isDisabled={false}
|
|
53
|
+
dropdownIcon={<Icon as={CaretDown} size="sm" mr={3} color="trueGray.800" />}
|
|
54
|
+
{..._select}
|
|
55
|
+
>{items}</Select>;
|
|
56
|
+
if (tooltip) {
|
|
57
|
+
//TODO: This doesn't yet work, but doesn't do anything harmful either!
|
|
58
|
+
select = <Tooltip label={tooltip} placement={tooltipPlacement}>{select}</Tooltip>;
|
|
59
|
+
}
|
|
60
|
+
return <Row {...props}>
|
|
61
|
+
{select}
|
|
62
|
+
</Row>;
|
|
63
|
+
}
|
|
64
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Keyboard,
|
|
3
|
+
Platform,
|
|
4
|
+
TouchableWithoutFeedback,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
import {
|
|
7
|
+
Column,
|
|
8
|
+
KeyboardAvoidingView,
|
|
9
|
+
ScrollView,
|
|
10
|
+
} from 'native-base';
|
|
11
|
+
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
|
|
12
|
+
import { useDimensions } from '@react-native-community/Hooks';
|
|
13
|
+
import { useHeaderHeight } from '@react-navigation/elements';
|
|
14
|
+
import testProps from '../Functions/testProps';
|
|
15
|
+
|
|
16
|
+
export default function ScreenContainer(props) {
|
|
17
|
+
const {
|
|
18
|
+
screenName = 'ScreenContainer',
|
|
19
|
+
p = 0,
|
|
20
|
+
safeArea = false,
|
|
21
|
+
bg = '#fff',
|
|
22
|
+
scrollEnabled = false,
|
|
23
|
+
keyboardAvoiding = false,
|
|
24
|
+
behavior = Platform.OS === 'ios' ? 'padding' : 'height', // for the KeyboardAvoidingView. 'height', 'position', 'padding'
|
|
25
|
+
justifyContent = 'flex-start',
|
|
26
|
+
alignItems = 'center',
|
|
27
|
+
onLayout = () => {},
|
|
28
|
+
} = props,
|
|
29
|
+
screen = useDimensions().screen,
|
|
30
|
+
headerHeight = useHeaderHeight(),
|
|
31
|
+
safeAreaProps = {};
|
|
32
|
+
if (safeArea !== false) {
|
|
33
|
+
safeAreaProps.safeAreaTop = true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let content = <Column
|
|
37
|
+
{...testProps(screenName)}
|
|
38
|
+
alignItems={alignItems}
|
|
39
|
+
justifyContent={justifyContent}
|
|
40
|
+
flex={1}
|
|
41
|
+
w="100%"
|
|
42
|
+
p={p}
|
|
43
|
+
bg={bg}
|
|
44
|
+
overflow="visible"
|
|
45
|
+
onLayout={onLayout}
|
|
46
|
+
{...safeAreaProps}
|
|
47
|
+
>
|
|
48
|
+
{props.children}
|
|
49
|
+
</Column>;
|
|
50
|
+
if (keyboardAvoiding && scrollEnabled) {
|
|
51
|
+
content = <KeyboardAwareScrollView behavior={behavior} contentContainerStyle={{ flex: 1, }}>
|
|
52
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
|
53
|
+
{content}
|
|
54
|
+
</TouchableWithoutFeedback>
|
|
55
|
+
</KeyboardAwareScrollView>;
|
|
56
|
+
} else {
|
|
57
|
+
if (keyboardAvoiding) {
|
|
58
|
+
content = <KeyboardAvoidingView behavior={behavior} flex={1}>
|
|
59
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
|
60
|
+
{content}
|
|
61
|
+
</TouchableWithoutFeedback>
|
|
62
|
+
</KeyboardAvoidingView>;
|
|
63
|
+
}
|
|
64
|
+
if (scrollEnabled) {
|
|
65
|
+
content = <ScrollView keyboardShouldPersistTaps="always" _contentContainerStyle={{
|
|
66
|
+
minHeight: screen.height - headerHeight,
|
|
67
|
+
}}>{content}</ScrollView>;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return content;
|
|
71
|
+
}
|