@terraware/web-components 4.2.26-rc.0 → 4.3.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/_vendor/react-multi-carousel/index.js +13 -0
- package/_vendor/react-multi-carousel/lib/Arrows.js +13 -0
- package/_vendor/react-multi-carousel/lib/Carousel.js +19 -0
- package/_vendor/react-multi-carousel/lib/CarouselItems.js +14 -0
- package/_vendor/react-multi-carousel/lib/Dots.js +16 -0
- package/_vendor/react-multi-carousel/lib/index.js +13 -0
- package/_vendor/react-multi-carousel/lib/types.js +13 -0
- package/_vendor/react-multi-carousel/lib/utils/clones.js +14 -0
- package/_vendor/react-multi-carousel/lib/utils/common.js +13 -0
- package/_vendor/react-multi-carousel/lib/utils/dots.js +14 -0
- package/_vendor/react-multi-carousel/lib/utils/elementWidth.js +12 -0
- package/_vendor/react-multi-carousel/lib/utils/index.js +20 -0
- package/_vendor/react-multi-carousel/lib/utils/mouseOrTouchMove.js +14 -0
- package/_vendor/react-multi-carousel/lib/utils/next.js +13 -0
- package/_vendor/react-multi-carousel/lib/utils/previous.js +14 -0
- package/_vendor/react-multi-carousel/lib/utils/throttle.js +12 -0
- package/_vendor/react-multi-carousel/lib/utils/throwError.js +14 -0
- package/_virtual/Arrows.js +3 -0
- package/_virtual/Carousel.js +3 -0
- package/_virtual/CarouselItems.js +3 -0
- package/_virtual/Dots.js +3 -0
- package/_virtual/_commonjsHelpers.js +5 -0
- package/_virtual/clones.js +3 -0
- package/_virtual/common.js +3 -0
- package/_virtual/dots2.js +3 -0
- package/_virtual/elementWidth.js +3 -0
- package/_virtual/index.js +7 -0
- package/_virtual/index2.js +3 -0
- package/_virtual/index3.js +3 -0
- package/_virtual/mouseOrTouchMove.js +3 -0
- package/_virtual/next.js +3 -0
- package/_virtual/previous.js +3 -0
- package/_virtual/throttle.js +3 -0
- package/_virtual/throwError.js +3 -0
- package/_virtual/types.js +3 -0
- package/components/AntSwitch/index.js +6 -4
- package/components/Autocomplete/Autocomplete.js +19 -16
- package/components/Badge/index.js +8 -6
- package/components/BusySpinner/index.js +11 -8
- package/components/Button/Button.js +12 -9
- package/components/Checkbox.js +11 -8
- package/components/Confirm/index.js +14 -17
- package/components/DatePicker/DatePicker.js +19 -23
- package/components/DialogBox/DialogBox.js +25 -20
- package/components/Divisor.js +11 -8
- package/components/Dropdown.js +18 -15
- package/components/EditableTable/index.js +17 -14
- package/components/ErrorBox/ErrorBox.js +18 -15
- package/components/FileChooser/index.js +20 -15
- package/components/FormBottomBar/index.js +15 -12
- package/components/Icon/Icon.js +9 -6
- package/components/Icon/icons/index.js +252 -251
- package/components/IconTooltip/index.js +14 -9
- package/components/Map/MapBox.js +35 -32
- package/components/Map/MapContainer.js +10 -6
- package/components/Map/MapDateSliderControl.js +14 -12
- package/components/Map/MapDrawer.js +16 -12
- package/components/Map/MapLegend.js +32 -28
- package/components/Map/MapViewStyleControl.js +11 -9
- package/components/Map/ReactMapboxWrapper.js +1 -1
- package/components/Map/index.js +13 -11
- package/components/Map/types.js +5 -3
- package/components/Map/useMaintainLayerOrder.js +5 -2
- package/components/Markdown/index.js +6 -4
- package/components/Message/Message.js +25 -20
- package/components/MultiSelect/index.js +26 -23
- package/components/Navbar/NavFooter.js +8 -5
- package/components/Navbar/NavItem.js +14 -11
- package/components/Navbar/NavSection.js +10 -7
- package/components/Navbar/Navbar.js +16 -11
- package/components/Navbar/SubNavbar.js +8 -5
- package/components/Note.js +10 -7
- package/components/OverlayModal/OverlayModal.js +13 -11
- package/components/PageForm/index.js +15 -12
- package/components/PhotoChooser/index.js +30 -25
- package/components/PhotosCarousel/index.js +15 -18
- package/components/Pill/index.js +14 -11
- package/components/PillList/index.js +10 -7
- package/components/PlacementWrapper/index.js +8 -6
- package/components/PopoverMenu/Popover.js +12 -9
- package/components/PopoverMenu/index.js +14 -11
- package/components/PopoverMultiSelect/index.js +14 -11
- package/components/ProgressCircle/ProgressCircle.js +12 -9
- package/components/RadioButton.js +9 -6
- package/components/Select/Select.js +9 -6
- package/components/Select/SelectT.js +30 -26
- package/components/Separator/index.js +7 -5
- package/components/Size.js +1 -1
- package/components/Slider/index.js +9 -6
- package/components/SummaryBox.js +13 -10
- package/components/Tabs/index.js +22 -18
- package/components/TextTruncated/index.js +13 -20
- package/components/Textfield/Textfield.js +34 -28
- package/components/Textfield/TruncatedTextArea.js +12 -10
- package/components/TimelineSlider/TimelineMarker.js +8 -6
- package/components/TimelineSlider/TimelineRail.js +6 -4
- package/components/TimelineSlider/index.js +14 -12
- package/components/Tooltip/Tooltip.js +12 -7
- package/components/ViewPhotosDialog/index.js +14 -11
- package/components/VirtualWalkthrough/Annotation.js +10 -8
- package/components/VirtualWalkthrough/AnnotationEditPane.js +23 -21
- package/components/VirtualWalkthrough/AnnotationPanel.js +16 -14
- package/components/VirtualWalkthrough/Application.js +9 -7
- package/components/VirtualWalkthrough/AutoRotator.js +5 -3
- package/components/VirtualWalkthrough/BlockingSpinner.js +10 -7
- package/components/VirtualWalkthrough/BoundaryRing.js +8 -6
- package/components/VirtualWalkthrough/BoundaryWall.js +8 -6
- package/components/VirtualWalkthrough/CameraInfo.js +15 -13
- package/components/VirtualWalkthrough/ControlsInfoPane.js +59 -57
- package/components/VirtualWalkthrough/GradientSky.js +8 -6
- package/components/VirtualWalkthrough/SplatControls.js +37 -35
- package/components/VirtualWalkthrough/SplatCrop.js +6 -4
- package/components/VirtualWalkthrough/SplatFadeCrop.js +7 -5
- package/components/VirtualWalkthrough/SplatModel.js +17 -14
- package/components/VirtualWalkthrough/SplatRevealRain.js +6 -4
- package/components/VirtualWalkthrough/TfAnnotationManager.js +8 -5
- package/components/VirtualWalkthrough/TfXrNavigation.js +7 -5
- package/components/VirtualWalkthrough/VirtualWalkthroughViewer.js +47 -45
- package/components/VirtualWalkthrough/VrAnnotationPanel.js +9 -7
- package/components/VirtualWalkthrough/XrAnnotationInteraction.js +9 -7
- package/components/VirtualWalkthrough/XrExitButton.js +9 -7
- package/components/VirtualWalkthrough/XrGazeDwell.js +9 -7
- package/components/VirtualWalkthrough/XrPointerRay.js +9 -7
- package/components/VirtualWalkthrough/boundary-ring.js +7 -5
- package/components/VirtualWalkthrough/boundary-wall.js +8 -6
- package/components/VirtualWalkthrough/groundPlane.js +6 -3
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.js +5 -2
- package/components/VirtualWalkthrough/splatFormat.js +6 -4
- package/components/VirtualWalkthrough/vr-annotation-panel-layout.js +4 -2
- package/components/VirtualWalkthrough/vr-annotation-panel.js +8 -5
- package/components/VirtualWalkthrough/walkthrough-camera.js +6 -4
- package/components/VirtualWalkthrough/xr-annotation-candidates.js +8 -6
- package/components/VirtualWalkthrough/xr-annotation-interaction.js +9 -6
- package/components/VirtualWalkthrough/xr-annotation-targeting.js +5 -2
- package/components/VirtualWalkthrough/xr-button-arming.js +4 -2
- package/components/VirtualWalkthrough/xr-button-hold.js +5 -3
- package/components/VirtualWalkthrough/xr-exit-button.js +10 -8
- package/components/VirtualWalkthrough/xr-face-buttons.js +6 -4
- package/components/VirtualWalkthrough/xr-gaze-dwell-state.js +5 -3
- package/components/VirtualWalkthrough/xr-gaze-dwell.js +9 -7
- package/components/VirtualWalkthrough/xr-interactive-ui.js +10 -8
- package/components/VirtualWalkthrough/xr-pointer-ray.js +5 -3
- package/components/VirtualWalkthrough/xr-progress-pie.js +4 -2
- package/components/VirtualWalkthrough/xr-ray-quad.js +5 -2
- package/components/VirtualWalkthrough/xr-scene-bounds.js +5 -3
- package/components/VirtualWalkthrough/xr-teleport-gesture.js +4 -2
- package/components/svg/BlobbyGrayIconImage.js +13 -11
- package/components/svg/BlobbyGrayIconImport.js +13 -11
- package/components/svg/BlobbyGrayIconUploadToTheCloud.js +13 -11
- package/components/svg/BlobbyIconCloudChecked.js +41 -39
- package/components/svg/BlobbyIconExportOrUploadPhoto.js +41 -39
- package/components/svg/BlobbyIconFolder.js +41 -39
- package/components/svg/BlobbyIconGraphReport.js +41 -39
- package/components/svg/BlobbyIconHappy.js +41 -39
- package/components/svg/BlobbyIconHeartMonitor.js +41 -39
- package/components/svg/BlobbyIconLeaf.js +41 -39
- package/components/svg/BlobbyIconLibrary.js +41 -39
- package/components/svg/BlobbyIconNursery.js +41 -39
- package/components/svg/BlobbyIconOrganization.js +41 -39
- package/components/svg/BlobbyIconParchment.js +41 -39
- package/components/svg/BlobbyIconPeople.js +41 -39
- package/components/svg/BlobbyIconSeedBank.js +41 -39
- package/components/svg/BlobbyIconSeedling.js +41 -39
- package/components/svg/BlobbyIconSeeds.js +41 -39
- package/components/svg/BlobbyIconSite.js +42 -40
- package/components/svg/BlobbyIconSparkles.js +41 -39
- package/components/svg/BlobbyIconWrench.js +41 -39
- package/components/svg/Bug.js +8 -6
- package/components/svg/Calendar.js +8 -6
- package/components/svg/CaretDown.js +8 -6
- package/components/svg/CaretLeft.js +8 -6
- package/components/svg/CaretRight.js +8 -6
- package/components/svg/CaretUp.js +8 -6
- package/components/svg/ChevronDown.js +8 -6
- package/components/svg/ChevronUp.js +8 -6
- package/components/svg/Close.js +8 -6
- package/components/svg/Critical.js +8 -6
- package/components/svg/Edit.js +41 -39
- package/components/svg/Error.js +8 -6
- package/components/svg/Filter.js +8 -6
- package/components/svg/Folder.js +8 -6
- package/components/svg/Help.js +8 -6
- package/components/svg/Home.js +8 -6
- package/components/svg/IconAdd.js +8 -6
- package/components/svg/IconArrowRight.js +8 -6
- package/components/svg/IconBusinessNetwork.js +8 -6
- package/components/svg/IconCalendar.js +8 -6
- package/components/svg/IconCancel.js +8 -6
- package/components/svg/IconChargingBattery.js +8 -6
- package/components/svg/IconChecklist.js +8 -6
- package/components/svg/IconCheckmark.js +8 -6
- package/components/svg/IconCoinInHand.js +8 -6
- package/components/svg/IconColumns.js +8 -6
- package/components/svg/IconComment.js +8 -6
- package/components/svg/IconDashboard.js +8 -6
- package/components/svg/IconDataMigration.js +8 -6
- package/components/svg/IconDocument.js +8 -6
- package/components/svg/IconDownloadFromTheCloud.js +8 -6
- package/components/svg/IconEdit.js +8 -6
- package/components/svg/IconExpand.js +8 -6
- package/components/svg/IconExport.js +8 -6
- package/components/svg/IconExternalLink.js +8 -6
- package/components/svg/IconEye.js +8 -6
- package/components/svg/IconEyeOff.js +8 -6
- package/components/svg/IconFile.js +8 -6
- package/components/svg/IconFolder.js +8 -6
- package/components/svg/IconFullScreen.js +8 -6
- package/components/svg/IconFutures.js +8 -6
- package/components/svg/IconGraphReport.js +8 -6
- package/components/svg/IconHeartMonitor.js +8 -6
- package/components/svg/IconHelp.js +8 -6
- package/components/svg/IconHistory.js +8 -6
- package/components/svg/IconImport.js +8 -6
- package/components/svg/IconIndex.js +8 -6
- package/components/svg/IconLayers.js +8 -6
- package/components/svg/IconLibrary.js +8 -6
- package/components/svg/IconList.js +8 -6
- package/components/svg/IconLivePlant.js +8 -6
- package/components/svg/IconLocations.js +8 -6
- package/components/svg/IconMail.js +8 -6
- package/components/svg/IconManager.js +8 -6
- package/components/svg/IconMarker.js +8 -6
- package/components/svg/IconMenu.js +8 -6
- package/components/svg/IconMenuHorizontal.js +8 -6
- package/components/svg/IconModule.js +8 -6
- package/components/svg/IconMyLocation.js +8 -6
- package/components/svg/IconNote.js +8 -6
- package/components/svg/IconNursery.js +8 -6
- package/components/svg/IconOrg.js +8 -6
- package/components/svg/IconParchment.js +8 -6
- package/components/svg/IconPhoto.js +8 -6
- package/components/svg/IconPlantsFilled.js +8 -6
- package/components/svg/IconRedo.js +8 -6
- package/components/svg/IconRestorationSite.js +8 -6
- package/components/svg/IconSeedBank.js +8 -6
- package/components/svg/IconSeedling.js +8 -6
- package/components/svg/IconSettings.js +8 -6
- package/components/svg/IconSlice.js +8 -6
- package/components/svg/IconSubmit.js +8 -6
- package/components/svg/IconSubtract.js +8 -6
- package/components/svg/IconSynced.js +8 -6
- package/components/svg/IconTrashCan.js +8 -6
- package/components/svg/IconTreasureMap.js +8 -6
- package/components/svg/IconUnavailable.js +8 -6
- package/components/svg/IconUndo.js +8 -6
- package/components/svg/IconVariable.js +8 -6
- package/components/svg/IconVideo.js +9 -7
- package/components/svg/IconWifi.js +8 -6
- package/components/svg/Info.js +8 -6
- package/components/svg/Key.js +8 -6
- package/components/svg/Leaf.js +8 -6
- package/components/svg/Lock.js +8 -6
- package/components/svg/Logo.js +16 -14
- package/components/svg/MenuVertical.js +8 -6
- package/components/svg/Notification.js +8 -6
- package/components/svg/Person.js +8 -6
- package/components/svg/Plus.js +8 -6
- package/components/svg/RestorationSite.js +8 -6
- package/components/svg/Search.js +8 -6
- package/components/svg/Seeds.js +8 -6
- package/components/svg/Site.js +8 -6
- package/components/svg/Sparkles.js +8 -6
- package/components/svg/Species.js +8 -6
- package/components/svg/Species2.js +41 -39
- package/components/svg/Spinner.js +16 -14
- package/components/svg/Star.js +8 -6
- package/components/svg/Success.js +8 -6
- package/components/svg/SuccessFilled.js +8 -6
- package/components/svg/TerrawareLogoDesktop.js +17 -15
- package/components/svg/TerrawareLogoMobile.js +9 -7
- package/components/svg/Touchscreen.js +8 -6
- package/components/svg/UploadCloud.js +41 -39
- package/components/svg/Warning.js +8 -6
- package/components/svg/WelcomeClipboard.js +32 -30
- package/components/svg/index.js +127 -127
- package/components/table/EnhancedTableToolbar.js +18 -15
- package/components/table/EnhancedTableToolbarV2.js +8 -6
- package/components/table/TableCellRenderer.js +37 -32
- package/components/table/TableHeader.js +17 -14
- package/components/table/TableHeaderItem.js +18 -15
- package/components/table/density.js +5 -3
- package/components/table/index.js +40 -37
- package/components/table/sort.js +6 -4
- package/components/table/types.js +1 -1
- package/components/types/index.js +1 -1
- package/hooks/useBoolean.js +4 -2
- package/hooks/useCameraPosition.js +5 -2
- package/hooks/useDevicePerformance.js +6 -3
- package/hooks/useXr.js +6 -4
- package/index.js +55 -58
- package/package.json +6 -2
- package/style-dictionary-dist/TerrawareTheme.js +2 -1
- package/theme.js +5 -2
- package/utils/color.js +5 -2
- package/utils/date.js +7 -6
- package/utils/index.js +4 -5
- package/utils/preventDefaultEvent.js +2 -1
- package/utils/text.js +3 -2
- package/utils/useDeviceInfo.js +2 -1
- package/virtualWalkthrough.js +23 -31
- package/components/Button/button.test.js +0 -23
- package/components/MultiSelect/MultiSelect.test.js +0 -73
- package/components/VirtualWalkthrough/TfXrNavigation.test.js +0 -110
- package/components/VirtualWalkthrough/boundary-ring.test.js +0 -109
- package/components/VirtualWalkthrough/boundary-wall.test.js +0 -203
- package/components/VirtualWalkthrough/groundPlane.test.js +0 -45
- package/components/VirtualWalkthrough/splatFormat.test.js +0 -51
- package/components/VirtualWalkthrough/vr-annotation-panel-layout.test.js +0 -26
- package/components/VirtualWalkthrough/xr-annotation-targeting.test.js +0 -66
- package/components/VirtualWalkthrough/xr-button-arming.test.js +0 -35
- package/components/VirtualWalkthrough/xr-button-hold.test.js +0 -57
- package/components/VirtualWalkthrough/xr-exit-button.test.js +0 -23
- package/components/VirtualWalkthrough/xr-face-buttons.test.js +0 -82
- package/components/VirtualWalkthrough/xr-gaze-dwell-state.test.js +0 -61
- package/components/VirtualWalkthrough/xr-interactive-ui.test.js +0 -165
- package/components/VirtualWalkthrough/xr-progress-pie.test.js +0 -79
- package/components/VirtualWalkthrough/xr-ray-quad.test.js +0 -37
- package/components/VirtualWalkthrough/xr-scene-bounds.test.js +0 -70
- package/components/VirtualWalkthrough/xr-teleport-gesture.test.js +0 -90
- package/components/table/sort.test.js +0 -35
- package/utils/date.test.js +0 -84
- package/utils/text.test.js +0 -21
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react';
|
|
2
2
|
import { useSortable } from '@dnd-kit/sortable';
|
|
3
3
|
import { CSS } from '@dnd-kit/utilities';
|
|
4
4
|
import { DragHandle } from '@mui/icons-material';
|
|
5
|
-
import {
|
|
6
|
-
import IconTooltip from '../IconTooltip';
|
|
7
|
-
import { jsx
|
|
8
|
-
|
|
5
|
+
import { useTheme, TableCell, Box, TableSortLabel } from '@mui/material';
|
|
6
|
+
import IconTooltip from '../IconTooltip/index.js';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
function TableHeaderItem(props) {
|
|
9
10
|
const {
|
|
10
11
|
headCell,
|
|
11
12
|
order,
|
|
@@ -32,7 +33,7 @@ export default function TableHeaderItem(props) {
|
|
|
32
33
|
const createSortHandler = property => event => {
|
|
33
34
|
onRequestSort(event, property);
|
|
34
35
|
};
|
|
35
|
-
return headCell.alignment === 'right' ? /*#__PURE__*/
|
|
36
|
+
return headCell.alignment === 'right' ? /*#__PURE__*/jsx(TableCell, {
|
|
36
37
|
ref: setNodeRef,
|
|
37
38
|
id: `table-header-${headCell.id}`,
|
|
38
39
|
align: 'right',
|
|
@@ -41,22 +42,22 @@ export default function TableHeaderItem(props) {
|
|
|
41
42
|
style: style,
|
|
42
43
|
className: headCell.className || '',
|
|
43
44
|
sx: headCell.sx,
|
|
44
|
-
children: /*#__PURE__*/
|
|
45
|
+
children: /*#__PURE__*/jsxs(Box, {
|
|
45
46
|
display: "flex",
|
|
46
47
|
alignItems: "center",
|
|
47
48
|
flexDirection: "row-reverse",
|
|
48
|
-
children: [headCell.label && /*#__PURE__*/
|
|
49
|
+
children: [headCell.label && /*#__PURE__*/jsxs(TableSortLabel, {
|
|
49
50
|
sx: {
|
|
50
51
|
flexDirection: 'row-reverse'
|
|
51
52
|
},
|
|
52
53
|
active: orderBy === headCell.id,
|
|
53
54
|
direction: orderBy === headCell.id ? order : 'asc',
|
|
54
55
|
onClick: createSortHandler(headCell.id),
|
|
55
|
-
children: [headCell.tooltipTitle && /*#__PURE__*/
|
|
56
|
+
children: [headCell.tooltipTitle && /*#__PURE__*/jsx(IconTooltip, {
|
|
56
57
|
title: headCell.tooltipTitle,
|
|
57
58
|
disableRightMargin: true
|
|
58
59
|
}), headCell.label]
|
|
59
|
-
}), i > 0 && /*#__PURE__*/
|
|
60
|
+
}), i > 0 && /*#__PURE__*/jsx(DragHandle, {
|
|
60
61
|
...attributes,
|
|
61
62
|
...listeners,
|
|
62
63
|
sx: {
|
|
@@ -70,7 +71,7 @@ export default function TableHeaderItem(props) {
|
|
|
70
71
|
}
|
|
71
72
|
})]
|
|
72
73
|
})
|
|
73
|
-
}, headCell.id) : /*#__PURE__*/
|
|
74
|
+
}, headCell.id) : /*#__PURE__*/jsx(TableCell, {
|
|
74
75
|
ref: setNodeRef,
|
|
75
76
|
id: `table-header-${headCell.id}`,
|
|
76
77
|
align: 'left',
|
|
@@ -79,11 +80,11 @@ export default function TableHeaderItem(props) {
|
|
|
79
80
|
style: style,
|
|
80
81
|
className: headCell.className || '',
|
|
81
82
|
sx: headCell.sx,
|
|
82
|
-
children: headCell.label && /*#__PURE__*/
|
|
83
|
+
children: headCell.label && /*#__PURE__*/jsxs(TableSortLabel, {
|
|
83
84
|
active: orderBy === headCell.id,
|
|
84
85
|
direction: orderBy === headCell.id ? order : 'asc',
|
|
85
86
|
onClick: createSortHandler(headCell.id),
|
|
86
|
-
children: [i > 0 && /*#__PURE__*/
|
|
87
|
+
children: [i > 0 && /*#__PURE__*/jsx(DragHandle, {
|
|
87
88
|
...attributes,
|
|
88
89
|
...listeners,
|
|
89
90
|
sx: {
|
|
@@ -93,9 +94,11 @@ export default function TableHeaderItem(props) {
|
|
|
93
94
|
color: theme.palette.neutral[600]
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
|
-
}), headCell.label, headCell.tooltipTitle && /*#__PURE__*/
|
|
97
|
+
}), headCell.label, headCell.tooltipTitle && /*#__PURE__*/jsx(IconTooltip, {
|
|
97
98
|
title: headCell.tooltipTitle
|
|
98
99
|
})]
|
|
99
100
|
})
|
|
100
101
|
}, headCell.id);
|
|
101
|
-
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { TableHeaderItem as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const getTableCellPaddingY = tableDensity => {
|
|
2
2
|
switch (tableDensity) {
|
|
3
3
|
case 'comfortable':
|
|
4
4
|
return '16px';
|
|
@@ -8,7 +8,7 @@ export const getTableCellPaddingY = tableDensity => {
|
|
|
8
8
|
return '20px';
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
const getTableRowHeight = tableDensity => {
|
|
12
12
|
switch (tableDensity) {
|
|
13
13
|
case 'comfortable':
|
|
14
14
|
return '52px';
|
|
@@ -17,4 +17,6 @@ export const getTableRowHeight = tableDensity => {
|
|
|
17
17
|
case 'roomy':
|
|
18
18
|
return '60px';
|
|
19
19
|
}
|
|
20
|
-
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { getTableCellPaddingY, getTableRowHeight };
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useSensors, useSensor, MouseSensor, TouchSensor, KeyboardSensor, DndContext } from '@dnd-kit/core';
|
|
3
3
|
import { sortableKeyboardCoordinates } from '@dnd-kit/sortable';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
4
|
+
import { useTheme, TableContainer, Table, TableBody, TableRow, TableCell, Checkbox, Typography, Box, Pagination } from '@mui/material';
|
|
5
|
+
import 'lodash';
|
|
6
|
+
import 'luxon';
|
|
7
|
+
import useDeviceInfo from '../../utils/useDeviceInfo.js';
|
|
8
|
+
import { CheckboxStyle } from '../Checkbox.js';
|
|
9
|
+
import EnhancedTableToolbarV2 from './EnhancedTableToolbarV2.js';
|
|
10
|
+
import CellRenderer from './TableCellRenderer.js';
|
|
11
|
+
import EnhancedTableHead from './TableHeader.js';
|
|
12
|
+
import { getTableCellPaddingY, getTableRowHeight } from './density.js';
|
|
13
|
+
import { stableSort, descendingComparator, getComparator } from './sort.js';
|
|
14
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
|
-
export const isTopBarButton = input => {
|
|
16
|
+
const isTopBarButton = input => {
|
|
16
17
|
const castInput = input;
|
|
17
18
|
return !!(castInput.buttonType && castInput.onButtonClick);
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
function EnhancedTable({
|
|
20
21
|
id,
|
|
21
22
|
columns,
|
|
22
23
|
rows,
|
|
23
24
|
order: _order = 'asc',
|
|
24
25
|
orderBy: _orderBy,
|
|
25
|
-
Renderer =
|
|
26
|
+
Renderer = CellRenderer,
|
|
26
27
|
onSelect,
|
|
27
28
|
onPageChange,
|
|
28
29
|
maxItemsPerPage = 100,
|
|
@@ -227,8 +228,8 @@ export default function EnhancedTable({
|
|
|
227
228
|
}
|
|
228
229
|
return Math.min(pageNumber * maxItemsPerPage, paginationTotal);
|
|
229
230
|
}, [pageNumber, maxItemsPerPage, paginationTotal, sortedPageRows.length]);
|
|
230
|
-
return /*#__PURE__*/
|
|
231
|
-
children: [showTopBar && /*#__PURE__*/
|
|
231
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
232
|
+
children: [showTopBar && /*#__PURE__*/jsx(EnhancedTableToolbarV2, {
|
|
232
233
|
selectedRowsCount: selectedRows?.length || 0,
|
|
233
234
|
pagesCount: pagesCount,
|
|
234
235
|
renderNumSelectedText: renderNumSelectedText,
|
|
@@ -239,12 +240,12 @@ export default function EnhancedTable({
|
|
|
239
240
|
handleSelectAll: () => setSelectedRows && setSelectedRows(rows),
|
|
240
241
|
handleSelectNone: () => setSelectedRows && setSelectedRows([])
|
|
241
242
|
} : undefined
|
|
242
|
-
}), /*#__PURE__*/
|
|
243
|
+
}), /*#__PURE__*/jsx(TableContainer, {
|
|
243
244
|
id: id,
|
|
244
|
-
children: /*#__PURE__*/
|
|
245
|
+
children: /*#__PURE__*/jsx(DndContext, {
|
|
245
246
|
sensors: sensors,
|
|
246
247
|
onDragEnd: handleDragEnd,
|
|
247
|
-
children: /*#__PURE__*/
|
|
248
|
+
children: /*#__PURE__*/jsxs(Table, {
|
|
248
249
|
stickyHeader: stickyHeader,
|
|
249
250
|
"aria-labelledby": "tableTitle",
|
|
250
251
|
size: "medium",
|
|
@@ -252,7 +253,7 @@ export default function EnhancedTable({
|
|
|
252
253
|
sx: {
|
|
253
254
|
borderCollapse: 'initial'
|
|
254
255
|
},
|
|
255
|
-
children: [!hideHeader && /*#__PURE__*/
|
|
256
|
+
children: [!hideHeader && /*#__PURE__*/jsx(EnhancedTableHead, {
|
|
256
257
|
order: order,
|
|
257
258
|
orderBy: orderBy,
|
|
258
259
|
onRequestSort: handleRequestSort,
|
|
@@ -262,20 +263,20 @@ export default function EnhancedTable({
|
|
|
262
263
|
onSelectAllClick: showCheckbox ? handleSelectAllClick : undefined,
|
|
263
264
|
rowCount: showCheckbox ? sortedPageRows?.length : undefined,
|
|
264
265
|
density: density
|
|
265
|
-
}), /*#__PURE__*/
|
|
266
|
-
children: [sortedPageRows.length < 1 && emptyTableMessage && /*#__PURE__*/
|
|
267
|
-
children: /*#__PURE__*/
|
|
266
|
+
}), /*#__PURE__*/jsxs(TableBody, {
|
|
267
|
+
children: [sortedPageRows.length < 1 && emptyTableMessage && /*#__PURE__*/jsx(TableRow, {
|
|
268
|
+
children: /*#__PURE__*/jsx(TableCell, {
|
|
268
269
|
colSpan: columns.length + 1,
|
|
269
270
|
align: "center",
|
|
270
|
-
children: /*#__PURE__*/
|
|
271
|
+
children: /*#__PURE__*/jsx("p", {
|
|
271
272
|
children: emptyTableMessage
|
|
272
273
|
})
|
|
273
274
|
})
|
|
274
275
|
}), sortedPageRows && sortedPageRows.map((row, index) => {
|
|
275
276
|
const onClick = onSelect && !controlledOnSelect ? () => onSelect(row) : undefined;
|
|
276
277
|
const isItemSelected = isSelected(row);
|
|
277
|
-
return /*#__PURE__*/
|
|
278
|
-
children: [/*#__PURE__*/
|
|
278
|
+
return /*#__PURE__*/jsxs(React.Fragment, {
|
|
279
|
+
children: [/*#__PURE__*/jsxs(TableRow, {
|
|
279
280
|
id: `row${index + 1}`,
|
|
280
281
|
hover: true,
|
|
281
282
|
onClick: e => {
|
|
@@ -304,21 +305,21 @@ export default function EnhancedTable({
|
|
|
304
305
|
backgroundColor: theme.palette.TwClrBgSecondaryHover
|
|
305
306
|
}
|
|
306
307
|
},
|
|
307
|
-
children: [showCheckbox && /*#__PURE__*/
|
|
308
|
+
children: [showCheckbox && /*#__PURE__*/jsx(TableCell, {
|
|
308
309
|
padding: "checkbox",
|
|
309
310
|
sx: {
|
|
310
311
|
'&.MuiTableCell-root': {
|
|
311
312
|
borderBottom: `1px solid ${theme.palette.TwClrBgSecondary}`
|
|
312
313
|
}
|
|
313
314
|
},
|
|
314
|
-
children: /*#__PURE__*/
|
|
315
|
+
children: /*#__PURE__*/jsx(Checkbox, {
|
|
315
316
|
disableRipple: true,
|
|
316
317
|
sx: CheckboxStyle(theme),
|
|
317
318
|
color: "primary",
|
|
318
319
|
checked: isItemSelected,
|
|
319
320
|
onClick: e => !isClickable || !isClickable(row) ? handleClick(e, row) : null
|
|
320
321
|
})
|
|
321
|
-
}), displayColumnDetails && displayColumnDetails.map(c => /*#__PURE__*/
|
|
322
|
+
}), displayColumnDetails && displayColumnDetails.map(c => /*#__PURE__*/jsx(Renderer, {
|
|
322
323
|
index: index + 1,
|
|
323
324
|
row: row,
|
|
324
325
|
column: c,
|
|
@@ -332,7 +333,7 @@ export default function EnhancedTable({
|
|
|
332
333
|
paddingY: getTableCellPaddingY(density)
|
|
333
334
|
}
|
|
334
335
|
}, c.key))]
|
|
335
|
-
}), DetailsRenderer && /*#__PURE__*/
|
|
336
|
+
}), DetailsRenderer && /*#__PURE__*/jsx(DetailsRenderer, {
|
|
336
337
|
index: index,
|
|
337
338
|
row: row
|
|
338
339
|
})]
|
|
@@ -341,22 +342,22 @@ export default function EnhancedTable({
|
|
|
341
342
|
})]
|
|
342
343
|
})
|
|
343
344
|
})
|
|
344
|
-
}), tableComments && /*#__PURE__*/
|
|
345
|
+
}), tableComments && /*#__PURE__*/jsx(Typography, {
|
|
345
346
|
fontWeight: 400,
|
|
346
347
|
fontSize: "14px",
|
|
347
348
|
color: theme.palette.TwClrTxtSecondary,
|
|
348
349
|
marginTop: 2,
|
|
349
350
|
children: tableComments
|
|
350
|
-
}), renderPaginationText && /*#__PURE__*/
|
|
351
|
+
}), renderPaginationText && /*#__PURE__*/jsxs(Box, {
|
|
351
352
|
display: "flex",
|
|
352
353
|
alignItems: "center",
|
|
353
354
|
justifyContent: "flex-end",
|
|
354
355
|
paddingTop: "24px",
|
|
355
|
-
children: [/*#__PURE__*/
|
|
356
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
356
357
|
paddingRight: "24px",
|
|
357
358
|
fontSize: "14px",
|
|
358
359
|
children: renderPaginationText(minRowNumber, maxRowNumber, paginationTotal)
|
|
359
|
-
}), /*#__PURE__*/
|
|
360
|
+
}), /*#__PURE__*/jsx(Pagination, {
|
|
360
361
|
count: pagesCount,
|
|
361
362
|
page: pageNumber,
|
|
362
363
|
shape: "rounded",
|
|
@@ -367,9 +368,11 @@ export default function EnhancedTable({
|
|
|
367
368
|
})]
|
|
368
369
|
});
|
|
369
370
|
}
|
|
370
|
-
|
|
371
|
+
function tableSort(ignore, array, comparator) {
|
|
371
372
|
if (ignore) {
|
|
372
373
|
return array;
|
|
373
374
|
}
|
|
374
375
|
return stableSort(array, comparator);
|
|
375
|
-
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export { EnhancedTable as default, isTopBarButton, tableSort };
|
package/components/table/sort.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function descendingComparator(a, b, orderBy, order) {
|
|
2
2
|
// first attempt to parse into a numeric value and compare
|
|
3
3
|
const numCompare = descendingNumComparator(a, b, orderBy);
|
|
4
4
|
if (numCompare !== null) {
|
|
@@ -46,10 +46,10 @@ function descendingNumComparator(a, b, orderBy) {
|
|
|
46
46
|
}
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
function getComparator(order, orderBy, sorting) {
|
|
50
50
|
return (a, b) => sorting(a, b, orderBy, order);
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
function stableSort(array, comparator) {
|
|
53
53
|
const stabilizedThis = array.map((el, index) => [el, index]);
|
|
54
54
|
stabilizedThis.sort((a, b) => {
|
|
55
55
|
const order = comparator(a[0], b[0]);
|
|
@@ -59,4 +59,6 @@ export function stableSort(array, comparator) {
|
|
|
59
59
|
return a[1] - b[1];
|
|
60
60
|
});
|
|
61
61
|
return stabilizedThis.map(el => el[0]);
|
|
62
|
-
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { descendingComparator, getComparator, stableSort };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/hooks/useBoolean.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
|
|
2
3
|
const useBoolean = initialValue => {
|
|
3
4
|
const [value, setValue] = useState(initialValue);
|
|
4
5
|
const setTrue = useCallback(() => {
|
|
@@ -9,4 +10,5 @@ const useBoolean = initialValue => {
|
|
|
9
10
|
}, []);
|
|
10
11
|
return [value, setValue, setTrue, setFalse];
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
export { useBoolean as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'react';
|
|
2
2
|
import { useApp } from '@playcanvas/react/hooks';
|
|
3
3
|
import { Vec3 } from 'playcanvas';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
const useCameraPosition = () => {
|
|
5
6
|
const app = useApp();
|
|
6
7
|
const setCamera = useCallback((focus, position, horizontalNdcBias = 0) => {
|
|
7
8
|
const camera = app.root.findByName('camera');
|
|
@@ -30,4 +31,6 @@ export const useCameraPosition = () => {
|
|
|
30
31
|
setCamera,
|
|
31
32
|
getCameraState
|
|
32
33
|
}), [setCamera, getCameraState]);
|
|
33
|
-
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { useCameraPosition };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import useDeviceInfo from '../utils/useDeviceInfo';
|
|
3
|
-
|
|
2
|
+
import useDeviceInfo from '../utils/useDeviceInfo.js';
|
|
3
|
+
|
|
4
|
+
const useDevicePerformance = () => {
|
|
4
5
|
const {
|
|
5
6
|
isMobile
|
|
6
7
|
} = useDeviceInfo();
|
|
@@ -13,4 +14,6 @@ export const useDevicePerformance = () => {
|
|
|
13
14
|
deviceMemory,
|
|
14
15
|
isMobile
|
|
15
16
|
};
|
|
16
|
-
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { useDevicePerformance };
|
package/hooks/useXr.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { useApp } from '@playcanvas/react/hooks';
|
|
3
|
-
import {
|
|
3
|
+
import { XRTYPE_AR, XRTYPE_VR, XRSPACE_LOCALFLOOR } from 'playcanvas';
|
|
4
|
+
|
|
4
5
|
const XR_TYPES = {
|
|
5
6
|
VR: XRTYPE_VR,
|
|
6
7
|
AR: XRTYPE_AR
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
const useXr = ({
|
|
9
10
|
onError
|
|
10
11
|
} = {}) => {
|
|
11
12
|
const app = useApp();
|
|
@@ -75,4 +76,5 @@ export const useXr = ({
|
|
|
75
76
|
isCurrentlyInVr: currentXrType === XRTYPE_VR
|
|
76
77
|
}), [isXrAvailable, startXr, endXr, currentXrType]);
|
|
77
78
|
};
|
|
78
|
-
|
|
79
|
+
|
|
80
|
+
export { useXr as default, useXr };
|
package/index.js
CHANGED
|
@@ -1,58 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
import
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
import { descendingComparator, getComparator, stableSort } from './components/table/sort';
|
|
57
|
-
import theme from './theme';
|
|
58
|
-
export { AntSwitch, Autocomplete, Badge, BusySpinner, Button, CellRenderer, CellDateRenderer, Checkbox, Confirm, DatePicker, descendingComparator, DialogBox, Divisor, Dropdown, DropdownV1, EditableTable, ErrorBox, FileChooser, FormBottomBar, getComparator, icons, Icon, IconTooltip, MapComponent, Message, MultiSelect, NavFooter, NavItem, NavSection, Navbar, Note, OverlayModal, PageForm, Pill, PillList, PhotoChooser, PhotosCarousel, PlacementWrapper, Popover, PopoverMenu, PopoverMultiSelect, ProgressCircle, RadioButton, Select, SelectT, Separator, Slider, stableSort, SummaryBox, Svg, Table, Tabs, Textfield, TextTruncated, TimelineSlider, theme, Tooltip, ViewPhotosDialog };
|
|
1
|
+
export { default as AntSwitch } from './components/AntSwitch/index.js';
|
|
2
|
+
export { default as Autocomplete } from './components/Autocomplete/Autocomplete.js';
|
|
3
|
+
export { default as Badge } from './components/Badge/index.js';
|
|
4
|
+
export { default as BusySpinner } from './components/BusySpinner/index.js';
|
|
5
|
+
export { default as Button } from './components/Button/Button.js';
|
|
6
|
+
export { default as Checkbox } from './components/Checkbox.js';
|
|
7
|
+
export { default as Confirm } from './components/Confirm/index.js';
|
|
8
|
+
export { default as DatePicker } from './components/DatePicker/DatePicker.js';
|
|
9
|
+
export { default as DialogBox } from './components/DialogBox/DialogBox.js';
|
|
10
|
+
export { default as Divisor } from './components/Divisor.js';
|
|
11
|
+
export { default as Dropdown, DropdownV1 } from './components/Dropdown.js';
|
|
12
|
+
export { default as EditableTable } from './components/EditableTable/index.js';
|
|
13
|
+
export { default as ErrorBox } from './components/ErrorBox/ErrorBox.js';
|
|
14
|
+
export { default as FileChooser } from './components/FileChooser/index.js';
|
|
15
|
+
export { default as FormBottomBar } from './components/FormBottomBar/index.js';
|
|
16
|
+
export { default as Icon } from './components/Icon/Icon.js';
|
|
17
|
+
export { default as icons } from './components/Icon/icons/index.js';
|
|
18
|
+
export { default as IconTooltip } from './components/IconTooltip/index.js';
|
|
19
|
+
export { default as MapComponent } from './components/Map/index.js';
|
|
20
|
+
export { default as Message } from './components/Message/Message.js';
|
|
21
|
+
export { default as MultiSelect } from './components/MultiSelect/index.js';
|
|
22
|
+
export { default as NavFooter } from './components/Navbar/NavFooter.js';
|
|
23
|
+
export { default as NavItem } from './components/Navbar/NavItem.js';
|
|
24
|
+
export { default as NavSection } from './components/Navbar/NavSection.js';
|
|
25
|
+
export { default as Navbar } from './components/Navbar/Navbar.js';
|
|
26
|
+
export { default as Note } from './components/Note.js';
|
|
27
|
+
export { default as OverlayModal } from './components/OverlayModal/OverlayModal.js';
|
|
28
|
+
export { default as PageForm } from './components/PageForm/index.js';
|
|
29
|
+
export { default as PhotoChooser } from './components/PhotoChooser/index.js';
|
|
30
|
+
export { default as PhotosCarousel } from './components/PhotosCarousel/index.js';
|
|
31
|
+
export { default as Pill } from './components/Pill/index.js';
|
|
32
|
+
export { default as PillList } from './components/PillList/index.js';
|
|
33
|
+
export { default as PlacementWrapper } from './components/PlacementWrapper/index.js';
|
|
34
|
+
export { default as PopoverMenu } from './components/PopoverMenu/index.js';
|
|
35
|
+
export { default as Popover } from './components/PopoverMenu/Popover.js';
|
|
36
|
+
export { default as PopoverMultiSelect } from './components/PopoverMultiSelect/index.js';
|
|
37
|
+
export { default as ProgressCircle } from './components/ProgressCircle/ProgressCircle.js';
|
|
38
|
+
export { default as RadioButton } from './components/RadioButton.js';
|
|
39
|
+
export { default as Select } from './components/Select/Select.js';
|
|
40
|
+
export { default as SelectT } from './components/Select/SelectT.js';
|
|
41
|
+
export { default as Separator } from './components/Separator/index.js';
|
|
42
|
+
export { default as Slider } from './components/Slider/index.js';
|
|
43
|
+
export { default as SummaryBox } from './components/SummaryBox.js';
|
|
44
|
+
export { default as Tabs } from './components/Tabs/index.js';
|
|
45
|
+
export { default as TextTruncated } from './components/TextTruncated/index.js';
|
|
46
|
+
export { default as Textfield } from './components/Textfield/Textfield.js';
|
|
47
|
+
export { default as TimelineSlider } from './components/TimelineSlider/index.js';
|
|
48
|
+
export { default as Tooltip } from './components/Tooltip/Tooltip.js';
|
|
49
|
+
export { default as ViewPhotosDialog } from './components/ViewPhotosDialog/index.js';
|
|
50
|
+
import * as index from './components/svg/index.js';
|
|
51
|
+
export { index as Svg };
|
|
52
|
+
export { default as Table } from './components/table/index.js';
|
|
53
|
+
export { CellDateRenderer, default as CellRenderer } from './components/table/TableCellRenderer.js';
|
|
54
|
+
export { descendingComparator, getComparator, stableSort } from './components/table/sort.js';
|
|
55
|
+
export { default as theme } from './theme.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terraware/web-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"author": "Terraformation Inc.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -48,5 +48,9 @@
|
|
|
48
48
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
|
|
49
49
|
"type": "module",
|
|
50
50
|
"module": "./index.js",
|
|
51
|
-
"types": "./index.d.ts"
|
|
51
|
+
"types": "./index.d.ts",
|
|
52
|
+
"sideEffects": [
|
|
53
|
+
"*.css",
|
|
54
|
+
"*.scss"
|
|
55
|
+
]
|
|
52
56
|
}
|
package/theme.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createTheme } from '@mui/material/styles';
|
|
2
|
-
import TerrawareTheme from './style-dictionary-dist/TerrawareTheme';
|
|
2
|
+
import TerrawareTheme from './style-dictionary-dist/TerrawareTheme.js';
|
|
3
|
+
|
|
3
4
|
const defaultTheme = {
|
|
4
5
|
breakpoints: {
|
|
5
6
|
values: {
|
|
@@ -76,4 +77,6 @@ const defaultTheme = {
|
|
|
76
77
|
...TerrawareTheme.palette
|
|
77
78
|
}
|
|
78
79
|
};
|
|
79
|
-
|
|
80
|
+
var theme = createTheme(defaultTheme);
|
|
81
|
+
|
|
82
|
+
export { theme as default };
|
package/utils/color.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import hexRgb from 'hex-rgb';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const getRgbaFromHex = (hex, opacity) => {
|
|
3
4
|
const rgba = hexRgb(hex, {
|
|
4
5
|
alpha: opacity,
|
|
5
6
|
format: 'object'
|
|
@@ -11,4 +12,6 @@ export const getRgbaFromHex = (hex, opacity) => {
|
|
|
11
12
|
alpha
|
|
12
13
|
} = rgba;
|
|
13
14
|
return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
|
|
14
|
-
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { getRgbaFromHex };
|
package/utils/date.js
CHANGED
|
@@ -12,7 +12,7 @@ import { DateTime } from 'luxon';
|
|
|
12
12
|
/**
|
|
13
13
|
* Helper util that returns default time zone as a fallback.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
const tz = timeZoneId => timeZoneId || 'Etc/UTC';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Parse a date ISO string with zone implied.
|
|
@@ -47,7 +47,7 @@ const getDisplayValue = date => {
|
|
|
47
47
|
/**
|
|
48
48
|
* Returns <Month> <Year> (eg. July 2023).
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
const getShortDate = date => {
|
|
51
51
|
if (date.isValid) {
|
|
52
52
|
return date.toFormat('LLLL yyyy');
|
|
53
53
|
}
|
|
@@ -59,7 +59,7 @@ export const getShortDate = date => {
|
|
|
59
59
|
* any DateType value passed in (ISO string or epoch milliseconds or DateTime object).
|
|
60
60
|
* Note: the DateTime object input support is mostly for ease of use and will essentially be a pass-through.
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
const getDate = (date, timeZoneId) => {
|
|
63
63
|
if (typeof date === 'string') {
|
|
64
64
|
const fromString = getDateFromISOString(date, timeZoneId);
|
|
65
65
|
if (fromString.isValid) {
|
|
@@ -96,18 +96,19 @@ const getDateDisplayValue = (date, timeZoneId) => {
|
|
|
96
96
|
/**
|
|
97
97
|
* Exported function that returns todays date in a specific (optional) time zone.
|
|
98
98
|
*/
|
|
99
|
-
|
|
99
|
+
const getTodaysDateFormatted = timeZoneId => {
|
|
100
100
|
return getDisplayValue(DateTime.now().setZone(tz(timeZoneId)));
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
104
|
* Checks if a date is in the future, time zone for date is optional.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
const isInTheFuture = (date, timeZoneId) => {
|
|
107
107
|
const d = getDate(date, timeZoneId);
|
|
108
108
|
if (d.isValid) {
|
|
109
109
|
return d.toMillis() > Date.now();
|
|
110
110
|
}
|
|
111
111
|
return false;
|
|
112
112
|
};
|
|
113
|
-
|
|
113
|
+
|
|
114
|
+
export { getDateDisplayValue as default, getDate, getShortDate, getTodaysDateFormatted, isInTheFuture, tz };
|