@terraware/web-components 4.2.12 → 4.2.14-rc.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/components/AntSwitch/index.js +8 -14
- package/components/Autocomplete/Autocomplete.js +67 -70
- package/components/Badge/index.js +16 -20
- package/components/BusySpinner/index.js +30 -35
- package/components/Button/Button.js +23 -27
- package/components/Button/button.test.js +8 -10
- package/components/Checkbox.js +10 -19
- package/components/Confirm/index.js +44 -51
- package/components/DatePicker/DatePicker.js +116 -117
- package/components/DialogBox/DialogBox.js +76 -66
- package/components/Divisor.js +15 -20
- package/components/Dropdown.js +54 -61
- package/components/EditableTable/index.js +129 -135
- package/components/ErrorBox/ErrorBox.js +37 -36
- package/components/FileChooser/index.js +73 -77
- package/components/FormBottomBar/index.js +63 -69
- package/components/Icon/Icon.js +14 -21
- package/components/Icon/icons/index.d.ts +1 -1
- package/components/Icon/icons/index.d.ts.map +1 -1
- package/components/Icon/icons/index.js +251 -255
- package/components/IconTooltip/index.js +29 -34
- package/components/Map/MapBox.js +199 -220
- package/components/Map/MapContainer.js +14 -18
- package/components/Map/MapDateSliderControl.js +44 -46
- package/components/Map/MapDrawer.js +32 -33
- package/components/Map/MapLegend.js +96 -95
- package/components/Map/MapViewStyleControl.js +38 -48
- package/components/Map/ReactMapboxWrapper.js +2 -9
- package/components/Map/index.js +47 -55
- package/components/Map/types.js +2 -8
- package/components/Map/useMaintainLayerOrder.js +4 -11
- package/components/Markdown/index.js +14 -21
- package/components/Message/Message.js +59 -51
- package/components/MultiSelect/MultiSelect.test.js +22 -24
- package/components/MultiSelect/index.js +73 -69
- package/components/Navbar/NavFooter.js +8 -13
- package/components/Navbar/NavItem.js +43 -37
- package/components/Navbar/NavSection.js +13 -17
- package/components/Navbar/Navbar.js +35 -38
- package/components/Navbar/SubNavbar.js +8 -13
- package/components/Note.js +14 -19
- package/components/OverlayModal/OverlayModal.js +36 -37
- package/components/PageForm/index.js +30 -35
- package/components/PhotoChooser/index.js +93 -98
- package/components/Pill/index.js +29 -31
- package/components/PillList/index.js +16 -22
- package/components/PlacementWrapper/index.js +20 -25
- package/components/PopoverMenu/Popover.js +33 -37
- package/components/PopoverMenu/index.js +41 -46
- package/components/PopoverMultiSelect/index.js +18 -21
- package/components/ProgressCircle/ProgressCircle.js +23 -26
- package/components/RadioButton.js +7 -14
- package/components/Select/Select.js +8 -13
- package/components/Select/SelectT.js +110 -108
- package/components/Separator/index.js +8 -14
- package/components/Size.js +1 -5
- package/components/Slider/index.js +7 -13
- package/components/SummaryBox.js +36 -39
- package/components/Tabs/index.js +75 -77
- package/components/TextTruncated/index.js +64 -65
- package/components/Textfield/Textfield.js +100 -95
- package/components/Textfield/TruncatedTextArea.js +44 -46
- package/components/TimelineSlider/TimelineMarker.js +24 -28
- package/components/TimelineSlider/TimelineRail.js +5 -11
- package/components/TimelineSlider/index.js +47 -51
- package/components/Tooltip/Tooltip.js +21 -26
- package/components/ViewPhotosDialog/index.js +58 -62
- package/components/VirtualWalkthrough/Annotation.d.ts +41 -0
- package/components/VirtualWalkthrough/Annotation.d.ts.map +1 -0
- package/components/VirtualWalkthrough/Annotation.js +197 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.d.ts +20 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.js +136 -0
- package/components/VirtualWalkthrough/AnnotationPanel.d.ts +13 -0
- package/components/VirtualWalkthrough/AnnotationPanel.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AnnotationPanel.js +196 -0
- package/components/VirtualWalkthrough/Application.d.ts +9 -0
- package/components/VirtualWalkthrough/Application.d.ts.map +1 -0
- package/components/VirtualWalkthrough/Application.js +32 -0
- package/components/VirtualWalkthrough/AutoRotator.d.ts +109 -0
- package/components/VirtualWalkthrough/AutoRotator.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AutoRotator.js +217 -0
- package/components/VirtualWalkthrough/BlockingSpinner.d.ts +3 -0
- package/components/VirtualWalkthrough/BlockingSpinner.d.ts.map +1 -0
- package/components/VirtualWalkthrough/BlockingSpinner.js +27 -0
- package/components/VirtualWalkthrough/BoundaryRing.d.ts +9 -0
- package/components/VirtualWalkthrough/BoundaryRing.d.ts.map +1 -0
- package/components/VirtualWalkthrough/BoundaryRing.js +33 -0
- package/components/VirtualWalkthrough/CameraInfo.d.ts +16 -0
- package/components/VirtualWalkthrough/CameraInfo.d.ts.map +1 -0
- package/components/VirtualWalkthrough/CameraInfo.js +88 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.d.ts +37 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.js +196 -0
- package/components/VirtualWalkthrough/GradientSky.d.ts +9 -0
- package/components/VirtualWalkthrough/GradientSky.d.ts.map +1 -0
- package/components/VirtualWalkthrough/GradientSky.js +73 -0
- package/components/VirtualWalkthrough/SplatControls.d.ts +50 -0
- package/components/VirtualWalkthrough/SplatControls.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatControls.js +252 -0
- package/components/VirtualWalkthrough/SplatCrop.d.ts +8 -0
- package/components/VirtualWalkthrough/SplatCrop.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatCrop.js +18 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.d.ts +8 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.js +18 -0
- package/components/VirtualWalkthrough/SplatModel.d.ts +15 -0
- package/components/VirtualWalkthrough/SplatModel.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatModel.js +60 -0
- package/components/VirtualWalkthrough/SplatRevealRain.d.ts +18 -0
- package/components/VirtualWalkthrough/SplatRevealRain.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatRevealRain.js +38 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.d.ts +110 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.d.ts.map +1 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.js +368 -0
- package/components/VirtualWalkthrough/TfXrNavigation.d.ts +15 -0
- package/components/VirtualWalkthrough/TfXrNavigation.d.ts.map +1 -0
- package/components/VirtualWalkthrough/TfXrNavigation.js +24 -0
- package/components/VirtualWalkthrough/annotation-styles.css +5 -0
- package/components/VirtualWalkthrough/application-styles.css +4 -0
- package/components/VirtualWalkthrough/boundary-ring.d.ts +47 -0
- package/components/VirtualWalkthrough/boundary-ring.d.ts.map +1 -0
- package/components/VirtualWalkthrough/boundary-ring.js +125 -0
- package/components/VirtualWalkthrough/boundary-ring.test.js +109 -0
- package/components/VirtualWalkthrough/groundPlane.d.ts +14 -0
- package/components/VirtualWalkthrough/groundPlane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/groundPlane.js +47 -0
- package/components/VirtualWalkthrough/groundPlane.test.js +45 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts +19 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts.map +1 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.js +119 -0
- package/components/VirtualWalkthrough/walkthrough-camera.d.ts +77 -0
- package/components/VirtualWalkthrough/walkthrough-camera.d.ts.map +1 -0
- package/components/VirtualWalkthrough/walkthrough-camera.js +320 -0
- package/components/svg/BlobbyGrayIconImage.js +36 -41
- package/components/svg/BlobbyGrayIconImport.js +36 -41
- package/components/svg/BlobbyGrayIconUploadToTheCloud.js +36 -41
- package/components/svg/BlobbyIconCloudChecked.js +161 -158
- package/components/svg/BlobbyIconExportOrUploadPhoto.js +161 -158
- package/components/svg/BlobbyIconFolder.js +161 -158
- package/components/svg/BlobbyIconGraphReport.js +161 -158
- package/components/svg/BlobbyIconHappy.js +161 -158
- package/components/svg/BlobbyIconHeartMonitor.js +161 -158
- package/components/svg/BlobbyIconLeaf.js +161 -158
- package/components/svg/BlobbyIconLibrary.js +161 -158
- package/components/svg/BlobbyIconNursery.js +163 -160
- package/components/svg/BlobbyIconOrganization.js +161 -158
- package/components/svg/BlobbyIconParchment.js +161 -158
- package/components/svg/BlobbyIconPeople.js +161 -158
- package/components/svg/BlobbyIconSeedBank.js +161 -158
- package/components/svg/BlobbyIconSeedling.js +161 -158
- package/components/svg/BlobbyIconSeeds.js +161 -158
- package/components/svg/BlobbyIconSite.js +164 -161
- package/components/svg/BlobbyIconSparkles.js +161 -158
- package/components/svg/BlobbyIconWrench.js +161 -158
- package/components/svg/Bug.js +18 -27
- package/components/svg/Calendar.js +18 -27
- package/components/svg/CaretDown.js +18 -27
- package/components/svg/CaretLeft.js +18 -27
- package/components/svg/CaretRight.js +18 -27
- package/components/svg/CaretUp.js +18 -27
- package/components/svg/ChevronDown.js +18 -27
- package/components/svg/ChevronUp.js +18 -27
- package/components/svg/Close.js +18 -27
- package/components/svg/Critical.js +18 -27
- package/components/svg/Edit.js +161 -158
- package/components/svg/Error.js +18 -27
- package/components/svg/Filter.js +18 -27
- package/components/svg/Folder.js +18 -27
- package/components/svg/Help.js +18 -27
- package/components/svg/Home.js +18 -27
- package/components/svg/IconAdd.js +18 -27
- package/components/svg/IconArrowRight.js +19 -28
- package/components/svg/IconBusinessNetwork.js +18 -27
- package/components/svg/IconCalendar.d.ts +1 -1
- package/components/svg/IconCalendar.d.ts.map +1 -1
- package/components/svg/IconCalendar.js +18 -27
- package/components/svg/IconCancel.js +18 -27
- package/components/svg/IconChargingBattery.js +18 -27
- package/components/svg/IconChecklist.js +19 -28
- package/components/svg/IconCheckmark.js +18 -27
- package/components/svg/IconCoinInHand.js +18 -27
- package/components/svg/IconColumns.js +18 -27
- package/components/svg/IconComment.js +18 -27
- package/components/svg/IconDashboard.js +18 -27
- package/components/svg/IconDataMigration.js +18 -27
- package/components/svg/IconDocument.d.ts +8 -0
- package/components/svg/IconDocument.d.ts.map +1 -0
- package/components/svg/IconDocument.js +21 -0
- package/components/svg/IconDownloadFromTheCloud.js +19 -28
- package/components/svg/IconEdit.js +19 -28
- package/components/svg/IconExpand.js +19 -28
- package/components/svg/IconExport.js +18 -27
- package/components/svg/IconExternalLink.js +18 -27
- package/components/svg/IconEye.js +18 -27
- package/components/svg/IconEyeOff.js +18 -27
- package/components/svg/IconFile.js +18 -27
- package/components/svg/IconFolder.js +18 -27
- package/components/svg/IconFullScreen.js +18 -27
- package/components/svg/IconFutures.js +18 -27
- package/components/svg/IconGraphReport.js +18 -27
- package/components/svg/IconHeartMonitor.js +18 -27
- package/components/svg/IconHelp.js +19 -28
- package/components/svg/IconHistory.js +18 -27
- package/components/svg/IconImport.js +18 -27
- package/components/svg/IconIndex.js +18 -27
- package/components/svg/IconLayers.js +18 -27
- package/components/svg/IconLibrary.js +18 -27
- package/components/svg/IconList.js +18 -27
- package/components/svg/IconLivePlant.js +18 -27
- package/components/svg/IconLocations.js +18 -27
- package/components/svg/IconMail.js +18 -27
- package/components/svg/IconManager.js +18 -27
- package/components/svg/IconMarker.js +18 -27
- package/components/svg/IconMenu.js +18 -27
- package/components/svg/IconMenuHorizontal.js +18 -27
- package/components/svg/IconModule.js +18 -27
- package/components/svg/IconMyLocation.js +18 -27
- package/components/svg/IconNote.js +19 -28
- package/components/svg/IconNursery.js +18 -27
- package/components/svg/IconOrg.js +18 -27
- package/components/svg/IconParchment.js +18 -27
- package/components/svg/IconPhoto.js +18 -27
- package/components/svg/IconPlantsFilled.js +18 -27
- package/components/svg/IconRedo.js +18 -27
- package/components/svg/IconRestorationSite.js +18 -27
- package/components/svg/IconSeedBank.js +18 -27
- package/components/svg/IconSeedling.js +18 -27
- package/components/svg/IconSettings.js +18 -27
- package/components/svg/IconSlice.js +18 -27
- package/components/svg/IconSubmit.js +18 -27
- package/components/svg/IconSubtract.js +19 -28
- package/components/svg/IconSynced.js +18 -27
- package/components/svg/IconTrashCan.js +18 -27
- package/components/svg/IconTreasureMap.js +18 -27
- package/components/svg/IconUnavailable.js +18 -27
- package/components/svg/IconUndo.js +18 -27
- package/components/svg/IconVariable.js +18 -27
- package/components/svg/IconVideo.js +19 -28
- package/components/svg/IconWifi.js +18 -27
- package/components/svg/Info.js +18 -27
- package/components/svg/Key.js +18 -27
- package/components/svg/Leaf.js +18 -27
- package/components/svg/Lock.js +18 -27
- package/components/svg/Logo.js +40 -45
- package/components/svg/MenuVertical.js +18 -27
- package/components/svg/Notification.js +18 -27
- package/components/svg/Person.js +18 -27
- package/components/svg/Plus.js +18 -27
- package/components/svg/RestorationSite.js +18 -27
- package/components/svg/Search.js +18 -27
- package/components/svg/Seeds.js +18 -27
- package/components/svg/Site.js +18 -27
- package/components/svg/Sparkles.js +18 -27
- package/components/svg/Species.js +18 -27
- package/components/svg/Species2.js +161 -158
- package/components/svg/Spinner.js +27 -36
- package/components/svg/Star.js +18 -27
- package/components/svg/Success.js +18 -27
- package/components/svg/SuccessFilled.js +18 -27
- package/components/svg/TerrawareLogoDesktop.js +44 -49
- package/components/svg/TerrawareLogoMobile.js +20 -29
- package/components/svg/Touchscreen.js +18 -27
- package/components/svg/UploadCloud.js +161 -158
- package/components/svg/Warning.js +18 -27
- package/components/svg/WelcomeClipboard.js +130 -135
- package/components/svg/index.d.ts +1 -0
- package/components/svg/index.d.ts.map +1 -1
- package/components/svg/index.js +127 -888
- package/components/table/EnhancedTableToolbar.js +45 -47
- package/components/table/EnhancedTableToolbarV2.js +18 -26
- package/components/table/TableCellRenderer.js +137 -143
- package/components/table/TableHeader.js +45 -47
- package/components/table/TableHeaderItem.js +65 -64
- package/components/table/density.js +3 -11
- package/components/table/index.js +225 -218
- package/components/table/sort.js +8 -18
- package/components/table/sort.test.js +6 -8
- package/components/table/types.js +1 -5
- package/components/types/index.js +1 -5
- package/hooks/useBoolean.d.ts +4 -0
- package/hooks/useBoolean.d.ts.map +1 -0
- package/hooks/useBoolean.js +12 -0
- package/hooks/useCameraPosition.d.ts +8 -0
- package/hooks/useCameraPosition.d.ts.map +1 -0
- package/hooks/useCameraPosition.js +33 -0
- package/index.js +57 -398
- package/license-report.html +1 -1
- package/package.json +10 -3
- package/style-dictionary-dist/TerrawareTheme.js +1 -7
- package/theme.js +7 -14
- package/utils/color.d.ts +2 -0
- package/utils/color.d.ts.map +1 -0
- package/utils/color.js +14 -0
- package/utils/date.js +13 -24
- package/utils/date.test.js +40 -43
- package/utils/index.js +5 -53
- package/utils/preventDefaultEvent.js +1 -7
- package/utils/text.js +2 -9
- package/utils/text.test.js +9 -11
- package/utils/useDeviceInfo.js +10 -16
- package/virtualWalkthrough.d.ts +31 -0
- package/virtualWalkthrough.d.ts.map +1 -0
- package/virtualWalkthrough.js +28 -0
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = Slider;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _material = require("@mui/material");
|
|
10
|
-
function Slider(props) {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Slider as MuiSlider, useTheme } from '@mui/material';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export default function Slider(props) {
|
|
11
5
|
const {
|
|
12
6
|
defaultValue,
|
|
13
7
|
value,
|
|
@@ -18,7 +12,7 @@ function Slider(props) {
|
|
|
18
12
|
step,
|
|
19
13
|
valueLabelDisplay
|
|
20
14
|
} = props;
|
|
21
|
-
const theme =
|
|
15
|
+
const theme = useTheme();
|
|
22
16
|
const sliderStyles = {
|
|
23
17
|
'.MuiSlider-rail': {
|
|
24
18
|
backgroundColor: theme.palette.TwClrBgBrandTertiary,
|
|
@@ -45,7 +39,7 @@ function Slider(props) {
|
|
|
45
39
|
onChange(val);
|
|
46
40
|
}
|
|
47
41
|
};
|
|
48
|
-
return /*#__PURE__*/
|
|
42
|
+
return /*#__PURE__*/_jsx(MuiSlider, {
|
|
49
43
|
"aria-label": "Slider",
|
|
50
44
|
defaultValue: defaultValue,
|
|
51
45
|
value: value,
|
|
@@ -53,7 +47,7 @@ function Slider(props) {
|
|
|
53
47
|
min: min,
|
|
54
48
|
max: max,
|
|
55
49
|
onChangeCommitted: handleChange,
|
|
56
|
-
step: step
|
|
50
|
+
step: step ?? null,
|
|
57
51
|
valueLabelDisplay: valueLabelDisplay,
|
|
58
52
|
sx: sliderStyles
|
|
59
53
|
});
|
package/components/SummaryBox.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
variant = 'default',
|
|
16
|
-
id,
|
|
17
|
-
icon,
|
|
18
|
-
onIconClick
|
|
19
|
-
} = _ref;
|
|
20
|
-
const theme = (0, _material.useTheme)();
|
|
21
|
-
const summaryBoxStyles = (0, _react.useMemo)(() => {
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { Info } from '@mui/icons-material';
|
|
3
|
+
import { Box, IconButton, Typography, useTheme } from '@mui/material';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export default function SummaryBox({
|
|
6
|
+
title,
|
|
7
|
+
value,
|
|
8
|
+
variant = 'default',
|
|
9
|
+
id,
|
|
10
|
+
icon,
|
|
11
|
+
onIconClick
|
|
12
|
+
}) {
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
const summaryBoxStyles = useMemo(() => {
|
|
22
15
|
switch (variant) {
|
|
23
16
|
case 'default':
|
|
24
17
|
return {
|
|
@@ -51,23 +44,27 @@ function SummaryBox(_ref) {
|
|
|
51
44
|
};
|
|
52
45
|
}
|
|
53
46
|
}, [theme, variant]);
|
|
54
|
-
return /*#__PURE__*/
|
|
47
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
55
48
|
id: id,
|
|
56
|
-
sx: summaryBoxStyles
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
49
|
+
sx: summaryBoxStyles,
|
|
50
|
+
children: [icon && /*#__PURE__*/_jsx(IconButton, {
|
|
51
|
+
onClick: onIconClick,
|
|
52
|
+
sx: {
|
|
53
|
+
position: 'absolute',
|
|
54
|
+
right: theme.spacing(2)
|
|
55
|
+
},
|
|
56
|
+
children: /*#__PURE__*/_jsx(Info, {})
|
|
57
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
58
|
+
component: "p",
|
|
59
|
+
children: title
|
|
60
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
61
|
+
component: "p",
|
|
62
|
+
variant: "h6",
|
|
63
|
+
sx: {
|
|
64
|
+
fontWeight: theme.typography.fontWeightBold,
|
|
65
|
+
whiteSpace: 'pre-line'
|
|
66
|
+
},
|
|
67
|
+
children: value
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
73
70
|
}
|
package/components/Tabs/index.js
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
activeTab,
|
|
19
|
-
children,
|
|
20
|
-
onChangeTab,
|
|
21
|
-
tabs,
|
|
22
|
-
tabStyle,
|
|
23
|
-
headerBorder = false,
|
|
24
|
-
sx
|
|
25
|
-
} = _ref;
|
|
26
|
-
const [selectedTab, setSelectedTab] = (0, _react.useState)((_ref2 = activeTab !== null && activeTab !== void 0 ? activeTab : (_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.id) !== null && _ref2 !== void 0 ? _ref2 : '');
|
|
27
|
-
const theme = (0, _material.useTheme)();
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { TabContext, TabList, TabPanel } from '@mui/lab';
|
|
3
|
+
import { Box, Tab as MuiTab, Tooltip, useTheme } from '@mui/material';
|
|
4
|
+
import { useDeviceInfo } from '../../utils';
|
|
5
|
+
import Icon from '../Icon/Icon';
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const Tabs = ({
|
|
8
|
+
activeTab,
|
|
9
|
+
children,
|
|
10
|
+
onChangeTab,
|
|
11
|
+
tabs,
|
|
12
|
+
tabStyle,
|
|
13
|
+
headerBorder = false,
|
|
14
|
+
sx
|
|
15
|
+
}) => {
|
|
16
|
+
const [selectedTab, setSelectedTab] = useState(activeTab ?? tabs[0]?.id ?? '');
|
|
17
|
+
const theme = useTheme();
|
|
28
18
|
const {
|
|
29
19
|
isMobile
|
|
30
|
-
} =
|
|
20
|
+
} = useDeviceInfo();
|
|
31
21
|
const tabStyles = [{
|
|
32
22
|
color: theme.palette.TwClrTxtSecondary,
|
|
33
23
|
fontSize: '16px',
|
|
@@ -71,67 +61,75 @@ const Tabs = _ref => {
|
|
|
71
61
|
setSelectedTab(tab);
|
|
72
62
|
}
|
|
73
63
|
};
|
|
74
|
-
|
|
64
|
+
useEffect(() => {
|
|
75
65
|
if (activeTab !== undefined) {
|
|
76
66
|
setSelectedTab(activeTab);
|
|
77
67
|
}
|
|
78
68
|
}, [activeTab]);
|
|
79
|
-
const renderedTabs =
|
|
80
|
-
const muiTab = /*#__PURE__*/
|
|
81
|
-
key: index,
|
|
69
|
+
const renderedTabs = useMemo(() => tabs.map((tab, index) => {
|
|
70
|
+
const muiTab = /*#__PURE__*/_jsx(MuiTab, {
|
|
82
71
|
disabled: tab.disabled,
|
|
83
|
-
icon: tab.icon ? /*#__PURE__*/
|
|
72
|
+
icon: tab.icon ? /*#__PURE__*/_jsx(Icon, {
|
|
84
73
|
name: tab.icon
|
|
85
74
|
}) : undefined,
|
|
86
|
-
label: /*#__PURE__*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
75
|
+
label: /*#__PURE__*/_jsxs(_Fragment, {
|
|
76
|
+
children: [tab.label, tab.tooltip && !tab.disabled && /*#__PURE__*/_jsx(Tooltip, {
|
|
77
|
+
title: tab.tooltip,
|
|
78
|
+
arrow: true,
|
|
79
|
+
placement: "top-start",
|
|
80
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
81
|
+
style: {
|
|
82
|
+
position: 'absolute',
|
|
83
|
+
inset: 0
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
})]
|
|
87
|
+
}),
|
|
96
88
|
sx: tabStyles,
|
|
97
89
|
value: tab.id
|
|
98
|
-
});
|
|
99
|
-
return tab.disabled ? /*#__PURE__*/
|
|
90
|
+
}, index);
|
|
91
|
+
return tab.disabled ? /*#__PURE__*/_jsx(Tooltip, {
|
|
100
92
|
title: tab.tooltip,
|
|
101
|
-
key: index,
|
|
102
93
|
arrow: true,
|
|
103
|
-
placement: "top-start"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
placement: "top-start",
|
|
95
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
96
|
+
style: {
|
|
97
|
+
display: 'inline-flex'
|
|
98
|
+
},
|
|
99
|
+
children: muiTab
|
|
100
|
+
})
|
|
101
|
+
}, index) : muiTab;
|
|
109
102
|
}), [tabs]);
|
|
110
|
-
return /*#__PURE__*/
|
|
111
|
-
sx: (0, _objectSpread2.default)({
|
|
112
|
-
width: '100%'
|
|
113
|
-
}, sx)
|
|
114
|
-
}, /*#__PURE__*/_react.default.createElement(_lab.TabContext, {
|
|
115
|
-
value: selectedTab
|
|
116
|
-
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
117
|
-
sx: tabHeaderProps,
|
|
118
|
-
className: "tab-header"
|
|
119
|
-
}, /*#__PURE__*/_react.default.createElement(_lab.TabList, {
|
|
120
|
-
onChange: (unused, value) => setTab(value),
|
|
103
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
121
104
|
sx: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
TabIndicatorProps: {
|
|
125
|
-
style: {
|
|
126
|
-
background: theme.palette.TwClrBgBrand,
|
|
127
|
-
height: '4px'
|
|
128
|
-
}
|
|
105
|
+
width: '100%',
|
|
106
|
+
...sx
|
|
129
107
|
},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
108
|
+
children: /*#__PURE__*/_jsxs(TabContext, {
|
|
109
|
+
value: selectedTab,
|
|
110
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
111
|
+
sx: tabHeaderProps,
|
|
112
|
+
className: "tab-header",
|
|
113
|
+
children: /*#__PURE__*/_jsx(TabList, {
|
|
114
|
+
onChange: (unused, value) => setTab(value),
|
|
115
|
+
sx: {
|
|
116
|
+
minHeight: theme.spacing(4.5)
|
|
117
|
+
},
|
|
118
|
+
TabIndicatorProps: {
|
|
119
|
+
style: {
|
|
120
|
+
background: theme.palette.TwClrBgBrand,
|
|
121
|
+
height: '4px'
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
variant: 'scrollable',
|
|
125
|
+
children: renderedTabs
|
|
126
|
+
})
|
|
127
|
+
}), children, tabs.map((tab, index) => /*#__PURE__*/_jsx(TabPanel, {
|
|
128
|
+
sx: tabPanelStyles,
|
|
129
|
+
value: tab.id,
|
|
130
|
+
children: tab.children
|
|
131
|
+
}, index))]
|
|
132
|
+
})
|
|
133
|
+
});
|
|
136
134
|
};
|
|
137
|
-
|
|
135
|
+
export default Tabs;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { Link, Tooltip, Typography, useTheme } from '@mui/material';
|
|
2
3
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = TextTruncated;
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _material = require("@mui/material");
|
|
12
4
|
/**
|
|
13
5
|
* Represents the result of truncating the string list
|
|
14
6
|
* text: the text to display before the '...# more' link
|
|
@@ -18,7 +10,7 @@ var _material = require("@mui/material");
|
|
|
18
10
|
* -1: the list is of length one but the element cannot be fully
|
|
19
11
|
* displayed. show '...more' without a '#'
|
|
20
12
|
*/
|
|
21
|
-
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
14
|
/**
|
|
23
15
|
* Compute TextDisplay for a list of strings
|
|
24
16
|
* @param strings list of strings to process
|
|
@@ -55,7 +47,7 @@ function computeFromStringList(strings, maxLength, listSeparator) {
|
|
|
55
47
|
numberMore: stringsRemaining
|
|
56
48
|
};
|
|
57
49
|
}
|
|
58
|
-
function TextTruncated(props) {
|
|
50
|
+
export default function TextTruncated(props) {
|
|
59
51
|
const {
|
|
60
52
|
stringList,
|
|
61
53
|
listSeparator,
|
|
@@ -66,22 +58,21 @@ function TextTruncated(props) {
|
|
|
66
58
|
showAllStyle,
|
|
67
59
|
placeHolder
|
|
68
60
|
} = props;
|
|
69
|
-
const [showAllOpen, setShowAllOpen] =
|
|
70
|
-
const [canvasContext, setCanvasContext] =
|
|
71
|
-
const theme =
|
|
72
|
-
|
|
73
|
-
var _canvas$getContext;
|
|
61
|
+
const [showAllOpen, setShowAllOpen] = useState(false);
|
|
62
|
+
const [canvasContext, setCanvasContext] = useState();
|
|
63
|
+
const theme = useTheme();
|
|
64
|
+
useEffect(() => {
|
|
74
65
|
const canvas = document.createElement('canvas');
|
|
75
|
-
setCanvasContext(
|
|
66
|
+
setCanvasContext(canvas?.getContext('2d') ?? undefined);
|
|
76
67
|
}, []);
|
|
77
|
-
const pixelsPerChar =
|
|
68
|
+
const pixelsPerChar = useMemo(() => {
|
|
78
69
|
// compute the pixels per character, averaged over the comma-separated joined stringList
|
|
79
70
|
const fullText = stringList.join(listSeparator);
|
|
80
71
|
let result = 0;
|
|
81
72
|
if (canvasContext) {
|
|
82
73
|
const fontSize = textStyle && textStyle.fontSize || theme.typography.fontSize;
|
|
83
74
|
const fontFamily = textStyle && textStyle.fontFamily || theme.typography.fontFamily;
|
|
84
|
-
canvasContext.font =
|
|
75
|
+
canvasContext.font = `${fontSize}px ${fontFamily}`;
|
|
85
76
|
result = canvasContext.measureText(fullText).width;
|
|
86
77
|
}
|
|
87
78
|
return result / fullText.length;
|
|
@@ -96,51 +87,59 @@ function TextTruncated(props) {
|
|
|
96
87
|
e.stopPropagation();
|
|
97
88
|
setShowAllOpen(!showAllOpen);
|
|
98
89
|
};
|
|
99
|
-
return stringList.length > 0 ? /*#__PURE__*/
|
|
100
|
-
sx: textStyle
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
90
|
+
return stringList.length > 0 ? /*#__PURE__*/_jsxs(Typography, {
|
|
91
|
+
sx: textStyle,
|
|
92
|
+
children: [textToDisplay.text, textToDisplay.numberMore !== 0 && moreText ? moreSeparator : '', textToDisplay.numberMore !== 0 ? /*#__PURE__*/_jsx(Tooltip, {
|
|
93
|
+
arrow: true,
|
|
94
|
+
open: moreText ? showAllOpen : undefined,
|
|
95
|
+
enterDelay: moreText ? 0 : 400,
|
|
96
|
+
title: /*#__PURE__*/_jsx(Typography, {
|
|
97
|
+
sx: showAllStyle,
|
|
98
|
+
fontSize: "14px",
|
|
99
|
+
children: stringList.join(listSeparator)
|
|
100
|
+
}),
|
|
101
|
+
sx: {
|
|
102
|
+
'& .MuiTooltip-arrow': {
|
|
103
|
+
color: `${theme.palette.TwClrBg} !important`,
|
|
104
|
+
'&:before': {
|
|
105
|
+
border: `1px solid ${theme.palette.TwClrBrdrTertiary}`
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
'& .MuiTooltip-popper': {
|
|
109
|
+
maxHeight: '200px',
|
|
110
|
+
overflow: 'auto'
|
|
111
|
+
},
|
|
112
|
+
'& .MuiTooltip-tooltip': {
|
|
113
|
+
backgroundColor: `${theme.palette.TwClrBg} !important`,
|
|
114
|
+
color: `${theme.palette.TwClrTxt} !important`,
|
|
115
|
+
border: `1px solid ${theme.palette.TwClrBrdrTertiary} !important`,
|
|
116
|
+
borderRadius: '8px !important',
|
|
117
|
+
boxShadow: `0px 3px 3px ${theme.palette.TwClrBaseGray100}`,
|
|
118
|
+
padding: '8px'
|
|
114
119
|
}
|
|
115
120
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
})
|
|
141
|
-
}, (textToDisplay.numberMore > 0 ? textToDisplay.numberMore + ' ' : '') + moreText)) : /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
142
|
-
sx: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, textStyle), {}, {
|
|
143
|
-
display: 'inline'
|
|
144
|
-
})
|
|
145
|
-
}, moreSeparator)) : null) : placeHolder || null;
|
|
121
|
+
children: moreText ? /*#__PURE__*/_jsx(Link, {
|
|
122
|
+
component: "button",
|
|
123
|
+
onClick: onClickHandler,
|
|
124
|
+
onBlur: () => setShowAllOpen(false),
|
|
125
|
+
sx: {
|
|
126
|
+
color: theme.palette.TwClrTxtBrand,
|
|
127
|
+
textDecorationColor: `${theme.palette.TwClrTxtBrand}80`
|
|
128
|
+
},
|
|
129
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
130
|
+
sx: {
|
|
131
|
+
...textStyle,
|
|
132
|
+
marginTop: '-3px'
|
|
133
|
+
},
|
|
134
|
+
children: (textToDisplay.numberMore > 0 ? textToDisplay.numberMore + ' ' : '') + moreText
|
|
135
|
+
})
|
|
136
|
+
}) : /*#__PURE__*/_jsx(Typography, {
|
|
137
|
+
sx: {
|
|
138
|
+
...textStyle,
|
|
139
|
+
display: 'inline'
|
|
140
|
+
},
|
|
141
|
+
children: moreSeparator
|
|
142
|
+
})
|
|
143
|
+
}) : null]
|
|
144
|
+
}) : placeHolder || null;
|
|
146
145
|
}
|