@terraware/web-components 3.5.12-rc.7 → 3.5.12
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 +27 -0
- package/components/AntSwitch/styles.scss +66 -0
- package/components/Autocomplete/Autocomplete.js +131 -0
- package/components/Autocomplete/styles.scss +155 -0
- package/components/Badge/index.js +32 -0
- package/components/BusySpinner/index.js +49 -0
- package/components/Button/Button.js +51 -0
- package/components/Button/button.test.js +25 -0
- package/components/Button/styles.scss +453 -0
- package/components/Checkbox.js +70 -0
- package/components/Confirm/index.js +94 -0
- package/components/DatePicker/DatePicker.js +150 -0
- package/components/DatePicker/styles.scss +95 -0
- package/components/DialogBox/DialogBox.js +91 -0
- package/components/DialogBox/styles.scss +165 -0
- package/components/Divisor.js +21 -0
- package/components/Dropdown.js +102 -0
- package/components/ErrorBox/ErrorBox.js +47 -0
- package/components/ErrorBox/styles.scss +63 -0
- package/components/FileChooser/index.js +137 -0
- package/components/FormBottomBar/index.js +90 -0
- package/components/Icon/Icon.js +25 -0
- package/components/Icon/icons/index.js +241 -0
- package/components/Icon/styles.scss +41 -0
- package/components/IconTooltip/index.js +61 -0
- package/components/Map/MapBox.d.ts.map +1 -1
- package/components/Map/MapBox.js +479 -0
- package/components/Map/MapContainer.js +30 -0
- package/components/Map/MapDateSliderControl.js +66 -0
- package/components/Map/MapDrawer.js +45 -0
- package/components/Map/MapLegend.js +172 -0
- package/components/Map/MapViewStyleControl.js +74 -0
- package/components/Map/ReactMapboxWrapper.d.ts +3 -0
- package/components/Map/ReactMapboxWrapper.d.ts.map +1 -0
- package/components/Map/ReactMapboxWrapper.js +9 -0
- package/components/Map/index.js +190 -0
- package/components/Map/styles.scss +130 -0
- package/components/Map/types.js +24 -0
- package/components/Map/useMaintainLayerOrder.js +32 -0
- package/components/Message/Message.js +67 -0
- package/components/Message/styles.scss +202 -0
- package/components/MultiSelect/MultiSelect.test.js +75 -0
- package/components/MultiSelect/index.js +120 -0
- package/components/MultiSelect/styles.scss +180 -0
- package/components/Navbar/NavFooter.js +17 -0
- package/components/Navbar/NavItem.js +73 -0
- package/components/Navbar/NavSection.js +22 -0
- package/components/Navbar/Navbar.js +46 -0
- package/components/Navbar/SubNavbar.js +17 -0
- package/components/Navbar/styles.scss +155 -0
- package/components/Note.js +25 -0
- package/components/PageForm/index.js +43 -0
- package/components/PhotoChooser/index.js +137 -0
- package/components/Pill/index.js +46 -0
- package/components/Pill/styles.scss +50 -0
- package/components/PillList/index.js +29 -0
- package/components/PillList/styles.scss +12 -0
- package/components/PlacementWrapper/index.js +63 -0
- package/components/PopoverMenu/Popover.js +88 -0
- package/components/PopoverMenu/index.js +59 -0
- package/components/PopoverMultiSelect/index.js +62 -0
- package/components/PopoverMultiSelect/styles.scss +10 -0
- package/components/ProgressCircle/ProgressCircle.js +34 -0
- package/components/ProgressCircle/styles.scss +87 -0
- package/components/RadioButton.js +25 -0
- package/components/Select/Select.js +19 -0
- package/components/Select/SelectT.js +245 -0
- package/components/Select/styles.scss +307 -0
- package/components/Separator/index.js +21 -0
- package/components/Size.js +5 -0
- package/components/Slider/index.js +60 -0
- package/components/SummaryBox.js +73 -0
- package/components/Tabs/index.js +111 -0
- package/components/TextTruncated/index.js +146 -0
- package/components/Textfield/Textfield.js +172 -0
- package/components/Textfield/TruncatedTextArea.js +71 -0
- package/components/Textfield/styles.scss +271 -0
- package/components/Tooltip/Tooltip.js +54 -0
- package/components/ViewPhotosDialog/index.js +136 -0
- package/components/ViewPhotosDialog/styles.scss +18 -0
- package/components/svg/BlobbyGrayIconImage.js +39 -0
- package/components/svg/BlobbyGrayIconImport.js +39 -0
- package/components/svg/BlobbyGrayIconUploadToTheCloud.js +39 -0
- package/components/svg/BlobbyIconCloudChecked.js +156 -0
- package/components/svg/BlobbyIconExportOrUploadPhoto.js +156 -0
- package/components/svg/BlobbyIconFolder.js +156 -0
- package/components/svg/BlobbyIconGraphReport.js +156 -0
- package/components/svg/BlobbyIconHappy.js +156 -0
- package/components/svg/BlobbyIconHeartMonitor.js +156 -0
- package/components/svg/BlobbyIconLeaf.js +156 -0
- package/components/svg/BlobbyIconLibrary.js +156 -0
- package/components/svg/BlobbyIconNursery.js +158 -0
- package/components/svg/BlobbyIconOrganization.js +156 -0
- package/components/svg/BlobbyIconParchment.js +156 -0
- package/components/svg/BlobbyIconPeople.js +156 -0
- package/components/svg/BlobbyIconSeedBank.js +156 -0
- package/components/svg/BlobbyIconSeedling.js +156 -0
- package/components/svg/BlobbyIconSeeds.js +156 -0
- package/components/svg/BlobbyIconSite.js +159 -0
- package/components/svg/BlobbyIconSparkles.js +156 -0
- package/components/svg/BlobbyIconWrench.js +156 -0
- package/components/svg/Bug.js +25 -0
- package/components/svg/Calendar.js +25 -0
- package/components/svg/CaretDown.js +25 -0
- package/components/svg/CaretLeft.js +25 -0
- package/components/svg/CaretRight.js +25 -0
- package/components/svg/CaretUp.js +25 -0
- package/components/svg/ChevronDown.js +25 -0
- package/components/svg/ChevronUp.js +25 -0
- package/components/svg/Close.js +25 -0
- package/components/svg/Critical.js +25 -0
- package/components/svg/Edit.js +156 -0
- package/components/svg/Error.js +25 -0
- package/components/svg/Filter.js +25 -0
- package/components/svg/Folder.js +25 -0
- package/components/svg/Help.js +25 -0
- package/components/svg/Home.js +25 -0
- package/components/svg/IconAdd.js +25 -0
- package/components/svg/IconArrowRight.js +27 -0
- package/components/svg/IconBusinessNetwork.js +25 -0
- package/components/svg/IconCancel.js +25 -0
- package/components/svg/IconChargingBattery.js +25 -0
- package/components/svg/IconCheckmark.js +25 -0
- package/components/svg/IconCoinInHand.js +25 -0
- package/components/svg/IconColumns.js +25 -0
- package/components/svg/IconComment.js +26 -0
- package/components/svg/IconDashboard.js +25 -0
- package/components/svg/IconDataMigration.js +25 -0
- package/components/svg/IconEdit.js +27 -0
- package/components/svg/IconExport.js +25 -0
- package/components/svg/IconExternalLink.js +25 -0
- package/components/svg/IconEye.js +25 -0
- package/components/svg/IconEyeOff.js +25 -0
- package/components/svg/IconFile.js +25 -0
- package/components/svg/IconFolder.js +25 -0
- package/components/svg/IconFullScreen.js +26 -0
- package/components/svg/IconFutures.js +25 -0
- package/components/svg/IconGraphReport.js +25 -0
- package/components/svg/IconHeartMonitor.js +25 -0
- package/components/svg/IconHelp.js +27 -0
- package/components/svg/IconHistory.js +25 -0
- package/components/svg/IconImport.js +25 -0
- package/components/svg/IconIndex.js +25 -0
- package/components/svg/IconLayers.js +25 -0
- package/components/svg/IconLibrary.js +26 -0
- package/components/svg/IconList.js +25 -0
- package/components/svg/IconLivePlant.js +25 -0
- package/components/svg/IconLocations.js +25 -0
- package/components/svg/IconMail.js +25 -0
- package/components/svg/IconManager.js +25 -0
- package/components/svg/IconMarker.js +25 -0
- package/components/svg/IconMenu.js +25 -0
- package/components/svg/IconMenuHorizontal.js +25 -0
- package/components/svg/IconModule.js +25 -0
- package/components/svg/IconMyLocation.js +25 -0
- package/components/svg/IconNote.js +27 -0
- package/components/svg/IconNursery.js +27 -0
- package/components/svg/IconOrg.js +25 -0
- package/components/svg/IconParchment.js +25 -0
- package/components/svg/IconPhoto.js +25 -0
- package/components/svg/IconRedo.js +25 -0
- package/components/svg/IconRestorationSite.js +25 -0
- package/components/svg/IconSeedBank.js +25 -0
- package/components/svg/IconSeedling.js +25 -0
- package/components/svg/IconSettings.js +25 -0
- package/components/svg/IconSlice.js +25 -0
- package/components/svg/IconSubmit.js +25 -0
- package/components/svg/IconSubtract.js +27 -0
- package/components/svg/IconSynced.js +25 -0
- package/components/svg/IconTrashCan.js +25 -0
- package/components/svg/IconTreasureMap.js +25 -0
- package/components/svg/IconUndo.js +25 -0
- package/components/svg/IconVariable.js +25 -0
- package/components/svg/IconWifi.js +25 -0
- package/components/svg/Info.js +25 -0
- package/components/svg/Key.js +25 -0
- package/components/svg/Leaf.js +25 -0
- package/components/svg/Lock.js +25 -0
- package/components/svg/Logo.js +43 -0
- package/components/svg/MenuVertical.js +25 -0
- package/components/svg/Notification.js +25 -0
- package/components/svg/Person.js +25 -0
- package/components/svg/Plus.js +25 -0
- package/components/svg/RestorationSite.js +25 -0
- package/components/svg/Search.js +25 -0
- package/components/svg/Seeds.js +25 -0
- package/components/svg/Site.js +25 -0
- package/components/svg/Sparkles.js +25 -0
- package/components/svg/Species.js +25 -0
- package/components/svg/Species2.js +156 -0
- package/components/svg/Spinner.js +52 -0
- package/components/svg/Success.js +25 -0
- package/components/svg/SuccessFilled.js +25 -0
- package/components/svg/TerrawareLogoDesktop.js +49 -0
- package/components/svg/TerrawareLogoMobile.js +30 -0
- package/components/svg/Touchscreen.js +25 -0
- package/components/svg/UploadCloud.js +156 -0
- package/components/svg/Warning.js +25 -0
- package/components/svg/WelcomeClipboard.js +133 -0
- package/components/svg/index.js +832 -0
- package/components/table/EnhancedTableToolbar.js +76 -0
- package/components/table/EnhancedTableToolbarV2.js +49 -0
- package/components/table/TableCellRenderer.js +244 -0
- package/components/table/TableHeader.js +75 -0
- package/components/table/TableHeaderItem.js +100 -0
- package/components/table/density.js +28 -0
- package/components/table/index.js +346 -0
- package/components/table/sort.js +72 -0
- package/components/table/sort.test.js +37 -0
- package/components/table/types.js +5 -0
- package/components/types/index.js +5 -0
- package/fonts/Inter.ttf +0 -0
- package/index.css +11 -0
- package/index.js +377 -0
- package/package.json +2 -5
- package/setupTests.js +5 -0
- package/style-dictionary-dist/TerrawareTheme.js +193 -0
- package/style-dictionary-dist/terraware.scss +414 -0
- package/theme.js +86 -0
- package/utils/date.js +124 -0
- package/utils/date.test.js +87 -0
- package/utils/index.js +53 -0
- package/utils/preventDefaultEvent.js +8 -0
- package/utils/text.js +17 -0
- package/utils/text.test.js +23 -0
- package/utils/useDeviceInfo.js +85 -0
- package/index.cjs.js +0 -88606
- package/index.cjs.js.map +0 -1
- package/index.esm.js +0 -88533
- package/index.esm.js.map +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = DatePicker;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _xDatePickers = require("@mui/x-date-pickers");
|
|
12
|
+
var _AdapterLuxon = require("@mui/x-date-pickers/AdapterLuxon");
|
|
13
|
+
var _luxon = require("luxon");
|
|
14
|
+
var _date = require("../../utils/date");
|
|
15
|
+
var _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
|
16
|
+
require("./styles.scss");
|
|
17
|
+
/**
|
|
18
|
+
* TODO: remove support for JS Date in DatePickerDateType once
|
|
19
|
+
* clients have moved to only using DateTime objects in input props
|
|
20
|
+
* and callback arguments.
|
|
21
|
+
* export type DatePickerDateType = Exclude<DateType, Date> | null;
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const initializeDate = (value, timeZoneId) => {
|
|
25
|
+
if (!value) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const date = (0, _date.getDate)(value, timeZoneId);
|
|
29
|
+
return date !== null && date !== void 0 && date.isValid ? date : null;
|
|
30
|
+
};
|
|
31
|
+
function DatePicker(props) {
|
|
32
|
+
var _props$locale;
|
|
33
|
+
const [temporalValue, setTemporalValue] = (0, _react.useState)(initializeDate(props.value, props.defaultTimeZone));
|
|
34
|
+
const [minDateTime, setMinDateTime] = (0, _react.useState)(initializeDate(props.minDate, props.defaultTimeZone));
|
|
35
|
+
const [maxDateTime, setMaxDateTime] = (0, _react.useState)(initializeDate(props.maxDate, props.defaultTimeZone));
|
|
36
|
+
const locale = (_props$locale = props.locale) !== null && _props$locale !== void 0 ? _props$locale : 'en';
|
|
37
|
+
_luxon.Settings.defaultZone = (0, _date.tz)(props.defaultTimeZone);
|
|
38
|
+
_react.default.useEffect(() => {
|
|
39
|
+
setTemporalValue(prev => {
|
|
40
|
+
if (props.value !== prev && props.value) {
|
|
41
|
+
return initializeDate(props.value, props.defaultTimeZone);
|
|
42
|
+
} else {
|
|
43
|
+
return prev;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}, [props.defaultTimeZone, props.value]);
|
|
47
|
+
_react.default.useEffect(() => {
|
|
48
|
+
setMinDateTime(initializeDate(props.minDate, props.defaultTimeZone));
|
|
49
|
+
}, [props.defaultTimeZone, props.minDate]);
|
|
50
|
+
_react.default.useEffect(() => {
|
|
51
|
+
setMaxDateTime(initializeDate(props.maxDate, props.defaultTimeZone));
|
|
52
|
+
}, [props.defaultTimeZone, props.maxDate]);
|
|
53
|
+
|
|
54
|
+
// TODO: Localize the yyyy-mm-dd placeholder string that is shown to users when the input is
|
|
55
|
+
// empty. It appears to be generated programmatically deep in the guts of the MUI DatePicker
|
|
56
|
+
// code, and it most likely uses the browser's locale.
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
58
|
+
className: "date-picker ".concat(props.className, " ").concat(props.errorText ? 'date-picker--error' : ''),
|
|
59
|
+
sx: props.sx
|
|
60
|
+
}, /*#__PURE__*/_react.default.createElement(_xDatePickers.LocalizationProvider, {
|
|
61
|
+
dateAdapter: _AdapterLuxon.AdapterLuxon,
|
|
62
|
+
adapterLocale: locale
|
|
63
|
+
}, props.label && /*#__PURE__*/_react.default.createElement("label", {
|
|
64
|
+
htmlFor: props.id,
|
|
65
|
+
className: "textfield-label"
|
|
66
|
+
}, props.label), props.showTime ? /*#__PURE__*/_react.default.createElement(_xDatePickers.DesktopDateTimePicker, {
|
|
67
|
+
disabled: props.disabled,
|
|
68
|
+
minDate: minDateTime && minDateTime.isValid ? minDateTime : undefined,
|
|
69
|
+
maxDate: maxDateTime && maxDateTime.isValid ? maxDateTime : undefined,
|
|
70
|
+
onChange: newValue => {
|
|
71
|
+
setTemporalValue(newValue);
|
|
72
|
+
// TODO: remove onChange and make onDateChange required
|
|
73
|
+
if (props.onChange) {
|
|
74
|
+
props.onChange(newValue && newValue.isValid ? newValue.toJSDate() : null);
|
|
75
|
+
}
|
|
76
|
+
if (props.onDateChange) {
|
|
77
|
+
props.onDateChange(newValue && newValue.isValid ? newValue : undefined);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
onError: props.onError,
|
|
81
|
+
slotProps: {
|
|
82
|
+
textField: {
|
|
83
|
+
sx: {
|
|
84
|
+
'& fieldset': {
|
|
85
|
+
border: 'none'
|
|
86
|
+
},
|
|
87
|
+
'& .MuiFormHelperText-root': {
|
|
88
|
+
marginLeft: 0
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
helperText: props.errorText ? /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
+
className: "textfield-error-text-container"
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
94
|
+
name: "error",
|
|
95
|
+
className: "textfield-error-text--icon"
|
|
96
|
+
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
97
|
+
htmlFor: props.id,
|
|
98
|
+
className: "textfield-error-text"
|
|
99
|
+
}, props.errorText)) : props.helperText,
|
|
100
|
+
id: props.id,
|
|
101
|
+
placeholder: props.placeholder,
|
|
102
|
+
autoFocus: props.autoFocus,
|
|
103
|
+
onKeyPress: props.onKeyPress
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
value: temporalValue
|
|
107
|
+
}) : /*#__PURE__*/_react.default.createElement(_xDatePickers.DesktopDatePicker, {
|
|
108
|
+
disabled: props.disabled,
|
|
109
|
+
format: "yyyy-MM-dd",
|
|
110
|
+
minDate: minDateTime && minDateTime.isValid ? minDateTime : undefined,
|
|
111
|
+
maxDate: maxDateTime && maxDateTime.isValid ? maxDateTime : undefined,
|
|
112
|
+
onChange: newValue => {
|
|
113
|
+
setTemporalValue(newValue);
|
|
114
|
+
// TODO: remove onChange and make onDateChange required
|
|
115
|
+
if (props.onChange) {
|
|
116
|
+
props.onChange(newValue && newValue.isValid ? newValue.toJSDate() : null);
|
|
117
|
+
}
|
|
118
|
+
if (props.onDateChange) {
|
|
119
|
+
props.onDateChange(newValue && newValue.isValid ? newValue : undefined);
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
onError: props.onError,
|
|
123
|
+
slotProps: {
|
|
124
|
+
textField: {
|
|
125
|
+
sx: {
|
|
126
|
+
'& fieldset': {
|
|
127
|
+
border: 'none'
|
|
128
|
+
},
|
|
129
|
+
'& .MuiFormHelperText-root': {
|
|
130
|
+
marginLeft: 0
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
helperText: props.errorText ? /*#__PURE__*/_react.default.createElement("div", {
|
|
134
|
+
className: "textfield-error-text-container"
|
|
135
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
136
|
+
name: "error",
|
|
137
|
+
className: "textfield-error-text--icon"
|
|
138
|
+
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
139
|
+
htmlFor: props.id,
|
|
140
|
+
className: "textfield-error-text"
|
|
141
|
+
}, props.errorText)) : props.helperText,
|
|
142
|
+
id: props.id,
|
|
143
|
+
placeholder: props.placeholder,
|
|
144
|
+
autoFocus: props.autoFocus,
|
|
145
|
+
onKeyPress: props.onKeyPress
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
value: temporalValue
|
|
149
|
+
})));
|
|
150
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@import '../../style-dictionary-dist/terraware.scss';
|
|
2
|
+
|
|
3
|
+
@font-face {
|
|
4
|
+
font-family: 'Inter';
|
|
5
|
+
src: local('Inter'), url(../../fonts/Inter.ttf) format('truetype');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.date-picker {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-flow: column wrap;
|
|
11
|
+
|
|
12
|
+
.textfield-label {
|
|
13
|
+
font-family: $tw-fnt-frm-fld-label-font-family;
|
|
14
|
+
font-size: $tw-fnt-frm-fld-label-font-size;
|
|
15
|
+
font-weight: $tw-fnt-frm-fld-label-font-weight;
|
|
16
|
+
line-height: $tw-fnt-frm-fld-label-line-height;
|
|
17
|
+
color: $tw-clr-txt-secondary;
|
|
18
|
+
margin-bottom: $tw-spc-base-xx-small;
|
|
19
|
+
display: block;
|
|
20
|
+
width: 100%;
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.textfield-error-text-container {
|
|
25
|
+
display: flex;
|
|
26
|
+
margin-top: $tw-spc-base-x-small;
|
|
27
|
+
|
|
28
|
+
.textfield-error-text {
|
|
29
|
+
font-family: $tw-fnt-frm-fld-error-text-font-family;
|
|
30
|
+
font-size: $tw-fnt-frm-fld-error-text-font-size;
|
|
31
|
+
font-weight: $tw-fnt-frm-fld-error-text-font-weight;
|
|
32
|
+
line-height: $tw-fnt-frm-fld-error-text-line-height;
|
|
33
|
+
color: $tw-clr-txt-danger;
|
|
34
|
+
width: 100%;
|
|
35
|
+
max-width: 100%;
|
|
36
|
+
|
|
37
|
+
&--icon {
|
|
38
|
+
fill: $tw-clr-txt-danger;
|
|
39
|
+
width: $tw-fnt-frm-fld-error-text-line-height;
|
|
40
|
+
height: $tw-fnt-frm-fld-error-text-line-height;
|
|
41
|
+
margin-right: $tw-spc-base-x-small;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.MuiInputBase-root {
|
|
47
|
+
border: 1px solid $tw-clr-bg-info;
|
|
48
|
+
border-radius: $tw-sz-base-x-small;
|
|
49
|
+
position: unset;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.MuiInputBase-input {
|
|
53
|
+
height: 18px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.MuiIconButton-root {
|
|
57
|
+
color: $tw-clr-icn-secondary;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
input {
|
|
61
|
+
padding: calc(#{$tw-spc-base-xx-small} * 2.5) calc(#{$tw-spc-base-xx-small} * 3);
|
|
62
|
+
background-color: $tw-clr-base-white;
|
|
63
|
+
border-radius: $tw-sz-base-x-small 0 0 $tw-sz-base-x-small;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.MuiOutlinedInput-root {
|
|
67
|
+
border-color: $tw-clr-brdr-secondary;
|
|
68
|
+
|
|
69
|
+
&:hover {
|
|
70
|
+
border-color: $tw-clr-brdr-hover;
|
|
71
|
+
}
|
|
72
|
+
&.Mui-focused {
|
|
73
|
+
border-color: $tw-clr-brdr-hover;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&--error {
|
|
78
|
+
.MuiInputBase-root {
|
|
79
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-danger;
|
|
80
|
+
background-color: $tw-clr-bg-danger-tertiary;
|
|
81
|
+
|
|
82
|
+
&:hover {
|
|
83
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-danger;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:active {
|
|
87
|
+
border: $tw-sz-frm-fld-text-input-stroke-active solid $tw-clr-brdr-danger;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
input {
|
|
92
|
+
background-color: $tw-clr-bg-danger-tertiary;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
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 = DialogBox;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _utils = require("../../utils");
|
|
11
|
+
var _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
|
12
|
+
require("./styles.scss");
|
|
13
|
+
function DialogBox(props) {
|
|
14
|
+
const {
|
|
15
|
+
title,
|
|
16
|
+
size,
|
|
17
|
+
message,
|
|
18
|
+
children,
|
|
19
|
+
leftButton,
|
|
20
|
+
rightButtons,
|
|
21
|
+
middleButtons,
|
|
22
|
+
onClose,
|
|
23
|
+
open,
|
|
24
|
+
scrolled,
|
|
25
|
+
skrim,
|
|
26
|
+
style
|
|
27
|
+
} = props;
|
|
28
|
+
const hasFooter = leftButton || rightButtons || middleButtons;
|
|
29
|
+
const {
|
|
30
|
+
isMobile
|
|
31
|
+
} = (0, _utils.useDeviceInfo)();
|
|
32
|
+
return open ? /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
+
className: "dialog-box-container".concat(skrim ? '--skrim' : '', " ").concat(open ? 'dialog-box--opened' : 'dialog-box--closed', " ").concat(isMobile ? 'mobile' : ''),
|
|
34
|
+
onClick: event => {
|
|
35
|
+
if (event.target instanceof HTMLElement && event.target.classList.contains('dialog-box--opened')) {
|
|
36
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
style: style
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
41
|
+
className: "dialog-box dialog-box--".concat(size)
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: "dialog-box--header"
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
className: "close-icon-spacer"
|
|
46
|
+
}), /*#__PURE__*/_react.default.createElement("p", {
|
|
47
|
+
className: "title"
|
|
48
|
+
}, title), /*#__PURE__*/_react.default.createElement(_material.IconButton, {
|
|
49
|
+
onClick: onClose,
|
|
50
|
+
size: "small"
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
52
|
+
name: "close",
|
|
53
|
+
className: "icon-close"
|
|
54
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
className: (hasFooter ? 'dialog-box--body' : 'dialog-box--body-no-footer') + (scrolled ? ' scrolled' : '')
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
57
|
+
className: "dialog-box--message"
|
|
58
|
+
}, message), /*#__PURE__*/_react.default.createElement("div", {
|
|
59
|
+
className: "dialog-box--boundary"
|
|
60
|
+
}, children)), hasFooter && /*#__PURE__*/_react.default.createElement("div", {
|
|
61
|
+
className: "dialog-box--footer"
|
|
62
|
+
}, leftButton && /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
+
className: "dialog-box--footer-container"
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
+
className: "left-button"
|
|
66
|
+
}, leftButton), /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
className: "right-buttons"
|
|
68
|
+
}, rightButtons === null || rightButtons === void 0 ? void 0 : rightButtons.map((rb, index) => {
|
|
69
|
+
const rbWithKey = {
|
|
70
|
+
...rb,
|
|
71
|
+
key: "rb-".concat(index),
|
|
72
|
+
props: {
|
|
73
|
+
...rb.props,
|
|
74
|
+
size: rb.props.size || 'medium'
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return rbWithKey;
|
|
78
|
+
}))), middleButtons && /*#__PURE__*/_react.default.createElement("div", {
|
|
79
|
+
className: "dialog-box--actions-container"
|
|
80
|
+
}, middleButtons === null || middleButtons === void 0 ? void 0 : middleButtons.map((mb, index) => {
|
|
81
|
+
const mbWithKey = {
|
|
82
|
+
...mb,
|
|
83
|
+
key: "mb-".concat(index),
|
|
84
|
+
props: {
|
|
85
|
+
...mb.props,
|
|
86
|
+
size: mb.props.size || 'medium'
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return mbWithKey;
|
|
90
|
+
}))))) : null;
|
|
91
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
@import '../../style-dictionary-dist/terraware.scss';
|
|
2
|
+
|
|
3
|
+
@font-face {
|
|
4
|
+
font-family: 'Inter';
|
|
5
|
+
src: local('Inter'), url(../../fonts/Inter.ttf) format('truetype');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dialog-box-container {
|
|
9
|
+
height: 100%;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
position: fixed;
|
|
14
|
+
z-index: 1300;
|
|
15
|
+
inset: 0px;
|
|
16
|
+
|
|
17
|
+
&--skrim {
|
|
18
|
+
background-color: rgba($tw-clr-base-gray-025, $tw-opcty-base-060);
|
|
19
|
+
background-image: linear-gradient(
|
|
20
|
+
180deg,
|
|
21
|
+
rgba($tw-clr-base-green-050, $tw-opcty-base-000),
|
|
22
|
+
rgba($tw-clr-base-green-050, 0.24)
|
|
23
|
+
);
|
|
24
|
+
height: 100%;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
position: fixed;
|
|
29
|
+
z-index: 1300;
|
|
30
|
+
inset: 0px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.mobile {
|
|
34
|
+
margin: 0 $tw-spc-base-small;
|
|
35
|
+
.dialog-box {
|
|
36
|
+
&--footer {
|
|
37
|
+
button {
|
|
38
|
+
margin: 0 0 $tw-spc-base-x-small 0;
|
|
39
|
+
}
|
|
40
|
+
&-container {
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
.left-button,
|
|
43
|
+
.right-buttons {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
&--actions-container {
|
|
50
|
+
flex-direction: column-reverse;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dialog-box {
|
|
57
|
+
box-shadow: $tw-elvtn-base-800;
|
|
58
|
+
border-radius: $tw-sz-base-small;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
background: $tw-clr-base-white;
|
|
62
|
+
max-height: calc(100vh - 128px); //64 from top and bottom
|
|
63
|
+
max-width: calc(100vw - 32px);
|
|
64
|
+
margin-top: auto;
|
|
65
|
+
margin-bottom: auto;
|
|
66
|
+
|
|
67
|
+
&--closed {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&--small {
|
|
72
|
+
width: 320px;
|
|
73
|
+
}
|
|
74
|
+
&--medium {
|
|
75
|
+
width: 480px;
|
|
76
|
+
}
|
|
77
|
+
&--large {
|
|
78
|
+
width: 640px;
|
|
79
|
+
}
|
|
80
|
+
&--x-large {
|
|
81
|
+
width: 800px;
|
|
82
|
+
}
|
|
83
|
+
&--xx-large {
|
|
84
|
+
width: 1080px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&--header {
|
|
88
|
+
border-bottom: 1px solid $tw-clr-brdr-tertiary;
|
|
89
|
+
padding: $tw-spc-base-small $tw-spc-base-medium;
|
|
90
|
+
display: flex;
|
|
91
|
+
justify-content: space-between;
|
|
92
|
+
align-items: center;
|
|
93
|
+
border-radius: $tw-sz-base-small $tw-sz-base-small 0 0;
|
|
94
|
+
.title {
|
|
95
|
+
font-family: $tw-fnt-dlg-bx-title-font-family;
|
|
96
|
+
font-size: $tw-fnt-dlg-bx-title-font-size;
|
|
97
|
+
font-weight: $tw-fnt-dlg-bx-title-font-weight;
|
|
98
|
+
line-height: $tw-fnt-dlg-bx-title-line-height;
|
|
99
|
+
color: $tw-clr-txt;
|
|
100
|
+
text-align: center;
|
|
101
|
+
margin: 0;
|
|
102
|
+
width: 100%;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.icon-close {
|
|
106
|
+
fill: $tw-clr-icn-secondary;
|
|
107
|
+
height: $tw-sz-base-medium;
|
|
108
|
+
width: $tw-sz-base-medium;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.MuiButtonBase-root {
|
|
112
|
+
padding: $tw-spc-base-xx-small;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.close-icon-spacer {
|
|
116
|
+
height: calc(#{$tw-sz-base-medium} + 2 *#{$tw-spc-base-xx-small});
|
|
117
|
+
width: calc(#{$tw-sz-base-medium} + 2 *#{$tw-spc-base-xx-small});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&--body {
|
|
122
|
+
background: $tw-clr-base-white;
|
|
123
|
+
padding: $tw-spc-base-medium;
|
|
124
|
+
text-align: center;
|
|
125
|
+
&.scrolled {
|
|
126
|
+
overflow: auto;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&--body-no-footer {
|
|
131
|
+
padding: $tw-spc-base-medium;
|
|
132
|
+
&.scrolled {
|
|
133
|
+
overflow: auto;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&--message {
|
|
138
|
+
font-family: $tw-fnt-dlg-bx-message-font-family;
|
|
139
|
+
font-size: $tw-fnt-dlg-bx-message-font-size;
|
|
140
|
+
font-weight: $tw-fnt-dlg-bx-message-font-weight;
|
|
141
|
+
line-height: $tw-fnt-dlg-bx-message-line-height;
|
|
142
|
+
color: $tw-clr-txt;
|
|
143
|
+
width: 100%;
|
|
144
|
+
text-align: center;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&--footer {
|
|
148
|
+
border-radius: 0 0 $tw-sz-base-small $tw-sz-base-small;
|
|
149
|
+
background-color: $tw-clr-bg-secondary;
|
|
150
|
+
padding: $tw-spc-base-medium $tw-spc-base-medium;
|
|
151
|
+
button + button {
|
|
152
|
+
margin-left: $tw-spc-base-x-small;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&--footer-container {
|
|
157
|
+
display: flex;
|
|
158
|
+
justify-content: space-between;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&--actions-container {
|
|
162
|
+
display: flex;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 = Divisor;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
function Divisor(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
mt = 3
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
15
|
+
mt: mt
|
|
16
|
+
}), /*#__PURE__*/_react.default.createElement(_material.Divider, {
|
|
17
|
+
light: true
|
|
18
|
+
}), /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
19
|
+
mt: mt
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DropdownV1 = DropdownV1;
|
|
8
|
+
exports.default = Dropdown;
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _Autocomplete = _interopRequireDefault(require("./Autocomplete/Autocomplete"));
|
|
12
|
+
var _SelectT = _interopRequireDefault(require("./Select/SelectT"));
|
|
13
|
+
function DropdownV1(_ref) {
|
|
14
|
+
let {
|
|
15
|
+
id,
|
|
16
|
+
label,
|
|
17
|
+
values,
|
|
18
|
+
onChange,
|
|
19
|
+
selected,
|
|
20
|
+
disabled
|
|
21
|
+
} = _ref;
|
|
22
|
+
const onChangeH = event => {
|
|
23
|
+
onChange(event.target.value);
|
|
24
|
+
};
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_material.FormControl, {
|
|
26
|
+
variant: "outlined",
|
|
27
|
+
size: "small",
|
|
28
|
+
disabled: disabled,
|
|
29
|
+
sx: {
|
|
30
|
+
width: '100%'
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_material.InputLabel, {
|
|
33
|
+
id: "".concat(id, "-outlined-label")
|
|
34
|
+
}, label), /*#__PURE__*/_react.default.createElement(_material.Select, {
|
|
35
|
+
labelId: "".concat(id, "-outlined-label"),
|
|
36
|
+
id: id,
|
|
37
|
+
label: label,
|
|
38
|
+
onChange: onChangeH,
|
|
39
|
+
value: selected
|
|
40
|
+
}, values === null || values === void 0 ? void 0 : values.map(_ref2 => {
|
|
41
|
+
let {
|
|
42
|
+
label: inLabel,
|
|
43
|
+
value
|
|
44
|
+
} = _ref2;
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
46
|
+
id: value,
|
|
47
|
+
key: value,
|
|
48
|
+
value: value
|
|
49
|
+
}, inLabel);
|
|
50
|
+
})));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* This is a simple dropdown that takes in a tuple { label, value }
|
|
54
|
+
* for list of options.
|
|
55
|
+
* The label is used for display, the value is passed back in onChange, and used to set selectedValue.
|
|
56
|
+
*
|
|
57
|
+
* Example:
|
|
58
|
+
* <Dropdown
|
|
59
|
+
* options=[{ label: 'label', value: 'value'}, { label: 'label1': value: 'value1'} ]
|
|
60
|
+
* onChange={(value: string) => setSomeValue(value)}
|
|
61
|
+
* selectedValue={'value1'}
|
|
62
|
+
* />
|
|
63
|
+
*/
|
|
64
|
+
function Dropdown(props) {
|
|
65
|
+
const {
|
|
66
|
+
selectedValue,
|
|
67
|
+
onChange,
|
|
68
|
+
options,
|
|
69
|
+
autocomplete,
|
|
70
|
+
...remainingProps
|
|
71
|
+
} = props;
|
|
72
|
+
const selectedItem = options === null || options === void 0 ? void 0 : options.find(option => option.value === selectedValue);
|
|
73
|
+
const renderOption = option => {
|
|
74
|
+
const styles = {
|
|
75
|
+
fontWeight: option.fontWeight || 'normal',
|
|
76
|
+
fontStyle: option.fontStyle || 'normal'
|
|
77
|
+
};
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
79
|
+
style: styles
|
|
80
|
+
}, option.label);
|
|
81
|
+
};
|
|
82
|
+
if (autocomplete) {
|
|
83
|
+
return /*#__PURE__*/_react.default.createElement(_Autocomplete.default, Object.assign({}, remainingProps, {
|
|
84
|
+
options: options !== null && options !== void 0 ? options : [],
|
|
85
|
+
selected: selectedItem || '',
|
|
86
|
+
isEqual: (A, B) => A.value === B.value,
|
|
87
|
+
onChange: option => onChange(option.value)
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement(_SelectT.default, Object.assign({}, remainingProps, {
|
|
91
|
+
options: options,
|
|
92
|
+
selectedValue: selectedItem,
|
|
93
|
+
isEqual: (A, B) => A.value === B.value,
|
|
94
|
+
renderOption: renderOption,
|
|
95
|
+
toT: str => ({
|
|
96
|
+
label: str,
|
|
97
|
+
value: str
|
|
98
|
+
}),
|
|
99
|
+
displayLabel: option => (option === null || option === void 0 ? void 0 : option.label) || '',
|
|
100
|
+
onChange: option => onChange(option.value)
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 = ErrorBox;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _useDeviceInfo = _interopRequireDefault(require("../../utils/useDeviceInfo"));
|
|
11
|
+
var _Button = _interopRequireDefault(require("../Button/Button"));
|
|
12
|
+
var _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
|
13
|
+
require("./styles.scss");
|
|
14
|
+
function ErrorBox(props) {
|
|
15
|
+
const {
|
|
16
|
+
text,
|
|
17
|
+
onClick,
|
|
18
|
+
buttonText,
|
|
19
|
+
title,
|
|
20
|
+
className,
|
|
21
|
+
sx
|
|
22
|
+
} = props;
|
|
23
|
+
const {
|
|
24
|
+
isMobile
|
|
25
|
+
} = (0, _useDeviceInfo.default)();
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
27
|
+
className: "error-box ".concat(className, " ").concat(isMobile ? 'mobile' : ''),
|
|
28
|
+
sx: sx
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
+
className: "error-box--container"
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
32
|
+
name: "error",
|
|
33
|
+
className: "error-icon",
|
|
34
|
+
size: "large"
|
|
35
|
+
}), /*#__PURE__*/_react.default.createElement("div", null, title && /*#__PURE__*/_react.default.createElement("h1", {
|
|
36
|
+
className: "error-title"
|
|
37
|
+
}, title), /*#__PURE__*/_react.default.createElement("p", {
|
|
38
|
+
className: "error-text"
|
|
39
|
+
}, text))), buttonText && onClick && /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: "button-container"
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
42
|
+
label: buttonText,
|
|
43
|
+
priority: "secondary",
|
|
44
|
+
type: "passive",
|
|
45
|
+
onClick: onClick
|
|
46
|
+
})));
|
|
47
|
+
}
|