@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,245 @@
|
|
|
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 = SelectT;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
var _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
|
14
|
+
var _IconTooltip = _interopRequireDefault(require("../IconTooltip"));
|
|
15
|
+
require("./styles.scss");
|
|
16
|
+
// Styles for overriding select dropdown
|
|
17
|
+
|
|
18
|
+
function SelectT(props) {
|
|
19
|
+
const {
|
|
20
|
+
className,
|
|
21
|
+
disabled,
|
|
22
|
+
displayLabel,
|
|
23
|
+
editable,
|
|
24
|
+
errorText,
|
|
25
|
+
fixedMenu,
|
|
26
|
+
fullWidth,
|
|
27
|
+
helperText,
|
|
28
|
+
hideArrow,
|
|
29
|
+
id,
|
|
30
|
+
isEqual,
|
|
31
|
+
label,
|
|
32
|
+
onBlur,
|
|
33
|
+
onChange,
|
|
34
|
+
onFocus,
|
|
35
|
+
options,
|
|
36
|
+
placeholder,
|
|
37
|
+
readonly,
|
|
38
|
+
renderOption,
|
|
39
|
+
required,
|
|
40
|
+
selectedValue,
|
|
41
|
+
selectStyles,
|
|
42
|
+
sx,
|
|
43
|
+
tooltipTitle,
|
|
44
|
+
toT,
|
|
45
|
+
warningText
|
|
46
|
+
} = props;
|
|
47
|
+
const selectClass = (0, _classnames.default)({
|
|
48
|
+
'textfield-value': true,
|
|
49
|
+
'textfield-value--disabled': disabled,
|
|
50
|
+
'textfield-value--error': !!errorText,
|
|
51
|
+
'textfield-value--warning': !!warningText,
|
|
52
|
+
'textfield-value--readonly': readonly
|
|
53
|
+
});
|
|
54
|
+
const itemClass = (0, _classnames.default)({
|
|
55
|
+
'select-value': true,
|
|
56
|
+
'select-value--disabled': disabled
|
|
57
|
+
});
|
|
58
|
+
const [openedOptions, setOpenedOptions] = (0, _react.useState)(false);
|
|
59
|
+
const [fixedMenuPositioned, setFixedMenuPositioned] = (0, _react.useState)(false);
|
|
60
|
+
const [selectedIndex, setSelectedIndex] = (0, _react.useState)(-1);
|
|
61
|
+
const inputRef = (0, _react.useRef)(null);
|
|
62
|
+
const dropdownRef = (0, _react.useRef)(null);
|
|
63
|
+
const hasOptions = (0, _react.useMemo)(() => options !== undefined && options.length > 0, [options]);
|
|
64
|
+
const repositionMenu = (0, _react.useCallback)(checkHeight => {
|
|
65
|
+
if (openedOptions && hasOptions) {
|
|
66
|
+
scrollToSelectedElement();
|
|
67
|
+
if (fixedMenu && inputRef.current && dropdownRef.current) {
|
|
68
|
+
dropdownRef.current.style.width = "".concat(inputRef.current.offsetWidth, "px");
|
|
69
|
+
const bbox = inputRef.current.getBoundingClientRect();
|
|
70
|
+
dropdownRef.current.style.top = "".concat(bbox.top + bbox.height, "px");
|
|
71
|
+
const dropdownBottom = dropdownRef.current.clientHeight + bbox.top + bbox.height;
|
|
72
|
+
const windowHeightThreshold = window.innerHeight - bbox.height;
|
|
73
|
+
if (checkHeight && dropdownBottom > windowHeightThreshold) {
|
|
74
|
+
dropdownRef.current.style.maxHeight = "".concat(dropdownRef.current.clientHeight - (dropdownBottom - windowHeightThreshold), "px");
|
|
75
|
+
}
|
|
76
|
+
setFixedMenuPositioned(true);
|
|
77
|
+
}
|
|
78
|
+
} else if (fixedMenu) {
|
|
79
|
+
setFixedMenuPositioned(false);
|
|
80
|
+
}
|
|
81
|
+
}, [fixedMenu, openedOptions, hasOptions]);
|
|
82
|
+
(0, _react.useEffect)(() => {
|
|
83
|
+
repositionMenu(true);
|
|
84
|
+
}, [repositionMenu]);
|
|
85
|
+
(0, _react.useEffect)(() => {
|
|
86
|
+
let newIndex = -1;
|
|
87
|
+
if (options && selectedValue) {
|
|
88
|
+
options.find((option, index) => {
|
|
89
|
+
if (isEqual(option, selectedValue)) {
|
|
90
|
+
newIndex = index;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (newIndex !== selectedIndex) {
|
|
97
|
+
setSelectedIndex(newIndex);
|
|
98
|
+
}
|
|
99
|
+
}, [options, selectedValue, selectedIndex, isEqual]);
|
|
100
|
+
const handleScroll = (0, _react.useCallback)(() => {
|
|
101
|
+
repositionMenu(false);
|
|
102
|
+
}, [repositionMenu]);
|
|
103
|
+
const handleClick = (0, _react.useCallback)(event => {
|
|
104
|
+
// Don't respond to user clicks inside the input box because those are
|
|
105
|
+
// already handled by toggleOptions()
|
|
106
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target) && inputRef.current && !inputRef.current.contains(event.target)) {
|
|
107
|
+
setOpenedOptions(false);
|
|
108
|
+
}
|
|
109
|
+
}, []);
|
|
110
|
+
const handleResize = (0, _react.useCallback)(() => {
|
|
111
|
+
setOpenedOptions(false);
|
|
112
|
+
}, []);
|
|
113
|
+
(0, _react.useEffect)(() => {
|
|
114
|
+
window.addEventListener('click', handleClick);
|
|
115
|
+
window.addEventListener('resize', handleResize);
|
|
116
|
+
window.addEventListener('scroll', handleScroll);
|
|
117
|
+
return () => {
|
|
118
|
+
window.removeEventListener('click', handleClick);
|
|
119
|
+
window.removeEventListener('resize', handleResize);
|
|
120
|
+
window.removeEventListener('scroll', handleScroll);
|
|
121
|
+
};
|
|
122
|
+
}, [handleClick, handleResize, handleScroll]);
|
|
123
|
+
const toggleOptions = () => {
|
|
124
|
+
setOpenedOptions(isOpen => !isOpen);
|
|
125
|
+
};
|
|
126
|
+
const onOptionSelected = (option, index) => {
|
|
127
|
+
if (onChange) {
|
|
128
|
+
onChange(option);
|
|
129
|
+
}
|
|
130
|
+
setOpenedOptions(false);
|
|
131
|
+
setSelectedIndex(index);
|
|
132
|
+
};
|
|
133
|
+
const onChangeHandler = e => {
|
|
134
|
+
const textValue = e.target.value;
|
|
135
|
+
if ((0, _utils.isWhitespaces)(textValue)) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (onChange) {
|
|
139
|
+
onChange(toT(textValue));
|
|
140
|
+
}
|
|
141
|
+
setOpenedOptions(true);
|
|
142
|
+
};
|
|
143
|
+
const onKeyDownHandler = e => {
|
|
144
|
+
if (e.key === 'Tab') {
|
|
145
|
+
toggleOptions();
|
|
146
|
+
} else {
|
|
147
|
+
var _dropdownRef$current;
|
|
148
|
+
const pressedLetter = e.key.toUpperCase();
|
|
149
|
+
const items = (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.getElementsByTagName('li');
|
|
150
|
+
if (items) {
|
|
151
|
+
const arrayOfItems = Array.from(items);
|
|
152
|
+
for (const item of arrayOfItems) {
|
|
153
|
+
if (item.dataset.key === pressedLetter) {
|
|
154
|
+
item.scrollIntoView({
|
|
155
|
+
behavior: 'smooth',
|
|
156
|
+
block: 'start'
|
|
157
|
+
});
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const scrollToSelectedElement = () => {
|
|
165
|
+
var _dropdownRef$current2;
|
|
166
|
+
const items = (_dropdownRef$current2 = dropdownRef.current) === null || _dropdownRef$current2 === void 0 ? void 0 : _dropdownRef$current2.getElementsByTagName('li');
|
|
167
|
+
if (items) {
|
|
168
|
+
const arrayOfItems = Array.from(items);
|
|
169
|
+
for (const item of arrayOfItems) {
|
|
170
|
+
if (item.dataset.selected === 'true') {
|
|
171
|
+
if (dropdownRef.current) {
|
|
172
|
+
const topPos = item.offsetTop;
|
|
173
|
+
dropdownRef.current.scrollTop = topPos;
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
181
|
+
className: "select ".concat(className),
|
|
182
|
+
sx: sx
|
|
183
|
+
}, label && /*#__PURE__*/_react.default.createElement("label", {
|
|
184
|
+
htmlFor: id,
|
|
185
|
+
className: "textfield-label"
|
|
186
|
+
}, label, " ", required ? '*' : '', " ", tooltipTitle && /*#__PURE__*/_react.default.createElement(_IconTooltip.default, {
|
|
187
|
+
title: tooltipTitle
|
|
188
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
189
|
+
className: "textfield-container ".concat(fullWidth ? 'textfield-container--fullWidth' : '')
|
|
190
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
191
|
+
id: id,
|
|
192
|
+
className: selectClass,
|
|
193
|
+
onClick: toggleOptions,
|
|
194
|
+
ref: inputRef,
|
|
195
|
+
style: (selectStyles || {}).inputContainer
|
|
196
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
197
|
+
value: displayLabel(selectedValue),
|
|
198
|
+
readOnly: !editable || readonly,
|
|
199
|
+
placeholder: placeholder,
|
|
200
|
+
onChange: onChangeHandler,
|
|
201
|
+
onKeyDown: onKeyDownHandler,
|
|
202
|
+
onBlur: onBlur,
|
|
203
|
+
onFocus: onFocus,
|
|
204
|
+
required: required,
|
|
205
|
+
style: (selectStyles || {}).input
|
|
206
|
+
}), !hideArrow && /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
207
|
+
name: 'chevronDown',
|
|
208
|
+
className: "textfield-value--icon-right",
|
|
209
|
+
style: (selectStyles || {}).arrow
|
|
210
|
+
})), options && options.length > 0 && openedOptions && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, fixedMenu && /*#__PURE__*/_react.default.createElement("div", {
|
|
211
|
+
className: "scroll-block"
|
|
212
|
+
}), /*#__PURE__*/_react.default.createElement("ul", {
|
|
213
|
+
className: 'options-container' + (fixedMenu ? ' fixed-menu' : '') + (fixedMenuPositioned ? ' positioned' : ''),
|
|
214
|
+
ref: dropdownRef,
|
|
215
|
+
style: (selectStyles || {}).optionsContainer
|
|
216
|
+
}, options.map((option, index) => {
|
|
217
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
218
|
+
"data-key": displayLabel(option).charAt(0).toUpperCase(),
|
|
219
|
+
"data-selected": selectedIndex === index,
|
|
220
|
+
key: index,
|
|
221
|
+
onClick: () => !readonly ? onOptionSelected(option, index) : undefined,
|
|
222
|
+
className: "".concat(itemClass, " ").concat(selectedIndex === index ? 'select-value--selected' : '', " "),
|
|
223
|
+
style: (selectStyles || {}).optionContainer
|
|
224
|
+
}, renderOption(option));
|
|
225
|
+
})))), errorText && /*#__PURE__*/_react.default.createElement("div", {
|
|
226
|
+
className: "textfield-label-container"
|
|
227
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
228
|
+
name: "error",
|
|
229
|
+
className: "textfield-error-text--icon"
|
|
230
|
+
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
231
|
+
htmlFor: id,
|
|
232
|
+
className: "textfield-error-text"
|
|
233
|
+
}, errorText)), warningText && /*#__PURE__*/_react.default.createElement("div", {
|
|
234
|
+
className: "textfield-label-container"
|
|
235
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
236
|
+
name: "warning",
|
|
237
|
+
className: "textfield-warning-text--icon"
|
|
238
|
+
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
239
|
+
htmlFor: id,
|
|
240
|
+
className: "textfield-warning-text"
|
|
241
|
+
}, warningText)), helperText && /*#__PURE__*/_react.default.createElement("label", {
|
|
242
|
+
htmlFor: id,
|
|
243
|
+
className: "textfield-help-text"
|
|
244
|
+
}, helperText));
|
|
245
|
+
}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
3
|
+
@import '../../style-dictionary-dist/terraware.scss';
|
|
4
|
+
|
|
5
|
+
@font-face {
|
|
6
|
+
font-family: 'Inter';
|
|
7
|
+
src: local('Inter'), url(../../fonts/Inter.ttf) format('truetype');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.select {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-flow: row wrap;
|
|
13
|
+
|
|
14
|
+
.textfield-container {
|
|
15
|
+
position: relative;
|
|
16
|
+
width: 228px;
|
|
17
|
+
|
|
18
|
+
&--fullWidth {
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.textfield-label {
|
|
24
|
+
font-family: $tw-fnt-frm-fld-label-font-family;
|
|
25
|
+
font-size: $tw-fnt-frm-fld-label-font-size;
|
|
26
|
+
font-weight: $tw-fnt-frm-fld-label-font-weight;
|
|
27
|
+
line-height: $tw-fnt-frm-fld-label-line-height;
|
|
28
|
+
color: $tw-clr-txt-secondary;
|
|
29
|
+
margin-bottom: $tw-spc-base-xx-small;
|
|
30
|
+
display: block;
|
|
31
|
+
width: 100%;
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.textfield-help-text {
|
|
36
|
+
font-family: $tw-fnt-frm-fld-help-text-font-family;
|
|
37
|
+
font-size: $tw-fnt-frm-fld-help-text-font-size;
|
|
38
|
+
font-weight: $tw-fnt-frm-fld-help-text-font-weight;
|
|
39
|
+
line-height: $tw-fnt-frm-fld-help-text-line-height;
|
|
40
|
+
color: $tw-clr-txt-secondary;
|
|
41
|
+
display: block;
|
|
42
|
+
width: 100%;
|
|
43
|
+
max-width: 100%;
|
|
44
|
+
margin-top: $tw-spc-base-xx-small;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.textfield-value {
|
|
48
|
+
background-color: $tw-clr-bg;
|
|
49
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-secondary;
|
|
50
|
+
padding: #{$tw-spc-base-x-small - $tw-sz-frm-fld-text-input-stroke};
|
|
51
|
+
border-radius: $tw-sz-base-x-small;
|
|
52
|
+
border-width: $tw-sz-frm-fld-text-input-stroke;
|
|
53
|
+
display: flex;
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-hover;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:active {
|
|
60
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-active;
|
|
61
|
+
outline: $tw-sz-frm-fld-text-input-stroke-active solid $tw-clr-brdr-active;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:focus-within {
|
|
65
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-active;
|
|
66
|
+
outline: $tw-sz-frm-fld-text-input-stroke-active solid $tw-clr-brdr-active;
|
|
67
|
+
outline-offset: -$tw-sz-frm-fld-text-input-stroke;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
input {
|
|
71
|
+
border: none;
|
|
72
|
+
width: 100%;
|
|
73
|
+
font-family: $tw-fnt-frm-fld-text-value-font-family;
|
|
74
|
+
font-size: $tw-fnt-frm-fld-text-value-font-size;
|
|
75
|
+
font-weight: $tw-fnt-frm-fld-text-value-font-weight;
|
|
76
|
+
line-height: $tw-fnt-frm-fld-text-value-line-height;
|
|
77
|
+
color: $tw-clr-txt;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
background: transparent;
|
|
80
|
+
padding-top: 0;
|
|
81
|
+
padding-bottom: 0;
|
|
82
|
+
|
|
83
|
+
&::placeholder {
|
|
84
|
+
font-family: $tw-fnt-frm-fld-text-placeholder-font-family;
|
|
85
|
+
font-size: $tw-fnt-frm-fld-text-placeholder-font-size;
|
|
86
|
+
font-weight: $tw-fnt-frm-fld-text-placeholder-font-weight;
|
|
87
|
+
line-height: $tw-fnt-frm-fld-text-placeholder-line-height;
|
|
88
|
+
color: $tw-clr-txt-tertiary;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&:focus-visible {
|
|
92
|
+
outline: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&--display {
|
|
97
|
+
font-family: $tw-fnt-frm-fld-text-value-font-family;
|
|
98
|
+
font-size: $tw-fnt-frm-fld-text-value-font-size;
|
|
99
|
+
font-weight: $tw-fnt-frm-fld-text-value-font-weight;
|
|
100
|
+
line-height: $tw-fnt-frm-fld-text-value-line-height;
|
|
101
|
+
padding: $tw-spc-base-x-small 0;
|
|
102
|
+
margin: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&--disabled {
|
|
106
|
+
opacity: $tw-opcty-semantic-off;
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
|
|
109
|
+
&:hover {
|
|
110
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-secondary;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&:active {
|
|
114
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-secondary;
|
|
115
|
+
outline: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:focus-within {
|
|
119
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-secondary;
|
|
120
|
+
outline: 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&--icon-right {
|
|
125
|
+
width: $tw-fnt-frm-fld-text-value-line-height;
|
|
126
|
+
height: $tw-fnt-frm-fld-text-value-line-height;
|
|
127
|
+
fill: $tw-clr-icn;
|
|
128
|
+
margin-left: $tw-spc-base-x-small;
|
|
129
|
+
flex-shrink: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&--icon-left {
|
|
133
|
+
width: $tw-fnt-frm-fld-text-value-line-height;
|
|
134
|
+
height: $tw-fnt-frm-fld-text-value-line-height;
|
|
135
|
+
fill: $tw-clr-icn-secondary;
|
|
136
|
+
margin-right: $tw-spc-base-x-small;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&--error {
|
|
140
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-danger;
|
|
141
|
+
background-color: $tw-clr-bg-danger-tertiary;
|
|
142
|
+
|
|
143
|
+
&:hover {
|
|
144
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-danger-hover;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:active {
|
|
148
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-danger-active;
|
|
149
|
+
outline: $tw-sz-frm-fld-text-input-stroke-active solid $tw-clr-brdr-danger-active;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&:focus-within {
|
|
153
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-danger-active;
|
|
154
|
+
outline: $tw-sz-frm-fld-text-input-stroke-active solid $tw-clr-brdr-danger-active;
|
|
155
|
+
outline-offset: -$tw-sz-frm-fld-text-input-stroke;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&--warning {
|
|
160
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-warning;
|
|
161
|
+
background-color: $tw-clr-bg-warning-tertiary;
|
|
162
|
+
|
|
163
|
+
&:hover {
|
|
164
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-warning-hover;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&:active {
|
|
168
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-warning-active;
|
|
169
|
+
outline: $tw-sz-frm-fld-text-input-stroke-active solid $tw-clr-brdr-warning-active;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&:focus-within {
|
|
173
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-warning-active;
|
|
174
|
+
outline: $tw-sz-frm-fld-text-input-stroke-active solid $tw-clr-brdr-warning-active;
|
|
175
|
+
outline-offset: -$tw-sz-frm-fld-text-input-stroke;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&--readonly {
|
|
180
|
+
background-color: $tw-clr-bg-secondary;
|
|
181
|
+
|
|
182
|
+
&:hover {
|
|
183
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-secondary;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&:active {
|
|
187
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-secondary;
|
|
188
|
+
outline: 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&:focus-within {
|
|
192
|
+
border: $tw-sz-frm-fld-text-input-stroke solid $tw-clr-brdr-secondary;
|
|
193
|
+
outline: 0;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&--readonly input {
|
|
198
|
+
cursor: auto;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.textfield-label-container {
|
|
203
|
+
position: relative;
|
|
204
|
+
display: flex;
|
|
205
|
+
width: 100%;
|
|
206
|
+
margin-top: $tw-spc-base-xx-small;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.textfield-error-text {
|
|
210
|
+
font-family: $tw-fnt-frm-fld-error-text-font-family;
|
|
211
|
+
font-size: $tw-fnt-frm-fld-error-text-font-size;
|
|
212
|
+
font-weight: $tw-fnt-frm-fld-error-text-font-weight;
|
|
213
|
+
line-height: $tw-fnt-frm-fld-error-text-line-height;
|
|
214
|
+
color: $tw-clr-txt-danger;
|
|
215
|
+
display: block;
|
|
216
|
+
width: 100%;
|
|
217
|
+
max-width: 100%;
|
|
218
|
+
|
|
219
|
+
&--icon {
|
|
220
|
+
fill: $tw-clr-icn-danger;
|
|
221
|
+
width: $tw-fnt-frm-fld-error-text-line-height;
|
|
222
|
+
height: $tw-fnt-frm-fld-error-text-line-height;
|
|
223
|
+
margin-right: $tw-spc-base-x-small;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.textfield-warning-text {
|
|
228
|
+
font-family: $tw-fnt-frm-fld-warning-text-font-family;
|
|
229
|
+
font-size: $tw-fnt-frm-fld-warning-text-font-size;
|
|
230
|
+
font-weight: $tw-fnt-frm-fld-warning-text-font-weight;
|
|
231
|
+
line-height: $tw-fnt-frm-fld-warning-text-line-height;
|
|
232
|
+
color: $tw-clr-txt-warning;
|
|
233
|
+
display: block;
|
|
234
|
+
width: 100%;
|
|
235
|
+
max-width: 100%;
|
|
236
|
+
|
|
237
|
+
&--icon {
|
|
238
|
+
fill: $tw-clr-icn-warning;
|
|
239
|
+
width: $tw-fnt-frm-fld-error-text-line-height;
|
|
240
|
+
height: $tw-fnt-frm-fld-error-text-line-height;
|
|
241
|
+
margin-right: $tw-spc-base-x-small;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.options-container {
|
|
246
|
+
z-index: 3;
|
|
247
|
+
width: calc(100% - 2px);
|
|
248
|
+
position: absolute;
|
|
249
|
+
top: 44px;
|
|
250
|
+
list-style-type: none;
|
|
251
|
+
padding: $tw-spc-base-x-small 0;
|
|
252
|
+
background: $tw-clr-bg;
|
|
253
|
+
border: 1px solid $tw-clr-brdr-secondary;
|
|
254
|
+
margin: $tw-spc-base-xx-small 0 0;
|
|
255
|
+
border-radius: $tw-sz-base-x-small;
|
|
256
|
+
max-height: 300px;
|
|
257
|
+
overflow-y: auto;
|
|
258
|
+
|
|
259
|
+
&.fixed-menu {
|
|
260
|
+
visibility: 'hidden';
|
|
261
|
+
|
|
262
|
+
&.positioned {
|
|
263
|
+
visibility: 'visible';
|
|
264
|
+
position: fixed;
|
|
265
|
+
z-index: 11;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.select-value {
|
|
270
|
+
font-family: $tw-fnt-frm-fld-select-value-font-family;
|
|
271
|
+
font-size: $tw-fnt-frm-fld-select-value-font-size;
|
|
272
|
+
font-weight: $tw-fnt-frm-fld-select-value-font-weight;
|
|
273
|
+
line-height: $tw-fnt-frm-fld-select-value-line-height;
|
|
274
|
+
padding: $tw-spc-base-x-small $tw-spc-base-small;
|
|
275
|
+
cursor: pointer;
|
|
276
|
+
|
|
277
|
+
&:hover {
|
|
278
|
+
background-color: $tw-clr-bg-selected-ghost-hover;
|
|
279
|
+
color: $tw-clr-txt;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
&:active {
|
|
283
|
+
background-color: $tw-clr-bg-selected-ghost-active;
|
|
284
|
+
color: $tw-clr-txt;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&--selected,
|
|
288
|
+
&--selected:hover {
|
|
289
|
+
background-color: $tw-clr-bg-selected;
|
|
290
|
+
color: $tw-clr-txt-on-selected;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
&--disabled {
|
|
294
|
+
opacity: $tw-opcty-semantic-off;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.scroll-block {
|
|
300
|
+
position: fixed;
|
|
301
|
+
top: 0;
|
|
302
|
+
bottom: 0;
|
|
303
|
+
left: 0;
|
|
304
|
+
right: 0;
|
|
305
|
+
z-index: 10;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
@@ -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 = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _theme = _interopRequireDefault(require("../../theme"));
|
|
11
|
+
const Separator = props => {
|
|
12
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
13
|
+
sx: {
|
|
14
|
+
margin: _theme.default.spacing(0, 2),
|
|
15
|
+
width: '1px',
|
|
16
|
+
height: props.height || '32px',
|
|
17
|
+
backgroundColor: props.color || _theme.default.palette.TwClrBrdrTertiary
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var _default = exports.default = Separator;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = Slider;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
function Slider(props) {
|
|
11
|
+
const {
|
|
12
|
+
defaultValue,
|
|
13
|
+
value,
|
|
14
|
+
marks,
|
|
15
|
+
min,
|
|
16
|
+
max,
|
|
17
|
+
onChange,
|
|
18
|
+
step,
|
|
19
|
+
valueLabelDisplay
|
|
20
|
+
} = props;
|
|
21
|
+
const theme = (0, _material.useTheme)();
|
|
22
|
+
const sliderStyles = {
|
|
23
|
+
'.MuiSlider-rail': {
|
|
24
|
+
backgroundColor: theme.palette.TwClrBgBrandTertiary,
|
|
25
|
+
height: theme.spacing(0.5)
|
|
26
|
+
},
|
|
27
|
+
'.MuiSlider-track': {
|
|
28
|
+
display: 'none'
|
|
29
|
+
},
|
|
30
|
+
'.MuiSlider-mark': {
|
|
31
|
+
backgroundColor: theme.palette.TwClrBgBrand,
|
|
32
|
+
height: '8px',
|
|
33
|
+
width: '8px',
|
|
34
|
+
borderRadius: '4px'
|
|
35
|
+
},
|
|
36
|
+
'.MuiSlider-thumb': {
|
|
37
|
+
backgroundColor: theme.palette.TwClrBgBrand,
|
|
38
|
+
height: '16px',
|
|
39
|
+
width: '16px',
|
|
40
|
+
borderRadius: '8px'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const handleChange = (event, val) => {
|
|
44
|
+
if (!Array.isArray(val)) {
|
|
45
|
+
onChange(val);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_material.Slider, {
|
|
49
|
+
"aria-label": "Slider",
|
|
50
|
+
defaultValue: defaultValue,
|
|
51
|
+
value: value,
|
|
52
|
+
marks: marks,
|
|
53
|
+
min: min,
|
|
54
|
+
max: max,
|
|
55
|
+
onChangeCommitted: handleChange,
|
|
56
|
+
step: step !== null && step !== void 0 ? step : null,
|
|
57
|
+
valueLabelDisplay: valueLabelDisplay,
|
|
58
|
+
sx: sliderStyles
|
|
59
|
+
});
|
|
60
|
+
}
|