@trackunit/react-components 0.0.200 → 0.0.203
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/index.js +226 -566
- package/package.json +19 -18
- /package/{common → src/common}/CommonProps.d.ts +0 -0
- /package/{common → src/common}/LegacyComponentStory.d.ts +0 -0
- /package/{common → src/common}/StorybookProps.d.ts +0 -0
- /package/{common → src/common}/index.d.ts +0 -0
- /package/{common → src/common}/useContainerProps.d.ts +0 -0
- /package/{components → src/components}/ActionButton/ActionButton.d.ts +0 -0
- /package/{components → src/components}/ActionButton/index.d.ts +0 -0
- /package/{components → src/components}/Alert/Alert.d.ts +0 -0
- /package/{components → src/components}/Alert/index.d.ts +0 -0
- /package/{components → src/components}/Badge/Badge.d.ts +0 -0
- /package/{components → src/components}/Badge/index.d.ts +0 -0
- /package/{components → src/components}/BaseInput/BaseInput.d.ts +0 -0
- /package/{components → src/components}/BaseInput/index.d.ts +0 -0
- /package/{components → src/components}/Card/Card.d.ts +0 -0
- /package/{components → src/components}/Card/CardBody.d.ts +0 -0
- /package/{components → src/components}/Card/CardFooter.d.ts +0 -0
- /package/{components → src/components}/Card/CardHeader.d.ts +0 -0
- /package/{components → src/components}/Card/DensityContainer.d.ts +0 -0
- /package/{components → src/components}/Card/index.d.ts +0 -0
- /package/{components → src/components}/Chart/Chart.d.ts +0 -0
- /package/{components → src/components}/Chart/index.d.ts +0 -0
- /package/{components → src/components}/Checkbox/CheckIcon.d.ts +0 -0
- /package/{components → src/components}/Checkbox/Checkbox.d.ts +0 -0
- /package/{components → src/components}/Checkbox/IndeterminateIcon.d.ts +0 -0
- /package/{components → src/components}/Checkbox/index.d.ts +0 -0
- /package/{components → src/components}/Collapse/Collapse.d.ts +0 -0
- /package/{components → src/components}/Collapse/index.d.ts +0 -0
- /package/{components → src/components}/CopyableText/CopyableText.d.ts +0 -0
- /package/{components → src/components}/CopyableText/index.d.ts +0 -0
- /package/{components → src/components}/DateField/DateField.d.ts +0 -0
- /package/{components → src/components}/DateInput/DateInput.d.ts +0 -0
- /package/{components → src/components}/DayPicker/DayPicker.d.ts +0 -0
- /package/{components → src/components}/DayPicker/DayPickerPopover.d.ts +0 -0
- /package/{components → src/components}/DayPicker/DayRangePicker.d.ts +0 -0
- /package/{components → src/components}/DayPicker/index.d.ts +0 -0
- /package/{components → src/components}/DayPicker/useLocale.d.ts +0 -0
- /package/{components → src/components}/EmailInput/EmailInput.d.ts +0 -0
- /package/{components → src/components}/FormGroup/FormGroup.d.ts +0 -0
- /package/{components → src/components}/Heading/Heading.d.ts +0 -0
- /package/{components → src/components}/Heading/index.d.ts +0 -0
- /package/{components → src/components}/Icon/Icon.d.ts +0 -0
- /package/{components → src/components}/Indicator/Indicator.d.ts +0 -0
- /package/{components → src/components}/Indicator/index.d.ts +0 -0
- /package/{components → src/components}/Label/Label.d.ts +0 -0
- /package/{components → src/components}/Label/index.d.ts +0 -0
- /package/{components → src/components}/LegendItem/LegendItem.d.ts +0 -0
- /package/{components → src/components}/LegendItem/index.d.ts +0 -0
- /package/{components → src/components}/Menu/MenuItem/MenuItem.d.ts +0 -0
- /package/{components → src/components}/Menu/MenuList/MenuList.d.ts +0 -0
- /package/{components → src/components}/Menu/MoreMenu/MoreMenu.d.ts +0 -0
- /package/{components → src/components}/Menu/index.d.ts +0 -0
- /package/{components → src/components}/Modal/Modal.d.ts +0 -0
- /package/{components → src/components}/Modal/ModalBackdrop.d.ts +0 -0
- /package/{components → src/components}/Modal/index.d.ts +0 -0
- /package/{components → src/components}/Modal/useModal.d.ts +0 -0
- /package/{components → src/components}/NumberField/NumberField.d.ts +0 -0
- /package/{components → src/components}/NumberInput/NumberInput.d.ts +0 -0
- /package/{components → src/components}/PageHeader/PageHeader.d.ts +0 -0
- /package/{components → src/components}/PageHeader/index.d.ts +0 -0
- /package/{components → src/components}/Pagination/Pagination.d.ts +0 -0
- /package/{components → src/components}/PhoneInput/PhoneInput.d.ts +0 -0
- /package/{components → src/components}/Popover/Popover.d.ts +0 -0
- /package/{components → src/components}/Popover/PopoverList.d.ts +0 -0
- /package/{components → src/components}/Popover/PopoverListItem.d.ts +0 -0
- /package/{components → src/components}/Popover/PopoverTitle.d.ts +0 -0
- /package/{components → src/components}/Popover/index.d.ts +0 -0
- /package/{components → src/components}/Prompt/Prompt.d.ts +0 -0
- /package/{components → src/components}/Prompt/index.d.ts +0 -0
- /package/{components → src/components}/RadioGroup/RadioGroup.d.ts +0 -0
- /package/{components → src/components}/RadioGroup/RadioGroupContext.d.ts +0 -0
- /package/{components → src/components}/RadioGroup/RadioItem.d.ts +0 -0
- /package/{components → src/components}/RadioGroup/index.d.ts +0 -0
- /package/{components → src/components}/Search/Search.d.ts +0 -0
- /package/{components → src/components}/Search/index.d.ts +0 -0
- /package/{components → src/components}/SectionHeader/SectionHeader.d.ts +0 -0
- /package/{components → src/components}/SectionHeader/index.d.ts +0 -0
- /package/{components → src/components}/Select/CreatableSelect.d.ts +0 -0
- /package/{components → src/components}/Select/FieldContainer.d.ts +0 -0
- /package/{components → src/components}/Select/Select.d.ts +0 -0
- /package/{components → src/components}/Select/SelectMenuItem/SelectMenuItem.d.ts +0 -0
- /package/{components → src/components}/Select/TagWithWidth.d.ts +0 -0
- /package/{components → src/components}/Select/TagsContainer.d.ts +0 -0
- /package/{components → src/components}/Select/index.d.ts +0 -0
- /package/{components → src/components}/Select/shared.d.ts +0 -0
- /package/{components → src/components}/Select/useCustomComponents.d.ts +0 -0
- /package/{components → src/components}/Select/useCustomStyles.d.ts +0 -0
- /package/{components → src/components}/Select/useSelect.d.ts +0 -0
- /package/{components → src/components}/SkeletonLines/SkeletonLines.d.ts +0 -0
- /package/{components → src/components}/SkeletonLines/index.d.ts +0 -0
- /package/{components → src/components}/Spacer/Spacer.d.ts +0 -0
- /package/{components → src/components}/Spacer/index.d.ts +0 -0
- /package/{components → src/components}/Spinner/Spinner.d.ts +0 -0
- /package/{components → src/components}/Spinner/index.d.ts +0 -0
- /package/{components → src/components}/Tag/Tag.d.ts +0 -0
- /package/{components → src/components}/Tag/index.d.ts +0 -0
- /package/{components → src/components}/Text/Text.d.ts +0 -0
- /package/{components → src/components}/Text/index.d.ts +0 -0
- /package/{components → src/components}/TextArea/TextArea.d.ts +0 -0
- /package/{components → src/components}/TextArea/index.d.ts +0 -0
- /package/{components → src/components}/TextAreaField/TextAreaField.d.ts +0 -0
- /package/{components → src/components}/TextAreaField/index.d.ts +0 -0
- /package/{components → src/components}/TextField/TextField.d.ts +0 -0
- /package/{components → src/components}/TextField/TextLenghtIndicator.d.ts +0 -0
- /package/{components → src/components}/TextField/index.d.ts +0 -0
- /package/{components → src/components}/TextInput/TextInput.d.ts +0 -0
- /package/{components → src/components}/Timeline/Timeline.d.ts +0 -0
- /package/{components → src/components}/Tip/Tip.d.ts +0 -0
- /package/{components → src/components}/Tip/index.d.ts +0 -0
- /package/{components → src/components}/Toggle/Toggle.d.ts +0 -0
- /package/{components → src/components}/Toggle/index.d.ts +0 -0
- /package/{components → src/components}/Tooltip/Tooltip.d.ts +0 -0
- /package/{components → src/components}/Tooltip/index.d.ts +0 -0
- /package/{components → src/components}/ValueBar/ValueBar.d.ts +0 -0
- /package/{components → src/components}/ValueBar/ValueBarHelper.d.ts +0 -0
- /package/{components → src/components}/ValueBar/ValueBarTypes.d.ts +0 -0
- /package/{components → src/components}/ValueBar/index.d.ts +0 -0
- /package/{components → src/components}/buttons/Button/Button.d.ts +0 -0
- /package/{components → src/components}/buttons/IconButton/IconButton.d.ts +0 -0
- /package/{components → src/components}/buttons/StarButton/StarButton.d.ts +0 -0
- /package/{components → src/components}/buttons/index.d.ts +0 -0
- /package/{components → src/components}/buttons/shared/ButtonProps.d.ts +0 -0
- /package/{components → src/components}/buttons/shared/helpers.d.ts +0 -0
- /package/{components → src/components}/index.d.ts +0 -0
- /package/{components → src/components}/theme/DefaultTheme.d.ts +0 -0
- /package/{components → src/components}/theme/index.d.ts +0 -0
- /package/{hooks → src/hooks}/index.d.ts +0 -0
- /package/{hooks → src/hooks}/useDebounce.d.ts +0 -0
- /package/{hooks → src/hooks}/useLocalStorage.d.ts +0 -0
- /package/{hooks → src/hooks}/useTimeout.d.ts +0 -0
- /package/{index.d.ts → src/index.d.ts} +0 -0
- /package/{layout → src/layout}/helper/MinTopFullContentLayout.d.ts +0 -0
- /package/{layout → src/layout}/index.d.ts +0 -0
- /package/{layout → src/layout}/responsive/FilterListMapLayout.d.ts +0 -0
- /package/{layout → src/layout}/responsive/FullWidthRepeatingLayout.d.ts +0 -0
- /package/{layout → src/layout}/responsive/GridArea.d.ts +0 -0
- /package/{layout → src/layout}/responsive/IntrinsicallyResponsiveGrid.d.ts +0 -0
- /package/{layout → src/layout}/responsive/TitleNavContentLayout.d.ts +0 -0
- /package/{layout → src/layout}/responsive/TwoColumnLayout.d.ts +0 -0
- /package/{test-config → src/test-config}/jest.setup.d.ts +0 -0
- /package/{test-utils → src/test-utils}/hooks.d.ts +0 -0
- /package/{test-utils → src/test-utils}/test-utils.d.ts +0 -0
package/index.js
CHANGED
|
@@ -44,15 +44,12 @@ const useContainerProps = ({
|
|
|
44
44
|
className,
|
|
45
45
|
"data-testid": dataTestId
|
|
46
46
|
};
|
|
47
|
-
|
|
48
47
|
if (containerProps["data-testid"] === undefined) {
|
|
49
48
|
delete containerProps["data-testid"];
|
|
50
49
|
}
|
|
51
|
-
|
|
52
50
|
if (containerProps.className === undefined) {
|
|
53
51
|
delete containerProps.className;
|
|
54
52
|
}
|
|
55
|
-
|
|
56
53
|
return containerProps;
|
|
57
54
|
};
|
|
58
55
|
|
|
@@ -107,7 +104,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
107
104
|
* @param {SpinnerProps} props - The props for the Spinner component
|
|
108
105
|
* @returns {JSX.Element} Spinner component
|
|
109
106
|
*/
|
|
110
|
-
|
|
111
107
|
const Spinner = ({
|
|
112
108
|
mode = "light",
|
|
113
109
|
size = "medium",
|
|
@@ -130,23 +126,19 @@ const Spinner = ({
|
|
|
130
126
|
})
|
|
131
127
|
}));
|
|
132
128
|
};
|
|
133
|
-
|
|
134
129
|
const getSpinnerStyles = () => ({
|
|
135
130
|
$size
|
|
136
131
|
}) => {
|
|
137
132
|
switch ($size) {
|
|
138
133
|
case "small":
|
|
139
134
|
return tws`tu-spinner--small`;
|
|
140
|
-
|
|
141
135
|
case "large":
|
|
142
136
|
return tws`tu-spinner--large`;
|
|
143
|
-
|
|
144
137
|
case "medium":
|
|
145
138
|
default:
|
|
146
139
|
return;
|
|
147
140
|
}
|
|
148
141
|
};
|
|
149
|
-
|
|
150
142
|
const StyledSpinner$1 = tw.span`
|
|
151
143
|
tu-spinner
|
|
152
144
|
${p => p.$mode === "dark" ? tws`tu-spinner--dark` : null}
|
|
@@ -162,7 +154,6 @@ const Container$8 = tw.div`
|
|
|
162
154
|
*
|
|
163
155
|
* @returns {string} - Classnames for the button
|
|
164
156
|
*/
|
|
165
|
-
|
|
166
157
|
const getStyles = () => ({
|
|
167
158
|
$color,
|
|
168
159
|
$variant
|
|
@@ -190,17 +181,14 @@ const getStyles = () => ({
|
|
|
190
181
|
*
|
|
191
182
|
* @returns {string} - The correct class for setting padding.
|
|
192
183
|
*/
|
|
193
|
-
|
|
194
184
|
const getPadding = () => ({
|
|
195
185
|
$size
|
|
196
186
|
}) => {
|
|
197
187
|
switch ($size) {
|
|
198
188
|
case "small":
|
|
199
189
|
return tws`tu-button--small`;
|
|
200
|
-
|
|
201
190
|
case "large":
|
|
202
191
|
return tws`tu-button--large`;
|
|
203
|
-
|
|
204
192
|
default:
|
|
205
193
|
return "";
|
|
206
194
|
}
|
|
@@ -212,30 +200,28 @@ const getPadding = () => ({
|
|
|
212
200
|
* @param {ButtonProps} props - The props for the Button component
|
|
213
201
|
* @returns {JSX.Element} Button component
|
|
214
202
|
*/
|
|
215
|
-
|
|
216
203
|
const Button = React.forwardRef((_a, ref) => {
|
|
217
204
|
var {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
205
|
+
onClick,
|
|
206
|
+
children,
|
|
207
|
+
loading,
|
|
208
|
+
disabled,
|
|
209
|
+
className,
|
|
210
|
+
fullWidth = false,
|
|
211
|
+
prefix,
|
|
212
|
+
suffix,
|
|
213
|
+
color = "primary",
|
|
214
|
+
variant = "filled",
|
|
215
|
+
type = "button",
|
|
216
|
+
size = "medium",
|
|
217
|
+
square = false,
|
|
218
|
+
dataTestId,
|
|
219
|
+
title,
|
|
220
|
+
role,
|
|
221
|
+
tabIndex,
|
|
222
|
+
renderAs = "button"
|
|
223
|
+
} = _a,
|
|
224
|
+
rest = __rest(_a, ["onClick", "children", "loading", "disabled", "className", "fullWidth", "prefix", "suffix", "color", "variant", "type", "size", "square", "dataTestId", "title", "role", "tabIndex", "renderAs"]);
|
|
239
225
|
return jsxs(StyledButton$1, Object.assign({
|
|
240
226
|
"$as": renderAs,
|
|
241
227
|
onClick: onClick,
|
|
@@ -274,15 +260,14 @@ const StyledSpinner = twx(Spinner)`
|
|
|
274
260
|
|
|
275
261
|
const IconButton = React.forwardRef((_a, ref) => {
|
|
276
262
|
var {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
263
|
+
icon,
|
|
264
|
+
size = "small",
|
|
265
|
+
square = true,
|
|
266
|
+
circular,
|
|
267
|
+
loading,
|
|
268
|
+
disabled
|
|
269
|
+
} = _a,
|
|
270
|
+
rest = __rest(_a, ["icon", "size", "square", "circular", "loading", "disabled"]);
|
|
286
271
|
return jsx(StyledButton, Object.assign({
|
|
287
272
|
size: size,
|
|
288
273
|
square: square,
|
|
@@ -309,7 +294,6 @@ const IconSizeClassMap = {
|
|
|
309
294
|
small: tws`tu-icon--small`,
|
|
310
295
|
medium: tws`tu-icon--medium`,
|
|
311
296
|
large: tws`tu-icon--large` // 24x24px
|
|
312
|
-
|
|
313
297
|
};
|
|
314
298
|
/**
|
|
315
299
|
* - The Icon component is used to display an Icon.
|
|
@@ -319,7 +303,6 @@ const IconSizeClassMap = {
|
|
|
319
303
|
* @param {IconProps} props - The props for the Icon component
|
|
320
304
|
* @returns {JSX.Element} Icon component
|
|
321
305
|
*/
|
|
322
|
-
|
|
323
306
|
const Icon$1 = ({
|
|
324
307
|
name,
|
|
325
308
|
size = "large",
|
|
@@ -336,17 +319,14 @@ const Icon$1 = ({
|
|
|
336
319
|
const correctIconType = React.useMemo(() => type ? type : size === "large" ? "outline" : "solid", [type, size]);
|
|
337
320
|
const colorClassNames = React.useMemo(() => correctIconType === "solid" ? tws`fill-current stroke-transparent` : tws`fill-transparent stroke-current`, [correctIconType]);
|
|
338
321
|
let IconComponent = null;
|
|
339
|
-
|
|
340
322
|
if (HeroIconsArray.find(icon => icon === name)) {
|
|
341
323
|
IconComponent = heroIconLookup(name, correctIconType);
|
|
342
324
|
} else if (TrackunitSolidIconsArray.find(icon => icon === name) || TrackunitOutlineIconsArray.find(icon => icon === name)) {
|
|
343
325
|
IconComponent = trackunitIconLookup(name, correctIconType);
|
|
344
326
|
}
|
|
345
|
-
|
|
346
327
|
if (!IconComponent) {
|
|
347
328
|
return null;
|
|
348
329
|
}
|
|
349
|
-
|
|
350
330
|
return jsx(React.Suspense, Object.assign({
|
|
351
331
|
fallback: jsx(LoadingDot, {
|
|
352
332
|
className: iconSizeClassName
|
|
@@ -379,52 +359,38 @@ const Root$6 = tw.span`
|
|
|
379
359
|
switch ($color) {
|
|
380
360
|
case "primary":
|
|
381
361
|
return tws`tu-icon--primary`;
|
|
382
|
-
|
|
383
362
|
case "secondary":
|
|
384
363
|
return tws`tu-icon--secondary`;
|
|
385
|
-
|
|
386
364
|
case "accent":
|
|
387
365
|
return tws`tu-icon--accent`;
|
|
388
|
-
|
|
389
366
|
case "neutral":
|
|
390
367
|
return tws`tu-icon--neutral`;
|
|
391
|
-
|
|
392
368
|
case "info":
|
|
393
369
|
return tws`tu-icon--info`;
|
|
394
|
-
|
|
395
370
|
case "success":
|
|
396
371
|
return tws`tu-icon--success`;
|
|
397
|
-
|
|
398
372
|
case "warning":
|
|
399
373
|
return tws`tu-icon--warning`;
|
|
400
|
-
|
|
401
374
|
case "danger":
|
|
402
375
|
return tws`tu-icon--danger`;
|
|
403
|
-
|
|
404
376
|
case "good":
|
|
405
377
|
return tws`tu-icon--good`;
|
|
406
|
-
|
|
407
378
|
case "low":
|
|
408
379
|
return tws`tu-icon--low`;
|
|
409
|
-
|
|
410
380
|
case "critical":
|
|
411
381
|
return tws`tu-icon--critical`;
|
|
412
|
-
|
|
413
382
|
case "working":
|
|
414
383
|
return tws`tu-icon--working`;
|
|
415
|
-
|
|
416
384
|
case "idle":
|
|
417
385
|
return tws`tu-icon--idle`;
|
|
418
|
-
|
|
419
386
|
case "stopped":
|
|
420
387
|
return tws`tu-icon--stopped`;
|
|
421
|
-
|
|
388
|
+
case "moving":
|
|
389
|
+
return tws`tu-icon--moving`;
|
|
422
390
|
case "unknown":
|
|
423
391
|
return tws`tu-icon--unknown`;
|
|
424
|
-
|
|
425
392
|
case "white":
|
|
426
393
|
return tws`text-white`;
|
|
427
|
-
|
|
428
394
|
default:
|
|
429
395
|
return "tu-icon--default";
|
|
430
396
|
}
|
|
@@ -437,7 +403,6 @@ const Root$6 = tw.span`
|
|
|
437
403
|
* @param {ActionButtonProps} props - The props for the ActionButton component
|
|
438
404
|
* @returns {JSX.Element} ActionButton component
|
|
439
405
|
*/
|
|
440
|
-
|
|
441
406
|
const ActionButton = ({
|
|
442
407
|
type,
|
|
443
408
|
value,
|
|
@@ -448,34 +413,27 @@ const ActionButton = ({
|
|
|
448
413
|
switch (type) {
|
|
449
414
|
case "PHONE_NUMBER":
|
|
450
415
|
return "PhoneOutgoingIcon";
|
|
451
|
-
|
|
452
416
|
case "WEB_ADDRESS":
|
|
453
417
|
return "ExternalLinkIcon";
|
|
454
|
-
|
|
455
418
|
case "EMAIL":
|
|
456
419
|
default:
|
|
457
420
|
return "MailIcon";
|
|
458
421
|
}
|
|
459
422
|
};
|
|
460
|
-
|
|
461
423
|
const ButtonAction = () => {
|
|
462
424
|
switch (type) {
|
|
463
425
|
case "EMAIL":
|
|
464
426
|
return window.open(`mailto:${value}`);
|
|
465
|
-
|
|
466
427
|
case "WEB_ADDRESS":
|
|
467
428
|
if (value) {
|
|
468
429
|
return window.open(value, "_blank", "noopener,noreferrer");
|
|
469
430
|
}
|
|
470
|
-
|
|
471
431
|
return null;
|
|
472
|
-
|
|
473
432
|
case "PHONE_NUMBER":
|
|
474
433
|
default:
|
|
475
434
|
return window.open(`tel:${value}`);
|
|
476
435
|
}
|
|
477
436
|
};
|
|
478
|
-
|
|
479
437
|
return jsx(ActionContainer, {
|
|
480
438
|
children: jsx(StyledIconButton, {
|
|
481
439
|
"$fieldSize": iconSize,
|
|
@@ -506,7 +464,6 @@ ${({
|
|
|
506
464
|
* @param {StarButtonProps} props - The props for the StarButton component
|
|
507
465
|
* @returns {JSX.Element} StarButton component
|
|
508
466
|
*/
|
|
509
|
-
|
|
510
467
|
const StarButton = ({
|
|
511
468
|
starred,
|
|
512
469
|
onClick
|
|
@@ -544,7 +501,6 @@ const CustomIcon = twx(Icon$1)`
|
|
|
544
501
|
* @param {TextProps} props - The props for the Text component
|
|
545
502
|
* @returns {JSX.Element} Text component
|
|
546
503
|
*/
|
|
547
|
-
|
|
548
504
|
const Text$1 = ({
|
|
549
505
|
children,
|
|
550
506
|
type = "p",
|
|
@@ -575,7 +531,6 @@ const Text$1 = ({
|
|
|
575
531
|
children: children
|
|
576
532
|
}));
|
|
577
533
|
};
|
|
578
|
-
|
|
579
534
|
const getTextSize = () => ({
|
|
580
535
|
$size
|
|
581
536
|
}) => {
|
|
@@ -586,7 +541,6 @@ const getTextSize = () => ({
|
|
|
586
541
|
};
|
|
587
542
|
return sizes[$size];
|
|
588
543
|
};
|
|
589
|
-
|
|
590
544
|
const getTextWeight = () => ({
|
|
591
545
|
$weight
|
|
592
546
|
}) => {
|
|
@@ -597,7 +551,6 @@ const getTextWeight = () => ({
|
|
|
597
551
|
};
|
|
598
552
|
return weights[$weight];
|
|
599
553
|
};
|
|
600
|
-
|
|
601
554
|
const getFontColor$1 = () => ({
|
|
602
555
|
$inverted,
|
|
603
556
|
$subtle
|
|
@@ -606,7 +559,6 @@ const getFontColor$1 = () => ({
|
|
|
606
559
|
const inverted = $inverted ? tws`tu-text--inverted` : null;
|
|
607
560
|
return $subtle ? subtle : inverted;
|
|
608
561
|
};
|
|
609
|
-
|
|
610
562
|
const getTextAlignment = () => ({
|
|
611
563
|
$align
|
|
612
564
|
}) => {
|
|
@@ -617,7 +569,6 @@ const getTextAlignment = () => ({
|
|
|
617
569
|
};
|
|
618
570
|
return alignments[$align];
|
|
619
571
|
};
|
|
620
|
-
|
|
621
572
|
const StyledText$4 = tw.text`
|
|
622
573
|
tu-text
|
|
623
574
|
${getFontColor$1()}
|
|
@@ -635,7 +586,6 @@ const StyledText$4 = tw.text`
|
|
|
635
586
|
* @param {AlertProps} props - The props for the Alert component
|
|
636
587
|
* @returns {JSX.Element} Alert component
|
|
637
588
|
*/
|
|
638
|
-
|
|
639
589
|
const Alert = ({
|
|
640
590
|
color = "info",
|
|
641
591
|
title,
|
|
@@ -649,7 +599,6 @@ const Alert = ({
|
|
|
649
599
|
inline = false
|
|
650
600
|
}) => {
|
|
651
601
|
const ref = React.useRef();
|
|
652
|
-
|
|
653
602
|
const getIconFromColor = () => {
|
|
654
603
|
switch (color) {
|
|
655
604
|
case "danger":
|
|
@@ -657,39 +606,32 @@ const Alert = ({
|
|
|
657
606
|
name: "ExclamationIcon",
|
|
658
607
|
color: "danger"
|
|
659
608
|
});
|
|
660
|
-
|
|
661
609
|
case "warning":
|
|
662
610
|
return jsx(Icon$1, {
|
|
663
611
|
name: "ExclamationCircleIcon",
|
|
664
612
|
color: "warning"
|
|
665
613
|
});
|
|
666
|
-
|
|
667
614
|
case "success":
|
|
668
615
|
return jsx(Icon$1, {
|
|
669
616
|
name: "CheckCircleIcon",
|
|
670
617
|
color: "success"
|
|
671
618
|
});
|
|
672
|
-
|
|
673
619
|
default:
|
|
674
620
|
return jsx(Icon$1, {
|
|
675
621
|
name: "InformationCircleIcon"
|
|
676
622
|
});
|
|
677
623
|
}
|
|
678
624
|
};
|
|
679
|
-
|
|
680
625
|
const getButtonColor = () => {
|
|
681
626
|
switch (color) {
|
|
682
627
|
case "danger":
|
|
683
628
|
return "danger";
|
|
684
|
-
|
|
685
629
|
case "warning":
|
|
686
630
|
return "warning";
|
|
687
|
-
|
|
688
631
|
default:
|
|
689
632
|
return "primary";
|
|
690
633
|
}
|
|
691
634
|
};
|
|
692
|
-
|
|
693
635
|
const body = inline ? jsxs("div", {
|
|
694
636
|
children: [title && jsx(Text$1, Object.assign({
|
|
695
637
|
weight: "bold"
|
|
@@ -793,7 +735,6 @@ const Alert = ({
|
|
|
793
735
|
const CloseButtonContainer = tw.div`
|
|
794
736
|
${p => p.$inline ? tws`tu-alert__close-button-container--inline` : tws`tu-alert__close-button-container`}
|
|
795
737
|
`;
|
|
796
|
-
|
|
797
738
|
const getBackgroundColor = () => ({
|
|
798
739
|
$color
|
|
799
740
|
}) => {
|
|
@@ -805,7 +746,6 @@ const getBackgroundColor = () => ({
|
|
|
805
746
|
};
|
|
806
747
|
return colors[$color];
|
|
807
748
|
};
|
|
808
|
-
|
|
809
749
|
const Container$7 = tw.div`
|
|
810
750
|
tu-alert
|
|
811
751
|
${p => p.$inline ? tws`tu-alert--inline` : null}
|
|
@@ -838,23 +778,20 @@ const IconContainer$1 = tw.div`
|
|
|
838
778
|
* @param {BadgeProps} props - The props for the Badge component
|
|
839
779
|
* @returns {JSX.Element} Badge component
|
|
840
780
|
*/
|
|
841
|
-
|
|
842
781
|
const Badge = _a => {
|
|
843
782
|
var {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
783
|
+
color = "danger",
|
|
784
|
+
subtle = false,
|
|
785
|
+
className,
|
|
786
|
+
count,
|
|
787
|
+
max,
|
|
788
|
+
hideZero = false,
|
|
789
|
+
dataTestId
|
|
790
|
+
} = _a;
|
|
791
|
+
__rest(_a, ["color", "subtle", "className", "count", "max", "hideZero", "dataTestId"]);
|
|
854
792
|
if (hideZero && count === 0) {
|
|
855
793
|
return null;
|
|
856
794
|
}
|
|
857
|
-
|
|
858
795
|
const displayedCount = count && max ? count > max ? `${max}+` : count : count;
|
|
859
796
|
return jsx(StyledText$3, Object.assign({
|
|
860
797
|
className: className,
|
|
@@ -867,7 +804,6 @@ const Badge = _a => {
|
|
|
867
804
|
children: displayedCount
|
|
868
805
|
}));
|
|
869
806
|
};
|
|
870
|
-
|
|
871
807
|
const getBadgeModifierClass = () => ({
|
|
872
808
|
$color,
|
|
873
809
|
$subtle
|
|
@@ -891,7 +827,6 @@ const getBadgeModifierClass = () => ({
|
|
|
891
827
|
};
|
|
892
828
|
return colorClasses[$color];
|
|
893
829
|
};
|
|
894
|
-
|
|
895
830
|
const StyledText$3 = tw.text`
|
|
896
831
|
tu-badge
|
|
897
832
|
${({
|
|
@@ -908,22 +843,20 @@ const StyledText$3 = tw.text`
|
|
|
908
843
|
* For specific input types make sure to use the corresponding input component.
|
|
909
844
|
* This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
|
|
910
845
|
*/
|
|
911
|
-
|
|
912
846
|
const BaseInput = React.forwardRef((_a, ref) => {
|
|
913
847
|
var {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
848
|
+
className,
|
|
849
|
+
isInvalid,
|
|
850
|
+
dataTestId,
|
|
851
|
+
prefix,
|
|
852
|
+
suffix,
|
|
853
|
+
addonBefore,
|
|
854
|
+
addonAfter,
|
|
855
|
+
actions,
|
|
856
|
+
fieldSize = "medium",
|
|
857
|
+
nonInteractive = false
|
|
858
|
+
} = _a,
|
|
859
|
+
rest = __rest(_a, ["className", "isInvalid", "dataTestId", "prefix", "suffix", "addonBefore", "addonAfter", "actions", "fieldSize", "nonInteractive"]);
|
|
927
860
|
return jsxs(InputContainer$1, Object.assign({
|
|
928
861
|
"$fieldSize": fieldSize,
|
|
929
862
|
"$invalid": isInvalid,
|
|
@@ -989,7 +922,6 @@ const ROLE_CARD = "region";
|
|
|
989
922
|
* @param {CardProps} props - The props for the Card component
|
|
990
923
|
* @returns {JSX.Element} Card component
|
|
991
924
|
*/
|
|
992
|
-
|
|
993
925
|
const Card = ({
|
|
994
926
|
children,
|
|
995
927
|
onClick,
|
|
@@ -1017,14 +949,12 @@ const Card = ({
|
|
|
1017
949
|
children: children
|
|
1018
950
|
}));
|
|
1019
951
|
};
|
|
1020
|
-
|
|
1021
952
|
const getOverflow$1 = () => ({
|
|
1022
953
|
$overflow
|
|
1023
954
|
}) => {
|
|
1024
955
|
if (!$overflow) {
|
|
1025
956
|
return null;
|
|
1026
957
|
}
|
|
1027
|
-
|
|
1028
958
|
const overflows = {
|
|
1029
959
|
visible: tws`overflow-visible`,
|
|
1030
960
|
hidden: tws`overflow-hidden`,
|
|
@@ -1033,7 +963,6 @@ const getOverflow$1 = () => ({
|
|
|
1033
963
|
};
|
|
1034
964
|
return overflows[$overflow];
|
|
1035
965
|
};
|
|
1036
|
-
|
|
1037
966
|
const StyledCard$1 = tw.div`
|
|
1038
967
|
tu-card
|
|
1039
968
|
${p => p.$fullHeight ? `h-full` : null}
|
|
@@ -1050,7 +979,6 @@ const StyledCard$1 = tw.div`
|
|
|
1050
979
|
* @param {ContainerProps} props - The props for the DensityContainer component
|
|
1051
980
|
* @returns {JSX.Element} DensityContainer component
|
|
1052
981
|
*/
|
|
1053
|
-
|
|
1054
982
|
const DensityContainer = ({
|
|
1055
983
|
children,
|
|
1056
984
|
className,
|
|
@@ -1069,7 +997,6 @@ const DensityContainer = ({
|
|
|
1069
997
|
children: children
|
|
1070
998
|
}));
|
|
1071
999
|
};
|
|
1072
|
-
|
|
1073
1000
|
const getDirection = () => ({
|
|
1074
1001
|
$direction
|
|
1075
1002
|
}) => {
|
|
@@ -1082,7 +1009,6 @@ const getDirection = () => ({
|
|
|
1082
1009
|
};
|
|
1083
1010
|
return directions[$direction];
|
|
1084
1011
|
};
|
|
1085
|
-
|
|
1086
1012
|
const densityAuto = tws`
|
|
1087
1013
|
gap-3
|
|
1088
1014
|
p-3
|
|
@@ -1091,29 +1017,23 @@ const densityAuto = tws`
|
|
|
1091
1017
|
md:gap-4
|
|
1092
1018
|
md:p-6
|
|
1093
1019
|
`;
|
|
1094
|
-
|
|
1095
1020
|
const DensityFinder = ({
|
|
1096
1021
|
$density
|
|
1097
1022
|
}) => {
|
|
1098
1023
|
switch ($density) {
|
|
1099
1024
|
case "none":
|
|
1100
1025
|
return;
|
|
1101
|
-
|
|
1102
1026
|
case "compact":
|
|
1103
1027
|
return tws`gap-3 p-3`;
|
|
1104
|
-
|
|
1105
1028
|
case "comfortable":
|
|
1106
1029
|
return tws`gap-4 p-4`;
|
|
1107
|
-
|
|
1108
1030
|
case "spacious":
|
|
1109
1031
|
return tws`gap-4 p-6`;
|
|
1110
|
-
|
|
1111
1032
|
case "auto":
|
|
1112
1033
|
default:
|
|
1113
1034
|
return densityAuto;
|
|
1114
1035
|
}
|
|
1115
1036
|
};
|
|
1116
|
-
|
|
1117
1037
|
const StyledDensityContainer$1 = tw.div`
|
|
1118
1038
|
flex
|
|
1119
1039
|
${getDirection()}
|
|
@@ -1129,7 +1049,6 @@ ${DensityFinder}
|
|
|
1129
1049
|
* @param {CardBodyProps} props - The props for the CardBody component
|
|
1130
1050
|
* @returns {JSX.Element} CardBody component
|
|
1131
1051
|
*/
|
|
1132
|
-
|
|
1133
1052
|
const CardBody = ({
|
|
1134
1053
|
density = "auto",
|
|
1135
1054
|
overflow = "auto",
|
|
@@ -1148,14 +1067,12 @@ const CardBody = ({
|
|
|
1148
1067
|
children: children
|
|
1149
1068
|
}));
|
|
1150
1069
|
};
|
|
1151
|
-
|
|
1152
1070
|
const getOverflow = () => ({
|
|
1153
1071
|
$overflow
|
|
1154
1072
|
}) => {
|
|
1155
1073
|
if (!$overflow) {
|
|
1156
1074
|
return null;
|
|
1157
1075
|
}
|
|
1158
|
-
|
|
1159
1076
|
const overflows = {
|
|
1160
1077
|
visible: tws`overflow-visible`,
|
|
1161
1078
|
hidden: tws`overflow-hidden`,
|
|
@@ -1164,7 +1081,6 @@ const getOverflow = () => ({
|
|
|
1164
1081
|
};
|
|
1165
1082
|
return overflows[$overflow];
|
|
1166
1083
|
};
|
|
1167
|
-
|
|
1168
1084
|
const StyledDensityContainer = twx(DensityContainer)`
|
|
1169
1085
|
${getOverflow()}
|
|
1170
1086
|
tu-card__body
|
|
@@ -1178,7 +1094,6 @@ const StyledDensityContainer = twx(DensityContainer)`
|
|
|
1178
1094
|
* @param {CardFooterProps} props - The props for the CardFooter component
|
|
1179
1095
|
* @returns {JSX.Element} CardFooter component
|
|
1180
1096
|
*/
|
|
1181
|
-
|
|
1182
1097
|
const CardFooter = ({
|
|
1183
1098
|
dataTestId,
|
|
1184
1099
|
className,
|
|
@@ -1208,7 +1123,6 @@ const Body = tw.div`
|
|
|
1208
1123
|
* @param {HeadingProps} props - The props for the Heading component
|
|
1209
1124
|
* @returns {JSX.Element} Heading component
|
|
1210
1125
|
*/
|
|
1211
|
-
|
|
1212
1126
|
const Heading$1 = ({
|
|
1213
1127
|
children,
|
|
1214
1128
|
variant = "primary",
|
|
@@ -1234,7 +1148,6 @@ const Heading$1 = ({
|
|
|
1234
1148
|
children: children
|
|
1235
1149
|
}));
|
|
1236
1150
|
};
|
|
1237
|
-
|
|
1238
1151
|
const getVariantStyles = () => ({
|
|
1239
1152
|
$variant
|
|
1240
1153
|
}) => {
|
|
@@ -1246,7 +1159,6 @@ const getVariantStyles = () => ({
|
|
|
1246
1159
|
};
|
|
1247
1160
|
return variants[$variant];
|
|
1248
1161
|
};
|
|
1249
|
-
|
|
1250
1162
|
const getFontColor = () => ({
|
|
1251
1163
|
$inverted,
|
|
1252
1164
|
$subtle
|
|
@@ -1255,7 +1167,6 @@ const getFontColor = () => ({
|
|
|
1255
1167
|
const inverted = $inverted ? tws`tu-heading--inverted` : null;
|
|
1256
1168
|
return $subtle ? subtle : inverted;
|
|
1257
1169
|
};
|
|
1258
|
-
|
|
1259
1170
|
const StyledHeading = tw.div`
|
|
1260
1171
|
tu-heading
|
|
1261
1172
|
${getFontColor()}
|
|
@@ -1268,7 +1179,6 @@ const StyledHeading = tw.div`
|
|
|
1268
1179
|
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
1269
1180
|
* @returns {JSX.Element} CardHeader component
|
|
1270
1181
|
*/
|
|
1271
|
-
|
|
1272
1182
|
const CardHeader = ({
|
|
1273
1183
|
heading,
|
|
1274
1184
|
headingVariant = "primary",
|
|
@@ -1332,7 +1242,6 @@ const HeadingContainer$1 = tw.div`
|
|
|
1332
1242
|
* @param {ChartProps} props - The props for the Chart component
|
|
1333
1243
|
* @returns {JSX.Element} Chart component
|
|
1334
1244
|
*/
|
|
1335
|
-
|
|
1336
1245
|
const Chart = ({
|
|
1337
1246
|
options,
|
|
1338
1247
|
showLoading,
|
|
@@ -1352,46 +1261,35 @@ const Chart = ({
|
|
|
1352
1261
|
dataTestId
|
|
1353
1262
|
}) => {
|
|
1354
1263
|
var _a, _b;
|
|
1355
|
-
|
|
1356
1264
|
const echartsRef = React.useRef(null);
|
|
1357
1265
|
const eventHandlers = React.useMemo(() => {
|
|
1358
1266
|
const values = {};
|
|
1359
|
-
|
|
1360
1267
|
if (onDataZoom !== undefined) {
|
|
1361
1268
|
values.dataZoom = onDataZoom;
|
|
1362
1269
|
}
|
|
1363
|
-
|
|
1364
1270
|
if (onBrush !== undefined) {
|
|
1365
1271
|
values.brush = onBrush;
|
|
1366
1272
|
}
|
|
1367
|
-
|
|
1368
1273
|
if (onBrushSelected !== undefined) {
|
|
1369
1274
|
values.brushSelected = onBrushSelected;
|
|
1370
1275
|
}
|
|
1371
|
-
|
|
1372
1276
|
if (mouseLeaveChart !== undefined) {
|
|
1373
1277
|
values.globalout = mouseLeaveChart;
|
|
1374
1278
|
}
|
|
1375
|
-
|
|
1376
1279
|
if (mouseMoveChart !== undefined) {
|
|
1377
1280
|
values.mouseMove = event => {
|
|
1378
1281
|
var _a;
|
|
1379
|
-
|
|
1380
1282
|
mouseMoveChart(event, (_a = echartsRef === null || echartsRef === void 0 ? void 0 : echartsRef.current) === null || _a === void 0 ? void 0 : _a.getEchartsInstance());
|
|
1381
1283
|
};
|
|
1382
1284
|
}
|
|
1383
|
-
|
|
1384
1285
|
return values;
|
|
1385
1286
|
}, [onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, mouseMoveChart]);
|
|
1386
1287
|
React.useEffect(() => {
|
|
1387
1288
|
var _a;
|
|
1388
|
-
|
|
1389
1289
|
const instance = (_a = echartsRef === null || echartsRef === void 0 ? void 0 : echartsRef.current) === null || _a === void 0 ? void 0 : _a.getEchartsInstance();
|
|
1390
|
-
|
|
1391
1290
|
if (instance && onClick) {
|
|
1392
1291
|
instance.on("click", onClick);
|
|
1393
1292
|
}
|
|
1394
|
-
|
|
1395
1293
|
return () => {
|
|
1396
1294
|
if (instance && !instance.isDisposed()) {
|
|
1397
1295
|
instance.off("click", onClick);
|
|
@@ -1446,7 +1344,6 @@ const ChartContainer = tw.div`
|
|
|
1446
1344
|
* @param {LabelProps} props - The props for the Label component
|
|
1447
1345
|
* @returns {JSX.Element} Label component
|
|
1448
1346
|
*/
|
|
1449
|
-
|
|
1450
1347
|
const Label$2 = ({
|
|
1451
1348
|
id,
|
|
1452
1349
|
htmlFor,
|
|
@@ -1483,7 +1380,6 @@ ${({
|
|
|
1483
1380
|
* @param {CheckIconProps} props - The props for the CheckIcon component
|
|
1484
1381
|
* @returns {JSX.Element} CheckIcon component
|
|
1485
1382
|
*/
|
|
1486
|
-
|
|
1487
1383
|
const CheckIcon = ({
|
|
1488
1384
|
className,
|
|
1489
1385
|
dataTestId
|
|
@@ -1511,7 +1407,6 @@ const CheckIcon = ({
|
|
|
1511
1407
|
* @param {IndeterminateIconProps} props - The props for the IndeterminateIcon component
|
|
1512
1408
|
* @returns {JSX.Element} IndeterminateIcon component
|
|
1513
1409
|
*/
|
|
1514
|
-
|
|
1515
1410
|
const IndeterminateIcon = ({
|
|
1516
1411
|
className
|
|
1517
1412
|
}) => jsx("svg", Object.assign({
|
|
@@ -1543,35 +1438,30 @@ const IndeterminateIcon = ({
|
|
|
1543
1438
|
* @param {CheckboxProps} props - The props for the Checkbox component
|
|
1544
1439
|
* @returns {JSX.Element} Checkbox component
|
|
1545
1440
|
*/
|
|
1546
|
-
|
|
1547
1441
|
const Checkbox = React.forwardRef((_a, ref) => {
|
|
1548
1442
|
var {
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1443
|
+
className,
|
|
1444
|
+
dataTestId,
|
|
1445
|
+
onChange,
|
|
1446
|
+
checked = false,
|
|
1447
|
+
disabled = false,
|
|
1448
|
+
isInvalid = false,
|
|
1449
|
+
readOnly,
|
|
1450
|
+
indeterminate = false,
|
|
1451
|
+
children,
|
|
1452
|
+
label,
|
|
1453
|
+
tabIndex = 0
|
|
1454
|
+
} = _a,
|
|
1455
|
+
rest = __rest(_a, ["className", "dataTestId", "onChange", "checked", "disabled", "isInvalid", "readOnly", "indeterminate", "children", "label", "tabIndex"]);
|
|
1563
1456
|
const icon = indeterminate ? jsx(StyledIndeterminateIcon, {}) : checked && jsx(StyledCheckIcon, {});
|
|
1564
1457
|
const internalRef = React.useRef(null);
|
|
1565
1458
|
const isReadonly = disabled || readOnly;
|
|
1566
|
-
|
|
1567
1459
|
const onKeyPress = e => {
|
|
1568
1460
|
var _a;
|
|
1569
|
-
|
|
1570
1461
|
if ("Space" === e.code) {
|
|
1571
1462
|
(_a = internalRef === null || internalRef === void 0 ? void 0 : internalRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
1572
1463
|
}
|
|
1573
1464
|
};
|
|
1574
|
-
|
|
1575
1465
|
const uuid = rest.id ? rest.id : v4();
|
|
1576
1466
|
return jsxs(CheckboxContainer, Object.assign({
|
|
1577
1467
|
"data-testid": `${dataTestId}Container`,
|
|
@@ -1625,7 +1515,6 @@ const CheckboxWrapper = tw.span`
|
|
|
1625
1515
|
if ($disabled) {
|
|
1626
1516
|
return tws`tu-checkbox--disabled`;
|
|
1627
1517
|
}
|
|
1628
|
-
|
|
1629
1518
|
return $indeterminate ? tws`tu-checkbox--indeterminate` : $checked ? tws`tu-checkbox--selected` : tws`tu-checkbox--deselected`;
|
|
1630
1519
|
}}
|
|
1631
1520
|
|
|
@@ -1640,7 +1529,6 @@ const CheckboxWrapper = tw.span`
|
|
|
1640
1529
|
* @param {CollapseProps} props - The props for the Collapse component
|
|
1641
1530
|
* @returns {JSX.Element} Collapse component
|
|
1642
1531
|
*/
|
|
1643
|
-
|
|
1644
1532
|
const Collapse = ({
|
|
1645
1533
|
id,
|
|
1646
1534
|
initialExpanded = false,
|
|
@@ -1655,7 +1543,6 @@ const Collapse = ({
|
|
|
1655
1543
|
if (onToggle) {
|
|
1656
1544
|
onToggle(e, !expanded);
|
|
1657
1545
|
}
|
|
1658
|
-
|
|
1659
1546
|
setExpanded(!expanded);
|
|
1660
1547
|
}, [expanded, onToggle]);
|
|
1661
1548
|
return jsxs(StyledCollapse, Object.assign({
|
|
@@ -1705,7 +1592,6 @@ const CollapseLabel = tw.div`
|
|
|
1705
1592
|
const LabelContainer$2 = tw.div`
|
|
1706
1593
|
tu-collapse__label__container
|
|
1707
1594
|
`;
|
|
1708
|
-
|
|
1709
1595
|
const Collapsible = ({
|
|
1710
1596
|
children,
|
|
1711
1597
|
expanded,
|
|
@@ -1727,7 +1613,6 @@ const Collapsible = ({
|
|
|
1727
1613
|
}))
|
|
1728
1614
|
}));
|
|
1729
1615
|
};
|
|
1730
|
-
|
|
1731
1616
|
const AnimatedCollapsible = tw.div`
|
|
1732
1617
|
tu-collapsible--animated
|
|
1733
1618
|
`;
|
|
@@ -1741,7 +1626,6 @@ const StyledCollapsible = tw.div`
|
|
|
1741
1626
|
* @param {CopyableTextProps} props - The props for the CopyableText component
|
|
1742
1627
|
* @returns {JSX.Element} CopyableText component
|
|
1743
1628
|
*/
|
|
1744
|
-
|
|
1745
1629
|
const CopyableText = ({
|
|
1746
1630
|
text,
|
|
1747
1631
|
alternativeText,
|
|
@@ -1749,16 +1633,13 @@ const CopyableText = ({
|
|
|
1749
1633
|
className
|
|
1750
1634
|
}) => {
|
|
1751
1635
|
var _a;
|
|
1752
|
-
|
|
1753
1636
|
const value = (_a = alternativeText !== null && alternativeText !== void 0 ? alternativeText : text) !== null && _a !== void 0 ? _a : "";
|
|
1754
1637
|
const [animating, setAnimating] = useState(false);
|
|
1755
1638
|
const [, copyToClipboard] = useCopyToClipboard();
|
|
1756
|
-
|
|
1757
1639
|
const handleOnClick = () => {
|
|
1758
1640
|
copyToClipboard(value);
|
|
1759
1641
|
setAnimating(true);
|
|
1760
1642
|
};
|
|
1761
|
-
|
|
1762
1643
|
return jsx(StyledCopyableText, Object.assign({
|
|
1763
1644
|
className: className,
|
|
1764
1645
|
"data-testid": dataTestId,
|
|
@@ -1779,24 +1660,20 @@ const StyledCopyableText = tw.span`
|
|
|
1779
1660
|
*
|
|
1780
1661
|
* NOTE: If shown with a label, please use the `DateField` component instead.
|
|
1781
1662
|
*/
|
|
1782
|
-
|
|
1783
1663
|
const DateInput = forwardRef((_a, ref) => {
|
|
1784
1664
|
var {
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1665
|
+
min,
|
|
1666
|
+
max,
|
|
1667
|
+
defaultValue,
|
|
1668
|
+
value
|
|
1669
|
+
} = _a,
|
|
1670
|
+
rest = __rest(_a, ["min", "max", "defaultValue", "value"]);
|
|
1671
|
+
const formatDateToInputString = date => date instanceof Date ? format(date, "yyyy-MM-dd") : date;
|
|
1672
|
+
// @ts-ignore
|
|
1793
1673
|
// Chrome needs it's default icon to have datepicker functionality.
|
|
1794
1674
|
// window.chrome doesn't exist in TS but is available on chrome browsers.
|
|
1795
1675
|
// If it fails it will just show our icon.
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
1676
|
const hideOnChrome = () => window.chrome !== null && typeof window.chrome !== "undefined" ? "hidden" : "";
|
|
1799
|
-
|
|
1800
1677
|
return jsx(BaseInput, Object.assign({
|
|
1801
1678
|
type: "date",
|
|
1802
1679
|
value: formatDateToInputString(value),
|
|
@@ -1818,7 +1695,6 @@ const DateInput = forwardRef((_a, ref) => {
|
|
|
1818
1695
|
* @param {PopoverProps} props The children to render in the popover
|
|
1819
1696
|
* @returns {ReactElement} Popover with specified content and placement
|
|
1820
1697
|
*/
|
|
1821
|
-
|
|
1822
1698
|
const Popover = ({
|
|
1823
1699
|
children,
|
|
1824
1700
|
render,
|
|
@@ -1856,9 +1732,9 @@ const Popover = ({
|
|
|
1856
1732
|
ignoreMouse: activation.hover
|
|
1857
1733
|
}), useHover(context, {
|
|
1858
1734
|
enabled: activation.hover
|
|
1859
|
-
}), useRole(context), useDismiss(context)]);
|
|
1735
|
+
}), useRole(context), useDismiss(context)]);
|
|
1736
|
+
// Preserve the consumer's ref
|
|
1860
1737
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1861
|
-
|
|
1862
1738
|
const ref = useMemo(() => mergeRefs([reference, children.ref]), [reference, children]);
|
|
1863
1739
|
return jsxs(Fragment, {
|
|
1864
1740
|
children: [cloneElement(children, getReferenceProps(Object.assign({
|
|
@@ -1889,8 +1765,8 @@ const Popover = ({
|
|
|
1889
1765
|
}))
|
|
1890
1766
|
})]
|
|
1891
1767
|
});
|
|
1892
|
-
};
|
|
1893
|
-
|
|
1768
|
+
};
|
|
1769
|
+
// Utility to merge refs — Heavily inspired by https://github.com/gregberge/react-merge-refs
|
|
1894
1770
|
function mergeRefs(refs) {
|
|
1895
1771
|
return value => {
|
|
1896
1772
|
refs.forEach(ref => {
|
|
@@ -1909,7 +1785,6 @@ function mergeRefs(refs) {
|
|
|
1909
1785
|
* @param {PopoverListProps} props - The props for the PopoverList component
|
|
1910
1786
|
* @returns {JSX.Element} PopoverList component
|
|
1911
1787
|
*/
|
|
1912
|
-
|
|
1913
1788
|
const PopoverList = ({
|
|
1914
1789
|
className,
|
|
1915
1790
|
children,
|
|
@@ -1941,7 +1816,6 @@ const StyledCardBody = twx(CardBody)`
|
|
|
1941
1816
|
* @param {PopoverListItemProps} props - The props for the PopoverListItem component
|
|
1942
1817
|
* @returns {JSX.Element} PopoverListItem component
|
|
1943
1818
|
*/
|
|
1944
|
-
|
|
1945
1819
|
const PopoverListItem = ({
|
|
1946
1820
|
selected,
|
|
1947
1821
|
children,
|
|
@@ -1967,7 +1841,6 @@ const PopoverListItem = ({
|
|
|
1967
1841
|
children: suffix
|
|
1968
1842
|
})]
|
|
1969
1843
|
}));
|
|
1970
|
-
|
|
1971
1844
|
return jsx(ListItem, Object.assign({
|
|
1972
1845
|
"$selected": selected,
|
|
1973
1846
|
disabled: disabled,
|
|
@@ -2001,7 +1874,6 @@ const PopoverLink = twx(Link)`
|
|
|
2001
1874
|
* @param {PopoverTitleProps} props - The props for the PopoverTitle component
|
|
2002
1875
|
* @returns {JSX.Element} PopoverTitle component
|
|
2003
1876
|
*/
|
|
2004
|
-
|
|
2005
1877
|
const PopoverTitle = ({
|
|
2006
1878
|
children,
|
|
2007
1879
|
action,
|
|
@@ -2039,34 +1911,29 @@ tu-popover-title-text
|
|
|
2039
1911
|
* @param {TooltipProps} props - The props for the Tooltip component
|
|
2040
1912
|
* @returns {JSX.Element} Tooltip component
|
|
2041
1913
|
*/
|
|
2042
|
-
|
|
2043
1914
|
const Tooltip = _a => {
|
|
2044
1915
|
var {
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
1916
|
+
children,
|
|
1917
|
+
dataTestId,
|
|
1918
|
+
disabled,
|
|
1919
|
+
className
|
|
1920
|
+
} = _a,
|
|
1921
|
+
rest = __rest(_a, ["children", "dataTestId", "disabled", "className"]);
|
|
2052
1922
|
const wrappedChildren = jsx(Flex$1, Object.assign({
|
|
2053
1923
|
className: className,
|
|
2054
1924
|
"data-testid": dataTestId && `${dataTestId}-parent`
|
|
2055
1925
|
}, {
|
|
2056
1926
|
children: children
|
|
2057
1927
|
}));
|
|
2058
|
-
|
|
2059
1928
|
if (disabled) {
|
|
2060
1929
|
return wrappedChildren;
|
|
2061
1930
|
}
|
|
2062
|
-
|
|
2063
1931
|
return jsx(TooltipContainer, Object.assign({
|
|
2064
1932
|
dataTestId: dataTestId
|
|
2065
1933
|
}, rest, {
|
|
2066
1934
|
children: wrappedChildren
|
|
2067
1935
|
}));
|
|
2068
1936
|
};
|
|
2069
|
-
|
|
2070
1937
|
const TooltipContainer = ({
|
|
2071
1938
|
label,
|
|
2072
1939
|
placement = "bottom",
|
|
@@ -2094,7 +1961,6 @@ const TooltipContainer = ({
|
|
|
2094
1961
|
}, {
|
|
2095
1962
|
children: children
|
|
2096
1963
|
}));
|
|
2097
|
-
|
|
2098
1964
|
const Flex$1 = tw.div`
|
|
2099
1965
|
inline-flex
|
|
2100
1966
|
`;
|
|
@@ -2113,7 +1979,6 @@ const Content = tw.div`
|
|
|
2113
1979
|
* @param {TipProps} props - The props for the Tip component
|
|
2114
1980
|
* @returns {JSX.Element} Tip component
|
|
2115
1981
|
*/
|
|
2116
|
-
|
|
2117
1982
|
const Tip = ({
|
|
2118
1983
|
children,
|
|
2119
1984
|
iconProps,
|
|
@@ -2158,7 +2023,6 @@ const TipContainer = tw.text`
|
|
|
2158
2023
|
* @param {FormGroupProps} props - The props for the FormGroup component
|
|
2159
2024
|
* @returns {JSX.Element} FormGroup component
|
|
2160
2025
|
*/
|
|
2161
|
-
|
|
2162
2026
|
const FormGroup = ({
|
|
2163
2027
|
isInvalid,
|
|
2164
2028
|
helpText,
|
|
@@ -2228,21 +2092,19 @@ const HelpAddon = tw.span`
|
|
|
2228
2092
|
*
|
|
2229
2093
|
* _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
|
|
2230
2094
|
*/
|
|
2231
|
-
|
|
2232
2095
|
const DateField = forwardRef((_a, ref) => {
|
|
2233
2096
|
var {
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2097
|
+
label,
|
|
2098
|
+
tip,
|
|
2099
|
+
helpText,
|
|
2100
|
+
errorMessage,
|
|
2101
|
+
helpAddon,
|
|
2102
|
+
isInvalid,
|
|
2103
|
+
className,
|
|
2104
|
+
defaultValue,
|
|
2105
|
+
dataTestId
|
|
2106
|
+
} = _a,
|
|
2107
|
+
rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "className", "defaultValue", "dataTestId"]);
|
|
2246
2108
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
2247
2109
|
return jsx(FormGroup, Object.assign({
|
|
2248
2110
|
label: label,
|
|
@@ -2292,7 +2154,6 @@ const localeLookup = {
|
|
|
2292
2154
|
* @param {string} language The language to match
|
|
2293
2155
|
* @returns {Locale} The corresponding Locale object
|
|
2294
2156
|
*/
|
|
2295
|
-
|
|
2296
2157
|
const useLocale = language => {
|
|
2297
2158
|
return localeLookup[language] || localeLookup.en;
|
|
2298
2159
|
};
|
|
@@ -2303,7 +2164,6 @@ const useLocale = language => {
|
|
|
2303
2164
|
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
2304
2165
|
* @returns {JSX.Element} DayPicker component
|
|
2305
2166
|
*/
|
|
2306
|
-
|
|
2307
2167
|
const DayPicker = ({
|
|
2308
2168
|
onDaySelect,
|
|
2309
2169
|
disabledDays,
|
|
@@ -2333,7 +2193,6 @@ const DayPicker = ({
|
|
|
2333
2193
|
* @param {DayPickerPopoverProps} props - The props for the DayPickerPopover component
|
|
2334
2194
|
* @returns {JSX.Element} DayPickerPopover component
|
|
2335
2195
|
*/
|
|
2336
|
-
|
|
2337
2196
|
const DayPickerPopover = ({
|
|
2338
2197
|
disabledDays,
|
|
2339
2198
|
className,
|
|
@@ -2378,7 +2237,6 @@ const DayPickerPopover = ({
|
|
|
2378
2237
|
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
2379
2238
|
* @returns {JSX.Element} DayRangePicker component
|
|
2380
2239
|
*/
|
|
2381
|
-
|
|
2382
2240
|
const DayRangePicker = ({
|
|
2383
2241
|
onRangeSelect,
|
|
2384
2242
|
selectedDays,
|
|
@@ -2393,7 +2251,6 @@ const DayRangePicker = ({
|
|
|
2393
2251
|
if (onRangeSelect && range === undefined) {
|
|
2394
2252
|
onRangeSelect(undefined);
|
|
2395
2253
|
}
|
|
2396
|
-
|
|
2397
2254
|
if (onRangeSelect && range) {
|
|
2398
2255
|
const from = range.from;
|
|
2399
2256
|
const to = range.to ? range.to : range.from;
|
|
@@ -2430,19 +2287,17 @@ const DayRangePicker = ({
|
|
|
2430
2287
|
* @param {IndicatorProps} props - The props for the Indicator component
|
|
2431
2288
|
* @returns {JSX.Element} Indicator component
|
|
2432
2289
|
*/
|
|
2433
|
-
|
|
2434
2290
|
const Indicator$1 = _a => {
|
|
2435
2291
|
var {
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2292
|
+
dataTestId,
|
|
2293
|
+
icon,
|
|
2294
|
+
label,
|
|
2295
|
+
color = "unknown",
|
|
2296
|
+
withBackground = true,
|
|
2297
|
+
withLabel = true,
|
|
2298
|
+
ping = false
|
|
2299
|
+
} = _a,
|
|
2300
|
+
rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping"]);
|
|
2446
2301
|
return jsxs(Container$4, Object.assign({
|
|
2447
2302
|
"$color": color,
|
|
2448
2303
|
"data-testid": dataTestId
|
|
@@ -2471,70 +2326,50 @@ const Container$4 = tw.div`
|
|
|
2471
2326
|
switch ($color) {
|
|
2472
2327
|
case "primary":
|
|
2473
2328
|
return tws`tu-indicator--primary`;
|
|
2474
|
-
|
|
2475
2329
|
case "secondary":
|
|
2476
2330
|
return tws`tu-indicator--secondary`;
|
|
2477
|
-
|
|
2478
2331
|
case "accent":
|
|
2479
2332
|
return tws`tu-indicator--accent`;
|
|
2480
|
-
|
|
2481
2333
|
case "neutral":
|
|
2482
2334
|
return tws`tu-indicator--neutral`;
|
|
2483
|
-
|
|
2484
2335
|
case "info":
|
|
2485
2336
|
return tws`tu-indicator--info`;
|
|
2486
|
-
|
|
2487
2337
|
case "success":
|
|
2488
2338
|
return tws`tu-indicator--success`;
|
|
2489
|
-
|
|
2490
2339
|
case "warning":
|
|
2491
2340
|
return tws`tu-indicator--warning`;
|
|
2492
|
-
|
|
2493
2341
|
case "danger":
|
|
2494
2342
|
return tws`tu-indicator--danger`;
|
|
2495
|
-
|
|
2496
2343
|
case "good":
|
|
2497
2344
|
return tws`tu-indicator--good`;
|
|
2498
|
-
|
|
2499
2345
|
case "low":
|
|
2500
2346
|
return tws`tu-indicator--low`;
|
|
2501
|
-
|
|
2502
2347
|
case "critical":
|
|
2503
2348
|
return tws`tu-indicator--critical`;
|
|
2504
|
-
|
|
2505
2349
|
case "working":
|
|
2506
2350
|
return tws`tu-indicator--working`;
|
|
2507
|
-
|
|
2508
2351
|
case "idle":
|
|
2509
2352
|
return tws`tu-indicator--idle`;
|
|
2510
|
-
|
|
2511
2353
|
case "stopped":
|
|
2512
2354
|
return tws`tu-indicator--stopped`;
|
|
2513
|
-
|
|
2355
|
+
case "moving":
|
|
2356
|
+
return tws`tu-indicator--moving`;
|
|
2514
2357
|
case "unknown":
|
|
2515
2358
|
return tws`tu-indicator--unknown`;
|
|
2516
|
-
|
|
2517
2359
|
case "on_rent":
|
|
2518
2360
|
return tws`tu-indicator--on-rent`;
|
|
2519
|
-
|
|
2520
2361
|
case "available":
|
|
2521
2362
|
return tws`tu-indicator--available`;
|
|
2522
|
-
|
|
2523
2363
|
case "pickup_ready":
|
|
2524
2364
|
return tws`tu-indicator--pickup-ready`;
|
|
2525
|
-
|
|
2526
2365
|
case "transfer":
|
|
2527
2366
|
return tws`tu-indicator--transfer`;
|
|
2528
|
-
|
|
2529
2367
|
case "in_repair":
|
|
2530
2368
|
return tws`tu-indicator--in-repair`;
|
|
2531
|
-
|
|
2532
2369
|
case "returned":
|
|
2533
2370
|
return tws`tu-indicator--returned`;
|
|
2534
|
-
|
|
2535
2371
|
case "other_rental_status":
|
|
2536
2372
|
return tws`tu-indicator--other-rental-status`;
|
|
2537
|
-
|
|
2538
2373
|
default:
|
|
2539
2374
|
return "";
|
|
2540
2375
|
}
|
|
@@ -2562,7 +2397,6 @@ const Ping = tw.span`
|
|
|
2562
2397
|
* @param {ILegendItem} props - The props for the LegendItem component
|
|
2563
2398
|
* @returns {JSX.Element} LegendItem component
|
|
2564
2399
|
*/
|
|
2565
|
-
|
|
2566
2400
|
const LegendItem = ({
|
|
2567
2401
|
className,
|
|
2568
2402
|
label,
|
|
@@ -2617,7 +2451,6 @@ const Indicator = tw.div`
|
|
|
2617
2451
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
2618
2452
|
* @returns {JSX.Element} MenuItem component
|
|
2619
2453
|
*/
|
|
2620
|
-
|
|
2621
2454
|
const MenuItem = ({
|
|
2622
2455
|
className,
|
|
2623
2456
|
dataTestId,
|
|
@@ -2695,20 +2528,16 @@ const Label = tw.div`
|
|
|
2695
2528
|
* @param {MenuListProps} props - The props for the MenuList component
|
|
2696
2529
|
* @returns {JSX.Element} MenuList component
|
|
2697
2530
|
*/
|
|
2698
|
-
|
|
2699
2531
|
const MenuList = _a => {
|
|
2700
2532
|
var {
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2533
|
+
dataTestId,
|
|
2534
|
+
className,
|
|
2535
|
+
children,
|
|
2536
|
+
showDivider = false
|
|
2537
|
+
} = _a;
|
|
2538
|
+
__rest(_a, ["dataTestId", "className", "children", "showDivider"]);
|
|
2708
2539
|
const childrenArr = Children.toArray(children);
|
|
2709
|
-
|
|
2710
2540
|
const isLastItem = index => index === childrenArr.length - 1;
|
|
2711
|
-
|
|
2712
2541
|
return jsx(Container$2, Object.assign({
|
|
2713
2542
|
"data-testid": dataTestId,
|
|
2714
2543
|
className: className,
|
|
@@ -2727,14 +2556,11 @@ const Divider = tw.hr`
|
|
|
2727
2556
|
`;
|
|
2728
2557
|
|
|
2729
2558
|
var DotsDirection;
|
|
2730
|
-
|
|
2731
2559
|
(function (DotsDirection) {
|
|
2732
2560
|
DotsDirection[DotsDirection["horizontal"] = 0] = "horizontal";
|
|
2733
2561
|
DotsDirection[DotsDirection["vertical"] = 1] = "vertical";
|
|
2734
2562
|
})(DotsDirection || (DotsDirection = {}));
|
|
2735
|
-
|
|
2736
2563
|
var MenuPlacement;
|
|
2737
|
-
|
|
2738
2564
|
(function (MenuPlacement) {
|
|
2739
2565
|
MenuPlacement[MenuPlacement["above"] = 0] = "above";
|
|
2740
2566
|
MenuPlacement[MenuPlacement["below"] = 1] = "below";
|
|
@@ -2746,8 +2572,6 @@ var MenuPlacement;
|
|
|
2746
2572
|
* @param {MoreMenuProps} props - The props for the MoreMenu component
|
|
2747
2573
|
* @returns {JSX.Element} MoreMenu component
|
|
2748
2574
|
*/
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
2575
|
const MoreMenu = ({
|
|
2752
2576
|
className,
|
|
2753
2577
|
dataTestId,
|
|
@@ -2797,7 +2621,6 @@ const Root$3 = tw.div`
|
|
|
2797
2621
|
* @param {ModalBackdropProps} props - The props for the ModalBackdrop component
|
|
2798
2622
|
* @returns {JSX.Element} ModalBackdrop component
|
|
2799
2623
|
*/
|
|
2800
|
-
|
|
2801
2624
|
const ModalBackdrop = ({
|
|
2802
2625
|
children,
|
|
2803
2626
|
isVisible,
|
|
@@ -2808,9 +2631,8 @@ const ModalBackdrop = ({
|
|
|
2808
2631
|
ref: ref,
|
|
2809
2632
|
"$isVisible": isVisible,
|
|
2810
2633
|
onMouseDown: e => {
|
|
2811
|
-
var _a, _b;
|
|
2812
|
-
|
|
2813
|
-
|
|
2634
|
+
var _a, _b;
|
|
2635
|
+
// only react on click on backdrop - accessing first child to get around styled element element
|
|
2814
2636
|
if (ref.current !== null) {
|
|
2815
2637
|
if ((e === null || e === void 0 ? void 0 : e.target) === ((_b = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[0])) {
|
|
2816
2638
|
onClick();
|
|
@@ -2835,7 +2657,6 @@ const Backdrop = tw.div`
|
|
|
2835
2657
|
* - Modals interrupt a user's workflow by design.
|
|
2836
2658
|
* - The modal component provides a foundation for creating dialogs, lightboxes, etc.
|
|
2837
2659
|
*/
|
|
2838
|
-
|
|
2839
2660
|
const Modal = React.forwardRef(({
|
|
2840
2661
|
isOpen,
|
|
2841
2662
|
children,
|
|
@@ -2863,7 +2684,6 @@ const Modal = React.forwardRef(({
|
|
|
2863
2684
|
}))
|
|
2864
2685
|
}));
|
|
2865
2686
|
});
|
|
2866
|
-
|
|
2867
2687
|
const getCardMaxWidth = () => ({
|
|
2868
2688
|
maxWidth
|
|
2869
2689
|
}) => {
|
|
@@ -2877,7 +2697,6 @@ const getCardMaxWidth = () => ({
|
|
|
2877
2697
|
};
|
|
2878
2698
|
return widths[maxWidth];
|
|
2879
2699
|
};
|
|
2880
|
-
|
|
2881
2700
|
const StyledCard = twx(Card)`
|
|
2882
2701
|
tu-modal__card
|
|
2883
2702
|
${getCardMaxWidth()}
|
|
@@ -2892,7 +2711,6 @@ const StyledDiv = tw.div`
|
|
|
2892
2711
|
* @param {UseModalProps} props - The props for the useModal hook
|
|
2893
2712
|
* @returns {*} useModal return
|
|
2894
2713
|
*/
|
|
2895
|
-
|
|
2896
2714
|
const useModal = ({
|
|
2897
2715
|
closeOnOutsideClick
|
|
2898
2716
|
} = {}) => {
|
|
@@ -2911,22 +2729,18 @@ const useModal = ({
|
|
|
2911
2729
|
if (!closeOnOutsideClick) {
|
|
2912
2730
|
return;
|
|
2913
2731
|
}
|
|
2914
|
-
|
|
2915
2732
|
const clickingOutsideModal = modalRef && modalRef.current && !modalRef.current.contains(target);
|
|
2916
|
-
|
|
2917
2733
|
if (clickingOutsideModal) {
|
|
2918
2734
|
closePortal();
|
|
2919
2735
|
}
|
|
2920
2736
|
}
|
|
2921
2737
|
});
|
|
2922
|
-
|
|
2923
2738
|
const PortalWrapper = props => jsx(Portal, {
|
|
2924
2739
|
children: jsx(Modal, Object.assign({
|
|
2925
2740
|
ref: modalRef,
|
|
2926
2741
|
isOpen: isOpen
|
|
2927
2742
|
}, props))
|
|
2928
2743
|
});
|
|
2929
|
-
|
|
2930
2744
|
PortalWrapper.displayName = "Modal";
|
|
2931
2745
|
const WrappedModal = useCallback(PortalWrapper, [Portal, isOpen]);
|
|
2932
2746
|
return {
|
|
@@ -2943,7 +2757,6 @@ const useModal = ({
|
|
|
2943
2757
|
*
|
|
2944
2758
|
* NOTE: If shown with a label, please use the `NumberField` component instead.
|
|
2945
2759
|
*/
|
|
2946
|
-
|
|
2947
2760
|
const NumberInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
|
|
2948
2761
|
ref: ref,
|
|
2949
2762
|
type: "number"
|
|
@@ -2956,22 +2769,20 @@ const NumberInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
|
|
|
2956
2769
|
*
|
|
2957
2770
|
* _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
|
|
2958
2771
|
*/
|
|
2959
|
-
|
|
2960
2772
|
const NumberField = forwardRef((_a, ref) => {
|
|
2961
2773
|
var {
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2774
|
+
label,
|
|
2775
|
+
tip,
|
|
2776
|
+
helpText,
|
|
2777
|
+
errorMessage,
|
|
2778
|
+
helpAddon,
|
|
2779
|
+
isInvalid,
|
|
2780
|
+
maxLength,
|
|
2781
|
+
className,
|
|
2782
|
+
value,
|
|
2783
|
+
dataTestId
|
|
2784
|
+
} = _a,
|
|
2785
|
+
rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "maxLength", "className", "value", "dataTestId"]);
|
|
2975
2786
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
2976
2787
|
return jsx(FormGroup, Object.assign({
|
|
2977
2788
|
label: label,
|
|
@@ -3005,18 +2816,16 @@ const NumberField = forwardRef((_a, ref) => {
|
|
|
3005
2816
|
* @param {TagProps} props - The props for the tag component
|
|
3006
2817
|
* @returns {JSX.Element} tag component
|
|
3007
2818
|
*/
|
|
3008
|
-
|
|
3009
2819
|
const Tag = React.forwardRef((_a, ref) => {
|
|
3010
2820
|
var {
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
2821
|
+
className,
|
|
2822
|
+
dataTestId,
|
|
2823
|
+
children,
|
|
2824
|
+
size = "medium",
|
|
2825
|
+
onClose,
|
|
2826
|
+
color = "primary"
|
|
2827
|
+
} = _a;
|
|
2828
|
+
__rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
|
|
3020
2829
|
return jsxs(StyledText, Object.assign({
|
|
3021
2830
|
className: className,
|
|
3022
2831
|
"$size": size,
|
|
@@ -3026,7 +2835,8 @@ const Tag = React.forwardRef((_a, ref) => {
|
|
|
3026
2835
|
"$withXIcon": !!onClose,
|
|
3027
2836
|
ref: ref
|
|
3028
2837
|
}, {
|
|
3029
|
-
children: [children, onClose &&
|
|
2838
|
+
children: [children, onClose &&
|
|
2839
|
+
// a fix for multiselect deselecting tags working together with fade out animation
|
|
3030
2840
|
jsx(IconContainer, Object.assign({
|
|
3031
2841
|
onMouseDown: onClose
|
|
3032
2842
|
}, {
|
|
@@ -3042,7 +2852,6 @@ const Tag = React.forwardRef((_a, ref) => {
|
|
|
3042
2852
|
}))]
|
|
3043
2853
|
}));
|
|
3044
2854
|
});
|
|
3045
|
-
|
|
3046
2855
|
const getSizeModifierClass = () => ({
|
|
3047
2856
|
$size,
|
|
3048
2857
|
$withXIcon
|
|
@@ -3053,7 +2862,6 @@ const getSizeModifierClass = () => ({
|
|
|
3053
2862
|
};
|
|
3054
2863
|
return tagSizeModifierClass[$size];
|
|
3055
2864
|
};
|
|
3056
|
-
|
|
3057
2865
|
const getColorModifierClass = () => ({
|
|
3058
2866
|
$color
|
|
3059
2867
|
}) => {
|
|
@@ -3076,7 +2884,6 @@ const getColorModifierClass = () => ({
|
|
|
3076
2884
|
};
|
|
3077
2885
|
return colorClasses[$color];
|
|
3078
2886
|
};
|
|
3079
|
-
|
|
3080
2887
|
const StyledText = tw.span`
|
|
3081
2888
|
tu-tag
|
|
3082
2889
|
${getSizeModifierClass()}
|
|
@@ -3094,7 +2901,6 @@ const IconContainer = tw.div`
|
|
|
3094
2901
|
* @param {PageHeaderProps} props - The props for the PageHeader component
|
|
3095
2902
|
* @returns {JSX.Element} PageHeader component
|
|
3096
2903
|
*/
|
|
3097
|
-
|
|
3098
2904
|
const PageHeader = ({
|
|
3099
2905
|
className,
|
|
3100
2906
|
dataTestId,
|
|
@@ -3150,23 +2956,18 @@ const PageHeader = ({
|
|
|
3150
2956
|
})]
|
|
3151
2957
|
}));
|
|
3152
2958
|
};
|
|
3153
|
-
|
|
3154
2959
|
function isValidHttpUrl(link) {
|
|
3155
2960
|
if (!link) {
|
|
3156
2961
|
return false;
|
|
3157
2962
|
}
|
|
3158
|
-
|
|
3159
2963
|
let url;
|
|
3160
|
-
|
|
3161
2964
|
try {
|
|
3162
2965
|
url = new URL(link);
|
|
3163
2966
|
} catch (_) {
|
|
3164
2967
|
return false;
|
|
3165
2968
|
}
|
|
3166
|
-
|
|
3167
2969
|
return url.protocol === "http:" || url.protocol === "https:";
|
|
3168
2970
|
}
|
|
3169
|
-
|
|
3170
2971
|
const StyledPageHeader = tw.div`
|
|
3171
2972
|
tu-page-header
|
|
3172
2973
|
`;
|
|
@@ -3189,7 +2990,6 @@ const StyledTip = twx(Tip)`
|
|
|
3189
2990
|
/**
|
|
3190
2991
|
* Display placeholder lines before the data gets loaded to reduce load-time frustration.
|
|
3191
2992
|
*/
|
|
3192
|
-
|
|
3193
2993
|
const SkeletonLines = memo(({
|
|
3194
2994
|
margin = "10px 0",
|
|
3195
2995
|
lines = 1,
|
|
@@ -3199,23 +2999,18 @@ const SkeletonLines = memo(({
|
|
|
3199
2999
|
dataTestId
|
|
3200
3000
|
}) => {
|
|
3201
3001
|
const skeletonLines = [];
|
|
3202
|
-
|
|
3203
3002
|
const getWidth = index => {
|
|
3204
3003
|
if (width instanceof Array) {
|
|
3205
3004
|
return width[index] || "100%";
|
|
3206
3005
|
}
|
|
3207
|
-
|
|
3208
3006
|
return width;
|
|
3209
3007
|
};
|
|
3210
|
-
|
|
3211
3008
|
const getHeight = index => {
|
|
3212
3009
|
if (height instanceof Array) {
|
|
3213
3010
|
return height[index] || "auto";
|
|
3214
3011
|
}
|
|
3215
|
-
|
|
3216
3012
|
return height;
|
|
3217
3013
|
};
|
|
3218
|
-
|
|
3219
3014
|
for (let i = 0; i < lines; i++) {
|
|
3220
3015
|
skeletonLines.push(jsx(SkeletonLine, Object.assign({
|
|
3221
3016
|
"data-testid": dataTestId,
|
|
@@ -3231,9 +3026,8 @@ const SkeletonLines = memo(({
|
|
|
3231
3026
|
children: "\u00A0"
|
|
3232
3027
|
})
|
|
3233
3028
|
}), i));
|
|
3234
|
-
}
|
|
3235
|
-
|
|
3236
|
-
|
|
3029
|
+
}
|
|
3030
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
3237
3031
|
return jsx(Fragment, {
|
|
3238
3032
|
children: skeletonLines
|
|
3239
3033
|
});
|
|
@@ -3248,7 +3042,6 @@ const SkeletonLine = tw.div`
|
|
|
3248
3042
|
* @param {IPaginationProps} props - The props for the Pagination component
|
|
3249
3043
|
* @returns {JSX.Element} Pagination component
|
|
3250
3044
|
*/
|
|
3251
|
-
|
|
3252
3045
|
const Pagination = ({
|
|
3253
3046
|
gotoPage,
|
|
3254
3047
|
previousPage,
|
|
@@ -3268,11 +3061,9 @@ const Pagination = ({
|
|
|
3268
3061
|
}) => {
|
|
3269
3062
|
const [page, setPage] = React.useState(pageIndex);
|
|
3270
3063
|
const [pageInputValue, setPageInputValue] = React.useState(String(pageIndex !== undefined ? pageIndex + 1 : 1));
|
|
3271
|
-
|
|
3272
3064
|
if (!loading && pageCount === undefined) {
|
|
3273
3065
|
throw Error("Pagination should be provided with a pageCount");
|
|
3274
3066
|
}
|
|
3275
|
-
|
|
3276
3067
|
React.useEffect(() => {
|
|
3277
3068
|
if (pageIndex !== undefined && (isNaN(pageIndex) || pageIndex < 0)) {
|
|
3278
3069
|
gotoPage(0);
|
|
@@ -3287,43 +3078,36 @@ const Pagination = ({
|
|
|
3287
3078
|
let val = parseInt(pageString);
|
|
3288
3079
|
val = isNaN(val) ? 0 : val;
|
|
3289
3080
|
val = val < 1 ? 0 : val - 1;
|
|
3290
|
-
|
|
3291
3081
|
if (pageCount !== undefined && pageCount !== null) {
|
|
3292
3082
|
val = val > pageCount ? pageCount - 1 : val;
|
|
3293
3083
|
}
|
|
3294
|
-
|
|
3295
3084
|
return val;
|
|
3296
3085
|
}, [pageCount]);
|
|
3297
3086
|
const handlePageChange = React.useCallback(action => {
|
|
3298
3087
|
const from = page;
|
|
3299
3088
|
let to = from;
|
|
3300
3089
|
let description = "";
|
|
3301
|
-
|
|
3302
3090
|
switch (action) {
|
|
3303
3091
|
case "prev":
|
|
3304
3092
|
to = from !== undefined ? from - 1 : 0;
|
|
3305
3093
|
previousPage();
|
|
3306
3094
|
description = "Previous Page";
|
|
3307
3095
|
break;
|
|
3308
|
-
|
|
3309
3096
|
case "next":
|
|
3310
3097
|
to = from !== undefined ? from + 1 : 0;
|
|
3311
3098
|
nextPage();
|
|
3312
3099
|
description = "Next Page";
|
|
3313
3100
|
break;
|
|
3314
|
-
|
|
3315
3101
|
case "manual":
|
|
3316
3102
|
to = parsePageString(pageInputValue);
|
|
3317
3103
|
gotoPage(to);
|
|
3318
3104
|
description = "Manual Page Change";
|
|
3319
3105
|
break;
|
|
3320
3106
|
}
|
|
3321
|
-
|
|
3322
3107
|
if (to) {
|
|
3323
3108
|
setPage(to);
|
|
3324
3109
|
setPageInputValue(String(to + 1));
|
|
3325
3110
|
}
|
|
3326
|
-
|
|
3327
3111
|
eventName && logPageChange && logPageChange(eventName, {
|
|
3328
3112
|
parentName,
|
|
3329
3113
|
type: "Pagination",
|
|
@@ -3332,13 +3116,10 @@ const Pagination = ({
|
|
|
3332
3116
|
action: description
|
|
3333
3117
|
});
|
|
3334
3118
|
}, [page, logPageChange, eventName, parentName, previousPage, nextPage, parsePageString, pageInputValue, gotoPage]);
|
|
3335
|
-
|
|
3336
3119
|
const handleOnBlur = () => {
|
|
3337
3120
|
handlePageChange("manual");
|
|
3338
3121
|
};
|
|
3339
|
-
|
|
3340
3122
|
const handleOnFocus = e => e.target.select();
|
|
3341
|
-
|
|
3342
3123
|
const handleOnChange = React.useCallback(e => {
|
|
3343
3124
|
setPageInputValue(e.target.value);
|
|
3344
3125
|
}, []);
|
|
@@ -3346,10 +3127,8 @@ const Pagination = ({
|
|
|
3346
3127
|
if (e.key !== "Enter") {
|
|
3347
3128
|
return;
|
|
3348
3129
|
}
|
|
3349
|
-
|
|
3350
3130
|
handlePageChange("manual");
|
|
3351
3131
|
}, [handlePageChange]);
|
|
3352
|
-
|
|
3353
3132
|
if (loading) {
|
|
3354
3133
|
return jsx(Root$2, Object.assign({
|
|
3355
3134
|
className: className
|
|
@@ -3360,7 +3139,6 @@ const Pagination = ({
|
|
|
3360
3139
|
})
|
|
3361
3140
|
}));
|
|
3362
3141
|
}
|
|
3363
|
-
|
|
3364
3142
|
return jsxs(Root$2, Object.assign({
|
|
3365
3143
|
"data-testid": dataTestId,
|
|
3366
3144
|
className: className
|
|
@@ -3429,17 +3207,13 @@ function useConfirmExit(confirmExit, when = true) {
|
|
|
3429
3207
|
if (!when) {
|
|
3430
3208
|
return;
|
|
3431
3209
|
}
|
|
3432
|
-
|
|
3433
3210
|
const push = navigator.push;
|
|
3434
|
-
|
|
3435
3211
|
navigator.push = (...args) => {
|
|
3436
3212
|
const result = confirmExit();
|
|
3437
|
-
|
|
3438
3213
|
if (result !== false) {
|
|
3439
3214
|
push(...args);
|
|
3440
3215
|
}
|
|
3441
3216
|
};
|
|
3442
|
-
|
|
3443
3217
|
return () => {
|
|
3444
3218
|
navigator.push = push;
|
|
3445
3219
|
};
|
|
@@ -3452,8 +3226,6 @@ function useConfirmExit(confirmExit, when = true) {
|
|
|
3452
3226
|
* @param {boolean} when -
|
|
3453
3227
|
* @returns {void} void
|
|
3454
3228
|
*/
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
3229
|
const usePrompt = (message, when = true) => {
|
|
3458
3230
|
useEffect(() => {
|
|
3459
3231
|
if (when) {
|
|
@@ -3461,7 +3233,6 @@ const usePrompt = (message, when = true) => {
|
|
|
3461
3233
|
return message;
|
|
3462
3234
|
};
|
|
3463
3235
|
}
|
|
3464
|
-
|
|
3465
3236
|
return () => {
|
|
3466
3237
|
window.onbeforeunload = null;
|
|
3467
3238
|
};
|
|
@@ -3478,7 +3249,6 @@ const usePrompt = (message, when = true) => {
|
|
|
3478
3249
|
* @param {PromptProps} Props -
|
|
3479
3250
|
* @returns {void} void
|
|
3480
3251
|
*/
|
|
3481
|
-
|
|
3482
3252
|
const Prompt = ({
|
|
3483
3253
|
when,
|
|
3484
3254
|
message
|
|
@@ -3501,7 +3271,6 @@ const RadioGroupContext = React.createContext(null);
|
|
|
3501
3271
|
* @param {RadioGroupProps} props - The props for the RadioGroup component
|
|
3502
3272
|
* @returns {JSX.Element} RadioGroup component
|
|
3503
3273
|
*/
|
|
3504
|
-
|
|
3505
3274
|
const RadioGroup = ({
|
|
3506
3275
|
children,
|
|
3507
3276
|
id,
|
|
@@ -3552,7 +3321,6 @@ ${({
|
|
|
3552
3321
|
* @param {RadioItemProps} props - The props for the RadioItem component
|
|
3553
3322
|
* @returns {JSX.Element} RadioItem component
|
|
3554
3323
|
*/
|
|
3555
|
-
|
|
3556
3324
|
const RadioItem = ({
|
|
3557
3325
|
label,
|
|
3558
3326
|
value,
|
|
@@ -3622,7 +3390,6 @@ ${({
|
|
|
3622
3390
|
*
|
|
3623
3391
|
* NOTE: If shown with a label, please use the `TextField` component instead.
|
|
3624
3392
|
*/
|
|
3625
|
-
|
|
3626
3393
|
const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
|
|
3627
3394
|
ref: ref,
|
|
3628
3395
|
type: "text"
|
|
@@ -3634,7 +3401,6 @@ const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
|
|
|
3634
3401
|
* @param {SearchProps} props - The props for the Search component
|
|
3635
3402
|
* @returns {JSX.Element} Search component
|
|
3636
3403
|
*/
|
|
3637
|
-
|
|
3638
3404
|
const Search = ({
|
|
3639
3405
|
className,
|
|
3640
3406
|
placeholder = "Search",
|
|
@@ -3698,7 +3464,6 @@ const StyledTextInput = twx(TextInput)`
|
|
|
3698
3464
|
* @param {SpacerProps} props - The props for the Spacer component
|
|
3699
3465
|
* @returns {JSX.Element} Spacer component
|
|
3700
3466
|
*/
|
|
3701
|
-
|
|
3702
3467
|
const Spacer = ({
|
|
3703
3468
|
minHeight,
|
|
3704
3469
|
border,
|
|
@@ -3710,22 +3475,18 @@ const Spacer = ({
|
|
|
3710
3475
|
border: border
|
|
3711
3476
|
});
|
|
3712
3477
|
};
|
|
3713
|
-
|
|
3714
3478
|
const GetSpacerHeight = () => ({
|
|
3715
3479
|
minHeight
|
|
3716
3480
|
}) => {
|
|
3717
3481
|
switch (minHeight) {
|
|
3718
3482
|
case "normal":
|
|
3719
3483
|
return tws`tu-spacer--normal`;
|
|
3720
|
-
|
|
3721
3484
|
case "large":
|
|
3722
3485
|
return tws`tu-spacer--large`;
|
|
3723
|
-
|
|
3724
3486
|
default:
|
|
3725
3487
|
return "";
|
|
3726
3488
|
}
|
|
3727
3489
|
};
|
|
3728
|
-
|
|
3729
3490
|
const Space = tw.div`
|
|
3730
3491
|
${p => `${p.border ? `tu-spacer--border` : null}`}
|
|
3731
3492
|
${GetSpacerHeight()}
|
|
@@ -3737,7 +3498,6 @@ const Space = tw.div`
|
|
|
3737
3498
|
* @param {SectionHeaderProps} props - The props for the section header component
|
|
3738
3499
|
* @returns {JSX.Element} SectionHeader component
|
|
3739
3500
|
*/
|
|
3740
|
-
|
|
3741
3501
|
const SectionHeader = ({
|
|
3742
3502
|
title,
|
|
3743
3503
|
subtitle,
|
|
@@ -3773,7 +3533,6 @@ const StyledFlex = tw.div`tu-section-header__flex`;
|
|
|
3773
3533
|
* @param {SelectContainerProps} props - The props for the SelectContainer component
|
|
3774
3534
|
* @returns {JSX.Element} SelectContainer component
|
|
3775
3535
|
*/
|
|
3776
|
-
|
|
3777
3536
|
const SelectContainer$1 = ({
|
|
3778
3537
|
children,
|
|
3779
3538
|
label,
|
|
@@ -3822,32 +3581,28 @@ const InformativeText = twx(Text$1)`
|
|
|
3822
3581
|
* @param {MultiValue<Option> | SingleValue<Option>} arg option to check type
|
|
3823
3582
|
* @returns {arg is MultiValue<Option> } is Multivalue
|
|
3824
3583
|
*/
|
|
3825
|
-
|
|
3826
3584
|
function isMultiValue(arg) {
|
|
3827
3585
|
return Array.isArray(arg);
|
|
3828
3586
|
}
|
|
3829
|
-
|
|
3830
3587
|
function isGroupBase(arg) {
|
|
3831
3588
|
return arg.options !== undefined;
|
|
3832
3589
|
}
|
|
3833
|
-
|
|
3834
3590
|
const isSelectedOption = (option, selected) => {
|
|
3835
3591
|
if (isGroupBase(option)) {
|
|
3836
3592
|
return false;
|
|
3837
3593
|
}
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
selected.some(v => v.value === option.value) :
|
|
3594
|
+
return isMultiValue(selected) ?
|
|
3595
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3596
|
+
selected.some(v => v.value === option.value) :
|
|
3597
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3841
3598
|
option.value === (selected === null || selected === void 0 ? void 0 : selected.value);
|
|
3842
3599
|
};
|
|
3843
|
-
|
|
3844
3600
|
const removeSelectedFromGroups = (group, selected) => {
|
|
3845
3601
|
if (isGroupBase(group)) {
|
|
3846
3602
|
return Object.assign(Object.assign({}, group), {
|
|
3847
3603
|
options: group.options.filter(option => !isSelectedOption(option, selected))
|
|
3848
3604
|
});
|
|
3849
3605
|
}
|
|
3850
|
-
|
|
3851
3606
|
return group;
|
|
3852
3607
|
};
|
|
3853
3608
|
/**
|
|
@@ -3857,17 +3612,15 @@ const removeSelectedFromGroups = (group, selected) => {
|
|
|
3857
3612
|
* @param {PropsValue<Option> | undefined} value Selected values
|
|
3858
3613
|
* @returns {OptionsOrGroups<Option, Group>} An array of ordered options with selected on top
|
|
3859
3614
|
*/
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
3615
|
const getOrderedOptions = (options, value) => {
|
|
3863
3616
|
if (value && options) {
|
|
3864
|
-
const orderedValues = isMultiValue(value) ?
|
|
3617
|
+
const orderedValues = isMultiValue(value) ?
|
|
3618
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3865
3619
|
[...value].sort((a, b) => a.label.localeCompare(b.label)) : [value];
|
|
3866
|
-
const selectableOptions = options.filter(option => !isSelectedOption(option, value)).map(option => removeSelectedFromGroups(option, value));
|
|
3867
|
-
|
|
3620
|
+
const selectableOptions = options.filter(option => !isSelectedOption(option, value)).map(option => removeSelectedFromGroups(option, value));
|
|
3621
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3868
3622
|
return orderedValues.concat(selectableOptions) || [];
|
|
3869
3623
|
}
|
|
3870
|
-
|
|
3871
3624
|
return options || [];
|
|
3872
3625
|
};
|
|
3873
3626
|
const SelectPrefix = tw.div`
|
|
@@ -3880,7 +3633,6 @@ const SelectPrefix = tw.div`
|
|
|
3880
3633
|
* @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
|
|
3881
3634
|
* @returns {JSX.Element} SingleSelectMenuItem
|
|
3882
3635
|
*/
|
|
3883
|
-
|
|
3884
3636
|
const SingleSelectMenuItem = ({
|
|
3885
3637
|
label,
|
|
3886
3638
|
icon,
|
|
@@ -3910,7 +3662,6 @@ const SingleSelectMenuItem = ({
|
|
|
3910
3662
|
* @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
|
|
3911
3663
|
* @returns {JSX.Element} multi select menu item
|
|
3912
3664
|
*/
|
|
3913
|
-
|
|
3914
3665
|
const MultiSelectMenuItem = ({
|
|
3915
3666
|
label,
|
|
3916
3667
|
onClick,
|
|
@@ -3948,18 +3699,15 @@ const MultiSelectMenuItem = ({
|
|
|
3948
3699
|
* @param {TagProps} props - The props for the tag component
|
|
3949
3700
|
* @returns {JSX.Element} TagWithWidth component
|
|
3950
3701
|
*/
|
|
3951
|
-
|
|
3952
3702
|
const TagWithWidth = _a => {
|
|
3953
3703
|
var {
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3704
|
+
onWidthKnown,
|
|
3705
|
+
children
|
|
3706
|
+
} = _a,
|
|
3707
|
+
rest = __rest(_a, ["onWidthKnown", "children"]);
|
|
3959
3708
|
const ref = React__default.useRef(null);
|
|
3960
3709
|
React__default.useLayoutEffect(() => {
|
|
3961
3710
|
var _a;
|
|
3962
|
-
|
|
3963
3711
|
onWidthKnown && onWidthKnown({
|
|
3964
3712
|
width: ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0
|
|
3965
3713
|
});
|
|
@@ -3977,7 +3725,6 @@ const TagWithWidth = _a => {
|
|
|
3977
3725
|
* @param {TagsContainerProps} props - The props for the TagContainer
|
|
3978
3726
|
* @returns {JSX.Element} TagsContainer
|
|
3979
3727
|
*/
|
|
3980
|
-
|
|
3981
3728
|
const TagsContainer = ({
|
|
3982
3729
|
items,
|
|
3983
3730
|
width = "100%",
|
|
@@ -3992,22 +3739,18 @@ const TagsContainer = ({
|
|
|
3992
3739
|
const itemsCount = items.length;
|
|
3993
3740
|
React__default.useLayoutEffect(() => {
|
|
3994
3741
|
var _a;
|
|
3995
|
-
|
|
3996
3742
|
availableWidth.current = ((_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0;
|
|
3997
3743
|
}, [containerRef]);
|
|
3998
|
-
|
|
3999
3744
|
const onWidthKnownHandler = ({
|
|
4000
3745
|
width: reportedWidth
|
|
4001
3746
|
}) => {
|
|
4002
3747
|
childrenWidth.current.push({
|
|
4003
3748
|
width: reportedWidth + itemsGap
|
|
4004
3749
|
});
|
|
4005
|
-
|
|
4006
3750
|
if (childrenWidth.current.length === itemsCount) {
|
|
4007
3751
|
setIsReady(true);
|
|
4008
3752
|
}
|
|
4009
3753
|
};
|
|
4010
|
-
|
|
4011
3754
|
const requiredSpace = childrenWidth.current.reduce((previous, current) => {
|
|
4012
3755
|
return previous + current.width;
|
|
4013
3756
|
}, 0);
|
|
@@ -4024,7 +3767,6 @@ const TagsContainer = ({
|
|
|
4024
3767
|
}, 0);
|
|
4025
3768
|
const isLast = index === items.length;
|
|
4026
3769
|
const counterRequired = requiredSpace > availableSpace && counter !== 0;
|
|
4027
|
-
|
|
4028
3770
|
if (isLast && counterRequired) {
|
|
4029
3771
|
return jsx(TagWithWidth, Object.assign({
|
|
4030
3772
|
onWidthKnown: ({
|
|
@@ -4037,13 +3779,10 @@ const TagsContainer = ({
|
|
|
4037
3779
|
})
|
|
4038
3780
|
}), item.text + index);
|
|
4039
3781
|
}
|
|
4040
|
-
|
|
4041
3782
|
if (isLast) {
|
|
4042
3783
|
return null;
|
|
4043
3784
|
}
|
|
4044
|
-
|
|
4045
3785
|
const itemCanFit = spaceNeeded <= availableSpace;
|
|
4046
|
-
|
|
4047
3786
|
if (itemCanFit) {
|
|
4048
3787
|
return jsx(TagWithWidth, Object.assign({
|
|
4049
3788
|
onWidthKnown: onWidthKnownHandler,
|
|
@@ -4058,13 +3797,10 @@ const TagsContainer = ({
|
|
|
4058
3797
|
children: item.text
|
|
4059
3798
|
}), item.text + index);
|
|
4060
3799
|
}
|
|
4061
|
-
|
|
4062
3800
|
const fromTheItems = item.text !== "";
|
|
4063
|
-
|
|
4064
3801
|
if (fromTheItems) {
|
|
4065
3802
|
counter = counter + 1;
|
|
4066
3803
|
}
|
|
4067
|
-
|
|
4068
3804
|
return null;
|
|
4069
3805
|
}).filter(element => element !== null);
|
|
4070
3806
|
return jsxs(Container, Object.assign({
|
|
@@ -4104,7 +3840,6 @@ tu-select__counter
|
|
|
4104
3840
|
* @param {JSX.Element} dropdownIcon an custom dropdown icon
|
|
4105
3841
|
* @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
|
|
4106
3842
|
*/
|
|
4107
|
-
|
|
4108
3843
|
const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon) => {
|
|
4109
3844
|
const customComponents = React.useMemo(() => {
|
|
4110
3845
|
return Object.assign({
|
|
@@ -4127,7 +3862,6 @@ const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIs
|
|
|
4127
3862
|
text: tagProps.children,
|
|
4128
3863
|
onClick: disabled ? undefined : e => {
|
|
4129
3864
|
var _a, _b;
|
|
4130
|
-
|
|
4131
3865
|
refMenuIsEnabled.current = false;
|
|
4132
3866
|
((_a = tagProps === null || tagProps === void 0 ? void 0 : tagProps.removeProps) === null || _a === void 0 ? void 0 : _a.onClick) && ((_b = tagProps === null || tagProps === void 0 ? void 0 : tagProps.removeProps) === null || _b === void 0 ? void 0 : _b.onClick(e));
|
|
4133
3867
|
},
|
|
@@ -4140,12 +3874,10 @@ const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIs
|
|
|
4140
3874
|
props: tagProps
|
|
4141
3875
|
}) => {
|
|
4142
3876
|
var _a, _b;
|
|
4143
|
-
|
|
4144
3877
|
return jsx(Tag, Object.assign({
|
|
4145
3878
|
className: tws`shrink-0 inline-flex`,
|
|
4146
3879
|
onClose: e => {
|
|
4147
3880
|
var _a, _b;
|
|
4148
|
-
|
|
4149
3881
|
e.stopPropagation();
|
|
4150
3882
|
refMenuIsEnabled.current = false;
|
|
4151
3883
|
((_a = tagProps === null || tagProps === void 0 ? void 0 : tagProps.removeProps) === null || _a === void 0 ? void 0 : _a.onClick) && ((_b = tagProps === null || tagProps === void 0 ? void 0 : tagProps.removeProps) === null || _b === void 0 ? void 0 : _b.onClick(e));
|
|
@@ -4164,7 +3896,6 @@ const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIs
|
|
|
4164
3896
|
})
|
|
4165
3897
|
}));
|
|
4166
3898
|
}
|
|
4167
|
-
|
|
4168
3899
|
return jsx(components.ValueContainer, Object.assign({}, props, {
|
|
4169
3900
|
isDisabled: props.selectProps.isDisabled
|
|
4170
3901
|
}, {
|
|
@@ -4195,7 +3926,6 @@ const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIs
|
|
|
4195
3926
|
if (disabled) {
|
|
4196
3927
|
return null;
|
|
4197
3928
|
}
|
|
4198
|
-
|
|
4199
3929
|
return jsx(components.ClearIndicator, Object.assign({}, props, {
|
|
4200
3930
|
children: jsx(XIcon, Object.assign({
|
|
4201
3931
|
onClick: props.clearValue,
|
|
@@ -4254,9 +3984,9 @@ const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIs
|
|
|
4254
3984
|
}))
|
|
4255
3985
|
}));
|
|
4256
3986
|
}
|
|
4257
|
-
}, componentsProps);
|
|
3987
|
+
}, componentsProps);
|
|
3988
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4258
3989
|
}, [componentsProps, disabled, menuIsClosing, refMenuIsEnabled, maxSelectedDisplayCount]); // do not add dropdownIcon (it will cause issue with opening/closing list for selects with custom icon)
|
|
4259
|
-
|
|
4260
3990
|
return customComponents;
|
|
4261
3991
|
};
|
|
4262
3992
|
const StyledIcon = tw.div`
|
|
@@ -4276,7 +4006,6 @@ tu-select__x-icon
|
|
|
4276
4006
|
* @param {StylesConfig<Option, IsMulti, Group> | undefined} styles a optional object to override styles of react-select
|
|
4277
4007
|
* @returns {StylesConfig<Option, boolean>} styles to override in select
|
|
4278
4008
|
*/
|
|
4279
|
-
|
|
4280
4009
|
const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, styles) => {
|
|
4281
4010
|
const customStyles = React.useMemo(() => {
|
|
4282
4011
|
return Object.assign({
|
|
@@ -4351,7 +4080,8 @@ const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, style
|
|
|
4351
4080
|
padding: "0px"
|
|
4352
4081
|
});
|
|
4353
4082
|
}
|
|
4354
|
-
}, styles);
|
|
4083
|
+
}, styles);
|
|
4084
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4355
4085
|
}, [refContainer, refPrefix]);
|
|
4356
4086
|
return {
|
|
4357
4087
|
customStyles
|
|
@@ -4364,40 +4094,37 @@ const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, style
|
|
|
4364
4094
|
* @param {SelectProps} props - The props for the Select component
|
|
4365
4095
|
* @returns {IUseSelect} Select component
|
|
4366
4096
|
*/
|
|
4367
|
-
|
|
4368
4097
|
const useSelect = _a => {
|
|
4369
4098
|
var _b;
|
|
4370
|
-
|
|
4371
4099
|
var {
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4100
|
+
id,
|
|
4101
|
+
className,
|
|
4102
|
+
dataTestId = "select",
|
|
4103
|
+
prefix,
|
|
4104
|
+
async,
|
|
4105
|
+
dropdownIcon,
|
|
4106
|
+
maxMenuHeight = 200,
|
|
4107
|
+
label,
|
|
4108
|
+
hasError,
|
|
4109
|
+
disabled,
|
|
4110
|
+
isMulti,
|
|
4111
|
+
components,
|
|
4112
|
+
value,
|
|
4113
|
+
options,
|
|
4114
|
+
onChange,
|
|
4115
|
+
isLoading,
|
|
4116
|
+
classNamePrefix = "",
|
|
4117
|
+
onMenuOpen,
|
|
4118
|
+
onMenuClose,
|
|
4119
|
+
maxSelectedDisplayCount = undefined,
|
|
4120
|
+
isClearable = false,
|
|
4121
|
+
isSearchable = true,
|
|
4122
|
+
onMenuScrollToBottom,
|
|
4123
|
+
styles,
|
|
4124
|
+
filterOption,
|
|
4125
|
+
onInputChange
|
|
4126
|
+
} = _a,
|
|
4127
|
+
props = __rest(_a, ["id", "className", "dataTestId", "prefix", "async", "dropdownIcon", "maxMenuHeight", "label", "hasError", "disabled", "isMulti", "components", "value", "options", "onChange", "isLoading", "classNamePrefix", "onMenuOpen", "onMenuClose", "maxSelectedDisplayCount", "isClearable", "isSearchable", "onMenuScrollToBottom", "styles", "filterOption", "onInputChange"]);
|
|
4401
4128
|
const refContainer = React__default.useRef(null);
|
|
4402
4129
|
const refPrefix = React__default.useRef(null);
|
|
4403
4130
|
const {
|
|
@@ -4408,10 +4135,8 @@ const useSelect = _a => {
|
|
|
4408
4135
|
const refMenuIsEnabled = React__default.useRef(true);
|
|
4409
4136
|
const customComponents = useCustomComponents(components, disabled || false, menuIsClosing, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon);
|
|
4410
4137
|
const menuPlacement = "auto";
|
|
4411
|
-
|
|
4412
4138
|
const openMenuHandler = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
4413
4139
|
onMenuOpen && onMenuOpen();
|
|
4414
|
-
|
|
4415
4140
|
if (refMenuIsEnabled.current) {
|
|
4416
4141
|
setMenuIsClosing(false);
|
|
4417
4142
|
yield setMenuIsOpen(true);
|
|
@@ -4419,15 +4144,12 @@ const useSelect = _a => {
|
|
|
4419
4144
|
refMenuIsEnabled.current = true;
|
|
4420
4145
|
}
|
|
4421
4146
|
});
|
|
4422
|
-
|
|
4423
4147
|
const closeMenuHandler = () => {
|
|
4424
4148
|
if (refMenuIsEnabled.current) {
|
|
4425
4149
|
setMenuIsClosing(true);
|
|
4426
4150
|
}
|
|
4427
|
-
|
|
4428
4151
|
onMenuClose && onMenuClose();
|
|
4429
4152
|
};
|
|
4430
|
-
|
|
4431
4153
|
React__default.useEffect(() => {
|
|
4432
4154
|
const timeout = menuIsClosing && setTimeout(() => {
|
|
4433
4155
|
setMenuIsOpen(false);
|
|
@@ -4462,7 +4184,6 @@ const useSelect = _a => {
|
|
|
4462
4184
|
* @param {CreateableSelectProps} props - The props for the CreatableSelect component
|
|
4463
4185
|
* @returns {JSX.Element} CreatableSelect component
|
|
4464
4186
|
*/
|
|
4465
|
-
|
|
4466
4187
|
const CreatableSelect = props => {
|
|
4467
4188
|
const {
|
|
4468
4189
|
id,
|
|
@@ -4568,7 +4289,6 @@ const CreatableSelect = props => {
|
|
|
4568
4289
|
* @param {SelectProps} props - The props for the Select component
|
|
4569
4290
|
* @returns {JSX.Element} Select component
|
|
4570
4291
|
*/
|
|
4571
|
-
|
|
4572
4292
|
const Select = props => {
|
|
4573
4293
|
const {
|
|
4574
4294
|
id,
|
|
@@ -4669,30 +4389,28 @@ Select.displayName = "Select";
|
|
|
4669
4389
|
* The TextArea is a base component, and should not be used very often.
|
|
4670
4390
|
* For most cases the TextAreaField is the correct component.
|
|
4671
4391
|
*/
|
|
4672
|
-
|
|
4673
4392
|
const TextArea = React.forwardRef((_a, ref) => {
|
|
4674
4393
|
var {
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4394
|
+
id,
|
|
4395
|
+
name,
|
|
4396
|
+
value,
|
|
4397
|
+
rows,
|
|
4398
|
+
disabled,
|
|
4399
|
+
placeholder,
|
|
4400
|
+
readOnly,
|
|
4401
|
+
tabIndex,
|
|
4402
|
+
onChange,
|
|
4403
|
+
onFocus,
|
|
4404
|
+
onBlur,
|
|
4405
|
+
maxLength,
|
|
4406
|
+
resize = "vertical",
|
|
4407
|
+
defaultValue,
|
|
4408
|
+
className,
|
|
4409
|
+
required,
|
|
4410
|
+
dataTestId,
|
|
4411
|
+
isInvalid
|
|
4412
|
+
} = _a,
|
|
4413
|
+
rest = __rest(_a, ["id", "name", "value", "rows", "disabled", "placeholder", "readOnly", "tabIndex", "onChange", "onFocus", "onBlur", "maxLength", "resize", "defaultValue", "className", "required", "dataTestId", "isInvalid"]);
|
|
4696
4414
|
return jsx(StyledTextArea, Object.assign({
|
|
4697
4415
|
name: name,
|
|
4698
4416
|
value: value,
|
|
@@ -4728,16 +4446,12 @@ const StyledTextArea = tw.textarea`
|
|
|
4728
4446
|
switch ($resize) {
|
|
4729
4447
|
case "both":
|
|
4730
4448
|
return tws`resize`;
|
|
4731
|
-
|
|
4732
4449
|
case "horizontal":
|
|
4733
4450
|
return tws`resize-x`;
|
|
4734
|
-
|
|
4735
4451
|
case "vertical":
|
|
4736
4452
|
return tws`resize-y`;
|
|
4737
|
-
|
|
4738
4453
|
case "none":
|
|
4739
4454
|
return tws`resize-none`;
|
|
4740
|
-
|
|
4741
4455
|
default:
|
|
4742
4456
|
return null;
|
|
4743
4457
|
}
|
|
@@ -4751,7 +4465,6 @@ const StyledTextArea = tw.textarea`
|
|
|
4751
4465
|
* @param {TextLengthIndicatorProps} props - The props for the TextLengthIndicator component
|
|
4752
4466
|
* @returns {JSX.Element} TextLengthIndicator component
|
|
4753
4467
|
*/
|
|
4754
|
-
|
|
4755
4468
|
const TextLengthIndicator = ({
|
|
4756
4469
|
length,
|
|
4757
4470
|
maxLength
|
|
@@ -4766,25 +4479,23 @@ const Root$1 = tw.span`
|
|
|
4766
4479
|
|
|
4767
4480
|
const TextAreaField = React.forwardRef((_a, ref) => {
|
|
4768
4481
|
var {
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4482
|
+
label,
|
|
4483
|
+
tip,
|
|
4484
|
+
helpText,
|
|
4485
|
+
helpAddon,
|
|
4486
|
+
errorMessage,
|
|
4487
|
+
isInvalid,
|
|
4488
|
+
maxLength,
|
|
4489
|
+
onChange,
|
|
4490
|
+
className,
|
|
4491
|
+
value,
|
|
4492
|
+
dataTestId
|
|
4493
|
+
} = _a,
|
|
4494
|
+
rest = __rest(_a, ["label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
4783
4495
|
const [valueLength, setValueLength] = React.useState(value ? `${value}`.length : 0);
|
|
4784
4496
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
4785
4497
|
const handleChange = React.useCallback(event => {
|
|
4786
4498
|
setValueLength(event.target.value.length);
|
|
4787
|
-
|
|
4788
4499
|
if (onChange) {
|
|
4789
4500
|
onChange(event);
|
|
4790
4501
|
}
|
|
@@ -4821,28 +4532,25 @@ const TextAreaField = React.forwardRef((_a, ref) => {
|
|
|
4821
4532
|
*
|
|
4822
4533
|
* _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
|
|
4823
4534
|
*/
|
|
4824
|
-
|
|
4825
4535
|
const TextField = React.forwardRef((_a, ref) => {
|
|
4826
4536
|
var {
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4537
|
+
label,
|
|
4538
|
+
tip,
|
|
4539
|
+
helpText,
|
|
4540
|
+
helpAddon,
|
|
4541
|
+
errorMessage,
|
|
4542
|
+
isInvalid,
|
|
4543
|
+
maxLength,
|
|
4544
|
+
onChange,
|
|
4545
|
+
className,
|
|
4546
|
+
value,
|
|
4547
|
+
dataTestId
|
|
4548
|
+
} = _a,
|
|
4549
|
+
rest = __rest(_a, ["label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
4841
4550
|
const [valueLength, setValueLength] = React.useState(value ? `${value}`.length : 0);
|
|
4842
4551
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
4843
4552
|
const handleChange = React.useCallback(event => {
|
|
4844
4553
|
setValueLength(event.target.value.length);
|
|
4845
|
-
|
|
4846
4554
|
if (onChange) {
|
|
4847
4555
|
onChange(event);
|
|
4848
4556
|
}
|
|
@@ -4881,7 +4589,6 @@ const TextField = React.forwardRef((_a, ref) => {
|
|
|
4881
4589
|
* @param {TimelineProps} props - The props for the Timeline component
|
|
4882
4590
|
* @returns {JSX.Element} Timeline component
|
|
4883
4591
|
*/
|
|
4884
|
-
|
|
4885
4592
|
const Timeline = ({
|
|
4886
4593
|
className,
|
|
4887
4594
|
dataTestId,
|
|
@@ -4901,7 +4608,6 @@ const Timeline = ({
|
|
|
4901
4608
|
* @param {TimeLineElementProps} props the props
|
|
4902
4609
|
* @returns {JSX.Element} component
|
|
4903
4610
|
*/
|
|
4904
|
-
|
|
4905
4611
|
const TimelineElement = ({
|
|
4906
4612
|
date,
|
|
4907
4613
|
children,
|
|
@@ -4921,7 +4627,6 @@ const TimelineElement = ({
|
|
|
4921
4627
|
onClick
|
|
4922
4628
|
}) => {
|
|
4923
4629
|
var _a;
|
|
4924
|
-
|
|
4925
4630
|
return jsxs("li", Object.assign({
|
|
4926
4631
|
className: `${tws`tu-timeline-element`}${(_a = " " + className) !== null && _a !== void 0 ? _a : ""} `,
|
|
4927
4632
|
"data-date": `${date}`,
|
|
@@ -4952,7 +4657,6 @@ const TimelineElement = ({
|
|
|
4952
4657
|
* @param {ToggleProps} props - The props for the Toggle component
|
|
4953
4658
|
* @returns {JSX.Element} Toggle component
|
|
4954
4659
|
*/
|
|
4955
|
-
|
|
4956
4660
|
const Toggle = React.forwardRef(({
|
|
4957
4661
|
toggled = false,
|
|
4958
4662
|
onChange,
|
|
@@ -5052,7 +4756,6 @@ ${({
|
|
|
5052
4756
|
* @param {number} max - max range value
|
|
5053
4757
|
* @returns {number} normalized score
|
|
5054
4758
|
*/
|
|
5055
|
-
|
|
5056
4759
|
const getScore = (value, min, max) => {
|
|
5057
4760
|
if (value <= min) {
|
|
5058
4761
|
return 0.01; // always render at least some small fragment
|
|
@@ -5061,7 +4764,6 @@ const getScore = (value, min, max) => {
|
|
|
5061
4764
|
if (value >= max) {
|
|
5062
4765
|
return 1;
|
|
5063
4766
|
}
|
|
5064
|
-
|
|
5065
4767
|
return (value - min) / (max - min);
|
|
5066
4768
|
};
|
|
5067
4769
|
/**
|
|
@@ -5070,16 +4772,13 @@ const getScore = (value, min, max) => {
|
|
|
5070
4772
|
* @param {number} score - score number for which color should be returned
|
|
5071
4773
|
* @returns {string} color value
|
|
5072
4774
|
*/
|
|
5073
|
-
|
|
5074
4775
|
const getDefaultFillColor = score => {
|
|
5075
4776
|
if (score < 0.3) {
|
|
5076
4777
|
return color("DANGER", 500, "CSS");
|
|
5077
4778
|
}
|
|
5078
|
-
|
|
5079
4779
|
if (score >= 0.6) {
|
|
5080
4780
|
return color("SUCCESS", 600, "CSS");
|
|
5081
4781
|
}
|
|
5082
|
-
|
|
5083
4782
|
return color("WARNING", 300, "CSS");
|
|
5084
4783
|
};
|
|
5085
4784
|
/**
|
|
@@ -5089,18 +4788,14 @@ const getDefaultFillColor = score => {
|
|
|
5089
4788
|
* @param {LevelColors} levelColors - custom colors and levels definitions
|
|
5090
4789
|
* @returns {string} color value
|
|
5091
4790
|
*/
|
|
5092
|
-
|
|
5093
4791
|
const getFillColor = (score, levelColors) => {
|
|
5094
4792
|
var _a, _b;
|
|
5095
|
-
|
|
5096
4793
|
if (levelColors.low && score < (levelColors.low.level || 0)) {
|
|
5097
4794
|
return levelColors.low.color;
|
|
5098
4795
|
}
|
|
5099
|
-
|
|
5100
4796
|
if (levelColors.high && score >= (levelColors.high.level || 0)) {
|
|
5101
4797
|
return levelColors.high.color;
|
|
5102
4798
|
}
|
|
5103
|
-
|
|
5104
4799
|
return (_b = (_a = levelColors.medium) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : color("WARNING", 300);
|
|
5105
4800
|
};
|
|
5106
4801
|
/**
|
|
@@ -5112,7 +4807,6 @@ const getFillColor = (score, levelColors) => {
|
|
|
5112
4807
|
* @param {LevelColors} levelColors - level colors used to coloring the bar
|
|
5113
4808
|
* @returns {JSX.Element} ValueBar component
|
|
5114
4809
|
*/
|
|
5115
|
-
|
|
5116
4810
|
const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
5117
4811
|
const score = getScore(value, min, max);
|
|
5118
4812
|
return getFillColor(score, levelColors);
|
|
@@ -5124,7 +4818,6 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
|
5124
4818
|
* @param {ValueBarProps} props - The props for the ValueBar component
|
|
5125
4819
|
* @returns {JSX.Element} ValueBar component
|
|
5126
4820
|
*/
|
|
5127
|
-
|
|
5128
4821
|
const ValueBar = ({
|
|
5129
4822
|
value,
|
|
5130
4823
|
min = 0,
|
|
@@ -5197,7 +4890,6 @@ const Bar = tw.rect`
|
|
|
5197
4890
|
* @param {number} delay The debounce time
|
|
5198
4891
|
* @returns {any} value The latest values received
|
|
5199
4892
|
*/
|
|
5200
|
-
|
|
5201
4893
|
const useDebounce = (value, delay = 500) => {
|
|
5202
4894
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
5203
4895
|
useEffect(() => {
|
|
@@ -5218,22 +4910,18 @@ const useDebounce = (value, delay = 500) => {
|
|
|
5218
4910
|
* @param {string | null | undefined} initialValue - The initial value for the state/local storage item
|
|
5219
4911
|
* @returns {string | null | undefined} value
|
|
5220
4912
|
*/
|
|
5221
|
-
|
|
5222
4913
|
const useLocalStorage = (key, initialValue) => {
|
|
5223
4914
|
if (!key) {
|
|
5224
4915
|
throw new Error("useLocalStorage key may not be falsy");
|
|
5225
4916
|
}
|
|
5226
|
-
|
|
5227
4917
|
const setLocalStorageItem = useCallback(value => window.localStorage.setItem(key, typeof value === "object" ? JSON.stringify(value) : `${value}`), [key]);
|
|
5228
4918
|
const removeLocalStorageItem = useCallback(() => window.localStorage.removeItem(key), [key]);
|
|
5229
4919
|
const [item, setValue] = useState(() => {
|
|
5230
4920
|
const value = window.localStorage.getItem(key);
|
|
5231
|
-
|
|
5232
4921
|
if (value !== undefined && value !== null) {
|
|
5233
4922
|
const parsedValue = tryParse(value);
|
|
5234
4923
|
return parsedValue;
|
|
5235
4924
|
}
|
|
5236
|
-
|
|
5237
4925
|
return initialValue !== null && initialValue !== void 0 ? initialValue : null;
|
|
5238
4926
|
});
|
|
5239
4927
|
useEffect(() => {
|
|
@@ -5258,14 +4946,11 @@ const useLocalStorage = (key, initialValue) => {
|
|
|
5258
4946
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5259
4947
|
}, []);
|
|
5260
4948
|
*/
|
|
5261
|
-
|
|
5262
4949
|
const removeItem = () => {
|
|
5263
4950
|
setValue(null);
|
|
5264
4951
|
};
|
|
5265
|
-
|
|
5266
4952
|
return [item, setValue, removeItem];
|
|
5267
4953
|
};
|
|
5268
|
-
|
|
5269
4954
|
function tryParse(value) {
|
|
5270
4955
|
try {
|
|
5271
4956
|
return JSON.parse(value);
|
|
@@ -5280,7 +4965,6 @@ function tryParse(value) {
|
|
|
5280
4965
|
* @param {UseTimeoutProps} props The props
|
|
5281
4966
|
* @returns {{ startTimeout: () => void; stopTimeout: () => void; }} return
|
|
5282
4967
|
*/
|
|
5283
|
-
|
|
5284
4968
|
const useTimeout = ({
|
|
5285
4969
|
onTimeout,
|
|
5286
4970
|
duration
|
|
@@ -5300,7 +4984,6 @@ const useTimeout = ({
|
|
|
5300
4984
|
onTimeout();
|
|
5301
4985
|
}, duration);
|
|
5302
4986
|
}
|
|
5303
|
-
|
|
5304
4987
|
return () => {
|
|
5305
4988
|
stopTimeout();
|
|
5306
4989
|
};
|
|
@@ -5317,7 +5000,6 @@ const useTimeout = ({
|
|
|
5317
5000
|
* @param {MinTopFullContentLayoutProps} props - The props for the MinTopFullContentLayout component
|
|
5318
5001
|
* @returns {JSX.Element} MinTopFullContentLayout component
|
|
5319
5002
|
*/
|
|
5320
|
-
|
|
5321
5003
|
const MinTopFullContentLayout = ({
|
|
5322
5004
|
children,
|
|
5323
5005
|
className,
|
|
@@ -5350,7 +5032,6 @@ const Layout$5 = tw.span`
|
|
|
5350
5032
|
* @param {FilterListMapLayoutProps} props - The props for the FilterListMapLayout component
|
|
5351
5033
|
* @returns {JSX.Element} FilterListMapLayout component
|
|
5352
5034
|
*/
|
|
5353
|
-
|
|
5354
5035
|
const FilterListMapLayout = ({
|
|
5355
5036
|
children
|
|
5356
5037
|
}) => jsx(Layout$4, {
|
|
@@ -5368,7 +5049,6 @@ const Layout$4 = tw.span`
|
|
|
5368
5049
|
* @param {FullWidthRepeatingLayoutProps} props - The props for the FullWidthRepeatingLayout component
|
|
5369
5050
|
* @returns {JSX.Element} FullWidthRepeatingLayout component
|
|
5370
5051
|
*/
|
|
5371
|
-
|
|
5372
5052
|
const FullWidthRepeatingLayout = ({
|
|
5373
5053
|
children,
|
|
5374
5054
|
rowSizing = "Unmanaged",
|
|
@@ -5392,10 +5072,8 @@ const Layout$3 = tw.span`
|
|
|
5392
5072
|
switch ($rowSizing) {
|
|
5393
5073
|
case "MinContent":
|
|
5394
5074
|
return tws` tu-layout-FullWidthRepeatingLayout--MinContent`;
|
|
5395
|
-
|
|
5396
5075
|
case "Equal":
|
|
5397
5076
|
return tws` tu-layout-FullWidthRepeatingLayout--Equal`;
|
|
5398
|
-
|
|
5399
5077
|
case "Unmanaged":
|
|
5400
5078
|
default:
|
|
5401
5079
|
return null;
|
|
@@ -5409,7 +5087,6 @@ const Layout$3 = tw.span`
|
|
|
5409
5087
|
* @param {GridAreaProps} props - The props for the GridArea component
|
|
5410
5088
|
* @returns {JSX.Element} GridArea component
|
|
5411
5089
|
*/
|
|
5412
|
-
|
|
5413
5090
|
const GridArea = ({
|
|
5414
5091
|
area,
|
|
5415
5092
|
dataTestId,
|
|
@@ -5432,7 +5109,6 @@ const GridArea = ({
|
|
|
5432
5109
|
* @param {IntrinsicallyResponsiveGridProps} props - The props for the IntrinsicallyResponsiveGrid component
|
|
5433
5110
|
* @returns {JSX.Element} IntrinsicallyResponsiveGrid component
|
|
5434
5111
|
*/
|
|
5435
|
-
|
|
5436
5112
|
const IntrinsicallyResponsiveGrid = ({
|
|
5437
5113
|
children,
|
|
5438
5114
|
occupation = "auto-fill",
|
|
@@ -5457,7 +5133,6 @@ const Layout$2 = tw.span`
|
|
|
5457
5133
|
switch ($occupation) {
|
|
5458
5134
|
case "auto-fit":
|
|
5459
5135
|
return tws`tu-layout-IntrinsicallyResponsiveGrid--fit`;
|
|
5460
|
-
|
|
5461
5136
|
case "auto-fill":
|
|
5462
5137
|
default:
|
|
5463
5138
|
return tws`tu-layout-IntrinsicallyResponsiveGrid--fill`;
|
|
@@ -5470,16 +5145,12 @@ const Layout$2 = tw.span`
|
|
|
5470
5145
|
switch ($minColumnWidth) {
|
|
5471
5146
|
case "xs":
|
|
5472
5147
|
return tws`tu-layout-IntrinsicallyResponsiveGrid--xs`;
|
|
5473
|
-
|
|
5474
5148
|
case "sm":
|
|
5475
5149
|
return tws`tu-layout-IntrinsicallyResponsiveGrid--sm`;
|
|
5476
|
-
|
|
5477
5150
|
case "lg":
|
|
5478
5151
|
return tws`tu-layout-IntrinsicallyResponsiveGrid--lg`;
|
|
5479
|
-
|
|
5480
5152
|
case "xl":
|
|
5481
5153
|
return tws`tu-layout-IntrinsicallyResponsiveGrid--xl`;
|
|
5482
|
-
|
|
5483
5154
|
case "md":
|
|
5484
5155
|
default:
|
|
5485
5156
|
return tws`tu-layout-IntrinsicallyResponsiveGrid--md`;
|
|
@@ -5492,31 +5163,22 @@ const Layout$2 = tw.span`
|
|
|
5492
5163
|
switch ($gap) {
|
|
5493
5164
|
case "tiny":
|
|
5494
5165
|
return tws`gap-1`;
|
|
5495
|
-
|
|
5496
5166
|
case "mini":
|
|
5497
5167
|
return tws`gap-2`;
|
|
5498
|
-
|
|
5499
5168
|
case "small":
|
|
5500
5169
|
return tws`gap-3`;
|
|
5501
|
-
|
|
5502
5170
|
case "medium":
|
|
5503
5171
|
return tws`gap-4`;
|
|
5504
|
-
|
|
5505
5172
|
case "large":
|
|
5506
5173
|
return tws`gap-6`;
|
|
5507
|
-
|
|
5508
5174
|
case "giant":
|
|
5509
5175
|
return tws`gap-8`;
|
|
5510
|
-
|
|
5511
5176
|
case "enormous":
|
|
5512
5177
|
return tws`gap-10`;
|
|
5513
|
-
|
|
5514
5178
|
case "none":
|
|
5515
5179
|
return tws`gap-0`;
|
|
5516
|
-
|
|
5517
5180
|
case "inherit":
|
|
5518
5181
|
return tws`gap-[inherit]`;
|
|
5519
|
-
|
|
5520
5182
|
case "auto":
|
|
5521
5183
|
default:
|
|
5522
5184
|
return tws`tu-gap-responsive`;
|
|
@@ -5530,7 +5192,6 @@ const Layout$2 = tw.span`
|
|
|
5530
5192
|
* @param {TitleNavContentLayoutProps} props - The props for the TitleNavContentLayout component
|
|
5531
5193
|
* @returns {JSX.Element} TitleNavContentLayout component
|
|
5532
5194
|
*/
|
|
5533
|
-
|
|
5534
5195
|
const TitleNavContentLayout = ({
|
|
5535
5196
|
children
|
|
5536
5197
|
}) => jsx(Layout$1, {
|
|
@@ -5546,7 +5207,6 @@ const Layout$1 = tw.div`
|
|
|
5546
5207
|
* @param {TwoColumnLayoutProps} props - The props for the TwoColumnLayout component
|
|
5547
5208
|
* @returns {JSX.Element} TwoColumnLayout component
|
|
5548
5209
|
*/
|
|
5549
|
-
|
|
5550
5210
|
const TwoColumnLayout = ({
|
|
5551
5211
|
children
|
|
5552
5212
|
}) => jsx(Layout, {
|