@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,27 @@
|
|
|
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 = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
require("./styles.scss");
|
|
11
|
+
const AntSwitch = props => {
|
|
12
|
+
const {
|
|
13
|
+
checked,
|
|
14
|
+
disabled,
|
|
15
|
+
onChange
|
|
16
|
+
} = props;
|
|
17
|
+
const onChangeHandler = (0, _react.useCallback)((event, value) => {
|
|
18
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
19
|
+
}, [onChange]);
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_material.Switch, {
|
|
21
|
+
className: "ant-switch",
|
|
22
|
+
checked: checked,
|
|
23
|
+
disabled: disabled,
|
|
24
|
+
onChange: onChangeHandler
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var _default = exports.default = AntSwitch;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
@import '../../style-dictionary-dist/terraware.scss';
|
|
2
|
+
|
|
3
|
+
.ant-switch {
|
|
4
|
+
width: 28px;
|
|
5
|
+
height: 16px;
|
|
6
|
+
padding: 0;
|
|
7
|
+
display: flex;
|
|
8
|
+
|
|
9
|
+
.MuiSwitch-switchBase {
|
|
10
|
+
padding: 2px;
|
|
11
|
+
|
|
12
|
+
&.Mui-checked {
|
|
13
|
+
transform: translateX(12px);
|
|
14
|
+
color: #fff;
|
|
15
|
+
|
|
16
|
+
+ .MuiSwitch-track {
|
|
17
|
+
opacity: 1;
|
|
18
|
+
background-color: #1890ff;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Add dark mode override using a body class or custom data attribute
|
|
22
|
+
body.dark & + .MuiSwitch-track {
|
|
23
|
+
background-color: #177ddc;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.MuiSwitch-thumb {
|
|
29
|
+
box-shadow: 0 2px 4px 0 rgba(0, 35, 11, 0.2);
|
|
30
|
+
width: 12px;
|
|
31
|
+
height: 12px;
|
|
32
|
+
border-radius: 6px;
|
|
33
|
+
transition: width 200ms;
|
|
34
|
+
|
|
35
|
+
// Width change on active
|
|
36
|
+
.ant-switch:active & {
|
|
37
|
+
width: 15px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ant-switch:active .MuiSwitch-switchBase.Mui-checked {
|
|
41
|
+
transform: translateX(9px);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.MuiSwitch-track {
|
|
46
|
+
border-radius: 8px;
|
|
47
|
+
opacity: 1;
|
|
48
|
+
background-color: rgba(0, 0, 0, 0.25);
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
|
|
51
|
+
// Dark mode override
|
|
52
|
+
body.dark & {
|
|
53
|
+
background-color: rgba(255, 255, 255, 0.35);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.Mui-disabled {
|
|
58
|
+
opacity: $tw-opcty-semantic-off;
|
|
59
|
+
|
|
60
|
+
&.Mui-checked {
|
|
61
|
+
+ .MuiSwitch-track {
|
|
62
|
+
opacity: $tw-opcty-semantic-off;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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 = Autocomplete;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
|
11
|
+
var _IconTooltip = _interopRequireDefault(require("../IconTooltip"));
|
|
12
|
+
require("../Select/styles.scss");
|
|
13
|
+
require("./styles.scss");
|
|
14
|
+
const isEmpty = value => ['', undefined].includes(value);
|
|
15
|
+
function Autocomplete(_ref) {
|
|
16
|
+
let {
|
|
17
|
+
id,
|
|
18
|
+
label,
|
|
19
|
+
options,
|
|
20
|
+
onChange,
|
|
21
|
+
selected,
|
|
22
|
+
filterOptions,
|
|
23
|
+
freeSolo,
|
|
24
|
+
disabled,
|
|
25
|
+
className,
|
|
26
|
+
hideClearIcon,
|
|
27
|
+
isEqual,
|
|
28
|
+
placeholder,
|
|
29
|
+
errorText,
|
|
30
|
+
tooltipTitle,
|
|
31
|
+
required,
|
|
32
|
+
noOptionsText,
|
|
33
|
+
loading,
|
|
34
|
+
loadingText,
|
|
35
|
+
open,
|
|
36
|
+
onOpen,
|
|
37
|
+
onClose,
|
|
38
|
+
sx,
|
|
39
|
+
renderOption
|
|
40
|
+
} = _ref;
|
|
41
|
+
const onChangeHandler = (event, value) => {
|
|
42
|
+
if (event) {
|
|
43
|
+
if (value) {
|
|
44
|
+
onChange(value);
|
|
45
|
+
} else {
|
|
46
|
+
onChange('');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const renderInput = params => /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
51
|
+
className: "auto-complete ".concat(className),
|
|
52
|
+
sx: sx
|
|
53
|
+
}, label && /*#__PURE__*/_react.default.createElement("label", {
|
|
54
|
+
htmlFor: id,
|
|
55
|
+
className: "textfield-label"
|
|
56
|
+
}, label, " ", required ? '*' : '', tooltipTitle && /*#__PURE__*/_react.default.createElement(_IconTooltip.default, {
|
|
57
|
+
placement: "top",
|
|
58
|
+
title: tooltipTitle
|
|
59
|
+
})), /*#__PURE__*/_react.default.createElement(_material.TextField, Object.assign({}, params, {
|
|
60
|
+
variant: "outlined",
|
|
61
|
+
size: "small",
|
|
62
|
+
placeholder: placeholder,
|
|
63
|
+
className: errorText ? 'auto-complete--error' : ''
|
|
64
|
+
})), errorText && /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
+
className: "textfield-label-container"
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
67
|
+
name: "error",
|
|
68
|
+
className: "textfield-error-text--icon"
|
|
69
|
+
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
70
|
+
htmlFor: id,
|
|
71
|
+
className: "textfield-error-text"
|
|
72
|
+
}, errorText)));
|
|
73
|
+
const optionalArgs = {};
|
|
74
|
+
if (hideClearIcon) {
|
|
75
|
+
optionalArgs.clearIcon = null;
|
|
76
|
+
}
|
|
77
|
+
if (isEqual) {
|
|
78
|
+
optionalArgs.isOptionEqualToValue = isEqual;
|
|
79
|
+
} else {
|
|
80
|
+
optionalArgs.isOptionEqualToValue = (option, value) => option === value || isEmpty(option) && isEmpty(value);
|
|
81
|
+
}
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement(_material.Autocomplete, Object.assign({
|
|
83
|
+
disabled: disabled,
|
|
84
|
+
id: id,
|
|
85
|
+
options: options,
|
|
86
|
+
getOptionLabel: option => {
|
|
87
|
+
if (typeof option === 'object') {
|
|
88
|
+
var _option$label;
|
|
89
|
+
return (_option$label = option.label) !== null && _option$label !== void 0 ? _option$label : '';
|
|
90
|
+
}
|
|
91
|
+
return option !== null && option !== void 0 ? option : '';
|
|
92
|
+
},
|
|
93
|
+
onChange: onChangeHandler,
|
|
94
|
+
onInputChange: (event, value) => freeSolo && onChangeHandler(event, value),
|
|
95
|
+
value: selected,
|
|
96
|
+
filterOptions: filterOptions,
|
|
97
|
+
freeSolo: freeSolo,
|
|
98
|
+
forcePopupIcon: true,
|
|
99
|
+
renderInput: renderInput,
|
|
100
|
+
"aria-required": required,
|
|
101
|
+
noOptionsText: noOptionsText,
|
|
102
|
+
loading: loading,
|
|
103
|
+
loadingText: loadingText,
|
|
104
|
+
open: open,
|
|
105
|
+
onOpen: onOpen,
|
|
106
|
+
onClose: onClose,
|
|
107
|
+
popupIcon: /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
108
|
+
name: loading ? 'spinner' : open ? 'chevronUp' : 'chevronDown',
|
|
109
|
+
className: "auto-complete--icon-right",
|
|
110
|
+
size: "medium"
|
|
111
|
+
}),
|
|
112
|
+
classes: {
|
|
113
|
+
paper: 'auto-complete select',
|
|
114
|
+
listbox: 'options-container'
|
|
115
|
+
},
|
|
116
|
+
sx: {
|
|
117
|
+
'& .MuiAutocomplete-popupIndicator:hover': {
|
|
118
|
+
background: 'transparent'
|
|
119
|
+
},
|
|
120
|
+
'& .MuiAutocomplete-popupIndicator': {
|
|
121
|
+
background: 'transparent',
|
|
122
|
+
transform: 'none'
|
|
123
|
+
},
|
|
124
|
+
'& .MuiTouchRipple-root': {
|
|
125
|
+
display: 'none'
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, optionalArgs, {
|
|
129
|
+
renderOption: renderOption
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
.auto-complete {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-flow: row 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
|
+
.MuiInputBase-root {
|
|
25
|
+
border: 1px solid $tw-clr-brdr-secondary;
|
|
26
|
+
border-radius: $tw-spc-base-x-small;
|
|
27
|
+
position: unset;
|
|
28
|
+
padding: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.Mui-disabled {
|
|
32
|
+
border-color: $tw-clr-brdr-secondary;
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
opacity: $tw-opcty-semantic-off;
|
|
35
|
+
color: $tw-clr-txt;
|
|
36
|
+
|
|
37
|
+
::placeholder {
|
|
38
|
+
color: $tw-clr-txt;
|
|
39
|
+
opacity: 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
input {
|
|
44
|
+
padding: calc(#{$tw-spc-base-xx-small} * 2.5) calc(#{$tw-spc-base-xx-small} * 3);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
& .MuiInputBase-input {
|
|
48
|
+
height: '21px';
|
|
49
|
+
}
|
|
50
|
+
& .MuiOutlinedInput-root {
|
|
51
|
+
fieldset {
|
|
52
|
+
border-color: $tw-clr-brdr-secondary;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:hover fieldset {
|
|
56
|
+
border-color: $tw-clr-brdr-hover;
|
|
57
|
+
}
|
|
58
|
+
.Mui-focused fieldset {
|
|
59
|
+
border-color: $tw-clr-brdr-hover;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&--icon-right {
|
|
64
|
+
width: $tw-fnt-frm-fld-text-value-line-height;
|
|
65
|
+
height: $tw-fnt-frm-fld-text-value-line-height;
|
|
66
|
+
fill: $tw-clr-icn;
|
|
67
|
+
margin-left: $tw-spc-base-x-small;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&.select {
|
|
71
|
+
.options-container {
|
|
72
|
+
top: 0;
|
|
73
|
+
margin-top: $tw-spc-base-x-small;
|
|
74
|
+
|
|
75
|
+
.MuiAutocomplete-option {
|
|
76
|
+
font-family: $tw-fnt-frm-fld-select-value-font-family;
|
|
77
|
+
font-size: $tw-fnt-frm-fld-select-value-font-size;
|
|
78
|
+
font-weight: $tw-fnt-frm-fld-select-value-font-weight;
|
|
79
|
+
line-height: $tw-fnt-frm-fld-select-value-line-height;
|
|
80
|
+
padding: $tw-spc-base-x-small $tw-spc-base-small;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
|
|
83
|
+
&:hover {
|
|
84
|
+
background-color: $tw-clr-bg-selected-ghost-hover;
|
|
85
|
+
color: $tw-clr-txt;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:active {
|
|
89
|
+
background-color: $tw-clr-bg-selected-ghost-active;
|
|
90
|
+
color: $tw-clr-txt;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&[aria-selected='true'],
|
|
94
|
+
&[aria-selected='true']:hover {
|
|
95
|
+
background-color: $tw-clr-bg-selected;
|
|
96
|
+
color: $tw-clr-txt-on-selected;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:disabled {
|
|
100
|
+
opacity: $tw-opcty-semantic-off;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.textfield-label-container {
|
|
107
|
+
display: flex;
|
|
108
|
+
width: 100%;
|
|
109
|
+
margin-top: $tw-spc-base-xx-small;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.textfield-error-text {
|
|
113
|
+
font-family: $tw-fnt-frm-fld-error-text-font-family;
|
|
114
|
+
font-size: $tw-fnt-frm-fld-error-text-font-size;
|
|
115
|
+
font-weight: $tw-fnt-frm-fld-error-text-font-weight;
|
|
116
|
+
line-height: $tw-fnt-frm-fld-error-text-line-height;
|
|
117
|
+
color: $tw-clr-txt-danger;
|
|
118
|
+
display: block;
|
|
119
|
+
width: 100%;
|
|
120
|
+
max-width: 100%;
|
|
121
|
+
|
|
122
|
+
&--icon {
|
|
123
|
+
fill: $tw-clr-icn-danger;
|
|
124
|
+
width: $tw-fnt-frm-fld-error-text-line-height;
|
|
125
|
+
height: $tw-fnt-frm-fld-error-text-line-height;
|
|
126
|
+
margin-right: $tw-spc-base-x-small;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&--error {
|
|
131
|
+
fieldset {
|
|
132
|
+
border: none;
|
|
133
|
+
}
|
|
134
|
+
.MuiOutlinedInput-root {
|
|
135
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-danger;
|
|
136
|
+
&:hover fieldset {
|
|
137
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-danger-hover;
|
|
138
|
+
}
|
|
139
|
+
&.Mui-focused fieldset.MuiOutlinedInput-notchedOutline {
|
|
140
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-danger-active;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
background-color: $tw-clr-bg-danger-tertiary;
|
|
144
|
+
border-radius: $tw-spc-base-x-small;
|
|
145
|
+
&:active {
|
|
146
|
+
outline: $tw-sz-frm-fld-text-input-stroke-active solid $tw-clr-brdr-danger-active;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&:focus-within,
|
|
150
|
+
&:focus-visible {
|
|
151
|
+
outline: $tw-sz-frm-fld-text-input-stroke-active solid $tw-clr-brdr-danger-active;
|
|
152
|
+
outline-offset: -$tw-sz-frm-fld-text-input-stroke;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
const Badge = props => {
|
|
11
|
+
const theme = (0, _material.useTheme)();
|
|
12
|
+
const backgroundColor = props.backgroundColor || theme.palette.TwClrBgSecondary;
|
|
13
|
+
const borderColor = props.borderColor || theme.palette.TwClrBrdrSecondary;
|
|
14
|
+
const labelColor = props.labelColor || borderColor;
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
16
|
+
component: "span",
|
|
17
|
+
sx: {
|
|
18
|
+
backgroundColor,
|
|
19
|
+
border: "1px solid ".concat(borderColor),
|
|
20
|
+
borderRadius: theme.spacing(1),
|
|
21
|
+
display: 'inline-block',
|
|
22
|
+
padding: theme.spacing(0.5, 1),
|
|
23
|
+
width: 'fit-content'
|
|
24
|
+
}
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
26
|
+
color: labelColor,
|
|
27
|
+
component: "span",
|
|
28
|
+
fontSize: "14px",
|
|
29
|
+
fontWeight: 500
|
|
30
|
+
}, props.label));
|
|
31
|
+
};
|
|
32
|
+
var _default = exports.default = Badge;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 = BusySpinner;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _hexRgb = _interopRequireDefault(require("hex-rgb"));
|
|
11
|
+
function BusySpinner(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
withSkrim,
|
|
14
|
+
noBackground
|
|
15
|
+
} = _ref;
|
|
16
|
+
const theme = (0, _material.useTheme)();
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
18
|
+
sx: {
|
|
19
|
+
position: 'fixed',
|
|
20
|
+
left: 0,
|
|
21
|
+
right: 0,
|
|
22
|
+
top: 0,
|
|
23
|
+
bottom: 0,
|
|
24
|
+
backgroundColor: withSkrim ? "".concat((0, _hexRgb.default)("".concat(theme.palette.TwClrBaseGray025), {
|
|
25
|
+
alpha: 0.6,
|
|
26
|
+
format: 'css'
|
|
27
|
+
})) : 'none',
|
|
28
|
+
zIndex: 2000,
|
|
29
|
+
backgroundImage: noBackground ? 'none' : 'linear-gradient(180deg,' + "".concat((0, _hexRgb.default)("".concat(theme.palette.TwClrBaseGreen050), {
|
|
30
|
+
alpha: 0,
|
|
31
|
+
format: 'css'
|
|
32
|
+
}), " 0%,") + "".concat((0, _hexRgb.default)("".concat(theme.palette.TwClrBaseGreen050), {
|
|
33
|
+
alpha: 0.24,
|
|
34
|
+
format: 'css'
|
|
35
|
+
}), " 100%)")
|
|
36
|
+
}
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
38
|
+
display: "flex",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
padding: theme.spacing(5),
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
height: "100%"
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(_material.CircularProgress, {
|
|
45
|
+
sx: {
|
|
46
|
+
color: theme.palette.TwClrIcnBrand
|
|
47
|
+
}
|
|
48
|
+
})));
|
|
49
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 = Button;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
|
11
|
+
require("./styles.scss");
|
|
12
|
+
function Button(props) {
|
|
13
|
+
const {
|
|
14
|
+
onClick,
|
|
15
|
+
label,
|
|
16
|
+
type = 'productive',
|
|
17
|
+
priority = 'primary',
|
|
18
|
+
size = 'small',
|
|
19
|
+
disabled,
|
|
20
|
+
icon,
|
|
21
|
+
rightIcon,
|
|
22
|
+
processing,
|
|
23
|
+
id,
|
|
24
|
+
className,
|
|
25
|
+
style,
|
|
26
|
+
sx
|
|
27
|
+
} = props;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_material.ButtonBase, {
|
|
29
|
+
id: id,
|
|
30
|
+
onClick: onClick,
|
|
31
|
+
className: "button ".concat(type, "-").concat(priority, " button--").concat(size, " ").concat(type, "-").concat(priority, "--").concat(size, " ").concat(icon && !processing ? 'button-with-icon' : '', " ").concat(rightIcon && !processing ? 'button-with-right-icon' : '', "\n ").concat(!label ? 'button-no-label' : '', " ").concat(className !== null && className !== void 0 ? className : ''),
|
|
32
|
+
disabled: disabled,
|
|
33
|
+
style: style,
|
|
34
|
+
sx: [{
|
|
35
|
+
'& path': {
|
|
36
|
+
fill: 'currentColor'
|
|
37
|
+
}
|
|
38
|
+
}, ...(Array.isArray(sx) ? sx : [sx])]
|
|
39
|
+
}, processing && /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
40
|
+
name: "spinner",
|
|
41
|
+
size: size,
|
|
42
|
+
className: "icon-spinner"
|
|
43
|
+
}), !processing && icon && /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
44
|
+
name: icon,
|
|
45
|
+
size: size
|
|
46
|
+
}), !processing && !!label && label, !processing && rightIcon && /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
47
|
+
name: rightIcon,
|
|
48
|
+
size: size,
|
|
49
|
+
className: "icon-right"
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
var _Button = _interopRequireDefault(require("./Button"));
|
|
7
|
+
test('calls onClick prop when clicked', () => {
|
|
8
|
+
const handleClick = jest.fn();
|
|
9
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
10
|
+
onClick: handleClick,
|
|
11
|
+
label: "Click me"
|
|
12
|
+
}));
|
|
13
|
+
_react2.fireEvent.click(_react2.screen.getByText(/click me/i));
|
|
14
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
15
|
+
});
|
|
16
|
+
test('should not call onClick prop when button is disabled', () => {
|
|
17
|
+
const handleClick = jest.fn();
|
|
18
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
19
|
+
onClick: handleClick,
|
|
20
|
+
label: "Click me",
|
|
21
|
+
disabled: true
|
|
22
|
+
}));
|
|
23
|
+
_react2.fireEvent.click(_react2.screen.getByText(/click me/i));
|
|
24
|
+
expect(handleClick).toHaveBeenCalledTimes(0);
|
|
25
|
+
});
|