@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.
Files changed (304) hide show
  1. package/components/AntSwitch/index.js +8 -14
  2. package/components/Autocomplete/Autocomplete.js +67 -70
  3. package/components/Badge/index.js +16 -20
  4. package/components/BusySpinner/index.js +30 -35
  5. package/components/Button/Button.js +23 -27
  6. package/components/Button/button.test.js +8 -10
  7. package/components/Checkbox.js +10 -19
  8. package/components/Confirm/index.js +44 -51
  9. package/components/DatePicker/DatePicker.js +116 -117
  10. package/components/DialogBox/DialogBox.js +76 -66
  11. package/components/Divisor.js +15 -20
  12. package/components/Dropdown.js +54 -61
  13. package/components/EditableTable/index.js +129 -135
  14. package/components/ErrorBox/ErrorBox.js +37 -36
  15. package/components/FileChooser/index.js +73 -77
  16. package/components/FormBottomBar/index.js +63 -69
  17. package/components/Icon/Icon.js +14 -21
  18. package/components/Icon/icons/index.d.ts +1 -1
  19. package/components/Icon/icons/index.d.ts.map +1 -1
  20. package/components/Icon/icons/index.js +251 -255
  21. package/components/IconTooltip/index.js +29 -34
  22. package/components/Map/MapBox.js +199 -220
  23. package/components/Map/MapContainer.js +14 -18
  24. package/components/Map/MapDateSliderControl.js +44 -46
  25. package/components/Map/MapDrawer.js +32 -33
  26. package/components/Map/MapLegend.js +96 -95
  27. package/components/Map/MapViewStyleControl.js +38 -48
  28. package/components/Map/ReactMapboxWrapper.js +2 -9
  29. package/components/Map/index.js +47 -55
  30. package/components/Map/types.js +2 -8
  31. package/components/Map/useMaintainLayerOrder.js +4 -11
  32. package/components/Markdown/index.js +14 -21
  33. package/components/Message/Message.js +59 -51
  34. package/components/MultiSelect/MultiSelect.test.js +22 -24
  35. package/components/MultiSelect/index.js +73 -69
  36. package/components/Navbar/NavFooter.js +8 -13
  37. package/components/Navbar/NavItem.js +43 -37
  38. package/components/Navbar/NavSection.js +13 -17
  39. package/components/Navbar/Navbar.js +35 -38
  40. package/components/Navbar/SubNavbar.js +8 -13
  41. package/components/Note.js +14 -19
  42. package/components/OverlayModal/OverlayModal.js +36 -37
  43. package/components/PageForm/index.js +30 -35
  44. package/components/PhotoChooser/index.js +93 -98
  45. package/components/Pill/index.js +29 -31
  46. package/components/PillList/index.js +16 -22
  47. package/components/PlacementWrapper/index.js +20 -25
  48. package/components/PopoverMenu/Popover.js +33 -37
  49. package/components/PopoverMenu/index.js +41 -46
  50. package/components/PopoverMultiSelect/index.js +18 -21
  51. package/components/ProgressCircle/ProgressCircle.js +23 -26
  52. package/components/RadioButton.js +7 -14
  53. package/components/Select/Select.js +8 -13
  54. package/components/Select/SelectT.js +110 -108
  55. package/components/Separator/index.js +8 -14
  56. package/components/Size.js +1 -5
  57. package/components/Slider/index.js +7 -13
  58. package/components/SummaryBox.js +36 -39
  59. package/components/Tabs/index.js +75 -77
  60. package/components/TextTruncated/index.js +64 -65
  61. package/components/Textfield/Textfield.js +100 -95
  62. package/components/Textfield/TruncatedTextArea.js +44 -46
  63. package/components/TimelineSlider/TimelineMarker.js +24 -28
  64. package/components/TimelineSlider/TimelineRail.js +5 -11
  65. package/components/TimelineSlider/index.js +47 -51
  66. package/components/Tooltip/Tooltip.js +21 -26
  67. package/components/ViewPhotosDialog/index.js +58 -62
  68. package/components/VirtualWalkthrough/Annotation.d.ts +41 -0
  69. package/components/VirtualWalkthrough/Annotation.d.ts.map +1 -0
  70. package/components/VirtualWalkthrough/Annotation.js +197 -0
  71. package/components/VirtualWalkthrough/AnnotationEditPane.d.ts +20 -0
  72. package/components/VirtualWalkthrough/AnnotationEditPane.d.ts.map +1 -0
  73. package/components/VirtualWalkthrough/AnnotationEditPane.js +136 -0
  74. package/components/VirtualWalkthrough/AnnotationPanel.d.ts +13 -0
  75. package/components/VirtualWalkthrough/AnnotationPanel.d.ts.map +1 -0
  76. package/components/VirtualWalkthrough/AnnotationPanel.js +196 -0
  77. package/components/VirtualWalkthrough/Application.d.ts +9 -0
  78. package/components/VirtualWalkthrough/Application.d.ts.map +1 -0
  79. package/components/VirtualWalkthrough/Application.js +32 -0
  80. package/components/VirtualWalkthrough/AutoRotator.d.ts +109 -0
  81. package/components/VirtualWalkthrough/AutoRotator.d.ts.map +1 -0
  82. package/components/VirtualWalkthrough/AutoRotator.js +217 -0
  83. package/components/VirtualWalkthrough/BlockingSpinner.d.ts +3 -0
  84. package/components/VirtualWalkthrough/BlockingSpinner.d.ts.map +1 -0
  85. package/components/VirtualWalkthrough/BlockingSpinner.js +27 -0
  86. package/components/VirtualWalkthrough/BoundaryRing.d.ts +9 -0
  87. package/components/VirtualWalkthrough/BoundaryRing.d.ts.map +1 -0
  88. package/components/VirtualWalkthrough/BoundaryRing.js +33 -0
  89. package/components/VirtualWalkthrough/CameraInfo.d.ts +16 -0
  90. package/components/VirtualWalkthrough/CameraInfo.d.ts.map +1 -0
  91. package/components/VirtualWalkthrough/CameraInfo.js +88 -0
  92. package/components/VirtualWalkthrough/ControlsInfoPane.d.ts +37 -0
  93. package/components/VirtualWalkthrough/ControlsInfoPane.d.ts.map +1 -0
  94. package/components/VirtualWalkthrough/ControlsInfoPane.js +196 -0
  95. package/components/VirtualWalkthrough/GradientSky.d.ts +9 -0
  96. package/components/VirtualWalkthrough/GradientSky.d.ts.map +1 -0
  97. package/components/VirtualWalkthrough/GradientSky.js +73 -0
  98. package/components/VirtualWalkthrough/SplatControls.d.ts +50 -0
  99. package/components/VirtualWalkthrough/SplatControls.d.ts.map +1 -0
  100. package/components/VirtualWalkthrough/SplatControls.js +252 -0
  101. package/components/VirtualWalkthrough/SplatCrop.d.ts +8 -0
  102. package/components/VirtualWalkthrough/SplatCrop.d.ts.map +1 -0
  103. package/components/VirtualWalkthrough/SplatCrop.js +18 -0
  104. package/components/VirtualWalkthrough/SplatFadeCrop.d.ts +8 -0
  105. package/components/VirtualWalkthrough/SplatFadeCrop.d.ts.map +1 -0
  106. package/components/VirtualWalkthrough/SplatFadeCrop.js +18 -0
  107. package/components/VirtualWalkthrough/SplatModel.d.ts +15 -0
  108. package/components/VirtualWalkthrough/SplatModel.d.ts.map +1 -0
  109. package/components/VirtualWalkthrough/SplatModel.js +60 -0
  110. package/components/VirtualWalkthrough/SplatRevealRain.d.ts +18 -0
  111. package/components/VirtualWalkthrough/SplatRevealRain.d.ts.map +1 -0
  112. package/components/VirtualWalkthrough/SplatRevealRain.js +38 -0
  113. package/components/VirtualWalkthrough/TfAnnotationManager.d.ts +110 -0
  114. package/components/VirtualWalkthrough/TfAnnotationManager.d.ts.map +1 -0
  115. package/components/VirtualWalkthrough/TfAnnotationManager.js +368 -0
  116. package/components/VirtualWalkthrough/TfXrNavigation.d.ts +15 -0
  117. package/components/VirtualWalkthrough/TfXrNavigation.d.ts.map +1 -0
  118. package/components/VirtualWalkthrough/TfXrNavigation.js +24 -0
  119. package/components/VirtualWalkthrough/annotation-styles.css +5 -0
  120. package/components/VirtualWalkthrough/application-styles.css +4 -0
  121. package/components/VirtualWalkthrough/boundary-ring.d.ts +47 -0
  122. package/components/VirtualWalkthrough/boundary-ring.d.ts.map +1 -0
  123. package/components/VirtualWalkthrough/boundary-ring.js +125 -0
  124. package/components/VirtualWalkthrough/boundary-ring.test.js +109 -0
  125. package/components/VirtualWalkthrough/groundPlane.d.ts +14 -0
  126. package/components/VirtualWalkthrough/groundPlane.d.ts.map +1 -0
  127. package/components/VirtualWalkthrough/groundPlane.js +47 -0
  128. package/components/VirtualWalkthrough/groundPlane.test.js +45 -0
  129. package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts +19 -0
  130. package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts.map +1 -0
  131. package/components/VirtualWalkthrough/gsplat-fade-crop-effect.js +119 -0
  132. package/components/VirtualWalkthrough/walkthrough-camera.d.ts +77 -0
  133. package/components/VirtualWalkthrough/walkthrough-camera.d.ts.map +1 -0
  134. package/components/VirtualWalkthrough/walkthrough-camera.js +320 -0
  135. package/components/svg/BlobbyGrayIconImage.js +36 -41
  136. package/components/svg/BlobbyGrayIconImport.js +36 -41
  137. package/components/svg/BlobbyGrayIconUploadToTheCloud.js +36 -41
  138. package/components/svg/BlobbyIconCloudChecked.js +161 -158
  139. package/components/svg/BlobbyIconExportOrUploadPhoto.js +161 -158
  140. package/components/svg/BlobbyIconFolder.js +161 -158
  141. package/components/svg/BlobbyIconGraphReport.js +161 -158
  142. package/components/svg/BlobbyIconHappy.js +161 -158
  143. package/components/svg/BlobbyIconHeartMonitor.js +161 -158
  144. package/components/svg/BlobbyIconLeaf.js +161 -158
  145. package/components/svg/BlobbyIconLibrary.js +161 -158
  146. package/components/svg/BlobbyIconNursery.js +163 -160
  147. package/components/svg/BlobbyIconOrganization.js +161 -158
  148. package/components/svg/BlobbyIconParchment.js +161 -158
  149. package/components/svg/BlobbyIconPeople.js +161 -158
  150. package/components/svg/BlobbyIconSeedBank.js +161 -158
  151. package/components/svg/BlobbyIconSeedling.js +161 -158
  152. package/components/svg/BlobbyIconSeeds.js +161 -158
  153. package/components/svg/BlobbyIconSite.js +164 -161
  154. package/components/svg/BlobbyIconSparkles.js +161 -158
  155. package/components/svg/BlobbyIconWrench.js +161 -158
  156. package/components/svg/Bug.js +18 -27
  157. package/components/svg/Calendar.js +18 -27
  158. package/components/svg/CaretDown.js +18 -27
  159. package/components/svg/CaretLeft.js +18 -27
  160. package/components/svg/CaretRight.js +18 -27
  161. package/components/svg/CaretUp.js +18 -27
  162. package/components/svg/ChevronDown.js +18 -27
  163. package/components/svg/ChevronUp.js +18 -27
  164. package/components/svg/Close.js +18 -27
  165. package/components/svg/Critical.js +18 -27
  166. package/components/svg/Edit.js +161 -158
  167. package/components/svg/Error.js +18 -27
  168. package/components/svg/Filter.js +18 -27
  169. package/components/svg/Folder.js +18 -27
  170. package/components/svg/Help.js +18 -27
  171. package/components/svg/Home.js +18 -27
  172. package/components/svg/IconAdd.js +18 -27
  173. package/components/svg/IconArrowRight.js +19 -28
  174. package/components/svg/IconBusinessNetwork.js +18 -27
  175. package/components/svg/IconCalendar.d.ts +1 -1
  176. package/components/svg/IconCalendar.d.ts.map +1 -1
  177. package/components/svg/IconCalendar.js +18 -27
  178. package/components/svg/IconCancel.js +18 -27
  179. package/components/svg/IconChargingBattery.js +18 -27
  180. package/components/svg/IconChecklist.js +19 -28
  181. package/components/svg/IconCheckmark.js +18 -27
  182. package/components/svg/IconCoinInHand.js +18 -27
  183. package/components/svg/IconColumns.js +18 -27
  184. package/components/svg/IconComment.js +18 -27
  185. package/components/svg/IconDashboard.js +18 -27
  186. package/components/svg/IconDataMigration.js +18 -27
  187. package/components/svg/IconDocument.d.ts +8 -0
  188. package/components/svg/IconDocument.d.ts.map +1 -0
  189. package/components/svg/IconDocument.js +21 -0
  190. package/components/svg/IconDownloadFromTheCloud.js +19 -28
  191. package/components/svg/IconEdit.js +19 -28
  192. package/components/svg/IconExpand.js +19 -28
  193. package/components/svg/IconExport.js +18 -27
  194. package/components/svg/IconExternalLink.js +18 -27
  195. package/components/svg/IconEye.js +18 -27
  196. package/components/svg/IconEyeOff.js +18 -27
  197. package/components/svg/IconFile.js +18 -27
  198. package/components/svg/IconFolder.js +18 -27
  199. package/components/svg/IconFullScreen.js +18 -27
  200. package/components/svg/IconFutures.js +18 -27
  201. package/components/svg/IconGraphReport.js +18 -27
  202. package/components/svg/IconHeartMonitor.js +18 -27
  203. package/components/svg/IconHelp.js +19 -28
  204. package/components/svg/IconHistory.js +18 -27
  205. package/components/svg/IconImport.js +18 -27
  206. package/components/svg/IconIndex.js +18 -27
  207. package/components/svg/IconLayers.js +18 -27
  208. package/components/svg/IconLibrary.js +18 -27
  209. package/components/svg/IconList.js +18 -27
  210. package/components/svg/IconLivePlant.js +18 -27
  211. package/components/svg/IconLocations.js +18 -27
  212. package/components/svg/IconMail.js +18 -27
  213. package/components/svg/IconManager.js +18 -27
  214. package/components/svg/IconMarker.js +18 -27
  215. package/components/svg/IconMenu.js +18 -27
  216. package/components/svg/IconMenuHorizontal.js +18 -27
  217. package/components/svg/IconModule.js +18 -27
  218. package/components/svg/IconMyLocation.js +18 -27
  219. package/components/svg/IconNote.js +19 -28
  220. package/components/svg/IconNursery.js +18 -27
  221. package/components/svg/IconOrg.js +18 -27
  222. package/components/svg/IconParchment.js +18 -27
  223. package/components/svg/IconPhoto.js +18 -27
  224. package/components/svg/IconPlantsFilled.js +18 -27
  225. package/components/svg/IconRedo.js +18 -27
  226. package/components/svg/IconRestorationSite.js +18 -27
  227. package/components/svg/IconSeedBank.js +18 -27
  228. package/components/svg/IconSeedling.js +18 -27
  229. package/components/svg/IconSettings.js +18 -27
  230. package/components/svg/IconSlice.js +18 -27
  231. package/components/svg/IconSubmit.js +18 -27
  232. package/components/svg/IconSubtract.js +19 -28
  233. package/components/svg/IconSynced.js +18 -27
  234. package/components/svg/IconTrashCan.js +18 -27
  235. package/components/svg/IconTreasureMap.js +18 -27
  236. package/components/svg/IconUnavailable.js +18 -27
  237. package/components/svg/IconUndo.js +18 -27
  238. package/components/svg/IconVariable.js +18 -27
  239. package/components/svg/IconVideo.js +19 -28
  240. package/components/svg/IconWifi.js +18 -27
  241. package/components/svg/Info.js +18 -27
  242. package/components/svg/Key.js +18 -27
  243. package/components/svg/Leaf.js +18 -27
  244. package/components/svg/Lock.js +18 -27
  245. package/components/svg/Logo.js +40 -45
  246. package/components/svg/MenuVertical.js +18 -27
  247. package/components/svg/Notification.js +18 -27
  248. package/components/svg/Person.js +18 -27
  249. package/components/svg/Plus.js +18 -27
  250. package/components/svg/RestorationSite.js +18 -27
  251. package/components/svg/Search.js +18 -27
  252. package/components/svg/Seeds.js +18 -27
  253. package/components/svg/Site.js +18 -27
  254. package/components/svg/Sparkles.js +18 -27
  255. package/components/svg/Species.js +18 -27
  256. package/components/svg/Species2.js +161 -158
  257. package/components/svg/Spinner.js +27 -36
  258. package/components/svg/Star.js +18 -27
  259. package/components/svg/Success.js +18 -27
  260. package/components/svg/SuccessFilled.js +18 -27
  261. package/components/svg/TerrawareLogoDesktop.js +44 -49
  262. package/components/svg/TerrawareLogoMobile.js +20 -29
  263. package/components/svg/Touchscreen.js +18 -27
  264. package/components/svg/UploadCloud.js +161 -158
  265. package/components/svg/Warning.js +18 -27
  266. package/components/svg/WelcomeClipboard.js +130 -135
  267. package/components/svg/index.d.ts +1 -0
  268. package/components/svg/index.d.ts.map +1 -1
  269. package/components/svg/index.js +127 -888
  270. package/components/table/EnhancedTableToolbar.js +45 -47
  271. package/components/table/EnhancedTableToolbarV2.js +18 -26
  272. package/components/table/TableCellRenderer.js +137 -143
  273. package/components/table/TableHeader.js +45 -47
  274. package/components/table/TableHeaderItem.js +65 -64
  275. package/components/table/density.js +3 -11
  276. package/components/table/index.js +225 -218
  277. package/components/table/sort.js +8 -18
  278. package/components/table/sort.test.js +6 -8
  279. package/components/table/types.js +1 -5
  280. package/components/types/index.js +1 -5
  281. package/hooks/useBoolean.d.ts +4 -0
  282. package/hooks/useBoolean.d.ts.map +1 -0
  283. package/hooks/useBoolean.js +12 -0
  284. package/hooks/useCameraPosition.d.ts +8 -0
  285. package/hooks/useCameraPosition.d.ts.map +1 -0
  286. package/hooks/useCameraPosition.js +33 -0
  287. package/index.js +57 -398
  288. package/license-report.html +1 -1
  289. package/package.json +10 -3
  290. package/style-dictionary-dist/TerrawareTheme.js +1 -7
  291. package/theme.js +7 -14
  292. package/utils/color.d.ts +2 -0
  293. package/utils/color.d.ts.map +1 -0
  294. package/utils/color.js +14 -0
  295. package/utils/date.js +13 -24
  296. package/utils/date.test.js +40 -43
  297. package/utils/index.js +5 -53
  298. package/utils/preventDefaultEvent.js +1 -7
  299. package/utils/text.js +2 -9
  300. package/utils/text.test.js +9 -11
  301. package/utils/useDeviceInfo.js +10 -16
  302. package/virtualWalkthrough.d.ts +31 -0
  303. package/virtualWalkthrough.d.ts.map +1 -0
  304. package/virtualWalkthrough.js +28 -0
@@ -1,13 +1,7 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
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 = (0, _material.useTheme)();
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__*/_react.default.createElement(_material.Slider, {
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 !== null && step !== void 0 ? step : null,
50
+ step: step ?? null,
57
51
  valueLabelDisplay: valueLabelDisplay,
58
52
  sx: sliderStyles
59
53
  });
@@ -1,24 +1,17 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = SummaryBox;
8
- var _react = _interopRequireWildcard(require("react"));
9
- var _iconsMaterial = require("@mui/icons-material");
10
- var _material = require("@mui/material");
11
- function SummaryBox(_ref) {
12
- let {
13
- title,
14
- value,
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__*/_react.default.createElement(_material.Box, {
47
+ return /*#__PURE__*/_jsxs(Box, {
55
48
  id: id,
56
- sx: summaryBoxStyles
57
- }, icon && /*#__PURE__*/_react.default.createElement(_material.IconButton, {
58
- onClick: onIconClick,
59
- sx: {
60
- position: 'absolute',
61
- right: theme.spacing(2)
62
- }
63
- }, /*#__PURE__*/_react.default.createElement(_iconsMaterial.Info, null)), /*#__PURE__*/_react.default.createElement(_material.Typography, {
64
- component: "p"
65
- }, title), /*#__PURE__*/_react.default.createElement(_material.Typography, {
66
- component: "p",
67
- variant: "h6",
68
- sx: {
69
- fontWeight: theme.typography.fontWeightBold,
70
- whiteSpace: 'pre-line'
71
- }
72
- }, value));
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
  }
@@ -1,33 +1,23 @@
1
- "use strict";
2
-
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 = void 0;
9
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _lab = require("@mui/lab");
12
- var _material = require("@mui/material");
13
- var _utils = require("../../utils");
14
- var _Icon = _interopRequireDefault(require("../Icon/Icon"));
15
- const Tabs = _ref => {
16
- var _ref2, _tabs$;
17
- let {
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
- } = (0, _utils.useDeviceInfo)();
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
- (0, _react.useEffect)(() => {
64
+ useEffect(() => {
75
65
  if (activeTab !== undefined) {
76
66
  setSelectedTab(activeTab);
77
67
  }
78
68
  }, [activeTab]);
79
- const renderedTabs = (0, _react.useMemo)(() => tabs.map((tab, index) => {
80
- const muiTab = /*#__PURE__*/_react.default.createElement(_material.Tab, {
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__*/_react.default.createElement(_Icon.default, {
72
+ icon: tab.icon ? /*#__PURE__*/_jsx(Icon, {
84
73
  name: tab.icon
85
74
  }) : undefined,
86
- label: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tab.label, tab.tooltip && !tab.disabled && /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
87
- title: tab.tooltip,
88
- arrow: true,
89
- placement: "top-start"
90
- }, /*#__PURE__*/_react.default.createElement("span", {
91
- style: {
92
- position: 'absolute',
93
- inset: 0
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__*/_react.default.createElement(_material.Tooltip, {
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
- }, /*#__PURE__*/_react.default.createElement("span", {
105
- style: {
106
- display: 'inline-flex'
107
- }
108
- }, muiTab)) : muiTab;
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__*/_react.default.createElement(_material.Box, {
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
- minHeight: theme.spacing(4.5)
123
- },
124
- TabIndicatorProps: {
125
- style: {
126
- background: theme.palette.TwClrBgBrand,
127
- height: '4px'
128
- }
105
+ width: '100%',
106
+ ...sx
129
107
  },
130
- variant: 'scrollable'
131
- }, renderedTabs)), children, tabs.map((tab, index) => /*#__PURE__*/_react.default.createElement(_lab.TabPanel, {
132
- key: index,
133
- sx: tabPanelStyles,
134
- value: tab.id
135
- }, tab.children))));
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
- var _default = exports.default = Tabs;
135
+ export default Tabs;
@@ -1,14 +1,6 @@
1
- "use strict";
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] = (0, _react.useState)(false);
70
- const [canvasContext, setCanvasContext] = (0, _react.useState)();
71
- const theme = (0, _material.useTheme)();
72
- (0, _react.useEffect)(() => {
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((_canvas$getContext = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d')) !== null && _canvas$getContext !== void 0 ? _canvas$getContext : undefined);
66
+ setCanvasContext(canvas?.getContext('2d') ?? undefined);
76
67
  }, []);
77
- const pixelsPerChar = (0, _react.useMemo)(() => {
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 = "".concat(fontSize, "px ").concat(fontFamily);
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__*/_react.default.createElement(_material.Typography, {
100
- sx: textStyle
101
- }, textToDisplay.text, textToDisplay.numberMore !== 0 && moreText ? moreSeparator : '', textToDisplay.numberMore !== 0 ? /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
102
- arrow: true,
103
- open: moreText ? showAllOpen : undefined,
104
- enterDelay: moreText ? 0 : 400,
105
- title: /*#__PURE__*/_react.default.createElement(_material.Typography, {
106
- sx: showAllStyle,
107
- fontSize: "14px"
108
- }, stringList.join(listSeparator)),
109
- sx: {
110
- '& .MuiTooltip-arrow': {
111
- color: "".concat(theme.palette.TwClrBg, " !important"),
112
- '&:before': {
113
- border: "1px solid ".concat(theme.palette.TwClrBrdrTertiary)
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
- '& .MuiTooltip-popper': {
117
- maxHeight: '200px',
118
- overflow: 'auto'
119
- },
120
- '& .MuiTooltip-tooltip': {
121
- backgroundColor: "".concat(theme.palette.TwClrBg, " !important"),
122
- color: "".concat(theme.palette.TwClrTxt, " !important"),
123
- border: "1px solid ".concat(theme.palette.TwClrBrdrTertiary, " !important"),
124
- borderRadius: '8px !important',
125
- boxShadow: "0px 3px 3px ".concat(theme.palette.TwClrBaseGray100),
126
- padding: '8px'
127
- }
128
- }
129
- }, moreText ? /*#__PURE__*/_react.default.createElement(_material.Link, {
130
- component: "button",
131
- onClick: onClickHandler,
132
- onBlur: () => setShowAllOpen(false),
133
- sx: {
134
- color: theme.palette.TwClrTxtBrand,
135
- textDecorationColor: "".concat(theme.palette.TwClrTxtBrand, "80")
136
- }
137
- }, /*#__PURE__*/_react.default.createElement(_material.Typography, {
138
- sx: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, textStyle), {}, {
139
- marginTop: '-3px'
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
  }