@onehat/ui 0.1.3 → 0.2.1
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 +14 -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
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onehat/ui",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Base UI for OneHat apps",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "npx cypress open --config-file ../cypress.json"
|
|
9
|
-
"docs": "jsdoc -c ./jsdoc.json -t ./node_modules/ink-docstrap/template -R README.md"
|
|
10
|
-
},
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/OneHatRepo/ui.git"
|
|
8
|
+
"test": "npx cypress open --config-file ../cypress.json"
|
|
14
9
|
},
|
|
15
10
|
"keywords": [
|
|
16
11
|
"onehat",
|
|
@@ -22,34 +17,35 @@
|
|
|
22
17
|
"company": "OneHat Technologies, LLC",
|
|
23
18
|
"url": "https://onehat.com"
|
|
24
19
|
},
|
|
25
|
-
"license": "
|
|
26
|
-
"bugs": {
|
|
27
|
-
"url": "https://github.com/OneHatRepo/ui/issues"
|
|
28
|
-
},
|
|
29
|
-
"homepage": "https://github.com/OneHatRepo/ui#readme",
|
|
20
|
+
"license": "UNLICENSED",
|
|
30
21
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
22
|
+
"@ckeditor/ckeditor5-react": "^5.0.6",
|
|
23
|
+
"@onehat/data": "^1.13.6",
|
|
24
|
+
"browser-or-node": "^2.1.1",
|
|
25
|
+
"ckeditor5-custom-build": "file:ckeditor5",
|
|
33
26
|
"js-cookie": "^3.0.1",
|
|
34
27
|
"native-base": "^3.4.25",
|
|
35
|
-
"react-hook-form": "^7.
|
|
28
|
+
"react-hook-form": "^7.43.1"
|
|
36
29
|
},
|
|
37
30
|
"peerDependencies": {
|
|
38
31
|
"react": "*",
|
|
32
|
+
"react-color": "^2.19.3",
|
|
33
|
+
"react-datetime": "^3.2.0",
|
|
34
|
+
"react-draggable": "^4.4.5",
|
|
39
35
|
"react-dom": "*",
|
|
40
36
|
"react-native": "*"
|
|
41
37
|
},
|
|
42
38
|
"devDependencies": {
|
|
43
|
-
"@babel/core": "^7.
|
|
44
|
-
"@babel/node": "^7.20.
|
|
39
|
+
"@babel/core": "^7.21.0",
|
|
40
|
+
"@babel/node": "^7.20.7",
|
|
45
41
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
46
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
42
|
+
"@babel/plugin-transform-runtime": "^7.21.0",
|
|
47
43
|
"@babel/preset-env": "^7.20.2",
|
|
48
|
-
"@babel/register": "^7.
|
|
49
|
-
"@babel/runtime": "^7.
|
|
50
|
-
"@cypress/webpack-preprocessor": "^5.
|
|
51
|
-
"babel-loader": "^9.1.
|
|
52
|
-
"cypress": "^12.
|
|
44
|
+
"@babel/register": "^7.21.0",
|
|
45
|
+
"@babel/runtime": "^7.21.0",
|
|
46
|
+
"@cypress/webpack-preprocessor": "^5.17.0",
|
|
47
|
+
"babel-loader": "^9.1.2",
|
|
48
|
+
"cypress": "^12.6.0",
|
|
53
49
|
"webpack": "^5.75.0"
|
|
54
50
|
}
|
|
55
51
|
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { useState, useEffect, useRef, } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Column,
|
|
5
|
+
Pressable,
|
|
6
|
+
Row,
|
|
7
|
+
ScrollView,
|
|
8
|
+
Text,
|
|
9
|
+
} from 'native-base';
|
|
10
|
+
import inArray from '../../Functions/inArray.js';
|
|
11
|
+
import emptyFn from '../../Functions/emptyFn.js';
|
|
12
|
+
import _ from 'lodash';
|
|
13
|
+
|
|
14
|
+
// The Accordion has two modes.
|
|
15
|
+
// In the first (onlyOne), only one section can be expanded at a time.
|
|
16
|
+
// Otherwise, any section can be expanded—multiple at a time.
|
|
17
|
+
// In the first, the section which is newly expanded will scroll to the top,
|
|
18
|
+
// and extra padding down below will be added. In the other mode,
|
|
19
|
+
// no auto scrolling will take place
|
|
20
|
+
//
|
|
21
|
+
// If you want to scroll in the second mode…
|
|
22
|
+
// Every time I expand or collapse a section, get the new height of each section.
|
|
23
|
+
// That way you can still calculate the top position for any sections scrolling
|
|
24
|
+
// Might be able to do a delta since last calsulation.
|
|
25
|
+
|
|
26
|
+
export default function Accordion(props) {
|
|
27
|
+
const {
|
|
28
|
+
sections = [],
|
|
29
|
+
activeSections = [],
|
|
30
|
+
setActiveSections = emptyFn,
|
|
31
|
+
renderHeader = emptyFn,
|
|
32
|
+
renderContent = emptyFn,
|
|
33
|
+
onAnimationEnd = emptyFn,
|
|
34
|
+
onLayout,
|
|
35
|
+
onlyOne = true,
|
|
36
|
+
...propsToPass
|
|
37
|
+
} = props,
|
|
38
|
+
scrollViewRef = useRef(),
|
|
39
|
+
refs = {},
|
|
40
|
+
[isRendered, setIsRendered] = useState(false),
|
|
41
|
+
[containerInitialHeight, setContainerInitialHeight] = useState(0),
|
|
42
|
+
sectionHeight = containerInitialHeight / (sections?.length || 1), // protect against divide by zero
|
|
43
|
+
calculateExtraPadding = () => {
|
|
44
|
+
// this adds extra padding to the bottom, depending on what's active
|
|
45
|
+
// so that scrollTo can scroll the active header all the way downto the top
|
|
46
|
+
let extraPadding = 0;
|
|
47
|
+
const activeIx = activeSections[0];
|
|
48
|
+
if (isRendered && activeIx) {
|
|
49
|
+
// when the first section is active, we don't need to add any padding.
|
|
50
|
+
// For each subsequent section, we need to add more and more padding
|
|
51
|
+
// until when the last section is active, we need to add padding equal to
|
|
52
|
+
// the container height
|
|
53
|
+
extraPadding = (activeIx +2) * sectionHeight;
|
|
54
|
+
}
|
|
55
|
+
return extraPadding;
|
|
56
|
+
},
|
|
57
|
+
items = _.map(sections, (section, ix) => {
|
|
58
|
+
|
|
59
|
+
const itemVar = 'item' + ix;
|
|
60
|
+
refs[itemVar] = useRef(); // so we have refs for each section - e.g. refs.item0
|
|
61
|
+
|
|
62
|
+
const
|
|
63
|
+
isActive = inArray(ix, activeSections),
|
|
64
|
+
header = renderHeader(section, ix, isActive),
|
|
65
|
+
content = renderContent(section, ix, isActive, refs[itemVar]),
|
|
66
|
+
rowProps = {};
|
|
67
|
+
|
|
68
|
+
// TODO: Animate height. Possible help here: https://stackoverflow.com/a/57333550 and https://stackoverflow.com/a/64797961
|
|
69
|
+
if (isActive) {
|
|
70
|
+
rowProps.flex = 1;
|
|
71
|
+
} else {
|
|
72
|
+
rowProps.h = 0;
|
|
73
|
+
rowProps.overflow = 'hidden'; // otherwise some elements mistakenly show
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return <Column key={ix}>
|
|
77
|
+
<Pressable
|
|
78
|
+
onPress={(e) => {
|
|
79
|
+
let newActiveSections = [];
|
|
80
|
+
if (onlyOne) {
|
|
81
|
+
if (!isActive) {
|
|
82
|
+
newActiveSections = [ix];
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
if (isActive) {
|
|
86
|
+
newActiveSections = _.without(activeSections, ix);
|
|
87
|
+
} else {
|
|
88
|
+
newActiveSections = _.clone(activeSections);
|
|
89
|
+
newActiveSections.push(ix);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
setActiveSections(newActiveSections);
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
{header}
|
|
96
|
+
</Pressable>
|
|
97
|
+
<Row {...rowProps} bg="#f00">
|
|
98
|
+
{content}
|
|
99
|
+
</Row>
|
|
100
|
+
</Column>;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!isRendered) {
|
|
105
|
+
return () => {};
|
|
106
|
+
}
|
|
107
|
+
if (!onlyOne) {
|
|
108
|
+
return () => {}; // Don't animate if !onlyOne
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const
|
|
112
|
+
scrollView = scrollViewRef.current,
|
|
113
|
+
activeIx = activeSections[0];
|
|
114
|
+
|
|
115
|
+
let scrollTo = 0;
|
|
116
|
+
if (activeSections?.length && sections?.length) {
|
|
117
|
+
scrollTo = sectionHeight * activeIx;
|
|
118
|
+
}
|
|
119
|
+
setTimeout(()=> {
|
|
120
|
+
scrollView.scrollTo({ x: 0, y: scrollTo, animated: true });
|
|
121
|
+
}, 10); // delay so render can finish
|
|
122
|
+
|
|
123
|
+
}, [activeSections, isRendered]);
|
|
124
|
+
|
|
125
|
+
return <ScrollView ref={scrollViewRef} keyboardShouldPersistTaps="always" flex={1} w="100%">
|
|
126
|
+
<Column
|
|
127
|
+
{...propsToPass}
|
|
128
|
+
pb={(onlyOne ? calculateExtraPadding() : 0) + 'px'}
|
|
129
|
+
onLayout={(e) => {
|
|
130
|
+
if (!containerInitialHeight) {
|
|
131
|
+
const { height } = e.nativeEvent.layout;
|
|
132
|
+
setContainerInitialHeight(height);
|
|
133
|
+
console.log('height', height);
|
|
134
|
+
}
|
|
135
|
+
if (onLayout) {
|
|
136
|
+
onLayout(e);
|
|
137
|
+
}
|
|
138
|
+
setIsRendered(true);
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
{items}
|
|
142
|
+
</Column>
|
|
143
|
+
</ScrollView>;
|
|
144
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon,
|
|
3
|
+
Pressable,
|
|
4
|
+
Text,
|
|
5
|
+
} from 'native-base';
|
|
6
|
+
import AngleLeft from '../Icons/AngleLeft.js';
|
|
7
|
+
|
|
8
|
+
export default function BackButton(props) {
|
|
9
|
+
return <Pressable flexDirection="row" justifyContent="flex-start" alignItems="center" pr={5} {...props}>
|
|
10
|
+
<Icon as={AngleLeft} color="#2563eb" size="sm" />
|
|
11
|
+
<Text fontSize={20} color="#2563eb" left={-1}>Back</Text>
|
|
12
|
+
</Pressable>;
|
|
13
|
+
}
|
|
14
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Badge,
|
|
3
|
+
Icon,
|
|
4
|
+
Pressable,
|
|
5
|
+
Text,
|
|
6
|
+
} from 'native-base';
|
|
7
|
+
import {
|
|
8
|
+
Ionicons,
|
|
9
|
+
} from '@expo/vector-icons';
|
|
10
|
+
import testProps from '../../Functions/testProps';
|
|
11
|
+
|
|
12
|
+
export default function CartButtonWithBadge(props) {
|
|
13
|
+
const {
|
|
14
|
+
badgeMsg,
|
|
15
|
+
onPress,
|
|
16
|
+
} = props;
|
|
17
|
+
return <Pressable onPress={onPress} flexDirection="row" justifyContent="center" pr={5} {...testProps('cartBtn')}>
|
|
18
|
+
<Icon as={Ionicons} name="cart" color="primary.800" size="xl" pb={1} />
|
|
19
|
+
{badgeMsg > 0 &&
|
|
20
|
+
<Badge position="absolute" right={2} top={-10} colorScheme="danger" rounded="20px" variant="solid" {...testProps('cartBadge')}>
|
|
21
|
+
<Text fontSize={12} fontWeight="bold" color="lightText">{badgeMsg}</Text>
|
|
22
|
+
</Badge>}
|
|
23
|
+
</Pressable>
|
|
24
|
+
}
|
|
25
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Icon,
|
|
4
|
+
Pressable,
|
|
5
|
+
Spinner,
|
|
6
|
+
Tooltip,
|
|
7
|
+
} from 'native-base';
|
|
8
|
+
|
|
9
|
+
const IconButton = React.forwardRef((props, ref) => {
|
|
10
|
+
const {
|
|
11
|
+
// _icon, // props for the icon component
|
|
12
|
+
// icon, // The actual icon component to use
|
|
13
|
+
_spinner,
|
|
14
|
+
isLoading = false,
|
|
15
|
+
tooltip,
|
|
16
|
+
tooltipPlacement = 'bottom',
|
|
17
|
+
} = props;
|
|
18
|
+
const propsIcon = props._icon || {};
|
|
19
|
+
let icon = props.icon || <Icon {...propsIcon} />;
|
|
20
|
+
if (isLoading) {
|
|
21
|
+
icon = <Spinner {..._spinner} />;
|
|
22
|
+
}
|
|
23
|
+
const pressable = <Pressable
|
|
24
|
+
ref={ref}
|
|
25
|
+
borderRadius="md"
|
|
26
|
+
colorScheme="primary"
|
|
27
|
+
flexDirection="row"
|
|
28
|
+
justifyContent="center"
|
|
29
|
+
alignItems="center"
|
|
30
|
+
p={2}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{icon}
|
|
34
|
+
</Pressable>;
|
|
35
|
+
let ret = pressable;
|
|
36
|
+
if (tooltip) {
|
|
37
|
+
ret = <Tooltip label={tooltip} placement={tooltipPlacement}>{pressable}</Tooltip>;
|
|
38
|
+
}
|
|
39
|
+
return ret;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export default IconButton;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import React, { useState, } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Column,
|
|
4
|
+
Row,
|
|
5
|
+
} from 'native-base';
|
|
6
|
+
import {
|
|
7
|
+
HORIZONTAL,
|
|
8
|
+
VERTICAL,
|
|
9
|
+
} from '../../Constants/Directions.js';
|
|
10
|
+
import Splitter from './Splitter.js';
|
|
11
|
+
|
|
12
|
+
export default function Container(props) {
|
|
13
|
+
const {
|
|
14
|
+
center,
|
|
15
|
+
north,
|
|
16
|
+
south,
|
|
17
|
+
east,
|
|
18
|
+
west,
|
|
19
|
+
|
|
20
|
+
isNorthCollapsed,
|
|
21
|
+
setIsNorthCollapsed,
|
|
22
|
+
isSouthCollapsed,
|
|
23
|
+
setIsSouthCollapsed,
|
|
24
|
+
isEastCollapsed,
|
|
25
|
+
setIsEastCollapsed,
|
|
26
|
+
isWestCollapsed,
|
|
27
|
+
setIsWestCollapsed,
|
|
28
|
+
} = props,
|
|
29
|
+
[localIsNorthCollapsed, setLocalIsNorthCollapsed] = useState(north ? north.props.startsCollapsed : false),
|
|
30
|
+
[localIsSouthCollapsed, setLocalIsSouthCollapsed] = useState(south ? south.props.startsCollapsed : false),
|
|
31
|
+
[localIsEastCollapsed, setLocalIsEastCollapsed] = useState(east ? east.props.startsCollapsed : false),
|
|
32
|
+
[localIsWestCollapsed, setLocalIsWestCollapsed] = useState(west ? west.props.startsCollapsed : false),
|
|
33
|
+
[northHeight, setNorthHeight] = useState(north ? north.props.h : 0),
|
|
34
|
+
[southHeight, setSouthHeight] = useState(south ? south.props.h : 0),
|
|
35
|
+
[eastWidth, setEastWidth] = useState(east ? east.props.w : 0),
|
|
36
|
+
[westWidth, setWestWidth] = useState(west ? west.props.w : 0),
|
|
37
|
+
onNorthResize = (delta) => {
|
|
38
|
+
const newHeight = northHeight + delta;
|
|
39
|
+
setNorthHeight(newHeight);
|
|
40
|
+
},
|
|
41
|
+
onSouthResize = (delta) => {
|
|
42
|
+
const newHeight = southHeight - delta; // minus
|
|
43
|
+
setSouthHeight(newHeight);
|
|
44
|
+
},
|
|
45
|
+
onEastResize = (delta) => {
|
|
46
|
+
const newWidth = eastWidth - delta; // minus
|
|
47
|
+
setEastWidth(newWidth);
|
|
48
|
+
},
|
|
49
|
+
onWestResize = (delta) => {
|
|
50
|
+
const newWidth = westWidth + delta;
|
|
51
|
+
setWestWidth(newWidth);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
let componentProps = {},
|
|
55
|
+
centerComponent = null,
|
|
56
|
+
northComponent = null,
|
|
57
|
+
northSplitter = null,
|
|
58
|
+
southComponent = null,
|
|
59
|
+
southSplitter = null,
|
|
60
|
+
eastComponent = null,
|
|
61
|
+
eastSplitter = null,
|
|
62
|
+
westComponent = null,
|
|
63
|
+
westSplitter = null;
|
|
64
|
+
|
|
65
|
+
centerComponent = React.cloneElement(center, { isCollapsible: false, });
|
|
66
|
+
if (north) {
|
|
67
|
+
componentProps.collapseDirection = VERTICAL;
|
|
68
|
+
if (!north.props.h && !north.props.flex) {
|
|
69
|
+
componentProps.flex = 50;
|
|
70
|
+
}
|
|
71
|
+
if (north.props.isResizable) {
|
|
72
|
+
if (northHeight) {
|
|
73
|
+
componentProps.h = northHeight;
|
|
74
|
+
componentProps.flex = null;
|
|
75
|
+
}
|
|
76
|
+
componentProps.w = '100%';
|
|
77
|
+
componentProps.isCollapsed = setIsNorthCollapsed ? isNorthCollapsed : localIsNorthCollapsed;
|
|
78
|
+
componentProps.setIsCollapsed = setIsNorthCollapsed || setLocalIsNorthCollapsed;
|
|
79
|
+
componentProps.onLayout = (e) => {
|
|
80
|
+
const height = parseFloat(e.nativeEvent.layout.height);
|
|
81
|
+
if (height !== northHeight) {
|
|
82
|
+
setNorthHeight(height);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
northSplitter = <Splitter mode={VERTICAL} onDragStop={onNorthResize} />;
|
|
86
|
+
}
|
|
87
|
+
northComponent = React.cloneElement(north, { ...componentProps, w: '100%', });
|
|
88
|
+
componentProps = {};
|
|
89
|
+
}
|
|
90
|
+
if (south) {
|
|
91
|
+
componentProps.collapseDirection = VERTICAL;
|
|
92
|
+
if (!south.props.h && !south.props.flex) {
|
|
93
|
+
componentProps.flex = 50;
|
|
94
|
+
}
|
|
95
|
+
if (south.props.isResizable) {
|
|
96
|
+
if (southHeight) {
|
|
97
|
+
componentProps.h = southHeight;
|
|
98
|
+
componentProps.flex = null;
|
|
99
|
+
}
|
|
100
|
+
componentProps.w = '100%';
|
|
101
|
+
componentProps.isCollapsed = setIsSouthCollapsed ? isSouthCollapsed : localIsSouthCollapsed;
|
|
102
|
+
componentProps.setIsCollapsed = setIsSouthCollapsed || setLocalIsSouthCollapsed;
|
|
103
|
+
componentProps.onLayout = (e) => {
|
|
104
|
+
const height = parseFloat(e.nativeEvent.layout.height);
|
|
105
|
+
if (height !== southHeight) {
|
|
106
|
+
setSouthHeight(height);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
southSplitter = <Splitter mode={VERTICAL} onDragStop={onSouthResize} />;
|
|
110
|
+
}
|
|
111
|
+
southComponent = React.cloneElement(south, { ...componentProps, w: '100%', });
|
|
112
|
+
componentProps = {};
|
|
113
|
+
}
|
|
114
|
+
if (east) {
|
|
115
|
+
componentProps.collapseDirection = HORIZONTAL;
|
|
116
|
+
if (!east.props.h && !east.props.flex) {
|
|
117
|
+
componentProps.flex = 50;
|
|
118
|
+
}
|
|
119
|
+
if (east.props.isResizable) {
|
|
120
|
+
if (eastWidth) {
|
|
121
|
+
componentProps.w = eastWidth;
|
|
122
|
+
componentProps.flex = null;
|
|
123
|
+
}
|
|
124
|
+
componentProps.h = '100%';
|
|
125
|
+
componentProps.isCollapsed = setIsEastCollapsed ? isEastCollapsed : localIsEastCollapsed;
|
|
126
|
+
componentProps.setIsCollapsed = setIsEastCollapsed || setLocalIsEastCollapsed;
|
|
127
|
+
componentProps.onLayout = (e) => {
|
|
128
|
+
const width = parseFloat(e.nativeEvent.layout.width);
|
|
129
|
+
if (width !== eastWidth) {
|
|
130
|
+
setEastWidth(width);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
eastSplitter = <Splitter mode={HORIZONTAL} onDragStop={onEastResize} />;
|
|
134
|
+
}
|
|
135
|
+
eastComponent = React.cloneElement(east, { ...componentProps, h: '100%', });
|
|
136
|
+
componentProps = {};
|
|
137
|
+
}
|
|
138
|
+
if (west) {
|
|
139
|
+
componentProps.collapseDirection = HORIZONTAL;
|
|
140
|
+
if (!west.props.h && !west.props.flex) {
|
|
141
|
+
componentProps.flex = 50;
|
|
142
|
+
}
|
|
143
|
+
if (west.props.isResizable) {
|
|
144
|
+
if (westWidth) {
|
|
145
|
+
componentProps.w = westWidth;
|
|
146
|
+
componentProps.flex = null;
|
|
147
|
+
}
|
|
148
|
+
componentProps.h = '100%';
|
|
149
|
+
componentProps.isCollapsed = setIsWestCollapsed ? isWestCollapsed : localIsWestCollapsed;
|
|
150
|
+
componentProps.setIsCollapsed = setIsWestCollapsed || setLocalIsWestCollapsed;
|
|
151
|
+
componentProps.onLayout = (e) => {
|
|
152
|
+
const width = parseFloat(e.nativeEvent.layout.width);
|
|
153
|
+
if (width !== westWidth) {
|
|
154
|
+
setWestWidth(width);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
westSplitter = <Splitter mode={HORIZONTAL} onDragStop={onWestResize} />;
|
|
158
|
+
}
|
|
159
|
+
westComponent = React.cloneElement(west, { ...componentProps, h: '100%', });
|
|
160
|
+
componentProps = {};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return <Column w="100%" flex={1}>
|
|
164
|
+
{northComponent}
|
|
165
|
+
{(!isNorthCollapsed && !localIsNorthCollapsed) && northSplitter}
|
|
166
|
+
<Row w="100%" flex={100}>
|
|
167
|
+
{westComponent}
|
|
168
|
+
{(!isWestCollapsed && !localIsWestCollapsed) && westSplitter}
|
|
169
|
+
<Column h="100%" flex={100}>
|
|
170
|
+
{centerComponent}
|
|
171
|
+
</Column>
|
|
172
|
+
{(!isEastCollapsed && !localIsEastCollapsed) && eastSplitter}
|
|
173
|
+
{eastComponent}
|
|
174
|
+
</Row>
|
|
175
|
+
{(!isSouthCollapsed && !localIsSouthCollapsed) && southSplitter}
|
|
176
|
+
{southComponent}
|
|
177
|
+
</Column>;
|
|
178
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
Row,
|
|
4
|
+
Text,
|
|
5
|
+
} from 'native-base';
|
|
6
|
+
import {
|
|
7
|
+
HORIZONTAL,
|
|
8
|
+
VERTICAL,
|
|
9
|
+
} from '../../Constants/Directions.js';
|
|
10
|
+
import styles from '../../Styles/StyleSheets.js';
|
|
11
|
+
import withDraggable from '../Hoc/withDraggable.js';
|
|
12
|
+
|
|
13
|
+
// Note on modes:
|
|
14
|
+
// HORIZONTAL means the Splitter moves along the X axis.
|
|
15
|
+
// VERTICAL means the Splitter moves along the Y axis.
|
|
16
|
+
|
|
17
|
+
function Splitter(props) {
|
|
18
|
+
const {
|
|
19
|
+
mode = HORIZONTAL, // HORIZONTAL, VERTICAL
|
|
20
|
+
isDragging,
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
if (mode === VERTICAL) {
|
|
24
|
+
return <Row
|
|
25
|
+
testID="Splitter"
|
|
26
|
+
bg={isDragging ? 'secondary.600' : 'primary.600'}
|
|
27
|
+
h="3px"
|
|
28
|
+
w="100%"
|
|
29
|
+
alignItems="center"
|
|
30
|
+
justifyContent="center"
|
|
31
|
+
>
|
|
32
|
+
<Row testID="handle" h="2px" w="10%" bg="#ccc"></Row>
|
|
33
|
+
</Row>;
|
|
34
|
+
}
|
|
35
|
+
return <Column
|
|
36
|
+
testID="Splitter"
|
|
37
|
+
bg={isDragging ? 'secondary.600' : 'primary.600'}
|
|
38
|
+
h="100%"
|
|
39
|
+
w="3px"
|
|
40
|
+
alignItems="center"
|
|
41
|
+
justifyContent="center"
|
|
42
|
+
style={styles.ewResize}
|
|
43
|
+
>
|
|
44
|
+
<Column testID="handle" w="2px" h="10%" bg="#ccc"></Column>
|
|
45
|
+
</Column>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Need a hoc to specifically deliver the 'getParentNode' prop
|
|
49
|
+
function withParentNode(WrappedComponent) {
|
|
50
|
+
return (props) => {
|
|
51
|
+
const {
|
|
52
|
+
getParentNode = (node) => node.parentElement.parentElement,
|
|
53
|
+
} = props;
|
|
54
|
+
return <WrappedComponent
|
|
55
|
+
getParentNode={getParentNode}
|
|
56
|
+
{...props}
|
|
57
|
+
/>;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default withParentNode(withDraggable(Splitter));
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Row,
|
|
4
|
+
Text,
|
|
5
|
+
} from 'native-base';
|
|
6
|
+
import Date from '../Form/Field/Date.js';
|
|
7
|
+
import withTooltip from '../Hoc/withTooltip.js';
|
|
8
|
+
import withValue from '../Hoc/withValue.js';
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
|
|
11
|
+
const
|
|
12
|
+
DateRange = (props) => {
|
|
13
|
+
const {
|
|
14
|
+
value = {
|
|
15
|
+
low: null,
|
|
16
|
+
high: null,
|
|
17
|
+
},
|
|
18
|
+
setValue,
|
|
19
|
+
mode,
|
|
20
|
+
tooltip = '',
|
|
21
|
+
|
|
22
|
+
minValue = 0,
|
|
23
|
+
maxValue,
|
|
24
|
+
} = props,
|
|
25
|
+
[low, setLow] = useState(''),
|
|
26
|
+
[high, setHigh] = useState(''),
|
|
27
|
+
onChangeLow = (value) => {
|
|
28
|
+
setLow(value);
|
|
29
|
+
const newValue = {
|
|
30
|
+
low: value,
|
|
31
|
+
high,
|
|
32
|
+
};
|
|
33
|
+
setValue(newValue);
|
|
34
|
+
},
|
|
35
|
+
onChangeHigh = (value) => {
|
|
36
|
+
setHigh(value);
|
|
37
|
+
const newValue = {
|
|
38
|
+
low,
|
|
39
|
+
high: value,
|
|
40
|
+
};
|
|
41
|
+
setValue(newValue);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
|
|
46
|
+
// Initialize format of value - needs to be JSON object with combination of two values
|
|
47
|
+
if (value === null || typeof value === 'undefined') {
|
|
48
|
+
setValue({
|
|
49
|
+
low: null,
|
|
50
|
+
high: null,
|
|
51
|
+
});
|
|
52
|
+
return () => {};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Make local value conform to externally changed value
|
|
56
|
+
if (value.low !== low) {
|
|
57
|
+
setLow(value.low);
|
|
58
|
+
}
|
|
59
|
+
if (value.high !== high) {
|
|
60
|
+
setHigh(value.high);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}, [value]);
|
|
64
|
+
|
|
65
|
+
return <Row
|
|
66
|
+
justifyContent="center"
|
|
67
|
+
alignItems="center"
|
|
68
|
+
flex={1}
|
|
69
|
+
px={1}
|
|
70
|
+
>
|
|
71
|
+
<Date
|
|
72
|
+
value={low}
|
|
73
|
+
onChangeValue={onChangeLow}
|
|
74
|
+
mode={mode}
|
|
75
|
+
startingValue={null}
|
|
76
|
+
// minValue={minValue}
|
|
77
|
+
// maxValue={maxValue}
|
|
78
|
+
tooltip={(tooltip ? tooltip + ' ' : '') + 'Low'}
|
|
79
|
+
/>
|
|
80
|
+
<Text px={2} userSelect="none">to</Text>
|
|
81
|
+
<Date
|
|
82
|
+
value={high}
|
|
83
|
+
onChangeValue={onChangeHigh}
|
|
84
|
+
mode={mode}
|
|
85
|
+
startingValue={null}
|
|
86
|
+
// minValue={minValue}
|
|
87
|
+
// maxValue={maxValue}
|
|
88
|
+
tooltip={(tooltip ? tooltip + ' ' : '') + 'High'}
|
|
89
|
+
/>
|
|
90
|
+
</Row>;
|
|
91
|
+
},
|
|
92
|
+
DateRangeField = withValue(DateRange);
|
|
93
|
+
|
|
94
|
+
export default DateRangeField;
|
|
95
|
+
|
|
96
|
+
// Tooltip needs us to forwardRef
|
|
97
|
+
// export default withTooltip(React.forwardRef((props, ref) => {
|
|
98
|
+
// return <DateField {...props} outerRef={ref} />;
|
|
99
|
+
// }));
|