@trackunit/react-components 0.1.76 → 0.1.78
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/README.md +1 -1
- package/index.cjs +116 -1278
- package/index.css +0 -260
- package/index.js +118 -1241
- package/package.json +4 -7
- package/src/components/index.d.ts +0 -24
- package/src/components/ActionButton/ActionButton.d.ts +0 -27
- package/src/components/ActionButton/index.d.ts +0 -1
- package/src/components/BaseInput/BaseInput.d.ts +0 -62
- package/src/components/BaseInput/index.d.ts +0 -1
- package/src/components/Checkbox/CheckIcon.d.ts +0 -12
- package/src/components/Checkbox/Checkbox.d.ts +0 -48
- package/src/components/Checkbox/IndeterminateIcon.d.ts +0 -10
- package/src/components/Checkbox/index.d.ts +0 -1
- package/src/components/DateField/DateField.d.ts +0 -19
- package/src/components/DateInput/DateInput.d.ts +0 -28
- package/src/components/DropZone/DropZone.d.ts +0 -34
- package/src/components/EmailField/EmailField.d.ts +0 -17
- package/src/components/EmailInput/EmailInput.d.ts +0 -13
- package/src/components/EmailInput/index.d.ts +0 -1
- package/src/components/FormGroup/FormGroup.d.ts +0 -39
- package/src/components/Label/Label.d.ts +0 -34
- package/src/components/Label/index.d.ts +0 -1
- package/src/components/NumberField/NumberField.d.ts +0 -19
- package/src/components/NumberInput/NumberInput.d.ts +0 -12
- package/src/components/PhoneField/PhoneField.d.ts +0 -28
- package/src/components/PhoneInput/CountryCodeSelect.d.ts +0 -16
- package/src/components/PhoneInput/CountryCodes.d.ts +0 -5
- package/src/components/PhoneInput/PhoneInput.d.ts +0 -25
- package/src/components/PhoneInput/index.d.ts +0 -1
- package/src/components/RadioGroup/RadioGroup.d.ts +0 -57
- package/src/components/RadioGroup/RadioGroupContext.d.ts +0 -11
- package/src/components/RadioGroup/RadioItem.d.ts +0 -23
- package/src/components/RadioGroup/index.d.ts +0 -2
- package/src/components/Search/Search.d.ts +0 -62
- package/src/components/Search/index.d.ts +0 -1
- package/src/components/Select/CreatableSelect.d.ts +0 -38
- package/src/components/Select/FieldContainer.d.ts +0 -20
- package/src/components/Select/Select.d.ts +0 -18
- package/src/components/Select/SelectMenuItem/SelectMenuItem.d.ts +0 -49
- package/src/components/Select/TagWithWidth.d.ts +0 -17
- package/src/components/Select/TagsContainer.d.ts +0 -45
- package/src/components/Select/index.d.ts +0 -7
- package/src/components/Select/shared.d.ts +0 -15
- package/src/components/Select/useCustomComponents.d.ts +0 -19
- package/src/components/Select/useCustomStyles.d.ts +0 -14
- package/src/components/Select/useSelect.d.ts +0 -143
- package/src/components/TextArea/TextArea.d.ts +0 -30
- package/src/components/TextArea/index.d.ts +0 -1
- package/src/components/TextAreaField/TextAreaField.d.ts +0 -18
- package/src/components/TextAreaField/index.d.ts +0 -1
- package/src/components/TextField/TextField.d.ts +0 -24
- package/src/components/TextField/TextLenghtIndicator.d.ts +0 -19
- package/src/components/TextField/index.d.ts +0 -1
- package/src/components/TextInput/TextInput.d.ts +0 -12
- package/src/components/Toggle/Toggle.d.ts +0 -57
- package/src/components/Toggle/index.d.ts +0 -1
- package/src/components/UploadField/UploadField.d.ts +0 -15
- package/src/components/UploadInput/UploadInput.d.ts +0 -33
package/index.cjs
CHANGED
|
@@ -7,19 +7,13 @@ var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var uiIcons = require('@trackunit/ui-icons');
|
|
9
9
|
var reactUse = require('react-use');
|
|
10
|
-
var uuid = require('uuid');
|
|
11
|
-
var dateFns = require('date-fns');
|
|
12
|
-
var react = require('@floating-ui/react');
|
|
13
10
|
var reactDayPicker = require('react-day-picker');
|
|
14
11
|
var locale = require('date-fns/locale');
|
|
12
|
+
var react = require('@floating-ui/react');
|
|
15
13
|
var usePortal = require('react-useportal');
|
|
16
|
-
var ReactSelect = require('react-select');
|
|
17
|
-
var ReactAsyncCreatableSelect = require('react-select/async-creatable');
|
|
18
|
-
var ReactCreatableSelect = require('react-select/creatable');
|
|
19
|
-
var ReactAsyncSelect = require('react-select/async');
|
|
20
|
-
var libphonenumberJs = require('libphonenumber-js');
|
|
21
14
|
var reactRouterDom = require('react-router-dom');
|
|
22
15
|
var reactHelmetAsync = require('react-helmet-async');
|
|
16
|
+
var dateFns = require('date-fns');
|
|
23
17
|
var uiDesignTokens = require('@trackunit/ui-design-tokens');
|
|
24
18
|
|
|
25
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -45,10 +39,6 @@ function _interopNamespace(e) {
|
|
|
45
39
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
46
40
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
47
41
|
var usePortal__default = /*#__PURE__*/_interopDefaultLegacy(usePortal);
|
|
48
|
-
var ReactSelect__default = /*#__PURE__*/_interopDefaultLegacy(ReactSelect);
|
|
49
|
-
var ReactAsyncCreatableSelect__default = /*#__PURE__*/_interopDefaultLegacy(ReactAsyncCreatableSelect);
|
|
50
|
-
var ReactCreatableSelect__default = /*#__PURE__*/_interopDefaultLegacy(ReactCreatableSelect);
|
|
51
|
-
var ReactAsyncSelect__default = /*#__PURE__*/_interopDefaultLegacy(ReactAsyncSelect);
|
|
52
42
|
|
|
53
43
|
const docs = {
|
|
54
44
|
source: {
|
|
@@ -101,16 +91,6 @@ function __rest(s, e) {
|
|
|
101
91
|
t[p[i]] = s[p[i]];
|
|
102
92
|
}
|
|
103
93
|
return t;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
107
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
108
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
109
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
110
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
111
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
112
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
113
|
-
});
|
|
114
94
|
}
|
|
115
95
|
|
|
116
96
|
/**
|
|
@@ -128,7 +108,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
128
108
|
* @returns {JSX.Element} Spinner component
|
|
129
109
|
*/
|
|
130
110
|
const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId, }) => {
|
|
131
|
-
return (jsxRuntime.jsx(Container$
|
|
111
|
+
return (jsxRuntime.jsx(Container$7, Object.assign({ "$mode": mode, "$centering": centering, className: containerClassName }, { children: jsxRuntime.jsx(StyledSpinner$1, { "$size": size, "$mode": mode, role: "spinbutton", className: className, "data-testid": dataTestId }) })));
|
|
132
112
|
};
|
|
133
113
|
const getSpinnerStyles = () => ({ $size }) => {
|
|
134
114
|
switch ($size) {
|
|
@@ -158,7 +138,7 @@ const StyledSpinner$1 = tailwindStyledComponents.tw.span `
|
|
|
158
138
|
${p => (p.$mode === "dark" ? tailwindStyledComponents.tws `tu-spinner--dark` : null)}
|
|
159
139
|
${getSpinnerStyles()}
|
|
160
140
|
`;
|
|
161
|
-
const Container$
|
|
141
|
+
const Container$7 = tailwindStyledComponents.tw.div `
|
|
162
142
|
tu-spinner--container
|
|
163
143
|
${getCenteringStyles()}
|
|
164
144
|
|
|
@@ -268,12 +248,12 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fil
|
|
|
268
248
|
if (!IconComponent) {
|
|
269
249
|
return null;
|
|
270
250
|
}
|
|
271
|
-
return (jsxRuntime.jsx(React__namespace.Suspense, Object.assign({ fallback: jsxRuntime.jsx(LoadingDot, { className: iconSizeClassName }) }, { children: jsxRuntime.jsx(Root$
|
|
251
|
+
return (jsxRuntime.jsx(React__namespace.Suspense, Object.assign({ fallback: jsxRuntime.jsx(LoadingDot, { className: iconSizeClassName }) }, { children: jsxRuntime.jsx(Root$6, Object.assign({ "$color": color, onClick: onClick, "data-testid": dataTestId, ref: forwardedRef }, { children: jsxRuntime.jsx(IconComponent, { "data-testid": dataTestId ? `${dataTestId}-${name}` : name, className: `${iconSizeClassName} ${colorClassNames} ${className !== null && className !== void 0 ? className : ""} ${name} aspect-square`, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style) }) })) })));
|
|
272
252
|
};
|
|
273
253
|
const LoadingDot = tailwindStyledComponents.tw.span `
|
|
274
254
|
tu-loading-dot
|
|
275
255
|
`;
|
|
276
|
-
const Root$
|
|
256
|
+
const Root$6 = tailwindStyledComponents.tw.span `
|
|
277
257
|
tu-icon
|
|
278
258
|
${({ $color }) => {
|
|
279
259
|
switch ($color) {
|
|
@@ -317,48 +297,6 @@ const Root$9 = tailwindStyledComponents.tw.span `
|
|
|
317
297
|
}}
|
|
318
298
|
`;
|
|
319
299
|
|
|
320
|
-
/**
|
|
321
|
-
* The ActionButton component is a wrapper over IconButton to perform an action when the onClick event is triggered.
|
|
322
|
-
*
|
|
323
|
-
* @param {ActionButtonProps} props - The props for the ActionButton component
|
|
324
|
-
* @returns {JSX.Element} ActionButton component
|
|
325
|
-
*/
|
|
326
|
-
const ActionButton = ({ type, value, dataTestId, iconSize, disabled }) => {
|
|
327
|
-
const getIconName = () => {
|
|
328
|
-
switch (type) {
|
|
329
|
-
case "PHONE_NUMBER":
|
|
330
|
-
return "PhoneArrowUpRightIcon";
|
|
331
|
-
case "WEB_ADDRESS":
|
|
332
|
-
return "ArrowTopRightOnSquareIcon";
|
|
333
|
-
case "EMAIL":
|
|
334
|
-
default:
|
|
335
|
-
return "EnvelopeIcon";
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
const ButtonAction = () => {
|
|
339
|
-
switch (type) {
|
|
340
|
-
case "EMAIL":
|
|
341
|
-
return window.open(`mailto:${value}`);
|
|
342
|
-
case "WEB_ADDRESS":
|
|
343
|
-
if (value) {
|
|
344
|
-
return window.open(value, "_blank", "noopener,noreferrer");
|
|
345
|
-
}
|
|
346
|
-
return null;
|
|
347
|
-
case "PHONE_NUMBER":
|
|
348
|
-
default:
|
|
349
|
-
return window.open(`tel:${value}`);
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
return (jsxRuntime.jsx(ActionContainer, { children: jsxRuntime.jsx(StyledIconButton, { "$fieldSize": iconSize, disabled: disabled, dataTestId: dataTestId || "testIconButtonId", size: "small", color: "tertiary", icon: jsxRuntime.jsx(Icon, { size: "small", name: getIconName() }), onClick: ButtonAction }) }));
|
|
353
|
-
};
|
|
354
|
-
const ActionContainer = tailwindStyledComponents.tw.div `
|
|
355
|
-
tu-action-container
|
|
356
|
-
`;
|
|
357
|
-
const StyledIconButton = tailwindStyledComponents.twx(IconButton) `
|
|
358
|
-
tu-action-button
|
|
359
|
-
${({ $fieldSize }) => $fieldSize === "small" && tailwindStyledComponents.tws `tu-action-button--small`}
|
|
360
|
-
`;
|
|
361
|
-
|
|
362
300
|
/**
|
|
363
301
|
* The StarButton component is used for favorite actions or similar.
|
|
364
302
|
*
|
|
@@ -366,9 +304,9 @@ ${({ $fieldSize }) => $fieldSize === "small" && tailwindStyledComponents.tws `tu
|
|
|
366
304
|
* @returns {JSX.Element} StarButton component
|
|
367
305
|
*/
|
|
368
306
|
const StarButton = ({ starred, onClick }) => {
|
|
369
|
-
return (jsxRuntime.jsx(Flex$
|
|
307
|
+
return (jsxRuntime.jsx(Flex$1, Object.assign({ onClick: onClick, "data-test-id": "starred-filter" }, { children: jsxRuntime.jsx(CustomIcon, { name: "StarIcon", "$starred": starred }) })));
|
|
370
308
|
};
|
|
371
|
-
const Flex$
|
|
309
|
+
const Flex$1 = tailwindStyledComponents.tw.div `
|
|
372
310
|
flex
|
|
373
311
|
items-center
|
|
374
312
|
`;
|
|
@@ -464,13 +402,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
464
402
|
return "primary";
|
|
465
403
|
}
|
|
466
404
|
};
|
|
467
|
-
const body = inline ? (jsxRuntime.jsxs("div", { children: [title && jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && (jsxRuntime.jsx(Description
|
|
405
|
+
const body = inline ? (jsxRuntime.jsxs("div", { children: [title && jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && (jsxRuntime.jsx(Description, Object.assign({ weight: !title ? "bold" : "normal", "$hasTitle": !!title }, { children: children })))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [title && jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && (jsxRuntime.jsx(Description, Object.assign({ weight: !title ? "bold" : "normal", "$hasTitle": !!title }, { children: children })))] }));
|
|
468
406
|
React__namespace.useEffect(() => {
|
|
469
407
|
if (autoScroll) {
|
|
470
408
|
ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
|
|
471
409
|
}
|
|
472
410
|
}, [ref, autoScroll]);
|
|
473
|
-
return (jsxRuntime.jsxs(Container$
|
|
411
|
+
return (jsxRuntime.jsxs(Container$6, Object.assign({ "$color": color, className: className, "data-testid": dataTestId, "$inline": inline, ref: ref, role: "alert" }, { children: [jsxRuntime.jsx(IconContainer$1, Object.assign({ "$inline": inline }, { children: getIconFromColor() })), jsxRuntime.jsxs(Content$1, Object.assign({ "$inline": inline }, { children: [jsxRuntime.jsxs(ContentDetails, { children: [jsxRuntime.jsx(ContentBody, { children: body }), onClose && !inline ? (jsxRuntime.jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsxRuntime.jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] }), (primaryAction || secondaryAction || onClose) && (jsxRuntime.jsxs(RightAligned, Object.assign({ "$inline": inline }, { children: [secondaryAction && (jsxRuntime.jsx(Button, Object.assign({ size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading }, { children: secondaryAction.label }))), primaryAction && (jsxRuntime.jsx(Button, Object.assign({ size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading }, { children: primaryAction.label }))), onClose && inline ? (jsxRuntime.jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsxRuntime.jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] })))] }))] })));
|
|
474
412
|
};
|
|
475
413
|
const CloseButtonContainer = tailwindStyledComponents.tw.div `
|
|
476
414
|
${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert__close-button-container--inline` : tailwindStyledComponents.tws `tu-alert__close-button-container`)}
|
|
@@ -484,7 +422,7 @@ const getBackgroundColor = () => ({ $color }) => {
|
|
|
484
422
|
};
|
|
485
423
|
return colors[$color];
|
|
486
424
|
};
|
|
487
|
-
const Container$
|
|
425
|
+
const Container$6 = tailwindStyledComponents.tw.div `
|
|
488
426
|
tu-alert
|
|
489
427
|
${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert--inline` : null)}
|
|
490
428
|
${getBackgroundColor()}
|
|
@@ -498,7 +436,7 @@ const ContentDetails = tailwindStyledComponents.tw.div `
|
|
|
498
436
|
const ContentBody = tailwindStyledComponents.tw.div `
|
|
499
437
|
tu-alert__content-body
|
|
500
438
|
`;
|
|
501
|
-
const Description
|
|
439
|
+
const Description = tailwindStyledComponents.twx(Text$1) `
|
|
502
440
|
${p => (p.$hasTitle ? tailwindStyledComponents.tws `tu-alert__description` : null)}
|
|
503
441
|
`;
|
|
504
442
|
const RightAligned = tailwindStyledComponents.tw.div `
|
|
@@ -537,37 +475,6 @@ const StyledText$2 = tailwindStyledComponents.tw.text `
|
|
|
537
475
|
${getBadgeModifierClass()}
|
|
538
476
|
`;
|
|
539
477
|
|
|
540
|
-
/**
|
|
541
|
-
* A base input component that can be used for text inputs, password inputs, etc.
|
|
542
|
-
* A reference to the input element is provided as the `ref` prop.
|
|
543
|
-
* Extends props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
|
|
544
|
-
*
|
|
545
|
-
* For specific input types make sure to use the corresponding input component.
|
|
546
|
-
* This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
|
|
547
|
-
*/
|
|
548
|
-
const BaseInput = React__namespace.forwardRef((_a, ref) => {
|
|
549
|
-
var { className, isInvalid, dataTestId, prefix, suffix, addonBefore, addonAfter, actions, fieldSize = "medium", nonInteractive = false } = _a, rest = __rest(_a, ["className", "isInvalid", "dataTestId", "prefix", "suffix", "addonBefore", "addonAfter", "actions", "fieldSize", "nonInteractive"]);
|
|
550
|
-
return (jsxRuntime.jsxs(InputContainer$1, Object.assign({ "$fieldSize": fieldSize, "$invalid": isInvalid, "$disabled": rest.disabled || rest.readOnly, className: className, "data-testid": dataTestId && `${dataTestId}-container` }, { children: [addonBefore && addonBefore !== undefined ? (jsxRuntime.jsx(AddonBefore, Object.assign({ "data-testid": dataTestId && `${dataTestId}-addonBefore` }, { children: addonBefore }))) : null, prefix && addonBefore !== prefix ? (jsxRuntime.jsx(InputPrefix, Object.assign({ "data-testid": dataTestId && `${dataTestId}-prefix` }, { children: prefix }))) : null, jsxRuntime.jsx("input", Object.assign({ ref: ref, "data-testid": dataTestId, className: tailwindStyledComponents.tws `tu-input__field` }, rest, { readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsxRuntime.jsx(InputSuffix, Object.assign({ "data-testid": dataTestId && `${dataTestId}-suffix` }, { children: suffix }))) : null, actions && addonBefore !== actions ? actions : null, addonAfter && addonAfter !== undefined && addonBefore !== addonAfter ? (jsxRuntime.jsx(AddonAfter, Object.assign({ "data-testid": dataTestId && `${dataTestId}-addonAfter` }, { children: addonAfter }))) : null] })));
|
|
551
|
-
});
|
|
552
|
-
const InputPrefix = tailwindStyledComponents.tw.div `
|
|
553
|
-
tu-input__prefix
|
|
554
|
-
`;
|
|
555
|
-
const InputSuffix = tailwindStyledComponents.tw.div `
|
|
556
|
-
tu-input__suffix
|
|
557
|
-
`;
|
|
558
|
-
const AddonBefore = tailwindStyledComponents.tw.div `
|
|
559
|
-
tu-input__addon-before
|
|
560
|
-
`;
|
|
561
|
-
const AddonAfter = tailwindStyledComponents.tw.div `
|
|
562
|
-
tu-input__addon-after
|
|
563
|
-
`;
|
|
564
|
-
const InputContainer$1 = tailwindStyledComponents.tw.label `
|
|
565
|
-
tu-input
|
|
566
|
-
${({ $invalid }) => ($invalid ? tailwindStyledComponents.tws `tu-input--invalid` : null)}
|
|
567
|
-
${({ $disabled }) => ($disabled ? tailwindStyledComponents.tws `tu-input--disabled` : null)}
|
|
568
|
-
${({ $fieldSize }) => ($fieldSize === "small" ? tailwindStyledComponents.tws `tu-input--small` : null)}
|
|
569
|
-
`;
|
|
570
|
-
|
|
571
478
|
const ROLE_CARD = "region";
|
|
572
479
|
/**
|
|
573
480
|
* The Card component is a container for UI elements, and is the main component of the modal.
|
|
@@ -685,9 +592,9 @@ const StyledDensityContainer = tailwindStyledComponents.twx(DensityContainer) `
|
|
|
685
592
|
* @returns {JSX.Element} CardFooter component
|
|
686
593
|
*/
|
|
687
594
|
const CardFooter = ({ dataTestId, className, children, density, hideSeparator = false }) => {
|
|
688
|
-
return (jsxRuntime.jsx(Container$
|
|
595
|
+
return (jsxRuntime.jsx(Container$5, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density, direction: "row" }, { children: children })));
|
|
689
596
|
};
|
|
690
|
-
const Container$
|
|
597
|
+
const Container$5 = tailwindStyledComponents.twx(DensityContainer) `
|
|
691
598
|
tu-card__footer-density-container
|
|
692
599
|
${p => p.$hideSeparator && tailwindStyledComponents.tws `tu-card__footer-density-container--borderless`}
|
|
693
600
|
`;
|
|
@@ -734,101 +641,19 @@ const StyledHeading = tailwindStyledComponents.tw.div `
|
|
|
734
641
|
* @returns {JSX.Element} CardHeader component
|
|
735
642
|
*/
|
|
736
643
|
const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
|
|
737
|
-
return (jsxRuntime.jsx(Root$
|
|
644
|
+
return (jsxRuntime.jsx(Root$5, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density }, { children: jsxRuntime.jsxs(Container$4, { children: [jsxRuntime.jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxRuntime.jsxs(HeadingContainer$1, { children: [jsxRuntime.jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] }), subHeading && (jsxRuntime.jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsxRuntime.jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }), className: "!h-min" }))] }) })));
|
|
738
645
|
};
|
|
739
|
-
const Root$
|
|
646
|
+
const Root$5 = tailwindStyledComponents.twx(DensityContainer) `
|
|
740
647
|
tu-card__header-density-container
|
|
741
648
|
${p => p.$hideSeparator && tailwindStyledComponents.tws `tu-card__header-density-container--borderless`}
|
|
742
649
|
`;
|
|
743
|
-
const Container$
|
|
650
|
+
const Container$4 = tailwindStyledComponents.tw.div `
|
|
744
651
|
tu-card__header
|
|
745
652
|
`;
|
|
746
653
|
const HeadingContainer$1 = tailwindStyledComponents.tw.div `
|
|
747
654
|
tu-card__header-heading-container
|
|
748
655
|
`;
|
|
749
656
|
|
|
750
|
-
/**
|
|
751
|
-
* The Label component is used for labels for input fields.
|
|
752
|
-
* This component is **not used directly**, but is part of the FormGroup and Field components.
|
|
753
|
-
*
|
|
754
|
-
* @param {LabelProps} props - The props for the Label component
|
|
755
|
-
* @returns {JSX.Element} Label component
|
|
756
|
-
*/
|
|
757
|
-
const Label$2 = ({ id, htmlFor, children, className, dataTestId, disabled, isInvalid, }) => {
|
|
758
|
-
return (jsxRuntime.jsx(Root$7, Object.assign({ id: id || "", htmlFor: htmlFor || "", className: className, "data-testid": dataTestId, "$disabled": disabled, "$isInvalid": isInvalid }, { children: children })));
|
|
759
|
-
};
|
|
760
|
-
const Root$7 = tailwindStyledComponents.tw.label `
|
|
761
|
-
tu-label
|
|
762
|
-
${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-label--disabled`}
|
|
763
|
-
${({ $isInvalid }) => $isInvalid && tailwindStyledComponents.tws `tu-label--invalid`}
|
|
764
|
-
`;
|
|
765
|
-
|
|
766
|
-
/**
|
|
767
|
-
* The CheckIcon component is used by the checkbox to display the checked state.
|
|
768
|
-
*
|
|
769
|
-
* @param {CheckIconProps} props - The props for the CheckIcon component
|
|
770
|
-
* @returns {JSX.Element} CheckIcon component
|
|
771
|
-
*/
|
|
772
|
-
const CheckIcon = ({ className, dataTestId }) => {
|
|
773
|
-
return (jsxRuntime.jsx("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", className: className, "data-testid": dataTestId, fill: "none", viewBox: "0 0 10 10", stroke: "currentColor", strokeWidth: "2" }, { children: jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m2 5.5 2 2L8.5 3" }) })));
|
|
774
|
-
};
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
* The IndeterminateIcon component is used by the checkbox to display the Indeterminate state.
|
|
778
|
-
*
|
|
779
|
-
* @param {IndeterminateIconProps} props - The props for the IndeterminateIcon component
|
|
780
|
-
* @returns {JSX.Element} IndeterminateIcon component
|
|
781
|
-
*/
|
|
782
|
-
const IndeterminateIcon = ({ className }) => (jsxRuntime.jsx("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", className: className, fill: "none", viewBox: "0 0 10 10", stroke: "currentColor", strokeWidth: "2" }, { children: jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 5h4" }) })));
|
|
783
|
-
|
|
784
|
-
/**
|
|
785
|
-
* Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.
|
|
786
|
-
*
|
|
787
|
-
* Checkboxes are used for multiple choices, not for mutually exclusive choices. Each checkbox works independently from other checkboxes in the list, therefore checking an additional box does not affect any other selections.
|
|
788
|
-
*
|
|
789
|
-
* _**Do use** checkboxes to allow selection in a form, for filtering, terms and conditions to indicate agreement, and bulk actions in lists or tables._
|
|
790
|
-
*
|
|
791
|
-
* _**Do not use** checkboxes if the user can only select one option from a list, radio buttons should be used instead of checkboxes._
|
|
792
|
-
*
|
|
793
|
-
* @description A reference to the input element is provided as the `ref` prop.
|
|
794
|
-
* @augments props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
|
|
795
|
-
* @param {CheckboxProps} props - The props for the Checkbox component
|
|
796
|
-
* @returns {JSX.Element} Checkbox component
|
|
797
|
-
*/
|
|
798
|
-
const Checkbox = React__namespace.forwardRef((_a, ref) => {
|
|
799
|
-
var { className, dataTestId, onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, children, label, tabIndex = 0 } = _a, rest = __rest(_a, ["className", "dataTestId", "onChange", "checked", "disabled", "isInvalid", "readOnly", "indeterminate", "children", "label", "tabIndex"]);
|
|
800
|
-
const icon = indeterminate ? jsxRuntime.jsx(StyledIndeterminateIcon, {}) : checked && jsxRuntime.jsx(StyledCheckIcon, {});
|
|
801
|
-
const internalRef = React__namespace.useRef(null);
|
|
802
|
-
const isReadonly = disabled || readOnly;
|
|
803
|
-
const onKeyPress = e => {
|
|
804
|
-
var _a;
|
|
805
|
-
if ("Space" === e.code) {
|
|
806
|
-
(_a = internalRef === null || internalRef === void 0 ? void 0 : internalRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
807
|
-
}
|
|
808
|
-
};
|
|
809
|
-
const uuid = rest.id || dataTestId;
|
|
810
|
-
return (jsxRuntime.jsxs(CheckboxContainer, Object.assign({ "data-testid": dataTestId && `${dataTestId}Container`, htmlFor: uuid, className: className }, { children: [jsxRuntime.jsx(HiddenInput$1, Object.assign({ type: "checkbox", checked: !indeterminate && checked, onChange: onChange, disabled: disabled, "data-testid": dataTestId, readOnly: readOnly, "aria-checked": !indeterminate && checked, role: "checkbox", id: uuid }, rest, { ref: ref })), jsxRuntime.jsx(CheckboxWrapper, Object.assign({ id: uuid, "$disabled": isReadonly, "$checked": checked, "$indeterminate": indeterminate, "$isInvalid": isReadonly ? false : isInvalid, tabIndex: isReadonly ? -1 : tabIndex, onKeyPress: onKeyPress }, { children: icon })), label && (jsxRuntime.jsx(Label$2, Object.assign({ className: tailwindStyledComponents.tws `cursor-pointer`, htmlFor: uuid, disabled: isReadonly, isInvalid: isReadonly ? false : isInvalid, dataTestId: dataTestId && `${dataTestId}-Label` }, { children: label }))), children] })));
|
|
811
|
-
});
|
|
812
|
-
const StyledCheckIcon = tailwindStyledComponents.twx(CheckIcon) `tu-checkbox--icon`;
|
|
813
|
-
const StyledIndeterminateIcon = tailwindStyledComponents.twx(IndeterminateIcon) `tu-checkbox--icon`;
|
|
814
|
-
const CheckboxContainer = tailwindStyledComponents.tw.label `tu-checkbox--container group`;
|
|
815
|
-
const HiddenInput$1 = tailwindStyledComponents.tw.input `tu-checkbox--input`;
|
|
816
|
-
const CheckboxWrapper = tailwindStyledComponents.tw.span `
|
|
817
|
-
tu-checkbox
|
|
818
|
-
${({ $checked, $disabled, $indeterminate }) => {
|
|
819
|
-
if ($disabled) {
|
|
820
|
-
return tailwindStyledComponents.tws `tu-checkbox--disabled`;
|
|
821
|
-
}
|
|
822
|
-
return $indeterminate
|
|
823
|
-
? tailwindStyledComponents.tws `tu-checkbox--indeterminate`
|
|
824
|
-
: $checked
|
|
825
|
-
? tailwindStyledComponents.tws `tu-checkbox--selected`
|
|
826
|
-
: tailwindStyledComponents.tws `tu-checkbox--deselected`;
|
|
827
|
-
}}
|
|
828
|
-
|
|
829
|
-
${({ $isInvalid }) => $isInvalid && tailwindStyledComponents.tws `tu-checkbox--invalid`}
|
|
830
|
-
`;
|
|
831
|
-
|
|
832
657
|
/**
|
|
833
658
|
* The Collapse component is used to condense non-important information.
|
|
834
659
|
*
|
|
@@ -843,7 +668,7 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
|
|
|
843
668
|
}
|
|
844
669
|
setExpanded(!expanded);
|
|
845
670
|
}, [expanded, onToggle]);
|
|
846
|
-
return (jsxRuntime.jsxs(StyledCollapse, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsxRuntime.jsx(CollapseLabel, Object.assign({ role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxRuntime.jsxs(LabelContainer
|
|
671
|
+
return (jsxRuntime.jsxs(StyledCollapse, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsxRuntime.jsx(CollapseLabel, Object.assign({ role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxRuntime.jsxs(LabelContainer, { children: [jsxRuntime.jsx(Text$1, Object.assign({ weight: "bold" }, { children: label })), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Rotate, { name: "ChevronDownIcon", size: "small", "$expanded": expanded }), size: "medium", variant: "transparent", color: "secondary" })] }) })), jsxRuntime.jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
|
|
847
672
|
};
|
|
848
673
|
const Rotate = tailwindStyledComponents.twx(Icon) `
|
|
849
674
|
${p => (p.$expanded ? tailwindStyledComponents.tws `tu-icon--animated-rotate-expanded` : null)}
|
|
@@ -855,7 +680,7 @@ const StyledCollapse = tailwindStyledComponents.tw.div `
|
|
|
855
680
|
const CollapseLabel = tailwindStyledComponents.tw.div `
|
|
856
681
|
tu-collapse__label
|
|
857
682
|
`;
|
|
858
|
-
const LabelContainer
|
|
683
|
+
const LabelContainer = tailwindStyledComponents.tw.div `
|
|
859
684
|
tu-collapse__label__container
|
|
860
685
|
`;
|
|
861
686
|
const Collapsible = ({ children, expanded, id }) => {
|
|
@@ -890,21 +715,48 @@ const StyledCopyableText = tailwindStyledComponents.tw.span `
|
|
|
890
715
|
tu-copyable-text
|
|
891
716
|
${p => (p.$animating ? tailwindStyledComponents.tws `tu-copyable-text--animating` : null)}`;
|
|
892
717
|
|
|
718
|
+
const localeLookup = {
|
|
719
|
+
en: locale.enGB,
|
|
720
|
+
"en-US": locale.enUS,
|
|
721
|
+
"en-GB": locale.enGB,
|
|
722
|
+
da: locale.da,
|
|
723
|
+
de: locale.de,
|
|
724
|
+
cs: locale.cs,
|
|
725
|
+
nl: locale.nl,
|
|
726
|
+
fr: locale.fr,
|
|
727
|
+
fi: locale.fi,
|
|
728
|
+
hu: locale.hu,
|
|
729
|
+
it: locale.it,
|
|
730
|
+
nb: locale.nb,
|
|
731
|
+
pl: locale.pl,
|
|
732
|
+
pt: locale.pt,
|
|
733
|
+
ru: locale.ru,
|
|
734
|
+
ro: locale.ro,
|
|
735
|
+
es: locale.es,
|
|
736
|
+
sv: locale.sv,
|
|
737
|
+
ja: locale.ja,
|
|
738
|
+
th: locale.th,
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* A helper function to get the matching Locale object for a given language.
|
|
742
|
+
*
|
|
743
|
+
* @param {string} language The language to match
|
|
744
|
+
* @returns {Locale} The corresponding Locale object
|
|
745
|
+
*/
|
|
746
|
+
const useLocale = (language) => {
|
|
747
|
+
return localeLookup[language] || localeLookup.en;
|
|
748
|
+
};
|
|
749
|
+
|
|
893
750
|
/**
|
|
894
|
-
*
|
|
751
|
+
* The DayPicker component is used when the user needs to select a date.
|
|
895
752
|
*
|
|
896
|
-
*
|
|
753
|
+
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
754
|
+
* @returns {JSX.Element} DayPicker component
|
|
897
755
|
*/
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
// Chrome needs it's default icon to have datepicker functionality.
|
|
903
|
-
// window.chrome doesn't exist in TS but is available on chrome browsers.
|
|
904
|
-
// If it fails it will just show our icon.
|
|
905
|
-
const hideOnChrome = () => (window.chrome !== null && typeof window.chrome !== "undefined" ? "hidden" : "");
|
|
906
|
-
return (jsxRuntime.jsx(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: jsxRuntime.jsx(Icon, { dataTestId: "calendar", name: "CalendarIcon", size: "medium", type: "solid", className: hideOnChrome() }) }, rest)));
|
|
907
|
-
});
|
|
756
|
+
const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, className, dataTestId, max, }) => {
|
|
757
|
+
const locale = useLocale(language);
|
|
758
|
+
return (jsxRuntime.jsx(reactDayPicker.DayPicker, { onDayClick: onDaySelect, selected: selectedDays, locale: locale, disabled: disabledDays, className: `custom-day-picker ${className !== null && className !== void 0 ? className : ""}`, max: max, footer: jsxRuntime.jsx("div", { "data-testid": dataTestId }) }));
|
|
759
|
+
};
|
|
908
760
|
|
|
909
761
|
/**
|
|
910
762
|
* The hook that powers the Popover component.
|
|
@@ -1007,9 +859,9 @@ const PopoverContent = React__default["default"].forwardRef(function PopoverCont
|
|
|
1007
859
|
* @returns {JSX.Element} PopoverTitle component
|
|
1008
860
|
*/
|
|
1009
861
|
const PopoverTitle = ({ children, action, divider = false, className, dataTestId }) => {
|
|
1010
|
-
return (jsxRuntime.jsxs(Container$
|
|
862
|
+
return (jsxRuntime.jsxs(Container$3, Object.assign({ "$divider": divider, className: className, "data-testid": dataTestId }, { children: [jsxRuntime.jsx(StyledText$1, Object.assign({ type: "div", subtle: true, size: "small", weight: "bold", uppercase: true }, { children: children })), action] })));
|
|
1011
863
|
};
|
|
1012
|
-
const Container$
|
|
864
|
+
const Container$3 = tailwindStyledComponents.tw.div `
|
|
1013
865
|
tu-popover-title-container
|
|
1014
866
|
${p => p.$divider && `tu-popover-title-container--divider`}
|
|
1015
867
|
`;
|
|
@@ -1031,134 +883,6 @@ const PopoverTrigger = React.forwardRef(function PopoverTrigger(_a, propRef) {
|
|
|
1031
883
|
}
|
|
1032
884
|
});
|
|
1033
885
|
|
|
1034
|
-
/**
|
|
1035
|
-
* The Tooltip component is used to show helpful tips or contextual information to the users.
|
|
1036
|
-
*
|
|
1037
|
-
* @param {TooltipProps} props - The props for the Tooltip component
|
|
1038
|
-
* @returns {JSX.Element} Tooltip component
|
|
1039
|
-
*/
|
|
1040
|
-
const Tooltip = (_a) => {
|
|
1041
|
-
var { children, dataTestId, disabled, className } = _a, rest = __rest(_a, ["children", "dataTestId", "disabled", "className"]);
|
|
1042
|
-
const wrappedChildren = (jsxRuntime.jsx(Flex$1, Object.assign({ className: className, "data-testid": dataTestId && `${dataTestId}-parent` }, { children: children })));
|
|
1043
|
-
if (disabled) {
|
|
1044
|
-
return wrappedChildren;
|
|
1045
|
-
}
|
|
1046
|
-
return (jsxRuntime.jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
|
|
1047
|
-
};
|
|
1048
|
-
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.jsxs(StyledPopover, Object.assign({ className: "tu-tooltip__container", placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "" }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: children }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx(Content, Object.assign({ "$mode": mode }, { children: jsxRuntime.jsx(Text$1, Object.assign({ inverted: mode === "dark", type: contentTextType }, { children: label })) })) })] })));
|
|
1049
|
-
const Flex$1 = tailwindStyledComponents.tw.div `
|
|
1050
|
-
inline-flex
|
|
1051
|
-
`;
|
|
1052
|
-
const StyledPopover = tailwindStyledComponents.twx(Popover) `
|
|
1053
|
-
tu-tooltip__container
|
|
1054
|
-
`;
|
|
1055
|
-
const Content = tailwindStyledComponents.tw.div `
|
|
1056
|
-
tu-tooltip__content
|
|
1057
|
-
${p => (p.$mode === "light" ? tailwindStyledComponents.tws `tu-tooltip--light` : null)}
|
|
1058
|
-
`;
|
|
1059
|
-
|
|
1060
|
-
/**
|
|
1061
|
-
* The Tip component is used to show helpful tips or contextual information to the users.
|
|
1062
|
-
* The tip can optionally be rendered as an anchor tag, which redirects to users to an external link on click.
|
|
1063
|
-
*
|
|
1064
|
-
* @param {TipProps} props - The props for the Tip component
|
|
1065
|
-
* @returns {JSX.Element} Tip component
|
|
1066
|
-
*/
|
|
1067
|
-
const Tip = ({ children, iconProps, dataTestId, link, renderAs = "span", className, placement = "bottom", mode, }) => {
|
|
1068
|
-
const ifAnchorTag = renderAs === "a";
|
|
1069
|
-
return (jsxRuntime.jsx(TipContainer, Object.assign({ "data-testid": dataTestId, "$as": renderAs, href: ifAnchorTag ? link : undefined, target: ifAnchorTag ? "_blank" : undefined, className: className }, { children: jsxRuntime.jsx(Tooltip, Object.assign({ label: children, dataTestId: dataTestId && `${dataTestId}-tooltip`, mode: mode, className: "tu-tip-tooltip", placement: placement }, { children: jsxRuntime.jsx(Icon, Object.assign({ name: "QuestionMarkCircleIcon", size: "medium", dataTestId: dataTestId && `${dataTestId}-icon` }, iconProps)) })) })));
|
|
1070
|
-
};
|
|
1071
|
-
const TipContainer = tailwindStyledComponents.tw.text `
|
|
1072
|
-
tu-tip
|
|
1073
|
-
`;
|
|
1074
|
-
|
|
1075
|
-
/**
|
|
1076
|
-
* The FormGroup component should be used to wrap any Input element that needs a label.
|
|
1077
|
-
* Besides a label the component supplies an optional Tip, HelpText and HelpAddon support.
|
|
1078
|
-
*
|
|
1079
|
-
* @param {FormGroupProps} props - The props for the FormGroup component
|
|
1080
|
-
* @returns {JSX.Element} FormGroup component
|
|
1081
|
-
*/
|
|
1082
|
-
const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, disabled = false, }) => {
|
|
1083
|
-
return (jsxRuntime.jsxs(FormGroupRoot, Object.assign({ className: className, "data-testid": dataTestId, "$disabled": disabled }, { children: [jsxRuntime.jsxs(ContainerBefore, { children: [jsxRuntime.jsx(FormGroupLabel, Object.assign({ dataTestId: dataTestId && `${dataTestId}-label`, htmlFor: htmlFor, id: htmlFor + "-label" }, { children: label })), tip && jsxRuntime.jsx(Tip, Object.assign({ dataTestId: dataTestId && `${dataTestId}-tip` }, { children: tip }))] }), children, jsxRuntime.jsxs(ContainerAfter, Object.assign({ "$isInvalid": isInvalid }, { children: [helpText && jsxRuntime.jsx("span", Object.assign({ "data-testid": dataTestId && `${dataTestId}-helpText` }, { children: helpText })), helpAddon && jsxRuntime.jsx(HelpAddon, Object.assign({ "data-testid": dataTestId && `${dataTestId}-helpAddon` }, { children: helpAddon }))] }))] })));
|
|
1084
|
-
};
|
|
1085
|
-
const FormGroupRoot = tailwindStyledComponents.tw.div `
|
|
1086
|
-
tu-form-group
|
|
1087
|
-
${({ $disabled }) => {
|
|
1088
|
-
return $disabled ? "pointer-events-none" : null;
|
|
1089
|
-
}}
|
|
1090
|
-
`;
|
|
1091
|
-
const ContainerBefore = tailwindStyledComponents.tw.div `
|
|
1092
|
-
tu-form-group__container-before
|
|
1093
|
-
`;
|
|
1094
|
-
const FormGroupLabel = tailwindStyledComponents.twx(Label$2) `
|
|
1095
|
-
component-formGroup-font
|
|
1096
|
-
`;
|
|
1097
|
-
const ContainerAfter = tailwindStyledComponents.tw.div `
|
|
1098
|
-
tu-form-group__container-after
|
|
1099
|
-
${({ $isInvalid }) => ($isInvalid ? tailwindStyledComponents.tws `tu-form-group__container-after--invalid` : null)}
|
|
1100
|
-
`;
|
|
1101
|
-
const HelpAddon = tailwindStyledComponents.tw.span `
|
|
1102
|
-
tu-form-group__help-addon
|
|
1103
|
-
`;
|
|
1104
|
-
|
|
1105
|
-
/**
|
|
1106
|
-
* The date field component is used for entering date values.
|
|
1107
|
-
*
|
|
1108
|
-
* _**Do use**_ the DateField for date input.
|
|
1109
|
-
*
|
|
1110
|
-
* _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
|
|
1111
|
-
*/
|
|
1112
|
-
const DateField = React.forwardRef((_a, ref) => {
|
|
1113
|
-
var { label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "className", "defaultValue", "dataTestId"]);
|
|
1114
|
-
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
1115
|
-
const htmlForId = id ? id : "dateField-" + uuid.v4();
|
|
1116
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, disabled: rest.disabled, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(DateInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, defaultValue: defaultValue, isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
|
|
1117
|
-
});
|
|
1118
|
-
|
|
1119
|
-
const localeLookup = {
|
|
1120
|
-
en: locale.enGB,
|
|
1121
|
-
"en-US": locale.enUS,
|
|
1122
|
-
"en-GB": locale.enGB,
|
|
1123
|
-
da: locale.da,
|
|
1124
|
-
de: locale.de,
|
|
1125
|
-
cs: locale.cs,
|
|
1126
|
-
nl: locale.nl,
|
|
1127
|
-
fr: locale.fr,
|
|
1128
|
-
fi: locale.fi,
|
|
1129
|
-
hu: locale.hu,
|
|
1130
|
-
it: locale.it,
|
|
1131
|
-
nb: locale.nb,
|
|
1132
|
-
pl: locale.pl,
|
|
1133
|
-
pt: locale.pt,
|
|
1134
|
-
ru: locale.ru,
|
|
1135
|
-
ro: locale.ro,
|
|
1136
|
-
es: locale.es,
|
|
1137
|
-
sv: locale.sv,
|
|
1138
|
-
ja: locale.ja,
|
|
1139
|
-
th: locale.th,
|
|
1140
|
-
};
|
|
1141
|
-
/**
|
|
1142
|
-
* A helper function to get the matching Locale object for a given language.
|
|
1143
|
-
*
|
|
1144
|
-
* @param {string} language The language to match
|
|
1145
|
-
* @returns {Locale} The corresponding Locale object
|
|
1146
|
-
*/
|
|
1147
|
-
const useLocale = (language) => {
|
|
1148
|
-
return localeLookup[language] || localeLookup.en;
|
|
1149
|
-
};
|
|
1150
|
-
|
|
1151
|
-
/**
|
|
1152
|
-
* The DayPicker component is used when the user needs to select a date.
|
|
1153
|
-
*
|
|
1154
|
-
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
1155
|
-
* @returns {JSX.Element} DayPicker component
|
|
1156
|
-
*/
|
|
1157
|
-
const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, className, dataTestId, max, }) => {
|
|
1158
|
-
const locale = useLocale(language);
|
|
1159
|
-
return (jsxRuntime.jsx(reactDayPicker.DayPicker, { onDayClick: onDaySelect, selected: selectedDays, locale: locale, disabled: disabledDays, className: `custom-day-picker ${className !== null && className !== void 0 ? className : ""}`, max: max, footer: jsxRuntime.jsx("div", { "data-testid": dataTestId }) }));
|
|
1160
|
-
};
|
|
1161
|
-
|
|
1162
886
|
/**
|
|
1163
887
|
* The DayPickerPopover component returns a button which when clicked shows the daypicker.
|
|
1164
888
|
*
|
|
@@ -1212,7 +936,7 @@ const Drawer = ({ open, onClose = () => { }, children, disableOverlay = false, p
|
|
|
1212
936
|
window.removeEventListener("keyup", onKeyPress);
|
|
1213
937
|
};
|
|
1214
938
|
}, [open, onClose]);
|
|
1215
|
-
return (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ context: context }, { children: open ? (jsxRuntime.jsxs(Root$
|
|
939
|
+
return (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ context: context }, { children: open ? (jsxRuntime.jsxs(Root$4, Object.assign({ id: "drawer" }, { children: [!disableOverlay && jsxRuntime.jsx(Overlay, { "aria-hidden": open, "$open": open, onClick: onClose, id: "drawer__overlay" }), jsxRuntime.jsx(StyledCard$1, Object.assign({ "aria-hidden": open, "data-testId": dataTestId, "$open": open, "$position": position, id: "drawer__card", className: className }, { children: children }))] }))) : (
|
|
1216
940
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
1217
941
|
jsxRuntime.jsx(jsxRuntime.Fragment, {})) })));
|
|
1218
942
|
};
|
|
@@ -1234,7 +958,7 @@ const StyledCard$1 = tailwindStyledComponents.twx(Card) `
|
|
|
1234
958
|
${({ $open }) => $open && tailwindStyledComponents.tws `tu-drawer__card--open`}
|
|
1235
959
|
${({ $position }) => getPositionStyles($position)}
|
|
1236
960
|
`;
|
|
1237
|
-
const Root$
|
|
961
|
+
const Root$4 = tailwindStyledComponents.tw.div `
|
|
1238
962
|
tu-drawer
|
|
1239
963
|
`;
|
|
1240
964
|
const Overlay = tailwindStyledComponents.tw.div `
|
|
@@ -1242,103 +966,6 @@ const Overlay = tailwindStyledComponents.tw.div `
|
|
|
1242
966
|
${({ $open }) => $open && tailwindStyledComponents.tws `tu-drawer__overlay--open`}
|
|
1243
967
|
`;
|
|
1244
968
|
|
|
1245
|
-
/**
|
|
1246
|
-
* The Drop Zone can be used to drag and drop files
|
|
1247
|
-
*
|
|
1248
|
-
* @param {DropZoneProps} props - The props for the DropZone component
|
|
1249
|
-
* @returns {JSX.Element} DropZone component
|
|
1250
|
-
*/
|
|
1251
|
-
const DropZone = (_a) => {
|
|
1252
|
-
var { className, dataTestId, filesSelected, label, size = "large", isInvalid = false, disabled = false } = _a, rest = __rest(_a, ["className", "dataTestId", "filesSelected", "label", "size", "isInvalid", "disabled"]);
|
|
1253
|
-
const [dragActive, setDragActive] = React__default["default"].useState(false);
|
|
1254
|
-
const [fileDropped, setFileDropped] = React__default["default"].useState(false);
|
|
1255
|
-
// function that handles drag enter, drag leave and drag over
|
|
1256
|
-
const handleDrag = (e) => {
|
|
1257
|
-
e.preventDefault();
|
|
1258
|
-
e.stopPropagation();
|
|
1259
|
-
if ((e.type === "dragenter" || e.type === "dragover") && !disabled) {
|
|
1260
|
-
setDragActive(true);
|
|
1261
|
-
}
|
|
1262
|
-
else if (e.type === "dragleave") {
|
|
1263
|
-
setDragActive(false);
|
|
1264
|
-
}
|
|
1265
|
-
};
|
|
1266
|
-
//function to handle when user clicks on dropzone to upload
|
|
1267
|
-
const handleChange = (e) => {
|
|
1268
|
-
e.preventDefault();
|
|
1269
|
-
e.stopPropagation();
|
|
1270
|
-
if (e.target.files && !disabled) {
|
|
1271
|
-
filesSelected(e.target.files);
|
|
1272
|
-
}
|
|
1273
|
-
};
|
|
1274
|
-
//funtion to handle drop
|
|
1275
|
-
const handleDrop = (e) => {
|
|
1276
|
-
e.preventDefault();
|
|
1277
|
-
e.stopPropagation();
|
|
1278
|
-
setDragActive(false);
|
|
1279
|
-
if (e.dataTransfer.files && e.dataTransfer.files[0] && !disabled) {
|
|
1280
|
-
filesSelected(e.dataTransfer.files);
|
|
1281
|
-
setFileDropped(true);
|
|
1282
|
-
}
|
|
1283
|
-
};
|
|
1284
|
-
return (jsxRuntime.jsxs(Root$5, Object.assign({ "$disabled": disabled, "$isInvalid": isInvalid, "$dragActive": dragActive, "$fileDropped": fileDropped, "$size": size, className: className, "data-testid": dataTestId, onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, onClick: e => {
|
|
1285
|
-
if (disabled) {
|
|
1286
|
-
e.preventDefault();
|
|
1287
|
-
e.stopPropagation();
|
|
1288
|
-
}
|
|
1289
|
-
} }, rest, { children: [jsxRuntime.jsx("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxRuntime.jsxs(DropZoneLabel, Object.assign({ htmlFor: "input-file-upload", "data-testid": dataTestId && `${dataTestId}-label` }, { children: [jsxRuntime.jsx(Icon, { type: "solid", name: "ArrowUpCircleIcon", color: isInvalid ? "danger" : "neutral", style: !isInvalid ? { color: "rgb(156 163 175)" } : {} }), jsxRuntime.jsx("span", { children: label })] }))] })));
|
|
1290
|
-
};
|
|
1291
|
-
const Root$5 = tailwindStyledComponents.tw.div `
|
|
1292
|
-
tu-drop-zone
|
|
1293
|
-
${({ $size }) => ($size === "small" ? tailwindStyledComponents.tws `tu-drop-zone--small` : null)}
|
|
1294
|
-
${({ $size }) => ($size === "medium" ? tailwindStyledComponents.tws `tu-drop-zone--medium` : null)}
|
|
1295
|
-
${({ $size }) => ($size === "large" ? tailwindStyledComponents.tws `tu-drop-zone--large` : null)}
|
|
1296
|
-
${({ $dragActive }) => ($dragActive ? tailwindStyledComponents.tws `tu-drop-zone--drag-active` : null)}
|
|
1297
|
-
${({ $fileDropped }) => ($fileDropped ? tailwindStyledComponents.tws `tu-drop-zone--drop-complete` : null)}
|
|
1298
|
-
${({ $isInvalid }) => ($isInvalid ? tailwindStyledComponents.tws `tu-drop-zone--invalid` : null)}
|
|
1299
|
-
${({ $disabled }) => ($disabled ? tailwindStyledComponents.tws `tu-drop-zone--disabled` : null)}
|
|
1300
|
-
`;
|
|
1301
|
-
const DropZoneLabel = tailwindStyledComponents.tw.label `
|
|
1302
|
-
tu-drop-zone__label
|
|
1303
|
-
`;
|
|
1304
|
-
|
|
1305
|
-
/**
|
|
1306
|
-
* A Email Input component is used for input of the type Email.
|
|
1307
|
-
*
|
|
1308
|
-
* It has an ActionButton which sends an email to the specified address using "mailto:" link.
|
|
1309
|
-
*
|
|
1310
|
-
* Extends props of BaseInput.
|
|
1311
|
-
*
|
|
1312
|
-
* A reference to the input element is provided as the `ref` prop.
|
|
1313
|
-
* For specific input types make sure to use the corresponding input component.
|
|
1314
|
-
*/
|
|
1315
|
-
const EmailInput = React__namespace.forwardRef((_a, ref) => {
|
|
1316
|
-
var { fieldSize = "medium", disabled = false, dataTestId } = _a, rest = __rest(_a, ["fieldSize", "disabled", "dataTestId"]);
|
|
1317
|
-
const [email, setEmail] = React__namespace.useState("");
|
|
1318
|
-
const sendEmail = () => {
|
|
1319
|
-
return window.open(`mailto:${email}`);
|
|
1320
|
-
};
|
|
1321
|
-
return (jsxRuntime.jsx(BaseInput, Object.assign({ dataTestId: dataTestId, fieldSize: fieldSize, ref: ref, type: "email", placeholder: rest.placeholder || "mail@example.com", onChange: e => setEmail(e.target.value) }, rest, { actions: jsxRuntime.jsx(ActionButton, { disabled: disabled, value: email, type: "EMAIL", onClick: sendEmail, dataTestId: dataTestId && `${dataTestId}-emailIcon`, iconSize: fieldSize }) })));
|
|
1322
|
-
});
|
|
1323
|
-
|
|
1324
|
-
/**
|
|
1325
|
-
* The EmailField component is used to enter email.
|
|
1326
|
-
* EmailField validates that user enters a valid email address.
|
|
1327
|
-
*
|
|
1328
|
-
*/
|
|
1329
|
-
const EmailField = React.forwardRef((_a, ref) => {
|
|
1330
|
-
var { label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "className", "defaultValue", "dataTestId"]);
|
|
1331
|
-
const [value, setValue] = React.useState(defaultValue);
|
|
1332
|
-
const htmlForId = id ? id : "emailField-" + uuid.v4();
|
|
1333
|
-
// Type guard to check if value is a string
|
|
1334
|
-
function isString(inputValue) {
|
|
1335
|
-
return typeof inputValue === "string";
|
|
1336
|
-
}
|
|
1337
|
-
// Check the regular expression only if value is a string
|
|
1338
|
-
const renderAsInvalid = !!errorMessage || (isString(value) && !/^\S+@\S+\.\S+$/.test(value));
|
|
1339
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, disabled: rest.disabled, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(EmailInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, value: value, onChange: e => setValue(e.target.value), isInvalid: renderAsInvalid, disabled: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
|
|
1340
|
-
});
|
|
1341
|
-
|
|
1342
969
|
/**
|
|
1343
970
|
* The external link component is used to link to an external page outside the Trackunit Manager.
|
|
1344
971
|
*
|
|
@@ -1363,9 +990,9 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
|
|
|
1363
990
|
*/
|
|
1364
991
|
const Indicator = (_a) => {
|
|
1365
992
|
var { dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false } = _a, rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping"]);
|
|
1366
|
-
return (jsxRuntime.jsxs(Container$
|
|
993
|
+
return (jsxRuntime.jsxs(Container$2, Object.assign({ "$color": color, "data-testid": dataTestId }, rest, { title: !withLabel ? label : undefined }, { children: [jsxRuntime.jsxs(IconBackground, Object.assign({ "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", "$withBackground": withBackground }, { children: [ping && jsxRuntime.jsx(Ping, { "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" }), icon] })), label !== undefined && withLabel && (jsxRuntime.jsx(Label$1, Object.assign({ "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label" }, { children: label })))] })));
|
|
1367
994
|
};
|
|
1368
|
-
const Container$
|
|
995
|
+
const Container$2 = tailwindStyledComponents.tw.div `
|
|
1369
996
|
tu-indicator
|
|
1370
997
|
${({ $color }) => {
|
|
1371
998
|
switch ($color) {
|
|
@@ -1448,12 +1075,12 @@ const Ping = tailwindStyledComponents.tw.span `
|
|
|
1448
1075
|
*/
|
|
1449
1076
|
const MenuItem = ({ className, dataTestId, label, children, selected, focused, prefix, suffix, disabled, onClick, }) => {
|
|
1450
1077
|
const containerProps = useContainerProps({ className, dataTestId });
|
|
1451
|
-
return (jsxRuntime.jsxs(Container$
|
|
1078
|
+
return (jsxRuntime.jsxs(Container$1, Object.assign({}, containerProps, { onClick: e => {
|
|
1452
1079
|
e.stopPropagation();
|
|
1453
1080
|
onClick && onClick(e);
|
|
1454
1081
|
}, "$selected": selected, "$focused": focused, tabIndex: 0, "$disabled": disabled }, { children: [prefix && (jsxRuntime.jsx(Prefix, Object.assign({ "$selected": selected, "data-testid": dataTestId && `${dataTestId}-prefix` }, { children: prefix }))), children && typeof children !== "string" ? (children) : (jsxRuntime.jsx(Label, Object.assign({ "data-testid": dataTestId && `${dataTestId}-label` }, { children: children !== null && children !== void 0 ? children : label }))), suffix && (jsxRuntime.jsx(Suffix, Object.assign({ "$selected": selected, "data-testid": dataTestId && `${dataTestId}-suffix` }, { children: suffix })))] })));
|
|
1455
1082
|
};
|
|
1456
|
-
const Container$
|
|
1083
|
+
const Container$1 = tailwindStyledComponents.tw.div `
|
|
1457
1084
|
group tu-menu-item
|
|
1458
1085
|
${({ $selected }) => ($selected ? tailwindStyledComponents.tws `tu-menu-item--selected ` : "tu-menu-item--unselected")}
|
|
1459
1086
|
${({ $focused }) => ($focused ? tailwindStyledComponents.tws `tu-menu-item--focused ` : "")}
|
|
@@ -1482,9 +1109,9 @@ const MenuList = (_a) => {
|
|
|
1482
1109
|
var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a; __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
|
|
1483
1110
|
const childrenArr = React.Children.toArray(children);
|
|
1484
1111
|
const isLastItem = (index) => index === childrenArr.length - 1;
|
|
1485
|
-
return (jsxRuntime.jsx(Container
|
|
1112
|
+
return (jsxRuntime.jsx(Container, Object.assign({ "$withStickyHeader": withStickyHeader, "data-testid": dataTestId, className: className, tabIndex: 0, role: "list" }, { children: React.Children.map(childrenArr, (menuItem, index) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [menuItem, showDivider && !isLastItem(index) && jsxRuntime.jsx(Divider, {})] }))) })));
|
|
1486
1113
|
};
|
|
1487
|
-
const Container
|
|
1114
|
+
const Container = tailwindStyledComponents.tw.div `
|
|
1488
1115
|
tu-menu-list
|
|
1489
1116
|
${props => props.$withStickyHeader && tailwindStyledComponents.tws `tu-menu-list--sticky-header`}
|
|
1490
1117
|
`;
|
|
@@ -1731,11 +1358,11 @@ const MoreMenu = ({ className, dataTestId, dotsDirection = "horizontal", menuPla
|
|
|
1731
1358
|
useClickOutside(actionMenuRef, () => {
|
|
1732
1359
|
setActionMenuIsOpen(false);
|
|
1733
1360
|
});
|
|
1734
|
-
return (jsxRuntime.jsx(Root$
|
|
1361
|
+
return (jsxRuntime.jsx(Root$3, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxRuntime.jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsxRuntime.jsx(Icon, Object.assign({ name: dotsName }, iconProps)), onClick: () => {
|
|
1735
1362
|
setActionMenuIsOpen(!actionMenuIsOpen);
|
|
1736
1363
|
} })) }), jsxRuntime.jsx(PopoverContent, { children: close => (typeof children === "function" ? children(close) : children) })] })) })));
|
|
1737
1364
|
};
|
|
1738
|
-
const Root$
|
|
1365
|
+
const Root$3 = tailwindStyledComponents.tw.div `
|
|
1739
1366
|
tu-more-menu
|
|
1740
1367
|
${({ variant }) => (variant === "primary" ? tailwindStyledComponents.tws `tu-more-menu--primary` : "")}
|
|
1741
1368
|
`;
|
|
@@ -1814,27 +1441,6 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
1814
1441
|
};
|
|
1815
1442
|
};
|
|
1816
1443
|
|
|
1817
|
-
/**
|
|
1818
|
-
* A thin wrapper around the `BaseInput` component for number input fields.
|
|
1819
|
-
*
|
|
1820
|
-
* NOTE: If shown with a label, please use the `NumberField` component instead.
|
|
1821
|
-
*/
|
|
1822
|
-
const NumberInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BaseInput, Object.assign({ ref: ref, type: "number" }, props))));
|
|
1823
|
-
|
|
1824
|
-
/**
|
|
1825
|
-
* The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
|
|
1826
|
-
*
|
|
1827
|
-
* _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
|
|
1828
|
-
*
|
|
1829
|
-
* _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
|
|
1830
|
-
*/
|
|
1831
|
-
const NumberField = React.forwardRef((_a, ref) => {
|
|
1832
|
-
var { label, id, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "maxLength", "className", "value", "dataTestId"]);
|
|
1833
|
-
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
1834
|
-
const htmlForId = id ? id : "numberField-" + uuid.v4();
|
|
1835
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(NumberInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
|
|
1836
|
-
});
|
|
1837
|
-
|
|
1838
1444
|
/**
|
|
1839
1445
|
* The tag component is used to categorize elements in the ui.
|
|
1840
1446
|
*
|
|
@@ -1889,6 +1495,47 @@ const IconContainer = tailwindStyledComponents.tw.div `
|
|
|
1889
1495
|
tu-tag__icon-container
|
|
1890
1496
|
`;
|
|
1891
1497
|
|
|
1498
|
+
/**
|
|
1499
|
+
* The Tooltip component is used to show helpful tips or contextual information to the users.
|
|
1500
|
+
*
|
|
1501
|
+
* @param {TooltipProps} props - The props for the Tooltip component
|
|
1502
|
+
* @returns {JSX.Element} Tooltip component
|
|
1503
|
+
*/
|
|
1504
|
+
const Tooltip = (_a) => {
|
|
1505
|
+
var { children, dataTestId, disabled, className } = _a, rest = __rest(_a, ["children", "dataTestId", "disabled", "className"]);
|
|
1506
|
+
const wrappedChildren = (jsxRuntime.jsx(Flex, Object.assign({ className: className, "data-testid": dataTestId && `${dataTestId}-parent` }, { children: children })));
|
|
1507
|
+
if (disabled) {
|
|
1508
|
+
return wrappedChildren;
|
|
1509
|
+
}
|
|
1510
|
+
return (jsxRuntime.jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
|
|
1511
|
+
};
|
|
1512
|
+
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.jsxs(StyledPopover, Object.assign({ className: "tu-tooltip__container", placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "" }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: children }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx(Content, Object.assign({ "$mode": mode }, { children: jsxRuntime.jsx(Text$1, Object.assign({ inverted: mode === "dark", type: contentTextType }, { children: label })) })) })] })));
|
|
1513
|
+
const Flex = tailwindStyledComponents.tw.div `
|
|
1514
|
+
inline-flex
|
|
1515
|
+
`;
|
|
1516
|
+
const StyledPopover = tailwindStyledComponents.twx(Popover) `
|
|
1517
|
+
tu-tooltip__container
|
|
1518
|
+
`;
|
|
1519
|
+
const Content = tailwindStyledComponents.tw.div `
|
|
1520
|
+
tu-tooltip__content
|
|
1521
|
+
${p => (p.$mode === "light" ? tailwindStyledComponents.tws `tu-tooltip--light` : null)}
|
|
1522
|
+
`;
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* The Tip component is used to show helpful tips or contextual information to the users.
|
|
1526
|
+
* The tip can optionally be rendered as an anchor tag, which redirects to users to an external link on click.
|
|
1527
|
+
*
|
|
1528
|
+
* @param {TipProps} props - The props for the Tip component
|
|
1529
|
+
* @returns {JSX.Element} Tip component
|
|
1530
|
+
*/
|
|
1531
|
+
const Tip = ({ children, iconProps, dataTestId, link, renderAs = "span", className, placement = "bottom", mode, }) => {
|
|
1532
|
+
const ifAnchorTag = renderAs === "a";
|
|
1533
|
+
return (jsxRuntime.jsx(TipContainer, Object.assign({ "data-testid": dataTestId, "$as": renderAs, href: ifAnchorTag ? link : undefined, target: ifAnchorTag ? "_blank" : undefined, className: className }, { children: jsxRuntime.jsx(Tooltip, Object.assign({ label: children, dataTestId: dataTestId && `${dataTestId}-tooltip`, mode: mode, className: "tu-tip-tooltip", placement: placement }, { children: jsxRuntime.jsx(Icon, Object.assign({ name: "QuestionMarkCircleIcon", size: "medium", dataTestId: dataTestId && `${dataTestId}-icon` }, iconProps)) })) })));
|
|
1534
|
+
};
|
|
1535
|
+
const TipContainer = tailwindStyledComponents.tw.text `
|
|
1536
|
+
tu-tip
|
|
1537
|
+
`;
|
|
1538
|
+
|
|
1892
1539
|
/**
|
|
1893
1540
|
* Pageheader component is used to display a page header.
|
|
1894
1541
|
*
|
|
@@ -2000,573 +1647,19 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
2000
1647
|
onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange({ from, to, description });
|
|
2001
1648
|
}, [page, onPageChange, previousPage, nextPage]);
|
|
2002
1649
|
if (loading) {
|
|
2003
|
-
return (jsxRuntime.jsx(Root$
|
|
1650
|
+
return (jsxRuntime.jsx(Root$2, Object.assign({ className: className }, { children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) })));
|
|
2004
1651
|
}
|
|
2005
|
-
return (jsxRuntime.jsxs(Root$
|
|
1652
|
+
return (jsxRuntime.jsxs(Root$2, Object.assign({ "data-testid": dataTestId, className: className }, { children: [jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronLeftIcon", size: "small" }), size: "small", color: "secondary", variant: "transparent" }), !cursorBase && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TextStyled, Object.assign({ dataTestId: "current-page" }, { children: currentPage })), jsxRuntime.jsx(TextStyled, Object.assign({ dataTestId: "page-count" }, { children: pageCount !== null && pageCount !== undefined && getTranslatedCount(pageCount) }))] })), jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
|
|
2006
1653
|
? !canNextPage || false
|
|
2007
1654
|
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronRightIcon", size: "small" }), size: "small", color: "secondary", variant: "transparent" })] })));
|
|
2008
1655
|
};
|
|
2009
|
-
const Root$
|
|
1656
|
+
const Root$2 = tailwindStyledComponents.tw.div `
|
|
2010
1657
|
tu-pagination
|
|
2011
1658
|
`;
|
|
2012
1659
|
const TextStyled = tailwindStyledComponents.twx(Text$1) `
|
|
2013
1660
|
tu-pagination__text
|
|
2014
1661
|
`;
|
|
2015
1662
|
|
|
2016
|
-
/**
|
|
2017
|
-
* The SelectContainer component.
|
|
2018
|
-
*
|
|
2019
|
-
* @param {SelectContainerProps} props - The props for the SelectContainer component
|
|
2020
|
-
* @returns {JSX.Element} SelectContainer component
|
|
2021
|
-
*/
|
|
2022
|
-
const SelectContainer$1 = ({ children, label, hideLabel, id, hasError, error, description, info, dataTestId, isDisabled, }) => {
|
|
2023
|
-
return (jsxRuntime.jsxs(Container$2, Object.assign({ "data-testid": dataTestId, "$hasError": hasError, "$isDisabled": isDisabled }, { children: [label && !hideLabel && jsxRuntime.jsx(Label$2, Object.assign({ htmlFor: id }, { children: label })), children, (hasError || info) && (jsxRuntime.jsx(InformativeText, Object.assign({ size: "small", "$hasError": hasError !== null && hasError !== void 0 ? hasError : false }, { children: hasError ? error : info })))] })));
|
|
2024
|
-
};
|
|
2025
|
-
const Container$2 = tailwindStyledComponents.tw.label `
|
|
2026
|
-
tu-select__container
|
|
2027
|
-
tu-select
|
|
2028
|
-
${({ $hasError }) => ($hasError ? tailwindStyledComponents.tws `tu-select--invalid` : null)}
|
|
2029
|
-
${({ $isDisabled }) => ($isDisabled ? tailwindStyledComponents.tws `tu-select--disabled` : null)}
|
|
2030
|
-
`;
|
|
2031
|
-
const InformativeText = tailwindStyledComponents.twx(Text$1) `
|
|
2032
|
-
tu-informative-text
|
|
2033
|
-
${p => (p.$hasError ? `tu-informative-text--error` : null)}
|
|
2034
|
-
`;
|
|
2035
|
-
|
|
2036
|
-
/**
|
|
2037
|
-
* @param {MultiValue<Option> | SingleValue<Option>} arg option to check type
|
|
2038
|
-
* @returns {arg is MultiValue<Option> } is Multivalue
|
|
2039
|
-
*/
|
|
2040
|
-
function isMultiValue(arg) {
|
|
2041
|
-
return Array.isArray(arg);
|
|
2042
|
-
}
|
|
2043
|
-
function isGroupBase(arg) {
|
|
2044
|
-
return arg.options !== undefined;
|
|
2045
|
-
}
|
|
2046
|
-
const isSelectedOption = (option, selected) => {
|
|
2047
|
-
if (isGroupBase(option)) {
|
|
2048
|
-
return false;
|
|
2049
|
-
}
|
|
2050
|
-
return isMultiValue(selected)
|
|
2051
|
-
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2052
|
-
selected.some(v => v.value === option.value)
|
|
2053
|
-
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2054
|
-
option.value === (selected === null || selected === void 0 ? void 0 : selected.value);
|
|
2055
|
-
};
|
|
2056
|
-
const removeSelectedFromGroups = (group, selected) => {
|
|
2057
|
-
if (isGroupBase(group)) {
|
|
2058
|
-
return Object.assign(Object.assign({}, group), { options: group.options.filter(option => !isSelectedOption(option, selected)) });
|
|
2059
|
-
}
|
|
2060
|
-
return group;
|
|
2061
|
-
};
|
|
2062
|
-
/**
|
|
2063
|
-
* @template IsMulti
|
|
2064
|
-
* @template Group
|
|
2065
|
-
* @param {OptionsOrGroups<Option, Group> | undefined} options An array of options to select from
|
|
2066
|
-
* @param {PropsValue<Option> | undefined} value Selected values
|
|
2067
|
-
* @returns {OptionsOrGroups<Option, Group>} An array of ordered options with selected on top
|
|
2068
|
-
*/
|
|
2069
|
-
const getOrderedOptions = (options, value) => {
|
|
2070
|
-
if (value && options) {
|
|
2071
|
-
const orderedValues = isMultiValue(value)
|
|
2072
|
-
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2073
|
-
[...value].sort((a, b) => a.label.localeCompare(b.label))
|
|
2074
|
-
: [value];
|
|
2075
|
-
const selectableOptions = options
|
|
2076
|
-
.filter(option => !isSelectedOption(option, value))
|
|
2077
|
-
.map(option => removeSelectedFromGroups(option, value));
|
|
2078
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2079
|
-
return orderedValues.concat(selectableOptions) || [];
|
|
2080
|
-
}
|
|
2081
|
-
return options || [];
|
|
2082
|
-
};
|
|
2083
|
-
const SelectPrefix = tailwindStyledComponents.tw.div `
|
|
2084
|
-
tu-select__prefix
|
|
2085
|
-
`;
|
|
2086
|
-
|
|
2087
|
-
/**
|
|
2088
|
-
* A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
|
|
2089
|
-
*
|
|
2090
|
-
* @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
|
|
2091
|
-
* @returns {JSX.Element} SingleSelectMenuItem
|
|
2092
|
-
*/
|
|
2093
|
-
const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, focused, disabled, }) => {
|
|
2094
|
-
return (jsxRuntime.jsx(MenuItem, { dataTestId: dataTestId, label: label, prefix: icon, onClick: onClick, selected: selected, disabled: disabled, focused: focused, suffix: selected ? jsxRuntime.jsx(Icon, { name: "CheckIcon", size: "small" }) : undefined }));
|
|
2095
|
-
};
|
|
2096
|
-
/**
|
|
2097
|
-
* A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
|
|
2098
|
-
*
|
|
2099
|
-
* @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
|
|
2100
|
-
* @returns {JSX.Element} multi select menu item
|
|
2101
|
-
*/
|
|
2102
|
-
const MultiSelectMenuItem = ({ label, onClick, selected, dataTestId, focused, disabled, }) => {
|
|
2103
|
-
return (jsxRuntime.jsx(MenuItem, { dataTestId: dataTestId, label: label, disabled: disabled, prefix: jsxRuntime.jsx(Checkbox, { checked: selected, readOnly: false, onChange: () => null, disabled: disabled, onClick: e => {
|
|
2104
|
-
e.stopPropagation();
|
|
2105
|
-
} }), onClick: e => {
|
|
2106
|
-
e.stopPropagation();
|
|
2107
|
-
onClick && onClick(e);
|
|
2108
|
-
}, selected: selected, focused: focused }));
|
|
2109
|
-
};
|
|
2110
|
-
|
|
2111
|
-
/**
|
|
2112
|
-
* Extended Tag component with information about its own width.
|
|
2113
|
-
* Used in the select component.
|
|
2114
|
-
*
|
|
2115
|
-
* @param {TagProps} props - The props for the tag component
|
|
2116
|
-
* @returns {JSX.Element} TagWithWidth component
|
|
2117
|
-
*/
|
|
2118
|
-
const TagWithWidth = (_a) => {
|
|
2119
|
-
var { onWidthKnown, children } = _a, rest = __rest(_a, ["onWidthKnown", "children"]);
|
|
2120
|
-
const ref = React__default["default"].useRef(null);
|
|
2121
|
-
React__default["default"].useLayoutEffect(() => {
|
|
2122
|
-
var _a;
|
|
2123
|
-
onWidthKnown && onWidthKnown({ width: ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0 });
|
|
2124
|
-
}, [ref, onWidthKnown]);
|
|
2125
|
-
return (jsxRuntime.jsx(Tag, Object.assign({ ref: ref }, rest, { children: children })));
|
|
2126
|
-
};
|
|
2127
|
-
|
|
2128
|
-
/**
|
|
2129
|
-
* TagsContainer component to display tags in limited space when children can't fit space it displays counter
|
|
2130
|
-
*
|
|
2131
|
-
* @param {TagsContainerProps} props - The props for the TagContainer
|
|
2132
|
-
* @returns {JSX.Element} TagsContainer
|
|
2133
|
-
*/
|
|
2134
|
-
const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix }) => {
|
|
2135
|
-
const [isReady, setIsReady] = React__default["default"].useState(false);
|
|
2136
|
-
const [counterWidth, setCounterWidth] = React__default["default"].useState(0);
|
|
2137
|
-
const containerRef = React__default["default"].useRef(null);
|
|
2138
|
-
const availableWidth = React__default["default"].useRef();
|
|
2139
|
-
const childrenWidth = React__default["default"].useRef([]);
|
|
2140
|
-
const itemsCount = items.length;
|
|
2141
|
-
React__default["default"].useLayoutEffect(() => {
|
|
2142
|
-
var _a;
|
|
2143
|
-
availableWidth.current = ((_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0;
|
|
2144
|
-
}, [containerRef]);
|
|
2145
|
-
const onWidthKnownHandler = ({ width: reportedWidth }) => {
|
|
2146
|
-
childrenWidth.current.push({ width: reportedWidth + itemsGap });
|
|
2147
|
-
if (childrenWidth.current.length === itemsCount) {
|
|
2148
|
-
setIsReady(true);
|
|
2149
|
-
}
|
|
2150
|
-
};
|
|
2151
|
-
const requiredSpace = childrenWidth.current.reduce((previous, current) => {
|
|
2152
|
-
return previous + current.width;
|
|
2153
|
-
}, 0);
|
|
2154
|
-
let counter = 0;
|
|
2155
|
-
const availableSpace = ((availableWidth === null || availableWidth === void 0 ? void 0 : availableWidth.current) || 0) - counterWidth;
|
|
2156
|
-
const renderedElements = items
|
|
2157
|
-
.concat({ text: "", onClick: () => null, disabled: false }) // reserved element for a potential counter
|
|
2158
|
-
.map((item, index) => {
|
|
2159
|
-
const spaceNeeded = childrenWidth.current.slice(0, index + 1).reduce((previous, current) => {
|
|
2160
|
-
return previous + current.width;
|
|
2161
|
-
}, 0);
|
|
2162
|
-
const isLast = index === items.length;
|
|
2163
|
-
const counterRequired = requiredSpace > availableSpace && counter !== 0;
|
|
2164
|
-
if (isLast && counterRequired) {
|
|
2165
|
-
return (jsxRuntime.jsx(TagWithWidth, Object.assign({ onWidthKnown: ({ width: reportedWidth }) => setCounterWidth(reportedWidth), color: "neutral" }, { children: jsxRuntime.jsxs(Counter, { children: ["+", counter] }) }), item.text + index));
|
|
2166
|
-
}
|
|
2167
|
-
if (isLast) {
|
|
2168
|
-
return null;
|
|
2169
|
-
}
|
|
2170
|
-
const itemCanFit = spaceNeeded <= availableSpace;
|
|
2171
|
-
if (itemCanFit) {
|
|
2172
|
-
return (jsxRuntime.jsx(TagWithWidth, Object.assign({ onWidthKnown: onWidthKnownHandler, className: tailwindStyledComponents.tws `shrink-0 inline-flex`, onClose: e => {
|
|
2173
|
-
e.stopPropagation();
|
|
2174
|
-
item.onClick();
|
|
2175
|
-
}, color: item.disabled ? "unknown" : "primary", dataTestId: item.text }, { children: item.text }), item.text + index));
|
|
2176
|
-
}
|
|
2177
|
-
const fromTheItems = item.text !== "";
|
|
2178
|
-
if (fromTheItems) {
|
|
2179
|
-
counter = counter + 1;
|
|
2180
|
-
}
|
|
2181
|
-
return null;
|
|
2182
|
-
})
|
|
2183
|
-
.filter(element => element !== null);
|
|
2184
|
-
return (jsxRuntime.jsxs(Container$1, Object.assign({ style: {
|
|
2185
|
-
width: `${width}`,
|
|
2186
|
-
}, "$ready": isReady, ref: containerRef }, { children: [renderedElements, postFix] })));
|
|
2187
|
-
};
|
|
2188
|
-
const Container$1 = tailwindStyledComponents.tw.div `
|
|
2189
|
-
tu-select__dynamic-tag--container
|
|
2190
|
-
${({ $ready }) => {
|
|
2191
|
-
return $ready ? tailwindStyledComponents.tws `visible` : tailwindStyledComponents.tws `invisible`;
|
|
2192
|
-
}}
|
|
2193
|
-
`;
|
|
2194
|
-
const Counter = tailwindStyledComponents.tw.div `
|
|
2195
|
-
tu-select__counter
|
|
2196
|
-
`;
|
|
2197
|
-
|
|
2198
|
-
/**
|
|
2199
|
-
* A hook to retrieve components override object.
|
|
2200
|
-
* This complex object includes all the compositional components that are used in react-select. If you wish to overwrite a component, pass in an object with the appropriate namespace.
|
|
2201
|
-
*
|
|
2202
|
-
* @template IsMulti
|
|
2203
|
-
* @template Group
|
|
2204
|
-
* @param {Partial<SelectComponents<Option, IsMulti, Group>> | undefined} componentsProps a custom component prop that you can to override defaults
|
|
2205
|
-
* @param {boolean} disabled decide to override disabled variant
|
|
2206
|
-
* @param {boolean} menuIsOpen menu is open state
|
|
2207
|
-
* @param {React.MutableRefObject<boolean>} refMenuIsEnabled a flag to block menu from open
|
|
2208
|
-
* @param {string} dataTestId a test id
|
|
2209
|
-
* @param {number} maxSelectedDisplayCount a number of max display count
|
|
2210
|
-
* @param {JSX.Element} dropdownIcon an custom dropdown icon
|
|
2211
|
-
* @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
|
|
2212
|
-
*/
|
|
2213
|
-
const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon) => {
|
|
2214
|
-
// perhaps it should not be wrap in memo (causing some issues with opening and closing on mobiles)
|
|
2215
|
-
const customComponents = React__namespace.useMemo(() => {
|
|
2216
|
-
return Object.assign({ ValueContainer: props => {
|
|
2217
|
-
if (props.isMulti) {
|
|
2218
|
-
const PLACEHOLDER_KEY = "placeholder";
|
|
2219
|
-
const key = props && props.children && props.children[0] ? props.children[0].key : "";
|
|
2220
|
-
const values = props && props.children ? props.children[0] : [];
|
|
2221
|
-
const tags = key === PLACEHOLDER_KEY ? [] : values;
|
|
2222
|
-
const searchInput = props && props.children && props.children[1];
|
|
2223
|
-
return (jsxRuntime.jsx(ReactSelect.components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled }, { children: maxSelectedDisplayCount === undefined ? (jsxRuntime.jsx(TagsContainer, { width: "100%", items: tags
|
|
2224
|
-
? tags.map(({ props: tagProps }) => {
|
|
2225
|
-
return {
|
|
2226
|
-
text: tagProps.children,
|
|
2227
|
-
onClick: disabled
|
|
2228
|
-
? undefined
|
|
2229
|
-
: (e) => {
|
|
2230
|
-
var _a, _b;
|
|
2231
|
-
refMenuIsEnabled.current = false;
|
|
2232
|
-
((_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));
|
|
2233
|
-
},
|
|
2234
|
-
disabled: disabled,
|
|
2235
|
-
};
|
|
2236
|
-
})
|
|
2237
|
-
: [], postFix: searchInput })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [tags &&
|
|
2238
|
-
tags.slice(0, maxSelectedDisplayCount).map(({ props: tagProps }) => {
|
|
2239
|
-
var _a, _b;
|
|
2240
|
-
return (jsxRuntime.jsx(Tag, Object.assign({ className: tailwindStyledComponents.tws `shrink-0 inline-flex`, onClose: e => {
|
|
2241
|
-
var _a, _b;
|
|
2242
|
-
e.stopPropagation();
|
|
2243
|
-
refMenuIsEnabled.current = false;
|
|
2244
|
-
((_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));
|
|
2245
|
-
}, color: disabled ? "unknown" : "primary", dataTestId: (_a = tagProps.children) === null || _a === void 0 ? void 0 : _a.toString() }, { children: tagProps.children }), (_b = tagProps.children) === null || _b === void 0 ? void 0 : _b.toString()));
|
|
2246
|
-
}), tags && tags.length > maxSelectedDisplayCount && (jsxRuntime.jsxs(Tag, Object.assign({ color: "neutral", dataTestId: "counter" }, { children: ["+", tags.length - maxSelectedDisplayCount] }))), searchInput] })) })));
|
|
2247
|
-
}
|
|
2248
|
-
return (jsxRuntime.jsx(ReactSelect.components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled }, { children: props.children })));
|
|
2249
|
-
}, LoadingIndicator: props => {
|
|
2250
|
-
return jsxRuntime.jsx(Spinner, { size: "small", className: tailwindStyledComponents.tws `mt-1.5 mr-1` });
|
|
2251
|
-
}, DropdownIndicator: props => {
|
|
2252
|
-
const icon = props.selectProps.menuIsOpen ? (jsxRuntime.jsx(Icon, { name: "ChevronUpIcon", size: "medium" })) : (jsxRuntime.jsx(Icon, { name: "ChevronDownIcon", size: "medium" }));
|
|
2253
|
-
return props.selectProps.isLoading ? null : (jsxRuntime.jsx(ReactSelect.components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(StyledIcon, { children: dropdownIcon ? dropdownIcon : icon }) })));
|
|
2254
|
-
}, IndicatorSeparator: () => null, ClearIndicator: props => {
|
|
2255
|
-
if (disabled) {
|
|
2256
|
-
return null;
|
|
2257
|
-
}
|
|
2258
|
-
return (jsxRuntime.jsx(ReactSelect.components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(XMarkIcon, Object.assign({ onClick: props.clearValue, "data-testid": dataTestId && `${dataTestId}-XMarkIcon` }, { children: jsxRuntime.jsx(Icon, { name: "XCircleIcon", size: "medium" }) })) })));
|
|
2259
|
-
}, Control: props => {
|
|
2260
|
-
return (jsxRuntime.jsx(ReactSelect.components.Control, Object.assign({}, props, { className: props.isDisabled ? tailwindStyledComponents.tws `tu-select__control--disabled` : "" })));
|
|
2261
|
-
}, SingleValue: props => {
|
|
2262
|
-
return (jsxRuntime.jsx(ReactSelect.components.SingleValue, Object.assign({}, props, { className: props.isDisabled ? tailwindStyledComponents.tws `tu-select__single-value--disabled` : "" }, { children: jsxRuntime.jsx("div", Object.assign({ "data-testid": dataTestId + "-singleValue" }, { children: props.children })) })));
|
|
2263
|
-
}, Menu: props => {
|
|
2264
|
-
return (jsxRuntime.jsx(ReactSelect.components.Menu, Object.assign({}, props, { className: props.selectProps.menuIsOpen
|
|
2265
|
-
? tailwindStyledComponents.tws `tu-select__menu-list animate-fade-in-fast`
|
|
2266
|
-
: tailwindStyledComponents.tws `tu-select__menu-list animate-fade-out-fast` })));
|
|
2267
|
-
}, Option: props => {
|
|
2268
|
-
const componentProps = {
|
|
2269
|
-
label: props.label,
|
|
2270
|
-
focused: props.isFocused,
|
|
2271
|
-
selected: props.isSelected,
|
|
2272
|
-
onClick: props.innerProps.onClick,
|
|
2273
|
-
};
|
|
2274
|
-
return (jsxRuntime.jsx(ReactSelect.components.Option, Object.assign({}, props, { innerProps: Object.assign(Object.assign({}, props.innerProps), { role: "option", onClick: () => { } }) }, { children: props.isMulti ? (jsxRuntime.jsx(MultiSelectMenuItem, Object.assign({}, componentProps, { disabled: disabled, dataTestId: props.label }))) : (jsxRuntime.jsx(SingleSelectMenuItem, Object.assign({}, componentProps, { disabled: disabled || props.isDisabled, dataTestId: props.label }))) })));
|
|
2275
|
-
} }, componentsProps);
|
|
2276
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2277
|
-
}, [componentsProps, disabled, maxSelectedDisplayCount]); // do not add dropdownIcon (it will cause issue with opening/closing list for selects with custom icon)
|
|
2278
|
-
return customComponents;
|
|
2279
|
-
};
|
|
2280
|
-
const StyledIcon = tailwindStyledComponents.tw.div `
|
|
2281
|
-
tu-select--icon
|
|
2282
|
-
`;
|
|
2283
|
-
const XMarkIcon = tailwindStyledComponents.tw.div `
|
|
2284
|
-
tu-select--icon
|
|
2285
|
-
tu-select__x-icon
|
|
2286
|
-
`;
|
|
2287
|
-
|
|
2288
|
-
/**
|
|
2289
|
-
* @template IsMulti
|
|
2290
|
-
* @template Group
|
|
2291
|
-
* @param {React.RefObject<HTMLDivElement>} refContainer react ref to container element
|
|
2292
|
-
* @param {React.RefObject<HTMLDivElement>} refPrefix react ref to prefix element
|
|
2293
|
-
* @param {number | undefined} maxSelectedDisplayCount a number of max display count
|
|
2294
|
-
* @param {StylesConfig<Option, IsMulti, Group> | undefined} styles a optional object to override styles of react-select
|
|
2295
|
-
* @returns {StylesConfig<Option, boolean>} styles to override in select
|
|
2296
|
-
*/
|
|
2297
|
-
const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, styles) => {
|
|
2298
|
-
const customStyles = React__namespace.useMemo(() => {
|
|
2299
|
-
return Object.assign({ control: base => {
|
|
2300
|
-
return Object.assign(Object.assign({}, base), { border: "0", boxShadow: "0", "&:hover": {
|
|
2301
|
-
border: "0",
|
|
2302
|
-
}, marginRight: "2px", backgroundColor: "" });
|
|
2303
|
-
}, singleValue: base => (Object.assign({}, base)), multiValue: base => (Object.assign({}, base)), multiValueLabel: base => (Object.assign({}, base)), indicatorsContainer: base => (Object.assign({}, base)), indicatorSeparator: () => ({
|
|
2304
|
-
width: "0px",
|
|
2305
|
-
}), menu: base => {
|
|
2306
|
-
return Object.assign(Object.assign({}, base), { width: "100%", marginTop: "4px", marginBottom: "18px", transition: "all 1s ease-in-out" });
|
|
2307
|
-
}, input: base => (Object.assign(Object.assign({}, base), { marginLeft: "0px" })), placeholder: base => (Object.assign({}, base)), option: () => ({}), menuPortal: base => (Object.assign(Object.assign({}, base), { width: (refContainer === null || refContainer === void 0 ? void 0 : refContainer.current) ? `${refContainer.current.clientWidth}px` : base.width, transform: (refPrefix === null || refPrefix === void 0 ? void 0 : refPrefix.current) ? `translate(-${refPrefix.current.clientWidth + 2}px)` : "translate(-2px)", backgroundColor: "#ffffff", borderRadius: "var(--border-radius-lg)", zIndex: 20, borderColor: "rgb(var(--color-slate-300))", boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)" })), menuList: base => {
|
|
2308
|
-
return Object.assign(Object.assign({}, base), { position: "relative", padding: "var(--spacing-1)", display: "grid", gap: "var(--spacing-1)", width: "100%", borderRadius: "0px", boxShadow: "none", paddingTop: "0px" });
|
|
2309
|
-
}, valueContainer: base => {
|
|
2310
|
-
return Object.assign(Object.assign({}, base), { flexWrap: maxSelectedDisplayCount !== undefined ? "wrap" : "nowrap", gap: "0.25rem" });
|
|
2311
|
-
}, container: base => (Object.assign(Object.assign({}, base), { border: "none", width: "calc(100% - 2px)", paddingLeft: "2px" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
|
|
2312
|
-
return Object.assign(Object.assign({}, base), { padding: "0px" });
|
|
2313
|
-
} }, styles);
|
|
2314
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2315
|
-
}, [refContainer, refPrefix]);
|
|
2316
|
-
return { customStyles };
|
|
2317
|
-
};
|
|
2318
|
-
|
|
2319
|
-
/**
|
|
2320
|
-
* A hook used by selects to share the common code
|
|
2321
|
-
*
|
|
2322
|
-
* @param {SelectProps} props - The props for the Select component
|
|
2323
|
-
* @returns {IUseSelect} Select component
|
|
2324
|
-
*/
|
|
2325
|
-
const useSelect = (_a) => {
|
|
2326
|
-
var _b;
|
|
2327
|
-
var { id, className, dataTestId = "select", prefix, async, dropdownIcon, maxMenuHeight = 200, label, hasError, disabled, isMulti, components, value, options, onChange, isLoading, classNamePrefix = "", onMenuOpen, onMenuClose, maxSelectedDisplayCount = undefined, isClearable = false, isSearchable = true, onMenuScrollToBottom, styles, filterOption, onInputChange } = _a, 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"]);
|
|
2328
|
-
const refContainer = React__default["default"].useRef(null);
|
|
2329
|
-
const refPrefix = React__default["default"].useRef(null);
|
|
2330
|
-
const { customStyles } = useCustomStyles(refContainer, refPrefix, maxSelectedDisplayCount, styles);
|
|
2331
|
-
const [menuIsOpen, setMenuIsOpen] = React__default["default"].useState((_b = props.menuIsOpen) !== null && _b !== void 0 ? _b : false);
|
|
2332
|
-
const refMenuIsEnabled = React__default["default"].useRef(true);
|
|
2333
|
-
const customComponents = useCustomComponents(components, disabled || false, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon);
|
|
2334
|
-
const menuPlacement = "auto";
|
|
2335
|
-
const openMenuHandler = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2336
|
-
onMenuOpen && onMenuOpen();
|
|
2337
|
-
if (refMenuIsEnabled.current) {
|
|
2338
|
-
setMenuIsOpen(true);
|
|
2339
|
-
}
|
|
2340
|
-
else {
|
|
2341
|
-
refMenuIsEnabled.current = true;
|
|
2342
|
-
}
|
|
2343
|
-
});
|
|
2344
|
-
const closeMenuHandler = () => {
|
|
2345
|
-
setMenuIsOpen(false);
|
|
2346
|
-
onMenuClose && onMenuClose();
|
|
2347
|
-
};
|
|
2348
|
-
const orderedOptions = React__default["default"].useMemo(() => {
|
|
2349
|
-
return disabled
|
|
2350
|
-
? getOrderedOptions(options, value).map(option => {
|
|
2351
|
-
return Object.assign(Object.assign({}, option), { disabled: true });
|
|
2352
|
-
})
|
|
2353
|
-
: getOrderedOptions(options, value);
|
|
2354
|
-
}, [options, value, disabled]);
|
|
2355
|
-
return {
|
|
2356
|
-
refContainer,
|
|
2357
|
-
refPrefix,
|
|
2358
|
-
customStyles,
|
|
2359
|
-
menuIsOpen,
|
|
2360
|
-
customComponents,
|
|
2361
|
-
menuPlacement,
|
|
2362
|
-
openMenuHandler,
|
|
2363
|
-
closeMenuHandler,
|
|
2364
|
-
orderedOptions,
|
|
2365
|
-
};
|
|
2366
|
-
};
|
|
2367
|
-
|
|
2368
|
-
/**
|
|
2369
|
-
* The CreatableSelect component.
|
|
2370
|
-
*
|
|
2371
|
-
* @param {CreateableSelectProps} props - The props for the CreatableSelect component
|
|
2372
|
-
* @returns {JSX.Element} CreatableSelect component
|
|
2373
|
-
*/
|
|
2374
|
-
const CreatableSelect = (props) => {
|
|
2375
|
-
const { id, dataTestId = "select", async, maxMenuHeight = 200, label, error, disabled, isMulti, value, hideLabel, description, info, options, onChange, isLoading, classNamePrefix = "", filterOption, prefix, } = props;
|
|
2376
|
-
const hasError = !!error;
|
|
2377
|
-
const { refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
2378
|
-
const selectProps = {
|
|
2379
|
-
value,
|
|
2380
|
-
menuPlacement,
|
|
2381
|
-
maxMenuHeight,
|
|
2382
|
-
onChange,
|
|
2383
|
-
"aria-label": label,
|
|
2384
|
-
"data-testid": dataTestId,
|
|
2385
|
-
components: customComponents,
|
|
2386
|
-
styles: customStyles,
|
|
2387
|
-
tabSelectsValue: false,
|
|
2388
|
-
blurInputOnSelect: !isMulti,
|
|
2389
|
-
menuPortalTarget: document.body,
|
|
2390
|
-
isSearchable: disabled ? false : true,
|
|
2391
|
-
menuShouldBlockScroll: true,
|
|
2392
|
-
menuShouldScrollIntoView: true,
|
|
2393
|
-
openMenuOnFocus: disabled ? false : true,
|
|
2394
|
-
menuIsOpen: disabled ? false : menuIsOpen,
|
|
2395
|
-
openMenuOnClick: true,
|
|
2396
|
-
closeMenuOnSelect: false,
|
|
2397
|
-
isMulti: isMulti,
|
|
2398
|
-
classNamePrefix,
|
|
2399
|
-
isLoading,
|
|
2400
|
-
id,
|
|
2401
|
-
};
|
|
2402
|
-
return (jsxRuntime.jsx(SelectContainer$1, Object.assign({ label: label, hideLabel: hideLabel, id: id, hasError: hasError, error: error, description: description, info: info, dataTestId: dataTestId, isDisabled: disabled }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [prefix !== undefined && (jsxRuntime.jsx(SelectPrefix, Object.assign({ "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix }, { children: prefix }))), async ? (jsxRuntime.jsx(ReactAsyncCreatableSelect__default["default"], Object.assign({ "aria-label": label, maxMenuHeight: maxMenuHeight, "data-testid": dataTestId, components: customComponents }, props, { onMenuOpen: () => {
|
|
2403
|
-
!disabled && openMenuHandler();
|
|
2404
|
-
}, onMenuClose: () => {
|
|
2405
|
-
closeMenuHandler();
|
|
2406
|
-
} }))) : (jsxRuntime.jsx(ReactCreatableSelect__default["default"], Object.assign({}, selectProps, { options: filterOption ? orderedOptions : options, isMulti: isMulti, onMenuOpen: () => {
|
|
2407
|
-
!disabled && openMenuHandler();
|
|
2408
|
-
}, onMenuClose: () => {
|
|
2409
|
-
closeMenuHandler();
|
|
2410
|
-
} })))] }) })));
|
|
2411
|
-
};
|
|
2412
|
-
|
|
2413
|
-
/**
|
|
2414
|
-
* Selects are input components used to choose a value from a set.
|
|
2415
|
-
*
|
|
2416
|
-
* @param {SelectProps} props - The props for the Select component
|
|
2417
|
-
* @returns {JSX.Element} Select component
|
|
2418
|
-
*/
|
|
2419
|
-
const Select = (props) => {
|
|
2420
|
-
const { className } = props, propsNoClassName = __rest(props, ["className"]);
|
|
2421
|
-
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = "", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable, } = props;
|
|
2422
|
-
const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
2423
|
-
const selectProps = {
|
|
2424
|
-
value,
|
|
2425
|
-
menuPlacement,
|
|
2426
|
-
maxMenuHeight,
|
|
2427
|
-
onChange,
|
|
2428
|
-
"aria-label": label,
|
|
2429
|
-
"data-testid": dataTestId,
|
|
2430
|
-
components: customComponents,
|
|
2431
|
-
styles: customStyles,
|
|
2432
|
-
tabSelectsValue: false,
|
|
2433
|
-
blurInputOnSelect: !isMulti,
|
|
2434
|
-
menuPortalTarget: props.menuPortalTarget || document.body,
|
|
2435
|
-
isSearchable: disabled ? false : isSearchable,
|
|
2436
|
-
menuShouldBlockScroll: true,
|
|
2437
|
-
menuShouldScrollIntoView: true,
|
|
2438
|
-
openMenuOnFocus: true,
|
|
2439
|
-
menuIsOpen,
|
|
2440
|
-
openMenuOnClick: true,
|
|
2441
|
-
closeMenuOnSelect: false,
|
|
2442
|
-
isMulti,
|
|
2443
|
-
classNamePrefix,
|
|
2444
|
-
isLoading,
|
|
2445
|
-
isClearable,
|
|
2446
|
-
id,
|
|
2447
|
-
onMenuScrollToBottom,
|
|
2448
|
-
onInputChange,
|
|
2449
|
-
};
|
|
2450
|
-
return (jsxRuntime.jsxs(SelectContainer, Object.assign({ ref: refContainer, className: className, "data-testid": dataTestId, "$hasError": hasError, "$isDisabled": disabled }, { children: [prefix !== undefined && (jsxRuntime.jsx(SelectPrefix, Object.assign({ "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix }, { children: prefix }))), async ? (jsxRuntime.jsx(ReactAsyncSelect__default["default"], Object.assign({}, propsNoClassName, selectProps, async, { onMenuOpen: openMenuHandler, onMenuClose: closeMenuHandler }))) : (jsxRuntime.jsx(ReactSelect__default["default"], Object.assign({}, propsNoClassName, selectProps, { options: filterOption ? orderedOptions : options, hideSelectedOptions: false, isMulti: isMulti, onMenuOpen: openMenuHandler, onMenuClose: closeMenuHandler })))] })));
|
|
2451
|
-
};
|
|
2452
|
-
const SelectContainer = tailwindStyledComponents.tw.div `
|
|
2453
|
-
tu-select
|
|
2454
|
-
${({ $hasError }) => ($hasError ? tailwindStyledComponents.tws `tu-select--invalid` : null)}
|
|
2455
|
-
${({ $isDisabled }) => ($isDisabled ? tailwindStyledComponents.tws `tu-select--disabled` : null)}
|
|
2456
|
-
`;
|
|
2457
|
-
Select.displayName = "Select";
|
|
2458
|
-
|
|
2459
|
-
const COUNTRY_CODES_NOT_SUPPORTED_BY_BACKEND = ["53", "98", "211", "247", "249", "383", "850", "963"];
|
|
2460
|
-
const ADDITIONAL_COUNTRY_CODES_SUPPORTED_BY_BACKEND = [
|
|
2461
|
-
"1242",
|
|
2462
|
-
"1246",
|
|
2463
|
-
"1264",
|
|
2464
|
-
"1268",
|
|
2465
|
-
"1284",
|
|
2466
|
-
"1340",
|
|
2467
|
-
"1345",
|
|
2468
|
-
"1441",
|
|
2469
|
-
"1473",
|
|
2470
|
-
"1649",
|
|
2471
|
-
"1664",
|
|
2472
|
-
"1670",
|
|
2473
|
-
"1671",
|
|
2474
|
-
"1684",
|
|
2475
|
-
"1721",
|
|
2476
|
-
"1758",
|
|
2477
|
-
"1767",
|
|
2478
|
-
"1784",
|
|
2479
|
-
"1809",
|
|
2480
|
-
"1868",
|
|
2481
|
-
"1869",
|
|
2482
|
-
"1876",
|
|
2483
|
-
"379",
|
|
2484
|
-
"5999",
|
|
2485
|
-
"881",
|
|
2486
|
-
"882",
|
|
2487
|
-
"883",
|
|
2488
|
-
];
|
|
2489
|
-
const countryCodesSet = [
|
|
2490
|
-
...new Set(libphonenumberJs.getCountries().map(code => libphonenumberJs.getCountryCallingCode(code))),
|
|
2491
|
-
...ADDITIONAL_COUNTRY_CODES_SUPPORTED_BY_BACKEND,
|
|
2492
|
-
]
|
|
2493
|
-
.filter(code => !COUNTRY_CODES_NOT_SUPPORTED_BY_BACKEND.includes(code))
|
|
2494
|
-
.sort((a, b) => Number(a) - Number(b));
|
|
2495
|
-
const countryCodes = countryCodesSet.map(code => ({ label: `+${code}`, value: code }));
|
|
2496
|
-
|
|
2497
|
-
/**
|
|
2498
|
-
* The CountryCodeSelect component is used to select a country code for a phone number.
|
|
2499
|
-
*
|
|
2500
|
-
* @param {CountryCodeSelectProps} props - The props for the CountryCodeSelect component
|
|
2501
|
-
* @returns {JSX.Element} CountryCodeSelect component
|
|
2502
|
-
*/
|
|
2503
|
-
const CountryCodeSelect = ({ excludedCountries, countryCode, isInvalid, setCountryCode, }) => {
|
|
2504
|
-
const [isCountryCodeMissing, setIsCountryCodeMissing] = React.useState(false);
|
|
2505
|
-
React.useEffect(() => {
|
|
2506
|
-
countryCode && setIsCountryCodeMissing(false);
|
|
2507
|
-
}, [countryCode]);
|
|
2508
|
-
const filteredCodes = countryCodes.filter(code => {
|
|
2509
|
-
return !(excludedCountries === null || excludedCountries === void 0 ? void 0 : excludedCountries.some(excludedCode => excludedCode.value === code.value));
|
|
2510
|
-
});
|
|
2511
|
-
return (jsxRuntime.jsx(Select, { className: "w-28", "aria-invalid": isCountryCodeMissing, options: filteredCodes.map(code => code), value: filteredCodes.find(({ value: currentValue }) => currentValue === countryCode), onChange: input => {
|
|
2512
|
-
setCountryCode(input === null || input === void 0 ? void 0 : input.value);
|
|
2513
|
-
}, placeholder: "+45", hasError: isCountryCodeMissing || isInvalid, maxMenuHeight: 200 }));
|
|
2514
|
-
};
|
|
2515
|
-
|
|
2516
|
-
/**
|
|
2517
|
-
* A component for inputting phone numbers with an optional action button for initiating a phone call.
|
|
2518
|
-
*
|
|
2519
|
-
* @param {string} [dataTestId] - The data test ID for the component.
|
|
2520
|
-
* @param {boolean} [disabled=false] - Whether the component is disabled or not.
|
|
2521
|
-
* @param {string} [fieldSize="medium"] - The size of the input field.
|
|
2522
|
-
* @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
|
|
2523
|
-
* @returns {JSX.Element} - The PhoneInput component.
|
|
2524
|
-
*/
|
|
2525
|
-
const PhoneInput = React.forwardRef((_a, ref) => {
|
|
2526
|
-
var { dataTestId, isInvalid, disabled = false, fieldSize = "medium", disableAction = false } = _a, rest = __rest(_a, ["dataTestId", "isInvalid", "disabled", "fieldSize", "disableAction"]);
|
|
2527
|
-
const [phoneNumber, setPhoneNumber] = React.useState();
|
|
2528
|
-
const [renderAsInvalid, setRenderAsInvalid] = React.useState(false);
|
|
2529
|
-
const [countryCode, setCountryCode] = React.useState(undefined);
|
|
2530
|
-
const [isPhoneNumberInvalid, setIsPhoneNumberInvalid] = React.useState(false);
|
|
2531
|
-
const handlePhoneNumberChange = (e) => {
|
|
2532
|
-
const input = e.target.value;
|
|
2533
|
-
setIsPhoneNumberInvalid(!Boolean(input));
|
|
2534
|
-
setPhoneNumber(input);
|
|
2535
|
-
};
|
|
2536
|
-
React.useEffect(() => {
|
|
2537
|
-
setRenderAsInvalid(isInvalid || isPhoneNumberInvalid);
|
|
2538
|
-
}, [isInvalid, isPhoneNumberInvalid]);
|
|
2539
|
-
return (jsxRuntime.jsxs(Container, { children: [jsxRuntime.jsx(CountryCodeSelect, { isInvalid: renderAsInvalid, countryCode: countryCode, setCountryCode: setCountryCode }), jsxRuntime.jsx(BaseInput, Object.assign({ ref: ref, dataTestId: dataTestId, isInvalid: renderAsInvalid, fieldSize: fieldSize, type: "tel", value: phoneNumber, onChange: handlePhoneNumberChange, disabled: disabled, actions: !disableAction && (jsxRuntime.jsx(ActionButton, { disabled: !countryCode || !phoneNumber || disabled || renderAsInvalid, value: `${countryCode}${phoneNumber}`, type: "PHONE_NUMBER", dataTestId: dataTestId && `${dataTestId}-phoneIcon`, iconSize: fieldSize })) }, rest))] }));
|
|
2540
|
-
});
|
|
2541
|
-
const Container = tailwindStyledComponents.tw.div `
|
|
2542
|
-
grid
|
|
2543
|
-
grid-cols-min-fr
|
|
2544
|
-
gap-2
|
|
2545
|
-
`;
|
|
2546
|
-
|
|
2547
|
-
/**
|
|
2548
|
-
* The PhoneField component is used to enter phone number.
|
|
2549
|
-
* It is a wrapper around the PhoneInput component and the FormGroup component.
|
|
2550
|
-
* It is used to render a phone number field with a label, a tip, a help text, a help addon and an error message.
|
|
2551
|
-
*
|
|
2552
|
-
* @param {string} [label] - The label for the component.
|
|
2553
|
-
* @param {string} [tip] - The tip for the component.
|
|
2554
|
-
* @param {string} [helpText] - The help text for the component.
|
|
2555
|
-
* @param {string} [helpAddon] - The help addon for the component.
|
|
2556
|
-
* @param {string} [errorMessage] - The error message for the component.
|
|
2557
|
-
* @param {string} [defaultValue] - The default value for the component.
|
|
2558
|
-
* @param {boolean} [disabled=false] - Whether the component is disabled or not.
|
|
2559
|
-
* @param {string} [fieldSize="medium"] - The size of the input field.
|
|
2560
|
-
* @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
|
|
2561
|
-
* @returns {JSX.Element} - The PhoneField component.
|
|
2562
|
-
*/
|
|
2563
|
-
const PhoneField = React.forwardRef((_a, ref) => {
|
|
2564
|
-
var { label, id, tip, helpText, isInvalid, errorMessage, value, helpAddon, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "isInvalid", "errorMessage", "value", "helpAddon", "className", "defaultValue", "dataTestId"]);
|
|
2565
|
-
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
2566
|
-
const htmlForId = id ? id : "phoneField-" + uuid.v4();
|
|
2567
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, disabled: rest.disabled, className: className, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(PhoneInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", value: value || defaultValue, isInvalid: renderAsInvalid }, rest)) })));
|
|
2568
|
-
});
|
|
2569
|
-
|
|
2570
1663
|
function useConfirmExit(confirmExit, when = true) {
|
|
2571
1664
|
const { navigator } = React.useContext(reactRouterDom.UNSAFE_NavigationContext);
|
|
2572
1665
|
React.useEffect(() => {
|
|
@@ -2620,84 +1713,6 @@ const Prompt = ({ when, message }) => {
|
|
|
2620
1713
|
return null;
|
|
2621
1714
|
};
|
|
2622
1715
|
|
|
2623
|
-
const RadioGroupContext = React__namespace.createContext(null);
|
|
2624
|
-
|
|
2625
|
-
/**
|
|
2626
|
-
* Use radio buttons when you have a group of mutually exclusive choices and only one selection from the group is allowed.
|
|
2627
|
-
*
|
|
2628
|
-
* Radio buttons are used for mutually exclusive choices, not for multiple choices. Only one radio button can be selected at a time. When a user chooses a new item, the previous choice is automatically deselected.
|
|
2629
|
-
*
|
|
2630
|
-
* _**Do use** Radio buttons in forms, settings, or selections in a list._
|
|
2631
|
-
*
|
|
2632
|
-
* _**Do not use** Radio buttons if a user can select many option from a list, use checkboxes instead of radio buttons._
|
|
2633
|
-
*
|
|
2634
|
-
* @param {RadioGroupProps} props - The props for the RadioGroup component
|
|
2635
|
-
* @returns {JSX.Element} RadioGroup component
|
|
2636
|
-
*/
|
|
2637
|
-
const RadioGroup = ({ children, id, name, value, disabled, onChange, label, inline, className, dataTestId, isInvalid, }) => {
|
|
2638
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ label: label, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(Flex, Object.assign({ "$inline": inline, className: className, "data-testid": dataTestId }, { children: jsxRuntime.jsx(RadioGroupContext.Provider, Object.assign({ value: {
|
|
2639
|
-
id,
|
|
2640
|
-
value,
|
|
2641
|
-
name: name || id,
|
|
2642
|
-
onChange,
|
|
2643
|
-
disabled,
|
|
2644
|
-
isInvalid,
|
|
2645
|
-
} }, { children: children })) })) })));
|
|
2646
|
-
};
|
|
2647
|
-
RadioGroup.displayName = "RadioGroup";
|
|
2648
|
-
const Flex = tailwindStyledComponents.tw.div `
|
|
2649
|
-
${({ $inline }) => ($inline ? tailwindStyledComponents.tws `tu-radiogroup--inline` : tailwindStyledComponents.tws `tu-radiogroup`)}
|
|
2650
|
-
`;
|
|
2651
|
-
|
|
2652
|
-
/**
|
|
2653
|
-
* The RadioItem component.
|
|
2654
|
-
*
|
|
2655
|
-
* @param {RadioItemProps} props - The props for the RadioItem component
|
|
2656
|
-
* @returns {JSX.Element} RadioItem component
|
|
2657
|
-
*/
|
|
2658
|
-
const RadioItem = ({ label, value, dataTestId, className, description }) => {
|
|
2659
|
-
const groupCtx = React__namespace.useContext(RadioGroupContext);
|
|
2660
|
-
const isChecked = (groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.value) === value;
|
|
2661
|
-
return (jsxRuntime.jsxs(InputWrapper, Object.assign({ className: className, htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Wrapper` }, { children: [jsxRuntime.jsx(Input, { id: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, type: "radio", role: "radio", value: value, checked: isChecked, "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled, "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid, onChange: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.onChange, "data-testid": dataTestId, "$checked": isChecked }), jsxRuntime.jsxs(LabelContainer$1, { children: [jsxRuntime.jsx(Label$2, Object.assign({ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, dataTestId: dataTestId && `${dataTestId}-Label`, disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled, isInvalid: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid }, { children: label })), description && (jsxRuntime.jsx(Description$1, Object.assign({ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Description`, "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled }, { children: description })))] })] })));
|
|
2662
|
-
};
|
|
2663
|
-
const InputWrapper = tailwindStyledComponents.tw.label `tu-radioitem__wrapper`;
|
|
2664
|
-
const Input = tailwindStyledComponents.tw.input `
|
|
2665
|
-
tu-radioitem
|
|
2666
|
-
${({ $checked }) => $checked && tailwindStyledComponents.tws `tu-radioitem--checked`}
|
|
2667
|
-
${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-radioitem--disabled`}
|
|
2668
|
-
${({ $isInvalid }) => $isInvalid && tailwindStyledComponents.tws `tu-radioitem--invalid`}
|
|
2669
|
-
`;
|
|
2670
|
-
const LabelContainer$1 = tailwindStyledComponents.tw.div `tu-radioitem__label-container`;
|
|
2671
|
-
const Description$1 = tailwindStyledComponents.tw.label `
|
|
2672
|
-
tu-radioitem__description
|
|
2673
|
-
${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-radioitem__description--disabled`}
|
|
2674
|
-
`;
|
|
2675
|
-
|
|
2676
|
-
/**
|
|
2677
|
-
* A thin wrapper around the `BaseInput` component for text input fields.
|
|
2678
|
-
*
|
|
2679
|
-
* NOTE: If shown with a label, please use the `TextField` component instead.
|
|
2680
|
-
*/
|
|
2681
|
-
const TextInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BaseInput, Object.assign({ ref: ref, type: "text" }, props))));
|
|
2682
|
-
|
|
2683
|
-
/**
|
|
2684
|
-
* The Search component is used to render a search input field.
|
|
2685
|
-
*
|
|
2686
|
-
* @param {SearchProps} props - The props for the Search component
|
|
2687
|
-
* @returns {JSX.Element} Search component
|
|
2688
|
-
*/
|
|
2689
|
-
const Search = (_a) => {
|
|
2690
|
-
var { className, placeholder = "Search", value, widenInputOnFocus, showBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", ref } = _a, rest = __rest(_a, ["className", "placeholder", "value", "widenInputOnFocus", "showBorderWhenNotInFocus", "disabled", "onKeyUp", "onChange", "onFocus", "onBlur", "name", "onClear", "dataTestId", "autoComplete", "ref"]);
|
|
2691
|
-
return (jsxRuntime.jsx(StyledTextInput, Object.assign({}, rest, { ref: ref, dataTestId: dataTestId, name: name, className: className, "$widenOnFocus": widenInputOnFocus, "$showBorderWhenNotInFocus": showBorderWhenNotInFocus, placeholder: placeholder, prefix: jsxRuntime.jsx(Icon, { name: "MagnifyingGlassIcon", size: "medium" }), suffix: onClear ? (jsxRuntime.jsx("button", Object.assign({ "data-testid": dataTestId && `${dataTestId}_suffix_component`, onClick: () => {
|
|
2692
|
-
onClear();
|
|
2693
|
-
} }, { children: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }) }))) : undefined, value: value, disabled: disabled, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, autoComplete: autoComplete })));
|
|
2694
|
-
};
|
|
2695
|
-
const StyledTextInput = tailwindStyledComponents.twx(TextInput) `
|
|
2696
|
-
tu-search
|
|
2697
|
-
${({ $showBorderWhenNotInFocus }) => $showBorderWhenNotInFocus && tailwindStyledComponents.tws `tu-search--border`}
|
|
2698
|
-
${({ $widenOnFocus }) => $widenOnFocus && tailwindStyledComponents.tws `tu-search--widen-on-focus`}
|
|
2699
|
-
`;
|
|
2700
|
-
|
|
2701
1716
|
/**
|
|
2702
1717
|
* The Spacer component is used for adding a bit of space in the ui.
|
|
2703
1718
|
*
|
|
@@ -2810,7 +1825,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2810
1825
|
}
|
|
2811
1826
|
return tailwindStyledComponents.tws `visible`;
|
|
2812
1827
|
};
|
|
2813
|
-
return (jsxRuntime.jsxs(Root$
|
|
1828
|
+
return (jsxRuntime.jsxs(Root$1, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsxRuntime.jsx(ChildContainer, Object.assign({ "$breakpoint": breakpoint, ref: overflowContainerRef, className: childContainerClassName, "data-testid": dataTestId && `${dataTestId}-child-container` }, { children: React__default["default"].Children.map(children, child => {
|
|
2814
1829
|
return React__default["default"].cloneElement(child, {
|
|
2815
1830
|
className: `${child.props.className} ${itemVisibilityClassName(child.props.id)}`,
|
|
2816
1831
|
});
|
|
@@ -2830,7 +1845,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2830
1845
|
: null;
|
|
2831
1846
|
}) }))) }))) : null] })));
|
|
2832
1847
|
};
|
|
2833
|
-
const Root$
|
|
1848
|
+
const Root$1 = tailwindStyledComponents.tw.div `
|
|
2834
1849
|
tu-sidebar
|
|
2835
1850
|
`;
|
|
2836
1851
|
const breakpointClasses = {
|
|
@@ -2847,85 +1862,6 @@ const ChildContainer = tailwindStyledComponents.tw.div `
|
|
|
2847
1862
|
${({ $breakpoint }) => breakpointClasses[$breakpoint]}
|
|
2848
1863
|
`;
|
|
2849
1864
|
|
|
2850
|
-
/**
|
|
2851
|
-
* The TextArea is a base component, and should not be used very often.
|
|
2852
|
-
* For most cases the TextAreaField is the correct component.
|
|
2853
|
-
*/
|
|
2854
|
-
const TextArea = React__namespace.forwardRef((_a, ref) => {
|
|
2855
|
-
var { id, name, value, rows, disabled, placeholder, readOnly, tabIndex, onChange, onFocus, onBlur, maxLength, resize = "vertical", defaultValue, className, required, dataTestId, isInvalid } = _a, rest = __rest(_a, ["id", "name", "value", "rows", "disabled", "placeholder", "readOnly", "tabIndex", "onChange", "onFocus", "onBlur", "maxLength", "resize", "defaultValue", "className", "required", "dataTestId", "isInvalid"]);
|
|
2856
|
-
return (jsxRuntime.jsx(StyledTextArea, Object.assign({ id: id, name: name, value: value, rows: rows, disabled: disabled, placeholder: placeholder, readOnly: readOnly, tabIndex: tabIndex, onFocus: onFocus, onBlur: onBlur, maxLength: maxLength, "$resize": resize, "$invalid": isInvalid, ref: ref, defaultValue: defaultValue, required: required }, rest, { onChange: onChange, "data-testid": dataTestId })));
|
|
2857
|
-
});
|
|
2858
|
-
const StyledTextArea = tailwindStyledComponents.tw.textarea `
|
|
2859
|
-
tu-textarea
|
|
2860
|
-
${({ $invalid }) => ($invalid ? tailwindStyledComponents.tws `tu-textarea--invalid` : null)}
|
|
2861
|
-
${({ disabled }) => (disabled ? tailwindStyledComponents.tws `tu-textarea--disabled` : null)}
|
|
2862
|
-
${({ $resize }) => {
|
|
2863
|
-
switch ($resize) {
|
|
2864
|
-
case "both":
|
|
2865
|
-
return tailwindStyledComponents.tws `resize`;
|
|
2866
|
-
case "horizontal":
|
|
2867
|
-
return tailwindStyledComponents.tws `resize-x`;
|
|
2868
|
-
case "vertical":
|
|
2869
|
-
return tailwindStyledComponents.tws `resize-y`;
|
|
2870
|
-
case "none":
|
|
2871
|
-
return tailwindStyledComponents.tws `resize-none`;
|
|
2872
|
-
default:
|
|
2873
|
-
return null;
|
|
2874
|
-
}
|
|
2875
|
-
}};
|
|
2876
|
-
`;
|
|
2877
|
-
|
|
2878
|
-
/**
|
|
2879
|
-
* The TextLengthIndicator component shows a `{length}/{maxLength}` label.
|
|
2880
|
-
* Used for TextFields to communicate a maximum allowed input length.
|
|
2881
|
-
*
|
|
2882
|
-
* @param {TextLengthIndicatorProps} props - The props for the TextLengthIndicator component
|
|
2883
|
-
* @returns {JSX.Element} TextLengthIndicator component
|
|
2884
|
-
*/
|
|
2885
|
-
const TextLengthIndicator = ({ length, maxLength }) => {
|
|
2886
|
-
return (jsxRuntime.jsxs(Root$1, { children: [length, "/", maxLength] }));
|
|
2887
|
-
};
|
|
2888
|
-
const Root$1 = tailwindStyledComponents.tw.span `
|
|
2889
|
-
font-mono
|
|
2890
|
-
`;
|
|
2891
|
-
|
|
2892
|
-
const TextAreaField = React__namespace.forwardRef((_a, ref) => {
|
|
2893
|
-
var { id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["id", "label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
2894
|
-
const [valueLength, setValueLength] = React__namespace.useState(value ? `${value}`.length : 0);
|
|
2895
|
-
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
2896
|
-
const htmlForId = id ? id : "textAreaField-" + uuid.v4();
|
|
2897
|
-
const handleChange = React__namespace.useCallback((event) => {
|
|
2898
|
-
setValueLength(event.target.value.length);
|
|
2899
|
-
if (onChange) {
|
|
2900
|
-
onChange(event);
|
|
2901
|
-
}
|
|
2902
|
-
}, [onChange]);
|
|
2903
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, helpAddon: helpAddon ||
|
|
2904
|
-
(maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), className: className, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(TextArea, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, onChange: handleChange, dataTestId: dataTestId })) })));
|
|
2905
|
-
});
|
|
2906
|
-
|
|
2907
|
-
/**
|
|
2908
|
-
* Text fields enable the user to interact with and input content and data. This component can be used for long and short form entries. Allow the size of the text input box to reflect the length of the content you expect the user to enter.
|
|
2909
|
-
*
|
|
2910
|
-
* _**Do use** when the user has to input or edit simple text based information, such as metadata._
|
|
2911
|
-
*
|
|
2912
|
-
* _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
|
|
2913
|
-
*/
|
|
2914
|
-
const TextField = React__namespace.forwardRef((_a, ref) => {
|
|
2915
|
-
var { id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["id", "label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
2916
|
-
const [valueLength, setValueLength] = React__namespace.useState(value ? `${value}`.length : 0);
|
|
2917
|
-
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
2918
|
-
const htmlFor = id ? id : "textField-" + uuid.v4();
|
|
2919
|
-
const handleChange = React__namespace.useCallback((event) => {
|
|
2920
|
-
setValueLength(event.target.value.length);
|
|
2921
|
-
if (onChange) {
|
|
2922
|
-
onChange(event);
|
|
2923
|
-
}
|
|
2924
|
-
}, [onChange]);
|
|
2925
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlFor, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon ||
|
|
2926
|
-
(maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), dataTestId: dataTestId && `${dataTestId}-FormGroup`, disabled: rest.readOnly }, { children: jsxRuntime.jsx(TextInput, Object.assign({ id: htmlFor, "aria-labelledby": htmlFor + "-label", ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, onChange: handleChange, dataTestId: dataTestId })) })));
|
|
2927
|
-
});
|
|
2928
|
-
|
|
2929
1865
|
/**
|
|
2930
1866
|
* Timeline - used to contain TimelineElements for building a sequence of timed entries - each rendered on a line
|
|
2931
1867
|
* - with an indicator (dot)
|
|
@@ -2955,68 +1891,6 @@ function defaultHeader(date, showTime) {
|
|
|
2955
1891
|
})})`;
|
|
2956
1892
|
}
|
|
2957
1893
|
|
|
2958
|
-
/**
|
|
2959
|
-
* Use Toggle when you have to only enable/disable a feature.
|
|
2960
|
-
*
|
|
2961
|
-
* _**Do use** Toggle in forms or settings._
|
|
2962
|
-
*
|
|
2963
|
-
* _**Do not use** Toggle if a user can select many option from a list, use checkboxes instead of toggle._
|
|
2964
|
-
*
|
|
2965
|
-
* @param {ToggleProps} props - The props for the Toggle component
|
|
2966
|
-
* @returns {JSX.Element} Toggle component
|
|
2967
|
-
*/
|
|
2968
|
-
const Toggle = React__namespace.forwardRef(({ toggled = false, onChange, disabled, size = "medium", id, tabIndex, required, className, dataTestId, onBlur, name, description = "", }, ref) => {
|
|
2969
|
-
return (jsxRuntime.jsxs(ToggleWrapper, { children: [jsxRuntime.jsxs(InputContainer, Object.assign({ htmlFor: id }, { children: [jsxRuntime.jsx(HiddenInput, { name: name, type: "checkbox", checked: toggled, disabled: disabled, onChange: e => {
|
|
2970
|
-
e.stopPropagation();
|
|
2971
|
-
onChange(!toggled, e);
|
|
2972
|
-
}, id: id, "aria-checked": toggled, role: "checkbox", tabIndex: tabIndex, required: required, ref: ref, "data-testid": dataTestId && `${dataTestId}-Input`, onBlur: onBlur }), jsxRuntime.jsx(SwitchContainer, Object.assign({ "$toggled": toggled, htmlFor: id, "$disabled": disabled, "$size": size }, { children: jsxRuntime.jsx(Switch, { "$toggled": toggled, htmlFor: id, "data-testid": dataTestId && `${dataTestId}-Switch` }) }))] })), jsxRuntime.jsxs(LabelContainer, { children: [jsxRuntime.jsx(Label$2, Object.assign({ htmlFor: id, dataTestId: dataTestId && `${dataTestId}-Label`, disabled: disabled }, { children: name })), description && (jsxRuntime.jsx(Description, Object.assign({ htmlFor: id, "data-testid": dataTestId && `${dataTestId}-Description`, "$disabled": disabled }, { children: description })))] })] }));
|
|
2973
|
-
});
|
|
2974
|
-
Toggle.displayName = "Toggle";
|
|
2975
|
-
const ToggleWrapper = tailwindStyledComponents.tw.div `tu-toggle__wrapper`;
|
|
2976
|
-
const InputContainer = tailwindStyledComponents.tw.label `tu-toggle__input-container `;
|
|
2977
|
-
const HiddenInput = tailwindStyledComponents.tw.input `tu-toggle__input`;
|
|
2978
|
-
const Switch = tailwindStyledComponents.tw.label `
|
|
2979
|
-
${({ $toggled }) => ($toggled ? tailwindStyledComponents.tws `tu-toggle__switch` : tailwindStyledComponents.tws `tu-toggle`)}`;
|
|
2980
|
-
const SwitchContainer = tailwindStyledComponents.tw.label `
|
|
2981
|
-
tu-toggle__switch-container
|
|
2982
|
-
${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-toggle--disabled`};
|
|
2983
|
-
${({ $size }) => ($size === "small" ? tailwindStyledComponents.tws `tu-toggle--small` : tailwindStyledComponents.tws `tu-toggle--medium`)};
|
|
2984
|
-
${({ $toggled }) => $toggled && tailwindStyledComponents.tws `tu-toggle--toggled`}`;
|
|
2985
|
-
const LabelContainer = tailwindStyledComponents.tw.div `tu-toggle__label-container`;
|
|
2986
|
-
const Description = tailwindStyledComponents.tw.label `
|
|
2987
|
-
tu-toggle__description
|
|
2988
|
-
${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-toggle__description--disabled`}
|
|
2989
|
-
`;
|
|
2990
|
-
|
|
2991
|
-
/**
|
|
2992
|
-
* A thin wrapper around the `BaseInput` component for upload input fields.
|
|
2993
|
-
*
|
|
2994
|
-
* NOTE: If shown with a label, please use the `UploadField` component instead.
|
|
2995
|
-
*/
|
|
2996
|
-
const UploadInput = React.forwardRef((_a, ref) => {
|
|
2997
|
-
var { disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles } = _a, rest = __rest(_a, ["disabled", "acceptedTypes", "nonInteractive", "uploadLabel", "multipleFiles"]);
|
|
2998
|
-
return (jsxRuntime.jsx(UploadInputContainer, { children: jsxRuntime.jsx(BaseInput, Object.assign({ addonBefore: uploadLabel, ref: ref, disabled: disabled, accept: acceptedTypes, multiple: multipleFiles, type: "file", nonInteractive: nonInteractive,
|
|
2999
|
-
// onClick used to work with nonInteractive option
|
|
3000
|
-
onClick: event => {
|
|
3001
|
-
if (nonInteractive) {
|
|
3002
|
-
event.preventDefault();
|
|
3003
|
-
event.stopPropagation();
|
|
3004
|
-
}
|
|
3005
|
-
} }, rest)) }));
|
|
3006
|
-
});
|
|
3007
|
-
const UploadInputContainer = tailwindStyledComponents.tw.label `
|
|
3008
|
-
tu-upload-input`;
|
|
3009
|
-
|
|
3010
|
-
/**
|
|
3011
|
-
* Upload fields enable the user to upload Files.
|
|
3012
|
-
*/
|
|
3013
|
-
const UploadField = React.forwardRef((_a, ref) => {
|
|
3014
|
-
var { label, id, tip, helpText, errorMessage, isInvalid, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "isInvalid", "className", "value", "dataTestId"]);
|
|
3015
|
-
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
3016
|
-
const htmlForId = id ? id : "uploadField-" + uuid.v4();
|
|
3017
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, dataTestId: `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(UploadInput, Object.assign({ ref: ref, id: htmlForId, "aria-labelledby": htmlForId + "-label", isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
|
|
3018
|
-
});
|
|
3019
|
-
|
|
3020
1894
|
/**
|
|
3021
1895
|
* Helper function to get normalized score in range 0-1 used by the ValueBar
|
|
3022
1896
|
*
|
|
@@ -3291,37 +2165,23 @@ const Layout = tailwindStyledComponents.tw.div `
|
|
|
3291
2165
|
tu-layout-TwoColumnLayout
|
|
3292
2166
|
`;
|
|
3293
2167
|
|
|
3294
|
-
Object.defineProperty(exports, 'ValueType', {
|
|
3295
|
-
enumerable: true,
|
|
3296
|
-
get: function () { return ReactSelect__default["default"]; }
|
|
3297
|
-
});
|
|
3298
|
-
exports.ActionButton = ActionButton;
|
|
3299
2168
|
exports.Alert = Alert;
|
|
3300
2169
|
exports.Badge = Badge;
|
|
3301
|
-
exports.BaseInput = BaseInput;
|
|
3302
2170
|
exports.Button = Button;
|
|
3303
2171
|
exports.Card = Card;
|
|
3304
2172
|
exports.CardBody = CardBody;
|
|
3305
2173
|
exports.CardFooter = CardFooter;
|
|
3306
2174
|
exports.CardHeader = CardHeader;
|
|
3307
|
-
exports.Checkbox = Checkbox;
|
|
3308
2175
|
exports.Collapse = Collapse;
|
|
3309
2176
|
exports.ContentGridArea = ContentGridArea;
|
|
3310
2177
|
exports.CopyableText = CopyableText;
|
|
3311
|
-
exports.CreatableSelect = CreatableSelect;
|
|
3312
|
-
exports.DateField = DateField;
|
|
3313
|
-
exports.DateInput = DateInput;
|
|
3314
2178
|
exports.DayPicker = DayPicker;
|
|
3315
2179
|
exports.DayPickerPopover = DayPickerPopover;
|
|
3316
2180
|
exports.DayRangePicker = DayRangePicker;
|
|
3317
2181
|
exports.DensityContainer = DensityContainer;
|
|
3318
2182
|
exports.Drawer = Drawer;
|
|
3319
|
-
exports.DropZone = DropZone;
|
|
3320
|
-
exports.EmailField = EmailField;
|
|
3321
|
-
exports.EmailInput = EmailInput;
|
|
3322
2183
|
exports.ExternalLink = ExternalLink;
|
|
3323
2184
|
exports.FilterListMapLayout = FilterListMapLayout;
|
|
3324
|
-
exports.FormGroup = FormGroup;
|
|
3325
2185
|
exports.FullWidthRepeatingLayout = FullWidthRepeatingLayout;
|
|
3326
2186
|
exports.GridArea = GridArea;
|
|
3327
2187
|
exports.Heading = Heading$1;
|
|
@@ -3329,64 +2189,42 @@ exports.Icon = Icon;
|
|
|
3329
2189
|
exports.IconButton = IconButton;
|
|
3330
2190
|
exports.Indicator = Indicator;
|
|
3331
2191
|
exports.IntrinsicallyResponsiveGrid = IntrinsicallyResponsiveGrid;
|
|
3332
|
-
exports.Label = Label$2;
|
|
3333
2192
|
exports.MenuItem = MenuItem;
|
|
3334
2193
|
exports.MenuList = MenuList;
|
|
3335
2194
|
exports.MinTopFullContentLayout = MinTopFullContentLayout;
|
|
3336
2195
|
exports.Modal = Modal;
|
|
3337
2196
|
exports.ModalBackdrop = ModalBackdrop;
|
|
3338
2197
|
exports.MoreMenu = MoreMenu;
|
|
3339
|
-
exports.MultiSelectMenuItem = MultiSelectMenuItem;
|
|
3340
2198
|
exports.NavGridArea = NavGridArea;
|
|
3341
|
-
exports.NumberField = NumberField;
|
|
3342
|
-
exports.NumberInput = NumberInput;
|
|
3343
2199
|
exports.PageHeader = PageHeader;
|
|
3344
2200
|
exports.Pagination = Pagination;
|
|
3345
|
-
exports.PhoneField = PhoneField;
|
|
3346
|
-
exports.PhoneInput = PhoneInput;
|
|
3347
2201
|
exports.Popover = Popover;
|
|
3348
2202
|
exports.PopoverContent = PopoverContent;
|
|
3349
2203
|
exports.PopoverTitle = PopoverTitle;
|
|
3350
2204
|
exports.PopoverTrigger = PopoverTrigger;
|
|
3351
2205
|
exports.Prompt = Prompt;
|
|
3352
2206
|
exports.ROLE_CARD = ROLE_CARD;
|
|
3353
|
-
exports.RadioGroup = RadioGroup;
|
|
3354
|
-
exports.RadioItem = RadioItem;
|
|
3355
|
-
exports.Search = Search;
|
|
3356
2207
|
exports.SectionHeader = SectionHeader;
|
|
3357
|
-
exports.Select = Select;
|
|
3358
|
-
exports.SelectPrefix = SelectPrefix;
|
|
3359
2208
|
exports.Sidebar = Sidebar;
|
|
3360
|
-
exports.SingleSelectMenuItem = SingleSelectMenuItem;
|
|
3361
2209
|
exports.SkeletonLines = SkeletonLines;
|
|
3362
2210
|
exports.Spacer = Spacer;
|
|
3363
2211
|
exports.Spinner = Spinner;
|
|
3364
2212
|
exports.StarButton = StarButton;
|
|
3365
2213
|
exports.Tag = Tag;
|
|
3366
2214
|
exports.Text = Text$1;
|
|
3367
|
-
exports.TextArea = TextArea;
|
|
3368
|
-
exports.TextAreaField = TextAreaField;
|
|
3369
|
-
exports.TextField = TextField;
|
|
3370
|
-
exports.TextInput = TextInput;
|
|
3371
2215
|
exports.Timeline = Timeline;
|
|
3372
2216
|
exports.TimelineElement = TimelineElement;
|
|
3373
2217
|
exports.Tip = Tip;
|
|
3374
2218
|
exports.TitleGridArea = TitleGridArea;
|
|
3375
2219
|
exports.TitleNavContentLayout = TitleNavContentLayout;
|
|
3376
|
-
exports.Toggle = Toggle;
|
|
3377
2220
|
exports.Tooltip = Tooltip;
|
|
3378
2221
|
exports.TwoColumnLayout = TwoColumnLayout;
|
|
3379
|
-
exports.UploadField = UploadField;
|
|
3380
|
-
exports.UploadInput = UploadInput;
|
|
3381
2222
|
exports.ValueBar = ValueBar;
|
|
3382
2223
|
exports.docs = docs;
|
|
3383
2224
|
exports.getDevicePixelRatio = getDevicePixelRatio;
|
|
3384
|
-
exports.getOrderedOptions = getOrderedOptions;
|
|
3385
2225
|
exports.getValueBarColorByValue = getValueBarColorByValue;
|
|
3386
|
-
exports.isMultiValue = isMultiValue;
|
|
3387
2226
|
exports.useClickOutside = useClickOutside;
|
|
3388
2227
|
exports.useContainerProps = useContainerProps;
|
|
3389
|
-
exports.useCustomComponents = useCustomComponents;
|
|
3390
2228
|
exports.useDebounce = useDebounce;
|
|
3391
2229
|
exports.useDevicePixelRatio = useDevicePixelRatio;
|
|
3392
2230
|
exports.useLocalStorage = useLocalStorage;
|